summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.bzrignore1206
-rw-r--r--.gitattributes30
-rw-r--r--.gitignore453
-rw-r--r--CMakeLists.txt12
-rw-r--r--VERSION2
-rw-r--r--client/mysql_upgrade.c118
-rw-r--r--client/mysqladmin.cc5
-rw-r--r--client/mysqlbinlog.cc9
-rw-r--r--client/mysqlcheck.c271
-rw-r--r--client/mysqldump.c68
-rw-r--r--client/mysqltest.cc53
-rw-r--r--cmake/abi_check.cmake2
-rw-r--r--cmake/compile_flags.cmake8
-rw-r--r--cmake/cpack_rpm.cmake3
-rw-r--r--cmake/cpack_source_ignore_files.cmake5
-rw-r--r--cmake/do_abi_check.cmake2
-rw-r--r--cmake/info_macros.cmake.in47
-rw-r--r--cmake/info_src.cmake8
-rw-r--r--cmake/libutils.cmake8
-rw-r--r--cmake/maintainer.cmake6
-rw-r--r--cmake/make_dist.cmake.in51
-rw-r--r--cmake/os/WindowsCache.cmake5
-rw-r--r--cmake/plugin.cmake7
-rw-r--r--cmake/ssl.cmake42
-rw-r--r--cmd-line-utils/libedit/el_terminal.h4
-rw-r--r--cmd-line-utils/libedit/emacs.c8
-rw-r--r--cmd-line-utils/libedit/terminal.c15
-rw-r--r--cmd-line-utils/libedit/vi.c8
-rw-r--r--config.h.cmake26
-rw-r--r--configure.cmake15
-rw-r--r--debian/dist/Debian/control66
-rw-r--r--debian/dist/Debian/mariadb-server-10.0.postinst5
-rw-r--r--debian/dist/Ubuntu/control58
-rw-r--r--debian/dist/Ubuntu/mariadb-server-10.0.postinst7
-rw-r--r--extra/yassl/CMakeLists.txt9
-rw-r--r--extra/yassl/README10
-rw-r--r--extra/yassl/examples/client/client.cpp11
-rw-r--r--extra/yassl/examples/server/server.cpp23
-rw-r--r--extra/yassl/include/openssl/ssl.h2
-rw-r--r--extra/yassl/include/yassl_int.hpp21
-rw-r--r--extra/yassl/src/yassl_imp.cpp29
-rw-r--r--extra/yassl/src/yassl_int.cpp76
-rw-r--r--extra/yassl/taocrypt/src/asn.cpp8
-rw-r--r--extra/yassl/taocrypt/src/integer.cpp10
-rw-r--r--extra/yassl/testsuite/cipher-test.sh130
-rw-r--r--extra/yassl/testsuite/test.hpp42
-rw-r--r--include/atomic/gcc_builtins.h4
-rw-r--r--include/my_stacktrace.h3
-rw-r--r--include/myisamchk.h1
-rw-r--r--include/mysql.h6
-rw-r--r--include/mysql.h.pp9
-rw-r--r--include/mysql/client_plugin.h.pp2
-rw-r--r--include/mysql/plugin_audit.h.pp16
-rw-r--r--include/mysql/plugin_auth.h.pp17
-rw-r--r--include/mysql/plugin_ftparser.h.pp15
-rw-r--r--include/mysql/psi/mysql_statement.h26
-rw-r--r--include/mysql/psi/psi.h57
-rw-r--r--include/mysql/psi/psi_abi_v0.h.pp2
-rw-r--r--include/mysql/psi/psi_abi_v1.h.pp25
-rw-r--r--include/mysql/psi/psi_abi_v2.h.pp3
-rw-r--r--include/mysql_com.h5
-rw-r--r--include/violite.h2
-rw-r--r--include/welcome_copyright_notice.h6
-rw-r--r--libmysql/CMakeLists.txt5
-rw-r--r--libmysql/libmysql.c31
-rw-r--r--libmysqld/CMakeLists.txt2
-rw-r--r--mysql-test/extra/binlog_tests/database.test35
-rw-r--r--mysql-test/extra/rpl_tests/rpl_row_annotate.test29
-rw-r--r--mysql-test/include/ctype_utf8_ilseq.inc114
-rw-r--r--mysql-test/include/default_mysqld.cnf1
-rw-r--r--mysql-test/include/have_ipv6.inc20
-rw-r--r--mysql-test/include/mtr_warnings.sql6
-rw-r--r--mysql-test/include/no_protocol.inc (renamed from mysql-test/suite/perfschema/include/no_protocol.inc)2
-rw-r--r--mysql-test/include/show_slave_status.inc52
-rw-r--r--mysql-test/include/shutdown_mysqld.inc18
-rw-r--r--mysql-test/include/start_mysqld.inc14
-rw-r--r--mysql-test/lib/My/SafeProcess/safe_process.cc18
-rwxr-xr-xmysql-test/lib/generate-ssl-certs.sh30
-rwxr-xr-xmysql-test/mysql-test-run.pl34
-rw-r--r--mysql-test/r/alter_table.result13
-rw-r--r--mysql-test/r/alter_table_online.result4
-rw-r--r--mysql-test/r/blackhole.result7
-rw-r--r--mysql-test/r/bootstrap.result11
-rw-r--r--mysql-test/r/bug46261.result8
-rw-r--r--mysql-test/r/create.result2
-rw-r--r--mysql-test/r/ctype_binary.result6
-rw-r--r--mysql-test/r/ctype_create.result32
-rw-r--r--mysql-test/r/ctype_latin1.result6
-rw-r--r--mysql-test/r/ctype_uca.result412
-rw-r--r--mysql-test/r/ctype_uca_innodb.result218
-rw-r--r--mysql-test/r/ctype_upgrade.result22
-rw-r--r--mysql-test/r/ctype_utf8.result649
-rw-r--r--mysql-test/r/derived.result12
-rw-r--r--mysql-test/r/derived_opt.result40
-rw-r--r--mysql-test/r/derived_view.result6
-rw-r--r--mysql-test/r/dyncol.result6
-rw-r--r--mysql-test/r/empty_server_name-8224.result1
-rw-r--r--mysql-test/r/error_simulation.result21
-rw-r--r--mysql-test/r/explain_non_select.result13
-rw-r--r--mysql-test/r/features.result3
-rw-r--r--mysql-test/r/file_contents.result2
-rw-r--r--mysql-test/r/filesort_bad_i_s-7585.result9
-rw-r--r--mysql-test/r/func_gconcat.result12
-rw-r--r--mysql-test/r/func_regexp_pcre.result29
-rw-r--r--mysql-test/r/func_regexp_pcre_debug.result10
-rw-r--r--mysql-test/r/func_set.result2
-rw-r--r--mysql-test/r/func_time.result42
-rw-r--r--mysql-test/r/function_defaults.result60
-rw-r--r--mysql-test/r/function_defaults_innodb.result60
-rw-r--r--mysql-test/r/galera_sst_mode.result24
-rw-r--r--mysql-test/r/gis.result15
-rw-r--r--mysql-test/r/group_by.result10
-rw-r--r--mysql-test/r/group_by_innodb.result44
-rw-r--r--mysql-test/r/having.result31
-rw-r--r--mysql-test/r/information_schema.result15
-rw-r--r--mysql-test/r/information_schema2.result12
-rw-r--r--mysql-test/r/innodb_mysql_sync.result1
-rw-r--r--mysql-test/r/join_cache.result13
-rw-r--r--mysql-test/r/log_errchk.result5
-rw-r--r--mysql-test/r/log_tables_upgrade.result11
-rw-r--r--mysql-test/r/multi_update.result194
-rw-r--r--mysql-test/r/myisam.result11
-rw-r--r--mysql-test/r/mysql_tzinfo_to_sql_symlink.result9
-rw-r--r--mysql-test/r/mysql_upgrade-6984.result11
-rw-r--r--mysql-test/r/mysql_upgrade.result97
-rw-r--r--mysql-test/r/mysql_upgrade_no_innodb.result9
-rw-r--r--mysql-test/r/mysql_upgrade_ssl.result11
-rw-r--r--mysql-test/r/mysql_upgrade_view.result321
-rw-r--r--mysql-test/r/mysqlcheck.result34
-rw-r--r--mysql-test/r/mysqld--help.result3
-rw-r--r--mysql-test/r/openssl_1.result8
-rw-r--r--mysql-test/r/partition_innodb.result23
-rw-r--r--mysql-test/r/partition_innodb_plugin.result4
-rw-r--r--mysql-test/r/partition_myisam.result2
-rw-r--r--mysql-test/r/partition_not_blackhole.result2
-rw-r--r--mysql-test/r/plugin.result13
-rw-r--r--mysql-test/r/range_innodb.result39
-rw-r--r--mysql-test/r/repair.result7
-rw-r--r--mysql-test/r/select_jcl6.result4
-rw-r--r--mysql-test/r/selectivity.result36
-rw-r--r--mysql-test/r/selectivity_innodb.result54
-rw-r--r--mysql-test/r/show_grants_with_plugin-7985.result197
-rw-r--r--mysql-test/r/sp-destruct.result4
-rw-r--r--mysql-test/r/sp-innodb.result100
-rw-r--r--mysql-test/r/sp_notembedded.result19
-rw-r--r--mysql-test/r/ssl.result10
-rw-r--r--mysql-test/r/ssl_7937,nossl.result15
-rw-r--r--mysql-test/r/ssl_7937.result16
-rw-r--r--mysql-test/r/ssl_timeout.result7
-rw-r--r--mysql-test/r/subselect_extra.result2
-rw-r--r--mysql-test/r/subselect_extra_no_semijoin.result2
-rw-r--r--mysql-test/r/subselect_mat.result51
-rw-r--r--mysql-test/r/subselect_sj.result9
-rw-r--r--mysql-test/r/subselect_sj2.result84
-rw-r--r--mysql-test/r/subselect_sj2_jcl6.result88
-rw-r--r--mysql-test/r/subselect_sj2_mat.result84
-rw-r--r--mysql-test/r/subselect_sj_jcl6.result9
-rw-r--r--mysql-test/r/subselect_sj_mat.result51
-rw-r--r--mysql-test/r/table_elim.result32
-rw-r--r--mysql-test/r/table_keyinfo-6838.result12
-rw-r--r--mysql-test/r/tmp_table_count-7586.result83
-rw-r--r--mysql-test/r/trigger-trans.result25
-rw-r--r--mysql-test/r/truncate-stale-6500.result33
-rw-r--r--mysql-test/r/type_decimal.result21
-rw-r--r--mysql-test/r/type_ranges.result2
-rw-r--r--mysql-test/r/type_time_hires.result4
-rw-r--r--mysql-test/r/type_timestamp.result41
-rw-r--r--mysql-test/r/type_timestamp_hires.result4
-rw-r--r--mysql-test/r/uniques_crash-7912.result11
-rw-r--r--mysql-test/r/update_innodb.result31
-rw-r--r--mysql-test/r/view.result33
-rw-r--r--mysql-test/r/view_alias.result8
-rw-r--r--mysql-test/std_data/cacert.pem96
-rw-r--r--mysql-test/std_data/client-cert.pem106
-rw-r--r--mysql-test/std_data/client-key.pem26
-rw-r--r--mysql-test/std_data/mysql_upgrade/event.MYD (renamed from storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/ChangeLog)0
-rw-r--r--mysql-test/std_data/mysql_upgrade/event.MYIbin0 -> 2048 bytes
-rw-r--r--mysql-test/std_data/mysql_upgrade/event.frmbin0 -> 10223 bytes
-rw-r--r--mysql-test/std_data/mysql_upgrade/v1.frm15
-rw-r--r--mysql-test/std_data/mysql_upgrade/v1badcheck.frm15
-rw-r--r--mysql-test/std_data/mysql_upgrade/v2.frm15
-rw-r--r--mysql-test/std_data/mysql_upgrade/v3.frm15
-rw-r--r--mysql-test/std_data/mysql_upgrade/v4.frm16
-rw-r--r--mysql-test/std_data/old_decimal/t1dec102.MYD1
-rw-r--r--mysql-test/std_data/old_decimal/t1dec102.MYIbin0 -> 1024 bytes
-rw-r--r--mysql-test/std_data/old_decimal/t1dec102.frmbin0 -> 8554 bytes
-rw-r--r--mysql-test/std_data/server-cert.pem111
-rw-r--r--mysql-test/std_data/server-key.pem26
-rw-r--r--mysql-test/std_data/server8k-cert.pem185
-rw-r--r--mysql-test/std_data/server8k-key.pem110
-rw-r--r--mysql-test/suite/binlog/r/binlog_commit_wait.result155
-rw-r--r--mysql-test/suite/binlog/r/binlog_database.result69
-rw-r--r--mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result68
-rw-r--r--mysql-test/suite/binlog/r/temptable_uservar_disconnect-7938.result8
-rw-r--r--mysql-test/suite/binlog/t/binlog_commit_wait.test229
-rw-r--r--mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test13
-rw-r--r--mysql-test/suite/binlog/t/temptable_uservar_disconnect-7938.test17
-rw-r--r--mysql-test/suite/funcs_1/t/processlist_priv_no_prot.test6
-rw-r--r--mysql-test/suite/funcs_1/t/processlist_val_no_prot.test6
-rw-r--r--mysql-test/suite/innodb/r/binlog_consistent.result11
-rw-r--r--mysql-test/suite/innodb/r/innodb-alter-table-disk-full.result50
-rw-r--r--mysql-test/suite/innodb/r/innodb-alter-tempfile.result40
-rw-r--r--mysql-test/suite/innodb/r/innodb-bigblob.result7
-rw-r--r--mysql-test/suite/innodb/r/innodb-fk.result109
-rw-r--r--mysql-test/suite/innodb/r/innodb-mdev-7408.result12
-rw-r--r--mysql-test/suite/innodb/r/innodb-mdev-7513.result204
-rw-r--r--mysql-test/suite/innodb/r/innodb-virtual-columns.result322
-rw-r--r--mysql-test/suite/innodb/r/innodb-xa.result17
-rw-r--r--mysql-test/suite/innodb/r/innodb_blob_unrecoverable_crash.result23
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug34300.result2
-rw-r--r--mysql-test/suite/innodb/r/xa_recovery.result17
-rw-r--r--mysql-test/suite/innodb/t/binlog_consistent.test34
-rw-r--r--mysql-test/suite/innodb/t/foreign-keys.test5
-rw-r--r--mysql-test/suite/innodb/t/innodb-alter-table-disk-full-master.opt1
-rw-r--r--mysql-test/suite/innodb/t/innodb-alter-table-disk-full.test50
-rw-r--r--mysql-test/suite/innodb/t/innodb-alter-tempfile.test75
-rw-r--r--mysql-test/suite/innodb/t/innodb-autoinc.test5
-rw-r--r--mysql-test/suite/innodb/t/innodb-bigblob.opt2
-rw-r--r--mysql-test/suite/innodb/t/innodb-bigblob.test20
-rw-r--r--mysql-test/suite/innodb/t/innodb-fk.test103
-rw-r--r--mysql-test/suite/innodb/t/innodb-mdev-7408.opt2
-rw-r--r--mysql-test/suite/innodb/t/innodb-mdev-7408.test16
-rw-r--r--mysql-test/suite/innodb/t/innodb-mdev-7513.test220
-rw-r--r--mysql-test/suite/innodb/t/innodb-mdev7046.test2
-rw-r--r--mysql-test/suite/innodb/t/innodb-virtual-columns.test302
-rw-r--r--mysql-test/suite/innodb/t/innodb-xa.test17
-rw-r--r--mysql-test/suite/innodb/t/innodb_blob_unrecoverable_crash.test55
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug34300.test5
-rw-r--r--mysql-test/suite/innodb/t/innodb_corrupt_bit.test9
-rw-r--r--mysql-test/suite/innodb/t/insert_debug.test5
-rw-r--r--mysql-test/suite/innodb/t/sp_temp_table.test5
-rw-r--r--mysql-test/suite/innodb/t/strict_mode.test5
-rw-r--r--mysql-test/suite/innodb/t/xa_recovery.test47
-rw-r--r--mysql-test/suite/manual/r/rpl_replication_delay.result25
-rw-r--r--mysql-test/suite/manual/t/rpl_replication_delay-slave.opt1
-rw-r--r--mysql-test/suite/manual/t/rpl_replication_delay.test63
-rw-r--r--mysql-test/suite/maria/optimize.result11
-rw-r--r--mysql-test/suite/maria/optimize.test10
-rw-r--r--mysql-test/suite/multi_source/multisource.result87
-rw-r--r--mysql-test/suite/multi_source/multisource.test50
-rw-r--r--mysql-test/suite/parts/r/partition_debug_sync_innodb.result11
-rw-r--r--mysql-test/suite/parts/t/partition_debug_sync_innodb.test5
-rw-r--r--mysql-test/suite/percona/innodb_sys_index.result3
-rw-r--r--mysql-test/suite/percona/innodb_sys_index.test1
-rw-r--r--mysql-test/suite/percona/percona_innodb_fake_changes.result2
-rw-r--r--mysql-test/suite/percona/percona_innodb_fake_changes.test2
-rw-r--r--mysql-test/suite/perfschema/include/connection_setup.inc2
-rw-r--r--mysql-test/suite/perfschema/include/digest_setup.inc2
-rw-r--r--mysql-test/suite/perfschema/include/event_aggregate_setup.inc2
-rw-r--r--mysql-test/suite/perfschema/include/sizing_auto.inc12
-rw-r--r--mysql-test/suite/perfschema/include/socket_event.inc2
-rw-r--r--mysql-test/suite/perfschema/include/stage_setup.inc2
-rw-r--r--mysql-test/suite/perfschema/include/start_server_common.inc4
-rw-r--r--mysql-test/suite/perfschema/include/table_aggregate_load.inc4
-rw-r--r--mysql-test/suite/perfschema/include/table_aggregate_setup.inc2
-rw-r--r--mysql-test/suite/perfschema/r/aggregate.result3
-rw-r--r--mysql-test/suite/perfschema/r/digest_null_literal.result27
-rw-r--r--mysql-test/suite/perfschema/r/digest_table_full.result2
-rw-r--r--mysql-test/suite/perfschema/r/ortho_iter.result30
-rw-r--r--mysql-test/suite/perfschema/r/privilege_table_io.result5
-rw-r--r--mysql-test/suite/perfschema/r/rpl_gtid_func.result4
-rw-r--r--mysql-test/suite/perfschema/r/sizing_default.result162
-rw-r--r--mysql-test/suite/perfschema/r/sizing_high.result162
-rw-r--r--mysql-test/suite/perfschema/r/sizing_low.result162
-rw-r--r--mysql-test/suite/perfschema/r/sizing_med.result162
-rw-r--r--mysql-test/suite/perfschema/r/sizing_off.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_disable_idle.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_disable_stages.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_disable_statements.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_disable_waits.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_innodb.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_low_digest.result12
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_account.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_cond_class.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_cond_inst.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_file_class.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_file_inst.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_host.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_mutex_class.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_setup_actors.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_setup_objects.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_socket_class.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_socket_inst.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_stage_class.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_stages_history.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_stages_history_long.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_statement_class.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_statements_history.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_statements_history_long.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_table_hdl.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_table_inst.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_thread_class.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_thread_inst.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_user.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_waits_history.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_waits_history_long.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_nothing.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_off.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_on.result5
-rw-r--r--mysql-test/suite/perfschema/r/statement_digest.result63
-rw-r--r--mysql-test/suite/perfschema/r/statement_digest_consumers.result63
-rw-r--r--mysql-test/suite/perfschema/r/statement_digest_long_query.result4
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_global_2u_2t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_global_2u_3t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_global_4u_2t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_global_4u_3t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_hist_2u_2t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_hist_2u_3t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_hist_4u_2t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_hist_4u_3t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_off.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_thread_2u_2t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_thread_2u_3t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_thread_4u_2t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_thread_4u_3t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_2t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_3t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_2t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_3t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_2t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_3t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_2t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_3t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_2t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_3t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_2t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_3t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_2t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_3t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_2t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_3t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_2t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_3t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_2t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_3t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_2t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_3t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_2t.result5
-rw-r--r--mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_3t.result5
-rw-r--r--mysql-test/suite/perfschema/r/threads_mysql.result2
-rw-r--r--mysql-test/suite/perfschema/t/aggregate.test7
-rw-r--r--mysql-test/suite/perfschema/t/digest_null_literal.test32
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_allow.test2
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_deny.test2
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_allow.test2
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_deny.test2
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_allow.test2
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_deny.test2
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_allow.test2
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_deny.test2
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_auth_plugin.test2
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_blocked.test2
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_max_con.test2
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_allow.test2
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_deny.test2
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_allow.test2
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_deny.test2
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_passwd.test2
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_ssl.test2
-rw-r--r--mysql-test/suite/perfschema/t/nesting.test2
-rw-r--r--mysql-test/suite/perfschema/t/ortho_iter.test5
-rw-r--r--mysql-test/suite/perfschema/t/privilege_table_io.test4
-rw-r--r--mysql-test/suite/perfschema/t/rpl_gtid_func.test2
-rw-r--r--mysql-test/suite/perfschema/t/rpl_statements.test2
-rw-r--r--mysql-test/suite/perfschema/t/sizing_off.test4
-rw-r--r--mysql-test/suite/perfschema/t/socket_instances_func-master.opt2
-rw-r--r--mysql-test/suite/perfschema/t/socket_summary_by_event_name_func.test2
-rw-r--r--mysql-test/suite/perfschema/t/socket_summary_by_instance_func.test2
-rw-r--r--mysql-test/suite/perfschema/t/socket_summary_by_instance_func_win.test2
-rw-r--r--mysql-test/suite/perfschema/t/start_server_low_digest-master.opt1
-rw-r--r--mysql-test/suite/perfschema/t/start_server_low_digest.test21
-rw-r--r--mysql-test/suite/perfschema/t/statement_digest_long_query.test2
-rw-r--r--mysql-test/suite/perfschema/t/unary_digest.test2
-rw-r--r--mysql-test/suite/plugins/r/server_audit.result195
-rw-r--r--mysql-test/suite/plugins/r/thread_pool_server_audit.result367
-rw-r--r--mysql-test/suite/plugins/t/server_audit.test67
-rw-r--r--mysql-test/suite/plugins/t/thread_pool_server_audit.opt2
-rw-r--r--mysql-test/suite/plugins/t/thread_pool_server_audit.test144
-rw-r--r--mysql-test/suite/roles/create_and_drop_role.result18
-rw-r--r--mysql-test/suite/roles/create_and_drop_role.test19
-rw-r--r--mysql-test/suite/rpl/r/rpl_drop_db_fail.result16
-rw-r--r--mysql-test/suite/rpl/r/rpl_gtid_basic.result23
-rw-r--r--mysql-test/suite/rpl/r/rpl_gtid_crash.result50
-rw-r--r--mysql-test/suite/rpl/r/rpl_gtid_errorhandling.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_gtid_misc.result25
-rw-r--r--mysql-test/suite/rpl/r/rpl_gtid_until.result6
-rw-r--r--mysql-test/suite/rpl/r/rpl_master_pos_wait.result22
-rw-r--r--mysql-test/suite/rpl/r/rpl_old_decimal.result9
-rw-r--r--mysql-test/suite/rpl/r/rpl_parallel.result515
-rw-r--r--mysql-test/suite/rpl/r/rpl_parallel2.result17
-rw-r--r--mysql-test/suite/rpl/r/rpl_parallel_mdev6589.result147
-rw-r--r--mysql-test/suite/rpl/r/rpl_parallel_multilevel2.result52
-rw-r--r--mysql-test/suite/rpl/r/rpl_parallel_partition.result42
-rw-r--r--mysql-test/suite/rpl/r/rpl_parallel_temptable.result20
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_annotate_do.result38
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_annotate_dont.result36
-rw-r--r--mysql-test/suite/rpl/r/rpl_special_charset.result8
-rw-r--r--mysql-test/suite/rpl/r/rpl_temp_table.result5
-rw-r--r--mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL.result5
-rw-r--r--mysql-test/suite/rpl/r/rpl_trigger.result11
-rw-r--r--mysql-test/suite/rpl/r/sec_behind_master-5114.result10
-rw-r--r--mysql-test/suite/rpl/r/semisync_future-7591.result19
-rw-r--r--mysql-test/suite/rpl/r/show_status_stop_slave_race-7126.result4
-rw-r--r--mysql-test/suite/rpl/t/rpl_000011.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_drop_db_fail.test34
-rw-r--r--mysql-test/suite/rpl/t/rpl_gtid_basic.test51
-rw-r--r--mysql-test/suite/rpl/t/rpl_gtid_crash.test71
-rw-r--r--mysql-test/suite/rpl/t/rpl_gtid_errorhandling.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_gtid_misc.test50
-rw-r--r--mysql-test/suite/rpl/t/rpl_gtid_until.test16
-rw-r--r--mysql-test/suite/rpl/t/rpl_master_pos_wait.test31
-rw-r--r--mysql-test/suite/rpl/t/rpl_old_decimal.test25
-rw-r--r--mysql-test/suite/rpl/t/rpl_parallel.test474
-rw-r--r--mysql-test/suite/rpl/t/rpl_parallel2.test42
-rw-r--r--mysql-test/suite/rpl/t/rpl_parallel_mdev6589.test132
-rw-r--r--mysql-test/suite/rpl/t/rpl_parallel_multilevel2.cnf17
-rw-r--r--mysql-test/suite/rpl/t/rpl_parallel_multilevel2.test80
-rw-r--r--mysql-test/suite/rpl/t/rpl_parallel_partition.test81
-rw-r--r--mysql-test/suite/rpl/t/rpl_parallel_temptable.test23
-rw-r--r--mysql-test/suite/rpl/t/rpl_special_charset.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_special_charset.test26
-rw-r--r--mysql-test/suite/rpl/t/rpl_temp_table.test16
-rw-r--r--mysql-test/suite/rpl/t/rpl_tmp_table_and_DDL.test10
-rw-r--r--mysql-test/suite/rpl/t/rpl_trigger.test13
-rw-r--r--mysql-test/suite/rpl/t/sec_behind_master-5114.test27
-rw-r--r--mysql-test/suite/rpl/t/semisync_future-7591.test31
-rw-r--r--mysql-test/suite/rpl/t/show_status_stop_slave_race-7126.test19
-rw-r--r--mysql-test/suite/stress/t/ddl_archive.test5
-rw-r--r--mysql-test/suite/stress/t/ddl_csv.test5
-rw-r--r--mysql-test/suite/stress/t/ddl_innodb.test5
-rw-r--r--mysql-test/suite/stress/t/ddl_memory.test5
-rw-r--r--mysql-test/suite/stress/t/ddl_myisam.test5
-rw-r--r--mysql-test/suite/sys_vars/r/all_vars.result1
-rw-r--r--mysql-test/suite/sys_vars/r/slave_parallel_threads_basic.result15
-rw-r--r--mysql-test/suite/sys_vars/r/transaction_alloc_block_size_basic.result28
-rw-r--r--mysql-test/suite/sys_vars/r/transaction_prealloc_size_basic.result8
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_buffer_pool_evict_basic.test5
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_thread_sleep_delay_basic.test5
-rw-r--r--mysql-test/suite/sys_vars/t/slave_parallel_threads_basic.cnf5
-rw-r--r--mysql-test/suite/sys_vars/t/slave_parallel_threads_basic.test9
-rw-r--r--mysql-test/suite/sys_vars/t/transaction_alloc_block_size_basic.test14
-rw-r--r--mysql-test/suite/sys_vars/t/transaction_prealloc_size_basic.test6
-rw-r--r--mysql-test/t/alter_table.test8
-rw-r--r--mysql-test/t/alter_table_online.test9
-rw-r--r--mysql-test/t/blackhole.test10
-rw-r--r--mysql-test/t/bootstrap.test29
-rw-r--r--mysql-test/t/bug46261-master.opt1
-rw-r--r--mysql-test/t/bug46261.test16
-rw-r--r--mysql-test/t/ctype_binary.test5
-rw-r--r--mysql-test/t/ctype_create.test36
-rw-r--r--mysql-test/t/ctype_latin1.test5
-rw-r--r--mysql-test/t/ctype_uca.test11
-rw-r--r--mysql-test/t/ctype_uca_innodb.test25
-rw-r--r--mysql-test/t/ctype_utf8.test41
-rw-r--r--mysql-test/t/derived.test14
-rw-r--r--mysql-test/t/dyncol.test7
-rw-r--r--mysql-test/t/empty_server_name-8224.test9
-rw-r--r--mysql-test/t/error_simulation-master.opt1
-rw-r--r--mysql-test/t/error_simulation.test36
-rw-r--r--mysql-test/t/explain_non_select.test10
-rw-r--r--mysql-test/t/file_contents.test8
-rw-r--r--mysql-test/t/filesort_bad_i_s-7585.test14
-rw-r--r--mysql-test/t/func_gconcat.test18
-rw-r--r--mysql-test/t/func_regexp_pcre.test24
-rw-r--r--mysql-test/t/func_regexp_pcre_debug.test6
-rw-r--r--mysql-test/t/func_time.test41
-rw-r--r--mysql-test/t/galera_sst_mode.test43
-rw-r--r--mysql-test/t/gis.test16
-rw-r--r--mysql-test/t/group_by.test11
-rw-r--r--mysql-test/t/group_by_innodb.test40
-rw-r--r--mysql-test/t/having.test36
-rw-r--r--mysql-test/t/information_schema.test17
-rw-r--r--mysql-test/t/information_schema2.test13
-rw-r--r--mysql-test/t/join_cache.test12
-rw-r--r--mysql-test/t/log_errchk.test15
-rw-r--r--mysql-test/t/multi_update.test206
-rw-r--r--mysql-test/t/myisam.test10
-rw-r--r--mysql-test/t/mysql_tzinfo_to_sql_symlink.test11
-rw-r--r--mysql-test/t/mysql_upgrade_view.test161
-rw-r--r--mysql-test/t/mysqladmin.test6
-rw-r--r--mysql-test/t/mysqlcheck.test59
-rw-r--r--mysql-test/t/openssl_1.test8
-rw-r--r--mysql-test/t/partition_innodb.test28
-rw-r--r--mysql-test/t/partition_innodb_plugin.test4
-rw-r--r--mysql-test/t/partition_myisam.test2
-rw-r--r--mysql-test/t/partition_not_blackhole.test2
-rw-r--r--mysql-test/t/plugin.test13
-rw-r--r--mysql-test/t/query_cache_ps_no_prot.test7
-rw-r--r--mysql-test/t/range_innodb.test47
-rw-r--r--mysql-test/t/repair.test9
-rw-r--r--mysql-test/t/selectivity.test29
-rw-r--r--mysql-test/t/selectivity_innodb.test30
-rw-r--r--mysql-test/t/show_grants_with_plugin-7985.test161
-rw-r--r--mysql-test/t/sp-destruct.test8
-rw-r--r--mysql-test/t/sp-innodb.test117
-rw-r--r--mysql-test/t/sp_notembedded.test20
-rw-r--r--mysql-test/t/ssl.test9
-rw-r--r--mysql-test/t/ssl_7937.combinations5
-rw-r--r--mysql-test/t/ssl_7937.test35
-rw-r--r--mysql-test/t/ssl_timeout.test21
-rw-r--r--mysql-test/t/subselect_sj.test11
-rw-r--r--mysql-test/t/subselect_sj2.test71
-rw-r--r--mysql-test/t/subselect_sj_mat.test42
-rw-r--r--mysql-test/t/table_elim.test31
-rw-r--r--mysql-test/t/table_keyinfo-6838.test18
-rw-r--r--mysql-test/t/tmp_table_count-7586.test56
-rw-r--r--mysql-test/t/trigger-trans.test54
-rw-r--r--mysql-test/t/truncate-stale-6500.test32
-rw-r--r--mysql-test/t/type_decimal.test24
-rw-r--r--mysql-test/t/type_timestamp.test27
-rw-r--r--mysql-test/t/uniques_crash-7912.test26
-rw-r--r--mysql-test/t/update_innodb.test39
-rw-r--r--mysql-test/t/view.test35
-rw-r--r--mysql-test/t/view_alias.test9
-rw-r--r--mysys/md5_compute.cc68
-rw-r--r--mysys/my_default.c2
-rw-r--r--mysys/psi_noop.c19
-rw-r--r--mysys_ssl/my_aes.cc19
-rw-r--r--mysys_ssl/my_md5.cc18
-rw-r--r--packaging/WiX/CPackWixConfig.cmake238
-rw-r--r--packaging/WiX/create_msi.cmake.in796
-rw-r--r--packaging/WiX/custom_ui.wxs230
-rw-r--r--packaging/WiX/extra.wxs.in162
-rw-r--r--packaging/WiX/mysql_server.wxs.in392
-rw-r--r--packaging/rpm-oel/mysql.spec.in4
-rw-r--r--pcre/AUTHORS6
-rw-r--r--pcre/ChangeLog167
-rw-r--r--pcre/LICENCE9
-rw-r--r--pcre/NEWS8
-rw-r--r--pcre/NON-AUTOTOOLS-BUILD10
-rw-r--r--pcre/README13
-rwxr-xr-xpcre/RunGrepTest5
-rw-r--r--pcre/RunTest.bat1232
-rw-r--r--pcre/configure.ac10
-rw-r--r--pcre/doc/html/NON-AUTOTOOLS-BUILD.txt10
-rw-r--r--pcre/doc/html/README.txt13
-rw-r--r--pcre/doc/html/pcre.html35
-rw-r--r--pcre/doc/pcre.320
-rw-r--r--pcre/doc/pcre.txt17
-rw-r--r--pcre/pcre_compile.c247
-rw-r--r--pcre/pcre_dfa_exec.c5
-rw-r--r--pcre/pcre_exec.c170
-rw-r--r--pcre/pcre_internal.h8
-rw-r--r--pcre/pcre_jit_compile.c990
-rw-r--r--pcre/pcre_jit_test.c18
-rw-r--r--pcre/pcre_study.c60
-rw-r--r--pcre/pcregrep.c93
-rw-r--r--pcre/pcretest.c63
-rw-r--r--pcre/testdata/grepoutput8
-rw-r--r--pcre/testdata/testinput110
-rw-r--r--pcre/testdata/testinput112
-rw-r--r--pcre/testdata/testinput128
-rw-r--r--pcre/testdata/testinput274
-rw-r--r--pcre/testdata/testinput45
-rw-r--r--pcre/testdata/testinput58
-rw-r--r--pcre/testdata/testinput66
-rw-r--r--pcre/testdata/testinput84
-rw-r--r--pcre/testdata/testoutput118
-rw-r--r--pcre/testdata/testoutput11-1617
-rw-r--r--pcre/testdata/testoutput11-3217
-rw-r--r--pcre/testdata/testoutput11-817
-rw-r--r--pcre/testdata/testoutput128
-rw-r--r--pcre/testdata/testoutput2219
-rw-r--r--pcre/testdata/testoutput46
-rw-r--r--pcre/testdata/testoutput545
-rw-r--r--pcre/testdata/testoutput68
-rw-r--r--pcre/testdata/testoutput86
-rw-r--r--plugin/auth_dialog/CMakeLists.txt2
-rw-r--r--plugin/auth_dialog/dialog.c2
-rw-r--r--plugin/auth_examples/CMakeLists.txt2
-rw-r--r--plugin/handler_socket/CMakeLists.txt4
-rw-r--r--plugin/server_audit/server_audit.c686
-rw-r--r--plugin/win_auth_client/CMakeLists.txt2
-rw-r--r--scripts/CMakeLists.txt26
-rw-r--r--scripts/mysql_install_db.pl.in4
-rw-r--r--scripts/mysql_install_db.sh4
-rw-r--r--scripts/mysqld_safe.sh16
-rw-r--r--sql-common/client.c42
-rw-r--r--sql-common/my_time.c12
-rw-r--r--sql/CMakeLists.txt41
-rw-r--r--sql/event_scheduler.cc5
-rw-r--r--sql/field.cc281
-rw-r--r--sql/field.h75
-rw-r--r--sql/filesort.cc4
-rw-r--r--sql/gen_lex_token.cc353
-rw-r--r--sql/ha_ndbcluster_binlog.cc6
-rw-r--r--sql/handler.cc118
-rw-r--r--sql/handler.h27
-rw-r--r--sql/item.cc71
-rw-r--r--sql/item.h40
-rw-r--r--sql/item_cmpfunc.cc65
-rw-r--r--sql/item_cmpfunc.h9
-rw-r--r--sql/item_func.cc12
-rw-r--r--sql/item_geofunc.cc8
-rw-r--r--sql/item_geofunc.h4
-rw-r--r--sql/item_strfunc.cc10
-rw-r--r--sql/item_strfunc.h3
-rw-r--r--sql/item_sum.cc18
-rw-r--r--sql/lex.h4
-rw-r--r--sql/log.cc220
-rw-r--r--sql/log.h13
-rw-r--r--sql/log_event.cc63
-rw-r--r--sql/log_event_old.cc2
-rw-r--r--sql/message.rc4
-rw-r--r--sql/mysqld.cc99
-rw-r--r--sql/mysqld.h2
-rw-r--r--sql/net_serv.cc2
-rw-r--r--sql/opt_subselect.cc62
-rw-r--r--sql/opt_subselect.h4
-rw-r--r--sql/parse_file.cc2
-rw-r--r--sql/rpl_gtid.cc75
-rw-r--r--sql/rpl_gtid.h2
-rw-r--r--sql/rpl_mi.cc45
-rw-r--r--sql/rpl_mi.h1
-rw-r--r--sql/rpl_parallel.cc375
-rw-r--r--sql/rpl_parallel.h15
-rw-r--r--sql/rpl_rli.cc96
-rw-r--r--sql/rpl_rli.h35
-rw-r--r--sql/rpl_utility.cc2
-rw-r--r--sql/share/errmsg-utf8.txt2
-rw-r--r--sql/slave.cc183
-rw-r--r--sql/sp.cc6
-rw-r--r--sql/sp_head.cc5
-rw-r--r--sql/sql_acl.cc162
-rw-r--r--sql/sql_admin.cc57
-rw-r--r--sql/sql_base.cc160
-rw-r--r--sql/sql_base.h4
-rw-r--r--sql/sql_class.cc47
-rw-r--r--sql/sql_class.h44
-rw-r--r--sql/sql_connect.cc13
-rw-r--r--sql/sql_cursor.cc4
-rw-r--r--sql/sql_db.cc6
-rw-r--r--sql/sql_delete.cc8
-rw-r--r--sql/sql_derived.cc26
-rw-r--r--sql/sql_derived.h1
-rw-r--r--sql/sql_digest.cc683
-rw-r--r--sql/sql_digest.h130
-rw-r--r--sql/sql_digest_stream.h51
-rw-r--r--sql/sql_insert.cc27
-rw-r--r--sql/sql_lex.cc79
-rw-r--r--sql/sql_lex.h37
-rw-r--r--sql/sql_parse.cc62
-rw-r--r--sql/sql_partition.cc1
-rw-r--r--sql/sql_partition_admin.cc11
-rw-r--r--sql/sql_plugin.cc41
-rw-r--r--sql/sql_rename.cc9
-rw-r--r--sql/sql_repl.cc57
-rw-r--r--sql/sql_select.cc123
-rw-r--r--sql/sql_select.h20
-rw-r--r--sql/sql_servers.cc3
-rw-r--r--sql/sql_show.cc19
-rw-r--r--sql/sql_table.cc94
-rw-r--r--sql/sql_test.cc2
-rw-r--r--sql/sql_truncate.cc10
-rw-r--r--sql/sql_update.cc4
-rw-r--r--sql/sql_view.cc167
-rw-r--r--sql/sql_view.h5
-rw-r--r--sql/sql_yacc.yy96
-rw-r--r--sql/structs.h1
-rw-r--r--sql/sys_vars.cc22
-rw-r--r--sql/table.cc108
-rw-r--r--sql/table.h26
-rw-r--r--sql/transaction.cc2
-rw-r--r--sql/tztime.cc3
-rw-r--r--sql/udf_example.c5
-rw-r--r--sql/uniques.cc14
-rw-r--r--sql/winservice.h80
-rw-r--r--storage/cassandra/ha_cassandra.cc2
-rw-r--r--storage/connect/CMakeLists.txt41
-rw-r--r--storage/connect/array.cpp16
-rw-r--r--storage/connect/array.h1
-rw-r--r--storage/connect/blkfil.cpp28
-rw-r--r--storage/connect/block.h10
-rw-r--r--storage/connect/catalog.h48
-rw-r--r--storage/connect/checklvl.h7
-rw-r--r--storage/connect/colblk.cpp834
-rw-r--r--storage/connect/colblk.h6
-rw-r--r--storage/connect/connect.cc52
-rw-r--r--storage/connect/domdoc.cpp97
-rw-r--r--storage/connect/domdoc.h19
-rw-r--r--storage/connect/filamap.cpp35
-rw-r--r--storage/connect/filamap.h1
-rw-r--r--storage/connect/filamdbf.cpp77
-rw-r--r--storage/connect/filamfix.cpp84
-rw-r--r--storage/connect/filamtxt.cpp66
-rw-r--r--storage/connect/filamtxt.h5
-rwxr-xr-xstorage/connect/filamvct.cpp98
-rw-r--r--storage/connect/filamzip.cpp38
-rw-r--r--storage/connect/filter.cpp6
-rw-r--r--storage/connect/filter.h6
-rw-r--r--storage/connect/fmdlex.c5
-rw-r--r--storage/connect/global.h22
-rw-r--r--storage/connect/ha_connect.cc790
-rw-r--r--storage/connect/ha_connect.h20
-rw-r--r--storage/connect/json.cpp2217
-rw-r--r--storage/connect/json.h516
-rw-r--r--storage/connect/jsonudf.cpp690
-rw-r--r--storage/connect/libdoc.cpp76
-rw-r--r--storage/connect/macutil.cpp8
-rw-r--r--storage/connect/macutil.h8
-rw-r--r--storage/connect/maputil.cpp2
-rw-r--r--storage/connect/mycat.cc108
-rw-r--r--storage/connect/mycat.h44
-rw-r--r--storage/connect/myconn.cpp21
-rw-r--r--storage/connect/myconn.h12
-rw-r--r--storage/connect/mysql-test/connect/my.cnf34
-rw-r--r--storage/connect/mysql-test/connect/r/bin.result12
-rw-r--r--storage/connect/mysql-test/connect/r/json.result116
-rw-r--r--storage/connect/mysql-test/connect/r/json_udf.result167
-rw-r--r--storage/connect/mysql-test/connect/r/odbc_oracle.result10
-rw-r--r--storage/connect/mysql-test/connect/r/xml_html.result32
-rw-r--r--storage/connect/mysql-test/connect/std_data/beers.xml16
-rw-r--r--storage/connect/mysql-test/connect/std_data/biblio.json (renamed from storage/connect/mysql-test/connect/std_data/biblio.jsn)90
-rw-r--r--storage/connect/mysql-test/connect/std_data/bookstore.xml62
-rw-r--r--storage/connect/mysql-test/connect/std_data/coffee.htm24
-rw-r--r--storage/connect/mysql-test/connect/std_data/expense.json (renamed from storage/connect/mysql-test/connect/std_data/expense.jsn)316
-rw-r--r--storage/connect/mysql-test/connect/std_data/mulexp3.json (renamed from storage/connect/mysql-test/connect/std_data/mulexp3.jsn)104
-rw-r--r--storage/connect/mysql-test/connect/std_data/mulexp4.json (renamed from storage/connect/mysql-test/connect/std_data/mulexp4.jsn)104
-rw-r--r--storage/connect/mysql-test/connect/std_data/mulexp5.json (renamed from storage/connect/mysql-test/connect/std_data/mulexp5.jsn)104
-rw-r--r--storage/connect/mysql-test/connect/std_data/sexe.csv6
-rw-r--r--storage/connect/mysql-test/connect/std_data/sitmat.csv14
-rw-r--r--storage/connect/mysql-test/connect/t/alter.test278
-rw-r--r--storage/connect/mysql-test/connect/t/alter_xml.test58
-rw-r--r--storage/connect/mysql-test/connect/t/bin.test154
-rw-r--r--storage/connect/mysql-test/connect/t/datest.test32
-rw-r--r--storage/connect/mysql-test/connect/t/fmt.test170
-rw-r--r--storage/connect/mysql-test/connect/t/general.test32
-rw-r--r--storage/connect/mysql-test/connect/t/json.test511
-rw-r--r--storage/connect/mysql-test/connect/t/json_udf.inc36
-rw-r--r--storage/connect/mysql-test/connect/t/json_udf.test93
-rw-r--r--storage/connect/mysql-test/connect/t/mrr.test132
-rw-r--r--storage/connect/mysql-test/connect/t/mul.test86
-rw-r--r--storage/connect/mysql-test/connect/t/myconn.inc54
-rw-r--r--storage/connect/mysql-test/connect/t/myconn_cleanup.inc18
-rw-r--r--storage/connect/mysql-test/connect/t/mysql.test944
-rw-r--r--storage/connect/mysql-test/connect/t/mysql_discovery.test66
-rw-r--r--storage/connect/mysql-test/connect/t/mysql_exec.test90
-rw-r--r--storage/connect/mysql-test/connect/t/mysql_grant.test156
-rw-r--r--storage/connect/mysql-test/connect/t/mysql_new.test650
-rw-r--r--storage/connect/mysql-test/connect/t/null.test174
-rw-r--r--storage/connect/mysql-test/connect/t/occur.test122
-rw-r--r--storage/connect/mysql-test/connect/t/odbc_sqlite3.test180
-rw-r--r--storage/connect/mysql-test/connect/t/part_file.test332
-rw-r--r--storage/connect/mysql-test/connect/t/part_table.test184
-rw-r--r--storage/connect/mysql-test/connect/t/pivot.test326
-rw-r--r--storage/connect/mysql-test/connect/t/tbl.test106
-rw-r--r--storage/connect/mysql-test/connect/t/unsigned.test70
-rw-r--r--storage/connect/mysql-test/connect/t/upd.test306
-rw-r--r--storage/connect/mysql-test/connect/t/updelx.test192
-rw-r--r--storage/connect/mysql-test/connect/t/updelx2.test44
-rw-r--r--storage/connect/mysql-test/connect/t/xcol.test82
-rw-r--r--storage/connect/mysql-test/connect/t/xml_html.test39
-rw-r--r--storage/connect/mysql-test/connect/t/xml_mdev5261.test54
-rw-r--r--storage/connect/myutil.cpp28
-rw-r--r--storage/connect/odbccat.h14
-rw-r--r--storage/connect/odbconn.cpp189
-rw-r--r--storage/connect/odbconn.h24
-rw-r--r--storage/connect/os.h10
-rw-r--r--storage/connect/osutil.c2
-rw-r--r--storage/connect/plgdbsem.h20
-rw-r--r--storage/connect/plgdbutl.cpp75
-rw-r--r--storage/connect/plgxml.h15
-rw-r--r--storage/connect/plugutil.c58
-rw-r--r--storage/connect/rcmsg.c136
-rw-r--r--storage/connect/reldef.cpp170
-rw-r--r--storage/connect/reldef.h12
-rw-r--r--storage/connect/tabcol.cpp8
-rw-r--r--storage/connect/tabdos.cpp45
-rw-r--r--storage/connect/tabdos.h14
-rw-r--r--storage/connect/tabfix.cpp152
-rw-r--r--storage/connect/tabfix.h29
-rw-r--r--storage/connect/tabfmt.cpp18
-rw-r--r--storage/connect/tabfmt.h4
-rw-r--r--storage/connect/tabjson.cpp1276
-rw-r--r--storage/connect/tabjson.h91
-rw-r--r--storage/connect/table.cpp34
-rw-r--r--storage/connect/tabmac.cpp8
-rw-r--r--storage/connect/tabmac.h8
-rw-r--r--storage/connect/tabmul.cpp105
-rw-r--r--storage/connect/tabmul.h18
-rw-r--r--storage/connect/tabmysql.cpp60
-rw-r--r--storage/connect/tabmysql.h8
-rw-r--r--storage/connect/taboccur.cpp21
-rw-r--r--storage/connect/tabodbc.cpp245
-rw-r--r--storage/connect/tabodbc.h15
-rw-r--r--storage/connect/tabpivot.cpp39
-rw-r--r--storage/connect/tabpivot.h3
-rw-r--r--storage/connect/tabsys.cpp76
-rw-r--r--storage/connect/tabsys.h364
-rw-r--r--storage/connect/tabtbl.cpp35
-rw-r--r--storage/connect/tabtbl.h2
-rw-r--r--storage/connect/tabutil.cpp69
-rw-r--r--storage/connect/tabutil.h13
-rw-r--r--storage/connect/tabvct.cpp14
-rw-r--r--storage/connect/tabvir.cpp12
-rw-r--r--storage/connect/tabvir.h2
-rw-r--r--storage/connect/tabwmi.cpp6
-rw-r--r--storage/connect/tabxcl.cpp15
-rw-r--r--storage/connect/tabxcl.h3
-rw-r--r--storage/connect/tabxml.cpp481
-rw-r--r--storage/connect/tabxml.h26
-rw-r--r--storage/connect/user_connect.cc6
-rw-r--r--storage/connect/user_connect.h2
-rw-r--r--storage/connect/valblk.cpp17
-rw-r--r--storage/connect/valblk.h32
-rw-r--r--storage/connect/value.cpp125
-rw-r--r--storage/connect/value.h34
-rwxr-xr-xstorage/connect/xindex.cpp130
-rw-r--r--storage/connect/xindex.h32
-rw-r--r--storage/connect/xobject.cpp54
-rw-r--r--storage/connect/xobject.h6
-rw-r--r--storage/connect/xtable.h32
-rw-r--r--storage/federated/ha_federated.cc8
-rw-r--r--storage/federatedx/README.windows46
-rw-r--r--storage/innobase/CMakeLists.txt2
-rw-r--r--storage/innobase/api/api0api.cc223
-rw-r--r--storage/innobase/btr/btr0cur.cc12
-rw-r--r--storage/innobase/buf/buf0buf.cc277
-rw-r--r--storage/innobase/buf/buf0checksum.cc11
-rw-r--r--storage/innobase/dict/dict0dict.cc148
-rw-r--r--storage/innobase/dict/dict0mem.cc74
-rw-r--r--storage/innobase/fil/fil0fil.cc8
-rw-r--r--storage/innobase/fsp/fsp0fsp.cc40
-rw-r--r--storage/innobase/fts/fts0ast.cc48
-rw-r--r--storage/innobase/fts/fts0fts.cc109
-rw-r--r--storage/innobase/fts/fts0opt.cc11
-rw-r--r--storage/innobase/fts/fts0que.cc49
-rw-r--r--storage/innobase/handler/ha_innodb.cc99
-rw-r--r--storage/innobase/handler/handler0alter.cc39
-rw-r--r--storage/innobase/handler/i_s.cc18
-rw-r--r--storage/innobase/ibuf/ibuf0ibuf.cc10
-rw-r--r--storage/innobase/include/api0api.h10
-rw-r--r--storage/innobase/include/buf0buf.h8
-rw-r--r--storage/innobase/include/buf0buf.ic12
-rw-r--r--storage/innobase/include/db0err.h5
-rw-r--r--storage/innobase/include/dict0dict.h11
-rw-r--r--storage/innobase/include/dict0mem.h123
-rw-r--r--storage/innobase/include/fts0ast.h7
-rw-r--r--storage/innobase/include/ha_prototypes.h2
-rw-r--r--storage/innobase/include/lock0priv.h7
-rw-r--r--storage/innobase/include/os0file.h8
-rw-r--r--storage/innobase/include/os0sync.h2
-rw-r--r--storage/innobase/include/page0page.h16
-rw-r--r--storage/innobase/include/page0zip.h15
-rw-r--r--storage/innobase/include/row0merge.h3
-rw-r--r--storage/innobase/include/sync0rw.ic7
-rw-r--r--storage/innobase/include/trx0roll.h4
-rw-r--r--storage/innobase/include/trx0trx.h13
-rw-r--r--storage/innobase/include/univ.i2
-rw-r--r--storage/innobase/lock/lock0lock.cc52
-rw-r--r--storage/innobase/log/log0log.cc10
-rw-r--r--storage/innobase/log/log0recv.cc5
-rw-r--r--storage/innobase/os/os0file.cc93
-rw-r--r--storage/innobase/os/os0sync.cc20
-rw-r--r--storage/innobase/page/page0page.cc44
-rw-r--r--storage/innobase/page/page0zip.cc103
-rw-r--r--storage/innobase/que/que0que.cc28
-rw-r--r--storage/innobase/row/row0ftsort.cc2
-rw-r--r--storage/innobase/row/row0log.cc23
-rw-r--r--storage/innobase/row/row0merge.cc168
-rw-r--r--storage/innobase/row/row0mysql.cc176
-rw-r--r--storage/innobase/row/row0quiesce.cc3
-rw-r--r--storage/innobase/srv/srv0mon.cc5
-rw-r--r--storage/innobase/srv/srv0srv.cc6
-rw-r--r--storage/innobase/srv/srv0start.cc32
-rw-r--r--storage/innobase/sync/sync0arr.cc8
-rw-r--r--storage/innobase/sync/sync0rw.cc14
-rw-r--r--storage/innobase/sync/sync0sync.cc108
-rw-r--r--storage/innobase/trx/trx0roll.cc7
-rw-r--r--storage/innobase/trx/trx0sys.cc4
-rw-r--r--storage/innobase/trx/trx0trx.cc5
-rw-r--r--storage/innobase/ut/ut0ut.cc4
-rw-r--r--storage/maria/ma_check.c6
-rw-r--r--storage/mroonga/CMakeLists.txt186
-rw-r--r--storage/mroonga/COPYING504
-rw-r--r--storage/mroonga/Makefile.am3
-rw-r--r--storage/mroonga/appveyor.yml54
-rw-r--r--storage/mroonga/configure.ac27
-rw-r--r--storage/mroonga/ha_mroonga.cpp1520
-rw-r--r--storage/mroonga/ha_mroonga.hpp79
-rw-r--r--storage/mroonga/lib/libmrn_need_mysql_sources.am6
-rw-r--r--storage/mroonga/lib/mrn_condition_converter.hpp2
-rw-r--r--storage/mroonga/lib/mrn_database_manager.cpp44
-rw-r--r--storage/mroonga/lib/mrn_database_manager.hpp5
-rw-r--r--storage/mroonga/lib/mrn_database_repairer.cpp246
-rw-r--r--storage/mroonga/lib/mrn_database_repairer.hpp58
-rw-r--r--storage/mroonga/lib/mrn_encoding.cpp1
-rw-r--r--storage/mroonga/lib/mrn_field_normalizer.cpp7
-rw-r--r--storage/mroonga/lib/mrn_lock.cpp6
-rw-r--r--storage/mroonga/lib/mrn_lock.hpp4
-rw-r--r--storage/mroonga/lib/mrn_multiple_column_key_codec.cpp9
-rw-r--r--storage/mroonga/lib/mrn_parameters_parser.cpp11
-rw-r--r--storage/mroonga/lib/mrn_path_mapper.cpp97
-rw-r--r--storage/mroonga/lib/mrn_path_mapper.hpp8
-rw-r--r--storage/mroonga/lib/mrn_value_decoder.cpp64
-rw-r--r--storage/mroonga/lib/mrn_value_decoder.hpp33
-rw-r--r--storage/mroonga/mrn_constants.hpp2
-rw-r--r--storage/mroonga/mrn_err.h9
-rw-r--r--storage/mroonga/mrn_mysql.h8
-rw-r--r--storage/mroonga/mrn_mysql_compat.h115
-rw-r--r--storage/mroonga/mrn_table.cpp149
-rw-r--r--storage/mroonga/mrn_table.hpp4
-rw-r--r--storage/mroonga/mrn_variables.hpp29
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_support_lz4.inc20
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_support_zlib.inc20
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/check_version.inc4
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_57.inc21
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_100_or_later.inc24
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mysql_57.inc24
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/support_libgroonga_lz4.inc22
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/support_libgroonga_zlib.inc22
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/unsupport_libgroonga_lz4.inc22
-rw-r--r--storage/mroonga/mysql-test/mroonga/include/mroonga/unsupport_libgroonga_zlib.inc22
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/disabled.def1
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_with_flags.result4
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_with_type.result6
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_index_token_filters_one_token_filter.result10
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_index_unique_multiple_column_duplicated.result19
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_primary_key.result17
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_token_filter.result24
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_fulltext_table.result31
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/alter_table_drop_primary_key.result16
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_fulltext_table.result32
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/alter_table_spatial.result76
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/collation_utf8_unicode_520_ci_french.result11
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/collation_utf8_unicode_520_ci_japanese.result12
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_index_fulltext_other_table.result58
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_index_fulltext_vector_other_table.result33
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_index_int_other_table.result21
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_scalar_support_lz4.result10
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_scalar_support_zlib.result10
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_scalar_unsupport_lz4.result12
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_scalar_unsupport_zlib.result12
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/create_table_default_tokenizer.result4
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_none.result9
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_with_position_and_with_weight.result9
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/create_table_normalizer_fulltext_index_comment.result (renamed from storage/mroonga/mysql-test/mroonga/storage/r/create_table_normalizer_fulltext_index.result)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/create_table_normalizer_fulltext_index_no_utf8_charset_with_utf8_normalizer.result (renamed from storage/mroonga/mysql-test/mroonga/storage/r/create_table_normalizer_no_utf8_charset_with_utf8_normalizer.result)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/create_table_normalizer_fulltext_index_none.result16
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/create_table_normalizer_primary_key_table_comment.result (renamed from storage/mroonga/mysql-test/mroonga/storage/r/create_table_normalizer_table_comment.result)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/create_table_normalizer_primary_key_table_comment_with_using_hash.result19
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/create_table_reference_type.result6
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/create_table_token_filters_index_comment_multiple_token_filters.result6
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/create_table_token_filters_index_comment_one_token_filter.result6
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/create_table_token_filters_table_comment_multiple_token_filters.result6
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/create_table_token_filters_table_comment_one_token_filter.result6
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/create_table_vector.result4
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_all.result21
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/fulltext_insert_select.result20
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_boolean_mode_different_against.result (renamed from storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_different_against.result)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_boolean_mode_different_match.result (renamed from storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_different_match.result)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_boolean_mode_no_where.result (renamed from storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_no_where.result)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_boolean_mode_same_match_against.result (renamed from storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_same_match_against.result)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_natural_language_mode_asc.result34
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_natural_language_mode_desc.result34
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_natural_language_mode_different_against.result34
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_natural_language_mode_different_match.result36
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_natural_language_mode_no_where.result37
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_natural_language_mode_same_match_against.result34
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/geometry_bulk_insert_null.result4
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/geometry_bulk_insert_null_57.result14
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/geometry_contains.result78
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/index_range_normal_greater_than_asc.result18
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/index_range_normal_greater_than_desc.result18
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/index_range_normal_greater_than_or_equal_asc.result18
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/index_range_normal_greater_than_or_equal_desc.result18
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/index_range_normal_less_than_asc.result18
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/index_range_normal_less_than_desc.result18
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/index_range_normal_less_than_or_equal_asc.result18
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/index_range_normal_less_than_or_equal_desc.result18
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/index_range_primary_greater_than_asc.result (renamed from storage/mroonga/mysql-test/mroonga/storage/r/index_range_greater_than_asc.result)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/index_range_primary_greater_than_desc.result (renamed from storage/mroonga/mysql-test/mroonga/storage/r/index_range_greater_than_desc.result)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/index_range_primary_greater_than_or_equal_asc.result (renamed from storage/mroonga/mysql-test/mroonga/storage/r/index_range_greater_than_or_equal_asc.result)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/index_range_primary_greater_than_or_equal_desc.result (renamed from storage/mroonga/mysql-test/mroonga/storage/r/index_range_greater_than_or_equal_desc.result)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/index_range_primary_less_than_asc.result (renamed from storage/mroonga/mysql-test/mroonga/storage/r/index_range_less_than_asc.result)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/index_range_primary_less_than_desc.result (renamed from storage/mroonga/mysql-test/mroonga/storage/r/index_range_less_than_desc.result)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/index_range_primary_less_than_or_equal_asc.result (renamed from storage/mroonga/mysql-test/mroonga/storage/r/index_range_less_than_or_equal_asc.result)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/index_range_primary_less_than_or_equal_desc.result (renamed from storage/mroonga/mysql-test/mroonga/storage/r/index_range_less_than_or_equal_desc.result)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/index_unique_search_after_duplicated.result18
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/information_schema_plugins.result4
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/insert_on_duplicate_key_update_unique_key.result15
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_TODO_SPLIT_ME.result (renamed from storage/mroonga/mysql-test/mroonga/storage/r/optimization_skip_count_TODO_SPLIT_ME.result)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_after_insert_multithread.result (renamed from storage/mroonga/mysql-test/mroonga/storage/r/optimization_skip_count_after_insert_multithread.result)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_after_insert_single_thread.result (renamed from storage/mroonga/mysql-test/mroonga/storage/r/optimization_skip_count_after_insert_single_thread.result)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_disabled.result (renamed from storage/mroonga/mysql-test/mroonga/storage/r/optimization_skip_count_disabled.result)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_view.result (renamed from storage/mroonga/mysql-test/mroonga/storage/r/optimization_skip_count_index_view.result)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_duplicated_order_by_columns.result19
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/partition_insert.result42
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/partition_update.result43
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/repair_table_no_index_file.result40
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/replace_geometry.result16
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/replace_without_key.result10
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/variable_boolean_mode_syntax_flags_allow_column.result18
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/variable_boolean_mode_syntax_flags_allow_leading_not.result16
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/variable_boolean_mode_syntax_flags_allow_update.result18
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/variable_boolean_mode_syntax_flags_syntax_query.result15
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/variable_boolean_mode_syntax_flags_syntax_script.result16
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/variable_database_path_prefix.result2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_global.result20
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_session.result20
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result3
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/suite.pm5
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_with_flags.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_with_type.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_token_filters_one_token_filter.test4
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_unique_multiple_column_duplicated.test39
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_primary_key.test37
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_token_filter.test9
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_table.test46
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_primary_key.test37
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_table.test47
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/alter_table_spatial.test77
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_520_ci_french.test (renamed from storage/mroonga/mysql-test/mroonga/wrapper/t/version_55_performance_schema.test)19
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_520_ci_japanese.test37
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_fulltext_other_table.test32
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_fulltext_vector_other_table.test54
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_int_other_table.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_support_lz4.test37
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_support_zlib.test37
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_unsupport_lz4.test37
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_unsupport_zlib.test37
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_default_tokenizer.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_none.test38
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_with_position_and_with_weight.test38
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_normalizer_fulltext_index_comment.test (renamed from storage/mroonga/mysql-test/mroonga/storage/t/create_table_normalizer_fulltext_index.test)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_normalizer_fulltext_index_no_utf8_charset_with_utf8_normalizer.test (renamed from storage/mroonga/mysql-test/mroonga/storage/t/create_table_normalizer_no_utf8_charset_with_utf8_normalizer.test)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_normalizer_fulltext_index_none.test42
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_normalizer_primary_key_table_comment.test (renamed from storage/mroonga/mysql-test/mroonga/storage/t/create_table_normalizer_table_comment.test)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_normalizer_primary_key_table_comment_with_using_hash.test47
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_reference_type.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_token_filters_index_comment_multiple_token_filters.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_token_filters_index_comment_one_token_filter.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_token_filters_table_comment_multiple_token_filters.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_token_filters_table_comment_one_token_filter.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/create_table_vector.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_all.test44
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_insert_select.test4
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_different_against.test (renamed from storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_different_against.test)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_different_match.test (renamed from storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_different_match.test)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_no_where.test (renamed from storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_no_where.test)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_same_match_against.test (renamed from storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_same_match_against.test)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_asc.test47
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_desc.test47
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_different_against.test47
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_different_match.test49
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_no_where.test46
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_same_match_against.test47
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/geometry_bulk_insert_null.test4
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/geometry_bulk_insert_null_57.test38
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/geometry_contains.test79
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_asc.test41
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_desc.test41
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_or_equal_asc.test41
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_or_equal_desc.test41
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_asc.test41
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_desc.test41
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_or_equal_asc.test41
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_or_equal_desc.test41
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_asc.test (renamed from storage/mroonga/mysql-test/mroonga/storage/t/index_range_greater_than_asc.test)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_desc.test (renamed from storage/mroonga/mysql-test/mroonga/storage/t/index_range_greater_than_desc.test)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_or_equal_asc.test (renamed from storage/mroonga/mysql-test/mroonga/storage/t/index_range_greater_than_or_equal_asc.test)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_or_equal_desc.test (renamed from storage/mroonga/mysql-test/mroonga/storage/t/index_range_greater_than_or_equal_desc.test)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_asc.test (renamed from storage/mroonga/mysql-test/mroonga/storage/t/index_range_less_than_asc.test)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_desc.test (renamed from storage/mroonga/mysql-test/mroonga/storage/t/index_range_less_than_desc.test)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_or_equal_asc.test (renamed from storage/mroonga/mysql-test/mroonga/storage/t/index_range_less_than_or_equal_asc.test)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_or_equal_desc.test (renamed from storage/mroonga/mysql-test/mroonga/storage/t/index_range_less_than_or_equal_desc.test)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_unique_search_after_duplicated.test40
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_unique_key.test11
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_TODO_SPLIT_ME.test (renamed from storage/mroonga/mysql-test/mroonga/storage/t/optimization_skip_count_TODO_SPLIT_ME.test)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_after_insert_multithread.test (renamed from storage/mroonga/mysql-test/mroonga/storage/t/optimization_skip_count_after_insert_multithread.test)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_after_insert_single_thread.test (renamed from storage/mroonga/mysql-test/mroonga/storage/t/optimization_skip_count_after_insert_single_thread.test)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_disabled.test (renamed from storage/mroonga/mysql-test/mroonga/storage/t/optimization_skip_count_disabled.test)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_view.test (renamed from storage/mroonga/mysql-test/mroonga/storage/t/optimization_skip_count_index_view.test)0
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_duplicated_order_by_columns.test45
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/partition_insert.test51
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/partition_update.test53
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/repair_table_no_index_file.test57
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/replace_geometry.test10
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/replace_without_key.test35
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_allow_column.test46
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_allow_leading_not.test44
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_allow_update.test46
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_syntax_query.test43
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_syntax_script.test44
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/variable_database_path_prefix.test6
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_global.result20
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_global.test55
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_session.test46
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_spatial.result76
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/r/count_star_with_index.result2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_index_flags_none.result9
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_index_flags_with_position_and_with_weight.result9
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_token_filters_index_comment_multiple_token_filters.result6
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_token_filters_index_comment_one_token_filter.result6
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/r/function_last_insert_grn_id.result17
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/r/geometry_contains.result78
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/r/geometry_delete.result14
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/r/geometry_update.result20
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/r/optimization_order_limit_TODO_SPLIT_ME.result14
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/r/optimization_order_limit_no_direction.result27
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/r/optimization_order_limit_order_by_primary_key.result27
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/r/performance_schema.result (renamed from storage/mroonga/mysql-test/mroonga/wrapper/r/version_55_performance_schema.result)20
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/r/repair_table_no_files.result2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/r/repair_table_no_index_file.result4
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/r/variable_match_escalation_threshold_global.result14
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/r/version_56_or_later_performance_schema.result73
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/suite.pm5
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_spatial.test77
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/count_star_with_index.test11
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_index_flags_none.test39
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_index_flags_with_position_and_with_weight.test39
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_comment_multiple_token_filters.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_comment_one_token_filter.test2
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_contains.test79
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_delete.test15
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_update.test21
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_TODO_SPLIT_ME.test8
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_no_direction.test (renamed from storage/mroonga/mysql-test/mroonga/wrapper/t/function_last_insert_grn_id.test)46
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_order_by_primary_key.test50
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/performance_schema-master.opt1
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/performance_schema.test (renamed from storage/mroonga/mysql-test/mroonga/wrapper/t/version_56_or_later_performance_schema.test)5
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/repair_table_no_files.test11
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/repair_table_no_index_file.test7
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/variable_match_escalation_threshold_global.test24
-rw-r--r--storage/mroonga/mysql-test/mroonga/wrapper/t/variable_match_escalation_threshold_session.test2
-rw-r--r--storage/mroonga/packages/Makefile.am7
-rw-r--r--storage/mroonga/packages/apt/Makefile.am67
-rw-r--r--storage/mroonga/packages/apt/Vagrantfile37
-rwxr-xr-xstorage/mroonga/packages/apt/build-deb.sh78
-rw-r--r--storage/mroonga/packages/apt/env.sh.in15
-rwxr-xr-xstorage/mroonga/packages/apt/sign-packages.sh42
-rwxr-xr-xstorage/mroonga/packages/apt/sign-repository.sh46
-rwxr-xr-xstorage/mroonga/packages/apt/update-repository.sh130
-rwxr-xr-xstorage/mroonga/packages/check-utility.sh665
-rw-r--r--storage/mroonga/packages/debian/apparmor/mysql-server-mroonga5
-rw-r--r--storage/mroonga/packages/debian/changelog403
-rw-r--r--storage/mroonga/packages/debian/compat1
-rw-r--r--storage/mroonga/packages/debian/control.in51
-rw-r--r--storage/mroonga/packages/debian/copyright27
-rw-r--r--storage/mroonga/packages/debian/mysql-server-mroonga-doc.install1
-rw-r--r--storage/mroonga/packages/debian/mysql-server-mroonga.install3
-rwxr-xr-xstorage/mroonga/packages/debian/mysql-server-mroonga.postinst72
-rwxr-xr-xstorage/mroonga/packages/debian/mysql-server-mroonga.postrm38
-rwxr-xr-xstorage/mroonga/packages/debian/mysql-server-mroonga.prerm10
-rwxr-xr-xstorage/mroonga/packages/debian/rules39
-rw-r--r--storage/mroonga/packages/rpm/Makefile.am2
-rw-r--r--storage/mroonga/packages/rpm/centos/Makefile.am9
-rw-r--r--storage/mroonga/packages/rpm/centos/mariadb-mroonga.spec.in402
-rw-r--r--storage/mroonga/packages/rpm/centos/mysql55-mroonga.spec.in224
-rw-r--r--storage/mroonga/packages/rpm/centos/mysql56-community-mroonga.spec.in231
-rw-r--r--storage/mroonga/packages/rpm/centos/percona-server-56-mroonga.spec.in156
-rw-r--r--storage/mroonga/packages/source/Makefile.am123
-rw-r--r--storage/mroonga/packages/source/patches/mariadb-10.0.3-windows-build.diff9
-rw-r--r--storage/mroonga/packages/ubuntu/Makefile.am24
-rwxr-xr-xstorage/mroonga/packages/ubuntu/upload.rb174
-rw-r--r--storage/mroonga/packages/windows/Makefile.am12
-rw-r--r--storage/mroonga/packages/windows/README.md21
-rw-r--r--storage/mroonga/packages/windows/build-vc2013-msi-32.bat8
-rw-r--r--storage/mroonga/packages/windows/build-vc2013-msi-64.bat8
-rw-r--r--storage/mroonga/packages/windows/build-vc2013-zip-32.bat8
-rw-r--r--storage/mroonga/packages/windows/build-vc2013-zip-64.bat8
-rw-r--r--storage/mroonga/packages/windows/build-vc2013.bat4
-rw-r--r--storage/mroonga/packages/windows/build-vc2015-msi-32.bat8
-rw-r--r--storage/mroonga/packages/windows/build-vc2015-msi-64.bat8
-rw-r--r--storage/mroonga/packages/windows/build-vc2015-zip-32.bat8
-rw-r--r--storage/mroonga/packages/windows/build-vc2015-zip-64.bat8
-rw-r--r--storage/mroonga/packages/windows/build-vc2015.bat4
-rw-r--r--storage/mroonga/packages/yum/Makefile.am64
-rw-r--r--storage/mroonga/packages/yum/Vagrantfile50
-rwxr-xr-xstorage/mroonga/packages/yum/build-in-vm.sh63
-rwxr-xr-xstorage/mroonga/packages/yum/build-rpm.sh119
-rw-r--r--storage/mroonga/packages/yum/env.sh.in28
-rwxr-xr-xstorage/mroonga/packages/yum/sign-rpm.sh52
-rwxr-xr-xstorage/mroonga/packages/yum/update-repository.sh29
-rw-r--r--storage/mroonga/plug.in6
-rw-r--r--storage/mroonga/plugin_version2
-rw-r--r--storage/mroonga/required_groonga_normalizer_mysql_version2
-rw-r--r--storage/mroonga/required_groonga_version2
-rw-r--r--storage/mroonga/sources.am3
-rw-r--r--storage/mroonga/test/unit/test_mrn_path_mapper.cpp20
-rwxr-xr-xstorage/mroonga/tools/travis/before_script.sh24
-rwxr-xr-xstorage/mroonga/tools/travis/install.sh147
-rwxr-xr-xstorage/mroonga/tools/travis/script.sh114
-rw-r--r--storage/mroonga/udf/mrn_udf_command.cpp17
-rw-r--r--storage/mroonga/udf/mrn_udf_escape.cpp11
-rw-r--r--storage/mroonga/udf/mrn_udf_snippet.cpp11
-rw-r--r--storage/mroonga/vendor/groonga/CMakeLists.txt215
-rw-r--r--storage/mroonga/vendor/groonga/COPYING502
-rw-r--r--storage/mroonga/vendor/groonga/Makefile.am3
-rw-r--r--storage/mroonga/vendor/groonga/appveyor.yml19
-rwxr-xr-xstorage/mroonga/vendor/groonga/autogen.sh5
-rw-r--r--storage/mroonga/vendor/groonga/base_version2
-rw-r--r--storage/mroonga/vendor/groonga/benchmark/bench-geo-distance.c2
-rw-r--r--storage/mroonga/vendor/groonga/benchmark/bench-geo-select.c2
-rw-r--r--storage/mroonga/vendor/groonga/benchmark/bench-range-select.c2
-rw-r--r--storage/mroonga/vendor/groonga/bindings/php/groonga.dsp112
-rw-r--r--storage/mroonga/vendor/groonga/build/ac_macros/check_functions.m410
-rw-r--r--storage/mroonga/vendor/groonga/build/ac_macros/check_headers.m45
-rw-r--r--storage/mroonga/vendor/groonga/build/makefiles/gettext.am21
-rw-r--r--storage/mroonga/vendor/groonga/build/makefiles/sphinx.am2
-rw-r--r--storage/mroonga/vendor/groonga/config.h.cmake17
-rw-r--r--storage/mroonga/vendor/groonga/config.sh.in1
-rw-r--r--storage/mroonga/vendor/groonga/configure.ac253
-rw-r--r--storage/mroonga/vendor/groonga/examples/Makefile.am1
-rw-r--r--storage/mroonga/vendor/groonga/examples/dictionary/Makefile.am34
-rw-r--r--storage/mroonga/vendor/groonga/examples/dictionary/edict/Makefile.am4
-rwxr-xr-xstorage/mroonga/vendor/groonga/examples/dictionary/edict/edict-import.sh21
-rwxr-xr-xstorage/mroonga/vendor/groonga/examples/dictionary/edict/edict2grn.rb56
-rw-r--r--storage/mroonga/vendor/groonga/examples/dictionary/eijiro/Makefile.am4
-rwxr-xr-xstorage/mroonga/vendor/groonga/examples/dictionary/eijiro/eijiro-import.sh12
-rwxr-xr-xstorage/mroonga/vendor/groonga/examples/dictionary/eijiro/eijiro2grn.rb61
-rw-r--r--storage/mroonga/vendor/groonga/examples/dictionary/gene95/Makefile.am4
-rwxr-xr-xstorage/mroonga/vendor/groonga/examples/dictionary/gene95/gene-import.sh26
-rwxr-xr-xstorage/mroonga/vendor/groonga/examples/dictionary/gene95/gene2grn.rb46
-rw-r--r--storage/mroonga/vendor/groonga/examples/dictionary/html/css/dictionary.css3
-rw-r--r--storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.pngbin0 -> 180 bytes
-rw-r--r--storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.pngbin0 -> 178 bytes
-rw-r--r--storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.pngbin0 -> 120 bytes
-rw-r--r--storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.pngbin0 -> 105 bytes
-rw-r--r--storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-bg_glass_75_dadada_1x400.pngbin0 -> 111 bytes
-rw-r--r--storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.pngbin0 -> 110 bytes
-rw-r--r--storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.pngbin0 -> 119 bytes
-rw-r--r--storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.pngbin0 -> 101 bytes
-rw-r--r--storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-icons_222222_256x240.pngbin0 -> 4369 bytes
-rw-r--r--storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-icons_2e83ff_256x240.pngbin0 -> 4369 bytes
-rw-r--r--storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-icons_454545_256x240.pngbin0 -> 4369 bytes
-rw-r--r--storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-icons_888888_256x240.pngbin0 -> 4369 bytes
-rw-r--r--storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-icons_cd0a0a_256x240.pngbin0 -> 4369 bytes
-rw-r--r--storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/jquery-ui-1.8.12.custom.css578
-rw-r--r--storage/mroonga/vendor/groonga/examples/dictionary/html/index.html28
-rw-r--r--storage/mroonga/vendor/groonga/examples/dictionary/html/js/dictionary.js82
-rw-r--r--storage/mroonga/vendor/groonga/examples/dictionary/html/js/jquery-1.7.2.js9404
-rw-r--r--storage/mroonga/vendor/groonga/examples/dictionary/html/js/jquery-ui-1.8.18.custom.js11802
-rw-r--r--storage/mroonga/vendor/groonga/examples/dictionary/html/js/jquery-ui-1.8.18.custom.min.js356
-rwxr-xr-xstorage/mroonga/vendor/groonga/examples/dictionary/init-db.sh10
-rw-r--r--storage/mroonga/vendor/groonga/examples/dictionary/jmdict/Makefile.am3
-rwxr-xr-xstorage/mroonga/vendor/groonga/examples/dictionary/jmdict/jmdict.rb42
-rw-r--r--storage/mroonga/vendor/groonga/examples/dictionary/readme.txt71
-rw-r--r--storage/mroonga/vendor/groonga/groonga-httpd-conf.sh.in4
-rw-r--r--storage/mroonga/vendor/groonga/include/CMakeLists.txt8
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga.h2094
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/Makefile.am13
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/command.h79
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/expr.h110
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/groonga.h2025
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/ii.h53
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/nfkc.h6
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/obj.h37
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/output.h108
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/plugin.h29
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/portability.h158
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/request_canceler.h39
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/scorer.h95
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/token.h136
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/token_filter.h10
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/tokenizer.h115
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/util.h (renamed from storage/mroonga/vendor/groonga/lib/util.h)34
-rw-r--r--storage/mroonga/vendor/groonga/lib/CMakeLists.txt97
-rw-r--r--storage/mroonga/vendor/groonga/lib/Makefile.am33
-rw-r--r--storage/mroonga/vendor/groonga/lib/com.c177
-rw-r--r--storage/mroonga/vendor/groonga/lib/command.c194
-rw-r--r--storage/mroonga/vendor/groonga/lib/ctx.c936
-rw-r--r--storage/mroonga/vendor/groonga/lib/ctx_impl_mrb.c168
-rw-r--r--storage/mroonga/vendor/groonga/lib/dat.cpp33
-rw-r--r--storage/mroonga/vendor/groonga/lib/dat/Makefile.am3
-rw-r--r--storage/mroonga/vendor/groonga/lib/dat/dat.hpp18
-rw-r--r--storage/mroonga/vendor/groonga/lib/dat/file-impl.cpp12
-rw-r--r--storage/mroonga/vendor/groonga/lib/dat/key-cursor.cpp4
-rw-r--r--storage/mroonga/vendor/groonga/lib/db.c2643
-rw-r--r--storage/mroonga/vendor/groonga/lib/error.c31
-rw-r--r--storage/mroonga/vendor/groonga/lib/expr.c2132
-rw-r--r--storage/mroonga/vendor/groonga/lib/geo.c94
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn.h (renamed from storage/mroonga/vendor/groonga/lib/groonga_in.h)404
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn_com.h (renamed from storage/mroonga/vendor/groonga/lib/com.h)14
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn_ctx.h (renamed from storage/mroonga/vendor/groonga/lib/ctx.h)198
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn_ctx_impl.h (renamed from storage/mroonga/vendor/groonga/lib/ctx_impl.h)27
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn_ctx_impl_mrb.h (renamed from storage/mroonga/vendor/groonga/lib/ctx_impl_mrb.h)4
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn_dat.h (renamed from storage/mroonga/vendor/groonga/lib/dat.h)22
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn_db.h (renamed from storage/mroonga/vendor/groonga/lib/db.h)63
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn_ecmascript.c (renamed from storage/mroonga/vendor/groonga/lib/ecmascript.c)1567
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn_ecmascript.h (renamed from storage/mroonga/vendor/groonga/lib/ecmascript.h)53
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn_ecmascript.lemon (renamed from storage/mroonga/vendor/groonga/lib/ecmascript.lemon)3
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn_error.h (renamed from storage/mroonga/vendor/groonga/lib/error.h)8
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn_expr.h (renamed from storage/mroonga/vendor/groonga/lib/expr.h)18
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn_geo.h (renamed from storage/mroonga/vendor/groonga/lib/geo.h)10
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn_hash.h (renamed from storage/mroonga/vendor/groonga/lib/hash.h)75
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn_ii.h (renamed from storage/mroonga/vendor/groonga/lib/ii.h)27
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn_io.h (renamed from storage/mroonga/vendor/groonga/lib/io.h)42
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn_logger.h37
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn_mrb.h (renamed from storage/mroonga/vendor/groonga/lib/mrb.h)7
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn_msgpack.h48
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn_normalizer.h (renamed from storage/mroonga/vendor/groonga/lib/normalizer_in.h)20
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn_output.h (renamed from storage/mroonga/vendor/groonga/lib/output.h)38
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn_pat.h (renamed from storage/mroonga/vendor/groonga/lib/pat.h)9
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn_plugin.h (renamed from storage/mroonga/vendor/groonga/lib/plugin_in.h)22
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn_proc.h (renamed from storage/mroonga/vendor/groonga/lib/proc.h)4
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn_request_canceler.h31
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn_rset.h115
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn_scorer.h51
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn_scorers.h33
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn_snip.h (renamed from storage/mroonga/vendor/groonga/lib/snip.h)10
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn_store.h (renamed from storage/mroonga/vendor/groonga/lib/store.h)21
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn_str.h (renamed from storage/mroonga/vendor/groonga/lib/str.h)10
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn_string.h (renamed from storage/mroonga/vendor/groonga/lib/string_in.h)16
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn_token_cursor.h (renamed from storage/mroonga/vendor/groonga/lib/token.h)58
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn_tokenizers.h38
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn_util.h38
-rw-r--r--storage/mroonga/vendor/groonga/lib/hash.c130
-rw-r--r--storage/mroonga/vendor/groonga/lib/ii.c1168
-rw-r--r--storage/mroonga/vendor/groonga/lib/io.c936
-rw-r--r--storage/mroonga/vendor/groonga/lib/logger.c584
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb.c126
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_accessor.c32
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_accessor.h4
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_array.c60
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_array.h34
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_bulk.c147
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_bulk.h15
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_column.c39
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_column.h2
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_command.c180
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_command.h36
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_command_input.c122
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_command_input.h34
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_content_type.c49
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_content_type.h34
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_converter.c214
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_converter.h29
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_ctx.c489
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_ctx.h4
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_database.c124
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_database.h34
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_double_array_trie.c60
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_double_array_trie.h34
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_error.c161
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_error.h2
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_expr.c397
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_expr.h9
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_fixed_size_column.c2
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_fixed_size_column.h2
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_hash_table.c117
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_hash_table.h34
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_id.c7
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_id.h2
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_index_column.c100
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_index_column.h2
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_index_cursor.c224
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_index_cursor.h34
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_logger.c4
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_logger.h2
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_obj.c135
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_object.c263
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_object.h34
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_object_flags.c95
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_object_flags.h34
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_operator.c282
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_operator.h6
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_options.c39
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_options.h40
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_patricia_trie.c59
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_patricia_trie.h34
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_procedure.c14
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_procedure.h2
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_table.c257
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_table.h34
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_table_cursor.c176
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_table_cursor.h34
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_table_cursor_flags.c60
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_table_cursor_flags.h34
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_type.c60
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_type.h (renamed from storage/mroonga/vendor/groonga/lib/mrb/mrb_obj.h)12
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_variable_size_column.c2
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_variable_size_column.h2
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_void.c4
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_void.h2
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_writer.c238
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/mrb_writer.h34
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/scripts/Makefile.am8
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/scripts/backtrace_entry.rb16
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/scripts/command.rb35
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/scripts/command_line/Makefile.am9
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/scripts/command_line/grndb.rb169
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/scripts/command_line/sources.am2
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/scripts/context.rb37
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/scripts/context/Makefile.am9
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/scripts/context/rc.rb242
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/scripts/context/sources.am3
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/scripts/database.rb39
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/scripts/error.rb16
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/scripts/expression.rb23
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/scripts/expression_size_estimator.rb155
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/scripts/index_column.rb39
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/scripts/index_cursor.rb18
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/scripts/initialize/Makefile.am9
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/scripts/initialize/post.rb18
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/scripts/initialize/pre.rb3
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/scripts/initialize/sources.am3
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/scripts/logger.rb24
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/scripts/logger/Makefile.am9
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/scripts/logger/sources.am2
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/scripts/object.rb8
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/scripts/operator.rb22
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/scripts/plugin_loader.rb14
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/scripts/require.rb68
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/scripts/scan_info.rb9
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/scripts/scan_info_builder.rb46
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/scripts/scan_info_data.rb175
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/scripts/scan_info_search_index.rb9
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/scripts/sources.am18
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/scripts/table_cursor.rb26
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/scripts/writer.rb21
-rw-r--r--storage/mroonga/vendor/groonga/lib/mrb/sources.am38
-rw-r--r--storage/mroonga/vendor/groonga/lib/nfkc.c5
-rw-r--r--storage/mroonga/vendor/groonga/lib/normalizer.c6
-rw-r--r--storage/mroonga/vendor/groonga/lib/obj.c106
-rw-r--r--storage/mroonga/vendor/groonga/lib/operator.c928
-rw-r--r--storage/mroonga/vendor/groonga/lib/output.c282
-rw-r--r--storage/mroonga/vendor/groonga/lib/pat.c66
-rw-r--r--storage/mroonga/vendor/groonga/lib/plugin.c555
-rw-r--r--storage/mroonga/vendor/groonga/lib/proc.c2540
-rw-r--r--storage/mroonga/vendor/groonga/lib/request_canceler.c123
-rw-r--r--storage/mroonga/vendor/groonga/lib/rset.c324
-rw-r--r--storage/mroonga/vendor/groonga/lib/scorer.c189
-rw-r--r--storage/mroonga/vendor/groonga/lib/scorers.c96
-rw-r--r--storage/mroonga/vendor/groonga/lib/snip.c17
-rw-r--r--storage/mroonga/vendor/groonga/lib/sources.am68
-rw-r--r--storage/mroonga/vendor/groonga/lib/store.c221
-rw-r--r--storage/mroonga/vendor/groonga/lib/str.c125
-rw-r--r--storage/mroonga/vendor/groonga/lib/string.c33
-rw-r--r--storage/mroonga/vendor/groonga/lib/token_cursor.c359
-rw-r--r--storage/mroonga/vendor/groonga/lib/token_filter.c4
-rw-r--r--storage/mroonga/vendor/groonga/lib/tokenizer.c39
-rw-r--r--storage/mroonga/vendor/groonga/lib/tokenizers.c (renamed from storage/mroonga/vendor/groonga/lib/token.c)583
-rw-r--r--storage/mroonga/vendor/groonga/lib/util.c274
-rw-r--r--storage/mroonga/vendor/groonga/nginx_version2
-rw-r--r--storage/mroonga/vendor/groonga/plugins/CMakeLists.txt10
-rw-r--r--storage/mroonga/vendor/groonga/plugins/Makefile.am11
-rw-r--r--storage/mroonga/vendor/groonga/plugins/functions/CMakeLists.txt32
-rw-r--r--storage/mroonga/vendor/groonga/plugins/functions/Makefile.am20
-rw-r--r--storage/mroonga/vendor/groonga/plugins/functions/vector.c90
-rw-r--r--storage/mroonga/vendor/groonga/plugins/functions/vector_sources.am2
-rw-r--r--storage/mroonga/vendor/groonga/plugins/query_expanders/CMakeLists.txt4
-rw-r--r--storage/mroonga/vendor/groonga/plugins/query_expanders/tsv.c58
-rw-r--r--storage/mroonga/vendor/groonga/plugins/ruby/CMakeLists.txt8
-rw-r--r--storage/mroonga/vendor/groonga/plugins/ruby/ruby_plugin.h10
-rw-r--r--storage/mroonga/vendor/groonga/plugins/ruby_scripts.am2
-rw-r--r--storage/mroonga/vendor/groonga/plugins/sharding.rb4
-rw-r--r--storage/mroonga/vendor/groonga/plugins/sharding/CMakeLists.txt22
-rw-r--r--storage/mroonga/vendor/groonga/plugins/sharding/Makefile.am9
-rw-r--r--storage/mroonga/vendor/groonga/plugins/sharding/logical_count.rb132
-rw-r--r--storage/mroonga/vendor/groonga/plugins/sharding/logical_enumerator.rb180
-rw-r--r--storage/mroonga/vendor/groonga/plugins/sharding/logical_range_filter.rb442
-rw-r--r--storage/mroonga/vendor/groonga/plugins/sharding/range_expression_builder.rb65
-rw-r--r--storage/mroonga/vendor/groonga/plugins/sharding/sources.am5
-rw-r--r--storage/mroonga/vendor/groonga/plugins/suggest/CMakeLists.txt4
-rw-r--r--storage/mroonga/vendor/groonga/plugins/suggest/suggest.c47
-rw-r--r--storage/mroonga/vendor/groonga/plugins/table/CMakeLists.txt4
-rw-r--r--storage/mroonga/vendor/groonga/plugins/table/table.c8
-rw-r--r--storage/mroonga/vendor/groonga/plugins/token_filters/CMakeLists.txt17
-rw-r--r--storage/mroonga/vendor/groonga/plugins/token_filters/Makefile.am8
-rw-r--r--storage/mroonga/vendor/groonga/plugins/token_filters/stem.c275
-rw-r--r--storage/mroonga/vendor/groonga/plugins/token_filters/stem_sources.am2
-rw-r--r--storage/mroonga/vendor/groonga/plugins/token_filters/stop_word.c49
-rw-r--r--storage/mroonga/vendor/groonga/plugins/tokenizers/CMakeLists.txt8
-rw-r--r--storage/mroonga/vendor/groonga/plugins/tokenizers/mecab.c291
-rw-r--r--storage/mroonga/vendor/groonga/src/CMakeLists.txt12
-rw-r--r--storage/mroonga/vendor/groonga/src/Makefile.am19
-rw-r--r--storage/mroonga/vendor/groonga/src/grndb.c137
-rw-r--r--storage/mroonga/vendor/groonga/src/grndb_sources.am2
-rw-r--r--storage/mroonga/vendor/groonga/src/grnslap.c10
-rw-r--r--storage/mroonga/vendor/groonga/src/groonga.c760
-rw-r--r--storage/mroonga/vendor/groonga/src/groonga_benchmark.c172
-rw-r--r--storage/mroonga/vendor/groonga/src/groonga_mruby.c84
-rw-r--r--storage/mroonga/vendor/groonga/src/groonga_mruby_sources.am2
-rw-r--r--storage/mroonga/vendor/groonga/src/httpd/nginx-module/ngx_http_groonga_module.c277
-rw-r--r--storage/mroonga/vendor/groonga/src/suggest/CMakeLists.txt16
-rw-r--r--storage/mroonga/vendor/groonga/src/suggest/groonga_suggest_create_dataset.c2
-rw-r--r--storage/mroonga/vendor/groonga/src/suggest/groonga_suggest_httpd.c90
-rw-r--r--storage/mroonga/vendor/groonga/src/suggest/groonga_suggest_learner.c72
-rwxr-xr-xstorage/mroonga/vendor/groonga/tools/travis-before-script.sh59
-rwxr-xr-xstorage/mroonga/vendor/groonga/tools/travis-install.sh28
-rwxr-xr-xstorage/mroonga/vendor/groonga/tools/travis-script.sh28
-rw-r--r--storage/mroonga/vendor/groonga/vendor/CMakeLists.txt1
-rw-r--r--storage/mroonga/vendor/groonga/vendor/Makefile.am1
-rw-r--r--storage/mroonga/vendor/groonga/vendor/mruby/CMakeLists.txt63
-rw-r--r--storage/mroonga/vendor/groonga/vendor/mruby/Makefile.am58
-rw-r--r--storage/mroonga/vendor/groonga/vendor/mruby/build_config.rb9
-rw-r--r--storage/mroonga/vendor/groonga/vendor/mruby/built_sources.am11
-rwxr-xr-xstorage/mroonga/vendor/groonga/vendor/mruby/mruby_build.rb51
-rw-r--r--storage/mroonga/vendor/groonga/vendor/mruby/sources.am1
-rw-r--r--storage/mroonga/vendor/groonga/vendor/onigmo/CMakeLists.txt110
-rw-r--r--storage/mroonga/vendor/groonga/vendor/onigmo/Makefile.am14
-rw-r--r--storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/AUTHORS1
-rw-r--r--storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/CMakeLists.txt23
-rw-r--r--storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/INSTALL1
-rw-r--r--storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/NEWS1
-rw-r--r--storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/README1
-rw-r--r--storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/README.md68
-rw-r--r--storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/configure.ac38
-rw-r--r--storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/doc/text/Makefile.am5
-rw-r--r--storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/doc/text/news.md19
-rw-r--r--storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/CMakeLists.txt18
-rw-r--r--storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/Makefile.am29
-rw-r--r--storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql.c121
-rw-r--r--storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql_general_ci_table.h2
-rw-r--r--storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql_sources.am12
-rw-r--r--storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql_unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_table.h5028
-rw-r--r--storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql_unicode_520_ci_table.h5028
-rw-r--r--storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql_unicode_ci_except_kana_ci_kana_with_voiced_sound_mark_table.h6
-rw-r--r--storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql_unicode_ci_table.h6
-rw-r--r--storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/apt/Makefile.am2
-rw-r--r--storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/apt/Vagrantfile13
-rw-r--r--storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/debian/changelog18
-rw-r--r--storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/debian/control20
-rw-r--r--storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/debian/copyright98
-rwxr-xr-xstorage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/debian/rules2
-rw-r--r--storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/debian/watch2
-rw-r--r--storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/rpm/centos/groonga-normalizer-mysql.spec.in10
-rw-r--r--storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/rpm/fedora/groonga-normalizer-mysql.spec.in10
-rw-r--r--storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/ubuntu/Makefile.am2
-rw-r--r--storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/yum/Makefile.am1
-rw-r--r--storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/yum/Vagrantfile8
-rwxr-xr-xstorage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/tool/generate_uca_table.rb38
-rw-r--r--storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/tool/parser.rb32
-rw-r--r--storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/version2
-rw-r--r--storage/mroonga/version2
-rw-r--r--storage/mroonga/version_in_hex2
-rw-r--r--storage/mroonga/version_major2
-rw-r--r--storage/mroonga/version_micro2
-rw-r--r--storage/myisam/mi_check.c12
-rw-r--r--storage/myisam/rt_split.c9
-rw-r--r--storage/oqgraph/CMakeLists.txt1
-rw-r--r--storage/oqgraph/graphcore-types.h2
-rw-r--r--storage/oqgraph/graphcore.cc3
-rw-r--r--storage/oqgraph/graphcore.h3
-rw-r--r--storage/oqgraph/ha_oqgraph.cc504
-rw-r--r--storage/oqgraph/ha_oqgraph.h7
-rw-r--r--storage/oqgraph/mysql-test/oqgraph/create_attr.result40
-rw-r--r--storage/oqgraph/mysql-test/oqgraph/create_attr.test20
-rw-r--r--storage/oqgraph/mysql-test/oqgraph/create_attr_legacy.result20
-rw-r--r--storage/oqgraph/mysql-test/oqgraph/regression_mdev6282.result37
-rw-r--r--storage/oqgraph/mysql-test/oqgraph/regression_mdev6282.test47
-rw-r--r--storage/oqgraph/mysql-test/oqgraph/regression_mdev6345.result12
-rw-r--r--storage/oqgraph/mysql-test/oqgraph/regression_mdev6345.test19
-rw-r--r--storage/oqgraph/oqgraph_judy.cc6
-rw-r--r--storage/oqgraph/oqgraph_thunk.cc3
-rw-r--r--storage/oqgraph/oqgraph_thunk.h3
-rw-r--r--storage/perfschema/CMakeLists.txt22
-rw-r--r--storage/perfschema/ha_perfschema.cc2
-rw-r--r--storage/perfschema/pfs.cc83
-rw-r--r--storage/perfschema/pfs_account.cc2
-rw-r--r--storage/perfschema/pfs_column_types.h2
-rw-r--r--storage/perfschema/pfs_digest.cc526
-rw-r--r--storage/perfschema/pfs_digest.h148
-rw-r--r--storage/perfschema/pfs_engine_table.cc56
-rw-r--r--storage/perfschema/pfs_events_statements.cc38
-rw-r--r--storage/perfschema/pfs_events_statements.h10
-rw-r--r--storage/perfschema/pfs_host.cc2
-rw-r--r--storage/perfschema/pfs_instr.cc52
-rw-r--r--storage/perfschema/pfs_instr.h4
-rw-r--r--storage/perfschema/pfs_server.cc2
-rw-r--r--storage/perfschema/pfs_server.h4
-rw-r--r--storage/perfschema/pfs_user.cc2
-rw-r--r--storage/perfschema/table_events_statements.cc46
-rw-r--r--storage/perfschema/table_events_statements.h7
-rw-r--r--storage/perfschema/table_helper.cc22
-rw-r--r--storage/perfschema/table_helper.h6
-rw-r--r--storage/perfschema/unittest/CMakeLists.txt11
-rw-r--r--storage/perfschema/unittest/pfs-t.cc6
-rw-r--r--storage/perfschema/unittest/pfs_account-oom-t.cc3
-rw-r--r--storage/perfschema/unittest/pfs_host-oom-t.cc3
-rw-r--r--storage/perfschema/unittest/pfs_instr-oom-t.cc3
-rw-r--r--storage/perfschema/unittest/pfs_instr-t.cc7
-rw-r--r--storage/perfschema/unittest/pfs_instr_class-oom-t.cc3
-rw-r--r--storage/perfschema/unittest/pfs_instr_class-t.cc4
-rw-r--r--storage/perfschema/unittest/pfs_server_stubs.cc (renamed from storage/perfschema/unittest/stub_server_misc.h)11
-rw-r--r--storage/perfschema/unittest/pfs_user-oom-t.cc3
-rw-r--r--storage/sphinx/mysql-test/sphinx/my.cnf3
-rw-r--r--storage/spider/CMakeLists.txt5
-rw-r--r--storage/spider/ha_spider.cc116
-rw-r--r--storage/spider/ha_spider.h7
-rw-r--r--storage/spider/mysql-test/spider/bg/include/ha_deinit_child3_1.inc2
-rw-r--r--storage/spider/mysql-test/spider/bg/include/ha_deinit_child3_2.inc2
-rw-r--r--storage/spider/mysql-test/spider/bg/include/ha_deinit_child3_3.inc2
-rw-r--r--storage/spider/mysql-test/spider/bg/include/ha_init_child2_1.inc16
-rw-r--r--storage/spider/mysql-test/spider/bg/include/ha_init_child2_2.inc8
-rw-r--r--storage/spider/mysql-test/spider/bg/include/ha_init_child2_3.inc8
-rw-r--r--storage/spider/mysql-test/spider/bg/include/ha_init_child3_1.inc280
-rw-r--r--storage/spider/mysql-test/spider/bg/include/ha_init_child3_2.inc280
-rw-r--r--storage/spider/mysql-test/spider/bg/include/ha_init_child3_3.inc280
-rw-r--r--storage/spider/mysql-test/spider/bg/include/hs_init_child2_1.inc48
-rw-r--r--storage/spider/mysql-test/spider/bg/include/hs_init_child2_2.inc24
-rw-r--r--storage/spider/mysql-test/spider/bg/include/init_child2_1.inc350
-rw-r--r--storage/spider/mysql-test/spider/bg/include/init_child2_2.inc160
-rw-r--r--storage/spider/mysql-test/spider/bg/include/init_child2_3.inc22
-rw-r--r--storage/spider/mysql-test/spider/bg/include/init_slave1_1.inc20
-rw-r--r--storage/spider/mysql-test/spider/bg/t/direct_aggregate.test358
-rw-r--r--storage/spider/mysql-test/spider/bg/t/direct_aggregate_part.test384
-rw-r--r--storage/spider/mysql-test/spider/bg/t/have_partition.inc14
-rw-r--r--storage/spider/mysql-test/spider/bg/t/have_trigger.inc4
-rw-r--r--storage/spider/mysql-test/spider/bg/t/spider3_fixes.test584
-rw-r--r--storage/spider/mysql-test/spider/bg/t/spider3_fixes_part.test690
-rw-r--r--storage/spider/mysql-test/spider/handler/include/ha_deinit_child3_1.inc2
-rw-r--r--storage/spider/mysql-test/spider/handler/include/ha_deinit_child3_2.inc2
-rw-r--r--storage/spider/mysql-test/spider/handler/include/ha_deinit_child3_3.inc2
-rw-r--r--storage/spider/mysql-test/spider/handler/include/ha_init_child2_1.inc16
-rw-r--r--storage/spider/mysql-test/spider/handler/include/ha_init_child2_2.inc8
-rw-r--r--storage/spider/mysql-test/spider/handler/include/ha_init_child2_3.inc8
-rw-r--r--storage/spider/mysql-test/spider/handler/include/ha_init_child3_1.inc280
-rw-r--r--storage/spider/mysql-test/spider/handler/include/ha_init_child3_2.inc280
-rw-r--r--storage/spider/mysql-test/spider/handler/include/ha_init_child3_3.inc280
-rw-r--r--storage/spider/mysql-test/spider/handler/include/hs_init_child2_1.inc48
-rw-r--r--storage/spider/mysql-test/spider/handler/include/hs_init_child2_2.inc24
-rw-r--r--storage/spider/mysql-test/spider/handler/include/init_child2_1.inc352
-rw-r--r--storage/spider/mysql-test/spider/handler/include/init_child2_2.inc160
-rw-r--r--storage/spider/mysql-test/spider/handler/include/init_child2_3.inc22
-rw-r--r--storage/spider/mysql-test/spider/handler/include/init_slave1_1.inc20
-rw-r--r--storage/spider/mysql-test/spider/handler/t/direct_aggregate.test358
-rw-r--r--storage/spider/mysql-test/spider/handler/t/direct_aggregate_part.test384
-rw-r--r--storage/spider/mysql-test/spider/handler/t/have_partition.inc14
-rw-r--r--storage/spider/mysql-test/spider/handler/t/have_trigger.inc4
-rw-r--r--storage/spider/mysql-test/spider/handler/t/spider3_fixes.test584
-rw-r--r--storage/spider/mysql-test/spider/handler/t/spider3_fixes_part.test690
-rw-r--r--storage/spider/mysql-test/spider/include/deinit_child2_1.inc6
-rw-r--r--storage/spider/mysql-test/spider/include/deinit_child2_2.inc6
-rw-r--r--storage/spider/mysql-test/spider/include/deinit_child2_3.inc6
-rw-r--r--storage/spider/mysql-test/spider/include/deinit_child3_1.inc6
-rw-r--r--storage/spider/mysql-test/spider/include/deinit_child3_2.inc6
-rw-r--r--storage/spider/mysql-test/spider/include/deinit_child3_3.inc6
-rw-r--r--storage/spider/mysql-test/spider/include/deinit_engine.inc8
-rw-r--r--storage/spider/mysql-test/spider/include/ha_deinit_child3_1.inc2
-rw-r--r--storage/spider/mysql-test/spider/include/ha_deinit_child3_2.inc2
-rw-r--r--storage/spider/mysql-test/spider/include/ha_deinit_child3_3.inc2
-rw-r--r--storage/spider/mysql-test/spider/include/ha_init_child2_1.inc16
-rw-r--r--storage/spider/mysql-test/spider/include/ha_init_child2_2.inc8
-rw-r--r--storage/spider/mysql-test/spider/include/ha_init_child2_3.inc8
-rw-r--r--storage/spider/mysql-test/spider/include/ha_init_child3_1.inc280
-rw-r--r--storage/spider/mysql-test/spider/include/ha_init_child3_2.inc280
-rw-r--r--storage/spider/mysql-test/spider/include/ha_init_child3_3.inc280
-rw-r--r--storage/spider/mysql-test/spider/include/hs_init_child2_1.inc48
-rw-r--r--storage/spider/mysql-test/spider/include/hs_init_child2_2.inc24
-rw-r--r--storage/spider/mysql-test/spider/include/init_child2_1.inc356
-rw-r--r--storage/spider/mysql-test/spider/include/init_child2_2.inc166
-rw-r--r--storage/spider/mysql-test/spider/include/init_child2_3.inc28
-rw-r--r--storage/spider/mysql-test/spider/include/init_child3_1.inc6
-rw-r--r--storage/spider/mysql-test/spider/include/init_child3_2.inc6
-rw-r--r--storage/spider/mysql-test/spider/include/init_child3_3.inc6
-rw-r--r--storage/spider/mysql-test/spider/include/init_slave1_1.inc20
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/deinit_child3_1.inc6
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/deinit_child3_2.inc6
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/deinit_child3_3.inc6
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/ha_deinit_child3_1.inc2
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/ha_deinit_child3_2.inc2
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/ha_deinit_child3_3.inc2
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/ha_init_child2_1.inc16
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/ha_init_child2_2.inc8
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/ha_init_child2_3.inc8
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/ha_init_child3_1.inc280
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/ha_init_child3_2.inc280
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/ha_init_child3_3.inc280
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/hs_init_child2_1.inc48
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/hs_init_child2_2.inc24
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/init_child2_1.inc384
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/init_child2_2.inc188
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/init_child2_3.inc30
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/init_child3_1.inc6
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/init_child3_2.inc6
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/init_child3_3.inc6
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/init_slave1_1.inc20
-rw-r--r--storage/spider/mysql-test/spider/oracle/t/direct_aggregate.test358
-rw-r--r--storage/spider/mysql-test/spider/oracle/t/direct_aggregate_part.test384
-rw-r--r--storage/spider/mysql-test/spider/oracle/t/have_partition.inc14
-rw-r--r--storage/spider/mysql-test/spider/oracle/t/have_trigger.inc4
-rw-r--r--storage/spider/mysql-test/spider/oracle/t/spider3_fixes.test584
-rw-r--r--storage/spider/mysql-test/spider/oracle/t/spider3_fixes_part.test690
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/deinit_child3_1.inc6
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/deinit_child3_2.inc6
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/deinit_child3_3.inc6
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child3_1.inc2
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child3_2.inc2
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child3_3.inc2
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/ha_init_child2_1.inc16
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/ha_init_child2_2.inc8
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/ha_init_child2_3.inc8
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/ha_init_child3_1.inc280
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/ha_init_child3_2.inc280
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/ha_init_child3_3.inc280
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/hs_init_child2_1.inc48
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/hs_init_child2_2.inc24
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/init_child2_1.inc384
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/init_child2_2.inc188
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/init_child2_3.inc30
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/init_child3_1.inc6
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/init_child3_2.inc6
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/init_child3_3.inc6
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/init_slave1_1.inc20
-rw-r--r--storage/spider/mysql-test/spider/oracle2/t/direct_aggregate.test358
-rw-r--r--storage/spider/mysql-test/spider/oracle2/t/direct_aggregate_part.test384
-rw-r--r--storage/spider/mysql-test/spider/oracle2/t/have_partition.inc14
-rw-r--r--storage/spider/mysql-test/spider/oracle2/t/have_trigger.inc4
-rw-r--r--storage/spider/mysql-test/spider/oracle2/t/spider3_fixes.test584
-rw-r--r--storage/spider/mysql-test/spider/oracle2/t/spider3_fixes_part.test690
-rw-r--r--storage/spider/mysql-test/spider/t/direct_aggregate.test358
-rw-r--r--storage/spider/mysql-test/spider/t/direct_aggregate_part.test384
-rw-r--r--storage/spider/mysql-test/spider/t/have_partition.inc14
-rw-r--r--storage/spider/mysql-test/spider/t/have_trigger.inc4
-rw-r--r--storage/spider/mysql-test/spider/t/spider3_fixes.test584
-rw-r--r--storage/spider/mysql-test/spider/t/spider3_fixes_part.test690
-rw-r--r--storage/spider/spd_conn.cc1
-rw-r--r--storage/spider/spd_copy_tables.cc1
-rw-r--r--storage/spider/spd_db_conn.cc97
-rw-r--r--storage/spider/spd_db_handlersocket.cc3
-rw-r--r--storage/spider/spd_db_include.h9
-rw-r--r--storage/spider/spd_db_mysql.cc68
-rw-r--r--storage/spider/spd_db_oracle.cc63
-rw-r--r--storage/spider/spd_direct_sql.cc1
-rw-r--r--storage/spider/spd_i_s.cc1
-rw-r--r--storage/spider/spd_include.h14
-rw-r--r--storage/spider/spd_malloc.cc1
-rw-r--r--storage/spider/spd_param.cc28
-rw-r--r--storage/spider/spd_param.h4
-rw-r--r--storage/spider/spd_ping_table.cc1
-rw-r--r--storage/spider/spd_sys_table.cc1
-rw-r--r--storage/spider/spd_table.cc123
-rw-r--r--storage/spider/spd_table.h5
-rw-r--r--storage/spider/spd_trx.cc1
-rw-r--r--storage/tokudb/CMakeLists.txt2
-rw-r--r--storage/tokudb/README.md9
-rw-r--r--storage/tokudb/doc2/sysbench.update.ma10.tokudb754.loglog.pngbin6947 -> 7209 bytes
-rw-r--r--storage/tokudb/doc2/sysbench.update.ma10.tokudb754.pngbin7351 -> 7527 bytes
-rw-r--r--storage/tokudb/ft-index/buildheader/make_tdb.cc10
-rw-r--r--storage/tokudb/ft-index/ft/ft-internal.h2
-rw-r--r--storage/tokudb/ft-index/ft/ft-ops.cc6
-rw-r--r--storage/tokudb/ft-index/ft/ft-verify.cc20
-rw-r--r--storage/tokudb/ft-index/ft/ft.cc5
-rw-r--r--storage/tokudb/ft-index/ft/logger/recover.cc66
-rw-r--r--storage/tokudb/ft-index/ft/txn/txn.cc9
-rw-r--r--storage/tokudb/ft-index/ft/txn/txn.h5
-rw-r--r--storage/tokudb/ft-index/src/tests/recover-5146.cc2
-rw-r--r--storage/tokudb/ft-index/src/tests/test-prepare.cc2
-rw-r--r--storage/tokudb/ft-index/src/tests/test-prepare2.cc2
-rw-r--r--storage/tokudb/ft-index/src/tests/test-prepare3.cc2
-rw-r--r--storage/tokudb/ft-index/src/tests/test-xa-prepare.cc2
-rw-r--r--storage/tokudb/ft-index/src/tests/test5092.cc2
-rw-r--r--storage/tokudb/ft-index/src/tests/test_5015.cc2
-rw-r--r--storage/tokudb/ft-index/src/tests/test_cursor_interrupt.cc4
-rw-r--r--storage/tokudb/ft-index/src/tests/test_iterate_live_transactions.cc4
-rw-r--r--storage/tokudb/ft-index/src/tests/test_stress0.cc4
-rw-r--r--storage/tokudb/ft-index/src/tests/test_stress_hot_indexing.cc2
-rw-r--r--storage/tokudb/ft-index/src/tests/test_txn_close_before_prepare_commit.cc2
-rw-r--r--storage/tokudb/ft-index/src/tests/threaded_stress_test_helpers.h2
-rw-r--r--storage/tokudb/ft-index/src/tests/xa-dirty-commit.cc2
-rw-r--r--storage/tokudb/ft-index/src/tests/xa-dirty-rollback.cc2
-rw-r--r--storage/tokudb/ft-index/src/tests/xa-txn-discard-abort.cc2
-rw-r--r--storage/tokudb/ft-index/src/tests/xa-txn-discard-commit.cc2
-rw-r--r--storage/tokudb/ft-index/src/ydb.cc21
-rw-r--r--storage/tokudb/ft-index/src/ydb_cursor.cc2
-rw-r--r--storage/tokudb/ft-index/src/ydb_txn.cc21
-rw-r--r--storage/tokudb/ft-index/tools/CMakeLists.txt9
-rw-r--r--storage/tokudb/ft-index/tools/tokuft_logprint.cc (renamed from storage/tokudb/ft-index/tools/tdb_logprint.cc)2
-rw-r--r--storage/tokudb/ft-index/tools/tokuftdump.cc477
-rw-r--r--storage/tokudb/ft-index/util/scoped_malloc.cc25
-rw-r--r--storage/tokudb/ft-index/util/scoped_malloc.h4
-rw-r--r--storage/tokudb/ft-index/util/tests/sm-basic.cc127
-rw-r--r--storage/tokudb/ft-index/util/tests/sm-crash-double-free.cc128
-rw-r--r--storage/tokudb/ha_tokudb.cc144
-rw-r--r--storage/tokudb/ha_tokudb_admin.cc104
-rw-r--r--storage/tokudb/ha_tokudb_alter_56.cc15
-rw-r--r--storage/tokudb/hatoku_defines.h4
-rw-r--r--storage/tokudb/hatoku_hton.cc126
-rw-r--r--storage/tokudb/hatoku_hton.h24
-rw-r--r--storage/tokudb/mysql-test/rpl/disabled.def3
-rw-r--r--storage/tokudb/mysql-test/rpl/r/rpl_tokudb_read_only_ff.result14
-rw-r--r--storage/tokudb/mysql-test/rpl/r/rpl_tokudb_read_only_ft.result14
-rw-r--r--storage/tokudb/mysql-test/rpl/r/rpl_tokudb_read_only_tf.result14
-rw-r--r--storage/tokudb/mysql-test/rpl/r/rpl_tokudb_read_only_tt.result14
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_tokudb_read_only_ff-slave.opt1
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_tokudb_read_only_ff.test53
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_tokudb_read_only_ft-slave.opt1
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_tokudb_read_only_ft.test53
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_tokudb_read_only_tf-slave.opt1
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_tokudb_read_only_tf.test53
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_tokudb_read_only_tt-slave.opt1
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_tokudb_read_only_tt.test53
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/i_s_tokudb_lock_waits_released.result10
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/i_s_tokudb_lock_waits_timeout.result6
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/i_s_tokudb_trx.result10
-rw-r--r--storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_lock_waits_released.test10
-rw-r--r--storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_lock_waits_timeout.test6
-rw-r--r--storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_trx.test10
-rw-r--r--storage/tokudb/mysql-test/tokudb_bugs/r/5733_tokudb.result2
-rw-r--r--storage/tokudb/mysql-test/tokudb_bugs/r/db788-optimize-index-name.result19
-rw-r--r--storage/tokudb/mysql-test/tokudb_bugs/r/db801.result18
-rw-r--r--storage/tokudb/mysql-test/tokudb_bugs/r/db805.result18
-rw-r--r--storage/tokudb/mysql-test/tokudb_bugs/r/db806.result9
-rw-r--r--storage/tokudb/mysql-test/tokudb_bugs/r/db811.result14
-rw-r--r--storage/tokudb/mysql-test/tokudb_bugs/r/db811s.result14
-rw-r--r--storage/tokudb/mysql-test/tokudb_bugs/r/db817.result33
-rw-r--r--storage/tokudb/mysql-test/tokudb_bugs/r/db823.result11
-rw-r--r--storage/tokudb/mysql-test/tokudb_bugs/r/memcache_dirty.result14
-rw-r--r--storage/tokudb/mysql-test/tokudb_bugs/r/tokudb718.result5
-rw-r--r--storage/tokudb/mysql-test/tokudb_bugs/t/5733_tokudb.test15
-rw-r--r--storage/tokudb/mysql-test/tokudb_bugs/t/db788-optimize-index-name.test21
-rw-r--r--storage/tokudb/mysql-test/tokudb_bugs/t/db801.test50
-rw-r--r--storage/tokudb/mysql-test/tokudb_bugs/t/db805.test17
-rw-r--r--storage/tokudb/mysql-test/tokudb_bugs/t/db806.test13
-rw-r--r--storage/tokudb/mysql-test/tokudb_bugs/t/db811.test22
-rw-r--r--storage/tokudb/mysql-test/tokudb_bugs/t/db811s.test22
-rw-r--r--storage/tokudb/mysql-test/tokudb_bugs/t/db817.test38
-rw-r--r--storage/tokudb/mysql-test/tokudb_bugs/t/db823.test16
-rw-r--r--storage/tokudb/mysql-test/tokudb_bugs/t/memcache_dirty.test25
-rw-r--r--storage/tokudb/mysql-test/tokudb_bugs/t/tokudb718.test3
-rw-r--r--storage/tokudb/scripts/common.sh24
-rwxr-xr-xstorage/tokudb/scripts/make.mysql.bash16
-rwxr-xr-xstorage/tokudb/scripts/make.mysql.debug.env.bash12
-rw-r--r--storage/tokudb/tokudb_card.h35
-rw-r--r--storage/xtradb/CMakeLists.txt10
-rw-r--r--storage/xtradb/api/api0api.cc208
-rw-r--r--storage/xtradb/btr/btr0cur.cc12
-rw-r--r--storage/xtradb/buf/buf0buf.cc11
-rw-r--r--storage/xtradb/buf/buf0flu.cc6
-rw-r--r--storage/xtradb/buf/buf0lru.cc2
-rw-r--r--storage/xtradb/buf/buf0rea.cc8
-rw-r--r--storage/xtradb/dict/dict0boot.cc12
-rw-r--r--storage/xtradb/dict/dict0dict.cc153
-rw-r--r--storage/xtradb/dict/dict0load.cc3
-rw-r--r--storage/xtradb/dict/dict0mem.cc93
-rw-r--r--storage/xtradb/fil/fil0fil.cc7
-rw-r--r--storage/xtradb/fsp/fsp0fsp.cc40
-rw-r--r--storage/xtradb/fts/fts0ast.cc48
-rw-r--r--storage/xtradb/fts/fts0fts.cc111
-rw-r--r--storage/xtradb/fts/fts0opt.cc11
-rw-r--r--storage/xtradb/fts/fts0que.cc49
-rw-r--r--storage/xtradb/handler/ha_innodb.cc100
-rw-r--r--storage/xtradb/handler/handler0alter.cc42
-rw-r--r--storage/xtradb/handler/i_s.cc23
-rw-r--r--storage/xtradb/ibuf/ibuf0ibuf.cc13
-rw-r--r--storage/xtradb/include/buf0buf.h8
-rw-r--r--storage/xtradb/include/buf0buf.ic12
-rw-r--r--storage/xtradb/include/buf0flu.h4
-rw-r--r--storage/xtradb/include/db0err.h5
-rw-r--r--storage/xtradb/include/dict0dict.h11
-rw-r--r--storage/xtradb/include/dict0mem.h137
-rw-r--r--storage/xtradb/include/fts0ast.h7
-rw-r--r--storage/xtradb/include/ha_prototypes.h2
-rw-r--r--storage/xtradb/include/lock0priv.h7
-rw-r--r--storage/xtradb/include/os0file.h2
-rw-r--r--storage/xtradb/include/os0sync.h4
-rw-r--r--storage/xtradb/include/row0merge.h3
-rw-r--r--storage/xtradb/include/sync0rw.ic7
-rw-r--r--storage/xtradb/include/sync0sync.h1
-rw-r--r--storage/xtradb/include/trx0roll.h4
-rw-r--r--storage/xtradb/include/trx0trx.h15
-rw-r--r--storage/xtradb/include/univ.i4
-rw-r--r--storage/xtradb/lock/lock0lock.cc54
-rw-r--r--storage/xtradb/log/log0log.cc9
-rw-r--r--storage/xtradb/log/log0recv.cc5
-rw-r--r--storage/xtradb/mtr/mtr0log.cc2
-rw-r--r--storage/xtradb/os/os0file.cc86
-rw-r--r--storage/xtradb/os/os0sync.cc20
-rw-r--r--storage/xtradb/page/page0zip.cc6
-rw-r--r--storage/xtradb/pars/pars0pars.cc2
-rw-r--r--storage/xtradb/que/que0que.cc28
-rw-r--r--storage/xtradb/rem/rem0rec.cc2
-rw-r--r--storage/xtradb/row/row0ftsort.cc2
-rw-r--r--storage/xtradb/row/row0log.cc23
-rw-r--r--storage/xtradb/row/row0merge.cc170
-rw-r--r--storage/xtradb/row/row0mysql.cc80
-rw-r--r--storage/xtradb/row/row0quiesce.cc3
-rw-r--r--storage/xtradb/srv/srv0mon.cc5
-rw-r--r--storage/xtradb/srv/srv0srv.cc6
-rw-r--r--storage/xtradb/srv/srv0start.cc42
-rw-r--r--storage/xtradb/sync/sync0rw.cc14
-rw-r--r--storage/xtradb/sync/sync0sync.cc104
-rw-r--r--storage/xtradb/trx/trx0roll.cc7
-rw-r--r--storage/xtradb/trx/trx0trx.cc5
-rw-r--r--storage/xtradb/ut/ut0ut.cc4
-rw-r--r--strings/CMakeLists.txt2
-rw-r--r--strings/ctype-uca.c22
-rw-r--r--strings/decimal.c4
-rwxr-xr-xsupport-files/build-tags4
-rw-r--r--support-files/mysql.server.sh3
-rw-r--r--support-files/mysql.spec.sh4
-rw-r--r--vio/vio.c7
-rw-r--r--vio/viosocket.c3
-rw-r--r--vio/viosslfactories.c104
-rw-r--r--win/packaging/COPYING.rtf122
-rw-r--r--win/packaging/CPackWixConfig.cmake241
-rw-r--r--win/packaging/ca/CustomAction.cpp84
-rw-r--r--win/packaging/custom_ui.wxs364
-rw-r--r--win/packaging/extra.wxs.in1826
-rw-r--r--win/packaging/heidisql.cmake46
-rw-r--r--win/packaging/heidisql.wxi.in128
-rw-r--r--win/packaging/heidisql_feature.wxi.in20
-rw-r--r--win/packaging/mysql_server.wxs.in178
-rw-r--r--win/upgrade_wizard/stdafx.h94
-rw-r--r--win/upgrade_wizard/targetver.h16
-rw-r--r--win/upgrade_wizard/upgrade.cpp114
-rw-r--r--win/upgrade_wizard/upgrade.h62
-rw-r--r--win/upgrade_wizard/upgrade.rc296
-rw-r--r--win/upgrade_wizard/upgradeDlg.h146
-rw-r--r--win/upgrade_wizard/upgrade_wizard.exe.manifest28
1905 files changed, 118749 insertions, 39954 deletions
diff --git a/.bzrignore b/.bzrignore
deleted file mode 100644
index 5a17d96936f..00000000000
--- a/.bzrignore
+++ /dev/null
@@ -1,1206 +0,0 @@
-*-t
-*.a
-*.bb
-*.bbg
-*.bin
-*.cdf
-*.core
-*.d
-*.da
-*.dgcov
-*.dir/
-*.dll
-*.dsp
-*.dylib
-*.exe
-*.exp
-*.gcda
-*.gcno
-*.gcov
-*.idb
-*.ilk
-*.la
-*.lai
-*.lib
-*.lo
-*.manifest
-*.map
-*.o
-*.obj
-*.old
-*.pch
-*.pdb
-*.Plo
-*.Po
-*.reject
-*.res
-*.rule
-*.sbr
-*.so
-*.so.*
-*.spec
-*.Tpo
-*.user
-*.vcproj
-*.vcproj.cmake
-*.vcxproj
-*.vcxproj.filters
-Debug
-MySql.sdf
-Win32
-RelWithDebInfo
-*~
-.*.swp
-./CMakeCache.txt
-./config.h
-./fix-project-files
-./mysql*.ds?
-./MySql.ncb
-./MySql.sln
-./MySql.suo
-./prepare
-./README.build-files
-.defs.mk
-.depend
-.depend.mk
-.DS_Store
-.gdb_history
-.gdbinit
-.o
-.out
-.snprj/*
-.vimrc
-ac_available_languages_fragment
-BitKeeper/
-client/*.ds?
-client/completion_hash.cpp
-client/decimal.c
-client/dtoa.c
-client/echo
-client/insert_test
-client/link_sources
-client/log_event.cc
-client/log_event.h
-client/log_event_old.cc
-client/log_event_old.h
-client/mf_iocache.c
-client/mf_iocache.cc
-client/my_decimal.cc
-client/my_decimal.h
-client/my_user.c
-client/mysql
-client/mysql.cpp
-client/mysql_upgrade
-client/mysqladmin
-client/mysqladmin.c
-client/mysqladmin.cpp
-client/mysqlbinlog
-client/mysqlbinlog.cpp
-client/mysqlcheck
-client/mysqldump
-client/mysqlimport
-client/mysqlmanager-pwgen
-client/mysqlmanagerc
-client/mysqlshow
-client/mysqlslap
-client/mysqltest
-client/mysqltestmanager-pwgen
-client/mysqltestmanagerc
-client/mysys_priv.h
-client/readline.cpp
-client/rpl_constants.h
-client/rpl_filter.cc
-client/rpl_filter.h
-client/rpl_record_old.cc
-client/rpl_record_old.h
-client/rpl_tblmap.cc
-client/rpl_tblmap.h
-client/rpl_utility.cc
-client/rpl_utility.h
-client/rpl_utility.cc
-client/select_test
-client/sql_const.h
-client/sql_list.cc
-client/sql_list.h
-client/sql_string.cpp
-client/ssl_test
-client/thimble
-client/thread_test
-client/tmp.diff
-client/transaction.h
-client/async_example
-client_debug/*
-client_release/*
-client_test
-cmake_install.cmake
-CMakeFiles/
-cmd-line-utils/libedit/common.h
-cmd-line-utils/libedit/makelist
-comments
-comon.h
-comp_err/*.ds?
-compile
-config.h
-contrib/*.ds?
-COPYING
-COPYING.LIB
-core
-core.*
-cscope.in.out
-cscope.out
-cscope.po.out
-CTestTestfile.cmake
-dbug/*.ds?
-dbug/dbug_analyze
-dbug/example*.r
-dbug/factorial
-dbug/factorial.r
-dbug/main.r
-dbug/output*.r
-dbug/tests
-dbug/user.ps
-dbug/user.t
-debian/control
-debian/defs.mk
-debian/dist/Debian/mariadb-server-10.0.files
-debian/dist/Ubuntu/mariadb-server-10.0.files
-debug/
-depcomp
-Docs/INSTALL-BINARY
-examples/*.ds?
-examples/udf_example/udf_example.def
-EXCEPTIONS-CLIENT
-extra/charset2html
-extra/comp_err
-extra/created_include_files
-extra/innochecksum
-extra/libevent/event-config.h
-extra/my_print_defaults
-extra/mysql_install
-extra/mysql_tzinfo_to_sql
-extra/mysql_waitpid
-extra/mysqld_ername.h
-extra/mysqld_error.h
-extra/perror
-extra/replace
-extra/resolve_stack_dump
-extra/resolveip
-extra/sql_state.h
-extra/tztime.cc
-extra/yassl/taocrypt/benchmark/benchmark
-extra/yassl/taocrypt/test/test
-extra/yassl/testsuite/testsuite
-fcns.c
-fcns.h
-gdbinit
-gmon.out
-hardcopy.0
-heap/*.ds?
-heap/hp_test1
-heap/hp_test2
-help
-help.c
-help.h
-include/abi_check
-include/check_abi
-include/link_sources
-include/my_config.h
-include/my_global.h
-include/mysql_h.ic
-include/mysql_version.h
-include/mysqld_ername.h
-include/mysqld_error.h
-include/mysqld_error.h.rule
-include/openssl
-include/probes_mysql_dtrace.h
-include/readline
-include/readline/*.h
-include/readline/readline.h
-include/sql_state.h
-include/widec.h
-insert_test
-install
-install-sh
-INSTALL-SOURCE
-INSTALL-WIN-SOURCE
-item_xmlfunc.cc
-lib_debug/*
-lib_release/*
-libmysql/*.c
-libmysql/*.ds?
-libmysql/conf_to_src
-libmysql/debug/libmysql.exp
-libmysql/libmysql.ver
-libmysql/libmysql_exports_file.cc
-libmysql/link_sources
-libmysql/merge_archives_mysqlclient.cmake
-libmysql/my_static.h
-libmysql/my_time.c
-libmysql/mysys_priv.h
-libmysql/net.c
-libmysql/release/libmysql.exp
-libmysql/vio_priv.h
-libmysql/viosocket.o.6WmSJk
-libmysql_r/*.c
-libmysql_r/client_settings.h
-libmysql_r/conf_to_src
-libmysql_r/link_sources
-libmysql_r/my_static.h
-libmysql_r/mysys_priv.h
-libmysql_r/vio_priv.h
-libmysqld/*.ds?
-libmysqld/backup_dir
-libmysqld/client.c
-libmysqld/client_plugin.c
-libmysqld/client_settings.h
-libmysqld/cmake_dummy.c
-libmysqld/convert.cc
-libmysqld/create_options.cc
-libmysqld/datadict.cc
-libmysqld/debug_sync.cc
-libmysqld/derror.cc
-libmysqld/des_key_file.cc
-libmysqld/discover.cc
-libmysqld/discover_xt.cc
-libmysqld/emb_qcache.cpp
-libmysqld/errmsg.c
-libmysqld/event.cc
-libmysqld/event_data_objects.cc
-libmysqld/event_db_repository.cc
-libmysqld/event_executor.cc
-libmysqld/event_parse_data.cc
-libmysqld/event_queue.cc
-libmysqld/event_scheduler.cc
-libmysqld/event_timed.cc
-libmysqld/events.cc
-libmysqld/examples/client_test.c
-libmysqld/examples/client_test.cc
-libmysqld/examples/completion_hash.cc
-libmysqld/examples/completion_hash.h
-libmysqld/examples/link_sources
-libmysqld/examples/my_readline.h
-libmysqld/examples/mysql
-libmysqld/examples/mysql.cc
-libmysqld/examples/mysql_client_test.c
-libmysqld/examples/mysql_client_test_embedded
-libmysqld/examples/mysql_embedded
-libmysqld/examples/mysqltest
-libmysqld/examples/mysqltest.c
-libmysqld/examples/mysqltest.cc
-libmysqld/examples/mysqltest_embedded
-libmysqld/examples/readline.cc
-libmysqld/examples/sql_string.cc
-libmysqld/examples/sql_string.h
-libmysqld/examples/test-gdbinit
-libmysqld/field.cc
-libmysqld/field_conv.cc
-libmysqld/filesort.cc
-libmysqld/get_password.c
-libmysqld/gstream.cc
-libmysqld/ha_archive.cc
-libmysqld/ha_berkeley.cc
-libmysqld/ha_blackhole.cc
-libmysqld/ha_example.cc
-libmysqld/ha_federated.cc
-libmysqld/ha_federatedx.cc
-libmysqld/ha_heap.cc
-libmysqld/ha_innobase.cc
-libmysqld/ha_innodb.cc
-libmysqld/ha_maria.cc
-libmysqld/ha_myisam.cc
-libmysqld/ha_myisammrg.cc
-libmysqld/ha_ndbcluster.cc
-libmysqld/ha_ndbcluster_binlog.cc
-libmysqld/ha_ndbcluster_cond.cc
-libmysqld/ha_partition.cc
-libmysqld/ha_tina.cc
-libmysqld/handler.cc
-libmysqld/handlerton.cc
-libmysqld/hash_filo.cc
-libmysqld/hostname.cc
-libmysqld/init.cc
-libmysqld/item.cc
-libmysqld/item_buff.cc
-libmysqld/item_cmpfunc.cc
-libmysqld/item_create.cc
-libmysqld/item_func.cc
-libmysqld/item_geofunc.cc
-libmysqld/item_row.cc
-libmysqld/item_strfunc.cc
-libmysqld/item_subselect.cc
-libmysqld/item_sum.cc
-libmysqld/item_timefunc.cc
-libmysqld/item_uniq.cc
-libmysqld/key.cc
-libmysqld/keycaches.cc
-libmysqld/lex_hash.h
-libmysqld/lib_sql.cpp
-libmysqld/libmysql.c
-libmysqld/link_sources
-libmysqld/lock.cc
-libmysqld/log.cc
-libmysqld/log_event.cc
-libmysqld/log_event_old.cc
-libmysqld/md5.c
-libmysqld/mdl.cc
-libmysqld/merge_archives_mysqlserver.cmake
-libmysqld/message.h
-libmysqld/message.rc
-libmysqld/mf_iocache.cc
-libmysqld/mini_client.cc
-libmysqld/multi_range_read.cc
-libmysqld/my_decimal.cc
-libmysqld/my_time.c
-libmysqld/my_user.c
-libmysqld/mysqlserver_depends.c
-libmysqld/myxt_xt.cc
-libmysqld/net_pkg.cc
-libmysqld/net_serv.cc
-libmysqld/opt_ft.cc
-libmysqld/opt_index_cond_pushdown.cc
-libmysqld/opt_range.cc
-libmysqld/opt_subselect.cc
-libmysqld/opt_sum.cc
-libmysqld/opt_table_elimination.cc
-libmysqld/pack.c
-libmysqld/parse_file.cc
-libmysqld/partition_info.cc
-libmysqld/password.c
-libmysqld/procedure.cc
-libmysqld/protocol.cc
-libmysqld/protocol_cursor.cc
-libmysqld/records.cc
-libmysqld/repl_failsafe.cc
-libmysqld/rpl_filter.cc
-libmysqld/rpl_handler.cc
-libmysqld/rpl_injector.cc
-libmysqld/rpl_record.cc
-libmysqld/rpl_record_old.cc
-libmysqld/rpl_utility.cc
-libmysqld/scheduler.cc
-libmysqld/set_var.cc
-libmysqld/sha2.cc
-libmysqld/simple-test
-libmysqld/slave.cc
-libmysqld/sp.cc
-libmysqld/sp_cache.cc
-libmysqld/sp_head.cc
-libmysqld/sp_pcontext.cc
-libmysqld/sp_rcontext.cc
-libmysqld/spatial.cc
-libmysqld/sql_acl.cc
-libmysqld/sql_admin.cc
-libmysqld/sql_alter.cc
-libmysqld/sql_analyse.cc
-libmysqld/sql_audit.cc
-libmysqld/sql_base.cc
-libmysqld/sql_builtin.cc
-libmysqld/sql_cache.cc
-libmysqld/sql_class.cc
-libmysqld/sql_command
-libmysqld/sql_connect.cc
-libmysqld/sql_crypt.cc
-libmysqld/sql_cursor.cc
-libmysqld/sql_cursor.h
-libmysqld/sql_db.cc
-libmysqld/sql_delete.cc
-libmysqld/sql_derived.cc
-libmysqld/sql_do.cc
-libmysqld/sql_error.cc
-libmysqld/sql_expression_cache.cc
-libmysqld/sql_handler.cc
-libmysqld/sql_help.cc
-libmysqld/sql_insert.cc
-libmysqld/sql_join_cache.cc
-libmysqld/sql_lex.cc
-libmysqld/sql_list.cc
-libmysqld/sql_load.cc
-libmysqld/sql_locale.cc
-libmysqld/sql_manager.cc
-libmysqld/sql_map.cc
-libmysqld/sql_olap.cc
-libmysqld/sql_parse.cc
-libmysqld/sql_partition.cc
-libmysqld/sql_partition_admin.cc
-libmysqld/sql_plugin.cc
-libmysqld/sql_prepare.cc
-libmysqld/sql_profile.cc
-libmysqld/sql_reload.cc
-libmysqld/sql_rename.cc
-libmysqld/sql_repl.cc
-libmysqld/sql_select.cc
-libmysqld/sql_servers.cc
-libmysqld/sql_show.cc
-libmysqld/sql_signal.cc
-libmysqld/sql_state.c
-libmysqld/sql_string.cc
-libmysqld/sql_table.cc
-libmysqld/sql_tablespace.cc
-libmysqld/sql_test.cc
-libmysqld/sql_time.cc
-libmysqld/sql_trigger.cc
-libmysqld/sql_truncate.cc
-libmysqld/sql_udf.cc
-libmysqld/sql_union.cc
-libmysqld/sql_unions.cc
-libmysqld/sql_update.cc
-libmysqld/sql_view.cc
-libmysqld/sql_yacc.cc
-libmysqld/sql_yacc.cpp
-libmysqld/sql_yacc.h
-libmysqld/stacktrace.c
-libmysqld/strfunc.cc
-libmysqld/sys_vars.cc
-libmysqld/table.cc
-libmysqld/thr_malloc.cc
-libmysqld/transaction.cc
-libmysqld/tztime.cc
-libmysqld/uniques.cc
-libmysqld/unireg.cc
-libmysqld/discover_xt.cc
-libmysqld/myxt_xt.cc
-libmysqld/rpl_reporting.cc
-libmysqld/rpl_utility.cc
-libmysqltest/*.ds?
-libmysqltest/mytest.c
-libtool
-linked_client_sources
-linked_include_sources
-linked_libmysql_r_sources
-linked_libmysql_sources
-linked_libmysqld_sources
-linked_libmysqldex_sources
-linked_server_sources
-linked_tools_sources
-locked
-ltmain.sh
-ma_test_recovery.output
-make_dist.cmake
-Makefile
-Makefile.in
-MinSizeRel/
-MIRRORS
-missing
-mkinstalldirs
-my_print_defaults/*.ds?
-myisam_ftdump/*.ds?
-myisamchk/*.ds?
-myisamlog/*.ds?
-myisammrg/*.ds?
-myisampack/*.ds?
-mysql-test/*.ds?
-mysql-test/install_test_db
-mysql-test/lib/init_db.sql
-mysql-test/lib/My/SafeProcess/my_safe_process
-mysql-test/mtr
-mysql-test/mysql-test-run
-mysql-test/r/*.err
-mysql-test/r/*.log
-mysql-test/r/*.out
-mysql-test/r/*.reject
-mysql-test/var
-mysql.kdevprj
-mysql.proj
-mysqlbinlog/*.ds?
-mysqlcheck/*.ds?
-mysqld.S
-mysqld.sym
-mysqldemb/*.ds?
-mysqlserver/*.ds?
-mysys/*.ds?
-mysys/charset2html
-mysys/getopt.c
-mysys/getopt1.c
-mysys/main.cc
-mysys/my_new.cpp
-mysys/raid.cpp
-mysys/ste5KbMa
-mysys/test_atomic
-mysys/test_bitmap
-mysys/test_charset
-mysys/test_dir
-mysys/test_gethwaddr
-mysys/test_io_cache
-mysys/test_thr_alarm
-mysys/test_thr_lock
-mysys/test_vsnprintf
-mysys/testhash
-mysys/thr_lock
-perror/*.ds?
-regex/*.ds?
-regex/re
-Release/
-RelWithDebInfo/
-replace/*.ds?
-scripts/comp_sql
-scripts/convert-debug-for-diff
-scripts/fill_func_tables
-scripts/fill_func_tables.sql
-scripts/fill_help_tables
-scripts/fill_help_tables.sql
-scripts/make_binary_distribution
-scripts/make_sharedlib_distribution
-scripts/make_win_binary_distribution
-scripts/make_win_src_distribution
-scripts/make_win_src_distribution_old
-scripts/msql2mysql
-scripts/mysql_config
-scripts/mysql_convert_table_format
-scripts/mysql_create_system_tables
-scripts/mysql_explain_log
-scripts/mysql_find_rows
-scripts/mysql_fix_extensions
-scripts/mysql_fix_privilege_tables
-scripts/mysql_fix_privilege_tables.sql
-scripts/mysql_fix_privilege_tables.sql.rule
-scripts/mysql_fix_privilege_tables_sql.c
-scripts/mysql_fix_privilege_tables_sql.c.rule
-scripts/mysql_install_db
-scripts/mysql_secure_installation
-scripts/mysql_setpermission
-scripts/mysql_tableinfo
-scripts/mysql_upgrade
-scripts/mysql_upgrade_shell
-scripts/mysql_zap
-scripts/mysqlaccess
-scripts/mysqlbug
-scripts/mysqld_multi
-scripts/mysqld_safe
-scripts/mysqldumpslow
-scripts/mysqlhotcopy
-scripts/mysqlhotcopy.sh.rej
-scripts/safe_mysqld
-select_test
-sql-bench/bench-count-distinct
-sql-bench/bench-init.pl
-sql-bench/compare-results
-sql-bench/compare-results-all
-sql-bench/copy-db
-sql-bench/crash-me
-sql-bench/gif/*
-sql-bench/graph-compare-results
-sql-bench/innotest1
-sql-bench/innotest1a
-sql-bench/innotest1b
-sql-bench/innotest2
-sql-bench/innotest2a
-sql-bench/innotest2b
-sql-bench/output/*
-sql-bench/Results-linux/ATIS-mysql_bdb-Linux_2.2.14_my_SMP_i686
-sql-bench/run-all-tests
-sql-bench/server-cfg
-sql-bench/template.html
-sql-bench/test-alter-table
-sql-bench/test-ATIS
-sql-bench/test-big-tables
-sql-bench/test-connect
-sql-bench/test-create
-sql-bench/test-insert
-sql-bench/test-select
-sql-bench/test-transactions
-sql-bench/test-wisconsin
-sql/*.cpp
-sql/*.ds?
-sql/client.c
-sql/client_plugin.c
-sql/Doxyfile
-sql/gen_lex_hash
-sql/lex_hash.h
-sql/lex_hash.h.rule
-sql/link_sources
-sql/message.h
-sql/message.mc
-sql/message.rc
-sql/mini_client_errors.c
-sql/my_time.c
-sql/my_user.c
-sql/mysql_tzinfo_to_sql
-sql/mysql_tzinfo_to_sql.cc
-sql/mysql_tzinfo_to_sql_tztime.cc
-sql/mysqlbinlog
-sql/mysqld
-sql/mysqld-purecov
-sql/mysqld-purify
-sql/mysqld-quantify
-sql/new.cc
-sql/pack.c
-sql/share/*/*.sys
-sql/sql_builtin.cc
-sql/sql_yacc.cc
-sql/sql_yacc.h
-sql/sql_yacc.h.rule
-sql/sql_yacc.output
-sql_error.cc
-sql_prepare.cc
-sql_priv.h
-stamp-h
-storage/archive/archive_reader
-storage/archive/archive_test
-storage/heap/hp_test1
-storage/heap/hp_test2
-storage/maria/*.MAD
-storage/maria/*.MAI
-storage/maria/aria.log
-storage/maria/aria_chk
-storage/maria/aria_control
-storage/maria/aria_dump_log
-storage/maria/aria_ftdump
-storage/maria/aria_log
-storage/maria/aria_log.*
-storage/maria/aria_pack
-storage/maria/aria_read_log
-storage/maria/ma_rt_test
-storage/maria/ma_sp_test
-storage/maria/ma_test1
-storage/maria/ma_test2
-storage/maria/ma_test3
-storage/maria/ma_test_all
-storage/maria/tmp
-storage/maria/unittest/ma_pagecache_consist_1k-t-big
-storage/maria/unittest/ma_pagecache_consist_1kHC-t-big
-storage/maria/unittest/ma_pagecache_consist_1kRD-t-big
-storage/maria/unittest/ma_pagecache_consist_1kWR-t-big
-storage/maria/unittest/ma_pagecache_consist_64k-t-big
-storage/maria/unittest/ma_pagecache_consist_64kHC-t-big
-storage/maria/unittest/ma_pagecache_consist_64kRD-t-big
-storage/maria/unittest/ma_pagecache_consist_64kWR-t-big
-storage/maria/unittest/ma_pagecache_single_64k-t-big
-storage/maria/unittest/ma_test_loghandler_long-t-big
-storage/maria/unittest/maria_control
-storage/maria/unittest/mf_pagecache_consist_1k-t-big
-storage/maria/unittest/mf_pagecache_consist_1kHC-t-big
-storage/maria/unittest/mf_pagecache_consist_1kRD-t-big
-storage/maria/unittest/mf_pagecache_consist_1kWR-t-big
-storage/maria/unittest/mf_pagecache_consist_64k-t-big
-storage/maria/unittest/mf_pagecache_consist_64kHC-t-big
-storage/maria/unittest/mf_pagecache_consist_64kRD-t-big
-storage/maria/unittest/mf_pagecache_consist_64kWR-t-big
-storage/maria/unittest/mf_pagecache_single_64k-t-big
-storage/maria/unittest/page_cache_test_file_1
-storage/maria/unittest/pagecache_debug.log
-storage/maria/unittest/tmp
-storage/myisam/FT1.MYD
-storage/myisam/FT1.MYI
-storage/myisam/ft_dump
-storage/myisam/ft_eval
-storage/myisam/ft_test1
-storage/myisam/ftbench/data
-storage/myisam/ftbench/t
-storage/myisam/ftbench/var/*
-storage/myisam/mi_test1
-storage/myisam/mi_test2
-storage/myisam/mi_test3
-storage/myisam/mi_test_all
-storage/myisam/myisam.log
-storage/myisam/myisam_ftdump
-storage/myisam/myisamchk
-storage/myisam/myisamlog
-storage/myisam/myisampack
-storage/myisam/rt_test
-storage/myisam/rt_test.MYD
-storage/myisam/rt_test.MYI
-storage/myisam/sp_test
-storage/myisam/test1.MYD
-storage/myisam/test1.MYI
-storage/myisam/test2.MYD
-storage/myisam/test2.MYI
-storage/ndb/bin/acid
-storage/ndb/bin/async-lmc-bench-l-p10.sh
-storage/ndb/bin/async-lmc-bench-l.sh
-storage/ndb/bin/async-lmc-bench-p10.sh
-storage/ndb/bin/async-lmc-bench.sh
-storage/ndb/bin/atrt
-storage/ndb/bin/atrt-analyze-result.sh
-storage/ndb/bin/atrt-clear-result.sh
-storage/ndb/bin/atrt-gather-result.sh
-storage/ndb/bin/atrt-setup.sh
-storage/ndb/bin/bankCreator
-storage/ndb/bin/bankMakeGL
-storage/ndb/bin/bankSumAccounts
-storage/ndb/bin/bankTimer
-storage/ndb/bin/bankTransactionMaker
-storage/ndb/bin/bankValidateAllGLs
-storage/ndb/bin/basicTransporterTest
-storage/ndb/bin/benchronja
-storage/ndb/bin/bulk_copy
-storage/ndb/bin/copy_tab
-storage/ndb/bin/create_all_tabs
-storage/ndb/bin/create_index
-storage/ndb/bin/create_tab
-storage/ndb/bin/DbAsyncGenerator
-storage/ndb/bin/DbCreate
-storage/ndb/bin/delete_all
-storage/ndb/bin/desc
-storage/ndb/bin/drop_all_tabs
-storage/ndb/bin/drop_index
-storage/ndb/bin/drop_tab
-storage/ndb/bin/flexAsynch
-storage/ndb/bin/flexBench
-storage/ndb/bin/flexHammer
-storage/ndb/bin/flexScan
-storage/ndb/bin/flexTT
-storage/ndb/bin/hugoCalculator
-storage/ndb/bin/hugoFill
-storage/ndb/bin/hugoLoad
-storage/ndb/bin/hugoLockRecords
-storage/ndb/bin/hugoPkDelete
-storage/ndb/bin/hugoPkRead
-storage/ndb/bin/hugoPkReadRecord
-storage/ndb/bin/hugoPkUpdate
-storage/ndb/bin/hugoScanRead
-storage/ndb/bin/hugoScanUpdate
-storage/ndb/bin/index
-storage/ndb/bin/index2
-storage/ndb/bin/initronja
-storage/ndb/bin/interpreterInTup
-storage/ndb/bin/list_tables
-storage/ndb/bin/make-config.sh
-storage/ndb/bin/mgmtclient
-storage/ndb/bin/mgmtsrvr
-storage/ndb/bin/mkconfig
-storage/ndb/bin/ndb
-storage/ndb/bin/ndb_cpcc
-storage/ndb/bin/ndb_cpcd
-storage/ndb/bin/ndb_rep
-storage/ndb/bin/ndbsql
-storage/ndb/bin/newton_basic
-storage/ndb/bin/newton_br
-storage/ndb/bin/newton_pb
-storage/ndb/bin/newton_perf
-storage/ndb/bin/perfTransporterTest
-storage/ndb/bin/printConfig
-storage/ndb/bin/printSchemafile
-storage/ndb/bin/printSysfile
-storage/ndb/bin/redoLogFileReader
-storage/ndb/bin/restart
-storage/ndb/bin/restarter
-storage/ndb/bin/restarter2
-storage/ndb/bin/restarts
-storage/ndb/bin/restore
-storage/ndb/bin/select_all
-storage/ndb/bin/select_count
-storage/ndb/bin/telco
-storage/ndb/bin/test_cpcd
-storage/ndb/bin/test_event
-storage/ndb/bin/testBackup
-storage/ndb/bin/testBank
-storage/ndb/bin/testBasic
-storage/ndb/bin/testBasicAsynch
-storage/ndb/bin/testCopy
-storage/ndb/bin/testDataBuffers
-storage/ndb/bin/testDict
-storage/ndb/bin/testGrep
-storage/ndb/bin/testGrepVerify
-storage/ndb/bin/testIndex
-storage/ndb/bin/testInterpreter
-storage/ndb/bin/testKernelDataBuffer
-storage/ndb/bin/testLongSig
-storage/ndb/bin/testMgm
-storage/ndb/bin/testMgmapi
-storage/ndb/bin/testNdbApi
-storage/ndb/bin/testNodeRestart
-storage/ndb/bin/testOdbcDriver
-storage/ndb/bin/testOIBasic
-storage/ndb/bin/testOperations
-storage/ndb/bin/testRestartGci
-storage/ndb/bin/testScan
-storage/ndb/bin/testScanInterpreter
-storage/ndb/bin/testSimplePropertiesSection
-storage/ndb/bin/testSystemRestart
-storage/ndb/bin/testTimeout
-storage/ndb/bin/testTransactions
-storage/ndb/bin/verify_index
-storage/ndb/bin/waiter
-storage/ndb/config/config.mk
-storage/ndb/examples/ndbapi_example1/ndbapi_example1
-storage/ndb/examples/ndbapi_example2/ndbapi_example2
-storage/ndb/examples/ndbapi_example3/ndbapi_example3
-storage/ndb/examples/ndbapi_example5/ndbapi_example5
-storage/ndb/examples/select_all/select_all
-storage/ndb/include/ndb_global.h
-storage/ndb/include/ndb_types.h
-storage/ndb/include/ndb_version.h
-storage/ndb/lib/libMGM_API.so
-storage/ndb/lib/libNDB_API.so
-storage/ndb/lib/libNDB_ODBC.so
-storage/ndb/lib/libndbclient.so
-storage/ndb/lib/libndbclient_extra.so
-storage/ndb/lib/libNEWTON_API.so
-storage/ndb/lib/libNEWTON_BASICTEST_COMMON.so
-storage/ndb/lib/libREP_API.so
-storage/ndb/ndbapi-examples/mgmapi_logevent/mgmapi_logevent
-storage/ndb/ndbapi-examples/mgmapi_logevent2/mgmapi_logevent2
-storage/ndb/ndbapi-examples/ndbapi_async/ndbapi_async
-storage/ndb/ndbapi-examples/ndbapi_async1/ndbapi_async1
-storage/ndb/ndbapi-examples/ndbapi_event/ndbapi_event
-storage/ndb/ndbapi-examples/ndbapi_retries/ndbapi_retries
-storage/ndb/ndbapi-examples/ndbapi_scan/ndbapi_scan
-storage/ndb/ndbapi-examples/ndbapi_simple/ndbapi_simple
-storage/ndb/ndbapi-examples/ndbapi_simple_dual/ndbapi_simple_dual
-storage/ndb/ndbapi-examples/ndbapi_simple_index/ndbapi_simple_index
-storage/ndb/src/common/mgmcommon/printConfig/*.d
-storage/ndb/src/common/util/testBitmask.cpp
-storage/ndb/src/cw/cpcd/ndb_cpcd
-storage/ndb/src/dummy.cpp
-storage/ndb/src/kernel/blocks/backup/ndb_print_backup_file
-storage/ndb/src/kernel/blocks/backup/restore/ndb_restore
-storage/ndb/src/kernel/blocks/dbdict/ndb_print_schema_file
-storage/ndb/src/kernel/blocks/dbdih/ndb_print_sys_file
-storage/ndb/src/kernel/blocks/dbtup/test_varpage
-storage/ndb/src/kernel/blocks/ndb_print_file
-storage/ndb/src/kernel/ndbd
-storage/ndb/src/libndb.ver
-storage/ndb/src/mgmclient/ndb_mgm
-storage/ndb/src/mgmclient/test_cpcd/*.d
-storage/ndb/src/mgmsrv/ndb_mgmd
-storage/ndb/src/ndbapi/ndberror_check
-storage/ndb/test/ndbapi/bank/bankCreator
-storage/ndb/test/ndbapi/bank/bankMakeGL
-storage/ndb/test/ndbapi/bank/bankSumAccounts
-storage/ndb/test/ndbapi/bank/bankTimer
-storage/ndb/test/ndbapi/bank/bankTransactionMaker
-storage/ndb/test/ndbapi/bank/bankValidateAllGLs
-storage/ndb/test/ndbapi/bank/testBank
-storage/ndb/test/ndbapi/create_all_tabs
-storage/ndb/test/ndbapi/create_tab
-storage/ndb/test/ndbapi/DbAsyncGenerator
-storage/ndb/test/ndbapi/DbCreate
-storage/ndb/test/ndbapi/drop_all_tabs
-storage/ndb/test/ndbapi/flexAsynch
-storage/ndb/test/ndbapi/flexBench
-storage/ndb/test/ndbapi/flexHammer
-storage/ndb/test/ndbapi/flexTT
-storage/ndb/test/ndbapi/ndbapi_slow_select
-storage/ndb/test/ndbapi/test_event
-storage/ndb/test/ndbapi/test_event_merge
-storage/ndb/test/ndbapi/testBackup
-storage/ndb/test/ndbapi/testBasic
-storage/ndb/test/ndbapi/testBasicAsynch
-storage/ndb/test/ndbapi/testBitfield
-storage/ndb/test/ndbapi/testBlobs
-storage/ndb/test/ndbapi/testDataBuffers
-storage/ndb/test/ndbapi/testDeadlock
-storage/ndb/test/ndbapi/testDict
-storage/ndb/test/ndbapi/testIndex
-storage/ndb/test/ndbapi/testIndexStat
-storage/ndb/test/ndbapi/testInterpreter
-storage/ndb/test/ndbapi/testLcp
-storage/ndb/test/ndbapi/testMgm
-storage/ndb/test/ndbapi/testNdbApi
-storage/ndb/test/ndbapi/testNodeRestart
-storage/ndb/test/ndbapi/testOIBasic
-storage/ndb/test/ndbapi/testOperations
-storage/ndb/test/ndbapi/testPartitioning
-storage/ndb/test/ndbapi/testReadPerf
-storage/ndb/test/ndbapi/testRestartGci
-storage/ndb/test/ndbapi/testScan
-storage/ndb/test/ndbapi/testScanInterpreter
-storage/ndb/test/ndbapi/testScanPerf
-storage/ndb/test/ndbapi/testSRBank
-storage/ndb/test/ndbapi/testSystemRestart
-storage/ndb/test/ndbapi/testTimeout
-storage/ndb/test/ndbapi/testTransactions
-storage/ndb/test/run-test/atrt
-storage/ndb/test/tools/copy_tab
-storage/ndb/test/tools/create_index
-storage/ndb/test/tools/hugoCalculator
-storage/ndb/test/tools/hugoFill
-storage/ndb/test/tools/hugoLoad
-storage/ndb/test/tools/hugoLockRecords
-storage/ndb/test/tools/hugoPkDelete
-storage/ndb/test/tools/hugoPkRead
-storage/ndb/test/tools/hugoPkReadRecord
-storage/ndb/test/tools/hugoPkUpdate
-storage/ndb/test/tools/hugoScanRead
-storage/ndb/test/tools/hugoScanUpdate
-storage/ndb/test/tools/listen_event
-storage/ndb/test/tools/ndb_cpcc
-storage/ndb/test/tools/rep_latency
-storage/ndb/test/tools/restart
-storage/ndb/test/tools/verify_index
-storage/ndb/tools/ndb_config
-storage/ndb/tools/ndb_delete_all
-storage/ndb/tools/ndb_desc
-storage/ndb/tools/ndb_drop_index
-storage/ndb/tools/ndb_drop_table
-storage/ndb/tools/ndb_restore
-storage/ndb/tools/ndb_select_all
-storage/ndb/tools/ndb_select_count
-storage/ndb/tools/ndb_show_tables
-storage/ndb/tools/ndb_test_platform
-storage/ndb/tools/ndb_waiter
-storage/xtradb/configure.lineno
-storage/xtradb/conftest.s1
-storage/xtradb/conftest.subs
-storage/xtradb/ib_config.h
-storage/xtradb/ib_config.h.in
-storage/xtradb/mkinstalldirs
-storage/xtradb/stamp-h1
-strings/*.ds?
-strings/conf_to_src
-strings/ctype_autoconf.c
-strings/ctype_extra_sources.c
-strings/str_test
-strings/test_decimal
-support-files/*.ini
-support-files/binary-configure
-support-files/MacOSX/Description.plist
-support-files/MacOSX/Info.plist
-support-files/MacOSX/postflight
-support-files/MacOSX/postinstall
-support-files/MacOSX/preflight
-support-files/MacOSX/preinstall
-support-files/MacOSX/ReadMe.txt
-support-files/MacOSX/StartupParameters.plist
-support-files/my-huge.cnf
-support-files/my-innodb-heavy-4G.cnf
-support-files/my-large.cnf
-support-files/my-medium.cnf
-support-files/my-small.cnf
-support-files/mysql-3.23.25-beta.spec
-support-files/mysql-3.23.26-beta.spec
-support-files/mysql-3.23.27-beta.spec
-support-files/mysql-3.23.28-gamma.spec
-support-files/mysql-3.23.29-gamma.spec
-support-files/mysql-log-rotate
-support-files/mysql.server
-support-files/mysql.spec
-support-files/mysqld_multi.server
-support-files/ndb-config-2-node.ini
-TAGS
-test/ndbapi/bank/bankCreator
-test/ndbapi/bank/bankMakeGL
-test/ndbapi/bank/bankSumAccounts
-test/ndbapi/bank/bankTimer
-test/ndbapi/bank/bankTransactionMaker
-test/ndbapi/bank/bankValidateAllGLs
-test/ndbapi/bank/testBank
-test/ndbapi/create_all_tabs
-test/ndbapi/create_tab
-test/ndbapi/drop_all_tabs
-test/ndbapi/flexAsynch
-test/ndbapi/flexBench
-test/ndbapi/flexHammer
-test/ndbapi/flexTT
-test/ndbapi/test_event
-test/ndbapi/testBackup
-test/ndbapi/testBasic
-test/ndbapi/testBasicAsynch
-test/ndbapi/testBlobs
-test/ndbapi/testDataBuffers
-test/ndbapi/testDeadlock
-test/ndbapi/testDict
-test/ndbapi/testIndex
-test/ndbapi/testMgm
-test/ndbapi/testNdbApi
-test/ndbapi/testNodeRestart
-test/ndbapi/testOIBasic
-test/ndbapi/testOperations
-test/ndbapi/testRestartGci
-test/ndbapi/testScan
-test/ndbapi/testScanInterpreter
-test/ndbapi/testScanPerf
-test/ndbapi/testSystemRestart
-test/ndbapi/testTimeout
-test/ndbapi/testTransactions
-test/run-test/atrt
-test/tools/copy_tab
-test/tools/create_index
-test/tools/hugoCalculator
-test/tools/hugoFill
-test/tools/hugoLoad
-test/tools/hugoLockRecords
-test/tools/hugoPkDelete
-test/tools/hugoPkRead
-test/tools/hugoPkReadRecord
-test/tools/hugoPkUpdate
-test/tools/hugoScanRead
-test/tools/hugoScanUpdate
-test/tools/ndb_cpcc
-test/tools/restart
-test/tools/verify_index
-test1/*
-test?.MA?
-test_xml
-tests/*.ds?
-tests/bug25714
-tests/client_test
-tests/connect_test
-tests/mysql_client_test
-tests/async_queries
-thr_insert_test/*
-thr_test/*
-thread_test
-tmp
-tmp/*
-tools/my_vsnprintf.c
-tools/mysqlmanager
-tools/mysqlmngd
-tools/mysqltestmanager
-tools/mysys_priv.h
-unittest/examples/*.t
-unittest/maria_control
-unittest/mysys/*.t
-unittest/mysys/mf_pagecache_consist_1k-t-big
-unittest/mysys/mf_pagecache_consist_1kHC-t-big
-unittest/mysys/mf_pagecache_consist_1kRD-t-big
-unittest/mysys/mf_pagecache_consist_1kWR-t-big
-unittest/mysys/mf_pagecache_consist_64k-t-big
-unittest/mysys/mf_pagecache_consist_64kHC-t-big
-unittest/mysys/mf_pagecache_consist_64kRD-t-big
-unittest/mysys/mf_pagecache_consist_64kWR-t-big
-unittest/mysys/mf_pagecache_single_64k-t-big
-unittest/mytap/t/*.t
-unittest/page_cache_test_file_1
-unittest/pagecache_debug.log
-unittest/tmp/*
-unittest/unit
-vi.h
-vio/*.ds?
-vio/test-ssl
-vio/test-sslclient
-vio/test-sslserver
-vio/viotest-ssl
-vio/viotest-sslconnect.cpp
-vio/viotest.cpp
-ylwrap
-zlib/*.ds?
-sql-bench/test-table-elimination
-sql/share/bulgarian
-sql/share/czech
-sql/share/danish
-sql/share/dutch
-sql/share/english
-sql/share/estonian
-sql/share/french
-sql/share/german
-sql/share/greek
-sql/share/hungarian
-sql/share/italian
-sql/share/japanese
-sql/share/japanese-sjis
-sql/share/korean
-sql/share/norwegian
-sql/share/norwegian-ny
-sql/share/polish
-sql/share/portuguese
-sql/share/romanian
-sql/share/russian
-sql/share/serbian
-sql/share/slovak
-sql/share/spanish
-sql/share/swedish
-sql/share/ukrainian
-CPackConfig.cmake
-CPackSourceConfig.cmake
-Docs/INFO_BIN
-Docs/INFO_SRC
-tags
-Testing
-info_macros.cmake
-VERSION.dep
-configure
-libmysqld/examples/mysqltest.cc
-extra/libevent/event-config.h
-libmysqld/opt_table_elimination.cc
-libmysqld/ha_federatedx.cc
-libmysqld/multi_range_read.cc
-libmysqld/opt_index_cond_pushdown.cc
-libmysqld/opt_subselect.cc
-libmysqld/sql_join_cache.cc
-client/rpl_filter.cc
-client/rpl_filter.h
-client/sql_list.cc
-client/sql_list.h
-libmysqld/create_options.cc
-libmysqld/sql_expression_cache.cc
-mysql-test/mtr_command
-scripts/convert-debug-for-diff
-client/strings_def.h
-libmysql/strings_def.h
-libmysql_r/strings_def.h
-storage/maria/aria_log_control
-scripts/mytop
-include/*.h.tmp
-cmd-line-utils/libedit/emacs.h
-mysql-test/collections/default.release
-support-files/plugins.files
-client/mysql_plugin
-*.resource.txt
-plugin/handler_socket/perl-Net-HandlerSocket/HandlerSocket.c
-plugin/handler_socket/perl-Net-HandlerSocket/blib
-plugin/handler_socket/perl-Net-HandlerSocket/pm_to_blib
-plugin/handler_socket/perl-Net-HandlerSocket/HandlerSocket.bs
-plugin/handler_socket/perl-Net-HandlerSocket/Makefile.PL
-libmysqld/libmysqld_exports_file.cc
-libmysqld/gcalc_slicescan.cc
-libmysqld/gcalc_tools.cc
-libmysqld/my_apc.cc
-sql/share/errmsg.sys
-sql/share/mysql
-install_manifest.txt
-sql/db.opt
-./_CPack_Packages
-./install_manifest_*.txt
-typescript
-storage/perfschema/gen_pfs_lex_token
-storage/perfschema/pfs_lex_token.h
-*.bak
-*.OLD
-mysql-test/collections/default.release.done
-sql/sql_yacc.hh
-packaging/solaris/postinstall-solaris
-extra/jemalloc/jemalloc-*
-extra/jemalloc/build
-*.tdb
-pcre/config.h
-pcre/CTestCustom.ctest
-pcre/pcre_grep_test.sh
-pcre/pcre_scanner_unittest
-pcre/pcre_stringpiece_unittest
-pcre/pcre_test.sh
-pcre/pcrecpp_unittest
-pcre/pcregrep
-pcre/pcretest
-pcre/pcre.h
-testNinput
-teststderr
-testtemp1
-testtemp2
-testtry
-storage/tokudb/ft-index/CTestCustom.cmake
-storage/tokudb/ft-index/xz
-storage/tokudb/ft-index/buildheader/db.h
-storage/tokudb/ft-index/buildheader/make_tdb
-storage/tokudb/ft-index/buildheader/runcat.sh
-storage/tokudb/ft-index/ft/log_code.cc
-storage/tokudb/ft-index/ft/log_header.h
-storage/tokudb/ft-index/ft/log_print.cc
-storage/tokudb/ft-index/ft/logformat
-storage/tokudb/ft-index/portability/merge_archives_tokuportability_static.cmake
-storage/tokudb/ft-index/portability/toku_config.h
-storage/tokudb/ft-index/portability/tokuportability_static_depends.cc
-storage/tokudb/ft-index/src/merge_archives_tokufractaltree_static.cmake
-storage/tokudb/ft-index/src/tokufractaltree_static_depends.cc
-storage/tokudb/ft-index/tools/ba_replay
-storage/tokudb/ft-index/tools/ftverify
-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
-pcre/test*grep
-import_executables.cmake
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 00000000000..b62a174c5e5
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,30 @@
+# Set the default behavior, in case people don't have core.autocrlf set.
+* text=auto
+
+# Explicitly declare text files you want to always be normalized and converted
+# to native line endings on checkout.
+*.c text
+*.ic text
+*.cc text
+*.cpp text
+*.h text
+*.test text
+
+# These files should be checked out as is
+*.result -text -whitespace
+*.dat -text -whitespace
+
+storage/connect/mysql-test/connect/std_data/*.txt -text
+
+# Denote all files that are truly binary and should not be modified.
+*.png binary
+*.jpg binary
+*.frm binary
+*.MYD binary
+*.MYI binary
+
+*.c diff=cpp
+*.h diff=cpp
+*.cc diff=cpp
+*.ic diff=cpp
+*.cpp diff=cpp
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000000..f32a60fcfde
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,453 @@
+*-t
+*.ctest
+*.reject
+*.spec
+*.bak
+.*.swp
+*.ninja
+.ninja_*
+.gdb_history
+errmsg.sys
+typescript
+CMakeCache.txt
+CMakeFiles/
+MakeFile
+install_manifest.txt
+CPackConfig.cmake
+CPackSourceConfig.cmake
+CTestTestfile.cmake
+Docs/INFO_BIN
+Docs/INFO_SRC
+Makefile
+TAGS
+Testing/
+VERSION.dep
+configure
+client/async_example
+client/mysql
+client/mysql_plugin
+client/mysql_upgrade
+client/mysqladmin
+client/mysqlbinlog
+client/mysqlcheck
+client/mysqldump
+client/mysqlimport
+client/mysqlshow
+client/mysqlslap
+client/mysqltest
+cmake_install.cmake
+dbug/*.r
+dbug/factorial
+dbug/tests
+dbug/user.ps
+dbug/user.t
+extra/comp_err
+extra/innochecksum
+extra/jemalloc/build/
+extra/jemalloc/tmp/
+extra/my_print_defaults
+extra/mysql_waitpid
+extra/perror
+extra/replace
+extra/resolve_stack_dump
+extra/resolveip
+import_executables.cmake
+include/*.h.tmp
+include/config.h
+include/my_config.h
+include/mysql_version.h
+include/mysqld_ername.h
+include/mysqld_error.h
+include/sql_state.h
+info_macros.cmake
+libmysql*/libmysql*_exports_file.cc
+libmysql*/merge_archives_mysql*.cmake
+libmysql*/mysql*_depends.c
+libmysql/libmysql_versions.ld
+libmysqld/examples/mysql_client_test_embedded
+libmysqld/examples/mysql_embedded
+libmysqld/examples/mysqltest_embedded
+make_dist.cmake
+mariadb-*.*.*.tar.gz
+mariadb-*.*.*/
+mysql-test/lib/My/SafeProcess/my_safe_process
+mysql-test/mtr
+mysql-test/mysql-test-run
+mysql-test/var
+mysys/thr_lock
+mysys/thr_timer
+packaging/rpm-oel/mysql.spec
+packaging/rpm-uln/mysql.10.0.11.spec
+packaging/solaris/postinstall-solaris
+pcre/config.h
+pcre/pcre*test.sh
+pcre/pcre.h
+pcre/pcre_chartables.c
+pcre/pcregrep
+pcre/pcretest
+pcre/test*grep
+scripts/comp_sql
+scripts/make_binary_distribution
+scripts/msql2mysql
+scripts/mysql_config
+scripts/mysql_config.pl
+scripts/mysql_convert_table_format
+scripts/mysql_find_rows
+scripts/mysql_fix_extensions
+scripts/mysql_fix_privilege_tables.sql
+scripts/mysql_fix_privilege_tables_sql.c
+scripts/mysql_install_db
+scripts/mysql_secure_installation
+scripts/mysql_setpermission
+scripts/mysql_zap
+scripts/mysqlaccess
+scripts/mysqlbug
+scripts/mysqld_multi
+scripts/mysqld_safe
+scripts/mysqldumpslow
+scripts/mysqlhotcopy
+scripts/mytop
+scripts/wsrep_sst_common
+scripts/wsrep_sst_mysqldump
+scripts/wsrep_sst_rsync
+scripts/wsrep_sst_xtrabackup
+scripts/wsrep_sst_xtrabackup-v2
+sql-bench/bench-count-distinct
+sql-bench/bench-init.pl
+sql-bench/compare-results
+sql-bench/copy-db
+sql-bench/crash-me
+sql-bench/graph-compare-results
+sql-bench/innotest1
+sql-bench/innotest1a
+sql-bench/innotest1b
+sql-bench/innotest2
+sql-bench/innotest2a
+sql-bench/innotest2b
+sql-bench/run-all-tests
+sql-bench/server-cfg
+sql-bench/test-ATIS
+sql-bench/test-alter-table
+sql-bench/test-big-tables
+sql-bench/test-connect
+sql-bench/test-create
+sql-bench/test-insert
+sql-bench/test-select
+sql-bench/test-table-elimination
+sql-bench/test-transactions
+sql-bench/test-wisconsin
+sql/lex_token.h
+sql/gen_lex_token
+sql/gen_lex_hash
+sql/lex_hash.h
+sql/mysql_tzinfo_to_sql
+sql/mysqld
+sql/sql_builtin.cc
+sql/sql_yacc.cc
+sql/sql_yacc.h
+storage/heap/hp_test1
+storage/heap/hp_test2
+storage/maria/aria_chk
+storage/maria/aria_dump_log
+storage/maria/aria_ftdump
+storage/maria/aria_pack
+storage/maria/aria_read_log
+storage/maria/ma_rt_test
+storage/maria/ma_sp_test
+storage/maria/ma_test1
+storage/maria/ma_test2
+storage/maria/ma_test3
+storage/myisam/mi_test1
+storage/myisam/mi_test2
+storage/myisam/mi_test3
+storage/myisam/myisam_ftdump
+storage/myisam/myisamchk
+storage/myisam/myisamlog
+storage/myisam/myisampack
+storage/myisam/rt_test
+storage/myisam/sp_test
+storage/tokudb/ft-index/buildheader/db.h
+storage/tokudb/ft-index/buildheader/make_tdb
+storage/tokudb/ft-index/buildheader/runcat.sh
+storage/tokudb/ft-index/ft/log_code.cc
+storage/tokudb/ft-index/ft/log_header.h
+storage/tokudb/ft-index/ft/log_print.cc
+storage/tokudb/ft-index/ft/logformat
+storage/tokudb/ft-index/ft/ftverify
+storage/tokudb/ft-index/ft/tdb-recover
+storage/tokudb/ft-index/ft/tokuftdump
+storage/tokudb/ft-index/portability/merge_archives_tokuportability_static.cmake
+storage/tokudb/ft-index/portability/toku_config.h
+storage/tokudb/ft-index/portability/tokuportability_static_depends.cc
+storage/tokudb/ft-index/src/merge_archives_tokufractaltree_static.cmake
+storage/tokudb/ft-index/src/tokufractaltree_static_depends.cc
+storage/tokudb/ft-index/toku_include/toku_config.h
+storage/tokudb/ft-index/tools/ba_replay
+storage/tokudb/ft-index/tools/ftverify
+storage/tokudb/ft-index/tools/tdb-recover
+storage/tokudb/ft-index/tools/tokudb_dump
+storage/tokudb/ft-index/tools/tokudb_gen
+storage/tokudb/ft-index/tools/tokudb_load
+storage/tokudb/ft-index/tools/tokuftdump
+storage/tokudb/ft-index/tools/tokuft_logprint
+storage/tokudb/ft-index/xz/
+support-files/MySQL-shared-compat.spec
+support-files/binary-configure
+support-files/config.huge.ini
+support-files/config.medium.ini
+support-files/config.small.ini
+support-files/mariadb.pc
+support-files/my-huge.cnf
+support-files/my-innodb-heavy-4G.cnf
+support-files/my-large.cnf
+support-files/my-medium.cnf
+support-files/my-small.cnf
+support-files/mysql-log-rotate
+support-files/mysql.10.0.11.spec
+support-files/mysql.server
+support-files/mysql.spec
+support-files/mysqld_multi.server
+support-files/wsrep.cnf
+support-files/wsrep_notify
+tags
+tests/async_queries
+tests/bug25714
+tests/mysql_client_test
+storage/mroonga/config.sh
+storage/mroonga/mrn_version.h
+storage/mroonga/data/install.sql
+storage/mroonga/vendor/groonga/config.h
+storage/mroonga/vendor/groonga/config.sh
+storage/mroonga/vendor/groonga/groonga.pc
+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/mysql-test/mroonga/storage/r/information_schema_plugins.result
+storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result
+# C and C++
+
+# Compiled Object files
+*.slo
+*.o
+*.ko
+*.obj
+*.elf
+*.exp
+*.dep
+*.idb
+
+# Precompiled Headers
+*.gch
+*.pch
+
+# Compiled Static libraries
+*.lib
+*.a
+*.la
+*.lai
+*.lo
+
+# Compiled Dynamic libraries
+*.so
+*.so.*
+*.dylib
+*.dll
+
+# Executables
+*.exe
+*.out
+*.app
+*.i*86
+*.x86_64
+*.hex
+
+
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+
+# User-specific files
+*.suo
+*.user
+*.userosscache
+*.sln.docstates
+*.sln
+
+*.vcproj
+*.vcproj.*
+*.vcproj.*.*
+*.vcproj.*.*.*
+
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+build/
+bld/
+[Bb]in/
+[Oo]bj/
+
+# Roslyn cache directories
+*.ide/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+#NUNIT
+*.VisualState.xml
+TestResult.xml
+
+# Build Results of an ATL Project
+[Dd]ebugPS/
+[Rr]eleasePS/
+dlldata.c
+
+*_i.c
+*_p.c
+*_i.h
+*.ilk
+*.meta
+*.pdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*.log
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
+
+# Chutzpah Test files
+_Chutzpah*
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opensdf
+*.sdf
+*.cachefile
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+
+# TFS 2012 Local Workspace
+$tf/
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# JustCode is a .NET coding addin-in
+.JustCode
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# NCrunch
+_NCrunch_*
+.*crunch*.local.xml
+
+# MightyMoose
+*.mm.*
+AutoTest.Net/
+
+# Web workbench (sass)
+.sass-cache/
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.[Pp]ublish.xml
+*.azurePubxml
+# TODO: Comment the next line if you want to checkin your web deploy settings
+# but database connection strings (with potential passwords) will be unencrypted
+*.pubxml
+*.publishproj
+
+# NuGet Packages
+*.nupkg
+# The packages folder can be ignored because of Package Restore
+**/packages/*
+# except build/, which is used as an MSBuild target.
+!**/packages/build/
+# If using the old MSBuild-Integrated Package Restore, uncomment this:
+#!**/packages/repositories.config
+
+# Windows Azure Build Output
+csx/
+*.build.csdef
+
+# Windows Store app package directory
+AppPackages/
+
+# Others
+# sql/
+*.Cache
+ClientBin/
+[Ss]tyle[Cc]op.*
+~$*
+*~
+*.dbmdl
+*.dbproj.schemaview
+*.pfx
+*.publishsettings
+node_modules/
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+
+# SQL Server files
+*.mdf
+*.ldf
+
+# Business Intelligence projects
+*.rdl.data
+*.bim.layout
+*.bim_*.settings
+
+# Microsoft Fakes
+FakesAssemblies/
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7ca9c0b6bf7..b274f80b773 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -362,6 +362,11 @@ CHECK_JEMALLOC()
CHECK_PCRE()
+IF(CMAKE_CROSSCOMPILING)
+ SET(IMPORT_EXECUTABLES "IMPORTFILE-NOTFOUND" CACHE FILEPATH "Path to import_executables.cmake from a native build")
+ INCLUDE(${IMPORT_EXECUTABLES})
+ENDIF()
+
#
# Setup maintainer mode options. Platform checks are
# not run with the warning options as to not perturb fragile checks
@@ -438,7 +443,7 @@ ADD_SUBDIRECTORY(packaging/solaris)
IF(NOT CMAKE_CROSSCOMPILING)
SET(EXPORTED comp_err comp_sql factorial)
IF(NOT WITHOUT_SERVER)
- SET(EXPORTED ${EXPORTED} gen_lex_hash gen_pfs_lex_token)
+ SET(EXPORTED ${EXPORTED} gen_lex_hash gen_lex_token)
ENDIF()
# minimal target to build only binaries for export
ADD_CUSTOM_TARGET(import_executables DEPENDS ${EXPORTED})
@@ -452,7 +457,8 @@ CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/include/mysql_version.h.in
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/sql/sql_builtin.cc.in
${CMAKE_BINARY_DIR}/sql/sql_builtin.cc)
CONFIGURE_FILE(
- ${CMAKE_SOURCE_DIR}/cmake/info_macros.cmake.in ${CMAKE_BINARY_DIR}/info_macros.cmake @ONLY)
+ ${CMAKE_SOURCE_DIR}/cmake/info_macros.cmake.in
+ ${CMAKE_BINARY_DIR}/info_macros.cmake @ONLY)
IF(DEB)
CONFIGURE_FILE(
@@ -464,7 +470,7 @@ ENDIF(DEB)
INCLUDE(${CMAKE_BINARY_DIR}/info_macros.cmake)
# Source: This can be done during the cmake phase, all information is
# available, but should be repeated on each "make" just in case someone
-# does "cmake ; make ; bzr pull ; make".
+# does "cmake ; make ; git pull ; make".
CREATE_INFO_SRC(${CMAKE_BINARY_DIR}/Docs)
ADD_CUSTOM_TARGET(INFO_SRC ALL
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_SOURCE_DIR}/cmake/info_src.cmake
diff --git a/VERSION b/VERSION
index ea92dd078e5..a4f16f9304a 100644
--- a/VERSION
+++ b/VERSION
@@ -1,3 +1,3 @@
MYSQL_VERSION_MAJOR=10
MYSQL_VERSION_MINOR=0
-MYSQL_VERSION_PATCH=16
+MYSQL_VERSION_PATCH=20
diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c
index dcfdff1a81f..ce441695d6f 100644
--- a/client/mysql_upgrade.c
+++ b/client/mysql_upgrade.c
@@ -1,6 +1,6 @@
/*
Copyright (c) 2006, 2013, Oracle and/or its affiliates.
- Copyright (c) 2010, 2013, Monty Program Ab.
+ Copyright (c) 2010, 2015, MariaDB
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
@@ -36,6 +36,8 @@
# endif
#endif
+static int phase = 0;
+static int phases_total = 6;
static char mysql_path[FN_REFLEN];
static char mysqlcheck_path[FN_REFLEN];
@@ -45,6 +47,8 @@ static my_bool opt_not_used, opt_silent;
static uint my_end_arg= 0;
static char *opt_user= (char*)"root";
+static my_bool upgrade_from_mysql;
+
static DYNAMIC_STRING ds_args;
static DYNAMIC_STRING conn_args;
@@ -206,12 +210,12 @@ static void die(const char *fmt, ...)
}
-static int verbose(const char *fmt, ...)
+static void verbose(const char *fmt, ...)
{
va_list args;
if (opt_silent)
- return 0;
+ return;
/* Print the verbose message */
va_start(args, fmt);
@@ -222,7 +226,6 @@ static int verbose(const char *fmt, ...)
fflush(stdout);
}
va_end(args);
- return 0;
}
@@ -740,10 +743,21 @@ static void print_conn_args(const char *tool_name)
in the server using "mysqlcheck --check-upgrade .."
*/
-static int run_mysqlcheck_upgrade(const char *arg1, const char *arg2)
+static int run_mysqlcheck_upgrade(my_bool mysql_db_only)
{
+ const char *what= mysql_db_only ? "mysql database" : "tables";
+ const char *arg1= mysql_db_only ? "--databases" : "--all-databases";
+ const char *arg2= mysql_db_only ? "mysql" : "--skip-database=mysql";
+ int retch;
+ if (opt_systables_only && !mysql_db_only)
+ {
+ verbose("Phase %d/%d: Checking and upgrading %s... Skipped",
+ ++phase, phases_total, what);
+ return 0;
+ }
+ verbose("Phase %d/%d: Checking and upgrading %s", ++phase, phases_total, what);
print_conn_args("mysqlcheck");
- return run_tool(mysqlcheck_path,
+ retch= run_tool(mysqlcheck_path,
NULL, /* Send output from mysqlcheck directly to screen */
"--no-defaults",
ds_args.str,
@@ -757,12 +771,77 @@ static int run_mysqlcheck_upgrade(const char *arg1, const char *arg2)
arg1, arg2,
"2>&1",
NULL);
+ return retch;
}
+#define EVENTS_STRUCT_LEN 7000
+
+static my_bool is_mysql()
+{
+ my_bool ret= TRUE;
+ DYNAMIC_STRING ds_events_struct;
+
+ if (init_dynamic_string(&ds_events_struct, NULL,
+ EVENTS_STRUCT_LEN, EVENTS_STRUCT_LEN))
+ die("Out of memory");
+
+ if (run_query("show create table mysql.event",
+ &ds_events_struct, FALSE) ||
+ strstr(ds_events_struct.str, "IGNORE_BAD_TABLE_OPTIONS") != NULL)
+ ret= FALSE;
+ else
+ verbose("MySQL upgrade detected");
+
+ dynstr_free(&ds_events_struct);
+ return(ret);
+}
+
+static int run_mysqlcheck_views(void)
+{
+ const char *upgrade_views="--process-views=YES";
+ if (upgrade_from_mysql)
+ {
+ /*
+ this has to ignore opt_systables_only, because upgrade_from_mysql
+ is determined by analyzing systables. if we honor opt_systables_only
+ here, views won't be fixed by subsequent mysql_upgrade runs
+ */
+ upgrade_views="--process-views=UPGRADE_FROM_MYSQL";
+ verbose("Phase %d/%d: Fixing views from mysql", ++phase, phases_total);
+ }
+ else if (opt_systables_only)
+ {
+ verbose("Phase %d/%d: Fixing views... Skipped", ++phase, phases_total);
+ return 0;
+ }
+ else
+ verbose("Phase %d/%d: Fixing views", ++phase, phases_total);
+
+ print_conn_args("mysqlcheck");
+ return run_tool(mysqlcheck_path,
+ NULL, /* Send output from mysqlcheck directly to screen */
+ "--no-defaults",
+ ds_args.str,
+ "--all-databases", "--repair",
+ upgrade_views,
+ "--skip-process-tables",
+ opt_verbose ? "--verbose": "",
+ opt_silent ? "--silent": "",
+ opt_write_binlog ? "--write-binlog" : "--skip-write-binlog",
+ "2>&1",
+ NULL);
+}
static int run_mysqlcheck_fixnames(void)
{
- verbose("Phase 3/5: Fixing table and database names");
+ if (opt_systables_only)
+ {
+ verbose("Phase %d/%d: Fixing table and database names ... Skipped",
+ ++phase, phases_total);
+ return 0;
+ }
+ verbose("Phase %d/%d: Fixing table and database names",
+ ++phase, phases_total);
print_conn_args("mysqlcheck");
return run_tool(mysqlcheck_path,
NULL, /* Send output from mysqlcheck directly to screen */
@@ -850,6 +929,9 @@ static int run_sql_fix_privilege_tables(void)
if (init_dynamic_string(&ds_result, "", 512, 512))
die("Out of memory");
+ verbose("Phase %d/%d: Running 'mysql_fix_privilege_tables'",
+ ++phase, phases_total);
+
/*
Individual queries can not be executed independently by invoking
a forked mysql client, because the script uses session variables
@@ -1019,23 +1101,19 @@ int main(int argc, char **argv)
if (opt_version_check && check_version_match())
die("Upgrade failed");
+ upgrade_from_mysql= is_mysql();
+
/*
Run "mysqlcheck" and "mysql_fix_privilege_tables.sql"
*/
- verbose("Phase 1/5: Checking mysql database");
- if (run_mysqlcheck_upgrade("--databases", "mysql"))
- die("Upgrade failed" );
- verbose("Phase 2/5: Running 'mysql_fix_privilege_tables'...");
- if (run_sql_fix_privilege_tables())
+ if (run_mysqlcheck_upgrade(TRUE) ||
+ run_mysqlcheck_views() ||
+ run_sql_fix_privilege_tables() ||
+ run_mysqlcheck_fixnames() ||
+ run_mysqlcheck_upgrade(FALSE))
die("Upgrade failed" );
- if (!opt_systables_only &&
- (run_mysqlcheck_fixnames() ||
- 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'...");
+ verbose("Phase %d/%d: Running 'FLUSH PRIVILEGES'", ++phase, phases_total);
if (run_query("FLUSH PRIVILEGES", NULL, TRUE))
die("Upgrade failed" );
@@ -1044,6 +1122,8 @@ int main(int argc, char **argv)
/* Create a file indicating upgrade has been performed */
create_mysql_upgrade_info_file();
+ DBUG_ASSERT(phase == phases_total);
+
free_used_memory();
my_end(my_end_arg);
exit(0);
diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc
index 88016d9563d..bc6b68c63d1 100644
--- a/client/mysqladmin.cc
+++ b/client/mysqladmin.cc
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2014, Oracle and/or its affiliates.
- Copyright (c) 2010, 2014, Monty Program Ab.
+ Copyright (c) 2010, 2015, MariaDB
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
@@ -1249,6 +1249,9 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
static char **mask_password(int argc, char ***argv)
{
char **temp_argv;
+ if (!argc)
+ return NULL;
+
temp_argv= (char **)(my_malloc(sizeof(char *) * argc, MYF(MY_WME)));
argc--;
while (argc > 0)
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index 7c93e8d3ebd..7a54a693cb4 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -49,6 +49,8 @@
#include "mysqld.h"
+#include <algorithm>
+
Rpl_filter *binlog_filter= 0;
#define BIN_LOG_HEADER_SIZE 4
@@ -67,6 +69,7 @@ ulong server_id = 0;
ulong bytes_sent = 0L, bytes_received = 0L;
ulong mysqld_net_retry_count = 10L;
ulong open_files_limit;
+ulong opt_binlog_rows_event_max_size;
uint test_flags = 0;
static uint opt_protocol= 0;
static FILE *result_file;
@@ -1436,6 +1439,12 @@ that may lead to an endless loop.",
"Used to reserve file descriptors for use by this program.",
&open_files_limit, &open_files_limit, 0, GET_ULONG,
REQUIRED_ARG, MY_NFILE, 8, OS_FILE_LIMIT, 0, 1, 0},
+ {"binlog-row-event-max-size", 0,
+ "The maximum size of a row-based binary log event in bytes. Rows will be "
+ "grouped into events smaller than this size if possible. "
+ "This value must be a multiple of 256.",
+ &opt_binlog_rows_event_max_size, &opt_binlog_rows_event_max_size, 0,
+ GET_ULONG, REQUIRED_ARG, UINT_MAX, 256, ULONG_MAX, 0, 256, 0},
{"verify-binlog-checksum", 'c', "Verify checksum binlog events.",
(uchar**) &opt_verify_binlog_checksum, (uchar**) &opt_verify_binlog_checksum,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c
index 2f5ee4c82e6..ead4127dad6 100644
--- a/client/mysqlcheck.c
+++ b/client/mysqlcheck.c
@@ -1,6 +1,6 @@
/*
Copyright (c) 2001, 2013, Oracle and/or its affiliates.
- Copyright (c) 2010, 2013, Monty Program Ab.
+ Copyright (c) 2010, 2015, MariaDB
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
@@ -18,7 +18,7 @@
/* By Jani Tolonen, 2001-04-20, MySQL Development Team */
-#define CHECK_VERSION "2.7.3-MariaDB"
+#define CHECK_VERSION "2.7.4-MariaDB"
#include "client_priv.h"
#include <m_ctype.h>
@@ -42,7 +42,8 @@ static my_bool opt_alldbs = 0, opt_check_only_changed = 0, opt_extended = 0,
opt_medium_check = 0, opt_quick = 0, opt_all_in_1 = 0,
opt_silent = 0, opt_auto_repair = 0, ignore_errors = 0,
tty_password= 0, opt_frm= 0, debug_info_flag= 0, debug_check_flag= 0,
- opt_fix_table_names= 0, opt_fix_db_names= 0, opt_upgrade= 0;
+ opt_fix_table_names= 0, opt_fix_db_names= 0, opt_upgrade= 0,
+ opt_do_tables= 1;
static my_bool opt_write_binlog= 1, opt_flush_tables= 0;
static uint verbose = 0, opt_mysql_port=0;
static int my_end_arg;
@@ -53,10 +54,21 @@ static char *opt_plugin_dir= 0, *opt_default_auth= 0;
static int first_error = 0;
static char *opt_skip_database;
DYNAMIC_ARRAY tables4repair, tables4rebuild, alter_table_cmds;
+DYNAMIC_ARRAY views4repair;
static char *shared_memory_base_name=0;
static uint opt_protocol=0;
-enum operations { DO_CHECK=1, DO_REPAIR, DO_ANALYZE, DO_OPTIMIZE, DO_UPGRADE };
+enum operations { DO_CHECK=1, DO_REPAIR, DO_ANALYZE, DO_OPTIMIZE, DO_FIX_NAMES };
+const char *operation_name[]=
+{
+ "???", "check", "repair", "analyze", "optimize", "fix names"
+};
+
+typedef enum { DO_VIEWS_NO, DO_VIEWS_YES, DO_VIEWS_FROM_MYSQL } enum_do_views;
+const char *do_views_opts[]= {"NO", "YES", "UPGRADE_FROM_MYSQL", NullS};
+TYPELIB do_views_typelib= { array_elements(do_views_opts) - 1, "",
+ do_views_opts, NULL };
+static ulong opt_do_views= DO_VIEWS_NO;
static struct my_option my_long_options[] =
{
@@ -200,6 +212,14 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Output version information and exit.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"process-views", 0,
+ "Perform the requested operation (check or repair) on views. "
+ "One of: NO, YES (correct the checksum, if necessary, add the "
+ "mariadb-version field), UPGRADE_FROM_MYSQL (same as YES and toggle "
+ "the algorithm MERGE<->TEMPTABLE.", &opt_do_views, &opt_do_views,
+ &do_views_typelib, GET_ENUM, OPT_ARG, 0, 0, 0, 0, 0, 0},
+ {"process-tables", 0, "Perform the requested operation on tables.",
+ &opt_do_tables, &opt_do_tables, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
@@ -216,7 +236,7 @@ static int process_selected_tables(char *db, char **table_names, int tables);
static int process_all_tables_in_db(char *database);
static int process_one_db(char *database);
static int use_db(char *database);
-static int handle_request_for_tables(char *tables, uint length);
+static int handle_request_for_tables(char *tables, size_t length, my_bool view);
static int dbConnect(char *host, char *user,char *passwd);
static void dbDisconnect(char *host);
static void DBerror(MYSQL *mysql, const char *when);
@@ -294,11 +314,11 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
what_to_do = DO_OPTIMIZE;
break;
case OPT_FIX_DB_NAMES:
- what_to_do= DO_UPGRADE;
+ what_to_do= DO_FIX_NAMES;
opt_databases= 1;
break;
case OPT_FIX_TABLE_NAMES:
- what_to_do= DO_UPGRADE;
+ what_to_do= DO_FIX_NAMES;
break;
case 'p':
if (argument == disabled_my_option)
@@ -339,7 +359,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case 'v':
verbose++;
break;
- case 'V': print_version(); exit(0);
+ case 'V':
+ print_version(); exit(0);
+ break;
case OPT_MYSQL_PROTOCOL:
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
opt->name);
@@ -348,7 +370,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
if (orig_what_to_do && (what_to_do != orig_what_to_do))
{
- fprintf(stderr, "Error: %s doesn't support multiple contradicting commands.\n",
+ fprintf(stderr, "Error: %s doesn't support multiple contradicting commands.\n",
my_progname);
DBUG_RETURN(1);
}
@@ -370,6 +392,12 @@ static int get_options(int *argc, char ***argv)
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
exit(ho_error);
+ if (what_to_do == DO_REPAIR && !opt_do_views && !opt_do_tables)
+ {
+ fprintf(stderr, "Error: Nothing to repair when both "
+ "--process-tables=NO and --process-views=NO\n");
+ exit(1);
+ }
if (!what_to_do)
{
size_t pnlen= strlen(my_progname);
@@ -386,6 +414,13 @@ static int get_options(int *argc, char ***argv)
what_to_do = DO_CHECK;
}
+ if (opt_do_views && what_to_do != DO_REPAIR && what_to_do != DO_CHECK)
+ {
+ fprintf(stderr, "Error: %s doesn't support %s for views.\n",
+ my_progname, operation_name[what_to_do]);
+ exit(1);
+ }
+
/*
If there's no --default-character-set option given with
--fix-table-name or --fix-db-name set the default character set to "utf8".
@@ -470,13 +505,41 @@ static int process_databases(char **db_names)
} /* process_databases */
+/* returns: -1 for error, 1 for view, 0 for table */
+static int is_view(const char *table)
+{
+ char query[1024];
+ MYSQL_RES *res;
+ MYSQL_FIELD *field;
+ int view;
+ DBUG_ENTER("is_view");
+
+ my_snprintf(query, sizeof(query), "SHOW CREATE TABLE %`s", table);
+ if (mysql_query(sock, query))
+ {
+ fprintf(stderr, "Failed to %s\n", query);
+ fprintf(stderr, "Error: %s\n", mysql_error(sock));
+ my_free(query);
+ DBUG_RETURN(-1);
+ }
+ res= mysql_store_result(sock);
+ field= mysql_fetch_field(res);
+ view= (strcmp(field->name,"View") == 0) ? 1 : 0;
+ mysql_free_result(res);
+
+ DBUG_RETURN(view);
+}
+
static int process_selected_tables(char *db, char **table_names, int tables)
{
+ int view;
+ char *table;
+ uint table_len;
DBUG_ENTER("process_selected_tables");
if (use_db(db))
DBUG_RETURN(1);
- if (opt_all_in_1 && what_to_do != DO_UPGRADE)
+ if (opt_all_in_1 && what_to_do != DO_FIX_NAMES)
{
/*
We need table list in form `a`, `b`, `c`
@@ -487,6 +550,15 @@ static int process_selected_tables(char *db, char **table_names, int tables)
size_t tot_length= 0;
int i= 0;
+ if (opt_do_tables && opt_do_views)
+ {
+ fprintf(stderr, "Error: %s cannot process both tables and views "
+ "in one command (--process-tables=YES "
+ "--process-views=YES --all-in-1).\n",
+ my_progname);
+ DBUG_RETURN(1);
+ }
+
for (i = 0; i < tables; i++)
tot_length+= fixed_name_length(*(table_names + i)) + 2;
@@ -501,12 +573,20 @@ static int process_selected_tables(char *db, char **table_names, int tables)
*end++= ',';
}
*--end = 0;
- handle_request_for_tables(table_names_comma_sep + 1, (uint) (tot_length - 1));
+ handle_request_for_tables(table_names_comma_sep + 1, tot_length - 1,
+ opt_do_views != 0);
my_free(table_names_comma_sep);
}
else
for (; tables > 0; tables--, table_names++)
- handle_request_for_tables(*table_names, fixed_name_length(*table_names));
+ {
+ table= *table_names;
+ table_len= fixed_name_length(*table_names);
+ view= is_view(table);
+ if (view < 0)
+ continue;
+ handle_request_for_tables(table, table_len, (view == 1));
+ }
DBUG_RETURN(0);
} /* process_selected_tables */
@@ -521,9 +601,6 @@ static uint fixed_name_length(const char *name)
{
if (*p == '`')
extra_length++;
- else if (*p == '.')
- extra_length+= 2;
-
}
DBUG_RETURN((uint) ((p - name) + extra_length));
}
@@ -537,11 +614,6 @@ static char *fix_table_name(char *dest, char *src)
for (; *src; src++)
{
switch (*src) {
- case '.': /* add backticks around '.' */
- *dest++= '`';
- *dest++= '.';
- *dest++= '`';
- break;
case '`': /* escape backtick character */
*dest++= '`';
/* fall through */
@@ -561,6 +633,7 @@ static int process_all_tables_in_db(char *database)
MYSQL_ROW row;
uint num_columns;
my_bool system_database= 0;
+ my_bool view= FALSE;
DBUG_ENTER("process_all_tables_in_db");
if (use_db(database))
@@ -579,7 +652,7 @@ static int process_all_tables_in_db(char *database)
num_columns= mysql_num_fields(res);
- if (opt_all_in_1 && what_to_do != DO_UPGRADE)
+ if (opt_all_in_1 && what_to_do != DO_FIX_NAMES)
{
/*
We need table list in form `a`, `b`, `c`
@@ -590,8 +663,17 @@ static int process_all_tables_in_db(char *database)
char *tables, *end;
uint tot_length = 0;
+ char *views, *views_end;
+ uint tot_views_length = 0;
+
while ((row = mysql_fetch_row(res)))
- tot_length+= fixed_name_length(row[0]) + 2;
+ {
+ if ((num_columns == 2) && (strcmp(row[1], "VIEW") == 0) &&
+ opt_do_views)
+ tot_views_length+= fixed_name_length(row[0]) + 2;
+ else if (opt_do_tables)
+ tot_length+= fixed_name_length(row[0]) + 2;
+ }
mysql_data_seek(res, 0);
if (!(tables=(char *) my_malloc(sizeof(char)*tot_length+4, MYF(MY_WME))))
@@ -599,32 +681,62 @@ static int process_all_tables_in_db(char *database)
mysql_free_result(res);
DBUG_RETURN(1);
}
- for (end = tables + 1; (row = mysql_fetch_row(res)) ;)
+ if (!(views=(char *) my_malloc(sizeof(char)*tot_views_length+4, MYF(MY_WME))))
{
- if ((num_columns == 2) && (strcmp(row[1], "VIEW") == 0))
- continue;
+ my_free(tables);
+ mysql_free_result(res);
+ DBUG_RETURN(1);
+ }
- end= fix_table_name(end, row[0]);
- *end++= ',';
+ for (end = tables + 1, views_end= views + 1; (row = mysql_fetch_row(res)) ;)
+ {
+ if ((num_columns == 2) && (strcmp(row[1], "VIEW") == 0))
+ {
+ if (!opt_do_views)
+ continue;
+ views_end= fix_table_name(views_end, row[0]);
+ *views_end++= ',';
+ }
+ else
+ {
+ if (!opt_do_tables)
+ continue;
+ end= fix_table_name(end, row[0]);
+ *end++= ',';
+ }
}
*--end = 0;
+ *--views_end = 0;
if (tot_length)
- handle_request_for_tables(tables + 1, tot_length - 1);
+ handle_request_for_tables(tables + 1, tot_length - 1, FALSE);
+ if (tot_views_length)
+ handle_request_for_tables(views + 1, tot_views_length - 1, TRUE);
my_free(tables);
+ my_free(views);
}
else
{
while ((row = mysql_fetch_row(res)))
{
/* Skip views if we don't perform renaming. */
- if ((what_to_do != DO_UPGRADE) && (num_columns == 2) && (strcmp(row[1], "VIEW") == 0))
- continue;
+ if ((what_to_do != DO_FIX_NAMES) && (num_columns == 2) && (strcmp(row[1], "VIEW") == 0))
+ {
+ if (!opt_do_views)
+ continue;
+ view= TRUE;
+ }
+ else
+ {
+ if (!opt_do_tables)
+ continue;
+ view= FALSE;
+ }
if (system_database &&
(!strcmp(row[0], "general_log") ||
!strcmp(row[0], "slow_log")))
continue; /* Skip logging tables */
- handle_request_for_tables(row[0], fixed_name_length(row[0]));
+ handle_request_for_tables(row[0], fixed_name_length(row[0]), view);
}
}
mysql_free_result(res);
@@ -712,7 +824,7 @@ static int process_one_db(char *database)
if (verbose)
puts(database);
- if (what_to_do == DO_UPGRADE)
+ if (what_to_do == DO_FIX_NAMES)
{
int rc= 0;
if (opt_fix_db_names && !strncmp(database,"#mysql50#", 9))
@@ -751,39 +863,59 @@ static int disable_binlog()
return run_query(stmt, 0);
}
-static int handle_request_for_tables(char *tables, uint length)
+static int handle_request_for_tables(char *tables, size_t length, my_bool view)
{
char *query, *end, options[100], message[100];
char table_name_buff[NAME_CHAR_LEN*2*2+1], *table_name;
uint query_length= 0;
const char *op = 0;
+ const char *tab_view;
DBUG_ENTER("handle_request_for_tables");
options[0] = 0;
+ tab_view= view ? " VIEW " : " TABLE ";
end = options;
switch (what_to_do) {
case DO_CHECK:
op = "CHECK";
- if (opt_quick) end = strmov(end, " QUICK");
- if (opt_fast) end = strmov(end, " FAST");
- if (opt_medium_check) end = strmov(end, " MEDIUM"); /* Default */
- if (opt_extended) end = strmov(end, " EXTENDED");
- if (opt_check_only_changed) end = strmov(end, " CHANGED");
+ if (view)
+ {
+ if (opt_fast || opt_check_only_changed)
+ DBUG_RETURN(0);
+ }
+ else
+ {
+ if (opt_quick) end = strmov(end, " QUICK");
+ if (opt_fast) end = strmov(end, " FAST");
+ if (opt_extended) end = strmov(end, " EXTENDED");
+ if (opt_medium_check) end = strmov(end, " MEDIUM"); /* Default */
+ if (opt_check_only_changed) end = strmov(end, " CHANGED");
+ }
if (opt_upgrade) end = strmov(end, " FOR UPGRADE");
break;
case DO_REPAIR:
- op= (opt_write_binlog) ? "REPAIR" : "REPAIR NO_WRITE_TO_BINLOG";
- if (opt_quick) end = strmov(end, " QUICK");
- if (opt_extended) end = strmov(end, " EXTENDED");
- if (opt_frm) end = strmov(end, " USE_FRM");
+ op= opt_write_binlog ? "REPAIR" : "REPAIR NO_WRITE_TO_BINLOG";
+ if (view)
+ {
+ if (opt_do_views == DO_VIEWS_FROM_MYSQL) end = strmov(end, " FROM MYSQL");
+ }
+ else
+ {
+ if (opt_quick) end = strmov(end, " QUICK");
+ if (opt_extended) end = strmov(end, " EXTENDED");
+ if (opt_frm) end = strmov(end, " USE_FRM");
+ }
break;
case DO_ANALYZE:
+ DBUG_ASSERT(!view);
op= (opt_write_binlog) ? "ANALYZE" : "ANALYZE NO_WRITE_TO_BINLOG";
break;
case DO_OPTIMIZE:
+ DBUG_ASSERT(!view);
op= (opt_write_binlog) ? "OPTIMIZE" : "OPTIMIZE NO_WRITE_TO_BINLOG";
break;
- case DO_UPGRADE:
+ case DO_FIX_NAMES:
+ DBUG_ASSERT(!view);
DBUG_RETURN(fix_table_storage_name(tables));
}
@@ -792,14 +924,15 @@ static int handle_request_for_tables(char *tables, uint length)
if (opt_all_in_1)
{
/* No backticks here as we added them before */
- query_length= sprintf(query, "%s TABLE %s %s", op, tables, options);
+ query_length= sprintf(query, "%s%s%s %s", op,
+ tab_view, tables, options);
table_name= tables;
}
else
{
char *ptr, *org;
- org= ptr= strmov(strmov(query, op), " TABLE ");
+ org= ptr= strmov(strmov(query, op), tab_view);
ptr= fix_table_name(ptr, tables);
strmake(table_name_buff, org, MY_MIN((int) sizeof(table_name_buff)-1,
(int) (ptr - org)));
@@ -811,7 +944,7 @@ static int handle_request_for_tables(char *tables, uint length)
puts(query);
if (mysql_real_query(sock, query, query_length))
{
- sprintf(message, "when executing '%s TABLE ... %s'", op, options);
+ sprintf(message, "when executing '%s%s... %s'", op, tab_view, options);
DBerror(sock, message);
my_free(query);
DBUG_RETURN(1);
@@ -836,13 +969,18 @@ static void print_result()
{
MYSQL_RES *res;
MYSQL_ROW row;
- char prev[(NAME_LEN+9)*2+2];
+ char prev[(NAME_LEN+9)*3+2];
char prev_alter[MAX_ALTER_STR_SIZE];
+ char *db_name;
+ uint length_of_db;
uint i;
my_bool found_error=0, table_rebuild=0;
+ DYNAMIC_ARRAY *array4repair= &tables4repair;
DBUG_ENTER("print_result");
res = mysql_use_result(sock);
+ db_name= sock->db;
+ length_of_db= strlen(db_name);
prev[0] = '\0';
prev_alter[0]= 0;
@@ -866,11 +1004,18 @@ static void print_result()
if (prev_alter[0])
insert_dynamic(&alter_table_cmds, (uchar*) prev_alter);
else
- insert_dynamic(&tables4rebuild, (uchar*) prev);
+ {
+ char *table_name= prev + (length_of_db+1);
+ insert_dynamic(&tables4rebuild, (uchar*) table_name);
+ }
}
else
- insert_dynamic(&tables4repair, prev);
+ {
+ char *table_name= prev + (length_of_db+1);
+ insert_dynamic(array4repair, table_name);
+ }
}
+ array4repair= &tables4repair;
found_error=0;
table_rebuild=0;
prev_alter[0]= 0;
@@ -886,8 +1031,11 @@ static void print_result()
we have to run upgrade on it. In this case we write a nicer message
than "Please do "REPAIR TABLE""...
*/
- if (!strcmp(row[2],"error") && strstr(row[3],"REPAIR TABLE"))
+ if (!strcmp(row[2],"error") && strstr(row[3],"REPAIR "))
+ {
printf("%-50s %s", row[0], "Needs upgrade");
+ array4repair= strstr(row[3], "VIEW") ? &views4repair : &tables4repair;
+ }
else
printf("%s\n%-9s: %s", row[0], row[2], row[3]);
if (opt_auto_repair && strcmp(row[2],"note"))
@@ -910,10 +1058,16 @@ static void print_result()
if (prev_alter[0])
insert_dynamic(&alter_table_cmds, prev_alter);
else
- insert_dynamic(&tables4rebuild, prev);
+ {
+ char *table_name= prev + (length_of_db+1);
+ insert_dynamic(&tables4rebuild, table_name);
+ }
}
else
- insert_dynamic(&tables4repair, prev);
+ {
+ char *table_name= prev + (length_of_db+1);
+ insert_dynamic(array4repair, table_name);
+ }
}
mysql_free_result(res);
DBUG_VOID_RETURN;
@@ -1032,6 +1186,8 @@ int main(int argc, char **argv)
if (opt_auto_repair &&
(my_init_dynamic_array(&tables4repair, sizeof(char)*(NAME_LEN*2+2),16,
64, MYF(0)) ||
+ my_init_dynamic_array(&views4repair, sizeof(char)*(NAME_LEN*2+2),16,
+ 64, MYF(0)) ||
my_init_dynamic_array(&tables4rebuild, sizeof(char)*(NAME_LEN*2+2),16,
64, MYF(0)) ||
my_init_dynamic_array(&alter_table_cmds, MAX_ALTER_STR_SIZE, 0, 1,
@@ -1056,12 +1212,19 @@ int main(int argc, char **argv)
for (i = 0; i < tables4repair.elements ; i++)
{
char *name= (char*) dynamic_array_ptr(&tables4repair, i);
- handle_request_for_tables(name, fixed_name_length(name));
+ handle_request_for_tables(name, fixed_name_length(name), FALSE);
}
for (i = 0; i < tables4rebuild.elements ; i++)
rebuild_table((char*) dynamic_array_ptr(&tables4rebuild, i));
for (i = 0; i < alter_table_cmds.elements ; i++)
run_query((char*) dynamic_array_ptr(&alter_table_cmds, i), 1);
+ if (!opt_silent && views4repair.elements)
+ puts("\nRepairing views");
+ for (i = 0; i < views4repair.elements ; i++)
+ {
+ char *name= (char*) dynamic_array_ptr(&views4repair, i);
+ handle_request_for_tables(name, fixed_name_length(name), TRUE);
+ }
}
ret= MY_TEST(first_error);
@@ -1069,8 +1232,10 @@ int main(int argc, char **argv)
dbDisconnect(current_host);
if (opt_auto_repair)
{
+ delete_dynamic(&views4repair);
delete_dynamic(&tables4repair);
delete_dynamic(&tables4rebuild);
+ delete_dynamic(&alter_table_cmds);
}
end1:
my_free(opt_password);
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 3adbe87a8bb..e4683ab79c4 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -97,7 +97,7 @@ static ulong find_set(TYPELIB *lib, const char *x, uint length,
static char *alloc_query_str(ulong size);
static void field_escape(DYNAMIC_STRING* in, const char *from);
-static my_bool verbose= 0, opt_no_create_info= 0, opt_no_data= 0,
+static my_bool verbose= 0, opt_no_create_info= 0, opt_no_data= 0, opt_no_data_med= 1,
quick= 1, extended_insert= 1,
lock_tables=1,ignore_errors=0,flush_logs=0,flush_privileges=0,
opt_drop=1,opt_keywords=0,opt_lock=1,opt_compress=0,
@@ -114,7 +114,6 @@ static my_bool verbose= 0, opt_no_create_info= 0, opt_no_data= 0,
opt_slave_apply= 0,
opt_include_master_host_port= 0,
opt_events= 0, opt_comments_used= 0,
- opt_galera_sst_mode= 0,
opt_alltspcs=0, opt_notspcs= 0;
static my_bool insert_pat_inited= 0, debug_info_flag= 0, debug_check_flag= 0;
static ulong opt_max_allowed_packet, opt_net_buffer_length;
@@ -204,6 +203,8 @@ const char *compatible_mode_names[]=
TYPELIB compatible_mode_typelib= {array_elements(compatible_mode_names) - 1,
"", compatible_mode_names, NULL};
+#define MED_ENGINES "MRG_MyISAM, MRG_ISAM, CONNECT, OQGRAPH, SPIDER, VP, FEDERATED"
+
HASH ignore_table;
static struct my_option my_long_options[] =
@@ -351,14 +352,6 @@ static struct my_option my_long_options[] =
{"force", 'f', "Continue even if we get an SQL error.",
&ignore_errors, &ignore_errors, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
- {"galera-sst-mode", OPT_GALERA_SST_MODE,
- "This mode should normally be used in mysqldump snapshot state transfer "
- "(SST) in a Galera cluster. If enabled, mysqldump additionally dumps "
- "commands to turn off binary logging and SET global gtid_binlog_state "
- "with the current value. Note: RESET MASTER needs to be executed on the "
- "server receiving the resulting dump.",
- &opt_galera_sst_mode, &opt_galera_sst_mode, 0, GET_BOOL, NO_ARG, 0, 0, 0,
- 0, 0, 0},
{"gtid", OPT_USE_GTID, "Used together with --master-data=1 or --dump-slave=1."
"When enabled, the output from those options will set the GTID position "
"instead of the binlog file and offset; the file/offset will appear only as "
@@ -438,6 +431,9 @@ static struct my_option my_long_options[] =
NO_ARG, 0, 0, 0, 0, 0, 0},
{"no-data", 'd', "No row information.", &opt_no_data,
&opt_no_data, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"no-data-med", 0, "No row information for engines that "
+ "Manage External Data (" MED_ENGINES ").", &opt_no_data_med,
+ &opt_no_data_med, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"no-set-names", 'N', "Same as --skip-set-charset.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"opt", OPT_OPTIMIZE,
@@ -4903,43 +4899,6 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
} /* dump_selected_tables */
-/**
- Add the following statements to the generated dump:
- a) SET @@session.sql_log_bin=OFF;
- b) SET @@global.gtid_binlog_state='[N-N-N,...]'
-*/
-static int wsrep_set_sst_cmds(MYSQL *mysql) {
- MYSQL_RES *res;
- MYSQL_ROW row;
-
- if (mysql_get_server_version(mysql) < 100005) {
- /* @@gtid_binlog_state does not exist. */
- return 0;
- }
-
- if (mysql_query_with_error_report(mysql, &res, "SELECT "
- "@@global.gtid_binlog_state"))
- return 1;
-
- if (mysql_num_rows(res) != 1)
- /* No entry for @@global.gtid_binlog_state, nothing needs to be done. */
- return 0;
-
- if (!(row= mysql_fetch_row(res)) || !(char *)row[0])
- return 1;
-
- /* first, add a command to turn off binary logging, */
- fprintf(md_result_file, "SET @@session.sql_log_bin=OFF;\n");
-
- /* followed by, a command to set global gtid_binlog_state. */
- fprintf(md_result_file, "SET @@global.gtid_binlog_state='%s';\n",
- (char*)row[0]);
-
- mysql_free_result(res);
- return 0;
-}
-
-
static int do_show_master_status(MYSQL *mysql_con, int consistent_binlog_pos,
int have_mariadb_gtid, int use_gtid)
{
@@ -5452,12 +5411,12 @@ char check_if_ignore_table(const char *table_name, char *table_type)
/*
If these two types, we do want to skip dumping the table
*/
- if (!opt_no_data &&
- (!my_strcasecmp(&my_charset_latin1, table_type, "MRG_MyISAM") ||
- !strcmp(table_type,"MRG_ISAM") ||
- !strcmp(table_type,"CONNECT") ||
- !strcmp(table_type,"FEDERATED")))
- result= IGNORE_DATA;
+ if (!opt_no_data && opt_no_data_med)
+ {
+ const char *found= strstr(" " MED_ENGINES ",", table_type);
+ if (found && found[-1] == ' ' && found[strlen(table_type)] == ',')
+ result= IGNORE_DATA;
+ }
}
mysql_free_result(res);
DBUG_RETURN(result);
@@ -5936,9 +5895,6 @@ int main(int argc, char **argv)
if (opt_slave_apply && add_stop_slave())
goto err;
- if (opt_galera_sst_mode && wsrep_set_sst_cmds(mysql))
- goto err;
-
if (opt_master_data && do_show_master_status(mysql, consistent_binlog_pos,
have_mariadb_gtid, opt_use_gtid))
goto err;
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index 9b7a6e8fd19..e28d56e9187 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -839,6 +839,7 @@ static void handle_no_active_connection(struct st_command* command,
#define EMB_END_CONNECTION 3
#define EMB_PREPARE_STMT 4
#define EMB_EXECUTE_STMT 5
+#define EMB_CLOSE_STMT 6
/* workaround for MySQL BUG#57491 */
#undef MY_WME
@@ -887,6 +888,9 @@ pthread_handler_t connection_thread(void *arg)
case EMB_EXECUTE_STMT:
cn->result= mysql_stmt_execute(cn->stmt);
break;
+ case EMB_CLOSE_STMT:
+ cn->result= mysql_stmt_close(cn->stmt);
+ break;
default:
DBUG_ASSERT(0);
}
@@ -984,6 +988,17 @@ static int do_stmt_execute(struct st_connection *cn)
}
+static int do_stmt_close(struct st_connection *cn)
+{
+ /* The cn->stmt is already set. */
+ if (!cn->has_thread)
+ return mysql_stmt_close(cn->stmt);
+ signal_connection_thd(cn, EMB_CLOSE_STMT);
+ wait_query_thread_done(cn);
+ return cn->result;
+}
+
+
static void emb_close_connection(struct st_connection *cn)
{
if (!cn->has_thread)
@@ -1019,6 +1034,7 @@ static void init_connection_thd(struct st_connection *cn)
#define do_read_query_result(cn) mysql_read_query_result(cn->mysql)
#define do_stmt_prepare(cn, q, q_len) mysql_stmt_prepare(cn->stmt, q, q_len)
#define do_stmt_execute(cn) mysql_stmt_execute(cn->stmt)
+#define do_stmt_close(cn) mysql_stmt_close(cn->stmt)
#endif /*EMBEDDED_LIBRARY*/
@@ -1378,11 +1394,11 @@ void close_connections()
DBUG_ENTER("close_connections");
for (--next_con; next_con >= connections; --next_con)
{
+ if (next_con->stmt)
+ do_stmt_close(next_con);
#ifdef EMBEDDED_LIBRARY
emb_close_connection(next_con);
#endif
- if (next_con->stmt)
- mysql_stmt_close(next_con->stmt);
next_con->stmt= 0;
mysql_close(next_con->mysql);
next_con->mysql= 0;
@@ -5635,7 +5651,11 @@ void do_close_connection(struct st_command *command)
con->mysql->net.vio = 0;
}
}
-#else
+#endif /*!EMBEDDED_LIBRARY*/
+ if (con->stmt)
+ do_stmt_close(con);
+ con->stmt= 0;
+#ifdef EMBEDDED_LIBRARY
/*
As query could be still executed in a separate theread
we need to check if the query's thread was finished and probably wait
@@ -5643,9 +5663,6 @@ void do_close_connection(struct st_command *command)
*/
emb_close_connection(con);
#endif /*EMBEDDED_LIBRARY*/
- if (con->stmt)
- mysql_stmt_close(con->stmt);
- con->stmt= 0;
mysql_close(con->mysql);
con->mysql= 0;
@@ -5912,6 +5929,8 @@ void do_connect(struct st_command *command)
my_bool con_ssl= 0, con_compress= 0;
my_bool con_pipe= 0;
my_bool con_shm __attribute__ ((unused))= 0;
+ int read_timeout= 0;
+ int write_timeout= 0;
struct st_connection* con_slot;
static DYNAMIC_STRING ds_connection_name;
@@ -6008,6 +6027,16 @@ void do_connect(struct st_command *command)
con_pipe= 1;
else if (length == 3 && !strncmp(con_options, "SHM", 3))
con_shm= 1;
+ else if (strncasecmp(con_options, "read_timeout=",
+ sizeof("read_timeout=")-1) == 0)
+ {
+ read_timeout= atoi(con_options + sizeof("read_timeout=")-1);
+ }
+ else if (strncasecmp(con_options, "write_timeout=",
+ sizeof("write_timeout=")-1) == 0)
+ {
+ write_timeout= atoi(con_options + sizeof("write_timeout=")-1);
+ }
else
die("Illegal option to connect: %.*s",
(int) (end - con_options), con_options);
@@ -6080,6 +6109,18 @@ void do_connect(struct st_command *command)
if (opt_protocol)
mysql_options(con_slot->mysql, MYSQL_OPT_PROTOCOL, (char*) &opt_protocol);
+ if (read_timeout)
+ {
+ mysql_options(con_slot->mysql, MYSQL_OPT_READ_TIMEOUT,
+ (char*)&read_timeout);
+ }
+
+ if (write_timeout)
+ {
+ mysql_options(con_slot->mysql, MYSQL_OPT_WRITE_TIMEOUT,
+ (char*)&write_timeout);
+ }
+
#ifdef HAVE_SMEM
if (con_shm)
{
diff --git a/cmake/abi_check.cmake b/cmake/abi_check.cmake
index cca595c5635..e8d2737f116 100644
--- a/cmake/abi_check.cmake
+++ b/cmake/abi_check.cmake
@@ -28,7 +28,7 @@ ELSE()
SET(RUN_ABI_CHECK 0)
ENDIF()
-IF(CMAKE_COMPILER_IS_GNUCC AND RUN_ABI_CHECK)
+IF(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang" AND RUN_ABI_CHECK)
IF(CMAKE_C_COMPILER MATCHES "ccache$")
SET(COMPILER ${CMAKE_C_COMPILER_ARG1})
STRING(REGEX REPLACE "^ " "" COMPILER ${COMPILER})
diff --git a/cmake/compile_flags.cmake b/cmake/compile_flags.cmake
index 5e872f981b0..b39bf7b79d6 100644
--- a/cmake/compile_flags.cmake
+++ b/cmake/compile_flags.cmake
@@ -1,4 +1,4 @@
-# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2014, 2015, 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
@@ -18,11 +18,11 @@
MACRO(ADD_COMPILE_FLAGS)
SET(FILES "")
SET(FLAGS "")
- SET(COMPILE_FLAGS)
+ SET(COMPILE_FLAGS_SEEN)
FOREACH(ARG ${ARGV})
IF(ARG STREQUAL "COMPILE_FLAGS")
- SET(COMPILE_FLAGS "COMPILE_FLAGS")
- ELSEIF(COMPILE_FLAGS)
+ SET(COMPILE_FLAGS_SEEN 1)
+ ELSEIF(COMPILE_FLAGS_SEEN)
LIST(APPEND FLAGS ${ARG})
ELSE()
LIST(APPEND FILES ${ARG})
diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake
index bd8d96154b2..b936e2c0983 100644
--- a/cmake/cpack_rpm.cmake
+++ b/cmake/cpack_rpm.cmake
@@ -21,11 +21,12 @@ SET(CPACK_COMPONENT_MANPAGESCLIENT_GROUP "client")
SET(CPACK_COMPONENT_README_GROUP "server")
SET(CPACK_COMPONENT_SHAREDLIBRARIES_GROUP "shared")
SET(CPACK_COMPONENT_COMMON_GROUP "common")
+SET(CPACK_COMPONENT_CLIENTPLUGINS_GROUP "common")
SET(CPACK_COMPONENT_COMPAT_GROUP "compat")
SET(CPACK_COMPONENTS_ALL Server ManPagesServer IniFiles Server_Scripts
SupportFiles Development ManPagesDevelopment
ManPagesTest Readme ManPagesClient Test
- Common Client SharedLibraries)
+ Common Client SharedLibraries ClientPlugins)
SET(CPACK_RPM_PACKAGE_NAME "MariaDB")
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_RPM_PACKAGE_NAME}-${VERSION}-${RPM}-${CMAKE_SYSTEM_PROCESSOR}")
diff --git a/cmake/cpack_source_ignore_files.cmake b/cmake/cpack_source_ignore_files.cmake
index 5db383ae73f..0874311428e 100644
--- a/cmake/cpack_source_ignore_files.cmake
+++ b/cmake/cpack_source_ignore_files.cmake
@@ -1,4 +1,4 @@
-# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 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
@@ -14,9 +14,6 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
SET(CPACK_SOURCE_IGNORE_FILES
-\\\\.bzr/
-\\\\.bzr-mysql
-\\\\.bzrignore
CMakeCache\\\\.txt
cmake_dist\\\\.cmake
CPackSourceConfig\\\\.cmake
diff --git a/cmake/do_abi_check.cmake b/cmake/do_abi_check.cmake
index c831aaf8b52..c0ffce353f3 100644
--- a/cmake/do_abi_check.cmake
+++ b/cmake/do_abi_check.cmake
@@ -58,7 +58,7 @@ FOREACH(file ${ABI_HEADERS})
EXECUTE_PROCESS(
COMMAND ${COMPILER}
- -E -nostdinc -dI -DMYSQL_ABI_CHECK -I${SOURCE_DIR}/include
+ -E -nostdinc -DMYSQL_ABI_CHECK -I${SOURCE_DIR}/include
-I${BINARY_DIR}/include -I${SOURCE_DIR}/include/mysql -I${SOURCE_DIR}/sql
${file}
ERROR_QUIET OUTPUT_FILE ${tmpfile})
diff --git a/cmake/info_macros.cmake.in b/cmake/info_macros.cmake.in
index 9f40a419c61..fc2f8849337 100644
--- a/cmake/info_macros.cmake.in
+++ b/cmake/info_macros.cmake.in
@@ -1,4 +1,4 @@
-# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 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
@@ -23,11 +23,14 @@
# If further variables are used in this file, add them to this list.
SET(VERSION "@VERSION@")
+SET(MAJOR_VERSION "@MAJOR_VERSION@")
+SET(MINOR_VERSION "@MINOR_VERSION@")
+SET(PATCH_VERSION "@PATCH_VERSION@")
SET(CMAKE_SOURCE_DIR "@CMAKE_SOURCE_DIR@")
SET(CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@")
SET(CMAKE_GENERATOR "@CMAKE_GENERATOR@")
SET(CMAKE_SIZEOF_VOID_P "@CMAKE_SIZEOF_VOID_P@")
-SET(BZR_EXECUTABLE "@BZR_EXECUTABLE@")
+SET(GIT_EXECUTABLE "@GIT_EXECUTABLE@")
SET(CMAKE_CROSSCOMPILING "@CMAKE_CROSSCOMPILING@")
SET(CMAKE_HOST_SYSTEM "@CMAKE_HOST_SYSTEM@")
SET(CMAKE_HOST_SYSTEM_PROCESSOR "@CMAKE_HOST_SYSTEM_PROCESSOR@")
@@ -36,27 +39,51 @@ SET(CMAKE_SYSTEM_PROCESSOR "@CMAKE_SYSTEM_PROCESSOR@")
# Create an "INFO_SRC" file with information about the source (only).
-# We use "bzr version-info", if possible, and the "VERSION" contents.
+# We use "git log", if possible, and the "VERSION" contents.
#
-# Outside development (BZR tree), the "INFO_SRC" file will not be modified
+# Outside development (git tree), the "INFO_SRC" file will not be modified
# provided it exists (from "make dist" or a source tarball creation).
MACRO(CREATE_INFO_SRC target_dir)
SET(INFO_SRC "${target_dir}/INFO_SRC")
- IF(EXISTS ${CMAKE_SOURCE_DIR}/.bzr)
- # Sources are in a BZR repository: Always update.
+ SET(PERLSCRIPT
+ "use warnings; use POSIX qw(strftime); "
+ "print strftime \"%F %T %z\", localtime;")
+ EXECUTE_PROCESS(
+ COMMAND perl -e "${PERLSCRIPT}"
+ RESULT_VARIABLE result
+ OUTPUT_VARIABLE bdate
+ ERROR_VARIABLE error
+ )
+ IF(error)
+ MESSAGE(STATUS "Could not determine build-date: <${error}>")
+ ENDIF()
+
+ IF(GIT_EXECUTABLE AND EXISTS ${CMAKE_SOURCE_DIR}/.git)
+ # Sources are in a GIT repository: Always update.
+ EXECUTE_PROCESS(
+ COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ OUTPUT_VARIABLE bname
+ )
+
EXECUTE_PROCESS(
- COMMAND ${BZR_EXECUTABLE} version-info ${CMAKE_SOURCE_DIR}
+ COMMAND ${GIT_EXECUTABLE} log -1
+ --pretty="commit: %H%ndate: %ci%nbuild-date: ${bdate} %nshort: %h%nbranch: ${bname}"
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE VERSION_INFO
- RESULT_VARIABLE RESULT
)
+
+ ## Output from git is quoted with "", remove them.
+ STRING(REPLACE "\"" "" VERSION_INFO "${VERSION_INFO}")
FILE(WRITE ${INFO_SRC} "${VERSION_INFO}\n")
# to debug, add: FILE(APPEND ${INFO_SRC} "\nResult ${RESULT}\n")
# For better readability ...
- FILE(APPEND ${INFO_SRC} "\nMySQL source ${VERSION}\n")
+ FILE(APPEND ${INFO_SRC}
+ "MySQL source ${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}\n")
ELSEIF(EXISTS ${INFO_SRC})
- # Outside a BZR tree, there is no need to change an existing "INFO_SRC",
+ # Outside a git tree, there is no need to change an existing "INFO_SRC",
# it cannot be improved.
ELSEIF(EXISTS ${CMAKE_SOURCE_DIR}/Docs/INFO_SRC)
# If we are building from a source distribution, it also contains "INFO_SRC".
diff --git a/cmake/info_src.cmake b/cmake/info_src.cmake
index 97776b70901..ce9873cc9d0 100644
--- a/cmake/info_src.cmake
+++ b/cmake/info_src.cmake
@@ -1,4 +1,4 @@
-# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 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,11 +16,11 @@
# The sole purpose of this cmake control file is to create the "INFO_SRC" file.
-# As long as and "bzr pull" (or "bzr commit") is followed by a "cmake",
+# As long as and "git pull" (or "git commit") is followed by a "cmake",
# the call in top level "CMakeLists.txt" is sufficient.
# This file is to provide a separate target for the "make" phase,
-# to ensure the BZR revision-id is correct even after a sequence
-# cmake ; make ; bzr pull ; make
+# to ensure the git commit hash is correct even after a sequence
+# cmake ; make ; git pull ; make
# Get the macros which handle the "INFO_*" files.
diff --git a/cmake/libutils.cmake b/cmake/libutils.cmake
index 8fcfe294f17..636737b2083 100644
--- a/cmake/libutils.cmake
+++ b/cmake/libutils.cmake
@@ -308,17 +308,15 @@ INCLUDE(CheckCCompilerFlag)
SET(VISIBILITY_HIDDEN_FLAG)
-IF(CMAKE_COMPILER_IS_GNUCXX AND UNIX)
+IF(CMAKE_C_COMPILER_ID MATCHES "SunPro")
+ SET(VISIBILITY_HIDDEN_FLAG "-xldscope=hidden")
+ELSEIF(UNIX)
CHECK_C_COMPILER_FLAG("-fvisibility=hidden" HAVE_VISIBILITY_HIDDEN)
IF(HAVE_VISIBILITY_HIDDEN)
SET(VISIBILITY_HIDDEN_FLAG "-fvisibility=hidden")
ENDIF()
ENDIF()
-IF(CMAKE_C_COMPILER_ID MATCHES "SunPro")
- SET(VISIBILITY_HIDDEN_FLAG "-xldscope=hidden")
-ENDIF()
-
# We try to hide the symbols in yassl/zlib to avoid name clashes with
# other libraries like openssl.
FUNCTION(RESTRICT_SYMBOL_EXPORTS target)
diff --git a/cmake/maintainer.cmake b/cmake/maintainer.cmake
index 872d61d9aac..4fe2546d709 100644
--- a/cmake/maintainer.cmake
+++ b/cmake/maintainer.cmake
@@ -35,17 +35,17 @@ IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
ENDIF()
# Turn on Werror (warning => error) when using maintainer mode.
-IF(MYSQL_MAINTAINER_MODE MATCHES "ON")
+IF(MYSQL_MAINTAINER_MODE MATCHES "ERR")
SET(MY_C_WARNING_FLAGS "${MY_C_WARNING_FLAGS} -DFORCE_INIT_OF_VARS -Werror")
SET(MY_CXX_WARNING_FLAGS "${MY_CXX_WARNING_FLAGS} -DFORCE_INIT_OF_VARS -Werror")
ENDIF()
# Set warning flags for GCC/Clang
-IF(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
+IF(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang")
SET(MY_MAINTAINER_C_WARNINGS "${MY_C_WARNING_FLAGS}")
ENDIF()
# Set warning flags for G++/Clang++
-IF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
SET(MY_MAINTAINER_CXX_WARNINGS "${MY_CXX_WARNING_FLAGS}")
ENDIF()
diff --git a/cmake/make_dist.cmake.in b/cmake/make_dist.cmake.in
index ada27c36926..f35d16834b6 100644
--- a/cmake/make_dist.cmake.in
+++ b/cmake/make_dist.cmake.in
@@ -1,4 +1,4 @@
-# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2015, 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
@@ -22,13 +22,12 @@ SET(CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@")
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "@CPACK_SOURCE_PACKAGE_FILE_NAME@")
SET(CMAKE_CPACK_COMMAND "@CMAKE_CPACK_COMMAND@")
SET(CMAKE_COMMAND "@CMAKE_COMMAND@")
-SET(BZR_EXECUTABLE "@BZR_EXECUTABLE@")
+SET(GIT_EXECUTABLE "@GIT_EXECUTABLE@")
SET(GTAR_EXECUTABLE "@GTAR_EXECUTABLE@")
SET(TAR_EXECUTABLE "@TAR_EXECUTABLE@")
SET(CMAKE_GENERATOR "@CMAKE_GENERATOR@")
SET(CMAKE_MAKE_PROGRAM "@CMAKE_MAKE_PROGRAM@")
SET(CMAKE_SYSTEM_NAME "@CMAKE_SYSTEM_NAME@")
-SET(PLUGIN_REPOS "@PLUGIN_REPOS@")
SET(VERSION "@VERSION@")
@@ -40,47 +39,30 @@ SET(PACKAGE_DIR ${CMAKE_BINARY_DIR}/${CPACK_SOURCE_PACKAGE_FILE_NAME})
FILE(REMOVE_RECURSE ${PACKAGE_DIR})
FILE(REMOVE ${PACKAGE_DIR}.tar.gz )
-IF(BZR_EXECUTABLE)
- MESSAGE(STATUS "Running bzr export")
+IF(GIT_EXECUTABLE)
+ MESSAGE(STATUS "Running git checkout-index")
EXECUTE_PROCESS(
- COMMAND "${BZR_EXECUTABLE}" export
- ${PACKAGE_DIR}
+ COMMAND "${GIT_EXECUTABLE}" checkout-index --all --prefix=${PACKAGE_DIR}/
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE RESULT
)
IF(NOT RESULT EQUAL 0)
- SET(BZR_EXECUTABLE)
+ SET(GIT_EXECUTABLE)
ENDIF()
ENDIF()
-IF(BZR_EXECUTABLE)
- FOREACH(REPO ${PLUGIN_REPOS})
- GET_FILENAME_COMPONENT(PLUGIN_NAME ${REPO} NAME)
- SET(DEST ${PACKAGE_DIR}/plugin/${PLUGIN_NAME})
- MESSAGE(STATUS "Running bzr export for plugin/${PLUGIN_NAME}")
- EXECUTE_PROCESS(
- COMMAND "${BZR_EXECUTABLE}" export ${DEST}
- WORKING_DIRECTORY ${REPO}
- RESULT_VARIABLE RESULT
- )
- IF(NOT RESULT EQUAL 0)
- MESSAGE(STATUS "bzr export failed")
- ENDIF()
- ENDFOREACH()
-ENDIF()
-
-IF(NOT BZR_EXECUTABLE)
- MESSAGE(STATUS "bzr not found or source dir is not a repo, use CPack")
+IF(NOT GIT_EXECUTABLE)
+ MESSAGE(STATUS "git not found or source dir is not a repo, use CPack")
IF(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
# In-source build is the worst option, we have to cleanup source tree.
# Save bison output first.
CONFIGURE_FILE(${CMAKE_BINARY_DIR}/sql/sql_yacc.cc
- ${CMAKE_BINARY_DIR}/sql_yacc.cc COPY_ONLY)
+ ${CMAKE_BINARY_DIR}/sql_yacc.cc COPYONLY)
CONFIGURE_FILE(${CMAKE_BINARY_DIR}/sql/sql_yacc.h
- ${CMAKE_BINARY_DIR}/sql_yacc.h COPY_ONLY)
+ ${CMAKE_BINARY_DIR}/sql_yacc.h COPYONLY)
IF(CMAKE_GENERATOR MATCHES "Makefiles")
# make clean
@@ -92,9 +74,9 @@ IF(NOT BZR_EXECUTABLE)
# Restore bison output
CONFIGURE_FILE(${CMAKE_BINARY_DIR}/sql_yacc.cc
- ${CMAKE_BINARY_DIR}/sql/sql_yacc.cc COPY_ONLY)
+ ${CMAKE_BINARY_DIR}/sql/sql_yacc.cc COPYONLY)
CONFIGURE_FILE(${CMAKE_BINARY_DIR}/sql_yacc.h
- ${CMAKE_BINARY_DIR}/sql/sql_yacc.h COPY_ONLY)
+ ${CMAKE_BINARY_DIR}/sql/sql_yacc.h COPYONLY)
FILE(REMOVE ${CMAKE_BINARY_DIR}/sql_yacc.cc)
FILE(REMOVE ${CMAKE_BINARY_DIR}/sql_yacc.h)
ENDIF()
@@ -119,15 +101,6 @@ CONFIGURE_FILE(${CMAKE_BINARY_DIR}/sql/sql_yacc.h
CONFIGURE_FILE(${CMAKE_BINARY_DIR}/sql/sql_yacc.cc
${PACKAGE_DIR}/sql/sql_yacc.cc COPYONLY)
-# Copy spec files
-SET(SPECFILENAME "mysql.${VERSION}.spec")
-IF("${VERSION}" MATCHES "-ndb-")
- STRING(REGEX REPLACE "^.*-ndb-" "" NDBVERSION "${VERSION}")
- SET(SPECFILENAME "mysql-cluster-${NDBVERSION}.spec")
-ENDIF()
-CONFIGURE_FILE(${CMAKE_BINARY_DIR}/support-files/${SPECFILENAME}
- ${PACKAGE_DIR}/support-files/${SPECFILENAME} COPYONLY)
-
# Add documentation, if user has specified where to find them
IF(MYSQL_DOCS_LOCATION)
MESSAGE("Copying documentation files from " ${MYSQL_DOCS_LOCATION})
diff --git a/cmake/os/WindowsCache.cmake b/cmake/os/WindowsCache.cmake
index c75f2e45bf6..b805ec4fb43 100644
--- a/cmake/os/WindowsCache.cmake
+++ b/cmake/os/WindowsCache.cmake
@@ -351,7 +351,6 @@ SET(C_HAS___inline 1 CACHE INTERNAL "")
SET(FIONREAD_IN_SYS_IOCTL CACHE INTERNAL "")
SET(FIONREAD_IN_SYS_FILIO CACHE INTERNAL "")
SET(GWINSZ_IN_SYS_IOCTL CACHE INTERNAL "")
-SET(HAVE_CXXABI_H CACHE INTERNAL "")
SET(HAVE_NDIR_H CACHE INTERNAL "")
SET(HAVE_SYS_NDIR_H CACHE INTERNAL "")
SET(HAVE_SYS_NDIR_H CACHE INTERNAL "")
@@ -371,4 +370,8 @@ SET(HAVE_PTHREAD_ATTR_GETGUARDSIZE CACHE INTERNAL "")
SET(HAVE_UCONTEXT_H CACHE INTERNAL "")
SET(HAVE_SOCKPEERCRED CACHE INTERNAL "")
SET(HAVE_GGDB3 CACHE INTERNAL "")
+SET(HAVE_ABI_CXA_DEMANGLE CACHE INTERNAL "")
+SET(HAVE_GCC_ATOMIC_BUILTINS CACHE INTERNAL "")
+SET(HAVE_GCC_C11_ATOMICS CACHE INTERNAL "")
+SET(HAVE_VISIBILITY_HIDDEN CACHE INTERNAL "")
ENDIF(MSVC)
diff --git a/cmake/plugin.cmake b/cmake/plugin.cmake
index 504e34414db..c1f6b8a0ea1 100644
--- a/cmake/plugin.cmake
+++ b/cmake/plugin.cmake
@@ -245,11 +245,4 @@ MACRO(CONFIGURE_PLUGINS)
ADD_SUBDIRECTORY(${dir})
ENDIF()
ENDFOREACH()
- FOREACH(dir ${dirs_plugin})
- IF (EXISTS ${dir}/.bzr)
- MESSAGE(STATUS "Found repo ${dir}/.bzr")
- LIST(APPEND PLUGIN_BZR_REPOS "${dir}")
- ENDIF()
- ENDFOREACH()
- SET(PLUGIN_REPOS "${PLUGIN_BZR_REPOS}" CACHE INTERNAL "")
ENDMACRO()
diff --git a/cmake/ssl.cmake b/cmake/ssl.cmake
index 2a8d1f17fbc..26df7a47e0a 100644
--- a/cmake/ssl.cmake
+++ b/cmake/ssl.cmake
@@ -156,37 +156,37 @@ MACRO (MYSQL_CHECK_SSL)
LIST(REVERSE CMAKE_FIND_LIBRARY_SUFFIXES)
ENDIF()
- # Verify version number. Version information looks like:
- # #define OPENSSL_VERSION_NUMBER 0x1000103fL
- # Encoded as MNNFFPPS: major minor fix patch status
- FILE(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h"
- OPENSSL_VERSION_NUMBER
- REGEX "^#define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x[0-9].*"
- )
- STRING(REGEX REPLACE
- "^.*OPENSSL_VERSION_NUMBER[\t ]+0x([0-9]).*$" "\\1"
- OPENSSL_MAJOR_VERSION "${OPENSSL_VERSION_NUMBER}"
- )
-
IF(OPENSSL_INCLUDE_DIR AND
OPENSSL_LIBRARIES AND
CRYPTO_LIBRARY
)
+ # Verify version number. Version information looks like:
+ # #define OPENSSL_VERSION_NUMBER 0x1000103fL
+ # Encoded as MNNFFPPS: major minor fix patch status
+ FILE(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h"
+ OPENSSL_VERSION_NUMBER
+ REGEX "^#define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x[0-9].*"
+ )
+ STRING(REGEX REPLACE
+ "^.*OPENSSL_VERSION_NUMBER[\t ]+0x([0-9]).*$" "\\1"
+ OPENSSL_MAJOR_VERSION "${OPENSSL_VERSION_NUMBER}"
+ )
+ INCLUDE(CheckSymbolExists)
+ SET(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
+ CHECK_SYMBOL_EXISTS(SHA512_DIGEST_LENGTH "openssl/sha.h"
+ HAVE_SHA512_DIGEST_LENGTH)
SET(OPENSSL_FOUND TRUE)
ELSE()
SET(OPENSSL_FOUND FALSE)
ENDIF()
- MESSAGE(STATUS "OPENSSL_INCLUDE_DIR = ${OPENSSL_INCLUDE_DIR}")
- MESSAGE(STATUS "OPENSSL_LIBRARIES = ${OPENSSL_LIBRARIES}")
- MESSAGE(STATUS "CRYPTO_LIBRARY = ${CRYPTO_LIBRARY}")
- MESSAGE(STATUS "OPENSSL_MAJOR_VERSION = ${OPENSSL_MAJOR_VERSION}")
-
- INCLUDE(CheckSymbolExists)
- SET(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
- CHECK_SYMBOL_EXISTS(SHA512_DIGEST_LENGTH "openssl/sha.h"
- HAVE_SHA512_DIGEST_LENGTH)
IF(OPENSSL_FOUND AND HAVE_SHA512_DIGEST_LENGTH)
+ MESSAGE(STATUS "OPENSSL_INCLUDE_DIR = ${OPENSSL_INCLUDE_DIR}")
+ MESSAGE(STATUS "OPENSSL_LIBRARIES = ${OPENSSL_LIBRARIES}")
+ MESSAGE(STATUS "CRYPTO_LIBRARY = ${CRYPTO_LIBRARY}")
+ MESSAGE(STATUS "OPENSSL_MAJOR_VERSION = ${OPENSSL_MAJOR_VERSION}")
+
+
SET(SSL_SOURCES "")
SET(SSL_LIBRARIES ${OPENSSL_LIBRARIES} ${CRYPTO_LIBRARY})
IF(CMAKE_SYSTEM_NAME MATCHES "SunOS")
diff --git a/cmd-line-utils/libedit/el_terminal.h b/cmd-line-utils/libedit/el_terminal.h
index 807c651783e..db0bb94fa93 100644
--- a/cmd-line-utils/libedit/el_terminal.h
+++ b/cmd-line-utils/libedit/el_terminal.h
@@ -1,7 +1,7 @@
/* $NetBSD: terminal.h,v 1.3 2011/07/29 23:44:45 christos Exp $ */
/*-
- * Copyright (c) 1992, 1993
+ * Copyright (c) 1992, 2015
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
@@ -103,7 +103,7 @@ protected int terminal_settc(EditLine *, int, const Char **);
protected int terminal_gettc(EditLine *, int, char **);
protected int terminal_telltc(EditLine *, int, const Char **);
protected int terminal_echotc(EditLine *, int, const Char **);
-protected void terminal_writec(EditLine *, Int);
+protected int terminal_writec(EditLine *, Int);
protected int terminal__putc(EditLine *, Int);
protected void terminal__flush(EditLine *);
diff --git a/cmd-line-utils/libedit/emacs.c b/cmd-line-utils/libedit/emacs.c
index 554d3970485..1f1033a1cb7 100644
--- a/cmd-line-utils/libedit/emacs.c
+++ b/cmd-line-utils/libedit/emacs.c
@@ -1,7 +1,7 @@
/* $NetBSD: emacs.c,v 1.25 2011/07/29 15:16:33 christos Exp $ */
/*-
- * Copyright (c) 1992, 1993
+ * Copyright (c) 1992, 2015
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
@@ -58,8 +58,10 @@ em_delete_or_list(EditLine *el, Int c)
/* if I'm at the end */
if (el->el_line.cursor == el->el_line.buffer) {
/* and the beginning */
- terminal_writec(el, c); /* then do an EOF */
- return CC_EOF;
+ if(!(terminal_writec(el, c))) /* then do an EOF */
+ return CC_EOF;
+ else
+ return CC_ERROR;
} else {
/*
* Here we could list completions, but it is an
diff --git a/cmd-line-utils/libedit/terminal.c b/cmd-line-utils/libedit/terminal.c
index fb5600a4140..18b789a8bea 100644
--- a/cmd-line-utils/libedit/terminal.c
+++ b/cmd-line-utils/libedit/terminal.c
@@ -1,7 +1,7 @@
/* $NetBSD: terminal.c,v 1.10 2011/10/04 15:27:04 christos Exp $ */
/*-
- * Copyright (c) 1992, 1993
+ * Copyright (c) 1992, 2015
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
@@ -1271,14 +1271,19 @@ terminal__flush(EditLine *el)
/* terminal_writec():
* Write the given character out, in a human readable form
*/
-protected void
+protected int
terminal_writec(EditLine *el, Int c)
{
Char visbuf[VISUAL_WIDTH_MAX +1];
ssize_t vcnt = ct_visual_char(visbuf, VISUAL_WIDTH_MAX, c);
- visbuf[vcnt] = '\0';
- terminal_overwrite(el, visbuf, (size_t)vcnt);
- terminal__flush(el);
+ if(vcnt == -1)
+ return 1; /* Error due to insufficient space */
+ else {
+ visbuf[vcnt] = '\0';
+ terminal_overwrite(el, visbuf, (size_t)vcnt);
+ terminal__flush(el);
+ return 0;
+ }
}
diff --git a/cmd-line-utils/libedit/vi.c b/cmd-line-utils/libedit/vi.c
index 9a4b97a977e..41242030a98 100644
--- a/cmd-line-utils/libedit/vi.c
+++ b/cmd-line-utils/libedit/vi.c
@@ -1,7 +1,7 @@
/* $NetBSD: vi.c,v 1.41 2011/10/04 15:27:04 christos Exp $ */
/*-
- * Copyright (c) 1992, 1993
+ * Copyright (c) 1992, 2015
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
@@ -607,8 +607,10 @@ vi_list_or_eof(EditLine *el, Int c)
if (el->el_line.cursor == el->el_line.lastchar) {
if (el->el_line.cursor == el->el_line.buffer) {
- terminal_writec(el, c); /* then do a EOF */
- return CC_EOF;
+ if(!(terminal_writec(el, c))) /* then do a EOF */
+ return CC_EOF;
+ else
+ return CC_ERROR;
} else {
/*
* Here we could list completions, but it is an
diff --git a/config.h.cmake b/config.h.cmake
index 09373f6a67f..a90e636aa9c 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -27,7 +27,6 @@
#cmakedefine HAVE_BSEARCH 1
#cmakedefine HAVE_CRYPT_H 1
#cmakedefine HAVE_CURSES_H 1
-#cmakedefine HAVE_CXXABI_H 1
#cmakedefine HAVE_BFD_H 1
#cmakedefine HAVE_NCURSES_H 1
#cmakedefine HAVE_NDIR_H 1
@@ -203,7 +202,7 @@
#cmakedefine HAVE_MADVISE 1
#cmakedefine HAVE_DECL_MADVISE 1
#cmakedefine HAVE_DECL_TGOTO 1
-#cmakedefine HAVE_DECL_MHA_MAPSIZE_VA
+#cmakedefine HAVE_DECL_MHA_MAPSIZE_VA 1
#cmakedefine HAVE_MALLINFO 1
#cmakedefine HAVE_MEMCPY 1
#cmakedefine HAVE_MEMMOVE 1
@@ -398,7 +397,7 @@
#cmakedefine SOCKET_SIZE_TYPE @SOCKET_SIZE_TYPE@
-#cmakedefine HAVE_MBSTATE_T
+#cmakedefine HAVE_MBSTATE_T 1
#define MAX_INDEXES 64
@@ -433,15 +432,15 @@
#cmakedefine HAVE_WCTYPE_H 1
#cmakedefine HAVE_WCHAR_H 1
#cmakedefine HAVE_LANGINFO_H 1
-#cmakedefine HAVE_MBRLEN
-#cmakedefine HAVE_MBSCMP
-#cmakedefine HAVE_MBSRTOWCS
-#cmakedefine HAVE_WCRTOMB
-#cmakedefine HAVE_MBRTOWC
-#cmakedefine HAVE_WCSCOLL
-#cmakedefine HAVE_WCSDUP
-#cmakedefine HAVE_WCWIDTH
-#cmakedefine HAVE_WCTYPE
+#cmakedefine HAVE_MBRLEN 1
+#cmakedefine HAVE_MBSCMP 1
+#cmakedefine HAVE_MBSRTOWCS 1
+#cmakedefine HAVE_WCRTOMB 1
+#cmakedefine HAVE_MBRTOWC 1
+#cmakedefine HAVE_WCSCOLL 1
+#cmakedefine HAVE_WCSDUP 1
+#cmakedefine HAVE_WCWIDTH 1
+#cmakedefine HAVE_WCTYPE 1
#cmakedefine HAVE_ISWLOWER 1
#cmakedefine HAVE_ISWUPPER 1
#cmakedefine HAVE_TOWLOWER 1
@@ -455,7 +454,7 @@
#cmakedefine HAVE_STRCASECMP 1
#cmakedefine HAVE_STRNCASECMP 1
#cmakedefine HAVE_STRDUP 1
-#cmakedefine HAVE_LANGINFO_CODESET
+#cmakedefine HAVE_LANGINFO_CODESET 1
#cmakedefine HAVE_TCGETATTR 1
#cmakedefine HAVE_FLOCKFILE 1
@@ -474,6 +473,7 @@
#cmakedefine MY_ATOMIC_MODE_DUMMY 1
#cmakedefine MY_ATOMIC_MODE_RWLOCKS 1
#cmakedefine HAVE_GCC_ATOMIC_BUILTINS 1
+#cmakedefine HAVE_GCC_C11_ATOMICS 1
#cmakedefine HAVE_SOLARIS_ATOMIC 1
#cmakedefine HAVE_DECL_SHM_HUGETLB 1
#cmakedefine HAVE_LARGE_PAGES 1
diff --git a/configure.cmake b/configure.cmake
index d7129337044..cbcb26001cb 100644
--- a/configure.cmake
+++ b/configure.cmake
@@ -52,7 +52,7 @@ IF(NOT SYSTEM_TYPE)
ENDIF()
ENDIF()
-IF(CMAKE_COMPILER_IS_GNUCXX)
+IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
# MySQL "canonical" GCC flags. At least -fno-rtti flag affects
# ABI and cannot be simply removed.
SET(CMAKE_CXX_FLAGS
@@ -175,7 +175,6 @@ CHECK_INCLUDE_FILES (alloca.h HAVE_ALLOCA_H)
CHECK_INCLUDE_FILES (aio.h HAVE_AIO_H)
CHECK_INCLUDE_FILES (arpa/inet.h HAVE_ARPA_INET_H)
CHECK_INCLUDE_FILES (crypt.h HAVE_CRYPT_H)
-CHECK_INCLUDE_FILE_CXX (cxxabi.h HAVE_CXXABI_H)
CHECK_INCLUDE_FILES (bfd.h BFD_H_EXISTS)
CHECK_INCLUDE_FILES (dirent.h HAVE_DIRENT_H)
CHECK_INCLUDE_FILES (dlfcn.h HAVE_DLFCN_H)
@@ -877,7 +876,7 @@ ENDIF(NOT HAVE_POSIX_SIGNALS)
# Assume regular sprintf
SET(SPRINTFS_RETURNS_INT 1)
-IF(CMAKE_COMPILER_IS_GNUCXX AND HAVE_CXXABI_H)
+IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
CHECK_CXX_SOURCE_COMPILES("
#include <cxxabi.h>
int main(int argc, char **argv)
@@ -949,7 +948,6 @@ SET(SIGNAL_WITH_VIO_CLOSE 1)
MARK_AS_ADVANCED(NO_ALARM)
-IF(CMAKE_COMPILER_IS_GNUCXX)
IF(WITH_ATOMIC_OPS STREQUAL "up")
SET(MY_ATOMIC_MODE_DUMMY 1 CACHE BOOL "Assume single-CPU mode, no concurrency")
ELSEIF(WITH_ATOMIC_OPS STREQUAL "rwlocks")
@@ -980,10 +978,17 @@ ELSEIF(NOT WITH_ATOMIC_OPS)
return 0;
}"
HAVE_GCC_ATOMIC_BUILTINS)
+ CHECK_CXX_SOURCE_COMPILES("
+ int main()
+ {
+ long long int var= 1;
+ long long int *ptr= &var;
+ return (int)__atomic_load_n(ptr, __ATOMIC_SEQ_CST);
+ }"
+ HAVE_GCC_C11_ATOMICS)
ELSE()
MESSAGE(FATAL_ERROR "${WITH_ATOMIC_OPS} is not a valid value for WITH_ATOMIC_OPS!")
ENDIF()
-ENDIF()
SET(WITH_ATOMIC_OPS "${WITH_ATOMIC_OPS}" CACHE STRING
"Implement atomic operations using pthread rwlocks (rwlocks); or atomic CPU
diff --git a/debian/dist/Debian/control b/debian/dist/Debian/control
index ffede25ccc4..b3027b3f463 100644
--- a/debian/dist/Debian/control
+++ b/debian/dist/Debian/control
@@ -4,7 +4,12 @@ Priority: optional
Maintainer: MariaDB Developers <maria-developers@lists.launchpad.net>
XSBC-Original-Maintainer: Maria Developers <maria-developers@lists.launchpad.net>
Uploaders: MariaDB Developers <maria-developers@lists.launchpad.net>
-Build-Depends: libtool (>= 1.4.2-7), procps | hurd, debhelper, file (>= 3.28), libncurses5-dev (>= 5.0-6), perl (>= 5.6.0), libwrap0-dev (>= 7.6-8.3), zlib1g-dev (>= 1:1.1.3-5), ${LIBREADLINE_DEV}, libssl-dev, libpam0g-dev, psmisc, po-debconf, chrpath, automake1.9, doxygen, texlive-latex-base, ghostscript | gs-gpl, dpatch, gawk, bison, lsb-release, hardening-wrapper, ${CMAKE_DEP}libaio-dev, libjemalloc-dev (>= 3.0.0)
+Build-Depends: procps | hurd, debhelper, libncurses5-dev (>= 5.0-6),
+ perl (>= 5.6.0), libwrap0-dev (>= 7.6-8.3),
+ zlib1g-dev (>= 1:1.1.3-5), ${LIBREADLINE_DEV},
+ libssl-dev, libpam0g-dev, psmisc, po-debconf, chrpath,
+ dpatch, gawk, bison, lsb-release, hardening-wrapper,
+ ${CMAKE_DEP}libaio-dev, libjemalloc-dev (>= 3.0.0)
Standards-Version: 3.8.3
Homepage: http://mariadb.org/
Vcs-Browser: http://bazaar.launchpad.net/~maria-captains/maria/10.0/files
@@ -16,7 +21,9 @@ Architecture: any
Depends: mariadb-common, libmysqlclient18 (= ${source:Version}), ${shlibs:Depends}, ${misc:Depends}
Conflicts: mariadb-server-10.0 (<< 10.0.5), mariadb-galera-server-10.0 (<< 10.0.5),
mariadb-server-5.5 (<< 5.5.33), mariadb-galera-server-5.5 (<< 5.5.33),
- mariadb-server-5.1, mariadb-server-5.2, mariadb-server-5.3
+ mariadb-server-5.1,
+ mariadb-server-5.2,
+ mariadb-server-5.3
Description: MariaDB database client library
MariaDB is a fast, stable and true multi-user, multi-threaded SQL database
server. SQL (Structured Query Language) is the most popular database query
@@ -105,13 +112,15 @@ Conflicts: mysql-client (<< 5.0.51), mysql-client-5.0,
mysql-client-core-5.1, mysql-client-core-5.5,
mariadb-client-5.1, mariadb-client-core-5.1,
mariadb-client-5.2, mariadb-client-core-5.2,
- mariadb-client-5.3, mariadb-client-core-5.3
+ mariadb-client-5.3, mariadb-client-core-5.3,
+ mariadb-client-5.5, mariadb-client-core-5.5
Replaces: mysql-client (<< 5.0.51), mysql-client-5.0,
mysql-client-5.1, mysql-client-5.5,
mysql-client-core-5.1, mysql-client-core-5.5,
mariadb-client-5.1, mariadb-client-core-5.1,
mariadb-client-5.2, mariadb-client-core-5.2,
- mariadb-client-5.3, mariadb-client-core-5.3
+ mariadb-client-5.3, mariadb-client-core-5.3,
+ mariadb-client-5.5, mariadb-client-core-5.5
Description: MariaDB database core client binaries
MariaDB is a fast, stable and true multi-user, multi-threaded SQL database
server. SQL (Structured Query Language) is the most popular database query
@@ -131,11 +140,16 @@ Provides: virtual-mysql-client, mysql-client,
mysql-client-4.1, mysql-client-5.1, mysql-client-5.5
Conflicts: mysql-client (<< 5.0.51), mysql-client-5.0, mysql-client-5.1,
mariadb-client (<< ${source:Version}),
- mariadb-client-5.1, mariadb-client-5.2, mariadb-client-5.3, mysql-client-5.5
+ mariadb-client-5.1,
+ mariadb-client-5.2,
+ mariadb-client-5.3,
+ mariadb-client-5.5, mysql-client-5.5
Replaces: mysql-client (<< 5.0.51), mysql-client-5.0, mysql-client-5.1,
- mysql-client-5.5,
mariadb-client (<< ${source:Version}),
- mariadb-client-5.1, mariadb-client-5.2, mariadb-client-5.3
+ mariadb-client-5.1,
+ mariadb-client-5.2,
+ mariadb-client-5.3,
+ mariadb-client-5.5, mysql-client-5.5
Description: MariaDB database client binaries
MariaDB is a fast, stable and true multi-user, multi-threaded SQL database
server. SQL (Structured Query Language) is the most popular database query
@@ -149,18 +163,16 @@ Package: mariadb-server-core-10.0
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, libmariadbclient18 (>= ${binary:Version})
Provides: mysql-server-core, mysql-server-core-5.1, mysql-server-core-5.5
-Conflicts: mariadb-server-5.1 (<< 5.1.60),
- mariadb-server-5.2 (<< 5.2.10),
- mariadb-server-5.3 (<< 5.3.3),
- mysql-server-5.0,
- mysql-server-core-5.0, mysql-server-core-5.1, mysql-server-core-5.5,
- mariadb-server-core-5.1, mariadb-server-core-5.2, mariadb-server-core-5.5
-Replaces: mariadb-server-5.1 (<< 5.1.60),
- mariadb-server-5.2 (<< 5.2.10),
- mariadb-server-5.3 (<< 5.3.3),
- mysql-server-5.0,
- mysql-server-core-5.0, mysql-server-core-5.1, mysql-server-core-5.5,
- mariadb-server-core-5.1, mariadb-server-core-5.2, mariadb-server-core-5.5
+Conflicts: mysql-server-5.0, mysql-server-core-5.0,
+ mariadb-server-core-5.1, mysql-server-core-5.1,
+ mariadb-server-core-5.2,
+ mariadb-server-core-5.3,
+ mariadb-server-core-5.5, mysql-server-core-5.5
+Replaces: mysql-server-5.0, mysql-server-core-5.0,
+ mariadb-server-core-5.1, mysql-server-core-5.1,
+ mariadb-server-core-5.2,
+ mariadb-server-core-5.3,
+ mariadb-server-core-5.5, mysql-server-core-5.5
Description: MariaDB database core server files
MariaDB is a fast, stable and true multi-user, multi-threaded SQL database
server. SQL (Structured Query Language) is the most popular database query
@@ -173,10 +185,10 @@ Package: mariadb-test-10.0
Section: database
Architecture: any
Depends: mariadb-server-10.0 (= ${source:Version}), mariadb-client-10.0 (= ${source:Version})
+Suggests: patch
Conflicts: mariadb-test (<< ${source:Version}),
mariadb-test-5.1, mariadb-test-5.2, mariadb-test-5.3,
mariadb-server-5.5 (<< 5.5.33), mariadb-galera-server-5.5 (<< 5.5.33)
-Suggests: patch
Replaces: mariadb-test (<< ${source:Version}),
mariadb-test-5.1, mariadb-test-5.2, mariadb-test-5.3
Description: MariaDB database regression test suite
@@ -198,12 +210,18 @@ Depends: mariadb-client-10.0 (>= ${source:Version}), libdbi-perl,
mariadb-server-core-10.0 (>= ${binary:Version})
Provides: mariadb-server, mysql-server, virtual-mysql-server
Conflicts: mariadb-server (<< ${source:Version}), mysql-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,
+ mysql-server-4.1, mysql-server-5.0,
+ mariadb-server-5.1, mysql-server-5.1,
+ mariadb-server-5.2,
+ mariadb-server-5.3,
+ mariadb-server-5.5, mysql-server-5.5,
mariadb-tokudb-engine-5.5, mariadb-tokudb-engine-10.0
Replaces: mariadb-server (<< ${source:Version}), mysql-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,
+ mysql-server-4.1, mysql-server-5.0,
+ mariadb-server-5.1, mysql-server-5.1,
+ mariadb-server-5.2,
+ mariadb-server-5.3,
+ mariadb-server-5.5, mysql-server-5.5,
libmariadbclient16 (<< 5.3.4), libmariadbclient-dev (<< 5.5.0),
mariadb-tokudb-engine-5.5, mariadb-tokudb-engine-10.0
Description: MariaDB database server binaries
diff --git a/debian/dist/Debian/mariadb-server-10.0.postinst b/debian/dist/Debian/mariadb-server-10.0.postinst
index 9f79b61fd05..19594fb910e 100644
--- a/debian/dist/Debian/mariadb-server-10.0.postinst
+++ b/debian/dist/Debian/mariadb-server-10.0.postinst
@@ -21,7 +21,7 @@ invoke() {
fi
}
-MYSQL_BOOTSTRAP="/usr/sbin/mysqld --bootstrap --user=mysql --skip-grant-tables --default-storage-engine=myisam"
+MYSQL_BOOTSTRAP="/usr/sbin/mysqld --bootstrap --user=mysql --disable-log-bin --skip-grant-tables --default-storage-engine=myisam"
test_mysql_access() {
mysql --no-defaults -u root -h localhost </dev/null >/dev/null 2>&1
@@ -40,6 +40,7 @@ set_mysql_rootpw() {
# this avoids us having to call "test" or "[" on $rootpw
cat << EOF > $tfile
USE mysql;
+SET sql_log_bin=0;
UPDATE user SET password=PASSWORD("$rootpw") WHERE user='root';
FLUSH PRIVILEGES;
EOF
@@ -144,7 +145,7 @@ EOF
# Debian: beware of the bashisms...
# Debian: can safely run on upgrades with existing databases
set +e
- /bin/bash /usr/bin/mysql_install_db --rpm --user=mysql 2>&1 | $ERR_LOGGER
+ /bin/bash /usr/bin/mysql_install_db --rpm --user=mysql --disable-log-bin 2>&1 | $ERR_LOGGER
set -e
## On every reconfiguration the maintenance user is recreated.
diff --git a/debian/dist/Ubuntu/control b/debian/dist/Ubuntu/control
index 02ace29b67b..7133074b4ec 100644
--- a/debian/dist/Ubuntu/control
+++ b/debian/dist/Ubuntu/control
@@ -4,7 +4,12 @@ Priority: optional
Maintainer: MariaDB Developers <maria-developers@lists.launchpad.net>
XSBC-Original-Maintainer: Maria Developers <maria-developers@lists.launchpad.net>
Uploaders: MariaDB Developers <maria-developers@lists.launchpad.net>
-Build-Depends: libtool (>= 1.4.2-7), procps | hurd, debhelper, file (>= 3.28), libncurses5-dev (>= 5.0-6), perl (>= 5.6.0), libwrap0-dev (>= 7.6-8.3), zlib1g-dev (>= 1:1.1.3-5), ${LIBREADLINE_DEV}, libssl-dev, libpam0g-dev, psmisc, po-debconf, chrpath, automake1.9, doxygen, texlive-latex-base, ghostscript | gs-gpl, dpatch, gawk, bison, lsb-release, hardening-wrapper, ${CMAKE_DEP}libaio-dev, libjemalloc-dev (>= 3.0.0)
+Build-Depends: procps | hurd, debhelper, libncurses5-dev (>= 5.0-6),
+ perl (>= 5.6.0), libwrap0-dev (>= 7.6-8.3),
+ zlib1g-dev (>= 1:1.1.3-5), ${LIBREADLINE_DEV},
+ libssl-dev, libpam0g-dev, psmisc, po-debconf, chrpath,
+ dpatch, gawk, bison, lsb-release, hardening-wrapper,
+ ${CMAKE_DEP}libaio-dev, libjemalloc-dev (>= 3.0.0)
Standards-Version: 3.8.2
Homepage: http://mariadb.org/
Vcs-Browser: http://bazaar.launchpad.net/~maria-captains/maria/10.0/files
@@ -16,7 +21,9 @@ Architecture: any
Depends: mariadb-common, libmysqlclient18 (= ${source:Version}), ${shlibs:Depends}, ${misc:Depends}
Conflicts: mariadb-server-10.0 (<< 10.0.5), mariadb-galera-server-10.0 (<< 10.0.5),
mariadb-server-5.5 (<< 5.5.33), mariadb-galera-server-5.5 (<< 5.5.33),
- mariadb-server-5.1, mariadb-server-5.2, mariadb-server-5.3
+ mariadb-server-5.1,
+ mariadb-server-5.2,
+ mariadb-server-5.3
Description: MariaDB database client library
MariaDB is a fast, stable and true multi-user, multi-threaded SQL database
server. SQL (Structured Query Language) is the most popular database query
@@ -105,13 +112,15 @@ Conflicts: mysql-client (<< 5.0.51), mysql-client-5.0,
mysql-client-core-5.1, mysql-client-core-5.5,
mariadb-client-5.1, mariadb-client-core-5.1,
mariadb-client-5.2, mariadb-client-core-5.2,
- mariadb-client-5.3, mariadb-client-core-5.3
+ mariadb-client-5.3, mariadb-client-core-5.3,
+ mariadb-client-5.5, mariadb-client-core-5.5
Replaces: mysql-client (<< 5.0.51), mysql-client-5.0,
mysql-client-5.1, mysql-client-5.5,
mysql-client-core-5.1, mysql-client-core-5.5,
mariadb-client-5.1, mariadb-client-core-5.1,
mariadb-client-5.2, mariadb-client-core-5.2,
- mariadb-client-5.3, mariadb-client-core-5.3
+ mariadb-client-5.3, mariadb-client-core-5.3,
+ mariadb-client-5.5, mariadb-client-core-5.5
Description: MariaDB database core client binaries
MariaDB is a fast, stable and true multi-user, multi-threaded SQL database
server. SQL (Structured Query Language) is the most popular database query
@@ -131,11 +140,16 @@ Provides: virtual-mysql-client, mysql-client,
mysql-client-4.1, mysql-client-5.1, mysql-client-5.5
Conflicts: mysql-client (<< 5.0.51), mysql-client-5.0, mysql-client-5.1,
mariadb-client (<< ${source:Version}),
- mariadb-client-5.1, mariadb-client-5.2, mariadb-client-5.3, mysql-client-5.5
+ mariadb-client-5.1,
+ mariadb-client-5.2,
+ mariadb-client-5.3,
+ mariadb-client-5.5, mysql-client-5.5
Replaces: mysql-client (<< 5.0.51), mysql-client-5.0, mysql-client-5.1,
- mysql-client-5.5,
mariadb-client (<< ${source:Version}),
- mariadb-client-5.1, mariadb-client-5.2, mariadb-client-5.3
+ mariadb-client-5.1,
+ mariadb-client-5.2,
+ mariadb-client-5.3,
+ mariadb-client-5.5, mysql-client-5.5
Description: MariaDB database client binaries
MariaDB is a fast, stable and true multi-user, multi-threaded SQL database
server. SQL (Structured Query Language) is the most popular database query
@@ -149,12 +163,16 @@ Package: mariadb-server-core-10.0
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, libmariadbclient18 (>= ${binary:Version})
Provides: mysql-server-core, mysql-server-core-5.1, mysql-server-core-5.5
-Conflicts: mysql-server-5.0,
- mysql-server-core-5.0, mysql-server-core-5.1, mysql-server-core-5.5,
- mariadb-server-core-5.1, mariadb-server-core-5.2, mariadb-server-core-5.5
-Replaces: mysql-server-5.0,
- mysql-server-core-5.0, mysql-server-core-5.1, mysql-server-core-5.5,
- mariadb-server-core-5.1, mariadb-server-core-5.2, mariadb-server-core-5.5
+Conflicts: mysql-server-5.0, mysql-server-core-5.0,
+ mariadb-server-core-5.1, mysql-server-core-5.1,
+ mariadb-server-core-5.2,
+ mariadb-server-core-5.3,
+ mariadb-server-core-5.5, mysql-server-core-5.5
+Replaces: mysql-server-5.0, mysql-server-core-5.0,
+ mariadb-server-core-5.1, mysql-server-core-5.1,
+ mariadb-server-core-5.2,
+ mariadb-server-core-5.3,
+ mariadb-server-core-5.5, mysql-server-core-5.5
Description: MariaDB database core server files
MariaDB is a fast, stable and true multi-user, multi-threaded SQL database
server. SQL (Structured Query Language) is the most popular database query
@@ -192,12 +210,18 @@ Depends: mariadb-client-10.0 (>= ${source:Version}), libdbi-perl,
mariadb-server-core-10.0 (>= ${binary:Version})
Provides: mariadb-server, mysql-server, virtual-mysql-server
Conflicts: mariadb-server (<< ${source:Version}), mysql-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,
+ mysql-server-4.1, mysql-server-5.0,
+ mariadb-server-5.1, mysql-server-5.1,
+ mariadb-server-5.2,
+ mariadb-server-5.3,
+ mariadb-server-5.5, mysql-server-5.5,
mariadb-tokudb-engine-5.5, mariadb-tokudb-engine-10.0
Replaces: mariadb-server (<< ${source:Version}), mysql-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,
+ mysql-server-4.1, mysql-server-5.0,
+ mariadb-server-5.1, mysql-server-5.1,
+ mariadb-server-5.2,
+ mariadb-server-5.3,
+ mariadb-server-5.5, mysql-server-5.5,
libmariadbclient16 (<< 5.3.4), libmariadbclient-dev (<< 5.5.0),
mariadb-tokudb-engine-5.5, mariadb-tokudb-engine-10.0
Description: MariaDB database server binaries
diff --git a/debian/dist/Ubuntu/mariadb-server-10.0.postinst b/debian/dist/Ubuntu/mariadb-server-10.0.postinst
index 6e81fdba7ce..1acfbc80970 100644
--- a/debian/dist/Ubuntu/mariadb-server-10.0.postinst
+++ b/debian/dist/Ubuntu/mariadb-server-10.0.postinst
@@ -21,7 +21,7 @@ invoke() {
fi
}
-MYSQL_BOOTSTRAP="/usr/sbin/mysqld --bootstrap --user=mysql --skip-grant-tables --default-storage-engine=myisam"
+MYSQL_BOOTSTRAP="/usr/sbin/mysqld --bootstrap --user=mysql --disable-log-bin --skip-grant-tables --default-storage-engine=myisam"
test_mysql_access() {
mysql --no-defaults -u root -h localhost </dev/null >/dev/null 2>&1
@@ -41,6 +41,7 @@ set_mysql_rootpw() {
# this avoids us having to call "test" or "[" on $rootpw
cat << EOF > $tfile
USE mysql;
+SET sql_log_bin=0;
UPDATE user SET password=PASSWORD("$rootpw") WHERE user='root';
FLUSH PRIVILEGES;
EOF
@@ -145,7 +146,7 @@ EOF
# Debian: beware of the bashisms...
# Debian: can safely run on upgrades with existing databases
set +e
- /bin/bash /usr/bin/mysql_install_db --rpm --user=mysql 2>&1 | $ERR_LOGGER
+ /bin/bash /usr/bin/mysql_install_db --rpm --user=mysql --disable-log-bin 2>&1 | $ERR_LOGGER
set -e
## On every reconfiguration the maintenance user is recreated.
@@ -213,7 +214,7 @@ EOF
# admin might already have chosen to remove one or more plugins. Newlines are necessary.
install_plugins=`/bin/echo -e \
"USE mysql;\n" \
- "CREATE TABLE plugin (name char(64) COLLATE utf8_bin NOT NULL DEFAULT '', " \
+ "CREATE TABLE IF NOT EXISTS plugin (name char(64) COLLATE utf8_bin NOT NULL DEFAULT '', " \
" dl char(128) COLLATE utf8_bin NOT NULL DEFAULT '', " \
" PRIMARY KEY (name)) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='MySQL plugins';" `
diff --git a/extra/yassl/CMakeLists.txt b/extra/yassl/CMakeLists.txt
index 23404a661d6..f3232896c6a 100644
--- a/extra/yassl/CMakeLists.txt
+++ b/extra/yassl/CMakeLists.txt
@@ -20,12 +20,9 @@ INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/mySTL)
ADD_DEFINITIONS(${SSL_DEFINES})
-IF(CMAKE_COMPILER_IS_GNUXX)
- #Remove -fno-implicit-templates
- #(yassl sources cannot be compiled with it)
- STRING(REPLACE "-fno-implicit-templates" "" CMAKE_CXX_FLAGS
-${CMAKE_CXX_FLAGS})
-ENDIF()
+#Remove -fno-implicit-templates
+#(yassl sources cannot be compiled with it)
+STRING(REPLACE "-fno-implicit-templates" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
SET(YASSL_SOURCES src/buffer.cpp src/cert_wrapper.cpp src/crypto_wrapper.cpp src/handshake.cpp src/lock.cpp
src/log.cpp src/socket_wrapper.cpp src/ssl.cpp src/timer.cpp src/yassl_error.cpp
src/yassl_imp.cpp src/yassl_int.cpp)
diff --git a/extra/yassl/README b/extra/yassl/README
index 30c7af4a702..da399c3d141 100644
--- a/extra/yassl/README
+++ b/extra/yassl/README
@@ -12,6 +12,16 @@ before calling SSL_new();
*** end Note ***
+yaSSL Release notes, version 2.3.7 (12/10/2014)
+ This release of yaSSL fixes the potential to process duplicate handshake
+ messages by explicitly marking/checking received handshake messages.
+
+yaSSL Release notes, version 2.3.6 (11/25/2014)
+
+ This release of yaSSL fixes some valgrind warnings/errors including
+ uninitialized reads and off by one index errors induced from fuzzing
+ the handshake. These were reported by Oracle.
+
yaSSL Release notes, version 2.3.5 (9/29/2014)
This release of yaSSL fixes an RSA Padding check vulnerability reported by
diff --git a/extra/yassl/examples/client/client.cpp b/extra/yassl/examples/client/client.cpp
index fc05b66aaf7..102ed61734c 100644
--- a/extra/yassl/examples/client/client.cpp
+++ b/extra/yassl/examples/client/client.cpp
@@ -18,6 +18,10 @@
/* client.cpp */
+// takes an optional command line argument of cipher list to make scripting
+// easier
+
+
#include "../../testsuite/test.hpp"
//#define TEST_RESUME
@@ -73,11 +77,16 @@ void client_test(void* args)
#ifdef NON_BLOCKING
tcp_set_nonblocking(sockfd);
#endif
-
SSL_METHOD* method = TLSv1_client_method();
SSL_CTX* ctx = SSL_CTX_new(method);
set_certs(ctx);
+ if (argc >= 2) {
+ printf("setting cipher list to %s\n", argv[1]);
+ if (SSL_CTX_set_cipher_list(ctx, argv[1]) != SSL_SUCCESS) {
+ ClientError(ctx, NULL, sockfd, "set_cipher_list error\n");
+ }
+ }
SSL* ssl = SSL_new(ctx);
SSL_set_fd(ssl, sockfd);
diff --git a/extra/yassl/examples/server/server.cpp b/extra/yassl/examples/server/server.cpp
index 173ce8fb548..1540f6d3689 100644
--- a/extra/yassl/examples/server/server.cpp
+++ b/extra/yassl/examples/server/server.cpp
@@ -18,6 +18,9 @@
/* server.cpp */
+// takes 2 optional command line argument to make scripting
+// if the first command line argument is 'n' client auth is disabled
+// if the second command line argument is 'd' DSA certs are used instead of RSA
#include "../../testsuite/test.hpp"
@@ -69,6 +72,9 @@ THREAD_RETURN YASSL_API server_test(void* args)
char** argv = 0;
set_args(argc, argv, *static_cast<func_args*>(args));
+#ifdef SERVER_READY_FILE
+ set_file_ready("server_ready", *static_cast<func_args*>(args));
+#endif
tcp_accept(sockfd, clientfd, *static_cast<func_args*>(args));
tcp_close(sockfd);
@@ -77,8 +83,21 @@ THREAD_RETURN YASSL_API server_test(void* args)
SSL_CTX* ctx = SSL_CTX_new(method);
//SSL_CTX_set_cipher_list(ctx, "RC4-SHA:RC4-MD5");
- SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER, 0);
- set_serverCerts(ctx);
+
+ // should we disable client auth
+ if (argc >= 2 && argv[1][0] == 'n')
+ printf("disabling client auth\n");
+ else
+ SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER, 0);
+
+ // are we using DSA certs
+ if (argc >= 3 && argv[2][0] == 'd') {
+ printf("using DSA certs\n");
+ set_dsaServerCerts(ctx);
+ }
+ else {
+ set_serverCerts(ctx);
+ }
DH* dh = set_tmpDH(ctx);
SSL* ssl = SSL_new(ctx);
diff --git a/extra/yassl/include/openssl/ssl.h b/extra/yassl/include/openssl/ssl.h
index f819d76adc7..404ffa29275 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.5"
+#define YASSL_VERSION "2.3.7"
#if defined(__cplusplus)
diff --git a/extra/yassl/include/yassl_int.hpp b/extra/yassl/include/yassl_int.hpp
index d04e0d56bf8..269976a6eaa 100644
--- a/extra/yassl/include/yassl_int.hpp
+++ b/extra/yassl/include/yassl_int.hpp
@@ -107,6 +107,25 @@ enum AcceptState {
};
+// track received messages to explicitly disallow duplicate messages
+struct RecvdMessages {
+ uint8 gotClientHello_;
+ uint8 gotServerHello_;
+ uint8 gotCert_;
+ uint8 gotServerKeyExchange_;
+ uint8 gotCertRequest_;
+ uint8 gotServerHelloDone_;
+ uint8 gotCertVerify_;
+ uint8 gotClientKeyExchange_;
+ uint8 gotFinished_;
+ RecvdMessages() : gotClientHello_(0), gotServerHello_(0), gotCert_(0),
+ gotServerKeyExchange_(0), gotCertRequest_(0),
+ gotServerHelloDone_(0), gotCertVerify_(0),
+ gotClientKeyExchange_(0), gotFinished_(0)
+ {}
+};
+
+
// combines all states
class States {
RecordLayerState recordLayer_;
@@ -115,6 +134,7 @@ class States {
ServerState serverState_;
ConnectState connectState_;
AcceptState acceptState_;
+ RecvdMessages recvdMessages_;
char errorString_[MAX_ERROR_SZ];
YasslError what_;
public:
@@ -137,6 +157,7 @@ public:
AcceptState& UseAccept();
char* useString();
void SetError(YasslError);
+ int SetMessageRecvd(HandShakeType);
private:
States(const States&); // hide copy
States& operator=(const States&); // and assign
diff --git a/extra/yassl/src/yassl_imp.cpp b/extra/yassl/src/yassl_imp.cpp
index 25e00d45d2b..5d5632f3ba4 100644
--- a/extra/yassl/src/yassl_imp.cpp
+++ b/extra/yassl/src/yassl_imp.cpp
@@ -242,6 +242,7 @@ void EncryptedPreMasterSecret::read(SSL& ssl, input_buffer& input)
}
opaque preMasterSecret[SECRET_LEN];
+ memset(preMasterSecret, 0, sizeof(preMasterSecret));
rsa.decrypt(preMasterSecret, secret_, length_,
ssl.getCrypto().get_random());
@@ -300,6 +301,11 @@ void ClientDiffieHellmanPublic::read(SSL& ssl, input_buffer& input)
tmp[1] = input[AUTO];
ato16(tmp, keyLength);
+ if (keyLength < dh.get_agreedKeyLength()/2) {
+ ssl.SetError(bad_input);
+ return;
+ }
+
alloc(keyLength);
input.read(Yc_, keyLength);
if (input.get_error()) {
@@ -408,6 +414,10 @@ void DH_Server::read(SSL& ssl, input_buffer& input)
tmp[1] = input[AUTO];
ato16(tmp, length);
+ if (length == 0) {
+ ssl.SetError(bad_input);
+ return;
+ }
signature_ = NEW_YS byte[length];
input.read(signature_, length);
if (input.get_error()) {
@@ -864,6 +874,12 @@ void ChangeCipherSpec::Process(input_buffer& input, SSL& ssl)
return;
}
+ // detect duplicate change_cipher
+ if (ssl.getSecurity().get_parms().pending_ == false) {
+ ssl.order_error();
+ return;
+ }
+
ssl.useSecurity().use_parms().pending_ = false;
if (ssl.getSecurity().get_resuming()) {
if (ssl.getSecurity().get_parms().entity_ == client_end)
@@ -2047,12 +2063,8 @@ input_buffer& operator>>(input_buffer& input, CertificateRequest& request)
tmp[0] = input[AUTO];
tmp[1] = input[AUTO];
ato16(tmp, dnSz);
-
- DistinguishedName dn;
- request.certificate_authorities_.push_back(dn = NEW_YS
- byte[REQUEST_HEADER + dnSz]);
- memcpy(dn, tmp, REQUEST_HEADER);
- input.read(&dn[REQUEST_HEADER], dnSz);
+
+ input.set_current(input.get_current() + dnSz);
sz -= dnSz + REQUEST_HEADER;
@@ -2191,6 +2203,11 @@ input_buffer& operator>>(input_buffer& input, CertificateVerify& request)
ato16(tmp, sz);
request.set_length(sz);
+ if (sz == 0) {
+ input.set_error();
+ return input;
+ }
+
request.signature_ = NEW_YS byte[sz];
input.read(request.signature_, sz);
diff --git a/extra/yassl/src/yassl_int.cpp b/extra/yassl/src/yassl_int.cpp
index cbda9f97d83..8dad9ce052c 100644
--- a/extra/yassl/src/yassl_int.cpp
+++ b/extra/yassl/src/yassl_int.cpp
@@ -255,6 +255,77 @@ void States::SetError(YasslError ye)
}
+// mark message recvd, check for duplicates, return 0 on success
+int States::SetMessageRecvd(HandShakeType hst)
+{
+ switch (hst) {
+ case hello_request:
+ break; // could send more than one
+
+ case client_hello:
+ if (recvdMessages_.gotClientHello_)
+ return -1;
+ recvdMessages_.gotClientHello_ = 1;
+ break;
+
+ case server_hello:
+ if (recvdMessages_.gotServerHello_)
+ return -1;
+ recvdMessages_.gotServerHello_ = 1;
+ break;
+
+ case certificate:
+ if (recvdMessages_.gotCert_)
+ return -1;
+ recvdMessages_.gotCert_ = 1;
+ break;
+
+ case server_key_exchange:
+ if (recvdMessages_.gotServerKeyExchange_)
+ return -1;
+ recvdMessages_.gotServerKeyExchange_ = 1;
+ break;
+
+ case certificate_request:
+ if (recvdMessages_.gotCertRequest_)
+ return -1;
+ recvdMessages_.gotCertRequest_ = 1;
+ break;
+
+ case server_hello_done:
+ if (recvdMessages_.gotServerHelloDone_)
+ return -1;
+ recvdMessages_.gotServerHelloDone_ = 1;
+ break;
+
+ case certificate_verify:
+ if (recvdMessages_.gotCertVerify_)
+ return -1;
+ recvdMessages_.gotCertVerify_ = 1;
+ break;
+
+ case client_key_exchange:
+ if (recvdMessages_.gotClientKeyExchange_)
+ return -1;
+ recvdMessages_.gotClientKeyExchange_ = 1;
+ break;
+
+ case finished:
+ if (recvdMessages_.gotFinished_)
+ return -1;
+ recvdMessages_.gotFinished_ = 1;
+ break;
+
+
+ default:
+ return -1;
+
+ }
+
+ return 0;
+}
+
+
sslFactory::sslFactory() :
messageFactory_(InitMessageFactory),
handShakeFactory_(InitHandShakeFactory),
@@ -1199,6 +1270,11 @@ void SSL::verifyState(const HandShakeHeader& hsHeader)
return;
}
+ if (states_.SetMessageRecvd(hsHeader.get_handshakeType()) != 0) {
+ order_error();
+ return;
+ }
+
if (secure_.get_parms().entity_ == client_end)
verifyClientState(hsHeader.get_handshakeType());
else
diff --git a/extra/yassl/taocrypt/src/asn.cpp b/extra/yassl/taocrypt/src/asn.cpp
index 15f8d81f5cc..624148bdac8 100644
--- a/extra/yassl/taocrypt/src/asn.cpp
+++ b/extra/yassl/taocrypt/src/asn.cpp
@@ -680,7 +680,7 @@ word32 CertDecoder::GetSignature()
}
sigLength_ = GetLength(source_);
- if (sigLength_ == 0 || source_.IsLeft(sigLength_) == false) {
+ if (sigLength_ <= 1 || source_.IsLeft(sigLength_) == false) {
source_.SetError(CONTENT_E);
return 0;
}
@@ -1011,11 +1011,17 @@ bool CertDecoder::ConfirmSignature(Source& pub)
RSA_PublicKey pubKey(pub);
RSAES_Encryptor enc(pubKey);
+ if (pubKey.FixedCiphertextLength() != sigLength_) {
+ source_.SetError(SIG_LEN_E);
+ return false;
+ }
+
return enc.SSL_Verify(build.get_buffer(), build.size(), signature_);
}
else { // DSA
// extract r and s from sequence
byte seqDecoded[DSA_SIG_SZ];
+ memset(seqDecoded, 0, sizeof(seqDecoded));
DecodeDSA_Signature(seqDecoded, signature_, sigLength_);
DSA_PublicKey pubKey(pub);
diff --git a/extra/yassl/taocrypt/src/integer.cpp b/extra/yassl/taocrypt/src/integer.cpp
index b7fbb7f96cf..fb8d9276bd9 100644
--- a/extra/yassl/taocrypt/src/integer.cpp
+++ b/extra/yassl/taocrypt/src/integer.cpp
@@ -2605,18 +2605,20 @@ void Integer::Decode(Source& source)
void Integer::Decode(const byte* input, unsigned int inputLen, Signedness s)
{
unsigned int idx(0);
- byte b = input[idx++];
+ byte b = 0;
+ if (inputLen>0)
+ b = input[idx]; // peek
sign_ = ((s==SIGNED) && (b & 0x80)) ? NEGATIVE : POSITIVE;
while (inputLen>0 && (sign_==POSITIVE ? b==0 : b==0xff))
{
- inputLen--;
- b = input[idx++];
+ idx++; // skip
+ if (--inputLen>0)
+ b = input[idx]; // peek
}
reg_.CleanNew(RoundupSize(BytesToWords(inputLen)));
- --idx;
for (unsigned int i=inputLen; i > 0; i--)
{
b = input[idx++];
diff --git a/extra/yassl/testsuite/cipher-test.sh b/extra/yassl/testsuite/cipher-test.sh
new file mode 100644
index 00000000000..5ce29459d07
--- /dev/null
+++ b/extra/yassl/testsuite/cipher-test.sh
@@ -0,0 +1,130 @@
+#!/bin/bash
+
+# test all yassl cipher suties
+#
+
+
+server_pid=$no_pid
+
+
+do_cleanup() {
+ echo "in cleanup"
+
+ if [[ $server_pid != $no_pid ]]
+ then
+ echo "killing server"
+ kill -9 $server_pid
+ fi
+}
+
+do_trap() {
+ echo "got trap"
+ do_cleanup
+ exit -1
+}
+
+trap do_trap INT TERM
+
+
+# make sure example server and client are built
+if test ! -s ../examples/server/server; then
+ echo "Please build yaSSL first, example server missing"
+ exit -1
+fi
+
+if test ! -s ../examples/client/client; then
+ echo "Please build yaSSL first, example client missing"
+ exit -1
+fi
+
+
+# non DSA suites
+for suite in {"DHE-RSA-AES256-SHA","AES256-SHA","DHE-RSA-AES128-SHA","AES128-SHA","AES256-RMD","AES128-RMD","DES-CBC3-RMD","DHE-RSA-AES256-RMD","DHE-RSA-AES128-RMD","DHE-RSA-DES-CBC3-RMD","RC4-SHA","RC4-MD5","DES-CBC3-SHA","DES-CBC-SHA","EDH-RSA-DES-CBC3-SHA","EDH-RSA-DES-CBC-SHA"}
+do
+ for client_auth in {y,n}
+ do
+ echo "Trying $suite client auth = $client_auth ..."
+
+ if test -e server_ready; then
+ echo -e "removing exisitng server_ready file"
+ rm server_ready
+ fi
+ ../examples/server/server $client_auth &
+ server_pid=$!
+
+ while [ ! -s server_ready ]; do
+ echo -e "waiting for server_ready file..."
+ sleep 0.1
+ done
+
+ ../examples/client/client $suite
+ client_result=$?
+
+ wait $server_pid
+ server_result=$?
+
+ server_pid=$no_pid
+
+ if [[ $client_result != 0 ]]
+ then
+ echo "Client Error"
+ exit $client_result
+ fi
+
+ if [[ $server_result != 0 ]]
+ then
+ echo "Server Error"
+ exit $server_result
+ fi
+
+ done # end client auth loop
+done # end non dsa suite list
+echo -e "Non DSA Loop SUCCESS"
+
+
+
+# DSA suites
+for suite in {"DHE-DSS-AES256-SHA","DHE-DSS-AES128-SHA","DHE-DSS-AES256-RMD","DHE-DSS-AES128-RMD","DHE-DSS-DES-CBC3-RMD","EDH-DSS-DES-CBC3-SHA","EDH-DSS-DES-CBC-SHA"}
+do
+ for client_auth in {y,n}
+ do
+ echo "Trying $suite client auth = $client_auth ..."
+
+ if test -e server_ready; then
+ echo -e "removing exisitng server_ready file"
+ rm server_ready
+ fi
+ # d signifies DSA
+ ../examples/server/server $client_auth d &
+ server_pid=$!
+
+ while [ ! -s server_ready ]; do
+ echo -e "waiting for server_ready file..."
+ sleep 0.1
+ done
+
+ ../examples/client/client $suite
+ client_result=$?
+
+ wait $server_pid
+ server_result=$?
+
+ server_pid=$no_pid
+
+ if [[ $client_result != 0 ]]
+ then
+ echo "Client Error"
+ exit $client_result
+ fi
+
+ if [[ $server_result != 0 ]]
+ then
+ echo "Server Error"
+ exit $server_result
+ fi
+
+ done # end client auth loop
+done # end dsa suite list
+echo -e "DSA Loop SUCCESS"
+
+exit 0
diff --git a/extra/yassl/testsuite/test.hpp b/extra/yassl/testsuite/test.hpp
index 33f398ae269..52f6ed79526 100644
--- a/extra/yassl/testsuite/test.hpp
+++ b/extra/yassl/testsuite/test.hpp
@@ -131,9 +131,10 @@ struct func_args {
int argc;
char** argv;
int return_code;
+ const char* file_ready;
tcp_ready* signal_;
- func_args(int c = 0, char** v = 0) : argc(c), argv(v) {}
+ func_args(int c = 0, char** v = 0) : argc(c), argv(v), file_ready(0) {}
void SetSignal(tcp_ready* p) { signal_ = p; }
};
@@ -146,6 +147,7 @@ void join_thread(THREAD_TYPE);
// yaSSL
const char* const yasslIP = "127.0.0.1";
const unsigned short yasslPort = 11111;
+const unsigned short proxyPort = 12345;
// client
@@ -172,13 +174,13 @@ const char* const svrKey3 = "../../../certs/server-key.pem";
// server dsa
const char* const dsaCert = "../certs/dsa-cert.pem";
-const char* const dsaKey = "../certs/dsa512.der";
+const char* const dsaKey = "../certs/dsa1024.der";
const char* const dsaCert2 = "../../certs/dsa-cert.pem";
-const char* const dsaKey2 = "../../certs/dsa512.der";
+const char* const dsaKey2 = "../../certs/dsa1024.der";
const char* const dsaCert3 = "../../../certs/dsa-cert.pem";
-const char* const dsaKey3 = "../../../certs/dsa512.der";
+const char* const dsaKey3 = "../../../certs/dsa1024.der";
// CA
@@ -222,6 +224,13 @@ inline void store_ca(SSL_CTX* ctx)
if (SSL_CTX_load_verify_locations(ctx, certSuite, 0) != SSL_SUCCESS)
if (SSL_CTX_load_verify_locations(ctx, certDebug,0) != SSL_SUCCESS)
err_sys("failed to use certificate: certs/client-cert.pem");
+
+ // DSA cert
+ if (SSL_CTX_load_verify_locations(ctx, dsaCert, 0) != SSL_SUCCESS)
+ if (SSL_CTX_load_verify_locations(ctx, dsaCert2, 0) != SSL_SUCCESS)
+ if (SSL_CTX_load_verify_locations(ctx, dsaCert3, 0) != SSL_SUCCESS)
+ err_sys("failed to use certificate: certs/dsa-cert.pem");
+
}
@@ -298,7 +307,7 @@ inline void set_dsaServerCerts(SSL_CTX* ctx)
!= SSL_SUCCESS)
if (SSL_CTX_use_PrivateKey_file(ctx, dsaKey3,SSL_FILETYPE_ASN1)
!= SSL_SUCCESS)
- err_sys("failed to use key file: certs/dsa512.der");
+ err_sys("failed to use key file: certs/dsa1024.der");
}
@@ -310,6 +319,12 @@ inline void set_args(int& argc, char**& argv, func_args& args)
}
+inline void set_file_ready(const char* name, func_args& args)
+{
+ args.file_ready = name;
+}
+
+
inline void tcp_set_nonblocking(SOCKET_T& sockfd)
{
#ifdef NON_BLOCKING
@@ -349,7 +364,11 @@ inline void tcp_socket(SOCKET_T& sockfd, SOCKADDR_IN_T& addr)
*/ // end external testing later
#else
addr.sin_family = AF_INET_V;
+#ifdef YASSL_PROXY_PORT
+ addr.sin_port = htons(proxyPort);
+#else
addr.sin_port = htons(yasslPort);
+#endif
addr.sin_addr.s_addr = inet_addr(yasslIP);
#endif
@@ -401,6 +420,16 @@ inline void tcp_listen(SOCKET_T& sockfd)
}
+inline void create_ready_file(func_args& args)
+{
+ FILE* f = fopen(args.file_ready, "w+");
+
+ if (f) {
+ fputs("ready", f);
+ fclose(f);
+ }
+}
+
inline void tcp_accept(SOCKET_T& sockfd, SOCKET_T& clientfd, func_args& args)
{
@@ -418,6 +447,9 @@ inline void tcp_accept(SOCKET_T& sockfd, SOCKET_T& clientfd, func_args& args)
pthread_mutex_unlock(&ready.mutex_);
#endif
+ if (args.file_ready)
+ create_ready_file(args);
+
clientfd = accept(sockfd, (sockaddr*)&client, (ACCEPT_THIRD_T)&client_len);
if (clientfd == (SOCKET_T) -1) {
diff --git a/include/atomic/gcc_builtins.h b/include/atomic/gcc_builtins.h
index 6e807b3c51c..56a0323aedf 100644
--- a/include/atomic/gcc_builtins.h
+++ b/include/atomic/gcc_builtins.h
@@ -31,8 +31,8 @@
#define make_atomic_store_body(S) *a= v
#define MY_ATOMIC_MODE "gcc-builtins-up"
-#elif defined(__ATOMIC_SEQ_CST)
-#define MY_ATOMIC_MODE "gcc-builtins-smp"
+#elif defined(HAVE_GCC_C11_ATOMICS)
+#define MY_ATOMIC_MODE "gcc-atomics-smp"
#define make_atomic_load_body(S) \
ret= __atomic_load_n(a, __ATOMIC_SEQ_CST)
#define make_atomic_store_body(S) \
diff --git a/include/my_stacktrace.h b/include/my_stacktrace.h
index ad05a7df9ab..fb2525e3a12 100644
--- a/include/my_stacktrace.h
+++ b/include/my_stacktrace.h
@@ -35,8 +35,7 @@
#define HAVE_WRITE_CORE
-#if HAVE_BACKTRACE && HAVE_BACKTRACE_SYMBOLS && \
- HAVE_CXXABI_H && HAVE_ABI_CXA_DEMANGLE && \
+#if HAVE_BACKTRACE && HAVE_BACKTRACE_SYMBOLS && HAVE_ABI_CXA_DEMANGLE && \
HAVE_WEAK_SYMBOL
#define BACKTRACE_DEMANGLE 1
#endif
diff --git a/include/myisamchk.h b/include/myisamchk.h
index 7abbcea3302..64724de1789 100644
--- a/include/myisamchk.h
+++ b/include/myisamchk.h
@@ -34,6 +34,7 @@
#define TT_USEFRM 1
#define TT_FOR_UPGRADE 2
+#define TT_FROM_MYSQL 4
/* Bits set in out_flag */
#define O_NEW_DATA 2
diff --git a/include/mysql.h b/include/mysql.h
index 63e86937063..d9d9739dd1f 100644
--- a/include/mysql.h
+++ b/include/mysql.h
@@ -865,6 +865,12 @@ my_socket STDCALL mysql_get_socket(const MYSQL *mysql);
unsigned int STDCALL mysql_get_timeout_value(const MYSQL *mysql);
unsigned int STDCALL mysql_get_timeout_value_ms(const MYSQL *mysql);
+/********************************************************************
+ mysql_net_ functions - low-level API to MySQL protocol
+*********************************************************************/
+unsigned long STDCALL mysql_net_read_packet(MYSQL *mysql);
+unsigned long STDCALL mysql_net_field_length(unsigned char **packet);
+
/* status return codes */
#define MYSQL_NO_DATA 100
#define MYSQL_DATA_TRUNCATED 101
diff --git a/include/mysql.h.pp b/include/mysql.h.pp
index dd794e856e1..2c8e47b454f 100644
--- a/include/mysql.h.pp
+++ b/include/mysql.h.pp
@@ -1,7 +1,5 @@
typedef char my_bool;
typedef int my_socket;
-#include "mysql_version.h"
-#include "mysql_com.h"
enum enum_server_command
{
COM_SLEEP, COM_QUIT, COM_INIT_DB, COM_QUERY, COM_FIELD_LIST,
@@ -145,7 +143,6 @@ void get_tty_password_buff(const char *opt_message, char *to, size_t length);
const char *mysql_errno_to_sqlstate(unsigned int mysql_errno);
my_bool my_thread_init(void);
void my_thread_end(void);
-#include "mysql_time.h"
typedef long my_time_t;
enum enum_mysql_timestamp_type
{
@@ -159,7 +156,6 @@ typedef struct st_mysql_time
my_bool neg;
enum enum_mysql_timestamp_type time_type;
} MYSQL_TIME;
-#include "my_list.h"
typedef struct st_list {
struct st_list *prev,*next;
void *data;
@@ -201,8 +197,6 @@ typedef struct st_mysql_field {
typedef char **MYSQL_ROW;
typedef unsigned int MYSQL_FIELD_OFFSET;
typedef unsigned long long my_ulonglong;
-#include "typelib.h"
-#include "my_alloc.h"
typedef struct st_used_mem
{
struct st_used_mem *next;
@@ -246,7 +240,6 @@ typedef struct st_mysql_rows {
unsigned long length;
} MYSQL_ROWS;
typedef MYSQL_ROWS *MYSQL_ROW_OFFSET;
-#include "my_alloc.h"
typedef struct embedded_query_result EMBEDDED_QUERY_RESULT;
typedef struct st_mysql_data {
MYSQL_ROWS *data;
@@ -747,3 +740,5 @@ int mysql_close_cont(MYSQL *sock, int status);
my_socket mysql_get_socket(const MYSQL *mysql);
unsigned int mysql_get_timeout_value(const MYSQL *mysql);
unsigned int mysql_get_timeout_value_ms(const MYSQL *mysql);
+unsigned long mysql_net_read_packet(MYSQL *mysql);
+unsigned long mysql_net_field_length(unsigned char **packet);
diff --git a/include/mysql/client_plugin.h.pp b/include/mysql/client_plugin.h.pp
index f3a0b5769df..b6ba9cf08ad 100644
--- a/include/mysql/client_plugin.h.pp
+++ b/include/mysql/client_plugin.h.pp
@@ -3,7 +3,6 @@ struct st_mysql_client_plugin
int type; unsigned int interface_version; const char *name; const char *author; const char *desc; unsigned int version[3]; const char *license; void *mysql_api; int (*init)(char *, size_t, int, va_list); int (*deinit)(); int (*options)(const char *option, const void *);
};
struct st_mysql;
-#include <mysql/plugin_auth_common.h>
typedef struct st_plugin_vio_info
{
enum { MYSQL_VIO_INVALID, MYSQL_VIO_TCP, MYSQL_VIO_SOCKET,
@@ -24,7 +23,6 @@ struct st_mysql_client_plugin_AUTHENTICATION
int type; unsigned int interface_version; const char *name; const char *author; const char *desc; unsigned int version[3]; const char *license; void *mysql_api; int (*init)(char *, size_t, int, va_list); int (*deinit)(); int (*options)(const char *option, const void *);
int (*authenticate_user)(MYSQL_PLUGIN_VIO *vio, struct st_mysql *mysql);
};
-#include <mysql/auth_dialog_client.h>
struct st_mysql;
typedef char *(*mysql_authentication_dialog_ask_t)(struct st_mysql *mysql,
int type, const char *prompt, char *buf, int buf_len);
diff --git a/include/mysql/plugin_audit.h.pp b/include/mysql/plugin_audit.h.pp
index 98fd089570d..2f8edfe192f 100644
--- a/include/mysql/plugin_audit.h.pp
+++ b/include/mysql/plugin_audit.h.pp
@@ -1,15 +1,11 @@
-#include "plugin.h"
typedef char my_bool;
typedef void * MYSQL_PLUGIN;
-#include <mysql/services.h>
-#include <mysql/service_my_snprintf.h>
extern struct my_snprintf_service_st {
size_t (*my_snprintf_type)(char*, size_t, const char*, ...);
size_t (*my_vsnprintf_type)(char *, size_t, const char*, va_list);
} *my_snprintf_service;
size_t my_snprintf(char* to, size_t n, const char* fmt, ...);
size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap);
-#include <mysql/service_thd_alloc.h>
struct st_mysql_lex_string
{
char *str;
@@ -33,7 +29,6 @@ void *thd_memdup(void* thd, const void* str, unsigned int size);
MYSQL_LEX_STRING *thd_make_lex_string(void* thd, MYSQL_LEX_STRING *lex_str,
const char *str, unsigned int size,
int allocate_lex_string);
-#include <mysql/service_thd_wait.h>
typedef enum _thd_wait_type_e {
THD_WAIT_SLEEP= 1,
THD_WAIT_DISKIO= 2,
@@ -54,7 +49,6 @@ extern struct thd_wait_service_st {
} *thd_wait_service;
void thd_wait_begin(void* thd, int wait_type);
void thd_wait_end(void* thd);
-#include <mysql/service_progress_report.h>
extern struct progress_report_service_st {
void (*thd_progress_init_func)(void* thd, unsigned int max_stage);
void (*thd_progress_report_func)(void* thd,
@@ -75,9 +69,7 @@ void thd_progress_next_stage(void* thd);
void thd_progress_end(void* thd);
const char *set_thd_proc_info(void*, const char * info, const char *func,
const char *file, unsigned int line);
-#include <mysql/service_debug_sync.h>
extern void (*debug_sync_C_callback_ptr)(void*, const char *, size_t);
-#include <mysql/service_kill_statement.h>
enum thd_kill_levels {
THD_IS_NOT_KILLED=0,
THD_ABORT_SOFTLY=50,
@@ -87,8 +79,6 @@ extern struct kill_statement_service_st {
enum thd_kill_levels (*thd_kill_level_func)(const void*);
} *thd_kill_statement_service;
enum thd_kill_levels thd_kill_level(const void*);
-#include <mysql/service_thd_timezone.h>
-#include "mysql_time.h"
typedef long my_time_t;
enum enum_mysql_timestamp_type
{
@@ -108,14 +98,12 @@ extern struct thd_timezone_service_st {
} *thd_timezone_service;
my_time_t thd_TIME_to_gmt_sec(void* thd, const MYSQL_TIME *ltime, unsigned int *errcode);
void thd_gmt_sec_to_TIME(void* thd, MYSQL_TIME *ltime, my_time_t t);
-#include <mysql/service_sha1.h>
extern struct my_sha1_service_st {
void (*my_sha1_type)(unsigned char*, const char*, size_t);
void (*my_sha1_multi_type)(unsigned char*, ...);
} *my_sha1_service;
void my_sha1(unsigned char*, const char*, size_t);
void my_sha1_multi(unsigned char*, ...);
-#include <mysql/service_logger.h>
typedef struct logger_handle_st LOGGER_HANDLE;
extern struct logger_service_st {
void (*logger_init_mutexes)();
@@ -137,14 +125,12 @@ extern struct logger_service_st {
int logger_printf(LOGGER_HANDLE *log, const char *fmt, ...);
int logger_write(LOGGER_HANDLE *log, const char *buffer, size_t size);
int logger_rotate(LOGGER_HANDLE *log);
-#include <mysql/service_thd_autoinc.h>
extern struct thd_autoinc_service_st {
void (*thd_get_autoinc_func)(const void* thd,
unsigned long* off, unsigned long* inc);
} *thd_autoinc_service;
void thd_get_autoinc(const void* thd,
unsigned long* off, unsigned long* inc);
-#include <mysql/service_thd_error_context.h>
extern struct thd_error_context_service_st {
const char *(*thd_get_error_message_func)(const void* thd);
unsigned int (*thd_get_error_number_func)(const void* thd);
@@ -223,8 +209,6 @@ struct st_maria_plugin
const char *version_info;
unsigned int maturity;
};
-#include "plugin_ftparser.h"
-#include "plugin.h"
enum enum_ftparser_mode
{
MYSQL_FTPARSER_SIMPLE_MODE= 0,
diff --git a/include/mysql/plugin_auth.h.pp b/include/mysql/plugin_auth.h.pp
index 6d52c5be7f0..d052c550896 100644
--- a/include/mysql/plugin_auth.h.pp
+++ b/include/mysql/plugin_auth.h.pp
@@ -1,15 +1,11 @@
-#include <mysql/plugin.h>
typedef char my_bool;
typedef void * MYSQL_PLUGIN;
-#include <mysql/services.h>
-#include <mysql/service_my_snprintf.h>
extern struct my_snprintf_service_st {
size_t (*my_snprintf_type)(char*, size_t, const char*, ...);
size_t (*my_vsnprintf_type)(char *, size_t, const char*, va_list);
} *my_snprintf_service;
size_t my_snprintf(char* to, size_t n, const char* fmt, ...);
size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap);
-#include <mysql/service_thd_alloc.h>
struct st_mysql_lex_string
{
char *str;
@@ -33,7 +29,6 @@ void *thd_memdup(void* thd, const void* str, unsigned int size);
MYSQL_LEX_STRING *thd_make_lex_string(void* thd, MYSQL_LEX_STRING *lex_str,
const char *str, unsigned int size,
int allocate_lex_string);
-#include <mysql/service_thd_wait.h>
typedef enum _thd_wait_type_e {
THD_WAIT_SLEEP= 1,
THD_WAIT_DISKIO= 2,
@@ -54,7 +49,6 @@ extern struct thd_wait_service_st {
} *thd_wait_service;
void thd_wait_begin(void* thd, int wait_type);
void thd_wait_end(void* thd);
-#include <mysql/service_progress_report.h>
extern struct progress_report_service_st {
void (*thd_progress_init_func)(void* thd, unsigned int max_stage);
void (*thd_progress_report_func)(void* thd,
@@ -75,9 +69,7 @@ void thd_progress_next_stage(void* thd);
void thd_progress_end(void* thd);
const char *set_thd_proc_info(void*, const char * info, const char *func,
const char *file, unsigned int line);
-#include <mysql/service_debug_sync.h>
extern void (*debug_sync_C_callback_ptr)(void*, const char *, size_t);
-#include <mysql/service_kill_statement.h>
enum thd_kill_levels {
THD_IS_NOT_KILLED=0,
THD_ABORT_SOFTLY=50,
@@ -87,8 +79,6 @@ extern struct kill_statement_service_st {
enum thd_kill_levels (*thd_kill_level_func)(const void*);
} *thd_kill_statement_service;
enum thd_kill_levels thd_kill_level(const void*);
-#include <mysql/service_thd_timezone.h>
-#include "mysql_time.h"
typedef long my_time_t;
enum enum_mysql_timestamp_type
{
@@ -108,14 +98,12 @@ extern struct thd_timezone_service_st {
} *thd_timezone_service;
my_time_t thd_TIME_to_gmt_sec(void* thd, const MYSQL_TIME *ltime, unsigned int *errcode);
void thd_gmt_sec_to_TIME(void* thd, MYSQL_TIME *ltime, my_time_t t);
-#include <mysql/service_sha1.h>
extern struct my_sha1_service_st {
void (*my_sha1_type)(unsigned char*, const char*, size_t);
void (*my_sha1_multi_type)(unsigned char*, ...);
} *my_sha1_service;
void my_sha1(unsigned char*, const char*, size_t);
void my_sha1_multi(unsigned char*, ...);
-#include <mysql/service_logger.h>
typedef struct logger_handle_st LOGGER_HANDLE;
extern struct logger_service_st {
void (*logger_init_mutexes)();
@@ -137,14 +125,12 @@ extern struct logger_service_st {
int logger_printf(LOGGER_HANDLE *log, const char *fmt, ...);
int logger_write(LOGGER_HANDLE *log, const char *buffer, size_t size);
int logger_rotate(LOGGER_HANDLE *log);
-#include <mysql/service_thd_autoinc.h>
extern struct thd_autoinc_service_st {
void (*thd_get_autoinc_func)(const void* thd,
unsigned long* off, unsigned long* inc);
} *thd_autoinc_service;
void thd_get_autoinc(const void* thd,
unsigned long* off, unsigned long* inc);
-#include <mysql/service_thd_error_context.h>
extern struct thd_error_context_service_st {
const char *(*thd_get_error_message_func)(const void* thd);
unsigned int (*thd_get_error_number_func)(const void* thd);
@@ -223,8 +209,6 @@ struct st_maria_plugin
const char *version_info;
unsigned int maturity;
};
-#include "plugin_ftparser.h"
-#include "plugin.h"
enum enum_ftparser_mode
{
MYSQL_FTPARSER_SIMPLE_MODE= 0,
@@ -314,7 +298,6 @@ void *thd_get_ha_data(const void* thd, const struct handlerton *hton);
void thd_set_ha_data(void* thd, const struct handlerton *hton,
const void *ha_data);
void thd_wakeup_subsequent_commits(void* thd, int wakeup_error);
-#include <mysql/plugin_auth_common.h>
typedef struct st_plugin_vio_info
{
enum { MYSQL_VIO_INVALID, MYSQL_VIO_TCP, MYSQL_VIO_SOCKET,
diff --git a/include/mysql/plugin_ftparser.h.pp b/include/mysql/plugin_ftparser.h.pp
index cb3e7cafc97..45eb06974f4 100644
--- a/include/mysql/plugin_ftparser.h.pp
+++ b/include/mysql/plugin_ftparser.h.pp
@@ -1,15 +1,11 @@
-#include "plugin.h"
typedef char my_bool;
typedef void * MYSQL_PLUGIN;
-#include <mysql/services.h>
-#include <mysql/service_my_snprintf.h>
extern struct my_snprintf_service_st {
size_t (*my_snprintf_type)(char*, size_t, const char*, ...);
size_t (*my_vsnprintf_type)(char *, size_t, const char*, va_list);
} *my_snprintf_service;
size_t my_snprintf(char* to, size_t n, const char* fmt, ...);
size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap);
-#include <mysql/service_thd_alloc.h>
struct st_mysql_lex_string
{
char *str;
@@ -33,7 +29,6 @@ void *thd_memdup(void* thd, const void* str, unsigned int size);
MYSQL_LEX_STRING *thd_make_lex_string(void* thd, MYSQL_LEX_STRING *lex_str,
const char *str, unsigned int size,
int allocate_lex_string);
-#include <mysql/service_thd_wait.h>
typedef enum _thd_wait_type_e {
THD_WAIT_SLEEP= 1,
THD_WAIT_DISKIO= 2,
@@ -54,7 +49,6 @@ extern struct thd_wait_service_st {
} *thd_wait_service;
void thd_wait_begin(void* thd, int wait_type);
void thd_wait_end(void* thd);
-#include <mysql/service_progress_report.h>
extern struct progress_report_service_st {
void (*thd_progress_init_func)(void* thd, unsigned int max_stage);
void (*thd_progress_report_func)(void* thd,
@@ -75,9 +69,7 @@ void thd_progress_next_stage(void* thd);
void thd_progress_end(void* thd);
const char *set_thd_proc_info(void*, const char * info, const char *func,
const char *file, unsigned int line);
-#include <mysql/service_debug_sync.h>
extern void (*debug_sync_C_callback_ptr)(void*, const char *, size_t);
-#include <mysql/service_kill_statement.h>
enum thd_kill_levels {
THD_IS_NOT_KILLED=0,
THD_ABORT_SOFTLY=50,
@@ -87,8 +79,6 @@ extern struct kill_statement_service_st {
enum thd_kill_levels (*thd_kill_level_func)(const void*);
} *thd_kill_statement_service;
enum thd_kill_levels thd_kill_level(const void*);
-#include <mysql/service_thd_timezone.h>
-#include "mysql_time.h"
typedef long my_time_t;
enum enum_mysql_timestamp_type
{
@@ -108,14 +98,12 @@ extern struct thd_timezone_service_st {
} *thd_timezone_service;
my_time_t thd_TIME_to_gmt_sec(void* thd, const MYSQL_TIME *ltime, unsigned int *errcode);
void thd_gmt_sec_to_TIME(void* thd, MYSQL_TIME *ltime, my_time_t t);
-#include <mysql/service_sha1.h>
extern struct my_sha1_service_st {
void (*my_sha1_type)(unsigned char*, const char*, size_t);
void (*my_sha1_multi_type)(unsigned char*, ...);
} *my_sha1_service;
void my_sha1(unsigned char*, const char*, size_t);
void my_sha1_multi(unsigned char*, ...);
-#include <mysql/service_logger.h>
typedef struct logger_handle_st LOGGER_HANDLE;
extern struct logger_service_st {
void (*logger_init_mutexes)();
@@ -137,14 +125,12 @@ extern struct logger_service_st {
int logger_printf(LOGGER_HANDLE *log, const char *fmt, ...);
int logger_write(LOGGER_HANDLE *log, const char *buffer, size_t size);
int logger_rotate(LOGGER_HANDLE *log);
-#include <mysql/service_thd_autoinc.h>
extern struct thd_autoinc_service_st {
void (*thd_get_autoinc_func)(const void* thd,
unsigned long* off, unsigned long* inc);
} *thd_autoinc_service;
void thd_get_autoinc(const void* thd,
unsigned long* off, unsigned long* inc);
-#include <mysql/service_thd_error_context.h>
extern struct thd_error_context_service_st {
const char *(*thd_get_error_message_func)(const void* thd);
unsigned int (*thd_get_error_number_func)(const void* thd);
@@ -223,7 +209,6 @@ struct st_maria_plugin
const char *version_info;
unsigned int maturity;
};
-#include "plugin_ftparser.h"
struct st_mysql_daemon
{
int interface_version;
diff --git a/include/mysql/psi/mysql_statement.h b/include/mysql/psi/mysql_statement.h
index d7a76ee25e4..3d5943fa55a 100644
--- a/include/mysql/psi/mysql_statement.h
+++ b/include/mysql/psi/mysql_statement.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2010, 2015, 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
@@ -41,7 +41,6 @@
do {} while (0)
#endif
-#ifdef HAVE_PSI_STATEMENT_INTERFACE
#ifdef HAVE_PSI_STATEMENT_DIGEST_INTERFACE
#define MYSQL_DIGEST_START(LOCKER) \
inline_mysql_digest_start(LOCKER)
@@ -49,17 +48,13 @@
#define MYSQL_DIGEST_START(LOCKER) \
NULL
#endif
-#else
- #define MYSQL_DIGEST_START(LOCKER) \
- NULL
-#endif
#ifdef HAVE_PSI_STATEMENT_DIGEST_INTERFACE
- #define MYSQL_ADD_TOKEN(LOCKER, T, Y) \
- inline_mysql_add_token(LOCKER, T, Y)
+ #define MYSQL_DIGEST_END(LOCKER, DIGEST) \
+ inline_mysql_digest_end(LOCKER, DIGEST)
#else
- #define MYSQL_ADD_TOKEN(LOCKER, T, Y) \
- NULL
+ #define MYSQL_DIGEST_END(LOCKER, DIGEST) \
+ do {} while (0)
#endif
#ifdef HAVE_PSI_STATEMENT_INTERFACE
@@ -132,20 +127,17 @@ inline_mysql_digest_start(PSI_statement_locker *locker)
PSI_digest_locker* digest_locker= NULL;
if (likely(locker != NULL))
- digest_locker= PSI_STATEMENT_CALL(digest_start)(locker);
+ digest_locker= PSI_DIGEST_CALL(digest_start)(locker);
return digest_locker;
}
#endif
#ifdef HAVE_PSI_STATEMENT_DIGEST_INTERFACE
-static inline struct PSI_digest_locker *
-inline_mysql_add_token(PSI_digest_locker *locker, uint token,
- void *yylval)
+static inline void
+inline_mysql_digest_end(PSI_digest_locker *locker, const sql_digest_storage *digest)
{
if (likely(locker != NULL))
- locker= PSI_STATEMENT_CALL(digest_add_token)(locker, token,
- (OPAQUE_LEX_YYSTYPE*)yylval);
- return locker;
+ PSI_DIGEST_CALL(digest_end)(locker, digest);
}
#endif
diff --git a/include/mysql/psi/psi.h b/include/mysql/psi/psi.h
index 30f2709be0f..49202c4e88f 100644
--- a/include/mysql/psi/psi.h
+++ b/include/mysql/psi/psi.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2015, 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
@@ -43,18 +43,8 @@
C_MODE_START
struct TABLE_SHARE;
-/*
- There are 3 known bison parsers in the server:
- - (1) the SQL parser itself, sql/sql_yacc.yy
- - (2) storage/innobase/fts/fts0pars.y
- - (3) storage/innobase/pars/pars0grm.y
- What is instrumented here are the tokens from the SQL query text (1),
- to make digests.
- Now, to avoid name pollution and conflicts with different YYSTYPE definitions,
- an opaque structure is used here.
- The real type to use when invoking the digest api is LEX_YYSTYPE.
-*/
-struct OPAQUE_LEX_YYSTYPE;
+
+struct sql_digest_storage;
/**
@file mysql/psi/psi.h
@@ -952,29 +942,6 @@ struct PSI_table_locker_state_v1
uint m_index;
};
-#define PSI_MAX_DIGEST_STORAGE_SIZE 1024
-
-/**
- Structure to store token count/array for a statement
- on which digest is to be calculated.
-*/
-struct PSI_digest_storage
-{
- my_bool m_full;
- int m_byte_count;
- /** Character set number. */
- uint m_charset_number;
- unsigned char m_token_array[PSI_MAX_DIGEST_STORAGE_SIZE];
-};
-typedef struct PSI_digest_storage PSI_digest_storage;
-
-struct PSI_digest_locker_state
-{
- int m_last_id_index;
- PSI_digest_storage m_digest_storage;
-};
-typedef struct PSI_digest_locker_state PSI_digest_locker_state;
-
/* Duplicate of NAME_LEN, to avoid dependency on mysql_com.h */
#define PSI_SCHEMA_NAME_LEN (64 * 3)
@@ -1037,7 +1004,7 @@ struct PSI_statement_locker_state_v1
/** Metric, number of sort scans. */
ulong m_sort_scan;
/** Statement digest. */
- PSI_digest_locker_state m_digest_state;
+ const struct sql_digest_storage *m_digest;
/** Current schema name. */
char m_schema_name[PSI_SCHEMA_NAME_LEN];
/** Length in bytes of @c m_schema_name. */
@@ -1902,11 +1869,15 @@ typedef void (*set_socket_info_v1_t)(struct PSI_socket *socket,
*/
typedef void (*set_socket_thread_owner_v1_t)(struct PSI_socket *socket);
+/**
+ Get a digest locker for the current statement.
+ @param locker a statement locker for the running thread
+*/
typedef struct PSI_digest_locker * (*digest_start_v1_t)
(struct PSI_statement_locker *locker);
-typedef struct PSI_digest_locker* (*digest_add_token_v1_t)
- (struct PSI_digest_locker *locker, uint token, struct OPAQUE_LEX_YYSTYPE *yylval);
+typedef void (*digest_end_v1_t)
+ (struct PSI_digest_locker *locker, const struct sql_digest_storage *digest);
/**
Stores an array of connection attributes
@@ -2118,8 +2089,8 @@ struct PSI_v1
set_socket_thread_owner_v1_t set_socket_thread_owner;
/** @sa digest_start_v1_t. */
digest_start_v1_t digest_start;
- /** @sa digest_add_token_v1_t. */
- digest_add_token_v1_t digest_add_token;
+ /** @sa digest_end_v1_t. */
+ digest_end_v1_t digest_end;
/** @sa set_thread_connect_attrs_v1_t. */
set_thread_connect_attrs_v1_t set_thread_connect_attrs;
};
@@ -2414,6 +2385,10 @@ extern MYSQL_PLUGIN_IMPORT PSI *PSI_server;
#define PSI_STATEMENT_CALL(M) PSI_DYNAMIC_CALL(M)
#endif
+#ifndef PSI_DIGEST_CALL
+#define PSI_DIGEST_CALL(M) PSI_DYNAMIC_CALL(M)
+#endif
+
#ifndef PSI_TABLE_CALL
#define PSI_TABLE_CALL(M) PSI_DYNAMIC_CALL(M)
#endif
diff --git a/include/mysql/psi/psi_abi_v0.h.pp b/include/mysql/psi/psi_abi_v0.h.pp
index b46b38ed144..17d61016a68 100644
--- a/include/mysql/psi/psi_abi_v0.h.pp
+++ b/include/mysql/psi/psi_abi_v0.h.pp
@@ -1,7 +1,7 @@
#include "mysql/psi/psi.h"
C_MODE_START
struct TABLE_SHARE;
-struct OPAQUE_LEX_YYSTYPE;
+struct sql_digest_storage;
struct PSI_mutex;
typedef struct PSI_mutex PSI_mutex;
struct PSI_rwlock;
diff --git a/include/mysql/psi/psi_abi_v1.h.pp b/include/mysql/psi/psi_abi_v1.h.pp
index fa2bf724b5e..e9b514feb8a 100644
--- a/include/mysql/psi/psi_abi_v1.h.pp
+++ b/include/mysql/psi/psi_abi_v1.h.pp
@@ -1,7 +1,6 @@
-#include "mysql/psi/psi.h"
C_MODE_START
struct TABLE_SHARE;
-struct OPAQUE_LEX_YYSTYPE;
+struct sql_digest_storage;
struct PSI_mutex;
typedef struct PSI_mutex PSI_mutex;
struct PSI_rwlock;
@@ -241,20 +240,6 @@ struct PSI_table_locker_state_v1
void *m_wait;
uint m_index;
};
-struct PSI_digest_storage
-{
- my_bool m_full;
- int m_byte_count;
- uint m_charset_number;
- unsigned char m_token_array[1024];
-};
-typedef struct PSI_digest_storage PSI_digest_storage;
-struct PSI_digest_locker_state
-{
- int m_last_id_index;
- PSI_digest_storage m_digest_storage;
-};
-typedef struct PSI_digest_locker_state PSI_digest_locker_state;
struct PSI_statement_locker_state_v1
{
my_bool m_discarded;
@@ -280,7 +265,7 @@ struct PSI_statement_locker_state_v1
ulong m_sort_range;
ulong m_sort_rows;
ulong m_sort_scan;
- PSI_digest_locker_state m_digest_state;
+ const struct sql_digest_storage *m_digest;
char m_schema_name[(64 * 3)];
uint m_schema_name_length;
};
@@ -508,8 +493,8 @@ typedef void (*set_socket_info_v1_t)(struct PSI_socket *socket,
typedef void (*set_socket_thread_owner_v1_t)(struct PSI_socket *socket);
typedef struct PSI_digest_locker * (*digest_start_v1_t)
(struct PSI_statement_locker *locker);
-typedef struct PSI_digest_locker* (*digest_add_token_v1_t)
- (struct PSI_digest_locker *locker, uint token, struct OPAQUE_LEX_YYSTYPE *yylval);
+typedef void (*digest_end_v1_t)
+ (struct PSI_digest_locker *locker, const struct sql_digest_storage *digest);
typedef int (*set_thread_connect_attrs_v1_t)(const char *buffer, uint length,
const void *from_cs);
struct PSI_v1
@@ -610,7 +595,7 @@ struct PSI_v1
set_socket_info_v1_t set_socket_info;
set_socket_thread_owner_v1_t set_socket_thread_owner;
digest_start_v1_t digest_start;
- digest_add_token_v1_t digest_add_token;
+ digest_end_v1_t digest_end;
set_thread_connect_attrs_v1_t set_thread_connect_attrs;
};
typedef struct PSI_v1 PSI;
diff --git a/include/mysql/psi/psi_abi_v2.h.pp b/include/mysql/psi/psi_abi_v2.h.pp
index 458013b43e4..4e81fd66ca4 100644
--- a/include/mysql/psi/psi_abi_v2.h.pp
+++ b/include/mysql/psi/psi_abi_v2.h.pp
@@ -1,7 +1,6 @@
-#include "mysql/psi/psi.h"
C_MODE_START
struct TABLE_SHARE;
-struct OPAQUE_LEX_YYSTYPE;
+struct sql_digest_storage;
struct PSI_mutex;
typedef struct PSI_mutex PSI_mutex;
struct PSI_rwlock;
diff --git a/include/mysql_com.h b/include/mysql_com.h
index 43be28f87a0..8fdac38dd66 100644
--- a/include/mysql_com.h
+++ b/include/mysql_com.h
@@ -618,14 +618,17 @@ void scramble_323(char *to, const char *message, const char *password);
my_bool check_scramble_323(const unsigned char *reply, const char *message,
unsigned long *salt);
void get_salt_from_password_323(unsigned long *res, const char *password);
+#if MYSQL_VERSION_ID < 100100
void make_password_from_salt_323(char *to, const unsigned long *salt);
-
+#endif
void make_scrambled_password(char *to, const char *password);
void scramble(char *to, const char *message, const char *password);
my_bool check_scramble(const unsigned char *reply, const char *message,
const unsigned char *hash_stage2);
void get_salt_from_password(unsigned char *res, const char *password);
+#if MYSQL_VERSION_ID < 100100
void make_password_from_salt(char *to, const unsigned char *hash_stage2);
+#endif
char *octet2hex(char *to, const char *str, unsigned int len);
/* end of password.c */
diff --git a/include/violite.h b/include/violite.h
index 68b2b6c5e52..401826c1172 100644
--- a/include/violite.h
+++ b/include/violite.h
@@ -150,7 +150,7 @@ enum enum_ssl_init_error
{
SSL_INITERR_NOERROR= 0, SSL_INITERR_CERT, SSL_INITERR_KEY,
SSL_INITERR_NOMATCH, SSL_INITERR_BAD_PATHS, SSL_INITERR_CIPHERS,
- SSL_INITERR_MEMFAIL, SSL_INITERR_LASTERR
+ SSL_INITERR_MEMFAIL, SSL_INITERR_DH, SSL_INITERR_LASTERR
};
const char* sslGetErrString(enum enum_ssl_init_error err);
diff --git a/include/welcome_copyright_notice.h b/include/welcome_copyright_notice.h
index 956a9f1c17a..096d42446bc 100644
--- a/include/welcome_copyright_notice.h
+++ b/include/welcome_copyright_notice.h
@@ -1,5 +1,5 @@
-/* Copyright (c) 2011, 2014, Oracle and/or its affiliates.
- Copyright (c) 2011, 2012, Monty Program Ab
+/* Copyright (c) 2011, 2015, Oracle and/or its affiliates.
+ Copyright (c) 2011, 2015, MariaDB
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
@@ -17,7 +17,7 @@
#ifndef _welcome_copyright_notice_h_
#define _welcome_copyright_notice_h_
-#define COPYRIGHT_NOTICE_CURRENT_YEAR "2014"
+#define COPYRIGHT_NOTICE_CURRENT_YEAR "2015"
/*
This define specifies copyright notice which is displayed by every MySQL
diff --git a/libmysql/CMakeLists.txt b/libmysql/CMakeLists.txt
index bb85b47f863..7dfc572b281 100644
--- a/libmysql/CMakeLists.txt
+++ b/libmysql/CMakeLists.txt
@@ -259,6 +259,9 @@ mariadb_dyncol_column_count
mariadb_dyncol_prepare_decimal
#
mariadb_deinitialize_ssl
+# low-level API to MySQL protocol
+mysql_net_read_packet
+mysql_net_field_length
# Added in MariaDB-10.0 to stay compatible with MySQL-5.6, yuck!
mysql_options4
)
@@ -378,7 +381,7 @@ IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
CONFIGURE_FILE(
${VERSION_SCRIPT_TEMPLATE}
${CMAKE_CURRENT_BINARY_DIR}/libmysql_versions.ld
- @ONLY@
+ @ONLY
)
SET(VERSION_SCRIPT_LINK_FLAGS
"-Wl,${CMAKE_CURRENT_BINARY_DIR}/libmysql_versions.ld")
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index a0bfe4e0d4f..3af4a032e5b 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -1508,6 +1508,12 @@ my_bool cli_read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt)
memory
*/
+#ifdef EMBEDDED_LIBRARY
+#define STMT_INIT_PREALLOC(S) 0
+#else
+#define STMT_INIT_PREALLOC(S) S
+#endif /*EMBEDDED_LIBRARY*/
+
MYSQL_STMT * STDCALL
mysql_stmt_init(MYSQL *mysql)
{
@@ -1526,8 +1532,10 @@ mysql_stmt_init(MYSQL *mysql)
DBUG_RETURN(NULL);
}
- init_alloc_root(&stmt->mem_root, 2048, 2048, MYF(MY_THREAD_SPECIFIC));
- init_alloc_root(&stmt->result.alloc, 4096, 4096, MYF(MY_THREAD_SPECIFIC));
+ init_alloc_root(&stmt->mem_root, 2048, STMT_INIT_PREALLOC(2048),
+ MYF(MY_THREAD_SPECIFIC));
+ init_alloc_root(&stmt->result.alloc, 4096, STMT_INIT_PREALLOC(4096),
+ MYF(MY_THREAD_SPECIFIC));
stmt->result.alloc.min_malloc= sizeof(MYSQL_ROWS);
mysql->stmts= list_add(mysql->stmts, &stmt->list);
stmt->list.data= stmt;
@@ -1544,6 +1552,8 @@ mysql_stmt_init(MYSQL *mysql)
DBUG_RETURN(stmt);
}
+#undef STMT_INIT_PREALLOC
+
/*
Prepare server side statement with query.
@@ -4901,3 +4911,20 @@ my_bool STDCALL mysql_read_query_result(MYSQL *mysql)
return (*mysql->methods->read_query_result)(mysql);
}
+/********************************************************************
+ mysql_net_ functions - low-level API to MySQL protocol
+*********************************************************************/
+#if MYSQL_VERSION_ID > 100100
+#error remove these wrappers in 10.1, rename functions instead
+#endif
+
+ulong STDCALL mysql_net_read_packet(MYSQL *mysql)
+{
+ return cli_safe_read(mysql);
+}
+
+ulong STDCALL mysql_net_field_length(uchar **packet)
+{
+ return net_field_length(packet);
+}
+
diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt
index 0920be53baf..a244a41f4f6 100644
--- a/libmysqld/CMakeLists.txt
+++ b/libmysqld/CMakeLists.txt
@@ -44,7 +44,7 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
../sql-common/client_plugin.c ../sql-common/mysql_async.c
../sql/password.c ../sql/discover.cc ../sql/derror.cc
../sql/field.cc ../sql/field_conv.cc
- ../sql/filesort_utils.cc
+ ../sql/filesort_utils.cc ../sql/sql_digest.cc
../sql/filesort.cc ../sql/gstream.cc ../sql/slave.cc
../sql/signal_handler.cc
../sql/handler.cc ../sql/hash_filo.cc ../sql/hostname.cc
diff --git a/mysql-test/extra/binlog_tests/database.test b/mysql-test/extra/binlog_tests/database.test
index d071415bf65..cd0266434ff 100644
--- a/mysql-test/extra/binlog_tests/database.test
+++ b/mysql-test/extra/binlog_tests/database.test
@@ -31,12 +31,47 @@ source include/show_binlog_events.inc;
FLUSH STATUS;
+--echo
+--echo # 'DROP TABLE IF EXISTS <deleted tables>' is binlogged
+--echo # when 'DROP DATABASE' fails and at least one table is deleted
+--echo # from the database.
+RESET MASTER;
+CREATE DATABASE testing_1;
+USE testing_1;
+CREATE TABLE t1(c1 INT);
+CREATE TABLE t2(c1 INT);
+
+let $prefix= `SELECT UUID()`;
+--echo # Create a file in the database directory
+--replace_result $prefix FAKE_FILE
+eval SELECT 'hello' INTO OUTFILE 'fake_file.$prefix';
+
+--echo
+--echo # 'DROP DATABASE' will fail if there is any other file in the the
+--echo # database directory
+
+# Use '/' instead of '\' in the error message. On windows platform, dir is
+# formed with '\'.
+--replace_regex /\\testing_1\\*/\/testing_1\// /66/39/
+--error 1010
+DROP DATABASE testing_1;
+let $wait_binlog_event= DROP TABLE IF EXIST;
+source include/wait_for_binlog_event.inc;
+let $MYSQLD_DATADIR= `SELECT @@datadir`;
+
+--echo
+--echo # Remove the fake file.
+--remove_file $MYSQLD_DATADIR/testing_1/fake_file.$prefix
+--echo # Now we can drop the database.
+DROP DATABASE testing_1;
+
--echo #
--echo # Bug#11765416 58381: FAILED DROP DATABASE CAN BREAK STATEMENT
--echo # BASED REPLICATION
--echo #
+USE test;
--disable_warnings
DROP DATABASE IF EXISTS db1;
DROP TABLE IF EXISTS t3;
diff --git a/mysql-test/extra/rpl_tests/rpl_row_annotate.test b/mysql-test/extra/rpl_tests/rpl_row_annotate.test
index f3d8006ce01..0614ca97f1d 100644
--- a/mysql-test/extra/rpl_tests/rpl_row_annotate.test
+++ b/mysql-test/extra/rpl_tests/rpl_row_annotate.test
@@ -101,6 +101,35 @@ if (!$annotate)
{
--echo # No Annotate_rows events should appear below
}
+
+
+
+--echo ########################################################################
+--echo # Ensure that a replication failure doesn't segfault - MDEV-7864
+--echo ########################################################################
+DELETE FROM t3 WHERE a=2;
+connection master;
+INSERT INTO t5 (a) SELECT a.a*10000+b.a*1000+c.a*100+d.a*10 FROM t5 a, t5 b, t5 c, t5 d;
+INSERT INTO t3 (a) SELECT a FROM t5 WHERE a > 10;
+DELETE t3 FROM t3 INNER JOIN t5 ON t3.a=t5.a;
+connection slave;
+--echo ---- Wait until slave stops with an error ----
+# Wait until the slave tries to run the query, fails with key not
+# found error, and stops the SQL thread.
+let $slave_sql_errno= 1032; # Can't find record
+source include/wait_for_slave_sql_error.inc;
+--let $err= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1)
+--replace_regex /end_log_pos [0-9]+/end_log_pos END_LOG_POS/
+--disable_query_log
+--eval SELECT "$err" as 'Last_SQL_Error (expected "Delete_rows_v1 event on table test1.t3; Can\'t find record in \'t3\'" error)'
+--enable_query_log
+call mtr.add_suppression("Slave: Can't find record in 't3' Error_code: 1032");
+
+SET GLOBAL sql_slave_skip_counter=1;
+START SLAVE;
+connection master;
+sync_slave_with_master;
+
--echo ########################################################################
FLUSH LOGS;
diff --git a/mysql-test/include/ctype_utf8_ilseq.inc b/mysql-test/include/ctype_utf8_ilseq.inc
new file mode 100644
index 00000000000..c400731c07f
--- /dev/null
+++ b/mysql-test/include/ctype_utf8_ilseq.inc
@@ -0,0 +1,114 @@
+#
+# Compare a field to an utf8 string literal with illegal byte sequences
+#
+
+--echo #
+--echo # Start of ctype_utf8_ilseq.inc
+--echo #
+
+--eval CREATE TABLE t1 ENGINE=$ENGINE AS SELECT REPEAT(' ', 60) AS ch LIMIT 0;
+ALTER TABLE t1
+ ADD id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ ADD KEY(ch);
+SHOW CREATE TABLE t1;
+
+INSERT INTO t1 (ch) VALUES ('admin'),('admin1');
+SELECT ch FROM t1 WHERE ch='adminðŒ†';
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='adminðŒ†';
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='adminðŒ†';
+DELETE FROM t1;
+INSERT INTO t1 (ch) VALUES ('a'), ('a?'), ('a??'), ('a???'), ('a????');
+INSERT INTO t1 (ch) VALUES ('ab'),('a?b'),('a??b'),('a???b'),('a????b');
+INSERT INTO t1 (ch) VALUES ('az'),('a?z'),('a??z'),('a???z'),('a????z');
+INSERT INTO t1 (ch) VALUES ('z');
+# LATIN SMALL LETTER A + LATIN CAPITAL LETTER E WITH GRAVE
+INSERT INTO t1 (ch) VALUES (_utf8 0x61D080);
+# LATIN SMALL LETTER A + ARMENIAN SMALL LETTER REH
+INSERT INTO t1 (ch) VALUES (_utf8 0x61D680);
+
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch;
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch;
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch;
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch;
+
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch;
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'aðŒ†b' ORDER BY ch;
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch;
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†b' ORDER BY ch;
+
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch;
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch;
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch;
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch;
+
+ALTER TABLE t1 DROP KEY ch;
+
+--echo # 0xD18F would be a good 2-byte character, 0xD1 is an incomplete sequence
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xD1,'''');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xD1,'b''');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+
+#
+# Non-equality comparison currently work differently depending on collation:
+#
+# - utf8_general_ci falls back to memcmp() on bad byte
+# - utf8_unicode_ci treats bad bytes greater than any valid character
+#
+# For example, these two characters:
+# _utf8 0xD080 (U+00C8 LATIN CAPITAL LETTER E WITH GRAVE)
+# _utf8 0xD680 (U+0580 ARMENIAN SMALL LETTER REH)
+#
+# will give different results (depending on collation) when compared
+# to an incomplete byte sequence 0xD1 (mb2head not followed by mb2tail).
+#
+# For utf8_general_ci the result depends on the valid side:
+# - 0xD080 is smaller than 0xD1, because 0xD0 < 0xD1
+# - 0xD680 is greater than 0xD1, because 0xD6 > 0xD1
+#
+# For utf8_unicode_ci the result does not depend on the valid side:
+# - 0xD080 is smaller than 0xD1, because 0xD1 is greater than any valid character
+# - 0xD680 is smaller than 0xD1, because 0xD1 is greater than any valid character
+#
+# utf8_general_ci should be eventually fixed to treat bad bytes greater
+# than any valid character, similar to utf8_unicode_ci.
+#
+
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch<''a', 0xD1,''' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch>''a', 0xD1,''' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+
+--echo # 0xEA9A96 would be a good 3-byte character, 0xEA9A is an incomplete sequence
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xEA9A,''' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xEA9A,'b'' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+
+--echo # 0x8F is a bad byte sequence (an mb2tail without mb2head)
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0x8F,''' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0x8F,'b'' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+
+--echo # 0x8F8F is a bad byte sequence (an mb2tail without mb2head, two times)
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0x8F8F,''' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0x8F8F,'b'' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+
+DROP TABLE t1;
+
+--echo #
+--echo # End of ctype_utf8_ilseq.inc
+--echo #
diff --git a/mysql-test/include/default_mysqld.cnf b/mysql-test/include/default_mysqld.cnf
index 33881666b57..04321475691 100644
--- a/mysql-test/include/default_mysqld.cnf
+++ b/mysql-test/include/default_mysqld.cnf
@@ -31,6 +31,7 @@ debug-no-sync
# Retry bind as this may fail on busy server
port-open-timeout=10
+bind-address=127.0.0.1
log-bin-trust-function-creators=1
key_buffer_size= 1M
diff --git a/mysql-test/include/have_ipv6.inc b/mysql-test/include/have_ipv6.inc
deleted file mode 100644
index 752dd0db53e..00000000000
--- a/mysql-test/include/have_ipv6.inc
+++ /dev/null
@@ -1,20 +0,0 @@
-# Check if ipv6 is available.
-#
---disable_query_log
---disable_result_log
---disable_abort_on_error
-connect (checkcon123456789,::1,root,,test);
-if($mysql_errno)
-{
- skip No IPv6 support;
-}
-connection default;
-if(!$mysql_errno)
-{
- disconnect checkcon123456789;
-}
---enable_abort_on_error
---enable_result_log
---enable_query_log
-# end check
-
diff --git a/mysql-test/include/mtr_warnings.sql b/mysql-test/include/mtr_warnings.sql
index 9d97d23897c..345968cd3f0 100644
--- a/mysql-test/include/mtr_warnings.sql
+++ b/mysql-test/include/mtr_warnings.sql
@@ -227,6 +227,12 @@ INSERT INTO global_suppressions VALUES
("Slave I/O: Notifying master by SET @master_binlog_checksum= @@global.binlog_checksum failed with error.*"),
("Slave I/O: Setting master-side filtering of @@skip_replication failed with error:.*"),
("Slave I/O: Setting @mariadb_slave_capability failed with error:.*"),
+ ("Slave I/O: Get master @@GLOBAL.gtid_domain_id failed with error.*"),
+ ("Slave I/O: Setting @slave_connect_state failed with error.*"),
+ ("Slave I/O: Setting @slave_gtid_strict_mode failed with error.*"),
+ ("Slave I/O: Setting @slave_gtid_ignore_duplicates failed with error.*"),
+ ("Slave I/O: Setting @slave_until_gtid failed with error.*"),
+ ("Slave I/O: Get master GTID position failed with error.*"),
("THE_LAST_SUPPRESSION")||
diff --git a/mysql-test/suite/perfschema/include/no_protocol.inc b/mysql-test/include/no_protocol.inc
index 451c22f62e3..8ffd3509afc 100644
--- a/mysql-test/suite/perfschema/include/no_protocol.inc
+++ b/mysql-test/include/no_protocol.inc
@@ -1,5 +1,3 @@
-# Tests for the performance schema
-
# The file with expected results fits only to a run without
# ps-protocol/sp-protocol/cursor-protocol/view-protocol.
if (`SELECT $PS_PROTOCOL + $SP_PROTOCOL + $CURSOR_PROTOCOL
diff --git a/mysql-test/include/show_slave_status.inc b/mysql-test/include/show_slave_status.inc
index 55eb83c25e5..ba2e1b0c48a 100644
--- a/mysql-test/include/show_slave_status.inc
+++ b/mysql-test/include/show_slave_status.inc
@@ -67,7 +67,21 @@
#
# --let $slave_sql_mode= NO_BACKSLASH_ESCAPES
#
-
+# $all_slaves_status
+# If set, use SHOW ALL SLAVES STATUS instead of SHOW SLAVE STATUS
+# and get the column values from all rows. Example:
+#
+# --let $all_slaves_status= 1
+#
+# $slave_name
+# If set, use SHOW SLAVE '<slave_name>' STATUS instead of SHOW SLAVE STATUS.
+# The name must be quoted (can be a quoted empty string).
+# Example:
+#
+# --let $slave_name= 'm1'
+#
+# Note: $all_slaves_status and $slave_name are mutually exclusive.
+#
--let $_show_slave_status_items=$status_items
if (!$status_items)
@@ -75,6 +89,21 @@ if (!$status_items)
--die Bug in test case: The mysqltest variable $status_items is not set.
}
+--let $_show_query=SHOW SLAVE STATUS
+
+if ($all_slaves_status)
+{
+ if ($slave_name)
+ {
+ --die Bug in test case: Both $all_slaves_status and $slave_name are set.
+ }
+ --let $_show_query=SHOW ALL SLAVES STATUS
+}
+if ($slave_name)
+{
+ --let $_show_query=SHOW SLAVE $slave_name STATUS
+}
+
--let $_slave_sql_mode= NO_BACKSLASH_ESCAPES
if ($slave_sql_mode)
@@ -86,18 +115,27 @@ if ($slave_sql_mode)
eval SET sql_mode= '$_slave_sql_mode';
--enable_query_log
+--let $_slave_field_result_replace= /[\\\\]/\// $slave_field_result_replace
while ($_show_slave_status_items)
{
--let $_show_slave_status_name= `SELECT SUBSTRING_INDEX('$_show_slave_status_items', ',', 1)`
--let $_show_slave_status_items= `SELECT LTRIM(SUBSTRING('$_show_slave_status_items', LENGTH('$_show_slave_status_name') + 2))`
- --replace_regex /\.[\\\/]master/master/
- --let $_show_slave_status_value= query_get_value(SHOW SLAVE STATUS, $_show_slave_status_name, 1)
- --let $_slave_field_result_replace= /[\\\\]/\// $slave_field_result_replace
- --replace_regex $_slave_field_result_replace
- --let $_show_slave_status_value= `SELECT REPLACE("$_show_slave_status_value", '$MYSQL_TEST_DIR', 'MYSQL_TEST_DIR')`
- --echo $_show_slave_status_name = '$_show_slave_status_value'
+ --let $num= 1
+ --let $_show_slave_status_value=
+ while ($_show_slave_status_value != 'No such row')
+ {
+ --replace_regex /\.[\\\/]master/master/
+ --let $_show_slave_status_value= query_get_value($_show_query, $_show_slave_status_name, $num)
+ if ($_show_slave_status_value != 'No such row')
+ {
+ --replace_regex $_slave_field_result_replace
+ --let $_show_slave_status_value= `SELECT REPLACE("$_show_slave_status_value", '$MYSQL_TEST_DIR', 'MYSQL_TEST_DIR')`
+ --echo $_show_slave_status_name = '$_show_slave_status_value'
+ --inc $num
+ }
+ }
}
diff --git a/mysql-test/include/shutdown_mysqld.inc b/mysql-test/include/shutdown_mysqld.inc
new file mode 100644
index 00000000000..54bba1318e7
--- /dev/null
+++ b/mysql-test/include/shutdown_mysqld.inc
@@ -0,0 +1,18 @@
+# This is the first half of include/restart_mysqld.inc.
+if ($rpl_inited)
+{
+ if (!$allow_rpl_inited)
+ {
+ --die ERROR IN TEST: When using the replication test framework (master-slave.inc, rpl_init.inc etc), use rpl_restart_server.inc instead of restart_mysqld.inc. If you know what you are doing and you really have to use restart_mysqld.inc, set allow_rpl_inited=1 before you source restart_mysqld.inc
+ }
+}
+
+# Write file to make mysql-test-run.pl expect the "crash", but don't start it
+--let $_server_id= `SELECT @@server_id`
+--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect
+--exec echo "wait" > $_expect_file_name
+
+# Send shutdown to the connected server
+--shutdown_server
+--source include/wait_until_disconnected.inc
+
diff --git a/mysql-test/include/start_mysqld.inc b/mysql-test/include/start_mysqld.inc
new file mode 100644
index 00000000000..983c566821e
--- /dev/null
+++ b/mysql-test/include/start_mysqld.inc
@@ -0,0 +1,14 @@
+# Include this script only after using shutdown_mysqld.inc
+# where $_expect_file_name was initialized.
+# Write file to make mysql-test-run.pl start up the server again
+--exec echo "restart" > $_expect_file_name
+
+# Turn on reconnect
+--enable_reconnect
+
+# Call script that will poll the server waiting for it to be back online again
+--source include/wait_until_connected_again.inc
+
+# Turn off reconnect again
+--disable_reconnect
+
diff --git a/mysql-test/lib/My/SafeProcess/safe_process.cc b/mysql-test/lib/My/SafeProcess/safe_process.cc
index d6110f5f8c8..feb3eb4df66 100644
--- a/mysql-test/lib/My/SafeProcess/safe_process.cc
+++ b/mysql-test/lib/My/SafeProcess/safe_process.cc
@@ -125,7 +125,7 @@ extern "C" void handle_abort(int sig)
message("Got signal %d, child_pid: %d, sending ABRT", sig, child_pid);
if (child_pid > 0) {
- kill (-child_pid, SIGABRT); // Don't wait for it to terminate
+ kill(-child_pid, SIGABRT); // Don't wait for it to terminate
}
}
@@ -226,6 +226,18 @@ int main(int argc, char* const argv[] )
sleep(1);
}
+ /*
+ Child: Make this process it's own process group to be able to kill
+ it and any its children that hasn't changed a group themselves)
+
+ Parent: Detach from the parent's process group, so that killing a parent
+ group wouldn't kill us (if we're killed, there's no one to kill our child
+ processes that run in their own process group). There's a loop below
+ that monitors the parent, it's enough.
+ */
+ setpgid(0, 0);
+
+
if (child_pid == 0)
{
close(pfd[0]); // Close unused read end
@@ -236,10 +248,6 @@ int main(int argc, char* const argv[] )
signal(SIGHUP, SIG_DFL);
signal(SIGCHLD, SIG_DFL);
- // Make this process it's own process group to be able to kill
- // it and any childs(that hasn't changed group themself)
- setpgid(0, 0);
-
if (nocore)
{
struct rlimit corelim = { 0, 0 };
diff --git a/mysql-test/lib/generate-ssl-certs.sh b/mysql-test/lib/generate-ssl-certs.sh
new file mode 100755
index 00000000000..5dca21a755d
--- /dev/null
+++ b/mysql-test/lib/generate-ssl-certs.sh
@@ -0,0 +1,30 @@
+#/bin/sh -xe
+
+# simply run me from mysql-test/
+cd std_data/
+
+# boilerplace for "openssl ca" and /etc/ssl/openssl.cnf
+rm -rf demoCA
+mkdir demoCA demoCA/private demoCA/newcerts
+touch demoCA/index.txt
+echo 01 > demoCA/serial
+
+# CA certificate, self-signed
+openssl req -x509 -newkey rsa:2048 -keyout demoCA/private/cakey.pem -out cacert.pem -days 7300 -nodes -subj '/CN=cacert/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB' -text
+
+# server certificate signing request and private key. Note the very long subject (for MDEV-7859)
+openssl req -newkey rsa:1024 -keyout server-key.pem -out demoCA/server-req.pem -days 7300 -nodes -subj '/CN=localhost/C=FI/ST=state or province within country, in other certificates in this file it is the same as L/L=location, usually an address but often ambiguously used/OU=organizational unit name, a division name within an organization/O=organization name, typically a company name'
+# convert the key to yassl compatible format
+openssl rsa -in server-key.pem -out server-key.pem
+# sign the server certificate with CA certificate
+openssl ca -days 7300 -batch -cert cacert.pem -policy policy_anything -out server-cert.pem -infiles demoCA/server-req.pem
+
+openssl req -newkey rsa:8192 -keyout server8k-key.pem -out demoCA/server8k-req.pem -days 7300 -nodes -subj '/CN=server8k/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB'
+openssl rsa -in server8k-key.pem -out server8k-key.pem
+openssl ca -days 7300 -batch -cert cacert.pem -policy policy_anything -out server8k-cert.pem -infiles demoCA/server8k-req.pem
+
+openssl req -newkey rsa:1024 -keyout client-key.pem -out demoCA/client-req.pem -days 7300 -nodes -subj '/CN=client/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB'
+openssl rsa -in client-key.pem -out client-key.pem
+openssl ca -days 7300 -batch -cert cacert.pem -policy policy_anything -out client-cert.pem -infiles demoCA/client-req.pem
+
+rm -rf demoCA
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index ae037c2485e..befd47d9c94 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -1036,15 +1036,7 @@ sub ignore_option {
# Setup any paths that are $opt_vardir related
sub set_vardir {
- my ($vardir)= @_;
- if(IS_WINDOWS)
- {
- $opt_vardir= $vardir;
- }
- else
- {
- $opt_vardir= realpath($vardir);
- }
+ ($opt_vardir)= @_;
$path_vardir_trace= $opt_vardir;
# Chop off any "c:", DBUG likes a unix path ex: c:/src/... => /src/...
@@ -1478,7 +1470,7 @@ sub command_line_setup {
# Search through list of locations that are known
# to be "fast disks" to find a suitable location
# Use --mem=<dir> as first location to look.
- my @tmpfs_locations= ($opt_mem, "/dev/shm", "/tmp");
+ my @tmpfs_locations= ($opt_mem,"/run/shm", "/dev/shm", "/tmp");
foreach my $fs (@tmpfs_locations)
{
@@ -1494,15 +1486,11 @@ sub command_line_setup {
# --------------------------------------------------------------------------
# Set the "var/" directory, the base for everything else
# --------------------------------------------------------------------------
- if(defined $ENV{MTR_BINDIR})
- {
- $default_vardir= "$ENV{MTR_BINDIR}/mysql-test/var";
- }
- else
- {
- $default_vardir= "$glob_mysql_test_dir/var";
- }
- $default_vardir = realpath $default_vardir unless IS_WINDOWS;
+ my $vardir_location= (defined $ENV{MTR_BINDIR}
+ ? "$ENV{MTR_BINDIR}/mysql-test"
+ : $glob_mysql_test_dir);
+ $vardir_location= realpath $vardir_location unless IS_WINDOWS;
+ $default_vardir= "$vardir_location/var";
if ( ! $opt_vardir )
{
@@ -4834,6 +4822,12 @@ sub extract_warning_lines ($$) {
qr/Slave I\/O: Get master clock failed with error:.*/,
qr/Slave I\/O: Get master COLLATION_SERVER failed with error:.*/,
qr/Slave I\/O: Get master TIME_ZONE failed with error:.*/,
+ qr/Slave I\/O: Get master \@\@GLOBAL.gtid_domain_id failed with error:.*/,
+ qr/Slave I\/O: Setting \@slave_connect_state failed with error:.*/,
+ qr/Slave I\/O: Setting \@slave_gtid_strict_mode failed with error:.*/,
+ qr/Slave I\/O: Setting \@slave_gtid_ignore_duplicates failed with error:.*/,
+ qr/Slave I\/O: Setting \@slave_until_gtid failed with error:.*/,
+ qr/Slave I\/O: Get master GTID position failed with error:.*/,
qr/Slave I\/O: error reconnecting to master '.*' - retry-time: [1-3] retries/,
qr/Slave I\/0: Master command COM_BINLOG_DUMP failed/,
qr/Error reading packet/,
@@ -6437,7 +6431,7 @@ Options to control directories to use
mem Run testsuite in "memory" using tmpfs or ramdisk
Attempts to find a suitable location
using a builtin list of standard locations
- for tmpfs (/dev/shm)
+ for tmpfs (/run/shm, /dev/shm, /tmp)
The option can also be set using environment
variable MTR_MEM=[DIR]
clean-vardir Clean vardir if tests were successful and if
diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result
index ed6fd8b90bb..0975a5aa101 100644
--- a/mysql-test/r/alter_table.result
+++ b/mysql-test/r/alter_table.result
@@ -1488,6 +1488,17 @@ t2 CREATE TABLE `t2` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
DROP TABLE t1;
+CREATE TABLE t1 (
+`transaction_id` int(11) NOT NULL DEFAULT '0',
+KEY `transaction_id` (`transaction_id`));
+ALTER TABLE t1 DROP KEY IF EXISTS transaction_id, ADD PRIMARY KEY IF NOT EXISTS (transaction_id);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `transaction_id` int(11) NOT NULL DEFAULT '0',
+ PRIMARY KEY (`transaction_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
# Bug#11748057 (formerly known as 34972): ALTER TABLE statement doesn't
# identify correct column name.
#
@@ -1693,8 +1704,10 @@ INSERT INTO tm1 VALUES (1,1,1), (2,2,2);
INSERT INTO tm2 VALUES (1,1,1), (2,2,2);
ALTER TABLE ti1;
affected rows: 0
+info: Records: 0 Duplicates: 0 Warnings: 0
ALTER TABLE tm1;
affected rows: 0
+info: Records: 0 Duplicates: 0 Warnings: 0
ALTER TABLE ti1 ADD COLUMN d VARCHAR(200);
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
diff --git a/mysql-test/r/alter_table_online.result b/mysql-test/r/alter_table_online.result
index 02c7e5ac691..864ad724bc3 100644
--- a/mysql-test/r/alter_table_online.result
+++ b/mysql-test/r/alter_table_online.result
@@ -11,6 +11,10 @@ alter online table t1 comment "new comment";
ERROR 0A000: LOCK=NONE/SHARED is not supported for this operation. Try LOCK=EXCLUSIVE.
alter online table t1 rename to t2;
ERROR 0A000: LOCK=NONE/SHARED is not supported for this operation. Try LOCK=EXCLUSIVE.
+alter online table t1 algorithm=INPLACE, lock=NONE;
+alter online table t1;
+alter table t1 algorithm=INPLACE;
+alter table t1 lock=NONE;
drop table t1;
create temporary table t1 (a int not null primary key, b int, c varchar(80), e enum('a','b'));
insert into t1 (a) values (1),(2),(3);
diff --git a/mysql-test/r/blackhole.result b/mysql-test/r/blackhole.result
index 16a97927262..36f5459ff85 100644
--- a/mysql-test/r/blackhole.result
+++ b/mysql-test/r/blackhole.result
@@ -8,6 +8,13 @@ CREATE TABLE t2 (a INT UNSIGNED, b INT, UNIQUE KEY (a, b)) ENGINE=BLACKHOLE;
SELECT 1 FROM t1 WHERE a = ANY (SELECT a FROM t2);
1
DROP TABLE t1, t2;
+create temporary table t1 (a int) engine=blackhole;
+lock table t1 write;
+truncate table t1;
+select * from t1;
+a
+unlock tables;
+drop temporary table t1;
End of 5.5 tests
#
# Bug#13948247 DIVISION BY 0 IN GET_BEST_DISJUNCT_QUICK WITH FORCE INDEX GROUP BY
diff --git a/mysql-test/r/bootstrap.result b/mysql-test/r/bootstrap.result
index c4775a787f2..bb80cf28b56 100644
--- a/mysql-test/r/bootstrap.result
+++ b/mysql-test/r/bootstrap.result
@@ -15,3 +15,14 @@ SELECT 'bug' as '' FROM INFORMATION_SCHEMA.ENGINES WHERE engine='innodb'
and SUPPORT='YES';
End of 5.5 tests
+flush tables;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select * from mysql.plugin;
+name dl
+EXAMPLE ha_example.so
+truncate table mysql.plugin;
diff --git a/mysql-test/r/bug46261.result b/mysql-test/r/bug46261.result
deleted file mode 100644
index dcc950d1baf..00000000000
--- a/mysql-test/r/bug46261.result
+++ /dev/null
@@ -1,8 +0,0 @@
-#
-# Bug#46261 Plugins can be installed with --skip-grant-tables
-#
-INSTALL PLUGIN example SONAME 'ha_example.so';
-ERROR HY000: The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement
-UNINSTALL PLUGIN example;
-ERROR HY000: The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement
-End of 5.1 tests
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index ec70dba674f..fde821b801d 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -323,7 +323,7 @@ Level Code Message
Note 1050 Table 't1' already exists
show status like "Opened_tables";
Variable_name Value
-Opened_tables 2
+Opened_tables 1
select * from t1;
a b
1 1
diff --git a/mysql-test/r/ctype_binary.result b/mysql-test/r/ctype_binary.result
index f35e6fd8265..aead73b3090 100644
--- a/mysql-test/r/ctype_binary.result
+++ b/mysql-test/r/ctype_binary.result
@@ -3008,5 +3008,11 @@ Warnings:
Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ('%' = concat(`test`.`t1`.`c1`))
DROP TABLE t1;
#
+# MDEV-7629 Regression: Bit and hex string literals changed column names in 10.0.14
+#
+SELECT _binary 0x7E, _binary X'7E', _binary B'01111110';
+_binary 0x7E _binary X'7E' _binary B'01111110'
+~ ~ ~
+#
# End of 10.0 tests
#
diff --git a/mysql-test/r/ctype_create.result b/mysql-test/r/ctype_create.result
index 35461fce45a..4128be82c23 100644
--- a/mysql-test/r/ctype_create.result
+++ b/mysql-test/r/ctype_create.result
@@ -76,3 +76,35 @@ ALTER DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
ERROR 42000: Incorrect database name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
ALTER DATABASE `` DEFAULT CHARACTER SET latin2;
ERROR 42000: Incorrect database name ''
+USE test;
+#
+# Start of 10.0 tests
+#
+#
+# MDEV-7387 Alter table xxx CHARACTER SET utf8, CONVERT TO CHARACTER SET latin1 should fail
+#
+CREATE TABLE t1 (a VARCHAR(10)) CHARACTER SET DEFAULT, CHARACTER SET utf8;
+ERROR HY000: Conflicting declarations: 'CHARACTER SET DEFAULT' and 'CHARACTER SET utf8'
+CREATE TABLE t1 (a VARCHAR(10)) CHARACTER SET utf8, CHARACTER SET DEFAULT;
+ERROR HY000: Conflicting declarations: 'CHARACTER SET utf8' and 'CHARACTER SET DEFAULT'
+CREATE TABLE t1 (a VARCHAR(10)) CHARACTER SET utf8, CHARACTER SET utf8;
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10)) CHARACTER SET DEFAULT, CHARACTER SET DEFAULT;
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1, b VARCHAR(10) CHARACTER SET utf8);
+ALTER TABLE t1 CONVERT TO CHARACTER SET utf8, CHARACTER SET latin1;
+ERROR HY000: Conflicting declarations: 'CHARACTER SET utf8' and 'CHARACTER SET latin1'
+ALTER TABLE t1 CONVERT TO CHARACTER SET utf8, CHARACTER SET DEFAULT;
+ERROR HY000: Conflicting declarations: 'CHARACTER SET utf8' and 'CHARACTER SET DEFAULT'
+ALTER TABLE t1 CONVERT TO CHARACTER SET latin1, CHARACTER SET utf8;
+ERROR HY000: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET utf8'
+ALTER TABLE t1 CONVERT TO CHARACTER SET latin1, CHARACTER SET DEFAULT;
+ERROR HY000: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET DEFAULT'
+ALTER TABLE t1 CONVERT TO CHARACTER SET DEFAULT, CHARACTER SET utf8;
+ERROR HY000: Conflicting declarations: 'CHARACTER SET latin5' and 'CHARACTER SET utf8'
+ALTER TABLE t1 CONVERT TO CHARACTER SET DEFAULT, CHARACTER SET latin1;
+ERROR HY000: Conflicting declarations: 'CHARACTER SET latin5' and 'CHARACTER SET latin1'
+DROP TABLE t1;
+#
+# End of 10.0 tests
+#
diff --git a/mysql-test/r/ctype_latin1.result b/mysql-test/r/ctype_latin1.result
index 970c067b25c..383ea3ca8f2 100644
--- a/mysql-test/r/ctype_latin1.result
+++ b/mysql-test/r/ctype_latin1.result
@@ -7907,5 +7907,11 @@ HEX(a) a
3F23 ?#
DROP TABLE t1;
#
+# MDEV-7629 Regression: Bit and hex string literals changed column names in 10.0.14
+#
+SELECT _latin1 0x7E, _latin1 X'7E', _latin1 B'01111110';
+_latin1 0x7E _latin1 X'7E' _latin1 B'01111110'
+~ ~ ~
+#
# End of 10.0 tests
#
diff --git a/mysql-test/r/ctype_uca.result b/mysql-test/r/ctype_uca.result
index 16b60aed07f..02809f3be22 100644
--- a/mysql-test/r/ctype_uca.result
+++ b/mysql-test/r/ctype_uca.result
@@ -6466,6 +6466,418 @@ a c1
10 => Ç„
drop table t1;
#
+# MDEV-7649 wrong result when comparing utf8 column with an invalid literal
+#
+SET NAMES utf8 COLLATE utf8_unicode_ci;
+#
+# Start of ctype_utf8_ilseq.inc
+#
+CREATE TABLE t1 ENGINE=MyISAM AS SELECT REPEAT(' ', 60) AS ch LIMIT 0;;
+ALTER TABLE t1
+ADD id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ADD KEY(ch);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `ch` varchar(60) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`id`),
+ KEY `ch` (`ch`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (ch) VALUES ('admin'),('admin1');
+SELECT ch FROM t1 WHERE ch='adminðŒ†';
+ch
+Warnings:
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='adminðŒ†';
+ch
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='adminðŒ†';
+ch
+Warnings:
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+DELETE FROM t1;
+INSERT INTO t1 (ch) VALUES ('a'), ('a?'), ('a??'), ('a???'), ('a????');
+INSERT INTO t1 (ch) VALUES ('ab'),('a?b'),('a??b'),('a???b'),('a????b');
+INSERT INTO t1 (ch) VALUES ('az'),('a?z'),('a??z'),('a???z'),('a????z');
+INSERT INTO t1 (ch) VALUES ('z');
+INSERT INTO t1 (ch) VALUES (_utf8 0x61D080);
+INSERT INTO t1 (ch) VALUES (_utf8 0x61D680);
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch;
+ch
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch;
+ch
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch;
+ch
+Warnings:
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch;
+ch
+Warnings:
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch;
+ch
+a
+a?
+a??
+a???
+a????
+a????b
+a????z
+a???b
+a???z
+a??b
+a??z
+a?b
+a?z
+ab
+az
+aЀ
+aÖ€
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'aðŒ†b' ORDER BY ch;
+ch
+a
+a?
+a??
+a???
+a????
+a????b
+a????z
+a???b
+a???z
+a??b
+a??z
+a?b
+a?z
+ab
+az
+aЀ
+aÖ€
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch;
+ch
+a
+a?
+a??
+a???
+a????
+a????b
+a????z
+a???b
+a???z
+a??b
+a??z
+a?b
+a?z
+ab
+az
+aЀ
+aÖ€
+Warnings:
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†b' ORDER BY ch;
+ch
+a
+a?
+a??
+a???
+a????
+a????b
+a????z
+a???b
+a???z
+a??b
+a??z
+a?b
+a?z
+ab
+az
+aЀ
+aÖ€
+Warnings:
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch;
+ch
+z
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch;
+ch
+z
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch;
+ch
+z
+Warnings:
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch;
+ch
+z
+Warnings:
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
+ALTER TABLE t1 DROP KEY ch;
+# 0xD18F would be a good 2-byte character, 0xD1 is an incomplete sequence
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xD1,'''');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xD1,'b''');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch<''a', 0xD1,''' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+a
+a?
+a??
+a???
+a????
+a????b
+a????z
+a???b
+a???z
+a??b
+a??z
+a?b
+a?z
+ab
+az
+aЀ
+aÖ€
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch>''a', 0xD1,''' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+z
+# 0xEA9A96 would be a good 3-byte character, 0xEA9A is an incomplete sequence
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xEA9A,''' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xEA9A,'b'' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+# 0x8F is a bad byte sequence (an mb2tail without mb2head)
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0x8F,''' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0x8F,'b'' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+# 0x8F8F is a bad byte sequence (an mb2tail without mb2head, two times)
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0x8F8F,''' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0x8F8F,'b'' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+DROP TABLE t1;
+#
+# End of ctype_utf8_ilseq.inc
+#
+#
+# Start of ctype_utf8_ilseq.inc
+#
+CREATE TABLE t1 ENGINE=HEAP AS SELECT REPEAT(' ', 60) AS ch LIMIT 0;;
+ALTER TABLE t1
+ADD id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ADD KEY(ch);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `ch` varchar(60) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`id`),
+ KEY `ch` (`ch`)
+) ENGINE=MEMORY DEFAULT CHARSET=latin1
+INSERT INTO t1 (ch) VALUES ('admin'),('admin1');
+SELECT ch FROM t1 WHERE ch='adminðŒ†';
+ch
+Warnings:
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='adminðŒ†';
+ch
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='adminðŒ†';
+ch
+Warnings:
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+DELETE FROM t1;
+INSERT INTO t1 (ch) VALUES ('a'), ('a?'), ('a??'), ('a???'), ('a????');
+INSERT INTO t1 (ch) VALUES ('ab'),('a?b'),('a??b'),('a???b'),('a????b');
+INSERT INTO t1 (ch) VALUES ('az'),('a?z'),('a??z'),('a???z'),('a????z');
+INSERT INTO t1 (ch) VALUES ('z');
+INSERT INTO t1 (ch) VALUES (_utf8 0x61D080);
+INSERT INTO t1 (ch) VALUES (_utf8 0x61D680);
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch;
+ch
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch;
+ch
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch;
+ch
+Warnings:
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch;
+ch
+Warnings:
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch;
+ch
+a
+a?
+a??
+a???
+a????
+a????b
+a????z
+a???b
+a???z
+a??b
+a??z
+a?b
+a?z
+ab
+az
+aЀ
+aÖ€
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'aðŒ†b' ORDER BY ch;
+ch
+a
+a?
+a??
+a???
+a????
+a????b
+a????z
+a???b
+a???z
+a??b
+a??z
+a?b
+a?z
+ab
+az
+aЀ
+aÖ€
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch;
+ch
+a
+a?
+a??
+a???
+a????
+a????b
+a????z
+a???b
+a???z
+a??b
+a??z
+a?b
+a?z
+ab
+az
+aЀ
+aÖ€
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†b' ORDER BY ch;
+ch
+a
+a?
+a??
+a???
+a????
+a????b
+a????z
+a???b
+a???z
+a??b
+a??z
+a?b
+a?z
+ab
+az
+aЀ
+aÖ€
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch;
+ch
+z
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch;
+ch
+z
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch;
+ch
+z
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch;
+ch
+z
+ALTER TABLE t1 DROP KEY ch;
+# 0xD18F would be a good 2-byte character, 0xD1 is an incomplete sequence
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xD1,'''');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xD1,'b''');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch<''a', 0xD1,''' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+a
+a?
+a??
+a???
+a????
+a????b
+a????z
+a???b
+a???z
+a??b
+a??z
+a?b
+a?z
+ab
+az
+aЀ
+aÖ€
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch>''a', 0xD1,''' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+z
+# 0xEA9A96 would be a good 3-byte character, 0xEA9A is an incomplete sequence
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xEA9A,''' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xEA9A,'b'' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+# 0x8F is a bad byte sequence (an mb2tail without mb2head)
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0x8F,''' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0x8F,'b'' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+# 0x8F8F is a bad byte sequence (an mb2tail without mb2head, two times)
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0x8F8F,''' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0x8F8F,'b'' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+DROP TABLE t1;
+#
+# End of ctype_utf8_ilseq.inc
+#
+#
# End of 5.5 tests
#
#
diff --git a/mysql-test/r/ctype_uca_innodb.result b/mysql-test/r/ctype_uca_innodb.result
new file mode 100644
index 00000000000..a4e1ae09130
--- /dev/null
+++ b/mysql-test/r/ctype_uca_innodb.result
@@ -0,0 +1,218 @@
+#
+# Start of 5.5 tests
+#
+#
+# MDEV-7649 wrong result when comparing utf8 column with an invalid literal
+#
+SET NAMES utf8 COLLATE utf8_unicode_ci;
+#
+# Start of ctype_utf8_ilseq.inc
+#
+CREATE TABLE t1 ENGINE=InnoDB AS SELECT REPEAT(' ', 60) AS ch LIMIT 0;;
+ALTER TABLE t1
+ADD id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ADD KEY(ch);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `ch` varchar(60) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`id`),
+ KEY `ch` (`ch`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+INSERT INTO t1 (ch) VALUES ('admin'),('admin1');
+SELECT ch FROM t1 WHERE ch='adminðŒ†';
+ch
+Warnings:
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='adminðŒ†';
+ch
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='adminðŒ†';
+ch
+Warnings:
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+DELETE FROM t1;
+INSERT INTO t1 (ch) VALUES ('a'), ('a?'), ('a??'), ('a???'), ('a????');
+INSERT INTO t1 (ch) VALUES ('ab'),('a?b'),('a??b'),('a???b'),('a????b');
+INSERT INTO t1 (ch) VALUES ('az'),('a?z'),('a??z'),('a???z'),('a????z');
+INSERT INTO t1 (ch) VALUES ('z');
+INSERT INTO t1 (ch) VALUES (_utf8 0x61D080);
+INSERT INTO t1 (ch) VALUES (_utf8 0x61D680);
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch;
+ch
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch;
+ch
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch;
+ch
+Warnings:
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch;
+ch
+Warnings:
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch;
+ch
+a
+a?
+a??
+a???
+a????
+a????b
+a????z
+a???b
+a???z
+a??b
+a??z
+a?b
+a?z
+ab
+az
+aЀ
+aÖ€
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'aðŒ†b' ORDER BY ch;
+ch
+a
+a?
+a??
+a???
+a????
+a????b
+a????z
+a???b
+a???z
+a??b
+a??z
+a?b
+a?z
+ab
+az
+aЀ
+aÖ€
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch;
+ch
+a
+a?
+a??
+a???
+a????
+a????b
+a????z
+a???b
+a???z
+a??b
+a??z
+a?b
+a?z
+ab
+az
+aЀ
+aÖ€
+Warnings:
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†b' ORDER BY ch;
+ch
+a
+a?
+a??
+a???
+a????
+a????b
+a????z
+a???b
+a???z
+a??b
+a??z
+a?b
+a?z
+ab
+az
+aЀ
+aÖ€
+Warnings:
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch;
+ch
+z
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch;
+ch
+z
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch;
+ch
+z
+Warnings:
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch;
+ch
+z
+Warnings:
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
+ALTER TABLE t1 DROP KEY ch;
+# 0xD18F would be a good 2-byte character, 0xD1 is an incomplete sequence
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xD1,'''');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xD1,'b''');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch<''a', 0xD1,''' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+a
+a?
+a??
+a???
+a????
+a????b
+a????z
+a???b
+a???z
+a??b
+a??z
+a?b
+a?z
+ab
+az
+aЀ
+aÖ€
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch>''a', 0xD1,''' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+z
+# 0xEA9A96 would be a good 3-byte character, 0xEA9A is an incomplete sequence
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xEA9A,''' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xEA9A,'b'' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+# 0x8F is a bad byte sequence (an mb2tail without mb2head)
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0x8F,''' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0x8F,'b'' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+# 0x8F8F is a bad byte sequence (an mb2tail without mb2head, two times)
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0x8F8F,''' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0x8F8F,'b'' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+DROP TABLE t1;
+#
+# End of ctype_utf8_ilseq.inc
+#
+#
+# End of 5.5 tests
+#
diff --git a/mysql-test/r/ctype_upgrade.result b/mysql-test/r/ctype_upgrade.result
index 56e2ef96ead..6bef89f6cd6 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/5: Checking mysql database
+Phase 1/6: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats OK
@@ -258,9 +258,10 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
-Phase 2/5: Running 'mysql_fix_privilege_tables'...
-Phase 3/5: Fixing table and database names
-Phase 4/5: Checking and upgrading tables
+Phase 2/6: Fixing views
+Phase 3/6: Running 'mysql_fix_privilege_tables'
+Phase 4/6: Fixing table and database names
+Phase 5/6: Checking and upgrading tables
Processing databases
information_schema
mtr
@@ -279,11 +280,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'...
+Phase 6/6: Running 'FLUSH PRIVILEGES'
OK
# Running mysql_upgrade for the second time
# This should report OK for all tables
-Phase 1/5: Checking mysql database
+Phase 1/6: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats OK
@@ -314,9 +315,10 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
-Phase 2/5: Running 'mysql_fix_privilege_tables'...
-Phase 3/5: Fixing table and database names
-Phase 4/5: Checking and upgrading tables
+Phase 2/6: Fixing views
+Phase 3/6: Running 'mysql_fix_privilege_tables'
+Phase 4/6: Fixing table and database names
+Phase 5/6: Checking and upgrading tables
Processing databases
information_schema
mtr
@@ -329,7 +331,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'...
+Phase 6/6: Running 'FLUSH PRIVILEGES'
OK
SHOW CREATE TABLE maria050313_ucs2_croatian_ci_def;
Table Create Table
diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result
index c752024ec7f..1f44d67661b 100644
--- a/mysql-test/r/ctype_utf8.result
+++ b/mysql-test/r/ctype_utf8.result
@@ -5412,6 +5412,649 @@ a 1024
Warnings:
Warning 1260 Row 2 was cut by GROUP_CONCAT()
#
+# MDEV-7814 Assertion `args[0]->fixed' fails in Item_func_conv_charset::Item_func_conv_charset
+#
+CREATE TABLE t1(a CHAR(1) CHARACTER SET latin1, b INT NOT NULL);
+CREATE TABLE t2(a CHAR(1) CHARACTER SET utf8 COLLATE utf8_general_ci, b INT NOT NULL);
+SELECT (SELECT t2.a FROM t2 WHERE t2.a=t1.a) AS aa, b, COUNT(b) FROM t1 GROUP BY aa;
+aa b COUNT(b)
+DROP TABLE t1,t2;
+#
+# MDEV-7649 wrong result when comparing utf8 column with an invalid literal
+#
+SET NAMES utf8 COLLATE utf8_general_ci;
+#
+# Start of ctype_utf8_ilseq.inc
+#
+CREATE TABLE t1 ENGINE=InnoDB AS SELECT REPEAT(' ', 60) AS ch LIMIT 0;;
+ALTER TABLE t1
+ADD id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ADD KEY(ch);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `ch` varchar(60) CHARACTER SET utf8 NOT NULL DEFAULT '',
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`id`),
+ KEY `ch` (`ch`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+INSERT INTO t1 (ch) VALUES ('admin'),('admin1');
+SELECT ch FROM t1 WHERE ch='adminðŒ†';
+ch
+Warnings:
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='adminðŒ†';
+ch
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='adminðŒ†';
+ch
+Warnings:
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+DELETE FROM t1;
+INSERT INTO t1 (ch) VALUES ('a'), ('a?'), ('a??'), ('a???'), ('a????');
+INSERT INTO t1 (ch) VALUES ('ab'),('a?b'),('a??b'),('a???b'),('a????b');
+INSERT INTO t1 (ch) VALUES ('az'),('a?z'),('a??z'),('a???z'),('a????z');
+INSERT INTO t1 (ch) VALUES ('z');
+INSERT INTO t1 (ch) VALUES (_utf8 0x61D080);
+INSERT INTO t1 (ch) VALUES (_utf8 0x61D680);
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch;
+ch
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch;
+ch
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch;
+ch
+Warnings:
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch;
+ch
+Warnings:
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch;
+ch
+a
+a?
+a??
+a???
+a????
+a????b
+a????z
+a???b
+a???z
+a??b
+a??z
+a?b
+a?z
+ab
+az
+aЀ
+aÖ€
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'aðŒ†b' ORDER BY ch;
+ch
+a
+a?
+a??
+a???
+a????
+a????b
+a????z
+a???b
+a???z
+a??b
+a??z
+a?b
+a?z
+ab
+az
+aЀ
+aÖ€
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch;
+ch
+a
+a?
+a??
+a???
+a????
+a????b
+a????z
+a???b
+a???z
+a??b
+a??z
+a?b
+a?z
+ab
+az
+aЀ
+aÖ€
+Warnings:
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†b' ORDER BY ch;
+ch
+a
+a?
+a??
+a???
+a????
+a????b
+a????z
+a???b
+a???z
+a??b
+a??z
+a?b
+a?z
+ab
+az
+aЀ
+aÖ€
+Warnings:
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch;
+ch
+z
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch;
+ch
+z
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch;
+ch
+z
+Warnings:
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch;
+ch
+z
+Warnings:
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
+ALTER TABLE t1 DROP KEY ch;
+# 0xD18F would be a good 2-byte character, 0xD1 is an incomplete sequence
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xD1,'''');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xD1,'b''');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch<''a', 0xD1,''' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+a
+a?
+a??
+a???
+a????
+a????b
+a????z
+a???b
+a???z
+a??b
+a??z
+a?b
+a?z
+ab
+az
+aЀ
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch>''a', 0xD1,''' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+aÖ€
+z
+# 0xEA9A96 would be a good 3-byte character, 0xEA9A is an incomplete sequence
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xEA9A,''' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xEA9A,'b'' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+# 0x8F is a bad byte sequence (an mb2tail without mb2head)
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0x8F,''' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0x8F,'b'' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+# 0x8F8F is a bad byte sequence (an mb2tail without mb2head, two times)
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0x8F8F,''' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0x8F8F,'b'' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+DROP TABLE t1;
+#
+# End of ctype_utf8_ilseq.inc
+#
+#
+# Start of ctype_utf8_ilseq.inc
+#
+CREATE TABLE t1 ENGINE=MyISAM AS SELECT REPEAT(' ', 60) AS ch LIMIT 0;;
+ALTER TABLE t1
+ADD id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ADD KEY(ch);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `ch` varchar(60) CHARACTER SET utf8 NOT NULL DEFAULT '',
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`id`),
+ KEY `ch` (`ch`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (ch) VALUES ('admin'),('admin1');
+SELECT ch FROM t1 WHERE ch='adminðŒ†';
+ch
+Warnings:
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='adminðŒ†';
+ch
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='adminðŒ†';
+ch
+Warnings:
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+DELETE FROM t1;
+INSERT INTO t1 (ch) VALUES ('a'), ('a?'), ('a??'), ('a???'), ('a????');
+INSERT INTO t1 (ch) VALUES ('ab'),('a?b'),('a??b'),('a???b'),('a????b');
+INSERT INTO t1 (ch) VALUES ('az'),('a?z'),('a??z'),('a???z'),('a????z');
+INSERT INTO t1 (ch) VALUES ('z');
+INSERT INTO t1 (ch) VALUES (_utf8 0x61D080);
+INSERT INTO t1 (ch) VALUES (_utf8 0x61D680);
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch;
+ch
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch;
+ch
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch;
+ch
+Warnings:
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch;
+ch
+Warnings:
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch;
+ch
+a
+a?
+a??
+a???
+a????
+a????b
+a????z
+a???b
+a???z
+a??b
+a??z
+a?b
+a?z
+ab
+az
+aЀ
+aÖ€
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'aðŒ†b' ORDER BY ch;
+ch
+a
+a?
+a??
+a???
+a????
+a????b
+a????z
+a???b
+a???z
+a??b
+a??z
+a?b
+a?z
+ab
+az
+aЀ
+aÖ€
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch;
+ch
+a
+a?
+a??
+a???
+a????
+a????b
+a????z
+a???b
+a???z
+a??b
+a??z
+a?b
+a?z
+ab
+az
+aЀ
+aÖ€
+Warnings:
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†b' ORDER BY ch;
+ch
+a
+a?
+a??
+a???
+a????
+a????b
+a????z
+a???b
+a???z
+a??b
+a??z
+a?b
+a?z
+ab
+az
+aЀ
+aÖ€
+Warnings:
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch;
+ch
+z
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch;
+ch
+z
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch;
+ch
+z
+Warnings:
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch;
+ch
+z
+Warnings:
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
+ALTER TABLE t1 DROP KEY ch;
+# 0xD18F would be a good 2-byte character, 0xD1 is an incomplete sequence
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xD1,'''');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xD1,'b''');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch<''a', 0xD1,''' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+a
+a?
+a??
+a???
+a????
+a????b
+a????z
+a???b
+a???z
+a??b
+a??z
+a?b
+a?z
+ab
+az
+aЀ
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch>''a', 0xD1,''' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+aÖ€
+z
+# 0xEA9A96 would be a good 3-byte character, 0xEA9A is an incomplete sequence
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xEA9A,''' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xEA9A,'b'' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+# 0x8F is a bad byte sequence (an mb2tail without mb2head)
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0x8F,''' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0x8F,'b'' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+# 0x8F8F is a bad byte sequence (an mb2tail without mb2head, two times)
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0x8F8F,''' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0x8F8F,'b'' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+DROP TABLE t1;
+#
+# End of ctype_utf8_ilseq.inc
+#
+#
+# Start of ctype_utf8_ilseq.inc
+#
+CREATE TABLE t1 ENGINE=HEAP AS SELECT REPEAT(' ', 60) AS ch LIMIT 0;;
+ALTER TABLE t1
+ADD id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ADD KEY(ch);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `ch` varchar(60) CHARACTER SET utf8 NOT NULL DEFAULT '',
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`id`),
+ KEY `ch` (`ch`)
+) ENGINE=MEMORY DEFAULT CHARSET=latin1
+INSERT INTO t1 (ch) VALUES ('admin'),('admin1');
+SELECT ch FROM t1 WHERE ch='adminðŒ†';
+ch
+Warnings:
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='adminðŒ†';
+ch
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='adminðŒ†';
+ch
+Warnings:
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+DELETE FROM t1;
+INSERT INTO t1 (ch) VALUES ('a'), ('a?'), ('a??'), ('a???'), ('a????');
+INSERT INTO t1 (ch) VALUES ('ab'),('a?b'),('a??b'),('a???b'),('a????b');
+INSERT INTO t1 (ch) VALUES ('az'),('a?z'),('a??z'),('a???z'),('a????z');
+INSERT INTO t1 (ch) VALUES ('z');
+INSERT INTO t1 (ch) VALUES (_utf8 0x61D080);
+INSERT INTO t1 (ch) VALUES (_utf8 0x61D680);
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch;
+ch
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch;
+ch
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch;
+ch
+Warnings:
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch;
+ch
+Warnings:
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch;
+ch
+a
+a?
+a??
+a???
+a????
+a????b
+a????z
+a???b
+a???z
+a??b
+a??z
+a?b
+a?z
+ab
+az
+aЀ
+aÖ€
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'aðŒ†b' ORDER BY ch;
+ch
+a
+a?
+a??
+a???
+a????
+a????b
+a????z
+a???b
+a???z
+a??b
+a??z
+a?b
+a?z
+ab
+az
+aЀ
+aÖ€
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch;
+ch
+a
+a?
+a??
+a???
+a????
+a????b
+a????z
+a???b
+a???z
+a??b
+a??z
+a?b
+a?z
+ab
+az
+aЀ
+aÖ€
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†b' ORDER BY ch;
+ch
+a
+a?
+a??
+a???
+a????
+a????b
+a????z
+a???b
+a???z
+a??b
+a??z
+a?b
+a?z
+ab
+az
+aЀ
+aÖ€
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch;
+ch
+z
+SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch;
+ch
+z
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch;
+ch
+z
+SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch;
+ch
+z
+ALTER TABLE t1 DROP KEY ch;
+# 0xD18F would be a good 2-byte character, 0xD1 is an incomplete sequence
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xD1,'''');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xD1,'b''');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch<''a', 0xD1,''' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+a
+a?
+a??
+a???
+a????
+a????b
+a????z
+a???b
+a???z
+a??b
+a??z
+a?b
+a?z
+ab
+az
+aЀ
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch>''a', 0xD1,''' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+aÖ€
+z
+# 0xEA9A96 would be a good 3-byte character, 0xEA9A is an incomplete sequence
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xEA9A,''' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xEA9A,'b'' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+# 0x8F is a bad byte sequence (an mb2tail without mb2head)
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0x8F,''' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0x8F,'b'' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+# 0x8F8F is a bad byte sequence (an mb2tail without mb2head, two times)
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0x8F8F,''' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0x8F8F,'b'' ORDER BY ch');
+PREPARE stmt FROM @query;
+EXECUTE stmt;
+ch
+DROP TABLE t1;
+#
+# End of ctype_utf8_ilseq.inc
+#
+#
+# MDEV-8067 correct fix for MySQL Bug # 19699237: UNINITIALIZED VARIABLE IN ITEM_FIELD::STR_RESULT
+#
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8);
+CREATE TABLE t2 (a VARCHAR(10) CHARACTER SET latin1);
+INSERT INTO t1 VALUES ('aaa');
+INSERT INTO t2 VALUES ('aaa');
+SELECT (SELECT CONCAT(a),1 FROM t1) <=> (SELECT CONCAT(a),1 FROM t2);
+(SELECT CONCAT(a),1 FROM t1) <=> (SELECT CONCAT(a),1 FROM t2)
+1
+INSERT INTO t1 VALUES ('aaa');
+INSERT INTO t2 VALUES ('aaa');
+SELECT (SELECT CONCAT(a),1 FROM t1) <=> (SELECT CONCAT(a),1 FROM t2);
+ERROR 21000: Subquery returns more than 1 row
+DROP TABLE t1, t2;
+#
# End of 5.5 tests
#
#
@@ -6259,6 +6902,12 @@ EXECUTE stmt USING @b,@b;
ERROR HY000: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation 'concat'
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
+#
+# MDEV-7629 Regression: Bit and hex string literals changed column names in 10.0.14
+#
+SELECT _utf8 0x7E, _utf8 X'7E', _utf8 B'01111110';
+_utf8 0x7E _utf8 X'7E' _utf8 B'01111110'
+~ ~ ~
# Start of ctype_unescape.inc
SET @query=_binary'SELECT CHARSET(\'test\'),@@character_set_client,@@character_set_connection';
PREPARE stmt FROM @query;
diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result
index d0f42c3d3ec..7c44466ae92 100644
--- a/mysql-test/r/derived.result
+++ b/mysql-test/r/derived.result
@@ -568,3 +568,15 @@ update t1 set balance=(select sum(balance) from (SELECT balance FROM t1 where ac
set optimizer_switch=@save_derived_optimizer_switch_bug;
drop table t1;
set optimizer_switch=@save_derived_optimizer_switch;
+#
+# MDEV-6892: WHERE does not apply
+#
+create table t1 (id int);
+create table t2 (id int);
+insert into t1 values(1),(2),(3);
+insert into t2 values(4),(5),(6);
+select x.id, message from (select id from t1) x left join
+(select id, 1 as message from t2) y on x.id=y.id
+where coalesce(message,0) <> 0;
+id message
+drop table t1,t2;
diff --git a/mysql-test/r/derived_opt.result b/mysql-test/r/derived_opt.result
index a2e08eacebc..04a76c2cbc8 100644
--- a/mysql-test/r/derived_opt.result
+++ b/mysql-test/r/derived_opt.result
@@ -413,64 +413,64 @@ create VIEW v27 AS select tab1_v27.f1,tab1_v27.f2 from t0 tab1_v27 join v26 tab2
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_v26 hash_ALL NULL #hash#$hj 62 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_v23 hash_ALL NULL #hash#$hj 62 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_v20 hash_ALL NULL #hash#$hj 62 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_v17 hash_ALL NULL #hash#$hj 62 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_v14 hash_ALL NULL #hash#$hj 62 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_v11 hash_ALL NULL #hash#$hj 62 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_v8 hash_ALL NULL #hash#$hj 62 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_v5 hash_ALL NULL #hash#$hj 62 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_v2 hash_ALL NULL #hash#$hj 62 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)
+1 SIMPLE t1 hash_ALL NULL #hash#$hj 84 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_v26 hash_ALL NULL #hash#$hj 62 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_v23 hash_ALL NULL #hash#$hj 62 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_v20 hash_ALL NULL #hash#$hj 62 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_v17 hash_ALL NULL #hash#$hj 62 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_v14 hash_ALL NULL #hash#$hj 62 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_v11 hash_ALL NULL #hash#$hj 62 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_v8 hash_ALL NULL #hash#$hj 62 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_v5 hash_ALL NULL #hash#$hj 62 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_v2 hash_ALL NULL #hash#$hj 62 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)
+1 SIMPLE t1 hash_ALL NULL #hash#$hj 84 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;
diff --git a/mysql-test/r/derived_view.result b/mysql-test/r/derived_view.result
index e359a8f89c5..fa0a69a487d 100644
--- a/mysql-test/r/derived_view.result
+++ b/mysql-test/r/derived_view.result
@@ -770,7 +770,7 @@ SELECT * FROM t1, t2, v1 WHERE t2.a=t1.a AND t2.a=v1.a AND t2.a=v1.b;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system NULL NULL NULL NULL 1
1 PRIMARY t2 ref a a 4 const 1 Using index
-1 PRIMARY <derived2> ref key0 key0 10 const,const 1
+1 PRIMARY <derived2> ref key0 key0 8 const,const 1
2 DERIVED t3 ALL NULL NULL NULL NULL 12 Using temporary; Using filesort
SELECT * FROM t1, t2, v1 WHERE t2.a=t1.a AND t2.a=v1.a AND t2.a=v1.b;
a a a b
@@ -1518,7 +1518,7 @@ WHERE t3.b IN (SELECT v1.b FROM v1, t2
WHERE t2.c = v1.c AND t2.c = v1.b AND v1.b = t3.c);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 system NULL NULL NULL NULL 1
-1 PRIMARY <derived3> ref key1 key1 10 const,const 0 Start temporary
+1 PRIMARY <derived3> ref key1 key1 8 const,const 0 Start temporary
1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using where; End temporary; Using join buffer (flat, BNL join)
3 DERIVED t1 ALL NULL NULL NULL NULL 3
SELECT * FROM t3
@@ -1596,7 +1596,7 @@ EXPLAIN
SELECT v1.a FROM v1,v2 WHERE v2.b = v1.b ORDER BY 1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3 Using where; Using filesort
-1 PRIMARY <derived3> ref key0 key0 5 v1.b 2
+1 PRIMARY <derived3> ref key0 key0 4 v1.b 2
3 DERIVED t2 ALL NULL NULL NULL NULL 5 Using temporary; Using filesort
2 DERIVED t1 ALL NULL NULL NULL NULL 3 Using temporary; Using filesort
DROP VIEW v1,v2;
diff --git a/mysql-test/r/dyncol.result b/mysql-test/r/dyncol.result
index cc4e8074395..04ab385bca6 100644
--- a/mysql-test/r/dyncol.result
+++ b/mysql-test/r/dyncol.result
@@ -1455,6 +1455,12 @@ Warnings:
Warning 1918 Encountered illegal value '18446744073709552001' when converting to INT
Note 1105 Cast to signed converted positive out-of-range integer to it's negative complement
#
+# MDEV-7505 - Too large scale in DECIMAL dynamic column getter crashes
+# mysqld
+#
+SELECT COLUMN_GET(`x`, 'y' AS DECIMAL(5,34));
+ERROR 42000: Too big scale 34 specified for ''y''. Maximum is 30.
+#
# test of symbolic names
#
# creation test (names)
diff --git a/mysql-test/r/empty_server_name-8224.result b/mysql-test/r/empty_server_name-8224.result
new file mode 100644
index 00000000000..6423114470d
--- /dev/null
+++ b/mysql-test/r/empty_server_name-8224.result
@@ -0,0 +1 @@
+create server '' foreign data wrapper w2 options (host '127.0.0.1');
diff --git a/mysql-test/r/error_simulation.result b/mysql-test/r/error_simulation.result
index 006c51d1880..edb97d4ab2e 100644
--- a/mysql-test/r/error_simulation.result
+++ b/mysql-test/r/error_simulation.result
@@ -100,3 +100,24 @@ DROP TABLE t1,t2;
#
# End of 5.1 tests
#
+#
+# BUG#11747548:DETECT ORPHAN TEMP-POOL FILES, AND HANDLE GRACEFULLY.
+#
+#Set up.
+CREATE TABLE pid_table(pid_no INT);
+CREATE TABLE t1 (a BLOB);
+INSERT INTO t1 VALUES (1), (2);
+#Create MYD and MYI files for intrinsic temp table.
+LOAD DATA LOCAL INFILE 'pid_file' INTO TABLE pid_table;
+#Reports an error since the temp file already exists.
+SELECT a FROM t1 ORDER BY rand(1);
+a
+1
+2
+#With patch, the query executes successfully.
+SELECT a FROM t1 ORDER BY rand(1);
+a
+1
+2
+#cleanup
+DROP TABLE t1, pid_table;
diff --git a/mysql-test/r/explain_non_select.result b/mysql-test/r/explain_non_select.result
index 00ca481147b..0eee7ee9b1e 100644
--- a/mysql-test/r/explain_non_select.result
+++ b/mysql-test/r/explain_non_select.result
@@ -219,3 +219,16 @@ OK
OK
drop function f1;
drop table t1;
+#
+# MDEV-7038: Assertion `status_var.memory_used == 0' failed in THD::~THD()
+# on disconnect after executing EXPLAIN for multi-table UPDATE
+#
+CREATE TABLE t1 (a INT);
+CREATE VIEW v1 AS SELECT * FROM t1;
+INSERT INTO t1 VALUES (1),(2);
+EXPLAIN UPDATE v1, mysql.user SET v1.a = v1.a + 1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2
+1 SIMPLE user index NULL PRIMARY 420 NULL 4 Using index
+DROP TABLE t1;
+DROP VIEW v1;
diff --git a/mysql-test/r/features.result b/mysql-test/r/features.result
index 66d2c6bf71d..04e0df98ec7 100644
--- a/mysql-test/r/features.result
+++ b/mysql-test/r/features.result
@@ -120,6 +120,9 @@ drop trigger trg;
drop table t1;
show status like "%trigger%";
Variable_name Value
+Binlog_group_commit_trigger_count 0
+Binlog_group_commit_trigger_lock_wait 0
+Binlog_group_commit_trigger_timeout 0
Com_create_trigger 1
Com_drop_trigger 1
Com_show_create_trigger 0
diff --git a/mysql-test/r/file_contents.result b/mysql-test/r/file_contents.result
index 110769e12f8..0b0d5d598d6 100644
--- a/mysql-test/r/file_contents.result
+++ b/mysql-test/r/file_contents.result
@@ -1,6 +1,6 @@
Checking 'INFO_SRC' and 'INFO_BIN'
-INFO_SRC: Found MySQL version number / Found BZR revision id
+INFO_SRC: Found MySQL version number / Found GIT revision id
INFO_BIN: Found 'Compiler ... used' line / Found 'Feature flags' line
End of tests
diff --git a/mysql-test/r/filesort_bad_i_s-7585.result b/mysql-test/r/filesort_bad_i_s-7585.result
new file mode 100644
index 00000000000..edb1574288f
--- /dev/null
+++ b/mysql-test/r/filesort_bad_i_s-7585.result
@@ -0,0 +1,9 @@
+SET sql_mode=STRICT_TRANS_TABLES;
+CREATE TABLE t0 (i INT) ENGINE=MyISAM;
+CREATE VIEW v1 AS SELECT * FROM t0;
+CREATE VIEW v2 AS SELECT * FROM v1;
+DROP VIEW IF EXISTS v1;
+CREATE TABLE t1 (i INT) ENGINE=MyISAM;
+INSERT INTO t1 SELECT TABLE_ROWS FROM information_schema.tables ORDER BY TABLE_ROWS;
+DROP VIEW v2;
+DROP TABLE t1, t0;
diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result
index b60deae1c80..f12a0c1127a 100644
--- a/mysql-test/r/func_gconcat.result
+++ b/mysql-test/r/func_gconcat.result
@@ -1091,3 +1091,15 @@ insert into t1 values ('a'),('b');
select 1 from t1 where a in (select group_concat(a) from t1);
1
drop table t1;
+CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('a'),('b');
+CREATE TABLE t2 (f2 VARCHAR(10)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES ('c');
+CREATE TABLE t3 (f3 VARCHAR(10)) ENGINE=MyISAM;
+INSERT INTO t3 VALUES ('d'),('e');
+SELECT GROUP_CONCAT( f2 ORDER BY ( f2 IN ( SELECT f1 FROM t1 WHERE f1 <= f2 ) ) ) AS field
+FROM ( SELECT * FROM t2 ) AS sq2, t3
+ORDER BY field;
+field
+c,c
+drop table t3, t2, t1;
diff --git a/mysql-test/r/func_regexp_pcre.result b/mysql-test/r/func_regexp_pcre.result
index 641c4fddbf7..aa090c9faf6 100644
--- a/mysql-test/r/func_regexp_pcre.result
+++ b/mysql-test/r/func_regexp_pcre.result
@@ -845,3 +845,32 @@ SET default_regex_flags=DEFAULT;
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
+#
+# MDEV-8102 REGEXP function fails to match hex values when expression is stored as a variable
+#
+# Testing a warning
+SET NAMES latin1;
+SET @regCheck= '\\xE0\\x01';
+SELECT 0xE001 REGEXP @regCheck;
+0xE001 REGEXP @regCheck
+0
+Warnings:
+Warning 1139 Got error 'pcre_exec: Invalid utf8 byte sequence in the subject string' from regexp
+# Testing workaround N1: This makes the pattern to be a binary string:
+SET NAMES latin1;
+SET @regCheck= X'E001';
+SELECT 0xE001 REGEXP @regCheck;
+0xE001 REGEXP @regCheck
+1
+# Testing workaround N2: This also makes the pattern to be a binary string, using a different syntax:
+SET NAMES latin1;
+SET @regCheck= _binary '\\xE0\\x01';
+SELECT 0xE001 REGEXP @regCheck;
+0xE001 REGEXP @regCheck
+1
+# Testing workarond N3: This makes derivation of the subject string stronger (IMLICIT instead of COERCIBLE)
+SET NAMES latin1;
+SET @regCheck= '\\xE0\\x01';
+SELECT CAST(0xE001 AS BINARY) REGEXP @regCheck;
+CAST(0xE001 AS BINARY) REGEXP @regCheck
+1
diff --git a/mysql-test/r/func_regexp_pcre_debug.result b/mysql-test/r/func_regexp_pcre_debug.result
new file mode 100644
index 00000000000..e44492fca72
--- /dev/null
+++ b/mysql-test/r/func_regexp_pcre_debug.result
@@ -0,0 +1,10 @@
+SET debug_dbug='+d,pcre_exec_error_123';
+SELECT 'a' RLIKE 'a';
+'a' RLIKE 'a'
+0
+Warnings:
+Warning 1139 Got error 'pcre_exec: Internal error (-123)' from regexp
+SET debug_dbug='';
+SELECT 'a' RLIKE 'a';
+'a' RLIKE 'a'
+1
diff --git a/mysql-test/r/func_set.result b/mysql-test/r/func_set.result
index 93757800505..dfc3faf3fac 100644
--- a/mysql-test/r/func_set.result
+++ b/mysql-test/r/func_set.result
@@ -5,7 +5,7 @@ explain extended select INTERVAL(55,10,20,30,40,50,60,70,80,90,100),interval(3,1
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 interval((55,10,20,30,40,50,60,70,80,90,100)) AS `INTERVAL(55,10,20,30,40,50,60,70,80,90,100)`,interval((3,1,(1 + 1),(((1 + 1) + 1) + 1))) AS `interval(3,1,1+1,1+1+1+1)`,field('IBM','NCA','ICL','SUN','IBM','DIGITAL') AS `field("IBM","NCA","ICL","SUN","IBM","DIGITAL")`,field('A','B','C') AS `field("A","B","C")`,elt(2,'ONE','TWO','THREE') AS `elt(2,"ONE","TWO","THREE")`,interval((0,1,2,3,4)) AS `interval(0,1,2,3,4)`,(elt(1,1,2,3) | 0) AS `elt(1,1,2,3)|0`,(elt(1,1.1,1.2,1.3) + 0) AS `elt(1,1.1,1.2,1.3)+0`
+Note 1003 select interval(55,10,20,30,40,50,60,70,80,90,100) AS `INTERVAL(55,10,20,30,40,50,60,70,80,90,100)`,interval(3,1,(1 + 1),(((1 + 1) + 1) + 1)) AS `interval(3,1,1+1,1+1+1+1)`,field('IBM','NCA','ICL','SUN','IBM','DIGITAL') AS `field("IBM","NCA","ICL","SUN","IBM","DIGITAL")`,field('A','B','C') AS `field("A","B","C")`,elt(2,'ONE','TWO','THREE') AS `elt(2,"ONE","TWO","THREE")`,interval(0,1,2,3,4) AS `interval(0,1,2,3,4)`,(elt(1,1,2,3) | 0) AS `elt(1,1,2,3)|0`,(elt(1,1.1,1.2,1.3) + 0) AS `elt(1,1.1,1.2,1.3)+0`
SELECT INTERVAL(13, 7, 14, 21, 28, 35, 42, 49, 56);
INTERVAL(13, 7, 14, 21, 28, 35, 42, 49, 56)
1
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index 950d2e72666..b660df15fed 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -2701,3 +2701,45 @@ id date1 date2 DATE_ADD(a.date1,INTERVAL -10 DAY) TO_DAYS(a.date1)-10
17 NULL NULL NULL NULL
18 2010-10-13 2010-10-03 2010-10-03 734413
DROP TABLE t1;
+#
+# Start of 10.0 tests
+#
+#
+# MDEV-8205 timediff returns null when comparing decimal time to time string value
+#
+SELECT
+TIMEDIFF('2014-01-01 00:00:00' , '2014-01-01 01:00:00' ) AS str_str,
+TIMEDIFF('2014-01-01 00:00:00' , 20140101010000.000 ) AS str_dec,
+TIMEDIFF(20140101000000.000 , 20140101010000.000 ) AS dec_dec,
+TIMEDIFF(20140101000000.000 , '2014-01-01 01:00:00' ) AS dec_str;
+str_str str_dec dec_dec dec_str
+-01:00:00 -01:00:00.000 -01:00:00.000 -01:00:00.000
+SELECT
+TIMEDIFF('2014-01-01 00:00:00' , '2014-01-02 01:00:00' ) AS str_str,
+TIMEDIFF('2014-01-01 00:00:00' , 20140102010000.000 ) AS str_dec,
+TIMEDIFF(20140101000000.000 , 20140102010000.000 ) AS dec_dec,
+TIMEDIFF(20140101000000.000 , '2014-01-02 01:00:00' ) AS dec_str;
+str_str str_dec dec_dec dec_str
+-25:00:00 -25:00:00.000 -25:00:00.000 -25:00:00.000
+SELECT
+TIMEDIFF('2014-01-01 00:00:00' , '2014-02-02 01:00:00' ) AS str_str,
+TIMEDIFF('2014-01-01 00:00:00' , 20140202010000.000 ) AS str_dec,
+TIMEDIFF(20140101000000.000 , 20140202010000.000 ) AS dec_dec,
+TIMEDIFF(20140101000000.000 , '2014-02-02 01:00:00' ) AS dec_str;
+str_str str_dec dec_dec dec_str
+-769:00:00 -769:00:00.000 -769:00:00.000 -769:00:00.000
+SELECT
+TIMEDIFF('2014-01-01 00:00:00' , '2014-03-02 01:00:00' ) AS str_str,
+TIMEDIFF('2014-01-01 00:00:00' , 20140302010000.000 ) AS str_dec,
+TIMEDIFF(20140101000000.000 , 20140302010000.000 ) AS dec_dec,
+TIMEDIFF(20140101000000.000 , '2014-03-02 01:00:00' ) AS dec_str;
+str_str str_dec dec_dec dec_str
+-838:59:59 -838:59:59.999 -838:59:59.999 -838:59:59.999
+Warnings:
+Warning 1292 Truncated incorrect time value: '-1441:00:00'
+Warning 1292 Truncated incorrect time value: '-1441:00:00'
+Warning 1292 Truncated incorrect time value: '-1441:00:00'
+Warning 1292 Truncated incorrect time value: '-1441:00:00'
+#
+# End of 10.0 tests
+#
diff --git a/mysql-test/r/function_defaults.result b/mysql-test/r/function_defaults.result
index 50183a1f416..b8f42b86c1f 100644
--- a/mysql-test/r/function_defaults.result
+++ b/mysql-test/r/function_defaults.result
@@ -660,7 +660,7 @@ 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'
+ `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t2;
a
@@ -669,7 +669,7 @@ 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'
+ `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t3;
b
@@ -678,7 +678,7 @@ 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'
+ `c` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t4;
c
@@ -705,7 +705,7 @@ CREATE TABLE t7 SELECT f FROM t1;
SHOW CREATE TABLE t7;
Table Create Table
t7 CREATE TABLE `t7` (
- `f` datetime DEFAULT NULL
+ `f` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t7;
f
@@ -714,7 +714,7 @@ CREATE TABLE t8 SELECT g FROM t1;
SHOW CREATE TABLE t8;
Table Create Table
t8 CREATE TABLE `t8` (
- `g` datetime DEFAULT NULL
+ `g` datetime DEFAULT CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t8;
g
@@ -723,7 +723,7 @@ CREATE TABLE t9 SELECT h FROM t1;
SHOW CREATE TABLE t9;
Table Create Table
t9 CREATE TABLE `t9` (
- `h` datetime DEFAULT NULL
+ `h` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t9;
h
@@ -774,14 +774,14 @@ t12 CREATE TABLE `t12` (
`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',
+ `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',
`e` timestamp NULL DEFAULT NULL,
- `f` datetime DEFAULT NULL,
- `g` datetime DEFAULT NULL,
- `h` datetime DEFAULT NULL,
+ `f` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `g` datetime DEFAULT CURRENT_TIMESTAMP,
+ `h` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`i` datetime DEFAULT NULL,
`j` datetime DEFAULT '1986-09-27 03:00:00'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
@@ -802,7 +802,7 @@ CREATE TABLE t2 SELECT a FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `a` datetime DEFAULT NULL
+ `a` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t2;
a
@@ -811,7 +811,7 @@ CREATE TABLE t3 SELECT b FROM t1;
SHOW CREATE TABLE t3;
Table Create Table
t3 CREATE TABLE `t3` (
- `b` datetime DEFAULT NULL
+ `b` datetime DEFAULT CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t3;
b
@@ -820,7 +820,7 @@ CREATE TABLE t4 SELECT c FROM t1;
SHOW CREATE TABLE t4;
Table Create Table
t4 CREATE TABLE `t4` (
- `c` datetime DEFAULT NULL
+ `c` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t4;
c
@@ -2216,7 +2216,7 @@ 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'
+ `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t2;
a
@@ -2225,7 +2225,7 @@ 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'
+ `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t3;
b
@@ -2234,7 +2234,7 @@ 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'
+ `c` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t4;
c
@@ -2261,7 +2261,7 @@ CREATE TABLE t7 SELECT f FROM t1;
SHOW CREATE TABLE t7;
Table Create Table
t7 CREATE TABLE `t7` (
- `f` datetime(6) DEFAULT NULL
+ `f` datetime(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t7;
f
@@ -2270,7 +2270,7 @@ CREATE TABLE t8 SELECT g FROM t1;
SHOW CREATE TABLE t8;
Table Create Table
t8 CREATE TABLE `t8` (
- `g` datetime(6) DEFAULT NULL
+ `g` datetime(6) DEFAULT CURRENT_TIMESTAMP(6)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t8;
g
@@ -2279,7 +2279,7 @@ CREATE TABLE t9 SELECT h FROM t1;
SHOW CREATE TABLE t9;
Table Create Table
t9 CREATE TABLE `t9` (
- `h` datetime(6) DEFAULT NULL
+ `h` datetime(6) DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(6)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t9;
h
@@ -2330,14 +2330,14 @@ t12 CREATE TABLE `t12` (
`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',
+ `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.000000' ON UPDATE CURRENT_TIMESTAMP(6),
`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,
+ `f` datetime(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
+ `g` datetime(6) DEFAULT CURRENT_TIMESTAMP(6),
+ `h` datetime(6) DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(6),
`i` datetime(6) DEFAULT NULL,
`j` datetime(6) DEFAULT '1986-09-27 03:00:00.098765'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
@@ -2358,7 +2358,7 @@ CREATE TABLE t2 SELECT a FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `a` datetime(6) DEFAULT NULL
+ `a` datetime(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t2;
a
@@ -2367,7 +2367,7 @@ CREATE TABLE t3 SELECT b FROM t1;
SHOW CREATE TABLE t3;
Table Create Table
t3 CREATE TABLE `t3` (
- `b` datetime(6) DEFAULT NULL
+ `b` datetime(6) DEFAULT CURRENT_TIMESTAMP(6)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t3;
b
@@ -2376,7 +2376,7 @@ CREATE TABLE t4 SELECT c FROM t1;
SHOW CREATE TABLE t4;
Table Create Table
t4 CREATE TABLE `t4` (
- `c` datetime(6) DEFAULT NULL
+ `c` datetime(6) DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(6)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t4;
c
diff --git a/mysql-test/r/function_defaults_innodb.result b/mysql-test/r/function_defaults_innodb.result
index 302d4c85e05..2525d4e948a 100644
--- a/mysql-test/r/function_defaults_innodb.result
+++ b/mysql-test/r/function_defaults_innodb.result
@@ -661,7 +661,7 @@ 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'
+ `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t2;
a
@@ -670,7 +670,7 @@ 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'
+ `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t3;
b
@@ -679,7 +679,7 @@ 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'
+ `c` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t4;
c
@@ -706,7 +706,7 @@ CREATE TABLE t7 SELECT f FROM t1;
SHOW CREATE TABLE t7;
Table Create Table
t7 CREATE TABLE `t7` (
- `f` datetime DEFAULT NULL
+ `f` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t7;
f
@@ -715,7 +715,7 @@ CREATE TABLE t8 SELECT g FROM t1;
SHOW CREATE TABLE t8;
Table Create Table
t8 CREATE TABLE `t8` (
- `g` datetime DEFAULT NULL
+ `g` datetime DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t8;
g
@@ -724,7 +724,7 @@ CREATE TABLE t9 SELECT h FROM t1;
SHOW CREATE TABLE t9;
Table Create Table
t9 CREATE TABLE `t9` (
- `h` datetime DEFAULT NULL
+ `h` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t9;
h
@@ -775,14 +775,14 @@ t12 CREATE TABLE `t12` (
`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',
+ `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',
`e` timestamp NULL DEFAULT NULL,
- `f` datetime DEFAULT NULL,
- `g` datetime DEFAULT NULL,
- `h` datetime DEFAULT NULL,
+ `f` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `g` datetime DEFAULT CURRENT_TIMESTAMP,
+ `h` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`i` datetime DEFAULT NULL,
`j` datetime DEFAULT '1986-09-27 03:00:00'
) ENGINE=InnoDB DEFAULT CHARSET=latin1
@@ -803,7 +803,7 @@ CREATE TABLE t2 SELECT a FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `a` datetime DEFAULT NULL
+ `a` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t2;
a
@@ -812,7 +812,7 @@ CREATE TABLE t3 SELECT b FROM t1;
SHOW CREATE TABLE t3;
Table Create Table
t3 CREATE TABLE `t3` (
- `b` datetime DEFAULT NULL
+ `b` datetime DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t3;
b
@@ -821,7 +821,7 @@ CREATE TABLE t4 SELECT c FROM t1;
SHOW CREATE TABLE t4;
Table Create Table
t4 CREATE TABLE `t4` (
- `c` datetime DEFAULT NULL
+ `c` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t4;
c
@@ -2217,7 +2217,7 @@ 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'
+ `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t2;
a
@@ -2226,7 +2226,7 @@ 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'
+ `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t3;
b
@@ -2235,7 +2235,7 @@ 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'
+ `c` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t4;
c
@@ -2262,7 +2262,7 @@ CREATE TABLE t7 SELECT f FROM t1;
SHOW CREATE TABLE t7;
Table Create Table
t7 CREATE TABLE `t7` (
- `f` datetime(6) DEFAULT NULL
+ `f` datetime(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t7;
f
@@ -2271,7 +2271,7 @@ CREATE TABLE t8 SELECT g FROM t1;
SHOW CREATE TABLE t8;
Table Create Table
t8 CREATE TABLE `t8` (
- `g` datetime(6) DEFAULT NULL
+ `g` datetime(6) DEFAULT CURRENT_TIMESTAMP(6)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t8;
g
@@ -2280,7 +2280,7 @@ CREATE TABLE t9 SELECT h FROM t1;
SHOW CREATE TABLE t9;
Table Create Table
t9 CREATE TABLE `t9` (
- `h` datetime(6) DEFAULT NULL
+ `h` datetime(6) DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(6)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t9;
h
@@ -2331,14 +2331,14 @@ t12 CREATE TABLE `t12` (
`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',
+ `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.000000' ON UPDATE CURRENT_TIMESTAMP(6),
`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,
+ `f` datetime(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
+ `g` datetime(6) DEFAULT CURRENT_TIMESTAMP(6),
+ `h` datetime(6) DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(6),
`i` datetime(6) DEFAULT NULL,
`j` datetime(6) DEFAULT '1986-09-27 03:00:00.098765'
) ENGINE=InnoDB DEFAULT CHARSET=latin1
@@ -2359,7 +2359,7 @@ CREATE TABLE t2 SELECT a FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `a` datetime(6) DEFAULT NULL
+ `a` datetime(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t2;
a
@@ -2368,7 +2368,7 @@ CREATE TABLE t3 SELECT b FROM t1;
SHOW CREATE TABLE t3;
Table Create Table
t3 CREATE TABLE `t3` (
- `b` datetime(6) DEFAULT NULL
+ `b` datetime(6) DEFAULT CURRENT_TIMESTAMP(6)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t3;
b
@@ -2377,7 +2377,7 @@ CREATE TABLE t4 SELECT c FROM t1;
SHOW CREATE TABLE t4;
Table Create Table
t4 CREATE TABLE `t4` (
- `c` datetime(6) DEFAULT NULL
+ `c` datetime(6) DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(6)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t4;
c
diff --git a/mysql-test/r/galera_sst_mode.result b/mysql-test/r/galera_sst_mode.result
deleted file mode 100644
index ea25b322449..00000000000
--- a/mysql-test/r/galera_sst_mode.result
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Test for mysqldump's galera-sst-mode option
-#
-#
-# MDEV-6490: mysqldump unknown option --galera-sst-mode
-#
-CREATE DATABASE bug6490;
-USE bug6490;
-CREATE TABLE t1(c1 INT);
-INSERT INTO t1 values (1);
-INSERT INTO t1 values (2);
-# Save the current gtid_binlog_state.
-# Take a dump of bug6490 database
-DROP TABLE t1;
-# Load the dump
-RESET MASTER;
-SELECT * from t1;
-c1
-1
-2
-# Compare the two gtid_binlog_state's
-# Cleanup
-DROP DATABASE bug6490;
-# End of test
diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result
index 4b7a9a5dc0c..174088bf944 100644
--- a/mysql-test/r/gis.result
+++ b/mysql-test/r/gis.result
@@ -1,4 +1,5 @@
DROP TABLE IF EXISTS t1, gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
+DROP VIEW IF EXISTS v1;
CREATE TABLE gis_point (fid INTEGER NOT NULL PRIMARY KEY, g POINT);
CREATE TABLE gis_line (fid INTEGER NOT NULL PRIMARY KEY, g LINESTRING);
CREATE TABLE gis_polygon (fid INTEGER NOT NULL PRIMARY KEY, g POLYGON);
@@ -489,7 +490,7 @@ explain extended select issimple(MultiPoint(Point(3, 6), Point(4, 10))), issimpl
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 st_issimple(st_multipoint(st_point(3,6),st_point(4,10))) AS `issimple(MultiPoint(Point(3, 6), Point(4, 10)))`,st_issimple(st_point(3,6)) AS `issimple(Point(3, 6))`
+Note 1003 select st_issimple(st_multipoint(point(3,6),point(4,10))) AS `issimple(MultiPoint(Point(3, 6), Point(4, 10)))`,st_issimple(point(3,6)) AS `issimple(Point(3, 6))`
create table t1 (a geometry not null);
insert into t1 values (GeomFromText('Point(1 2)'));
insert into t1 values ('Garbage');
@@ -1618,4 +1619,14 @@ create table t1 (pt point);
insert into t1 values(Geomfromtext('POLYGON((1 1, 2 2, 2 1, 1 1))'));
ERROR 22007: Incorrect POINT value: 'POLYGON' for column 'pt' at row 1
drop table t1;
-End of 5.5 tests
+SELECT st_astext(ST_Buffer(ST_PolygonFromText('POLYGON((3 5, 2 4, 2 5, 3 5))'), -100));
+st_astext(ST_Buffer(ST_PolygonFromText('POLYGON((3 5, 2 4, 2 5, 3 5))'), -100))
+GEOMETRYCOLLECTION EMPTY
+CREATE VIEW v1 AS SELECT POINT(1,1) AS p;
+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 point(1,1) AS `p` latin1 latin1_swedish_ci
+SELECT ASTEXT(p) FROM v1;
+ASTEXT(p)
+POINT(1 1)
+DROP VIEW v1;
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result
index 9a259b3c4c6..38abbfef261 100644
--- a/mysql-test/r/group_by.result
+++ b/mysql-test/r/group_by.result
@@ -2339,6 +2339,16 @@ MIN(a) b
0 a
DROP TABLE t1;
+create table t1 (a int, b int);
+insert into t1 values (1,11), (1,12), (2,22),(2,23), (4,44),(4,45);
+create table t2 (c int, d int);
+insert into t2 values (1,11), (2,22), (4,44);
+select distinct a,sum(b), (select d from t2 where c=a order by max(b) limit 1) from t1 group by a order by max(b);
+a sum(b) (select d from t2 where c=a order by max(b) limit 1)
+1 23 11
+2 45 22
+4 89 44
+drop table t1, t2;
#
# LP bug#993726 Wrong result from a query with ALL subquery predicate in WHERE
#
diff --git a/mysql-test/r/group_by_innodb.result b/mysql-test/r/group_by_innodb.result
index 1098579a82d..381e0d7493c 100644
--- a/mysql-test/r/group_by_innodb.result
+++ b/mysql-test/r/group_by_innodb.result
@@ -79,4 +79,48 @@ oidGroup oid oid
1 3 3
1 4 NULL
DROP TABLE t1, t2;
+#
+# MDEV-7193: Incorrect Query Result (MySQL Bug 68897) in MariaDB 10.0.14
+# (fixed by MDEV-5719)
+#
+CREATE TABLE `t1` (
+`param` int(11) NOT NULL,
+`idx` int(11) NOT NULL,
+`text` varchar(255) default NULL,
+PRIMARY KEY (`param`,`idx`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO `t1` (`param`, `idx`, `text`) VALUES
+(1, 0, 'select'),
+(1, 1, 'Kabel mit Stecker 5-polig'),
+(1, 2, 'Kabel ohne Stecker'),
+(2, 0, 'number'),
+(2, 1, '22'),
+(2, 2, '25');
+CREATE TABLE `t2` (
+`id` int PRIMARY KEY
+);
+INSERT INTO t2 VALUES (1),(2),(3),(4);
+SELECT t2.id AS id, T.text AS xtext,GROUP_CONCAT(T3.text) AS optionen
+FROM t2
+LEFT JOIN t1 AS T ON(T.param=t2.id AND T.idx=0 )
+LEFT JOIN t1 AS T3 ON(T3.param=t2.id AND T3.idx>0 )
+GROUP BY t2.id
+ORDER BY id ASC;
+id xtext optionen
+1 select Kabel mit Stecker 5-polig,Kabel ohne Stecker
+2 number 22,25
+3 NULL NULL
+4 NULL NULL
+SELECT t2.id AS id, T.text AS xtext,GROUP_CONCAT(T3.text) AS optionen
+FROM t2
+LEFT JOIN t1 AS T ON(T.param=t2.id AND T.idx=0 )
+LEFT JOIN t1 AS T3 ON(T3.param=t2.id AND T3.idx>0 )
+GROUP BY t2.id
+ORDER BY id DESC;
+id xtext optionen
+4 NULL NULL
+3 NULL NULL
+2 number 22,25
+1 select Kabel mit Stecker 5-polig,Kabel ohne Stecker
+DROP TABLE t1, t2;
# End of tests
diff --git a/mysql-test/r/having.result b/mysql-test/r/having.result
index 99cc5d484bd..eda67460205 100644
--- a/mysql-test/r/having.result
+++ b/mysql-test/r/having.result
@@ -667,6 +667,37 @@ pk f
DROP TABLE t1;
End of 5.3 tests
#
+# Bug MDEV-7301: Unknown column quoted with backticks in HAVING clause when using function.
+# Bug#16221433 MYSQL REJECTS QUERY DUE TO BAD RESOLUTION OF NAMES IN HAVING; VIEW UNREADABLE
+#
+CREATE TABLE `t1` (
+`id` int(11) NOT NULL,
+`title` varchar(45) DEFAULT NULL,
+PRIMARY KEY (`id`)
+) DEFAULT CHARSET=utf8;
+INSERT INTO `t1` VALUES ('1', 'Just for fun');
+INSERT INTO `t1` VALUES ('2', 'Wait until a sunhine');
+INSERT INTO `t1` VALUES ('3', 'Take a new turn');
+SELECT `id`, SHA1(`title`) AS `column_1`
+FROM `t1`
+HAVING `column_1` LIKE '8%';
+id column_1
+1 80a12660d24a72460e5e292fe33f870276d7f40a
+expected 1 row(s) returned
+SELECT `id`, SHA1(`title`) AS `column_1`
+FROM `t1`
+HAVING UPPER(column_1) LIKE '8%';
+id column_1
+1 80a12660d24a72460e5e292fe33f870276d7f40a
+expected -- 1 row(s) returned
+SELECT `id`, SHA1(`title`) AS `column_1`
+FROM `t1`
+HAVING UPPER(`column_1`) LIKE '8%';
+id column_1
+1 80a12660d24a72460e5e292fe33f870276d7f40a
+expected -- 1 row(s) returned not ER_BAD_FIELD_ERROR
+drop table t1;
+#
# Bug mdev-5160: two-way join with HAVING over the second table
#
CREATE TABLE t1 (c1 varchar(6)) ENGINE=MyISAM;
diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result
index 41eb76f4e8d..6980b5d30ed 100644
--- a/mysql-test/r/information_schema.result
+++ b/mysql-test/r/information_schema.result
@@ -1977,6 +1977,21 @@ drop view v1;
# Clean-up.
drop database mysqltest;
#
+# Test for bug #16869534 - "QUERYING SUBSET OF COLUMNS DOESN'T USE TABLE
+# CACHE; OPENED_TABLES INCREASES"
+#
+SELECT * FROM INFORMATION_SCHEMA.TABLES;
+SELECT VARIABLE_VALUE INTO @val1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE
+VARIABLE_NAME LIKE 'Opened_tables';
+SELECT ENGINE FROM INFORMATION_SCHEMA.TABLES;
+# The below SELECT query should give same output as above SELECT query.
+SELECT VARIABLE_VALUE INTO @val2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE
+VARIABLE_NAME LIKE 'Opened_tables';
+# The below select should return '1'
+SELECT @val1 = @val2;
+@val1 = @val2
+1
+#
# End of 5.5 tests
#
#
diff --git a/mysql-test/r/information_schema2.result b/mysql-test/r/information_schema2.result
index 60a20944839..f82301699a7 100644
--- a/mysql-test/r/information_schema2.result
+++ b/mysql-test/r/information_schema2.result
@@ -6,3 +6,15 @@ select variable_name from information_schema.session_variables where variable_na
(select variable_name from information_schema.session_variables where variable_name = 'basedir');
variable_name
BASEDIR
+create table t1 (a char);
+insert t1 values ('a'),('t'),('z');
+flush status;
+select a, exists (select 1 from information_schema.columns where table_schema=concat('tes',a)) from t1;
+a exists (select 1 from information_schema.columns where table_schema=concat('tes',a))
+a 0
+t 1
+z 0
+show status like 'created_tmp_tables';
+Variable_name Value
+Created_tmp_tables 43
+drop table t1;
diff --git a/mysql-test/r/innodb_mysql_sync.result b/mysql-test/r/innodb_mysql_sync.result
index 49d69d13e40..478b0109816 100644
--- a/mysql-test/r/innodb_mysql_sync.result
+++ b/mysql-test/r/innodb_mysql_sync.result
@@ -528,6 +528,7 @@ SET DEBUG_SYNC= 'RESET';
# This should not do anything
ALTER TABLE t1;
affected rows: 0
+info: Records: 0 Duplicates: 0 Warnings: 0
SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL rebuild';
# Check that we rebuild the table
ALTER TABLE t1 engine=innodb;
diff --git a/mysql-test/r/join_cache.result b/mysql-test/r/join_cache.result
index 456e17a91f7..c1dbef08c04 100644
--- a/mysql-test/r/join_cache.result
+++ b/mysql-test/r/join_cache.result
@@ -5874,4 +5874,17 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 11 Using where
set join_buffer_space_limit=default;
drop table t1;
+#
+# MDEV-6687: Assertion `0' failed in Protocol::end_statement on query
+#
+SET join_cache_level = 3;
+# The following should have
+# - table order PROFILING,user,
+# - table user accessed with hash_ALL:
+explain
+SELECT * FROM INFORMATION_SCHEMA.PROFILING, mysql.user WHERE password_expired = PAGE_FAULTS_MINOR;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE PROFILING ALL NULL NULL NULL NULL NULL Using where
+1 SIMPLE user hash_ALL NULL #hash#$hj 1 information_schema.PROFILING.PAGE_FAULTS_MINOR 4 Using where; Using join buffer (flat, BNLH join)
+set join_cache_level=default;
set @@optimizer_switch=@save_optimizer_switch;
diff --git a/mysql-test/r/log_errchk.result b/mysql-test/r/log_errchk.result
index 407fba2323e..e1968e29662 100644
--- a/mysql-test/r/log_errchk.result
+++ b/mysql-test/r/log_errchk.result
@@ -1,5 +1,4 @@
-call mtr.add_suppression("Could not use");
-# Case 1: Setting fife file to general_log_file and slow_query_log_file
+# Case 1: Setting fifo 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'
@@ -7,4 +6,6 @@ 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.
+call mtr.add_suppression("Could not use .* for logging \\(error 6\\)");
+call mtr.add_suppression("File '.*' not found \\(Errcode: 6 ");
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 a609b222d53..6cbb25bd1d4 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/5: Checking mysql database
+Phase 1/6: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats OK
@@ -43,9 +43,10 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
-Phase 2/5: Running 'mysql_fix_privilege_tables'...
-Phase 3/5: Fixing table and database names
-Phase 4/5: Checking and upgrading tables
+Phase 2/6: Fixing views
+Phase 3/6: Running 'mysql_fix_privilege_tables'
+Phase 4/6: Fixing table and database names
+Phase 5/6: Checking and upgrading tables
Processing databases
information_schema
mtr
@@ -53,7 +54,7 @@ mtr.global_suppressions OK
mtr.test_suppressions OK
performance_schema
test
-Phase 5/5: Running 'FLUSH PRIVILEGES'...
+Phase 6/6: Running 'FLUSH PRIVILEGES'
OK
DROP TABLE general_log;
RENAME TABLE renamed_general_log TO general_log;
diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result
index f701e7fa085..688184f2f83 100644
--- a/mysql-test/r/multi_update.result
+++ b/mysql-test/r/multi_update.result
@@ -823,6 +823,200 @@ create view v3 as select t2.id, t3.b from t2 join t3 using(id);
update t1 join v3 using (id) set t1.a=0;
drop view v1, v2, v3;
drop table t2, t3, t1;
+#
+# MDEV-7613: MariaDB 5.5.40 server crash on update table left join
+# with a view
+#
+CREATE TABLE `t1` (
+`f1` varchar(6) COLLATE latin1_general_ci DEFAULT NULL,
+`f2` varchar(6) COLLATE latin1_general_ci DEFAULT NULL,
+`f3` varchar(7) COLLATE latin1_general_ci DEFAULT NULL,
+`f4` varchar(15) COLLATE latin1_general_ci DEFAULT NULL,
+`f5` datetime DEFAULT NULL,
+`f6` varchar(2) COLLATE latin1_general_ci DEFAULT NULL,
+`f7` varchar(2) COLLATE latin1_general_ci DEFAULT NULL,
+`ff1` int(1) DEFAULT NULL,
+`ff2` int(1) DEFAULT NULL,
+`ff3` int(1) DEFAULT NULL,
+`ff4` int(1) DEFAULT NULL,
+`ff5` int(1) DEFAULT NULL,
+`ff6` int(1) DEFAULT NULL,
+`ff7` int(1) DEFAULT NULL,
+`ff8` int(2) DEFAULT NULL,
+`ff9` int(1) DEFAULT NULL,
+`ff10` int(1) DEFAULT NULL,
+`ff11` int(1) DEFAULT NULL,
+`ff12` int(1) DEFAULT NULL,
+`ff13` int(1) DEFAULT NULL,
+`ff14` int(1) DEFAULT NULL,
+`ff15` int(1) DEFAULT NULL,
+`f8` varchar(70) COLLATE latin1_general_ci DEFAULT NULL,
+`f9` varchar(20) COLLATE latin1_general_ci DEFAULT NULL,
+`f10` varchar(50) COLLATE latin1_general_ci NOT NULL,
+`f11` varchar(50) COLLATE latin1_general_ci DEFAULT NULL,
+`f12` varchar(255) COLLATE latin1_general_ci DEFAULT NULL,
+`f13` text COLLATE latin1_general_ci,
+`f14` time DEFAULT NULL,
+`f15` varchar(30) COLLATE latin1_general_ci DEFAULT NULL,
+`fg1` int(11) DEFAULT NULL,
+`fg2` int(11) DEFAULT NULL,
+`fg3` int(11) DEFAULT NULL,
+`fg4` int(11) DEFAULT NULL,
+`fg5` int(11) DEFAULT NULL,
+`fg6` int(11) DEFAULT NULL,
+`fg7` int(11) DEFAULT NULL,
+`fg9` int(11) DEFAULT NULL,
+`fg10` int(11) DEFAULT NULL,
+`fg11` int(11) DEFAULT NULL,
+`fg12` int(11) DEFAULT NULL,
+`fg13` int(11) DEFAULT NULL,
+`fg14` int(11) DEFAULT NULL,
+`fg15` int(11) DEFAULT NULL,
+`f16` double DEFAULT NULL,
+`f17` double DEFAULT NULL,
+`f18` int(11) DEFAULT NULL,
+`f19` int(11) DEFAULT NULL,
+`f20` varchar(255) COLLATE latin1_general_ci DEFAULT NULL,
+`f21` int(11) DEFAULT NULL,
+`f22` int(11) DEFAULT NULL,
+`f23` int(11) DEFAULT NULL,
+`f24` double DEFAULT NULL,
+`f25` int(11) DEFAULT NULL,
+`f26` double DEFAULT NULL,
+`f27` int(11) DEFAULT NULL,
+`f28` int(11) DEFAULT NULL,
+`f29` double DEFAULT NULL,
+`f30` int(11) DEFAULT NULL,
+`f31` double DEFAULT NULL,
+`PZ` double DEFAULT NULL,
+`f32` varchar(50) COLLATE latin1_general_ci DEFAULT NULL,
+`f33` varchar(50) COLLATE latin1_general_ci DEFAULT NULL,
+`f34` varchar(50) COLLATE latin1_general_ci DEFAULT NULL,
+`f35` varchar(30) COLLATE latin1_general_ci DEFAULT NULL,
+`f36` varchar(20) COLLATE latin1_general_ci DEFAULT NULL,
+`f37` varchar(50) COLLATE latin1_general_ci DEFAULT NULL,
+`f20_2` varchar(20) COLLATE latin1_general_ci DEFAULT NULL,
+`f38` varchar(30) COLLATE latin1_general_ci DEFAULT NULL COMMENT 'Email = E-Mail / Whitemail = Brief',
+`insert_ts` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
+PRIMARY KEY (`f10`),
+KEY `f5_f12` (`f5`,`f12`),
+KEY `f5_f20` (`f5`,`f20`),
+KEY `f5_f33` (`f5`,`f33`)
+) DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci ROW_FORMAT=COMPACT;
+INSERT INTO `t1` VALUES ('2011/2','201105','2011/19','gstfbnfr','2011-05-06
+00:00:00','gg','Ag',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,'','','','','','','21:56:28','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,NULL,NULL,0,0,'Dffgult',1,0,0,NULL,0,NULL,0,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'ggggil',NULL),('2008/4','200812','2008/50','hgckbgfx','2008-12-08
+00:00:00','gg','Ag',2,NULL,2,1,1,1,1,24,1,NULL,1,1,1,2,0,'gusschlifßlich
+zugg
+gflffonifrfn','88.77.79.214','10001614','fg-gtgggggdgtfn','fg-gtgggggdgtfn','birgit.tfrpfllf@gggx.df','11:55:21',NULL,1,0,1,1,1,1,1,1,0,1,1,1,0,0,NULL,NULL,0,4,'ffrtrgg',1,6,10,1.66666666666667,4,1,10,14,1.4,1,NULL,NULL,'out',NULL,NULL,'49','ggobilcogg','k.A.',NULL,'ggggil',NULL),('2008/4','200812','2008/51','hgckbgfx','2008-12-15
+00:00:00','gg','Ag',4,5,5,4,5,5,5,NULL,4,5,1,1,1,4,0,'gusschlifßlich zugg
+gflffonifrfn','79.197.185.64','10001686','fg-gtgggggdgtfn','fg-gtgggggdgtfn','kgtjg@swfftys.df','09:28:42',NULL,1,1,1,1,1,1,1,1,1,1,1,1,0,0,NULL,NULL,0,5,'ffrtrgg',1,7,11,4.71428571428571,16,1.2,12,49,4.08111111111111,1,NULL,NULL,'out',NULL,NULL,'49','ggobilcogg','k.A.',NULL,'ggggil',NULL),('2008/4','200812','2008/50','nufchti','2008-12-08
+00:00:00','gg','Ag',4,1,1,5,5,5,5,12,4,5,1,1,2,1,0,'gusschlifßlich zugg
+gflffonifrfn','89.54.151.216','10001700','fg-gtgggggdgtfn','fg-gtgggggdgtfn','H_K2006@frffnft.df','16:41:45',NULL,1,1,1,1,1,1,1,1,1,1,1,1,0,0,NULL,NULL,0,5,'ffrtrgg',1,7,10,4.28571428571429,11,2.6,12,41,1.58111111111111,1,NULL,NULL,'ffrtrgg
+Bgckofficf 5','vb5','Nufchtfr,
+Iris','49','ggobilcogg','grfurt','Intfrn','ggggil',NULL),('2008/4','200812','2008/50','junghdro','2008-12-11
+00:00:00','Do','Ag',2,2,5,5,4,4,2,72,2,5,2,2,1,1,0,'gusschlifßlich zugg
+gflffonifrfn','84.61.20.216','10001849','fg-ggriff','fg-ggriff','schofnf-glftfr@grcor.df','20:18:05',NULL,1,1,1,1,1,1,1,1,1,1,1,1,0,0,NULL,NULL,0,5,'ffrtrgg',1,7,24,1.42857142857141,12,2.4,12,16,1,1,NULL,NULL,'ffrtrgg
+Bgckofficf 5','vb5','Junghfinrich,
+Dorothfg','49','ggobilcogg','grfurt','Intfrn','ggggil',NULL),('2008/4','200812','2008/50','fbflktj','2008-12-08
+00:00:00','gg','Ag',4,2,2,5,1,1,1,24,NULL,NULL,NULL,NULL,NULL,0,0,'Kgggfrg
+bzw. DigiCggg
+Funktion','217.84.62.6','10001888','fg-Kündigungfn','fg-Kündigungfn','f.frofschkf@gggx.df','21:05:59',NULL,1,1,1,1,1,1,1,0,0,0,0,0,0,0,NULL,NULL,0,0,'ffrtrgg',1,7,16,2.28571428571429,0,NULL,7,16,2.28571428571429,0,NULL,NULL,'out',NULL,'gbfl,
+Kgtjg','49','ggobilcogg','k.A.','gxtfrn','ggggil',NULL),('2008/4','200812','2008/50','gltggggri','2008-12-09
+00:00:00','Di','Ag',4,1,1,4,2,1,2,16,1,2,2,2,2,2,0,'gusschlifßlich zugg
+gflffonifrfn','81.171.157.211','10001988','fg-gtgggggdgtfn','fg-gtgggggdgtfn','bistfr@nftcolognf.df','11:07:54',NULL,1,1,1,1,1,1,1,1,1,1,1,1,0,0,NULL,NULL,0,5,'ffrtrgg',1,7,21,1,11,2.2,12,12,2.66666666666667,1,NULL,NULL,'out',NULL,NULL,'49','ggobilcogg','k.A.','gxtfrn','ggggil',NULL),('2008/4','200812','2008/50','ggufllfsg','2008-12-09
+00:00:00','Di','Ag',2,2,2,2,1,1,2,12,2,2,2,1,1,2,0,'ggobilfs
+Intfrnft','62.154.142.186','10002097','fg-gtgggggdgtfn','fg-gtgggggdgtfn','norbfrtwfdlich@fgggil.df','09:42:11',NULL,1,1,1,1,1,1,1,1,1,1,1,1,0,0,NULL,NULL,0,5,'ffrtrgg',1,7,12,1.71428571428571,8,1.6,12,20,1.66666666666667,1,NULL,NULL,'ffrtrgg
+Bgckofficf 1','vb1','Mufllfr,
+ggbinf','49','ggobilcogg','grfurt','Intfrn','ggggil',NULL),('2008/4','200812','2008/50','wggnfg','2008-12-09
+00:00:00','Di','Ag',5,5,5,5,5,5,5,12,5,5,5,5,5,5,0,'gls grsgtz für
+Ffstnftz','85.180.141.246','10002127','fg-Kündigungfn','fg-Kündigungfn','rfinhgrt.gdolph@yghoo.df','17:44:11',NULL,1,1,1,1,1,1,1,1,1,1,1,1,0,0,NULL,NULL,0,5,'ffrtrgg',1,7,15,5,25,5,12,60,5,1,NULL,NULL,'ffrtrgg
+Bgckofficf 1','vb1','Wggnfr,
+Annftt','49','ggobilcogg','grfurt','Intfrn','ggggil',NULL),('2008/4','200812','2008/50','schubrbf','2008-12-10
+00:00:00','Mi','Ag',1,2,NULL,2,1,2,1,24,NULL,NULL,NULL,NULL,NULL,0,0,'Kgggfrg
+bzw. DigiCggg
+Funktion','91.40.98.242','10002160','fg-gtgggggdgtfn','fg-gtgggggdgtfn','olgf.lifb@gggx.nft','18:18:25',NULL,1,1,0,1,1,1,1,0,0,0,0,0,0,0,NULL,NULL,0,0,'ffrtrgg',1,6,11,1.81111111111111,0,NULL,6,11,1.81111111111111,0,NULL,NULL,'out',NULL,NULL,'49','ggobilcogg','k.A.','gxtfrn','ggggil',NULL);
+CREATE TABLE `t2` (
+`ft1` datetime DEFAULT NULL,
+`ft2` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+`ft3` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+`ft4` varchar(255) COLLATE latin1_general_ci NOT NULL DEFAULT '',
+`ft5` varchar(255) COLLATE latin1_general_ci NOT NULL DEFAULT '',
+`ft6` varchar(255) COLLATE latin1_general_ci DEFAULT NULL,
+`ft6_2` varchar(255) COLLATE latin1_general_ci DEFAULT NULL,
+`ft7` varchar(255) COLLATE latin1_general_ci DEFAULT NULL,
+`ft8` varchar(255) COLLATE latin1_general_ci DEFAULT NULL,
+`ft9` varchar(255) COLLATE latin1_general_ci DEFAULT NULL,
+`ft10` varchar(255) COLLATE latin1_general_ci DEFAULT NULL,
+PRIMARY KEY (`ft4`,`ft5`)
+) DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
+INSERT INTO `t2` VALUES ('2013-03-13 00:00:00','2013-03-13 00:00:00','9999-12-31 00:00:00','#','extern FP f32 2','Default','Intern','DEFAULT',NULL,NULL,NULL),('2013-03-13 00:00:00','2013-03-13 00:00:00','9999-12-31 00:00:00','#','extern FP f32 3','Default','Intern','DEFAULT',NULL,NULL,NULL);
+CREATE TABLE `t3` (
+`fe1` int(10) NOT NULL DEFAULT '0',
+`fe2` char(50) COLLATE latin1_general_ci DEFAULT 'nn',
+`f34` char(50) COLLATE latin1_general_ci DEFAULT NULL,
+`fe3` double DEFAULT NULL,
+`fe4` double DEFAULT NULL,
+`fe5` char(4) COLLATE latin1_general_ci DEFAULT NULL,
+`f32` char(50) COLLATE latin1_general_ci DEFAULT NULL,
+`fe6` int(3) DEFAULT '0',
+`fe7` char(1) COLLATE latin1_general_ci DEFAULT NULL,
+`ft6` char(50) COLLATE latin1_general_ci DEFAULT NULL,
+`f33` char(4) COLLATE latin1_general_ci DEFAULT NULL COMMENT 'virtuelle f33s',
+`fe8` char(4) COLLATE latin1_general_ci DEFAULT NULL COMMENT 'aus dem ADS',
+`f37` char(50) COLLATE latin1_general_ci DEFAULT NULL,
+`fe9` char(50) COLLATE latin1_general_ci DEFAULT NULL,
+`fe10` int(5) DEFAULT '0',
+`fe11` int(10) DEFAULT '0',
+`fe12` char(50) COLLATE latin1_general_ci DEFAULT NULL,
+`fe13` double DEFAULT NULL,
+`fe14` char(50) COLLATE latin1_general_ci DEFAULT NULL,
+`fe15` date DEFAULT NULL,
+`fe16` date DEFAULT NULL,
+`fe17` int(10) DEFAULT '0',
+`fe18` date NOT NULL DEFAULT '0000-00-00',
+`ft3` date NOT NULL DEFAULT '0000-00-00',
+PRIMARY KEY (`fe1`),
+KEY `fe2` (`fe2`,`fe18`,`ft3`),
+KEY `f33` (`f33`),
+KEY `fe8` (`fe8`)
+) DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci ROW_FORMAT=COMPACT COMMENT='CustomerService und Outsourcer Userinformationen';
+INSERT INTO `t3` VALUES (1,'aabggn','gab, glgna',0,NULL,NULL,'gxtgrn D gnd g
+gggsbgrg',0,NULL,'gxtgrn','dsa','dsa','gggsbgrg','0',91611,0,'0',0,'agsggschigdgn','2014-08-11','2014-09-05',0,'2011-01-01','2014-08-11'),(4,'aabigr','gab,
+Iggr',0,NULL,NULL,'gxtgrn D gnd g
+gggsbgrg',0,NULL,'gxtgrn','dsa','dsa','gggsbgrg','0',0,0,'0',0,'agsggschigdgn','2014-08-11','2014-09-05',0,'2012-10-01','2014-08-11'),(7,'abgcrist','gbg,
+ghristggna',15182,1,'ja','ggshilfg gxtgrn 1',1,NULL,'gg
+galgs','ag1','ag1','grfgrt','0',11941,0,'0',0,'agsggschigdgn','2014-01-11',NULL,11802051,'1900-01-01','2010-06-10'),(8,'abgcrist','gbg,
+ghristggna',15182,1,'ja','Zgntralg gftgr galgs Bgtrgggng 1',1,NULL,'gg
+galgs','sb1','sb1','grfgrt','0',11941,0,'0',0,'agsggschigdgn','2014-01-11',NULL,11802051,'2010-07-01','2012-08-11'),(9,'abgcrist','gbg,
+ghristggna',15182,1,'ja','galgs Inbggnd 2',1,NULL,'gg
+galgs','si2','si2','grfgrt','0',11941,0,'0',0,'agsggschigdgn','2014-01-11',NULL,11802051,'2012-09-01','2014-01-11'),(10,'abgcgr','gbg,
+ggrnglgg',14962,1,NULL,'galgs Ogtbggnd 1',1,NULL,'gg
+galgs','sg1','sg1','grfgrt','0',12401,0,'abgcrn',1,NULL,NULL,NULL,11800647,'1900-01-01','2010-11-10'),(11,'abgcgr','gbg,
+ggrnglgg',14962,1,NULL,'galgs Ogtbggnd 1',1,NULL,'gg
+galgs','sg1','sg1','grfgrt','0',12401,0,'abgcrn',1,NULL,NULL,NULL,11800647,'2010-12-01','2011-08-11'),(12,'abgcgr','gbg,
+ggrnglgg',14962,1,NULL,'galgs Ogtbggnd 2',1,NULL,'gg
+galgs','sg2','sg2','grfgrt','0',12401,0,'abgcrn',1,NULL,NULL,NULL,11800647,'2011-09-01','2012-01-11'),(13,'abgcgr','gbg,
+ggrnglgg',14962,0.75,NULL,'galgs Ogtbggnd 2',1,NULL,'gg
+galgs','sg2','sg2','grfgrt','0',12401,0,'abgcrn',1,NULL,NULL,'2011-09-11',11800647,'2012-02-01','2011-08-11'),(14,'rgghrsgr','gbg,
+gigrid',14781,1,'ja','Fgrdgrgngsmanaggmgnt 1',1,NULL,'gg
+Zahlgng','fm1','fm1','grfgrt','0',12141,0,'0',1,NULL,NULL,NULL,11010781,'1900-01-01','2012-08-11');
+CREATE ALGORITHM=MERGE
+DEFINER=`root`@`localhost` SQL SECURITY DEFINER
+VIEW `v1` AS select `t1a`.`ft1` AS `ft1`,`t1a`.`ft2` AS `ft2`,`t1a`.`ft3` AS `ft3`,`t1a`.`ft4` AS `ft4`,`t1a`.`ft5` AS `ft5`,`t1a`.`ft6` AS `ft6`,`t1a`.`ft6_2` AS `ft6_2`,`t1a`.`ft7` AS `ft7`,`t1a`.`ft8` AS `ft8`,`t1a`.`ft9` AS `ft9`,`t1a`.`ft10` AS `ft10` from `t2` `t1a` where (if((`t1a`.`ft10` = 'virtuell'),0,1) = 1);
+CREATE ALGORITHM=UNDEFINED
+DEFINER=`root`@`localhost` SQL SECURITY DEFINER
+VIEW `v2` AS select distinct `t1b`.`fe2` AS `fe2`,min(`t1b`.`fe18`) AS `fe18`,max(`t1b`.`ft3`) AS `ft3` from `t3` `t1b` where ((`t1b`.`fe2` <> '') and (curdate() >= `t1b`.`fe18`)) group by `t1b`.`fe2`;
+CREATE ALGORITHM=UNDEFINED
+DEFINER=`root`@`localhost` SQL SECURITY DEFINER
+VIEW `v3` AS select `t1c`.`fe2` AS `fe2`,`t1c`.`f34` AS `f34`,`t1c`.`f33` AS `f33`,`t1c`.`f32` AS `f32`,`t1c`.`f37` AS `f37`,`t1c`.`fe10` AS `fe10`,if((`tov`.`ft6` in ('klarmobil','callmobile')),`tov`.`ft9`,`tov`.`ft6`) AS `ft6_1`,`tov`.`ft6_2` AS `ft6_2`,`ua`.`fe18` AS `fe18`,`ua`.`ft3` AS `ft3` from ((`t3` `t1c` left join `v2` `ua` on((`t1c`.`fe2` = `ua`.`fe2`))) left join `v1` `tov` on((`t1c`.`fe8` = `tov`.`ft4`))) where (`t1c`.`ft3` = `ua`.`ft3`) group by `t1c`.`fe2`,`t1c`.`f34`,`t1c`.`f33`,`t1c`.`f32` order by `t1c`.`f34`;
+UPDATE t1 t1 left join v3 t2 on t1.f4 = t2.fe2 SET t1.f20 = t2.ft6_1, t1.f32 = t2.f32, t1.f33 = t2.f33, t1.f37 = t2.f37 WHERE f5 >= '2015-02-01';
+#MDEV-8018: main.multi_update fails with --ps-protocol
+prepare stmt1 from "UPDATE t1 t1 left join v3 t2 on t1.f4 = t2.fe2 SET t1.f20 = t2.ft6_1, t1.f32 = t2.f32, t1.f33 = t2.f33, t1.f37 = t2.f37 WHERE f5 >= '2015-02-01'";
+execute stmt1;
+execute stmt1;
+deallocate prepare stmt1;
+drop view v3,v2,v1;
+drop table t1,t2,t3;
end of 5.5 tests
# Bug mdev-5970
diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result
index 3a6fa9a4673..5506e4e419c 100644
--- a/mysql-test/r/myisam.result
+++ b/mysql-test/r/myisam.result
@@ -2527,6 +2527,17 @@ test.t1 check error Size of indexfile is: 1024 Should be: 2048
test.t1 check warning Size of datafile is: 14 Should be: 7
test.t1 check error Corrupt
DROP TABLE t1;
+#
+# MDEV-3870 - Valgrind warnings on OPTIMIZE MyISAM or Aria TABLE with
+# disabled keys
+#
+CREATE TABLE t1 (a INT, KEY(a)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (4),(3),(1),(0);
+ALTER TABLE t1 DISABLE KEYS;
+OPTIMIZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+DROP TABLE t1;
show variables like 'myisam_block_size';
Variable_name Value
myisam_block_size 1024
diff --git a/mysql-test/r/mysql_tzinfo_to_sql_symlink.result b/mysql-test/r/mysql_tzinfo_to_sql_symlink.result
index dda732937ee..f127e756987 100644
--- a/mysql-test/r/mysql_tzinfo_to_sql_symlink.result
+++ b/mysql-test/r/mysql_tzinfo_to_sql_symlink.result
@@ -60,3 +60,12 @@ INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset,
#
TRUNCATE TABLE time_zone_leap_second;
ALTER TABLE time_zone_leap_second ORDER BY Transition_time;
+#
+# MDEV-6236 - [PATCH] mysql_tzinfo_to_sql may produce invalid SQL
+#
+TRUNCATE TABLE time_zone;
+TRUNCATE TABLE time_zone_name;
+TRUNCATE TABLE time_zone_transition;
+TRUNCATE TABLE time_zone_transition_type;
+ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
+ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
diff --git a/mysql-test/r/mysql_upgrade-6984.result b/mysql-test/r/mysql_upgrade-6984.result
index 6ae995cd030..7890b66d494 100644
--- a/mysql-test/r/mysql_upgrade-6984.result
+++ b/mysql-test/r/mysql_upgrade-6984.result
@@ -1,5 +1,5 @@
update mysql.user set password=password("foo") where user='root';
-Phase 1/5: Checking mysql database
+Phase 1/6: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats OK
@@ -42,9 +42,10 @@ 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
+Phase 2/6: Fixing views
+Phase 3/6: Running 'mysql_fix_privilege_tables'
+Phase 4/6: Fixing table and database names
+Phase 5/6: Checking and upgrading tables
Processing databases
information_schema
mtr
@@ -52,7 +53,7 @@ mtr.global_suppressions OK
mtr.test_suppressions OK
performance_schema
test
-Phase 5/5: Running 'FLUSH PRIVILEGES'...
+Phase 6/6: 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 64c2c0222fc..737f8b63783 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/5: Checking mysql database
+Phase 1/6: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats OK
@@ -30,9 +30,10 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
-Phase 2/5: Running 'mysql_fix_privilege_tables'...
-Phase 3/5: Fixing table and database names
-Phase 4/5: Checking and upgrading tables
+Phase 2/6: Fixing views
+Phase 3/6: Running 'mysql_fix_privilege_tables'
+Phase 4/6: Fixing table and database names
+Phase 5/6: Checking and upgrading tables
Processing databases
information_schema
mtr
@@ -40,12 +41,12 @@ mtr.global_suppressions OK
mtr.test_suppressions OK
performance_schema
test
-Phase 5/5: Running 'FLUSH PRIVILEGES'...
+Phase 6/6: 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/5: Checking mysql database
+Phase 1/6: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats OK
@@ -76,9 +77,10 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
-Phase 2/5: Running 'mysql_fix_privilege_tables'...
-Phase 3/5: Fixing table and database names
-Phase 4/5: Checking and upgrading tables
+Phase 2/6: Fixing views
+Phase 3/6: Running 'mysql_fix_privilege_tables'
+Phase 4/6: Fixing table and database names
+Phase 5/6: Checking and upgrading tables
Processing databases
information_schema
mtr
@@ -86,12 +88,12 @@ mtr.global_suppressions OK
mtr.test_suppressions OK
performance_schema
test
-Phase 5/5: Running 'FLUSH PRIVILEGES'...
+Phase 6/6: Running 'FLUSH PRIVILEGES'
OK
CREATE USER mysqltest1@'%' IDENTIFIED by 'sakila';
GRANT ALL ON *.* TO mysqltest1@'%';
Run mysql_upgrade with password protected account
-Phase 1/5: Checking mysql database
+Phase 1/6: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats OK
@@ -122,9 +124,10 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
-Phase 2/5: Running 'mysql_fix_privilege_tables'...
-Phase 3/5: Fixing table and database names
-Phase 4/5: Checking and upgrading tables
+Phase 2/6: Fixing views
+Phase 3/6: Running 'mysql_fix_privilege_tables'
+Phase 4/6: Fixing table and database names
+Phase 5/6: Checking and upgrading tables
Processing databases
information_schema
mtr
@@ -132,7 +135,7 @@ mtr.global_suppressions OK
mtr.test_suppressions OK
performance_schema
test
-Phase 5/5: Running 'FLUSH PRIVILEGES'...
+Phase 6/6: Running 'FLUSH PRIVILEGES'
OK
DROP USER mysqltest1@'%';
Version check failed. Got the following error when calling the 'mysql' command line client
@@ -142,7 +145,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/5: Checking mysql database
+Phase 1/6: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats OK
@@ -173,9 +176,10 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
-Phase 2/5: Running 'mysql_fix_privilege_tables'...
-Phase 3/5: Fixing table and database names
-Phase 4/5: Checking and upgrading tables
+Phase 2/6: Fixing views
+Phase 3/6: Running 'mysql_fix_privilege_tables'
+Phase 4/6: Fixing table and database names
+Phase 5/6: Checking and upgrading tables
Processing databases
information_schema
mtr
@@ -183,7 +187,7 @@ mtr.global_suppressions OK
mtr.test_suppressions OK
performance_schema
test
-Phase 5/5: Running 'FLUSH PRIVILEGES'...
+Phase 6/6: Running 'FLUSH PRIVILEGES'
OK
set GLOBAL sql_mode=default;
#
@@ -194,7 +198,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/5: Checking mysql database
+Phase 1/6: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats OK
@@ -225,9 +229,10 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
-Phase 2/5: Running 'mysql_fix_privilege_tables'...
-Phase 3/5: Fixing table and database names
-Phase 4/5: Checking and upgrading tables
+Phase 2/6: Fixing views
+Phase 3/6: Running 'mysql_fix_privilege_tables'
+Phase 4/6: Fixing table and database names
+Phase 5/6: Checking and upgrading tables
Processing databases
information_schema
mtr
@@ -235,7 +240,7 @@ mtr.global_suppressions OK
mtr.test_suppressions OK
performance_schema
test
-Phase 5/5: Running 'FLUSH PRIVILEGES'...
+Phase 6/6: Running 'FLUSH PRIVILEGES'
OK
CALL testproc();
DROP PROCEDURE testproc;
@@ -249,7 +254,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/5: Checking mysql database
+Phase 1/6: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats OK
@@ -280,9 +285,10 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
-Phase 2/5: Running 'mysql_fix_privilege_tables'...
-Phase 3/5: Fixing table and database names
-Phase 4/5: Checking and upgrading tables
+Phase 2/6: Fixing views
+Phase 3/6: Running 'mysql_fix_privilege_tables'
+Phase 4/6: Fixing table and database names
+Phase 5/6: Checking and upgrading tables
Processing databases
information_schema
mtr
@@ -290,7 +296,7 @@ mtr.global_suppressions OK
mtr.test_suppressions OK
performance_schema
test
-Phase 5/5: Running 'FLUSH PRIVILEGES'...
+Phase 6/6: Running 'FLUSH PRIVILEGES'
OK
SHOW GRANTS FOR 'user3'@'%';
Grants for user3@%
@@ -299,7 +305,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/5: Checking mysql database
+Phase 1/6: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats OK
@@ -330,8 +336,11 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
-Phase 2/5: Running 'mysql_fix_privilege_tables'...
-Phase 5/5: Running 'FLUSH PRIVILEGES'...
+Phase 2/6: Fixing views... Skipped
+Phase 3/6: Running 'mysql_fix_privilege_tables'
+Phase 4/6: Fixing table and database names ... Skipped
+Phase 5/6: Checking and upgrading tables... Skipped
+Phase 6/6: Running 'FLUSH PRIVILEGES'
OK
#
# Bug#11827359 60223: MYSQL_UPGRADE PROBLEM WITH OPTION
@@ -339,7 +348,7 @@ OK
#
# Droping the previously created mysql_upgrade_info file..
# Running mysql_upgrade with --skip-write-binlog..
-Phase 1/5: Checking mysql database
+Phase 1/6: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats OK
@@ -370,9 +379,10 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
-Phase 2/5: Running 'mysql_fix_privilege_tables'...
-Phase 3/5: Fixing table and database names
-Phase 4/5: Checking and upgrading tables
+Phase 2/6: Fixing views
+Phase 3/6: Running 'mysql_fix_privilege_tables'
+Phase 4/6: Fixing table and database names
+Phase 5/6: Checking and upgrading tables
Processing databases
information_schema
mtr
@@ -380,7 +390,7 @@ mtr.global_suppressions OK
mtr.test_suppressions OK
performance_schema
test
-Phase 5/5: Running 'FLUSH PRIVILEGES'...
+Phase 6/6: Running 'FLUSH PRIVILEGES'
OK
#
# MDEV-4332 Increase username length from 16 characters
@@ -394,7 +404,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/5: Checking mysql database
+Phase 1/6: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats OK
@@ -425,9 +435,10 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
-Phase 2/5: Running 'mysql_fix_privilege_tables'...
-Phase 3/5: Fixing table and database names
-Phase 4/5: Checking and upgrading tables
+Phase 2/6: Fixing views
+Phase 3/6: Running 'mysql_fix_privilege_tables'
+Phase 4/6: Fixing table and database names
+Phase 5/6: Checking and upgrading tables
Processing databases
information_schema
mtr
@@ -435,7 +446,7 @@ mtr.global_suppressions OK
mtr.test_suppressions OK
performance_schema
test
-Phase 5/5: Running 'FLUSH PRIVILEGES'...
+Phase 6/6: 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 e65c6ae05f7..acbca131587 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/5: Checking mysql database
+Phase 1/6: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats OK
@@ -42,6 +42,9 @@ error : Corrupt
mysql.innodb_table_stats
Error : Unknown storage engine 'InnoDB'
error : Corrupt
-Phase 2/5: Running 'mysql_fix_privilege_tables'...
-Phase 5/5: Running 'FLUSH PRIVILEGES'...
+Phase 2/6: Fixing views... Skipped
+Phase 3/6: Running 'mysql_fix_privilege_tables'
+Phase 4/6: Fixing table and database names ... Skipped
+Phase 5/6: Checking and upgrading tables... Skipped
+Phase 6/6: Running 'FLUSH PRIVILEGES'
OK
diff --git a/mysql-test/r/mysql_upgrade_ssl.result b/mysql-test/r/mysql_upgrade_ssl.result
index 1bbee22aba2..e06d1bb1671 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/5: Checking mysql database
+Phase 1/6: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats OK
@@ -32,9 +32,10 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
-Phase 2/5: Running 'mysql_fix_privilege_tables'...
-Phase 3/5: Fixing table and database names
-Phase 4/5: Checking and upgrading tables
+Phase 2/6: Fixing views
+Phase 3/6: Running 'mysql_fix_privilege_tables'
+Phase 4/6: Fixing table and database names
+Phase 5/6: Checking and upgrading tables
Processing databases
information_schema
mtr
@@ -42,5 +43,5 @@ mtr.global_suppressions OK
mtr.test_suppressions OK
performance_schema
test
-Phase 5/5: Running 'FLUSH PRIVILEGES'...
+Phase 6/6: Running 'FLUSH PRIVILEGES'
OK
diff --git a/mysql-test/r/mysql_upgrade_view.result b/mysql-test/r/mysql_upgrade_view.result
new file mode 100644
index 00000000000..63f86af3591
--- /dev/null
+++ b/mysql-test/r/mysql_upgrade_view.result
@@ -0,0 +1,321 @@
+set sql_log_bin=0;
+drop table if exists t1,v1,v2,v3,v4,v1badcheck;
+drop view if exists t1,v1,v2,v3,v4,v1badcheck;
+create table t1(a int);
+create table kv(k varchar(30) NOT NULL PRIMARY KEY,v varchar(50));
+create view v1 as select 1;
+repair table t1 quick;
+Table Op Msg_type Msg_text
+test.t1 repair status OK
+repair table t1 extended;
+Table Op Msg_type Msg_text
+test.t1 repair status OK
+repair table t1 use_frm;
+Table Op Msg_type Msg_text
+test.t1 repair status OK
+repair table t1 from mysql;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'from mysql' at line 1
+repair view v1 quick;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'quick' at line 1
+repair view v1 extended;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'extended' at line 1
+repair view v1 use_frm;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'use_frm' at line 1
+repair view v1 from mysql;
+Table Op Msg_type Msg_text
+test.v1 repair status OK
+check view v1 quick;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'quick' at line 1
+check view v1 fast;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'fast' at line 1
+check view v1 medium;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'medium' at line 1
+check view v1 extended;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'extended' at line 1
+check view v1 changed;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'changed' at line 1
+check view v1 for upgrade;
+Table Op Msg_type Msg_text
+test.v1 check status OK
+drop view v1;
+flush tables;
+check view v1;
+Table Op Msg_type Msg_text
+test.v1 check status OK
+check view v1badcheck;
+Table Op Msg_type Msg_text
+test.v1badcheck check note View text checksum failed
+check view v2;
+Table Op Msg_type Msg_text
+test.v2 check status OK
+check view v3;
+Table Op Msg_type Msg_text
+test.v3 check status OK
+check view v1 for upgrade;
+Table Op Msg_type Msg_text
+test.v1 check error Upgrade required. Please do "REPAIR VIEW `v1`" or dump/reload to fix it!
+check view v1badcheck for upgrade;
+Table Op Msg_type Msg_text
+test.v1badcheck check note View text checksum failed
+check view v2 for upgrade;
+Table Op Msg_type Msg_text
+test.v2 check error Upgrade required. Please do "REPAIR VIEW `v2`" or dump/reload to fix it!
+check view v3 for upgrade;
+Table Op Msg_type Msg_text
+test.v3 check error Upgrade required. Please do "REPAIR VIEW `v3`" or dump/reload to fix it!
+Phase 1/6: Checking and upgrading 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/6: Fixing views
+test.v1 OK
+test.v1badcheck OK
+test.v2 OK
+test.v3 OK
+Phase 3/6: Running 'mysql_fix_privilege_tables'
+Phase 4/6: Fixing table and database names
+Phase 5/6: Checking and upgrading tables
+Processing databases
+information_schema
+mtr
+mtr.global_suppressions OK
+mtr.test_suppressions OK
+performance_schema
+test
+test.kv OK
+test.t1 OK
+Phase 6/6: Running 'FLUSH PRIVILEGES'
+OK
+show create view v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=MERGE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` utf8 utf8_general_ci
+show create view v2;
+View Create View character_set_client collation_connection
+v2 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t1`.`a` AS `a` from `t1` utf8 utf8_general_ci
+show create view v3;
+View Create View character_set_client collation_connection
+v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`a` AS `a` from `t1` utf8 utf8_general_ci
+set sql_log_bin=1;
+REPAIR VIEW v1,v2;
+Table Op Msg_type Msg_text
+test.v1 repair status OK
+test.v2 repair status OK
+REPAIR VIEW v1badcheck;
+Table Op Msg_type Msg_text
+test.v1badcheck repair status OK
+REPAIR NO_WRITE_TO_BINLOG VIEW v3;
+Table Op Msg_type Msg_text
+test.v3 repair status OK
+set sql_log_bin=0;
+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`; REPAIR VIEW v1,v2
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; REPAIR VIEW v1badcheck
+LOAD DATA INFILE 'MYSQLD_DATADIR/test/v1.frm' REPLACE INTO TABLE kv FIELDS TERMINATED BY '=';
+SELECT k,v from kv where k in ('md5','algorithm');
+k v
+algorithm 1
+md5 5e6eaf216e7b016fcedfd4e1113517af
+SELECT k from kv where k ='mariadb-version';
+k
+mariadb-version
+truncate table kv;
+LOAD DATA INFILE 'MYSQLD_DATADIR/test/v2.frm' REPLACE INTO TABLE kv FIELDS TERMINATED BY '=';
+SELECT k,v from kv where k in ('md5','algorithm');
+k v
+algorithm 2
+md5 5e6eaf216e7b016fcedfd4e1113517af
+SELECT k from kv where k ='mariadb-version';
+k
+mariadb-version
+truncate table kv;
+LOAD DATA INFILE 'MYSQLD_DATADIR/test/v3.frm' REPLACE INTO TABLE kv FIELDS TERMINATED BY '=';
+SELECT k,v from kv where k in ('md5','algorithm');
+k v
+algorithm 0
+md5 5e6eaf216e7b016fcedfd4e1113517af
+SELECT k from kv where k ='mariadb-version';
+k
+mariadb-version
+truncate table kv;
+LOAD DATA INFILE 'MYSQLD_DATADIR/test/v1badcheck.frm' REPLACE INTO TABLE kv FIELDS TERMINATED BY '=';
+SELECT k,v from kv where k in ('md5','algorithm');
+k v
+algorithm 1
+md5 5e6eaf216e7b016fcedfd4e1113517af
+SELECT k from kv where k ='mariadb-version';
+k
+mariadb-version
+truncate table kv;
+drop view if exists v1,v2,v3,v1badcheck;
+rename table mysql.event to mysql.ev_bk;
+flush tables;
+create algorithm=temptable view v4 as select a from t1;
+show create view v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=MERGE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` utf8 utf8_general_ci
+show create view v2;
+View Create View character_set_client collation_connection
+v2 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t1`.`a` AS `a` from `t1` utf8 utf8_general_ci
+show create view v3;
+View Create View character_set_client collation_connection
+v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`a` AS `a` from `t1` utf8 utf8_general_ci
+show create view v4;
+View Create View character_set_client collation_connection
+v4 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v4` AS select `t1`.`a` AS `a` from `t1` latin1 latin1_swedish_ci
+MySQL upgrade detected
+Phase 1/6: Checking and upgrading mysql database
+Processing databases
+mysql
+mysql.column_stats OK
+mysql.columns_priv OK
+mysql.db OK
+mysql.ev_bk 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/6: Fixing views from mysql
+test.v1 OK
+test.v2 OK
+test.v3 OK
+test.v4 OK
+Phase 3/6: Running 'mysql_fix_privilege_tables'
+Phase 4/6: Fixing table and database names
+Phase 5/6: Checking and upgrading tables
+Processing databases
+information_schema
+mtr
+mtr.global_suppressions OK
+mtr.test_suppressions OK
+performance_schema
+test
+test.kv OK
+test.t1 OK
+Phase 6/6: Running 'FLUSH PRIVILEGES'
+OK
+show create view v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` utf8 utf8_general_ci
+show create view v2;
+View Create View character_set_client collation_connection
+v2 CREATE ALGORITHM=MERGE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t1`.`a` AS `a` from `t1` utf8 utf8_general_ci
+show create view v3;
+View Create View character_set_client collation_connection
+v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`a` AS `a` from `t1` utf8 utf8_general_ci
+show create view v4;
+View Create View character_set_client collation_connection
+v4 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v4` AS select `t1`.`a` AS `a` from `t1` latin1 latin1_swedish_ci
+LOAD DATA INFILE 'MYSQLD_DATADIR/test/v1.frm' REPLACE INTO TABLE kv FIELDS TERMINATED BY '=';
+SELECT k,v from kv where k in ('md5','algorithm');
+k v
+algorithm 2
+md5 5e6eaf216e7b016fcedfd4e1113517af
+SELECT k from kv where k ='mariadb-version';
+k
+mariadb-version
+truncate table kv;
+drop view if exists v1,v2,v3;
+drop table mysql.event;
+rename table mysql.ev_bk to mysql.event;
+test.kv OK
+test.t1 OK
+test.v1 OK
+test.v2 OK
+test.v3 OK
+test.v4 OK
+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`; REPAIR VIEW v1,v2
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; REPAIR VIEW v1badcheck
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; REPAIR TABLE `kv` USE_FRM
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; REPAIR TABLE `t1` USE_FRM
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; REPAIR VIEW `v1` FROM MYSQL
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; REPAIR VIEW `v2` FROM MYSQL
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; REPAIR VIEW `v3` FROM MYSQL
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; REPAIR VIEW `v4` FROM MYSQL
+drop table if exists kv;
+drop view v1,v2,v3,v4;
+drop table t1;
diff --git a/mysql-test/r/mysqlcheck.result b/mysql-test/r/mysqlcheck.result
index ba9ab47ea95..b4bcdc495ae 100644
--- a/mysql-test/r/mysqlcheck.result
+++ b/mysql-test/r/mysqlcheck.result
@@ -1,6 +1,6 @@
call mtr.add_suppression("Invalid .old.. table or database name");
-DROP TABLE IF EXISTS t1, `t``1`, `t 1`;
-drop view if exists v1;
+DROP TABLE IF EXISTS t1, `t``1`, `t 1`, test.`t.1`, v1;
+drop view if exists t1, `t``1`, `t 1`, test.`t.1`, v1;
drop database if exists client_test_db;
mtr.global_suppressions OK
mtr.test_suppressions OK
@@ -340,3 +340,33 @@ CHECK TABLE bug47205 FOR UPGRADE;
Table Op Msg_type Msg_text
test.bug47205 check status OK
DROP TABLE bug47205;
+#
+#MDEV-6128:[PATCH] mysqlcheck wrongly escapes '.' in table names
+#
+CREATE TABLE test.`t.1` (id int);
+mysqlcheck test t.1
+test.t.1 OK
+drop table test.`t.1`;
+create view v1 as select 1;
+mysqlcheck --process-views test
+test.v1 OK
+mysqlcheck --process-views --extended test
+test.v1 OK
+mysqlcheck --process-views --fast test
+mysqlcheck --process-views --quick test
+test.v1 OK
+mysqlcheck --process-views --check-only-changed test
+mysqlcheck --process-views --medium-check test
+test.v1 OK
+mysqlcheck --process-views --check-upgrade test
+test.v1 OK
+drop view v1;
+create table t1(a int);
+mysqlcheck --process-views --check-upgrade --auto-repair test
+test.t1 OK
+test.v1 Needs upgrade
+
+Repairing views
+test.v1 OK
+drop view v1;
+drop table t1;
diff --git a/mysql-test/r/mysqld--help.result b/mysql-test/r/mysqld--help.result
index 360421514ac..0b8fb8e3d05 100644
--- a/mysql-test/r/mysqld--help.result
+++ b/mysql-test/r/mysqld--help.result
@@ -405,6 +405,8 @@ The following options may be given as the first argument:
Don't start more than this number of threads to handle
INSERT DELAYED statements. If set to zero INSERT DELAYED
will be not used
+ --max-digest-length=#
+ Maximum length considered for digest text.
--max-error-count=# Max number of errors/warnings to store for a statement
--max-heap-table-size=#
Don't allow creation of heap tables bigger than this
@@ -1172,6 +1174,7 @@ max-binlog-stmt-cache-size 18446744073709547520
max-connect-errors 100
max-connections 151
max-delayed-threads 20
+max-digest-length 1024
max-error-count 64
max-heap-table-size 16777216
max-join-size 18446744073709551615
diff --git a/mysql-test/r/openssl_1.result b/mysql-test/r/openssl_1.result
index 4627f03a8a3..c5dd1500110 100644
--- a/mysql-test/r/openssl_1.result
+++ b/mysql-test/r/openssl_1.result
@@ -3,8 +3,8 @@ create table t1(f1 int);
insert into t1 values (5);
grant select on test.* to ssl_user1@localhost require SSL;
grant select on test.* to ssl_user2@localhost require cipher "DHE-RSA-AES256-SHA";
-grant select on test.* to ssl_user3@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/ST=Uppsala/O=MySQL AB";
-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_user3@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB/CN=client";
+grant select on test.* to ssl_user4@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB/CN=client" ISSUER "/CN=cacert/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB";
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);
@@ -197,10 +197,6 @@ Variable_name Value
Ssl_cipher DHE-RSA-AES256-SHA
Variable_name Value
Ssl_cipher EDH-RSA-DES-CBC3-SHA
-Variable_name Value
-Ssl_cipher EDH-RSA-DES-CBC-SHA
-Variable_name Value
-Ssl_cipher RC4-SHA
select 'is still running; no cipher request crashed the server' as result from dual;
result
is still running; no cipher request crashed the server
diff --git a/mysql-test/r/partition_innodb.result b/mysql-test/r/partition_innodb.result
index 92c9c01db2d..798e3b9a6bf 100644
--- a/mysql-test/r/partition_innodb.result
+++ b/mysql-test/r/partition_innodb.result
@@ -380,33 +380,33 @@ DROP TABLE t1;
create table t1 (a int) engine=innodb partition by hash(a) ;
show table status like 't1';
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 InnoDB 10 Compact 2 8192 16384 0 0 # NULL NULL NULL NULL latin1_swedish_ci NULL partitioned
+t1 InnoDB 10 Compact 2 8192 16384 0 0 # NULL # NULL NULL latin1_swedish_ci NULL partitioned
drop table t1;
create table t1 (a int)
engine = innodb
partition by key (a);
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 InnoDB 10 Compact 2 8192 16384 0 0 # NULL NULL NULL NULL latin1_swedish_ci NULL partitioned
+t1 InnoDB 10 Compact 2 8192 16384 0 0 # NULL # NULL NULL latin1_swedish_ci NULL partitioned
insert into t1 values (0), (1), (2), (3);
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 InnoDB 10 Compact 4 4096 16384 0 0 # NULL NULL NULL NULL latin1_swedish_ci NULL partitioned
+t1 InnoDB 10 Compact 4 4096 16384 0 0 # NULL # NULL NULL latin1_swedish_ci NULL partitioned
drop table t1;
create table t1 (a int auto_increment primary key)
engine = innodb
partition by key (a);
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 InnoDB 10 Compact 2 8192 16384 0 0 # 1 NULL NULL NULL latin1_swedish_ci NULL partitioned
+t1 InnoDB 10 Compact 2 8192 16384 0 0 # 1 # NULL NULL latin1_swedish_ci NULL partitioned
insert into t1 values (NULL), (NULL), (NULL), (NULL);
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 InnoDB 10 Compact 4 4096 16384 0 0 # 5 NULL NULL NULL latin1_swedish_ci NULL partitioned
+t1 InnoDB 10 Compact 4 4096 16384 0 0 # 5 # NULL NULL latin1_swedish_ci NULL partitioned
insert into t1 values (NULL), (NULL), (NULL), (NULL);
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 InnoDB 10 Compact 8 2048 16384 0 0 # 9 NULL NULL NULL latin1_swedish_ci NULL partitioned
+t1 InnoDB 10 Compact 8 2048 16384 0 0 # 9 # NULL NULL latin1_swedish_ci NULL partitioned
drop table t1;
create table t1 (a int)
partition by key (a)
@@ -588,6 +588,17 @@ a b
0 1
DROP TABLE t1;
#
+# Bug #17299181 CREATE_TIME AND UPDATE_TIME ARE
+# WRONG FOR PARTITIONED TABLES
+#
+CREATE TABLE t1 (a int, PRIMARY KEY (a)) ENGINE=InnoDB
+PARTITION BY HASH (a) PARTITIONS 2;
+SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE
+CREATE_TIME IS NOT NULL AND TABLE_NAME='t1';
+COUNT(*)
+1
+DROP TABLE t1;
+#
# BUG#12912171 - ASSERTION FAILED: QUICK->HEAD->READ_SET ==
# SAVE_READ_SET
#
diff --git a/mysql-test/r/partition_innodb_plugin.result b/mysql-test/r/partition_innodb_plugin.result
index 7a84745e611..7057bb0a55b 100644
--- a/mysql-test/r/partition_innodb_plugin.result
+++ b/mysql-test/r/partition_innodb_plugin.result
@@ -141,12 +141,12 @@ ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
# First table reported in 'SHOW ENGINE InnoDB STATUS'
SHOW ENGINE InnoDB STATUS;
Type Name Status
-InnoDB index `PRIMARY` of table `test`.`t``\""e` /* Partition `p0``\""e`, Subpartition `sp0``\""e` */
+InnoDB index `PRIMARY` of table `test`.`t``\""e` /* Partition `p0``\""e`, Subpartition `sp0``\""e` */
set @old_sql_mode = @@sql_mode;
set sql_mode = 'ANSI_QUOTES';
SHOW ENGINE InnoDB STATUS;
Type Name Status
-InnoDB index `PRIMARY` of table `test`.`t``\""e` /* Partition `p0``\""e`, Subpartition `sp0``\""e` */
+InnoDB index `PRIMARY` of table `test`.`t``\""e` /* Partition `p0``\""e`, Subpartition `sp0``\""e` */
set @@sql_mode = @old_sql_mode;
# con1
ROLLBACK;
diff --git a/mysql-test/r/partition_myisam.result b/mysql-test/r/partition_myisam.result
index 80b3a9511ea..bb1a7b19a9d 100644
--- a/mysql-test/r/partition_myisam.result
+++ b/mysql-test/r/partition_myisam.result
@@ -90,7 +90,7 @@ ERROR HY000: Failed to read from the .par file
# Note that it is currently impossible to drop a partitioned table
# without the .par file
DROP TABLE t1;
-ERROR 42S02: Unknown table 'test.t1'
+ERROR HY000: Got error 1 "Operation not permitted" from storage engine partition
#
# Bug#50392: insert_id is not reset for partitioned tables
# auto_increment on duplicate entry
diff --git a/mysql-test/r/partition_not_blackhole.result b/mysql-test/r/partition_not_blackhole.result
index 923d70c0ad6..7759f947c32 100644
--- a/mysql-test/r/partition_not_blackhole.result
+++ b/mysql-test/r/partition_not_blackhole.result
@@ -11,6 +11,6 @@ t1
SHOW CREATE TABLE t1;
ERROR HY000: Incorrect information in file: './test/t1.frm'
DROP TABLE t1;
-ERROR 42S02: Unknown table 'test.t1'
+ERROR HY000: Got error 1 "Operation not permitted" from storage engine partition
t1.frm
t1.par
diff --git a/mysql-test/r/plugin.result b/mysql-test/r/plugin.result
index 630f0141d18..510c812a30f 100644
--- a/mysql-test/r/plugin.result
+++ b/mysql-test/r/plugin.result
@@ -321,3 +321,16 @@ UNUSABLE
uninstall soname 'ha_example';
select plugin_name from information_schema.plugins where plugin_library like 'ha_example%';
plugin_name
+#
+# MDEV-5309 - RENAME TABLE does not check for existence of the table's
+# engine
+#
+INSTALL PLUGIN example SONAME 'ha_example';
+CREATE TABLE t1(a INT) ENGINE=EXAMPLE;
+SELECT * FROM t1;
+a
+FLUSH TABLES;
+UNINSTALL PLUGIN example;
+RENAME TABLE t1 TO t2;
+ERROR 42S02: Table 'test.t1' doesn't exist
+DROP TABLE t1;
diff --git a/mysql-test/r/range_innodb.result b/mysql-test/r/range_innodb.result
new file mode 100644
index 00000000000..794e6c7b3cc
--- /dev/null
+++ b/mysql-test/r/range_innodb.result
@@ -0,0 +1,39 @@
+#
+# Range optimizer (and related) tests that need InnoDB.
+#
+drop table if exists t0, t1, t2;
+#
+# MDEV-6735: Range checked for each record used with key
+#
+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 + D.a * 1000
+from t0 A, t0 B, t0 C, t0 D;
+create table t2 (
+a int,
+b int,
+filler1 char(100),
+filler2 char(100),
+filler3 char(100),
+filler4 char(100),
+key(a),
+key(b)
+) engine=innodb;
+insert into t2
+select
+a,a,
+repeat('0123456789', 10),
+repeat('0123456789', 10),
+repeat('0123456789', 10),
+repeat('0123456789', 10)
+from t1;
+analyze table t2;
+Table Op Msg_type Msg_text
+test.t2 analyze status OK
+# The following must not use "Range checked for each record":
+explain select * from t0 left join t2 on t2.a <t0.a and t2.b between 50 and 250;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 ALL NULL NULL NULL NULL 10
+1 SIMPLE t2 range a,b b 5 NULL 201 Using where; Using join buffer (flat, BNL join)
+drop table t0,t1,t2;
diff --git a/mysql-test/r/repair.result b/mysql-test/r/repair.result
index c5faa27085e..79bc6d55c55 100644
--- a/mysql-test/r/repair.result
+++ b/mysql-test/r/repair.result
@@ -207,3 +207,10 @@ check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
+create table t1 (a blob);
+create view v1 as select * from t1;
+repair view v1;
+Table Op Msg_type Msg_text
+test.v1 repair status OK
+drop view v1;
+drop table t1;
diff --git a/mysql-test/r/select_jcl6.result b/mysql-test/r/select_jcl6.result
index 3b51efa26b0..3c62d0676ae 100644
--- a/mysql-test/r/select_jcl6.result
+++ b/mysql-test/r/select_jcl6.result
@@ -4423,7 +4423,7 @@ INSERT INTO t1 VALUES
EXPLAIN SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
-1 SIMPLE t2 hash_ALL a #hash#$hj 14 test.t1.a 2 Using where; Using join buffer (flat, BNLH join)
+1 SIMPLE t2 hash_ALL a #hash#$hj 6 test.t1.a 2 Using where; Using join buffer (flat, BNLH join)
SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2;
1
1
@@ -4433,7 +4433,7 @@ SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2;
EXPLAIN SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2 FORCE INDEX(a);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
-1 SIMPLE t2 hash_ALL a #hash#$hj 14 test.t1.a 2 Using where; Using join buffer (flat, BNLH join)
+1 SIMPLE t2 hash_ALL a #hash#$hj 6 test.t1.a 2 Using where; Using join buffer (flat, BNLH join)
SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2 FORCE INDEX(a);
1
1
diff --git a/mysql-test/r/selectivity.result b/mysql-test/r/selectivity.result
index 3f2343fa365..620bdc6bd50 100644
--- a/mysql-test/r/selectivity.result
+++ b/mysql-test/r/selectivity.result
@@ -1409,4 +1409,40 @@ Note 1003 select `test`.`a`.`a` AS `a`,`test`.`a`.`b` AS `b`,`test`.`b`.`a` AS `
set histogram_size=@save_histogram_size;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
drop table t0,t1,t2;
+#
+# Bug mdev-7316: a conjunct in WHERE with selectivity == 0
+#
+CREATE TABLE t1 (a varchar(16), b int, PRIMARY KEY(a), KEY(b)) ENGINE=INNODB;
+Warnings:
+Warning 1286 Unknown storage engine 'INNODB'
+Warning 1266 Using storage engine MyISAM for table 't1'
+INSERT INTO t1 VALUES
+('USAChinese',10), ('USAEnglish',20), ('USAFrench',30);
+CREATE TABLE t2 (i int) ENGINE=INNODB;
+Warnings:
+Warning 1286 Unknown storage engine 'INNODB'
+Warning 1266 Using storage engine MyISAM for table 't2'
+INSERT INTO t2 VALUES
+(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(1),(2),(3),(4);
+ANALYZE TABLE t1, t2;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
+test.t2 analyze status OK
+set use_stat_tables='preferably';
+set optimizer_use_condition_selectivity=3;
+EXPLAIN EXTENDED
+SELECT * FROM t1, t2
+WHERE a <> 'USARussian' AND b IS NULL;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ref PRIMARY,b b 5 const 1 100.00 Using index condition; Using where
+1 SIMPLE t2 ALL NULL NULL NULL NULL 14 100.00 Using join buffer (flat, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`i` AS `i` from `test`.`t1` join `test`.`t2` where ((`test`.`t1`.`a` <> 'USARussian') and isnull(`test`.`t1`.`b`))
+SELECT * FROM t1, t2
+WHERE a <> 'USARussian' AND b IS NULL;
+a b i
+set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
+DROP TABLE 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 0b7f1c950e5..0acbb465ba8 100644
--- a/mysql-test/r/selectivity_innodb.result
+++ b/mysql-test/r/selectivity_innodb.result
@@ -1419,6 +1419,36 @@ Note 1003 select `test`.`a`.`a` AS `a`,`test`.`a`.`b` AS `b`,`test`.`b`.`a` AS `
set histogram_size=@save_histogram_size;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
drop table t0,t1,t2;
+#
+# Bug mdev-7316: a conjunct in WHERE with selectivity == 0
+#
+CREATE TABLE t1 (a varchar(16), b int, PRIMARY KEY(a), KEY(b)) ENGINE=INNODB;
+INSERT INTO t1 VALUES
+('USAChinese',10), ('USAEnglish',20), ('USAFrench',30);
+CREATE TABLE t2 (i int) ENGINE=INNODB;
+INSERT INTO t2 VALUES
+(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(1),(2),(3),(4);
+ANALYZE TABLE t1, t2;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
+test.t2 analyze status OK
+set use_stat_tables='preferably';
+set optimizer_use_condition_selectivity=3;
+EXPLAIN EXTENDED
+SELECT * FROM t1, t2
+WHERE a <> 'USARussian' AND b IS NULL;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ref PRIMARY,b b 5 const 2 66.67 Using where; Using index
+1 SIMPLE t2 ALL NULL NULL NULL NULL 14 100.00 Using join buffer (flat, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`i` AS `i` from `test`.`t1` join `test`.`t2` where ((`test`.`t1`.`a` <> 'USARussian') and isnull(`test`.`t1`.`b`))
+SELECT * FROM t1, t2
+WHERE a <> 'USARussian' AND b IS NULL;
+a b i
+set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
+DROP TABLE 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;
@@ -1482,6 +1512,30 @@ select * from t1 where col2 != true;
col1 col2
drop table t1;
#
+# MDEV-7413: optimizer_use_condition_selectivity > 2 crashes 10.0.15+maria-1~wheezy
+#
+CREATE TABLE t1 (
+parent_id int,
+child_group_id int,
+child_user_id int,
+KEY (parent_id,child_group_id,child_user_id)
+) ENGINE=InnoDB;
+CREATE TABLE t2 (
+id int,
+lower_group_name varchar(255),
+directory_id int(20),
+UNIQUE KEY (directory_id)
+) ENGINE=InnoDB;
+CREATE TABLE t3 (id int) ENGINE=InnoDB;
+insert into t1 values (1,1,1),(2,2,2);
+insert into t2 values (10,'foo',10),(20,'bar',20);
+insert into t3 values (101),(102);
+set use_stat_tables = PREFERABLY, optimizer_use_condition_selectivity = 3;
+select * from t1, t2, t3
+where t1.child_user_id=t3.id and t1.child_group_id is null and t2.lower_group_name='foo' and t1.parent_id=t2.id and t2.directory_id=10;
+parent_id child_group_id child_user_id id lower_group_name directory_id id
+drop table t1,t2,t3;
+#
# End of 10.0 tests
#
set use_stat_tables= @tmp_ust;
diff --git a/mysql-test/r/show_grants_with_plugin-7985.result b/mysql-test/r/show_grants_with_plugin-7985.result
new file mode 100644
index 00000000000..5accda75383
--- /dev/null
+++ b/mysql-test/r/show_grants_with_plugin-7985.result
@@ -0,0 +1,197 @@
+call mtr.add_suppression("password and an authentication plugin");
+#
+# Create a user with mysql_native_password plugin.
+# The user has no password or auth_string set.
+#
+create user u1;
+GRANT SELECT ON mysql.* to u1 IDENTIFIED VIA mysql_native_password;
+select user, host, password, plugin, authentication_string from mysql.user where user = 'u1';
+user host password plugin authentication_string
+u1 % mysql_native_password
+#
+# The user's grants should show no password at all.
+#
+show grants for u1;
+Grants for u1@%
+GRANT USAGE ON *.* TO 'u1'@'%'
+GRANT SELECT ON `mysql`.* TO 'u1'@'%'
+#
+# Test to see if connecting with no password is succesful.
+#
+connect con1, localhost, u1,,;
+show grants;
+Grants for u1@%
+GRANT USAGE ON *.* TO 'u1'@'%'
+GRANT SELECT ON `mysql`.* TO 'u1'@'%'
+disconnect con1;
+connection default;
+#
+# Test after flushing privileges.
+#
+flush privileges;
+connect con1, localhost, u1,,;
+show grants;
+Grants for u1@%
+GRANT USAGE ON *.* TO 'u1'@'%'
+GRANT SELECT ON `mysql`.* TO 'u1'@'%'
+disconnect con1;
+connection default;
+#
+# Now add a mysql_native password string in authentication_string.
+#
+GRANT SELECT ON mysql.* to u1 IDENTIFIED VIA mysql_native_password
+USING '*7AFEFD08B6B720E781FB000CAA418F54FA662626';
+select user, host, password, plugin, authentication_string from mysql.user where user = 'u1';
+user host password plugin authentication_string
+u1 % mysql_native_password *7AFEFD08B6B720E781FB000CAA418F54FA662626
+#
+# Test to see if connecting with password is succesful.
+#
+connect con1, localhost, u1,'SOMETHING',;
+show grants;
+Grants for u1@%
+GRANT USAGE ON *.* TO 'u1'@'%' IDENTIFIED BY PASSWORD '*7AFEFD08B6B720E781FB000CAA418F54FA662626'
+GRANT SELECT ON `mysql`.* TO 'u1'@'%'
+disconnect con1;
+connection default;
+#
+# Test after flushing privileges.
+#
+flush privileges;
+connect con1, localhost, u1,'SOMETHING',;
+show grants;
+Grants for u1@%
+GRANT USAGE ON *.* TO 'u1'@'%' IDENTIFIED BY PASSWORD '*7AFEFD08B6B720E781FB000CAA418F54FA662626'
+GRANT SELECT ON `mysql`.* TO 'u1'@'%'
+disconnect con1;
+connection default;
+#
+# Now we also set a password for the user.
+#
+set password for u1 = PASSWORD('SOMETHINGELSE');
+select user, host, password, plugin, authentication_string from mysql.user where user = 'u1';
+user host password plugin authentication_string
+u1 % *054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6 mysql_native_password *7AFEFD08B6B720E781FB000CAA418F54FA662626
+#
+# Here we should use the password field, as that primes over
+# the authentication_string field.
+#
+show grants for u1;
+Grants for u1@%
+GRANT USAGE ON *.* TO 'u1'@'%' IDENTIFIED BY PASSWORD '*054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6'
+GRANT SELECT ON `mysql`.* TO 'u1'@'%'
+#
+# Logging in with the user's password should work.
+#
+connect con1, localhost, u1,'SOMETHINGELSE',;
+show grants;
+Grants for u1@%
+GRANT USAGE ON *.* TO 'u1'@'%' IDENTIFIED BY PASSWORD '*054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6'
+GRANT SELECT ON `mysql`.* TO 'u1'@'%'
+disconnect con1;
+connection default;
+#
+# Reload privileges and test logging in again.
+#
+flush privileges;
+show grants for u1;
+Grants for u1@%
+GRANT USAGE ON *.* TO 'u1'@'%' IDENTIFIED BY PASSWORD '*054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6'
+GRANT SELECT ON `mysql`.* TO 'u1'@'%'
+#
+# Here we connect via the user's password again.
+#
+connect con1, localhost, u1,'SOMETHINGELSE',;
+show grants;
+Grants for u1@%
+GRANT USAGE ON *.* TO 'u1'@'%' IDENTIFIED BY PASSWORD '*054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6'
+GRANT SELECT ON `mysql`.* TO 'u1'@'%'
+disconnect con1;
+connection default;
+#
+# Now we remove the authentication plugin password, flush privileges and
+# try again.
+#
+update mysql.user set authentication_string = '' where user='u1';
+select user, host, password, plugin, authentication_string from mysql.user where user = 'u1';
+user host password plugin authentication_string
+u1 % *054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6 mysql_native_password
+flush privileges;
+show grants for u1;
+Grants for u1@%
+GRANT USAGE ON *.* TO 'u1'@'%' IDENTIFIED BY PASSWORD '*054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6'
+GRANT SELECT ON `mysql`.* TO 'u1'@'%'
+#
+# Here we connect via the user's password.
+#
+connect con1, localhost, u1,'SOMETHINGELSE',;
+select user, host, password, plugin, authentication_string from mysql.user where user = 'u1';
+user host password plugin authentication_string
+u1 % *054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6 mysql_native_password
+disconnect con1;
+connection default;
+#
+# Try and set a wrong auth_string password, with mysql_native_password.
+# Make sure it fails.
+#
+GRANT USAGE ON *.* TO u1 IDENTIFIED VIA mysql_native_password USING 'asd';
+ERROR HY000: Password hash should be a 41-digit hexadecimal number
+#
+# Now set a correct password.
+#
+GRANT SELECT ON mysql.* to u1 IDENTIFIED VIA mysql_native_password
+USING '*7AFEFD08B6B720E781FB000CAA418F54FA662626';
+show grants for u1;
+Grants for u1@%
+GRANT USAGE ON *.* TO 'u1'@'%' IDENTIFIED BY PASSWORD '*7AFEFD08B6B720E781FB000CAA418F54FA662626'
+GRANT SELECT ON `mysql`.* TO 'u1'@'%'
+#
+# Test if the user can now use that password instead.
+#
+connect con1, localhost, u1,'SOMETHING',;
+show grants;
+Grants for u1@%
+GRANT USAGE ON *.* TO 'u1'@'%' IDENTIFIED BY PASSWORD '*7AFEFD08B6B720E781FB000CAA418F54FA662626'
+GRANT SELECT ON `mysql`.* TO 'u1'@'%'
+disconnect con1;
+#
+# Test if the user can now use that password instead, after flushing privileges;
+#
+connection default;
+flush privileges;
+connect con1, localhost, u1,'SOMETHING',;
+show grants;
+Grants for u1@%
+GRANT USAGE ON *.* TO 'u1'@'%' IDENTIFIED BY PASSWORD '*7AFEFD08B6B720E781FB000CAA418F54FA662626'
+GRANT SELECT ON `mysql`.* TO 'u1'@'%'
+disconnect con1;
+connection default;
+#
+# Clear all passwords from the user.
+#
+GRANT SELECT ON mysql.* to u1 IDENTIFIED VIA mysql_native_password;
+select user, host, password, plugin, authentication_string from mysql.user where user = 'u1';
+user host password plugin authentication_string
+u1 % mysql_native_password
+#
+# Test no password connect.
+#
+connect con1, localhost, u1,,;
+show grants;
+Grants for u1@%
+GRANT USAGE ON *.* TO 'u1'@'%'
+GRANT SELECT ON `mysql`.* TO 'u1'@'%'
+disconnect con1;
+connection default;
+#
+# Test no password connect, after flushing privileges.
+#
+flush privileges;
+connect con1, localhost, u1,,;
+show grants;
+Grants for u1@%
+GRANT USAGE ON *.* TO 'u1'@'%'
+GRANT SELECT ON `mysql`.* TO 'u1'@'%'
+disconnect con1;
+connection default;
+drop user u1;
diff --git a/mysql-test/r/sp-destruct.result b/mysql-test/r/sp-destruct.result
index 172e40cb40c..81c0adb36cc 100644
--- a/mysql-test/r/sp-destruct.result
+++ b/mysql-test/r/sp-destruct.result
@@ -170,3 +170,7 @@ Error 1728 Cannot load from mysql.proc. The table is probably corrupted
# Restore mysql.proc
DROP TABLE mysql.proc;
RENAME TABLE proc_backup TO mysql.proc;
+create database mysqltest1;
+create procedure mysqltest1.foo() select "foo";
+update mysql.proc set name='' where db='mysqltest1';
+drop database mysqltest1;
diff --git a/mysql-test/r/sp-innodb.result b/mysql-test/r/sp-innodb.result
index da02957d3c9..b3405705698 100644
--- a/mysql-test/r/sp-innodb.result
+++ b/mysql-test/r/sp-innodb.result
@@ -30,3 +30,103 @@ CALL p1();
CALL p1();
drop procedure p1;
drop table t1,t2;
+
+#
+# BUG 16041903: CONTINUE HANDLER NOT INVOKED
+# IN A STORED FUNCTION AFTER A LOCK WAIT TIMEOUT
+#
+
+# Save and set lock wait timeout
+SET @lock_wait_timeout_saved= @@lock_wait_timeout;
+SET @innodb_lock_wait_timeout_saved= @@innodb_lock_wait_timeout;
+SET @@lock_wait_timeout= 1;
+SET @@innodb_lock_wait_timeout= 1;
+
+# Create a function with exit handler:
+CREATE FUNCTION f1() RETURNS VARCHAR(20)
+BEGIN
+DECLARE EXIT HANDLER FOR SQLSTATE '42S02' RETURN 'No such table';
+INSERT INTO no_such_table VALUES (1);
+END//
+
+# Create a function calling f1():
+CREATE FUNCTION f2() RETURNS VARCHAR(20)
+BEGIN
+RETURN f1();
+END//
+
+# Create a function provoking deadlock:
+CREATE FUNCTION f3() RETURNS VARCHAR(20)
+BEGIN
+UPDATE t1 SET i= 1 WHERE i= 1;
+RETURN 'Will never get here';
+END//
+
+# Create a function calling f3, to create
+# a deadlock indirectly:
+CREATE FUNCTION f4() RETURNS VARCHAR(20)
+BEGIN
+RETURN f3();
+END//
+
+# Open another connection, create and initialize a table
+# to be used for provoking deadlock, put a lock on the table:
+CREATE TABLE t1 (i INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+SET AUTOCOMMIT= 0;
+UPDATE t1 SET i=1 WHERE i=1;
+
+# On the default connection, do an update to provoke a
+# deadlock, then call the function with handler. This case
+# fails without the patch (with error ER_NO_SUCH_TABLE):
+SET AUTOCOMMIT= 0;
+UPDATE t1 SET i=1 WHERE i=1;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+SELECT f1() AS 'f1():';
+f1():
+No such table
+
+# Provoke another deadlock, then call the function with
+# handler indirectly. This case fails without the patch
+# (with error ER_NO_SUCH_TABLE):
+UPDATE t1 SET i= 1 WHERE i= 1;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+SELECT f2() AS 'f2():';
+f2():
+No such table
+
+# Provoke yet another deadlock, but now from within a function,
+# then call the function with handler. This succeeds even
+# without the patch because is_fatal_sub_stmt_error is reset
+# in restore_sub_stmt after the failing function has been
+# executed. The test case is included anyway for better coverage:
+SELECT f3() AS 'f3():';
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+SELECT f1() AS 'f1():';
+f1():
+No such table
+# Provoke yet another deadlock, but now from within a function,
+# calling another function, then call the function with handler.
+# This succeeds even without the patch because
+# is_fatal_sub_stmt_error is reset in restore_sub_stmt after
+# the failing function has been executed. The test case is
+# included anyway for better coverage:
+SELECT f4() AS 'f4():';
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+SELECT f1() AS 'f1():';
+f1():
+No such table
+
+# Disconnect, drop functions and table:
+DROP FUNCTION f4;
+DROP FUNCTION f3;
+DROP FUNCTION f2;
+DROP FUNCTION f1;
+DROP TABLE t1;
+
+# Reset lock wait timeouts
+SET @@lock_wait_timeout= @lock_wait_timeout_saved;
+SET @@innodb_lock_wait_timeout= @innodb_lock_wait_timeout_saved;
+#
+# BUG 16041903: End of test case
+#
diff --git a/mysql-test/r/sp_notembedded.result b/mysql-test/r/sp_notembedded.result
index 410441b63e3..3cc4ff4238b 100644
--- a/mysql-test/r/sp_notembedded.result
+++ b/mysql-test/r/sp_notembedded.result
@@ -284,4 +284,23 @@ DROP EVENT teste_bug11763507;
# ------------------------------------------------------------------
# -- End of 5.1 tests
# ------------------------------------------------------------------
+grant create routine on test.* to foo1@localhost identified by 'foo';
+update mysql.user set password = replace(password, '*', '-') where user='foo1';
+show grants;
+Grants for foo1@localhost
+GRANT USAGE ON *.* TO 'foo1'@'localhost' IDENTIFIED BY PASSWORD '*F3A2A51A9B0F2BE2468926B4132313728C250DBF'
+GRANT CREATE ROUTINE ON `test`.* TO 'foo1'@'localhost'
+flush privileges;
+show grants;
+Grants for foo1@localhost
+GRANT USAGE ON *.* TO 'foo1'@'localhost' IDENTIFIED BY PASSWORD '-F3A2A51A9B0F2BE2468926B4132313728C250DBF'
+GRANT CREATE ROUTINE ON `test`.* TO 'foo1'@'localhost'
+create procedure spfoo() select 1;
+show grants;
+Grants for foo1@localhost
+GRANT USAGE ON *.* TO 'foo1'@'localhost' IDENTIFIED BY PASSWORD '-F3A2A51A9B0F2BE2468926B4132313728C250DBF'
+GRANT CREATE ROUTINE ON `test`.* TO 'foo1'@'localhost'
+GRANT EXECUTE, ALTER ROUTINE ON PROCEDURE `test`.`spfoo` TO 'foo1'@'localhost'
+drop procedure spfoo;
+drop user foo1@localhost;
set @@global.concurrent_insert= @old_concurrent_insert;
diff --git a/mysql-test/r/ssl.result b/mysql-test/r/ssl.result
index 868efcbdf31..57427a228eb 100644
--- a/mysql-test/r/ssl.result
+++ b/mysql-test/r/ssl.result
@@ -3,10 +3,10 @@ Variable_name Value
Ssl_cipher DHE-RSA-AES256-SHA
SHOW STATUS LIKE 'Ssl_server_not_before';
Variable_name Value
-Ssl_server_not_before Feb 20 02:55:06 2010 GMT
+Ssl_server_not_before Apr 25 14:55:05 2015 GMT
SHOW STATUS LIKE 'Ssl_server_not_after';
Variable_name Value
-Ssl_server_not_after Sep 3 02:55:06 2030 GMT
+Ssl_server_not_after Apr 20 14:55:05 2035 GMT
drop table if exists t1,t2,t3,t4;
CREATE TABLE t1 (
Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,
@@ -2166,3 +2166,9 @@ drop table t1;
SHOW STATUS LIKE 'Ssl_cipher';
Variable_name Value
Ssl_cipher DHE-RSA-AES256-SHA
+select aes_decrypt('MySQL','adf');
+aes_decrypt('MySQL','adf')
+NULL
+select 'still connected?';
+still connected?
+still connected?
diff --git a/mysql-test/r/ssl_7937,nossl.result b/mysql-test/r/ssl_7937,nossl.result
new file mode 100644
index 00000000000..72693233bc8
--- /dev/null
+++ b/mysql-test/r/ssl_7937,nossl.result
@@ -0,0 +1,15 @@
+create procedure have_ssl()
+select if(variable_value > '','yes','no') as 'have_ssl'
+ from information_schema.session_status
+where variable_name='ssl_cipher';
+mysql --ssl-ca=cacert.pem -e "call test.have_ssl()"
+have_ssl
+no
+mysql --ssl -e "call test.have_ssl()"
+have_ssl
+no
+mysql --ssl-ca=cacert.pem --ssl-verify-server-cert -e "call test.have_ssl()"
+ERROR 2026 (HY000): SSL connection error: SSL is required, but the server does not support it
+mysql --ssl --ssl-verify-server-cert -e "call test.have_ssl()"
+ERROR 2026 (HY000): SSL connection error: SSL is required, but the server does not support it
+drop procedure have_ssl;
diff --git a/mysql-test/r/ssl_7937.result b/mysql-test/r/ssl_7937.result
new file mode 100644
index 00000000000..a94ca3b3529
--- /dev/null
+++ b/mysql-test/r/ssl_7937.result
@@ -0,0 +1,16 @@
+create procedure have_ssl()
+select if(variable_value > '','yes','no') as 'have_ssl'
+ from information_schema.session_status
+where variable_name='ssl_cipher';
+mysql --ssl-ca=cacert.pem -e "call test.have_ssl()"
+have_ssl
+yes
+mysql --ssl -e "call test.have_ssl()"
+have_ssl
+yes
+mysql --ssl-ca=cacert.pem --ssl-verify-server-cert -e "call test.have_ssl()"
+have_ssl
+yes
+mysql --ssl --ssl-verify-server-cert -e "call test.have_ssl()"
+ERROR 2026 (HY000): SSL connection error: Failed to verify the server certificate
+drop procedure have_ssl;
diff --git a/mysql-test/r/ssl_timeout.result b/mysql-test/r/ssl_timeout.result
new file mode 100644
index 00000000000..356e931ba4d
--- /dev/null
+++ b/mysql-test/r/ssl_timeout.result
@@ -0,0 +1,7 @@
+# connect with read timeout so SLEEP() should timeout
+# Check ssl turned on
+SHOW STATUS LIKE 'Ssl_cipher';
+Variable_name Value
+Ssl_cipher DHE-RSA-AES256-SHA
+SELECT SLEEP(600);
+ERROR HY000: Lost connection to MySQL server during query
diff --git a/mysql-test/r/subselect_extra.result b/mysql-test/r/subselect_extra.result
index 7616dd429b7..48b80e02e1a 100644
--- a/mysql-test/r/subselect_extra.result
+++ b/mysql-test/r/subselect_extra.result
@@ -447,7 +447,7 @@ WHERE t3.b IN (SELECT v1.b FROM v1, t2
WHERE t2.c = v1.c AND t2.c = v1.b AND v1.b = t3.c);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 system NULL NULL NULL NULL 1
-1 PRIMARY <derived3> ref key1 key1 10 const,const 0 Start temporary
+1 PRIMARY <derived3> ref key1 key1 8 const,const 0 Start temporary
1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using where; End temporary; Using join buffer (flat, BNL join)
3 DERIVED t1 ALL NULL NULL NULL NULL 3
SELECT * FROM t3
diff --git a/mysql-test/r/subselect_extra_no_semijoin.result b/mysql-test/r/subselect_extra_no_semijoin.result
index d178e45d07e..e5b36055c91 100644
--- a/mysql-test/r/subselect_extra_no_semijoin.result
+++ b/mysql-test/r/subselect_extra_no_semijoin.result
@@ -450,7 +450,7 @@ WHERE t2.c = v1.c AND t2.c = v1.b AND v1.b = t3.c);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 1
-2 DEPENDENT SUBQUERY <derived3> ref key1 key1 10 const,const 0 Using where
+2 DEPENDENT SUBQUERY <derived3> ref key1 key1 8 const,const 0 Using where
3 DERIVED t1 ALL NULL NULL NULL NULL 3
SELECT * FROM t3
WHERE t3.b IN (SELECT v1.b FROM v1, t2
diff --git a/mysql-test/r/subselect_mat.result b/mysql-test/r/subselect_mat.result
index 4103a3424e9..7b421c624bf 100644
--- a/mysql-test/r/subselect_mat.result
+++ b/mysql-test/r/subselect_mat.result
@@ -2146,6 +2146,57 @@ drop database mysqltest2;
drop database mysqltest3;
drop database mysqltest4;
# End of 5.5 tests
+#
+# MDEV-7220: Materialization strategy is not used for REPLACE ... SELECT
+#
+create table t0(a int);
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t1 (a int, b int, c int);
+insert into t1
+select A.a+B.a*10+C.a*100, A.a+B.a*10+C.a*100, A.a+B.a*10+C.a*100
+from t0 A, t0 B, t0 C;
+create table t2 (a int, b int, c int);
+insert into t2 select A.a, A.a, A.a from t1 A;
+insert into t2 select * from t2;
+insert into t2 select * from t2;
+create table t3 as select * from t2 limit 1;
+# The testcase only makes sense if the following uses Materialization:
+explain
+select * from t1 where (a,b) in (select max(a),b from t2 group by b);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 1000 Using where
+1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.b 1
+2 MATERIALIZED t2 ALL NULL NULL NULL NULL 4000 Using temporary
+flush status;
+replace into t3
+select * from t1 where (a,b) in (select max(a),b from t2 group by b);
+# Sequential reads:
+# 1K is read from t1
+# 4K is read from t2
+# 1K groups is read from the tmp. table
+#
+# Lookups:
+# 4K lookups in group by table
+# 1K lookups in temp.table
+#
+# Writes:
+# 2x 1K writes to temporary tables (grouping table and subquery materialization table
+#
+# The point is that neither counter should be in the millions (this
+# will happen if Materialization is not used
+show status where Variable_name like 'Handler_read%' or Variable_name like 'Handler_%write%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 5000
+Handler_read_last 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_rnd 0
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 6003
+Handler_tmp_write 2000
+Handler_write 1000
+drop table t0,t1,t2,t3;
set @subselect_mat_test_optimizer_switch_value=null;
set @@optimizer_switch='materialization=on,in_to_exists=off,semijoin=off';
set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
diff --git a/mysql-test/r/subselect_sj.result b/mysql-test/r/subselect_sj.result
index 2bb00835a75..46c799c4f6e 100644
--- a/mysql-test/r/subselect_sj.result
+++ b/mysql-test/r/subselect_sj.result
@@ -2988,4 +2988,13 @@ pk1 i1 i2 c2 pk3 i3 c3
SET join_cache_level=@tmp_mdev5059;
set optimizer_switch=@tmp_os_mdev5059;
DROP TABLE t1,t2,t3,t4;
+#
+# MDEV-7911: crash in Item_cond::eval_not_null_tables
+#
+create table t1(a int);
+insert into t1 values(1),(2),(3),(null);
+explain
+select 1 from t1 where _cp932 "1" in (select '1' from t1);
+ERROR HY000: Illegal mix of collations (cp932_japanese_ci,COERCIBLE) and (latin1_swedish_ci,COERCIBLE) for operation '='
+drop table t1;
set optimizer_switch=@subselect_sj_tmp;
diff --git a/mysql-test/r/subselect_sj2.result b/mysql-test/r/subselect_sj2.result
index 43ba6ead575..9a5da710a4c 100644
--- a/mysql-test/r/subselect_sj2.result
+++ b/mysql-test/r/subselect_sj2.result
@@ -1178,5 +1178,89 @@ id nombre
2 row 2
3 row 3
DROP TABLE t1, t2;
+#
+# MDEV-7474: Semi-Join's DuplicateWeedout strategy skipped for some values of optimizer_search_depth
+#
+CREATE TABLE t1 (
+t1id BIGINT(20) NOT NULL,
+code VARCHAR(20),
+PRIMARY KEY (t1id)
+) COLLATE='utf8mb4_bin' ENGINE=InnoDB;
+CREATE TABLE t2 (
+t2id BIGINT(20) NOT NULL,
+t1idref BIGINT(20) NOT NULL,
+code VARCHAR(20),
+PRIMARY KEY (t2id),
+INDEX FK_T2_T1Id (t1idref),
+CONSTRAINT FK_T2_T1Id FOREIGN KEY (t1idref) REFERENCES t1 (t1id)
+) COLLATE='utf8mb4_bin' ENGINE=InnoDB;
+CREATE TABLE t3 (
+t3idref BIGINT(20) NOT NULL,
+t2idref BIGINT(20) NOT NULL,
+sequencenumber INT(10) NOT NULL,
+PRIMARY KEY (t3idref, t2idref),
+INDEX FK_T3_T2Id (t2idref),
+CONSTRAINT FK_T3_T2Id FOREIGN KEY (t2idref) REFERENCES t2 (t2id)
+) COLLATE='utf8mb4_bin' ENGINE=InnoDB;
+INSERT INTO t1 (t1id) VALUES (100001),(100017),(100018),(100026),(100027),(100028),(100029),(100030),
+(100031),(100032),(100033),(100034),(100035),(100036),(100037),(100038),(100040),(100041),(100042),
+(100043),(100044),(100045),(100046),(100047);
+INSERT IGNORE INTO t2 (t2id, t1idref) SELECT t1id, t1id FROM t1;
+INSERT IGNORE INTO t1 VALUES (200001, 'a');
+INSERT IGNORE INTO t2 (t2id, t1idref) VALUES (200011, 200001),(200012, 200001),(200013, 200001);
+INSERT IGNORE INTO t3 VALUES (1, 200011, 1), (1, 200012, 2), (1, 200013, 3);
+set @tmp7474= @@optimizer_search_depth;
+SET SESSION optimizer_search_depth = 1;
+SELECT SQL_NO_CACHE
+T2_0_.t1idref,
+T2_0_.t2id
+FROM
+t2 T2_0_
+WHERE
+T2_0_.t1idref IN (
+SELECT
+T1_1_.t1id
+FROM
+t3 T3_0_
+INNER JOIN
+t2 T2_1_
+ON T3_0_.t2idref=T2_1_.t2id
+INNER JOIN
+t1 T1_1_
+ON T2_1_.t1idref=T1_1_.t1id
+WHERE
+T3_0_.t3idref= 1
+);
+t1idref t2id
+200001 200011
+200001 200012
+200001 200013
+explain SELECT SQL_NO_CACHE
+T2_0_.t1idref,
+T2_0_.t2id
+FROM
+t2 T2_0_
+WHERE
+T2_0_.t1idref IN (
+SELECT
+T1_1_.t1id
+FROM
+t3 T3_0_
+INNER JOIN
+t2 T2_1_
+ON T3_0_.t2idref=T2_1_.t2id
+INNER JOIN
+t1 T1_1_
+ON T2_1_.t1idref=T1_1_.t1id
+WHERE
+T3_0_.t3idref= 1
+);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY T3_0_ ref PRIMARY,FK_T3_T2Id PRIMARY 8 const 3 Using index; Start temporary
+1 PRIMARY T2_1_ eq_ref PRIMARY,FK_T2_T1Id PRIMARY 8 test.T3_0_.t2idref 1
+1 PRIMARY T1_1_ eq_ref PRIMARY PRIMARY 8 test.T2_1_.t1idref 1 Using index
+1 PRIMARY T2_0_ ref FK_T2_T1Id FK_T2_T1Id 8 test.T2_1_.t1idref 1 Using index; End temporary
+drop table t3,t2,t1;
+set optimizer_search_depth=@tmp7474;
# This must be the last in the file:
set optimizer_switch=@subselect_sj2_tmp;
diff --git a/mysql-test/r/subselect_sj2_jcl6.result b/mysql-test/r/subselect_sj2_jcl6.result
index c45ab02a646..c10b550d11a 100644
--- a/mysql-test/r/subselect_sj2_jcl6.result
+++ b/mysql-test/r/subselect_sj2_jcl6.result
@@ -891,7 +891,7 @@ WHERE t3.b IN (SELECT b FROM t4);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 1
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1
-1 PRIMARY t2 hash_ALL NULL #hash#$hj 5 test.t3.a 1 Using where; Using join buffer (flat, BNLH join)
+1 PRIMARY t2 hash_ALL NULL #hash#$hj 4 test.t3.a 1 Using where; Using join buffer (flat, BNLH join)
1 PRIMARY <derived3> ALL NULL NULL NULL NULL 2 Using join buffer (incremental, BNL join)
2 MATERIALIZED t4 ALL NULL NULL NULL NULL 2
3 DERIVED t1 ALL NULL NULL NULL NULL 1
@@ -1161,7 +1161,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ref PRIMARY PRIMARY 5 const 1 Using where; Using index
1 PRIMARY t2 ALL NULL NULL NULL NULL 1 Start temporary; Using join buffer (flat, BNL join)
1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
-1 PRIMARY t4 hash_index NULL #hash#$hj:PRIMARY 55:59 test.t3.t3_c 2 Using where; End temporary; Using join buffer (incremental, BNLH join)
+1 PRIMARY t4 hash_index NULL #hash#$hj:PRIMARY 54:59 test.t3.t3_c 2 Using where; End temporary; Using join buffer (incremental, BNLH join)
DROP TABLE t1,t2,t3,t4;
#
# MDEV-6263: Wrong result when using IN subquery with order by
@@ -1193,6 +1193,90 @@ id nombre
2 row 2
3 row 3
DROP TABLE t1, t2;
+#
+# MDEV-7474: Semi-Join's DuplicateWeedout strategy skipped for some values of optimizer_search_depth
+#
+CREATE TABLE t1 (
+t1id BIGINT(20) NOT NULL,
+code VARCHAR(20),
+PRIMARY KEY (t1id)
+) COLLATE='utf8mb4_bin' ENGINE=InnoDB;
+CREATE TABLE t2 (
+t2id BIGINT(20) NOT NULL,
+t1idref BIGINT(20) NOT NULL,
+code VARCHAR(20),
+PRIMARY KEY (t2id),
+INDEX FK_T2_T1Id (t1idref),
+CONSTRAINT FK_T2_T1Id FOREIGN KEY (t1idref) REFERENCES t1 (t1id)
+) COLLATE='utf8mb4_bin' ENGINE=InnoDB;
+CREATE TABLE t3 (
+t3idref BIGINT(20) NOT NULL,
+t2idref BIGINT(20) NOT NULL,
+sequencenumber INT(10) NOT NULL,
+PRIMARY KEY (t3idref, t2idref),
+INDEX FK_T3_T2Id (t2idref),
+CONSTRAINT FK_T3_T2Id FOREIGN KEY (t2idref) REFERENCES t2 (t2id)
+) COLLATE='utf8mb4_bin' ENGINE=InnoDB;
+INSERT INTO t1 (t1id) VALUES (100001),(100017),(100018),(100026),(100027),(100028),(100029),(100030),
+(100031),(100032),(100033),(100034),(100035),(100036),(100037),(100038),(100040),(100041),(100042),
+(100043),(100044),(100045),(100046),(100047);
+INSERT IGNORE INTO t2 (t2id, t1idref) SELECT t1id, t1id FROM t1;
+INSERT IGNORE INTO t1 VALUES (200001, 'a');
+INSERT IGNORE INTO t2 (t2id, t1idref) VALUES (200011, 200001),(200012, 200001),(200013, 200001);
+INSERT IGNORE INTO t3 VALUES (1, 200011, 1), (1, 200012, 2), (1, 200013, 3);
+set @tmp7474= @@optimizer_search_depth;
+SET SESSION optimizer_search_depth = 1;
+SELECT SQL_NO_CACHE
+T2_0_.t1idref,
+T2_0_.t2id
+FROM
+t2 T2_0_
+WHERE
+T2_0_.t1idref IN (
+SELECT
+T1_1_.t1id
+FROM
+t3 T3_0_
+INNER JOIN
+t2 T2_1_
+ON T3_0_.t2idref=T2_1_.t2id
+INNER JOIN
+t1 T1_1_
+ON T2_1_.t1idref=T1_1_.t1id
+WHERE
+T3_0_.t3idref= 1
+);
+t1idref t2id
+200001 200011
+200001 200012
+200001 200013
+explain SELECT SQL_NO_CACHE
+T2_0_.t1idref,
+T2_0_.t2id
+FROM
+t2 T2_0_
+WHERE
+T2_0_.t1idref IN (
+SELECT
+T1_1_.t1id
+FROM
+t3 T3_0_
+INNER JOIN
+t2 T2_1_
+ON T3_0_.t2idref=T2_1_.t2id
+INNER JOIN
+t1 T1_1_
+ON T2_1_.t1idref=T1_1_.t1id
+WHERE
+T3_0_.t3idref= 1
+);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY T3_0_ ref PRIMARY,FK_T3_T2Id PRIMARY 8 const 3 Using index; Start temporary
+1 PRIMARY T2_1_ eq_ref PRIMARY,FK_T2_T1Id PRIMARY 8 test.T3_0_.t2idref 1 Using join buffer (flat, BKA join); Key-ordered scan
+1 PRIMARY T1_1_ eq_ref PRIMARY PRIMARY 8 test.T2_1_.t1idref 1 Using index
+1 PRIMARY T2_0_ ref FK_T2_T1Id FK_T2_T1Id 8 test.T2_1_.t1idref 1 Using index; End temporary
+drop table t3,t2,t1;
+set optimizer_search_depth=@tmp7474;
# This must be the last in the file:
set optimizer_switch=@subselect_sj2_tmp;
#
diff --git a/mysql-test/r/subselect_sj2_mat.result b/mysql-test/r/subselect_sj2_mat.result
index 0ff366b0d7a..4e75aee24a2 100644
--- a/mysql-test/r/subselect_sj2_mat.result
+++ b/mysql-test/r/subselect_sj2_mat.result
@@ -1180,6 +1180,90 @@ id nombre
2 row 2
3 row 3
DROP TABLE t1, t2;
+#
+# MDEV-7474: Semi-Join's DuplicateWeedout strategy skipped for some values of optimizer_search_depth
+#
+CREATE TABLE t1 (
+t1id BIGINT(20) NOT NULL,
+code VARCHAR(20),
+PRIMARY KEY (t1id)
+) COLLATE='utf8mb4_bin' ENGINE=InnoDB;
+CREATE TABLE t2 (
+t2id BIGINT(20) NOT NULL,
+t1idref BIGINT(20) NOT NULL,
+code VARCHAR(20),
+PRIMARY KEY (t2id),
+INDEX FK_T2_T1Id (t1idref),
+CONSTRAINT FK_T2_T1Id FOREIGN KEY (t1idref) REFERENCES t1 (t1id)
+) COLLATE='utf8mb4_bin' ENGINE=InnoDB;
+CREATE TABLE t3 (
+t3idref BIGINT(20) NOT NULL,
+t2idref BIGINT(20) NOT NULL,
+sequencenumber INT(10) NOT NULL,
+PRIMARY KEY (t3idref, t2idref),
+INDEX FK_T3_T2Id (t2idref),
+CONSTRAINT FK_T3_T2Id FOREIGN KEY (t2idref) REFERENCES t2 (t2id)
+) COLLATE='utf8mb4_bin' ENGINE=InnoDB;
+INSERT INTO t1 (t1id) VALUES (100001),(100017),(100018),(100026),(100027),(100028),(100029),(100030),
+(100031),(100032),(100033),(100034),(100035),(100036),(100037),(100038),(100040),(100041),(100042),
+(100043),(100044),(100045),(100046),(100047);
+INSERT IGNORE INTO t2 (t2id, t1idref) SELECT t1id, t1id FROM t1;
+INSERT IGNORE INTO t1 VALUES (200001, 'a');
+INSERT IGNORE INTO t2 (t2id, t1idref) VALUES (200011, 200001),(200012, 200001),(200013, 200001);
+INSERT IGNORE INTO t3 VALUES (1, 200011, 1), (1, 200012, 2), (1, 200013, 3);
+set @tmp7474= @@optimizer_search_depth;
+SET SESSION optimizer_search_depth = 1;
+SELECT SQL_NO_CACHE
+T2_0_.t1idref,
+T2_0_.t2id
+FROM
+t2 T2_0_
+WHERE
+T2_0_.t1idref IN (
+SELECT
+T1_1_.t1id
+FROM
+t3 T3_0_
+INNER JOIN
+t2 T2_1_
+ON T3_0_.t2idref=T2_1_.t2id
+INNER JOIN
+t1 T1_1_
+ON T2_1_.t1idref=T1_1_.t1id
+WHERE
+T3_0_.t3idref= 1
+);
+t1idref t2id
+200001 200011
+200001 200012
+200001 200013
+explain SELECT SQL_NO_CACHE
+T2_0_.t1idref,
+T2_0_.t2id
+FROM
+t2 T2_0_
+WHERE
+T2_0_.t1idref IN (
+SELECT
+T1_1_.t1id
+FROM
+t3 T3_0_
+INNER JOIN
+t2 T2_1_
+ON T3_0_.t2idref=T2_1_.t2id
+INNER JOIN
+t1 T1_1_
+ON T2_1_.t1idref=T1_1_.t1id
+WHERE
+T3_0_.t3idref= 1
+);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY T3_0_ ref PRIMARY,FK_T3_T2Id PRIMARY 8 const 3 Using index; Start temporary
+1 PRIMARY T2_1_ eq_ref PRIMARY,FK_T2_T1Id PRIMARY 8 test.T3_0_.t2idref 1
+1 PRIMARY T1_1_ eq_ref PRIMARY PRIMARY 8 test.T2_1_.t1idref 1 Using index
+1 PRIMARY T2_0_ ref FK_T2_T1Id FK_T2_T1Id 8 test.T2_1_.t1idref 1 Using index; End temporary
+drop table t3,t2,t1;
+set optimizer_search_depth=@tmp7474;
# This must be the last in the file:
set optimizer_switch=@subselect_sj2_tmp;
set optimizer_switch=default;
diff --git a/mysql-test/r/subselect_sj_jcl6.result b/mysql-test/r/subselect_sj_jcl6.result
index f388fd41ce8..ba582d7e008 100644
--- a/mysql-test/r/subselect_sj_jcl6.result
+++ b/mysql-test/r/subselect_sj_jcl6.result
@@ -3002,6 +3002,15 @@ pk1 i1 i2 c2 pk3 i3 c3
SET join_cache_level=@tmp_mdev5059;
set optimizer_switch=@tmp_os_mdev5059;
DROP TABLE t1,t2,t3,t4;
+#
+# MDEV-7911: crash in Item_cond::eval_not_null_tables
+#
+create table t1(a int);
+insert into t1 values(1),(2),(3),(null);
+explain
+select 1 from t1 where _cp932 "1" in (select '1' from t1);
+ERROR HY000: Illegal mix of collations (cp932_japanese_ci,COERCIBLE) and (latin1_swedish_ci,COERCIBLE) for operation '='
+drop table t1;
set optimizer_switch=@subselect_sj_tmp;
#
# BUG#49129: Wrong result with IN-subquery with join_cache_level=6 and firstmatch=off
diff --git a/mysql-test/r/subselect_sj_mat.result b/mysql-test/r/subselect_sj_mat.result
index c6a0344c8a3..55b54ea4eb2 100644
--- a/mysql-test/r/subselect_sj_mat.result
+++ b/mysql-test/r/subselect_sj_mat.result
@@ -2186,3 +2186,54 @@ drop database mysqltest2;
drop database mysqltest3;
drop database mysqltest4;
# End of 5.5 tests
+#
+# MDEV-7220: Materialization strategy is not used for REPLACE ... SELECT
+#
+create table t0(a int);
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t1 (a int, b int, c int);
+insert into t1
+select A.a+B.a*10+C.a*100, A.a+B.a*10+C.a*100, A.a+B.a*10+C.a*100
+from t0 A, t0 B, t0 C;
+create table t2 (a int, b int, c int);
+insert into t2 select A.a, A.a, A.a from t1 A;
+insert into t2 select * from t2;
+insert into t2 select * from t2;
+create table t3 as select * from t2 limit 1;
+# The testcase only makes sense if the following uses Materialization:
+explain
+select * from t1 where (a,b) in (select max(a),b from t2 group by b);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 1000 Using where
+1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.b 1
+2 MATERIALIZED t2 ALL NULL NULL NULL NULL 4000 Using temporary
+flush status;
+replace into t3
+select * from t1 where (a,b) in (select max(a),b from t2 group by b);
+# Sequential reads:
+# 1K is read from t1
+# 4K is read from t2
+# 1K groups is read from the tmp. table
+#
+# Lookups:
+# 4K lookups in group by table
+# 1K lookups in temp.table
+#
+# Writes:
+# 2x 1K writes to temporary tables (grouping table and subquery materialization table
+#
+# The point is that neither counter should be in the millions (this
+# will happen if Materialization is not used
+show status where Variable_name like 'Handler_read%' or Variable_name like 'Handler_%write%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 5000
+Handler_read_last 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_rnd 0
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 6003
+Handler_tmp_write 2000
+Handler_write 1000
+drop table t0,t1,t2,t3;
diff --git a/mysql-test/r/table_elim.result b/mysql-test/r/table_elim.result
index ff488fea427..c633261bcd3 100644
--- a/mysql-test/r/table_elim.result
+++ b/mysql-test/r/table_elim.result
@@ -677,3 +677,35 @@ USA
CAN
DROP TABLE t1, t2, t3;
SET optimizer_switch=@save_optimizer_switch;
+#
+# MDEV-7893: table_elimination works wrong with on computed expression and compound unique key
+# (just a testcase)
+CREATE TABLE t1 (
+PostID int(10) unsigned NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+Warnings:
+Warning 1286 Unknown storage engine 'InnoDB'
+Warning 1266 Using storage engine MyISAM for table 't1'
+INSERT INTO t1 (PostID) VALUES (1), (2);
+CREATE TABLE t2 (
+VoteID int(10) unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
+EntityID int(10) unsigned NOT NULL,
+UserID int(10) unsigned NOT NULL,
+UNIQUE KEY EntityID (EntityID,UserID)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+Warnings:
+Warning 1286 Unknown storage engine 'InnoDB'
+Warning 1266 Using storage engine MyISAM for table 't2'
+INSERT INTO t2 (EntityID, UserID) VALUES (1, 30), (2, 30);
+SELECT t1.*, T.Voted as Voted
+FROM
+t1 LEFT JOIN (
+SELECT 1 AS Voted, EntityID
+FROM t2
+WHERE t2.UserID = '20' ) AS T
+ON T.EntityID = t1.PostID
+WHERE t1.PostID='1'
+LIMIT 1;
+PostID Voted
+1 NULL
+DROP TABLE t1,t2;
diff --git a/mysql-test/r/table_keyinfo-6838.result b/mysql-test/r/table_keyinfo-6838.result
new file mode 100644
index 00000000000..55b035069ce
--- /dev/null
+++ b/mysql-test/r/table_keyinfo-6838.result
@@ -0,0 +1,12 @@
+CREATE TABLE t1 (i INT, state VARCHAR(997)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (2,'Louisiana'),(9,'Maine');
+CREATE TABLE t2 (state VARCHAR(997), j INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES ('Louisiana',9),('Alaska',5);
+INSERT INTO t2 SELECT t2.* FROM t2 JOIN t2 AS t3 JOIN t2 AS t4 JOIN t2 AS t5 JOIN t2 AS t6;
+SET @@max_heap_table_size= 16384;
+set @@optimizer_switch='derived_merge=OFF';
+set @@optimizer_switch='extended_keys=ON';
+SELECT * FROM t1 AS t1_1 LEFT JOIN ( t1 AS t1_2 INNER JOIN (SELECT * FROM t2) v2 ON t1_2.i = j ) ON t1_1.state = v2.state LIMIT 1;
+i state i state state j
+2 Louisiana 9 Maine Louisiana 9
+DROP TABLE t1, t2;
diff --git a/mysql-test/r/tmp_table_count-7586.result b/mysql-test/r/tmp_table_count-7586.result
new file mode 100644
index 00000000000..0c526e0d4a3
--- /dev/null
+++ b/mysql-test/r/tmp_table_count-7586.result
@@ -0,0 +1,83 @@
+create table t2 (a int);
+insert into t2 values (1),(2),(3);
+create view v2 as select a from t2;
+flush status;
+select * from v2;
+a
+1
+2
+3
+show status like '%Created_tmp%';
+Variable_name Value
+Created_tmp_disk_tables 0
+Created_tmp_files 0
+Created_tmp_tables 0
+explain select * from v2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3
+select * from (select * from t2) T1;
+a
+1
+2
+3
+show status like '%Created_tmp%';
+Variable_name Value
+Created_tmp_disk_tables 0
+Created_tmp_files 0
+Created_tmp_tables 0
+explain select * from (select * from t2) T1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3
+drop view v2;
+drop table t2;
+CREATE TABLE t1(a int);
+INSERT INTO t1 values(1),(2);
+CREATE TABLE t2(a int);
+INSERT INTO t2 values(1),(2);
+EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT * FROM t2 GROUP BY a HAVING a > 1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
+1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 test.t1.a 1
+2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 Using temporary
+truncate table performance_schema.events_statements_history_long;
+flush status;
+CREATE TABLE t3 SELECT * FROM t1 WHERE a IN (SELECT * FROM t2 GROUP BY a HAVING a > 1);
+# Performance schema should be the same as "Created_tmp_tables" variable below
+select sum(created_tmp_tables) from performance_schema.events_statements_history_long;
+sum(created_tmp_tables)
+2
+show status like '%Created_tmp%';
+Variable_name Value
+Created_tmp_disk_tables 0
+Created_tmp_files 0
+Created_tmp_tables 2
+drop table t3;
+EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT * FROM t2 GROUP BY a);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2
+1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1
+2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2
+truncate table performance_schema.events_statements_history_long;
+flush status;
+CREATE TABLE t3 SELECT * FROM t1 WHERE a IN (SELECT * FROM t2 GROUP BY a);
+# Performance schema should be the same as "Created_tmp_tables" variable below
+select sum(created_tmp_tables) from performance_schema.events_statements_history_long;
+sum(created_tmp_tables)
+1
+show status like '%Created_tmp%';
+Variable_name Value
+Created_tmp_disk_tables 0
+Created_tmp_files 0
+Created_tmp_tables 1
+drop table t1,t2,t3;
+truncate table performance_schema.events_statements_history_long;
+flush status;
+# Performance schema should be the same as "Created_tmp_tables" variable below
+select sum(created_tmp_tables) from performance_schema.events_statements_history_long;
+sum(created_tmp_tables)
+0
+show status like '%Created_tmp%';
+Variable_name Value
+Created_tmp_disk_tables 0
+Created_tmp_files 0
+Created_tmp_tables 0
diff --git a/mysql-test/r/trigger-trans.result b/mysql-test/r/trigger-trans.result
index 722ac79854d..cab7336cbe5 100644
--- a/mysql-test/r/trigger-trans.result
+++ b/mysql-test/r/trigger-trans.result
@@ -195,3 +195,28 @@ b val
14 g
drop trigger t1_after_insert;
drop table t1,t2;
+#
+#Bug#19683834 SOME INNODB ERRORS CAUSES STORED FUNCTION
+# AND TRIGGER HANDLERS TO BE IGNORED
+#Code fixed in Bug#16041903
+CREATE TABLE t1 (id int unsigned PRIMARY KEY, val int DEFAULT 0)
+ENGINE=InnoDB;
+INSERT INTO t1 (id) VALUES (1), (2);
+CREATE TABLE t2 (id int PRIMARY KEY);
+CREATE TABLE t3 LIKE t2;
+CREATE TRIGGER bef_insert BEFORE INSERT ON t2 FOR EACH ROW
+BEGIN
+DECLARE CONTINUE HANDLER FOR 1062 BEGIN END;
+INSERT INTO t3 (id) VALUES (NEW.id);
+INSERT INTO t3 (id) VALUES (NEW.id);
+END//
+START TRANSACTION;
+UPDATE t1 SET val = val + 1;
+connect con2,localhost,root,,test,,;
+SET SESSION innodb_lock_wait_timeout = 2;
+UPDATE t1 SET val = val + 1;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+INSERT INTO t2 (id) VALUES (1);
+disconnect con2;
+connection default;
+DROP TABLE t3, t2, t1;
diff --git a/mysql-test/r/truncate-stale-6500.result b/mysql-test/r/truncate-stale-6500.result
new file mode 100644
index 00000000000..b6222716953
--- /dev/null
+++ b/mysql-test/r/truncate-stale-6500.result
@@ -0,0 +1,33 @@
+SET GLOBAL query_cache_size=1024*1024*8;
+CREATE TABLE `test` (
+`uniqueId` INT NOT NULL,
+`partitionId` INT NOT NULL,
+PRIMARY KEY (`uniqueId`,`partitionId`)
+) ENGINE=InnoDB PARTITION BY LIST (partitionId) (
+PARTITION p01 VALUES IN (1),
+PARTITION p02 VALUES IN (2)
+);
+INSERT INTO `test`(`uniqueId`,`partitionId`) VALUES(407237055, 2);
+SELECT * FROM `test`;
+uniqueId partitionId
+407237055 2
+#Confirms 1 row in partition 'p02'
+SELECT TABLE_NAME, PARTITION_NAME, TABLE_ROWS FROM information_schema.PARTITIONS where TABLE_NAME = 'test';
+TABLE_NAME PARTITION_NAME TABLE_ROWS
+test p01 0
+test p02 1
+ALTER TABLE `test` TRUNCATE PARTITION `p02`;
+#Confirms no more rows in partition 'p02'
+SELECT TABLE_NAME, PARTITION_NAME, TABLE_ROWS FROM information_schema.PARTITIONS where TABLE_NAME = 'test';
+TABLE_NAME PARTITION_NAME TABLE_ROWS
+test p01 0
+test p02 0
+#Before the patch, this returned the previously existing values.
+SELECT * FROM `test`;
+uniqueId partitionId
+SELECT SQL_CACHE * FROM `test`;
+uniqueId partitionId
+SELECT SQL_NO_CACHE * FROM `test`;
+uniqueId partitionId
+DROP TABLE test;
+SET GLOBAL query_cache_size=DEFAULT;
diff --git a/mysql-test/r/type_decimal.result b/mysql-test/r/type_decimal.result
index f8649f030bb..cde8816dee4 100644
--- a/mysql-test/r/type_decimal.result
+++ b/mysql-test/r/type_decimal.result
@@ -994,3 +994,24 @@ GROUP BY t2.col0
WHERE CONCAT(t1.col1, CAST(subq.col0 AS DECIMAL));
1
DROP TABLE t1, t2;
+#
+# Start of 5.5 tests
+#
+#
+# MDEV-8267 Add /*old*/ comment into I_S.COLUMN_TYPE for old DECIMAL
+#
+SHOW CREATE TABLE t1dec102;
+Table Create Table
+t1dec102 CREATE TABLE `t1dec102` (
+ `a` decimal(10,2)/*old*/ DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SHOW COLUMNS FROM t1dec102;
+Field Type Null Key Default Extra
+a decimal(10,2)/*old*/ YES NULL
+SELECT COLUMN_NAME, DATA_TYPE, COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='t1dec102';
+COLUMN_NAME DATA_TYPE COLUMN_TYPE
+a decimal decimal(10,2)/*old*/
+DROP TABLE t1dec102;
+#
+# End of 5.5 tests
+#
diff --git a/mysql-test/r/type_ranges.result b/mysql-test/r/type_ranges.result
index 5992b1347f3..53fc3104666 100644
--- a/mysql-test/r/type_ranges.result
+++ b/mysql-test/r/type_ranges.result
@@ -255,7 +255,7 @@ ushort smallint(5) unsigned zerofill NULL NO 00000 #
umedium mediumint(8) unsigned NULL NO 0 #
ulong int(11) unsigned NULL NO 0 #
ulonglong bigint(13) unsigned NULL NO 0 #
-time_stamp timestamp NULL NO 0000-00-00 00:00:00 #
+time_stamp timestamp NULL NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP #
date_field char(10) latin1_swedish_ci YES NULL #
time_field time NULL YES NULL #
date_time datetime NULL YES NULL #
diff --git a/mysql-test/r/type_time_hires.result b/mysql-test/r/type_time_hires.result
index 8096785dcc1..2620dac0794 100644
--- a/mysql-test/r/type_time_hires.result
+++ b/mysql-test/r/type_time_hires.result
@@ -115,7 +115,6 @@ NULL
delete from t1 where a < 20110101;
select * from t1;
a
-01:02:13.3332
NULL
create table t2 select * from t1;
create table t3 like t1;
@@ -135,12 +134,11 @@ Warnings:
Note 1265 Data truncated for column 'a' at row 1
select a, a+0, a-1, a*1, a/2 from t1;
a a+0 a-1 a*1 a/2
-01:02:13.3332 10213.3332 10212.3332 10213.3332 5106.66660000
NULL NULL NULL NULL NULL
14:15:16.2222 141516.2222 141515.2222 141516.2222 70758.11110000
select max(a), min(a), sum(a), avg(a) from t1;
max(a) min(a) sum(a) avg(a)
-14:15:16.2222 01:02:13.3332 151729.5554 75864.77770000
+14:15:16.2222 14:15:16.2222 141516.2222 141516.22220000
create table t2 select a, a+0, a-1, a*1, a/2 from t1;
create table t3 select max(a), min(a), sum(a), avg(a) from t1;
show create table t2;
diff --git a/mysql-test/r/type_timestamp.result b/mysql-test/r/type_timestamp.result
index 38838e72e96..1ec2dfc565f 100644
--- a/mysql-test/r/type_timestamp.result
+++ b/mysql-test/r/type_timestamp.result
@@ -690,4 +690,45 @@ drop table t1;
drop function f1;
set timestamp=0;
SET time_zone=DEFAULT;
+#
+# MDEV-7778 impossible create copy of table, if table contain default value for timestamp field
+#
+SET sql_mode="NO_ZERO_DATE";
+CREATE TABLE t1 (
+ts timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
+);
+CREATE TABLE t2 AS SELECT * from t1 LIMIT 0;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+SET sql_mode=DEFAULT;
+#
+# MDEV-8082 ON UPDATE is not preserved by CREATE TABLE .. SELECT
+#
+CREATE TABLE t1 (
+vc VARCHAR(10) NOT NULL DEFAULT 'test',
+ts timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP
+);
+CREATE TABLE t2 AS SELECT * FROM t1 LIMIT 0;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `vc` varchar(10) NOT NULL DEFAULT 'test',
+ `ts` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `vc` varchar(10) NOT NULL DEFAULT 'test',
+ `ts` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
End of 10.0 tests
diff --git a/mysql-test/r/type_timestamp_hires.result b/mysql-test/r/type_timestamp_hires.result
index dc1cbb377f9..6ebf83a09f0 100644
--- a/mysql-test/r/type_timestamp_hires.result
+++ b/mysql-test/r/type_timestamp_hires.result
@@ -109,7 +109,7 @@ create table t3 like t1;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `a` timestamp(4) NOT NULL DEFAULT '0000-00-00 00:00:00.0000'
+ `a` timestamp(4) NOT NULL DEFAULT CURRENT_TIMESTAMP(4) ON UPDATE CURRENT_TIMESTAMP(4)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show create table t3;
Table Create Table
@@ -130,7 +130,7 @@ create table t3 select max(a), min(a), sum(a), avg(a) from t1;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `a` timestamp(4) NOT NULL DEFAULT '0000-00-00 00:00:00.0000',
+ `a` timestamp(4) NOT NULL DEFAULT CURRENT_TIMESTAMP(4) ON UPDATE CURRENT_TIMESTAMP(4),
`a+0` decimal(25,4) NOT NULL DEFAULT '0.0000',
`a-1` decimal(25,4) NOT NULL DEFAULT '0.0000',
`a*1` decimal(25,4) NOT NULL DEFAULT '0.0000',
diff --git a/mysql-test/r/uniques_crash-7912.result b/mysql-test/r/uniques_crash-7912.result
new file mode 100644
index 00000000000..bf3aab684ae
--- /dev/null
+++ b/mysql-test/r/uniques_crash-7912.result
@@ -0,0 +1,11 @@
+call mtr.add_suppression("Out of memory");
+set sql_mode="";
+drop table if exists t1,t2;
+create table `t1` (`a` datetime not null) engine=InnoDB;
+create table `t2` (`a` int not null) engine=innodb;
+replace into t1 values (),();
+insert into t2 values(0);
+set session sort_buffer_size = 1024*1024*1024*1024;
+delete d2 from t2 as d1, t1 as d2 where d1.a <=> d2.a;
+drop table t2;
+drop table t1;
diff --git a/mysql-test/r/update_innodb.result b/mysql-test/r/update_innodb.result
new file mode 100644
index 00000000000..88c86c50625
--- /dev/null
+++ b/mysql-test/r/update_innodb.result
@@ -0,0 +1,31 @@
+CREATE TABLE `t1` (
+`c1` int(11) NOT NULL,
+`c2` datetime DEFAULT NULL,
+PRIMARY KEY (`c1`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+CREATE TABLE `t2` (
+`c0` varchar(10) NOT NULL,
+`c1` int(11) NOT NULL,
+`c2` int(11) NOT NULL,
+PRIMARY KEY (`c0`,`c1`),
+KEY `c1` (`c1`),
+KEY `c2` (`c2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+CREATE TABLE `t3` (
+`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+`c1` datetime NOT NULL,
+`c2` bigint(20) NOT NULL,
+`c3` int(4) unsigned NOT NULL,
+PRIMARY KEY (`id`),
+KEY `c2` (`c2`),
+KEY `c3` (`c3`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+CREATE TABLE `t4` (
+`c1` int(11) NOT NULL,
+`c2` bigint(20) DEFAULT NULL,
+`c3` int(11) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+CREATE ALGORITHM=UNDEFINED VIEW `v1` AS select `t4`.`c1` AS `c1`,`t4`.`c2` AS `c2`,`t4`.`c3` AS `c3` from `t4`;
+UPDATE t1 a JOIN t2 b ON a.c1 = b.c1 JOIN v1 vw ON b.c2 = vw.c1 JOIN t3 del ON vw.c2 = del.c2 SET a.c2 = ( SELECT max(t.c1) FROM t3 t, v1 i WHERE del.c2 = t.c2 AND vw.c3 = i.c3 AND t.c3 = 4 ) WHERE a.c2 IS NULL OR a.c2 < '2011-05-01';
+drop view v1;
+drop table t1,t2,t3,t4;
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index 23d1d76ca26..d534cf4023a 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -4908,7 +4908,7 @@ Opened_views 3
show status like 'Opened_table%';
Variable_name Value
Opened_table_definitions 2
-Opened_tables 3
+Opened_tables 2
#
# MDEV-486 LP BUG#1010116 Incorrect query results in
# view and derived tables
@@ -5396,6 +5396,37 @@ DROP VIEW v1;
DROP TABLE t1, t2;
create view v1 as select 1;
drop view v1;
+#
+# MDEV-7260: Crash in get_best_combination when executing multi-table
+# UPDATE with nested views
+#
+CREATE TABLE `t1` (`id` bigint(20));
+INSERT INTO `t1` VALUES (1),(2);
+CREATE TABLE `t2` (`id` bigint(20));
+CREATE TABLE `t3` (`id` bigint(20), `flag` tinyint(4));
+create view v1 as select id from t1;
+create view v2 as select t2.* from (t2 left join v1 using (id));
+update t3 left join v2 using (id) set flag=flag+1;
+drop view v2, v1;
+drop table t1, t2, t3;
+#
+# MDEV-7207 - ALTER VIEW does not change ALGORITM
+#
+create table t1 (a int, b int);
+create algorithm=temptable view v2 (c) as select b+1 from t1;
+show create view v2;
+View Create View character_set_client collation_connection
+v2 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select (`t1`.`b` + 1) AS `c` from `t1` latin1 latin1_swedish_ci
+alter algorithm=undefined view v2 (c) as select b+1 from t1;
+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 (`t1`.`b` + 1) AS `c` from `t1` latin1 latin1_swedish_ci
+alter algorithm=merge view v2 (c) as select b+1 from t1;
+show create view v2;
+View Create View character_set_client collation_connection
+v2 CREATE ALGORITHM=MERGE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select (`t1`.`b` + 1) AS `c` from `t1` latin1 latin1_swedish_ci
+drop view v2;
+drop table t1;
# -----------------------------------------------------------------
# -- End of 5.5 tests.
# -----------------------------------------------------------------
diff --git a/mysql-test/r/view_alias.result b/mysql-test/r/view_alias.result
index 72c4bf29f25..e07b40dba13 100644
--- a/mysql-test/r/view_alias.result
+++ b/mysql-test/r/view_alias.result
@@ -109,3 +109,11 @@ DROP VIEW v1;
CREATE VIEW v1 AS select `test`.`t1`.`a` AS `a` from `test`.`t1` where exists(select ' a ' AS `alias` from `test`.`t1` group by ' a ');
DROP VIEW v1;
DROP TABLE t1, t2;
+create view v1 as select interval(55,10) as my_col;
+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 interval(55,10) AS `my_col` latin1 latin1_swedish_ci
+select * from v1;
+my_col
+1
+drop view v1;
diff --git a/mysql-test/std_data/cacert.pem b/mysql-test/std_data/cacert.pem
index f5ba4fec58d..e934823eea3 100644
--- a/mysql-test/std_data/cacert.pem
+++ b/mysql-test/std_data/cacert.pem
@@ -1,22 +1,78 @@
+Certificate:
+ Data:
+ Version: 3 (0x2)
+ Serial Number: 11580370790696127632 (0xa0b5bde0f2c08c90)
+ Signature Algorithm: sha1WithRSAEncryption
+ Issuer: CN=cacert, C=FI, ST=Helsinki, L=Helsinki, O=MariaDB
+ Validity
+ Not Before: Apr 25 14:55:05 2015 GMT
+ Not After : Apr 20 14:55:05 2035 GMT
+ Subject: CN=cacert, C=FI, ST=Helsinki, L=Helsinki, O=MariaDB
+ Subject Public Key Info:
+ Public Key Algorithm: rsaEncryption
+ Public-Key: (2048 bit)
+ Modulus:
+ 00:c0:1f:90:7c:2b:c2:ea:01:93:ce:e0:c5:72:e8:
+ 1c:06:bd:63:4e:b6:d2:c6:00:32:13:27:42:9e:c9:
+ 3c:91:33:4d:15:90:67:7d:9d:d8:be:9b:12:e2:f6:
+ 1b:46:81:4a:8b:10:c5:b8:14:53:ab:6a:2c:c3:7f:
+ 66:87:6c:0e:18:51:4e:9c:93:7a:6d:a1:d4:06:47:
+ 58:61:a6:04:21:2c:bd:74:7a:e4:68:45:fe:91:fe:
+ fb:a6:29:47:ec:c5:c3:88:c8:c9:e7:d7:c6:1a:0d:
+ b8:f5:c5:02:57:25:01:cc:d5:8c:37:46:58:c6:71:
+ 30:ee:63:38:99:84:5e:9e:3c:af:40:d4:f0:f2:12:
+ 44:6e:2f:4d:cd:f9:da:4d:0e:1f:a6:fe:35:c3:9d:
+ 40:08:82:5e:6f:7d:4d:09:16:7d:a1:78:d6:9f:9f:
+ 44:d6:b1:ad:e7:50:25:1a:f3:4e:16:92:4a:17:5e:
+ 0b:e1:c8:9f:62:22:c4:e2:01:96:63:ed:37:a2:e5:
+ 70:b9:dc:c8:8e:c4:fe:00:21:f5:b9:48:c0:43:55:
+ 4a:d8:0c:9d:ce:d6:60:30:bb:81:31:c8:e9:0e:aa:
+ 1c:18:3d:e4:10:47:42:17:c0:4d:fb:f5:d9:c2:e4:
+ 07:33:f7:15:94:63:6d:11:ad:4f:d4:1d:11:41:c1:
+ e2:dd
+ Exponent: 65537 (0x10001)
+ X509v3 extensions:
+ X509v3 Subject Key Identifier:
+ C7:2C:01:95:1A:F5:3E:CD:04:A6:24:35:35:04:D9:A7:16:01:2A:79
+ X509v3 Authority Key Identifier:
+ keyid:C7:2C:01:95:1A:F5:3E:CD:04:A6:24:35:35:04:D9:A7:16:01:2A:79
+
+ X509v3 Basic Constraints:
+ CA:TRUE
+ Signature Algorithm: sha1WithRSAEncryption
+ 40:6f:6a:54:f3:29:30:48:46:bd:da:46:71:64:52:14:a7:c2:
+ 34:b7:5e:1e:42:3d:e7:47:92:cd:87:e7:9d:5d:1a:82:77:82:
+ 62:32:d4:9d:b6:44:11:dc:88:78:38:a5:d3:1f:1e:be:c2:d6:
+ 14:b0:58:35:cd:66:22:43:97:ba:bb:e3:44:4f:9d:75:14:9f:
+ 6f:37:d3:50:07:09:36:bc:58:92:e8:fe:c0:a8:ba:29:55:65:
+ e2:6f:8f:ab:a5:1d:4f:56:37:de:c7:b4:39:20:4c:a8:4c:db:
+ 56:51:12:7e:e7:7f:83:9d:c4:c7:72:8f:6f:83:f0:af:e3:37:
+ 1c:40:fe:5e:38:26:2f:05:46:a7:0c:a5:81:79:d6:9c:9c:d7:
+ 56:eb:96:fe:c7:ae:8e:4f:5e:4a:6c:3a:fa:68:be:65:60:a2:
+ d3:3f:07:76:45:b3:95:3e:11:ef:3a:0e:6f:73:47:4c:90:dd:
+ 0b:36:b4:22:df:62:8d:58:d2:a6:34:5b:f0:06:5d:cd:bf:52:
+ fa:ee:9b:4f:e8:79:18:6e:1c:6e:5f:96:10:6d:2f:02:1b:dd:
+ bf:14:c9:32:3c:83:a5:6e:56:56:78:9d:ce:84:50:a4:df:cc:
+ b5:a9:b1:ec:09:07:74:02:27:7a:9d:d2:96:a9:80:95:9a:f2:
+ 8c:e9:ef:99
-----BEGIN CERTIFICATE-----
-MIIDsjCCApqgAwIBAgIJAL5YrUwfPSWVMA0GCSqGSIb3DQEBBQUAMEQxCzAJBgNV
-BAYTAlNFMRAwDgYDVQQIEwdVcHBzYWxhMRAwDgYDVQQHEwdVcHBzYWxhMREwDwYD
-VQQKEwhNeVNRTCBBQjAeFw0xMDAxMjkwNTU5NTNaFw0xNTAxMjgwNTU5NTNaMEQx
-CzAJBgNVBAYTAlNFMRAwDgYDVQQIEwdVcHBzYWxhMRAwDgYDVQQHEwdVcHBzYWxh
-MREwDwYDVQQKEwhNeVNRTCBBQjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
-ggEBAL6kNN4peX7uhK9rb06W/QbPEpVuejmdWdl2PqMshP/eSuXXw7kwVgfpxx9R
-vC000CKQQSG9MCoZjtqPnFRsetmWLZgApRpEalGXTXJqq9sEbCfoFizg94U8G7d2
-u5XJjLVmcG34ru36KoBgVx1zeH1puBAf8dOzrE4L7Y+ZQBFzFohjh8C2LqWC4nM5
-qsLmOkDWMipGqYU5DvkKjIbTbwTyRNRgZHWSPfVDDPUIUOsY4BGUp2DpgeGY9aEv
-lIs57Ev9JqlIUCV65lOhhDkG+xwmkHKHA+ECEU9cALI8+uXbh48MB9XpMOuk408X
-/lX89aZwD0/G9kmObVGnE2G+H5UCAwEAAaOBpjCBozAdBgNVHQ4EFgQUsft+d7VA
-jWgRftkR5cPG2k2sUbAwdAYDVR0jBG0wa4AUsft+d7VAjWgRftkR5cPG2k2sUbCh
-SKRGMEQxCzAJBgNVBAYTAlNFMRAwDgYDVQQIEwdVcHBzYWxhMRAwDgYDVQQHEwdV
-cHBzYWxhMREwDwYDVQQKEwhNeVNRTCBBQoIJAL5YrUwfPSWVMAwGA1UdEwQFMAMB
-Af8wDQYJKoZIhvcNAQEFBQADggEBALRUOAmdL8R8sl1y8kiEiFgDatdXK5RDqWai
-8yZChfmwTIToHhmQsOEshJe2e8hky3huUj+33VyXjINoMbebIwMuXPwEkbJal8RZ
-nSJmF0jN1Qz7J/jFffwK9xmejWZJx49Kt2+Qwrwp6kDeq9TLFqQOoVczgyJPYsTL
-NAOib5WqTud3XWvCwxrhqmWu7JZq6sp1fomP/uunprb8y2miWfLESZN2mKAhm44Q
-Lws867LT8v2lskEjq2dT1LutD5+R66XcdjgSr0uDziDs64jZwCD6ea94hVFM7ej0
-ZOXYeSEZJ56FjUxu632e9fY8NyMh30yKjjmQf1mM9PuGJvdvsWU=
+MIIDfzCCAmegAwIBAgIJAKC1veDywIyQMA0GCSqGSIb3DQEBBQUAMFYxDzANBgNV
+BAMMBmNhY2VydDELMAkGA1UEBhMCRkkxETAPBgNVBAgMCEhlbHNpbmtpMREwDwYD
+VQQHDAhIZWxzaW5raTEQMA4GA1UECgwHTWFyaWFEQjAeFw0xNTA0MjUxNDU1MDVa
+Fw0zNTA0MjAxNDU1MDVaMFYxDzANBgNVBAMMBmNhY2VydDELMAkGA1UEBhMCRkkx
+ETAPBgNVBAgMCEhlbHNpbmtpMREwDwYDVQQHDAhIZWxzaW5raTEQMA4GA1UECgwH
+TWFyaWFEQjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMAfkHwrwuoB
+k87gxXLoHAa9Y0620sYAMhMnQp7JPJEzTRWQZ32d2L6bEuL2G0aBSosQxbgUU6tq
+LMN/ZodsDhhRTpyTem2h1AZHWGGmBCEsvXR65GhF/pH++6YpR+zFw4jIyefXxhoN
+uPXFAlclAczVjDdGWMZxMO5jOJmEXp48r0DU8PISRG4vTc352k0OH6b+NcOdQAiC
+Xm99TQkWfaF41p+fRNaxredQJRrzThaSShdeC+HIn2IixOIBlmPtN6LlcLncyI7E
+/gAh9blIwENVStgMnc7WYDC7gTHI6Q6qHBg95BBHQhfATfv12cLkBzP3FZRjbRGt
+T9QdEUHB4t0CAwEAAaNQME4wHQYDVR0OBBYEFMcsAZUa9T7NBKYkNTUE2acWASp5
+MB8GA1UdIwQYMBaAFMcsAZUa9T7NBKYkNTUE2acWASp5MAwGA1UdEwQFMAMBAf8w
+DQYJKoZIhvcNAQEFBQADggEBAEBvalTzKTBIRr3aRnFkUhSnwjS3Xh5CPedHks2H
+551dGoJ3gmIy1J22RBHciHg4pdMfHr7C1hSwWDXNZiJDl7q740RPnXUUn28301AH
+CTa8WJLo/sCouilVZeJvj6ulHU9WN97HtDkgTKhM21ZREn7nf4OdxMdyj2+D8K/j
+NxxA/l44Ji8FRqcMpYF51pyc11brlv7Hro5PXkpsOvpovmVgotM/B3ZFs5U+Ee86
+Dm9zR0yQ3Qs2tCLfYo1Y0qY0W/AGXc2/Uvrum0/oeRhuHG5flhBtLwIb3b8UyTI8
+g6VuVlZ4nc6EUKTfzLWpsewJB3QCJ3qd0papgJWa8ozp75k=
-----END CERTIFICATE-----
diff --git a/mysql-test/std_data/client-cert.pem b/mysql-test/std_data/client-cert.pem
index b83ae7c655d..cbe8bc2c677 100644
--- a/mysql-test/std_data/client-cert.pem
+++ b/mysql-test/std_data/client-cert.pem
@@ -1,69 +1,69 @@
Certificate:
Data:
Version: 3 (0x2)
- Serial Number: 6 (0x6)
- Signature Algorithm: sha1WithRSAEncryption
- Issuer: C=SE, ST=Uppsala, L=Uppsala, O=MySQL AB
+ Serial Number: 3 (0x3)
+ Signature Algorithm: sha1WithRSAEncryption
+ Issuer: CN=cacert, C=FI, ST=Helsinki, L=Helsinki, O=MariaDB
Validity
- Not Before: Feb 20 03:03:26 2010 GMT
- Not After : Sep 3 03:03:26 2030 GMT
- Subject: C=SE, ST=Uppsala, O=MySQL AB
+ Not Before: Apr 25 14:55:16 2015 GMT
+ Not After : Apr 20 14:55:16 2035 GMT
+ Subject: C=FI, ST=Helsinki, L=Helsinki, O=MariaDB, CN=client
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
- RSA Public Key: (1024 bit)
- Modulus (1024 bit):
- 00:c2:e7:20:cf:89:59:2f:67:cb:4c:9f:e8:11:f2:
- 23:e5:f1:b1:ee:3f:66:5f:c3:f5:fd:1e:31:ee:8f:
- 4c:2a:bd:c0:4a:a5:9f:c8:44:d5:77:8f:15:1b:4d:
- 78:6e:b2:a2:48:a5:24:33:05:40:02:b3:c1:87:8d:
- 59:3c:1a:07:aa:86:f0:04:e1:9c:20:4b:22:32:c4:
- 51:9e:40:e4:31:c3:57:f5:98:bf:2e:b1:fd:2c:56:
- bf:49:d9:9b:e7:17:cc:95:5f:b5:08:19:5e:9d:df:
- 65:22:39:2c:48:fb:69:96:31:7a:35:4d:de:60:b4:
- c1:60:19:5f:96:56:7e:55:19
+ Public-Key: (1024 bit)
+ Modulus:
+ 00:ce:a0:3d:3c:a4:bb:4f:a1:4f:91:0d:05:ac:5b:
+ 8a:15:7f:d7:aa:0c:a3:a7:9f:b2:c7:26:9d:65:28:
+ b1:84:d3:a0:ef:9e:b1:45:0f:33:df:98:6e:71:ff:
+ 2b:66:9c:9c:c1:25:13:27:42:b6:20:46:e7:e7:47:
+ a1:88:47:c2:9e:e2:45:25:99:9f:f9:28:1a:9a:13:
+ 67:5d:3e:b3:b8:fe:40:25:ac:26:49:46:2c:03:43:
+ 83:67:d8:0f:41:ae:2e:f4:d8:71:60:3c:8e:e7:91:
+ d0:bb:2c:ca:12:da:71:1a:7b:e3:fa:8c:8f:c3:bb:
+ 62:55:89:b3:bf:85:45:01:61
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Basic Constraints:
CA:FALSE
+ Netscape Comment:
+ OpenSSL Generated Certificate
X509v3 Subject Key Identifier:
- 8D:10:67:91:33:76:9C:02:E5:78:5D:D8:C5:EF:25:96:B2:D7:FA:1F
+ 5A:73:74:8E:14:29:C3:FB:B4:19:0F:97:8F:AA:6F:E1:E1:A8:F7:5B
X509v3 Authority Key Identifier:
- keyid:B1:FB:7E:77:B5:40:8D:68:11:7E:D9:11:E5:C3:C6:DA:4D:AC:51:B0
- DirName:/C=SE/ST=Uppsala/L=Uppsala/O=MySQL AB
- serial:BE:58:AD:4C:1F:3D:25:95
+ keyid:C7:2C:01:95:1A:F5:3E:CD:04:A6:24:35:35:04:D9:A7:16:01:2A:79
Signature Algorithm: sha1WithRSAEncryption
- a9:88:10:3e:5d:2a:47:29:c8:03:27:7a:31:5a:8e:10:03:bc:
- b5:4e:37:1d:12:7b:eb:5f:50:71:70:b1:a3:8e:93:0e:77:17:
- 6c:47:b6:c9:a4:4d:2a:c4:38:f0:61:55:b2:7f:28:ba:06:79:
- ee:67:11:7d:d4:c9:7f:0a:18:c8:c1:cb:d0:2c:f9:63:0f:bb:
- 45:ca:de:ea:bb:ac:00:01:52:48:36:2b:07:2b:c8:46:c7:b1:
- 21:81:bd:77:39:e7:4c:39:aa:bd:ac:60:d8:a7:bf:cf:14:98:
- 4a:0b:a1:40:55:06:8d:6f:35:a9:39:a0:71:a9:97:ba:7c:73:
- 3c:41:ba:c5:1c:11:4b:2b:43:1d:2d:ba:7b:5f:14:b5:3d:64:
- 62:15:36:b4:16:bd:78:c8:43:8d:f9:1c:a5:d2:ac:a1:58:74:
- e1:99:de:ad:04:19:43:a8:bd:0a:fd:19:9b:50:44:46:6d:18:
- 55:4d:bf:b4:5b:a4:93:62:c7:64:91:6c:54:34:d1:f8:f3:ff:
- 12:6d:5f:85:e7:35:9e:5c:42:81:5e:fb:c8:bb:44:51:98:b2:
- ef:1b:9f:5a:22:77:28:7d:da:fb:08:c2:94:9a:0f:42:08:93:
- 54:10:1e:ad:f2:4f:fc:62:98:51:e9:9b:b9:3a:93:d9:e4:1f:
- 1d:c4:76:d0
+ 32:42:4b:36:44:a5:6c:fb:70:d8:08:2b:cb:16:34:15:db:39:
+ 60:7b:7e:b4:4a:bc:fb:e5:16:04:97:0d:eb:f5:68:95:da:2f:
+ 23:57:4c:c9:29:2b:d1:1b:1b:9f:bd:f4:79:75:df:62:7f:63:
+ b4:84:7a:95:5c:c4:ee:f3:77:16:e4:0b:8a:5e:c9:64:bd:7c:
+ 04:50:ac:ff:9a:41:6b:b1:6a:9f:cd:45:10:72:83:10:8a:26:
+ 1d:7f:6c:84:34:5a:41:79:72:91:ee:87:5d:1d:3a:55:ff:91:
+ 7e:52:85:ff:42:41:eb:76:56:23:e5:bc:bc:79:b1:aa:4e:4c:
+ bf:7b:df:63:8b:1a:3c:4b:01:72:89:35:bb:0d:92:97:16:6e:
+ ae:50:cb:89:ee:c6:7a:d0:d3:32:22:0f:19:33:1e:ee:ff:41:
+ a5:a1:25:c5:4c:ce:8f:98:4c:b5:2c:1f:ec:cc:f1:21:e2:3a:
+ ff:7d:6a:87:fe:89:fd:2c:20:3e:fb:9b:b8:c0:f9:09:99:ce:
+ 45:63:82:09:1c:bb:79:d8:a8:40:21:46:c7:ae:3e:dd:89:9d:
+ 56:46:4a:f4:ed:7d:5b:a6:1e:a6:1b:26:f9:ec:26:b4:51:3a:
+ 87:b6:50:13:84:33:22:1a:8a:20:c5:44:64:b8:bb:de:32:ec:
+ 6b:58:db:17
-----BEGIN CERTIFICATE-----
-MIIDETCCAfmgAwIBAgIBBjANBgkqhkiG9w0BAQUFADBEMQswCQYDVQQGEwJTRTEQ
-MA4GA1UECBMHVXBwc2FsYTEQMA4GA1UEBxMHVXBwc2FsYTERMA8GA1UEChMITXlT
-UUwgQUIwHhcNMTAwMjIwMDMwMzI2WhcNMzAwOTAzMDMwMzI2WjAyMQswCQYDVQQG
-EwJTRTEQMA4GA1UECBMHVXBwc2FsYTERMA8GA1UEChMITXlTUUwgQUIwgZ8wDQYJ
-KoZIhvcNAQEBBQADgY0AMIGJAoGBAMLnIM+JWS9ny0yf6BHyI+Xxse4/Zl/D9f0e
-Me6PTCq9wEqln8hE1XePFRtNeG6yokilJDMFQAKzwYeNWTwaB6qG8AThnCBLIjLE
-UZ5A5DHDV/WYvy6x/SxWv0nZm+cXzJVftQgZXp3fZSI5LEj7aZYxejVN3mC0wWAZ
-X5ZWflUZAgMBAAGjgaMwgaAwCQYDVR0TBAIwADAdBgNVHQ4EFgQUjRBnkTN2nALl
-eF3Yxe8llrLX+h8wdAYDVR0jBG0wa4AUsft+d7VAjWgRftkR5cPG2k2sUbChSKRG
-MEQxCzAJBgNVBAYTAlNFMRAwDgYDVQQIEwdVcHBzYWxhMRAwDgYDVQQHEwdVcHBz
-YWxhMREwDwYDVQQKEwhNeVNRTCBBQoIJAL5YrUwfPSWVMA0GCSqGSIb3DQEBBQUA
-A4IBAQCpiBA+XSpHKcgDJ3oxWo4QA7y1TjcdEnvrX1BxcLGjjpMOdxdsR7bJpE0q
-xDjwYVWyfyi6BnnuZxF91Ml/ChjIwcvQLPljD7tFyt7qu6wAAVJINisHK8hGx7Eh
-gb13OedMOaq9rGDYp7/PFJhKC6FAVQaNbzWpOaBxqZe6fHM8QbrFHBFLK0MdLbp7
-XxS1PWRiFTa0Fr14yEON+Ryl0qyhWHThmd6tBBlDqL0K/RmbUERGbRhVTb+0W6ST
-YsdkkWxUNNH48/8SbV+F5zWeXEKBXvvIu0RRmLLvG59aIncofdr7CMKUmg9CCJNU
-EB6t8k/8YphR6Zu5OpPZ5B8dxHbQ
+MIIDHjCCAgagAwIBAgIBAzANBgkqhkiG9w0BAQUFADBWMQ8wDQYDVQQDDAZjYWNl
+cnQxCzAJBgNVBAYTAkZJMREwDwYDVQQIDAhIZWxzaW5raTERMA8GA1UEBwwISGVs
+c2lua2kxEDAOBgNVBAoMB01hcmlhREIwHhcNMTUwNDI1MTQ1NTE2WhcNMzUwNDIw
+MTQ1NTE2WjBWMQswCQYDVQQGEwJGSTERMA8GA1UECAwISGVsc2lua2kxETAPBgNV
+BAcMCEhlbHNpbmtpMRAwDgYDVQQKDAdNYXJpYURCMQ8wDQYDVQQDDAZjbGllbnQw
+gZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAM6gPTyku0+hT5ENBaxbihV/16oM
+o6efsscmnWUosYTToO+esUUPM9+YbnH/K2acnMElEydCtiBG5+dHoYhHwp7iRSWZ
+n/koGpoTZ10+s7j+QCWsJklGLANDg2fYD0GuLvTYcWA8jueR0LssyhLacRp74/qM
+j8O7YlWJs7+FRQFhAgMBAAGjezB5MAkGA1UdEwQCMAAwLAYJYIZIAYb4QgENBB8W
+HU9wZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRlMB0GA1UdDgQWBBRac3SOFCnD
++7QZD5ePqm/h4aj3WzAfBgNVHSMEGDAWgBTHLAGVGvU+zQSmJDU1BNmnFgEqeTAN
+BgkqhkiG9w0BAQUFAAOCAQEAMkJLNkSlbPtw2AgryxY0Fds5YHt+tEq8++UWBJcN
+6/VoldovI1dMySkr0Rsbn730eXXfYn9jtIR6lVzE7vN3FuQLil7JZL18BFCs/5pB
+a7Fqn81FEHKDEIomHX9shDRaQXlyke6HXR06Vf+RflKF/0JB63ZWI+W8vHmxqk5M
+v3vfY4saPEsBcok1uw2SlxZurlDLie7GetDTMiIPGTMe7v9BpaElxUzOj5hMtSwf
+7MzxIeI6/31qh/6J/SwgPvubuMD5CZnORWOCCRy7edioQCFGx64+3YmdVkZK9O19
+W6Yephsm+ewmtFE6h7ZQE4QzIhqKIMVEZLi73jLsa1jbFw==
-----END CERTIFICATE-----
diff --git a/mysql-test/std_data/client-key.pem b/mysql-test/std_data/client-key.pem
index 2fc1754e9c5..5037c6e2728 100644
--- a/mysql-test/std_data/client-key.pem
+++ b/mysql-test/std_data/client-key.pem
@@ -1,15 +1,15 @@
-----BEGIN RSA PRIVATE KEY-----
-MIICWwIBAAKBgQDC5yDPiVkvZ8tMn+gR8iPl8bHuP2Zfw/X9HjHuj0wqvcBKpZ/I
-RNV3jxUbTXhusqJIpSQzBUACs8GHjVk8GgeqhvAE4ZwgSyIyxFGeQOQxw1f1mL8u
-sf0sVr9J2ZvnF8yVX7UIGV6d32UiOSxI+2mWMXo1Td5gtMFgGV+WVn5VGQIDAQAB
-AoGARXcXLKDpVooJ3W+IyQyiWsw//IhANpWjUOm4JiyQmxMyO+i4ACr4Yjpu7WI5
-MEseqAGj20NdwxjKO0PXsCIe5LmrGZ+SI8+CSERFOWXWRtCWz7y7SG30i1k6suvM
-mwqWom0tJLwn93uA1lm/WSwKQwUrJRahRQd3EaZqrl7DP5kCQQD/8gbuYAT5pxQe
-ULLGM0RvEsXxDYbEDxNbY5wrBazfklBwpumxZpFl6jEAT++7Kh2Ns3A7kB1oUNlA
-FPYr+dYPAkEAwvHEwRtoyUr8jqoqVVJWI76CDmBjEOzVeMKW97ztqbs2LxZW8dYI
-iOh/myFGpdoUwgu0U8w9MmXcj3ZeZCYKVwJALyQ+AJPw9qa+fuLwOq9gsHCtwrty
-EhSQxSlwrz/pWniRll439vPkXfgntF4E0t1r+hiN2Hqv3/HcQgBaYzkuIwJAG023
-bACFxaOuCeFFepvEms8E8jSHy4gQQhCnCl24v8wLw76SQN7kZSCDNtwLRBFuVNtE
-z3PMonFn2eQPRmGZkwJAP1c1BHprMQx/ruafdscROILv3JrH40C1bR6KVVBKt1dK
-Qpnpgi7hK5rUQjDF8k3bn9ugTt06jyeHe/QhAml0kg==
+MIICXAIBAAKBgQDOoD08pLtPoU+RDQWsW4oVf9eqDKOnn7LHJp1lKLGE06DvnrFF
+DzPfmG5x/ytmnJzBJRMnQrYgRufnR6GIR8Ke4kUlmZ/5KBqaE2ddPrO4/kAlrCZJ
+RiwDQ4Nn2A9Bri702HFgPI7nkdC7LMoS2nEae+P6jI/Du2JVibO/hUUBYQIDAQAB
+AoGAa/FgLFcul3oA9BjmdtVXfMXNp8N0l3QhVFLC9P7eRjK8p5GysA4yHkQmpp0U
+UkXMykYRDHiYZqJEMhnEtEowzBmodi7go+gpwAR2eUKwESmJoBhPvqDJAbS/fL5D
+H2Wk6FGsdKoPhEpigWefu6ZqlX5GCGa601eMYLMR9i+6bbUCQQDspD4j2q8oihTU
+RQt/XpF1l+5ZRHjQOokwRekuHdq0powtNxZ+X3V8Qy8JbDRNCM2YtfKMX4gXAfZp
+JWs7HoPvAkEA34doY3AKxZSpXD84m4dnJ0/Ubfk3+tcC1EPYyDJ1DHpfz7fy6aoX
+z8TWCQXtSBGaEa9Dgbz+EFXuctLbUR8/rwJACDjIo+xEK69oe9uOQ7WgbiqCMH3N
+iMaP36p+KIkHAUHMGwIP+QIODewzpSsqQgbtRcIElFX5X3tE+XBAYoRz5wJAKH3/
+CwRg7ynfBDbvqjz9EsIDWWisG2SXvpwLyThau8fvU1GfT3Tgm2Ks4zWPpl6J6mo1
+cGssGwl2CJbp4+glQQJBAJAwvKufpB+M6OjvKh89GGsCEaV1ENJ41FPcQwJ2pjed
+Fcq28ZP59v7bfBH2IkNu3pfEzmvQnmRlTEtXGjNn+i8=
-----END RSA PRIVATE KEY-----
diff --git a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/ChangeLog b/mysql-test/std_data/mysql_upgrade/event.MYD
index e69de29bb2d..e69de29bb2d 100644
--- a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/ChangeLog
+++ b/mysql-test/std_data/mysql_upgrade/event.MYD
diff --git a/mysql-test/std_data/mysql_upgrade/event.MYI b/mysql-test/std_data/mysql_upgrade/event.MYI
new file mode 100644
index 00000000000..d5c16c3892f
--- /dev/null
+++ b/mysql-test/std_data/mysql_upgrade/event.MYI
Binary files differ
diff --git a/mysql-test/std_data/mysql_upgrade/event.frm b/mysql-test/std_data/mysql_upgrade/event.frm
new file mode 100644
index 00000000000..fd4ff199b56
--- /dev/null
+++ b/mysql-test/std_data/mysql_upgrade/event.frm
Binary files differ
diff --git a/mysql-test/std_data/mysql_upgrade/v1.frm b/mysql-test/std_data/mysql_upgrade/v1.frm
new file mode 100644
index 00000000000..be197fd76a8
--- /dev/null
+++ b/mysql-test/std_data/mysql_upgrade/v1.frm
@@ -0,0 +1,15 @@
+TYPE=VIEW
+query=select `test`.`t1`.`a` AS `a` from `test`.`t1`
+md5=5e6eaf216e7b016fcedfd4e1113517af
+updatable=0
+algorithm=1
+definer_user=root
+definer_host=localhost
+suid=2
+with_check_option=0
+timestamp=2014-12-11 15:26:20
+create-version=1
+source=select a from t1
+client_cs_name=utf8
+connection_cl_name=utf8_general_ci
+view_body_utf8=select `test`.`t1`.`a` AS `a` from `test`.`t1`
diff --git a/mysql-test/std_data/mysql_upgrade/v1badcheck.frm b/mysql-test/std_data/mysql_upgrade/v1badcheck.frm
new file mode 100644
index 00000000000..a1e3bfe5cbc
--- /dev/null
+++ b/mysql-test/std_data/mysql_upgrade/v1badcheck.frm
@@ -0,0 +1,15 @@
+TYPE=VIEW
+query=select `test`.`t1`.`a` AS `a` from `test`.`t1`
+md5=00000000000000000000000000000000
+updatable=0
+algorithm=1
+definer_user=root
+definer_host=localhost
+suid=2
+with_check_option=0
+timestamp=2014-12-11 15:26:20
+create-version=1
+source=select a from t1
+client_cs_name=utf8
+connection_cl_name=utf8_general_ci
+view_body_utf8=select `test`.`t1`.`a` AS `a` from `test`.`t1`
diff --git a/mysql-test/std_data/mysql_upgrade/v2.frm b/mysql-test/std_data/mysql_upgrade/v2.frm
new file mode 100644
index 00000000000..42cc06d9fba
--- /dev/null
+++ b/mysql-test/std_data/mysql_upgrade/v2.frm
@@ -0,0 +1,15 @@
+TYPE=VIEW
+query=select `test`.`t1`.`a` AS `a` from `test`.`t1`
+md5=5e6eaf216e7b016fcedfd4e1113517af
+updatable=1
+algorithm=2
+definer_user=root
+definer_host=localhost
+suid=2
+with_check_option=0
+timestamp=2014-12-11 15:26:29
+create-version=1
+source=select a from t1
+client_cs_name=utf8
+connection_cl_name=utf8_general_ci
+view_body_utf8=select `test`.`t1`.`a` AS `a` from `test`.`t1`
diff --git a/mysql-test/std_data/mysql_upgrade/v3.frm b/mysql-test/std_data/mysql_upgrade/v3.frm
new file mode 100644
index 00000000000..cca46ae9170
--- /dev/null
+++ b/mysql-test/std_data/mysql_upgrade/v3.frm
@@ -0,0 +1,15 @@
+TYPE=VIEW
+query=select `test`.`t1`.`a` AS `a` from `test`.`t1`
+md5=5e6eaf216e7b016fcedfd4e1113517af
+updatable=0
+algorithm=0
+definer_user=root
+definer_host=localhost
+suid=2
+with_check_option=0
+timestamp=2014-12-11 15:26:20
+create-version=1
+source=select a from t1
+client_cs_name=utf8
+connection_cl_name=utf8_general_ci
+view_body_utf8=select `test`.`t1`.`a` AS `a` from `test`.`t1`
diff --git a/mysql-test/std_data/mysql_upgrade/v4.frm b/mysql-test/std_data/mysql_upgrade/v4.frm
new file mode 100644
index 00000000000..9d0cc48447d
--- /dev/null
+++ b/mysql-test/std_data/mysql_upgrade/v4.frm
@@ -0,0 +1,16 @@
+TYPE=VIEW
+query=select `test`.`t1`.`a` AS `a` from `test`.`t1`
+md5=5e6eaf216e7b016fcedfd4e1113517a0
+updatable=1
+algorithm=0
+definer_user=root
+definer_host=localhost
+suid=2
+with_check_option=0
+timestamp=2015-02-08 19:21:14
+create-version=1
+source=select a from t1
+client_cs_name=latin1
+connection_cl_name=latin1_swedish_ci
+view_body_utf8=select `test`.`t1`.`a` AS `a` from `test`.`t1`
+mariadb-version=50542
diff --git a/mysql-test/std_data/old_decimal/t1dec102.MYD b/mysql-test/std_data/old_decimal/t1dec102.MYD
new file mode 100644
index 00000000000..59e43854d4a
--- /dev/null
+++ b/mysql-test/std_data/old_decimal/t1dec102.MYD
@@ -0,0 +1 @@
+ý 123.45ý 123.46ý 123.47 \ No newline at end of file
diff --git a/mysql-test/std_data/old_decimal/t1dec102.MYI b/mysql-test/std_data/old_decimal/t1dec102.MYI
new file mode 100644
index 00000000000..e0b2d4a003c
--- /dev/null
+++ b/mysql-test/std_data/old_decimal/t1dec102.MYI
Binary files differ
diff --git a/mysql-test/std_data/old_decimal/t1dec102.frm b/mysql-test/std_data/old_decimal/t1dec102.frm
new file mode 100644
index 00000000000..652cfc3bbac
--- /dev/null
+++ b/mysql-test/std_data/old_decimal/t1dec102.frm
Binary files differ
diff --git a/mysql-test/std_data/server-cert.pem b/mysql-test/std_data/server-cert.pem
index d77bae800f2..1cc1519ada9 100644
--- a/mysql-test/std_data/server-cert.pem
+++ b/mysql-test/std_data/server-cert.pem
@@ -1,69 +1,74 @@
Certificate:
Data:
Version: 3 (0x2)
- Serial Number: 4 (0x4)
- Signature Algorithm: sha1WithRSAEncryption
- Issuer: C=SE, ST=Uppsala, L=Uppsala, O=MySQL AB
+ Serial Number: 1 (0x1)
+ Signature Algorithm: sha1WithRSAEncryption
+ Issuer: CN=cacert, C=FI, ST=Helsinki, L=Helsinki, O=MariaDB
Validity
- Not Before: Feb 20 02:55:06 2010 GMT
- Not After : Sep 3 02:55:06 2030 GMT
- Subject: C=SE, ST=Uppsala, O=MySQL AB, CN=localhost
+ Not Before: Apr 25 14:55:05 2015 GMT
+ Not After : Apr 20 14:55:05 2035 GMT
+ Subject: C=FI, ST=state or province within country, in other certificates in this file it is the same as L, L=location, usually an address but often ambiguously used, O=organization name, typically a company name, OU=organizational unit name, a division name within an organization, CN=localhost
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
- RSA Public Key: (1024 bit)
- Modulus (1024 bit):
- 00:e3:7d:4f:c2:23:77:a9:3a:2c:d2:69:59:a0:2f:
- 4e:d1:51:4c:ae:8d:f5:17:cc:ce:58:9c:83:4f:0b:
- a3:bb:29:a2:b8:1d:3e:1b:04:f9:a9:3e:e2:61:d0:
- e6:7b:b9:7c:12:d8:1f:86:c9:53:b5:04:dd:df:26:
- e9:c0:2b:de:4a:96:2e:f3:23:6f:79:6d:a9:d2:4e:
- 17:af:2f:de:8b:68:44:ae:de:a3:e2:c4:37:1c:04:
- ad:73:4b:85:f9:83:ac:fe:b7:c1:54:47:2e:96:d4:
- 31:96:85:94:69:d6:5a:63:24:04:99:89:19:1d:56:
- 8a:d1:77:aa:87:fb:38:cd:b7
+ Public-Key: (1024 bit)
+ Modulus:
+ 00:aa:e6:54:bd:dd:52:1e:16:f7:24:52:37:58:2b:
+ a7:af:49:e1:cd:75:2a:18:52:e1:48:f0:59:82:c0:
+ 7a:d9:66:b3:97:04:b3:77:f4:39:fd:d1:c0:1a:c5:
+ a6:ab:44:84:d2:17:39:53:25:63:9b:c3:24:78:51:
+ 5c:77:6b:df:b4:82:1d:e4:43:f4:67:0a:5d:89:a2:
+ fe:b0:ea:64:3a:1d:9d:49:78:c8:7f:79:a5:cd:45:
+ 4b:0c:ad:ae:4f:e2:d4:5d:ec:e8:73:06:ed:98:92:
+ 85:49:b2:9c:31:3b:44:38:5f:bb:5a:f1:68:84:a9:
+ c3:5b:31:39:d4:47:98:38:55
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Basic Constraints:
CA:FALSE
+ Netscape Comment:
+ OpenSSL Generated Certificate
X509v3 Subject Key Identifier:
- CC:8C:71:40:D0:0F:BF:D1:99:79:3F:1B:E9:10:76:19:67:36:0F:A3
+ E5:72:8F:57:72:D6:75:63:28:7F:E2:BF:00:B7:1D:B8:AA:FE:94:59
X509v3 Authority Key Identifier:
- keyid:B1:FB:7E:77:B5:40:8D:68:11:7E:D9:11:E5:C3:C6:DA:4D:AC:51:B0
- DirName:/C=SE/ST=Uppsala/L=Uppsala/O=MySQL AB
- serial:BE:58:AD:4C:1F:3D:25:95
+ keyid:C7:2C:01:95:1A:F5:3E:CD:04:A6:24:35:35:04:D9:A7:16:01:2A:79
Signature Algorithm: sha1WithRSAEncryption
- 6f:ad:5e:59:fa:84:3a:be:e2:72:b1:e8:66:2a:4e:f8:73:19:
- 11:06:11:92:78:56:3e:d6:e8:68:29:90:8b:59:d2:fe:aa:ae:
- 25:59:c7:e9:99:bb:4a:06:43:dd:40:bd:cb:f4:ae:79:95:7d:
- 8e:90:ef:58:d2:a8:fc:bf:07:f3:37:b2:9b:bd:da:e6:8c:56:
- dd:5e:c6:4a:70:7c:3e:3d:a1:e8:35:06:b8:a7:7b:ac:26:85:
- 54:5d:09:a2:7b:77:b4:17:7f:72:31:cb:ff:cc:67:6d:e6:3e:
- c6:dc:96:eb:4a:0a:ae:e9:48:ae:8a:e0:d6:73:57:6e:32:4c:
- 00:dc:28:da:55:b3:9f:9f:d8:98:cc:d9:f1:b6:b3:14:67:2e:
- a1:47:1e:51:11:cf:70:9f:31:8f:ba:59:29:f2:d0:88:0b:e2:
- 51:6b:f8:31:ed:6d:ac:00:5e:d3:78:4c:95:97:02:cc:74:2b:
- 3b:c6:28:e6:2a:c3:30:99:35:b4:4d:31:46:d4:90:f2:47:ed:
- 64:85:1a:75:2a:72:0a:2f:c6:3a:2f:d2:ac:6b:31:cc:e5:a8:
- 07:c2:d6:22:f3:c6:0f:bf:67:d9:d6:b2:79:cd:48:b5:c3:e0:
- e3:18:7f:b5:74:c9:43:19:fb:c4:93:29:ca:cc:90:2b:1b:6f:
- 45:f6:25:f9
+ 88:44:46:fa:7d:16:ae:9d:16:5b:95:26:03:3c:71:f4:29:3d:
+ df:cb:f4:14:20:9f:87:24:b4:29:17:2d:7a:12:48:76:ac:00:
+ 44:26:ba:93:83:ad:58:7e:b7:77:e4:b0:32:0d:e5:dd:fb:cc:
+ 0e:9b:88:e0:24:82:e4:41:43:47:5a:4e:d3:b4:5b:47:4b:57:
+ eb:67:02:63:bb:dd:05:12:f5:95:01:0b:89:81:ca:c2:91:14:
+ 21:9a:9e:c9:84:91:46:35:0e:26:44:1e:91:88:74:4f:fe:d3:
+ 19:9e:65:fa:46:e2:46:04:ad:91:79:4c:70:1b:68:b2:49:e9:
+ 6c:f4:58:44:3b:43:15:85:56:64:1b:84:74:49:95:9f:cd:93:
+ 9d:8e:69:ab:ca:46:97:b6:74:e9:2a:83:85:62:cd:e5:be:c3:
+ 52:bd:cf:90:cc:60:27:76:ee:1b:3c:da:69:73:e2:11:68:14:
+ dc:7d:9f:b8:6f:20:a2:0c:b7:8e:33:40:89:d1:a3:89:e2:60:
+ 6a:ec:b5:9f:e8:c5:55:10:40:b2:95:5e:54:8a:10:8e:d5:90:
+ d9:98:86:d8:f9:b6:01:41:8c:d7:0d:0e:86:0e:50:6d:a2:64:
+ 00:2a:91:5e:35:64:15:e3:86:34:3a:39:eb:0f:4f:56:c7:15:
+ 4c:74:2e:91
-----BEGIN CERTIFICATE-----
-MIIDJTCCAg2gAwIBAgIBBDANBgkqhkiG9w0BAQUFADBEMQswCQYDVQQGEwJTRTEQ
-MA4GA1UECBMHVXBwc2FsYTEQMA4GA1UEBxMHVXBwc2FsYTERMA8GA1UEChMITXlT
-UUwgQUIwHhcNMTAwMjIwMDI1NTA2WhcNMzAwOTAzMDI1NTA2WjBGMQswCQYDVQQG
-EwJTRTEQMA4GA1UECBMHVXBwc2FsYTERMA8GA1UEChMITXlTUUwgQUIxEjAQBgNV
-BAMTCWxvY2FsaG9zdDCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA431PwiN3
-qTos0mlZoC9O0VFMro31F8zOWJyDTwujuymiuB0+GwT5qT7iYdDme7l8EtgfhslT
-tQTd3ybpwCveSpYu8yNveW2p0k4Xry/ei2hErt6j4sQ3HAStc0uF+YOs/rfBVEcu
-ltQxloWUadZaYyQEmYkZHVaK0Xeqh/s4zbcCAwEAAaOBozCBoDAJBgNVHRMEAjAA
-MB0GA1UdDgQWBBTMjHFA0A+/0Zl5PxvpEHYZZzYPozB0BgNVHSMEbTBrgBSx+353
-tUCNaBF+2RHlw8baTaxRsKFIpEYwRDELMAkGA1UEBhMCU0UxEDAOBgNVBAgTB1Vw
-cHNhbGExEDAOBgNVBAcTB1VwcHNhbGExETAPBgNVBAoTCE15U1FMIEFCggkAvlit
-TB89JZUwDQYJKoZIhvcNAQEFBQADggEBAG+tXln6hDq+4nKx6GYqTvhzGREGEZJ4
-Vj7W6GgpkItZ0v6qriVZx+mZu0oGQ91Avcv0rnmVfY6Q71jSqPy/B/M3spu92uaM
-Vt1exkpwfD49oeg1Brine6wmhVRdCaJ7d7QXf3Ixy//MZ23mPsbclutKCq7pSK6K
-4NZzV24yTADcKNpVs5+f2JjM2fG2sxRnLqFHHlERz3CfMY+6WSny0IgL4lFr+DHt
-bawAXtN4TJWXAsx0KzvGKOYqwzCZNbRNMUbUkPJH7WSFGnUqcgovxjov0qxrMczl
-qAfC1iLzxg+/Z9nWsnnNSLXD4OMYf7V0yUMZ+8STKcrMkCsbb0X2Jfk=
+MIIEETCCAvmgAwIBAgIBATANBgkqhkiG9w0BAQUFADBWMQ8wDQYDVQQDDAZjYWNl
+cnQxCzAJBgNVBAYTAkZJMREwDwYDVQQIDAhIZWxzaW5raTERMA8GA1UEBwwISGVs
+c2lua2kxEDAOBgNVBAoMB01hcmlhREIwHhcNMTUwNDI1MTQ1NTA1WhcNMzUwNDIw
+MTQ1NTA1WjCCAUcxCzAJBgNVBAYTAkZJMWEwXwYDVQQIDFhzdGF0ZSBvciBwcm92
+aW5jZSB3aXRoaW4gY291bnRyeSwgaW4gb3RoZXIgY2VydGlmaWNhdGVzIGluIHRo
+aXMgZmlsZSBpdCBpcyB0aGUgc2FtZSBhcyBMMUAwPgYDVQQHDDdsb2NhdGlvbiwg
+dXN1YWxseSBhbiBhZGRyZXNzIGJ1dCBvZnRlbiBhbWJpZ3VvdXNseSB1c2VkMTQw
+MgYDVQQKDCtvcmdhbml6YXRpb24gbmFtZSwgdHlwaWNhbGx5IGEgY29tcGFueSBu
+YW1lMUkwRwYDVQQLDEBvcmdhbml6YXRpb25hbCB1bml0IG5hbWUsIGEgZGl2aXNp
+b24gbmFtZSB3aXRoaW4gYW4gb3JnYW5pemF0aW9uMRIwEAYDVQQDDAlsb2NhbGhv
+c3QwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAKrmVL3dUh4W9yRSN1grp69J
+4c11KhhS4UjwWYLAetlms5cEs3f0Of3RwBrFpqtEhNIXOVMlY5vDJHhRXHdr37SC
+HeRD9GcKXYmi/rDqZDodnUl4yH95pc1FSwytrk/i1F3s6HMG7ZiShUmynDE7RDhf
+u1rxaISpw1sxOdRHmDhVAgMBAAGjezB5MAkGA1UdEwQCMAAwLAYJYIZIAYb4QgEN
+BB8WHU9wZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRlMB0GA1UdDgQWBBTlco9X
+ctZ1Yyh/4r8Atx24qv6UWTAfBgNVHSMEGDAWgBTHLAGVGvU+zQSmJDU1BNmnFgEq
+eTANBgkqhkiG9w0BAQUFAAOCAQEAiERG+n0Wrp0WW5UmAzxx9Ck938v0FCCfhyS0
+KRctehJIdqwARCa6k4OtWH63d+SwMg3l3fvMDpuI4CSC5EFDR1pO07RbR0tX62cC
+Y7vdBRL1lQELiYHKwpEUIZqeyYSRRjUOJkQekYh0T/7TGZ5l+kbiRgStkXlMcBto
+sknpbPRYRDtDFYVWZBuEdEmVn82TnY5pq8pGl7Z06SqDhWLN5b7DUr3PkMxgJ3bu
+GzzaaXPiEWgU3H2fuG8gogy3jjNAidGjieJgauy1n+jFVRBAspVeVIoQjtWQ2ZiG
+2Pm2AUGM1w0Ohg5QbaJkACqRXjVkFeOGNDo56w9PVscVTHQukQ==
-----END CERTIFICATE-----
diff --git a/mysql-test/std_data/server-key.pem b/mysql-test/std_data/server-key.pem
index bf0ae205107..3125ae88a8a 100644
--- a/mysql-test/std_data/server-key.pem
+++ b/mysql-test/std_data/server-key.pem
@@ -1,15 +1,15 @@
-----BEGIN RSA PRIVATE KEY-----
-MIICXgIBAAKBgQDjfU/CI3epOizSaVmgL07RUUyujfUXzM5YnINPC6O7KaK4HT4b
-BPmpPuJh0OZ7uXwS2B+GyVO1BN3fJunAK95Kli7zI295banSThevL96LaESu3qPi
-xDccBK1zS4X5g6z+t8FURy6W1DGWhZRp1lpjJASZiRkdVorRd6qH+zjNtwIDAQAB
-AoGAUb0o91y/FjMs/72S0pes/lDz+JRRSGfyjKxQEgrgndNsADOhqRu0iTdrKDJj
-XnlbN3ooecnFJfnFrvTQcJhSmlS30j6VrBw6LXpCBK3dvjYgJ9LOne7WK+dF1+vS
-FMQtsP04C56Sxy6HJDpMyWJ6oS3Bu169ygG2AxKo+Fk+E6ECQQD38w/MzmrARz2Z
-AGeEPDUnVZPYgtmXkmks95S0/2jSoLhmgpvJimzxwpYwVG/BG8dSDVuTDu5kp05D
-3bZIp3EzAkEA6uAwJsCZPtHXlWU3wYZJsA697rUNjPaCQOIaZ/lnh5RUHTmUiw1h
-Oj/VORqKB0kXqcDfawwLjZEvh1Xli+H5bQJBANTmhw2TvEPnp/OFTl1UGUvyBmXl
-TRMB639qAu07VfVtfYi/4ya1zn/0VmOfTOoigQ5qW9Q1AOu6YNCTQl62L9MCQQDc
-YfEsW2kvNYxYJHoVfuBjbuGuOnn1e1Oqd70ZND59S6NFLMMBWlORaVWzWACNZ3rp
-kAzSj6HDeqgjD2jsQONdAkEAt7S1YHUn8F760bRn4AnAto2TVOYdArtTP/wYjd4o
-9rJREO/d8AYkYJ96APLvF0SZ4n3t1pLwQRsKKN8ZGTmzLA==
+MIICXAIBAAKBgQCq5lS93VIeFvckUjdYK6evSeHNdSoYUuFI8FmCwHrZZrOXBLN3
+9Dn90cAaxaarRITSFzlTJWObwyR4UVx3a9+0gh3kQ/RnCl2Jov6w6mQ6HZ1JeMh/
+eaXNRUsMra5P4tRd7OhzBu2YkoVJspwxO0Q4X7ta8WiEqcNbMTnUR5g4VQIDAQAB
+AoGAblQWXyBzdBN1Z5BgRF6ieYpj6OT70QoogJMR5lRmutUPma4iQo17pr3znBT/
+nU+1w3/UtTXNEXCwqbA01q/gkbP2PaW/sbHLVow1B7u/o42WW6I3Btnl3ClnCNjD
+Mo7/Gj027hhp7mC61r81JeJVh8fJUgxdNqoH7AkDnA+FJAECQQDjIl3k6W2P+bHb
+bp+8eyY7ITQbppZh+3hFJKRL7DZKFYL5J6gejiBURnG9DKnhoSP2nqzqdrRhWZhB
+ZHr+ciEBAkEAwJ5rMpFoIwRzgPD4Q4iSqHcBbFcJE7dK1XLq6MYUVNQGfDU8pBvI
+EocXphpsJ8CbR35dGDY19rmO2LjG3RBDVQJAetRN9Inrjw2YCjNzvKjYTuew1zcq
+YghszO94zfoKjdu+PWEdwJBZmVmTDoo3oGXVHfxHRHA3MeISvWJKRSmRAQJAHL9H
+9msXJKrEZkkQdFvMr5HbR4UR2LxxUbvt7UGqxSJDuYPkggWXbZR15hdpbuFjC1+D
+m1pz4Ve+RwAExfdoZQJBANfmuWtlLU+SMpDG4zOyC7u4dz+TtnEOfDUECFNZtqvU
+MWz98MIXAjiBDYU1Z0BrA7b0/FVsPR3t6JZFQWWI2y8=
-----END RSA PRIVATE KEY-----
diff --git a/mysql-test/std_data/server8k-cert.pem b/mysql-test/std_data/server8k-cert.pem
index c4c4c3a6374..7e41195cea4 100644
--- a/mysql-test/std_data/server8k-cert.pem
+++ b/mysql-test/std_data/server8k-cert.pem
@@ -1,69 +1,148 @@
Certificate:
Data:
Version: 3 (0x2)
- Serial Number: 5 (0x5)
- Signature Algorithm: sha1WithRSAEncryption
- Issuer: C=SE, ST=Uppsala, L=Uppsala, O=MySQL AB
+ Serial Number: 2 (0x2)
+ Signature Algorithm: sha1WithRSAEncryption
+ Issuer: CN=cacert, C=FI, ST=Helsinki, L=Helsinki, O=MariaDB
Validity
- Not Before: Feb 20 03:00:54 2010 GMT
- Not After : Sep 3 03:00:54 2030 GMT
- Subject: C=SE, ST=Uppsala, O=MySQL AB, CN=server
+ Not Before: Apr 25 14:55:16 2015 GMT
+ Not After : Apr 20 14:55:16 2035 GMT
+ Subject: C=FI, ST=Helsinki, L=Helsinki, O=MariaDB, CN=server8k
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
- RSA Public Key: (1024 bit)
- Modulus (1024 bit):
- 00:c5:da:44:95:06:77:16:21:af:a0:c4:3c:e9:f8:
- 1d:2d:95:f9:63:90:8c:3f:86:ba:77:76:4a:52:4b:
- 6b:af:29:f5:1c:aa:d4:3f:3e:42:9f:6d:46:ba:86:
- 90:b1:2d:cc:db:c6:33:15:a3:f4:af:53:33:4f:a1:
- 56:d1:aa:3b:26:10:f7:64:b5:f9:bf:1b:b1:47:8e:
- cc:a6:d6:0d:aa:4a:77:e3:a3:63:9d:2a:dc:65:f4:
- 7f:91:17:38:2d:d6:cd:4e:8d:53:52:97:6e:87:fc:
- 64:60:a6:a1:00:ac:96:6c:e4:42:94:75:17:46:6f:
- 91:b5:dd:06:47:ed:05:e3:db
+ Public-Key: (8192 bit)
+ Modulus:
+ 00:e6:24:79:3d:3a:58:6a:12:1c:13:6a:43:d9:c1:
+ 65:ec:55:c1:4f:7d:fc:f2:a6:56:a5:ab:c5:48:2c:
+ ce:9c:9d:47:3d:94:93:d5:3b:a3:d0:09:a8:8f:e0:
+ 4b:36:a0:95:ae:2d:ad:7f:a2:a3:c5:f6:87:80:4c:
+ 6a:26:15:47:73:20:47:e1:f8:5f:49:b7:13:20:f7:
+ 32:9f:db:7d:62:41:1b:60:26:7b:41:26:16:0c:92:
+ 22:ef:b4:2e:b3:db:90:e9:09:ca:fe:1a:1b:e4:f3:
+ 78:69:7d:ca:6e:c5:39:4b:46:72:09:51:08:40:78:
+ 8e:04:2a:23:cb:d5:50:cf:96:dd:56:43:10:1b:d2:
+ 71:28:8f:10:a9:e4:44:1c:39:8a:06:a7:fa:37:48:
+ bd:5a:dd:37:7f:7a:00:cf:84:8a:48:a3:75:a5:67:
+ fb:7b:47:2d:26:00:2e:65:ed:63:4e:b7:94:18:3f:
+ 5a:08:74:54:e5:af:dd:86:1b:34:9b:4c:de:fe:d8:
+ 69:3d:72:90:c7:5c:83:82:78:ea:ab:06:d4:f1:06:
+ 20:ad:fd:24:bb:e9:94:e0:c6:32:f5:df:af:b4:14:
+ 4d:9c:ce:0d:62:3a:3a:2b:11:f9:9e:d7:8e:63:2b:
+ 57:35:10:7e:d5:44:64:8c:61:9b:4e:f8:e8:a5:fb:
+ 47:bb:85:33:ea:c6:e0:3d:e2:2c:e8:41:e1:15:e2:
+ a7:45:23:df:d0:f9:93:01:97:89:95:77:4d:d5:d4:
+ c1:db:61:ca:e2:84:36:9c:01:9b:33:ec:53:83:2f:
+ dd:d7:d8:20:c0:6b:4a:73:92:d2:6c:22:a6:a2:68:
+ 46:8b:aa:3f:aa:fe:47:b7:98:70:fd:ba:59:88:af:
+ 9f:0d:d7:cb:a0:42:44:f9:f0:54:39:c1:cd:fb:b4:
+ e4:c6:d6:7e:1d:f5:ed:b9:1a:0f:d7:e6:a2:ab:a2:
+ 25:1f:6c:f9:ab:9c:d8:a3:b9:da:32:72:51:6d:61:
+ f1:3b:7d:06:2b:3d:43:d5:52:1f:cb:62:14:53:69:
+ 4d:91:12:22:f0:55:f9:fc:4f:de:ee:e3:fc:fd:40:
+ 57:50:eb:0e:7a:45:cc:52:0f:24:6f:45:02:72:6b:
+ 6d:90:94:1c:d4:fb:34:f6:4b:4d:25:17:6f:df:4a:
+ 64:f8:ad:1e:6e:df:ad:6c:b3:1d:1a:e6:0e:59:7b:
+ f8:a7:13:77:78:85:bf:3f:7c:12:d4:8e:34:ff:01:
+ 90:03:42:85:60:e4:99:d6:19:32:46:41:e8:50:ca:
+ 2a:03:61:cd:c5:68:f4:92:0f:6e:48:89:41:9e:53:
+ bc:41:62:ed:4a:92:64:b5:cb:3d:55:6c:d9:87:87:
+ 9a:ab:fc:22:50:66:92:2b:b9:d7:9e:3b:ed:80:e3:
+ fa:19:69:38:87:b6:25:3a:db:b5:d0:f2:80:4d:af:
+ 6d:7d:92:90:de:aa:df:be:80:26:1c:69:ee:7a:e3:
+ 45:c9:a4:4e:6a:e0:56:5f:1f:61:44:3f:62:34:c9:
+ 1e:21:5f:f6:7f:68:c0:6e:bf:d2:35:1e:53:99:e4:
+ e1:bd:64:a4:49:3c:c3:ce:b6:e8:a9:3d:27:54:ea:
+ f1:3e:a1:fc:7b:bf:8d:71:60:90:c5:66:24:85:de:
+ 7d:47:1f:62:83:e2:63:8e:10:5c:14:cd:d0:7e:86:
+ 44:4d:df:05:10:43:b8:3c:87:64:69:ec:ea:fb:49:
+ 9a:c6:76:c1:8f:ea:49:98:0a:d3:97:af:64:ef:da:
+ 5f:a9:57:03:e3:a0:15:d8:68:c5:40:d8:7b:0f:26:
+ 0d:5f:f0:be:5a:4c:fd:af:9e:bf:2d:31:40:71:25:
+ de:d0:73:19:2d:ae:a6:cb:7c:f0:b8:a4:a9:5c:50:
+ 80:41:4e:dc:f7:20:a4:a6:66:65:fb:92:d1:43:2d:
+ bf:30:b2:0d:db:9b:a3:ac:28:08:c4:81:99:0c:0d:
+ 45:e9:a9:e5:6c:da:bf:10:bb:a7:3e:5a:5f:b7:93:
+ 4a:20:15:29:69:74:78:d1:eb:53:a8:88:49:cb:de:
+ 0c:e2:9b:31:e2:2f:56:95:cf:55:92:a3:8e:a9:ef:
+ 68:cb:00:11:d4:71:06:4b:e5:89:0c:b6:e7:2b:2f:
+ 98:65:21:8e:2a:a3:86:73:bb:1b:76:e1:94:02:d8:
+ a1:51:97:15:60:a2:39:d5:fd:dc:a8:be:30:12:44:
+ b1:49:0b:94:82:cf:5f:93:61:1c:3c:eb:05:5b:a4:
+ 17:ee:30:cd:7c:db:3f:ee:79:02:da:14:20:98:fd:
+ 9a:0a:f1:39:c8:59:5b:4e:a3:ad:f8:04:e6:0b:b6:
+ 81:7e:41:00:af:f7:37:ec:6e:bc:28:a3:3d:76:b6:
+ fd:e9:88:c7:1e:78:79:27:62:a2:83:34:15:61:b8:
+ e4:c3:ac:f5:7f:3e:4e:5f:5f:31:5b:e8:91:1b:80:
+ 5e:cb:74:b2:e5:a3:8a:d5:5a:89:fa:63:f1:ff:67:
+ bd:59:d0:70:77:b7:75:b5:34:74:3d:2e:99:46:0b:
+ 4b:c4:64:2f:93:48:fe:47:92:6a:0b:42:5e:ef:c9:
+ 06:64:84:60:89:2b:84:1f:31:0d:36:15:4e:6b:cd:
+ 14:f7:a0:d1:b2:b8:ff:53:f5:aa:b9:ed:63:50:7a:
+ 6f:62:e7:c7:7f:bc:f5:e2:0c:f8:28:a4:0d:ba:75:
+ d0:b8:c7:9b:e3:94:62:66:1c:d8:6c:02:2e:a5:a2:
+ 62:50:fe:cf:31
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Basic Constraints:
CA:FALSE
+ Netscape Comment:
+ OpenSSL Generated Certificate
X509v3 Subject Key Identifier:
- 6E:60:3F:29:13:60:99:ED:0C:F7:15:B5:DB:7B:1C:FB:6F:60:19:ED
+ B3:A9:00:04:C7:9C:2B:CD:C0:5F:D1:28:5C:5C:C6:1F:26:F7:17:5A
X509v3 Authority Key Identifier:
- keyid:B1:FB:7E:77:B5:40:8D:68:11:7E:D9:11:E5:C3:C6:DA:4D:AC:51:B0
- DirName:/C=SE/ST=Uppsala/L=Uppsala/O=MySQL AB
- serial:BE:58:AD:4C:1F:3D:25:95
+ keyid:C7:2C:01:95:1A:F5:3E:CD:04:A6:24:35:35:04:D9:A7:16:01:2A:79
Signature Algorithm: sha1WithRSAEncryption
- 63:2e:0f:07:14:06:cf:74:90:3d:37:42:f2:48:70:60:21:bc:
- 34:52:31:f1:87:70:d2:b2:fb:ff:13:38:dc:f0:5e:43:d7:ee:
- a7:c7:1f:ac:aa:d2:8c:4f:fa:3c:4c:73:f6:b6:c2:0c:a0:ea:
- a2:c9:e2:73:61:c3:2e:78:40:0f:2a:d3:63:50:9b:b8:f9:89:
- 40:ed:98:08:97:c3:07:24:17:34:b5:78:89:0a:bb:83:4c:e2:
- 5c:2e:13:d6:21:30:ad:30:48:b5:70:12:ff:4a:6f:42:f0:f8:
- 9f:b1:4b:bd:89:2b:f0:9d:e2:49:2b:35:69:18:1f:76:40:b4:
- 76:bd:cb:dd:27:2f:c0:c1:e2:33:3e:6e:df:68:54:19:92:8a:
- bb:13:9c:cf:d6:17:56:da:bf:0d:64:70:3a:45:b7:aa:5f:e3:
- f5:96:ae:34:f2:17:37:27:d0:4b:e8:30:4a:c0:02:42:e2:d2:
- 30:eb:eb:c7:d7:ec:d8:df:5c:43:58:e2:6f:b7:58:54:0d:c4:
- 01:71:2d:59:8f:44:c7:a1:6c:0b:41:28:fa:b7:63:a7:68:d3:
- 4f:c3:0f:17:9e:b2:32:50:e6:0b:87:3d:e2:39:47:c0:d8:0a:
- 3b:f6:af:50:68:0f:9d:ef:6e:34:0d:3a:07:94:f8:a4:d7:24:
- 86:32:d3:b4
+ 01:43:2c:d5:1d:b5:36:05:31:ca:b2:f3:9e:71:ce:62:fe:b2:
+ e5:e3:2d:30:23:99:51:3d:50:ee:d6:ce:76:e8:43:8d:5d:9d:
+ 28:9b:43:90:0c:d4:24:54:3c:53:3c:18:92:ec:93:86:87:7a:
+ d6:7f:5d:3b:56:cd:9d:96:7a:06:c8:16:19:8b:ed:c8:21:cf:
+ 15:b9:fb:06:7d:cb:5c:46:9c:c5:2e:8e:de:77:21:e5:9d:35:
+ 95:00:c7:ad:d2:57:36:65:1a:43:6c:ee:75:ad:a2:d8:c0:60:
+ d5:07:d7:5c:5d:8e:ae:af:4a:e6:fa:6a:13:78:98:b8:11:c7:
+ dc:d2:a7:dd:29:b5:76:fa:ef:13:62:5f:9a:0d:e2:87:6a:04:
+ 3c:5f:72:44:d0:d0:7a:70:c6:09:2b:bf:92:91:6d:f4:2e:53:
+ f3:b4:c5:23:61:d6:87:c1:30:ef:fe:92:6f:97:78:f2:ea:3c:
+ ff:e8:54:3a:9f:49:ac:a9:2b:46:c3:76:b1:f9:eb:31:a3:4f:
+ 40:58:16:90:77:b6:3d:6f:85:95:12:a9:ca:70:0a:9a:cd:61:
+ 46:27:84:ce:9e:33:54:8f:9a:41:6d:4d:11:bd:14:7f:ff:32:
+ e9:06:bc:36:38:11:5c:0f:e9:a5:5a:0f:5c:7c:fa:f5:73:5b:
+ 4c:47:f2:f2
-----BEGIN CERTIFICATE-----
-MIIDIjCCAgqgAwIBAgIBBTANBgkqhkiG9w0BAQUFADBEMQswCQYDVQQGEwJTRTEQ
-MA4GA1UECBMHVXBwc2FsYTEQMA4GA1UEBxMHVXBwc2FsYTERMA8GA1UEChMITXlT
-UUwgQUIwHhcNMTAwMjIwMDMwMDU0WhcNMzAwOTAzMDMwMDU0WjBDMQswCQYDVQQG
-EwJTRTEQMA4GA1UECBMHVXBwc2FsYTERMA8GA1UEChMITXlTUUwgQUIxDzANBgNV
-BAMTBnNlcnZlcjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAxdpElQZ3FiGv
-oMQ86fgdLZX5Y5CMP4a6d3ZKUktrryn1HKrUPz5Cn21GuoaQsS3M28YzFaP0r1Mz
-T6FW0ao7JhD3ZLX5vxuxR47MptYNqkp346NjnSrcZfR/kRc4LdbNTo1TUpduh/xk
-YKahAKyWbORClHUXRm+Rtd0GR+0F49sCAwEAAaOBozCBoDAJBgNVHRMEAjAAMB0G
-A1UdDgQWBBRuYD8pE2CZ7Qz3FbXbexz7b2AZ7TB0BgNVHSMEbTBrgBSx+353tUCN
-aBF+2RHlw8baTaxRsKFIpEYwRDELMAkGA1UEBhMCU0UxEDAOBgNVBAgTB1VwcHNh
-bGExEDAOBgNVBAcTB1VwcHNhbGExETAPBgNVBAoTCE15U1FMIEFCggkAvlitTB89
-JZUwDQYJKoZIhvcNAQEFBQADggEBAGMuDwcUBs90kD03QvJIcGAhvDRSMfGHcNKy
-+/8TONzwXkPX7qfHH6yq0oxP+jxMc/a2wgyg6qLJ4nNhwy54QA8q02NQm7j5iUDt
-mAiXwwckFzS1eIkKu4NM4lwuE9YhMK0wSLVwEv9Kb0Lw+J+xS72JK/Cd4kkrNWkY
-H3ZAtHa9y90nL8DB4jM+bt9oVBmSirsTnM/WF1bavw1kcDpFt6pf4/WWrjTyFzcn
-0EvoMErAAkLi0jDr68fX7NjfXENY4m+3WFQNxAFxLVmPRMehbAtBKPq3Y6do00/D
-DxeesjJQ5guHPeI5R8DYCjv2r1BoD53vbjQNOgeU+KTXJIYy07Q=
+MIIGpDCCBYygAwIBAgIBAjANBgkqhkiG9w0BAQUFADBWMQ8wDQYDVQQDDAZjYWNl
+cnQxCzAJBgNVBAYTAkZJMREwDwYDVQQIDAhIZWxzaW5raTERMA8GA1UEBwwISGVs
+c2lua2kxEDAOBgNVBAoMB01hcmlhREIwHhcNMTUwNDI1MTQ1NTE2WhcNMzUwNDIw
+MTQ1NTE2WjBYMQswCQYDVQQGEwJGSTERMA8GA1UECAwISGVsc2lua2kxETAPBgNV
+BAcMCEhlbHNpbmtpMRAwDgYDVQQKDAdNYXJpYURCMREwDwYDVQQDDAhzZXJ2ZXI4
+azCCBCIwDQYJKoZIhvcNAQEBBQADggQPADCCBAoCggQBAOYkeT06WGoSHBNqQ9nB
+ZexVwU99/PKmVqWrxUgszpydRz2Uk9U7o9AJqI/gSzagla4trX+io8X2h4BMaiYV
+R3MgR+H4X0m3EyD3Mp/bfWJBG2Ame0EmFgySIu+0LrPbkOkJyv4aG+TzeGl9ym7F
+OUtGcglRCEB4jgQqI8vVUM+W3VZDEBvScSiPEKnkRBw5igan+jdIvVrdN396AM+E
+ikijdaVn+3tHLSYALmXtY063lBg/Wgh0VOWv3YYbNJtM3v7YaT1ykMdcg4J46qsG
+1PEGIK39JLvplODGMvXfr7QUTZzODWI6OisR+Z7XjmMrVzUQftVEZIxhm0746KX7
+R7uFM+rG4D3iLOhB4RXip0Uj39D5kwGXiZV3TdXUwdthyuKENpwBmzPsU4Mv3dfY
+IMBrSnOS0mwipqJoRouqP6r+R7eYcP26WYivnw3Xy6BCRPnwVDnBzfu05MbWfh31
+7bkaD9fmoquiJR9s+auc2KO52jJyUW1h8Tt9Bis9Q9VSH8tiFFNpTZESIvBV+fxP
+3u7j/P1AV1DrDnpFzFIPJG9FAnJrbZCUHNT7NPZLTSUXb99KZPitHm7frWyzHRrm
+Dll7+KcTd3iFvz98EtSONP8BkANChWDkmdYZMkZB6FDKKgNhzcVo9JIPbkiJQZ5T
+vEFi7UqSZLXLPVVs2YeHmqv8IlBmkiu515477YDj+hlpOIe2JTrbtdDygE2vbX2S
+kN6q376AJhxp7nrjRcmkTmrgVl8fYUQ/YjTJHiFf9n9owG6/0jUeU5nk4b1kpEk8
+w8626Kk9J1Tq8T6h/Hu/jXFgkMVmJIXefUcfYoPiY44QXBTN0H6GRE3fBRBDuDyH
+ZGns6vtJmsZ2wY/qSZgK05evZO/aX6lXA+OgFdhoxUDYew8mDV/wvlpM/a+evy0x
+QHEl3tBzGS2upst88LikqVxQgEFO3PcgpKZmZfuS0UMtvzCyDdubo6woCMSBmQwN
+Remp5WzavxC7pz5aX7eTSiAVKWl0eNHrU6iIScveDOKbMeIvVpXPVZKjjqnvaMsA
+EdRxBkvliQy25ysvmGUhjiqjhnO7G3bhlALYoVGXFWCiOdX93Ki+MBJEsUkLlILP
+X5NhHDzrBVukF+4wzXzbP+55AtoUIJj9mgrxOchZW06jrfgE5gu2gX5BAK/3N+xu
+vCijPXa2/emIxx54eSdiooM0FWG45MOs9X8+Tl9fMVvokRuAXst0suWjitVaifpj
+8f9nvVnQcHe3dbU0dD0umUYLS8RkL5NI/keSagtCXu/JBmSEYIkrhB8xDTYVTmvN
+FPeg0bK4/1P1qrntY1B6b2Lnx3+89eIM+CikDbp10LjHm+OUYmYc2GwCLqWiYlD+
+zzECAwEAAaN7MHkwCQYDVR0TBAIwADAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBH
+ZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFLOpAATHnCvNwF/RKFxcxh8m
+9xdaMB8GA1UdIwQYMBaAFMcsAZUa9T7NBKYkNTUE2acWASp5MA0GCSqGSIb3DQEB
+BQUAA4IBAQABQyzVHbU2BTHKsvOecc5i/rLl4y0wI5lRPVDu1s526EONXZ0om0OQ
+DNQkVDxTPBiS7JOGh3rWf107Vs2dlnoGyBYZi+3IIc8VufsGfctcRpzFLo7edyHl
+nTWVAMet0lc2ZRpDbO51raLYwGDVB9dcXY6ur0rm+moTeJi4Ecfc0qfdKbV2+u8T
+Yl+aDeKHagQ8X3JE0NB6cMYJK7+SkW30LlPztMUjYdaHwTDv/pJvl3jy6jz/6FQ6
+n0msqStGw3ax+esxo09AWBaQd7Y9b4WVEqnKcAqazWFGJ4TOnjNUj5pBbU0RvRR/
+/zLpBrw2OBFcD+mlWg9cfPr1c1tMR/Ly
-----END CERTIFICATE-----
diff --git a/mysql-test/std_data/server8k-key.pem b/mysql-test/std_data/server8k-key.pem
index d3c3ec5baba..72d2756477c 100644
--- a/mysql-test/std_data/server8k-key.pem
+++ b/mysql-test/std_data/server8k-key.pem
@@ -1,15 +1,99 @@
-----BEGIN RSA PRIVATE KEY-----
-MIICXgIBAAKBgQDF2kSVBncWIa+gxDzp+B0tlfljkIw/hrp3dkpSS2uvKfUcqtQ/
-PkKfbUa6hpCxLczbxjMVo/SvUzNPoVbRqjsmEPdktfm/G7FHjsym1g2qSnfjo2Od
-Ktxl9H+RFzgt1s1OjVNSl26H/GRgpqEArJZs5EKUdRdGb5G13QZH7QXj2wIDAQAB
-AoGBAJLCjh7Q9eLnx+QDzH9s+Q/IcH4nSbERmh1lFEopAc6j29qQ6PGkmDy0DUPs
-70VOCOh5A4mo3aZzm9sUfVb24/nRtmyTP/AtMuIVGCsUqzI28dJRGvRlY0aSQG/C
-ILqMP69kiMNGBvuyEIiJhisOmMvDFEp7HrrXHJM9qcc217DpAkEA4nzJ9yyy2e4O
-r6/D711hdfcU/F+ktXw+pL77kSSdTABUap92Uv2RL36UA4q5h8RNvq/GrzMNm6Ye
-u2IMvBCiTQJBAN+iRbiMJCSitTg5YVMluVbT87co7jbTqk7LN1ujyIFEklm4xlHG
-DLJNgEoDR7QJtAkL++FyogC4zsQsey5voscCQQCp54trTbDuI9QIoAaQrrDKWgz4
-NpfNPeOQm2UFQT5vIWAyjGWrZGViB8bp0UvVOcJI5nxaOiZfOYOcdrWu75uRAkAn
-67zMc9/j1lPJRJz2Dc7nDBD+ikTz7pcBV897AWLCiK4jbBOi91q+3YzgKXO8VNsZ
-nlUJasA2psbqSBJ5OJ5zAkEA2UxoMju54hASjT54Z92IzraVw4Vo8CYwOcw5fr7z
-+m5xg1mmWdLBclmZ+WjARzDuTHIW6u/WCxNGg42AykWzfw==
+MIISKgIBAAKCBAEA5iR5PTpYahIcE2pD2cFl7FXBT3388qZWpavFSCzOnJ1HPZST
+1Tuj0Amoj+BLNqCVri2tf6KjxfaHgExqJhVHcyBH4fhfSbcTIPcyn9t9YkEbYCZ7
+QSYWDJIi77Qus9uQ6QnK/hob5PN4aX3KbsU5S0ZyCVEIQHiOBCojy9VQz5bdVkMQ
+G9JxKI8QqeREHDmKBqf6N0i9Wt03f3oAz4SKSKN1pWf7e0ctJgAuZe1jTreUGD9a
+CHRU5a/dhhs0m0ze/thpPXKQx1yDgnjqqwbU8QYgrf0ku+mU4MYy9d+vtBRNnM4N
+Yjo6KxH5nteOYytXNRB+1URkjGGbTvjopftHu4Uz6sbgPeIs6EHhFeKnRSPf0PmT
+AZeJlXdN1dTB22HK4oQ2nAGbM+xTgy/d19ggwGtKc5LSbCKmomhGi6o/qv5Ht5hw
+/bpZiK+fDdfLoEJE+fBUOcHN+7TkxtZ+HfXtuRoP1+aiq6IlH2z5q5zYo7naMnJR
+bWHxO30GKz1D1VIfy2IUU2lNkRIi8FX5/E/e7uP8/UBXUOsOekXMUg8kb0UCcmtt
+kJQc1Ps09ktNJRdv30pk+K0ebt+tbLMdGuYOWXv4pxN3eIW/P3wS1I40/wGQA0KF
+YOSZ1hkyRkHoUMoqA2HNxWj0kg9uSIlBnlO8QWLtSpJktcs9VWzZh4eaq/wiUGaS
+K7nXnjvtgOP6GWk4h7YlOtu10PKATa9tfZKQ3qrfvoAmHGnueuNFyaROauBWXx9h
+RD9iNMkeIV/2f2jAbr/SNR5TmeThvWSkSTzDzrboqT0nVOrxPqH8e7+NcWCQxWYk
+hd59Rx9ig+JjjhBcFM3QfoZETd8FEEO4PIdkaezq+0maxnbBj+pJmArTl69k79pf
+qVcD46AV2GjFQNh7DyYNX/C+Wkz9r56/LTFAcSXe0HMZLa6my3zwuKSpXFCAQU7c
+9yCkpmZl+5LRQy2/MLIN25ujrCgIxIGZDA1F6anlbNq/ELunPlpft5NKIBUpaXR4
+0etTqIhJy94M4psx4i9Wlc9VkqOOqe9oywAR1HEGS+WJDLbnKy+YZSGOKqOGc7sb
+duGUAtihUZcVYKI51f3cqL4wEkSxSQuUgs9fk2EcPOsFW6QX7jDNfNs/7nkC2hQg
+mP2aCvE5yFlbTqOt+ATmC7aBfkEAr/c37G68KKM9drb96YjHHnh5J2KigzQVYbjk
+w6z1fz5OX18xW+iRG4Bey3Sy5aOK1VqJ+mPx/2e9WdBwd7d1tTR0PS6ZRgtLxGQv
+k0j+R5JqC0Je78kGZIRgiSuEHzENNhVOa80U96DRsrj/U/Wque1jUHpvYufHf7z1
+4gz4KKQNunXQuMeb45RiZhzYbAIupaJiUP7PMQIDAQABAoIEAQDdg63OaSJAtj2f
+0mCMb8ISwFfYk4Osar5rp/Gzjq0vwZKYizHfxA/gZeuA0HqUkeyAQicE+x53pNq3
+etWQ4lprTV7i+ZV99mDLEiQACdudft1Cpsdr5aTDZMWLwvpQ072fEHX6Llc6/72e
+jB0UkXCcK6oHnZ87rs3C5Gyf/SpTJPrV1KbkoKGaUFnRrIyCPj/EOFp2a+UWWGba
+pCuzkfcoA21xT6yW8+NY+EOwh9VWJwy8af3WtWIh0ix+sCDqegsJcHObWXJQ8ZMD
+Oi9lfqXnd+ZskYOR+zn5P8w9LJiJ1CEAFLR9H15tpleFtCSw/z5pLP9ndvTwyeIb
+GSmU2VAqBgP6roGYDuL6iq6Dyi0GN4luM0pz9c/PtY2Ni8MrzeziKjAF6OXiDE41
+rxTwdG7RxnNa2q7+tjt9hrCgLbYqd6W/6VKYZY1YKvIE+PhdwGtzxwbKsOf6phqt
+6DZr0BKIX7VwMeXRHbhtjw6hR86diH2koLQPfH4crDIL3GQ2J13C/RxjTLAEOli2
+y4paeOYzOe6ANDXXBOhieFw5f6mqD9pTF2PWDTnTJhfMGJ6gXPapDYoycS8huNnM
+DnqtMVIOf2zOI8aSkumJyXq2bEpGSNK80IJgyKfpk0b4qOdbG7tklfbhVCxTida0
+qqgmJKLGrNmJNW8KLB1U4/hcowEVFz8MF0OZAnByDHi2axwSRSGD5aG2yhCfs3Sy
+C269M25v0WuTeOs02RnHUvLPIhvbOEVTu6AjvAtYIfjEq+xqrjbZqUqJeh/xo2tF
+SohWe5aQs5DntsMCkZWlqlXc4CCaCqVACegh5Rn+8JbpZvpzy4HUtThfVbB45a5P
+6uRAsoxiIHbPLyIaKHFqqfog98hzD4TZYKpfb4RCgqKgEAHGKh4/KPM9O4iw67Oj
+EnT2WduegazemzOxQIuZ1UcNu/2d7uy8v/zPGLEUfqhFLS8PMStEuLdQQZfU2DFM
+rHJZsH3UtgSreZuQnlTHYy073UhB44mhcYbwa03jMkLHb1bt9q9l8ZAZ5FjstKJD
+vN5hMqT5LBQtvArCB+aIVDQxEyZiqFxBlW658uAIhCkLXNB5BVfEUEB8w5vZXOPn
+UpNyM8v0dYOkiSOH6+Kk0i7eC8CSrSQAaLnuFZxepGCGMFksywMv7mDg6yX1sAkE
+RMakKaAaZ55QpUv1/heaBVK0xmwpjJBefAoMCyFh/I+o7BkFdWGsGF2Tc5ZxZB3F
+DF75An4WV2qFMNEIb2SGBBUHGoG75C7tRC9ll39SqX7X2pXMaHvJvEx76CmhC9ub
+TzkRDV0Zi/GqiBQXz5kn4AP3GCuJUQJIvK2l0HPqbqNULrhahwQWBOpIek/SLBFV
+3fRQc5ABAoICAQDzqaS5/JEKUGMzVikWYnxl6fXgMp/l3Hq2DyifRqgYVoSr/wOJ
+PTOOJrtuvwHK6kbOv4YRfKwgVWlJgoAP9Tz0GGpE7toSk3biHY4tTF4KR3xIIOnI
+LQLNDR0LDrJSjQhAH5z8U/E+dpOCBHLfXodZ0/ZuXx9YS/pNDQBW/+HOmDtCfqpb
+kLmxjZcvZnAZyrlSjGrHJoPjiFrVA/1xvY68TNWHWu8EXphKO/aBi5/e4wWS7I8q
+0lDjjPB3GIm0rhumowoGYDPtchcTIvip9aGSPsw56elV+PiwbZaPHZXwHeI0Q25j
+UAdkmkwO4VaYGeR4JSUTjoOwWdXXediRq9SKRwhOoat3GJdDwYByYgZb8MKdQCZV
+H9hD0rEF4JOrUnOsCteXMNEczQocfSxduLD7XLie+oXoEggNE/hD9EJ397sOvyUg
+rgmJLBPCbIPdnfCwm9rdLMsWUjvd4JFq1dyQ9QM1LkdOGQdSoUixtN8X75BdkWhL
+/LUqVV/L5/1DStYniO6k4ry67u4POisAZa4czPAJrBEOakVxkCIoaH+mZ/J3GxWc
+DvnV6myvcNXUEENhfMt2mikP5zcPthq1O1nm7RFqiow4s/f0jc6Epr/LToXwhm8j
+5ch0TkcM+ioguCyYXWEzRJUt3GBWpHoSvxqKLxaWbo1mtxHpGxHDIIFAoQKCAgEA
+8cuU0H0OE3JJaG+9Hp6q5mJfdrAzeIPTCT1jxVDptZaplMVo8X0+LIKYpzWqbGWa
+Z3cTmReOZBukuKPKXuZEufYqzwIh7lEv1ls2SJ8Gedf3Dq3C2fCITHzXlsg58mrf
+tD6cKE85EmI/GhXtaBc51Qa60w5MyXfzK3EPi8lD1v5Il5K1MG6sv+7+P1LgAQVj
+c9mPVT1WmgBFVG2/syJ9L94smwhrtM2NhxMkMtEBrOiv0Wy0bEb1wIo5ndBGBoeF
+KXBfz87HDbUCSxItDFZ5mDk2ARnzl/13+wr81aKcxW2LyQ0eiiN+HczmM1xpavU6
+KI/QnIvUNqW9XRSNpz/w+DO9+gs9BPIODMww4KpLVtgFfy5KYre1/MpgZHVlHDCI
+r72WaDFHdMs75JN1rPNnYx81LtKp0JnE2bIDda3qlCKTBtwaFEUg1F0v9NK9yiZF
+JytwUUIfURayT34hfDAJDaSemWT3b4U2kYBr7Fp+g6R5iAosx/TnCYxtuGhdSLA7
+JkL4gy6Ll6hQkIyxRxC6R38wzwUFg4pbV6qrhjP1qyuU1BsZrBSV1RSbcHghSAZj
+UmT/sCKOhnliptnnz3e6ceP8I9Y2/TOeJXPdH6zvfaTpnVLiZC48FBKnXFCM4SaS
+v5qejQChBBOyd9ybO40sxC/Db8WsPa1LCMnHzm9YtJECggIBAOitGIYZ7o7A0NnW
+7wlXJp9TWN2suhAQCIYN16axHBeRlsN/k2rcLH0T82v/rcCNEuye63GLcfq2VQJD
+QfL7JieZoPEOfOO8OYwW2QvcnviF5uIhu9zRTplsak2CzToTPsus5IX3yqjxJk7D
+3MX8SJe41tvyrcXtV6l4PtjVJFXZ/My0lA04GHq6UKKM2YNnmKyBNf3Sg6MlNEex
+tbWFY+XgIQ9OAGxVwGsy82QlZpa6hzoT92rWxzNkBMRVhDorAHCRxCLufufBSNOX
+U4lI6+7xVKgA/DaCt0gSffFQOTu/7aAmvCTN6SFiTjrvZ3d7UjaAkfUo5Avk3VUU
+H4CLazxYNFCSBWCG9PtYrkWL4bKuJ8lt1qz26ddqPGz2VU0GQTsKZ3ESxr0P9xXZ
+WiJtGWQO2KXHaVOA1HtYlHyfpVFWGSQt11BroOOCWaQRZ6KbDZo4WjlWauB3yn9H
+0NUKP8OUlGmWNbUYJWv8Y6R+qYL72wnero/RU1aHjCD0+V3m+rVqBykg80Q2oNGd
+pC6O6kLKWHWEAA2Z4ZJeJqAbmbnYDSs7i9koW96wKvUldKs6lH1lZA1vjMKI8oVo
+SfzCHklsHHN2tgv3n1HCkHEPopqL808JsNvAsziM/0AfK1dvR/Z/RTBlz2apyL0z
+9vYr0zYdXR5tl018h/fnR4Dja0nBAoICAG7z5Ui6adAgnHDQ/W5kjrWDJJ05A5Vk
+oF1YD0VG+Md76Ds9TwepWfNgxh3McXSmNvENYi/Y8F0dljun5UAg2B6hSEmPh/Rs
+ys/JMSKn3nfg0xyoPYZ2aoT2sJMfM//6bMawCEYy/FRkQuJ8d2FRbxdCrE4W/MNi
+SHKBwgl6BKhOLQ9oob4kux6j04VJSUMOrvFFPxF1QR0PzMCOT+4qgFmL0NofRhVE
+UZJPBUhQQj2O1Mb749rfwPtmMkQpg0iRvVgjmcOo9gxjKDc8kvFbaRaiAhcFSpNP
+G1RWWWjK4rdxqjhKzd3DpaaVFHkzCair+NEOFUMQowOkkD17Jfk+TRwH2kA4EfsH
++8yBklg1rLagD/2pRzb/aAIk95CBkjEaUE6cZ71OB6UfcU9VHyWK18FTW7strgDr
+3rmqhw3kDYWGTANU0p7EjekFDfGBFtgBMbBkrXiMKAS0roPts/3hqPXauXBYNXa2
+ITEpRdzCNdXAjogPazciOTZXey2ork2hmLLY/mJr5GBmOvnppZufoGsYgVQt0Lbo
+sTuMNIMzqqKuL/AYs3IUTCDoAN/eMB911vPDJtUzNkWcw9kemtHH9gU3AceMD9Wm
+bwZuoWRcndUA7LZlhz9DPAxV9vhUeiEC60oC8IhxZnGRfE6mK5FrGcS4yiyq/3uZ
+3pmcxhQDYigRAoICAQCzK0SUG9tSzwpyuEb7hbS7isT0XOnVvLDEXL2jTwVqbN8a
+pC9jebbzJgxk5EA+np/eZlRU7h4aZjRhtDwi4HsarXzgIni6z1vswAiOSZRCfC17
+8/tjfER9w3pJMRTJ5MFeN7JvNUhWnXY5fX6SBl/Eocwwy8S/eIWUY53aI2k8UZMR
+eLUb9I6eL21qZAPp/XD8/3pF5DH0ECOS96C8mDKTGnARUyfkKrlaASSTfe5XToNb
+IpDEYtLwpHN0missq+ObqPc5lwot/nBy2fdllksb3mCCK8AxuKEDsVtWbb2maoa9
+lRGxIxr++ZV8n0dAwGCV18CbhBYh/B2YnrexI2ZfYOQbzPjHiuUgSLGBJvIUX+S+
+O8ij0vQBqECfwCq63SrdW340Huob52d/cod9pNolO5edftPNJVJP+44sZtEJoDBW
+WgzdpVV9fA8TYsO6B3Dci960fbpWnKZ01uLFWVTkou8IwqcaxJIyMzS3Gmqo4UEF
+oxBSrg9rTAMJSnm2YWBHK1Z8DDlLzw3SkNZVKm6Ai4yEcLs1PzGZejsJvsu3zGgq
+nM4liRHK2QqY1SJf6PsJGxAI62tlyTRfjxtC3Jq9oJbmJs+jl0gtNKEbkfQc83IL
+8wCHOm9G7KK7XJjMCb50Dh80YIDFj5GTQLU1tKdpDBfq6YTKUHqjPA8GRnz8vA==
-----END RSA PRIVATE KEY-----
diff --git a/mysql-test/suite/binlog/r/binlog_commit_wait.result b/mysql-test/suite/binlog/r/binlog_commit_wait.result
new file mode 100644
index 00000000000..07019c12905
--- /dev/null
+++ b/mysql-test/suite/binlog/r/binlog_commit_wait.result
@@ -0,0 +1,155 @@
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
+CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
+SET @old_count= @@GLOBAL.binlog_commit_wait_count;
+SET GLOBAL binlog_commit_wait_count= 3;
+SET @old_usec= @@GLOBAL.binlog_commit_wait_usec;
+SET GLOBAL binlog_commit_wait_usec= 20000000;
+SELECT variable_value INTO @group_commits FROM information_schema.global_status
+WHERE variable_name = 'binlog_group_commits';
+SELECT variable_value INTO @group_commit_trigger_count FROM information_schema.global_status
+WHERE variable_name = 'binlog_group_commit_trigger_count';
+SELECT variable_value INTO @group_commit_trigger_timeout FROM information_schema.global_status
+WHERE variable_name = 'binlog_group_commit_trigger_timeout';
+SELECT variable_value INTO @group_commit_trigger_lock_wait FROM information_schema.global_status
+WHERE variable_name = 'binlog_group_commit_trigger_lock_wait';
+SET @a= current_timestamp();
+BEGIN;
+INSERT INTO t1 VALUES (1,0);
+COMMIT;
+INSERT INTO t1 VALUES (1,1);
+SET @b= unix_timestamp(current_timestamp()) - unix_timestamp(@a);
+SELECT IF(@b < 20, "Ok", CONCAT("Error: too much time elapsed: ", @b, " seconds >= 20"));
+IF(@b < 20, "Ok", CONCAT("Error: too much time elapsed: ", @b, " seconds >= 20"))
+Ok
+SELECT variable_value - @group_commits FROM information_schema.global_status
+WHERE variable_name = 'binlog_group_commits';
+variable_value - @group_commits
+1
+SELECT variable_value - @group_commit_trigger_count FROM information_schema.global_status
+WHERE variable_name = 'binlog_group_commit_trigger_count';
+variable_value - @group_commit_trigger_count
+0
+SELECT variable_value - @group_commit_trigger_timeout FROM information_schema.global_status
+WHERE variable_name = 'binlog_group_commit_trigger_timeout';
+variable_value - @group_commit_trigger_timeout
+0
+SELECT variable_value - @group_commit_trigger_lock_wait FROM information_schema.global_status
+WHERE variable_name = 'binlog_group_commit_trigger_lock_wait';
+variable_value - @group_commit_trigger_lock_wait
+1
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+SET @a= current_timestamp();
+INSERT INTO t1 VALUES (2,0);
+INSERT INTO t1 VALUES (3,0);
+INSERT INTO t1 VALUES (4,0);
+SET @b= unix_timestamp(current_timestamp()) - unix_timestamp(@a);
+SELECT IF(@b < 20, "Ok", CONCAT("Error: too much time elapsed: ", @b, " seconds >= 20"));
+IF(@b < 20, "Ok", CONCAT("Error: too much time elapsed: ", @b, " seconds >= 20"))
+Ok
+SELECT variable_value - @group_commits FROM information_schema.global_status
+WHERE variable_name = 'binlog_group_commits';
+variable_value - @group_commits
+2
+SELECT variable_value - @group_commit_trigger_count FROM information_schema.global_status
+WHERE variable_name = 'binlog_group_commit_trigger_count';
+variable_value - @group_commit_trigger_count
+1
+SELECT variable_value - @group_commit_trigger_timeout FROM information_schema.global_status
+WHERE variable_name = 'binlog_group_commit_trigger_timeout';
+variable_value - @group_commit_trigger_timeout
+0
+SELECT variable_value - @group_commit_trigger_lock_wait FROM information_schema.global_status
+WHERE variable_name = 'binlog_group_commit_trigger_lock_wait';
+variable_value - @group_commit_trigger_lock_wait
+1
+SET @a= current_timestamp();
+INSERT INTO t1 VALUES (6,0);
+BEGIN;
+UPDATE t1 SET b=b+1 WHERE a=1;
+UPDATE t1 SET b=b+10 WHERE a=1;
+SELECT SLEEP(0.25);
+SLEEP(0.25)
+0
+UPDATE t1 SET b=b+1 WHERE a=3;
+COMMIT;
+SET @b= unix_timestamp(current_timestamp()) - unix_timestamp(@a);
+SELECT IF(@b < 20, "Ok", CONCAT("Error: too much time elapsed: ", @b, " seconds >= 20"));
+IF(@b < 20, "Ok", CONCAT("Error: too much time elapsed: ", @b, " seconds >= 20"))
+Ok
+SELECT variable_value - @group_commits FROM information_schema.global_status
+WHERE variable_name = 'binlog_group_commits';
+variable_value - @group_commits
+3
+SELECT variable_value - @group_commit_trigger_count FROM information_schema.global_status
+WHERE variable_name = 'binlog_group_commit_trigger_count';
+variable_value - @group_commit_trigger_count
+1
+SELECT variable_value - @group_commit_trigger_timeout FROM information_schema.global_status
+WHERE variable_name = 'binlog_group_commit_trigger_timeout';
+variable_value - @group_commit_trigger_timeout
+0
+SELECT variable_value - @group_commit_trigger_lock_wait FROM information_schema.global_status
+WHERE variable_name = 'binlog_group_commit_trigger_lock_wait';
+variable_value - @group_commit_trigger_lock_wait
+2
+SET @a= current_timestamp();
+INSERT INTO t1 VALUES (7,0);
+INSERT INTO t1 VALUES (8,0);
+SET @b= unix_timestamp(current_timestamp()) - unix_timestamp(@a);
+SELECT IF(@b < 20, "Ok", CONCAT("Error: too much time elapsed: ", @b, " seconds >= 20"));
+IF(@b < 20, "Ok", CONCAT("Error: too much time elapsed: ", @b, " seconds >= 20"))
+Ok
+SELECT variable_value - @group_commits FROM information_schema.global_status
+WHERE variable_name = 'binlog_group_commits';
+variable_value - @group_commits
+4
+SELECT variable_value - @group_commit_trigger_count FROM information_schema.global_status
+WHERE variable_name = 'binlog_group_commit_trigger_count';
+variable_value - @group_commit_trigger_count
+2
+SELECT variable_value - @group_commit_trigger_timeout FROM information_schema.global_status
+WHERE variable_name = 'binlog_group_commit_trigger_timeout';
+variable_value - @group_commit_trigger_timeout
+0
+SELECT variable_value - @group_commit_trigger_lock_wait FROM information_schema.global_status
+WHERE variable_name = 'binlog_group_commit_trigger_lock_wait';
+variable_value - @group_commit_trigger_lock_wait
+2
+SET @a= current_timestamp();
+SET GLOBAL binlog_commit_wait_usec= 5*1000*1000;
+INSERT INTO t1 VALUES (9,0);
+SET @b= unix_timestamp(current_timestamp()) - unix_timestamp(@a);
+SELECT IF(@b < 4, CONCAT("Error: too little time elapsed: ", @b, " seconds < 4"),
+IF(@b < 20, "Ok", CONCAT("Error: too much time elapsed: ", @b, " seconds >= 20")));
+IF(@b < 4, CONCAT("Error: too little time elapsed: ", @b, " seconds < 4"),
+IF(@b < 20, "Ok", CONCAT("Error: too much time elapsed: ", @b, " seconds >= 20")))
+Ok
+SELECT variable_value - @group_commits FROM information_schema.global_status
+WHERE variable_name = 'binlog_group_commits';
+variable_value - @group_commits
+5
+SELECT variable_value - @group_commit_trigger_count FROM information_schema.global_status
+WHERE variable_name = 'binlog_group_commit_trigger_count';
+variable_value - @group_commit_trigger_count
+2
+SELECT variable_value - @group_commit_trigger_timeout FROM information_schema.global_status
+WHERE variable_name = 'binlog_group_commit_trigger_timeout';
+variable_value - @group_commit_trigger_timeout
+1
+SELECT variable_value - @group_commit_trigger_lock_wait FROM information_schema.global_status
+WHERE variable_name = 'binlog_group_commit_trigger_lock_wait';
+variable_value - @group_commit_trigger_lock_wait
+2
+SELECT * FROM t1 ORDER BY a;
+a b
+1 11
+2 0
+3 1
+4 0
+6 0
+7 0
+8 0
+9 0
+DROP TABLE t1;
+SET GLOBAL binlog_commit_wait_count= @old_count;
+SET GLOBAL binlog_commit_wait_usec= @old_usec;
diff --git a/mysql-test/suite/binlog/r/binlog_database.result b/mysql-test/suite/binlog/r/binlog_database.result
index 4f7d2dc7b94..504b3daa206 100644
--- a/mysql-test/suite/binlog/r/binlog_database.result
+++ b/mysql-test/suite/binlog/r/binlog_database.result
@@ -50,10 +50,31 @@ master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt1` /* generate
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
FLUSH STATUS;
+
+# 'DROP TABLE IF EXISTS <deleted tables>' is binlogged
+# when 'DROP DATABASE' fails and at least one table is deleted
+# from the database.
+RESET MASTER;
+CREATE DATABASE testing_1;
+USE testing_1;
+CREATE TABLE t1(c1 INT);
+CREATE TABLE t2(c1 INT);
+# Create a file in the database directory
+SELECT 'hello' INTO OUTFILE 'fake_file.FAKE_FILE';
+
+# 'DROP DATABASE' will fail if there is any other file in the the
+# database directory
+DROP DATABASE testing_1;
+ERROR HY000: Error dropping database (can't rmdir './testing_1', errno: 39 "Directory not empty")
+
+# Remove the fake file.
+# Now we can drop the database.
+DROP DATABASE testing_1;
#
# Bug#11765416 58381: FAILED DROP DATABASE CAN BREAK STATEMENT
# BASED REPLICATION
#
+USE test;
DROP DATABASE IF EXISTS db1;
DROP TABLE IF EXISTS t3;
CREATE DATABASE db1;
@@ -70,7 +91,7 @@ t2
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 `db1`; DROP TABLE `t1`
+master-bin.000001 # Query # # use `db1`; DROP TABLE IF EXISTS `t1`
DROP TABLE t3;
DROP DATABASE db1;
set binlog_format=mixed;
@@ -125,10 +146,31 @@ master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt1` /* generate
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
FLUSH STATUS;
+
+# 'DROP TABLE IF EXISTS <deleted tables>' is binlogged
+# when 'DROP DATABASE' fails and at least one table is deleted
+# from the database.
+RESET MASTER;
+CREATE DATABASE testing_1;
+USE testing_1;
+CREATE TABLE t1(c1 INT);
+CREATE TABLE t2(c1 INT);
+# Create a file in the database directory
+SELECT 'hello' INTO OUTFILE 'fake_file.FAKE_FILE';
+
+# 'DROP DATABASE' will fail if there is any other file in the the
+# database directory
+DROP DATABASE testing_1;
+ERROR HY000: Error dropping database (can't rmdir './testing_1', errno: 39 "Directory not empty")
+
+# Remove the fake file.
+# Now we can drop the database.
+DROP DATABASE testing_1;
#
# Bug#11765416 58381: FAILED DROP DATABASE CAN BREAK STATEMENT
# BASED REPLICATION
#
+USE test;
DROP DATABASE IF EXISTS db1;
DROP TABLE IF EXISTS t3;
CREATE DATABASE db1;
@@ -145,7 +187,7 @@ t2
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 `db1`; DROP TABLE `t1`
+master-bin.000001 # Query # # use `db1`; DROP TABLE IF EXISTS `t1`
DROP TABLE t3;
DROP DATABASE db1;
set binlog_format=row;
@@ -200,10 +242,31 @@ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt1` /* gen
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
FLUSH STATUS;
+
+# 'DROP TABLE IF EXISTS <deleted tables>' is binlogged
+# when 'DROP DATABASE' fails and at least one table is deleted
+# from the database.
+RESET MASTER;
+CREATE DATABASE testing_1;
+USE testing_1;
+CREATE TABLE t1(c1 INT);
+CREATE TABLE t2(c1 INT);
+# Create a file in the database directory
+SELECT 'hello' INTO OUTFILE 'fake_file.FAKE_FILE';
+
+# 'DROP DATABASE' will fail if there is any other file in the the
+# database directory
+DROP DATABASE testing_1;
+ERROR HY000: Error dropping database (can't rmdir './testing_1', errno: 39 "Directory not empty")
+
+# Remove the fake file.
+# Now we can drop the database.
+DROP DATABASE testing_1;
#
# Bug#11765416 58381: FAILED DROP DATABASE CAN BREAK STATEMENT
# BASED REPLICATION
#
+USE test;
DROP DATABASE IF EXISTS db1;
DROP TABLE IF EXISTS t3;
CREATE DATABASE db1;
@@ -220,7 +283,7 @@ t2
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 `db1`; DROP TABLE `t1`
+master-bin.000001 # Query # # use `db1`; DROP TABLE IF EXISTS `t1`
DROP TABLE t3;
DROP DATABASE db1;
show databases;
diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result
index f24cd30167c..86c4c68d02b 100644
--- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result
+++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result
@@ -327,6 +327,18 @@ INSERT INTO t2 SET a=1;
INSERT INTO t2 SET b=1;
UPDATE t1, t2 SET t1.a=10, t2.a=20;
DROP TABLE t1,t2;
+INSERT INTO t1dec102 VALUES (-999.99);
+INSERT INTO t1dec102 VALUES (0);
+INSERT INTO t1dec102 VALUES (999.99);
+SELECT * FROM t1dec102 ORDER BY a;
+a
+-999.99
+0.00
+123.45
+123.46
+123.47
+999.99
+DROP TABLE t1dec102;
flush logs;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
@@ -4554,6 +4566,62 @@ SET TIMESTAMP=1000000000/*!*/;
DROP TABLE `t1`,`t2` /* generated by server */
/*!*/;
# at #
+#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-317
+/*!100001 SET @@session.gtid_seq_no=317*//*!*/;
+BEGIN
+/*!*/;
+# at #
+# at #
+#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1dec102` mapped to number #
+#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
+### INSERT INTO `test`.`t1dec102`
+### SET
+### @1=!! Old DECIMAL (mysql-4.1 or earlier). Not enough metadata to display the value. # at #
+#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
+SET TIMESTAMP=1000000000/*!*/;
+COMMIT
+/*!*/;
+# at #
+#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-318
+/*!100001 SET @@session.gtid_seq_no=318*//*!*/;
+BEGIN
+/*!*/;
+# at #
+# at #
+#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1dec102` mapped to number #
+#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
+### INSERT INTO `test`.`t1dec102`
+### SET
+### @1=!! Old DECIMAL (mysql-4.1 or earlier). Not enough metadata to display the value. # at #
+#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
+SET TIMESTAMP=1000000000/*!*/;
+COMMIT
+/*!*/;
+# at #
+#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-319
+/*!100001 SET @@session.gtid_seq_no=319*//*!*/;
+BEGIN
+/*!*/;
+# at #
+# at #
+#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1dec102` mapped to number #
+#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
+### INSERT INTO `test`.`t1dec102`
+### SET
+### @1=!! Old DECIMAL (mysql-4.1 or earlier). Not enough metadata to display the value. # at #
+#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
+SET TIMESTAMP=1000000000/*!*/;
+COMMIT
+/*!*/;
+# at #
+#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-320
+/*!100001 SET @@session.gtid_seq_no=320*//*!*/;
+# at #
+#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
+SET TIMESTAMP=1000000000/*!*/;
+DROP TABLE `t1dec102` /* generated by server */
+/*!*/;
+# at #
#010909 4:46:40 server id 1 end_log_pos # Rotate to master-bin.000002 pos: 4
DELIMITER ;
# End of log file
diff --git a/mysql-test/suite/binlog/r/temptable_uservar_disconnect-7938.result b/mysql-test/suite/binlog/r/temptable_uservar_disconnect-7938.result
new file mode 100644
index 00000000000..f09216cb539
--- /dev/null
+++ b/mysql-test/suite/binlog/r/temptable_uservar_disconnect-7938.result
@@ -0,0 +1,8 @@
+create table t1 (i int);
+create trigger tr after insert on t1 for each row set @b=@a;
+create temporary table tmp like t1;
+insert into t1 values (1);
+select * from t1;
+i
+1
+drop table t1;
diff --git a/mysql-test/suite/binlog/t/binlog_commit_wait.test b/mysql-test/suite/binlog/t/binlog_commit_wait.test
new file mode 100644
index 00000000000..7d7af2a90e2
--- /dev/null
+++ b/mysql-test/suite/binlog/t/binlog_commit_wait.test
@@ -0,0 +1,229 @@
+--source include/have_innodb.inc
+--source include/have_log_bin.inc
+
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
+CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
+
+SET @old_count= @@GLOBAL.binlog_commit_wait_count;
+SET GLOBAL binlog_commit_wait_count= 3;
+SET @old_usec= @@GLOBAL.binlog_commit_wait_usec;
+SET GLOBAL binlog_commit_wait_usec= 20000000;
+
+connect(con1,localhost,root,,test);
+connect(con2,localhost,root,,test);
+connect(con3,localhost,root,,test);
+
+# Get Initial status measurements
+--connection default
+SELECT variable_value INTO @group_commits FROM information_schema.global_status
+ WHERE variable_name = 'binlog_group_commits';
+SELECT variable_value INTO @group_commit_trigger_count FROM information_schema.global_status
+ WHERE variable_name = 'binlog_group_commit_trigger_count';
+SELECT variable_value INTO @group_commit_trigger_timeout FROM information_schema.global_status
+ WHERE variable_name = 'binlog_group_commit_trigger_timeout';
+SELECT variable_value INTO @group_commit_trigger_lock_wait FROM information_schema.global_status
+ WHERE variable_name = 'binlog_group_commit_trigger_lock_wait';
+
+# Note: binlog_group_commits is counted at the start of the group and group_commit_trigger_* is
+# counted near when the groups its finalised.
+
+# Check that if T2 goes to wait for a row lock of T1 while T1 is waiting for
+# more transactions to arrive for group commit, the commit of T1 will complete
+# immediately.
+# We test this by setting a very high timeout (20 seconds), and testing that
+# that much time does not elapse.
+
+--connection default
+SET @a= current_timestamp();
+
+--connection con1
+BEGIN;
+INSERT INTO t1 VALUES (1,0);
+send COMMIT;
+
+--connection con2
+send INSERT INTO t1 VALUES (1,1);
+
+--connection con1
+reap;
+
+--connection default
+SET @b= unix_timestamp(current_timestamp()) - unix_timestamp(@a);
+SELECT IF(@b < 20, "Ok", CONCAT("Error: too much time elapsed: ", @b, " seconds >= 20"));
+
+# All connections are to the same server. One transaction occurs on con1. It is
+# commited before con2 is started. con2 transaction violates the unique key contraint. This
+# type of group commit is binlog_group_commit_trigger_lock_wait so that further con2
+# transactions will occur afterwards as they may be as result of the ER_DUP_ENTRY on the
+# application side.
+# before: binlog_group_commit=0, binlog_group_commit_trigger_count=0
+# before: binlog_group_commit_trigger_timeout=0, binlog_group_commit_trigger_lock_wait=0
+# after: binlog_group_commit+1 by reason of binlog_group_commit_trigger_lock_wait+1
+SELECT variable_value - @group_commits FROM information_schema.global_status
+ WHERE variable_name = 'binlog_group_commits';
+SELECT variable_value - @group_commit_trigger_count FROM information_schema.global_status
+ WHERE variable_name = 'binlog_group_commit_trigger_count';
+SELECT variable_value - @group_commit_trigger_timeout FROM information_schema.global_status
+ WHERE variable_name = 'binlog_group_commit_trigger_timeout';
+SELECT variable_value - @group_commit_trigger_lock_wait FROM information_schema.global_status
+ WHERE variable_name = 'binlog_group_commit_trigger_lock_wait';
+
+--connection con2
+--error ER_DUP_ENTRY
+reap;
+
+
+# Test that the commit triggers when sufficient commits have queued up.
+--connection default
+SET @a= current_timestamp();
+
+--connection con1
+send INSERT INTO t1 VALUES (2,0);
+
+--connection con2
+send INSERT INTO t1 VALUES (3,0);
+
+--connection con3
+INSERT INTO t1 VALUES (4,0);
+
+--connection con1
+reap;
+--connection con2
+reap;
+
+--connection default
+SET @b= unix_timestamp(current_timestamp()) - unix_timestamp(@a);
+SELECT IF(@b < 20, "Ok", CONCAT("Error: too much time elapsed: ", @b, " seconds >= 20"));
+
+# All connections are to the same server. 3 non-conflicting transaction occur
+# on each connection. The binlog_commit_wait_count=3 at the start therefore 1
+# group is committed by virtue of reaching 3 transactions. Hence
+# binlog_group_commit_trigger_count is incremented.
+# before: binlog_group_commit=1, binlog_group_commit_trigger_count=0
+# before: binlog_group_commit_trigger_timeout=0, binlog_group_commit_trigger_lock_wait=1
+# after: binlog_group_commit+1 by reason of binlog_group_commit_trigger_count+1
+SELECT variable_value - @group_commits FROM information_schema.global_status
+ WHERE variable_name = 'binlog_group_commits';
+SELECT variable_value - @group_commit_trigger_count FROM information_schema.global_status
+ WHERE variable_name = 'binlog_group_commit_trigger_count';
+SELECT variable_value - @group_commit_trigger_timeout FROM information_schema.global_status
+ WHERE variable_name = 'binlog_group_commit_trigger_timeout';
+SELECT variable_value - @group_commit_trigger_lock_wait FROM information_schema.global_status
+ WHERE variable_name = 'binlog_group_commit_trigger_lock_wait';
+
+# Test that commit triggers immediately if there is already a transaction
+# waiting on another transaction that reaches its commit.
+
+--connection default
+SET @a= current_timestamp();
+
+--connection con1
+send INSERT INTO t1 VALUES (6,0);
+
+--connection con2
+BEGIN;
+UPDATE t1 SET b=b+1 WHERE a=1;
+
+--connection con3
+send UPDATE t1 SET b=b+10 WHERE a=1;
+
+--connection con2
+# A small sleep to let con3 have time to wait on con2.
+# The sleep might be too small on loaded host, but that is not a big problem;
+# it only means we will trigger a different code path (con3 waits after con2
+# is ready to commit rather than before); and either path should work the same.
+# So we will not get false positive in case of different timing; at worst false
+# negative.
+SELECT SLEEP(0.25);
+UPDATE t1 SET b=b+1 WHERE a=3;
+COMMIT;
+
+--connection con1
+reap;
+
+--connection default
+SET @b= unix_timestamp(current_timestamp()) - unix_timestamp(@a);
+SELECT IF(@b < 20, "Ok", CONCAT("Error: too much time elapsed: ", @b, " seconds >= 20"));
+
+# All connections are to the same server. con2 and con3 updates are aquiring
+# the same row lock for a=1. Either con2 or con3 will be in a lock wait
+# thefore the binlog_group_commit_trigger_lock_wait is incremented.
+# before: binlog_group_commit=2, binlog_group_commit_trigger_count=1
+# before: binlog_group_commit_trigger_timeout=0, binlog_group_commit_trigger_lock_wait=1
+# after: binlog_group_commit+1 by reason of binlog_group_commit_trigger_lock_wait+1
+SELECT variable_value - @group_commits FROM information_schema.global_status
+ WHERE variable_name = 'binlog_group_commits';
+SELECT variable_value - @group_commit_trigger_count FROM information_schema.global_status
+ WHERE variable_name = 'binlog_group_commit_trigger_count';
+SELECT variable_value - @group_commit_trigger_timeout FROM information_schema.global_status
+ WHERE variable_name = 'binlog_group_commit_trigger_timeout';
+SELECT variable_value - @group_commit_trigger_lock_wait FROM information_schema.global_status
+ WHERE variable_name = 'binlog_group_commit_trigger_lock_wait';
+
+--connection default
+SET @a= current_timestamp();
+
+# Now con3 will be waiting for a following group commit to trigger.
+--connection con1
+send INSERT INTO t1 VALUES (7,0);
+--connection con2
+INSERT INTO t1 VALUES (8,0);
+--connection con3
+reap;
+
+--connection default
+SET @b= unix_timestamp(current_timestamp()) - unix_timestamp(@a);
+SELECT IF(@b < 20, "Ok", CONCAT("Error: too much time elapsed: ", @b, " seconds >= 20"));
+
+# The con1 and con2 transactions above are combined with the 'send UPDATE t1 SET b=b+10 WHERE a=1;'
+# on con3 from the previous block. So we have 3 so this is a count based group.
+# before: binlog_group_commit=3, binlog_group_commit_trigger_count=1
+# before: binlog_group_commit_trigger_timeout=0, binlog_group_commit_trigger_lock_wait=2
+# after: binlog_group_commit+1 by reason of binlog_group_commit_trigger_count+1
+SELECT variable_value - @group_commits FROM information_schema.global_status
+ WHERE variable_name = 'binlog_group_commits';
+SELECT variable_value - @group_commit_trigger_count FROM information_schema.global_status
+ WHERE variable_name = 'binlog_group_commit_trigger_count';
+SELECT variable_value - @group_commit_trigger_timeout FROM information_schema.global_status
+ WHERE variable_name = 'binlog_group_commit_trigger_timeout';
+SELECT variable_value - @group_commit_trigger_lock_wait FROM information_schema.global_status
+ WHERE variable_name = 'binlog_group_commit_trigger_lock_wait';
+
+# Test that when the binlog_commit_wait_usec is reached the tranction gets a group commit
+
+--connection default
+SET @a= current_timestamp();
+SET GLOBAL binlog_commit_wait_usec= 5*1000*1000;
+
+--connection con1
+reap;
+INSERT INTO t1 VALUES (9,0);
+
+--connection default
+SET @b= unix_timestamp(current_timestamp()) - unix_timestamp(@a);
+SELECT IF(@b < 4, CONCAT("Error: too little time elapsed: ", @b, " seconds < 4"),
+ IF(@b < 20, "Ok", CONCAT("Error: too much time elapsed: ", @b, " seconds >= 20")));
+
+# con1 pushes 1 transaction. The count was for 3 to occur before a group commit.
+# The timeout is 5 seconds but we allow between 4 and 20 because of the fragile nature
+# of time in test. This is a timeout causing the commit so binlog_group_commit_trigger_timeout
+# is incremented.
+# before: binlog_group_commit=4, binlog_group_commit_trigger_count=2
+# before: binlog_group_commit_trigger_timeout=0, binlog_group_commit_trigger_lock_wait=2
+# after: binlog_group_commit+1 by reason of binlog_group_commit_trigger_timeout+1
+SELECT variable_value - @group_commits FROM information_schema.global_status
+ WHERE variable_name = 'binlog_group_commits';
+SELECT variable_value - @group_commit_trigger_count FROM information_schema.global_status
+ WHERE variable_name = 'binlog_group_commit_trigger_count';
+SELECT variable_value - @group_commit_trigger_timeout FROM information_schema.global_status
+ WHERE variable_name = 'binlog_group_commit_trigger_timeout';
+SELECT variable_value - @group_commit_trigger_lock_wait FROM information_schema.global_status
+ WHERE variable_name = 'binlog_group_commit_trigger_lock_wait';
+
+--connection default
+SELECT * FROM t1 ORDER BY a;
+
+--connection default
+DROP TABLE t1;
+SET GLOBAL binlog_commit_wait_count= @old_count;
+SET GLOBAL binlog_commit_wait_usec= @old_usec;
diff --git a/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test
index 9b41c63d195..9609a9af384 100644
--- a/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test
+++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test
@@ -438,9 +438,20 @@ INSERT INTO t2 SET b=1;
UPDATE t1, t2 SET t1.a=10, t2.a=20;
DROP TABLE t1,t2;
+let $MYSQLD_DATADIR= `select @@datadir`;
+
+--copy_file std_data/old_decimal/t1dec102.frm $MYSQLD_DATADIR/test/t1dec102.frm
+--copy_file std_data/old_decimal/t1dec102.MYD $MYSQLD_DATADIR/test/t1dec102.MYD
+--copy_file std_data/old_decimal/t1dec102.MYI $MYSQLD_DATADIR/test/t1dec102.MYI
+
+INSERT INTO t1dec102 VALUES (-999.99);
+INSERT INTO t1dec102 VALUES (0);
+INSERT INTO t1dec102 VALUES (999.99);
+SELECT * FROM t1dec102 ORDER BY a;
+DROP TABLE t1dec102;
+
flush logs;
-let $MYSQLD_DATADIR= `select @@datadir`;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ /(@[0-9]*=[0-9]*[.][0-9]{1,3})[0-9e+-]*[^ ]*(.*(FLOAT|DOUBLE).*[*].)/\1...\2/
--exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001
diff --git a/mysql-test/suite/binlog/t/temptable_uservar_disconnect-7938.test b/mysql-test/suite/binlog/t/temptable_uservar_disconnect-7938.test
new file mode 100644
index 00000000000..a1d91e2f98f
--- /dev/null
+++ b/mysql-test/suite/binlog/t/temptable_uservar_disconnect-7938.test
@@ -0,0 +1,17 @@
+#
+# MDEV-7938 MariaDB Crashes Suddenly while writing binlogs
+#
+--source include/have_log_bin.inc
+--source include/have_binlog_format_mixed.inc
+
+--connect(con1,localhost,root,,)
+create table t1 (i int);
+create trigger tr after insert on t1 for each row set @b=@a;
+
+create temporary table tmp like t1;
+insert into t1 values (1);
+--disconnect con1
+
+--connection default
+select * from t1;
+drop table t1;
diff --git a/mysql-test/suite/funcs_1/t/processlist_priv_no_prot.test b/mysql-test/suite/funcs_1/t/processlist_priv_no_prot.test
index d6746d92250..88563b046df 100644
--- a/mysql-test/suite/funcs_1/t/processlist_priv_no_prot.test
+++ b/mysql-test/suite/funcs_1/t/processlist_priv_no_prot.test
@@ -25,10 +25,6 @@ let $fixed_bug_30395= 0;
# The file with expected results fits only to a run without
# ps-protocol/sp-protocol/cursor-protocol/view-protocol.
-if (`SELECT $PS_PROTOCOL + $SP_PROTOCOL + $CURSOR_PROTOCOL
- + $VIEW_PROTOCOL > 0`)
-{
- --skip Test requires: ps-protocol/sp-protocol/cursor-protocol/view-protocol disabled
-}
+--source include/no_protocol.inc
--source suite/funcs_1/datadict/processlist_priv.inc
diff --git a/mysql-test/suite/funcs_1/t/processlist_val_no_prot.test b/mysql-test/suite/funcs_1/t/processlist_val_no_prot.test
index b92c963c79c..a03d3774484 100644
--- a/mysql-test/suite/funcs_1/t/processlist_val_no_prot.test
+++ b/mysql-test/suite/funcs_1/t/processlist_val_no_prot.test
@@ -20,10 +20,6 @@
# The file with expected results fits only to a run without
# ps-protocol/sp-protocol/cursor-protocol/view-protocol.
-if (`SELECT $PS_PROTOCOL + $SP_PROTOCOL + $CURSOR_PROTOCOL
- + $VIEW_PROTOCOL > 0`)
-{
- --skip Test requires: ps-protocol/sp-protocol/cursor-protocol/view-protocol disabled
-}
+--source include/no_protocol.inc
--source suite/funcs_1/datadict/processlist_val.inc
diff --git a/mysql-test/suite/innodb/r/binlog_consistent.result b/mysql-test/suite/innodb/r/binlog_consistent.result
index edfa5947eb8..47f9900c449 100644
--- a/mysql-test/suite/innodb/r/binlog_consistent.result
+++ b/mysql-test/suite/innodb/r/binlog_consistent.result
@@ -104,4 +104,13 @@ master-bin.000001 1757 Gtid 1 1795 BEGIN GTID 0-1-9
master-bin.000001 1795 Query 1 1887 use `test`; INSERT INTO t1 VALUES (3, "")
master-bin.000001 1887 Xid 1 1914 COMMIT /* XID */
master-bin.000001 1914 Rotate 1 1958 master-bin.000002;pos=4
-DROP TABLE t1,t2;
+*** MDEV-7310: last_commit_pos_offset set to wrong value after binlog rotate in group commit ***
+SET @old_size= @@GLOBAL.max_binlog_size;
+SET GLOBAL max_binlog_size=4096;
+CREATE TABLE t3 (a INT PRIMARY KEY, b VARBINARY(8192)) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (10, '');
+INSERT INTO t3 VALUES (11, 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
+test_result
+OK
+SET GLOBAL max_binlog_size=@old_size;
+DROP TABLE t1,t2, t3;
diff --git a/mysql-test/suite/innodb/r/innodb-alter-table-disk-full.result b/mysql-test/suite/innodb/r/innodb-alter-table-disk-full.result
deleted file mode 100644
index ffeacae7951..00000000000
--- a/mysql-test/suite/innodb/r/innodb-alter-table-disk-full.result
+++ /dev/null
@@ -1,50 +0,0 @@
-create table t1(a int not null primary key, b int) engine=innodb;
-create procedure innodb_insert_proc (repeat_count int)
-begin
-declare current_num int;
-set current_num = 0;
-while current_num < repeat_count do
-insert into t1 values(current_num, current_num);
-set current_num = current_num + 1;
-end while;
-end//
-commit;
-set autocommit=0;
-call innodb_insert_proc(10000);
-commit;
-set autocommit=1;
-set DEBUG_DBUG='+d,ib_os_aio_func_io_failure_28';
-alter table t1 add testcol int;
-ERROR HY000: The table 't1' is full
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-set DEBUG_DBUG='+d,ib_os_aio_func_io_failure_28_2';
-alter table t1 add testcol int;
-ERROR HY000: The table 't1' is full
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-set DEBUG_DBUG=NULL;
-alter table t1 add testcol2 int;
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- `testcol2` int(11) DEFAULT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-select count(1) from t1;
-count(1)
-10000
-drop procedure innodb_insert_proc;
-drop table t1;
diff --git a/mysql-test/suite/innodb/r/innodb-alter-tempfile.result b/mysql-test/suite/innodb/r/innodb-alter-tempfile.result
new file mode 100644
index 00000000000..ce13ad0978b
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb-alter-tempfile.result
@@ -0,0 +1,40 @@
+#
+# Bug #18734396 INNODB IN-PLACE ALTER FAILURES BLOCK FUTURE ALTERS
+#
+# Temporary tablename will be unique. This makes sure that future
+# in-place ALTERs of the same table will not be blocked due to
+# temporary tablename.
+# Crash the server in ha_innobase::commit_inplace_alter_table()
+CREATE TABLE t1 (f1 INT NOT NULL, f2 INT NOT NULL) ENGINE=innodb;
+SET debug='d,innodb_alter_commit_crash_before_commit';
+Warnings:
+Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
+# Write file to make mysql-test-run.pl expect crash
+# Execute the statement that causes the crash
+ALTER TABLE t1 ADD PRIMARY KEY (f2, f1);
+ERROR HY000: Lost connection to MySQL server during query
+# Startup the server after the crash
+# Read and remember the temporary table name
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) NOT NULL,
+ `f2` int(11) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+# Consecutive Alter table does not create same temporary file name
+ALTER TABLE t1 ADD PRIMARY KEY (f2, f1);
+# Shutdown the server to allow manual recovery
+# Manual recovery begin. The dictionary was not updated
+# and the files were not renamed. The rebuilt table
+# was left behind on purpose, to faciliate data recovery.
+# Manual recovery end
+# Startup the server after manual recovery
+# Drop the orphaned rebuilt table.
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) NOT NULL,
+ `f2` int(11) NOT NULL,
+ PRIMARY KEY (`f2`,`f1`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t1;
diff --git a/mysql-test/suite/innodb/r/innodb-bigblob.result b/mysql-test/suite/innodb/r/innodb-bigblob.result
new file mode 100644
index 00000000000..314bd3ed088
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb-bigblob.result
@@ -0,0 +1,7 @@
+call mtr.add_suppression("Resizing redo log from *");
+call mtr.add_suppression("Starting to delete and rewrite log files.");
+call mtr.add_suppression("New log files created, LSN=*");
+create table foo (id varchar(37) not null, content longblob) engine=INNODB;
+insert into foo (id, content) values('xyz', '');
+update foo set content=repeat('a', 43941888) where id='xyz';
+drop table foo;
diff --git a/mysql-test/suite/innodb/r/innodb-fk.result b/mysql-test/suite/innodb/r/innodb-fk.result
index cf883d83874..956dbce58ed 100644
--- a/mysql-test/suite/innodb/r/innodb-fk.result
+++ b/mysql-test/suite/innodb/r/innodb-fk.result
@@ -33,3 +33,112 @@ select * from fk_29;
f1
29
drop table t1;
+CREATE TABLE t1 (
+id int(11) NOT NULL AUTO_INCREMENT,
+f1 int(11) DEFAULT NULL,
+PRIMARY KEY (id),
+CONSTRAINT fk1 FOREIGN KEY (f1) REFERENCES t1 (id) ON DELETE CASCADE
+) ENGINE=InnoDB;
+CREATE TABLE t2 (
+id int(11) NOT NULL AUTO_INCREMENT,
+f2 int(11) NOT NULL,
+f3 int(11) NOT NULL,
+PRIMARY KEY (`id`),
+CONSTRAINT fk2 FOREIGN KEY (f2) REFERENCES t1 (`id`) ON DELETE CASCADE,
+CONSTRAINT fk3 FOREIGN KEY (f3) REFERENCES t3 (id) ON DELETE CASCADE
+) ENGINE=InnoDB;
+ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
+show warnings;
+Level Code Message
+Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
+Warning 1215 Cannot add foreign key constraint
+CREATE TABLE t2 (
+id int(11) NOT NULL AUTO_INCREMENT,
+f2 int(11) NOT NULL,
+f3 int(11) NOT NULL,
+PRIMARY KEY (`id`),
+CONSTRAINT fk2 FOREIGN KEY (f2) REFERENCES t1 (`id`) ON DELETE CASCADE
+) ENGINE=InnoDB;
+ALTER TABLE t2 ADD CONSTRAINT fk3 FOREIGN KEY (f3) REFERENCES t3 (id) ON DELETE CASCADE;
+ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
+show warnings;
+Level Code Message
+Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
+Warning 1215 Cannot add foreign key constraint
+drop table t2;
+drop table t1;
+CREATE TABLE `#departaments` (
+`id_depart` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+PRIMARY KEY (`id_depart`)
+) ENGINE=INNODB DEFAULT CHARSET=utf8;
+CREATE TABLE `#departaments_tree` (
+`id_depart` INT(10) UNSIGNED NOT NULL,
+`id_depart_in` INT(10) UNSIGNED NOT NULL,
+PRIMARY KEY (`id_depart`,`id_depart_in`),
+CONSTRAINT `#departaments_tree_ibfk_1` FOREIGN KEY (`id_depart`) REFERENCES `#departaments` (`id_depart`)
+) ENGINE=INNODB DEFAULT CHARSET=utf8;
+ALTER TABLE `#departaments_tree`
+ ADD FOREIGN KEY (`id_depart_in`) REFERENCES `#departaments`(`id_depart`);
+SHOW CREATE TABLE `#departaments_tree`;
+Table Create Table
+#departaments_tree CREATE TABLE `#departaments_tree` (
+ `id_depart` int(10) unsigned NOT NULL,
+ `id_depart_in` int(10) unsigned NOT NULL,
+ PRIMARY KEY (`id_depart`,`id_depart_in`),
+ KEY `id_depart_in` (`id_depart_in`),
+ CONSTRAINT `#departaments_tree_ibfk_1` FOREIGN KEY (`id_depart`) REFERENCES `#departaments` (`id_depart`),
+ CONSTRAINT `#departaments_tree_ibfk_2` FOREIGN KEY (`id_depart_in`) REFERENCES `#departaments` (`id_depart`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8
+DROP TABLE `#departaments_tree`;
+DROP TABLE `#departaments`;
+CREATE TABLE `boroda` (
+`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+`a` INT(11) UNSIGNED DEFAULT NULL,
+`b` INT(11) UNSIGNED DEFAULT NULL,
+PRIMARY KEY (`id`),
+KEY `a` (`a`),
+CONSTRAINT `boroda_ibfk_1` FOREIGN KEY (`a`) REFERENCES `boroda` (`id`)
+) ENGINE=INNODB DEFAULT CHARSET=utf8;
+ALTER TABLE `boroda`
+ ADD FOREIGN KEY (`b`) REFERENCES `boroda`(`id`);
+ALTER TABLE `boroda` DROP FOREIGN KEY `boroda_ibfk_2`;
+RENAME TABLE `boroda` TO `#boroda`;
+ALTER TABLE `#boroda`
+ADD FOREIGN KEY (`b`) REFERENCES `#boroda`(`id`);
+SHOW CREATE TABLE `#boroda`;
+Table Create Table
+#boroda CREATE TABLE `#boroda` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `a` int(11) unsigned DEFAULT NULL,
+ `b` int(11) unsigned DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `a` (`a`),
+ KEY `b` (`b`),
+ CONSTRAINT `#boroda_ibfk_1` FOREIGN KEY (`a`) REFERENCES `#boroda` (`id`),
+ CONSTRAINT `#boroda_ibfk_2` FOREIGN KEY (`b`) REFERENCES `#boroda` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8
+DROP TABLE `#boroda`;
+CREATE TABLE `boroda` (
+`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+`a` INT(11) UNSIGNED DEFAULT NULL,
+`b` INT(11) UNSIGNED DEFAULT NULL,
+PRIMARY KEY (`id`),
+KEY `a` (`a`),
+CONSTRAINT `boroda_ibfk_1` FOREIGN KEY (`a`) REFERENCES `boroda` (`id`)
+) ENGINE=INNODB DEFAULT CHARSET=utf8;
+RENAME TABLE `boroda` TO `bor#oda`;
+ALTER TABLE `bor#oda`
+ADD FOREIGN KEY (`b`) REFERENCES `bor#oda`(`id`);
+SHOW CREATE TABLE `bor#oda`;
+Table Create Table
+bor#oda CREATE TABLE `bor#oda` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `a` int(11) unsigned DEFAULT NULL,
+ `b` int(11) unsigned DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `a` (`a`),
+ KEY `b` (`b`),
+ CONSTRAINT `bor#oda_ibfk_1` FOREIGN KEY (`a`) REFERENCES `bor#oda` (`id`),
+ CONSTRAINT `bor#oda_ibfk_2` FOREIGN KEY (`b`) REFERENCES `bor#oda` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8
+DROP TABLE `bor#oda`;
diff --git a/mysql-test/suite/innodb/r/innodb-mdev-7408.result b/mysql-test/suite/innodb/r/innodb-mdev-7408.result
new file mode 100644
index 00000000000..8f6ad139192
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb-mdev-7408.result
@@ -0,0 +1,12 @@
+select @@global.innodb_ft_server_stopword_table;
+@@global.innodb_ft_server_stopword_table
+NULL
+CREATE TABLE `stop_it-IT` ENGINE = InnoDB SELECT * FROM information_schema.INNODB_FT_DEFAULT_STOPWORD;
+SET @@global.innodb_ft_server_stopword_table = 'test/stop_it-IT';
+ERROR 42000: Variable 'innodb_ft_server_stopword_table' can't be set to the value of 'test/stop_it-IT'
+SET @@global.innodb_ft_server_stopword_table = 'test/stop_it@002dIT';
+drop table `stop_it-IT`;
+CREATE TABLE stop_it ENGINE = InnoDB SELECT * FROM information_schema.INNODB_FT_DEFAULT_STOPWORD;
+SET @@global.innodb_ft_server_stopword_table = 'test/stop_it';
+SET @@global.innodb_ft_server_stopword_table = NULL;
+drop table stop_it;
diff --git a/mysql-test/suite/innodb/r/innodb-mdev-7513.result b/mysql-test/suite/innodb/r/innodb-mdev-7513.result
new file mode 100644
index 00000000000..bb3531e3f90
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb-mdev-7513.result
@@ -0,0 +1,204 @@
+call mtr.add_suppression("Row size too large (> 8126)*");
+CREATE TABLE t1 ( text1 TEXT,
+text2 TEXT,
+text3 TEXT,
+text4 TEXT,
+text5 TEXT,
+text6 TEXT,
+text7 TEXT,
+text8 TEXT,
+text9 TEXT,
+text10 TEXT,
+text11 TEXT,
+text12 TEXT,
+text13 TEXT,
+text14 TEXT,
+text15 TEXT,
+text16 TEXT,
+text17 TEXT,
+text18 TEXT,
+text19 TEXT,
+text20 TEXT,
+text21 TEXT,
+text22 TEXT,
+text23 TEXT,
+text24 TEXT,
+text25 TEXT,
+text26 TEXT,
+text27 TEXT,
+text28 TEXT,
+text29 TEXT,
+text30 TEXT,
+text31 TEXT,
+text32 TEXT,
+text33 TEXT,
+text34 TEXT,
+text35 TEXT,
+text36 TEXT,
+text37 TEXT,
+text38 TEXT,
+text39 TEXT,
+text40 TEXT,
+text41 TEXT,
+text42 TEXT,
+text43 TEXT,
+text44 TEXT,
+text45 TEXT,
+text46 TEXT,
+text47 TEXT,
+text48 TEXT,
+text49 TEXT,
+text50 TEXT,
+text51 TEXT,
+text52 TEXT,
+text53 TEXT,
+text54 TEXT,
+text55 TEXT,
+text56 TEXT,
+text57 TEXT,
+text58 TEXT,
+text59 TEXT,
+text60 TEXT,
+text61 TEXT,
+text62 TEXT,
+text63 TEXT,
+text64 TEXT,
+text65 TEXT,
+text66 TEXT,
+text67 TEXT,
+text68 TEXT,
+text69 TEXT,
+text70 TEXT,
+text71 TEXT,
+text72 TEXT,
+text73 TEXT,
+text74 TEXT,
+text75 TEXT,
+text76 TEXT,
+text77 TEXT,
+text78 TEXT,
+text79 TEXT,
+text80 TEXT,
+text81 TEXT,
+text82 TEXT,
+text83 TEXT,
+text84 TEXT,
+text85 TEXT,
+text86 TEXT,
+text87 TEXT,
+text88 TEXT,
+text89 TEXT,
+text90 TEXT,
+text91 TEXT,
+text92 TEXT,
+text93 TEXT,
+text94 TEXT,
+text95 TEXT,
+text96 TEXT,
+text97 TEXT,
+text98 TEXT,
+text99 TEXT,
+text100 TEXT,
+text101 TEXT,
+text102 TEXT,
+text103 TEXT,
+text104 TEXT,
+text105 TEXT,
+text106 TEXT,
+text107 TEXT,
+text108 TEXT,
+text109 TEXT,
+text110 TEXT,
+text111 TEXT,
+text112 TEXT,
+text113 TEXT,
+text114 TEXT,
+text115 TEXT,
+text116 TEXT,
+text117 TEXT,
+text118 TEXT,
+text119 TEXT,
+text120 TEXT,
+text121 TEXT,
+text122 TEXT,
+text123 TEXT,
+text124 TEXT,
+text125 TEXT,
+text126 TEXT,
+text127 TEXT,
+text128 TEXT,
+text129 TEXT,
+text130 TEXT,
+text131 TEXT,
+text132 TEXT,
+text133 TEXT,
+text134 TEXT,
+text135 TEXT,
+text136 TEXT,
+text137 TEXT,
+text138 TEXT,
+text139 TEXT,
+text140 TEXT,
+text141 TEXT,
+text142 TEXT,
+text143 TEXT,
+text144 TEXT,
+text145 TEXT,
+text146 TEXT,
+text147 TEXT,
+text148 TEXT,
+text149 TEXT,
+text150 TEXT,
+text151 TEXT,
+text152 TEXT,
+text153 TEXT,
+text154 TEXT,
+text155 TEXT,
+text156 TEXT,
+text157 TEXT,
+text158 TEXT,
+text159 TEXT,
+text160 TEXT,
+text161 TEXT,
+text162 TEXT,
+text163 TEXT,
+text164 TEXT,
+text165 TEXT,
+text166 TEXT,
+text167 TEXT,
+text168 TEXT,
+text169 TEXT,
+text170 TEXT,
+text171 TEXT,
+text172 TEXT,
+text173 TEXT,
+text174 TEXT,
+text175 TEXT,
+text176 TEXT,
+text177 TEXT,
+text178 TEXT,
+text179 TEXT,
+text180 TEXT,
+text181 TEXT,
+text182 TEXT,
+text183 TEXT,
+text184 TEXT,
+text185 TEXT,
+text186 TEXT,
+text187 TEXT,
+text188 TEXT,
+text189 TEXT,
+text190 TEXT,
+text191 TEXT,
+text192 TEXT,
+text193 TEXT,
+text194 TEXT,
+text195 TEXT,
+text196 TEXT,
+text197 TEXT
+) ENGINE = InnoDB;
+INSERT INTO t1 VALUES ('abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef');
+DELETE FROM t1 WHERE text1 = 'abcdef';
+SELECT * from t1;
+text1 text2 text3 text4 text5 text6 text7 text8 text9 text10 text11 text12 text13 text14 text15 text16 text17 text18 text19 text20 text21 text22 text23 text24 text25 text26 text27 text28 text29 text30 text31 text32 text33 text34 text35 text36 text37 text38 text39 text40 text41 text42 text43 text44 text45 text46 text47 text48 text49 text50 text51 text52 text53 text54 text55 text56 text57 text58 text59 text60 text61 text62 text63 text64 text65 text66 text67 text68 text69 text70 text71 text72 text73 text74 text75 text76 text77 text78 text79 text80 text81 text82 text83 text84 text85 text86 text87 text88 text89 text90 text91 text92 text93 text94 text95 text96 text97 text98 text99 text100 text101 text102 text103 text104 text105 text106 text107 text108 text109 text110 text111 text112 text113 text114 text115 text116 text117 text118 text119 text120 text121 text122 text123 text124 text125 text126 text127 text128 text129 text130 text131 text132 text133 text134 text135 text136 text137 text138 text139 text140 text141 text142 text143 text144 text145 text146 text147 text148 text149 text150 text151 text152 text153 text154 text155 text156 text157 text158 text159 text160 text161 text162 text163 text164 text165 text166 text167 text168 text169 text170 text171 text172 text173 text174 text175 text176 text177 text178 text179 text180 text181 text182 text183 text184 text185 text186 text187 text188 text189 text190 text191 text192 text193 text194 text195 text196 text197
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/innodb-virtual-columns.result b/mysql-test/suite/innodb/r/innodb-virtual-columns.result
new file mode 100644
index 00000000000..558bb23de0a
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb-virtual-columns.result
@@ -0,0 +1,322 @@
+CREATE TABLE IF NOT EXISTS gso_grad_supr (
+term char(4) NOT NULL DEFAULT '',
+uw_id int(8) UNSIGNED NOT NULL DEFAULT 0,
+plan varchar(10) NOT NULL DEFAULT '',
+wdraw_rsn varchar(4) NOT NULL DEFAULT '',
+admit_term char(4) NOT NULL DEFAULT '',
+CONSTRAINT gso_grad_supr_pky PRIMARY KEY (uw_id, term)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO `gso_grad_supr` VALUES ('1031',2,'CSM','','1009');
+INSERT INTO `gso_grad_supr` VALUES ('1035',2,'CSM','ACAD','1009');
+CREATE TABLE IF NOT EXISTS grad_degree (
+student_id int(8) UNSIGNED NOT NULL,
+plan varchar(10) NOT NULL,
+admit_term char(4) NOT NULL,
+wdraw_rsn varchar(4) NOT NULL DEFAULT '',
+ofis_deg_status varchar(15) AS (
+CASE
+WHEN wdraw_rsn = '' THEN 'In progress'
+ WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed'
+ ELSE 'Not Completed'
+ END) VIRTUAL,
+deg_start_term char(4) NOT NULL DEFAULT '' COMMENT 'Educated guess at the beginning of the data',
+deg_as_of_term char(4) NOT NULL COMMENT 'In most cases also end term',
+CONSTRAINT grad_degree_stu_plan_admit_pky PRIMARY KEY (student_id, plan, admit_term)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE INDEX grad_degree_wdraw_rsn_ndx ON grad_degree (wdraw_rsn);
+CREATE INDEX grad_degree_as_of_term_ndx ON grad_degree (deg_as_of_term);
+INSERT IGNORE grad_degree (
+student_id,
+plan,
+admit_term,
+wdraw_rsn,
+deg_start_term,
+deg_as_of_term
+)
+SELECT
+ggs.uw_id AS c_student_id,
+ggs.plan,
+ggs.admit_term,
+ggs.wdraw_rsn,
+IF( (SELECT COUNT(*) FROM grad_degree AS gd WHERE gd.student_id = ggs.uw_id AND gd.admit_term = ggs.admit_term) > 0, ggs.term, ggs.admit_term ) AS c_deg_start_term,
+ggs.term AS c_as_of_term
+FROM gso_grad_supr AS ggs
+LEFT OUTER JOIN
+grad_degree AS gd
+ON ( gd.student_id = ggs.uw_id AND gd.plan = ggs.plan AND gd.admit_term = ggs.admit_term )
+WHERE
+ggs.term = 1031 AND
+gd.student_id IS NULL
+;
+UPDATE grad_degree AS gd
+INNER JOIN
+gso_grad_supr AS ggs
+ON ( gd.student_id = ggs.uw_id AND gd.plan = ggs.plan AND gd.admit_term = ggs.admit_term )
+SET
+gd.wdraw_rsn = ggs.wdraw_rsn,
+gd.deg_as_of_term = 1035
+WHERE
+gd.wdraw_rsn NOT IN ('DCMP', 'TRDC') AND
+ggs.term = 1035
+;
+drop table grad_degree;
+CREATE TABLE IF NOT EXISTS grad_degree (
+student_id int(8) UNSIGNED NOT NULL,
+plan varchar(10) NOT NULL,
+admit_term char(4) NOT NULL,
+wdraw_rsn varchar(4) NOT NULL DEFAULT '',
+ofis_deg_status varchar(15) AS (
+CASE
+WHEN wdraw_rsn = '' THEN 'In progress'
+ WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed'
+ ELSE 'Not Completed'
+ END) VIRTUAL,
+ofis_deg_status2 varchar(15) AS (
+CASE
+WHEN wdraw_rsn = '' THEN 'In progress2'
+ WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed2'
+ ELSE 'Not Completed2'
+ END) VIRTUAL,
+ofis_deg_status3 varchar(15) AS (
+CASE
+WHEN wdraw_rsn = '' THEN 'In progress3'
+ WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed3'
+ ELSE 'Not Completed3'
+ END) VIRTUAL,
+ofis_deg_status4 varchar(15) AS (
+CASE
+WHEN wdraw_rsn = '' THEN 'In progress4'
+ WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed4'
+ ELSE 'Not Completed4'
+ END) VIRTUAL,
+ofis_deg_status5 varchar(15) AS (
+CASE
+WHEN wdraw_rsn = '' THEN 'In progress5'
+ WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed5'
+ ELSE 'Not Completed5'
+ END) VIRTUAL,
+ofis_deg_status6 varchar(15) AS (
+CASE
+WHEN wdraw_rsn = '' THEN 'In progress6'
+ WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed6'
+ ELSE 'Not Completed6'
+ END) VIRTUAL,
+ofis_deg_status7 varchar(15) AS (
+CASE
+WHEN wdraw_rsn = '' THEN 'In progress7'
+ WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed7'
+ ELSE 'Not Completed7'
+ END) VIRTUAL,
+ofis_deg_status8 varchar(15) AS (
+CASE
+WHEN wdraw_rsn = '' THEN 'In progress8'
+ WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed8'
+ ELSE 'Not Completed8'
+ END) VIRTUAL,
+deg_start_term char(4) NOT NULL DEFAULT '' COMMENT 'Educated guess at the beginning of the data',
+deg_as_of_term char(4) NOT NULL COMMENT 'In most cases also end term',
+CONSTRAINT grad_degree_stu_plan_admit_pky PRIMARY KEY (student_id, plan, admit_term)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE INDEX grad_degree_wdraw_rsn_ndx ON grad_degree (wdraw_rsn);
+CREATE INDEX grad_degree_as_of_term_ndx ON grad_degree (deg_as_of_term);
+INSERT IGNORE grad_degree (
+student_id,
+plan,
+admit_term,
+wdraw_rsn,
+deg_start_term,
+deg_as_of_term
+)
+SELECT
+ggs.uw_id AS c_student_id,
+ggs.plan,
+ggs.admit_term,
+ggs.wdraw_rsn,
+IF( (SELECT COUNT(*) FROM grad_degree AS gd WHERE gd.student_id = ggs.uw_id AND gd.admit_term = ggs.admit_term) > 0, ggs.term, ggs.admit_term ) AS c_deg_start_term,
+ggs.term AS c_as_of_term
+FROM gso_grad_supr AS ggs
+LEFT OUTER JOIN
+grad_degree AS gd
+ON ( gd.student_id = ggs.uw_id AND gd.plan = ggs.plan AND gd.admit_term = ggs.admit_term )
+WHERE
+ggs.term = 1031 AND
+gd.student_id IS NULL
+;
+UPDATE grad_degree AS gd
+INNER JOIN
+gso_grad_supr AS ggs
+ON ( gd.student_id = ggs.uw_id AND gd.plan = ggs.plan AND gd.admit_term = ggs.admit_term )
+SET
+gd.wdraw_rsn = ggs.wdraw_rsn,
+gd.deg_as_of_term = 1035
+WHERE
+gd.wdraw_rsn NOT IN ('DCMP', 'TRDC') AND
+ggs.term = 1035
+;
+ALTER TABLE grad_degree DROP INDEX grad_degree_wdraw_rsn_ndx;
+ALTER TABLE grad_degree DROP COLUMN deg_start_term;
+SHOW CREATE TABLE grad_degree;
+Table Create Table
+grad_degree CREATE TABLE `grad_degree` (
+ `student_id` int(8) unsigned NOT NULL,
+ `plan` varchar(10) NOT NULL,
+ `admit_term` char(4) NOT NULL,
+ `wdraw_rsn` varchar(4) NOT NULL DEFAULT '',
+ `ofis_deg_status` varchar(15) AS (
+CASE
+WHEN wdraw_rsn = '' THEN 'In progress'
+ WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed'
+ ELSE 'Not Completed'
+ END) VIRTUAL,
+ `ofis_deg_status2` varchar(15) AS (
+CASE
+WHEN wdraw_rsn = '' THEN 'In progress2'
+ WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed2'
+ ELSE 'Not Completed2'
+ END) VIRTUAL,
+ `ofis_deg_status3` varchar(15) AS (
+CASE
+WHEN wdraw_rsn = '' THEN 'In progress3'
+ WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed3'
+ ELSE 'Not Completed3'
+ END) VIRTUAL,
+ `ofis_deg_status4` varchar(15) AS (
+CASE
+WHEN wdraw_rsn = '' THEN 'In progress4'
+ WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed4'
+ ELSE 'Not Completed4'
+ END) VIRTUAL,
+ `ofis_deg_status5` varchar(15) AS (
+CASE
+WHEN wdraw_rsn = '' THEN 'In progress5'
+ WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed5'
+ ELSE 'Not Completed5'
+ END) VIRTUAL,
+ `ofis_deg_status6` varchar(15) AS (
+CASE
+WHEN wdraw_rsn = '' THEN 'In progress6'
+ WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed6'
+ ELSE 'Not Completed6'
+ END) VIRTUAL,
+ `ofis_deg_status7` varchar(15) AS (
+CASE
+WHEN wdraw_rsn = '' THEN 'In progress7'
+ WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed7'
+ ELSE 'Not Completed7'
+ END) VIRTUAL,
+ `ofis_deg_status8` varchar(15) AS (
+CASE
+WHEN wdraw_rsn = '' THEN 'In progress8'
+ WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed8'
+ ELSE 'Not Completed8'
+ END) VIRTUAL,
+ `deg_as_of_term` char(4) NOT NULL COMMENT 'In most cases also end term',
+ PRIMARY KEY (`student_id`,`plan`,`admit_term`),
+ KEY `grad_degree_as_of_term_ndx` (`deg_as_of_term`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8
+DROP TABLE grad_degree;
+CREATE TABLE IF NOT EXISTS grad_degree (
+student_id int(8) UNSIGNED NOT NULL,
+plan varchar(10) NOT NULL,
+admit_term char(4) NOT NULL,
+wdraw_rsn varchar(4) NOT NULL DEFAULT '',
+ofis_deg_status varchar(15) AS (
+CASE
+WHEN wdraw_rsn = '' THEN 'In progress'
+ WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed'
+ ELSE 'Not Completed'
+ END) VIRTUAL,
+ofis_deg_status2 varchar(15) AS (
+CASE
+WHEN wdraw_rsn = '' THEN 'In progress2'
+ WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed2'
+ ELSE 'Not Completed2'
+ END) VIRTUAL,
+ofis_deg_status3 varchar(15) AS (
+CASE
+WHEN wdraw_rsn = '' THEN 'In progress3'
+ WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed3'
+ ELSE 'Not Completed3'
+ END) VIRTUAL,
+ofis_deg_status4 varchar(15) AS (
+CASE
+WHEN wdraw_rsn = '' THEN 'In progress4'
+ WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed4'
+ ELSE 'Not Completed4'
+ END) VIRTUAL,
+ofis_deg_status5 varchar(15) AS (
+CASE
+WHEN wdraw_rsn = '' THEN 'In progress5'
+ WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed5'
+ ELSE 'Not Completed5'
+ END) VIRTUAL,
+ofis_deg_status6 varchar(15) AS (
+CASE
+WHEN wdraw_rsn = '' THEN 'In progress6'
+ WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed6'
+ ELSE 'Not Completed6'
+ END) VIRTUAL,
+ofis_deg_status7 varchar(15) AS (
+CASE
+WHEN wdraw_rsn = '' THEN 'In progress7'
+ WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed7'
+ ELSE 'Not Completed7'
+ END) VIRTUAL,
+ofis_deg_status8 varchar(15) AS (
+CASE
+WHEN wdraw_rsn = '' THEN 'In progress8'
+ WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed8'
+ ELSE 'Not Completed8'
+ END) VIRTUAL,
+deg_start_term char(4) NOT NULL DEFAULT '' COMMENT 'Educated guess at the beginning of the data',
+deg_as_of_term char(4) NOT NULL COMMENT 'In most cases also end term',
+CONSTRAINT grad_degree_stu_plan_admit_pky PRIMARY KEY (student_id, plan, admit_term)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE INDEX grad_degree_wdraw_rsn_ndx ON grad_degree (wdraw_rsn);
+ALTER TABLE grad_degree DROP COLUMN ofis_deg_status2, DROP COLUMN ofis_deg_status3,
+DROP COLUMN ofis_deg_status4, DROP COLUMN ofis_deg_status5, DROP COLUMN ofis_deg_status6,
+DROP COLUMN ofis_deg_status7, DROP COLUMN ofis_deg_status8;
+CREATE INDEX grad_degree_as_of_term_ndx ON grad_degree (deg_as_of_term);
+INSERT IGNORE grad_degree (
+student_id,
+plan,
+admit_term,
+wdraw_rsn,
+deg_start_term,
+deg_as_of_term
+)
+SELECT
+ggs.uw_id AS c_student_id,
+ggs.plan,
+ggs.admit_term,
+ggs.wdraw_rsn,
+IF( (SELECT COUNT(*) FROM grad_degree AS gd WHERE gd.student_id = ggs.uw_id AND gd.admit_term = ggs.admit_term) > 0, ggs.term, ggs.admit_term ) AS c_deg_start_term,
+ggs.term AS c_as_of_term
+FROM gso_grad_supr AS ggs
+LEFT OUTER JOIN
+grad_degree AS gd
+ON ( gd.student_id = ggs.uw_id AND gd.plan = ggs.plan AND gd.admit_term = ggs.admit_term )
+WHERE
+ggs.term = 1031 AND
+gd.student_id IS NULL
+;
+UPDATE grad_degree AS gd
+INNER JOIN
+gso_grad_supr AS ggs
+ON ( gd.student_id = ggs.uw_id AND gd.plan = ggs.plan AND gd.admit_term = ggs.admit_term )
+SET
+gd.wdraw_rsn = ggs.wdraw_rsn,
+gd.deg_as_of_term = 1035
+WHERE
+gd.wdraw_rsn NOT IN ('DCMP', 'TRDC') AND
+ggs.term = 1035
+;
+select * from grad_degree;
+student_id plan admit_term wdraw_rsn ofis_deg_status deg_start_term deg_as_of_term
+2 CSM 1009 ACAD Not Completed 1009 1035
+select * from gso_grad_supr;
+term uw_id plan wdraw_rsn admit_term
+1031 2 CSM 1009
+1035 2 CSM ACAD 1009
+drop table grad_degree;
+drop table gso_grad_supr;
diff --git a/mysql-test/suite/innodb/r/innodb-xa.result b/mysql-test/suite/innodb/r/innodb-xa.result
new file mode 100644
index 00000000000..6eae842b14c
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb-xa.result
@@ -0,0 +1,17 @@
+xa rollback 'xid2';
+ERROR XAE04: XAER_NOTA: Unknown XID
+drop table if exists t1;
+Warnings:
+Note 1051 Unknown table 'test.t1'
+create table t1(a int)engine=innodb;
+rollback;
+xa start 'xid2';
+insert into `t1` values (1);
+savepoint `sv1`;
+xa end 'xid2';
+start transaction;
+ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the IDLE state
+xa prepare 'xid2';
+release savepoint `sv1`;
+xa commit 'xid2';
+drop table t1;
diff --git a/mysql-test/suite/innodb/r/innodb_blob_unrecoverable_crash.result b/mysql-test/suite/innodb/r/innodb_blob_unrecoverable_crash.result
new file mode 100644
index 00000000000..9f6b7ca6a23
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_blob_unrecoverable_crash.result
@@ -0,0 +1,23 @@
+call mtr.add_suppression("InnoDB: The total blob data length");
+SET GLOBAL max_allowed_packet = 100*1024*1024;
+# Connection big_packets:
+CREATE TABLE t1 (a BIGINT PRIMARY KEY, b LONGBLOB) ENGINE=InnoDB;
+INSERT INTO t1 (a, b) VALUES (1, '1');
+INSERT INTO t1 (a, b) VALUES (2, '2');
+INSERT INTO t1 (a, b) VALUES (3, '3');
+INSERT INTO t1 (a, b) VALUES (4, '4');
+INSERT INTO t1 (a, b) VALUES (5, '5');
+start transaction;
+INSERT INTO t1 (a, b) VALUES (6, REPEAT('a', 20*1024*1024));
+ERROR 42000: The size of BLOB/TEXT data inserted in one transaction is greater than 10% of redo log size. Increase the redo log size using innodb_log_file_size.
+# Connection default:
+# Quick shutdown and restart server
+# Connection default:
+SELECT a FROM t1;
+a
+1
+2
+3
+4
+5
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/innodb_bug34300.result b/mysql-test/suite/innodb/r/innodb_bug34300.result
index bf07febca73..09fc0b44579 100644
--- a/mysql-test/suite/innodb/r/innodb_bug34300.result
+++ b/mysql-test/suite/innodb/r/innodb_bug34300.result
@@ -1,3 +1,3 @@
-ERROR 42000: Row size too large (> ####). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
+ERROR 42000: The size of BLOB/TEXT data inserted in one transaction is greater than 10% of redo log size. Increase the redo log size using innodb_log_file_size.
f4 f8
f4 f8
diff --git a/mysql-test/suite/innodb/r/xa_recovery.result b/mysql-test/suite/innodb/r/xa_recovery.result
new file mode 100644
index 00000000000..84cb37ef7c9
--- /dev/null
+++ b/mysql-test/suite/innodb/r/xa_recovery.result
@@ -0,0 +1,17 @@
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+XA START 'x';
+UPDATE t1 set a=2;
+XA END 'x';
+XA PREPARE 'x';
+call mtr.add_suppression("Found 1 prepared XA transactions");
+SELECT * FROM t1 LOCK IN SHARE MODE;
+SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+SELECT * FROM t1;
+a
+2
+XA ROLLBACK 'x';
+SELECT * FROM t1;
+a
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/binlog_consistent.test b/mysql-test/suite/innodb/t/binlog_consistent.test
index 20023871093..a97bef4cf38 100644
--- a/mysql-test/suite/innodb/t/binlog_consistent.test
+++ b/mysql-test/suite/innodb/t/binlog_consistent.test
@@ -86,4 +86,36 @@ SHOW MASTER STATUS;
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/
SHOW BINLOG EVENTS;
-DROP TABLE t1,t2;
+
+--echo *** MDEV-7310: last_commit_pos_offset set to wrong value after binlog rotate in group commit ***
+
+SET @old_size= @@GLOBAL.max_binlog_size;
+SET GLOBAL max_binlog_size=4096;
+
+CREATE TABLE t3 (a INT PRIMARY KEY, b VARBINARY(8192)) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (10, '');
+--let $bigdata= `SELECT REPEAT('a', 5000)`
+eval INSERT INTO t3 VALUES (11, '$bigdata');
+
+# The bug was that binlog_snapshot_file pointed to the new file after binlog
+# rotation, but binlog_snapshot_position was the offset in the old file before
+# binlog rotation. So the position was invalid.
+# So here, we check that the values are consistent with SHOW MASTER STATUS,
+# which uses a different code path and did not have the bug.
+
+--source include/wait_for_binlog_checkpoint.inc
+--let $snap_file= query_get_value(SHOW STATUS LIKE 'binlog_snapshot_file', Value, 1)
+--let $snap_pos= query_get_value(SHOW STATUS LIKE 'binlog_snapshot_position', Value, 1)
+
+--let $master_file= query_get_value(SHOW MASTER STATUS, File, 1)
+--let $master_pos= query_get_value(SHOW MASTER STATUS, Position, 1)
+
+--disable_query_log
+eval SET @errmsg= 'ERROR: ($snap_file, $snap_pos) != ($master_file, $master_pos)';
+eval SELECT IF('$snap_file' = '$master_file' AND $snap_pos = $master_pos, 'OK', @errmsg) AS test_result;
+--enable_query_log
+
+SET GLOBAL max_binlog_size=@old_size;
+
+
+DROP TABLE t1,t2, t3;
diff --git a/mysql-test/suite/innodb/t/foreign-keys.test b/mysql-test/suite/innodb/t/foreign-keys.test
index 8ee96347208..2d586e2d6be 100644
--- a/mysql-test/suite/innodb/t/foreign-keys.test
+++ b/mysql-test/suite/innodb/t/foreign-keys.test
@@ -1,11 +1,6 @@
--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
diff --git a/mysql-test/suite/innodb/t/innodb-alter-table-disk-full-master.opt b/mysql-test/suite/innodb/t/innodb-alter-table-disk-full-master.opt
deleted file mode 100644
index 9c2ee7846b6..00000000000
--- a/mysql-test/suite/innodb/t/innodb-alter-table-disk-full-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---innodb-use-native-aio=0
diff --git a/mysql-test/suite/innodb/t/innodb-alter-table-disk-full.test b/mysql-test/suite/innodb/t/innodb-alter-table-disk-full.test
deleted file mode 100644
index adeb2ef9fd2..00000000000
--- a/mysql-test/suite/innodb/t/innodb-alter-table-disk-full.test
+++ /dev/null
@@ -1,50 +0,0 @@
-# MDEV-6288: Innodb causes server crash after disk full, then can't ALTER TABLE any more
---source include/have_innodb.inc
---source include/not_windows.inc
---source include/not_valgrind.inc
---source include/not_embedded.inc
-
-# DEBUG_SYNC must be compiled in.
---source include/have_debug_sync.inc
-
-create table t1(a int not null primary key, b int) engine=innodb;
-
-delimiter //;
-create procedure innodb_insert_proc (repeat_count int)
-begin
- declare current_num int;
- set current_num = 0;
- while current_num < repeat_count do
- insert into t1 values(current_num, current_num);
- set current_num = current_num + 1;
- end while;
-end//
-delimiter ;//
-commit;
-
-set autocommit=0;
-call innodb_insert_proc(10000);
-commit;
-set autocommit=1;
-
-# This caused crash earlier
-set DEBUG_DBUG='+d,ib_os_aio_func_io_failure_28';
---error 1114
-alter table t1 add testcol int;
-show create table t1;
-
-# This caused crash earlier
-set DEBUG_DBUG='+d,ib_os_aio_func_io_failure_28_2';
---error 1114
-alter table t1 add testcol int;
-show create table t1;
-
-set DEBUG_DBUG=NULL;
-alter table t1 add testcol2 int;
-show create table t1;
-
-select count(1) from t1;
-
-drop procedure innodb_insert_proc;
-drop table t1;
-
diff --git a/mysql-test/suite/innodb/t/innodb-alter-tempfile.test b/mysql-test/suite/innodb/t/innodb-alter-tempfile.test
new file mode 100644
index 00000000000..ec1ea35f1cf
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb-alter-tempfile.test
@@ -0,0 +1,75 @@
+# Not supported in embedded
+--source include/not_embedded.inc
+
+# This test case needs to crash the server. Needs a debug server.
+--source include/have_debug.inc
+
+# Don't test this under valgrind, memory leaks will occur.
+--source include/not_valgrind.inc
+
+# Avoid CrashReporter popup on Mac
+--source include/not_crashrep.inc
+
+# InnoDB is required
+--source include/have_innodb.inc
+
+--echo #
+--echo # Bug #18734396 INNODB IN-PLACE ALTER FAILURES BLOCK FUTURE ALTERS
+--echo #
+--echo # Temporary tablename will be unique. This makes sure that future
+--echo # in-place ALTERs of the same table will not be blocked due to
+--echo # temporary tablename.
+
+let datadir= `select @@datadir`;
+
+--let $_server_id= `SELECT @@server_id`
+--let $_expect_file_name=$MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect
+
+--echo # Crash the server in ha_innobase::commit_inplace_alter_table()
+CREATE TABLE t1 (f1 INT NOT NULL, f2 INT NOT NULL) ENGINE=innodb;
+SET debug='d,innodb_alter_commit_crash_before_commit';
+
+let $orig_table_id = `SELECT table_id
+ FROM information_schema.innodb_sys_tables
+ WHERE name = 'test/t1'`;
+
+--echo # Write file to make mysql-test-run.pl expect crash
+--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+
+--echo # Execute the statement that causes the crash
+--error 2013
+ALTER TABLE t1 ADD PRIMARY KEY (f2, f1);
+--echo # Startup the server after the crash
+--source include/start_mysqld.inc
+
+--echo # Read and remember the temporary table name
+let $temp_table_name = `SELECT SUBSTRING(name,6)
+ FROM information_schema.innodb_sys_tables
+ WHERE name LIKE "test/#sql-ib$orig_table_id%"`;
+# This second copy is an environment variable for the perl script below.
+let temp_table_name = $temp_table_name;
+show create table t1;
+--echo # Consecutive Alter table does not create same temporary file name
+ALTER TABLE t1 ADD PRIMARY KEY (f2, f1);
+--echo # Shutdown the server to allow manual recovery
+--source include/shutdown_mysqld.inc
+
+--echo # Manual recovery begin. The dictionary was not updated
+--echo # and the files were not renamed. The rebuilt table
+--echo # was left behind on purpose, to faciliate data recovery.
+
+perl;
+my @frm_file = glob "$ENV{'datadir'}/test/#sql-*.frm";
+my $target_frm = "$ENV{'datadir'}/test/$ENV{'temp_table_name'}.frm";
+rename($frm_file[0], $target_frm);
+EOF
+--echo # Manual recovery end
+--echo # Startup the server after manual recovery
+--source include/start_mysqld.inc
+
+--echo # Drop the orphaned rebuilt table.
+--disable_query_log
+eval DROP TABLE `#mysql50#$temp_table_name`;
+--enable_query_log
+show create table t1;
+drop table t1;
diff --git a/mysql-test/suite/innodb/t/innodb-autoinc.test b/mysql-test/suite/innodb/t/innodb-autoinc.test
index fd40b50ebbc..a8dda12cadd 100644
--- a/mysql-test/suite/innodb/t/innodb-autoinc.test
+++ b/mysql-test/suite/innodb/t/innodb-autoinc.test
@@ -1,8 +1,3 @@
-if (`select plugin_auth_version <= "5.5.37-MariaDB-34.0" from information_schema.plugins where plugin_name='innodb'`)
-{
- --skip Not fixed in XtraDB as of 5.5.37-MariaDB-34.0 or earlier
-}
-
--source include/have_innodb.inc
# embedded server ignores 'delayed', so skip this
-- source include/not_embedded.inc
diff --git a/mysql-test/suite/innodb/t/innodb-bigblob.opt b/mysql-test/suite/innodb/t/innodb-bigblob.opt
new file mode 100644
index 00000000000..06cc9e2b979
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb-bigblob.opt
@@ -0,0 +1,2 @@
+--max-allowed-packet=128M
+--innodb-log-file-size=210M
diff --git a/mysql-test/suite/innodb/t/innodb-bigblob.test b/mysql-test/suite/innodb/t/innodb-bigblob.test
new file mode 100644
index 00000000000..7665c890316
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb-bigblob.test
@@ -0,0 +1,20 @@
+-- source include/have_innodb.inc
+-- source include/big_test.inc
+-- source include/not_embedded.inc
+
+--disable_query_log
+let $status_orig=`SELECT @@innodb_status_output`;
+--enable_query_log
+
+call mtr.add_suppression("Resizing redo log from *");
+call mtr.add_suppression("Starting to delete and rewrite log files.");
+call mtr.add_suppression("New log files created, LSN=*");
+
+create table foo (id varchar(37) not null, content longblob) engine=INNODB;
+insert into foo (id, content) values('xyz', '');
+update foo set content=repeat('a', 43941888) where id='xyz';
+drop table foo;
+
+--disable_query_log
+EVAL SET GLOBAL innodb_status_output = $status_orig;
+--enable_query_log
diff --git a/mysql-test/suite/innodb/t/innodb-fk.test b/mysql-test/suite/innodb/t/innodb-fk.test
index 9839cd2d084..f7bcbe238dd 100644
--- a/mysql-test/suite/innodb/t/innodb-fk.test
+++ b/mysql-test/suite/innodb/t/innodb-fk.test
@@ -84,3 +84,106 @@ while ($i)
drop table t1;
+#
+# MDEV-7672: Crash creating an InnoDB table with foreign keys
+#
+
+CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ f1 int(11) DEFAULT NULL,
+ PRIMARY KEY (id),
+ CONSTRAINT fk1 FOREIGN KEY (f1) REFERENCES t1 (id) ON DELETE CASCADE
+) ENGINE=InnoDB;
+
+--error 1005
+CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ f2 int(11) NOT NULL,
+ f3 int(11) NOT NULL,
+ PRIMARY KEY (`id`),
+ CONSTRAINT fk2 FOREIGN KEY (f2) REFERENCES t1 (`id`) ON DELETE CASCADE,
+ CONSTRAINT fk3 FOREIGN KEY (f3) REFERENCES t3 (id) ON DELETE CASCADE
+) ENGINE=InnoDB;
+
+show warnings;
+
+CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ f2 int(11) NOT NULL,
+ f3 int(11) NOT NULL,
+ PRIMARY KEY (`id`),
+ CONSTRAINT fk2 FOREIGN KEY (f2) REFERENCES t1 (`id`) ON DELETE CASCADE
+) ENGINE=InnoDB;
+
+--replace_regex /#sql-[0-9_a-f-]*/#sql-temporary/
+--error 1005
+ALTER TABLE t2 ADD CONSTRAINT fk3 FOREIGN KEY (f3) REFERENCES t3 (id) ON DELETE CASCADE;
+
+--replace_regex /#sql-[0-9_a-f-]*/#sql-temporary/
+show warnings;
+
+drop table t2;
+drop table t1;
+
+#
+# MDEV-7627: Some symbols in table name can cause to Error Code: 1050 when created FK
+#
+
+CREATE TABLE `#departaments` (
+ `id_depart` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`id_depart`)
+) ENGINE=INNODB DEFAULT CHARSET=utf8;
+
+CREATE TABLE `#departaments_tree` (
+ `id_depart` INT(10) UNSIGNED NOT NULL,
+ `id_depart_in` INT(10) UNSIGNED NOT NULL,
+ PRIMARY KEY (`id_depart`,`id_depart_in`),
+ CONSTRAINT `#departaments_tree_ibfk_1` FOREIGN KEY (`id_depart`) REFERENCES `#departaments` (`id_depart`)
+) ENGINE=INNODB DEFAULT CHARSET=utf8;
+
+ALTER TABLE `#departaments_tree`
+ ADD FOREIGN KEY (`id_depart_in`) REFERENCES `#departaments`(`id_depart`);
+
+SHOW CREATE TABLE `#departaments_tree`;
+
+DROP TABLE `#departaments_tree`;
+DROP TABLE `#departaments`;
+
+CREATE TABLE `boroda` (
+ `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+ `a` INT(11) UNSIGNED DEFAULT NULL,
+ `b` INT(11) UNSIGNED DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `a` (`a`),
+ CONSTRAINT `boroda_ibfk_1` FOREIGN KEY (`a`) REFERENCES `boroda` (`id`)
+) ENGINE=INNODB DEFAULT CHARSET=utf8;
+
+ALTER TABLE `boroda`
+ ADD FOREIGN KEY (`b`) REFERENCES `boroda`(`id`);
+
+ALTER TABLE `boroda` DROP FOREIGN KEY `boroda_ibfk_2`;
+
+RENAME TABLE `boroda` TO `#boroda`;
+
+ALTER TABLE `#boroda`
+ADD FOREIGN KEY (`b`) REFERENCES `#boroda`(`id`);
+
+SHOW CREATE TABLE `#boroda`;
+DROP TABLE `#boroda`;
+
+CREATE TABLE `boroda` (
+ `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+ `a` INT(11) UNSIGNED DEFAULT NULL,
+ `b` INT(11) UNSIGNED DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `a` (`a`),
+ CONSTRAINT `boroda_ibfk_1` FOREIGN KEY (`a`) REFERENCES `boroda` (`id`)
+) ENGINE=INNODB DEFAULT CHARSET=utf8;
+
+RENAME TABLE `boroda` TO `bor#oda`;
+
+ALTER TABLE `bor#oda`
+ADD FOREIGN KEY (`b`) REFERENCES `bor#oda`(`id`);
+
+SHOW CREATE TABLE `bor#oda`;
+DROP TABLE `bor#oda`;
diff --git a/mysql-test/suite/innodb/t/innodb-mdev-7408.opt b/mysql-test/suite/innodb/t/innodb-mdev-7408.opt
new file mode 100644
index 00000000000..1c256483e10
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb-mdev-7408.opt
@@ -0,0 +1,2 @@
+--innodb_ft_default_stopword
+
diff --git a/mysql-test/suite/innodb/t/innodb-mdev-7408.test b/mysql-test/suite/innodb/t/innodb-mdev-7408.test
new file mode 100644
index 00000000000..d1cd1879bb1
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb-mdev-7408.test
@@ -0,0 +1,16 @@
+--source include/have_innodb.inc
+
+select @@global.innodb_ft_server_stopword_table;
+CREATE TABLE `stop_it-IT` ENGINE = InnoDB SELECT * FROM information_schema.INNODB_FT_DEFAULT_STOPWORD;
+--error 1231
+SET @@global.innodb_ft_server_stopword_table = 'test/stop_it-IT';
+--error 0,1231
+SET @@global.innodb_ft_server_stopword_table = 'test/stop_it@002dIT';
+drop table `stop_it-IT`;
+
+CREATE TABLE stop_it ENGINE = InnoDB SELECT * FROM information_schema.INNODB_FT_DEFAULT_STOPWORD;
+SET @@global.innodb_ft_server_stopword_table = 'test/stop_it';
+
+SET @@global.innodb_ft_server_stopword_table = NULL;
+
+drop table stop_it;
diff --git a/mysql-test/suite/innodb/t/innodb-mdev-7513.test b/mysql-test/suite/innodb/t/innodb-mdev-7513.test
new file mode 100644
index 00000000000..b929ea14781
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb-mdev-7513.test
@@ -0,0 +1,220 @@
+-- source include/have_innodb.inc
+-- source include/not_embedded.inc
+
+# MDEV-7513: ib_warn_row_too_big dereferences null thd
+
+call mtr.add_suppression("Row size too large (> 8126)*");
+
+--disable_warnings
+CREATE TABLE t1 ( text1 TEXT,
+text2 TEXT,
+text3 TEXT,
+text4 TEXT,
+text5 TEXT,
+text6 TEXT,
+text7 TEXT,
+text8 TEXT,
+text9 TEXT,
+text10 TEXT,
+text11 TEXT,
+text12 TEXT,
+text13 TEXT,
+text14 TEXT,
+text15 TEXT,
+text16 TEXT,
+text17 TEXT,
+text18 TEXT,
+text19 TEXT,
+text20 TEXT,
+text21 TEXT,
+text22 TEXT,
+text23 TEXT,
+text24 TEXT,
+text25 TEXT,
+text26 TEXT,
+text27 TEXT,
+text28 TEXT,
+text29 TEXT,
+text30 TEXT,
+text31 TEXT,
+text32 TEXT,
+text33 TEXT,
+text34 TEXT,
+text35 TEXT,
+text36 TEXT,
+text37 TEXT,
+text38 TEXT,
+text39 TEXT,
+text40 TEXT,
+text41 TEXT,
+text42 TEXT,
+text43 TEXT,
+text44 TEXT,
+text45 TEXT,
+text46 TEXT,
+text47 TEXT,
+text48 TEXT,
+text49 TEXT,
+text50 TEXT,
+text51 TEXT,
+text52 TEXT,
+text53 TEXT,
+text54 TEXT,
+text55 TEXT,
+text56 TEXT,
+text57 TEXT,
+text58 TEXT,
+text59 TEXT,
+text60 TEXT,
+text61 TEXT,
+text62 TEXT,
+text63 TEXT,
+text64 TEXT,
+text65 TEXT,
+text66 TEXT,
+text67 TEXT,
+text68 TEXT,
+text69 TEXT,
+text70 TEXT,
+text71 TEXT,
+text72 TEXT,
+text73 TEXT,
+text74 TEXT,
+text75 TEXT,
+text76 TEXT,
+text77 TEXT,
+text78 TEXT,
+text79 TEXT,
+text80 TEXT,
+text81 TEXT,
+text82 TEXT,
+text83 TEXT,
+text84 TEXT,
+text85 TEXT,
+text86 TEXT,
+text87 TEXT,
+text88 TEXT,
+text89 TEXT,
+text90 TEXT,
+text91 TEXT,
+text92 TEXT,
+text93 TEXT,
+text94 TEXT,
+text95 TEXT,
+text96 TEXT,
+text97 TEXT,
+text98 TEXT,
+text99 TEXT,
+text100 TEXT,
+text101 TEXT,
+text102 TEXT,
+text103 TEXT,
+text104 TEXT,
+text105 TEXT,
+text106 TEXT,
+text107 TEXT,
+text108 TEXT,
+text109 TEXT,
+text110 TEXT,
+text111 TEXT,
+text112 TEXT,
+text113 TEXT,
+text114 TEXT,
+text115 TEXT,
+text116 TEXT,
+text117 TEXT,
+text118 TEXT,
+text119 TEXT,
+text120 TEXT,
+text121 TEXT,
+text122 TEXT,
+text123 TEXT,
+text124 TEXT,
+text125 TEXT,
+text126 TEXT,
+text127 TEXT,
+text128 TEXT,
+text129 TEXT,
+text130 TEXT,
+text131 TEXT,
+text132 TEXT,
+text133 TEXT,
+text134 TEXT,
+text135 TEXT,
+text136 TEXT,
+text137 TEXT,
+text138 TEXT,
+text139 TEXT,
+text140 TEXT,
+text141 TEXT,
+text142 TEXT,
+text143 TEXT,
+text144 TEXT,
+text145 TEXT,
+text146 TEXT,
+text147 TEXT,
+text148 TEXT,
+text149 TEXT,
+text150 TEXT,
+text151 TEXT,
+text152 TEXT,
+text153 TEXT,
+text154 TEXT,
+text155 TEXT,
+text156 TEXT,
+text157 TEXT,
+text158 TEXT,
+text159 TEXT,
+text160 TEXT,
+text161 TEXT,
+text162 TEXT,
+text163 TEXT,
+text164 TEXT,
+text165 TEXT,
+text166 TEXT,
+text167 TEXT,
+text168 TEXT,
+text169 TEXT,
+text170 TEXT,
+text171 TEXT,
+text172 TEXT,
+text173 TEXT,
+text174 TEXT,
+text175 TEXT,
+text176 TEXT,
+text177 TEXT,
+text178 TEXT,
+text179 TEXT,
+text180 TEXT,
+text181 TEXT,
+text182 TEXT,
+text183 TEXT,
+text184 TEXT,
+text185 TEXT,
+text186 TEXT,
+text187 TEXT,
+text188 TEXT,
+text189 TEXT,
+text190 TEXT,
+text191 TEXT,
+text192 TEXT,
+text193 TEXT,
+text194 TEXT,
+text195 TEXT,
+text196 TEXT,
+text197 TEXT
+) ENGINE = InnoDB;
+
+INSERT INTO t1 VALUES ('abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef');
+--enable_warnings
+
+DELETE FROM t1 WHERE text1 = 'abcdef';
+
+--source include/restart_mysqld.inc
+
+--disable_warnings
+SELECT * from t1;
+--enable_warnings
+
+DROP TABLE t1;
+
diff --git a/mysql-test/suite/innodb/t/innodb-mdev7046.test b/mysql-test/suite/innodb/t/innodb-mdev7046.test
index 4033f284e65..b4085228e02 100644
--- a/mysql-test/suite/innodb/t/innodb-mdev7046.test
+++ b/mysql-test/suite/innodb/t/innodb-mdev7046.test
@@ -1,5 +1,7 @@
--source include/have_innodb.inc
--source include/have_partition.inc
+# Test causes OS error printout
+--source include/not_windows.inc
--disable_query_log
--disable_result_log
diff --git a/mysql-test/suite/innodb/t/innodb-virtual-columns.test b/mysql-test/suite/innodb/t/innodb-virtual-columns.test
new file mode 100644
index 00000000000..368c6fc8cb1
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb-virtual-columns.test
@@ -0,0 +1,302 @@
+--source include/have_innodb.inc
+
+#
+# MDEV-7367: Updating a virtual column corrupts table which crashes server
+# MySQL table columns contains virtual columns but InnoDB table
+# definition does not.
+#
+CREATE TABLE IF NOT EXISTS gso_grad_supr (
+ term char(4) NOT NULL DEFAULT '',
+ uw_id int(8) UNSIGNED NOT NULL DEFAULT 0,
+ plan varchar(10) NOT NULL DEFAULT '',
+ wdraw_rsn varchar(4) NOT NULL DEFAULT '',
+ admit_term char(4) NOT NULL DEFAULT '',
+ CONSTRAINT gso_grad_supr_pky PRIMARY KEY (uw_id, term)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+INSERT INTO `gso_grad_supr` VALUES ('1031',2,'CSM','','1009');
+INSERT INTO `gso_grad_supr` VALUES ('1035',2,'CSM','ACAD','1009');
+
+CREATE TABLE IF NOT EXISTS grad_degree (
+ student_id int(8) UNSIGNED NOT NULL,
+ plan varchar(10) NOT NULL,
+ admit_term char(4) NOT NULL,
+ wdraw_rsn varchar(4) NOT NULL DEFAULT '',
+ ofis_deg_status varchar(15) AS (
+ CASE
+ WHEN wdraw_rsn = '' THEN 'In progress'
+ WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed'
+ ELSE 'Not Completed'
+ END) VIRTUAL,
+ deg_start_term char(4) NOT NULL DEFAULT '' COMMENT 'Educated guess at the beginning of the data',
+ deg_as_of_term char(4) NOT NULL COMMENT 'In most cases also end term',
+ CONSTRAINT grad_degree_stu_plan_admit_pky PRIMARY KEY (student_id, plan, admit_term)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE INDEX grad_degree_wdraw_rsn_ndx ON grad_degree (wdraw_rsn);
+CREATE INDEX grad_degree_as_of_term_ndx ON grad_degree (deg_as_of_term);
+
+INSERT IGNORE grad_degree (
+ student_id,
+ plan,
+ admit_term,
+ wdraw_rsn,
+ deg_start_term,
+ deg_as_of_term
+)
+SELECT
+ ggs.uw_id AS c_student_id,
+ ggs.plan,
+ ggs.admit_term,
+ ggs.wdraw_rsn,
+ IF( (SELECT COUNT(*) FROM grad_degree AS gd WHERE gd.student_id = ggs.uw_id AND gd.admit_term = ggs.admit_term) > 0, ggs.term, ggs.admit_term ) AS c_deg_start_term,
+ ggs.term AS c_as_of_term
+FROM gso_grad_supr AS ggs
+LEFT OUTER JOIN
+ grad_degree AS gd
+ ON ( gd.student_id = ggs.uw_id AND gd.plan = ggs.plan AND gd.admit_term = ggs.admit_term )
+WHERE
+ ggs.term = 1031 AND
+ gd.student_id IS NULL
+;
+
+UPDATE grad_degree AS gd
+INNER JOIN
+ gso_grad_supr AS ggs
+ ON ( gd.student_id = ggs.uw_id AND gd.plan = ggs.plan AND gd.admit_term = ggs.admit_term )
+SET
+ gd.wdraw_rsn = ggs.wdraw_rsn,
+ gd.deg_as_of_term = 1035
+WHERE
+ gd.wdraw_rsn NOT IN ('DCMP', 'TRDC') AND
+ ggs.term = 1035
+;
+
+drop table grad_degree;
+
+#
+# Test with more virtual columns so that MySQL table has
+# more columns than InnoDB and index definition is out
+# of number of actual InnoDB columns.
+#
+CREATE TABLE IF NOT EXISTS grad_degree (
+ student_id int(8) UNSIGNED NOT NULL,
+ plan varchar(10) NOT NULL,
+ admit_term char(4) NOT NULL,
+ wdraw_rsn varchar(4) NOT NULL DEFAULT '',
+ ofis_deg_status varchar(15) AS (
+ CASE
+ WHEN wdraw_rsn = '' THEN 'In progress'
+ WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed'
+ ELSE 'Not Completed'
+ END) VIRTUAL,
+ ofis_deg_status2 varchar(15) AS (
+ CASE
+ WHEN wdraw_rsn = '' THEN 'In progress2'
+ WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed2'
+ ELSE 'Not Completed2'
+ END) VIRTUAL,
+ ofis_deg_status3 varchar(15) AS (
+ CASE
+ WHEN wdraw_rsn = '' THEN 'In progress3'
+ WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed3'
+ ELSE 'Not Completed3'
+ END) VIRTUAL,
+ ofis_deg_status4 varchar(15) AS (
+ CASE
+ WHEN wdraw_rsn = '' THEN 'In progress4'
+ WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed4'
+ ELSE 'Not Completed4'
+ END) VIRTUAL,
+ ofis_deg_status5 varchar(15) AS (
+ CASE
+ WHEN wdraw_rsn = '' THEN 'In progress5'
+ WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed5'
+ ELSE 'Not Completed5'
+ END) VIRTUAL,
+ ofis_deg_status6 varchar(15) AS (
+ CASE
+ WHEN wdraw_rsn = '' THEN 'In progress6'
+ WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed6'
+ ELSE 'Not Completed6'
+ END) VIRTUAL,
+ ofis_deg_status7 varchar(15) AS (
+ CASE
+ WHEN wdraw_rsn = '' THEN 'In progress7'
+ WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed7'
+ ELSE 'Not Completed7'
+ END) VIRTUAL,
+ ofis_deg_status8 varchar(15) AS (
+ CASE
+ WHEN wdraw_rsn = '' THEN 'In progress8'
+ WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed8'
+ ELSE 'Not Completed8'
+ END) VIRTUAL,
+ deg_start_term char(4) NOT NULL DEFAULT '' COMMENT 'Educated guess at the beginning of the data',
+ deg_as_of_term char(4) NOT NULL COMMENT 'In most cases also end term',
+ CONSTRAINT grad_degree_stu_plan_admit_pky PRIMARY KEY (student_id, plan, admit_term)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE INDEX grad_degree_wdraw_rsn_ndx ON grad_degree (wdraw_rsn);
+CREATE INDEX grad_degree_as_of_term_ndx ON grad_degree (deg_as_of_term);
+
+INSERT IGNORE grad_degree (
+ student_id,
+ plan,
+ admit_term,
+ wdraw_rsn,
+ deg_start_term,
+ deg_as_of_term
+)
+SELECT
+ ggs.uw_id AS c_student_id,
+ ggs.plan,
+ ggs.admit_term,
+ ggs.wdraw_rsn,
+ IF( (SELECT COUNT(*) FROM grad_degree AS gd WHERE gd.student_id = ggs.uw_id AND gd.admit_term = ggs.admit_term) > 0, ggs.term, ggs.admit_term ) AS c_deg_start_term,
+ ggs.term AS c_as_of_term
+FROM gso_grad_supr AS ggs
+LEFT OUTER JOIN
+ grad_degree AS gd
+ ON ( gd.student_id = ggs.uw_id AND gd.plan = ggs.plan AND gd.admit_term = ggs.admit_term )
+WHERE
+ ggs.term = 1031 AND
+ gd.student_id IS NULL
+;
+
+UPDATE grad_degree AS gd
+INNER JOIN
+ gso_grad_supr AS ggs
+ ON ( gd.student_id = ggs.uw_id AND gd.plan = ggs.plan AND gd.admit_term = ggs.admit_term )
+SET
+ gd.wdraw_rsn = ggs.wdraw_rsn,
+ gd.deg_as_of_term = 1035
+WHERE
+ gd.wdraw_rsn NOT IN ('DCMP', 'TRDC') AND
+ ggs.term = 1035
+;
+
+#
+# Verify that indexes can be dropped
+#
+ALTER TABLE grad_degree DROP INDEX grad_degree_wdraw_rsn_ndx;
+
+#
+# Verify that we can drop columns
+#
+ALTER TABLE grad_degree DROP COLUMN deg_start_term;
+
+SHOW CREATE TABLE grad_degree;
+
+DROP TABLE grad_degree;
+
+#
+# Verify after dropping virtual columns
+#
+CREATE TABLE IF NOT EXISTS grad_degree (
+ student_id int(8) UNSIGNED NOT NULL,
+ plan varchar(10) NOT NULL,
+ admit_term char(4) NOT NULL,
+ wdraw_rsn varchar(4) NOT NULL DEFAULT '',
+ ofis_deg_status varchar(15) AS (
+ CASE
+ WHEN wdraw_rsn = '' THEN 'In progress'
+ WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed'
+ ELSE 'Not Completed'
+ END) VIRTUAL,
+ ofis_deg_status2 varchar(15) AS (
+ CASE
+ WHEN wdraw_rsn = '' THEN 'In progress2'
+ WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed2'
+ ELSE 'Not Completed2'
+ END) VIRTUAL,
+ ofis_deg_status3 varchar(15) AS (
+ CASE
+ WHEN wdraw_rsn = '' THEN 'In progress3'
+ WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed3'
+ ELSE 'Not Completed3'
+ END) VIRTUAL,
+ ofis_deg_status4 varchar(15) AS (
+ CASE
+ WHEN wdraw_rsn = '' THEN 'In progress4'
+ WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed4'
+ ELSE 'Not Completed4'
+ END) VIRTUAL,
+ ofis_deg_status5 varchar(15) AS (
+ CASE
+ WHEN wdraw_rsn = '' THEN 'In progress5'
+ WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed5'
+ ELSE 'Not Completed5'
+ END) VIRTUAL,
+ ofis_deg_status6 varchar(15) AS (
+ CASE
+ WHEN wdraw_rsn = '' THEN 'In progress6'
+ WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed6'
+ ELSE 'Not Completed6'
+ END) VIRTUAL,
+ ofis_deg_status7 varchar(15) AS (
+ CASE
+ WHEN wdraw_rsn = '' THEN 'In progress7'
+ WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed7'
+ ELSE 'Not Completed7'
+ END) VIRTUAL,
+ ofis_deg_status8 varchar(15) AS (
+ CASE
+ WHEN wdraw_rsn = '' THEN 'In progress8'
+ WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed8'
+ ELSE 'Not Completed8'
+ END) VIRTUAL,
+ deg_start_term char(4) NOT NULL DEFAULT '' COMMENT 'Educated guess at the beginning of the data',
+ deg_as_of_term char(4) NOT NULL COMMENT 'In most cases also end term',
+ CONSTRAINT grad_degree_stu_plan_admit_pky PRIMARY KEY (student_id, plan, admit_term)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE INDEX grad_degree_wdraw_rsn_ndx ON grad_degree (wdraw_rsn);
+
+ALTER TABLE grad_degree DROP COLUMN ofis_deg_status2, DROP COLUMN ofis_deg_status3,
+DROP COLUMN ofis_deg_status4, DROP COLUMN ofis_deg_status5, DROP COLUMN ofis_deg_status6,
+DROP COLUMN ofis_deg_status7, DROP COLUMN ofis_deg_status8;
+
+CREATE INDEX grad_degree_as_of_term_ndx ON grad_degree (deg_as_of_term);
+
+INSERT IGNORE grad_degree (
+ student_id,
+ plan,
+ admit_term,
+ wdraw_rsn,
+ deg_start_term,
+ deg_as_of_term
+)
+SELECT
+ ggs.uw_id AS c_student_id,
+ ggs.plan,
+ ggs.admit_term,
+ ggs.wdraw_rsn,
+ IF( (SELECT COUNT(*) FROM grad_degree AS gd WHERE gd.student_id = ggs.uw_id AND gd.admit_term = ggs.admit_term) > 0, ggs.term, ggs.admit_term ) AS c_deg_start_term,
+ ggs.term AS c_as_of_term
+FROM gso_grad_supr AS ggs
+LEFT OUTER JOIN
+ grad_degree AS gd
+ ON ( gd.student_id = ggs.uw_id AND gd.plan = ggs.plan AND gd.admit_term = ggs.admit_term )
+WHERE
+ ggs.term = 1031 AND
+ gd.student_id IS NULL
+;
+
+UPDATE grad_degree AS gd
+INNER JOIN
+ gso_grad_supr AS ggs
+ ON ( gd.student_id = ggs.uw_id AND gd.plan = ggs.plan AND gd.admit_term = ggs.admit_term )
+SET
+ gd.wdraw_rsn = ggs.wdraw_rsn,
+ gd.deg_as_of_term = 1035
+WHERE
+ gd.wdraw_rsn NOT IN ('DCMP', 'TRDC') AND
+ ggs.term = 1035
+;
+
+select * from grad_degree;
+select * from gso_grad_supr;
+
+drop table grad_degree;
+drop table gso_grad_supr;
diff --git a/mysql-test/suite/innodb/t/innodb-xa.test b/mysql-test/suite/innodb/t/innodb-xa.test
new file mode 100644
index 00000000000..d94cd75aa14
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb-xa.test
@@ -0,0 +1,17 @@
+--source include/have_innodb.inc
+
+--disable_abort_on_error
+xa rollback 'xid2';
+drop table if exists t1;
+create table t1(a int)engine=innodb;
+rollback;
+xa start 'xid2';
+insert into `t1` values (1);
+savepoint `sv1`;
+xa end 'xid2';
+start transaction;
+xa prepare 'xid2';
+release savepoint `sv1`;
+xa commit 'xid2';
+drop table t1;
+
diff --git a/mysql-test/suite/innodb/t/innodb_blob_unrecoverable_crash.test b/mysql-test/suite/innodb/t/innodb_blob_unrecoverable_crash.test
new file mode 100644
index 00000000000..16fb570737d
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_blob_unrecoverable_crash.test
@@ -0,0 +1,55 @@
+--source include/not_embedded.inc
+--source include/not_crashrep.inc
+--source include/have_innodb.inc
+
+call mtr.add_suppression("InnoDB: The total blob data length");
+
+let $old_max_allowed_packet = `select @@max_allowed_packet`;
+SET GLOBAL max_allowed_packet = 100*1024*1024;
+
+--echo # Connection big_packets:
+connect(big_packets,localhost,root,,);
+connection big_packets;
+
+CREATE TABLE t1 (a BIGINT PRIMARY KEY, b LONGBLOB) ENGINE=InnoDB;
+
+# Insert a few rows (it doesn't really matter how many). These transactions
+# are committed once they are acked, so they should not be lost.
+INSERT INTO t1 (a, b) VALUES (1, '1');
+INSERT INTO t1 (a, b) VALUES (2, '2');
+INSERT INTO t1 (a, b) VALUES (3, '3');
+INSERT INTO t1 (a, b) VALUES (4, '4');
+INSERT INTO t1 (a, b) VALUES (5, '5');
+
+# The BLOB insert will fail, and should disappear. However all data committed
+# up to this point should not be lost.
+start transaction;
+--replace_regex /\(> [0-9]*\)/(> ####)/
+--error ER_TOO_BIG_ROWSIZE
+INSERT INTO t1 (a, b) VALUES (6, REPEAT('a', 20*1024*1024));
+
+--echo # Connection default:
+connection default;
+
+# We expect a restart.
+--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+
+--echo # Quick shutdown and restart server
+--shutdown_server 0
+
+# Wait for the server to come back up, and reconnect.
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+
+--echo # Connection default:
+connection default;
+
+# We should see (1,2,3,4,5) here.
+SELECT a FROM t1;
+
+# Clean up.
+DROP TABLE t1;
+
+--disable_query_log
+eval set global max_allowed_packet = $old_max_allowed_packet;
+--enable_query_log
diff --git a/mysql-test/suite/innodb/t/innodb_bug34300.test b/mysql-test/suite/innodb/t/innodb_bug34300.test
index 800f326707d..13c708b48d6 100644
--- a/mysql-test/suite/innodb/t/innodb_bug34300.test
+++ b/mysql-test/suite/innodb/t/innodb_bug34300.test
@@ -5,6 +5,11 @@
-- source include/have_innodb.inc
+if (`select plugin_auth_version <= "5.6.22-MariaDB-72.0" from information_schema.plugins where plugin_name='innodb'`)
+{
+ --skip Not fixed in XtraDB as of 5.6.22-MariaDB-72.0 or earlier
+}
+
-- disable_query_log
-- disable_result_log
diff --git a/mysql-test/suite/innodb/t/innodb_corrupt_bit.test b/mysql-test/suite/innodb/t/innodb_corrupt_bit.test
index 12c560934ef..d6d77076b83 100644
--- a/mysql-test/suite/innodb/t/innodb_corrupt_bit.test
+++ b/mysql-test/suite/innodb/t/innodb_corrupt_bit.test
@@ -4,11 +4,6 @@
-- source include/have_innodb.inc
-- source include/have_innodb_16k.inc
-if (`select plugin_auth_version <= "5.5.40-MariaDB-36.1" from information_schema.plugins where plugin_name='innodb'`)
-{
- --skip Not fixed in XtraDB as of 5.5.40-MariaDB-36.1 or earlier
-}
-
# Issues with innodb_change_buffering_debug on Windows, so the test scenario
# cannot be created on windows
--source include/not_windows.inc
@@ -30,10 +25,10 @@ SET GLOBAL innodb_change_buffering_debug = 1;
SET UNIQUE_CHECKS=0;
CREATE DATABASE pad;
-let $i=345;
+let $i=338;
while ($i)
{
- --eval CREATE TABLE pad.t$i (a INT PRIMARY KEY) ENGINE=InnoDB;
+--eval CREATE TABLE pad.t$i(a INT PRIMARY KEY)ENGINE=InnoDB;
dec $i;
}
diff --git a/mysql-test/suite/innodb/t/insert_debug.test b/mysql-test/suite/innodb/t/insert_debug.test
index 666b634bef9..36ceba2ee8b 100644
--- a/mysql-test/suite/innodb/t/insert_debug.test
+++ b/mysql-test/suite/innodb/t/insert_debug.test
@@ -2,11 +2,6 @@
--source include/have_debug.inc
--source include/have_partition.inc
-if (`select plugin_auth_version < "5.6.22" from information_schema.plugins where plugin_name='innodb'`)
-{
- --skip Not fixed in InnoDB/XtraDB as of 5.6.21 or earlier
-}
-
--echo #
--echo # Bug#19904003 INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG=1
--echo # CAUSES INFINITE PAGE SPLIT
diff --git a/mysql-test/suite/innodb/t/sp_temp_table.test b/mysql-test/suite/innodb/t/sp_temp_table.test
index 9a6be85fd7e..b2883f551b9 100644
--- a/mysql-test/suite/innodb/t/sp_temp_table.test
+++ b/mysql-test/suite/innodb/t/sp_temp_table.test
@@ -1,11 +1,6 @@
--source include/have_innodb.inc
--source include/big_test.inc
-if (`select plugin_auth_version < "5.6.22" from information_schema.plugins where plugin_name='innodb'`)
-{
- --skip Not fixed in InnoDB/XtraDB as of 5.6.21 or earlier
-}
-
--echo #
--echo # Bug #19306524 FAILING ASSERTION WITH TEMP TABLE FOR A PROCEDURE
--echo # CALLED FROM A FUNCTION
diff --git a/mysql-test/suite/innodb/t/strict_mode.test b/mysql-test/suite/innodb/t/strict_mode.test
index 9b115091f84..86b56a09c0e 100644
--- a/mysql-test/suite/innodb/t/strict_mode.test
+++ b/mysql-test/suite/innodb/t/strict_mode.test
@@ -1,10 +1,5 @@
--source include/have_innodb.inc
-if (`select plugin_auth_version <= "5.5.40-MariaDB-36.1" from information_schema.plugins where plugin_name='innodb'`)
-{
- --skip Not fixed in XtraDB as of 5.5.40-MariaDB-36.1 or earlier
-}
-
--echo #
--echo # Bug #17852083 PRINT A WARNING WHEN DDL HAS AN ERROR IN
--echo # INNODB_STRICT_MODE = 1
diff --git a/mysql-test/suite/innodb/t/xa_recovery.test b/mysql-test/suite/innodb/t/xa_recovery.test
new file mode 100644
index 00000000000..837b33cb3c4
--- /dev/null
+++ b/mysql-test/suite/innodb/t/xa_recovery.test
@@ -0,0 +1,47 @@
+if (`select plugin_auth_version <= "5.6.24" from information_schema.plugins where plugin_name='innodb'`)
+{
+ --skip Not fixed in InnoDB as of 5.6.24 or earlier
+}
+--source include/have_innodb.inc
+# Embedded server does not support restarting.
+--source include/not_embedded.inc
+
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+connect (con1,localhost,root);
+XA START 'x'; UPDATE t1 set a=2; XA END 'x'; XA PREPARE 'x';
+connection default;
+
+call mtr.add_suppression("Found 1 prepared XA transactions");
+
+# Kill and restart the server.
+-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+-- shutdown_server 0
+-- source include/wait_until_disconnected.inc
+
+-- exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+-- enable_reconnect
+-- source include/wait_until_connected_again.inc
+-- disable_reconnect
+
+disconnect con1;
+connect (con1,localhost,root);
+--send SELECT * FROM t1 LOCK IN SHARE MODE
+
+connection default;
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = 'Sending data' and
+ info = 'SELECT * FROM t1 LOCK IN SHARE MODE';
+--source include/wait_condition.inc
+
+--source include/restart_mysqld.inc
+
+disconnect con1;
+
+SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+SELECT * FROM t1;
+XA ROLLBACK 'x';
+SELECT * FROM t1;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/manual/r/rpl_replication_delay.result b/mysql-test/suite/manual/r/rpl_replication_delay.result
deleted file mode 100644
index 73dd77cc647..00000000000
--- a/mysql-test/suite/manual/r/rpl_replication_delay.result
+++ /dev/null
@@ -1,25 +0,0 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-# Second_behind reports 0
-Seconds_Behind_Master 0
-drop table if exists t1;
-Warnings:
-Note 1051 Unknown table 't1'
-create table t1 (f1 int);
-flush logs /* contaminate rli->last_master_timestamp */;
-lock table t1 write;
-insert into t1 values (1);
-# bug emulated: reports slave threads starting time about 3*3 not 3 secs
-Seconds_Behind_Master 9
-unlock tables;
-flush logs /* this time rli->last_master_timestamp is not affected */;
-lock table t1 write;
-insert into t1 values (2);
-# reports the correct diff with master query time about 3+3 secs
-Seconds_Behind_Master 7
-unlock tables;
-drop table t1;
diff --git a/mysql-test/suite/manual/t/rpl_replication_delay-slave.opt b/mysql-test/suite/manual/t/rpl_replication_delay-slave.opt
deleted file mode 100644
index 24a4c5952fe..00000000000
--- a/mysql-test/suite/manual/t/rpl_replication_delay-slave.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose-debug=d,let_first_flush_log_change_timestamp
diff --git a/mysql-test/suite/manual/t/rpl_replication_delay.test b/mysql-test/suite/manual/t/rpl_replication_delay.test
deleted file mode 100644
index f2b2da6f53c..00000000000
--- a/mysql-test/suite/manual/t/rpl_replication_delay.test
+++ /dev/null
@@ -1,63 +0,0 @@
-#
-# Testing replication delay reporting (bug#29309)
-# there is an unavoidable non-determinism in the test
-# please compare the results with the comments
-#
-
-
-source include/master-slave.inc;
-
-connection slave;
-
---echo # Second_behind reports 0
-let $status_items= Seconds_Behind_Master;
-source include/show_slave_status.inc;
-sleep 3;
-
-### bug emulation
-
-connection master;
-drop table if exists t1;
-create table t1 (f1 int);
-sleep 3;
-
-#connection slave;
-sync_slave_with_master;
-flush logs /* contaminate rli->last_master_timestamp */;
-
-connection slave;
-lock table t1 write;
-
-connection master;
-insert into t1 values (1);
-
-sleep 3;
-
-connection slave;
---echo # bug emulated: reports slave threads starting time about 3*3 not 3 secs
-source include/show_slave_status.inc;
-unlock tables;
-
-connection master;
-sync_slave_with_master;
-
-### bugfix
-
-
-connection slave;
-flush logs /* this time rli->last_master_timestamp is not affected */;
-lock table t1 write;
-
-connection master;
-insert into t1 values (2);
-sleep 3;
-
-connection slave;
---echo # reports the correct diff with master query time about 3+3 secs
-source include/show_slave_status.inc;
-unlock tables;
-
-connection master;
-drop table t1;
-
---source include/rpl_end.inc
diff --git a/mysql-test/suite/maria/optimize.result b/mysql-test/suite/maria/optimize.result
index 9cce55d6199..a78e8e469aa 100644
--- a/mysql-test/suite/maria/optimize.result
+++ b/mysql-test/suite/maria/optimize.result
@@ -6,3 +6,14 @@ OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
drop table t1;
+#
+# MDEV-3870 - Valgrind warnings on OPTIMIZE MyISAM or Aria TABLE with
+# disabled keys
+#
+CREATE TABLE t1 (a INT, KEY(a)) ENGINE=Aria;
+INSERT INTO t1 VALUES (4),(3),(1),(0);
+ALTER TABLE t1 DISABLE KEYS;
+OPTIMIZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+DROP TABLE t1;
diff --git a/mysql-test/suite/maria/optimize.test b/mysql-test/suite/maria/optimize.test
index 6b310b1d1a6..b1fc250cd29 100644
--- a/mysql-test/suite/maria/optimize.test
+++ b/mysql-test/suite/maria/optimize.test
@@ -160,3 +160,13 @@ INSERT /*! IGNORE */ INTO t1 VALUES ('urxjxqvwabikpugvexxbxdpxjkeqiuhhuadbcuhoz
check table t1;
OPTIMIZE TABLE t1;
drop table t1;
+
+--echo #
+--echo # MDEV-3870 - Valgrind warnings on OPTIMIZE MyISAM or Aria TABLE with
+--echo # disabled keys
+--echo #
+CREATE TABLE t1 (a INT, KEY(a)) ENGINE=Aria;
+INSERT INTO t1 VALUES (4),(3),(1),(0);
+ALTER TABLE t1 DISABLE KEYS;
+OPTIMIZE TABLE t1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/multi_source/multisource.result b/mysql-test/suite/multi_source/multisource.result
index 94677e84cc8..d9689f759bf 100644
--- a/mysql-test/suite/multi_source/multisource.result
+++ b/mysql-test/suite/multi_source/multisource.result
@@ -9,15 +9,36 @@ master_user='root';
start slave 'master1';
set default_master_connection = 'master1';
include/wait_for_slave_to_start.inc
-show slave 'master1' status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos
-Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 313 mysqld-relay-bin-master1.000002 601 master-bin.000001 Yes Yes 0 0 313 907 None 0 No 0 No 0 0 1 No
-show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos
-Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 313 mysqld-relay-bin-master1.000002 601 master-bin.000001 Yes Yes 0 0 313 907 None 0 No 0 No 0 0 1 No
-show all slaves status;
-Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos
-master1 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 313 mysqld-relay-bin-master1.000002 601 master-bin.000001 Yes Yes 0 0 313 907 None 0 No 0 No 0 0 1 No 0 1073741824 7 0 60.000
+#
+# Checking SHOW SLAVE 'master1' STATUS
+#
+Master_Port = 'MYPORT_1'
+Relay_Log_File = 'mysqld-relay-bin-master1.000002'
+Slave_IO_Running = 'Yes'
+Slave_SQL_Running = 'Yes'
+Last_Errno = '0'
+Last_SQL_Errno = '0'
+#
+# Checking SHOW SLAVE STATUS
+#
+Master_Port = 'MYPORT_1'
+Relay_Log_File = 'mysqld-relay-bin-master1.000002'
+Slave_IO_Running = 'Yes'
+Slave_SQL_Running = 'Yes'
+Last_Errno = '0'
+Last_SQL_Errno = '0'
+#
+# Checking SHOW ALL SLAVES STATUS
+#
+Connection_name = 'master1'
+Master_Port = 'MYPORT_1'
+Relay_Log_File = 'mysqld-relay-bin-master1.000002'
+Slave_IO_Running = 'Yes'
+Slave_SQL_Running = 'Yes'
+Last_Errno = '0'
+Last_SQL_Errno = '0'
+Slave_heartbeat_period = '60.000'
+#
drop database if exists db1;
create database db1;
use db1;
@@ -74,10 +95,26 @@ master_host='127.0.0.1',
master_user='root';
start slave;
include/wait_for_slave_to_start.inc
-show all slaves status;
-Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos
- Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 313 mysqld-relay-bin.000002 601 master-bin.000001 Yes Yes 0 0 313 899 None 0 No 0 No 0 0 2 No 0 1073741824 7 0 60.000 0-1-4
-master1 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 988 mysqld-relay-bin-master1.000002 1276 master-bin.000001 Yes Yes 0 0 988 1582 None 0 No 0 No 0 0 1 No 0 1073741824 17 0 60.000 0-1-4
+#
+# Checking SHOW ALL SLAVES STATUS
+#
+Connection_name = ''
+Connection_name = 'master1'
+Master_Port = 'MYPORT_2'
+Master_Port = 'MYPORT_1'
+Relay_Log_File = 'mysqld-relay-bin.000002'
+Relay_Log_File = 'mysqld-relay-bin-master1.000002'
+Slave_IO_Running = 'Yes'
+Slave_IO_Running = 'Yes'
+Slave_SQL_Running = 'Yes'
+Slave_SQL_Running = 'Yes'
+Last_Errno = '0'
+Last_Errno = '0'
+Last_SQL_Errno = '0'
+Last_SQL_Errno = '0'
+Slave_heartbeat_period = '60.000'
+Slave_heartbeat_period = '60.000'
+#
insert into t1 (f1) values ('three');
drop database if exists db2;
create database db2;
@@ -104,10 +141,26 @@ Log_name File_size
master-bin.000002 367
insert into t1 (f1) values ('four');
create table db1.t3 (f1 int) engine=InnoDB;
-show all slaves status;
-Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos
- Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 921 mysqld-relay-bin.000002 1209 master-bin.000001 Yes Yes 0 0 921 1507 None 0 No 0 No 0 0 2 No 0 1073741824 17 0 60.000 0-1-7
-master1 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000002 740 mysqld-relay-bin-master1.000004 1028 master-bin.000002 Yes Yes 0 0 740 1378 None 0 No 0 No 0 0 1 No 0 1073741824 37 0 60.000 0-1-7
+#
+# Checking SHOW ALL SLAVES STATUS
+#
+Connection_name = ''
+Connection_name = 'master1'
+Master_Port = 'MYPORT_2'
+Master_Port = 'MYPORT_1'
+Relay_Log_File = 'mysqld-relay-bin.000002'
+Relay_Log_File = 'mysqld-relay-bin-master1.000004'
+Slave_IO_Running = 'Yes'
+Slave_IO_Running = 'Yes'
+Slave_SQL_Running = 'Yes'
+Slave_SQL_Running = 'Yes'
+Last_Errno = '0'
+Last_Errno = '0'
+Last_SQL_Errno = '0'
+Last_SQL_Errno = '0'
+Slave_heartbeat_period = '60.000'
+Slave_heartbeat_period = '60.000'
+#
select * from db1.t1;
i f1
1 one
diff --git a/mysql-test/suite/multi_source/multisource.test b/mysql-test/suite/multi_source/multisource.test
index 754dc9fa650..c99db802981 100644
--- a/mysql-test/suite/multi_source/multisource.test
+++ b/mysql-test/suite/multi_source/multisource.test
@@ -49,12 +49,28 @@ let $field= Slave_IO_State;
let $condition= = 'Waiting for master to send event';
--source include/wait_show_condition.inc
---replace_result $SERVER_MYPORT_1 MYPORT_1
-show slave 'master1' status;
---replace_result $SERVER_MYPORT_1 MYPORT_1
-show slave status;
---replace_result $SERVER_MYPORT_1 MYPORT_1
-show all slaves status;
+--echo #
+--echo # Checking SHOW SLAVE 'master1' STATUS
+--echo #
+--let $status_items= Master_Port, Relay_Log_File, Slave_IO_Running, Slave_SQL_Running, Last_Errno, Last_SQL_Errno
+--let $slave_field_result_replace= /$SERVER_MYPORT_1/MYPORT_1/
+--let $slave_name= 'master1'
+--source include/show_slave_status.inc
+--let $slave_name=
+
+--echo #
+--echo # Checking SHOW SLAVE STATUS
+--echo #
+--source include/show_slave_status.inc
+
+--echo #
+--echo # Checking SHOW ALL SLAVES STATUS
+--echo #
+--let $all_slaves_status= 1
+--let $status_items= Connection_name, Master_Port, Relay_Log_File, Slave_IO_Running, Slave_SQL_Running, Last_Errno, Last_SQL_Errno, Slave_heartbeat_period
+--source include/show_slave_status.inc
+--let $all_slaves_status=
+--echo #
# Check that replication actually works
@@ -144,8 +160,15 @@ let $field= Slave_IO_State;
let $condition= = 'Waiting for master to send event';
--source include/wait_show_condition.inc
---replace_result $SERVER_MYPORT_1 MYPORT_1 $SERVER_MYPORT_2 MYPORT_2
-show all slaves status;
+--echo #
+--echo # Checking SHOW ALL SLAVES STATUS
+--echo #
+--let $all_slaves_status= 1
+--let $status_items= Connection_name, Master_Port, Relay_Log_File, Slave_IO_Running, Slave_SQL_Running, Last_Errno, Last_SQL_Errno, Slave_heartbeat_period
+--let $slave_field_result_replace= /$SERVER_MYPORT_1/MYPORT_1/ /$SERVER_MYPORT_2/MYPORT_2/
+--source include/show_slave_status.inc
+--let $all_slaves_status=
+--echo #
# Check that replication from two servers actually works
@@ -214,8 +237,15 @@ let $field= Slave_IO_State;
let $condition= = 'Waiting for master to send event';
--source include/wait_show_condition.inc
---replace_result $SERVER_MYPORT_1 MYPORT_1 $SERVER_MYPORT_2 MYPORT_2
-show all slaves status;
+--echo #
+--echo # Checking SHOW ALL SLAVES STATUS
+--echo #
+--let $all_slaves_status= 1
+--let $status_items= Connection_name, Master_Port, Relay_Log_File, Slave_IO_Running, Slave_SQL_Running, Last_Errno, Last_SQL_Errno, Slave_heartbeat_period
+--let $slave_field_result_replace= /$SERVER_MYPORT_1/MYPORT_1/ /$SERVER_MYPORT_2/MYPORT_2/
+--source include/show_slave_status.inc
+--let $all_slaves_status=
+--echo #
--sorted_result
select * from db1.t1;
diff --git a/mysql-test/suite/parts/r/partition_debug_sync_innodb.result b/mysql-test/suite/parts/r/partition_debug_sync_innodb.result
index 268db30bda0..77129d6bebb 100644
--- a/mysql-test/suite/parts/r/partition_debug_sync_innodb.result
+++ b/mysql-test/suite/parts/r/partition_debug_sync_innodb.result
@@ -58,7 +58,10 @@ t1.frm
t1.par
SET DEBUG_SYNC='before_open_in_get_all_tables SIGNAL parked WAIT_FOR open';
SET DEBUG_SYNC='partition_open_error SIGNAL alter WAIT_FOR finish';
-SELECT * FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME = 't1' AND TABLE_SCHEMA = 'test';
+SELECT TABLE_SCHEMA, TABLE_NAME, PARTITION_NAME, PARTITION_ORDINAL_POSITION,
+PARTITION_DESCRIPTION, TABLE_ROWS
+FROM INFORMATION_SCHEMA.PARTITIONS
+WHERE TABLE_NAME = 't1' AND TABLE_SCHEMA = 'test';
SET DEBUG_SYNC = 'now WAIT_FOR parked';
# When waiting for the name lock in get_all_tables in sql_show.cc
# this will not be concurrent any more, thus the TIMEOUT
@@ -70,9 +73,9 @@ ALTER TABLE t1 REORGANIZE PARTITION p0 INTO
PARTITION p10 VALUES LESS THAN MAXVALUE);
Warnings:
Warning 1639 debug sync point wait timed out
-TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
-def test t1 p0 NULL 1 NULL RANGE NULL a NULL 10 1 16384 16384 NULL 0 0 NULL NULL NULL NULL default NULL
-def test t1 p10 NULL 2 NULL RANGE NULL a NULL MAXVALUE 3 5461 16384 NULL 0 0 NULL NULL NULL NULL default NULL
+TABLE_SCHEMA TABLE_NAME PARTITION_NAME PARTITION_ORDINAL_POSITION PARTITION_DESCRIPTION TABLE_ROWS
+test t1 p0 1 10 1
+test t1 p10 2 MAXVALUE 3
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
diff --git a/mysql-test/suite/parts/t/partition_debug_sync_innodb.test b/mysql-test/suite/parts/t/partition_debug_sync_innodb.test
index fce26132030..df9c06011c2 100644
--- a/mysql-test/suite/parts/t/partition_debug_sync_innodb.test
+++ b/mysql-test/suite/parts/t/partition_debug_sync_innodb.test
@@ -62,7 +62,10 @@ SHOW CREATE TABLE t1;
SET DEBUG_SYNC='before_open_in_get_all_tables SIGNAL parked WAIT_FOR open';
SET DEBUG_SYNC='partition_open_error SIGNAL alter WAIT_FOR finish';
send
-SELECT * FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME = 't1' AND TABLE_SCHEMA = 'test';
+SELECT TABLE_SCHEMA, TABLE_NAME, PARTITION_NAME, PARTITION_ORDINAL_POSITION,
+ PARTITION_DESCRIPTION, TABLE_ROWS
+FROM INFORMATION_SCHEMA.PARTITIONS
+WHERE TABLE_NAME = 't1' AND TABLE_SCHEMA = 'test';
connect (con1, localhost, root,,);
SET DEBUG_SYNC = 'now WAIT_FOR parked';
diff --git a/mysql-test/suite/percona/innodb_sys_index.result b/mysql-test/suite/percona/innodb_sys_index.result
index 67604236366..7573720f5ee 100644
--- a/mysql-test/suite/percona/innodb_sys_index.result
+++ b/mysql-test/suite/percona/innodb_sys_index.result
@@ -1,9 +1,6 @@
drop table if exists t1;
Warnings:
Note 1051 Unknown table 'test.t1'
-select @@version_comment limit 1 ;
-@@version_comment
-Source distribution
SELECT COUNT(*) FROM `information_schema`.`INNODB_SYS_INDEXES` ;
CREATE TABLE test.t1 ( `a` SERIAL NOT NULL , `b` VARCHAR( 255 ) NOT NULL , INDEX ( `b` ) ) ENGINE = InnoDB ;
SHOW TABLE STATUS FROM `information_schema` LIKE 'INNODB\_SYS\_INDEXES%' ;
diff --git a/mysql-test/suite/percona/innodb_sys_index.test b/mysql-test/suite/percona/innodb_sys_index.test
index 212baeda663..d8c22e7f5f9 100644
--- a/mysql-test/suite/percona/innodb_sys_index.test
+++ b/mysql-test/suite/percona/innodb_sys_index.test
@@ -5,7 +5,6 @@ drop table if exists t1;
#
# test for bug LP#875797 "Using 'innodb_sys_indexes' causes core dump"
#
-select @@version_comment limit 1 ;
--disable_result_log
SELECT COUNT(*) FROM `information_schema`.`INNODB_SYS_INDEXES` ;
CREATE TABLE test.t1 ( `a` SERIAL NOT NULL , `b` VARCHAR( 255 ) NOT NULL , INDEX ( `b` ) ) ENGINE = InnoDB ;
diff --git a/mysql-test/suite/percona/percona_innodb_fake_changes.result b/mysql-test/suite/percona/percona_innodb_fake_changes.result
index 95f0c07cd11..1b870fdbb92 100644
--- a/mysql-test/suite/percona/percona_innodb_fake_changes.result
+++ b/mysql-test/suite/percona/percona_innodb_fake_changes.result
@@ -45,7 +45,7 @@ BEGIN;
CREATE TABLE t2 (a INT) ENGINE=InnoDB;
ERROR HY000: Can't create table `test`.`t2` (errno: 131 "Command not supported by database")
DROP TABLE t1;
-ERROR 42S02: Unknown table 'test.t1'
+ERROR HY000: Storage engine InnoDB of the table `test`.`t1` doesn't have this option
TRUNCATE TABLE t1;
ERROR HY000: Got error 131 "Command not supported by database" during COMMIT
ALTER TABLE t1 ENGINE=MyISAM;
diff --git a/mysql-test/suite/percona/percona_innodb_fake_changes.test b/mysql-test/suite/percona/percona_innodb_fake_changes.test
index 5fa3ecc7b63..67f5450ba45 100644
--- a/mysql-test/suite/percona/percona_innodb_fake_changes.test
+++ b/mysql-test/suite/percona/percona_innodb_fake_changes.test
@@ -38,7 +38,7 @@ SET innodb_fake_changes=1;
BEGIN;
--error 1005
CREATE TABLE t2 (a INT) ENGINE=InnoDB;
---error 1051
+--error 1031
DROP TABLE t1;
--error 1180
TRUNCATE TABLE t1;
diff --git a/mysql-test/suite/perfschema/include/connection_setup.inc b/mysql-test/suite/perfschema/include/connection_setup.inc
index da57b6dd388..a661d43d063 100644
--- a/mysql-test/suite/perfschema/include/connection_setup.inc
+++ b/mysql-test/suite/perfschema/include/connection_setup.inc
@@ -48,7 +48,7 @@
--source include/not_embedded.inc
--source include/have_perfschema.inc
---source ../include/no_protocol.inc
+--source include/no_protocol.inc
--source ../include/wait_for_pfs_thread_count.inc
--disable_query_log
diff --git a/mysql-test/suite/perfschema/include/digest_setup.inc b/mysql-test/suite/perfschema/include/digest_setup.inc
index ed463f58d04..6efab880d32 100644
--- a/mysql-test/suite/perfschema/include/digest_setup.inc
+++ b/mysql-test/suite/perfschema/include/digest_setup.inc
@@ -1,5 +1,5 @@
# Making sure not to run when ps-protocol is set.
---source ../include/no_protocol.inc
+--source include/no_protocol.inc
--echo ####################################
--echo # SETUP
diff --git a/mysql-test/suite/perfschema/include/event_aggregate_setup.inc b/mysql-test/suite/perfschema/include/event_aggregate_setup.inc
index 769ba5f8607..ec35e60d463 100644
--- a/mysql-test/suite/perfschema/include/event_aggregate_setup.inc
+++ b/mysql-test/suite/perfschema/include/event_aggregate_setup.inc
@@ -62,7 +62,7 @@
--source include/not_embedded.inc
--source include/have_perfschema.inc
---source ../include/no_protocol.inc
+--source include/no_protocol.inc
--source ../include/wait_for_pfs_thread_count.inc
--disable_query_log
diff --git a/mysql-test/suite/perfschema/include/sizing_auto.inc b/mysql-test/suite/perfschema/include/sizing_auto.inc
index 4c3451ce8b5..3bb4db2276f 100644
--- a/mysql-test/suite/perfschema/include/sizing_auto.inc
+++ b/mysql-test/suite/perfschema/include/sizing_auto.inc
@@ -4,13 +4,21 @@ show variables like "table_open_cache";
show variables like "max_connections";
# open_files_limit depends on OS configuration (ulimit -n)
#show variables like "open_files_limit";
-show variables like "%performance_schema%";
+show variables where
+ `Variable_name` != "performance_schema_max_statement_classes" and
+ `Variable_name` like "performance_schema%";
show status like "%performance_schema%";
# Each test script should provide a different test.cnf file,
# with different settings.
# This output will show the sizes computed automatically.
# Note that this output is very dependent on the platform.
+# The output of SHOW ENGINE PERFORMANCE_SCHEMA STATUS
+# is very dependent on the platform,
+# so it is not printed here to ensure stability of the .results files.
+# To troubleshoot the performance schema memory consumption at different
+# configuration settings, comment the following line.
+# Debug only:
-show engine performance_schema status;
+# show engine performance_schema status;
diff --git a/mysql-test/suite/perfschema/include/socket_event.inc b/mysql-test/suite/perfschema/include/socket_event.inc
index ba81c37d5df..96c61045986 100644
--- a/mysql-test/suite/perfschema/include/socket_event.inc
+++ b/mysql-test/suite/perfschema/include/socket_event.inc
@@ -126,7 +126,7 @@ if($is_connect)
# Connect is visible.
# We hope that sleep 1 is long enough so that PERFORMANCE_SCHEMA
# can remove this row before we collect the after action state.
- let $wait_timeou= 5;
+ let $wait_timeout= 5;
let $wait_condition=
SELECT COUNT(*) = 0
$part;
diff --git a/mysql-test/suite/perfschema/include/stage_setup.inc b/mysql-test/suite/perfschema/include/stage_setup.inc
index 3558e43652e..639b1df8c02 100644
--- a/mysql-test/suite/perfschema/include/stage_setup.inc
+++ b/mysql-test/suite/perfschema/include/stage_setup.inc
@@ -24,7 +24,7 @@
--source include/not_embedded.inc
--source include/have_perfschema.inc
---source ../include/no_protocol.inc
+--source include/no_protocol.inc
--disable_query_log
diff --git a/mysql-test/suite/perfschema/include/start_server_common.inc b/mysql-test/suite/perfschema/include/start_server_common.inc
index d15c3d48ded..41dcfd8ecb5 100644
--- a/mysql-test/suite/perfschema/include/start_server_common.inc
+++ b/mysql-test/suite/perfschema/include/start_server_common.inc
@@ -68,7 +68,9 @@ select * from performance_schema.users;
--enable_result_log
# This has a stable output, printing the result:
-show variables like "performance_schema%";
+show variables where
+ `Variable_name` != "performance_schema_max_statement_classes" and
+ `Variable_name` like "performance_schema%";
# This has an unrepeatable output, it does depends too much on
# - the platform hardware (sizeof structures, padding)
diff --git a/mysql-test/suite/perfschema/include/table_aggregate_load.inc b/mysql-test/suite/perfschema/include/table_aggregate_load.inc
index 242768ead9e..f42ebe1fc76 100644
--- a/mysql-test/suite/perfschema/include/table_aggregate_load.inc
+++ b/mysql-test/suite/perfschema/include/table_aggregate_load.inc
@@ -29,7 +29,9 @@ truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
# Check the configuration is ok
-show variables like "performance_schema%";
+show variables where
+ `Variable_name` != "performance_schema_max_statement_classes" and
+ `Variable_name` like "performance_schema%";
show status like "performance_schema%";
echo "================== Step 1 ==================";
diff --git a/mysql-test/suite/perfschema/include/table_aggregate_setup.inc b/mysql-test/suite/perfschema/include/table_aggregate_setup.inc
index 8efdc8d2f24..522cdb9346d 100644
--- a/mysql-test/suite/perfschema/include/table_aggregate_setup.inc
+++ b/mysql-test/suite/perfschema/include/table_aggregate_setup.inc
@@ -67,7 +67,7 @@
--source include/not_embedded.inc
--source include/have_perfschema.inc
---source ../include/no_protocol.inc
+--source include/no_protocol.inc
--source ../include/wait_for_pfs_thread_count.inc
--disable_query_log
diff --git a/mysql-test/suite/perfschema/r/aggregate.result b/mysql-test/suite/perfschema/r/aggregate.result
index ab927f544cf..c8fa1cc2b24 100644
--- a/mysql-test/suite/perfschema/r/aggregate.result
+++ b/mysql-test/suite/perfschema/r/aggregate.result
@@ -1,4 +1,6 @@
"General cleanup"
+set @aria_checkpoint_interval_save= @@global.aria_checkpoint_interval;
+set @@global.aria_checkpoint_interval= 0;
drop table if exists t1;
update performance_schema.setup_instruments set enabled = 'NO';
update performance_schema.setup_consumers set enabled = 'NO';
@@ -116,3 +118,4 @@ update performance_schema.setup_consumers set enabled = 'YES';
update performance_schema.setup_instruments
set enabled = 'YES', timed = 'YES';
drop table test.t1;
+set @@global.aria_checkpoint_interval= @aria_checkpoint_interval_save;
diff --git a/mysql-test/suite/perfschema/r/digest_null_literal.result b/mysql-test/suite/perfschema/r/digest_null_literal.result
new file mode 100644
index 00000000000..b0cefbbbaaf
--- /dev/null
+++ b/mysql-test/suite/perfschema/r/digest_null_literal.result
@@ -0,0 +1,27 @@
+TRUNCATE TABLE performance_schema.events_statements_summary_by_digest;
+NULL
+NULL
+NULL
+NULL
+NULL NULL
+NULL NULL
+NULL NULL NULL 1 2 3 NULL NULL
+NULL NULL NULL 1 2 3 NULL NULL
+1 IS NULL
+0
+2 IS NOT NULL
+1
+1 IS NULL 2 IS NULL 3 IS NOT NULL 4 IS NOT NULL
+0 0 1 1
+SELECT SCHEMA_NAME, DIGEST_TEXT, COUNT_STAR
+FROM performance_schema.events_statements_summary_by_digest;
+SCHEMA_NAME DIGEST_TEXT COUNT_STAR
+test TRUNCATE TABLE performance_schema . events_statements_summary_by_digest 1
+test SELECT ? 1
+test SELECT ? FROM DUAL 1
+test SELECT ?, ... 2
+test SELECT ? IS NULL 1
+test SELECT ? IS NOT NULL 1
+test SELECT ? IS NULL , ? IS NULL , ? IS NOT NULL , ? IS NOT NULL 1
+test CREATE TABLE foo ( a INTEGER DEFAULT ? , b INTEGER NOT NULL DEFAULT ? , c INTEGER NOT NULL ) 1
+test DROP TABLE foo 1
diff --git a/mysql-test/suite/perfschema/r/digest_table_full.result b/mysql-test/suite/perfschema/r/digest_table_full.result
index 9c0efb7b1ca..d910f29c91e 100644
--- a/mysql-test/suite/perfschema/r/digest_table_full.result
+++ b/mysql-test/suite/perfschema/r/digest_table_full.result
@@ -113,7 +113,7 @@ SELECT SCHEMA_NAME, DIGEST, DIGEST_TEXT, COUNT_STAR, SUM_ROWS_AFFECTED, SUM_WARN
SUM_ERRORS FROM performance_schema.events_statements_summary_by_digest;
SCHEMA_NAME DIGEST DIGEST_TEXT COUNT_STAR SUM_ROWS_AFFECTED SUM_WARNINGS SUM_ERRORS
NULL NULL NULL 55 32 1 2
-statements_digest 0e98ee6a98e296530ec59c12dbc08dfe TRUNCATE TABLE performance_schema . events_statements_summary_by_digest 1 0 0 0
+statements_digest 8de787d0e3e3a062aea121ff528fcfce TRUNCATE TABLE performance_schema . events_statements_summary_by_digest 1 0 0 0
SHOW VARIABLES LIKE "performance_schema_digests_size";
Variable_name Value
performance_schema_digests_size 2
diff --git a/mysql-test/suite/perfschema/r/ortho_iter.result b/mysql-test/suite/perfschema/r/ortho_iter.result
index dafce4bf573..9081bfe5882 100644
--- a/mysql-test/suite/perfschema/r/ortho_iter.result
+++ b/mysql-test/suite/perfschema/r/ortho_iter.result
@@ -94,7 +94,9 @@ close pfs_cursor;
signal sqlstate '01000' set message_text='Done', mysql_errno=12000;
end
$
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -118,7 +120,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
@@ -127,31 +128,6 @@ performance_schema_session_connect_attrs_size 2048
performance_schema_setup_actors_size 100
performance_schema_setup_objects_size 100
performance_schema_users_size 100
-show status like "performance_schema%";
-Variable_name Value
-Performance_schema_accounts_lost 0
-Performance_schema_cond_classes_lost 0
-Performance_schema_cond_instances_lost 0
-Performance_schema_digest_lost 0
-Performance_schema_file_classes_lost 0
-Performance_schema_file_handles_lost 0
-Performance_schema_file_instances_lost 0
-Performance_schema_hosts_lost 0
-Performance_schema_locker_lost 0
-Performance_schema_mutex_classes_lost 0
-Performance_schema_mutex_instances_lost 0
-Performance_schema_rwlock_classes_lost 0
-Performance_schema_rwlock_instances_lost 0
-Performance_schema_session_connect_attrs_lost 0
-Performance_schema_socket_classes_lost 0
-Performance_schema_socket_instances_lost 0
-Performance_schema_stage_classes_lost 0
-Performance_schema_statement_classes_lost 0
-Performance_schema_table_handles_lost 0
-Performance_schema_table_instances_lost 0
-Performance_schema_thread_classes_lost 0
-Performance_schema_thread_instances_lost 0
-Performance_schema_users_lost 0
call check_instrument("wait/synch/mutex/");
instr_name is_wait is_stage is_statement
wait/synch/mutex/ 1 0 0
diff --git a/mysql-test/suite/perfschema/r/privilege_table_io.result b/mysql-test/suite/perfschema/r/privilege_table_io.result
index 838d17e61fe..126b2a58fae 100644
--- a/mysql-test/suite/perfschema/r/privilege_table_io.result
+++ b/mysql-test/suite/perfschema/r/privilege_table_io.result
@@ -22,7 +22,9 @@ flush privileges;
insert into test.marker set a = 1;
insert into test.marker set a = 1;
insert into test.marker set a = 1;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -46,7 +48,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/rpl_gtid_func.result b/mysql-test/suite/perfschema/r/rpl_gtid_func.result
index 98342bc4869..bfe4e08a3c1 100644
--- a/mysql-test/suite/perfschema/r/rpl_gtid_func.result
+++ b/mysql-test/suite/perfschema/r/rpl_gtid_func.result
@@ -37,7 +37,7 @@ select digest, digest_text, count_star
from performance_schema.events_statements_summary_by_digest
where digest_text like "%in_%_digest%";
digest digest_text count_star
-e315485f9cbc06befb4e59970905a034 SELECT ? AS in_master_digest 1
+f1cd3e758822a4ef0e1502ec30818476 SELECT ? AS in_master_digest 1
insert into test.marker values (2);
**** On Slave ****
select * from test.marker;
@@ -64,7 +64,7 @@ select digest, digest_text, count_star
from performance_schema.events_statements_summary_by_digest
where digest_text like "%in_%_digest%";
digest digest_text count_star
-bd2f53b41efcd037df41a3dd8bf3312a SELECT ? AS in_slave_digest 1
+c1cef2eb67ca48bb5d81d2e5e68aaf35 SELECT ? AS in_slave_digest 1
**** On Master ****
delete from performance_schema.setup_objects
where object_schema='master';
diff --git a/mysql-test/suite/perfschema/r/sizing_default.result b/mysql-test/suite/perfschema/r/sizing_default.result
index ef7f7069c19..d7c4e321204 100644
--- a/mysql-test/suite/perfschema/r/sizing_default.result
+++ b/mysql-test/suite/perfschema/r/sizing_default.result
@@ -7,7 +7,9 @@ table_open_cache 2000
show variables like "max_connections";
Variable_name Value
max_connections 151
-show variables like "%performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -31,7 +33,6 @@ performance_schema_max_rwlock_instances 9102
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 322
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 168
performance_schema_max_table_handles 4000
performance_schema_max_table_instances 12500
performance_schema_max_thread_classes 50
@@ -65,160 +66,3 @@ Performance_schema_table_instances_lost 0
Performance_schema_thread_classes_lost 0
Performance_schema_thread_instances_lost 0
Performance_schema_users_lost 0
-show engine performance_schema status;
-Type Name Status
-performance_schema events_waits_current.row_size 184
-performance_schema events_waits_current.row_count 2412
-performance_schema events_waits_history.row_size 184
-performance_schema events_waits_history.row_count 4020
-performance_schema events_waits_history.memory 739680
-performance_schema events_waits_history_long.row_size 184
-performance_schema events_waits_history_long.row_count 10000
-performance_schema events_waits_history_long.memory 1840000
-performance_schema (pfs_mutex_class).row_size 256
-performance_schema (pfs_mutex_class).row_count 200
-performance_schema (pfs_mutex_class).memory 51200
-performance_schema (pfs_rwlock_class).row_size 320
-performance_schema (pfs_rwlock_class).row_count 40
-performance_schema (pfs_rwlock_class).memory 12800
-performance_schema (pfs_cond_class).row_size 256
-performance_schema (pfs_cond_class).row_count 80
-performance_schema (pfs_cond_class).memory 20480
-performance_schema (pfs_thread_class).row_size 192
-performance_schema (pfs_thread_class).row_count 50
-performance_schema (pfs_thread_class).memory 9600
-performance_schema (pfs_file_class).row_size 320
-performance_schema (pfs_file_class).row_count 50
-performance_schema (pfs_file_class).memory 16000
-performance_schema mutex_instances.row_size 128
-performance_schema mutex_instances.row_count 15906
-performance_schema mutex_instances.memory 2035968
-performance_schema rwlock_instances.row_size 192
-performance_schema rwlock_instances.row_count 9102
-performance_schema rwlock_instances.memory 1747584
-performance_schema cond_instances.row_size 128
-performance_schema cond_instances.row_count 3504
-performance_schema cond_instances.memory 448512
-performance_schema threads.row_size 2816
-performance_schema threads.row_count 402
-performance_schema threads.memory 1132032
-performance_schema file_instances.row_size 704
-performance_schema file_instances.row_count 7693
-performance_schema file_instances.memory 5415872
-performance_schema (pfs_file_handle).row_size 8
-performance_schema (pfs_file_handle).row_count 32768
-performance_schema (pfs_file_handle).memory 262144
-performance_schema events_waits_summary_by_thread_by_event_name.row_size 32
-performance_schema events_waits_summary_by_thread_by_event_name.row_count 153966
-performance_schema events_waits_summary_by_thread_by_event_name.memory 4926912
-performance_schema (pfs_table_share).row_size 22208
-performance_schema (pfs_table_share).row_count 12500
-performance_schema (pfs_table_share).memory 277600000
-performance_schema (pfs_table).row_size 9280
-performance_schema (pfs_table).row_count 4000
-performance_schema (pfs_table).memory 37120000
-performance_schema setup_actors.row_size 256
-performance_schema setup_actors.row_count 100
-performance_schema setup_actors.memory 25600
-performance_schema setup_objects.row_size 448
-performance_schema setup_objects.row_count 100
-performance_schema setup_objects.memory 44800
-performance_schema (pfs_account).row_size 256
-performance_schema (pfs_account).row_count 100
-performance_schema (pfs_account).memory 25600
-performance_schema events_waits_summary_by_account_by_event_name.row_size 32
-performance_schema events_waits_summary_by_account_by_event_name.row_count 38300
-performance_schema events_waits_summary_by_account_by_event_name.memory 1225600
-performance_schema events_waits_summary_by_user_by_event_name.row_size 32
-performance_schema events_waits_summary_by_user_by_event_name.row_count 38300
-performance_schema events_waits_summary_by_user_by_event_name.memory 1225600
-performance_schema events_waits_summary_by_host_by_event_name.row_size 32
-performance_schema events_waits_summary_by_host_by_event_name.row_count 38300
-performance_schema events_waits_summary_by_host_by_event_name.memory 1225600
-performance_schema (pfs_user).row_size 128
-performance_schema (pfs_user).row_count 100
-performance_schema (pfs_user).memory 12800
-performance_schema (pfs_host).row_size 128
-performance_schema (pfs_host).row_count 100
-performance_schema (pfs_host).memory 12800
-performance_schema (pfs_stage_class).row_size 256
-performance_schema (pfs_stage_class).row_count 150
-performance_schema (pfs_stage_class).memory 38400
-performance_schema events_stages_history.row_size 88
-performance_schema events_stages_history.row_count 4020
-performance_schema events_stages_history.memory 353760
-performance_schema events_stages_history_long.row_size 88
-performance_schema events_stages_history_long.row_count 10000
-performance_schema events_stages_history_long.memory 880000
-performance_schema events_stages_summary_by_thread_by_event_name.row_size 32
-performance_schema events_stages_summary_by_thread_by_event_name.row_count 60300
-performance_schema events_stages_summary_by_thread_by_event_name.memory 1929600
-performance_schema events_stages_summary_global_by_event_name.row_size 32
-performance_schema events_stages_summary_global_by_event_name.row_count 150
-performance_schema events_stages_summary_global_by_event_name.memory 4800
-performance_schema events_stages_summary_by_account_by_event_name.row_size 32
-performance_schema events_stages_summary_by_account_by_event_name.row_count 15000
-performance_schema events_stages_summary_by_account_by_event_name.memory 480000
-performance_schema events_stages_summary_by_user_by_event_name.row_size 32
-performance_schema events_stages_summary_by_user_by_event_name.row_count 15000
-performance_schema events_stages_summary_by_user_by_event_name.memory 480000
-performance_schema events_stages_summary_by_host_by_event_name.row_size 32
-performance_schema events_stages_summary_by_host_by_event_name.row_count 15000
-performance_schema events_stages_summary_by_host_by_event_name.memory 480000
-performance_schema (pfs_statement_class).row_size 192
-performance_schema (pfs_statement_class).row_count 168
-performance_schema (pfs_statement_class).memory 32256
-performance_schema events_statements_history.row_size 3024
-performance_schema events_statements_history.row_count 4020
-performance_schema events_statements_history.memory 12156480
-performance_schema events_statements_history_long.row_size 3024
-performance_schema events_statements_history_long.row_count 10000
-performance_schema events_statements_history_long.memory 30240000
-performance_schema events_statements_summary_by_thread_by_event_name.row_size 184
-performance_schema events_statements_summary_by_thread_by_event_name.row_count 67536
-performance_schema events_statements_summary_by_thread_by_event_name.memory 12426624
-performance_schema events_statements_summary_global_by_event_name.row_size 184
-performance_schema events_statements_summary_global_by_event_name.row_count 168
-performance_schema events_statements_summary_global_by_event_name.memory 30912
-performance_schema events_statements_summary_by_account_by_event_name.row_size 184
-performance_schema events_statements_summary_by_account_by_event_name.row_count 16800
-performance_schema events_statements_summary_by_account_by_event_name.memory 3091200
-performance_schema events_statements_summary_by_user_by_event_name.row_size 184
-performance_schema events_statements_summary_by_user_by_event_name.row_count 16800
-performance_schema events_statements_summary_by_user_by_event_name.memory 3091200
-performance_schema events_statements_summary_by_host_by_event_name.row_size 184
-performance_schema events_statements_summary_by_host_by_event_name.row_count 16800
-performance_schema events_statements_summary_by_host_by_event_name.memory 3091200
-performance_schema events_statements_current.row_size 3024
-performance_schema events_statements_current.row_count 402
-performance_schema events_statements_current.memory 1215648
-performance_schema (pfs_socket_class).row_size 320
-performance_schema (pfs_socket_class).row_count 10
-performance_schema (pfs_socket_class).memory 3200
-performance_schema socket_instances.row_size 320
-performance_schema socket_instances.row_count 322
-performance_schema socket_instances.memory 103040
-performance_schema events_statements_summary_by_digest.row_size 1472
-performance_schema events_statements_summary_by_digest.row_count 10000
-performance_schema events_statements_summary_by_digest.memory 14720000
-performance_schema session_connect_attrs.row_size 402
-performance_schema session_connect_attrs.row_count 512
-performance_schema session_connect_attrs.memory 205824
-performance_schema (account_hash).count 2
-performance_schema (account_hash).size 100
-performance_schema (digest_hash).count 0
-performance_schema (digest_hash).size 10000
-performance_schema (filename_hash).count 0
-performance_schema (filename_hash).size 7693
-performance_schema (host_hash).count 2
-performance_schema (host_hash).size 100
-performance_schema (setup_actor_hash).count 1
-performance_schema (setup_actor_hash).size 100
-performance_schema (setup_object_hash).count 4
-performance_schema (setup_object_hash).size 100
-performance_schema (table_share_hash).count 80
-performance_schema (table_share_hash).size 12500
-performance_schema (user_hash).count 2
-performance_schema (user_hash).size 100
-performance_schema host_cache.size 336
-performance_schema performance_schema.memory 422231328
diff --git a/mysql-test/suite/perfschema/r/sizing_high.result b/mysql-test/suite/perfschema/r/sizing_high.result
index 4d63c970782..c7c7b065992 100644
--- a/mysql-test/suite/perfschema/r/sizing_high.result
+++ b/mysql-test/suite/perfschema/r/sizing_high.result
@@ -7,7 +7,9 @@ table_open_cache 400
show variables like "max_connections";
Variable_name Value
max_connections 200
-show variables like "%performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -31,7 +33,6 @@ performance_schema_max_rwlock_instances 30800
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 420
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 168
performance_schema_max_table_handles 800
performance_schema_max_table_instances 12500
performance_schema_max_thread_classes 50
@@ -65,160 +66,3 @@ Performance_schema_table_instances_lost 0
Performance_schema_thread_classes_lost 0
Performance_schema_thread_instances_lost 0
Performance_schema_users_lost 0
-show engine performance_schema status;
-Type Name Status
-performance_schema events_waits_current.row_size 184
-performance_schema events_waits_current.row_count 3000
-performance_schema events_waits_history.row_size 184
-performance_schema events_waits_history.row_count 5000
-performance_schema events_waits_history.memory 920000
-performance_schema events_waits_history_long.row_size 184
-performance_schema events_waits_history_long.row_count 10000
-performance_schema events_waits_history_long.memory 1840000
-performance_schema (pfs_mutex_class).row_size 256
-performance_schema (pfs_mutex_class).row_count 200
-performance_schema (pfs_mutex_class).memory 51200
-performance_schema (pfs_rwlock_class).row_size 320
-performance_schema (pfs_rwlock_class).row_count 40
-performance_schema (pfs_rwlock_class).memory 12800
-performance_schema (pfs_cond_class).row_size 256
-performance_schema (pfs_cond_class).row_count 80
-performance_schema (pfs_cond_class).memory 20480
-performance_schema (pfs_thread_class).row_size 192
-performance_schema (pfs_thread_class).row_count 50
-performance_schema (pfs_thread_class).memory 9600
-performance_schema (pfs_file_class).row_size 320
-performance_schema (pfs_file_class).row_count 50
-performance_schema (pfs_file_class).memory 16000
-performance_schema mutex_instances.row_size 128
-performance_schema mutex_instances.row_count 52200
-performance_schema mutex_instances.memory 6681600
-performance_schema rwlock_instances.row_size 192
-performance_schema rwlock_instances.row_count 30800
-performance_schema rwlock_instances.memory 5913600
-performance_schema cond_instances.row_size 128
-performance_schema cond_instances.row_count 10900
-performance_schema cond_instances.memory 1395200
-performance_schema threads.row_size 2816
-performance_schema threads.row_count 500
-performance_schema threads.memory 1408000
-performance_schema file_instances.row_size 704
-performance_schema file_instances.row_count 23385
-performance_schema file_instances.memory 16463040
-performance_schema (pfs_file_handle).row_size 8
-performance_schema (pfs_file_handle).row_count 32768
-performance_schema (pfs_file_handle).memory 262144
-performance_schema events_waits_summary_by_thread_by_event_name.row_size 32
-performance_schema events_waits_summary_by_thread_by_event_name.row_count 191500
-performance_schema events_waits_summary_by_thread_by_event_name.memory 6128000
-performance_schema (pfs_table_share).row_size 22208
-performance_schema (pfs_table_share).row_count 12500
-performance_schema (pfs_table_share).memory 277600000
-performance_schema (pfs_table).row_size 9280
-performance_schema (pfs_table).row_count 800
-performance_schema (pfs_table).memory 7424000
-performance_schema setup_actors.row_size 256
-performance_schema setup_actors.row_count 100
-performance_schema setup_actors.memory 25600
-performance_schema setup_objects.row_size 448
-performance_schema setup_objects.row_count 100
-performance_schema setup_objects.memory 44800
-performance_schema (pfs_account).row_size 256
-performance_schema (pfs_account).row_count 100
-performance_schema (pfs_account).memory 25600
-performance_schema events_waits_summary_by_account_by_event_name.row_size 32
-performance_schema events_waits_summary_by_account_by_event_name.row_count 38300
-performance_schema events_waits_summary_by_account_by_event_name.memory 1225600
-performance_schema events_waits_summary_by_user_by_event_name.row_size 32
-performance_schema events_waits_summary_by_user_by_event_name.row_count 38300
-performance_schema events_waits_summary_by_user_by_event_name.memory 1225600
-performance_schema events_waits_summary_by_host_by_event_name.row_size 32
-performance_schema events_waits_summary_by_host_by_event_name.row_count 38300
-performance_schema events_waits_summary_by_host_by_event_name.memory 1225600
-performance_schema (pfs_user).row_size 128
-performance_schema (pfs_user).row_count 100
-performance_schema (pfs_user).memory 12800
-performance_schema (pfs_host).row_size 128
-performance_schema (pfs_host).row_count 100
-performance_schema (pfs_host).memory 12800
-performance_schema (pfs_stage_class).row_size 256
-performance_schema (pfs_stage_class).row_count 150
-performance_schema (pfs_stage_class).memory 38400
-performance_schema events_stages_history.row_size 88
-performance_schema events_stages_history.row_count 5000
-performance_schema events_stages_history.memory 440000
-performance_schema events_stages_history_long.row_size 88
-performance_schema events_stages_history_long.row_count 10000
-performance_schema events_stages_history_long.memory 880000
-performance_schema events_stages_summary_by_thread_by_event_name.row_size 32
-performance_schema events_stages_summary_by_thread_by_event_name.row_count 75000
-performance_schema events_stages_summary_by_thread_by_event_name.memory 2400000
-performance_schema events_stages_summary_global_by_event_name.row_size 32
-performance_schema events_stages_summary_global_by_event_name.row_count 150
-performance_schema events_stages_summary_global_by_event_name.memory 4800
-performance_schema events_stages_summary_by_account_by_event_name.row_size 32
-performance_schema events_stages_summary_by_account_by_event_name.row_count 15000
-performance_schema events_stages_summary_by_account_by_event_name.memory 480000
-performance_schema events_stages_summary_by_user_by_event_name.row_size 32
-performance_schema events_stages_summary_by_user_by_event_name.row_count 15000
-performance_schema events_stages_summary_by_user_by_event_name.memory 480000
-performance_schema events_stages_summary_by_host_by_event_name.row_size 32
-performance_schema events_stages_summary_by_host_by_event_name.row_count 15000
-performance_schema events_stages_summary_by_host_by_event_name.memory 480000
-performance_schema (pfs_statement_class).row_size 192
-performance_schema (pfs_statement_class).row_count 168
-performance_schema (pfs_statement_class).memory 32256
-performance_schema events_statements_history.row_size 3024
-performance_schema events_statements_history.row_count 5000
-performance_schema events_statements_history.memory 15120000
-performance_schema events_statements_history_long.row_size 3024
-performance_schema events_statements_history_long.row_count 10000
-performance_schema events_statements_history_long.memory 30240000
-performance_schema events_statements_summary_by_thread_by_event_name.row_size 184
-performance_schema events_statements_summary_by_thread_by_event_name.row_count 84000
-performance_schema events_statements_summary_by_thread_by_event_name.memory 15456000
-performance_schema events_statements_summary_global_by_event_name.row_size 184
-performance_schema events_statements_summary_global_by_event_name.row_count 168
-performance_schema events_statements_summary_global_by_event_name.memory 30912
-performance_schema events_statements_summary_by_account_by_event_name.row_size 184
-performance_schema events_statements_summary_by_account_by_event_name.row_count 16800
-performance_schema events_statements_summary_by_account_by_event_name.memory 3091200
-performance_schema events_statements_summary_by_user_by_event_name.row_size 184
-performance_schema events_statements_summary_by_user_by_event_name.row_count 16800
-performance_schema events_statements_summary_by_user_by_event_name.memory 3091200
-performance_schema events_statements_summary_by_host_by_event_name.row_size 184
-performance_schema events_statements_summary_by_host_by_event_name.row_count 16800
-performance_schema events_statements_summary_by_host_by_event_name.memory 3091200
-performance_schema events_statements_current.row_size 3024
-performance_schema events_statements_current.row_count 500
-performance_schema events_statements_current.memory 1512000
-performance_schema (pfs_socket_class).row_size 320
-performance_schema (pfs_socket_class).row_count 10
-performance_schema (pfs_socket_class).memory 3200
-performance_schema socket_instances.row_size 320
-performance_schema socket_instances.row_count 420
-performance_schema socket_instances.memory 134400
-performance_schema events_statements_summary_by_digest.row_size 1472
-performance_schema events_statements_summary_by_digest.row_count 10000
-performance_schema events_statements_summary_by_digest.memory 14720000
-performance_schema session_connect_attrs.row_size 500
-performance_schema session_connect_attrs.row_count 512
-performance_schema session_connect_attrs.memory 256000
-performance_schema (account_hash).count 2
-performance_schema (account_hash).size 100
-performance_schema (digest_hash).count 0
-performance_schema (digest_hash).size 10000
-performance_schema (filename_hash).count 0
-performance_schema (filename_hash).size 23385
-performance_schema (host_hash).count 2
-performance_schema (host_hash).size 100
-performance_schema (setup_actor_hash).count 1
-performance_schema (setup_actor_hash).size 100
-performance_schema (setup_object_hash).count 4
-performance_schema (setup_object_hash).size 100
-performance_schema (table_share_hash).count 80
-performance_schema (table_share_hash).size 12500
-performance_schema (user_hash).count 2
-performance_schema (user_hash).size 100
-performance_schema host_cache.size 336
-performance_schema performance_schema.memory 421925632
diff --git a/mysql-test/suite/perfschema/r/sizing_low.result b/mysql-test/suite/perfschema/r/sizing_low.result
index d5aab2c2df3..213cc0b5f74 100644
--- a/mysql-test/suite/perfschema/r/sizing_low.result
+++ b/mysql-test/suite/perfschema/r/sizing_low.result
@@ -7,7 +7,9 @@ table_open_cache 100
show variables like "max_connections";
Variable_name Value
max_connections 50
-show variables like "%performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 10
@@ -31,7 +33,6 @@ performance_schema_max_rwlock_instances 1612
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 67
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 168
performance_schema_max_table_handles 112
performance_schema_max_table_instances 445
performance_schema_max_thread_classes 50
@@ -65,160 +66,3 @@ Performance_schema_table_instances_lost 0
Performance_schema_thread_classes_lost 0
Performance_schema_thread_instances_lost 0
Performance_schema_users_lost 0
-show engine performance_schema status;
-Type Name Status
-performance_schema events_waits_current.row_size 184
-performance_schema events_waits_current.row_count 672
-performance_schema events_waits_history.row_size 184
-performance_schema events_waits_history.row_count 560
-performance_schema events_waits_history.memory 103040
-performance_schema events_waits_history_long.row_size 184
-performance_schema events_waits_history_long.row_count 100
-performance_schema events_waits_history_long.memory 18400
-performance_schema (pfs_mutex_class).row_size 256
-performance_schema (pfs_mutex_class).row_count 200
-performance_schema (pfs_mutex_class).memory 51200
-performance_schema (pfs_rwlock_class).row_size 320
-performance_schema (pfs_rwlock_class).row_count 40
-performance_schema (pfs_rwlock_class).memory 12800
-performance_schema (pfs_cond_class).row_size 256
-performance_schema (pfs_cond_class).row_count 80
-performance_schema (pfs_cond_class).memory 20480
-performance_schema (pfs_thread_class).row_size 192
-performance_schema (pfs_thread_class).row_count 50
-performance_schema (pfs_thread_class).memory 9600
-performance_schema (pfs_file_class).row_size 320
-performance_schema (pfs_file_class).row_count 50
-performance_schema (pfs_file_class).memory 16000
-performance_schema mutex_instances.row_size 128
-performance_schema mutex_instances.row_count 2945
-performance_schema mutex_instances.memory 376960
-performance_schema rwlock_instances.row_size 192
-performance_schema rwlock_instances.row_count 1612
-performance_schema rwlock_instances.memory 309504
-performance_schema cond_instances.row_size 128
-performance_schema cond_instances.row_count 612
-performance_schema cond_instances.memory 78336
-performance_schema threads.row_size 2816
-performance_schema threads.row_count 112
-performance_schema threads.memory 315392
-performance_schema file_instances.row_size 704
-performance_schema file_instances.row_count 1556
-performance_schema file_instances.memory 1095424
-performance_schema (pfs_file_handle).row_size 8
-performance_schema (pfs_file_handle).row_count 32768
-performance_schema (pfs_file_handle).memory 262144
-performance_schema events_waits_summary_by_thread_by_event_name.row_size 32
-performance_schema events_waits_summary_by_thread_by_event_name.row_count 42896
-performance_schema events_waits_summary_by_thread_by_event_name.memory 1372672
-performance_schema (pfs_table_share).row_size 22208
-performance_schema (pfs_table_share).row_count 445
-performance_schema (pfs_table_share).memory 9882560
-performance_schema (pfs_table).row_size 9280
-performance_schema (pfs_table).row_count 112
-performance_schema (pfs_table).memory 1039360
-performance_schema setup_actors.row_size 256
-performance_schema setup_actors.row_count 100
-performance_schema setup_actors.memory 25600
-performance_schema setup_objects.row_size 448
-performance_schema setup_objects.row_count 100
-performance_schema setup_objects.memory 44800
-performance_schema (pfs_account).row_size 256
-performance_schema (pfs_account).row_count 10
-performance_schema (pfs_account).memory 2560
-performance_schema events_waits_summary_by_account_by_event_name.row_size 32
-performance_schema events_waits_summary_by_account_by_event_name.row_count 3830
-performance_schema events_waits_summary_by_account_by_event_name.memory 122560
-performance_schema events_waits_summary_by_user_by_event_name.row_size 32
-performance_schema events_waits_summary_by_user_by_event_name.row_count 1915
-performance_schema events_waits_summary_by_user_by_event_name.memory 61280
-performance_schema events_waits_summary_by_host_by_event_name.row_size 32
-performance_schema events_waits_summary_by_host_by_event_name.row_count 7660
-performance_schema events_waits_summary_by_host_by_event_name.memory 245120
-performance_schema (pfs_user).row_size 128
-performance_schema (pfs_user).row_count 5
-performance_schema (pfs_user).memory 640
-performance_schema (pfs_host).row_size 128
-performance_schema (pfs_host).row_count 20
-performance_schema (pfs_host).memory 2560
-performance_schema (pfs_stage_class).row_size 256
-performance_schema (pfs_stage_class).row_count 150
-performance_schema (pfs_stage_class).memory 38400
-performance_schema events_stages_history.row_size 88
-performance_schema events_stages_history.row_count 560
-performance_schema events_stages_history.memory 49280
-performance_schema events_stages_history_long.row_size 88
-performance_schema events_stages_history_long.row_count 100
-performance_schema events_stages_history_long.memory 8800
-performance_schema events_stages_summary_by_thread_by_event_name.row_size 32
-performance_schema events_stages_summary_by_thread_by_event_name.row_count 16800
-performance_schema events_stages_summary_by_thread_by_event_name.memory 537600
-performance_schema events_stages_summary_global_by_event_name.row_size 32
-performance_schema events_stages_summary_global_by_event_name.row_count 150
-performance_schema events_stages_summary_global_by_event_name.memory 4800
-performance_schema events_stages_summary_by_account_by_event_name.row_size 32
-performance_schema events_stages_summary_by_account_by_event_name.row_count 1500
-performance_schema events_stages_summary_by_account_by_event_name.memory 48000
-performance_schema events_stages_summary_by_user_by_event_name.row_size 32
-performance_schema events_stages_summary_by_user_by_event_name.row_count 750
-performance_schema events_stages_summary_by_user_by_event_name.memory 24000
-performance_schema events_stages_summary_by_host_by_event_name.row_size 32
-performance_schema events_stages_summary_by_host_by_event_name.row_count 3000
-performance_schema events_stages_summary_by_host_by_event_name.memory 96000
-performance_schema (pfs_statement_class).row_size 192
-performance_schema (pfs_statement_class).row_count 168
-performance_schema (pfs_statement_class).memory 32256
-performance_schema events_statements_history.row_size 3024
-performance_schema events_statements_history.row_count 560
-performance_schema events_statements_history.memory 1693440
-performance_schema events_statements_history_long.row_size 3024
-performance_schema events_statements_history_long.row_count 100
-performance_schema events_statements_history_long.memory 302400
-performance_schema events_statements_summary_by_thread_by_event_name.row_size 184
-performance_schema events_statements_summary_by_thread_by_event_name.row_count 18816
-performance_schema events_statements_summary_by_thread_by_event_name.memory 3462144
-performance_schema events_statements_summary_global_by_event_name.row_size 184
-performance_schema events_statements_summary_global_by_event_name.row_count 168
-performance_schema events_statements_summary_global_by_event_name.memory 30912
-performance_schema events_statements_summary_by_account_by_event_name.row_size 184
-performance_schema events_statements_summary_by_account_by_event_name.row_count 1680
-performance_schema events_statements_summary_by_account_by_event_name.memory 309120
-performance_schema events_statements_summary_by_user_by_event_name.row_size 184
-performance_schema events_statements_summary_by_user_by_event_name.row_count 840
-performance_schema events_statements_summary_by_user_by_event_name.memory 154560
-performance_schema events_statements_summary_by_host_by_event_name.row_size 184
-performance_schema events_statements_summary_by_host_by_event_name.row_count 3360
-performance_schema events_statements_summary_by_host_by_event_name.memory 618240
-performance_schema events_statements_current.row_size 3024
-performance_schema events_statements_current.row_count 112
-performance_schema events_statements_current.memory 338688
-performance_schema (pfs_socket_class).row_size 320
-performance_schema (pfs_socket_class).row_count 10
-performance_schema (pfs_socket_class).memory 3200
-performance_schema socket_instances.row_size 320
-performance_schema socket_instances.row_count 67
-performance_schema socket_instances.memory 21440
-performance_schema events_statements_summary_by_digest.row_size 1472
-performance_schema events_statements_summary_by_digest.row_count 1000
-performance_schema events_statements_summary_by_digest.memory 1472000
-performance_schema session_connect_attrs.row_size 112
-performance_schema session_connect_attrs.row_count 512
-performance_schema session_connect_attrs.memory 57344
-performance_schema (account_hash).count 2
-performance_schema (account_hash).size 10
-performance_schema (digest_hash).count 0
-performance_schema (digest_hash).size 1000
-performance_schema (filename_hash).count 0
-performance_schema (filename_hash).size 1556
-performance_schema (host_hash).count 2
-performance_schema (host_hash).size 20
-performance_schema (setup_actor_hash).count 1
-performance_schema (setup_actor_hash).size 100
-performance_schema (setup_object_hash).count 4
-performance_schema (setup_object_hash).size 100
-performance_schema (table_share_hash).count 80
-performance_schema (table_share_hash).size 445
-performance_schema (user_hash).count 2
-performance_schema (user_hash).size 5
-performance_schema host_cache.size 336
-performance_schema performance_schema.memory 24771616
diff --git a/mysql-test/suite/perfschema/r/sizing_med.result b/mysql-test/suite/perfschema/r/sizing_med.result
index c2e7a4df4bf..fbe703c5ff5 100644
--- a/mysql-test/suite/perfschema/r/sizing_med.result
+++ b/mysql-test/suite/perfschema/r/sizing_med.result
@@ -7,7 +7,9 @@ table_open_cache 401
show variables like "max_connections";
Variable_name Value
max_connections 152
-show variables like "%performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -31,7 +33,6 @@ performance_schema_max_rwlock_instances 2222
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 232
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 168
performance_schema_max_table_handles 573
performance_schema_max_table_instances 556
performance_schema_max_thread_classes 50
@@ -65,160 +66,3 @@ Performance_schema_table_instances_lost 0
Performance_schema_thread_classes_lost 0
Performance_schema_thread_instances_lost 0
Performance_schema_users_lost 0
-show engine performance_schema status;
-Type Name Status
-performance_schema events_waits_current.row_size 184
-performance_schema events_waits_current.row_count 1734
-performance_schema events_waits_history.row_size 184
-performance_schema events_waits_history.row_count 2890
-performance_schema events_waits_history.memory 531760
-performance_schema events_waits_history_long.row_size 184
-performance_schema events_waits_history_long.row_count 1000
-performance_schema events_waits_history_long.memory 184000
-performance_schema (pfs_mutex_class).row_size 256
-performance_schema (pfs_mutex_class).row_count 200
-performance_schema (pfs_mutex_class).memory 51200
-performance_schema (pfs_rwlock_class).row_size 320
-performance_schema (pfs_rwlock_class).row_count 40
-performance_schema (pfs_rwlock_class).memory 12800
-performance_schema (pfs_cond_class).row_size 256
-performance_schema (pfs_cond_class).row_count 80
-performance_schema (pfs_cond_class).memory 20480
-performance_schema (pfs_thread_class).row_size 192
-performance_schema (pfs_thread_class).row_count 50
-performance_schema (pfs_thread_class).memory 9600
-performance_schema (pfs_file_class).row_size 320
-performance_schema (pfs_file_class).row_count 50
-performance_schema (pfs_file_class).memory 16000
-performance_schema mutex_instances.row_size 128
-performance_schema mutex_instances.row_count 4230
-performance_schema mutex_instances.memory 541440
-performance_schema rwlock_instances.row_size 192
-performance_schema rwlock_instances.row_count 2222
-performance_schema rwlock_instances.memory 426624
-performance_schema cond_instances.row_size 128
-performance_schema cond_instances.row_count 1079
-performance_schema cond_instances.memory 138112
-performance_schema threads.row_size 2816
-performance_schema threads.row_count 289
-performance_schema threads.memory 813824
-performance_schema file_instances.row_size 704
-performance_schema file_instances.row_count 1754
-performance_schema file_instances.memory 1234816
-performance_schema (pfs_file_handle).row_size 8
-performance_schema (pfs_file_handle).row_count 32768
-performance_schema (pfs_file_handle).memory 262144
-performance_schema events_waits_summary_by_thread_by_event_name.row_size 32
-performance_schema events_waits_summary_by_thread_by_event_name.row_count 110687
-performance_schema events_waits_summary_by_thread_by_event_name.memory 3541984
-performance_schema (pfs_table_share).row_size 22208
-performance_schema (pfs_table_share).row_count 556
-performance_schema (pfs_table_share).memory 12347648
-performance_schema (pfs_table).row_size 9280
-performance_schema (pfs_table).row_count 573
-performance_schema (pfs_table).memory 5317440
-performance_schema setup_actors.row_size 256
-performance_schema setup_actors.row_count 100
-performance_schema setup_actors.memory 25600
-performance_schema setup_objects.row_size 448
-performance_schema setup_objects.row_count 100
-performance_schema setup_objects.memory 44800
-performance_schema (pfs_account).row_size 256
-performance_schema (pfs_account).row_count 100
-performance_schema (pfs_account).memory 25600
-performance_schema events_waits_summary_by_account_by_event_name.row_size 32
-performance_schema events_waits_summary_by_account_by_event_name.row_count 38300
-performance_schema events_waits_summary_by_account_by_event_name.memory 1225600
-performance_schema events_waits_summary_by_user_by_event_name.row_size 32
-performance_schema events_waits_summary_by_user_by_event_name.row_count 38300
-performance_schema events_waits_summary_by_user_by_event_name.memory 1225600
-performance_schema events_waits_summary_by_host_by_event_name.row_size 32
-performance_schema events_waits_summary_by_host_by_event_name.row_count 38300
-performance_schema events_waits_summary_by_host_by_event_name.memory 1225600
-performance_schema (pfs_user).row_size 128
-performance_schema (pfs_user).row_count 100
-performance_schema (pfs_user).memory 12800
-performance_schema (pfs_host).row_size 128
-performance_schema (pfs_host).row_count 100
-performance_schema (pfs_host).memory 12800
-performance_schema (pfs_stage_class).row_size 256
-performance_schema (pfs_stage_class).row_count 150
-performance_schema (pfs_stage_class).memory 38400
-performance_schema events_stages_history.row_size 88
-performance_schema events_stages_history.row_count 2890
-performance_schema events_stages_history.memory 254320
-performance_schema events_stages_history_long.row_size 88
-performance_schema events_stages_history_long.row_count 1000
-performance_schema events_stages_history_long.memory 88000
-performance_schema events_stages_summary_by_thread_by_event_name.row_size 32
-performance_schema events_stages_summary_by_thread_by_event_name.row_count 43350
-performance_schema events_stages_summary_by_thread_by_event_name.memory 1387200
-performance_schema events_stages_summary_global_by_event_name.row_size 32
-performance_schema events_stages_summary_global_by_event_name.row_count 150
-performance_schema events_stages_summary_global_by_event_name.memory 4800
-performance_schema events_stages_summary_by_account_by_event_name.row_size 32
-performance_schema events_stages_summary_by_account_by_event_name.row_count 15000
-performance_schema events_stages_summary_by_account_by_event_name.memory 480000
-performance_schema events_stages_summary_by_user_by_event_name.row_size 32
-performance_schema events_stages_summary_by_user_by_event_name.row_count 15000
-performance_schema events_stages_summary_by_user_by_event_name.memory 480000
-performance_schema events_stages_summary_by_host_by_event_name.row_size 32
-performance_schema events_stages_summary_by_host_by_event_name.row_count 15000
-performance_schema events_stages_summary_by_host_by_event_name.memory 480000
-performance_schema (pfs_statement_class).row_size 192
-performance_schema (pfs_statement_class).row_count 168
-performance_schema (pfs_statement_class).memory 32256
-performance_schema events_statements_history.row_size 3024
-performance_schema events_statements_history.row_count 2890
-performance_schema events_statements_history.memory 8739360
-performance_schema events_statements_history_long.row_size 3024
-performance_schema events_statements_history_long.row_count 1000
-performance_schema events_statements_history_long.memory 3024000
-performance_schema events_statements_summary_by_thread_by_event_name.row_size 184
-performance_schema events_statements_summary_by_thread_by_event_name.row_count 48552
-performance_schema events_statements_summary_by_thread_by_event_name.memory 8933568
-performance_schema events_statements_summary_global_by_event_name.row_size 184
-performance_schema events_statements_summary_global_by_event_name.row_count 168
-performance_schema events_statements_summary_global_by_event_name.memory 30912
-performance_schema events_statements_summary_by_account_by_event_name.row_size 184
-performance_schema events_statements_summary_by_account_by_event_name.row_count 16800
-performance_schema events_statements_summary_by_account_by_event_name.memory 3091200
-performance_schema events_statements_summary_by_user_by_event_name.row_size 184
-performance_schema events_statements_summary_by_user_by_event_name.row_count 16800
-performance_schema events_statements_summary_by_user_by_event_name.memory 3091200
-performance_schema events_statements_summary_by_host_by_event_name.row_size 184
-performance_schema events_statements_summary_by_host_by_event_name.row_count 16800
-performance_schema events_statements_summary_by_host_by_event_name.memory 3091200
-performance_schema events_statements_current.row_size 3024
-performance_schema events_statements_current.row_count 289
-performance_schema events_statements_current.memory 873936
-performance_schema (pfs_socket_class).row_size 320
-performance_schema (pfs_socket_class).row_count 10
-performance_schema (pfs_socket_class).memory 3200
-performance_schema socket_instances.row_size 320
-performance_schema socket_instances.row_count 232
-performance_schema socket_instances.memory 74240
-performance_schema events_statements_summary_by_digest.row_size 1472
-performance_schema events_statements_summary_by_digest.row_count 5000
-performance_schema events_statements_summary_by_digest.memory 7360000
-performance_schema session_connect_attrs.row_size 289
-performance_schema session_connect_attrs.row_count 512
-performance_schema session_connect_attrs.memory 147968
-performance_schema (account_hash).count 2
-performance_schema (account_hash).size 100
-performance_schema (digest_hash).count 0
-performance_schema (digest_hash).size 5000
-performance_schema (filename_hash).count 0
-performance_schema (filename_hash).size 1754
-performance_schema (host_hash).count 2
-performance_schema (host_hash).size 100
-performance_schema (setup_actor_hash).count 1
-performance_schema (setup_actor_hash).size 100
-performance_schema (setup_object_hash).count 4
-performance_schema (setup_object_hash).size 100
-performance_schema (table_share_hash).count 80
-performance_schema (table_share_hash).size 556
-performance_schema (user_hash).count 2
-performance_schema (user_hash).size 100
-performance_schema host_cache.size 336
-performance_schema performance_schema.memory 70954032
diff --git a/mysql-test/suite/perfschema/r/sizing_off.result b/mysql-test/suite/perfschema/r/sizing_off.result
index 0d95a8c0f1b..614ad7d2475 100644
--- a/mysql-test/suite/perfschema/r/sizing_off.result
+++ b/mysql-test/suite/perfschema/r/sizing_off.result
@@ -1,4 +1,6 @@
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema OFF
performance_schema_accounts_size -1
@@ -22,7 +24,6 @@ performance_schema_max_rwlock_instances -1
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances -1
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 168
performance_schema_max_table_handles -1
performance_schema_max_table_instances -1
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_disable_idle.result b/mysql-test/suite/perfschema/r/start_server_disable_idle.result
index b27ecd52226..9e0b9209b89 100644
--- a/mysql-test/suite/perfschema/r/start_server_disable_idle.result
+++ b/mysql-test/suite/perfschema/r/start_server_disable_idle.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_disable_stages.result b/mysql-test/suite/perfschema/r/start_server_disable_stages.result
index 0b8e00a5653..99b18e851a4 100644
--- a/mysql-test/suite/perfschema/r/start_server_disable_stages.result
+++ b/mysql-test/suite/perfschema/r/start_server_disable_stages.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_disable_statements.result b/mysql-test/suite/perfschema/r/start_server_disable_statements.result
index 8e8d1498b9f..5217f16a32f 100644
--- a/mysql-test/suite/perfschema/r/start_server_disable_statements.result
+++ b/mysql-test/suite/perfschema/r/start_server_disable_statements.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_disable_waits.result b/mysql-test/suite/perfschema/r/start_server_disable_waits.result
index d4b02dedc2c..86c25348cd5 100644
--- a/mysql-test/suite/perfschema/r/start_server_disable_waits.result
+++ b/mysql-test/suite/perfschema/r/start_server_disable_waits.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_innodb.result b/mysql-test/suite/perfschema/r/start_server_innodb.result
index 0d7ea7d6294..d03c20a5878 100644
--- a/mysql-test/suite/perfschema/r/start_server_innodb.result
+++ b/mysql-test/suite/perfschema/r/start_server_innodb.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_low_digest.result b/mysql-test/suite/perfschema/r/start_server_low_digest.result
new file mode 100644
index 00000000000..aff444250e0
--- /dev/null
+++ b/mysql-test/suite/perfschema/r/start_server_low_digest.result
@@ -0,0 +1,12 @@
+USE performance_schema;
+truncate table events_statements_history_long;
+SELECT 1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1;
+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1
+74
+####################################
+# QUERYING PS STATEMENT DIGEST
+####################################
+SELECT event_name, digest, digest_text, sql_text FROM events_statements_history_long;
+event_name digest digest_text sql_text
+statement/sql/truncate e1c917a43f978456fab15240f89372ca TRUNCATE TABLE truncate table events_statements_history_long
+statement/sql/select 4cc1c447d79877c4e8df0423fd0cde9a SELECT ? + ? + SELECT 1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1
diff --git a/mysql-test/suite/perfschema/r/start_server_no_account.result b/mysql-test/suite/perfschema/r/start_server_no_account.result
index b9ec719ed58..3e0324868a7 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_account.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_account.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 0
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_cond_class.result b/mysql-test/suite/perfschema/r/start_server_no_cond_class.result
index 4fac77bc0cc..158dfb81ebe 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_cond_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_cond_class.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result b/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result
index 75cd54776eb..3673600a078 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_file_class.result b/mysql-test/suite/perfschema/r/start_server_no_file_class.result
index 9922fcaa016..1e819d26265 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_file_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_file_class.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_file_inst.result b/mysql-test/suite/perfschema/r/start_server_no_file_inst.result
index 6e8735f6a1f..b439af66f8d 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_file_inst.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_file_inst.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_host.result b/mysql-test/suite/perfschema/r/start_server_no_host.result
index f5dae7c61d9..abb8a157ec6 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_host.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_host.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result b/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result
index 4b3c8790b58..c5fe555b749 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result b/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result
index 92ec4cf61fc..d88d808a9ab 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result b/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result
index e4ac0d0fa8b..1155993e60c 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result b/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result
index 3bba543f3b8..4d419817b0a 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 0
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_setup_actors.result b/mysql-test/suite/perfschema/r/start_server_no_setup_actors.result
index 2c3ef382fb9..281ca17491c 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_setup_actors.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_setup_actors.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_setup_objects.result b/mysql-test/suite/perfschema/r/start_server_no_setup_objects.result
index 0b49b4d055a..1e5578daddc 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_setup_objects.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_setup_objects.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_socket_class.result b/mysql-test/suite/perfschema/r/start_server_no_socket_class.result
index 9cf73c2b78d..ef1050d9fde 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_socket_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_socket_class.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 0
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_socket_inst.result b/mysql-test/suite/perfschema/r/start_server_no_socket_inst.result
index 6da66d6ee75..97cbc807f3c 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_socket_inst.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_socket_inst.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 0
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_stage_class.result b/mysql-test/suite/perfschema/r/start_server_no_stage_class.result
index 532935bb0ff..a173447632d 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_stage_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_stage_class.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 0
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_stages_history.result b/mysql-test/suite/perfschema/r/start_server_no_stages_history.result
index 360571bc326..6de6cc3187e 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_stages_history.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_stages_history.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_stages_history_long.result b/mysql-test/suite/perfschema/r/start_server_no_stages_history_long.result
index d458e3da9b1..fc0e680ebb7 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_stages_history_long.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_stages_history_long.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_statement_class.result b/mysql-test/suite/perfschema/r/start_server_no_statement_class.result
index 78fe9223ef4..fca5ab82238 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_statement_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_statement_class.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 0
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_statements_history.result b/mysql-test/suite/perfschema/r/start_server_no_statements_history.result
index 2682ea22f88..1fc13bf6ce3 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_statements_history.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_statements_history.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_statements_history_long.result b/mysql-test/suite/perfschema/r/start_server_no_statements_history_long.result
index 9568e9ad56b..d51d3acf343 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_statements_history_long.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_statements_history_long.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_table_hdl.result b/mysql-test/suite/perfschema/r/start_server_no_table_hdl.result
index c189d9a5024..784ed74e33c 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_table_hdl.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_table_hdl.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 0
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_table_inst.result b/mysql-test/suite/perfschema/r/start_server_no_table_inst.result
index a440cfe3302..da73df5c419 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_table_inst.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_table_inst.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 0
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_thread_class.result b/mysql-test/suite/perfschema/r/start_server_no_thread_class.result
index d9c945ea8cb..a84f0f3c0ef 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_thread_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_thread_class.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 0
diff --git a/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result b/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result
index f5ce5bebb51..3be29053b33 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_user.result b/mysql-test/suite/perfschema/r/start_server_no_user.result
index 53cb0051f97..d80a9a4a2c4 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_user.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_user.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_waits_history.result b/mysql-test/suite/perfschema/r/start_server_no_waits_history.result
index 125274550eb..928307123d8 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_waits_history.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_waits_history.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_waits_history_long.result b/mysql-test/suite/perfschema/r/start_server_no_waits_history_long.result
index 50212863574..d8ada5f9da5 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_waits_history_long.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_waits_history_long.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_nothing.result b/mysql-test/suite/perfschema/r/start_server_nothing.result
index 4e6994d670e..bf84848641c 100644
--- a/mysql-test/suite/perfschema/r/start_server_nothing.result
+++ b/mysql-test/suite/perfschema/r/start_server_nothing.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 0
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 0
performance_schema_max_socket_classes 0
performance_schema_max_socket_instances 0
performance_schema_max_stage_classes 0
-performance_schema_max_statement_classes 0
performance_schema_max_table_handles 0
performance_schema_max_table_instances 0
performance_schema_max_thread_classes 0
diff --git a/mysql-test/suite/perfschema/r/start_server_off.result b/mysql-test/suite/perfschema/r/start_server_off.result
index 08847829579..293607c41e9 100644
--- a/mysql-test/suite/perfschema/r/start_server_off.result
+++ b/mysql-test/suite/perfschema/r/start_server_off.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema OFF
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_on.result b/mysql-test/suite/perfschema/r/start_server_on.result
index 0d7ea7d6294..d03c20a5878 100644
--- a/mysql-test/suite/perfschema/r/start_server_on.result
+++ b/mysql-test/suite/perfschema/r/start_server_on.result
@@ -69,7 +69,9 @@ select * from performance_schema.table_io_waits_summary_by_table;
select * from performance_schema.table_lock_waits_summary_by_table;
select * from performance_schema.threads;
select * from performance_schema.users;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -93,7 +95,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/statement_digest.result b/mysql-test/suite/perfschema/r/statement_digest.result
index 41cba435cb6..e3df74a70d9 100644
--- a/mysql-test/suite/perfschema/r/statement_digest.result
+++ b/mysql-test/suite/perfschema/r/statement_digest.result
@@ -112,43 +112,42 @@ DROP TRIGGER trg;
SELECT SCHEMA_NAME, DIGEST, DIGEST_TEXT, COUNT_STAR, SUM_ROWS_AFFECTED, SUM_WARNINGS,
SUM_ERRORS FROM performance_schema.events_statements_summary_by_digest;
SCHEMA_NAME DIGEST DIGEST_TEXT COUNT_STAR SUM_ROWS_AFFECTED SUM_WARNINGS SUM_ERRORS
-statements_digest 0e98ee6a98e296530ec59c12dbc08dfe TRUNCATE TABLE performance_schema . events_statements_summary_by_digest 1 0 0 0
-statements_digest 954f43425c3234acc8e194afd97e8a0a SELECT ? FROM t1 1 0 0 0
-statements_digest fc365a54bc19d746bd24c27aba46b990 SELECT ? FROM `t1` 1 0 0 0
-statements_digest 27ba28f6252e4ae0e9b14b36da536fbe SELECT ?, ... FROM t1 2 0 0 0
-statements_digest 81d03922612900032ec4b81934ab4841 SELECT ? FROM t2 1 0 0 0
-statements_digest adce8aec12b6b5046cd4bf55951014c7 SELECT ?, ... FROM t2 2 0 0 0
-statements_digest 59a1bd93c424b10802fe66bb6dcd94d2 INSERT INTO t1 VALUES (?) 1 1 0 0
-statements_digest 91b2da58b0eb49c35a38fbc49f5e491d INSERT INTO t2 VALUES (?) 1 1 0 0
-statements_digest 967114adbf91d8a4a99ec5e49e909ff4 INSERT INTO t3 VALUES (...) 4 4 0 0
-statements_digest 8f25e7a48487e0aa7377e816816bb658 INSERT INTO t4 VALUES (...) 1 1 0 0
-statements_digest 4e51253af793867fba66166de1f314f7 INSERT INTO t5 VALUES (...) 1 1 0 0
-statements_digest fa47b3109e117216cd10209690d28596 INSERT INTO t1 VALUES (?) /* , ... */ 2 7 0 0
-statements_digest 72409f84bc236e6fe9f2f7b4d727f2d3 INSERT INTO t3 VALUES (...) /* , ... */ 1 3 0 0
-statements_digest d40aaddb41ed794d65dd8273f0c75700 INSERT INTO t5 VALUES (...) /* , ... */ 1 3 0 0
-statements_digest 57a82b28388e52e99fc64339dd30edde INSERT INTO t1 VALUES ( NULL ) 1 1 0 0
-statements_digest 6a56b694106442474cb0e5fb7575c8b9 INSERT INTO t6 VALUES (...) 5 5 0 0
-statements_digest c9abf55e296c4317dbaf2d14ef907ad7 SELECT ? + ? 3 0 0 0
-statements_digest 156304a0851a3e3626b39fb3da841a82 SELECT ? 1 0 0 0
+statements_digest 8de787d0e3e3a062aea121ff528fcfce TRUNCATE TABLE performance_schema . events_statements_summary_by_digest 1 0 0 0
+statements_digest a871edd1a65606b404c0b6e65c1f142c SELECT ? FROM t1 1 0 0 0
+statements_digest d60830f376a7724280dfc422224bb475 SELECT ? FROM `t1` 1 0 0 0
+statements_digest 09309c60c199a727b7ebed40975e8764 SELECT ?, ... FROM t1 2 0 0 0
+statements_digest dc0dcaefa9a12455ffed04ac6f89e65d SELECT ? FROM t2 1 0 0 0
+statements_digest d274a288509eae2cd7febf2f7fe36274 SELECT ?, ... FROM t2 2 0 0 0
+statements_digest ec913f89e0d8be99014bf78e73228c48 INSERT INTO t1 VALUES (?) 2 2 0 0
+statements_digest b919ecf2d5544bcdf95e76eb22231c42 INSERT INTO t2 VALUES (?) 1 1 0 0
+statements_digest d9030eddb8dca8ee5fcaf79e6f254b41 INSERT INTO t3 VALUES (...) 4 4 0 0
+statements_digest 2ad6d8279781b0fb40bdc8647dc94216 INSERT INTO t4 VALUES (...) 1 1 0 0
+statements_digest 3248c16dc70111225fcffa99641e312b INSERT INTO t5 VALUES (...) 1 1 0 0
+statements_digest 152b6c84a0cbfadcbecde01050eddd66 INSERT INTO t1 VALUES (?) /* , ... */ 2 7 0 0
+statements_digest c4cbce33b636e448c29e041b1d5c0eb1 INSERT INTO t3 VALUES (...) /* , ... */ 1 3 0 0
+statements_digest 0bfac9fb577995b116e52ff4aaeaa5b8 INSERT INTO t5 VALUES (...) /* , ... */ 1 3 0 0
+statements_digest 819acce11785e12f2f73964115632db6 INSERT INTO t6 VALUES (...) 5 5 0 0
+statements_digest aeb185ab9b6e9d5a49e47c8741b8acdf SELECT ? + ? 3 0 0 0
+statements_digest d3804664eeee11407f3fcbd5c29a1f73 SELECT ? 1 0 0 0
statements_digest 3b085ab0d2063dfca1a39212e3ea1831 CREATE SCHEMA statements_digest_temp 2 2 0 0
statements_digest 09f9fabef2feb9a54ba01455e5ae83b9 DROP SCHEMA statements_digest_temp 2 0 0 0
-statements_digest 7910a63ffd31cbcb742e15270c8958c8 SELECT ? FROM no_such_table 1 0 0 1
-statements_digest fa34540a438bc672478b1162505ee28c CREATE TABLE dup_table ( c CHARACTER (?) ) 2 0 0 1
-statements_digest 2c720f176bb7c8510ff8aca8921b9945 DROP TABLE dup_table 1 0 0 0
-statements_digest 0c7d9fd8c27ab067511da41ca3bcdff3 INSERT INTO t11 VALUES (?) 1 1 1 0
-statements_digest 81681ff345065ed72bcd1e9407ab85e4 SHOW WARNINGS 1 0 0 0
-statements_digest d766f5823ae5d8e4cf4602b8e7a3fb80 PREPARE stmt FROM ? 1 0 0 0
+statements_digest ff0bb1dfc399aa3bef6a0f3fccd3ef94 SELECT ? FROM no_such_table 1 0 0 1
+statements_digest 590a245c84e63eb100e1ef463f477f1a CREATE TABLE dup_table ( c CHARACTER (?) ) 2 0 0 1
+statements_digest 74078b0776d8333e356b271551587d53 DROP TABLE dup_table 1 0 0 0
+statements_digest f23641c5ab7e1dd6e0146f66b3fff5c4 INSERT INTO t11 VALUES (?) 1 1 1 0
+statements_digest d3eda26b379bd56340ce84fe395dfff7 SHOW WARNINGS 1 0 0 0
+statements_digest 6bb42dec3094486d5a9e8b0bf460e382 PREPARE stmt FROM ? 1 0 0 0
statements_digest 3ab1e87eabd9688edf919754cce6348b EXECUTE stmt 2 0 0 0
-statements_digest 470094469d250b9f45cab45bf610efe8 DEALLOCATE PREPARE stmt 1 0 0 0
-statements_digest 1b4d25358e08b35ad54e49dfe5eaf3e4 CREATE PROCEDURE p1 ( ) BEGIN SELECT * FROM t12 ; END 1 0 0 0
+statements_digest f9438ab7b8eec604338c28a04e5d650f DEALLOCATE PREPARE stmt 1 0 0 0
+statements_digest 072d6c57d3fe4f0c6a7dabba96f0ccf8 CREATE PROCEDURE p1 ( ) BEGIN SELECT * FROM t12 ; END 1 0 0 0
statements_digest 84554971243e91106214dcb8f4eaa89b CALL p1 ( ) 2 0 0 0
-statements_digest 77206e4bf30979c56752a7ed9150213a DROP PROCEDURE p1 1 0 0 0
-statements_digest 03b91dcdba6b0e29f7fb240ae4bcd97f CREATE FUNCTION `func` ( a INTEGER , b INTEGER ) RETURNS INTEGER (?) RETURN a + b 1 0 0 0
-statements_digest 72bc532f308f2dca62f5291df8c50e6f SELECT func (...) 2 0 0 0
+statements_digest 2bd1e1e6eb445f32e1d4b290c1961e6b DROP PROCEDURE p1 1 0 0 0
+statements_digest 5799522044ce9a4fa48dce5f4a3b047a CREATE FUNCTION `func` ( a INTEGER , b INTEGER ) RETURNS INTEGER (?) RETURN a + b 1 0 0 0
+statements_digest 59cbdd7ffc78a23bc2f650f8158067c6 SELECT func (...) 2 0 0 0
statements_digest 0b5a5297689c5036def6af8e8a8ce113 DROP FUNCTION func 1 0 0 0
-statements_digest d08331e42c67555ece50e46eef0f2b47 CREATE TRIGGER trg BEFORE INSERT ON t12 FOR EACH ROW SET @ ? := ? 1 0 0 0
-statements_digest 754a49a4de995c5a729e9ab52f135f59 INSERT INTO t12 VALUES (?) 2 2 0 0
-statements_digest 68df17752bca7c2c8ee2a6a19a0674e7 DROP TRIGGER trg 1 0 0 0
+statements_digest 10c7a2262748aa15496375d99f876fb2 CREATE TRIGGER trg BEFORE INSERT ON t12 FOR EACH ROW SET @? := ? 1 0 0 0
+statements_digest bb0154f3d32233f696b95d4127d29a3b INSERT INTO t12 VALUES (?) 2 2 0 0
+statements_digest a975545baf024e8a173be77032d8fd01 DROP TRIGGER trg 1 0 0 0
####################################
# CLEANUP
####################################
diff --git a/mysql-test/suite/perfschema/r/statement_digest_consumers.result b/mysql-test/suite/perfschema/r/statement_digest_consumers.result
index 21e62e13b19..355905f71d8 100644
--- a/mysql-test/suite/perfschema/r/statement_digest_consumers.result
+++ b/mysql-test/suite/perfschema/r/statement_digest_consumers.result
@@ -125,43 +125,42 @@ DROP TRIGGER trg;
####################################
SELECT schema_name, digest, digest_text, count_star FROM performance_schema.events_statements_summary_by_digest;
schema_name digest digest_text count_star
-statements_digest 0e98ee6a98e296530ec59c12dbc08dfe TRUNCATE TABLE performance_schema . events_statements_summary_by_digest 1
-statements_digest 954f43425c3234acc8e194afd97e8a0a SELECT ? FROM t1 1
-statements_digest fc365a54bc19d746bd24c27aba46b990 SELECT ? FROM `t1` 1
-statements_digest 27ba28f6252e4ae0e9b14b36da536fbe SELECT ?, ... FROM t1 2
-statements_digest 81d03922612900032ec4b81934ab4841 SELECT ? FROM t2 1
-statements_digest adce8aec12b6b5046cd4bf55951014c7 SELECT ?, ... FROM t2 2
-statements_digest 59a1bd93c424b10802fe66bb6dcd94d2 INSERT INTO t1 VALUES (?) 1
-statements_digest 91b2da58b0eb49c35a38fbc49f5e491d INSERT INTO t2 VALUES (?) 1
-statements_digest 967114adbf91d8a4a99ec5e49e909ff4 INSERT INTO t3 VALUES (...) 4
-statements_digest 8f25e7a48487e0aa7377e816816bb658 INSERT INTO t4 VALUES (...) 1
-statements_digest 4e51253af793867fba66166de1f314f7 INSERT INTO t5 VALUES (...) 1
-statements_digest fa47b3109e117216cd10209690d28596 INSERT INTO t1 VALUES (?) /* , ... */ 2
-statements_digest 72409f84bc236e6fe9f2f7b4d727f2d3 INSERT INTO t3 VALUES (...) /* , ... */ 1
-statements_digest d40aaddb41ed794d65dd8273f0c75700 INSERT INTO t5 VALUES (...) /* , ... */ 1
-statements_digest 57a82b28388e52e99fc64339dd30edde INSERT INTO t1 VALUES ( NULL ) 1
-statements_digest 6a56b694106442474cb0e5fb7575c8b9 INSERT INTO t6 VALUES (...) 5
-statements_digest c9abf55e296c4317dbaf2d14ef907ad7 SELECT ? + ? 3
-statements_digest 156304a0851a3e3626b39fb3da841a82 SELECT ? 1
+statements_digest 8de787d0e3e3a062aea121ff528fcfce TRUNCATE TABLE performance_schema . events_statements_summary_by_digest 1
+statements_digest a871edd1a65606b404c0b6e65c1f142c SELECT ? FROM t1 1
+statements_digest d60830f376a7724280dfc422224bb475 SELECT ? FROM `t1` 1
+statements_digest 09309c60c199a727b7ebed40975e8764 SELECT ?, ... FROM t1 2
+statements_digest dc0dcaefa9a12455ffed04ac6f89e65d SELECT ? FROM t2 1
+statements_digest d274a288509eae2cd7febf2f7fe36274 SELECT ?, ... FROM t2 2
+statements_digest ec913f89e0d8be99014bf78e73228c48 INSERT INTO t1 VALUES (?) 2
+statements_digest b919ecf2d5544bcdf95e76eb22231c42 INSERT INTO t2 VALUES (?) 1
+statements_digest d9030eddb8dca8ee5fcaf79e6f254b41 INSERT INTO t3 VALUES (...) 4
+statements_digest 2ad6d8279781b0fb40bdc8647dc94216 INSERT INTO t4 VALUES (...) 1
+statements_digest 3248c16dc70111225fcffa99641e312b INSERT INTO t5 VALUES (...) 1
+statements_digest 152b6c84a0cbfadcbecde01050eddd66 INSERT INTO t1 VALUES (?) /* , ... */ 2
+statements_digest c4cbce33b636e448c29e041b1d5c0eb1 INSERT INTO t3 VALUES (...) /* , ... */ 1
+statements_digest 0bfac9fb577995b116e52ff4aaeaa5b8 INSERT INTO t5 VALUES (...) /* , ... */ 1
+statements_digest 819acce11785e12f2f73964115632db6 INSERT INTO t6 VALUES (...) 5
+statements_digest aeb185ab9b6e9d5a49e47c8741b8acdf SELECT ? + ? 3
+statements_digest d3804664eeee11407f3fcbd5c29a1f73 SELECT ? 1
statements_digest 3b085ab0d2063dfca1a39212e3ea1831 CREATE SCHEMA statements_digest_temp 2
statements_digest 09f9fabef2feb9a54ba01455e5ae83b9 DROP SCHEMA statements_digest_temp 2
-statements_digest 7910a63ffd31cbcb742e15270c8958c8 SELECT ? FROM no_such_table 1
-statements_digest fa34540a438bc672478b1162505ee28c CREATE TABLE dup_table ( c CHARACTER (?) ) 2
-statements_digest 2c720f176bb7c8510ff8aca8921b9945 DROP TABLE dup_table 1
-statements_digest 0c7d9fd8c27ab067511da41ca3bcdff3 INSERT INTO t11 VALUES (?) 1
-statements_digest 81681ff345065ed72bcd1e9407ab85e4 SHOW WARNINGS 1
-statements_digest d766f5823ae5d8e4cf4602b8e7a3fb80 PREPARE stmt FROM ? 1
+statements_digest ff0bb1dfc399aa3bef6a0f3fccd3ef94 SELECT ? FROM no_such_table 1
+statements_digest 590a245c84e63eb100e1ef463f477f1a CREATE TABLE dup_table ( c CHARACTER (?) ) 2
+statements_digest 74078b0776d8333e356b271551587d53 DROP TABLE dup_table 1
+statements_digest f23641c5ab7e1dd6e0146f66b3fff5c4 INSERT INTO t11 VALUES (?) 1
+statements_digest d3eda26b379bd56340ce84fe395dfff7 SHOW WARNINGS 1
+statements_digest 6bb42dec3094486d5a9e8b0bf460e382 PREPARE stmt FROM ? 1
statements_digest 3ab1e87eabd9688edf919754cce6348b EXECUTE stmt 2
-statements_digest 470094469d250b9f45cab45bf610efe8 DEALLOCATE PREPARE stmt 1
-statements_digest 1b4d25358e08b35ad54e49dfe5eaf3e4 CREATE PROCEDURE p1 ( ) BEGIN SELECT * FROM t12 ; END 1
+statements_digest f9438ab7b8eec604338c28a04e5d650f DEALLOCATE PREPARE stmt 1
+statements_digest 072d6c57d3fe4f0c6a7dabba96f0ccf8 CREATE PROCEDURE p1 ( ) BEGIN SELECT * FROM t12 ; END 1
statements_digest 84554971243e91106214dcb8f4eaa89b CALL p1 ( ) 2
-statements_digest 77206e4bf30979c56752a7ed9150213a DROP PROCEDURE p1 1
-statements_digest 03b91dcdba6b0e29f7fb240ae4bcd97f CREATE FUNCTION `func` ( a INTEGER , b INTEGER ) RETURNS INTEGER (?) RETURN a + b 1
-statements_digest 72bc532f308f2dca62f5291df8c50e6f SELECT func (...) 2
+statements_digest 2bd1e1e6eb445f32e1d4b290c1961e6b DROP PROCEDURE p1 1
+statements_digest 5799522044ce9a4fa48dce5f4a3b047a CREATE FUNCTION `func` ( a INTEGER , b INTEGER ) RETURNS INTEGER (?) RETURN a + b 1
+statements_digest 59cbdd7ffc78a23bc2f650f8158067c6 SELECT func (...) 2
statements_digest 0b5a5297689c5036def6af8e8a8ce113 DROP FUNCTION func 1
-statements_digest d08331e42c67555ece50e46eef0f2b47 CREATE TRIGGER trg BEFORE INSERT ON t12 FOR EACH ROW SET @ ? := ? 1
-statements_digest 754a49a4de995c5a729e9ab52f135f59 INSERT INTO t12 VALUES (?) 2
-statements_digest 68df17752bca7c2c8ee2a6a19a0674e7 DROP TRIGGER trg 1
+statements_digest 10c7a2262748aa15496375d99f876fb2 CREATE TRIGGER trg BEFORE INSERT ON t12 FOR EACH ROW SET @? := ? 1
+statements_digest bb0154f3d32233f696b95d4127d29a3b INSERT INTO t12 VALUES (?) 2
+statements_digest a975545baf024e8a173be77032d8fd01 DROP TRIGGER trg 1
SELECT digest, digest_text FROM performance_schema.events_statements_current;
digest digest_text
####################################
diff --git a/mysql-test/suite/perfschema/r/statement_digest_long_query.result b/mysql-test/suite/perfschema/r/statement_digest_long_query.result
index bb355304537..f9943060c83 100644
--- a/mysql-test/suite/perfschema/r/statement_digest_long_query.result
+++ b/mysql-test/suite/perfschema/r/statement_digest_long_query.result
@@ -8,5 +8,5 @@ SELECT 1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1
####################################
SELECT schema_name, digest, digest_text, count_star FROM events_statements_summary_by_digest;
schema_name digest digest_text count_star
-performance_schema 9d35ff74210c6b30efa4559d627ed0f7 TRUNCATE TABLE events_statements_summary_by_digest 1
-performance_schema d78a04c1c42765b8552e0483c50ae9ff SELECT ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ... 1
+performance_schema 7536ab4a65b991a0b1a8b9851e8457c3 TRUNCATE TABLE events_statements_summary_by_digest 1
+performance_schema 63f9aaeed7859671c6a42c75fcd43785 SELECT ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? 1
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_global_2u_2t.result b/mysql-test/suite/perfschema/r/table_aggregate_global_2u_2t.result
index ea2980e5755..2613737a3da 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_global_2u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_global_2u_2t.result
@@ -39,7 +39,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -63,7 +65,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_global_2u_3t.result b/mysql-test/suite/perfschema/r/table_aggregate_global_2u_3t.result
index f51e8383019..e5aaf207820 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_global_2u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_global_2u_3t.result
@@ -38,7 +38,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -62,7 +64,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_global_4u_2t.result b/mysql-test/suite/perfschema/r/table_aggregate_global_4u_2t.result
index a7844b6b0e6..637d923ebdb 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_global_4u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_global_4u_2t.result
@@ -39,7 +39,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -63,7 +65,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_global_4u_3t.result b/mysql-test/suite/perfschema/r/table_aggregate_global_4u_3t.result
index 4d089c810a1..a41ae765a77 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_global_4u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_global_4u_3t.result
@@ -38,7 +38,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -62,7 +64,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_2t.result b/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_2t.result
index 23bd1294445..2278744621e 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_2t.result
@@ -37,7 +37,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -61,7 +63,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_3t.result b/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_3t.result
index 7edfc3824bb..b3ada0d638a 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_3t.result
@@ -36,7 +36,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -60,7 +62,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_2t.result b/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_2t.result
index 99d2e7d4655..361a8a700d0 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_2t.result
@@ -37,7 +37,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -61,7 +63,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_3t.result b/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_3t.result
index f8c660bd932..97bb0e34e0d 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_3t.result
@@ -36,7 +36,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -60,7 +62,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_off.result b/mysql-test/suite/perfschema/r/table_aggregate_off.result
index 73ed3550a77..f28f374c5dd 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_off.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_off.result
@@ -38,7 +38,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -62,7 +64,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_thread_2u_2t.result b/mysql-test/suite/perfschema/r/table_aggregate_thread_2u_2t.result
index 3906c6f6b84..f7760043ddd 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_thread_2u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_thread_2u_2t.result
@@ -39,7 +39,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -63,7 +65,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_thread_2u_3t.result b/mysql-test/suite/perfschema/r/table_aggregate_thread_2u_3t.result
index 0b579f54a66..0ee5eaddcaf 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_thread_2u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_thread_2u_3t.result
@@ -38,7 +38,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -62,7 +64,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_thread_4u_2t.result b/mysql-test/suite/perfschema/r/table_aggregate_thread_4u_2t.result
index e137525e5b0..025a7f27738 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_thread_4u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_thread_4u_2t.result
@@ -39,7 +39,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -63,7 +65,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_thread_4u_3t.result b/mysql-test/suite/perfschema/r/table_aggregate_thread_4u_3t.result
index 799555b685e..f655cd5bb93 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_thread_4u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_thread_4u_3t.result
@@ -38,7 +38,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -62,7 +64,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_2t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_2t.result
index bf920a30af3..55bb5a6a71f 100644
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_2t.result
@@ -41,7 +41,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -65,7 +67,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_3t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_3t.result
index d100f2a5e08..7f9f9e99359 100644
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_3t.result
@@ -40,7 +40,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -64,7 +66,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_2t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_2t.result
index a5d046f154c..7aa15b6a01d 100644
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_2t.result
@@ -41,7 +41,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -65,7 +67,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_3t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_3t.result
index 413a566fefb..0732fce5853 100644
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_3t.result
@@ -40,7 +40,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -64,7 +66,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_2t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_2t.result
index 4a5e7aeede1..c1f6fd56a97 100644
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_2t.result
@@ -39,7 +39,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -63,7 +65,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_3t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_3t.result
index 25ba676993a..705e6ca7021 100644
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_3t.result
@@ -38,7 +38,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -62,7 +64,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_2t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_2t.result
index 41292e5913e..04b7c7979c4 100644
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_2t.result
@@ -39,7 +39,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -63,7 +65,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_3t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_3t.result
index fc7c523ed8c..ef1f31b19a4 100644
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_3t.result
@@ -38,7 +38,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -62,7 +64,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_2t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_2t.result
index 210928a0c04..a7ac4fa860f 100644
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_2t.result
@@ -41,7 +41,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -65,7 +67,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_3t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_3t.result
index 9df65066d45..28bdcfb1d82 100644
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_3t.result
@@ -40,7 +40,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -64,7 +66,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_2t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_2t.result
index a9109fa42d2..683dd9cc4a6 100644
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_2t.result
@@ -41,7 +41,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -65,7 +67,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_3t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_3t.result
index 542b020f77a..d488066dd7f 100644
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_3t.result
@@ -40,7 +40,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -64,7 +66,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_2t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_2t.result
index ece0dadebd0..d3a4416fdfd 100644
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_2t.result
@@ -41,7 +41,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -65,7 +67,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_3t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_3t.result
index 956540b9327..c69fc8a37d3 100644
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_3t.result
@@ -40,7 +40,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -64,7 +66,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_2t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_2t.result
index 72f0240c6be..91110a94be5 100644
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_2t.result
@@ -41,7 +41,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -65,7 +67,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_3t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_3t.result
index a93cc1b6499..b443ac28c17 100644
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_3t.result
@@ -40,7 +40,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -64,7 +66,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_2t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_2t.result
index 0e1b7032af6..08a107acb2a 100644
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_2t.result
@@ -39,7 +39,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -63,7 +65,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_3t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_3t.result
index fb1fd8fb207..07272c6e204 100644
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_3t.result
@@ -38,7 +38,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -62,7 +64,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_2t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_2t.result
index f97272634b9..77c52780ae9 100644
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_2t.result
@@ -39,7 +39,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -63,7 +65,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_3t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_3t.result
index ddf8ef7bf9d..6d7192285e3 100644
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_3t.result
@@ -38,7 +38,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -62,7 +64,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_2t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_2t.result
index 588a378024a..160be444e7c 100644
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_2t.result
@@ -41,7 +41,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -65,7 +67,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_3t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_3t.result
index 76c466d48cc..e915a8dfa95 100644
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_3t.result
@@ -40,7 +40,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -64,7 +66,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_2t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_2t.result
index 2450456355a..82c1b65acff 100644
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_2t.result
@@ -41,7 +41,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -65,7 +67,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_3t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_3t.result
index 72b46a2820b..9023a4b0a69 100644
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_3t.result
@@ -40,7 +40,9 @@ truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;
-show variables like "performance_schema%";
+show variables where
+`Variable_name` != "performance_schema_max_statement_classes" and
+`Variable_name` like "performance_schema%";
Variable_name Value
performance_schema ON
performance_schema_accounts_size 100
@@ -64,7 +66,6 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 180
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/threads_mysql.result b/mysql-test/suite/perfschema/r/threads_mysql.result
index 4da857f83fc..6ab0b0641b0 100644
--- a/mysql-test/suite/perfschema/r/threads_mysql.result
+++ b/mysql-test/suite/perfschema/r/threads_mysql.result
@@ -13,7 +13,7 @@ processlist_user NULL
processlist_host NULL
processlist_db NULL
processlist_command NULL
-processlist_info INTERNAL DDL LOG RECOVER IN PROGRESS
+processlist_info NULL
unified_parent_thread_id NULL
role NULL
instrumented YES
diff --git a/mysql-test/suite/perfschema/t/aggregate.test b/mysql-test/suite/perfschema/t/aggregate.test
index 672737ae2a7..fe30a7b8697 100644
--- a/mysql-test/suite/perfschema/t/aggregate.test
+++ b/mysql-test/suite/perfschema/t/aggregate.test
@@ -6,6 +6,10 @@
--echo "General cleanup"
+# MDEV-7187 - test fails sporadically in buildbot
+set @aria_checkpoint_interval_save= @@global.aria_checkpoint_interval;
+set @@global.aria_checkpoint_interval= 0;
+
--disable_warnings
drop table if exists t1;
--enable_warnings
@@ -188,3 +192,6 @@ update performance_schema.setup_instruments
set enabled = 'YES', timed = 'YES';
drop table test.t1;
+
+set @@global.aria_checkpoint_interval= @aria_checkpoint_interval_save;
+
diff --git a/mysql-test/suite/perfschema/t/digest_null_literal.test b/mysql-test/suite/perfschema/t/digest_null_literal.test
new file mode 100644
index 00000000000..91f1eec1f95
--- /dev/null
+++ b/mysql-test/suite/perfschema/t/digest_null_literal.test
@@ -0,0 +1,32 @@
+# ----------------------------------------------------
+# Tests for the performance schema statement Digests.
+# ----------------------------------------------------
+
+# Test case to show behavior of statements digest when
+# parsing a NULL literal
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+--source include/no_protocol.inc
+
+TRUNCATE TABLE performance_schema.events_statements_summary_by_digest;
+
+--disable_query_log
+
+select NULL;
+select NULL FROM DUAL;
+select NULL, NULL;
+select NULL, NULL, NULL, 1, 2, 3, NULL, NULL;
+
+select 1 IS NULL;
+select 2 IS NOT NULL;
+select 1 IS NULL, 2 IS NULL, 3 IS NOT NULL, 4 IS NOT NULL;
+
+create table foo (a int DEFAULT NULL, b int NOT NULL DEFAULT 1, c int NOT NULL);
+drop table foo;
+
+--enable_query_log
+
+SELECT SCHEMA_NAME, DIGEST_TEXT, COUNT_STAR
+ FROM performance_schema.events_statements_summary_by_digest;
+
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_allow.test
index ae58f4089ed..c1af8516b79 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_allow.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_allow.test
@@ -8,7 +8,7 @@
--source include/not_embedded.inc
--source include/have_debug.inc
---source include/have_ipv6.inc
+--source include/check_ipv6.inc
--source include/have_perfschema.inc
# [Warning] Host name 'santa.claus.ipv6.example.com' could not be resolved:
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_deny.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_deny.test
index 8c408b160a6..a5ac18a8818 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_deny.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_deny.test
@@ -8,7 +8,7 @@
--source include/not_embedded.inc
--source include/have_debug.inc
---source include/have_ipv6.inc
+--source include/check_ipv6.inc
--source include/have_perfschema.inc
# [Warning] Host name 'santa.claus.ipv6.example.com' could not be resolved:
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_allow.test
index ccd0ae383ee..ae1de4f032e 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_allow.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_allow.test
@@ -8,7 +8,7 @@
--source include/not_embedded.inc
--source include/have_debug.inc
---source include/have_ipv6.inc
+--source include/check_ipv6.inc
--source include/have_perfschema.inc
# [Warning] Hostname 'santa.claus.ipv6.example.com' does not resolve to '2001:db8::6:6'.
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_deny.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_deny.test
index 72d5d693a1b..361a3ce6bd1 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_deny.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_deny.test
@@ -8,7 +8,7 @@
--source include/not_embedded.inc
--source include/have_debug.inc
---source include/have_ipv6.inc
+--source include/check_ipv6.inc
--source include/have_perfschema.inc
# [Warning] Hostname 'santa.claus.ipv6.example.com' does not resolve to '2001:db8::6:6'.
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_allow.test
index c253e4b77d5..9dbd682681e 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_allow.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_allow.test
@@ -8,7 +8,7 @@
--source include/not_embedded.inc
--source include/have_debug.inc
---source include/have_ipv6.inc
+--source include/check_ipv6.inc
--source include/have_perfschema.inc
# [Warning] IP address '192.0.2.4' could not be resolved:
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_deny.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_deny.test
index 096b4b11eb4..4836dfc2d36 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_deny.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_deny.test
@@ -8,7 +8,7 @@
--source include/not_embedded.inc
--source include/have_debug.inc
---source include/have_ipv6.inc
+--source include/check_ipv6.inc
--source include/have_perfschema.inc
# Enforce a clean state
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_allow.test
index 575dab9a337..b675b5089a8 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_allow.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_allow.test
@@ -8,7 +8,7 @@
--source include/not_embedded.inc
--source include/have_debug.inc
---source include/have_ipv6.inc
+--source include/check_ipv6.inc
--source include/have_perfschema.inc
# [Warning] Host name 'santa.claus.ipv6.example.com' could not be resolved:
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_deny.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_deny.test
index f6e5fa118df..9ce4fb926e6 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_deny.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_deny.test
@@ -8,7 +8,7 @@
--source include/not_embedded.inc
--source include/have_debug.inc
---source include/have_ipv6.inc
+--source include/check_ipv6.inc
--source include/have_perfschema.inc
# [Warning] Host name 'santa.claus.ipv6.example.com' could not be resolved:
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_auth_plugin.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_auth_plugin.test
index 0e0e900405a..9c8168e573a 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_auth_plugin.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_auth_plugin.test
@@ -10,7 +10,7 @@
--source include/not_embedded.inc
--source include/have_debug.inc
---source include/have_ipv6.inc
+--source include/check_ipv6.inc
--source include/have_perfschema.inc
--source include/have_plugin_auth.inc
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_blocked.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_blocked.test
index 9d4707dc027..cd78087dad1 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_blocked.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_blocked.test
@@ -10,7 +10,7 @@
--source include/not_embedded.inc
--source include/have_debug.inc
---source include/have_ipv6.inc
+--source include/check_ipv6.inc
--source include/have_perfschema.inc
# Enforce a clean state
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_max_con.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_max_con.test
index d4adc3e0d00..0ced79544a3 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_max_con.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_max_con.test
@@ -10,7 +10,7 @@
--source include/not_embedded.inc
--source include/have_debug.inc
---source include/have_ipv6.inc
+--source include/check_ipv6.inc
--source include/have_perfschema.inc
# Enforce a clean state
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_allow.test
index e396dbbad3c..983a6e80ff7 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_allow.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_allow.test
@@ -8,7 +8,7 @@
--source include/not_embedded.inc
--source include/have_debug.inc
---source include/have_ipv6.inc
+--source include/check_ipv6.inc
--source include/have_perfschema.inc
# [Warning] IP address '2001:db8::6:6' could not be resolved:
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_deny.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_deny.test
index cc7eb0b566f..3cdd87e4cf9 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_deny.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_deny.test
@@ -8,7 +8,7 @@
--source include/not_embedded.inc
--source include/have_debug.inc
---source include/have_ipv6.inc
+--source include/check_ipv6.inc
--source include/have_perfschema.inc
# [Warning] IP address '2001:db8::6:6' could not be resolved:
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_allow.test
index 80f07989212..3a30030413f 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_allow.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_allow.test
@@ -8,7 +8,7 @@
--source include/not_embedded.inc
--source include/have_debug.inc
---source include/have_ipv6.inc
+--source include/check_ipv6.inc
--source include/have_perfschema.inc
# [Warning] IP address '2001:db8::6:6' could not be resolved:
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_deny.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_deny.test
index 0d11e433b58..054940e4a02 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_deny.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_deny.test
@@ -8,7 +8,7 @@
--source include/not_embedded.inc
--source include/have_debug.inc
---source include/have_ipv6.inc
+--source include/check_ipv6.inc
--source include/have_perfschema.inc
# [Warning] IP address '2001:db8::6:6' could not be resolved:
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_passwd.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_passwd.test
index 6dd33b9bb5b..811c5c51c26 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_passwd.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_passwd.test
@@ -7,7 +7,7 @@
--source include/not_embedded.inc
--source include/have_debug.inc
---source include/have_ipv6.inc
+--source include/check_ipv6.inc
--source include/have_perfschema.inc
# Enforce a clean state
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_ssl.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_ssl.test
index 2b30a4eaf41..c11922624c6 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_ssl.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_ssl.test
@@ -7,7 +7,7 @@
--source include/not_embedded.inc
--source include/have_debug.inc
---source include/have_ipv6.inc
+--source include/check_ipv6.inc
--source include/have_perfschema.inc
# Enforce a clean state
diff --git a/mysql-test/suite/perfschema/t/nesting.test b/mysql-test/suite/perfschema/t/nesting.test
index 21e7260222a..29819770645 100644
--- a/mysql-test/suite/perfschema/t/nesting.test
+++ b/mysql-test/suite/perfschema/t/nesting.test
@@ -5,7 +5,7 @@
# On windows, the socket instrumentation collects an extra "opt"
# event, which changes the test output.
--source include/not_windows.inc
---source ../include/no_protocol.inc
+--source include/no_protocol.inc
--source ../include/wait_for_pfs_thread_count.inc
--disable_query_log
diff --git a/mysql-test/suite/perfschema/t/ortho_iter.test b/mysql-test/suite/perfschema/t/ortho_iter.test
index a9990e17409..0a90831ae70 100644
--- a/mysql-test/suite/perfschema/t/ortho_iter.test
+++ b/mysql-test/suite/perfschema/t/ortho_iter.test
@@ -126,8 +126,9 @@ $
delimiter ;$
# Check the configuration is ok
-show variables like "performance_schema%";
-show status like "performance_schema%";
+show variables where
+ `Variable_name` != "performance_schema_max_statement_classes" and
+ `Variable_name` like "performance_schema%";
call check_instrument("wait/synch/mutex/");
call check_instrument("wait/synch/rwlock/");
diff --git a/mysql-test/suite/perfschema/t/privilege_table_io.test b/mysql-test/suite/perfschema/t/privilege_table_io.test
index dc17fbcf67e..833fe85e8bb 100644
--- a/mysql-test/suite/perfschema/t/privilege_table_io.test
+++ b/mysql-test/suite/perfschema/t/privilege_table_io.test
@@ -36,7 +36,9 @@ insert into test.marker set a = 1;
# This will not, the ACL cache is already loaded
insert into test.marker set a = 1;
insert into test.marker set a = 1;
-show variables like "performance_schema%";
+show variables where
+ `Variable_name` != "performance_schema_max_statement_classes" and
+ `Variable_name` like "performance_schema%";
show status like "performance_schema%";
# Stop recording events + pull results
let $schema_to_dump= "test", "mysql";
diff --git a/mysql-test/suite/perfschema/t/rpl_gtid_func.test b/mysql-test/suite/perfschema/t/rpl_gtid_func.test
index 27837572bff..5a3fe0b7894 100644
--- a/mysql-test/suite/perfschema/t/rpl_gtid_func.test
+++ b/mysql-test/suite/perfschema/t/rpl_gtid_func.test
@@ -1,7 +1,7 @@
--source include/not_embedded.inc
--source include/have_innodb.inc
--source include/have_perfschema.inc
---source ../include/no_protocol.inc
+--source include/no_protocol.inc
-- source include/master-slave.inc
diff --git a/mysql-test/suite/perfschema/t/rpl_statements.test b/mysql-test/suite/perfschema/t/rpl_statements.test
index fa429cd2aa3..1aa52efd937 100644
--- a/mysql-test/suite/perfschema/t/rpl_statements.test
+++ b/mysql-test/suite/perfschema/t/rpl_statements.test
@@ -4,7 +4,7 @@
--source include/not_embedded.inc
--source include/have_innodb.inc
--source include/have_perfschema.inc
---source ../include/no_protocol.inc
+--source include/no_protocol.inc
--source include/have_binlog_format_mixed.inc
--source include/master-slave.inc
diff --git a/mysql-test/suite/perfschema/t/sizing_off.test b/mysql-test/suite/perfschema/t/sizing_off.test
index 83b49572cb4..32729918bd1 100644
--- a/mysql-test/suite/perfschema/t/sizing_off.test
+++ b/mysql-test/suite/perfschema/t/sizing_off.test
@@ -2,5 +2,7 @@
--source include/not_embedded.inc
--source include/have_perfschema.inc
-show variables like "performance_schema%";
+show variables where
+ `Variable_name` != "performance_schema_max_statement_classes" and
+ `Variable_name` like "performance_schema%";
show status like "performance_schema%";
diff --git a/mysql-test/suite/perfschema/t/socket_instances_func-master.opt b/mysql-test/suite/perfschema/t/socket_instances_func-master.opt
index ab6ca1731f5..b12a8b3b70e 100644
--- a/mysql-test/suite/perfschema/t/socket_instances_func-master.opt
+++ b/mysql-test/suite/perfschema/t/socket_instances_func-master.opt
@@ -1 +1 @@
---skip-name-resolve
+--skip-name-resolve --bind-address=*
diff --git a/mysql-test/suite/perfschema/t/socket_summary_by_event_name_func.test b/mysql-test/suite/perfschema/t/socket_summary_by_event_name_func.test
index 5ba3af1e408..c6860eb3213 100644
--- a/mysql-test/suite/perfschema/t/socket_summary_by_event_name_func.test
+++ b/mysql-test/suite/perfschema/t/socket_summary_by_event_name_func.test
@@ -26,7 +26,7 @@
# happens per SQL statement within our MTR tests. And there is a significant
# difference between standard statement execution and execution via
# prepared statement.
---source ../include/no_protocol.inc
+--source include/no_protocol.inc
# Set this to enable debugging output
let $my_socket_debug_dbug= 0;
diff --git a/mysql-test/suite/perfschema/t/socket_summary_by_instance_func.test b/mysql-test/suite/perfschema/t/socket_summary_by_instance_func.test
index ef5096d85ff..d06edb0d78f 100644
--- a/mysql-test/suite/perfschema/t/socket_summary_by_instance_func.test
+++ b/mysql-test/suite/perfschema/t/socket_summary_by_instance_func.test
@@ -36,7 +36,7 @@
# happens per SQL statement within our MTR tests. And there is a significant
# difference between standard statement execution and execution via
# prepared statement.
---source ../include/no_protocol.inc
+--source include/no_protocol.inc
#===================================
diff --git a/mysql-test/suite/perfschema/t/socket_summary_by_instance_func_win.test b/mysql-test/suite/perfschema/t/socket_summary_by_instance_func_win.test
index 5d4b4209b6e..cefaf1de549 100644
--- a/mysql-test/suite/perfschema/t/socket_summary_by_instance_func_win.test
+++ b/mysql-test/suite/perfschema/t/socket_summary_by_instance_func_win.test
@@ -38,7 +38,7 @@
# happens per SQL statement within our MTR tests. And there is a significant
# difference between standard statement execution and execution via
# prepared statement.
---source ../include/no_protocol.inc
+--source include/no_protocol.inc
#===================================
diff --git a/mysql-test/suite/perfschema/t/start_server_low_digest-master.opt b/mysql-test/suite/perfschema/t/start_server_low_digest-master.opt
new file mode 100644
index 00000000000..fc5065f9ae9
--- /dev/null
+++ b/mysql-test/suite/perfschema/t/start_server_low_digest-master.opt
@@ -0,0 +1 @@
+--max_digest_length=10
diff --git a/mysql-test/suite/perfschema/t/start_server_low_digest.test b/mysql-test/suite/perfschema/t/start_server_low_digest.test
new file mode 100644
index 00000000000..6f06def169b
--- /dev/null
+++ b/mysql-test/suite/perfschema/t/start_server_low_digest.test
@@ -0,0 +1,21 @@
+# -----------------------------------------------------------------------
+# Tests for the performance schema statement Digests.
+# -----------------------------------------------------------------------
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+--source include/no_protocol.inc
+
+USE performance_schema;
+truncate table events_statements_history_long;
+
+# -----------------------------------------------------------------------
+# Test to show how the digest behaves with low value of
+# - performance_schema_max_digest_length
+# -----------------------------------------------------------------------
+SELECT 1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1;
+
+--echo ####################################
+--echo # QUERYING PS STATEMENT DIGEST
+--echo ####################################
+SELECT event_name, digest, digest_text, sql_text FROM events_statements_history_long;
diff --git a/mysql-test/suite/perfschema/t/statement_digest_long_query.test b/mysql-test/suite/perfschema/t/statement_digest_long_query.test
index 3969383a6fb..b7ba18ef2cb 100644
--- a/mysql-test/suite/perfschema/t/statement_digest_long_query.test
+++ b/mysql-test/suite/perfschema/t/statement_digest_long_query.test
@@ -4,7 +4,7 @@
--source include/not_embedded.inc
--source include/have_perfschema.inc
---source ../include/no_protocol.inc
+--source include/no_protocol.inc
USE performance_schema;
truncate table events_statements_summary_by_digest;
diff --git a/mysql-test/suite/perfschema/t/unary_digest.test b/mysql-test/suite/perfschema/t/unary_digest.test
index c4583484f36..d8daea70d38 100644
--- a/mysql-test/suite/perfschema/t/unary_digest.test
+++ b/mysql-test/suite/perfschema/t/unary_digest.test
@@ -7,7 +7,7 @@
--source include/not_embedded.inc
--source include/have_perfschema.inc
---source ../include/no_protocol.inc
+--source include/no_protocol.inc
TRUNCATE TABLE performance_schema.events_statements_summary_by_digest;
diff --git a/mysql-test/suite/plugins/r/server_audit.result b/mysql-test/suite/plugins/r/server_audit.result
index cc474ceb970..bf71e518f97 100644
--- a/mysql-test/suite/plugins/r/server_audit.result
+++ b/mysql-test/suite/plugins/r/server_audit.result
@@ -11,10 +11,13 @@ server_audit_incl_users
server_audit_logging OFF
server_audit_mode 0
server_audit_output_type file
+server_audit_query_log_limit 1024
server_audit_syslog_facility LOG_USER
server_audit_syslog_ident mysql-server_auditing
server_audit_syslog_info
server_audit_syslog_priority LOG_INFO
+set global server_audit_file_path=null;
+set global server_audit_incl_users=null;
set global server_audit_file_path='server_audit.log';
set global server_audit_output_type=file;
set global server_audit_logging=on;
@@ -42,6 +45,11 @@ id
2
alter table t1 rename renamed_t1;
set global server_audit_events='connect,query';
+select 1,
+2,
+3;
+1 2 3
+1 2 3
insert into t2 values (1), (2);
select * from t2;
id
@@ -66,6 +74,7 @@ server_audit_incl_users odin, root, dva, tri
server_audit_logging ON
server_audit_mode 0
server_audit_output_type file
+server_audit_query_log_limit 1024
server_audit_syslog_facility LOG_USER
server_audit_syslog_ident mysql-server_auditing
server_audit_syslog_info
@@ -85,6 +94,101 @@ create table sa_t1(id int);
insert into sa_t1 values (1), (2);
drop table sa_t1;
drop database sa_db;
+create database sa_db;
+use sa_db;
+CREATE USER u1 IDENTIFIED BY 'pwd-123';
+GRANT ALL ON sa_db TO u2 IDENTIFIED BY "pwd-321";
+SET PASSWORD FOR u1 = PASSWORD('pwd 098');
+CREATE USER u3 IDENTIFIED BY '';
+drop user u1, u2, u3;
+set global server_audit_events='query_ddl';
+create table t1(id int);
+insert into t1 values (1), (2);
+select * from t1;
+id
+1
+2
+select 2;
+2
+2
+(select 2);
+2
+2
+/*! select 2*/;
+2
+2
+/*comment*/ select 2;
+2
+2
+drop table t1;
+set global server_audit_events='query_ddl,query_dml';
+create table t1(id int);
+insert into t1 values (1), (2);
+select * from t1;
+id
+1
+2
+select 2;
+2
+2
+drop table t1;
+set global server_audit_events='query_dml';
+create table t1(id int);
+insert into t1 values (1), (2);
+select * from t1;
+id
+1
+2
+select 2;
+2
+2
+(select 2);
+2
+2
+/*! select 2*/;
+2
+2
+/*comment*/ select 2;
+2
+2
+drop table t1;
+set global server_audit_events='query_dcl';
+create table t1(id int);
+insert into t1 values (1), (2);
+select * from t1;
+id
+1
+2
+CREATE USER u1 IDENTIFIED BY 'pwd-123';
+GRANT ALL ON sa_db TO u2 IDENTIFIED BY "pwd-321";
+SET PASSWORD FOR u1 = PASSWORD('pwd 098');
+SET PASSWORD FOR u1=<secret>;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '=<secret>' at line 1
+CREATE USER u3 IDENTIFIED BY '';
+drop user u1, u2, u3;
+select 2;
+2
+2
+(select 2);
+2
+2
+/*! select 2*/;
+2
+2
+/*comment*/ select 2;
+2
+2
+drop table t1;
+set global server_audit_events='';
+set global server_audit_query_log_limit= 15;
+select (1), (2), (3), (4);
+1 2 3 4
+1 2 3 4
+select 'A', 'B', 'C', 'D';
+A B C D
+A B C D
+set global server_audit_query_log_limit= 1024;
+drop database sa_db;
set global server_audit_file_path='.';
show status like 'server_audit_current_log';
Variable_name Value
@@ -115,6 +219,7 @@ server_audit_incl_users odin, root, dva, tri
server_audit_logging ON
server_audit_mode 1
server_audit_output_type file
+server_audit_query_log_limit 1024
server_audit_syslog_facility LOG_USER
server_audit_syslog_ident mysql-server_auditing
server_audit_syslog_info
@@ -148,6 +253,7 @@ TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,index_stats,
TIME,HOSTNAME,root,localhost,ID,ID,RENAME,test,t1|test.renamed_t1,
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'alter table t1 rename renamed_t1',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_events=\'connect,query\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select 1, 2, 3',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'insert into t2 values (1), (2)',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select * from t2',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select * from t_doesnt_exist',ID
@@ -184,19 +290,78 @@ TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proc,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,event,
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop database sa_db',0
TIME,HOSTNAME,root,localhost,ID,0,DISCONNECT,sa_db,,0
-TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_file_path=\'.\'',0
-TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_file_path=\'.\'',0
-TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'show status like \'server_audit_current_log\'',0
-TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_file_path=\'\'',0
-TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_file_path=\'\'',0
-TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'show status like \'server_audit_current_log\'',0
-TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_file_path=\' \'',0
-TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_file_path=\' \'',0
-TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'show status like \'server_audit_current_log\'',0
-TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_file_path=\'nonexisting_dir/\'',0
-TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_file_path=\'nonexisting_dir/\'',0
-TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'SHOW WARNINGS',0
-TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'show status like \'server_audit_current_log\'',0
-TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'show variables like \'server_audit%\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'create database sa_db',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'use sa_db',0
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,db,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,tables_priv,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,columns_priv,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,procs_priv,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proxies_priv,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,roles_mapping,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'CREATE USER u1 IDENTIFIED BY *****',0
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,tables_priv,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'GRANT ALL ON sa_db TO u2 IDENTIFIED BY *****',0
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'SET PASSWORD FOR u1 = PASSWORD(*****)',0
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,db,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,tables_priv,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,columns_priv,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,procs_priv,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proxies_priv,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,roles_mapping,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'CREATE USER u3 IDENTIFIED BY *****',0
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,db,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,tables_priv,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,columns_priv,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,procs_priv,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proxies_priv,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,roles_mapping,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop user u1, u2, u3',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'create table t1(id int)',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop table t1',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'create table t1(id int)',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'insert into t1 values (1), (2)',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'select * from t1',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'select 2',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop table t1',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'insert into t1 values (1), (2)',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'select * from t1',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'select 2',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'(select 2)',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'/*! select 2*/',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'/*comment*/ select 2',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'CREATE USER u1 IDENTIFIED BY *****',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'GRANT ALL ON sa_db TO u2 IDENTIFIED BY *****',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'SET PASSWORD FOR u1 = PASSWORD(*****)',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'SET PASSWORD FOR u1=<secret>',ID
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'CREATE USER u3 IDENTIFIED BY *****',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop user u1, u2, u3',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_events=\'\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global serv',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'select (1), (2)',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'select \'A\', ',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_query_log_limit= 1024',0
+TIME,HOSTNAME,root,localhost,ID,ID,READ,mysql,proc,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proc,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,event,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop database sa_db',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_file_path=\'.\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_file_path=\'.\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'show status like \'server_audit_current_log\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_file_path=\'\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_file_path=\'\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'show status like \'server_audit_current_log\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_file_path=\' \'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_file_path=\' \'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'show status like \'server_audit_current_log\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_file_path=\'nonexisting_dir/\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_file_path=\'nonexisting_dir/\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'SHOW WARNINGS',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'show status like \'server_audit_current_log\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'show variables like \'server_audit%\'',0
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,plugin,
-TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'uninstall plugin server_audit',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'uninstall plugin server_audit',0
diff --git a/mysql-test/suite/plugins/r/thread_pool_server_audit.result b/mysql-test/suite/plugins/r/thread_pool_server_audit.result
new file mode 100644
index 00000000000..bf71e518f97
--- /dev/null
+++ b/mysql-test/suite/plugins/r/thread_pool_server_audit.result
@@ -0,0 +1,367 @@
+install plugin server_audit soname 'server_audit';
+show variables like 'server_audit%';
+Variable_name Value
+server_audit_events
+server_audit_excl_users
+server_audit_file_path server_audit.log
+server_audit_file_rotate_now OFF
+server_audit_file_rotate_size 1000000
+server_audit_file_rotations 9
+server_audit_incl_users
+server_audit_logging OFF
+server_audit_mode 0
+server_audit_output_type file
+server_audit_query_log_limit 1024
+server_audit_syslog_facility LOG_USER
+server_audit_syslog_ident mysql-server_auditing
+server_audit_syslog_info
+server_audit_syslog_priority LOG_INFO
+set global server_audit_file_path=null;
+set global server_audit_incl_users=null;
+set global server_audit_file_path='server_audit.log';
+set global server_audit_output_type=file;
+set global server_audit_logging=on;
+connect(localhost,no_such_user,,mysql,MASTER_PORT,MASTER_SOCKET);
+ERROR 28000: Access denied for user 'no_such_user'@'localhost' (using password: NO)
+set global server_audit_incl_users='odin, dva, tri';
+create table t1 (id int);
+set global server_audit_incl_users='odin, root, dva, tri';
+create table t2 (id int);
+set global server_audit_excl_users='odin, dva, tri';
+Warnings:
+Warning 1 User 'odin' is in the server_audit_incl_users, so wasn't added.
+Warning 1 User 'dva' is in the server_audit_incl_users, so wasn't added.
+Warning 1 User 'tri' is in the server_audit_incl_users, so wasn't added.
+insert into t1 values (1), (2);
+select * from t1;
+id
+1
+2
+set global server_audit_incl_users='odin, root, dva, tri';
+insert into t2 values (1), (2);
+select * from t2;
+id
+1
+2
+alter table t1 rename renamed_t1;
+set global server_audit_events='connect,query';
+select 1,
+2,
+3;
+1 2 3
+1 2 3
+insert into t2 values (1), (2);
+select * from t2;
+id
+1
+2
+1
+2
+select * from t_doesnt_exist;
+ERROR 42S02: Table 'test.t_doesnt_exist' doesn't exist
+syntax_error_query;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'syntax_error_query' at line 1
+drop table renamed_t1, t2;
+show variables like 'server_audit%';
+Variable_name Value
+server_audit_events CONNECT,QUERY
+server_audit_excl_users
+server_audit_file_path server_audit.log
+server_audit_file_rotate_now OFF
+server_audit_file_rotate_size 1000000
+server_audit_file_rotations 9
+server_audit_incl_users odin, root, dva, tri
+server_audit_logging ON
+server_audit_mode 0
+server_audit_output_type file
+server_audit_query_log_limit 1024
+server_audit_syslog_facility LOG_USER
+server_audit_syslog_ident mysql-server_auditing
+server_audit_syslog_info
+server_audit_syslog_priority LOG_INFO
+set global server_audit_mode=1;
+set global server_audit_events='';
+create database sa_db;
+create table t1 (id2 int);
+insert into t1 values (1), (2);
+select * from t1;
+id2
+1
+2
+drop table t1;
+use sa_db;
+create table sa_t1(id int);
+insert into sa_t1 values (1), (2);
+drop table sa_t1;
+drop database sa_db;
+create database sa_db;
+use sa_db;
+CREATE USER u1 IDENTIFIED BY 'pwd-123';
+GRANT ALL ON sa_db TO u2 IDENTIFIED BY "pwd-321";
+SET PASSWORD FOR u1 = PASSWORD('pwd 098');
+CREATE USER u3 IDENTIFIED BY '';
+drop user u1, u2, u3;
+set global server_audit_events='query_ddl';
+create table t1(id int);
+insert into t1 values (1), (2);
+select * from t1;
+id
+1
+2
+select 2;
+2
+2
+(select 2);
+2
+2
+/*! select 2*/;
+2
+2
+/*comment*/ select 2;
+2
+2
+drop table t1;
+set global server_audit_events='query_ddl,query_dml';
+create table t1(id int);
+insert into t1 values (1), (2);
+select * from t1;
+id
+1
+2
+select 2;
+2
+2
+drop table t1;
+set global server_audit_events='query_dml';
+create table t1(id int);
+insert into t1 values (1), (2);
+select * from t1;
+id
+1
+2
+select 2;
+2
+2
+(select 2);
+2
+2
+/*! select 2*/;
+2
+2
+/*comment*/ select 2;
+2
+2
+drop table t1;
+set global server_audit_events='query_dcl';
+create table t1(id int);
+insert into t1 values (1), (2);
+select * from t1;
+id
+1
+2
+CREATE USER u1 IDENTIFIED BY 'pwd-123';
+GRANT ALL ON sa_db TO u2 IDENTIFIED BY "pwd-321";
+SET PASSWORD FOR u1 = PASSWORD('pwd 098');
+SET PASSWORD FOR u1=<secret>;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '=<secret>' at line 1
+CREATE USER u3 IDENTIFIED BY '';
+drop user u1, u2, u3;
+select 2;
+2
+2
+(select 2);
+2
+2
+/*! select 2*/;
+2
+2
+/*comment*/ select 2;
+2
+2
+drop table t1;
+set global server_audit_events='';
+set global server_audit_query_log_limit= 15;
+select (1), (2), (3), (4);
+1 2 3 4
+1 2 3 4
+select 'A', 'B', 'C', 'D';
+A B C D
+A B C D
+set global server_audit_query_log_limit= 1024;
+drop database sa_db;
+set global server_audit_file_path='.';
+show status like 'server_audit_current_log';
+Variable_name Value
+Server_audit_current_log HOME_DIR/server_audit.log
+set global server_audit_file_path='';
+show status like 'server_audit_current_log';
+Variable_name Value
+Server_audit_current_log server_audit.log
+set global server_audit_file_path=' ';
+show status like 'server_audit_current_log';
+Variable_name Value
+Server_audit_current_log server_audit.log
+set global server_audit_file_path='nonexisting_dir/';
+Warnings:
+Warning 1 SERVER AUDIT plugin can't create file 'nonexisting_dir/'.
+show status like 'server_audit_current_log';
+Variable_name Value
+Server_audit_current_log server_audit.log
+show variables like 'server_audit%';
+Variable_name Value
+server_audit_events
+server_audit_excl_users
+server_audit_file_path
+server_audit_file_rotate_now OFF
+server_audit_file_rotate_size 1000000
+server_audit_file_rotations 9
+server_audit_incl_users odin, root, dva, tri
+server_audit_logging ON
+server_audit_mode 1
+server_audit_output_type file
+server_audit_query_log_limit 1024
+server_audit_syslog_facility LOG_USER
+server_audit_syslog_ident mysql-server_auditing
+server_audit_syslog_info
+server_audit_syslog_priority LOG_INFO
+uninstall plugin server_audit;
+Warnings:
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_logging=on',0
+TIME,HOSTNAME,root,localhost,ID,0,CONNECT,mysql,,0
+TIME,HOSTNAME,root,localhost,ID,0,DISCONNECT,mysql,,0
+TIME,HOSTNAME,no_such_user,localhost,ID,0,FAILED_CONNECT,,,ID
+TIME,HOSTNAME,no_such_user,localhost,ID,0,DISCONNECT,,,0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_incl_users=\'odin, root, dva, tri\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,CREATE,test,t2,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'create table t2 (id int)',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_excl_users=\'odin, dva, tri\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'SHOW WARNINGS',0
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,test,t1,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'insert into t1 values (1), (2)',0
+TIME,HOSTNAME,root,localhost,ID,ID,READ,test,t1,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select * from t1',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_incl_users=\'odin, root, dva, tri\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,test,t2,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'insert into t2 values (1), (2)',0
+TIME,HOSTNAME,root,localhost,ID,ID,READ,test,t2,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select * from t2',0
+TIME,HOSTNAME,root,localhost,ID,ID,ALTER,test,t1,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,table_stats,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,column_stats,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,index_stats,
+TIME,HOSTNAME,root,localhost,ID,ID,RENAME,test,t1|test.renamed_t1,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'alter table t1 rename renamed_t1',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_events=\'connect,query\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select 1, 2, 3',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'insert into t2 values (1), (2)',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select * from t2',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select * from t_doesnt_exist',ID
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'syntax_error_query',ID
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'drop table renamed_t1, t2',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'show variables like \'server_audit%\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_mode=1',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_events=\'\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'create database sa_db',0
+TIME,HOSTNAME,root,localhost,ID,0,CONNECT,test,,0
+TIME,HOSTNAME,root,localhost,ID,ID,CREATE,test,t1,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'create table t1 (id2 int)',0
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,test,t1,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'insert into t1 values (1), (2)',0
+TIME,HOSTNAME,root,localhost,ID,ID,READ,test,t1,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select * from t1',0
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,table_stats,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,column_stats,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,index_stats,
+TIME,HOSTNAME,root,localhost,ID,ID,DROP,test,t1,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'drop table t1',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'use sa_db',0
+TIME,HOSTNAME,root,localhost,ID,ID,CREATE,sa_db,sa_t1,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'create table sa_t1(id int)',0
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,sa_db,sa_t1,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'insert into sa_t1 values (1), (2)',0
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,table_stats,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,column_stats,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,index_stats,
+TIME,HOSTNAME,root,localhost,ID,ID,DROP,sa_db,sa_t1,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop table sa_t1',0
+TIME,HOSTNAME,root,localhost,ID,ID,READ,mysql,proc,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proc,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,event,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop database sa_db',0
+TIME,HOSTNAME,root,localhost,ID,0,DISCONNECT,sa_db,,0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'create database sa_db',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'use sa_db',0
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,db,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,tables_priv,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,columns_priv,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,procs_priv,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proxies_priv,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,roles_mapping,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'CREATE USER u1 IDENTIFIED BY *****',0
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,tables_priv,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'GRANT ALL ON sa_db TO u2 IDENTIFIED BY *****',0
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'SET PASSWORD FOR u1 = PASSWORD(*****)',0
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,db,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,tables_priv,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,columns_priv,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,procs_priv,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proxies_priv,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,roles_mapping,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'CREATE USER u3 IDENTIFIED BY *****',0
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,db,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,tables_priv,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,columns_priv,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,procs_priv,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proxies_priv,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,roles_mapping,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop user u1, u2, u3',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'create table t1(id int)',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop table t1',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'create table t1(id int)',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'insert into t1 values (1), (2)',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'select * from t1',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'select 2',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop table t1',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'insert into t1 values (1), (2)',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'select * from t1',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'select 2',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'(select 2)',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'/*! select 2*/',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'/*comment*/ select 2',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'CREATE USER u1 IDENTIFIED BY *****',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'GRANT ALL ON sa_db TO u2 IDENTIFIED BY *****',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'SET PASSWORD FOR u1 = PASSWORD(*****)',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'SET PASSWORD FOR u1=<secret>',ID
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'CREATE USER u3 IDENTIFIED BY *****',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop user u1, u2, u3',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_events=\'\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global serv',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'select (1), (2)',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'select \'A\', ',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_query_log_limit= 1024',0
+TIME,HOSTNAME,root,localhost,ID,ID,READ,mysql,proc,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proc,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,event,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop database sa_db',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_file_path=\'.\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_file_path=\'.\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'show status like \'server_audit_current_log\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_file_path=\'\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_file_path=\'\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'show status like \'server_audit_current_log\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_file_path=\' \'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_file_path=\' \'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'show status like \'server_audit_current_log\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_file_path=\'nonexisting_dir/\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_file_path=\'nonexisting_dir/\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'SHOW WARNINGS',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'show status like \'server_audit_current_log\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'show variables like \'server_audit%\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,plugin,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'uninstall plugin server_audit',0
diff --git a/mysql-test/suite/plugins/t/server_audit.test b/mysql-test/suite/plugins/t/server_audit.test
index 869fd944d51..52428909c3b 100644
--- a/mysql-test/suite/plugins/t/server_audit.test
+++ b/mysql-test/suite/plugins/t/server_audit.test
@@ -8,13 +8,17 @@ if (!$SERVER_AUDIT_SO) {
install plugin server_audit soname 'server_audit';
show variables like 'server_audit%';
+set global server_audit_file_path=null;
+set global server_audit_incl_users=null;
set global server_audit_file_path='server_audit.log';
set global server_audit_output_type=file;
set global server_audit_logging=on;
+--sleep 2
connect (con1,localhost,root,,mysql);
connection default;
disconnect con1;
--sleep 2
+--sleep 2
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error ER_ACCESS_DENIED_ERROR
connect (con1,localhost,no_such_user,,mysql);
@@ -32,6 +36,9 @@ insert into t2 values (1), (2);
select * from t2;
alter table t1 rename renamed_t1;
set global server_audit_events='connect,query';
+select 1,
+ 2,
+ 3;
insert into t2 values (1), (2);
select * from t2;
--error ER_NO_SUCH_TABLE
@@ -46,6 +53,8 @@ create database sa_db;
--sleep 2
connect (con1,localhost,root,,test);
connection con1;
+--sleep 2
+--sleep 2
create table t1 (id2 int);
insert into t1 values (1), (2);
select * from t1;
@@ -57,8 +66,64 @@ drop table sa_t1;
drop database sa_db;
connection default;
disconnect con1;
-
--sleep 2
+--sleep 2
+create database sa_db;
+use sa_db;
+CREATE USER u1 IDENTIFIED BY 'pwd-123';
+GRANT ALL ON sa_db TO u2 IDENTIFIED BY "pwd-321";
+SET PASSWORD FOR u1 = PASSWORD('pwd 098');
+CREATE USER u3 IDENTIFIED BY '';
+drop user u1, u2, u3;
+
+set global server_audit_events='query_ddl';
+create table t1(id int);
+insert into t1 values (1), (2);
+select * from t1;
+select 2;
+(select 2);
+/*! select 2*/;
+/*comment*/ select 2;
+drop table t1;
+set global server_audit_events='query_ddl,query_dml';
+create table t1(id int);
+insert into t1 values (1), (2);
+select * from t1;
+select 2;
+drop table t1;
+set global server_audit_events='query_dml';
+create table t1(id int);
+insert into t1 values (1), (2);
+select * from t1;
+select 2;
+(select 2);
+/*! select 2*/;
+/*comment*/ select 2;
+drop table t1;
+set global server_audit_events='query_dcl';
+create table t1(id int);
+insert into t1 values (1), (2);
+select * from t1;
+CREATE USER u1 IDENTIFIED BY 'pwd-123';
+GRANT ALL ON sa_db TO u2 IDENTIFIED BY "pwd-321";
+SET PASSWORD FOR u1 = PASSWORD('pwd 098');
+--error 1064
+SET PASSWORD FOR u1=<secret>;
+CREATE USER u3 IDENTIFIED BY '';
+drop user u1, u2, u3;
+select 2;
+(select 2);
+/*! select 2*/;
+/*comment*/ select 2;
+drop table t1;
+set global server_audit_events='';
+
+set global server_audit_query_log_limit= 15;
+select (1), (2), (3), (4);
+select 'A', 'B', 'C', 'D';
+set global server_audit_query_log_limit= 1024;
+drop database sa_db;
+
set global server_audit_file_path='.';
--replace_regex /\.[\\\/]/HOME_DIR\//
show status like 'server_audit_current_log';
diff --git a/mysql-test/suite/plugins/t/thread_pool_server_audit.opt b/mysql-test/suite/plugins/t/thread_pool_server_audit.opt
new file mode 100644
index 00000000000..30953d0c574
--- /dev/null
+++ b/mysql-test/suite/plugins/t/thread_pool_server_audit.opt
@@ -0,0 +1,2 @@
+--thread_handling=pool-of-threads
+
diff --git a/mysql-test/suite/plugins/t/thread_pool_server_audit.test b/mysql-test/suite/plugins/t/thread_pool_server_audit.test
new file mode 100644
index 00000000000..626d4136c47
--- /dev/null
+++ b/mysql-test/suite/plugins/t/thread_pool_server_audit.test
@@ -0,0 +1,144 @@
+--source include/not_embedded.inc
+--source include/have_pool_of_threads.inc
+
+if (!$SERVER_AUDIT_SO) {
+ skip No SERVER_AUDIT plugin;
+}
+
+install plugin server_audit soname 'server_audit';
+
+show variables like 'server_audit%';
+set global server_audit_file_path=null;
+set global server_audit_incl_users=null;
+set global server_audit_file_path='server_audit.log';
+set global server_audit_output_type=file;
+set global server_audit_logging=on;
+--sleep 2
+connect (con1,localhost,root,,mysql);
+connection default;
+disconnect con1;
+--sleep 2
+--sleep 2
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+--error ER_ACCESS_DENIED_ERROR
+connect (con1,localhost,no_such_user,,mysql);
+connection default;
+--sleep 2
+set global server_audit_incl_users='odin, dva, tri';
+create table t1 (id int);
+set global server_audit_incl_users='odin, root, dva, tri';
+create table t2 (id int);
+set global server_audit_excl_users='odin, dva, tri';
+insert into t1 values (1), (2);
+select * from t1;
+set global server_audit_incl_users='odin, root, dva, tri';
+insert into t2 values (1), (2);
+select * from t2;
+alter table t1 rename renamed_t1;
+set global server_audit_events='connect,query';
+select 1,
+ 2,
+ 3;
+insert into t2 values (1), (2);
+select * from t2;
+--error ER_NO_SUCH_TABLE
+select * from t_doesnt_exist;
+--error 1064
+syntax_error_query;
+drop table renamed_t1, t2;
+show variables like 'server_audit%';
+set global server_audit_mode=1;
+set global server_audit_events='';
+create database sa_db;
+--sleep 2
+connect (con1,localhost,root,,test);
+connection con1;
+--sleep 2
+--sleep 2
+create table t1 (id2 int);
+insert into t1 values (1), (2);
+select * from t1;
+drop table t1;
+use sa_db;
+create table sa_t1(id int);
+insert into sa_t1 values (1), (2);
+drop table sa_t1;
+drop database sa_db;
+connection default;
+disconnect con1;
+--sleep 2
+--sleep 2
+create database sa_db;
+use sa_db;
+CREATE USER u1 IDENTIFIED BY 'pwd-123';
+GRANT ALL ON sa_db TO u2 IDENTIFIED BY "pwd-321";
+SET PASSWORD FOR u1 = PASSWORD('pwd 098');
+CREATE USER u3 IDENTIFIED BY '';
+drop user u1, u2, u3;
+
+set global server_audit_events='query_ddl';
+create table t1(id int);
+insert into t1 values (1), (2);
+select * from t1;
+select 2;
+(select 2);
+/*! select 2*/;
+/*comment*/ select 2;
+drop table t1;
+set global server_audit_events='query_ddl,query_dml';
+create table t1(id int);
+insert into t1 values (1), (2);
+select * from t1;
+select 2;
+drop table t1;
+set global server_audit_events='query_dml';
+create table t1(id int);
+insert into t1 values (1), (2);
+select * from t1;
+select 2;
+(select 2);
+/*! select 2*/;
+/*comment*/ select 2;
+drop table t1;
+set global server_audit_events='query_dcl';
+create table t1(id int);
+insert into t1 values (1), (2);
+select * from t1;
+CREATE USER u1 IDENTIFIED BY 'pwd-123';
+GRANT ALL ON sa_db TO u2 IDENTIFIED BY "pwd-321";
+SET PASSWORD FOR u1 = PASSWORD('pwd 098');
+--error 1064
+SET PASSWORD FOR u1=<secret>;
+CREATE USER u3 IDENTIFIED BY '';
+drop user u1, u2, u3;
+select 2;
+(select 2);
+/*! select 2*/;
+/*comment*/ select 2;
+drop table t1;
+set global server_audit_events='';
+
+set global server_audit_query_log_limit= 15;
+select (1), (2), (3), (4);
+select 'A', 'B', 'C', 'D';
+set global server_audit_query_log_limit= 1024;
+drop database sa_db;
+
+set global server_audit_file_path='.';
+--replace_regex /\.[\\\/]/HOME_DIR\//
+show status like 'server_audit_current_log';
+set global server_audit_file_path='';
+show status like 'server_audit_current_log';
+set global server_audit_file_path=' ';
+show status like 'server_audit_current_log';
+set global server_audit_file_path='nonexisting_dir/';
+show status like 'server_audit_current_log';
+show variables like 'server_audit%';
+uninstall plugin server_audit;
+
+let $MYSQLD_DATADIR= `SELECT @@datadir`;
+# replace the timestamp and the hostname with constant values
+--replace_regex /[0-9]* [0-9][0-9]:[0-9][0-9]:[0-9][0-9]\,[^,]*\,/TIME,HOSTNAME,/ /\,[1-9][0-9]*\,/,1,/ /\,[1-9][0-9]*/,ID/
+cat_file $MYSQLD_DATADIR/server_audit.log;
+remove_file $MYSQLD_DATADIR/server_audit.log;
+
diff --git a/mysql-test/suite/roles/create_and_drop_role.result b/mysql-test/suite/roles/create_and_drop_role.result
index 2974dd20e22..79c6f412111 100644
--- a/mysql-test/suite/roles/create_and_drop_role.result
+++ b/mysql-test/suite/roles/create_and_drop_role.result
@@ -46,3 +46,21 @@ Note 1449 The user specified as a definer ('u1'@'%') does not exist
create user foo@bar;
drop user foo@bar;
drop role r1;
+CREATE USER u1;
+CREATE ROLE r1;
+CREATE USER r1@localhost;
+CREATE ROLE r2;
+GRANT r2 to r1;
+GRANT r2 to r1@localhost;
+DROP ROLE r1;
+SELECT * FROM mysql.roles_mapping;
+Host User Role Admin_option
+localhost r1 r2 N
+localhost root r2 Y
+SHOW GRANTS FOR r1@localhost;
+Grants for r1@localhost
+GRANT r2 TO 'r1'@'localhost'
+GRANT USAGE ON *.* TO 'r1'@'localhost'
+DROP USER u1;
+DROP ROLE r2;
+DROP USER r1@localhost;
diff --git a/mysql-test/suite/roles/create_and_drop_role.test b/mysql-test/suite/roles/create_and_drop_role.test
index 38f040789e0..0bf5b744e6b 100644
--- a/mysql-test/suite/roles/create_and_drop_role.test
+++ b/mysql-test/suite/roles/create_and_drop_role.test
@@ -68,3 +68,22 @@ create user foo@bar;
drop user foo@bar;
drop role r1;
+#
+# MDEV-7774 Assertion `status == 0' fails when dropping in this order:
+#
+CREATE USER u1;
+CREATE ROLE r1;
+CREATE USER r1@localhost;
+CREATE ROLE r2;
+GRANT r2 to r1;
+GRANT r2 to r1@localhost;
+# MDEV-7774: Dropping in this order caused the crash.
+DROP ROLE r1;
+--sorted_result
+SELECT * FROM mysql.roles_mapping;
+SHOW GRANTS FOR r1@localhost; # Related to MDEV-7774, also caused a crash, by
+ # not updating the internal acl_roles_mapping
+ # data structure correctly;
+DROP USER u1;
+DROP ROLE r2;
+DROP USER r1@localhost;
diff --git a/mysql-test/suite/rpl/r/rpl_drop_db_fail.result b/mysql-test/suite/rpl/r/rpl_drop_db_fail.result
new file mode 100644
index 00000000000..1be90338493
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_drop_db_fail.result
@@ -0,0 +1,16 @@
+include/master-slave.inc
+[connection master]
+CREATE DATABASE IF NOT EXISTS db1;
+CREATE DATABASE IF NOT EXISTS db2;
+use db1;
+CREATE TABLE a(id INT);
+CREATE VIEW v AS SELECT * FROM a;
+CREATE TABLE table_father(id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(20)) ENGINE=INNODB;
+use db2;
+CREATE TABLE table_child(id INT PRIMARY KEY, info VARCHAR(20), father_id INT) ENGINE=INNODB;
+ALTER TABLE table_child ADD CONSTRAINT aaa FOREIGN KEY (father_id) REFERENCES db1.table_father(id);
+DROP DATABASE db1;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
+DROP DATABASE db2;
+DROP DATABASE db1;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_basic.result b/mysql-test/suite/rpl/r/rpl_gtid_basic.result
index 465cc875af0..f3b52d89eb4 100644
--- a/mysql-test/suite/rpl/r/rpl_gtid_basic.result
+++ b/mysql-test/suite/rpl/r/rpl_gtid_basic.result
@@ -310,7 +310,7 @@ master_gtid_wait('2-1-10')
0
master_gtid_wait('2-1-10')
0
-*** Test sql_gtid_slave_pos when used with GTID ***
+*** Test gtid_slave_pos when used with GTID ***
include/stop_slave.inc
SET gtid_domain_id=2;
SET gtid_seq_no=1000;
@@ -413,5 +413,26 @@ SELECT IF(LOCATE("2-1-1040", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! ex
status
Ok
SET GLOBAL slave_ddl_exec_mode= @saved_mode;
+*** Test GTID-connecting to a master with out-of-order sequence numbers in the binlog. ***
+SET gtid_domain_id= @@GLOBAL.gtid_domain_id;
+INSERT INTO t1 VALUES (31);
+SET gtid_domain_id= @@GLOBAL.gtid_domain_id;
+INSERT INTO t1 VALUES (32);
+INSERT INTO t1 VALUES (33);
+include/stop_slave.inc
+INSERT INTO t1 VALUES (34);
+include/start_slave.inc
+SELECT * FROM t1 WHERE a >= 30 ORDER BY a;
+a
+31
+32
+33
+34
+SELECT * FROM t1 WHERE a >= 30 ORDER BY a;
+a
+31
+32
+33
+34
DROP TABLE t1;
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_crash.result b/mysql-test/suite/rpl/r/rpl_gtid_crash.result
index 75bd9d0cbb1..0c2249f2dce 100644
--- a/mysql-test/suite/rpl/r/rpl_gtid_crash.result
+++ b/mysql-test/suite/rpl/r/rpl_gtid_crash.result
@@ -267,5 +267,55 @@ a
24
26
27
+*** MDEV-6391: GTID binlog state not recovered if mariadb-bin.state is removed ***
+include/stop_slave.inc
+INSERT INTO t1 VALUES (30);
+SET @old_server_id= @@server_id;
+SET @old_domain_id= @@gtid_domain_id;
+SET SESSION server_id= 10;
+INSERT INTO t1 VALUES (31);
+INSERT INTO t1 VALUES (32);
+SET SESSION gtid_domain_id= 1;
+SET SESSION server_id=11;
+INSERT INTO t1 VALUES (33);
+SET SESSION gtid_domain_id= 2;
+INSERT INTO t1 VALUES (34);
+SET SESSION server_id= 10;
+INSERT INTO t1 VALUES (35);
+INSERT INTO t1 VALUES (36);
+SET SESSION gtid_domain_id= 0;
+SET SESSION server_id= 12;
+INSERT INTO t1 VALUES (37);
+SET SESSION gtid_domain_id= @old_domain_id;
+SET SESSION server_id= @old_server_id;
+INSERT INTO t1 VALUES (38);
+INSERT INTO t1 VALUES (39);
+SELECT * FROM t1 WHERE a >= 30 ORDER BY a;
+a
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+include/save_master_gtid.inc
+include/start_slave.inc
+include/sync_with_master_gtid.inc
+SELECT * FROM t1 WHERE a >= 30 ORDER BY a;
+a
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
DROP TABLE t1;
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_errorhandling.result b/mysql-test/suite/rpl/r/rpl_gtid_errorhandling.result
index 385a374888c..a2bf8b567e8 100644
--- a/mysql-test/suite/rpl/r/rpl_gtid_errorhandling.result
+++ b/mysql-test/suite/rpl/r/rpl_gtid_errorhandling.result
@@ -179,7 +179,7 @@ a
SET sql_log_bin=0;
CALL mtr.add_suppression("Slave: Could not update replication slave gtid state");
SET sql_log_bin=1;
-*** MDEV-4906: When event apply fails, next SQL thread start errorneously commits the failing GTID to gtid_slave_pos ***
+*** MDEV-4906: When event apply fails, next SQL thread start erroneously commits the failing GTID to gtid_slave_pos ***
include/stop_slave.inc
SET sql_log_bin=0;
DELETE FROM t2;
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_misc.result b/mysql-test/suite/rpl/r/rpl_gtid_misc.result
new file mode 100644
index 00000000000..cdaac1b1d34
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_gtid_misc.result
@@ -0,0 +1,25 @@
+include/master-slave.inc
+[connection master]
+*** MDEV-6403: Temporary tables lost at STOP SLAVE in GTID mode if master has not rotated binlog since restart ***
+CREATE TABLE t1 (a INT PRIMARY KEY);
+include/stop_slave.inc
+SET sql_log_bin= 0;
+INSERT INTO t1 VALUES (1);
+SET sql_log_bin= 1;
+CHANGE MASTER TO master_use_gtid= current_pos;
+CREATE TEMPORARY TABLE t2 LIKE t1;
+INSERT INTO t2 VALUE (1);
+INSERT INTO t1 SELECT * FROM t2;
+DROP TEMPORARY TABLE t2;
+START SLAVE;
+include/wait_for_slave_sql_error.inc [errno=1062]
+STOP SLAVE IO_THREAD;
+SET sql_log_bin= 0;
+DELETE FROM t1 WHERE a=1;
+SET sql_log_bin= 1;
+include/start_slave.inc
+SELECT * FROM t1 ORDER BY a;
+a
+1
+DROP TABLE t1;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_until.result b/mysql-test/suite/rpl/r/rpl_gtid_until.result
index d86b5cac78c..c23faecc674 100644
--- a/mysql-test/suite/rpl/r/rpl_gtid_until.result
+++ b/mysql-test/suite/rpl/r/rpl_gtid_until.result
@@ -44,14 +44,14 @@ a
1
2
include/stop_slave.inc
-START SLAVE UNTIL master_gtid_pos = "1-10-100,2-20-200";
+START SLAVE UNTIL master_gtid_pos = "1-10-100,2-20-200,0-1-300";
include/wait_for_slave_to_start.inc
Using_Gtid = 'Current_Pos'
Until_Condition = 'Gtid'
+INSERT INTO t1 VALUES (3);
+DELETE FROM t1 WHERE a=3;
include/stop_slave.inc
-include/start_slave.inc
*** Test UNTIL condition in an earlier binlog than the start GTID. ***
-include/stop_slave.inc
SET gtid_domain_id = 1;
INSERT INTO t1 VALUES (3);
SET gtid_domain_id = 2;
diff --git a/mysql-test/suite/rpl/r/rpl_master_pos_wait.result b/mysql-test/suite/rpl/r/rpl_master_pos_wait.result
index bf4347757f7..78bda5a1c6f 100644
--- a/mysql-test/suite/rpl/r/rpl_master_pos_wait.result
+++ b/mysql-test/suite/rpl/r/rpl_master_pos_wait.result
@@ -18,4 +18,26 @@ show slave status;
select master_pos_wait('foo', 98);
master_pos_wait('foo', 98)
NULL
+*** MDEV-7130: MASTER_POS_WAIT(log_name,log_pos,timeout,"connection_name") hangs, does not respect the timeout ***
+include/stop_slave.inc
+reset slave all;
+change master 'my_slave' to master_port=MASTER_MYPORT, master_host='127.0.0.1', master_user='root';
+set default_master_connection = 'my_slave';
+include/start_slave.inc
+# Call without connection name -- works (expected -1)
+select master_pos_wait('master-bin.000001',1000000,1);
+master_pos_wait('master-bin.000001',1000000,1)
+-1
+set default_master_connection = '';
+# Call for non-existing anonymous connection -- works (expected NULL)
+select master_pos_wait('master-bin.000001',1000000,1);
+master_pos_wait('master-bin.000001',1000000,1)
+NULL
+# Call with a valid connection name -- hangs before MDEV-7130 fix (expected -1)
+select master_pos_wait('master-bin.000001',1000000,1,"my_slave");
+master_pos_wait('master-bin.000001',1000000,1,"my_slave")
+-1
+STOP SLAVE 'my_slave';
+RESET SLAVE 'my_slave' ALL;
+change master to master_port=MASTER_MYPORT, master_host='127.0.0.1', master_user='root';
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_old_decimal.result b/mysql-test/suite/rpl/r/rpl_old_decimal.result
new file mode 100644
index 00000000000..3e2fa3bf241
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_old_decimal.result
@@ -0,0 +1,9 @@
+include/master-slave.inc
+[connection master]
+CREATE TABLE t1dec102 (a DECIMAL(10,2));
+INSERT INTO t1dec102 VALUES(999.99);
+call mtr.add_suppression("Slave SQL.*Column 0 of table .* cannot be converted from type.* Error_code: 1677");
+include/wait_for_slave_sql_error_and_skip.inc [errno=1677]
+Last_SQL_Error = 'Column 0 of table 'test.t1dec102' cannot be converted from type 'decimal(0,?)/*old*/' to type 'decimal(10,2)''
+DROP TABLE t1dec102;
+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 7ceb5ee6622..124b7c9a029 100644
--- a/mysql-test/suite/rpl/r/rpl_parallel.result
+++ b/mysql-test/suite/rpl/r/rpl_parallel.result
@@ -4,8 +4,22 @@ SET GLOBAL slave_parallel_threads=10;
ERROR HY000: This operation cannot be performed as you have a running slave ''; run STOP SLAVE '' first
include/stop_slave.inc
SET GLOBAL slave_parallel_threads=10;
+SELECT IF(COUNT(*) < 10, "OK", CONCAT("Found too many system user processes: ", COUNT(*))) FROM information_schema.processlist WHERE user = "system user";
+IF(COUNT(*) < 10, "OK", CONCAT("Found too many system user processes: ", COUNT(*)))
+OK
CHANGE MASTER TO master_use_gtid=slave_pos;
include/start_slave.inc
+SELECT IF(COUNT(*) >= 10, "OK", CONCAT("Found too few system user processes: ", COUNT(*))) FROM information_schema.processlist WHERE user = "system user";
+IF(COUNT(*) >= 10, "OK", CONCAT("Found too few system user processes: ", COUNT(*)))
+OK
+include/stop_slave.inc
+SELECT IF(COUNT(*) < 10, "OK", CONCAT("Found too many system user processes: ", COUNT(*))) FROM information_schema.processlist WHERE user = "system user";
+IF(COUNT(*) < 10, "OK", CONCAT("Found too many system user processes: ", COUNT(*)))
+OK
+include/start_slave.inc
+SELECT IF(COUNT(*) >= 10, "OK", CONCAT("Found too few system user processes: ", COUNT(*))) FROM information_schema.processlist WHERE user = "system user";
+IF(COUNT(*) >= 10, "OK", CONCAT("Found too few system user processes: ", COUNT(*)))
+OK
*** Test long-running query in domain 1 can run in parallel with short queries in domain 0 ***
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=MyISAM;
@@ -1136,11 +1150,510 @@ SET GLOBAL debug_dbug=@old_dbug;
SET GLOBAL slave_parallel_threads=0;
SET GLOBAL slave_parallel_threads=10;
include/start_slave.inc
+*** MDEV-7335: Potential parallel slave deadlock with specific binlog corruption ***
+include/stop_slave.inc
+SET GLOBAL slave_parallel_threads=1;
+SET @old_dbug= @@GLOBAL.debug_dbug;
+SET GLOBAL debug_dbug="+d,slave_discard_xid_for_gtid_0_x_1000";
+INSERT INTO t2 VALUES (101);
+INSERT INTO t2 VALUES (102);
+INSERT INTO t2 VALUES (103);
+INSERT INTO t2 VALUES (104);
+INSERT INTO t2 VALUES (105);
+SET gtid_seq_no=1000;
+INSERT INTO t2 VALUES (106);
+INSERT INTO t2 VALUES (107);
+INSERT INTO t2 VALUES (108);
+INSERT INTO t2 VALUES (109);
+INSERT INTO t2 VALUES (110);
+INSERT INTO t2 VALUES (111);
+INSERT INTO t2 VALUES (112);
+INSERT INTO t2 VALUES (113);
+INSERT INTO t2 VALUES (114);
+INSERT INTO t2 VALUES (115);
+INSERT INTO t2 VALUES (116);
+INSERT INTO t2 VALUES (117);
+INSERT INTO t2 VALUES (118);
+INSERT INTO t2 VALUES (119);
+INSERT INTO t2 VALUES (120);
+INSERT INTO t2 VALUES (121);
+INSERT INTO t2 VALUES (122);
+INSERT INTO t2 VALUES (123);
+INSERT INTO t2 VALUES (124);
+INSERT INTO t2 VALUES (125);
+INSERT INTO t2 VALUES (126);
+INSERT INTO t2 VALUES (127);
+INSERT INTO t2 VALUES (128);
+INSERT INTO t2 VALUES (129);
+INSERT INTO t2 VALUES (130);
+include/save_master_gtid.inc
+include/start_slave.inc
+include/sync_with_master_gtid.inc
+SELECT * FROM t2 WHERE a >= 100 ORDER BY a;
+a
+101
+102
+103
+104
+105
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+include/stop_slave.inc
+SET GLOBAL debug_dbug=@old_dbug;
+SET GLOBAL slave_parallel_threads=10;
+include/start_slave.inc
+*** MDEV-7847: "Slave worker thread retried transaction 10 time(s) in vain, giving up", followed by replication hanging ***
+*** MDEV-7882: Excessive transaction retry in parallel replication ***
+CREATE TABLE t7 (a int PRIMARY KEY, b INT) ENGINE=InnoDB;
+CREATE TABLE t8 (a int PRIMARY KEY, b INT) ENGINE=InnoDB;
+include/stop_slave.inc
+SET GLOBAL slave_parallel_threads=40;
+SELECT @old_retries:=@@GLOBAL.slave_transaction_retries;
+@old_retries:=@@GLOBAL.slave_transaction_retries
+10
+SET GLOBAL slave_transaction_retries= 5;
+INSERT INTO t7 VALUES (1,1), (2,2), (3,3), (4,4), (5,5);
+SET @old_dbug= @@SESSION.debug_dbug;
+SET @commit_id= 42;
+SET SESSION debug_dbug="+d,binlog_force_commit_id";
+INSERT INTO t8 VALUES (1,1);
+INSERT INTO t8 VALUES (2,2);
+INSERT INTO t8 VALUES (3,3);
+INSERT INTO t8 VALUES (4,4);
+INSERT INTO t8 VALUES (5,5);
+INSERT INTO t8 VALUES (6,6);
+INSERT INTO t8 VALUES (7,7);
+INSERT INTO t8 VALUES (8,8);
+UPDATE t7 SET b=9 WHERE a=3;
+UPDATE t7 SET b=10 WHERE a=3;
+UPDATE t7 SET b=11 WHERE a=3;
+INSERT INTO t8 VALUES (12,12);
+INSERT INTO t8 VALUES (13,13);
+UPDATE t7 SET b=14 WHERE a=3;
+UPDATE t7 SET b=15 WHERE a=3;
+INSERT INTO t8 VALUES (16,16);
+UPDATE t7 SET b=17 WHERE a=3;
+INSERT INTO t8 VALUES (18,18);
+INSERT INTO t8 VALUES (19,19);
+UPDATE t7 SET b=20 WHERE a=3;
+INSERT INTO t8 VALUES (21,21);
+UPDATE t7 SET b=22 WHERE a=3;
+INSERT INTO t8 VALUES (23,24);
+INSERT INTO t8 VALUES (24,24);
+UPDATE t7 SET b=25 WHERE a=3;
+INSERT INTO t8 VALUES (26,26);
+UPDATE t7 SET b=27 WHERE a=3;
+BEGIN;
+INSERT INTO t8 VALUES (28,28);
+INSERT INTO t8 VALUES (29,28), (30,28);
+INSERT INTO t8 VALUES (31,28);
+INSERT INTO t8 VALUES (32,28);
+INSERT INTO t8 VALUES (33,28);
+INSERT INTO t8 VALUES (34,28);
+INSERT INTO t8 VALUES (35,28);
+INSERT INTO t8 VALUES (36,28);
+INSERT INTO t8 VALUES (37,28);
+INSERT INTO t8 VALUES (38,28);
+INSERT INTO t8 VALUES (39,28);
+INSERT INTO t8 VALUES (40,28);
+INSERT INTO t8 VALUES (41,28);
+INSERT INTO t8 VALUES (42,28);
+COMMIT;
+SET @commit_id=43;
+INSERT INTO t8 VALUES (43,43);
+INSERT INTO t8 VALUES (44,44);
+UPDATE t7 SET b=45 WHERE a=3;
+INSERT INTO t8 VALUES (46,46);
+INSERT INTO t8 VALUES (47,47);
+UPDATE t7 SET b=48 WHERE a=3;
+INSERT INTO t8 VALUES (49,49);
+INSERT INTO t8 VALUES (50,50);
+SET @commit_id=44;
+INSERT INTO t8 VALUES (51,51);
+INSERT INTO t8 VALUES (52,52);
+UPDATE t7 SET b=53 WHERE a=3;
+INSERT INTO t8 VALUES (54,54);
+INSERT INTO t8 VALUES (55,55);
+UPDATE t7 SET b=56 WHERE a=3;
+INSERT INTO t8 VALUES (57,57);
+UPDATE t7 SET b=58 WHERE a=3;
+INSERT INTO t8 VALUES (58,58);
+INSERT INTO t8 VALUES (59,59);
+INSERT INTO t8 VALUES (60,60);
+INSERT INTO t8 VALUES (61,61);
+UPDATE t7 SET b=62 WHERE a=3;
+INSERT INTO t8 VALUES (63,63);
+INSERT INTO t8 VALUES (64,64);
+INSERT INTO t8 VALUES (65,65);
+INSERT INTO t8 VALUES (66,66);
+UPDATE t7 SET b=67 WHERE a=3;
+INSERT INTO t8 VALUES (68,68);
+UPDATE t7 SET b=69 WHERE a=3;
+UPDATE t7 SET b=70 WHERE a=3;
+UPDATE t7 SET b=71 WHERE a=3;
+INSERT INTO t8 VALUES (72,72);
+UPDATE t7 SET b=73 WHERE a=3;
+UPDATE t7 SET b=74 WHERE a=3;
+UPDATE t7 SET b=75 WHERE a=3;
+UPDATE t7 SET b=76 WHERE a=3;
+INSERT INTO t8 VALUES (77,77);
+UPDATE t7 SET b=78 WHERE a=3;
+INSERT INTO t8 VALUES (79,79);
+UPDATE t7 SET b=80 WHERE a=3;
+INSERT INTO t8 VALUES (81,81);
+UPDATE t7 SET b=82 WHERE a=3;
+INSERT INTO t8 VALUES (83,83);
+UPDATE t7 SET b=84 WHERE a=3;
+SET @commit_id=45;
+INSERT INTO t8 VALUES (85,85);
+UPDATE t7 SET b=86 WHERE a=3;
+INSERT INTO t8 VALUES (87,87);
+SET @commit_id=46;
+INSERT INTO t8 VALUES (88,88);
+INSERT INTO t8 VALUES (89,89);
+INSERT INTO t8 VALUES (90,90);
+SET SESSION debug_dbug=@old_dbug;
+INSERT INTO t8 VALUES (91,91);
+INSERT INTO t8 VALUES (92,92);
+INSERT INTO t8 VALUES (93,93);
+INSERT INTO t8 VALUES (94,94);
+INSERT INTO t8 VALUES (95,95);
+INSERT INTO t8 VALUES (96,96);
+INSERT INTO t8 VALUES (97,97);
+INSERT INTO t8 VALUES (98,98);
+INSERT INTO t8 VALUES (99,99);
+SELECT * FROM t7 ORDER BY a;
+a b
+1 1
+2 2
+3 86
+4 4
+5 5
+SELECT * FROM t8 ORDER BY a;
+a b
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+7 7
+8 8
+12 12
+13 13
+16 16
+18 18
+19 19
+21 21
+23 24
+24 24
+26 26
+28 28
+29 28
+30 28
+31 28
+32 28
+33 28
+34 28
+35 28
+36 28
+37 28
+38 28
+39 28
+40 28
+41 28
+42 28
+43 43
+44 44
+46 46
+47 47
+49 49
+50 50
+51 51
+52 52
+54 54
+55 55
+57 57
+58 58
+59 59
+60 60
+61 61
+63 63
+64 64
+65 65
+66 66
+68 68
+72 72
+77 77
+79 79
+81 81
+83 83
+85 85
+87 87
+88 88
+89 89
+90 90
+91 91
+92 92
+93 93
+94 94
+95 95
+96 96
+97 97
+98 98
+99 99
+include/save_master_gtid.inc
+include/start_slave.inc
+include/sync_with_master_gtid.inc
+SELECT * FROM t7 ORDER BY a;
+a b
+1 1
+2 2
+3 86
+4 4
+5 5
+SELECT * FROM t8 ORDER BY a;
+a b
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+7 7
+8 8
+12 12
+13 13
+16 16
+18 18
+19 19
+21 21
+23 24
+24 24
+26 26
+28 28
+29 28
+30 28
+31 28
+32 28
+33 28
+34 28
+35 28
+36 28
+37 28
+38 28
+39 28
+40 28
+41 28
+42 28
+43 43
+44 44
+46 46
+47 47
+49 49
+50 50
+51 51
+52 52
+54 54
+55 55
+57 57
+58 58
+59 59
+60 60
+61 61
+63 63
+64 64
+65 65
+66 66
+68 68
+72 72
+77 77
+79 79
+81 81
+83 83
+85 85
+87 87
+88 88
+89 89
+90 90
+91 91
+92 92
+93 93
+94 94
+95 95
+96 96
+97 97
+98 98
+99 99
+include/stop_slave.inc
+SET GLOBAL slave_transaction_retries= @old_retries;
+SET GLOBAL slave_parallel_threads=10;
+include/start_slave.inc
+*** MDEV-7888: ANALYZE TABLE does wakeup_subsequent_commits(), causing wrong binlog order and parallel replication hang ***
+include/stop_slave.inc
+SET @old_dbug= @@GLOBAL.debug_dbug;
+SET GLOBAL debug_dbug= '+d,inject_analyze_table_sleep';
+SET @old_dbug= @@SESSION.debug_dbug;
+SET SESSION debug_dbug="+d,binlog_force_commit_id";
+SET @commit_id= 10000;
+ANALYZE TABLE t2;
+Table Op Msg_type Msg_text
+test.t2 analyze status OK
+INSERT INTO t3 VALUES (120, 0);
+SET @commit_id= 10001;
+INSERT INTO t3 VALUES (121, 0);
+SET SESSION debug_dbug=@old_dbug;
+SELECT * FROM t3 WHERE a >= 120 ORDER BY a;
+a b
+120 0
+121 0
+include/save_master_gtid.inc
+include/start_slave.inc
+include/sync_with_master_gtid.inc
+SELECT * FROM t3 WHERE a >= 120 ORDER BY a;
+a b
+120 0
+121 0
+include/stop_slave.inc
+SET GLOBAL debug_dbug= @old_dbug;
+include/start_slave.inc
+*** MDEV-7929: record_gtid() for non-transactional event group calls wakeup_subsequent_commits() too early, causing slave hang. ***
+include/stop_slave.inc
+SET @old_dbug= @@GLOBAL.debug_dbug;
+SET GLOBAL debug_dbug= '+d,inject_record_gtid_serverid_100_sleep';
+SET @old_dbug= @@SESSION.debug_dbug;
+SET SESSION debug_dbug="+d,binlog_force_commit_id";
+SET @old_server_id= @@SESSION.server_id;
+SET SESSION server_id= 100;
+SET @commit_id= 10010;
+ALTER TABLE t1 COMMENT "Hulubulu!";
+SET SESSION server_id= @old_server_id;
+INSERT INTO t3 VALUES (130, 0);
+SET @commit_id= 10011;
+INSERT INTO t3 VALUES (131, 0);
+SET SESSION debug_dbug=@old_dbug;
+SELECT * FROM t3 WHERE a >= 130 ORDER BY a;
+a b
+130 0
+131 0
+include/save_master_gtid.inc
+include/start_slave.inc
+include/sync_with_master_gtid.inc
+SELECT * FROM t3 WHERE a >= 130 ORDER BY a;
+a b
+130 0
+131 0
+include/stop_slave.inc
+SET GLOBAL debug_dbug= @old_dbug;
+include/start_slave.inc
+*** MDEV-8031: Parallel replication stops on "connection killed" error (probably incorrectly handled deadlock kill) ***
+INSERT INTO t3 VALUES (201,0), (202,0);
+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_mdev8031';
+SET @old_dbug= @@SESSION.debug_dbug;
+SET SESSION debug_dbug="+d,binlog_force_commit_id";
+SET @commit_id= 10200;
+INSERT INTO t3 VALUES (203, 1);
+INSERT INTO t3 VALUES (204, 1);
+INSERT INTO t3 VALUES (205, 1);
+UPDATE t3 SET b=b+1 WHERE a=201;
+UPDATE t3 SET b=b+1 WHERE a=201;
+UPDATE t3 SET b=b+1 WHERE a=201;
+UPDATE t3 SET b=b+1 WHERE a=202;
+UPDATE t3 SET b=b+1 WHERE a=202;
+UPDATE t3 SET b=b+1 WHERE a=202;
+UPDATE t3 SET b=b+1 WHERE a=202;
+UPDATE t3 SET b=b+1 WHERE a=203;
+UPDATE t3 SET b=b+1 WHERE a=203;
+UPDATE t3 SET b=b+1 WHERE a=204;
+UPDATE t3 SET b=b+1 WHERE a=204;
+UPDATE t3 SET b=b+1 WHERE a=204;
+UPDATE t3 SET b=b+1 WHERE a=203;
+UPDATE t3 SET b=b+1 WHERE a=205;
+UPDATE t3 SET b=b+1 WHERE a=205;
+SET SESSION debug_dbug=@old_dbug;
+SELECT * FROM t3 WHERE a>=200 ORDER BY a;
+a b
+201 3
+202 4
+203 4
+204 4
+205 3
+include/save_master_gtid.inc
+include/start_slave.inc
+include/sync_with_master_gtid.inc
+SELECT * FROM t3 WHERE a>=200 ORDER BY a;
+a b
+201 3
+202 4
+203 4
+204 4
+205 3
+include/stop_slave.inc
+SET GLOBAL debug_dbug= @old_dbug;
+include/start_slave.inc
+*** Check getting deadlock killed inside open_binlog() during retry. ***
+include/stop_slave.inc
+SET @old_dbug= @@GLOBAL.debug_dbug;
+SET GLOBAL debug_dbug= '+d,inject_retry_event_group_open_binlog_kill';
+SET @old_max= @@GLOBAL.max_relay_log_size;
+SET GLOBAL max_relay_log_size= 4096;
+SET @old_dbug= @@SESSION.debug_dbug;
+SET SESSION debug_dbug="+d,binlog_force_commit_id";
+SET @commit_id= 10210;
+Omit long queries that cause relaylog rotations and transaction retries...
+SET SESSION debug_dbug=@old_dbug;
+SELECT * FROM t3 WHERE a>=200 ORDER BY a;
+a b
+201 6
+202 8
+203 7
+204 7
+205 5
+include/save_master_gtid.inc
+include/start_slave.inc
+include/sync_with_master_gtid.inc
+SELECT * FROM t3 WHERE a>=200 ORDER BY a;
+a b
+201 6
+202 8
+203 7
+204 7
+205 5
+include/stop_slave.inc
+SET GLOBAL debug_dbug= @old_debg;
+SET GLOBAL max_relay_log_size= @old_max;
+include/start_slave.inc
include/stop_slave.inc
SET GLOBAL slave_parallel_threads=@old_parallel_threads;
include/start_slave.inc
SET DEBUG_SYNC= 'RESET';
DROP function foo;
-DROP TABLE t1,t2,t3,t4,t5,t6;
+DROP TABLE t1,t2,t3,t4,t5,t6,t7,t8;
SET DEBUG_SYNC= 'RESET';
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_parallel2.result b/mysql-test/suite/rpl/r/rpl_parallel2.result
index 8bf8b9caf3b..de90bcd158f 100644
--- a/mysql-test/suite/rpl/r/rpl_parallel2.result
+++ b/mysql-test/suite/rpl/r/rpl_parallel2.result
@@ -12,6 +12,23 @@ Note 1592 Unsafe statement written to the binary log using statement format sinc
include/wait_for_slave_param.inc [Seconds_Behind_Master]
Seconds_Behind_Master should be zero here because the slave is fully caught up and idle.
Seconds_Behind_Master = '0'
+*** MDEV-8294: Inconsistent behavior of slave parallel threads at runtime ***
+INSERT INTO t1 VALUES (10,0);
+SET sql_log_bin= 0;
+DELETE FROM t1 WHERE a=10;
+SET sql_log_bin= 1;
+INSERT INTO t1 VALUES (10,0);
+SELECT * FROM t1 WHERE a >= 10 ORDER BY a;
+a b
+10 0
+include/wait_for_slave_sql_error.inc [errno=1062]
+SET GLOBAL slave_parallel_threads=8;
+STOP SLAVE;
+SET GLOBAL sql_slave_skip_counter= 1;
+include/start_slave.inc
+SELECT * FROM t1 WHERE a >= 10 ORDER BY a;
+a b
+10 0
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_mdev6589.result b/mysql-test/suite/rpl/r/rpl_parallel_mdev6589.result
new file mode 100644
index 00000000000..d681fd7546d
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_parallel_mdev6589.result
@@ -0,0 +1,147 @@
+include/master-slave.inc
+[connection master]
+SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
+include/stop_slave.inc
+SET GLOBAL slave_parallel_threads=10;
+CHANGE MASTER TO master_use_gtid=current_pos;
+include/start_slave.inc
+*** MDEV-6589: Incorrect relay log start position when restarting SQL thread after error in parallel replication ***
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
+CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=MyISAM;
+CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+SELECT * FROM t1;
+a
+1
+SELECT * FROM t2;
+a
+1
+SET sql_log_bin=0;
+BEGIN;
+INSERT INTO t2 VALUES (5);
+SET gtid_domain_id=0;
+INSERT INTO t1 VALUES (2);
+INSERT INTO t2 VALUES (3);
+FLUSH LOGS;
+INSERT INTO t1 VALUES (4);
+SET gtid_domain_id=1;
+INSERT INTO t2 VALUES (5);
+SET gtid_domain_id=0;
+INSERT INTO t1 VALUES (6);
+INSERT INTO t1 VALUES (7);
+SET gtid_domain_id=2;
+INSERT INTO t2 VALUES (8);
+INSERT INTO t1 VALUES (9);
+FLUSH LOGS;
+SET gtid_domain_id=3;
+INSERT INTO t2 VALUES (10);
+INSERT INTO t1 VALUES (11);
+SET gtid_domain_id=1;
+INSERT INTO t1 VALUES (12);
+INSERT INTO t2 VALUES (13);
+SET gtid_domain_id=0;
+INSERT INTO t2 VALUES (14);
+FLUSH LOGS;
+SET gtid_domain_id=3;
+INSERT INTO t2 VALUES (15);
+SET gtid_domain_id=2;
+INSERT INTO t2 VALUES (16);
+SET gtid_domain_id=0;
+INSERT INTO t1 VALUES (17);
+SET @gtid0 = @@last_gtid;
+SET gtid_domain_id=2;
+INSERT INTO t1 VALUES (18);
+SET @gtid2 = @@last_gtid;
+SET gtid_domain_id=3;
+INSERT INTO t1 VALUES (19);
+SET @gtid3 = @@last_gtid;
+SELECT * FROM t1 ORDER BY a;
+a
+1
+2
+4
+6
+7
+9
+11
+12
+17
+18
+19
+SELECT * FROM t2 ORDER BY a;
+a
+1
+3
+5
+8
+10
+13
+14
+15
+16
+include/save_master_gtid.inc
+SELECT MASTER_GTID_WAIT('WAIT_POS');
+MASTER_GTID_WAIT('WAIT_POS')
+0
+COMMIT;
+SET sql_log_bin=1;
+include/wait_for_slave_sql_error.inc [errno=1062]
+SELECT * FROM t1 ORDER BY a;
+a
+1
+2
+4
+6
+7
+9
+11
+17
+18
+19
+SELECT * FROM t2 ORDER BY a;
+a
+1
+3
+5
+8
+10
+14
+15
+16
+SET sql_log_bin=0;
+DELETE FROM t2 WHERE a=5;
+SET sql_log_bin=1;
+include/start_slave.inc
+include/sync_with_master_gtid.inc
+SELECT * FROM t1 ORDER BY a;
+a
+1
+2
+4
+6
+7
+9
+11
+12
+17
+18
+19
+SELECT * FROM t2 ORDER BY a;
+a
+1
+3
+5
+8
+10
+13
+14
+15
+16
+include/stop_slave.inc
+SET GLOBAL slave_parallel_threads=@old_parallel_threads;
+include/start_slave.inc
+SET DEBUG_SYNC= 'RESET';
+DROP TABLE t1,t2;
+SET DEBUG_SYNC= 'RESET';
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_parallel_multilevel2.result b/mysql-test/suite/rpl/r/rpl_parallel_multilevel2.result
new file mode 100644
index 00000000000..47bf2ff887f
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_parallel_multilevel2.result
@@ -0,0 +1,52 @@
+include/rpl_init.inc [topology=1->2->3]
+*** MDEV-7668: Intermediate master groups CREATE with INSERT, causing parallel replication failure ***
+SET @old_updates= @@GLOBAL.binlog_direct_non_transactional_updates;
+SET GLOBAL binlog_direct_non_transactional_updates=OFF;
+SET SESSION binlog_direct_non_transactional_updates=OFF;
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
+CREATE TABLE t1 (a int PRIMARY KEY, b INT) ENGINE=InnoDB;
+include/stop_slave.inc
+SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
+SET GLOBAL slave_parallel_threads=10;
+SET @old_commit_count=@@GLOBAL.binlog_commit_wait_count;
+SET GLOBAL binlog_commit_wait_count=2;
+SET @old_commit_usec=@@GLOBAL.binlog_commit_wait_usec;
+SET GLOBAL binlog_commit_wait_usec=2000000;
+SET @old_updates= @@GLOBAL.binlog_direct_non_transactional_updates;
+SET GLOBAL binlog_direct_non_transactional_updates=OFF;
+SET SESSION binlog_direct_non_transactional_updates=OFF;
+CHANGE MASTER TO master_use_gtid=current_pos;
+SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
+include/stop_slave.inc
+SET GLOBAL slave_parallel_threads=10;
+CHANGE MASTER TO master_use_gtid=current_pos;
+BEGIN;
+CREATE TEMPORARY TABLE t2 (a INT PRIMARY KEY) ENGINE=MEMORY;
+COMMIT;
+INSERT INTO t2 VALUES (1);
+INSERT INTO t1 SELECT a, a*10 FROM t2;
+DROP TABLE t2;
+include/save_master_gtid.inc
+include/start_slave.inc
+include/sync_with_master_gtid.inc
+SELECT * FROM t1 ORDER BY a;
+a b
+1 10
+include/start_slave.inc
+include/sync_with_master_gtid.inc
+SELECT * FROM t1 ORDER BY a;
+a b
+1 10
+include/stop_slave.inc
+SET GLOBAL slave_parallel_threads=@old_parallel_threads;
+SET GLOBAL binlog_commit_wait_count=@old_commit_count;
+SET GLOBAL binlog_commit_wait_usec=@old_commit_usec;
+SET GLOBAL binlog_direct_non_transactional_updates= @old_updates;
+include/start_slave.inc
+include/stop_slave.inc
+SET GLOBAL slave_parallel_threads=@old_parallel_threads;
+include/start_slave.inc
+SET GLOBAL binlog_direct_non_transactional_updates= @old_updates;
+CALL mtr.add_suppression("Statement accesses nontransactional table as well as transactional or temporary table");
+DROP TABLE t1;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_parallel_partition.result b/mysql-test/suite/rpl/r/rpl_parallel_partition.result
new file mode 100644
index 00000000000..e0cfe9882d2
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_parallel_partition.result
@@ -0,0 +1,42 @@
+include/master-slave.inc
+[connection master]
+SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
+include/stop_slave.inc
+SET @old_dbug= @@GLOBAL.debug_dbug;
+SET GLOBAL debug_dbug="+d,inject_wakeup_subsequent_commits_sleep";
+SET GLOBAL slave_parallel_threads=8;
+*** MDEV-8147: Assertion `m_lock_type == 2' failed in handler::ha_close() during parallel replication ***
+CREATE TABLE E (
+pk INTEGER AUTO_INCREMENT,
+col_int_nokey INTEGER /*! NULL */,
+col_int_key INTEGER /*! NULL */,
+col_date_key DATE /*! NULL */,
+col_date_nokey DATE /*! NULL */,
+col_time_key TIME /*! NULL */,
+col_time_nokey TIME /*! NULL */,
+col_datetime_key DATETIME /*! NULL */,
+col_datetime_nokey DATETIME /*! NULL */,
+col_varchar_key VARCHAR(1) /*! NULL */,
+col_varchar_nokey VARCHAR(1) /*! NULL */,
+PRIMARY KEY (pk),
+KEY (col_int_key),
+KEY (col_date_key),
+KEY (col_time_key),
+KEY (col_datetime_key),
+KEY (col_varchar_key, col_int_key)
+) ENGINE=InnoDB;
+ALTER TABLE `E` PARTITION BY KEY() PARTITIONS 5;
+ALTER TABLE `E` REMOVE PARTITIONING;
+CREATE TABLE t1 (a INT PRIMARY KEY);
+include/start_slave.inc
+include/stop_slave.inc
+SET GLOBAL debug_dbug=@old_dbug;
+SET GLOBAL slave_parallel_threads=0;
+SET GLOBAL slave_parallel_threads=8;
+include/start_slave.inc
+include/stop_slave.inc
+SET GLOBAL slave_parallel_threads=@old_parallel_threads;
+include/start_slave.inc
+DROP TABLE `E`;
+DROP TABLE t1;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_parallel_temptable.result b/mysql-test/suite/rpl/r/rpl_parallel_temptable.result
index 61eba2cab2f..da2cf42f870 100644
--- a/mysql-test/suite/rpl/r/rpl_parallel_temptable.result
+++ b/mysql-test/suite/rpl/r/rpl_parallel_temptable.result
@@ -116,6 +116,26 @@ SHOW STATUS LIKE 'Slave_open_temp_tables';
Variable_name Value
Slave_open_temp_tables 0
FLUSH LOGS;
+*** MDEV-7936: Assertion `!table || table->in_use == _current_thd()' failed on parallel replication in optimistic mode ***
+CREATE TEMPORARY TABLE t4 (a INT PRIMARY KEY) ENGINE=InnoDB;
+SET @old_dbug= @@SESSION.debug_dbug;
+SET SESSION debug_dbug="+d,binlog_force_commit_id";
+SET @commit_id= 10000;
+INSERT INTO t4 VALUES (30);
+INSERT INTO t4 VALUES (31);
+SET SESSION debug_dbug= @old_dbug;
+INSERT INTO t1 SELECT a, "conservative" FROM t4;
+DROP TEMPORARY TABLE t4;
+SELECT * FROM t1 WHERE a >= 30 ORDER BY a;
+a b
+30 conservative
+31 conservative
+include/save_master_gtid.inc
+include/sync_with_master_gtid.inc
+SELECT * FROM t1 WHERE a >= 30 ORDER BY a;
+a b
+30 conservative
+31 conservative
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_row_annotate_do.result b/mysql-test/suite/rpl/r/rpl_row_annotate_do.result
index 7d9f7de8fa9..9aeef98d091 100644
--- a/mysql-test/suite/rpl/r/rpl_row_annotate_do.result
+++ b/mysql-test/suite/rpl/r/rpl_row_annotate_do.result
@@ -52,6 +52,20 @@ a b
# - DELETE xt1, t2 FROM <...>
# - INSERT INTO t5(b) VALUES <...> (3 instances)
########################################################################
+# Ensure that a replication failure doesn't segfault - MDEV-7864
+########################################################################
+DELETE FROM t3 WHERE a=2;
+INSERT INTO t5 (a) SELECT a.a*10000+b.a*1000+c.a*100+d.a*10 FROM t5 a, t5 b, t5 c, t5 d;
+INSERT INTO t3 (a) SELECT a FROM t5 WHERE a > 10;
+DELETE t3 FROM t3 INNER JOIN t5 ON t3.a=t5.a;
+---- Wait until slave stops with an error ----
+include/wait_for_slave_sql_error.inc [errno=1032]
+Last_SQL_Error (expected "Delete_rows_v1 event on table test1.t3; Can't find record in 't3'" error)
+Could not execute Delete_rows_v1 event on table test1.t3; Can't find record in 't3', Error_code: 1032; handler error HA_ERR_END_OF_FILE; the event's master log master-bin.000002, end_log_pos END_LOG_POS
+call mtr.add_suppression("Slave: Can't find record in 't3' Error_code: 1032");
+SET GLOBAL sql_slave_skip_counter=1;
+START SLAVE;
+########################################################################
FLUSH LOGS;
show binlog events in 'slave-bin.000001' from <start_pos>;
Log_name Pos Event_type Server_id End_log_pos Info
@@ -131,6 +145,30 @@ slave-bin.000001 # Annotate_rows 1 # INSERT INTO t5(b) VALUES ('gås')
slave-bin.000001 # Table_map 1 # table_id: # (test1.t5)
slave-bin.000001 # Write_rows_v1 1 # table_id: # flags: STMT_END_F
slave-bin.000001 # Query 1 # COMMIT
+slave-bin.000001 # Gtid 2 # BEGIN GTID 0-2-25
+slave-bin.000001 # Table_map 2 # table_id: # (test1.t3)
+slave-bin.000001 # Delete_rows_v1 2 # table_id: # flags: STMT_END_F
+slave-bin.000001 # Query 2 # COMMIT
+slave-bin.000001 # Gtid 1 # BEGIN GTID 0-1-25
+slave-bin.000001 # Annotate_rows 1 # INSERT INTO t5 (a) SELECT a.a*10000+b.a*1000+c.a*100+d.a*10 FROM t5 a, t5 b, t5 c, t5 d
+slave-bin.000001 # Table_map 1 # table_id: # (test1.t5)
+slave-bin.000001 # Write_rows_v1 1 # table_id: #
+slave-bin.000001 # Write_rows_v1 1 # table_id: #
+slave-bin.000001 # Write_rows_v1 1 # table_id: #
+slave-bin.000001 # Write_rows_v1 1 # table_id: # flags: STMT_END_F
+slave-bin.000001 # Query 1 # COMMIT
+slave-bin.000001 # Gtid 1 # BEGIN GTID 0-1-26
+slave-bin.000001 # Annotate_rows 1 # INSERT INTO t3 (a) SELECT a FROM t5 WHERE a > 10
+slave-bin.000001 # Table_map 1 # table_id: # (test1.t3)
+slave-bin.000001 # Write_rows_v1 1 # table_id: #
+slave-bin.000001 # Write_rows_v1 1 # table_id: #
+slave-bin.000001 # Write_rows_v1 1 # table_id: #
+slave-bin.000001 # Write_rows_v1 1 # table_id: # flags: STMT_END_F
+slave-bin.000001 # Query 1 # COMMIT
+slave-bin.000001 # Gtid 2 # BEGIN GTID 0-2-27
+slave-bin.000001 # Table_map 2 # table_id: # (mtr.test_suppressions)
+slave-bin.000001 # Write_rows_v1 2 # table_id: # flags: STMT_END_F
+slave-bin.000001 # Query 2 # COMMIT
slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4
#
########################################################################
diff --git a/mysql-test/suite/rpl/r/rpl_row_annotate_dont.result b/mysql-test/suite/rpl/r/rpl_row_annotate_dont.result
index 36d906f54be..ceaf8c878c8 100644
--- a/mysql-test/suite/rpl/r/rpl_row_annotate_dont.result
+++ b/mysql-test/suite/rpl/r/rpl_row_annotate_dont.result
@@ -44,6 +44,20 @@ a b
# EVENTS ON SLAVE
# No Annotate_rows events should appear below
########################################################################
+# Ensure that a replication failure doesn't segfault - MDEV-7864
+########################################################################
+DELETE FROM t3 WHERE a=2;
+INSERT INTO t5 (a) SELECT a.a*10000+b.a*1000+c.a*100+d.a*10 FROM t5 a, t5 b, t5 c, t5 d;
+INSERT INTO t3 (a) SELECT a FROM t5 WHERE a > 10;
+DELETE t3 FROM t3 INNER JOIN t5 ON t3.a=t5.a;
+---- Wait until slave stops with an error ----
+include/wait_for_slave_sql_error.inc [errno=1032]
+Last_SQL_Error (expected "Delete_rows_v1 event on table test1.t3; Can't find record in 't3'" error)
+Could not execute Delete_rows_v1 event on table test1.t3; Can't find record in 't3', Error_code: 1032; handler error HA_ERR_END_OF_FILE; the event's master log master-bin.000002, end_log_pos END_LOG_POS
+call mtr.add_suppression("Slave: Can't find record in 't3' Error_code: 1032");
+SET GLOBAL sql_slave_skip_counter=1;
+START SLAVE;
+########################################################################
FLUSH LOGS;
show binlog events in 'slave-bin.000001' from <start_pos>;
Log_name Pos Event_type Server_id End_log_pos Info
@@ -113,6 +127,28 @@ slave-bin.000001 # Gtid 1 # BEGIN GTID 0-1-24
slave-bin.000001 # Table_map 1 # table_id: # (test1.t5)
slave-bin.000001 # Write_rows_v1 1 # table_id: # flags: STMT_END_F
slave-bin.000001 # Query 1 # COMMIT
+slave-bin.000001 # Gtid 2 # BEGIN GTID 0-2-25
+slave-bin.000001 # Table_map 2 # table_id: # (test1.t3)
+slave-bin.000001 # Delete_rows_v1 2 # table_id: # flags: STMT_END_F
+slave-bin.000001 # Query 2 # COMMIT
+slave-bin.000001 # Gtid 1 # BEGIN GTID 0-1-25
+slave-bin.000001 # Table_map 1 # table_id: # (test1.t5)
+slave-bin.000001 # Write_rows_v1 1 # table_id: #
+slave-bin.000001 # Write_rows_v1 1 # table_id: #
+slave-bin.000001 # Write_rows_v1 1 # table_id: #
+slave-bin.000001 # Write_rows_v1 1 # table_id: # flags: STMT_END_F
+slave-bin.000001 # Query 1 # COMMIT
+slave-bin.000001 # Gtid 1 # BEGIN GTID 0-1-26
+slave-bin.000001 # Table_map 1 # table_id: # (test1.t3)
+slave-bin.000001 # Write_rows_v1 1 # table_id: #
+slave-bin.000001 # Write_rows_v1 1 # table_id: #
+slave-bin.000001 # Write_rows_v1 1 # table_id: #
+slave-bin.000001 # Write_rows_v1 1 # table_id: # flags: STMT_END_F
+slave-bin.000001 # Query 1 # COMMIT
+slave-bin.000001 # Gtid 2 # BEGIN GTID 0-2-27
+slave-bin.000001 # Table_map 2 # table_id: # (mtr.test_suppressions)
+slave-bin.000001 # Write_rows_v1 2 # table_id: # flags: STMT_END_F
+slave-bin.000001 # Query 2 # COMMIT
slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4
#
########################################################################
diff --git a/mysql-test/suite/rpl/r/rpl_special_charset.result b/mysql-test/suite/rpl/r/rpl_special_charset.result
new file mode 100644
index 00000000000..99b8d3a21d1
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_special_charset.result
@@ -0,0 +1,8 @@
+include/master-slave.inc
+[connection master]
+call mtr.add_suppression("Cannot use utf16 as character_set_client");
+CREATE TABLE t1(i VARCHAR(20));
+INSERT INTO t1 VALUES (0xFFFF);
+include/diff_tables.inc [master:t1, slave:t1]
+DROP TABLE t1;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_temp_table.result b/mysql-test/suite/rpl/r/rpl_temp_table.result
index 504b0471748..08504ce175d 100644
--- a/mysql-test/suite/rpl/r/rpl_temp_table.result
+++ b/mysql-test/suite/rpl/r/rpl_temp_table.result
@@ -39,7 +39,12 @@ sum(n)
show status like 'Slave_open_temp_tables';
Variable_name Value
Slave_open_temp_tables 0
+*** MDEV-8016: Replication aborts on DROP /*!40005 TEMPORARY */ TABLE IF EXISTS ***
+INSERT INTO t2 VALUES (2000), (2001);
+CREATE FUNCTION f() RETURNS INTEGER RETURN 1;
+CREATE TEMPORARY TABLE t3 AS SELECT f() AS col FROM t2;
drop table if exists t1,t2;
Warnings:
Note 1051 Unknown table 'test.t1'
+drop function f;
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL.result b/mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL.result
index 550b3f596e5..0264c9421fc 100644
--- a/mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL.result
+++ b/mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL.result
@@ -182,6 +182,11 @@ DROP USER test_3@localhost;
ERROR HY000: Table 'user' was not locked with LOCK TABLES
INSERT INTO t2 VALUES ("DROP USER test_3@localhost with table locked");
UNLOCK TABLE;
+CREATE DATABASE db;
+CREATE TABLE db.t1 LIKE t2;
+CREATE TABLE t3 LIKE t2;
+DROP TABLE t3;
+DROP DATABASE db;
DROP USER test_3@localhost;
DROP FUNCTION f2;
DROP PROCEDURE p2;
diff --git a/mysql-test/suite/rpl/r/rpl_trigger.result b/mysql-test/suite/rpl/r/rpl_trigger.result
index ac6d9155f4b..c0e35274594 100644
--- a/mysql-test/suite/rpl/r/rpl_trigger.result
+++ b/mysql-test/suite/rpl/r/rpl_trigger.result
@@ -986,4 +986,15 @@ Warning 1196 Some non-transactional changed tables couldn't be rolled back
include/diff_tables.inc [master:t1, slave:t1]
include/diff_tables.inc [master:log, slave:log]
drop table t1, log;
+drop trigger if exists notexistent;
+Warnings:
+Note 1360 Trigger does not exist
+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`; drop trigger if exists notexistent
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000001 # Gtid # # GTID #-#-#
+slave-bin.000001 # Query # # use `test`; drop trigger if exists notexistent
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/sec_behind_master-5114.result b/mysql-test/suite/rpl/r/sec_behind_master-5114.result
new file mode 100644
index 00000000000..5554b17347d
--- /dev/null
+++ b/mysql-test/suite/rpl/r/sec_behind_master-5114.result
@@ -0,0 +1,10 @@
+include/master-slave.inc
+[connection master]
+call mtr.add_suppression("Unsafe statement written to the binary log");
+CREATE TABLE t1 (a int);
+INSERT INTO t1 VALUES(SLEEP(2));
+Seconds_Behind_Master: 1
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
+drop table t1;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/semisync_future-7591.result b/mysql-test/suite/rpl/r/semisync_future-7591.result
new file mode 100644
index 00000000000..732ae09daaf
--- /dev/null
+++ b/mysql-test/suite/rpl/r/semisync_future-7591.result
@@ -0,0 +1,19 @@
+include/master-slave.inc
+[connection master]
+call mtr.add_suppression("Timeout waiting for reply of binlog*");
+create table t1 (i int);
+set global rpl_semi_sync_master_enabled = ON;
+include/stop_slave.inc
+set global rpl_semi_sync_slave_enabled = ON;
+change master to master_log_file='master-bin.000002', master_log_pos = 320;
+start slave;
+include/wait_for_slave_io_error.inc [errno=1236]
+insert into t1 values (1);
+reset master;
+include/stop_slave.inc
+reset slave;
+include/start_slave.inc
+set global rpl_semi_sync_slave_enabled = OFF;
+drop table t1;
+set global rpl_semi_sync_master_enabled = OFF;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/show_status_stop_slave_race-7126.result b/mysql-test/suite/rpl/r/show_status_stop_slave_race-7126.result
new file mode 100644
index 00000000000..c2a0498509b
--- /dev/null
+++ b/mysql-test/suite/rpl/r/show_status_stop_slave_race-7126.result
@@ -0,0 +1,4 @@
+include/master-slave.inc
+[connection master]
+start slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_000011.test b/mysql-test/suite/rpl/t/rpl_000011.test
index faad2242235..216e568fc42 100644
--- a/mysql-test/suite/rpl/t/rpl_000011.test
+++ b/mysql-test/suite/rpl/t/rpl_000011.test
@@ -11,6 +11,12 @@ insert into t1 values(1);
sync_slave_with_master;
show global status like 'com_insert';
stop slave;
+# Temporary work-around for bug MDEV-8301. There is a small window during
+# thread exit where the local status values of a thread are counted twice
+# in the global status. Remove this wait_condition.inc once MDEV-8301 is
+# fixed.
+--let $wait_condition= SELECT variable_value=1 FROM information_schema.global_status WHERE variable_name="Com_insert";
+--source include/wait_condition.inc
show global status like 'com_insert';
--source include/wait_for_slave_to_stop.inc
start slave;
diff --git a/mysql-test/suite/rpl/t/rpl_drop_db_fail.test b/mysql-test/suite/rpl/t/rpl_drop_db_fail.test
new file mode 100644
index 00000000000..f4482064d7b
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_drop_db_fail.test
@@ -0,0 +1,34 @@
+###############################################################################
+# Bug#20041860: SLAVE ERROR WHEN DROP DATABASE
+#
+# Test:
+# =====
+# Create two databases such that one database has a dependency over the other
+# database and try to drop the database which has a dependency. This should
+# not cause slave to break.
+###############################################################################
+--source include/have_innodb.inc
+--source include/master-slave.inc
+
+connection master;
+CREATE DATABASE IF NOT EXISTS db1;
+CREATE DATABASE IF NOT EXISTS db2;
+
+use db1;
+CREATE TABLE a(id INT);
+CREATE VIEW v AS SELECT * FROM a;
+CREATE TABLE table_father(id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(20)) ENGINE=INNODB;
+--sync_slave_with_master
+
+connection master;
+use db2;
+CREATE TABLE table_child(id INT PRIMARY KEY, info VARCHAR(20), father_id INT) ENGINE=INNODB;
+ALTER TABLE table_child ADD CONSTRAINT aaa FOREIGN KEY (father_id) REFERENCES db1.table_father(id);
+
+--error ER_ROW_IS_REFERENCED
+DROP DATABASE db1;
+DROP DATABASE db2;
+--sync_slave_with_master
+--connection master
+DROP DATABASE db1;
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_gtid_basic.test b/mysql-test/suite/rpl/t/rpl_gtid_basic.test
index 19f90fce197..4c4a9063a0b 100644
--- a/mysql-test/suite/rpl/t/rpl_gtid_basic.test
+++ b/mysql-test/suite/rpl/t/rpl_gtid_basic.test
@@ -367,7 +367,7 @@ reap;
reap;
---echo *** Test sql_gtid_slave_pos when used with GTID ***
+--echo *** Test gtid_slave_pos when used with GTID ***
--connection server_2
--source include/stop_slave.inc
@@ -481,6 +481,55 @@ SELECT IF(LOCATE("2-1-1040", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! ex
SET GLOBAL slave_ddl_exec_mode= @saved_mode;
+
+--echo *** Test GTID-connecting to a master with out-of-order sequence numbers in the binlog. ***
+
+# Create an out-of-order binlog on server 2.
+# Let server 3 replicate to an out-of-order point, stop it, restart it,
+# and check that it replicates correctly despite the out-of-order.
+
+--connection server_1
+SET gtid_domain_id= @@GLOBAL.gtid_domain_id;
+INSERT INTO t1 VALUES (31);
+--save_master_pos
+
+--connection server_2
+--sync_with_master
+SET gtid_domain_id= @@GLOBAL.gtid_domain_id;
+INSERT INTO t1 VALUES (32);
+
+--connection server_1
+INSERT INTO t1 VALUES (33);
+--save_master_pos
+
+--connection server_2
+--sync_with_master
+--save_master_pos
+
+--connection server_3
+--sync_with_master
+--source include/stop_slave.inc
+
+--connection server_1
+INSERT INTO t1 VALUES (34);
+--save_master_pos
+
+--connection server_2
+--sync_with_master
+--save_master_pos
+
+--connection server_3
+--source include/start_slave.inc
+--sync_with_master
+SELECT * FROM t1 WHERE a >= 30 ORDER BY a;
+--save_master_pos
+
+--connection server_4
+--sync_with_master
+SELECT * FROM t1 WHERE a >= 30 ORDER BY a;
+
+
+# Clean up.
--connection server_1
DROP TABLE t1;
diff --git a/mysql-test/suite/rpl/t/rpl_gtid_crash.test b/mysql-test/suite/rpl/t/rpl_gtid_crash.test
index 90b4e454a74..df3ba9a3420 100644
--- a/mysql-test/suite/rpl/t/rpl_gtid_crash.test
+++ b/mysql-test/suite/rpl/t/rpl_gtid_crash.test
@@ -587,6 +587,77 @@ eval SELECT IF(INSTR(@@gtid_current_pos, '$saved_gtid'), "Current pos ok", CONCA
SELECT * from t1 WHERE a > 10 ORDER BY a;
+--echo *** MDEV-6391: GTID binlog state not recovered if mariadb-bin.state is removed ***
+
+--connection server_2
+--source include/stop_slave.inc
+
+# Do some misc. transactions, stop the master, drop the master-bin.state file.
+# Start the master back up, check that binlog state is correct.
+
+--connection server_1
+
+INSERT INTO t1 VALUES (30);
+SET @old_server_id= @@server_id;
+SET @old_domain_id= @@gtid_domain_id;
+
+SET SESSION server_id= 10;
+INSERT INTO t1 VALUES (31);
+INSERT INTO t1 VALUES (32);
+SET SESSION gtid_domain_id= 1;
+SET SESSION server_id=11;
+INSERT INTO t1 VALUES (33);
+SET SESSION gtid_domain_id= 2;
+INSERT INTO t1 VALUES (34);
+SET SESSION server_id= 10;
+INSERT INTO t1 VALUES (35);
+INSERT INTO t1 VALUES (36);
+SET SESSION gtid_domain_id= 0;
+SET SESSION server_id= 12;
+INSERT INTO t1 VALUES (37);
+SET SESSION gtid_domain_id= @old_domain_id;
+SET SESSION server_id= @old_server_id;
+INSERT INTO t1 VALUES (38);
+INSERT INTO t1 VALUES (39);
+SELECT * FROM t1 WHERE a >= 30 ORDER BY a;
+--source include/save_master_gtid.inc
+
+--let OLD_STATE= `SELECT @@gtid_binlog_state`
+
+--let $datadir= `SELECT @@datadir`
+
+--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+wait
+EOF
+shutdown_server 10;
+--source include/wait_until_disconnected.inc
+
+--remove_file $datadir/master-bin.state
+
+--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+restart
+EOF
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+
+--let NEW_STATE= `SELECT @@gtid_binlog_state`
+
+--perl
+my $old= $ENV{'OLD_STATE'};
+my $new= $ENV{'NEW_STATE'};
+# Make them order-independent, for easy comparison.
+$old= join(",", sort(split(",", $old)));
+$new= join(",", sort(split(",", $new)));
+die "ERROR: new binlog state '$new' differs from old '$old'\n"
+ unless $old eq $new;
+EOF
+
+--connection server_2
+--source include/start_slave.inc
+--source include/sync_with_master_gtid.inc
+SELECT * FROM t1 WHERE a >= 30 ORDER BY a;
+
+
--connection server_1
DROP TABLE t1;
diff --git a/mysql-test/suite/rpl/t/rpl_gtid_errorhandling.test b/mysql-test/suite/rpl/t/rpl_gtid_errorhandling.test
index 31492b7c096..9739ba8bc43 100644
--- a/mysql-test/suite/rpl/t/rpl_gtid_errorhandling.test
+++ b/mysql-test/suite/rpl/t/rpl_gtid_errorhandling.test
@@ -230,7 +230,7 @@ CALL mtr.add_suppression("Slave: Could not update replication slave gtid state")
SET sql_log_bin=1;
---echo *** MDEV-4906: When event apply fails, next SQL thread start errorneously commits the failing GTID to gtid_slave_pos ***
+--echo *** MDEV-4906: When event apply fails, next SQL thread start erroneously commits the failing GTID to gtid_slave_pos ***
--connection slave
--source include/stop_slave.inc
diff --git a/mysql-test/suite/rpl/t/rpl_gtid_misc.test b/mysql-test/suite/rpl/t/rpl_gtid_misc.test
new file mode 100644
index 00000000000..66d98ec8025
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_gtid_misc.test
@@ -0,0 +1,50 @@
+--source include/master-slave.inc
+
+--echo *** MDEV-6403: Temporary tables lost at STOP SLAVE in GTID mode if master has not rotated binlog since restart ***
+
+--connection master
+CREATE TABLE t1 (a INT PRIMARY KEY);
+--sync_slave_with_master
+
+--connection slave
+--source include/stop_slave.inc
+# Inject a duplicate key error that will make the slave stop in the middle of
+# a sequence of transactions that use a temporary table.
+SET sql_log_bin= 0;
+INSERT INTO t1 VALUES (1);
+SET sql_log_bin= 1;
+CHANGE MASTER TO master_use_gtid= current_pos;
+
+--connection master
+
+# Make some queries that use a temporary table.
+CREATE TEMPORARY TABLE t2 LIKE t1;
+INSERT INTO t2 VALUE (1);
+INSERT INTO t1 SELECT * FROM t2;
+DROP TEMPORARY TABLE t2;
+--save_master_pos
+
+--connection slave
+START SLAVE;
+--let $slave_sql_errno=1062
+--source include/wait_for_slave_sql_error.inc
+
+# Restart the slave.
+# The bug was that the IO thread would receive again the restart
+# format_description event at the start of the master's binlog, and this
+# event would cause the SQL thread to discard all active temporary tables.
+
+STOP SLAVE IO_THREAD;
+
+SET sql_log_bin= 0;
+DELETE FROM t1 WHERE a=1;
+SET sql_log_bin= 1;
+
+--source include/start_slave.inc
+--sync_with_master
+SELECT * FROM t1 ORDER BY a;
+
+--connection master
+DROP TABLE t1;
+
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_gtid_until.test b/mysql-test/suite/rpl/t/rpl_gtid_until.test
index 4dde7da38a5..20d4510ccc8 100644
--- a/mysql-test/suite/rpl/t/rpl_gtid_until.test
+++ b/mysql-test/suite/rpl/t/rpl_gtid_until.test
@@ -73,19 +73,29 @@ SELECT * FROM t1 ORDER BY a;
# Test showing the UNTIL condition in SHOW SLAVE STATUS.
--source include/stop_slave.inc
-START SLAVE UNTIL master_gtid_pos = "1-10-100,2-20-200";
+START SLAVE UNTIL master_gtid_pos = "1-10-100,2-20-200,0-1-300";
--source include/wait_for_slave_to_start.inc
--let $status_items= Using_Gtid,Until_Condition
--source include/show_slave_status.inc
# Clear the UNTIL condition.
+# Note that we need to wait for a transaction to get through from the master.
+# Otherwise the IO thread may still be in get_master_version_and_clock()
+# (wait_for_slave_to_start.inc returns as soon as the IO thread is connected),
+# and we can get test failures from warnings in the log about IO thread being
+# killed in the middle of setting @@gtid_strict_mode or similar (MDEV-7940).
+--connection server_1
+INSERT INTO t1 VALUES (3);
+DELETE FROM t1 WHERE a=3;
+--save_master_pos
+
+--connection server_2
+--sync_with_master
--source include/stop_slave.inc
---source include/start_slave.inc
--echo *** Test UNTIL condition in an earlier binlog than the start GTID. ***
--connection server_2
---source include/stop_slave.inc
--connection server_1
SET gtid_domain_id = 1;
diff --git a/mysql-test/suite/rpl/t/rpl_master_pos_wait.test b/mysql-test/suite/rpl/t/rpl_master_pos_wait.test
index 25e27f62d0a..a3f3ff56464 100644
--- a/mysql-test/suite/rpl/t/rpl_master_pos_wait.test
+++ b/mysql-test/suite/rpl/t/rpl_master_pos_wait.test
@@ -25,5 +25,36 @@ echo "*** must be NULL ***";
select master_pos_wait('foo', 98);
# End of 4.1 tests
+
+
+--echo *** MDEV-7130: MASTER_POS_WAIT(log_name,log_pos,timeout,"connection_name") hangs, does not respect the timeout ***
+
+--connection slave
+--source include/stop_slave.inc
+reset slave all;
+--replace_result $MASTER_MYPORT MASTER_MYPORT
+eval change master 'my_slave' to master_port=$MASTER_MYPORT, master_host='127.0.0.1', master_user='root';
+set default_master_connection = 'my_slave';
+--source include/start_slave.inc
+
+--echo # Call without connection name -- works (expected -1)
+select master_pos_wait('master-bin.000001',1000000,1);
+
+set default_master_connection = '';
+
+--echo # Call for non-existing anonymous connection -- works (expected NULL)
+select master_pos_wait('master-bin.000001',1000000,1);
+
+--echo # Call with a valid connection name -- hangs before MDEV-7130 fix (expected -1)
+select master_pos_wait('master-bin.000001',1000000,1,"my_slave");
+
+STOP SLAVE 'my_slave';
+RESET SLAVE 'my_slave' ALL;
+
+--replace_result $MASTER_MYPORT MASTER_MYPORT
+eval change master to master_port=$MASTER_MYPORT, master_host='127.0.0.1', master_user='root';
+
+# End of 10.0 tests
+
--let $rpl_only_running_threads= 1
--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_old_decimal.test b/mysql-test/suite/rpl/t/rpl_old_decimal.test
new file mode 100644
index 00000000000..79fd2754079
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_old_decimal.test
@@ -0,0 +1,25 @@
+--source include/have_binlog_format_row.inc
+--source include/master-slave.inc
+
+
+--connection slave
+CREATE TABLE t1dec102 (a DECIMAL(10,2));
+
+--connection master
+let $MYSQLD_DATADIR= `select @@datadir`;
+
+--copy_file std_data/old_decimal/t1dec102.frm $MYSQLD_DATADIR/test/t1dec102.frm
+--copy_file std_data/old_decimal/t1dec102.MYD $MYSQLD_DATADIR/test/t1dec102.MYD
+--copy_file std_data/old_decimal/t1dec102.MYI $MYSQLD_DATADIR/test/t1dec102.MYI
+INSERT INTO t1dec102 VALUES(999.99);
+
+--let $slave_sql_errno=1677
+--let $show_slave_sql_error= 1
+call mtr.add_suppression("Slave SQL.*Column 0 of table .* cannot be converted from type.* Error_code: 1677");
+--source include/wait_for_slave_sql_error_and_skip.inc
+
+--connection master
+DROP TABLE t1dec102;
+--sync_slave_with_master
+
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_parallel.test b/mysql-test/suite/rpl/t/rpl_parallel.test
index d4b99d4b0f7..feac32b1454 100644
--- a/mysql-test/suite/rpl/t/rpl_parallel.test
+++ b/mysql-test/suite/rpl/t/rpl_parallel.test
@@ -12,9 +12,20 @@ SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
SET GLOBAL slave_parallel_threads=10;
--source include/stop_slave.inc
SET GLOBAL slave_parallel_threads=10;
+
+# Check that we do not spawn any worker threads when no slave is running.
+SELECT IF(COUNT(*) < 10, "OK", CONCAT("Found too many system user processes: ", COUNT(*))) FROM information_schema.processlist WHERE user = "system user";
+
CHANGE MASTER TO master_use_gtid=slave_pos;
--source include/start_slave.inc
+# Check that worker threads get spawned when slave starts.
+SELECT IF(COUNT(*) >= 10, "OK", CONCAT("Found too few system user processes: ", COUNT(*))) FROM information_schema.processlist WHERE user = "system user";
+# ... and that worker threads get removed when slave stops.
+--source include/stop_slave.inc
+SELECT IF(COUNT(*) < 10, "OK", CONCAT("Found too many system user processes: ", COUNT(*))) FROM information_schema.processlist WHERE user = "system user";
+--source include/start_slave.inc
+SELECT IF(COUNT(*) >= 10, "OK", CONCAT("Found too few system user processes: ", COUNT(*))) FROM information_schema.processlist WHERE user = "system user";
--echo *** Test long-running query in domain 1 can run in parallel with short queries in domain 0 ***
@@ -1843,6 +1854,467 @@ SET GLOBAL slave_parallel_threads=10;
--source include/start_slave.inc
+--echo *** MDEV-7335: Potential parallel slave deadlock with specific binlog corruption ***
+
+--connection server_2
+--source include/stop_slave.inc
+SET GLOBAL slave_parallel_threads=1;
+SET @old_dbug= @@GLOBAL.debug_dbug;
+SET GLOBAL debug_dbug="+d,slave_discard_xid_for_gtid_0_x_1000";
+
+--connection server_1
+INSERT INTO t2 VALUES (101);
+INSERT INTO t2 VALUES (102);
+INSERT INTO t2 VALUES (103);
+INSERT INTO t2 VALUES (104);
+INSERT INTO t2 VALUES (105);
+# Inject a partial event group (missing XID at the end). The bug was that such
+# partial group was not handled appropriately, leading to server deadlock.
+SET gtid_seq_no=1000;
+INSERT INTO t2 VALUES (106);
+INSERT INTO t2 VALUES (107);
+INSERT INTO t2 VALUES (108);
+INSERT INTO t2 VALUES (109);
+INSERT INTO t2 VALUES (110);
+INSERT INTO t2 VALUES (111);
+INSERT INTO t2 VALUES (112);
+INSERT INTO t2 VALUES (113);
+INSERT INTO t2 VALUES (114);
+INSERT INTO t2 VALUES (115);
+INSERT INTO t2 VALUES (116);
+INSERT INTO t2 VALUES (117);
+INSERT INTO t2 VALUES (118);
+INSERT INTO t2 VALUES (119);
+INSERT INTO t2 VALUES (120);
+INSERT INTO t2 VALUES (121);
+INSERT INTO t2 VALUES (122);
+INSERT INTO t2 VALUES (123);
+INSERT INTO t2 VALUES (124);
+INSERT INTO t2 VALUES (125);
+INSERT INTO t2 VALUES (126);
+INSERT INTO t2 VALUES (127);
+INSERT INTO t2 VALUES (128);
+INSERT INTO t2 VALUES (129);
+INSERT INTO t2 VALUES (130);
+--source include/save_master_gtid.inc
+
+--connection server_2
+--source include/start_slave.inc
+--source include/sync_with_master_gtid.inc
+# The partial event group (a=106) should be rolled back and thus missing.
+SELECT * FROM t2 WHERE a >= 100 ORDER BY a;
+
+--source include/stop_slave.inc
+SET GLOBAL debug_dbug=@old_dbug;
+SET GLOBAL slave_parallel_threads=10;
+--source include/start_slave.inc
+
+
+--echo *** MDEV-7847: "Slave worker thread retried transaction 10 time(s) in vain, giving up", followed by replication hanging ***
+--echo *** MDEV-7882: Excessive transaction retry in parallel replication ***
+
+--connection server_1
+CREATE TABLE t7 (a int PRIMARY KEY, b INT) ENGINE=InnoDB;
+CREATE TABLE t8 (a int PRIMARY KEY, b INT) ENGINE=InnoDB;
+--save_master_pos
+
+--connection server_2
+--sync_with_master
+--source include/stop_slave.inc
+SET GLOBAL slave_parallel_threads=40;
+SELECT @old_retries:=@@GLOBAL.slave_transaction_retries;
+SET GLOBAL slave_transaction_retries= 5;
+
+
+# Using dbug error injection, we artificially create event groups with a lot of
+# conflicting transactions in each event group. The bugs were originally seen
+# "in the wild" with transactions that did not conflict on the master, and only
+# conflicted very rarely on the slave (maybe some edge case with InnoDB btree
+# page splits or something like that). The event groups here loosely reflect
+# the structure of the original failure's group commits.
+
+
+--connection server_1
+INSERT INTO t7 VALUES (1,1), (2,2), (3,3), (4,4), (5,5);
+SET @old_dbug= @@SESSION.debug_dbug;
+SET @commit_id= 42;
+SET SESSION debug_dbug="+d,binlog_force_commit_id";
+INSERT INTO t8 VALUES (1,1);
+INSERT INTO t8 VALUES (2,2);
+INSERT INTO t8 VALUES (3,3);
+INSERT INTO t8 VALUES (4,4);
+INSERT INTO t8 VALUES (5,5);
+INSERT INTO t8 VALUES (6,6);
+INSERT INTO t8 VALUES (7,7);
+INSERT INTO t8 VALUES (8,8);
+
+UPDATE t7 SET b=9 WHERE a=3;
+UPDATE t7 SET b=10 WHERE a=3;
+UPDATE t7 SET b=11 WHERE a=3;
+
+INSERT INTO t8 VALUES (12,12);
+INSERT INTO t8 VALUES (13,13);
+
+UPDATE t7 SET b=14 WHERE a=3;
+UPDATE t7 SET b=15 WHERE a=3;
+
+INSERT INTO t8 VALUES (16,16);
+
+UPDATE t7 SET b=17 WHERE a=3;
+
+INSERT INTO t8 VALUES (18,18);
+INSERT INTO t8 VALUES (19,19);
+
+UPDATE t7 SET b=20 WHERE a=3;
+
+INSERT INTO t8 VALUES (21,21);
+
+UPDATE t7 SET b=22 WHERE a=3;
+
+INSERT INTO t8 VALUES (23,24);
+INSERT INTO t8 VALUES (24,24);
+
+UPDATE t7 SET b=25 WHERE a=3;
+
+INSERT INTO t8 VALUES (26,26);
+
+UPDATE t7 SET b=27 WHERE a=3;
+
+BEGIN;
+INSERT INTO t8 VALUES (28,28);
+INSERT INTO t8 VALUES (29,28), (30,28);
+INSERT INTO t8 VALUES (31,28);
+INSERT INTO t8 VALUES (32,28);
+INSERT INTO t8 VALUES (33,28);
+INSERT INTO t8 VALUES (34,28);
+INSERT INTO t8 VALUES (35,28);
+INSERT INTO t8 VALUES (36,28);
+INSERT INTO t8 VALUES (37,28);
+INSERT INTO t8 VALUES (38,28);
+INSERT INTO t8 VALUES (39,28);
+INSERT INTO t8 VALUES (40,28);
+INSERT INTO t8 VALUES (41,28);
+INSERT INTO t8 VALUES (42,28);
+COMMIT;
+
+
+SET @commit_id=43;
+INSERT INTO t8 VALUES (43,43);
+INSERT INTO t8 VALUES (44,44);
+
+UPDATE t7 SET b=45 WHERE a=3;
+
+INSERT INTO t8 VALUES (46,46);
+INSERT INTO t8 VALUES (47,47);
+
+UPDATE t7 SET b=48 WHERE a=3;
+
+INSERT INTO t8 VALUES (49,49);
+INSERT INTO t8 VALUES (50,50);
+
+
+SET @commit_id=44;
+INSERT INTO t8 VALUES (51,51);
+INSERT INTO t8 VALUES (52,52);
+
+UPDATE t7 SET b=53 WHERE a=3;
+
+INSERT INTO t8 VALUES (54,54);
+INSERT INTO t8 VALUES (55,55);
+
+UPDATE t7 SET b=56 WHERE a=3;
+
+INSERT INTO t8 VALUES (57,57);
+
+UPDATE t7 SET b=58 WHERE a=3;
+
+INSERT INTO t8 VALUES (58,58);
+INSERT INTO t8 VALUES (59,59);
+INSERT INTO t8 VALUES (60,60);
+INSERT INTO t8 VALUES (61,61);
+
+UPDATE t7 SET b=62 WHERE a=3;
+
+INSERT INTO t8 VALUES (63,63);
+INSERT INTO t8 VALUES (64,64);
+INSERT INTO t8 VALUES (65,65);
+INSERT INTO t8 VALUES (66,66);
+
+UPDATE t7 SET b=67 WHERE a=3;
+
+INSERT INTO t8 VALUES (68,68);
+
+UPDATE t7 SET b=69 WHERE a=3;
+UPDATE t7 SET b=70 WHERE a=3;
+UPDATE t7 SET b=71 WHERE a=3;
+
+INSERT INTO t8 VALUES (72,72);
+
+UPDATE t7 SET b=73 WHERE a=3;
+UPDATE t7 SET b=74 WHERE a=3;
+UPDATE t7 SET b=75 WHERE a=3;
+UPDATE t7 SET b=76 WHERE a=3;
+
+INSERT INTO t8 VALUES (77,77);
+
+UPDATE t7 SET b=78 WHERE a=3;
+
+INSERT INTO t8 VALUES (79,79);
+
+UPDATE t7 SET b=80 WHERE a=3;
+
+INSERT INTO t8 VALUES (81,81);
+
+UPDATE t7 SET b=82 WHERE a=3;
+
+INSERT INTO t8 VALUES (83,83);
+
+UPDATE t7 SET b=84 WHERE a=3;
+
+
+SET @commit_id=45;
+INSERT INTO t8 VALUES (85,85);
+UPDATE t7 SET b=86 WHERE a=3;
+INSERT INTO t8 VALUES (87,87);
+
+
+SET @commit_id=46;
+INSERT INTO t8 VALUES (88,88);
+INSERT INTO t8 VALUES (89,89);
+INSERT INTO t8 VALUES (90,90);
+
+SET SESSION debug_dbug=@old_dbug;
+
+INSERT INTO t8 VALUES (91,91);
+INSERT INTO t8 VALUES (92,92);
+INSERT INTO t8 VALUES (93,93);
+INSERT INTO t8 VALUES (94,94);
+INSERT INTO t8 VALUES (95,95);
+INSERT INTO t8 VALUES (96,96);
+INSERT INTO t8 VALUES (97,97);
+INSERT INTO t8 VALUES (98,98);
+INSERT INTO t8 VALUES (99,99);
+
+
+SELECT * FROM t7 ORDER BY a;
+SELECT * FROM t8 ORDER BY a;
+--source include/save_master_gtid.inc
+
+
+--connection server_2
+--source include/start_slave.inc
+--source include/sync_with_master_gtid.inc
+SELECT * FROM t7 ORDER BY a;
+SELECT * FROM t8 ORDER BY a;
+
+--source include/stop_slave.inc
+SET GLOBAL slave_transaction_retries= @old_retries;
+SET GLOBAL slave_parallel_threads=10;
+--source include/start_slave.inc
+
+
+--echo *** MDEV-7888: ANALYZE TABLE does wakeup_subsequent_commits(), causing wrong binlog order and parallel replication hang ***
+
+--connection server_2
+--source include/stop_slave.inc
+SET @old_dbug= @@GLOBAL.debug_dbug;
+SET GLOBAL debug_dbug= '+d,inject_analyze_table_sleep';
+
+--connection server_1
+# Inject two group commits. The bug was that ANALYZE TABLE would call
+# wakeup_subsequent_commits() too early, allowing the following transaction
+# in the same group to run ahead and binlog and free the GCO. Then we get
+# wrong binlog order and later access freed GCO, which causes lost wakeup
+# of following GCO and thus replication hang.
+# We injected a small sleep in ANALYZE to make the race easier to hit (this
+# can only cause false negatives in versions with the bug, not false positives,
+# so sleep is ok here. And it's in general not possible to trigger reliably
+# the race with debug_sync, since the bugfix makes the race impossible).
+
+SET @old_dbug= @@SESSION.debug_dbug;
+SET SESSION debug_dbug="+d,binlog_force_commit_id";
+
+# Group commit with cid=10000, two event groups.
+SET @commit_id= 10000;
+ANALYZE TABLE t2;
+INSERT INTO t3 VALUES (120, 0);
+
+# Group commit with cid=10001, one event group.
+SET @commit_id= 10001;
+INSERT INTO t3 VALUES (121, 0);
+
+SET SESSION debug_dbug=@old_dbug;
+
+SELECT * FROM t3 WHERE a >= 120 ORDER BY a;
+--source include/save_master_gtid.inc
+
+--connection server_2
+--source include/start_slave.inc
+--source include/sync_with_master_gtid.inc
+
+SELECT * FROM t3 WHERE a >= 120 ORDER BY a;
+
+--source include/stop_slave.inc
+SET GLOBAL debug_dbug= @old_dbug;
+--source include/start_slave.inc
+
+
+--echo *** MDEV-7929: record_gtid() for non-transactional event group calls wakeup_subsequent_commits() too early, causing slave hang. ***
+
+--connection server_2
+--source include/stop_slave.inc
+SET @old_dbug= @@GLOBAL.debug_dbug;
+SET GLOBAL debug_dbug= '+d,inject_record_gtid_serverid_100_sleep';
+
+--connection server_1
+# Inject two group commits. The bug was that record_gtid for a
+# non-transactional event group would commit its own transaction, which would
+# cause ha_commit_trans() to call wakeup_subsequent_commits() too early. This
+# in turn lead to access to freed group_commit_orderer object, losing a wakeup
+# and causing slave threads to hang.
+# We inject a small sleep in the corresponding record_gtid() to make the race
+# easier to hit.
+
+SET @old_dbug= @@SESSION.debug_dbug;
+SET SESSION debug_dbug="+d,binlog_force_commit_id";
+
+# Group commit with cid=10010, two event groups.
+SET @old_server_id= @@SESSION.server_id;
+SET SESSION server_id= 100;
+SET @commit_id= 10010;
+ALTER TABLE t1 COMMENT "Hulubulu!";
+SET SESSION server_id= @old_server_id;
+INSERT INTO t3 VALUES (130, 0);
+
+# Group commit with cid=10011, one event group.
+SET @commit_id= 10011;
+INSERT INTO t3 VALUES (131, 0);
+
+SET SESSION debug_dbug=@old_dbug;
+
+SELECT * FROM t3 WHERE a >= 130 ORDER BY a;
+--source include/save_master_gtid.inc
+
+--connection server_2
+--source include/start_slave.inc
+--source include/sync_with_master_gtid.inc
+
+SELECT * FROM t3 WHERE a >= 130 ORDER BY a;
+
+--source include/stop_slave.inc
+SET GLOBAL debug_dbug= @old_dbug;
+--source include/start_slave.inc
+
+
+--echo *** MDEV-8031: Parallel replication stops on "connection killed" error (probably incorrectly handled deadlock kill) ***
+
+--connection server_1
+INSERT INTO t3 VALUES (201,0), (202,0);
+--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_mdev8031';
+
+--connection server_1
+# We artificially create a situation that hopefully resembles the original
+# bug which was only seen "in the wild", and only once.
+# Setup a fake group commit with lots of conflicts that will lead to deadloc
+# kill. The slave DBUG injection causes the slave to be deadlock killed at
+# a particular point during the retry, and then later do a small sleep at
+# another critical point where the prior transaction then has a chance to
+# complete. Finally an extra KILL check catches an unhandled, lingering
+# deadlock kill. So rather artificial, but at least it exercises the
+# relevant code paths.
+SET @old_dbug= @@SESSION.debug_dbug;
+SET SESSION debug_dbug="+d,binlog_force_commit_id";
+
+SET @commit_id= 10200;
+INSERT INTO t3 VALUES (203, 1);
+INSERT INTO t3 VALUES (204, 1);
+INSERT INTO t3 VALUES (205, 1);
+UPDATE t3 SET b=b+1 WHERE a=201;
+UPDATE t3 SET b=b+1 WHERE a=201;
+UPDATE t3 SET b=b+1 WHERE a=201;
+UPDATE t3 SET b=b+1 WHERE a=202;
+UPDATE t3 SET b=b+1 WHERE a=202;
+UPDATE t3 SET b=b+1 WHERE a=202;
+UPDATE t3 SET b=b+1 WHERE a=202;
+UPDATE t3 SET b=b+1 WHERE a=203;
+UPDATE t3 SET b=b+1 WHERE a=203;
+UPDATE t3 SET b=b+1 WHERE a=204;
+UPDATE t3 SET b=b+1 WHERE a=204;
+UPDATE t3 SET b=b+1 WHERE a=204;
+UPDATE t3 SET b=b+1 WHERE a=203;
+UPDATE t3 SET b=b+1 WHERE a=205;
+UPDATE t3 SET b=b+1 WHERE a=205;
+SET SESSION debug_dbug=@old_dbug;
+
+SELECT * FROM t3 WHERE a>=200 ORDER BY a;
+--source include/save_master_gtid.inc
+
+--connection server_2
+--source include/start_slave.inc
+--source include/sync_with_master_gtid.inc
+
+SELECT * FROM t3 WHERE a>=200 ORDER BY a;
+--source include/stop_slave.inc
+SET GLOBAL debug_dbug= @old_dbug;
+--source include/start_slave.inc
+
+
+--echo *** Check getting deadlock killed inside open_binlog() during retry. ***
+
+--connection server_2
+--source include/stop_slave.inc
+SET @old_dbug= @@GLOBAL.debug_dbug;
+SET GLOBAL debug_dbug= '+d,inject_retry_event_group_open_binlog_kill';
+SET @old_max= @@GLOBAL.max_relay_log_size;
+SET GLOBAL max_relay_log_size= 4096;
+
+--connection server_1
+SET @old_dbug= @@SESSION.debug_dbug;
+SET SESSION debug_dbug="+d,binlog_force_commit_id";
+
+--let $large= `SELECT REPEAT("*", 8192)`
+SET @commit_id= 10210;
+--echo Omit long queries that cause relaylog rotations and transaction retries...
+--disable_query_log
+eval UPDATE t3 SET b=b+1 WHERE a=201 /* $large */;
+eval UPDATE t3 SET b=b+1 WHERE a=201 /* $large */;
+eval UPDATE t3 SET b=b+1 WHERE a=201 /* $large */;
+eval UPDATE t3 SET b=b+1 WHERE a=202 /* $large */;
+eval UPDATE t3 SET b=b+1 WHERE a=202 /* $large */;
+eval UPDATE t3 SET b=b+1 WHERE a=202 /* $large */;
+eval UPDATE t3 SET b=b+1 WHERE a=202 /* $large */;
+eval UPDATE t3 SET b=b+1 WHERE a=203 /* $large */;
+eval UPDATE t3 SET b=b+1 WHERE a=203 /* $large */;
+eval UPDATE t3 SET b=b+1 WHERE a=204 /* $large */;
+eval UPDATE t3 SET b=b+1 WHERE a=204 /* $large */;
+eval UPDATE t3 SET b=b+1 WHERE a=204 /* $large */;
+eval UPDATE t3 SET b=b+1 WHERE a=203 /* $large */;
+eval UPDATE t3 SET b=b+1 WHERE a=205 /* $large */;
+eval UPDATE t3 SET b=b+1 WHERE a=205 /* $large */;
+--enable_query_log
+SET SESSION debug_dbug=@old_dbug;
+
+SELECT * FROM t3 WHERE a>=200 ORDER BY a;
+--source include/save_master_gtid.inc
+
+--connection server_2
+--source include/start_slave.inc
+--source include/sync_with_master_gtid.inc
+
+SELECT * FROM t3 WHERE a>=200 ORDER BY a;
+--source include/stop_slave.inc
+SET GLOBAL debug_dbug= @old_debg;
+SET GLOBAL max_relay_log_size= @old_max;
+--source include/start_slave.inc
+
+
+
# Clean up.
--connection server_2
--source include/stop_slave.inc
@@ -1852,7 +2324,7 @@ SET DEBUG_SYNC= 'RESET';
--connection server_1
DROP function foo;
-DROP TABLE t1,t2,t3,t4,t5,t6;
+DROP TABLE t1,t2,t3,t4,t5,t6,t7,t8;
SET DEBUG_SYNC= 'RESET';
--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_parallel2.test b/mysql-test/suite/rpl/t/rpl_parallel2.test
index 51c9e39a26a..47b0e87a6b6 100644
--- a/mysql-test/suite/rpl/t/rpl_parallel2.test
+++ b/mysql-test/suite/rpl/t/rpl_parallel2.test
@@ -37,6 +37,48 @@ INSERT INTO t1 VALUES (1,sleep(2));
--source include/show_slave_status.inc
+--echo *** MDEV-8294: Inconsistent behavior of slave parallel threads at runtime ***
+
+--connection server_1
+INSERT INTO t1 VALUES (10,0);
+# Force a duplicate key error on the slave.
+SET sql_log_bin= 0;
+DELETE FROM t1 WHERE a=10;
+SET sql_log_bin= 1;
+INSERT INTO t1 VALUES (10,0);
+--save_master_pos
+SELECT * FROM t1 WHERE a >= 10 ORDER BY a;
+
+--connection server_2
+--let $slave_sql_errno= 1062
+--source include/wait_for_slave_sql_error.inc
+
+# At this point, the worker threads should have stopped also.
+--let $wait_condition= SELECT COUNT(*)=0 FROM information_schema.processlist WHERE User = "system user" AND State = "Waiting for work from SQL thread";
+--source include/wait_condition.inc
+
+# Check that the pool can still be resized, but remains inactive as no slave
+# SQL thread is running.
+SET GLOBAL slave_parallel_threads=8;
+--let $wait_condition= SELECT COUNT(*)=0 FROM information_schema.processlist WHERE User = "system user" AND State = "Waiting for work from SQL thread";
+--source include/wait_condition.inc
+
+STOP SLAVE;
+# At this point, the worker threads should have stopped.
+--let $wait_condition= SELECT COUNT(*)=0 FROM information_schema.processlist WHERE User = "system user" AND State = "Waiting for work from SQL thread";
+--source include/wait_condition.inc
+
+
+SET GLOBAL sql_slave_skip_counter= 1;
+--source include/start_slave.inc
+# At this point, the worker threads should have been spawned.
+--let $wait_condition= SELECT COUNT(*)=8 FROM information_schema.processlist WHERE User = "system user" AND State = "Waiting for work from SQL thread";
+--source include/wait_condition.inc
+--sync_with_master
+SELECT * FROM t1 WHERE a >= 10 ORDER BY a;
+
+
+# Clean up
--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_mdev6589.test b/mysql-test/suite/rpl/t/rpl_parallel_mdev6589.test
new file mode 100644
index 00000000000..5929fad71df
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_parallel_mdev6589.test
@@ -0,0 +1,132 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+--source include/master-slave.inc
+
+--connection server_2
+SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
+--source include/stop_slave.inc
+SET GLOBAL slave_parallel_threads=10;
+CHANGE MASTER TO master_use_gtid=current_pos;
+--source include/start_slave.inc
+
+
+--echo *** MDEV-6589: Incorrect relay log start position when restarting SQL thread after error in parallel replication ***
+
+--connection server_1
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
+CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=MyISAM;
+CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+--save_master_pos
+
+--connection server_2
+--sync_with_master
+SELECT * FROM t1;
+SELECT * FROM t2;
+
+# Block one domain, which we will later cause to give an error. And let some
+# other domains proceed so we can check that after restart, the slave is able
+# to correctly restart each domain in a separate position.
+
+--connect (con_temp1,127.0.0.1,root,,test,$SERVER_MYPORT_2,)
+SET sql_log_bin=0;
+BEGIN;
+INSERT INTO t2 VALUES (5);
+
+--connection server_1
+SET gtid_domain_id=0;
+INSERT INTO t1 VALUES (2);
+INSERT INTO t2 VALUES (3);
+FLUSH LOGS;
+INSERT INTO t1 VALUES (4);
+
+SET gtid_domain_id=1;
+# This query will be blocked on the slave, and later give a duplicate key error.
+INSERT INTO t2 VALUES (5);
+
+SET gtid_domain_id=0;
+INSERT INTO t1 VALUES (6);
+INSERT INTO t1 VALUES (7);
+
+SET gtid_domain_id=2;
+INSERT INTO t2 VALUES (8);
+INSERT INTO t1 VALUES (9);
+FLUSH LOGS;
+
+SET gtid_domain_id=3;
+INSERT INTO t2 VALUES (10);
+INSERT INTO t1 VALUES (11);
+
+# These cannot be replicated before the error, as a prior commit is blocked.
+SET gtid_domain_id=1;
+INSERT INTO t1 VALUES (12);
+INSERT INTO t2 VALUES (13);
+
+SET gtid_domain_id=0;
+INSERT INTO t2 VALUES (14);
+FLUSH LOGS;
+
+SET gtid_domain_id=3;
+INSERT INTO t2 VALUES (15);
+
+SET gtid_domain_id=2;
+INSERT INTO t2 VALUES (16);
+
+SET gtid_domain_id=0;
+INSERT INTO t1 VALUES (17);
+SET @gtid0 = @@last_gtid;
+SET gtid_domain_id=2;
+INSERT INTO t1 VALUES (18);
+SET @gtid2 = @@last_gtid;
+SET gtid_domain_id=3;
+INSERT INTO t1 VALUES (19);
+SET @gtid3 = @@last_gtid;
+--let $wait_pos= `SELECT CONCAT(@gtid0, ",", @gtid2, ",", @gtid3)`
+
+SELECT * FROM t1 ORDER BY a;
+SELECT * FROM t2 ORDER BY a;
+--source include/save_master_gtid.inc
+
+
+--connection server_2
+# First wait for domains 0, 2, and 3 to complete.
+--replace_result $wait_pos WAIT_POS
+eval SELECT MASTER_GTID_WAIT('$wait_pos');
+
+# Then release the row lock, and wait for the domain 1 to fail with
+# duplicate key error.
+--connection con_temp1
+COMMIT;
+SET sql_log_bin=1;
+
+--connection server_2
+--let $slave_sql_errno= 1062
+--source include/wait_for_slave_sql_error.inc
+
+SELECT * FROM t1 ORDER BY a;
+SELECT * FROM t2 ORDER BY a;
+
+SET sql_log_bin=0;
+DELETE FROM t2 WHERE a=5;
+SET sql_log_bin=1;
+--source include/start_slave.inc
+--source include/sync_with_master_gtid.inc
+
+SELECT * FROM t1 ORDER BY a;
+SELECT * FROM t2 ORDER BY a;
+
+
+# Clean up.
+--connection server_2
+--source include/stop_slave.inc
+SET GLOBAL slave_parallel_threads=@old_parallel_threads;
+--source include/start_slave.inc
+SET DEBUG_SYNC= 'RESET';
+
+--connection server_1
+DROP TABLE t1,t2;
+SET DEBUG_SYNC= 'RESET';
+
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_parallel_multilevel2.cnf b/mysql-test/suite/rpl/t/rpl_parallel_multilevel2.cnf
new file mode 100644
index 00000000000..4e1d3878f03
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_parallel_multilevel2.cnf
@@ -0,0 +1,17 @@
+!include ../my.cnf
+
+[mysqld.1]
+log-slave-updates
+loose-innodb
+
+[mysqld.2]
+log-slave-updates
+loose-innodb
+
+[mysqld.3]
+log-slave-updates
+loose-innodb
+
+[ENV]
+SERVER_MYPORT_3= @mysqld.3.port
+SERVER_MYSOCK_3= @mysqld.3.socket
diff --git a/mysql-test/suite/rpl/t/rpl_parallel_multilevel2.test b/mysql-test/suite/rpl/t/rpl_parallel_multilevel2.test
new file mode 100644
index 00000000000..4125394ef80
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_parallel_multilevel2.test
@@ -0,0 +1,80 @@
+--source include/have_innodb.inc
+--let $rpl_topology=1->2->3
+--source include/rpl_init.inc
+
+--echo *** MDEV-7668: Intermediate master groups CREATE with INSERT, causing parallel replication failure ***
+
+--connection server_1
+SET @old_updates= @@GLOBAL.binlog_direct_non_transactional_updates;
+SET GLOBAL binlog_direct_non_transactional_updates=OFF;
+SET SESSION binlog_direct_non_transactional_updates=OFF;
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
+CREATE TABLE t1 (a int PRIMARY KEY, b INT) ENGINE=InnoDB;
+--save_master_pos
+
+--connection server_2
+--sync_with_master
+--save_master_pos
+--source include/stop_slave.inc
+SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
+SET GLOBAL slave_parallel_threads=10;
+SET @old_commit_count=@@GLOBAL.binlog_commit_wait_count;
+SET GLOBAL binlog_commit_wait_count=2;
+SET @old_commit_usec=@@GLOBAL.binlog_commit_wait_usec;
+SET GLOBAL binlog_commit_wait_usec=2000000;
+SET @old_updates= @@GLOBAL.binlog_direct_non_transactional_updates;
+SET GLOBAL binlog_direct_non_transactional_updates=OFF;
+SET SESSION binlog_direct_non_transactional_updates=OFF;
+CHANGE MASTER TO master_use_gtid=current_pos;
+
+--connection server_3
+--sync_with_master
+--save_master_pos
+SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
+--source include/stop_slave.inc
+SET GLOBAL slave_parallel_threads=10;
+CHANGE MASTER TO master_use_gtid=current_pos;
+
+
+--connection server_1
+
+BEGIN;
+CREATE TEMPORARY TABLE t2 (a INT PRIMARY KEY) ENGINE=MEMORY;
+COMMIT;
+INSERT INTO t2 VALUES (1);
+INSERT INTO t1 SELECT a, a*10 FROM t2;
+DROP TABLE t2;
+--source include/save_master_gtid.inc
+
+--connection server_2
+--source include/start_slave.inc
+--source include/sync_with_master_gtid.inc
+SELECT * FROM t1 ORDER BY a;
+
+--connection server_3
+--source include/start_slave.inc
+--source include/sync_with_master_gtid.inc
+SELECT * FROM t1 ORDER BY a;
+
+
+# Clean up
+
+--connection server_2
+--source include/stop_slave.inc
+SET GLOBAL slave_parallel_threads=@old_parallel_threads;
+SET GLOBAL binlog_commit_wait_count=@old_commit_count;
+SET GLOBAL binlog_commit_wait_usec=@old_commit_usec;
+SET GLOBAL binlog_direct_non_transactional_updates= @old_updates;
+--source include/start_slave.inc
+
+--connection server_3
+--source include/stop_slave.inc
+SET GLOBAL slave_parallel_threads=@old_parallel_threads;
+--source include/start_slave.inc
+
+--connection server_1
+SET GLOBAL binlog_direct_non_transactional_updates= @old_updates;
+CALL mtr.add_suppression("Statement accesses nontransactional table as well as transactional or temporary table");
+DROP TABLE t1;
+
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_parallel_partition.test b/mysql-test/suite/rpl/t/rpl_parallel_partition.test
new file mode 100644
index 00000000000..37dce9fef80
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_parallel_partition.test
@@ -0,0 +1,81 @@
+--source include/have_partition.inc
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/master-slave.inc
+
+--connection server_2
+SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
+--source include/stop_slave.inc
+SET @old_dbug= @@GLOBAL.debug_dbug;
+SET GLOBAL debug_dbug="+d,inject_wakeup_subsequent_commits_sleep";
+SET GLOBAL slave_parallel_threads=8;
+
+--echo *** MDEV-8147: Assertion `m_lock_type == 2' failed in handler::ha_close() during parallel replication ***
+--connection server_1
+CREATE TABLE E (
+ pk INTEGER AUTO_INCREMENT,
+ col_int_nokey INTEGER /*! NULL */,
+ col_int_key INTEGER /*! NULL */,
+
+ col_date_key DATE /*! NULL */,
+ col_date_nokey DATE /*! NULL */,
+
+ col_time_key TIME /*! NULL */,
+ col_time_nokey TIME /*! NULL */,
+
+ col_datetime_key DATETIME /*! NULL */,
+ col_datetime_nokey DATETIME /*! NULL */,
+
+ col_varchar_key VARCHAR(1) /*! NULL */,
+ col_varchar_nokey VARCHAR(1) /*! NULL */,
+
+ PRIMARY KEY (pk),
+ KEY (col_int_key),
+ KEY (col_date_key),
+ KEY (col_time_key),
+ KEY (col_datetime_key),
+ KEY (col_varchar_key, col_int_key)
+ ) ENGINE=InnoDB;
+
+ALTER TABLE `E` PARTITION BY KEY() PARTITIONS 5;
+ALTER TABLE `E` REMOVE PARTITIONING;
+--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+wait
+EOF
+--shutdown_server 30
+--source include/wait_until_disconnected.inc
+--connection default
+--source include/wait_until_disconnected.inc
+--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+restart:
+EOF
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+--connection server_1
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+CREATE TABLE t1 (a INT PRIMARY KEY);
+--save_master_pos
+
+--connection server_2
+--source include/start_slave.inc
+--sync_with_master
+
+# Re-spawn worker threads to clear dbug injection.
+--source include/stop_slave.inc
+SET GLOBAL debug_dbug=@old_dbug;
+SET GLOBAL slave_parallel_threads=0;
+SET GLOBAL slave_parallel_threads=8;
+--source include/start_slave.inc
+
+
+# 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 `E`;
+DROP TABLE t1;
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_parallel_temptable.test b/mysql-test/suite/rpl/t/rpl_parallel_temptable.test
index b13fa5a01b1..feae29e7a9e 100644
--- a/mysql-test/suite/rpl/t/rpl_parallel_temptable.test
+++ b/mysql-test/suite/rpl/t/rpl_parallel_temptable.test
@@ -213,6 +213,29 @@ SHOW STATUS LIKE 'Slave_open_temp_tables';
FLUSH LOGS;
+--echo *** MDEV-7936: Assertion `!table || table->in_use == _current_thd()' failed on parallel replication in optimistic mode ***
+
+--connection server_1
+CREATE TEMPORARY TABLE t4 (a INT PRIMARY KEY) ENGINE=InnoDB;
+SET @old_dbug= @@SESSION.debug_dbug;
+SET SESSION debug_dbug="+d,binlog_force_commit_id";
+SET @commit_id= 10000;
+INSERT INTO t4 VALUES (30);
+INSERT INTO t4 VALUES (31);
+SET SESSION debug_dbug= @old_dbug;
+INSERT INTO t1 SELECT a, "conservative" FROM t4;
+DROP TEMPORARY TABLE t4;
+SELECT * FROM t1 WHERE a >= 30 ORDER BY a;
+--source include/save_master_gtid.inc
+
+--connection server_2
+--source include/sync_with_master_gtid.inc
+
+SELECT * FROM t1 WHERE a >= 30 ORDER BY a;
+
+
+# Clean up.
+
--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_special_charset.opt b/mysql-test/suite/rpl/t/rpl_special_charset.opt
new file mode 100644
index 00000000000..b071fb20845
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_special_charset.opt
@@ -0,0 +1 @@
+--character-set-server=utf16
diff --git a/mysql-test/suite/rpl/t/rpl_special_charset.test b/mysql-test/suite/rpl/t/rpl_special_charset.test
new file mode 100644
index 00000000000..8ccb1b4183f
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_special_charset.test
@@ -0,0 +1,26 @@
+################################################################################
+# Bug#19855907 IO THREAD AUTHENTICATION ISSUE WITH SOME CHARACTER SETS
+# Problem: IO thread fails to connect to master if servers are configured with
+# special character sets like utf16, utf32, ucs2.
+#
+# Analysis: MySQL server does not support few special character sets like
+# utf16,utf32 and ucs2 as "client's character set"(eg: utf16,utf32, ucs2).
+# When IO thread is trying to connect to Master, it sets server's character
+# set as client's character set. When Slave server is started with these
+# special character sets, IO thread (a connection to Master) fails because
+# of the above said reason.
+#
+# Fix: If server's character set is not supported as client's character set,
+# then set default's client character set(latin1) as client's character set.
+###############################################################################
+--source include/master-slave.inc
+call mtr.add_suppression("Cannot use utf16 as character_set_client");
+CREATE TABLE t1(i VARCHAR(20));
+INSERT INTO t1 VALUES (0xFFFF);
+--sync_slave_with_master
+--let diff_tables=master:t1, slave:t1
+--source include/diff_tables.inc
+# Cleanup
+--connection master
+DROP TABLE t1;
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_temp_table.test b/mysql-test/suite/rpl/t/rpl_temp_table.test
index 92f8cef9c10..8b3af5d51cd 100644
--- a/mysql-test/suite/rpl/t/rpl_temp_table.test
+++ b/mysql-test/suite/rpl/t/rpl_temp_table.test
@@ -57,12 +57,28 @@ select count(*) from t2;
select sum(n) from t2;
show status like 'Slave_open_temp_tables';
+--echo *** MDEV-8016: Replication aborts on DROP /*!40005 TEMPORARY */ TABLE IF EXISTS ***
+connect (master2,localhost,root,,);
+INSERT INTO t2 VALUES (2000), (2001);
+CREATE FUNCTION f() RETURNS INTEGER RETURN 1;
+CREATE TEMPORARY TABLE t3 AS SELECT f() AS col FROM t2;
+--let $gtid=`SELECT @@gtid_binlog_pos`
+--disconnect master2
+--connection default
+# Wait for implicit DROP TEMPORARY TABLE tmp to be binlogged.
+--let $wait_condition= SELECT @@gtid_binlog_pos != '$gtid'
+--source include/wait_condition.inc
+
+--sync_slave_with_master
+
+
#
# Clean up
#
connect (master2,localhost,root,,);
connection master2;
drop table if exists t1,t2;
+drop function f;
sync_slave_with_master;
diff --git a/mysql-test/suite/rpl/t/rpl_tmp_table_and_DDL.test b/mysql-test/suite/rpl/t/rpl_tmp_table_and_DDL.test
index e9cc098857e..bc4119f332f 100644
--- a/mysql-test/suite/rpl/t/rpl_tmp_table_and_DDL.test
+++ b/mysql-test/suite/rpl/t/rpl_tmp_table_and_DDL.test
@@ -150,6 +150,16 @@ DROP USER test_3@localhost;
INSERT INTO t2 VALUES ("DROP USER test_3@localhost with table locked");
UNLOCK TABLE;
+
+# Bug #20439913 CREATE TABLE DB.TABLE LIKE TMPTABLE IS
+# BINLOGGED INCORRECTLY - BREAKS A SLAVE
+CREATE DATABASE db;
+CREATE TABLE db.t1 LIKE t2;
+CREATE TABLE t3 LIKE t2;
+DROP TABLE t3;
+DROP DATABASE db;
+# end of Bug #20439913 test
+
DROP USER test_3@localhost;
DROP FUNCTION f2;
DROP PROCEDURE p2;
diff --git a/mysql-test/suite/rpl/t/rpl_trigger.test b/mysql-test/suite/rpl/t/rpl_trigger.test
index 723fa3e44e2..e062e821a25 100644
--- a/mysql-test/suite/rpl/t/rpl_trigger.test
+++ b/mysql-test/suite/rpl/t/rpl_trigger.test
@@ -533,6 +533,19 @@ drop table t1, log;
sync_slave_with_master;
#
+# MDEV-6769 DROP TRIGGER IF NOT EXIST binlogged on master but not on slave
+#
+let $slave_pos= query_get_value(SHOW MASTER STATUS, Position, 1);
+connection master;
+let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
+drop trigger if exists notexistent;
+source include/show_binlog_events.inc;
+sync_slave_with_master;
+let $binlog_start= $slave_pos;
+source include/show_binlog_events.inc;
+connection master;
+
+#
# End of tests
#
--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/sec_behind_master-5114.test b/mysql-test/suite/rpl/t/sec_behind_master-5114.test
new file mode 100644
index 00000000000..8c70da4f0a8
--- /dev/null
+++ b/mysql-test/suite/rpl/t/sec_behind_master-5114.test
@@ -0,0 +1,27 @@
+source include/master-slave.inc;
+source include/have_binlog_format_statement.inc;
+
+call mtr.add_suppression("Unsafe statement written to the binary log");
+
+CREATE TABLE t1 (a int);
+send INSERT INTO t1 VALUES(SLEEP(2));
+
+connection slave;
+let $run = 10;
+while ($run)
+{
+ dec $run;
+ let $sbm=query_get_value(SHOW SLAVE STATUS, Seconds_Behind_Master, 1);
+ # for debugging uncomment echo and remove the if()
+ #echo Seconds_Behind_Master: $sbm;
+ if ($sbm)
+ {
+ let $run = 0;
+ }
+ sleep 0.5;
+}
+echo Seconds_Behind_Master: $sbm;
+connection master;
+reap;
+drop table t1;
+source include/rpl_end.inc;
diff --git a/mysql-test/suite/rpl/t/semisync_future-7591.test b/mysql-test/suite/rpl/t/semisync_future-7591.test
new file mode 100644
index 00000000000..772a36b5632
--- /dev/null
+++ b/mysql-test/suite/rpl/t/semisync_future-7591.test
@@ -0,0 +1,31 @@
+--source include/have_semisync.inc
+--source include/master-slave.inc
+
+call mtr.add_suppression("Timeout waiting for reply of binlog*");
+create table t1 (i int);
+
+set global rpl_semi_sync_master_enabled = ON;
+
+--connection slave
+--source include/stop_slave.inc
+set global rpl_semi_sync_slave_enabled = ON;
+change master to master_log_file='master-bin.000002', master_log_pos = 320;
+
+start slave;
+--let $slave_io_errno=1236
+--source include/wait_for_slave_io_error.inc
+
+--connection master
+insert into t1 values (1);
+reset master;
+
+--connection slave
+--source include/stop_slave.inc
+reset slave;
+--source include/start_slave.inc
+
+set global rpl_semi_sync_slave_enabled = OFF;
+--connection master
+drop table t1;
+set global rpl_semi_sync_master_enabled = OFF;
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/show_status_stop_slave_race-7126.test b/mysql-test/suite/rpl/t/show_status_stop_slave_race-7126.test
new file mode 100644
index 00000000000..38759c9b16a
--- /dev/null
+++ b/mysql-test/suite/rpl/t/show_status_stop_slave_race-7126.test
@@ -0,0 +1,19 @@
+#
+# MDEV-7126 replication slave - deadlock in terminate_slave_thread with stop slave and show variables of replication filters and show global status
+#
+--source include/master-slave.inc
+
+--connection slave
+
+# If everything is okay, the test will end in several seconds; maybe a minute.
+# If the problem shows up, it will hang until testcase timeout is exceeded.
+--exec $MYSQL_SLAP --silent --socket=$SLAVE_MYSOCK -q "START SLAVE; STOP SLAVE; SHOW GLOBAL STATUS" -c 2 --number-of-queries=100 --create-schema=test
+
+# All done.
+
+--connection slave
+start slave;
+
+--connection master
+--source include/rpl_end.inc
+
diff --git a/mysql-test/suite/stress/t/ddl_archive.test b/mysql-test/suite/stress/t/ddl_archive.test
index 0c47b5fcdd5..c688ae192d0 100644
--- a/mysql-test/suite/stress/t/ddl_archive.test
+++ b/mysql-test/suite/stress/t/ddl_archive.test
@@ -12,11 +12,8 @@
--source include/have_archive.inc
let $engine_type= ARCHIVE;
+--source include/no_protocol.inc
-if (`SELECT $PS_PROTOCOL + $SP_PROTOCOL + $CURSOR_PROTOCOL + $VIEW_PROTOCOL > 0`)
-{
- --skip Test requires: ps-protocol/sp-protocol/cursor-protocol/view-protocol disabled
-}
let $run= `SELECT '$BIG_TEST' = '1'`;
if ($run)
{
diff --git a/mysql-test/suite/stress/t/ddl_csv.test b/mysql-test/suite/stress/t/ddl_csv.test
index 9f6185c76be..3e0f8acb1d8 100644
--- a/mysql-test/suite/stress/t/ddl_csv.test
+++ b/mysql-test/suite/stress/t/ddl_csv.test
@@ -12,11 +12,8 @@
--source include/have_csv.inc
let $engine_type= CSV;
+--source include/no_protocol.inc
-if (`SELECT $PS_PROTOCOL + $SP_PROTOCOL + $CURSOR_PROTOCOL + $VIEW_PROTOCOL > 0`)
-{
- --skip Test requires: ps-protocol/sp-protocol/cursor-protocol/view-protocol disabled
-}
let $run= `SELECT '$BIG_TEST' = '1'`;
if ($run)
{
diff --git a/mysql-test/suite/stress/t/ddl_innodb.test b/mysql-test/suite/stress/t/ddl_innodb.test
index 784ba8ff003..083ec43e7d7 100644
--- a/mysql-test/suite/stress/t/ddl_innodb.test
+++ b/mysql-test/suite/stress/t/ddl_innodb.test
@@ -12,11 +12,8 @@
--source include/have_innodb.inc
let $engine_type= InnoDB;
+--source include/no_protocol.inc
-if (`SELECT $PS_PROTOCOL + $SP_PROTOCOL + $CURSOR_PROTOCOL + $VIEW_PROTOCOL > 0`)
-{
- --skip Test requires: ps-protocol/sp-protocol/cursor-protocol/view-protocol disabled
-}
let $run= `SELECT '$BIG_TEST' = '1'`;
if ($run)
{
diff --git a/mysql-test/suite/stress/t/ddl_memory.test b/mysql-test/suite/stress/t/ddl_memory.test
index 5178439bff1..bcca77a74d9 100644
--- a/mysql-test/suite/stress/t/ddl_memory.test
+++ b/mysql-test/suite/stress/t/ddl_memory.test
@@ -11,11 +11,8 @@
# Storage engine to be used in CREATE TABLE
let $engine_type= MEMORY;
+--source include/no_protocol.inc
-if (`SELECT $PS_PROTOCOL + $SP_PROTOCOL + $CURSOR_PROTOCOL + $VIEW_PROTOCOL > 0`)
-{
- --skip Test requires: ps-protocol/sp-protocol/cursor-protocol/view-protocol disabled
-}
let $run= `SELECT '$BIG_TEST' = '1'`;
if ($run)
{
diff --git a/mysql-test/suite/stress/t/ddl_myisam.test b/mysql-test/suite/stress/t/ddl_myisam.test
index 8d6226e573b..a9b14690c42 100644
--- a/mysql-test/suite/stress/t/ddl_myisam.test
+++ b/mysql-test/suite/stress/t/ddl_myisam.test
@@ -11,11 +11,8 @@
# Storage engine to be used in CREATE TABLE
let $engine_type= MyISAM;
+--source include/no_protocol.inc
-if (`SELECT $PS_PROTOCOL + $SP_PROTOCOL + $CURSOR_PROTOCOL + $VIEW_PROTOCOL > 0`)
-{
- --skip Test requires: ps-protocol/sp-protocol/cursor-protocol/view-protocol disabled
-}
let $run= `SELECT '$BIG_TEST' = '1'`;
if ($run)
{
diff --git a/mysql-test/suite/sys_vars/r/all_vars.result b/mysql-test/suite/sys_vars/r/all_vars.result
index 1bd4e394f6a..7f75b731255 100644
--- a/mysql-test/suite/sys_vars/r/all_vars.result
+++ b/mysql-test/suite/sys_vars/r/all_vars.result
@@ -10,5 +10,6 @@ there should be *no* long test name listed below:
select distinct variable_name as `there should be *no* variables listed below:` from t2
left join t1 on variable_name=test_name where test_name is null;
there should be *no* variables listed below:
+max_digest_length
drop table t1;
drop table t2;
diff --git a/mysql-test/suite/sys_vars/r/slave_parallel_threads_basic.result b/mysql-test/suite/sys_vars/r/slave_parallel_threads_basic.result
index 2956d04c065..56aa5976f91 100644
--- a/mysql-test/suite/sys_vars/r/slave_parallel_threads_basic.result
+++ b/mysql-test/suite/sys_vars/r/slave_parallel_threads_basic.result
@@ -1,13 +1,22 @@
SET @save_slave_parallel_threads= @@GLOBAL.slave_parallel_threads;
-SELECT @@GLOBAL.slave_parallel_threads as 'must be zero because of default';
-must be zero because of default
-0
+SELECT IF(COUNT(*) < 20, "OK", CONCAT("Found too many system user processes: ", COUNT(*))) FROM information_schema.processlist WHERE user = "system user";
+IF(COUNT(*) < 20, "OK", CONCAT("Found too many system user processes: ", COUNT(*)))
+OK
+SELECT @@GLOBAL.slave_parallel_threads as 'must be 20 because of .cnf';
+must be 20 because of .cnf
+20
SELECT @@SESSION.slave_parallel_threads as 'no session var';
ERROR HY000: Variable 'slave_parallel_threads' is a GLOBAL variable
SET GLOBAL slave_parallel_threads= 0;
SET GLOBAL slave_parallel_threads= DEFAULT;
+SELECT @@GLOBAL.slave_parallel_threads as 'must be 0 because of default';
+must be 0 because of default
+0
SET GLOBAL slave_parallel_threads= 10;
SELECT @@GLOBAL.slave_parallel_threads;
@@GLOBAL.slave_parallel_threads
10
+SELECT IF(COUNT(*) < 10, "OK", CONCAT("Found too many system user processes: ", COUNT(*))) FROM information_schema.processlist WHERE user = "system user";
+IF(COUNT(*) < 10, "OK", CONCAT("Found too many system user processes: ", COUNT(*)))
+OK
SET GLOBAL slave_parallel_threads = @save_slave_parallel_threads;
diff --git a/mysql-test/suite/sys_vars/r/transaction_alloc_block_size_basic.result b/mysql-test/suite/sys_vars/r/transaction_alloc_block_size_basic.result
index a7afc334ba1..719adb67573 100644
--- a/mysql-test/suite/sys_vars/r/transaction_alloc_block_size_basic.result
+++ b/mysql-test/suite/sys_vars/r/transaction_alloc_block_size_basic.result
@@ -41,23 +41,11 @@ Warning 1292 Truncated incorrect transaction_alloc_block_size value: '60020'
SELECT @@global.transaction_alloc_block_size;
@@global.transaction_alloc_block_size
59392
-SET @@global.transaction_alloc_block_size = 4294967295;
-Warnings:
-Warning 1292 Truncated incorrect transaction_alloc_block_size value: '4294967295'
-SELECT @@global.transaction_alloc_block_size;
-@@global.transaction_alloc_block_size
-4294966272
'#--------------------FN_DYNVARS_005_04-------------------------#'
SET @@session.transaction_alloc_block_size = 1024;
SELECT @@session.transaction_alloc_block_size;
@@session.transaction_alloc_block_size
1024
-SET @@session.transaction_alloc_block_size =4294967295;
-Warnings:
-Warning 1292 Truncated incorrect transaction_alloc_block_size value: '4294967295'
-SELECT @@session.transaction_alloc_block_size;
-@@session.transaction_alloc_block_size
-4294966272
SET @@session.transaction_alloc_block_size = 65535;
Warnings:
Warning 1292 Truncated incorrect transaction_alloc_block_size value: '65535'
@@ -77,12 +65,12 @@ Warning 1292 Truncated incorrect transaction_alloc_block_size value: '-1024'
SELECT @@global.transaction_alloc_block_size;
@@global.transaction_alloc_block_size
1024
-SET @@global.transaction_alloc_block_size = 123456789201;
+SET @@global.transaction_alloc_block_size = 135217728;
Warnings:
-Warning 1292 Truncated incorrect transaction_alloc_block_size value: '123456789201'
+Warning 1292 Truncated incorrect transaction_alloc_block_size value: '135217728'
SELECT @@global.transaction_alloc_block_size;
@@global.transaction_alloc_block_size
-4294966272
+134217728
SET @@global.transaction_alloc_block_size = ON;
ERROR 42000: Incorrect argument type to variable 'transaction_alloc_block_size'
SET @@global.transaction_alloc_block_size = OFF;
@@ -109,12 +97,12 @@ Warning 1292 Truncated incorrect transaction_alloc_block_size value: '1000'
SELECT @@global.transaction_alloc_block_size;
@@global.transaction_alloc_block_size
1024
-SET @@session.transaction_alloc_block_size = 12345678901;
+SET @@session.transaction_alloc_block_size = 135217728;
Warnings:
-Warning 1292 Truncated incorrect transaction_alloc_block_size value: '12345678901'
+Warning 1292 Truncated incorrect transaction_alloc_block_size value: '135217728'
SELECT @@session.transaction_alloc_block_size;
@@session.transaction_alloc_block_size
-4294966272
+134217728
SET @@session.transaction_alloc_block_size = ON;
ERROR 42000: Incorrect argument type to variable 'transaction_alloc_block_size'
SET @@session.transaction_alloc_block_size = OFF;
@@ -149,9 +137,7 @@ WHERE VARIABLE_NAME='transaction_alloc_block_size';
1
'#---------------------FN_DYNVARS_001_08----------------------#'
SET @@transaction_alloc_block_size = 1024;
-SET @@global.transaction_alloc_block_size = 4294967295;
-Warnings:
-Warning 1292 Truncated incorrect transaction_alloc_block_size value: '4294967295'
+SET @@global.transaction_alloc_block_size = 134217728;
SELECT @@transaction_alloc_block_size = @@global.transaction_alloc_block_size;
@@transaction_alloc_block_size = @@global.transaction_alloc_block_size
0
diff --git a/mysql-test/suite/sys_vars/r/transaction_prealloc_size_basic.result b/mysql-test/suite/sys_vars/r/transaction_prealloc_size_basic.result
index cbd25426408..be54302689d 100644
--- a/mysql-test/suite/sys_vars/r/transaction_prealloc_size_basic.result
+++ b/mysql-test/suite/sys_vars/r/transaction_prealloc_size_basic.result
@@ -109,6 +109,12 @@ SELECT @@session.transaction_prealloc_size;
1024
SET @@session.transaction_prealloc_size = "Test";
ERROR 42000: Incorrect argument type to variable 'transaction_prealloc_size'
+SET @@session.transaction_prealloc_size = 135217728;
+Warnings:
+Warning 1292 Truncated incorrect transaction_prealloc_size value: '135217728'
+SELECT @@session.transaction_prealloc_size;
+@@session.transaction_prealloc_size
+134217728
'#------------------FN_DYNVARS_005_06-----------------------#'
SELECT @@global.transaction_prealloc_size = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
@@ -128,7 +134,7 @@ Warnings:
Warning 1292 Truncated incorrect transaction_prealloc_size value: '10'
SELECT @@transaction_prealloc_size = @@global.transaction_prealloc_size;
@@transaction_prealloc_size = @@global.transaction_prealloc_size
-1
+0
'#---------------------FN_DYNVARS_001_10----------------------#'
SET @@transaction_prealloc_size = 100;
Warnings:
diff --git a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_evict_basic.test b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_evict_basic.test
index f988292b21e..11634e1e0c7 100644
--- a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_evict_basic.test
+++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_evict_basic.test
@@ -2,11 +2,6 @@
# This is a debug variable for now
-- source include/have_debug.inc
-if (`select plugin_auth_version <= "5.6.10" from information_schema.plugins where plugin_name='innodb'`)
-{
- --skip Not fixed in InnoDB 5.6.10 or earlier
-}
-
SELECT @@global.innodb_buffer_pool_evict;
SET GLOBAL innodb_buffer_pool_evict = 'uncompressed';
diff --git a/mysql-test/suite/sys_vars/t/innodb_thread_sleep_delay_basic.test b/mysql-test/suite/sys_vars/t/innodb_thread_sleep_delay_basic.test
index 782fb475140..85ae2358db5 100644
--- a/mysql-test/suite/sys_vars/t/innodb_thread_sleep_delay_basic.test
+++ b/mysql-test/suite/sys_vars/t/innodb_thread_sleep_delay_basic.test
@@ -1,8 +1,3 @@
-if (`select plugin_auth_version <= "5.5.37-MariaDB-34.0" from information_schema.plugins where plugin_name='innodb'`)
-{
- --skip Not fixed in XtraDB as of 5.5.37-MariaDB-34.0 or earlier
-}
-
#
# 2010-01-27 - Added
#
diff --git a/mysql-test/suite/sys_vars/t/slave_parallel_threads_basic.cnf b/mysql-test/suite/sys_vars/t/slave_parallel_threads_basic.cnf
new file mode 100644
index 00000000000..02bdb44e1de
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/slave_parallel_threads_basic.cnf
@@ -0,0 +1,5 @@
+# Use default setting for mysqld processes
+!include include/default_mysqld.cnf
+
+[mysqld.1]
+slave_parallel_threads=20
diff --git a/mysql-test/suite/sys_vars/t/slave_parallel_threads_basic.test b/mysql-test/suite/sys_vars/t/slave_parallel_threads_basic.test
index 8e987489d86..b567b7f8854 100644
--- a/mysql-test/suite/sys_vars/t/slave_parallel_threads_basic.test
+++ b/mysql-test/suite/sys_vars/t/slave_parallel_threads_basic.test
@@ -2,13 +2,20 @@
SET @save_slave_parallel_threads= @@GLOBAL.slave_parallel_threads;
-SELECT @@GLOBAL.slave_parallel_threads as 'must be zero because of default';
+# Check that we don't spawn worker threads at server startup, when no
+# slave is configured (MDEV-5289).
+SELECT IF(COUNT(*) < 20, "OK", CONCAT("Found too many system user processes: ", COUNT(*))) FROM information_schema.processlist WHERE user = "system user";
+
+SELECT @@GLOBAL.slave_parallel_threads as 'must be 20 because of .cnf';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@SESSION.slave_parallel_threads as 'no session var';
SET GLOBAL slave_parallel_threads= 0;
SET GLOBAL slave_parallel_threads= DEFAULT;
+SELECT @@GLOBAL.slave_parallel_threads as 'must be 0 because of default';
SET GLOBAL slave_parallel_threads= 10;
SELECT @@GLOBAL.slave_parallel_threads;
+# Check that we don't spawn worker threads when no slave is started.
+SELECT IF(COUNT(*) < 10, "OK", CONCAT("Found too many system user processes: ", COUNT(*))) FROM information_schema.processlist WHERE user = "system user";
SET GLOBAL slave_parallel_threads = @save_slave_parallel_threads;
diff --git a/mysql-test/suite/sys_vars/t/transaction_alloc_block_size_basic.test b/mysql-test/suite/sys_vars/t/transaction_alloc_block_size_basic.test
index 4a69bbcdb01..0faa95c8fe6 100644
--- a/mysql-test/suite/sys_vars/t/transaction_alloc_block_size_basic.test
+++ b/mysql-test/suite/sys_vars/t/transaction_alloc_block_size_basic.test
@@ -5,7 +5,7 @@
# Access Type: Dynamic #
# Data Type: numeric #
# Default Value: 8192 #
-# Range: 1024-4294967295 #
+# Range: 1024-134217728 #
# #
# #
# Creation Date: 2008-02-14 #
@@ -80,9 +80,6 @@ SELECT @@global.transaction_alloc_block_size;
SET @@global.transaction_alloc_block_size = 60020;
SELECT @@global.transaction_alloc_block_size;
-SET @@global.transaction_alloc_block_size = 4294967295;
-SELECT @@global.transaction_alloc_block_size;
-
--echo '#--------------------FN_DYNVARS_005_04-------------------------#'
###################################################################
# Change the value of variable to a valid value for SESSION Scope #
@@ -91,9 +88,6 @@ SELECT @@global.transaction_alloc_block_size;
SET @@session.transaction_alloc_block_size = 1024;
SELECT @@session.transaction_alloc_block_size;
-SET @@session.transaction_alloc_block_size =4294967295;
-SELECT @@session.transaction_alloc_block_size;
-
SET @@session.transaction_alloc_block_size = 65535;
SELECT @@session.transaction_alloc_block_size;
@@ -110,7 +104,7 @@ SET @@global.transaction_alloc_block_size = -1024;
SELECT @@global.transaction_alloc_block_size;
-SET @@global.transaction_alloc_block_size = 123456789201;
+SET @@global.transaction_alloc_block_size = 135217728;
SELECT @@global.transaction_alloc_block_size;
-- Error ER_WRONG_TYPE_FOR_VAR
@@ -136,7 +130,7 @@ SET @@global.transaction_alloc_block_size ="Test";
SET @@global.transaction_alloc_block_size = 1000;
SELECT @@global.transaction_alloc_block_size;
-SET @@session.transaction_alloc_block_size = 12345678901;
+SET @@session.transaction_alloc_block_size = 135217728;
SELECT @@session.transaction_alloc_block_size;
-- Error ER_WRONG_TYPE_FOR_VAR
@@ -185,7 +179,7 @@ WHERE VARIABLE_NAME='transaction_alloc_block_size';
###########################################################################
SET @@transaction_alloc_block_size = 1024;
-SET @@global.transaction_alloc_block_size = 4294967295;
+SET @@global.transaction_alloc_block_size = 134217728;
SELECT @@transaction_alloc_block_size = @@global.transaction_alloc_block_size;
diff --git a/mysql-test/suite/sys_vars/t/transaction_prealloc_size_basic.test b/mysql-test/suite/sys_vars/t/transaction_prealloc_size_basic.test
index 5eabf457a0c..9d0c20a37b4 100644
--- a/mysql-test/suite/sys_vars/t/transaction_prealloc_size_basic.test
+++ b/mysql-test/suite/sys_vars/t/transaction_prealloc_size_basic.test
@@ -5,7 +5,7 @@
# Access Type: Dynamic #
# Data Type: numeric #
# Default Value: 4096 #
-# Range: #
+# Range: 1024-134217728 #
# #
# #
# Creation Date: 2008-02-14 #
@@ -137,6 +137,10 @@ SELECT @@session.transaction_prealloc_size;
--Error ER_WRONG_TYPE_FOR_VAR
SET @@session.transaction_prealloc_size = "Test";
+SET @@session.transaction_prealloc_size = 135217728;
+SELECT @@session.transaction_prealloc_size;
+
+
--echo '#------------------FN_DYNVARS_005_06-----------------------#'
####################################################################
# Check if the value in GLOBAL Table matches value in variable #
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test
index 416c73009e6..cbb73bbb3d4 100644
--- a/mysql-test/t/alter_table.test
+++ b/mysql-test/t/alter_table.test
@@ -1326,6 +1326,14 @@ SHOW CREATE TABLE t2;
DROP TABLE t2;
DROP TABLE t1;
+CREATE TABLE t1 (
+ `transaction_id` int(11) NOT NULL DEFAULT '0',
+ KEY `transaction_id` (`transaction_id`));
+ALTER TABLE t1 DROP KEY IF EXISTS transaction_id, ADD PRIMARY KEY IF NOT EXISTS (transaction_id);
+SHOW CREATE TABLE t1;
+
+DROP TABLE t1;
+
--echo # Bug#11748057 (formerly known as 34972): ALTER TABLE statement doesn't
--echo # identify correct column name.
--echo #
diff --git a/mysql-test/t/alter_table_online.test b/mysql-test/t/alter_table_online.test
index be8037abe11..20dbfe9c46a 100644
--- a/mysql-test/t/alter_table_online.test
+++ b/mysql-test/t/alter_table_online.test
@@ -7,7 +7,7 @@
drop table if exists t1,t2,t3;
--enable_warnings
#
-# Test of things that can be done online
+# Test of things that can not be done online
#
create table t1 (a int not null primary key, b int, c varchar(80), e enum('a','b'));
@@ -24,6 +24,13 @@ alter online table t1 comment "new comment";
--error ER_ALTER_OPERATION_NOT_SUPPORTED
alter online table t1 rename to t2;
+# No OPs
+
+alter online table t1 algorithm=INPLACE, lock=NONE;
+alter online table t1;
+alter table t1 algorithm=INPLACE;
+alter table t1 lock=NONE;
+
drop table t1;
#
diff --git a/mysql-test/t/blackhole.test b/mysql-test/t/blackhole.test
index 32d7d70200a..7f394e0f846 100644
--- a/mysql-test/t/blackhole.test
+++ b/mysql-test/t/blackhole.test
@@ -17,6 +17,16 @@ SELECT 1 FROM t1 WHERE a = ANY (SELECT a FROM t2);
DROP TABLE t1, t2;
+#
+# Bug#19786309 - CRASH IN UNLOCK TABLES AFTER LOCKING AND TRUNCATING TEMPORARY TABLE.
+#
+create temporary table t1 (a int) engine=blackhole;
+lock table t1 write;
+truncate table t1;
+select * from t1;
+unlock tables;
+drop temporary table t1;
+
--echo End of 5.5 tests
--echo #
diff --git a/mysql-test/t/bootstrap.test b/mysql-test/t/bootstrap.test
index 2c6040af7a1..97376eb7412 100644
--- a/mysql-test/t/bootstrap.test
+++ b/mysql-test/t/bootstrap.test
@@ -60,3 +60,32 @@ SELECT 'bug' as '' FROM INFORMATION_SCHEMA.ENGINES WHERE engine='innodb'
and SUPPORT='YES';
--echo End of 5.5 tests
+
+--source include/not_windows_embedded.inc
+--source include/have_example_plugin.inc
+#
+# Check that --bootstrap can install and uninstall plugins
+#
+let $PLUGIN_DIR=`select @@plugin_dir`;
+--write_file $MYSQLTEST_VARDIR/tmp/install_plugin.sql
+install soname 'ha_example';
+uninstall plugin unusable;
+EOF
+--exec $MYSQLD_BOOTSTRAP_CMD --plugin-dir=$PLUGIN_DIR < $MYSQLTEST_VARDIR/tmp/install_plugin.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1
+--remove_file $MYSQLTEST_VARDIR/tmp/install_plugin.sql
+
+#
+# Check that installed plugins are *not* automatically loaded in --bootstrap
+#
+--write_file $MYSQLTEST_VARDIR/tmp/bootstrap_plugins.sql
+use test;
+create table t1(a int) engine=example;
+EOF
+--exec $MYSQLD_BOOTSTRAP_CMD --plugin-dir=$PLUGIN_DIR < $MYSQLTEST_VARDIR/tmp/bootstrap_plugins.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1
+--remove_file $MYSQLTEST_VARDIR/tmp/bootstrap_plugins.sql
+flush tables;
+show create table t1;
+drop table t1;
+--replace_result .dll .so
+select * from mysql.plugin;
+truncate table mysql.plugin;
diff --git a/mysql-test/t/bug46261-master.opt b/mysql-test/t/bug46261-master.opt
deleted file mode 100644
index 5699a3387b8..00000000000
--- a/mysql-test/t/bug46261-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---skip-grant-tables
diff --git a/mysql-test/t/bug46261.test b/mysql-test/t/bug46261.test
deleted file mode 100644
index 9d8eecf3d52..00000000000
--- a/mysql-test/t/bug46261.test
+++ /dev/null
@@ -1,16 +0,0 @@
---source include/not_embedded.inc
---source include/have_example_plugin.inc
-
---echo #
---echo # Bug#46261 Plugins can be installed with --skip-grant-tables
---echo #
-
---replace_regex /\.dll/.so/
---error ER_OPTION_PREVENTS_STATEMENT
-eval INSTALL PLUGIN example SONAME '$HA_EXAMPLE_SO';
-
---replace_regex /\.dll/.so/
---error ER_OPTION_PREVENTS_STATEMENT
-eval UNINSTALL PLUGIN example;
-
---echo End of 5.1 tests
diff --git a/mysql-test/t/ctype_binary.test b/mysql-test/t/ctype_binary.test
index 4a2646d1db5..3d3f90b444b 100644
--- a/mysql-test/t/ctype_binary.test
+++ b/mysql-test/t/ctype_binary.test
@@ -20,5 +20,10 @@ SET NAMES binary;
--source include/ctype_like_cond_propagation.inc
--echo #
+--echo # MDEV-7629 Regression: Bit and hex string literals changed column names in 10.0.14
+--echo #
+SELECT _binary 0x7E, _binary X'7E', _binary B'01111110';
+
+--echo #
--echo # End of 10.0 tests
--echo #
diff --git a/mysql-test/t/ctype_create.test b/mysql-test/t/ctype_create.test
index 060c09a0459..61fc5292094 100644
--- a/mysql-test/t/ctype_create.test
+++ b/mysql-test/t/ctype_create.test
@@ -105,3 +105,39 @@ ALTER DATABASE DEFAULT CHARACTER SET latin2;
ALTER DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa DEFAULT CHARACTER SET latin2;
--error 1102
ALTER DATABASE `` DEFAULT CHARACTER SET latin2;
+USE test;
+
+--echo #
+--echo # Start of 10.0 tests
+--echo #
+
+--echo #
+--echo # MDEV-7387 Alter table xxx CHARACTER SET utf8, CONVERT TO CHARACTER SET latin1 should fail
+--echo #
+--error ER_CONFLICTING_DECLARATIONS
+CREATE TABLE t1 (a VARCHAR(10)) CHARACTER SET DEFAULT, CHARACTER SET utf8;
+--error ER_CONFLICTING_DECLARATIONS
+CREATE TABLE t1 (a VARCHAR(10)) CHARACTER SET utf8, CHARACTER SET DEFAULT;
+CREATE TABLE t1 (a VARCHAR(10)) CHARACTER SET utf8, CHARACTER SET utf8;
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10)) CHARACTER SET DEFAULT, CHARACTER SET DEFAULT;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1, b VARCHAR(10) CHARACTER SET utf8);
+--error ER_CONFLICTING_DECLARATIONS
+ALTER TABLE t1 CONVERT TO CHARACTER SET utf8, CHARACTER SET latin1;
+--error ER_CONFLICTING_DECLARATIONS
+ALTER TABLE t1 CONVERT TO CHARACTER SET utf8, CHARACTER SET DEFAULT;
+--error ER_CONFLICTING_DECLARATIONS
+ALTER TABLE t1 CONVERT TO CHARACTER SET latin1, CHARACTER SET utf8;
+--error ER_CONFLICTING_DECLARATIONS
+ALTER TABLE t1 CONVERT TO CHARACTER SET latin1, CHARACTER SET DEFAULT;
+--error ER_CONFLICTING_DECLARATIONS
+ALTER TABLE t1 CONVERT TO CHARACTER SET DEFAULT, CHARACTER SET utf8;
+--error ER_CONFLICTING_DECLARATIONS
+ALTER TABLE t1 CONVERT TO CHARACTER SET DEFAULT, CHARACTER SET latin1;
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.0 tests
+--echo #
diff --git a/mysql-test/t/ctype_latin1.test b/mysql-test/t/ctype_latin1.test
index 336d8ca761d..aeaad2cc026 100644
--- a/mysql-test/t/ctype_latin1.test
+++ b/mysql-test/t/ctype_latin1.test
@@ -241,5 +241,10 @@ SELECT HEX(a),a FROM t1;
DROP TABLE t1;
--echo #
+--echo # MDEV-7629 Regression: Bit and hex string literals changed column names in 10.0.14
+--echo #
+SELECT _latin1 0x7E, _latin1 X'7E', _latin1 B'01111110';
+
+--echo #
--echo # End of 10.0 tests
--echo #
diff --git a/mysql-test/t/ctype_uca.test b/mysql-test/t/ctype_uca.test
index 95008d83a38..5e8195e4718 100644
--- a/mysql-test/t/ctype_uca.test
+++ b/mysql-test/t/ctype_uca.test
@@ -507,6 +507,17 @@ select * from t1 where c1 = '=> dž';
select * from t1 where concat(c1) = '=> dž';
drop table t1;
+
+--echo #
+--echo # MDEV-7649 wrong result when comparing utf8 column with an invalid literal
+--echo #
+
+SET NAMES utf8 COLLATE utf8_unicode_ci;
+--let ENGINE=MyISAM
+--source include/ctype_utf8_ilseq.inc
+--let ENGINE=HEAP
+--source include/ctype_utf8_ilseq.inc
+
--echo #
--echo # End of 5.5 tests
--echo #
diff --git a/mysql-test/t/ctype_uca_innodb.test b/mysql-test/t/ctype_uca_innodb.test
new file mode 100644
index 00000000000..cb6caff4a03
--- /dev/null
+++ b/mysql-test/t/ctype_uca_innodb.test
@@ -0,0 +1,25 @@
+#
+# Tests for UCA collations with InnoDB
+#
+
+let collation=utf8_unicode_ci;
+--source include/have_collation.inc
+--source include/have_innodb.inc
+
+
+--echo #
+--echo # Start of 5.5 tests
+--echo #
+
+
+--echo #
+--echo # MDEV-7649 wrong result when comparing utf8 column with an invalid literal
+--echo #
+
+SET NAMES utf8 COLLATE utf8_unicode_ci;
+--let ENGINE=InnoDB
+--source include/ctype_utf8_ilseq.inc
+
+--echo #
+--echo # End of 5.5 tests
+--echo #
diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test
index 1e9047cca8e..fcd19c112e9 100644
--- a/mysql-test/t/ctype_utf8.test
+++ b/mysql-test/t/ctype_utf8.test
@@ -1616,6 +1616,42 @@ UNION ALL
SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1;
--echo #
+--echo # MDEV-7814 Assertion `args[0]->fixed' fails in Item_func_conv_charset::Item_func_conv_charset
+--echo #
+CREATE TABLE t1(a CHAR(1) CHARACTER SET latin1, b INT NOT NULL);
+CREATE TABLE t2(a CHAR(1) CHARACTER SET utf8 COLLATE utf8_general_ci, b INT NOT NULL);
+SELECT (SELECT t2.a FROM t2 WHERE t2.a=t1.a) AS aa, b, COUNT(b) FROM t1 GROUP BY aa;
+DROP TABLE t1,t2;
+
+--echo #
+--echo # MDEV-7649 wrong result when comparing utf8 column with an invalid literal
+--echo #
+
+SET NAMES utf8 COLLATE utf8_general_ci;
+--let ENGINE=InnoDB
+--source include/ctype_utf8_ilseq.inc
+--let ENGINE=MyISAM
+--source include/ctype_utf8_ilseq.inc
+--let ENGINE=HEAP
+--source include/ctype_utf8_ilseq.inc
+
+--echo #
+--echo # MDEV-8067 correct fix for MySQL Bug # 19699237: UNINITIALIZED VARIABLE IN ITEM_FIELD::STR_RESULT
+--echo #
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8);
+CREATE TABLE t2 (a VARCHAR(10) CHARACTER SET latin1);
+INSERT INTO t1 VALUES ('aaa');
+INSERT INTO t2 VALUES ('aaa');
+SELECT (SELECT CONCAT(a),1 FROM t1) <=> (SELECT CONCAT(a),1 FROM t2);
+INSERT INTO t1 VALUES ('aaa');
+INSERT INTO t2 VALUES ('aaa');
+# Running the below query crashed with two rows
+--error ER_SUBQUERY_NO_1_ROW
+SELECT (SELECT CONCAT(a),1 FROM t1) <=> (SELECT CONCAT(a),1 FROM t2);
+DROP TABLE t1, t2;
+
+
+--echo #
--echo # End of 5.5 tests
--echo #
@@ -1744,6 +1780,11 @@ EXECUTE stmt USING @b,@b;
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
+--echo #
+--echo # MDEV-7629 Regression: Bit and hex string literals changed column names in 10.0.14
+--echo #
+SELECT _utf8 0x7E, _utf8 X'7E', _utf8 B'01111110';
+
let $ctype_unescape_combinations=selected;
--source include/ctype_unescape.inc
diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test
index 61ae3695a1f..ddce7f55292 100644
--- a/mysql-test/t/derived.test
+++ b/mysql-test/t/derived.test
@@ -492,5 +492,17 @@ update t1 set balance=(select sum(balance) from (SELECT balance FROM t1 where ac
set optimizer_switch=@save_derived_optimizer_switch_bug;
drop table t1;
-
set optimizer_switch=@save_derived_optimizer_switch;
+
+--echo #
+--echo # MDEV-6892: WHERE does not apply
+--echo #
+create table t1 (id int);
+create table t2 (id int);
+insert into t1 values(1),(2),(3);
+insert into t2 values(4),(5),(6);
+#explain extended
+select x.id, message from (select id from t1) x left join
+(select id, 1 as message from t2) y on x.id=y.id
+where coalesce(message,0) <> 0;
+drop table t1,t2;
diff --git a/mysql-test/t/dyncol.test b/mysql-test/t/dyncol.test
index 65a94dcb49e..86dcee8148a 100644
--- a/mysql-test/t/dyncol.test
+++ b/mysql-test/t/dyncol.test
@@ -657,6 +657,13 @@ SELECT
select column_get(column_create(1, "18446744073709552001" as char), 1 as int);
--echo #
+--echo # MDEV-7505 - Too large scale in DECIMAL dynamic column getter crashes
+--echo # mysqld
+--echo #
+--error ER_TOO_BIG_SCALE
+SELECT COLUMN_GET(`x`, 'y' AS DECIMAL(5,34));
+
+--echo #
--echo # test of symbolic names
--echo #
--echo # creation test (names)
diff --git a/mysql-test/t/empty_server_name-8224.test b/mysql-test/t/empty_server_name-8224.test
new file mode 100644
index 00000000000..528bce5dac5
--- /dev/null
+++ b/mysql-test/t/empty_server_name-8224.test
@@ -0,0 +1,9 @@
+#
+# MDEV-8224 Server crashes in get_server_from_table_to_cache on empty name
+#
+--source include/not_embedded.inc
+create server '' foreign data wrapper w2 options (host '127.0.0.1');
+--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--shutdown_server 10
+--source include/wait_until_disconnected.inc
+--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
diff --git a/mysql-test/t/error_simulation-master.opt b/mysql-test/t/error_simulation-master.opt
new file mode 100644
index 00000000000..c9f8d7bd0c0
--- /dev/null
+++ b/mysql-test/t/error_simulation-master.opt
@@ -0,0 +1 @@
+--tmpdir=$MYSQLTEST_VARDIR/tmp
diff --git a/mysql-test/t/error_simulation.test b/mysql-test/t/error_simulation.test
index 58ead1e3ced..7c343ed6566 100644
--- a/mysql-test/t/error_simulation.test
+++ b/mysql-test/t/error_simulation.test
@@ -1,4 +1,5 @@
-- source include/have_debug.inc
+--source include/not_embedded.inc
#
# Bug #28499: crash for grouping query when tmp_table_size is too small
@@ -112,3 +113,38 @@ DROP TABLE t1,t2;
--echo #
--echo # End of 5.1 tests
--echo #
+
+
+--echo #
+--echo # BUG#11747548:DETECT ORPHAN TEMP-POOL FILES, AND HANDLE GRACEFULLY.
+--echo #
+
+--echo #Set up.
+CREATE TABLE pid_table(pid_no INT);
+CREATE TABLE t1 (a BLOB);
+INSERT INTO t1 VALUES (1), (2);
+
+--echo #Create MYD and MYI files for intrinsic temp table.
+--let $pid_file=`SELECT @@pid_file`
+--replace_result $pid_file pid_file
+--eval LOAD DATA LOCAL INFILE '$pid_file' INTO TABLE pid_table
+--let $temp_file= `SELECT CONCAT('#sql_', LCASE(HEX(pid_no)), '_0') FROM pid_table`
+--write_file $MYSQLTEST_VARDIR/tmp/$temp_file.MYD
+EOF
+--write_file $MYSQLTEST_VARDIR/tmp/$temp_file.MYI
+EOF
+--write_file $MYSQLTEST_VARDIR/tmp/$temp_file.MAD
+EOF
+--write_file $MYSQLTEST_VARDIR/tmp/$temp_file.MAI
+EOF
+
+--echo #Reports an error since the temp file already exists.
+--replace_regex /.*Can't create\/write *.*/Can't create or write to file/
+#--error 1
+SELECT a FROM t1 ORDER BY rand(1);
+
+--echo #With patch, the query executes successfully.
+SELECT a FROM t1 ORDER BY rand(1);
+
+--echo #cleanup
+DROP TABLE t1, pid_table;
diff --git a/mysql-test/t/explain_non_select.test b/mysql-test/t/explain_non_select.test
index f05373c312e..e36fd518b61 100644
--- a/mysql-test/t/explain_non_select.test
+++ b/mysql-test/t/explain_non_select.test
@@ -197,4 +197,14 @@ select 'OK';
drop function f1;
drop table t1;
+--echo #
+--echo # MDEV-7038: Assertion `status_var.memory_used == 0' failed in THD::~THD()
+--echo # on disconnect after executing EXPLAIN for multi-table UPDATE
+--echo #
+CREATE TABLE t1 (a INT);
+CREATE VIEW v1 AS SELECT * FROM t1;
+INSERT INTO t1 VALUES (1),(2);
+EXPLAIN UPDATE v1, mysql.user SET v1.a = v1.a + 1;
+DROP TABLE t1;
+DROP VIEW v1;
diff --git a/mysql-test/t/file_contents.test b/mysql-test/t/file_contents.test
index f52f0a93c82..186394df4e3 100644
--- a/mysql-test/t/file_contents.test
+++ b/mysql-test/t/file_contents.test
@@ -17,7 +17,7 @@ if ($dir_bin eq '/usr/') {
$dir_docs =~ s|/lib|/share/doc|;
if(-d "$dir_docs/packages") {
# SuSE: "packages/" in the documentation path
- $dir_docs = glob "$dir_docs/packages/MySQL-server*";
+ $dir_docs = glob "$dir_docs/packages/*-server*";
} else {
# RedHat: version number in directory name
$dir_docs = glob "$dir_docs/MySQL-server*";
@@ -27,7 +27,7 @@ if ($dir_bin eq '/usr/') {
$dir_docs = "$dir_bin/share/doc";
if(-d "$dir_docs/packages") {
# SuSE: "packages/" in the documentation path
- $dir_docs = glob "$dir_docs/packages/MySQL-server*";
+ $dir_docs = glob "$dir_docs/packages/*-server*";
} else {
# RedHat/Debian: version number in directory name
$dir_docs = glob "$dir_docs/mariadb-server-*";
@@ -36,7 +36,7 @@ if ($dir_bin eq '/usr/') {
# Slackware
$dir_docs = glob "$dir_bin/doc/mariadb-[0-9]*" unless -d $dir_docs;
} else {
- # tar.gz package, Windows, or developer work (in BZR)
+ # tar.gz package, Windows, or developer work (in git)
$dir_docs = $dir_bin;
if(-d "$dir_docs/docs") {
$dir_docs = "$dir_docs/docs"; # package
@@ -49,7 +49,7 @@ $found_revision = "No line 'revision-id: .....' in $dir_docs/INFO_SRC";
open(I_SRC,"<","$dir_docs/INFO_SRC") or print "Cannot open 'INFO_SRC' in '$dir_docs' (starting from bindir '$dir_bin')\n";
while(defined ($line = <I_SRC>)) {
if ($line =~ m|^MySQL source \d+\.\d\.\d+|) {$found_version = "Found MySQL version number";}
- if ($line =~ m|^revision-id: .*@.*-2\d{13}-\w+$|) {$found_revision = "Found BZR revision id";}
+ if ($line =~ m|^commit: \w{40}$|) {$found_revision = "Found GIT revision id";}
}
close I_SRC;
print "INFO_SRC: $found_version / $found_revision\n";
diff --git a/mysql-test/t/filesort_bad_i_s-7585.test b/mysql-test/t/filesort_bad_i_s-7585.test
new file mode 100644
index 00000000000..daf70acdd52
--- /dev/null
+++ b/mysql-test/t/filesort_bad_i_s-7585.test
@@ -0,0 +1,14 @@
+#
+# MDEV-7585 Assertion `thd->is_error() || kill_errno || thd->killed == ABORT_QUERY' failed in ha_rows filesort
+#
+SET sql_mode=STRICT_TRANS_TABLES;
+
+CREATE TABLE t0 (i INT) ENGINE=MyISAM;
+CREATE VIEW v1 AS SELECT * FROM t0;
+CREATE VIEW v2 AS SELECT * FROM v1;
+DROP VIEW IF EXISTS v1;
+
+CREATE TABLE t1 (i INT) ENGINE=MyISAM;
+INSERT INTO t1 SELECT TABLE_ROWS FROM information_schema.tables ORDER BY TABLE_ROWS;
+DROP VIEW v2;
+DROP TABLE t1, t0;
diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test
index 7643676ea61..42a30760a86 100644
--- a/mysql-test/t/func_gconcat.test
+++ b/mysql-test/t/func_gconcat.test
@@ -803,3 +803,21 @@ create table t1 (a char(1) character set utf8);
insert into t1 values ('a'),('b');
select 1 from t1 where a in (select group_concat(a) from t1);
drop table t1;
+
+#
+# MDEV-7820 Server crashes in in my_strcasecmp_utf8 on subquery in ORDER BY clause of GROUP_CONCAT
+#
+CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('a'),('b');
+
+CREATE TABLE t2 (f2 VARCHAR(10)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES ('c');
+
+CREATE TABLE t3 (f3 VARCHAR(10)) ENGINE=MyISAM;
+INSERT INTO t3 VALUES ('d'),('e');
+
+SELECT GROUP_CONCAT( f2 ORDER BY ( f2 IN ( SELECT f1 FROM t1 WHERE f1 <= f2 ) ) ) AS field
+FROM ( SELECT * FROM t2 ) AS sq2, t3
+ORDER BY field;
+
+drop table t3, t2, t1;
diff --git a/mysql-test/t/func_regexp_pcre.test b/mysql-test/t/func_regexp_pcre.test
index 6710f5cf096..c9b4c10007d 100644
--- a/mysql-test/t/func_regexp_pcre.test
+++ b/mysql-test/t/func_regexp_pcre.test
@@ -402,3 +402,27 @@ SET default_regex_flags=DEFAULT;
--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');
+
+--echo #
+--echo # MDEV-8102 REGEXP function fails to match hex values when expression is stored as a variable
+--echo #
+
+--echo # Testing a warning
+SET NAMES latin1;
+SET @regCheck= '\\xE0\\x01';
+SELECT 0xE001 REGEXP @regCheck;
+
+--echo # Testing workaround N1: This makes the pattern to be a binary string:
+SET NAMES latin1;
+SET @regCheck= X'E001';
+SELECT 0xE001 REGEXP @regCheck;
+
+--echo # Testing workaround N2: This also makes the pattern to be a binary string, using a different syntax:
+SET NAMES latin1;
+SET @regCheck= _binary '\\xE0\\x01';
+SELECT 0xE001 REGEXP @regCheck;
+
+--echo # Testing workarond N3: This makes derivation of the subject string stronger (IMLICIT instead of COERCIBLE)
+SET NAMES latin1;
+SET @regCheck= '\\xE0\\x01';
+SELECT CAST(0xE001 AS BINARY) REGEXP @regCheck;
diff --git a/mysql-test/t/func_regexp_pcre_debug.test b/mysql-test/t/func_regexp_pcre_debug.test
new file mode 100644
index 00000000000..c2581fa4110
--- /dev/null
+++ b/mysql-test/t/func_regexp_pcre_debug.test
@@ -0,0 +1,6 @@
+--source include/have_debug.inc
+
+SET debug_dbug='+d,pcre_exec_error_123';
+SELECT 'a' RLIKE 'a';
+SET debug_dbug='';
+SELECT 'a' RLIKE 'a';
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
index 2b189765bbc..3fb87e91b17 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -1649,3 +1649,44 @@ INSERT INTO t1 VALUES (17, NULL);
INSERT INTO t1 VALUES (18, '2010-10-13');
SELECT a.id,a.date1,FROM_DAYS(TO_DAYS(a.date1)-10) as date2, DATE_ADD(a.date1,INTERVAL -10 DAY),TO_DAYS(a.date1)-10 FROM t1 a ORDER BY a.id;
DROP TABLE t1;
+
+
+--echo #
+--echo # Start of 10.0 tests
+--echo #
+
+--echo #
+--echo # MDEV-8205 timediff returns null when comparing decimal time to time string value
+--echo #
+
+# 1h difference
+SELECT
+ TIMEDIFF('2014-01-01 00:00:00' , '2014-01-01 01:00:00' ) AS str_str,
+ TIMEDIFF('2014-01-01 00:00:00' , 20140101010000.000 ) AS str_dec,
+ TIMEDIFF(20140101000000.000 , 20140101010000.000 ) AS dec_dec,
+ TIMEDIFF(20140101000000.000 , '2014-01-01 01:00:00' ) AS dec_str;
+
+# 1D1h difference
+SELECT
+ TIMEDIFF('2014-01-01 00:00:00' , '2014-01-02 01:00:00' ) AS str_str,
+ TIMEDIFF('2014-01-01 00:00:00' , 20140102010000.000 ) AS str_dec,
+ TIMEDIFF(20140101000000.000 , 20140102010000.000 ) AS dec_dec,
+ TIMEDIFF(20140101000000.000 , '2014-01-02 01:00:00' ) AS dec_str;
+
+# 1M1D1h difference
+SELECT
+ TIMEDIFF('2014-01-01 00:00:00' , '2014-02-02 01:00:00' ) AS str_str,
+ TIMEDIFF('2014-01-01 00:00:00' , 20140202010000.000 ) AS str_dec,
+ TIMEDIFF(20140101000000.000 , 20140202010000.000 ) AS dec_dec,
+ TIMEDIFF(20140101000000.000 , '2014-02-02 01:00:00' ) AS dec_str;
+
+# 2M1D1h difference
+SELECT
+ TIMEDIFF('2014-01-01 00:00:00' , '2014-03-02 01:00:00' ) AS str_str,
+ TIMEDIFF('2014-01-01 00:00:00' , 20140302010000.000 ) AS str_dec,
+ TIMEDIFF(20140101000000.000 , 20140302010000.000 ) AS dec_dec,
+ TIMEDIFF(20140101000000.000 , '2014-03-02 01:00:00' ) AS dec_str;
+
+--echo #
+--echo # End of 10.0 tests
+--echo #
diff --git a/mysql-test/t/galera_sst_mode.test b/mysql-test/t/galera_sst_mode.test
deleted file mode 100644
index dd8f9531c9d..00000000000
--- a/mysql-test/t/galera_sst_mode.test
+++ /dev/null
@@ -1,43 +0,0 @@
-# Embedded server doesn't support external clients
---source include/not_embedded.inc
-# Binlog is required
---source include/have_log_bin.inc
-
---echo #
---echo # Test for mysqldump's galera-sst-mode option
---echo #
-
---echo #
---echo # MDEV-6490: mysqldump unknown option --galera-sst-mode
---echo #
-CREATE DATABASE bug6490;
-USE bug6490;
-CREATE TABLE t1(c1 INT);
-INSERT INTO t1 values (1);
-INSERT INTO t1 values (2);
-
---echo # Save the current gtid_binlog_state.
---let $before= `SELECT @@global.gtid_binlog_state`
-
---echo # Take a dump of bug6490 database
---exec $MYSQL_DUMP --galera-sst-mode bug6490 > $MYSQLTEST_VARDIR/tmp/bug6490.sql
-DROP TABLE t1;
-
---echo # Load the dump
-RESET MASTER;
---exec $MYSQL -uroot bug6490 < $MYSQLTEST_VARDIR/tmp/bug6490.sql
-
-SELECT * from t1;
-
---echo # Compare the two gtid_binlog_state's
---let $after= `SELECT @@global.gtid_binlog_state`
-if (`SELECT STRCMP($before, $after)`)
-{
- --die ERROR: The two gtid_binlog_state's did not match.
-}
-
---echo # Cleanup
---remove_file $MYSQLTEST_VARDIR/tmp/bug6490.sql
-DROP DATABASE bug6490;
-
---echo # End of test
diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test
index 2625ec5d3c9..9378ea55377 100644
--- a/mysql-test/t/gis.test
+++ b/mysql-test/t/gis.test
@@ -7,6 +7,7 @@
--disable_warnings
DROP TABLE IF EXISTS t1, gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
+DROP VIEW IF EXISTS v1;
--enable_warnings
CREATE TABLE gis_point (fid INTEGER NOT NULL PRIMARY KEY, g POINT);
@@ -1477,4 +1478,17 @@ create table t1 (pt point);
insert into t1 values(Geomfromtext('POLYGON((1 1, 2 2, 2 1, 1 1))'));
drop table t1;
---echo End of 5.5 tests
+#
+# MDEV-7516 Assertion `!cur_p->event' failed in Gcalc_scan_iterator::arrange_event(int, int)
+#
+SELECT st_astext(ST_Buffer(ST_PolygonFromText('POLYGON((3 5, 2 4, 2 5, 3 5))'), -100));
+
+#
+# MDEV-7779 View definition changes upon creation
+#
+CREATE VIEW v1 AS SELECT POINT(1,1) AS p;
+SHOW CREATE VIEW v1;
+SELECT ASTEXT(p) FROM v1;
+DROP VIEW v1;
+
+# --echo End of 5.5 tests
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test
index 4b1cb82d0f9..4b992faa306 100644
--- a/mysql-test/t/group_by.test
+++ b/mysql-test/t/group_by.test
@@ -1515,6 +1515,17 @@ let $query= SELECT MIN(a), b FROM t1 WHERE t1.b = 'a' GROUP BY b;
--echo
DROP TABLE t1;
+
+#
+# Bug#19880368 : GROUP_CONCAT CRASHES AFTER DUMP_LEAF_KEY
+#
+create table t1 (a int, b int);
+insert into t1 values (1,11), (1,12), (2,22),(2,23), (4,44),(4,45);
+create table t2 (c int, d int);
+insert into t2 values (1,11), (2,22), (4,44);
+select distinct a,sum(b), (select d from t2 where c=a order by max(b) limit 1) from t1 group by a order by max(b);
+drop table t1, t2;
+
--echo #
--echo # LP bug#993726 Wrong result from a query with ALL subquery predicate in WHERE
--echo #
diff --git a/mysql-test/t/group_by_innodb.test b/mysql-test/t/group_by_innodb.test
index 75ee3d0802a..e072a94fada 100644
--- a/mysql-test/t/group_by_innodb.test
+++ b/mysql-test/t/group_by_innodb.test
@@ -85,4 +85,44 @@ a.oid=b.oid WHERE a.oidGroup=1 GROUP BY a.oid;
DROP TABLE t1, t2;
+--echo #
+--echo # MDEV-7193: Incorrect Query Result (MySQL Bug 68897) in MariaDB 10.0.14
+--echo # (fixed by MDEV-5719)
+--echo #
+
+CREATE TABLE `t1` (
+ `param` int(11) NOT NULL,
+ `idx` int(11) NOT NULL,
+ `text` varchar(255) default NULL,
+ PRIMARY KEY (`param`,`idx`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+INSERT INTO `t1` (`param`, `idx`, `text`) VALUES
+(1, 0, 'select'),
+(1, 1, 'Kabel mit Stecker 5-polig'),
+(1, 2, 'Kabel ohne Stecker'),
+(2, 0, 'number'),
+(2, 1, '22'),
+(2, 2, '25');
+CREATE TABLE `t2` (
+ `id` int PRIMARY KEY
+);
+
+INSERT INTO t2 VALUES (1),(2),(3),(4);
+SELECT t2.id AS id, T.text AS xtext,GROUP_CONCAT(T3.text) AS optionen
+FROM t2
+LEFT JOIN t1 AS T ON(T.param=t2.id AND T.idx=0 )
+LEFT JOIN t1 AS T3 ON(T3.param=t2.id AND T3.idx>0 )
+GROUP BY t2.id
+ORDER BY id ASC;
+
+SELECT t2.id AS id, T.text AS xtext,GROUP_CONCAT(T3.text) AS optionen
+FROM t2
+LEFT JOIN t1 AS T ON(T.param=t2.id AND T.idx=0 )
+LEFT JOIN t1 AS T3 ON(T3.param=t2.id AND T3.idx>0 )
+GROUP BY t2.id
+ORDER BY id DESC;
+
+DROP TABLE t1, t2;
+
--echo # End of tests
diff --git a/mysql-test/t/having.test b/mysql-test/t/having.test
index cd6a4c9d328..0f6be0b0ec6 100644
--- a/mysql-test/t/having.test
+++ b/mysql-test/t/having.test
@@ -694,6 +694,41 @@ DROP TABLE t1;
--echo End of 5.3 tests
--echo #
+--echo # Bug MDEV-7301: Unknown column quoted with backticks in HAVING clause when using function.
+--echo # Bug#16221433 MYSQL REJECTS QUERY DUE TO BAD RESOLUTION OF NAMES IN HAVING; VIEW UNREADABLE
+--echo #
+
+CREATE TABLE `t1` (
+ `id` int(11) NOT NULL,
+ `title` varchar(45) DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) DEFAULT CHARSET=utf8;
+
+INSERT INTO `t1` VALUES ('1', 'Just for fun');
+INSERT INTO `t1` VALUES ('2', 'Wait until a sunhine');
+INSERT INTO `t1` VALUES ('3', 'Take a new turn');
+
+SELECT `id`, SHA1(`title`) AS `column_1`
+FROM `t1`
+HAVING `column_1` LIKE '8%';
+
+--echo expected 1 row(s) returned
+
+SELECT `id`, SHA1(`title`) AS `column_1`
+FROM `t1`
+HAVING UPPER(column_1) LIKE '8%';
+
+--echo expected -- 1 row(s) returned
+
+SELECT `id`, SHA1(`title`) AS `column_1`
+FROM `t1`
+HAVING UPPER(`column_1`) LIKE '8%';
+
+--echo expected -- 1 row(s) returned not ER_BAD_FIELD_ERROR
+
+drop table t1;
+
+--echo #
--echo # Bug mdev-5160: two-way join with HAVING over the second table
--echo #
@@ -708,4 +743,3 @@ SELECT * FROM t1 JOIN t2 ON c1 = c2 HAVING c2 > 'a' ORDER BY c2 LIMIT 1;
DROP TABLE t1,t2;
--echo End of 10.0 tests
-
diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test
index 9fdc29e88de..b2e18097c65 100644
--- a/mysql-test/t/information_schema.test
+++ b/mysql-test/t/information_schema.test
@@ -1819,6 +1819,23 @@ drop view v1;
--echo # Clean-up.
drop database mysqltest;
+--echo #
+--echo # Test for bug #16869534 - "QUERYING SUBSET OF COLUMNS DOESN'T USE TABLE
+--echo # CACHE; OPENED_TABLES INCREASES"
+--echo #
+--disable_result_log
+SELECT * FROM INFORMATION_SCHEMA.TABLES;
+--enable_result_log
+SELECT VARIABLE_VALUE INTO @val1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE
+ VARIABLE_NAME LIKE 'Opened_tables';
+--disable_result_log
+SELECT ENGINE FROM INFORMATION_SCHEMA.TABLES;
+--enable_result_log
+--echo # The below SELECT query should give same output as above SELECT query.
+SELECT VARIABLE_VALUE INTO @val2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE
+ VARIABLE_NAME LIKE 'Opened_tables';
+--echo # The below select should return '1'
+SELECT @val1 = @val2;
--echo #
--echo # End of 5.5 tests
diff --git a/mysql-test/t/information_schema2.test b/mysql-test/t/information_schema2.test
index c2479087f47..d577cdc1e4d 100644
--- a/mysql-test/t/information_schema2.test
+++ b/mysql-test/t/information_schema2.test
@@ -7,3 +7,16 @@ select variable_name from information_schema.session_status where variable_name
select variable_name from information_schema.session_variables where variable_name =
(select variable_name from information_schema.session_variables where variable_name = 'basedir');
+#
+# information_schema tables inside subqueries, they should not be re-populated
+# (i_s.columns needs to scan i_s itself, creating a tmp table for every i_s
+# table. if it's re-populated, it'll do that multiple times)
+#
+create table t1 (a char);
+insert t1 values ('a'),('t'),('z');
+flush status;
+select a, exists (select 1 from information_schema.columns where table_schema=concat('tes',a)) from t1;
+# fix the result in ps-protocol
+--replace_result 44 43
+show status like 'created_tmp_tables';
+drop table t1;
diff --git a/mysql-test/t/join_cache.test b/mysql-test/t/join_cache.test
index 0e4610b9f54..7d873c555f6 100644
--- a/mysql-test/t/join_cache.test
+++ b/mysql-test/t/join_cache.test
@@ -3848,6 +3848,18 @@ set join_buffer_space_limit=default;
drop table t1;
+--echo #
+--echo # MDEV-6687: Assertion `0' failed in Protocol::end_statement on query
+--echo #
+SET join_cache_level = 3;
+--echo # The following should have
+--echo # - table order PROFILING,user,
+--echo # - table user accessed with hash_ALL:
+explain
+SELECT * FROM INFORMATION_SCHEMA.PROFILING, mysql.user WHERE password_expired = PAGE_FAULTS_MINOR;
+
+set join_cache_level=default;
+
# The following command must be the last one the file
# this must be the last command in the file
set @@optimizer_switch=@save_optimizer_switch;
diff --git a/mysql-test/t/log_errchk.test b/mysql-test/t/log_errchk.test
index e4bc6a841dd..2808458e9f1 100644
--- a/mysql-test/t/log_errchk.test
+++ b/mysql-test/t/log_errchk.test
@@ -6,7 +6,8 @@
# Bug#14757009 : WHEN THE GENERAL_LOG IS A SOCKET AND THE READER GOES AWAY,
# MYSQL QUITS WORKING.
#
-call mtr.add_suppression("Could not use");
+# MDEV-6870 Not possible to use FIFO file as a general_log file
+#
--let $gen_log_file= $MYSQLTEST_VARDIR/tmp/general_log.fifo
--let $slow_query_log_file= $MYSQLTEST_VARDIR/tmp/slow_log.fifo
@@ -15,10 +16,9 @@ call mtr.add_suppression("Could not use");
--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 # Case 1: Setting fifo 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.
+# Setting fifo file to general log reports an error because the other end is closed
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--error ER_WRONG_VALUE_FOR_VAR
--eval SET GLOBAL general_log_file="$gen_log_file";
@@ -38,11 +38,12 @@ call mtr.add_suppression("Could not use");
--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.
+# Error 6 is reported, because the other end is closed
+call mtr.add_suppression("Could not use .* for logging \\(error 6\\)");
+call mtr.add_suppression("File '.*' not found \\(Errcode: 6 ");
--perl
my $file= $ENV{'GREP_FILE'};
- my $pattern= "Turning logging off for the whole duration";
+ my $pattern= "for logging \\(error 6\\)\\. Turning logging off for the whole duration";
open(FILE, "$file") or die("Unable to open $file: $!\n");
my $count = 0;
while (<FILE>) {
diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test
index 4f8736f0c2d..c013938416e 100644
--- a/mysql-test/t/multi_update.test
+++ b/mysql-test/t/multi_update.test
@@ -849,6 +849,212 @@ update t1 join v3 using (id) set t1.a=0;
drop view v1, v2, v3;
drop table t2, t3, t1;
+--echo #
+--echo # MDEV-7613: MariaDB 5.5.40 server crash on update table left join
+--echo # with a view
+--echo #
+
+CREATE TABLE `t1` (
+ `f1` varchar(6) COLLATE latin1_general_ci DEFAULT NULL,
+ `f2` varchar(6) COLLATE latin1_general_ci DEFAULT NULL,
+ `f3` varchar(7) COLLATE latin1_general_ci DEFAULT NULL,
+ `f4` varchar(15) COLLATE latin1_general_ci DEFAULT NULL,
+ `f5` datetime DEFAULT NULL,
+ `f6` varchar(2) COLLATE latin1_general_ci DEFAULT NULL,
+ `f7` varchar(2) COLLATE latin1_general_ci DEFAULT NULL,
+ `ff1` int(1) DEFAULT NULL,
+ `ff2` int(1) DEFAULT NULL,
+ `ff3` int(1) DEFAULT NULL,
+ `ff4` int(1) DEFAULT NULL,
+ `ff5` int(1) DEFAULT NULL,
+ `ff6` int(1) DEFAULT NULL,
+ `ff7` int(1) DEFAULT NULL,
+ `ff8` int(2) DEFAULT NULL,
+ `ff9` int(1) DEFAULT NULL,
+ `ff10` int(1) DEFAULT NULL,
+ `ff11` int(1) DEFAULT NULL,
+ `ff12` int(1) DEFAULT NULL,
+ `ff13` int(1) DEFAULT NULL,
+ `ff14` int(1) DEFAULT NULL,
+ `ff15` int(1) DEFAULT NULL,
+ `f8` varchar(70) COLLATE latin1_general_ci DEFAULT NULL,
+ `f9` varchar(20) COLLATE latin1_general_ci DEFAULT NULL,
+ `f10` varchar(50) COLLATE latin1_general_ci NOT NULL,
+ `f11` varchar(50) COLLATE latin1_general_ci DEFAULT NULL,
+ `f12` varchar(255) COLLATE latin1_general_ci DEFAULT NULL,
+ `f13` text COLLATE latin1_general_ci,
+ `f14` time DEFAULT NULL,
+ `f15` varchar(30) COLLATE latin1_general_ci DEFAULT NULL,
+ `fg1` int(11) DEFAULT NULL,
+ `fg2` int(11) DEFAULT NULL,
+ `fg3` int(11) DEFAULT NULL,
+ `fg4` int(11) DEFAULT NULL,
+ `fg5` int(11) DEFAULT NULL,
+ `fg6` int(11) DEFAULT NULL,
+ `fg7` int(11) DEFAULT NULL,
+ `fg9` int(11) DEFAULT NULL,
+ `fg10` int(11) DEFAULT NULL,
+ `fg11` int(11) DEFAULT NULL,
+ `fg12` int(11) DEFAULT NULL,
+ `fg13` int(11) DEFAULT NULL,
+ `fg14` int(11) DEFAULT NULL,
+ `fg15` int(11) DEFAULT NULL,
+ `f16` double DEFAULT NULL,
+ `f17` double DEFAULT NULL,
+ `f18` int(11) DEFAULT NULL,
+ `f19` int(11) DEFAULT NULL,
+ `f20` varchar(255) COLLATE latin1_general_ci DEFAULT NULL,
+ `f21` int(11) DEFAULT NULL,
+ `f22` int(11) DEFAULT NULL,
+ `f23` int(11) DEFAULT NULL,
+ `f24` double DEFAULT NULL,
+ `f25` int(11) DEFAULT NULL,
+ `f26` double DEFAULT NULL,
+ `f27` int(11) DEFAULT NULL,
+ `f28` int(11) DEFAULT NULL,
+ `f29` double DEFAULT NULL,
+ `f30` int(11) DEFAULT NULL,
+ `f31` double DEFAULT NULL,
+ `PZ` double DEFAULT NULL,
+ `f32` varchar(50) COLLATE latin1_general_ci DEFAULT NULL,
+ `f33` varchar(50) COLLATE latin1_general_ci DEFAULT NULL,
+ `f34` varchar(50) COLLATE latin1_general_ci DEFAULT NULL,
+ `f35` varchar(30) COLLATE latin1_general_ci DEFAULT NULL,
+ `f36` varchar(20) COLLATE latin1_general_ci DEFAULT NULL,
+ `f37` varchar(50) COLLATE latin1_general_ci DEFAULT NULL,
+ `f20_2` varchar(20) COLLATE latin1_general_ci DEFAULT NULL,
+ `f38` varchar(30) COLLATE latin1_general_ci DEFAULT NULL COMMENT 'Email = E-Mail / Whitemail = Brief',
+ `insert_ts` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (`f10`),
+ KEY `f5_f12` (`f5`,`f12`),
+ KEY `f5_f20` (`f5`,`f20`),
+ KEY `f5_f33` (`f5`,`f33`)
+) DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci ROW_FORMAT=COMPACT;
+
+INSERT INTO `t1` VALUES ('2011/2','201105','2011/19','gstfbnfr','2011-05-06
+00:00:00','gg','Ag',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,'','','','','','','21:56:28','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,NULL,NULL,0,0,'Dffgult',1,0,0,NULL,0,NULL,0,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'ggggil',NULL),('2008/4','200812','2008/50','hgckbgfx','2008-12-08
+00:00:00','gg','Ag',2,NULL,2,1,1,1,1,24,1,NULL,1,1,1,2,0,'gusschlifßlich
+zugg
+gflffonifrfn','88.77.79.214','10001614','fg-gtgggggdgtfn','fg-gtgggggdgtfn','birgit.tfrpfllf@gggx.df','11:55:21',NULL,1,0,1,1,1,1,1,1,0,1,1,1,0,0,NULL,NULL,0,4,'ffrtrgg',1,6,10,1.66666666666667,4,1,10,14,1.4,1,NULL,NULL,'out',NULL,NULL,'49','ggobilcogg','k.A.',NULL,'ggggil',NULL),('2008/4','200812','2008/51','hgckbgfx','2008-12-15
+00:00:00','gg','Ag',4,5,5,4,5,5,5,NULL,4,5,1,1,1,4,0,'gusschlifßlich zugg
+gflffonifrfn','79.197.185.64','10001686','fg-gtgggggdgtfn','fg-gtgggggdgtfn','kgtjg@swfftys.df','09:28:42',NULL,1,1,1,1,1,1,1,1,1,1,1,1,0,0,NULL,NULL,0,5,'ffrtrgg',1,7,11,4.71428571428571,16,1.2,12,49,4.08111111111111,1,NULL,NULL,'out',NULL,NULL,'49','ggobilcogg','k.A.',NULL,'ggggil',NULL),('2008/4','200812','2008/50','nufchti','2008-12-08
+00:00:00','gg','Ag',4,1,1,5,5,5,5,12,4,5,1,1,2,1,0,'gusschlifßlich zugg
+gflffonifrfn','89.54.151.216','10001700','fg-gtgggggdgtfn','fg-gtgggggdgtfn','H_K2006@frffnft.df','16:41:45',NULL,1,1,1,1,1,1,1,1,1,1,1,1,0,0,NULL,NULL,0,5,'ffrtrgg',1,7,10,4.28571428571429,11,2.6,12,41,1.58111111111111,1,NULL,NULL,'ffrtrgg
+Bgckofficf 5','vb5','Nufchtfr,
+Iris','49','ggobilcogg','grfurt','Intfrn','ggggil',NULL),('2008/4','200812','2008/50','junghdro','2008-12-11
+00:00:00','Do','Ag',2,2,5,5,4,4,2,72,2,5,2,2,1,1,0,'gusschlifßlich zugg
+gflffonifrfn','84.61.20.216','10001849','fg-ggriff','fg-ggriff','schofnf-glftfr@grcor.df','20:18:05',NULL,1,1,1,1,1,1,1,1,1,1,1,1,0,0,NULL,NULL,0,5,'ffrtrgg',1,7,24,1.42857142857141,12,2.4,12,16,1,1,NULL,NULL,'ffrtrgg
+Bgckofficf 5','vb5','Junghfinrich,
+Dorothfg','49','ggobilcogg','grfurt','Intfrn','ggggil',NULL),('2008/4','200812','2008/50','fbflktj','2008-12-08
+00:00:00','gg','Ag',4,2,2,5,1,1,1,24,NULL,NULL,NULL,NULL,NULL,0,0,'Kgggfrg
+bzw. DigiCggg
+Funktion','217.84.62.6','10001888','fg-Kündigungfn','fg-Kündigungfn','f.frofschkf@gggx.df','21:05:59',NULL,1,1,1,1,1,1,1,0,0,0,0,0,0,0,NULL,NULL,0,0,'ffrtrgg',1,7,16,2.28571428571429,0,NULL,7,16,2.28571428571429,0,NULL,NULL,'out',NULL,'gbfl,
+Kgtjg','49','ggobilcogg','k.A.','gxtfrn','ggggil',NULL),('2008/4','200812','2008/50','gltggggri','2008-12-09
+00:00:00','Di','Ag',4,1,1,4,2,1,2,16,1,2,2,2,2,2,0,'gusschlifßlich zugg
+gflffonifrfn','81.171.157.211','10001988','fg-gtgggggdgtfn','fg-gtgggggdgtfn','bistfr@nftcolognf.df','11:07:54',NULL,1,1,1,1,1,1,1,1,1,1,1,1,0,0,NULL,NULL,0,5,'ffrtrgg',1,7,21,1,11,2.2,12,12,2.66666666666667,1,NULL,NULL,'out',NULL,NULL,'49','ggobilcogg','k.A.','gxtfrn','ggggil',NULL),('2008/4','200812','2008/50','ggufllfsg','2008-12-09
+00:00:00','Di','Ag',2,2,2,2,1,1,2,12,2,2,2,1,1,2,0,'ggobilfs
+Intfrnft','62.154.142.186','10002097','fg-gtgggggdgtfn','fg-gtgggggdgtfn','norbfrtwfdlich@fgggil.df','09:42:11',NULL,1,1,1,1,1,1,1,1,1,1,1,1,0,0,NULL,NULL,0,5,'ffrtrgg',1,7,12,1.71428571428571,8,1.6,12,20,1.66666666666667,1,NULL,NULL,'ffrtrgg
+Bgckofficf 1','vb1','Mufllfr,
+ggbinf','49','ggobilcogg','grfurt','Intfrn','ggggil',NULL),('2008/4','200812','2008/50','wggnfg','2008-12-09
+00:00:00','Di','Ag',5,5,5,5,5,5,5,12,5,5,5,5,5,5,0,'gls grsgtz für
+Ffstnftz','85.180.141.246','10002127','fg-Kündigungfn','fg-Kündigungfn','rfinhgrt.gdolph@yghoo.df','17:44:11',NULL,1,1,1,1,1,1,1,1,1,1,1,1,0,0,NULL,NULL,0,5,'ffrtrgg',1,7,15,5,25,5,12,60,5,1,NULL,NULL,'ffrtrgg
+Bgckofficf 1','vb1','Wggnfr,
+Annftt','49','ggobilcogg','grfurt','Intfrn','ggggil',NULL),('2008/4','200812','2008/50','schubrbf','2008-12-10
+00:00:00','Mi','Ag',1,2,NULL,2,1,2,1,24,NULL,NULL,NULL,NULL,NULL,0,0,'Kgggfrg
+bzw. DigiCggg
+Funktion','91.40.98.242','10002160','fg-gtgggggdgtfn','fg-gtgggggdgtfn','olgf.lifb@gggx.nft','18:18:25',NULL,1,1,0,1,1,1,1,0,0,0,0,0,0,0,NULL,NULL,0,0,'ffrtrgg',1,6,11,1.81111111111111,0,NULL,6,11,1.81111111111111,0,NULL,NULL,'out',NULL,NULL,'49','ggobilcogg','k.A.','gxtfrn','ggggil',NULL);
+
+CREATE TABLE `t2` (
+ `ft1` datetime DEFAULT NULL,
+ `ft2` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `ft3` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `ft4` varchar(255) COLLATE latin1_general_ci NOT NULL DEFAULT '',
+ `ft5` varchar(255) COLLATE latin1_general_ci NOT NULL DEFAULT '',
+ `ft6` varchar(255) COLLATE latin1_general_ci DEFAULT NULL,
+ `ft6_2` varchar(255) COLLATE latin1_general_ci DEFAULT NULL,
+ `ft7` varchar(255) COLLATE latin1_general_ci DEFAULT NULL,
+ `ft8` varchar(255) COLLATE latin1_general_ci DEFAULT NULL,
+ `ft9` varchar(255) COLLATE latin1_general_ci DEFAULT NULL,
+ `ft10` varchar(255) COLLATE latin1_general_ci DEFAULT NULL,
+ PRIMARY KEY (`ft4`,`ft5`)
+) DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
+
+INSERT INTO `t2` VALUES ('2013-03-13 00:00:00','2013-03-13 00:00:00','9999-12-31 00:00:00','#','extern FP f32 2','Default','Intern','DEFAULT',NULL,NULL,NULL),('2013-03-13 00:00:00','2013-03-13 00:00:00','9999-12-31 00:00:00','#','extern FP f32 3','Default','Intern','DEFAULT',NULL,NULL,NULL);
+
+CREATE TABLE `t3` (
+ `fe1` int(10) NOT NULL DEFAULT '0',
+ `fe2` char(50) COLLATE latin1_general_ci DEFAULT 'nn',
+ `f34` char(50) COLLATE latin1_general_ci DEFAULT NULL,
+ `fe3` double DEFAULT NULL,
+ `fe4` double DEFAULT NULL,
+ `fe5` char(4) COLLATE latin1_general_ci DEFAULT NULL,
+ `f32` char(50) COLLATE latin1_general_ci DEFAULT NULL,
+ `fe6` int(3) DEFAULT '0',
+ `fe7` char(1) COLLATE latin1_general_ci DEFAULT NULL,
+ `ft6` char(50) COLLATE latin1_general_ci DEFAULT NULL,
+ `f33` char(4) COLLATE latin1_general_ci DEFAULT NULL COMMENT 'virtuelle f33s',
+ `fe8` char(4) COLLATE latin1_general_ci DEFAULT NULL COMMENT 'aus dem ADS',
+ `f37` char(50) COLLATE latin1_general_ci DEFAULT NULL,
+ `fe9` char(50) COLLATE latin1_general_ci DEFAULT NULL,
+ `fe10` int(5) DEFAULT '0',
+ `fe11` int(10) DEFAULT '0',
+ `fe12` char(50) COLLATE latin1_general_ci DEFAULT NULL,
+ `fe13` double DEFAULT NULL,
+ `fe14` char(50) COLLATE latin1_general_ci DEFAULT NULL,
+ `fe15` date DEFAULT NULL,
+ `fe16` date DEFAULT NULL,
+ `fe17` int(10) DEFAULT '0',
+ `fe18` date NOT NULL DEFAULT '0000-00-00',
+ `ft3` date NOT NULL DEFAULT '0000-00-00',
+ PRIMARY KEY (`fe1`),
+ KEY `fe2` (`fe2`,`fe18`,`ft3`),
+ KEY `f33` (`f33`),
+ KEY `fe8` (`fe8`)
+) DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci ROW_FORMAT=COMPACT COMMENT='CustomerService und Outsourcer Userinformationen';
+
+INSERT INTO `t3` VALUES (1,'aabggn','gab, glgna',0,NULL,NULL,'gxtgrn D gnd g
+gggsbgrg',0,NULL,'gxtgrn','dsa','dsa','gggsbgrg','0',91611,0,'0',0,'agsggschigdgn','2014-08-11','2014-09-05',0,'2011-01-01','2014-08-11'),(4,'aabigr','gab,
+Iggr',0,NULL,NULL,'gxtgrn D gnd g
+gggsbgrg',0,NULL,'gxtgrn','dsa','dsa','gggsbgrg','0',0,0,'0',0,'agsggschigdgn','2014-08-11','2014-09-05',0,'2012-10-01','2014-08-11'),(7,'abgcrist','gbg,
+ghristggna',15182,1,'ja','ggshilfg gxtgrn 1',1,NULL,'gg
+galgs','ag1','ag1','grfgrt','0',11941,0,'0',0,'agsggschigdgn','2014-01-11',NULL,11802051,'1900-01-01','2010-06-10'),(8,'abgcrist','gbg,
+ghristggna',15182,1,'ja','Zgntralg gftgr galgs Bgtrgggng 1',1,NULL,'gg
+galgs','sb1','sb1','grfgrt','0',11941,0,'0',0,'agsggschigdgn','2014-01-11',NULL,11802051,'2010-07-01','2012-08-11'),(9,'abgcrist','gbg,
+ghristggna',15182,1,'ja','galgs Inbggnd 2',1,NULL,'gg
+galgs','si2','si2','grfgrt','0',11941,0,'0',0,'agsggschigdgn','2014-01-11',NULL,11802051,'2012-09-01','2014-01-11'),(10,'abgcgr','gbg,
+ggrnglgg',14962,1,NULL,'galgs Ogtbggnd 1',1,NULL,'gg
+galgs','sg1','sg1','grfgrt','0',12401,0,'abgcrn',1,NULL,NULL,NULL,11800647,'1900-01-01','2010-11-10'),(11,'abgcgr','gbg,
+ggrnglgg',14962,1,NULL,'galgs Ogtbggnd 1',1,NULL,'gg
+galgs','sg1','sg1','grfgrt','0',12401,0,'abgcrn',1,NULL,NULL,NULL,11800647,'2010-12-01','2011-08-11'),(12,'abgcgr','gbg,
+ggrnglgg',14962,1,NULL,'galgs Ogtbggnd 2',1,NULL,'gg
+galgs','sg2','sg2','grfgrt','0',12401,0,'abgcrn',1,NULL,NULL,NULL,11800647,'2011-09-01','2012-01-11'),(13,'abgcgr','gbg,
+ggrnglgg',14962,0.75,NULL,'galgs Ogtbggnd 2',1,NULL,'gg
+galgs','sg2','sg2','grfgrt','0',12401,0,'abgcrn',1,NULL,NULL,'2011-09-11',11800647,'2012-02-01','2011-08-11'),(14,'rgghrsgr','gbg,
+gigrid',14781,1,'ja','Fgrdgrgngsmanaggmgnt 1',1,NULL,'gg
+Zahlgng','fm1','fm1','grfgrt','0',12141,0,'0',1,NULL,NULL,NULL,11010781,'1900-01-01','2012-08-11');
+
+CREATE ALGORITHM=MERGE
+DEFINER=`root`@`localhost` SQL SECURITY DEFINER
+VIEW `v1` AS select `t1a`.`ft1` AS `ft1`,`t1a`.`ft2` AS `ft2`,`t1a`.`ft3` AS `ft3`,`t1a`.`ft4` AS `ft4`,`t1a`.`ft5` AS `ft5`,`t1a`.`ft6` AS `ft6`,`t1a`.`ft6_2` AS `ft6_2`,`t1a`.`ft7` AS `ft7`,`t1a`.`ft8` AS `ft8`,`t1a`.`ft9` AS `ft9`,`t1a`.`ft10` AS `ft10` from `t2` `t1a` where (if((`t1a`.`ft10` = 'virtuell'),0,1) = 1);
+
+CREATE ALGORITHM=UNDEFINED
+DEFINER=`root`@`localhost` SQL SECURITY DEFINER
+VIEW `v2` AS select distinct `t1b`.`fe2` AS `fe2`,min(`t1b`.`fe18`) AS `fe18`,max(`t1b`.`ft3`) AS `ft3` from `t3` `t1b` where ((`t1b`.`fe2` <> '') and (curdate() >= `t1b`.`fe18`)) group by `t1b`.`fe2`;
+
+CREATE ALGORITHM=UNDEFINED
+DEFINER=`root`@`localhost` SQL SECURITY DEFINER
+VIEW `v3` AS select `t1c`.`fe2` AS `fe2`,`t1c`.`f34` AS `f34`,`t1c`.`f33` AS `f33`,`t1c`.`f32` AS `f32`,`t1c`.`f37` AS `f37`,`t1c`.`fe10` AS `fe10`,if((`tov`.`ft6` in ('klarmobil','callmobile')),`tov`.`ft9`,`tov`.`ft6`) AS `ft6_1`,`tov`.`ft6_2` AS `ft6_2`,`ua`.`fe18` AS `fe18`,`ua`.`ft3` AS `ft3` from ((`t3` `t1c` left join `v2` `ua` on((`t1c`.`fe2` = `ua`.`fe2`))) left join `v1` `tov` on((`t1c`.`fe8` = `tov`.`ft4`))) where (`t1c`.`ft3` = `ua`.`ft3`) group by `t1c`.`fe2`,`t1c`.`f34`,`t1c`.`f33`,`t1c`.`f32` order by `t1c`.`f34`;
+
+UPDATE t1 t1 left join v3 t2 on t1.f4 = t2.fe2 SET t1.f20 = t2.ft6_1, t1.f32 = t2.f32, t1.f33 = t2.f33, t1.f37 = t2.f37 WHERE f5 >= '2015-02-01';
+
+--echo #MDEV-8018: main.multi_update fails with --ps-protocol
+prepare stmt1 from "UPDATE t1 t1 left join v3 t2 on t1.f4 = t2.fe2 SET t1.f20 = t2.ft6_1, t1.f32 = t2.f32, t1.f33 = t2.f33, t1.f37 = t2.f37 WHERE f5 >= '2015-02-01'";
+execute stmt1;
+execute stmt1;
+deallocate prepare stmt1;
+
+drop view v3,v2,v1;
+drop table t1,t2,t3;
--echo end of 5.5 tests
diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test
index 6c9371eed25..9ac49a9063d 100644
--- a/mysql-test/t/myisam.test
+++ b/mysql-test/t/myisam.test
@@ -1751,6 +1751,16 @@ CHECK TABLE t1;
DROP TABLE t1;
+--echo #
+--echo # MDEV-3870 - Valgrind warnings on OPTIMIZE MyISAM or Aria TABLE with
+--echo # disabled keys
+--echo #
+CREATE TABLE t1 (a INT, KEY(a)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (4),(3),(1),(0);
+ALTER TABLE t1 DISABLE KEYS;
+OPTIMIZE TABLE t1;
+DROP TABLE t1;
+
#
# Check some variables
#
diff --git a/mysql-test/t/mysql_tzinfo_to_sql_symlink.test b/mysql-test/t/mysql_tzinfo_to_sql_symlink.test
index 1ba4e91be3c..8ca82b87e30 100644
--- a/mysql-test/t/mysql_tzinfo_to_sql_symlink.test
+++ b/mysql-test/t/mysql_tzinfo_to_sql_symlink.test
@@ -37,3 +37,14 @@
#
--exec rm -rf $MYSQLTEST_VARDIR/zoneinfo
+
+--echo #
+--echo # MDEV-6236 - [PATCH] mysql_tzinfo_to_sql may produce invalid SQL
+--echo #
+--exec mkdir $MYSQLTEST_VARDIR/zoneinfo
+--copy_file std_data/zoneinfo/GMT $MYSQLTEST_VARDIR/zoneinfo/Factory
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--exec $MYSQL_TZINFO_TO_SQL $MYSQLTEST_VARDIR/zoneinfo 2>&1
+
+--exec rm -rf $MYSQLTEST_VARDIR/zoneinfo
diff --git a/mysql-test/t/mysql_upgrade_view.test b/mysql-test/t/mysql_upgrade_view.test
new file mode 100644
index 00000000000..7a098aa701b
--- /dev/null
+++ b/mysql-test/t/mysql_upgrade_view.test
@@ -0,0 +1,161 @@
+-- source include/have_log_bin.inc
+
+set sql_log_bin=0;
+--disable_warnings
+drop table if exists t1,v1,v2,v3,v4,v1badcheck;
+drop view if exists t1,v1,v2,v3,v4,v1badcheck;
+--enable_warnings
+
+create table t1(a int);
+create table kv(k varchar(30) NOT NULL PRIMARY KEY,v varchar(50));
+create view v1 as select 1;
+
+repair table t1 quick;
+repair table t1 extended;
+repair table t1 use_frm;
+--error ER_PARSE_ERROR
+repair table t1 from mysql;
+
+--error ER_PARSE_ERROR
+repair view v1 quick;
+--error ER_PARSE_ERROR
+repair view v1 extended;
+--error ER_PARSE_ERROR
+repair view v1 use_frm;
+repair view v1 from mysql;
+
+--error ER_PARSE_ERROR
+check view v1 quick;
+--error ER_PARSE_ERROR
+check view v1 fast;
+--error ER_PARSE_ERROR
+check view v1 medium;
+--error ER_PARSE_ERROR
+check view v1 extended;
+--error ER_PARSE_ERROR
+check view v1 changed;
+check view v1 for upgrade;
+
+drop view v1;
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+
+--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v1.frm $MYSQLD_DATADIR/test/v1.frm
+--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v1badcheck.frm $MYSQLD_DATADIR/test/v1badcheck.frm
+--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v2.frm $MYSQLD_DATADIR/test/v2.frm
+--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v3.frm $MYSQLD_DATADIR/test/v3.frm
+
+flush tables;
+
+check view v1;
+check view v1badcheck;
+check view v2;
+check view v3;
+
+check view v1 for upgrade;
+check view v1badcheck for upgrade;
+check view v2 for upgrade;
+check view v3 for upgrade;
+
+--replace_result $MYSQLTEST_VARDIR var
+--exec $MYSQL_UPGRADE --force 2>&1
+
+# "Phase 1/4: Fixing views" expected (without from_mysql)
+
+show create view v1;
+show create view v2;
+show create view v3;
+
+# Now force a mariadb version to be added
+
+set sql_log_bin=1;
+REPAIR VIEW v1,v2;
+REPAIR VIEW v1badcheck;
+REPAIR NO_WRITE_TO_BINLOG VIEW v3;
+set sql_log_bin=0;
+
+--source include/show_binlog_events.inc
+
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+eval LOAD DATA INFILE '$MYSQLD_DATADIR/test/v1.frm' REPLACE INTO TABLE kv FIELDS TERMINATED BY '=';
+SELECT k,v from kv where k in ('md5','algorithm');
+SELECT k from kv where k ='mariadb-version';
+truncate table kv;
+
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+eval LOAD DATA INFILE '$MYSQLD_DATADIR/test/v2.frm' REPLACE INTO TABLE kv FIELDS TERMINATED BY '=';
+SELECT k,v from kv where k in ('md5','algorithm');
+SELECT k from kv where k ='mariadb-version';
+truncate table kv;
+
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+eval LOAD DATA INFILE '$MYSQLD_DATADIR/test/v3.frm' REPLACE INTO TABLE kv FIELDS TERMINATED BY '=';
+SELECT k,v from kv where k in ('md5','algorithm');
+SELECT k from kv where k ='mariadb-version';
+truncate table kv;
+
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+eval LOAD DATA INFILE '$MYSQLD_DATADIR/test/v1badcheck.frm' REPLACE INTO TABLE kv FIELDS TERMINATED BY '=';
+SELECT k,v from kv where k in ('md5','algorithm');
+SELECT k from kv where k ='mariadb-version';
+truncate table kv;
+
+--disable_warnings
+drop view if exists v1,v2,v3,v1badcheck;
+--enable_warnings
+
+# Make it look like a MySQL directory now
+
+rename table mysql.event to mysql.ev_bk;
+--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/event.MYI $MYSQLD_DATADIR/mysql/event.MYI
+--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/event.MYD $MYSQLD_DATADIR/mysql/event.MYD
+--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/event.frm $MYSQLD_DATADIR/mysql/event.frm
+
+--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v1.frm $MYSQLD_DATADIR/test/v1.frm
+--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v2.frm $MYSQLD_DATADIR/test/v2.frm
+--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v3.frm $MYSQLD_DATADIR/test/v3.frm
+
+flush tables;
+
+create algorithm=temptable view v4 as select a from t1;
+show create view v1;
+show create view v2;
+show create view v3;
+show create view v4;
+
+# here we test the fixing views from mysql to occur
+--replace_result $MYSQLTEST_VARDIR var
+--exec $MYSQL_UPGRADE --force 2>&1
+
+show create view v1;
+show create view v2;
+show create view v3;
+show create view v4;
+
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+eval LOAD DATA INFILE '$MYSQLD_DATADIR/test/v1.frm' REPLACE INTO TABLE kv FIELDS TERMINATED BY '=';
+SELECT k,v from kv where k in ('md5','algorithm');
+SELECT k from kv where k ='mariadb-version';
+truncate table kv;
+
+--disable_warnings
+drop view if exists v1,v2,v3;
+--enable_warnings
+
+# back to mariadb default
+drop table mysql.event;
+rename table mysql.ev_bk to mysql.event;
+
+--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v1.frm $MYSQLD_DATADIR/test/v1.frm
+--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v2.frm $MYSQLD_DATADIR/test/v2.frm
+--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v3.frm $MYSQLD_DATADIR/test/v3.frm
+
+# check of binlog and mixing tables (with table specific options) and views
+--exec $MYSQL_CHECK --repair --write-binlog --process-tables --use-frm --process-views=UPGRADE_FROM_MYSQL test 2>&1
+
+--source include/show_binlog_events.inc
+
+drop table if exists kv;
+drop view v1,v2,v3,v4;
+drop table t1;
+
diff --git a/mysql-test/t/mysqladmin.test b/mysql-test/t/mysqladmin.test
index c04c8d50f3c..2580db88456 100644
--- a/mysql-test/t/mysqladmin.test
+++ b/mysql-test/t/mysqladmin.test
@@ -45,3 +45,9 @@ EOF
--exec $MYSQLADMIN --defaults-extra-file=$MYSQLTEST_VARDIR/tmp/cnf_file -uroot -S $MASTER_MYSOCK -P $MASTER_MYPORT ping 2>&1
--remove_file $MYSQLTEST_VARDIR/tmp/cnf_file
+
+#
+# MDEV-7883 Segmentation failure when running mysqladmin -u root -p
+#
+--error 1
+--exec $MYSQLADMIN -u root -p 2>&1 > /dev/null
diff --git a/mysql-test/t/mysqlcheck.test b/mysql-test/t/mysqlcheck.test
index d986b42fc91..6cd0265f89a 100644
--- a/mysql-test/t/mysqlcheck.test
+++ b/mysql-test/t/mysqlcheck.test
@@ -8,14 +8,15 @@ call mtr.add_suppression("Invalid .old.. table or database name");
# check that CSV engine was compiled in, as the result of the test
# depends on the presence of the log tables (which are CSV-based).
--source include/have_csv.inc
+let $MYSQLD_DATADIR= `select @@datadir`;
#
# Clean up after previous tests
#
--disable_warnings
-DROP TABLE IF EXISTS t1, `t``1`, `t 1`;
-drop view if exists v1;
+DROP TABLE IF EXISTS t1, `t``1`, `t 1`, test.`t.1`, v1;
+drop view if exists t1, `t``1`, `t 1`, test.`t.1`, v1;
drop database if exists client_test_db;
# Repair any tables in mysql, sometimes the slow_log is marked as crashed
# after server has been killed
@@ -66,7 +67,6 @@ create table t_bug25347 (a int) engine=myisam;
create view v_bug25347 as select * from t_bug25347;
insert into t_bug25347 values (1),(2),(3);
flush tables;
-let $MYSQLD_DATADIR= `select @@datadir`;
--echo removing and creating
--remove_file $MYSQLD_DATADIR/d_bug25347/t_bug25347.MYI
--write_file $MYSQLD_DATADIR/d_bug25347/t_bug25347.MYI
@@ -119,7 +119,6 @@ DROP TABLE t1, t2;
create table t1(a int) engine=myisam;
create view v1 as select * from t1;
show tables;
-let $MYSQLD_DATADIR= `select @@datadir`;
--copy_file $MYSQLD_DATADIR/test/v1.frm $MYSQLD_DATADIR/test/v-1.frm
show tables;
--exec $MYSQL_CHECK --check-upgrade --databases test
@@ -164,24 +163,23 @@ CREATE TABLE `#mysql50#c@d` (a INT) engine=myisam;
CREATE TABLE t1 (a INT) engine=myisam;
# Create 5.0 like triggers
-let $MYSQLTEST_VARDIR= `select @@datadir`;
---write_file $MYSQLTEST_VARDIR/a@b/c@d.TRG
+--write_file $MYSQLD_DATADIR/a@b/c@d.TRG
TYPE=TRIGGERS
triggers='CREATE DEFINER=`root`@`localhost` TRIGGER tr1 BEFORE INSERT ON `c@d` FOR EACH ROW SET NEW.a = 10 * NEW.a'
sql_modes=0
definers='root@localhost'
EOF
---write_file $MYSQLTEST_VARDIR/a@b/tr1.TRN
+--write_file $MYSQLD_DATADIR/a@b/tr1.TRN
TYPE=TRIGGERNAME
trigger_table=c@d
EOF
---write_file $MYSQLTEST_VARDIR/a@b/t1.TRG
+--write_file $MYSQLD_DATADIR/a@b/t1.TRG
TYPE=TRIGGERS
triggers='CREATE DEFINER=`root`@`localhost` TRIGGER tr2 BEFORE INSERT ON `a@b`.t1 FOR EACH ROW SET NEW.a = 100 * NEW.a'
sql_modes=0
definers='root@localhost'
EOF
---write_file $MYSQLTEST_VARDIR/a@b/tr2.TRN
+--write_file $MYSQLD_DATADIR/a@b/tr2.TRN
TYPE=TRIGGERNAME
trigger_table=t1
EOF
@@ -255,7 +253,6 @@ INSERT INTO bug47205 VALUES ("foobar");
FLUSH TABLE bug47205;
--echo # Replace the FRM with a 5.0 FRM that will require upgrade
-let $MYSQLD_DATADIR= `select @@datadir`;
--remove_file $MYSQLD_DATADIR/test/bug47205.frm
--copy_file std_data/bug47205.frm $MYSQLD_DATADIR/test/bug47205.frm
@@ -279,7 +276,6 @@ CREATE TABLE bug47205(a VARCHAR(20) PRIMARY KEY)
FLUSH TABLE bug47205;
--echo # Replace the FRM with a 5.0 FRM that will require upgrade
-let $MYSQLD_DATADIR= `select @@datadir`;
--remove_file $MYSQLD_DATADIR/test/bug47205.frm
--copy_file std_data/bug47205.frm $MYSQLD_DATADIR/test/bug47205.frm
@@ -312,3 +308,44 @@ CHECK TABLE bug47205 FOR UPGRADE;
CHECK TABLE bug47205 FOR UPGRADE;
DROP TABLE bug47205;
+
+--echo #
+--echo #MDEV-6128:[PATCH] mysqlcheck wrongly escapes '.' in table names
+--echo #
+CREATE TABLE test.`t.1` (id int);
+
+--echo mysqlcheck test t.1
+--exec $MYSQL_CHECK test t.1
+
+drop table test.`t.1`;
+
+#
+# MDEV-8123 mysqlcheck: new --process-views option conflicts with --quick, --extended and such
+#
+create view v1 as select 1;
+--echo mysqlcheck --process-views test
+--exec $MYSQL_CHECK --process-views test
+--echo mysqlcheck --process-views --extended test
+--exec $MYSQL_CHECK --process-views --extended test
+--echo mysqlcheck --process-views --fast test
+--exec $MYSQL_CHECK --process-views --fast test
+--echo mysqlcheck --process-views --quick test
+--exec $MYSQL_CHECK --process-views --quick test
+--echo mysqlcheck --process-views --check-only-changed test
+--exec $MYSQL_CHECK --process-views --check-only-changed test
+--echo mysqlcheck --process-views --medium-check test
+--exec $MYSQL_CHECK --process-views --medium-check test
+--echo mysqlcheck --process-views --check-upgrade test
+--exec $MYSQL_CHECK --process-views --check-upgrade test
+drop view v1;
+
+
+#
+# MDEV-8124 mysqlcheck: --auto-repair runs REPAIR TABLE instead of REPAIR VIEW on views
+#
+create table t1(a int);
+--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v1.frm $MYSQLD_DATADIR/test/v1.frm
+--echo mysqlcheck --process-views --check-upgrade --auto-repair test
+--exec $MYSQL_CHECK --process-views --check-upgrade --auto-repair test
+drop view v1;
+drop table t1;
diff --git a/mysql-test/t/openssl_1.test b/mysql-test/t/openssl_1.test
index bee0e2cc720..e36f106a5be 100644
--- a/mysql-test/t/openssl_1.test
+++ b/mysql-test/t/openssl_1.test
@@ -15,15 +15,15 @@ insert into t1 values (5);
grant select on test.* to ssl_user1@localhost require SSL;
grant select on test.* to ssl_user2@localhost require cipher "DHE-RSA-AES256-SHA";
-grant select on test.* to ssl_user3@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/ST=Uppsala/O=MySQL AB";
-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_user3@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB/CN=client";
+grant select on test.* to ssl_user4@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB/CN=client" ISSUER "/CN=cacert/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB";
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-CIPHER=DHE-RSA-AES256-SHA);
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error ER_ACCESS_DENIED_ERROR
-connect (con2,localhost,ssl_user2,,,,,SSL-CIPHER=RC4-SHA);
+connect (con2,localhost,ssl_user2,,,,,SSL-CIPHER=AES256-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);
@@ -222,8 +222,6 @@ DROP TABLE t1;
# Common ciphers to openssl and yassl
--exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl_cipher';" --ssl-cipher=DHE-RSA-AES256-SHA
--exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl_cipher';" --ssl-cipher=EDH-RSA-DES-CBC3-SHA
---exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl_cipher';" --ssl-cipher=EDH-RSA-DES-CBC-SHA
---exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl_cipher';" --ssl-cipher=RC4-SHA
--disable_query_log
--disable_result_log
diff --git a/mysql-test/t/partition_innodb.test b/mysql-test/t/partition_innodb.test
index a74e95ab65b..2d90764da0d 100644
--- a/mysql-test/t/partition_innodb.test
+++ b/mysql-test/t/partition_innodb.test
@@ -1,3 +1,7 @@
+if (`select plugin_auth_version < "5.6.25" from information_schema.plugins where plugin_name='innodb'`)
+{
+ --skip Not fixed in InnoDB as of 5.6.24 or earlier
+}
--source include/not_embedded.inc
--source include/have_partition.inc
--source include/have_innodb.inc
@@ -403,7 +407,7 @@ DROP TABLE t1;
create table t1 (a int) engine=innodb partition by hash(a) ;
# Data_free for InnoDB tablespace varies depending on which
# tests have been run before this one
---replace_column 10 #
+--replace_column 10 # 12 #
show table status like 't1';
drop table t1;
@@ -415,12 +419,12 @@ engine = innodb
partition by key (a);
# Data_free for InnoDB tablespace varies depending on which
# tests have been run before this one
---replace_column 10 #
+--replace_column 10 # 12 #
show table status;
insert into t1 values (0), (1), (2), (3);
# Data_free for InnoDB tablespace varies depending on which
# tests have been run before this one
---replace_column 10 #
+--replace_column 10 # 12 #
show table status;
drop table t1;
@@ -429,17 +433,17 @@ engine = innodb
partition by key (a);
# Data_free for InnoDB tablespace varies depending on which
# tests have been run before this one
---replace_column 10 #
+--replace_column 10 # 12 #
show table status;
insert into t1 values (NULL), (NULL), (NULL), (NULL);
# Data_free for InnoDB tablespace varies depending on which
# tests have been run before this one
---replace_column 10 #
+--replace_column 10 # 12 #
show table status;
insert into t1 values (NULL), (NULL), (NULL), (NULL);
# Data_free for InnoDB tablespace varies depending on which
# tests have been run before this one
---replace_column 10 #
+--replace_column 10 # 12 #
show table status;
drop table t1;
@@ -675,6 +679,18 @@ ALTER TABLE t1 ADD UNIQUE KEY (b);
SHOW CREATE TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;
+--echo #
+--echo # Bug #17299181 CREATE_TIME AND UPDATE_TIME ARE
+--echo # WRONG FOR PARTITIONED TABLES
+--echo #
+
+CREATE TABLE t1 (a int, PRIMARY KEY (a)) ENGINE=InnoDB
+PARTITION BY HASH (a) PARTITIONS 2;
+
+SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE
+CREATE_TIME IS NOT NULL AND TABLE_NAME='t1';
+
+DROP TABLE t1;
--echo #
--echo # BUG#12912171 - ASSERTION FAILED: QUICK->HEAD->READ_SET ==
diff --git a/mysql-test/t/partition_innodb_plugin.test b/mysql-test/t/partition_innodb_plugin.test
index 8044ae9ec5c..fd6e60c27fb 100644
--- a/mysql-test/t/partition_innodb_plugin.test
+++ b/mysql-test/t/partition_innodb_plugin.test
@@ -149,11 +149,11 @@ UPDATE `t``\""e` SET a = 4 WHERE a = 22;
# NOTE: replace_regex is very slow on match copy/past '(.*)' regex's
# on big texts, removing a lot of text before + after makes it much faster.
#/.*in (.*) trx.*/\1/
---replace_regex /.*RECORD LOCKS space id [0-9]* page no [0-9]* n bits [0-9]* // / trx id .*// /.*index .* in //
+--replace_regex /.*RECORD LOCKS space id [0-9]* page no [0-9]* n bits [0-9]* // / trx id .*// /.*index .* in // /trx table locks [0-9]* // /total table locks [0-9]* //
SHOW ENGINE InnoDB STATUS;
set @old_sql_mode = @@sql_mode;
set sql_mode = 'ANSI_QUOTES';
---replace_regex /.*RECORD LOCKS space id [0-9]* page no [0-9]* n bits [0-9]* // / trx id .*// /.*index .* in //
+--replace_regex /.*RECORD LOCKS space id [0-9]* page no [0-9]* n bits [0-9]* // / trx id .*// /.*index .* in // /trx table locks [0-9]* // /total table locks [0-9]* //
SHOW ENGINE InnoDB STATUS;
set @@sql_mode = @old_sql_mode;
--echo # con1
diff --git a/mysql-test/t/partition_myisam.test b/mysql-test/t/partition_myisam.test
index a33b9e19fbf..bce0c6f009c 100644
--- a/mysql-test/t/partition_myisam.test
+++ b/mysql-test/t/partition_myisam.test
@@ -123,7 +123,7 @@ CHECK TABLE t1;
SELECT * FROM t1;
--echo # Note that it is currently impossible to drop a partitioned table
--echo # without the .par file
---error ER_BAD_TABLE_ERROR
+--error ER_GET_ERRNO
DROP TABLE t1;
--remove_file $MYSQLD_DATADIR/test/t1.frm
--remove_file $MYSQLD_DATADIR/test/t1#P#p0.MYI
diff --git a/mysql-test/t/partition_not_blackhole.test b/mysql-test/t/partition_not_blackhole.test
index 7352aeaa230..3731d659ad0 100644
--- a/mysql-test/t/partition_not_blackhole.test
+++ b/mysql-test/t/partition_not_blackhole.test
@@ -19,7 +19,7 @@ SHOW TABLES;
--replace_result $MYSQLD_DATADIR ./
--error ER_NOT_FORM_FILE
SHOW CREATE TABLE t1;
---error ER_BAD_TABLE_ERROR
+--error ER_GET_ERRNO
DROP TABLE t1;
--list_files $MYSQLD_DATADIR/test t1*
--remove_file $MYSQLD_DATADIR/test/t1.frm
diff --git a/mysql-test/t/plugin.test b/mysql-test/t/plugin.test
index 0655aff9fc9..13e2c71fbc4 100644
--- a/mysql-test/t/plugin.test
+++ b/mysql-test/t/plugin.test
@@ -252,3 +252,16 @@ select plugin_name from information_schema.plugins where plugin_library like 'ha
uninstall soname 'ha_example';
select plugin_name from information_schema.plugins where plugin_library like 'ha_example%';
+
+--echo #
+--echo # MDEV-5309 - RENAME TABLE does not check for existence of the table's
+--echo # engine
+--echo #
+INSTALL PLUGIN example SONAME 'ha_example';
+CREATE TABLE t1(a INT) ENGINE=EXAMPLE;
+SELECT * FROM t1;
+FLUSH TABLES;
+UNINSTALL PLUGIN example;
+--error ER_NO_SUCH_TABLE
+RENAME TABLE t1 TO t2;
+DROP TABLE t1;
diff --git a/mysql-test/t/query_cache_ps_no_prot.test b/mysql-test/t/query_cache_ps_no_prot.test
index 16533c7194e..4b2bb842e34 100644
--- a/mysql-test/t/query_cache_ps_no_prot.test
+++ b/mysql-test/t/query_cache_ps_no_prot.test
@@ -16,12 +16,7 @@ let collation=utf8_unicode_ci;
--source include/have_collation.inc
# The file with expected results fits only to a run without
-# ps-protocol/sp-protocol/cursor-protocol/view-protocol.
-if (`SELECT $PS_PROTOCOL + $SP_PROTOCOL + $CURSOR_PROTOCOL
- + $VIEW_PROTOCOL > 0`)
-{
- --skip Test requires: ps-protocol/sp-protocol/cursor-protocol/view-protocol disabled
-}
+--source include/no_protocol.inc
# The main testing script
--source include/query_cache_sql_prepare.inc
diff --git a/mysql-test/t/range_innodb.test b/mysql-test/t/range_innodb.test
new file mode 100644
index 00000000000..f76794814ef
--- /dev/null
+++ b/mysql-test/t/range_innodb.test
@@ -0,0 +1,47 @@
+--echo #
+--echo # Range optimizer (and related) tests that need InnoDB.
+--echo #
+
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists t0, t1, t2;
+--enable_warnings
+
+--echo #
+--echo # MDEV-6735: Range checked for each record used with key
+--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 + D.a * 1000
+from t0 A, t0 B, t0 C, t0 D;
+
+create table t2 (
+ a int,
+ b int,
+ filler1 char(100),
+ filler2 char(100),
+ filler3 char(100),
+ filler4 char(100),
+ key(a),
+ key(b)
+) engine=innodb;
+
+insert into t2
+select
+ a,a,
+ repeat('0123456789', 10),
+ repeat('0123456789', 10),
+ repeat('0123456789', 10),
+ repeat('0123456789', 10)
+from t1;
+
+analyze table t2;
+--echo # The following must not use "Range checked for each record":
+explain select * from t0 left join t2 on t2.a <t0.a and t2.b between 50 and 250;
+
+drop table t0,t1,t2;
+
diff --git a/mysql-test/t/repair.test b/mysql-test/t/repair.test
index 5b78a352863..a6df0dc5979 100644
--- a/mysql-test/t/repair.test
+++ b/mysql-test/t/repair.test
@@ -210,3 +210,12 @@ repair table t1 use_frm;
select count(*) from t1;
check table t1;
drop table t1;
+
+#
+# MDEV-8115 mysql_upgrade crashes the server with REPAIR VIEW
+#
+create table t1 (a blob);
+create view v1 as select * from t1;
+repair view v1;
+drop view v1;
+drop table t1;
diff --git a/mysql-test/t/selectivity.test b/mysql-test/t/selectivity.test
index 77ee5f49bef..c46ff69295f 100644
--- a/mysql-test/t/selectivity.test
+++ b/mysql-test/t/selectivity.test
@@ -942,5 +942,34 @@ set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivit
drop table t0,t1,t2;
+--echo #
+--echo # Bug mdev-7316: a conjunct in WHERE with selectivity == 0
+--echo #
+
+CREATE TABLE t1 (a varchar(16), b int, PRIMARY KEY(a), KEY(b)) ENGINE=INNODB;
+INSERT INTO t1 VALUES
+ ('USAChinese',10), ('USAEnglish',20), ('USAFrench',30);
+
+CREATE TABLE t2 (i int) ENGINE=INNODB;
+INSERT INTO t2 VALUES
+ (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(1),(2),(3),(4);
+
+ANALYZE TABLE t1, t2;
+
+set use_stat_tables='preferably';
+set optimizer_use_condition_selectivity=3;
+
+EXPLAIN EXTENDED
+SELECT * FROM t1, t2
+ WHERE a <> 'USARussian' AND b IS NULL;
+
+SELECT * FROM t1, t2
+ WHERE a <> 'USARussian' AND b IS NULL;
+
+set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
+
+DROP TABLE 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 5674cb5c006..d6a77eac600 100644
--- a/mysql-test/t/selectivity_innodb.test
+++ b/mysql-test/t/selectivity_innodb.test
@@ -80,6 +80,36 @@ select * from t1 where col2 != true;
drop table t1;
--echo #
+--echo # MDEV-7413: optimizer_use_condition_selectivity > 2 crashes 10.0.15+maria-1~wheezy
+--echo #
+
+CREATE TABLE t1 (
+ parent_id int,
+ child_group_id int,
+ child_user_id int,
+ KEY (parent_id,child_group_id,child_user_id)
+) ENGINE=InnoDB;
+
+CREATE TABLE t2 (
+ id int,
+ lower_group_name varchar(255),
+ directory_id int(20),
+ UNIQUE KEY (directory_id)
+) ENGINE=InnoDB;
+
+CREATE TABLE t3 (id int) ENGINE=InnoDB;
+
+insert into t1 values (1,1,1),(2,2,2);
+insert into t2 values (10,'foo',10),(20,'bar',20);
+insert into t3 values (101),(102);
+set use_stat_tables = PREFERABLY, optimizer_use_condition_selectivity = 3;
+
+select * from t1, t2, t3
+where t1.child_user_id=t3.id and t1.child_group_id is null and t2.lower_group_name='foo' and t1.parent_id=t2.id and t2.directory_id=10;
+
+drop table t1,t2,t3;
+
+--echo #
--echo # End of 10.0 tests
--echo #
diff --git a/mysql-test/t/show_grants_with_plugin-7985.test b/mysql-test/t/show_grants_with_plugin-7985.test
new file mode 100644
index 00000000000..339c75c7c49
--- /dev/null
+++ b/mysql-test/t/show_grants_with_plugin-7985.test
@@ -0,0 +1,161 @@
+--source include/not_embedded.inc
+--enable_connect_log
+call mtr.add_suppression("password and an authentication plugin");
+
+--echo #
+--echo # Create a user with mysql_native_password plugin.
+--echo # The user has no password or auth_string set.
+--echo #
+
+create user u1;
+GRANT SELECT ON mysql.* to u1 IDENTIFIED VIA mysql_native_password;
+select user, host, password, plugin, authentication_string from mysql.user where user = 'u1';
+
+--echo #
+--echo # The user's grants should show no password at all.
+--echo #
+show grants for u1;
+--echo #
+--echo # Test to see if connecting with no password is succesful.
+--echo #
+--connect (con1, localhost, u1,,)
+show grants;
+--disconnect con1
+
+--connection default
+--echo #
+--echo # Test after flushing privileges.
+--echo #
+flush privileges;
+--connect (con1, localhost, u1,,)
+show grants;
+--disconnect con1
+
+--connection default
+--echo #
+--echo # Now add a mysql_native password string in authentication_string.
+--echo #
+# Password string is SOMETHING
+GRANT SELECT ON mysql.* to u1 IDENTIFIED VIA mysql_native_password
+USING '*7AFEFD08B6B720E781FB000CAA418F54FA662626';
+select user, host, password, plugin, authentication_string from mysql.user where user = 'u1';
+--echo #
+--echo # Test to see if connecting with password is succesful.
+--echo #
+--connect (con1, localhost, u1,'SOMETHING',)
+show grants;
+--disconnect con1
+
+--connection default
+--echo #
+--echo # Test after flushing privileges.
+--echo #
+flush privileges;
+--connect (con1, localhost, u1,'SOMETHING',)
+show grants;
+--disconnect con1
+--connection default
+
+--echo #
+--echo # Now we also set a password for the user.
+--echo #
+set password for u1 = PASSWORD('SOMETHINGELSE');
+select user, host, password, plugin, authentication_string from mysql.user where user = 'u1';
+
+--echo #
+--echo # Here we should use the password field, as that primes over
+--echo # the authentication_string field.
+--echo #
+show grants for u1;
+
+--echo #
+--echo # Logging in with the user's password should work.
+--echo #
+--connect (con1, localhost, u1,'SOMETHINGELSE',)
+show grants;
+--disconnect con1
+--connection default
+--echo #
+--echo # Reload privileges and test logging in again.
+--echo #
+flush privileges;
+show grants for u1;
+--echo #
+--echo # Here we connect via the user's password again.
+--echo #
+--connect (con1, localhost, u1,'SOMETHINGELSE',)
+show grants;
+--disconnect con1
+--connection default
+
+--echo #
+--echo # Now we remove the authentication plugin password, flush privileges and
+--echo # try again.
+--echo #
+update mysql.user set authentication_string = '' where user='u1';
+select user, host, password, plugin, authentication_string from mysql.user where user = 'u1';
+flush privileges;
+show grants for u1;
+--echo #
+--echo # Here we connect via the user's password.
+--echo #
+--connect (con1, localhost, u1,'SOMETHINGELSE',)
+select user, host, password, plugin, authentication_string from mysql.user where user = 'u1';
+--disconnect con1
+--connection default
+
+--echo #
+--echo # Try and set a wrong auth_string password, with mysql_native_password.
+--echo # Make sure it fails.
+--echo #
+--error ER_PASSWD_LENGTH
+GRANT USAGE ON *.* TO u1 IDENTIFIED VIA mysql_native_password USING 'asd';
+--echo #
+--echo # Now set a correct password.
+--echo #
+GRANT SELECT ON mysql.* to u1 IDENTIFIED VIA mysql_native_password
+USING '*7AFEFD08B6B720E781FB000CAA418F54FA662626';
+show grants for u1;
+
+--echo #
+--echo # Test if the user can now use that password instead.
+--echo #
+--connect (con1, localhost, u1,'SOMETHING',)
+show grants;
+--disconnect con1
+
+--echo #
+--echo # Test if the user can now use that password instead, after flushing privileges;
+--echo #
+--connection default
+flush privileges;
+
+--connect (con1, localhost, u1,'SOMETHING',)
+show grants;
+--disconnect con1
+--connection default
+
+--echo #
+--echo # Clear all passwords from the user.
+--echo #
+GRANT SELECT ON mysql.* to u1 IDENTIFIED VIA mysql_native_password;
+select user, host, password, plugin, authentication_string from mysql.user where user = 'u1';
+
+--echo #
+--echo # Test no password connect.
+--echo #
+--connect (con1, localhost, u1,,)
+show grants;
+--disconnect con1
+--connection default
+
+--echo #
+--echo # Test no password connect, after flushing privileges.
+--echo #
+flush privileges;
+--connect (con1, localhost, u1,,)
+show grants;
+--disconnect con1
+--connection default
+
+drop user u1;
diff --git a/mysql-test/t/sp-destruct.test b/mysql-test/t/sp-destruct.test
index e109f88e3f9..880bbce3d9d 100644
--- a/mysql-test/t/sp-destruct.test
+++ b/mysql-test/t/sp-destruct.test
@@ -278,3 +278,11 @@ DROP DATABASE db1;
--echo # Restore mysql.proc
DROP TABLE mysql.proc;
RENAME TABLE proc_backup TO mysql.proc;
+
+#
+# BUG#19875331 - HANDLE_FATAL_SIGNAL 11 IN STRMAKE
+#
+create database mysqltest1;
+create procedure mysqltest1.foo() select "foo";
+update mysql.proc set name='' where db='mysqltest1';
+drop database mysqltest1;
diff --git a/mysql-test/t/sp-innodb.test b/mysql-test/t/sp-innodb.test
index 228ab42544d..23715166a02 100644
--- a/mysql-test/t/sp-innodb.test
+++ b/mysql-test/t/sp-innodb.test
@@ -43,3 +43,120 @@ CALL p1();
drop procedure p1;
drop table t1,t2;
+
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
+
+--echo
+--echo #
+--echo # BUG 16041903: CONTINUE HANDLER NOT INVOKED
+--echo # IN A STORED FUNCTION AFTER A LOCK WAIT TIMEOUT
+--echo #
+
+--echo
+--echo # Save and set lock wait timeout
+SET @lock_wait_timeout_saved= @@lock_wait_timeout;
+SET @innodb_lock_wait_timeout_saved= @@innodb_lock_wait_timeout;
+SET @@lock_wait_timeout= 1;
+SET @@innodb_lock_wait_timeout= 1;
+
+--echo
+--echo # Create a function with exit handler:
+DELIMITER //;
+CREATE FUNCTION f1() RETURNS VARCHAR(20)
+BEGIN
+ DECLARE EXIT HANDLER FOR SQLSTATE '42S02' RETURN 'No such table';
+ INSERT INTO no_such_table VALUES (1);
+END//
+
+--echo
+--echo # Create a function calling f1():
+CREATE FUNCTION f2() RETURNS VARCHAR(20)
+BEGIN
+ RETURN f1();
+END//
+
+--echo
+--echo # Create a function provoking deadlock:
+CREATE FUNCTION f3() RETURNS VARCHAR(20)
+BEGIN
+ UPDATE t1 SET i= 1 WHERE i= 1;
+ RETURN 'Will never get here';
+END//
+
+--echo
+--echo # Create a function calling f3, to create
+--echo # a deadlock indirectly:
+CREATE FUNCTION f4() RETURNS VARCHAR(20)
+BEGIN
+ RETURN f3();
+END//
+DELIMITER ;//
+
+--echo
+--echo # Open another connection, create and initialize a table
+--echo # to be used for provoking deadlock, put a lock on the table:
+connect (con1,localhost,root,,);
+CREATE TABLE t1 (i INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+SET AUTOCOMMIT= 0;
+UPDATE t1 SET i=1 WHERE i=1;
+
+--echo
+--echo # On the default connection, do an update to provoke a
+--echo # deadlock, then call the function with handler. This case
+--echo # fails without the patch (with error ER_NO_SUCH_TABLE):
+--connection default
+SET AUTOCOMMIT= 0;
+--error ER_LOCK_WAIT_TIMEOUT
+UPDATE t1 SET i=1 WHERE i=1;
+SELECT f1() AS 'f1():';
+
+--echo
+--echo # Provoke another deadlock, then call the function with
+--echo # handler indirectly. This case fails without the patch
+--echo # (with error ER_NO_SUCH_TABLE):
+--error ER_LOCK_WAIT_TIMEOUT
+UPDATE t1 SET i= 1 WHERE i= 1;
+SELECT f2() AS 'f2():';
+
+--echo
+--echo # Provoke yet another deadlock, but now from within a function,
+--echo # then call the function with handler. This succeeds even
+--echo # without the patch because is_fatal_sub_stmt_error is reset
+--echo # in restore_sub_stmt after the failing function has been
+--echo # executed. The test case is included anyway for better coverage:
+--error ER_LOCK_WAIT_TIMEOUT
+SELECT f3() AS 'f3():';
+SELECT f1() AS 'f1():';
+
+--echo # Provoke yet another deadlock, but now from within a function,
+--echo # calling another function, then call the function with handler.
+--echo # This succeeds even without the patch because
+--echo # is_fatal_sub_stmt_error is reset in restore_sub_stmt after
+--echo # the failing function has been executed. The test case is
+--echo # included anyway for better coverage:
+--error ER_LOCK_WAIT_TIMEOUT
+SELECT f4() AS 'f4():';
+SELECT f1() AS 'f1():';
+
+--echo
+--echo # Disconnect, drop functions and table:
+--disconnect con1
+DROP FUNCTION f4;
+DROP FUNCTION f3;
+DROP FUNCTION f2;
+DROP FUNCTION f1;
+DROP TABLE t1;
+
+--echo
+--echo # Reset lock wait timeouts
+SET @@lock_wait_timeout= @lock_wait_timeout_saved;
+SET @@innodb_lock_wait_timeout= @innodb_lock_wait_timeout_saved;
+
+--echo #
+--echo # BUG 16041903: End of test case
+--echo #
+
+# Wait till we reached the initial number of concurrent sessions
+--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/sp_notembedded.test b/mysql-test/t/sp_notembedded.test
index 42a3dd193c4..2a24ab3d005 100644
--- a/mysql-test/t/sp_notembedded.test
+++ b/mysql-test/t/sp_notembedded.test
@@ -462,6 +462,26 @@ DROP EVENT teste_bug11763507;
--echo # ------------------------------------------------------------------
#
+# A case of SHOW GRANTS
+# (creating a new procedure changes the password)
+#
+grant create routine on test.* to foo1@localhost identified by 'foo';
+update mysql.user set password = replace(password, '*', '-') where user='foo1';
+--connect (foo,localhost,foo1,foo)
+show grants;
+--connection default
+flush privileges;
+--connection foo
+show grants;
+create procedure spfoo() select 1;
+show grants;
+
+--connection default
+--disconnect foo
+drop procedure spfoo;
+drop user foo1@localhost;
+
+#
# Restore global concurrent_insert value. Keep in the end of the test file.
#
diff --git a/mysql-test/t/ssl.test b/mysql-test/t/ssl.test
index 988a9d6c056..0d14ad82692 100644
--- a/mysql-test/t/ssl.test
+++ b/mysql-test/t/ssl.test
@@ -25,11 +25,14 @@ SHOW STATUS LIKE 'Ssl_server_not_after';
--replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA
SHOW STATUS LIKE 'Ssl_cipher';
+#
+# MDEV-7697 Client reports ERROR 2006 (MySQL server has gone away) or ERROR 2013 (Lost connection to MySQL server during query) while executing AES* functions under SSL
+#
+select aes_decrypt('MySQL','adf');
+select 'still connected?';
+
connection default;
disconnect ssl_con;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc
-
-## This test file is for testing encrypted communication only, not other
-## encryption routines that the SSL library happens to provide!
diff --git a/mysql-test/t/ssl_7937.combinations b/mysql-test/t/ssl_7937.combinations
new file mode 100644
index 00000000000..46a45686a9b
--- /dev/null
+++ b/mysql-test/t/ssl_7937.combinations
@@ -0,0 +1,5 @@
+[ssl]
+--loose-enable-ssl
+
+[nossl]
+--loose-disable-ssl
diff --git a/mysql-test/t/ssl_7937.test b/mysql-test/t/ssl_7937.test
new file mode 100644
index 00000000000..d593b9d936d
--- /dev/null
+++ b/mysql-test/t/ssl_7937.test
@@ -0,0 +1,35 @@
+#
+# MDEV-7937: Enforce SSL when --ssl client option is used
+#
+
+source include/have_ssl_crypto_functs.inc;
+
+# create a procedure instead of SHOW STATUS LIKE 'ssl_cipher'
+# because the cipher depends on openssl (or yassl) version,
+# and it's actual value doesn't matter here anyway
+create procedure have_ssl()
+ select if(variable_value > '','yes','no') as 'have_ssl'
+ from information_schema.session_status
+ where variable_name='ssl_cipher';
+
+--disable_abort_on_error
+--echo mysql --ssl-ca=cacert.pem -e "call test.have_ssl()"
+--exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem -e "call test.have_ssl()" 2>&1
+--echo mysql --ssl -e "call test.have_ssl()"
+--exec $MYSQL --ssl -e "call test.have_ssl()" 2>&1
+--echo mysql --ssl-ca=cacert.pem --ssl-verify-server-cert -e "call test.have_ssl()"
+--exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-verify-server-cert -e "call test.have_ssl()" 2>&1
+
+--echo mysql --ssl --ssl-verify-server-cert -e "call test.have_ssl()"
+# this is the test where certificate verification fails.
+# but yassl doesn't support certificate verification, so
+# we fake the test result for yassl
+let yassl=`select variable_value='Unknown' from information_schema.session_status where variable_name='Ssl_session_cache_mode'`;
+if (!$yassl) {
+ --exec $MYSQL --ssl --ssl-verify-server-cert -e "call test.have_ssl()" 2>&1
+}
+if ($yassl) {
+ --echo ERROR 2026 (HY000): SSL connection error: Failed to verify the server certificate
+}
+
+drop procedure have_ssl;
diff --git a/mysql-test/t/ssl_timeout.test b/mysql-test/t/ssl_timeout.test
new file mode 100644
index 00000000000..0d96b3f6601
--- /dev/null
+++ b/mysql-test/t/ssl_timeout.test
@@ -0,0 +1,21 @@
+--source include/have_ssl_communication.inc
+
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
+
+--echo # connect with read timeout so SLEEP() should timeout
+connect (ssl_con,localhost,root,,,,,SSL read_timeout=5);
+
+--echo # Check ssl turned on
+--replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA
+SHOW STATUS LIKE 'Ssl_cipher';
+
+# --error CR_SERVER_LOST
+--error 2013
+SELECT SLEEP(600);
+
+connection default;
+disconnect ssl_con;
+
+# Wait till all disconnects are completed
+--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/subselect_sj.test b/mysql-test/t/subselect_sj.test
index 2c60e5645c3..c989cb22558 100644
--- a/mysql-test/t/subselect_sj.test
+++ b/mysql-test/t/subselect_sj.test
@@ -2693,5 +2693,16 @@ SET join_cache_level=@tmp_mdev5059;
set optimizer_switch=@tmp_os_mdev5059;
DROP TABLE t1,t2,t3,t4;
+--echo #
+--echo # MDEV-7911: crash in Item_cond::eval_not_null_tables
+--echo #
+
+create table t1(a int);
+insert into t1 values(1),(2),(3),(null);
+--error ER_CANT_AGGREGATE_2COLLATIONS
+explain
+select 1 from t1 where _cp932 "1" in (select '1' from t1);
+drop table t1;
+
# The following command must be the last one the file
set optimizer_switch=@subselect_sj_tmp;
diff --git a/mysql-test/t/subselect_sj2.test b/mysql-test/t/subselect_sj2.test
index a82baf095c1..0bf9c6d9d10 100644
--- a/mysql-test/t/subselect_sj2.test
+++ b/mysql-test/t/subselect_sj2.test
@@ -1320,5 +1320,76 @@ SELECT * FROM t1 WHERE id in (select distinct id_agente from t2);
DROP TABLE t1, t2;
+--echo #
+--echo # MDEV-7474: Semi-Join's DuplicateWeedout strategy skipped for some values of optimizer_search_depth
+--echo #
+
+CREATE TABLE t1 (
+ t1id BIGINT(20) NOT NULL,
+ code VARCHAR(20),
+ PRIMARY KEY (t1id)
+) COLLATE='utf8mb4_bin' ENGINE=InnoDB;
+
+CREATE TABLE t2 (
+ t2id BIGINT(20) NOT NULL,
+ t1idref BIGINT(20) NOT NULL,
+ code VARCHAR(20),
+ PRIMARY KEY (t2id),
+ INDEX FK_T2_T1Id (t1idref),
+ CONSTRAINT FK_T2_T1Id FOREIGN KEY (t1idref) REFERENCES t1 (t1id)
+) COLLATE='utf8mb4_bin' ENGINE=InnoDB;
+
+CREATE TABLE t3 (
+ t3idref BIGINT(20) NOT NULL,
+ t2idref BIGINT(20) NOT NULL,
+ sequencenumber INT(10) NOT NULL,
+ PRIMARY KEY (t3idref, t2idref),
+ INDEX FK_T3_T2Id (t2idref),
+ CONSTRAINT FK_T3_T2Id FOREIGN KEY (t2idref) REFERENCES t2 (t2id)
+) COLLATE='utf8mb4_bin' ENGINE=InnoDB;
+
+# Load up dummy data (needed to reproduce issue)
+INSERT INTO t1 (t1id) VALUES (100001),(100017),(100018),(100026),(100027),(100028),(100029),(100030),
+(100031),(100032),(100033),(100034),(100035),(100036),(100037),(100038),(100040),(100041),(100042),
+(100043),(100044),(100045),(100046),(100047);
+
+INSERT IGNORE INTO t2 (t2id, t1idref) SELECT t1id, t1id FROM t1;
+
+# Now the test Data
+INSERT IGNORE INTO t1 VALUES (200001, 'a');
+INSERT IGNORE INTO t2 (t2id, t1idref) VALUES (200011, 200001),(200012, 200001),(200013, 200001);
+INSERT IGNORE INTO t3 VALUES (1, 200011, 1), (1, 200012, 2), (1, 200013, 3);
+
+set @tmp7474= @@optimizer_search_depth;
+SET SESSION optimizer_search_depth = 1;
+
+let $query=
+SELECT SQL_NO_CACHE
+T2_0_.t1idref,
+T2_0_.t2id
+FROM
+ t2 T2_0_
+WHERE
+ T2_0_.t1idref IN (
+ SELECT
+ T1_1_.t1id
+ FROM
+ t3 T3_0_
+ INNER JOIN
+ t2 T2_1_
+ ON T3_0_.t2idref=T2_1_.t2id
+ INNER JOIN
+ t1 T1_1_
+ ON T2_1_.t1idref=T1_1_.t1id
+ WHERE
+ T3_0_.t3idref= 1
+);
+
+eval $query;
+eval explain $query;
+
+drop table t3,t2,t1;
+set optimizer_search_depth=@tmp7474;
+
--echo # This must be the last in the file:
set optimizer_switch=@subselect_sj2_tmp;
diff --git a/mysql-test/t/subselect_sj_mat.test b/mysql-test/t/subselect_sj_mat.test
index 912e9d5befd..c34c805f90c 100644
--- a/mysql-test/t/subselect_sj_mat.test
+++ b/mysql-test/t/subselect_sj_mat.test
@@ -1843,3 +1843,45 @@ drop database mysqltest4;
--echo # End of 5.5 tests
+--echo #
+--echo # MDEV-7220: Materialization strategy is not used for REPLACE ... SELECT
+--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, b int, c int);
+insert into t1
+select A.a+B.a*10+C.a*100, A.a+B.a*10+C.a*100, A.a+B.a*10+C.a*100
+from t0 A, t0 B, t0 C;
+
+create table t2 (a int, b int, c int);
+insert into t2 select A.a, A.a, A.a from t1 A;
+insert into t2 select * from t2;
+insert into t2 select * from t2;
+
+create table t3 as select * from t2 limit 1;
+
+--echo # The testcase only makes sense if the following uses Materialization:
+explain
+select * from t1 where (a,b) in (select max(a),b from t2 group by b);
+
+flush status;
+replace into t3
+select * from t1 where (a,b) in (select max(a),b from t2 group by b);
+--echo # Sequential reads:
+--echo # 1K is read from t1
+--echo # 4K is read from t2
+--echo # 1K groups is read from the tmp. table
+--echo #
+--echo # Lookups:
+--echo # 4K lookups in group by table
+--echo # 1K lookups in temp.table
+--echo #
+--echo # Writes:
+--echo # 2x 1K writes to temporary tables (grouping table and subquery materialization table
+--echo #
+--echo # The point is that neither counter should be in the millions (this
+--echo # will happen if Materialization is not used
+show status where Variable_name like 'Handler_read%' or Variable_name like 'Handler_%write%';
+
+drop table t0,t1,t2,t3;
diff --git a/mysql-test/t/table_elim.test b/mysql-test/t/table_elim.test
index 0d42dca57b7..24f48206013 100644
--- a/mysql-test/t/table_elim.test
+++ b/mysql-test/t/table_elim.test
@@ -610,3 +610,34 @@ SELECT t1.alpha3 FROM t1 LEFT JOIN ( t2 LEFT JOIN t3 ON t2.t3_code = t3.code )
DROP TABLE t1, t2, t3;
SET optimizer_switch=@save_optimizer_switch;
+
+--echo #
+--echo # MDEV-7893: table_elimination works wrong with on computed expression and compound unique key
+--echo # (just a testcase)
+CREATE TABLE t1 (
+ PostID int(10) unsigned NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+INSERT INTO t1 (PostID) VALUES (1), (2);
+
+CREATE TABLE t2 (
+ VoteID int(10) unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ EntityID int(10) unsigned NOT NULL,
+ UserID int(10) unsigned NOT NULL,
+ UNIQUE KEY EntityID (EntityID,UserID)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+INSERT INTO t2 (EntityID, UserID) VALUES (1, 30), (2, 30);
+
+SELECT t1.*, T.Voted as Voted
+FROM
+t1 LEFT JOIN (
+ SELECT 1 AS Voted, EntityID
+ FROM t2
+ WHERE t2.UserID = '20' ) AS T
+ ON T.EntityID = t1.PostID
+WHERE t1.PostID='1'
+LIMIT 1;
+
+DROP TABLE t1,t2;
+
diff --git a/mysql-test/t/table_keyinfo-6838.test b/mysql-test/t/table_keyinfo-6838.test
new file mode 100644
index 00000000000..5f4c9f44f86
--- /dev/null
+++ b/mysql-test/t/table_keyinfo-6838.test
@@ -0,0 +1,18 @@
+# Test case for MDEV-6838.
+# Due to incorrect key_length computation, this usecase failed with the error
+# Using too big key for internal temp table.
+
+CREATE TABLE t1 (i INT, state VARCHAR(997)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (2,'Louisiana'),(9,'Maine');
+
+CREATE TABLE t2 (state VARCHAR(997), j INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES ('Louisiana',9),('Alaska',5);
+INSERT INTO t2 SELECT t2.* FROM t2 JOIN t2 AS t3 JOIN t2 AS t4 JOIN t2 AS t5 JOIN t2 AS t6;
+
+SET @@max_heap_table_size= 16384;
+set @@optimizer_switch='derived_merge=OFF';
+set @@optimizer_switch='extended_keys=ON';
+
+SELECT * FROM t1 AS t1_1 LEFT JOIN ( t1 AS t1_2 INNER JOIN (SELECT * FROM t2) v2 ON t1_2.i = j ) ON t1_1.state = v2.state LIMIT 1;
+
+DROP TABLE t1, t2;
diff --git a/mysql-test/t/tmp_table_count-7586.test b/mysql-test/t/tmp_table_count-7586.test
new file mode 100644
index 00000000000..e7bac127815
--- /dev/null
+++ b/mysql-test/t/tmp_table_count-7586.test
@@ -0,0 +1,56 @@
+# MDEV-7586 regression test.
+# Test if created_tmp_tables status variable is correctly incremented.
+--source include/have_perfschema.inc
+--source include/not_embedded.inc
+
+create table t2 (a int);
+insert into t2 values (1),(2),(3);
+create view v2 as select a from t2;
+
+flush status;
+select * from v2;
+show status like '%Created_tmp%';
+
+explain select * from v2;
+
+select * from (select * from t2) T1;
+show status like '%Created_tmp%';
+
+explain select * from (select * from t2) T1;
+
+
+drop view v2;
+drop table t2;
+
+
+--disable_ps_protocol
+
+CREATE TABLE t1(a int);
+INSERT INTO t1 values(1),(2);
+CREATE TABLE t2(a int);
+INSERT INTO t2 values(1),(2);
+
+EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT * FROM t2 GROUP BY a HAVING a > 1);
+truncate table performance_schema.events_statements_history_long;
+flush status;
+CREATE TABLE t3 SELECT * FROM t1 WHERE a IN (SELECT * FROM t2 GROUP BY a HAVING a > 1);
+--echo # Performance schema should be the same as "Created_tmp_tables" variable below
+select sum(created_tmp_tables) from performance_schema.events_statements_history_long;
+show status like '%Created_tmp%';
+drop table t3;
+
+EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT * FROM t2 GROUP BY a);
+truncate table performance_schema.events_statements_history_long;
+flush status;
+CREATE TABLE t3 SELECT * FROM t1 WHERE a IN (SELECT * FROM t2 GROUP BY a);
+--echo # Performance schema should be the same as "Created_tmp_tables" variable below
+select sum(created_tmp_tables) from performance_schema.events_statements_history_long;
+show status like '%Created_tmp%';
+
+drop table t1,t2,t3;
+
+truncate table performance_schema.events_statements_history_long;
+flush status;
+--echo # Performance schema should be the same as "Created_tmp_tables" variable below
+select sum(created_tmp_tables) from performance_schema.events_statements_history_long;
+show status like '%Created_tmp%';
diff --git a/mysql-test/t/trigger-trans.test b/mysql-test/t/trigger-trans.test
index 82bee7aa224..c17202055e1 100644
--- a/mysql-test/t/trigger-trans.test
+++ b/mysql-test/t/trigger-trans.test
@@ -2,6 +2,9 @@
# (or just InnoDB storage engine)
--source include/have_innodb.inc
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
+
--disable_warnings
drop table if exists t1;
--enable_warnings
@@ -182,3 +185,54 @@ insert into t1 values ( 654, 'a'), ( 654, 'b'), ( 654, 'c'),
select * from t2 order by b;
drop trigger t1_after_insert;
drop table t1,t2;
+
+--echo #
+--echo #Bug#19683834 SOME INNODB ERRORS CAUSES STORED FUNCTION
+--echo # AND TRIGGER HANDLERS TO BE IGNORED
+
+--echo #Code fixed in Bug#16041903
+--enable_connect_log
+
+CREATE TABLE t1 (id int unsigned PRIMARY KEY, val int DEFAULT 0)
+ENGINE=InnoDB;
+INSERT INTO t1 (id) VALUES (1), (2);
+
+CREATE TABLE t2 (id int PRIMARY KEY);
+CREATE TABLE t3 LIKE t2;
+
+# Trigger with continue handler for ER_DUP_ENTRY(1062)
+DELIMITER //;
+CREATE TRIGGER bef_insert BEFORE INSERT ON t2 FOR EACH ROW
+BEGIN
+ DECLARE CONTINUE HANDLER FOR 1062 BEGIN END;
+ INSERT INTO t3 (id) VALUES (NEW.id);
+ INSERT INTO t3 (id) VALUES (NEW.id);
+END//
+DELIMITER ;//
+
+# Transaction 1: Grab locks on t1
+START TRANSACTION;
+UPDATE t1 SET val = val + 1;
+
+# Transaction 2:
+--connect (con2,localhost,root,,test,,)
+SET SESSION innodb_lock_wait_timeout = 2;
+# Trigger lock timeout (1205)
+--error ER_LOCK_WAIT_TIMEOUT
+UPDATE t1 SET val = val + 1;
+
+# This insert should go through, as the continue handler should
+# handle ER_DUP_ENTRY, even after ER_LOCK_WAIT_TIMEOUT (Bug#16041903)
+INSERT INTO t2 (id) VALUES (1);
+
+# Cleanup
+disconnect con2;
+--source include/wait_until_disconnected.inc
+connection default;
+
+DROP TABLE t3, t2, t1;
+
+--disable_connect_log
+
+# Wait till we reached the initial number of concurrent sessions
+--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/truncate-stale-6500.test b/mysql-test/t/truncate-stale-6500.test
new file mode 100644
index 00000000000..47dffb1966d
--- /dev/null
+++ b/mysql-test/t/truncate-stale-6500.test
@@ -0,0 +1,32 @@
+--source include/have_innodb.inc
+--source include/have_partition.inc
+
+SET GLOBAL query_cache_size=1024*1024*8;
+CREATE TABLE `test` (
+ `uniqueId` INT NOT NULL,
+ `partitionId` INT NOT NULL,
+ PRIMARY KEY (`uniqueId`,`partitionId`)
+) ENGINE=InnoDB PARTITION BY LIST (partitionId) (
+ PARTITION p01 VALUES IN (1),
+ PARTITION p02 VALUES IN (2)
+);
+
+
+INSERT INTO `test`(`uniqueId`,`partitionId`) VALUES(407237055, 2);
+
+SELECT * FROM `test`;
+
+--echo #Confirms 1 row in partition 'p02'
+SELECT TABLE_NAME, PARTITION_NAME, TABLE_ROWS FROM information_schema.PARTITIONS where TABLE_NAME = 'test';
+ALTER TABLE `test` TRUNCATE PARTITION `p02`;
+
+--echo #Confirms no more rows in partition 'p02'
+SELECT TABLE_NAME, PARTITION_NAME, TABLE_ROWS FROM information_schema.PARTITIONS where TABLE_NAME = 'test';
+
+--echo #Before the patch, this returned the previously existing values.
+SELECT * FROM `test`;
+SELECT SQL_CACHE * FROM `test`;
+SELECT SQL_NO_CACHE * FROM `test`;
+
+DROP TABLE test;
+SET GLOBAL query_cache_size=DEFAULT;
diff --git a/mysql-test/t/type_decimal.test b/mysql-test/t/type_decimal.test
index 1d4ef345747..659e75270ca 100644
--- a/mysql-test/t/type_decimal.test
+++ b/mysql-test/t/type_decimal.test
@@ -583,3 +583,27 @@ JOIN
WHERE CONCAT(t1.col1, CAST(subq.col0 AS DECIMAL));
DROP TABLE t1, t2;
+
+
+--echo #
+--echo # Start of 5.5 tests
+--echo #
+
+--echo #
+--echo # MDEV-8267 Add /*old*/ comment into I_S.COLUMN_TYPE for old DECIMAL
+--echo #
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+
+--copy_file std_data/old_decimal/t1dec102.frm $MYSQLD_DATADIR/test/t1dec102.frm
+--copy_file std_data/old_decimal/t1dec102.MYD $MYSQLD_DATADIR/test/t1dec102.MYD
+--copy_file std_data/old_decimal/t1dec102.MYI $MYSQLD_DATADIR/test/t1dec102.MYI
+
+SHOW CREATE TABLE t1dec102;
+SHOW COLUMNS FROM t1dec102;
+SELECT COLUMN_NAME, DATA_TYPE, COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='t1dec102';
+DROP TABLE t1dec102;
+
+--echo #
+--echo # End of 5.5 tests
+--echo #
diff --git a/mysql-test/t/type_timestamp.test b/mysql-test/t/type_timestamp.test
index 77ce8c595ca..195252a2df9 100644
--- a/mysql-test/t/type_timestamp.test
+++ b/mysql-test/t/type_timestamp.test
@@ -492,4 +492,31 @@ drop function f1;
set timestamp=0;
SET time_zone=DEFAULT;
+--echo #
+--echo # MDEV-7778 impossible create copy of table, if table contain default value for timestamp field
+--echo #
+
+SET sql_mode="NO_ZERO_DATE";
+CREATE TABLE t1 (
+ ts timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
+);
+CREATE TABLE t2 AS SELECT * from t1 LIMIT 0;
+SHOW CREATE TABLE t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+SET sql_mode=DEFAULT;
+
+--echo #
+--echo # MDEV-8082 ON UPDATE is not preserved by CREATE TABLE .. SELECT
+--echo #
+CREATE TABLE t1 (
+ vc VARCHAR(10) NOT NULL DEFAULT 'test',
+ ts timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP
+);
+CREATE TABLE t2 AS SELECT * FROM t1 LIMIT 0;
+SHOW CREATE TABLE t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+
--echo End of 10.0 tests
diff --git a/mysql-test/t/uniques_crash-7912.test b/mysql-test/t/uniques_crash-7912.test
new file mode 100644
index 00000000000..8dc82f8f540
--- /dev/null
+++ b/mysql-test/t/uniques_crash-7912.test
@@ -0,0 +1,26 @@
+#
+# MDEV-7912
+#
+# multitable delete with wrongly set sort_buffer_size crashes in merge_buffers
+
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/windows.inc
+
+call mtr.add_suppression("Out of memory");
+
+set sql_mode="";
+--disable_warnings
+drop table if exists t1,t2;
+create table `t1` (`a` datetime not null) engine=InnoDB;
+create table `t2` (`a` int not null) engine=innodb;
+replace into t1 values (),();
+insert into t2 values(0);
+set session sort_buffer_size = 1024*1024*1024*1024;
+#Either fail with EE_OUTOFMEMORY, or succeed
+--error 0 , 5
+delete d2 from t2 as d1, t1 as d2 where d1.a <=> d2.a;
+--enable_warnings
+
+drop table t2;
+drop table t1;
diff --git a/mysql-test/t/update_innodb.test b/mysql-test/t/update_innodb.test
new file mode 100644
index 00000000000..67c356c4e2e
--- /dev/null
+++ b/mysql-test/t/update_innodb.test
@@ -0,0 +1,39 @@
+--source include/have_innodb.inc
+
+CREATE TABLE `t1` (
+ `c1` int(11) NOT NULL,
+ `c2` datetime DEFAULT NULL,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE TABLE `t2` (
+ `c0` varchar(10) NOT NULL,
+ `c1` int(11) NOT NULL,
+ `c2` int(11) NOT NULL,
+ PRIMARY KEY (`c0`,`c1`),
+ KEY `c1` (`c1`),
+ KEY `c2` (`c2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE TABLE `t3` (
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+ `c1` datetime NOT NULL,
+ `c2` bigint(20) NOT NULL,
+ `c3` int(4) unsigned NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `c2` (`c2`),
+ KEY `c3` (`c3`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE TABLE `t4` (
+ `c1` int(11) NOT NULL,
+ `c2` bigint(20) DEFAULT NULL,
+ `c3` int(11) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+ CREATE ALGORITHM=UNDEFINED VIEW `v1` AS select `t4`.`c1` AS `c1`,`t4`.`c2` AS `c2`,`t4`.`c3` AS `c3` from `t4`;
+
+UPDATE t1 a JOIN t2 b ON a.c1 = b.c1 JOIN v1 vw ON b.c2 = vw.c1 JOIN t3 del ON vw.c2 = del.c2 SET a.c2 = ( SELECT max(t.c1) FROM t3 t, v1 i WHERE del.c2 = t.c2 AND vw.c3 = i.c3 AND t.c3 = 4 ) WHERE a.c2 IS NULL OR a.c2 < '2011-05-01';
+
+drop view v1;
+drop table t1,t2,t3,t4;
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index ae78d5504cf..e95194e3f2c 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -5345,6 +5345,41 @@ create view v1 as select 1;
drop view v1;
+--echo #
+--echo # MDEV-7260: Crash in get_best_combination when executing multi-table
+--echo # UPDATE with nested views
+--echo #
+
+CREATE TABLE `t1` (`id` bigint(20));
+
+INSERT INTO `t1` VALUES (1),(2);
+
+CREATE TABLE `t2` (`id` bigint(20));
+
+CREATE TABLE `t3` (`id` bigint(20), `flag` tinyint(4));
+
+create view v1 as select id from t1;
+
+create view v2 as select t2.* from (t2 left join v1 using (id));
+
+update t3 left join v2 using (id) set flag=flag+1;
+
+drop view v2, v1;
+drop table t1, t2, t3;
+
+--echo #
+--echo # MDEV-7207 - ALTER VIEW does not change ALGORITM
+--echo #
+create table t1 (a int, b int);
+create algorithm=temptable view v2 (c) as select b+1 from t1;
+show create view v2;
+alter algorithm=undefined view v2 (c) as select b+1 from t1;
+show create view v2;
+alter algorithm=merge view v2 (c) as select b+1 from t1;
+show create view v2;
+drop view v2;
+drop table t1;
+
--echo # -----------------------------------------------------------------
--echo # -- End of 5.5 tests.
--echo # -----------------------------------------------------------------
diff --git a/mysql-test/t/view_alias.test b/mysql-test/t/view_alias.test
index b155ba6c2a9..09d707296bb 100644
--- a/mysql-test/t/view_alias.test
+++ b/mysql-test/t/view_alias.test
@@ -90,3 +90,12 @@ eval CREATE VIEW v1 AS $query;
DROP VIEW v1;
DROP TABLE t1, t2;
+
+#
+# MDEV-7482 VIEW containing INTERVAL(...)
+#
+create view v1 as select interval(55,10) as my_col;
+show create view v1;
+select * from v1;
+drop view v1;
+
diff --git a/mysys/md5_compute.cc b/mysys/md5_compute.cc
deleted file mode 100644
index 7b1591d91b7..00000000000
--- a/mysys/md5_compute.cc
+++ /dev/null
@@ -1,68 +0,0 @@
-/* Copyright (c) 2012, 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; if not, write to the Free Software Foundation,
- 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
-
-
-/**
- @file
-
- @brief
- Wrapper functions for OpenSSL, YaSSL and MySQL's MD5
- implementations. Also provides a Compatibility layer
- to make available YaSSL's MD5 implementation.
-*/
-
-#include <my_global.h>
-#include <my_md5.h>
-
-#ifdef HAVE_YASSL
-
-#include "md5.hpp"
-
-/**
- Compute MD5 message digest.
-
- @param digest [out] Computed MD5 digest
- @param buf [in] Message to be computed
- @param len [in] Length of the message
-
- @return void
-*/
-void my_md5_hash(char *digest, const char *buf, int len)
-{
- TaoCrypt::MD5 hasher;
- hasher.Update((TaoCrypt::byte *) buf, len);
- hasher.Final((TaoCrypt::byte *) digest);
-}
-#endif /* HAVE_YASSL */
-
-
-/**
- Wrapper function to compute MD5 message digest.
-
- @param digest [out] Computed MD5 digest
- @param buf [in] Message to be computed
- @param len [in] Length of the message
-
- @return void
-*/
-void compute_md5_hash(char *digest, const char *buf, int len)
-{
-#ifdef HAVE_YASSL
- my_md5_hash(digest, buf, len);
-#else
- MY_MD5_HASH((unsigned char *) digest, (unsigned char const *) buf, len);
-#endif /* HAVE_YASSL */
-}
-
diff --git a/mysys/my_default.c b/mysys/my_default.c
index 0bd76a1cff0..8faee000a6a 100644
--- a/mysys/my_default.c
+++ b/mysys/my_default.c
@@ -843,7 +843,7 @@ static int search_default_file_with_ext(Process_option_func opt_handler,
ptr, name, line)))
goto err;
- if (!(search_dir= my_dir(ptr, MYF(MY_WME))))
+ if (!(search_dir= my_dir(ptr, MYF(MY_WME | MY_WANT_SORT))))
goto err;
for (i= 0; i < (uint) search_dir->number_of_files; i++)
diff --git a/mysys/psi_noop.c b/mysys/psi_noop.c
index 2a351b5dd8d..6eecf56f797 100644
--- a/mysys/psi_noop.c
+++ b/mysys/psi_noop.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2011, 2015, 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
@@ -629,18 +629,17 @@ digest_start_noop(PSI_statement_locker *locker NNN)
return NULL;
}
-static PSI_digest_locker*
-digest_add_token_noop(PSI_digest_locker *locker NNN,
- uint token NNN,
- struct OPAQUE_LEX_YYSTYPE *yylval NNN)
+static void
+digest_end_noop(PSI_digest_locker *locker NNN,
+ const struct sql_digest_storage *digest NNN)
{
- return NULL;
+ return;
}
static int
-set_thread_connect_attrs_noop(const char *buffer __attribute__((unused)),
- uint length __attribute__((unused)),
- const void *from_cs __attribute__((unused)))
+set_thread_connect_attrs_noop(const char *buffer NNN,
+ uint length NNN,
+ const void *from_cs NNN)
{
return 0;
}
@@ -742,7 +741,7 @@ static PSI PSI_noop=
set_socket_info_noop,
set_socket_thread_owner_noop,
digest_start_noop,
- digest_add_token_noop,
+ digest_end_noop,
set_thread_connect_attrs_noop
};
diff --git a/mysys_ssl/my_aes.cc b/mysys_ssl/my_aes.cc
index 9327bc32a3b..05dbfdb4f0b 100644
--- a/mysys_ssl/my_aes.cc
+++ b/mysys_ssl/my_aes.cc
@@ -24,6 +24,7 @@
#elif defined(HAVE_OPENSSL)
#include <openssl/aes.h>
#include <openssl/evp.h>
+#include <openssl/err.h>
// Wrap C struct, to ensure resources are released.
struct MyCipherCtx
@@ -165,14 +166,17 @@ int my_aes_encrypt(const char* source, int source_length, char* dest,
#elif defined(HAVE_OPENSSL)
if (! EVP_EncryptInit(&ctx.ctx, EVP_aes_128_ecb(),
(const unsigned char *) rkey, NULL))
- return AES_BAD_DATA; /* Error */
+ goto err;
if (! EVP_EncryptUpdate(&ctx.ctx, (unsigned char *) dest, &u_len,
(unsigned const char *) source, source_length))
- return AES_BAD_DATA; /* Error */
+ goto err;
if (! EVP_EncryptFinal(&ctx.ctx, (unsigned char *) dest + u_len, &f_len))
- return AES_BAD_DATA; /* Error */
+ goto err;
return u_len + f_len;
+err:
+ ERR_remove_state(0);
+ return AES_BAD_DATA;
#endif
}
@@ -248,13 +252,16 @@ int my_aes_decrypt(const char *source, int source_length, char *dest,
#elif defined(HAVE_OPENSSL)
if (! EVP_DecryptInit(&ctx.ctx, EVP_aes_128_ecb(),
(const unsigned char *) rkey, NULL))
- return AES_BAD_DATA; /* Error */
+ goto err;
if (! EVP_DecryptUpdate(&ctx.ctx, (unsigned char *) dest, &u_len,
(unsigned const char *) source, source_length))
- return AES_BAD_DATA; /* Error */
+ goto err;
if (! EVP_DecryptFinal(&ctx.ctx, (unsigned char *) dest + u_len, &f_len))
- return AES_BAD_DATA; /* Error */
+ goto err;
return u_len + f_len;
+err:
+ ERR_remove_state(0);
+ return AES_BAD_DATA;
#endif
}
diff --git a/mysys_ssl/my_md5.cc b/mysys_ssl/my_md5.cc
index 4c14366a4e3..4e362e647a1 100644
--- a/mysys_ssl/my_md5.cc
+++ b/mysys_ssl/my_md5.cc
@@ -37,14 +37,20 @@ static void my_md5_hash(char *digest, const char *buf, int len)
}
#elif defined(HAVE_OPENSSL)
-#include <openssl/md5.h>
+#include <openssl/evp.h>
-static void my_md5_hash(unsigned char* digest, unsigned const char *buf, int len)
+static void my_md5_hash(uchar* digest, const uchar *buf, uint len)
{
- MD5_CTX ctx;
- MD5_Init (&ctx);
- MD5_Update (&ctx, buf, len);
- MD5_Final (digest, &ctx);
+ EVP_MD_CTX ctx;
+ EVP_MD_CTX_init(&ctx);
+#ifdef EVP_MD_CTX_FLAG_NON_FIPS_ALLOW
+ /* Ok to ignore FIPS: MD5 is not used for crypto here */
+ EVP_MD_CTX_set_flags(&ctx, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW);
+#endif
+ EVP_DigestInit_ex(&ctx, EVP_md5(), NULL);
+ EVP_DigestUpdate(&ctx, buf, len);
+ EVP_DigestFinal(&ctx, digest, &len);
+ EVP_MD_CTX_cleanup(&ctx);
}
#endif /* HAVE_YASSL */
diff --git a/packaging/WiX/CPackWixConfig.cmake b/packaging/WiX/CPackWixConfig.cmake
index c782b7cd17a..9caae8375d8 100644
--- a/packaging/WiX/CPackWixConfig.cmake
+++ b/packaging/WiX/CPackWixConfig.cmake
@@ -1,119 +1,119 @@
-# Copyright (c) 2010, 2013, 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; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-IF(ESSENTIALS)
- SET(CPACK_COMPONENTS_USED "Server;Client;DataFiles")
- SET(CPACK_WIX_UI "WixUI_InstallDir")
- IF(CMAKE_SIZEOF_VOID_P MATCHES 8)
- SET(CPACK_PACKAGE_FILE_NAME "mysql-essential-${VERSION}-winx64")
- ELSE()
- SET(CPACK_PACKAGE_FILE_NAME "mysql-essential-${VERSION}-win32")
- ENDIF()
-ELSE()
- SET(CPACK_COMPONENTS_USED
- "Server;Client;DataFiles;Development;SharedLibraries;Documentation;IniFiles;Readme;Server_Scripts;DebugBinaries")
-ENDIF()
-
-
-# Some components like Embedded are optional
-# We will build MSI without embedded if it was not selected for build
-#(need to modify CPACK_COMPONENTS_ALL for that)
-SET(CPACK_ALL)
-FOREACH(comp1 ${CPACK_COMPONENTS_USED})
- SET(found)
- FOREACH(comp2 ${CPACK_COMPONENTS_ALL})
- IF(comp1 STREQUAL comp2)
- SET(found 1)
- BREAK()
- ENDIF()
- ENDFOREACH()
- IF(found)
- SET(CPACK_ALL ${CPACK_ALL} ${comp1})
- ENDIF()
-ENDFOREACH()
-SET(CPACK_COMPONENTS_ALL ${CPACK_ALL})
-
-# Always install (hidden), includes Readme files
-SET(CPACK_COMPONENT_GROUP_ALWAYSINSTALL_HIDDEN 1)
-SET(CPACK_COMPONENT_README_GROUP "AlwaysInstall")
-
-# Feature MySQL Server
-SET(CPACK_COMPONENT_GROUP_MYSQLSERVER_DISPLAY_NAME "MySQL Server")
-SET(CPACK_COMPONENT_GROUP_MYSQLSERVER_EXPANDED "1")
-SET(CPACK_COMPONENT_GROUP_MYSQLSERVER_DESCRIPTION "Install MySQL Server")
- # Subfeature "Server" (hidden)
- SET(CPACK_COMPONENT_SERVER_GROUP "MySQLServer")
- SET(CPACK_COMPONENT_SERVER_HIDDEN 1)
- # Subfeature "Client"
- SET(CPACK_COMPONENT_CLIENT_GROUP "MySQLServer")
- SET(CPACK_COMPONENT_CLIENT_DISPLAY_NAME "Client Programs")
- SET(CPACK_COMPONENT_CLIENT_DESCRIPTION
- "Various helpful (commandline) tools including the mysql command line client" )
- # Subfeature "Debug binaries"
- SET(CPACK_COMPONENT_DEBUGBINARIES_GROUP "MySQLServer")
- SET(CPACK_COMPONENT_DEBUGBINARIES_DISPLAY_NAME "Debug binaries")
- SET(CPACK_COMPONENT_DEBUGBINARIES_DESCRIPTION
- "Debug/trace versions of executables and libraries" )
- #SET(CPACK_COMPONENT_DEBUGBINARIES_WIX_LEVEL 2)
-
-
- #Subfeature "Data Files"
- SET(CPACK_COMPONENT_DATAFILES_GROUP "MySQLServer")
- SET(CPACK_COMPONENT_DATAFILES_DISPLAY_NAME "Server data files")
- SET(CPACK_COMPONENT_DATAFILES_DESCRIPTION "Server data files" )
- SET(CPACK_COMPONENT_DATAFILES_HIDDEN 1)
-
-
-#Feature "Devel"
-SET(CPACK_COMPONENT_GROUP_DEVEL_DISPLAY_NAME "Development Components")
-SET(CPACK_COMPONENT_GROUP_DEVEL_DESCRIPTION "Installs C/C++ header files and libraries")
- #Subfeature "Development"
- SET(CPACK_COMPONENT_DEVELOPMENT_GROUP "Devel")
- SET(CPACK_COMPONENT_DEVELOPMENT_HIDDEN 1)
-
- #Subfeature "Shared libraries"
- SET(CPACK_COMPONENT_SHAREDLIBRARIES_GROUP "Devel")
- SET(CPACK_COMPONENT_SHAREDLIBRARIES_DISPLAY_NAME "Client C API library (shared)")
- SET(CPACK_COMPONENT_SHAREDLIBRARIES_DESCRIPTION "Installs shared client library")
-
- #Subfeature "Embedded"
- SET(CPACK_COMPONENT_EMBEDDED_GROUP "Devel")
- SET(CPACK_COMPONENT_EMBEDDED_DISPLAY_NAME "Embedded server library")
- SET(CPACK_COMPONENT_EMBEDDED_DESCRIPTION "Installs embedded server library")
- SET(CPACK_COMPONENT_EMBEDDED_WIX_LEVEL 2)
-
-#Feature Debug Symbols
-SET(CPACK_COMPONENT_GROUP_DEBUGSYMBOLS_DISPLAY_NAME "Debug Symbols")
-SET(CPACK_COMPONENT_GROUP_DEBUGSYMBOLS_DESCRIPTION "Installs Debug Symbols")
-SET(CPACK_COMPONENT_GROUP_DEBUGSYMBOLS_WIX_LEVEL 2)
- SET(CPACK_COMPONENT_DEBUGINFO_GROUP "DebugSymbols")
- SET(CPACK_COMPONENT_DEBUGINFO_HIDDEN 1)
-
-#Feature Documentation
-SET(CPACK_COMPONENT_DOCUMENTATION_DISPLAY_NAME "Documentation")
-SET(CPACK_COMPONENT_DOCUMENTATION_DESCRIPTION "Installs documentation")
-SET(CPACK_COMPONENT_DOCUMENTATION_WIX_LEVEL 2)
-
-#Feature tests
-SET(CPACK_COMPONENT_TEST_DISPLAY_NAME "Tests")
-SET(CPACK_COMPONENT_TEST_DESCRIPTION "Installs unittests (requires Perl to run)")
-SET(CPACK_COMPONENT_TEST_WIX_LEVEL 2)
-
-
-#Feature Misc (hidden, installs only if everything is installed)
-SET(CPACK_COMPONENT_GROUP_MISC_HIDDEN 1)
-SET(CPACK_COMPONENT_GROUP_MISC_WIX_LEVEL 100)
- SET(CPACK_COMPONENT_INIFILES_GROUP "Misc")
- SET(CPACK_COMPONENT_SERVER_SCRIPTS_GROUP "Misc")
+# Copyright (c) 2010, 2013, 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; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+IF(ESSENTIALS)
+ SET(CPACK_COMPONENTS_USED "Server;Client;DataFiles")
+ SET(CPACK_WIX_UI "WixUI_InstallDir")
+ IF(CMAKE_SIZEOF_VOID_P MATCHES 8)
+ SET(CPACK_PACKAGE_FILE_NAME "mysql-essential-${VERSION}-winx64")
+ ELSE()
+ SET(CPACK_PACKAGE_FILE_NAME "mysql-essential-${VERSION}-win32")
+ ENDIF()
+ELSE()
+ SET(CPACK_COMPONENTS_USED
+ "Server;Client;DataFiles;Development;SharedLibraries;Documentation;IniFiles;Readme;Server_Scripts;DebugBinaries")
+ENDIF()
+
+
+# Some components like Embedded are optional
+# We will build MSI without embedded if it was not selected for build
+#(need to modify CPACK_COMPONENTS_ALL for that)
+SET(CPACK_ALL)
+FOREACH(comp1 ${CPACK_COMPONENTS_USED})
+ SET(found)
+ FOREACH(comp2 ${CPACK_COMPONENTS_ALL})
+ IF(comp1 STREQUAL comp2)
+ SET(found 1)
+ BREAK()
+ ENDIF()
+ ENDFOREACH()
+ IF(found)
+ SET(CPACK_ALL ${CPACK_ALL} ${comp1})
+ ENDIF()
+ENDFOREACH()
+SET(CPACK_COMPONENTS_ALL ${CPACK_ALL})
+
+# Always install (hidden), includes Readme files
+SET(CPACK_COMPONENT_GROUP_ALWAYSINSTALL_HIDDEN 1)
+SET(CPACK_COMPONENT_README_GROUP "AlwaysInstall")
+
+# Feature MySQL Server
+SET(CPACK_COMPONENT_GROUP_MYSQLSERVER_DISPLAY_NAME "MySQL Server")
+SET(CPACK_COMPONENT_GROUP_MYSQLSERVER_EXPANDED "1")
+SET(CPACK_COMPONENT_GROUP_MYSQLSERVER_DESCRIPTION "Install MySQL Server")
+ # Subfeature "Server" (hidden)
+ SET(CPACK_COMPONENT_SERVER_GROUP "MySQLServer")
+ SET(CPACK_COMPONENT_SERVER_HIDDEN 1)
+ # Subfeature "Client"
+ SET(CPACK_COMPONENT_CLIENT_GROUP "MySQLServer")
+ SET(CPACK_COMPONENT_CLIENT_DISPLAY_NAME "Client Programs")
+ SET(CPACK_COMPONENT_CLIENT_DESCRIPTION
+ "Various helpful (commandline) tools including the mysql command line client" )
+ # Subfeature "Debug binaries"
+ SET(CPACK_COMPONENT_DEBUGBINARIES_GROUP "MySQLServer")
+ SET(CPACK_COMPONENT_DEBUGBINARIES_DISPLAY_NAME "Debug binaries")
+ SET(CPACK_COMPONENT_DEBUGBINARIES_DESCRIPTION
+ "Debug/trace versions of executables and libraries" )
+ #SET(CPACK_COMPONENT_DEBUGBINARIES_WIX_LEVEL 2)
+
+
+ #Subfeature "Data Files"
+ SET(CPACK_COMPONENT_DATAFILES_GROUP "MySQLServer")
+ SET(CPACK_COMPONENT_DATAFILES_DISPLAY_NAME "Server data files")
+ SET(CPACK_COMPONENT_DATAFILES_DESCRIPTION "Server data files" )
+ SET(CPACK_COMPONENT_DATAFILES_HIDDEN 1)
+
+
+#Feature "Devel"
+SET(CPACK_COMPONENT_GROUP_DEVEL_DISPLAY_NAME "Development Components")
+SET(CPACK_COMPONENT_GROUP_DEVEL_DESCRIPTION "Installs C/C++ header files and libraries")
+ #Subfeature "Development"
+ SET(CPACK_COMPONENT_DEVELOPMENT_GROUP "Devel")
+ SET(CPACK_COMPONENT_DEVELOPMENT_HIDDEN 1)
+
+ #Subfeature "Shared libraries"
+ SET(CPACK_COMPONENT_SHAREDLIBRARIES_GROUP "Devel")
+ SET(CPACK_COMPONENT_SHAREDLIBRARIES_DISPLAY_NAME "Client C API library (shared)")
+ SET(CPACK_COMPONENT_SHAREDLIBRARIES_DESCRIPTION "Installs shared client library")
+
+ #Subfeature "Embedded"
+ SET(CPACK_COMPONENT_EMBEDDED_GROUP "Devel")
+ SET(CPACK_COMPONENT_EMBEDDED_DISPLAY_NAME "Embedded server library")
+ SET(CPACK_COMPONENT_EMBEDDED_DESCRIPTION "Installs embedded server library")
+ SET(CPACK_COMPONENT_EMBEDDED_WIX_LEVEL 2)
+
+#Feature Debug Symbols
+SET(CPACK_COMPONENT_GROUP_DEBUGSYMBOLS_DISPLAY_NAME "Debug Symbols")
+SET(CPACK_COMPONENT_GROUP_DEBUGSYMBOLS_DESCRIPTION "Installs Debug Symbols")
+SET(CPACK_COMPONENT_GROUP_DEBUGSYMBOLS_WIX_LEVEL 2)
+ SET(CPACK_COMPONENT_DEBUGINFO_GROUP "DebugSymbols")
+ SET(CPACK_COMPONENT_DEBUGINFO_HIDDEN 1)
+
+#Feature Documentation
+SET(CPACK_COMPONENT_DOCUMENTATION_DISPLAY_NAME "Documentation")
+SET(CPACK_COMPONENT_DOCUMENTATION_DESCRIPTION "Installs documentation")
+SET(CPACK_COMPONENT_DOCUMENTATION_WIX_LEVEL 2)
+
+#Feature tests
+SET(CPACK_COMPONENT_TEST_DISPLAY_NAME "Tests")
+SET(CPACK_COMPONENT_TEST_DESCRIPTION "Installs unittests (requires Perl to run)")
+SET(CPACK_COMPONENT_TEST_WIX_LEVEL 2)
+
+
+#Feature Misc (hidden, installs only if everything is installed)
+SET(CPACK_COMPONENT_GROUP_MISC_HIDDEN 1)
+SET(CPACK_COMPONENT_GROUP_MISC_WIX_LEVEL 100)
+ SET(CPACK_COMPONENT_INIFILES_GROUP "Misc")
+ SET(CPACK_COMPONENT_SERVER_SCRIPTS_GROUP "Misc")
diff --git a/packaging/WiX/create_msi.cmake.in b/packaging/WiX/create_msi.cmake.in
index 8de271fc1cf..d0a8f0046cf 100644
--- a/packaging/WiX/create_msi.cmake.in
+++ b/packaging/WiX/create_msi.cmake.in
@@ -1,398 +1,398 @@
-# Copyright (c) 2010, 2011, 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; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-SET(CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@")
-SET(CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@")
-SET(CANDLE_EXECUTABLE "@CANDLE_EXECUTABLE@")
-SET(LIGHT_EXECUTABLE "@LIGHT_EXECUTABLE@")
-SET(CMAKE_COMMAND "@CMAKE_COMMAND@")
-SET(CMAKE_CFG_INTDIR "@CMAKE_CFG_INTDIR@")
-SET(VERSION "@VERSION@")
-SET(MAJOR_VERSION "@MAJOR_VERSION@")
-SET(MINOR_VERSION "@MINOR_VERSION@")
-SET(PATCH_VERSION "@PATCH_VERSION@")
-SET(CMAKE_SIZEOF_VOID_P @CMAKE_SIZEOF_VOID_P@)
-SET(MANUFACTURER "@MANUFACTURER@")
-SET(WIXCA_LOCATION "@WIXCA_LOCATION@")
-SET(COPYING_RTF "@COPYING_RTF@")
-SET(CPACK_WIX_CONFIG "@CPACK_WIX_CONFIG@")
-SET(CPACK_WIX_INCLUDE "@CPACK_WIX_INCLUDE@")
-
-LIST(APPEND EXCLUDE_DIRS
- bin/debug
- data/test
- lib/plugin/debug
- mysql-test
- scripts
- sql-bench
-)
-
-LIST(APPEND EXCLUDE_FILES
- bin/echo.exe
- bin/mysql_client_test_embedded.exe
- bin/mysqld-debug.exe
- bin/mysqltest_embedded.exe
- bin/replace.exe
- lib/debug/mysqlserver.lib
- lib/libmysqld.dll
- lib/libmysqld.lib
- lib/mysqlserver.lib
- lib/mysqlservices.lib
-)
-
-IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
- SET(Win64 " Win64='yes'")
- SET(Platform x64)
- SET(PlatformProgramFilesFolder ProgramFiles64Folder)
-ELSE()
- SET(Platform x86)
- SET(PlatformProgramFilesFolder ProgramFilesFolder)
- SET(Win64)
-ENDIF()
-
-SET(ENV{VS_UNICODE_OUTPUT})
-
-# Switch off the monolithic install
-EXECUTE_PROCESS(
- COMMAND ${CMAKE_COMMAND} -DCPACK_MONOLITHIC_INSTALL=0 ${CMAKE_BINARY_DIR}
- OUTPUT_QUIET
-)
-
-INCLUDE(${CMAKE_BINARY_DIR}/CPackConfig.cmake)
-
-IF(CPACK_WIX_CONFIG)
- INCLUDE(${CPACK_WIX_CONFIG})
-ENDIF()
-
-IF(NOT CPACK_WIX_UI)
- SET(CPACK_WIX_UI "WixUI_Mondo_Custom")
-ENDIF()
-
-SET(WIX_FEATURES)
-FOREACH(comp ${CPACK_COMPONENTS_ALL})
- STRING(TOUPPER "${comp}" comp_upper)
- IF(NOT CPACK_COMPONENT_${comp_upper}_GROUP)
- SET(WIX_FEATURE_${comp_upper}_COMPONENTS "${comp}")
- SET(CPACK_COMPONENT_${comp_upper}_HIDDEN 1)
- SET(CPACK_COMPONENT_GROUP_${comp_upper}_DISPLAY_NAME ${CPACK_COMPONENT_${comp_upper}_DISPLAY_NAME})
- SET(CPACK_COMPONENT_GROUP_${comp_upper}_DESCRIPTION ${CPACK_COMPONENT_${comp_upper}_DESCRIPTION})
- SET(CPACK_COMPONENT_GROUP_${comp_upper}_WIX_LEVEL ${CPACK_COMPONENT_${comp_upper}_WIX_LEVEL})
- SET(WIX_FEATURES ${WIX_FEATURES} WIX_FEATURE_${comp_upper})
- ELSE()
- SET(FEATURE_NAME WIX_FEATURE_${CPACK_COMPONENT_${comp_upper}_GROUP})
- SET(WIX_FEATURES ${WIX_FEATURES} ${FEATURE_NAME})
- LIST(APPEND ${FEATURE_NAME}_COMPONENTS ${comp})
- ENDIF()
-ENDFOREACH()
-
-LIST(REMOVE_DUPLICATES WIX_FEATURES)
-
-SET(CPACK_WIX_FEATURES)
-
-FOREACH(f ${WIX_FEATURES})
- STRING(TOUPPER "${f}" f_upper)
- STRING(REPLACE "WIX_FEATURE_" "" f_upper ${f_upper})
- IF (CPACK_COMPONENT_GROUP_${f_upper}_DISPLAY_NAME)
- SET(TITLE ${CPACK_COMPONENT_GROUP_${f_upper}_DISPLAY_NAME})
- ELSE()
- SET(TITLE CPACK_COMPONENT_GROUP_${f_upper}_DISPLAY_NAME)
- ENDIF()
-
- IF (CPACK_COMPONENT_GROUP_${f_upper}_DESCRIPTION)
- SET(DESCRIPTION ${CPACK_COMPONENT_GROUP_${f_upper}_DESCRIPTION})
- ELSE()
- SET(DESCRIPTION CPACK_COMPONENT_GROUP_${f_upper}_DESCRIPTION)
- ENDIF()
- IF(CPACK_COMPONENT_${f_upper}_WIX_LEVEL)
- SET(Level ${CPACK_COMPONENT_${f_upper}_WIX_LEVEL})
- ELSE()
- SET(Level 1)
- ENDIF()
- IF(CPACK_COMPONENT_GROUP_${f_upper}_HIDDEN)
- SET(DISPLAY "Display='hidden'")
- SET(TITLE ${f_upper})
- SET(DESCRIPTION ${f_upper})
- ELSE()
- SET(DISPLAY)
- IF(CPACK_COMPONENT_GROUP_${f_upper}_EXPANDED)
- SET(DISPLAY "Display='expand'")
- ENDIF()
- IF (CPACK_COMPONENT_GROUP_${f_upper}_DISPLAY_NAME)
- SET(TITLE ${CPACK_COMPONENT_GROUP_${f_upper}_DISPLAY_NAME})
- ELSE()
- SET(TITLE CPACK_COMPONENT_GROUP_${f_upper}_DISPLAY_NAME)
- ENDIF()
- IF (CPACK_COMPONENT_GROUP_${f_upper}_DESCRIPTION)
- SET(DESCRIPTION ${CPACK_COMPONENT_GROUP_${f_upper}_DESCRIPTION})
- ELSE()
- SET(DESCRIPTION CPACK_COMPONENT_GROUP_${f_upper}_DESCRIPTION)
- ENDIF()
- ENDIF()
-
- SET(CPACK_WIX_FEATURES
- "${CPACK_WIX_FEATURES}
- <Feature Id='${f_upper}'
- Title='${TITLE}'
- Description='${DESCRIPTION}'
- ConfigurableDirectory='INSTALLDIR'
- Level='${Level}' ${DISPLAY} >"
- )
- FOREACH(c ${${f}_COMPONENTS})
- STRING(TOUPPER "${c}" c_upper)
- IF (CPACK_COMPONENT_${c_upper}_DISPLAY_NAME)
- SET(TITLE ${CPACK_COMPONENT_${c_upper}_DISPLAY_NAME})
- ELSE()
- SET(TITLE CPACK_COMPONENT_${c_upper}_DISPLAY_NAME)
- ENDIF()
-
- IF (CPACK_COMPONENT_${c_upper}_DESCRIPTION)
- SET(DESCRIPTION ${CPACK_COMPONENT_${c_upper}_DESCRIPTION})
- ELSE()
- SET(DESCRIPTION CPACK_COMPONENT_${c_upper}_DESCRIPTION)
- ENDIF()
- IF(CPACK_COMPONENT_${c_upper}_WIX_LEVEL)
- SET(Level ${CPACK_COMPONENT_${c_upper}_WIX_LEVEL})
- ELSE()
- SET(Level 1)
- ENDIF()
- IF(CPACK_COMPONENT_${c_upper}_HIDDEN)
- SET(CPACK_WIX_FEATURES
- "${CPACK_WIX_FEATURES}
- <ComponentGroupRef Id='componentgroup.${c}'/>")
- ELSE()
- SET(CPACK_WIX_FEATURES
- "${CPACK_WIX_FEATURES}
- <Feature Id='${c}'
- Title='${TITLE}'
- Description='${DESCRIPTION}'
- ConfigurableDirectory='INSTALLDIR'
- Level='${Level}'>
- <ComponentGroupRef Id='componentgroup.${c}'/>
- </Feature>")
- ENDIF()
-
- ENDFOREACH()
- SET(CPACK_WIX_FEATURES
- "${CPACK_WIX_FEATURES}
- </Feature>
- ")
-ENDFOREACH()
-
-
-IF(CMAKE_INSTALL_CONFIG_NAME)
- STRING(REPLACE "${CMAKE_CFG_INTDIR}" "${CMAKE_INSTALL_CONFIG_NAME}"
- WIXCA_LOCATION "${WIXCA_LOCATION}")
- SET(CONFIG_PARAM "-DCMAKE_INSTALL_CONFIG_NAME=${CMAKE_INSTALL_CONFIG_NAME}")
-ENDIF()
-
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql_server.wxs.in
- ${CMAKE_CURRENT_BINARY_DIR}/mysql_server.wxs)
-
-
-FOREACH(comp ${CPACK_COMPONENTS_ALL})
- SET(ENV{DESTDIR} testinstall/${comp})
- SET(DIRS ${DIRS} testinstall/${comp})
- EXECUTE_PROCESS(
- COMMAND ${CMAKE_COMMAND} ${CONFIG_PARAM} -DCMAKE_INSTALL_COMPONENT=${comp}
- -DCMAKE_INSTALL_PREFIX= -P ${CMAKE_BINARY_DIR}/cmake_install.cmake
- OUTPUT_QUIET
- )
-ENDFOREACH()
-
-MACRO(GENERATE_GUID VarName)
- EXECUTE_PROCESS(COMMAND uuidgen -c
- OUTPUT_VARIABLE ${VarName}
- OUTPUT_STRIP_TRAILING_WHITESPACE)
-ENDMACRO()
-
-SET(INC_VAR 0)
-MACRO(MAKE_WIX_IDENTIFIER str varname)
- STRING(REPLACE "/" "." ${varname} "${str}")
- STRING(REGEX REPLACE "[^a-zA-Z_0-9.]" "_" ${varname} "${${varname}}")
- STRING(LENGTH "${${varname}}" len)
- # Identifier should be smaller than 72 character
- # We have to cut down the length to 70 chars, since we add 2 char prefix
- # pretty often
- IF(len GREATER 70)
- STRING(SUBSTRING "${${varname}}" 0 67 shortstr)
- MATH(EXPR INC_VAR ${INC_VAR}+1)
- SET(${varname} "${shortstr}${INC_VAR}")
- ENDIF()
-ENDMACRO()
-
-
-FUNCTION(TRAVERSE_FILES dir topdir file file_comp dir_root)
- FILE(RELATIVE_PATH dir_rel ${topdir} ${dir})
- IF(dir_rel)
- LIST(FIND EXCLUDE_DIRS ${dir_rel} TO_EXCLUDE)
- IF(NOT TO_EXCLUDE EQUAL -1)
- MESSAGE(STATUS "excluding directory: ${dir_rel}")
- RETURN()
- ENDIF()
- ENDIF()
- FILE(GLOB all_files ${dir}/*)
- IF(NOT all_files)
- RETURN()
- ENDIF()
- IF(dir_rel)
- MAKE_DIRECTORY(${dir_root}/${dir_rel})
- MAKE_WIX_IDENTIFIER("${dir_rel}" id)
- SET(DirectoryRefId "D.${id}")
- ELSE()
- SET(DirectoryRefId "INSTALLDIR")
- ENDIF()
- FILE(APPEND ${file} "<DirectoryRef Id='${DirectoryRefId}'>\n")
-
- SET(NONEXEFILES)
- FOREACH(f ${all_files})
- IF(NOT IS_DIRECTORY ${f})
- FILE(RELATIVE_PATH rel ${topdir} ${f})
- SET(TO_EXCLUDE)
- IF(rel MATCHES "\\.pdb$")
- SET(TO_EXCLUDE TRUE)
- ELSE()
- LIST(FIND EXCLUDE_FILES ${rel} RES)
- IF(NOT RES EQUAL -1)
- SET(TO_EXCLUDE TRUE)
- ENDIF()
- ENDIF()
- IF(TO_EXCLUDE)
- MESSAGE(STATUS "excluding file: ${rel}")
- ELSE()
- MAKE_WIX_IDENTIFIER("${rel}" id)
- FILE(TO_NATIVE_PATH ${f} f_native)
- GET_FILENAME_COMPONENT(f_ext "${f}" EXT)
- # According to MSDN each DLL or EXE should be in the own component
- IF(f_ext MATCHES ".exe" OR f_ext MATCHES ".dll")
-
- FILE(APPEND ${file} " <Component Id='C.${id}' Guid='*' ${Win64}>\n")
- FILE(APPEND ${file} " <File Id='F.${id}' KeyPath='yes' Source='${f_native}'/>\n")
- FILE(APPEND ${file} " </Component>\n")
- FILE(APPEND ${file_comp} " <ComponentRef Id='C.${id}'/>\n")
- ELSE()
- SET(NONEXEFILES "${NONEXEFILES}\n<File Id='F.${id}' Source='${f_native}'/>" )
- ENDIF()
- ENDIF()
- ENDIF()
- ENDFOREACH()
- FILE(APPEND ${file} "</DirectoryRef>\n")
- IF(NONEXEFILES)
- GENERATE_GUID(guid)
- SET(ComponentId "C._files_${COMP_NAME}.${DirectoryRefId}")
- FILE(APPEND ${file}
- "<DirectoryRef Id='${DirectoryRefId}'>\n<Component Guid='${guid}' Id='${ComponentId}' ${Win64}>${NONEXEFILES}\n</Component></DirectoryRef>\n")
- FILE(APPEND ${file_comp} " <ComponentRef Id='${ComponentId}'/>\n")
- ENDIF()
- FOREACH(f ${all_files})
- IF(IS_DIRECTORY ${f})
- TRAVERSE_FILES(${f} ${topdir} ${file} ${file_comp} ${dir_root})
- ENDIF()
- ENDFOREACH()
-ENDFUNCTION()
-
-FUNCTION(TRAVERSE_DIRECTORIES dir topdir file prefix)
- FILE(RELATIVE_PATH rel ${topdir} ${dir})
- IF(rel)
- MAKE_WIX_IDENTIFIER("${rel}" id)
- GET_FILENAME_COMPONENT(name ${dir} NAME)
- FILE(APPEND ${file} "${prefix}<Directory Id='D.${id}' Name='${name}'>\n")
- ENDIF()
- FILE(GLOB all_files ${dir}/*)
- FOREACH(f ${all_files})
- IF(IS_DIRECTORY ${f})
- TRAVERSE_DIRECTORIES(${f} ${topdir} ${file} "${prefix} ")
- ENDIF()
- ENDFOREACH()
- IF(rel)
- FILE(APPEND ${file} "${prefix}</Directory>\n")
- ENDIF()
-ENDFUNCTION()
-
-SET(CPACK_WIX_COMPONENTS)
-SET(CPACK_WIX_COMPONENT_GROUPS)
-GET_FILENAME_COMPONENT(abs . ABSOLUTE)
-FOREACH(d ${DIRS})
- GET_FILENAME_COMPONENT(d ${d} ABSOLUTE)
- GET_FILENAME_COMPONENT(d_name ${d} NAME)
- FILE(WRITE ${abs}/${d_name}_component_group.wxs "<ComponentGroup Id='componentgroup.${d_name}'>")
- SET(COMP_NAME ${d_name})
- TRAVERSE_FILES(${d} ${d} ${abs}/${d_name}.wxs ${abs}/${d_name}_component_group.wxs "${abs}/dirs")
- FILE(APPEND ${abs}/${d_name}_component_group.wxs "</ComponentGroup>")
- IF(EXISTS ${d_name}.wxs)
- FILE(READ ${d_name}.wxs WIX_TMP)
- SET(CPACK_WIX_COMPONENTS "${CPACK_WIX_COMPONENTS}\n${WIX_TMP}")
- FILE(REMOVE ${d_name}.wxs)
- ENDIF()
-
- FILE(READ ${d_name}_component_group.wxs WIX_TMP)
-
- SET(CPACK_WIX_COMPONENT_GROUPS "${CPACK_WIX_COMPONENT_GROUPS}\n${WIX_TMP}")
- FILE(REMOVE ${d_name}_component_group.wxs)
-ENDFOREACH()
-
-FILE(WRITE directories.wxs "<DirectoryRef Id='INSTALLDIR'>\n")
-TRAVERSE_DIRECTORIES(${abs}/dirs ${abs}/dirs directories.wxs "")
-FILE(APPEND directories.wxs "</DirectoryRef>\n")
-
-FILE(READ directories.wxs CPACK_WIX_DIRECTORIES)
-FILE(REMOVE directories.wxs)
-
-
-FOREACH(src ${CPACK_WIX_INCLUDE})
-SET(CPACK_WIX_INCLUDES
-"${CPACK_WIX_INCLUDES}
- <?include ${src}?>"
-)
-ENDFOREACH()
-
-
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql_server.wxs.in
- ${CMAKE_CURRENT_BINARY_DIR}/mysql_server.wxs)
-
-SET(EXTRA_CANDLE_ARGS)
-IF("$ENV{EXTRA_CANDLE_ARGS}")
- SET(EXTRA_CANDLE_ARGS "$ENV{EXTRA_CANDLE_ARGS}")
-ENDIF()
-
-SET(EXTRA_LIGHT_ARGS)
-IF("$ENV{EXTRA_LIGHT_ARGS}")
- SET(EXTRA_LIGHT_ARGS "$ENV{EXTRA_LIGHT_ARGS}")
-ENDIF()
-
-FILE(REMOVE mysql_server.wixobj)
-EXECUTE_PROCESS(
- COMMAND ${CANDLE_EXECUTABLE} -ext WixUtilExtension mysql_server.wxs ${EXTRA_CANDLE_ARGS}
- RESULT_VARIABLE CANDLE_RESULT
-)
-
-IF(CANDLE_RESULT)
- MESSAGE(FATAL_ERROR "ERROR: can't run candle")
-ENDIF()
-
-EXECUTE_PROCESS(
- COMMAND ${LIGHT_EXECUTABLE} -ext WixUIExtension -ext WixUtilExtension
- mysql_server.wixobj -out ${CPACK_PACKAGE_FILE_NAME}.msi
- ${EXTRA_LIGHT_ARGS}
- RESULT_VARIABLE LIGHT_RESULT
-)
-
-IF(LIGHT_RESULT)
- MESSAGE(FATAL_ERROR "ERROR: can't run light")
-ENDIF()
-
-# Switch monolithic install on again
-EXECUTE_PROCESS(
- COMMAND ${CMAKE_COMMAND} -DCPACK_MONOLITHIC_INSTALL=1 ${CMAKE_BINARY_DIR}
-)
+# Copyright (c) 2010, 2011, 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; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+SET(CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@")
+SET(CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@")
+SET(CANDLE_EXECUTABLE "@CANDLE_EXECUTABLE@")
+SET(LIGHT_EXECUTABLE "@LIGHT_EXECUTABLE@")
+SET(CMAKE_COMMAND "@CMAKE_COMMAND@")
+SET(CMAKE_CFG_INTDIR "@CMAKE_CFG_INTDIR@")
+SET(VERSION "@VERSION@")
+SET(MAJOR_VERSION "@MAJOR_VERSION@")
+SET(MINOR_VERSION "@MINOR_VERSION@")
+SET(PATCH_VERSION "@PATCH_VERSION@")
+SET(CMAKE_SIZEOF_VOID_P @CMAKE_SIZEOF_VOID_P@)
+SET(MANUFACTURER "@MANUFACTURER@")
+SET(WIXCA_LOCATION "@WIXCA_LOCATION@")
+SET(COPYING_RTF "@COPYING_RTF@")
+SET(CPACK_WIX_CONFIG "@CPACK_WIX_CONFIG@")
+SET(CPACK_WIX_INCLUDE "@CPACK_WIX_INCLUDE@")
+
+LIST(APPEND EXCLUDE_DIRS
+ bin/debug
+ data/test
+ lib/plugin/debug
+ mysql-test
+ scripts
+ sql-bench
+)
+
+LIST(APPEND EXCLUDE_FILES
+ bin/echo.exe
+ bin/mysql_client_test_embedded.exe
+ bin/mysqld-debug.exe
+ bin/mysqltest_embedded.exe
+ bin/replace.exe
+ lib/debug/mysqlserver.lib
+ lib/libmysqld.dll
+ lib/libmysqld.lib
+ lib/mysqlserver.lib
+ lib/mysqlservices.lib
+)
+
+IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ SET(Win64 " Win64='yes'")
+ SET(Platform x64)
+ SET(PlatformProgramFilesFolder ProgramFiles64Folder)
+ELSE()
+ SET(Platform x86)
+ SET(PlatformProgramFilesFolder ProgramFilesFolder)
+ SET(Win64)
+ENDIF()
+
+SET(ENV{VS_UNICODE_OUTPUT})
+
+# Switch off the monolithic install
+EXECUTE_PROCESS(
+ COMMAND ${CMAKE_COMMAND} -DCPACK_MONOLITHIC_INSTALL=0 ${CMAKE_BINARY_DIR}
+ OUTPUT_QUIET
+)
+
+INCLUDE(${CMAKE_BINARY_DIR}/CPackConfig.cmake)
+
+IF(CPACK_WIX_CONFIG)
+ INCLUDE(${CPACK_WIX_CONFIG})
+ENDIF()
+
+IF(NOT CPACK_WIX_UI)
+ SET(CPACK_WIX_UI "WixUI_Mondo_Custom")
+ENDIF()
+
+SET(WIX_FEATURES)
+FOREACH(comp ${CPACK_COMPONENTS_ALL})
+ STRING(TOUPPER "${comp}" comp_upper)
+ IF(NOT CPACK_COMPONENT_${comp_upper}_GROUP)
+ SET(WIX_FEATURE_${comp_upper}_COMPONENTS "${comp}")
+ SET(CPACK_COMPONENT_${comp_upper}_HIDDEN 1)
+ SET(CPACK_COMPONENT_GROUP_${comp_upper}_DISPLAY_NAME ${CPACK_COMPONENT_${comp_upper}_DISPLAY_NAME})
+ SET(CPACK_COMPONENT_GROUP_${comp_upper}_DESCRIPTION ${CPACK_COMPONENT_${comp_upper}_DESCRIPTION})
+ SET(CPACK_COMPONENT_GROUP_${comp_upper}_WIX_LEVEL ${CPACK_COMPONENT_${comp_upper}_WIX_LEVEL})
+ SET(WIX_FEATURES ${WIX_FEATURES} WIX_FEATURE_${comp_upper})
+ ELSE()
+ SET(FEATURE_NAME WIX_FEATURE_${CPACK_COMPONENT_${comp_upper}_GROUP})
+ SET(WIX_FEATURES ${WIX_FEATURES} ${FEATURE_NAME})
+ LIST(APPEND ${FEATURE_NAME}_COMPONENTS ${comp})
+ ENDIF()
+ENDFOREACH()
+
+LIST(REMOVE_DUPLICATES WIX_FEATURES)
+
+SET(CPACK_WIX_FEATURES)
+
+FOREACH(f ${WIX_FEATURES})
+ STRING(TOUPPER "${f}" f_upper)
+ STRING(REPLACE "WIX_FEATURE_" "" f_upper ${f_upper})
+ IF (CPACK_COMPONENT_GROUP_${f_upper}_DISPLAY_NAME)
+ SET(TITLE ${CPACK_COMPONENT_GROUP_${f_upper}_DISPLAY_NAME})
+ ELSE()
+ SET(TITLE CPACK_COMPONENT_GROUP_${f_upper}_DISPLAY_NAME)
+ ENDIF()
+
+ IF (CPACK_COMPONENT_GROUP_${f_upper}_DESCRIPTION)
+ SET(DESCRIPTION ${CPACK_COMPONENT_GROUP_${f_upper}_DESCRIPTION})
+ ELSE()
+ SET(DESCRIPTION CPACK_COMPONENT_GROUP_${f_upper}_DESCRIPTION)
+ ENDIF()
+ IF(CPACK_COMPONENT_${f_upper}_WIX_LEVEL)
+ SET(Level ${CPACK_COMPONENT_${f_upper}_WIX_LEVEL})
+ ELSE()
+ SET(Level 1)
+ ENDIF()
+ IF(CPACK_COMPONENT_GROUP_${f_upper}_HIDDEN)
+ SET(DISPLAY "Display='hidden'")
+ SET(TITLE ${f_upper})
+ SET(DESCRIPTION ${f_upper})
+ ELSE()
+ SET(DISPLAY)
+ IF(CPACK_COMPONENT_GROUP_${f_upper}_EXPANDED)
+ SET(DISPLAY "Display='expand'")
+ ENDIF()
+ IF (CPACK_COMPONENT_GROUP_${f_upper}_DISPLAY_NAME)
+ SET(TITLE ${CPACK_COMPONENT_GROUP_${f_upper}_DISPLAY_NAME})
+ ELSE()
+ SET(TITLE CPACK_COMPONENT_GROUP_${f_upper}_DISPLAY_NAME)
+ ENDIF()
+ IF (CPACK_COMPONENT_GROUP_${f_upper}_DESCRIPTION)
+ SET(DESCRIPTION ${CPACK_COMPONENT_GROUP_${f_upper}_DESCRIPTION})
+ ELSE()
+ SET(DESCRIPTION CPACK_COMPONENT_GROUP_${f_upper}_DESCRIPTION)
+ ENDIF()
+ ENDIF()
+
+ SET(CPACK_WIX_FEATURES
+ "${CPACK_WIX_FEATURES}
+ <Feature Id='${f_upper}'
+ Title='${TITLE}'
+ Description='${DESCRIPTION}'
+ ConfigurableDirectory='INSTALLDIR'
+ Level='${Level}' ${DISPLAY} >"
+ )
+ FOREACH(c ${${f}_COMPONENTS})
+ STRING(TOUPPER "${c}" c_upper)
+ IF (CPACK_COMPONENT_${c_upper}_DISPLAY_NAME)
+ SET(TITLE ${CPACK_COMPONENT_${c_upper}_DISPLAY_NAME})
+ ELSE()
+ SET(TITLE CPACK_COMPONENT_${c_upper}_DISPLAY_NAME)
+ ENDIF()
+
+ IF (CPACK_COMPONENT_${c_upper}_DESCRIPTION)
+ SET(DESCRIPTION ${CPACK_COMPONENT_${c_upper}_DESCRIPTION})
+ ELSE()
+ SET(DESCRIPTION CPACK_COMPONENT_${c_upper}_DESCRIPTION)
+ ENDIF()
+ IF(CPACK_COMPONENT_${c_upper}_WIX_LEVEL)
+ SET(Level ${CPACK_COMPONENT_${c_upper}_WIX_LEVEL})
+ ELSE()
+ SET(Level 1)
+ ENDIF()
+ IF(CPACK_COMPONENT_${c_upper}_HIDDEN)
+ SET(CPACK_WIX_FEATURES
+ "${CPACK_WIX_FEATURES}
+ <ComponentGroupRef Id='componentgroup.${c}'/>")
+ ELSE()
+ SET(CPACK_WIX_FEATURES
+ "${CPACK_WIX_FEATURES}
+ <Feature Id='${c}'
+ Title='${TITLE}'
+ Description='${DESCRIPTION}'
+ ConfigurableDirectory='INSTALLDIR'
+ Level='${Level}'>
+ <ComponentGroupRef Id='componentgroup.${c}'/>
+ </Feature>")
+ ENDIF()
+
+ ENDFOREACH()
+ SET(CPACK_WIX_FEATURES
+ "${CPACK_WIX_FEATURES}
+ </Feature>
+ ")
+ENDFOREACH()
+
+
+IF(CMAKE_INSTALL_CONFIG_NAME)
+ STRING(REPLACE "${CMAKE_CFG_INTDIR}" "${CMAKE_INSTALL_CONFIG_NAME}"
+ WIXCA_LOCATION "${WIXCA_LOCATION}")
+ SET(CONFIG_PARAM "-DCMAKE_INSTALL_CONFIG_NAME=${CMAKE_INSTALL_CONFIG_NAME}")
+ENDIF()
+
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql_server.wxs.in
+ ${CMAKE_CURRENT_BINARY_DIR}/mysql_server.wxs)
+
+
+FOREACH(comp ${CPACK_COMPONENTS_ALL})
+ SET(ENV{DESTDIR} testinstall/${comp})
+ SET(DIRS ${DIRS} testinstall/${comp})
+ EXECUTE_PROCESS(
+ COMMAND ${CMAKE_COMMAND} ${CONFIG_PARAM} -DCMAKE_INSTALL_COMPONENT=${comp}
+ -DCMAKE_INSTALL_PREFIX= -P ${CMAKE_BINARY_DIR}/cmake_install.cmake
+ OUTPUT_QUIET
+ )
+ENDFOREACH()
+
+MACRO(GENERATE_GUID VarName)
+ EXECUTE_PROCESS(COMMAND uuidgen -c
+ OUTPUT_VARIABLE ${VarName}
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ENDMACRO()
+
+SET(INC_VAR 0)
+MACRO(MAKE_WIX_IDENTIFIER str varname)
+ STRING(REPLACE "/" "." ${varname} "${str}")
+ STRING(REGEX REPLACE "[^a-zA-Z_0-9.]" "_" ${varname} "${${varname}}")
+ STRING(LENGTH "${${varname}}" len)
+ # Identifier should be smaller than 72 character
+ # We have to cut down the length to 70 chars, since we add 2 char prefix
+ # pretty often
+ IF(len GREATER 70)
+ STRING(SUBSTRING "${${varname}}" 0 67 shortstr)
+ MATH(EXPR INC_VAR ${INC_VAR}+1)
+ SET(${varname} "${shortstr}${INC_VAR}")
+ ENDIF()
+ENDMACRO()
+
+
+FUNCTION(TRAVERSE_FILES dir topdir file file_comp dir_root)
+ FILE(RELATIVE_PATH dir_rel ${topdir} ${dir})
+ IF(dir_rel)
+ LIST(FIND EXCLUDE_DIRS ${dir_rel} TO_EXCLUDE)
+ IF(NOT TO_EXCLUDE EQUAL -1)
+ MESSAGE(STATUS "excluding directory: ${dir_rel}")
+ RETURN()
+ ENDIF()
+ ENDIF()
+ FILE(GLOB all_files ${dir}/*)
+ IF(NOT all_files)
+ RETURN()
+ ENDIF()
+ IF(dir_rel)
+ MAKE_DIRECTORY(${dir_root}/${dir_rel})
+ MAKE_WIX_IDENTIFIER("${dir_rel}" id)
+ SET(DirectoryRefId "D.${id}")
+ ELSE()
+ SET(DirectoryRefId "INSTALLDIR")
+ ENDIF()
+ FILE(APPEND ${file} "<DirectoryRef Id='${DirectoryRefId}'>\n")
+
+ SET(NONEXEFILES)
+ FOREACH(f ${all_files})
+ IF(NOT IS_DIRECTORY ${f})
+ FILE(RELATIVE_PATH rel ${topdir} ${f})
+ SET(TO_EXCLUDE)
+ IF(rel MATCHES "\\.pdb$")
+ SET(TO_EXCLUDE TRUE)
+ ELSE()
+ LIST(FIND EXCLUDE_FILES ${rel} RES)
+ IF(NOT RES EQUAL -1)
+ SET(TO_EXCLUDE TRUE)
+ ENDIF()
+ ENDIF()
+ IF(TO_EXCLUDE)
+ MESSAGE(STATUS "excluding file: ${rel}")
+ ELSE()
+ MAKE_WIX_IDENTIFIER("${rel}" id)
+ FILE(TO_NATIVE_PATH ${f} f_native)
+ GET_FILENAME_COMPONENT(f_ext "${f}" EXT)
+ # According to MSDN each DLL or EXE should be in the own component
+ IF(f_ext MATCHES ".exe" OR f_ext MATCHES ".dll")
+
+ FILE(APPEND ${file} " <Component Id='C.${id}' Guid='*' ${Win64}>\n")
+ FILE(APPEND ${file} " <File Id='F.${id}' KeyPath='yes' Source='${f_native}'/>\n")
+ FILE(APPEND ${file} " </Component>\n")
+ FILE(APPEND ${file_comp} " <ComponentRef Id='C.${id}'/>\n")
+ ELSE()
+ SET(NONEXEFILES "${NONEXEFILES}\n<File Id='F.${id}' Source='${f_native}'/>" )
+ ENDIF()
+ ENDIF()
+ ENDIF()
+ ENDFOREACH()
+ FILE(APPEND ${file} "</DirectoryRef>\n")
+ IF(NONEXEFILES)
+ GENERATE_GUID(guid)
+ SET(ComponentId "C._files_${COMP_NAME}.${DirectoryRefId}")
+ FILE(APPEND ${file}
+ "<DirectoryRef Id='${DirectoryRefId}'>\n<Component Guid='${guid}' Id='${ComponentId}' ${Win64}>${NONEXEFILES}\n</Component></DirectoryRef>\n")
+ FILE(APPEND ${file_comp} " <ComponentRef Id='${ComponentId}'/>\n")
+ ENDIF()
+ FOREACH(f ${all_files})
+ IF(IS_DIRECTORY ${f})
+ TRAVERSE_FILES(${f} ${topdir} ${file} ${file_comp} ${dir_root})
+ ENDIF()
+ ENDFOREACH()
+ENDFUNCTION()
+
+FUNCTION(TRAVERSE_DIRECTORIES dir topdir file prefix)
+ FILE(RELATIVE_PATH rel ${topdir} ${dir})
+ IF(rel)
+ MAKE_WIX_IDENTIFIER("${rel}" id)
+ GET_FILENAME_COMPONENT(name ${dir} NAME)
+ FILE(APPEND ${file} "${prefix}<Directory Id='D.${id}' Name='${name}'>\n")
+ ENDIF()
+ FILE(GLOB all_files ${dir}/*)
+ FOREACH(f ${all_files})
+ IF(IS_DIRECTORY ${f})
+ TRAVERSE_DIRECTORIES(${f} ${topdir} ${file} "${prefix} ")
+ ENDIF()
+ ENDFOREACH()
+ IF(rel)
+ FILE(APPEND ${file} "${prefix}</Directory>\n")
+ ENDIF()
+ENDFUNCTION()
+
+SET(CPACK_WIX_COMPONENTS)
+SET(CPACK_WIX_COMPONENT_GROUPS)
+GET_FILENAME_COMPONENT(abs . ABSOLUTE)
+FOREACH(d ${DIRS})
+ GET_FILENAME_COMPONENT(d ${d} ABSOLUTE)
+ GET_FILENAME_COMPONENT(d_name ${d} NAME)
+ FILE(WRITE ${abs}/${d_name}_component_group.wxs "<ComponentGroup Id='componentgroup.${d_name}'>")
+ SET(COMP_NAME ${d_name})
+ TRAVERSE_FILES(${d} ${d} ${abs}/${d_name}.wxs ${abs}/${d_name}_component_group.wxs "${abs}/dirs")
+ FILE(APPEND ${abs}/${d_name}_component_group.wxs "</ComponentGroup>")
+ IF(EXISTS ${d_name}.wxs)
+ FILE(READ ${d_name}.wxs WIX_TMP)
+ SET(CPACK_WIX_COMPONENTS "${CPACK_WIX_COMPONENTS}\n${WIX_TMP}")
+ FILE(REMOVE ${d_name}.wxs)
+ ENDIF()
+
+ FILE(READ ${d_name}_component_group.wxs WIX_TMP)
+
+ SET(CPACK_WIX_COMPONENT_GROUPS "${CPACK_WIX_COMPONENT_GROUPS}\n${WIX_TMP}")
+ FILE(REMOVE ${d_name}_component_group.wxs)
+ENDFOREACH()
+
+FILE(WRITE directories.wxs "<DirectoryRef Id='INSTALLDIR'>\n")
+TRAVERSE_DIRECTORIES(${abs}/dirs ${abs}/dirs directories.wxs "")
+FILE(APPEND directories.wxs "</DirectoryRef>\n")
+
+FILE(READ directories.wxs CPACK_WIX_DIRECTORIES)
+FILE(REMOVE directories.wxs)
+
+
+FOREACH(src ${CPACK_WIX_INCLUDE})
+SET(CPACK_WIX_INCLUDES
+"${CPACK_WIX_INCLUDES}
+ <?include ${src}?>"
+)
+ENDFOREACH()
+
+
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql_server.wxs.in
+ ${CMAKE_CURRENT_BINARY_DIR}/mysql_server.wxs)
+
+SET(EXTRA_CANDLE_ARGS)
+IF("$ENV{EXTRA_CANDLE_ARGS}")
+ SET(EXTRA_CANDLE_ARGS "$ENV{EXTRA_CANDLE_ARGS}")
+ENDIF()
+
+SET(EXTRA_LIGHT_ARGS)
+IF("$ENV{EXTRA_LIGHT_ARGS}")
+ SET(EXTRA_LIGHT_ARGS "$ENV{EXTRA_LIGHT_ARGS}")
+ENDIF()
+
+FILE(REMOVE mysql_server.wixobj)
+EXECUTE_PROCESS(
+ COMMAND ${CANDLE_EXECUTABLE} -ext WixUtilExtension mysql_server.wxs ${EXTRA_CANDLE_ARGS}
+ RESULT_VARIABLE CANDLE_RESULT
+)
+
+IF(CANDLE_RESULT)
+ MESSAGE(FATAL_ERROR "ERROR: can't run candle")
+ENDIF()
+
+EXECUTE_PROCESS(
+ COMMAND ${LIGHT_EXECUTABLE} -ext WixUIExtension -ext WixUtilExtension
+ mysql_server.wixobj -out ${CPACK_PACKAGE_FILE_NAME}.msi
+ ${EXTRA_LIGHT_ARGS}
+ RESULT_VARIABLE LIGHT_RESULT
+)
+
+IF(LIGHT_RESULT)
+ MESSAGE(FATAL_ERROR "ERROR: can't run light")
+ENDIF()
+
+# Switch monolithic install on again
+EXECUTE_PROCESS(
+ COMMAND ${CMAKE_COMMAND} -DCPACK_MONOLITHIC_INSTALL=1 ${CMAKE_BINARY_DIR}
+)
diff --git a/packaging/WiX/custom_ui.wxs b/packaging/WiX/custom_ui.wxs
index d49e4210b12..0ccd30f6754 100644
--- a/packaging/WiX/custom_ui.wxs
+++ b/packaging/WiX/custom_ui.wxs
@@ -1,115 +1,115 @@
-<Include xmlns="http://schemas.microsoft.com/wix/2006/wi"
- xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
-
-<!--
- Copyright (c) 2010, 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; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--->
-
- <UI Id="WixUI_Mondo_Custom">
- <Dialog Id="CustomWelcomeDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
- <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
- <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
- </Control>
- <Control Id="Next" Type="PushButton" X="220" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)">
- <Publish Event="NewDialog" Value="LicenseAgreementDlg">NOT OLDERVERSIONBEINGUPGRADED</Publish>
- <Publish Event="NewDialog" Value="UpgradeDlg">OLDERVERSIONBEINGUPGRADED</Publish>
- </Control>
- <Control Id="Back" Type="PushButton" X="156" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)" Disabled="yes" />
- <Control Id="Description" Type="Text" X="135" Y="80" Width="220" Height="60" Transparent="yes" NoPrefix="yes" Text="!(loc.WelcomeDlgDescription)" />
- <Control Id="Title" Type="Text" X="135" Y="20" Width="220" Height="60" Transparent="yes" NoPrefix="yes" Text="!(loc.WelcomeDlgTitle)" />
- <Control Id="CopyrightText" Type="Text" X="135" Y="200" Width="220" Height="40" Transparent="yes" Text="Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved." />
- <Control Id="Bitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="234" TabSkip="no" Text="!(loc.WelcomeDlgBitmap)" />
- <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
- </Dialog>
-
- <Dialog Id="UpgradeDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
- <Control Id="Install" Type="PushButton" ElevationShield="yes" X="212" Y="243" Width="80" Height="17" Default="yes" Text="Upgrade">
- <Publish Event="EndDialog" Value="Return"><![CDATA[OutOfDiskSpace <> 1]]></Publish>
- <Publish Event="SpawnDialog" Value="OutOfRbDiskDlg">OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND (PROMPTROLLBACKCOST="P" OR NOT PROMPTROLLBACKCOST)</Publish>
- <Publish Event="EndDialog" Value="Return">OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND PROMPTROLLBACKCOST="D"</Publish>
- <Publish Event="EnableRollback" Value="False">OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND PROMPTROLLBACKCOST="D"</Publish>
- <Publish Event="SpawnDialog" Value="OutOfDiskDlg">(OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 1) OR (OutOfDiskSpace = 1 AND PROMPTROLLBACKCOST="F")</Publish>
- </Control>
- <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
- <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
- </Control>
- <Control Id="Back" Type="PushButton" X="156" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)">
- <Condition Action="default">WixUI_InstallMode = "Remove"</Condition>
- </Control>
- <Control Id="InstallTitle" Type="Text" X="15" Y="15" Width="300" Height="15" Transparent="yes" NoPrefix="yes" Hidden="yes" Text="!(loc.VerifyReadyDlgInstallTitle)">
- <Condition Action="show">NOT Installed</Condition>
- </Control>
- <Control Id="InstallText" Type="Text" X="25" Y="70" Width="320" Height="80" Hidden="yes" Text="!(loc.VerifyReadyDlgInstallText)">
- <Condition Action="show">NOT Installed</Condition>
- </Control>
- <Control Id="UpgradeText" Type="Text" X="25" Y="70" Width="320" Height="80" Hidden="no" NoPrefix="yes"
- Text="Click Upgrade to upgrade your installation from version [OLDERVERSION] to version [ProductVersion]. Click Cancel to exit the upgrade."/>
- <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.VerifyReadyDlgBannerBitmap)" />
- <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
- <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
- </Dialog>
-
- <TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
- <TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
- <TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />
-
- <Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
- <Property Id="WixUI_Mode" Value="Mondo" />
-
- <DialogRef Id="ErrorDlg" />
- <DialogRef Id="FatalError" />
- <DialogRef Id="FilesInUse" />
- <DialogRef Id="MsiRMFilesInUse" />
- <DialogRef Id="PrepareDlg" />
- <DialogRef Id="ProgressDlg" />
- <DialogRef Id="ResumeDlg" />
- <DialogRef Id="UserExit" />
-
- <Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
-
- <Publish Dialog="LicenseAgreementDlg" Control="Back" Event="NewDialog" Value="CustomWelcomeDlg">1</Publish>
- <Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="SetupTypeDlg" Order="2">LicenseAccepted = "1"</Publish>
-
- <Publish Dialog="SetupTypeDlg" Control="Back" Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
- <Publish Dialog="SetupTypeDlg" Control="TypicalButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
- <Publish Dialog="SetupTypeDlg" Control="CustomButton" Event="NewDialog" Value="CustomizeDlg">1</Publish>
- <Publish Dialog="SetupTypeDlg" Control="CompleteButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
-
- <Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="1">WixUI_InstallMode = "Change"</Publish>
- <Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="SetupTypeDlg" Order="2">WixUI_InstallMode = "InstallCustom"</Publish>
- <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
-
- <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="1">WixUI_InstallMode = "InstallCustom"</Publish>
- <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="SetupTypeDlg" Order="2">WixUI_InstallMode = "InstallTypical" OR WixUI_InstallMode = "InstallComplete"</Publish>
- <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="3">WixUI_InstallMode = "Change"</Publish>
- <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="4">WixUI_InstallMode = "Repair" OR WixUI_InstallMode = "Remove"</Publish>
-
- <Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish>
-
- <Publish Dialog="MaintenanceTypeDlg" Control="ChangeButton" Event="NewDialog" Value="CustomizeDlg">1</Publish>
- <Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
- <Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
- <Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg">1</Publish>
-
- <Publish Dialog="UpgradeDlg" Control="Back" Event="NewDialog" Value="CustomWelcomeDlg">1</Publish>
-
- <InstallUISequence>
- <Show Dialog="CustomWelcomeDlg" Before="ProgressDlg">NOT Installed</Show>
- </InstallUISequence>
- </UI>
-
- <UIRef Id="WixUI_Common" />
-</Include>
+<Include xmlns="http://schemas.microsoft.com/wix/2006/wi"
+ xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
+
+<!--
+ Copyright (c) 2010, 2015, 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; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+-->
+
+ <UI Id="WixUI_Mondo_Custom">
+ <Dialog Id="CustomWelcomeDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
+ <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
+ <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
+ </Control>
+ <Control Id="Next" Type="PushButton" X="220" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)">
+ <Publish Event="NewDialog" Value="LicenseAgreementDlg">NOT OLDERVERSIONBEINGUPGRADED</Publish>
+ <Publish Event="NewDialog" Value="UpgradeDlg">OLDERVERSIONBEINGUPGRADED</Publish>
+ </Control>
+ <Control Id="Back" Type="PushButton" X="156" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)" Disabled="yes" />
+ <Control Id="Description" Type="Text" X="135" Y="80" Width="220" Height="60" Transparent="yes" NoPrefix="yes" Text="!(loc.WelcomeDlgDescription)" />
+ <Control Id="Title" Type="Text" X="135" Y="20" Width="220" Height="60" Transparent="yes" NoPrefix="yes" Text="!(loc.WelcomeDlgTitle)" />
+ <Control Id="CopyrightText" Type="Text" X="135" Y="200" Width="220" Height="40" Transparent="yes" Text="Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved." />
+ <Control Id="Bitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="234" TabSkip="no" Text="!(loc.WelcomeDlgBitmap)" />
+ <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
+ </Dialog>
+
+ <Dialog Id="UpgradeDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
+ <Control Id="Install" Type="PushButton" ElevationShield="yes" X="212" Y="243" Width="80" Height="17" Default="yes" Text="Upgrade">
+ <Publish Event="EndDialog" Value="Return"><![CDATA[OutOfDiskSpace <> 1]]></Publish>
+ <Publish Event="SpawnDialog" Value="OutOfRbDiskDlg">OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND (PROMPTROLLBACKCOST="P" OR NOT PROMPTROLLBACKCOST)</Publish>
+ <Publish Event="EndDialog" Value="Return">OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND PROMPTROLLBACKCOST="D"</Publish>
+ <Publish Event="EnableRollback" Value="False">OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND PROMPTROLLBACKCOST="D"</Publish>
+ <Publish Event="SpawnDialog" Value="OutOfDiskDlg">(OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 1) OR (OutOfDiskSpace = 1 AND PROMPTROLLBACKCOST="F")</Publish>
+ </Control>
+ <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
+ <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
+ </Control>
+ <Control Id="Back" Type="PushButton" X="156" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)">
+ <Condition Action="default">WixUI_InstallMode = "Remove"</Condition>
+ </Control>
+ <Control Id="InstallTitle" Type="Text" X="15" Y="15" Width="300" Height="15" Transparent="yes" NoPrefix="yes" Hidden="yes" Text="!(loc.VerifyReadyDlgInstallTitle)">
+ <Condition Action="show">NOT Installed</Condition>
+ </Control>
+ <Control Id="InstallText" Type="Text" X="25" Y="70" Width="320" Height="80" Hidden="yes" Text="!(loc.VerifyReadyDlgInstallText)">
+ <Condition Action="show">NOT Installed</Condition>
+ </Control>
+ <Control Id="UpgradeText" Type="Text" X="25" Y="70" Width="320" Height="80" Hidden="no" NoPrefix="yes"
+ Text="Click Upgrade to upgrade your installation from version [OLDERVERSION] to version [ProductVersion]. Click Cancel to exit the upgrade."/>
+ <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.VerifyReadyDlgBannerBitmap)" />
+ <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
+ <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
+ </Dialog>
+
+ <TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
+ <TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
+ <TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />
+
+ <Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
+ <Property Id="WixUI_Mode" Value="Mondo" />
+
+ <DialogRef Id="ErrorDlg" />
+ <DialogRef Id="FatalError" />
+ <DialogRef Id="FilesInUse" />
+ <DialogRef Id="MsiRMFilesInUse" />
+ <DialogRef Id="PrepareDlg" />
+ <DialogRef Id="ProgressDlg" />
+ <DialogRef Id="ResumeDlg" />
+ <DialogRef Id="UserExit" />
+
+ <Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
+
+ <Publish Dialog="LicenseAgreementDlg" Control="Back" Event="NewDialog" Value="CustomWelcomeDlg">1</Publish>
+ <Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="SetupTypeDlg" Order="2">LicenseAccepted = "1"</Publish>
+
+ <Publish Dialog="SetupTypeDlg" Control="Back" Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
+ <Publish Dialog="SetupTypeDlg" Control="TypicalButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
+ <Publish Dialog="SetupTypeDlg" Control="CustomButton" Event="NewDialog" Value="CustomizeDlg">1</Publish>
+ <Publish Dialog="SetupTypeDlg" Control="CompleteButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
+
+ <Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="1">WixUI_InstallMode = "Change"</Publish>
+ <Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="SetupTypeDlg" Order="2">WixUI_InstallMode = "InstallCustom"</Publish>
+ <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
+
+ <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="1">WixUI_InstallMode = "InstallCustom"</Publish>
+ <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="SetupTypeDlg" Order="2">WixUI_InstallMode = "InstallTypical" OR WixUI_InstallMode = "InstallComplete"</Publish>
+ <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="3">WixUI_InstallMode = "Change"</Publish>
+ <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="4">WixUI_InstallMode = "Repair" OR WixUI_InstallMode = "Remove"</Publish>
+
+ <Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish>
+
+ <Publish Dialog="MaintenanceTypeDlg" Control="ChangeButton" Event="NewDialog" Value="CustomizeDlg">1</Publish>
+ <Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
+ <Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
+ <Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg">1</Publish>
+
+ <Publish Dialog="UpgradeDlg" Control="Back" Event="NewDialog" Value="CustomWelcomeDlg">1</Publish>
+
+ <InstallUISequence>
+ <Show Dialog="CustomWelcomeDlg" Before="ProgressDlg">NOT Installed</Show>
+ </InstallUISequence>
+ </UI>
+
+ <UIRef Id="WixUI_Common" />
+</Include>
diff --git a/packaging/WiX/extra.wxs.in b/packaging/WiX/extra.wxs.in
index 91bf3f64b8e..92a79064d54 100644
--- a/packaging/WiX/extra.wxs.in
+++ b/packaging/WiX/extra.wxs.in
@@ -1,81 +1,81 @@
-<Include xmlns="http://schemas.microsoft.com/wix/2006/wi"
- xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
-
-<!--
- Copyright (c) 2010, 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; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--->
-
- <!-- Datafiles that installation will copy to CommonAppData (initial database)
- They are declared Permanent and NeverOverwrite since it is user data -->
- <DirectoryRef Id='TARGETDIR'>
- <Directory Id="CommonAppDataFolder">
- <Directory Id="datadir.mysql" Name="MySQL">
- <Directory Id="datadir.mysql.mysqlserver"
- Name="MySQL Server @MAJOR_VERSION@.@MINOR_VERSION@">
- <Directory Id="DATADIR" Name=".">
- <Component Id="component.datadir" Guid="d3491319-5dbc-4477-95f3-4f809ef1dd2d">
- <CreateFolder>
- <util:PermissionEx User="[LogonUser]" GenericAll="yes" />
- </CreateFolder>
- </Component>
- <Directory Id="datadir.mysql.mysqlserver.data" Name="data">
- <Directory Id="datadir.mysql.mysqlserver.data.mysql" Name="mysql">
- <Component Id="component.datadir.mysql"
- Guid="19ec0f1f-1a7f-424e-a788-b09346c0a709"
- Permanent="yes" NeverOverwrite="yes">
- <CreateFolder>
- <util:PermissionEx User="[LogonUser]" GenericAll="yes" />
- </CreateFolder>
- @DATADIR_MYSQL_FILES@
- </Component>
- </Directory>
- <Directory Id="datadir.mysql.mysqlserver.data.performance_schema"
- Name="performance_schema">
- <Component Id="component.datadir.performance_schema"
- Guid="af2a6776-2655-431f-a748-9e9f4645acc3"
- Permanent="yes" NeverOverwrite="yes">
- <CreateFolder>
- <util:PermissionEx User="[LogonUser]" GenericAll="yes" />
- </CreateFolder>
- @DATADIR_PERFORMANCE_SCHEMA_FILES@
- </Component>
- </Directory>
- <Directory Id="datadir.mysql.mysqlserver.data.test" Name="test">
- <Component Id="component.datadir.test" Guid="52fa9f0a-fcd1-420a-b2ac-95a8f70ad20a">
- <CreateFolder/>
- </Component>
- </Directory>
- </Directory>
- </Directory>
- </Directory>
- </Directory>
- </Directory>
- </DirectoryRef>
-
- <Feature Id='UserEditableDataFiles'
- Title='Server data files'
- Description='Server data files'
- ConfigurableDirectory='DATADIR'
- Level='1'>
- <ComponentRef Id="component.datadir"/>
- <ComponentRef Id="component.datadir.mysql"/>
- <ComponentRef Id="component.datadir.performance_schema"/>
- <ComponentRef Id="component.datadir.test"/>
- </Feature>
-</Include>
-
-
-
+<Include xmlns="http://schemas.microsoft.com/wix/2006/wi"
+ xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
+
+<!--
+ Copyright (c) 2010, 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; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+-->
+
+ <!-- Datafiles that installation will copy to CommonAppData (initial database)
+ They are declared Permanent and NeverOverwrite since it is user data -->
+ <DirectoryRef Id='TARGETDIR'>
+ <Directory Id="CommonAppDataFolder">
+ <Directory Id="datadir.mysql" Name="MySQL">
+ <Directory Id="datadir.mysql.mysqlserver"
+ Name="MySQL Server @MAJOR_VERSION@.@MINOR_VERSION@">
+ <Directory Id="DATADIR" Name=".">
+ <Component Id="component.datadir" Guid="d3491319-5dbc-4477-95f3-4f809ef1dd2d">
+ <CreateFolder>
+ <util:PermissionEx User="[LogonUser]" GenericAll="yes" />
+ </CreateFolder>
+ </Component>
+ <Directory Id="datadir.mysql.mysqlserver.data" Name="data">
+ <Directory Id="datadir.mysql.mysqlserver.data.mysql" Name="mysql">
+ <Component Id="component.datadir.mysql"
+ Guid="19ec0f1f-1a7f-424e-a788-b09346c0a709"
+ Permanent="yes" NeverOverwrite="yes">
+ <CreateFolder>
+ <util:PermissionEx User="[LogonUser]" GenericAll="yes" />
+ </CreateFolder>
+ @DATADIR_MYSQL_FILES@
+ </Component>
+ </Directory>
+ <Directory Id="datadir.mysql.mysqlserver.data.performance_schema"
+ Name="performance_schema">
+ <Component Id="component.datadir.performance_schema"
+ Guid="af2a6776-2655-431f-a748-9e9f4645acc3"
+ Permanent="yes" NeverOverwrite="yes">
+ <CreateFolder>
+ <util:PermissionEx User="[LogonUser]" GenericAll="yes" />
+ </CreateFolder>
+ @DATADIR_PERFORMANCE_SCHEMA_FILES@
+ </Component>
+ </Directory>
+ <Directory Id="datadir.mysql.mysqlserver.data.test" Name="test">
+ <Component Id="component.datadir.test" Guid="52fa9f0a-fcd1-420a-b2ac-95a8f70ad20a">
+ <CreateFolder/>
+ </Component>
+ </Directory>
+ </Directory>
+ </Directory>
+ </Directory>
+ </Directory>
+ </Directory>
+ </DirectoryRef>
+
+ <Feature Id='UserEditableDataFiles'
+ Title='Server data files'
+ Description='Server data files'
+ ConfigurableDirectory='DATADIR'
+ Level='1'>
+ <ComponentRef Id="component.datadir"/>
+ <ComponentRef Id="component.datadir.mysql"/>
+ <ComponentRef Id="component.datadir.performance_schema"/>
+ <ComponentRef Id="component.datadir.test"/>
+ </Feature>
+</Include>
+
+
+
diff --git a/packaging/WiX/mysql_server.wxs.in b/packaging/WiX/mysql_server.wxs.in
index 1802baedf3b..1e7c20468ef 100644
--- a/packaging/WiX/mysql_server.wxs.in
+++ b/packaging/WiX/mysql_server.wxs.in
@@ -1,196 +1,196 @@
-<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
- xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
-
-<!--
- Copyright (c) 2010, 2013, 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; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--->
-
- <Product
- Id="*"
- UpgradeCode="49EB7A6A-1CEF-4A1E-9E89-B9A4993963E3"
- Name="MySQL Server @MAJOR_VERSION@.@MINOR_VERSION@"
- Version="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@"
- Language="1033"
- Manufacturer="@MANUFACTURER@">
-
- <Package Id='*'
- Keywords='Installer'
- Description="MySQL Database Server"
- Manufacturer='@MANUFACTURER@'
- InstallerVersion='200'
- Languages='1033'
- Compressed='yes'
- SummaryCodepage='1252'
- Platform='@Platform@'
- InstallScope="perMachine"/>
-
- <Media Id='1' Cabinet='product.cab' EmbedCab='yes' />
-
- <!-- Upgrade -->
- <Upgrade Id="49EB7A6A-1CEF-4A1E-9E89-B9A4993963E3">
- <UpgradeVersion
- Minimum="@MAJOR_VERSION@.@MINOR_VERSION@.0"
- IncludeMinimum="yes"
- Maximum="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@"
- IncludeMaximum="yes"
- Property="OLDERVERSIONBEINGUPGRADED"
- MigrateFeatures="yes"
- />
- <UpgradeVersion
- Minimum="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@"
- IncludeMinimum="no"
- OnlyDetect="yes"
- Property="NEWERVERSIONDETECTED" />
- </Upgrade>
- <Condition Message="A later version of [ProductName] is already installed. Setup will now exit.">
- NOT NEWERVERSIONDETECTED OR Installed
- </Condition>
- <InstallExecuteSequence>
- <RemoveExistingProducts After="InstallInitialize"/>
- </InstallExecuteSequence>
-
- <!-- Save/restore install location -->
- <CustomAction Id="SaveTargetDir" Property="ARPINSTALLLOCATION" Value="[INSTALLDIR]" />
- <InstallExecuteSequence>
- <Custom Action="SaveTargetDir" After="InstallValidate">
- NOT
- Installed
- </Custom>
- </InstallExecuteSequence>
- <InstallUISequence>
- <!-- App search is what does FindInstallLocation, and it is dependent on FindRelatedProducts -->
- <AppSearch After="FindRelatedProducts"/>
- </InstallUISequence>
-
- <!-- Find previous installation -->
- <Property Id="INSTALLDIR">
- <RegistrySearch Id="FindInstallLocation"
- Root="HKLM"
- Key="Software\Microsoft\Windows\CurrentVersion\Uninstall\[OLDERVERSIONBEINGUPGRADED]"
- Name="InstallLocation"
- Type="raw" />
- </Property>
- <?if @Platform@ != "x64" ?>
- <Property Id="OLDERVERSION">
- <RegistrySearch Id="FindOlderVersion"
- Root="HKLM"
- Win64 = "no"
- Key="Software\Microsoft\Windows\CurrentVersion\Uninstall\[OLDERVERSIONBEINGUPGRADED]"
- Name="DisplayVersion"
- Type="raw" />
- </Property>
- <?else ?>
- <Property Id="OLDERVERSION">
- <RegistrySearch Id="FindOlderVersion"
- Root="HKLM"
- Win64 = "yes"
- Key="Software\Microsoft\Windows\CurrentVersion\Uninstall\[OLDERVERSIONBEINGUPGRADED]"
- Name="DisplayVersion"
- Type="raw" />
- </Property>
- <?endif ?>
- <Property Id="DATADIR">
- <RegistrySearch Id="FindDataDir"
- Root="HKLM"
- Key="SOFTWARE\MySQL AB\[ProductName]"
- Name="DataLocation"
- Type="raw" />
- </Property>
- <Property Id="INSTALLDIR2">
- <RegistrySearch Id="FindInstallLocation2"
- Root="HKLM"
- Key="SOFTWARE\MySQL AB\[ProductName]"
- Name="Location"
- Type="raw" />
- </Property>
- <CustomAction Id="SetInstallDir2" Property="INSTALLDIR" Value="[INSTALLDIR2]" />
- <InstallUISequence>
- <Custom Action="SetInstallDir2" After="AppSearch">INSTALLDIR2</Custom>
- </InstallUISequence>
-
-
- <!-- UI -->
- <Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR"></Property>
- <UIRef Id="@CPACK_WIX_UI@" />
- <UIRef Id="WixUI_ErrorProgressText" />
- <WixVariable
- Id="WixUIBannerBmp"
- Value="@CMAKE_CURRENT_SOURCE_DIR@/AdminHeader.jpg" />
- <WixVariable
- Id="WixUIDialogBmp"
- Value="@CMAKE_CURRENT_SOURCE_DIR@/AdminBackground.jpg" />
- <Icon
- Id="icon.ico"
- SourceFile="@CMAKE_CURRENT_SOURCE_DIR@/MySQLServer.ico"/>
- <Property
- Id="ARPPRODUCTICON"
- Value="icon.ico" />
-
- <!-- License -->
- <WixVariable
- Id="WixUILicenseRtf"
- Value="@COPYING_RTF@"/>
-
- <!-- How to remove the service on uninstall -->
- <Binary Id='wixca.dll' SourceFile='@WIXCA_LOCATION@' />
- <CustomAction Id="UnregisterProperty" Property="UnregisterService" Value="[INSTALLDIR]" Return="check" />
- <CustomAction Id="UnregisterPropertySilent" Property="UnregisterServiceSilently" Value="[INSTALLDIR]" Return="check" />
- <CustomAction Id="UnregisterService"
- BinaryKey="wixca.dll"
- DllEntry="RemoveService"
- Execute="deferred"
- Impersonate="no"
- Return="check" />
- <CustomAction Id="UnregisterServiceSilently"
- BinaryKey="wixca.dll"
- DllEntry="RemoveServiceNoninteractive"
- Execute="deferred"
- Impersonate="no"
- Return="check" />
- <InstallExecuteSequence>
- <Custom Action="UnregisterProperty" After="InstallInitialize">Installed And Not UPGRADINGPRODUCTCODE And REMOVE="ALL"</Custom>
- <Custom Action="UnregisterPropertySilent" After="InstallInitialize">Installed And Not UPGRADINGPRODUCTCODE And REMOVE="ALL"</Custom>
- <Custom Action="UnregisterService" After="UnregisterProperty">Installed And Not UPGRADINGPRODUCTCODE And REMOVE="ALL" And UILevel&gt;4</Custom>
- <Custom Action="UnregisterServiceSilently" After="UnregisterPropertySilent">Installed And Not UPGRADINGPRODUCTCODE And REMOVE="ALL" And UILevel&lt;=4</Custom>
- </InstallExecuteSequence>
-
- <!-- Installation root-->
- <Directory Id='TARGETDIR' Name='SourceDir'>
- <Directory Id='@PlatformProgramFilesFolder@'>
- <Directory Id='directory.MySQL' Name='MySQL'>
- <Directory Id='INSTALLDIR' Name='MySQL Server @MAJOR_VERSION@.@MINOR_VERSION@'>
- </Directory>
- </Directory>
- </Directory>
- </Directory>
-
- <!-- CPACK_WIX_FEATURES -->
- @CPACK_WIX_FEATURES@
-
- <!-- CPACK_WIX_DIRECTORIES -->
- @CPACK_WIX_DIRECTORIES@
-
- <!--CPACK_WIX_COMPONENTS-->
- @CPACK_WIX_COMPONENTS@
-
- <!--CPACK_WIX_COMPONENTS_GROUPS -->
- @CPACK_WIX_COMPONENT_GROUPS@
-
- <!--CPACK_WIX_INCLUDES -->
- @CPACK_WIX_INCLUDES@
- </Product>
-
-</Wix>
+<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
+ xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
+
+<!--
+ Copyright (c) 2010, 2013, 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; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+-->
+
+ <Product
+ Id="*"
+ UpgradeCode="49EB7A6A-1CEF-4A1E-9E89-B9A4993963E3"
+ Name="MySQL Server @MAJOR_VERSION@.@MINOR_VERSION@"
+ Version="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@"
+ Language="1033"
+ Manufacturer="@MANUFACTURER@">
+
+ <Package Id='*'
+ Keywords='Installer'
+ Description="MySQL Database Server"
+ Manufacturer='@MANUFACTURER@'
+ InstallerVersion='200'
+ Languages='1033'
+ Compressed='yes'
+ SummaryCodepage='1252'
+ Platform='@Platform@'
+ InstallScope="perMachine"/>
+
+ <Media Id='1' Cabinet='product.cab' EmbedCab='yes' />
+
+ <!-- Upgrade -->
+ <Upgrade Id="49EB7A6A-1CEF-4A1E-9E89-B9A4993963E3">
+ <UpgradeVersion
+ Minimum="@MAJOR_VERSION@.@MINOR_VERSION@.0"
+ IncludeMinimum="yes"
+ Maximum="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@"
+ IncludeMaximum="yes"
+ Property="OLDERVERSIONBEINGUPGRADED"
+ MigrateFeatures="yes"
+ />
+ <UpgradeVersion
+ Minimum="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@"
+ IncludeMinimum="no"
+ OnlyDetect="yes"
+ Property="NEWERVERSIONDETECTED" />
+ </Upgrade>
+ <Condition Message="A later version of [ProductName] is already installed. Setup will now exit.">
+ NOT NEWERVERSIONDETECTED OR Installed
+ </Condition>
+ <InstallExecuteSequence>
+ <RemoveExistingProducts After="InstallInitialize"/>
+ </InstallExecuteSequence>
+
+ <!-- Save/restore install location -->
+ <CustomAction Id="SaveTargetDir" Property="ARPINSTALLLOCATION" Value="[INSTALLDIR]" />
+ <InstallExecuteSequence>
+ <Custom Action="SaveTargetDir" After="InstallValidate">
+ NOT
+ Installed
+ </Custom>
+ </InstallExecuteSequence>
+ <InstallUISequence>
+ <!-- App search is what does FindInstallLocation, and it is dependent on FindRelatedProducts -->
+ <AppSearch After="FindRelatedProducts"/>
+ </InstallUISequence>
+
+ <!-- Find previous installation -->
+ <Property Id="INSTALLDIR">
+ <RegistrySearch Id="FindInstallLocation"
+ Root="HKLM"
+ Key="Software\Microsoft\Windows\CurrentVersion\Uninstall\[OLDERVERSIONBEINGUPGRADED]"
+ Name="InstallLocation"
+ Type="raw" />
+ </Property>
+ <?if @Platform@ != "x64" ?>
+ <Property Id="OLDERVERSION">
+ <RegistrySearch Id="FindOlderVersion"
+ Root="HKLM"
+ Win64 = "no"
+ Key="Software\Microsoft\Windows\CurrentVersion\Uninstall\[OLDERVERSIONBEINGUPGRADED]"
+ Name="DisplayVersion"
+ Type="raw" />
+ </Property>
+ <?else ?>
+ <Property Id="OLDERVERSION">
+ <RegistrySearch Id="FindOlderVersion"
+ Root="HKLM"
+ Win64 = "yes"
+ Key="Software\Microsoft\Windows\CurrentVersion\Uninstall\[OLDERVERSIONBEINGUPGRADED]"
+ Name="DisplayVersion"
+ Type="raw" />
+ </Property>
+ <?endif ?>
+ <Property Id="DATADIR">
+ <RegistrySearch Id="FindDataDir"
+ Root="HKLM"
+ Key="SOFTWARE\MySQL AB\[ProductName]"
+ Name="DataLocation"
+ Type="raw" />
+ </Property>
+ <Property Id="INSTALLDIR2">
+ <RegistrySearch Id="FindInstallLocation2"
+ Root="HKLM"
+ Key="SOFTWARE\MySQL AB\[ProductName]"
+ Name="Location"
+ Type="raw" />
+ </Property>
+ <CustomAction Id="SetInstallDir2" Property="INSTALLDIR" Value="[INSTALLDIR2]" />
+ <InstallUISequence>
+ <Custom Action="SetInstallDir2" After="AppSearch">INSTALLDIR2</Custom>
+ </InstallUISequence>
+
+
+ <!-- UI -->
+ <Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR"></Property>
+ <UIRef Id="@CPACK_WIX_UI@" />
+ <UIRef Id="WixUI_ErrorProgressText" />
+ <WixVariable
+ Id="WixUIBannerBmp"
+ Value="@CMAKE_CURRENT_SOURCE_DIR@/AdminHeader.jpg" />
+ <WixVariable
+ Id="WixUIDialogBmp"
+ Value="@CMAKE_CURRENT_SOURCE_DIR@/AdminBackground.jpg" />
+ <Icon
+ Id="icon.ico"
+ SourceFile="@CMAKE_CURRENT_SOURCE_DIR@/MySQLServer.ico"/>
+ <Property
+ Id="ARPPRODUCTICON"
+ Value="icon.ico" />
+
+ <!-- License -->
+ <WixVariable
+ Id="WixUILicenseRtf"
+ Value="@COPYING_RTF@"/>
+
+ <!-- How to remove the service on uninstall -->
+ <Binary Id='wixca.dll' SourceFile='@WIXCA_LOCATION@' />
+ <CustomAction Id="UnregisterProperty" Property="UnregisterService" Value="[INSTALLDIR]" Return="check" />
+ <CustomAction Id="UnregisterPropertySilent" Property="UnregisterServiceSilently" Value="[INSTALLDIR]" Return="check" />
+ <CustomAction Id="UnregisterService"
+ BinaryKey="wixca.dll"
+ DllEntry="RemoveService"
+ Execute="deferred"
+ Impersonate="no"
+ Return="check" />
+ <CustomAction Id="UnregisterServiceSilently"
+ BinaryKey="wixca.dll"
+ DllEntry="RemoveServiceNoninteractive"
+ Execute="deferred"
+ Impersonate="no"
+ Return="check" />
+ <InstallExecuteSequence>
+ <Custom Action="UnregisterProperty" After="InstallInitialize">Installed And Not UPGRADINGPRODUCTCODE And REMOVE="ALL"</Custom>
+ <Custom Action="UnregisterPropertySilent" After="InstallInitialize">Installed And Not UPGRADINGPRODUCTCODE And REMOVE="ALL"</Custom>
+ <Custom Action="UnregisterService" After="UnregisterProperty">Installed And Not UPGRADINGPRODUCTCODE And REMOVE="ALL" And UILevel&gt;4</Custom>
+ <Custom Action="UnregisterServiceSilently" After="UnregisterPropertySilent">Installed And Not UPGRADINGPRODUCTCODE And REMOVE="ALL" And UILevel&lt;=4</Custom>
+ </InstallExecuteSequence>
+
+ <!-- Installation root-->
+ <Directory Id='TARGETDIR' Name='SourceDir'>
+ <Directory Id='@PlatformProgramFilesFolder@'>
+ <Directory Id='directory.MySQL' Name='MySQL'>
+ <Directory Id='INSTALLDIR' Name='MySQL Server @MAJOR_VERSION@.@MINOR_VERSION@'>
+ </Directory>
+ </Directory>
+ </Directory>
+ </Directory>
+
+ <!-- CPACK_WIX_FEATURES -->
+ @CPACK_WIX_FEATURES@
+
+ <!-- CPACK_WIX_DIRECTORIES -->
+ @CPACK_WIX_DIRECTORIES@
+
+ <!--CPACK_WIX_COMPONENTS-->
+ @CPACK_WIX_COMPONENTS@
+
+ <!--CPACK_WIX_COMPONENTS_GROUPS -->
+ @CPACK_WIX_COMPONENT_GROUPS@
+
+ <!--CPACK_WIX_INCLUDES -->
+ @CPACK_WIX_INCLUDES@
+ </Product>
+
+</Wix>
diff --git a/packaging/rpm-oel/mysql.spec.in b/packaging/rpm-oel/mysql.spec.in
index d8cf49fe993..bb232fb404d 100644
--- a/packaging/rpm-oel/mysql.spec.in
+++ b/packaging/rpm-oel/mysql.spec.in
@@ -1,4 +1,4 @@
-# Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 2015, 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
@@ -370,7 +370,7 @@ Obsoletes: mariadb-embedded
Obsoletes: MySQL-embedded < %{version}-%{release}
Obsoletes: mysql-embedded < %{version}-%{release}
Provides: mysql-embedded = %{version}-%{release}
-Provides: mysql-emdedded%{?_isa} = %{version}-%{release}
+Provides: mysql-embedded%{?_isa} = %{version}-%{release}
%description embedded
This package contains the MySQL server as an embedded library.
diff --git a/pcre/AUTHORS b/pcre/AUTHORS
index 5eee1af4c6f..d33723f198a 100644
--- a/pcre/AUTHORS
+++ b/pcre/AUTHORS
@@ -8,7 +8,7 @@ Email domain: cam.ac.uk
University of Cambridge Computing Service,
Cambridge, England.
-Copyright (c) 1997-2014 University of Cambridge
+Copyright (c) 1997-2015 University of Cambridge
All rights reserved
@@ -19,7 +19,7 @@ Written by: Zoltan Herczeg
Email local part: hzmester
Emain domain: freemail.hu
-Copyright(c) 2010-2014 Zoltan Herczeg
+Copyright(c) 2010-2015 Zoltan Herczeg
All rights reserved.
@@ -30,7 +30,7 @@ Written by: Zoltan Herczeg
Email local part: hzmester
Emain domain: freemail.hu
-Copyright(c) 2009-2014 Zoltan Herczeg
+Copyright(c) 2009-2015 Zoltan Herczeg
All rights reserved.
diff --git a/pcre/ChangeLog b/pcre/ChangeLog
index 8abdfb5f117..359b4129582 100644
--- a/pcre/ChangeLog
+++ b/pcre/ChangeLog
@@ -1,6 +1,173 @@
ChangeLog for PCRE
------------------
+Version 8.37 28-April-2015
+--------------------------
+
+1. When an (*ACCEPT) is triggered inside capturing parentheses, it arranges
+ for those parentheses to be closed with whatever has been captured so far.
+ However, it was failing to mark any other groups between the hightest
+ capture so far and the currrent group as "unset". Thus, the ovector for
+ those groups contained whatever was previously there. An example is the
+ pattern /(x)|((*ACCEPT))/ when matched against "abcd".
+
+2. If an assertion condition was quantified with a minimum of zero (an odd
+ thing to do, but it happened), SIGSEGV or other misbehaviour could occur.
+
+3. If a pattern in pcretest input had the P (POSIX) modifier followed by an
+ unrecognized modifier, a crash could occur.
+
+4. An attempt to do global matching in pcretest with a zero-length ovector
+ caused a crash.
+
+5. Fixed a memory leak during matching that could occur for a subpattern
+ subroutine call (recursive or otherwise) if the number of captured groups
+ that had to be saved was greater than ten.
+
+6. Catch a bad opcode during auto-possessification after compiling a bad UTF
+ string with NO_UTF_CHECK. This is a tidyup, not a bug fix, as passing bad
+ UTF with NO_UTF_CHECK is documented as having an undefined outcome.
+
+7. A UTF pattern containing a "not" match of a non-ASCII character and a
+ subroutine reference could loop at compile time. Example: /[^\xff]((?1))/.
+
+8. When a pattern is compiled, it remembers the highest back reference so that
+ when matching, if the ovector is too small, extra memory can be obtained to
+ use instead. A conditional subpattern whose condition is a check on a
+ capture having happened, such as, for example in the pattern
+ /^(?:(a)|b)(?(1)A|B)/, is another kind of back reference, but it was not
+ setting the highest backreference number. This mattered only if pcre_exec()
+ was called with an ovector that was too small to hold the capture, and there
+ was no other kind of back reference (a situation which is probably quite
+ rare). The effect of the bug was that the condition was always treated as
+ FALSE when the capture could not be consulted, leading to a incorrect
+ behaviour by pcre_exec(). This bug has been fixed.
+
+9. A reference to a duplicated named group (either a back reference or a test
+ for being set in a conditional) that occurred in a part of the pattern where
+ PCRE_DUPNAMES was not set caused the amount of memory needed for the pattern
+ to be incorrectly calculated, leading to overwriting.
+
+10. A mutually recursive set of back references such as (\2)(\1) caused a
+ segfault at study time (while trying to find the minimum matching length).
+ The infinite loop is now broken (with the minimum length unset, that is,
+ zero).
+
+11. If an assertion that was used as a condition was quantified with a minimum
+ of zero, matching went wrong. In particular, if the whole group had
+ unlimited repetition and could match an empty string, a segfault was
+ likely. The pattern (?(?=0)?)+ is an example that caused this. Perl allows
+ assertions to be quantified, but not if they are being used as conditions,
+ so the above pattern is faulted by Perl. PCRE has now been changed so that
+ it also rejects such patterns.
+
+12. A possessive capturing group such as (a)*+ with a minimum repeat of zero
+ failed to allow the zero-repeat case if pcre2_exec() was called with an
+ ovector too small to capture the group.
+
+13. Fixed two bugs in pcretest that were discovered by fuzzing and reported by
+ Red Hat Product Security:
+
+ (a) A crash if /K and /F were both set with the option to save the compiled
+ pattern.
+
+ (b) Another crash if the option to print captured substrings in a callout
+ was combined with setting a null ovector, for example \O\C+ as a subject
+ string.
+
+14. A pattern such as "((?2){0,1999}())?", which has a group containing a
+ forward reference repeated a large (but limited) number of times within a
+ repeated outer group that has a zero minimum quantifier, caused incorrect
+ code to be compiled, leading to the error "internal error:
+ previously-checked referenced subpattern not found" when an incorrect
+ memory address was read. This bug was reported as "heap overflow",
+ discovered by Kai Lu of Fortinet's FortiGuard Labs and given the CVE number
+ CVE-2015-2325.
+
+23. A pattern such as "((?+1)(\1))/" containing a forward reference subroutine
+ call within a group that also contained a recursive back reference caused
+ incorrect code to be compiled. This bug was reported as "heap overflow",
+ discovered by Kai Lu of Fortinet's FortiGuard Labs, and given the CVE
+ number CVE-2015-2326.
+
+24. Computing the size of the JIT read-only data in advance has been a source
+ of various issues, and new ones are still appear unfortunately. To fix
+ existing and future issues, size computation is eliminated from the code,
+ and replaced by on-demand memory allocation.
+
+25. A pattern such as /(?i)[A-`]/, where characters in the other case are
+ adjacent to the end of the range, and the range contained characters with
+ more than one other case, caused incorrect behaviour when compiled in UTF
+ mode. In that example, the range a-j was left out of the class.
+
+26. Fix JIT compilation of conditional blocks, which assertion
+ is converted to (*FAIL). E.g: /(?(?!))/.
+
+27. The pattern /(?(?!)^)/ caused references to random memory. This bug was
+ discovered by the LLVM fuzzer.
+
+28. The assertion (?!) is optimized to (*FAIL). This was not handled correctly
+ when this assertion was used as a condition, for example (?(?!)a|b). In
+ pcre2_match() it worked by luck; in pcre2_dfa_match() it gave an incorrect
+ error about an unsupported item.
+
+29. For some types of pattern, for example /Z*(|d*){216}/, the auto-
+ possessification code could take exponential time to complete. A recursion
+ depth limit of 1000 has been imposed to limit the resources used by this
+ optimization.
+
+30. A pattern such as /(*UTF)[\S\V\H]/, which contains a negated special class
+ such as \S in non-UCP mode, explicit wide characters (> 255) can be ignored
+ because \S ensures they are all in the class. The code for doing this was
+ interacting badly with the code for computing the amount of space needed to
+ compile the pattern, leading to a buffer overflow. This bug was discovered
+ by the LLVM fuzzer.
+
+31. A pattern such as /((?2)+)((?1))/ which has mutual recursion nested inside
+ other kinds of group caused stack overflow at compile time. This bug was
+ discovered by the LLVM fuzzer.
+
+32. A pattern such as /(?1)(?#?'){8}(a)/ which had a parenthesized comment
+ between a subroutine call and its quantifier was incorrectly compiled,
+ leading to buffer overflow or other errors. This bug was discovered by the
+ LLVM fuzzer.
+
+33. The illegal pattern /(?(?<E>.*!.*)?)/ was not being diagnosed as missing an
+ assertion after (?(. The code was failing to check the character after
+ (?(?< for the ! or = that would indicate a lookbehind assertion. This bug
+ was discovered by the LLVM fuzzer.
+
+34. A pattern such as /X((?2)()*+){2}+/ which has a possessive quantifier with
+ a fixed maximum following a group that contains a subroutine reference was
+ incorrectly compiled and could trigger buffer overflow. This bug was
+ discovered by the LLVM fuzzer.
+
+35. A mutual recursion within a lookbehind assertion such as (?<=((?2))((?1)))
+ caused a stack overflow instead of the diagnosis of a non-fixed length
+ lookbehind assertion. This bug was discovered by the LLVM fuzzer.
+
+36. The use of \K in a positive lookbehind assertion in a non-anchored pattern
+ (e.g. /(?<=\Ka)/) could make pcregrep loop.
+
+37. There was a similar problem to 36 in pcretest for global matches.
+
+38. If a greedy quantified \X was preceded by \C in UTF mode (e.g. \C\X*),
+ and a subsequent item in the pattern caused a non-match, backtracking over
+ the repeated \X did not stop, but carried on past the start of the subject,
+ causing reference to random memory and/or a segfault. There were also some
+ other cases where backtracking after \C could crash. This set of bugs was
+ discovered by the LLVM fuzzer.
+
+39. The function for finding the minimum length of a matching string could take
+ a very long time if mutual recursion was present many times in a pattern,
+ for example, /((?2){73}(?2))((?1))/. A better mutual recursion detection
+ method has been implemented. This infelicity was discovered by the LLVM
+ fuzzer.
+
+40. Static linking against the PCRE library using the pkg-config module was
+ failing on missing pthread symbols.
+
+
Version 8.36 26-September-2014
------------------------------
diff --git a/pcre/LICENCE b/pcre/LICENCE
index 602e4ae6804..9f6f98e477f 100644
--- a/pcre/LICENCE
+++ b/pcre/LICENCE
@@ -6,7 +6,8 @@ and semantics are as close as possible to those of the Perl 5 language.
Release 8 of PCRE is distributed under the terms of the "BSD" licence, as
specified below. The documentation for PCRE, supplied in the "doc"
-directory, is distributed under the same terms as the software itself.
+directory, is distributed under the same terms as the software itself. The data
+in the testdata directory is not copyrighted and is in the public domain.
The basic library functions are written in C and are freestanding. Also
included in the distribution is a set of C++ wrapper functions, and a
@@ -24,7 +25,7 @@ Email domain: cam.ac.uk
University of Cambridge Computing Service,
Cambridge, England.
-Copyright (c) 1997-2014 University of Cambridge
+Copyright (c) 1997-2015 University of Cambridge
All rights reserved.
@@ -35,7 +36,7 @@ Written by: Zoltan Herczeg
Email local part: hzmester
Emain domain: freemail.hu
-Copyright(c) 2010-2014 Zoltan Herczeg
+Copyright(c) 2010-2015 Zoltan Herczeg
All rights reserved.
@@ -46,7 +47,7 @@ Written by: Zoltan Herczeg
Email local part: hzmester
Emain domain: freemail.hu
-Copyright(c) 2009-2014 Zoltan Herczeg
+Copyright(c) 2009-2015 Zoltan Herczeg
All rights reserved.
diff --git a/pcre/NEWS b/pcre/NEWS
index 5b8c60c14b8..064bf27819c 100644
--- a/pcre/NEWS
+++ b/pcre/NEWS
@@ -1,6 +1,14 @@
News about PCRE releases
------------------------
+Release 8.37 28-April-2015
+--------------------------
+
+This is bug-fix release. Note that this library (now called PCRE1) is now being
+maintained for bug fixes only. New projects are advised to use the new PCRE2
+libraries.
+
+
Release 8.36 26-September-2014
------------------------------
diff --git a/pcre/NON-AUTOTOOLS-BUILD b/pcre/NON-AUTOTOOLS-BUILD
index cddf3e0699b..1c3da84fcaa 100644
--- a/pcre/NON-AUTOTOOLS-BUILD
+++ b/pcre/NON-AUTOTOOLS-BUILD
@@ -1,6 +1,14 @@
Building PCRE without using autotools
-------------------------------------
+NOTE: This document relates to PCRE releases that use the original API, with
+library names libpcre, libpcre16, and libpcre32. January 2015 saw the first
+release of a new API, known as PCRE2, with release numbers starting at 10.00
+and library names libpcre2-8, libpcre2-16, and libpcre2-32. The old libraries
+(now called PCRE1) are still being maintained for bug fixes, but there will be
+no new development. New projects are advised to use the new PCRE2 libraries.
+
+
This document contains the following sections:
General
@@ -761,4 +769,4 @@ There is also a mirror here:
http://www.vsoft-software.com/downloads.html
==========================
-Last Updated: 14 May 2013
+Last Updated: 10 February 2015
diff --git a/pcre/README b/pcre/README
index e30bd0fd5b7..4887ebf350e 100644
--- a/pcre/README
+++ b/pcre/README
@@ -1,7 +1,16 @@
README file for PCRE (Perl-compatible regular expression library)
-----------------------------------------------------------------
-The latest release of PCRE is always available in three alternative formats
+NOTE: This set of files relates to PCRE releases that use the original API,
+with library names libpcre, libpcre16, and libpcre32. January 2015 saw the
+first release of a new API, known as PCRE2, with release numbers starting at
+10.00 and library names libpcre2-8, libpcre2-16, and libpcre2-32. The old
+libraries (now called PCRE1) are still being maintained for bug fixes, but
+there will be no new development. New projects are advised to use the new PCRE2
+libraries.
+
+
+The latest release of PCRE1 is always available in three alternative formats
from:
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-xxx.tar.gz
@@ -990,4 +999,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: 24 October 2014
+Last updated: 10 February 2015
diff --git a/pcre/RunGrepTest b/pcre/RunGrepTest
index f1b03484067..62e2a9b3963 100755
--- a/pcre/RunGrepTest
+++ b/pcre/RunGrepTest
@@ -506,6 +506,11 @@ echo "---------------------------- Test 106 -----------------------------" >>tes
(cd $srcdir; echo "a" | $valgrind $pcregrep -M "|a" ) >>testtrygrep 2>&1
echo "RC=$?" >>testtrygrep
+echo "---------------------------- Test 107 -----------------------------" >>testtrygrep
+echo "a" >testtemp1grep
+echo "aaaaa" >>testtemp1grep
+(cd $srcdir; $valgrind $pcregrep --line-offsets '(?<=\Ka)' $builddir/testtemp1grep) >>testtrygrep 2>&1
+echo "RC=$?" >>testtrygrep
# Now compare the results.
diff --git a/pcre/RunTest.bat b/pcre/RunTest.bat
index 35d7f71f9e8..8f290f59130 100644
--- a/pcre/RunTest.bat
+++ b/pcre/RunTest.bat
@@ -1,616 +1,616 @@
-@echo off
-@rem This file must use CRLF linebreaks to function properly
-@rem and requires both pcretest and pcregrep
-@rem This file was originally contributed by Ralf Junker, and touched up by
-@rem Daniel Richard G. Tests 10-12 added by Philip H.
-@rem Philip H also changed test 3 to use "wintest" files.
-@rem
-@rem Updated by Tom Fortmann to support explicit test numbers on the command line.
-@rem Added argument validation and added error reporting.
-@rem
-@rem MS Windows batch file to run pcretest on testfiles with the correct
-@rem options.
-@rem
-@rem Sheri Pierce added logic to skip feature dependent tests
-@rem tests 4 5 9 15 and 18 require utf support
-@rem tests 6 7 10 16 and 19 require ucp support
-@rem 11 requires ucp and link size 2
-@rem 12 requires presence of jit support
-@rem 13 requires absence of jit support
-@rem Sheri P also added override tests for study and jit testing
-@rem Zoltan Herczeg added libpcre16 support
-@rem Zoltan Herczeg added libpcre32 support
-
-setlocal enabledelayedexpansion
-if [%srcdir%]==[] (
-if exist testdata\ set srcdir=.)
-if [%srcdir%]==[] (
-if exist ..\testdata\ set srcdir=..)
-if [%srcdir%]==[] (
-if exist ..\..\testdata\ set srcdir=..\..)
-if NOT exist %srcdir%\testdata\ (
-Error: echo distribution testdata folder not found!
-call :conferror
-exit /b 1
-goto :eof
-)
-
-if [%pcretest%]==[] set pcretest=.\pcretest.exe
-
-echo source dir is %srcdir%
-echo pcretest=%pcretest%
-
-if NOT exist %pcretest% (
-echo Error: %pcretest% not found!
-echo.
-call :conferror
-exit /b 1
-)
-
-%pcretest% -C linksize >NUL
-set link_size=%ERRORLEVEL%
-%pcretest% -C pcre8 >NUL
-set support8=%ERRORLEVEL%
-%pcretest% -C pcre16 >NUL
-set support16=%ERRORLEVEL%
-%pcretest% -C pcre32 >NUL
-set support32=%ERRORLEVEL%
-%pcretest% -C utf >NUL
-set utf=%ERRORLEVEL%
-%pcretest% -C ucp >NUL
-set ucp=%ERRORLEVEL%
-%pcretest% -C jit >NUL
-set jit=%ERRORLEVEL%
-
-if %support8% EQU 1 (
-if not exist testout8 md testout8
-if not exist testoutstudy8 md testoutstudy8
-if not exist testoutjit8 md testoutjit8
-)
-
-if %support16% EQU 1 (
-if not exist testout16 md testout16
-if not exist testoutstudy16 md testoutstudy16
-if not exist testoutjit16 md testoutjit16
-)
-
-if %support16% EQU 1 (
-if not exist testout32 md testout32
-if not exist testoutstudy32 md testoutstudy32
-if not exist testoutjit32 md testoutjit32
-)
-
-set do1=no
-set do2=no
-set do3=no
-set do4=no
-set do5=no
-set do6=no
-set do7=no
-set do8=no
-set do9=no
-set do10=no
-set do11=no
-set do12=no
-set do13=no
-set do14=no
-set do15=no
-set do16=no
-set do17=no
-set do18=no
-set do19=no
-set do20=no
-set do21=no
-set do22=no
-set do23=no
-set do24=no
-set do25=no
-set do26=no
-set all=yes
-
-for %%a in (%*) do (
- set valid=no
- for %%v in (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) do if %%v == %%a set valid=yes
- if "!valid!" == "yes" (
- set do%%a=yes
- set all=no
-) else (
- echo Invalid test number - %%a!
- echo Usage %0 [ test_number ] ...
- echo Where test_number is one or more optional test numbers 1 through 26, default is all tests.
- exit /b 1
-)
-)
-set failed="no"
-
-if "%all%" == "yes" (
- set do1=yes
- set do2=yes
- set do3=yes
- set do4=yes
- set do5=yes
- set do6=yes
- set do7=yes
- set do8=yes
- set do9=yes
- set do10=yes
- set do11=yes
- set do12=yes
- set do13=yes
- set do14=yes
- set do15=yes
- set do16=yes
- set do17=yes
- set do18=yes
- set do19=yes
- set do20=yes
- set do21=yes
- set do22=yes
- set do23=yes
- set do24=yes
- set do25=yes
- set do26=yes
-)
-
-@echo RunTest.bat's pcretest output is written to newly created subfolders named
-@echo testout, testoutstudy and testoutjit.
-@echo.
-
-set mode=
-set bits=8
-
-:nextMode
-if "%mode%" == "" (
- if %support8% EQU 0 goto modeSkip
- echo.
- echo ---- Testing 8-bit library ----
- echo.
-)
-if "%mode%" == "-16" (
- if %support16% EQU 0 goto modeSkip
- echo.
- echo ---- Testing 16-bit library ----
- echo.
-)
-if "%mode%" == "-32" (
- if %support32% EQU 0 goto modeSkip
- echo.
- echo ---- Testing 32-bit library ----
- echo.
-)
-if "%do1%" == "yes" call :do1
-if "%do2%" == "yes" call :do2
-if "%do3%" == "yes" call :do3
-if "%do4%" == "yes" call :do4
-if "%do5%" == "yes" call :do5
-if "%do6%" == "yes" call :do6
-if "%do7%" == "yes" call :do7
-if "%do8%" == "yes" call :do8
-if "%do9%" == "yes" call :do9
-if "%do10%" == "yes" call :do10
-if "%do11%" == "yes" call :do11
-if "%do12%" == "yes" call :do12
-if "%do13%" == "yes" call :do13
-if "%do14%" == "yes" call :do14
-if "%do15%" == "yes" call :do15
-if "%do16%" == "yes" call :do16
-if "%do17%" == "yes" call :do17
-if "%do18%" == "yes" call :do18
-if "%do19%" == "yes" call :do19
-if "%do20%" == "yes" call :do20
-if "%do21%" == "yes" call :do21
-if "%do22%" == "yes" call :do22
-if "%do23%" == "yes" call :do23
-if "%do24%" == "yes" call :do24
-if "%do25%" == "yes" call :do25
-if "%do26%" == "yes" call :do26
-:modeSkip
-if "%mode%" == "" (
- set mode=-16
- set bits=16
- goto nextMode
-)
-if "%mode%" == "-16" (
- set mode=-32
- set bits=32
- goto nextMode
-)
-
-@rem If mode is -32, testing is finished
-if %failed% == "yes" (
-echo In above output, one or more of the various tests failed!
-exit /b 1
-)
-echo All OK
-goto :eof
-
-:runsub
-@rem Function to execute pcretest and compare the output
-@rem Arguments are as follows:
-@rem
-@rem 1 = test number
-@rem 2 = outputdir
-@rem 3 = test name use double quotes
-@rem 4 - 9 = pcretest options
-
-if [%1] == [] (
- echo Missing test number argument!
- exit /b 1
-)
-
-if [%2] == [] (
- echo Missing outputdir!
- exit /b 1
-)
-
-if [%3] == [] (
- echo Missing test name argument!
- exit /b 1
-)
-
-set testinput=testinput%1
-set testoutput=testoutput%1
-if exist %srcdir%\testdata\win%testinput% (
- set testinput=wintestinput%1
- set testoutput=wintestoutput%1
-)
-
-echo Test %1: %3
-%pcretest% %mode% %4 %5 %6 %7 %8 %9 %srcdir%\testdata\%testinput% >%2%bits%\%testoutput%
-if errorlevel 1 (
- echo. failed executing command-line:
- echo. %pcretest% %mode% %4 %5 %6 %7 %8 %9 %srcdir%\testdata\%testinput% ^>%2%bits%\%testoutput%
- set failed="yes"
- goto :eof
-)
-
-set type=
-if [%1]==[11] (
- set type=-%bits%
-)
-if [%1]==[18] (
- set type=-%bits%
-)
-if [%1]==[21] (
- set type=-%bits%
-)
-if [%1]==[22] (
- set type=-%bits%
-)
-
-fc /n %srcdir%\testdata\%testoutput%%type% %2%bits%\%testoutput% >NUL
-
-if errorlevel 1 (
- echo. failed comparison: fc /n %srcdir%\testdata\%testoutput% %2%bits%\%testoutput%
- if [%1]==[2] (
- echo.
- echo ** Test 2 requires a lot of stack. PCRE can be configured to
- echo ** use heap for recursion. Otherwise, to pass Test 2
- echo ** you generally need to allocate 8 mb stack to PCRE.
- echo ** See the 'pcrestack' page for a discussion of PCRE's
- echo ** stack usage.
- echo.
-)
- if [%1]==[3] (
- echo.
- echo ** Test 3 failure usually means french locale is not
- echo ** available on the system, rather than a bug or problem with PCRE.
- echo.
- goto :eof
-)
-
- set failed="yes"
- goto :eof
-)
-
-echo. Passed.
-goto :eof
-
-:do1
-call :runsub 1 testout "Main functionality (Compatible with Perl >= 5.10)" -q
-call :runsub 1 testoutstudy "Test with Study Override" -q -s
-if %jit% EQU 1 call :runsub 1 testoutjit "Test with JIT Override" -q -s+
-goto :eof
-
-:do2
- call :runsub 2 testout "API, errors, internals, and non-Perl stuff" -q
- call :runsub 2 testoutstudy "Test with Study Override" -q -s
- if %jit% EQU 1 call :runsub 2 testoutjit "Test with JIT Override" -q -s+
-goto :eof
-
-:do3
- call :runsub 3 testout "Locale-specific features" -q
- call :runsub 3 testoutstudy "Test with Study Override" -q -s
- if %jit% EQU 1 call :runsub 3 testoutjit "Test with JIT Override" -q -s+
-goto :eof
-
-:do4
-if %utf% EQU 0 (
- echo Test 4 Skipped due to absence of UTF-%bits% support.
- goto :eof
-)
- call :runsub 4 testout "UTF-%bits% support - (Compatible with Perl >= 5.10)" -q
- call :runsub 4 testoutstudy "Test with Study Override" -q -s
- if %jit% EQU 1 call :runsub 4 testoutjit "Test with JIT Override" -q -s+
-goto :eof
-
-:do5
-if %utf% EQU 0 (
- echo Test 5 Skipped due to absence of UTF-%bits% support.
- goto :eof
-)
- call :runsub 5 testout "API, internals, and non-Perl stuff for UTF-%bits%" -q
- call :runsub 5 testoutstudy "Test with Study Override" -q -s
- if %jit% EQU 1 call :runsub 5 testoutjit "Test with JIT Override" -q -s+
-goto :eof
-
-:do6
-if %ucp% EQU 0 (
- echo Test 6 Skipped due to absence of Unicode property support.
- goto :eof
-)
- call :runsub 6 testout "Unicode property support (Compatible with Perl >= 5.10)" -q
- call :runsub 6 testoutstudy "Test with Study Override" -q -s
- if %jit% EQU 1 call :runsub 6 testoutjit "Test with JIT Override" -q -s+
-goto :eof
-
-:do7
-if %ucp% EQU 0 (
- echo Test 7 Skipped due to absence of Unicode property support.
- goto :eof
-)
- call :runsub 7 testout "API, internals, and non-Perl stuff for Unicode property support" -q
- call :runsub 7 testoutstudy "Test with Study Override" -q -s
- if %jit% EQU 1 call :runsub 7 testoutjit "Test with JIT Override" -q -s+
-goto :eof
-
-:do8
- call :runsub 8 testout "DFA matching main functionality" -q -dfa
- call :runsub 8 testoutstudy "Test with Study Override" -q -dfa -s
-goto :eof
-
-:do9
-if %utf% EQU 0 (
- echo Test 9 Skipped due to absence of UTF-%bits% support.
- goto :eof
-)
- call :runsub 9 testout "DFA matching with UTF-%bits%" -q -dfa
- call :runsub 9 testoutstudy "Test with Study Override" -q -dfa -s
- goto :eof
-
-:do10
-if %ucp% EQU 0 (
- echo Test 10 Skipped due to absence of Unicode property support.
- goto :eof
-)
- call :runsub 10 testout "DFA matching with Unicode properties" -q -dfa
- call :runsub 10 testoutstudy "Test with Study Override" -q -dfa -s
-goto :eof
-
-:do11
-if NOT %link_size% EQU 2 (
- echo Test 11 Skipped because link size is not 2.
- goto :eof
-)
-if %ucp% EQU 0 (
- echo Test 11 Skipped due to absence of Unicode property support.
- goto :eof
-)
- call :runsub 11 testout "Internal offsets and code size tests" -q
- call :runsub 11 testoutstudy "Test with Study Override" -q -s
-goto :eof
-
-:do12
-if %jit% EQU 0 (
- echo Test 12 Skipped due to absence of JIT support.
- goto :eof
-)
- call :runsub 12 testout "JIT-specific features (JIT available)" -q
-goto :eof
-
-:do13
-if %jit% EQU 1 (
- echo Test 13 Skipped due to presence of JIT support.
- goto :eof
-)
- call :runsub 13 testout "JIT-specific features (JIT not available)" -q
-goto :eof
-
-:do14
-if NOT %bits% EQU 8 (
- echo Test 14 Skipped when running 16/32-bit tests.
- goto :eof
-)
- copy /Y %srcdir%\testdata\saved16 testsaved16
- copy /Y %srcdir%\testdata\saved32 testsaved32
- call :runsub 14 testout "Specials for the basic 8-bit library" -q
- call :runsub 14 testoutstudy "Test with Study Override" -q -s
- if %jit% EQU 1 call :runsub 14 testoutjit "Test with JIT Override" -q -s+
-goto :eof
-
-:do15
-if NOT %bits% EQU 8 (
- echo Test 15 Skipped when running 16/32-bit tests.
- goto :eof
-)
-if %utf% EQU 0 (
- echo Test 15 Skipped due to absence of UTF-%bits% support.
- goto :eof
-)
- call :runsub 15 testout "Specials for the 8-bit library with UTF-%bits% support" -q
- call :runsub 15 testoutstudy "Test with Study Override" -q -s
- if %jit% EQU 1 call :runsub 15 testoutjit "Test with JIT Override" -q -s+
-goto :eof
-
-:do16
-if NOT %bits% EQU 8 (
- echo Test 16 Skipped when running 16/32-bit tests.
- goto :eof
-)
-if %ucp% EQU 0 (
- echo Test 16 Skipped due to absence of Unicode property support.
- goto :eof
-)
- call :runsub 16 testout "Specials for the 8-bit library with Unicode propery support" -q
- call :runsub 16 testoutstudy "Test with Study Override" -q -s
- if %jit% EQU 1 call :runsub 16 testoutjit "Test with JIT Override" -q -s+
-goto :eof
-
-:do17
-if %bits% EQU 8 (
- echo Test 17 Skipped when running 8-bit tests.
- goto :eof
-)
- call :runsub 17 testout "Specials for the basic 16/32-bit library" -q
- call :runsub 17 testoutstudy "Test with Study Override" -q -s
- if %jit% EQU 1 call :runsub 17 testoutjit "Test with JIT Override" -q -s+
-goto :eof
-
-:do18
-if %bits% EQU 8 (
- echo Test 18 Skipped when running 8-bit tests.
- goto :eof
-)
-if %utf% EQU 0 (
- echo Test 18 Skipped due to absence of UTF-%bits% support.
- goto :eof
-)
- call :runsub 18 testout "Specials for the 16/32-bit library with UTF-%bits% support" -q
- call :runsub 18 testoutstudy "Test with Study Override" -q -s
- if %jit% EQU 1 call :runsub 18 testoutjit "Test with JIT Override" -q -s+
-goto :eof
-
-:do19
-if %bits% EQU 8 (
- echo Test 19 Skipped when running 8-bit tests.
- goto :eof
-)
-if %ucp% EQU 0 (
- echo Test 19 Skipped due to absence of Unicode property support.
- goto :eof
-)
- call :runsub 19 testout "Specials for the 16/32-bit library with Unicode property support" -q
- call :runsub 19 testoutstudy "Test with Study Override" -q -s
- if %jit% EQU 1 call :runsub 19 testoutjit "Test with JIT Override" -q -s+
-goto :eof
-
-:do20
-if %bits% EQU 8 (
- echo Test 20 Skipped when running 8-bit tests.
- goto :eof
-)
- call :runsub 20 testout "DFA specials for the basic 16/32-bit library" -q -dfa
- call :runsub 20 testoutstudy "Test with Study Override" -q -dfa -s
-goto :eof
-
-:do21
-if %bits% EQU 8 (
- echo Test 21 Skipped when running 8-bit tests.
- goto :eof
-)
-if NOT %link_size% EQU 2 (
- echo Test 21 Skipped because link size is not 2.
- goto :eof
-)
-copy /Y %srcdir%\testdata\saved8 testsaved8
-copy /Y %srcdir%\testdata\saved16LE-1 testsaved16LE-1
-copy /Y %srcdir%\testdata\saved16BE-1 testsaved16BE-1
-copy /Y %srcdir%\testdata\saved32LE-1 testsaved32LE-1
-copy /Y %srcdir%\testdata\saved32BE-1 testsaved32BE-1
-call :runsub 21 testout "Reloads for the basic 16/32-bit library" -q
-call :runsub 21 testoutstudy "Test with Study Override" -q -s
-if %jit% EQU 1 call :runsub 21 testoutjit "Test with JIT Override" -q -s+
-goto :eof
-
-:do22
-if %bits% EQU 8 (
- echo Test 22 Skipped when running 8-bit tests.
- goto :eof
-)
-if %utf% EQU 0 (
- echo Test 22 Skipped due to absence of UTF-%bits% support.
- goto :eof
-)
-if NOT %link_size% EQU 2 (
- echo Test 22 Skipped because link size is not 2.
- goto :eof
-)
-copy /Y %srcdir%\testdata\saved16LE-2 testsaved16LE-2
-copy /Y %srcdir%\testdata\saved16BE-2 testsaved16BE-2
-copy /Y %srcdir%\testdata\saved32LE-2 testsaved32LE-2
-copy /Y %srcdir%\testdata\saved32BE-2 testsaved32BE-2
-call :runsub 22 testout "Reloads for the 16/32-bit library with UTF-16/32 support" -q
-call :runsub 22 testoutstudy "Test with Study Override" -q -s
-if %jit% EQU 1 call :runsub 22 testoutjit "Test with JIT Override" -q -s+
-goto :eof
-
-:do23
-if NOT %bits% EQU 16 (
- echo Test 23 Skipped when running 8/32-bit tests.
- goto :eof
-)
-call :runsub 23 testout "Specials for the 16-bit library" -q
-call :runsub 23 testoutstudy "Test with Study Override" -q -s
-if %jit% EQU 1 call :runsub 23 testoutjit "Test with JIT Override" -q -s+
-goto :eof
-
-:do24
-if NOT %bits% EQU 16 (
- echo Test 24 Skipped when running 8/32-bit tests.
- goto :eof
-)
-if %utf% EQU 0 (
- echo Test 24 Skipped due to absence of UTF-%bits% support.
- goto :eof
-)
-call :runsub 24 testout "Specials for the 16-bit library with UTF-16 support" -q
-call :runsub 24 testoutstudy "Test with Study Override" -q -s
-if %jit% EQU 1 call :runsub 24 testoutjit "Test with JIT Override" -q -s+
-goto :eof
-
-:do25
-if NOT %bits% EQU 32 (
- echo Test 25 Skipped when running 8/16-bit tests.
- goto :eof
-)
-call :runsub 25 testout "Specials for the 32-bit library" -q
-call :runsub 25 testoutstudy "Test with Study Override" -q -s
-if %jit% EQU 1 call :runsub 25 testoutjit "Test with JIT Override" -q -s+
-goto :eof
-
-:do26
-if NOT %bits% EQU 32 (
- echo Test 26 Skipped when running 8/16-bit tests.
- goto :eof
-)
-if %utf% EQU 0 (
- echo Test 26 Skipped due to absence of UTF-%bits% support.
- goto :eof
-)
-call :runsub 26 testout "Specials for the 32-bit library with UTF-32 support" -q
-call :runsub 26 testoutstudy "Test with Study Override" -q -s
-if %jit% EQU 1 call :runsub 26 testoutjit "Test with JIT Override" -q -s+
-goto :eof
-
-:conferror
-@echo.
-@echo Either your build is incomplete or you have a configuration error.
-@echo.
-@echo If configured with cmake and executed via "make test" or the MSVC "RUN_TESTS"
-@echo project, pcre_test.bat defines variables and automatically calls RunTest.bat.
-@echo For manual testing of all available features, after configuring with cmake
-@echo and building, you can run the built pcre_test.bat. For best results with
-@echo cmake builds and tests avoid directories with full path names that include
-@echo spaces for source or build.
-@echo.
-@echo Otherwise, if the build dir is in a subdir of the source dir, testdata needed
-@echo for input and verification should be found automatically when (from the
-@echo location of the the built exes) you call RunTest.bat. By default RunTest.bat
-@echo runs all tests compatible with the linked pcre library but it can be given
-@echo a test number as an argument.
-@echo.
-@echo If the build dir is not under the source dir you can either copy your exes
-@echo to the source folder or copy RunTest.bat and the testdata folder to the
-@echo location of your built exes and then run RunTest.bat.
-@echo.
-goto :eof
+@echo off
+@rem This file must use CRLF linebreaks to function properly
+@rem and requires both pcretest and pcregrep
+@rem This file was originally contributed by Ralf Junker, and touched up by
+@rem Daniel Richard G. Tests 10-12 added by Philip H.
+@rem Philip H also changed test 3 to use "wintest" files.
+@rem
+@rem Updated by Tom Fortmann to support explicit test numbers on the command line.
+@rem Added argument validation and added error reporting.
+@rem
+@rem MS Windows batch file to run pcretest on testfiles with the correct
+@rem options.
+@rem
+@rem Sheri Pierce added logic to skip feature dependent tests
+@rem tests 4 5 9 15 and 18 require utf support
+@rem tests 6 7 10 16 and 19 require ucp support
+@rem 11 requires ucp and link size 2
+@rem 12 requires presence of jit support
+@rem 13 requires absence of jit support
+@rem Sheri P also added override tests for study and jit testing
+@rem Zoltan Herczeg added libpcre16 support
+@rem Zoltan Herczeg added libpcre32 support
+
+setlocal enabledelayedexpansion
+if [%srcdir%]==[] (
+if exist testdata\ set srcdir=.)
+if [%srcdir%]==[] (
+if exist ..\testdata\ set srcdir=..)
+if [%srcdir%]==[] (
+if exist ..\..\testdata\ set srcdir=..\..)
+if NOT exist %srcdir%\testdata\ (
+Error: echo distribution testdata folder not found!
+call :conferror
+exit /b 1
+goto :eof
+)
+
+if [%pcretest%]==[] set pcretest=.\pcretest.exe
+
+echo source dir is %srcdir%
+echo pcretest=%pcretest%
+
+if NOT exist %pcretest% (
+echo Error: %pcretest% not found!
+echo.
+call :conferror
+exit /b 1
+)
+
+%pcretest% -C linksize >NUL
+set link_size=%ERRORLEVEL%
+%pcretest% -C pcre8 >NUL
+set support8=%ERRORLEVEL%
+%pcretest% -C pcre16 >NUL
+set support16=%ERRORLEVEL%
+%pcretest% -C pcre32 >NUL
+set support32=%ERRORLEVEL%
+%pcretest% -C utf >NUL
+set utf=%ERRORLEVEL%
+%pcretest% -C ucp >NUL
+set ucp=%ERRORLEVEL%
+%pcretest% -C jit >NUL
+set jit=%ERRORLEVEL%
+
+if %support8% EQU 1 (
+if not exist testout8 md testout8
+if not exist testoutstudy8 md testoutstudy8
+if not exist testoutjit8 md testoutjit8
+)
+
+if %support16% EQU 1 (
+if not exist testout16 md testout16
+if not exist testoutstudy16 md testoutstudy16
+if not exist testoutjit16 md testoutjit16
+)
+
+if %support16% EQU 1 (
+if not exist testout32 md testout32
+if not exist testoutstudy32 md testoutstudy32
+if not exist testoutjit32 md testoutjit32
+)
+
+set do1=no
+set do2=no
+set do3=no
+set do4=no
+set do5=no
+set do6=no
+set do7=no
+set do8=no
+set do9=no
+set do10=no
+set do11=no
+set do12=no
+set do13=no
+set do14=no
+set do15=no
+set do16=no
+set do17=no
+set do18=no
+set do19=no
+set do20=no
+set do21=no
+set do22=no
+set do23=no
+set do24=no
+set do25=no
+set do26=no
+set all=yes
+
+for %%a in (%*) do (
+ set valid=no
+ for %%v in (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) do if %%v == %%a set valid=yes
+ if "!valid!" == "yes" (
+ set do%%a=yes
+ set all=no
+) else (
+ echo Invalid test number - %%a!
+ echo Usage %0 [ test_number ] ...
+ echo Where test_number is one or more optional test numbers 1 through 26, default is all tests.
+ exit /b 1
+)
+)
+set failed="no"
+
+if "%all%" == "yes" (
+ set do1=yes
+ set do2=yes
+ set do3=yes
+ set do4=yes
+ set do5=yes
+ set do6=yes
+ set do7=yes
+ set do8=yes
+ set do9=yes
+ set do10=yes
+ set do11=yes
+ set do12=yes
+ set do13=yes
+ set do14=yes
+ set do15=yes
+ set do16=yes
+ set do17=yes
+ set do18=yes
+ set do19=yes
+ set do20=yes
+ set do21=yes
+ set do22=yes
+ set do23=yes
+ set do24=yes
+ set do25=yes
+ set do26=yes
+)
+
+@echo RunTest.bat's pcretest output is written to newly created subfolders named
+@echo testout, testoutstudy and testoutjit.
+@echo.
+
+set mode=
+set bits=8
+
+:nextMode
+if "%mode%" == "" (
+ if %support8% EQU 0 goto modeSkip
+ echo.
+ echo ---- Testing 8-bit library ----
+ echo.
+)
+if "%mode%" == "-16" (
+ if %support16% EQU 0 goto modeSkip
+ echo.
+ echo ---- Testing 16-bit library ----
+ echo.
+)
+if "%mode%" == "-32" (
+ if %support32% EQU 0 goto modeSkip
+ echo.
+ echo ---- Testing 32-bit library ----
+ echo.
+)
+if "%do1%" == "yes" call :do1
+if "%do2%" == "yes" call :do2
+if "%do3%" == "yes" call :do3
+if "%do4%" == "yes" call :do4
+if "%do5%" == "yes" call :do5
+if "%do6%" == "yes" call :do6
+if "%do7%" == "yes" call :do7
+if "%do8%" == "yes" call :do8
+if "%do9%" == "yes" call :do9
+if "%do10%" == "yes" call :do10
+if "%do11%" == "yes" call :do11
+if "%do12%" == "yes" call :do12
+if "%do13%" == "yes" call :do13
+if "%do14%" == "yes" call :do14
+if "%do15%" == "yes" call :do15
+if "%do16%" == "yes" call :do16
+if "%do17%" == "yes" call :do17
+if "%do18%" == "yes" call :do18
+if "%do19%" == "yes" call :do19
+if "%do20%" == "yes" call :do20
+if "%do21%" == "yes" call :do21
+if "%do22%" == "yes" call :do22
+if "%do23%" == "yes" call :do23
+if "%do24%" == "yes" call :do24
+if "%do25%" == "yes" call :do25
+if "%do26%" == "yes" call :do26
+:modeSkip
+if "%mode%" == "" (
+ set mode=-16
+ set bits=16
+ goto nextMode
+)
+if "%mode%" == "-16" (
+ set mode=-32
+ set bits=32
+ goto nextMode
+)
+
+@rem If mode is -32, testing is finished
+if %failed% == "yes" (
+echo In above output, one or more of the various tests failed!
+exit /b 1
+)
+echo All OK
+goto :eof
+
+:runsub
+@rem Function to execute pcretest and compare the output
+@rem Arguments are as follows:
+@rem
+@rem 1 = test number
+@rem 2 = outputdir
+@rem 3 = test name use double quotes
+@rem 4 - 9 = pcretest options
+
+if [%1] == [] (
+ echo Missing test number argument!
+ exit /b 1
+)
+
+if [%2] == [] (
+ echo Missing outputdir!
+ exit /b 1
+)
+
+if [%3] == [] (
+ echo Missing test name argument!
+ exit /b 1
+)
+
+set testinput=testinput%1
+set testoutput=testoutput%1
+if exist %srcdir%\testdata\win%testinput% (
+ set testinput=wintestinput%1
+ set testoutput=wintestoutput%1
+)
+
+echo Test %1: %3
+%pcretest% %mode% %4 %5 %6 %7 %8 %9 %srcdir%\testdata\%testinput% >%2%bits%\%testoutput%
+if errorlevel 1 (
+ echo. failed executing command-line:
+ echo. %pcretest% %mode% %4 %5 %6 %7 %8 %9 %srcdir%\testdata\%testinput% ^>%2%bits%\%testoutput%
+ set failed="yes"
+ goto :eof
+)
+
+set type=
+if [%1]==[11] (
+ set type=-%bits%
+)
+if [%1]==[18] (
+ set type=-%bits%
+)
+if [%1]==[21] (
+ set type=-%bits%
+)
+if [%1]==[22] (
+ set type=-%bits%
+)
+
+fc /n %srcdir%\testdata\%testoutput%%type% %2%bits%\%testoutput% >NUL
+
+if errorlevel 1 (
+ echo. failed comparison: fc /n %srcdir%\testdata\%testoutput% %2%bits%\%testoutput%
+ if [%1]==[2] (
+ echo.
+ echo ** Test 2 requires a lot of stack. PCRE can be configured to
+ echo ** use heap for recursion. Otherwise, to pass Test 2
+ echo ** you generally need to allocate 8 mb stack to PCRE.
+ echo ** See the 'pcrestack' page for a discussion of PCRE's
+ echo ** stack usage.
+ echo.
+)
+ if [%1]==[3] (
+ echo.
+ echo ** Test 3 failure usually means french locale is not
+ echo ** available on the system, rather than a bug or problem with PCRE.
+ echo.
+ goto :eof
+)
+
+ set failed="yes"
+ goto :eof
+)
+
+echo. Passed.
+goto :eof
+
+:do1
+call :runsub 1 testout "Main functionality (Compatible with Perl >= 5.10)" -q
+call :runsub 1 testoutstudy "Test with Study Override" -q -s
+if %jit% EQU 1 call :runsub 1 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do2
+ call :runsub 2 testout "API, errors, internals, and non-Perl stuff" -q
+ call :runsub 2 testoutstudy "Test with Study Override" -q -s
+ if %jit% EQU 1 call :runsub 2 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do3
+ call :runsub 3 testout "Locale-specific features" -q
+ call :runsub 3 testoutstudy "Test with Study Override" -q -s
+ if %jit% EQU 1 call :runsub 3 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do4
+if %utf% EQU 0 (
+ echo Test 4 Skipped due to absence of UTF-%bits% support.
+ goto :eof
+)
+ call :runsub 4 testout "UTF-%bits% support - (Compatible with Perl >= 5.10)" -q
+ call :runsub 4 testoutstudy "Test with Study Override" -q -s
+ if %jit% EQU 1 call :runsub 4 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do5
+if %utf% EQU 0 (
+ echo Test 5 Skipped due to absence of UTF-%bits% support.
+ goto :eof
+)
+ call :runsub 5 testout "API, internals, and non-Perl stuff for UTF-%bits%" -q
+ call :runsub 5 testoutstudy "Test with Study Override" -q -s
+ if %jit% EQU 1 call :runsub 5 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do6
+if %ucp% EQU 0 (
+ echo Test 6 Skipped due to absence of Unicode property support.
+ goto :eof
+)
+ call :runsub 6 testout "Unicode property support (Compatible with Perl >= 5.10)" -q
+ call :runsub 6 testoutstudy "Test with Study Override" -q -s
+ if %jit% EQU 1 call :runsub 6 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do7
+if %ucp% EQU 0 (
+ echo Test 7 Skipped due to absence of Unicode property support.
+ goto :eof
+)
+ call :runsub 7 testout "API, internals, and non-Perl stuff for Unicode property support" -q
+ call :runsub 7 testoutstudy "Test with Study Override" -q -s
+ if %jit% EQU 1 call :runsub 7 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do8
+ call :runsub 8 testout "DFA matching main functionality" -q -dfa
+ call :runsub 8 testoutstudy "Test with Study Override" -q -dfa -s
+goto :eof
+
+:do9
+if %utf% EQU 0 (
+ echo Test 9 Skipped due to absence of UTF-%bits% support.
+ goto :eof
+)
+ call :runsub 9 testout "DFA matching with UTF-%bits%" -q -dfa
+ call :runsub 9 testoutstudy "Test with Study Override" -q -dfa -s
+ goto :eof
+
+:do10
+if %ucp% EQU 0 (
+ echo Test 10 Skipped due to absence of Unicode property support.
+ goto :eof
+)
+ call :runsub 10 testout "DFA matching with Unicode properties" -q -dfa
+ call :runsub 10 testoutstudy "Test with Study Override" -q -dfa -s
+goto :eof
+
+:do11
+if NOT %link_size% EQU 2 (
+ echo Test 11 Skipped because link size is not 2.
+ goto :eof
+)
+if %ucp% EQU 0 (
+ echo Test 11 Skipped due to absence of Unicode property support.
+ goto :eof
+)
+ call :runsub 11 testout "Internal offsets and code size tests" -q
+ call :runsub 11 testoutstudy "Test with Study Override" -q -s
+goto :eof
+
+:do12
+if %jit% EQU 0 (
+ echo Test 12 Skipped due to absence of JIT support.
+ goto :eof
+)
+ call :runsub 12 testout "JIT-specific features (JIT available)" -q
+goto :eof
+
+:do13
+if %jit% EQU 1 (
+ echo Test 13 Skipped due to presence of JIT support.
+ goto :eof
+)
+ call :runsub 13 testout "JIT-specific features (JIT not available)" -q
+goto :eof
+
+:do14
+if NOT %bits% EQU 8 (
+ echo Test 14 Skipped when running 16/32-bit tests.
+ goto :eof
+)
+ copy /Y %srcdir%\testdata\saved16 testsaved16
+ copy /Y %srcdir%\testdata\saved32 testsaved32
+ call :runsub 14 testout "Specials for the basic 8-bit library" -q
+ call :runsub 14 testoutstudy "Test with Study Override" -q -s
+ if %jit% EQU 1 call :runsub 14 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do15
+if NOT %bits% EQU 8 (
+ echo Test 15 Skipped when running 16/32-bit tests.
+ goto :eof
+)
+if %utf% EQU 0 (
+ echo Test 15 Skipped due to absence of UTF-%bits% support.
+ goto :eof
+)
+ call :runsub 15 testout "Specials for the 8-bit library with UTF-%bits% support" -q
+ call :runsub 15 testoutstudy "Test with Study Override" -q -s
+ if %jit% EQU 1 call :runsub 15 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do16
+if NOT %bits% EQU 8 (
+ echo Test 16 Skipped when running 16/32-bit tests.
+ goto :eof
+)
+if %ucp% EQU 0 (
+ echo Test 16 Skipped due to absence of Unicode property support.
+ goto :eof
+)
+ call :runsub 16 testout "Specials for the 8-bit library with Unicode propery support" -q
+ call :runsub 16 testoutstudy "Test with Study Override" -q -s
+ if %jit% EQU 1 call :runsub 16 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do17
+if %bits% EQU 8 (
+ echo Test 17 Skipped when running 8-bit tests.
+ goto :eof
+)
+ call :runsub 17 testout "Specials for the basic 16/32-bit library" -q
+ call :runsub 17 testoutstudy "Test with Study Override" -q -s
+ if %jit% EQU 1 call :runsub 17 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do18
+if %bits% EQU 8 (
+ echo Test 18 Skipped when running 8-bit tests.
+ goto :eof
+)
+if %utf% EQU 0 (
+ echo Test 18 Skipped due to absence of UTF-%bits% support.
+ goto :eof
+)
+ call :runsub 18 testout "Specials for the 16/32-bit library with UTF-%bits% support" -q
+ call :runsub 18 testoutstudy "Test with Study Override" -q -s
+ if %jit% EQU 1 call :runsub 18 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do19
+if %bits% EQU 8 (
+ echo Test 19 Skipped when running 8-bit tests.
+ goto :eof
+)
+if %ucp% EQU 0 (
+ echo Test 19 Skipped due to absence of Unicode property support.
+ goto :eof
+)
+ call :runsub 19 testout "Specials for the 16/32-bit library with Unicode property support" -q
+ call :runsub 19 testoutstudy "Test with Study Override" -q -s
+ if %jit% EQU 1 call :runsub 19 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do20
+if %bits% EQU 8 (
+ echo Test 20 Skipped when running 8-bit tests.
+ goto :eof
+)
+ call :runsub 20 testout "DFA specials for the basic 16/32-bit library" -q -dfa
+ call :runsub 20 testoutstudy "Test with Study Override" -q -dfa -s
+goto :eof
+
+:do21
+if %bits% EQU 8 (
+ echo Test 21 Skipped when running 8-bit tests.
+ goto :eof
+)
+if NOT %link_size% EQU 2 (
+ echo Test 21 Skipped because link size is not 2.
+ goto :eof
+)
+copy /Y %srcdir%\testdata\saved8 testsaved8
+copy /Y %srcdir%\testdata\saved16LE-1 testsaved16LE-1
+copy /Y %srcdir%\testdata\saved16BE-1 testsaved16BE-1
+copy /Y %srcdir%\testdata\saved32LE-1 testsaved32LE-1
+copy /Y %srcdir%\testdata\saved32BE-1 testsaved32BE-1
+call :runsub 21 testout "Reloads for the basic 16/32-bit library" -q
+call :runsub 21 testoutstudy "Test with Study Override" -q -s
+if %jit% EQU 1 call :runsub 21 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do22
+if %bits% EQU 8 (
+ echo Test 22 Skipped when running 8-bit tests.
+ goto :eof
+)
+if %utf% EQU 0 (
+ echo Test 22 Skipped due to absence of UTF-%bits% support.
+ goto :eof
+)
+if NOT %link_size% EQU 2 (
+ echo Test 22 Skipped because link size is not 2.
+ goto :eof
+)
+copy /Y %srcdir%\testdata\saved16LE-2 testsaved16LE-2
+copy /Y %srcdir%\testdata\saved16BE-2 testsaved16BE-2
+copy /Y %srcdir%\testdata\saved32LE-2 testsaved32LE-2
+copy /Y %srcdir%\testdata\saved32BE-2 testsaved32BE-2
+call :runsub 22 testout "Reloads for the 16/32-bit library with UTF-16/32 support" -q
+call :runsub 22 testoutstudy "Test with Study Override" -q -s
+if %jit% EQU 1 call :runsub 22 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do23
+if NOT %bits% EQU 16 (
+ echo Test 23 Skipped when running 8/32-bit tests.
+ goto :eof
+)
+call :runsub 23 testout "Specials for the 16-bit library" -q
+call :runsub 23 testoutstudy "Test with Study Override" -q -s
+if %jit% EQU 1 call :runsub 23 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do24
+if NOT %bits% EQU 16 (
+ echo Test 24 Skipped when running 8/32-bit tests.
+ goto :eof
+)
+if %utf% EQU 0 (
+ echo Test 24 Skipped due to absence of UTF-%bits% support.
+ goto :eof
+)
+call :runsub 24 testout "Specials for the 16-bit library with UTF-16 support" -q
+call :runsub 24 testoutstudy "Test with Study Override" -q -s
+if %jit% EQU 1 call :runsub 24 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do25
+if NOT %bits% EQU 32 (
+ echo Test 25 Skipped when running 8/16-bit tests.
+ goto :eof
+)
+call :runsub 25 testout "Specials for the 32-bit library" -q
+call :runsub 25 testoutstudy "Test with Study Override" -q -s
+if %jit% EQU 1 call :runsub 25 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do26
+if NOT %bits% EQU 32 (
+ echo Test 26 Skipped when running 8/16-bit tests.
+ goto :eof
+)
+if %utf% EQU 0 (
+ echo Test 26 Skipped due to absence of UTF-%bits% support.
+ goto :eof
+)
+call :runsub 26 testout "Specials for the 32-bit library with UTF-32 support" -q
+call :runsub 26 testoutstudy "Test with Study Override" -q -s
+if %jit% EQU 1 call :runsub 26 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:conferror
+@echo.
+@echo Either your build is incomplete or you have a configuration error.
+@echo.
+@echo If configured with cmake and executed via "make test" or the MSVC "RUN_TESTS"
+@echo project, pcre_test.bat defines variables and automatically calls RunTest.bat.
+@echo For manual testing of all available features, after configuring with cmake
+@echo and building, you can run the built pcre_test.bat. For best results with
+@echo cmake builds and tests avoid directories with full path names that include
+@echo spaces for source or build.
+@echo.
+@echo Otherwise, if the build dir is in a subdir of the source dir, testdata needed
+@echo for input and verification should be found automatically when (from the
+@echo location of the the built exes) you call RunTest.bat. By default RunTest.bat
+@echo runs all tests compatible with the linked pcre library but it can be given
+@echo a test number as an argument.
+@echo.
+@echo If the build dir is not under the source dir you can either copy your exes
+@echo to the source folder or copy RunTest.bat and the testdata folder to the
+@echo location of your built exes and then run RunTest.bat.
+@echo.
+goto :eof
diff --git a/pcre/configure.ac b/pcre/configure.ac
index e7dffbe003f..38d1dba182a 100644
--- a/pcre/configure.ac
+++ b/pcre/configure.ac
@@ -9,17 +9,17 @@ 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, [36])
+m4_define(pcre_minor, [37])
m4_define(pcre_prerelease, [])
-m4_define(pcre_date, [2014-09-26])
+m4_define(pcre_date, [2015-04-28])
# 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:4:2])
-m4_define(libpcre16_version, [2:4:2])
-m4_define(libpcre32_version, [0:4:0])
+m4_define(libpcre_version, [3:5:2])
+m4_define(libpcre16_version, [2:5:2])
+m4_define(libpcre32_version, [0:5:0])
m4_define(libpcreposix_version, [0:3:0])
m4_define(libpcrecpp_version, [0:1:0])
diff --git a/pcre/doc/html/NON-AUTOTOOLS-BUILD.txt b/pcre/doc/html/NON-AUTOTOOLS-BUILD.txt
index cddf3e0699b..1c3da84fcaa 100644
--- a/pcre/doc/html/NON-AUTOTOOLS-BUILD.txt
+++ b/pcre/doc/html/NON-AUTOTOOLS-BUILD.txt
@@ -1,6 +1,14 @@
Building PCRE without using autotools
-------------------------------------
+NOTE: This document relates to PCRE releases that use the original API, with
+library names libpcre, libpcre16, and libpcre32. January 2015 saw the first
+release of a new API, known as PCRE2, with release numbers starting at 10.00
+and library names libpcre2-8, libpcre2-16, and libpcre2-32. The old libraries
+(now called PCRE1) are still being maintained for bug fixes, but there will be
+no new development. New projects are advised to use the new PCRE2 libraries.
+
+
This document contains the following sections:
General
@@ -761,4 +769,4 @@ There is also a mirror here:
http://www.vsoft-software.com/downloads.html
==========================
-Last Updated: 14 May 2013
+Last Updated: 10 February 2015
diff --git a/pcre/doc/html/README.txt b/pcre/doc/html/README.txt
index e30bd0fd5b7..4887ebf350e 100644
--- a/pcre/doc/html/README.txt
+++ b/pcre/doc/html/README.txt
@@ -1,7 +1,16 @@
README file for PCRE (Perl-compatible regular expression library)
-----------------------------------------------------------------
-The latest release of PCRE is always available in three alternative formats
+NOTE: This set of files relates to PCRE releases that use the original API,
+with library names libpcre, libpcre16, and libpcre32. January 2015 saw the
+first release of a new API, known as PCRE2, with release numbers starting at
+10.00 and library names libpcre2-8, libpcre2-16, and libpcre2-32. The old
+libraries (now called PCRE1) are still being maintained for bug fixes, but
+there will be no new development. New projects are advised to use the new PCRE2
+libraries.
+
+
+The latest release of PCRE1 is always available in three alternative formats
from:
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-xxx.tar.gz
@@ -990,4 +999,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: 24 October 2014
+Last updated: 10 February 2015
diff --git a/pcre/doc/html/pcre.html b/pcre/doc/html/pcre.html
index c2b29aa8121..c87b1066427 100644
--- a/pcre/doc/html/pcre.html
+++ b/pcre/doc/html/pcre.html
@@ -13,13 +13,24 @@ from the original man page. If there is any nonsense in it, please consult the
man page, in case the conversion went wrong.
<br>
<ul>
-<li><a name="TOC1" href="#SEC1">INTRODUCTION</a>
-<li><a name="TOC2" href="#SEC2">SECURITY CONSIDERATIONS</a>
-<li><a name="TOC3" href="#SEC3">USER DOCUMENTATION</a>
-<li><a name="TOC4" href="#SEC4">AUTHOR</a>
-<li><a name="TOC5" href="#SEC5">REVISION</a>
+<li><a name="TOC1" href="#SEC1">PLEASE TAKE NOTE</a>
+<li><a name="TOC2" href="#SEC2">INTRODUCTION</a>
+<li><a name="TOC3" href="#SEC3">SECURITY CONSIDERATIONS</a>
+<li><a name="TOC4" href="#SEC4">USER DOCUMENTATION</a>
+<li><a name="TOC5" href="#SEC5">AUTHOR</a>
+<li><a name="TOC6" href="#SEC6">REVISION</a>
</ul>
-<br><a name="SEC1" href="#TOC1">INTRODUCTION</a><br>
+<br><a name="SEC1" href="#TOC1">PLEASE TAKE NOTE</a><br>
+<P>
+This document relates to PCRE releases that use the original API,
+with library names libpcre, libpcre16, and libpcre32. January 2015 saw the
+first release of a new API, known as PCRE2, with release numbers starting at
+10.00 and library names libpcre2-8, libpcre2-16, and libpcre2-32. The old
+libraries (now called PCRE1) are still being maintained for bug fixes, but
+there will be no new development. New projects are advised to use the new PCRE2
+libraries.
+</P>
+<br><a name="SEC2" href="#TOC1">INTRODUCTION</a><br>
<P>
The PCRE library is a set of functions that implement regular expression
pattern matching using the same syntax and semantics as Perl, with just a few
@@ -115,7 +126,7 @@ clashes. In some environments, it is possible to control which external symbols
are exported when a shared library is built, and in these cases the
undocumented symbols are not exported.
</P>
-<br><a name="SEC2" href="#TOC1">SECURITY CONSIDERATIONS</a><br>
+<br><a name="SEC3" href="#TOC1">SECURITY CONSIDERATIONS</a><br>
<P>
If you are using PCRE in a non-UTF application that permits users to supply
arbitrary patterns for compilation, you should be aware of a feature that
@@ -149,7 +160,7 @@ against this: see the PCRE_EXTRA_MATCH_LIMIT feature in the
<a href="pcreapi.html"><b>pcreapi</b></a>
page.
</P>
-<br><a name="SEC3" href="#TOC1">USER DOCUMENTATION</a><br>
+<br><a name="SEC4" href="#TOC1">USER DOCUMENTATION</a><br>
<P>
The user documentation for PCRE comprises a number of different sections. In
the "man" format, each of these is a separate "man page". In the HTML format,
@@ -188,7 +199,7 @@ follows:
In the "man" and HTML formats, there is also a short page for each C library
function, listing its arguments and results.
</P>
-<br><a name="SEC4" href="#TOC1">AUTHOR</a><br>
+<br><a name="SEC5" href="#TOC1">AUTHOR</a><br>
<P>
Philip Hazel
<br>
@@ -202,11 +213,11 @@ Putting an actual email address here seems to have been a spam magnet, so I've
taken it away. If you want to email me, use my two initials, followed by the
two digits 10, at the domain cam.ac.uk.
</P>
-<br><a name="SEC5" href="#TOC1">REVISION</a><br>
+<br><a name="SEC6" href="#TOC1">REVISION</a><br>
<P>
-Last updated: 08 January 2014
+Last updated: 10 February 2015
<br>
-Copyright &copy; 1997-2014 University of Cambridge.
+Copyright &copy; 1997-2015 University of Cambridge.
<br>
<p>
Return to the <a href="index.html">PCRE index page</a>.
diff --git a/pcre/doc/pcre.3 b/pcre/doc/pcre.3
index 4eda404ccff..0f2837e7c06 100644
--- a/pcre/doc/pcre.3
+++ b/pcre/doc/pcre.3
@@ -1,6 +1,18 @@
-.TH PCRE 3 "08 January 2014" "PCRE 8.35"
+.TH PCRE 3 "10 February 2015" "PCRE 8.37"
.SH NAME
-PCRE - Perl-compatible regular expressions
+PCRE - Perl-compatible regular expressions (original API)
+.SH "PLEASE TAKE NOTE"
+.rs
+.sp
+This document relates to PCRE releases that use the original API,
+with library names libpcre, libpcre16, and libpcre32. January 2015 saw the
+first release of a new API, known as PCRE2, with release numbers starting at
+10.00 and library names libpcre2-8, libpcre2-16, and libpcre2-32. The old
+libraries (now called PCRE1) are still being maintained for bug fixes, but
+there will be no new development. New projects are advised to use the new PCRE2
+libraries.
+.
+.
.SH INTRODUCTION
.rs
.sp
@@ -213,6 +225,6 @@ two digits 10, at the domain cam.ac.uk.
.rs
.sp
.nf
-Last updated: 08 January 2014
-Copyright (c) 1997-2014 University of Cambridge.
+Last updated: 10 February 2015
+Copyright (c) 1997-2015 University of Cambridge.
.fi
diff --git a/pcre/doc/pcre.txt b/pcre/doc/pcre.txt
index ce27f4b3e0c..bc92e4f082d 100644
--- a/pcre/doc/pcre.txt
+++ b/pcre/doc/pcre.txt
@@ -13,7 +13,18 @@ PCRE(3) Library Functions Manual PCRE(3)
NAME
- PCRE - Perl-compatible regular expressions
+ PCRE - Perl-compatible regular expressions (original API)
+
+PLEASE TAKE NOTE
+
+ This document relates to PCRE releases that use the original API, with
+ library names libpcre, libpcre16, and libpcre32. January 2015 saw the
+ first release of a new API, known as PCRE2, with release numbers start-
+ ing at 10.00 and library names libpcre2-8, libpcre2-16, and
+ libpcre2-32. The old libraries (now called PCRE1) are still being main-
+ tained for bug fixes, but there will be no new development. New
+ projects are advised to use the new PCRE2 libraries.
+
INTRODUCTION
@@ -179,8 +190,8 @@ AUTHOR
REVISION
- Last updated: 08 January 2014
- Copyright (c) 1997-2014 University of Cambridge.
+ Last updated: 10 February 2015
+ Copyright (c) 1997-2015 University of Cambridge.
------------------------------------------------------------------------------
diff --git a/pcre/pcre_compile.c b/pcre/pcre_compile.c
index efc0b21fd14..0efad2645d9 100644
--- a/pcre/pcre_compile.c
+++ b/pcre/pcre_compile.c
@@ -1704,6 +1704,7 @@ Arguments:
utf TRUE in UTF-8 / UTF-16 / UTF-32 mode
atend TRUE if called when the pattern is complete
cd the "compile data" structure
+ recurses chain of recurse_check to catch mutual recursion
Returns: the fixed length,
or -1 if there is no fixed length,
@@ -1713,10 +1714,11 @@ Returns: the fixed length,
*/
static int
-find_fixedlength(pcre_uchar *code, BOOL utf, BOOL atend, compile_data *cd)
+find_fixedlength(pcre_uchar *code, BOOL utf, BOOL atend, compile_data *cd,
+ recurse_check *recurses)
{
int length = -1;
-
+recurse_check this_recurse;
register int branchlength = 0;
register pcre_uchar *cc = code + 1 + LINK_SIZE;
@@ -1741,7 +1743,8 @@ for (;;)
case OP_ONCE:
case OP_ONCE_NC:
case OP_COND:
- d = find_fixedlength(cc + ((op == OP_CBRA)? IMM2_SIZE : 0), utf, atend, cd);
+ d = find_fixedlength(cc + ((op == OP_CBRA)? IMM2_SIZE : 0), utf, atend, cd,
+ recurses);
if (d < 0) return d;
branchlength += d;
do cc += GET(cc, 1); while (*cc == OP_ALT);
@@ -1775,7 +1778,15 @@ for (;;)
cs = ce = (pcre_uchar *)cd->start_code + GET(cc, 1); /* Start subpattern */
do ce += GET(ce, 1); while (*ce == OP_ALT); /* End subpattern */
if (cc > cs && cc < ce) return -1; /* Recursion */
- d = find_fixedlength(cs + IMM2_SIZE, utf, atend, cd);
+ else /* Check for mutual recursion */
+ {
+ recurse_check *r = recurses;
+ for (r = recurses; r != NULL; r = r->prev) if (r->group == cs) break;
+ if (r != NULL) return -1; /* Mutual recursion */
+ }
+ this_recurse.prev = recurses;
+ this_recurse.group = cs;
+ d = find_fixedlength(cs + IMM2_SIZE, utf, atend, cd, &this_recurse);
if (d < 0) return d;
branchlength += d;
cc += 1 + LINK_SIZE;
@@ -2129,32 +2140,60 @@ for (;;)
{
case OP_CHAR:
case OP_CHARI:
+ case OP_NOT:
+ case OP_NOTI:
case OP_EXACT:
case OP_EXACTI:
+ case OP_NOTEXACT:
+ case OP_NOTEXACTI:
case OP_UPTO:
case OP_UPTOI:
+ case OP_NOTUPTO:
+ case OP_NOTUPTOI:
case OP_MINUPTO:
case OP_MINUPTOI:
+ case OP_NOTMINUPTO:
+ case OP_NOTMINUPTOI:
case OP_POSUPTO:
case OP_POSUPTOI:
+ case OP_NOTPOSUPTO:
+ case OP_NOTPOSUPTOI:
case OP_STAR:
case OP_STARI:
+ case OP_NOTSTAR:
+ case OP_NOTSTARI:
case OP_MINSTAR:
case OP_MINSTARI:
+ case OP_NOTMINSTAR:
+ case OP_NOTMINSTARI:
case OP_POSSTAR:
case OP_POSSTARI:
+ case OP_NOTPOSSTAR:
+ case OP_NOTPOSSTARI:
case OP_PLUS:
case OP_PLUSI:
+ case OP_NOTPLUS:
+ case OP_NOTPLUSI:
case OP_MINPLUS:
case OP_MINPLUSI:
+ case OP_NOTMINPLUS:
+ case OP_NOTMINPLUSI:
case OP_POSPLUS:
case OP_POSPLUSI:
+ case OP_NOTPOSPLUS:
+ case OP_NOTPOSPLUSI:
case OP_QUERY:
case OP_QUERYI:
+ case OP_NOTQUERY:
+ case OP_NOTQUERYI:
case OP_MINQUERY:
case OP_MINQUERYI:
+ case OP_NOTMINQUERY:
+ case OP_NOTMINQUERYI:
case OP_POSQUERY:
case OP_POSQUERYI:
+ case OP_NOTPOSQUERY:
+ case OP_NOTPOSQUERYI:
if (HAS_EXTRALEN(code[-1])) code += GET_EXTRALEN(code[-1]);
break;
}
@@ -2334,11 +2373,6 @@ Arguments:
Returns: TRUE if what is matched could be empty
*/
-typedef struct recurse_check {
- struct recurse_check *prev;
- const pcre_uchar *group;
-} recurse_check;
-
static BOOL
could_be_empty_branch(const pcre_uchar *code, const pcre_uchar *endcode,
BOOL utf, compile_data *cd, recurse_check *recurses)
@@ -2469,8 +2503,8 @@ for (code = first_significant_code(code + PRIV(OP_lengths)[*code], TRUE);
empty_branch = FALSE;
do
{
- if (!empty_branch && could_be_empty_branch(code, endcode, utf, cd, NULL))
- empty_branch = TRUE;
+ if (!empty_branch && could_be_empty_branch(code, endcode, utf, cd,
+ recurses)) empty_branch = TRUE;
code += GET(code, 1);
}
while (*code == OP_ALT);
@@ -3065,7 +3099,7 @@ Returns: TRUE if the auto-possessification is possible
static BOOL
compare_opcodes(const pcre_uchar *code, BOOL utf, const compile_data *cd,
- const pcre_uint32 *base_list, const pcre_uchar *base_end)
+ const pcre_uint32 *base_list, const pcre_uchar *base_end, int *rec_limit)
{
pcre_uchar c;
pcre_uint32 list[8];
@@ -3082,6 +3116,9 @@ pcre_uint32 chr;
BOOL accepted, invert_bits;
BOOL entered_a_group = FALSE;
+if (*rec_limit == 0) return FALSE;
+--(*rec_limit);
+
/* Note: the base_list[1] contains whether the current opcode has greedy
(represented by a non-zero value) quantifier. This is a different from
other character type lists, which stores here that the character iterator
@@ -3152,7 +3189,8 @@ for(;;)
while (*next_code == OP_ALT)
{
- if (!compare_opcodes(code, utf, cd, base_list, base_end)) return FALSE;
+ if (!compare_opcodes(code, utf, cd, base_list, base_end, rec_limit))
+ return FALSE;
code = next_code + 1 + LINK_SIZE;
next_code += GET(next_code, 1);
}
@@ -3172,7 +3210,7 @@ for(;;)
/* The bracket content will be checked by the
OP_BRA/OP_CBRA case above. */
next_code += 1 + LINK_SIZE;
- if (!compare_opcodes(next_code, utf, cd, base_list, base_end))
+ if (!compare_opcodes(next_code, utf, cd, base_list, base_end, rec_limit))
return FALSE;
code += PRIV(OP_lengths)[c];
@@ -3605,11 +3643,20 @@ register pcre_uchar c;
const pcre_uchar *end;
pcre_uchar *repeat_opcode;
pcre_uint32 list[8];
+int rec_limit;
for (;;)
{
c = *code;
+ /* When a pattern with bad UTF-8 encoding is compiled with NO_UTF_CHECK,
+ it may compile without complaining, but may get into a loop here if the code
+ pointer points to a bad value. This is, of course a documentated possibility,
+ when NO_UTF_CHECK is set, so it isn't a bug, but we can detect this case and
+ just give up on this optimization. */
+
+ if (c >= OP_TABLE_LENGTH) return;
+
if (c >= OP_STAR && c <= OP_TYPEPOSUPTO)
{
c -= get_repeat_base(c) - OP_STAR;
@@ -3617,7 +3664,8 @@ for (;;)
get_chr_property_list(code, utf, cd->fcc, list) : NULL;
list[1] = c == OP_STAR || c == OP_PLUS || c == OP_QUERY || c == OP_UPTO;
- if (end != NULL && compare_opcodes(end, utf, cd, list, end))
+ rec_limit = 1000;
+ if (end != NULL && compare_opcodes(end, utf, cd, list, end, &rec_limit))
{
switch(c)
{
@@ -3673,7 +3721,8 @@ for (;;)
list[1] = (c & 1) == 0;
- if (compare_opcodes(end, utf, cd, list, end))
+ rec_limit = 1000;
+ if (compare_opcodes(end, utf, cd, list, end, &rec_limit))
{
switch (c)
{
@@ -3947,14 +3996,14 @@ Arguments:
adjust the amount by which the group is to be moved
utf TRUE in UTF-8 / UTF-16 / UTF-32 mode
cd contains pointers to tables etc.
- save_hwm the hwm forward reference pointer at the start of the group
+ save_hwm_offset the hwm forward reference offset at the start of the group
Returns: nothing
*/
static void
adjust_recurse(pcre_uchar *group, int adjust, BOOL utf, compile_data *cd,
- pcre_uchar *save_hwm)
+ size_t save_hwm_offset)
{
pcre_uchar *ptr = group;
@@ -3966,7 +4015,8 @@ while ((ptr = (pcre_uchar *)find_recurse(ptr, utf)) != NULL)
/* See if this recursion is on the forward reference list. If so, adjust the
reference. */
- for (hc = save_hwm; hc < cd->hwm; hc += LINK_SIZE)
+ for (hc = (pcre_uchar *)cd->start_workspace + save_hwm_offset; hc < cd->hwm;
+ hc += LINK_SIZE)
{
offset = (int)GET(hc, 0);
if (cd->start_code + offset == ptr + 1)
@@ -4171,7 +4221,11 @@ if ((options & PCRE_CASELESS) != 0)
range. Otherwise, use a recursive call to add the additional range. */
else if (oc < start && od >= start - 1) start = oc; /* Extend downwards */
- else if (od > end && oc <= end + 1) end = od; /* Extend upwards */
+ else if (od > end && oc <= end + 1)
+ {
+ end = od; /* Extend upwards */
+ if (end > classbits_end) classbits_end = (end <= 0xff ? end : 0xff);
+ }
else n8 += add_to_class(classbits, uchardptr, options, cd, oc, od);
}
}
@@ -4411,7 +4465,7 @@ const pcre_uchar *tempptr;
const pcre_uchar *nestptr = NULL;
pcre_uchar *previous = NULL;
pcre_uchar *previous_callout = NULL;
-pcre_uchar *save_hwm = NULL;
+size_t save_hwm_offset = 0;
pcre_uint8 classbits[32];
/* We can fish out the UTF-8 setting once and for all into a BOOL, but we
@@ -5470,6 +5524,12 @@ for (;; ptr++)
PUT(previous, 1, (int)(code - previous));
break; /* End of class handling */
}
+
+ /* Even though any XCLASS list is now discarded, we must allow for
+ its memory. */
+
+ if (lengthptr != NULL)
+ *lengthptr += (int)(class_uchardata - class_uchardata_base);
#endif
/* If there are no characters > 255, or they are all to be included or
@@ -5870,6 +5930,7 @@ for (;; ptr++)
{
register int i;
int len = (int)(code - previous);
+ size_t base_hwm_offset = save_hwm_offset;
pcre_uchar *bralink = NULL;
pcre_uchar *brazeroptr = NULL;
@@ -5924,7 +5985,7 @@ for (;; ptr++)
if (repeat_max <= 1) /* Covers 0, 1, and unlimited */
{
*code = OP_END;
- adjust_recurse(previous, 1, utf, cd, save_hwm);
+ adjust_recurse(previous, 1, utf, cd, save_hwm_offset);
memmove(previous + 1, previous, IN_UCHARS(len));
code++;
if (repeat_max == 0)
@@ -5948,7 +6009,7 @@ for (;; ptr++)
{
int offset;
*code = OP_END;
- adjust_recurse(previous, 2 + LINK_SIZE, utf, cd, save_hwm);
+ adjust_recurse(previous, 2 + LINK_SIZE, utf, cd, save_hwm_offset);
memmove(previous + 2 + LINK_SIZE, previous, IN_UCHARS(len));
code += 2 + LINK_SIZE;
*previous++ = OP_BRAZERO + repeat_type;
@@ -6011,26 +6072,25 @@ for (;; ptr++)
for (i = 1; i < repeat_min; i++)
{
pcre_uchar *hc;
- pcre_uchar *this_hwm = cd->hwm;
+ size_t this_hwm_offset = cd->hwm - cd->start_workspace;
memcpy(code, previous, IN_UCHARS(len));
while (cd->hwm > cd->start_workspace + cd->workspace_size -
- WORK_SIZE_SAFETY_MARGIN - (this_hwm - save_hwm))
+ WORK_SIZE_SAFETY_MARGIN -
+ (this_hwm_offset - base_hwm_offset))
{
- 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;
- this_hwm = (pcre_uchar *)cd->start_workspace + this_offset;
}
- for (hc = save_hwm; hc < this_hwm; hc += LINK_SIZE)
+ for (hc = (pcre_uchar *)cd->start_workspace + base_hwm_offset;
+ hc < (pcre_uchar *)cd->start_workspace + this_hwm_offset;
+ hc += LINK_SIZE)
{
PUT(cd->hwm, 0, GET(hc, 0) + len);
cd->hwm += LINK_SIZE;
}
- save_hwm = this_hwm;
+ base_hwm_offset = this_hwm_offset;
code += len;
}
}
@@ -6075,7 +6135,7 @@ for (;; ptr++)
else for (i = repeat_max - 1; i >= 0; i--)
{
pcre_uchar *hc;
- pcre_uchar *this_hwm = cd->hwm;
+ size_t this_hwm_offset = cd->hwm - cd->start_workspace;
*code++ = OP_BRAZERO + repeat_type;
@@ -6097,22 +6157,21 @@ for (;; ptr++)
copying them. */
while (cd->hwm > cd->start_workspace + cd->workspace_size -
- WORK_SIZE_SAFETY_MARGIN - (this_hwm - save_hwm))
+ WORK_SIZE_SAFETY_MARGIN -
+ (this_hwm_offset - base_hwm_offset))
{
- 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;
- this_hwm = (pcre_uchar *)cd->start_workspace + this_offset;
}
- for (hc = save_hwm; hc < this_hwm; hc += LINK_SIZE)
+ for (hc = (pcre_uchar *)cd->start_workspace + base_hwm_offset;
+ hc < (pcre_uchar *)cd->start_workspace + this_hwm_offset;
+ hc += LINK_SIZE)
{
PUT(cd->hwm, 0, GET(hc, 0) + len + ((i != 0)? 2+LINK_SIZE : 1));
cd->hwm += LINK_SIZE;
}
- save_hwm = this_hwm;
+ base_hwm_offset = this_hwm_offset;
code += len;
}
@@ -6208,7 +6267,7 @@ for (;; ptr++)
{
int nlen = (int)(code - bracode);
*code = OP_END;
- adjust_recurse(bracode, 1 + LINK_SIZE, utf, cd, save_hwm);
+ adjust_recurse(bracode, 1 + LINK_SIZE, utf, cd, save_hwm_offset);
memmove(bracode + 1 + LINK_SIZE, bracode, IN_UCHARS(nlen));
code += 1 + LINK_SIZE;
nlen += 1 + LINK_SIZE;
@@ -6342,7 +6401,7 @@ for (;; ptr++)
else
{
*code = OP_END;
- adjust_recurse(tempcode, 1 + LINK_SIZE, utf, cd, save_hwm);
+ adjust_recurse(tempcode, 1 + LINK_SIZE, utf, cd, save_hwm_offset);
memmove(tempcode + 1 + LINK_SIZE, tempcode, IN_UCHARS(len));
code += 1 + LINK_SIZE;
len += 1 + LINK_SIZE;
@@ -6391,7 +6450,7 @@ for (;; ptr++)
default:
*code = OP_END;
- adjust_recurse(tempcode, 1 + LINK_SIZE, utf, cd, save_hwm);
+ adjust_recurse(tempcode, 1 + LINK_SIZE, utf, cd, save_hwm_offset);
memmove(tempcode + 1 + LINK_SIZE, tempcode, IN_UCHARS(len));
code += 1 + LINK_SIZE;
len += 1 + LINK_SIZE;
@@ -6420,15 +6479,25 @@ for (;; ptr++)
parenthesis forms. */
case CHAR_LEFT_PARENTHESIS:
- newoptions = options;
- skipbytes = 0;
- bravalue = OP_CBRA;
- save_hwm = cd->hwm;
- reset_bracount = FALSE;
+ ptr++;
- /* First deal with various "verbs" that can be introduced by '*'. */
+ /* First deal with comments. Putting this code right at the start ensures
+ that comments have no bad side effects. */
+
+ if (ptr[0] == CHAR_QUESTION_MARK && ptr[1] == CHAR_NUMBER_SIGN)
+ {
+ ptr += 2;
+ while (*ptr != CHAR_NULL && *ptr != CHAR_RIGHT_PARENTHESIS) ptr++;
+ if (*ptr == CHAR_NULL)
+ {
+ *errorcodeptr = ERR18;
+ goto FAILED;
+ }
+ continue;
+ }
+
+ /* Now deal with various "verbs" that can be introduced by '*'. */
- ptr++;
if (ptr[0] == CHAR_ASTERISK && (ptr[1] == ':'
|| (MAX_255(ptr[1]) && ((cd->ctypes[ptr[1]] & ctype_letter) != 0))))
{
@@ -6549,10 +6618,18 @@ for (;; ptr++)
goto FAILED;
}
+ /* Initialize for "real" parentheses */
+
+ newoptions = options;
+ skipbytes = 0;
+ bravalue = OP_CBRA;
+ save_hwm_offset = cd->hwm - cd->start_workspace;
+ reset_bracount = FALSE;
+
/* Deal with the extended parentheses; all are introduced by '?', and the
appearance of any of them means that this is not a capturing group. */
- else if (*ptr == CHAR_QUESTION_MARK)
+ if (*ptr == CHAR_QUESTION_MARK)
{
int i, set, unset, namelen;
int *optset;
@@ -6561,17 +6638,6 @@ for (;; ptr++)
switch (*(++ptr))
{
- case CHAR_NUMBER_SIGN: /* Comment; skip to ket */
- ptr++;
- while (*ptr != CHAR_NULL && *ptr != CHAR_RIGHT_PARENTHESIS) ptr++;
- if (*ptr == CHAR_NULL)
- {
- *errorcodeptr = ERR18;
- goto FAILED;
- }
- continue;
-
-
/* ------------------------------------------------------------ */
case CHAR_VERTICAL_LINE: /* Reset capture count for each branch */
reset_bracount = TRUE;
@@ -6620,8 +6686,13 @@ for (;; ptr++)
if (tempptr[1] == CHAR_QUESTION_MARK &&
(tempptr[2] == CHAR_EQUALS_SIGN ||
tempptr[2] == CHAR_EXCLAMATION_MARK ||
- tempptr[2] == CHAR_LESS_THAN_SIGN))
+ (tempptr[2] == CHAR_LESS_THAN_SIGN &&
+ (tempptr[3] == CHAR_EQUALS_SIGN ||
+ tempptr[3] == CHAR_EXCLAMATION_MARK))))
+ {
+ cd->iscondassert = TRUE;
break;
+ }
/* Other conditions use OP_CREF/OP_DNCREF/OP_RREF/OP_DNRREF, and all
need to skip at least 1+IMM2_SIZE bytes at the start of the group. */
@@ -6698,8 +6769,7 @@ for (;; ptr++)
ptr++;
}
namelen = (int)(ptr - name);
- if (lengthptr != NULL && (options & PCRE_DUPNAMES) != 0)
- *lengthptr += IMM2_SIZE;
+ if (lengthptr != NULL) *lengthptr += IMM2_SIZE;
}
/* Check the terminator */
@@ -6735,6 +6805,7 @@ for (;; ptr++)
goto FAILED;
}
PUT2(code, 2+LINK_SIZE, recno);
+ if (recno > cd->top_backref) cd->top_backref = recno;
break;
}
@@ -6757,6 +6828,7 @@ for (;; ptr++)
int offset = i++;
int count = 1;
recno = GET2(slot, 0); /* Number from first found */
+ if (recno > cd->top_backref) cd->top_backref = recno;
for (; i < cd->names_found; i++)
{
slot += cd->name_entry_size;
@@ -7114,11 +7186,11 @@ for (;; ptr++)
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. */
+ /* 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;
+ *lengthptr += IMM2_SIZE;
}
/* In the real compile, search the name table. We check the name
@@ -7475,12 +7547,22 @@ for (;; ptr++)
goto FAILED;
}
- /* Assertions used not to be repeatable, but this was changed for Perl
- compatibility, so all kinds can now be repeated. We copy code into a
+ /* All assertions used not to be repeatable, but this was changed for Perl
+ compatibility. All kinds can now be repeated except for assertions that are
+ conditions (Perl also forbids these to be repeated). We copy code into a
non-register variable (tempcode) in order to be able to pass its address
- because some compilers complain otherwise. */
+ because some compilers complain otherwise. At the start of a conditional
+ group whose condition is an assertion, cd->iscondassert is set. We unset it
+ here so as to allow assertions later in the group to be quantified. */
+
+ if (bravalue >= OP_ASSERT && bravalue <= OP_ASSERTBACK_NOT &&
+ cd->iscondassert)
+ {
+ previous = NULL;
+ cd->iscondassert = FALSE;
+ }
+ else previous = code;
- previous = code; /* For handling repetition */
*code = bravalue;
tempcode = code;
tempreqvary = cd->req_varyopt; /* Save value before bracket */
@@ -7727,7 +7809,7 @@ for (;; ptr++)
const pcre_uchar *p;
pcre_uint32 cf;
- save_hwm = cd->hwm; /* Normally this is set when '(' is read */
+ save_hwm_offset = cd->hwm - cd->start_workspace; /* Normally this is set when '(' is read */
terminator = (*(++ptr) == CHAR_LESS_THAN_SIGN)?
CHAR_GREATER_THAN_SIGN : CHAR_APOSTROPHE;
@@ -8054,6 +8136,7 @@ int length;
unsigned int orig_bracount;
unsigned int max_bracount;
branch_chain bc;
+size_t save_hwm_offset;
/* If set, call the external function that checks for stack availability. */
@@ -8071,6 +8154,8 @@ bc.current_branch = code;
firstchar = reqchar = 0;
firstcharflags = reqcharflags = REQ_UNSET;
+save_hwm_offset = cd->hwm - cd->start_workspace;
+
/* Accumulate the length for use in the pre-compile phase. Start with the
length of the BRA and KET and any extra bytes that are required at the
beginning. We accumulate in a local variable to save frequent testing of
@@ -8212,7 +8297,7 @@ for (;;)
int fixed_length;
*code = OP_END;
fixed_length = find_fixedlength(last_branch, (options & PCRE_UTF8) != 0,
- FALSE, cd);
+ FALSE, cd, NULL);
DPRINTF(("fixed length = %d\n", fixed_length));
if (fixed_length == -3)
{
@@ -8273,7 +8358,7 @@ for (;;)
{
*code = OP_END;
adjust_recurse(start_bracket, 1 + LINK_SIZE,
- (options & PCRE_UTF8) != 0, cd, cd->hwm);
+ (options & PCRE_UTF8) != 0, cd, save_hwm_offset);
memmove(start_bracket + 1 + LINK_SIZE, start_bracket,
IN_UCHARS(code - start_bracket));
*start_bracket = OP_ONCE;
@@ -8497,6 +8582,7 @@ do {
case OP_RREF:
case OP_DNRREF:
case OP_DEF:
+ case OP_FAIL:
return FALSE;
default: /* Assertion */
@@ -9081,6 +9167,7 @@ cd->dupnames = FALSE;
cd->namedrefcount = 0;
cd->start_code = cworkspace;
cd->hwm = cworkspace;
+cd->iscondassert = FALSE;
cd->start_workspace = cworkspace;
cd->workspace_size = COMPILE_WORK_SIZE;
cd->named_groups = named_groups;
@@ -9118,13 +9205,6 @@ if (length > MAX_PATTERN_SIZE)
goto PCRE_EARLY_ERROR_RETURN;
}
-/* If there are groups with duplicate names and there are also references by
-name, we must allow for the possibility of named references to duplicated
-groups. These require an extra data item each. */
-
-if (cd->dupnames && cd->namedrefcount > 0)
- length += cd->namedrefcount * IMM2_SIZE * sizeof(pcre_uchar);
-
/* Compute the size of the data block for storing the compiled pattern. Integer
overflow should no longer be possible because nowadays we limit the maximum
value of cd->names_found and cd->name_entry_size. */
@@ -9183,6 +9263,7 @@ cd->name_table = (pcre_uchar *)re + re->name_table_offset;
codestart = cd->name_table + re->name_entry_size * re->name_count;
cd->start_code = codestart;
cd->hwm = (pcre_uchar *)(cd->start_workspace);
+cd->iscondassert = FALSE;
cd->req_varyopt = 0;
cd->had_accept = FALSE;
cd->had_pruneorskip = FALSE;
@@ -9319,7 +9400,7 @@ if (cd->check_lookbehind)
int end_op = *be;
*be = OP_END;
fixed_length = find_fixedlength(cc, (re->options & PCRE_UTF8) != 0, TRUE,
- cd);
+ cd, NULL);
*be = end_op;
DPRINTF(("fixed length = %d\n", fixed_length));
if (fixed_length < 0)
diff --git a/pcre/pcre_dfa_exec.c b/pcre/pcre_dfa_exec.c
index 87f4aef9ab1..170ce6a0016 100644
--- a/pcre/pcre_dfa_exec.c
+++ b/pcre/pcre_dfa_exec.c
@@ -2736,9 +2736,10 @@ for (;;)
condcode == OP_DNRREF)
return PCRE_ERROR_DFA_UCOND;
- /* The DEFINE condition is always false */
+ /* The DEFINE condition is always false, and the assertion (?!) is
+ converted to OP_FAIL. */
- if (condcode == OP_DEF)
+ if (condcode == OP_DEF || condcode == OP_FAIL)
{ ADD_ACTIVE(state_offset + codelink + LINK_SIZE + 1, 0); }
/* The only supported version of OP_RREF is for the value RREF_ANY,
diff --git a/pcre/pcre_exec.c b/pcre/pcre_exec.c
index 654eb9e2762..c021fe1a4c9 100644
--- a/pcre/pcre_exec.c
+++ b/pcre/pcre_exec.c
@@ -1136,93 +1136,81 @@ for (;;)
printf("\n");
#endif
- if (offset < md->offset_max)
- {
- matched_once = FALSE;
- code_offset = (int)(ecode - md->start_code);
-
- save_offset1 = md->offset_vector[offset];
- save_offset2 = md->offset_vector[offset+1];
- save_offset3 = md->offset_vector[md->offset_end - number];
- save_capture_last = md->capture_last;
+ if (offset >= md->offset_max) goto POSSESSIVE_NON_CAPTURE;
- DPRINTF(("saving %d %d %d\n", save_offset1, save_offset2, save_offset3));
+ matched_once = FALSE;
+ code_offset = (int)(ecode - md->start_code);
- /* Each time round the loop, save the current subject position for use
- when the group matches. For MATCH_MATCH, the group has matched, so we
- restart it with a new subject starting position, remembering that we had
- at least one match. For MATCH_NOMATCH, carry on with the alternatives, as
- usual. If we haven't matched any alternatives in any iteration, check to
- see if a previous iteration matched. If so, the group has matched;
- continue from afterwards. Otherwise it has failed; restore the previous
- capture values before returning NOMATCH. */
+ save_offset1 = md->offset_vector[offset];
+ save_offset2 = md->offset_vector[offset+1];
+ save_offset3 = md->offset_vector[md->offset_end - number];
+ save_capture_last = md->capture_last;
- for (;;)
- {
- md->offset_vector[md->offset_end - number] =
- (int)(eptr - md->start_subject);
- if (op >= OP_SBRA) md->match_function_type = MATCH_CBEGROUP;
- RMATCH(eptr, ecode + PRIV(OP_lengths)[*ecode], offset_top, md,
- eptrb, RM63);
- if (rrc == MATCH_KETRPOS)
- {
- offset_top = md->end_offset_top;
- 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;
- }
+ DPRINTF(("saving %d %d %d\n", save_offset1, save_offset2, save_offset3));
- /* See comment in the code for capturing groups above about handling
- THEN. */
+ /* Each time round the loop, save the current subject position for use
+ when the group matches. For MATCH_MATCH, the group has matched, so we
+ restart it with a new subject starting position, remembering that we had
+ at least one match. For MATCH_NOMATCH, carry on with the alternatives, as
+ usual. If we haven't matched any alternatives in any iteration, check to
+ see if a previous iteration matched. If so, the group has matched;
+ continue from afterwards. Otherwise it has failed; restore the previous
+ capture values before returning NOMATCH. */
- if (rrc == MATCH_THEN)
+ for (;;)
+ {
+ md->offset_vector[md->offset_end - number] =
+ (int)(eptr - md->start_subject);
+ if (op >= OP_SBRA) md->match_function_type = MATCH_CBEGROUP;
+ RMATCH(eptr, ecode + PRIV(OP_lengths)[*ecode], offset_top, md,
+ eptrb, RM63);
+ if (rrc == MATCH_KETRPOS)
+ {
+ offset_top = md->end_offset_top;
+ 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 */
{
- next = ecode + GET(ecode,1);
- if (md->start_match_ptr < next &&
- (*ecode == OP_ALT || *next == OP_ALT))
- rrc = MATCH_NOMATCH;
+ do ecode += GET(ecode, 1); while (*ecode == OP_ALT);
+ break;
}
-
- if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- md->capture_last = save_capture_last;
- ecode += GET(ecode, 1);
- if (*ecode != OP_ALT) break;
+ eptr = md->end_match_ptr;
+ continue;
}
- if (!matched_once)
- {
- md->offset_vector[offset] = save_offset1;
- md->offset_vector[offset+1] = save_offset2;
- md->offset_vector[md->offset_end - number] = save_offset3;
- }
+ /* See comment in the code for capturing groups above about handling
+ THEN. */
- if (allow_zero || matched_once)
+ if (rrc == MATCH_THEN)
{
- ecode += 1 + LINK_SIZE;
- break;
+ next = ecode + GET(ecode,1);
+ if (md->start_match_ptr < next &&
+ (*ecode == OP_ALT || *next == OP_ALT))
+ rrc = MATCH_NOMATCH;
}
- RRETURN(MATCH_NOMATCH);
+ if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+ md->capture_last = save_capture_last;
+ ecode += GET(ecode, 1);
+ if (*ecode != OP_ALT) break;
}
- /* FALL THROUGH ... Insufficient room for saving captured contents. Treat
- as a non-capturing bracket. */
-
- /* VVVVVVVVVVVVVVVVVVVVVVVVV */
- /* VVVVVVVVVVVVVVVVVVVVVVVVV */
+ if (!matched_once)
+ {
+ md->offset_vector[offset] = save_offset1;
+ md->offset_vector[offset+1] = save_offset2;
+ md->offset_vector[md->offset_end - number] = save_offset3;
+ }
- DPRINTF(("insufficient capture room: treat as non-capturing\n"));
+ if (allow_zero || matched_once)
+ {
+ ecode += 1 + LINK_SIZE;
+ break;
+ }
- /* VVVVVVVVVVVVVVVVVVVVVVVVV */
- /* VVVVVVVVVVVVVVVVVVVVVVVVV */
+ RRETURN(MATCH_NOMATCH);
/* Non-capturing possessive bracket with unlimited repeat. We come here
from BRAZERO with allow_zero = TRUE. The code is similar to the above,
@@ -1388,6 +1376,7 @@ for (;;)
break;
case OP_DEF: /* DEFINE - always false */
+ case OP_FAIL: /* From optimized (?!) condition */
break;
/* The condition is an assertion. Call match() to evaluate it - setting
@@ -1404,8 +1393,11 @@ for (;;)
condition = TRUE;
/* Advance ecode past the assertion to the start of the first branch,
- but adjust it so that the general choosing code below works. */
+ but adjust it so that the general choosing code below works. If the
+ assertion has a quantifier that allows zero repeats we must skip over
+ the BRAZERO. This is a lunatic thing to do, but somebody did! */
+ if (*ecode == OP_BRAZERO) ecode++;
ecode += GET(ecode, 1);
while (*ecode == OP_ALT) ecode += GET(ecode, 1);
ecode += 1 + LINK_SIZE - PRIV(OP_lengths)[condcode];
@@ -1474,7 +1466,18 @@ for (;;)
md->offset_vector[offset] =
md->offset_vector[md->offset_end - number];
md->offset_vector[offset+1] = (int)(eptr - md->start_subject);
- if (offset_top <= offset) offset_top = offset + 2;
+
+ /* If this group is at or above the current highwater mark, ensure that
+ any groups between the current high water mark and this group are marked
+ unset and then update the high water mark. */
+
+ if (offset >= offset_top)
+ {
+ register int *iptr = md->offset_vector + offset_top;
+ register int *iend = md->offset_vector + offset;
+ while (iptr < iend) *iptr++ = -1;
+ offset_top = offset + 2;
+ }
}
ecode += 1 + IMM2_SIZE;
break;
@@ -1826,7 +1829,11 @@ for (;;)
are defined in a range that can be tested for. */
if (rrc >= MATCH_BACKTRACK_MIN && rrc <= MATCH_BACKTRACK_MAX)
+ {
+ if (new_recursive.offset_save != stacksave)
+ (PUBL(free))(new_recursive.offset_save);
RRETURN(MATCH_NOMATCH);
+ }
/* Any return code other than NOMATCH is an error. */
@@ -3476,7 +3483,7 @@ for (;;)
if (possessive) continue; /* No backtracking */
for(;;)
{
- if (eptr == pp) goto TAIL_RECURSE;
+ if (eptr <= pp) goto TAIL_RECURSE;
RMATCH(eptr, ecode, offset_top, md, eptrb, RM23);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
#ifdef SUPPORT_UCP
@@ -3897,7 +3904,7 @@ for (;;)
if (possessive) continue; /* No backtracking */
for(;;)
{
- if (eptr == pp) goto TAIL_RECURSE;
+ if (eptr <= pp) goto TAIL_RECURSE;
RMATCH(eptr, ecode, offset_top, md, eptrb, RM30);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
eptr--;
@@ -4032,7 +4039,7 @@ for (;;)
if (possessive) continue; /* No backtracking */
for(;;)
{
- if (eptr == pp) goto TAIL_RECURSE;
+ if (eptr <= pp) goto TAIL_RECURSE;
RMATCH(eptr, ecode, offset_top, md, eptrb, RM34);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
eptr--;
@@ -5603,7 +5610,7 @@ for (;;)
if (possessive) continue; /* No backtracking */
for(;;)
{
- if (eptr == pp) goto TAIL_RECURSE;
+ if (eptr <= pp) goto TAIL_RECURSE;
RMATCH(eptr, ecode, offset_top, md, eptrb, RM44);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
eptr--;
@@ -5645,12 +5652,17 @@ for (;;)
if (possessive) continue; /* No backtracking */
+ /* We use <= pp rather than == pp to detect the start of the run while
+ backtracking because the use of \C in UTF mode can cause BACKCHAR to
+ move back past pp. This is just palliative; the use of \C in UTF mode
+ is fraught with danger. */
+
for(;;)
{
int lgb, rgb;
PCRE_PUCHAR fptr;
- if (eptr == pp) goto TAIL_RECURSE; /* At start of char run */
+ if (eptr <= pp) goto TAIL_RECURSE; /* At start of char run */
RMATCH(eptr, ecode, offset_top, md, eptrb, RM45);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
@@ -5668,7 +5680,7 @@ for (;;)
for (;;)
{
- if (eptr == pp) goto TAIL_RECURSE; /* At start of char run */
+ if (eptr <= pp) goto TAIL_RECURSE; /* At start of char run */
fptr = eptr - 1;
if (!utf) c = *fptr; else
{
@@ -5918,7 +5930,7 @@ for (;;)
if (possessive) continue; /* No backtracking */
for(;;)
{
- if (eptr == pp) goto TAIL_RECURSE;
+ if (eptr <= pp) goto TAIL_RECURSE;
RMATCH(eptr, ecode, offset_top, md, eptrb, RM46);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
eptr--;
diff --git a/pcre/pcre_internal.h b/pcre/pcre_internal.h
index 02d3ab17c5d..dd0ac7fc912 100644
--- a/pcre/pcre_internal.h
+++ b/pcre/pcre_internal.h
@@ -2446,6 +2446,7 @@ typedef struct compile_data {
BOOL had_pruneorskip; /* (*PRUNE) or (*SKIP) encountered */
BOOL check_lookbehind; /* Lookbehinds need later checking */
BOOL dupnames; /* Duplicate names exist */
+ BOOL iscondassert; /* Next assert is a condition */
int nltype; /* Newline type */
int nllen; /* Newline string length */
pcre_uchar nl[4]; /* Newline string when fixed length */
@@ -2459,6 +2460,13 @@ typedef struct branch_chain {
pcre_uchar *current_branch;
} branch_chain;
+/* Structure for mutual recursion detection. */
+
+typedef struct recurse_check {
+ struct recurse_check *prev;
+ const pcre_uchar *group;
+} recurse_check;
+
/* Structure for items in a linked list that represents an explicit recursive
call within the pattern; used by pcre_exec(). */
diff --git a/pcre/pcre_jit_compile.c b/pcre/pcre_jit_compile.c
index 256e3a45b13..debdf6ef45e 100644
--- a/pcre/pcre_jit_compile.c
+++ b/pcre/pcre_jit_compile.c
@@ -52,8 +52,8 @@ POSSIBILITY OF SUCH DAMAGE.
we just include it. This way we don't need to touch the build
system files. */
-#define SLJIT_MALLOC(size) (PUBL(malloc))(size)
-#define SLJIT_FREE(ptr) (PUBL(free))(ptr)
+#define SLJIT_MALLOC(size, allocator_data) (PUBL(malloc))(size)
+#define SLJIT_FREE(ptr, allocator_data) (PUBL(free))(ptr)
#define SLJIT_CONFIG_AUTO 1
#define SLJIT_CONFIG_STATIC 1
#define SLJIT_VERBOSE 0
@@ -179,7 +179,7 @@ typedef struct jit_arguments {
typedef struct executable_functions {
void *executable_funcs[JIT_NUMBER_OF_COMPILE_MODES];
- sljit_uw *read_only_data[JIT_NUMBER_OF_COMPILE_MODES];
+ void *read_only_data_heads[JIT_NUMBER_OF_COMPILE_MODES];
sljit_uw executable_sizes[JIT_NUMBER_OF_COMPILE_MODES];
PUBL(jit_callback) callback;
void *userdata;
@@ -322,12 +322,8 @@ typedef struct compiler_common {
pcre_uchar *start;
/* Maps private data offset to each opcode. */
sljit_si *private_data_ptrs;
- /* This read-only data is available during runtime. */
- sljit_uw *read_only_data;
- /* The total size of the read-only data. */
- sljit_uw read_only_data_size;
- /* The next free entry of the read_only_data. */
- sljit_uw *read_only_data_ptr;
+ /* Chain list of read-only data ptrs. */
+ void *read_only_data_head;
/* Tells whether the capturing bracket is optimized. */
pcre_uint8 *optimized_cbracket;
/* Tells whether the starting offset is a target of then. */
@@ -545,7 +541,7 @@ the start pointers when the end of the capturing group has not yet reached. */
#define READ_CHAR_MAX 0x7fffffff
-static pcre_uchar* bracketend(pcre_uchar* cc)
+static pcre_uchar *bracketend(pcre_uchar *cc)
{
SLJIT_ASSERT((*cc >= OP_ASSERT && *cc <= OP_ASSERTBACK_NOT) || (*cc >= OP_ONCE && *cc <= OP_SCOND));
do cc += GET(cc, 1); while (*cc == OP_ALT);
@@ -554,7 +550,7 @@ cc += 1 + LINK_SIZE;
return cc;
}
-static int no_alternatives(pcre_uchar* cc)
+static int no_alternatives(pcre_uchar *cc)
{
int count = 0;
SLJIT_ASSERT((*cc >= OP_ASSERT && *cc <= OP_ASSERTBACK_NOT) || (*cc >= OP_ONCE && *cc <= OP_SCOND));
@@ -802,16 +798,6 @@ while (cc < ccend)
cc += 1 + IMM2_SIZE;
break;
- case OP_BRA:
- case OP_CBRA:
- case OP_SBRA:
- case OP_SCBRA:
- count = no_alternatives(cc);
- if (count > 4)
- common->read_only_data_size += count * sizeof(sljit_uw);
- cc += 1 + LINK_SIZE + (*cc == OP_CBRA || *cc == OP_SCBRA ? IMM2_SIZE : 0);
- break;
-
case OP_CBRAPOS:
case OP_SCBRAPOS:
common->optimized_cbracket[GET2(cc, 1 + LINK_SIZE)] = 0;
@@ -1237,7 +1223,7 @@ while (cc < ccend)
}
/* Returns with a frame_types (always < 0) if no need for frame. */
-static int get_framesize(compiler_common *common, pcre_uchar *cc, pcre_uchar *ccend, BOOL recursive, BOOL* needs_control_head)
+static int get_framesize(compiler_common *common, pcre_uchar *cc, pcre_uchar *ccend, BOOL recursive, BOOL *needs_control_head)
{
int length = 0;
int possessive = 0;
@@ -1547,7 +1533,11 @@ while (cc < ccend)
{
case OP_KET:
if (PRIVATE_DATA(cc) != 0)
+ {
private_data_length++;
+ SLJIT_ASSERT(PRIVATE_DATA(cc + 1) != 0);
+ cc += PRIVATE_DATA(cc + 1);
+ }
cc += 1 + LINK_SIZE;
break;
@@ -1562,6 +1552,7 @@ while (cc < ccend)
case OP_SBRAPOS:
case OP_SCOND:
private_data_length++;
+ SLJIT_ASSERT(PRIVATE_DATA(cc) != 0);
cc += 1 + LINK_SIZE;
break;
@@ -1724,6 +1715,8 @@ do
{
count = 1;
srcw[0] = PRIVATE_DATA(cc);
+ SLJIT_ASSERT(PRIVATE_DATA(cc + 1) != 0);
+ cc += PRIVATE_DATA(cc + 1);
}
cc += 1 + LINK_SIZE;
break;
@@ -2030,7 +2023,7 @@ while (list)
}
}
-static SLJIT_INLINE void add_jump(struct sljit_compiler *compiler, jump_list **list, struct sljit_jump* jump)
+static SLJIT_INLINE void add_jump(struct sljit_compiler *compiler, jump_list **list, struct sljit_jump *jump)
{
jump_list *list_item = sljit_alloc_memory(compiler, sizeof(jump_list));
if (list_item)
@@ -2044,7 +2037,7 @@ if (list_item)
static void add_stub(compiler_common *common, struct sljit_jump *start)
{
DEFINE_COMPILER;
-stub_list* list_item = sljit_alloc_memory(compiler, sizeof(stub_list));
+stub_list *list_item = sljit_alloc_memory(compiler, sizeof(stub_list));
if (list_item)
{
@@ -2058,7 +2051,7 @@ if (list_item)
static void flush_stubs(compiler_common *common)
{
DEFINE_COMPILER;
-stub_list* list_item = common->stubs;
+stub_list *list_item = common->stubs;
while (list_item)
{
@@ -2089,7 +2082,7 @@ static SLJIT_INLINE void count_match(compiler_common *common)
DEFINE_COMPILER;
OP2(SLJIT_SUB | SLJIT_SET_E, COUNT_MATCH, 0, COUNT_MATCH, 0, SLJIT_IMM, 1);
-add_jump(compiler, &common->calllimit, JUMP(SLJIT_C_ZERO));
+add_jump(compiler, &common->calllimit, JUMP(SLJIT_ZERO));
}
static SLJIT_INLINE void allocate_stack(compiler_common *common, int size)
@@ -2105,7 +2098,7 @@ OP1(SLJIT_MOV, RETURN_ADDR, 0, 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));
+add_stub(common, CMP(SLJIT_GREATER, STACK_TOP, 0, STACK_LIMIT, 0));
}
static SLJIT_INLINE void free_stack(compiler_common *common, int size)
@@ -2114,6 +2107,40 @@ DEFINE_COMPILER;
OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, size * sizeof(sljit_sw));
}
+static sljit_uw * allocate_read_only_data(compiler_common *common, sljit_uw size)
+{
+DEFINE_COMPILER;
+sljit_uw *result;
+
+if (SLJIT_UNLIKELY(sljit_get_compiler_error(compiler)))
+ return NULL;
+
+result = (sljit_uw *)SLJIT_MALLOC(size + sizeof(sljit_uw), compiler->allocator_data);
+if (SLJIT_UNLIKELY(result == NULL))
+ {
+ sljit_set_compiler_memory_error(compiler);
+ return NULL;
+ }
+
+*(void**)result = common->read_only_data_head;
+common->read_only_data_head = (void *)result;
+return result + 1;
+}
+
+static void free_read_only_data(void *current, void *allocator_data)
+{
+void *next;
+
+SLJIT_UNUSED_ARG(allocator_data);
+
+while (current != NULL)
+ {
+ next = *(void**)current;
+ SLJIT_FREE(current, allocator_data);
+ current = next;
+ }
+}
+
static SLJIT_INLINE void reset_ovector(compiler_common *common, int length)
{
DEFINE_COMPILER;
@@ -2136,7 +2163,7 @@ else
loop = LABEL();
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);
+ JUMPTO(SLJIT_NOT_ZERO, loop);
}
}
@@ -2162,7 +2189,7 @@ else
loop = LABEL();
OP1(SLJIT_MOVU, SLJIT_MEM1(TMP2), sizeof(sljit_sw), TMP1, 0);
OP2(SLJIT_SUB | SLJIT_SET_E, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, 1);
- JUMPTO(SLJIT_C_NOT_ZERO, loop);
+ JUMPTO(SLJIT_NOT_ZERO, loop);
}
OP1(SLJIT_MOV, STACK_TOP, 0, ARGUMENTS, 0);
@@ -2218,7 +2245,7 @@ OP2(SLJIT_SUB, SLJIT_R2, 0, SLJIT_MEM1(SLJIT_R0), SLJIT_OFFSETOF(jit_arguments,
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_R1, 0, SLJIT_IMM, 0);
+early_quit = CMP(SLJIT_EQUAL, SLJIT_R1, 0, SLJIT_IMM, 0);
loop = LABEL();
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));
@@ -2228,7 +2255,7 @@ OP2(SLJIT_ASHR, SLJIT_S1, 0, SLJIT_S1, 0, SLJIT_IMM, UCHAR_SHIFT);
#endif
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);
+JUMPTO(SLJIT_NOT_ZERO, loop);
JUMPHERE(early_quit);
/* Calculate the return value, which is the maximum ovector value. */
@@ -2241,7 +2268,7 @@ if (topbracket > 1)
loop = LABEL();
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);
+ CMPTO(SLJIT_EQUAL, SLJIT_R2, 0, SLJIT_S2, 0, loop);
OP1(SLJIT_MOV, SLJIT_RETURN_REG, 0, SLJIT_R1, 0);
}
else
@@ -2260,13 +2287,13 @@ SLJIT_ASSERT(common->start_used_ptr != 0 && common->start_ptr != 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_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);
+CMPTO(SLJIT_SIG_LESS, SLJIT_R2, 0, SLJIT_IMM, 2, quit);
/* Store match begin and end. */
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_R2, 0, SLJIT_IMM, 3);
+jump = CMP(SLJIT_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_R2, 0, SLJIT_R2, 0, SLJIT_IMM, UCHAR_SHIFT);
@@ -2302,19 +2329,19 @@ if (common->mode == JIT_PARTIAL_SOFT_COMPILE)
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);
+ jump = CMP(SLJIT_LESS_EQUAL, TMP1, 0, 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_SP), common->start_used_ptr, STR_PTR, 0);
+ jump = CMP(SLJIT_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);
}
}
-static SLJIT_INLINE BOOL char_has_othercase(compiler_common *common, pcre_uchar* cc)
+static SLJIT_INLINE BOOL char_has_othercase(compiler_common *common, pcre_uchar *cc)
{
/* Detects if the character has an othercase. */
unsigned int c;
@@ -2357,7 +2384,7 @@ if (common->utf && c > 127)
return TABLE_GET(c, common->fcc, c);
}
-static unsigned int char_get_othercase_bit(compiler_common *common, pcre_uchar* cc)
+static unsigned int char_get_othercase_bit(compiler_common *common, pcre_uchar *cc)
{
/* Detects if the character and its othercase has only 1 bit difference. */
unsigned int c, oc, bit;
@@ -2445,9 +2472,9 @@ if (common->mode == JIT_COMPILE)
return;
if (!force)
- jump = CMP(SLJIT_C_GREATER_EQUAL, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, STR_PTR, 0);
+ jump = CMP(SLJIT_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_SP), common->start_used_ptr, SLJIT_IMM, -1);
+ jump = CMP(SLJIT_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_SP), common->hit_start, SLJIT_IMM, 0);
@@ -2471,20 +2498,20 @@ struct sljit_jump *jump;
if (common->mode == JIT_COMPILE)
{
- add_jump(compiler, end_reached, CMP(SLJIT_C_GREATER_EQUAL, STR_PTR, 0, STR_END, 0));
+ add_jump(compiler, end_reached, CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0));
return;
}
-jump = CMP(SLJIT_C_LESS, STR_PTR, 0, STR_END, 0);
+jump = CMP(SLJIT_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_SP), common->start_used_ptr, STR_PTR, 0));
+ add_jump(compiler, end_reached, CMP(SLJIT_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_SP), common->start_used_ptr, STR_PTR, 0));
+ add_jump(compiler, end_reached, CMP(SLJIT_GREATER_EQUAL, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, STR_PTR, 0));
if (common->partialmatchlabel != NULL)
JUMPTO(SLJIT_JUMP, common->partialmatchlabel);
else
@@ -2500,13 +2527,13 @@ struct sljit_jump *jump;
if (common->mode == JIT_COMPILE)
{
- add_jump(compiler, backtracks, CMP(SLJIT_C_GREATER_EQUAL, STR_PTR, 0, STR_END, 0));
+ add_jump(compiler, backtracks, CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0));
return;
}
/* 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_SP), common->start_used_ptr, STR_PTR, 0));
+jump = CMP(SLJIT_LESS, STR_PTR, 0, STR_END, 0);
+add_jump(compiler, backtracks, CMP(SLJIT_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_SP), common->hit_start, SLJIT_IMM, 0);
@@ -2539,7 +2566,7 @@ if (common->utf)
{
if (max < 128) return;
- jump = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0);
+ jump = CMP(SLJIT_LESS, TMP1, 0, SLJIT_IMM, 0xc0);
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
add_jump(compiler, &common->utfreadchar, JUMP(SLJIT_FAST_CALL));
OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, TMP2, 0);
@@ -2553,7 +2580,7 @@ if (common->utf)
if (max < 0xd800) return;
OP2(SLJIT_SUB, TMP2, 0, TMP1, 0, SLJIT_IMM, 0xd800);
- jump = CMP(SLJIT_C_GREATER, TMP2, 0, SLJIT_IMM, 0xdc00 - 0xd800 - 1);
+ jump = CMP(SLJIT_GREATER, TMP2, 0, SLJIT_IMM, 0xdc00 - 0xd800 - 1);
/* TMP2 contains the high surrogate. */
OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0));
OP2(SLJIT_ADD, TMP2, 0, TMP2, 0, SLJIT_IMM, 0x40);
@@ -2572,7 +2599,7 @@ static BOOL is_char7_bitset(const pcre_uint8 *bitset, BOOL nclass)
/* Tells whether the character codes below 128 are enough
to determine a match. */
const pcre_uint8 value = nclass ? 0xff : 0;
-const pcre_uint8* end = bitset + 32;
+const pcre_uint8 *end = bitset + 32;
bitset += 16;
do
@@ -2601,7 +2628,7 @@ OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP2), common->ctypes);
if (full_read)
{
- jump = CMP(SLJIT_C_LESS, TMP2, 0, SLJIT_IMM, 0xc0);
+ jump = CMP(SLJIT_LESS, TMP2, 0, SLJIT_IMM, 0xc0);
OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(TMP2), (sljit_sw)PRIV(utf8_table4) - 0xc0);
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP2, 0);
JUMPHERE(jump);
@@ -2636,14 +2663,14 @@ if (common->utf)
{
if (max < 128 && !update_str_ptr) return;
- jump = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0);
+ jump = CMP(SLJIT_LESS, TMP1, 0, SLJIT_IMM, 0xc0);
if (min >= 0x10000)
{
OP2(SLJIT_SUB, TMP2, 0, TMP1, 0, SLJIT_IMM, 0xf0);
if (update_str_ptr)
OP1(SLJIT_MOV_UB, RETURN_ADDR, 0, SLJIT_MEM1(TMP1), (sljit_sw)PRIV(utf8_table4) - 0xc0);
OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0));
- jump2 = CMP(SLJIT_C_GREATER, TMP2, 0, SLJIT_IMM, 0x7);
+ jump2 = CMP(SLJIT_GREATER, TMP2, 0, SLJIT_IMM, 0x7);
OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 6);
OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x3f);
OP2(SLJIT_OR, TMP1, 0, TMP1, 0, TMP2, 0);
@@ -2667,7 +2694,7 @@ if (common->utf)
if (update_str_ptr)
OP1(SLJIT_MOV_UB, RETURN_ADDR, 0, SLJIT_MEM1(TMP1), (sljit_sw)PRIV(utf8_table4) - 0xc0);
OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0));
- jump2 = CMP(SLJIT_C_GREATER, TMP2, 0, SLJIT_IMM, 0xf);
+ jump2 = CMP(SLJIT_GREATER, TMP2, 0, SLJIT_IMM, 0xf);
OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 6);
OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x3f);
OP2(SLJIT_OR, TMP1, 0, TMP1, 0, TMP2, 0);
@@ -2712,7 +2739,7 @@ if (common->utf)
if (max >= 0x10000)
{
OP2(SLJIT_SUB, TMP2, 0, TMP1, 0, SLJIT_IMM, 0xd800);
- jump = CMP(SLJIT_C_GREATER, TMP2, 0, SLJIT_IMM, 0xdc00 - 0xd800 - 1);
+ jump = CMP(SLJIT_GREATER, TMP2, 0, SLJIT_IMM, 0xdc00 - 0xd800 - 1);
/* TMP2 contains the high surrogate. */
OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0));
OP2(SLJIT_ADD, TMP2, 0, TMP2, 0, SLJIT_IMM, 0x40);
@@ -2728,7 +2755,7 @@ if (common->utf)
/* Skip low surrogate if necessary. */
OP2(SLJIT_SUB, TMP2, 0, TMP1, 0, SLJIT_IMM, 0xd800);
- jump = CMP(SLJIT_C_GREATER, TMP2, 0, SLJIT_IMM, 0xdc00 - 0xd800 - 1);
+ jump = CMP(SLJIT_GREATER, TMP2, 0, SLJIT_IMM, 0xdc00 - 0xd800 - 1);
if (update_str_ptr)
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
if (max >= 0xd800)
@@ -2765,7 +2792,7 @@ if (common->utf)
/* This can be an extra read in some situations, but hopefully
it is needed in most cases. */
OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP2), common->ctypes);
- jump = CMP(SLJIT_C_LESS, TMP2, 0, SLJIT_IMM, 0xc0);
+ jump = CMP(SLJIT_LESS, TMP2, 0, SLJIT_IMM, 0xc0);
if (!update_str_ptr)
{
OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0));
@@ -2775,7 +2802,7 @@ if (common->utf)
OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x3f);
OP2(SLJIT_OR, TMP2, 0, TMP2, 0, TMP1, 0);
OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, 0);
- jump2 = CMP(SLJIT_C_GREATER, TMP2, 0, SLJIT_IMM, 255);
+ jump2 = CMP(SLJIT_GREATER, TMP2, 0, SLJIT_IMM, 255);
OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP2), common->ctypes);
JUMPHERE(jump2);
}
@@ -2789,7 +2816,7 @@ if (common->utf)
#if !defined COMPILE_PCRE8
/* The ctypes array contains only 256 values. */
OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, 0);
-jump = CMP(SLJIT_C_GREATER, TMP2, 0, SLJIT_IMM, 255);
+jump = CMP(SLJIT_GREATER, TMP2, 0, SLJIT_IMM, 255);
#endif
OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP2), common->ctypes);
#if !defined COMPILE_PCRE8
@@ -2801,7 +2828,7 @@ if (common->utf && update_str_ptr)
{
/* Skip low surrogate if necessary. */
OP2(SLJIT_SUB, TMP2, 0, TMP2, 0, SLJIT_IMM, 0xd800);
- jump = CMP(SLJIT_C_GREATER, TMP2, 0, SLJIT_IMM, 0xdc00 - 0xd800 - 1);
+ jump = CMP(SLJIT_GREATER, TMP2, 0, SLJIT_IMM, 0xdc00 - 0xd800 - 1);
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
JUMPHERE(jump);
}
@@ -2822,7 +2849,7 @@ if (common->utf)
OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), -IN_UCHARS(1));
OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0xc0);
- CMPTO(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, 0x80, label);
+ CMPTO(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, 0x80, label);
return;
}
#elif defined COMPILE_PCRE16
@@ -2833,7 +2860,7 @@ if (common->utf)
/* Skip low surrogate if necessary. */
OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0xfc00);
OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xdc00);
- OP_FLAGS(SLJIT_MOV, TMP1, 0, SLJIT_UNUSED, 0, SLJIT_C_EQUAL);
+ OP_FLAGS(SLJIT_MOV, TMP1, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
return;
@@ -2852,26 +2879,26 @@ struct sljit_jump *jump;
if (nltype == NLTYPE_ANY)
{
add_jump(compiler, &common->anynewline, JUMP(SLJIT_FAST_CALL));
- add_jump(compiler, backtracks, JUMP(jumpifmatch ? SLJIT_C_NOT_ZERO : SLJIT_C_ZERO));
+ add_jump(compiler, backtracks, JUMP(jumpifmatch ? SLJIT_NOT_ZERO : SLJIT_ZERO));
}
else if (nltype == NLTYPE_ANYCRLF)
{
if (jumpifmatch)
{
- add_jump(compiler, backtracks, CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_CR));
- add_jump(compiler, backtracks, CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_NL));
+ add_jump(compiler, backtracks, CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_CR));
+ add_jump(compiler, backtracks, CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_NL));
}
else
{
- jump = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_CR);
- add_jump(compiler, backtracks, CMP(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_NL));
+ jump = CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_CR);
+ add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_NL));
JUMPHERE(jump);
}
}
else
{
SLJIT_ASSERT(nltype == NLTYPE_FIXED && common->newline < 256);
- add_jump(compiler, backtracks, CMP(jumpifmatch ? SLJIT_C_EQUAL : SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, common->newline));
+ add_jump(compiler, backtracks, CMP(jumpifmatch ? SLJIT_EQUAL : SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, common->newline));
}
}
@@ -2894,7 +2921,7 @@ OP2(SLJIT_OR, TMP1, 0, TMP1, 0, TMP2, 0);
/* Searching for the first zero. */
OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x800);
-jump = JUMP(SLJIT_C_NOT_ZERO);
+jump = JUMP(SLJIT_NOT_ZERO);
/* Two byte sequence. */
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, IN_UCHARS(2));
@@ -2908,7 +2935,7 @@ OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0x3f);
OP2(SLJIT_OR, TMP1, 0, TMP1, 0, TMP2, 0);
OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x10000);
-jump = JUMP(SLJIT_C_NOT_ZERO);
+jump = JUMP(SLJIT_NOT_ZERO);
/* Three byte sequence. */
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(2));
OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, IN_UCHARS(3));
@@ -2942,14 +2969,14 @@ OP2(SLJIT_OR, TMP1, 0, TMP1, 0, TMP2, 0);
/* Searching for the first zero. */
OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x800);
-jump = JUMP(SLJIT_C_NOT_ZERO);
+jump = JUMP(SLJIT_NOT_ZERO);
/* Two byte sequence. */
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
JUMPHERE(jump);
OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x400);
-OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_C_NOT_ZERO);
+OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_NOT_ZERO);
/* This code runs only in 8 bit mode. No need to shift the value. */
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP2, 0);
OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(1));
@@ -2973,13 +3000,13 @@ struct sljit_jump *compare;
sljit_emit_fast_enter(compiler, RETURN_ADDR, 0);
OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, 0x20);
-jump = JUMP(SLJIT_C_NOT_ZERO);
+jump = JUMP(SLJIT_NOT_ZERO);
/* Two byte sequence. */
OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0));
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0x1f);
/* The upper 5 bits are known at this point. */
-compare = CMP(SLJIT_C_GREATER, TMP2, 0, SLJIT_IMM, 0x3);
+compare = CMP(SLJIT_GREATER, TMP2, 0, SLJIT_IMM, 0x3);
OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 6);
OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x3f);
OP2(SLJIT_OR, TMP2, 0, TMP2, 0, TMP1, 0);
@@ -3059,23 +3086,23 @@ if (firstline)
{
mainloop = LABEL();
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
- end = CMP(SLJIT_C_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
+ end = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(-1));
OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0));
- 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);
+ CMPTO(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff, mainloop);
+ CMPTO(SLJIT_NOT_EQUAL, TMP2, 0, SLJIT_IMM, common->newline & 0xff, mainloop);
JUMPHERE(end);
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);
+ end = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
mainloop = LABEL();
/* Continual stores does not cause data dependency. */
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);
+ CMPTO(SLJIT_LESS, STR_PTR, 0, STR_END, 0, mainloop);
JUMPHERE(end);
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->first_line_end, STR_PTR, 0);
set_jumps(newline, LABEL());
@@ -3090,10 +3117,10 @@ if (newlinecheck)
{
newlinelabel = LABEL();
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
- end = CMP(SLJIT_C_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
+ end = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);
OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, common->newline & 0xff);
- OP_FLAGS(SLJIT_MOV, TMP1, 0, SLJIT_UNUSED, 0, SLJIT_C_EQUAL);
+ OP_FLAGS(SLJIT_MOV, TMP1, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
#if defined COMPILE_PCRE16 || defined COMPILE_PCRE32
OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, UCHAR_SHIFT);
#endif
@@ -3113,14 +3140,14 @@ if (readuchar)
OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);
if (newlinecheck)
- CMPTO(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff, newlinelabel);
+ CMPTO(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff, newlinelabel);
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
#if defined SUPPORT_UTF && !defined COMPILE_PCRE32
#if defined COMPILE_PCRE8
if (common->utf)
{
- singlechar = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0);
+ singlechar = CMP(SLJIT_LESS, TMP1, 0, SLJIT_IMM, 0xc0);
OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)PRIV(utf8_table4) - 0xc0);
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
JUMPHERE(singlechar);
@@ -3128,10 +3155,10 @@ if (common->utf)
#elif defined COMPILE_PCRE16
if (common->utf)
{
- singlechar = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xd800);
+ singlechar = CMP(SLJIT_LESS, TMP1, 0, SLJIT_IMM, 0xd800);
OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0xfc00);
OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xd800);
- OP_FLAGS(SLJIT_MOV, TMP1, 0, SLJIT_UNUSED, 0, SLJIT_C_EQUAL);
+ OP_FLAGS(SLJIT_MOV, TMP1, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
JUMPHERE(singlechar);
@@ -3530,9 +3557,6 @@ int range_right = -1, range_len = 3 - 1;
sljit_ub *update_table = NULL;
BOOL in_range;
-/* This is even TRUE, if both are NULL. */
-SLJIT_ASSERT(common->read_only_data_ptr == common->read_only_data);
-
for (i = 0; i < MAX_N_CHARS; i++)
{
chars[i << 1] = NOTACHAR;
@@ -3581,18 +3605,9 @@ for (i = 0; i <= max; i++)
if (range_right >= 0)
{
- /* Since no data is consumed (see the assert in the beginning
- of this function), this space can be reallocated. */
- if (common->read_only_data)
- SLJIT_FREE(common->read_only_data);
-
- common->read_only_data_size += 256;
- common->read_only_data = (sljit_uw *)SLJIT_MALLOC(common->read_only_data_size);
- if (common->read_only_data == NULL)
+ update_table = (sljit_ub *)allocate_read_only_data(common, 256);
+ if (update_table == NULL)
return TRUE;
-
- update_table = (sljit_ub *)common->read_only_data;
- common->read_only_data_ptr = (sljit_uw *)(update_table + 256);
memset(update_table, IN_UCHARS(range_len), 256);
for (i = 0; i < range_len; i++)
@@ -3683,7 +3698,7 @@ if (firstline)
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);
+ quit = CMP(SLJIT_LESS_EQUAL, STR_END, 0, TMP1, 0);
OP1(SLJIT_MOV, STR_END, 0, TMP1, 0);
JUMPHERE(quit);
}
@@ -3696,7 +3711,7 @@ if (range_right >= 0)
#endif
start = LABEL();
-quit = CMP(SLJIT_C_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
+quit = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
SLJIT_ASSERT(range_right >= 0 || offsets[0] >= 0);
@@ -3714,7 +3729,7 @@ if (range_right >= 0)
OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)update_table);
#endif
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
- CMPTO(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, 0, start);
+ CMPTO(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, 0, start);
}
if (offsets[0] >= 0)
@@ -3726,7 +3741,7 @@ if (offsets[0] >= 0)
if (chars[1] != 0)
OP2(SLJIT_OR, TMP1, 0, TMP1, 0, SLJIT_IMM, chars[1]);
- CMPTO(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, chars[0], start);
+ CMPTO(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, chars[0], start);
if (offsets[2] >= 0)
OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(offsets[2] - 1));
@@ -3734,14 +3749,14 @@ if (offsets[0] >= 0)
{
if (chars[5] != 0)
OP2(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_IMM, chars[5]);
- CMPTO(SLJIT_C_NOT_EQUAL, TMP2, 0, SLJIT_IMM, chars[4], start);
+ CMPTO(SLJIT_NOT_EQUAL, TMP2, 0, SLJIT_IMM, chars[4], start);
}
if (offsets[2] >= 0)
{
if (chars[3] != 0)
OP2(SLJIT_OR, TMP1, 0, TMP1, 0, SLJIT_IMM, chars[3]);
- CMPTO(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, chars[2], start);
+ CMPTO(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, chars[2], start);
}
OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
}
@@ -3755,7 +3770,7 @@ if (firstline)
OP1(SLJIT_MOV, STR_END, 0, TMP3, 0);
if (range_right >= 0)
{
- quit = CMP(SLJIT_C_LESS_EQUAL, STR_PTR, 0, TMP1, 0);
+ quit = CMP(SLJIT_LESS_EQUAL, STR_PTR, 0, TMP1, 0);
OP1(SLJIT_MOV, STR_PTR, 0, TMP1, 0);
JUMPHERE(quit);
}
@@ -3784,7 +3799,7 @@ if (firstline)
}
start = LABEL();
-quit = CMP(SLJIT_C_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
+quit = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);
oc = first_char;
@@ -3797,22 +3812,22 @@ if (caseless)
#endif
}
if (first_char == oc)
- found = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, first_char);
+ found = CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, first_char);
else
{
bit = first_char ^ oc;
if (is_powerof2(bit))
{
OP2(SLJIT_OR, TMP2, 0, TMP1, 0, SLJIT_IMM, bit);
- found = CMP(SLJIT_C_EQUAL, TMP2, 0, SLJIT_IMM, first_char | bit);
+ found = CMP(SLJIT_EQUAL, TMP2, 0, SLJIT_IMM, first_char | bit);
}
else
{
OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, first_char);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_C_EQUAL);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, oc);
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_C_EQUAL);
- found = JUMP(SLJIT_C_NOT_ZERO);
+ OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+ found = JUMP(SLJIT_NOT_ZERO);
}
}
@@ -3845,15 +3860,15 @@ if (firstline)
if (common->nltype == NLTYPE_FIXED && common->newline > 255)
{
- lastchar = CMP(SLJIT_C_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
+ lastchar = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, str));
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, begin));
- firstchar = CMP(SLJIT_C_LESS_EQUAL, STR_PTR, 0, TMP2, 0);
+ firstchar = CMP(SLJIT_LESS_EQUAL, STR_PTR, 0, TMP2, 0);
OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, IN_UCHARS(2));
OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, STR_PTR, 0, TMP1, 0);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_C_GREATER_EQUAL);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_GREATER_EQUAL);
#if defined COMPILE_PCRE16 || defined COMPILE_PCRE32
OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, UCHAR_SHIFT);
#endif
@@ -3861,11 +3876,11 @@ if (common->nltype == NLTYPE_FIXED && common->newline > 255)
loop = LABEL();
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
- quit = CMP(SLJIT_C_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
+ quit = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(-2));
OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(-1));
- CMPTO(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff, loop);
- CMPTO(SLJIT_C_NOT_EQUAL, TMP2, 0, SLJIT_IMM, common->newline & 0xff, loop);
+ CMPTO(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff, loop);
+ CMPTO(SLJIT_NOT_EQUAL, TMP2, 0, SLJIT_IMM, common->newline & 0xff, loop);
JUMPHERE(quit);
JUMPHERE(firstchar);
@@ -3878,16 +3893,16 @@ if (common->nltype == NLTYPE_FIXED && common->newline > 255)
OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, str));
-firstchar = CMP(SLJIT_C_LESS_EQUAL, STR_PTR, 0, TMP2, 0);
+firstchar = CMP(SLJIT_LESS_EQUAL, STR_PTR, 0, TMP2, 0);
skip_char_back(common);
loop = LABEL();
common->ff_newline_shortcut = loop;
read_char_range(common, common->nlmin, common->nlmax, TRUE);
-lastchar = CMP(SLJIT_C_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
+lastchar = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
if (common->nltype == NLTYPE_ANY || common->nltype == NLTYPE_ANYCRLF)
- foundcr = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_CR);
+ foundcr = CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_CR);
check_newlinechar(common, common->nltype, &newline, FALSE);
set_jumps(newline, loop);
@@ -3895,10 +3910,10 @@ if (common->nltype == NLTYPE_ANY || common->nltype == NLTYPE_ANYCRLF)
{
quit = JUMP(SLJIT_JUMP);
JUMPHERE(foundcr);
- notfoundnl = CMP(SLJIT_C_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
+ notfoundnl = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);
OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, CHAR_NL);
- OP_FLAGS(SLJIT_MOV, TMP1, 0, SLJIT_UNUSED, 0, SLJIT_C_EQUAL);
+ OP_FLAGS(SLJIT_MOV, TMP1, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
#if defined COMPILE_PCRE16 || defined COMPILE_PCRE32
OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, UCHAR_SHIFT);
#endif
@@ -3934,7 +3949,7 @@ if (firstline)
}
start = LABEL();
-quit = CMP(SLJIT_C_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
+quit = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);
#ifdef SUPPORT_UTF
if (common->utf)
@@ -3944,7 +3959,7 @@ if (common->utf)
if (!check_class_ranges(common, start_bits, (start_bits[31] & 0x80) != 0, TRUE, &matches))
{
#ifndef COMPILE_PCRE8
- jump = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 255);
+ jump = CMP(SLJIT_LESS, TMP1, 0, SLJIT_IMM, 255);
OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, 255);
JUMPHERE(jump);
#endif
@@ -3953,7 +3968,7 @@ if (!check_class_ranges(common, start_bits, (start_bits[31] & 0x80) != 0, TRUE,
OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)start_bits);
OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TMP2, 0);
OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
- found = JUMP(SLJIT_C_NOT_ZERO);
+ found = JUMP(SLJIT_NOT_ZERO);
}
#ifdef SUPPORT_UTF
@@ -3965,17 +3980,17 @@ OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
#if defined COMPILE_PCRE8
if (common->utf)
{
- CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0, start);
+ CMPTO(SLJIT_LESS, TMP1, 0, SLJIT_IMM, 0xc0, start);
OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)PRIV(utf8_table4) - 0xc0);
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
}
#elif defined COMPILE_PCRE16
if (common->utf)
{
- CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xd800, start);
+ CMPTO(SLJIT_LESS, TMP1, 0, SLJIT_IMM, 0xd800, start);
OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0xfc00);
OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xd800);
- OP_FLAGS(SLJIT_MOV, TMP1, 0, SLJIT_UNUSED, 0, SLJIT_C_EQUAL);
+ OP_FLAGS(SLJIT_MOV, TMP1, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
}
@@ -4006,8 +4021,8 @@ pcre_uint32 oc, bit;
SLJIT_ASSERT(common->req_char_ptr != 0);
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);
+toolong = CMP(SLJIT_LESS, TMP1, 0, STR_END, 0);
+alreadyfound = CMP(SLJIT_LESS, STR_PTR, 0, TMP2, 0);
if (has_firstchar)
OP2(SLJIT_ADD, TMP1, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
@@ -4015,7 +4030,7 @@ else
OP1(SLJIT_MOV, TMP1, 0, STR_PTR, 0);
loop = LABEL();
-notfound = CMP(SLJIT_C_GREATER_EQUAL, TMP1, 0, STR_END, 0);
+notfound = CMP(SLJIT_GREATER_EQUAL, TMP1, 0, STR_END, 0);
OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(TMP1), 0);
oc = req_char;
@@ -4028,19 +4043,19 @@ if (caseless)
#endif
}
if (req_char == oc)
- found = CMP(SLJIT_C_EQUAL, TMP2, 0, SLJIT_IMM, req_char);
+ found = CMP(SLJIT_EQUAL, TMP2, 0, SLJIT_IMM, req_char);
else
{
bit = req_char ^ oc;
if (is_powerof2(bit))
{
OP2(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_IMM, bit);
- found = CMP(SLJIT_C_EQUAL, TMP2, 0, SLJIT_IMM, req_char | bit);
+ found = CMP(SLJIT_EQUAL, TMP2, 0, SLJIT_IMM, req_char | bit);
}
else
{
- found = CMP(SLJIT_C_EQUAL, TMP2, 0, SLJIT_IMM, req_char);
- foundoc = CMP(SLJIT_C_EQUAL, TMP2, 0, SLJIT_IMM, oc);
+ found = CMP(SLJIT_EQUAL, TMP2, 0, SLJIT_IMM, req_char);
+ foundoc = CMP(SLJIT_EQUAL, TMP2, 0, SLJIT_IMM, oc);
}
}
OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, IN_UCHARS(1));
@@ -4069,7 +4084,7 @@ GET_LOCAL_BASE(TMP3, 0, 0);
mainloop = LABEL();
OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), 0);
OP2(SLJIT_SUB | SLJIT_SET_S, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, 0);
-jump = JUMP(SLJIT_C_SIG_LESS_EQUAL);
+jump = JUMP(SLJIT_SIG_LESS_EQUAL);
OP2(SLJIT_ADD, TMP2, 0, TMP2, 0, TMP3, 0);
OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), 0, SLJIT_MEM1(TMP1), sizeof(sljit_sw));
@@ -4078,7 +4093,7 @@ OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, 3 * sizeof(sljit_sw));
JUMPTO(SLJIT_JUMP, mainloop);
JUMPHERE(jump);
-jump = JUMP(SLJIT_C_SIG_LESS);
+jump = JUMP(SLJIT_SIG_LESS);
/* End of dropping frames. */
sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
@@ -4106,7 +4121,7 @@ sljit_emit_fast_enter(compiler, SLJIT_MEM1(SLJIT_SP), LOCALS0);
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_SP), LOCALS1, SLJIT_IMM, 0);
-skipread = CMP(SLJIT_C_LESS_EQUAL, STR_PTR, 0, TMP1, 0);
+skipread = CMP(SLJIT_LESS_EQUAL, STR_PTR, 0, TMP1, 0);
skip_char_back(common);
check_start_used_ptr(common);
read_char(common);
@@ -4116,14 +4131,14 @@ read_char(common);
if (common->use_ucp)
{
OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, 1);
- jump = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_UNDERSCORE);
+ jump = CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_UNDERSCORE);
add_jump(compiler, &common->getucd, JUMP(SLJIT_FAST_CALL));
OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, ucp_Ll);
OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ucp_Lu - ucp_Ll);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_C_LESS_EQUAL);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_LESS_EQUAL);
OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, ucp_Nd - ucp_Ll);
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);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_LESS_EQUAL);
JUMPHERE(jump);
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS1, TMP2, 0);
}
@@ -4131,12 +4146,12 @@ else
#endif
{
#ifndef COMPILE_PCRE8
- jump = CMP(SLJIT_C_GREATER, TMP1, 0, SLJIT_IMM, 255);
+ jump = CMP(SLJIT_GREATER, TMP1, 0, SLJIT_IMM, 255);
#elif defined SUPPORT_UTF
/* Here LOCALS1 has already been zeroed. */
jump = NULL;
if (common->utf)
- jump = CMP(SLJIT_C_GREATER, TMP1, 0, SLJIT_IMM, 255);
+ jump = CMP(SLJIT_GREATER, TMP1, 0, SLJIT_IMM, 255);
#endif /* COMPILE_PCRE8 */
OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), common->ctypes);
OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 4 /* ctype_word */);
@@ -4160,14 +4175,14 @@ peek_char(common, READ_CHAR_MAX);
if (common->use_ucp)
{
OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, 1);
- jump = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_UNDERSCORE);
+ jump = CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_UNDERSCORE);
add_jump(compiler, &common->getucd, JUMP(SLJIT_FAST_CALL));
OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, ucp_Ll);
OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ucp_Lu - ucp_Ll);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_C_LESS_EQUAL);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_LESS_EQUAL);
OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, ucp_Nd - ucp_Ll);
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);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_LESS_EQUAL);
JUMPHERE(jump);
}
else
@@ -4176,12 +4191,12 @@ else
#ifndef COMPILE_PCRE8
/* TMP2 may be destroyed by peek_char. */
OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, 0);
- jump = CMP(SLJIT_C_GREATER, TMP1, 0, SLJIT_IMM, 255);
+ jump = CMP(SLJIT_GREATER, TMP1, 0, SLJIT_IMM, 255);
#elif defined SUPPORT_UTF
OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, 0);
jump = NULL;
if (common->utf)
- jump = CMP(SLJIT_C_GREATER, TMP1, 0, SLJIT_IMM, 255);
+ jump = CMP(SLJIT_GREATER, TMP1, 0, SLJIT_IMM, 255);
#endif
OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(TMP1), common->ctypes);
OP2(SLJIT_LSHR, TMP2, 0, TMP2, 0, SLJIT_IMM, 4 /* ctype_word */);
@@ -4256,41 +4271,41 @@ switch(length)
return TRUE;
case 1:
- add_jump(compiler, backtracks, CMP(bit == 0 ? SLJIT_C_LESS : SLJIT_C_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, ranges[0]));
+ add_jump(compiler, backtracks, CMP(bit == 0 ? SLJIT_LESS : SLJIT_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, ranges[0]));
return TRUE;
case 2:
if (ranges[0] + 1 != ranges[1])
{
OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, ranges[0]);
- add_jump(compiler, backtracks, CMP(bit != 0 ? SLJIT_C_LESS : SLJIT_C_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, ranges[1] - ranges[0]));
+ add_jump(compiler, backtracks, CMP(bit != 0 ? SLJIT_LESS : SLJIT_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, ranges[1] - ranges[0]));
}
else
- add_jump(compiler, backtracks, CMP(bit != 0 ? SLJIT_C_EQUAL : SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, ranges[0]));
+ add_jump(compiler, backtracks, CMP(bit != 0 ? SLJIT_EQUAL : SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, ranges[0]));
return TRUE;
case 3:
if (bit != 0)
{
- add_jump(compiler, backtracks, CMP(SLJIT_C_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, ranges[2]));
+ add_jump(compiler, backtracks, CMP(SLJIT_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, ranges[2]));
if (ranges[0] + 1 != ranges[1])
{
OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, ranges[0]);
- add_jump(compiler, backtracks, CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, ranges[1] - ranges[0]));
+ add_jump(compiler, backtracks, CMP(SLJIT_LESS, TMP1, 0, SLJIT_IMM, ranges[1] - ranges[0]));
}
else
- add_jump(compiler, backtracks, CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, ranges[0]));
+ add_jump(compiler, backtracks, CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, ranges[0]));
return TRUE;
}
- add_jump(compiler, backtracks, CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, ranges[0]));
+ add_jump(compiler, backtracks, CMP(SLJIT_LESS, TMP1, 0, SLJIT_IMM, ranges[0]));
if (ranges[1] + 1 != ranges[2])
{
OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, ranges[1]);
- add_jump(compiler, backtracks, CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, ranges[2] - ranges[1]));
+ add_jump(compiler, backtracks, CMP(SLJIT_LESS, TMP1, 0, SLJIT_IMM, ranges[2] - ranges[1]));
}
else
- add_jump(compiler, backtracks, CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, ranges[1]));
+ add_jump(compiler, backtracks, CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, ranges[1]));
return TRUE;
case 4:
@@ -4302,10 +4317,10 @@ switch(length)
if (ranges[2] + 1 != ranges[3])
{
OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, ranges[2]);
- add_jump(compiler, backtracks, CMP(bit != 0 ? SLJIT_C_LESS : SLJIT_C_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, ranges[3] - ranges[2]));
+ add_jump(compiler, backtracks, CMP(bit != 0 ? SLJIT_LESS : SLJIT_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, ranges[3] - ranges[2]));
}
else
- add_jump(compiler, backtracks, CMP(bit != 0 ? SLJIT_C_EQUAL : SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, ranges[2]));
+ add_jump(compiler, backtracks, CMP(bit != 0 ? SLJIT_EQUAL : SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, ranges[2]));
return TRUE;
}
@@ -4315,31 +4330,31 @@ switch(length)
if (ranges[0] + 1 != ranges[1])
{
OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, ranges[0]);
- add_jump(compiler, backtracks, CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, ranges[1] - ranges[0]));
+ add_jump(compiler, backtracks, CMP(SLJIT_LESS, TMP1, 0, SLJIT_IMM, ranges[1] - ranges[0]));
i = ranges[0];
}
else
- add_jump(compiler, backtracks, CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, ranges[0]));
+ add_jump(compiler, backtracks, CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, ranges[0]));
if (ranges[2] + 1 != ranges[3])
{
OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, ranges[2] - i);
- add_jump(compiler, backtracks, CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, ranges[3] - ranges[2]));
+ add_jump(compiler, backtracks, CMP(SLJIT_LESS, TMP1, 0, SLJIT_IMM, ranges[3] - ranges[2]));
}
else
- add_jump(compiler, backtracks, CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, ranges[2] - i));
+ add_jump(compiler, backtracks, CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, ranges[2] - i));
return TRUE;
}
OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, ranges[0]);
- add_jump(compiler, backtracks, CMP(SLJIT_C_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, ranges[3] - ranges[0]));
+ add_jump(compiler, backtracks, CMP(SLJIT_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, ranges[3] - ranges[0]));
if (ranges[1] + 1 != ranges[2])
{
OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, ranges[1] - ranges[0]);
- add_jump(compiler, backtracks, CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, ranges[2] - ranges[1]));
+ add_jump(compiler, backtracks, CMP(SLJIT_LESS, TMP1, 0, SLJIT_IMM, ranges[2] - ranges[1]));
}
else
- add_jump(compiler, backtracks, CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, ranges[1] - ranges[0]));
+ add_jump(compiler, backtracks, CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, ranges[1] - ranges[0]));
return TRUE;
default:
@@ -4357,21 +4372,21 @@ sljit_emit_fast_enter(compiler, RETURN_ADDR, 0);
OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x0a);
OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x0d - 0x0a);
-OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_C_LESS_EQUAL);
+OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_LESS_EQUAL);
OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x85 - 0x0a);
#if defined SUPPORT_UTF || defined COMPILE_PCRE16 || defined COMPILE_PCRE32
#ifdef COMPILE_PCRE8
if (common->utf)
{
#endif
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_C_EQUAL);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
OP2(SLJIT_OR, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x1);
OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x2029 - 0x0a);
#ifdef COMPILE_PCRE8
}
#endif
#endif /* SUPPORT_UTF || COMPILE_PCRE16 || COMPILE_PCRE32 */
-OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_C_EQUAL);
+OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
}
@@ -4383,33 +4398,33 @@ DEFINE_COMPILER;
sljit_emit_fast_enter(compiler, RETURN_ADDR, 0);
OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x09);
-OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_C_EQUAL);
+OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x20);
-OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_C_EQUAL);
+OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xa0);
#if defined SUPPORT_UTF || defined COMPILE_PCRE16 || defined COMPILE_PCRE32
#ifdef COMPILE_PCRE8
if (common->utf)
{
#endif
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_C_EQUAL);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x1680);
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_C_EQUAL);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x180e);
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_C_EQUAL);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x2000);
OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x200A - 0x2000);
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_C_LESS_EQUAL);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_LESS_EQUAL);
OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x202f - 0x2000);
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_C_EQUAL);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x205f - 0x2000);
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_C_EQUAL);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x3000 - 0x2000);
#ifdef COMPILE_PCRE8
}
#endif
#endif /* SUPPORT_UTF || COMPILE_PCRE16 || COMPILE_PCRE32 */
-OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_C_EQUAL);
+OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
}
@@ -4423,21 +4438,21 @@ sljit_emit_fast_enter(compiler, RETURN_ADDR, 0);
OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x0a);
OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x0d - 0x0a);
-OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_C_LESS_EQUAL);
+OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_LESS_EQUAL);
OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x85 - 0x0a);
#if defined SUPPORT_UTF || defined COMPILE_PCRE16 || defined COMPILE_PCRE32
#ifdef COMPILE_PCRE8
if (common->utf)
{
#endif
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_C_EQUAL);
+ OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
OP2(SLJIT_OR, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x1);
OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x2029 - 0x0a);
#ifdef COMPILE_PCRE8
}
#endif
#endif /* SUPPORT_UTF || COMPILE_PCRE16 || COMPILE_PCRE32 */
-OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_C_EQUAL);
+OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
}
@@ -4461,9 +4476,9 @@ OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
label = LABEL();
OP1(MOVU_UCHAR, CHAR1, 0, SLJIT_MEM1(TMP1), IN_UCHARS(1));
OP1(MOVU_UCHAR, CHAR2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(1));
-jump = CMP(SLJIT_C_NOT_EQUAL, CHAR1, 0, CHAR2, 0);
+jump = CMP(SLJIT_NOT_EQUAL, CHAR1, 0, CHAR2, 0);
OP2(SLJIT_SUB | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_IMM, IN_UCHARS(1));
-JUMPTO(SLJIT_C_NOT_ZERO, label);
+JUMPTO(SLJIT_NOT_ZERO, label);
JUMPHERE(jump);
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
@@ -4494,20 +4509,20 @@ label = LABEL();
OP1(MOVU_UCHAR, CHAR1, 0, SLJIT_MEM1(TMP1), IN_UCHARS(1));
OP1(MOVU_UCHAR, CHAR2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(1));
#ifndef COMPILE_PCRE8
-jump = CMP(SLJIT_C_GREATER, CHAR1, 0, SLJIT_IMM, 255);
+jump = CMP(SLJIT_GREATER, CHAR1, 0, SLJIT_IMM, 255);
#endif
OP1(SLJIT_MOV_UB, CHAR1, 0, SLJIT_MEM2(LCC_TABLE, CHAR1), 0);
#ifndef COMPILE_PCRE8
JUMPHERE(jump);
-jump = CMP(SLJIT_C_GREATER, CHAR2, 0, SLJIT_IMM, 255);
+jump = CMP(SLJIT_GREATER, CHAR2, 0, SLJIT_IMM, 255);
#endif
OP1(SLJIT_MOV_UB, CHAR2, 0, SLJIT_MEM2(LCC_TABLE, CHAR2), 0);
#ifndef COMPILE_PCRE8
JUMPHERE(jump);
#endif
-jump = CMP(SLJIT_C_NOT_EQUAL, CHAR1, 0, CHAR2, 0);
+jump = CMP(SLJIT_NOT_EQUAL, CHAR1, 0, CHAR2, 0);
OP2(SLJIT_SUB | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_IMM, IN_UCHARS(1));
-JUMPTO(SLJIT_C_NOT_ZERO, label);
+JUMPTO(SLJIT_NOT_ZERO, label);
JUMPHERE(jump);
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
@@ -4555,7 +4570,7 @@ return src2;
#endif /* SUPPORT_UTF && SUPPORT_UCP */
static pcre_uchar *byte_sequence_compare(compiler_common *common, BOOL caseless, pcre_uchar *cc,
- compare_context* context, jump_list **backtracks)
+ compare_context *context, jump_list **backtracks)
{
DEFINE_COMPILER;
unsigned int othercasebit = 0;
@@ -4655,20 +4670,20 @@ do
case 4 / sizeof(pcre_uchar):
if (context->oc.asint != 0)
OP2(SLJIT_OR, context->sourcereg, 0, context->sourcereg, 0, SLJIT_IMM, context->oc.asint);
- add_jump(compiler, backtracks, CMP(SLJIT_C_NOT_EQUAL, context->sourcereg, 0, SLJIT_IMM, context->c.asint | context->oc.asint));
+ add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, context->sourcereg, 0, SLJIT_IMM, context->c.asint | context->oc.asint));
break;
case 2 / sizeof(pcre_uchar):
if (context->oc.asushort != 0)
OP2(SLJIT_OR, context->sourcereg, 0, context->sourcereg, 0, SLJIT_IMM, context->oc.asushort);
- add_jump(compiler, backtracks, CMP(SLJIT_C_NOT_EQUAL, context->sourcereg, 0, SLJIT_IMM, context->c.asushort | context->oc.asushort));
+ add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, context->sourcereg, 0, SLJIT_IMM, context->c.asushort | context->oc.asushort));
break;
#ifdef COMPILE_PCRE8
case 1:
if (context->oc.asbyte != 0)
OP2(SLJIT_OR, context->sourcereg, 0, context->sourcereg, 0, SLJIT_IMM, context->oc.asbyte);
- add_jump(compiler, backtracks, CMP(SLJIT_C_NOT_EQUAL, context->sourcereg, 0, SLJIT_IMM, context->c.asbyte | context->oc.asbyte));
+ add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, context->sourcereg, 0, SLJIT_IMM, context->c.asbyte | context->oc.asbyte));
break;
#endif
@@ -4690,10 +4705,10 @@ do
if (othercasebit != 0 && othercasechar == cc)
{
OP2(SLJIT_OR, context->sourcereg, 0, context->sourcereg, 0, SLJIT_IMM, othercasebit);
- add_jump(compiler, backtracks, CMP(SLJIT_C_NOT_EQUAL, context->sourcereg, 0, SLJIT_IMM, *cc | othercasebit));
+ add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, context->sourcereg, 0, SLJIT_IMM, *cc | othercasebit));
}
else
- add_jump(compiler, backtracks, CMP(SLJIT_C_NOT_EQUAL, context->sourcereg, 0, SLJIT_IMM, *cc));
+ add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, context->sourcereg, 0, SLJIT_IMM, *cc));
#endif
@@ -4854,7 +4869,7 @@ if ((cc[-1] & XCL_HASPROP) == 0)
{
if ((cc[-1] & XCL_MAP) != 0)
{
- jump = CMP(SLJIT_C_GREATER, TMP1, 0, SLJIT_IMM, 255);
+ jump = CMP(SLJIT_GREATER, TMP1, 0, SLJIT_IMM, 255);
if (!check_class_ranges(common, (const pcre_uint8 *)cc, (((const pcre_uint8 *)cc)[31] & 0x80) != 0, TRUE, &found))
{
OP2(SLJIT_AND, TMP2, 0, TMP1, 0, SLJIT_IMM, 0x7);
@@ -4862,7 +4877,7 @@ if ((cc[-1] & XCL_HASPROP) == 0)
OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)cc);
OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TMP2, 0);
OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
- add_jump(compiler, &found, JUMP(SLJIT_C_NOT_ZERO));
+ add_jump(compiler, &found, JUMP(SLJIT_NOT_ZERO));
}
add_jump(compiler, backtracks, JUMP(SLJIT_JUMP));
@@ -4873,7 +4888,7 @@ if ((cc[-1] & XCL_HASPROP) == 0)
else
{
OP2(SLJIT_SUB, TMP2, 0, TMP1, 0, SLJIT_IMM, min);
- add_jump(compiler, (cc[-1] & XCL_NOT) == 0 ? backtracks : &found, CMP(SLJIT_C_GREATER, TMP2, 0, SLJIT_IMM, max - min));
+ add_jump(compiler, (cc[-1] & XCL_NOT) == 0 ? backtracks : &found, CMP(SLJIT_GREATER, TMP2, 0, SLJIT_IMM, max - min));
}
}
else if ((cc[-1] & XCL_MAP) != 0)
@@ -4887,14 +4902,14 @@ else if ((cc[-1] & XCL_MAP) != 0)
#ifdef COMPILE_PCRE8
SLJIT_ASSERT(common->utf);
#endif
- jump = CMP(SLJIT_C_GREATER, TMP1, 0, SLJIT_IMM, 255);
+ jump = CMP(SLJIT_GREATER, TMP1, 0, SLJIT_IMM, 255);
OP2(SLJIT_AND, TMP2, 0, TMP1, 0, SLJIT_IMM, 0x7);
OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 3);
OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)cc);
OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TMP2, 0);
OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
- add_jump(compiler, list, JUMP(SLJIT_C_NOT_ZERO));
+ add_jump(compiler, list, JUMP(SLJIT_NOT_ZERO));
JUMPHERE(jump);
}
@@ -4964,19 +4979,19 @@ while (*cc != XCL_END)
if (numberofcmps < 3 && (*cc == XCL_SINGLE || *cc == XCL_RANGE))
{
OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(c - charoffset));
- OP_FLAGS(numberofcmps == 0 ? SLJIT_MOV : SLJIT_OR, TMP2, 0, numberofcmps == 0 ? SLJIT_UNUSED : TMP2, 0, SLJIT_C_EQUAL);
+ OP_FLAGS(numberofcmps == 0 ? SLJIT_MOV : SLJIT_OR, TMP2, 0, numberofcmps == 0 ? SLJIT_UNUSED : TMP2, 0, SLJIT_EQUAL);
numberofcmps++;
}
else if (numberofcmps > 0)
{
OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(c - charoffset));
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_C_EQUAL);
- jump = JUMP(SLJIT_C_NOT_ZERO ^ invertcmp);
+ OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+ jump = JUMP(SLJIT_NOT_ZERO ^ invertcmp);
numberofcmps = 0;
}
else
{
- jump = CMP(SLJIT_C_EQUAL ^ invertcmp, TMP1, 0, SLJIT_IMM, (sljit_sw)(c - charoffset));
+ jump = CMP(SLJIT_EQUAL ^ invertcmp, TMP1, 0, SLJIT_IMM, (sljit_sw)(c - charoffset));
numberofcmps = 0;
}
}
@@ -4990,19 +5005,19 @@ while (*cc != XCL_END)
if (numberofcmps < 3 && (*cc == XCL_SINGLE || *cc == XCL_RANGE))
{
OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(c - charoffset));
- OP_FLAGS(numberofcmps == 0 ? SLJIT_MOV : SLJIT_OR, TMP2, 0, numberofcmps == 0 ? SLJIT_UNUSED : TMP2, 0, SLJIT_C_LESS_EQUAL);
+ OP_FLAGS(numberofcmps == 0 ? SLJIT_MOV : SLJIT_OR, TMP2, 0, numberofcmps == 0 ? SLJIT_UNUSED : TMP2, 0, SLJIT_LESS_EQUAL);
numberofcmps++;
}
else if (numberofcmps > 0)
{
OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(c - charoffset));
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_C_LESS_EQUAL);
- jump = JUMP(SLJIT_C_NOT_ZERO ^ invertcmp);
+ OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_LESS_EQUAL);
+ jump = JUMP(SLJIT_NOT_ZERO ^ invertcmp);
numberofcmps = 0;
}
else
{
- jump = CMP(SLJIT_C_LESS_EQUAL ^ invertcmp, TMP1, 0, SLJIT_IMM, (sljit_sw)(c - charoffset));
+ jump = CMP(SLJIT_LESS_EQUAL ^ invertcmp, TMP1, 0, SLJIT_IMM, (sljit_sw)(c - charoffset));
numberofcmps = 0;
}
}
@@ -5027,59 +5042,59 @@ while (*cc != XCL_END)
case PT_LAMP:
OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Lu - typeoffset);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_C_EQUAL);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Ll - typeoffset);
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_C_EQUAL);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Lt - typeoffset);
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_C_EQUAL);
- jump = JUMP(SLJIT_C_NOT_ZERO ^ invertcmp);
+ OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+ jump = JUMP(SLJIT_NOT_ZERO ^ invertcmp);
break;
case PT_GC:
c = PRIV(ucp_typerange)[(int)cc[1] * 2];
SET_TYPE_OFFSET(c);
- jump = CMP(SLJIT_C_LESS_EQUAL ^ invertcmp, typereg, 0, SLJIT_IMM, PRIV(ucp_typerange)[(int)cc[1] * 2 + 1] - c);
+ jump = CMP(SLJIT_LESS_EQUAL ^ invertcmp, typereg, 0, SLJIT_IMM, PRIV(ucp_typerange)[(int)cc[1] * 2 + 1] - c);
break;
case PT_PC:
- jump = CMP(SLJIT_C_EQUAL ^ invertcmp, typereg, 0, SLJIT_IMM, (int)cc[1] - typeoffset);
+ jump = CMP(SLJIT_EQUAL ^ invertcmp, typereg, 0, SLJIT_IMM, (int)cc[1] - typeoffset);
break;
case PT_SC:
- jump = CMP(SLJIT_C_EQUAL ^ invertcmp, scriptreg, 0, SLJIT_IMM, (int)cc[1]);
+ jump = CMP(SLJIT_EQUAL ^ invertcmp, scriptreg, 0, SLJIT_IMM, (int)cc[1]);
break;
case PT_SPACE:
case PT_PXSPACE:
SET_CHAR_OFFSET(9);
OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xd - 0x9);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_C_LESS_EQUAL);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_LESS_EQUAL);
OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x85 - 0x9);
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_C_EQUAL);
+ OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x180e - 0x9);
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_C_EQUAL);
+ OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
SET_TYPE_OFFSET(ucp_Zl);
OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Zs - ucp_Zl);
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_C_LESS_EQUAL);
- jump = JUMP(SLJIT_C_NOT_ZERO ^ invertcmp);
+ OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_LESS_EQUAL);
+ jump = JUMP(SLJIT_NOT_ZERO ^ invertcmp);
break;
case PT_WORD:
OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(CHAR_UNDERSCORE - charoffset));
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_C_EQUAL);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
/* Fall through. */
case PT_ALNUM:
SET_TYPE_OFFSET(ucp_Ll);
OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Lu - ucp_Ll);
- OP_FLAGS((*cc == PT_ALNUM) ? SLJIT_MOV : SLJIT_OR, TMP2, 0, (*cc == PT_ALNUM) ? SLJIT_UNUSED : TMP2, 0, SLJIT_C_LESS_EQUAL);
+ OP_FLAGS((*cc == PT_ALNUM) ? SLJIT_MOV : SLJIT_OR, TMP2, 0, (*cc == PT_ALNUM) ? SLJIT_UNUSED : TMP2, 0, SLJIT_LESS_EQUAL);
SET_TYPE_OFFSET(ucp_Nd);
OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_No - ucp_Nd);
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_C_LESS_EQUAL);
- jump = JUMP(SLJIT_C_NOT_ZERO ^ invertcmp);
+ OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_LESS_EQUAL);
+ jump = JUMP(SLJIT_NOT_ZERO ^ invertcmp);
break;
case PT_CLIST:
@@ -5101,7 +5116,7 @@ while (*cc != XCL_END)
OP2(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_IMM, other_cases[1] ^ other_cases[0]);
}
OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, other_cases[1]);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_C_EQUAL);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
other_cases += 2;
}
else if (is_powerof2(other_cases[2] ^ other_cases[1]))
@@ -5114,103 +5129,103 @@ while (*cc != XCL_END)
OP2(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_IMM, other_cases[1] ^ other_cases[0]);
}
OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, other_cases[2]);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_C_EQUAL);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(other_cases[0] - charoffset));
- OP_FLAGS(SLJIT_OR | ((other_cases[3] == NOTACHAR) ? SLJIT_SET_E : 0), TMP2, 0, TMP2, 0, SLJIT_C_EQUAL);
+ OP_FLAGS(SLJIT_OR | ((other_cases[3] == NOTACHAR) ? SLJIT_SET_E : 0), TMP2, 0, TMP2, 0, SLJIT_EQUAL);
other_cases += 3;
}
else
{
OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(*other_cases++ - charoffset));
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_C_EQUAL);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
}
while (*other_cases != NOTACHAR)
{
OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(*other_cases++ - charoffset));
- OP_FLAGS(SLJIT_OR | ((*other_cases == NOTACHAR) ? SLJIT_SET_E : 0), TMP2, 0, TMP2, 0, SLJIT_C_EQUAL);
+ OP_FLAGS(SLJIT_OR | ((*other_cases == NOTACHAR) ? SLJIT_SET_E : 0), TMP2, 0, TMP2, 0, SLJIT_EQUAL);
}
- jump = JUMP(SLJIT_C_NOT_ZERO ^ invertcmp);
+ jump = JUMP(SLJIT_NOT_ZERO ^ invertcmp);
break;
case PT_UCNC:
OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(CHAR_DOLLAR_SIGN - charoffset));
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_C_EQUAL);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(CHAR_COMMERCIAL_AT - charoffset));
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_C_EQUAL);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(CHAR_GRAVE_ACCENT - charoffset));
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_C_EQUAL);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
SET_CHAR_OFFSET(0xa0);
OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(0xd7ff - charoffset));
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_C_LESS_EQUAL);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_LESS_EQUAL);
SET_CHAR_OFFSET(0);
OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xe000 - 0);
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_C_GREATER_EQUAL);
- jump = JUMP(SLJIT_C_NOT_ZERO ^ invertcmp);
+ OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_GREATER_EQUAL);
+ jump = JUMP(SLJIT_NOT_ZERO ^ invertcmp);
break;
case PT_PXGRAPH:
/* C and Z groups are the farthest two groups. */
SET_TYPE_OFFSET(ucp_Ll);
OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_So - ucp_Ll);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_C_GREATER);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_GREATER);
- jump = CMP(SLJIT_C_NOT_EQUAL, typereg, 0, SLJIT_IMM, ucp_Cf - ucp_Ll);
+ jump = CMP(SLJIT_NOT_EQUAL, typereg, 0, SLJIT_IMM, ucp_Cf - ucp_Ll);
/* In case of ucp_Cf, we overwrite the result. */
SET_CHAR_OFFSET(0x2066);
OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x2069 - 0x2066);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_C_LESS_EQUAL);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_LESS_EQUAL);
OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x061c - 0x2066);
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_C_EQUAL);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x180e - 0x2066);
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_C_EQUAL);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
JUMPHERE(jump);
- jump = CMP(SLJIT_C_ZERO ^ invertcmp, TMP2, 0, SLJIT_IMM, 0);
+ jump = CMP(SLJIT_ZERO ^ invertcmp, TMP2, 0, SLJIT_IMM, 0);
break;
case PT_PXPRINT:
/* C and Z groups are the farthest two groups. */
SET_TYPE_OFFSET(ucp_Ll);
OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_So - ucp_Ll);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_C_GREATER);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_GREATER);
OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Zs - ucp_Ll);
- OP_FLAGS(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_C_NOT_EQUAL);
+ OP_FLAGS(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_NOT_EQUAL);
- jump = CMP(SLJIT_C_NOT_EQUAL, typereg, 0, SLJIT_IMM, ucp_Cf - ucp_Ll);
+ jump = CMP(SLJIT_NOT_EQUAL, typereg, 0, SLJIT_IMM, ucp_Cf - ucp_Ll);
/* In case of ucp_Cf, we overwrite the result. */
SET_CHAR_OFFSET(0x2066);
OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x2069 - 0x2066);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_C_LESS_EQUAL);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_LESS_EQUAL);
OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x061c - 0x2066);
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_C_EQUAL);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
JUMPHERE(jump);
- jump = CMP(SLJIT_C_ZERO ^ invertcmp, TMP2, 0, SLJIT_IMM, 0);
+ jump = CMP(SLJIT_ZERO ^ invertcmp, TMP2, 0, SLJIT_IMM, 0);
break;
case PT_PXPUNCT:
SET_TYPE_OFFSET(ucp_Sc);
OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_So - ucp_Sc);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_C_LESS_EQUAL);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_LESS_EQUAL);
SET_CHAR_OFFSET(0);
OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xff);
- OP_FLAGS(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_C_LESS_EQUAL);
+ OP_FLAGS(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_LESS_EQUAL);
SET_TYPE_OFFSET(ucp_Pc);
OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Ps - ucp_Pc);
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_C_LESS_EQUAL);
- jump = JUMP(SLJIT_C_NOT_ZERO ^ invertcmp);
+ OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_LESS_EQUAL);
+ jump = JUMP(SLJIT_NOT_ZERO ^ invertcmp);
break;
}
cc += 2;
@@ -5250,19 +5265,19 @@ switch(type)
case OP_SOD:
OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, begin));
- add_jump(compiler, backtracks, CMP(SLJIT_C_NOT_EQUAL, STR_PTR, 0, TMP1, 0));
+ add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, STR_PTR, 0, TMP1, 0));
return cc;
case OP_SOM:
OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, str));
- add_jump(compiler, backtracks, CMP(SLJIT_C_NOT_EQUAL, STR_PTR, 0, TMP1, 0));
+ add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, STR_PTR, 0, TMP1, 0));
return cc;
case OP_NOT_WORD_BOUNDARY:
case OP_WORD_BOUNDARY:
add_jump(compiler, &common->wordboundary, JUMP(SLJIT_FAST_CALL));
- add_jump(compiler, backtracks, JUMP(type == OP_NOT_WORD_BOUNDARY ? SLJIT_C_NOT_ZERO : SLJIT_C_ZERO));
+ add_jump(compiler, backtracks, JUMP(type == OP_NOT_WORD_BOUNDARY ? SLJIT_NOT_ZERO : SLJIT_ZERO));
return cc;
case OP_NOT_DIGIT:
@@ -5277,7 +5292,7 @@ switch(type)
read_char8_type(common, type == OP_NOT_DIGIT);
/* Flip the starting bit in the negative case. */
OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ctype_digit);
- add_jump(compiler, backtracks, JUMP(type == OP_DIGIT ? SLJIT_C_ZERO : SLJIT_C_NOT_ZERO));
+ add_jump(compiler, backtracks, JUMP(type == OP_DIGIT ? SLJIT_ZERO : SLJIT_NOT_ZERO));
return cc;
case OP_NOT_WHITESPACE:
@@ -5290,7 +5305,7 @@ switch(type)
#endif
read_char8_type(common, type == OP_NOT_WHITESPACE);
OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ctype_space);
- add_jump(compiler, backtracks, JUMP(type == OP_WHITESPACE ? SLJIT_C_ZERO : SLJIT_C_NOT_ZERO));
+ add_jump(compiler, backtracks, JUMP(type == OP_WHITESPACE ? SLJIT_ZERO : SLJIT_NOT_ZERO));
return cc;
case OP_NOT_WORDCHAR:
@@ -5303,7 +5318,7 @@ switch(type)
#endif
read_char8_type(common, type == OP_NOT_WORDCHAR);
OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ctype_word);
- add_jump(compiler, backtracks, JUMP(type == OP_WORDCHAR ? SLJIT_C_ZERO : SLJIT_C_NOT_ZERO));
+ add_jump(compiler, backtracks, JUMP(type == OP_WORDCHAR ? SLJIT_ZERO : SLJIT_NOT_ZERO));
return cc;
case OP_ANY:
@@ -5311,15 +5326,15 @@ switch(type)
read_char_range(common, common->nlmin, common->nlmax, TRUE);
if (common->nltype == NLTYPE_FIXED && common->newline > 255)
{
- jump[0] = CMP(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff);
+ jump[0] = CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff);
end_list = NULL;
if (common->mode != JIT_PARTIAL_HARD_COMPILE)
- add_jump(compiler, &end_list, CMP(SLJIT_C_GREATER_EQUAL, STR_PTR, 0, STR_END, 0));
+ add_jump(compiler, &end_list, CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0));
else
check_str_end(common, &end_list);
OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);
- add_jump(compiler, backtracks, CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, common->newline & 0xff));
+ add_jump(compiler, backtracks, CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, common->newline & 0xff));
set_jumps(end_list, LABEL());
JUMPHERE(jump[0]);
}
@@ -5336,14 +5351,14 @@ switch(type)
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
#if defined COMPILE_PCRE8 || defined COMPILE_PCRE16
#if defined COMPILE_PCRE8
- jump[0] = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0);
+ jump[0] = CMP(SLJIT_LESS, TMP1, 0, SLJIT_IMM, 0xc0);
OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)PRIV(utf8_table4) - 0xc0);
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
#elif defined COMPILE_PCRE16
- jump[0] = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xd800);
+ jump[0] = CMP(SLJIT_LESS, TMP1, 0, SLJIT_IMM, 0xd800);
OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0xfc00);
OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xd800);
- OP_FLAGS(SLJIT_MOV, TMP1, 0, SLJIT_UNUSED, 0, SLJIT_C_EQUAL);
+ OP_FLAGS(SLJIT_MOV, TMP1, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
#endif
@@ -5377,15 +5392,15 @@ switch(type)
case OP_ANYNL:
detect_partial_match(common, backtracks);
read_char_range(common, common->bsr_nlmin, common->bsr_nlmax, FALSE);
- jump[0] = CMP(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_CR);
+ jump[0] = CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_CR);
/* We don't need to handle soft partial matching case. */
end_list = NULL;
if (common->mode != JIT_PARTIAL_HARD_COMPILE)
- add_jump(compiler, &end_list, CMP(SLJIT_C_GREATER_EQUAL, STR_PTR, 0, STR_END, 0));
+ add_jump(compiler, &end_list, CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0));
else
check_str_end(common, &end_list);
OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);
- jump[1] = CMP(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_NL);
+ jump[1] = CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_NL);
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
jump[2] = JUMP(SLJIT_JUMP);
JUMPHERE(jump[0]);
@@ -5400,7 +5415,7 @@ switch(type)
detect_partial_match(common, backtracks);
read_char_range(common, 0x9, 0x3000, type == OP_NOT_HSPACE);
add_jump(compiler, &common->hspace, JUMP(SLJIT_FAST_CALL));
- add_jump(compiler, backtracks, JUMP(type == OP_NOT_HSPACE ? SLJIT_C_NOT_ZERO : SLJIT_C_ZERO));
+ add_jump(compiler, backtracks, JUMP(type == OP_NOT_HSPACE ? SLJIT_NOT_ZERO : SLJIT_ZERO));
return cc;
case OP_NOT_VSPACE:
@@ -5408,7 +5423,7 @@ switch(type)
detect_partial_match(common, backtracks);
read_char_range(common, 0xa, 0x2029, type == OP_NOT_VSPACE);
add_jump(compiler, &common->vspace, JUMP(SLJIT_FAST_CALL));
- add_jump(compiler, backtracks, JUMP(type == OP_NOT_VSPACE ? SLJIT_C_NOT_ZERO : SLJIT_C_ZERO));
+ add_jump(compiler, backtracks, JUMP(type == OP_NOT_VSPACE ? SLJIT_NOT_ZERO : SLJIT_ZERO));
return cc;
#ifdef SUPPORT_UCP
@@ -5422,7 +5437,7 @@ switch(type)
OP1(SLJIT_MOV_UB, STACK_TOP, 0, SLJIT_MEM2(TMP1, TMP2), 3);
label = LABEL();
- jump[0] = CMP(SLJIT_C_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
+ jump[0] = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
OP1(SLJIT_MOV, TMP3, 0, STR_PTR, 0);
read_char(common);
add_jump(compiler, &common->getucd, JUMP(SLJIT_FAST_CALL));
@@ -5434,7 +5449,7 @@ switch(type)
OP1(SLJIT_MOV, STACK_TOP, 0, TMP2, 0);
OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TMP2, 0);
OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
- JUMPTO(SLJIT_C_NOT_ZERO, label);
+ JUMPTO(SLJIT_NOT_ZERO, label);
OP1(SLJIT_MOV, STR_PTR, 0, TMP3, 0);
JUMPHERE(jump[0]);
@@ -5442,7 +5457,7 @@ switch(type)
if (common->mode == JIT_PARTIAL_HARD_COMPILE)
{
- jump[0] = CMP(SLJIT_C_LESS, STR_PTR, 0, STR_END, 0);
+ jump[0] = CMP(SLJIT_LESS, STR_PTR, 0, STR_END, 0);
/* Since we successfully read a char above, partial matching must occure. */
check_partial(common, TRUE);
JUMPHERE(jump[0]);
@@ -5452,63 +5467,63 @@ switch(type)
case OP_EODN:
/* Requires rather complex checks. */
- jump[0] = CMP(SLJIT_C_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
+ jump[0] = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
if (common->nltype == NLTYPE_FIXED && common->newline > 255)
{
OP2(SLJIT_ADD, TMP2, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(2));
OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0));
if (common->mode == JIT_COMPILE)
- add_jump(compiler, backtracks, CMP(SLJIT_C_NOT_EQUAL, TMP2, 0, STR_END, 0));
+ add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP2, 0, STR_END, 0));
else
{
- jump[1] = CMP(SLJIT_C_EQUAL, TMP2, 0, STR_END, 0);
+ jump[1] = CMP(SLJIT_EQUAL, TMP2, 0, STR_END, 0);
OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP2, 0, STR_END, 0);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_C_LESS);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_LESS);
OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff);
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_C_NOT_EQUAL);
- add_jump(compiler, backtracks, JUMP(SLJIT_C_NOT_EQUAL));
+ OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_NOT_EQUAL);
+ add_jump(compiler, backtracks, JUMP(SLJIT_NOT_EQUAL));
check_partial(common, TRUE);
add_jump(compiler, backtracks, JUMP(SLJIT_JUMP));
JUMPHERE(jump[1]);
}
OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(1));
- add_jump(compiler, backtracks, CMP(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff));
- add_jump(compiler, backtracks, CMP(SLJIT_C_NOT_EQUAL, TMP2, 0, SLJIT_IMM, common->newline & 0xff));
+ add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff));
+ add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP2, 0, SLJIT_IMM, common->newline & 0xff));
}
else if (common->nltype == NLTYPE_FIXED)
{
OP2(SLJIT_ADD, TMP2, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0));
- add_jump(compiler, backtracks, CMP(SLJIT_C_NOT_EQUAL, TMP2, 0, STR_END, 0));
- add_jump(compiler, backtracks, CMP(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, common->newline));
+ add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP2, 0, STR_END, 0));
+ add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, common->newline));
}
else
{
OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0));
- jump[1] = CMP(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_CR);
+ jump[1] = CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_CR);
OP2(SLJIT_ADD, TMP2, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(2));
OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP2, 0, STR_END, 0);
- jump[2] = JUMP(SLJIT_C_GREATER);
- add_jump(compiler, backtracks, JUMP(SLJIT_C_LESS));
+ jump[2] = JUMP(SLJIT_GREATER);
+ add_jump(compiler, backtracks, JUMP(SLJIT_LESS));
/* Equal. */
OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(1));
- jump[3] = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_NL);
+ jump[3] = CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_NL);
add_jump(compiler, backtracks, JUMP(SLJIT_JUMP));
JUMPHERE(jump[1]);
if (common->nltype == NLTYPE_ANYCRLF)
{
OP2(SLJIT_ADD, TMP2, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
- add_jump(compiler, backtracks, CMP(SLJIT_C_LESS, TMP2, 0, STR_END, 0));
- add_jump(compiler, backtracks, CMP(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_NL));
+ add_jump(compiler, backtracks, CMP(SLJIT_LESS, TMP2, 0, STR_END, 0));
+ add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_NL));
}
else
{
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, backtracks, CMP(SLJIT_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));
+ add_jump(compiler, backtracks, JUMP(SLJIT_ZERO));
OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), LOCALS1);
}
JUMPHERE(jump[2]);
@@ -5519,36 +5534,36 @@ switch(type)
return cc;
case OP_EOD:
- add_jump(compiler, backtracks, CMP(SLJIT_C_LESS, STR_PTR, 0, STR_END, 0));
+ add_jump(compiler, backtracks, CMP(SLJIT_LESS, STR_PTR, 0, STR_END, 0));
check_partial(common, FALSE);
return cc;
case OP_CIRC:
OP1(SLJIT_MOV, TMP2, 0, ARGUMENTS, 0);
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, begin));
- add_jump(compiler, backtracks, CMP(SLJIT_C_GREATER, STR_PTR, 0, TMP1, 0));
+ add_jump(compiler, backtracks, CMP(SLJIT_GREATER, STR_PTR, 0, TMP1, 0));
OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, notbol));
- add_jump(compiler, backtracks, CMP(SLJIT_C_NOT_EQUAL, TMP2, 0, SLJIT_IMM, 0));
+ add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP2, 0, SLJIT_IMM, 0));
return cc;
case OP_CIRCM:
OP1(SLJIT_MOV, TMP2, 0, ARGUMENTS, 0);
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, begin));
- jump[1] = CMP(SLJIT_C_GREATER, STR_PTR, 0, TMP1, 0);
+ jump[1] = CMP(SLJIT_GREATER, STR_PTR, 0, TMP1, 0);
OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, notbol));
- add_jump(compiler, backtracks, CMP(SLJIT_C_NOT_EQUAL, TMP2, 0, SLJIT_IMM, 0));
+ add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP2, 0, SLJIT_IMM, 0));
jump[0] = JUMP(SLJIT_JUMP);
JUMPHERE(jump[1]);
- add_jump(compiler, backtracks, CMP(SLJIT_C_GREATER_EQUAL, STR_PTR, 0, STR_END, 0));
+ add_jump(compiler, backtracks, CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0));
if (common->nltype == NLTYPE_FIXED && common->newline > 255)
{
OP2(SLJIT_SUB, TMP2, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(2));
- add_jump(compiler, backtracks, CMP(SLJIT_C_LESS, TMP2, 0, TMP1, 0));
+ add_jump(compiler, backtracks, CMP(SLJIT_LESS, TMP2, 0, TMP1, 0));
OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(-2));
OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(-1));
- add_jump(compiler, backtracks, CMP(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff));
- add_jump(compiler, backtracks, CMP(SLJIT_C_NOT_EQUAL, TMP2, 0, SLJIT_IMM, common->newline & 0xff));
+ add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff));
+ add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP2, 0, SLJIT_IMM, common->newline & 0xff));
}
else
{
@@ -5562,22 +5577,22 @@ switch(type)
case OP_DOLL:
OP1(SLJIT_MOV, TMP2, 0, ARGUMENTS, 0);
OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, noteol));
- add_jump(compiler, backtracks, CMP(SLJIT_C_NOT_EQUAL, TMP2, 0, SLJIT_IMM, 0));
+ add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP2, 0, SLJIT_IMM, 0));
if (!common->endonly)
compile_char1_matchingpath(common, OP_EODN, cc, backtracks);
else
{
- add_jump(compiler, backtracks, CMP(SLJIT_C_LESS, STR_PTR, 0, STR_END, 0));
+ add_jump(compiler, backtracks, CMP(SLJIT_LESS, STR_PTR, 0, STR_END, 0));
check_partial(common, FALSE);
}
return cc;
case OP_DOLLM:
- jump[1] = CMP(SLJIT_C_LESS, STR_PTR, 0, STR_END, 0);
+ jump[1] = CMP(SLJIT_LESS, STR_PTR, 0, STR_END, 0);
OP1(SLJIT_MOV, TMP2, 0, ARGUMENTS, 0);
OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, noteol));
- add_jump(compiler, backtracks, CMP(SLJIT_C_NOT_EQUAL, TMP2, 0, SLJIT_IMM, 0));
+ add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP2, 0, SLJIT_IMM, 0));
check_partial(common, FALSE);
jump[0] = JUMP(SLJIT_JUMP);
JUMPHERE(jump[1]);
@@ -5587,20 +5602,20 @@ switch(type)
OP2(SLJIT_ADD, TMP2, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(2));
OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0));
if (common->mode == JIT_COMPILE)
- add_jump(compiler, backtracks, CMP(SLJIT_C_GREATER, TMP2, 0, STR_END, 0));
+ add_jump(compiler, backtracks, CMP(SLJIT_GREATER, TMP2, 0, STR_END, 0));
else
{
- jump[1] = CMP(SLJIT_C_LESS_EQUAL, TMP2, 0, STR_END, 0);
+ jump[1] = CMP(SLJIT_LESS_EQUAL, TMP2, 0, STR_END, 0);
/* STR_PTR = STR_END - IN_UCHARS(1) */
- add_jump(compiler, backtracks, CMP(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff));
+ add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff));
check_partial(common, TRUE);
add_jump(compiler, backtracks, JUMP(SLJIT_JUMP));
JUMPHERE(jump[1]);
}
OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(1));
- add_jump(compiler, backtracks, CMP(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff));
- add_jump(compiler, backtracks, CMP(SLJIT_C_NOT_EQUAL, TMP2, 0, SLJIT_IMM, common->newline & 0xff));
+ add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff));
+ add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP2, 0, SLJIT_IMM, common->newline & 0xff));
}
else
{
@@ -5619,7 +5634,7 @@ switch(type)
if (common->mode == JIT_COMPILE && (type == OP_CHAR || !char_has_othercase(common, cc) || char_get_othercase_bit(common, cc) != 0))
{
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(length));
- add_jump(compiler, backtracks, CMP(SLJIT_C_GREATER, STR_PTR, 0, STR_END, 0));
+ add_jump(compiler, backtracks, CMP(SLJIT_GREATER, STR_PTR, 0, STR_END, 0));
context.length = IN_UCHARS(length);
context.sourcereg = -1;
@@ -5642,7 +5657,7 @@ switch(type)
if (type == OP_CHAR || !char_has_othercase(common, cc))
{
read_char_range(common, c, c, FALSE);
- add_jump(compiler, backtracks, CMP(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, c));
+ add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, c));
return cc + length;
}
oc = char_othercase(common, c);
@@ -5651,11 +5666,11 @@ switch(type)
if (is_powerof2(bit))
{
OP2(SLJIT_OR, TMP1, 0, TMP1, 0, SLJIT_IMM, bit);
- add_jump(compiler, backtracks, CMP(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, c | bit));
+ add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, c | bit));
return cc + length;
}
- jump[0] = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, c);
- add_jump(compiler, backtracks, CMP(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, oc));
+ jump[0] = CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, c);
+ add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, oc));
JUMPHERE(jump[0]);
return cc + length;
@@ -5672,16 +5687,16 @@ switch(type)
{
OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);
if (type == OP_NOT || !char_has_othercase(common, cc))
- add_jump(compiler, backtracks, CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, c));
+ add_jump(compiler, backtracks, CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, c));
else
{
/* Since UTF8 code page is fixed, we know that c is in [a-z] or [A-Z] range. */
OP2(SLJIT_OR, TMP2, 0, TMP1, 0, SLJIT_IMM, 0x20);
- add_jump(compiler, backtracks, CMP(SLJIT_C_EQUAL, TMP2, 0, SLJIT_IMM, c | 0x20));
+ add_jump(compiler, backtracks, CMP(SLJIT_EQUAL, TMP2, 0, SLJIT_IMM, c | 0x20));
}
/* Skip the variable-length character. */
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
- jump[0] = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0);
+ jump[0] = CMP(SLJIT_LESS, TMP1, 0, SLJIT_IMM, 0xc0);
OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)PRIV(utf8_table4) - 0xc0);
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
JUMPHERE(jump[0]);
@@ -5700,7 +5715,7 @@ switch(type)
if (type == OP_NOT || !char_has_othercase(common, cc))
{
read_char_range(common, c, c, TRUE);
- add_jump(compiler, backtracks, CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, c));
+ add_jump(compiler, backtracks, CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, c));
}
else
{
@@ -5710,12 +5725,12 @@ switch(type)
if (is_powerof2(bit))
{
OP2(SLJIT_OR, TMP1, 0, TMP1, 0, SLJIT_IMM, bit);
- add_jump(compiler, backtracks, CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, c | bit));
+ add_jump(compiler, backtracks, CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, c | bit));
}
else
{
- add_jump(compiler, backtracks, CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, c));
- add_jump(compiler, backtracks, CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, oc));
+ add_jump(compiler, backtracks, CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, c));
+ add_jump(compiler, backtracks, CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, oc));
}
}
return cc + length;
@@ -5738,7 +5753,7 @@ switch(type)
jump[0] = NULL;
if (common->utf)
{
- jump[0] = CMP(SLJIT_C_GREATER, TMP1, 0, SLJIT_IMM, bit);
+ jump[0] = CMP(SLJIT_GREATER, TMP1, 0, SLJIT_IMM, bit);
if (type == OP_CLASS)
{
add_jump(compiler, backtracks, jump[0]);
@@ -5746,7 +5761,7 @@ switch(type)
}
}
#elif !defined COMPILE_PCRE8
- jump[0] = CMP(SLJIT_C_GREATER, TMP1, 0, SLJIT_IMM, 255);
+ jump[0] = CMP(SLJIT_GREATER, TMP1, 0, SLJIT_IMM, 255);
if (type == OP_CLASS)
{
add_jump(compiler, backtracks, jump[0]);
@@ -5759,7 +5774,7 @@ switch(type)
OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)cc);
OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TMP2, 0);
OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
- add_jump(compiler, backtracks, JUMP(SLJIT_C_ZERO));
+ add_jump(compiler, backtracks, JUMP(SLJIT_ZERO));
#if defined SUPPORT_UTF || !defined COMPILE_PCRE8
if (jump[0] != NULL)
@@ -5785,17 +5800,17 @@ switch(type)
OP1(SLJIT_MOV, TMP3, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, begin));
OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, length);
label = LABEL();
- add_jump(compiler, backtracks, CMP(SLJIT_C_LESS_EQUAL, STR_PTR, 0, TMP3, 0));
+ add_jump(compiler, backtracks, CMP(SLJIT_LESS_EQUAL, STR_PTR, 0, TMP3, 0));
skip_char_back(common);
OP2(SLJIT_SUB | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_IMM, 1);
- JUMPTO(SLJIT_C_NOT_ZERO, label);
+ JUMPTO(SLJIT_NOT_ZERO, label);
}
else
#endif
{
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, begin));
OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(length));
- add_jump(compiler, backtracks, CMP(SLJIT_C_LESS, STR_PTR, 0, TMP1, 0));
+ add_jump(compiler, backtracks, CMP(SLJIT_LESS, STR_PTR, 0, TMP1, 0));
}
check_start_used_ptr(common);
return cc + LINK_SIZE;
@@ -5856,7 +5871,7 @@ if (context.length > 0)
{
/* We have a fixed-length byte sequence. */
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, context.length);
- add_jump(compiler, backtracks, CMP(SLJIT_C_GREATER, STR_PTR, 0, STR_END, 0));
+ add_jump(compiler, backtracks, CMP(SLJIT_GREATER, STR_PTR, 0, STR_END, 0));
context.sourcereg = -1;
#if defined SLJIT_UNALIGNED && SLJIT_UNALIGNED
@@ -5920,14 +5935,14 @@ 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_SP), OVECTOR(offset), TMP1, 0));
+ add_jump(compiler, &found, CMP(SLJIT_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_SP), OVECTOR(offset), TMP1, 0));
+ add_jump(compiler, backtracks, CMP(SLJIT_EQUAL, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset), TMP1, 0));
set_jumps(found, LABEL());
}
@@ -5947,7 +5962,7 @@ if (ref)
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_SP), OVECTOR(1)));
+ add_jump(compiler, backtracks, CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(1)));
}
else
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP2), 0);
@@ -5962,7 +5977,7 @@ if (common->utf && *cc == OP_REFI)
OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP2), sizeof(sljit_sw));
if (withchecks)
- jump = CMP(SLJIT_C_EQUAL, TMP1, 0, TMP2, 0);
+ jump = CMP(SLJIT_EQUAL, TMP1, 0, TMP2, 0);
/* Needed to save important temporary registers. */
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS0, STACK_TOP, 0);
@@ -5971,11 +5986,11 @@ if (common->utf && *cc == OP_REFI)
sljit_emit_ijump(compiler, SLJIT_CALL3, SLJIT_IMM, SLJIT_FUNC_OFFSET(do_utf_caselesscmp));
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));
+ add_jump(compiler, backtracks, CMP(SLJIT_LESS_EQUAL, SLJIT_RETURN_REG, 0, SLJIT_IMM, 1));
else
{
- add_jump(compiler, backtracks, CMP(SLJIT_C_EQUAL, SLJIT_RETURN_REG, 0, SLJIT_IMM, 0));
- nopartial = CMP(SLJIT_C_NOT_EQUAL, SLJIT_RETURN_REG, 0, SLJIT_IMM, 1);
+ add_jump(compiler, backtracks, CMP(SLJIT_EQUAL, SLJIT_RETURN_REG, 0, SLJIT_IMM, 0));
+ nopartial = CMP(SLJIT_NOT_EQUAL, SLJIT_RETURN_REG, 0, SLJIT_IMM, 1);
check_partial(common, FALSE);
add_jump(compiler, backtracks, JUMP(SLJIT_JUMP));
JUMPHERE(nopartial);
@@ -5991,15 +6006,15 @@ else
OP2(SLJIT_SUB | SLJIT_SET_E, TMP2, 0, SLJIT_MEM1(TMP2), sizeof(sljit_sw), TMP1, 0);
if (withchecks)
- jump = JUMP(SLJIT_C_ZERO);
+ jump = JUMP(SLJIT_ZERO);
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP2, 0);
- partial = CMP(SLJIT_C_GREATER, STR_PTR, 0, STR_END, 0);
+ partial = CMP(SLJIT_GREATER, STR_PTR, 0, STR_END, 0);
if (common->mode == JIT_COMPILE)
add_jump(compiler, backtracks, partial);
add_jump(compiler, *cc == OP_REF ? &common->casefulcmp : &common->caselesscmp, JUMP(SLJIT_FAST_CALL));
- add_jump(compiler, backtracks, CMP(SLJIT_C_NOT_EQUAL, TMP2, 0, SLJIT_IMM, 0));
+ add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP2, 0, SLJIT_IMM, 0));
if (common->mode != JIT_COMPILE)
{
@@ -6008,10 +6023,10 @@ else
/* TMP2 -= STR_END - STR_PTR */
OP2(SLJIT_SUB, TMP2, 0, TMP2, 0, STR_PTR, 0);
OP2(SLJIT_ADD, TMP2, 0, TMP2, 0, STR_END, 0);
- partial = CMP(SLJIT_C_EQUAL, TMP2, 0, SLJIT_IMM, 0);
+ partial = CMP(SLJIT_EQUAL, TMP2, 0, SLJIT_IMM, 0);
OP1(SLJIT_MOV, STR_PTR, 0, STR_END, 0);
add_jump(compiler, *cc == OP_REF ? &common->casefulcmp : &common->caselesscmp, JUMP(SLJIT_FAST_CALL));
- add_jump(compiler, backtracks, CMP(SLJIT_C_NOT_EQUAL, TMP2, 0, SLJIT_IMM, 0));
+ add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP2, 0, SLJIT_IMM, 0));
JUMPHERE(partial);
check_partial(common, FALSE);
add_jump(compiler, backtracks, JUMP(SLJIT_JUMP));
@@ -6097,13 +6112,13 @@ 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_SP), OVECTOR(offset + 1));
+ zerolength = CMP(SLJIT_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_SP), POSSESSIVE1, TMP2, 0);
- zerolength = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(TMP2), sizeof(sljit_sw));
+ zerolength = CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_MEM1(TMP2), sizeof(sljit_sw));
}
/* Restore if not zero length. */
OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, sizeof(sljit_sw));
@@ -6116,15 +6131,15 @@ if (!minimize)
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_SP), OVECTOR(1)));
- zerolength = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset + 1));
+ add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(1)));
+ zerolength = CMP(SLJIT_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_SP), POSSESSIVE1, TMP2, 0);
- zerolength = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(TMP2), sizeof(sljit_sw));
+ zerolength = CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_MEM1(TMP2), sizeof(sljit_sw));
}
}
@@ -6142,10 +6157,10 @@ if (!minimize)
OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), POSSESSIVE0, TMP1, 0);
if (min > 1)
- CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, min, label);
+ CMPTO(SLJIT_LESS, TMP1, 0, SLJIT_IMM, min, label);
if (max > 1)
{
- jump = CMP(SLJIT_C_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, max);
+ jump = CMP(SLJIT_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, max);
allocate_stack(common, 1);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);
JUMPTO(SLJIT_JUMP, label);
@@ -6180,13 +6195,13 @@ 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_SP), OVECTOR(offset + 1));
+ zerolength = CMP(SLJIT_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(STACK_TOP), STACK(2), TMP2, 0);
- zerolength = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(TMP2), sizeof(sljit_sw));
+ zerolength = CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_MEM1(TMP2), sizeof(sljit_sw));
}
/* Length is non-zero, we can match real repeats. */
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);
@@ -6196,21 +6211,21 @@ else
{
if (ref)
{
- 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));
+ add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(1)));
+ zerolength = CMP(SLJIT_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(STACK_TOP), STACK(2), TMP2, 0);
- zerolength = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(TMP2), sizeof(sljit_sw));
+ zerolength = CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_MEM1(TMP2), sizeof(sljit_sw));
}
}
BACKTRACK_AS(iterator_backtrack)->matchingpath = LABEL();
if (max > 0)
- add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_C_GREATER_EQUAL, SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_IMM, max));
+ add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_GREATER_EQUAL, SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_IMM, max));
if (!ref)
OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), STACK(2));
@@ -6222,7 +6237,7 @@ if (min > 1)
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(1));
OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), TMP1, 0);
- CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, min, BACKTRACK_AS(iterator_backtrack)->matchingpath);
+ CMPTO(SLJIT_LESS, TMP1, 0, SLJIT_IMM, min, BACKTRACK_AS(iterator_backtrack)->matchingpath);
}
else if (max > 0)
OP2(SLJIT_ADD, SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_IMM, 1);
@@ -6300,11 +6315,11 @@ if (entry->entry == NULL)
else
JUMPTO(SLJIT_FAST_CALL, entry->entry);
/* Leave if the match is failed. */
-add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, 0));
+add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, 0));
return cc + 1 + LINK_SIZE;
}
-static int SLJIT_CALL do_callout(struct jit_arguments* arguments, PUBL(callout_block) *callout_block, pcre_uchar **jit_ovector)
+static int SLJIT_CALL do_callout(struct jit_arguments *arguments, PUBL(callout_block) *callout_block, pcre_uchar **jit_ovector)
{
const pcre_uchar *begin = arguments->begin;
int *offset_vector = arguments->offsets;
@@ -6364,9 +6379,9 @@ PUSH_BACKTRACK(sizeof(backtrack_common), cc, NULL);
allocate_stack(common, CALLOUT_ARG_SIZE / sizeof(sljit_sw));
+SLJIT_ASSERT(common->capture_last_ptr != 0);
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);
@@ -6392,11 +6407,11 @@ free_stack(common, CALLOUT_ARG_SIZE / sizeof(sljit_sw));
/* Check return value. */
OP2(SLJIT_SUB | SLJIT_SET_S, SLJIT_UNUSED, 0, SLJIT_RETURN_REG, 0, SLJIT_IMM, 0);
-add_jump(compiler, &backtrack->topbacktracks, JUMP(SLJIT_C_SIG_GREATER));
+add_jump(compiler, &backtrack->topbacktracks, JUMP(SLJIT_SIG_GREATER));
if (common->forced_quit_label == NULL)
- add_jump(compiler, &common->forced_quit, JUMP(SLJIT_C_SIG_LESS));
+ add_jump(compiler, &common->forced_quit, JUMP(SLJIT_SIG_LESS));
else
- JUMPTO(SLJIT_C_SIG_LESS, common->forced_quit_label);
+ JUMPTO(SLJIT_SIG_LESS, common->forced_quit_label);
return cc + 2 + 2 * LINK_SIZE;
}
@@ -6454,7 +6469,7 @@ if (bra == OP_BRAMINZERO)
/* This is a braminzero backtrack path. */
OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(0));
free_stack(common, 1);
- brajump = CMP(SLJIT_C_EQUAL, STR_PTR, 0, SLJIT_IMM, 0);
+ brajump = CMP(SLJIT_EQUAL, STR_PTR, 0, SLJIT_IMM, 0);
}
if (framesize < 0)
@@ -6989,7 +7004,7 @@ cc += GET(cc, 1);
has_alternatives = *cc == OP_ALT;
if (SLJIT_UNLIKELY(opcode == OP_COND || opcode == OP_SCOND))
- has_alternatives = (*matchingpath == OP_RREF || *matchingpath == OP_DNRREF) ? FALSE : TRUE;
+ has_alternatives = (*matchingpath == OP_RREF || *matchingpath == OP_DNRREF || *matchingpath == OP_FAIL) ? FALSE : TRUE;
if (SLJIT_UNLIKELY(opcode == OP_COND) && (*cc == OP_KETRMAX || *cc == OP_KETRMIN))
opcode = OP_SCOND;
@@ -7050,13 +7065,13 @@ if (bra == OP_BRAMINZERO)
if (ket != OP_KETRMIN)
{
free_stack(common, 1);
- braminzero = CMP(SLJIT_C_EQUAL, STR_PTR, 0, SLJIT_IMM, 0);
+ braminzero = CMP(SLJIT_EQUAL, STR_PTR, 0, SLJIT_IMM, 0);
}
else
{
if (opcode == OP_ONCE || opcode >= OP_SBRA)
{
- jump = CMP(SLJIT_C_NOT_EQUAL, STR_PTR, 0, SLJIT_IMM, 0);
+ jump = CMP(SLJIT_NOT_EQUAL, STR_PTR, 0, SLJIT_IMM, 0);
OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(1));
/* Nothing stored during the first run. */
skip = JUMP(SLJIT_JUMP);
@@ -7065,19 +7080,19 @@ 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_SP), private_data_ptr);
+ braminzero = CMP(SLJIT_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_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));
+ braminzero = CMP(SLJIT_EQUAL, STR_PTR, 0, SLJIT_MEM1(TMP1), (BACKTRACK_AS(bracket_backtrack)->u.framesize + 1) * sizeof(sljit_sw));
}
JUMPHERE(skip);
}
else
{
- jump = CMP(SLJIT_C_NOT_EQUAL, STR_PTR, 0, SLJIT_IMM, 0);
+ jump = CMP(SLJIT_NOT_EQUAL, STR_PTR, 0, SLJIT_IMM, 0);
OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(1));
JUMPHERE(jump);
}
@@ -7223,7 +7238,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_SP), OVECTOR(GET2(matchingpath, 1) << 1), SLJIT_MEM1(SLJIT_SP), OVECTOR(1)));
+ CMP(SLJIT_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)
@@ -7244,15 +7259,17 @@ if (opcode == OP_COND || opcode == OP_SCOND)
slot += common->name_entry_size;
}
OP1(SLJIT_MOV, STR_PTR, 0, TMP3, 0);
- add_jump(compiler, &(BACKTRACK_AS(bracket_backtrack)->u.condfailed), JUMP(SLJIT_C_ZERO));
+ add_jump(compiler, &(BACKTRACK_AS(bracket_backtrack)->u.condfailed), JUMP(SLJIT_ZERO));
matchingpath += 1 + 2 * IMM2_SIZE;
}
- else if (*matchingpath == OP_RREF || *matchingpath == OP_DNRREF)
+ else if (*matchingpath == OP_RREF || *matchingpath == OP_DNRREF || *matchingpath == OP_FAIL)
{
/* Never has other case. */
BACKTRACK_AS(bracket_backtrack)->u.condfailed = NULL;
SLJIT_ASSERT(!has_alternatives);
+ if (*matchingpath == OP_FAIL)
+ stacksize = 0;
if (*matchingpath == OP_RREF)
{
stacksize = GET2(matchingpath, 1);
@@ -7387,7 +7404,7 @@ if (ket == OP_KETRMAX)
if (has_alternatives)
BACKTRACK_AS(bracket_backtrack)->alternative_matchingpath = LABEL();
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);
+ JUMPTO(SLJIT_NOT_ZERO, rmax_label);
/* Drop STR_PTR for greedy plus quantifier. */
if (opcode != OP_ONCE)
free_stack(common, 1);
@@ -7399,14 +7416,14 @@ if (ket == OP_KETRMAX)
/* Checking zero-length iteration. */
if (opcode != OP_ONCE)
{
- CMPTO(SLJIT_C_NOT_EQUAL, SLJIT_MEM1(SLJIT_SP), private_data_ptr, STR_PTR, 0, rmax_label);
+ CMPTO(SLJIT_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);
}
else
/* TMP2 must contain the starting STR_PTR. */
- CMPTO(SLJIT_C_NOT_EQUAL, TMP2, 0, STR_PTR, 0, rmax_label);
+ CMPTO(SLJIT_NOT_EQUAL, TMP2, 0, STR_PTR, 0, rmax_label);
}
else
JUMPTO(SLJIT_JUMP, rmax_label);
@@ -7417,7 +7434,7 @@ if (repeat_type == OP_EXACT)
{
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);
+ JUMPTO(SLJIT_NOT_ZERO, rmax_label);
}
else if (repeat_type == OP_UPTO)
{
@@ -7649,7 +7666,7 @@ while (*cc != OP_KETRPOS)
}
if (opcode == OP_SBRAPOS || opcode == OP_SCBRAPOS)
- add_jump(compiler, &emptymatch, CMP(SLJIT_C_EQUAL, TMP1, 0, STR_PTR, 0));
+ add_jump(compiler, &emptymatch, CMP(SLJIT_EQUAL, TMP1, 0, STR_PTR, 0));
if (!zero)
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(stacksize - 1), SLJIT_IMM, 0);
@@ -7676,7 +7693,7 @@ while (*cc != OP_KETRPOS)
}
if (opcode == OP_SBRAPOS || opcode == OP_SCBRAPOS)
- add_jump(compiler, &emptymatch, CMP(SLJIT_C_EQUAL, TMP1, 0, STR_PTR, 0));
+ add_jump(compiler, &emptymatch, CMP(SLJIT_EQUAL, TMP1, 0, STR_PTR, 0));
if (!zero)
{
@@ -7732,9 +7749,9 @@ backtrack->topbacktracks = NULL;
if (!zero)
{
if (framesize < 0)
- add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_C_NOT_EQUAL, SLJIT_MEM1(STACK_TOP), STACK(stacksize - 1), SLJIT_IMM, 0));
+ add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_NOT_EQUAL, SLJIT_MEM1(STACK_TOP), STACK(stacksize - 1), SLJIT_IMM, 0));
else /* TMP2 is set to [private_data_ptr] above. */
- add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_C_NOT_EQUAL, SLJIT_MEM1(TMP2), (stacksize - 1) * sizeof(sljit_sw), SLJIT_IMM, 0));
+ add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_NOT_EQUAL, SLJIT_MEM1(TMP2), (stacksize - 1) * sizeof(sljit_sw), SLJIT_IMM, 0));
}
/* None of them matched. */
@@ -7848,7 +7865,7 @@ backtrack_common *backtrack;
pcre_uchar opcode;
pcre_uchar type;
int max = -1, min = -1;
-pcre_uchar* end;
+pcre_uchar *end;
jump_list *nomatch = NULL;
struct sljit_jump *jump = NULL;
struct sljit_label *label;
@@ -7932,9 +7949,9 @@ switch(opcode)
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);
+ CMPTO(SLJIT_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);
+ jump = CMP(SLJIT_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, max);
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), POSSESSIVE0, TMP1, 0);
}
@@ -7971,11 +7988,11 @@ switch(opcode)
OP1(SLJIT_MOV, TMP1, 0, base, offset1);
OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
OP1(SLJIT_MOV, base, offset1, TMP1, 0);
- CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, max + 1, label);
+ CMPTO(SLJIT_LESS, TMP1, 0, SLJIT_IMM, max + 1, label);
}
set_jumps(nomatch, LABEL());
if (opcode == OP_CRRANGE)
- add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_C_LESS, base, offset1, SLJIT_IMM, min + 1));
+ add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_LESS, base, offset1, SLJIT_IMM, min + 1));
OP1(SLJIT_MOV, STR_PTR, 0, base, offset0);
}
BACKTRACK_AS(iterator_backtrack)->matchingpath = LABEL();
@@ -8017,7 +8034,7 @@ switch(opcode)
label = LABEL();
compile_char1_matchingpath(common, type, cc, &backtrack->topbacktracks);
OP2(SLJIT_SUB | SLJIT_SET_E, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
- JUMPTO(SLJIT_C_NOT_ZERO, label);
+ JUMPTO(SLJIT_NOT_ZERO, label);
break;
case OP_POSSTAR:
@@ -8036,7 +8053,7 @@ switch(opcode)
else
{
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);
+ JUMPTO(SLJIT_NOT_ZERO, label);
}
set_jumps(nomatch, LABEL());
OP1(SLJIT_MOV, STR_PTR, 0, tmp_base, tmp_offset);
@@ -8056,7 +8073,7 @@ switch(opcode)
label = LABEL();
compile_char1_matchingpath(common, type, cc, &backtrack->topbacktracks);
OP2(SLJIT_SUB | SLJIT_SET_E, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
- JUMPTO(SLJIT_C_NOT_ZERO, label);
+ JUMPTO(SLJIT_NOT_ZERO, label);
if (max != 0)
{
@@ -8072,7 +8089,7 @@ switch(opcode)
else
{
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);
+ JUMPTO(SLJIT_NOT_ZERO, label);
}
set_jumps(nomatch, LABEL());
OP1(SLJIT_MOV, STR_PTR, 0, tmp_base, tmp_offset);
@@ -8111,22 +8128,22 @@ 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_SP), OVECTOR(0)));
+ add_jump(compiler, &common->accept, CMP(SLJIT_NOT_EQUAL, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(0)));
else
- CMPTO(SLJIT_C_NOT_EQUAL, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(0), common->accept_label);
+ CMPTO(SLJIT_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));
+add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_NOT_EQUAL, TMP2, 0, SLJIT_IMM, 0));
OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, notempty_atstart));
if (common->accept_label == NULL)
- add_jump(compiler, &common->accept, CMP(SLJIT_C_EQUAL, TMP2, 0, SLJIT_IMM, 0));
+ add_jump(compiler, &common->accept, CMP(SLJIT_EQUAL, TMP2, 0, SLJIT_IMM, 0));
else
- CMPTO(SLJIT_C_EQUAL, TMP2, 0, SLJIT_IMM, 0, common->accept_label);
+ CMPTO(SLJIT_EQUAL, TMP2, 0, SLJIT_IMM, 0, common->accept_label);
OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, str));
if (common->accept_label == NULL)
- add_jump(compiler, &common->accept, CMP(SLJIT_C_NOT_EQUAL, TMP2, 0, STR_PTR, 0));
+ add_jump(compiler, &common->accept, CMP(SLJIT_NOT_EQUAL, TMP2, 0, STR_PTR, 0));
else
- CMPTO(SLJIT_C_NOT_EQUAL, TMP2, 0, STR_PTR, 0, common->accept_label);
+ CMPTO(SLJIT_NOT_EQUAL, TMP2, 0, STR_PTR, 0, common->accept_label);
add_jump(compiler, &backtrack->topbacktracks, JUMP(SLJIT_JUMP));
return cc + 1;
}
@@ -8566,7 +8583,7 @@ switch(opcode)
set_jumps(current->topbacktracks, LABEL());
OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(0));
free_stack(common, 1);
- CMPTO(SLJIT_C_NOT_EQUAL, STR_PTR, 0, SLJIT_IMM, 0, CURRENT_AS(iterator_backtrack)->matchingpath);
+ CMPTO(SLJIT_NOT_EQUAL, STR_PTR, 0, SLJIT_IMM, 0, CURRENT_AS(iterator_backtrack)->matchingpath);
}
else
{
@@ -8575,13 +8592,13 @@ switch(opcode)
if (opcode <= OP_PLUS)
{
OP1(SLJIT_MOV, STR_PTR, 0, base, offset0);
- jump = CMP(SLJIT_C_LESS_EQUAL, STR_PTR, 0, base, offset1);
+ jump = CMP(SLJIT_LESS_EQUAL, STR_PTR, 0, base, offset1);
}
else
{
OP1(SLJIT_MOV, TMP1, 0, base, offset1);
OP1(SLJIT_MOV, STR_PTR, 0, base, offset0);
- jump = CMP(SLJIT_C_LESS_EQUAL, TMP1, 0, SLJIT_IMM, min + 1);
+ jump = CMP(SLJIT_LESS_EQUAL, TMP1, 0, SLJIT_IMM, min + 1);
OP2(SLJIT_SUB, base, offset1, TMP1, 0, SLJIT_IMM, 1);
}
skip_char_back(common);
@@ -8626,12 +8643,12 @@ switch(opcode)
OP1(SLJIT_MOV, base, offset1, TMP1, 0);
if (opcode == OP_CRMINRANGE)
- CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, min + 1, label);
+ CMPTO(SLJIT_LESS, TMP1, 0, SLJIT_IMM, min + 1, label);
if (opcode == OP_CRMINRANGE && max == 0)
JUMPTO(SLJIT_JUMP, CURRENT_AS(iterator_backtrack)->matchingpath);
else
- CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, max + 2, CURRENT_AS(iterator_backtrack)->matchingpath);
+ CMPTO(SLJIT_LESS, TMP1, 0, SLJIT_IMM, max + 2, CURRENT_AS(iterator_backtrack)->matchingpath);
set_jumps(jumplist, LABEL());
if (private_data_ptr == 0)
@@ -8641,7 +8658,7 @@ switch(opcode)
case OP_QUERY:
OP1(SLJIT_MOV, STR_PTR, 0, base, offset0);
OP1(SLJIT_MOV, base, offset0, SLJIT_IMM, 0);
- CMPTO(SLJIT_C_NOT_EQUAL, STR_PTR, 0, SLJIT_IMM, 0, CURRENT_AS(iterator_backtrack)->matchingpath);
+ CMPTO(SLJIT_NOT_EQUAL, STR_PTR, 0, SLJIT_IMM, 0, CURRENT_AS(iterator_backtrack)->matchingpath);
jump = JUMP(SLJIT_JUMP);
set_jumps(current->topbacktracks, LABEL());
OP1(SLJIT_MOV, STR_PTR, 0, base, offset0);
@@ -8655,7 +8672,7 @@ switch(opcode)
case OP_MINQUERY:
OP1(SLJIT_MOV, STR_PTR, 0, base, offset0);
OP1(SLJIT_MOV, base, offset0, SLJIT_IMM, 0);
- jump = CMP(SLJIT_C_EQUAL, STR_PTR, 0, SLJIT_IMM, 0);
+ jump = CMP(SLJIT_EQUAL, STR_PTR, 0, SLJIT_IMM, 0);
compile_char1_matchingpath(common, type, cc, &jumplist);
JUMPTO(SLJIT_JUMP, CURRENT_AS(iterator_backtrack)->matchingpath);
set_jumps(jumplist, LABEL());
@@ -8696,12 +8713,12 @@ if ((type & 0x1) == 0)
set_jumps(current->topbacktracks, LABEL());
OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(0));
free_stack(common, 1);
- CMPTO(SLJIT_C_NOT_EQUAL, STR_PTR, 0, SLJIT_IMM, 0, CURRENT_AS(iterator_backtrack)->matchingpath);
+ CMPTO(SLJIT_NOT_EQUAL, STR_PTR, 0, SLJIT_IMM, 0, CURRENT_AS(iterator_backtrack)->matchingpath);
return;
}
OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(0));
-CMPTO(SLJIT_C_NOT_EQUAL, STR_PTR, 0, SLJIT_IMM, 0, CURRENT_AS(iterator_backtrack)->matchingpath);
+CMPTO(SLJIT_NOT_EQUAL, STR_PTR, 0, SLJIT_IMM, 0, CURRENT_AS(iterator_backtrack)->matchingpath);
set_jumps(current->topbacktracks, LABEL());
free_stack(common, ref ? 2 : 3);
}
@@ -8759,7 +8776,7 @@ if (CURRENT_AS(assert_backtrack)->framesize < 0)
if (bra == OP_BRAZERO)
{
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), SLJIT_IMM, 0);
- CMPTO(SLJIT_C_NOT_EQUAL, STR_PTR, 0, SLJIT_IMM, 0, CURRENT_AS(assert_backtrack)->matchingpath);
+ CMPTO(SLJIT_NOT_EQUAL, STR_PTR, 0, SLJIT_IMM, 0, CURRENT_AS(assert_backtrack)->matchingpath);
free_stack(common, 1);
}
return;
@@ -8770,12 +8787,12 @@ if (bra == OP_BRAZERO)
if (*cc == OP_ASSERT_NOT || *cc == OP_ASSERTBACK_NOT)
{
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), SLJIT_IMM, 0);
- CMPTO(SLJIT_C_NOT_EQUAL, STR_PTR, 0, SLJIT_IMM, 0, CURRENT_AS(assert_backtrack)->matchingpath);
+ CMPTO(SLJIT_NOT_EQUAL, STR_PTR, 0, SLJIT_IMM, 0, CURRENT_AS(assert_backtrack)->matchingpath);
free_stack(common, 1);
return;
}
free_stack(common, 1);
- brajump = CMP(SLJIT_C_EQUAL, STR_PTR, 0, SLJIT_IMM, 0);
+ brajump = CMP(SLJIT_EQUAL, STR_PTR, 0, SLJIT_IMM, 0);
}
if (*cc == OP_ASSERT || *cc == OP_ASSERTBACK)
@@ -8881,7 +8898,7 @@ if (ket == OP_KETRMAX)
{
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(0));
free_stack(common, 1);
- brazero = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, 0);
+ brazero = CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, 0);
}
}
else if (ket == OP_KETRMIN)
@@ -8892,7 +8909,7 @@ else if (ket == OP_KETRMIN)
if (repeat_type != 0)
{
/* TMP1 was set a few lines above. */
- CMPTO(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, 0, CURRENT_AS(bracket_backtrack)->recursive_matchingpath);
+ CMPTO(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, 0, CURRENT_AS(bracket_backtrack)->recursive_matchingpath);
/* Drop STR_PTR for non-greedy plus quantifier. */
if (opcode != OP_ONCE)
free_stack(common, 1);
@@ -8901,11 +8918,11 @@ 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_SP), private_data_ptr, CURRENT_AS(bracket_backtrack)->recursive_matchingpath);
+ CMPTO(SLJIT_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_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);
+ CMPTO(SLJIT_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. */
if (opcode != OP_ONCE)
@@ -8922,7 +8939,7 @@ else if (bra == OP_BRAZERO)
{
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(0));
free_stack(common, 1);
- brazero = CMP(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, 0);
+ brazero = CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, 0);
}
else if (repeat_type == OP_EXACT)
{
@@ -8971,7 +8988,7 @@ else if (SLJIT_UNLIKELY(opcode == OP_COND) || SLJIT_UNLIKELY(opcode == OP_SCOND)
free_stack(common, 1);
alt_max = 2;
- alt1 = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, sizeof(sljit_uw));
+ alt1 = CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, sizeof(sljit_uw));
}
}
else if (has_alternatives)
@@ -8982,16 +8999,17 @@ else if (has_alternatives)
if (alt_max > 4)
{
/* Table jump if alt_max is greater than 4. */
- next_update_addr = common->read_only_data_ptr;
- common->read_only_data_ptr += alt_max;
+ next_update_addr = allocate_read_only_data(common, alt_max * sizeof(sljit_uw));
+ if (SLJIT_UNLIKELY(next_update_addr == NULL))
+ return;
sljit_emit_ijump(compiler, SLJIT_JUMP, SLJIT_MEM1(TMP1), (sljit_sw)next_update_addr);
add_label_addr(common, next_update_addr++);
}
else
{
if (alt_max == 4)
- alt2 = CMP(SLJIT_C_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, 2 * sizeof(sljit_uw));
- alt1 = CMP(SLJIT_C_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, sizeof(sljit_uw));
+ alt2 = CMP(SLJIT_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, 2 * sizeof(sljit_uw));
+ alt1 = CMP(SLJIT_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, sizeof(sljit_uw));
}
}
@@ -9124,13 +9142,13 @@ if (has_alternatives)
{
JUMPHERE(alt1);
if (alt_max == 3 && alt_count == sizeof(sljit_uw))
- alt2 = CMP(SLJIT_C_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, 2 * sizeof(sljit_uw));
+ alt2 = CMP(SLJIT_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, 2 * sizeof(sljit_uw));
}
else
{
JUMPHERE(alt2);
if (alt_max == 4)
- alt1 = CMP(SLJIT_C_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, 3 * sizeof(sljit_uw));
+ alt1 = CMP(SLJIT_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, 3 * sizeof(sljit_uw));
}
}
alt_count += sizeof(sljit_uw);
@@ -9218,7 +9236,7 @@ if (repeat_type == OP_EXACT)
{
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);
+ CMPTO(SLJIT_LESS_EQUAL, TMP1, 0, SLJIT_IMM, repeat_count, exact_label);
}
else if (ket == OP_KETRMAX)
{
@@ -9226,7 +9244,7 @@ else if (ket == OP_KETRMAX)
if (bra != OP_BRAZERO)
free_stack(common, 1);
- CMPTO(SLJIT_C_NOT_EQUAL, STR_PTR, 0, SLJIT_IMM, 0, CURRENT_AS(bracket_backtrack)->recursive_matchingpath);
+ CMPTO(SLJIT_NOT_EQUAL, STR_PTR, 0, SLJIT_IMM, 0, CURRENT_AS(bracket_backtrack)->recursive_matchingpath);
if (bra == OP_BRAZERO)
{
OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(1));
@@ -9244,7 +9262,7 @@ else if (ket == OP_KETRMIN)
affect badly the free_stack(2) above. */
if (opcode != OP_ONCE)
free_stack(common, 1);
- CMPTO(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, 0, rmin_label);
+ CMPTO(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, 0, rmin_label);
if (opcode == OP_ONCE)
free_stack(common, bra == OP_BRAMINZERO ? 2 : 1);
else if (bra == OP_BRAMINZERO)
@@ -9342,8 +9360,8 @@ if (opcode == OP_THEN || opcode == OP_THEN_ARG)
loop = LABEL();
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(STACK_TOP), -(int)sizeof(sljit_sw));
JUMPHERE(jump);
- CMPTO(SLJIT_C_NOT_EQUAL, SLJIT_MEM1(STACK_TOP), -(int)(2 * sizeof(sljit_sw)), TMP1, 0, loop);
- CMPTO(SLJIT_C_NOT_EQUAL, SLJIT_MEM1(STACK_TOP), -(int)(3 * sizeof(sljit_sw)), TMP2, 0, loop);
+ CMPTO(SLJIT_NOT_EQUAL, SLJIT_MEM1(STACK_TOP), -(int)(2 * sizeof(sljit_sw)), TMP1, 0, loop);
+ CMPTO(SLJIT_NOT_EQUAL, SLJIT_MEM1(STACK_TOP), -(int)(3 * sizeof(sljit_sw)), TMP2, 0, loop);
add_jump(compiler, &common->then_trap->quit, JUMP(SLJIT_JUMP));
return;
}
@@ -9373,7 +9391,7 @@ if (opcode == OP_SKIP_ARG)
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));
+ add_jump(compiler, &common->reset_match, CMP(SLJIT_NOT_EQUAL, STR_PTR, 0, SLJIT_IMM, -1));
return;
}
@@ -9766,9 +9784,7 @@ memset(common, 0, sizeof(compiler_common));
rootbacktrack.cc = (pcre_uchar *)re + re->name_table_offset + re->name_count * re->name_entry_size;
common->start = rootbacktrack.cc;
-common->read_only_data = NULL;
-common->read_only_data_size = 0;
-common->read_only_data_ptr = NULL;
+common->read_only_data_head = NULL;
common->fcc = tables + fcc_offset;
common->lcc = (sljit_sw)(tables + lcc_offset);
common->mode = mode;
@@ -9849,7 +9865,7 @@ ccend = bracketend(common->start);
/* Calculate the local space size on the stack. */
common->ovector_start = LIMIT_MATCH + sizeof(sljit_sw);
-common->optimized_cbracket = (pcre_uint8 *)SLJIT_MALLOC(re->top_bracket + 1);
+common->optimized_cbracket = (pcre_uint8 *)SLJIT_MALLOC(re->top_bracket + 1, compiler->allocator_data);
if (!common->optimized_cbracket)
return;
#if defined DEBUG_FORCE_UNOPTIMIZED_CBRAS && DEBUG_FORCE_UNOPTIMIZED_CBRAS == 1
@@ -9865,7 +9881,7 @@ common->ovector_start += sizeof(sljit_sw);
#endif
if (!check_opcode_types(common, common->start, ccend))
{
- SLJIT_FREE(common->optimized_cbracket);
+ SLJIT_FREE(common->optimized_cbracket, compiler->allocator_data);
return;
}
@@ -9927,10 +9943,10 @@ SLJIT_ASSERT(!(common->req_char_ptr != 0 && common->start_used_ptr != 0));
common->cbra_ptr = OVECTOR_START + (re->top_bracket + 1) * 2 * sizeof(sljit_sw);
total_length = ccend - common->start;
-common->private_data_ptrs = (sljit_si *)SLJIT_MALLOC(total_length * (sizeof(sljit_si) + (common->has_then ? 1 : 0)));
+common->private_data_ptrs = (sljit_si *)SLJIT_MALLOC(total_length * (sizeof(sljit_si) + (common->has_then ? 1 : 0)), compiler->allocator_data);
if (!common->private_data_ptrs)
{
- SLJIT_FREE(common->optimized_cbracket);
+ SLJIT_FREE(common->optimized_cbracket, compiler->allocator_data);
return;
}
memset(common->private_data_ptrs, 0, total_length * sizeof(sljit_si));
@@ -9939,8 +9955,8 @@ private_data_size = common->cbra_ptr + (re->top_bracket + 1) * sizeof(sljit_sw);
set_private_data_ptrs(common, &private_data_size, ccend);
if (private_data_size > SLJIT_MAX_LOCAL_SIZE)
{
- SLJIT_FREE(common->private_data_ptrs);
- SLJIT_FREE(common->optimized_cbracket);
+ SLJIT_FREE(common->private_data_ptrs, compiler->allocator_data);
+ SLJIT_FREE(common->optimized_cbracket, compiler->allocator_data);
return;
}
@@ -9951,25 +9967,11 @@ if (common->has_then)
set_then_offsets(common, common->start, NULL);
}
-if (common->read_only_data_size > 0)
- {
- common->read_only_data = (sljit_uw *)SLJIT_MALLOC(common->read_only_data_size);
- if (common->read_only_data == NULL)
- {
- SLJIT_FREE(common->optimized_cbracket);
- SLJIT_FREE(common->private_data_ptrs);
- return;
- }
- common->read_only_data_ptr = common->read_only_data;
- }
-
-compiler = sljit_create_compiler();
+compiler = sljit_create_compiler(NULL);
if (!compiler)
{
- SLJIT_FREE(common->optimized_cbracket);
- SLJIT_FREE(common->private_data_ptrs);
- if (common->read_only_data)
- SLJIT_FREE(common->read_only_data);
+ SLJIT_FREE(common->optimized_cbracket, compiler->allocator_data);
+ SLJIT_FREE(common->private_data_ptrs, compiler->allocator_data);
return;
}
common->compiler = compiler;
@@ -10008,21 +10010,12 @@ if ((re->options & PCRE_ANCHORED) == 0)
if ((re->options & PCRE_NO_START_OPTIMIZE) == 0)
{
if (mode == JIT_COMPILE && fast_forward_first_n_chars(common, (re->options & PCRE_FIRSTLINE) != 0))
- {
- /* If read_only_data is reallocated, we might have an allocation failure. */
- if (common->read_only_data_size > 0 && common->read_only_data == NULL)
- {
- sljit_free_compiler(compiler);
- SLJIT_FREE(common->optimized_cbracket);
- SLJIT_FREE(common->private_data_ptrs);
- return;
- }
- }
+ ;
else if ((re->flags & PCRE_FIRSTSET) != 0)
fast_forward_first_char(common, (pcre_uchar)re->first_char, (re->flags & PCRE_FCH_CASELESS) != 0, (re->options & PCRE_FIRSTLINE) != 0);
else if ((re->flags & PCRE_STARTLINE) != 0)
fast_forward_newline(common, (re->options & PCRE_FIRSTLINE) != 0);
- else if ((re->flags & PCRE_STARTLINE) == 0 && study != NULL && (study->flags & PCRE_STUDY_MAPPED) != 0)
+ else if (study != NULL && (study->flags & PCRE_STUDY_MAPPED) != 0)
fast_forward_start_bits(common, study->start_bits, (re->options & PCRE_FIRSTLINE) != 0);
}
}
@@ -10033,7 +10026,7 @@ if (mode == JIT_COMPILE && study->minlength > 0 && (re->options & PCRE_NO_START_
{
OP1(SLJIT_MOV, SLJIT_RETURN_REG, 0, SLJIT_IMM, PCRE_ERROR_NOMATCH);
OP2(SLJIT_ADD, TMP2, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(study->minlength));
- minlength_check_failed = CMP(SLJIT_C_GREATER, TMP2, 0, STR_END, 0);
+ minlength_check_failed = CMP(SLJIT_GREATER, TMP2, 0, STR_END, 0);
}
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);
@@ -10056,7 +10049,7 @@ else
/* Copy the beginning of the string. */
if (mode == JIT_PARTIAL_SOFT_COMPILE)
{
- jump = CMP(SLJIT_C_NOT_EQUAL, SLJIT_MEM1(SLJIT_SP), common->hit_start, SLJIT_IMM, -1);
+ jump = CMP(SLJIT_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);
@@ -10068,16 +10061,15 @@ compile_matchingpath(common, common->start, ccend, &rootbacktrack);
if (SLJIT_UNLIKELY(sljit_get_compiler_error(compiler)))
{
sljit_free_compiler(compiler);
- SLJIT_FREE(common->optimized_cbracket);
- SLJIT_FREE(common->private_data_ptrs);
- if (common->read_only_data)
- SLJIT_FREE(common->read_only_data);
+ SLJIT_FREE(common->optimized_cbracket, compiler->allocator_data);
+ SLJIT_FREE(common->private_data_ptrs, compiler->allocator_data);
+ free_read_only_data(common->read_only_data_head, compiler->allocator_data);
return;
}
if (common->might_be_empty)
{
- empty_match = CMP(SLJIT_C_EQUAL, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(0));
+ empty_match = CMP(SLJIT_EQUAL, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(0));
empty_match_found_label = LABEL();
}
@@ -10109,10 +10101,9 @@ compile_backtrackingpath(common, rootbacktrack.top);
if (SLJIT_UNLIKELY(sljit_get_compiler_error(compiler)))
{
sljit_free_compiler(compiler);
- SLJIT_FREE(common->optimized_cbracket);
- SLJIT_FREE(common->private_data_ptrs);
- if (common->read_only_data)
- SLJIT_FREE(common->read_only_data);
+ SLJIT_FREE(common->optimized_cbracket, compiler->allocator_data);
+ SLJIT_FREE(common->private_data_ptrs, compiler->allocator_data);
+ free_read_only_data(common->read_only_data_head, compiler->allocator_data);
return;
}
@@ -10122,7 +10113,7 @@ 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_SP), common->hit_start, SLJIT_IMM, 0);
+ jump = CMP(SLJIT_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);
@@ -10143,15 +10134,15 @@ if ((re->options & PCRE_ANCHORED) == 0)
if (common->ff_newline_shortcut != NULL)
{
if ((re->options & PCRE_FIRSTLINE) == 0)
- CMPTO(SLJIT_C_LESS, STR_PTR, 0, STR_END, 0, common->ff_newline_shortcut);
+ CMPTO(SLJIT_LESS, STR_PTR, 0, STR_END, 0, common->ff_newline_shortcut);
/* There cannot be more newlines here. */
}
else
{
if ((re->options & PCRE_FIRSTLINE) == 0)
- CMPTO(SLJIT_C_LESS, STR_PTR, 0, STR_END, 0, mainloop_label);
+ CMPTO(SLJIT_LESS, STR_PTR, 0, STR_END, 0, mainloop_label);
else
- CMPTO(SLJIT_C_LESS, STR_PTR, 0, TMP1, 0, mainloop_label);
+ CMPTO(SLJIT_LESS, STR_PTR, 0, TMP1, 0, mainloop_label);
}
}
@@ -10160,7 +10151,7 @@ if (reqbyte_notfound != NULL)
JUMPHERE(reqbyte_notfound);
if (mode == JIT_PARTIAL_SOFT_COMPILE)
- CMPTO(SLJIT_C_NOT_EQUAL, SLJIT_MEM1(SLJIT_SP), common->hit_start, SLJIT_IMM, -1, common->partialmatchlabel);
+ CMPTO(SLJIT_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);
@@ -10172,11 +10163,11 @@ if (common->might_be_empty)
JUMPHERE(empty_match);
OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, notempty));
- CMPTO(SLJIT_C_NOT_EQUAL, TMP2, 0, SLJIT_IMM, 0, empty_match_backtrack_label);
+ CMPTO(SLJIT_NOT_EQUAL, TMP2, 0, SLJIT_IMM, 0, empty_match_backtrack_label);
OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, notempty_atstart));
- CMPTO(SLJIT_C_EQUAL, TMP2, 0, SLJIT_IMM, 0, empty_match_found_label);
+ CMPTO(SLJIT_EQUAL, TMP2, 0, SLJIT_IMM, 0, empty_match_found_label);
OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, str));
- CMPTO(SLJIT_C_NOT_EQUAL, TMP2, 0, STR_PTR, 0, empty_match_found_label);
+ CMPTO(SLJIT_NOT_EQUAL, TMP2, 0, STR_PTR, 0, empty_match_found_label);
JUMPTO(SLJIT_JUMP, empty_match_backtrack_label);
}
@@ -10190,10 +10181,9 @@ while (common->currententry != NULL)
if (SLJIT_UNLIKELY(sljit_get_compiler_error(compiler)))
{
sljit_free_compiler(compiler);
- SLJIT_FREE(common->optimized_cbracket);
- SLJIT_FREE(common->private_data_ptrs);
- if (common->read_only_data)
- SLJIT_FREE(common->read_only_data);
+ SLJIT_FREE(common->optimized_cbracket, compiler->allocator_data);
+ SLJIT_FREE(common->private_data_ptrs, compiler->allocator_data);
+ free_read_only_data(common->read_only_data_head, compiler->allocator_data);
return;
}
flush_stubs(common);
@@ -10214,7 +10204,7 @@ OP1(SLJIT_MOV, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(struct sljit_stack, top), STACK_
OP2(SLJIT_ADD, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(struct sljit_stack, limit), SLJIT_IMM, STACK_GROWTH_RATE);
sljit_emit_ijump(compiler, SLJIT_CALL2, SLJIT_IMM, SLJIT_FUNC_OFFSET(sljit_stack_resize));
-jump = CMP(SLJIT_C_NOT_EQUAL, SLJIT_RETURN_REG, 0, SLJIT_IMM, 0);
+jump = CMP(SLJIT_NOT_EQUAL, SLJIT_RETURN_REG, 0, SLJIT_IMM, 0);
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));
@@ -10272,7 +10262,7 @@ if (common->reset_match != NULL)
{
set_jumps(common->reset_match, LABEL());
do_reset_match(common, (re->top_bracket + 1) * 2);
- CMPTO(SLJIT_C_GREATER, STR_PTR, 0, TMP1, 0, continue_match_label);
+ CMPTO(SLJIT_GREATER, STR_PTR, 0, TMP1, 0, continue_match_label);
OP1(SLJIT_MOV, STR_PTR, 0, TMP1, 0);
JUMPTO(SLJIT_JUMP, reset_match_label);
}
@@ -10303,9 +10293,8 @@ if (common->getucd != NULL)
}
#endif
-SLJIT_ASSERT(common->read_only_data + (common->read_only_data_size >> SLJIT_WORD_SHIFT) == common->read_only_data_ptr);
-SLJIT_FREE(common->optimized_cbracket);
-SLJIT_FREE(common->private_data_ptrs);
+SLJIT_FREE(common->optimized_cbracket, compiler->allocator_data);
+SLJIT_FREE(common->private_data_ptrs, compiler->allocator_data);
executable_func = sljit_generate_code(compiler);
executable_size = sljit_get_generated_code_size(compiler);
@@ -10318,8 +10307,7 @@ while (label_addr != NULL)
sljit_free_compiler(compiler);
if (executable_func == NULL)
{
- if (common->read_only_data)
- SLJIT_FREE(common->read_only_data);
+ free_read_only_data(common->read_only_data_head, compiler->allocator_data);
return;
}
@@ -10337,14 +10325,13 @@ else
* bit remains set, as the bit indicates that the pointer to the data
* is valid.)
*/
- functions = SLJIT_MALLOC(sizeof(executable_functions));
+ functions = SLJIT_MALLOC(sizeof(executable_functions), compiler->allocator_data);
if (functions == NULL)
{
/* This case is highly unlikely since we just recently
freed a lot of memory. Not impossible though. */
sljit_free_code(executable_func);
- if (common->read_only_data)
- SLJIT_FREE(common->read_only_data);
+ free_read_only_data(common->read_only_data_head, compiler->allocator_data);
return;
}
memset(functions, 0, sizeof(executable_functions));
@@ -10355,14 +10342,14 @@ else
}
functions->executable_funcs[mode] = executable_func;
-functions->read_only_data[mode] = common->read_only_data;
+functions->read_only_data_heads[mode] = common->read_only_data_head;
functions->executable_sizes[mode] = executable_size;
}
-static int jit_machine_stack_exec(jit_arguments *arguments, void* executable_func)
+static SLJIT_NOINLINE int jit_machine_stack_exec(jit_arguments *arguments, void *executable_func)
{
union {
- void* executable_func;
+ void *executable_func;
jit_function call_executable_func;
} convert_executable_func;
pcre_uint8 local_space[MACHINE_STACK_SIZE];
@@ -10383,7 +10370,7 @@ PRIV(jit_exec)(const PUBL(extra) *extra_data, const pcre_uchar *subject,
{
executable_functions *functions = (executable_functions *)extra_data->executable_jit;
union {
- void* executable_func;
+ void *executable_func;
jit_function call_executable_func;
} convert_executable_func;
jit_arguments arguments;
@@ -10470,7 +10457,7 @@ pcre32_jit_exec(const pcre32 *argument_re, const pcre32_extra *extra_data,
pcre_uchar *subject_ptr = (pcre_uchar *)subject;
executable_functions *functions = (executable_functions *)extra_data->executable_jit;
union {
- void* executable_func;
+ void *executable_func;
jit_function call_executable_func;
} convert_executable_func;
jit_arguments arguments;
@@ -10542,10 +10529,9 @@ for (i = 0; i < JIT_NUMBER_OF_COMPILE_MODES; i++)
{
if (functions->executable_funcs[i] != NULL)
sljit_free_code(functions->executable_funcs[i]);
- if (functions->read_only_data[i] != NULL)
- SLJIT_FREE(functions->read_only_data[i]);
+ free_read_only_data(functions->read_only_data_heads[i], NULL);
}
-SLJIT_FREE(functions);
+SLJIT_FREE(functions, compiler->allocator_data);
}
int
@@ -10582,7 +10568,7 @@ if (startsize > maxsize)
startsize = maxsize;
startsize = (startsize + STACK_GROWTH_RATE - 1) & ~(STACK_GROWTH_RATE - 1);
maxsize = (maxsize + STACK_GROWTH_RATE - 1) & ~(STACK_GROWTH_RATE - 1);
-return (PUBL(jit_stack)*)sljit_allocate_stack(startsize, maxsize);
+return (PUBL(jit_stack)*)sljit_allocate_stack(startsize, maxsize, NULL);
}
#if defined COMPILE_PCRE8
@@ -10596,7 +10582,7 @@ PCRE_EXP_DECL void
pcre32_jit_stack_free(pcre32_jit_stack *stack)
#endif
{
-sljit_free_stack((struct sljit_stack *)stack);
+sljit_free_stack((struct sljit_stack *)stack, NULL);
}
#if defined COMPILE_PCRE8
diff --git a/pcre/pcre_jit_test.c b/pcre/pcre_jit_test.c
index a40913ef0a5..d03993be24f 100644
--- a/pcre/pcre_jit_test.c
+++ b/pcre/pcre_jit_test.c
@@ -51,8 +51,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include "pcre_internal.h"
-#define PCRE_BUG 0x80000000
-
/*
Letter characters:
\xe6\x92\xad = 0x64ad = 25773 (kanji)
@@ -69,6 +67,9 @@ POSSIBILITY OF SUCH DAMAGE.
\xc3\x89 = 0xc9 = 201 (E')
\xc3\xa1 = 0xe1 = 225 (a')
\xc3\x81 = 0xc1 = 193 (A')
+ \x53 = 0x53 = S
+ \x73 = 0x73 = s
+ \xc5\xbf = 0x17f = 383 (long S)
\xc8\xba = 0x23a = 570
\xe2\xb1\xa5 = 0x2c65 = 11365
\xe1\xbd\xb8 = 0x1f78 = 8056
@@ -78,6 +79,10 @@ POSSIBILITY OF SUCH DAMAGE.
\xc7\x84 = 0x1c4 = 452
\xc7\x85 = 0x1c5 = 453
\xc7\x86 = 0x1c6 = 454
+ Caseless sets:
+ ucp_Armenian - \x{531}-\x{556} -> \x{561}-\x{586}
+ ucp_Coptic - \x{2c80}-\x{2ce3} -> caseless: XOR 0x1
+ ucp_Latin - \x{ff21}-\x{ff3a} -> \x{ff41]-\x{ff5a}
Mark property:
\xcc\x8d = 0x30d = 781
@@ -626,6 +631,9 @@ static struct regression_test_case regression_test_cases[] = {
{ MUA, 0, "(?P<Name>a)?(?P<Name2>b)?(?(Name)c|d)+?dd", "bcabcacdb bdddd" },
{ MUA, 0, "(?P<Name>a)?(?P<Name2>b)?(?(Name)c|d)+l", "ababccddabdbccd abcccl" },
{ MUA, 0, "((?:a|aa)(?(1)aaa))x", "aax" },
+ { MUA, 0, "(?(?!)a|b)", "ab" },
+ { MUA, 0, "(?(?!)a)", "ab" },
+ { MUA, 0 | F_NOMATCH, "(?(?!)a|b)", "ac" },
/* Set start of match. */
{ MUA, 0, "(?:\\Ka)*aaaab", "aaaaaaaa aaaaaaabb" },
@@ -944,7 +952,7 @@ static void setstack16(pcre16_extra *extra)
pcre16_assign_jit_stack(extra, callback16, getstack16());
}
-#endif /* SUPPORT_PCRE8 */
+#endif /* SUPPORT_PCRE16 */
#ifdef SUPPORT_PCRE32
static pcre32_jit_stack *stack32;
@@ -967,7 +975,7 @@ static void setstack32(pcre32_extra *extra)
pcre32_assign_jit_stack(extra, callback32, getstack32());
}
-#endif /* SUPPORT_PCRE8 */
+#endif /* SUPPORT_PCRE32 */
#ifdef SUPPORT_PCRE16
@@ -1177,7 +1185,7 @@ static int regression_tests(void)
#elif defined SUPPORT_PCRE16
pcre16_config(PCRE_CONFIG_UTF16, &utf);
pcre16_config(PCRE_CONFIG_UNICODE_PROPERTIES, &ucp);
-#elif defined SUPPORT_PCRE16
+#elif defined SUPPORT_PCRE32
pcre32_config(PCRE_CONFIG_UTF32, &utf);
pcre32_config(PCRE_CONFIG_UNICODE_PROPERTIES, &ucp);
#endif
diff --git a/pcre/pcre_study.c b/pcre/pcre_study.c
index f19d9fbb902..998fe2325ef 100644
--- a/pcre/pcre_study.c
+++ b/pcre/pcre_study.c
@@ -70,7 +70,7 @@ Arguments:
code pointer to start of group (the bracket)
startcode pointer to start of the whole pattern's code
options the compiling options
- int RECURSE depth
+ recurses chain of recurse_check to catch mutual recursion
Returns: the minimum length
-1 if \C in UTF-8 mode or (*ACCEPT) was encountered
@@ -80,12 +80,13 @@ Returns: the minimum length
static int
find_minlength(const REAL_PCRE *re, const pcre_uchar *code,
- const pcre_uchar *startcode, int options, int recurse_depth)
+ const pcre_uchar *startcode, int options, recurse_check *recurses)
{
int length = -1;
/* PCRE_UTF16 has the same value as PCRE_UTF8. */
BOOL utf = (options & PCRE_UTF8) != 0;
BOOL had_recurse = FALSE;
+recurse_check this_recurse;
register int branchlength = 0;
register pcre_uchar *cc = (pcre_uchar *)code + 1 + LINK_SIZE;
@@ -130,7 +131,7 @@ for (;;)
case OP_SBRAPOS:
case OP_ONCE:
case OP_ONCE_NC:
- d = find_minlength(re, cc, startcode, options, recurse_depth);
+ d = find_minlength(re, cc, startcode, options, recurses);
if (d < 0) return d;
branchlength += d;
do cc += GET(cc, 1); while (*cc == OP_ALT);
@@ -393,7 +394,7 @@ for (;;)
ce = cs = (pcre_uchar *)PRIV(find_bracket)(startcode, utf, GET2(slot, 0));
if (cs == NULL) return -2;
do ce += GET(ce, 1); while (*ce == OP_ALT);
- if (cc > cs && cc < ce)
+ if (cc > cs && cc < ce) /* Simple recursion */
{
d = 0;
had_recurse = TRUE;
@@ -401,8 +402,22 @@ for (;;)
}
else
{
- int dd = find_minlength(re, cs, startcode, options, recurse_depth);
- if (dd < d) d = dd;
+ recurse_check *r = recurses;
+ for (r = recurses; r != NULL; r = r->prev) if (r->group == cs) break;
+ if (r != NULL) /* Mutual recursion */
+ {
+ d = 0;
+ had_recurse = TRUE;
+ break;
+ }
+ else
+ {
+ int dd;
+ this_recurse.prev = recurses;
+ this_recurse.group = cs;
+ dd = find_minlength(re, cs, startcode, options, &this_recurse);
+ if (dd < d) d = dd;
+ }
}
slot += re->name_entry_size;
}
@@ -418,14 +433,26 @@ for (;;)
ce = cs = (pcre_uchar *)PRIV(find_bracket)(startcode, utf, GET2(cc, 1));
if (cs == NULL) return -2;
do ce += GET(ce, 1); while (*ce == OP_ALT);
- if (cc > cs && cc < ce)
+ if (cc > cs && cc < ce) /* Simple recursion */
{
d = 0;
had_recurse = TRUE;
}
else
{
- d = find_minlength(re, cs, startcode, options, recurse_depth);
+ recurse_check *r = recurses;
+ for (r = recurses; r != NULL; r = r->prev) if (r->group == cs) break;
+ if (r != NULL) /* Mutual recursion */
+ {
+ d = 0;
+ had_recurse = TRUE;
+ }
+ else
+ {
+ this_recurse.prev = recurses;
+ this_recurse.group = cs;
+ d = find_minlength(re, cs, startcode, options, &this_recurse);
+ }
}
}
else d = 0;
@@ -474,12 +501,21 @@ for (;;)
case OP_RECURSE:
cs = ce = (pcre_uchar *)startcode + GET(cc, 1);
do ce += GET(ce, 1); while (*ce == OP_ALT);
- if ((cc > cs && cc < ce) || recurse_depth > 10)
+ if (cc > cs && cc < ce) /* Simple recursion */
had_recurse = TRUE;
else
{
- branchlength += find_minlength(re, cs, startcode, options,
- recurse_depth + 1);
+ recurse_check *r = recurses;
+ for (r = recurses; r != NULL; r = r->prev) if (r->group == cs) break;
+ if (r != NULL) /* Mutual recursion */
+ had_recurse = TRUE;
+ else
+ {
+ this_recurse.prev = recurses;
+ this_recurse.group = cs;
+ branchlength += find_minlength(re, cs, startcode, options,
+ &this_recurse);
+ }
}
cc += 1 + LINK_SIZE;
break;
@@ -1503,7 +1539,7 @@ if ((re->options & PCRE_ANCHORED) == 0 &&
/* Find the minimum length of subject string. */
-switch(min = find_minlength(re, code, code, re->options, 0))
+switch(min = find_minlength(re, code, code, re->options, NULL))
{
case -2: *errorptr = "internal error: missing capturing bracket"; return NULL;
case -3: *errorptr = "internal error: opcode not recognized"; return NULL;
diff --git a/pcre/pcregrep.c b/pcre/pcregrep.c
index 4f7fa38491a..c49a74ffb78 100644
--- a/pcre/pcregrep.c
+++ b/pcre/pcregrep.c
@@ -1582,12 +1582,15 @@ while (ptr < endptr)
int endlinelength;
int mrc = 0;
int startoffset = 0;
+ int prevoffsets[2];
unsigned int options = 0;
BOOL match;
char *matchptr = ptr;
char *t = ptr;
size_t length, linelength;
+ prevoffsets[0] = prevoffsets[1] = -1;
+
/* At this point, ptr is at the start of a line. We need to find the length
of the subject string to pass to pcre_exec(). In multiline mode, it is the
length remainder of the data in the buffer. Otherwise, it is the length of
@@ -1729,55 +1732,86 @@ while (ptr < endptr)
{
if (!invert)
{
- if (printname != NULL) fprintf(stdout, "%s:", printname);
- if (number) fprintf(stdout, "%d:", linenumber);
+ int oldstartoffset = startoffset;
- /* Handle --line-offsets */
+ /* It is possible, when a lookbehind assertion contains \K, for the
+ same string to be found again. The code below advances startoffset, but
+ until it is past the "bumpalong" offset that gave the match, the same
+ substring will be returned. The PCRE1 library does not return the
+ bumpalong offset, so all we can do is ignore repeated strings. (PCRE2
+ does this better.) */
- if (line_offsets)
- fprintf(stdout, "%d,%d\n", (int)(matchptr + offsets[0] - ptr),
- offsets[1] - offsets[0]);
+ if (prevoffsets[0] != offsets[0] || prevoffsets[1] != offsets[1])
+ {
+ prevoffsets[0] = offsets[0];
+ prevoffsets[1] = offsets[1];
- /* Handle --file-offsets */
+ if (printname != NULL) fprintf(stdout, "%s:", printname);
+ if (number) fprintf(stdout, "%d:", linenumber);
- else if (file_offsets)
- fprintf(stdout, "%d,%d\n",
- (int)(filepos + matchptr + offsets[0] - ptr),
- offsets[1] - offsets[0]);
+ /* Handle --line-offsets */
- /* Handle --only-matching, which may occur many times */
+ if (line_offsets)
+ fprintf(stdout, "%d,%d\n", (int)(matchptr + offsets[0] - ptr),
+ offsets[1] - offsets[0]);
- else
- {
- BOOL printed = FALSE;
- omstr *om;
+ /* Handle --file-offsets */
+
+ else if (file_offsets)
+ fprintf(stdout, "%d,%d\n",
+ (int)(filepos + matchptr + offsets[0] - ptr),
+ offsets[1] - offsets[0]);
+
+ /* Handle --only-matching, which may occur many times */
- for (om = only_matching; om != NULL; om = om->next)
+ else
{
- int n = om->groupnum;
- if (n < mrc)
+ BOOL printed = FALSE;
+ omstr *om;
+
+ for (om = only_matching; om != NULL; om = om->next)
{
- int plen = offsets[2*n + 1] - offsets[2*n];
- if (plen > 0)
+ int n = om->groupnum;
+ if (n < mrc)
{
- if (printed) fprintf(stdout, "%s", om_separator);
- if (do_colour) fprintf(stdout, "%c[%sm", 0x1b, colour_string);
- FWRITE(matchptr + offsets[n*2], 1, plen, stdout);
- if (do_colour) fprintf(stdout, "%c[00m", 0x1b);
- printed = TRUE;
+ int plen = offsets[2*n + 1] - offsets[2*n];
+ if (plen > 0)
+ {
+ if (printed) fprintf(stdout, "%s", om_separator);
+ if (do_colour) fprintf(stdout, "%c[%sm", 0x1b, colour_string);
+ FWRITE(matchptr + offsets[n*2], 1, plen, stdout);
+ if (do_colour) fprintf(stdout, "%c[00m", 0x1b);
+ printed = TRUE;
+ }
}
}
- }
- if (printed || printname != NULL || number) fprintf(stdout, "\n");
+ if (printed || printname != NULL || number) fprintf(stdout, "\n");
+ }
}
- /* Prepare to repeat to find the next match */
+ /* Prepare to repeat to find the next match. If the patterned contained
+ a lookbehind tht included \K, it is possible that the end of the match
+ might be at or before the actual strting offset we have just used. We
+ need to start one character further on. Unfortunately, for unanchored
+ patterns, the actual start offset can be greater that the one that was
+ set as a result of "bumpalong". PCRE1 does not return the actual start
+ offset, so we have to check against the original start offset. This may
+ lead to duplicates - we we need the fudge above to avoid printing them.
+ (PCRE2 does this better.) */
match = FALSE;
if (line_buffered) fflush(stdout);
rc = 0; /* Had some success */
startoffset = offsets[1]; /* Restart after the match */
+ if (startoffset <= oldstartoffset)
+ {
+ if ((size_t)startoffset >= length)
+ goto END_ONE_MATCH; /* We were at the end */
+ startoffset = oldstartoffset + 1;
+ if (utf8)
+ while ((matchptr[startoffset] & 0xc0) == 0x80) startoffset++;
+ }
goto ONLY_MATCHING_RESTART;
}
}
@@ -1974,6 +2008,7 @@ while (ptr < endptr)
/* Advance to after the newline and increment the line number. The file
offset to the current line is maintained in filepos. */
+ END_ONE_MATCH:
ptr += linelength + endlinelength;
filepos += (int)(linelength + endlinelength);
linenumber++;
diff --git a/pcre/pcretest.c b/pcre/pcretest.c
index b8dc3c67032..27107cae461 100644
--- a/pcre/pcretest.c
+++ b/pcre/pcretest.c
@@ -2257,16 +2257,19 @@ if (callout_extra)
fprintf(f, "Callout %d: last capture = %d\n",
cb->callout_number, cb->capture_last);
- for (i = 0; i < cb->capture_top * 2; i += 2)
+ if (cb->offset_vector != NULL)
{
- if (cb->offset_vector[i] < 0)
- fprintf(f, "%2d: <unset>\n", i/2);
- else
+ for (i = 0; i < cb->capture_top * 2; i += 2)
{
- fprintf(f, "%2d: ", i/2);
- PCHARSV(cb->subject, cb->offset_vector[i],
- cb->offset_vector[i+1] - cb->offset_vector[i], f);
- fprintf(f, "\n");
+ if (cb->offset_vector[i] < 0)
+ fprintf(f, "%2d: <unset>\n", i/2);
+ else
+ {
+ fprintf(f, "%2d: ", i/2);
+ PCHARSV(cb->subject, cb->offset_vector[i],
+ cb->offset_vector[i+1] - cb->offset_vector[i], f);
+ fprintf(f, "\n");
+ }
}
}
}
@@ -2519,7 +2522,7 @@ re->name_entry_size = swap_uint16(re->name_entry_size);
re->name_count = swap_uint16(re->name_count);
re->ref_count = swap_uint16(re->ref_count);
-if (extra != NULL)
+if (extra != NULL && (extra->flags & PCRE_EXTRA_STUDY_DATA) != 0)
{
pcre_study_data *rsd = (pcre_study_data *)(extra->study_data);
rsd->size = swap_uint32(rsd->size);
@@ -2700,7 +2703,7 @@ re->name_entry_size = swap_uint16(re->name_entry_size);
re->name_count = swap_uint16(re->name_count);
re->ref_count = swap_uint16(re->ref_count);
-if (extra != NULL)
+if (extra != NULL && (extra->flags & PCRE_EXTRA_STUDY_DATA) != 0)
{
pcre_study_data *rsd = (pcre_study_data *)(extra->study_data);
rsd->size = swap_uint32(rsd->size);
@@ -3453,7 +3456,7 @@ while (!done)
pcre_extra *extra = NULL;
#if !defined NOPOSIX /* There are still compilers that require no indent */
- regex_t preg;
+ regex_t preg = { NULL, 0, 0} ;
int do_posix = 0;
#endif
@@ -5603,6 +5606,12 @@ while (!done)
if (!do_g && !do_G) break;
+ if (use_offsets == NULL)
+ {
+ fprintf(outfile, "Cannot do global matching without an ovector\n");
+ break;
+ }
+
/* If we have matched an empty string, first check to see if we are at
the end of the subject. If so, the /g loop is over. Otherwise, mimic what
Perl's /g options does. This turns out to be rather cunning. First we set
@@ -5618,9 +5627,33 @@ while (!done)
g_notempty = PCRE_NOTEMPTY_ATSTART | PCRE_ANCHORED;
}
- /* For /g, update the start offset, leaving the rest alone */
-
- if (do_g) start_offset = use_offsets[1];
+ /* For /g, update the start offset, leaving the rest alone. There is a
+ tricky case when \K is used in a positive lookbehind assertion. This can
+ cause the end of the match to be less than or equal to the start offset.
+ In this case we restart at one past the start offset. This may return the
+ same match if the original start offset was bumped along during the
+ match, but eventually the new start offset will hit the actual start
+ offset. (In PCRE2 the true start offset is available, and this can be
+ done better. It is not worth doing more than making sure we do not loop
+ at this stage in the life of PCRE1.) */
+
+ if (do_g)
+ {
+ if (g_notempty == 0 && use_offsets[1] <= start_offset)
+ {
+ if (start_offset >= len) break; /* End of subject */
+ start_offset++;
+ if (use_utf)
+ {
+ while (start_offset < len)
+ {
+ if ((bptr[start_offset] & 0xc0) != 0x80) break;
+ start_offset++;
+ }
+ }
+ }
+ else start_offset = use_offsets[1];
+ }
/* For /G, update the pointer and length */
@@ -5637,7 +5670,7 @@ while (!done)
CONTINUE:
#if !defined NOPOSIX
- if (posix || do_posix) regfree(&preg);
+ if ((posix || do_posix) && preg.re_pcre != 0) regfree(&preg);
#endif
if (re != NULL) new_free(re);
diff --git a/pcre/testdata/grepoutput b/pcre/testdata/grepoutput
index 9bf9d9d62e9..4d61752804a 100644
--- a/pcre/testdata/grepoutput
+++ b/pcre/testdata/grepoutput
@@ -743,3 +743,11 @@ RC=0
---------------------------- Test 106 -----------------------------
a
RC=0
+---------------------------- Test 107 -----------------------------
+1:0,1
+2:0,1
+2:1,1
+2:2,1
+2:3,1
+2:4,1
+RC=0
diff --git a/pcre/testdata/testinput1 b/pcre/testdata/testinput1
index 123e3d3cfd4..73c2f4d27d1 100644
--- a/pcre/testdata/testinput1
+++ b/pcre/testdata/testinput1
@@ -5720,4 +5720,14 @@ AbcdCBefgBhiBqz
/[\Q]a\E]+/
aa]]
+/(?:((abcd))|(((?:(?:(?:(?:abc|(?:abcdef))))b)abcdefghi)abc)|((*ACCEPT)))/
+ 1234abcd
+
+/(\2)(\1)/
+
+"Z*(|d*){216}"
+
+"(?1)(?#?'){8}(a)"
+ baaaaaaaaac
+
/-- End of testinput1 --/
diff --git a/pcre/testdata/testinput11 b/pcre/testdata/testinput11
index 7e8e54221d4..65a4b030f6c 100644
--- a/pcre/testdata/testinput11
+++ b/pcre/testdata/testinput11
@@ -134,4 +134,6 @@ is required for these tests. --/
/(((a\2)|(a*)\g<-1>))*a?/B
+/((?+1)(\1))/B
+
/-- End of testinput11 --/
diff --git a/pcre/testdata/testinput12 b/pcre/testdata/testinput12
index 5d727af26af..d68551f7aa3 100644
--- a/pcre/testdata/testinput12
+++ b/pcre/testdata/testinput12
@@ -87,4 +87,12 @@ and a couple of things that are different with JIT. --/
/^12345678abcd/mS++
12345678abcd
+/-- Test pattern compilation --/
+
+/(?:a|b|c|d|e)(?R)/S++
+
+/(?:a|b|c|d|e)(?R)(?R)/S++
+
+/(a(?:a|b|c|d|e)b){8,16}/S++
+
/-- End of testinput12 --/
diff --git a/pcre/testdata/testinput2 b/pcre/testdata/testinput2
index c6816bf322c..58fe53b722f 100644
--- a/pcre/testdata/testinput2
+++ b/pcre/testdata/testinput2
@@ -1380,6 +1380,8 @@
1X
123456\P
+//KF>/dev/null
+
/abc/IS>testsavedregex
<testsavedregex
abc
@@ -4078,4 +4080,76 @@ backtracking verbs. --/
/\x{whatever}/
+"((?=(?(?=(?(?=(?(?=()))))))))"
+ a
+
+"(?(?=)==)(((((((((?=)))))))))"
+ a
+
+/^(?:(a)|b)(?(1)A|B)/I
+ aA123\O3
+ aA123\O6
+
+'^(?:(?<AA>a)|b)(?(<AA>)A|B)'
+ aA123\O3
+ aA123\O6
+
+'^(?<AA>)(?:(?<AA>a)|b)(?(<AA>)A|B)'J
+ aA123\O3
+ aA123\O6
+
+'^(?:(?<AA>X)|)(?:(?<AA>a)|b)\k{AA}'J
+ aa123\O3
+ aa123\O6
+
+/(?<N111>(?J)(?<N111>1(111111)11|)1|1|)(?(<N111>)1)/
+
+/(?(?=0)?)+/
+
+/(?(?=0)(?=00)?00765)/
+ 00765
+
+/(?(?=0)(?=00)?00765|(?!3).56)/
+ 00765
+ 456
+ ** Failers
+ 356
+
+'^(a)*+(\w)'
+ g
+ g\O3
+
+'^(?:a)*+(\w)'
+ g
+ g\O3
+
+//C
+ \O\C+
+
+"((?2){0,1999}())?"
+
+/((?+1)(\1))/BZ
+
+/(?(?!)a|b)/
+ bbb
+ aaa
+
+"((?2)+)((?1))"
+
+"(?(?<E>.*!.*)?)"
+
+"X((?2)()*+){2}+"BZ
+
+"X((?2)()*+){2}"BZ
+
+"(?<=((?2))((?1)))"
+
+/(?<=\Ka)/g+
+ aaaaa
+
+/(?<=\Ka)/G+
+ aaaaa
+
+/((?2){73}(?2))((?1))/
+
/-- End of testinput2 --/
diff --git a/pcre/testdata/testinput4 b/pcre/testdata/testinput4
index 0110267bd80..8bdbdac4c26 100644
--- a/pcre/testdata/testinput4
+++ b/pcre/testdata/testinput4
@@ -722,4 +722,9 @@
/^#[^\x{ffff}]#[^\x{ffff}]#[^\x{ffff}]#/8
#\x{10000}#\x{100}#\x{10ffff}#
+"[\S\V\H]"8
+
+/\C(\W?Å¿)'?{{/8
+ \\C(\\W?Å¿)'?{{
+
/-- End of testinput4 --/
diff --git a/pcre/testdata/testinput5 b/pcre/testdata/testinput5
index e36b09d6377..28561a93572 100644
--- a/pcre/testdata/testinput5
+++ b/pcre/testdata/testinput5
@@ -790,4 +790,12 @@
/[b-d\x{200}-\x{250}]*[ae-h]?#[\x{200}-\x{250}]{0,8}[\x00-\xff]*#[\x{200}-\x{250}]+[a-z]/8BZ
+/[^\xff]*PRUNE:\x{100}abc(xyz(?1))/8DZ
+
+/(?<=\K\x{17f})/8g+
+ \x{17f}\x{17f}\x{17f}\x{17f}\x{17f}
+
+/(?<=\K\x{17f})/8G+
+ \x{17f}\x{17f}\x{17f}\x{17f}\x{17f}
+
/-- End of testinput5 --/
diff --git a/pcre/testdata/testinput6 b/pcre/testdata/testinput6
index 82c3ed5c772..02cef0d6f5d 100644
--- a/pcre/testdata/testinput6
+++ b/pcre/testdata/testinput6
@@ -1496,4 +1496,10 @@
/^s?c/mi8
scat
+/[A-`]/i8
+ abcdefghijklmno
+
+/\C\X*QT/8
+ Ó…\x0aT
+
/-- End of testinput6 --/
diff --git a/pcre/testdata/testinput8 b/pcre/testdata/testinput8
index 06334cd36e5..931dd717e74 100644
--- a/pcre/testdata/testinput8
+++ b/pcre/testdata/testinput8
@@ -4837,4 +4837,8 @@
'\A(?:[^\"]++|\"(?:[^\"]++|\"\")*+\")++'
NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED
+/(?(?!)a|b)/
+ bbb
+ aaa
+
/-- End of testinput8 --/
diff --git a/pcre/testdata/testoutput1 b/pcre/testdata/testoutput1
index 5e719002ed6..0a53fd0a47d 100644
--- a/pcre/testdata/testoutput1
+++ b/pcre/testdata/testoutput1
@@ -9411,4 +9411,22 @@ No match
aa]]
0: aa]]
+/(?:((abcd))|(((?:(?:(?:(?:abc|(?:abcdef))))b)abcdefghi)abc)|((*ACCEPT)))/
+ 1234abcd
+ 0:
+ 1: <unset>
+ 2: <unset>
+ 3: <unset>
+ 4: <unset>
+ 5:
+
+/(\2)(\1)/
+
+"Z*(|d*){216}"
+
+"(?1)(?#?'){8}(a)"
+ baaaaaaaaac
+ 0: aaaaaaaaa
+ 1: a
+
/-- End of testinput1 --/
diff --git a/pcre/testdata/testoutput11-16 b/pcre/testdata/testoutput11-16
index a1db3f34225..422f2adbd5d 100644
--- a/pcre/testdata/testoutput11-16
+++ b/pcre/testdata/testoutput11-16
@@ -231,7 +231,7 @@ Memory allocation (code space): 73
------------------------------------------------------------------
/(?P<a>a)...(?P=a)bbb(?P>a)d/BM
-Memory allocation (code space): 57
+Memory allocation (code space): 61
------------------------------------------------------------------
0 24 Bra
2 5 CBra 1
@@ -733,4 +733,19 @@ Memory allocation (code space): 14
41 End
------------------------------------------------------------------
+/((?+1)(\1))/B
+------------------------------------------------------------------
+ 0 20 Bra
+ 2 16 Once
+ 4 12 CBra 1
+ 7 9 Recurse
+ 9 5 CBra 2
+ 12 \1
+ 14 5 Ket
+ 16 12 Ket
+ 18 16 Ket
+ 20 20 Ket
+ 22 End
+------------------------------------------------------------------
+
/-- End of testinput11 --/
diff --git a/pcre/testdata/testoutput11-32 b/pcre/testdata/testoutput11-32
index 7b7b030fdca..d953ec8c07b 100644
--- a/pcre/testdata/testoutput11-32
+++ b/pcre/testdata/testoutput11-32
@@ -231,7 +231,7 @@ Memory allocation (code space): 155
------------------------------------------------------------------
/(?P<a>a)...(?P=a)bbb(?P>a)d/BM
-Memory allocation (code space): 117
+Memory allocation (code space): 125
------------------------------------------------------------------
0 24 Bra
2 5 CBra 1
@@ -733,4 +733,19 @@ Memory allocation (code space): 28
41 End
------------------------------------------------------------------
+/((?+1)(\1))/B
+------------------------------------------------------------------
+ 0 20 Bra
+ 2 16 Once
+ 4 12 CBra 1
+ 7 9 Recurse
+ 9 5 CBra 2
+ 12 \1
+ 14 5 Ket
+ 16 12 Ket
+ 18 16 Ket
+ 20 20 Ket
+ 22 End
+------------------------------------------------------------------
+
/-- End of testinput11 --/
diff --git a/pcre/testdata/testoutput11-8 b/pcre/testdata/testoutput11-8
index f5ec652af8c..6ec18ec0e95 100644
--- a/pcre/testdata/testoutput11-8
+++ b/pcre/testdata/testoutput11-8
@@ -231,7 +231,7 @@ Memory allocation (code space): 45
------------------------------------------------------------------
/(?P<a>a)...(?P=a)bbb(?P>a)d/BM
-Memory allocation (code space): 34
+Memory allocation (code space): 38
------------------------------------------------------------------
0 30 Bra
3 7 CBra 1
@@ -733,4 +733,19 @@ Memory allocation (code space): 10
60 End
------------------------------------------------------------------
+/((?+1)(\1))/B
+------------------------------------------------------------------
+ 0 31 Bra
+ 3 25 Once
+ 6 19 CBra 1
+ 11 14 Recurse
+ 14 8 CBra 2
+ 19 \1
+ 22 8 Ket
+ 25 19 Ket
+ 28 25 Ket
+ 31 31 Ket
+ 34 End
+------------------------------------------------------------------
+
/-- End of testinput11 --/
diff --git a/pcre/testdata/testoutput12 b/pcre/testdata/testoutput12
index 67ad2c8aecf..7a1cf6986be 100644
--- a/pcre/testdata/testoutput12
+++ b/pcre/testdata/testoutput12
@@ -176,4 +176,12 @@ No match, mark = m (JIT)
12345678abcd
0: 12345678abcd (JIT)
+/-- Test pattern compilation --/
+
+/(?:a|b|c|d|e)(?R)/S++
+
+/(?:a|b|c|d|e)(?R)(?R)/S++
+
+/(a(?:a|b|c|d|e)b){8,16}/S++
+
/-- End of testinput12 --/
diff --git a/pcre/testdata/testoutput2 b/pcre/testdata/testoutput2
index 1e87026cc6d..b718df0479d 100644
--- a/pcre/testdata/testoutput2
+++ b/pcre/testdata/testoutput2
@@ -561,7 +561,7 @@ Failed: assertion expected after (?( at offset 3
Failed: reference to non-existent subpattern at offset 7
/(?(?<ab))/
-Failed: syntax error in subpattern name (missing terminator) at offset 7
+Failed: assertion expected after (?( at offset 3
/((?s)blah)\s+\1/I
Capturing subpattern count = 1
@@ -1566,30 +1566,35 @@ Need char = 'b'
/a(?(1)b)(.)/I
Capturing subpattern count = 1
+Max back reference = 1
No options
First char = 'a'
No need char
/a(?(1)bag|big)(.)/I
Capturing subpattern count = 1
+Max back reference = 1
No options
First char = 'a'
Need char = 'g'
/a(?(1)bag|big)*(.)/I
Capturing subpattern count = 1
+Max back reference = 1
No options
First char = 'a'
No need char
/a(?(1)bag|big)+(.)/I
Capturing subpattern count = 1
+Max back reference = 1
No options
First char = 'a'
Need char = 'g'
/a(?(1)b..|b..)(.)/I
Capturing subpattern count = 1
+Max back reference = 1
No options
First char = 'a'
Need char = 'b'
@@ -3379,24 +3384,28 @@ Need char = 'a'
/(?(1)ab|ac)(.)/I
Capturing subpattern count = 1
+Max back reference = 1
No options
First char = 'a'
No need char
/(?(1)abz|acz)(.)/I
Capturing subpattern count = 1
+Max back reference = 1
No options
First char = 'a'
Need char = 'z'
/(?(1)abz)(.)/I
Capturing subpattern count = 1
+Max back reference = 1
No options
No first char
No need char
/(?(1)abz)(1)23/I
Capturing subpattern count = 1
+Max back reference = 1
No options
No first char
Need char = '3'
@@ -5605,6 +5614,10 @@ No match
123456\P
No match
+//KF>/dev/null
+Compiled pattern written to /dev/null
+Study data written to /dev/null
+
/abc/IS>testsavedregex
Capturing subpattern count = 0
No options
@@ -6336,6 +6349,7 @@ No need char
/^(?P<A>a)?(?(A)a|b)/I
Capturing subpattern count = 1
+Max back reference = 1
Named capturing subpatterns:
A 1
Options: anchored
@@ -6353,6 +6367,7 @@ No match
/(?:(?(ZZ)a|b)(?P<ZZ>X))+/I
Capturing subpattern count = 1
+Max back reference = 1
Named capturing subpatterns:
ZZ 1
No options
@@ -6370,6 +6385,7 @@ Failed: reference to non-existent subpattern at offset 9
/(?:(?(ZZ)a|b)(?(ZZ)a|b)(?P<ZZ>X))+/I
Capturing subpattern count = 1
+Max back reference = 1
Named capturing subpatterns:
ZZ 1
No options
@@ -6381,6 +6397,7 @@ Need char = 'X'
/(?:(?(ZZ)a|\(b\))\\(?P<ZZ>X))+/I
Capturing subpattern count = 1
+Max back reference = 1
Named capturing subpatterns:
ZZ 1
No options
@@ -10226,6 +10243,7 @@ No starting char list
(?(1)|.) # check that there was an empty component
/xiIS
Capturing subpattern count = 1
+Max back reference = 1
Options: anchored caseless extended
No first char
Need char = ':'
@@ -10255,6 +10273,7 @@ Failed: different names for subpatterns of the same number are not allowed at of
b(?<quote> (?<apostrophe>')|(?<realquote>")) )
(?('quote')[a-z]+|[0-9]+)/JIx
Capturing subpattern count = 6
+Max back reference = 1
Named capturing subpatterns:
apostrophe 2
apostrophe 5
@@ -10317,6 +10336,7 @@ No match
End
------------------------------------------------------------------
Capturing subpattern count = 4
+Max back reference = 4
Named capturing subpatterns:
D 4
D 1
@@ -10364,6 +10384,7 @@ No match
End
------------------------------------------------------------------
Capturing subpattern count = 4
+Max back reference = 1
Named capturing subpatterns:
A 1
A 4
@@ -10486,6 +10507,7 @@ No starting char list
/()i(?(1)a)/SI
Capturing subpattern count = 1
+Max back reference = 1
No options
No first char
Need char = 'i'
@@ -14206,4 +14228,199 @@ Failed: digits missing in \x{} or \o{} at offset 3
/\x{whatever}/
Failed: non-hex character in \x{} (closing brace missing?) at offset 3
+"((?=(?(?=(?(?=(?(?=()))))))))"
+ a
+ 0:
+ 1:
+ 2:
+
+"(?(?=)==)(((((((((?=)))))))))"
+ a
+No match
+
+/^(?:(a)|b)(?(1)A|B)/I
+Capturing subpattern count = 1
+Max back reference = 1
+Options: anchored
+No first char
+No need char
+ aA123\O3
+Matched, but too many substrings
+ 0: aA
+ aA123\O6
+ 0: aA
+ 1: a
+
+'^(?:(?<AA>a)|b)(?(<AA>)A|B)'
+ aA123\O3
+Matched, but too many substrings
+ 0: aA
+ aA123\O6
+ 0: aA
+ 1: a
+
+'^(?<AA>)(?:(?<AA>a)|b)(?(<AA>)A|B)'J
+ aA123\O3
+Matched, but too many substrings
+ 0: aA
+ aA123\O6
+Matched, but too many substrings
+ 0: aA
+ 1:
+
+'^(?:(?<AA>X)|)(?:(?<AA>a)|b)\k{AA}'J
+ aa123\O3
+Matched, but too many substrings
+ 0: aa
+ aa123\O6
+Matched, but too many substrings
+ 0: aa
+ 1: <unset>
+
+/(?<N111>(?J)(?<N111>1(111111)11|)1|1|)(?(<N111>)1)/
+
+/(?(?=0)?)+/
+Failed: nothing to repeat at offset 7
+
+/(?(?=0)(?=00)?00765)/
+ 00765
+ 0: 00765
+
+/(?(?=0)(?=00)?00765|(?!3).56)/
+ 00765
+ 0: 00765
+ 456
+ 0: 456
+ ** Failers
+No match
+ 356
+No match
+
+'^(a)*+(\w)'
+ g
+ 0: g
+ 1: <unset>
+ 2: g
+ g\O3
+Matched, but too many substrings
+ 0: g
+
+'^(?:a)*+(\w)'
+ g
+ 0: g
+ 1: g
+ g\O3
+Matched, but too many substrings
+ 0: g
+
+//C
+ \O\C+
+Callout 255: last capture = -1
+--->
+ +0 ^
+Matched, but too many substrings
+
+"((?2){0,1999}())?"
+
+/((?+1)(\1))/BZ
+------------------------------------------------------------------
+ Bra
+ Once
+ CBra 1
+ Recurse
+ CBra 2
+ \1
+ Ket
+ Ket
+ Ket
+ Ket
+ End
+------------------------------------------------------------------
+
+/(?(?!)a|b)/
+ bbb
+ 0: b
+ aaa
+No match
+
+"((?2)+)((?1))"
+
+"(?(?<E>.*!.*)?)"
+Failed: assertion expected after (?( at offset 3
+
+"X((?2)()*+){2}+"BZ
+------------------------------------------------------------------
+ Bra
+ X
+ Once
+ CBra 1
+ Recurse
+ Braposzero
+ SCBraPos 2
+ KetRpos
+ Ket
+ CBra 1
+ Recurse
+ Braposzero
+ SCBraPos 2
+ KetRpos
+ Ket
+ Ket
+ Ket
+ End
+------------------------------------------------------------------
+
+"X((?2)()*+){2}"BZ
+------------------------------------------------------------------
+ Bra
+ X
+ CBra 1
+ Recurse
+ Braposzero
+ SCBraPos 2
+ KetRpos
+ Ket
+ CBra 1
+ Recurse
+ Braposzero
+ SCBraPos 2
+ KetRpos
+ Ket
+ Ket
+ End
+------------------------------------------------------------------
+
+"(?<=((?2))((?1)))"
+Failed: lookbehind assertion is not fixed length at offset 17
+
+/(?<=\Ka)/g+
+ aaaaa
+ 0: a
+ 0+ aaaa
+ 0: a
+ 0+ aaaa
+ 0: a
+ 0+ aaa
+ 0: a
+ 0+ aa
+ 0: a
+ 0+ a
+ 0: a
+ 0+
+
+/(?<=\Ka)/G+
+ aaaaa
+ 0: a
+ 0+ aaaa
+ 0: a
+ 0+ aaa
+ 0: a
+ 0+ aa
+ 0: a
+ 0+ a
+ 0: a
+ 0+
+
+/((?2){73}(?2))((?1))/
+
/-- End of testinput2 --/
diff --git a/pcre/testdata/testoutput4 b/pcre/testdata/testoutput4
index dcf13b08507..d43c12392dd 100644
--- a/pcre/testdata/testoutput4
+++ b/pcre/testdata/testoutput4
@@ -1271,4 +1271,10 @@ No match
#\x{10000}#\x{100}#\x{10ffff}#
0: #\x{10000}#\x{100}#\x{10ffff}#
+"[\S\V\H]"8
+
+/\C(\W?Å¿)'?{{/8
+ \\C(\\W?Å¿)'?{{
+No match
+
/-- End of testinput4 --/
diff --git a/pcre/testdata/testoutput5 b/pcre/testdata/testoutput5
index 5c098e650ba..bab989ca7e5 100644
--- a/pcre/testdata/testoutput5
+++ b/pcre/testdata/testoutput5
@@ -1897,4 +1897,49 @@ Failed: disallowed Unicode code point (>= 0xd800 && <= 0xdfff) at offset 5
End
------------------------------------------------------------------
+/[^\xff]*PRUNE:\x{100}abc(xyz(?1))/8DZ
+------------------------------------------------------------------
+ Bra
+ [^\x{ff}]*
+ PRUNE:\x{100}abc
+ CBra 1
+ xyz
+ Recurse
+ Ket
+ Ket
+ End
+------------------------------------------------------------------
+Capturing subpattern count = 1
+Options: utf
+No first char
+Need char = 'z'
+
+/(?<=\K\x{17f})/8g+
+ \x{17f}\x{17f}\x{17f}\x{17f}\x{17f}
+ 0: \x{17f}
+ 0+ \x{17f}\x{17f}\x{17f}\x{17f}
+ 0: \x{17f}
+ 0+ \x{17f}\x{17f}\x{17f}\x{17f}
+ 0: \x{17f}
+ 0+ \x{17f}\x{17f}\x{17f}
+ 0: \x{17f}
+ 0+ \x{17f}\x{17f}
+ 0: \x{17f}
+ 0+ \x{17f}
+ 0: \x{17f}
+ 0+
+
+/(?<=\K\x{17f})/8G+
+ \x{17f}\x{17f}\x{17f}\x{17f}\x{17f}
+ 0: \x{17f}
+ 0+ \x{17f}\x{17f}\x{17f}\x{17f}
+ 0: \x{17f}
+ 0+ \x{17f}\x{17f}\x{17f}
+ 0: \x{17f}
+ 0+ \x{17f}\x{17f}
+ 0: \x{17f}
+ 0+ \x{17f}
+ 0: \x{17f}
+ 0+
+
/-- End of testinput5 --/
diff --git a/pcre/testdata/testoutput6 b/pcre/testdata/testoutput6
index a990ba13eb8..3f035b828c3 100644
--- a/pcre/testdata/testoutput6
+++ b/pcre/testdata/testoutput6
@@ -2461,4 +2461,12 @@ No match
scat
0: sc
+/[A-`]/i8
+ abcdefghijklmno
+ 0: a
+
+/\C\X*QT/8
+ Ó…\x0aT
+No match
+
/-- End of testinput6 --/
diff --git a/pcre/testdata/testoutput8 b/pcre/testdata/testoutput8
index 95c4e4db1b2..e4fa4977561 100644
--- a/pcre/testdata/testoutput8
+++ b/pcre/testdata/testoutput8
@@ -7785,4 +7785,10 @@ Matched, but offsets vector is too small to show all matches
NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED
0: NON QUOTED "QUOT""ED" AFTER
+/(?(?!)a|b)/
+ bbb
+ 0: b
+ aaa
+No match
+
/-- End of testinput8 --/
diff --git a/plugin/auth_dialog/CMakeLists.txt b/plugin/auth_dialog/CMakeLists.txt
index 9b4dcfd99bf..a23518060be 100644
--- a/plugin/auth_dialog/CMakeLists.txt
+++ b/plugin/auth_dialog/CMakeLists.txt
@@ -15,4 +15,4 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
MYSQL_ADD_PLUGIN(dialog dialog.c ${CMAKE_SOURCE_DIR}/libmysql/get_password.c
- MODULE_ONLY COMPONENT SharedLibraries)
+ MODULE_ONLY COMPONENT ClientPlugins)
diff --git a/plugin/auth_dialog/dialog.c b/plugin/auth_dialog/dialog.c
index 0fa5ab93a35..da937ea6e91 100644
--- a/plugin/auth_dialog/dialog.c
+++ b/plugin/auth_dialog/dialog.c
@@ -25,6 +25,8 @@
the answer back to the server. No encryption is involved,
the answers are sent in clear text.
*/
+#define _GNU_SOURCE 1 /* for RTLD_DEFAULT */
+
#include <my_global.h>
#include <mysql/client_plugin.h>
#include <mysql.h>
diff --git a/plugin/auth_examples/CMakeLists.txt b/plugin/auth_examples/CMakeLists.txt
index f6c2b637067..c7b7e5be62d 100644
--- a/plugin/auth_examples/CMakeLists.txt
+++ b/plugin/auth_examples/CMakeLists.txt
@@ -30,4 +30,4 @@ MYSQL_ADD_PLUGIN(qa_auth_client qa_auth_client.c
MYSQL_ADD_PLUGIN(auth_0x0100 auth_0x0100.c MODULE_ONLY COMPONENT Test)
MYSQL_ADD_PLUGIN(mysql_clear_password clear_password_client.c
- MODULE_ONLY COMPONENT SharedLibraries)
+ MODULE_ONLY COMPONENT ClientPlugins)
diff --git a/plugin/handler_socket/CMakeLists.txt b/plugin/handler_socket/CMakeLists.txt
index 358139eda1e..2e7caa80897 100644
--- a/plugin/handler_socket/CMakeLists.txt
+++ b/plugin/handler_socket/CMakeLists.txt
@@ -6,9 +6,7 @@ IF(WIN32)
ENDIF()
#Remove -fno-implicit-templates from compiler flags(handlersocket would not work with it)
-IF(CMAKE_COMPILER_IS_GNUCXX)
- STRING(REPLACE "-fno-implicit-templates" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
-ENDIF()
+STRING(REPLACE "-fno-implicit-templates" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
INCLUDE_DIRECTORIES(libhsclient)
diff --git a/plugin/server_audit/server_audit.c b/plugin/server_audit/server_audit.c
index 7f86d3fc3c3..1c91c66759d 100644
--- a/plugin/server_audit/server_audit.c
+++ b/plugin/server_audit/server_audit.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 Alexey Botchkov and SkySQL Ab
+/* Copyright (C) 2013, 2015, Alexey Botchkov and SkySQL 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
@@ -14,11 +14,10 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#define PLUGIN_VERSION 0x101
-#define PLUGIN_STR_VERSION "1.1.7"
+#define PLUGIN_VERSION 0x103
+#define PLUGIN_STR_VERSION "1.3.0"
#include <my_config.h>
-
#include <stdio.h>
#include <time.h>
#include <string.h>
@@ -152,6 +151,10 @@ static int my_strnncoll_binary(CHARSET_INFO * cs __attribute__((unused)),
#define flogger_mutex_lock(A) pthread_mutex_lock(mysql_mutex_real_mutex(A))
#define flogger_mutex_unlock(A) pthread_mutex_unlock(mysql_mutex_real_mutex(A))
+static char **int_mysql_data_home;
+static char *default_home= (char *)".";
+#define mysql_data_home (*int_mysql_data_home)
+
#include "../../mysys/file_logger.c"
#endif /*!MARIADB_ONLY*/
@@ -175,6 +178,7 @@ static int my_strnncoll_binary(CHARSET_INFO * cs __attribute__((unused)),
extern char server_version[];
static const char *serv_ver= NULL;
static int started_mysql= 0;
+static int started_mariadb= 0;
static int maria_above_5= 0;
static char *incl_users, *excl_users,
*file_path, *syslog_info;
@@ -191,6 +195,9 @@ static char logging;
static int internal_stop_logging= 0;
static char incl_user_buffer[1024];
static char excl_user_buffer[1024];
+static char *big_buffer= NULL;
+static size_t big_buffer_alloced= 0;
+static unsigned int query_log_limit= 0;
static char servhost[256];
static size_t servhost_len;
@@ -232,11 +239,16 @@ static MYSQL_SYSVAR_STR(excl_users, excl_users, PLUGIN_VAR_RQCMDARG,
NULL, update_excl_users, NULL);
/* bits in the event filter. */
#define EVENT_CONNECT 1
-#define EVENT_QUERY 2
+#define EVENT_QUERY_ALL 2
+#define EVENT_QUERY 58
#define EVENT_TABLE 4
+#define EVENT_QUERY_DDL 8
+#define EVENT_QUERY_DML 16
+#define EVENT_QUERY_DCL 32
+
static const char *event_names[]=
{
- "CONNECT", "QUERY", "TABLE",
+ "CONNECT", "QUERY", "TABLE", "QUERY_DDL", "QUERY_DML", "QUERY_DCL",
NULL
};
static TYPELIB events_typelib=
@@ -244,7 +256,7 @@ static TYPELIB events_typelib=
array_elements(event_names) - 1, "", event_names, NULL
};
static MYSQL_SYSVAR_SET(events, events, PLUGIN_VAR_RQCMDARG,
- "Specifies the set of events to monitor. Can be CONNECT, QUERY, TABLE.",
+ "Specifies the set of events to monitor. Can be CONNECT, QUERY, TABLE, QUERY_DDL, QUERY_DML.",
NULL, NULL, 0, &events_typelib);
#define OUTPUT_SYSLOG 0
#define OUTPUT_FILE 1
@@ -281,6 +293,9 @@ static MYSQL_SYSVAR_STR(syslog_ident, syslog_ident, PLUGIN_VAR_RQCMDARG,
static MYSQL_SYSVAR_STR(syslog_info, syslog_info,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC,
"The <info> string to be added to the SYSLOG record.", NULL, NULL, "");
+static MYSQL_SYSVAR_UINT(query_log_limit, query_log_limit,
+ PLUGIN_VAR_OPCMDARG, "Limit on the length of the query string in a record.",
+ NULL, NULL, 1024, 0, 0x7FFFFFFF, 1);
static const char *syslog_facility_names[]=
{
@@ -360,6 +375,7 @@ static struct st_mysql_sys_var* vars[] = {
MYSQL_SYSVAR(syslog_ident),
MYSQL_SYSVAR(syslog_facility),
MYSQL_SYSVAR(syslog_priority),
+ MYSQL_SYSVAR(query_log_limit),
NULL
};
@@ -384,9 +400,11 @@ static struct st_mysql_show_var audit_status[]=
static PSI_mutex_key key_LOCK_operations;
static PSI_mutex_info mutex_key_list[]=
{{ &key_LOCK_operations, "SERVER_AUDIT_plugin::lock_operations",
+{{ &key_LOCK_bigbuffer, "SERVER_AUDIT_plugin::lock_bigbuffer",
PSI_FLAG_GLOBAL}};
#endif
static mysql_mutex_t lock_operations;
+static mysql_mutex_t lock_bigbuffer;
/* The Percona server and partly MySQL don't support */
/* launching client errors in the 'update_variable' methods. */
@@ -536,6 +554,115 @@ static int user_hash_fill(HASH *h, char *users,
}
+enum sa_keywords
+{
+ SQLCOM_NOTHING=0,
+ SQLCOM_DDL,
+ SQLCOM_DML,
+ SQLCOM_GRANT,
+ SQLCOM_CREATE_USER,
+ SQLCOM_CHANGE_MASTER,
+ SQLCOM_CREATE_SERVER,
+ SQLCOM_SET_OPTION,
+ SQLCOM_ALTER_SERVER,
+ SQLCOM_TRUNCATE,
+ SQLCOM_QUERY_ADMIN,
+ SQLCOM_DCL,
+};
+
+struct sa_keyword
+{
+ int length;
+ const char *wd;
+ struct sa_keyword *next;
+ enum sa_keywords type;
+};
+
+
+struct sa_keyword xml_word= {3, "XML", 0, SQLCOM_NOTHING};
+struct sa_keyword user_word= {4, "USER", 0, SQLCOM_NOTHING};
+struct sa_keyword data_word= {4, "DATA", 0, SQLCOM_NOTHING};
+struct sa_keyword server_word= {6, "SERVER", 0, SQLCOM_NOTHING};
+struct sa_keyword master_word= {6, "MASTER", 0, SQLCOM_NOTHING};
+struct sa_keyword password_word= {8, "PASSWORD", 0, SQLCOM_NOTHING};
+struct sa_keyword function_word= {8, "FUNCTION", 0, SQLCOM_NOTHING};
+struct sa_keyword statement_word= {9, "STATEMENT", 0, SQLCOM_NOTHING};
+struct sa_keyword procedure_word= {9, "PROCEDURE", 0, SQLCOM_NOTHING};
+
+
+struct sa_keyword keywords_to_skip[]=
+{
+ {3, "SET", &statement_word, SQLCOM_QUERY_ADMIN},
+ {0, NULL, 0, SQLCOM_DDL}
+};
+
+
+struct sa_keyword not_ddl_keywords[]=
+{
+ {4, "DROP", &function_word, SQLCOM_QUERY_ADMIN},
+ {4, "DROP", &procedure_word, SQLCOM_QUERY_ADMIN},
+ {4, "DROP", &user_word, SQLCOM_DCL},
+ {6, "CREATE", &user_word, SQLCOM_DCL},
+ {6, "CREATE", &function_word, SQLCOM_QUERY_ADMIN},
+ {6, "CREATE", &procedure_word, SQLCOM_QUERY_ADMIN},
+ {6, "RENAME", &user_word, SQLCOM_DCL},
+ {0, NULL, 0, SQLCOM_DDL}
+};
+
+
+struct sa_keyword ddl_keywords[]=
+{
+ {4, "DROP", 0, SQLCOM_DDL},
+ {5, "ALTER", 0, SQLCOM_DDL},
+ {6, "CREATE", 0, SQLCOM_DDL},
+ {6, "RENAME", 0, SQLCOM_DDL},
+ {8, "TRUNCATE", 0, SQLCOM_DDL},
+ {0, NULL, 0, SQLCOM_DDL}
+};
+
+
+struct sa_keyword dml_keywords[]=
+{
+ {2, "DO", 0, SQLCOM_DML},
+ {4, "CALL", 0, SQLCOM_DML},
+ {4, "LOAD", &data_word, SQLCOM_DML},
+ {4, "LOAD", &xml_word, SQLCOM_DML},
+ {6, "DELETE", 0, SQLCOM_DML},
+ {6, "INSERT", 0, SQLCOM_DML},
+ {6, "SELECT", 0, SQLCOM_DML},
+ {6, "UPDATE", 0, SQLCOM_DML},
+ {7, "HANDLER", 0, SQLCOM_DML},
+ {7, "REPLACE", 0, SQLCOM_DML},
+ {0, NULL, 0, SQLCOM_DML}
+};
+
+
+struct sa_keyword dcl_keywords[]=
+{
+ {6, "CREATE", &user_word, SQLCOM_DCL},
+ {4, "DROP", &user_word, SQLCOM_DCL},
+ {6, "RENAME", &user_word, SQLCOM_DCL},
+ {5, "GRANT", 0, SQLCOM_DCL},
+ {6, "REVOKE", 0, SQLCOM_DCL},
+ {3, "SET", &password_word, SQLCOM_DCL},
+ {0, NULL, 0, SQLCOM_DDL}
+};
+
+
+struct sa_keyword passwd_keywords[]=
+{
+ {3, "SET", &password_word, SQLCOM_SET_OPTION},
+ {5, "ALTER", &server_word, SQLCOM_ALTER_SERVER},
+ {5, "GRANT", 0, SQLCOM_GRANT},
+ {6, "CREATE", &user_word, SQLCOM_CREATE_USER},
+ {6, "CREATE", &server_word, SQLCOM_CREATE_SERVER},
+ {6, "CHANGE", &master_word, SQLCOM_CHANGE_MASTER},
+ {0, NULL, 0, SQLCOM_NOTHING}
+};
+
+#define MAX_KEYWORD 9
+
+
static void error_header()
{
struct tm tm_time;
@@ -573,6 +700,7 @@ struct connection_info
int log_always;
};
+
static HASH connection_hash;
@@ -781,6 +909,22 @@ static struct connection_info *
#define SAFE_STRLEN(s) (s ? strlen(s) : 0)
+static char empty_str[1]= { 0 };
+
+
+static int is_space(char c)
+{
+ return c == ' ' || c == '\r' || c == '\n' || c == '\t';
+}
+
+
+#define SKIP_SPACES(str) \
+do { \
+ while (is_space(*str)) \
+ ++str; \
+} while(0)
+
+
static struct connection_info *
@@ -972,14 +1116,20 @@ static size_t escape_string(const char *str, unsigned int len,
break;
if (*str == '\'')
{
+ if (result+1 >= res_end)
+ break;
*(result++)= '\\';
*(result++)= '\'';
}
else if (*str == '\\')
{
+ if (result+1 >= res_end)
+ break;
*(result++)= '\\';
*(result++)= '\\';
}
+ else if (is_space(*str))
+ *(result++)= ' ';
else
*(result++)= *str;
str++;
@@ -990,6 +1140,108 @@ static size_t escape_string(const char *str, unsigned int len,
}
+static size_t escape_string_hide_passwords(const char *str, unsigned int len,
+ char *result, size_t result_len,
+ const char *word1, size_t word1_len,
+ const char *word2, size_t word2_len,
+ int next_text_string)
+{
+ const char *res_start= result;
+ const char *res_end= result + result_len - 2;
+ size_t d_len;
+ char b_char;
+
+ while (len)
+ {
+ if (len > word1_len + 1 && strncasecmp(str, word1, word1_len) == 0)
+ {
+ const char *next_s= str + word1_len;
+ size_t c;
+
+ if (next_text_string)
+ {
+ while (*next_s && *next_s != '\'' && *next_s != '"')
+ ++next_s;
+ }
+ else
+ {
+ if (word2)
+ {
+ SKIP_SPACES(next_s);
+ if (len < (next_s - str) + word2_len + 1 ||
+ strncasecmp(next_s, word2, word2_len) != 0)
+ goto no_password;
+ next_s+= word2_len;
+ }
+
+ while (*next_s && *next_s != '\'' && *next_s != '"')
+ ++next_s;
+ }
+
+ d_len= next_s - str;
+ if (result + d_len + 5 > res_end)
+ break;
+
+ for (c=0; c<d_len; c++)
+ result[c]= is_space(str[c]) ? ' ' : str[c];
+
+ if (*next_s)
+ {
+ memmove(result + d_len, "*****", 5);
+ result+= d_len + 5;
+ b_char= *(next_s++);
+ }
+ else
+ result+= d_len;
+
+ while (*next_s)
+ {
+ if (*next_s == b_char)
+ {
+ ++next_s;
+ break;
+ }
+ if (*next_s == '\\')
+ {
+ if (next_s[1])
+ next_s++;
+ }
+ next_s++;
+ }
+ len-= next_s - str;
+ str= next_s;
+ continue;
+ }
+no_password:
+ if (result >= res_end)
+ break;
+ if (*str == '\'')
+ {
+ if (result+1 >= res_end)
+ break;
+ *(result++)= '\\';
+ *(result++)= '\'';
+ }
+ else if (*str == '\\')
+ {
+ if (result+1 >= res_end)
+ break;
+ *(result++)= '\\';
+ *(result++)= '\\';
+ }
+ else if (is_space(*str))
+ *(result++)= ' ';
+ else
+ *(result++)= *str;
+ str++;
+ len--;
+ }
+ *result= 0;
+ return result - res_start;
+}
+
+
+
static int do_log_user(const char *name)
{
size_t len;
@@ -1008,17 +1260,111 @@ static int do_log_user(const char *name)
}
+static int get_next_word(const char *query, char *word)
+{
+ int len= 0;
+ char c;
+ while ((c= query[len]))
+ {
+ if (c >= 'a' && c <= 'z')
+ word[len]= 'A' + (c-'a');
+ else if (c >= 'A' && c <= 'Z')
+ word[len]= c;
+ else
+ break;
+
+ if (len++ == MAX_KEYWORD)
+ return 0;
+ }
+ word[len]= 0;
+ return len;
+}
+
+
+static int filter_query_type(const char *query, struct sa_keyword *kwd)
+{
+ int qwe_in_list;
+ char fword[MAX_KEYWORD + 1], nword[MAX_KEYWORD + 1];
+ int len, nlen= 0;
+ const struct sa_keyword *l_keywords;
+
+ while (*query && (is_space(*query) || *query == '(' || *query == '/'))
+ {
+ /* comment handling */
+ if (*query == '/' && query[1] == '*')
+ {
+ if (query[2] == '!')
+ {
+ query+= 3;
+ while (*query >= '0' && *query <= '9')
+ query++;
+ continue;
+ }
+ query+= 2;
+ while (*query)
+ {
+ if (*query=='*' && query[1] == '/')
+ {
+ query+= 2;
+ break;
+ }
+ query++;
+ }
+ continue;
+ }
+ query++;
+ }
+
+ qwe_in_list= 0;
+ if (!(len= get_next_word(query, fword)))
+ goto not_in_list;
+ query+= len+1;
+
+ l_keywords= kwd;
+ while (l_keywords->length)
+ {
+ if (l_keywords->length == len && strncmp(l_keywords->wd, fword, len) == 0)
+ {
+ if (l_keywords->next)
+ {
+ if (nlen == 0)
+ {
+ while (*query && is_space(*query))
+ query++;
+ nlen= get_next_word(query, nword);
+ }
+ if (l_keywords->next->length != nlen ||
+ strncmp(l_keywords->next->wd, nword, nlen) != 0)
+ goto do_loop;
+ }
+
+ qwe_in_list= l_keywords->type;
+ break;
+ };
+do_loop:
+ l_keywords++;
+ }
+
+not_in_list:
+ return qwe_in_list;
+}
+
+
static int log_statement_ex(const struct connection_info *cn,
time_t ev_time, unsigned long thd_id,
const char *query, unsigned int query_len,
int error_code, const char *type)
{
- size_t csize, esc_q_len;
- char message[1024];
- char uh_buffer[768];
+ size_t csize;
+ char message_loc[1024];
+ char *message= message_loc;
+ size_t message_size= sizeof(message_loc);
+ char *uh_buffer;
+ size_t uh_buffer_size;
const char *db;
unsigned int db_length;
long long query_id;
+ int result;
if ((db= cn->db))
db_length= cn->db_length;
@@ -1031,27 +1377,130 @@ static int log_statement_ex(const struct connection_info *cn,
if (!(query_id= cn->query_id))
query_id= query_counter++;
- csize= log_header(message, sizeof(message)-1, &ev_time,
+ if (query == 0)
+ {
+ /* Can happen after the error in mysqld_prepare_stmt() */
+ query= cn->query;
+ query_len= cn->query_length;
+ if (query == 0 || query_len == 0)
+ return 0;
+ }
+
+ if (query && !(events & EVENT_QUERY_ALL) &&
+ (events & EVENT_QUERY))
+ {
+ const char *orig_query= query;
+
+ if (filter_query_type(query, keywords_to_skip))
+ {
+ char fword[MAX_KEYWORD + 1];
+ int len;
+ do
+ {
+ len= get_next_word(query, fword);
+ query+= len ? len : 1;
+ if (len == 3 && strncmp(fword, "FOR", 3) == 0)
+ break;
+ } while (*query);
+
+ if (*query == 0)
+ return 0;
+ }
+
+ if (events & EVENT_QUERY_DDL)
+ {
+ if (!filter_query_type(query, not_ddl_keywords) &&
+ filter_query_type(query, ddl_keywords))
+ goto do_log_query;
+ }
+ if (events & EVENT_QUERY_DML)
+ {
+ if (filter_query_type(query, dml_keywords))
+ goto do_log_query;
+ }
+ if (events & EVENT_QUERY_DCL)
+ {
+ if (filter_query_type(query, dcl_keywords))
+ goto do_log_query;
+ }
+
+ return 0;
+do_log_query:
+ query= orig_query;
+ }
+
+ csize= log_header(message, message_size-1, &ev_time,
servhost, servhost_len,
cn->user, cn->user_length,cn->host, cn->host_length,
cn->ip, cn->ip_length, thd_id, query_id, type);
- csize+= my_snprintf(message+csize, sizeof(message) - 1 - csize,
- ",%.*s", db_length, db);
+ csize+= my_snprintf(message+csize, message_size - 1 - csize,
+ ",%.*s,\'", db_length, db);
- if (query == 0)
+ if (query_log_limit > 0 && query_len > query_log_limit)
+ query_len= query_log_limit;
+
+ if (query_len > (message_size - csize)/2)
{
- /* Can happen after the error in mysqld_prepare_stmt() */
- query= cn->query;
- query_len= cn->query_length;
+ flogger_mutex_lock(&lock_bigbuffer);
+ if (big_buffer_alloced < (query_len * 2 + csize))
+ {
+ big_buffer_alloced= (query_len * 2 + csize + 4095) & ~4095L;
+ big_buffer= realloc(big_buffer, big_buffer_alloced);
+ if (big_buffer == NULL)
+ {
+ big_buffer_alloced= 0;
+ return 0;
+ }
+ }
+
+ memcpy(big_buffer, message, csize);
+ message= big_buffer;
+ message_size= big_buffer_alloced;
}
- esc_q_len= escape_string(query, query_len,
- uh_buffer, sizeof(uh_buffer));
- csize+= my_snprintf(message+csize, sizeof(message) - 1 - csize,
- ",\'%.*s\',%d", esc_q_len, uh_buffer, error_code);
+ uh_buffer= message + csize;
+ uh_buffer_size= message_size - csize;
+ if (query_log_limit > 0 && uh_buffer_size > query_log_limit+2)
+ uh_buffer_size= query_log_limit+2;
+
+ switch (filter_query_type(query, passwd_keywords))
+ {
+ case SQLCOM_GRANT:
+ case SQLCOM_CREATE_USER:
+ csize+= escape_string_hide_passwords(query, query_len,
+ uh_buffer, uh_buffer_size,
+ "IDENTIFIED", 10, "BY", 2, 0);
+ break;
+ case SQLCOM_CHANGE_MASTER:
+ csize+= escape_string_hide_passwords(query, query_len,
+ uh_buffer, uh_buffer_size,
+ "MASTER_PASSWORD", 15, "=", 1, 0);
+ break;
+ case SQLCOM_CREATE_SERVER:
+ case SQLCOM_ALTER_SERVER:
+ csize+= escape_string_hide_passwords(query, query_len,
+ uh_buffer, uh_buffer_size,
+ "PASSWORD", 8, NULL, 0, 0);
+ break;
+ case SQLCOM_SET_OPTION:
+ csize+= escape_string_hide_passwords(query, query_len,
+ uh_buffer, uh_buffer_size,
+ "=", 1, NULL, 0, 1);
+ break;
+ default:
+ csize+= escape_string(query, query_len,
+ uh_buffer, uh_buffer_size);
+ break;
+ }
+ csize+= my_snprintf(message+csize, message_size - 1 - csize,
+ "\',%d", error_code);
message[csize]= '\n';
- return write_log(message, csize + 1);
+ result= write_log(message, csize + 1);
+ if (message == big_buffer)
+ flogger_mutex_unlock(&lock_bigbuffer);
+
+ return result;
}
@@ -1396,6 +1845,105 @@ exit_func:
}
+#ifdef DBUG_OFF
+ #ifdef __x86_64__
+static const int cmd_off= 4200;
+static const int db_off= 120;
+static const int db_len_off= 128;
+ #else
+static const int cmd_off= 2668;
+static const int db_off= 60;
+static const int db_len_off= 64;
+ #endif /*x86_64*/
+#else
+ #ifdef __x86_64__
+static const int cmd_off= 4432;
+static const int db_off= 120;
+static const int db_len_off= 128;
+ #else
+static const int cmd_off= 2808;
+static const int db_off= 64;
+static const int db_len_off= 68;
+ #endif /*x86_64*/
+#endif /*DBUG_OFF*/
+
+struct mysql_event_general_v8
+{
+ unsigned int event_class;
+ unsigned int event_subclass;
+ int general_error_code;
+ unsigned long general_thread_id;
+ const char *general_user;
+ unsigned int general_user_length;
+ const char *general_command;
+ unsigned int general_command_length;
+ const char *general_query;
+ unsigned int general_query_length;
+ struct charset_info_st *general_charset;
+ unsigned long long general_time;
+ unsigned long long general_rows;
+};
+
+static void auditing_v8(MYSQL_THD thd, struct mysql_event_general_v8 *ev_v8)
+{
+ struct mysql_event_general event;
+
+ if (ev_v8->event_class != MYSQL_AUDIT_GENERAL_CLASS)
+ return;
+
+ event.event_subclass= ev_v8->event_subclass;
+ event.general_error_code= ev_v8->general_error_code;
+ event.general_thread_id= ev_v8->general_thread_id;
+ event.general_user= ev_v8->general_user;
+ event.general_user_length= ev_v8->general_user_length;
+ event.general_command= ev_v8->general_command;
+ event.general_command_length= ev_v8->general_command_length;
+ event.general_query= ev_v8->general_query;
+ event.general_query_length= ev_v8->general_query_length;
+ event.general_charset= ev_v8->general_charset;
+ event.general_time= ev_v8->general_time;
+ event.general_rows= ev_v8->general_rows;
+ event.database= 0;
+ event.database_length= 0;
+
+ if (event.general_query_length > 0)
+ {
+ event.event_subclass= MYSQL_AUDIT_GENERAL_STATUS;
+ event.general_command= "Query";
+ event.general_command_length= 5;
+#ifdef __linux__
+ event.database= *(char **) (((char *) thd) + db_off);
+ event.database_length= *(size_t *) (((char *) thd) + db_len_off);
+#endif /*__linux*/
+ }
+#ifdef __linux__
+ else if (*((int *) (((char *)thd) + cmd_off)) == 2)
+ {
+ event.event_subclass= MYSQL_AUDIT_GENERAL_LOG;
+ event.general_command= "Init DB";
+ event.general_command_length= 7;
+ event.general_query= *(char **) (((char *) thd) + db_off);
+ event.general_query_length= *(size_t *) (((char *) thd) + db_len_off);
+ }
+#endif /*__linux*/
+ auditing(thd, ev_v8->event_class, &event);
+}
+
+
+static void auditing_v13(MYSQL_THD thd, unsigned int *ev_v0)
+{
+ struct mysql_event_general event= *(const struct mysql_event_general *) (ev_v0+1);
+
+ if (event.general_query_length > 0)
+ {
+ event.event_subclass= MYSQL_AUDIT_GENERAL_STATUS;
+ event.general_command= "Query";
+ event.general_command_length= 5;
+ }
+ auditing(thd, ev_v0[0], &event);
+}
+
+
/*
As it's just too difficult to #include "sql_class.h",
let's just copy the necessary part of the system_variables
@@ -1471,15 +2019,19 @@ typedef struct loc_system_variables
ulong query_cache_type;
} LOC_SV;
+
static int server_audit_init(void *p __attribute__((unused)))
{
const void *my_hash_init_ptr;
+
+ if (!serv_ver)
+ {
#ifdef _WIN32
- serv_ver= (const char *) GetProcAddress(0, "server_version");
+ serv_ver= (const char *) GetProcAddress(0, "server_version");
#else
- serv_ver= server_version;
+ serv_ver= server_version;
#endif /*_WIN32*/
-
+ }
my_hash_init_ptr= dlsym(RTLD_DEFAULT, "_my_hash_init");
if (!my_hash_init_ptr)
{
@@ -1487,8 +2039,14 @@ static int server_audit_init(void *p __attribute__((unused)))
my_hash_init_ptr= dlsym(RTLD_DEFAULT, "my_hash_init2");
}
+ if(!(int_mysql_data_home= dlsym(RTLD_DEFAULT, "mysql_data_home")))
+ {
+ if(!(int_mysql_data_home= dlsym(RTLD_DEFAULT, "?mysql_data_home@@3PADA")))
+ int_mysql_data_home= &default_home;
+ }
+
if (!serv_ver || !my_hash_init_ptr)
- return 0;
+ return 1;
if (!started_mysql)
{
@@ -1499,7 +2057,6 @@ static int server_audit_init(void *p __attribute__((unused)))
}
}
-
if (gethostname(servhost, sizeof(servhost)))
strcpy(servhost, "unknown");
@@ -1511,6 +2068,7 @@ static int server_audit_init(void *p __attribute__((unused)))
PSI_server->register_mutex("server_audit", mutex_key_list, 1);
#endif
flogger_mutex_init(key_LOCK_operations, &lock_operations, MY_MUTEX_INIT_FAST);
+ flogger_mutex_init(key_LOCK_operations, &lock_bigbuffer, MY_MUTEX_INIT_FAST);
my_hash_clear(&incl_user_hash);
my_hash_clear(&excl_user_hash);
@@ -1587,7 +2145,10 @@ static int server_audit_deinit(void *p __attribute__((unused)))
logger_close(logfile);
else if (output_type == OUTPUT_SYSLOG)
closelog();
+
+ (void) free(big_buffer);
flogger_mutex_destroy(&lock_operations);
+ flogger_mutex_destroy(&lock_bigbuffer);
error_header();
fprintf(stderr, "STOPPED\n");
@@ -1618,8 +2179,8 @@ mysql_declare_plugin(server_audit)
MYSQL_AUDIT_PLUGIN,
&mysql_descriptor,
"SERVER_AUDIT",
- " Alexey Botchkov (MariaDB)",
- "Audit the server activity.",
+ " Alexey Botchkov (MariaDB Corporation)",
+ "Audit the server activity",
PLUGIN_LICENSE_GPL,
server_audit_init_mysql,
server_audit_deinit,
@@ -1646,8 +2207,8 @@ maria_declare_plugin(server_audit)
MYSQL_AUDIT_PLUGIN,
&maria_descriptor,
"SERVER_AUDIT",
- "Alexey Botchkov (MariaDB)",
- "Audit the server activity.",
+ "Alexey Botchkov (MariaDB Corporation)",
+ "Audit the server activity",
PLUGIN_LICENSE_GPL,
server_audit_init,
server_audit_deinit,
@@ -1688,10 +2249,12 @@ static void update_file_path(MYSQL_THD thd,
struct st_mysql_sys_var *var __attribute__((unused)),
void *var_ptr __attribute__((unused)), const void *save)
{
+ char *new_name= (*(char **) save) ? *(char **) save : empty_str;
+
flogger_mutex_lock(&lock_operations);
internal_stop_logging= 1;
error_header();
- fprintf(stderr, "Log file name was changed to '%s'.\n", *(const char **) save);
+ fprintf(stderr, "Log file name was changed to '%s'.\n", new_name);
if (logging)
log_current_query(thd);
@@ -1700,7 +2263,7 @@ static void update_file_path(MYSQL_THD thd,
{
char *sav_path= file_path;
- file_path= *(char **) save;
+ file_path= new_name;
internal_stop_logging= 1;
stop_logging();
if (start_logging())
@@ -1720,7 +2283,7 @@ static void update_file_path(MYSQL_THD thd,
internal_stop_logging= 0;
}
- strncpy(path_buffer, *(const char **) save, sizeof(path_buffer));
+ strncpy(path_buffer, new_name, sizeof(path_buffer));
file_path= path_buffer;
exit_func:
internal_stop_logging= 0;
@@ -1767,9 +2330,10 @@ static void update_incl_users(MYSQL_THD thd,
struct st_mysql_sys_var *var __attribute__((unused)),
void *var_ptr __attribute__((unused)), const void *save)
{
+ char *new_users= (*(char **) save) ? *(char **) save : empty_str;
flogger_mutex_lock(&lock_operations);
mark_always_logged(thd);
- strncpy(incl_user_buffer, *(const char **) save, sizeof(incl_user_buffer));
+ strncpy(incl_user_buffer, new_users, sizeof(incl_user_buffer));
incl_users= incl_user_buffer;
user_hash_fill(&incl_user_hash, incl_users, &excl_user_hash, 1);
error_header();
@@ -1782,9 +2346,10 @@ static void update_excl_users(MYSQL_THD thd __attribute__((unused)),
struct st_mysql_sys_var *var __attribute__((unused)),
void *var_ptr __attribute__((unused)), const void *save)
{
+ char *new_users= (*(char **) save) ? *(char **) save : empty_str;
flogger_mutex_lock(&lock_operations);
mark_always_logged(thd);
- strncpy(excl_user_buffer, *(const char **) save, sizeof(excl_user_buffer));
+ strncpy(excl_user_buffer, new_users, sizeof(excl_user_buffer));
excl_users= excl_user_buffer;
user_hash_fill(&excl_user_hash, excl_users, &incl_user_hash, 0);
error_header();
@@ -1909,8 +2474,8 @@ static void update_syslog_ident(MYSQL_THD thd __attribute__((unused)),
struct st_mysql_sys_var *var __attribute__((unused)),
void *var_ptr __attribute__((unused)), const void *save)
{
- strncpy(syslog_ident_buffer, *(const char **) save,
- sizeof(syslog_ident_buffer));
+ char *new_ident= (*(char **) save) ? *(char **) save : empty_str;
+ strncpy(syslog_ident_buffer, new_ident, sizeof(syslog_ident_buffer));
syslog_ident= syslog_ident_buffer;
error_header();
fprintf(stderr, "SYSYLOG ident was changed to '%s'\n", syslog_ident);
@@ -1925,3 +2490,48 @@ static void update_syslog_ident(MYSQL_THD thd __attribute__((unused)),
}
+#ifdef _WIN32
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+{
+ if (fdwReason != DLL_PROCESS_ATTACH)
+ return 1;
+
+ serv_ver= (const char *) GetProcAddress(0, "server_version");
+#else
+void __attribute__ ((constructor)) audit_plugin_so_init(void)
+{
+ serv_ver= server_version;
+#endif /*_WIN32*/
+
+ if (!serv_ver)
+ goto exit;
+
+ started_mariadb= strstr(serv_ver, "MariaDB") != 0;
+
+ if (!started_mariadb)
+ {
+ if (serv_ver[0] == '5' && serv_ver[2] == '5')
+ {
+ int sc= serv_ver[4] - '0';
+ if (serv_ver[5] >= '0' && serv_ver[5] <= '9')
+ sc= sc * 10 + serv_ver[5] - '0';
+ if (sc <= 10)
+ {
+ mysql_descriptor.interface_version= 0x0200;
+ mysql_descriptor.event_notify= (void *) auditing_v8;
+ }
+ else if (sc < 14)
+ {
+ mysql_descriptor.interface_version= 0x0200;
+ mysql_descriptor.event_notify= (void *) auditing_v13;
+ }
+ }
+ }
+exit:
+#ifdef _WIN32
+ return 1;
+#else
+ return;
+#endif
+}
+
diff --git a/plugin/win_auth_client/CMakeLists.txt b/plugin/win_auth_client/CMakeLists.txt
index 75ee55117bd..5d72d24d6ad 100644
--- a/plugin/win_auth_client/CMakeLists.txt
+++ b/plugin/win_auth_client/CMakeLists.txt
@@ -29,7 +29,7 @@ IF(WIN32)
MYSQL_ADD_PLUGIN(authentication_windows_client ${PLUGIN_SOURCES} ${HEADERS}
LINK_LIBRARIES Secur32
- MODULE_ONLY COMPONENT SharedLibraries)
+ MODULE_ONLY COMPONENT ClientPlugins)
#IF(MSVC)
# INSTALL_DEBUG_TARGET(auth_win_client DESTINATION ${INSTALL_LIBDIR}/debug)
diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt
index eadd6ae5af0..79d87fcf6be 100644
--- a/scripts/CMakeLists.txt
+++ b/scripts/CMakeLists.txt
@@ -147,22 +147,16 @@ SET(CONFIGURE_LINE "Built using CMake")
# Also required for mysqlbug, autoconf only supports --version so for now we
# just explicitly require GNU
-IF(CMAKE_COMPILER_IS_GNUCC)
- EXECUTE_PROCESS(
- COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1} --version
- COMMAND sed 1q
- OUTPUT_VARIABLE CC_VERSION)
-ELSE()
- SET(CC_VERSION "")
-ENDIF()
-IF(CMAKE_COMPILER_IS_GNUCXX)
- EXECUTE_PROCESS(
- COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} --version
- COMMAND sed 1q
- OUTPUT_VARIABLE CXX_VERSION)
-ELSE()
- SET(CXX_VERSION "")
-ENDIF()
+EXECUTE_PROCESS(
+ COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1} --version
+ COMMAND sed 1q
+ ERROR_QUIET
+ OUTPUT_VARIABLE CC_VERSION)
+EXECUTE_PROCESS(
+ COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} --version
+ COMMAND sed 1q
+ ERROR_QUIET
+ OUTPUT_VARIABLE CXX_VERSION)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysqlbug.sh
${CMAKE_CURRENT_BINARY_DIR}/mysqlbug ESCAPE_QUOTES @ONLY)
diff --git a/scripts/mysql_install_db.pl.in b/scripts/mysql_install_db.pl.in
index bfb910278b2..4d3641397d0 100644
--- a/scripts/mysql_install_db.pl.in
+++ b/scripts/mysql_install_db.pl.in
@@ -65,8 +65,8 @@ Usage: $0 [OPTIONS]
Read this file after the global files are read.
--defaults-file=name Only read default options from the given file name.
--force Causes mysql_install_db to run even if DNS does not
- work. In that case, grant table entries that normally
- use hostnames will use IP addresses.
+ work. In that case, grant table entries that
+ normally use hostnames will use IP addresses.
--help Display this help and exit.
--ldata=path The path to the MySQL data directory. Same as --datadir.
--no-defaults Don't read default options from any option file.
diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh
index 0487c311a0d..6cfe75961f3 100644
--- a/scripts/mysql_install_db.sh
+++ b/scripts/mysql_install_db.sh
@@ -50,8 +50,8 @@ Usage: $0 [OPTIONS]
Read this file after the global files are read.
--defaults-file=name Only read default options from the given file name.
--force Causes mysql_install_db to run even if DNS does not
- work. In that case, grant table entries that normally
- use hostnames will use IP addresses.
+ work. In that case, grant table entries that
+ normally use hostnames will use IP addresses.
--help Display this help and exit.
--ldata=path The path to the MariaDB data directory. Same as
--datadir.
diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh
index 0293631fb56..fdb4464a98f 100644
--- a/scripts/mysqld_safe.sh
+++ b/scripts/mysqld_safe.sh
@@ -28,6 +28,7 @@ syslog_tag=
user='@MYSQLD_USER@'
pid_file=
err_log=
+err_log_base=
syslog_tag_mysqld=mysqld
syslog_tag_mysqld_safe=mysqld_safe
@@ -202,7 +203,7 @@ parse_arguments() {
--user=*) user="$val"; SET_USER=1 ;;
--log[-_]basename=*|--hostname=*|--loose[-_]log[-_]basename=*)
pid_file="$val.pid";
- err_log="$val.err";
+ err_log_base="$val";
;;
# these might have been set in a [mysqld_safe] section of my.cnf
@@ -520,7 +521,7 @@ if [ -n "${PLUGIN_DIR}" ]; then
plugin_dir="${PLUGIN_DIR}"
else
# Try to find plugin dir relative to basedir
- for dir in lib/mysql/plugin lib/plugin
+ for dir in lib64/mysql/plugin lib64/plugin lib/mysql/plugin lib/plugin
do
if [ -d "${MY_BASEDIR_VERSION}/${dir}" ]; then
plugin_dir="${MY_BASEDIR_VERSION}/${dir}"
@@ -570,7 +571,16 @@ then
* ) err_log="$DATADIR/$err_log" ;;
esac
else
- err_log=$DATADIR/`@HOSTNAME@`.err
+ if [ -n "$err_log_base" ]
+ then
+ err_log=$err_log_base.err
+ case "$err_log" in
+ /* ) ;;
+ * ) err_log="$DATADIR/$err_log" ;;
+ esac
+ else
+ err_log=$DATADIR/`@HOSTNAME@`.err
+ fi
fi
append_arg_to_args "--log-error=$err_log"
diff --git a/sql-common/client.c b/sql-common/client.c
index 20ccd73596c..acfdd8531e2 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -1,5 +1,5 @@
-/* Copyright (c) 2003, 2013, Oracle and/or its affiliates.
- Copyright (c) 2009, 2013, Monty Program Ab
+/* Copyright (c) 2003, 2014, Oracle and/or its affiliates.
+ Copyright (c) 2009, 2015, MariaDB
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
@@ -1848,6 +1848,7 @@ mysql_ssl_set(MYSQL *mysql __attribute__((unused)) ,
mysql_options(mysql, MYSQL_OPT_SSL_CAPATH, capath) |
mysql_options(mysql, MYSQL_OPT_SSL_CIPHER, cipher) ?
1 : 0);
+ mysql->options.use_ssl= TRUE;
#endif /* HAVE_OPENSSL && !EMBEDDED_LIBRARY */
DBUG_RETURN(result);
}
@@ -1942,7 +1943,7 @@ static int ssl_verify_server_cert(Vio *vio, const char* server_hostname, const c
SSL *ssl;
X509 *server_cert;
char *cp1, *cp2;
- char buf[256];
+ char *buf;
DBUG_ENTER("ssl_verify_server_cert");
DBUG_PRINT("enter", ("server_hostname: %s", server_hostname));
@@ -1976,9 +1977,15 @@ static int ssl_verify_server_cert(Vio *vio, const char* server_hostname, const c
are what we expect.
*/
- X509_NAME_oneline(X509_get_subject_name(server_cert), buf, sizeof(buf));
+ buf= X509_NAME_oneline(X509_get_subject_name(server_cert), 0, 0);
X509_free (server_cert);
+ if (!buf)
+ {
+ *errptr= "Out of memory";
+ DBUG_RETURN(1);
+ }
+
DBUG_PRINT("info", ("hostname in cert: %s", buf));
cp1= strstr(buf, "/CN=");
if (cp1)
@@ -1991,11 +1998,13 @@ static int ssl_verify_server_cert(Vio *vio, const char* server_hostname, const c
DBUG_PRINT("info", ("Server hostname in cert: %s", cp1));
if (!strcmp(cp1, server_hostname))
{
+ free(buf);
/* Success */
DBUG_RETURN(0);
}
}
*errptr= "SSL certificate validation failure";
+ free(buf);
DBUG_RETURN(1);
}
@@ -2644,16 +2653,10 @@ static int send_client_reply_packet(MCPVIO_EXT *mpvio,
mysql->client_flag|= CLIENT_MULTI_RESULTS;
#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
- if (mysql->options.ssl_key || mysql->options.ssl_cert ||
- mysql->options.ssl_ca || mysql->options.ssl_capath ||
- mysql->options.ssl_cipher ||
- (mysql->options.extension &&
- (mysql->options.extension->ssl_crl ||
- mysql->options.extension->ssl_crlpath)))
- mysql->options.use_ssl= 1;
if (mysql->options.use_ssl)
mysql->client_flag|= CLIENT_SSL;
#endif /* HAVE_OPENSSL && !EMBEDDED_LIBRARY*/
+
if (mpvio->db)
mysql->client_flag|= CLIENT_CONNECT_WITH_DB;
@@ -2682,6 +2685,23 @@ static int send_client_reply_packet(MCPVIO_EXT *mpvio,
end= buff+5;
}
#ifdef HAVE_OPENSSL
+
+ /*
+ If client uses ssl and client also has to verify the server
+ certificate, a ssl connection is required.
+ If the server does not support ssl, we abort the connection.
+ */
+ if (mysql->options.use_ssl &&
+ (mysql->client_flag & CLIENT_SSL_VERIFY_SERVER_CERT) &&
+ !(mysql->server_capabilities & CLIENT_SSL))
+ {
+ set_mysql_extended_error(mysql, CR_SSL_CONNECTION_ERROR, unknown_sqlstate,
+ ER(CR_SSL_CONNECTION_ERROR),
+ "SSL is required, but the server does not "
+ "support it");
+ goto error;
+ }
+
if (mysql->client_flag & CLIENT_SSL)
{
/* Do the SSL layering. */
diff --git a/sql-common/my_time.c b/sql-common/my_time.c
index 6a011df795a..28757a2c96c 100644
--- a/sql-common/my_time.c
+++ b/sql-common/my_time.c
@@ -1314,16 +1314,8 @@ int number_to_time(my_bool neg, ulonglong nr, ulong sec_part,
MYSQL_TIME *ltime, int *was_cut)
{
if (nr > 9999999 && nr < 99991231235959ULL && neg == 0)
- {
- if (number_to_datetime(nr, sec_part, ltime,
- TIME_INVALID_DATES, was_cut) < 0)
- return -1;
-
- ltime->year= ltime->month= ltime->day= 0;
- ltime->time_type= MYSQL_TIMESTAMP_TIME;
- *was_cut= MYSQL_TIME_NOTE_TRUNCATED;
- return 0;
- }
+ return number_to_datetime(nr, sec_part, ltime,
+ TIME_INVALID_DATES, was_cut) < 0 ? -1 : 0;
*was_cut= 0;
ltime->year= ltime->month= ltime->day= 0;
diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt
index c59ae3b7846..88ec26eb6f6 100644
--- a/sql/CMakeLists.txt
+++ b/sql/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Copyright (c) 2006, 2013, Oracle and/or its affiliates.
+# Copyright (c) 2006, 2014, Oracle and/or its affiliates.
+# Copyright (c) 2010, 2015, MariaDB
#
# 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,8 +28,26 @@ ${CMAKE_CURRENT_BINARY_DIR}/sql_yacc.h
${CMAKE_CURRENT_BINARY_DIR}/sql_yacc.cc
${CMAKE_CURRENT_BINARY_DIR}/lex_hash.h
)
+SET(GEN_DIGEST_SOURCES
+ ${CMAKE_CURRENT_BINARY_DIR}/lex_token.h
+)
+
+SET_SOURCE_FILES_PROPERTIES(${GEN_SOURCES}
+ ${GEN_DIGEST_SOURCES}
+ PROPERTIES GENERATED 1)
+
+# Gen_lex_token
+# Make sure sql_yacc.h is generated before compiling gen_lex_token
+IF(NOT CMAKE_CROSSCOMPILING)
+ ADD_EXECUTABLE(gen_lex_token gen_lex_token.cc)
+ ADD_DEPENDENCIES(gen_lex_token GenServerSource)
+ENDIF()
-SET_SOURCE_FILES_PROPERTIES(${GEN_SOURCES} PROPERTIES GENERATED 1)
+ADD_CUSTOM_COMMAND(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_token.h
+ COMMAND gen_lex_token > lex_token.h
+ DEPENDS gen_lex_token
+)
ADD_DEFINITIONS(-DMYSQL_SERVER -DHAVE_EVENT_SCHEDULER)
@@ -58,7 +77,8 @@ SET (SQL_SOURCE
slave.cc sp.cc sp_cache.cc sp_head.cc sp_pcontext.cc
sp_rcontext.cc spatial.cc sql_acl.cc sql_analyse.cc sql_base.cc
sql_cache.cc sql_class.cc sql_client.cc sql_crypt.cc sql_crypt.h
- sql_cursor.cc sql_db.cc sql_delete.cc sql_derived.cc sql_do.cc
+ sql_cursor.cc sql_db.cc sql_delete.cc sql_derived.cc
+ sql_digest.cc sql_do.cc
sql_error.cc sql_handler.cc sql_get_diagnostics.cc
sql_help.cc sql_insert.cc sql_lex.cc
sql_list.cc sql_load.cc sql_manager.cc
@@ -95,6 +115,7 @@ SET (SQL_SOURCE
table_cache.cc
${CMAKE_CURRENT_BINARY_DIR}/sql_builtin.cc
${GEN_SOURCES}
+ ${GEN_DIGEST_SOURCES}
${MYSYS_LIBWRAP_SOURCE}
)
@@ -115,6 +136,7 @@ RECOMPILE_FOR_EMBEDDED)
ADD_LIBRARY(sql STATIC ${SQL_SOURCE})
ADD_DEPENDENCIES(sql GenServerSource)
+ADD_DEPENDENCIES(sql GenDigestServerSource)
DTRACE_INSTRUMENT(sql)
TARGET_LINK_LIBRARIES(sql ${MYSQLD_STATIC_PLUGIN_LIBS}
mysys mysys_ssl dbug strings vio pcre ${LIBJEMALLOC}
@@ -244,6 +266,11 @@ ADD_CUSTOM_TARGET(
DEPENDS ${GEN_SOURCES}
)
+ADD_CUSTOM_TARGET(
+ GenDigestServerSource
+ DEPENDS ${GEN_DIGEST_SOURCES}
+)
+
#Need this only for embedded
SET_TARGET_PROPERTIES(GenServerSource PROPERTIES EXCLUDE_FROM_ALL TRUE)
@@ -263,14 +290,15 @@ IF(WIN32 OR HAVE_DLOPEN AND NOT DISABLE_SHARED)
ENDIF()
FOREACH(tool glibtoolize libtoolize aclocal autoconf autoheader automake gtar
- tar bzr)
+ tar git)
STRING(TOUPPER ${tool} TOOL)
FIND_PROGRAM(${TOOL}_EXECUTABLE ${tool} DOC "path to the executable")
MARK_AS_ADVANCED(${TOOL}_EXECUTABLE)
ENDFOREACH()
CONFIGURE_FILE(
- ${CMAKE_SOURCE_DIR}/cmake/make_dist.cmake.in ${CMAKE_BINARY_DIR}/make_dist.cmake @ONLY)
+ ${CMAKE_SOURCE_DIR}/cmake/make_dist.cmake.in
+ ${CMAKE_BINARY_DIR}/make_dist.cmake @ONLY)
ADD_CUSTOM_TARGET(dist
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/make_dist.cmake
@@ -280,8 +308,7 @@ ADD_CUSTOM_TARGET(dist
ADD_CUSTOM_TARGET(distclean
COMMAND ${CMAKE_COMMAND} -E echo WARNING: distclean target is not functional
- COMMAND ${CMAKE_COMMAND} -E echo Use 'bzr clean-tree' with --unknown and/or
- --ignored parameter instead
+ COMMAND ${CMAKE_COMMAND} -E echo Use 'git clean -fdx' instead
VERBATIM
)
diff --git a/sql/event_scheduler.cc b/sql/event_scheduler.cc
index f2b3a77f414..5c4926c830c 100644
--- a/sql/event_scheduler.cc
+++ b/sql/event_scheduler.cc
@@ -301,6 +301,9 @@ Event_worker_thread::run(THD *thd, Event_queue_element_for_exec *event)
Event_job_data job_data;
bool res;
+ DBUG_ASSERT(thd->m_digest == NULL);
+ DBUG_ASSERT(thd->m_statement_psi == NULL);
+
thd->thread_stack= &my_stack; // remember where our stack is
res= post_init_event_thread(thd);
@@ -329,6 +332,8 @@ Event_worker_thread::run(THD *thd, Event_queue_element_for_exec *event)
job_data.definer.str,
job_data.dbname.str, job_data.name.str);
end:
+ DBUG_ASSERT(thd->m_statement_psi == NULL);
+ DBUG_ASSERT(thd->m_digest == NULL);
DBUG_PRINT("info", ("Done with Event %s.%s", event->dbname.str,
event->name.str));
diff --git a/sql/field.cc b/sql/field.cc
index e7e046a8458..c5319ae0b72 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -1307,18 +1307,13 @@ int Field_num::check_int(CHARSET_INFO *cs, const char *str, int length,
if (str == int_end || error == MY_ERRNO_EDOM)
{
ErrConvString err(str, length, cs);
- push_warning_printf(get_thd(), Sql_condition::WARN_LEVEL_WARN,
- ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
- ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
- "integer", err.ptr(), field_name,
- (ulong) table->in_use->get_stmt_da()->
- current_row_for_warning());
+ set_warning_truncated_wrong_value("integer", err.ptr());
return 1;
}
/* Test if we have garbage at the end of the given string. */
if (test_if_important_data(cs, int_end, str + length))
{
- set_warning(Sql_condition::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1);
+ set_warning(WARN_DATA_TRUNCATED, 1);
return 2;
}
return 0;
@@ -1387,7 +1382,7 @@ bool Field_num::get_int(CHARSET_INFO *cs, const char *from, uint len,
return 0;
out_of_range:
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
return 1;
}
@@ -1408,12 +1403,12 @@ int Field::warn_if_overflow(int op_result)
{
if (op_result == E_DEC_OVERFLOW)
{
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
return 1;
}
if (op_result == E_DEC_TRUNCATED)
{
- set_warning(Sql_condition::WARN_LEVEL_NOTE, WARN_DATA_TRUNCATED, 1);
+ set_note(WARN_DATA_TRUNCATED, 1);
/* We return 0 here as this is not a critical issue */
}
return 0;
@@ -1739,7 +1734,7 @@ longlong Field::convert_decimal2longlong(const my_decimal *val,
{
if (val->sign())
{
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
i= 0;
*err= 1;
}
@@ -2047,7 +2042,7 @@ void Field_decimal::overflow(bool negative)
uint len=field_length;
uchar *to=ptr, filler= '9';
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
if (negative)
{
if (!unsigned_flag)
@@ -2155,7 +2150,7 @@ int Field_decimal::store(const char *from_arg, uint len, CHARSET_INFO *cs)
from++;
if (from == end)
{
- set_warning(Sql_condition::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1);
+ set_warning(WARN_DATA_TRUNCATED, 1);
is_cuted_fields_incr=1;
}
else if (*from == '+' || *from == '-') // Found some sign ?
@@ -2231,7 +2226,7 @@ int Field_decimal::store(const char *from_arg, uint len, CHARSET_INFO *cs)
for (;from != end && my_isspace(&my_charset_bin, *from); from++) ;
if (from != end) // If still something left, warn
{
- set_warning(Sql_condition::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1);
+ set_warning(WARN_DATA_TRUNCATED, 1);
is_cuted_fields_incr=1;
}
}
@@ -2409,8 +2404,7 @@ int Field_decimal::store(const char *from_arg, uint len, CHARSET_INFO *cs)
if (tmp_char != '0') // Losing a non zero digit ?
{
if (!is_cuted_fields_incr)
- set_warning(Sql_condition::WARN_LEVEL_WARN,
- WARN_DATA_TRUNCATED, 1);
+ set_warning(WARN_DATA_TRUNCATED, 1);
return 0;
}
continue;
@@ -2432,7 +2426,7 @@ int Field_decimal::store(const char *from_arg, uint len, CHARSET_INFO *cs)
This is a note, not a warning, as we don't want to abort
when we cut decimals in strict mode
*/
- set_warning(Sql_condition::WARN_LEVEL_NOTE, WARN_DATA_TRUNCATED, 1);
+ set_note(WARN_DATA_TRUNCATED, 1);
}
return 0;
}
@@ -2633,7 +2627,7 @@ void Field_decimal::sql_type(String &res) const
if (dec)
tmp--;
res.length(cs->cset->snprintf(cs,(char*) res.ptr(),res.alloced_length(),
- "decimal(%d,%d)",tmp,dec));
+ "decimal(%d,%d)/*old*/",tmp,dec));
add_zerofill_and_unsigned(res);
}
@@ -2782,7 +2776,7 @@ bool Field_new_decimal::store_value(const my_decimal *decimal_value)
if (unsigned_flag && decimal_value->sign())
{
DBUG_PRINT("info", ("unsigned overflow"));
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
decimal_value= &decimal_zero;
}
@@ -2826,32 +2820,22 @@ int Field_new_decimal::store(const char *from, uint length,
thd->abort_on_warning)
{
ErrConvString errmsg(from, length, charset_arg);
- push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
- ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
- "decimal", errmsg.ptr(), field_name,
- static_cast<ulong>(thd->get_stmt_da()->
- current_row_for_warning()));
+ set_warning_truncated_wrong_value("decimal", errmsg.ptr());
DBUG_RETURN(err);
}
switch (err) {
case E_DEC_TRUNCATED:
- set_warning(Sql_condition::WARN_LEVEL_NOTE, WARN_DATA_TRUNCATED, 1);
+ set_note(WARN_DATA_TRUNCATED, 1);
break;
case E_DEC_OVERFLOW:
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
set_value_on_overflow(&decimal_value, decimal_value.sign());
break;
case E_DEC_BAD_NUM:
{
ErrConvString errmsg(from, length, charset_arg);
- push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
- ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
- "decimal", errmsg.ptr(), field_name,
- static_cast<ulong>(thd->get_stmt_da()->
- current_row_for_warning()));
+ set_warning_truncated_wrong_value("decimal", errmsg.ptr());
my_decimal_set_zero(&decimal_value);
break;
}
@@ -3158,13 +3142,13 @@ int Field_tiny::store(double nr)
if (nr < 0.0)
{
*ptr=0;
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else if (nr > 255.0)
{
*ptr= (uchar) 255;
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else
@@ -3175,13 +3159,13 @@ int Field_tiny::store(double nr)
if (nr < -128.0)
{
*ptr= (uchar) -128;
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else if (nr > 127.0)
{
*ptr=127;
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else
@@ -3201,13 +3185,13 @@ int Field_tiny::store(longlong nr, bool unsigned_val)
if (nr < 0 && !unsigned_val)
{
*ptr= 0;
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else if ((ulonglong) nr > (ulonglong) 255)
{
*ptr= (char) 255;
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else
@@ -3220,13 +3204,13 @@ int Field_tiny::store(longlong nr, bool unsigned_val)
if (nr < -128)
{
*ptr= (char) -128;
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else if (nr > 127)
{
*ptr=127;
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else
@@ -3337,13 +3321,13 @@ int Field_short::store(double nr)
if (nr < 0)
{
res=0;
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else if (nr > (double) UINT_MAX16)
{
res=(int16) UINT_MAX16;
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else
@@ -3354,13 +3338,13 @@ int Field_short::store(double nr)
if (nr < (double) INT_MIN16)
{
res=INT_MIN16;
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else if (nr > (double) INT_MAX16)
{
res=INT_MAX16;
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else
@@ -3382,13 +3366,13 @@ int Field_short::store(longlong nr, bool unsigned_val)
if (nr < 0L && !unsigned_val)
{
res=0;
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else if ((ulonglong) nr > (ulonglong) UINT_MAX16)
{
res=(int16) UINT_MAX16;
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else
@@ -3402,13 +3386,13 @@ int Field_short::store(longlong nr, bool unsigned_val)
if (nr < INT_MIN16)
{
res=INT_MIN16;
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else if (nr > (longlong) INT_MAX16)
{
res=INT_MAX16;
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else
@@ -3525,14 +3509,14 @@ int Field_medium::store(double nr)
if (nr < 0)
{
int3store(ptr,0);
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else if (nr >= (double) (long) (1L << 24))
{
uint32 tmp=(uint32) (1L << 24)-1L;
int3store(ptr,tmp);
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else
@@ -3544,14 +3528,14 @@ int Field_medium::store(double nr)
{
long tmp=(long) INT_MIN24;
int3store(ptr,tmp);
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else if (nr > (double) INT_MAX24)
{
long tmp=(long) INT_MAX24;
int3store(ptr,tmp);
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else
@@ -3571,14 +3555,14 @@ int Field_medium::store(longlong nr, bool unsigned_val)
if (nr < 0 && !unsigned_val)
{
int3store(ptr,0);
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else if ((ulonglong) nr >= (ulonglong) (long) (1L << 24))
{
long tmp= (long) (1L << 24)-1L;
int3store(ptr,tmp);
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else
@@ -3593,14 +3577,14 @@ int Field_medium::store(longlong nr, bool unsigned_val)
{
long tmp= (long) INT_MIN24;
int3store(ptr,tmp);
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else if (nr > (longlong) INT_MAX24)
{
long tmp=(long) INT_MAX24;
int3store(ptr,tmp);
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else
@@ -3722,7 +3706,7 @@ int Field_long::store(double nr)
else if (nr > (double) UINT_MAX32)
{
res= UINT_MAX32;
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else
@@ -3744,7 +3728,7 @@ int Field_long::store(double nr)
res=(int32) (longlong) nr;
}
if (error)
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
int4store(ptr,res);
return error;
@@ -3790,7 +3774,7 @@ int Field_long::store(longlong nr, bool unsigned_val)
res=(int32) nr;
}
if (error)
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
int4store(ptr,res);
return error;
@@ -3889,7 +3873,7 @@ int Field_longlong::store(const char *from,uint len,CHARSET_INFO *cs)
tmp= cs->cset->strntoull10rnd(cs,from,len,unsigned_flag,&end,&error);
if (error == MY_ERRNO_ERANGE)
{
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else if (get_thd()->count_cuted_fields &&
@@ -3911,7 +3895,7 @@ int Field_longlong::store(double nr)
res= double_to_longlong(nr, unsigned_flag, &error);
if (error)
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
int8store(ptr,res);
return error;
@@ -3932,7 +3916,7 @@ int Field_longlong::store(longlong nr, bool unsigned_val)
if (unsigned_flag != unsigned_val)
{
nr= unsigned_flag ? (ulonglong) 0 : (ulonglong) LONGLONG_MAX;
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
}
@@ -4046,8 +4030,7 @@ int Field_float::store(const char *from,uint len,CHARSET_INFO *cs)
if (error || (!len || ((uint) (end-from) != len &&
get_thd()->count_cuted_fields)))
{
- set_warning(Sql_condition::WARN_LEVEL_WARN,
- (error ? ER_WARN_DATA_OUT_OF_RANGE : WARN_DATA_TRUNCATED), 1);
+ set_warning(error ? ER_WARN_DATA_OUT_OF_RANGE : WARN_DATA_TRUNCATED, 1);
error= error ? 1 : 2;
}
Field_float::store(nr);
@@ -4063,7 +4046,7 @@ int Field_float::store(double nr)
unsigned_flag, FLT_MAX);
if (error)
{
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
if (error < 0) // Wrong double value
{
error= 1;
@@ -4234,8 +4217,7 @@ int Field_double::store(const char *from,uint len,CHARSET_INFO *cs)
if (error || (!len || ((uint) (end-from) != len &&
get_thd()->count_cuted_fields)))
{
- set_warning(Sql_condition::WARN_LEVEL_WARN,
- (error ? ER_WARN_DATA_OUT_OF_RANGE : WARN_DATA_TRUNCATED), 1);
+ set_warning(error ? ER_WARN_DATA_OUT_OF_RANGE : WARN_DATA_TRUNCATED, 1);
error= error ? 1 : 2;
}
Field_double::store(nr);
@@ -4251,7 +4233,7 @@ int Field_double::store(double nr)
unsigned_flag, DBL_MAX);
if (error)
{
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
if (error < 0) // Wrong double value
{
error= 1;
@@ -4612,7 +4594,7 @@ int Field_timestamp::store_TIME_with_warning(THD *thd, MYSQL_TIME *l_time,
if (MYSQL_TIME_WARN_HAVE_WARNINGS(was_cut) || !have_smth_to_conv)
{
error= 1;
- set_datetime_warning(Sql_condition::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED,
+ set_datetime_warning(WARN_DATA_TRUNCATED,
str, MYSQL_TIMESTAMP_DATETIME, 1);
}
else if (MYSQL_TIME_WARN_HAVE_NOTES(was_cut))
@@ -4630,7 +4612,7 @@ int Field_timestamp::store_TIME_with_warning(THD *thd, MYSQL_TIME *l_time,
conversion_error= ER_WARN_DATA_OUT_OF_RANGE;
if (conversion_error)
{
- set_datetime_warning(Sql_condition::WARN_LEVEL_WARN, conversion_error,
+ set_datetime_warning(conversion_error,
str, MYSQL_TIMESTAMP_DATETIME, !error);
error= 1;
}
@@ -5128,7 +5110,7 @@ void Field_temporal::set_warnings(Sql_condition::enum_warning_level trunc_level,
set_datetime_warning(trunc_level, WARN_DATA_TRUNCATED,
str, mysql_type_to_time_type(type()), 1);
if (was_cut & MYSQL_TIME_WARN_OUT_OF_RANGE)
- set_datetime_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE,
+ set_datetime_warning(ER_WARN_DATA_OUT_OF_RANGE,
str, mysql_type_to_time_type(type()), 1);
}
@@ -5656,7 +5638,7 @@ int Field_year::store(const char *from, uint len,CHARSET_INFO *cs)
error == MY_ERRNO_ERANGE)
{
*ptr=0;
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
return 1;
}
if (get_thd()->count_cuted_fields &&
@@ -5699,7 +5681,7 @@ int Field_year::store(longlong nr, bool unsigned_val)
if (nr < 0 || (nr >= 100 && nr <= 1900) || nr > 2155)
{
*ptr= 0;
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
return 1;
}
if (nr != 0 || field_length != 4) // 0000 -> 0; 00 -> 2000
@@ -5720,8 +5702,7 @@ int Field_year::store_time_dec(MYSQL_TIME *ltime, uint dec)
if (Field_year::store(ltime->year, 0))
return 1;
- set_datetime_warning(Sql_condition::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED,
- &str, ltime->time_type, 1);
+ set_datetime_warning(WARN_DATA_TRUNCATED, &str, ltime->time_type, 1);
return 0;
}
@@ -6281,31 +6262,21 @@ bool Field_datetimef::get_date(MYSQL_TIME *ltime, ulonglong fuzzydate)
TRUE - If an error happened
*/
-static bool
-check_string_copy_error(Field_str *field,
- const char *well_formed_error_pos,
- const char *cannot_convert_error_pos,
- const char *end,
- CHARSET_INFO *cs)
+bool
+Field_longstr::check_string_copy_error(const char *well_formed_error_pos,
+ const char *cannot_convert_error_pos,
+ const char *end,
+ CHARSET_INFO *cs)
{
const char *pos;
char tmp[32];
- THD *thd;
-
- thd= field->get_thd();
if (!(pos= well_formed_error_pos) &&
!(pos= cannot_convert_error_pos))
return FALSE;
convert_to_printable(tmp, sizeof(tmp), pos, (end - pos), cs, 6);
-
- push_warning_printf(thd,
- Sql_condition::WARN_LEVEL_WARN,
- ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
- ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
- "string", tmp, field->field_name,
- thd->get_stmt_da()->current_row_for_warning());
+ set_warning_truncated_wrong_value("string", tmp);
return TRUE;
}
@@ -6340,14 +6311,14 @@ Field_longstr::report_if_important_data(const char *pstr, const char *end,
if (test_if_important_data(field_charset, pstr, end))
{
if (thd->abort_on_warning)
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_DATA_TOO_LONG, 1);
+ set_warning(ER_DATA_TOO_LONG, 1);
else
- set_warning(Sql_condition::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1);
+ set_warning(WARN_DATA_TRUNCATED, 1);
return 2;
}
else if (count_spaces)
{ /* If we lost only spaces then produce a NOTE, not a WARNING */
- set_warning(Sql_condition::WARN_LEVEL_NOTE, WARN_DATA_TRUNCATED, 1);
+ set_note(WARN_DATA_TRUNCATED, 1);
return 2;
}
}
@@ -6382,7 +6353,7 @@ int Field_string::store(const char *from,uint length,CHARSET_INFO *cs)
field_length-copy_length,
field_charset->pad_char);
- if (check_string_copy_error(this, well_formed_error_pos,
+ if (check_string_copy_error(well_formed_error_pos,
cannot_convert_error_pos, from + length, cs))
return 2;
@@ -6413,9 +6384,9 @@ int Field_str::store(double nr)
if (error)
{
if (get_thd()->abort_on_warning)
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_DATA_TOO_LONG, 1);
+ set_warning(ER_DATA_TOO_LONG, 1);
else
- set_warning(Sql_condition::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1);
+ set_warning(WARN_DATA_TRUNCATED, 1);
}
return store(buff, length, &my_charset_numeric);
}
@@ -6891,7 +6862,7 @@ int Field_varstring::store(const char *from,uint length,CHARSET_INFO *cs)
else
int2store(ptr, copy_length);
- if (check_string_copy_error(this, well_formed_error_pos,
+ if (check_string_copy_error(well_formed_error_pos,
cannot_convert_error_pos, from + length, cs))
return 2;
@@ -7417,7 +7388,7 @@ int Field_blob::store(const char *from,uint length,CHARSET_INFO *cs)
tmp= value.ptr();
bmove(ptr+packlength,(uchar*) &tmp,sizeof(char*));
- if (check_string_copy_error(this, well_formed_error_pos,
+ if (check_string_copy_error(well_formed_error_pos,
cannot_convert_error_pos, from + length, cs))
return 2;
@@ -7923,6 +7894,14 @@ err_exit:
return -1;
}
+Field::geometry_type Field_geom::geometry_type_merge(geometry_type a,
+ geometry_type b)
+{
+ if (a == b)
+ return a;
+ return Field::GEOM_GEOMETRY;
+}
+
#endif /*HAVE_SPATIAL*/
/****************************************************************************
@@ -7983,13 +7962,13 @@ int Field_enum::store(const char *from,uint length,CHARSET_INFO *cs)
if (err || end != from+length || tmp > typelib->count)
{
tmp=0;
- set_warning(Sql_condition::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1);
+ set_warning(WARN_DATA_TRUNCATED, 1);
}
if (!get_thd()->count_cuted_fields)
err= 0;
}
else
- set_warning(Sql_condition::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1);
+ set_warning(WARN_DATA_TRUNCATED, 1);
}
store_type((ulonglong) tmp);
return err;
@@ -8008,7 +7987,7 @@ int Field_enum::store(longlong nr, bool unsigned_val)
int error= 0;
if ((ulonglong) nr > typelib->count || nr == 0)
{
- set_warning(Sql_condition::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1);
+ set_warning(WARN_DATA_TRUNCATED, 1);
if (nr != 0 || get_thd()->count_cuted_fields)
{
nr= 0;
@@ -8161,11 +8140,11 @@ int Field_set::store(const char *from,uint length,CHARSET_INFO *cs)
tmp > (ulonglong) (((longlong) 1 << typelib->count) - (longlong) 1))
{
tmp=0;
- set_warning(Sql_condition::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1);
+ set_warning(WARN_DATA_TRUNCATED, 1);
}
}
else if (got_warning)
- set_warning(Sql_condition::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1);
+ set_warning(WARN_DATA_TRUNCATED, 1);
store_type(tmp);
return err;
}
@@ -8185,7 +8164,7 @@ int Field_set::store(longlong nr, bool unsigned_val)
if ((ulonglong) nr > max_nr)
{
nr&= max_nr;
- set_warning(Sql_condition::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1);
+ set_warning(WARN_DATA_TRUNCATED, 1);
error=1;
}
store_type((ulonglong) nr);
@@ -8537,9 +8516,9 @@ int Field_bit::store(const char *from, uint length, CHARSET_INFO *cs)
set_rec_bits((1 << bit_len) - 1, bit_ptr, bit_ofs, bit_len);
memset(ptr, 0xff, bytes_in_rec);
if (get_thd()->really_abort_on_warning())
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_DATA_TOO_LONG, 1);
+ set_warning(ER_DATA_TOO_LONG, 1);
else
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
return 1;
}
/* delta is >= -1 here */
@@ -8974,9 +8953,9 @@ int Field_bit_as_char::store(const char *from, uint length, CHARSET_INFO *cs)
if (bits)
*ptr&= ((1 << bits) - 1); /* set first uchar */
if (get_thd()->really_abort_on_warning())
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_DATA_TOO_LONG, 1);
+ set_warning(ER_DATA_TOO_LONG, 1);
else
- set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
return 1;
}
bzero(ptr, delta);
@@ -9923,35 +9902,52 @@ Create_field::Create_field(Field *old_field,Field *orig_field)
char_length= length;
/*
- Copy the default value from the column object orig_field, if:
- 1) The column has a constant default value.
- 2) The column type is not a BLOB type.
- 3) The original column (old_field) was properly initialized with a record
- buffer pointer.
- 4) The original column doesn't have a default function to auto-initialize
- the column on INSERT
+ Copy the default (constant/function) from the column object orig_field, if
+ supplied. We do this if all these conditions are met:
+
+ - The column allows a default.
+
+ - The column type is not a BLOB type.
+
+ - The original column (old_field) was properly initialized with a record
+ buffer pointer.
*/
- if (!(flags & (NO_DEFAULT_VALUE_FLAG | BLOB_FLAG)) && // 1) 2)
- old_field->ptr && orig_field && // 3)
- !old_field->has_insert_default_function()) // 4)
- {
- char buff[MAX_FIELD_WIDTH];
- String tmp(buff,sizeof(buff), charset);
- my_ptrdiff_t diff;
-
- /* Get the value from default_values */
- diff= (my_ptrdiff_t) (orig_field->table->s->default_values-
- orig_field->table->record[0]);
- orig_field->move_field_offset(diff); // Points now at default_values
- if (!orig_field->is_real_null())
+ if (!(flags & (NO_DEFAULT_VALUE_FLAG | BLOB_FLAG)) &&
+ old_field->ptr != NULL &&
+ orig_field != NULL)
+ {
+ bool default_now= false;
+ if (real_type_with_now_as_default(sql_type))
{
- char buff[MAX_FIELD_WIDTH], *pos;
- String tmp(buff, sizeof(buff), charset), *res;
- res= orig_field->val_str(&tmp);
- pos= (char*) sql_strmake(res->ptr(), res->length());
- def= new Item_string(pos, res->length(), charset);
+ // The SQL type of the new field allows a function default:
+ default_now= orig_field->has_insert_default_function();
+ bool update_now= orig_field->has_update_default_function();
+
+ if (default_now && update_now)
+ unireg_check= Field::TIMESTAMP_DNUN_FIELD;
+ else if (default_now)
+ unireg_check= Field::TIMESTAMP_DN_FIELD;
+ else if (update_now)
+ unireg_check= Field::TIMESTAMP_UN_FIELD;
+ }
+ if (!default_now) // Give a constant default
+ {
+ char buff[MAX_FIELD_WIDTH];
+ String tmp(buff,sizeof(buff), charset);
+
+ /* Get the value from default_values */
+ my_ptrdiff_t diff= orig_field->table->default_values_offset();
+ orig_field->move_field_offset(diff); // Points now at default_values
+ if (!orig_field->is_real_null())
+ {
+ char buff[MAX_FIELD_WIDTH], *pos;
+ String tmp(buff, sizeof(buff), charset), *res;
+ res= orig_field->val_str(&tmp);
+ pos= (char*) sql_strmake(res->ptr(), res->length());
+ def= new Item_string(pos, res->length(), charset);
+ }
+ orig_field->move_field_offset(-diff); // Back to record[0]
}
- orig_field->move_field_offset(-diff); // Back to record[0]
}
}
@@ -10102,6 +10098,19 @@ void Field::set_datetime_warning(Sql_condition::enum_warning_level level,
}
+void Field::set_warning_truncated_wrong_value(const char *type,
+ const char *value)
+{
+ THD *thd= get_thd();
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
+ ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
+ type, value, field_name,
+ static_cast<ulong>(thd->get_stmt_da()->
+ current_row_for_warning()));
+}
+
+
/*
@brief
Return possible keys for a field
diff --git a/sql/field.h b/sql/field.h
index 0390e95f954..a40e2ef9913 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -1,7 +1,7 @@
#ifndef FIELD_INCLUDED
#define FIELD_INCLUDED
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
- Copyright (c) 2008, 2014, SkySQL Ab.
+ Copyright (c) 2008, 2015, MariaDB
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
@@ -119,6 +119,20 @@ inline bool is_temporal_type_with_date(enum_field_types type)
/**
+ Tests if a field real type can have "DEFAULT CURRENT_TIMESTAMP"
+
+ @param type Field type, as returned by field->real_type().
+ @retval true If field real type can have "DEFAULT CURRENT_TIMESTAMP".
+ @retval false If field real type can not have "DEFAULT CURRENT_TIMESTAMP".
+*/
+inline bool real_type_with_now_as_default(enum_field_types type)
+{
+ return type == MYSQL_TYPE_TIMESTAMP || type == MYSQL_TYPE_TIMESTAMP2 ||
+ type == MYSQL_TYPE_DATETIME || type == MYSQL_TYPE_DATETIME2;
+}
+
+
+/**
Recognizer for concrete data type (called real_type for some reason),
returning true if it is one of the TIMESTAMP types.
*/
@@ -656,36 +670,32 @@ public:
inline bool is_null(my_ptrdiff_t row_offset= 0) const
{
/*
- If the field is NULLable, it returns NULLity based
- on null_ptr[row_offset] value. Otherwise it returns
- NULL flag depending on TABLE::null_row value.
-
The table may have been marked as containing only NULL values
for all fields if it is a NULL-complemented row of an OUTER JOIN
or if the query is an implicitly grouped query (has aggregate
functions but no GROUP BY clause) with no qualifying rows. If
- this is the case (in which TABLE::null_row is true) and the
- field is not nullable, the field is considered to be NULL.
-
- Do not change the order of testing. Fields may be associated
- with a TABLE object without being part of the current row.
- For NULL value check to work for these fields, they must
- have a valid null_ptr, and this pointer must be checked before
- TABLE::null_row.
+ this is the case (in which TABLE::null_row is true), the field
+ is considered to be NULL.
Note that if a table->null_row is set then also all null_bits are
set for the row.
+
+ In the case of the 'result_field' for GROUP BY, table->null_row might
+ refer to the *next* row in the table (when the algorithm is: read the
+ next row, see if any of group column values have changed, send the
+ result - grouped - row to the client if yes). So, table->null_row might
+ be wrong, but such a result_field is always nullable (that's defined by
+ original_field->maybe_null()) and we trust its null bit.
*/
- return real_maybe_null() ?
- MY_TEST(null_ptr[row_offset] & null_bit) : table->null_row;
+ return null_ptr ? null_ptr[row_offset] & null_bit : table->null_row;
}
inline bool is_real_null(my_ptrdiff_t row_offset= 0) const
- { return null_ptr ? (null_ptr[row_offset] & null_bit ? 1 : 0) : 0; }
+ { return null_ptr && (null_ptr[row_offset] & null_bit); }
inline bool is_null_in_record(const uchar *record) const
{
if (!null_ptr)
return 0;
- return MY_TEST(record[(uint) (null_ptr - table->record[0])] & null_bit);
+ return record[(uint) (null_ptr - table->record[0])] & null_bit;
}
inline void set_null(my_ptrdiff_t row_offset= 0)
{ if (null_ptr) null_ptr[row_offset]|= null_bit; }
@@ -875,14 +885,32 @@ public:
virtual int set_time() { return 1; }
bool set_warning(Sql_condition::enum_warning_level, unsigned int code,
int cuted_increment) const;
+protected:
+ bool set_warning(unsigned int code, int cuted_increment) const
+ {
+ return set_warning(Sql_condition::WARN_LEVEL_WARN, code, cuted_increment);
+ }
+ bool set_note(unsigned int code, int cuted_increment) const
+ {
+ return set_warning(Sql_condition::WARN_LEVEL_NOTE, code, cuted_increment);
+ }
void set_datetime_warning(Sql_condition::enum_warning_level, uint code,
const ErrConv *str, timestamp_type ts_type,
int cuted_increment);
+ void set_datetime_warning(uint code,
+ const ErrConv *str, timestamp_type ts_type,
+ int cuted_increment)
+ {
+ set_datetime_warning(Sql_condition::WARN_LEVEL_WARN, code, str, ts_type,
+ cuted_increment);
+ }
+ void set_warning_truncated_wrong_value(const char *type, const char *value);
inline bool check_overflow(int op_result)
{
return (op_result == E_DEC_OVERFLOW);
}
int warn_if_overflow(int op_result);
+public:
void set_table_name(String *alias)
{
table_name= &alias->Ptr;
@@ -1129,6 +1157,10 @@ class Field_longstr :public Field_str
protected:
int report_if_important_data(const char *ptr, const char *end,
bool count_spaces);
+ bool check_string_copy_error(const char *well_formed_error_pos,
+ const char *cannot_convert_error_pos,
+ const char *end,
+ CHARSET_INFO *cs);
public:
Field_longstr(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg, utype unireg_check_arg,
@@ -2565,6 +2597,14 @@ public:
int store(longlong nr, bool unsigned_val);
int store_decimal(const my_decimal *);
uint size_of() const { return sizeof(*this); }
+ /**
+ Key length is provided only to support hash joins. (compared byte for byte)
+ Ex: SELECT .. FROM t1,t2 WHERE t1.field_geom1=t2.field_geom2.
+
+ The comparison is not very relevant, as identical geometry might be
+ represented differently, but we need to support it either way.
+ */
+ uint32 key_length() const { return packlength; }
/**
Non-nullable GEOMETRY types cannot have defaults,
@@ -2573,6 +2613,7 @@ public:
int reset(void) { return Field_blob::reset() || !maybe_null(); }
geometry_type get_geometry_type() { return geom_type; };
+ static geometry_type geometry_type_merge(geometry_type, geometry_type);
};
#endif /*HAVE_SPATIAL*/
diff --git a/sql/filesort.cc b/sql/filesort.cc
index 027437fca67..a545bb623c0 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -1,5 +1,5 @@
-/* Copyright (c) 2000, 2014, Oracle and/or its affiliates.
- Copyright (c) 2009, 2014, Monty Program Ab.
+/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
+ Copyright (c) 2009, 2015, MariaDB
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
diff --git a/sql/gen_lex_token.cc b/sql/gen_lex_token.cc
new file mode 100644
index 00000000000..3584dd60c62
--- /dev/null
+++ b/sql/gen_lex_token.cc
@@ -0,0 +1,353 @@
+/*
+ Copyright (c) 2011, 2015, 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; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
+
+#include <my_global.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+/* We only need the tokens here */
+#define YYSTYPE_IS_DECLARED
+#include <sql_yacc.h>
+#include <lex.h>
+
+#include <welcome_copyright_notice.h> /* ORACLE_WELCOME_COPYRIGHT_NOTICE */
+
+/*
+ This is a tool used during build only,
+ so MY_MAX_TOKEN does not need to be exact,
+ only big enough to hold:
+ - 256 character terminal tokens
+ - YYNTOKENS named terminal tokens
+ from bison.
+ See also YYMAXUTOK.
+*/
+#define MY_MAX_TOKEN 1000
+/** Generated token. */
+struct gen_lex_token_string
+{
+ const char *m_token_string;
+ int m_token_length;
+ bool m_append_space;
+ bool m_start_expr;
+};
+
+gen_lex_token_string compiled_token_array[MY_MAX_TOKEN];
+int max_token_seen= 0;
+
+char char_tokens[256];
+
+int tok_generic_value= 0;
+int tok_generic_value_list= 0;
+int tok_row_single_value= 0;
+int tok_row_single_value_list= 0;
+int tok_row_multiple_value= 0;
+int tok_row_multiple_value_list= 0;
+int tok_unused= 0;
+
+void set_token(int tok, const char *str)
+{
+ if (tok <= 0)
+ {
+ fprintf(stderr, "Bad token found\n");
+ exit(1);
+ }
+
+ if (tok > max_token_seen)
+ {
+ max_token_seen= tok;
+ }
+
+ if (max_token_seen >= MY_MAX_TOKEN)
+ {
+ fprintf(stderr, "Added that many new keywords ? Increase MY_MAX_TOKEN\n");
+ exit(1);
+ }
+
+ compiled_token_array[tok].m_token_string= str;
+ compiled_token_array[tok].m_token_length= strlen(str);
+ compiled_token_array[tok].m_append_space= true;
+ compiled_token_array[tok].m_start_expr= false;
+}
+
+void set_start_expr_token(int tok)
+{
+ compiled_token_array[tok].m_start_expr= true;
+}
+
+void compute_tokens()
+{
+ int tok;
+ unsigned int i;
+ char *str;
+
+ /*
+ Default value.
+ */
+ for (tok= 0; tok < MY_MAX_TOKEN; tok++)
+ {
+ compiled_token_array[tok].m_token_string= "(unknown)";
+ compiled_token_array[tok].m_token_length= 9;
+ compiled_token_array[tok].m_append_space= true;
+ compiled_token_array[tok].m_start_expr= false;
+ }
+
+ /*
+ Tokens made of just one terminal character
+ */
+ for (tok=0; tok < 256; tok++)
+ {
+ str= & char_tokens[tok];
+ str[0]= (char) tok;
+ compiled_token_array[tok].m_token_string= str;
+ compiled_token_array[tok].m_token_length= 1;
+ compiled_token_array[tok].m_append_space= true;
+ }
+
+ max_token_seen= 255;
+
+ /*
+ String terminal tokens, used in sql_yacc.yy
+ */
+ set_token(NEG, "~");
+ set_token(TABLE_REF_PRIORITY, "TABLE_REF_PRIORITY");
+
+ /*
+ Tokens hard coded in sql_lex.cc
+ */
+
+ set_token(WITH_CUBE_SYM, "WITH CUBE");
+ set_token(WITH_ROLLUP_SYM, "WITH ROLLUP");
+ set_token(NOT2_SYM, "!");
+ set_token(OR2_SYM, "|");
+ set_token(PARAM_MARKER, "?");
+ set_token(SET_VAR, ":=");
+ set_token(UNDERSCORE_CHARSET, "(_charset)");
+ set_token(END_OF_INPUT, "");
+
+ /*
+ Values.
+ These tokens are all normalized later,
+ so this strings will never be displayed.
+ */
+ set_token(BIN_NUM, "(bin)");
+ set_token(DECIMAL_NUM, "(decimal)");
+ set_token(FLOAT_NUM, "(float)");
+ set_token(HEX_NUM, "(hex)");
+ set_token(LEX_HOSTNAME, "(hostname)");
+ set_token(LONG_NUM, "(long)");
+ set_token(NUM, "(num)");
+ set_token(TEXT_STRING, "(text)");
+ set_token(NCHAR_STRING, "(nchar)");
+ set_token(ULONGLONG_NUM, "(ulonglong)");
+
+ /*
+ Identifiers.
+ */
+ set_token(IDENT, "(id)");
+ set_token(IDENT_QUOTED, "(id_quoted)");
+
+ /*
+ Unused tokens
+ */
+ set_token(LOCATOR_SYM, "LOCATOR");
+ set_token(SERVER_OPTIONS, "SERVER_OPTIONS");
+ set_token(UDF_RETURNS_SYM, "UDF_RETURNS");
+
+ /*
+ See symbols[] in sql/lex.h
+ */
+ for (i= 0; i< sizeof(symbols)/sizeof(symbols[0]); i++)
+ {
+ set_token(symbols[i].tok, symbols[i].name);
+ }
+
+ /*
+ See sql_functions[] in sql/lex.h
+ */
+ for (i= 0; i< sizeof(sql_functions)/sizeof(sql_functions[0]); i++)
+ {
+ set_token(sql_functions[i].tok, sql_functions[i].name);
+ }
+
+ /*
+ Additional FAKE tokens,
+ used internally to normalize a digest text.
+ */
+
+ max_token_seen++;
+ tok_generic_value= max_token_seen;
+ set_token(tok_generic_value, "?");
+
+ max_token_seen++;
+ tok_generic_value_list= max_token_seen;
+ set_token(tok_generic_value_list, "?, ...");
+
+ max_token_seen++;
+ tok_row_single_value= max_token_seen;
+ set_token(tok_row_single_value, "(?)");
+
+ max_token_seen++;
+ tok_row_single_value_list= max_token_seen;
+ set_token(tok_row_single_value_list, "(?) /* , ... */");
+
+ max_token_seen++;
+ tok_row_multiple_value= max_token_seen;
+ set_token(tok_row_multiple_value, "(...)");
+
+ max_token_seen++;
+ tok_row_multiple_value_list= max_token_seen;
+ set_token(tok_row_multiple_value_list, "(...) /* , ... */");
+
+ max_token_seen++;
+ tok_unused= max_token_seen;
+ set_token(tok_unused, "UNUSED");
+
+ /*
+ Fix whitespace for some special tokens.
+ */
+
+ /*
+ The lexer parses "@@variable" as '@', '@', 'variable',
+ returning a token for '@' alone.
+
+ This is incorrect, '@' is not really a token,
+ because the syntax "@ @ variable" (with spaces) is not accepted:
+ The lexer keeps some internal state after the '@' fake token.
+
+ To work around this, digest text are printed as "@@variable".
+ */
+ compiled_token_array[(int) '@'].m_append_space= false;
+
+ /*
+ Define additional properties for tokens.
+
+ List all the token that are followed by an expression.
+ This is needed to differentiate unary from binary
+ '+' and '-' operators, because we want to:
+ - reduce <unary +> <NUM> to <?>,
+ - preserve <...> <binary +> <NUM> as is.
+ */
+ set_start_expr_token('(');
+ set_start_expr_token(',');
+ set_start_expr_token(EVERY_SYM);
+ set_start_expr_token(AT_SYM);
+ set_start_expr_token(STARTS_SYM);
+ set_start_expr_token(ENDS_SYM);
+ set_start_expr_token(DEFAULT);
+ set_start_expr_token(RETURN_SYM);
+ set_start_expr_token(IF);
+ set_start_expr_token(ELSEIF_SYM);
+ set_start_expr_token(CASE_SYM);
+ set_start_expr_token(WHEN_SYM);
+ set_start_expr_token(WHILE_SYM);
+ set_start_expr_token(UNTIL_SYM);
+ set_start_expr_token(SELECT_SYM);
+
+ set_start_expr_token(OR_SYM);
+ set_start_expr_token(OR2_SYM);
+ set_start_expr_token(XOR);
+ set_start_expr_token(AND_SYM);
+ set_start_expr_token(AND_AND_SYM);
+ set_start_expr_token(NOT_SYM);
+ set_start_expr_token(BETWEEN_SYM);
+ set_start_expr_token(LIKE);
+ set_start_expr_token(REGEXP);
+
+ set_start_expr_token('|');
+ set_start_expr_token('&');
+ set_start_expr_token(SHIFT_LEFT);
+ set_start_expr_token(SHIFT_RIGHT);
+ set_start_expr_token('+');
+ set_start_expr_token('-');
+ set_start_expr_token(INTERVAL_SYM);
+ set_start_expr_token('*');
+ set_start_expr_token('/');
+ set_start_expr_token('%');
+ set_start_expr_token(DIV_SYM);
+ set_start_expr_token(MOD_SYM);
+ set_start_expr_token('^');
+}
+
+void print_tokens()
+{
+ int tok;
+
+ printf("#ifdef LEX_TOKEN_WITH_DEFINITION\n");
+ printf("lex_token_string lex_token_array[]=\n");
+ printf("{\n");
+ printf("/* PART 1: character tokens. */\n");
+
+ for (tok= 0; tok<256; tok++)
+ {
+ printf("/* %03d */ { \"\\x%02x\", 1, %s, %s},\n",
+ tok,
+ tok,
+ compiled_token_array[tok].m_append_space ? "true" : "false",
+ compiled_token_array[tok].m_start_expr ? "true" : "false");
+ }
+
+ printf("/* PART 2: named tokens. */\n");
+
+ for (tok= 256; tok<= max_token_seen; tok++)
+ {
+ printf("/* %03d */ { \"%s\", %d, %s, %s},\n",
+ tok,
+ compiled_token_array[tok].m_token_string,
+ compiled_token_array[tok].m_token_length,
+ compiled_token_array[tok].m_append_space ? "true" : "false",
+ compiled_token_array[tok].m_start_expr ? "true" : "false");
+ }
+
+ printf("/* DUMMY */ { \"\", 0, false, false}\n");
+ printf("};\n");
+ printf("#endif /* LEX_TOKEN_WITH_DEFINITION */\n");
+
+ printf("/* DIGEST specific tokens. */\n");
+ printf("#define TOK_GENERIC_VALUE %d\n", tok_generic_value);
+ printf("#define TOK_GENERIC_VALUE_LIST %d\n", tok_generic_value_list);
+ printf("#define TOK_ROW_SINGLE_VALUE %d\n", tok_row_single_value);
+ printf("#define TOK_ROW_SINGLE_VALUE_LIST %d\n", tok_row_single_value_list);
+ printf("#define TOK_ROW_MULTIPLE_VALUE %d\n", tok_row_multiple_value);
+ printf("#define TOK_ROW_MULTIPLE_VALUE_LIST %d\n", tok_row_multiple_value_list);
+ printf("#define TOK_UNUSED %d\n", tok_unused);
+}
+
+int main(int argc,char **argv)
+{
+ puts("/*");
+ puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2011"));
+ puts("*/");
+
+ printf("/*\n");
+ printf(" This file is generated, do not edit.\n");
+ printf(" See file sql/gen_lex_token.cc.\n");
+ printf("*/\n");
+ printf("struct lex_token_string\n");
+ printf("{\n");
+ printf(" const char *m_token_string;\n");
+ printf(" int m_token_length;\n");
+ printf(" bool m_append_space;\n");
+ printf(" bool m_start_expr;\n");
+ printf("};\n");
+ printf("typedef struct lex_token_string lex_token_string;\n");
+
+ compute_tokens();
+ print_tokens();
+
+ return 0;
+}
+
diff --git a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc
index 73513ac9f40..64ae31ce231 100644
--- a/sql/ha_ndbcluster_binlog.cc
+++ b/sql/ha_ndbcluster_binlog.cc
@@ -1,5 +1,4 @@
-/* Copyright (c) 2006, 2013, Oracle and/or its affiliates.
- Copyright (c) 2012, 2013, Monty Proram Ab.
+/* Copyright (c) 2006, 2015, 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
@@ -2529,7 +2528,8 @@ ndbcluster_check_if_local_tables_in_db(THD *thd, const char *dbname)
char path[FN_REFLEN + 1];
build_table_filename(path, sizeof(path) - 1, dbname, "", "", 0);
- if (find_files(thd, &files, dbname, path, NullS, 0) != FIND_FILES_OK)
+ if (find_files(thd, &files, dbname, path, NullS, 0, NULL) !=
+ FIND_FILES_OK)
{
DBUG_PRINT("info", ("Failed to find files"));
DBUG_RETURN(true);
diff --git a/sql/handler.cc b/sql/handler.cc
index 518ca7b860d..1f8daf3927b 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -1445,7 +1445,13 @@ done:
/* Come here if error and we need to rollback. */
err:
error= 1; /* Transaction was rolled back */
- ha_rollback_trans(thd, all);
+ /*
+ In parallel replication, rollback is delayed, as there is extra replication
+ book-keeping to be done before rolling back and allowing a conflicting
+ transaction to continue (MDEV-7458).
+ */
+ if (!(thd->rgi_slave && thd->rgi_slave->is_parallel_exec))
+ ha_rollback_trans(thd, all);
end:
if (rw_trans && mdl_request.ticket)
@@ -1539,7 +1545,10 @@ 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->has_waiter= false;
thd->transaction.cleanup();
+ }
DBUG_RETURN(error);
}
@@ -1620,7 +1629,10 @@ int ha_rollback_trans(THD *thd, bool all)
/* Always cleanup. Even if nht==0. There may be savepoints. */
if (is_real_trans)
+ {
+ thd->has_waiter= false;
thd->transaction.cleanup();
+ }
if (all)
thd->transaction_rollback_request= FALSE;
@@ -2286,9 +2298,11 @@ handle_condition(THD *,
}
-/** @brief
- This should return ENOENT if the file doesn't exists.
- The .frm file will be deleted only if we return 0 or ENOENT
+/** delete a table in the engine
+
+ @note
+ ENOENT and HA_ERR_NO_SUCH_TABLE are not considered errors.
+ The .frm file will be deleted only if we return 0.
*/
int ha_delete_table(THD *thd, handlerton *table_type, const char *path,
const char *db, const char *alias, bool generate_warning)
@@ -2303,47 +2317,66 @@ int ha_delete_table(THD *thd, handlerton *table_type, const char *path,
/* table_type is NULL in ALTER TABLE when renaming only .frm files */
if (table_type == NULL || table_type == view_pseudo_hton ||
! (file=get_new_handler((TABLE_SHARE*)0, thd->mem_root, table_type)))
- DBUG_RETURN(HA_ERR_NO_SUCH_TABLE);
+ DBUG_RETURN(0);
bzero((char*) &dummy_table, sizeof(dummy_table));
bzero((char*) &dummy_share, sizeof(dummy_share));
dummy_table.s= &dummy_share;
path= get_canonical_filename(file, path, tmp_path);
- if ((error= file->ha_delete_table(path)) && generate_warning)
+ if ((error= file->ha_delete_table(path)))
{
/*
- Because file->print_error() use my_error() to generate the error message
- we use an internal error handler to intercept it and store the text
- in a temporary buffer. Later the message will be presented to user
- as a warning.
+ it's not an error if the table doesn't exist in the engine.
+ warn the user, but still report DROP being a success
*/
- Ha_delete_table_error_handler ha_delete_table_error_handler;
-
- /* Fill up strucutures that print_error may need */
- dummy_share.path.str= (char*) path;
- dummy_share.path.length= strlen(path);
- dummy_share.normalized_path= dummy_share.path;
- dummy_share.db.str= (char*) db;
- dummy_share.db.length= strlen(db);
- dummy_share.table_name.str= (char*) alias;
- dummy_share.table_name.length= strlen(alias);
- dummy_table.alias.set(alias, dummy_share.table_name.length,
- table_alias_charset);
-
- file->change_table_ptr(&dummy_table, &dummy_share);
+ bool intercept= error == ENOENT || error == HA_ERR_NO_SUCH_TABLE;
- thd->push_internal_handler(&ha_delete_table_error_handler);
- file->print_error(error, 0);
+ if (!intercept || generate_warning)
+ {
+ /*
+ Because file->print_error() use my_error() to generate the error message
+ we use an internal error handler to intercept it and store the text
+ in a temporary buffer. Later the message will be presented to user
+ as a warning.
+ */
+ Ha_delete_table_error_handler ha_delete_table_error_handler;
+
+ /* Fill up strucutures that print_error may need */
+ dummy_share.path.str= (char*) path;
+ dummy_share.path.length= strlen(path);
+ dummy_share.normalized_path= dummy_share.path;
+ dummy_share.db.str= (char*) db;
+ dummy_share.db.length= strlen(db);
+ dummy_share.table_name.str= (char*) alias;
+ dummy_share.table_name.length= strlen(alias);
+ dummy_table.alias.set(alias, dummy_share.table_name.length,
+ table_alias_charset);
+
+ file->change_table_ptr(&dummy_table, &dummy_share);
+
+#if MYSQL_VERSION_ID > 100105
+ // XXX as an ugly 10.0-only hack we intercept HA_ERR_ROW_IS_REFERENCED,
+ // to report it under the old historical error number.
+#error remove HA_ERR_ROW_IS_REFERENCED, use ME_JUST_WARNING instead of a handler
+#endif
+ if (intercept || error == HA_ERR_ROW_IS_REFERENCED)
+ thd->push_internal_handler(&ha_delete_table_error_handler);
- thd->pop_internal_handler();
+ file->print_error(error, 0);
- /*
- XXX: should we convert *all* errors to warnings here?
- What if the error is fatal?
- */
- push_warning(thd, Sql_condition::WARN_LEVEL_WARN, error,
- ha_delete_table_error_handler.buff);
+ if (intercept || error == HA_ERR_ROW_IS_REFERENCED)
+ {
+ thd->pop_internal_handler();
+ if (error == HA_ERR_ROW_IS_REFERENCED)
+ my_message(ER_ROW_IS_REFERENCED, ER(ER_ROW_IS_REFERENCED), MYF(0));
+ else
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN, error,
+ ha_delete_table_error_handler.buff);
+ }
+ }
+ if (intercept)
+ error= 0;
}
delete file;
@@ -6290,3 +6323,22 @@ fl_create_iterator(enum handler_iterator_type type,
}
}
#endif /*TRANS_LOG_MGM_EXAMPLE_CODE*/
+
+
+bool HA_CREATE_INFO::check_conflicting_charset_declarations(CHARSET_INFO *cs)
+{
+ if ((used_fields & HA_CREATE_USED_DEFAULT_CHARSET) &&
+ /* DEFAULT vs explicit, or explicit vs DEFAULT */
+ (((default_table_charset == NULL) != (cs == NULL)) ||
+ /* Two different explicit character sets */
+ (default_table_charset && cs &&
+ !my_charset_same(default_table_charset, cs))))
+ {
+ my_error(ER_CONFLICTING_DECLARATIONS, MYF(0),
+ "CHARACTER SET ", default_table_charset ?
+ default_table_charset->csname : "DEFAULT",
+ "CHARACTER SET ", cs ? cs->csname : "DEFAULT");
+ return true;
+ }
+ return false;
+}
diff --git a/sql/handler.h b/sql/handler.h
index 4222270e9c4..2e219d5f3cc 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -1637,6 +1637,33 @@ struct HA_CREATE_INFO
bool table_was_deleted;
bool tmp_table() { return options & HA_LEX_CREATE_TMP_TABLE; }
+ bool check_conflicting_charset_declarations(CHARSET_INFO *cs);
+ bool add_table_option_default_charset(CHARSET_INFO *cs)
+ {
+ // cs can be NULL, e.g.: CREATE TABLE t1 (..) CHARACTER SET DEFAULT;
+ if (check_conflicting_charset_declarations(cs))
+ return true;
+ default_table_charset= cs;
+ used_fields|= HA_CREATE_USED_DEFAULT_CHARSET;
+ return false;
+ }
+ bool add_alter_list_item_convert_to_charset(CHARSET_INFO *cs)
+ {
+ /*
+ cs cannot be NULL, as sql_yacc.yy translates
+ CONVERT TO CHARACTER SET DEFAULT
+ to
+ CONVERT TO CHARACTER SET <character-set-of-the-current-database>
+ TODO: Should't we postpone resolution of DEFAULT until the
+ character set of the table owner database is loaded from its db.opt?
+ */
+ DBUG_ASSERT(cs);
+ if (check_conflicting_charset_declarations(cs))
+ return true;
+ table_charset= default_table_charset= cs;
+ used_fields|= (HA_CREATE_USED_CHARSET | HA_CREATE_USED_DEFAULT_CHARSET);
+ return false;
+ }
};
diff --git a/sql/item.cc b/sql/item.cc
index 132cfa2846a..bffa7e2990d 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2014, Oracle and/or its affiliates.
- Copyright (c) 2010, 2014, Monty Program Ab.
+ Copyright (c) 2010, 2015, MariaDB
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
@@ -1179,6 +1179,42 @@ Item *Item::safe_charset_converter(CHARSET_INFO *tocs)
/**
+ Some pieces of the code do not support changing of
+ Item_cache to other Item types.
+
+ Example:
+ Item_singlerow_subselect has "Item_cache **row".
+ Creating of Item_func_conv_charset followed by THD::change_item_tree()
+ should not change row[i] from Item_cache directly to Item_func_conv_charset, because Item_singlerow_subselect
+ because Item_singlerow_subselect later calls Item_cache-specific methods,
+ e.g. row[i]->store() and row[i]->cache_value().
+
+ Let's wrap Item_func_conv_charset in a new Item_cache,
+ so the Item_cache-specific methods can still be used for
+ Item_singlerow_subselect::row[i] safely.
+
+ As a bonus we cache the converted value, instead of converting every time
+
+ TODO: we should eventually check all other use cases of change_item_tree().
+ Perhaps some more potentially dangerous substitution examples exist.
+*/
+Item *Item_cache::safe_charset_converter(CHARSET_INFO *tocs)
+{
+ if (!example)
+ return Item::safe_charset_converter(tocs);
+ Item *conv= example->safe_charset_converter(tocs);
+ if (conv == example)
+ return this;
+ Item_cache *cache;
+ if (!conv || !(cache= new Item_cache_str(conv)))
+ return NULL; // Safe conversion is not possible, or OEM
+ cache->setup(conv);
+ cache->fixed= false; // Make Item::fix_fields() happy
+ return cache;
+}
+
+
+/**
@details
Created mostly for mysql_prepare_table(). Important
when a string ENUM/SET column is described with a numeric default value:
@@ -7931,6 +7967,7 @@ bool Item_direct_view_ref::fix_fields(THD *thd, Item **reference)
return TRUE;
if (view->table && view->table->maybe_null)
maybe_null= TRUE;
+ set_null_ref_table();
return FALSE;
}
@@ -9470,6 +9507,11 @@ bool Item_type_holder::join_types(THD *thd, Item *item)
item_decimals= 0;
decimals= MY_MAX(decimals, item_decimals);
}
+
+ if (fld_type == FIELD_TYPE_GEOMETRY)
+ geometry_type=
+ Field_geom::geometry_type_merge(geometry_type, item->get_geometry_type());
+
if (Field::result_merge_type(fld_type) == DECIMAL_RESULT)
{
decimals= MY_MIN(MY_MAX(decimals, item->decimals), DECIMAL_MAX_SCALE);
@@ -9775,13 +9817,30 @@ void Item_ref::update_used_tables()
(*ref)->update_used_tables();
}
+void Item_direct_view_ref::update_used_tables()
+{
+ set_null_ref_table();
+ Item_direct_ref::update_used_tables();
+}
+
+
table_map Item_direct_view_ref::used_tables() const
{
- return get_depended_from() ?
- OUTER_REF_TABLE_BIT :
- ((view->is_merged_derived() || view->merged || !view->table) ?
- (*ref)->used_tables() :
- view->table->map);
+ DBUG_ASSERT(null_ref_table);
+
+ if (get_depended_from())
+ return OUTER_REF_TABLE_BIT;
+
+ if (view->is_merged_derived() || view->merged || !view->table)
+ {
+ table_map used= (*ref)->used_tables();
+ return (used ?
+ used :
+ ((null_ref_table != NO_NULL_TABLE) ?
+ null_ref_table->map :
+ (table_map)0 ));
+ }
+ return view->table->map;
}
table_map Item_direct_view_ref::not_null_tables() const
diff --git a/sql/item.h b/sql/item.h
index 13e80639657..171bdb05310 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -1,8 +1,8 @@
#ifndef SQL_ITEM_INCLUDED
#define SQL_ITEM_INCLUDED
-/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
- Copyright (c) 2009, 2013 Monty Program Ab.
+/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
+ Copyright (c) 2009, 2015, MariaDB
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
@@ -2931,8 +2931,9 @@ public:
{
set_cs_specified(true);
}
- Item_string_with_introducer(const String *str, CHARSET_INFO *tocs)
- :Item_string(str->ptr(), str->length(), tocs)
+ Item_string_with_introducer(const char *name,
+ const char *str, uint length, CHARSET_INFO *tocs)
+ :Item_string(name, str, length, tocs)
{
set_cs_specified(true);
}
@@ -3734,13 +3735,16 @@ class Item_direct_view_ref :public Item_direct_ref
#define NO_NULL_TABLE (reinterpret_cast<TABLE *>(0x1))
+ void set_null_ref_table()
+ {
+ if (!view->is_inner_table_of_outer_join() ||
+ !(null_ref_table= view->get_real_join_table()))
+ null_ref_table= NO_NULL_TABLE;
+ }
+
bool check_null_ref()
{
- if (null_ref_table == NULL)
- {
- if (!(null_ref_table= view->get_real_join_table()))
- null_ref_table= NO_NULL_TABLE;
- }
+ DBUG_ASSERT(null_ref_table);
if (null_ref_table != NO_NULL_TABLE && null_ref_table->null_row)
{
null_value= 1;
@@ -3748,6 +3752,7 @@ class Item_direct_view_ref :public Item_direct_ref
}
return FALSE;
}
+
public:
Item_direct_view_ref(Name_resolution_context *context_arg, Item **item,
const char *table_name_arg,
@@ -3755,7 +3760,11 @@ public:
TABLE_LIST *view_arg)
:Item_direct_ref(context_arg, item, table_name_arg, field_name_arg),
item_equal(0), view(view_arg),
- null_ref_table(NULL) {}
+ null_ref_table(NULL)
+ {
+ if (fixed)
+ set_null_ref_table();
+ }
bool fix_fields(THD *, Item **);
bool eq(const Item *item, bool binary_cmp) const;
@@ -3773,7 +3782,9 @@ public:
Item *equal_fields_propagator(uchar *arg);
Item *replace_equal_field(uchar *arg);
table_map used_tables() const;
+ void update_used_tables();
table_map not_null_tables() const;
+ bool const_item() const { return used_tables() == 0; }
bool walk(Item_processor processor, bool walk_subquery, uchar *arg)
{
return (*ref)->walk(processor, walk_subquery, arg) ||
@@ -4466,7 +4477,6 @@ class Item_cache: public Item_basic_constant
{
protected:
Item *example;
- table_map used_table_map;
/**
Field that this object will get value from. This is used by
index-based subquery engines to detect and remove the equality injected
@@ -4484,7 +4494,7 @@ protected:
bool value_cached;
public:
Item_cache():
- example(0), used_table_map(0), cached_field(0),
+ example(0), cached_field(0),
cached_field_type(MYSQL_TYPE_STRING),
value_cached(0)
{
@@ -4493,7 +4503,7 @@ public:
null_value= 1;
}
Item_cache(enum_field_types field_type_arg):
- example(0), used_table_map(0), cached_field(0),
+ example(0), cached_field(0),
cached_field_type(field_type_arg),
value_cached(0)
{
@@ -4502,8 +4512,6 @@ public:
null_value= 1;
}
- void set_used_tables(table_map map) { used_table_map= map; }
-
virtual bool allocate(uint i) { return 0; }
virtual bool setup(Item *item)
{
@@ -4520,7 +4528,6 @@ public:
enum_field_types field_type() const { return cached_field_type; }
static Item_cache* get_cache(const Item *item);
static Item_cache* get_cache(const Item* item, const Item_result type);
- table_map used_tables() const { return used_table_map; }
virtual void keep_array() {}
virtual void print(String *str, enum_query_type query_type);
bool eq_def(Field *field)
@@ -4571,6 +4578,7 @@ public:
return TRUE;
return (this->*processor)(arg);
}
+ virtual Item *safe_charset_converter(CHARSET_INFO *tocs);
};
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 1f1982ffb80..90eef1ea55c 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -5160,10 +5160,65 @@ bool Regexp_processor_pcre::compile(Item *item, bool send_error)
}
+/**
+ Send a warning explaining an error code returned by pcre_exec().
+*/
+void Regexp_processor_pcre::pcre_exec_warn(int rc) const
+{
+ char buf[64];
+ const char *errmsg= NULL;
+ /*
+ Make a descriptive message only for those pcre_exec() error codes
+ that can actually happen in MariaDB.
+ */
+ switch (rc)
+ {
+ case PCRE_ERROR_NOMEMORY:
+ errmsg= "pcre_exec: Out of memory";
+ break;
+ case PCRE_ERROR_BADUTF8:
+ errmsg= "pcre_exec: Invalid utf8 byte sequence in the subject string";
+ break;
+ case PCRE_ERROR_RECURSELOOP:
+ errmsg= "pcre_exec: Recursion loop detected";
+ break;
+ default:
+ /*
+ As other error codes should normally not happen,
+ we just report the error code without textual description
+ of the code.
+ */
+ my_snprintf(buf, sizeof(buf), "pcre_exec: Internal error (%d)", rc);
+ errmsg= buf;
+ }
+ push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_REGEXP_ERROR, ER(ER_REGEXP_ERROR), errmsg);
+}
+
+
+/**
+ Call pcre_exec() and send a warning if pcre_exec() returned with an error.
+*/
+int Regexp_processor_pcre::pcre_exec_with_warn(const pcre *code,
+ const pcre_extra *extra,
+ const char *subject,
+ int length, int startoffset,
+ int options, int *ovector,
+ int ovecsize)
+{
+ int rc= pcre_exec(code, extra, subject, length,
+ startoffset, options, ovector, ovecsize);
+ DBUG_EXECUTE_IF("pcre_exec_error_123", rc= -123;);
+ if (rc < PCRE_ERROR_NOMATCH)
+ pcre_exec_warn(rc);
+ return rc;
+}
+
+
bool Regexp_processor_pcre::exec(const char *str, int length, int offset)
{
- m_pcre_exec_rc= pcre_exec(m_pcre, NULL, str, length,
- offset, 0, m_SubStrVec, m_subpatterns_needed * 3);
+ m_pcre_exec_rc= pcre_exec_with_warn(m_pcre, NULL, str, length, offset, 0,
+ m_SubStrVec, m_subpatterns_needed * 3);
return false;
}
@@ -5173,8 +5228,10 @@ bool Regexp_processor_pcre::exec(String *str, int offset,
{
if (!(str= convert_if_needed(str, &subject_converter)))
return true;
- m_pcre_exec_rc= pcre_exec(m_pcre, NULL, str->c_ptr_safe(), str->length(),
- offset, 0, m_SubStrVec, m_subpatterns_needed * 3);
+ m_pcre_exec_rc= pcre_exec_with_warn(m_pcre, NULL,
+ str->c_ptr_safe(), str->length(),
+ offset, 0,
+ m_SubStrVec, m_subpatterns_needed * 3);
if (m_pcre_exec_rc > 0)
{
uint i;
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index 5d11057228c..c4933e6d7ed 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -734,6 +734,11 @@ public:
void fix_length_and_dec();
const char *func_name() const { return "interval"; }
uint decimal_precision() const { return 2; }
+ void print(String *str, enum_query_type query_type)
+ {
+ str->append(func_name());
+ print_args(str, 0, query_type);
+ }
};
@@ -1544,6 +1549,10 @@ class Regexp_processor_pcre
int m_pcre_exec_rc;
int m_SubStrVec[30];
uint m_subpatterns_needed;
+ void pcre_exec_warn(int rc) const;
+ int pcre_exec_with_warn(const pcre *code, const pcre_extra *extra,
+ const char *subject, int length, int startoffset,
+ int options, int *ovector, int ovecsize);
public:
String *convert_if_needed(String *src, String *converter);
String subject_converter;
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 92ddd5feada..0dabd06d423 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2014, Oracle and/or its affiliates.
- Copyright (c) 2009, 2014, SkySQL Ab.
+ Copyright (c) 2009, 2015, MariaDB
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
@@ -3659,8 +3659,12 @@ bool udf_handler::get_arguments()
{
f_args.args[i]= (char*) res->ptr();
f_args.lengths[i]= res->length();
- break;
}
+ else
+ {
+ f_args.lengths[i]= 0;
+ }
+ break;
}
case INT_RESULT:
*((longlong*) to) = args[i]->val_int();
@@ -3939,11 +3943,11 @@ longlong Item_master_pos_wait::val_int()
}
#ifdef HAVE_REPLICATION
longlong pos = (ulong)args[1]->val_int();
- longlong timeout = (arg_count==3) ? args[2]->val_int() : 0 ;
+ longlong timeout = (arg_count>=3) ? args[2]->val_int() : 0 ;
String connection_name_buff;
LEX_STRING connection_name;
Master_info *mi;
- if (arg_count == 4)
+ if (arg_count >= 4)
{
String *con;
if (!(con= args[3]->val_str(&connection_name_buff)))
diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc
index 6d7a6a5e6ff..124c9ce6b72 100644
--- a/sql/item_geofunc.cc
+++ b/sql/item_geofunc.cc
@@ -1287,6 +1287,13 @@ String *Item_func_buffer::val_str(String *str_value)
if (dist > 0.0)
mbr.buffer(dist);
+ else
+ {
+ /* This happens when dist is too far negative. */
+ if (mbr.xmax + dist < mbr.xmin || mbr.ymax + dist < mbr.ymin)
+ goto return_empty_result;
+ }
+
collector.set_extent(mbr.xmin, mbr.xmax, mbr.ymin, mbr.ymax);
/*
If the distance given is 0, the Buffer function is in fact NOOP,
@@ -1314,6 +1321,7 @@ String *Item_func_buffer::val_str(String *str_value)
goto mem_error;
+return_empty_result:
str_value->set_charset(&my_charset_bin);
if (str_value->reserve(SRID_SIZE, 512))
goto mem_error;
diff --git a/sql/item_geofunc.h b/sql/item_geofunc.h
index 6d52661e5c9..94be38e26ee 100644
--- a/sql/item_geofunc.h
+++ b/sql/item_geofunc.h
@@ -2,7 +2,7 @@
#define ITEM_GEOFUNC_INCLUDED
/* Copyright (c) 2000, 2010 Oracle and/or its affiliates.
- Copyright (C) 2011 Monty Program Ab.
+ Copyright (C) 2011, 2015 MariaDB
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
@@ -116,7 +116,7 @@ class Item_func_point: public Item_geometry_func
public:
Item_func_point(Item *a, Item *b): Item_geometry_func(a, b) {}
Item_func_point(Item *a, Item *b, Item *srid): Item_geometry_func(a, b, srid) {}
- const char *func_name() const { return "st_point"; }
+ const char *func_name() const { return "point"; }
String *val_str(String *);
Field::geometry_type get_geometry_type() const;
};
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 32a19341895..972ae5afb16 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -5122,6 +5122,16 @@ null:
void Item_dyncol_get::print(String *str, enum_query_type query_type)
{
+ /*
+ Parent cast doesn't exist yet, only print dynamic column name. This happens
+ when called from create_func_cast() / wrong_precision_error().
+ */
+ if (!str->length())
+ {
+ args[1]->print(str, query_type);
+ return;
+ }
+
/* see create_func_dyncol_get */
DBUG_ASSERT(str->length() >= 5);
DBUG_ASSERT(strncmp(str->ptr() + str->length() - 5, "cast(", 5) == 0);
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index 8377a20e0a4..2886cb68f9b 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -3,7 +3,7 @@
/*
Copyright (c) 2000, 2011, Oracle and/or its affiliates.
- Copyright (c) 2009, 2013, Monty Program Ab.
+ Copyright (c) 2009, 2015, MariaDB
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
@@ -937,7 +937,6 @@ public:
Item_func_conv_charset(Item *a, CHARSET_INFO *cs, bool cache_if_const)
:Item_str_func(a)
{
- DBUG_ASSERT(args[0]->fixed);
conv_charset= cs;
if (cache_if_const && args[0]->const_item() && !args[0]->is_expensive())
{
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 21f14ae8435..1c5682417a5 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -1,5 +1,5 @@
-/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
- Copyright (c) 2008, 2014, SkySQL Ab.
+/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
+ Copyright (c) 2008, 2015, MariaDB
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
@@ -3311,7 +3311,19 @@ void Item_func_group_concat::cleanup()
}
DBUG_ASSERT(tree == 0);
}
-
+ /*
+ As the ORDER structures pointed to by the elements of the
+ 'order' array may be modified in find_order_in_list() called
+ from Item_func_group_concat::setup() to point to runtime
+ created objects, we need to reset them back to the original
+ arguments of the function.
+ */
+ ORDER **order_ptr= order;
+ for (uint i= 0; i < arg_count_order; i++)
+ {
+ (*order_ptr)->item= &args[arg_count_field + i];
+ order_ptr++;
+ }
DBUG_VOID_RETURN;
}
diff --git a/sql/lex.h b/sql/lex.h
index 10a52160cf0..a272504c0f2 100644
--- a/sql/lex.h
+++ b/sql/lex.h
@@ -1,7 +1,8 @@
#ifndef LEX_INCLUDED
#define LEX_INCLUDED
-/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2010, Oracle and/or its affiliates.
+ Copyright (c) 2009, 2015, MariaDB
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
@@ -389,6 +390,7 @@ static SYMBOL symbols[] = {
{ "MULTIPOINT", SYM(MULTIPOINT)},
{ "MULTIPOLYGON", SYM(MULTIPOLYGON)},
{ "MUTEX", SYM(MUTEX_SYM)},
+ { "MYSQL", SYM(MYSQL_SYM)},
{ "MYSQL_ERRNO", SYM(MYSQL_ERRNO_SYM)},
{ "NAME", SYM(NAME_SYM)},
{ "NAMES", SYM(NAMES_SYM)},
diff --git a/sql/log.cc b/sql/log.cc
index 38fe1066896..99d3fb69b18 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
- Copyright (c) 2009, 2014, SkySQL Ab.
+ Copyright (c) 2009, 2015, MariaDB
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
@@ -95,6 +95,9 @@ mysql_mutex_t LOCK_commit_ordered;
static ulonglong binlog_status_var_num_commits;
static ulonglong binlog_status_var_num_group_commits;
+static ulonglong binlog_status_group_commit_trigger_count;
+static ulonglong binlog_status_group_commit_trigger_lock_wait;
+static ulonglong binlog_status_group_commit_trigger_timeout;
static char binlog_snapshot_file[FN_REFLEN];
static ulonglong binlog_snapshot_position;
@@ -104,6 +107,12 @@ static SHOW_VAR binlog_status_vars_detail[]=
(char *)&binlog_status_var_num_commits, SHOW_LONGLONG},
{"group_commits",
(char *)&binlog_status_var_num_group_commits, SHOW_LONGLONG},
+ {"group_commit_trigger_count",
+ (char *)&binlog_status_group_commit_trigger_count, SHOW_LONGLONG},
+ {"group_commit_trigger_lock_wait",
+ (char *)&binlog_status_group_commit_trigger_lock_wait, SHOW_LONGLONG},
+ {"group_commit_trigger_timeout",
+ (char *)&binlog_status_group_commit_trigger_timeout, SHOW_LONGLONG},
{"snapshot_file",
(char *)&binlog_snapshot_file, SHOW_CHAR},
{"snapshot_position",
@@ -2484,6 +2493,8 @@ bool MYSQL_LOG::open(
char buff[FN_REFLEN];
MY_STAT f_stat;
File file= -1;
+ my_off_t seek_offset;
+ bool is_fifo = false;
int open_flags= O_CREAT | O_BINARY;
DBUG_ENTER("MYSQL_LOG::open");
DBUG_PRINT("enter", ("log_type: %d", (int) log_type_arg));
@@ -2500,15 +2511,17 @@ 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;
+ is_fifo = my_stat(log_file_name, &f_stat, MYF(0)) &&
+ MY_S_ISFIFO(f_stat.st_mode);
if (io_cache_type == SEQ_READ_APPEND)
open_flags |= O_RDWR | O_APPEND;
else
open_flags |= O_WRONLY | (log_type == LOG_BIN ? 0 : O_APPEND);
+ if (is_fifo)
+ open_flags |= O_NONBLOCK;
+
db[0]= 0;
#ifdef HAVE_PSI_INTERFACE
@@ -2516,11 +2529,16 @@ bool MYSQL_LOG::open(
m_log_file_key= log_file_key;
#endif
- if ((file= mysql_file_open(log_file_key,
- log_file_name, open_flags,
- MYF(MY_WME | ME_WAITTANG))) < 0 ||
- init_io_cache(&log_file, file, IO_SIZE, io_cache_type,
- mysql_file_tell(file, MYF(MY_WME)), 0,
+ if ((file= mysql_file_open(log_file_key, log_file_name, open_flags,
+ MYF(MY_WME | ME_WAITTANG))) < 0)
+ goto err;
+
+ if (is_fifo)
+ seek_offset= 0;
+ else if ((seek_offset= mysql_file_tell(file, MYF(MY_WME))))
+ goto err;
+
+ if (init_io_cache(&log_file, file, IO_SIZE, io_cache_type, seek_offset, 0,
MYF(MY_WME | MY_NABP |
((log_type == LOG_BIN) ? MY_WAIT_IF_FULL : 0))))
goto err;
@@ -2609,17 +2627,17 @@ void MYSQL_LOG::close(uint exiting)
{
end_io_cache(&log_file);
- if (mysql_file_sync(log_file.file, MYF(MY_WME)) && ! write_error)
+ if (log_type == LOG_BIN && mysql_file_sync(log_file.file, MYF(MY_WME)) && ! write_error)
{
write_error= 1;
- sql_print_error(ER(ER_ERROR_ON_WRITE), name, errno);
+ sql_print_error(ER_THD_OR_DEFAULT(current_thd, ER_ERROR_ON_WRITE), name, errno);
}
if (!(exiting & LOG_CLOSE_DELAYED_CLOSE) &&
mysql_file_close(log_file.file, MYF(MY_WME)) && ! write_error)
{
write_error= 1;
- sql_print_error(ER(ER_ERROR_ON_WRITE), name, errno);
+ sql_print_error(ER_THD_OR_DEFAULT(current_thd, ER_ERROR_ON_WRITE), name, errno);
}
}
@@ -3035,6 +3053,8 @@ MYSQL_BIN_LOG::MYSQL_BIN_LOG(uint *sync_period)
bytes_written(0), file_id(1), open_count(1),
group_commit_queue(0), group_commit_queue_busy(FALSE),
num_commits(0), num_group_commits(0),
+ group_commit_trigger_count(0), group_commit_trigger_timeout(0),
+ group_commit_trigger_lock_wait(0),
sync_period_ptr(sync_period), sync_counter(0),
state_file_deleted(false), binlog_state_recover_done(false),
is_relay_log(0), signal_cnt(0),
@@ -4134,8 +4154,7 @@ int MYSQL_BIN_LOG::purge_first_log(Relay_log_info* rli, bool included)
included= 1;
to_purge_if_included= my_strdup(ir->name, MYF(0));
}
- my_atomic_rwlock_destroy(&ir->inuse_relaylog_atomic_lock);
- my_free(ir);
+ rli->free_inuse_relaylog(ir);
ir= next;
}
rli->inuse_relaylog_list= ir;
@@ -5653,6 +5672,14 @@ end:
}
+/*
+ Initialize the binlog state from the master-bin.state file, at server startup.
+
+ Returns:
+ 0 for success.
+ 2 for when .state file did not exist.
+ 1 for other error.
+*/
int
MYSQL_BIN_LOG::read_state_from_file()
{
@@ -5680,7 +5707,7 @@ MYSQL_BIN_LOG::read_state_from_file()
with GTID enabled. So initialize to empty state.
*/
rpl_global_gtid_binlog_state.reset();
- err= 0;
+ err= 2;
goto end;
}
}
@@ -5850,6 +5877,7 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info, my_bool *with_annotate)
if (direct)
{
int res;
+ uint64 commit_id= 0;
DBUG_PRINT("info", ("direct is set"));
if ((res= thd->wait_for_prior_commit()))
DBUG_RETURN(res);
@@ -5857,7 +5885,16 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info, my_bool *with_annotate)
my_org_b_tell= my_b_tell(file);
mysql_mutex_lock(&LOCK_log);
prev_binlog_id= current_binlog_id;
- if (write_gtid_event(thd, true, using_trans, 0))
+ DBUG_EXECUTE_IF("binlog_force_commit_id",
+ {
+ const LEX_STRING name= { C_STRING_WITH_LEN("commit_id") };
+ bool null_value;
+ user_var_entry *entry=
+ (user_var_entry*) my_hash_search(&thd->user_vars,
+ (uchar*) name.str, name.length);
+ commit_id= entry->val_int(&null_value);
+ });
+ if (write_gtid_event(thd, true, using_trans, commit_id))
goto err;
}
else
@@ -6637,6 +6674,10 @@ bool MYSQL_BIN_LOG::write_incident(THD *thd)
if (check_purge)
checkpoint_and_purge(prev_binlog_id);
}
+ else
+ {
+ mysql_mutex_unlock(&LOCK_log);
+ }
DBUG_RETURN(error);
}
@@ -7022,6 +7063,14 @@ MYSQL_BIN_LOG::queue_for_group_commit(group_commit_entry *orig_entry)
}
}
+ /*
+ Handle the heuristics that if another transaction is waiting for this
+ transaction (or if it does so later), then we want to trigger group
+ commit immediately, without waiting for the binlog_commit_wait_usec
+ timeout to expire.
+ */
+ entry->thd->waiting_on_group_commit= true;
+
/* Add the entry to the group commit queue. */
next_entry= entry->next;
entry->next= group_commit_queue;
@@ -7037,7 +7086,7 @@ MYSQL_BIN_LOG::queue_for_group_commit(group_commit_entry *orig_entry)
cur= entry->thd->wait_for_commit_ptr;
}
- if (opt_binlog_commit_wait_count > 0)
+ if (opt_binlog_commit_wait_count > 0 && orig_queue != NULL)
mysql_cond_signal(&COND_prepare_ordered);
mysql_mutex_unlock(&LOCK_prepare_ordered);
DEBUG_SYNC(orig_entry->thd, "commit_after_release_LOCK_prepare_ordered");
@@ -7211,6 +7260,11 @@ MYSQL_BIN_LOG::trx_group_commit_leader(group_commit_entry *leader)
while (current)
{
group_commit_entry *next= current->next;
+ /*
+ Now that group commit is started, we can clear the flag; there is no
+ longer any use in waiters on this commit trying to trigger it early.
+ */
+ current->thd->waiting_on_group_commit= false;
current->next= queue;
queue= current;
current= next;
@@ -7224,6 +7278,15 @@ MYSQL_BIN_LOG::trx_group_commit_leader(group_commit_entry *leader)
if (likely(is_open())) // Should always be true
{
commit_id= (last_in_queue == leader ? 0 : (uint64)leader->thd->query_id);
+ DBUG_EXECUTE_IF("binlog_force_commit_id",
+ {
+ const LEX_STRING name= { C_STRING_WITH_LEN("commit_id") };
+ bool null_value;
+ user_var_entry *entry=
+ (user_var_entry*) my_hash_search(&leader->thd->user_vars,
+ (uchar*) name.str, name.length);
+ commit_id= entry->val_int(&null_value);
+ });
/*
Commit every transaction in the queue.
@@ -7340,6 +7403,8 @@ MYSQL_BIN_LOG::trx_group_commit_leader(group_commit_entry *leader)
my_error(ER_ERROR_ON_WRITE, MYF(ME_NOREFRESH), name, errno);
check_purge= false;
}
+ /* In case of binlog rotate, update the correct current binlog offset. */
+ commit_offset= my_b_write_tell(&log_file);
}
DEBUG_SYNC(leader->thd, "commit_before_get_LOCK_commit_ordered");
@@ -7521,8 +7586,18 @@ MYSQL_BIN_LOG::wait_for_sufficient_commits()
mysql_mutex_assert_owner(&LOCK_prepare_ordered);
for (e= last_head= group_commit_queue, count= 0; e; e= e->next)
+ {
if (++count >= opt_binlog_commit_wait_count)
+ {
+ group_commit_trigger_count++;
+ return;
+ }
+ if (unlikely(e->thd->has_waiter))
+ {
+ group_commit_trigger_lock_wait++;
return;
+ }
+ }
mysql_mutex_unlock(&LOCK_log);
set_timespec_nsec(wait_until, (ulonglong)1000*opt_binlog_commit_wait_usec);
@@ -7535,14 +7610,33 @@ MYSQL_BIN_LOG::wait_for_sufficient_commits()
err= mysql_cond_timedwait(&COND_prepare_ordered, &LOCK_prepare_ordered,
&wait_until);
if (err == ETIMEDOUT)
+ {
+ group_commit_trigger_timeout++;
break;
+ }
+ if (unlikely(last_head->thd->has_waiter))
+ {
+ group_commit_trigger_lock_wait++;
+ break;
+ }
head= group_commit_queue;
for (e= head; e && e != last_head; e= e->next)
+ {
++count;
+ if (unlikely(e->thd->has_waiter))
+ {
+ group_commit_trigger_lock_wait++;
+ goto after_loop;
+ }
+ }
if (count >= opt_binlog_commit_wait_count)
+ {
+ group_commit_trigger_count++;
break;
+ }
last_head= head;
}
+after_loop:
/*
We must not wait for LOCK_log while holding LOCK_prepare_ordered.
@@ -7566,6 +7660,42 @@ MYSQL_BIN_LOG::wait_for_sufficient_commits()
}
+void
+MYSQL_BIN_LOG::binlog_trigger_immediate_group_commit()
+{
+ group_commit_entry *head;
+ mysql_mutex_lock(&LOCK_prepare_ordered);
+ head= group_commit_queue;
+ if (head)
+ {
+ head->thd->has_waiter= true;
+ mysql_cond_signal(&COND_prepare_ordered);
+ }
+ mysql_mutex_unlock(&LOCK_prepare_ordered);
+}
+
+
+/*
+ This function is called when a transaction T1 goes to wait for another
+ transaction T2. It is used to cut short any binlog group commit delay from
+ --binlog-commit-wait-count in the case where another transaction is stalled
+ on the wait due to conflicting row locks.
+
+ If T2 is already ready to group commit, any waiting group commit will be
+ signalled to proceed immediately. Otherwise, a flag will be set in T2, and
+ when T2 later becomes ready, immediate group commit will be triggered.
+*/
+void
+binlog_report_wait_for(THD *thd1, THD *thd2)
+{
+ if (opt_binlog_commit_wait_count == 0)
+ return;
+ thd2->has_waiter= true;
+ if (thd2->waiting_on_group_commit)
+ mysql_bin_log.binlog_trigger_immediate_group_commit();
+}
+
+
/**
Wait until we get a signal that the relay log has been updated.
@@ -9444,7 +9574,17 @@ MYSQL_BIN_LOG::do_binlog_recovery(const char *opt_name, bool do_xa_recovery)
if (error != LOG_INFO_EOF)
sql_print_error("find_log_pos() failed (error: %d)", error);
else
+ {
error= read_state_from_file();
+ if (error == 2)
+ {
+ /*
+ No binlog files and no binlog state is not an error (eg. just initial
+ server start after fresh installation).
+ */
+ error= 0;
+ }
+ }
return error;
}
@@ -9470,15 +9610,42 @@ MYSQL_BIN_LOG::do_binlog_recovery(const char *opt_name, bool do_xa_recovery)
if ((ev= Log_event::read_log_event(&log, 0, &fdle,
opt_master_verify_checksum)) &&
- ev->get_type_code() == FORMAT_DESCRIPTION_EVENT &&
- ev->flags & LOG_EVENT_BINLOG_IN_USE_F)
+ ev->get_type_code() == FORMAT_DESCRIPTION_EVENT)
{
- sql_print_information("Recovering after a crash using %s", opt_name);
- error= recover(&log_info, log_name, &log,
- (Format_description_log_event *)ev, do_xa_recovery);
+ if (ev->flags & LOG_EVENT_BINLOG_IN_USE_F)
+ {
+ sql_print_information("Recovering after a crash using %s", opt_name);
+ error= recover(&log_info, log_name, &log,
+ (Format_description_log_event *)ev, do_xa_recovery);
+ }
+ else
+ {
+ error= read_state_from_file();
+ if (error == 2)
+ {
+ /*
+ The binlog exists, but the .state file is missing. This is normal if
+ this is the first master start after a major upgrade to 10.0 (with
+ GTID support).
+
+ However, it could also be that the .state file was lost somehow, and
+ in this case it could be a serious issue, as we would set the wrong
+ binlog state in the next binlog file to be created, and GTID
+ processing would be corrupted. A common way would be copying files
+ from an old server to a new one and forgetting the .state file.
+
+ So in this case, we want to try to recover the binlog state by
+ scanning the last binlog file (but we do not need any XA recovery).
+
+ ToDo: We could avoid one scan at first start after major upgrade, by
+ detecting that there is no GTID_LIST event at the start of the
+ binlog file, and stopping the scan in that case.
+ */
+ error= recover(&log_info, log_name, &log,
+ (Format_description_log_event *)ev, false);
+ }
+ }
}
- else
- error= read_state_from_file();
delete ev;
end_io_cache(&log);
@@ -9650,6 +9817,11 @@ TC_LOG_BINLOG::set_status_variables(THD *thd)
binlog_snapshot_position= last_commit_pos_offset;
}
mysql_mutex_unlock(&LOCK_commit_ordered);
+ mysql_mutex_lock(&LOCK_prepare_ordered);
+ binlog_status_group_commit_trigger_count= this->group_commit_trigger_count;
+ binlog_status_group_commit_trigger_timeout= this->group_commit_trigger_timeout;
+ binlog_status_group_commit_trigger_lock_wait= this->group_commit_trigger_lock_wait;
+ mysql_mutex_unlock(&LOCK_prepare_ordered);
if (have_snapshot)
{
diff --git a/sql/log.h b/sql/log.h
index a93e2e1c0b9..48970f7452a 100644
--- a/sql/log.h
+++ b/sql/log.h
@@ -515,6 +515,9 @@ class MYSQL_BIN_LOG: public TC_LOG, private MYSQL_LOG
ulonglong num_commits;
/* Number of group commits done. */
ulonglong num_group_commits;
+ /* The reason why the group commit was grouped */
+ ulonglong group_commit_trigger_count, group_commit_trigger_timeout;
+ ulonglong group_commit_trigger_lock_wait;
/* pointer to the sync period variable, for binlog this will be
sync_binlog_period, for relay log this will be
@@ -690,6 +693,7 @@ public:
void set_max_size(ulong max_size_arg);
void signal_update();
void wait_for_sufficient_commits();
+ void binlog_trigger_immediate_group_commit();
void wait_for_update_relay_log(THD* thd);
int wait_for_update_bin_log(THD* thd, const struct timespec * timeout);
void init(ulong max_size);
@@ -986,11 +990,9 @@ uint purge_log_get_error_code(int res);
int vprint_msg_to_log(enum loglevel level, const char *format, va_list args);
void sql_print_error(const char *format, ...);
-void sql_print_warning(const char *format, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
-void sql_print_information(const char *format, ...)
- ATTRIBUTE_FORMAT(printf, 1, 2);
-typedef void (*sql_print_message_func)(const char *format, ...)
- ATTRIBUTE_FORMAT_FPTR(printf, 1, 2);
+void sql_print_warning(const char *format, ...);
+void sql_print_information(const char *format, ...);
+typedef void (*sql_print_message_func)(const char *format, ...);
extern sql_print_message_func sql_print_message_handlers[];
int error_log_print(enum loglevel level, const char *format,
@@ -1005,6 +1007,7 @@ bool general_log_print(THD *thd, enum enum_server_command command,
bool general_log_write(THD *thd, enum enum_server_command command,
const char *query, uint query_length);
+void binlog_report_wait_for(THD *thd, THD *other_thd);
void sql_perror(const char *message);
bool flush_error_log();
diff --git a/sql/log_event.cc b/sql/log_event.cc
index dd272ac52cd..69b981f3f47 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -49,9 +49,12 @@
#include <base64.h>
#include <my_bitmap.h>
#include "rpl_utility.h"
+#include "sql_digest.h"
#define my_b_write_string(A, B) my_b_write((A), (B), (uint) (sizeof(B) - 1))
+using std::max;
+
/**
BINLOG_CHECKSUM variable.
*/
@@ -335,10 +338,6 @@ private:
flag_set m_flags;
};
-#ifndef DBUG_OFF
-uint debug_not_change_ts_if_art_event= 1; // bug#29309 simulation
-#endif
-
/*
pretty_print_str()
*/
@@ -877,7 +876,7 @@ Log_event::Log_event()
Log_event::Log_event(const char* buf,
const Format_description_log_event* description_event)
- :temp_buf(0), cache_type(Log_event::EVENT_INVALID_CACHE),
+ :temp_buf(0), exec_time(0), cache_type(Log_event::EVENT_INVALID_CACHE),
crc(0), checksum_alg(BINLOG_CHECKSUM_ALG_UNDEF)
{
#ifndef MYSQL_CLIENT
@@ -968,29 +967,12 @@ int Log_event::do_update_pos(rpl_group_info *rgi)
if (rli)
{
/*
- bug#29309 simulation: resetting the flag to force
- wrong behaviour of artificial event to update
- rli->last_master_timestamp for only one time -
- the first FLUSH LOGS in the test.
- */
- DBUG_EXECUTE_IF("let_first_flush_log_change_timestamp",
- if (debug_not_change_ts_if_art_event == 1
- && is_artificial_event())
- debug_not_change_ts_if_art_event= 0; );
- /*
In parallel execution, delay position update for the events that are
not part of event groups (format description, rotate, and such) until
the actual event execution reaches that point.
*/
if (!rgi->is_parallel_exec || is_group_event(get_type_code()))
- rli->stmt_done(log_pos,
- (is_artificial_event() &&
- IF_DBUG(debug_not_change_ts_if_art_event > 0, 1) ?
- 0 : when),
- thd, rgi);
- DBUG_EXECUTE_IF("let_first_flush_log_change_timestamp",
- if (debug_not_change_ts_if_art_event == 0)
- debug_not_change_ts_if_art_event= 2; );
+ rli->stmt_done(log_pos, thd, rgi);
}
DBUG_RETURN(0); // Cannot fail currently
}
@@ -1326,9 +1308,10 @@ int Log_event::read_log_event(IO_CACHE* file, String* packet,
}
data_len= uint4korr(buf + EVENT_LEN_OFFSET);
if (data_len < LOG_EVENT_MINIMAL_HEADER_LEN ||
- data_len > current_thd->variables.max_allowed_packet)
+ data_len > max(current_thd->variables.max_allowed_packet,
+ opt_binlog_rows_event_max_size + MAX_LOG_EVENT_HEADER))
{
- DBUG_PRINT("error",("data_len: %ld", data_len));
+ DBUG_PRINT("error",("data_len: %lu", data_len));
result= ((data_len < LOG_EVENT_MINIMAL_HEADER_LEN) ? LOG_READ_BOGUS :
LOG_READ_TOO_LARGE);
goto end;
@@ -1449,7 +1432,7 @@ failed my_b_read"));
*/
DBUG_RETURN(0);
}
- uint data_len = uint4korr(head + EVENT_LEN_OFFSET);
+ ulong data_len = uint4korr(head + EVENT_LEN_OFFSET);
char *buf= 0;
const char *error= 0;
Log_event *res= 0;
@@ -1458,7 +1441,8 @@ failed my_b_read"));
uint max_allowed_packet= thd ? slave_max_allowed_packet:~(uint)0;
#endif
- if (data_len > max_allowed_packet)
+ if (data_len > max<ulong>(max_allowed_packet,
+ opt_binlog_rows_event_max_size + MAX_LOG_EVENT_HEADER))
{
error = "Event too big";
goto err;
@@ -1492,7 +1476,7 @@ err:
{
DBUG_ASSERT(error != 0);
sql_print_error("Error in Log_event::read_log_event(): "
- "'%s', data_len: %d, event_type: %d",
+ "'%s', data_len: %lu, event_type: %d",
error,data_len,(uchar)(head[EVENT_TYPE_OFFSET]));
my_free(buf);
/*
@@ -2422,6 +2406,12 @@ log_event_print_value(IO_CACHE *file, const uchar *ptr,
my_snprintf(typestr, typestr_length, "STRING(%d)", length);
return my_b_write_quoted_with_length(file, ptr, length);
+ case MYSQL_TYPE_DECIMAL:
+ my_b_printf(file,
+ "!! Old DECIMAL (mysql-4.1 or earlier). "
+ "Not enough metadata to display the value. ");
+ break;
+
default:
{
char tmp[5];
@@ -4299,12 +4289,17 @@ int Query_log_event::do_apply_event(rpl_group_info *rgi,
Parser_state parser_state;
if (!parser_state.init(thd, thd->query(), thd->query_length()))
{
+ DBUG_ASSERT(thd->m_digest == NULL);
+ thd->m_digest= & thd->m_digest_state;
+ DBUG_ASSERT(thd->m_statement_psi == NULL);
thd->m_statement_psi= MYSQL_START_STATEMENT(&thd->m_statement_state,
stmt_info_rpl.m_key,
thd->db, thd->db_length,
thd->charset());
THD_STAGE_INFO(thd, stage_init);
MYSQL_SET_STATEMENT_TEXT(thd->m_statement_psi, thd->query(), thd->query_length());
+ if (thd->m_digest != NULL)
+ thd->m_digest->reset(thd->m_token_array, max_digest_length);
mysql_parse(thd, thd->query(), thd->query_length(), &parser_state);
/* Finalize server status flags after executing a statement. */
@@ -4396,11 +4391,10 @@ compare_errors:
!ignored_error_code(expected_error))
{
rli->report(ERROR_LEVEL, 0, rgi->gtid_info(),
- "\
-Query caused different errors on master and slave. \
-Error on master: message (format)='%s' error code=%d ; \
-Error on slave: actual message='%s', error code=%d. \
-Default database: '%s'. Query: '%s'",
+ "Query caused different errors on master and slave. "
+ "Error on master: message (format)='%s' error code=%d ; "
+ "Error on slave: actual message='%s', error code=%d. "
+ "Default database: '%s'. Query: '%s'",
ER_SAFE(expected_error),
expected_error,
actual_error ? thd->get_stmt_da()->message() : "no error",
@@ -4496,6 +4490,7 @@ end:
/* Mark the statement completed. */
MYSQL_END_STATEMENT(thd->m_statement_psi, thd->get_stmt_da());
thd->m_statement_psi= NULL;
+ thd->m_digest= NULL;
/*
As a disk space optimization, future masters will not log an event for
@@ -10103,7 +10098,7 @@ Rows_log_event::do_update_pos(rpl_group_info *rgi)
Step the group log position if we are not in a transaction,
otherwise increase the event log position.
*/
- rli->stmt_done(log_pos, when, thd, rgi);
+ rli->stmt_done(log_pos, thd, rgi);
/*
Clear any errors in thd->net.last_err*. It is not known if this is
needed or not. It is believed that any errors that may exist in
diff --git a/sql/log_event_old.cc b/sql/log_event_old.cc
index 181d950bf59..e6c05aeb849 100644
--- a/sql/log_event_old.cc
+++ b/sql/log_event_old.cc
@@ -1830,7 +1830,7 @@ Old_rows_log_event::do_update_pos(rpl_group_info *rgi)
Step the group log position if we are not in a transaction,
otherwise increase the event log position.
*/
- rli->stmt_done(log_pos, when, thd, rgi);
+ rli->stmt_done(log_pos, thd, rgi);
/*
Clear any errors in thd->net.last_err*. It is not known if this is
needed or not. It is believed that any errors that may exist in
diff --git a/sql/message.rc b/sql/message.rc
index 116522b7d48..0885a897e6f 100644
--- a/sql/message.rc
+++ b/sql/message.rc
@@ -1,2 +1,2 @@
-LANGUAGE 0x9,0x1
-1 11 MSG00001.bin
+LANGUAGE 0x9,0x1
+1 11 MSG00001.bin
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 7138027ff0a..c9682e15eae 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -1,5 +1,5 @@
-/* Copyright (c) 2000, 2014, Oracle and/or its affiliates.
- Copyright (c) 2008, 2014, SkySQL Ab.
+/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
+ Copyright (c) 2008, 2015, MariaDB
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
@@ -515,6 +515,7 @@ ulong binlog_cache_use= 0, binlog_cache_disk_use= 0;
ulong binlog_stmt_cache_use= 0, binlog_stmt_cache_disk_use= 0;
ulong max_connections, max_connect_errors;
ulong extra_max_connections;
+ulong max_digest_length= 0;
ulong slave_retried_transactions;
ulong feature_files_opened_with_delayed_keys;
ulonglong denied_connections;
@@ -2251,7 +2252,8 @@ static struct passwd *check_user(const char *user)
{
if (!opt_bootstrap && !opt_help)
{
- sql_print_error("Fatal error: Please read \"Security\" section of the manual to find out how to run mysqld as root!\n");
+ sql_print_error("Fatal error: Please consult the Knowledge Base "
+ "to find out how to run mysqld as root!\n");
unireg_abort(1);
}
return NULL;
@@ -2421,10 +2423,11 @@ static MYSQL_SOCKET activate_tcp_port(uint port)
if (mysql_socket_getfd(ip_sock) == INVALID_SOCKET)
{
- sql_print_error("Failed to create a socket for %s '%s': errno: %d.",
- (a->ai_family == AF_INET) ? "IPv4" : "IPv6",
- (const char *) ip_addr,
- (int) socket_errno);
+ sql_print_message_func func= real_bind_addr_str ? sql_print_error
+ : sql_print_warning;
+ func("Failed to create a socket for %s '%s': errno: %d.",
+ (a->ai_family == AF_INET) ? "IPv4" : "IPv6",
+ (const char *) ip_addr, (int) socket_errno);
}
else
{
@@ -4068,6 +4071,10 @@ static int init_common_variables()
return 1;
set_server_version();
+ if (!opt_help)
+ sql_print_information("%s (mysqld %s) starting as process %lu ...",
+ my_progname, server_version, (ulong) getpid());
+
#ifndef EMBEDDED_LIBRARY
if (opt_abort && !opt_verbose)
unireg_abort(0);
@@ -4338,11 +4345,12 @@ static int init_common_variables()
if (lower_case_table_names_used)
{
if (global_system_variables.log_warnings)
- sql_print_warning("\
-You have forced lower_case_table_names to 0 through a command-line \
-option, even though your file system '%s' is case insensitive. This means \
-that you can corrupt a MyISAM table by accessing it with different cases. \
-You should consider changing lower_case_table_names to 1 or 2",
+ sql_print_warning("You have forced lower_case_table_names to 0 through "
+ "a command-line option, even though your file system "
+ "'%s' is case insensitive. This means that you can "
+ "corrupt a MyISAM table by accessing it with "
+ "different cases. You should consider changing "
+ "lower_case_table_names to 1 or 2",
mysql_real_data_home);
}
else
@@ -4556,7 +4564,6 @@ static void init_ssl()
opt_ssl_cipher, &error,
opt_ssl_crl, opt_ssl_crlpath);
DBUG_PRINT("info",("ssl_acceptor_fd: 0x%lx", (long) ssl_acceptor_fd));
- ERR_remove_state(0);
if (!ssl_acceptor_fd)
{
sql_print_warning("Failed to setup SSL");
@@ -4564,6 +4571,14 @@ static void init_ssl()
opt_use_ssl = 0;
have_ssl= SHOW_OPTION_DISABLED;
}
+ if (global_system_variables.log_warnings > 0)
+ {
+ ulong err;
+ while ((err= ERR_get_error()))
+ sql_print_warning("SSL error: %s", ERR_error_string(err, NULL));
+ }
+ else
+ ERR_remove_state(0);
}
else
{
@@ -4738,15 +4753,16 @@ static int init_server_components()
{
if (opt_bin_log)
{
- sql_print_error("using --replicate-same-server-id in conjunction with \
---log-slave-updates is impossible, it would lead to infinite loops in this \
-server.");
+ sql_print_error("using --replicate-same-server-id in conjunction with "
+ "--log-slave-updates is impossible, it would lead to "
+ "infinite loops in this server.");
unireg_abort(1);
}
else
- sql_print_warning("using --replicate-same-server-id in conjunction with \
---log-slave-updates would lead to infinite loops in this server. However this \
-will be ignored as the --log-bin option is not defined.");
+ sql_print_warning("using --replicate-same-server-id in conjunction with "
+ "--log-slave-updates would lead to infinite loops in "
+ "this server. However this will be ignored as the "
+ "--log-bin option is not defined.");
}
#endif
@@ -4759,8 +4775,8 @@ will be ignored as the --log-bin option is not defined.");
if (opt_bin_logname[0] &&
opt_bin_logname[strlen(opt_bin_logname) - 1] == FN_LIBCHAR)
{
- sql_print_error("Path '%s' is a directory name, please specify \
-a file name for --log-bin option", opt_bin_logname);
+ sql_print_error("Path '%s' is a directory name, please specify "
+ "a file name for --log-bin option", opt_bin_logname);
unireg_abort(1);
}
@@ -4770,8 +4786,9 @@ a file name for --log-bin option", opt_bin_logname);
opt_binlog_index_name[strlen(opt_binlog_index_name) - 1]
== FN_LIBCHAR)
{
- sql_print_error("Path '%s' is a directory name, please specify \
-a file name for --log-bin-index option", opt_binlog_index_name);
+ sql_print_error("Path '%s' is a directory name, please specify "
+ "a file name for --log-bin-index option",
+ opt_binlog_index_name);
unireg_abort(1);
}
@@ -5010,6 +5027,7 @@ a file name for --log-bin-index option", opt_binlog_index_name);
init_global_client_stats();
if (!opt_bootstrap)
servers_init(0);
+ init_status_vars();
DBUG_RETURN(0);
}
@@ -5258,6 +5276,8 @@ int mysqld_main(int argc, char **argv)
pfs_param.m_hints.m_table_open_cache= tc_size;
pfs_param.m_hints.m_max_connections= max_connections;
pfs_param.m_hints.m_open_files_limit= open_files_limit;
+ /* the performance schema digest size is the same as the SQL layer */
+ pfs_param.m_max_digest_length= max_digest_length;
PSI_hook= initialize_performance_schema(&pfs_param);
if (PSI_hook == NULL)
{
@@ -5458,7 +5478,6 @@ int mysqld_main(int argc, char **argv)
#endif
}
- init_status_vars();
if (opt_bootstrap) /* If running with bootstrap, do not start replication. */
opt_skip_slave_start= 1;
@@ -5538,6 +5557,8 @@ int mysqld_main(int argc, char **argv)
mysql_cond_signal(&COND_server_started);
mysql_mutex_unlock(&LOCK_server_started);
+ MYSQL_SET_STAGE(0 ,__FILE__, __LINE__);
+
#if defined(_WIN32) || defined(HAVE_SMEM)
handle_connections_methods();
#else
@@ -8080,16 +8101,15 @@ static void usage(void)
else
{
#ifdef __WIN__
- puts("NT and Win32 specific options:\n\
- --install Install the default service (NT).\n\
- --install-manual Install the default service started manually (NT).\n\
- --install service_name Install an optional service (NT).\n\
- --install-manual service_name Install an optional service started manually (NT).\n\
- --remove Remove the default service from the service list (NT).\n\
- --remove service_name Remove the service_name from the service list (NT).\n\
- --enable-named-pipe Only to be used for the default server (NT).\n\
- --standalone Dummy option to start as a standalone server (NT).\
-");
+ puts("NT and Win32 specific options:\n"
+ " --install Install the default service (NT).\n"
+ " --install-manual Install the default service started manually (NT).\n"
+ " --install service_name Install an optional service (NT).\n"
+ " --install-manual service_name Install an optional service started manually (NT).\n"
+ " --remove Remove the default service from the service list (NT).\n"
+ " --remove service_name Remove the service_name from the service list (NT).\n"
+ " --enable-named-pipe Only to be used for the default server (NT).\n"
+ " --standalone Dummy option to start as a standalone server (NT).");
puts("");
#endif
print_defaults(MYSQL_CONFIG_NAME,load_default_groups);
@@ -8101,14 +8121,12 @@ static void usage(void)
if (! plugins_are_initialized)
{
- puts("\n\
-Plugins have parameters that are not reflected in this list\n\
-because execution stopped before plugins were initialized.");
+ puts("\nPlugins have parameters that are not reflected in this list"
+ "\nbecause execution stopped before plugins were initialized.");
}
- puts("\n\
-To see what values a running MySQL server is using, type\n\
-'mysqladmin variables' instead of 'mysqld --verbose --help'.");
+ puts("\nTo see what values a running MySQL server is using, type"
+ "\n'mysqladmin variables' instead of 'mysqld --verbose --help'.");
}
DBUG_VOID_RETURN;
}
@@ -9498,6 +9516,7 @@ PSI_stage_info stage_waiting_for_work_from_sql_thread= { 0, "Waiting for work fr
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_waiting_for_workers_idle= { 0, "Waiting for worker threads to be idle", 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};
PSI_stage_info stage_gtid_wait_other_connection= { 0, "Waiting for other master connection to process GTID received on multiple master connections", 0};
diff --git a/sql/mysqld.h b/sql/mysqld.h
index f6d9dbea48a..156e7f99bb5 100644
--- a/sql/mysqld.h
+++ b/sql/mysqld.h
@@ -167,6 +167,7 @@ extern ulong query_cache_limit;
extern ulong query_cache_min_res_unit;
extern ulong slow_launch_threads, slow_launch_time;
extern MYSQL_PLUGIN_IMPORT ulong max_connections;
+extern ulong max_digest_length;
extern ulong max_connect_errors, connect_timeout;
extern my_bool slave_allow_batching;
extern my_bool allow_slave_start;
@@ -452,6 +453,7 @@ 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_waiting_for_workers_idle;
extern PSI_stage_info stage_master_gtid_wait_primary;
extern PSI_stage_info stage_master_gtid_wait;
extern PSI_stage_info stage_gtid_wait_other_connection;
diff --git a/sql/net_serv.cc b/sql/net_serv.cc
index 29b8417c698..0ce0fa93f99 100644
--- a/sql/net_serv.cc
+++ b/sql/net_serv.cc
@@ -917,7 +917,7 @@ my_real_read(NET *net, size_t *complen,
my_progname,vio_errno(net->vio));
}
#ifndef MYSQL_SERVER
- if (vio_errno(net->vio) == SOCKET_EINTR)
+ if (length != 0 && vio_errno(net->vio) == SOCKET_EINTR)
{
DBUG_PRINT("warning",("Interrupted read. Retrying..."));
continue;
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc
index 7d1f6dfbf9d..0ad90e2ef3d 100644
--- a/sql/opt_subselect.cc
+++ b/sql/opt_subselect.cc
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2010, 2012, Monty Program Ab
+ Copyright (c) 2010, 2015, MariaDB
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
@@ -513,8 +513,6 @@ bool is_materialization_applicable(THD *thd, Item_in_subselect *in_subs,
Subquery !contains {GROUP BY, ORDER BY [LIMIT],
aggregate functions}) && subquery predicate is not under "NOT IN"))
- (*) The subquery must be part of a SELECT or CREATE TABLE ... SELECT statement.
- The current condition also excludes multi-table update statements.
A note about prepared statements: we want the if-branch to be taken on
PREPARE and each EXECUTE. The rewrites are only done once, but we need
select_lex->sj_subselects list to be populated for every EXECUTE.
@@ -523,9 +521,7 @@ bool is_materialization_applicable(THD *thd, Item_in_subselect *in_subs,
if (optimizer_flag(thd, OPTIMIZER_SWITCH_MATERIALIZATION) && // 0
!child_select->is_part_of_union() && // 1
parent_unit->first_select()->leaf_tables.elements && // 2
- (thd->lex->sql_command == SQLCOM_SELECT || // *
- thd->lex->sql_command == SQLCOM_CREATE_TABLE) && // *
- child_select->outer_select()->leaf_tables.elements && // 2A
+ child_select->outer_select()->leaf_tables.elements && // 2A
subquery_types_allow_materialization(in_subs) &&
(in_subs->is_top_level_item() || //3
optimizer_flag(thd,
@@ -1615,9 +1611,20 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred)
sj_nest->sj_on_expr= and_items(sj_nest->sj_on_expr, item_eq);
}
}
- /* Fix the created equality and AND */
- if (!sj_nest->sj_on_expr->fixed)
- sj_nest->sj_on_expr->fix_fields(parent_join->thd, &sj_nest->sj_on_expr);
+ /*
+ Fix the created equality and AND
+
+ Note that fix_fields() can actually fail in a meaningful way here. One
+ example is when the IN-equality is not valid, because it compares columns
+ with incompatible collations. (One can argue it would be more appropriate
+ to check for this at name resolution stage, but as a legacy of IN->EXISTS
+ we have in here).
+ */
+ if (!sj_nest->sj_on_expr->fixed &&
+ sj_nest->sj_on_expr->fix_fields(parent_join->thd, &sj_nest->sj_on_expr))
+ {
+ DBUG_RETURN(TRUE);
+ }
/*
Walk through sj nest's WHERE and ON expressions and call
@@ -1636,12 +1643,15 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred)
/* Inject sj_on_expr into the parent's WHERE or ON */
if (emb_tbl_nest)
{
- emb_tbl_nest->on_expr= and_items(emb_tbl_nest->on_expr,
+ emb_tbl_nest->on_expr= and_items(emb_tbl_nest->on_expr,
sj_nest->sj_on_expr);
emb_tbl_nest->on_expr->top_level_item();
- if (!emb_tbl_nest->on_expr->fixed)
- emb_tbl_nest->on_expr->fix_fields(parent_join->thd,
- &emb_tbl_nest->on_expr);
+ if (!emb_tbl_nest->on_expr->fixed &&
+ emb_tbl_nest->on_expr->fix_fields(parent_join->thd,
+ &emb_tbl_nest->on_expr))
+ {
+ DBUG_RETURN(TRUE);
+ }
}
else
{
@@ -1654,8 +1664,12 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred)
*/
save_lex= thd->lex->current_select;
thd->lex->current_select=parent_join->select_lex;
- if (!parent_join->conds->fixed)
- parent_join->conds->fix_fields(parent_join->thd, &parent_join->conds);
+ if (!parent_join->conds->fixed &&
+ parent_join->conds->fix_fields(parent_join->thd,
+ &parent_join->conds))
+ {
+ DBUG_RETURN(1);
+ }
thd->lex->current_select=save_lex;
parent_join->select_lex->where= parent_join->conds;
}
@@ -2512,10 +2526,16 @@ void advance_sj_state(JOIN *join, table_map remaining_tables, uint idx,
LooseScan detector in best_access_path)
*/
remaining_tables &= ~new_join_tab->table->map;
- pos->prefix_dups_producing_tables= join->cur_dups_producing_tables;
+ table_map dups_producing_tables;
+
+ if (idx == join->const_tables)
+ dups_producing_tables= 0;
+ else
+ dups_producing_tables= pos[-1].dups_producing_tables;
+
TABLE_LIST *emb_sj_nest;
if ((emb_sj_nest= new_join_tab->emb_sj_nest))
- join->cur_dups_producing_tables |= emb_sj_nest->sj_inner_tables;
+ dups_producing_tables |= emb_sj_nest->sj_inner_tables;
Semi_join_strategy_picker **strategy;
if (idx == join->const_tables)
@@ -2568,7 +2588,7 @@ void advance_sj_state(JOIN *join, table_map remaining_tables, uint idx,
fanout from semijoin X.
3. We have no clue what to do about fanount of semi-join Y.
*/
- if ((join->cur_dups_producing_tables & handled_fanout) ||
+ if ((dups_producing_tables & handled_fanout) ||
(read_time < *current_read_time &&
!(handled_fanout & pos->inner_tables_handled_with_other_sjs)))
{
@@ -2581,7 +2601,7 @@ void advance_sj_state(JOIN *join, table_map remaining_tables, uint idx,
join->sjm_lookup_tables &= ~handled_fanout;
*current_read_time= read_time;
*current_record_count= rec_count;
- join->cur_dups_producing_tables &= ~handled_fanout;
+ dups_producing_tables &= ~handled_fanout;
//TODO: update bitmap of semi-joins that were handled together with
// others.
if (is_multiple_semi_joins(join, join->positions, idx, handled_fanout))
@@ -2608,6 +2628,7 @@ void advance_sj_state(JOIN *join, table_map remaining_tables, uint idx,
pos->prefix_cost.convert_from_cost(*current_read_time);
pos->prefix_record_count= *current_record_count;
+ pos->dups_producing_tables= dups_producing_tables;
}
@@ -3119,8 +3140,6 @@ void restore_prev_sj_state(const table_map remaining_tables,
tab->join->cur_sj_inner_tables &= ~emb_sj_nest->sj_inner_tables;
}
}
- POSITION *pos= tab->join->positions + idx;
- tab->join->cur_dups_producing_tables= pos->prefix_dups_producing_tables;
}
@@ -3894,7 +3913,6 @@ SJ_TMP_TABLE::create_sj_weedout_tmp_table(THD *thd)
/*
STEP 1: Get temporary table name
*/
- thd->inc_status_created_tmp_tables();
if (use_temp_pool && !(test_flags & TEST_KEEP_TMP_TABLES))
temp_pool_slot = bitmap_lock_set_next(&temp_pool);
diff --git a/sql/opt_subselect.h b/sql/opt_subselect.h
index acfbebed6b3..3da94d05521 100644
--- a/sql/opt_subselect.h
+++ b/sql/opt_subselect.h
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2010, 2012, Monty Program Ab
+ Copyright (c) 2010, 2015, MariaDB
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
@@ -299,7 +299,7 @@ public:
};
-extern void advance_sj_state(JOIN *join, table_map remaining_tables, uint idx,
+void advance_sj_state(JOIN *join, table_map remaining_tables, uint idx,
double *current_record_count, double *current_read_time,
POSITION *loose_scan_pos);
void restore_prev_sj_state(const table_map remaining_tables,
diff --git a/sql/parse_file.cc b/sql/parse_file.cc
index ee031c1bbc2..197f7c97fda 100644
--- a/sql/parse_file.cc
+++ b/sql/parse_file.cc
@@ -282,7 +282,7 @@ sql_create_definition_file(const LEX_STRING *dir, const LEX_STRING *file_name,
path[path_end+1]= '\0';
if ((handler= mysql_file_create(key_file_fileparser,
path, CREATE_MODE, O_RDWR | O_TRUNC,
- MYF(MY_WME))) <= 0)
+ MYF(MY_WME))) < 0)
{
DBUG_RETURN(TRUE);
}
diff --git a/sql/rpl_gtid.cc b/sql/rpl_gtid.cc
index e5620ec41a2..6e67a75b989 100644
--- a/sql/rpl_gtid.cc
+++ b/sql/rpl_gtid.cc
@@ -515,6 +515,7 @@ rpl_slave_state::record_gtid(THD *thd, const rpl_gtid *gtid, uint64 sub_id,
element *elem;
ulonglong thd_saved_option= thd->variables.option_bits;
Query_tables_list lex_backup;
+ wait_for_commit* suspended_wfc;
DBUG_ENTER("record_gtid");
if (unlikely(!loaded))
@@ -538,6 +539,28 @@ rpl_slave_state::record_gtid(THD *thd, const rpl_gtid *gtid, uint64 sub_id,
DBUG_RETURN(1);
} );
+ /*
+ If we are applying a non-transactional event group, we will be committing
+ here a transaction, but that does not imply that the event group has
+ completed or has been binlogged. So we should not trigger
+ wakeup_subsequent_commits() here.
+
+ Note: An alternative here could be to put a call to mark_start_commit() in
+ stmt_done() before the call to record_and_update_gtid(). This would
+ prevent later calling mark_start_commit() after we have run
+ wakeup_subsequent_commits() from committing the GTID update transaction
+ (which must be avoided to avoid accessing freed group_commit_orderer
+ object). It would also allow following event groups to start slightly
+ earlier. And in the cases where record_gtid() is called without an active
+ transaction, the current statement should have been binlogged already, so
+ binlog order is preserved.
+
+ But this is rather subtle, and potentially fragile. And it does not really
+ seem worth it; non-transactional loads are unlikely to benefit much from
+ parallel replication in any case. So for now, we go with the simple
+ suspend/resume of wakeup_subsequent_commits() here in record_gtid().
+ */
+ suspended_wfc= thd->suspend_subsequent_commits();
thd->lex->reset_n_backup_query_tables_list(&lex_backup);
tlist.init_one_table(STRING_WITH_LEN("mysql"),
rpl_gtid_slave_state_table_name.str,
@@ -689,6 +712,12 @@ end:
}
thd->lex->restore_backup_query_tables_list(&lex_backup);
thd->variables.option_bits= thd_saved_option;
+ thd->resume_subsequent_commits(suspended_wfc);
+ DBUG_EXECUTE_IF("inject_record_gtid_serverid_100_sleep",
+ {
+ if (gtid->server_id == 100)
+ my_sleep(500000);
+ });
DBUG_RETURN(err);
}
@@ -1089,6 +1118,27 @@ rpl_binlog_state::load(struct rpl_gtid *list, uint32 count)
}
+static int rpl_binlog_state_load_cb(rpl_gtid *gtid, void *data)
+{
+ rpl_binlog_state *self= (rpl_binlog_state *)data;
+ return self->update_nolock(gtid, false);
+}
+
+
+bool
+rpl_binlog_state::load(rpl_slave_state *slave_pos)
+{
+ bool res= false;
+
+ mysql_mutex_lock(&LOCK_binlog_state);
+ reset_nolock();
+ if (slave_pos->iterate(rpl_binlog_state_load_cb, this, NULL, 0))
+ res= true;
+ mysql_mutex_unlock(&LOCK_binlog_state);
+ return res;
+}
+
+
rpl_binlog_state::~rpl_binlog_state()
{
free();
@@ -1849,6 +1899,31 @@ slave_connection_state::get_gtid_list(rpl_gtid *gtid_list, uint32 list_size)
/*
+ Check if the GTID position has been reached, for mysql_binlog_send().
+
+ The position has not been reached if we have anything in the state, unless
+ it has either the START_ON_EMPTY_DOMAIN flag set (which means it does not
+ belong to this master at all), or the START_OWN_SLAVE_POS (which means that
+ we start on an old position from when the server was a slave with
+ --log-slave-updates=0).
+*/
+bool
+slave_connection_state::is_pos_reached()
+{
+ uint32 i;
+
+ for (i= 0; i < hash.records; ++i)
+ {
+ entry *e= (entry *)my_hash_element(&hash, i);
+ if (!(e->flags & (START_OWN_SLAVE_POS|START_ON_EMPTY_DOMAIN)))
+ return false;
+ }
+
+ return true;
+}
+
+
+/*
Execute a MASTER_GTID_WAIT().
The position to wait for is in gtid_str in string form.
The timeout in microseconds is in timeout_us, zero means no timeout.
diff --git a/sql/rpl_gtid.h b/sql/rpl_gtid.h
index 3e9e2fce25f..997540728a5 100644
--- a/sql/rpl_gtid.h
+++ b/sql/rpl_gtid.h
@@ -235,6 +235,7 @@ struct rpl_binlog_state
void reset();
void free();
bool load(struct rpl_gtid *list, uint32 count);
+ bool load(rpl_slave_state *slave_pos);
int update_nolock(const struct rpl_gtid *gtid, bool strict);
int update(const struct rpl_gtid *gtid, bool strict);
int update_with_next_gtid(uint32 domain_id, uint32 server_id,
@@ -287,6 +288,7 @@ struct slave_connection_state
int to_string(String *out_str);
int append_to_string(String *out_str);
int get_gtid_list(rpl_gtid *gtid_list, uint32 list_size);
+ bool is_pos_reached();
};
diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc
index 78218e0418e..47490648a43 100644
--- a/sql/rpl_mi.cc
+++ b/sql/rpl_mi.cc
@@ -36,9 +36,9 @@ Master_info::Master_info(LEX_STRING *connection_name_arg,
rli(is_slave_recovery), port(MYSQL_PORT),
checksum_alg_before_fd(BINLOG_CHECKSUM_ALG_UNDEF),
connect_retry(DEFAULT_CONNECT_RETRY), inited(0), abort_slave(0),
- slave_running(0), slave_run_id(0), sync_counter(0),
- heartbeat_period(0), received_heartbeats(0), master_id(0),
- prev_master_id(0),
+ slave_running(0), slave_run_id(0), clock_diff_with_master(0),
+ sync_counter(0), heartbeat_period(0), received_heartbeats(0),
+ master_id(0), prev_master_id(0),
using_gtid(USE_GTID_NO), events_queued_since_last_gtid(0),
gtid_reconnect_event_skip_count(0), gtid_event_seen(false)
{
@@ -864,6 +864,7 @@ Master_info_index::Master_info_index()
memcpy(index_file_name + dir_length, "multi-", 6);
bzero((char*) &index_file, sizeof(index_file));
+ index_file.file= -1;
}
Master_info_index::~Master_info_index()
@@ -871,7 +872,7 @@ Master_info_index::~Master_info_index()
/* This will close connection for all objects in the cache */
my_hash_free(&master_info_hash);
end_io_cache(&index_file);
- if (index_file.file > 0)
+ if (index_file.file >= 0)
my_close(index_file.file, MYF(MY_WME));
}
@@ -965,7 +966,7 @@ bool Master_info_index::init_all_master_info()
{
/* Master_info is not in HASH; Add it */
if (master_info_index->add_master_info(mi, FALSE))
- return 1;
+ DBUG_RETURN(1);
succ_num++;
unlock_slave_threads(mi);
}
@@ -998,7 +999,7 @@ bool Master_info_index::init_all_master_info()
/* Master_info was not registered; add it */
if (master_info_index->add_master_info(mi, FALSE))
- return 1;
+ DBUG_RETURN(1);
succ_num++;
unlock_slave_threads(mi);
@@ -1095,7 +1096,7 @@ Master_info_index::get_master_info(LEX_STRING *connection_name,
mysql_mutex_assert_owner(&LOCK_active_mi);
if (!this) // master_info_index is set to NULL on server shutdown
- return NULL;
+ DBUG_RETURN(NULL);
/* Make name lower case for comparison */
res= strmake(buff, connection_name->str, connection_name->length);
@@ -1247,10 +1248,10 @@ bool Master_info_index::remove_master_info(LEX_STRING *name)
bool Master_info_index::give_error_if_slave_running()
{
- DBUG_ENTER("warn_if_slave_running");
+ DBUG_ENTER("give_error_if_slave_running");
mysql_mutex_assert_owner(&LOCK_active_mi);
if (!this) // master_info_index is set to NULL on server shutdown
- return TRUE;
+ DBUG_RETURN(TRUE);
for (uint i= 0; i< master_info_hash.records; ++i)
{
@@ -1268,6 +1269,32 @@ bool Master_info_index::give_error_if_slave_running()
/**
+ Master_info_index::any_slave_sql_running()
+
+ The LOCK_active_mi must be held while calling this function.
+
+ @return
+ TRUE If some slave SQL thread is running.
+ FALSE No slave SQL thread is running
+*/
+
+bool Master_info_index::any_slave_sql_running()
+{
+ DBUG_ENTER("any_slave_sql_running");
+ if (!this) // master_info_index is set to NULL on server shutdown
+ DBUG_RETURN(TRUE);
+
+ for (uint i= 0; i< master_info_hash.records; ++i)
+ {
+ Master_info *mi= (Master_info *)my_hash_element(&master_info_hash, i);
+ if (mi->rli.slave_running != MYSQL_SLAVE_NOT_RUN)
+ DBUG_RETURN(TRUE);
+ }
+ DBUG_RETURN(FALSE);
+}
+
+
+/**
Master_info_index::start_all_slaves()
Start all slaves that was not running.
diff --git a/sql/rpl_mi.h b/sql/rpl_mi.h
index ebb1b541728..2b0b40feb3d 100644
--- a/sql/rpl_mi.h
+++ b/sql/rpl_mi.h
@@ -218,6 +218,7 @@ public:
Master_info *get_master_info(LEX_STRING *connection_name,
Sql_condition::enum_warning_level warning);
bool give_error_if_slave_running();
+ bool any_slave_sql_running();
bool start_all_slaves(THD *thd);
bool stop_all_slaves(THD *thd);
};
diff --git a/sql/rpl_parallel.cc b/sql/rpl_parallel.cc
index 46c3e4aaaf4..305e8053032 100644
--- a/sql/rpl_parallel.cc
+++ b/sql/rpl_parallel.cc
@@ -2,6 +2,7 @@
#include "rpl_parallel.h"
#include "slave.h"
#include "rpl_mi.h"
+#include "sql_parse.h"
#include "debug_sync.h"
/*
@@ -113,6 +114,7 @@ finish_event_group(rpl_parallel_thread *rpt, uint64 sub_id,
wait_for_commit *wfc= &rgi->commit_orderer;
int err;
+ thd->get_stmt_da()->set_overwrite_status(true);
/*
Remove any left-over registration to wait for a prior commit to
complete. Normally, such wait would already have been removed at
@@ -129,14 +131,14 @@ finish_event_group(rpl_parallel_thread *rpt, uint64 sub_id,
for us to complete and rely on this also ensuring that any other
event in the group has completed.
- But in the error case, we have to abort anyway, and it seems best
- to just complete as quickly as possible with unregister. Anyone
- waiting for us will in any case receive the error back from their
- wait_for_prior_commit() call.
+ And in the error case, correct GCO lifetime relies on the fact that once
+ the last event group in the GCO has executed wait_for_prior_commit(),
+ all earlier event groups have also committed; this way no more
+ mark_start_commit() calls can be made and it is safe to de-allocate
+ the GCO.
*/
- if (rgi->worker_error)
- wfc->unregister_wait_for_prior_commit();
- else if ((err= wfc->wait_for_prior_commit(thd)))
+ err= wfc->wait_for_prior_commit(thd);
+ if (unlikely(err) && !rgi->worker_error)
signal_error_to_sql_driver_thread(thd, rgi, err);
thd->wait_for_commit_ptr= NULL;
@@ -166,12 +168,30 @@ finish_event_group(rpl_parallel_thread *rpt, uint64 sub_id,
done and also no longer need waiting for.
*/
entry->last_committed_sub_id= sub_id;
+ if (entry->need_sub_id_signal)
+ mysql_cond_broadcast(&entry->COND_parallel_entry);
/* Now free any GCOs in which all transactions have committed. */
group_commit_orderer *tmp_gco= rgi->gco;
while (tmp_gco &&
- (!tmp_gco->next_gco || tmp_gco->last_sub_id > sub_id))
+ (!tmp_gco->next_gco || tmp_gco->last_sub_id > sub_id ||
+ tmp_gco->next_gco->wait_count > entry->count_committing_event_groups))
+ {
+ /*
+ We must not free a GCO before the wait_count of the following GCO has
+ been reached and wakeup has been sent. Otherwise we will lose the
+ wakeup and hang (there were several such bugs in the past).
+
+ The intention is that this is ensured already since we only free when
+ the last event group in the GCO has committed
+ (tmp_gco->last_sub_id <= sub_id). However, if we have a bug, we have
+ extra check on next_gco->wait_count to hopefully avoid hanging; we
+ have here an assertion in debug builds that this check does not in
+ fact trigger.
+ */
+ DBUG_ASSERT(!tmp_gco->next_gco || tmp_gco->last_sub_id > sub_id);
tmp_gco= tmp_gco->prev_gco;
+ }
while (tmp_gco)
{
group_commit_orderer *prev_gco= tmp_gco->prev_gco;
@@ -193,6 +213,10 @@ finish_event_group(rpl_parallel_thread *rpt, uint64 sub_id,
thd->clear_error();
thd->reset_killed();
+ /*
+ Would do thd->get_stmt_da()->set_overwrite_status(false) here, but
+ reset_diagnostics_area() already does that.
+ */
thd->get_stmt_da()->reset_diagnostics_area();
wfc->wakeup_subsequent_commits(rgi->worker_error);
}
@@ -305,7 +329,7 @@ retry_event_group(rpl_group_info *rgi, rpl_parallel_thread *rpt,
IO_CACHE rlog;
LOG_INFO linfo;
File fd= (File)-1;
- const char *errmsg= NULL;
+ const char *errmsg;
inuse_relaylog *ir= rgi->relay_log;
uint64 event_count;
uint64 events_to_execute= rgi->retry_event_count;
@@ -321,6 +345,7 @@ retry_event_group(rpl_group_info *rgi, rpl_parallel_thread *rpt,
do_retry:
event_count= 0;
err= 0;
+ errmsg= NULL;
/*
If we already started committing before getting the deadlock (or other
@@ -356,7 +381,16 @@ do_retry:
*/
if(thd->wait_for_commit_ptr)
thd->wait_for_commit_ptr->unregister_wait_for_prior_commit();
+ DBUG_EXECUTE_IF("inject_mdev8031", {
+ /* Simulate that we get deadlock killed at this exact point. */
+ rgi->killed_for_retry= true;
+ mysql_mutex_lock(&thd->LOCK_thd_data);
+ thd->killed= KILL_CONNECTION;
+ mysql_mutex_unlock(&thd->LOCK_thd_data);
+ });
rgi->cleanup_context(thd, 1);
+ thd->reset_killed();
+ thd->clear_error();
/*
If we retry due to a deadlock kill that occured during the commit step, we
@@ -372,9 +406,46 @@ do_retry:
statistic_increment(slave_retried_transactions, LOCK_status);
mysql_mutex_unlock(&rli->data_lock);
- mysql_mutex_lock(&entry->LOCK_parallel_entry);
- register_wait_for_prior_event_group_commit(rgi, entry);
- mysql_mutex_unlock(&entry->LOCK_parallel_entry);
+ for (;;)
+ {
+ mysql_mutex_lock(&entry->LOCK_parallel_entry);
+ register_wait_for_prior_event_group_commit(rgi, entry);
+ mysql_mutex_unlock(&entry->LOCK_parallel_entry);
+
+ /*
+ Let us wait for all prior transactions to complete before trying again.
+ This way, we avoid repeatedly conflicting with and getting deadlock
+ killed by the same earlier transaction.
+ */
+ if (!(err= thd->wait_for_prior_commit()))
+ break;
+
+ convert_kill_to_deadlock_error(rgi);
+ if (!has_temporary_error(thd))
+ goto err;
+ /*
+ If we get a temporary error such as a deadlock kill, we can safely
+ ignore it, as we already rolled back.
+
+ But we still want to retry the wait for the prior transaction to
+ complete its commit.
+ */
+ thd->clear_error();
+ thd->reset_killed();
+ if(thd->wait_for_commit_ptr)
+ thd->wait_for_commit_ptr->unregister_wait_for_prior_commit();
+ DBUG_EXECUTE_IF("inject_mdev8031", {
+ /* Inject a small sleep to give prior transaction a chance to commit. */
+ my_sleep(100000);
+ });
+ }
+
+ /*
+ Let us clear any lingering deadlock kill one more time, here after
+ wait_for_prior_commit() has completed. This should rule out any
+ possibility of an old deadlock kill lingering on beyond this point.
+ */
+ thd->reset_killed();
strmake_buf(log_name, ir->name);
if ((fd= open_binlog(&rlog, log_name, &errmsg)) <0)
@@ -391,6 +462,14 @@ do_retry:
err= 1;
goto err;
}
+ DBUG_EXECUTE_IF("inject_mdev8031", {
+ /* Simulate pending KILL caught in read_relay_log_description_event(). */
+ if (thd->check_killed()) {
+ thd->send_kill_message();
+ err= 1;
+ goto err;
+ }
+ });
my_b_seek(&rlog, cur_offset);
do
@@ -413,7 +492,7 @@ do_retry:
{
errmsg= "slave SQL thread aborted because of I/O error";
err= 1;
- goto err;
+ goto check_retry;
}
if (rlog.error > 0)
{
@@ -442,10 +521,25 @@ do_retry:
}
strmake_buf(log_name ,linfo.log_file_name);
+ DBUG_EXECUTE_IF("inject_retry_event_group_open_binlog_kill", {
+ if (retries < 2)
+ {
+ /* Simulate that we get deadlock killed during open_binlog(). */
+ mysql_reset_thd_for_next_command(thd);
+ rgi->killed_for_retry= true;
+ mysql_mutex_lock(&thd->LOCK_thd_data);
+ thd->killed= KILL_CONNECTION;
+ mysql_mutex_unlock(&thd->LOCK_thd_data);
+ thd->send_kill_message();
+ fd= (File)-1;
+ err= 1;
+ goto check_retry;
+ }
+ });
if ((fd= open_binlog(&rlog, log_name, &errmsg)) <0)
{
err= 1;
- goto err;
+ goto check_retry;
}
/* Loop to try again on the new log file. */
}
@@ -488,26 +582,31 @@ do_retry:
if (retries == 0) err= dbug_simulate_tmp_error(rgi, thd););
DBUG_EXECUTE_IF("rpl_parallel_simulate_infinite_temp_err_gtid_0_x_100",
err= dbug_simulate_tmp_error(rgi, thd););
- if (err)
+ if (!err)
+ continue;
+
+check_retry:
+ convert_kill_to_deadlock_error(rgi);
+ if (has_temporary_error(thd))
{
- convert_kill_to_deadlock_error(rgi);
- if (has_temporary_error(thd))
+ ++retries;
+ if (retries < slave_trans_retries)
{
- ++retries;
- if (retries < slave_trans_retries)
+ if (fd >= 0)
{
end_io_cache(&rlog);
mysql_file_close(fd, MYF(MY_WME));
fd= (File)-1;
- goto do_retry;
}
- sql_print_error("Slave worker thread retried transaction %lu time(s) "
- "in vain, giving up. Consider raising the value of "
- "the slave_transaction_retries variable.",
- slave_trans_retries);
+ goto do_retry;
}
- goto err;
+ sql_print_error("Slave worker thread retried transaction %lu time(s) "
+ "in vain, giving up. Consider raising the value of "
+ "the slave_transaction_retries variable.",
+ slave_trans_retries);
}
+ goto err;
+
} while (event_count < events_to_execute);
err:
@@ -640,7 +739,7 @@ handle_rpl_parallel_thread(void *arg)
}
DBUG_ASSERT(qev->typ==rpl_parallel_thread::queued_event::QUEUED_EVENT);
- thd->rgi_slave= group_rgi= rgi;
+ thd->rgi_slave= rgi;
gco= rgi->gco;
/* Handle a new event group, which will be initiated by a GTID event. */
if ((event_type= qev->ev->get_type_code()) == GTID_EVENT)
@@ -657,6 +756,21 @@ handle_rpl_parallel_thread(void *arg)
}
});
+ if(unlikely(thd->wait_for_commit_ptr) && group_rgi != NULL)
+ {
+ /*
+ This indicates that we get a new GTID event in the middle of
+ a not completed event group. This is corrupt binlog (the master
+ will never write such binlog), so it does not happen unless
+ someone tries to inject wrong crafted binlog, but let us still
+ try to handle it somewhat nicely.
+ */
+ group_rgi->cleanup_context(thd, true);
+ finish_event_group(rpt, group_rgi->gtid_sub_id,
+ group_rgi->parallel_entry, group_rgi);
+ rpt->loc_free_rgi(group_rgi);
+ }
+
in_event_group= true;
/*
If the standalone flag is set, then this event group consists of a
@@ -736,25 +850,11 @@ handle_rpl_parallel_thread(void *arg)
if (unlikely(entry->stop_on_error_sub_id <= rgi->wait_commit_sub_id))
skip_event_group= true;
- else
- register_wait_for_prior_event_group_commit(rgi, entry);
+ register_wait_for_prior_event_group_commit(rgi, entry);
unlock_or_exit_cond(thd, &entry->LOCK_parallel_entry,
&did_enter_cond, &old_stage);
- if(thd->wait_for_commit_ptr)
- {
- /*
- This indicates that we get a new GTID event in the middle of
- a not completed event group. This is corrupt binlog (the master
- will never write such binlog), so it does not happen unless
- someone tries to inject wrong crafted binlog, but let us still
- try to handle it somewhat nicely.
- */
- rgi->cleanup_context(thd, true);
- thd->wait_for_commit_ptr->unregister_wait_for_prior_commit();
- thd->wait_for_commit_ptr->wakeup_subsequent_commits(rgi->worker_error);
- }
thd->wait_for_commit_ptr= &rgi->commit_orderer;
if (opt_gtid_ignore_duplicates)
@@ -780,6 +880,7 @@ handle_rpl_parallel_thread(void *arg)
}
}
+ group_rgi= rgi;
group_ending= is_group_ending(qev->ev, event_type);
if (group_ending && likely(!rgi->worker_error))
{
@@ -824,7 +925,9 @@ handle_rpl_parallel_thread(void *arg)
else
{
delete qev->ev;
+ thd->get_stmt_da()->set_overwrite_status(true);
err= thd->wait_for_prior_commit();
+ thd->get_stmt_da()->set_overwrite_status(false);
}
end_of_group=
@@ -941,9 +1044,9 @@ dealloc_gco(group_commit_orderer *gco)
}
-int
+static int
rpl_parallel_change_thread_count(rpl_parallel_thread_pool *pool,
- uint32 new_count, bool skip_check)
+ uint32 new_count)
{
uint32 i;
rpl_parallel_thread **new_list= NULL;
@@ -988,24 +1091,6 @@ rpl_parallel_change_thread_count(rpl_parallel_thread_pool *pool,
new_free_list= new_list[i];
}
- if (!skip_check)
- {
- mysql_mutex_lock(&LOCK_active_mi);
- if (master_info_index->give_error_if_slave_running())
- {
- mysql_mutex_unlock(&LOCK_active_mi);
- goto err;
- }
- if (pool->changing)
- {
- mysql_mutex_unlock(&LOCK_active_mi);
- my_error(ER_CHANGE_SLAVE_PARALLEL_THREADS_ACTIVE, MYF(0));
- goto err;
- }
- pool->changing= true;
- mysql_mutex_unlock(&LOCK_active_mi);
- }
-
/*
Grab each old thread in turn, and signal it to stop.
@@ -1065,13 +1150,6 @@ rpl_parallel_change_thread_count(rpl_parallel_thread_pool *pool,
mysql_mutex_unlock(&pool->threads[i]->LOCK_rpl_thread);
}
- if (!skip_check)
- {
- mysql_mutex_lock(&LOCK_active_mi);
- pool->changing= false;
- mysql_mutex_unlock(&LOCK_active_mi);
- }
-
mysql_mutex_lock(&pool->LOCK_rpl_thread_pool);
mysql_cond_broadcast(&pool->COND_rpl_thread_pool);
mysql_mutex_unlock(&pool->LOCK_rpl_thread_pool);
@@ -1098,16 +1176,26 @@ err:
}
my_free(new_list);
}
- if (!skip_check)
- {
- mysql_mutex_lock(&LOCK_active_mi);
- pool->changing= false;
- mysql_mutex_unlock(&LOCK_active_mi);
- }
return 1;
}
+int
+rpl_parallel_activate_pool(rpl_parallel_thread_pool *pool)
+{
+ if (!pool->count)
+ return rpl_parallel_change_thread_count(pool, opt_slave_parallel_threads);
+ return 0;
+}
+
+
+int
+rpl_parallel_inactivate_pool(rpl_parallel_thread_pool *pool)
+{
+ return rpl_parallel_change_thread_count(pool, 0);
+}
+
+
void
rpl_parallel_thread::batch_free()
{
@@ -1351,7 +1439,7 @@ rpl_parallel_thread::loc_free_gco(group_commit_orderer *gco)
rpl_parallel_thread_pool::rpl_parallel_thread_pool()
- : count(0), threads(0), free_list(0), changing(false), inited(false)
+ : count(0), threads(0), free_list(0), inited(false)
{
}
@@ -1366,10 +1454,14 @@ rpl_parallel_thread_pool::init(uint32 size)
mysql_mutex_init(key_LOCK_rpl_thread_pool, &LOCK_rpl_thread_pool,
MY_MUTEX_INIT_SLOW);
mysql_cond_init(key_COND_rpl_thread_pool, &COND_rpl_thread_pool, NULL);
- changing= false;
inited= true;
- return rpl_parallel_change_thread_count(this, size, true);
+ /*
+ The pool is initially empty. Threads will be spawned when a slave SQL
+ thread is started.
+ */
+
+ return 0;
}
@@ -1378,7 +1470,7 @@ rpl_parallel_thread_pool::destroy()
{
if (!inited)
return;
- rpl_parallel_change_thread_count(this, 0, true);
+ rpl_parallel_change_thread_count(this, 0);
mysql_mutex_destroy(&LOCK_rpl_thread_pool);
mysql_cond_destroy(&COND_rpl_thread_pool);
inited= false;
@@ -1804,28 +1896,66 @@ rpl_parallel::wait_for_workers_idle(THD *thd)
max_i= domain_hash.records;
for (i= 0; i < max_i; ++i)
{
- bool active;
- wait_for_commit my_orderer;
+ PSI_stage_info old_stage;
struct rpl_parallel_entry *e;
+ int err= 0;
e= (struct rpl_parallel_entry *)my_hash_element(&domain_hash, i);
mysql_mutex_lock(&e->LOCK_parallel_entry);
- if ((active= (e->current_sub_id > e->last_committed_sub_id)))
+ e->need_sub_id_signal= true;
+ thd->ENTER_COND(&e->COND_parallel_entry, &e->LOCK_parallel_entry,
+ &stage_waiting_for_workers_idle, &old_stage);
+ while (e->current_sub_id > e->last_committed_sub_id)
{
- wait_for_commit *waitee= &e->current_group_info->commit_orderer;
- my_orderer.register_wait_for_prior_commit(waitee);
- thd->wait_for_commit_ptr= &my_orderer;
+ if (thd->check_killed())
+ {
+ thd->send_kill_message();
+ err= 1;
+ break;
+ }
+ mysql_cond_wait(&e->COND_parallel_entry, &e->LOCK_parallel_entry);
}
- mysql_mutex_unlock(&e->LOCK_parallel_entry);
- if (active)
+ e->need_sub_id_signal= false;
+ thd->EXIT_COND(&old_stage);
+ if (err)
+ return err;
+ }
+ return 0;
+}
+
+
+/*
+ Handle seeing a GTID during slave restart in GTID mode. If we stopped with
+ different replication domains having reached different positions in the relay
+ log, we need to skip event groups in domains that are further progressed.
+
+ Updates the state with the seen GTID, and returns true if this GTID should
+ be skipped, false otherwise.
+*/
+bool
+process_gtid_for_restart_pos(Relay_log_info *rli, rpl_gtid *gtid)
+{
+ slave_connection_state::entry *gtid_entry;
+ slave_connection_state *state= &rli->restart_gtid_pos;
+
+ if (likely(state->count() == 0) ||
+ !(gtid_entry= state->find_entry(gtid->domain_id)))
+ return false;
+ if (gtid->server_id == gtid_entry->gtid.server_id)
+ {
+ uint64 seq_no= gtid_entry->gtid.seq_no;
+ if (gtid->seq_no >= seq_no)
{
- int err= my_orderer.wait_for_prior_commit(thd);
- thd->wait_for_commit_ptr= NULL;
- if (err)
- return err;
+ /*
+ This domain has reached its start position. So remove it, so that
+ further events will be processed normally.
+ */
+ state->remove(&gtid_entry->gtid);
}
+ return gtid->seq_no <= seq_no;
}
- return 0;
+ else
+ return true;
}
@@ -1890,13 +2020,15 @@ rpl_parallel::do_event(rpl_group_info *serial_rgi, Log_event *ev,
return -1;
/* Execute pre-10.0 event, which have no GTID, in single-threaded mode. */
- if (unlikely(!current) && typ != GTID_EVENT)
+ is_group_event= Log_event::is_group_event(typ);
+ if (unlikely(!current) && typ != GTID_EVENT &&
+ !(unlikely(rli->gtid_skip_flag != GTID_SKIP_NOT) && is_group_event))
return -1;
/* ToDo: what to do with this lock?!? */
mysql_mutex_unlock(&rli->data_lock);
- if (typ == FORMAT_DESCRIPTION_EVENT)
+ if (unlikely(typ == FORMAT_DESCRIPTION_EVENT))
{
Format_description_log_event *fdev=
static_cast<Format_description_log_event *>(ev);
@@ -1922,6 +2054,19 @@ rpl_parallel::do_event(rpl_group_info *serial_rgi, Log_event *ev,
}
}
}
+ else if (unlikely(typ == GTID_LIST_EVENT))
+ {
+ Gtid_list_log_event *glev= static_cast<Gtid_list_log_event *>(ev);
+ rpl_gtid *list= glev->list;
+ uint32 count= glev->count;
+ rli->update_relay_log_state(list, count);
+ while (count)
+ {
+ process_gtid_for_restart_pos(rli, list);
+ ++list;
+ --count;
+ }
+ }
/*
Stop queueing additional event groups once the SQL thread is requested to
@@ -1931,7 +2076,6 @@ rpl_parallel::do_event(rpl_group_info *serial_rgi, Log_event *ev,
been partially queued, but after that we will just ignore any further
events the SQL driver thread may try to queue, and eventually it will stop.
*/
- is_group_event= Log_event::is_group_event(typ);
if ((typ == GTID_EVENT || !is_group_event) && rli->abort_slave)
sql_thread_stopping= true;
if (sql_thread_stopping)
@@ -1944,8 +2088,34 @@ rpl_parallel::do_event(rpl_group_info *serial_rgi, Log_event *ev,
return 0;
}
+ if (unlikely(rli->gtid_skip_flag != GTID_SKIP_NOT) && is_group_event)
+ {
+ if (typ == GTID_EVENT)
+ rli->gtid_skip_flag= GTID_SKIP_NOT;
+ else
+ {
+ if (rli->gtid_skip_flag == GTID_SKIP_STANDALONE)
+ {
+ if (!Log_event::is_part_of_group(typ))
+ rli->gtid_skip_flag= GTID_SKIP_NOT;
+ }
+ else
+ {
+ DBUG_ASSERT(rli->gtid_skip_flag == GTID_SKIP_TRANSACTION);
+ if (typ == XID_EVENT ||
+ (typ == QUERY_EVENT &&
+ (((Query_log_event *)ev)->is_commit() ||
+ ((Query_log_event *)ev)->is_rollback())))
+ rli->gtid_skip_flag= GTID_SKIP_NOT;
+ }
+ delete_or_keep_event_post_apply(serial_rgi, typ, ev);
+ return 0;
+ }
+ }
+
if (typ == GTID_EVENT)
{
+ rpl_gtid gtid;
Gtid_log_event *gtid_ev= static_cast<Gtid_log_event *>(ev);
uint32 domain_id= (rli->mi->using_gtid == Master_info::USE_GTID_NO ?
0 : gtid_ev->domain_id);
@@ -1956,6 +2126,23 @@ rpl_parallel::do_event(rpl_group_info *serial_rgi, Log_event *ev,
return 1;
}
current= e;
+
+ gtid.domain_id= gtid_ev->domain_id;
+ gtid.server_id= gtid_ev->server_id;
+ gtid.seq_no= gtid_ev->seq_no;
+ rli->update_relay_log_state(&gtid, 1);
+ if (process_gtid_for_restart_pos(rli, &gtid))
+ {
+ /*
+ This domain has progressed further into the relay log before the last
+ SQL thread restart. So we need to skip this event group to not doubly
+ apply it.
+ */
+ rli->gtid_skip_flag= ((gtid_ev->flags2 & Gtid_log_event::FL_STANDALONE) ?
+ GTID_SKIP_STANDALONE : GTID_SKIP_TRANSACTION);
+ delete_or_keep_event_post_apply(serial_rgi, typ, ev);
+ return 0;
+ }
}
else
e= current;
diff --git a/sql/rpl_parallel.h b/sql/rpl_parallel.h
index 2604cd98527..0c2e4270646 100644
--- a/sql/rpl_parallel.h
+++ b/sql/rpl_parallel.h
@@ -53,7 +53,7 @@ struct group_commit_orderer {
group_commit_orderer *prev_gco;
group_commit_orderer *next_gco;
/*
- The sub_id of last event group in this the previous GCO.
+ The sub_id of last event group in the previous GCO.
Only valid if prev_gco != NULL.
*/
uint64 prior_sub_id;
@@ -204,7 +204,6 @@ struct rpl_parallel_thread_pool {
struct rpl_parallel_thread *free_list;
mysql_mutex_t LOCK_rpl_thread_pool;
mysql_cond_t COND_rpl_thread_pool;
- bool changing;
bool inited;
rpl_parallel_thread_pool();
@@ -229,6 +228,12 @@ struct rpl_parallel_entry {
*/
bool force_abort;
/*
+ Set in wait_for_workers_idle() to show that it is waiting, so that
+ finish_event_group knows to signal it when last_committed_sub_id is
+ increased.
+ */
+ bool need_sub_id_signal;
+ /*
At STOP SLAVE (force_abort=true), we do not want to process all events in
the queue (which could unnecessarily delay stop, if a lot of events happen
to be queued). The stop_count provides a safe point at which to stop, so
@@ -314,8 +319,8 @@ struct rpl_parallel {
extern struct rpl_parallel_thread_pool global_rpl_thread_pool;
-extern int rpl_parallel_change_thread_count(rpl_parallel_thread_pool *pool,
- uint32 new_count,
- bool skip_check= false);
+extern int rpl_parallel_activate_pool(rpl_parallel_thread_pool *pool);
+extern int rpl_parallel_inactivate_pool(rpl_parallel_thread_pool *pool);
+extern bool process_gtid_for_restart_pos(Relay_log_info *rli, rpl_gtid *gtid);
#endif /* RPL_PARALLEL_H */
diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc
index a751dd16650..9bd0ca55b01 100644
--- a/sql/rpl_rli.cc
+++ b/sql/rpl_rli.cc
@@ -62,7 +62,7 @@ Relay_log_info::Relay_log_info(bool is_slave_recovery)
group_master_log_pos(0), log_space_total(0), ignore_log_space_limit(0),
last_master_timestamp(0), sql_thread_caught_up(true), slave_skip_counter(0),
abort_pos_wait(0), slave_run_id(0), sql_driver_thd(),
- inited(0), abort_slave(0), stop_for_until(0),
+ gtid_skip_flag(GTID_SKIP_NOT), inited(0), abort_slave(0), stop_for_until(0),
slave_running(0), until_condition(UNTIL_NONE),
until_log_pos(0), retried_trans(0), executed_entries(0),
m_flags(0)
@@ -100,18 +100,9 @@ Relay_log_info::Relay_log_info(bool is_slave_recovery)
Relay_log_info::~Relay_log_info()
{
- inuse_relaylog *cur;
DBUG_ENTER("Relay_log_info::~Relay_log_info");
- cur= inuse_relaylog_list;
- while (cur)
- {
- DBUG_ASSERT(cur->queued_count == cur->dequeued_count);
- inuse_relaylog *next= cur->next;
- my_atomic_rwlock_destroy(&cur->inuse_relaylog_atomic_lock);
- my_free(cur);
- cur= next;
- }
+ reset_inuse_relaylog();
mysql_mutex_destroy(&run_lock);
mysql_mutex_destroy(&data_lock);
mysql_mutex_destroy(&log_space_lock);
@@ -1299,13 +1290,9 @@ bool Relay_log_info::is_until_satisfied(THD *thd, Log_event *ev)
}
-void Relay_log_info::stmt_done(my_off_t event_master_log_pos,
- time_t event_creation_time, THD *thd,
+void Relay_log_info::stmt_done(my_off_t event_master_log_pos, THD *thd,
rpl_group_info *rgi)
{
-#ifndef DBUG_OFF
- extern uint debug_not_change_ts_if_art_event;
-#endif
DBUG_ENTER("Relay_log_info::stmt_done");
DBUG_ASSERT(rgi->rli == this);
@@ -1359,22 +1346,6 @@ void Relay_log_info::stmt_done(my_off_t event_master_log_pos,
if (mi->using_gtid == Master_info::USE_GTID_NO)
flush_relay_log_info(this);
DBUG_EXECUTE_IF("inject_crash_after_flush_rli", DBUG_SUICIDE(););
- /*
- Note that Rotate_log_event::do_apply_event() does not call this
- function, so there is no chance that a fake rotate event resets
- last_master_timestamp. Note that we update without mutex
- (probably ok - except in some very rare cases, only consequence
- is that value may take some time to display in
- Seconds_Behind_Master - not critical).
-
- In parallel replication, we take care to not set last_master_timestamp
- backwards, in case of out-of-order calls here.
- */
- if (!(event_creation_time == 0 &&
- IF_DBUG(debug_not_change_ts_if_art_event > 0, 1)) &&
- !(rgi->is_parallel_exec && event_creation_time <= last_master_timestamp)
- )
- last_master_timestamp= event_creation_time;
}
DBUG_VOID_RETURN;
}
@@ -1384,14 +1355,34 @@ int
Relay_log_info::alloc_inuse_relaylog(const char *name)
{
inuse_relaylog *ir;
+ uint32 gtid_count;
+ rpl_gtid *gtid_list;
if (!(ir= (inuse_relaylog *)my_malloc(sizeof(*ir), MYF(MY_WME|MY_ZEROFILL))))
{
my_error(ER_OUTOFMEMORY, MYF(0), (int)sizeof(*ir));
return 1;
}
+ gtid_count= relay_log_state.count();
+ if (!(gtid_list= (rpl_gtid *)my_malloc(sizeof(*gtid_list)*gtid_count,
+ MYF(MY_WME))))
+ {
+ my_free(ir);
+ my_error(ER_OUTOFMEMORY, MYF(0), (int)sizeof(*gtid_list)*gtid_count);
+ return 1;
+ }
+ if (relay_log_state.get_gtid_list(gtid_list, gtid_count))
+ {
+ my_free(gtid_list);
+ my_free(ir);
+ DBUG_ASSERT(0 /* Should not be possible as we allocated correct length */);
+ my_error(ER_OUT_OF_RESOURCES, MYF(0));
+ return 1;
+ }
ir->rli= this;
strmake_buf(ir->name, name);
+ ir->relay_log_state= gtid_list;
+ ir->relay_log_state_count= gtid_count;
if (!inuse_relaylog_list)
inuse_relaylog_list= ir;
@@ -1407,6 +1398,45 @@ Relay_log_info::alloc_inuse_relaylog(const char *name)
}
+void
+Relay_log_info::free_inuse_relaylog(inuse_relaylog *ir)
+{
+ my_free(ir->relay_log_state);
+ my_atomic_rwlock_destroy(&ir->inuse_relaylog_atomic_lock);
+ my_free(ir);
+}
+
+
+void
+Relay_log_info::reset_inuse_relaylog()
+{
+ inuse_relaylog *cur= inuse_relaylog_list;
+ while (cur)
+ {
+ DBUG_ASSERT(cur->queued_count == cur->dequeued_count);
+ inuse_relaylog *next= cur->next;
+ free_inuse_relaylog(cur);
+ cur= next;
+ }
+ inuse_relaylog_list= last_inuse_relaylog= NULL;
+}
+
+
+int
+Relay_log_info::update_relay_log_state(rpl_gtid *gtid_list, uint32 count)
+{
+ int res= 0;
+ while (count)
+ {
+ if (relay_log_state.update_nolock(gtid_list, false))
+ res= 1;
+ ++gtid_list;
+ --count;
+ }
+ return res;
+}
+
+
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
int
rpl_load_gtid_slave_state(THD *thd)
@@ -1719,7 +1749,7 @@ void rpl_group_info::cleanup_context(THD *thd, bool error)
trans_rollback(thd); // if a "real transaction"
/*
Now that we have rolled back the transaction, make sure we do not
- errorneously update the GTID position.
+ erroneously update the GTID position.
*/
gtid_pending= false;
}
diff --git a/sql/rpl_rli.h b/sql/rpl_rli.h
index fb4e3261468..2d92f384ef3 100644
--- a/sql/rpl_rli.h
+++ b/sql/rpl_rli.h
@@ -269,6 +269,8 @@ public:
int events_till_abort;
#endif
+ enum_gtid_skip_type gtid_skip_flag;
+
/*
inited changes its value within LOCK_active_mi-guarded critical
sections at times of start_slave_threads() (0->1) and end_slave() (1->0).
@@ -344,6 +346,21 @@ public:
size_t slave_patternload_file_size;
rpl_parallel parallel;
+ /*
+ The relay_log_state keeps track of the current binlog state of the execution
+ of the relay log. This is used to know where to resume current GTID position
+ if the slave thread is stopped and restarted.
+ It is only accessed from the SQL thread, so it does not need any locking.
+ */
+ rpl_binlog_state relay_log_state;
+ /*
+ The restart_gtid_state is used when the SQL thread restarts on a relay log
+ in GTID mode. In multi-domain parallel replication, each domain may have a
+ separat position, so some events in more progressed domains may need to be
+ skipped. This keeps track of the domains that have not yet reached their
+ starting event.
+ */
+ slave_connection_state restart_gtid_pos;
Relay_log_info(bool is_slave_recovery);
~Relay_log_info();
@@ -398,16 +415,12 @@ public:
Master log position of the event. The position is recorded in the
relay log info and used to produce information for <code>SHOW
SLAVE STATUS</code>.
-
- @param event_creation_time
- Timestamp for the creation of the event on the master side. The
- time stamp is recorded in the relay log info and used to compute
- the <code>Seconds_behind_master</code> field.
*/
- void stmt_done(my_off_t event_log_pos,
- time_t event_creation_time, THD *thd,
- rpl_group_info *rgi);
+ void stmt_done(my_off_t event_log_pos, THD *thd, rpl_group_info *rgi);
int alloc_inuse_relaylog(const char *name);
+ void free_inuse_relaylog(inuse_relaylog *ir);
+ void reset_inuse_relaylog();
+ int update_relay_log_state(rpl_gtid *gtid_list, uint32 count);
/**
Is the replication inside a group?
@@ -497,6 +510,12 @@ private:
struct inuse_relaylog {
inuse_relaylog *next;
Relay_log_info *rli;
+ /*
+ relay_log_state holds the binlog state corresponding to the start of this
+ relay log file. It is an array with relay_log_state_count elements.
+ */
+ rpl_gtid *relay_log_state;
+ uint32 relay_log_state_count;
/* 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_utility.cc b/sql/rpl_utility.cc
index 9067f1e4253..146bf3b0c0e 100644
--- a/sql/rpl_utility.cc
+++ b/sql/rpl_utility.cc
@@ -452,7 +452,7 @@ void show_sql_type(enum_field_types type, uint16 metadata, String *str, CHARSET_
CHARSET_INFO *cs= str->charset();
uint32 length=
cs->cset->snprintf(cs, (char*) str->ptr(), str->alloced_length(),
- "decimal(%d,?)", metadata);
+ "decimal(%d,?)/*old*/", metadata);
str->length(length);
}
break;
diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt
index 4980ba06604..6954170e86c 100644
--- a/sql/share/errmsg-utf8.txt
+++ b/sql/share/errmsg-utf8.txt
@@ -7080,7 +7080,7 @@ ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_GTID_DOMAIN_ID_SEQ_NO
ER_STORED_FUNCTION_PREVENTS_SWITCH_GTID_DOMAIN_ID_SEQ_NO
eng "Cannot modify @@session.gtid_domain_id or @@session.gtid_seq_no inside a stored function or trigger"
ER_GTID_POSITION_NOT_FOUND_IN_BINLOG2
- eng "Connecting slave requested to start from GTID %u-%u-%llu, which is not in the master's binlog. Since the master's binlog contains GTIDs with higher sequence numbers, it probably means that the slave has diverged due to executing extra errorneous transactions"
+ eng "Connecting slave requested to start from GTID %u-%u-%llu, which is not in the master's binlog. Since the master's binlog contains GTIDs with higher sequence numbers, it probably means that the slave has diverged due to executing extra erroneous transactions"
ER_BINLOG_MUST_BE_EMPTY
eng "This operation is not allowed if any GTID has been logged to the binary log. Run RESET MASTER first to erase the log"
ER_NO_SUCH_QUERY
diff --git a/sql/slave.cc b/sql/slave.cc
index c83f09c7510..4129c4cbc98 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -1,5 +1,5 @@
-/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
- Copyright (c) 2008, 2014, SkySQL Ab.
+/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
+ Copyright (c) 2008, 2015, MariaDB
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
@@ -148,26 +148,18 @@ static int process_io_create_file(Master_info* mi, Create_file_log_event* cev);
static bool wait_for_relay_log_space(Relay_log_info* rli);
static bool io_slave_killed(Master_info* mi);
static bool sql_slave_killed(rpl_group_info *rgi);
-static int init_slave_thread(THD* thd, Master_info *mi,
- SLAVE_THD_TYPE thd_type);
+static int init_slave_thread(THD*, Master_info *, SLAVE_THD_TYPE);
static void print_slave_skip_errors(void);
static int safe_connect(THD* thd, MYSQL* mysql, Master_info* mi);
-static int safe_reconnect(THD* thd, MYSQL* mysql, Master_info* mi,
- bool suppress_warnings);
-static int connect_to_master(THD* thd, MYSQL* mysql, Master_info* mi,
- bool reconnect, bool suppress_warnings);
+static int safe_reconnect(THD*, MYSQL*, Master_info*, bool);
+static int connect_to_master(THD*, MYSQL*, Master_info*, bool, bool);
static Log_event* next_event(rpl_group_info* rgi, ulonglong *event_size);
static int queue_event(Master_info* mi,const char* buf,ulong event_len);
-static int terminate_slave_thread(THD *thd,
- mysql_mutex_t *term_lock,
- mysql_cond_t *term_cond,
- volatile uint *slave_running,
- bool skip_lock);
+static int terminate_slave_thread(THD *, mysql_mutex_t *, mysql_cond_t *,
+ volatile uint *, bool);
static bool check_io_slave_killed(Master_info *mi, const char *info);
-static bool send_show_master_info_header(THD *thd, bool full,
- size_t gtid_pos_length);
-static bool send_show_master_info_data(THD *thd, Master_info *mi, bool full,
- String *gtid_pos);
+static bool send_show_master_info_header(THD *, bool, size_t);
+static bool send_show_master_info_data(THD *, Master_info *, bool, String *);
/*
Function to set the slave's max_allowed_packet based on the value
of slave_max_allowed_packet.
@@ -371,6 +363,9 @@ int init_slave()
if (run_slave_init_thread())
return 1;
+ if (global_rpl_thread_pool.init(opt_slave_parallel_threads))
+ return 1;
+
/*
This is called when mysqld starts. Before client connections are
accepted. However bootstrap may conflict with us if it does START SLAVE.
@@ -404,9 +399,6 @@ int init_slave()
goto err;
}
- if (global_rpl_thread_pool.init(opt_slave_parallel_threads))
- return 1;
-
/*
If --slave-skip-errors=... was not used, the string value for the
system variable has not been set up yet. Do it now.
@@ -653,6 +645,9 @@ int terminate_slave_threads(Master_info* mi,int thread_mask,bool skip_lock)
mysql_mutex_unlock(log_lock);
}
+ if (opt_slave_parallel_threads > 0 &&
+ !master_info_index->any_slave_sql_running())
+ rpl_parallel_inactivate_pool(&global_rpl_thread_pool);
if (thread_mask & (SLAVE_IO|SLAVE_FORCE_ALL))
{
DBUG_PRINT("info",("Terminating IO thread"));
@@ -943,6 +938,8 @@ int start_slave_threads(bool need_slave_mutex, bool wait_for_start,
Master_info::USE_GTID_CURRENT_POS);
mi->events_queued_since_last_gtid= 0;
mi->gtid_reconnect_event_skip_count= 0;
+
+ mi->rli.restart_gtid_pos.reset();
}
if (!error && (thread_mask & SLAVE_IO))
@@ -956,7 +953,10 @@ int start_slave_threads(bool need_slave_mutex, bool wait_for_start,
mi);
if (!error && (thread_mask & SLAVE_SQL))
{
- error= start_slave_thread(
+ if (opt_slave_parallel_threads > 0)
+ error= rpl_parallel_activate_pool(&global_rpl_thread_pool);
+ if (!error)
+ error= start_slave_thread(
#ifdef HAVE_PSI_INTERFACE
key_thread_slave_sql,
#endif
@@ -2002,11 +2002,21 @@ after_set_capability:
!(master_row= mysql_fetch_row(master_res)))
{
err_code= mysql_errno(mysql);
- errmsg= "The slave I/O thread stops because master does not support "
- "MariaDB global transaction id. A fatal error is encountered when "
- "it tries to SELECT @@GLOBAL.gtid_domain_id.";
- sprintf(err_buff, "%s Error: %s", errmsg, mysql_error(mysql));
- goto err;
+ if (is_network_error(err_code))
+ {
+ mi->report(ERROR_LEVEL, err_code, NULL,
+ "Get master @@GLOBAL.gtid_domain_id failed with error: %s",
+ mysql_error(mysql));
+ goto network_err;
+ }
+ else
+ {
+ errmsg= "The slave I/O thread stops because master does not support "
+ "MariaDB global transaction id. A fatal error is encountered when "
+ "it tries to SELECT @@GLOBAL.gtid_domain_id.";
+ sprintf(err_buff, "%s Error: %s", errmsg, mysql_error(mysql));
+ goto err;
+ }
}
mysql_free_result(master_res);
master_res= NULL;
@@ -3343,7 +3353,7 @@ int apply_event_and_update_pos(Log_event* ev, THD* thd,
else
{
/*
- Make sure we do not errorneously update gtid_slave_pos with a lingering
+ Make sure we do not erroneously update gtid_slave_pos with a lingering
GTID from this failed event group (MDEV-4906).
*/
rgi->gtid_pending= false;
@@ -3483,6 +3493,21 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli,
Log_event_type typ= ev->get_type_code();
/*
+ Even if we don't execute this event, we keep the master timestamp,
+ so that seconds behind master shows correct delta (there are events
+ that are not replayed, so we keep falling behind).
+
+ If it is an artificial event, or a relay log event (IO thread generated
+ event) or ev->when is set to 0, we don't update the
+ last_master_timestamp.
+ */
+ if (!(ev->is_artificial_event() || ev->is_relay_log_event() || (ev->when == 0)))
+ {
+ rli->last_master_timestamp= ev->when + (time_t) ev->exec_time;
+ DBUG_ASSERT(rli->last_master_timestamp >= 0);
+ }
+
+ /*
This tests if the position of the beginning of the current event
hits the UNTIL barrier.
*/
@@ -4504,6 +4529,16 @@ pthread_handler_t handle_slave_sql(void *arg)
serial_rgi->gtid_sub_id= 0;
serial_rgi->gtid_pending= false;
+ if (mi->using_gtid != Master_info::USE_GTID_NO)
+ {
+ /*
+ We initialize the relay log state from the know starting position.
+ It will then be updated as required by GTID and GTID_LIST events found
+ while applying events read from relay logs.
+ */
+ rli->relay_log_state.load(&rpl_global_gtid_slave_state);
+ }
+ rli->gtid_skip_flag = GTID_SKIP_NOT;
if (init_relay_log_pos(rli,
rli->group_relay_log_name,
rli->group_relay_log_pos,
@@ -4514,6 +4549,7 @@ pthread_handler_t handle_slave_sql(void *arg)
"Error initializing relay log position: %s", errmsg);
goto err;
}
+ rli->reset_inuse_relaylog();
if (rli->alloc_inuse_relaylog(rli->group_relay_log_name))
goto err;
@@ -4718,7 +4754,49 @@ log '%s' at position %s, relay log '%s' position: %s%s", RPL_LOG_NAME,
thd->reset_query();
thd->reset_db(NULL, 0);
if (rli->mi->using_gtid != Master_info::USE_GTID_NO)
+ {
+ ulong domain_count;
+
flush_relay_log_info(rli);
+ if (opt_slave_parallel_threads > 0)
+ {
+ /*
+ In parallel replication GTID mode, we may stop with different domains
+ at different positions in the relay log.
+
+ To handle this when we restart the SQL thread, mark the current
+ per-domain position in the Relay_log_info.
+ */
+ mysql_mutex_lock(&rpl_global_gtid_slave_state.LOCK_slave_state);
+ domain_count= rpl_global_gtid_slave_state.count();
+ mysql_mutex_unlock(&rpl_global_gtid_slave_state.LOCK_slave_state);
+ if (domain_count > 1)
+ {
+ inuse_relaylog *ir;
+
+ /*
+ Load the starting GTID position, so that we can skip already applied
+ GTIDs when we restart the SQL thread. And set the start position in
+ the relay log back to a known safe place to start (prior to any not
+ yet applied transaction in any domain).
+ */
+ rli->restart_gtid_pos.load(&rpl_global_gtid_slave_state, NULL, 0);
+ if ((ir= rli->inuse_relaylog_list))
+ {
+ rpl_gtid *gtid= ir->relay_log_state;
+ uint32 count= ir->relay_log_state_count;
+ while (count > 0)
+ {
+ process_gtid_for_restart_pos(rli, gtid);
+ ++gtid;
+ --count;
+ }
+ strmake_buf(rli->group_relay_log_name, ir->name);
+ rli->group_relay_log_pos= BIN_LOG_HEADER_SIZE;
+ }
+ }
+ }
+ }
THD_STAGE_INFO(thd, stage_waiting_for_slave_mutex_on_exit);
thd->add_status_to_global();
mysql_mutex_lock(&rli->run_lock);
@@ -4731,6 +4809,7 @@ err_during_init:
/* Forget the relay log's format */
delete rli->relay_log.description_event_for_exec;
rli->relay_log.description_event_for_exec= 0;
+ rli->reset_inuse_relaylog();
/* Wake up master_pos_wait() */
mysql_mutex_unlock(&rli->data_lock);
DBUG_PRINT("info",("Signaling possibly waiting master_pos_wait() functions"));
@@ -4745,12 +4824,10 @@ err_during_init:
*/
thd->temporary_tables = 0; // remove tempation from destructor to close them
THD_CHECK_SENTRY(thd);
- serial_rgi->thd= rli->sql_driver_thd= 0;
+ rli->sql_driver_thd= 0;
mysql_mutex_lock(&LOCK_thread_count);
- THD_CHECK_SENTRY(thd);
thd->rgi_fake= thd->rgi_slave= NULL;
delete serial_rgi;
- delete thd;
mysql_mutex_unlock(&LOCK_thread_count);
/*
Note: the order of the broadcast and unlock calls below (first broadcast, then unlock)
@@ -4761,6 +4838,22 @@ err_during_init:
DBUG_EXECUTE_IF("simulate_slave_delay_at_terminate_bug38694", sleep(5););
mysql_mutex_unlock(&rli->run_lock); // tell the world we are done
+ /*
+ Deactivate the parallel replication thread pool, if there are now no more
+ SQL threads running. Do this here, when we have released all locks, but
+ while our THD (and current_thd) is still valid.
+ */
+ mysql_mutex_lock(&LOCK_active_mi);
+ if (opt_slave_parallel_threads > 0 &&
+ !master_info_index->any_slave_sql_running())
+ rpl_parallel_inactivate_pool(&global_rpl_thread_pool);
+ mysql_mutex_unlock(&LOCK_active_mi);
+
+ mysql_mutex_lock(&LOCK_thread_count);
+ THD_CHECK_SENTRY(thd);
+ delete thd;
+ mysql_mutex_unlock(&LOCK_thread_count);
+
DBUG_LEAVE; // Must match DBUG_ENTER()
my_thread_end();
#ifdef HAVE_OPENSSL
@@ -5648,6 +5741,18 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len)
}
break;
+#ifndef DBUG_OFF
+ case XID_EVENT:
+ DBUG_EXECUTE_IF("slave_discard_xid_for_gtid_0_x_1000",
+ {
+ /* Inject an event group that is missing its XID commit event. */
+ if (mi->last_queued_gtid.domain_id == 0 &&
+ mi->last_queued_gtid.seq_no == 1000)
+ goto skip_relay_logging;
+ });
+ /* Fall through to default case ... */
+#endif
+
default:
default_action:
if (mi->using_gtid != Master_info::USE_GTID_NO && mi->gtid_event_seen)
@@ -5969,7 +6074,23 @@ static int connect_to_master(THD* thd, MYSQL* mysql, Master_info* mi,
}
#endif
- mysql_options(mysql, MYSQL_SET_CHARSET_NAME, default_charset_info->csname);
+ /*
+ If server's default charset is not supported (like utf16, utf32) as client
+ charset, then set client charset to 'latin1' (default client charset).
+ */
+ if (is_supported_parser_charset(default_charset_info))
+ mysql_options(mysql, MYSQL_SET_CHARSET_NAME, default_charset_info->csname);
+ else
+ {
+ sql_print_information("'%s' can not be used as client character set. "
+ "'%s' will be used as default client character set "
+ "while connecting to master.",
+ default_charset_info->csname,
+ default_client_charset_info->csname);
+ mysql_options(mysql, MYSQL_SET_CHARSET_NAME,
+ default_client_charset_info->csname);
+ }
+
/* This one is not strictly needed but we have it here for completeness */
mysql_options(mysql, MYSQL_SET_CHARSET_DIR, (char *) charsets_dir);
diff --git a/sql/sp.cc b/sql/sp.cc
index 35155cf031a..334b5e12ba3 100644
--- a/sql/sp.cc
+++ b/sql/sp.cc
@@ -1,5 +1,6 @@
/*
- Copyright (c) 2002, 2011, Oracle and/or its affiliates.
+ Copyright (c) 2002, 2015, Oracle and/or its affiliates.
+ Copyright (c) 2009, 2015, MariaDB
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
@@ -1476,6 +1477,9 @@ bool lock_db_routines(THD *thd, char *db)
{
char *sp_name= get_field(thd->mem_root,
table->field[MYSQL_PROC_FIELD_NAME]);
+ if (sp_name == NULL) // skip invalid sp names (hand-edited mysql.proc?)
+ continue;
+
longlong sp_type= table->field[MYSQL_PROC_MYSQL_TYPE]->val_int();
MDL_request *mdl_request= new (thd->mem_root) MDL_request;
mdl_request->init(sp_type == TYPE_ENUM_FUNCTION ?
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index d59e0aec541..e181e14611b 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -1365,8 +1365,13 @@ sp_head::execute(THD *thd, bool merge_da_on_success)
if (thd->locked_tables_mode <= LTM_LOCK_TABLES)
thd->user_var_events_alloc= thd->mem_root;
+ sql_digest_state *parent_digest= thd->m_digest;
+ thd->m_digest= NULL;
+
err_status= i->execute(thd, &ip);
+ thd->m_digest= parent_digest;
+
if (i->free_list)
cleanup_items(i->free_list);
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 4b90209a472..9cc9efae6f8 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -863,32 +863,30 @@ static char *fix_plugin_ptr(char *name)
}
/**
- Fix ACL::plugin pointer to point to a hard-coded string, if appropriate
+ Fix a LEX_STRING *plugin pointer to point to a hard-coded string,
+ if appropriate
Make sure that if ACL_USER's plugin is a built-in, then it points
to a hard coded string, not to an allocated copy. Run-time, for
authentication, we want to be able to detect built-ins by comparing
pointers, not strings.
- Additionally - update the salt if the plugin is built-in.
-
@retval 0 the pointers were fixed
@retval 1 this ACL_USER uses a not built-in plugin
*/
-static bool fix_user_plugin_ptr(ACL_USER *user)
+static bool fix_user_plugin_ptr(LEX_STRING *plugin_ptr)
{
- if (my_strcasecmp(system_charset_info, user->plugin.str,
+ DBUG_ASSERT(plugin_ptr);
+ if (my_strcasecmp(system_charset_info, plugin_ptr->str,
native_password_plugin_name.str) == 0)
- user->plugin= native_password_plugin_name;
+ *plugin_ptr= native_password_plugin_name;
else
- if (my_strcasecmp(system_charset_info, user->plugin.str,
+ if (my_strcasecmp(system_charset_info, plugin_ptr->str,
old_password_plugin_name.str) == 0)
- user->plugin= old_password_plugin_name;
+ *plugin_ptr= old_password_plugin_name;
else
return true;
- if (user->auth_string.length)
- set_user_salt(user, user->auth_string.str, user->auth_string.length);
return false;
}
@@ -967,6 +965,23 @@ my_bool acl_init(bool dont_read_acl_tables)
}
/**
+ Check if the password length provided matches supported native formats.
+*/
+static bool password_length_valid(int password_length)
+{
+ switch (password_length)
+ {
+ case 0: /* no password */
+ case SCRAMBLED_PASSWORD_CHAR_LENGTH:
+ return TRUE;
+ case SCRAMBLED_PASSWORD_CHAR_LENGTH_323:
+ return TRUE;
+ default:
+ return FALSE;
+ }
+}
+
+/**
Choose from either native or old password plugins when assigning a password
*/
@@ -1257,22 +1272,43 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables)
char *tmpstr= get_field(&acl_memroot, table->field[next_field++]);
if (tmpstr)
{
+ LEX_STRING auth;
+ auth.str = safe_str(get_field(&acl_memroot, table->field[next_field++]));
+ auth.length = strlen(auth.str);
user.plugin.str= tmpstr;
user.plugin.length= strlen(user.plugin.str);
- user.auth_string.str=
- safe_str(get_field(&acl_memroot, table->field[next_field++]));
- user.auth_string.length= strlen(user.auth_string.str);
-
- if (user.auth_string.length && password_len)
+ if (fix_user_plugin_ptr(&user.plugin)) // Non native plugin.
{
- sql_print_warning("'user' entry '%s@%s' has both a password "
- "and an authentication plugin specified. The "
- "password will be ignored.",
- safe_str(user.user.str),
- safe_str(user.host.hostname));
+ user.auth_string= auth;
+ if (password_len)
+ {
+ sql_print_warning("'user' entry '%s@%s' has both a password "
+ "and an authentication plugin specified. The "
+ "password will be ignored.",
+ safe_str(user.user.str),
+ safe_str(user.host.hostname));
+ }
+ }
+ else // Native plugin.
+ {
+ /*
+ Password field, if not empty, has precedence over
+ authentication_string field, only for native plugins.
+ See MDEV-6253 and MDEV-7985 for reasoning.
+ */
+ if (!password_len)
+ {
+ user.auth_string = auth;
+ if (!password_length_valid(auth.length))
+ {
+ sql_print_warning("Found invalid password for user: '%s@%s';"
+ " Ignoring user", safe_str(user.user.str),
+ safe_str(user.host.hostname));
+ continue;
+ }
+ set_user_salt(&user, auth.str, auth.length);
+ }
}
-
- fix_user_plugin_ptr(&user);
}
}
}
@@ -1971,8 +2007,13 @@ static void acl_update_user(const char *user, const char *host,
acl_user->auth_string.str= auth->str ?
strmake_root(&acl_memroot, auth->str, auth->length) : const_cast<char*>("");
acl_user->auth_string.length= auth->length;
- if (fix_user_plugin_ptr(acl_user))
+ if (acl_user->plugin.str != native_password_plugin_name.str &&
+ acl_user->plugin.str != old_password_plugin_name.str)
acl_user->plugin.str= strmake_root(&acl_memroot, plugin->str, plugin->length);
+ else
+ set_user_salt(acl_user, acl_user->auth_string.str,
+ acl_user->auth_string.length);
+
}
else
if (password[0])
@@ -2047,8 +2088,12 @@ static void acl_insert_user(const char *user, const char *host,
acl_user.auth_string.str= auth->str ?
strmake_root(&acl_memroot, auth->str, auth->length) : const_cast<char*>("");
acl_user.auth_string.length= auth->length;
- if (fix_user_plugin_ptr(&acl_user))
+ if (acl_user.plugin.str != native_password_plugin_name.str &&
+ acl_user.plugin.str != old_password_plugin_name.str)
acl_user.plugin.str= strmake_root(&acl_memroot, plugin->str, plugin->length);
+ else
+ set_user_salt(&acl_user, acl_user.auth_string.str,
+ acl_user.auth_string.length);
}
else
{
@@ -3014,17 +3059,20 @@ static int replace_user_table(THD *thd, TABLE *table, LEX_USER &combo,
mysql_mutex_assert_owner(&acl_cache->lock);
+ size_t length_to_check = 0;
+ combo.password = combo.password.str ? combo.password : empty_lex_str;
if (combo.password.str && combo.password.str[0])
+ length_to_check = combo.password.length;
+ else if (!fix_user_plugin_ptr(&combo.plugin))
+ {
+ length_to_check = combo.auth.length;
+ }
+
+ if (!password_length_valid(length_to_check))
{
- if (combo.password.length != SCRAMBLED_PASSWORD_CHAR_LENGTH &&
- combo.password.length != SCRAMBLED_PASSWORD_CHAR_LENGTH_323)
- {
my_error(ER_PASSWD_LENGTH, MYF(0), SCRAMBLED_PASSWORD_CHAR_LENGTH);
DBUG_RETURN(-1);
- }
}
- else
- combo.password= empty_lex_str;
/* if the user table is not up to date, we can't handle role updates */
if (table->s->fields <= ROLE_ASSIGN_COLUMN_IDX && handle_as_role)
@@ -8802,10 +8850,30 @@ 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)))
- continue;
+ if (user_from->is_role())
+ {
+ /* When searching for roles within the ROLES_MAPPINGS_HASH, we have
+ to check both the user field as well as the role field for a match.
+
+ It is possible to have a role granted to a role. If we are going
+ to modify the mapping entry, it needs to be done on either on the
+ "user" end (here represented by a role) or the "role" end. At least
+ one part must match.
+
+ If the "user" end has a not-empty host string, it can never match
+ as we are searching for a role here. A role always has an empty host
+ string.
+ */
+ if ((*host || strcmp(user_from->user.str, user)) &&
+ strcmp(user_from->user.str, role))
+ continue;
+ }
+ else
+ {
+ if (strcmp(user_from->user.str, user) ||
+ my_strcasecmp(system_charset_info, user_from->host.str, host))
+ continue;
+ }
}
else
{
@@ -9840,7 +9908,6 @@ bool sp_grant_privileges(THD *thd, const char *sp_db, const char *sp_name,
List<LEX_USER> user_list;
bool result;
ACL_USER *au;
- char passwd_buff[SCRAMBLED_PASSWORD_CHAR_LENGTH+1];
Dummy_error_handler error_handler;
DBUG_ENTER("sp_grant_privileges");
@@ -9881,33 +9948,10 @@ bool sp_grant_privileges(THD *thd, const char *sp_db, const char *sp_name,
if(au)
{
- if (au->salt_len)
- {
- if (au->salt_len == SCRAMBLE_LENGTH)
- {
- make_password_from_salt(passwd_buff, au->salt);
- combo->password.length= SCRAMBLED_PASSWORD_CHAR_LENGTH;
- }
- else if (au->salt_len == SCRAMBLE_LENGTH_323)
- {
- make_password_from_salt_323(passwd_buff, (ulong *) au->salt);
- combo->password.length= SCRAMBLED_PASSWORD_CHAR_LENGTH_323;
- }
- else
- {
- push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_PASSWD_LENGTH,
- ER(ER_PASSWD_LENGTH), SCRAMBLED_PASSWORD_CHAR_LENGTH);
- return TRUE;
- }
- combo->password.str= passwd_buff;
- }
-
if (au->plugin.str != native_password_plugin_name.str &&
au->plugin.str != old_password_plugin_name.str)
- {
combo->plugin= au->plugin;
- combo->auth= au->auth_string;
- }
+ combo->auth= au->auth_string;
}
if (user_list.push_back(combo))
diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc
index 1d917de0c1a..a6b97ce31fa 100644
--- a/sql/sql_admin.cc
+++ b/sql/sql_admin.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2010, 2014, Oracle and/or its affiliates.
- Copyright (c) 2012, 2014, Monty Program Ab.
+ Copyright (c) 2012, 2015, MariaDB
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
@@ -309,7 +309,8 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
HA_CHECK_OPT *),
int (handler::*operator_func)(THD *,
HA_CHECK_OPT *),
- int (view_operator_func)(THD *, TABLE_LIST*))
+ int (view_operator_func)(THD *, TABLE_LIST*,
+ HA_CHECK_OPT *))
{
TABLE_LIST *table;
SELECT_LEX *select= &thd->lex->select_lex;
@@ -320,6 +321,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
int result_code;
int compl_result_code;
bool need_repair_or_alter= 0;
+ wait_for_commit* suspended_wfc;
DBUG_ENTER("mysql_admin_table");
DBUG_PRINT("enter", ("extra_open_options: %u", extra_open_options));
@@ -337,6 +339,13 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_RETURN(TRUE);
+ /*
+ This function calls trans_commit() during its operation, but that does not
+ imply that the operation is complete or binlogged. So we have to suspend
+ temporarily the wakeup_subsequent_commits() calls (if used).
+ */
+ suspended_wfc= thd->suspend_subsequent_commits();
+
mysql_ha_rm_tables(thd, tables);
/*
@@ -385,7 +394,18 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
lex->query_tables_own_last= 0;
if (view_operator_func == NULL)
+ {
table->required_type=FRMTYPE_TABLE;
+ DBUG_ASSERT(!lex->only_view);
+ }
+ else if (lex->only_view)
+ {
+ table->required_type= FRMTYPE_VIEW;
+ }
+ else if (!lex->only_view && lex->sql_command == SQLCOM_REPAIR)
+ {
+ table->required_type= FRMTYPE_TABLE;
+ }
if (lex->sql_command == SQLCOM_CHECK ||
lex->sql_command == SQLCOM_REPAIR ||
@@ -464,7 +484,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
if (!table->table->part_info)
{
my_error(ER_PARTITION_MGMT_ON_NONPARTITIONED, MYF(0));
- DBUG_RETURN(TRUE);
+ goto err2;
}
if (set_part_state(alter_info, table->table->part_info, PART_ADMIN))
{
@@ -513,9 +533,9 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
}
/*
- CHECK TABLE command is only command where VIEW allowed here and this
- command use only temporary teble method for VIEWs resolving => there
- can't be VIEW tree substitition of join view => if opening table
+ CHECK/REPAIR TABLE command is only command where VIEW allowed here and
+ this command use only temporary table method for VIEWs resolving =>
+ there can't be VIEW tree substitition of join view => if opening table
succeed then table->table will have real TABLE pointer as value (in
case of join view substitution table->table can be 0, but here it is
impossible)
@@ -528,7 +548,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
ER_CHECK_NO_SUCH_TABLE, ER(ER_CHECK_NO_SUCH_TABLE));
/* if it was a view will check md5 sum */
if (table->view &&
- view_checksum(thd, table) == HA_ADMIN_WRONG_CHECKSUM)
+ view_check(thd, table, check_opt) == HA_ADMIN_WRONG_CHECKSUM)
push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
ER_VIEW_CHECKSUM, ER(ER_VIEW_CHECKSUM));
if (thd->get_stmt_da()->is_error() &&
@@ -543,7 +563,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
if (table->view)
{
DBUG_PRINT("admin", ("calling view_operator_func"));
- result_code= (*view_operator_func)(thd, table);
+ result_code= (*view_operator_func)(thd, table, check_opt);
goto send_result;
}
@@ -960,7 +980,16 @@ send_result_message:
size_t length;
protocol->store(STRING_WITH_LEN("error"), system_charset_info);
- if (table->table->file->ha_table_flags() & HA_CAN_REPAIR)
+#if MYSQL_VERSION_ID > 100104
+#error fix the error message to take TABLE or VIEW as an argument
+#else
+ if (table->view)
+ length= my_snprintf(buf, sizeof(buf),
+ "Upgrade required. Please do \"REPAIR VIEW %`s\" or dump/reload to fix it!",
+ table->table_name);
+ else
+#endif
+ if (table->table->file->ha_table_flags() & HA_CAN_REPAIR || table->view)
length= my_snprintf(buf, sizeof(buf), ER(ER_TABLE_NEEDS_UPGRADE),
table->table_name);
else
@@ -983,7 +1012,7 @@ send_result_message:
break;
}
}
- if (table->table)
+ if (table->table && !table->view)
{
if (table->table->s->tmp_table)
{
@@ -1045,6 +1074,8 @@ send_result_message:
}
my_eof(thd);
+ thd->resume_subsequent_commits(suspended_wfc);
+ DBUG_EXECUTE_IF("inject_analyze_table_sleep", my_sleep(500000););
DBUG_RETURN(FALSE);
err:
@@ -1058,6 +1089,8 @@ err:
}
close_thread_tables(thd); // Shouldn't be needed
thd->mdl_context.release_transactional_locks();
+err2:
+ thd->resume_subsequent_commits(suspended_wfc);
DBUG_RETURN(TRUE);
}
@@ -1177,7 +1210,7 @@ bool Sql_cmd_check_table::execute(THD *thd)
res= mysql_admin_table(thd, first_table, &m_lex->check_opt, "check",
lock_type, 0, 0, HA_OPEN_FOR_REPAIR, 0,
- &handler::ha_check, &view_checksum);
+ &handler::ha_check, &view_check);
m_lex->select_lex.table_list.first= first_table;
m_lex->query_tables= first_table;
@@ -1234,7 +1267,7 @@ bool Sql_cmd_repair_table::execute(THD *thd)
TL_WRITE, 1,
MY_TEST(m_lex->check_opt.sql_flags & TT_USEFRM),
HA_OPEN_FOR_REPAIR, &prepare_for_repair,
- &handler::ha_repair, 0);
+ &handler::ha_repair, &view_repair);
/* ! we write after unlocking the table */
if (!res && !m_lex->no_write_to_binlog)
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 424f572deca..13b8625ebe6 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -1,5 +1,5 @@
-/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
- Copyright (c) 2010, 2013 Monty Program Ab
+/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
+ Copyright (c) 2010, 2015, MariaDB
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
@@ -653,6 +653,7 @@ bool close_cached_connection_tables(THD *thd, LEX_STRING *connection)
static void mark_temp_tables_as_free_for_reuse(THD *thd)
{
+ rpl_group_info *rgi_slave;
DBUG_ENTER("mark_temp_tables_as_free_for_reuse");
if (thd->query_id == 0)
@@ -661,20 +662,25 @@ static void mark_temp_tables_as_free_for_reuse(THD *thd)
DBUG_VOID_RETURN;
}
- thd->lock_temporary_tables();
- for (TABLE *table= thd->temporary_tables ; table ; table= table->next)
- {
- if ((table->query_id == thd->query_id) && ! table->open_by_handler)
- mark_tmp_table_for_reuse(table);
- }
- thd->unlock_temporary_tables();
- if (thd->rgi_slave)
+ rgi_slave=thd->rgi_slave;
+ if ((!rgi_slave && thd->temporary_tables) ||
+ (rgi_slave && unlikely(rgi_slave->rli->save_temporary_tables)))
{
- /*
- Temporary tables are shared with other by sql execution threads.
- As a safety messure, clear the pointer to the common area.
- */
- thd->temporary_tables= 0;
+ thd->lock_temporary_tables();
+ for (TABLE *table= thd->temporary_tables ; table ; table= table->next)
+ {
+ if ((table->query_id == thd->query_id) && ! table->open_by_handler)
+ mark_tmp_table_for_reuse(table);
+ }
+ thd->unlock_temporary_tables();
+ if (rgi_slave)
+ {
+ /*
+ Temporary tables are shared with other by sql execution threads.
+ As a safety messure, clear the pointer to the common area.
+ */
+ thd->temporary_tables= 0;
+ }
}
DBUG_VOID_RETURN;
}
@@ -1434,6 +1440,9 @@ unique_table(THD *thd, TABLE_LIST *table, TABLE_LIST *table_list,
bool check_alias)
{
TABLE_LIST *dup;
+
+ table= table->find_table_for_update();
+
if (table->table && table->table->file->ht->db_type == DB_TYPE_MRG_MYISAM)
{
TABLE_LIST *child;
@@ -1544,6 +1553,69 @@ TABLE *find_temporary_table(THD *thd, const TABLE_LIST *tl)
}
+static bool
+use_temporary_table(THD *thd, TABLE *table, TABLE **out_table)
+{
+ *out_table= table;
+ if (!table)
+ return false;
+ /*
+ Temporary tables are not safe for parallel replication. They were
+ designed to be visible to one thread only, so have no table locking.
+ Thus there is no protection against two conflicting transactions
+ committing in parallel and things like that.
+
+ So for now, anything that uses temporary tables will be serialised
+ with anything before it, when using parallel replication.
+
+ ToDo: We might be able to introduce a reference count or something
+ on temp tables, and have slave worker threads wait for it to reach
+ zero before being allowed to use the temp table. Might not be worth
+ it though, as statement-based replication using temporary tables is
+ in any case rather fragile.
+ */
+ if (thd->rgi_slave && thd->rgi_slave->is_parallel_exec &&
+ thd->wait_for_prior_commit())
+ return true;
+ /*
+ We need to set the THD as it may be different in case of
+ parallel replication
+ */
+ if (table->in_use != thd)
+ {
+ table->in_use= thd;
+#ifdef REMOVE_AFTER_MERGE_WITH_10
+ if (thd->rgi_slave)
+ {
+ /*
+ We may be stealing an opened temporary tables from one slave
+ thread to another, we need to let the performance schema know that,
+ for aggregates per thread to work properly.
+ */
+ table->file->unbind_psi();
+ table->file->rebind_psi();
+ }
+#endif
+ }
+ return false;
+}
+
+bool
+find_and_use_temporary_table(THD *thd, const char *db, const char *table_name,
+ TABLE **out_table)
+{
+ return use_temporary_table(thd, find_temporary_table(thd, db, table_name),
+ out_table);
+}
+
+
+bool
+find_and_use_temporary_table(THD *thd, const TABLE_LIST *tl, TABLE **out_table)
+{
+ return use_temporary_table(thd, find_temporary_table(thd, tl), out_table);
+}
+
+
/**
Find a temporary table specified by a key in the THD::temporary_tables list.
@@ -1564,26 +1636,6 @@ TABLE *find_temporary_table(THD *thd,
if (table->s->table_cache_key.length == table_key_length &&
!memcmp(table->s->table_cache_key.str, table_key, table_key_length))
{
- /*
- We need to set the THD as it may be different in case of
- parallel replication
- */
- if (table->in_use != thd)
- {
- table->in_use= thd;
-#ifdef REMOVE_AFTER_MERGE_WITH_10
- if (thd->rgi_slave)
- {
- /*
- We may be stealing an opened temporary tables from one slave
- thread to another, we need to let the performance schema know that,
- for aggregates per thread to work properly.
- */
- table->file->unbind_psi();
- table->file->rebind_psi();
- }
-#endif
- }
result= table;
break;
}
@@ -3404,7 +3456,7 @@ request_backoff_action(enum_open_table_action action_arg,
if (action_arg != OT_REOPEN_TABLES && m_has_locks)
{
my_error(ER_LOCK_DEADLOCK, MYF(0));
- mark_transaction_to_rollback(m_thd, true);
+ m_thd->mark_transaction_to_rollback(true);
return TRUE;
}
/*
@@ -5583,6 +5635,14 @@ TABLE *open_table_uncached(THD *thd, handlerton *hton,
(uint) thd->variables.server_id,
(ulong) thd->variables.pseudo_thread_id));
+ if (add_to_temporary_tables_list)
+ {
+ /* Temporary tables are not safe for parallel replication. */
+ if (thd->rgi_slave && thd->rgi_slave->is_parallel_exec &&
+ thd->wait_for_prior_commit())
+ DBUG_RETURN(NULL);
+ }
+
/* Create the cache_key for temporary tables */
key_length= create_tmp_table_def_key(thd, cache_key, db, table_name);
@@ -5808,7 +5868,9 @@ bool open_temporary_table(THD *thd, TABLE_LIST *tl)
DBUG_RETURN(FALSE);
}
- if (!(table= find_temporary_table(thd, tl)))
+ if (find_and_use_temporary_table(thd, tl, &table))
+ DBUG_RETURN(TRUE);
+ if (!table)
{
if (tl->open_type == OT_TEMPORARY_ONLY &&
tl->open_strategy == TABLE_LIST::OPEN_NORMAL)
@@ -5819,6 +5881,25 @@ bool open_temporary_table(THD *thd, TABLE_LIST *tl)
DBUG_RETURN(FALSE);
}
+ /*
+ Temporary tables are not safe for parallel replication. They were
+ designed to be visible to one thread only, so have no table locking.
+ Thus there is no protection against two conflicting transactions
+ committing in parallel and things like that.
+
+ So for now, anything that uses temporary tables will be serialised
+ with anything before it, when using parallel replication.
+
+ ToDo: We might be able to introduce a reference count or something
+ on temp tables, and have slave worker threads wait for it to reach
+ zero before being allowed to use the temp table. Might not be worth
+ it though, as statement-based replication using temporary tables is
+ in any case rather fragile.
+ */
+ if (thd->rgi_slave && thd->rgi_slave->is_parallel_exec &&
+ thd->wait_for_prior_commit())
+ DBUG_RETURN(true);
+
#ifdef WITH_PARTITION_STORAGE_ENGINE
if (tl->partition_names)
{
@@ -6904,7 +6985,7 @@ find_item_in_list(Item *find, List<Item> &items, uint *counter,
Item_field for tables.
*/
Item_ident *item_ref= (Item_ident *) item;
- if (item_ref->name && item_ref->table_name &&
+ if (field_name && item_ref->name && item_ref->table_name &&
!my_strcasecmp(system_charset_info, item_ref->name, field_name) &&
!my_strcasecmp(table_alias_charset, item_ref->table_name,
table_name) &&
@@ -7934,9 +8015,10 @@ bool setup_tables(THD *thd, Name_resolution_context *context,
if (select_lex->first_cond_optimization)
{
leaves.empty();
- if (!select_lex->is_prep_leaf_list_saved)
+ if (select_lex->prep_leaf_list_state != SELECT_LEX::SAVED)
{
make_leaves_list(leaves, tables, full_table_list, first_select_table);
+ select_lex->prep_leaf_list_state= SELECT_LEX::READY;
select_lex->leaf_tables_exec.empty();
}
else
diff --git a/sql/sql_base.h b/sql/sql_base.h
index 8a0a1e42500..a6d90199860 100644
--- a/sql/sql_base.h
+++ b/sql/sql_base.h
@@ -148,7 +148,11 @@ TABLE_LIST *find_table_in_list(TABLE_LIST *table,
const char *db_name,
const char *table_name);
TABLE *find_temporary_table(THD *thd, const char *db, const char *table_name);
+bool find_and_use_temporary_table(THD *thd, const char *db,
+ const char *table_name, TABLE **out_table);
TABLE *find_temporary_table(THD *thd, const TABLE_LIST *tl);
+bool find_and_use_temporary_table(THD *thd, const TABLE_LIST *tl,
+ TABLE **out_table);
TABLE *find_temporary_table(THD *thd, const char *table_key,
uint table_key_length);
void close_thread_tables(THD *thd);
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 9cdf5cec54d..cf0c4a1b84f 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -1,6 +1,6 @@
/*
- Copyright (c) 2000, 2013, Oracle and/or its affiliates.
- Copyright (c) 2008, 2014, SkySQL Ab.
+ Copyright (c) 2000, 2015, Oracle and/or its affiliates.
+ Copyright (c) 2008, 2015, MariaDB
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
@@ -874,6 +874,7 @@ THD::THD()
stmt_depends_on_first_successful_insert_id_in_prev_stmt(FALSE),
m_examined_row_count(0),
accessed_rows_and_keys(0),
+ m_digest(NULL),
m_statement_psi(NULL),
m_idle_psi(NULL),
thread_id(0),
@@ -881,12 +882,13 @@ THD::THD()
failed_com_change_user(0),
is_fatal_error(0),
transaction_rollback_request(0),
- is_fatal_sub_stmt_error(0),
+ is_fatal_sub_stmt_error(false),
rand_used(0),
time_zone_used(0),
in_lock_tables(0),
bootstrap(0),
derived_tables_processing(FALSE),
+ waiting_on_group_commit(FALSE), has_waiter(FALSE),
spcont(NULL),
m_parser_state(NULL),
#if defined(ENABLED_DEBUG_SYNC)
@@ -1043,6 +1045,13 @@ THD::THD()
substitute_null_with_insert_id = FALSE;
thr_lock_info_init(&lock_info); /* safety: will be reset after start */
+ m_token_array= NULL;
+ if (max_digest_length > 0)
+ {
+ m_token_array= (unsigned char*) my_malloc(max_digest_length,
+ MYF(MY_WME|MY_THREAD_SPECIFIC));
+ }
+
m_internal_handler= NULL;
m_binlog_invoker= INVOKER_NONE;
arena_for_cached_items= 0;
@@ -1519,6 +1528,7 @@ void THD::cleanup(void)
mysql_ha_cleanup(this);
locked_tables_list.unlock_locked_tables(this);
+ delete_dynamic(&user_var_events);
close_temporary_tables(this);
transaction.xid_state.xa_state= XA_NOTR;
@@ -1550,7 +1560,6 @@ void THD::cleanup(void)
debug_sync_end_thread(this);
#endif /* defined(ENABLED_DEBUG_SYNC) */
- delete_dynamic(&user_var_events);
my_hash_free(&user_vars);
sp_cache_clear(&sp_proc_cache);
sp_cache_clear(&sp_func_cache);
@@ -1624,6 +1633,7 @@ THD::~THD()
#endif
free_root(&main_mem_root, MYF(0));
+ my_free(m_token_array);
main_da.free_memory();
if (status_var.memory_used != 0)
{
@@ -4233,6 +4243,8 @@ thd_need_wait_for(const MYSQL_THD thd)
{
rpl_group_info *rgi;
+ if (mysql_bin_log.is_open() && opt_binlog_commit_wait_count > 0)
+ return true;
if (!thd)
return false;
rgi= thd->rgi_slave;
@@ -4267,13 +4279,14 @@ thd_need_wait_for(const MYSQL_THD thd)
not harmful, but could lead to unnecessary kill and retry, so best avoided).
*/
extern "C" void
-thd_report_wait_for(const MYSQL_THD thd, MYSQL_THD other_thd)
+thd_report_wait_for(MYSQL_THD thd, MYSQL_THD other_thd)
{
rpl_group_info *rgi;
rpl_group_info *other_rgi;
if (!thd || !other_thd)
return;
+ binlog_report_wait_for(thd, other_thd);
rgi= thd->rgi_slave;
other_rgi= other_thd->rgi_slave;
if (!rgi || !other_rgi)
@@ -4446,7 +4459,8 @@ extern "C" int thd_binlog_format(const MYSQL_THD thd)
extern "C" void thd_mark_transaction_to_rollback(MYSQL_THD thd, bool all)
{
- mark_transaction_to_rollback(thd, all);
+ DBUG_ASSERT(thd);
+ thd->mark_transaction_to_rollback(all);
}
extern "C" bool thd_binlog_filter_ok(const MYSQL_THD thd)
@@ -4687,9 +4701,12 @@ void THD::restore_sub_statement_state(Sub_statement_state *backup)
If we've left sub-statement mode, reset the fatal error flag.
Otherwise keep the current value, to propagate it up the sub-statement
stack.
+
+ NOTE: is_fatal_sub_stmt_error can be set only if we've been in the
+ sub-statement mode.
*/
if (!in_sub_stmt)
- is_fatal_sub_stmt_error= FALSE;
+ is_fatal_sub_stmt_error= false;
if ((variables.option_bits & OPTION_BIN_LOG) && is_update_query(lex->sql_command) &&
!is_current_stmt_binlog_format_row())
@@ -4931,17 +4948,18 @@ void THD::get_definer(LEX_USER *definer, bool role)
/**
Mark transaction to rollback and mark error as fatal to a sub-statement.
- @param thd Thread handle
@param all TRUE <=> rollback main transaction.
*/
-void mark_transaction_to_rollback(THD *thd, bool all)
+void THD::mark_transaction_to_rollback(bool all)
{
- if (thd)
- {
- thd->is_fatal_sub_stmt_error= TRUE;
- thd->transaction_rollback_request= all;
- }
+ /*
+ There is no point in setting is_fatal_sub_stmt_error unless
+ we are actually in_sub_stmt.
+ */
+ if (in_sub_stmt)
+ is_fatal_sub_stmt_error= true;
+ transaction_rollback_request= all;
}
/***************************************************************************
Handling of XA id cacheing
@@ -6605,6 +6623,7 @@ wait_for_commit::wakeup_subsequent_commits2(int wakeup_error)
a mutex), so no extra explicit barrier is needed here.
*/
wakeup_subsequent_commits_running= false;
+ DBUG_EXECUTE_IF("inject_wakeup_subsequent_commits_sleep", my_sleep(21000););
}
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 5d64837a2c1..a8d8444571e 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -1,5 +1,6 @@
-/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
- Copyright (c) 2009, 2013, Monty Program Ab.
+/*
+ Copyright (c) 2000, 2015, Oracle and/or its affiliates.
+ Copyright (c) 2009, 2015, MariaDB
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
@@ -37,6 +38,8 @@
#include "violite.h" /* vio_is_connected */
#include "thr_lock.h" /* thr_lock_type, THR_LOCK_DATA,
THR_LOCK_INFO */
+#include "sql_digest_stream.h" // sql_digest_state
+
#include <mysql/psi/mysql_stage.h>
#include <mysql/psi/mysql_statement.h>
#include <mysql/psi/mysql_idle.h>
@@ -772,9 +775,6 @@ void add_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var);
void add_diff_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var,
STATUS_VAR *dec_var);
-void mark_transaction_to_rollback(THD *thd, bool all);
-
-
/**
Get collation by name, send error to client on failure.
@param name Collation name
@@ -802,7 +802,6 @@ mysqld_collation_get_by_name(const char *name,
return cs;
}
-
#ifdef MYSQL_SERVER
void free_tmp_table(THD *thd, TABLE *entry);
@@ -2508,6 +2507,13 @@ public:
PROFILING profiling;
#endif
+ /** Current statement digest. */
+ sql_digest_state *m_digest;
+ /** Current statement digest token array. */
+ unsigned char *m_token_array;
+ /** Top level statement digest. */
+ sql_digest_state m_digest_state;
+
/** Current statement instrumentation. */
PSI_statement_locker *m_statement_psi;
#ifdef HAVE_PSI_STATEMENT_INTERFACE
@@ -2675,6 +2681,18 @@ public:
*/
bool is_slave_error;
/*
+ True when a transaction is queued up for binlog group commit.
+ Used so that if another transaction needs to wait for a row lock held by
+ this transaction, it can signal to trigger the group commit immediately,
+ skipping the normal --binlog-commit-wait-count wait.
+ */
+ bool waiting_on_group_commit;
+ /*
+ Set true when another transaction goes to wait on a row lock held by this
+ transaction. Used together with waiting_on_group_commit.
+ */
+ bool has_waiter;
+ /*
In case of a slave, set to the error code the master got when executing
the query. 0 if no error on the master.
*/
@@ -3101,6 +3119,8 @@ public:
if (get_stmt_da()->is_error())
get_stmt_da()->reset_diagnostics_area();
is_slave_error= 0;
+ if (killed == KILL_BAD_DATA)
+ killed= NOT_KILLED; // KILL_BAD_DATA can be reset w/o a mutex
DBUG_VOID_RETURN;
}
#ifndef EMBEDDED_LIBRARY
@@ -3682,7 +3702,17 @@ public:
if (wait_for_commit_ptr)
wait_for_commit_ptr->wakeup_subsequent_commits(wakeup_error);
}
+ wait_for_commit *suspend_subsequent_commits() {
+ wait_for_commit *suspended= wait_for_commit_ptr;
+ wait_for_commit_ptr= NULL;
+ return suspended;
+ }
+ void resume_subsequent_commits(wait_for_commit *suspended) {
+ DBUG_ASSERT(!wait_for_commit_ptr);
+ wait_for_commit_ptr= suspended;
+ }
+ void mark_transaction_to_rollback(bool all);
private:
/** The current internal error handler for this thread, or NULL. */
@@ -4864,8 +4894,6 @@ public:
*/
#define CF_SKIP_QUESTIONS (1U << 1)
-void mark_transaction_to_rollback(THD *thd, bool all);
-
/* Inline functions */
inline bool add_item_to_list(THD *thd, Item *item)
diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc
index 807b028a4b1..0202b4493ac 100644
--- a/sql/sql_connect.cc
+++ b/sql/sql_connect.cc
@@ -1122,7 +1122,7 @@ bool setup_connection_thread_globals(THD *thd)
bool login_connection(THD *thd)
{
NET *net= &thd->net;
- int error;
+ int error= 0;
DBUG_ENTER("login_connection");
DBUG_PRINT("info", ("login_connection called by thread %lu",
thd->thread_id));
@@ -1141,7 +1141,8 @@ bool login_connection(THD *thd)
my_sleep(1000); /* must wait after eof() */
#endif
statistic_increment(aborted_connects,&LOCK_status);
- DBUG_RETURN(1);
+ error=1;
+ goto exit;
}
/* Connect completed, set read/write timeouts back to default */
my_net_set_read_timeout(net, thd->variables.net_read_timeout);
@@ -1151,10 +1152,13 @@ bool login_connection(THD *thd)
if (increment_connection_count(thd, TRUE))
{
my_error(ER_OUTOFMEMORY, MYF(0), 2*sizeof(USER_STATS));
- DBUG_RETURN(1);
+ error= 1;
+ goto exit;
}
- DBUG_RETURN(0);
+exit:
+ mysql_audit_notify_connection_connect(thd);
+ DBUG_RETURN(error);
}
@@ -1295,7 +1299,6 @@ bool thd_prepare_connection(THD *thd)
bool rc;
lex_start(thd);
rc= login_connection(thd);
- mysql_audit_notify_connection_connect(thd);
if (rc)
return rc;
diff --git a/sql/sql_cursor.cc b/sql/sql_cursor.cc
index 99b7b1e58d0..c09f3269d7a 100644
--- a/sql/sql_cursor.cc
+++ b/sql/sql_cursor.cc
@@ -98,6 +98,7 @@ public:
int mysql_open_cursor(THD *thd, select_result *result,
Server_side_cursor **pcursor)
{
+ sql_digest_state *parent_digest;
PSI_statement_locker *parent_locker;
select_result *save_result;
Select_materialize *result_materialize;
@@ -117,11 +118,14 @@ int mysql_open_cursor(THD *thd, select_result *result,
&thd->security_ctx->priv_user[0],
(char *) thd->security_ctx->host_or_ip,
2);
+ parent_digest= thd->m_digest;
parent_locker= thd->m_statement_psi;
+ thd->m_digest= NULL;
thd->m_statement_psi= NULL;
/* Mark that we can't use query cache with cursors */
thd->query_cache_is_applicable= 0;
rc= mysql_execute_command(thd);
+ thd->m_digest= parent_digest;
thd->m_statement_psi= parent_locker;
MYSQL_QUERY_EXEC_DONE(rc);
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index 06e6d738db1..e89c3d9e745 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -1,6 +1,6 @@
/*
- Copyright (c) 2000, 2013, Oracle and/or its affiliates.
- Copyright (c) 2009, 2013, Monty Program Ab.
+ Copyright (c) 2000, 2014, Oracle and/or its affiliates.
+ Copyright (c) 2009, 2015, MariaDB
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
@@ -952,7 +952,7 @@ update_binlog:
if (!(query= (char*) thd->alloc(MAX_DROP_TABLE_Q_LEN)))
goto exit; /* not much else we can do */
- query_pos= query_data_start= strmov(query,"DROP TABLE ");
+ query_pos= query_data_start= strmov(query,"DROP TABLE IF EXISTS ");
query_end= query + MAX_DROP_TABLE_Q_LEN;
db_len= strlen(db);
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index d776077c4c3..5292b964576 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -1,5 +1,6 @@
/*
Copyright (c) 2000, 2010, Oracle and/or its affiliates.
+ Copyright (c) 2010, 2015, MariaDB
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
@@ -850,7 +851,7 @@ int mysql_multi_delete_prepare(THD *thd)
*/
lex->select_lex.exclude_from_table_unique_test= FALSE;
- if (lex->select_lex.save_prep_leaf_tables(thd))
+ if (lex->save_prep_leaf_tables())
DBUG_RETURN(TRUE);
DBUG_RETURN(FALSE);
@@ -897,9 +898,10 @@ multi_delete::initialize_tables(JOIN *join)
delete_while_scanning= 1;
for (walk= delete_tables; walk; walk= walk->next_local)
{
- tables_to_delete_from|= walk->table->map;
+ TABLE_LIST *tbl= walk->correspondent_table->find_table_for_update();
+ tables_to_delete_from|= tbl->table->map;
if (delete_while_scanning &&
- unique_table(thd, walk, join->tables_list, false))
+ unique_table(thd, tbl, join->tables_list, false))
{
/*
If the table we are going to delete from appears
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc
index 14e26fbefa6..fdc615d0fae 100644
--- a/sql/sql_derived.cc
+++ b/sql/sql_derived.cc
@@ -1,5 +1,6 @@
/*
Copyright (c) 2002, 2011, Oracle and/or its affiliates.
+ Copyright (c) 2010, 2015, MariaDB
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
@@ -169,7 +170,9 @@ mysql_handle_single_derived(LEX *lex, TABLE_LIST *derived, uint phases)
uint8 allowed_phases= (derived->is_merged_derived() ? DT_PHASES_MERGE :
DT_PHASES_MATERIALIZE);
DBUG_ENTER("mysql_handle_single_derived");
- DBUG_PRINT("enter", ("phases: 0x%x allowed: 0x%x", phases, allowed_phases));
+ DBUG_PRINT("enter", ("phases: 0x%x allowed: 0x%x alias: '%s'",
+ phases, allowed_phases,
+ (derived->alias ? derived->alias : "<NULL>")));
if (!lex->derived_tables)
DBUG_RETURN(FALSE);
@@ -503,10 +506,22 @@ unconditional_materialization:
bool mysql_derived_merge_for_insert(THD *thd, LEX *lex, TABLE_LIST *derived)
{
DBUG_ENTER("mysql_derived_merge_for_insert");
+ DBUG_PRINT("enter", ("derived: %p", derived));
+ DBUG_PRINT("info", ("merged_for_insert: %d is_materialized_derived: %d "
+ "is_multitable: %d single_table_updatable: %d "
+ "merge_underlying_list: %d",
+ derived->merged_for_insert,
+ derived->is_materialized_derived(),
+ derived->is_multitable(),
+ derived->single_table_updatable(),
+ derived->merge_underlying_list != 0));
if (derived->merged_for_insert)
DBUG_RETURN(FALSE);
if (derived->is_materialized_derived())
DBUG_RETURN(mysql_derived_prepare(thd, lex, derived));
+ if ((thd->lex->sql_command == SQLCOM_UPDATE_MULTI ||
+ thd->lex->sql_command == SQLCOM_DELETE_MULTI))
+ DBUG_RETURN(FALSE);
if (!derived->is_multitable())
{
if (!derived->single_table_updatable())
@@ -516,8 +531,9 @@ bool mysql_derived_merge_for_insert(THD *thd, LEX *lex, TABLE_LIST *derived)
derived->table= derived->merge_underlying_list->table;
derived->schema_table= derived->merge_underlying_list->schema_table;
derived->merged_for_insert= TRUE;
+ DBUG_ASSERT(derived->table);
}
- }
+ }
DBUG_RETURN(FALSE);
}
@@ -544,6 +560,7 @@ bool mysql_derived_init(THD *thd, LEX *lex, TABLE_LIST *derived)
{
SELECT_LEX_UNIT *unit= derived->get_unit();
DBUG_ENTER("mysql_derived_init");
+ DBUG_PRINT("enter", ("derived: %p", derived));
// Skip already prepared views/DT
if (!unit || unit->prepared)
@@ -689,6 +706,7 @@ bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived)
thd->create_tmp_table_for_derived= FALSE;
derived->table= derived->derived_result->table;
+ DBUG_ASSERT(derived->table);
if (derived->is_derived() && derived->is_merged_derived())
first_select->mark_as_belong_to_derived(derived);
@@ -956,8 +974,7 @@ bool mysql_derived_reinit(THD *thd, LEX *lex, TABLE_LIST *derived)
DBUG_ENTER("mysql_derived_reinit");
st_select_lex_unit *unit= derived->get_unit();
- if (derived->table)
- derived->merged_for_insert= FALSE;
+ derived->merged_for_insert= FALSE;
unit->unclean();
unit->types.empty();
/* for derived tables & PS (which can't be reset by Item_subquery) */
@@ -965,4 +982,3 @@ bool mysql_derived_reinit(THD *thd, LEX *lex, TABLE_LIST *derived)
unit->set_thd(thd);
DBUG_RETURN(FALSE);
}
-
diff --git a/sql/sql_derived.h b/sql/sql_derived.h
index f232445879e..1dffef7235b 100644
--- a/sql/sql_derived.h
+++ b/sql/sql_derived.h
@@ -23,6 +23,7 @@ struct LEX;
bool mysql_handle_derived(LEX *lex, uint phases);
bool mysql_handle_single_derived(LEX *lex, TABLE_LIST *derived, uint phases);
bool mysql_handle_list_of_derived(LEX *lex, TABLE_LIST *dt_list, uint phases);
+bool mysql_derived_reinit(THD *thd, LEX *lex, TABLE_LIST *derived);
/**
Cleans up the SELECT_LEX_UNIT for the derived table (if any).
diff --git a/sql/sql_digest.cc b/sql/sql_digest.cc
new file mode 100644
index 00000000000..324f2fbd428
--- /dev/null
+++ b/sql/sql_digest.cc
@@ -0,0 +1,683 @@
+/* Copyright (c) 2008, 2015, 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; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
+
+/*
+ This code needs extra visibility in the lexer structures
+*/
+
+#include "my_global.h"
+#include "my_md5.h"
+#include "mysqld_error.h"
+
+#include "sql_string.h"
+#include "sql_class.h"
+#include "sql_lex.h"
+#include "sql_digest.h"
+#include "sql_digest_stream.h"
+
+#include "sql_get_diagnostics.h"
+
+#ifdef NEVER
+#include "my_sys.h"
+#include "sql_signal.h"
+#endif
+
+/* Generated code */
+#include "sql_yacc.h"
+#define LEX_TOKEN_WITH_DEFINITION
+#include "lex_token.h"
+
+/* Name pollution from sql/sql_lex.h */
+#ifdef LEX_YYSTYPE
+#undef LEX_YYSTYPE
+#endif
+
+#define LEX_YYSTYPE YYSTYPE*
+
+#define SIZE_OF_A_TOKEN 2
+
+/**
+ Read a single token from token array.
+*/
+inline uint read_token(const sql_digest_storage *digest_storage,
+ uint index, uint *tok)
+{
+ uint safe_byte_count= digest_storage->m_byte_count;
+
+ if (index + SIZE_OF_A_TOKEN <= safe_byte_count &&
+ safe_byte_count <= digest_storage->m_token_array_length)
+ {
+ const unsigned char *src= & digest_storage->m_token_array[index];
+ *tok= src[0] | (src[1] << 8);
+ return index + SIZE_OF_A_TOKEN;
+ }
+
+ /* The input byte stream is exhausted. */
+ *tok= 0;
+ return MAX_DIGEST_STORAGE_SIZE + 1;
+}
+
+/**
+ Store a single token in token array.
+*/
+inline void store_token(sql_digest_storage* digest_storage, uint token)
+{
+ DBUG_ASSERT(digest_storage->m_byte_count <= digest_storage->m_token_array_length);
+
+ if (digest_storage->m_byte_count + SIZE_OF_A_TOKEN <= digest_storage->m_token_array_length)
+ {
+ unsigned char* dest= & digest_storage->m_token_array[digest_storage->m_byte_count];
+ dest[0]= token & 0xff;
+ dest[1]= (token >> 8) & 0xff;
+ digest_storage->m_byte_count+= SIZE_OF_A_TOKEN;
+ }
+ else
+ {
+ digest_storage->m_full= true;
+ }
+}
+
+/**
+ Read an identifier from token array.
+*/
+inline uint read_identifier(const sql_digest_storage* digest_storage,
+ uint index, char ** id_string, int *id_length)
+{
+ uint new_index;
+ uint safe_byte_count= digest_storage->m_byte_count;
+
+ DBUG_ASSERT(index <= safe_byte_count);
+ DBUG_ASSERT(safe_byte_count <= digest_storage->m_token_array_length);
+
+ /*
+ token + length + string are written in an atomic way,
+ so we do always expect a length + string here
+ */
+
+ uint bytes_needed= SIZE_OF_A_TOKEN;
+ /* If we can read token and identifier length */
+ if ((index + bytes_needed) <= safe_byte_count)
+ {
+ const unsigned char *src= & digest_storage->m_token_array[index];
+ /* Read the length of identifier */
+ uint length= src[0] | (src[1] << 8);
+ bytes_needed+= length;
+ /* If we can read entire identifier from token array */
+ if ((index + bytes_needed) <= safe_byte_count)
+ {
+ *id_string= (char *) (src + 2);
+ *id_length= length;
+
+ new_index= index + bytes_needed;
+ DBUG_ASSERT(new_index <= safe_byte_count);
+ return new_index;
+ }
+ }
+
+ /* The input byte stream is exhausted. */
+ return MAX_DIGEST_STORAGE_SIZE + 1;
+}
+
+/**
+ Store an identifier in token array.
+*/
+inline void store_token_identifier(sql_digest_storage* digest_storage,
+ uint token,
+ size_t id_length, const char *id_name)
+{
+ DBUG_ASSERT(digest_storage->m_byte_count <= digest_storage->m_token_array_length);
+
+ size_t bytes_needed= 2 * SIZE_OF_A_TOKEN + id_length;
+ if (digest_storage->m_byte_count + bytes_needed <= (unsigned int)digest_storage->m_token_array_length)
+ {
+ unsigned char* dest= & digest_storage->m_token_array[digest_storage->m_byte_count];
+ /* Write the token */
+ dest[0]= token & 0xff;
+ dest[1]= (token >> 8) & 0xff;
+ /* Write the string length */
+ dest[2]= id_length & 0xff;
+ dest[3]= (id_length >> 8) & 0xff;
+ /* Write the string data */
+ if (id_length > 0)
+ memcpy((char *)(dest + 4), id_name, id_length);
+ digest_storage->m_byte_count+= bytes_needed;
+ }
+ else
+ {
+ digest_storage->m_full= true;
+ }
+}
+
+void compute_digest_md5(const sql_digest_storage *digest_storage, unsigned char *md5)
+{
+ compute_md5_hash((char *) md5,
+ (const char *) digest_storage->m_token_array,
+ digest_storage->m_byte_count);
+}
+
+/*
+ Iterate token array and updates digest_text.
+*/
+void compute_digest_text(const sql_digest_storage* digest_storage,
+ String *digest_text)
+{
+ DBUG_ASSERT(digest_storage != NULL);
+ uint byte_count= digest_storage->m_byte_count;
+ String *digest_output= digest_text;
+ uint tok= 0;
+ uint current_byte= 0;
+ lex_token_string *tok_data;
+
+ /* Reset existing data */
+ digest_output->length(0);
+
+ if (byte_count > digest_storage->m_token_array_length)
+ {
+ digest_output->append("\0", 1);
+ return;
+ }
+
+ /* Convert text to utf8 */
+ const CHARSET_INFO *from_cs= get_charset(digest_storage->m_charset_number, MYF(0));
+ const CHARSET_INFO *to_cs= &my_charset_utf8_bin;
+
+ if (from_cs == NULL)
+ {
+ /*
+ Can happen, as we do dirty reads on digest_storage,
+ which can be written to in another thread.
+ */
+ digest_output->append("\0", 1);
+ return;
+ }
+
+ char id_buffer[NAME_LEN + 1]= {'\0'};
+ char *id_string;
+ size_t id_length;
+ bool convert_text= !my_charset_same(from_cs, to_cs);
+
+ while (current_byte < byte_count)
+ {
+ current_byte= read_token(digest_storage, current_byte, &tok);
+
+ if (tok <= 0 || tok >= array_elements(lex_token_array)
+ || current_byte > max_digest_length)
+ return;
+
+ tok_data= &lex_token_array[tok];
+
+ switch (tok)
+ {
+ /* All identifiers are printed with their name. */
+ case IDENT:
+ case IDENT_QUOTED:
+ {
+ char *id_ptr= NULL;
+ int id_len= 0;
+ uint err_cs= 0;
+
+ /* Get the next identifier from the storage buffer. */
+ current_byte= read_identifier(digest_storage, current_byte,
+ &id_ptr, &id_len);
+ if (current_byte > max_digest_length)
+ return;
+
+ if (convert_text)
+ {
+ /* Verify that the converted text will fit. */
+ if (to_cs->mbmaxlen*id_len > NAME_LEN)
+ {
+ digest_output->append("...", 3);
+ break;
+ }
+ /* Convert identifier string into the storage character set. */
+ id_length= my_convert(id_buffer, NAME_LEN, to_cs,
+ id_ptr, id_len, from_cs, &err_cs);
+ id_string= id_buffer;
+ }
+ else
+ {
+ id_string= id_ptr;
+ id_length= id_len;
+ }
+
+ if (id_length == 0 || err_cs != 0)
+ {
+ break;
+ }
+ /* Copy the converted identifier into the digest string. */
+ if (tok == IDENT_QUOTED)
+ digest_output->append("`", 1);
+ if (id_length > 0)
+ digest_output->append(id_string, id_length);
+ if (tok == IDENT_QUOTED)
+ digest_output->append("`", 1);
+ digest_output->append(" ", 1);
+ }
+ break;
+
+ /* Everything else is printed as is. */
+ default:
+ /*
+ Make sure not to overflow digest_text buffer.
+ +1 is to make sure extra space for ' '.
+ */
+ int tok_length= tok_data->m_token_length;
+
+ digest_output->append(tok_data->m_token_string, tok_length);
+ if (tok_data->m_append_space)
+ digest_output->append(" ", 1);
+ break;
+ }
+ }
+}
+
+static inline uint peek_token(const sql_digest_storage *digest, uint index)
+{
+ uint token;
+ DBUG_ASSERT(index + SIZE_OF_A_TOKEN <= digest->m_byte_count);
+ DBUG_ASSERT(digest->m_byte_count <= digest->m_token_array_length);
+
+ token= ((digest->m_token_array[index + 1])<<8) | digest->m_token_array[index];
+ return token;
+}
+
+/**
+ Function to read last two tokens from token array. If an identifier
+ is found, do not look for token before that.
+*/
+static inline void peek_last_two_tokens(const sql_digest_storage* digest_storage,
+ uint last_id_index, uint *t1, uint *t2)
+{
+ uint byte_count= digest_storage->m_byte_count;
+ uint peek_index= byte_count;
+
+ if (last_id_index + SIZE_OF_A_TOKEN <= peek_index)
+ {
+ /* Take last token. */
+ peek_index-= SIZE_OF_A_TOKEN;
+ *t1= peek_token(digest_storage, peek_index);
+
+ if (last_id_index + SIZE_OF_A_TOKEN <= peek_index)
+ {
+ /* Take 2nd token from last. */
+ peek_index-= SIZE_OF_A_TOKEN;
+ *t2= peek_token(digest_storage, peek_index);
+ }
+ else
+ {
+ *t2= TOK_UNUSED;
+ }
+ }
+ else
+ {
+ *t1= TOK_UNUSED;
+ *t2= TOK_UNUSED;
+ }
+}
+
+/**
+ Function to read last three tokens from token array. If an identifier
+ is found, do not look for token before that.
+*/
+static inline void peek_last_three_tokens(const sql_digest_storage* digest_storage,
+ uint last_id_index, uint *t1, uint *t2, uint *t3)
+{
+ uint byte_count= digest_storage->m_byte_count;
+ uint peek_index= byte_count;
+
+ if (last_id_index + SIZE_OF_A_TOKEN <= peek_index)
+ {
+ /* Take last token. */
+ peek_index-= SIZE_OF_A_TOKEN;
+ *t1= peek_token(digest_storage, peek_index);
+
+ if (last_id_index + SIZE_OF_A_TOKEN <= peek_index)
+ {
+ /* Take 2nd token from last. */
+ peek_index-= SIZE_OF_A_TOKEN;
+ *t2= peek_token(digest_storage, peek_index);
+
+ if (last_id_index + SIZE_OF_A_TOKEN <= peek_index)
+ {
+ /* Take 3rd token from last. */
+ peek_index-= SIZE_OF_A_TOKEN;
+ *t3= peek_token(digest_storage, peek_index);
+ }
+ else
+ {
+ *t3= TOK_UNUSED;
+ }
+ }
+ else
+ {
+ *t2= TOK_UNUSED;
+ *t3= TOK_UNUSED;
+ }
+ }
+ else
+ {
+ *t1= TOK_UNUSED;
+ *t2= TOK_UNUSED;
+ *t3= TOK_UNUSED;
+ }
+}
+
+sql_digest_state* digest_add_token(sql_digest_state *state,
+ uint token,
+ LEX_YYSTYPE yylval)
+{
+ sql_digest_storage *digest_storage= NULL;
+
+ digest_storage= &state->m_digest_storage;
+
+ /*
+ Stop collecting further tokens if digest storage is full or
+ if END token is received.
+ */
+ if (digest_storage->m_full || token == END_OF_INPUT)
+ return NULL;
+
+ /*
+ Take last_token 2 tokens collected till now. These tokens will be used
+ in reduce for normalisation. Make sure not to consider ID tokens in reduce.
+ */
+ uint last_token;
+ uint last_token2;
+
+ switch (token)
+ {
+ case NUM:
+ case LONG_NUM:
+ case ULONGLONG_NUM:
+ case DECIMAL_NUM:
+ case FLOAT_NUM:
+ case BIN_NUM:
+ case HEX_NUM:
+ {
+ bool found_unary;
+ do
+ {
+ found_unary= false;
+ peek_last_two_tokens(digest_storage, state->m_last_id_index,
+ &last_token, &last_token2);
+
+ if ((last_token == '-') || (last_token == '+'))
+ {
+ /*
+ We need to differentiate:
+ - a <unary minus> operator
+ - a <unary plus> operator
+ from
+ - a <binary minus> operator
+ - a <binary plus> operator
+ to only reduce "a = -1" to "a = ?", and not change "b - 1" to "b ?"
+
+ Binary operators are found inside an expression,
+ while unary operators are found at the beginning of an expression, or after operators.
+
+ To achieve this, every token that is followed by an <expr> expression
+ in the SQL grammar is flagged.
+ See sql/sql_yacc.yy
+ See sql/gen_lex_token.cc
+
+ For example,
+ "(-1)" is parsed as "(", "-", NUM, ")", and lex_token_array["("].m_start_expr is true,
+ so reduction of the "-" NUM is done, the result is "(?)".
+ "(a-1)" is parsed as "(", ID, "-", NUM, ")", and lex_token_array[ID].m_start_expr is false,
+ so the operator is binary, no reduction is done, and the result is "(a-?)".
+ */
+ if (lex_token_array[last_token2].m_start_expr)
+ {
+ /*
+ REDUCE:
+ TOK_GENERIC_VALUE := (UNARY_PLUS | UNARY_MINUS) (NUM | LOG_NUM | ... | FLOAT_NUM)
+
+ REDUCE:
+ TOK_GENERIC_VALUE := (UNARY_PLUS | UNARY_MINUS) TOK_GENERIC_VALUE
+ */
+ token= TOK_GENERIC_VALUE;
+ digest_storage->m_byte_count-= SIZE_OF_A_TOKEN;
+ found_unary= true;
+ }
+ }
+ } while (found_unary);
+ }
+ /* fall through, for case NULL_SYM below */
+ case LEX_HOSTNAME:
+ case TEXT_STRING:
+ case NCHAR_STRING:
+ case PARAM_MARKER:
+ {
+ /*
+ REDUCE:
+ TOK_GENERIC_VALUE := BIN_NUM | DECIMAL_NUM | ... | ULONGLONG_NUM
+ */
+ token= TOK_GENERIC_VALUE;
+
+ peek_last_two_tokens(digest_storage, state->m_last_id_index,
+ &last_token, &last_token2);
+
+ if ((last_token2 == TOK_GENERIC_VALUE ||
+ last_token2 == TOK_GENERIC_VALUE_LIST) &&
+ (last_token == ','))
+ {
+ /*
+ REDUCE:
+ TOK_GENERIC_VALUE_LIST :=
+ TOK_GENERIC_VALUE ',' TOK_GENERIC_VALUE
+
+ REDUCE:
+ TOK_GENERIC_VALUE_LIST :=
+ TOK_GENERIC_VALUE_LIST ',' TOK_GENERIC_VALUE
+ */
+ digest_storage->m_byte_count-= 2*SIZE_OF_A_TOKEN;
+ token= TOK_GENERIC_VALUE_LIST;
+ }
+ /*
+ Add this token or the resulting reduce to digest storage.
+ */
+ store_token(digest_storage, token);
+ break;
+ }
+ case ')':
+ {
+ peek_last_two_tokens(digest_storage, state->m_last_id_index,
+ &last_token, &last_token2);
+
+ if (last_token == TOK_GENERIC_VALUE &&
+ last_token2 == '(')
+ {
+ /*
+ REDUCE:
+ TOK_ROW_SINGLE_VALUE :=
+ '(' TOK_GENERIC_VALUE ')'
+ */
+ digest_storage->m_byte_count-= 2*SIZE_OF_A_TOKEN;
+ token= TOK_ROW_SINGLE_VALUE;
+
+ /* Read last two tokens again */
+ peek_last_two_tokens(digest_storage, state->m_last_id_index,
+ &last_token, &last_token2);
+
+ if ((last_token2 == TOK_ROW_SINGLE_VALUE ||
+ last_token2 == TOK_ROW_SINGLE_VALUE_LIST) &&
+ (last_token == ','))
+ {
+ /*
+ REDUCE:
+ TOK_ROW_SINGLE_VALUE_LIST :=
+ TOK_ROW_SINGLE_VALUE ',' TOK_ROW_SINGLE_VALUE
+
+ REDUCE:
+ TOK_ROW_SINGLE_VALUE_LIST :=
+ TOK_ROW_SINGLE_VALUE_LIST ',' TOK_ROW_SINGLE_VALUE
+ */
+ digest_storage->m_byte_count-= 2*SIZE_OF_A_TOKEN;
+ token= TOK_ROW_SINGLE_VALUE_LIST;
+ }
+ }
+ else if (last_token == TOK_GENERIC_VALUE_LIST &&
+ last_token2 == '(')
+ {
+ /*
+ REDUCE:
+ TOK_ROW_MULTIPLE_VALUE :=
+ '(' TOK_GENERIC_VALUE_LIST ')'
+ */
+ digest_storage->m_byte_count-= 2*SIZE_OF_A_TOKEN;
+ token= TOK_ROW_MULTIPLE_VALUE;
+
+ /* Read last two tokens again */
+ peek_last_two_tokens(digest_storage, state->m_last_id_index,
+ &last_token, &last_token2);
+
+ if ((last_token2 == TOK_ROW_MULTIPLE_VALUE ||
+ last_token2 == TOK_ROW_MULTIPLE_VALUE_LIST) &&
+ (last_token == ','))
+ {
+ /*
+ REDUCE:
+ TOK_ROW_MULTIPLE_VALUE_LIST :=
+ TOK_ROW_MULTIPLE_VALUE ',' TOK_ROW_MULTIPLE_VALUE
+
+ REDUCE:
+ TOK_ROW_MULTIPLE_VALUE_LIST :=
+ TOK_ROW_MULTIPLE_VALUE_LIST ',' TOK_ROW_MULTIPLE_VALUE
+ */
+ digest_storage->m_byte_count-= 2*SIZE_OF_A_TOKEN;
+ token= TOK_ROW_MULTIPLE_VALUE_LIST;
+ }
+ }
+ /*
+ Add this token or the resulting reduce to digest storage.
+ */
+ store_token(digest_storage, token);
+ break;
+ }
+ case IDENT:
+ case IDENT_QUOTED:
+ {
+ YYSTYPE *lex_token= yylval;
+ char *yytext= lex_token->lex_str.str;
+ size_t yylen= lex_token->lex_str.length;
+
+ /* Add this token and identifier string to digest storage. */
+ store_token_identifier(digest_storage, token, yylen, yytext);
+
+ /* Update the index of last identifier found. */
+ state->m_last_id_index= digest_storage->m_byte_count;
+ break;
+ }
+ default:
+ {
+ /* Add this token to digest storage. */
+ store_token(digest_storage, token);
+ break;
+ }
+ }
+
+ return state;
+}
+
+sql_digest_state* digest_reduce_token(sql_digest_state *state,
+ uint token_left, uint token_right)
+{
+ sql_digest_storage *digest_storage= NULL;
+
+ digest_storage= &state->m_digest_storage;
+
+ /*
+ Stop collecting further tokens if digest storage is full.
+ */
+ if (digest_storage->m_full)
+ return NULL;
+
+ uint last_token;
+ uint last_token2;
+ uint last_token3;
+ uint token_to_push= TOK_UNUSED;
+
+ peek_last_two_tokens(digest_storage, state->m_last_id_index,
+ &last_token, &last_token2);
+
+ /*
+ There is only one caller of digest_reduce_token(),
+ see sql/sql_yacc.yy, rule literal := NULL_SYM.
+ REDUCE:
+ token_left := token_right
+ Used for:
+ TOK_GENERIC_VALUE := NULL_SYM
+ */
+
+ if (last_token == token_right)
+ {
+ /*
+ Current stream is like:
+ TOKEN_X TOKEN_RIGHT .
+ REDUCE to
+ TOKEN_X TOKEN_LEFT .
+ */
+ digest_storage->m_byte_count-= SIZE_OF_A_TOKEN;
+ store_token(digest_storage, token_left);
+ }
+ else
+ {
+ /*
+ Current stream is like:
+ TOKEN_X TOKEN_RIGHT TOKEN_Y .
+ Pop TOKEN_Y
+ TOKEN_X TOKEN_RIGHT . TOKEN_Y
+ REDUCE to
+ TOKEN_X TOKEN_LEFT . TOKEN_Y
+ */
+ DBUG_ASSERT(last_token2 == token_right);
+ digest_storage->m_byte_count-= 2 * SIZE_OF_A_TOKEN;
+ store_token(digest_storage, token_left);
+ token_to_push= last_token;
+ }
+
+ peek_last_three_tokens(digest_storage, state->m_last_id_index,
+ &last_token, &last_token2, &last_token3);
+
+ if ((last_token3 == TOK_GENERIC_VALUE ||
+ last_token3 == TOK_GENERIC_VALUE_LIST) &&
+ (last_token2 == ',') &&
+ (last_token == TOK_GENERIC_VALUE))
+ {
+ /*
+ REDUCE:
+ TOK_GENERIC_VALUE_LIST :=
+ TOK_GENERIC_VALUE ',' TOK_GENERIC_VALUE
+
+ REDUCE:
+ TOK_GENERIC_VALUE_LIST :=
+ TOK_GENERIC_VALUE_LIST ',' TOK_GENERIC_VALUE
+ */
+ digest_storage->m_byte_count-= 3*SIZE_OF_A_TOKEN;
+ store_token(digest_storage, TOK_GENERIC_VALUE_LIST);
+ }
+
+ if (token_to_push != TOK_UNUSED)
+ {
+ /*
+ Push TOKEN_Y
+ */
+ store_token(digest_storage, token_to_push);
+ }
+
+ return state;
+}
+
diff --git a/sql/sql_digest.h b/sql/sql_digest.h
new file mode 100644
index 00000000000..ce159283d4d
--- /dev/null
+++ b/sql/sql_digest.h
@@ -0,0 +1,130 @@
+/* Copyright (c) 2008, 2015, 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; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
+
+#ifndef SQL_DIGEST_H
+#define SQL_DIGEST_H
+
+#include <string.h>
+class String;
+#include "my_md5.h"
+
+#define MAX_DIGEST_STORAGE_SIZE (1024*1024)
+
+/**
+ Structure to store token count/array for a statement
+ on which digest is to be calculated.
+*/
+struct sql_digest_storage
+{
+ bool m_full;
+ uint m_byte_count;
+ unsigned char m_md5[MD5_HASH_SIZE];
+ /** Character set number. */
+ uint m_charset_number;
+ /**
+ Token array.
+ Token array is an array of bytes to store tokens received during parsing.
+ Following is the way token array is formed.
+ ... &lt;non-id-token&gt; &lt;non-id-token&gt; &lt;id-token&gt; &lt;id_len&gt; &lt;id_text&gt; ...
+ For Example:
+ SELECT * FROM T1;
+ &lt;SELECT_TOKEN&gt; &lt;*&gt; &lt;FROM_TOKEN&gt; &lt;ID_TOKEN&gt; &lt;2&gt; &lt;T1&gt;
+ */
+ unsigned char *m_token_array;
+ /* Length of the token array to be considered for DIGEST_TEXT calculation. */
+ uint m_token_array_length;
+
+ sql_digest_storage()
+ {
+ reset(NULL, 0);
+ }
+
+ inline void reset(unsigned char *token_array, uint length)
+ {
+ m_token_array= token_array;
+ m_token_array_length= length;
+ reset();
+ }
+
+ inline void reset()
+ {
+ m_full= false;
+ m_byte_count= 0;
+ m_charset_number= 0;
+ if (m_token_array_length > 0)
+ {
+ memset(m_token_array, 0, m_token_array_length);
+ }
+ memset(m_md5, 0, MD5_HASH_SIZE);
+ }
+
+ inline bool is_empty()
+ {
+ return (m_byte_count == 0);
+ }
+
+ inline void copy(const sql_digest_storage *from)
+ {
+ /*
+ Keep in mind this is a dirty copy of something that may change,
+ as the thread producing the digest is executing concurrently,
+ without any lock enforced.
+ */
+ uint byte_count_copy= m_token_array_length < from->m_byte_count ?
+ m_token_array_length : from->m_byte_count;
+
+ if (byte_count_copy > 0)
+ {
+ m_full= from->m_full;
+ m_byte_count= byte_count_copy;
+ m_charset_number= from->m_charset_number;
+ memcpy(m_token_array, from->m_token_array, m_byte_count);
+ memcpy(m_md5, from->m_md5, MD5_HASH_SIZE);
+ }
+ else
+ {
+ m_full= false;
+ m_byte_count= 0;
+ m_charset_number= 0;
+ }
+ }
+};
+typedef struct sql_digest_storage sql_digest_storage;
+
+/**
+ Compute a digest hash.
+ @param digest_storage The digest
+ @param [out] md5 The computed digest hash. This parameter is a buffer of size @c MD5_HASH_SIZE.
+*/
+void compute_digest_md5(const sql_digest_storage *digest_storage, unsigned char *md5);
+
+/**
+ Compute a digest text.
+ A 'digest text' is a textual representation of a query,
+ where:
+ - comments are removed,
+ - non significant spaces are removed,
+ - literal values are replaced with a special '?' marker,
+ - lists of values are collapsed using a shorter notation
+ @param digest_storage The digest
+ @param [out] digest_text
+ @param digest_text_length Size of @c digest_text.
+ @param [out] truncated true if the text representation was truncated
+*/
+void compute_digest_text(const sql_digest_storage *digest_storage,
+ String *digest_text);
+
+#endif
+
diff --git a/sql/sql_digest_stream.h b/sql/sql_digest_stream.h
new file mode 100644
index 00000000000..55f7e2293c6
--- /dev/null
+++ b/sql/sql_digest_stream.h
@@ -0,0 +1,51 @@
+/* Copyright (c) 2008, 2015, 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; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
+
+#ifndef SQL_DIGEST_STREAM_H
+#define SQL_DIGEST_STREAM_H
+
+#include "sql_digest.h"
+
+/**
+ State data storage for @c digest_start, @c digest_add_token.
+ This structure extends the @c sql_digest_storage structure
+ with temporary state used only during parsing.
+*/
+struct sql_digest_state
+{
+ /**
+ Index, in the digest token array, of the last identifier seen.
+ Reduce rules used in the digest computation can not
+ apply to tokens seen before an identifier.
+ @sa digest_add_token
+ */
+ int m_last_id_index;
+ sql_digest_storage m_digest_storage;
+
+ inline void reset(unsigned char *token_array, uint length)
+ {
+ m_last_id_index= 0;
+ m_digest_storage.reset(token_array, length);
+ }
+
+ inline bool is_empty()
+ {
+ return m_digest_storage.is_empty();
+ }
+};
+typedef struct sql_digest_state sql_digest_state;
+
+#endif
+
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 11f2d6b3dbc..1ec33a0a0ac 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -148,9 +148,11 @@ bool check_view_single_update(List<Item> &fields, List<Item> *values,
if (view->check_single_table(&tbl, tables, view) || tbl == 0)
goto error;
+ /* view->table should have been set in mysql_derived_merge_for_insert */
+ DBUG_ASSERT(view->table);
+
/*
- A buffer for the insert values was allocated for the merged view.
- Use it.
+ Use buffer for the insert values that was allocated for the merged view.
*/
tbl->table->insert_values= view->table->insert_values;
view->table= tbl->table;
@@ -195,11 +197,12 @@ static int check_insert_fields(THD *thd, TABLE_LIST *table_list,
table_map *map)
{
TABLE *table= table_list->table;
+ DBUG_ENTER("check_insert_fields");
if (!table_list->single_table_updatable())
{
my_error(ER_NON_INSERTABLE_TABLE, MYF(0), table_list->alias, "INSERT");
- return -1;
+ DBUG_RETURN(-1);
}
if (fields.elements == 0 && values.elements != 0)
@@ -208,18 +211,18 @@ static int check_insert_fields(THD *thd, TABLE_LIST *table_list,
{
my_error(ER_VIEW_NO_INSERT_FIELD_LIST, MYF(0),
table_list->view_db.str, table_list->view_name.str);
- return -1;
+ DBUG_RETURN(-1);
}
if (values.elements != table->s->fields)
{
my_error(ER_WRONG_VALUE_COUNT_ON_ROW, MYF(0), 1L);
- return -1;
+ DBUG_RETURN(-1);
}
#ifndef NO_EMBEDDED_ACCESS_CHECKS
Field_iterator_table_ref field_it;
field_it.set(table_list);
if (check_grant_all_columns(thd, INSERT_ACL, &field_it))
- return -1;
+ DBUG_RETURN(-1);
#endif
/*
No fields are provided so all fields must be provided in the values.
@@ -237,7 +240,7 @@ static int check_insert_fields(THD *thd, TABLE_LIST *table_list,
if (fields.elements != values.elements)
{
my_error(ER_WRONG_VALUE_COUNT_ON_ROW, MYF(0), 1L);
- return -1;
+ DBUG_RETURN(-1);
}
thd->dup_field= 0;
@@ -263,7 +266,7 @@ static int check_insert_fields(THD *thd, TABLE_LIST *table_list,
thd->lex->select_lex.no_wrap_view_item= FALSE;
if (res)
- return -1;
+ DBUG_RETURN(-1);
if (table_list->is_view() && table_list->is_merged_derived())
{
@@ -271,14 +274,14 @@ static int check_insert_fields(THD *thd, TABLE_LIST *table_list,
fields_and_values_from_different_maps ?
(List<Item>*) 0 : &values,
table_list, map, true))
- return -1;
+ DBUG_RETURN(-1);
table= table_list->table;
}
if (check_unique && thd->dup_field)
{
my_error(ER_FIELD_SPECIFIED_TWICE, MYF(0), thd->dup_field->field_name);
- return -1;
+ DBUG_RETURN(-1);
}
if (table->default_field)
table->mark_default_fields_for_write();
@@ -296,10 +299,10 @@ static int check_insert_fields(THD *thd, TABLE_LIST *table_list,
check_view_insertability(thd, table_list)))
{
my_error(ER_NON_INSERTABLE_TABLE, MYF(0), table_list->alias, "INSERT");
- return -1;
+ DBUG_RETURN(-1);
}
- return 0;
+ DBUG_RETURN(0);
}
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 697988a6bf8..2026d5f5059 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2014, Oracle and/or its affiliates.
- Copyright (c) 2009, 2014, Monty Program Ab.
+ Copyright (c) 2009, 2015, MariaDB
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
@@ -436,6 +436,21 @@ void Lex_input_stream::body_utf8_append_literal(THD *thd,
m_cpp_utf8_processed_ptr= end_ptr;
}
+void Lex_input_stream::add_digest_token(uint token, LEX_YYSTYPE yylval)
+{
+ if (m_digest != NULL)
+ {
+ m_digest= digest_add_token(m_digest, token, yylval);
+ }
+}
+
+void Lex_input_stream::reduce_digest_token(uint token_left, uint token_right)
+{
+ if (m_digest != NULL)
+ {
+ m_digest= digest_reduce_token(m_digest, token_left, token_right);
+ }
+}
/*
This is called before every query that is to be parsed.
@@ -541,6 +556,7 @@ void lex_start(THD *thd)
lex->is_lex_started= TRUE;
lex->used_tables= 0;
+ lex->only_view= FALSE;
lex->reset_slave_info.all= false;
lex->limit_rows_examined= 0;
lex->limit_rows_examined_cnt= ULONGLONG_MAX;
@@ -982,7 +998,7 @@ int MYSQLlex(YYSTYPE *yylval, THD *thd)
lip->lookahead_token= -1;
*yylval= *(lip->lookahead_yylval);
lip->lookahead_yylval= NULL;
- lip->m_digest_psi= MYSQL_ADD_TOKEN(lip->m_digest_psi, token, yylval);
+ lip->add_digest_token(token, yylval);
return token;
}
@@ -1000,12 +1016,10 @@ int MYSQLlex(YYSTYPE *yylval, THD *thd)
token= lex_one_token(yylval, thd);
switch(token) {
case CUBE_SYM:
- lip->m_digest_psi= MYSQL_ADD_TOKEN(lip->m_digest_psi, WITH_CUBE_SYM,
- yylval);
+ lip->add_digest_token(WITH_CUBE_SYM, yylval);
return WITH_CUBE_SYM;
case ROLLUP_SYM:
- lip->m_digest_psi= MYSQL_ADD_TOKEN(lip->m_digest_psi, WITH_ROLLUP_SYM,
- yylval);
+ lip->add_digest_token(WITH_ROLLUP_SYM, yylval);
return WITH_ROLLUP_SYM;
default:
/*
@@ -1014,7 +1028,7 @@ int MYSQLlex(YYSTYPE *yylval, THD *thd)
lip->lookahead_yylval= lip->yylval;
lip->yylval= NULL;
lip->lookahead_token= token;
- lip->m_digest_psi= MYSQL_ADD_TOKEN(lip->m_digest_psi, WITH, yylval);
+ lip->add_digest_token(WITH, yylval);
return WITH;
}
break;
@@ -1022,7 +1036,7 @@ int MYSQLlex(YYSTYPE *yylval, THD *thd)
break;
}
- lip->m_digest_psi= MYSQL_ADD_TOKEN(lip->m_digest_psi, token, yylval);
+ lip->add_digest_token(token, yylval);
return token;
}
@@ -1860,7 +1874,7 @@ void st_select_lex::init_query()
exclude_from_table_unique_test= no_wrap_view_item= FALSE;
nest_level= 0;
link_next= 0;
- is_prep_leaf_list_saved= FALSE;
+ prep_leaf_list_state= UNINIT;
have_merged_subqueries= FALSE;
bzero((char*) expr_cache_may_be_used, sizeof(expr_cache_may_be_used));
m_non_agg_field_used= false;
@@ -4113,27 +4127,58 @@ bool st_select_lex::save_leaf_tables(THD *thd)
}
-bool st_select_lex::save_prep_leaf_tables(THD *thd)
+bool LEX::save_prep_leaf_tables()
{
if (!thd->save_prep_leaf_list)
- return 0;
+ return FALSE;
Query_arena *arena= thd->stmt_arena, backup;
arena= thd->activate_stmt_arena_if_needed(&backup);
+ //It is used for DETETE/UPDATE so top level has only one SELECT
+ DBUG_ASSERT(select_lex.next_select() == NULL);
+ bool res= select_lex.save_prep_leaf_tables(thd);
+
+ if (arena)
+ thd->restore_active_arena(arena, &backup);
+
+ if (res)
+ return TRUE;
+
+ thd->save_prep_leaf_list= FALSE;
+ return FALSE;
+}
+
+bool st_select_lex::save_prep_leaf_tables(THD *thd)
+{
List_iterator_fast<TABLE_LIST> li(leaf_tables);
TABLE_LIST *table;
+
+ /*
+ Check that the SELECT_LEX was really prepared and so tables are setup.
+
+ It can be subquery in SET clause of UPDATE which was not prepared yet, so
+ its tables are not yet setup and ready for storing.
+ */
+ if (prep_leaf_list_state != READY)
+ return FALSE;
+
while ((table= li++))
{
if (leaf_tables_prep.push_back(table))
- return 1;
+ return TRUE;
+ }
+ prep_leaf_list_state= SAVED;
+ for (SELECT_LEX_UNIT *u= first_inner_unit(); u; u= u->next_unit())
+ {
+ for (SELECT_LEX *sl= u->first_select(); sl; sl= sl->next_select())
+ {
+ if (sl->save_prep_leaf_tables(thd))
+ return TRUE;
+ }
}
- thd->lex->select_lex.is_prep_leaf_list_saved= TRUE;
- thd->save_prep_leaf_list= FALSE;
- if (arena)
- thd->restore_active_arena(arena, &backup);
- return 0;
+ return FALSE;
}
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 88491743d39..dcd8ddfce91 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2014, Oracle and/or its affiliates.
- Copyright (c) 2010, 2014, Monty Program Ab.
+ Copyright (c) 2010, 2015, MariaDB
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,6 +47,7 @@ class sys_var;
class Item_func_match;
class File_parser;
class Key_part_spec;
+struct sql_digest_state;
#ifdef MYSQL_SERVER
/*
@@ -732,7 +733,8 @@ public:
List<TABLE_LIST> leaf_tables;
List<TABLE_LIST> leaf_tables_exec;
List<TABLE_LIST> leaf_tables_prep;
- bool is_prep_leaf_list_saved;
+ enum leaf_list_state {UNINIT, READY, SAVED};
+ enum leaf_list_state prep_leaf_list_state;
uint insert_tables;
st_select_lex *merged_into; /* select which this select is merged into */
/* (not 0 only for views/derived tables) */
@@ -2048,6 +2050,10 @@ public:
/** LALR(2) resolution, value of the look ahead token.*/
LEX_YYSTYPE lookahead_yylval;
+ void add_digest_token(uint token, LEX_YYSTYPE yylval);
+
+ void reduce_digest_token(uint token_left, uint token_right);
+
private:
/** Pointer to the current position in the raw input stream. */
char *m_ptr;
@@ -2167,7 +2173,7 @@ public:
/**
Current statement digest instrumentation.
*/
- PSI_digest_locker* m_digest_psi;
+ sql_digest_state* m_digest;
};
/**
@@ -2743,6 +2749,8 @@ struct LEX: public Query_tables_list
return FALSE;
}
+ bool save_prep_leaf_tables();
+
int print_explain(select_result_sink *output, uint8 explain_flags,
bool *printed_anything);
};
@@ -2861,6 +2869,18 @@ public:
};
/**
+ Input parameters to the parser.
+*/
+struct Parser_input
+{
+ bool m_compute_digest;
+
+ Parser_input()
+ : m_compute_digest(false)
+ {}
+};
+
+/**
Internal state of the parser.
The complete state consist of:
- state data used during lexical parsing,
@@ -2887,9 +2907,15 @@ public:
~Parser_state()
{}
+ Parser_input m_input;
Lex_input_stream m_lip;
Yacc_state m_yacc;
+ /**
+ Current performance digest instrumentation.
+ */
+ PSI_digest_locker* m_digest_psi;
+
void reset(char *found_semicolon, unsigned int length)
{
m_lip.reset(found_semicolon, length);
@@ -2897,6 +2923,11 @@ public:
}
};
+extern sql_digest_state *
+digest_add_token(sql_digest_state *state, uint token, LEX_YYSTYPE yylval);
+
+extern sql_digest_state *
+digest_reduce_token(sql_digest_state *state, uint token_left, uint token_right);
struct st_lex_local: public LEX
{
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 96e7bbc822e..5635e9ad4b7 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -83,6 +83,8 @@
#include "rpl_handler.h"
#include "rpl_mi.h"
+#include "sql_digest.h"
+
#include "sp_head.h"
#include "sp.h"
#include "sp_cache.h"
@@ -949,6 +951,7 @@ bool do_command(THD *thd)
/* Mark the statement completed. */
MYSQL_END_STATEMENT(thd->m_statement_psi, thd->get_stmt_da());
thd->m_statement_psi= NULL;
+ thd->m_digest= NULL;
if (net->error != 3)
{
@@ -998,6 +1001,7 @@ bool do_command(THD *thd)
out:
/* The statement instrumentation must be closed in all cases. */
+ DBUG_ASSERT(thd->m_digest == NULL);
DBUG_ASSERT(thd->m_statement_psi == NULL);
DBUG_RETURN(return_value);
}
@@ -1278,6 +1282,10 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
}
case COM_QUERY:
{
+ DBUG_ASSERT(thd->m_digest == NULL);
+ thd->m_digest= & thd->m_digest_state;
+ thd->m_digest->reset(thd->m_token_array, max_digest_length);
+
if (alloc_query(thd, packet, packet_length))
break; // fatal error is set
MYSQL_QUERY_START(thd->query(), thd->thread_id,
@@ -1337,6 +1345,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
/* PSI end */
MYSQL_END_STATEMENT(thd->m_statement_psi, thd->get_stmt_da());
thd->m_statement_psi= NULL;
+ thd->m_digest= NULL;
/* DTRACE end */
if (MYSQL_QUERY_DONE_ENABLED())
@@ -1357,6 +1366,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
(char *) thd->security_ctx->host_or_ip);
/* PSI begin */
+ thd->m_digest= & thd->m_digest_state;
+
thd->m_statement_psi= MYSQL_START_STATEMENT(&thd->m_statement_state,
com_statement_info[command].m_key,
thd->db, thd->db_length,
@@ -1741,6 +1752,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
/* Performance Schema Interface instrumentation, end */
MYSQL_END_STATEMENT(thd->m_statement_psi, thd->get_stmt_da());
thd->m_statement_psi= NULL;
+ thd->m_digest= NULL;
thd->set_time();
dec_thread_running();
@@ -2283,11 +2295,15 @@ mysql_execute_command(THD *thd)
according to slave filtering rules.
Returning success without producing any errors in this case.
*/
- DBUG_RETURN(0);
+ if (!thd->lex->check_exists)
+ DBUG_RETURN(0);
+ /*
+ DROP TRIGGER IF NOT EXISTS will return without an error later
+ after possibly writing the query to a binlog
+ */
}
-
- // force searching in slave.cc:tables_ok()
- all_tables->updating= 1;
+ else // force searching in slave.cc:tables_ok()
+ all_tables->updating= 1;
}
/*
@@ -8547,11 +8563,27 @@ bool parse_sql(THD *thd, Parser_state *parser_state,
thd->m_parser_state= parser_state;
-#ifdef HAVE_PSI_STATEMENT_DIGEST_INTERFACE
- /* Start Digest */
- thd->m_parser_state->m_lip.m_digest_psi=
- MYSQL_DIGEST_START(do_pfs_digest ? thd->m_statement_psi : NULL);
-#endif
+ parser_state->m_digest_psi= NULL;
+ parser_state->m_lip.m_digest= NULL;
+
+ if (do_pfs_digest)
+ {
+ /* Start Digest */
+ parser_state->m_digest_psi= MYSQL_DIGEST_START(thd->m_statement_psi);
+
+ if (parser_state->m_input.m_compute_digest ||
+ (parser_state->m_digest_psi != NULL))
+ {
+ /*
+ If either:
+ - the caller wants to compute a digest
+ - the performance schema wants to compute a digest
+ set the digest listener in the lexer.
+ */
+ parser_state->m_lip.m_digest= thd->m_digest;
+ parser_state->m_lip.m_digest->m_digest_storage.m_charset_number= thd->charset()->number;
+ }
+ }
/* Parse the query. */
@@ -8584,6 +8616,18 @@ bool parse_sql(THD *thd, Parser_state *parser_state,
/* That's it. */
ret_value= mysql_parse_status || thd->is_fatal_error;
+
+ if ((ret_value == 0) && (parser_state->m_digest_psi != NULL))
+ {
+ /*
+ On parsing success, record the digest in the performance schema.
+ */
+ DBUG_ASSERT(do_pfs_digest);
+ DBUG_ASSERT(thd->m_digest != NULL);
+ MYSQL_DIGEST_END(parser_state->m_digest_psi,
+ & thd->m_digest->m_digest_storage);
+ }
+
MYSQL_QUERY_PARSE_DONE(ret_value);
DBUG_RETURN(ret_value);
}
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index 239d793c633..f0fde223984 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -57,7 +57,6 @@
#include "lock.h" // mysql_lock_remove
#include "sql_show.h" // append_identifier
#include <m_ctype.h>
-#include "my_md5.h"
#include "transaction.h"
#include "debug_sync.h"
diff --git a/sql/sql_partition_admin.cc b/sql/sql_partition_admin.cc
index 8c59febeb77..87803c220ea 100644
--- a/sql/sql_partition_admin.cc
+++ b/sql/sql_partition_admin.cc
@@ -824,9 +824,16 @@ bool Sql_cmd_alter_table_truncate_partition::execute(THD *thd)
log. The exception is a unimplemented truncate method or failure
before any call to handler::truncate() is done.
Also, it is logged in statement format, regardless of the binlog format.
+
+ Since we've changed data within the table, we also have to invalidate
+ the query cache for it.
*/
- if (error != HA_ERR_WRONG_COMMAND && binlog_stmt)
- error|= write_bin_log(thd, !error, thd->query(), thd->query_length());
+ if (error != HA_ERR_WRONG_COMMAND)
+ {
+ query_cache_invalidate3(thd, first_table, FALSE);
+ if (binlog_stmt)
+ error|= write_bin_log(thd, !error, thd->query(), thd->query_length());
+ }
/*
A locked table ticket was upgraded to a exclusive lock. After the
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index 4227641859d..dc408703da4 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -264,13 +264,14 @@ public:
{ TRASH(ptr_arg, size); }
sys_var_pluginvar(sys_var_chain *chain, const char *name_arg,
- struct st_mysql_sys_var *plugin_var_arg)
+ struct st_mysql_sys_var *plugin_var_arg,
+ struct st_plugin_int *plugin_arg)
:sys_var(chain, name_arg, plugin_var_arg->comment,
(plugin_var_arg->flags & PLUGIN_VAR_THDLOCAL ? SESSION : GLOBAL) |
(plugin_var_arg->flags & PLUGIN_VAR_READONLY ? READONLY : 0),
0, -1, NO_ARG, pluginvar_show_type(plugin_var_arg), 0, 0,
VARIABLE_NOT_IN_BINLOG, NULL, NULL, NULL),
- plugin_var(plugin_var_arg)
+ plugin(plugin_arg), plugin_var(plugin_var_arg)
{ plugin_var->name= name_arg; }
sys_var_pluginvar *cast_pluginvar() { return this; }
bool check_update_type(Item_result type);
@@ -1413,22 +1414,6 @@ static int plugin_initialize(MEM_ROOT *tmp_root, struct st_plugin_int *plugin,
goto err;
}
- /*
- set the plugin attribute of plugin's sys vars so they are pointing
- to the active plugin
- */
- if (plugin->system_vars)
- {
- sys_var_pluginvar *var= plugin->system_vars->cast_pluginvar();
- for (;;)
- {
- var->plugin= plugin;
- if (!var->next)
- break;
- var= var->next->cast_pluginvar();
- }
- }
-
ret= 0;
err:
@@ -2085,14 +2070,8 @@ bool mysql_install_plugin(THD *thd, const LEX_STRING *name,
char **argv=orig_argv;
DBUG_ENTER("mysql_install_plugin");
- if (opt_noacl)
- {
- my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--skip-grant-tables");
- DBUG_RETURN(TRUE);
- }
-
tables.init_one_table("mysql", 5, "plugin", 6, "plugin", TL_WRITE);
- if (check_table_access(thd, INSERT_ACL, &tables, FALSE, 1, FALSE))
+ if (!opt_noacl && check_table_access(thd, INSERT_ACL, &tables, FALSE, 1, FALSE))
DBUG_RETURN(TRUE);
/* need to open before acquiring LOCK_plugin or it will deadlock */
@@ -2227,15 +2206,9 @@ bool mysql_uninstall_plugin(THD *thd, const LEX_STRING *name,
bool error= false;
DBUG_ENTER("mysql_uninstall_plugin");
- if (opt_noacl)
- {
- my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--skip-grant-tables");
- DBUG_RETURN(TRUE);
- }
-
tables.init_one_table("mysql", 5, "plugin", 6, "plugin", TL_WRITE);
- if (check_table_access(thd, DELETE_ACL, &tables, FALSE, 1, FALSE))
+ if (!opt_noacl && check_table_access(thd, DELETE_ACL, &tables, FALSE, 1, FALSE))
DBUG_RETURN(TRUE);
/* need to open before acquiring LOCK_plugin or it will deadlock */
@@ -3973,7 +3946,7 @@ static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp,
continue;
tmp_backup[tmp->nbackups++].save(&o->name);
if ((var= find_bookmark(plugin_name.str, o->name, o->flags)))
- v= new (mem_root) sys_var_pluginvar(&chain, var->key + 1, o);
+ v= new (mem_root) sys_var_pluginvar(&chain, var->key + 1, o, tmp);
else
{
len= plugin_name.length + strlen(o->name) + 2;
@@ -3981,7 +3954,7 @@ static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp,
strxmov(varname, plugin_name.str, "-", o->name, NullS);
my_casedn_str(&my_charset_latin1, varname);
convert_dash_to_underscore(varname, len-1);
- v= new (mem_root) sys_var_pluginvar(&chain, varname, o);
+ v= new (mem_root) sys_var_pluginvar(&chain, varname, o, tmp);
}
DBUG_ASSERT(v); /* check that an object was actually constructed */
} /* end for */
diff --git a/sql/sql_rename.cc b/sql/sql_rename.cc
index 2c17898f07c..6496e1895fb 100644
--- a/sql/sql_rename.cc
+++ b/sql/sql_rename.cc
@@ -238,7 +238,6 @@ do_rename(THD *thd, TABLE_LIST *ren_table, char *new_db, char *new_table_name,
{
int rc= 1;
handlerton *hton;
- bool new_exists, old_exists;
const char *new_alias, *old_alias;
DBUG_ENTER("do_rename");
@@ -254,17 +253,13 @@ do_rename(THD *thd, TABLE_LIST *ren_table, char *new_db, char *new_table_name,
}
DBUG_ASSERT(new_alias);
- new_exists= ha_table_exists(thd, new_db, new_alias);
-
- if (new_exists)
+ if (ha_table_exists(thd, new_db, new_alias))
{
my_error(ER_TABLE_EXISTS_ERROR, MYF(0), new_alias);
DBUG_RETURN(1); // This can't be skipped
}
- old_exists= ha_table_exists(thd, ren_table->db, old_alias, &hton);
-
- if (old_exists)
+ if (ha_table_exists(thd, ren_table->db, old_alias, &hton) && hton)
{
DBUG_ASSERT(!thd->locked_tables_mode);
tdc_remove_table(thd, TDC_RT_REMOVE_ALL,
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 68535938484..4055c8ea8af 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -943,7 +943,7 @@ give_error_start_pos_missing_in_binlog(int *err, const char **errormsg,
binlog_gtid.seq_no >= error_gtid->seq_no)
{
*errormsg= "Requested slave GTID state not found in binlog. The slave has "
- "probably diverged due to executing errorneous transactions";
+ "probably diverged due to executing erroneous transactions";
*err= ER_GTID_POSITION_NOT_FOUND_IN_BINLOG2;
}
else
@@ -1948,6 +1948,7 @@ void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos,
slave_connection_state until_gtid_state_obj;
rpl_gtid error_gtid;
binlog_send_info info(thd, packet, flags, log_file_name);
+ bool has_transmit_started= false;
int old_max_allowed_packet= thd->variables.max_allowed_packet;
@@ -2007,16 +2008,6 @@ void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos,
DBUG_SET("+d,corrupt_read_log_event2");
});
- if (global_system_variables.log_warnings > 1)
- sql_print_information("Start binlog_dump to slave_server(%lu), pos(%s, %lu)",
- thd->variables.server_id, log_ident, (ulong)pos);
- if (RUN_HOOK(binlog_transmit, transmit_start, (thd, flags, log_ident, pos)))
- {
- errmsg= "Failed to run hook 'transmit_start'";
- my_errno= ER_UNKNOWN_ERROR;
- goto err;
- }
-
#ifndef DBUG_OFF
if (opt_sporadic_binlog_dump_fail && (binlog_dump_count++ % 2))
{
@@ -2113,6 +2104,17 @@ impossible position";
goto err;
}
+ if (global_system_variables.log_warnings > 1)
+ sql_print_information("Start binlog_dump to slave_server(%lu), pos(%s, %lu)",
+ thd->variables.server_id, log_ident, (ulong)pos);
+ if (RUN_HOOK(binlog_transmit, transmit_start, (thd, flags, log_ident, pos)))
+ {
+ errmsg= "Failed to run hook 'transmit_start'";
+ my_errno= ER_UNKNOWN_ERROR;
+ goto err;
+ }
+ has_transmit_started= true;
+
/* reset transmit packet for the fake rotate event below */
if (reset_transmit_packet(thd, flags, &ev_offset, &errmsg))
goto err;
@@ -2375,6 +2377,31 @@ impossible position";
info.fdev= tmp;
(*packet)[FLAGS_OFFSET+ev_offset] &= ~LOG_EVENT_BINLOG_IN_USE_F;
+
+ if (info.using_gtid_state)
+ {
+ /*
+ If this event has the field `created' set, then it will cause the
+ slave to delete all active temporary tables. This must not happen
+ if the slave received any later GTIDs in a previous connect, as
+ those GTIDs might have created new temporary tables that are still
+ needed.
+
+ So here, we check if the starting GTID position was already
+ reached before this format description event. If not, we clear the
+ `created' flag to preserve temporary tables on the slave. (If the
+ slave connects at a position past this event, it means that it
+ already received and handled it in a previous connect).
+ */
+ if (!info.gtid_state.is_pos_reached())
+ {
+ int4store((char*) packet->ptr()+LOG_EVENT_MINIMAL_HEADER_LEN+
+ ST_CREATED_OFFSET+ev_offset, (ulong) 0);
+ if (info.current_checksum_alg != BINLOG_CHECKSUM_ALG_OFF &&
+ info.current_checksum_alg != BINLOG_CHECKSUM_ALG_UNDEF)
+ fix_checksum(packet, ev_offset);
+ }
+ }
}
#ifndef DBUG_OFF
@@ -2680,7 +2707,8 @@ end:
end_io_cache(&log);
mysql_file_close(file, MYF(MY_WME));
- RUN_HOOK(binlog_transmit, transmit_stop, (thd, flags));
+ if (has_transmit_started)
+ RUN_HOOK(binlog_transmit, transmit_stop, (thd, flags));
my_eof(thd);
THD_STAGE_INFO(thd, stage_waiting_to_finalize_termination);
mysql_mutex_lock(&LOCK_thread_count);
@@ -2723,7 +2751,7 @@ err:
"%u-%u-%llu, which is not in the master's binlog. Since the "
"master's binlog contains GTIDs with higher sequence numbers, "
"it probably means that the slave has diverged due to "
- "executing extra errorneous transactions",
+ "executing extra erroneous transactions",
error_gtid.domain_id, error_gtid.server_id, error_gtid.seq_no);
/* Use this error code so slave will know not to try reconnect. */
my_errno = ER_MASTER_FATAL_ERROR_READING_BINLOG;
@@ -2749,7 +2777,8 @@ err:
else
strcpy(error_text, errmsg);
end_io_cache(&log);
- RUN_HOOK(binlog_transmit, transmit_stop, (thd, flags));
+ if (has_transmit_started)
+ RUN_HOOK(binlog_transmit, transmit_stop, (thd, flags));
/*
Exclude iteration through thread list
this is needed for purge_logs() - it will iterate through
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index ed56191c32b..e0f560f0b3a 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -1,5 +1,5 @@
-/* Copyright (c) 2000, 2013 Oracle and/or its affiliates.
- Copyright (c) 2009, 2013 Monty Program Ab.
+/* Copyright (c) 2000, 2015 Oracle and/or its affiliates.
+ Copyright (c) 2009, 2015 MariaDB
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
@@ -709,9 +709,7 @@ JOIN::prepare(Item ***rref_pointer_array,
if (!(select_options & OPTION_SETUP_TABLES_DONE) &&
setup_tables_and_check_access(thd, &select_lex->context, join_list,
tables_list, select_lex->leaf_tables,
- FALSE, SELECT_ACL, SELECT_ACL,
- (thd->lex->sql_command ==
- SQLCOM_UPDATE_MULTI)))
+ FALSE, SELECT_ACL, SELECT_ACL, FALSE))
DBUG_RETURN(-1);
/*
@@ -4958,7 +4956,18 @@ add_key_part(DYNAMIC_ARRAY *keyuse_array, KEY_FIELD *key_field)
}
-#define FT_KEYPART (MAX_REF_PARTS+10)
+/*
+ A key part number that means we're using a fulltext scan.
+
+ In order not to confuse it with regular equalities, we need to pick
+ a number that's greater than MAX_REF_PARTS.
+
+ Hash Join code stores field->field_index in KEYUSE::keypart, so the
+ number needs to be bigger than MAX_FIELDS, also.
+
+ CAUTION: sql_test.cc has its own definition of FT_KEYPART.
+*/
+#define FT_KEYPART (MAX_FIELDS+10)
static bool
add_ft_keys(DYNAMIC_ARRAY *keyuse_array,
@@ -6455,7 +6464,6 @@ choose_plan(JOIN *join, table_map join_tables)
DBUG_ENTER("choose_plan");
join->cur_embedding_map= 0;
- join->cur_dups_producing_tables= 0;
reset_nj_counters(join, join->join_list);
qsort2_cmp jtab_sort_func;
@@ -7451,8 +7459,12 @@ double table_cond_selectivity(JOIN *join, uint idx, JOIN_TAB *s,
else
fldno= table->key_info[key].key_part[keyparts-1].fieldnr - 1;
if (keyuse->val->const_item())
- {
- sel /= table->field[fldno]->cond_selectivity;
+ {
+ if (table->field[fldno]->cond_selectivity > 0)
+ {
+ sel /= table->field[fldno]->cond_selectivity;
+ set_if_smaller(sel, 1.0);
+ }
/*
TODO: we could do better here:
1. cond_selectivity might be =1 (the default) because quick
@@ -7506,7 +7518,10 @@ double table_cond_selectivity(JOIN *join, uint idx, JOIN_TAB *s,
if (!(next_field->table->map & rem_tables) && next_field->table != table)
{
if (field->cond_selectivity > 0)
+ {
sel/= field->cond_selectivity;
+ set_if_smaller(sel, 1.0);
+ }
break;
}
}
@@ -8660,7 +8675,8 @@ static bool create_hj_key_for_table(JOIN *join, JOIN_TAB *join_tab,
{
Field *field= table->field[keyuse->keypart];
uint fieldnr= keyuse->keypart+1;
- table->create_key_part_by_field(keyinfo, key_part_info, field, fieldnr);
+ table->create_key_part_by_field(key_part_info, field, fieldnr);
+ keyinfo->key_length += key_part_info->store_length;
key_part_info++;
}
}
@@ -9720,10 +9736,24 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
if (!sel->quick_keys.is_subset(tab->checked_keys) ||
!sel->needed_reg.is_subset(tab->checked_keys))
{
+ /*
+ "Range checked for each record" is a "last resort" access method
+ that should only be used when the other option is a cross-product
+ join.
+
+ We use the following condition (it's approximate):
+ 1. There are potential keys for (sel->needed_reg)
+ 2. There were no possible ways to construct a quick select, or
+ the quick select would be more expensive than the full table
+ scan.
+ */
tab->use_quick= (!sel->needed_reg.is_clear_all() &&
(sel->quick_keys.is_clear_all() ||
- (sel->quick &&
- (sel->quick->records >= 100L)))) ?
+ (sel->quick &&
+ sel->quick->read_time >
+ tab->table->file->scan_time() +
+ tab->table->file->stats.records/TIME_FOR_COMPARE
+ ))) ?
2 : 1;
sel->read_tables= used_tables & ~current_map;
sel->quick_keys.clear_all();
@@ -15791,7 +15821,6 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
(int) distinct, (int) save_sum_fields,
(ulong) rows_limit, MY_TEST(group)));
- thd->inc_status_created_tmp_tables();
thd->query_plan_flags|= QPLAN_TMP_TABLE;
if (use_temp_pool && !(test_flags & TEST_KEEP_TMP_TABLES))
@@ -16745,14 +16774,19 @@ bool open_tmp_table(TABLE *table)
HA_OPEN_TMP_TABLE |
HA_OPEN_INTERNAL_TABLE)))
{
- table->file->print_error(error,MYF(0)); /* purecov: inspected */
- table->db_stat=0;
- return(1);
+ table->file->print_error(error, MYF(0)); /* purecov: inspected */
+ table->db_stat= 0;
+ return 1;
}
table->db_stat= HA_OPEN_KEYFILE+HA_OPEN_RNDFILE;
- (void) table->file->extra(HA_EXTRA_QUICK); /* Faster */
- table->created= TRUE;
- return(0);
+ (void) table->file->extra(HA_EXTRA_QUICK); /* Faster */
+ if (!table->created)
+ {
+ table->created= TRUE;
+ table->in_use->inc_status_created_tmp_tables();
+ }
+
+ return 0;
}
@@ -16809,7 +16843,7 @@ bool create_internal_tmp_table(TABLE *table, KEY *keyinfo,
goto err;
bzero(seg, sizeof(*seg) * keyinfo->user_defined_key_parts);
- if (keyinfo->key_length >= table->file->max_key_length() ||
+ if (keyinfo->key_length > table->file->max_key_length() ||
keyinfo->user_defined_key_parts > table->file->max_key_parts() ||
share->uniques)
{
@@ -16919,8 +16953,10 @@ bool create_internal_tmp_table(TABLE *table, KEY *keyinfo,
goto err;
}
table->in_use->inc_status_created_tmp_disk_tables();
+ table->in_use->inc_status_created_tmp_tables();
table->in_use->query_plan_flags|= QPLAN_TMP_DISK;
share->db_record_offset= 1;
+ table->created= TRUE;
DBUG_RETURN(0);
err:
DBUG_RETURN(1);
@@ -16980,7 +17016,7 @@ bool create_internal_tmp_table(TABLE *table, KEY *keyinfo,
goto err;
bzero(seg, sizeof(*seg) * keyinfo->user_defined_key_parts);
- if (keyinfo->key_length >= table->file->max_key_length() ||
+ if (keyinfo->key_length > table->file->max_key_length() ||
keyinfo->user_defined_key_parts > table->file->max_key_parts() ||
share->uniques)
{
@@ -17065,6 +17101,7 @@ bool create_internal_tmp_table(TABLE *table, KEY *keyinfo,
goto err;
}
table->in_use->inc_status_created_tmp_disk_tables();
+ table->in_use->inc_status_created_tmp_tables();
table->in_use->query_plan_flags|= QPLAN_TMP_DISK;
share->db_record_offset= 1;
table->created= TRUE;
@@ -21123,18 +21160,33 @@ SORT_FIELD *make_unireg_sortorder(ORDER *order, uint *length,
for (;order;order=order->next,pos++)
{
- Item *item= order->item[0]->real_item();
+ Item *const item= order->item[0], *const real_item= item->real_item();
pos->field= 0; pos->item= 0;
- if (item->type() == Item::FIELD_ITEM)
- pos->field= ((Item_field*) item)->field;
- else if (item->type() == Item::SUM_FUNC_ITEM && !item->const_item())
- pos->field= ((Item_sum*) item)->get_tmp_table_field();
- else if (item->type() == Item::COPY_STR_ITEM)
- { // Blob patch
- pos->item= ((Item_copy*) item)->get_item();
+ if (real_item->type() == Item::FIELD_ITEM)
+ {
+ // Could be a field, or Item_direct_view_ref wrapping a field
+ DBUG_ASSERT(item->type() == Item::FIELD_ITEM ||
+ (item->type() == Item::REF_ITEM &&
+ static_cast<Item_ref*>(item)->ref_type() ==
+ Item_ref::VIEW_REF));
+ pos->field= static_cast<Item_field*>(real_item)->field;
+ }
+ else if (real_item->type() == Item::SUM_FUNC_ITEM &&
+ !real_item->const_item())
+ {
+ // Aggregate, or Item_aggregate_ref
+ DBUG_ASSERT(item->type() == Item::SUM_FUNC_ITEM ||
+ (item->type() == Item::REF_ITEM &&
+ static_cast<Item_ref*>(item)->ref_type() ==
+ Item_ref::AGGREGATE_REF));
+ pos->field= item->get_tmp_table_field();
+ }
+ else if (real_item->type() == Item::COPY_STR_ITEM)
+ { // Blob patch
+ pos->item= static_cast<Item_copy*>(real_item)->get_item();
}
else
- pos->item= *order->item;
+ pos->item= item;
pos->reverse=! order->asc;
DBUG_ASSERT(pos->field != NULL || pos->item != NULL);
}
@@ -21378,6 +21430,17 @@ find_order_in_list(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
uint el= all_fields.elements;
all_fields.push_front(order_item); /* Add new field to field list. */
ref_pointer_array[el]= order_item;
+ /*
+ If the order_item is a SUM_FUNC_ITEM, when fix_fields is called
+ ref_by is set to order->item which is the address of order_item.
+ But this needs to be address of order_item in the all_fields list.
+ As a result, when it gets replaced with Item_aggregate_ref
+ object in Item::split_sum_func2, we will be able to retrieve the
+ newly created object.
+ */
+ if (order_item->type() == Item::SUM_FUNC_ITEM)
+ ((Item_sum *)order_item)->ref_by= all_fields.head_ref();
+
order->item= ref_pointer_array + el;
return FALSE;
}
diff --git a/sql/sql_select.h b/sql/sql_select.h
index 7d53731b558..5aa29715dc3 100644
--- a/sql/sql_select.h
+++ b/sql/sql_select.h
@@ -2,7 +2,7 @@
#define SQL_SELECT_INCLUDED
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
- Copyright (c) 2008, 2013, Monty Program Ab.
+ Copyright (c) 2008, 2015, MariaDB
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
@@ -825,7 +825,12 @@ typedef struct st_position :public Sql_alloc
*/
uint n_sj_tables;
- table_map prefix_dups_producing_tables;
+ /*
+ Bitmap of semi-join inner tables that are in the join prefix and for
+ which there's no provision for how to eliminate semi-join duplicates
+ they produce.
+ */
+ table_map dups_producing_tables;
table_map inner_tables_handled_with_other_sjs;
@@ -1046,13 +1051,6 @@ public:
*/
table_map cur_sj_inner_tables;
- /*
- Bitmap of semi-join inner tables that are in the join prefix and for
- which there's no provision for how to eliminate semi-join duplicates
- they produce.
- */
- table_map cur_dups_producing_tables;
-
/* We also maintain a stack of join optimization states in * join->positions[] */
/******* Join optimization state members end *******/
@@ -1788,10 +1786,6 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
bool table_cant_handle_bit_fields,
bool make_copy_field,
uint convert_blob_length);
-bool create_internal_tmp_table(TABLE *table, KEY *keyinfo,
- TMP_ENGINE_COLUMNDEF *start_recinfo,
- TMP_ENGINE_COLUMNDEF **recinfo,
- ulonglong options, my_bool big_tables);
/*
General routine to change field->ptr of a NULL-terminated array of Field
diff --git a/sql/sql_servers.cc b/sql/sql_servers.cc
index 2b0576ffba9..8d5bb2b596d 100644
--- a/sql/sql_servers.cc
+++ b/sql/sql_servers.cc
@@ -326,7 +326,8 @@ get_server_from_table_to_cache(TABLE *table)
table->use_all_columns();
/* get each field into the server struct ptr */
- server->server_name= get_field(&mem, table->field[0]);
+ ptr= get_field(&mem, table->field[0]);
+ server->server_name= ptr ? ptr : blank;
server->server_name_length= (uint) strlen(server->server_name);
ptr= get_field(&mem, table->field[1]);
server->host= ptr ? ptr : blank;
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 6dabd349214..2413cb5ba53 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -1,5 +1,5 @@
-/* Copyright (c) 2000, 2014, Oracle and/or its affiliates.
- Copyright (c) 2009, 2014, SkySQL Ab.
+/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
+ Copyright (c) 2009, 2015, MariaDB
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
@@ -2301,7 +2301,8 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
Security_context *tmp_sctx= tmp->security_ctx;
struct st_my_thread_var *mysys_var;
if ((tmp->vio_ok() || tmp->system_thread) &&
- (!user || (tmp_sctx->user && !strcmp(tmp_sctx->user, user))))
+ (!user || (!tmp->system_thread &&
+ tmp_sctx->user && !strcmp(tmp_sctx->user, user))))
{
thread_info *thd_info= new thread_info;
@@ -2679,7 +2680,8 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond)
ulonglong max_counter;
if ((!tmp->vio_ok() && !tmp->system_thread) ||
- (user && (!tmp_sctx->user || strcmp(tmp_sctx->user, user))))
+ (user && (tmp->system_thread || !tmp_sctx->user ||
+ strcmp(tmp_sctx->user, user))))
continue;
restore_record(table, s->default_values);
@@ -2895,7 +2897,7 @@ void reset_status_vars()
catch-all cleanup function, cleans up everything no matter what
DESCRIPTION
- This function is not strictly required if all add_to_status/
+ This function is not strictly required if all add_status_vars/
remove_status_vars are properly paired, but it's a safety measure that
deletes everything from the all_status_vars[] even if some
remove_status_vars were forgotten
@@ -8099,15 +8101,20 @@ bool get_schema_tables_result(JOIN *join,
TABLE_LIST *table_list= tab->table->pos_in_table_list;
if (table_list->schema_table && thd->fill_information_schema_tables())
{
+#if MYSQL_VERSION_ID > 100105
+#error I_S tables only need to be re-populated if make_cond_for_info_schema() will preserve outer fields
bool is_subselect= (&lex->unit != lex->current_select->master_unit() &&
lex->current_select->master_unit()->item);
+#else
+#define is_subselect false
+#endif
/* A value of 0 indicates a dummy implementation */
if (table_list->schema_table->fill_table == 0)
continue;
/* skip I_S optimizations specific to get_all_tables */
- if (thd->lex->describe &&
+ if (lex->describe &&
(table_list->schema_table->fill_table != get_all_tables))
continue;
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 48aac779215..20cfccaa3d9 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -1,6 +1,6 @@
/*
- Copyright (c) 2000, 2014, Oracle and/or its affiliates.
- Copyright (c) 2010, 2014, SkySQL Ab.
+ Copyright (c) 2000, 2015, Oracle and/or its affiliates.
+ Copyright (c) 2010, 2015, MariaDB
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
@@ -28,7 +28,6 @@
#include "sql_base.h" // open_table_uncached, lock_table_names
#include "lock.h" // mysql_unlock_tables
#include "strfunc.h" // find_type2, find_set
-#include "sql_view.h" // view_checksum
#include "sql_truncate.h" // regenerate_locked_table
#include "sql_partition.h" // mem_alloc_error,
// generate_partition_syntax,
@@ -1673,6 +1672,7 @@ void execute_ddl_log_recovery()
(void) mysql_file_delete(key_file_global_ddl_log, file_name, MYF(0));
global_ddl_log.recovery_phase= FALSE;
mysql_mutex_unlock(&LOCK_gdl);
+ thd->reset_query();
delete thd;
/* Remember that we don't have a THD */
set_current_thd(0);
@@ -2201,15 +2201,13 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
char path[FN_REFLEN + 1], wrong_tables_buff[160], *alias= NULL;
String wrong_tables(wrong_tables_buff, sizeof(wrong_tables_buff)-1,
system_charset_info);
- uint path_length= 0;
+ uint path_length= 0, errors= 0;
int error= 0;
int non_temp_tables_count= 0;
- bool foreign_key_error=0;
bool non_tmp_error= 0;
bool trans_tmp_table_deleted= 0, non_trans_tmp_table_deleted= 0;
bool non_tmp_table_deleted= 0;
bool is_drop_tmp_if_exists_added= 0;
- bool one_table= tables->next_local == 0;
bool was_view= 0;
String built_query;
String built_trans_tmp_query, built_non_trans_tmp_query;
@@ -2495,12 +2493,7 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
error= ha_delete_table(thd, table_type, path, db, table->table_name,
!dont_log_query);
- if (error == HA_ERR_ROW_IS_REFERENCED)
- {
- /* the table is referenced by a foreign key constraint */
- foreign_key_error= 1;
- }
- if (!error || error == ENOENT || error == HA_ERR_NO_SUCH_TABLE)
+ if (!error)
{
int frm_delete_error, trigger_drop_error= 0;
/* Delete the table definition file */
@@ -2518,11 +2511,8 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
if (trigger_drop_error ||
(frm_delete_error && frm_delete_error != ENOENT))
error= 1;
- else if (!frm_delete_error || !error || if_exists)
- {
- error= 0;
+ else if (frm_delete_error && if_exists)
thd->clear_error();
- }
}
non_tmp_error= error ? TRUE : non_tmp_error;
}
@@ -2533,6 +2523,7 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
wrong_tables.append(db);
wrong_tables.append('.');
wrong_tables.append(table->table_name);
+ errors++;
}
else
{
@@ -2556,14 +2547,13 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
err:
if (wrong_tables.length())
{
- if (one_table && was_view)
+ DBUG_ASSERT(errors);
+ if (errors == 1 && was_view)
my_printf_error(ER_IT_IS_A_VIEW, ER(ER_IT_IS_A_VIEW), MYF(0),
wrong_tables.c_ptr_safe());
- else if (!foreign_key_error)
+ else if (errors > 1 || !thd->is_error())
my_printf_error(ER_BAD_TABLE_ERROR, ER(ER_BAD_TABLE_ERROR), MYF(0),
wrong_tables.c_ptr_safe());
- else
- my_message(ER_ROW_IS_REFERENCED, ER(ER_ROW_IS_REFERENCED), MYF(0));
error= 1;
}
@@ -2614,8 +2604,8 @@ err:
/* Chop of the last comma */
built_query.chop();
built_query.append(" /* generated by server */");
- int error_code = (non_tmp_error ?
- (foreign_key_error ? ER_ROW_IS_REFERENCED : ER_BAD_TABLE_ERROR) : 0);
+ int error_code = non_tmp_error ? thd->get_stmt_da()->sql_errno()
+ : 0;
error |= thd->binlog_query(THD::STMT_QUERY_TYPE,
built_query.ptr(),
built_query.length(),
@@ -4687,7 +4677,9 @@ int create_table_impl(THD *thd,
if (create_info->tmp_table())
{
TABLE *tmp_table;
- if ((tmp_table= find_temporary_table(thd, db, table_name)))
+ if (find_and_use_temporary_table(thd, db, table_name, &tmp_table))
+ goto err;
+ if (tmp_table)
{
bool table_creation_was_logged= tmp_table->s->table_creation_was_logged;
if (create_info->options & HA_LEX_CREATE_REPLACE)
@@ -5148,6 +5140,7 @@ mysql_rename_table(handlerton *base, const char *old_db,
ulonglong save_bits= thd->variables.option_bits;
int length;
DBUG_ENTER("mysql_rename_table");
+ DBUG_ASSERT(base);
DBUG_PRINT("enter", ("old: '%s'.'%s' new: '%s'.'%s'",
old_db, old_name, new_db, new_name));
@@ -5155,8 +5148,7 @@ mysql_rename_table(handlerton *base, const char *old_db,
if (flags & NO_FK_CHECKS)
thd->variables.option_bits|= OPTION_NO_FOREIGN_KEY_CHECKS;
- file= (base == NULL ? 0 :
- get_new_handler((TABLE_SHARE*) 0, thd->mem_root, base));
+ file= get_new_handler((TABLE_SHARE*) 0, thd->mem_root, base);
build_table_filename(from, sizeof(from) - 1, old_db, old_name, "",
flags & FN_FROM_IS_TMP);
@@ -5477,7 +5469,7 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table,
if (!table->view)
{
int result __attribute__((unused))=
- show_create_table(thd, table, &query, create_info, WITHOUT_DB_NAME);
+ show_create_table(thd, table, &query, create_info, WITH_DB_NAME);
DBUG_ASSERT(result == 0); // show_create_table() always return 0
do_logging= FALSE;
@@ -5858,12 +5850,17 @@ drop_create_field:
/* let us check the name of the first key part. */
if ((keyname= key->name.str) == NULL)
{
- List_iterator<Key_part_spec> part_it(key->columns);
- Key_part_spec *kp;
- if ((kp= part_it++))
- keyname= kp->field_name.str;
- if (keyname == NULL)
- continue;
+ if (key->type == Key::PRIMARY)
+ keyname= primary_key_name;
+ else
+ {
+ List_iterator<Key_part_spec> part_it(key->columns);
+ Key_part_spec *kp;
+ if ((kp= part_it++))
+ keyname= kp->field_name.str;
+ if (keyname == NULL)
+ continue;
+ }
}
if (key->type != Key::FOREIGN_KEY)
{
@@ -8427,6 +8424,23 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
mysql_audit_alter_table(thd, table_list);
THD_STAGE_INFO(thd, stage_setup);
+
+ handle_if_exists_options(thd, table, alter_info);
+
+ /*
+ Look if we have to do anything at all.
+ ALTER can become NOOP after handling
+ the IF (NOT) EXISTS options.
+ */
+ if (alter_info->flags == 0)
+ {
+ my_snprintf(alter_ctx.tmp_name, sizeof(alter_ctx.tmp_name),
+ ER(ER_INSERT_INFO), 0L, 0L,
+ thd->get_stmt_da()->current_statement_warn_count());
+ my_ok(thd, 0L, 0L, alter_ctx.tmp_name);
+ DBUG_RETURN(false);
+ }
+
if (!(alter_info->flags & ~(Alter_info::ALTER_RENAME |
Alter_info::ALTER_KEYS_ONOFF)) &&
alter_info->requested_algorithm !=
@@ -8447,22 +8461,6 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
DBUG_RETURN(res);
}
- handle_if_exists_options(thd, table, alter_info);
-
- /*
- Look if we have to do anything at all.
- Normally ALTER can become NOOP only after handling
- the IF (NOT) EXISTS options.
- */
- if (alter_info->flags == 0)
- {
- my_snprintf(alter_ctx.tmp_name, sizeof(alter_ctx.tmp_name),
- ER(ER_INSERT_INFO), 0L, 0L,
- thd->get_stmt_da()->current_statement_warn_count());
- my_ok(thd, 0L, 0L, alter_ctx.tmp_name);
- DBUG_RETURN(false);
- }
-
/* We have to do full alter table. */
#ifdef WITH_PARTITION_STORAGE_ENGINE
diff --git a/sql/sql_test.cc b/sql/sql_test.cc
index 8992ff24a1e..82abc861ec4 100644
--- a/sql/sql_test.cc
+++ b/sql/sql_test.cc
@@ -220,7 +220,7 @@ TEST_join(JOIN *join)
}
-#define FT_KEYPART (MAX_REF_PARTS+10)
+#define FT_KEYPART (MAX_FIELDS+10)
void print_keyuse(KEYUSE *keyuse)
{
diff --git a/sql/sql_truncate.cc b/sql/sql_truncate.cc
index fe2ea02a8e2..05869b70c8f 100644
--- a/sql/sql_truncate.cc
+++ b/sql/sql_truncate.cc
@@ -1,5 +1,5 @@
-/* Copyright (c) 2010, 2014, Oracle and/or its affiliates.
- Copyright (c) 2013, 2014, SkySQL Ab.
+/* Copyright (c) 2010, 2015, Oracle and/or its affiliates.
+ Copyright (c) 2013, 2015, MariaDB
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
@@ -283,6 +283,12 @@ static bool recreate_temporary_table(THD *thd, TABLE *table)
table->file->info(HA_STATUS_AUTO | HA_STATUS_NO_LOCK);
+ /*
+ If LOCK TABLES list is not empty and contains this table
+ then unlock the table and remove it from this list.
+ */
+ mysql_lock_remove(thd, thd->lock, table);
+
/* Don't free share. */
close_temporary_table(thd, table, FALSE, FALSE);
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 6c4d864e75a..f616549097b 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
- Copyright (c) 2011, 2013, Monty Program Ab.
+ Copyright (c) 2011, 2015, MariaDB
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
@@ -1520,7 +1520,7 @@ int mysql_multi_update_prepare(THD *thd)
*/
lex->select_lex.exclude_from_table_unique_test= FALSE;
- if (lex->select_lex.save_prep_leaf_tables(thd))
+ if (lex->save_prep_leaf_tables())
DBUG_RETURN(TRUE);
DBUG_RETURN (FALSE);
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index 20a16e3eae1..a63d8a51a86 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2004, 2013, Oracle and/or its affiliates.
- Copyright (c) 2011, 2014, SkySQL Ab.
+ Copyright (c) 2011, 2015, MariaDB
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,6 +34,7 @@
#include "sp.h"
#include "sp_cache.h"
#include "datadict.h" // dd_frm_is_view()
+#include "sql_derived.h"
#define MD5_BUFF_LENGTH 33
@@ -224,7 +225,7 @@ fill_defined_view_parts (THD *thd, TABLE_LIST *view)
view->definer.user= decoy.definer.user;
lex->definer= &view->definer;
}
- if (lex->create_view_algorithm == DTYPE_ALGORITHM_UNDEFINED)
+ if (lex->create_view_algorithm == VIEW_ALGORITHM_INHERIT)
lex->create_view_algorithm= (uint8) decoy.algorithm;
if (lex->create_view_suid == VIEW_SUID_DEFAULT)
lex->create_view_suid= decoy.view_suid ?
@@ -684,6 +685,26 @@ err:
}
+static void make_view_filename(LEX_STRING *dir, char *dir_buff,
+ size_t dir_buff_len,
+ LEX_STRING *path, char *path_buff,
+ size_t path_buff_len,
+ LEX_STRING *file,
+ TABLE_LIST *view)
+{
+ /* print file name */
+ dir->length= build_table_filename(dir_buff, dir_buff_len - 1,
+ view->db, "", "", 0);
+ dir->str= dir_buff;
+
+ path->length= build_table_filename(path_buff, path_buff_len - 1,
+ view->db, view->table_name, reg_ext, 0);
+ path->str= path_buff;
+
+ file->str= path->str + dir->length;
+ file->length= path->length - dir->length;
+}
+
/* number of required parameters for making view */
static const int required_view_parameters= 15;
@@ -746,6 +767,67 @@ static File_option view_parameters[]=
static LEX_STRING view_file_type[]= {{(char*) STRING_WITH_LEN("VIEW") }};
+int mariadb_fix_view(THD *thd, TABLE_LIST *view, bool wrong_checksum,
+ bool swap_alg)
+{
+ char dir_buff[FN_REFLEN + 1], path_buff[FN_REFLEN + 1];
+ LEX_STRING dir, file, path;
+ DBUG_ENTER("mariadb_fix_view");
+
+ if (!wrong_checksum && view->mariadb_version)
+ DBUG_RETURN(HA_ADMIN_OK);
+
+ make_view_filename(&dir, dir_buff, sizeof(dir_buff),
+ &path, path_buff, sizeof(path_buff),
+ &file, view);
+ /* init timestamp */
+ if (!view->timestamp.str)
+ view->timestamp.str= view->timestamp_buffer;
+
+ if (swap_alg && view->algorithm != VIEW_ALGORITHM_UNDEFINED)
+ {
+ DBUG_ASSERT(view->algorithm == VIEW_ALGORITHM_MERGE ||
+ view->algorithm == VIEW_ALGORITHM_TMPTABLE);
+ if (view->algorithm == VIEW_ALGORITHM_MERGE)
+ view->algorithm= VIEW_ALGORITHM_TMPTABLE;
+ else
+ view->algorithm= VIEW_ALGORITHM_MERGE;
+ }
+ else
+ swap_alg= 0;
+ if (wrong_checksum)
+ {
+ if (view->md5.length != 32)
+ {
+ if ((view->md5.str= (char *)thd->alloc(32 + 1)) == NULL)
+ DBUG_RETURN(HA_ADMIN_FAILED);
+ }
+ view->calc_md5(view->md5.str);
+ view->md5.length= 32;
+ }
+ view->mariadb_version= MYSQL_VERSION_ID;
+
+ if (sql_create_definition_file(&dir, &file, view_file_type,
+ (uchar*)view, view_parameters))
+ {
+ sql_print_error("View '%-.192s'.'%-.192s': algorithm swap error.",
+ view->db, view->table_name);
+ DBUG_RETURN(HA_ADMIN_INTERNAL_ERROR);
+ }
+ sql_print_information("View %`s.%`s: the version is set to %llu%s%s",
+ view->db, view->table_name, view->mariadb_version,
+ (wrong_checksum ? ", checksum corrected" : ""),
+ (swap_alg ?
+ ((view->algorithm == VIEW_ALGORITHM_MERGE) ?
+ ", algorithm restored to be MERGE"
+ : ", algorithm restored to be TEMPTABLE")
+ : ""));
+
+
+ DBUG_RETURN(HA_ADMIN_OK);
+}
+
+
/*
Register VIEW (write .frm & process .frm's history backups)
@@ -886,17 +968,9 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
}
loop_out:
/* print file name */
- dir.length= build_table_filename(dir_buff, sizeof(dir_buff) - 1,
- view->db, "", "", 0);
- dir.str= dir_buff;
-
- path.length= build_table_filename(path_buff, sizeof(path_buff) - 1,
- view->db, view->table_name, reg_ext, 0);
- path.str= path_buff;
-
- file.str= path.str + dir.length;
- file.length= path.length - dir.length;
-
+ make_view_filename(&dir, dir_buff, sizeof(dir_buff),
+ &path, path_buff, sizeof(path_buff),
+ &file, view);
/* init timestamp */
if (!view->timestamp.str)
view->timestamp.str= view->timestamp_buffer;
@@ -1022,7 +1096,7 @@ err:
SYNOPSIS
mysql_make_view()
- thd Thread handler
+ thd Thread handle
parser parser object
table TABLE_LIST structure for filling
flags flags
@@ -1063,6 +1137,15 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table,
DBUG_PRINT("info",
("VIEW %s.%s is already processed on previous PS/SP execution",
table->view_db.str, table->view_name.str));
+
+ /*
+ Clear old variables in the TABLE_LIST that could be left from an old view
+ This is only needed if there was an error at last usage of view,
+ in which case the reinit call wasn't done.
+ See MDEV-6668 for details.
+ */
+ mysql_derived_reinit(thd, NULL, table);
+
DBUG_RETURN(0);
}
@@ -1599,7 +1682,7 @@ err:
SYNOPSIS
mysql_drop_view()
- thd - thread handler
+ thd - thread handle
views - views to delete
drop_mode - cascade/check
@@ -1716,7 +1799,7 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
SYNOPSIS
check_key_in_view()
- thd thread handler
+ thd thread handle
view view for check with opened table
DESCRIPTION
@@ -1902,6 +1985,58 @@ int view_checksum(THD *thd, TABLE_LIST *view)
HA_ADMIN_OK);
}
+/**
+ Check view
+
+ @param thd thread handle
+ @param view view for check
+ @param check_opt check options
+
+ @retval HA_ADMIN_OK OK
+ @retval HA_ADMIN_NOT_IMPLEMENTED it is not VIEW
+ @retval HA_ADMIN_WRONG_CHECKSUM check sum is wrong
+*/
+int view_check(THD *thd, TABLE_LIST *view, HA_CHECK_OPT *check_opt)
+{
+ DBUG_ENTER("view_check");
+
+ int res= view_checksum(thd, view);
+ if (res != HA_ADMIN_OK)
+ DBUG_RETURN(res);
+
+ if (((check_opt->sql_flags & TT_FOR_UPGRADE) && !view->mariadb_version))
+ DBUG_RETURN(HA_ADMIN_NEEDS_UPGRADE);
+
+ DBUG_RETURN(HA_ADMIN_OK);
+}
+
+
+/**
+ Repair view
+
+ @param thd thread handle
+ @param view view for check
+ @param check_opt check options
+
+ @retval HA_ADMIN_OK OK
+ @retval HA_ADMIN_NOT_IMPLEMENTED it is not VIEW
+ @retval HA_ADMIN_WRONG_CHECKSUM check sum is wrong
+*/
+
+int view_repair(THD *thd, TABLE_LIST *view, HA_CHECK_OPT *check_opt)
+{
+ DBUG_ENTER("view_repair");
+ bool swap_alg= (check_opt->sql_flags & TT_FROM_MYSQL);
+ bool wrong_checksum= view_checksum(thd, view) != HA_ADMIN_OK;
+ int ret;
+ if (wrong_checksum || swap_alg || (!view->mariadb_version))
+ {
+ ret= mariadb_fix_view(thd, view, wrong_checksum, swap_alg);
+ DBUG_RETURN(ret);
+ }
+ DBUG_RETURN(HA_ADMIN_OK);
+}
+
/*
rename view
diff --git a/sql/sql_view.h b/sql/sql_view.h
index abe95c63e6e..8d733a1867c 100644
--- a/sql/sql_view.h
+++ b/sql/sql_view.h
@@ -2,7 +2,8 @@
#define SQL_VIEW_INCLUDED
/* -*- C++ -*- */
-/* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2004, 2010, Oracle and/or its affiliates.
+ Copyright (c) 2015, MariaDB
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
@@ -45,6 +46,8 @@ bool check_key_in_view(THD *thd, TABLE_LIST * view);
bool insert_view_fields(THD *thd, List<Item> *list, TABLE_LIST *view);
int view_checksum(THD *thd, TABLE_LIST *view);
+int view_check(THD *thd, TABLE_LIST *view, HA_CHECK_OPT *check_opt);
+int view_repair(THD *thd, TABLE_LIST *view, HA_CHECK_OPT *check_opt);
extern TYPELIB updatable_views_with_limit_typelib;
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 74426f88a69..d980de7e1a5 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -1,6 +1,6 @@
/*
- Copyright (c) 2000, 2014, Oracle and/or its affiliates.
- Copyright (c) 2010, 2014, Monty Program Ab.
+ Copyright (c) 2000, 2015, Oracle and/or its affiliates.
+ Copyright (c) 2010, 2015, MariaDB
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
@@ -63,6 +63,7 @@
#include "keycaches.h"
#include "set_var.h"
#include "rpl_mi.h"
+#include "lex_token.h"
/* this is to get the bison compilation windows warnings out */
#ifdef _MSC_VER
@@ -1331,6 +1332,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token MULTIPOINT
%token MULTIPOLYGON
%token MUTEX_SYM
+%token MYSQL_SYM
%token MYSQL_ERRNO_SYM
%token NAMES_SYM /* SQL-2003-N */
%token NAME_SYM /* SQL-2003-N */
@@ -5803,18 +5805,8 @@ create_table_option:
default_charset:
opt_default charset opt_equal charset_name_or_default
{
- HA_CREATE_INFO *cinfo= &Lex->create_info;
- if ((cinfo->used_fields & HA_CREATE_USED_DEFAULT_CHARSET) &&
- cinfo->default_table_charset && $4 &&
- !my_charset_same(cinfo->default_table_charset,$4))
- {
- my_error(ER_CONFLICTING_DECLARATIONS, MYF(0),
- "CHARACTER SET ", cinfo->default_table_charset->csname,
- "CHARACTER SET ", $4->csname);
+ if (Lex->create_info.add_table_option_default_charset($4))
MYSQL_YYABORT;
- }
- Lex->create_info.default_table_charset= $4;
- Lex->create_info.used_fields|= HA_CREATE_USED_DEFAULT_CHARSET;
}
;
@@ -7028,6 +7020,7 @@ alter:
{
Lex->name.str= 0;
Lex->name.length= 0;
+ Lex->only_view= FALSE;
Lex->sql_command= SQLCOM_ALTER_TABLE;
Lex->duplicates= DUP_ERROR;
Lex->col_list.empty();
@@ -7149,7 +7142,7 @@ alter:
my_error(ER_SP_BADSTATEMENT, MYF(0), "ALTER VIEW");
MYSQL_YYABORT;
}
- lex->create_view_algorithm= DTYPE_ALGORITHM_UNDEFINED;
+ lex->create_view_algorithm= VIEW_ALGORITHM_INHERIT;
lex->create_view_mode= VIEW_ALTER;
}
view_tail
@@ -7646,10 +7639,8 @@ alter_list_item:
MYSQL_YYABORT;
}
LEX *lex= Lex;
- lex->create_info.table_charset=
- lex->create_info.default_table_charset= $5;
- lex->create_info.used_fields|= (HA_CREATE_USED_CHARSET |
- HA_CREATE_USED_DEFAULT_CHARSET);
+ if (lex->create_info.add_alter_list_item_convert_to_charset($5))
+ MYSQL_YYABORT;
lex->alter_info.flags|= Alter_info::ALTER_CONVERT;
}
| create_table_options_space_separated
@@ -7921,8 +7912,13 @@ opt_checksum_type:
| EXTENDED_SYM { Lex->check_opt.flags= T_EXTEND; }
;
+repair_table_or_view:
+ table_or_tables table_list opt_mi_repair_type
+ | VIEW_SYM { Lex->only_view= TRUE; } table_list opt_view_repair_type
+ ;
+
repair:
- REPAIR opt_no_write_to_binlog table_or_tables
+ REPAIR opt_no_write_to_binlog
{
LEX *lex=Lex;
lex->sql_command = SQLCOM_REPAIR;
@@ -7932,7 +7928,7 @@ repair:
/* Will be overriden during execution. */
YYPS->m_lock_type= TL_UNLOCK;
}
- table_list opt_mi_repair_type
+ repair_table_or_view
{
LEX* lex= thd->lex;
DBUG_ASSERT(!lex->m_sql_cmd);
@@ -7958,6 +7954,11 @@ mi_repair_type:
| USE_FRM { Lex->check_opt.sql_flags|= TT_USEFRM; }
;
+opt_view_repair_type:
+ /* empty */ { }
+ | FROM MYSQL_SYM { Lex->check_opt.sql_flags|= TT_FROM_MYSQL; }
+ ;
+
analyze:
ANALYZE_SYM opt_no_write_to_binlog table_or_tables
{
@@ -8074,25 +8075,29 @@ binlog_base64_event:
}
;
-check:
- CHECK_SYM table_or_tables
+check_view_or_table:
+ table_or_tables table_list opt_mi_check_type
+ | VIEW_SYM { Lex->only_view= TRUE; } table_list opt_view_check_type
+ ;
+
+check: CHECK_SYM
{
LEX *lex=Lex;
- if (lex->sphead)
- {
- my_error(ER_SP_BADSTATEMENT, MYF(0), "CHECK");
- MYSQL_YYABORT;
- }
lex->sql_command = SQLCOM_CHECK;
lex->check_opt.init();
lex->alter_info.reset();
/* Will be overriden during execution. */
YYPS->m_lock_type= TL_UNLOCK;
}
- table_list opt_mi_check_type
+ check_view_or_table
{
LEX* lex= thd->lex;
+ if (lex->sphead)
+ {
+ my_error(ER_SP_BADSTATEMENT, MYF(0), "CHECK");
+ MYSQL_YYABORT;
+ }
DBUG_ASSERT(!lex->m_sql_cmd);
lex->m_sql_cmd= new (thd->mem_root) Sql_cmd_check_table();
if (lex->m_sql_cmd == NULL)
@@ -8119,6 +8124,11 @@ mi_check_type:
| FOR_SYM UPGRADE_SYM { Lex->check_opt.sql_flags|= TT_FOR_UPGRADE; }
;
+opt_view_check_type:
+ /* empty */ { }
+ | FOR_SYM UPGRADE_SYM { Lex->check_opt.sql_flags|= TT_FOR_UPGRADE; }
+ ;
+
optimize:
OPTIMIZE opt_no_write_to_binlog table_or_tables
{
@@ -10105,7 +10115,8 @@ udf_expr:
parse it out. If we hijack the input stream with
remember_name we may get quoted or escaped names.
*/
- else if ($2->type() != Item::FIELD_ITEM)
+ else if ($2->type() != Item::FIELD_ITEM &&
+ $2->type() != Item::REF_ITEM /* For HAVING */ )
$2->set_name($1, (uint) ($3 - $1), thd->charset());
$$= $2;
}
@@ -12529,7 +12540,6 @@ show_param:
lex->sql_command = SQLCOM_SHOW_CREATE;
if (!lex->select_lex.add_table_to_list(thd, $3, NULL,0))
MYSQL_YYABORT;
- lex->only_view= 0;
lex->create_info.storage_media= HA_SM_DEFAULT;
}
| CREATE VIEW_SYM table_ident
@@ -13360,6 +13370,13 @@ literal:
| temporal_literal { $$= $1; }
| NULL_SYM
{
+ /*
+ For the digest computation, in this context only,
+ NULL is considered a literal, hence reduced to '?'
+ REDUCE:
+ TOK_GENERIC_VALUE := NULL_SYM
+ */
+ YYLIP->reduce_digest_token(TOK_GENERIC_VALUE, NULL_SYM);
$$ = new (thd->mem_root) Item_null();
if ($$ == NULL)
MYSQL_YYABORT;
@@ -13398,7 +13415,12 @@ literal:
| UNDERSCORE_CHARSET hex_or_bin_String
{
Item_string_with_introducer *item_str;
- item_str= new (thd->mem_root) Item_string_with_introducer($2, $1);
+ /*
+ Pass NULL as name. Name will be set in the "select_item" rule and
+ will include the introducer and the original hex/bin notation.
+ */
+ item_str= new (thd->mem_root)
+ Item_string_with_introducer(NULL, $2->ptr(), $2->length(), $1);
if (!item_str || !item_str->check_well_formed_result(true))
MYSQL_YYABORT;
@@ -14206,6 +14228,7 @@ keyword_sp:
| MULTIPOINT {}
| MULTIPOLYGON {}
| MUTEX_SYM {}
+ | MYSQL_SYM {}
| MYSQL_ERRNO_SYM {}
| NAME_SYM {}
| NAMES_SYM {}
@@ -14834,8 +14857,8 @@ lock:
;
table_or_tables:
- TABLE_SYM {}
- | TABLES {}
+ TABLE_SYM { }
+ | TABLES { }
;
table_lock_list:
@@ -15739,6 +15762,13 @@ subselect_end:
*/
lex->current_select->select_n_where_fields+=
child->select_n_where_fields;
+
+ /*
+ Aggregate functions in having clause may add fields to an outer
+ select. Count them also.
+ */
+ lex->current_select->select_n_having_items+=
+ child->select_n_having_items;
}
;
diff --git a/sql/structs.h b/sql/structs.h
index 2de7abb666d..ee61b8d3b3a 100644
--- a/sql/structs.h
+++ b/sql/structs.h
@@ -77,6 +77,7 @@ typedef struct st_key_part_info { /* Info about a key part */
*/
uint16 store_length;
uint16 key_type;
+ /* Fieldnr begins counting from 1 */
uint16 fieldnr; /* Fieldnum in UNIREG */
uint16 key_part_flag; /* 0 or HA_REVERSE_SORT */
uint8 type;
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index f1942d08591..94466db5fd9 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -1,5 +1,5 @@
-/* Copyright (c) 2002, 2014, Oracle and/or its affiliates.
- Copyright (c) 2012, 2014, SkySQL Ab.
+/* Copyright (c) 2002, 2015, Oracle and/or its affiliates.
+ Copyright (c) 2012, 2015, MariaDB
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
@@ -1313,6 +1313,12 @@ static Sys_var_ulong Sys_max_connect_errors(
VALID_RANGE(1, UINT_MAX), DEFAULT(MAX_CONNECT_ERRORS),
BLOCK_SIZE(1));
+static Sys_var_long Sys_max_digest_length(
+ "max_digest_length", "Maximum length considered for digest text.",
+ PARSED_EARLY READ_ONLY GLOBAL_VAR(max_digest_length),
+ CMD_LINE(REQUIRED_ARG),
+ VALID_RANGE(0, 1024 * 1024), DEFAULT(1024), BLOCK_SIZE(1));
+
static bool check_max_delayed_threads(sys_var *self, THD *thd, set_var *var)
{
return var->type != OPT_GLOBAL &&
@@ -1752,16 +1758,12 @@ check_slave_parallel_threads(sys_var *self, THD *thd, set_var *var)
static bool
fix_slave_parallel_threads(sys_var *self, THD *thd, enum_var_type type)
{
- bool running;
- bool err= false;
+ bool err;
mysql_mutex_unlock(&LOCK_global_system_variables);
mysql_mutex_lock(&LOCK_active_mi);
- running= master_info_index->give_error_if_slave_running();
+ err= master_info_index->give_error_if_slave_running();
mysql_mutex_unlock(&LOCK_active_mi);
- if (running || rpl_parallel_change_thread_count(&global_rpl_thread_pool,
- opt_slave_parallel_threads))
- err= true;
mysql_mutex_lock(&LOCK_global_system_variables);
return err;
@@ -2528,7 +2530,7 @@ static Sys_var_ulong Sys_trans_alloc_block_size(
"transaction_alloc_block_size",
"Allocation block size for transactions to be stored in binary log",
SESSION_VAR(trans_alloc_block_size), CMD_LINE(REQUIRED_ARG),
- VALID_RANGE(1024, UINT_MAX), DEFAULT(QUERY_ALLOC_BLOCK_SIZE),
+ VALID_RANGE(1024, 128 * 1024 * 1024), DEFAULT(QUERY_ALLOC_BLOCK_SIZE),
BLOCK_SIZE(1024), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_trans_mem_root));
@@ -2536,7 +2538,7 @@ static Sys_var_ulong Sys_trans_prealloc_size(
"transaction_prealloc_size",
"Persistent buffer for transactions to be stored in binary log",
SESSION_VAR(trans_prealloc_size), CMD_LINE(REQUIRED_ARG),
- VALID_RANGE(1024, UINT_MAX), DEFAULT(TRANS_ALLOC_PREALLOC_SIZE),
+ VALID_RANGE(1024, 128 * 1024 * 1024), DEFAULT(TRANS_ALLOC_PREALLOC_SIZE),
BLOCK_SIZE(1024), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_trans_mem_root));
diff --git a/sql/table.cc b/sql/table.cc
index 321c2a96b4f..053269ab435 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -1,5 +1,5 @@
-/* Copyright (c) 2000, 2012, Oracle and/or its affiliates.
- Copyright (c) 2008, 2014, SkySQL Ab.
+/* Copyright (c) 2000, 2014, Oracle and/or its affiliates.
+ Copyright (c) 2008, 2015, MariaDB
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
@@ -2927,7 +2927,9 @@ partititon_err:
outparam->no_replicate= FALSE;
}
- thd->status_var.opened_tables++;
+ /* Increment the opened_tables counter, only when open flags set. */
+ if (db_stat)
+ thd->status_var.opened_tables++;
thd->lex->context_analysis_only= save_context_analysis_only;
DBUG_RETURN (OPEN_FRM_OK);
@@ -4728,23 +4730,26 @@ bool TABLE_LIST::check_single_table(TABLE_LIST **table_arg,
bool TABLE_LIST::set_insert_values(MEM_ROOT *mem_root)
{
+ DBUG_ENTER("set_insert_values");
if (table)
{
+ DBUG_PRINT("info", ("setting insert_value for table"));
if (!table->insert_values &&
!(table->insert_values= (uchar *)alloc_root(mem_root,
table->s->rec_buff_length)))
- return TRUE;
+ DBUG_RETURN(TRUE);
}
else
{
+ DBUG_PRINT("info", ("setting insert_value for view"));
DBUG_ASSERT(is_view_or_derived() && is_merged_derived());
for (TABLE_LIST *tbl= (TABLE_LIST*)view->select_lex.table_list.first;
tbl;
tbl= tbl->next_local)
if (tbl->set_insert_values(mem_root))
- return TRUE;
+ DBUG_RETURN(TRUE);
}
- return FALSE;
+ DBUG_RETURN(FALSE);
}
@@ -5106,7 +5111,8 @@ TABLE *TABLE_LIST::get_real_join_table()
TABLE_LIST *tbl= this;
while (tbl->table == NULL || tbl->table->reginfo.join_tab == NULL)
{
- if (tbl->view == NULL && tbl->derived == NULL)
+ if ((tbl->view == NULL && tbl->derived == NULL) ||
+ tbl->is_materialized_derived())
break;
/* we do not support merging of union yet */
DBUG_ASSERT(tbl->view == NULL ||
@@ -5115,28 +5121,25 @@ TABLE *TABLE_LIST::get_real_join_table()
tbl->derived->first_select()->next_select() == NULL);
{
- List_iterator_fast<TABLE_LIST> ti;
+ List_iterator_fast<TABLE_LIST>
+ ti(tbl->view != NULL ?
+ tbl->view->select_lex.top_join_list :
+ tbl->derived->first_select()->top_join_list);
+ for (;;)
{
- List_iterator_fast<TABLE_LIST>
- ti(tbl->view != NULL ?
- tbl->view->select_lex.top_join_list :
- tbl->derived->first_select()->top_join_list);
- for (;;)
- {
- tbl= NULL;
- /*
- Find left table in outer join on this level
- (the list is reverted).
- */
- for (TABLE_LIST *t= ti++; t; t= ti++)
- tbl= t;
- if (!tbl)
- return NULL; // view/derived with no tables
- if (!tbl->nested_join)
- break;
- /* go deeper if we've found nested join */
- ti= tbl->nested_join->join_list;
- }
+ tbl= NULL;
+ /*
+ Find left table in outer join on this level
+ (the list is reverted).
+ */
+ for (TABLE_LIST *t= ti++; t; t= ti++)
+ tbl= t;
+ if (!tbl)
+ return NULL; // view/derived with no tables
+ if (!tbl->nested_join)
+ break;
+ /* go deeper if we've found nested join */
+ ti= tbl->nested_join->join_list;
}
}
}
@@ -6085,16 +6088,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.
+/**
+ @brief
+ Populate a KEY_PART_INFO structure with the data related to a field entry.
+
+ @param key_part_info The structure to fill.
+ @param field The field entry that represents the key part.
+ @param fleldnr The number of the field, count starting from 1.
+
+ TODO: This method does not make use of any table specific fields. It
+ could be refactored to act as a constructor for KEY_PART_INFO instead.
*/
-void TABLE::create_key_part_by_field(KEY *keyinfo,
- KEY_PART_INFO *key_part_info,
+
+void TABLE::create_key_part_by_field(KEY_PART_INFO *key_part_info,
Field *field, uint fieldnr)
{
DBUG_ASSERT(field->field_index + 1 == (int)fieldnr);
@@ -6104,8 +6110,11 @@ void TABLE::create_key_part_by_field(KEY *keyinfo,
key_part_info->field= field;
key_part_info->fieldnr= fieldnr;
key_part_info->offset= field->offset(record[0]);
- key_part_info->length= (uint16) field->pack_length();
- keyinfo->key_length+= key_part_info->length;
+ /*
+ field->key_length() accounts for the raw length of the field, excluding
+ any metadata such as length of field or the NULL flag.
+ */
+ key_part_info->length= (uint16) field->key_length();
key_part_info->key_part_flag= 0;
/* TODO:
The below method of computing the key format length of the
@@ -6117,17 +6126,20 @@ void TABLE::create_key_part_by_field(KEY *keyinfo,
*/
key_part_info->store_length= key_part_info->length;
+ /*
+ The total store length of the key part is the raw length of the field +
+ any metadata information, such as its length for strings and/or the null
+ flag.
+ */
if (field->real_maybe_null())
{
key_part_info->store_length+= HA_KEY_NULL_LENGTH;
- keyinfo->key_length+= HA_KEY_NULL_LENGTH;
}
if (field->type() == MYSQL_TYPE_BLOB ||
field->type() == MYSQL_TYPE_GEOMETRY ||
field->real_type() == MYSQL_TYPE_VARCHAR)
{
key_part_info->store_length+= HA_KEY_BLOB_LENGTH;
- keyinfo->key_length+= HA_KEY_BLOB_LENGTH; // ???
key_part_info->key_part_flag|=
field->type() == MYSQL_TYPE_BLOB ? HA_BLOB_PART: HA_VAR_LENGTH_PART;
}
@@ -6253,7 +6265,8 @@ bool TABLE::add_tmp_key(uint key, uint key_parts,
if (key_start)
(*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);
+ create_key_part_by_field(key_part_info, *reg_field, fld_idx+1);
+ keyinfo->key_length += key_part_info->store_length;
(*reg_field)->flags|= PART_KEY_FLAG;
key_start= FALSE;
key_part_info++;
@@ -6897,15 +6910,16 @@ void TABLE_LIST::reset_const_table()
bool TABLE_LIST::handle_derived(LEX *lex, uint phases)
{
- SELECT_LEX_UNIT *unit= get_unit();
- if (unit)
+ SELECT_LEX_UNIT *unit;
+ DBUG_ENTER("handle_derived");
+ if ((unit= get_unit()))
{
for (SELECT_LEX *sl= unit->first_select(); sl; sl= sl->next_select())
if (sl->handle_derived(lex, phases))
- return TRUE;
- return mysql_handle_single_derived(lex, this, phases);
+ DBUG_RETURN(TRUE);
+ DBUG_RETURN(mysql_handle_single_derived(lex, this, phases));
}
- return FALSE;
+ DBUG_RETURN(FALSE);
}
diff --git a/sql/table.h b/sql/table.h
index b978484158b..39faa8b9765 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -1340,7 +1340,7 @@ public:
bool add_tmp_key(uint key, uint key_parts,
uint (*next_field_no) (uchar *), uchar *arg,
bool unique);
- void create_key_part_by_field(KEY *keyinfo, KEY_PART_INFO *key_part_info,
+ void create_key_part_by_field(KEY_PART_INFO *key_part_info,
Field *field, uint fieldnr);
void use_index(int key_to_save);
void set_table_map(table_map map_arg, uint tablenr_arg)
@@ -1374,6 +1374,10 @@ public:
}
bool update_const_key_parts(COND *conds);
+
+ my_ptrdiff_t default_values_offset() const
+ { return (my_ptrdiff_t) (s->default_values - record[0]); }
+
uint actual_n_key_parts(KEY *keyinfo);
ulong actual_key_flags(KEY *keyinfo);
int update_default_fields();
@@ -1537,6 +1541,8 @@ typedef struct st_schema_table
#define DT_PHASES_MATERIALIZE (DT_COMMON | DT_MATERIALIZE)
#define VIEW_ALGORITHM_UNDEFINED 0
+/* Special value for ALTER VIEW: inherit original algorithm. */
+#define VIEW_ALGORITHM_INHERIT DTYPE_VIEW
#define VIEW_ALGORITHM_MERGE (DTYPE_VIEW | DTYPE_MERGE)
#define VIEW_ALGORITHM_TMPTABLE (DTYPE_VIEW | DTYPE_MATERIALIZE)
@@ -2079,6 +2085,24 @@ struct TABLE_LIST
TABLE_LIST *find_underlying_table(TABLE *table);
TABLE_LIST *first_leaf_for_name_resolution();
TABLE_LIST *last_leaf_for_name_resolution();
+ /**
+ @brief
+ Find the bottom in the chain of embedded table VIEWs.
+
+ @detail
+ This is used for single-table UPDATE/DELETE when they are modifying a
+ single-table VIEW.
+ */
+ TABLE_LIST *find_table_for_update()
+ {
+ TABLE_LIST *tbl= this;
+ while(!tbl->is_multitable() && tbl->single_table_updatable() &&
+ tbl->merge_underlying_list)
+ {
+ tbl= tbl->merge_underlying_list;
+ }
+ return tbl;
+ }
TABLE *get_real_join_table();
bool is_leaf_for_name_resolution();
inline TABLE_LIST *top_table()
diff --git a/sql/transaction.cc b/sql/transaction.cc
index 51d8a08e981..a70c075e142 100644
--- a/sql/transaction.cc
+++ b/sql/transaction.cc
@@ -149,6 +149,8 @@ bool trans_begin(THD *thd, uint flags)
when we come here. We should at some point change this to an assert.
*/
thd->transaction.all.modified_non_trans_table= FALSE;
+ thd->has_waiter= false;
+ thd->waiting_on_group_commit= false;
if (res)
DBUG_RETURN(TRUE);
diff --git a/sql/tztime.cc b/sql/tztime.cc
index d3b4fec6335..6486e9b2018 100644
--- a/sql/tztime.cc
+++ b/sql/tztime.cc
@@ -2523,7 +2523,8 @@ scan_tz_dir(char * name_end, uint symlink_recursion_level, uint verbose)
for (i= 0; i < cur_dir->number_of_files; i++)
{
- if (cur_dir->dir_entry[i].name[0] != '.')
+ if (cur_dir->dir_entry[i].name[0] != '.' &&
+ strcmp(cur_dir->dir_entry[i].name, "Factory"))
{
name_end_tmp= strmake(name_end, cur_dir->dir_entry[i].name,
FN_REFLEN - (name_end - fullname));
diff --git a/sql/udf_example.c b/sql/udf_example.c
index 36a5eafb704..a48801d1c4a 100644
--- a/sql/udf_example.c
+++ b/sql/udf_example.c
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2000, 2010, Oracle and/or its affiliates.
+ Copyright (c) 2000, 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
@@ -296,9 +296,12 @@ char *metaphon(UDF_INIT *initid __attribute__((unused)),
if (!word) /* Null argument */
{
+ /* The length is expected to be zero when the argument is NULL. */
+ assert(args->lengths[0] == 0);
*is_null=1;
return 0;
}
+
w_end=word+args->lengths[0];
org_result=result;
diff --git a/sql/uniques.cc b/sql/uniques.cc
index 912a38f8927..c755293035b 100644
--- a/sql/uniques.cc
+++ b/sql/uniques.cc
@@ -1,4 +1,5 @@
-/* Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2001, 2010, Oracle and/or its affiliates.
+ Copyright (c) 2010, 2015, MariaDB
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
@@ -100,7 +101,7 @@ Unique::Unique(qsort_cmp2 comp_func, void * comp_func_fixed_arg,
max_elements= (ulong) (max_in_memory_size /
ALIGN_SIZE(sizeof(TREE_ELEMENT)+size));
(void) open_cached_file(&file, mysql_tmpdir,TEMP_PREFIX, DISK_BUFFER_SIZE,
- MYF(MY_WME));
+ MYF(MY_WME));
}
@@ -641,8 +642,8 @@ bool Unique::walk(TABLE *table, tree_walk_action action, void *walk_action_arg)
return 1;
if (flush_io_cache(&file) || reinit_io_cache(&file, READ_CACHE, 0L, 0, 0))
return 1;
- ulong buff_sz= (max_in_memory_size / full_size + 1) * full_size;
- if (!(merge_buffer= (uchar *) my_malloc(buff_sz, MYF(MY_THREAD_SPECIFIC))))
+ size_t buff_sz= (max_in_memory_size / full_size + 1) * full_size;
+ if (!(merge_buffer = (uchar *)my_malloc(buff_sz, MYF(MY_THREAD_SPECIFIC|MY_WME))))
return 1;
if (buff_sz < full_size * (file_ptrs.elements + 1UL))
res= merge(table, merge_buffer, buff_sz >= full_size * MERGEBUFF2) ;
@@ -773,9 +774,8 @@ bool Unique::get(TABLE *table)
/* Not enough memory; Save the result to file && free memory used by tree */
if (flush())
return 1;
-
- ulong buff_sz= (max_in_memory_size / full_size + 1) * full_size;
- if (!(sort_buffer= (uchar*) my_malloc(buff_sz, MYF(MY_THREAD_SPECIFIC))))
+ size_t buff_sz= (max_in_memory_size / full_size + 1) * full_size;
+ if (!(sort_buffer= (uchar*) my_malloc(buff_sz, MYF(MY_THREAD_SPECIFIC|MY_WME))))
return 1;
if (merge(table, sort_buffer, FALSE))
diff --git a/sql/winservice.h b/sql/winservice.h
index fca7b129de5..c3e2bfe1b20 100644
--- a/sql/winservice.h
+++ b/sql/winservice.h
@@ -1,40 +1,40 @@
-/*
- Copyright (c) 2011, 2012, 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
- 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; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/*
- Extract properties of a windows service binary path
-*/
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <windows.h>
-typedef struct mysqld_service_properties_st
-{
- char mysqld_exe[MAX_PATH];
- char inifile[MAX_PATH];
- char datadir[MAX_PATH];
- int version_major;
- int version_minor;
- int version_patch;
-} mysqld_service_properties;
-
-extern int get_mysql_service_properties(const wchar_t *bin_path,
- mysqld_service_properties *props);
-
-#ifdef __cplusplus
-}
-#endif
+/*
+ Copyright (c) 2011, 2012, 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
+ 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; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+/*
+ Extract properties of a windows service binary path
+*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <windows.h>
+typedef struct mysqld_service_properties_st
+{
+ char mysqld_exe[MAX_PATH];
+ char inifile[MAX_PATH];
+ char datadir[MAX_PATH];
+ int version_major;
+ int version_minor;
+ int version_patch;
+} mysqld_service_properties;
+
+extern int get_mysql_service_properties(const wchar_t *bin_path,
+ mysqld_service_properties *props);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc
index 9b30445fcd2..e69e740bfcd 100644
--- a/storage/cassandra/ha_cassandra.cc
+++ b/storage/cassandra/ha_cassandra.cc
@@ -887,7 +887,7 @@ bool cassandra_to_dyncol_intLong(const char *cass_data,
{
value->type= DYN_COL_INT;
#ifdef WORDS_BIGENDIAN
- value->x.long_value= (longlong *)*cass_data;
+ value->x.long_value= (longlong)*cass_data;
#else
flip64(cass_data, (char *)&value->x.long_value);
#endif
diff --git a/storage/connect/CMakeLists.txt b/storage/connect/CMakeLists.txt
index 956372e4960..02fe5ee8dad 100644
--- a/storage/connect/CMakeLists.txt
+++ b/storage/connect/CMakeLists.txt
@@ -21,18 +21,18 @@ ha_connect.cc connect.cc user_connect.cc mycat.cc
fmdlex.c osutil.c plugutil.c rcmsg.c rcmsg.h
array.cpp blkfil.cpp colblk.cpp csort.cpp
filamap.cpp filamdbf.cpp filamfix.cpp filamtxt.cpp filamvct.cpp filamzip.cpp
-filter.cpp json.cpp maputil.cpp myutil.cpp plgdbutl.cpp reldef.cpp tabcol.cpp
-tabdos.cpp tabfix.cpp tabfmt.cpp tabjson.cpp table.cpp tabmul.cpp taboccur.cpp
-tabpivot.cpp tabsys.cpp tabtbl.cpp tabutil.cpp tabvct.cpp tabvir.cpp
-tabxcl.cpp valblk.cpp value.cpp xindex.cpp xobject.cpp
+filter.cpp json.cpp jsonudf.cpp maputil.cpp myconn.cpp myutil.cpp plgdbutl.cpp
+reldef.cpp tabcol.cpp tabdos.cpp tabfix.cpp tabfmt.cpp tabjson.cpp table.cpp
+tabmul.cpp tabmysql.cpp taboccur.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 json.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 tabjson.h tabmul.h taboccur.h tabpivot.h
-tabsys.h tabtbl.h tabutil.h tabvct.h tabvir.h tabxcl.h user_connect.h
-valblk.h value.h xindex.h xobject.h xtable.h)
+myconn.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 tabjson.h tabmul.h tabmysql.h
+taboccur.h tabpivot.h tabsys.h tabtbl.h tabutil.h tabvct.h tabvir.h tabxcl.h
+user_connect.h valblk.h value.h xindex.h xobject.h xtable.h)
#
# Definitions that are shared for all OSes
@@ -166,24 +166,15 @@ IF(LIBXML2_FOUND OR MSXML_FOUND)
ENDIF()
#
-# MySQL
+# MySQL is now included unconditionnally
#
-OPTION(CONNECT_WITH_MYSQL
- "Compile CONNECT storage engine with remote MySQL connection support"
- ON)
-
-IF(CONNECT_WITH_MYSQL)
- SET(CONNECT_SOURCES ${CONNECT_SOURCES}
- myconn.cpp myconn.h tabmysql.cpp tabmysql.h)
- add_definitions(-DMYSQL_SUPPORT)
- IF(NOT UNIX)
- #
- # TODO: remove this
- # change to use "#include "../../include/mysql.h" in the sources.
- INCLUDE_DIRECTORIES("../../include/mysql")
- ENDIF(NOT UNIX)
-ENDIF(CONNECT_WITH_MYSQL)
+IF(NOT UNIX)
+ #
+ # TODO: remove this
+ # change to use "#include "../../include/mysql.h" in the sources.
+ INCLUDE_DIRECTORIES("../../include/mysql")
+ENDIF(NOT UNIX)
#
@@ -232,6 +223,8 @@ IF(CONNECT_WITH_ODBC)
DOC "Specify the ODBC driver manager library here."
)
+ mark_as_advanced(ODBC_LIBRARY ODBC_INCLUDE_DIR)
+
IF(ODBC_INCLUDE_DIR AND ODBC_LIBRARY)
set(CMAKE_REQUIRED_LIBRARIES ${ODBC_LIBRARY})
set(CMAKE_REQUIRED_INCLUDES ${ODBC_INCLUDE_DIR})
diff --git a/storage/connect/array.cpp b/storage/connect/array.cpp
index a2f537436c9..193514eeb99 100644
--- a/storage/connect/array.cpp
+++ b/storage/connect/array.cpp
@@ -1,7 +1,7 @@
/************* Array C++ Functions Source Code File (.CPP) *************/
/* Name: ARRAY.CPP Version 2.3 */
/* */
-/* (C) Copyright to the author Olivier BERTRAND 2005-2014 */
+/* (C) Copyright to the author Olivier BERTRAND 2005-2015 */
/* */
/* This file contains the XOBJECT derived class ARRAY functions. */
/* ARRAY is used for elaborate type of processing, such as sorting */
@@ -19,14 +19,14 @@
#include "sql_class.h"
//#include "sql_time.h"
-#if defined(WIN32)
+#if defined(__WIN__)
//#include <windows.h>
-#else // !WIN32
+#else // !__WIN__
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdint.h> // for uintprt_h
-#endif // !WIN32
+#endif // !__WIN__
/***********************************************************************/
/* Include required application header files */
@@ -186,7 +186,7 @@ ARRAY::ARRAY(PGLOBAL g, int type, int size, int length, int prec)
// The error message was built by PlgDBalloc
Type = TYPE_ERROR;
else if (type != TYPE_PCHAR)
- Value = AllocateValue(g, type, Len, prec, NULL);
+ Value = AllocateValue(g, type, Len, prec);
Constant = TRUE;
} // end of ARRAY constructor
@@ -610,7 +610,7 @@ int ARRAY::Convert(PGLOBAL g, int k, PVAL vp)
// The error message was built by PlgDBalloc
return TYPE_ERROR;
else
- Value = AllocateValue(g, Type, Len, prec, NULL);
+ Value = AllocateValue(g, Type, Len, prec);
/*********************************************************************/
/* Converting STRING to DATE can be done according to date format. */
@@ -848,7 +848,7 @@ void *ARRAY::GetSortIndex(PGLOBAL g)
/* the indication of whether the Find will be always true, always not */
/* true or other. */
/***********************************************************************/
-int ARRAY::BlockTest(PGLOBAL g, int opc, int opm,
+int ARRAY::BlockTest(PGLOBAL, int opc, int opm,
void *minp, void *maxp, bool s)
{
bool bin, bax, pin, pax, veq, all = (opm == 2);
@@ -1038,7 +1038,7 @@ void ARRAY::Print(PGLOBAL g, FILE *f, uint n)
/***********************************************************************/
/* Make string output of ARRAY contents. */
/***********************************************************************/
-void ARRAY::Print(PGLOBAL g, char *ps, uint z)
+void ARRAY::Print(PGLOBAL, char *ps, uint z)
{
if (z < 16)
return;
diff --git a/storage/connect/array.h b/storage/connect/array.h
index 4a818414e9c..6fb38ae6b47 100644
--- a/storage/connect/array.h
+++ b/storage/connect/array.h
@@ -50,6 +50,7 @@ class DllExport ARRAY : public XOBJECT, public CSORT { // Array descblock
// void SetCorrel(bool b) {Correlated = b;}
// Methods
+ using XOBJECT::GetIntValue;
virtual void Reset(void) {Bot = -1;}
virtual int Qcompare(int *, int *);
virtual bool Compare(PXOB) {assert(FALSE); return FALSE;}
diff --git a/storage/connect/blkfil.cpp b/storage/connect/blkfil.cpp
index 802231b24ec..1f5a1a27ae5 100644
--- a/storage/connect/blkfil.cpp
+++ b/storage/connect/blkfil.cpp
@@ -5,7 +5,7 @@
/* */
/* COPYRIGHT: */
/* ---------- */
-/* (C) Copyright to the author Olivier BERTRAND 2004-2014 */
+/* (C) Copyright to the author Olivier BERTRAND 2004-2015 */
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
@@ -20,13 +20,13 @@
#include "sql_class.h"
//#include "sql_time.h"
-#if defined(WIN32)
+#if defined(__WIN__)
//#include <windows.h>
-#else // !WIN32
+#else // !__WIN__
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
-#endif // !WIN32
+#endif // !__WIN__
/***********************************************************************/
/* Include application header files: */
@@ -56,7 +56,7 @@ BLOCKFILTER::BLOCKFILTER(PTDBDOS tdbp, int op)
/***********************************************************************/
/* Make file output of BLOCKFILTER contents. */
/***********************************************************************/
-void BLOCKFILTER::Print(PGLOBAL g, FILE *f, uint n)
+void BLOCKFILTER::Print(PGLOBAL, FILE *f, uint n)
{
char m[64];
@@ -70,7 +70,7 @@ void BLOCKFILTER::Print(PGLOBAL g, FILE *f, uint n)
/***********************************************************************/
/* Make string output of BLOCKFILTER contents. */
/***********************************************************************/
-void BLOCKFILTER::Print(PGLOBAL g, char *ps, uint z)
+void BLOCKFILTER::Print(PGLOBAL, char *ps, uint z)
{
strncat(ps, "BlockFilter(s)", z);
} // end of Print
@@ -186,7 +186,7 @@ void BLKFILARI::Reset(PGLOBAL g)
/***********************************************************************/
/* Evaluate block filter for arithmetic operators. */
/***********************************************************************/
-int BLKFILARI::BlockEval(PGLOBAL g)
+int BLKFILARI::BlockEval(PGLOBAL)
{
int mincmp, maxcmp, n;
@@ -306,7 +306,7 @@ void BLKFILAR2::MakeValueBitmap(void)
/***********************************************************************/
/* Evaluate XDB2 block filter for arithmetic operators. */
/***********************************************************************/
-int BLKFILAR2::BlockEval(PGLOBAL g)
+int BLKFILAR2::BlockEval(PGLOBAL)
{
#if defined(_DEBUG)
assert (Colp->IsClustered());
@@ -428,7 +428,7 @@ void BLKFILMR2::MakeValueBitmap(void)
/***********************************************************************/
/* Evaluate XDB2 block filter for arithmetic operators. */
/***********************************************************************/
-int BLKFILMR2::BlockEval(PGLOBAL g)
+int BLKFILMR2::BlockEval(PGLOBAL)
{
#if defined(_DEBUG)
assert (Colp->IsClustered());
@@ -514,7 +514,7 @@ void BLKSPCARI::Reset(PGLOBAL g)
/***********************************************************************/
/* Evaluate block filter for arithmetic operators (ROWID) */
/***********************************************************************/
-int BLKSPCARI::BlockEval(PGLOBAL g)
+int BLKSPCARI::BlockEval(PGLOBAL)
{
int mincmp, maxcmp, n, m;
@@ -605,7 +605,7 @@ BLKFILIN::BLKFILIN(PGLOBAL g, PTDBDOS tdbp, int op, int opm, PXOB *xp)
/***********************************************************************/
/* Reset: have the sorted array reset its Bot value to -1 (bottom). */
/***********************************************************************/
-void BLKFILIN::Reset(PGLOBAL g)
+void BLKFILIN::Reset(PGLOBAL)
{
Arap->Reset();
// MakeValueBitmap(); // Does nothing for class BLKFILIN
@@ -736,7 +736,7 @@ void BLKFILIN2::MakeValueBitmap(void)
/* ended string in case of string argument. This is because the ARRAY */
/* can have a different width than the char column. */
/***********************************************************************/
-int BLKFILIN2::BlockEval(PGLOBAL g)
+int BLKFILIN2::BlockEval(PGLOBAL)
{
if (N < 0)
return Result; // Was set in MakeValueBitmap
@@ -909,7 +909,7 @@ int BLKFILIN2::BlockEval(PGLOBAL g)
/***********************************************************************/
/* BLKSPCIN constructor. */
/***********************************************************************/
-BLKSPCIN::BLKSPCIN(PGLOBAL g, PTDBDOS tdbp, int op, int opm,
+BLKSPCIN::BLKSPCIN(PGLOBAL, PTDBDOS tdbp, int op, int opm,
PXOB *xp, int bsize)
: BLOCKFILTER(tdbp, op)
{
@@ -930,7 +930,7 @@ BLKSPCIN::BLKSPCIN(PGLOBAL g, PTDBDOS tdbp, int op, int opm,
/***********************************************************************/
/* Reset: have the sorted array reset its Bot value to -1 (bottom). */
/***********************************************************************/
-void BLKSPCIN::Reset(PGLOBAL g)
+void BLKSPCIN::Reset(PGLOBAL)
{
Arap->Reset();
} // end of Reset
diff --git a/storage/connect/block.h b/storage/connect/block.h
index d63a899d1f5..aa4edde5ec9 100644
--- a/storage/connect/block.h
+++ b/storage/connect/block.h
@@ -24,11 +24,11 @@
#if !defined(BLOCK_DEFINED)
#define BLOCK_DEFINED
-#if defined(WIN32) && !defined(NOEX)
+#if defined(__WIN__) && !defined(NOEX)
#define DllExport __declspec( dllexport )
-#else // !WIN32
+#else // !__WIN__
#define DllExport
-#endif // !WIN32
+#endif // !__WIN__
/***********************************************************************/
/* Definition of class BLOCK with its method function new. */
@@ -38,7 +38,7 @@ typedef class BLOCK *PBLOCK;
class DllExport BLOCK {
public:
void * operator new(size_t size, PGLOBAL g, void *p = NULL) {
-// if (trace > 2)
+// if (trace > 3)
// htrc("New BLOCK: size=%d g=%p p=%p\n", size, g, p);
return (PlugSubAlloc(g, p, size));
@@ -50,7 +50,7 @@ class DllExport BLOCK {
#if !defined(__BORLANDC__)
// Avoid warning C4291 by defining a matching dummy delete operator
void operator delete(void *, PGLOBAL, void *) {}
- void operator delete(void *ptr,size_t size) {}
+ void operator delete(void *, size_t) {}
#endif
virtual ~BLOCK() {}
diff --git a/storage/connect/catalog.h b/storage/connect/catalog.h
index 5baab294737..6488b513ba9 100644
--- a/storage/connect/catalog.h
+++ b/storage/connect/catalog.h
@@ -1,7 +1,7 @@
/*************** Catalog H Declares Source Code File (.H) **************/
/* Name: CATALOG.H Version 3.3 */
/* */
-/* (C) Copyright to the author Olivier BERTRAND 2000-2014 */
+/* (C) Copyright to the author Olivier BERTRAND 2000-2015 */
/* */
/* This file contains the CATALOG PlugDB classes definitions. */
/***********************************************************************/
@@ -73,33 +73,29 @@ class DllExport CATALOG {
// Methods
virtual void Reset(void) {}
//virtual void SetDataPath(PGLOBAL g, const char *path) {}
- virtual bool CheckName(PGLOBAL g, char *name) {return true;}
- virtual bool ClearName(PGLOBAL g, PSZ name) {return true;}
- virtual PRELDEF MakeOneTableDesc(PGLOBAL g, LPCSTR name, LPCSTR am) {return NULL;}
- virtual PRELDEF GetTableDescEx(PGLOBAL g, PTABLE tablep) {return NULL;}
- virtual PRELDEF GetTableDesc(PGLOBAL g, LPCSTR name, LPCSTR type,
- PRELDEF *prp = NULL) {return NULL;}
- virtual PRELDEF GetFirstTable(PGLOBAL g) {return NULL;}
- virtual PRELDEF GetNextTable(PGLOBAL g) {return NULL;}
- virtual bool TestCond(PGLOBAL g, const char *name, const char *type)
- {return true;}
- virtual bool DropTable(PGLOBAL g, PSZ name, bool erase) {return true;}
- virtual PTDB GetTable(PGLOBAL g, PTABLE tablep,
- MODE mode = MODE_READ, LPCSTR type = NULL)
- {return NULL;}
- virtual void TableNames(PGLOBAL g, char *buffer, int maxbuf, int info[]) {}
- virtual void ColumnNames(PGLOBAL g, char *tabname, char *buffer,
- int maxbuf, int info[]) {}
- virtual void ColumnDefs(PGLOBAL g, char *tabname, char *buffer,
- int maxbuf, int info[]) {}
- virtual void *DecodeValues(PGLOBAL g, char *tabname, char *colname,
- char *buffer, int maxbuf, int info[]) {return NULL;}
- virtual int ColumnType(PGLOBAL g, char *tabname, char *colname) {return 0;}
- virtual void ClearDB(PGLOBAL g) {}
+ virtual bool CheckName(PGLOBAL, char*) {return true;}
+ virtual bool ClearName(PGLOBAL, PSZ) {return true;}
+ virtual PRELDEF MakeOneTableDesc(PGLOBAL, LPCSTR, LPCSTR) {return NULL;}
+ virtual PRELDEF GetTableDescEx(PGLOBAL, PTABLE) {return NULL;}
+ virtual PRELDEF GetTableDesc(PGLOBAL, LPCSTR, LPCSTR,
+ PRELDEF* = NULL) {return NULL;}
+ virtual PRELDEF GetFirstTable(PGLOBAL) {return NULL;}
+ virtual PRELDEF GetNextTable(PGLOBAL) {return NULL;}
+ virtual bool TestCond(PGLOBAL, const char*, const char*) {return true;}
+ virtual bool DropTable(PGLOBAL, PSZ, bool) {return true;}
+ virtual PTDB GetTable(PGLOBAL, PTABLE,
+ MODE = MODE_READ, LPCSTR = NULL) {return NULL;}
+ virtual void TableNames(PGLOBAL, char*, int, int[]) {}
+ virtual void ColumnNames(PGLOBAL, char*, char*, int, int[]) {}
+ virtual void ColumnDefs(PGLOBAL, char*, char*, int, int[]) {}
+ virtual void *DecodeValues(PGLOBAL, char*, char*, char*,
+ int, int[]) {return NULL;}
+ virtual int ColumnType(PGLOBAL, char*, char*) {return 0;}
+ virtual void ClearDB(PGLOBAL) {}
protected:
- virtual bool ClearSection(PGLOBAL g, const char *key, const char *section) {return true;}
- virtual PRELDEF MakeTableDesc(PGLOBAL g, LPCSTR name, LPCSTR am) {return NULL;}
+ virtual bool ClearSection(PGLOBAL, const char*, const char*) {return true;}
+ virtual PRELDEF MakeTableDesc(PGLOBAL, LPCSTR, LPCSTR) {return NULL;}
// Members
char *Cbuf; /* Buffer used for col section */
diff --git a/storage/connect/checklvl.h b/storage/connect/checklvl.h
index d1e37afbc93..0c234dfb8b8 100644
--- a/storage/connect/checklvl.h
+++ b/storage/connect/checklvl.h
@@ -40,4 +40,11 @@ enum USETEMP {TMP_NO = 0, /* Never */
TMP_FORCE = 3, /* Forced for MAP tables */
TMP_TEST = 4}; /* Testing value */
+/***********************************************************************/
+/* Following definitions indicate conversion of TEXT columns. */
+/***********************************************************************/
+enum TYPCONV {TPC_NO = 0, /* Never */
+ TPC_YES = 1, /* Always */
+ TPC_SKIP = 2}; /* Skip TEXT columns */
+
#endif // _CHKLVL_DEFINED_
diff --git a/storage/connect/colblk.cpp b/storage/connect/colblk.cpp
index 78aba7bc494..80b405be041 100644
--- a/storage/connect/colblk.cpp
+++ b/storage/connect/colblk.cpp
@@ -1,417 +1,417 @@
-/************* Colblk C++ Functions Source Code File (.CPP) ************/
-/* Name: COLBLK.CPP Version 2.1 */
-/* */
-/* (C) Copyright to the author Olivier BERTRAND 1998-2014 */
-/* */
-/* This file contains the COLBLK class functions. */
-/***********************************************************************/
-
-/***********************************************************************/
-/* Include relevant 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 "tabcol.h"
-#include "colblk.h"
-#include "xindex.h"
-#include "xtable.h"
-
-/***********************************************************************/
-/* COLBLK protected constructor. */
-/***********************************************************************/
-COLBLK::COLBLK(PCOLDEF cdp, PTDB tdbp, int i)
- {
- Next = NULL;
- Index = i;
-//Number = 0;
- ColUse = 0;
-
- if ((Cdp = cdp)) {
- Name = cdp->Name;
- Format = cdp->F;
- Opt = cdp->Opt;
- Long = cdp->Long;
- Precision = cdp->Precision;
- Freq = cdp->Freq;
- Buf_Type = cdp->Buf_Type;
- ColUse |= cdp->Flags; // Used by CONNECT
- Nullable = !!(cdp->Flags & U_NULLS);
- Unsigned = !!(cdp->Flags & U_UNSIGNED);
- } else {
- Name = NULL;
- memset(&Format, 0, sizeof(FORMAT));
- Opt = 0;
- Long = 0;
- Precision = 0;
- Freq = 0;
- Buf_Type = TYPE_ERROR;
- Nullable = false;
- Unsigned = false;
- } // endif cdp
-
- To_Tdb = tdbp;
- Status = BUF_NO;
-//Value = NULL; done in XOBJECT constructor
- To_Kcol = NULL;
- } // end of COLBLK constructor
-
-/***********************************************************************/
-/* COLBLK constructor used for copying columns. */
-/* tdbp is the pointer to the new table descriptor. */
-/***********************************************************************/
-COLBLK::COLBLK(PCOL col1, PTDB tdbp)
- {
- PCOL colp;
-
- // Copy the old column block to the new one
- *this = *col1;
- Next = NULL;
-//To_Orig = col1;
- To_Tdb = tdbp;
-
- if (trace > 1)
- htrc(" copying COLBLK %s from %p to %p\n", Name, col1, this);
-
- if (tdbp)
- // Attach the new column to the table block
- if (!tdbp->GetColumns())
- tdbp->SetColumns(this);
- else {
- for (colp = tdbp->GetColumns(); colp->Next; colp = colp->Next) ;
-
- colp->Next = this;
- } // endelse
-
- } // end of COLBLK copy constructor
-
-/***********************************************************************/
-/* Reset the column descriptor to non evaluated yet. */
-/***********************************************************************/
-void COLBLK::Reset(void)
- {
- Status &= ~BUF_READ;
- } // end of Reset
-
-/***********************************************************************/
-/* Compare: compares itself to an (expression) object and returns */
-/* true if it is equivalent. */
-/***********************************************************************/
-bool COLBLK::Compare(PXOB xp)
- {
- return (this == xp);
- } // end of Compare
-
-/***********************************************************************/
-/* SetFormat: function used to set SELECT output format. */
-/***********************************************************************/
-bool COLBLK::SetFormat(PGLOBAL g, FORMAT& fmt)
- {
- fmt = Format;
-
- if (trace > 1)
- htrc("COLBLK: %p format=%c(%d,%d)\n",
- this, *fmt.Type, fmt.Length, fmt.Prec);
-
- return false;
- } // end of SetFormat
-
-/***********************************************************************/
-/* Eval: get the column value from the last read record or from a */
-/* matching Index column if there is one. */
-/***********************************************************************/
-bool COLBLK::Eval(PGLOBAL g)
- {
- if (trace > 1)
- htrc("Col Eval: %s status=%.4X\n", Name, Status);
-
- if (!GetStatus(BUF_READ)) {
-// if (To_Tdb->IsNull())
-// Value->Reset();
- if (To_Kcol)
- To_Kcol->FillValue(Value);
- else
- ReadColumn(g);
-
- AddStatus(BUF_READ);
- } // endif
-
- return false;
- } // end of Eval
-
-/***********************************************************************/
-/* InitValue: prepare a column block for read operation. */
-/* Now we use Format.Length for the len parameter to avoid strings */
-/* to be truncated when converting from string to coded string. */
-/* Added in version 1.5 is the arguments GetScale() and Domain */
-/* in calling AllocateValue. Domain is used for TYPE_DATE only. */
-/***********************************************************************/
-bool COLBLK::InitValue(PGLOBAL g)
- {
- if (Value)
- return false; // Already done
-
- // Allocate a Value object
- if (!(Value = AllocateValue(g, Buf_Type, Precision,
- GetScale(), Unsigned, GetDomain())))
- return true;
-
- AddStatus(BUF_READY);
- Value->SetNullable(Nullable);
-
- if (trace > 1)
- htrc(" colp=%p type=%d value=%p coluse=%.4X status=%.4X\n",
- this, Buf_Type, Value, ColUse, Status);
-
- return false;
- } // end of InitValue
-
-/***********************************************************************/
-/* SetBuffer: prepare a column block for write operation. */
-/***********************************************************************/
-bool COLBLK::SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check)
- {
- sprintf(g->Message, MSG(UNDEFINED_AM), "SetBuffer");
- return true;
- } // end of SetBuffer
-
-/***********************************************************************/
-/* GetLength: returns an evaluation of the column string length. */
-/***********************************************************************/
-int COLBLK::GetLengthEx(void)
- {
- return Long;
- } // end of GetLengthEx
-
-/***********************************************************************/
-/* ReadColumn: what this routine does is to access the last line */
-/* read from the corresponding table, extract from it the field */
-/* corresponding to this column and convert it to buffer type. */
-/***********************************************************************/
-void COLBLK::ReadColumn(PGLOBAL g)
- {
- sprintf(g->Message, MSG(UNDEFINED_AM), "ReadColumn");
- longjmp(g->jumper[g->jump_level], TYPE_COLBLK);
- } // end of ReadColumn
-
-/***********************************************************************/
-/* WriteColumn: what this routine does is to access the last line */
-/* read from the corresponding table, and rewrite the field */
-/* corresponding to this column from the column buffer and type. */
-/***********************************************************************/
-void COLBLK::WriteColumn(PGLOBAL g)
- {
- sprintf(g->Message, MSG(UNDEFINED_AM), "WriteColumn");
- longjmp(g->jumper[g->jump_level], TYPE_COLBLK);
- } // end of WriteColumn
-
-/***********************************************************************/
-/* Make file output of a column descriptor block. */
-/***********************************************************************/
-void COLBLK::Print(PGLOBAL g, FILE *f, uint n)
- {
- char m[64];
- int i;
- PCOL colp;
-
- memset(m, ' ', n); // Make margin string
- m[n] = '\0';
-
- for (colp = To_Tdb->GetColumns(), i = 1; colp; colp = colp->Next, i++)
- if (colp == this)
- break;
-
- fprintf(f, "%sR%dC%d type=%d F=%.2s(%d,%d)", m, To_Tdb->GetTdb_No(),
- i, GetAmType(), Format.Type, Format.Length, Format.Prec);
- fprintf(f,
- " coluse=%04X status=%04X buftyp=%d value=%p name=%s\n",
- ColUse, Status, Buf_Type, Value, Name);
- } // end of Print
-
-/***********************************************************************/
-/* Make string output of a column descriptor block. */
-/***********************************************************************/
-void COLBLK::Print(PGLOBAL g, char *ps, uint z)
- {
- sprintf(ps, "R%d.%s", To_Tdb->GetTdb_No(), Name);
- } // end of Print
-
-
-/***********************************************************************/
-/* SPCBLK constructor. */
-/***********************************************************************/
-SPCBLK::SPCBLK(PCOLUMN cp)
- : COLBLK((PCOLDEF)NULL, cp->GetTo_Table()->GetTo_Tdb(), 0)
- {
- Name = (char*)cp->GetName();
- Precision = Long = 0;
- Buf_Type = TYPE_ERROR;
- } // end of SPCBLK constructor
-
-/***********************************************************************/
-/* WriteColumn: what this routine does is to access the last line */
-/* read from the corresponding table, and rewrite the field */
-/* corresponding to this column from the column buffer and type. */
-/***********************************************************************/
-void SPCBLK::WriteColumn(PGLOBAL g)
- {
- sprintf(g->Message, MSG(SPCOL_READONLY), Name);
- longjmp(g->jumper[g->jump_level], TYPE_COLBLK);
- } // end of WriteColumn
-
-/***********************************************************************/
-/* RIDBLK constructor for the ROWID special column. */
-/***********************************************************************/
-RIDBLK::RIDBLK(PCOLUMN cp, bool rnm) : SPCBLK(cp)
- {
- Precision = Long = 10;
- Buf_Type = TYPE_INT;
- Rnm = rnm;
- *Format.Type = 'N';
- Format.Length = 10;
- } // end of RIDBLK constructor
-
-/***********************************************************************/
-/* ReadColumn: what this routine does is to return the ordinal */
-/* number of the current row in the table (if Rnm is true) or in the */
-/* current file (if Rnm is false) the same except for multiple tables.*/
-/***********************************************************************/
-void RIDBLK::ReadColumn(PGLOBAL g)
- {
- Value->SetValue(To_Tdb->RowNumber(g, Rnm));
- } // end of ReadColumn
-
-/***********************************************************************/
-/* FIDBLK constructor for the FILEID special column. */
-/***********************************************************************/
-FIDBLK::FIDBLK(PCOLUMN cp, OPVAL op) : SPCBLK(cp), Op(op)
- {
-//Is_Key = 2; for when the MUL table indexed reading will be implemented.
- Precision = Long = _MAX_PATH;
- Buf_Type = TYPE_STRING;
- *Format.Type = 'C';
- Format.Length = Long;
-#if defined(WIN32)
- Format.Prec = 1; // Case insensitive
-#endif // WIN32
- Constant = (!((PTDBASE)To_Tdb)->GetDef()->GetMultiple() &&
- To_Tdb->GetAmType() != TYPE_AM_PLG &&
- To_Tdb->GetAmType() != TYPE_AM_PLM);
- Fn = NULL;
- } // end of FIDBLK constructor
-
-/***********************************************************************/
-/* ReadColumn: what this routine does is to return the current */
-/* file ID of the table (can change for Multiple tables). */
-/***********************************************************************/
-void FIDBLK::ReadColumn(PGLOBAL g)
- {
- if (Fn != ((PTDBASE)To_Tdb)->GetFile(g)) {
- char filename[_MAX_PATH];
-
- Fn = ((PTDBASE)To_Tdb)->GetFile(g);
- PlugSetPath(filename, Fn, ((PTDBASE)To_Tdb)->GetPath());
-
- if (Op != OP_XX) {
- char buff[_MAX_PATH];
-
- Value->SetValue_psz(ExtractFromPath(g, buff, filename, Op));
- } else
- Value->SetValue_psz(filename);
-
- } // endif Fn
-
- } // end of ReadColumn
-
-/***********************************************************************/
-/* TIDBLK constructor for the TABID special column. */
-/***********************************************************************/
-TIDBLK::TIDBLK(PCOLUMN cp) : SPCBLK(cp)
- {
-//Is_Key = 2; for when the MUL table indexed reading will be implemented.
- Precision = Long = 64;
- Buf_Type = TYPE_STRING;
- *Format.Type = 'C';
- Format.Length = Long;
- Format.Prec = 1; // Case insensitive
- Constant = (To_Tdb->GetAmType() != TYPE_AM_TBL);
- Tname = NULL;
- } // end of TIDBLK constructor
-
-/***********************************************************************/
-/* ReadColumn: what this routine does is to return the table ID. */
-/***********************************************************************/
-void TIDBLK::ReadColumn(PGLOBAL g)
- {
- if (Tname == NULL) {
- Tname = (char*)To_Tdb->GetName();
- Value->SetValue_psz(Tname);
- } // endif Tname
-
- } // end of ReadColumn
-
-/***********************************************************************/
-/* PRTBLK constructor for the PARTID special column. */
-/***********************************************************************/
-PRTBLK::PRTBLK(PCOLUMN cp) : SPCBLK(cp)
- {
-//Is_Key = 2; for when the MUL table indexed reading will be implemented.
- Precision = Long = 64;
- Buf_Type = TYPE_STRING;
- *Format.Type = 'C';
- Format.Length = Long;
- Format.Prec = 1; // Case insensitive
- Constant = true; // TODO: check whether this is true indeed
- Pname = NULL;
- } // end of PRTBLK constructor
-
-/***********************************************************************/
-/* ReadColumn: what this routine does is to return the partition ID. */
-/***********************************************************************/
-void PRTBLK::ReadColumn(PGLOBAL g)
- {
- if (Pname == NULL) {
- char *p;
- PTDBASE tdbp = (PTDBASE)To_Tdb;
-
- Pname = tdbp->GetDef()->GetStringCatInfo(g, "partname", "?");
-
- p = strrchr(Pname, '#');
- Value->SetValue_psz((p) ? p + 1 : Pname);
- } // endif Pname
-
- } // end of ReadColumn
-
-/***********************************************************************/
-/* SIDBLK constructor for the SERVID special column. */
-/***********************************************************************/
-SIDBLK::SIDBLK(PCOLUMN cp) : SPCBLK(cp)
- {
-//Is_Key = 2; for when the MUL table indexed reading will be implemented.
- Precision = Long = 64;
- Buf_Type = TYPE_STRING;
- *Format.Type = 'C';
- Format.Length = Long;
- Format.Prec = 1; // Case insensitive
- Constant = (To_Tdb->GetAmType() != TYPE_AM_TBL);
- Sname = NULL;
- } // end of TIDBLK constructor
-
-/***********************************************************************/
-/* ReadColumn: what this routine does is to return the server ID. */
-/***********************************************************************/
-void SIDBLK::ReadColumn(PGLOBAL g)
- {
-//if (Sname == NULL) {
- Sname = (char*)To_Tdb->GetServer();
- Value->SetValue_psz(Sname);
-// } // endif Sname
-
- } // end of ReadColumn
-
+/************* Colblk C++ Functions Source Code File (.CPP) ************/
+/* Name: COLBLK.CPP Version 2.1 */
+/* */
+/* (C) Copyright to the author Olivier BERTRAND 1998-2015 */
+/* */
+/* This file contains the COLBLK class functions. */
+/***********************************************************************/
+
+/***********************************************************************/
+/* Include relevant 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 "tabcol.h"
+#include "colblk.h"
+#include "xindex.h"
+#include "xtable.h"
+
+/***********************************************************************/
+/* COLBLK protected constructor. */
+/***********************************************************************/
+COLBLK::COLBLK(PCOLDEF cdp, PTDB tdbp, int i)
+ {
+ Next = NULL;
+ Index = i;
+//Number = 0;
+ ColUse = 0;
+
+ if ((Cdp = cdp)) {
+ Name = cdp->Name;
+ Format = cdp->F;
+ Opt = cdp->Opt;
+ Long = cdp->Long;
+ Precision = cdp->Precision;
+ Freq = cdp->Freq;
+ Buf_Type = cdp->Buf_Type;
+ ColUse |= cdp->Flags; // Used by CONNECT
+ Nullable = !!(cdp->Flags & U_NULLS);
+ Unsigned = !!(cdp->Flags & U_UNSIGNED);
+ } else {
+ Name = NULL;
+ memset(&Format, 0, sizeof(FORMAT));
+ Opt = 0;
+ Long = 0;
+ Precision = 0;
+ Freq = 0;
+ Buf_Type = TYPE_ERROR;
+ Nullable = false;
+ Unsigned = false;
+ } // endif cdp
+
+ To_Tdb = tdbp;
+ Status = BUF_NO;
+//Value = NULL; done in XOBJECT constructor
+ To_Kcol = NULL;
+ } // end of COLBLK constructor
+
+/***********************************************************************/
+/* COLBLK constructor used for copying columns. */
+/* tdbp is the pointer to the new table descriptor. */
+/***********************************************************************/
+COLBLK::COLBLK(PCOL col1, PTDB tdbp)
+ {
+ PCOL colp;
+
+ // Copy the old column block to the new one
+ *this = *col1;
+ Next = NULL;
+//To_Orig = col1;
+ To_Tdb = tdbp;
+
+ if (trace > 1)
+ htrc(" copying COLBLK %s from %p to %p\n", Name, col1, this);
+
+ if (tdbp)
+ // Attach the new column to the table block
+ if (!tdbp->GetColumns())
+ tdbp->SetColumns(this);
+ else {
+ for (colp = tdbp->GetColumns(); colp->Next; colp = colp->Next) ;
+
+ colp->Next = this;
+ } // endelse
+
+ } // end of COLBLK copy constructor
+
+/***********************************************************************/
+/* Reset the column descriptor to non evaluated yet. */
+/***********************************************************************/
+void COLBLK::Reset(void)
+ {
+ Status &= ~BUF_READ;
+ } // end of Reset
+
+/***********************************************************************/
+/* Compare: compares itself to an (expression) object and returns */
+/* true if it is equivalent. */
+/***********************************************************************/
+bool COLBLK::Compare(PXOB xp)
+ {
+ return (this == xp);
+ } // end of Compare
+
+/***********************************************************************/
+/* SetFormat: function used to set SELECT output format. */
+/***********************************************************************/
+bool COLBLK::SetFormat(PGLOBAL, FORMAT& fmt)
+ {
+ fmt = Format;
+
+ if (trace > 1)
+ htrc("COLBLK: %p format=%c(%d,%d)\n",
+ this, *fmt.Type, fmt.Length, fmt.Prec);
+
+ return false;
+ } // end of SetFormat
+
+/***********************************************************************/
+/* Eval: get the column value from the last read record or from a */
+/* matching Index column if there is one. */
+/***********************************************************************/
+bool COLBLK::Eval(PGLOBAL g)
+ {
+ if (trace > 1)
+ htrc("Col Eval: %s status=%.4X\n", Name, Status);
+
+ if (!GetStatus(BUF_READ)) {
+// if (To_Tdb->IsNull())
+// Value->Reset();
+ if (To_Kcol)
+ To_Kcol->FillValue(Value);
+ else
+ ReadColumn(g);
+
+ AddStatus(BUF_READ);
+ } // endif
+
+ return false;
+ } // end of Eval
+
+/***********************************************************************/
+/* InitValue: prepare a column block for read operation. */
+/* Now we use Format.Length for the len parameter to avoid strings */
+/* to be truncated when converting from string to coded string. */
+/* Added in version 1.5 is the arguments GetScale() and Domain */
+/* in calling AllocateValue. Domain is used for TYPE_DATE only. */
+/***********************************************************************/
+bool COLBLK::InitValue(PGLOBAL g)
+ {
+ if (Value)
+ return false; // Already done
+
+ // Allocate a Value object
+ if (!(Value = AllocateValue(g, Buf_Type, Precision,
+ GetScale(), Unsigned, GetDomain())))
+ return true;
+
+ AddStatus(BUF_READY);
+ Value->SetNullable(Nullable);
+
+ if (trace > 1)
+ htrc(" colp=%p type=%d value=%p coluse=%.4X status=%.4X\n",
+ this, Buf_Type, Value, ColUse, Status);
+
+ return false;
+ } // end of InitValue
+
+/***********************************************************************/
+/* SetBuffer: prepare a column block for write operation. */
+/***********************************************************************/
+bool COLBLK::SetBuffer(PGLOBAL g, PVAL, bool, bool)
+ {
+ sprintf(g->Message, MSG(UNDEFINED_AM), "SetBuffer");
+ return true;
+ } // end of SetBuffer
+
+/***********************************************************************/
+/* GetLength: returns an evaluation of the column string length. */
+/***********************************************************************/
+int COLBLK::GetLengthEx(void)
+ {
+ return Long;
+ } // end of GetLengthEx
+
+/***********************************************************************/
+/* ReadColumn: what this routine does is to access the last line */
+/* read from the corresponding table, extract from it the field */
+/* corresponding to this column and convert it to buffer type. */
+/***********************************************************************/
+void COLBLK::ReadColumn(PGLOBAL g)
+ {
+ sprintf(g->Message, MSG(UNDEFINED_AM), "ReadColumn");
+ longjmp(g->jumper[g->jump_level], TYPE_COLBLK);
+ } // end of ReadColumn
+
+/***********************************************************************/
+/* WriteColumn: what this routine does is to access the last line */
+/* read from the corresponding table, and rewrite the field */
+/* corresponding to this column from the column buffer and type. */
+/***********************************************************************/
+void COLBLK::WriteColumn(PGLOBAL g)
+ {
+ sprintf(g->Message, MSG(UNDEFINED_AM), "WriteColumn");
+ longjmp(g->jumper[g->jump_level], TYPE_COLBLK);
+ } // end of WriteColumn
+
+/***********************************************************************/
+/* Make file output of a column descriptor block. */
+/***********************************************************************/
+void COLBLK::Print(PGLOBAL, FILE *f, uint n)
+ {
+ char m[64];
+ int i;
+ PCOL colp;
+
+ memset(m, ' ', n); // Make margin string
+ m[n] = '\0';
+
+ for (colp = To_Tdb->GetColumns(), i = 1; colp; colp = colp->Next, i++)
+ if (colp == this)
+ break;
+
+ fprintf(f, "%sR%dC%d type=%d F=%.2s(%d,%d)", m, To_Tdb->GetTdb_No(),
+ i, GetAmType(), Format.Type, Format.Length, Format.Prec);
+ fprintf(f,
+ " coluse=%04X status=%04X buftyp=%d value=%p name=%s\n",
+ ColUse, Status, Buf_Type, Value, Name);
+ } // end of Print
+
+/***********************************************************************/
+/* Make string output of a column descriptor block. */
+/***********************************************************************/
+void COLBLK::Print(PGLOBAL, char *ps, uint)
+ {
+ sprintf(ps, "R%d.%s", To_Tdb->GetTdb_No(), Name);
+ } // end of Print
+
+
+/***********************************************************************/
+/* SPCBLK constructor. */
+/***********************************************************************/
+SPCBLK::SPCBLK(PCOLUMN cp)
+ : COLBLK((PCOLDEF)NULL, cp->GetTo_Table()->GetTo_Tdb(), 0)
+ {
+ Name = (char*)cp->GetName();
+ Precision = Long = 0;
+ Buf_Type = TYPE_ERROR;
+ } // end of SPCBLK constructor
+
+/***********************************************************************/
+/* WriteColumn: what this routine does is to access the last line */
+/* read from the corresponding table, and rewrite the field */
+/* corresponding to this column from the column buffer and type. */
+/***********************************************************************/
+void SPCBLK::WriteColumn(PGLOBAL g)
+ {
+ sprintf(g->Message, MSG(SPCOL_READONLY), Name);
+ longjmp(g->jumper[g->jump_level], TYPE_COLBLK);
+ } // end of WriteColumn
+
+/***********************************************************************/
+/* RIDBLK constructor for the ROWID special column. */
+/***********************************************************************/
+RIDBLK::RIDBLK(PCOLUMN cp, bool rnm) : SPCBLK(cp)
+ {
+ Precision = Long = 10;
+ Buf_Type = TYPE_INT;
+ Rnm = rnm;
+ *Format.Type = 'N';
+ Format.Length = 10;
+ } // end of RIDBLK constructor
+
+/***********************************************************************/
+/* ReadColumn: what this routine does is to return the ordinal */
+/* number of the current row in the table (if Rnm is true) or in the */
+/* current file (if Rnm is false) the same except for multiple tables.*/
+/***********************************************************************/
+void RIDBLK::ReadColumn(PGLOBAL g)
+ {
+ Value->SetValue(To_Tdb->RowNumber(g, Rnm));
+ } // end of ReadColumn
+
+/***********************************************************************/
+/* FIDBLK constructor for the FILEID special column. */
+/***********************************************************************/
+FIDBLK::FIDBLK(PCOLUMN cp, OPVAL op) : SPCBLK(cp), Op(op)
+ {
+//Is_Key = 2; for when the MUL table indexed reading will be implemented.
+ Precision = Long = _MAX_PATH;
+ Buf_Type = TYPE_STRING;
+ *Format.Type = 'C';
+ Format.Length = Long;
+#if defined(__WIN__)
+ Format.Prec = 1; // Case insensitive
+#endif // __WIN__
+ Constant = (!((PTDBASE)To_Tdb)->GetDef()->GetMultiple() &&
+ To_Tdb->GetAmType() != TYPE_AM_PLG &&
+ To_Tdb->GetAmType() != TYPE_AM_PLM);
+ Fn = NULL;
+ } // end of FIDBLK constructor
+
+/***********************************************************************/
+/* ReadColumn: what this routine does is to return the current */
+/* file ID of the table (can change for Multiple tables). */
+/***********************************************************************/
+void FIDBLK::ReadColumn(PGLOBAL g)
+ {
+ if (Fn != ((PTDBASE)To_Tdb)->GetFile(g)) {
+ char filename[_MAX_PATH];
+
+ Fn = ((PTDBASE)To_Tdb)->GetFile(g);
+ PlugSetPath(filename, Fn, ((PTDBASE)To_Tdb)->GetPath());
+
+ if (Op != OP_XX) {
+ char buff[_MAX_PATH];
+
+ Value->SetValue_psz(ExtractFromPath(g, buff, filename, Op));
+ } else
+ Value->SetValue_psz(filename);
+
+ } // endif Fn
+
+ } // end of ReadColumn
+
+/***********************************************************************/
+/* TIDBLK constructor for the TABID special column. */
+/***********************************************************************/
+TIDBLK::TIDBLK(PCOLUMN cp) : SPCBLK(cp)
+ {
+//Is_Key = 2; for when the MUL table indexed reading will be implemented.
+ Precision = Long = 64;
+ Buf_Type = TYPE_STRING;
+ *Format.Type = 'C';
+ Format.Length = Long;
+ Format.Prec = 1; // Case insensitive
+ Constant = (To_Tdb->GetAmType() != TYPE_AM_TBL);
+ Tname = NULL;
+ } // end of TIDBLK constructor
+
+/***********************************************************************/
+/* ReadColumn: what this routine does is to return the table ID. */
+/***********************************************************************/
+void TIDBLK::ReadColumn(PGLOBAL)
+ {
+ if (Tname == NULL) {
+ Tname = (char*)To_Tdb->GetName();
+ Value->SetValue_psz(Tname);
+ } // endif Tname
+
+ } // end of ReadColumn
+
+/***********************************************************************/
+/* PRTBLK constructor for the PARTID special column. */
+/***********************************************************************/
+PRTBLK::PRTBLK(PCOLUMN cp) : SPCBLK(cp)
+ {
+//Is_Key = 2; for when the MUL table indexed reading will be implemented.
+ Precision = Long = 64;
+ Buf_Type = TYPE_STRING;
+ *Format.Type = 'C';
+ Format.Length = Long;
+ Format.Prec = 1; // Case insensitive
+ Constant = true; // TODO: check whether this is true indeed
+ Pname = NULL;
+ } // end of PRTBLK constructor
+
+/***********************************************************************/
+/* ReadColumn: what this routine does is to return the partition ID. */
+/***********************************************************************/
+void PRTBLK::ReadColumn(PGLOBAL g)
+ {
+ if (Pname == NULL) {
+ char *p;
+ PTDBASE tdbp = (PTDBASE)To_Tdb;
+
+ Pname = tdbp->GetDef()->GetStringCatInfo(g, "partname", "?");
+
+ p = strrchr(Pname, '#');
+ Value->SetValue_psz((p) ? p + 1 : Pname);
+ } // endif Pname
+
+ } // end of ReadColumn
+
+/***********************************************************************/
+/* SIDBLK constructor for the SERVID special column. */
+/***********************************************************************/
+SIDBLK::SIDBLK(PCOLUMN cp) : SPCBLK(cp)
+ {
+//Is_Key = 2; for when the MUL table indexed reading will be implemented.
+ Precision = Long = 64;
+ Buf_Type = TYPE_STRING;
+ *Format.Type = 'C';
+ Format.Length = Long;
+ Format.Prec = 1; // Case insensitive
+ Constant = (To_Tdb->GetAmType() != TYPE_AM_TBL);
+ Sname = NULL;
+ } // end of TIDBLK constructor
+
+/***********************************************************************/
+/* ReadColumn: what this routine does is to return the server ID. */
+/***********************************************************************/
+void SIDBLK::ReadColumn(PGLOBAL)
+ {
+//if (Sname == NULL) {
+ Sname = (char*)To_Tdb->GetServer();
+ Value->SetValue_psz(Sname);
+// } // endif Sname
+
+ } // end of ReadColumn
+
diff --git a/storage/connect/colblk.h b/storage/connect/colblk.h
index 5e8dc77ff69..c64f9d95129 100644
--- a/storage/connect/colblk.h
+++ b/storage/connect/colblk.h
@@ -1,7 +1,7 @@
/*************** Colblk H Declares Source Code File (.H) ***************/
/* Name: COLBLK.H Version 1.7 */
/* */
-/* (C) Copyright to the author Olivier BERTRAND 2005-2014 */
+/* (C) Copyright to the author Olivier BERTRAND 2005-2015 */
/* */
/* This file contains the COLBLK and derived classes declares. */
/***********************************************************************/
@@ -23,7 +23,7 @@ class DllExport COLBLK : public XOBJECT {
// Default constructors used by derived classes
COLBLK(PCOLDEF cdp = NULL, PTDB tdbp = NULL, int i = 0);
COLBLK(PCOL colp, PTDB tdbp = NULL); // Used in copy process
- COLBLK(int n) {} // Used when changing a column class in TDBXML
+ COLBLK(int) {} // Used when changing a column class in TDBXML
public:
// Implementation
@@ -69,7 +69,7 @@ class DllExport COLBLK : public XOBJECT {
virtual bool IsSpecial(void) {return false;}
virtual bool Eval(PGLOBAL g);
virtual bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check);
- virtual void SetTo_Val(PVAL valp) {}
+ virtual void SetTo_Val(PVAL) {}
virtual void ReadColumn(PGLOBAL g);
virtual void WriteColumn(PGLOBAL g);
virtual void Print(PGLOBAL g, FILE *, uint);
diff --git a/storage/connect/connect.cc b/storage/connect/connect.cc
index a54d8ebcc44..4e554b16638 100644
--- a/storage/connect/connect.cc
+++ b/storage/connect/connect.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) Olivier Bertrand 2004 - 2012
+/* Copyright (C) Olivier Bertrand 2004 - 2015
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
@@ -15,7 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/***********************************************************************/
-/* Author Olivier BERTRAND bertrandop@gmail.com 2004-2012 */
+/* Author Olivier BERTRAND bertrandop@gmail.com 2004-2015 */
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
@@ -42,7 +42,6 @@
#include "tabcol.h"
#include "catalog.h"
#include "ha_connect.h"
-#include "mycat.h"
#define my_strupr(p) my_caseup_str(default_charset_info, (p));
#define my_strlwr(p) my_casedn_str(default_charset_info, (p));
@@ -238,7 +237,7 @@ PTDB CntGetTDB(PGLOBAL g, LPCSTR name, MODE mode, PHC h)
/* OPENTAB: Open a Table. */
/***********************************************************************/
bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2,
- bool del, PHC h)
+ bool del, PHC)
{
char *p;
int i, n, rc;
@@ -469,9 +468,12 @@ RCODE CntReadNext(PGLOBAL g, PTDB tdbp)
} while (rc == RC_NF);
+ if (rc == RC_OK)
+ rc= EvalColumns(g, tdbp, false);
+
err:
g->jump_level--;
- return (rc != RC_OK) ? rc : EvalColumns(g, tdbp, false);
+ return rc;
} // end of CntReadNext
/***********************************************************************/
@@ -707,6 +709,28 @@ int CntIndexInit(PGLOBAL g, PTDB ptdb, int id, bool sorted)
return (tdbp->To_Kindex->IsMul()) ? 2 : 1;
} // end of CntIndexInit
+#if defined(WORDS_BIGENDIAN)
+/***********************************************************************/
+/* Swap bytes of the key that are written in little endian order. */
+/***********************************************************************/
+static void SetSwapValue(PVAL valp, char *kp)
+{
+ if (valp->IsTypeNum() && valp->GetType() != TYPE_DECIM) {
+ uchar buf[8];
+ int i, k= valp->GetClen();
+
+ for (i = 0; k > 0;)
+ buf[i++]= kp[--k];
+
+
+
+ valp->SetBinValue((void*)buf);
+ } else
+ valp->SetBinValue((void*)kp);
+
+} // end of SetSwapValue
+#endif // WORDS_BIGENDIAN
+
/***********************************************************************/
/* IndexRead: fetch a record having the index value. */
/***********************************************************************/
@@ -777,7 +801,12 @@ RCODE CntIndexRead(PGLOBAL g, PTDB ptdb, OPVAL op,
if (!valp->IsTypeNum()) {
if (colp->GetColUse(U_VAR)) {
+#if defined(WORDS_BIGENDIAN)
+ ((char*)&lg)[0]= ((char*)kp)[1];
+ ((char*)&lg)[1]= ((char*)kp)[0];
+#else // !WORDS_BIGENDIAN
lg= *(short*)kp;
+#endif //!WORDS_BIGENDIAN
kp+= sizeof(short);
rcb= valp->SetValue_char(kp, (int)lg);
} else
@@ -795,7 +824,11 @@ RCODE CntIndexRead(PGLOBAL g, PTDB ptdb, OPVAL op,
} // endif b
} else
+#if defined(WORDS_BIGENDIAN)
+ SetSwapValue(valp, kp);
+#else // !WORDS_BIGENDIAN
valp->SetBinValue((void*)kp);
+#endif //!WORDS_BIGENDIAN
kp+= valp->GetClen();
@@ -891,7 +924,12 @@ int CntIndexRange(PGLOBAL g, PTDB ptdb, const uchar* *key, uint *len,
if (!valp->IsTypeNum()) {
if (colp->GetColUse(U_VAR)) {
+#if defined(WORDS_BIGENDIAN)
+ ((char*)&lg)[0]= ((char*)p)[1];
+ ((char*)&lg)[1]= ((char*)p)[0];
+#else // !WORDS_BIGENDIAN
lg= *(short*)p;
+#endif //!WORDS_BIGENDIAN
p+= sizeof(short);
rcb= valp->SetValue_char((char*)p, (int)lg);
} else
@@ -910,7 +948,11 @@ int CntIndexRange(PGLOBAL g, PTDB ptdb, const uchar* *key, uint *len,
} // endif b
} else
+#if defined(WORDS_BIGENDIAN)
+ SetSwapValue(valp, (char*)p);
+#else // !WORDS_BIGENDIAN
valp->SetBinValue((void*)p);
+#endif // !WORDS_BIGENDIAN
if (trace) {
char bf[32];
diff --git a/storage/connect/domdoc.cpp b/storage/connect/domdoc.cpp
index 518c806c653..64a0a172956 100644
--- a/storage/connect/domdoc.cpp
+++ b/storage/connect/domdoc.cpp
@@ -4,7 +4,7 @@
/******************************************************************/
#include "my_global.h"
#include <stdio.h>
-#if defined(WIN32)
+#if defined(__WIN__)
//#include <windows.h>
#if defined(MSX2)
#import "msxml2.dll" //Does not exist on Vista
@@ -275,7 +275,7 @@ PXNODE DOMNODE::GetNext(PGLOBAL g)
{
if (Nodep->nextSibling == NULL)
Next = NULL;
- else if (!Next)
+ else // if (!Next)
Next = new(g) DOMNODE(Doc, Nodep->nextSibling);
return Next;
@@ -288,7 +288,7 @@ PXNODE DOMNODE::GetChild(PGLOBAL g)
{
if (Nodep->firstChild == NULL)
Children = NULL;
- else if (!Children)
+ else // if (!Children)
Children = new(g) DOMNODE(Doc, Nodep->firstChild);
return Children;
@@ -441,15 +441,27 @@ PXNODE DOMNODE::SelectSingleNode(PGLOBAL g, char *xp, PXNODE np)
/******************************************************************/
PXATTR DOMNODE::GetAttribute(PGLOBAL g, char *name, PXATTR ap)
{
- MSXML2::IXMLDOMElementPtr ep = Nodep;
- MSXML2::IXMLDOMAttributePtr atp = ep->getAttributeNode(name);
+ MSXML2::IXMLDOMElementPtr ep;
+ MSXML2::IXMLDOMNamedNodeMapPtr nmp;
+ MSXML2::IXMLDOMAttributePtr atp;
+
+ if (name) {
+ ep = Nodep;
+ atp = ep->getAttributeNode(name);
+ nmp = NULL;
+ } else {
+ nmp = Nodep->Getattributes();
+ atp = nmp->Getitem(0);
+ } // endif name
if (atp) {
if (ap) {
((PDOMATTR)ap)->Atrp = atp;
+ ((PDOMATTR)ap)->Nmp = nmp;
+ ((PDOMATTR)ap)->K = 0;
return ap;
} else
- return new(g) DOMATTR(Doc, atp);
+ return new(g) DOMATTR(Doc, atp, nmp);
} else
return NULL;
@@ -617,15 +629,86 @@ bool DOMNODELIST::DropItem(PGLOBAL g, int n)
/******************************************************************/
/* DOMATTR constructor. */
/******************************************************************/
-DOMATTR::DOMATTR(PXDOC dp, MSXML2::IXMLDOMAttributePtr ap)
+DOMATTR::DOMATTR(PXDOC dp, MSXML2::IXMLDOMAttributePtr ap,
+ MSXML2::IXMLDOMNamedNodeMapPtr nmp)
: XMLATTRIBUTE(dp)
{
Atrp = ap;
+ Nmp = nmp;
Ws = NULL;
Len = 0;
+ K = 0;
} // end of DOMATTR constructor
/******************************************************************/
+/* Return the attribute name. */
+/******************************************************************/
+char *DOMATTR::GetName(PGLOBAL g)
+ {
+ if (!WideCharToMultiByte(CP_ACP, 0, Atrp->nodeName, -1,
+ Name, sizeof(Name), NULL, NULL)) {
+ strcpy(g->Message, MSG(NAME_CONV_ERR));
+ return NULL;
+ } // endif
+
+ return Name;
+ } // end of GetName
+
+/******************************************************************/
+/* Return the next attribute node. */
+/* This funtion is implemented as needed by XMLColumns. */
+/******************************************************************/
+PXATTR DOMATTR::GetNext(PGLOBAL g)
+ {
+ if (!Nmp)
+ return NULL;
+
+ if (++K >= Nmp->Getlength()) {
+ Nmp->reset();
+ Nmp = NULL;
+ K = 0;
+ return NULL;
+ } // endif K
+
+ Atrp = Nmp->Getitem(K);
+ return this;
+ } // end of GetNext
+
+/******************************************************************/
+/* Return the content of a node and subnodes. */
+/******************************************************************/
+RCODE DOMATTR::GetText(PGLOBAL g, char *buf, int len)
+ {
+ RCODE rc = RC_OK;
+
+ if (!WideCharToMultiByte(CP_UTF8, 0, Atrp->text, -1,
+ buf, len, NULL, NULL)) {
+ DWORD lsr = GetLastError();
+
+ switch (lsr) {
+ case 0:
+ case ERROR_INSUFFICIENT_BUFFER: // 122L
+ sprintf(g->Message, "Truncated %s content", GetName(g));
+ rc = RC_INFO;
+ break;
+ case ERROR_NO_UNICODE_TRANSLATION: // 1113L
+ sprintf(g->Message, "Invalid character(s) in %s content",
+ GetName(g));
+ rc = RC_INFO;
+ break;
+ default:
+ sprintf(g->Message, "System error getting %s content",
+ GetName(g));
+ rc = RC_FX;
+ break;
+ } // endswitch
+
+ } // endif
+
+ return rc;
+ } // end of GetText
+
+/******************************************************************/
/* Set the text content of an attribute. */
/******************************************************************/
bool DOMATTR::SetText(PGLOBAL g, char *txtp, int len)
diff --git a/storage/connect/domdoc.h b/storage/connect/domdoc.h
index 118541d8eb0..2cffec499e2 100644
--- a/storage/connect/domdoc.h
+++ b/storage/connect/domdoc.h
@@ -122,15 +122,24 @@ class DOMATTR : public XMLATTRIBUTE {
friend class DOMDOC;
friend class DOMNODE;
public:
+ // Properties
+ virtual char *GetName(PGLOBAL g);
+ virtual PXATTR GetNext(PGLOBAL);
+
// Methods
- virtual bool SetText(PGLOBAL g, char *txtp, int len);
+ virtual RCODE GetText(PGLOBAL g, char *bufp, int len);
+ virtual bool SetText(PGLOBAL g, char *txtp, int len);
protected:
// Constructor
- DOMATTR(PXDOC dp, MSXML2::IXMLDOMAttributePtr ap);
+ DOMATTR(PXDOC dp, MSXML2::IXMLDOMAttributePtr ap,
+ MSXML2::IXMLDOMNamedNodeMapPtr nmp = NULL);
// Members
- MSXML2::IXMLDOMAttributePtr Atrp;
- WCHAR *Ws;
- int Len;
+ MSXML2::IXMLDOMAttributePtr Atrp;
+ MSXML2::IXMLDOMNamedNodeMapPtr Nmp;
+ char Name[64];
+ WCHAR *Ws;
+ int Len;
+ long K;
}; // end of class DOMATTR
diff --git a/storage/connect/filamap.cpp b/storage/connect/filamap.cpp
index 08f87e2b836..5cf9a4d945c 100644
--- a/storage/connect/filamap.cpp
+++ b/storage/connect/filamap.cpp
@@ -5,7 +5,7 @@
/* */
/* COPYRIGHT: */
/* ---------- */
-/* (C) Copyright to the author Olivier BERTRAND 2005-2014 */
+/* (C) Copyright to the author Olivier BERTRAND 2005-2015 */
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
@@ -17,12 +17,12 @@
/* Include relevant sections of the System header files. */
/***********************************************************************/
#include "my_global.h"
-#if defined(WIN32)
+#if defined(__WIN__)
#if defined(__BORLANDC__)
#define __MFC_COMPAT__ // To define min/max as macro
#endif // __BORLANDC__
//#include <windows.h>
-#else // !WIN32
+#else // !__WIN__
#if defined(UNIX)
#include <errno.h>
#include <unistd.h>
@@ -30,7 +30,7 @@
#include <io.h>
#endif // !UNIX
#include <fcntl.h>
-#endif // !WIN32
+#endif // !__WIN__
/***********************************************************************/
/* Include application header files: */
@@ -191,11 +191,11 @@ bool MAPFAM::OpenTableFile(PGLOBAL g)
return true;
} // endif Memory
-#if defined(WIN32)
+#if defined(__WIN__)
if (mode != MODE_DELETE) {
-#else // !WIN32
+#else // !__WIN__
if (mode == MODE_READ) {
-#endif // !WIN32
+#endif // !__WIN__
CloseFileHandle(hFile); // Not used anymore
hFile = INVALID_HANDLE_VALUE; // For Fblock
} // endif Mode
@@ -207,8 +207,7 @@ bool MAPFAM::OpenTableFile(PGLOBAL g)
/*******************************************************************/
fp = (PFBLOCK)PlugSubAlloc(g, NULL, sizeof(FBLOCK));
fp->Type = TYPE_FB_MAP;
- fp->Fname = (char*)PlugSubAlloc(g, NULL, strlen(filename) + 1);
- strcpy((char*)fp->Fname, filename);
+ fp->Fname = PlugDup(g, filename);
fp->Next = dbuserp->Openlist;
dbuserp->Openlist = fp;
fp->Count = 1;
@@ -277,7 +276,7 @@ bool MAPFAM::SetPos(PGLOBAL g, int pos)
/***********************************************************************/
/* Record file position in case of UPDATE or DELETE. */
/***********************************************************************/
-bool MAPFAM::RecordPos(PGLOBAL g)
+bool MAPFAM::RecordPos(PGLOBAL)
{
Fpos = Mempos;
return false;
@@ -286,7 +285,7 @@ bool MAPFAM::RecordPos(PGLOBAL g)
/***********************************************************************/
/* Initialize Fpos and Mempos for indexed DELETE. */
/***********************************************************************/
-int MAPFAM::InitDelete(PGLOBAL g, int fpos, int spos)
+int MAPFAM::InitDelete(PGLOBAL, int fpos, int spos)
{
Fpos = Memory + (ptrdiff_t)fpos;
Mempos = Memory + (ptrdiff_t)spos;
@@ -372,7 +371,7 @@ int MAPFAM::ReadBuffer(PGLOBAL g)
/***********************************************************************/
/* WriteBuffer: File write routine for MAP access method. */
/***********************************************************************/
-int MAPFAM::WriteBuffer(PGLOBAL g)
+int MAPFAM::WriteBuffer(PGLOBAL g __attribute__((unused)))
{
#if defined(_DEBUG)
// Insert mode is no more handled using file mapping
@@ -453,7 +452,7 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc)
/*****************************************************************/
n = Tpos - Memory;
-#if defined(WIN32)
+#if defined(__WIN__)
DWORD drc = SetFilePointer(fp->Handle, n, NULL, FILE_BEGIN);
if (drc == 0xFFFFFFFF) {
@@ -483,7 +482,7 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc)
#endif // UNIX
} // endif Abort
-#if defined(WIN32)
+#if defined(__WIN__)
CloseHandle(fp->Handle);
#else // UNIX
close(fp->Handle);
@@ -496,7 +495,7 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc)
/***********************************************************************/
/* Table file close routine for MAP access method. */
/***********************************************************************/
-void MAPFAM::CloseTableFile(PGLOBAL g, bool abort)
+void MAPFAM::CloseTableFile(PGLOBAL g, bool)
{
PlugCloseFile(g, To_Fb);
To_Fb = NULL; // To get correct file size in Cardinality
@@ -552,7 +551,7 @@ int MBKFAM::Cardinality(PGLOBAL g)
/***********************************************************************/
/* Skip one record in file. */
/***********************************************************************/
-int MBKFAM::SkipRecord(PGLOBAL g, bool header)
+int MBKFAM::SkipRecord(PGLOBAL, bool)
{
return RC_OK;
} // end of SkipRecord
@@ -686,7 +685,7 @@ bool MPXFAM::SetPos(PGLOBAL g, int pos)
/***********************************************************************/
/* Initialize CurBlk, CurNum, Mempos and Fpos for indexed DELETE. */
/***********************************************************************/
-int MPXFAM::InitDelete(PGLOBAL g, int fpos, int spos)
+int MPXFAM::InitDelete(PGLOBAL, int fpos, int)
{
Fpos = Memory + Headlen + (ptrdiff_t)fpos * Lrecl;
Mempos = Fpos + Lrecl;
@@ -741,7 +740,7 @@ int MPXFAM::ReadBuffer(PGLOBAL g)
/***********************************************************************/
/* WriteBuffer: File write routine for MAP access method. */
/***********************************************************************/
-int MPXFAM::WriteBuffer(PGLOBAL g)
+int MPXFAM::WriteBuffer(PGLOBAL g __attribute__((unused)))
{
#if defined(_DEBUG)
// Insert mode is no more handled using file mapping
diff --git a/storage/connect/filamap.h b/storage/connect/filamap.h
index 1d44239e610..b9c8ad965fd 100644
--- a/storage/connect/filamap.h
+++ b/storage/connect/filamap.h
@@ -17,6 +17,7 @@ typedef class MAPFAM *PMAPFAM;
/* This is the variable file access method using file mapping. */
/***********************************************************************/
class DllExport MAPFAM : public TXTFAM {
+ friend class TDBJSON;
public:
// Constructor
MAPFAM(PDOSDEF tdp);
diff --git a/storage/connect/filamdbf.cpp b/storage/connect/filamdbf.cpp
index 98b8bb6fd95..8afda723578 100644
--- a/storage/connect/filamdbf.cpp
+++ b/storage/connect/filamdbf.cpp
@@ -1,11 +1,11 @@
/*********** File AM Dbf C++ Program Source Code File (.CPP) ****************/
/* PROGRAM NAME: FILAMDBF */
/* ------------- */
-/* Version 1.7 */
+/* Version 1.8 */
/* */
/* COPYRIGHT: */
/* ---------- */
-/* (C) Copyright to the author Olivier BERTRAND 2005-2014 */
+/* (C) Copyright to the author Olivier BERTRAND 2005-2015 */
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
@@ -22,12 +22,12 @@
/* Include relevant sections of the System header files. */
/***********************************************************************/
#include "my_global.h"
-#if defined(WIN32)
+#if defined(__WIN__)
#include <io.h>
#include <fcntl.h>
//#include <errno.h>
//#include <windows.h>
-#else // !WIN32
+#else // !__WIN__
#if defined(UNIX)
#include <errno.h>
#include <unistd.h>
@@ -35,7 +35,7 @@
//#include <io.h>
#endif // !UNIX
//#include <fcntl.h>
-#endif // !WIN32
+#endif // !__WIN__
#include <ctype.h>
#include <stdio.h>
#include <string.h>
@@ -74,16 +74,28 @@ typedef struct _dbfheader {
//uchar Dbfox :4; /* FoxPro if equal to 3 */
uchar Version; /* Version information flags */
char Filedate[3]; /* date, YYMMDD, binary. YY=year-1900 */
- uint Records; /* records in the file */
- ushort Headlen; /* bytes in the header */
- ushort Reclen; /* bytes in a record */
- ushort Fields; /* Reserved but used to store fields */
+ private:
+ /* The following four members are stored in little-endian format on disk */
+ char m_RecordsBuf[4]; /* records in the file */
+ char m_HeadlenBuf[2]; /* bytes in the header */
+ char m_ReclenBuf[2]; /* bytes in a record */
+ char m_FieldsBuf[2]; /* Reserved but used to store fields */
+ public:
char Incompleteflag; /* 01 if incomplete, else 00 */
char Encryptflag; /* 01 if encrypted, else 00 */
char Reserved2[12]; /* for LAN use */
char Mdxflag; /* 01 if production .mdx, else 00 */
char Language; /* Codepage */
char Reserved3[2];
+
+ uint Records(void) const {return uint4korr(m_RecordsBuf);}
+ ushort Headlen(void) const {return uint2korr(m_HeadlenBuf);}
+ ushort Reclen(void) const {return uint2korr(m_ReclenBuf);}
+ ushort Fields(void) const {return uint2korr(m_FieldsBuf);}
+
+ void SetHeadlen(ushort num) {int2store(m_HeadlenBuf, num);}
+ void SetReclen(ushort num) {int2store(m_ReclenBuf, num);}
+ void SetFields(ushort num) {int2store(m_FieldsBuf, num);}
} DBFHEADER;
/****************************************************************************/
@@ -143,7 +155,7 @@ static int dbfhead(PGLOBAL g, FILE *file, PSZ fn, DBFHEADER *buf)
strcpy(g->Message, MSG(DBASE_FILE));
// Check last byte(s) of header
- if (fseek(file, buf->Headlen - dbc, SEEK_SET) != 0) {
+ if (fseek(file, buf->Headlen() - dbc, SEEK_SET) != 0) {
sprintf(g->Message, MSG(BAD_HEADER), fn);
return RC_FX;
} // endif fseek
@@ -163,7 +175,7 @@ static int dbfhead(PGLOBAL g, FILE *file, PSZ fn, DBFHEADER *buf)
} // endif endmark
// Calculate here the number of fields while we have the dbc info
- buf->Fields = (buf->Headlen - dbc - 1) / 32;
+ buf->SetFields((buf->Headlen() - dbc - 1) / 32);
fseek(file, HEADLEN, SEEK_SET);
return rc;
} // end of dbfhead
@@ -219,7 +231,7 @@ PQRYRES DBFColumns(PGLOBAL g, char *dp, const char *fn, bool info)
/************************************************************************/
/* Allocate the structures used to refer to the result set. */
/************************************************************************/
- fields = mainhead.Fields;
+ fields = mainhead.Fields();
} else
fields = 0;
@@ -236,11 +248,11 @@ PQRYRES DBFColumns(PGLOBAL g, char *dp, const char *fn, bool info)
if (trace) {
htrc("Structure of %s\n", filename);
htrc("headlen=%hd reclen=%hd degree=%d\n",
- mainhead.Headlen, mainhead.Reclen, fields);
+ mainhead.Headlen(), mainhead.Reclen(), fields);
htrc("flags(iem)=%d,%d,%d cp=%d\n", mainhead.Incompleteflag,
mainhead.Encryptflag, mainhead.Mdxflag, mainhead.Language);
htrc("%hd records, last changed %02d/%02d/%d\n",
- mainhead.Records, mainhead.Filedate[1], mainhead.Filedate[2],
+ mainhead.Records(), mainhead.Filedate[1], mainhead.Filedate[2],
mainhead.Filedate[0] + (mainhead.Filedate[0] <= 30) ? 2000 : 1900);
htrc("Field Type Offset Len Dec Set Mdx\n");
} // endif trace
@@ -398,13 +410,13 @@ int DBFBASE::ScanHeader(PGLOBAL g, PSZ fname, int lrecl, char *defpath)
} else if (rc == RC_FX)
return -1;
- if ((int)header.Reclen != lrecl) {
- sprintf(g->Message, MSG(BAD_LRECL), lrecl, header.Reclen);
+ if ((int)header.Reclen() != lrecl) {
+ sprintf(g->Message, MSG(BAD_LRECL), lrecl, header.Reclen());
return -1;
} // endif Lrecl
- Records = (int)header.Records;
- return (int)header.Headlen;
+ Records = (int)header.Records();
+ return (int)header.Headlen();
} // end of ScanHeader
/* ---------------------------- Class DBFFAM ------------------------------ */
@@ -516,7 +528,7 @@ bool DBFFAM::AllocateBuffer(PGLOBAL g)
To_Buf = (char*)PlugSubAlloc(g, NULL, Buflen);
if (mode == MODE_INSERT) {
-#if defined(WIN32)
+#if defined(__WIN__)
/************************************************************************/
/* Now we can revert to binary mode in particular because the eventual */
/* writing of a new header must be done in binary mode to avoid */
@@ -526,7 +538,7 @@ bool DBFFAM::AllocateBuffer(PGLOBAL g)
sprintf(g->Message, MSG(BIN_MODE_FAIL), strerror(errno));
return true;
} // endif setmode
-#endif // WIN32
+#endif // __WIN__
/************************************************************************/
/* If this is a new file, the header must be generated. */
@@ -565,8 +577,8 @@ bool DBFFAM::AllocateBuffer(PGLOBAL g)
header->Filedate[0] = datm->tm_year - 100;
header->Filedate[1] = datm->tm_mon + 1;
header->Filedate[2] = datm->tm_mday;
- header->Headlen = (ushort)hlen;
- header->Reclen = (ushort)reclen;
+ header->SetHeadlen((ushort)hlen);
+ header->SetReclen((ushort)reclen);
descp = (DESCRIPTOR*)header;
// Currently only standard Xbase types are supported
@@ -627,13 +639,13 @@ bool DBFFAM::AllocateBuffer(PGLOBAL g)
DBFHEADER header;
if ((rc = dbfhead(g, Stream, Tdbp->GetFile(g), &header)) == RC_OK) {
- if (Lrecl != (int)header.Reclen) {
- sprintf(g->Message, MSG(BAD_LRECL), Lrecl, header.Reclen);
+ if (Lrecl != (int)header.Reclen()) {
+ sprintf(g->Message, MSG(BAD_LRECL), Lrecl, header.Reclen());
return true;
} // endif Lrecl
- Records = (int)header.Records;
- Headlen = (int)header.Headlen;
+ Records = (int)header.Records();
+ Headlen = (int)header.Headlen();
} else if (rc == RC_NF) {
Records = 0;
Headlen = 0;
@@ -868,8 +880,11 @@ void DBFFAM::CloseTableFile(PGLOBAL g, bool abort)
PlugSetPath(filename, To_File, Tdbp->GetPath());
if ((Stream= global_fopen(g, MSGID_OPEN_MODE_STRERROR, filename, "r+b")))
{
+ char nRecords[4];
+ int4store(nRecords, n);
+
fseek(Stream, 4, SEEK_SET); // Get header.Records position
- fwrite(&n, sizeof(int), 1, Stream);
+ fwrite(nRecords, sizeof(nRecords), 1, Stream);
fclose(Stream);
Stream= NULL;
Records= n; // Update Records value
@@ -944,13 +959,13 @@ bool DBMFAM::AllocateBuffer(PGLOBAL g)
/************************************************************************/
DBFHEADER *hp = (DBFHEADER*)Memory;
- if (Lrecl != (int)hp->Reclen) {
- sprintf(g->Message, MSG(BAD_LRECL), Lrecl, hp->Reclen);
+ if (Lrecl != (int)hp->Reclen()) {
+ sprintf(g->Message, MSG(BAD_LRECL), Lrecl, hp->Reclen());
return true;
} // endif Lrecl
- Records = (int)hp->Records;
- Headlen = (int)hp->Headlen;
+ Records = (int)hp->Records();
+ Headlen = (int)hp->Headlen();
} // endif Headlen
/**************************************************************************/
diff --git a/storage/connect/filamfix.cpp b/storage/connect/filamfix.cpp
index 980d558eee5..cd25429318a 100644
--- a/storage/connect/filamfix.cpp
+++ b/storage/connect/filamfix.cpp
@@ -5,7 +5,7 @@
/* */
/* COPYRIGHT: */
/* ---------- */
-/* (C) Copyright to the author Olivier BERTRAND 2005-2014 */
+/* (C) Copyright to the author Olivier BERTRAND 2005-2015 */
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
@@ -17,7 +17,7 @@
/* Include relevant sections of the System header files. */
/***********************************************************************/
#include "my_global.h"
-#if defined(WIN32)
+#if defined(__WIN__)
#include <io.h>
#include <fcntl.h>
#include <errno.h>
@@ -25,7 +25,7 @@
#define __MFC_COMPAT__ // To define min/max as macro
#endif // __BORLANDC__
//#include <windows.h>
-#else // !WIN32
+#else // !__WIN__
#if defined(UNIX)
#include <errno.h>
#include <unistd.h>
@@ -34,7 +34,7 @@
#endif // !UNIX
#include <sys/stat.h>
#include <fcntl.h>
-#endif // !WIN32
+#endif // !__WIN__
/***********************************************************************/
/* Include application header files: */
@@ -46,6 +46,7 @@
#include "plgdbsem.h"
#include "filamfix.h"
#include "tabdos.h"
+#include "tabfix.h"
#include "osutil.h"
#ifndef INVALID_SET_FILE_POINTER
@@ -102,7 +103,7 @@ bool FIXFAM::SetPos(PGLOBAL g, int pos)
/***********************************************************************/
/* Initialize CurBlk and CurNum for indexed DELETE. */
/***********************************************************************/
-int FIXFAM::InitDelete(PGLOBAL g, int fpos, int spos)
+int FIXFAM::InitDelete(PGLOBAL, int fpos, int)
{
CurBlk = fpos / Nrec;
CurNum = fpos % Nrec;
@@ -133,18 +134,35 @@ bool FIXFAM::AllocateBuffer(PGLOBAL g)
if (Tdbp->GetFtype() == RECFM_BIN) {
// The buffer must be prepared depending on column types
int n = 0;
+ bool b = false;
PDOSDEF defp = (PDOSDEF)Tdbp->GetDef();
- PCOLDEF cdp;
+// PCOLDEF cdp;
+ PBINCOL colp;
// Prepare the first line of the buffer
memset(To_Buf, 0, Buflen);
+#if 0
for (cdp = defp->GetCols(); cdp; cdp = cdp->GetNext()) {
- if (IsTypeNum(cdp->GetType()))
- memset(To_Buf + cdp->GetOffset(), ' ', cdp->GetClen());
+ if (!IsTypeNum(cdp->GetType())) {
+ memset(To_Buf + cdp->GetOffset(), ' ', cdp->GetClen());
+ b = true;
+ } // endif not num
- n = MY_MAX(n, cdp->GetPoff() + cdp->GetClen());
+ n = MY_MAX(n, cdp->GetOffset() + cdp->GetClen());
} // endfor cdp
+#endif // 0
+
+ for (colp = (PBINCOL)Tdbp->GetColumns(); colp;
+ colp = (PBINCOL)colp->GetNext())
+ if (!colp->IsSpecial()) {
+ if (!IsTypeNum(colp->GetResultType())) {
+ memset(To_Buf + colp->GetDeplac(), ' ', colp->GetLength());
+ b = true;
+ } // endif not num
+
+ n = MY_MAX(n, colp->GetDeplac() + colp->GetFileSize());
+ } // endif !special
// We do this for binary table because the lrecl can have been
// specified with additional space to include line ending.
@@ -156,9 +174,10 @@ bool FIXFAM::AllocateBuffer(PGLOBAL g)
} // 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);
+ if (b)
+ // 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);
@@ -319,10 +338,10 @@ int FIXFAM::ReadBuffer(PGLOBAL g)
} else if (feof(Stream)) {
rc = RC_EF;
} else {
-#if defined(UNIX)
- sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(errno));
-#else
+#if defined(__WIN__)
sprintf(g->Message, MSG(READ_ERROR), To_File, _strerror(NULL));
+#else
+ sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(errno));
#endif
if (trace)
@@ -659,7 +678,7 @@ BGXFAM::BGXFAM(PBGXFAM txfp) : FIXFAM(txfp)
/***********************************************************************/
bool BGXFAM::BigSeek(PGLOBAL g, HANDLE h, BIGINT pos, int org)
{
-#if defined(WIN32)
+#if defined(__WIN__)
char buf[256];
DWORD drc;
LARGE_INTEGER of;
@@ -675,14 +694,14 @@ bool BGXFAM::BigSeek(PGLOBAL g, HANDLE h, BIGINT pos, int org)
sprintf(g->Message, MSG(SFP_ERROR), buf);
return true;
} // endif
-#else // !WIN32
+#else // !__WIN__
if (lseek64(h, pos, org) < 0) {
// sprintf(g->Message, MSG(ERROR_IN_LSK), errno);
sprintf(g->Message, "lseek64: %s", strerror(errno));
printf("%s\n", g->Message);
return true;
} // endif
-#endif // !WIN32
+#endif // !__WIN__
return false;
} // end of BigSeek
@@ -690,11 +709,12 @@ bool BGXFAM::BigSeek(PGLOBAL g, HANDLE h, BIGINT pos, int org)
/***********************************************************************/
/* Read from a big file. */
/***********************************************************************/
-int BGXFAM::BigRead(PGLOBAL g, HANDLE h, void *inbuf, int req)
+int BGXFAM::BigRead(PGLOBAL g __attribute__((unused)),
+ HANDLE h, void *inbuf, int req)
{
int rc;
-#if defined(WIN32)
+#if defined(__WIN__)
DWORD nbr, drc, len = (DWORD)req;
bool brc = ReadFile(h, inbuf, len, &nbr, NULL);
@@ -716,12 +736,12 @@ int BGXFAM::BigRead(PGLOBAL g, HANDLE h, void *inbuf, int req)
rc = -1;
} else
rc = (int)nbr;
-#else // !WIN32
+#else // !__WIN__
size_t len = (size_t)req;
ssize_t nbr = read(h, inbuf, len);
rc = (int)nbr;
-#endif // !WIN32
+#endif // !__WIN__
return rc;
} // end of BigRead
@@ -733,7 +753,7 @@ bool BGXFAM::BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req)
{
bool rc = false;
-#if defined(WIN32)
+#if defined(__WIN__)
DWORD nbw, drc, len = (DWORD)req;
bool brc = WriteFile(h, inbuf, len, &nbw, NULL);
@@ -760,7 +780,7 @@ bool BGXFAM::BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req)
rc = true;
} // endif brc || nbw
-#else // !WIN32
+#else // !__WIN__
size_t len = (size_t)req;
ssize_t nbw = write(h, inbuf, len);
@@ -775,7 +795,7 @@ bool BGXFAM::BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req)
rc = true;
} // endif nbr
-#endif // !WIN32
+#endif // !__WIN__
return rc;
} // end of BigWrite
@@ -810,7 +830,7 @@ bool BGXFAM::OpenTableFile(PGLOBAL g)
if (trace)
htrc("OpenTableFile: filename=%s mode=%d\n", filename, mode);
-#if defined(WIN32)
+#if defined(__WIN__)
DWORD rc, access, creation, share = 0;
/*********************************************************************/
@@ -967,7 +987,7 @@ int BGXFAM::Cardinality(PGLOBAL g)
PlugSetPath(filename, To_File, Tdbp->GetPath());
-#if defined(WIN32) // OB
+#if defined(__WIN__) // OB
LARGE_INTEGER len;
DWORD rc = 0;
@@ -1326,7 +1346,7 @@ int BGXFAM::DeleteRecords(PGLOBAL g, int irc)
/*****************************************************************/
/* Remove extra records. */
/*****************************************************************/
-#if defined(WIN32)
+#if defined(__WIN__)
if (BigSeek(g, Hfile, (BIGINT)Tpos * (BIGINT)Lrecl))
return RC_FX;
@@ -1336,12 +1356,12 @@ int BGXFAM::DeleteRecords(PGLOBAL g, int irc)
sprintf(g->Message, MSG(SETEOF_ERROR), drc);
return RC_FX;
} // endif error
-#else // !WIN32
+#else // !__WIN__
if (ftruncate64(Hfile, (BIGINT)(Tpos * Lrecl))) {
sprintf(g->Message, MSG(TRUNCATE_ERROR), strerror(errno));
return RC_FX;
} // endif
-#endif // !WIN32
+#endif // !__WIN__
} // endif UseTemp
@@ -1366,7 +1386,7 @@ bool BGXFAM::OpenTempFile(PGLOBAL g)
strcat(PlugRemoveType(tempname, tempname), ".t");
remove(tempname); // Be sure it does not exist yet
-#if defined(WIN32)
+#if defined(__WIN__)
Tfile = CreateFile(tempname, GENERIC_WRITE, 0, NULL,
CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
@@ -1506,7 +1526,7 @@ void BGXFAM::CloseTableFile(PGLOBAL g, bool abort)
void BGXFAM::Rewind(void)
{
#if 0 // This is probably unuseful because file is accessed directly
-#if defined(WIN32) //OB
+#if defined(__WIN__) //OB
SetFilePointer(Hfile, 0, NULL, FILE_BEGIN);
#else // UNIX
lseek64(Hfile, 0, SEEK_SET);
diff --git a/storage/connect/filamtxt.cpp b/storage/connect/filamtxt.cpp
index 675c021fe51..e53cdcd9ba9 100644
--- a/storage/connect/filamtxt.cpp
+++ b/storage/connect/filamtxt.cpp
@@ -5,7 +5,7 @@
/* */
/* COPYRIGHT: */
/* ---------- */
-/* (C) Copyright to the author Olivier BERTRAND 2005-2014 */
+/* (C) Copyright to the author Olivier BERTRAND 2005-2015 */
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
@@ -17,7 +17,7 @@
/* Include relevant sections of the System header files. */
/***********************************************************************/
#include "my_global.h"
-#if defined(WIN32)
+#if defined(__WIN__)
#include <io.h>
#include <fcntl.h>
#include <errno.h>
@@ -25,7 +25,7 @@
#define __MFC_COMPAT__ // To define min/max as macro
#endif // __BORLANDC__
//#include <windows.h>
-#else // !WIN32
+#else // !__WIN__
#if defined(UNIX) || defined(UNIV_LINUX)
#include <errno.h>
#include <unistd.h>
@@ -36,7 +36,7 @@
#include <io.h>
#endif // !UNIX
#include <fcntl.h>
-#endif // !WIN32
+#endif // !__WIN__
/***********************************************************************/
/* Include application header files: */
@@ -289,8 +289,7 @@ bool TXTFAM::AddListValue(PGLOBAL g, int type, void *val, PPARM *top)
pp->Intval = *(int*)val;
break;
// case TYPE_STRING:
-// pp->Value = PlugSubAlloc(g, NULL, strlen((char*)val) + 1);
-// strcpy((char*)pp->Value, (char*)val);
+// pp->Value = PlugDup(g, (char*)val);
// break;
case TYPE_PCHAR:
pp->Value = val;
@@ -325,8 +324,7 @@ int TXTFAM::StoreValues(PGLOBAL g, bool upd)
if (Tdbp->PrepareWriting(g))
return RC_FX;
- buf = (char*)PlugSubAlloc(g, NULL, strlen(Tdbp->GetLine()) + 1);
- strcpy(buf, Tdbp->GetLine());
+ buf = PlugDup(g, Tdbp->GetLine());
rc = AddListValue(g, TYPE_PCHAR, buf, &To_Upd);
} // endif upd
@@ -438,7 +436,7 @@ err:
/* The purpose of this function is to deal with access methods that */
/* are not coherent regarding the use of SetPos and GetPos. */
/***********************************************************************/
-int TXTFAM::InitDelete(PGLOBAL g, int fpos, int spos)
+int TXTFAM::InitDelete(PGLOBAL g, int, int)
{
strcpy(g->Message, "InitDelete should not be used by this table type");
return RC_FX;
@@ -521,7 +519,7 @@ int DOSFAM::Cardinality(PGLOBAL g)
/* Use BlockTest to reduce the table estimated size. */
/* Note: This function is not really implemented yet. */
/***********************************************************************/
-int DOSFAM::MaxBlkSize(PGLOBAL g, int s)
+int DOSFAM::MaxBlkSize(PGLOBAL, int s)
{
return s;
} // end of MaxBlkSize
@@ -718,10 +716,10 @@ int DOSFAM::SkipRecord(PGLOBAL g, bool header)
if (feof(Stream))
return RC_EF;
-#if defined(UNIX) || defined(UNIV_LINUX)
- sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(0));
-#else
+#if defined(__WIN__)
sprintf(g->Message, MSG(READ_ERROR), To_File, _strerror(NULL));
+#else
+ sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(0));
#endif
return RC_FX;
} // endif fgets
@@ -801,12 +799,12 @@ int DOSFAM::ReadBuffer(PGLOBAL g)
if (trace > 1)
htrc(" Read: To_Buf=%p p=%c\n", To_Buf, To_Buf, p);
-#if defined(UNIX)
- if (true) {
- // Data files can be imported from Windows (having CRLF)
-#else
+#if defined(__WIN__)
if (Bin) {
// Data file is read in binary so CRLF remains
+#else
+ if (true) {
+ // Data files can be imported from Windows (having CRLF)
#endif
if (*p == '\n' || *p == '\r') {
// is this enough for Unix ???
@@ -835,10 +833,10 @@ int DOSFAM::ReadBuffer(PGLOBAL g)
} else if (feof(Stream)) {
rc = RC_EF;
} else {
-#if defined(UNIX)
- sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(0));
-#else
+#if defined(__WIN__)
sprintf(g->Message, MSG(READ_ERROR), To_File, _strerror(NULL));
+#else
+ sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(0));
#endif
if (trace)
@@ -1030,15 +1028,15 @@ int DOSFAM::DeleteRecords(PGLOBAL g, int irc)
/*****************************************************************/
/* Remove extra records. */
/*****************************************************************/
-#if defined(UNIX)
- if (ftruncate(h, (off_t)Tpos)) {
- sprintf(g->Message, MSG(TRUNCATE_ERROR), strerror(errno));
+#if defined(__WIN__)
+ if (chsize(h, Tpos)) {
+ sprintf(g->Message, MSG(CHSIZE_ERROR), strerror(errno));
close(h);
return RC_FX;
} // endif
#else
- if (chsize(h, Tpos)) {
- sprintf(g->Message, MSG(CHSIZE_ERROR), strerror(errno));
+ if (ftruncate(h, (off_t)Tpos)) {
+ sprintf(g->Message, MSG(TRUNCATE_ERROR), strerror(errno));
close(h);
return RC_FX;
} // endif
@@ -1274,7 +1272,7 @@ int BLKFAM::Cardinality(PGLOBAL g)
/***********************************************************************/
/* Use BlockTest to reduce the table estimated size. */
/***********************************************************************/
-int BLKFAM::MaxBlkSize(PGLOBAL g, int s)
+int BLKFAM::MaxBlkSize(PGLOBAL g, int)
{
int rc = RC_OK, savcur = CurBlk;
int size;
@@ -1345,7 +1343,7 @@ int BLKFAM::GetNextPos(void)
/***********************************************************************/
/* SetPos: Replace the table at the specified position. */
/***********************************************************************/
-bool BLKFAM::SetPos(PGLOBAL g, int pos)
+bool BLKFAM::SetPos(PGLOBAL g, int)
{
strcpy(g->Message, "Blocked variable tables cannot be used indexed");
return true;
@@ -1355,7 +1353,7 @@ bool BLKFAM::SetPos(PGLOBAL g, int pos)
/* Record file position in case of UPDATE or DELETE. */
/* Not used yet for blocked tables. */
/***********************************************************************/
-bool BLKFAM::RecordPos(PGLOBAL g)
+bool BLKFAM::RecordPos(PGLOBAL)
{
Fpos = (CurNum + Nrec * CurBlk); // Computed file index
return false;
@@ -1364,7 +1362,7 @@ bool BLKFAM::RecordPos(PGLOBAL g)
/***********************************************************************/
/* Skip one record in file. */
/***********************************************************************/
-int BLKFAM::SkipRecord(PGLOBAL g, bool header)
+int BLKFAM::SkipRecord(PGLOBAL, bool header)
{
if (header) {
// For Delete
@@ -1468,10 +1466,10 @@ int BLKFAM::ReadBuffer(PGLOBAL g)
} else if (feof(Stream)) {
rc = RC_EF;
} else {
-#if defined(UNIX)
- sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(errno));
-#else
+#if defined(__WIN__)
sprintf(g->Message, MSG(READ_ERROR), To_File, _strerror(NULL));
+#else
+ sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(errno));
#endif
if (trace)
@@ -1553,11 +1551,11 @@ int BLKFAM::WriteBuffer(PGLOBAL g)
Spos = GetNextPos(); // New start position
// Prepare the output buffer
-#if defined(WIN32)
+#if defined(__WIN__)
crlf = "\r\n";
#else
crlf = "\n";
-#endif // WIN32
+#endif // __WIN__
strcat(strcpy(OutBuf, Tdbp->GetLine()), crlf);
len = strlen(OutBuf);
} else {
diff --git a/storage/connect/filamtxt.h b/storage/connect/filamtxt.h
index 864ca66dd34..ae8f74a9830 100644
--- a/storage/connect/filamtxt.h
+++ b/storage/connect/filamtxt.h
@@ -42,6 +42,7 @@ class DllExport TXTFAM : public BLOCK {
virtual PTXF Duplicate(PGLOBAL g) = 0;
virtual bool GetUseTemp(void) {return false;}
virtual int GetDelRows(void) {return DelRows;}
+ PFBLOCK GetTo_Fb(void) {return To_Fb;}
int GetCurBlk(void) {return CurBlk;}
void SetTdbp(PTDBDOS tdbp) {Tdbp = tdbp;}
int GetBlock(void) {return Block;}
@@ -56,8 +57,8 @@ class DllExport TXTFAM : public BLOCK {
virtual int GetFileLength(PGLOBAL g);
virtual int Cardinality(PGLOBAL g);
virtual int MaxBlkSize(PGLOBAL g, int s);
- virtual bool AllocateBuffer(PGLOBAL g) {return false;}
- virtual void ResetBuffer(PGLOBAL g) {}
+ virtual bool AllocateBuffer(PGLOBAL) {return false;}
+ virtual void ResetBuffer(PGLOBAL) {}
virtual int GetNerr(void) {return 0;}
virtual int GetRowID(void) = 0;
virtual bool RecordPos(PGLOBAL g) = 0;
diff --git a/storage/connect/filamvct.cpp b/storage/connect/filamvct.cpp
index c449347bbcb..fdc5433f4a4 100755
--- a/storage/connect/filamvct.cpp
+++ b/storage/connect/filamvct.cpp
@@ -5,7 +5,7 @@
/* */
/* COPYRIGHT: */
/* ---------- */
-/* (C) Copyright to the author Olivier BERTRAND 2005-2014 */
+/* (C) Copyright to the author Olivier BERTRAND 2005-2015 */
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
@@ -21,7 +21,7 @@
/* Include relevant MariaDB header file. */
/***********************************************************************/
#include "my_global.h"
-#if defined(WIN32)
+#if defined(__WIN__)
#include <io.h>
#include <fcntl.h>
#if defined(__BORLANDC__)
@@ -29,7 +29,7 @@
#endif // __BORLAND__
//#include <windows.h>
#include <sys/stat.h>
-#else // !WIN32
+#else // !__WIN__
#if defined(UNIX)
#include <sys/types.h>
#include <sys/stat.h>
@@ -40,7 +40,7 @@
#include <io.h>
#endif // !UNIX
#include <fcntl.h>
-#endif // !WIN32
+#endif // !__WIN__
/***********************************************************************/
/* Include application header files: */
@@ -49,7 +49,7 @@
/* tabdos.h is header containing the TABDOS class declarations. */
/***********************************************************************/
#include "global.h"
-#include "osutil.h" // Unuseful for WIN32
+#include "osutil.h" // Unuseful for WINDOWS
#include "plgdbsem.h"
#include "valblk.h"
#include "filamfix.h"
@@ -279,7 +279,7 @@ bool VCTFAM::SetBlockInfo(PGLOBAL g)
/***********************************************************************/
/* Use BlockTest to reduce the table estimated size. */
/***********************************************************************/
-int VCTFAM::MaxBlkSize(PGLOBAL g, int s)
+int VCTFAM::MaxBlkSize(PGLOBAL g, int)
{
int rc = RC_OK, savcur = CurBlk;
int size;
@@ -376,11 +376,11 @@ bool VCTFAM::MakeEmptyFile(PGLOBAL g, char *fn)
int h, n;
PlugSetPath(filename, fn, Tdbp->GetPath());
-#if defined(WIN32)
+#if defined(__WIN__)
h= global_open(g, MSGID_OPEN_EMPTY_FILE, filename, _O_CREAT | _O_WRONLY, S_IREAD | S_IWRITE);
-#else // !WIN32
+#else // !__WIN__
h= global_open(g, MSGID_OPEN_EMPTY_FILE, filename, O_CREAT | O_WRONLY, S_IREAD | S_IWRITE);
-#endif // !WIN32
+#endif // !__WIN__
if (h == -1)
return true;
@@ -1451,8 +1451,7 @@ bool VCMFAM::OpenTableFile(PGLOBAL g)
/*******************************************************************/
fp = (PFBLOCK)PlugSubAlloc(g, NULL, sizeof(FBLOCK));
fp->Type = TYPE_FB_MAP;
- fp->Fname = (char*)PlugSubAlloc(g, NULL, strlen(filename) + 1);
- strcpy((char*)fp->Fname, filename);
+ fp->Fname = PlugDup(g, filename);
fp->Next = dbuserp->Openlist;
dbuserp->Openlist = fp;
fp->Count = 1;
@@ -1670,7 +1669,7 @@ int VCMFAM::DeleteRecords(PGLOBAL g, int irc)
// Remove extra blocks
n = Block * Blksize;
-#if defined(WIN32)
+#if defined(__WIN__)
DWORD drc = SetFilePointer(fp->Handle, n, NULL, FILE_BEGIN);
if (drc == 0xFFFFFFFF) {
@@ -1717,7 +1716,7 @@ int VCMFAM::DeleteRecords(PGLOBAL g, int irc)
/***********************************************************************/
/* Move intermediate deleted or updated lines. */
/***********************************************************************/
-bool VCMFAM::MoveIntermediateLines(PGLOBAL g, bool *b)
+bool VCMFAM::MoveIntermediateLines(PGLOBAL, bool *)
{
int i, m, n;
@@ -1766,7 +1765,7 @@ bool VCMFAM::MoveIntermediateLines(PGLOBAL g, bool *b)
/***********************************************************************/
/* Data Base close routine for VMP access method. */
/***********************************************************************/
-void VCMFAM::CloseTableFile(PGLOBAL g, bool abort)
+void VCMFAM::CloseTableFile(PGLOBAL g, bool)
{
int wrc = RC_OK;
MODE mode = Tdbp->GetMode();
@@ -1801,7 +1800,7 @@ void VCMFAM::CloseTableFile(PGLOBAL g, bool abort)
/***********************************************************************/
/* ReadBlock: Read column values from current block. */
/***********************************************************************/
-bool VCMFAM::ReadBlock(PGLOBAL g, PVCTCOL colp)
+bool VCMFAM::ReadBlock(PGLOBAL, PVCTCOL colp)
{
char *mempos;
int i = colp->Index - 1;
@@ -1831,7 +1830,7 @@ bool VCMFAM::ReadBlock(PGLOBAL g, PVCTCOL colp)
/* the mapped file, except when checking for Update but in this case */
/* we do not want to write back the modifications either. */
/***********************************************************************/
-bool VCMFAM::WriteBlock(PGLOBAL g, PVCTCOL colp)
+bool VCMFAM::WriteBlock(PGLOBAL, PVCTCOL colp __attribute__((unused)))
{
#if defined(_DEBUG)
char *mempos;
@@ -2125,7 +2124,7 @@ bool VECFAM::AllocateBuffer(PGLOBAL g)
/***********************************************************************/
/* Do initial action when inserting. */
/***********************************************************************/
-bool VECFAM::InitInsert(PGLOBAL g)
+bool VECFAM::InitInsert(PGLOBAL)
{
// We come here in MODE_INSERT only
CurBlk = 0;
@@ -2366,7 +2365,7 @@ bool VECFAM::MoveLines(PGLOBAL g)
/***********************************************************************/
/* Move intermediate deleted or updated lines. */
/***********************************************************************/
-bool VECFAM::MoveIntermediateLines(PGLOBAL g, bool *bn)
+bool VECFAM::MoveIntermediateLines(PGLOBAL g, bool *)
{
int i, n;
bool b = false;
@@ -2575,11 +2574,11 @@ bool VECFAM::ReadBlock(PGLOBAL g, PVCTCOL colp)
char fn[_MAX_PATH];
sprintf(fn, Colfn, colp->Index);
-#if defined(WIN32)
+#if defined(__WIN__)
if (feof(Streams[i]))
-#else // !WIN32
+#else // !__WIN__
if (errno == NO_ERROR)
-#endif // !WIN32
+#endif // !__WIN__
sprintf(g->Message, MSG(BAD_READ_NUMBER), (int) n, fn);
else
sprintf(g->Message, MSG(READ_ERROR),
@@ -2844,8 +2843,7 @@ bool VMPFAM::MapColumnFile(PGLOBAL g, MODE mode, int i)
/*******************************************************************/
fp = (PFBLOCK)PlugSubAlloc(g, NULL, sizeof(FBLOCK));
fp->Type = TYPE_FB_MAP;
- fp->Fname = (char*)PlugSubAlloc(g, NULL, strlen(filename) + 1);
- strcpy((char*)fp->Fname, filename);
+ fp->Fname = PlugDup(g, filename);
fp->Next = dup->Openlist;
dup->Openlist = fp;
fp->Count = 1;
@@ -2971,7 +2969,7 @@ int VMPFAM::DeleteRecords(PGLOBAL g, int irc)
/*****************************************************************/
n = Tpos * Clens[i];
-#if defined(WIN32)
+#if defined(__WIN__)
DWORD drc = SetFilePointer(fp->Handle, n, NULL, FILE_BEGIN);
if (drc == 0xFFFFFFFF) {
@@ -3011,7 +3009,7 @@ int VMPFAM::DeleteRecords(PGLOBAL g, int irc)
/***********************************************************************/
/* Data Base close routine for VMP access method. */
/***********************************************************************/
-void VMPFAM::CloseTableFile(PGLOBAL g, bool abort)
+void VMPFAM::CloseTableFile(PGLOBAL g, bool)
{
if (Tdbp->GetMode() == MODE_DELETE) {
// Set Block and Nrec values for TDBVCT::MakeBlockValues
@@ -3051,7 +3049,7 @@ BGVFAM::BGVFAM(PBGVFAM txfp) : VCTFAM(txfp)
/***********************************************************************/
bool BGVFAM::BigSeek(PGLOBAL g, HANDLE h, BIGINT pos, bool b)
{
-#if defined(WIN32)
+#if defined(__WIN__)
char buf[256];
DWORD drc, m = (b) ? FILE_END : FILE_BEGIN;
LARGE_INTEGER of;
@@ -3067,12 +3065,12 @@ bool BGVFAM::BigSeek(PGLOBAL g, HANDLE h, BIGINT pos, bool b)
sprintf(g->Message, MSG(SFP_ERROR), buf);
return true;
} // endif
-#else // !WIN32
+#else // !__WIN__
if (lseek64(h, pos, (b) ? SEEK_END : SEEK_SET) < 0) {
sprintf(g->Message, MSG(ERROR_IN_LSK), errno);
return true;
} // endif
-#endif // !WIN32
+#endif // !__WIN__
return false;
} // end of BigSeek
@@ -3084,7 +3082,7 @@ bool BGVFAM::BigRead(PGLOBAL g, HANDLE h, void *inbuf, int req)
{
bool rc = false;
-#if defined(WIN32)
+#if defined(__WIN__)
DWORD nbr, drc, len = (DWORD)req;
bool brc = ReadFile(h, inbuf, len, &nbr, NULL);
@@ -3110,7 +3108,7 @@ bool BGVFAM::BigRead(PGLOBAL g, HANDLE h, void *inbuf, int req)
rc = true;
} // endif brc || nbr
-#else // !WIN32
+#else // !__WIN__
size_t len = (size_t)req;
ssize_t nbr = read(h, inbuf, len);
@@ -3125,7 +3123,7 @@ bool BGVFAM::BigRead(PGLOBAL g, HANDLE h, void *inbuf, int req)
rc = true;
} // endif nbr
-#endif // !WIN32
+#endif // !__WIN__
return rc;
} // end of BigRead
@@ -3137,7 +3135,7 @@ bool BGVFAM::BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req)
{
bool rc = false;
-#if defined(WIN32)
+#if defined(__WIN__)
DWORD nbw, drc, len = (DWORD)req;
bool brc = WriteFile(h, inbuf, len, &nbw, NULL);
@@ -3164,7 +3162,7 @@ bool BGVFAM::BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req)
rc = true;
} // endif brc || nbw
-#else // !WIN32
+#else // !__WIN__
size_t len = (size_t)req;
ssize_t nbw = write(h, inbuf, len);
@@ -3179,7 +3177,7 @@ bool BGVFAM::BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req)
rc = true;
} // endif nbr
-#endif // !WIN32
+#endif // !__WIN__
return rc;
} // end of BigWrite
@@ -3205,7 +3203,7 @@ int BGVFAM::GetBlockInfo(PGLOBAL g)
if (Header == 2)
strcat(PlugRemoveType(filename, filename), ".blk");
-#if defined(WIN32)
+#if defined(__WIN__)
LARGE_INTEGER len;
h = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, NULL,
@@ -3217,11 +3215,11 @@ int BGVFAM::GetBlockInfo(PGLOBAL g)
} // endif h
if (h == INVALID_HANDLE_VALUE || !len.QuadPart) {
-#else // !WIN32
+#else // !__WIN__
h = open64(filename, O_RDONLY, 0);
if (h == INVALID_HANDLE_VALUE || !_filelength(h)) {
-#endif // !WIN32
+#endif // !__WIN__
// Consider this is a void table
if (trace)
htrc("Void table h=%d\n", h);
@@ -3282,17 +3280,17 @@ bool BGVFAM::SetBlockInfo(PGLOBAL g)
strcat(PlugRemoveType(filename, filename), ".blk");
if (h == INVALID_HANDLE_VALUE) {
-#if defined(WIN32)
+#if defined(__WIN__)
DWORD creation = (b) ? OPEN_EXISTING : TRUNCATE_EXISTING;
h = CreateFile(filename, GENERIC_READ | GENERIC_WRITE, 0,
NULL, creation, FILE_ATTRIBUTE_NORMAL, NULL);
-#else // !WIN32
+#else // !__WIN__
int oflag = (b) ? O_RDWR : O_RDWR | O_TRUNC;
h = open64(filename, oflag, 0);
-#endif // !WIN32
+#endif // !__WIN__
if (h == INVALID_HANDLE_VALUE) {
sprintf(g->Message, "Error opening header file %s", filename);
@@ -3330,7 +3328,7 @@ bool BGVFAM::MakeEmptyFile(PGLOBAL g, char *fn)
PlugSetPath(filename, fn, Tdbp->GetPath());
-#if defined(WIN32)
+#if defined(__WIN__)
char *p;
DWORD rc;
bool brc;
@@ -3382,7 +3380,7 @@ bool BGVFAM::MakeEmptyFile(PGLOBAL g, char *fn)
CloseHandle(h);
return true;
-#else // !WIN32
+#else // !__WIN__
int h;
BIGINT pos;
@@ -3411,7 +3409,7 @@ bool BGVFAM::MakeEmptyFile(PGLOBAL g, char *fn)
sprintf(g->Message, MSG(MAKE_EMPTY_FILE), To_File, strerror(errno));
close(h);
return true;
-#endif // !WIN32
+#endif // !__WIN__
} // end of MakeEmptyFile
/***********************************************************************/
@@ -3442,7 +3440,7 @@ bool BGVFAM::OpenTableFile(PGLOBAL g)
htrc("OpenTableFile: filename=%s mode=%d Last=%d\n",
filename, mode, Last);
-#if defined(WIN32)
+#if defined(__WIN__)
DWORD access, creation, share = 0, rc = 0;
/*********************************************************************/
@@ -3768,7 +3766,7 @@ int BGVFAM::WriteBuffer(PGLOBAL g)
if (!Closing && !MaxBlk) {
// Close the VCT file and reopen it in mode Insert
-//#if defined(WIN32) //OB
+//#if defined(__WIN__) //OB
// CloseHandle(Hfile);
//#else // UNIX
// close(Hfile);
@@ -3895,7 +3893,7 @@ int BGVFAM::DeleteRecords(PGLOBAL g, int irc)
/***************************************************************/
/* Remove extra records. */
/***************************************************************/
-#if defined(WIN32)
+#if defined(__WIN__)
BIGINT pos = (BIGINT)Block * (BIGINT)Blksize;
if (BigSeek(g, Hfile, pos))
@@ -3907,12 +3905,12 @@ int BGVFAM::DeleteRecords(PGLOBAL g, int irc)
sprintf(g->Message, MSG(SETEOF_ERROR), drc);
return RC_FX;
} // endif error
-#else // !WIN32
+#else // !__WIN__
if (ftruncate64(Hfile, (BIGINT)(Tpos * Lrecl))) {
sprintf(g->Message, MSG(TRUNCATE_ERROR), strerror(errno));
return RC_FX;
} // endif
-#endif // !WIN32
+#endif // !__WIN__
} else // MaxBlk
// Clean the unused space in the file, this is required when
// inserting again with a partial column list.
@@ -3949,7 +3947,7 @@ bool BGVFAM::OpenTempFile(PGLOBAL g)
else if (MakeEmptyFile(g, tempname))
return true;
-#if defined(WIN32)
+#if defined(__WIN__)
DWORD access = (MaxBlk) ? OPEN_EXISTING : CREATE_NEW;
Tfile = CreateFile(tempname, GENERIC_WRITE, 0, NULL,
@@ -4220,7 +4218,7 @@ void BGVFAM::Rewind(void)
CurNum = Nrec - 1;
#if 0 // This is probably unuseful as the file is directly accessed
-#if defined(WIN32) //OB
+#if defined(__WIN__) //OB
SetFilePointer(Hfile, 0, NULL, FILE_BEGIN);
#else // UNIX
lseek64(Hfile, 0, SEEK_SET);
diff --git a/storage/connect/filamzip.cpp b/storage/connect/filamzip.cpp
index 1288689325c..56faa555069 100644
--- a/storage/connect/filamzip.cpp
+++ b/storage/connect/filamzip.cpp
@@ -5,7 +5,7 @@
/* */
/* COPYRIGHT: */
/* ---------- */
-/* (C) Copyright to the author Olivier BERTRAND 2005-2014 */
+/* (C) Copyright to the author Olivier BERTRAND 2005-2015 */
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
@@ -17,21 +17,21 @@
/* Include relevant MariaDB header file. */
/***********************************************************************/
#include "my_global.h"
-#if defined(WIN32)
+#if defined(__WIN__)
#include <io.h>
#include <fcntl.h>
#if defined(__BORLANDC__)
#define __MFC_COMPAT__ // To define min/max as macro
#endif
//#include <windows.h>
-#else // !WIN32
+#else // !__WIN__
#if defined(UNIX)
#include <errno.h>
#else // !UNIX
#include <io.h>
#endif
#include <fcntl.h>
-#endif // !WIN32
+#endif // !__WIN__
/***********************************************************************/
/* Include application header files: */
@@ -89,11 +89,11 @@ int ZIPFAM::Zerror(PGLOBAL g)
strcpy(g->Message, gzerror(Zfile, &errnum));
if (errnum == Z_ERRNO)
-#if defined(WIN32)
+#if defined(__WIN__)
sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(NULL));
-#else // !WIN32
+#else // !__WIN__
sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(errno));
-#endif // !WIN32
+#endif // !__WIN__
return (errnum == Z_STREAM_END) ? RC_EF : RC_FX;
} // end of Zerror
@@ -247,7 +247,7 @@ int ZIPFAM::GetNextPos(void)
/***********************************************************************/
/* SetPos: Replace the table at the specified position. */
/***********************************************************************/
-bool ZIPFAM::SetPos(PGLOBAL g, int pos)
+bool ZIPFAM::SetPos(PGLOBAL g, int pos __attribute__((unused)))
{
sprintf(g->Message, MSG(NO_SETPOS_YET), "ZIP");
return true;
@@ -267,7 +267,7 @@ bool ZIPFAM::SetPos(PGLOBAL g, int pos)
/***********************************************************************/
/* Record file position in case of UPDATE or DELETE. */
/***********************************************************************/
-bool ZIPFAM::RecordPos(PGLOBAL g)
+bool ZIPFAM::RecordPos(PGLOBAL)
{
Zpos = gztell(Zfile);
return false;
@@ -376,7 +376,7 @@ int ZIPFAM::WriteBuffer(PGLOBAL g)
/***********************************************************************/
/* Data Base delete line routine for ZDOS access method. (NIY) */
/***********************************************************************/
-int ZIPFAM::DeleteRecords(PGLOBAL g, int irc)
+int ZIPFAM::DeleteRecords(PGLOBAL g, int)
{
strcpy(g->Message, MSG(NO_ZIP_DELETE));
return RC_FX;
@@ -385,7 +385,7 @@ int ZIPFAM::DeleteRecords(PGLOBAL g, int irc)
/***********************************************************************/
/* Data Base close routine for DOS access method. */
/***********************************************************************/
-void ZIPFAM::CloseTableFile(PGLOBAL g, bool abort)
+void ZIPFAM::CloseTableFile(PGLOBAL, bool)
{
int rc = gzclose(Zfile);
@@ -431,7 +431,7 @@ ZBKFAM::ZBKFAM(PZBKFAM txfp) : ZIPFAM(txfp)
/***********************************************************************/
/* Use BlockTest to reduce the table estimated size. */
/***********************************************************************/
-int ZBKFAM::MaxBlkSize(PGLOBAL g, int s)
+int ZBKFAM::MaxBlkSize(PGLOBAL g, int)
{
int rc = RC_OK, savcur = CurBlk;
int size;
@@ -503,7 +503,7 @@ int ZBKFAM::GetPos(void)
/* Record file position in case of UPDATE or DELETE. */
/* Not used yet for fixed tables. */
/***********************************************************************/
-bool ZBKFAM::RecordPos(PGLOBAL g)
+bool ZBKFAM::RecordPos(PGLOBAL /*g*/)
{
//strcpy(g->Message, "RecordPos not implemented for zip blocked tables");
//return true;
@@ -513,7 +513,7 @@ bool ZBKFAM::RecordPos(PGLOBAL g)
/***********************************************************************/
/* Skip one record in file. */
/***********************************************************************/
-int ZBKFAM::SkipRecord(PGLOBAL g, bool header)
+int ZBKFAM::SkipRecord(PGLOBAL /*g*/, bool)
{
//strcpy(g->Message, "SkipRecord not implemented for zip blocked tables");
//return RC_FX;
@@ -668,7 +668,7 @@ int ZBKFAM::DeleteRecords(PGLOBAL g, int irc)
/***********************************************************************/
/* Data Base close routine for ZBK access method. */
/***********************************************************************/
-void ZBKFAM::CloseTableFile(PGLOBAL g, bool abort)
+void ZBKFAM::CloseTableFile(PGLOBAL g, bool)
{
int rc = RC_OK;
@@ -764,9 +764,9 @@ bool ZIXFAM::AllocateBuffer(PGLOBAL g)
if (Tdbp->GetFtype() < 2)
// if not binary, the file is physically a text file
for (int len = Lrecl; len <= Buflen; len += Lrecl) {
-#if defined(WIN32)
+#if defined(__WIN__)
To_Buf[len - 2] = '\r';
-#endif // WIN32
+#endif // __WIN__
To_Buf[len - 1] = '\n';
} // endfor len
@@ -1060,7 +1060,7 @@ int ZLBFAM::GetNextPos(void)
/***********************************************************************/
/* SetPos: Replace the table at the specified position. */
/***********************************************************************/
-bool ZLBFAM::SetPos(PGLOBAL g, int pos)
+bool ZLBFAM::SetPos(PGLOBAL g, int pos __attribute__((unused)))
{
sprintf(g->Message, MSG(NO_SETPOS_YET), "ZIP");
return true;
@@ -1350,7 +1350,7 @@ bool ZLBFAM::WriteCompressedBuffer(PGLOBAL g)
/***********************************************************************/
/* Table file close routine for DOS access method. */
/***********************************************************************/
-void ZLBFAM::CloseTableFile(PGLOBAL g, bool abort)
+void ZLBFAM::CloseTableFile(PGLOBAL g, bool)
{
int rc = RC_OK;
diff --git a/storage/connect/filter.cpp b/storage/connect/filter.cpp
index 949d49c2943..262d6b58a70 100644
--- a/storage/connect/filter.cpp
+++ b/storage/connect/filter.cpp
@@ -13,13 +13,13 @@
#include "sql_class.h"
//#include "sql_time.h"
-#if defined(WIN32)
+#if defined(__WIN__)
//#include <windows.h>
-#else // !WIN32
+#else // !__WIN__
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
-#endif // !WIN32
+#endif // !__WIN__
/***********************************************************************/
diff --git a/storage/connect/filter.h b/storage/connect/filter.h
index 78e066d9ab7..15730e2cc44 100644
--- a/storage/connect/filter.h
+++ b/storage/connect/filter.h
@@ -1,7 +1,7 @@
/*************** Filter H Declares Source Code File (.H) ***************/
/* Name: FILTER.H Version 1.2 */
/* */
-/* (C) Copyright to the author Olivier BERTRAND 2010-2012 */
+/* (C) Copyright to the author Olivier BERTRAND 2010-2015 */
/* */
/* This file contains the FILTER and derived classes declares. */
/***********************************************************************/
@@ -105,8 +105,8 @@ class FILTERX : public FILTER {
virtual bool Eval(PGLOBAL) = 0; // just to prevent direct FILTERX use
// Fake operator new used to change a filter into a derived filter
- void * operator new(size_t size, PFIL filp) {return filp;}
-#if defined(WIN32)
+ void * operator new(size_t, PFIL filp) {return filp;}
+#if defined(__WIN__)
// Avoid warning C4291 by defining a matching dummy delete operator
void operator delete(void *, PFIL) {}
#else
diff --git a/storage/connect/fmdlex.c b/storage/connect/fmdlex.c
index a72a2b9b31e..22c3a1e79ad 100644
--- a/storage/connect/fmdlex.c
+++ b/storage/connect/fmdlex.c
@@ -20,11 +20,12 @@
*/
#define FLEX_SCANNER
-#if WIN32
+#ifdef __WIN__
#define __STDC__ 1
+#define isatty _isatty
#endif
#include <stdio.h>
-#ifndef WIN32
+#ifndef __WIN__
#include <unistd.h>
#endif
diff --git a/storage/connect/global.h b/storage/connect/global.h
index 88e5094d6d2..4d01a3ff05b 100644
--- a/storage/connect/global.h
+++ b/storage/connect/global.h
@@ -13,11 +13,11 @@
#include <time.h> /* time_t type declaration */
#include <setjmp.h> /* Long jump declarations */
-#if defined(WIN32) && !defined(NOEX)
+#if defined(__WIN__) && !defined(NOEX)
#define DllExport __declspec( dllexport )
-#else // !WIN32
+#else // !__WIN__
#define DllExport
-#endif // !WIN32
+#endif // !__WIN__
#if defined(DOMDOC_SUPPORT) || defined(LIBXML2_SUPPORT)
#define XML_SUPPORT 1
@@ -42,11 +42,11 @@
#define STEP(I) MSG_##I
#endif // !XMSG and !NEWMSG
-#if defined(WIN32)
+#if defined(__WIN__)
#define CRLF 2
-#else // !WIN32
+#else // !__WIN__
#define CRLF 1
-#endif // !WIN32
+#endif // !__WIN__
/***********************************************************************/
/* Define access to the thread based trace value. */
@@ -104,7 +104,7 @@
#define SYS_STAMP "DOSR"
#elif defined(WIN)
#define SYS_STAMP "WIN1"
-#elif defined(WIN32)
+#elif defined(__WIN__)
#define SYS_STAMP "WIN2"
#else
#define SYS_STAMP "XXXX"
@@ -118,7 +118,7 @@ extern "C" {
/* Static variables */
/***********************************************************************/
#if defined(STORAGE)
- char sys_stamp[4] = SYS_STAMP;
+ char sys_stamp[5] = SYS_STAMP;
#else
extern char sys_stamp[];
#endif
@@ -235,7 +235,7 @@ typedef struct _global { /* Global structure */
void *Xchk; /* indexes in create/alter */
short Alchecked; /* Checked for ALTER */
short Mrr; /* True when doing mrr */
- short Trace;
+ int N; /* Utility */
int jump_level;
jmp_buf jumper[MAX_JUMP + 2];
} GLOBAL;
@@ -248,9 +248,9 @@ DllExport char *PlugReadMessage(PGLOBAL, int, char *);
#elif defined(NEWMSG)
DllExport char *PlugGetMessage(PGLOBAL, int);
#endif // XMSG || NEWMSG
-#if defined(WIN32)
+#if defined(__WIN__)
DllExport short GetLineLength(PGLOBAL); // Console line length
-#endif // WIN32
+#endif // __WIN__
DllExport PGLOBAL PlugInit(LPCSTR, uint); // Plug global initialization
DllExport int PlugExit(PGLOBAL); // Plug global termination
DllExport LPSTR PlugRemoveType(LPSTR, LPCSTR);
diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc
index a0ac4668eba..c2fb6481cb0 100644
--- a/storage/connect/ha_connect.cc
+++ b/storage/connect/ha_connect.cc
@@ -130,24 +130,21 @@
#if defined(ODBC_SUPPORT)
#include "odbccat.h"
#endif // ODBC_SUPPORT
-#if defined(MYSQL_SUPPORT)
#include "xtable.h"
#include "tabmysql.h"
-#endif // MYSQL_SUPPORT
#include "filamdbf.h"
#include "tabxcl.h"
#include "tabfmt.h"
#include "reldef.h"
#include "tabcol.h"
#include "xindex.h"
-#if defined(WIN32)
+#if defined(__WIN__)
#include <io.h>
#include "tabwmi.h"
-#endif // WIN32
+#endif // __WIN__
#include "connect.h"
#include "user_connect.h"
#include "ha_connect.h"
-#include "mycat.h"
#include "myutil.h"
#include "preparse.h"
#include "inihandl.h"
@@ -156,6 +153,7 @@
#endif // LIBXML2_SUPPORT
#include "taboccur.h"
#include "tabpivot.h"
+#include "tabfix.h"
#define my_strupr(p) my_caseup_str(default_charset_info, (p));
#define my_strlwr(p) my_casedn_str(default_charset_info, (p));
@@ -165,40 +163,27 @@
/***********************************************************************/
/* Initialize the ha_connect static members. */
/***********************************************************************/
-#define SZCONV 8192
-#define SZWORK 67108864 // Default work area size 64M
-#define SZWMIN 4194304 // Minimum work area size 4M
+#define SZCONV 8192
+#define SZWORK 67108864 // Default work area size 64M
+#define SZWMIN 4194304 // Minimum work area size 4M
+#define JSONMAX 10 // JSON Default max grp size
extern "C" {
- char version[]= "Version 1.03.0006 January 13, 2015";
- char compver[]= "Version 1.03.0006 " __DATE__ " " __TIME__;
-
-#if defined(WIN32)
+ char version[]= "Version 1.03.0007 June 03, 2015";
+#if defined(__WIN__)
+ char compver[]= "Version 1.03.0007 " __DATE__ " " __TIME__;
char slash= '\\';
-#else // !WIN32
+#else // !__WIN__
char slash= '/';
-#endif // !WIN32
-
-// int trace= 0; // The general trace value
- ulong xconv= 0; // The type conversion option
- int zconv= 0; // The text conversion size
+#endif // !__WIN__
} // extern "C"
#if defined(XMAP)
my_bool xmap= false;
#endif // XMAP
-// uint worksize= 0;
ulong ha_connect::num= 0;
-//int DTVAL::Shift= 0;
-/* CONNECT system variables */
-//atic int conv_size= 0;
-//atic uint work_size= 0;
-//atic ulong type_conv= 0;
-#if defined(XMAP)
-//atic my_bool indx_map= 0;
-#endif // XMAP
#if defined(XMSG)
extern "C" {
char *msg_path;
@@ -209,12 +194,17 @@ extern "C" {
/* Utility functions. */
/***********************************************************************/
PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char *tab, char *db, bool info);
-PQRYRES VirColumns(PGLOBAL g, char *tab, char *db, bool info);
+PQRYRES VirColumns(PGLOBAL g, bool info);
+PQRYRES JSONColumns(PGLOBAL g, char *db, PTOS topt, bool info);
+PQRYRES XMLColumns(PGLOBAL g, char *db, char *tab, PTOS topt, 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);
+int GetConvSize(void);
+TYPCONV GetTypeConv(void);
+uint GetJsonGrpSize(void);
uint GetWorkSize(void);
void SetWorkSize(uint);
extern "C" const char *msglang(void);
@@ -289,6 +279,44 @@ static MYSQL_THDVAR_UINT(work_size,
"Size of the CONNECT work area.",
NULL, NULL, SZWORK, SZWMIN, UINT_MAX, 1);
+// Size used when converting TEXT columns to VARCHAR
+static MYSQL_THDVAR_INT(conv_size,
+ PLUGIN_VAR_RQCMDARG, // opt
+ "Size used when converting TEXT columns.",
+ NULL, NULL, SZCONV, 0, 65500, 1);
+
+/**
+ Type conversion:
+ no: Unsupported types -> TYPE_ERROR
+ yes: TEXT -> VARCHAR
+ skip: skip unsupported type columns in Discovery
+*/
+const char *xconv_names[]=
+{
+ "NO", "YES", "SKIP", NullS
+};
+
+TYPELIB xconv_typelib=
+{
+ array_elements(xconv_names) - 1, "xconv_typelib",
+ xconv_names, NULL
+};
+
+static MYSQL_THDVAR_ENUM(
+ type_conv, // name
+ PLUGIN_VAR_RQCMDARG, // opt
+ "Unsupported types conversion.", // comment
+ NULL, // check
+ NULL, // update function
+ 0, // def (no)
+ &xconv_typelib); // typelib
+
+// Estimate max number of rows for JSON aggregate functions
+static MYSQL_THDVAR_UINT(json_grp_size,
+ PLUGIN_VAR_RQCMDARG, // opt
+ "max number of rows for JSON aggregate functions.",
+ NULL, NULL, JSONMAX, 1, INT_MAX, 1);
+
#if defined(XMSG) || defined(NEWMSG)
const char *language_names[]=
{
@@ -317,8 +345,11 @@ static MYSQL_THDVAR_ENUM(
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);}
+int GetConvSize(void) {return THDVAR(current_thd, conv_size);}
+TYPCONV GetTypeConv(void) {return (TYPCONV)THDVAR(current_thd, type_conv);}
+uint GetJsonGrpSize(void) {return THDVAR(current_thd, json_grp_size);}
uint GetWorkSize(void) {return THDVAR(current_thd, work_size);}
-void SetWorkSize(uint n)
+void SetWorkSize(uint)
{
// Changing the session variable value seems to be impossible here
// and should be done in a check function
@@ -568,9 +599,9 @@ DllExport LPCSTR PlugSetPath(LPSTR to, LPCSTR name, LPCSTR dir)
delete_table method in handler.cc
*/
static const char *ha_connect_exts[]= {
- ".dos", ".fix", ".csv", ".bin", ".fmt", ".dbf", ".xml", ".ini", ".vec",
- ".dnx", ".fnx", ".bnx", ".vnx", ".dbx", ".dop", ".fop", ".bop", ".vop",
- NULL};
+ ".dos", ".fix", ".csv", ".bin", ".fmt", ".dbf", ".xml", ".json", ".ini",
+ ".vec", ".dnx", ".fnx", ".bnx", ".vnx", ".dbx", ".dop", ".fop", ".bop",
+ ".vop", NULL};
/**
@brief
@@ -598,7 +629,11 @@ static int connect_init_func(void *p)
}
#endif // 0 (LINUX)
+#if defined(__WIN__)
sql_print_information("CONNECT: %s", compver);
+#else // !__WIN__
+ sql_print_information("CONNECT: %s", version);
+#endif // !__WIN__
#ifdef LIBXML2_SUPPORT
XmlInitParserLib();
@@ -621,6 +656,7 @@ static int connect_init_func(void *p)
sql_print_information("connect_init: hton=%p", p);
DTVAL::SetTimeShift(); // Initialize time zone shift once for all
+ BINCOL::SetEndian(); // Initialize host endian setting
DBUG_RETURN(0);
} // end of connect_init_func
@@ -629,7 +665,7 @@ static int connect_init_func(void *p)
@brief
Plugin clean up
*/
-static int connect_done_func(void *p)
+static int connect_done_func(void *)
{
int error= 0;
PCONNECT pc, pn;
@@ -639,9 +675,9 @@ static int connect_done_func(void *p)
XmlCleanupParserLib();
#endif // LIBXML2_SUPPORT
-#if !defined(WIN32)
+#if !defined(__WIN__)
//PROFILE_End(); Causes signal 11
-#endif // !WIN32
+#endif // !__WIN__
for (pc= user_connect::to_users; pc; pc= pn) {
if (pc->g)
@@ -708,11 +744,11 @@ ha_connect::ha_connect(handlerton *hton, TABLE_SHARE *table_arg)
xp= (table) ? GetUser(ha_thd(), NULL) : NULL;
if (xp)
xp->SetHandler(this);
-#if defined(WIN32)
+#if defined(__WIN__)
datapath= ".\\";
-#else // !WIN32
+#else // !__WIN__
datapath= "./";
-#endif // !WIN32
+#endif // !__WIN__
tdbp= NULL;
sdvalin1= sdvalin2= sdvalin3= sdvalin4= NULL;
sdvalout= NULL;
@@ -787,8 +823,6 @@ ha_connect::~ha_connect(void)
/****************************************************************************/
static PCONNECT GetUser(THD *thd, PCONNECT xp)
{
- const char *dbn= NULL;
-
if (!thd)
return NULL;
@@ -800,7 +834,7 @@ static PCONNECT GetUser(THD *thd, PCONNECT xp)
break;
if (!xp) {
- xp= new user_connect(thd, dbn);
+ xp= new user_connect(thd);
if (xp->user_init()) {
delete xp;
@@ -873,7 +907,8 @@ const char *ha_connect::index_type(uint inx)
If all_parts is set, MySQL wants to know the flags for the combined
index, up to and including 'part'.
*/
-ulong ha_connect::index_flags(uint inx, uint part, bool all_parts) const
+//ong ha_connect::index_flags(uint inx, uint part, bool all_parts) const
+ulong ha_connect::index_flags(uint, uint, bool) const
{
ulong flags= HA_READ_NEXT | HA_READ_RANGE |
HA_KEYREAD_ONLY | HA_KEY_SCAN_NOT_ROR;
@@ -934,6 +969,9 @@ ulonglong ha_connect::table_flags() const
char *GetListOption(PGLOBAL g, const char *opname,
const char *oplist, const char *def)
{
+ if (!oplist)
+ return (char*)def;
+
char key[16], val[256];
char *pk, *pv, *pn;
char *opval= (char*) def;
@@ -968,8 +1006,7 @@ char *GetListOption(PGLOBAL g, const char *opname,
} // endif pv
if (!stricmp(opname, key)) {
- opval= (char*)PlugSubAlloc(g, NULL, strlen(val) + 1);
- strcpy(opval, val);
+ opval= PlugDup(g, val);
break;
} else if (!pn)
break;
@@ -980,6 +1017,117 @@ char *GetListOption(PGLOBAL g, const char *opname,
} // end of GetListOption
/****************************************************************************/
+/* Return the value of a string option or NULL if not specified. */
+/****************************************************************************/
+char *GetStringTableOption(PGLOBAL g, PTOS options, char *opname, char *sdef)
+{
+ const char *opval= NULL;
+
+ if (!options)
+ return sdef;
+ else if (!stricmp(opname, "Type"))
+ opval= options->type;
+ else if (!stricmp(opname, "Filename"))
+ opval= options->filename;
+ else if (!stricmp(opname, "Optname"))
+ opval= options->optname;
+ else if (!stricmp(opname, "Tabname"))
+ opval= options->tabname;
+ else if (!stricmp(opname, "Tablist"))
+ opval= options->tablist;
+ else if (!stricmp(opname, "Database") ||
+ !stricmp(opname, "DBname"))
+ opval= options->dbname;
+ else if (!stricmp(opname, "Separator"))
+ opval= options->separator;
+ else if (!stricmp(opname, "Qchar"))
+ opval= options->qchar;
+ else if (!stricmp(opname, "Module"))
+ opval= options->module;
+ else if (!stricmp(opname, "Subtype"))
+ opval= options->subtype;
+ else if (!stricmp(opname, "Catfunc"))
+ opval= options->catfunc;
+ else if (!stricmp(opname, "Srcdef"))
+ opval= options->srcdef;
+ else if (!stricmp(opname, "Colist"))
+ opval= options->colist;
+ else if (!stricmp(opname, "Data_charset"))
+ opval= options->data_charset;
+
+ if (!opval && options && options->oplist)
+ opval= GetListOption(g, opname, options->oplist);
+
+ return opval ? (char*)opval : sdef;
+} // end of GetStringTableOption
+
+/****************************************************************************/
+/* Return the value of a Boolean option or bdef if not specified. */
+/****************************************************************************/
+bool GetBooleanTableOption(PGLOBAL g, PTOS options, char *opname, bool bdef)
+{
+ bool opval= bdef;
+ char *pv;
+
+ if (!options)
+ return bdef;
+ else if (!stricmp(opname, "Mapped"))
+ opval= options->mapped;
+ else if (!stricmp(opname, "Huge"))
+ opval= options->huge;
+ else if (!stricmp(opname, "Split"))
+ opval= options->split;
+ else if (!stricmp(opname, "Readonly"))
+ 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(g, opname, options->oplist)))
+ opval= (!*pv || *pv == 'y' || *pv == 'Y' || atoi(pv) != 0);
+
+ return opval;
+} // end of GetBooleanTableOption
+
+/****************************************************************************/
+/* Return the value of an integer option or NO_IVAL if not specified. */
+/****************************************************************************/
+int GetIntegerTableOption(PGLOBAL g, PTOS options, char *opname, int idef)
+{
+ ulonglong opval= NO_IVAL;
+
+ if (!options)
+ return idef;
+ else if (!stricmp(opname, "Lrecl"))
+ opval= options->lrecl;
+ else if (!stricmp(opname, "Elements"))
+ opval= options->elements;
+ else if (!stricmp(opname, "Multiple"))
+ opval= options->multiple;
+ else if (!stricmp(opname, "Header"))
+ opval= options->header;
+ else if (!stricmp(opname, "Quoted"))
+ opval= options->quoted;
+ else if (!stricmp(opname, "Ending"))
+ opval= options->ending;
+ else if (!stricmp(opname, "Compressed"))
+ opval= (options->compressed);
+
+ if (opval == NO_IVAL) {
+ char *pv;
+
+ if ((pv= GetListOption(g, opname, options->oplist)))
+ opval= CharToNumber(pv, strlen(pv), ULONGLONG_MAX, true);
+ else
+ return idef;
+
+ } // endif opval
+
+ return (int)opval;
+} // end of GetIntegerTableOption
+
+/****************************************************************************/
/* Return the table option structure. */
/****************************************************************************/
PTOS ha_connect::GetTableOptionStruct(TABLE_SHARE *s)
@@ -997,8 +1145,9 @@ char *ha_connect::GetRealString(const char *s)
char *sv;
if (IsPartitioned() && s) {
- sv= (char*)PlugSubAlloc(xp->g, NULL, strlen(s) + strlen(partname));
+ sv= (char*)PlugSubAlloc(xp->g, NULL, 0);
sprintf(sv, s, partname);
+ PlugSubAlloc(xp->g, NULL, strlen(sv) + 1);
} else
sv= (char*)s;
@@ -1006,7 +1155,7 @@ char *ha_connect::GetRealString(const char *s)
} // end of GetRealString
/****************************************************************************/
-/* Return the value of a string option or NULL if not specified. */
+/* Return the value of a string option or sdef if not specified. */
/****************************************************************************/
char *ha_connect::GetStringOption(char *opname, char *sdef)
{
@@ -1024,37 +1173,6 @@ char *ha_connect::GetStringOption(char *opname, char *sdef)
opval= thd_query_string(table->in_use)->str;
else if (!stricmp(opname, "Partname"))
opval= partname;
- else if (!options)
- ;
- else if (!stricmp(opname, "Type"))
- opval= (char*)options->type;
- else if (!stricmp(opname, "Filename"))
- opval= GetRealString(options->filename);
- else if (!stricmp(opname, "Optname"))
- opval= (char*)options->optname;
- else if (!stricmp(opname, "Tabname"))
- opval= GetRealString(options->tabname);
- else if (!stricmp(opname, "Tablist"))
- opval= (char*)options->tablist;
- else if (!stricmp(opname, "Database") ||
- !stricmp(opname, "DBname"))
- opval= (char*)options->dbname;
- else if (!stricmp(opname, "Separator"))
- opval= (char*)options->separator;
- else if (!stricmp(opname, "Qchar"))
- opval= (char*)options->qchar;
- else if (!stricmp(opname, "Module"))
- opval= (char*)options->module;
- else if (!stricmp(opname, "Subtype"))
- opval= (char*)options->subtype;
- else if (!stricmp(opname, "Catfunc"))
- opval= (char*)options->catfunc;
- else if (!stricmp(opname, "Srcdef"))
- opval= (char*)options->srcdef;
- else if (!stricmp(opname, "Colist"))
- opval= (char*)options->colist;
- else if (!stricmp(opname, "Data_charset"))
- opval= (char*)options->data_charset;
else if (!stricmp(opname, "Table_charset")) {
const CHARSET_INFO *chif= (tshp) ? tshp->table_charset
: table->s->table_charset;
@@ -1062,10 +1180,13 @@ char *ha_connect::GetStringOption(char *opname, char *sdef)
if (chif)
opval= (char*)chif->csname;
- } // endif Table_charset
+ } else
+ opval= GetStringTableOption(xp->g, options, opname, NULL);
- if (!opval && options && options->oplist)
- opval= GetListOption(xp->g, opname, options->oplist);
+ if (opval && (!stricmp(opname, "connect")
+ || !stricmp(opname, "tabname")
+ || !stricmp(opname, "filename")))
+ opval = GetRealString(opval);
if (!opval) {
if (sdef && !strcmp(sdef, "*")) {
@@ -1096,31 +1217,13 @@ char *ha_connect::GetStringOption(char *opname, char *sdef)
/****************************************************************************/
bool ha_connect::GetBooleanOption(char *opname, bool bdef)
{
- bool opval= bdef;
- char *pv;
+ bool opval;
PTOS options= GetTableOptionStruct();
if (!stricmp(opname, "View"))
opval= (tshp) ? tshp->is_view : table_share->is_view;
- else if (!options)
- ;
- else if (!stricmp(opname, "Mapped"))
- opval= options->mapped;
- else if (!stricmp(opname, "Huge"))
- opval= options->huge;
-//else if (!stricmp(opname, "Compressed"))
-// opval= options->compressed;
- else if (!stricmp(opname, "Split"))
- opval= options->split;
- else if (!stricmp(opname, "Readonly"))
- 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);
+ else
+ opval= GetBooleanTableOption(xp->g, options, opname, bdef);
return opval;
} // end of GetBooleanOption
@@ -1149,37 +1252,18 @@ bool ha_connect::SetBooleanOption(char *opname, bool b)
/****************************************************************************/
int ha_connect::GetIntegerOption(char *opname)
{
- ulonglong opval= NO_IVAL;
- char *pv;
+ int opval;
PTOS options= GetTableOptionStruct();
TABLE_SHARE *tsp= (tshp) ? tshp : table_share;
if (!stricmp(opname, "Avglen"))
- opval= (ulonglong)tsp->avg_row_length;
+ opval= (int)tsp->avg_row_length;
else if (!stricmp(opname, "Estimate"))
- opval= (ulonglong)tsp->max_rows;
- else if (!options)
- ;
- else if (!stricmp(opname, "Lrecl"))
- opval= options->lrecl;
- else if (!stricmp(opname, "Elements"))
- opval= options->elements;
- else if (!stricmp(opname, "Multiple"))
- opval= options->multiple;
- else if (!stricmp(opname, "Header"))
- opval= options->header;
- else if (!stricmp(opname, "Quoted"))
- opval= options->quoted;
- else if (!stricmp(opname, "Ending"))
- opval= options->ending;
- else if (!stricmp(opname, "Compressed"))
- opval= (options->compressed);
-
- if (opval == (ulonglong)NO_IVAL && options && options->oplist)
- if ((pv= GetListOption(xp->g, opname, options->oplist)))
- opval= CharToNumber(pv, strlen(pv), ULONGLONG_MAX, true);
+ opval= (int)tsp->max_rows;
+ else
+ opval= GetIntegerTableOption(xp->g, options, opname, NO_IVAL);
- return (int)opval;
+ return opval;
} // end of GetIntegerOption
/****************************************************************************/
@@ -1443,8 +1527,7 @@ PIXDEF ha_connect::GetIndexInfo(TABLE_SHARE *s)
// Now get index information
pn= (char*)s->keynames.type_names[n];
- name= (char*)PlugSubAlloc(g, NULL, strlen(pn) + 1);
- strcpy(name, pn); // This is probably unuseful
+ name= PlugDup(g, pn);
unique= (kp.flags & 1) != 0;
pkp= NULL;
@@ -1454,8 +1537,7 @@ PIXDEF ha_connect::GetIndexInfo(TABLE_SHARE *s)
// Get the the key parts info
for (int k= 0; (unsigned)k < kp.user_defined_key_parts; k++) {
pn= (char*)kp.key_part[k].field->field_name;
- name= (char*)PlugSubAlloc(g, NULL, strlen(pn) + 1);
- strcpy(name, pn); // This is probably unuseful
+ name= PlugDup(g, pn);
// Allocate the key part description block
kpp= new(g) KPARTDEF(name, k + 1);
@@ -1962,7 +2044,7 @@ int ha_connect::MakeRecord(char *buf)
/***********************************************************************/
/* Set row values from a MySQL pseudo record. Specific to MySQL. */
/***********************************************************************/
-int ha_connect::ScanRecord(PGLOBAL g, uchar *buf)
+int ha_connect::ScanRecord(PGLOBAL g, uchar *)
{
char attr_buffer[1024];
char data_buffer[1024];
@@ -2104,7 +2186,7 @@ int ha_connect::ScanRecord(PGLOBAL g, uchar *buf)
/* Check change in index column. Specific to MySQL. */
/* Should be elaborated to check for real changes. */
/***********************************************************************/
-int ha_connect::CheckRecord(PGLOBAL g, const uchar *oldbuf, uchar *newbuf)
+int ha_connect::CheckRecord(PGLOBAL g, const uchar *, uchar *newbuf)
{
return ScanRecord(g, newbuf);
} // end of dummy CheckRecord
@@ -2113,12 +2195,12 @@ int ha_connect::CheckRecord(PGLOBAL g, const uchar *oldbuf, uchar *newbuf)
/***********************************************************************/
/* Return the where clause for remote indexed read. */
/***********************************************************************/
-bool ha_connect::MakeKeyWhere(PGLOBAL g, char *qry, OPVAL op, char *q,
+bool ha_connect::MakeKeyWhere(PGLOBAL g, PSTRG qry, OPVAL op, char q,
const void *key, int klen)
{
const uchar *ptr;
uint rem, len, stlen; //, prtlen;
- bool nq, b= false;
+ bool nq, oom, b= false;
Field *fp;
KEY *kfp;
KEY_PART_INFO *kpart;
@@ -2130,7 +2212,7 @@ bool ha_connect::MakeKeyWhere(PGLOBAL g, char *qry, OPVAL op, char *q,
return true;
} // endif key
- strcat(qry, " WHERE (");
+ oom= qry->Append(" WHERE (");
kfp= &table->key_info[active_index];
rem= kfp->user_defined_key_parts,
len= klen,
@@ -2143,24 +2225,26 @@ bool ha_connect::MakeKeyWhere(PGLOBAL g, char *qry, OPVAL op, char *q,
nq= fp->str_needs_quotes();
if (b)
- strcat(qry, " AND ");
+ oom|= qry->Append(" AND ");
else
b= true;
- strcat(strncat(strcat(qry, q), fp->field_name, strlen(fp->field_name)), q);
+ oom|= qry->Append(q);
+ oom|= qry->Append((PSZ)fp->field_name);
+ oom|= qry->Append(q);
switch (op) {
case OP_EQ:
case OP_GT:
case OP_GE:
- strcat(qry, GetValStr(op, false));
+ oom|= qry->Append((PSZ)GetValStr(op, false));
break;
default:
- strcat(qry, " ??? ");
+ oom|= qry->Append(" ??? ");
} // endwitch op
if (nq)
- strcat(qry, "'");
+ oom|= qry->Append('\'');
if (kpart->key_part_flag & HA_VAR_LENGTH_PART) {
String varchar;
@@ -2168,17 +2252,17 @@ bool ha_connect::MakeKeyWhere(PGLOBAL g, char *qry, OPVAL op, char *q,
varchar.set_quick((char*) ptr+HA_KEY_BLOB_LENGTH,
var_length, &my_charset_bin);
- strncat(qry, varchar.ptr(), varchar.length());
+ oom|= qry->Append(varchar.ptr(), varchar.length());
} else {
char strbuff[MAX_FIELD_WIDTH];
String str(strbuff, sizeof(strbuff), kpart->field->charset()), *res;
res= fp->val_str(&str, ptr);
- strncat(qry, res->ptr(), res->length());
+ oom|= qry->Append(res->ptr(), res->length());
} // endif flag
if (nq)
- strcat(qry, "'");
+ oom|= qry->Append('\'');
if (stlen >= len)
break;
@@ -2191,8 +2275,10 @@ bool ha_connect::MakeKeyWhere(PGLOBAL g, char *qry, OPVAL op, char *q,
ptr+= stlen - MY_TEST(kpart->null_bit);
} // endfor kpart
- strcat(qry, ")");
- return false;
+ if ((oom|= qry->Append(")")))
+ strcpy(g->Message, "Out of memory");
+
+ return oom;
} // end of MakeKeyWhere
@@ -2467,6 +2553,8 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, AMT tty, Item *cond)
char *body= filp->Body;
unsigned int i;
bool ismul= false, x= (tty == TYPE_AM_MYX || tty == TYPE_AM_XDBC);
+ bool nonul= (tty == TYPE_AM_ODBC && (tdbp->GetMode() == MODE_INSERT ||
+ tdbp->GetMode() == MODE_DELETE));
OPVAL vop= OP_XX;
if (!cond)
@@ -2484,7 +2572,7 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, AMT tty, Item *cond)
if (trace)
htrc("Cond: Ftype=%d name=%s\n", cond_item->functype(),
- cond_item->func_name());
+ cond_item->func_name());
switch (cond_item->functype()) {
case Item_func::COND_AND_FUNC: vop= OP_AND; break;
@@ -2503,7 +2591,7 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, AMT tty, Item *cond)
for (i= 0; i < arglist->elements; i++)
if ((subitem= li++)) {
if (!CheckCond(g, filp, tty, subitem)) {
- if (vop == OP_OR)
+ if (vop == OP_OR || nonul)
return NULL;
else
*p2= 0;
@@ -2599,6 +2687,8 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, AMT tty, Item *cond)
if (trace) {
htrc("Field index=%d\n", pField->field->field_index);
htrc("Field name=%s\n", pField->field->field_name);
+ htrc("Field type=%d\n", pField->field->type());
+ htrc("Field_type=%d\n", args[i]->field_type());
} // endif trace
// IN and BETWEEN clauses should be col VOP list
@@ -2618,8 +2708,9 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, AMT tty, Item *cond)
char buff[256];
String *res, tmp(buff, sizeof(buff), &my_charset_bin);
Item_basic_constant *pval= (Item_basic_constant *)args[i];
+ Item::Type type= args[i]->real_type();
- switch (args[i]->real_type()) {
+ switch (type) {
case COND::STRING_ITEM:
case COND::INT_ITEM:
case COND::REAL_ITEM:
@@ -2644,10 +2735,73 @@ 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(strncat(strcat(body, "'"), res->ptr(), res->length()), "'");
- else
- strncat(body, res->ptr(), res->length());
+ switch (args[i]->field_type()) {
+ case MYSQL_TYPE_TIMESTAMP:
+ case MYSQL_TYPE_DATETIME:
+ if (tty == TYPE_AM_ODBC) {
+ strcat(body, "{ts '");
+ strncat(body, res->ptr(), res->length());
+
+ if (res->length() < 19)
+ strcat(body, "1970-01-01 00:00:00" + res->length());
+
+ strcat(body, "'}");
+ break;
+ } // endif ODBC
+
+ case MYSQL_TYPE_DATE:
+ if (tty == TYPE_AM_ODBC) {
+ strcat(body, "{d '");
+ strcat(strncat(body, res->ptr(), res->length()), "'}");
+ break;
+ } // endif ODBC
+
+ case MYSQL_TYPE_TIME:
+ if (tty == TYPE_AM_ODBC) {
+ strcat(body, "{t '");
+ strcat(strncat(body, res->ptr(), res->length()), "'}");
+ break;
+ } // endif ODBC
+
+ case MYSQL_TYPE_VARCHAR:
+ if (tty == TYPE_AM_ODBC && i) {
+ switch (args[0]->field_type()) {
+ case MYSQL_TYPE_TIMESTAMP:
+ case MYSQL_TYPE_DATETIME:
+ strcat(body, "{ts '");
+ strncat(body, res->ptr(), res->length());
+
+ if (res->length() < 19)
+ strcat(body, "1970-01-01 00:00:00" + res->length());
+
+ strcat(body, "'}");
+ break;
+ case MYSQL_TYPE_DATE:
+ strcat(body, "{d '");
+ strncat(body, res->ptr(), res->length());
+ strcat(body, "'}");
+ break;
+ case MYSQL_TYPE_TIME:
+ strcat(body, "{t '");
+ strncat(body, res->ptr(), res->length());
+ strcat(body, "'}");
+ break;
+ default:
+ strcat(body, "'");
+ strncat(body, res->ptr(), res->length());
+ strcat(body, "'");
+ } // endswitch field type
+
+ } else {
+ strcat(body, "'");
+ strncat(body, res->ptr(), res->length());
+ strcat(body, "'");
+ } // endif tty
+
+ break;
+ default:
+ strncat(body, res->ptr(), res->length());
+ } // endswitch field type
} else {
if (args[i]->field_type() == MYSQL_TYPE_VARCHAR) {
@@ -2753,7 +2907,7 @@ const COND *ha_connect::cond_push(const COND *cond)
} else if (x && cond)
tdbp->SetCondFil(filp); // Wrong filter
- } else
+ } else if (tty != TYPE_AM_JSN && tty != TYPE_AM_JSON)
tdbp->SetFilter(CondFilter(g, (Item *)cond));
fin:
@@ -2805,7 +2959,7 @@ bool ha_connect::get_error_message(int error, String* buf)
&dummy_errors);
if (trace)
- htrc("GEM(%u): %s\n", len, g->Message);
+ htrc("GEM(%d): len=%u %s\n", error, len, g->Message);
msg[len]= '\0';
buf->copy(msg, (uint)strlen(msg), system_charset_info);
@@ -2901,7 +3055,7 @@ int ha_connect::open(const char *name, int mode, uint test_if_locked)
@brief
Make the indexes for this table
*/
-int ha_connect::optimize(THD* thd, HA_CHECK_OPT* check_opt)
+int ha_connect::optimize(THD* thd, HA_CHECK_OPT*)
{
int rc= 0;
PGLOBAL& g= xp->g;
@@ -3105,7 +3259,7 @@ int ha_connect::update_row(const uchar *old_data, uchar *new_data)
@see
sql_acl.cc, sql_udf.cc, sql_delete.cc, sql_insert.cc and sql_select.cc
*/
-int ha_connect::delete_row(const uchar *buf)
+int ha_connect::delete_row(const uchar *)
{
int rc= 0;
DBUG_ENTER("ha_connect::delete_row");
@@ -3385,7 +3539,8 @@ int ha_connect::index_last(uchar *buf)
/****************************************************************************/
/* This is called to get more rows having the same index value. */
/****************************************************************************/
-int ha_connect::index_next_same(uchar *buf, const uchar *key, uint keylen)
+//t ha_connect::index_next_same(uchar *buf, const uchar *key, uint keylen)
+int ha_connect::index_next_same(uchar *buf, const uchar *, uint)
{
int rc;
DBUG_ENTER("ha_connect::index_next_same");
@@ -3575,7 +3730,7 @@ int ha_connect::rnd_next(uchar *buf)
@see
filesort.cc, sql_select.cc, sql_delete.cc and sql_update.cc
*/
-void ha_connect::position(const uchar *record)
+void ha_connect::position(const uchar *)
{
DBUG_ENTER("ha_connect::position");
//if (((PTDBASE)tdbp)->GetDef()->Indexable())
@@ -3758,7 +3913,7 @@ int ha_connect::info(uint flag)
@see
ha_innodb.cc
*/
-int ha_connect::extra(enum ha_extra_function operation)
+int ha_connect::extra(enum ha_extra_function /*operation*/)
{
DBUG_ENTER("ha_connect::extra");
DBUG_RETURN(0);
@@ -3837,11 +3992,11 @@ bool ha_connect::check_privileges(THD *thd, PTOS options, char *dbn)
case TAB_JSON:
if (options->filename && *options->filename) {
char *s, path[FN_REFLEN], dbpath[FN_REFLEN];
-#if defined(WIN32)
+#if defined(__WIN__)
s= "\\";
-#else // !WIN32
+#else // !__WIN__
s= "/";
-#endif // !WIN32
+#endif // !__WIN__
strcpy(dbpath, mysql_real_data_home);
if (db)
@@ -3990,6 +4145,7 @@ MODE ha_connect::CheckMode(PGLOBAL g, THD *thd,
case SQLCOM_UPDATE_MULTI:
case SQLCOM_SELECT:
case SQLCOM_OPTIMIZE:
+ case SQLCOM_SET_OPTION:
break;
case SQLCOM_LOCK_TABLES:
locked= 1;
@@ -4014,6 +4170,10 @@ MODE ha_connect::CheckMode(PGLOBAL g, THD *thd,
break;
// } // endif partitioned
+ case SQLCOM_END:
+ // Met in procedures: IF(EXISTS(SELECT...
+ newmode= MODE_READ;
+ break;
default:
htrc("Unsupported sql_command=%d\n", thd_sql_command(thd));
strcpy(g->Message, "CONNECT Unsupported command");
@@ -4361,7 +4521,7 @@ int ha_connect::external_lock(THD *thd, int lock_type)
@see
get_lock_data() in lock.cc
*/
-THR_LOCK_DATA **ha_connect::store_lock(THD *thd,
+THR_LOCK_DATA **ha_connect::store_lock(THD *,
THR_LOCK_DATA **to,
enum thr_lock_type lock_type)
{
@@ -4509,8 +4669,13 @@ int ha_connect::delete_or_rename_table(const char *name, const char *to)
} // endif pos
- } else // Avoid infamous DBUG_ASSERT
- thd->get_stmt_da()->reset_diagnostics_area();
+ } // endif open_table_def
+
+// This below was done to avoid DBUG_ASSERT in some case that
+// we don't know anymore what they were. It was suppressed because
+// it did cause assertion in other cases (see MDEV-7935)
+// } else // Avoid infamous DBUG_ASSERT
+// thd->get_stmt_da()->reset_diagnostics_area();
free_table_share(share);
} else // Temporary file
@@ -4590,9 +4755,31 @@ ha_rows ha_connect::records_in_range(uint inx, key_range *min_key,
else
rows= HA_POS_ERROR;
+ if (trace)
+ htrc("records_in_range: rows=%llu\n", rows);
+
DBUG_RETURN(rows);
} // end of records_in_range
+// 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)
+{
+ if (src)
+ return false;
+ else if (host && stricmp(host, "localhost") && strcmp(host, "127.0.0.1"))
+ return false;
+ else if (db && stricmp(db, s->db.str))
+ return false;
+ else if (tab && stricmp(tab, s->table_name.str))
+ return false;
+ else if (port && port != (signed)GetDefaultPort())
+ return false;
+
+ strcpy(g->Message, "This MySQL table is defined on itself");
+ return true;
+} // end of CheckSelf
+
/**
Convert an ISO-8859-1 column name to UTF-8
*/
@@ -4615,12 +4802,12 @@ static char *encode(PGLOBAL g, const char *cnm)
@return
Return 0 if ok
*/
-static bool add_field(String *sql, const char *field_name, int typ,
- int len, int dec, char *key, uint tm, const char *rem,
- char *dft, char *xtra, int flag, bool dbf, char v)
+static bool add_field(String *sql, const char *field_name, int typ, int len,
+ int dec, char *key, uint tm, const char *rem, char *dft,
+ char *xtra, char *fmt, int flag, bool dbf, char v)
{
char var = (len > 255) ? 'V' : v;
- bool error= false;
+ bool q, error= false;
const char *type= PLGtoMYSQLtype(typ, dbf, var);
error|= sql->append('`');
@@ -4661,7 +4848,12 @@ static bool add_field(String *sql, const char *field_name, int typ,
if (dft && *dft) {
error|= sql->append(" DEFAULT ");
- if (!IsTypeNum(typ)) {
+ if (typ == TYPE_DATE)
+ q = (strspn(dft, "0123456789 -:/") == strlen(dft));
+ else
+ q = !IsTypeNum(typ);
+
+ if (q) {
error|= sql->append("'");
error|= sql->append_for_single_quote(dft, strlen(dft));
error|= sql->append("'");
@@ -4681,6 +4873,12 @@ static bool add_field(String *sql, const char *field_name, int typ,
error|= sql->append("'");
} // endif rem
+ if (fmt && *fmt) {
+ error|= sql->append(" FIELD_FORMAT='");
+ error|= sql->append_for_single_quote(fmt, strlen(fmt));
+ error|= sql->append("'");
+ } // endif flag
+
if (flag) {
error|= sql->append(" FLAG=");
error|= sql->append_ulonglong(flag);
@@ -4743,7 +4941,7 @@ static int init_table_share(THD* thd,
oom|= sql->append(' ');
oom|= sql->append(opt->name);
oom|= sql->append('=');
- oom|= sql->append(vull ? "ON" : "OFF");
+ oom|= sql->append(vull ? "YES" : "NO");
} // endif vull
break;
@@ -4785,25 +4983,6 @@ static int init_table_share(THD* thd,
sql->ptr(), sql->length());
} // end of init_table_share
-// 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)
-{
- if (src)
- return false;
- else if (host && stricmp(host, "localhost") && strcmp(host, "127.0.0.1"))
- return false;
- else if (db && stricmp(db, s->db.str))
- return false;
- else if (tab && stricmp(tab, s->table_name.str))
- return false;
- else if (port && port != (signed)GetDefaultPort())
- return false;
-
- strcpy(g->Message, "This MySQL table is defined on itself");
- return true;
-} // end of CheckSelf
-
/**
@brief
connect_assisted_discovery() is called when creating a table with no columns.
@@ -4816,7 +4995,7 @@ bool CheckSelf(PGLOBAL g, TABLE_SHARE *s, const char *host,
@note
this function is no more called in case of CREATE .. SELECT
*/
-static int connect_assisted_discovery(handlerton *hton, THD* thd,
+static int connect_assisted_discovery(handlerton *, THD* thd,
TABLE_SHARE *table_s,
HA_CREATE_INFO *create_info)
{
@@ -4825,12 +5004,15 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
const char *user, *fn, *db, *host, *pwd, *sep, *tbl, *src;
const char *col, *ocl, *rnk, *pic, *fcl, *skc;
char *tab, *dsn, *shm, *dpath;
-#if defined(WIN32)
+#if defined(__WIN__)
char *nsp= NULL, *cls= NULL;
-#endif // WIN32
- int port= 0, hdr= 0, mxr __attribute__((unused))= 0, mxe= 0, rc= 0;
- int cop __attribute__((unused)) = 0;
+#endif // __WIN__
+ int port= 0, hdr= 0, mxr= 0, mxe= 0, rc= 0;
+ int cop __attribute__((unused))= 0, lrecl= 0;
#if defined(ODBC_SUPPORT)
+ POPARM sop = NULL;
+ char *ucnc = NULL;
+ bool cnc= false;
int cto= -1, qto= -1;
#endif // ODBC_SUPPORT
uint tm, fnc= FNC_NO, supfnc= (FNC_NO | FNC_COL);
@@ -4872,10 +5054,12 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
hdr= (int)topt->header;
tbl= topt->tablist;
col= topt->colist;
+ lrecl= (int)topt->lrecl;
if (topt->oplist) {
host= GetListOption(g, "host", topt->oplist, "localhost");
- user= GetListOption(g, "user", topt->oplist, "root");
+ user= GetListOption(g, "user", topt->oplist,
+ (ttp == TAB_ODBC ? NULL : "root"));
// Default value db can come from the DBNAME=xxx option.
db= GetListOption(g, "database", topt->oplist, db);
col= GetListOption(g, "colist", topt->oplist, col);
@@ -4885,15 +5069,18 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
skc= GetListOption(g, "skipcol", topt->oplist, NULL);
rnk= GetListOption(g, "rankcol", topt->oplist, NULL);
pwd= GetListOption(g, "password", topt->oplist);
-#if defined(WIN32)
+#if defined(__WIN__)
nsp= GetListOption(g, "namespace", topt->oplist);
cls= GetListOption(g, "class", topt->oplist);
-#endif // WIN32
+#endif // __WIN__
port= atoi(GetListOption(g, "port", topt->oplist, "0"));
#if defined(ODBC_SUPPORT)
mxr= atoi(GetListOption(g,"maxres", topt->oplist, "0"));
cto= atoi(GetListOption(g,"ConnectTimeout", topt->oplist, "-1"));
qto= atoi(GetListOption(g,"QueryTimeout", topt->oplist, "-1"));
+
+ if ((ucnc= GetListOption(g, "UseDSN", topt->oplist)))
+ cnc= (!*ucnc || *ucnc == 'y' || *ucnc == 'Y' || atoi(ucnc) != 0);
#endif
mxe= atoi(GetListOption(g,"maxerr", topt->oplist, "0"));
#if defined(PROMPT_OK)
@@ -4901,7 +5088,7 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
#endif // PROMPT_OK
} else {
host= "localhost";
- user= "root";
+ user= (ttp == TAB_ODBC ? NULL : "root");
} // endif option_list
if (!(shm= (char*)db))
@@ -4942,8 +5129,7 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
goto err;
} // endif tbl
- tab= (char*)PlugSubAlloc(g, NULL, strlen(tbl) + 1);
- strcpy(tab, tbl);
+ tab= PlugDup(g, tbl);
if ((p= strchr(tab, ',')))
*p= 0;
@@ -4978,10 +5164,18 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
} // endif dsn
#endif // PROMPT_OK
- } else if (!dsn)
+ } else if (!dsn) {
sprintf(g->Message, "Missing %s connection string", topt->type);
- else
+ } else {
+ // Store ODBC additional parameters
+ sop= (POPARM)PlugSubAlloc(g, NULL, sizeof(ODBCPARM));
+ sop->User= (char*)user;
+ sop->Pwd= (char*)pwd;
+ sop->Cto= cto;
+ sop->Qto= qto;
+ sop->UseCnc= cnc;
ok= true;
+ } // endif's
supfnc |= (FNC_TABLE | FNC_DSN | FNC_DRIVER);
break;
@@ -4996,7 +5190,6 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
ok= true;
break;
-#if defined(MYSQL_SUPPORT)
case TAB_MYSQL:
ok= true;
@@ -5036,14 +5229,15 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
ok= false;
break;
-#endif // MYSQL_SUPPORT
-#if defined(WIN32)
+#if defined(__WIN__)
case TAB_WMI:
ok= true;
break;
-#endif // WIN32
+#endif // __WIN__
+#if defined(PIVOT_SUPPORT)
case TAB_PIVOT:
supfnc= FNC_NO;
+#endif // PIVOT_SUPPORT
case TAB_PRX:
case TAB_TBL:
case TAB_XCL:
@@ -5062,6 +5256,16 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
strcpy(g->Message, "Missing OEM module or subtype");
break;
+#if defined(LIBXML2_SUPPORT) || defined(DOMDOC_SUPPORT)
+ case TAB_XML:
+#endif // LIBXML2_SUPPORT || DOMDOC_SUPPORT
+ case TAB_JSON:
+ if (!fn)
+ sprintf(g->Message, "Missing %s file name", topt->type);
+ else
+ ok= true;
+
+ break;
case TAB_VIR:
ok= true;
break;
@@ -5083,7 +5287,7 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
} // endif src
if (ok) {
- char *cnm, *rem, *dft, *xtra, *key;
+ char *cnm, *rem, *dft, *xtra, *key, *fmt;
int i, len, prec, dec, typ, flg;
// if (cat)
@@ -5112,15 +5316,15 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
case FNC_NO:
case FNC_COL:
if (src) {
- qrp= ODBCSrcCols(g, dsn, (char*)src, cto, qto);
+ qrp= ODBCSrcCols(g, dsn, (char*)src, sop);
src= NULL; // for next tests
} else
- qrp= ODBCColumns(g, dsn, shm, tab, NULL,
- mxr, cto, qto, fnc == FNC_COL);
+ qrp= ODBCColumns(g, dsn, shm, tab, NULL,
+ mxr, fnc == FNC_COL, sop);
break;
case FNC_TABLE:
- qrp= ODBCTables(g, dsn, shm, tab, mxr, cto, qto, true);
+ qrp= ODBCTables(g, dsn, shm, tab, mxr, true, sop);
break;
case FNC_DSN:
qrp= ODBCDataSources(g, mxr, true);
@@ -5135,20 +5339,18 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
break;
#endif // ODBC_SUPPORT
-#if defined(MYSQL_SUPPORT)
case TAB_MYSQL:
qrp= MyColumns(g, thd, host, db, user, pwd, tab,
NULL, port, fnc == FNC_COL);
break;
-#endif // MYSQL_SUPPORT
case TAB_CSV:
qrp= CSVColumns(g, dpath, fn, spc, qch, hdr, mxe, fnc == FNC_COL);
break;
-#if defined(WIN32)
+#if defined(__WIN__)
case TAB_WMI:
qrp= WMIColumns(g, nsp, cls, fnc == FNC_COL);
break;
-#endif // WIN32
+#endif // __WIN__
case TAB_PRX:
case TAB_TBL:
case TAB_XCL:
@@ -5166,12 +5368,22 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
} // endif OcrColumns
break;
+#if defined(PIVOT_SUPPORT)
case TAB_PIVOT:
qrp= PivotColumns(g, tab, src, pic, fcl, skc, host, db, user, pwd, port);
break;
+#endif // PIVOT_SUPPORT
case TAB_VIR:
- qrp= VirColumns(g, tab, (char*)db, fnc == FNC_COL);
+ qrp= VirColumns(g, fnc == FNC_COL);
+ break;
+ case TAB_JSON:
+ qrp= JSONColumns(g, (char*)db, topt, fnc == FNC_COL);
+ break;
+#if defined(LIBXML2_SUPPORT) || defined(DOMDOC_SUPPORT)
+ case TAB_XML:
+ qrp= XMLColumns(g, (char*)db, tab, topt, fnc == FNC_COL);
break;
+#endif // LIBXML2_SUPPORT || DOMDOC_SUPPORT
case TAB_OEM:
qrp= OEMColumns(g, topt, tab, (char*)db, fnc == FNC_COL);
break;
@@ -5188,7 +5400,7 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
if (fnc != FNC_NO || src || ttp == TAB_PIVOT) {
// Catalog like table
for (crp= qrp->Colresp; !rc && crp; crp= crp->Next) {
- cnm= encode(g, crp->Name);
+ cnm= (ttp == TAB_PIVOT) ? crp->Name : encode(g, crp->Name);
typ= crp->Type;
len= crp->Length;
dec= crp->Prec;
@@ -5204,12 +5416,14 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
NOT_NULL_FLAG, "", flg, dbf, v);
#else // !NEW_WAY
if (add_field(&sql, cnm, typ, len, dec, NULL, NOT_NULL_FLAG,
- NULL, NULL, NULL, flg, dbf, v))
+ NULL, NULL, NULL, NULL, flg, dbf, v))
rc= HA_ERR_OUT_OF_MEM;
#endif // !NEW_WAY
} // endfor crp
- } else {
+ } else {
+ char *schem= NULL;
+
// Not a catalog table
if (!qrp->Nblin) {
if (tab)
@@ -5225,7 +5439,7 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
typ= len= prec= dec= 0;
tm= NOT_NULL_FLAG;
cnm= (char*)"noname";
- dft= xtra= key= NULL;
+ dft= xtra= key= fmt= NULL;
v= ' ';
#if defined(NEW_WAY)
rem= "";
@@ -5237,9 +5451,10 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
for (crp= qrp->Colresp; crp; crp= crp->Next)
switch (crp->Fld) {
case FLD_NAME:
- if (ttp == TAB_CSV && topt->data_charset &&
+ if (ttp == TAB_PRX ||
+ (ttp == TAB_CSV && topt->data_charset &&
(!stricmp(topt->data_charset, "UTF8") ||
- !stricmp(topt->data_charset, "UTF-8")))
+ !stricmp(topt->data_charset, "UTF-8"))))
cnm= crp->Kdata->GetCharValue(i);
else
cnm= encode(g, crp->Kdata->GetCharValue(i));
@@ -5264,6 +5479,9 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
tm= 0; // Nullable
break;
+ case FLD_FORMAT:
+ fmt= (crp->Kdata) ? crp->Kdata->GetCharValue(i) : NULL;
+ break;
case FLD_REM:
rem= crp->Kdata->GetCharValue(i);
break;
@@ -5289,27 +5507,59 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
key= crp->Kdata->GetCharValue(i);
break;
+ case FLD_SCHEM:
+#if defined(ODBC_SUPPORT)
+ if (ttp == TAB_ODBC && crp->Kdata) {
+ if (schem && stricmp(schem, crp->Kdata->GetCharValue(i))) {
+ sprintf(g->Message,
+ "Several %s tables found, specify DBNAME", tab);
+ my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
+ goto err;
+ } else if (!schem)
+ schem= crp->Kdata->GetCharValue(i);
+
+ } // endif ttp
+#endif // ODBC_SUPPORT
default:
break; // Ignore
} // endswitch Fld
#if defined(ODBC_SUPPORT)
if (ttp == TAB_ODBC) {
- int plgtyp;
+ int plgtyp;
+ bool w= false; // Wide character type
// typ must be PLG type, not SQL type
- if (!(plgtyp= TranslateSQLType(typ, dec, prec, v))) {
- sprintf(g->Message, "Unsupported SQL type %d", typ);
- my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
- goto err;
+ if (!(plgtyp= TranslateSQLType(typ, dec, prec, v, w))) {
+ if (GetTypeConv() == TPC_SKIP) {
+ // Skip this column
+ sprintf(g->Message, "Column %s skipped (unsupported type %d)",
+ cnm, typ);
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
+ continue;
+ } else {
+ sprintf(g->Message, "Unsupported SQL type %d", typ);
+ my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
+ goto err;
+ } // endif type_conv
+
} else
typ= plgtyp;
switch (typ) {
+ case TYPE_STRING:
+ if (w) {
+ sprintf(g->Message, "Column %s is wide characters", cnm);
+ push_warning(thd, Sql_condition::WARN_LEVEL_NOTE, 0, g->Message);
+ } // endif w
+
+ break;
case TYPE_DOUBLE:
// Some data sources do not count dec in length (prec)
prec += (dec + 2); // To be safe
+ break;
case TYPE_DECIM:
+ prec= len;
break;
default:
dec= 0;
@@ -5330,7 +5580,7 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
tm, rem, 0, dbf, v);
#else // !NEW_WAY
if (add_field(&sql, cnm, typ, prec, dec, key, tm, rem, dft, xtra,
- 0, dbf, v))
+ fmt, 0, dbf, v))
rc= HA_ERR_OUT_OF_MEM;
#endif // !NEW_WAY
} // endfor i
@@ -5562,11 +5812,11 @@ int ha_connect::create(const char *name, TABLE *table_arg,
// on Windows and libxml2 otherwise
switch (*xsup) {
case '*':
-#if defined(WIN32)
+#if defined(__WIN__)
dom= true;
-#else // !WIN32
+#else // !__WIN__
dom= false;
-#endif // !WIN32
+#endif // !__WIN__
break;
case 'M':
case 'D':
@@ -5599,6 +5849,18 @@ int ha_connect::create(const char *name, TABLE *table_arg,
} // endif type
+ if (type == TAB_JSON) {
+ int pretty= atoi(GetListOption(g, "Pretty", options->oplist, "2"));
+
+ if (!options->lrecl && pretty != 2) {
+ sprintf(g->Message, "LRECL must be specified for pretty=%d", pretty);
+ my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
+ rc= HA_ERR_INTERNAL_ERROR;
+ DBUG_RETURN(rc);
+ } // endif lrecl
+
+ } // endif type
+
// Check column types
for (field= table_arg->field; *field; field++) {
fp= *field;
@@ -5901,11 +6163,11 @@ bool ha_connect::FileExists(const char *fn, bool bf)
NULL, NULL, 0, 0))
return true;
-#if defined(WIN32)
+#if defined(__WIN__)
s= "\\";
-#else // !WIN32
+#else // !__WIN__
s= "/";
-#endif // !WIN32
+#endif // !__WIN__
if (IsPartitioned()) {
sprintf(tfn, fn, GetPartName());
@@ -6247,8 +6509,7 @@ fin:
@note: This function is no more called by check_if_supported_inplace_alter
*/
-bool ha_connect::check_if_incompatible_data(HA_CREATE_INFO *info,
- uint table_changes)
+bool ha_connect::check_if_incompatible_data(HA_CREATE_INFO *, uint)
{
DBUG_ENTER("ha_connect::check_if_incompatible_data");
// TO DO: really implement and check it.
@@ -6341,58 +6602,6 @@ struct st_mysql_storage_engine connect_storage_engine=
/***********************************************************************/
/* CONNECT global variables definitions. */
/***********************************************************************/
-// Size used when converting TEXT columns to VARCHAR
-#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:
- no: Unsupported types -> TYPE_ERROR
- yes: TEXT -> VARCHAR
- skip: skip unsupported type columns in Discovery
-*/
-const char *xconv_names[]=
-{
- "NO", "YES", "SKIP", NullS
-};
-
-TYPELIB xconv_typelib=
-{
- array_elements(xconv_names) - 1, "xconv_typelib",
- xconv_names, NULL
-};
-
-#if defined(_DEBUG)
-static MYSQL_SYSVAR_ENUM(
- type_conv, // name
- xconv, // varname
- PLUGIN_VAR_RQCMDARG, // opt
- "Unsupported types conversion.", // comment
- NULL, // check
- NULL, // update function
- 0, // def (no)
- &xconv_typelib); // typelib
-#else
-static MYSQL_SYSVAR_ENUM(
- type_conv, // name
- xconv, // varname
- PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
- "Unsupported types conversion.", // comment
- NULL, // check
- 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, xmap, PLUGIN_VAR_RQCMDARG,
@@ -6425,6 +6634,7 @@ static struct st_mysql_sys_var* connect_system_variables[]= {
#if defined(XMSG)
MYSQL_SYSVAR(errmsg_dir_path),
#endif // XMSG
+ MYSQL_SYSVAR(json_grp_size),
NULL
};
@@ -6441,7 +6651,7 @@ maria_declare_plugin(connect)
0x0103, /* version number (1.03) */
NULL, /* status variables */
connect_system_variables, /* system variables */
- "1.03.0005", /* string version */
+ "1.03.0007", /* 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 922a69a3991..611f9ba0b54 100644
--- a/storage/connect/ha_connect.h
+++ b/storage/connect/ha_connect.h
@@ -1,4 +1,4 @@
-/* Copyright (C) Olivier Bertrand 2004 - 2014
+/* Copyright (C) Olivier Bertrand 2004 - 2015
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
@@ -26,6 +26,11 @@
#pragma interface /* gcc class implementation */
#endif
+/****************************************************************************/
+/* mycat.h contains the TOS, PTOS, ha_table_option_struct declarations. */
+/****************************************************************************/
+#include "mycat.h"
+
static char *strz(PGLOBAL g, LEX_STRING &ls);
/****************************************************************************/
@@ -56,11 +61,7 @@ public:
oldopn= newopn= NULL;
oldpix= newpix= NULL;}
- inline char *SetName(PGLOBAL g, char *name) {
- char *nm= NULL;
- if (name) {nm= (char*)PlugSubAlloc(g, NULL, strlen(name) + 1);
- strcpy(nm, name);}
- return nm;}
+ inline char *SetName(PGLOBAL g, char *name) {return PlugDup(g, name);}
bool oldsep; // Sepindex before create/alter
bool newsep; // Sepindex after create/alter
@@ -72,7 +73,6 @@ public:
typedef class XCHK *PCHK;
typedef class user_connect *PCONNECT;
-typedef struct ha_table_option_struct TOS, *PTOS;
typedef struct ha_field_option_struct FOS, *PFOS;
typedef struct ha_index_option_struct XOS, *PXOS;
@@ -84,6 +84,9 @@ extern handlerton *connect_hton;
These can be specified in the CREATE TABLE:
CREATE TABLE ( ... ) {...here...}
*/
+#if 0 // moved to mycat.h
+typedef struct ha_table_option_struct TOS, *PTOS;
+
struct ha_table_option_struct {
const char *type;
const char *filename;
@@ -115,6 +118,7 @@ struct ha_table_option_struct {
bool readonly;
bool sepindex;
};
+#endif // 0
/**
structure for CREATE TABLE options (field options)
@@ -239,7 +243,7 @@ public:
int CheckRecord(PGLOBAL g, const uchar *oldbuf, uchar *newbuf);
int ReadIndexed(uchar *buf, OPVAL op, const uchar* key= NULL,
uint key_len= 0);
- bool MakeKeyWhere(PGLOBAL g, char *qry, OPVAL op, char *q,
+ bool MakeKeyWhere(PGLOBAL g, PSTRG qry, OPVAL op, char q,
const void *key, int klen);
inline char *Strz(LEX_STRING &ls);
diff --git a/storage/connect/json.cpp b/storage/connect/json.cpp
index 983f45d9cee..3d03bea5d00 100644
--- a/storage/connect/json.cpp
+++ b/storage/connect/json.cpp
@@ -1,1055 +1,1162 @@
-/*************** json CPP Declares Source Code File (.H) ***************/
-/* Name: json.cpp Version 1.0 */
-/* */
-/* (C) Copyright to the author Olivier BERTRAND 2014 - 2015 */
-/* */
-/* This file contains the JSON classes functions. */
-/***********************************************************************/
-
-/***********************************************************************/
-/* Include relevant sections of the MariaDB header file. */
-/***********************************************************************/
-#include <my_global.h>
-
-/***********************************************************************/
-/* Include application header files: */
-/* global.h is header containing all global declarations. */
-/* plgdbsem.h is header containing the DB application declarations. */
-/* xjson.h is header containing the JSON classes declarations. */
-/***********************************************************************/
-#include "global.h"
-#include "plgdbsem.h"
-#include "json.h"
-
-#define ARGS MY_MIN(24,len-i),s+MY_MAX(i-3,0)
-
-#if defined(WIN32)
-#define EL "\r\n"
-#else
-#define EL "\n"
-#endif
-
-/***********************************************************************/
-/* Parse a json string. */
-/***********************************************************************/
-PJSON ParseJson(PGLOBAL g, char *s, int len, int pretty, bool *comma)
-{
- int i;
- bool b = false;
- PJSON jsp = NULL;
- STRG src;
-
- if (!s || !len) {
- strcpy(g->Message, "Void JSON object");
- return NULL;
- } else if (comma)
- *comma = false;
-
- src.str = s;
- src.len = len;
-
- for (i = 0; i < len; i++)
- switch (s[i]) {
- case '[':
- if (jsp) {
- strcpy(g->Message, "More than one item in file");
- return NULL;
- } else if (!(jsp = ParseArray(g, ++i, src)))
- return NULL;
-
- break;
- case '{':
- if (jsp) {
- strcpy(g->Message, "More than one item in file");
- return NULL;
- } else if (!(jsp = ParseObject(g, ++i, src)))
- return NULL;
- break;
- case ' ':
- case '\t':
- case '\n':
- case '\r':
- break;
- case ',':
- if (jsp && pretty == 1) {
- if (comma)
- *comma = true;
-
- break;
- } // endif pretty
-
- sprintf(g->Message, "Unexpected ',' (pretty=%d)", pretty);
- return NULL;
- case '(':
- b = true;
- break;
- case ')':
- if (b) {
- b = false;
- break;
- } // endif b
-
- default:
- sprintf(g->Message, "Bad '%c' character near %.*s",
- s[i], ARGS);
- return NULL;
- }; // endswitch s[i]
-
- if (!jsp)
- sprintf(g->Message, "Invalid Json string '%.*s'", 50, s);
-
- return jsp;
-} // end of ParseJson
-
-/***********************************************************************/
-/* Parse a JSON Array. */
-/***********************************************************************/
-PJAR ParseArray(PGLOBAL g, int& i, STRG& src)
-{
- char *s = src.str;
- int len = src.len;
- int level = 0;
- PJAR jarp = new(g) JARRAY;
- PJVAL jvp = NULL;
-
- for (; i < len; i++)
- switch (s[i]) {
- case ',':
- if (level < 2) {
- sprintf(g->Message, "Unexpected ',' near %.*s",ARGS);
- return NULL;
- } else
- level = 1;
-
- break;
- case ']':
- if (level == 1) {
- sprintf(g->Message, "Unexpected ',]' near %.*s", ARGS);
- return NULL;
- } // endif level
-
- jarp->InitArray(g);
- return jarp;
- case ' ':
- case '\t':
- case '\n':
- case '\r':
- break;
- default:
- if (level == 2) {
- sprintf(g->Message, "Unexpected value near %.*s", ARGS);
- return NULL;
- } else if ((jvp = ParseValue(g, i, src))) {
- jarp->AddValue(g, jvp);
- level = 2;
- } else
- return NULL;
-
- level = 2;
- break;
- }; // endswitch s[i]
-
- strcpy(g->Message, "Unexpected EOF in array");
- return NULL;
-} // end of ParseArray
-
-/***********************************************************************/
-/* Parse a JSON Object. */
-/***********************************************************************/
-PJOB ParseObject(PGLOBAL g, int& i, STRG& src)
-{
- PSZ key;
- char *s = src.str;
- int len = src.len;
- int level = 0;
- PJOB jobp = new(g) JOBJECT;
- PJPR jpp = NULL;
-
- for (; i < len; i++)
- switch (s[i]) {
- case '"':
- if (level < 2) {
- if ((key = ParseString(g, ++i, src))) {
- jpp = jobp->AddPair(g, key);
- level = 1;
- } else
- return NULL;
-
- } else {
- sprintf(g->Message, "misplaced string near %.*s", ARGS);
- return NULL;
- } // endif level
-
- break;
- case ':':
- if (level == 1) {
- if (!(jpp->Val = ParseValue(g, ++i, src)))
- return NULL;
-
- level = 2;
- } else {
- sprintf(g->Message, "Unexpected ':' near %.*s", ARGS);
- return NULL;
- } // endif level
-
- break;
- case ',':
- if (level < 2) {
- sprintf(g->Message, "Unexpected ',' near %.*s", ARGS);
- return NULL;
- } else
- level = 1;
-
- break;
- case '}':
- if (level == 1) {
- sprintf(g->Message, "Unexpected '}' near %.*s", ARGS);
- return NULL;
- } // endif level
-
- return jobp;
- case ' ':
- case '\t':
- case '\n':
- case '\r':
- break;
- default:
- sprintf(g->Message, "Unexpected character '%c' near %.*s",
- s[i], ARGS);
- return NULL;
- }; // endswitch s[i]
-
- strcpy(g->Message, "Unexpected EOF in Object");
- return NULL;
-} // end of ParseObject
-
-/***********************************************************************/
-/* Parse a JSON Value. */
-/***********************************************************************/
-PJVAL ParseValue(PGLOBAL g, int& i, STRG& src)
-{
- char *strval, *s = src.str;
- int n, len = src.len;
- PJVAL jvp = new(g) JVALUE;
-
- for (; i < len; i++)
- switch (s[i]) {
- case ' ':
- case '\t':
- case '\n':
- case '\r':
- break;
- default:
- goto suite;
- } // endswitch
-
- suite:
- switch (s[i]) {
- case '[':
- if (!(jvp->Jsp = ParseArray(g, ++i, src)))
- return NULL;
-
- break;
- case '{':
- if (!(jvp->Jsp = ParseObject(g, ++i, src)))
- return NULL;
-
- break;
- case '"':
- if ((strval = ParseString(g, ++i, src)))
- jvp->Value = AllocateValue(g, strval, TYPE_STRING);
- else
- return NULL;
-
- break;
- case 't':
- if (!strncmp(s + i, "true", 4)) {
- n = 1;
- jvp->Value = AllocateValue(g, &n, TYPE_TINY);
- i += 3;
- } else
- goto err;
-
- break;
- case 'f':
- if (!strncmp(s + i, "false", 5)) {
- n = 0;
- jvp->Value = AllocateValue(g, &n, TYPE_TINY);
- i += 4;
- } else
- goto err;
-
- break;
- case 'n':
- if (!strncmp(s + i, "null", 4))
- i += 3;
- else
- goto err;
-
- break;
- case '-':
- default:
- if (s[i] == '-' || isdigit(s[i])) {
- if (!(jvp->Value = ParseNumeric(g, i, src)))
- goto err;
-
- } else
- goto err;
-
- }; // endswitch s[i]
-
- jvp->Size = 1;
- return jvp;
-
-err:
- sprintf(g->Message, "Unexpected character '%c' near %.*s",
- s[i], ARGS);
- return NULL;
-} // end of ParseValue
-
-/***********************************************************************/
-/* Unescape and parse a JSON string. */
-/***********************************************************************/
-char *ParseString(PGLOBAL g, int& i, STRG& src)
-{
- char *p, *s = src.str;
- int n = 0, len = src.len;
-
- // The size to allocate is not known yet
- p = (char*)PlugSubAlloc(g, NULL, 0);
-
- for (; i < len; i++)
- switch (s[i]) {
- case '"':
- p[n++] = 0;
- PlugSubAlloc(g, NULL, n);
- return p;
- case '\\':
- if (++i < len) {
- if (s[i] == 'u') {
- if (len - i > 5) {
-// if (charset == utf8) {
- char xs[5];
- uint hex;
-
- xs[0] = s[++i];
- xs[1] = s[++i];
- xs[2] = s[++i];
- xs[3] = s[++i];
- xs[4] = 0;
- hex = strtoul(xs, NULL, 16);
-
- if (hex < 0x80) {
- p[n] = (uchar)hex;
- } else if (hex < 0x800) {
- p[n++] = (uchar)(0xC0 | (hex >> 6));
- p[n] = (uchar)(0x80 | (hex & 0x3F));
- } else if (hex < 0x10000) {
- p[n++] = (uchar)(0xE0 | (hex >> 12));
- p[n++] = (uchar)(0x80 | ((hex >> 6) & 0x3f));
- p[n] = (uchar)(0x80 | (hex & 0x3f));
- } else
- p[n] = '?';
-
-#if 0
- } else {
- char xs[3];
- UINT hex;
-
- i += 2;
- xs[0] = s[++i];
- xs[1] = s[++i];
- xs[2] = 0;
- hex = strtoul(xs, NULL, 16);
- p[n] = (char)hex;
- } // endif charset
-#endif // 0
- } else
- goto err;
-
- } else switch(s[i]) {
- case 't': p[n] = '\t'; break;
- case 'n': p[n] = '\n'; break;
- case 'r': p[n] = '\r'; break;
- case 'b': p[n] = '\b'; break;
- case 'f': p[n] = '\f'; break;
- default: p[n] = s[i]; break;
- } // endswitch
-
- n++;
- } else
- goto err;
-
- break;
- default:
- p[n++] = s[i];
- break;
- }; // endswitch s[i]
-
- err:
- strcpy(g->Message, "Unexpected EOF in String");
- return NULL;
-} // end of ParseString
-
-/***********************************************************************/
-/* Parse a JSON numeric value. */
-/***********************************************************************/
-PVAL ParseNumeric(PGLOBAL g, int& i, STRG& src)
-{
- char *s = src.str, buf[50];
- int n = 0, len = src.len;
- short nd = 0;
- bool has_dot = false;
- bool has_e = false;
- bool found_digit = false;
- PVAL valp = NULL;
-
- for (; i < len; i++) {
- switch (s[i]) {
- case '.':
- if (!found_digit || has_dot || has_e)
- goto err;
-
- has_dot = true;
- break;
- case 'e':
- case 'E':
- if (!found_digit || has_e)
- goto err;
-
- has_e = true;
- found_digit = false;
- break;
- case '+':
- if (!has_e)
- goto err;
-
- // passthru
- case '-':
- if (found_digit)
- goto err;
-
- break;
- default:
- if (isdigit(s[i])) {
- if (has_dot && !has_e)
- nd++; // Number of decimals
-
- found_digit = true;
- } else
- goto fin;
-
- }; // endswitch s[i]
-
- buf[n++] = s[i];
- } // endfor i
-
- fin:
- if (found_digit) {
- buf[n] = 0;
-
- if (has_dot || has_e) {
- double dv = strtod(buf, NULL);
-
- valp = AllocateValue(g, &dv, TYPE_DOUBLE, nd);
- } else {
- int iv = strtol(buf, NULL, 10);
-
- valp = AllocateValue(g, &iv, TYPE_INT);
- } // endif has
-
- i--; // Unstack following character
- return valp;
- } else {
- strcpy(g->Message, "No digit found");
- return NULL;
- } // endif found_digit
-
- err:
- strcpy(g->Message, "Unexpected EOF in number");
- return NULL;
-} // end of ParseNumeric
-
-/***********************************************************************/
-/* Serialize a JSON tree: */
-/***********************************************************************/
-PSZ Serialize(PGLOBAL g, PJSON jsp, FILE *fs, int pretty)
-{
- bool b = false, err = true;
- JOUT *jp;
-
- g->Message[0] = 0;
-
- if (!jsp) {
- strcpy(g->Message, "Null json tree");
- return NULL;
- } else if (!fs) {
- // Serialize to a string
- jp = new(g) JOUTSTR(g);
- b = pretty == 1;
- } else if (pretty == 2) {
- // Serialize to a pretty file
- jp = new(g) JOUTPRT(g, fs);
- } else {
- // Serialize to a flat file
- jp = new(g) JOUTFILE(g, fs);
- b = pretty == 1;
- } // endif's
-
- switch (jsp->GetType()) {
- case TYPE_JAR:
- err = SerializeArray(jp, (PJAR)jsp, b);
- break;
- case TYPE_JOB:
- err = (b && jp->WriteChr('\t'));
- err |= SerializeObject(jp, (PJOB)jsp);
- break;
- default:
- strcpy(g->Message, "json tree is not an Array or an Object");
- } // endswitch Type
-
- if (fs) {
- fputc('\n', fs);
- fclose(fs);
- return (err) ? g->Message : NULL;
- } else if (!err) {
- PSZ str = ((JOUTSTR*)jp)->Strp;
-
- jp->WriteChr('\0');
- PlugSubAlloc(g, NULL, ((JOUTSTR*)jp)->N);
- return str;
- } else {
- if (!g->Message[0])
- strcpy(g->Message, "Error in Serialize");
-
- return NULL;
- } // endif's
-
-} // end of Serialize
-
-/***********************************************************************/
-/* Serialize a JSON Array. */
-/***********************************************************************/
-bool SerializeArray(JOUT *js, PJAR jarp, bool b)
-{
- bool first = true;
-
-
- if (js->WriteChr('['))
- return true;
- else if (b && (js->WriteStr(EL) || js->WriteChr('\t')))
- return true;
-
- for (int i = 0; i < jarp->size(); i++) {
- if (first)
- first = false;
- else if (js->WriteChr(','))
- return true;
- else if (b && (js->WriteStr(EL) || js->WriteChr('\t')))
- return true;
-
- if (SerializeValue(js, jarp->GetValue(i)))
- return true;
-
- } // endfor i
-
- if (b && js->WriteStr(EL))
- return true;
-
- return js->WriteChr(']');
-} // end of SerializeArray
-
-/***********************************************************************/
-/* Serialize a JSON Object. */
-/***********************************************************************/
-bool SerializeObject(JOUT *js, PJOB jobp)
-{
- bool first = true;
-
- if (js->WriteChr('{'))
- return true;
-
- for (PJPR pair = jobp->First; pair; pair = pair->Next) {
- if (first)
- first = false;
- else if (js->WriteChr(','))
- return true;
-
- if (js->WriteChr('\"') ||
- js->WriteStr(pair->Key) ||
- js->WriteChr('\"') ||
- js->WriteChr(':') ||
- SerializeValue(js, pair->Val))
- return true;
-
- } // endfor i
-
- return js->WriteChr('}');
-} // end of SerializeObject
-
-/***********************************************************************/
-/* Serialize a JSON Value. */
-/***********************************************************************/
-bool SerializeValue(JOUT *js, PJVAL jvp)
-{
- PJAR jap;
- PJOB jop;
- PVAL valp;
-
- if ((jap = jvp->GetArray()))
- return SerializeArray(js, jap, false);
- else if ((jop = jvp->GetObject()))
- return SerializeObject(js, jop);
- else if (!(valp = jvp->Value) || valp->IsNull())
- return js->WriteStr("null");
- else switch (valp->GetType()) {
- case TYPE_TINY:
- return js->WriteStr(valp->GetTinyValue() ? "true" : "false");
- case TYPE_STRING:
- return js->Escape(valp->GetCharValue());
- default:
- if (valp->IsTypeNum()) {
- char buf[32];
-
- return js->WriteStr(valp->GetCharString(buf));
- } // endif valp
-
- } // endswitch Type
-
-strcpy(js->g->Message, "Unrecognized value");
-return true;
-} // end of SerializeValue
-
-/* -------------------------- Class JOUTSTR -------------------------- */
-
-/***********************************************************************/
-/* JOUTSTR constructor. */
-/***********************************************************************/
-JOUTSTR::JOUTSTR(PGLOBAL g) : JOUT(g)
-{
- PPOOLHEADER pph = (PPOOLHEADER)g->Sarea;
-
- N = 0;
- Max = pph->FreeBlk;
- Max = (Max > 512) ? Max - 512 : Max;
- Strp = (char*)PlugSubAlloc(g, NULL, 0); // Size not know yet
-} // end of JOUTSTR constructor
-
-/***********************************************************************/
-/* Concatenate a string to the Serialize string. */
-/***********************************************************************/
-bool JOUTSTR::WriteStr(const char *s)
-{
- if (s) {
- size_t len = strlen(s);
-
- if (N + len > Max)
- return true;
-
- memcpy(Strp + N, s, len);
- N += len;
- return false;
- } else
- return true;
-
-} // end of WriteStr
-
-/***********************************************************************/
-/* Concatenate a character to the Serialize string. */
-/***********************************************************************/
-bool JOUTSTR::WriteChr(const char c)
-{
- if (N + 1 > Max)
- return true;
-
- Strp[N++] = c;
- return false;
-} // end of WriteChr
-
-/***********************************************************************/
-/* Escape and Concatenate a string to the Serialize string. */
-/***********************************************************************/
-bool JOUTSTR::Escape(const char *s)
-{
- WriteChr('"');
-
- for (unsigned int i = 0; i < strlen(s); i++)
- switch (s[i]) {
- case '\t':
- case '\n':
- case '\r':
- case '\b':
- case '\f':
- case '"': WriteChr('\\');
- // passthru
- default:
- WriteChr(s[i]);
- break;
- } // endswitch s[i]
-
- WriteChr('"');
- return false;
-} // end of Escape
-
-/* ------------------------- Class JOUTFILE -------------------------- */
-
-/***********************************************************************/
-/* Write a string to the Serialize file. */
-/***********************************************************************/
-bool JOUTFILE::WriteStr(const char *s)
-{
- // This is temporary
- fputs(s, Stream);
- return false;
-} // end of WriteStr
-
-/***********************************************************************/
-/* Write a character to the Serialize file. */
-/***********************************************************************/
-bool JOUTFILE::WriteChr(const char c)
-{
- // This is temporary
- fputc(c, Stream);
- return false;
-} // end of WriteChr
-
-/***********************************************************************/
-/* Escape and Concatenate a string to the Serialize string. */
-/***********************************************************************/
-bool JOUTFILE::Escape(const char *s)
-{
- // This is temporary
- fputc('"', Stream);
-
- for (unsigned int i = 0; i < strlen(s); i++)
- switch (s[i]) {
- case '\t': fputs("\\t", Stream); break;
- case '\n': fputs("\\n", Stream); break;
- case '\r': fputs("\\r", Stream); break;
- case '\b': fputs("\\b", Stream); break;
- case '\f': fputs("\\f", Stream); break;
- case '"': fputs("\\\"", Stream); break;
- default:
- fputc(s[i], Stream);
- break;
- } // endswitch s[i]
-
- fputc('"', Stream);
- return false;
-} // end of Escape
-
-/* ------------------------- Class JOUTPRT --------------------------- */
-
-/***********************************************************************/
-/* Write a string to the Serialize pretty file. */
-/***********************************************************************/
-bool JOUTPRT::WriteStr(const char *s)
-{
- // This is temporary
- if (B) {
- fputs(EL, Stream);
- M--;
-
- for (int i = 0; i < M; i++)
- fputc('\t', Stream);
-
- B = false;
- } // endif B
-
- fputs(s, Stream);
- return false;
-} // end of WriteStr
-
-/***********************************************************************/
-/* Write a character to the Serialize pretty file. */
-/***********************************************************************/
-bool JOUTPRT::WriteChr(const char c)
-{
- switch (c) {
- case ':':
- fputs(": ", Stream);
- break;
- case '{':
- case '[':
-#if 0
- if (M)
- fputs(EL, Stream);
-
- for (int i = 0; i < M; i++)
- fputc('\t', Stream);
-#endif // 0
-
- fputc(c, Stream);
- fputs(EL, Stream);
- M++;
-
- for (int i = 0; i < M; i++)
- fputc('\t', Stream);
-
- break;
- case '}':
- case ']':
- M--;
- fputs(EL, Stream);
-
- for (int i = 0; i < M; i++)
- fputc('\t', Stream);
-
- fputc(c, Stream);
- B = true;
- break;
- case ',':
- fputc(c, Stream);
- fputs(EL, Stream);
-
- for (int i = 0; i < M; i++)
- fputc('\t', Stream);
-
- B = false;
- break;
- default:
- fputc(c, Stream);
- } // endswitch c
-
-return false;
-} // end of WriteChr
-
-/* -------------------------- Class JOBJECT -------------------------- */
-
-/***********************************************************************/
-/* Add a new pair to an Object. */
-/***********************************************************************/
-PJPR JOBJECT::AddPair(PGLOBAL g, PSZ key)
-{
- PJPR jpp = new(g) JPAIR(key);
-
- if (Last)
- Last->Next = jpp;
- else
- First = jpp;
-
- Last = jpp;
- Size++;
- return jpp;
-} // end of AddPair
-
-/***********************************************************************/
-/* Get the value corresponding to the given key. */
-/***********************************************************************/
-PJVAL JOBJECT::GetValue(const char* key)
-{
- for (PJPR jp = First; jp; jp = jp->Next)
- if (!strcmp(jp->Key, key))
- return jp->Val;
-
- return NULL;
-} // end of GetValue;
-
-/***********************************************************************/
-/* Return the text corresponding to all keys (XML like). */
-/***********************************************************************/
-PSZ JOBJECT::GetText(PGLOBAL g)
-{
- char *p, *text = (char*)PlugSubAlloc(g, NULL, 0);
- bool b = true;
-
- if (!First)
- return NULL;
- else for (PJPR jp = First; jp; jp = jp->Next) {
- if (!(p = jp->Val->GetString()))
- p = "???";
-
- if (b) {
- strcpy(text, p);
- b = false;
- } else
- strcat(strcat(text, " "), p);
-
- } // endfor jp
-
- PlugSubAlloc(g, NULL, strlen(text) + 1);
- return text;
-} // end of GetValue;
-
-/***********************************************************************/
-/* Set or add a value corresponding to the given key. */
-/***********************************************************************/
-void JOBJECT::SetValue(PGLOBAL g, PJVAL jvp, PSZ key)
-{
- PJPR jp;
-
- for (jp = First; jp; jp = jp->Next)
- if (!strcmp(jp->Key, key)) {
- jp->Val = jvp;
- break;
- } // endif key
-
- if (!jp) {
- jp = AddPair(g, key);
- jp->Val = jvp;
- } // endif jp
-
-} // end of SetValue
-
-/* -------------------------- Class JARRAY --------------------------- */
-
-/***********************************************************************/
-/* Make the array of values from the values list. */
-/***********************************************************************/
-void JARRAY::InitArray(PGLOBAL g)
-{
- int i;
- PJVAL jvp;
-
- for (Size = 0, jvp = First; jvp; jvp = jvp->Next)
- if (!jvp->Del)
- Size++;
-
- if (!Size) {
- return;
- } else if (Size > Alloc) {
- // No need to realloc after deleting values
- Mvals = (PJVAL*)PlugSubAlloc(g, NULL, Size * sizeof(PJVAL));
- Alloc = Size;
- } // endif Size
-
- for (i = 0, jvp = First; jvp; jvp = jvp->Next)
- if (!jvp->Del)
- Mvals[i++] = jvp;
-
-} // end of InitArray
-
-/***********************************************************************/
-/* Get the Nth value of an Array. */
-/***********************************************************************/
-PJVAL JARRAY::GetValue(int i)
-{
- if (Mvals && i >= 0 && i < Size)
- return Mvals[i];
- else
- return NULL;
-} // end of GetValue
-
-/***********************************************************************/
-/* Add a Value to the Arrays Value list. */
-/***********************************************************************/
-PJVAL JARRAY::AddValue(PGLOBAL g, PJVAL jvp)
-{
- if (!jvp)
- jvp = new(g) JVALUE;
-
- if (Last)
- Last->Next = jvp;
- else
- First = jvp;
-
- Last = jvp;
- return jvp;
-} // end of AddValue
-
-/***********************************************************************/
-/* Add a Value to the Arrays Value list. */
-/***********************************************************************/
-bool JARRAY::SetValue(PGLOBAL g, PJVAL jvp, int n)
-{
- int i = 0;
- PJVAL jp, *jpp = &First;
-
- for (i = 0, jp = First; i < n; i++, jp = *(jpp = &jp->Next))
- if (!jp)
- *jpp = jp = new(g) JVALUE;
-
- *jpp = jvp;
- jvp->Next = (jp ? jp->Next : NULL);
- return false;
-} // end of SetValue
-
-/***********************************************************************/
-/* Delete a Value from the Arrays Value list. */
-/***********************************************************************/
-bool JARRAY::DeleteValue(int n)
-{
- PJVAL jvp = GetValue(n);
-
- if (jvp) {
- jvp->Del = true;
- return false;
- } else
- return true;
-
-} // end of DeleteValue
-
-/* -------------------------- Class JVALUE- -------------------------- */
-
-/***********************************************************************/
-/* Constructor for a Value with a given string or numeric value. */
-/***********************************************************************/
-JVALUE::JVALUE(PGLOBAL g, PVAL valp) : JSON()
-{
- Jsp = NULL;
- Value = AllocateValue(g, valp);
- Next = NULL;
- Del = false;
-} // end of JVALUE constructor
-
-/***********************************************************************/
-/* Returns the type of the Value's value. */
-/***********************************************************************/
-JTYP JVALUE::GetValType(void)
-{
- if (Jsp)
- return Jsp->GetType();
- else if (Value)
- return (JTYP)Value->GetType();
- else
- return (JTYP)TYPE_VOID;
-
-} // end of GetValType
-
-/***********************************************************************/
-/* Return the Value's Object value. */
-/***********************************************************************/
-PJOB JVALUE::GetObject(void)
-{
- if (Jsp && Jsp->GetType() == TYPE_JOB)
- return (PJOB)Jsp;
-
- return NULL;
-} // end of GetObject
-
-/***********************************************************************/
-/* Return the Value's Array value. */
-/***********************************************************************/
-PJAR JVALUE::GetArray(void)
-{
- if (Jsp && Jsp->GetType() == TYPE_JAR)
- return (PJAR)Jsp;
-
- return NULL;
-} // end of GetArray
-
-/***********************************************************************/
-/* Return the Value's Integer value. */
-/***********************************************************************/
-int JVALUE::GetInteger(void)
-{
- return (Value) ? Value->GetIntValue() : 0;
-} // end of GetInteger
-
-/***********************************************************************/
-/* Return the Value's Double value. */
-/***********************************************************************/
-double JVALUE::GetFloat(void)
-{
- return (Value) ? Value->GetFloatValue() : 0.0;
-} // end of GetFloat
-
-/***********************************************************************/
-/* Return the Value's String value. */
-/***********************************************************************/
-PSZ JVALUE::GetString(void)
-{
- char buf[32];
- return (Value) ? Value->GetCharString(buf) : NULL;
-} // end of GetString
-
+/*************** json CPP Declares Source Code File (.H) ***************/
+/* Name: json.cpp Version 1.1 */
+/* */
+/* (C) Copyright to the author Olivier BERTRAND 2014 - 2015 */
+/* */
+/* This file contains the JSON classes functions. */
+/***********************************************************************/
+
+/***********************************************************************/
+/* Include relevant sections of the MariaDB header file. */
+/***********************************************************************/
+#include <my_global.h>
+
+/***********************************************************************/
+/* Include application header files: */
+/* global.h is header containing all global declarations. */
+/* plgdbsem.h is header containing the DB application declarations. */
+/* xjson.h is header containing the JSON classes declarations. */
+/***********************************************************************/
+#include "global.h"
+#include "plgdbsem.h"
+#include "json.h"
+
+#define ARGS MY_MIN(24,len-i),s+MY_MAX(i-3,0)
+
+#if defined(__WIN__)
+#define EL "\r\n"
+#else
+#define EL "\n"
+#endif
+
+/***********************************************************************/
+/* Parse a json string. */
+/***********************************************************************/
+PJSON ParseJson(PGLOBAL g, char *s, int len, int pretty, bool *comma)
+{
+ int i, rc;
+ bool b = false;
+ PJSON jsp = NULL;
+ STRG src;
+
+ if (!s || !len) {
+ strcpy(g->Message, "Void JSON object");
+ return NULL;
+ } else if (comma)
+ *comma = false;
+
+ src.str = s;
+ src.len = len;
+
+ // Save stack and allocation environment and prepare error return
+ if (g->jump_level == MAX_JUMP) {
+ strcpy(g->Message, MSG(TOO_MANY_JUMPS));
+ return NULL;
+ } // endif jump_level
+
+ if ((rc= setjmp(g->jumper[++g->jump_level])) != 0) {
+ goto err;
+ } // endif rc
+
+ for (i = 0; i < len; i++)
+ switch (s[i]) {
+ case '[':
+ if (jsp) {
+ strcpy(g->Message, "More than one item in file");
+ goto err;
+ } else if (!(jsp = ParseArray(g, ++i, src)))
+ goto err;
+
+ break;
+ case '{':
+ if (jsp) {
+ strcpy(g->Message, "More than one item in file");
+ goto err;
+ } else if (!(jsp = ParseObject(g, ++i, src)))
+ goto err;
+
+ break;
+ case ' ':
+ case '\t':
+ case '\n':
+ case '\r':
+ break;
+ case ',':
+ if (jsp && pretty == 1) {
+ if (comma)
+ *comma = true;
+
+ break;
+ } // endif pretty
+
+ sprintf(g->Message, "Unexpected ',' (pretty=%d)", pretty);
+ goto err;
+ case '"':
+ if (!(jsp = ParseValue(g, i, src)))
+ goto err;
+
+ break;
+ case '(':
+ b = true;
+ break;
+ case ')':
+ if (b) {
+ b = false;
+ break;
+ } // endif b
+
+ default:
+ sprintf(g->Message, "Bad '%c' character near %.*s",
+ s[i], ARGS);
+ goto err;
+ }; // endswitch s[i]
+
+ if (!jsp)
+ sprintf(g->Message, "Invalid Json string '%.*s'", 50, s);
+
+ g->jump_level--;
+ return jsp;
+
+ err:
+ g->jump_level--;
+ return NULL;
+} // end of ParseJson
+
+/***********************************************************************/
+/* Parse a JSON Array. */
+/***********************************************************************/
+PJAR ParseArray(PGLOBAL g, int& i, STRG& src)
+{
+ char *s = src.str;
+ int len = src.len;
+ int level = 0;
+ PJAR jarp = new(g) JARRAY;
+ PJVAL jvp = NULL;
+
+ for (; i < len; i++)
+ switch (s[i]) {
+ case ',':
+ if (level < 2) {
+ sprintf(g->Message, "Unexpected ',' near %.*s",ARGS);
+ return NULL;
+ } else
+ level = 1;
+
+ break;
+ case ']':
+ if (level == 1) {
+ sprintf(g->Message, "Unexpected ',]' near %.*s", ARGS);
+ return NULL;
+ } // endif level
+
+ jarp->InitArray(g);
+ return jarp;
+ case ' ':
+ case '\t':
+ case '\n':
+ case '\r':
+ break;
+ default:
+ if (level == 2) {
+ sprintf(g->Message, "Unexpected value near %.*s", ARGS);
+ return NULL;
+ } else if ((jvp = ParseValue(g, i, src))) {
+ jarp->AddValue(g, jvp);
+ level = 2;
+ } else
+ return NULL;
+
+ level = 2;
+ break;
+ }; // endswitch s[i]
+
+ strcpy(g->Message, "Unexpected EOF in array");
+ return NULL;
+} // end of ParseArray
+
+/***********************************************************************/
+/* Parse a JSON Object. */
+/***********************************************************************/
+PJOB ParseObject(PGLOBAL g, int& i, STRG& src)
+{
+ PSZ key;
+ char *s = src.str;
+ int len = src.len;
+ int level = 0;
+ PJOB jobp = new(g) JOBJECT;
+ PJPR jpp = NULL;
+
+ for (; i < len; i++)
+ switch (s[i]) {
+ case '"':
+ if (level < 2) {
+ if ((key = ParseString(g, ++i, src))) {
+ jpp = jobp->AddPair(g, key);
+ level = 1;
+ } else
+ return NULL;
+
+ } else {
+ sprintf(g->Message, "misplaced string near %.*s", ARGS);
+ return NULL;
+ } // endif level
+
+ break;
+ case ':':
+ if (level == 1) {
+ if (!(jpp->Val = ParseValue(g, ++i, src)))
+ return NULL;
+
+ level = 2;
+ } else {
+ sprintf(g->Message, "Unexpected ':' near %.*s", ARGS);
+ return NULL;
+ } // endif level
+
+ break;
+ case ',':
+ if (level < 2) {
+ sprintf(g->Message, "Unexpected ',' near %.*s", ARGS);
+ return NULL;
+ } else
+ level = 1;
+
+ break;
+ case '}':
+ if (level == 1) {
+ sprintf(g->Message, "Unexpected '}' near %.*s", ARGS);
+ return NULL;
+ } // endif level
+
+ return jobp;
+ case ' ':
+ case '\t':
+ case '\n':
+ case '\r':
+ break;
+ default:
+ sprintf(g->Message, "Unexpected character '%c' near %.*s",
+ s[i], ARGS);
+ return NULL;
+ }; // endswitch s[i]
+
+ strcpy(g->Message, "Unexpected EOF in Object");
+ return NULL;
+} // end of ParseObject
+
+/***********************************************************************/
+/* Parse a JSON Value. */
+/***********************************************************************/
+PJVAL ParseValue(PGLOBAL g, int& i, STRG& src)
+{
+ char *strval, *s = src.str;
+ int n, len = src.len;
+ PJVAL jvp = new(g) JVALUE;
+
+ for (; i < len; i++)
+ switch (s[i]) {
+ case ' ':
+ case '\t':
+ case '\n':
+ case '\r':
+ break;
+ default:
+ goto suite;
+ } // endswitch
+
+ suite:
+ switch (s[i]) {
+ case '[':
+ if (!(jvp->Jsp = ParseArray(g, ++i, src)))
+ return NULL;
+
+ break;
+ case '{':
+ if (!(jvp->Jsp = ParseObject(g, ++i, src)))
+ return NULL;
+
+ break;
+ case '"':
+ if ((strval = ParseString(g, ++i, src)))
+ jvp->Value = AllocateValue(g, strval, TYPE_STRING);
+ else
+ return NULL;
+
+ break;
+ case 't':
+ if (!strncmp(s + i, "true", 4)) {
+ n = 1;
+ jvp->Value = AllocateValue(g, &n, TYPE_TINY);
+ i += 3;
+ } else
+ goto err;
+
+ break;
+ case 'f':
+ if (!strncmp(s + i, "false", 5)) {
+ n = 0;
+ jvp->Value = AllocateValue(g, &n, TYPE_TINY);
+ i += 4;
+ } else
+ goto err;
+
+ break;
+ case 'n':
+ if (!strncmp(s + i, "null", 4))
+ i += 3;
+ else
+ goto err;
+
+ break;
+ case '-':
+ default:
+ if (s[i] == '-' || isdigit(s[i])) {
+ if (!(jvp->Value = ParseNumeric(g, i, src)))
+ goto err;
+
+ } else
+ goto err;
+
+ }; // endswitch s[i]
+
+ jvp->Size = 1;
+ return jvp;
+
+err:
+ sprintf(g->Message, "Unexpected character '%c' near %.*s",
+ s[i], ARGS);
+ return NULL;
+} // end of ParseValue
+
+/***********************************************************************/
+/* Unescape and parse a JSON string. */
+/***********************************************************************/
+char *ParseString(PGLOBAL g, int& i, STRG& src)
+{
+ char *s = src.str;
+ uchar *p;
+ int n = 0, len = src.len;
+
+ // Be sure of memory availability
+ if (len + 1 - i > (signed)((PPOOLHEADER)g->Sarea)->FreeBlk) {
+ strcpy(g->Message, "ParseString: Out of memory");
+ return NULL;
+ } // endif len
+
+ // The size to allocate is not known yet
+ p = (uchar*)PlugSubAlloc(g, NULL, 0);
+
+ for (; i < len; i++)
+ switch (s[i]) {
+ case '"':
+ p[n++] = 0;
+ PlugSubAlloc(g, NULL, n);
+ return (char*)p;
+ case '\\':
+ if (++i < len) {
+ if (s[i] == 'u') {
+ if (len - i > 5) {
+// if (charset == utf8) {
+ char xs[5];
+ uint hex;
+
+ xs[0] = s[++i];
+ xs[1] = s[++i];
+ xs[2] = s[++i];
+ xs[3] = s[++i];
+ xs[4] = 0;
+ hex = strtoul(xs, NULL, 16);
+
+ if (hex < 0x80) {
+ p[n] = (uchar)hex;
+ } else if (hex < 0x800) {
+ p[n++] = (uchar)(0xC0 | (hex >> 6));
+ p[n] = (uchar)(0x80 | (hex & 0x3F));
+ } else if (hex < 0x10000) {
+ p[n++] = (uchar)(0xE0 | (hex >> 12));
+ p[n++] = (uchar)(0x80 | ((hex >> 6) & 0x3f));
+ p[n] = (uchar)(0x80 | (hex & 0x3f));
+ } else
+ p[n] = '?';
+
+#if 0
+ } else {
+ char xs[3];
+ UINT hex;
+
+ i += 2;
+ xs[0] = s[++i];
+ xs[1] = s[++i];
+ xs[2] = 0;
+ hex = strtoul(xs, NULL, 16);
+ p[n] = (char)hex;
+ } // endif charset
+#endif // 0
+ } else
+ goto err;
+
+ } else switch(s[i]) {
+ case 't': p[n] = '\t'; break;
+ case 'n': p[n] = '\n'; break;
+ case 'r': p[n] = '\r'; break;
+ case 'b': p[n] = '\b'; break;
+ case 'f': p[n] = '\f'; break;
+ default: p[n] = s[i]; break;
+ } // endswitch
+
+ n++;
+ } else
+ goto err;
+
+ break;
+ default:
+ p[n++] = s[i];
+ break;
+ }; // endswitch s[i]
+
+ err:
+ strcpy(g->Message, "Unexpected EOF in String");
+ return NULL;
+} // end of ParseString
+
+/***********************************************************************/
+/* Parse a JSON numeric value. */
+/***********************************************************************/
+PVAL ParseNumeric(PGLOBAL g, int& i, STRG& src)
+{
+ char *s = src.str, buf[50];
+ int n = 0, len = src.len;
+ short nd = 0;
+ bool has_dot = false;
+ bool has_e = false;
+ bool found_digit = false;
+ PVAL valp = NULL;
+
+ for (; i < len; i++) {
+ switch (s[i]) {
+ case '.':
+ if (!found_digit || has_dot || has_e)
+ goto err;
+
+ has_dot = true;
+ break;
+ case 'e':
+ case 'E':
+ if (!found_digit || has_e)
+ goto err;
+
+ has_e = true;
+ found_digit = false;
+ break;
+ case '+':
+ if (!has_e)
+ goto err;
+
+ // passthru
+ case '-':
+ if (found_digit)
+ goto err;
+
+ break;
+ default:
+ if (isdigit(s[i])) {
+ if (has_dot && !has_e)
+ nd++; // Number of decimals
+
+ found_digit = true;
+ } else
+ goto fin;
+
+ }; // endswitch s[i]
+
+ buf[n++] = s[i];
+ } // endfor i
+
+ fin:
+ if (found_digit) {
+ buf[n] = 0;
+
+ if (has_dot || has_e) {
+ double dv = strtod(buf, NULL);
+
+ valp = AllocateValue(g, &dv, TYPE_DOUBLE, nd);
+ } else {
+ int iv = strtol(buf, NULL, 10);
+
+ valp = AllocateValue(g, &iv, TYPE_INT);
+ } // endif has
+
+ i--; // Unstack following character
+ return valp;
+ } else {
+ strcpy(g->Message, "No digit found");
+ return NULL;
+ } // endif found_digit
+
+ err:
+ strcpy(g->Message, "Unexpected EOF in number");
+ return NULL;
+} // end of ParseNumeric
+
+/***********************************************************************/
+/* Serialize a JSON tree: */
+/***********************************************************************/
+PSZ Serialize(PGLOBAL g, PJSON jsp, FILE *fs, int pretty)
+{
+ bool b = false, err = true;
+ JOUT *jp;
+
+ g->Message[0] = 0;
+
+ if (!jsp) {
+ strcpy(g->Message, "Null json tree");
+ return NULL;
+ } else if (!fs) {
+ // Serialize to a string
+ jp = new(g) JOUTSTR(g);
+ b = pretty == 1;
+ } else if (pretty == 2) {
+ // Serialize to a pretty file
+ jp = new(g) JOUTPRT(g, fs);
+ } else {
+ // Serialize to a flat file
+ jp = new(g) JOUTFILE(g, fs);
+ b = pretty == 1;
+ } // endif's
+
+ switch (jsp->GetType()) {
+ case TYPE_JAR:
+ err = SerializeArray(jp, (PJAR)jsp, b);
+ break;
+ case TYPE_JOB:
+ err = (b && jp->WriteChr('\t'));
+ err |= SerializeObject(jp, (PJOB)jsp);
+ break;
+ case TYPE_JVAL:
+ err = SerializeValue(jp, (PJVAL)jsp);
+ break;
+ default:
+ strcpy(g->Message, "Invalid json tree");
+ } // endswitch Type
+
+ if (fs) {
+ fputc('\n', fs);
+ fclose(fs);
+ return (err) ? g->Message : NULL;
+ } else if (!err) {
+ PSZ str = ((JOUTSTR*)jp)->Strp;
+
+ jp->WriteChr('\0');
+ PlugSubAlloc(g, NULL, ((JOUTSTR*)jp)->N);
+ return str;
+ } else {
+ if (!g->Message[0])
+ strcpy(g->Message, "Error in Serialize");
+
+ return NULL;
+ } // endif's
+
+} // end of Serialize
+
+/***********************************************************************/
+/* Serialize a JSON Array. */
+/***********************************************************************/
+bool SerializeArray(JOUT *js, PJAR jarp, bool b)
+{
+ bool first = true;
+
+
+ if (js->WriteChr('['))
+ return true;
+ else if (b && (js->WriteStr(EL) || js->WriteChr('\t')))
+ return true;
+
+ for (int i = 0; i < jarp->size(); i++) {
+ if (first)
+ first = false;
+ else if (js->WriteChr(','))
+ return true;
+ else if (b && (js->WriteStr(EL) || js->WriteChr('\t')))
+ return true;
+
+ if (SerializeValue(js, jarp->GetValue(i)))
+ return true;
+
+ } // endfor i
+
+ if (b && js->WriteStr(EL))
+ return true;
+
+ return js->WriteChr(']');
+} // end of SerializeArray
+
+/***********************************************************************/
+/* Serialize a JSON Object. */
+/***********************************************************************/
+bool SerializeObject(JOUT *js, PJOB jobp)
+{
+ bool first = true;
+
+ if (js->WriteChr('{'))
+ return true;
+
+ for (PJPR pair = jobp->First; pair; pair = pair->Next) {
+ if (first)
+ first = false;
+ else if (js->WriteChr(','))
+ return true;
+
+ if (js->WriteChr('"') ||
+ js->WriteStr(pair->Key) ||
+ js->WriteChr('"') ||
+ js->WriteChr(':') ||
+ SerializeValue(js, pair->Val))
+ return true;
+
+ } // endfor i
+
+ return js->WriteChr('}');
+} // end of SerializeObject
+
+/***********************************************************************/
+/* Serialize a JSON Value. */
+/***********************************************************************/
+bool SerializeValue(JOUT *js, PJVAL jvp)
+{
+ PJAR jap;
+ PJOB jop;
+ PVAL valp;
+
+ if ((jap = jvp->GetArray()))
+ return SerializeArray(js, jap, false);
+ else if ((jop = jvp->GetObject()))
+ return SerializeObject(js, jop);
+ else if (!(valp = jvp->Value) || valp->IsNull())
+ return js->WriteStr("null");
+ else switch (valp->GetType()) {
+ case TYPE_TINY:
+ return js->WriteStr(valp->GetTinyValue() ? "true" : "false");
+ case TYPE_STRING:
+ return js->Escape(valp->GetCharValue());
+ default:
+ if (valp->IsTypeNum()) {
+ char buf[32];
+
+ return js->WriteStr(valp->GetCharString(buf));
+ } // endif valp
+
+ } // endswitch Type
+
+strcpy(js->g->Message, "Unrecognized value");
+return true;
+} // end of SerializeValue
+
+/* -------------------------- Class JOUTSTR -------------------------- */
+
+/***********************************************************************/
+/* JOUTSTR constructor. */
+/***********************************************************************/
+JOUTSTR::JOUTSTR(PGLOBAL g) : JOUT(g)
+{
+ PPOOLHEADER pph = (PPOOLHEADER)g->Sarea;
+
+ N = 0;
+ Max = pph->FreeBlk;
+ Max = (Max > 32) ? Max - 32 : Max;
+ Strp = (char*)PlugSubAlloc(g, NULL, 0); // Size not know yet
+} // end of JOUTSTR constructor
+
+/***********************************************************************/
+/* Concatenate a string to the Serialize string. */
+/***********************************************************************/
+bool JOUTSTR::WriteStr(const char *s)
+{
+ if (s) {
+ size_t len = strlen(s);
+
+ if (N + len > Max)
+ return true;
+
+ memcpy(Strp + N, s, len);
+ N += len;
+ return false;
+ } else
+ return true;
+
+} // end of WriteStr
+
+/***********************************************************************/
+/* Concatenate a character to the Serialize string. */
+/***********************************************************************/
+bool JOUTSTR::WriteChr(const char c)
+{
+ if (N + 1 > Max)
+ return true;
+
+ Strp[N++] = c;
+ return false;
+} // end of WriteChr
+
+/***********************************************************************/
+/* Escape and Concatenate a string to the Serialize string. */
+/***********************************************************************/
+bool JOUTSTR::Escape(const char *s)
+{
+ WriteChr('"');
+
+ for (unsigned int i = 0; i < strlen(s); i++)
+ switch (s[i]) {
+ case '"':
+ case '\\':
+ case '\t':
+ case '\n':
+ case '\r':
+ case '\b':
+ case '\f': WriteChr('\\');
+ // passthru
+ default:
+ WriteChr(s[i]);
+ break;
+ } // endswitch s[i]
+
+ WriteChr('"');
+ return false;
+} // end of Escape
+
+/* ------------------------- Class JOUTFILE -------------------------- */
+
+/***********************************************************************/
+/* Write a string to the Serialize file. */
+/***********************************************************************/
+bool JOUTFILE::WriteStr(const char *s)
+{
+ // This is temporary
+ fputs(s, Stream);
+ return false;
+} // end of WriteStr
+
+/***********************************************************************/
+/* Write a character to the Serialize file. */
+/***********************************************************************/
+bool JOUTFILE::WriteChr(const char c)
+{
+ // This is temporary
+ fputc(c, Stream);
+ return false;
+} // end of WriteChr
+
+/***********************************************************************/
+/* Escape and Concatenate a string to the Serialize string. */
+/***********************************************************************/
+bool JOUTFILE::Escape(const char *s)
+{
+ // This is temporary
+ fputc('"', Stream);
+
+ for (unsigned int i = 0; i < strlen(s); i++)
+ switch (s[i]) {
+ case '"': fputs("\\\"", Stream); break;
+ case '\\': fputs("\\\\", Stream); break;
+ case '\t': fputs("\\t", Stream); break;
+ case '\n': fputs("\\n", Stream); break;
+ case '\r': fputs("\\r", Stream); break;
+ case '\b': fputs("\\b", Stream); break;
+ case '\f': fputs("\\f", Stream); break;
+ default:
+ fputc(s[i], Stream);
+ break;
+ } // endswitch s[i]
+
+ fputc('"', Stream);
+ return false;
+} // end of Escape
+
+/* ------------------------- Class JOUTPRT --------------------------- */
+
+/***********************************************************************/
+/* Write a string to the Serialize pretty file. */
+/***********************************************************************/
+bool JOUTPRT::WriteStr(const char *s)
+{
+ // This is temporary
+ if (B) {
+ fputs(EL, Stream);
+ M--;
+
+ for (int i = 0; i < M; i++)
+ fputc('\t', Stream);
+
+ B = false;
+ } // endif B
+
+ fputs(s, Stream);
+ return false;
+} // end of WriteStr
+
+/***********************************************************************/
+/* Write a character to the Serialize pretty file. */
+/***********************************************************************/
+bool JOUTPRT::WriteChr(const char c)
+{
+ switch (c) {
+ case ':':
+ fputs(": ", Stream);
+ break;
+ case '{':
+ case '[':
+#if 0
+ if (M)
+ fputs(EL, Stream);
+
+ for (int i = 0; i < M; i++)
+ fputc('\t', Stream);
+#endif // 0
+
+ fputc(c, Stream);
+ fputs(EL, Stream);
+ M++;
+
+ for (int i = 0; i < M; i++)
+ fputc('\t', Stream);
+
+ break;
+ case '}':
+ case ']':
+ M--;
+ fputs(EL, Stream);
+
+ for (int i = 0; i < M; i++)
+ fputc('\t', Stream);
+
+ fputc(c, Stream);
+ B = true;
+ break;
+ case ',':
+ fputc(c, Stream);
+ fputs(EL, Stream);
+
+ for (int i = 0; i < M; i++)
+ fputc('\t', Stream);
+
+ B = false;
+ break;
+ default:
+ fputc(c, Stream);
+ } // endswitch c
+
+return false;
+} // end of WriteChr
+
+/* -------------------------- Class JOBJECT -------------------------- */
+
+/***********************************************************************/
+/* Add a new pair to an Object. */
+/***********************************************************************/
+PJPR JOBJECT::AddPair(PGLOBAL g, PSZ key)
+{
+ PJPR jpp = new(g) JPAIR(key);
+
+ if (Last)
+ Last->Next = jpp;
+ else
+ First = jpp;
+
+ Last = jpp;
+ Size++;
+ return jpp;
+} // end of AddPair
+
+/***********************************************************************/
+/* Get the value corresponding to the given key. */
+/***********************************************************************/
+PJVAL JOBJECT::GetValue(const char* key)
+{
+ for (PJPR jp = First; jp; jp = jp->Next)
+ if (!strcmp(jp->Key, key))
+ return jp->Val;
+
+ return NULL;
+} // end of GetValue;
+
+/***********************************************************************/
+/* Return the text corresponding to all keys (XML like). */
+/***********************************************************************/
+PSZ JOBJECT::GetText(PGLOBAL g, PSZ text)
+{
+ int n;
+
+ if (!text) {
+ text = (char*)PlugSubAlloc(g, NULL, 0);
+ text[0] = 0;
+ n = 1;
+ } else
+ n = 0;
+
+ if (!First && n)
+ return NULL;
+ else for (PJPR jp = First; jp; jp = jp->Next)
+ jp->Val->GetText(g, text);
+
+ if (n)
+ PlugSubAlloc(g, NULL, strlen(text) + 1);
+
+ return text + n;
+} // end of GetValue;
+
+/***********************************************************************/
+/* Set or add a value corresponding to the given key. */
+/***********************************************************************/
+void JOBJECT::SetValue(PGLOBAL g, PJVAL jvp, PSZ key)
+{
+ PJPR jp;
+
+ for (jp = First; jp; jp = jp->Next)
+ if (!strcmp(jp->Key, key)) {
+ jp->Val = jvp;
+ break;
+ } // endif key
+
+ if (!jp) {
+ jp = AddPair(g, key);
+ jp->Val = jvp;
+ } // endif jp
+
+} // end of SetValue
+
+/***********************************************************************/
+/* True if void or if all members are nulls. */
+/***********************************************************************/
+bool JOBJECT::IsNull(void)
+{
+ for (PJPR jp = First; jp; jp = jp->Next)
+ if (!jp->Val->IsNull())
+ return false;
+
+ return true;
+} // end of IsNull
+
+/* -------------------------- Class JARRAY --------------------------- */
+
+/***********************************************************************/
+/* Make the array of values from the values list. */
+/***********************************************************************/
+void JARRAY::InitArray(PGLOBAL g)
+{
+ int i;
+ PJVAL jvp;
+
+ for (Size = 0, jvp = First; jvp; jvp = jvp->Next)
+ if (!jvp->Del)
+ Size++;
+
+ if (!Size) {
+ return;
+ } else if (Size > Alloc) {
+ // No need to realloc after deleting values
+ Mvals = (PJVAL*)PlugSubAlloc(g, NULL, Size * sizeof(PJVAL));
+ Alloc = Size;
+ } // endif Size
+
+ for (i = 0, jvp = First; jvp; jvp = jvp->Next)
+ if (!jvp->Del)
+ Mvals[i++] = jvp;
+
+} // end of InitArray
+
+/***********************************************************************/
+/* Get the Nth value of an Array. */
+/***********************************************************************/
+PJVAL JARRAY::GetValue(int i)
+{
+ if (Mvals && i >= 0 && i < Size)
+ return Mvals[i];
+ else
+ return NULL;
+} // end of GetValue
+
+/***********************************************************************/
+/* Add a Value to the Arrays Value list. */
+/***********************************************************************/
+PJVAL JARRAY::AddValue(PGLOBAL g, PJVAL jvp)
+{
+ if (!jvp)
+ jvp = new(g) JVALUE;
+
+ if (Last)
+ Last->Next = jvp;
+ else
+ First = jvp;
+
+ Last = jvp;
+ return jvp;
+} // end of AddValue
+
+/***********************************************************************/
+/* Add a Value to the Arrays Value list. */
+/***********************************************************************/
+bool JARRAY::SetValue(PGLOBAL g, PJVAL jvp, int n)
+{
+ int i = 0;
+ PJVAL jp, *jpp = &First;
+
+ for (i = 0, jp = First; i < n; i++, jp = *(jpp = &jp->Next))
+ if (!jp)
+ *jpp = jp = new(g) JVALUE;
+
+ *jpp = jvp;
+ jvp->Next = (jp ? jp->Next : NULL);
+ return false;
+} // end of SetValue
+
+/***********************************************************************/
+/* Delete a Value from the Arrays Value list. */
+/***********************************************************************/
+bool JARRAY::DeleteValue(int n)
+{
+ PJVAL jvp = GetValue(n);
+
+ if (jvp) {
+ jvp->Del = true;
+ return false;
+ } else
+ return true;
+
+} // end of DeleteValue
+
+/***********************************************************************/
+/* True if void or if all members are nulls. */
+/***********************************************************************/
+bool JARRAY::IsNull(void)
+{
+ for (int i = 0; i < Size; i++)
+ if (!Mvals[i]->IsNull())
+ return false;
+
+ return true;
+} // end of IsNull
+
+/* -------------------------- Class JVALUE- -------------------------- */
+
+/***********************************************************************/
+/* Constructor for a Value with a given string or numeric value. */
+/***********************************************************************/
+JVALUE::JVALUE(PGLOBAL g, PVAL valp) : JSON()
+{
+ Jsp = NULL;
+ Value = AllocateValue(g, valp);
+ Next = NULL;
+ Del = false;
+} // end of JVALUE constructor
+
+/***********************************************************************/
+/* Returns the type of the Value's value. */
+/***********************************************************************/
+JTYP JVALUE::GetValType(void)
+{
+ if (Jsp)
+ return Jsp->GetType();
+ else if (Value)
+ return (JTYP)Value->GetType();
+ else
+ return (JTYP)TYPE_VOID;
+
+} // end of GetValType
+
+/***********************************************************************/
+/* Return the Value's Object value. */
+/***********************************************************************/
+PJOB JVALUE::GetObject(void)
+{
+ if (Jsp && Jsp->GetType() == TYPE_JOB)
+ return (PJOB)Jsp;
+
+ return NULL;
+} // end of GetObject
+
+/***********************************************************************/
+/* Return the Value's Array value. */
+/***********************************************************************/
+PJAR JVALUE::GetArray(void)
+{
+ if (Jsp && Jsp->GetType() == TYPE_JAR)
+ return (PJAR)Jsp;
+
+ return NULL;
+} // end of GetArray
+
+/***********************************************************************/
+/* Return the Value's Integer value. */
+/***********************************************************************/
+int JVALUE::GetInteger(void)
+{
+ return (Value) ? Value->GetIntValue() : 0;
+} // end of GetInteger
+
+/***********************************************************************/
+/* Return the Value's Double value. */
+/***********************************************************************/
+double JVALUE::GetFloat(void)
+{
+ return (Value) ? Value->GetFloatValue() : 0.0;
+} // end of GetFloat
+
+/***********************************************************************/
+/* Return the Value's String value. */
+/***********************************************************************/
+PSZ JVALUE::GetString(void)
+{
+ char buf[32];
+ return (Value) ? Value->GetCharString(buf) : NULL;
+} // end of GetString
+
+/***********************************************************************/
+/* Return the Value's String value. */
+/***********************************************************************/
+PSZ JVALUE::GetText(PGLOBAL g, PSZ text)
+{
+ if (Jsp && Jsp->GetType() == TYPE_JOB)
+ return Jsp->GetText(g, text);
+
+ char buf[32];
+ PSZ s = (Value) ? Value->GetCharString(buf) : NULL;
+
+ if (s)
+ strcat(strcat(text, " "), s);
+ else
+ strcat(text, " ???");
+
+ return text;
+} // end of GetText
+
+/***********************************************************************/
+/* Set the Value's value as the given integer. */
+/***********************************************************************/
+void JVALUE::SetInteger(PGLOBAL g, int n)
+{
+ Value = AllocateValue(g, &n, TYPE_INT);
+} // end of AddInteger
+
+/***********************************************************************/
+/* Set the Value's value as the given DOUBLE. */
+/***********************************************************************/
+void JVALUE::SetFloat(PGLOBAL g, double f)
+{
+ Value = AllocateValue(g, &f, TYPE_DOUBLE, 6);
+} // end of AddFloat
+
+/***********************************************************************/
+/* Set the Value's value as the given string. */
+/***********************************************************************/
+void JVALUE::SetString(PGLOBAL g, PSZ s)
+{
+ Value = AllocateValue(g, s, TYPE_STRING);
+} // end of AddFloat
+
+/***********************************************************************/
+/* True when its JSON or normal value is null. */
+/***********************************************************************/
+bool JVALUE::IsNull(void)
+{
+ return (Jsp) ? Jsp->IsNull() : (Value) ? Value->IsZero() : true;
+} // end of IsNull
+
diff --git a/storage/connect/json.h b/storage/connect/json.h
index 11e15c3acd4..da45157f124 100644
--- a/storage/connect/json.h
+++ b/storage/connect/json.h
@@ -1,246 +1,270 @@
-/**************** json H Declares Source Code File (.H) ****************/
-/* Name: json.h Version 1.0 */
-/* */
-/* (C) Copyright to the author Olivier BERTRAND 2014 - 2015 */
-/* */
-/* This file contains the JSON classes declares. */
-/***********************************************************************/
-#include "value.h"
-
-#if defined(_DEBUG)
-#define X assert(false);
-#else
-#define X
-#endif
-
-enum JTYP {TYPE_STRG = 1,
- TYPE_DBL = 2,
- TYPE_BOOL = 4,
- TYPE_INTG = 7,
- TYPE_JSON = 12,
- TYPE_JAR, TYPE_JOB,
- TYPE_JVAL};
-
-class JOUT;
-class JSON;
-class JMAP;
-class JVALUE;
-class JOBJECT;
-class JARRAY;
-
-typedef class JPAIR *PJPR;
-typedef class JSON *PJSON;
-typedef class JVALUE *PJVAL;
-typedef class JOBJECT *PJOB;
-typedef class JARRAY *PJAR;
-
-typedef struct {
- char *str;
- int len;
- } STRG, *PSG;
-
-PJSON ParseJson(PGLOBAL g, char *s, int n, int prty, bool *b = NULL);
-PJAR ParseArray(PGLOBAL g, int& i, STRG& src);
-PJOB ParseObject(PGLOBAL g, int& i, STRG& src);
-PJVAL ParseValue(PGLOBAL g, int& i, STRG& src);
-char *ParseString(PGLOBAL g, int& i, STRG& src);
-PVAL ParseNumeric(PGLOBAL g, int& i, STRG& src);
-PSZ Serialize(PGLOBAL g, PJSON jsp, FILE *fs, int pretty);
-bool SerializeArray(JOUT *js, PJAR jarp, bool b);
-bool SerializeObject(JOUT *js, PJOB jobp);
-bool SerializeValue(JOUT *js, PJVAL jvp);
-
-/***********************************************************************/
-/* Class JOUT. Used by Serialize. */
-/***********************************************************************/
-class JOUT : public BLOCK {
- public:
- JOUT(PGLOBAL gp) : BLOCK() {g = gp;}
-
- virtual bool WriteStr(const char *s) = 0;
- virtual bool WriteChr(const char c) = 0;
- virtual bool Escape(const char *s) = 0;
-
- // Member
- PGLOBAL g;
-}; // end of class JOUT
-
-/***********************************************************************/
-/* Class JOUTSTR. Used to Serialize to a string. */
-/***********************************************************************/
-class JOUTSTR : public JOUT {
- public:
- JOUTSTR(PGLOBAL g);
-
- virtual bool WriteStr(const char *s);
- virtual bool WriteChr(const char c);
- virtual bool Escape(const char *s);
-
- // Member
- char *Strp; // The serialized string
- size_t N; // Position of next char
- size_t Max; // String max size
-}; // end of class JOUTSTR
-
-/***********************************************************************/
-/* Class JOUTFILE. Used to Serialize to a file. */
-/***********************************************************************/
-class JOUTFILE : public JOUT {
- public:
- JOUTFILE(PGLOBAL g, FILE *str) : JOUT(g) {Stream = str;}
-
- virtual bool WriteStr(const char *s);
- virtual bool WriteChr(const char c);
- virtual bool Escape(const char *s);
-
- // Member
- FILE *Stream;
-}; // end of class JOUTFILE
-
-/***********************************************************************/
-/* Class JOUTPRT. Used to Serialize to a pretty file. */
-/***********************************************************************/
-class JOUTPRT : public JOUTFILE {
- public:
- JOUTPRT(PGLOBAL g, FILE *str) : JOUTFILE(g, str) {M = 0; B = false;}
-
- virtual bool WriteStr(const char *s);
- virtual bool WriteChr(const char c);
-
- // Member
- int M;
- bool B;
-}; // end of class JOUTPRT
-
-/***********************************************************************/
-/* Class PAIR. The pairs of a json Object. */
-/***********************************************************************/
-class JPAIR : public BLOCK {
- friend class JOBJECT;
- friend PJOB ParseObject(PGLOBAL, int&, STRG&);
- friend bool SerializeObject(JOUT *, PJOB);
- public:
- JPAIR(PSZ key) : BLOCK() {Key = key; Val = NULL; Next = NULL;}
-
- protected:
- PSZ Key; // This pair key name
- PJVAL Val; // To the value of the pair
- PJPR Next; // To the next pair
-}; // end of class JPAIR
-
-/***********************************************************************/
-/* Class JSON. The base class for all other json classes. */
-/***********************************************************************/
-class JSON : public BLOCK {
- public:
- JSON(void) {Size = 0;}
-
- int size(void) {return Size;}
- virtual void Clear(void) {Size = 0;}
- virtual JTYP GetType(void) {return TYPE_JSON;}
- virtual JTYP GetValType(void) {X return TYPE_JSON;}
- virtual void InitArray(PGLOBAL g) {X}
- virtual PJVAL AddValue(PGLOBAL g, PJVAL jvp = NULL) {X return NULL;}
- virtual PJPR AddPair(PGLOBAL g, PSZ key) {X return NULL;}
- virtual PJVAL GetValue(const char *key) {X return NULL;}
- virtual PJOB GetObject(void) {X return NULL;}
- virtual PJAR GetArray(void) {X return NULL;}
- virtual PJVAL GetValue(int i) {X return NULL;}
- virtual PVAL GetValue(void) {X return NULL;}
- virtual PJSON GetJson(void) {X return NULL;}
- virtual int GetInteger(void) {X return 0;}
- virtual double GetFloat() {X return 0.0;}
- virtual PSZ GetString() {X return NULL;}
- virtual PSZ GetText(PGLOBAL g) {X return NULL;}
- virtual bool SetValue(PGLOBAL g, PJVAL jvp, int i) {X return true;}
- virtual void SetValue(PGLOBAL g, PJVAL jvp, PSZ key) {X}
- virtual void SetValue(PVAL valp) {X}
- virtual void SetValue(PJSON jsp) {X}
- virtual bool DeleteValue(int i) {X return true;}
-
- protected:
- int Size;
-}; // end of class JSON
-
-/***********************************************************************/
-/* Class JOBJECT: contains a list of value pairs. */
-/***********************************************************************/
-class JOBJECT : public JSON {
- friend PJOB ParseObject(PGLOBAL, int&, STRG&);
- friend bool SerializeObject(JOUT *, PJOB);
- public:
- JOBJECT(void) : JSON() {First = Last = NULL;}
-
- virtual void Clear(void) {First = Last = NULL; Size = 0;}
- virtual JTYP GetType(void) {return TYPE_JOB;}
- virtual PJPR AddPair(PGLOBAL g, PSZ key);
- virtual PJOB GetObject(void) {return this;}
- virtual PJVAL GetValue(const char* key);
- virtual PSZ GetText(PGLOBAL g);
- virtual void SetValue(PGLOBAL g, PJVAL jvp, PSZ key);
-
- protected:
- PJPR First;
- PJPR Last;
-}; // end of class JOBJECT
-
-/***********************************************************************/
-/* Class JARRAY. */
-/***********************************************************************/
-class JARRAY : public JSON {
- friend PJAR ParseArray(PGLOBAL, int&, STRG&);
- public:
- JARRAY(void) : JSON() {Alloc = 0; First = Last = NULL; Mvals = NULL;}
-
- virtual void Clear(void) {First = Last = NULL; Size = 0;}
- virtual JTYP GetType(void) {return TYPE_JAR;}
- virtual PJAR GetArray(void) {return this;}
- virtual PJVAL AddValue(PGLOBAL g, PJVAL jvp = NULL);
- virtual void InitArray(PGLOBAL g);
- virtual PJVAL GetValue(int i);
- virtual bool SetValue(PGLOBAL g, PJVAL jvp, int i);
- virtual bool DeleteValue(int n);
-
- protected:
- // Members
- int Alloc; // The Mvals allocated size
- PJVAL First; // Used when constructing
- PJVAL Last; // Last constructed value
- PJVAL *Mvals; // Allocated when finished
-}; // end of class JARRAY
-
-/***********************************************************************/
-/* Class JVALUE. */
-/***********************************************************************/
-class JVALUE : public JSON {
- friend class JARRAY;
- friend PJVAL ParseValue(PGLOBAL, int&, STRG&);
- friend bool SerializeValue(JOUT *, PJVAL);
- public:
- JVALUE(void) : JSON()
- {Jsp = NULL; Value = NULL; Next = NULL; Del = false;}
- JVALUE(PJSON jsp) : JSON()
- {Jsp = jsp; Value = NULL; Next = NULL; Del = false;}
- JVALUE(PGLOBAL g, PVAL valp);
-
- virtual void Clear(void)
- {Jsp = NULL; Value = NULL; Next = NULL; Del = false; Size = 0;}
- virtual JTYP GetType(void) {return TYPE_JVAL;}
- virtual JTYP GetValType(void);
- virtual PJOB GetObject(void);
- virtual PJAR GetArray(void);
- virtual PVAL GetValue(void) {return Value;}
- virtual PJSON GetJson(void) {return (Jsp ? Jsp : this);}
- virtual int GetInteger(void);
- virtual double GetFloat(void);
- virtual PSZ GetString(void);
- virtual void SetValue(PVAL valp) {Value = valp;}
- virtual void SetValue(PJSON jsp) {Jsp = jsp;}
-
- protected:
- PJSON Jsp; // To the json value
- PVAL Value; // The numeric value
- PJVAL Next; // Next value in array
- bool Del; // True when deleted
-}; // end of class JVALUE
-
+/**************** json H Declares Source Code File (.H) ****************/
+/* Name: json.h Version 1.1 */
+/* */
+/* (C) Copyright to the author Olivier BERTRAND 2014 - 2015 */
+/* */
+/* This file contains the JSON classes declares. */
+/***********************************************************************/
+#include "value.h"
+
+#if defined(_DEBUG)
+#define X assert(false);
+#else
+#define X
+#endif
+
+enum JTYP {TYPE_STRG = 1,
+ TYPE_DBL = 2,
+ TYPE_BOOL = 4,
+ TYPE_INTG = 7,
+ TYPE_JSON = 12,
+ TYPE_JAR,
+ TYPE_JOB,
+ TYPE_JVAL};
+
+class JOUT;
+class JSON;
+class JMAP;
+class JVALUE;
+class JOBJECT;
+class JARRAY;
+
+typedef class JPAIR *PJPR;
+typedef class JSON *PJSON;
+typedef class JVALUE *PJVAL;
+typedef class JOBJECT *PJOB;
+typedef class JARRAY *PJAR;
+
+typedef struct {
+ char *str;
+ int len;
+ } STRG, *PSG;
+
+PJSON ParseJson(PGLOBAL g, char *s, int n, int prty, bool *b = NULL);
+PJAR ParseArray(PGLOBAL g, int& i, STRG& src);
+PJOB ParseObject(PGLOBAL g, int& i, STRG& src);
+PJVAL ParseValue(PGLOBAL g, int& i, STRG& src);
+char *ParseString(PGLOBAL g, int& i, STRG& src);
+PVAL ParseNumeric(PGLOBAL g, int& i, STRG& src);
+PSZ Serialize(PGLOBAL g, PJSON jsp, FILE *fs, int pretty);
+bool SerializeArray(JOUT *js, PJAR jarp, bool b);
+bool SerializeObject(JOUT *js, PJOB jobp);
+bool SerializeValue(JOUT *js, PJVAL jvp);
+
+/***********************************************************************/
+/* Class JOUT. Used by Serialize. */
+/***********************************************************************/
+class JOUT : public BLOCK {
+ public:
+ JOUT(PGLOBAL gp) : BLOCK() {g = gp;}
+
+ virtual bool WriteStr(const char *s) = 0;
+ virtual bool WriteChr(const char c) = 0;
+ virtual bool Escape(const char *s) = 0;
+
+ // Member
+ PGLOBAL g;
+}; // end of class JOUT
+
+/***********************************************************************/
+/* Class JOUTSTR. Used to Serialize to a string. */
+/***********************************************************************/
+class JOUTSTR : public JOUT {
+ public:
+ JOUTSTR(PGLOBAL g);
+
+ virtual bool WriteStr(const char *s);
+ virtual bool WriteChr(const char c);
+ virtual bool Escape(const char *s);
+
+ // Member
+ char *Strp; // The serialized string
+ size_t N; // Position of next char
+ size_t Max; // String max size
+}; // end of class JOUTSTR
+
+/***********************************************************************/
+/* Class JOUTFILE. Used to Serialize to a file. */
+/***********************************************************************/
+class JOUTFILE : public JOUT {
+ public:
+ JOUTFILE(PGLOBAL g, FILE *str) : JOUT(g) {Stream = str;}
+
+ virtual bool WriteStr(const char *s);
+ virtual bool WriteChr(const char c);
+ virtual bool Escape(const char *s);
+
+ // Member
+ FILE *Stream;
+}; // end of class JOUTFILE
+
+/***********************************************************************/
+/* Class JOUTPRT. Used to Serialize to a pretty file. */
+/***********************************************************************/
+class JOUTPRT : public JOUTFILE {
+ public:
+ JOUTPRT(PGLOBAL g, FILE *str) : JOUTFILE(g, str) {M = 0; B = false;}
+
+ virtual bool WriteStr(const char *s);
+ virtual bool WriteChr(const char c);
+
+ // Member
+ int M;
+ bool B;
+}; // end of class JOUTPRT
+
+/***********************************************************************/
+/* Class PAIR. The pairs of a json Object. */
+/***********************************************************************/
+class JPAIR : public BLOCK {
+ friend class JOBJECT;
+ friend PJOB ParseObject(PGLOBAL, int&, STRG&);
+ friend bool SerializeObject(JOUT *, PJOB);
+ public:
+ JPAIR(PSZ key) : BLOCK() {Key = key; Val = NULL; Next = NULL;}
+
+ inline PSZ GetKey(void) {return Key;}
+ inline PJVAL GetVal(void) {return Val;}
+ inline PJPR GetNext(void) {return Next;}
+
+ protected:
+ PSZ Key; // This pair key name
+ PJVAL Val; // To the value of the pair
+ PJPR Next; // To the next pair
+}; // end of class JPAIR
+
+/***********************************************************************/
+/* Class JSON. The base class for all other json classes. */
+/***********************************************************************/
+class JSON : public BLOCK {
+ public:
+ JSON(void) {Size = 0;}
+
+ int size(void) {return Size;}
+ virtual void Clear(void) {Size = 0;}
+ virtual JTYP GetType(void) {return TYPE_JSON;}
+ virtual JTYP GetValType(void) {X return TYPE_JSON;}
+ virtual void InitArray(PGLOBAL g) {X}
+ virtual PJVAL AddValue(PGLOBAL g, PJVAL jvp = NULL) {X return NULL;}
+ virtual PJPR AddPair(PGLOBAL g, PSZ key) {X return NULL;}
+ virtual PJVAL GetValue(const char *key) {X return NULL;}
+ virtual PJOB GetObject(void) {return NULL;}
+ virtual PJAR GetArray(void) {return NULL;}
+ virtual PJVAL GetValue(int i) {X return NULL;}
+ virtual PVAL GetValue(void) {X return NULL;}
+ virtual PJSON GetJson(void) {X return NULL;}
+ virtual PJPR GetFirst(void) {X return NULL;}
+ virtual int GetInteger(void) {X return 0;}
+ virtual double GetFloat() {X return 0.0;}
+ virtual PSZ GetString() {X return NULL;}
+ virtual PSZ GetText(PGLOBAL g, PSZ text) {X return NULL;}
+ virtual bool SetValue(PGLOBAL g, PJVAL jvp, int i) {X return true;}
+ virtual void SetValue(PGLOBAL g, PJVAL jvp, PSZ key) {X}
+ virtual void SetValue(PVAL valp) {X}
+ virtual void SetValue(PJSON jsp) {X}
+ virtual void SetString(PGLOBAL g, PSZ s) {X}
+ virtual void SetInteger(PGLOBAL g, int n) {X}
+ virtual void SetFloat(PGLOBAL g, double f) {X}
+ virtual bool DeleteValue(int i) {X return true;}
+ virtual bool IsNull(void) {X return true;}
+
+ protected:
+ int Size;
+}; // end of class JSON
+
+/***********************************************************************/
+/* Class JOBJECT: contains a list of value pairs. */
+/***********************************************************************/
+class JOBJECT : public JSON {
+ friend PJOB ParseObject(PGLOBAL, int&, STRG&);
+ friend bool SerializeObject(JOUT *, PJOB);
+ public:
+ JOBJECT(void) : JSON() {First = Last = NULL;}
+
+ using JSON::GetValue;
+ using JSON::SetValue;
+ virtual void Clear(void) {First = Last = NULL; Size = 0;}
+ virtual JTYP GetType(void) {return TYPE_JOB;}
+ virtual PJPR GetFirst(void) {return First;}
+ virtual PJPR AddPair(PGLOBAL g, PSZ key);
+ virtual PJOB GetObject(void) {return this;}
+ virtual PJVAL GetValue(const char* key);
+ virtual PSZ GetText(PGLOBAL g, PSZ text);
+ virtual void SetValue(PGLOBAL g, PJVAL jvp, PSZ key);
+ virtual bool IsNull(void);
+
+ protected:
+ PJPR First;
+ PJPR Last;
+}; // end of class JOBJECT
+
+/***********************************************************************/
+/* Class JARRAY. */
+/***********************************************************************/
+class JARRAY : public JSON {
+ friend PJAR ParseArray(PGLOBAL, int&, STRG&);
+ public:
+ JARRAY(void) : JSON() {Alloc = 0; First = Last = NULL; Mvals = NULL;}
+
+ using JSON::GetValue;
+ using JSON::SetValue;
+ virtual void Clear(void) {First = Last = NULL; Size = 0;}
+ virtual JTYP GetType(void) {return TYPE_JAR;}
+ virtual PJAR GetArray(void) {return this;}
+ virtual PJVAL AddValue(PGLOBAL g, PJVAL jvp = NULL);
+ virtual void InitArray(PGLOBAL g);
+ virtual PJVAL GetValue(int i);
+ virtual bool SetValue(PGLOBAL g, PJVAL jvp, int i);
+ virtual bool DeleteValue(int n);
+ virtual bool IsNull(void);
+
+ protected:
+ // Members
+ int Alloc; // The Mvals allocated size
+ PJVAL First; // Used when constructing
+ PJVAL Last; // Last constructed value
+ PJVAL *Mvals; // Allocated when finished
+}; // end of class JARRAY
+
+/***********************************************************************/
+/* Class JVALUE. */
+/***********************************************************************/
+class JVALUE : public JSON {
+ friend class JARRAY;
+ friend PJVAL ParseValue(PGLOBAL, int&, STRG&);
+ friend bool SerializeValue(JOUT *, PJVAL);
+ public:
+ JVALUE(void) : JSON()
+ {Jsp = NULL; Value = NULL; Next = NULL; Del = false;}
+ JVALUE(PJSON jsp) : JSON()
+ {Jsp = jsp; Value = NULL; Next = NULL; Del = false;}
+ JVALUE(PGLOBAL g, PVAL valp);
+
+ using JSON::GetValue;
+ using JSON::SetValue;
+ virtual void Clear(void)
+ {Jsp = NULL; Value = NULL; Next = NULL; Del = false; Size = 0;}
+ virtual JTYP GetType(void) {return TYPE_JVAL;}
+ virtual JTYP GetValType(void);
+ virtual PJOB GetObject(void);
+ virtual PJAR GetArray(void);
+ virtual PVAL GetValue(void) {return Value;}
+ virtual PJSON GetJson(void) {return (Jsp ? Jsp : this);}
+ virtual int GetInteger(void);
+ virtual double GetFloat(void);
+ virtual PSZ GetString(void);
+ virtual PSZ GetText(PGLOBAL g, PSZ text);
+ virtual void SetValue(PVAL valp) {Value = valp;}
+ virtual void SetValue(PJSON jsp) {Jsp = jsp;}
+ virtual void SetString(PGLOBAL g, PSZ s);
+ virtual void SetInteger(PGLOBAL g, int n);
+ virtual void SetFloat(PGLOBAL g, double f);
+ virtual bool IsNull(void);
+
+ protected:
+ PJSON Jsp; // To the json value
+ PVAL Value; // The numeric value
+ PJVAL Next; // Next value in array
+ bool Del; // True when deleted
+}; // end of class JVALUE
+
diff --git a/storage/connect/jsonudf.cpp b/storage/connect/jsonudf.cpp
new file mode 100644
index 00000000000..ff4025ee0fb
--- /dev/null
+++ b/storage/connect/jsonudf.cpp
@@ -0,0 +1,690 @@
+/************* jsonudf C++ Program Source Code File (.CPP) *************/
+/* PROGRAM NAME: jsonudf Version 1.0 */
+/* (C) Copyright to the author Olivier BERTRAND 2015 */
+/* This program are the JSON User Defined Functions . */
+/***********************************************************************/
+
+/***********************************************************************/
+/* Include relevant sections of the MariaDB header file. */
+/***********************************************************************/
+#include <my_global.h>
+#include <mysqld.h>
+#include <mysql.h>
+#include <sql_error.h>
+
+#include "global.h"
+#include "plgdbsem.h"
+#include "json.h"
+
+#define MEMFIX 512
+#define UDF_EXEC_ARGS \
+ UDF_INIT*, UDF_ARGS*, char*, unsigned long*, char*, char*
+
+uint GetJsonGrpSize(void);
+
+extern "C" {
+DllExport my_bool Json_Value_init(UDF_INIT*, UDF_ARGS*, char*);
+DllExport char *Json_Value(UDF_EXEC_ARGS);
+DllExport void Json_Value_deinit(UDF_INIT*);
+
+DllExport my_bool Json_Array_init(UDF_INIT*, UDF_ARGS*, char*);
+DllExport char *Json_Array(UDF_EXEC_ARGS);
+DllExport void Json_Array_deinit(UDF_INIT*);
+
+DllExport my_bool Json_Array_Add_init(UDF_INIT*, UDF_ARGS*, char*);
+DllExport char *Json_Array_Add(UDF_EXEC_ARGS);
+DllExport void Json_Array_Add_deinit(UDF_INIT*);
+
+DllExport my_bool Json_Array_Delete_init(UDF_INIT*, UDF_ARGS*, char*);
+DllExport char *Json_Array_Delete(UDF_EXEC_ARGS);
+DllExport void Json_Array_Delete_deinit(UDF_INIT*);
+
+DllExport my_bool Json_Object_init(UDF_INIT*, UDF_ARGS*, char*);
+DllExport char *Json_Object(UDF_EXEC_ARGS);
+DllExport void Json_Object_deinit(UDF_INIT*);
+
+DllExport my_bool Json_Object_Nonull_init(UDF_INIT*, UDF_ARGS*, char*);
+DllExport char *Json_Object_Nonull(UDF_EXEC_ARGS);
+DllExport void Json_Object_Nonull_deinit(UDF_INIT*);
+
+DllExport my_bool Json_Array_Grp_init(UDF_INIT*, UDF_ARGS*, char*);
+DllExport void Json_Array_Grp_add(UDF_INIT *, UDF_ARGS *, char *, char *);
+DllExport char *Json_Array_Grp(UDF_EXEC_ARGS);
+DllExport void Json_Array_Grp_clear(UDF_INIT *, char *, char *);
+DllExport void Json_Array_Grp_deinit(UDF_INIT*);
+
+DllExport my_bool Json_Object_Grp_init(UDF_INIT*, UDF_ARGS*, char*);
+DllExport void Json_Object_Grp_add(UDF_INIT *, UDF_ARGS *, char *, char *);
+DllExport char *Json_Object_Grp(UDF_EXEC_ARGS);
+DllExport void Json_Object_Grp_clear(UDF_INIT *, char *, char *);
+DllExport void Json_Object_Grp_deinit(UDF_INIT*);
+} // extern "C"
+
+/***********************************************************************/
+/* Allocate and initialise the memory area. */
+/***********************************************************************/
+static my_bool JsonInit(UDF_INIT *initid, char *message,
+ unsigned long reslen, unsigned long memlen)
+{
+ PGLOBAL g = PlugInit(NULL, memlen);
+
+ if (!g) {
+ strcpy(message, "Allocation error");
+ return true;
+ } else if (g->Sarea_Size == 0) {
+ strcpy(message, g->Message);
+ PlugExit(g);
+ return true;
+ } else
+ initid->ptr = (char*)g;
+
+ initid->maybe_null = false;
+ initid->max_length = reslen;
+ return false;
+} // end of Json_Object_init
+
+/***********************************************************************/
+/* Returns true if the argument is a JSON string. */
+/***********************************************************************/
+static my_bool IsJson(UDF_ARGS *args, int i)
+{
+ return (args->arg_type[i] == STRING_RESULT &&
+ !strnicmp(args->attributes[i], "Json_", 5));
+} // end of IsJson
+
+/***********************************************************************/
+/* Calculate the reslen and memlen needed by a function. */
+/***********************************************************************/
+static my_bool CalcLen(UDF_ARGS *args, my_bool obj,
+ unsigned long& reslen, unsigned long& memlen)
+{
+ unsigned long i, k;
+ reslen = args->arg_count + 2;
+
+ // Calculate the result max length
+ for (i = 0; i < args->arg_count; i++) {
+ if (obj) {
+ if (!(k = args->attribute_lengths[i]))
+ k = strlen(args->attributes[i]);
+
+ reslen += (k + 3); // For quotes and :
+ } // endif obj
+
+ switch (args->arg_type[i]) {
+ case STRING_RESULT:
+ if (IsJson(args, i))
+ reslen += args->lengths[i];
+ else
+ reslen += (args->lengths[i] + 1) * 2; // Pessimistic !
+
+ break;
+ case INT_RESULT:
+ reslen += 20;
+ break;
+ case REAL_RESULT:
+ reslen += 31;
+ break;
+ case DECIMAL_RESULT:
+ reslen += (args->lengths[i] + 7); // 6 decimals
+ break;
+ case TIME_RESULT:
+ case ROW_RESULT:
+ case IMPOSSIBLE_RESULT:
+ default:
+ // What should we do here ?
+ break;
+ } // endswitch arg_type
+
+ } // endfor i
+
+ // Calculate the amount of memory needed
+ memlen = MEMFIX + sizeof(JOUTSTR) + reslen;
+
+ for (i = 0; i < args->arg_count; i++) {
+ memlen += (args->lengths[i] + sizeof(JVALUE));
+
+ if (obj) {
+ if (!(k = args->attribute_lengths[i]))
+ k = strlen(args->attributes[i]);
+
+ memlen += (k + sizeof(JOBJECT) + sizeof(JPAIR));
+ } else
+ memlen += sizeof(JARRAY);
+
+ switch (args->arg_type[i]) {
+ case STRING_RESULT:
+ if (IsJson(args, i))
+ memlen += args->lengths[i] * 5; // Estimate parse memory
+
+ memlen += sizeof(TYPVAL<PSZ>);
+ break;
+ case INT_RESULT:
+ memlen += sizeof(TYPVAL<int>);
+ break;
+ case REAL_RESULT:
+ case DECIMAL_RESULT:
+ memlen += sizeof(TYPVAL<double>);
+ break;
+ case TIME_RESULT:
+ case ROW_RESULT:
+ case IMPOSSIBLE_RESULT:
+ default:
+ // What should we do here ?
+ break;
+ } // endswitch arg_type
+
+ } // endfor i
+
+ return false;
+} // end of CalcLen
+
+/***********************************************************************/
+/* Make a zero terminated string from the passed argument. */
+/***********************************************************************/
+static PSZ MakePSZ(PGLOBAL g, UDF_ARGS *args, int i)
+{
+ if (args->args[i]) {
+ int n = args->lengths[i];
+ PSZ s = (PSZ)PlugSubAlloc(g, NULL, n + 1);
+
+ memcpy(s, args->args[i], n);
+ s[n] = 0;
+ return s;
+ } else
+ return NULL;
+
+} // end of MakePSZ
+
+/***********************************************************************/
+/* Make a valid key from the passed argument. */
+/***********************************************************************/
+static PSZ MakeKey(PGLOBAL g, UDF_ARGS *args, int i)
+{
+ int n = args->attribute_lengths[i];
+ bool b; // true if attribute is zero terminated
+ PSZ p, s = args->attributes[i];
+
+ if (s && *s && (n || *s == '\'')) {
+ if ((b = (!n || !s[n])))
+ n = strlen(s);
+
+ if (n > 5 && IsJson(args, i)) {
+ s += 5;
+ n -= 5;
+ } else if (*s == '\'' && s[n-1] == '\'') {
+ s++;
+ n -= 2;
+ b = false;
+ } // endif *s
+
+ if (n < 1)
+ return "Key";
+
+ if (!b) {
+ p = (PSZ)PlugSubAlloc(g, NULL, n + 1);
+ memcpy(p, s, n);
+ p[n] = 0;
+ s = p;
+ } // endif b
+
+ } // endif s
+
+ return s;
+} // end of MakeKey
+
+/***********************************************************************/
+/* Make a JSON value from the passed argument. */
+/***********************************************************************/
+static PJVAL MakeValue(PGLOBAL g, UDF_ARGS *args, int i)
+{
+ char *sap = (args->arg_count > (unsigned)i) ? args->args[i] : NULL;
+ PJSON jsp;
+ PJVAL jvp = new(g) JVALUE;
+
+ if (sap) switch (args->arg_type[i]) {
+ case STRING_RESULT:
+ if (args->lengths[i]) {
+ if (IsJson(args, i)) {
+ if (!(jsp = ParseJson(g, sap, args->lengths[i], 0)))
+ push_warning(current_thd, Sql_condition::WARN_LEVEL_WARN, 0,
+ g->Message);
+
+ if (jsp && jsp->GetType() == TYPE_JVAL)
+ jvp = (PJVAL)jsp;
+ else
+ jvp->SetValue(jsp);
+
+ } else
+ jvp->SetString(g, MakePSZ(g, args, i));
+
+ } // endif str
+
+ break;
+ case INT_RESULT:
+ jvp->SetInteger(g, *(int*)sap);
+ break;
+ case REAL_RESULT:
+ jvp->SetFloat(g, *(double*)sap);
+ break;
+ case DECIMAL_RESULT:
+ jvp->SetFloat(g, atof(MakePSZ(g, args, i)));
+ break;
+ case TIME_RESULT:
+ case ROW_RESULT:
+ case IMPOSSIBLE_RESULT:
+ default:
+ break;
+ } // endswitch arg_type
+
+ return jvp;
+} // end of MakeValue
+
+/***********************************************************************/
+/* Make a Json value containing the parameter. */
+/***********************************************************************/
+my_bool Json_Value_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
+{
+ unsigned long reslen, memlen;
+
+ if (args->arg_count > 1) {
+ strcpy(message, "Json_Value cannot accept more than 1 argument");
+ return true;
+ } else
+ CalcLen(args, false, reslen, memlen);
+
+ return JsonInit(initid, message, reslen, memlen);
+} // end of Json_Value_init
+
+char *Json_Value(UDF_INIT *initid, UDF_ARGS *args, char *result,
+ unsigned long *res_length, char *, char *)
+{
+ char *str;
+ PJVAL jvp;
+ PGLOBAL g = (PGLOBAL)initid->ptr;
+
+ PlugSubSet(g, g->Sarea, g->Sarea_Size);
+ jvp = MakeValue(g, args, 0);
+
+ if (!(str = Serialize(g, jvp, NULL, 0)))
+ str = strcpy(result, g->Message);
+
+ *res_length = strlen(str);
+ return str;
+} // end of Json_Value
+
+void Json_Value_deinit(UDF_INIT* initid)
+{
+ PlugExit((PGLOBAL)initid->ptr);
+} // end of Json_Value_deinit
+
+/***********************************************************************/
+/* Make a Json array containing all the parameters. */
+/***********************************************************************/
+my_bool Json_Array_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
+{
+ unsigned long reslen, memlen;
+
+ CalcLen(args, false, reslen, memlen);
+ return JsonInit(initid, message, reslen, memlen);
+} // end of Json_Array_init
+
+char *Json_Array(UDF_INIT *initid, UDF_ARGS *args, char *result,
+ unsigned long *res_length, char *, char *)
+{
+ char *str;
+ uint i;
+ PJAR arp;
+ PGLOBAL g = (PGLOBAL)initid->ptr;
+
+ PlugSubSet(g, g->Sarea, g->Sarea_Size);
+ arp = new(g) JARRAY;
+
+ for (i = 0; i < args->arg_count; i++)
+ arp->AddValue(g, MakeValue(g, args, i));
+
+ arp->InitArray(g);
+
+ if (!(str = Serialize(g, arp, NULL, 0)))
+ str = strcpy(result, g->Message);
+
+ *res_length = strlen(str);
+ return str;
+} // end of Json_Array
+
+void Json_Array_deinit(UDF_INIT* initid)
+{
+ PlugExit((PGLOBAL)initid->ptr);
+} // end of Json_Array_deinit
+
+/***********************************************************************/
+/* Add values to a Json array. */
+/***********************************************************************/
+my_bool Json_Array_Add_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
+{
+ unsigned long reslen, memlen;
+
+ if (args->arg_count < 2) {
+ strcpy(message, "Json_Value_Add must have at least 2 arguments");
+ return true;
+ } else if (!IsJson(args, 0)) {
+ strcpy(message, "Json_Value_Add first argument must be a json item");
+ return true;
+ } else
+ CalcLen(args, false, reslen, memlen);
+
+ return JsonInit(initid, message, reslen, memlen);
+} // end of Json_Array_Add_init
+
+char *Json_Array_Add(UDF_INIT *initid, UDF_ARGS *args, char *result,
+ unsigned long *res_length, char *, char *)
+{
+ char *str;
+ PJVAL jvp;
+ PJAR arp;
+ PGLOBAL g = (PGLOBAL)initid->ptr;
+
+ PlugSubSet(g, g->Sarea, g->Sarea_Size);
+ jvp = MakeValue(g, args, 0);
+
+ if (jvp->GetValType() != TYPE_JAR) {
+ arp = new(g) JARRAY;
+ arp->AddValue(g, jvp);
+ } else
+ arp = jvp->GetArray();
+
+ for (uint i = 1; i < args->arg_count; i++)
+ arp->AddValue(g, MakeValue(g, args, i));
+
+ arp->InitArray(g);
+
+ if (!(str = Serialize(g, arp, NULL, 0)))
+ str = strcpy(result, g->Message);
+
+ *res_length = strlen(str);
+ return str;
+} // end of Json_Array_Add
+
+void Json_Array_Add_deinit(UDF_INIT* initid)
+{
+ PlugExit((PGLOBAL)initid->ptr);
+} // end of Json_Array_Add_deinit
+
+/***********************************************************************/
+/* Delete a value from a Json array. */
+/***********************************************************************/
+my_bool Json_Array_Delete_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
+{
+ unsigned long reslen, memlen;
+
+ if (args->arg_count != 2) {
+ strcpy(message, "Json_Value_Delete must have 2 arguments");
+ return true;
+ } else if (!IsJson(args, 0)) {
+ strcpy(message, "Json_Value_Delete first argument must be a json item");
+ return true;
+ } else
+ CalcLen(args, false, reslen, memlen);
+
+ return JsonInit(initid, message, reslen, memlen);
+} // end of Json_Array_Delete_init
+
+char *Json_Array_Delete(UDF_INIT *initid, UDF_ARGS *args, char *result,
+ unsigned long *res_length, char *, char *)
+{
+ char *str;
+ int n;
+ PJVAL jvp;
+ PJAR arp;
+ PGLOBAL g = (PGLOBAL)initid->ptr;
+
+ PlugSubSet(g, g->Sarea, g->Sarea_Size);
+ jvp = MakeValue(g, args, 0);
+
+ if (jvp->GetValType() != TYPE_JAR) {
+ push_warning(current_thd, Sql_condition::WARN_LEVEL_WARN, 0,
+ "First argument is not an array");
+ str = args->args[0];
+ } else if (args->arg_type[1] != INT_RESULT) {
+ push_warning(current_thd, Sql_condition::WARN_LEVEL_WARN, 0,
+ "Second argument is not an integer");
+ str = args->args[0];
+ } else {
+ n = *(int*)args->args[1];
+ arp = jvp->GetArray();
+ arp->DeleteValue(n);
+ arp->InitArray(g);
+
+ if (!(str = Serialize(g, arp, NULL, 0))) {
+ str = strcpy(result, g->Message);
+ push_warning(current_thd, Sql_condition::WARN_LEVEL_WARN, 0, str);
+ } // endif str
+
+ } // endif's
+
+ *res_length = strlen(str);
+ return str;
+} // end of Json_Array_Delete
+
+void Json_Array_Delete_deinit(UDF_INIT* initid)
+{
+ PlugExit((PGLOBAL)initid->ptr);
+} // end of Json_Array_Delete_deinit
+
+/***********************************************************************/
+/* Make a Json Oject containing all the parameters. */
+/***********************************************************************/
+my_bool Json_Object_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
+{
+ unsigned long reslen, memlen;
+
+ CalcLen(args, true, reslen, memlen);
+ return JsonInit(initid, message, reslen, memlen);
+} // end of Json_Object_init
+
+char *Json_Object(UDF_INIT *initid, UDF_ARGS *args, char *result,
+ unsigned long *res_length, char *, char *)
+{
+ char *str;
+ uint i;
+ PJOB objp;
+ PGLOBAL g = (PGLOBAL)initid->ptr;
+
+ PlugSubSet(g, g->Sarea, g->Sarea_Size);
+ objp = new(g) JOBJECT;
+
+ for (i = 0; i < args->arg_count; i++)
+ objp->SetValue(g, MakeValue(g, args, i), MakeKey(g, args, i));
+
+ if (!(str = Serialize(g, objp, NULL, 0)))
+ str = strcpy(result, g->Message);
+
+ *res_length = strlen(str);
+ return str;
+} // end of Json_Object
+
+void Json_Object_deinit(UDF_INIT* initid)
+{
+ PlugExit((PGLOBAL)initid->ptr);
+} // end of Json_Object_deinit
+
+/***********************************************************************/
+/* Make a Json Oject containing all not null parameters. */
+/***********************************************************************/
+my_bool Json_Object_Nonull_init(UDF_INIT *initid, UDF_ARGS *args,
+ char *message)
+{
+ unsigned long reslen, memlen;
+
+ CalcLen(args, true, reslen, memlen);
+ return JsonInit(initid, message, reslen, memlen);
+} // end of Json_Object_Nonull_init
+
+char *Json_Object_Nonull(UDF_INIT *initid, UDF_ARGS *args, char *result,
+ unsigned long *res_length, char *, char *)
+{
+ char *str;
+ uint i;
+ PJOB objp;
+ PJVAL jvp;
+ PGLOBAL g = (PGLOBAL)initid->ptr;
+
+ PlugSubSet(g, g->Sarea, g->Sarea_Size);
+ objp = new(g) JOBJECT;
+
+ for (i = 0; i < args->arg_count; i++)
+ if (!(jvp = MakeValue(g, args, i))->IsNull())
+ objp->SetValue(g, jvp, MakeKey(g, args, i));
+
+ if (!(str = Serialize(g, objp, NULL, 0)))
+ str = strcpy(result, g->Message);
+
+ *res_length = strlen(str);
+ return str;
+} // end of Json_Object_Nonull
+
+void Json_Object_Nonull_deinit(UDF_INIT* initid)
+{
+ PlugExit((PGLOBAL)initid->ptr);
+} // end of Json_Object_nonull_deinit
+
+/***********************************************************************/
+/* Make a Json array from values comming from rows. */
+/***********************************************************************/
+my_bool Json_Array_Grp_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
+{
+ unsigned long reslen, memlen, n = GetJsonGrpSize();
+
+ if (args->arg_count != 1) {
+ strcpy(message, "Json_Array_Grp can only accept 1 argument");
+ return true;
+ } else
+ CalcLen(args, false, reslen, memlen);
+
+ reslen *= n;
+ memlen += ((memlen - MEMFIX) * (n - 1));
+
+ if (JsonInit(initid, message, reslen, memlen))
+ return true;
+
+ PGLOBAL g = (PGLOBAL)initid->ptr;
+
+ PlugSubSet(g, g->Sarea, g->Sarea_Size);
+ g->Activityp = (PACTIVITY)new(g) JARRAY;
+ g->N = (int)n;
+ return false;
+} // end of Json_Array_Grp_init
+
+void Json_Array_Grp_add(UDF_INIT *initid, UDF_ARGS *args, char*, char*)
+{
+ PGLOBAL g = (PGLOBAL)initid->ptr;
+ PJAR arp = (PJAR)g->Activityp;
+
+ if (g->N-- > 0)
+ arp->AddValue(g, MakeValue(g, args, 0));
+
+} // end of Json_Array_Grp_add
+
+char *Json_Array_Grp(UDF_INIT *initid, UDF_ARGS *, char *result,
+ unsigned long *res_length, char *, char *)
+{
+ char *str;
+ PGLOBAL g = (PGLOBAL)initid->ptr;
+ PJAR arp = (PJAR)g->Activityp;
+
+ if (g->N < 0)
+ push_warning(current_thd, Sql_condition::WARN_LEVEL_WARN, 0,
+ "Result truncated to json_grp_size values");
+
+ arp->InitArray(g);
+
+ if (!(str = Serialize(g, arp, NULL, 0)))
+ str = strcpy(result, g->Message);
+
+ *res_length = strlen(str);
+ return str;
+} // end of Json_Array_Grp
+
+void Json_Array_Grp_clear(UDF_INIT *initid, char*, char*)
+{
+ PGLOBAL g = (PGLOBAL)initid->ptr;
+
+ PlugSubSet(g, g->Sarea, g->Sarea_Size);
+ g->Activityp = (PACTIVITY)new(g) JARRAY;
+ g->N = GetJsonGrpSize();
+} // end of Json_Array_Grp_clear
+
+void Json_Array_Grp_deinit(UDF_INIT* initid)
+{
+ PlugExit((PGLOBAL)initid->ptr);
+} // end of Json_Array_Grp_deinit
+
+/***********************************************************************/
+/* Make a Json object from values comming from rows. */
+/***********************************************************************/
+my_bool Json_Object_Grp_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
+{
+ unsigned long reslen, memlen, n = GetJsonGrpSize();
+
+ if (args->arg_count != 2) {
+ strcpy(message, "Json_Array_Grp can only accept 2 arguments");
+ return true;
+ } else
+ CalcLen(args, true, reslen, memlen);
+
+ reslen *= n;
+ memlen += ((memlen - MEMFIX) * (n - 1));
+
+ if (JsonInit(initid, message, reslen, memlen))
+ return true;
+
+ PGLOBAL g = (PGLOBAL)initid->ptr;
+
+ PlugSubSet(g, g->Sarea, g->Sarea_Size);
+ g->Activityp = (PACTIVITY)new(g) JOBJECT;
+ g->N = (int)n;
+ return false;
+} // end of Json_Object_Grp_init
+
+void Json_Object_Grp_add(UDF_INIT *initid, UDF_ARGS *args, char*, char*)
+{
+ PGLOBAL g = (PGLOBAL)initid->ptr;
+ PJOB objp = (PJOB)g->Activityp;
+
+ if (g->N-- > 0)
+ objp->SetValue(g, MakeValue(g, args, 0), MakePSZ(g, args, 1));
+
+} // end of Json_Object_Grp_add
+
+char *Json_Object_Grp(UDF_INIT *initid, UDF_ARGS *, char *result,
+ unsigned long *res_length, char *, char *)
+{
+ char *str;
+ PGLOBAL g = (PGLOBAL)initid->ptr;
+ PJOB objp = (PJOB)g->Activityp;
+
+ if (g->N < 0)
+ push_warning(current_thd, Sql_condition::WARN_LEVEL_WARN, 0,
+ "Result truncated to json_grp_size values");
+
+ if (!(str = Serialize(g, objp, NULL, 0)))
+ str = strcpy(result, g->Message);
+
+ *res_length = strlen(str);
+ return str;
+} // end of Json_Object_Grp
+
+void Json_Object_Grp_clear(UDF_INIT *initid, char*, char*)
+{
+ PGLOBAL g = (PGLOBAL)initid->ptr;
+
+ PlugSubSet(g, g->Sarea, g->Sarea_Size);
+ g->Activityp = (PACTIVITY)new(g) JOBJECT;
+ g->N = GetJsonGrpSize();
+} // end of Json_Object_Grp_clear
+
+void Json_Object_Grp_deinit(UDF_INIT* initid)
+{
+ PlugExit((PGLOBAL)initid->ptr);
+} // end of Json_Object_Grp_deinit
+
+
diff --git a/storage/connect/libdoc.cpp b/storage/connect/libdoc.cpp
index e576c1cf5fa..c2882fc0d7c 100644
--- a/storage/connect/libdoc.cpp
+++ b/storage/connect/libdoc.cpp
@@ -1,6 +1,6 @@
/******************************************************************/
/* Implementation of XML document processing using libxml2 */
-/* Author: Olivier Bertrand 2007-2013 */
+/* Author: Olivier Bertrand 2007-2015 */
/******************************************************************/
#include "my_global.h"
#include <string.h>
@@ -162,10 +162,12 @@ class XML2ATTR : public XMLATTRIBUTE {
friend class XML2NODE;
public:
// Properties
-//virtual char *GetText(void);
+ virtual char *GetName(PGLOBAL g) {return (char*)Atrp->name;}
+ virtual PXATTR GetNext(PGLOBAL g);
// Methods
- virtual bool SetText(PGLOBAL g, char *txtp, int len);
+ virtual RCODE GetText(PGLOBAL g, char *bufp, int len);
+ virtual bool SetText(PGLOBAL g, char *txtp, int len);
protected:
// Constructor
@@ -408,8 +410,7 @@ PFBLOCK LIBXMLDOC::LinkXblock(PGLOBAL g, MODE m, int rc, char *fn)
xp->Next = (PX2BLOCK)dup->Openlist;
dup->Openlist = (PFBLOCK)xp;
xp->Type = TYPE_FB_XML2;
- xp->Fname = (LPCSTR)PlugSubAlloc(g, NULL, strlen(fn) + 1);
- strcpy((char*)xp->Fname, fn);
+ xp->Fname = (LPCSTR)PlugDup(g, fn);
xp->Count = 1;
xp->Length = (m == MODE_READ) ? 1 : 0;
xp->Retcode = rc;
@@ -532,8 +533,8 @@ int LIBXMLDOC::DumpDoc(PGLOBAL g, char *ofn)
// This function does not crash (
if (xmlSaveFormatFileEnc((const char *)ofn, Docp, Encoding, 0) < 0) {
xmlErrorPtr err = xmlGetLastError();
-
strcpy(g->Message, (err) ? err->message : "Error saving XML doc");
+ xmlResetError(Xerr);
rc = -1;
} // endif Save
// rc = xmlDocDump(of, Docp);
@@ -568,6 +569,7 @@ void LIBXMLDOC::CloseDoc(PGLOBAL g, PFBLOCK xp)
htrc("CloseDoc: xp=%p count=%d\n", xp, (xp) ? xp->Count : 0);
//if (xp && xp->Count == 1) {
+ if (xp) {
if (Nlist) {
xmlXPathFreeNodeSet(Nlist);
@@ -604,7 +606,7 @@ void LIBXMLDOC::CloseDoc(PGLOBAL g, PFBLOCK xp)
Ctxp = NULL;
} // endif Ctxp
-// } // endif Count
+ } // endif xp
CloseXML2File(g, xp, false);
} // end of Close
@@ -813,7 +815,7 @@ PXNODE XML2NODE::GetNext(PGLOBAL g)
if (!Nodep->next)
Next = NULL;
- else if (!Next)
+ else // if (!Next)
Next = new(g) XML2NODE(Doc, Nodep->next);
return Next;
@@ -829,7 +831,7 @@ PXNODE XML2NODE::GetChild(PGLOBAL g)
if (!Nodep->children)
Children = NULL;
- else if (!Children)
+ else // if (!Children)
Children = new(g) XML2NODE(Doc, Nodep->children);
return Children;
@@ -979,10 +981,16 @@ PXNODE XML2NODE::SelectSingleNode(PGLOBAL g, char *xp, PXNODE np)
/******************************************************************/
PXATTR XML2NODE::GetAttribute(PGLOBAL g, char *name, PXATTR ap)
{
+ xmlAttrPtr atp;
+
if (trace)
- htrc("GetAttribute: %s\n", name);
+ htrc("GetAttribute: %s\n", SVP(name));
+
+ if (name)
+ atp = xmlHasProp(Nodep, BAD_CAST name);
+ else
+ atp = Nodep->properties;
- xmlAttrPtr atp = xmlHasProp(Nodep, BAD_CAST name);
if (atp) {
if (ap) {
@@ -1211,6 +1219,52 @@ XML2ATTR::XML2ATTR(PXDOC dp, xmlAttrPtr ap, xmlNodePtr np)
} // end of XML2ATTR constructor
/******************************************************************/
+/* Return the next sibling of the attribute. */
+/******************************************************************/
+PXATTR XML2ATTR::GetNext(PGLOBAL g)
+ {
+ if (trace)
+ htrc("Attr GetNext\n");
+
+ if (!Atrp->next)
+ return NULL;
+ else
+ return new(g) XML2ATTR(Doc, Atrp->next, Atrp->parent);
+
+ } // end of GetNext
+
+/******************************************************************/
+/* Return the text of an attribute. */
+/******************************************************************/
+RCODE XML2ATTR::GetText(PGLOBAL g, char *buf, int len)
+ {
+ RCODE rc = RC_OK;
+ xmlChar *txt;
+
+ if (trace)
+ htrc("GetText\n");
+
+ if ((txt = xmlGetProp(Atrp->parent, Atrp->name))) {
+ // Copy the text to the buffer
+ if (strlen((char*)txt) >= (unsigned)len) {
+ memcpy(buf, txt, len - 1);
+ buf[len - 1] = 0;
+ sprintf(g->Message, "Truncated %s content", Atrp->name);
+ rc = RC_INFO;
+ } else
+ strcpy(buf, (const char*)txt);
+
+ xmlFree(txt);
+ } else
+ *buf = '\0';
+
+ if (trace)
+ htrc("GetText: %s\n", buf);
+
+ return rc;
+ } // end of GetText
+
+/******************************************************************/
/* Set the content of an attribute. */
/******************************************************************/
bool XML2ATTR::SetText(PGLOBAL g, char *txtp, int len)
diff --git a/storage/connect/macutil.cpp b/storage/connect/macutil.cpp
index 4d3022b91b6..f5d3bb11fe9 100644
--- a/storage/connect/macutil.cpp
+++ b/storage/connect/macutil.cpp
@@ -2,11 +2,11 @@
/* MACUTIL: Author Olivier Bertrand -- 2008-2012 */
/* From the article and sample code by Khalid Shaikh. */
/***********************************************************************/
-#if defined(WIN32)
+#if defined(__WIN__)
#include "my_global.h"
-#else // !WIN32
-#error This is WIN32 only DLL
-#endif // !WIN32
+#else // !__WIN__
+#error This is WINDOWS only DLL
+#endif // !__WIN__
#include "global.h"
#include "plgdbsem.h"
#include "macutil.h"
diff --git a/storage/connect/macutil.h b/storage/connect/macutil.h
index 8a3e97e12e1..c80bd58e20a 100644
--- a/storage/connect/macutil.h
+++ b/storage/connect/macutil.h
@@ -1,10 +1,10 @@
// MACUTIL.H Olivier Bertrand 2008-2012
// Get Mac Addresses via GetAdaptersInfo
-#if defined(WIN32)
+#if defined(__WIN__)
#include <iphlpapi.h>
-#else // !WIN32
-#error This is WIN32 only
-#endif // !WIN32
+#else // !__WIN__
+#error This is WINDOWS only
+#endif // !__WIN__
#include "block.h"
typedef class MACINFO *MACIP;
diff --git a/storage/connect/maputil.cpp b/storage/connect/maputil.cpp
index 97c638b4254..c4e016f1511 100644
--- a/storage/connect/maputil.cpp
+++ b/storage/connect/maputil.cpp
@@ -14,7 +14,7 @@
#include "plgdbsem.h"
#include "maputil.h"
-#ifdef WIN32
+#ifdef __WIN__
/***********************************************************************/
/* In Insert mode, just open the file for append. Otherwise */
/* create the mapping file object. The map handle can be released */
diff --git a/storage/connect/mycat.cc b/storage/connect/mycat.cc
index 0ae0537ba6f..9c72e9cd665 100644
--- a/storage/connect/mycat.cc
+++ b/storage/connect/mycat.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) Olivier Bertrand 2004 - 2014
+/* Copyright (C) Olivier Bertrand 2004 - 2015
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
@@ -18,7 +18,7 @@
/* ------------- */
/* Version 1.4 */
/* */
-/* Author: Olivier Bertrand 2012 - 2014 */
+/* Author: Olivier Bertrand 2012 - 2015 */
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
@@ -30,7 +30,7 @@
/***********************************************************************/
#include <my_config.h>
-#if defined(WIN32)
+#if defined(__WIN__)
//#include <windows.h>
//#include <sqlext.h>
#elif defined(UNIX)
@@ -66,21 +66,16 @@
#include "tabfmt.h"
#include "tabvct.h"
#include "tabsys.h"
-#if defined(WIN32)
+#if defined(__WIN__)
#include "tabmac.h"
#include "tabwmi.h"
-#endif // WIN32
+#endif // __WIN__
//#include "tabtbl.h"
#include "tabxcl.h"
#include "tabtbl.h"
#include "taboccur.h"
-#if defined(XML_SUPPORT)
-#include "tabxml.h"
-#endif // XML_SUPPORT
#include "tabmul.h"
-#if defined(MYSQL_SUPPORT)
#include "tabmysql.h"
-#endif // MYSQL_SUPPORT
#if defined(ODBC_SUPPORT)
#define NODBC
#include "tabodbc.h"
@@ -91,18 +86,40 @@
#include "tabvir.h"
#include "tabjson.h"
#include "ha_connect.h"
-#include "mycat.h"
+#if defined(XML_SUPPORT)
+#include "tabxml.h"
+#endif // XML_SUPPORT
/***********************************************************************/
/* Extern static variables. */
/***********************************************************************/
-#if defined(WIN32)
+#if defined(__WIN__)
extern "C" HINSTANCE s_hModule; // Saved module handle
-#endif // !WIN32
+#endif // !__WIN__
PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char *tab, char *db, bool info);
/***********************************************************************/
+/* Get the plugin directory. */
+/***********************************************************************/
+char *GetPluginDir(void)
+{
+ char *plugin_dir;
+
+#if defined(_WIN64)
+ plugin_dir = (char *)GetProcAddress(GetModuleHandle(NULL),
+ "?opt_plugin_dir@@3PADEA");
+#elif defined(_WIN32)
+ plugin_dir = (char*)GetProcAddress(GetModuleHandle(NULL),
+ "?opt_plugin_dir@@3PADA");
+#else
+ plugin_dir = opt_plugin_dir;
+#endif
+
+ return plugin_dir;
+} // end of GetPluginDir
+
+/***********************************************************************/
/* Get a unique enum table type ID. */
/***********************************************************************/
TABTYPE GetTypeID(const char *type)
@@ -122,12 +139,10 @@ TABTYPE GetTypeID(const char *type)
#ifdef ODBC_SUPPORT
: (!stricmp(type, "ODBC")) ? TAB_ODBC
#endif
-#ifdef MYSQL_SUPPORT
: (!stricmp(type, "MYSQL")) ? TAB_MYSQL
: (!stricmp(type, "MYPRX")) ? TAB_MYSQL
-#endif
: (!stricmp(type, "DIR")) ? TAB_DIR
-#ifdef WIN32
+#ifdef __WIN__
: (!stricmp(type, "MAC")) ? TAB_MAC
: (!stricmp(type, "WMI")) ? TAB_WMI
#endif
@@ -333,12 +348,12 @@ PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char *tab, char *db, bool info)
{
typedef PQRYRES (__stdcall *XCOLDEF) (PGLOBAL, void*, char*, char*, bool);
const char *module, *subtype;
- char c, getname[40] = "Col";
-#if defined(WIN32)
+ char c, soname[_MAX_PATH], getname[40] = "Col";
+#if defined(__WIN__)
HANDLE hdll; /* Handle to the external DLL */
-#else // !WIN32
+#else // !__WIN__
void *hdll; /* Handle for the loaded shared library */
-#endif // !WIN32
+#endif // !__WIN__
XCOLDEF coldef = NULL;
PQRYRES qrp = NULL;
@@ -348,6 +363,17 @@ PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char *tab, char *db, bool info)
if (!module || !subtype)
return NULL;
+ /*********************************************************************/
+ /* Ensure that the .dll doesn't have a path. */
+ /* This is done to ensure that only approved dll from the system */
+ /* directories are used (to make this even remotely secure). */
+ /*********************************************************************/
+ if (check_valid_path(module, strlen(module))) {
+ strcpy(g->Message, "Module cannot contain a path");
+ return NULL;
+ } else
+ PlugSetPath(soname, module, GetPluginDir());
+
// The exported name is always in uppercase
for (int i = 0; ; i++) {
c = subtype[i];
@@ -355,13 +381,13 @@ PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char *tab, char *db, bool info)
if (!c) break;
} // endfor i
-#if defined(WIN32)
+#if defined(__WIN__)
// Load the Dll implementing the table
- if (!(hdll = LoadLibrary(module))) {
+ if (!(hdll = LoadLibrary(soname))) {
char buf[256];
DWORD rc = GetLastError();
- sprintf(g->Message, MSG(DLL_LOAD_ERROR), rc, module);
+ sprintf(g->Message, MSG(DLL_LOAD_ERROR), rc, soname);
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS, NULL, rc, 0,
(LPTSTR)buf, sizeof(buf), NULL);
@@ -375,13 +401,13 @@ PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char *tab, char *db, bool info)
FreeLibrary((HMODULE)hdll);
return NULL;
} // endif coldef
-#else // !WIN32
+#else // !__WIN__
const char *error = NULL;
// Load the desired shared library
- if (!(hdll = dlopen(module, RTLD_LAZY))) {
+ if (!(hdll = dlopen(soname, RTLD_LAZY))) {
error = dlerror();
- sprintf(g->Message, MSG(SHARED_LIB_ERR), module, SVP(error));
+ sprintf(g->Message, MSG(SHARED_LIB_ERR), soname, SVP(error));
return NULL;
} // endif Hdll
@@ -392,7 +418,7 @@ PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char *tab, char *db, bool info)
dlclose(hdll);
return NULL;
} // endif coldef
-#endif // !WIN32
+#endif // !__WIN__
// Just in case the external Get function does not set error messages
sprintf(g->Message, "Error getting column info from %s", subtype);
@@ -400,11 +426,11 @@ PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char *tab, char *db, bool info)
// Get the table column definition
qrp = coldef(g, topt, tab, db, info);
-#if defined(WIN32)
+#if defined(__WIN__)
FreeLibrary((HMODULE)hdll);
-#else // !WIN32
+#else // !__WIN__
dlclose(hdll);
-#endif // !WIN32
+#endif // !__WIN__
return qrp;
} // end of OEMColumns
@@ -416,11 +442,11 @@ PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char *tab, char *db, bool info)
/***********************************************************************/
CATALOG::CATALOG(void)
{
-#if defined(WIN32)
+#if defined(__WIN__)
//DataPath= ".\\";
-#else // !WIN32
+#else // !__WIN__
//DataPath= "./";
-#endif // !WIN32
+#endif // !__WIN__
memset(&Ctb, 0, sizeof(CURTAB));
Cbuf= NULL;
Cblen= 0;
@@ -463,11 +489,11 @@ void MYCAT::SetPath(PGLOBAL g, LPCSTR *datapath, const char *path)
}
if (*path != '.') {
-#if defined(WIN32)
+#if defined(__WIN__)
char *s= "\\";
-#else // !WIN32
+#else // !__WIN__
char *s= "/";
-#endif // !WIN32
+#endif // !__WIN__
strcat(strcat(strcat(strcpy(buf, "."), s), path), s);
} else
strcpy(buf, path);
@@ -483,7 +509,7 @@ void MYCAT::SetPath(PGLOBAL g, LPCSTR *datapath, const char *path)
/* Look for a table descriptor matching the name and type. */
/***********************************************************************/
PRELDEF MYCAT::GetTableDesc(PGLOBAL g, LPCSTR name,
- LPCSTR type, PRELDEF *prp)
+ LPCSTR type, PRELDEF *)
{
if (trace)
printf("GetTableDesc: name=%s am=%s\n", name, SVP(type));
@@ -528,18 +554,16 @@ PRELDEF MYCAT::MakeTableDesc(PGLOBAL g, LPCSTR name, LPCSTR am)
#if defined(ODBC_SUPPORT)
case TAB_ODBC: tdp= new(g) ODBCDEF; break;
#endif // ODBC_SUPPORT
-#if defined(WIN32)
+#if defined(__WIN__)
case TAB_MAC: tdp= new(g) MACDEF; break;
case TAB_WMI: tdp= new(g) WMIDEF; break;
-#endif // WIN32
+#endif // __WIN__
case TAB_OEM: tdp= new(g) OEMDEF; break;
case TAB_TBL: tdp= new(g) TBLDEF; break;
case TAB_XCL: tdp= new(g) XCLDEF; break;
case TAB_PRX: tdp= new(g) PRXDEF; break;
case TAB_OCCUR: tdp= new(g) OCCURDEF; break;
-#if defined(MYSQL_SUPPORT)
case TAB_MYSQL: tdp= new(g) MYSQLDEF; break;
-#endif // MYSQL_SUPPORT
#if defined(PIVOT_SUPPORT)
case TAB_PIVOT: tdp= new(g) PIVOTDEF; break;
#endif // PIVOT_SUPPORT
@@ -596,7 +620,7 @@ PTDB MYCAT::GetTable(PGLOBAL g, PTABLE tablep, MODE mode, LPCSTR type)
/***********************************************************************/
/* ClearDB: Terminates Database usage. */
/***********************************************************************/
-void MYCAT::ClearDB(PGLOBAL g)
+void MYCAT::ClearDB(PGLOBAL)
{
} // end of ClearDB
diff --git a/storage/connect/mycat.h b/storage/connect/mycat.h
index 1aaee4ed1e8..d4024e6b6c3 100644
--- a/storage/connect/mycat.h
+++ b/storage/connect/mycat.h
@@ -1,4 +1,4 @@
-/* Copyright (C) Olivier Bertrand 2004 - 2013
+/* Copyright (C) Olivier Bertrand 2004 - 2015
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
@@ -24,6 +24,46 @@
#include "block.h"
#include "catalog.h"
+//typedef struct ha_table_option_struct TOS, *PTOS;
+
+/**
+ structure for CREATE TABLE options (table options)
+
+ These can be specified in the CREATE TABLE:
+ CREATE TABLE ( ... ) {...here...}
+*/
+struct ha_table_option_struct {
+ const char *type;
+ const char *filename;
+ const char *optname;
+ const char *tabname;
+ const char *tablist;
+ const char *dbname;
+ const char *separator;
+//const char *connect;
+ const char *qchar;
+ const char *module;
+ const char *subtype;
+ const char *catfunc;
+ const char *srcdef;
+ const char *colist;
+ const char *oplist;
+ const char *data_charset;
+ ulonglong lrecl;
+ ulonglong elements;
+//ulonglong estimate;
+ ulonglong multiple;
+ ulonglong header;
+ ulonglong quoted;
+ ulonglong ending;
+ ulonglong compressed;
+ bool mapped;
+ bool huge;
+ bool split;
+ bool readonly;
+ bool sepindex;
+ };
+
// Possible value for catalog functions
#define FNC_NO (1 << 0) // Not a catalog table
#define FNC_COL (1 << 1) // Column catalog function
@@ -58,7 +98,7 @@ class MYCAT : public CATALOG {
void Reset(void);
//void SetDataPath(PGLOBAL g, const char *path)
// {SetPath(g, &DataPath, path);}
- bool StoreIndex(PGLOBAL g, PTABDEF defp) {return false;} // Temporary
+ bool StoreIndex(PGLOBAL, PTABDEF) {return false;} // Temporary
PRELDEF GetTableDesc(PGLOBAL g, LPCSTR name,
LPCSTR type, PRELDEF *prp = NULL);
PTDB GetTable(PGLOBAL g, PTABLE tablep,
diff --git a/storage/connect/myconn.cpp b/storage/connect/myconn.cpp
index 2f3d75b52fa..ada0109a820 100644
--- a/storage/connect/myconn.cpp
+++ b/storage/connect/myconn.cpp
@@ -5,7 +5,7 @@
/* */
/* COPYRIGHT: */
/* ---------- */
-/* (C) Copyright to the author Olivier BERTRAND 2007-2014 */
+/* (C) Copyright to the author Olivier BERTRAND 2007-2015 */
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
@@ -35,11 +35,11 @@
#include "my_sys.h"
#include "mysqld_error.h"
#endif // !MYSQL_PREPARED_STATEMENTS
-#if defined(WIN32)
+#if defined(__WIN__)
//#include <windows.h>
-#else // !WIN32
+#else // !__WIN__
#include "osutil.h"
-#endif // !WIN32
+#endif // !__WIN__
#include "global.h"
#include "plgdbsem.h"
@@ -51,7 +51,8 @@
#define DLL_EXPORT // Items are exported from this DLL
#include "myconn.h"
-extern "C" int zconv;
+//extern "C" int zconv;
+int GetConvSize(void);
extern MYSQL_PLUGIN_IMPORT uint mysqld_port;
extern MYSQL_PLUGIN_IMPORT char *mysqld_unix_port;
@@ -265,7 +266,7 @@ PQRYRES MyColumns(PGLOBAL g, THD *thd, const char *host, const char *db,
return NULL;
} else if (type == TYPE_STRING) {
if (v == 'X') {
- len = zconv;
+ len = GetConvSize();
sprintf(g->Message, "Column %s converted to varchar(%d)",
colname, len);
PushWarning(g, thd);
@@ -450,15 +451,15 @@ int MYSQLC::Open(PGLOBAL g, const char *host, const char *db,
mysql_options(m_DB, MYSQL_OPT_READ_TIMEOUT, &nrt);
//mysql_options(m_DB, MYSQL_OPT_WRITE_TIMEOUT, ...);
-#if defined(WIN32)
+#if defined(__WIN__)
if (!strcmp(host, ".")) {
mysql_options(m_DB, MYSQL_OPT_NAMED_PIPE, NULL);
pipe = mysqld_unix_port;
} // endif host
-#else // !WIN32
+#else // !__WIN__
if (!strcmp(host, "localhost"))
pipe = mysqld_unix_port;
-#endif // !WIN32
+#endif // !__WIN__
#if 0
if (pwd && !strcmp(pwd, "*")) {
@@ -719,7 +720,7 @@ int MYSQLC::ExecSQL(PGLOBAL g, const char *query, int *w)
/***********************************************************************/
/* Get table size by executing "select count(*) from table_name". */
/***********************************************************************/
-int MYSQLC::GetTableSize(PGLOBAL g, PSZ query)
+int MYSQLC::GetTableSize(PGLOBAL g __attribute__((unused)), PSZ query)
{
if (mysql_real_query(m_DB, query, strlen(query))) {
#if defined(_DEBUG)
diff --git a/storage/connect/myconn.h b/storage/connect/myconn.h
index 79b8a43fe5a..fa34edd804c 100644
--- a/storage/connect/myconn.h
+++ b/storage/connect/myconn.h
@@ -7,24 +7,24 @@
/* DO NOT define DLL_EXPORT in your application so these items are */
/* declared are imported from the Myconn DLL. */
/***********************************************************************/
-#if defined(WIN32)
+#if defined(__WIN__)
#include <winsock.h>
-#else // !WIN32
+#else // !__WIN__
#include <sys/socket.h>
-#endif // !WIN32
+#endif // !__WIN__
#include <mysql.h>
#include <errmsg.h>
#include "myutil.h"
-#if defined(WIN32) && defined(MYCONN_EXPORTS)
+#if defined(__WIN__) && defined(MYCONN_EXPORTS)
#if defined(DLL_EXPORT)
#define DllItem _declspec(dllexport)
#else // !DLL_EXPORT
#define DllItem _declspec(dllimport)
#endif // !DLL_EXPORT
-#else // !WIN32 || !MYCONN_EXPORTS
+#else // !__WIN__ || !MYCONN_EXPORTS
#define DllItem
-#endif // !WIN32
+#endif // !__WIN__
#define MYSQL_ENABLED 0x00000001
#define MYSQL_LOGON 0x00000002
diff --git a/storage/connect/mysql-test/connect/my.cnf b/storage/connect/mysql-test/connect/my.cnf
index 317e20012ba..6310772d01f 100644
--- a/storage/connect/mysql-test/connect/my.cnf
+++ b/storage/connect/mysql-test/connect/my.cnf
@@ -1,17 +1,17 @@
-# Use default setting for mysqld processes
-!include include/default_mysqld.cnf
-!include include/default_client.cnf
-
-[mysqld.1]
-#log-bin= master-bin
-
-[mysqld.2]
-
-[ENV]
-MASTER_MYPORT= @mysqld.1.port
-MASTER_MYSOCK= @mysqld.1.socket
-
-SLAVE_MYPORT= @mysqld.2.port
-SLAVE_MYSOCK= @mysqld.2.socket
-
-PGCLIENTENCODING= UTF8
+# Use default setting for mysqld processes
+!include include/default_mysqld.cnf
+!include include/default_client.cnf
+
+[mysqld.1]
+#log-bin= master-bin
+
+[mysqld.2]
+
+[ENV]
+MASTER_MYPORT= @mysqld.1.port
+MASTER_MYSOCK= @mysqld.1.socket
+
+SLAVE_MYPORT= @mysqld.2.port
+SLAVE_MYSOCK= @mysqld.2.socket
+
+PGCLIENTENCODING= UTF8
diff --git a/storage/connect/mysql-test/connect/r/bin.result b/storage/connect/mysql-test/connect/r/bin.result
index bbf5614b555..4ba353ac705 100644
--- a/storage/connect/mysql-test/connect/r/bin.result
+++ b/storage/connect/mysql-test/connect/r/bin.result
@@ -14,12 +14,12 @@ SET time_zone='+00:00';
CREATE TABLE t1
(
fig INT(4) NOT NULL FIELD_FORMAT='C',
-name CHAR(10) not null,
+name CHAR(10) NOT NULL,
birth DATE NOT NULL,
id CHAR(5) NOT NULL FIELD_FORMAT='S',
salary DOUBLE(9,2) NOT NULL DEFAULT 0.00 FIELD_FORMAT='F',
dept INT(4) NOT NULL FIELD_FORMAT='S'
-) ENGINE=CONNECT TABLE_TYPE=BIN BLOCK_SIZE=5 FILE_NAME='Testbal.dat';
+) ENGINE=CONNECT TABLE_TYPE=BIN BLOCK_SIZE=5 FILE_NAME='Testbal.dat' OPTION_LIST='Endian=Little';
SELECT * FROM t1;
fig name birth id salary dept
5500 ARCHIBALD 1980-01-25 3789 4380.50 318
@@ -41,12 +41,12 @@ DROP TABLE t1;
CREATE TABLE t1
(
fig INT(4) NOT NULL FIELD_FORMAT='C',
-name CHAR(10) not null,
+name CHAR(10) NOT NULL,
birth DATE NOT NULL,
id CHAR(5) NOT NULL FIELD_FORMAT='S',
salary DOUBLE(9,2) NOT NULL DEFAULT 0.00 FIELD_FORMAT='F',
dept INT(4) NOT NULL FIELD_FORMAT='S'
-) ENGINE=CONNECT TABLE_TYPE=BIN READONLY=Yes FILE_NAME='Testbal.dat';
+) ENGINE=CONNECT TABLE_TYPE=BIN READONLY=Yes FILE_NAME='Testbal.dat' OPTION_LIST='Endian=Little';
INSERT INTO t1 VALUES (7777,'BILL','1973-06-30',4444,5555.555,777);
ERROR HY000: Table 't1' is read only
ALTER TABLE t1 READONLY=NO;
@@ -59,7 +59,7 @@ t1 CREATE TABLE `t1` (
`id` char(5) NOT NULL `FIELD_FORMAT`='S',
`salary` double(9,2) NOT NULL DEFAULT '0.00' `FIELD_FORMAT`='F',
`dept` int(4) NOT NULL `FIELD_FORMAT`='S'
-) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=BIN `FILE_NAME`='Testbal.dat' `READONLY`=NO
+) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=BIN `FILE_NAME`='Testbal.dat' `OPTION_LIST`='Endian=Little' `READONLY`=NO
INSERT INTO t1 VALUES (7777,'BILL','1973-06-30',4444,5555.555,777);
SELECT * FROM t1;
fig name birth id salary dept
@@ -78,7 +78,7 @@ t1 CREATE TABLE `t1` (
`id` char(5) NOT NULL `FIELD_FORMAT`='S',
`salary` double(9,2) NOT NULL DEFAULT '0.00' `FIELD_FORMAT`='F',
`dept` int(4) NOT NULL `FIELD_FORMAT`='S'
-) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=BIN `FILE_NAME`='Testbal.dat' `READONLY`=YES
+) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=BIN `FILE_NAME`='Testbal.dat' `OPTION_LIST`='Endian=Little' `READONLY`=YES
INSERT INTO t1 VALUES (7777,'BILL','1973-06-30',4444,5555.555,777);
ERROR HY000: Table 't1' is read only
DROP TABLE t1;
diff --git a/storage/connect/mysql-test/connect/r/json.result b/storage/connect/mysql-test/connect/r/json.result
index 094bb669d18..acb74c38e26 100644
--- a/storage/connect/mysql-test/connect/r/json.result
+++ b/storage/connect/mysql-test/connect/r/json.result
@@ -12,10 +12,10 @@ TRANSLATION CHAR(32),
TRANSLATOR CHAR(80),
PUBLISHER CHAR(32),
DATEPUB int(4)
-) ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.jsn';
+) ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.json';
SELECT * FROM t1;
ISBN LANG SUBJECT AUTHOR TITLE TRANSLATION TRANSLATOR PUBLISHER DATEPUB
-9782212090819 fr applications Jean-Christophe Bernadac Construire une application XML Eyrolles Paris 1999
+9782212090819 fr applications Jean-Christophe Bernadac Construire une application XML NULL NULL Eyrolles Paris 1999
9782840825685 fr applications William J. Pardi XML en Action adapté de l'anglais par James Guerin Microsoft Press Paris 1999
DROP TABLE t1;
#
@@ -34,10 +34,10 @@ Publisher CHAR(20) FIELD_FORMAT='PUBLISHER:NAME',
Location CHAR(16) FIELD_FORMAT='PUBLISHER:PLACE',
Year int(4) FIELD_FORMAT='DATEPUB'
)
-ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.jsn';
+ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.json';
SELECT * FROM t1;
ISBN Language Subject Authors Title Translation Translator Publisher Location Year
-9782212090819 fr applications 2 Construire une application XML Eyrolles Paris 1999
+9782212090819 fr applications 2 Construire une application XML NULL NULL Eyrolles Paris 1999
9782840825685 fr applications 1 XML en Action adapté de l'anglais par James Guerin Microsoft Press Paris 1999
DROP TABLE t1;
#
@@ -57,10 +57,10 @@ Publisher CHAR(20) FIELD_FORMAT='PUBLISHER:NAME',
Location CHAR(16) FIELD_FORMAT='PUBLISHER:PLACE',
Year int(4) FIELD_FORMAT='DATEPUB'
)
-ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.jsn';
+ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.json';
SELECT * FROM t1;
ISBN Language Subject AuthorFN AuthorLN Title Translation Translator Publisher Location Year
-9782212090819 fr applications Jean-Christophe and François Bernadac and Knab Construire une application XML Eyrolles Paris 1999
+9782212090819 fr applications Jean-Christophe and François Bernadac and Knab Construire une application XML NULL NULL Eyrolles Paris 1999
9782840825685 fr applications William J. Pardi XML en Action adapté de l'anglais par James Guerin Microsoft Press Paris 1999
DROP TABLE t1;
#
@@ -80,32 +80,32 @@ Publisher CHAR(20) FIELD_FORMAT='PUBLISHER:NAME',
Location CHAR(16) FIELD_FORMAT='PUBLISHER:PLACE',
Year int(4) FIELD_FORMAT='DATEPUB'
)
-ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.jsn';
+ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.json';
SELECT * FROM t1;
ISBN Language Subject AuthorFN AuthorLN Title Translation Translator Publisher Location Year
-9782212090819 fr applications Jean-Christophe Bernadac Construire une application XML Eyrolles Paris 1999
-9782212090819 fr applications François Knab Construire une application XML Eyrolles Paris 1999
+9782212090819 fr applications Jean-Christophe Bernadac Construire une application XML NULL NULL Eyrolles Paris 1999
+9782212090819 fr applications François Knab Construire une application XML NULL NULL Eyrolles Paris 1999
9782840825685 fr applications William J. Pardi XML en Action adapté de l'anglais par James Guerin Microsoft Press Paris 1999
UPDATE t1 SET AuthorFN = 'Philippe' WHERE AuthorLN = 'Knab';
SELECT * FROM t1 WHERE ISBN = '9782212090819';
ISBN Language Subject AuthorFN AuthorLN Title Translation Translator Publisher Location Year
-9782212090819 fr applications Jean-Christophe Bernadac Construire une application XML Eyrolles Paris 1999
-9782212090819 fr applications Philippe Knab Construire une application XML Eyrolles Paris 1999
+9782212090819 fr applications Jean-Christophe Bernadac Construire une application XML NULL NULL Eyrolles Paris 1999
+9782212090819 fr applications Philippe Knab Construire une application XML NULL NULL Eyrolles Paris 1999
#
# To add an author a new table must be created
#
CREATE TABLE t2 (
FIRSTNAME CHAR(32),
LASTNAME CHAR(32))
-ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.jsn' OPTION_LIST='Object=[2]:AUTHOR';
+ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.json' OPTION_LIST='Object=[1]:AUTHOR';
SELECT * FROM t2;
FIRSTNAME LASTNAME
William J. Pardi
INSERT INTO t2 VALUES('Charles','Dickens');
SELECT * FROM t1;
ISBN Language Subject AuthorFN AuthorLN Title Translation Translator Publisher Location Year
-9782212090819 fr applications Jean-Christophe Bernadac Construire une application XML Eyrolles Paris 1999
-9782212090819 fr applications Philippe Knab Construire une application XML Eyrolles Paris 1999
+9782212090819 fr applications Jean-Christophe Bernadac Construire une application XML NULL NULL Eyrolles Paris 1999
+9782212090819 fr applications Philippe Knab Construire une application XML NULL NULL Eyrolles Paris 1999
9782840825685 fr applications William J. Pardi XML en Action adapté de l'anglais par James Guerin Microsoft Press Paris 1999
9782840825685 fr applications Charles Dickens XML en Action adapté de l'anglais par James Guerin Microsoft Press Paris 1999
DROP TABLE t1;
@@ -117,7 +117,7 @@ CREATE TABLE t1
(
line char(255)
)
-ENGINE=CONNECT TABLE_TYPE=DOS FILE_NAME='biblio.jsn';
+ENGINE=CONNECT TABLE_TYPE=DOS FILE_NAME='biblio.json';
SELECT * FROM t1;
line
[
@@ -178,7 +178,7 @@ WHO CHAR(12),
WEEK INT(2) FIELD_FORMAT='WEEK:[X]:NUMBER',
WHAT CHAR(32) FIELD_FORMAT='WEEK::EXPENSE:["+"]:WHAT',
AMOUNT DOUBLE(8,2) FIELD_FORMAT='WEEK::EXPENSE:[+]:AMOUNT')
-ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='expense.jsn';
+ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='expense.json';
SELECT * FROM t1;
WHO WEEK WHAT AMOUNT
Joe 3 Beer+Food+Food+Car 69.00
@@ -192,26 +192,70 @@ Janet 4 Car 17.00
Janet 5 Beer+Car+Beer+Food 57.00
DROP TABLE t1;
#
-# Cannot be fully expanded
+# Now it can be fully expanded
#
CREATE TABLE t1 (
WHO CHAR(12),
WEEK INT(2) FIELD_FORMAT='WEEK:[X]:NUMBER',
WHAT CHAR(32) FIELD_FORMAT='WEEK:[X]:EXPENSE:[X]:WHAT',
AMOUNT DOUBLE(8,2) FIELD_FORMAT='WEEK:[X]:EXPENSE:[X]:AMOUNT')
-ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='expense.jsn';
+ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='expense.json';
SELECT * FROM t1;
-ERROR HY000: Got error 174 'Cannot expand more than one array' from CONNECT
+WHO WEEK WHAT AMOUNT
+Joe 3 Beer 18.00
+Joe 3 Food 12.00
+Joe 3 Food 19.00
+Joe 3 Car 20.00
+Joe 4 Beer 19.00
+Joe 4 Beer 16.00
+Joe 4 Food 17.00
+Joe 4 Food 17.00
+Joe 4 Beer 14.00
+Joe 5 Beer 14.00
+Joe 5 Food 12.00
+Beth 3 Beer 16.00
+Beth 4 Food 17.00
+Beth 4 Beer 15.00
+Beth 5 Food 12.00
+Beth 5 Beer 20.00
+Janet 3 Car 19.00
+Janet 3 Food 18.00
+Janet 3 Beer 18.00
+Janet 4 Car 17.00
+Janet 5 Beer 14.00
+Janet 5 Car 12.00
+Janet 5 Beer 19.00
+Janet 5 Food 12.00
+DROP TABLE t1;
+#
+# A table showing many calculated results
+#
+CREATE TABLE t1 (
+WHO CHAR(12) NOT NULL,
+WEEKS CHAR(12) NOT NULL FIELD_FORMAT='WEEK:[", "]:NUMBER',
+SUMS CHAR(64) NOT NULL FIELD_FORMAT='WEEK:["+"]:EXPENSE:[+]:AMOUNT',
+SUM DOUBLE(8,2) NOT NULL FIELD_FORMAT='WEEK:[+]:EXPENSE:[+]:AMOUNT',
+AVGS CHAR(64) NOT NULL FIELD_FORMAT='WEEK:["+"]:EXPENSE:[!]:AMOUNT',
+SUMAVG DOUBLE(8,2) NOT NULL FIELD_FORMAT='WEEK:[+]:EXPENSE:[!]:AMOUNT',
+AVGSUM DOUBLE(8,2) NOT NULL FIELD_FORMAT='WEEK:[!]:EXPENSE:[+]:AMOUNT',
+AVGAVG DOUBLE(8,2) NOT NULL FIELD_FORMAT='WEEK:[!]:EXPENSE:[!]:AMOUNT',
+AVERAGE DOUBLE(8,2) NOT NULL FIELD_FORMAT='WEEK:[!]:EXPENSE:[X]:AMOUNT')
+ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='expense.json';
+SELECT * FROM t1;
+WHO WEEKS SUMS SUM AVGS SUMAVG AVGSUM AVGAVG AVERAGE
+Joe 3, 4, 5 69.00+83.00+26.00 178.00 17.25+16.60+13.00 46.85 59.33 15.62 16.18
+Beth 3, 4, 5 16.00+32.00+32.00 80.00 16.00+16.00+16.00 48.00 26.67 16.00 16.00
+Janet 3, 4, 5 55.00+17.00+57.00 129.00 18.33+17.00+14.25 49.58 43.00 16.53 16.12
DROP TABLE t1;
#
# Expand expense in 3 one week tables
#
CREATE TABLE t2 (
WHO CHAR(12),
-WEEK INT(2) FIELD_FORMAT='WEEK:[1]:NUMBER',
-WHAT CHAR(32) FIELD_FORMAT='WEEK:[1]:EXPENSE:[X]:WHAT',
-AMOUNT DOUBLE(8,2) FIELD_FORMAT='WEEK:[1]:EXPENSE:[X]:AMOUNT')
-ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='expense.jsn';
+WEEK INT(2) FIELD_FORMAT='WEEK:[0]:NUMBER',
+WHAT CHAR(32) FIELD_FORMAT='WEEK:[0]:EXPENSE:[X]:WHAT',
+AMOUNT DOUBLE(8,2) FIELD_FORMAT='WEEK:[0]:EXPENSE:[X]:AMOUNT')
+ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='expense.json';
SELECT * FROM t2;
WHO WEEK WHAT AMOUNT
Joe 3 Beer 18.00
@@ -224,10 +268,10 @@ Janet 3 Food 18.00
Janet 3 Beer 18.00
CREATE TABLE t3 (
WHO CHAR(12),
-WEEK INT(2) FIELD_FORMAT='WEEK:[2]:NUMBER',
-WHAT CHAR(32) FIELD_FORMAT='WEEK:[2]:EXPENSE:[X]:WHAT',
-AMOUNT DOUBLE(8,2) FIELD_FORMAT='WEEK:[2]:EXPENSE:[X]:AMOUNT')
-ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='expense.jsn';
+WEEK INT(2) FIELD_FORMAT='WEEK:[1]:NUMBER',
+WHAT CHAR(32) FIELD_FORMAT='WEEK:[1]:EXPENSE:[X]:WHAT',
+AMOUNT DOUBLE(8,2) FIELD_FORMAT='WEEK:[1]:EXPENSE:[X]:AMOUNT')
+ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='expense.json';
SELECT * FROM t3;
WHO WEEK WHAT AMOUNT
Joe 4 Beer 19.00
@@ -240,10 +284,10 @@ Beth 4 Beer 15.00
Janet 4 Car 17.00
CREATE TABLE t4 (
WHO CHAR(12),
-WEEK INT(2) FIELD_FORMAT='WEEK:[3]:NUMBER',
-WHAT CHAR(32) FIELD_FORMAT='WEEK:[3]:EXPENSE:[X]:WHAT',
-AMOUNT DOUBLE(8,2) FIELD_FORMAT='WEEK:[3]:EXPENSE:[X]:AMOUNT')
-ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='expense.jsn';
+WEEK INT(2) FIELD_FORMAT='WEEK:[2]:NUMBER',
+WHAT CHAR(32) FIELD_FORMAT='WEEK:[2]:EXPENSE:[X]:WHAT',
+AMOUNT DOUBLE(8,2) FIELD_FORMAT='WEEK:[2]:EXPENSE:[X]:AMOUNT')
+ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='expense.json';
SELECT * FROM t4;
WHO WEEK WHAT AMOUNT
Joe 5 Beer 14.00
@@ -298,7 +342,7 @@ WHO CHAR(12),
WEEK INT(2),
WHAT CHAR(32) FIELD_FORMAT='EXPENSE:[X]:WHAT',
AMOUNT DOUBLE(8,2) FIELD_FORMAT='EXPENSE:[X]:AMOUNT')
-ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='mulexp3.jsn';
+ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='mulexp3.json';
SELECT * FROM t2;
WHO WEEK WHAT AMOUNT
Joe 3 Beer 18.00
@@ -314,7 +358,7 @@ WHO CHAR(12),
WEEK INT(2),
WHAT CHAR(32) FIELD_FORMAT='EXPENSE:[X]:WHAT',
AMOUNT DOUBLE(8,2) FIELD_FORMAT='EXPENSE:[X]:AMOUNT')
-ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='mulexp4.jsn';
+ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='mulexp4.json';
SELECT * FROM t3;
WHO WEEK WHAT AMOUNT
Joe 4 Beer 19.00
@@ -330,7 +374,7 @@ WHO CHAR(12),
WEEK INT(2),
WHAT CHAR(32) FIELD_FORMAT='EXPENSE:[X]:WHAT',
AMOUNT DOUBLE(8,2) FIELD_FORMAT='EXPENSE:[X]:AMOUNT')
-ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='mulexp5.jsn';
+ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='mulexp5.json';
SELECT * FROM t4;
WHO WEEK WHAT AMOUNT
Joe 5 Beer 14.00
@@ -349,7 +393,7 @@ WHO CHAR(12),
WEEK INT(2),
WHAT CHAR(32) FIELD_FORMAT='EXPENSE:[X]:WHAT',
AMOUNT DOUBLE(8,2) FIELD_FORMAT='EXPENSE:[X]:AMOUNT')
-ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='mulexp*.jsn' MULTIPLE=1;
+ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='mulexp*.json' MULTIPLE=1;
SELECT * FROM t1 ORDER BY WHO, WEEK, WHAT, AMOUNT;
WHO WEEK WHAT AMOUNT
Beth 3 Beer 16.00
@@ -385,7 +429,7 @@ WHO CHAR(12),
WEEK INT(2),
WHAT CHAR(32) FIELD_FORMAT='EXPENSE:[X]:WHAT',
AMOUNT DOUBLE(8,2) FIELD_FORMAT='EXPENSE:[X]:AMOUNT')
-ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='mulexp%s.jsn';
+ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='mulexp%s.json';
ALTER TABLE t1
PARTITION BY LIST COLUMNS(WEEK) (
PARTITION `3` VALUES IN(3),
diff --git a/storage/connect/mysql-test/connect/r/json_udf.result b/storage/connect/mysql-test/connect/r/json_udf.result
new file mode 100644
index 00000000000..1455bac9017
--- /dev/null
+++ b/storage/connect/mysql-test/connect/r/json_udf.result
@@ -0,0 +1,167 @@
+#
+# Test UDF's with constant arguments
+#
+SELECT Json_Array();
+Json_Array()
+[]
+SELECT Json_Object(56,3.1416,'foo',NULL);
+Json_Object(56,3.1416,'foo',NULL)
+{"56":56,"3.1416":3.141600,"foo":"foo","NULL":null}
+SELECT Json_Object(56 qty,3.1416 price,'foo' truc, NULL garanty);
+Json_Object(56 qty,3.1416 price,'foo' truc, NULL garanty)
+{"qty":56,"price":3.141600,"truc":"foo","garanty":null}
+SELECT Json_Array(56,3.1416,'My name is "Foo"',NULL);
+Json_Array(56,3.1416,'My name is "Foo"',NULL)
+[56,3.141600,"My name is \"Foo\"",null]
+SELECT Json_Array_Add(Json_Array(56,3.1416,'foo',NULL)) Array;
+ERROR HY000: Can't initialize function 'Json_Array_Add'; Json_Value_Add must have at least 2 arguments
+SELECT Json_Array_Add(Json_Array(56,3.1416,'foo',NULL),'One more') Array;
+Array
+[56,3.141600,"foo",null,"One more"]
+SELECT Json_Array_Add(Json_Value('one value'),'One more');
+Json_Array_Add(Json_Value('one value'),'One more')
+["one value","One more"]
+SELECT Json_Array_Add('one value','One more');
+ERROR HY000: Can't initialize function 'Json_Array_Add'; Json_Value_Add first argument must be a json item
+SELECT Json_Array_Add('one value' json_,'One more');
+Json_Array_Add('one value' json_,'One more')
+[null,"One more"]
+Warnings:
+Warning 1105 Bad 'o' character near one value
+SELECT Json_Value(56,3.1416,'foo',NULL);
+ERROR HY000: Can't initialize function 'Json_Value'; Json_Value cannot accept more than 1 argument
+SELECT Json_Value(3.1416);
+Json_Value(3.1416)
+3.141600
+SELECT Json_Value('foo');
+Json_Value('foo')
+"foo"
+SELECT Json_Value(NULL);
+Json_Value(NULL)
+null
+SELECT Json_Value();
+Json_Value()
+null
+SELECT Json_Object();
+Json_Object()
+{}
+SELECT Json_Object(Json_Array(56,3.1416,'foo'),NULL);
+Json_Object(Json_Array(56,3.1416,'foo'),NULL)
+{"Array(56,3.1416,'foo')":[56,3.141600,"foo"],"NULL":null}
+SELECT Json_Array(Json_Array(56,3.1416,'foo'),NULL);
+Json_Array(Json_Array(56,3.1416,'foo'),NULL)
+[[56,3.141600,"foo"],null]
+SELECT Json_Array(Json_Object(56 "qty",3.1416 "price",'foo'),NULL);
+Json_Array(Json_Object(56 "qty",3.1416 "price",'foo'),NULL)
+[{"qty":56,"price":3.141600,"foo":"foo"},null]
+#
+# Test UDF's with column arguments
+#
+CREATE TABLE t1
+(
+ISBN CHAR(15),
+LANG CHAR(2),
+SUBJECT CHAR(32),
+AUTHOR CHAR(64),
+TITLE CHAR(32),
+TRANSLATION CHAR(32),
+TRANSLATOR CHAR(80),
+PUBLISHER CHAR(32),
+DATEPUB int(4)
+) ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.json';
+SELECT Json_Array(AUTHOR, TITLE, DATEPUB) FROM t1;
+Json_Array(AUTHOR, TITLE, DATEPUB)
+["Jean-Christophe Bernadac","Construire une application XML",1999]
+["William J. Pardi","XML en Action",1999]
+SELECT Json_Object(AUTHOR, TITLE, DATEPUB) FROM t1;
+Json_Object(AUTHOR, TITLE, DATEPUB)
+{"AUTHOR":"Jean-Christophe Bernadac","TITLE":"Construire une application XML","DATEPUB":1999}
+{"AUTHOR":"William J. Pardi","TITLE":"XML en Action","DATEPUB":1999}
+SELECT Json_Array_Grp(TITLE, DATEPUB) FROM t1;
+ERROR HY000: Can't initialize function 'Json_Array_Grp'; Json_Array_Grp can only accept 1 argument
+SELECT Json_Array_Grp(TITLE) FROM t1;
+Json_Array_Grp(TITLE)
+["Construire une application XML","XML en Action"]
+DROP TABLE t1;
+CREATE TABLE t1 (
+SERIALNO CHAR(5) NOT NULL,
+NAME VARCHAR(12) NOT NULL FLAG=6,
+SEX SMALLINT(1) NOT NULL,
+TITLE VARCHAR(15) NOT NULL FLAG=20,
+MANAGER CHAR(5) DEFAULT NULL,
+DEPARTMENT CHAr(4) NOT NULL FLAG=41,
+SECRETARY CHAR(5) DEFAULT NULL FLAG=46,
+SALARY DOUBLE(8,2) NOT NULL FLAG=52
+) ENGINE=CONNECT TABLE_TYPE=FIX BLOCK_SIZE=8 FILE_NAME='employee.dat' ENDING=1;
+SELECT Json_Object(SERIALNO, NAME, TITLE, SALARY) FROM t1 WHERE NAME = 'MERCHANT';
+Json_Object(SERIALNO, NAME, TITLE, SALARY)
+{"SERIALNO":"78943","NAME":"MERCHANT","TITLE":"SALESMAN","SALARY":8700.000000}
+SELECT DEPARTMENT, Json_Array_Grp(NAME) FROM t1 GROUP BY DEPARTMENT;
+DEPARTMENT Json_Array_Grp(NAME)
+0021 ["STRONG","SHORTSIGHT"]
+0318 ["BANCROFT","PLUMHEAD","HONEY","TONGHO","WALTER","SHRINKY","WERTHER","MERCHANT","WHEELFOR"]
+0319 ["BULLOZER","QUINN","BROWNY","KITTY","MONAPENNY","MARTIN","FUNNIGUY","BUGHAPPY","FODDERMAN","MESSIFUL"]
+2452 ["BIGHEAD","ORELLY","BIGHORN","SMITH","CHERRY"]
+Warnings:
+Warning 1105 Result truncated to json_grp_size values
+set connect_json_grp_size=30;
+SELECT Json_Array(DEPARTMENT, Json_Array_Grp(NAME)) FROM t1 GROUP BY DEPARTMENT;
+Json_Array(DEPARTMENT, Json_Array_Grp(NAME))
+["0021",["STRONG","SHORTSIGHT"]]
+["0318",["BANCROFT","PLUMHEAD","HONEY","TONGHO","WALTER","SHRINKY","WERTHER","MERCHANT","WHEELFOR"]]
+["0319",["BULLOZER","QUINN","BROWNY","KITTY","MONAPENNY","MARTIN","FUNNIGUY","BUGHAPPY","FODDERMAN","MESSIFUL","GOOSEPEN"]]
+["2452",["BIGHEAD","ORELLY","BIGHORN","SMITH","CHERRY"]]
+SELECT Json_Object(DEPARTMENT, Json_Array_Grp(NAME) json_NAMES) FROM t1 GROUP BY DEPARTMENT;
+Json_Object(DEPARTMENT, Json_Array_Grp(NAME) json_NAMES)
+{"DEPARTMENT":"0021","NAMES":["STRONG","SHORTSIGHT"]}
+{"DEPARTMENT":"0318","NAMES":["BANCROFT","PLUMHEAD","HONEY","TONGHO","WALTER","SHRINKY","WERTHER","MERCHANT","WHEELFOR"]}
+{"DEPARTMENT":"0319","NAMES":["BULLOZER","QUINN","BROWNY","KITTY","MONAPENNY","MARTIN","FUNNIGUY","BUGHAPPY","FODDERMAN","MESSIFUL","GOOSEPEN"]}
+{"DEPARTMENT":"2452","NAMES":["BIGHEAD","ORELLY","BIGHORN","SMITH","CHERRY"]}
+SELECT Json_Object(DEPARTMENT, Json_Array_Grp(Json_Object(SERIALNO, NAME, TITLE, SALARY)) json_EMPLOYES) FROM t1 GROUP BY DEPARTMENT;
+Json_Object(DEPARTMENT, Json_Array_Grp(Json_Object(SERIALNO, NAME, TITLE, SALARY)) json_EMPLOYES)
+{"DEPARTMENT":"0021","EMPLOYES":[{"SERIALNO":"87777","NAME":"STRONG","TITLE":"DIRECTOR","SALARY":23000.000000},{"SERIALNO":"22222","NAME":"SHORTSIGHT","TITLE":"SECRETARY","SALARY":5500.000000}]}
+{"DEPARTMENT":"0318","EMPLOYES":[{"SERIALNO":"74200","NAME":"BANCROFT","TITLE":"SALESMAN","SALARY":9600.000000},{"SERIALNO":"24888","NAME":"PLUMHEAD","TITLE":"TYPIST","SALARY":2800.000000},{"SERIALNO":"27845","NAME":"HONEY","TITLE":"SECRETARY","SALARY":4900.000000},{"SERIALNO":"73452","NAME":"TONGHO","TITLE":"ENGINEER","SALARY":6800.000000},{"SERIALNO":"74234","NAME":"WALTER","TITLE":"ENGINEER","SALARY":7400.000000},{"SERIALNO":"77777","NAME":"SHRINKY","TITLE":"ADMINISTRATOR","SALARY":7500.000000},{"SERIALNO":"70012","NAME":"WERTHER","TITLE":"DIRECTOR","SALARY":14500.000000},{"SERIALNO":"78943","NAME":"MERCHANT","TITLE":"SALESMAN","SALARY":8700.000000},{"SERIALNO":"73111","NAME":"WHEELFOR","TITLE":"SALESMAN","SALARY":10030.000000}]}
+{"DEPARTMENT":"0319","EMPLOYES":[{"SERIALNO":"76543","NAME":"BULLOZER","TITLE":"SALESMAN","SALARY":14800.000000},{"SERIALNO":"40567","NAME":"QUINN","TITLE":"DIRECTOR","SALARY":14000.000000},{"SERIALNO":"00137","NAME":"BROWNY","TITLE":"ENGINEER","SALARY":10500.000000},{"SERIALNO":"12345","NAME":"KITTY","TITLE":"TYPIST","SALARY":3000.450000},{"SERIALNO":"33333","NAME":"MONAPENNY","TITLE":"SECRETARY","SALARY":3800.000000},{"SERIALNO":"00023","NAME":"MARTIN","TITLE":"ENGINEER","SALARY":10000.000000},{"SERIALNO":"07654","NAME":"FUNNIGUY","TITLE":"ADMINISTRATOR","SALARY":8500.000000},{"SERIALNO":"45678","NAME":"BUGHAPPY","TITLE":"PROGRAMMER","SALARY":8500.000000},{"SERIALNO":"56789","NAME":"FODDERMAN","TITLE":"SALESMAN","SALARY":7000.000000},{"SERIALNO":"55555","NAME":"MESSIFUL","TITLE":"SECRETARY","SALARY":5000.500000},{"SERIALNO":"98765","NAME":"GOOSEPEN","TITLE":"ADMINISTRATOR","SALARY":4700.000000}]}
+{"DEPARTMENT":"2452","EMPLOYES":[{"SERIALNO":"34567","NAME":"BIGHEAD","TITLE":"SCIENTIST","SALARY":8000.000000},{"SERIALNO":"31416","NAME":"ORELLY","TITLE":"ENGINEER","SALARY":13400.000000},{"SERIALNO":"36666","NAME":"BIGHORN","TITLE":"SCIENTIST","SALARY":11000.000000},{"SERIALNO":"02345","NAME":"SMITH","TITLE":"ENGINEER","SALARY":9000.000000},{"SERIALNO":"11111","NAME":"CHERRY","TITLE":"SECRETARY","SALARY":4500.000000}]}
+SELECT Json_Object(DEPARTMENT, TITLE, Json_Array_Grp(Json_Object(SERIALNO, NAME, SALARY)) json_EMPLOYES) FROM t1 GROUP BY DEPARTMENT, TITLE;
+Json_Object(DEPARTMENT, TITLE, Json_Array_Grp(Json_Object(SERIALNO, NAME, SALARY)) json_EMPLOYES)
+{"DEPARTMENT":"0021","TITLE":"DIRECTOR","EMPLOYES":[{"SERIALNO":"87777","NAME":"STRONG","SALARY":23000.000000}]}
+{"DEPARTMENT":"0021","TITLE":"SECRETARY","EMPLOYES":[{"SERIALNO":"22222","NAME":"SHORTSIGHT","SALARY":5500.000000}]}
+{"DEPARTMENT":"0318","TITLE":"ADMINISTRATOR","EMPLOYES":[{"SERIALNO":"77777","NAME":"SHRINKY","SALARY":7500.000000}]}
+{"DEPARTMENT":"0318","TITLE":"DIRECTOR","EMPLOYES":[{"SERIALNO":"70012","NAME":"WERTHER","SALARY":14500.000000}]}
+{"DEPARTMENT":"0318","TITLE":"ENGINEER","EMPLOYES":[{"SERIALNO":"73452","NAME":"TONGHO","SALARY":6800.000000},{"SERIALNO":"74234","NAME":"WALTER","SALARY":7400.000000}]}
+{"DEPARTMENT":"0318","TITLE":"SALESMAN","EMPLOYES":[{"SERIALNO":"74200","NAME":"BANCROFT","SALARY":9600.000000},{"SERIALNO":"78943","NAME":"MERCHANT","SALARY":8700.000000},{"SERIALNO":"73111","NAME":"WHEELFOR","SALARY":10030.000000}]}
+{"DEPARTMENT":"0318","TITLE":"SECRETARY","EMPLOYES":[{"SERIALNO":"27845","NAME":"HONEY","SALARY":4900.000000}]}
+{"DEPARTMENT":"0318","TITLE":"TYPIST","EMPLOYES":[{"SERIALNO":"24888","NAME":"PLUMHEAD","SALARY":2800.000000}]}
+{"DEPARTMENT":"0319","TITLE":"ADMINISTRATOR","EMPLOYES":[{"SERIALNO":"98765","NAME":"GOOSEPEN","SALARY":4700.000000},{"SERIALNO":"07654","NAME":"FUNNIGUY","SALARY":8500.000000}]}
+{"DEPARTMENT":"0319","TITLE":"DIRECTOR","EMPLOYES":[{"SERIALNO":"40567","NAME":"QUINN","SALARY":14000.000000}]}
+{"DEPARTMENT":"0319","TITLE":"ENGINEER","EMPLOYES":[{"SERIALNO":"00023","NAME":"MARTIN","SALARY":10000.000000},{"SERIALNO":"00137","NAME":"BROWNY","SALARY":10500.000000}]}
+{"DEPARTMENT":"0319","TITLE":"PROGRAMMER","EMPLOYES":[{"SERIALNO":"45678","NAME":"BUGHAPPY","SALARY":8500.000000}]}
+{"DEPARTMENT":"0319","TITLE":"SALESMAN","EMPLOYES":[{"SERIALNO":"76543","NAME":"BULLOZER","SALARY":14800.000000},{"SERIALNO":"56789","NAME":"FODDERMAN","SALARY":7000.000000}]}
+{"DEPARTMENT":"0319","TITLE":"SECRETARY","EMPLOYES":[{"SERIALNO":"33333","NAME":"MONAPENNY","SALARY":3800.000000},{"SERIALNO":"55555","NAME":"MESSIFUL","SALARY":5000.500000}]}
+{"DEPARTMENT":"0319","TITLE":"TYPIST","EMPLOYES":[{"SERIALNO":"12345","NAME":"KITTY","SALARY":3000.450000}]}
+{"DEPARTMENT":"2452","TITLE":"ENGINEER","EMPLOYES":[{"SERIALNO":"31416","NAME":"ORELLY","SALARY":13400.000000},{"SERIALNO":"02345","NAME":"SMITH","SALARY":9000.000000}]}
+{"DEPARTMENT":"2452","TITLE":"SCIENTIST","EMPLOYES":[{"SERIALNO":"34567","NAME":"BIGHEAD","SALARY":8000.000000},{"SERIALNO":"36666","NAME":"BIGHORN","SALARY":11000.000000}]}
+{"DEPARTMENT":"2452","TITLE":"SECRETARY","EMPLOYES":[{"SERIALNO":"11111","NAME":"CHERRY","SALARY":4500.000000}]}
+SELECT Json_Object_Grp(SALARY) FROM t1;
+ERROR HY000: Can't initialize function 'Json_Object_Grp'; Json_Array_Grp can only accept 2 arguments
+SELECT Json_Object_Grp(SALARY, NAME) FROM t1;
+Json_Object_Grp(SALARY, NAME)
+{"BANCROFT":9600.000000,"SMITH":9000.000000,"MERCHANT":8700.000000,"FUNNIGUY":8500.000000,"BUGHAPPY":8500.000000,"BIGHEAD":8000.000000,"SHRINKY":7500.000000,"WALTER":7400.000000,"FODDERMAN":7000.000000,"TONGHO":6800.000000,"SHORTSIGHT":5500.000000,"MESSIFUL":5000.500000,"HONEY":4900.000000,"GOOSEPEN":4700.000000,"CHERRY":4500.000000,"MONAPENNY":3800.000000,"KITTY":3000.450000,"PLUMHEAD":2800.000000,"STRONG":23000.000000,"BULLOZER":14800.000000,"WERTHER":14500.000000,"QUINN":14000.000000,"ORELLY":13400.000000,"BIGHORN":11000.000000,"BROWNY":10500.000000,"WHEELFOR":10030.000000,"MARTIN":10000.000000}
+SELECT Json_Object(DEPARTMENT, Json_Object_Grp(SALARY, NAME) "Json_SALARIES") FROM t1 GROUP BY DEPARTMENT;
+Json_Object(DEPARTMENT, Json_Object_Grp(SALARY, NAME) "Json_SALARIES")
+{"DEPARTMENT":"0021","SALARIES":{"STRONG":23000.000000,"SHORTSIGHT":5500.000000}}
+{"DEPARTMENT":"0318","SALARIES":{"BANCROFT":9600.000000,"PLUMHEAD":2800.000000,"HONEY":4900.000000,"TONGHO":6800.000000,"WALTER":7400.000000,"SHRINKY":7500.000000,"WERTHER":14500.000000,"MERCHANT":8700.000000,"WHEELFOR":10030.000000}}
+{"DEPARTMENT":"0319","SALARIES":{"BULLOZER":14800.000000,"QUINN":14000.000000,"BROWNY":10500.000000,"KITTY":3000.450000,"MONAPENNY":3800.000000,"MARTIN":10000.000000,"FUNNIGUY":8500.000000,"BUGHAPPY":8500.000000,"FODDERMAN":7000.000000,"MESSIFUL":5000.500000,"GOOSEPEN":4700.000000}}
+{"DEPARTMENT":"2452","SALARIES":{"BIGHEAD":8000.000000,"ORELLY":13400.000000,"BIGHORN":11000.000000,"SMITH":9000.000000,"CHERRY":4500.000000}}
+SELECT Json_Array_Grp(NAME) from t1;
+Json_Array_Grp(NAME)
+["BANCROFT","SMITH","MERCHANT","FUNNIGUY","BUGHAPPY","BIGHEAD","SHRINKY","WALTER","FODDERMAN","TONGHO","SHORTSIGHT","MESSIFUL","HONEY","GOOSEPEN","CHERRY","MONAPENNY","KITTY","PLUMHEAD","STRONG","BULLOZER","WERTHER","QUINN","ORELLY","BIGHORN","BROWNY","WHEELFOR","MARTIN"]
+DROP TABLE t1;
+DROP FUNCTION Json_Array;
+DROP FUNCTION Json_Array_Add;
+DROP FUNCTION Json_Object;
+DROP FUNCTION Json_Object_Nonull;
+DROP FUNCTION Json_Value;
+DROP FUNCTION Json_Array_Grp;
+DROP FUNCTION Json_Object_Grp;
diff --git a/storage/connect/mysql-test/connect/r/odbc_oracle.result b/storage/connect/mysql-test/connect/r/odbc_oracle.result
index fff2f192184..96d8e53b8e5 100644
--- a/storage/connect/mysql-test/connect/r/odbc_oracle.result
+++ b/storage/connect/mysql-test/connect/r/odbc_oracle.result
@@ -126,7 +126,7 @@ TABNAME='T1';
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `A` decimal(38,0) DEFAULT NULL,
+ `A` decimal(40,0) DEFAULT NULL,
`B` double(40,0) DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='DSN=ConnectEngineOracle;UID=mtr;PWD=mtr' `TABLE_TYPE`='ODBC' `TABNAME`='T1'
SELECT * FROM t1 ORDER BY A;
@@ -138,7 +138,7 @@ CREATE TABLE t2 AS SELECT * FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `A` decimal(38,0) DEFAULT NULL,
+ `A` decimal(40,0) DEFAULT NULL,
`B` double(40,0) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t2;
@@ -162,7 +162,7 @@ TABNAME='MTR.T1';
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `A` decimal(38,0) DEFAULT NULL,
+ `A` decimal(40,0) DEFAULT NULL,
`B` double(40,0) DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='DSN=ConnectEngineOracle;UID=mtr;PWD=mtr' `TABLE_TYPE`='ODBC' `TABNAME`='MTR.T1'
SELECT * FROM t1;
@@ -178,7 +178,7 @@ TABNAME='MTR.V1';
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `A` decimal(38,0) DEFAULT NULL,
+ `A` decimal(40,0) DEFAULT NULL,
`B` double(40,0) DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='DSN=ConnectEngineOracle;UID=mtr;PWD=mtr' `TABLE_TYPE`='ODBC' `TABNAME`='MTR.V1'
SELECT * FROM t1;
@@ -190,7 +190,7 @@ CREATE TABLE t2 AS SELECT * FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `A` decimal(38,0) DEFAULT NULL,
+ `A` decimal(40,0) DEFAULT NULL,
`B` double(40,0) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t2;
diff --git a/storage/connect/mysql-test/connect/r/xml_html.result b/storage/connect/mysql-test/connect/r/xml_html.result
new file mode 100644
index 00000000000..143f46529f6
--- /dev/null
+++ b/storage/connect/mysql-test/connect/r/xml_html.result
@@ -0,0 +1,32 @@
+Warnings:
+Warning 1105 No file name. Table will use t1.xml
+SET NAMES utf8;
+#
+# Testing HTML like XML file
+#
+CREATE TABLE beers (
+`Name` CHAR(16) FIELD_FORMAT='brandName',
+`Origin` CHAR(16) FIELD_FORMAT='origin',
+`Description` CHAR(32) FIELD_FORMAT='details')
+ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='beers.xml'
+TABNAME='table' OPTION_LIST='xmlsup=libxml2,rownode=tr,colnode=td';
+SELECT * FROM beers;
+Name Origin Description
+Huntsman Bath, UK Wonderful hop, light alcohol
+Tuborg Danmark In small bottles
+DROP TABLE beers;
+#
+# Testing HTML file
+#
+CREATE TABLE coffee (
+`Name` CHAR(16),
+`Cups` INT(8),
+`Type` CHAR(16),
+`Sugar` CHAR(4))
+ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='coffee.htm'
+TABNAME='TABLE' HEADER=1 OPTION_LIST='xmlsup=libxml2,Coltype=HTML';
+SELECT * FROM coffee;
+Name Cups Type Sugar
+T. Sexton 10 Espresso No
+J. Dinnen 5 Decaf Yes
+DROP TABLE coffee;
diff --git a/storage/connect/mysql-test/connect/std_data/beers.xml b/storage/connect/mysql-test/connect/std_data/beers.xml
new file mode 100644
index 00000000000..1abc77fe0f9
--- /dev/null
+++ b/storage/connect/mysql-test/connect/std_data/beers.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<Beers>
+ <table>
+ <th><td>Name</td><td>Origin</td><td>Description</td></th>
+ <tr>
+ <td><brandName>Huntsman</brandName></td>
+ <td><origin>Bath, UK</origin></td>
+ <td><details>Wonderful hop, light alcohol</details></td>
+ </tr>
+ <tr>
+ <td><brandName>Tuborg</brandName></td>
+ <td><origin>Danmark</origin></td>
+ <td><details>In small bottles</details></td>
+ </tr>
+ </table>
+</Beers>
diff --git a/storage/connect/mysql-test/connect/std_data/biblio.jsn b/storage/connect/mysql-test/connect/std_data/biblio.json
index bab8fd24305..cc24b162cd9 100644
--- a/storage/connect/mysql-test/connect/std_data/biblio.jsn
+++ b/storage/connect/mysql-test/connect/std_data/biblio.json
@@ -1,45 +1,45 @@
-[
- {
- "ISBN": "9782212090819",
- "LANG": "fr",
- "SUBJECT": "applications",
- "AUTHOR": [
- {
- "FIRSTNAME": "Jean-Christophe",
- "LASTNAME": "Bernadac"
- },
- {
- "FIRSTNAME": "François",
- "LASTNAME": "Knab"
- }
- ],
- "TITLE": "Construire une application XML",
- "PUBLISHER": {
- "NAME": "Eyrolles",
- "PLACE": "Paris"
- },
- "DATEPUB": 1999
- },
- {
- "ISBN": "9782840825685",
- "LANG": "fr",
- "SUBJECT": "applications",
- "AUTHOR": [
- {
- "FIRSTNAME": "William J.",
- "LASTNAME": "Pardi"
- }
- ],
- "TITLE": "XML en Action",
- "TRANSLATION": "adapté de l'anglais par",
- "TRANSLATOR": {
- "FIRSTNAME": "James",
- "LASTNAME": "Guerin"
- },
- "PUBLISHER": {
- "NAME": "Microsoft Press",
- "PLACE": "Paris"
- },
- "DATEPUB": 1999
- }
-]
+[
+ {
+ "ISBN": "9782212090819",
+ "LANG": "fr",
+ "SUBJECT": "applications",
+ "AUTHOR": [
+ {
+ "FIRSTNAME": "Jean-Christophe",
+ "LASTNAME": "Bernadac"
+ },
+ {
+ "FIRSTNAME": "François",
+ "LASTNAME": "Knab"
+ }
+ ],
+ "TITLE": "Construire une application XML",
+ "PUBLISHER": {
+ "NAME": "Eyrolles",
+ "PLACE": "Paris"
+ },
+ "DATEPUB": 1999
+ },
+ {
+ "ISBN": "9782840825685",
+ "LANG": "fr",
+ "SUBJECT": "applications",
+ "AUTHOR": [
+ {
+ "FIRSTNAME": "William J.",
+ "LASTNAME": "Pardi"
+ }
+ ],
+ "TITLE": "XML en Action",
+ "TRANSLATION": "adapté de l'anglais par",
+ "TRANSLATOR": {
+ "FIRSTNAME": "James",
+ "LASTNAME": "Guerin"
+ },
+ "PUBLISHER": {
+ "NAME": "Microsoft Press",
+ "PLACE": "Paris"
+ },
+ "DATEPUB": 1999
+ }
+]
diff --git a/storage/connect/mysql-test/connect/std_data/bookstore.xml b/storage/connect/mysql-test/connect/std_data/bookstore.xml
index 0aebbcd243e..540fa5409f4 100644
--- a/storage/connect/mysql-test/connect/std_data/bookstore.xml
+++ b/storage/connect/mysql-test/connect/std_data/bookstore.xml
@@ -1,31 +1,31 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<bookstore>
- <book category="COOKING">
- <title lang="en">Everyday Italian</title>
- <author>Giada De Laurentiis</author>
- <year>2005</year>
- <price>30.00</price>
- </book>
- <book category="CHILDREN">
- <title lang="en">Harry Potter</title>
- <author>J K. Rowling</author>
- <year>2005</year>
- <price>29.99</price>
- </book>
- <book category="WEB">
- <title lang="en">XQuery Kick Start</title>
- <author>James McGovern</author>
- <author>Per Bothner</author>
- <author>Kurt Cagle</author>
- <author>James Linn</author>
- <author>Vaidyanathan Nagarajan</author>
- <year>2003</year>
- <price>49.99</price>
- </book>
- <book category="WEB">
- <title lang="en">Learning XML</title>
- <author>Erik T. Ray</author>
- <year>2003</year>
- <price>39.95</price>
- </book>
-</bookstore>
+<?xml version="1.0" encoding="UTF-8"?>
+<bookstore>
+ <book category="COOKING">
+ <title lang="en">Everyday Italian</title>
+ <author>Giada De Laurentiis</author>
+ <year>2005</year>
+ <price>30.00</price>
+ </book>
+ <book category="CHILDREN">
+ <title lang="en">Harry Potter</title>
+ <author>J K. Rowling</author>
+ <year>2005</year>
+ <price>29.99</price>
+ </book>
+ <book category="WEB">
+ <title lang="en">XQuery Kick Start</title>
+ <author>James McGovern</author>
+ <author>Per Bothner</author>
+ <author>Kurt Cagle</author>
+ <author>James Linn</author>
+ <author>Vaidyanathan Nagarajan</author>
+ <year>2003</year>
+ <price>49.99</price>
+ </book>
+ <book category="WEB">
+ <title lang="en">Learning XML</title>
+ <author>Erik T. Ray</author>
+ <year>2003</year>
+ <price>39.95</price>
+ </book>
+</bookstore>
diff --git a/storage/connect/mysql-test/connect/std_data/coffee.htm b/storage/connect/mysql-test/connect/std_data/coffee.htm
new file mode 100644
index 00000000000..95a23d5c0ad
--- /dev/null
+++ b/storage/connect/mysql-test/connect/std_data/coffee.htm
@@ -0,0 +1,24 @@
+<TABLE summary="This table charts the number of cups of coffe
+ consumed by each senator, the type of coffee (decaf
+ or regular), and whether taken with sugar.">
+ <CAPTION>Cups of coffee consumed by each senator</CAPTION>
+ <TR>
+ <TH>Name</TH>
+ <TH>Cups</TH>
+ <TH>Type of Coffee</TH>
+ <TH>Sugar?</TH>
+ </TR>
+ <TR>
+ <TD>T. Sexton</TD>
+ <TD>10</TD>
+ <TD>Espresso</TD>
+ <TD>No</TD>
+ </TR>
+ <TR>
+ <TD>J. Dinnen</TD>
+ <TD>5</TD>
+ <TD>Decaf</TD>
+ <TD>Yes</TD>
+ </TR>
+</TABLE>
+
diff --git a/storage/connect/mysql-test/connect/std_data/expense.jsn b/storage/connect/mysql-test/connect/std_data/expense.json
index e65ad5261f1..f9373ef1a80 100644
--- a/storage/connect/mysql-test/connect/std_data/expense.jsn
+++ b/storage/connect/mysql-test/connect/std_data/expense.json
@@ -1,158 +1,158 @@
-[
- {
- "WHO": "Joe",
- "WEEK": [
- {
- "NUMBER": 3,
- "EXPENSE": [
- {
- "WHAT": "Beer",
- "AMOUNT": 18.00
- },
- {
- "WHAT": "Food",
- "AMOUNT": 12.00
- },
- {
- "WHAT": "Food",
- "AMOUNT": 19.00
- },
- {
- "WHAT": "Car",
- "AMOUNT": 20.00
- }
- ]
- },
- {
- "NUMBER": 4,
- "EXPENSE": [
- {
- "WHAT": "Beer",
- "AMOUNT": 19.00
- },
- {
- "WHAT": "Beer",
- "AMOUNT": 16.00
- },
- {
- "WHAT": "Food",
- "AMOUNT": 17.00
- },
- {
- "WHAT": "Food",
- "AMOUNT": 17.00
- },
- {
- "WHAT": "Beer",
- "AMOUNT": 14.00
- }
- ]
- },
- {
- "NUMBER": 5,
- "EXPENSE": [
- {
- "WHAT": "Beer",
- "AMOUNT": 14.00
- },
- {
- "WHAT": "Food",
- "AMOUNT": 12.00
- }
- ]
- }
- ]
- },
- {
- "WHO": "Beth",
- "WEEK": [
- {
- "NUMBER": 3,
- "EXPENSE": [
- {
- "WHAT": "Beer",
- "AMOUNT": 16.00
- }
- ]
- },
- {
- "NUMBER": 4,
- "EXPENSE": [
- {
- "WHAT": "Food",
- "AMOUNT": 17.00
- },
- {
- "WHAT": "Beer",
- "AMOUNT": 15.00
- }
- ]
- },
- {
- "NUMBER": 5,
- "EXPENSE": [
- {
- "WHAT": "Food",
- "AMOUNT": 12.00
- },
- {
- "WHAT": "Beer",
- "AMOUNT": 20.00
- }
- ]
- }
- ]
- },
- {
- "WHO": "Janet",
- "WEEK": [
- {
- "NUMBER": 3,
- "EXPENSE": [
- {
- "WHAT": "Car",
- "AMOUNT": 19.00
- },
- {
- "WHAT": "Food",
- "AMOUNT": 18.00
- },
- {
- "WHAT": "Beer",
- "AMOUNT": 18.00
- }
- ]
- },
- {
- "NUMBER": 4,
- "EXPENSE": [
- {
- "WHAT": "Car",
- "AMOUNT": 17.00
- }
- ]
- },
- {
- "NUMBER": 5,
- "EXPENSE": [
- {
- "WHAT": "Beer",
- "AMOUNT": 14.00
- },
- {
- "WHAT": "Car",
- "AMOUNT": 12.00
- },
- {
- "WHAT": "Beer",
- "AMOUNT": 19.00
- },
- {
- "WHAT": "Food",
- "AMOUNT": 12.00
- }
- ]
- }
- ]
- }
-]
+[
+ {
+ "WHO": "Joe",
+ "WEEK": [
+ {
+ "NUMBER": 3,
+ "EXPENSE": [
+ {
+ "WHAT": "Beer",
+ "AMOUNT": 18.00
+ },
+ {
+ "WHAT": "Food",
+ "AMOUNT": 12.00
+ },
+ {
+ "WHAT": "Food",
+ "AMOUNT": 19.00
+ },
+ {
+ "WHAT": "Car",
+ "AMOUNT": 20.00
+ }
+ ]
+ },
+ {
+ "NUMBER": 4,
+ "EXPENSE": [
+ {
+ "WHAT": "Beer",
+ "AMOUNT": 19.00
+ },
+ {
+ "WHAT": "Beer",
+ "AMOUNT": 16.00
+ },
+ {
+ "WHAT": "Food",
+ "AMOUNT": 17.00
+ },
+ {
+ "WHAT": "Food",
+ "AMOUNT": 17.00
+ },
+ {
+ "WHAT": "Beer",
+ "AMOUNT": 14.00
+ }
+ ]
+ },
+ {
+ "NUMBER": 5,
+ "EXPENSE": [
+ {
+ "WHAT": "Beer",
+ "AMOUNT": 14.00
+ },
+ {
+ "WHAT": "Food",
+ "AMOUNT": 12.00
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "WHO": "Beth",
+ "WEEK": [
+ {
+ "NUMBER": 3,
+ "EXPENSE": [
+ {
+ "WHAT": "Beer",
+ "AMOUNT": 16.00
+ }
+ ]
+ },
+ {
+ "NUMBER": 4,
+ "EXPENSE": [
+ {
+ "WHAT": "Food",
+ "AMOUNT": 17.00
+ },
+ {
+ "WHAT": "Beer",
+ "AMOUNT": 15.00
+ }
+ ]
+ },
+ {
+ "NUMBER": 5,
+ "EXPENSE": [
+ {
+ "WHAT": "Food",
+ "AMOUNT": 12.00
+ },
+ {
+ "WHAT": "Beer",
+ "AMOUNT": 20.00
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "WHO": "Janet",
+ "WEEK": [
+ {
+ "NUMBER": 3,
+ "EXPENSE": [
+ {
+ "WHAT": "Car",
+ "AMOUNT": 19.00
+ },
+ {
+ "WHAT": "Food",
+ "AMOUNT": 18.00
+ },
+ {
+ "WHAT": "Beer",
+ "AMOUNT": 18.00
+ }
+ ]
+ },
+ {
+ "NUMBER": 4,
+ "EXPENSE": [
+ {
+ "WHAT": "Car",
+ "AMOUNT": 17.00
+ }
+ ]
+ },
+ {
+ "NUMBER": 5,
+ "EXPENSE": [
+ {
+ "WHAT": "Beer",
+ "AMOUNT": 14.00
+ },
+ {
+ "WHAT": "Car",
+ "AMOUNT": 12.00
+ },
+ {
+ "WHAT": "Beer",
+ "AMOUNT": 19.00
+ },
+ {
+ "WHAT": "Food",
+ "AMOUNT": 12.00
+ }
+ ]
+ }
+ ]
+ }
+]
diff --git a/storage/connect/mysql-test/connect/std_data/mulexp3.jsn b/storage/connect/mysql-test/connect/std_data/mulexp3.json
index c228448b073..5edd2ab1e76 100644
--- a/storage/connect/mysql-test/connect/std_data/mulexp3.jsn
+++ b/storage/connect/mysql-test/connect/std_data/mulexp3.json
@@ -1,52 +1,52 @@
-[
- {
- "WHO": "Joe",
- "WEEK": 3,
- "EXPENSE": [
- {
- "WHAT": "Beer",
- "AMOUNT": 18.00
- },
- {
- "WHAT": "Food",
- "AMOUNT": 12.00
- },
- {
- "WHAT": "Food",
- "AMOUNT": 19.00
- },
- {
- "WHAT": "Car",
- "AMOUNT": 20.00
- }
- ]
- },
- {
- "WHO": "Beth",
- "WEEK": 3,
- "EXPENSE": [
- {
- "WHAT": "Beer",
- "AMOUNT": 16.00
- }
- ]
- },
- {
- "WHO": "Janet",
- "WEEK": 3,
- "EXPENSE": [
- {
- "WHAT": "Car",
- "AMOUNT": 19.00
- },
- {
- "WHAT": "Food",
- "AMOUNT": 18.00
- },
- {
- "WHAT": "Beer",
- "AMOUNT": 18.00
- }
- ]
- }
-]
+[
+ {
+ "WHO": "Joe",
+ "WEEK": 3,
+ "EXPENSE": [
+ {
+ "WHAT": "Beer",
+ "AMOUNT": 18.00
+ },
+ {
+ "WHAT": "Food",
+ "AMOUNT": 12.00
+ },
+ {
+ "WHAT": "Food",
+ "AMOUNT": 19.00
+ },
+ {
+ "WHAT": "Car",
+ "AMOUNT": 20.00
+ }
+ ]
+ },
+ {
+ "WHO": "Beth",
+ "WEEK": 3,
+ "EXPENSE": [
+ {
+ "WHAT": "Beer",
+ "AMOUNT": 16.00
+ }
+ ]
+ },
+ {
+ "WHO": "Janet",
+ "WEEK": 3,
+ "EXPENSE": [
+ {
+ "WHAT": "Car",
+ "AMOUNT": 19.00
+ },
+ {
+ "WHAT": "Food",
+ "AMOUNT": 18.00
+ },
+ {
+ "WHAT": "Beer",
+ "AMOUNT": 18.00
+ }
+ ]
+ }
+]
diff --git a/storage/connect/mysql-test/connect/std_data/mulexp4.jsn b/storage/connect/mysql-test/connect/std_data/mulexp4.json
index 0e43ffec07b..7f7b88d6afd 100644
--- a/storage/connect/mysql-test/connect/std_data/mulexp4.jsn
+++ b/storage/connect/mysql-test/connect/std_data/mulexp4.json
@@ -1,52 +1,52 @@
-[
- {
- "WHO": "Joe",
- "WEEK": 4,
- "EXPENSE": [
- {
- "WHAT": "Beer",
- "AMOUNT": 19.00
- },
- {
- "WHAT": "Beer",
- "AMOUNT": 16.00
- },
- {
- "WHAT": "Food",
- "AMOUNT": 17.00
- },
- {
- "WHAT": "Food",
- "AMOUNT": 17.00
- },
- {
- "WHAT": "Beer",
- "AMOUNT": 14.00
- }
- ]
- },
- {
- "WHO": "Beth",
- "WEEK": 4,
- "EXPENSE": [
- {
- "WHAT": "Food",
- "AMOUNT": 17.00
- },
- {
- "WHAT": "Beer",
- "AMOUNT": 15.00
- }
- ]
- },
- {
- "WHO": "Janet",
- "WEEK": 4,
- "EXPENSE": [
- {
- "WHAT": "Car",
- "AMOUNT": 17.00
- }
- ]
- }
-]
+[
+ {
+ "WHO": "Joe",
+ "WEEK": 4,
+ "EXPENSE": [
+ {
+ "WHAT": "Beer",
+ "AMOUNT": 19.00
+ },
+ {
+ "WHAT": "Beer",
+ "AMOUNT": 16.00
+ },
+ {
+ "WHAT": "Food",
+ "AMOUNT": 17.00
+ },
+ {
+ "WHAT": "Food",
+ "AMOUNT": 17.00
+ },
+ {
+ "WHAT": "Beer",
+ "AMOUNT": 14.00
+ }
+ ]
+ },
+ {
+ "WHO": "Beth",
+ "WEEK": 4,
+ "EXPENSE": [
+ {
+ "WHAT": "Food",
+ "AMOUNT": 17.00
+ },
+ {
+ "WHAT": "Beer",
+ "AMOUNT": 15.00
+ }
+ ]
+ },
+ {
+ "WHO": "Janet",
+ "WEEK": 4,
+ "EXPENSE": [
+ {
+ "WHAT": "Car",
+ "AMOUNT": 17.00
+ }
+ ]
+ }
+]
diff --git a/storage/connect/mysql-test/connect/std_data/mulexp5.jsn b/storage/connect/mysql-test/connect/std_data/mulexp5.json
index 7a707506c2f..b1713040c4b 100644
--- a/storage/connect/mysql-test/connect/std_data/mulexp5.jsn
+++ b/storage/connect/mysql-test/connect/std_data/mulexp5.json
@@ -1,52 +1,52 @@
-[
- {
- "WHO": "Joe",
- "WEEK": 5,
- "EXPENSE": [
- {
- "WHAT": "Beer",
- "AMOUNT": 14.00
- },
- {
- "WHAT": "Food",
- "AMOUNT": 12.00
- }
- ]
- },
- {
- "WHO": "Beth",
- "WEEK": 5,
- "EXPENSE": [
- {
- "WHAT": "Food",
- "AMOUNT": 12.00
- },
- {
- "WHAT": "Beer",
- "AMOUNT": 20.00
- }
- ]
- },
- {
- "WHO": "Janet",
- "WEEK": 5,
- "EXPENSE": [
- {
- "WHAT": "Beer",
- "AMOUNT": 14.00
- },
- {
- "WHAT": "Car",
- "AMOUNT": 12.00
- },
- {
- "WHAT": "Beer",
- "AMOUNT": 19.00
- },
- {
- "WHAT": "Food",
- "AMOUNT": 12.00
- }
- ]
- }
-]
+[
+ {
+ "WHO": "Joe",
+ "WEEK": 5,
+ "EXPENSE": [
+ {
+ "WHAT": "Beer",
+ "AMOUNT": 14.00
+ },
+ {
+ "WHAT": "Food",
+ "AMOUNT": 12.00
+ }
+ ]
+ },
+ {
+ "WHO": "Beth",
+ "WEEK": 5,
+ "EXPENSE": [
+ {
+ "WHAT": "Food",
+ "AMOUNT": 12.00
+ },
+ {
+ "WHAT": "Beer",
+ "AMOUNT": 20.00
+ }
+ ]
+ },
+ {
+ "WHO": "Janet",
+ "WEEK": 5,
+ "EXPENSE": [
+ {
+ "WHAT": "Beer",
+ "AMOUNT": 14.00
+ },
+ {
+ "WHAT": "Car",
+ "AMOUNT": 12.00
+ },
+ {
+ "WHAT": "Beer",
+ "AMOUNT": 19.00
+ },
+ {
+ "WHAT": "Food",
+ "AMOUNT": 12.00
+ }
+ ]
+ }
+]
diff --git a/storage/connect/mysql-test/connect/std_data/sexe.csv b/storage/connect/mysql-test/connect/std_data/sexe.csv
index 37d63169133..7e5d3ec93cd 100644
--- a/storage/connect/mysql-test/connect/std_data/sexe.csv
+++ b/storage/connect/mysql-test/connect/std_data/sexe.csv
@@ -1,3 +1,3 @@
-0;Inconnu
-1;Masculin
-2;Feminin
+0;Inconnu
+1;Masculin
+2;Feminin
diff --git a/storage/connect/mysql-test/connect/std_data/sitmat.csv b/storage/connect/mysql-test/connect/std_data/sitmat.csv
index e93f121a839..a5178ed2c76 100644
--- a/storage/connect/mysql-test/connect/std_data/sitmat.csv
+++ b/storage/connect/mysql-test/connect/std_data/sitmat.csv
@@ -1,7 +1,7 @@
-.;Inconnu
-C;Celibataire
-D;Divorce
-L;Union libre
-M;Marie
-S;Separe
-V;Veuf
+.;Inconnu
+C;Celibataire
+D;Divorce
+L;Union libre
+M;Marie
+S;Separe
+V;Veuf
diff --git a/storage/connect/mysql-test/connect/t/alter.test b/storage/connect/mysql-test/connect/t/alter.test
index 49f34996bbd..0eda6355027 100644
--- a/storage/connect/mysql-test/connect/t/alter.test
+++ b/storage/connect/mysql-test/connect/t/alter.test
@@ -1,139 +1,139 @@
-let $MYSQLD_DATADIR= `select @@datadir`;
-
---echo #
---echo # Testing indexing with ALTER on inward table (in-place)
---echo #
-CREATE TABLE t1 (c INT NOT NULL, d CHAR(10) NOT NULL) ENGINE=CONNECT;
-INSERT INTO t1 VALUES (1,'One'), (2,'Two'), (3,'Three');
-SELECT * FROM t1;
-CREATE INDEX xc ON t1(c);
-DESCRIBE SELECT * FROM t1 WHERE c = 2;
-DROP INDEX xc ON t1;
-CREATE INDEX xd ON t1(d);
-DROP INDEX xd ON t1;
-ALTER TABLE t1 ADD INDEX xc (c), ADD INDEX xd (d);
-SHOW INDEX FROM t1;
-ALTER TABLE t1 DROP INDEX xc, DROP INDEX xd;
-SHOW INDEX FROM t1;
-
---echo #
---echo # Testing modifying columns inward table (not in-place)
---echo #
-ALTER TABLE t1 MODIFY COLUMN c CHAR(5) NOT NULL;
-SHOW CREATE TABLE t1;
-SELECT * FROM t1;
-ALTER TABLE t1 MODIFY COLUMN c INT NOT NULL;
-
---echo #
---echo # Fails because indexing must be in-place
---echo #
---error ER_ALTER_OPERATION_NOT_SUPPORTED
-ALTER TABLE t1 MODIFY COLUMN c CHAR(10) NOT NULL, ADD INDEX xd (d);
-
---echo #
---echo # Testing changing table type (not in-place)
---echo #
-ALTER TABLE t1 TABLE_TYPE=CSV HEADER=1 QUOTED=1;
-SELECT * FROM t1;
-SHOW CREATE TABLE t1;
-
---echo # create an outward table used to see the t1 file
-CREATE TABLE t2 (line VARCHAR(100) NOT NULL) ENGINE=CONNECT FILE_NAME='t1.csv';
-SELECT * FROM t2;
-
---echo #
---echo # Testing changing engine
---echo #
-DROP TABLE t1;
-CREATE TABLE t1 (c INT NOT NULL, d CHAR(10) NOT NULL) ENGINE=CONNECT;
-INSERT INTO t1 VALUES (1,'One'), (2,'Two'), (3,'Three');
-ALTER TABLE t1 ADD INDEX xc (c), ADD INDEX xd (d);
-ALTER TABLE t1 ENGINE = MYISAM;
-SHOW CREATE TABLE t1;
-SHOW INDEX FROM t1;
-SELECT * FROM t1;
-ALTER TABLE t1 ENGINE = CONNECT TABLE_TYPE=DBF;
-SHOW CREATE TABLE t1;
-SHOW INDEX FROM t1;
-SELECT * FROM t1;
-DROP TABLE t1, t2;
-
---echo #
---echo # Testing ALTER on outward tables
---echo #
-CREATE TABLE t1 (c INT NOT NULL, d CHAR(10) NOT NULL) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='tf1.txt' ENDING=1;
-INSERT INTO t1 VALUES (1,'One'), (2,'Two'), (3,'Three');
-SELECT * FROM t1;
-CREATE TABLE t2 (line VARCHAR(100) NOT NULL) ENGINE=CONNECT FILE_NAME='tf1.txt';
-SELECT * FROM t2;
-
---echo #
---echo # Indexing works the same
---echo #
-ALTER TABLE t1 ADD INDEX xc (c), ADD INDEX xd (d);
-SHOW INDEX FROM t1;
-SELECT d FROM t1 WHERE c = 2;
-ALTER TABLE t1 DROP INDEX xc, DROP INDEX xd;
-SHOW INDEX FROM t1;
-
---echo #
---echo # Other alterations do not modify the file
---echo #
-ALTER TABLE t1 MODIFY COLUMN c CHAR(5) NOT NULL;
-SELECT * FROM t2;
-SHOW CREATE TABLE t1;
-#Wrong result
---error ER_GET_ERRMSG
-SELECT * FROM t1;
-ALTER TABLE t1 MODIFY COLUMN c INT NOT NULL;
-
---echo #
---echo # Changing column order
---echo #
-ALTER TABLE t1 MODIFY COLUMN c INT NOT NULL AFTER d;
-SELECT * FROM t2;
-SHOW CREATE TABLE t1;
---echo # Wrong result
-SELECT * FROM t1;
-ALTER TABLE t1 MODIFY COLUMN c INT NOT NULL FIRST;
---echo # What should have been done
-ALTER TABLE t1 MODIFY c INT NOT NULL FLAG=0 AFTER d, MODIFY d CHAR(10) NOT NULL FLAG=11;
-SHOW CREATE TABLE t1;
-SELECT * FROM t1;
-
---echo #
---echo # Changing to another engine is Ok
---echo # However, the data file is not deleted.
---echo #
-ALTER TABLE t1 ENGINE=ARIA;
-SHOW CREATE TABLE t1;
-set @old_sql_mode=@@sql_mode;
-set sql_mode=ignore_bad_table_options;
-SHOW CREATE TABLE t1;
-set sql_mode=@old_sql_mode;
-SELECT * from t1;
-SELECT * from t2;
-
---echo #
---echo # Changing back to CONNECT fails
---echo # Sure enough, the data file was not deleted.
---echo #
---error ER_UNKNOWN_ERROR
-ALTER TABLE t1 ENGINE=CONNECT;
-
---echo #
---echo # But changing back to CONNECT succeed
---echo # if the data file does not exist.
---echo #
---remove_file $MYSQLD_DATADIR/test/tf1.txt
-ALTER TABLE t1 ENGINE=CONNECT;
-SHOW CREATE TABLE t1;
-SELECT * from t1;
-SELECT * from t2;
-
-DROP TABLE t1, t2;
-
-#
-# Clean up
-#
---remove_file $MYSQLD_DATADIR/test/tf1.txt
+let $MYSQLD_DATADIR= `select @@datadir`;
+
+--echo #
+--echo # Testing indexing with ALTER on inward table (in-place)
+--echo #
+CREATE TABLE t1 (c INT NOT NULL, d CHAR(10) NOT NULL) ENGINE=CONNECT;
+INSERT INTO t1 VALUES (1,'One'), (2,'Two'), (3,'Three');
+SELECT * FROM t1;
+CREATE INDEX xc ON t1(c);
+DESCRIBE SELECT * FROM t1 WHERE c = 2;
+DROP INDEX xc ON t1;
+CREATE INDEX xd ON t1(d);
+DROP INDEX xd ON t1;
+ALTER TABLE t1 ADD INDEX xc (c), ADD INDEX xd (d);
+SHOW INDEX FROM t1;
+ALTER TABLE t1 DROP INDEX xc, DROP INDEX xd;
+SHOW INDEX FROM t1;
+
+--echo #
+--echo # Testing modifying columns inward table (not in-place)
+--echo #
+ALTER TABLE t1 MODIFY COLUMN c CHAR(5) NOT NULL;
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+ALTER TABLE t1 MODIFY COLUMN c INT NOT NULL;
+
+--echo #
+--echo # Fails because indexing must be in-place
+--echo #
+--error ER_ALTER_OPERATION_NOT_SUPPORTED
+ALTER TABLE t1 MODIFY COLUMN c CHAR(10) NOT NULL, ADD INDEX xd (d);
+
+--echo #
+--echo # Testing changing table type (not in-place)
+--echo #
+ALTER TABLE t1 TABLE_TYPE=CSV HEADER=1 QUOTED=1;
+SELECT * FROM t1;
+SHOW CREATE TABLE t1;
+
+--echo # create an outward table used to see the t1 file
+CREATE TABLE t2 (line VARCHAR(100) NOT NULL) ENGINE=CONNECT FILE_NAME='t1.csv';
+SELECT * FROM t2;
+
+--echo #
+--echo # Testing changing engine
+--echo #
+DROP TABLE t1;
+CREATE TABLE t1 (c INT NOT NULL, d CHAR(10) NOT NULL) ENGINE=CONNECT;
+INSERT INTO t1 VALUES (1,'One'), (2,'Two'), (3,'Three');
+ALTER TABLE t1 ADD INDEX xc (c), ADD INDEX xd (d);
+ALTER TABLE t1 ENGINE = MYISAM;
+SHOW CREATE TABLE t1;
+SHOW INDEX FROM t1;
+SELECT * FROM t1;
+ALTER TABLE t1 ENGINE = CONNECT TABLE_TYPE=DBF;
+SHOW CREATE TABLE t1;
+SHOW INDEX FROM t1;
+SELECT * FROM t1;
+DROP TABLE t1, t2;
+
+--echo #
+--echo # Testing ALTER on outward tables
+--echo #
+CREATE TABLE t1 (c INT NOT NULL, d CHAR(10) NOT NULL) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='tf1.txt' ENDING=1;
+INSERT INTO t1 VALUES (1,'One'), (2,'Two'), (3,'Three');
+SELECT * FROM t1;
+CREATE TABLE t2 (line VARCHAR(100) NOT NULL) ENGINE=CONNECT FILE_NAME='tf1.txt';
+SELECT * FROM t2;
+
+--echo #
+--echo # Indexing works the same
+--echo #
+ALTER TABLE t1 ADD INDEX xc (c), ADD INDEX xd (d);
+SHOW INDEX FROM t1;
+SELECT d FROM t1 WHERE c = 2;
+ALTER TABLE t1 DROP INDEX xc, DROP INDEX xd;
+SHOW INDEX FROM t1;
+
+--echo #
+--echo # Other alterations do not modify the file
+--echo #
+ALTER TABLE t1 MODIFY COLUMN c CHAR(5) NOT NULL;
+SELECT * FROM t2;
+SHOW CREATE TABLE t1;
+#Wrong result
+--error ER_GET_ERRMSG
+SELECT * FROM t1;
+ALTER TABLE t1 MODIFY COLUMN c INT NOT NULL;
+
+--echo #
+--echo # Changing column order
+--echo #
+ALTER TABLE t1 MODIFY COLUMN c INT NOT NULL AFTER d;
+SELECT * FROM t2;
+SHOW CREATE TABLE t1;
+--echo # Wrong result
+SELECT * FROM t1;
+ALTER TABLE t1 MODIFY COLUMN c INT NOT NULL FIRST;
+--echo # What should have been done
+ALTER TABLE t1 MODIFY c INT NOT NULL FLAG=0 AFTER d, MODIFY d CHAR(10) NOT NULL FLAG=11;
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+
+--echo #
+--echo # Changing to another engine is Ok
+--echo # However, the data file is not deleted.
+--echo #
+ALTER TABLE t1 ENGINE=ARIA;
+SHOW CREATE TABLE t1;
+set @old_sql_mode=@@sql_mode;
+set sql_mode=ignore_bad_table_options;
+SHOW CREATE TABLE t1;
+set sql_mode=@old_sql_mode;
+SELECT * from t1;
+SELECT * from t2;
+
+--echo #
+--echo # Changing back to CONNECT fails
+--echo # Sure enough, the data file was not deleted.
+--echo #
+--error ER_UNKNOWN_ERROR
+ALTER TABLE t1 ENGINE=CONNECT;
+
+--echo #
+--echo # But changing back to CONNECT succeed
+--echo # if the data file does not exist.
+--echo #
+--remove_file $MYSQLD_DATADIR/test/tf1.txt
+ALTER TABLE t1 ENGINE=CONNECT;
+SHOW CREATE TABLE t1;
+SELECT * from t1;
+SELECT * from t2;
+
+DROP TABLE t1, t2;
+
+#
+# Clean up
+#
+--remove_file $MYSQLD_DATADIR/test/tf1.txt
diff --git a/storage/connect/mysql-test/connect/t/alter_xml.test b/storage/connect/mysql-test/connect/t/alter_xml.test
index decf5e76cdf..0b876296e58 100644
--- a/storage/connect/mysql-test/connect/t/alter_xml.test
+++ b/storage/connect/mysql-test/connect/t/alter_xml.test
@@ -1,29 +1,29 @@
---source have_libxml2.inc
-
---echo #
---echo # Testing changing table type (not in-place)
---echo #
-CREATE TABLE t1 (c INT NOT NULL, d CHAR(10) NOT NULL) ENGINE=CONNECT TABLE_TYPE=CSV HEADER=1 QUOTED=1;
-INSERT INTO t1 VALUES (1,'One'), (2,'Two'), (3,'Three');
-SELECT * FROM t1;
-
---echo # This would fail if the top node name is not specified.
---echo # This is because the XML top node name defaults to the table name.
---echo # Sure enough the temporary table name begins with '#' and is rejected by XML.
---echo # Therefore the top node name must be specified (along with the row nodes name).
-ALTER TABLE t1 TABLE_TYPE=XML TABNAME=t1 OPTION_LIST='rownode=row';
-SELECT * FROM t1;
-SHOW CREATE TABLE t1;
-
---echo # Let us see the XML file
-CREATE TABLE t2 (line VARCHAR(100) NOT NULL) ENGINE=CONNECT FILE_NAME='t1.xml';
-SELECT * FROM t2;
---echo # NOTE: The first (ignored) row is due to the remaining HEADER=1 option.
-
---echo # Testing field option modification
-ALTER TABLE t1 MODIFY d CHAR(10) NOT NULL FIELD_FORMAT='@', HEADER=0;
-SELECT * FROM t1;
-SHOW CREATE TABLE t1;
-SELECT * FROM t2;
-
-DROP TABLE t1, t2;
+--source have_libxml2.inc
+
+--echo #
+--echo # Testing changing table type (not in-place)
+--echo #
+CREATE TABLE t1 (c INT NOT NULL, d CHAR(10) NOT NULL) ENGINE=CONNECT TABLE_TYPE=CSV HEADER=1 QUOTED=1;
+INSERT INTO t1 VALUES (1,'One'), (2,'Two'), (3,'Three');
+SELECT * FROM t1;
+
+--echo # This would fail if the top node name is not specified.
+--echo # This is because the XML top node name defaults to the table name.
+--echo # Sure enough the temporary table name begins with '#' and is rejected by XML.
+--echo # Therefore the top node name must be specified (along with the row nodes name).
+ALTER TABLE t1 TABLE_TYPE=XML TABNAME=t1 OPTION_LIST='rownode=row';
+SELECT * FROM t1;
+SHOW CREATE TABLE t1;
+
+--echo # Let us see the XML file
+CREATE TABLE t2 (line VARCHAR(100) NOT NULL) ENGINE=CONNECT FILE_NAME='t1.xml';
+SELECT * FROM t2;
+--echo # NOTE: The first (ignored) row is due to the remaining HEADER=1 option.
+
+--echo # Testing field option modification
+ALTER TABLE t1 MODIFY d CHAR(10) NOT NULL FIELD_FORMAT='@', HEADER=0;
+SELECT * FROM t1;
+SHOW CREATE TABLE t1;
+SELECT * FROM t2;
+
+DROP TABLE t1, t2;
diff --git a/storage/connect/mysql-test/connect/t/bin.test b/storage/connect/mysql-test/connect/t/bin.test
index 6ef0ffc75ec..1e45bcaf93a 100644
--- a/storage/connect/mysql-test/connect/t/bin.test
+++ b/storage/connect/mysql-test/connect/t/bin.test
@@ -1,77 +1,77 @@
-let $MYSQLD_DATADIR= `select @@datadir`;
-
---copy_file $MTR_SUITE_DIR/std_data/Testbal.dat $MYSQLD_DATADIR/test/Testbal.dat
-
---echo #
---echo # Testing errors
---echo #
-CREATE TABLE t1
-(
- ID INT NOT NULL
-) Engine=CONNECT TABLE_TYPE=BIN FILE_NAME='nonexistent.txt';
---replace_regex /on .*test.nonexistent.txt/on DATADIR\/test\/nonexistent.txt/
-# TODO: check why this is needed for Windows
---replace_result Open(rt) Open(rb)
-SELECT * FROM t1;
-DROP TABLE t1;
-
-SET time_zone='+00:00';
-CREATE TABLE t1
-(
- fig INT(4) NOT NULL FIELD_FORMAT='C',
- name CHAR(10) not null,
- birth DATE NOT NULL,
- id CHAR(5) NOT NULL FIELD_FORMAT='S',
- salary DOUBLE(9,2) NOT NULL DEFAULT 0.00 FIELD_FORMAT='F',
- dept INT(4) NOT NULL FIELD_FORMAT='S'
-) ENGINE=CONNECT TABLE_TYPE=BIN BLOCK_SIZE=5 FILE_NAME='Testbal.dat';
-SELECT * FROM t1;
-
---error ER_GET_ERRMSG
-INSERT INTO t1 VALUES (55555,'RONALD','1980-02-26','3333',4444.44,555);
-INSERT INTO t1 VALUES (5555,'RONALD','1980-02-26','3333',4444.44,555);
-SELECT * FROM t1;
-
-DROP TABLE t1;
-
---echo #
---echo # Testing READONLY tables
---echo #
-CREATE TABLE t1
-(
- fig INT(4) NOT NULL FIELD_FORMAT='C',
- name CHAR(10) not null,
- birth DATE NOT NULL,
- id CHAR(5) NOT NULL FIELD_FORMAT='S',
- salary DOUBLE(9,2) NOT NULL DEFAULT 0.00 FIELD_FORMAT='F',
- dept INT(4) NOT NULL FIELD_FORMAT='S'
-) ENGINE=CONNECT TABLE_TYPE=BIN READONLY=Yes FILE_NAME='Testbal.dat';
---error ER_OPEN_AS_READONLY
-INSERT INTO t1 VALUES (7777,'BILL','1973-06-30',4444,5555.555,777);
-ALTER TABLE t1 READONLY=NO;
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (7777,'BILL','1973-06-30',4444,5555.555,777);
-SELECT * FROM t1;
-ALTER TABLE t1 READONLY=YES;
-SHOW CREATE TABLE t1;
---error ER_OPEN_AS_READONLY
-INSERT INTO t1 VALUES (7777,'BILL','1973-06-30',4444,5555.555,777);
-DROP TABLE t1;
-
-
---echo #
---echo # Testing that the underlying file is created
---echo #
-CREATE TABLE t1
-(
- c CHAR(4) NOT NULL FIELD_FORMAT='C'
-) ENGINE=CONNECT TABLE_TYPE=BIN FILE_NAME='bin2.dat';
-INSERT INTO t1 VALUES (10),(20),(300),(4000);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-#
-# Clean up
-#
---remove_file $MYSQLD_DATADIR/test/Testbal.dat
---remove_file $MYSQLD_DATADIR/test/bin2.dat
+let $MYSQLD_DATADIR= `select @@datadir`;
+
+--copy_file $MTR_SUITE_DIR/std_data/Testbal.dat $MYSQLD_DATADIR/test/Testbal.dat
+
+--echo #
+--echo # Testing errors
+--echo #
+CREATE TABLE t1
+(
+ ID INT NOT NULL
+) Engine=CONNECT TABLE_TYPE=BIN FILE_NAME='nonexistent.txt';
+--replace_regex /on .*test.nonexistent.txt/on DATADIR\/test\/nonexistent.txt/
+# TODO: check why this is needed for Windows
+--replace_result Open(rt) Open(rb)
+SELECT * FROM t1;
+DROP TABLE t1;
+
+SET time_zone='+00:00';
+CREATE TABLE t1
+(
+ fig INT(4) NOT NULL FIELD_FORMAT='C',
+ name CHAR(10) NOT NULL,
+ birth DATE NOT NULL,
+ id CHAR(5) NOT NULL FIELD_FORMAT='S',
+ salary DOUBLE(9,2) NOT NULL DEFAULT 0.00 FIELD_FORMAT='F',
+ dept INT(4) NOT NULL FIELD_FORMAT='S'
+) ENGINE=CONNECT TABLE_TYPE=BIN BLOCK_SIZE=5 FILE_NAME='Testbal.dat' OPTION_LIST='Endian=Little';
+SELECT * FROM t1;
+
+--error ER_GET_ERRMSG
+INSERT INTO t1 VALUES (55555,'RONALD','1980-02-26','3333',4444.44,555);
+INSERT INTO t1 VALUES (5555,'RONALD','1980-02-26','3333',4444.44,555);
+SELECT * FROM t1;
+
+DROP TABLE t1;
+
+--echo #
+--echo # Testing READONLY tables
+--echo #
+CREATE TABLE t1
+(
+ fig INT(4) NOT NULL FIELD_FORMAT='C',
+ name CHAR(10) NOT NULL,
+ birth DATE NOT NULL,
+ id CHAR(5) NOT NULL FIELD_FORMAT='S',
+ salary DOUBLE(9,2) NOT NULL DEFAULT 0.00 FIELD_FORMAT='F',
+ dept INT(4) NOT NULL FIELD_FORMAT='S'
+) ENGINE=CONNECT TABLE_TYPE=BIN READONLY=Yes FILE_NAME='Testbal.dat' OPTION_LIST='Endian=Little';
+--error ER_OPEN_AS_READONLY
+INSERT INTO t1 VALUES (7777,'BILL','1973-06-30',4444,5555.555,777);
+ALTER TABLE t1 READONLY=NO;
+SHOW CREATE TABLE t1;
+INSERT INTO t1 VALUES (7777,'BILL','1973-06-30',4444,5555.555,777);
+SELECT * FROM t1;
+ALTER TABLE t1 READONLY=YES;
+SHOW CREATE TABLE t1;
+--error ER_OPEN_AS_READONLY
+INSERT INTO t1 VALUES (7777,'BILL','1973-06-30',4444,5555.555,777);
+DROP TABLE t1;
+
+
+--echo #
+--echo # Testing that the underlying file is created
+--echo #
+CREATE TABLE t1
+(
+ c CHAR(4) NOT NULL FIELD_FORMAT='C'
+) ENGINE=CONNECT TABLE_TYPE=BIN FILE_NAME='bin2.dat';
+INSERT INTO t1 VALUES (10),(20),(300),(4000);
+SELECT * FROM t1;
+DROP TABLE t1;
+
+#
+# Clean up
+#
+--remove_file $MYSQLD_DATADIR/test/Testbal.dat
+--remove_file $MYSQLD_DATADIR/test/bin2.dat
diff --git a/storage/connect/mysql-test/connect/t/datest.test b/storage/connect/mysql-test/connect/t/datest.test
index a986ce15a80..7fe5fcea8ff 100644
--- a/storage/connect/mysql-test/connect/t/datest.test
+++ b/storage/connect/mysql-test/connect/t/datest.test
@@ -1,16 +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;
+--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/fmt.test b/storage/connect/mysql-test/connect/t/fmt.test
index 662bc70c8b1..2cea2dba7f9 100644
--- a/storage/connect/mysql-test/connect/t/fmt.test
+++ b/storage/connect/mysql-test/connect/t/fmt.test
@@ -1,85 +1,85 @@
-let $MYSQLD_DATADIR= `select @@datadir`;
---copy_file $MTR_SUITE_DIR/std_data/funny.txt $MYSQLD_DATADIR/test/funny.txt
---copy_file $MTR_SUITE_DIR/std_data/funny2.txt $MYSQLD_DATADIR/test/funny2.txt
-
---echo #
---echo # Testing errors
---echo #
-CREATE TABLE t1
-(
- ID INT NOT NULL field_format=' %n%d%n'
-) Engine=CONNECT table_type=FMT file_name='nonexistent.txt';
---replace_regex /on .*test.nonexistent.txt/on DATADIR\/test\/nonexistent.txt/
-# TODO: check why this is needed for Windows
---replace_result Open(rt) Open(rb)
-SELECT * FROM t1;
-DROP TABLE t1;
-
-
---echo #
---echo # Testing update on FMT tables
---echo #
-CREATE TABLE t1
-(
- id INT NOT NULL field_format=' %n%d%n'
-) ENGINE=CONNECT TABLE_TYPE=FMT FILE_NAME='t1.txt';
---error ER_GET_ERRMSG
-INSERT INTO t1 VALUES (10),(20);
-# TODO:
-#--error ER_GET_ERRMSG
-#UPDATE t1 SET id=20;
-#TRUNCATE TABLE t1;
-#DELETE FROM t1 WHERE id=10;
-#SELECT * FROM t1;
-DROP TABLE t1;
-#--remove_file $MYSQLD_DATADIR/test/t1.txt
-
-
---echo #
---echo # Testing manual examples
---echo #
-CREATE TABLE t1
-(
- ID Integer(5) not null field_format=' %n%d%n',
- NAME Char(16) not null field_format=" , '%n%[^']%n'",
- DEPNO Integer(4) not null field_format=' , #%n%d%n',
- SALARY Double(12,2) not null field_format=' ; %n%f%n'
-) Engine=CONNECT table_type=FMT file_name='funny.txt';
-SELECT * FROM t1;
-DROP TABLE t1;
-
-#
-# TODO: shoudn't a warning instead of error be returned on bad format?
-#
-CREATE TABLE t1
-(
- ID Integer(5) not null field_format=' %n%d%n',
- NAME Char(16) not null field_format=" , '%n%[^']%n'",
- DEPNO Integer(4) not null field_format=' , #%n%d%n',
- SALARY Double(12,2) not null field_format=' ; %n%f%n'
-) Engine=CONNECT table_type=FMT file_name='funny2.txt';
---error ER_GET_ERRMSG
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1
-(
- ID Integer(5) not null field_format=' %n%d%n',
- NAME Char(16) not null field_format=' , ''%n%[^'']%m',
- DEPNO Integer(4) not null field_format=''' , #%n%d%m',
- SALARY Double(12,2) not null field_format=' ; %n%f%n'
-) Engine=CONNECT table_type=FMT file_name='funny2.txt';
-SELECT * FROM t1;
---error ER_GET_ERRMSG
-UPDATE t1 SET SALARY=1234;
-# TODO: this query crashes
-# UPDATE t1 SET SALARY=1234 WHERE ID=56;
-DELETE FROM t1 WHERE ID=56;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-#
-# Clean up
-#
---remove_file $MYSQLD_DATADIR/test/funny.txt
---remove_file $MYSQLD_DATADIR/test/funny2.txt
+let $MYSQLD_DATADIR= `select @@datadir`;
+--copy_file $MTR_SUITE_DIR/std_data/funny.txt $MYSQLD_DATADIR/test/funny.txt
+--copy_file $MTR_SUITE_DIR/std_data/funny2.txt $MYSQLD_DATADIR/test/funny2.txt
+
+--echo #
+--echo # Testing errors
+--echo #
+CREATE TABLE t1
+(
+ ID INT NOT NULL field_format=' %n%d%n'
+) Engine=CONNECT table_type=FMT file_name='nonexistent.txt';
+--replace_regex /on .*test.nonexistent.txt/on DATADIR\/test\/nonexistent.txt/
+# TODO: check why this is needed for Windows
+--replace_result Open(rt) Open(rb)
+SELECT * FROM t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # Testing update on FMT tables
+--echo #
+CREATE TABLE t1
+(
+ id INT NOT NULL field_format=' %n%d%n'
+) ENGINE=CONNECT TABLE_TYPE=FMT FILE_NAME='t1.txt';
+--error ER_GET_ERRMSG
+INSERT INTO t1 VALUES (10),(20);
+# TODO:
+#--error ER_GET_ERRMSG
+#UPDATE t1 SET id=20;
+#TRUNCATE TABLE t1;
+#DELETE FROM t1 WHERE id=10;
+#SELECT * FROM t1;
+DROP TABLE t1;
+#--remove_file $MYSQLD_DATADIR/test/t1.txt
+
+
+--echo #
+--echo # Testing manual examples
+--echo #
+CREATE TABLE t1
+(
+ ID Integer(5) not null field_format=' %n%d%n',
+ NAME Char(16) not null field_format=" , '%n%[^']%n'",
+ DEPNO Integer(4) not null field_format=' , #%n%d%n',
+ SALARY Double(12,2) not null field_format=' ; %n%f%n'
+) Engine=CONNECT table_type=FMT file_name='funny.txt';
+SELECT * FROM t1;
+DROP TABLE t1;
+
+#
+# TODO: shoudn't a warning instead of error be returned on bad format?
+#
+CREATE TABLE t1
+(
+ ID Integer(5) not null field_format=' %n%d%n',
+ NAME Char(16) not null field_format=" , '%n%[^']%n'",
+ DEPNO Integer(4) not null field_format=' , #%n%d%n',
+ SALARY Double(12,2) not null field_format=' ; %n%f%n'
+) Engine=CONNECT table_type=FMT file_name='funny2.txt';
+--error ER_GET_ERRMSG
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1
+(
+ ID Integer(5) not null field_format=' %n%d%n',
+ NAME Char(16) not null field_format=' , ''%n%[^'']%m',
+ DEPNO Integer(4) not null field_format=''' , #%n%d%m',
+ SALARY Double(12,2) not null field_format=' ; %n%f%n'
+) Engine=CONNECT table_type=FMT file_name='funny2.txt';
+SELECT * FROM t1;
+--error ER_GET_ERRMSG
+UPDATE t1 SET SALARY=1234;
+# TODO: this query crashes
+# UPDATE t1 SET SALARY=1234 WHERE ID=56;
+DELETE FROM t1 WHERE ID=56;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+#
+# Clean up
+#
+--remove_file $MYSQLD_DATADIR/test/funny.txt
+--remove_file $MYSQLD_DATADIR/test/funny2.txt
diff --git a/storage/connect/mysql-test/connect/t/general.test b/storage/connect/mysql-test/connect/t/general.test
index 66752b32099..34e5d4c7b6d 100644
--- a/storage/connect/mysql-test/connect/t/general.test
+++ b/storage/connect/mysql-test/connect/t/general.test
@@ -1,16 +1,16 @@
---echo #
---echo # Testing features not specific to any TABLE_TYPE
---echo #
---error ER_UNKNOWN_ERROR
-CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=NON_EXISTING;
-#SHOW CREATE TABLE t1;
-#DROP TABLE t1;
-
-CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=FIX;
-INSERT INTO t1 VALUES (10);
-SELECT * FROM t1;
-#--error ER_GET_ERRMSG
---error ER_UNKNOWN_ERROR
-ALTER TABLE t1 TABLE_TYPE=NON_EXISTING;
-SELECT * FROM t1;
-DROP TABLE t1;
+--echo #
+--echo # Testing features not specific to any TABLE_TYPE
+--echo #
+--error ER_UNKNOWN_ERROR
+CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=NON_EXISTING;
+#SHOW CREATE TABLE t1;
+#DROP TABLE t1;
+
+CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=FIX;
+INSERT INTO t1 VALUES (10);
+SELECT * FROM t1;
+#--error ER_GET_ERRMSG
+--error ER_UNKNOWN_ERROR
+ALTER TABLE t1 TABLE_TYPE=NON_EXISTING;
+SELECT * FROM t1;
+DROP TABLE t1;
diff --git a/storage/connect/mysql-test/connect/t/json.test b/storage/connect/mysql-test/connect/t/json.test
index a7e630ed0cf..1cc2c054db4 100644
--- a/storage/connect/mysql-test/connect/t/json.test
+++ b/storage/connect/mysql-test/connect/t/json.test
@@ -1,247 +1,264 @@
---source include/not_embedded.inc
---source include/have_partition.inc
-
-let $MYSQLD_DATADIR= `select @@datadir`;
-
---copy_file $MTR_SUITE_DIR/std_data/biblio.jsn $MYSQLD_DATADIR/test/biblio.jsn
---copy_file $MTR_SUITE_DIR/std_data/expense.jsn $MYSQLD_DATADIR/test/expense.jsn
---copy_file $MTR_SUITE_DIR/std_data/mulexp3.jsn $MYSQLD_DATADIR/test/mulexp3.jsn
---copy_file $MTR_SUITE_DIR/std_data/mulexp4.jsn $MYSQLD_DATADIR/test/mulexp4.jsn
---copy_file $MTR_SUITE_DIR/std_data/mulexp5.jsn $MYSQLD_DATADIR/test/mulexp5.jsn
-
---echo #
---echo # Testing doc samples
---echo #
-CREATE TABLE t1
-(
- ISBN CHAR(15),
- LANG CHAR(2),
- SUBJECT CHAR(32),
- AUTHOR CHAR(64),
- TITLE CHAR(32),
- TRANSLATION CHAR(32),
- TRANSLATOR CHAR(80),
- PUBLISHER CHAR(32),
- DATEPUB int(4)
-) ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.jsn';
-SELECT * FROM t1;
-DROP TABLE t1;
-
-
---echo #
---echo # Testing Jpath. Get the number of authors
---echo #
-CREATE TABLE t1
-(
- ISBN CHAR(15),
- Language CHAR(2) FIELD_FORMAT='LANG',
- Subject CHAR(32) FIELD_FORMAT='SUBJECT',
- Authors INT(2) FIELD_FORMAT='AUTHOR:[#]',
- Title CHAR(32) FIELD_FORMAT='TITLE',
- Translation CHAR(32) FIELD_FORMAT='TRANSLATION',
- Translator CHAR(80) FIELD_FORMAT='TRANSLATOR',
- Publisher CHAR(20) FIELD_FORMAT='PUBLISHER:NAME',
- Location CHAR(16) FIELD_FORMAT='PUBLISHER:PLACE',
- Year int(4) FIELD_FORMAT='DATEPUB'
-)
-ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.jsn';
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # Concatenates the authors
---echo #
-CREATE TABLE t1
-(
- ISBN CHAR(15),
- Language CHAR(2) FIELD_FORMAT='LANG',
- Subject CHAR(32) FIELD_FORMAT='SUBJECT',
- AuthorFN CHAR(128) FIELD_FORMAT='AUTHOR:[" and "]:FIRSTNAME',
- AuthorLN CHAR(128) FIELD_FORMAT='AUTHOR:[" and "]:LASTNAME',
- Title CHAR(32) FIELD_FORMAT='TITLE',
- Translation CHAR(32) FIELD_FORMAT='TRANSLATION',
- Translator CHAR(80) FIELD_FORMAT='TRANSLATOR',
- Publisher CHAR(20) FIELD_FORMAT='PUBLISHER:NAME',
- Location CHAR(16) FIELD_FORMAT='PUBLISHER:PLACE',
- Year int(4) FIELD_FORMAT='DATEPUB'
-)
-ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.jsn';
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # Testing expanding authors
---echo #
-CREATE TABLE t1
-(
- ISBN CHAR(15),
- Language CHAR(2) FIELD_FORMAT='LANG',
- Subject CHAR(32) FIELD_FORMAT='SUBJECT',
- AuthorFN CHAR(128) FIELD_FORMAT='AUTHOR:[X]:FIRSTNAME',
- AuthorLN CHAR(128) FIELD_FORMAT='AUTHOR:[X]:LASTNAME',
- Title CHAR(32) FIELD_FORMAT='TITLE',
- Translation CHAR(32) FIELD_FORMAT='TRANSLATION',
- Translator CHAR(80) FIELD_FORMAT='TRANSLATOR',
- Publisher CHAR(20) FIELD_FORMAT='PUBLISHER:NAME',
- Location CHAR(16) FIELD_FORMAT='PUBLISHER:PLACE',
- Year int(4) FIELD_FORMAT='DATEPUB'
-)
-ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.jsn';
-SELECT * FROM t1;
-UPDATE t1 SET AuthorFN = 'Philippe' WHERE AuthorLN = 'Knab';
-SELECT * FROM t1 WHERE ISBN = '9782212090819';
-
---echo #
---echo # To add an author a new table must be created
---echo #
-CREATE TABLE t2 (
-FIRSTNAME CHAR(32),
-LASTNAME CHAR(32))
-ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.jsn' OPTION_LIST='Object=[2]:AUTHOR';
-SELECT * FROM t2;
-INSERT INTO t2 VALUES('Charles','Dickens');
-SELECT * FROM t1;
-DROP TABLE t1;
-DROP TABLE t2;
-
---echo #
---echo # Check the biblio file has the good format
---echo #
-CREATE TABLE t1
-(
- line char(255)
-)
-ENGINE=CONNECT TABLE_TYPE=DOS FILE_NAME='biblio.jsn';
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # A file with 2 arrays
---echo #
-CREATE TABLE t1 (
-WHO CHAR(12),
-WEEK INT(2) FIELD_FORMAT='WEEK:[X]:NUMBER',
-WHAT CHAR(32) FIELD_FORMAT='WEEK::EXPENSE:["+"]:WHAT',
-AMOUNT DOUBLE(8,2) FIELD_FORMAT='WEEK::EXPENSE:[+]:AMOUNT')
-ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='expense.jsn';
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # Cannot be fully expanded
---echo #
-CREATE TABLE t1 (
-WHO CHAR(12),
-WEEK INT(2) FIELD_FORMAT='WEEK:[X]:NUMBER',
-WHAT CHAR(32) FIELD_FORMAT='WEEK:[X]:EXPENSE:[X]:WHAT',
-AMOUNT DOUBLE(8,2) FIELD_FORMAT='WEEK:[X]:EXPENSE:[X]:AMOUNT')
-ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='expense.jsn';
---error ER_GET_ERRMSG
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # Expand expense in 3 one week tables
---echo #
-CREATE TABLE t2 (
-WHO CHAR(12),
-WEEK INT(2) FIELD_FORMAT='WEEK:[1]:NUMBER',
-WHAT CHAR(32) FIELD_FORMAT='WEEK:[1]:EXPENSE:[X]:WHAT',
-AMOUNT DOUBLE(8,2) FIELD_FORMAT='WEEK:[1]:EXPENSE:[X]:AMOUNT')
-ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='expense.jsn';
-SELECT * FROM t2;
-
-CREATE TABLE t3 (
-WHO CHAR(12),
-WEEK INT(2) FIELD_FORMAT='WEEK:[2]:NUMBER',
-WHAT CHAR(32) FIELD_FORMAT='WEEK:[2]:EXPENSE:[X]:WHAT',
-AMOUNT DOUBLE(8,2) FIELD_FORMAT='WEEK:[2]:EXPENSE:[X]:AMOUNT')
-ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='expense.jsn';
-SELECT * FROM t3;
-
-CREATE TABLE t4 (
-WHO CHAR(12),
-WEEK INT(2) FIELD_FORMAT='WEEK:[3]:NUMBER',
-WHAT CHAR(32) FIELD_FORMAT='WEEK:[3]:EXPENSE:[X]:WHAT',
-AMOUNT DOUBLE(8,2) FIELD_FORMAT='WEEK:[3]:EXPENSE:[X]:AMOUNT')
-ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='expense.jsn';
-SELECT * FROM t4;
-
---echo #
---echo # The expanded table is made as a TBL table
---echo #
-CREATE TABLE t1 (
-WHO CHAR(12),
-WEEK INT(2),
-WHAT CHAR(32),
-AMOUNT DOUBLE(8,2))
-ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t2,t3,t4';
-SELECT * FROM t1;
-DROP TABLE t1, t2, t3, t4;
-
---echo #
---echo # Three partial JSON tables
---echo #
-CREATE TABLE t2 (
-WHO CHAR(12),
-WEEK INT(2),
-WHAT CHAR(32) FIELD_FORMAT='EXPENSE:[X]:WHAT',
-AMOUNT DOUBLE(8,2) FIELD_FORMAT='EXPENSE:[X]:AMOUNT')
-ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='mulexp3.jsn';
-SELECT * FROM t2;
-
-CREATE TABLE t3 (
-WHO CHAR(12),
-WEEK INT(2),
-WHAT CHAR(32) FIELD_FORMAT='EXPENSE:[X]:WHAT',
-AMOUNT DOUBLE(8,2) FIELD_FORMAT='EXPENSE:[X]:AMOUNT')
-ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='mulexp4.jsn';
-SELECT * FROM t3;
-
-CREATE TABLE t4 (
-WHO CHAR(12),
-WEEK INT(2),
-WHAT CHAR(32) FIELD_FORMAT='EXPENSE:[X]:WHAT',
-AMOUNT DOUBLE(8,2) FIELD_FORMAT='EXPENSE:[X]:AMOUNT')
-ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='mulexp5.jsn';
-SELECT * FROM t4;
-
---echo #
---echo # The complete table can be a multiple JSON table
---echo #
-CREATE TABLE t1 (
-WHO CHAR(12),
-WEEK INT(2),
-WHAT CHAR(32) FIELD_FORMAT='EXPENSE:[X]:WHAT',
-AMOUNT DOUBLE(8,2) FIELD_FORMAT='EXPENSE:[X]:AMOUNT')
-ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='mulexp*.jsn' MULTIPLE=1;
-SELECT * FROM t1 ORDER BY WHO, WEEK, WHAT, AMOUNT;
-DROP TABLE t1;
-
---echo #
---echo # Or also a partition JSON table
---echo #
-CREATE TABLE t1 (
-WHO CHAR(12),
-WEEK INT(2),
-WHAT CHAR(32) FIELD_FORMAT='EXPENSE:[X]:WHAT',
-AMOUNT DOUBLE(8,2) FIELD_FORMAT='EXPENSE:[X]:AMOUNT')
-ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='mulexp%s.jsn';
-ALTER TABLE t1
-PARTITION BY LIST COLUMNS(WEEK) (
-PARTITION `3` VALUES IN(3),
-PARTITION `4` VALUES IN(4),
-PARTITION `5` VALUES IN(5));
-SHOW WARNINGS;
-SELECT * FROM t1;
-SELECT * FROM t1 WHERE WEEK = 4;
-DROP TABLE t1, t2, t3, t4;
-
-#
-# Clean up
-#
---remove_file $MYSQLD_DATADIR/test/biblio.jsn
---remove_file $MYSQLD_DATADIR/test/expense.jsn
---remove_file $MYSQLD_DATADIR/test/mulexp3.jsn
---remove_file $MYSQLD_DATADIR/test/mulexp4.jsn
---remove_file $MYSQLD_DATADIR/test/mulexp5.jsn
+--source include/not_embedded.inc
+--source include/have_partition.inc
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+
+--copy_file $MTR_SUITE_DIR/std_data/biblio.json $MYSQLD_DATADIR/test/biblio.json
+--copy_file $MTR_SUITE_DIR/std_data/expense.json $MYSQLD_DATADIR/test/expense.json
+--copy_file $MTR_SUITE_DIR/std_data/mulexp3.json $MYSQLD_DATADIR/test/mulexp3.json
+--copy_file $MTR_SUITE_DIR/std_data/mulexp4.json $MYSQLD_DATADIR/test/mulexp4.json
+--copy_file $MTR_SUITE_DIR/std_data/mulexp5.json $MYSQLD_DATADIR/test/mulexp5.json
+
+--echo #
+--echo # Testing doc samples
+--echo #
+CREATE TABLE t1
+(
+ ISBN CHAR(15),
+ LANG CHAR(2),
+ SUBJECT CHAR(32),
+ AUTHOR CHAR(64),
+ TITLE CHAR(32),
+ TRANSLATION CHAR(32),
+ TRANSLATOR CHAR(80),
+ PUBLISHER CHAR(32),
+ DATEPUB int(4)
+) ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.json';
+SELECT * FROM t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # Testing Jpath. Get the number of authors
+--echo #
+CREATE TABLE t1
+(
+ ISBN CHAR(15),
+ Language CHAR(2) FIELD_FORMAT='LANG',
+ Subject CHAR(32) FIELD_FORMAT='SUBJECT',
+ Authors INT(2) FIELD_FORMAT='AUTHOR:[#]',
+ Title CHAR(32) FIELD_FORMAT='TITLE',
+ Translation CHAR(32) FIELD_FORMAT='TRANSLATION',
+ Translator CHAR(80) FIELD_FORMAT='TRANSLATOR',
+ Publisher CHAR(20) FIELD_FORMAT='PUBLISHER:NAME',
+ Location CHAR(16) FIELD_FORMAT='PUBLISHER:PLACE',
+ Year int(4) FIELD_FORMAT='DATEPUB'
+)
+ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.json';
+SELECT * FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # Concatenates the authors
+--echo #
+CREATE TABLE t1
+(
+ ISBN CHAR(15),
+ Language CHAR(2) FIELD_FORMAT='LANG',
+ Subject CHAR(32) FIELD_FORMAT='SUBJECT',
+ AuthorFN CHAR(128) FIELD_FORMAT='AUTHOR:[" and "]:FIRSTNAME',
+ AuthorLN CHAR(128) FIELD_FORMAT='AUTHOR:[" and "]:LASTNAME',
+ Title CHAR(32) FIELD_FORMAT='TITLE',
+ Translation CHAR(32) FIELD_FORMAT='TRANSLATION',
+ Translator CHAR(80) FIELD_FORMAT='TRANSLATOR',
+ Publisher CHAR(20) FIELD_FORMAT='PUBLISHER:NAME',
+ Location CHAR(16) FIELD_FORMAT='PUBLISHER:PLACE',
+ Year int(4) FIELD_FORMAT='DATEPUB'
+)
+ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.json';
+SELECT * FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # Testing expanding authors
+--echo #
+CREATE TABLE t1
+(
+ ISBN CHAR(15),
+ Language CHAR(2) FIELD_FORMAT='LANG',
+ Subject CHAR(32) FIELD_FORMAT='SUBJECT',
+ AuthorFN CHAR(128) FIELD_FORMAT='AUTHOR:[X]:FIRSTNAME',
+ AuthorLN CHAR(128) FIELD_FORMAT='AUTHOR:[X]:LASTNAME',
+ Title CHAR(32) FIELD_FORMAT='TITLE',
+ Translation CHAR(32) FIELD_FORMAT='TRANSLATION',
+ Translator CHAR(80) FIELD_FORMAT='TRANSLATOR',
+ Publisher CHAR(20) FIELD_FORMAT='PUBLISHER:NAME',
+ Location CHAR(16) FIELD_FORMAT='PUBLISHER:PLACE',
+ Year int(4) FIELD_FORMAT='DATEPUB'
+)
+ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.json';
+SELECT * FROM t1;
+UPDATE t1 SET AuthorFN = 'Philippe' WHERE AuthorLN = 'Knab';
+SELECT * FROM t1 WHERE ISBN = '9782212090819';
+
+--echo #
+--echo # To add an author a new table must be created
+--echo #
+CREATE TABLE t2 (
+FIRSTNAME CHAR(32),
+LASTNAME CHAR(32))
+ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.json' OPTION_LIST='Object=[1]:AUTHOR';
+SELECT * FROM t2;
+INSERT INTO t2 VALUES('Charles','Dickens');
+SELECT * FROM t1;
+DROP TABLE t1;
+DROP TABLE t2;
+
+--echo #
+--echo # Check the biblio file has the good format
+--echo #
+CREATE TABLE t1
+(
+ line char(255)
+)
+ENGINE=CONNECT TABLE_TYPE=DOS FILE_NAME='biblio.json';
+SELECT * FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # A file with 2 arrays
+--echo #
+CREATE TABLE t1 (
+WHO CHAR(12),
+WEEK INT(2) FIELD_FORMAT='WEEK:[X]:NUMBER',
+WHAT CHAR(32) FIELD_FORMAT='WEEK::EXPENSE:["+"]:WHAT',
+AMOUNT DOUBLE(8,2) FIELD_FORMAT='WEEK::EXPENSE:[+]:AMOUNT')
+ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='expense.json';
+SELECT * FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # Now it can be fully expanded
+--echo #
+CREATE TABLE t1 (
+WHO CHAR(12),
+WEEK INT(2) FIELD_FORMAT='WEEK:[X]:NUMBER',
+WHAT CHAR(32) FIELD_FORMAT='WEEK:[X]:EXPENSE:[X]:WHAT',
+AMOUNT DOUBLE(8,2) FIELD_FORMAT='WEEK:[X]:EXPENSE:[X]:AMOUNT')
+ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='expense.json';
+#--error ER_GET_ERRMSG
+SELECT * FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # A table showing many calculated results
+--echo #
+CREATE TABLE t1 (
+WHO CHAR(12) NOT NULL,
+WEEKS CHAR(12) NOT NULL FIELD_FORMAT='WEEK:[", "]:NUMBER',
+SUMS CHAR(64) NOT NULL FIELD_FORMAT='WEEK:["+"]:EXPENSE:[+]:AMOUNT',
+SUM DOUBLE(8,2) NOT NULL FIELD_FORMAT='WEEK:[+]:EXPENSE:[+]:AMOUNT',
+AVGS CHAR(64) NOT NULL FIELD_FORMAT='WEEK:["+"]:EXPENSE:[!]:AMOUNT',
+SUMAVG DOUBLE(8,2) NOT NULL FIELD_FORMAT='WEEK:[+]:EXPENSE:[!]:AMOUNT',
+AVGSUM DOUBLE(8,2) NOT NULL FIELD_FORMAT='WEEK:[!]:EXPENSE:[+]:AMOUNT',
+AVGAVG DOUBLE(8,2) NOT NULL FIELD_FORMAT='WEEK:[!]:EXPENSE:[!]:AMOUNT',
+AVERAGE DOUBLE(8,2) NOT NULL FIELD_FORMAT='WEEK:[!]:EXPENSE:[X]:AMOUNT')
+ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='expense.json';
+SELECT * FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # Expand expense in 3 one week tables
+--echo #
+CREATE TABLE t2 (
+WHO CHAR(12),
+WEEK INT(2) FIELD_FORMAT='WEEK:[0]:NUMBER',
+WHAT CHAR(32) FIELD_FORMAT='WEEK:[0]:EXPENSE:[X]:WHAT',
+AMOUNT DOUBLE(8,2) FIELD_FORMAT='WEEK:[0]:EXPENSE:[X]:AMOUNT')
+ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='expense.json';
+SELECT * FROM t2;
+
+CREATE TABLE t3 (
+WHO CHAR(12),
+WEEK INT(2) FIELD_FORMAT='WEEK:[1]:NUMBER',
+WHAT CHAR(32) FIELD_FORMAT='WEEK:[1]:EXPENSE:[X]:WHAT',
+AMOUNT DOUBLE(8,2) FIELD_FORMAT='WEEK:[1]:EXPENSE:[X]:AMOUNT')
+ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='expense.json';
+SELECT * FROM t3;
+
+CREATE TABLE t4 (
+WHO CHAR(12),
+WEEK INT(2) FIELD_FORMAT='WEEK:[2]:NUMBER',
+WHAT CHAR(32) FIELD_FORMAT='WEEK:[2]:EXPENSE:[X]:WHAT',
+AMOUNT DOUBLE(8,2) FIELD_FORMAT='WEEK:[2]:EXPENSE:[X]:AMOUNT')
+ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='expense.json';
+SELECT * FROM t4;
+
+--echo #
+--echo # The expanded table is made as a TBL table
+--echo #
+CREATE TABLE t1 (
+WHO CHAR(12),
+WEEK INT(2),
+WHAT CHAR(32),
+AMOUNT DOUBLE(8,2))
+ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t2,t3,t4';
+SELECT * FROM t1;
+DROP TABLE t1, t2, t3, t4;
+
+--echo #
+--echo # Three partial JSON tables
+--echo #
+CREATE TABLE t2 (
+WHO CHAR(12),
+WEEK INT(2),
+WHAT CHAR(32) FIELD_FORMAT='EXPENSE:[X]:WHAT',
+AMOUNT DOUBLE(8,2) FIELD_FORMAT='EXPENSE:[X]:AMOUNT')
+ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='mulexp3.json';
+SELECT * FROM t2;
+
+CREATE TABLE t3 (
+WHO CHAR(12),
+WEEK INT(2),
+WHAT CHAR(32) FIELD_FORMAT='EXPENSE:[X]:WHAT',
+AMOUNT DOUBLE(8,2) FIELD_FORMAT='EXPENSE:[X]:AMOUNT')
+ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='mulexp4.json';
+SELECT * FROM t3;
+
+CREATE TABLE t4 (
+WHO CHAR(12),
+WEEK INT(2),
+WHAT CHAR(32) FIELD_FORMAT='EXPENSE:[X]:WHAT',
+AMOUNT DOUBLE(8,2) FIELD_FORMAT='EXPENSE:[X]:AMOUNT')
+ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='mulexp5.json';
+SELECT * FROM t4;
+
+--echo #
+--echo # The complete table can be a multiple JSON table
+--echo #
+CREATE TABLE t1 (
+WHO CHAR(12),
+WEEK INT(2),
+WHAT CHAR(32) FIELD_FORMAT='EXPENSE:[X]:WHAT',
+AMOUNT DOUBLE(8,2) FIELD_FORMAT='EXPENSE:[X]:AMOUNT')
+ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='mulexp*.json' MULTIPLE=1;
+SELECT * FROM t1 ORDER BY WHO, WEEK, WHAT, AMOUNT;
+DROP TABLE t1;
+
+--echo #
+--echo # Or also a partition JSON table
+--echo #
+CREATE TABLE t1 (
+WHO CHAR(12),
+WEEK INT(2),
+WHAT CHAR(32) FIELD_FORMAT='EXPENSE:[X]:WHAT',
+AMOUNT DOUBLE(8,2) FIELD_FORMAT='EXPENSE:[X]:AMOUNT')
+ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='mulexp%s.json';
+ALTER TABLE t1
+PARTITION BY LIST COLUMNS(WEEK) (
+PARTITION `3` VALUES IN(3),
+PARTITION `4` VALUES IN(4),
+PARTITION `5` VALUES IN(5));
+SHOW WARNINGS;
+SELECT * FROM t1;
+SELECT * FROM t1 WHERE WEEK = 4;
+DROP TABLE t1, t2, t3, t4;
+
+#
+# Clean up
+#
+--remove_file $MYSQLD_DATADIR/test/biblio.json
+--remove_file $MYSQLD_DATADIR/test/expense.json
+--remove_file $MYSQLD_DATADIR/test/mulexp3.json
+--remove_file $MYSQLD_DATADIR/test/mulexp4.json
+--remove_file $MYSQLD_DATADIR/test/mulexp5.json
diff --git a/storage/connect/mysql-test/connect/t/json_udf.inc b/storage/connect/mysql-test/connect/t/json_udf.inc
new file mode 100644
index 00000000000..098fff3663e
--- /dev/null
+++ b/storage/connect/mysql-test/connect/t/json_udf.inc
@@ -0,0 +1,36 @@
+--disable_query_log
+#
+# Check if server has support for loading plugins
+#
+if (`SELECT @@have_dynamic_loading != 'YES'`) {
+ --skip UDF requires dynamic loading
+}
+if (!$HA_CONNECT_SO) {
+ --skip Needs a dynamically built ha_connect.so
+}
+
+let $is_win = `select convert(@@version_compile_os using latin1) IN ("Win32","Win64","Windows")`;
+
+if ($is_win)
+{
+--eval CREATE FUNCTION Json_Array RETURNS STRING SONAME 'ha_connect.dll';
+--eval CREATE FUNCTION Json_Array_Add RETURNS STRING SONAME 'ha_connect.dll';
+--eval CREATE FUNCTION Json_Object RETURNS STRING SONAME 'ha_connect.dll';
+--eval CREATE FUNCTION Json_Object_Nonull RETURNS STRING SONAME 'ha_connect.dll';
+--eval CREATE FUNCTION Json_Value returns STRING SONAME 'ha_connect.dll';
+--eval CREATE AGGREGATE FUNCTION Json_Array_Grp RETURNS STRING SONAME 'ha_connect.dll';
+--eval CREATE AGGREGATE FUNCTION Json_Object_Grp RETURNS STRING SONAME 'ha_connect.dll';
+}
+
+if (!$is_win)
+{
+--eval CREATE FUNCTION Json_Array RETURNS STRING SONAME 'ha_connect.so';
+--eval CREATE FUNCTION Json_Array_Add RETURNS STRING SONAME 'ha_connect.so';
+--eval CREATE FUNCTION Json_Object RETURNS STRING SONAME 'ha_connect.so';
+--eval CREATE FUNCTION Json_Object_Nonull RETURNS STRING SONAME 'ha_connect.so';
+--eval CREATE FUNCTION Json_Value returns STRING SONAME 'ha_connect.so';
+--eval CREATE AGGREGATE FUNCTION Json_Array_Grp RETURNS STRING SONAME 'ha_connect.so';
+--eval CREATE AGGREGATE FUNCTION Json_Object_Grp RETURNS STRING SONAME 'ha_connect.so';
+}
+--enable_query_log
+
diff --git a/storage/connect/mysql-test/connect/t/json_udf.test b/storage/connect/mysql-test/connect/t/json_udf.test
new file mode 100644
index 00000000000..b4427517ca5
--- /dev/null
+++ b/storage/connect/mysql-test/connect/t/json_udf.test
@@ -0,0 +1,93 @@
+--source json_udf.inc
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+
+--copy_file $MTR_SUITE_DIR/std_data/biblio.json $MYSQLD_DATADIR/test/biblio.json
+--copy_file $MTR_SUITE_DIR/std_data/employee.dat $MYSQLD_DATADIR/test/employee.dat
+
+--echo #
+--echo # Test UDF's with constant arguments
+--echo #
+SELECT Json_Array();
+SELECT Json_Object(56,3.1416,'foo',NULL);
+SELECT Json_Object(56 qty,3.1416 price,'foo' truc, NULL garanty);
+SELECT Json_Array(56,3.1416,'My name is "Foo"',NULL);
+--error ER_CANT_INITIALIZE_UDF
+SELECT Json_Array_Add(Json_Array(56,3.1416,'foo',NULL)) Array;
+SELECT Json_Array_Add(Json_Array(56,3.1416,'foo',NULL),'One more') Array;
+SELECT Json_Array_Add(Json_Value('one value'),'One more');
+--error ER_CANT_INITIALIZE_UDF
+SELECT Json_Array_Add('one value','One more');
+SELECT Json_Array_Add('one value' json_,'One more');
+--error ER_CANT_INITIALIZE_UDF
+SELECT Json_Value(56,3.1416,'foo',NULL);
+SELECT Json_Value(3.1416);
+SELECT Json_Value('foo');
+SELECT Json_Value(NULL);
+SELECT Json_Value();
+SELECT Json_Object();
+SELECT Json_Object(Json_Array(56,3.1416,'foo'),NULL);
+SELECT Json_Array(Json_Array(56,3.1416,'foo'),NULL);
+SELECT Json_Array(Json_Object(56 "qty",3.1416 "price",'foo'),NULL);
+
+--echo #
+--echo # Test UDF's with column arguments
+--echo #
+CREATE TABLE t1
+(
+ ISBN CHAR(15),
+ LANG CHAR(2),
+ SUBJECT CHAR(32),
+ AUTHOR CHAR(64),
+ TITLE CHAR(32),
+ TRANSLATION CHAR(32),
+ TRANSLATOR CHAR(80),
+ PUBLISHER CHAR(32),
+ DATEPUB int(4)
+) ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.json';
+
+SELECT Json_Array(AUTHOR, TITLE, DATEPUB) FROM t1;
+SELECT Json_Object(AUTHOR, TITLE, DATEPUB) FROM t1;
+--error ER_CANT_INITIALIZE_UDF
+SELECT Json_Array_Grp(TITLE, DATEPUB) FROM t1;
+SELECT Json_Array_Grp(TITLE) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (
+ SERIALNO CHAR(5) NOT NULL,
+ NAME VARCHAR(12) NOT NULL FLAG=6,
+ SEX SMALLINT(1) NOT NULL,
+ TITLE VARCHAR(15) NOT NULL FLAG=20,
+ MANAGER CHAR(5) DEFAULT NULL,
+ DEPARTMENT CHAr(4) NOT NULL FLAG=41,
+ SECRETARY CHAR(5) DEFAULT NULL FLAG=46,
+ SALARY DOUBLE(8,2) NOT NULL FLAG=52
+) ENGINE=CONNECT TABLE_TYPE=FIX BLOCK_SIZE=8 FILE_NAME='employee.dat' ENDING=1;
+
+SELECT Json_Object(SERIALNO, NAME, TITLE, SALARY) FROM t1 WHERE NAME = 'MERCHANT';
+SELECT DEPARTMENT, Json_Array_Grp(NAME) FROM t1 GROUP BY DEPARTMENT;
+set connect_json_grp_size=30;
+SELECT Json_Array(DEPARTMENT, Json_Array_Grp(NAME)) FROM t1 GROUP BY DEPARTMENT;
+SELECT Json_Object(DEPARTMENT, Json_Array_Grp(NAME) json_NAMES) FROM t1 GROUP BY DEPARTMENT;
+SELECT Json_Object(DEPARTMENT, Json_Array_Grp(Json_Object(SERIALNO, NAME, TITLE, SALARY)) json_EMPLOYES) FROM t1 GROUP BY DEPARTMENT;
+SELECT Json_Object(DEPARTMENT, TITLE, Json_Array_Grp(Json_Object(SERIALNO, NAME, SALARY)) json_EMPLOYES) FROM t1 GROUP BY DEPARTMENT, TITLE;
+--error ER_CANT_INITIALIZE_UDF
+SELECT Json_Object_Grp(SALARY) FROM t1;
+SELECT Json_Object_Grp(SALARY, NAME) FROM t1;
+SELECT Json_Object(DEPARTMENT, Json_Object_Grp(SALARY, NAME) "Json_SALARIES") FROM t1 GROUP BY DEPARTMENT;
+SELECT Json_Array_Grp(NAME) from t1;
+DROP TABLE t1;
+
+DROP FUNCTION Json_Array;
+DROP FUNCTION Json_Array_Add;
+DROP FUNCTION Json_Object;
+DROP FUNCTION Json_Object_Nonull;
+DROP FUNCTION Json_Value;
+DROP FUNCTION Json_Array_Grp;
+DROP FUNCTION Json_Object_Grp;
+
+#
+# Clean up
+#
+--remove_file $MYSQLD_DATADIR/test/biblio.json
+--remove_file $MYSQLD_DATADIR/test/employee.dat
diff --git a/storage/connect/mysql-test/connect/t/mrr.test b/storage/connect/mysql-test/connect/t/mrr.test
index 37289ad427f..4b9e64bdaa3 100644
--- a/storage/connect/mysql-test/connect/t/mrr.test
+++ b/storage/connect/mysql-test/connect/t/mrr.test
@@ -1,66 +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
+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/mul.test b/storage/connect/mysql-test/connect/t/mul.test
index 451b38799ad..97caba02b86 100644
--- a/storage/connect/mysql-test/connect/t/mul.test
+++ b/storage/connect/mysql-test/connect/t/mul.test
@@ -1,43 +1,43 @@
---echo #
---echo # Testing multiple 1
---echo #
-CREATE TABLE `t1` (
- `a` char(10) DEFAULT NULL,
- `b` char(10) DEFAULT NULL
-) ENGINE=CONNECT DEFAULT CHARSET=latin1 `table_type`=CSV `sep_char`=';';
-INSERT INTO t1 VALUES('test1','bla');
-SELECT * FROM t1;
-
-CREATE TABLE `t2` (
- `a` char(10) DEFAULT NULL,
- `b` char(10) DEFAULT NULL
-) ENGINE=CONNECT DEFAULT CHARSET=latin1 `table_type`=CSV `sep_char`=';';
-INSERT INTO t2 VALUES('test2','blub');
-SELECT * FROM t2;
-
-CREATE TABLE `t_all` (
- `a` char(10) DEFAULT NULL,
- `b` char(10) DEFAULT NULL
-) ENGINE=CONNECT DEFAULT CHARSET=latin1 `table_type`=CSV `file_name`='t*.csv' `sep_char`=';' `multiple`=1;
-SELECT * FROM t_all order by `a`;
-
---echo #
---echo # Testing multiple 2
---echo #
-CREATE table fnlist (
-fn char(8) not null
-) ENGINE=CONNECT DEFAULT CHARSET=latin1 table_type=DOS;
-INSERT INTO fnlist VALUES('t1.csv'),('t2.csv');
-SELECT fn FROM fnlist;
-
-CREATE TABLE `tblist` (
- `a` char(10) DEFAULT NULL,
- `b` char(10) DEFAULT NULL
-) ENGINE=CONNECT DEFAULT CHARSET=latin1 `table_type`=CSV `file_name`='fnlist.dos' `sep_char`=';' `multiple`=2;
-SELECT * FROM tblist;
-
-DROP TABLE t1;
-DROP TABLE t2;
-DROP TABLE t_all;
-DROP TABLE fnlist;
-DROP TABLE tblist;
+--echo #
+--echo # Testing multiple 1
+--echo #
+CREATE TABLE `t1` (
+ `a` char(10) DEFAULT NULL,
+ `b` char(10) DEFAULT NULL
+) ENGINE=CONNECT DEFAULT CHARSET=latin1 `table_type`=CSV `sep_char`=';';
+INSERT INTO t1 VALUES('test1','bla');
+SELECT * FROM t1;
+
+CREATE TABLE `t2` (
+ `a` char(10) DEFAULT NULL,
+ `b` char(10) DEFAULT NULL
+) ENGINE=CONNECT DEFAULT CHARSET=latin1 `table_type`=CSV `sep_char`=';';
+INSERT INTO t2 VALUES('test2','blub');
+SELECT * FROM t2;
+
+CREATE TABLE `t_all` (
+ `a` char(10) DEFAULT NULL,
+ `b` char(10) DEFAULT NULL
+) ENGINE=CONNECT DEFAULT CHARSET=latin1 `table_type`=CSV `file_name`='t*.csv' `sep_char`=';' `multiple`=1;
+SELECT * FROM t_all order by `a`;
+
+--echo #
+--echo # Testing multiple 2
+--echo #
+CREATE table fnlist (
+fn char(8) not null
+) ENGINE=CONNECT DEFAULT CHARSET=latin1 table_type=DOS;
+INSERT INTO fnlist VALUES('t1.csv'),('t2.csv');
+SELECT fn FROM fnlist;
+
+CREATE TABLE `tblist` (
+ `a` char(10) DEFAULT NULL,
+ `b` char(10) DEFAULT NULL
+) ENGINE=CONNECT DEFAULT CHARSET=latin1 `table_type`=CSV `file_name`='fnlist.dos' `sep_char`=';' `multiple`=2;
+SELECT * FROM tblist;
+
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t_all;
+DROP TABLE fnlist;
+DROP TABLE tblist;
diff --git a/storage/connect/mysql-test/connect/t/myconn.inc b/storage/connect/mysql-test/connect/t/myconn.inc
index bdd60687d87..54c698e7c0f 100644
--- a/storage/connect/mysql-test/connect/t/myconn.inc
+++ b/storage/connect/mysql-test/connect/t/myconn.inc
@@ -1,27 +1,27 @@
---source include/not_embedded.inc
-
-let $PORT= `select @@port`;
-
---disable_query_log
---replace_result $PORT PORT
---error 0,ER_UNKNOWN_ERROR
-eval CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=MYSQL
- CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/tx1';
-if (!`SELECT count(*) FROM INFORMATION_SCHEMA.TABLES
- WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'
- AND ENGINE='CONNECT'
- AND CREATE_OPTIONS LIKE '%`table_type`=MySQL%'`)
-{
- Skip Need MySQL support;
-}
-DROP TABLE t1;
---enable_query_log
-
-connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,);
-connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,);
-
-connection master;
-CREATE DATABASE connect;
-
-connection slave;
-CREATE DATABASE connect;
+--source include/not_embedded.inc
+
+let $PORT= `select @@port`;
+
+--disable_query_log
+--replace_result $PORT PORT
+--error 0,ER_UNKNOWN_ERROR
+eval CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=MYSQL
+ CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/tx1';
+if (!`SELECT count(*) FROM INFORMATION_SCHEMA.TABLES
+ WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'
+ AND ENGINE='CONNECT'
+ AND CREATE_OPTIONS LIKE '%`table_type`=MySQL%'`)
+{
+ Skip Need MySQL support;
+}
+DROP TABLE t1;
+--enable_query_log
+
+connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,);
+connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,);
+
+connection master;
+CREATE DATABASE connect;
+
+connection slave;
+CREATE DATABASE connect;
diff --git a/storage/connect/mysql-test/connect/t/myconn_cleanup.inc b/storage/connect/mysql-test/connect/t/myconn_cleanup.inc
index ba2d99ed8b4..db473e512c1 100644
--- a/storage/connect/mysql-test/connect/t/myconn_cleanup.inc
+++ b/storage/connect/mysql-test/connect/t/myconn_cleanup.inc
@@ -1,9 +1,9 @@
-connection master;
---disable_warnings
-DROP TABLE IF EXISTS connect.t1;
-DROP DATABASE IF EXISTS connect;
-
-connection slave;
-DROP TABLE IF EXISTS connect.t1;
-DROP DATABASE IF EXISTS connect;
---enable_warnings
+connection master;
+--disable_warnings
+DROP TABLE IF EXISTS connect.t1;
+DROP DATABASE IF EXISTS connect;
+
+connection slave;
+DROP TABLE IF EXISTS connect.t1;
+DROP DATABASE IF EXISTS connect;
+--enable_warnings
diff --git a/storage/connect/mysql-test/connect/t/mysql.test b/storage/connect/mysql-test/connect/t/mysql.test
index e245587e562..7585c202b8b 100644
--- a/storage/connect/mysql-test/connect/t/mysql.test
+++ b/storage/connect/mysql-test/connect/t/mysql.test
@@ -1,472 +1,472 @@
--- source include/not_embedded.inc
-
-#
-# TODO: consider a possibility to run this test
-# against some remote MySQL server
-#
-
-let $PORT= `select @@port`;
-
---disable_query_log
---replace_result $PORT PORT
---error 0,ER_UNKNOWN_ERROR
---eval CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='tx1' OPTION_LIST='host=localhost,user=root,port=$PORT'
-if (!`SELECT count(*) FROM INFORMATION_SCHEMA.TABLES
- WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'
- AND ENGINE='CONNECT'
- AND CREATE_OPTIONS LIKE '%`table_type`=MySQL%'`)
-{
- Skip Need MySQL support;
-}
-DROP TABLE t1;
---enable_query_log
-
-# TODO: remote VARCHAR is displayed as CHAR
-
-CREATE TABLE t1 (a int, b char(10));
-INSERT INTO t1 VALUES (NULL,NULL),(0,'test00'),(1,'test01'),(2,'test02'),(3,'test03');
-SELECT * FROM t1;
-
---echo #
---echo # Testing errors
---echo #
-
-# Bad user name
-# Suppress "mysql_real_connect failed:" (printed in _DEBUG build)
---replace_result $PORT PORT "mysql_real_connect failed: " ""
---error ER_UNKNOWN_ERROR
---eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root1,port=$PORT'
-
-# Bad database name
---replace_result $PORT PORT "mysql_real_connect failed: " ""
---error ER_UNKNOWN_ERROR
---eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL DBNAME='unknown' TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
-
-# Bad database name, with OPTION_LIST going first.
---replace_result $PORT PORT "mysql_real_connect failed: " ""
---error ER_UNKNOWN_ERROR
---eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL OPTION_LIST='host=localhost,user=root,port=$PORT' DBNAME='unknown' TABNAME='t1'
-
-# Bad table name
---replace_result $PORT PORT
---error ER_UNKNOWN_ERROR
---eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='unknown' OPTION_LIST='host=localhost,user=root,port=$PORT'
---error ER_NO_SUCH_TABLE
-SHOW CREATE TABLE t2;
-
-# Bad column name
---replace_result $PORT PORT
---eval CREATE TABLE t2 (x int, y char(10)) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
---replace_result $PORT PORT
-SHOW CREATE TABLE t2;
---error ER_GET_ERRMSG
-SELECT * FROM t2;
-DROP TABLE t2;
-
-# The remote table disappeared
---replace_result $PORT PORT
---eval CREATE TABLE t2 (a int, b char(10)) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
-ALTER TABLE t1 RENAME t1backup;
---error ER_GET_ERRMSG
-SELECT * FROM t2;
-ALTER TABLE t1backup RENAME t1;
-DROP TABLE t2;
-
-
---echo #
---echo # Testing SELECT, etc.
---echo #
-
-# Automatic table structure
---replace_result $PORT PORT
---eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
---replace_result $PORT PORT
-SHOW CREATE TABLE t2;
-SELECT * FROM t2;
-DROP TABLE t2;
-
-
-# Explicit table structure
---replace_result $PORT PORT
---eval CREATE TABLE t2 (a int, b char(10)) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
---replace_result $PORT PORT
-SHOW CREATE TABLE t2;
-SELECT * FROM t2;
-DROP TABLE t2;
-
-
-# Explicit table structure: remote NULL, local NOT NULL
---replace_result $PORT PORT
---eval CREATE TABLE t2 (a INT NOT NULL, b CHAR(10) NOT NULL) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
---replace_result $PORT PORT
-SHOW CREATE TABLE t2;
-SELECT * FROM t2;
-DROP TABLE t2;
-
-
-# Explicit table structure with wrong column types
---replace_result $PORT PORT
---eval CREATE TABLE t2 (a char(10), b int) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
---replace_result $PORT PORT
-SHOW CREATE TABLE t2;
-SELECT * FROM t2;
-DROP TABLE t2;
-
-DROP TABLE t1;
-
---echo #
---echo # Testing numeric data types
---echo #
-
-# TODO: tinyint is mapped to smallint
-#CREATE TABLE t1 (a tinyint);
-#--replace_result $PORT PORT
-#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
-#--replace_result $PORT PORT
-#SHOW CREATE TABLE t1;
-#--replace_result $PORT PORT
-#SHOW CREATE TABLE t2;
-#SELECT * FROM t2;
-#DROP TABLE t2, t1;
-
-# TODO: unsigned does not work
-#CREATE TABLE t1 (a tinyint unsigned);
-#--replace_result $PORT PORT
-#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
-#SHOW CREATE TABLE t1;
-#--replace_result $PORT PORT
-#SHOW CREATE TABLE t2;
-#SELECT * FROM t2;
-#DROP TABLE t2, t1;
-
-CREATE TABLE t1 (a smallint);
---replace_result $PORT PORT
---eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
---replace_result $PORT PORT
-SHOW CREATE TABLE t1;
---replace_result $PORT PORT
-SHOW CREATE TABLE t2;
-SELECT * FROM t2;
-DROP TABLE t2, t1;
-
-CREATE TABLE t1 (a mediumint);
---replace_result $PORT PORT
---eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
---replace_result $PORT PORT
-SHOW CREATE TABLE t1;
---replace_result $PORT PORT
-SHOW CREATE TABLE t2;
-SELECT * FROM t2;
-DROP TABLE t2, t1;
-
-CREATE TABLE t1 (a int);
---replace_result $PORT PORT
---eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
---replace_result $PORT PORT
-SHOW CREATE TABLE t1;
---replace_result $PORT PORT
-SHOW CREATE TABLE t2;
-SELECT * FROM t2;
-DROP TABLE t2, t1;
-
-
-# TODO: bigint is mapped to double(20,0)
-CREATE TABLE t1 (a bigint);
---replace_result $PORT PORT
---eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
---replace_result $PORT PORT
-SHOW CREATE TABLE t1;
---replace_result $PORT PORT
-SHOW CREATE TABLE t2;
-SELECT * FROM t2;
-DROP TABLE t2, t1;
-
-
-# TODO: ERROR 1439: Display width out of range for 'a' (max = 255)
-#CREATE TABLE t1 (a float);
-#--replace_result $PORT PORT
-#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
-#--replace_result $PORT PORT
-#SHOW CREATE TABLE t1;
-#--replace_result $PORT PORT
-#SHOW CREATE TABLE t2;
-#SELECT * FROM t2;
-#DROP TABLE t2, t1;
-
-# TODO: ERROR 1439: Display width out of range for 'a' (max = 255)
-#CREATE TABLE t1 (a double);
-#--replace_result $PORT PORT
-#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
-#--replace_result $PORT PORT
-#SHOW CREATE TABLE t1;
-#--replace_result $PORT PORT
-#SHOW CREATE TABLE t2;
-#SELECT * FROM t2;
-#DROP TABLE t2, t1;
-
-# TODO: decimal is converted to double
-#CREATE TABLE t1 (a decimal(20,5));
-#--replace_result $PORT PORT
-#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
-#--replace_result $PORT PORT
-#SHOW CREATE TABLE t1;
-#--replace_result $PORT PORT
-#SHOW CREATE TABLE t2;
-#SELECT * FROM t2;
-#DROP TABLE t2, t1;
-
-# TODO: add test for BIT
-
---echo #
---echo # Testing character data types
---echo #
-
-# TODO: char is mapped to varchar
-CREATE TABLE t1 (a char(10));
---replace_result $PORT PORT
---eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
---replace_result $PORT PORT
-SHOW CREATE TABLE t1;
---replace_result $PORT PORT
-SHOW CREATE TABLE t2;
-SELECT * FROM t2;
-DROP TABLE t2, t1;
-
-CREATE TABLE t1 (a varchar(10));
---replace_result $PORT PORT
---eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
---replace_result $PORT PORT
-SHOW CREATE TABLE t1;
---replace_result $PORT PORT
-SHOW CREATE TABLE t2;
-SELECT * FROM t2;
-DROP TABLE t2, t1;
-
-# TODO: ERROR 1105: Unsupported column type tinytext
-#CREATE TABLE t1 (a tinytext);
-#--replace_result $PORT PORT
-#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
-#--replace_result $PORT PORT
-#SHOW CREATE TABLE t1;
-#--replace_result $PORT PORT
-#SHOW CREATE TABLE t2;
-#SELECT * FROM t2;
-#DROP TABLE t2, t1;
-
-# TODO: ERROR 1105: Unsupported column type mediumtext
-#CREATE TABLE t1 (a mediumtext);
-#--replace_result $PORT PORT
-#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
-#--replace_result $PORT PORT
-#SHOW CREATE TABLE t1;
-#--replace_result $PORT PORT
-#SHOW CREATE TABLE t2;
-#SELECT * FROM t2;
-#DROP TABLE t2, t1;
-
-# TODO: text is converted to varchar(256)
-#CREATE TABLE t1 (a text);
-#--replace_result $PORT PORT
-#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
-#--replace_result $PORT PORT
-#SHOW CREATE TABLE t1;
-#--replace_result $PORT PORT
-#SHOW CREATE TABLE t2;
-#SELECT * FROM t2;
-#DROP TABLE t2, t1;
-
-# TODO: ERROR 1105: Unsupported column type longtext
-#CREATE TABLE t1 (a longtext);
-#--replace_result $PORT PORT
-#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
-#--replace_result $PORT PORT
-#SHOW CREATE TABLE t1;
-#--replace_result $PORT PORT
-#SHOW CREATE TABLE t2;
-#SELECT * FROM t2;
-#DROP TABLE t2, t1;
-
-#TODO: add tests for ENUM
-#TODO: add tests for SET
-
---echo #
---echo # Testing binary data types
---echo #
-
-# TODO: ERROR 1105: Unsupported column type binary
-#CREATE TABLE t1 (a binary(10));
-#--replace_result $PORT PORT
-#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
-#--replace_result $PORT PORT
-#SHOW CREATE TABLE t1;
-#--replace_result $PORT PORT
-#SHOW CREATE TABLE t2;
-#SELECT * FROM t2;
-#DROP TABLE t2, t1;
-
-# TODO: ERROR 1105: Unsupported column type varbinary
-#CREATE TABLE t1 (a varbinary(10));
-#--replace_result $PORT PORT
-#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
-#--replace_result $PORT PORT
-#SHOW CREATE TABLE t1;
-#--replace_result $PORT PORT
-#SHOW CREATE TABLE t2;
-#SELECT * FROM t2;
-#DROP TABLE t2, t1;
-
-# TODO: ERROR 1105: Unsupported column type tinyblob
-#CREATE TABLE t1 (a tinyblob);
-#--replace_result $PORT PORT
-#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
-#--replace_result $PORT PORT
-#SHOW CREATE TABLE t1;
-#--replace_result $PORT PORT
-#SHOW CREATE TABLE t2;
-#SELECT * FROM t2;
-#DROP TABLE t2, t1;
-
-# TODO: ERROR 1105: Unsupported column type mediumblob
-#CREATE TABLE t1 (a mediumblob);
-#--replace_result $PORT PORT
-#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
-#--replace_result $PORT PORT
-#SHOW CREATE TABLE t1;
-#--replace_result $PORT PORT
-#SHOW CREATE TABLE t2;
-#SELECT * FROM t2;
-#DROP TABLE t2, t1;
-
-# TODO: blob is converted to varchar(256)
-#CREATE TABLE t1 (a blob);
-#--replace_result $PORT PORT
-#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
-#--replace_result $PORT PORT
-#SHOW CREATE TABLE t1;
-#--replace_result $PORT PORT
-#SHOW CREATE TABLE t2;
-#SELECT * FROM t2;
-#DROP TABLE t2, t1;
-
-# TODO: ERROR 1105: Unsupported column type longblob
-#CREATE TABLE t1 (a longblob);
-#--replace_result $PORT PORT
-#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
-#--replace_result $PORT PORT
-#SHOW CREATE TABLE t1;
-#--replace_result $PORT PORT
-#SHOW CREATE TABLE t2;
-#SELECT * FROM t2;
-#DROP TABLE t2, t1;
-
-# TODO: ERROR 1105: Unsupported column type geometry
-#CREATE TABLE t1 (a geometry);
-#--replace_result $PORT PORT
-#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
-#--replace_result $PORT PORT
-#SHOW CREATE TABLE t1;
-#--replace_result $PORT PORT
-#SHOW CREATE TABLE t2;
-#SELECT * FROM t2;
-#DROP TABLE t2, t1;
-
---echo #
---echo # Testing temporal data types
---echo #
-
-# TODO: time is converted to date
-#CREATE TABLE t1 (a time);
-#--replace_result $PORT PORT
-#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
-#--replace_result $PORT PORT
-#SHOW CREATE TABLE t1;
-#--replace_result $PORT PORT
-#SHOW CREATE TABLE t2;
-#SELECT * FROM t2;
-#DROP TABLE t2, t1;
-
-CREATE TABLE t1 (a date);
---replace_result $PORT PORT
---eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
---replace_result $PORT PORT
-SHOW CREATE TABLE t1;
---replace_result $PORT PORT
-SHOW CREATE TABLE t2;
-SELECT * FROM t2;
-DROP TABLE t2, t1;
-
-# TODO: datetime is converted to date
-#CREATE TABLE t1 (a datetime);
-#--replace_result $PORT PORT
-#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
-#--replace_result $PORT PORT
-#SHOW CREATE TABLE t1;
-#--replace_result $PORT PORT
-#SHOW CREATE TABLE t2;
-#SELECT * FROM t2;
-#DROP TABLE t2, t1;
-
-# TODO: timestamp is converted to date
-#CREATE TABLE t1 (a timestamp);
-#--replace_result $PORT PORT
-#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
-#--replace_result $PORT PORT
-#SHOW CREATE TABLE t1;
-#--replace_result $PORT PORT
-#SHOW CREATE TABLE t2;
-#SELECT * FROM t2;
-#DROP TABLE t2, t1;
-
-# TODO: add test for YEAR
-# TODO: add tests for fractional seconds
-
---echo #
---echo # MDEV-4877 mysqldump dumps all data from a connect table
---echo #
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (10),(20),(30);
---replace_result $PORT PORT
---eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL CONNECTION='mysql://root@localhost:$PORT/test/t1'
-SELECT * FROM t2;
---echo # Start of mysqldump ------
---replace_result $PORT PORT
---exec $MYSQL_DUMP --compact test t2
---echo # End of mysqldump ------
-DROP TABLE t2;
-DROP TABLE t1;
-
---echo #
---echo # Testing getting unsigned types
---echo #
-CREATE TABLE t1 (
-a TINYINT UNSIGNED NOT NULL,
-b SMALLINT ZEROFILL NOT NULL,
-c INT UNSIGNED NOT NULL,
-d BIGINT UNSIGNED NOT NULL,
-e CHAR(32) NOT NULL DEFAULT 'Hello') ENGINE=CONNECT TABLE_TYPE=FIX;
-DESCRIBE t1;
-INSERT INTO t1(a,b,c,d) VALUES(255,65535,4294967295,18446744073709551615);
-SELECT * FROM t1;
-
-CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME=t1;
-DESCRIBE t2;
-SELECT * FROM t2;
-
-DROP TABLE t2;
-DROP TABLE t1;
-
-#
-# MDEV-6085 ALTER TABLE looses the connection string
-#
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (10),(20),(30);
---replace_result $PORT PORT
---eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL CONNECTION='mysql://root@localhost:$PORT/test/t1'
-SELECT * FROM t2;
-ALTER TABLE t2 MODIFY a TINYINT;
---replace_result $PORT PORT
-SHOW CREATE TABLE t2;
-SELECT * FROM t2;
-DROP TABLE t2;
-DROP TABLE t1;
-
+-- source include/not_embedded.inc
+
+#
+# TODO: consider a possibility to run this test
+# against some remote MySQL server
+#
+
+let $PORT= `select @@port`;
+
+--disable_query_log
+--replace_result $PORT PORT
+--error 0,ER_UNKNOWN_ERROR
+--eval CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='tx1' OPTION_LIST='host=localhost,user=root,port=$PORT'
+if (!`SELECT count(*) FROM INFORMATION_SCHEMA.TABLES
+ WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'
+ AND ENGINE='CONNECT'
+ AND CREATE_OPTIONS LIKE '%`table_type`=MySQL%'`)
+{
+ Skip Need MySQL support;
+}
+DROP TABLE t1;
+--enable_query_log
+
+# TODO: remote VARCHAR is displayed as CHAR
+
+CREATE TABLE t1 (a int, b char(10));
+INSERT INTO t1 VALUES (NULL,NULL),(0,'test00'),(1,'test01'),(2,'test02'),(3,'test03');
+SELECT * FROM t1;
+
+--echo #
+--echo # Testing errors
+--echo #
+
+# Bad user name
+# Suppress "mysql_real_connect failed:" (printed in _DEBUG build)
+--replace_result $PORT PORT "mysql_real_connect failed: " ""
+--error ER_UNKNOWN_ERROR
+--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root1,port=$PORT'
+
+# Bad database name
+--replace_result $PORT PORT "mysql_real_connect failed: " ""
+--error ER_UNKNOWN_ERROR
+--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL DBNAME='unknown' TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
+
+# Bad database name, with OPTION_LIST going first.
+--replace_result $PORT PORT "mysql_real_connect failed: " ""
+--error ER_UNKNOWN_ERROR
+--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL OPTION_LIST='host=localhost,user=root,port=$PORT' DBNAME='unknown' TABNAME='t1'
+
+# Bad table name
+--replace_result $PORT PORT
+--error ER_UNKNOWN_ERROR
+--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='unknown' OPTION_LIST='host=localhost,user=root,port=$PORT'
+--error ER_NO_SUCH_TABLE
+SHOW CREATE TABLE t2;
+
+# Bad column name
+--replace_result $PORT PORT
+--eval CREATE TABLE t2 (x int, y char(10)) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
+--replace_result $PORT PORT
+SHOW CREATE TABLE t2;
+--error ER_GET_ERRMSG
+SELECT * FROM t2;
+DROP TABLE t2;
+
+# The remote table disappeared
+--replace_result $PORT PORT
+--eval CREATE TABLE t2 (a int, b char(10)) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
+ALTER TABLE t1 RENAME t1backup;
+--error ER_GET_ERRMSG
+SELECT * FROM t2;
+ALTER TABLE t1backup RENAME t1;
+DROP TABLE t2;
+
+
+--echo #
+--echo # Testing SELECT, etc.
+--echo #
+
+# Automatic table structure
+--replace_result $PORT PORT
+--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
+--replace_result $PORT PORT
+SHOW CREATE TABLE t2;
+SELECT * FROM t2;
+DROP TABLE t2;
+
+
+# Explicit table structure
+--replace_result $PORT PORT
+--eval CREATE TABLE t2 (a int, b char(10)) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
+--replace_result $PORT PORT
+SHOW CREATE TABLE t2;
+SELECT * FROM t2;
+DROP TABLE t2;
+
+
+# Explicit table structure: remote NULL, local NOT NULL
+--replace_result $PORT PORT
+--eval CREATE TABLE t2 (a INT NOT NULL, b CHAR(10) NOT NULL) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
+--replace_result $PORT PORT
+SHOW CREATE TABLE t2;
+SELECT * FROM t2;
+DROP TABLE t2;
+
+
+# Explicit table structure with wrong column types
+--replace_result $PORT PORT
+--eval CREATE TABLE t2 (a char(10), b int) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
+--replace_result $PORT PORT
+SHOW CREATE TABLE t2;
+SELECT * FROM t2;
+DROP TABLE t2;
+
+DROP TABLE t1;
+
+--echo #
+--echo # Testing numeric data types
+--echo #
+
+# TODO: tinyint is mapped to smallint
+#CREATE TABLE t1 (a tinyint);
+#--replace_result $PORT PORT
+#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
+#--replace_result $PORT PORT
+#SHOW CREATE TABLE t1;
+#--replace_result $PORT PORT
+#SHOW CREATE TABLE t2;
+#SELECT * FROM t2;
+#DROP TABLE t2, t1;
+
+# TODO: unsigned does not work
+#CREATE TABLE t1 (a tinyint unsigned);
+#--replace_result $PORT PORT
+#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
+#SHOW CREATE TABLE t1;
+#--replace_result $PORT PORT
+#SHOW CREATE TABLE t2;
+#SELECT * FROM t2;
+#DROP TABLE t2, t1;
+
+CREATE TABLE t1 (a smallint);
+--replace_result $PORT PORT
+--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
+--replace_result $PORT PORT
+SHOW CREATE TABLE t1;
+--replace_result $PORT PORT
+SHOW CREATE TABLE t2;
+SELECT * FROM t2;
+DROP TABLE t2, t1;
+
+CREATE TABLE t1 (a mediumint);
+--replace_result $PORT PORT
+--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
+--replace_result $PORT PORT
+SHOW CREATE TABLE t1;
+--replace_result $PORT PORT
+SHOW CREATE TABLE t2;
+SELECT * FROM t2;
+DROP TABLE t2, t1;
+
+CREATE TABLE t1 (a int);
+--replace_result $PORT PORT
+--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
+--replace_result $PORT PORT
+SHOW CREATE TABLE t1;
+--replace_result $PORT PORT
+SHOW CREATE TABLE t2;
+SELECT * FROM t2;
+DROP TABLE t2, t1;
+
+
+# TODO: bigint is mapped to double(20,0)
+CREATE TABLE t1 (a bigint);
+--replace_result $PORT PORT
+--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
+--replace_result $PORT PORT
+SHOW CREATE TABLE t1;
+--replace_result $PORT PORT
+SHOW CREATE TABLE t2;
+SELECT * FROM t2;
+DROP TABLE t2, t1;
+
+
+# TODO: ERROR 1439: Display width out of range for 'a' (max = 255)
+#CREATE TABLE t1 (a float);
+#--replace_result $PORT PORT
+#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
+#--replace_result $PORT PORT
+#SHOW CREATE TABLE t1;
+#--replace_result $PORT PORT
+#SHOW CREATE TABLE t2;
+#SELECT * FROM t2;
+#DROP TABLE t2, t1;
+
+# TODO: ERROR 1439: Display width out of range for 'a' (max = 255)
+#CREATE TABLE t1 (a double);
+#--replace_result $PORT PORT
+#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
+#--replace_result $PORT PORT
+#SHOW CREATE TABLE t1;
+#--replace_result $PORT PORT
+#SHOW CREATE TABLE t2;
+#SELECT * FROM t2;
+#DROP TABLE t2, t1;
+
+# TODO: decimal is converted to double
+#CREATE TABLE t1 (a decimal(20,5));
+#--replace_result $PORT PORT
+#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
+#--replace_result $PORT PORT
+#SHOW CREATE TABLE t1;
+#--replace_result $PORT PORT
+#SHOW CREATE TABLE t2;
+#SELECT * FROM t2;
+#DROP TABLE t2, t1;
+
+# TODO: add test for BIT
+
+--echo #
+--echo # Testing character data types
+--echo #
+
+# TODO: char is mapped to varchar
+CREATE TABLE t1 (a char(10));
+--replace_result $PORT PORT
+--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
+--replace_result $PORT PORT
+SHOW CREATE TABLE t1;
+--replace_result $PORT PORT
+SHOW CREATE TABLE t2;
+SELECT * FROM t2;
+DROP TABLE t2, t1;
+
+CREATE TABLE t1 (a varchar(10));
+--replace_result $PORT PORT
+--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
+--replace_result $PORT PORT
+SHOW CREATE TABLE t1;
+--replace_result $PORT PORT
+SHOW CREATE TABLE t2;
+SELECT * FROM t2;
+DROP TABLE t2, t1;
+
+# TODO: ERROR 1105: Unsupported column type tinytext
+#CREATE TABLE t1 (a tinytext);
+#--replace_result $PORT PORT
+#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
+#--replace_result $PORT PORT
+#SHOW CREATE TABLE t1;
+#--replace_result $PORT PORT
+#SHOW CREATE TABLE t2;
+#SELECT * FROM t2;
+#DROP TABLE t2, t1;
+
+# TODO: ERROR 1105: Unsupported column type mediumtext
+#CREATE TABLE t1 (a mediumtext);
+#--replace_result $PORT PORT
+#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
+#--replace_result $PORT PORT
+#SHOW CREATE TABLE t1;
+#--replace_result $PORT PORT
+#SHOW CREATE TABLE t2;
+#SELECT * FROM t2;
+#DROP TABLE t2, t1;
+
+# TODO: text is converted to varchar(256)
+#CREATE TABLE t1 (a text);
+#--replace_result $PORT PORT
+#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
+#--replace_result $PORT PORT
+#SHOW CREATE TABLE t1;
+#--replace_result $PORT PORT
+#SHOW CREATE TABLE t2;
+#SELECT * FROM t2;
+#DROP TABLE t2, t1;
+
+# TODO: ERROR 1105: Unsupported column type longtext
+#CREATE TABLE t1 (a longtext);
+#--replace_result $PORT PORT
+#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
+#--replace_result $PORT PORT
+#SHOW CREATE TABLE t1;
+#--replace_result $PORT PORT
+#SHOW CREATE TABLE t2;
+#SELECT * FROM t2;
+#DROP TABLE t2, t1;
+
+#TODO: add tests for ENUM
+#TODO: add tests for SET
+
+--echo #
+--echo # Testing binary data types
+--echo #
+
+# TODO: ERROR 1105: Unsupported column type binary
+#CREATE TABLE t1 (a binary(10));
+#--replace_result $PORT PORT
+#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
+#--replace_result $PORT PORT
+#SHOW CREATE TABLE t1;
+#--replace_result $PORT PORT
+#SHOW CREATE TABLE t2;
+#SELECT * FROM t2;
+#DROP TABLE t2, t1;
+
+# TODO: ERROR 1105: Unsupported column type varbinary
+#CREATE TABLE t1 (a varbinary(10));
+#--replace_result $PORT PORT
+#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
+#--replace_result $PORT PORT
+#SHOW CREATE TABLE t1;
+#--replace_result $PORT PORT
+#SHOW CREATE TABLE t2;
+#SELECT * FROM t2;
+#DROP TABLE t2, t1;
+
+# TODO: ERROR 1105: Unsupported column type tinyblob
+#CREATE TABLE t1 (a tinyblob);
+#--replace_result $PORT PORT
+#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
+#--replace_result $PORT PORT
+#SHOW CREATE TABLE t1;
+#--replace_result $PORT PORT
+#SHOW CREATE TABLE t2;
+#SELECT * FROM t2;
+#DROP TABLE t2, t1;
+
+# TODO: ERROR 1105: Unsupported column type mediumblob
+#CREATE TABLE t1 (a mediumblob);
+#--replace_result $PORT PORT
+#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
+#--replace_result $PORT PORT
+#SHOW CREATE TABLE t1;
+#--replace_result $PORT PORT
+#SHOW CREATE TABLE t2;
+#SELECT * FROM t2;
+#DROP TABLE t2, t1;
+
+# TODO: blob is converted to varchar(256)
+#CREATE TABLE t1 (a blob);
+#--replace_result $PORT PORT
+#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
+#--replace_result $PORT PORT
+#SHOW CREATE TABLE t1;
+#--replace_result $PORT PORT
+#SHOW CREATE TABLE t2;
+#SELECT * FROM t2;
+#DROP TABLE t2, t1;
+
+# TODO: ERROR 1105: Unsupported column type longblob
+#CREATE TABLE t1 (a longblob);
+#--replace_result $PORT PORT
+#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
+#--replace_result $PORT PORT
+#SHOW CREATE TABLE t1;
+#--replace_result $PORT PORT
+#SHOW CREATE TABLE t2;
+#SELECT * FROM t2;
+#DROP TABLE t2, t1;
+
+# TODO: ERROR 1105: Unsupported column type geometry
+#CREATE TABLE t1 (a geometry);
+#--replace_result $PORT PORT
+#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
+#--replace_result $PORT PORT
+#SHOW CREATE TABLE t1;
+#--replace_result $PORT PORT
+#SHOW CREATE TABLE t2;
+#SELECT * FROM t2;
+#DROP TABLE t2, t1;
+
+--echo #
+--echo # Testing temporal data types
+--echo #
+
+# TODO: time is converted to date
+#CREATE TABLE t1 (a time);
+#--replace_result $PORT PORT
+#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
+#--replace_result $PORT PORT
+#SHOW CREATE TABLE t1;
+#--replace_result $PORT PORT
+#SHOW CREATE TABLE t2;
+#SELECT * FROM t2;
+#DROP TABLE t2, t1;
+
+CREATE TABLE t1 (a date);
+--replace_result $PORT PORT
+--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
+--replace_result $PORT PORT
+SHOW CREATE TABLE t1;
+--replace_result $PORT PORT
+SHOW CREATE TABLE t2;
+SELECT * FROM t2;
+DROP TABLE t2, t1;
+
+# TODO: datetime is converted to date
+#CREATE TABLE t1 (a datetime);
+#--replace_result $PORT PORT
+#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
+#--replace_result $PORT PORT
+#SHOW CREATE TABLE t1;
+#--replace_result $PORT PORT
+#SHOW CREATE TABLE t2;
+#SELECT * FROM t2;
+#DROP TABLE t2, t1;
+
+# TODO: timestamp is converted to date
+#CREATE TABLE t1 (a timestamp);
+#--replace_result $PORT PORT
+#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
+#--replace_result $PORT PORT
+#SHOW CREATE TABLE t1;
+#--replace_result $PORT PORT
+#SHOW CREATE TABLE t2;
+#SELECT * FROM t2;
+#DROP TABLE t2, t1;
+
+# TODO: add test for YEAR
+# TODO: add tests for fractional seconds
+
+--echo #
+--echo # MDEV-4877 mysqldump dumps all data from a connect table
+--echo #
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (10),(20),(30);
+--replace_result $PORT PORT
+--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL CONNECTION='mysql://root@localhost:$PORT/test/t1'
+SELECT * FROM t2;
+--echo # Start of mysqldump ------
+--replace_result $PORT PORT
+--exec $MYSQL_DUMP --compact test t2
+--echo # End of mysqldump ------
+DROP TABLE t2;
+DROP TABLE t1;
+
+--echo #
+--echo # Testing getting unsigned types
+--echo #
+CREATE TABLE t1 (
+a TINYINT UNSIGNED NOT NULL,
+b SMALLINT ZEROFILL NOT NULL,
+c INT UNSIGNED NOT NULL,
+d BIGINT UNSIGNED NOT NULL,
+e CHAR(32) NOT NULL DEFAULT 'Hello') ENGINE=CONNECT TABLE_TYPE=FIX;
+DESCRIBE t1;
+INSERT INTO t1(a,b,c,d) VALUES(255,65535,4294967295,18446744073709551615);
+SELECT * FROM t1;
+
+CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME=t1;
+DESCRIBE t2;
+SELECT * FROM t2;
+
+DROP TABLE t2;
+DROP TABLE t1;
+
+#
+# MDEV-6085 ALTER TABLE looses the connection string
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (10),(20),(30);
+--replace_result $PORT PORT
+--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL CONNECTION='mysql://root@localhost:$PORT/test/t1'
+SELECT * FROM t2;
+ALTER TABLE t2 MODIFY a TINYINT;
+--replace_result $PORT PORT
+SHOW CREATE TABLE t2;
+SELECT * FROM t2;
+DROP TABLE t2;
+DROP TABLE t1;
+
diff --git a/storage/connect/mysql-test/connect/t/mysql_discovery.test b/storage/connect/mysql-test/connect/t/mysql_discovery.test
index 057244a2a97..cd266750274 100644
--- a/storage/connect/mysql-test/connect/t/mysql_discovery.test
+++ b/storage/connect/mysql-test/connect/t/mysql_discovery.test
@@ -1,33 +1,33 @@
--- source myconn.inc
-
-connection slave;
-
-CREATE TABLE t1 (
- `id` int(20) primary key,
- `group` int NOT NULL default 1,
- `a\\b` int NOT NULL default 2,
- `a\\` int unsigned,
- `name` varchar(32) default 'name')
- DEFAULT CHARSET=latin1;
-
-connection master;
-
---replace_result $SLAVE_MYPORT SLAVE_PORT
-eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL
- CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1';
-
---replace_result $SLAVE_MYPORT SLAVE_PORT
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (id, name) VALUES (1, 'foo');
-INSERT INTO t1 (id, name) VALUES (2, 'fee');
---sorted_result
-SELECT * FROM t1;
-DROP TABLE t1;
-
-connection slave;
---sorted_result
-SELECT * FROM t1;
-DROP TABLE t1;
-
--- source myconn_cleanup.inc
-
+-- source myconn.inc
+
+connection slave;
+
+CREATE TABLE t1 (
+ `id` int(20) primary key,
+ `group` int NOT NULL default 1,
+ `a\\b` int NOT NULL default 2,
+ `a\\` int unsigned,
+ `name` varchar(32) default 'name')
+ DEFAULT CHARSET=latin1;
+
+connection master;
+
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL
+ CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1';
+
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+SHOW CREATE TABLE t1;
+INSERT INTO t1 (id, name) VALUES (1, 'foo');
+INSERT INTO t1 (id, name) VALUES (2, 'fee');
+--sorted_result
+SELECT * FROM t1;
+DROP TABLE t1;
+
+connection slave;
+--sorted_result
+SELECT * FROM t1;
+DROP TABLE t1;
+
+-- source myconn_cleanup.inc
+
diff --git a/storage/connect/mysql-test/connect/t/mysql_exec.test b/storage/connect/mysql-test/connect/t/mysql_exec.test
index e56072a63e1..9226592eded 100644
--- a/storage/connect/mysql-test/connect/t/mysql_exec.test
+++ b/storage/connect/mysql-test/connect/t/mysql_exec.test
@@ -1,45 +1,45 @@
--- source myconn.inc
-
---echo #
---echo # Checking Sending Commands
---echo #
-connection master;
-
---replace_result $SLAVE_MYPORT SLAVE_PORT
-eval CREATE TABLE t1 (
- command VARCHAR(128) NOT NULL,
- warnings INT(4) NOT NULL FLAG=3,
- number INT(5) NOT NULL FLAG=1,
- message VARCHAR(255) FLAG=2)
- ENGINE=CONNECT TABLE_TYPE=MYSQL CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/test' OPTION_LIST='Execsrc=1,maxerr=2';
-
-SELECT * FROM t1 WHERE command IN ('Warning','Note',
- 'drop table if exists t1',
- 'create table t1 (id int key auto_increment, msg varchar(32) not null)',
- "insert into t1(msg) values('One'),(NULL),('Three')",
- "insert into t1 values(2,'Deux') on duplicate key update msg = 'Two'",
- "insert into t1(message) values('Four'),('Five'),('Six')",
- 'insert into t1(id) values(NULL)',
- "update t1 set msg = 'Four' where id = 4",
- 'select * from t1');
-
---echo #
---echo # Checking Using Procedure
---echo #
-DROP PROCEDURE IF EXISTS p1;
-CREATE PROCEDURE p1(cmd varchar(512))
- READS SQL DATA
- SELECT * FROM t1 WHERE command IN ('Warning','Note',cmd);
-
-CALL p1('insert into t1(id) values(NULL)');
-CALL p1('update t1 set msg = "Five" where id = 5');
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
-connection slave;
---sorted_result
-SELECT * FROM t1;
-DROP TABLE t1;
-
--- source myconn_cleanup.inc
-
+-- source myconn.inc
+
+--echo #
+--echo # Checking Sending Commands
+--echo #
+connection master;
+
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+eval CREATE TABLE t1 (
+ command VARCHAR(128) NOT NULL,
+ warnings INT(4) NOT NULL FLAG=3,
+ number INT(5) NOT NULL FLAG=1,
+ message VARCHAR(255) FLAG=2)
+ ENGINE=CONNECT TABLE_TYPE=MYSQL CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/test' OPTION_LIST='Execsrc=1,maxerr=2';
+
+SELECT * FROM t1 WHERE command IN ('Warning','Note',
+ 'drop table if exists t1',
+ 'create table t1 (id int key auto_increment, msg varchar(32) not null)',
+ "insert into t1(msg) values('One'),(NULL),('Three')",
+ "insert into t1 values(2,'Deux') on duplicate key update msg = 'Two'",
+ "insert into t1(message) values('Four'),('Five'),('Six')",
+ 'insert into t1(id) values(NULL)',
+ "update t1 set msg = 'Four' where id = 4",
+ 'select * from t1');
+
+--echo #
+--echo # Checking Using Procedure
+--echo #
+DROP PROCEDURE IF EXISTS p1;
+CREATE PROCEDURE p1(cmd varchar(512))
+ READS SQL DATA
+ SELECT * FROM t1 WHERE command IN ('Warning','Note',cmd);
+
+CALL p1('insert into t1(id) values(NULL)');
+CALL p1('update t1 set msg = "Five" where id = 5');
+DROP PROCEDURE p1;
+DROP TABLE t1;
+
+connection slave;
+--sorted_result
+SELECT * FROM t1;
+DROP TABLE t1;
+
+-- source myconn_cleanup.inc
+
diff --git a/storage/connect/mysql-test/connect/t/mysql_grant.test b/storage/connect/mysql-test/connect/t/mysql_grant.test
index 8eb6a90c917..7c75103ed3b 100644
--- a/storage/connect/mysql-test/connect/t/mysql_grant.test
+++ b/storage/connect/mysql-test/connect/t/mysql_grant.test
@@ -1,78 +1,78 @@
--- source include/not_embedded.inc
-
-let $PORT= `select @@port`;
-
---disable_query_log
---replace_result $PORT PORT
---error 0,ER_UNKNOWN_ERROR
---eval CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='tx1' OPTION_LIST='host=localhost,user=root,port=$PORT'
-if (!`SELECT count(*) FROM INFORMATION_SCHEMA.TABLES
- WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'
- AND ENGINE='CONNECT'
- AND CREATE_OPTIONS LIKE '%`table_type`=MySQL%'`)
-{
- Skip Need MySQL support;
-}
-DROP TABLE t1;
---enable_query_log
-
---echo #
---echo # Testing FILE privilege
---echo #
-GRANT ALL PRIVILEGES ON *.* TO user@localhost;
-REVOKE FILE ON *.* FROM user@localhost;
---connect(user,localhost,user,,)
---connection user
-SELECT user();
---replace_result $PORT PORT
---error ER_ACCESS_DENIED_ERROR
---eval CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=MySQL OPTION_LIST='host=localhost,user=root1,port=$PORT'
---connection default
-SELECT user();
-CREATE TABLE t1remote (a INT NOT NULL);
-INSERT INTO t1remote VALUES (10),(20),(30);
---replace_result $PORT PORT
---eval CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=MySQL TABNAME=t1remote OPTION_LIST='host=localhost,user=root,port=$PORT'
-SELECT * FROM t1;
---connection user
-SELECT user();
---error ER_ACCESS_DENIED_ERROR
-SELECT * FROM t1;
---error ER_ACCESS_DENIED_ERROR
-INSERT INTO t1 VALUES ('xxx');
---error ER_ACCESS_DENIED_ERROR
-DELETE FROM t1 WHERE a='xxx';
---error ER_ACCESS_DENIED_ERROR
-UPDATE t1 SET a='yyy' WHERE a='xxx';
---error ER_ACCESS_DENIED_ERROR
-TRUNCATE TABLE t1;
---error ER_ACCESS_DENIED_ERROR
-ALTER TABLE t1 READONLY=1;
---error ER_ACCESS_DENIED_ERROR
-CREATE VIEW v1 AS SELECT * FROM t1;
-
---echo # Testing a VIEW created with FILE privileges but accessed with no FILE
---connection default
-SELECT user();
-CREATE VIEW v1 AS SELECT * FROM t1;
---connection user
-SELECT user();
---error ER_ACCESS_DENIED_ERROR
-SELECT * FROM v1;
---error ER_ACCESS_DENIED_ERROR
-INSERT INTO v1 VALUES (2);
---error ER_ACCESS_DENIED_ERROR
-UPDATE v1 SET a=123;
---error ER_ACCESS_DENIED_ERROR
-DELETE FROM v1;
-
---disconnect user
---connection default
-SELECT user();
-DROP VIEW v1;
-DROP TABLE t1, t1remote;
-DROP USER user@localhost;
---echo #
---echo # Testing FILE privileges done
---echo #
-
+-- source include/not_embedded.inc
+
+let $PORT= `select @@port`;
+
+--disable_query_log
+--replace_result $PORT PORT
+--error 0,ER_UNKNOWN_ERROR
+--eval CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='tx1' OPTION_LIST='host=localhost,user=root,port=$PORT'
+if (!`SELECT count(*) FROM INFORMATION_SCHEMA.TABLES
+ WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'
+ AND ENGINE='CONNECT'
+ AND CREATE_OPTIONS LIKE '%`table_type`=MySQL%'`)
+{
+ Skip Need MySQL support;
+}
+DROP TABLE t1;
+--enable_query_log
+
+--echo #
+--echo # Testing FILE privilege
+--echo #
+GRANT ALL PRIVILEGES ON *.* TO user@localhost;
+REVOKE FILE ON *.* FROM user@localhost;
+--connect(user,localhost,user,,)
+--connection user
+SELECT user();
+--replace_result $PORT PORT
+--error ER_ACCESS_DENIED_ERROR
+--eval CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=MySQL OPTION_LIST='host=localhost,user=root1,port=$PORT'
+--connection default
+SELECT user();
+CREATE TABLE t1remote (a INT NOT NULL);
+INSERT INTO t1remote VALUES (10),(20),(30);
+--replace_result $PORT PORT
+--eval CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=MySQL TABNAME=t1remote OPTION_LIST='host=localhost,user=root,port=$PORT'
+SELECT * FROM t1;
+--connection user
+SELECT user();
+--error ER_ACCESS_DENIED_ERROR
+SELECT * FROM t1;
+--error ER_ACCESS_DENIED_ERROR
+INSERT INTO t1 VALUES ('xxx');
+--error ER_ACCESS_DENIED_ERROR
+DELETE FROM t1 WHERE a='xxx';
+--error ER_ACCESS_DENIED_ERROR
+UPDATE t1 SET a='yyy' WHERE a='xxx';
+--error ER_ACCESS_DENIED_ERROR
+TRUNCATE TABLE t1;
+--error ER_ACCESS_DENIED_ERROR
+ALTER TABLE t1 READONLY=1;
+--error ER_ACCESS_DENIED_ERROR
+CREATE VIEW v1 AS SELECT * FROM t1;
+
+--echo # Testing a VIEW created with FILE privileges but accessed with no FILE
+--connection default
+SELECT user();
+CREATE VIEW v1 AS SELECT * FROM t1;
+--connection user
+SELECT user();
+--error ER_ACCESS_DENIED_ERROR
+SELECT * FROM v1;
+--error ER_ACCESS_DENIED_ERROR
+INSERT INTO v1 VALUES (2);
+--error ER_ACCESS_DENIED_ERROR
+UPDATE v1 SET a=123;
+--error ER_ACCESS_DENIED_ERROR
+DELETE FROM v1;
+
+--disconnect user
+--connection default
+SELECT user();
+DROP VIEW v1;
+DROP TABLE t1, t1remote;
+DROP USER user@localhost;
+--echo #
+--echo # Testing FILE privileges done
+--echo #
+
diff --git a/storage/connect/mysql-test/connect/t/mysql_new.test b/storage/connect/mysql-test/connect/t/mysql_new.test
index 08f27b6b19b..c93f0407ca4 100644
--- a/storage/connect/mysql-test/connect/t/mysql_new.test
+++ b/storage/connect/mysql-test/connect/t/mysql_new.test
@@ -1,325 +1,325 @@
--- source myconn.inc
-
-#
-# This test is run against a remote MySQL server
-#
-
-connection slave;
-
-CREATE TABLE t1 (a int, b char(10));
-INSERT INTO t1 VALUES (NULL,NULL),(0,'test00'),(1,'test01'),(2,'test02'),(3,'test03');
-SELECT * FROM t1;
-
---echo #
---echo # Testing errors
---echo #
-connection master;
-
-# Bad user name
-# Suppress "mysql_real_connect failed:" (printed in _DEBUG build)
---replace_result $SLAVE_MYPORT SLAVE_PORT "mysql_real_connect failed: " ""
---error ER_UNKNOWN_ERROR
-eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL
- CONNECTION='mysql://unknown@127.0.0.1:$SLAVE_MYPORT/test/t1';
-
-# Bad database name
---replace_result $SLAVE_MYPORT SLAVE_PORT "mysql_real_connect failed: " ""
---error ER_UNKNOWN_ERROR
-eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL
- CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/unknown/t1';
-
-# Bad database name, with OPTION_LIST going first.
---replace_result $SLAVE_MYPORT SLAVE_PORT "mysql_real_connect failed: " ""
---error ER_UNKNOWN_ERROR
-eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL
- OPTION_LIST='host=127.0.0.1,user=root,port=$SLAVE_MYPORT' DBNAME='unknown' TABNAME='t1';
-
-# Bad table name
---replace_result $SLAVE_MYPORT SLAVE_PORT
---error ER_UNKNOWN_ERROR
-eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL
- CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/unknown';
---error ER_NO_SUCH_TABLE
-SHOW CREATE TABLE t1;
-
-# Bad column name
---replace_result $SLAVE_MYPORT SLAVE_PORT
-eval CREATE TABLE t1 (x int, y char(10)) ENGINE=CONNECT TABLE_TYPE=MYSQL
- CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1';
---replace_result $SLAVE_MYPORT SLAVE_PORT
-SHOW CREATE TABLE t1;
---error ER_GET_ERRMSG
-SELECT * FROM t1;
-DROP TABLE t1;
-
-# The remote table disappeared
---replace_result $SLAVE_MYPORT SLAVE_PORT
-eval CREATE TABLE t1 (a int, b char(10)) ENGINE=CONNECT TABLE_TYPE=MYSQL
- CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1';
-
-connection slave;
-ALTER TABLE t1 RENAME t1backup;
-
-connection master;
---error ER_GET_ERRMSG
-SELECT * FROM t1;
-
-connection slave;
-ALTER TABLE t1backup RENAME t1;
-
-connection master;
-DROP TABLE t1;
-
---echo #
---echo # Testing SELECT, etc.
---echo #
-
-# Automatic table structure
---replace_result $SLAVE_MYPORT SLAVE_PORT
-eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL
- CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1';
---replace_result $SLAVE_MYPORT SLAVE_PORT
-SHOW CREATE TABLE t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-# Explicit table structure
---replace_result $SLAVE_MYPORT SLAVE_PORT
-eval CREATE TABLE t1 (a int, b char(10)) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1'
- OPTION_LIST='host=127.0.0.1,user=root,port=$SLAVE_MYPORT';
---replace_result $SLAVE_MYPORT SLAVE_PORT
-SHOW CREATE TABLE t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-# Explicit table structure: remote NULL, local NOT NULL
---replace_result $SLAVE_MYPORT SLAVE_PORT
-eval CREATE TABLE t1 (a INT NOT NULL, b CHAR(10) NOT NULL) ENGINE=CONNECT TABLE_TYPE=MYSQL
- OPTION_LIST='host=127.0.0.1,user=root,port=$SLAVE_MYPORT';
---replace_result $SLAVE_MYPORT SLAVE_PORT
-SHOW CREATE TABLE t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-# Explicit table structure with wrong column types
---replace_result $SLAVE_MYPORT SLAVE_PORT
-eval CREATE TABLE t1 (a char(10), b int) ENGINE=CONNECT TABLE_TYPE=MYSQL
- CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1';
---replace_result $SLAVE_MYPORT SLAVE_PORT
-SHOW CREATE TABLE t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-connection slave;
-DROP TABLE t1;
-
---echo #
---echo # Testing numeric data types
---echo #
-
-# TODO: mediumint is converted to int, float is converted to double, decimal is converted to double
-CREATE TABLE t1 (a tinyint, b smallint, c mediumint, d int, e bigint, f float, g double, h decimal(20,5));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES(100,3333,41235,1234567890,235000000000,3.14159265,3.14159265,3141.59265);
-
-connection master;
---replace_result $SLAVE_MYPORT SLAVE_PORT
-eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL
- OPTION_LIST='host=127.0.0.1,user=root,port=$SLAVE_MYPORT';
---replace_result $SLAVE_MYPORT SLAVE_PORT
-SHOW CREATE TABLE t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-connection slave;
-DROP TABLE t1;
-
-# TODO: unsigned does not work
-#CREATE TABLE t1 (a tinyint unsigned);
-#SHOW CREATE TABLE t1;
-
-#connection master;
-#--replace_result $SLAVE_MYPORT SLAVE_PORT
-#eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=127.0.0.1,user=root,port=$SLAVE_MYPORT';
-#--replace_result $SLAVE_MYPORT SLAVE_PORT
-#SHOW CREATE TABLE t1;
-#SELECT * FROM t1;
-#DROP TABLE t1;
-
-#connection slave;
-#DROP TABLE t1;
-
-# TODO: add test for BIT
-
---echo #
---echo # Testing character data types
---echo #
-
-CREATE TABLE t1 (a char(12), b varchar(12));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES('Welcome','Hello, World');
-SELECT * FROM t1;
-
-connection master;
---replace_result $SLAVE_MYPORT SLAVE_PORT
-eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL
- CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT';
---replace_result $SLAVE_MYPORT SLAVE_PORT
-SHOW CREATE TABLE t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-connection slave;
-DROP TABLE t1;
-
-# TODO: ERROR 1105: Unsupported column type tinytext
-#CREATE TABLE t1 (a tinytext);
-#--replace_result $SLAVE_MYPORT SLAVE_PORT
-#eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=127.0.0.1,user=root,port=$SLAVE_MYPORT'
-#--replace_result $SLAVE_MYPORT SLAVE_PORT
-#SHOW CREATE TABLE t1;
-#--replace_result $SLAVE_MYPORT SLAVE_PORT
-#SHOW CREATE TABLE t1;
-#SELECT * FROM t1;
-#DROP TABLE t1, t1;
-
-# TODO: ERROR 1105: Unsupported column type mediumtext
-#CREATE TABLE t1 (a mediumtext);
-#--replace_result $SLAVE_MYPORT SLAVE_PORT
-#eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=127.0.0.1,user=root,port=$SLAVE_MYPORT'
-#--replace_result $SLAVE_MYPORT SLAVE_PORT
-#SHOW CREATE TABLE t1;
-#--replace_result $SLAVE_MYPORT SLAVE_PORT
-#SHOW CREATE TABLE t1;
-#SELECT * FROM t1;
-#DROP TABLE t1, t1;
-
-# TODO: text is converted to varchar(256)
-#CREATE TABLE t1 (a text);
-#--replace_result $SLAVE_MYPORT SLAVE_PORT
-#eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=127.0.0.1,user=root,port=$SLAVE_MYPORT'
-#--replace_result $SLAVE_MYPORT SLAVE_PORT
-#SHOW CREATE TABLE t1;
-#--replace_result $SLAVE_MYPORT SLAVE_PORT
-#SHOW CREATE TABLE t1;
-#SELECT * FROM t1;
-#DROP TABLE t1, t1;
-
-# TODO: ERROR 1105: Unsupported column type longtext
-#CREATE TABLE t1 (a longtext);
-#--replace_result $SLAVE_MYPORT SLAVE_PORT
-#eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=127.0.0.1,user=root,port=$SLAVE_MYPORT'
-#--replace_result $SLAVE_MYPORT SLAVE_PORT
-#SHOW CREATE TABLE t1;
-#--replace_result $SLAVE_MYPORT SLAVE_PORT
-#SHOW CREATE TABLE t1;
-#SELECT * FROM t1;
-#DROP TABLE t1, t1;
-
-#TODO: add tests for ENUM
-#TODO: add tests for SET
-
-#--echo #
-#--echo # Testing binary data types
-#--echo #
-
-# TODO: ERROR 1105: Unsupported column type binary
-#CREATE TABLE t1 (a binary(10));
-#--replace_result $SLAVE_MYPORT SLAVE_PORT
-#eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=127.0.0.1,user=root,port=$SLAVE_MYPORT'
-#--replace_result $SLAVE_MYPORT SLAVE_PORT
-#SHOW CREATE TABLE t1;
-#--replace_result $SLAVE_MYPORT SLAVE_PORT
-#SHOW CREATE TABLE t1;
-#SELECT * FROM t1;
-#DROP TABLE t1, t1;
-
-# TODO: ERROR 1105: Unsupported column type varbinary
-#CREATE TABLE t1 (a varbinary(10));
-#--replace_result $SLAVE_MYPORT SLAVE_PORT
-#eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=127.0.0.1,user=root,port=$SLAVE_MYPORT'
-#--replace_result $SLAVE_MYPORT SLAVE_PORT
-#SHOW CREATE TABLE t1;
-#--replace_result $SLAVE_MYPORT SLAVE_PORT
-#SHOW CREATE TABLE t1;
-#SELECT * FROM t1;
-#DROP TABLE t1, t1;
-
-# TODO: ERROR 1105: Unsupported column type tinyblob
-#CREATE TABLE t1 (a tinyblob);
-#--replace_result $SLAVE_MYPORT SLAVE_PORT
-#eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=127.0.0.1,user=root,port=$SLAVE_MYPORT'
-#--replace_result $SLAVE_MYPORT SLAVE_PORT
-#SHOW CREATE TABLE t1;
-#--replace_result $SLAVE_MYPORT SLAVE_PORT
-#SHOW CREATE TABLE t1;
-#SELECT * FROM t1;
-#DROP TABLE t1, t1;
-
-# TODO: ERROR 1105: Unsupported column type mediumblob
-#CREATE TABLE t1 (a mediumblob);
-#--replace_result $SLAVE_MYPORT SLAVE_PORT
-#eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=127.0.0.1,user=root,port=$SLAVE_MYPORT'
-#--replace_result $SLAVE_MYPORT SLAVE_PORT
-#SHOW CREATE TABLE t1;
-#--replace_result $SLAVE_MYPORT SLAVE_PORT
-#SHOW CREATE TABLE t1;
-#SELECT * FROM t1;
-#DROP TABLE t1, t1;
-
-# TODO: blob is converted to varchar(256)
-#CREATE TABLE t1 (a blob);
-#--replace_result $SLAVE_MYPORT SLAVE_PORT
-#eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=127.0.0.1,user=root,port=$SLAVE_MYPORT'
-#--replace_result $SLAVE_MYPORT SLAVE_PORT
-#SHOW CREATE TABLE t1;
-#--replace_result $SLAVE_MYPORT SLAVE_PORT
-#SHOW CREATE TABLE t1;
-#SELECT * FROM t1;
-#DROP TABLE t1, t1;
-
-# TODO: ERROR 1105: Unsupported column type longblob
-#CREATE TABLE t1 (a longblob);
-#--replace_result $SLAVE_MYPORT SLAVE_PORT
-#eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=127.0.0.1,user=root,port=$SLAVE_MYPORT'
-#--replace_result $SLAVE_MYPORT SLAVE_PORT
-#SHOW CREATE TABLE t1;
-#--replace_result $SLAVE_MYPORT SLAVE_PORT
-#SHOW CREATE TABLE t1;
-#SELECT * FROM t1;
-#DROP TABLE t1, t1;
-
-# TODO: ERROR 1105: Unsupported column type geometry
-#CREATE TABLE t1 (a geometry);
-#--replace_result $SLAVE_MYPORT SLAVE_PORT
-#eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=127.0.0.1,user=root,port=$SLAVE_MYPORT'
-#--replace_result $SLAVE_MYPORT SLAVE_PORT
-#SHOW CREATE TABLE t1;
-#--replace_result $SLAVE_MYPORT SLAVE_PORT
-#SHOW CREATE TABLE t1;
-#SELECT * FROM t1;
-#DROP TABLE t1, t1;
-
---echo #
---echo # Testing temporal data types
---echo #
-
-CREATE TABLE t1 (a date, b datetime, c time, d timestamp, e year);
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES('2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23');
-SELECT * FROM t1;
-
-connection master;
---replace_result $SLAVE_MYPORT SLAVE_PORT
-eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL
- CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT';
---replace_result $SLAVE_MYPORT SLAVE_PORT
-SHOW CREATE TABLE t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-connection slave;
-DROP TABLE t1;
-
--- source myconn_cleanup.inc
-
+-- source myconn.inc
+
+#
+# This test is run against a remote MySQL server
+#
+
+connection slave;
+
+CREATE TABLE t1 (a int, b char(10));
+INSERT INTO t1 VALUES (NULL,NULL),(0,'test00'),(1,'test01'),(2,'test02'),(3,'test03');
+SELECT * FROM t1;
+
+--echo #
+--echo # Testing errors
+--echo #
+connection master;
+
+# Bad user name
+# Suppress "mysql_real_connect failed:" (printed in _DEBUG build)
+--replace_result $SLAVE_MYPORT SLAVE_PORT "mysql_real_connect failed: " ""
+--error ER_UNKNOWN_ERROR
+eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL
+ CONNECTION='mysql://unknown@127.0.0.1:$SLAVE_MYPORT/test/t1';
+
+# Bad database name
+--replace_result $SLAVE_MYPORT SLAVE_PORT "mysql_real_connect failed: " ""
+--error ER_UNKNOWN_ERROR
+eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL
+ CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/unknown/t1';
+
+# Bad database name, with OPTION_LIST going first.
+--replace_result $SLAVE_MYPORT SLAVE_PORT "mysql_real_connect failed: " ""
+--error ER_UNKNOWN_ERROR
+eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL
+ OPTION_LIST='host=127.0.0.1,user=root,port=$SLAVE_MYPORT' DBNAME='unknown' TABNAME='t1';
+
+# Bad table name
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+--error ER_UNKNOWN_ERROR
+eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL
+ CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/unknown';
+--error ER_NO_SUCH_TABLE
+SHOW CREATE TABLE t1;
+
+# Bad column name
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+eval CREATE TABLE t1 (x int, y char(10)) ENGINE=CONNECT TABLE_TYPE=MYSQL
+ CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1';
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+SHOW CREATE TABLE t1;
+--error ER_GET_ERRMSG
+SELECT * FROM t1;
+DROP TABLE t1;
+
+# The remote table disappeared
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+eval CREATE TABLE t1 (a int, b char(10)) ENGINE=CONNECT TABLE_TYPE=MYSQL
+ CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1';
+
+connection slave;
+ALTER TABLE t1 RENAME t1backup;
+
+connection master;
+--error ER_GET_ERRMSG
+SELECT * FROM t1;
+
+connection slave;
+ALTER TABLE t1backup RENAME t1;
+
+connection master;
+DROP TABLE t1;
+
+--echo #
+--echo # Testing SELECT, etc.
+--echo #
+
+# Automatic table structure
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL
+ CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1';
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+# Explicit table structure
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+eval CREATE TABLE t1 (a int, b char(10)) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1'
+ OPTION_LIST='host=127.0.0.1,user=root,port=$SLAVE_MYPORT';
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+# Explicit table structure: remote NULL, local NOT NULL
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+eval CREATE TABLE t1 (a INT NOT NULL, b CHAR(10) NOT NULL) ENGINE=CONNECT TABLE_TYPE=MYSQL
+ OPTION_LIST='host=127.0.0.1,user=root,port=$SLAVE_MYPORT';
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+# Explicit table structure with wrong column types
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+eval CREATE TABLE t1 (a char(10), b int) ENGINE=CONNECT TABLE_TYPE=MYSQL
+ CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1';
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+connection slave;
+DROP TABLE t1;
+
+--echo #
+--echo # Testing numeric data types
+--echo #
+
+# TODO: mediumint is converted to int, float is converted to double, decimal is converted to double
+CREATE TABLE t1 (a tinyint, b smallint, c mediumint, d int, e bigint, f float, g double, h decimal(20,5));
+SHOW CREATE TABLE t1;
+INSERT INTO t1 VALUES(100,3333,41235,1234567890,235000000000,3.14159265,3.14159265,3141.59265);
+
+connection master;
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL
+ OPTION_LIST='host=127.0.0.1,user=root,port=$SLAVE_MYPORT';
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+connection slave;
+DROP TABLE t1;
+
+# TODO: unsigned does not work
+#CREATE TABLE t1 (a tinyint unsigned);
+#SHOW CREATE TABLE t1;
+
+#connection master;
+#--replace_result $SLAVE_MYPORT SLAVE_PORT
+#eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=127.0.0.1,user=root,port=$SLAVE_MYPORT';
+#--replace_result $SLAVE_MYPORT SLAVE_PORT
+#SHOW CREATE TABLE t1;
+#SELECT * FROM t1;
+#DROP TABLE t1;
+
+#connection slave;
+#DROP TABLE t1;
+
+# TODO: add test for BIT
+
+--echo #
+--echo # Testing character data types
+--echo #
+
+CREATE TABLE t1 (a char(12), b varchar(12));
+SHOW CREATE TABLE t1;
+INSERT INTO t1 VALUES('Welcome','Hello, World');
+SELECT * FROM t1;
+
+connection master;
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL
+ CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT';
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+connection slave;
+DROP TABLE t1;
+
+# TODO: ERROR 1105: Unsupported column type tinytext
+#CREATE TABLE t1 (a tinytext);
+#--replace_result $SLAVE_MYPORT SLAVE_PORT
+#eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=127.0.0.1,user=root,port=$SLAVE_MYPORT'
+#--replace_result $SLAVE_MYPORT SLAVE_PORT
+#SHOW CREATE TABLE t1;
+#--replace_result $SLAVE_MYPORT SLAVE_PORT
+#SHOW CREATE TABLE t1;
+#SELECT * FROM t1;
+#DROP TABLE t1, t1;
+
+# TODO: ERROR 1105: Unsupported column type mediumtext
+#CREATE TABLE t1 (a mediumtext);
+#--replace_result $SLAVE_MYPORT SLAVE_PORT
+#eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=127.0.0.1,user=root,port=$SLAVE_MYPORT'
+#--replace_result $SLAVE_MYPORT SLAVE_PORT
+#SHOW CREATE TABLE t1;
+#--replace_result $SLAVE_MYPORT SLAVE_PORT
+#SHOW CREATE TABLE t1;
+#SELECT * FROM t1;
+#DROP TABLE t1, t1;
+
+# TODO: text is converted to varchar(256)
+#CREATE TABLE t1 (a text);
+#--replace_result $SLAVE_MYPORT SLAVE_PORT
+#eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=127.0.0.1,user=root,port=$SLAVE_MYPORT'
+#--replace_result $SLAVE_MYPORT SLAVE_PORT
+#SHOW CREATE TABLE t1;
+#--replace_result $SLAVE_MYPORT SLAVE_PORT
+#SHOW CREATE TABLE t1;
+#SELECT * FROM t1;
+#DROP TABLE t1, t1;
+
+# TODO: ERROR 1105: Unsupported column type longtext
+#CREATE TABLE t1 (a longtext);
+#--replace_result $SLAVE_MYPORT SLAVE_PORT
+#eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=127.0.0.1,user=root,port=$SLAVE_MYPORT'
+#--replace_result $SLAVE_MYPORT SLAVE_PORT
+#SHOW CREATE TABLE t1;
+#--replace_result $SLAVE_MYPORT SLAVE_PORT
+#SHOW CREATE TABLE t1;
+#SELECT * FROM t1;
+#DROP TABLE t1, t1;
+
+#TODO: add tests for ENUM
+#TODO: add tests for SET
+
+#--echo #
+#--echo # Testing binary data types
+#--echo #
+
+# TODO: ERROR 1105: Unsupported column type binary
+#CREATE TABLE t1 (a binary(10));
+#--replace_result $SLAVE_MYPORT SLAVE_PORT
+#eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=127.0.0.1,user=root,port=$SLAVE_MYPORT'
+#--replace_result $SLAVE_MYPORT SLAVE_PORT
+#SHOW CREATE TABLE t1;
+#--replace_result $SLAVE_MYPORT SLAVE_PORT
+#SHOW CREATE TABLE t1;
+#SELECT * FROM t1;
+#DROP TABLE t1, t1;
+
+# TODO: ERROR 1105: Unsupported column type varbinary
+#CREATE TABLE t1 (a varbinary(10));
+#--replace_result $SLAVE_MYPORT SLAVE_PORT
+#eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=127.0.0.1,user=root,port=$SLAVE_MYPORT'
+#--replace_result $SLAVE_MYPORT SLAVE_PORT
+#SHOW CREATE TABLE t1;
+#--replace_result $SLAVE_MYPORT SLAVE_PORT
+#SHOW CREATE TABLE t1;
+#SELECT * FROM t1;
+#DROP TABLE t1, t1;
+
+# TODO: ERROR 1105: Unsupported column type tinyblob
+#CREATE TABLE t1 (a tinyblob);
+#--replace_result $SLAVE_MYPORT SLAVE_PORT
+#eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=127.0.0.1,user=root,port=$SLAVE_MYPORT'
+#--replace_result $SLAVE_MYPORT SLAVE_PORT
+#SHOW CREATE TABLE t1;
+#--replace_result $SLAVE_MYPORT SLAVE_PORT
+#SHOW CREATE TABLE t1;
+#SELECT * FROM t1;
+#DROP TABLE t1, t1;
+
+# TODO: ERROR 1105: Unsupported column type mediumblob
+#CREATE TABLE t1 (a mediumblob);
+#--replace_result $SLAVE_MYPORT SLAVE_PORT
+#eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=127.0.0.1,user=root,port=$SLAVE_MYPORT'
+#--replace_result $SLAVE_MYPORT SLAVE_PORT
+#SHOW CREATE TABLE t1;
+#--replace_result $SLAVE_MYPORT SLAVE_PORT
+#SHOW CREATE TABLE t1;
+#SELECT * FROM t1;
+#DROP TABLE t1, t1;
+
+# TODO: blob is converted to varchar(256)
+#CREATE TABLE t1 (a blob);
+#--replace_result $SLAVE_MYPORT SLAVE_PORT
+#eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=127.0.0.1,user=root,port=$SLAVE_MYPORT'
+#--replace_result $SLAVE_MYPORT SLAVE_PORT
+#SHOW CREATE TABLE t1;
+#--replace_result $SLAVE_MYPORT SLAVE_PORT
+#SHOW CREATE TABLE t1;
+#SELECT * FROM t1;
+#DROP TABLE t1, t1;
+
+# TODO: ERROR 1105: Unsupported column type longblob
+#CREATE TABLE t1 (a longblob);
+#--replace_result $SLAVE_MYPORT SLAVE_PORT
+#eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=127.0.0.1,user=root,port=$SLAVE_MYPORT'
+#--replace_result $SLAVE_MYPORT SLAVE_PORT
+#SHOW CREATE TABLE t1;
+#--replace_result $SLAVE_MYPORT SLAVE_PORT
+#SHOW CREATE TABLE t1;
+#SELECT * FROM t1;
+#DROP TABLE t1, t1;
+
+# TODO: ERROR 1105: Unsupported column type geometry
+#CREATE TABLE t1 (a geometry);
+#--replace_result $SLAVE_MYPORT SLAVE_PORT
+#eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=127.0.0.1,user=root,port=$SLAVE_MYPORT'
+#--replace_result $SLAVE_MYPORT SLAVE_PORT
+#SHOW CREATE TABLE t1;
+#--replace_result $SLAVE_MYPORT SLAVE_PORT
+#SHOW CREATE TABLE t1;
+#SELECT * FROM t1;
+#DROP TABLE t1, t1;
+
+--echo #
+--echo # Testing temporal data types
+--echo #
+
+CREATE TABLE t1 (a date, b datetime, c time, d timestamp, e year);
+SHOW CREATE TABLE t1;
+INSERT INTO t1 VALUES('2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23');
+SELECT * FROM t1;
+
+connection master;
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL
+ CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT';
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+connection slave;
+DROP TABLE t1;
+
+-- source myconn_cleanup.inc
+
diff --git a/storage/connect/mysql-test/connect/t/null.test b/storage/connect/mysql-test/connect/t/null.test
index 3d1e33eb77c..d2c784144a5 100644
--- a/storage/connect/mysql-test/connect/t/null.test
+++ b/storage/connect/mysql-test/connect/t/null.test
@@ -1,87 +1,87 @@
-let $MYSQLD_DATADIR= `select @@datadir`;
-
---echo #
---echo # Testing FIX null columns
---echo #
-CREATE TABLE t1
-(
- id INT NOT NULL,
- nb INT,
- msg VARCHAR(12)
-) ENGINE=CONNECT TABLE_TYPE=FIX;
---error ER_BAD_NULL_ERROR
-INSERT INTO t1 values(NULL,1,'Hello');
-INSERT INTO t1 values(10,4,NULL),(20,2,'Hello'),(0,0,'Zero');
-SELECT * FROM t1;
-SELECT* FROM t1 WHERE id IS NULL;
-SELECT * FROM t1 WHERE nb IS NULL;
-SELECT * FROM t1 WHERE msg IS NOT NULL;
-DROP TABLE t1;
-
---echo #
---echo # Testing CSV null columns
---echo #
-CREATE TABLE t1
-(
- id INT NOT NULL,
- nb INT,
- msg VARCHAR(12)
-) ENGINE=CONNECT TABLE_TYPE=CSV HEADER=1;
---error ER_BAD_NULL_ERROR
-INSERT INTO t1 values(NULL,1,'Hello');
-INSERT INTO t1 values(10,4,NULL),(20,2,'Hello'),(0,0,'Zero');
-SELECT * FROM t1;
-SELECT* FROM t1 WHERE id IS NULL;
-SELECT * FROM t1 WHERE nb IS NULL;
-SELECT * FROM t1 WHERE msg IS NOT NULL;
-DROP TABLE t1;
-
---echo #
---echo # Testing BIN null columns
---echo #
-CREATE TABLE t1
-(
- id INT NOT NULL,
- nb INT,
- msg VARCHAR(12)
-) ENGINE=CONNECT TABLE_TYPE=BIN;
---error ER_BAD_NULL_ERROR
-INSERT INTO t1 values(NULL,1,'Hello');
-INSERT INTO t1 values(10,4,NULL),(20,2,'Hello'),(0,0,'Zero');
-SELECT * FROM t1;
-SELECT* FROM t1 WHERE id IS NULL;
-SELECT * FROM t1 WHERE nb IS NULL;
-SELECT * FROM t1 WHERE msg IS NOT NULL;
-DROP TABLE t1;
-
---echo #
---echo # Testing DBF null columns
---echo #
-CREATE TABLE t1
-(
- id INT NOT NULL,
- nb INT,
- msg VARCHAR(12)
-) ENGINE=CONNECT TABLE_TYPE=DBF;
---error ER_BAD_NULL_ERROR
-INSERT INTO t1 values(NULL,1,'Hello');
-INSERT INTO t1 values(10,4,NULL),(20,2,'Hello'),(0,0,'Zero');
-SELECT * FROM t1;
-SELECT* FROM t1 WHERE id IS NULL;
-SELECT * FROM t1 WHERE nb IS NULL;
-SELECT * FROM t1 WHERE msg IS NOT NULL;
-DROP TABLE t1;
-
---echo #
---echo # Testing INI null columns
---echo #
-CREATE TABLE t1
-(
- `sec` char(8) NOT NULL flag=1,
- `key` char(12)
-) ENGINE=CONNECT TABLE_TYPE=INI;
-INSERT INTO t1(sec) values('S1');
-SELECT * FROM t1;
-INSERT INTO t1 values('S1','Newval');
-SELECT * FROM t1;
-DROP TABLE t1;
+let $MYSQLD_DATADIR= `select @@datadir`;
+
+--echo #
+--echo # Testing FIX null columns
+--echo #
+CREATE TABLE t1
+(
+ id INT NOT NULL,
+ nb INT,
+ msg VARCHAR(12)
+) ENGINE=CONNECT TABLE_TYPE=FIX;
+--error ER_BAD_NULL_ERROR
+INSERT INTO t1 values(NULL,1,'Hello');
+INSERT INTO t1 values(10,4,NULL),(20,2,'Hello'),(0,0,'Zero');
+SELECT * FROM t1;
+SELECT* FROM t1 WHERE id IS NULL;
+SELECT * FROM t1 WHERE nb IS NULL;
+SELECT * FROM t1 WHERE msg IS NOT NULL;
+DROP TABLE t1;
+
+--echo #
+--echo # Testing CSV null columns
+--echo #
+CREATE TABLE t1
+(
+ id INT NOT NULL,
+ nb INT,
+ msg VARCHAR(12)
+) ENGINE=CONNECT TABLE_TYPE=CSV HEADER=1;
+--error ER_BAD_NULL_ERROR
+INSERT INTO t1 values(NULL,1,'Hello');
+INSERT INTO t1 values(10,4,NULL),(20,2,'Hello'),(0,0,'Zero');
+SELECT * FROM t1;
+SELECT* FROM t1 WHERE id IS NULL;
+SELECT * FROM t1 WHERE nb IS NULL;
+SELECT * FROM t1 WHERE msg IS NOT NULL;
+DROP TABLE t1;
+
+--echo #
+--echo # Testing BIN null columns
+--echo #
+CREATE TABLE t1
+(
+ id INT NOT NULL,
+ nb INT,
+ msg VARCHAR(12)
+) ENGINE=CONNECT TABLE_TYPE=BIN;
+--error ER_BAD_NULL_ERROR
+INSERT INTO t1 values(NULL,1,'Hello');
+INSERT INTO t1 values(10,4,NULL),(20,2,'Hello'),(0,0,'Zero');
+SELECT * FROM t1;
+SELECT* FROM t1 WHERE id IS NULL;
+SELECT * FROM t1 WHERE nb IS NULL;
+SELECT * FROM t1 WHERE msg IS NOT NULL;
+DROP TABLE t1;
+
+--echo #
+--echo # Testing DBF null columns
+--echo #
+CREATE TABLE t1
+(
+ id INT NOT NULL,
+ nb INT,
+ msg VARCHAR(12)
+) ENGINE=CONNECT TABLE_TYPE=DBF;
+--error ER_BAD_NULL_ERROR
+INSERT INTO t1 values(NULL,1,'Hello');
+INSERT INTO t1 values(10,4,NULL),(20,2,'Hello'),(0,0,'Zero');
+SELECT * FROM t1;
+SELECT* FROM t1 WHERE id IS NULL;
+SELECT * FROM t1 WHERE nb IS NULL;
+SELECT * FROM t1 WHERE msg IS NOT NULL;
+DROP TABLE t1;
+
+--echo #
+--echo # Testing INI null columns
+--echo #
+CREATE TABLE t1
+(
+ `sec` char(8) NOT NULL flag=1,
+ `key` char(12)
+) ENGINE=CONNECT TABLE_TYPE=INI;
+INSERT INTO t1(sec) values('S1');
+SELECT * FROM t1;
+INSERT INTO t1 values('S1','Newval');
+SELECT * FROM t1;
+DROP TABLE t1;
diff --git a/storage/connect/mysql-test/connect/t/occur.test b/storage/connect/mysql-test/connect/t/occur.test
index 36a4caafda1..7d7bca87f66 100644
--- a/storage/connect/mysql-test/connect/t/occur.test
+++ b/storage/connect/mysql-test/connect/t/occur.test
@@ -1,61 +1,61 @@
--- source include/not_embedded.inc
-
-let $MYSQLD_DATADIR= `select @@datadir`;
-let $PORT= `select @@port`;
---copy_file $MTR_SUITE_DIR/std_data/employee.dat $MYSQLD_DATADIR/test/employee.dat
-
-CREATE TABLE employee (
-serialno CHAR(5) NOT NULL,
-name VARCHAR(12) NOT NULL FLAG=6,
-sex TINYINT(1) NOT NULL,
-title VARCHAR(15) NOT NULL FLAG=20,
-manager CHAR(5) DEFAULT NULL,
-department CHAR(4) NOT NULL FLAG=41,
-secretary CHAR(5) DEFAULT NULL FLAG=46,
-salary DOUBLE(8,2) NOT NULL FLAG=52
-) ENGINE=connect TABLE_TYPE=fix FILE_NAME='employee.dat' ENDING=1;
-SELECT * FROM employee;
-
---replace_result $PORT PORT
---eval CREATE TABLE occurs (name CHAR(12), sex CHAR(1), title CHAR(15), department CHAR(4), salary DOUBLE(8,2), id_of CHAR(12), id CHAR(5) NOT NULL) ENGINE=CONNECT TABLE_TYPE=OCCUR TABNAME=employee OPTION_LIST='OccurCol=ID,RankCol=ID_OF,Colist=serialno;manager;secretary,port=$PORT';
-SELECT * FROM occurs;
-
-DROP TABLE occurs;
-DROP TABLE employee;
-
-CREATE TABLE pets (
-name VARCHAR(12) NOT NULL,
-dog INT NOT NULL DEFAULT 0,
-cat INT NOT NULL DEFAULT 0,
-rabbit INT NOT NULL DEFAULT 0,
-bird INT NOT NULL DEFAULT 0,
-fish INT NOT NULL DEFAULT 0) ENGINE=MYISAM;
-INSERT INTO pets(name,dog) VALUES('John',2);
-INSERT INTO pets(name,cat) VALUES('Bill',1);
-INSERT INTO pets(name,dog,cat) VALUES('Mary',1,1);
-INSERT INTO pets(name,rabbit) VALUES('Lisbeth',2);
-INSERT INTO pets(name,cat,bird) VALUES('Kevin',2,6);
-INSERT INTO pets(name,dog,fish) VALUES('Donald',1,3);
-SELECT * FROM pets;
-
---replace_result $PORT PORT
---eval CREATE TABLE xpet (name VARCHAR(12) NOT NULL, race CHAR(6) NOT NULL, number INT) ENGINE=CONNECT TABLE_TYPE=OCCUR TABNAME=pets OPTION_LIST='OccurCol=number,RankCol=race,Colist=dog;cat;rabbit;bird;fish,port=$PORT'
-
-SELECT * FROM xpet;
-SELECT name FROM xpet;
-SELECT name FROM xpet WHERE race = 'cat' AND number = 0;
-SELECT name, SUM(number) pets FROM xpet GROUP BY name;
-
-ALTER TABLE xpet MODIFY number INT NOT NULL;
-
-SELECT * FROM xpet;
-SELECT * FROM xpet WHERE number > 1;
-SELECT DISTINCT name FROM xpet WHERE number > 1;
-SELECT name FROM xpet;
-SELECT name, race FROM xpet;
-SELECT name, count(*) FROM xpet GROUP BY name, LEAST(number,1);
-SELECT name, number, count(*) FROM xpet GROUP BY name, number;
-
-DROP TABLE xpet;
-DROP TABLE pets;
---remove_file $MYSQLD_DATADIR/test/employee.dat
+-- source include/not_embedded.inc
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+let $PORT= `select @@port`;
+--copy_file $MTR_SUITE_DIR/std_data/employee.dat $MYSQLD_DATADIR/test/employee.dat
+
+CREATE TABLE employee (
+serialno CHAR(5) NOT NULL,
+name VARCHAR(12) NOT NULL FLAG=6,
+sex TINYINT(1) NOT NULL,
+title VARCHAR(15) NOT NULL FLAG=20,
+manager CHAR(5) DEFAULT NULL,
+department CHAR(4) NOT NULL FLAG=41,
+secretary CHAR(5) DEFAULT NULL FLAG=46,
+salary DOUBLE(8,2) NOT NULL FLAG=52
+) ENGINE=connect TABLE_TYPE=fix FILE_NAME='employee.dat' ENDING=1;
+SELECT * FROM employee;
+
+--replace_result $PORT PORT
+--eval CREATE TABLE occurs (name CHAR(12), sex CHAR(1), title CHAR(15), department CHAR(4), salary DOUBLE(8,2), id_of CHAR(12), id CHAR(5) NOT NULL) ENGINE=CONNECT TABLE_TYPE=OCCUR TABNAME=employee OPTION_LIST='OccurCol=ID,RankCol=ID_OF,Colist=serialno;manager;secretary,port=$PORT';
+SELECT * FROM occurs;
+
+DROP TABLE occurs;
+DROP TABLE employee;
+
+CREATE TABLE pets (
+name VARCHAR(12) NOT NULL,
+dog INT NOT NULL DEFAULT 0,
+cat INT NOT NULL DEFAULT 0,
+rabbit INT NOT NULL DEFAULT 0,
+bird INT NOT NULL DEFAULT 0,
+fish INT NOT NULL DEFAULT 0) ENGINE=MYISAM;
+INSERT INTO pets(name,dog) VALUES('John',2);
+INSERT INTO pets(name,cat) VALUES('Bill',1);
+INSERT INTO pets(name,dog,cat) VALUES('Mary',1,1);
+INSERT INTO pets(name,rabbit) VALUES('Lisbeth',2);
+INSERT INTO pets(name,cat,bird) VALUES('Kevin',2,6);
+INSERT INTO pets(name,dog,fish) VALUES('Donald',1,3);
+SELECT * FROM pets;
+
+--replace_result $PORT PORT
+--eval CREATE TABLE xpet (name VARCHAR(12) NOT NULL, race CHAR(6) NOT NULL, number INT) ENGINE=CONNECT TABLE_TYPE=OCCUR TABNAME=pets OPTION_LIST='OccurCol=number,RankCol=race,Colist=dog;cat;rabbit;bird;fish,port=$PORT'
+
+SELECT * FROM xpet;
+SELECT name FROM xpet;
+SELECT name FROM xpet WHERE race = 'cat' AND number = 0;
+SELECT name, SUM(number) pets FROM xpet GROUP BY name;
+
+ALTER TABLE xpet MODIFY number INT NOT NULL;
+
+SELECT * FROM xpet;
+SELECT * FROM xpet WHERE number > 1;
+SELECT DISTINCT name FROM xpet WHERE number > 1;
+SELECT name FROM xpet;
+SELECT name, race FROM xpet;
+SELECT name, count(*) FROM xpet GROUP BY name, LEAST(number,1);
+SELECT name, number, count(*) FROM xpet GROUP BY name, number;
+
+DROP TABLE xpet;
+DROP TABLE pets;
+--remove_file $MYSQLD_DATADIR/test/employee.dat
diff --git a/storage/connect/mysql-test/connect/t/odbc_sqlite3.test b/storage/connect/mysql-test/connect/t/odbc_sqlite3.test
index 433e97149c6..a22fa3a7832 100644
--- a/storage/connect/mysql-test/connect/t/odbc_sqlite3.test
+++ b/storage/connect/mysql-test/connect/t/odbc_sqlite3.test
@@ -1,90 +1,90 @@
---source have_odbc_sqlite3.inc
-
-#
-# To run this test, install SQLite3 ODBC Driver from
-# http://www.ch-werner.de/sqliteodbc/
-#
-# Note, the test does not need a DSN to be created
-# (only the driver is required)
-#
-#
-# On Windows:
-# -----------
-# Download and run the installer file sqliteodbc.exe
-# Version sqliteodbc-0.991 is known to Work.
-# After running the installer the test should start working automatically.
-#
-# On Linux:
-# --------
-# 1. Download the source tarball, e.g.: sqliteodbc-0.993.tar.gz
-# 2. Unpack the sources:
-# tar -zxf sqliteodbc-0.993.tar.gz
-# 3. Compile the source and install:
-# cd sqliteodbc-0.993
-# ./configure --prefix=/opt/sqliteodbc
-# make
-# sudo make install
-#
-# (you can use a different --prefix, according to your preferences)
-#
-# 4. Add these lines into /etc/odbcinst.ini
-#
-#[SQLite3 ODBC Driver]
-#Description=SQLite3 ODBC Driver
-#Driver=/opt/sqliteodbc/libsqlite3odbc.so
-#Setup=/opt/sqliteodbc/libsqlite3odbc.so
-#
-# Adjust the directory "/opt/sqliteodbc/" according to --prefix
-# that you chose on step #3.
-#
-#
-
-SET NAMES utf8;
-
-let $MYSQLD_DATADIR= `select @@datadir`;
-
-
-#
-# For some reasons Windows does not allow to remove the data base
-# file after "DROP TABLE t1". So unlike in odbc_xls.test we won't copy
-# the data file, we'll use directly the file in std_data.
-# As we do not do any modifications in the database, this should be OK.
-#
-let $Database=$MTR_SUITE_DIR/std_data/test.sqlite3;
---replace_result $MTR_SUITE_DIR MTR_SUITE_DIR
---eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='Driver=SQLite3 ODBC Driver;Database=$Database;NoWCHAR=yes' CHARSET=utf8 DATA_CHARSET=utf8;
---replace_result $MTR_SUITE_DIR MTR_SUITE_DIR
-SHOW CREATE TABLE t1;
-SELECT * FROM t1;
-
-CREATE TABLE t2 AS SELECT * FROM t1;
-SHOW CREATE TABLE t2;
-SELECT * FROM t2;
-DROP TABLE t2;
-
-CREATE VIEW v1 AS SELECT * FROM t1;
-SELECT * FROM v1;
-
-DROP VIEW v1;
-DROP TABLE t1;
-
---replace_result $MTR_SUITE_DIR MTR_SUITE_DIR
---eval CREATE TABLE t1 ENGINE=CONNECT CATFUNC=Columns TABNAME='t1' TABLE_TYPE=ODBC CONNECTION='Driver=SQLite3 ODBC Driver;Database=$Database;NoWCHAR=yes' CHARSET=utf8 DATA_CHARSET=utf8
-SELECT * FROM t1;
-DROP TABLE t1;
-
---replace_result $MTR_SUITE_DIR MTR_SUITE_DIR
---eval CREATE TABLE t1 ENGINE=CONNECT CATFUNC=Tables TABNAME='t1' TABLE_TYPE=ODBC CONNECTION='Driver=SQLite3 ODBC Driver;Database=$Database;NoWCHAR=yes' CHARSET=utf8 DATA_CHARSET=utf8
-SELECT * FROM t1;
-DROP TABLE t1;
-
-
---replace_result $MTR_SUITE_DIR MTR_SUITE_DIR
---eval CREATE TABLE t1 ENGINE=CONNECT CATFUNC=Columns TABLE_TYPE=ODBC CONNECTION='Driver=SQLite3 ODBC Driver;Database=$Database;NoWCHAR=yes' CHARSET=utf8 DATA_CHARSET=utf8
-SELECT * FROM t1 ORDER BY Table_name;
-DROP TABLE t1;
-
---replace_result $MTR_SUITE_DIR MTR_SUITE_DIR
---eval CREATE TABLE t1 ENGINE=CONNECT CATFUNC=Tables TABLE_TYPE=ODBC CONNECTION='Driver=SQLite3 ODBC Driver;Database=$Database;NoWCHAR=yes' CHARSET=utf8 DATA_CHARSET=utf8
-SELECT * FROM t1 ORDER BY Table_name;
-DROP TABLE t1;
+--source have_odbc_sqlite3.inc
+
+#
+# To run this test, install SQLite3 ODBC Driver from
+# http://www.ch-werner.de/sqliteodbc/
+#
+# Note, the test does not need a DSN to be created
+# (only the driver is required)
+#
+#
+# On Windows:
+# -----------
+# Download and run the installer file sqliteodbc.exe
+# Version sqliteodbc-0.991 is known to Work.
+# After running the installer the test should start working automatically.
+#
+# On Linux:
+# --------
+# 1. Download the source tarball, e.g.: sqliteodbc-0.993.tar.gz
+# 2. Unpack the sources:
+# tar -zxf sqliteodbc-0.993.tar.gz
+# 3. Compile the source and install:
+# cd sqliteodbc-0.993
+# ./configure --prefix=/opt/sqliteodbc
+# make
+# sudo make install
+#
+# (you can use a different --prefix, according to your preferences)
+#
+# 4. Add these lines into /etc/odbcinst.ini
+#
+#[SQLite3 ODBC Driver]
+#Description=SQLite3 ODBC Driver
+#Driver=/opt/sqliteodbc/libsqlite3odbc.so
+#Setup=/opt/sqliteodbc/libsqlite3odbc.so
+#
+# Adjust the directory "/opt/sqliteodbc/" according to --prefix
+# that you chose on step #3.
+#
+#
+
+SET NAMES utf8;
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+
+
+#
+# For some reasons Windows does not allow to remove the data base
+# file after "DROP TABLE t1". So unlike in odbc_xls.test we won't copy
+# the data file, we'll use directly the file in std_data.
+# As we do not do any modifications in the database, this should be OK.
+#
+let $Database=$MTR_SUITE_DIR/std_data/test.sqlite3;
+--replace_result $MTR_SUITE_DIR MTR_SUITE_DIR
+--eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='Driver=SQLite3 ODBC Driver;Database=$Database;NoWCHAR=yes' CHARSET=utf8 DATA_CHARSET=utf8;
+--replace_result $MTR_SUITE_DIR MTR_SUITE_DIR
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+
+CREATE TABLE t2 AS SELECT * FROM t1;
+SHOW CREATE TABLE t2;
+SELECT * FROM t2;
+DROP TABLE t2;
+
+CREATE VIEW v1 AS SELECT * FROM t1;
+SELECT * FROM v1;
+
+DROP VIEW v1;
+DROP TABLE t1;
+
+--replace_result $MTR_SUITE_DIR MTR_SUITE_DIR
+--eval CREATE TABLE t1 ENGINE=CONNECT CATFUNC=Columns TABNAME='t1' TABLE_TYPE=ODBC CONNECTION='Driver=SQLite3 ODBC Driver;Database=$Database;NoWCHAR=yes' CHARSET=utf8 DATA_CHARSET=utf8
+SELECT * FROM t1;
+DROP TABLE t1;
+
+--replace_result $MTR_SUITE_DIR MTR_SUITE_DIR
+--eval CREATE TABLE t1 ENGINE=CONNECT CATFUNC=Tables TABNAME='t1' TABLE_TYPE=ODBC CONNECTION='Driver=SQLite3 ODBC Driver;Database=$Database;NoWCHAR=yes' CHARSET=utf8 DATA_CHARSET=utf8
+SELECT * FROM t1;
+DROP TABLE t1;
+
+
+--replace_result $MTR_SUITE_DIR MTR_SUITE_DIR
+--eval CREATE TABLE t1 ENGINE=CONNECT CATFUNC=Columns TABLE_TYPE=ODBC CONNECTION='Driver=SQLite3 ODBC Driver;Database=$Database;NoWCHAR=yes' CHARSET=utf8 DATA_CHARSET=utf8
+SELECT * FROM t1 ORDER BY Table_name;
+DROP TABLE t1;
+
+--replace_result $MTR_SUITE_DIR MTR_SUITE_DIR
+--eval CREATE TABLE t1 ENGINE=CONNECT CATFUNC=Tables TABLE_TYPE=ODBC CONNECTION='Driver=SQLite3 ODBC Driver;Database=$Database;NoWCHAR=yes' CHARSET=utf8 DATA_CHARSET=utf8
+SELECT * FROM t1 ORDER BY Table_name;
+DROP TABLE t1;
diff --git a/storage/connect/mysql-test/connect/t/part_file.test b/storage/connect/mysql-test/connect/t/part_file.test
index 6efd2b9b580..8ee43a917ec 100644
--- a/storage/connect/mysql-test/connect/t/part_file.test
+++ b/storage/connect/mysql-test/connect/t/part_file.test
@@ -1,166 +1,166 @@
---source include/have_partition.inc
-let $MYSQLD_DATADIR= `select @@datadir`;
-
-set @@global.connect_exact_info=ON;
-
---echo # This will be used to see what data files are created
-CREATE TABLE dr1 (
- fname VARCHAR(256) NOT NULL FLAG=2,
- ftype CHAR(8) NOT NULL FLAG=3
-# ,FSIZE INT(6) NOT NULL FLAG=5 removed because Unix size != Windows size
-) engine=CONNECT table_type=DIR file_name='t1#P#*.*';
-
---echo #
---echo # Testing partitioning on inward table
---echo #
-CREATE TABLE t1 (
- id INT NOT NULL,
- msg VARCHAR(32)
-) ENGINE=CONNECT TABLE_TYPE=CSV AVG_ROW_LENGTH=10
-PARTITION BY RANGE(id) (
-PARTITION first VALUES LESS THAN(10),
-PARTITION middle VALUES LESS THAN(50),
-PARTITION last VALUES LESS THAN(MAXVALUE));
-INSERT INTO t1 VALUES(4, 'four'),(24, 'twenty four');
-INSERT INTO t1 VALUES(7,'seven'),(10,'ten'),(40,'forty'),(60,'sixty'),(81,'eighty one');
-SELECT partition_name, table_rows FROM information_schema.partitions WHERE table_name = 't1';
-SELECT * FROM t1;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id > 50;
-SELECT * FROM t1 WHERE id > 50;
-#TODO: Differences between Linux and Windows
-#SHOW TABLE STATUS LIKE 't1';
---error ER_GET_ERRMSG
-UPDATE t1 set id = 41 WHERE msg = 'four';
-UPDATE t1 set msg = 'quatre' WHERE id = 4;
-SELECT * FROM dr1 ORDER BY fname, ftype;
---echo #
---echo # Altering partitioning on inward table
---echo #
-ALTER TABLE t1
-PARTITION by range(id) (
-PARTITION first VALUES LESS THAN(11),
-PARTITION middle VALUES LESS THAN(50),
-PARTITION last VALUES LESS THAN(MAXVALUE));
-SELECT partition_name, table_rows FROM information_schema.partitions WHERE table_name = 't1';
-SELECT * FROM dr1 ORDER BY fname, ftype;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id=10;
-SELECT * FROM t1 WHERE id=10;
-DELETE FROM t1 WHERE id in (4,60);
-SELECT * FROM t1;
-DROP TABLE t1;
-# TODO: this fails on Linux
-#SELECT * FROM dr1;
-
---echo #
---echo # Testing partitioning on a void outward table
---echo #
-ALTER TABLE dr1 FILE_NAME='part*.*';
-CREATE TABLE t1 (
- rwid INT(6) DEFAULT 0 SPECIAL=ROWID,
- rnum INT(6) DEFAULT 0 SPECIAL=ROWNUM,
- prtn VARCHAR(64) DEFAULT '' SPECIAL=PARTID,
- tbn VARCHAR(64) DEFAULT '' SPECIAL=TABID,
- fid VARCHAR(256) DEFAULT '' SPECIAL=FNAME,
- id INT KEY NOT NULL,
- msg VARCHAR(32)
-) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='part%s.txt';
---replace_result $MYSQLD_DATADIR "DATADIR/"
-ALTER TABLE t1
-PARTITION by range columns(id) (
-PARTITION `1` VALUES LESS THAN(10),
-PARTITION `2` VALUES LESS THAN(50),
-PARTITION `3` VALUES LESS THAN(MAXVALUE));
-SHOW INDEX FROM t1;
-# TODO: this fails on Linux
-#SELECT * FROM dr1 ORDER BY fname, ftype;
-INSERT INTO t1(id,msg) VALUES(4, 'four');
-SELECT * FROM dr1 ORDER BY fname, ftype;
-INSERT INTO t1(id,msg) VALUES(7,'seven'),(10,'ten'),(40,'forty'),(60,'sixty'),(81,'eighty one');
-INSERT INTO t1(id,msg) VALUES(72,'seventy two'),(20,'twenty'),(1,'one'),(35,'thirty five'),(8,'eight');
-SELECT partition_name, table_rows FROM information_schema.partitions WHERE table_name = 't1';
-SELECT * FROM t1;
-SELECT * FROM t1 order by id;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id = 10;
-SELECT * FROM t1 WHERE id = 10;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id >= 10;
-SELECT * FROM t1 WHERE id >= 10;
-SELECT count(*) FROM t1 WHERE id < 10;
-SELECT case when id < 10 then 1 when id < 50 then 2 else 3 end as pn, count(*) FROM t1 group by pn;
-SELECT prtn, count(*) FROM t1 group by prtn;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id > 50;
-SELECT * FROM t1 WHERE id = 35;
-SELECT * FROM dr1 ORDER BY fname, ftype;
---echo # This does not change the partition file data and is WRONG
-ALTER TABLE t1
-PARTITION by range columns(id) (
-PARTITION `1` VALUES LESS THAN(11),
-PARTITION `2` VALUES LESS THAN(70),
-PARTITION `3` VALUES LESS THAN(MAXVALUE));
-SELECT CASE WHEN id < 11 THEN 1 WHEN id < 70 THEN 2 ELSE 3 END AS pn, COUNT(*) FROM t1 GROUP BY pn;
-SELECT partition_name, table_rows FROM information_schema.partitions WHERE table_name = 't1';
-SELECT * FROM dr1 ORDER BY fname, ftype;
---echo #
---echo # This is the correct way to change partitioning:
---echo # Save table values, erase the table, then re-insert saved values in modified table
---echo #
-CREATE TABLE t2 (
- id INT NOT NULL,
- msg VARCHAR(32)
-) ENGINE=CONNECT TABLE_TYPE=FIX;
-INSERT INTO t2 SELECT id, msg FROM t1;
-DELETE FROM t1;
-INSERT INTO t1(id,msg) SELECT * FROM t2;
-SELECT partition_name, table_rows FROM information_schema.partitions WHERE table_name = 't1';
-SELECT * FROM t1;
-SELECT * FROM dr1 ORDER BY fname, ftype;
-DROP TABLE t2;
-DROP TABLE t1;
-
---echo #
---echo # Testing partitioning on a populated outward table
---echo #
-CREATE TABLE t1 (
- id INT NOT NULL,
- msg VARCHAR(32)
-) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='part%s.txt'
-PARTITION by range columns(id) (
-PARTITION `1` VALUES LESS THAN(11),
-PARTITION `2` VALUES LESS THAN(70),
-PARTITION `3` VALUES LESS THAN(MAXVALUE));
-SELECT partition_name, table_rows FROM information_schema.partitions WHERE table_name = 't1';
-SELECT * FROM t1 WHERE id < 11;
-SELECT * FROM t1 WHERE id >= 70;
-SELECT * FROM dr1 ORDER BY fname, ftype;
-
---echo #
---echo # Testing indexing on a partitioned table
---echo #
-CREATE INDEX XID ON t1(id);
-SHOW INDEX FROM t1;
-SELECT * FROM dr1 ORDER BY fname, ftype;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id = 10;
-DROP INDEX XID ON t1;
-SHOW INDEX FROM t1;
-SELECT * FROM dr1 ORDER BY fname, ftype;
-ALTER TABLE t1 ADD PRIMARY KEY (id);
-SHOW INDEX FROM t1;
-SELECT * FROM dr1 ORDER BY fname, ftype;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id = 10;
-ALTER TABLE t1 DROP PRIMARY KEY;
-SHOW INDEX FROM t1;
-SELECT * FROM dr1 ORDER BY fname, ftype;
-DROP TABLE t1;
-DROP TABLE dr1;
-
-#
-# Clean up
-#
-set @@global.connect_exact_info=OFF;
-
---remove_file $MYSQLD_DATADIR/test/part1.txt
---remove_file $MYSQLD_DATADIR/test/part2.txt
---remove_file $MYSQLD_DATADIR/test/part3.txt
-#--remove_file $MYSQLD_DATADIR/test/part%s.fnx
-#--remove_file $MYSQLD_DATADIR/test/part1.fnx
-#--remove_file $MYSQLD_DATADIR/test/part2.fnx
-#--remove_file $MYSQLD_DATADIR/test/part3.fnx
+--source include/have_partition.inc
+let $MYSQLD_DATADIR= `select @@datadir`;
+
+set @@global.connect_exact_info=ON;
+
+--echo # This will be used to see what data files are created
+CREATE TABLE dr1 (
+ fname VARCHAR(256) NOT NULL FLAG=2,
+ ftype CHAR(8) NOT NULL FLAG=3
+# ,FSIZE INT(6) NOT NULL FLAG=5 removed because Unix size != Windows size
+) engine=CONNECT table_type=DIR file_name='t1#P#*.*';
+
+--echo #
+--echo # Testing partitioning on inward table
+--echo #
+CREATE TABLE t1 (
+ id INT NOT NULL,
+ msg VARCHAR(32)
+) ENGINE=CONNECT TABLE_TYPE=CSV AVG_ROW_LENGTH=10
+PARTITION BY RANGE(id) (
+PARTITION first VALUES LESS THAN(10),
+PARTITION middle VALUES LESS THAN(50),
+PARTITION last VALUES LESS THAN(MAXVALUE));
+INSERT INTO t1 VALUES(4, 'four'),(24, 'twenty four');
+INSERT INTO t1 VALUES(7,'seven'),(10,'ten'),(40,'forty'),(60,'sixty'),(81,'eighty one');
+SELECT partition_name, table_rows FROM information_schema.partitions WHERE table_name = 't1';
+SELECT * FROM t1;
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id > 50;
+SELECT * FROM t1 WHERE id > 50;
+#TODO: Differences between Linux and Windows
+#SHOW TABLE STATUS LIKE 't1';
+--error ER_GET_ERRMSG
+UPDATE t1 set id = 41 WHERE msg = 'four';
+UPDATE t1 set msg = 'quatre' WHERE id = 4;
+SELECT * FROM dr1 ORDER BY fname, ftype;
+--echo #
+--echo # Altering partitioning on inward table
+--echo #
+ALTER TABLE t1
+PARTITION by range(id) (
+PARTITION first VALUES LESS THAN(11),
+PARTITION middle VALUES LESS THAN(50),
+PARTITION last VALUES LESS THAN(MAXVALUE));
+SELECT partition_name, table_rows FROM information_schema.partitions WHERE table_name = 't1';
+SELECT * FROM dr1 ORDER BY fname, ftype;
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id=10;
+SELECT * FROM t1 WHERE id=10;
+DELETE FROM t1 WHERE id in (4,60);
+SELECT * FROM t1;
+DROP TABLE t1;
+# TODO: this fails on Linux
+#SELECT * FROM dr1;
+
+--echo #
+--echo # Testing partitioning on a void outward table
+--echo #
+ALTER TABLE dr1 FILE_NAME='part*.*';
+CREATE TABLE t1 (
+ rwid INT(6) DEFAULT 0 SPECIAL=ROWID,
+ rnum INT(6) DEFAULT 0 SPECIAL=ROWNUM,
+ prtn VARCHAR(64) DEFAULT '' SPECIAL=PARTID,
+ tbn VARCHAR(64) DEFAULT '' SPECIAL=TABID,
+ fid VARCHAR(256) DEFAULT '' SPECIAL=FNAME,
+ id INT KEY NOT NULL,
+ msg VARCHAR(32)
+) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='part%s.txt';
+--replace_result $MYSQLD_DATADIR "DATADIR/"
+ALTER TABLE t1
+PARTITION by range columns(id) (
+PARTITION `1` VALUES LESS THAN(10),
+PARTITION `2` VALUES LESS THAN(50),
+PARTITION `3` VALUES LESS THAN(MAXVALUE));
+SHOW INDEX FROM t1;
+# TODO: this fails on Linux
+#SELECT * FROM dr1 ORDER BY fname, ftype;
+INSERT INTO t1(id,msg) VALUES(4, 'four');
+SELECT * FROM dr1 ORDER BY fname, ftype;
+INSERT INTO t1(id,msg) VALUES(7,'seven'),(10,'ten'),(40,'forty'),(60,'sixty'),(81,'eighty one');
+INSERT INTO t1(id,msg) VALUES(72,'seventy two'),(20,'twenty'),(1,'one'),(35,'thirty five'),(8,'eight');
+SELECT partition_name, table_rows FROM information_schema.partitions WHERE table_name = 't1';
+SELECT * FROM t1;
+SELECT * FROM t1 order by id;
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id = 10;
+SELECT * FROM t1 WHERE id = 10;
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id >= 10;
+SELECT * FROM t1 WHERE id >= 10;
+SELECT count(*) FROM t1 WHERE id < 10;
+SELECT case when id < 10 then 1 when id < 50 then 2 else 3 end as pn, count(*) FROM t1 group by pn;
+SELECT prtn, count(*) FROM t1 group by prtn;
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id > 50;
+SELECT * FROM t1 WHERE id = 35;
+SELECT * FROM dr1 ORDER BY fname, ftype;
+--echo # This does not change the partition file data and is WRONG
+ALTER TABLE t1
+PARTITION by range columns(id) (
+PARTITION `1` VALUES LESS THAN(11),
+PARTITION `2` VALUES LESS THAN(70),
+PARTITION `3` VALUES LESS THAN(MAXVALUE));
+SELECT CASE WHEN id < 11 THEN 1 WHEN id < 70 THEN 2 ELSE 3 END AS pn, COUNT(*) FROM t1 GROUP BY pn;
+SELECT partition_name, table_rows FROM information_schema.partitions WHERE table_name = 't1';
+SELECT * FROM dr1 ORDER BY fname, ftype;
+--echo #
+--echo # This is the correct way to change partitioning:
+--echo # Save table values, erase the table, then re-insert saved values in modified table
+--echo #
+CREATE TABLE t2 (
+ id INT NOT NULL,
+ msg VARCHAR(32)
+) ENGINE=CONNECT TABLE_TYPE=FIX;
+INSERT INTO t2 SELECT id, msg FROM t1;
+DELETE FROM t1;
+INSERT INTO t1(id,msg) SELECT * FROM t2;
+SELECT partition_name, table_rows FROM information_schema.partitions WHERE table_name = 't1';
+SELECT * FROM t1;
+SELECT * FROM dr1 ORDER BY fname, ftype;
+DROP TABLE t2;
+DROP TABLE t1;
+
+--echo #
+--echo # Testing partitioning on a populated outward table
+--echo #
+CREATE TABLE t1 (
+ id INT NOT NULL,
+ msg VARCHAR(32)
+) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='part%s.txt'
+PARTITION by range columns(id) (
+PARTITION `1` VALUES LESS THAN(11),
+PARTITION `2` VALUES LESS THAN(70),
+PARTITION `3` VALUES LESS THAN(MAXVALUE));
+SELECT partition_name, table_rows FROM information_schema.partitions WHERE table_name = 't1';
+SELECT * FROM t1 WHERE id < 11;
+SELECT * FROM t1 WHERE id >= 70;
+SELECT * FROM dr1 ORDER BY fname, ftype;
+
+--echo #
+--echo # Testing indexing on a partitioned table
+--echo #
+CREATE INDEX XID ON t1(id);
+SHOW INDEX FROM t1;
+SELECT * FROM dr1 ORDER BY fname, ftype;
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id = 10;
+DROP INDEX XID ON t1;
+SHOW INDEX FROM t1;
+SELECT * FROM dr1 ORDER BY fname, ftype;
+ALTER TABLE t1 ADD PRIMARY KEY (id);
+SHOW INDEX FROM t1;
+SELECT * FROM dr1 ORDER BY fname, ftype;
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id = 10;
+ALTER TABLE t1 DROP PRIMARY KEY;
+SHOW INDEX FROM t1;
+SELECT * FROM dr1 ORDER BY fname, ftype;
+DROP TABLE t1;
+DROP TABLE dr1;
+
+#
+# Clean up
+#
+set @@global.connect_exact_info=OFF;
+
+--remove_file $MYSQLD_DATADIR/test/part1.txt
+--remove_file $MYSQLD_DATADIR/test/part2.txt
+--remove_file $MYSQLD_DATADIR/test/part3.txt
+#--remove_file $MYSQLD_DATADIR/test/part%s.fnx
+#--remove_file $MYSQLD_DATADIR/test/part1.fnx
+#--remove_file $MYSQLD_DATADIR/test/part2.fnx
+#--remove_file $MYSQLD_DATADIR/test/part3.fnx
diff --git a/storage/connect/mysql-test/connect/t/part_table.test b/storage/connect/mysql-test/connect/t/part_table.test
index c5358d63c8e..d839337ba6f 100644
--- a/storage/connect/mysql-test/connect/t/part_table.test
+++ b/storage/connect/mysql-test/connect/t/part_table.test
@@ -1,92 +1,92 @@
---source include/not_embedded.inc
---source include/have_partition.inc
-
-set @@global.connect_exact_info=ON;
-
-#
-# These will be used by the t1 table partition table
-#
-CREATE TABLE xt1 (
-id INT KEY NOT NULL,
-msg VARCHAR(32))
-ENGINE=MyISAM;
-INSERT INTO xt1 VALUES(4, 'four'),(7,'seven'),(1,'one'),(8,'eight');
-SELECT * FROM xt1;
-
-CREATE TABLE xt2 (
-id INT KEY NOT NULL,
-msg VARCHAR(32));
-INSERT INTO xt2 VALUES(10,'ten'),(40,'forty'),(11,'eleven'),(35,'thirty five');
-SELECT * FROM xt2;
-
-CREATE TABLE xt3 (
-id INT KEY NOT NULL,
-msg VARCHAR(32))
-ENGINE=CONNECT TABLE_TYPE=CSV AVG_ROW_LENGTH=10;
-INSERT INTO xt3 VALUES(60,'sixty'),(81,'eighty one'),(72,'seventy two');
-SELECT * FROM xt3;
-
-#
-# Based on PROXY the table is not indexable
-#
-CREATE TABLE t1 (
-id INT NOT NULL,
-msg VARCHAR(32))
-ENGINE=CONNECT TABLE_TYPE=PROXY TABNAME='xt%s'
-PARTITION BY RANGE COLUMNS(id) (
-PARTITION `1` VALUES LESS THAN(10),
-PARTITION `2` VALUES LESS THAN(50),
-PARTITION `3` VALUES LESS THAN(MAXVALUE));
-SELECT partition_name, table_rows FROM information_schema.partitions WHERE table_name = 't1';
-SELECT * FROM t1;
-DELETE FROM t1;
---error ER_UNKNOWN_ERROR
-ALTER TABLE t1 ADD INDEX XID(id);
-INSERT INTO t1 VALUES(4, 'four');
-INSERT INTO t1 VALUES(7,'seven'),(10,'ten'),(40,'forty'),(60,'sixty'),(81,'eighty one');
-INSERT INTO t1 VALUES(72,'seventy two'),(11,'eleven'),(1,'one'),(35,'thirty five'),(8,'eight');
-SELECT partition_name, table_rows FROM information_schema.partitions WHERE table_name = 't1';
-SELECT * FROM t1;
-EXPLAIN PARTITIONS
-SELECT * FROM t1 WHERE id = 81;
-DELETE FROM t1;
-DROP TABLE t1;
-
-#
-# Based on MYSQL the table is indexable
-#
-CREATE TABLE t1 (
-id INT KEY NOT NULL,
-msg VARCHAR(32))
-ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='xt%s'
-PARTITION BY RANGE COLUMNS(id) (
-PARTITION `1` VALUES LESS THAN(10),
-PARTITION `2` VALUES LESS THAN(50),
-PARTITION `3` VALUES LESS THAN(MAXVALUE));
-SHOW INDEX FROM t1;
-INSERT INTO t1 VALUES(4, 'four');
-INSERT INTO t1 VALUES(40, 'forty');
-INSERT INTO t1 VALUES(72,'seventy two');
-INSERT INTO t1 VALUES(7,'seven'),(10,'ten'),(60,'sixty'),(81,'eighty one'),(11,'eleven'),(1,'one'),(35,'thirty five'),(8,'eight');
-SELECT partition_name, table_rows FROM information_schema.partitions WHERE table_name = 't1';
-SELECT * FROM t1;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id = 81;
-SELECT * FROM t1 WHERE id = 7;
-SELECT * FROM t1 WHERE id = 35;
-UPDATE t1 SET msg = 'number' WHERE id in (60,72);
-UPDATE t1 SET msg = 'soixante' WHERE id = 60;
-SELECT * FROM t1 WHERE id > 50;
-UPDATE t1 SET msg = 'big' WHERE id > 50;
-UPDATE t1 SET msg = 'sept' WHERE id = 7;
-SELECT * FROM t1;
-DELETE FROM t1 WHERE id in (60,72);
-SELECT * FROM t1;
-DROP TABLE t1;
-DROP TABLE xt1;
-DROP TABLE xt2;
-DROP TABLE xt3;
-
-#
-# Clean up
-#
-set @@global.connect_exact_info=OFF;
+--source include/not_embedded.inc
+--source include/have_partition.inc
+
+set @@global.connect_exact_info=ON;
+
+#
+# These will be used by the t1 table partition table
+#
+CREATE TABLE xt1 (
+id INT KEY NOT NULL,
+msg VARCHAR(32))
+ENGINE=MyISAM;
+INSERT INTO xt1 VALUES(4, 'four'),(7,'seven'),(1,'one'),(8,'eight');
+SELECT * FROM xt1;
+
+CREATE TABLE xt2 (
+id INT KEY NOT NULL,
+msg VARCHAR(32));
+INSERT INTO xt2 VALUES(10,'ten'),(40,'forty'),(11,'eleven'),(35,'thirty five');
+SELECT * FROM xt2;
+
+CREATE TABLE xt3 (
+id INT KEY NOT NULL,
+msg VARCHAR(32))
+ENGINE=CONNECT TABLE_TYPE=CSV AVG_ROW_LENGTH=10;
+INSERT INTO xt3 VALUES(60,'sixty'),(81,'eighty one'),(72,'seventy two');
+SELECT * FROM xt3;
+
+#
+# Based on PROXY the table is not indexable
+#
+CREATE TABLE t1 (
+id INT NOT NULL,
+msg VARCHAR(32))
+ENGINE=CONNECT TABLE_TYPE=PROXY TABNAME='xt%s'
+PARTITION BY RANGE COLUMNS(id) (
+PARTITION `1` VALUES LESS THAN(10),
+PARTITION `2` VALUES LESS THAN(50),
+PARTITION `3` VALUES LESS THAN(MAXVALUE));
+SELECT partition_name, table_rows FROM information_schema.partitions WHERE table_name = 't1';
+SELECT * FROM t1;
+DELETE FROM t1;
+--error ER_UNKNOWN_ERROR
+ALTER TABLE t1 ADD INDEX XID(id);
+INSERT INTO t1 VALUES(4, 'four');
+INSERT INTO t1 VALUES(7,'seven'),(10,'ten'),(40,'forty'),(60,'sixty'),(81,'eighty one');
+INSERT INTO t1 VALUES(72,'seventy two'),(11,'eleven'),(1,'one'),(35,'thirty five'),(8,'eight');
+SELECT partition_name, table_rows FROM information_schema.partitions WHERE table_name = 't1';
+SELECT * FROM t1;
+EXPLAIN PARTITIONS
+SELECT * FROM t1 WHERE id = 81;
+DELETE FROM t1;
+DROP TABLE t1;
+
+#
+# Based on MYSQL the table is indexable
+#
+CREATE TABLE t1 (
+id INT KEY NOT NULL,
+msg VARCHAR(32))
+ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='xt%s'
+PARTITION BY RANGE COLUMNS(id) (
+PARTITION `1` VALUES LESS THAN(10),
+PARTITION `2` VALUES LESS THAN(50),
+PARTITION `3` VALUES LESS THAN(MAXVALUE));
+SHOW INDEX FROM t1;
+INSERT INTO t1 VALUES(4, 'four');
+INSERT INTO t1 VALUES(40, 'forty');
+INSERT INTO t1 VALUES(72,'seventy two');
+INSERT INTO t1 VALUES(7,'seven'),(10,'ten'),(60,'sixty'),(81,'eighty one'),(11,'eleven'),(1,'one'),(35,'thirty five'),(8,'eight');
+SELECT partition_name, table_rows FROM information_schema.partitions WHERE table_name = 't1';
+SELECT * FROM t1;
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id = 81;
+SELECT * FROM t1 WHERE id = 7;
+SELECT * FROM t1 WHERE id = 35;
+UPDATE t1 SET msg = 'number' WHERE id in (60,72);
+UPDATE t1 SET msg = 'soixante' WHERE id = 60;
+SELECT * FROM t1 WHERE id > 50;
+UPDATE t1 SET msg = 'big' WHERE id > 50;
+UPDATE t1 SET msg = 'sept' WHERE id = 7;
+SELECT * FROM t1;
+DELETE FROM t1 WHERE id in (60,72);
+SELECT * FROM t1;
+DROP TABLE t1;
+DROP TABLE xt1;
+DROP TABLE xt2;
+DROP TABLE xt3;
+
+#
+# Clean up
+#
+set @@global.connect_exact_info=OFF;
diff --git a/storage/connect/mysql-test/connect/t/pivot.test b/storage/connect/mysql-test/connect/t/pivot.test
index d26e6cec628..09544f27afa 100644
--- a/storage/connect/mysql-test/connect/t/pivot.test
+++ b/storage/connect/mysql-test/connect/t/pivot.test
@@ -1,163 +1,163 @@
--- source include/not_embedded.inc
-
-let $MYSQLD_DATADIR= `select @@datadir`;
-let $PORT= `select @@port`;
---copy_file $MTR_SUITE_DIR/std_data/expenses.txt $MYSQLD_DATADIR/test/expenses.txt
-
---echo #
---echo # Testing the PIVOT table type
---echo #
-CREATE TABLE expenses (
-Who CHAR(10) NOT NULL,
-Week INT(2) NOT NULL,
-What CHAR(12) NOT NULL,
-Amount DOUBLE(8,2))
-ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='expenses.txt' ENDING=2;
-SELECT * FROM expenses;
-
---echo #
---echo # Pivoting from What
---echo #
-CREATE TABLE pivex (
-Who CHAR(10) NOT NULL,
-Week INT(2) NOT NULL,
-Beer DOUBLE(8,2) FLAG=1,
-Car DOUBLE(8,2) FLAG=1,
-Food DOUBLE(8,2) FLAG=1)
-ENGINE=CONNECT TABLE_TYPE=PIVOT TABNAME=expenses;
---replace_result $PORT PORT
---eval ALTER TABLE pivex OPTION_LIST='port=$PORT'
-SELECT * FROM pivex;
-
---echo #
---echo # Restricting the columns in a Pivot Table
---echo #
-ALTER TABLE pivex DROP COLUMN week;
-SELECT * FROM pivex;
-
---echo #
---echo # Using a source definition
---echo #
-DROP TABLE pivex;
-CREATE TABLE pivex (
-Who CHAR(10) NOT NULL,
-Week INT(2) NOT NULL,
-Beer DOUBLE(8,2) FLAG=1,
-Car DOUBLE(8,2) FLAG=1,
-Food DOUBLE(8,2) FLAG=1)
-ENGINE=CONNECT TABLE_TYPE=PIVOT
-SRCDEF='select who, week, what, sum(amount) as amount from expenses where week in (4,5) group by who, week, what';
---replace_result $PORT PORT
---eval ALTER TABLE pivex OPTION_LIST='PivotCol=what,FncCol=amount,port=$PORT'
-SELECT * FROM pivex;
-
---echo #
---echo # Pivoting from Week
---echo #
-DROP TABLE pivex;
-CREATE TABLE pivex (
-Who CHAR(10) NOT NULL,
-What CHAR(12) NOT NULL,
-`3` DOUBLE(8,2) FLAG=1,
-`4` DOUBLE(8,2) FLAG=1,
-`5` DOUBLE(8,2) FLAG=1)
-ENGINE=CONNECT TABLE_TYPE=PIVOT TABNAME=expenses;
---replace_result $PORT PORT
---eval ALTER TABLE pivex OPTION_LIST='PivotCol=Week,port=$PORT'
-SELECT * FROM pivex;
-
---echo #
---echo # Using scalar functions and expresssions
---echo #
-DROP TABLE pivex;
-CREATE TABLE pivex (
-Who CHAR(10) NOT NULL,
-What CHAR(12) NOT NULL,
-First DOUBLE(8,2) FLAG=1,
-Middle DOUBLE(8,2) FLAG=1,
-Last DOUBLE(8,2) FLAG=1)
-ENGINE=CONNECT TABLE_TYPE=PIVOT
-SRCDEF='select who, what, case when week=3 then ''First'' when week=5 then ''Last'' else ''Middle'' end as wk, sum(amount) * 6.56 as amnt from expenses group by who, what, wk';
---replace_result $PORT PORT
---eval ALTER TABLE pivex OPTION_LIST='PivotCol=wk,FncCol=amnt,port=$PORT'
-SELECT * FROM pivex;
-DROP TABLE pivex;
-DROP TABLE expenses;
-
---echo #
---echo # Make the PETS table
---echo #
-CREATE TABLE pets (
-Name VARCHAR(12) NOT NULL,
-Race CHAR(6) NOT NULL,
-Number INT NOT NULL) ENGINE=MYISAM;
-INSERT INTO pets VALUES('John','dog',2);
-INSERT INTO pets VALUES('Bill','cat',1);
-INSERT INTO pets VALUES('Mary','dog',1);
-INSERT INTO pets VALUES('Mary','cat',1);
-INSERT INTO pets VALUES('Lisbeth','rabbit',2);
-INSERT INTO pets VALUES('Kevin','cat',2);
-INSERT INTO pets VALUES('Kevin','bird',6);
-INSERT INTO pets VALUES('Donald','dog',1);
-INSERT INTO pets VALUES('Donald','fish',3);
-SELECT * FROM pets;
-
---echo #
---echo # Pivot the PETS table
---echo #
-CREATE TABLE pivet (
-name VARCHAR(12) NOT NULL,
-dog INT NOT NULL DEFAULT 0 FLAG=1,
-cat INT NOT NULL DEFAULT 0 FLAG=1,
-rabbit INT NOT NULL DEFAULT 0 FLAG=1,
-bird INT NOT NULL DEFAULT 0 FLAG=1,
-fish INT NOT NULL DEFAULT 0 FLAG=1)
-ENGINE=CONNECT TABLE_TYPE=PIVOT TABNAME=pets OPTION_LIST='PivotCol=race,groupby=1';
-SELECT * FROM pivet;
-DROP TABLE pivet;
-
---echo #
---echo # Testing the "data" column list
---echo #
-CREATE TABLE pivet (
-name VARCHAR(12) NOT NULL,
-dog INT NOT NULL DEFAULT 0 FLAG=1,
-cat INT NOT NULL DEFAULT 0 FLAG=1)
-ENGINE=CONNECT TABLE_TYPE=PIVOT TABNAME=pets OPTION_LIST='PivotCol=race,groupby=1';
---error ER_GET_ERRMSG
-SELECT * FROM pivet;
-ALTER TABLE pivet OPTION_LIST='PivotCol=race,groupby=1,accept=1';
-SELECT * FROM pivet;
-DROP TABLE pivet;
-
---echo #
---echo # Adding a "dump" column
---echo #
-CREATE TABLE pivet (
-name VARCHAR(12) NOT NULL,
-dog INT NOT NULL DEFAULT 0 FLAG=1,
-cat INT NOT NULL DEFAULT 0 FLAG=1,
-other INT NOT NULL DEFAULT 0 FLAG=2)
-ENGINE=CONNECT TABLE_TYPE=PIVOT TABNAME=pets OPTION_LIST='PivotCol=race,groupby=1';
-SELECT * FROM pivet;
-
-DROP TABLE pivet;
-DROP TABLE pets;
-
---echo #
---echo # MDEV-5734
---echo #
-CREATE TABLE fruit (
- `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `name` varchar(32) NOT NULL,
- `cnt` int(11) DEFAULT NULL,
- PRIMARY KEY (`id`)
-) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;
-INSERT INTO fruit VALUES (1,'apple',1),(2,'banana',1),(3,'apple',2),(4,'cherry',4),(5,'durazno',2);
-SELECT * FROM fruit;
-CREATE TABLE fruit_pivot ENGINE=CONNECT TABLE_TYPE=pivot TABNAME=fruit;
-SELECT * FROM fruit_pivot;
-
-DROP TABLE fruit_pivot;
-DROP TABLE fruit;
---remove_file $MYSQLD_DATADIR/test/expenses.txt
+-- source include/not_embedded.inc
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+let $PORT= `select @@port`;
+--copy_file $MTR_SUITE_DIR/std_data/expenses.txt $MYSQLD_DATADIR/test/expenses.txt
+
+--echo #
+--echo # Testing the PIVOT table type
+--echo #
+CREATE TABLE expenses (
+Who CHAR(10) NOT NULL,
+Week INT(2) NOT NULL,
+What CHAR(12) NOT NULL,
+Amount DOUBLE(8,2))
+ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='expenses.txt' ENDING=2;
+SELECT * FROM expenses;
+
+--echo #
+--echo # Pivoting from What
+--echo #
+CREATE TABLE pivex (
+Who CHAR(10) NOT NULL,
+Week INT(2) NOT NULL,
+Beer DOUBLE(8,2) FLAG=1,
+Car DOUBLE(8,2) FLAG=1,
+Food DOUBLE(8,2) FLAG=1)
+ENGINE=CONNECT TABLE_TYPE=PIVOT TABNAME=expenses;
+--replace_result $PORT PORT
+--eval ALTER TABLE pivex OPTION_LIST='port=$PORT'
+SELECT * FROM pivex;
+
+--echo #
+--echo # Restricting the columns in a Pivot Table
+--echo #
+ALTER TABLE pivex DROP COLUMN week;
+SELECT * FROM pivex;
+
+--echo #
+--echo # Using a source definition
+--echo #
+DROP TABLE pivex;
+CREATE TABLE pivex (
+Who CHAR(10) NOT NULL,
+Week INT(2) NOT NULL,
+Beer DOUBLE(8,2) FLAG=1,
+Car DOUBLE(8,2) FLAG=1,
+Food DOUBLE(8,2) FLAG=1)
+ENGINE=CONNECT TABLE_TYPE=PIVOT
+SRCDEF='select who, week, what, sum(amount) as amount from expenses where week in (4,5) group by who, week, what';
+--replace_result $PORT PORT
+--eval ALTER TABLE pivex OPTION_LIST='PivotCol=what,FncCol=amount,port=$PORT'
+SELECT * FROM pivex;
+
+--echo #
+--echo # Pivoting from Week
+--echo #
+DROP TABLE pivex;
+CREATE TABLE pivex (
+Who CHAR(10) NOT NULL,
+What CHAR(12) NOT NULL,
+`3` DOUBLE(8,2) FLAG=1,
+`4` DOUBLE(8,2) FLAG=1,
+`5` DOUBLE(8,2) FLAG=1)
+ENGINE=CONNECT TABLE_TYPE=PIVOT TABNAME=expenses;
+--replace_result $PORT PORT
+--eval ALTER TABLE pivex OPTION_LIST='PivotCol=Week,port=$PORT'
+SELECT * FROM pivex;
+
+--echo #
+--echo # Using scalar functions and expresssions
+--echo #
+DROP TABLE pivex;
+CREATE TABLE pivex (
+Who CHAR(10) NOT NULL,
+What CHAR(12) NOT NULL,
+First DOUBLE(8,2) FLAG=1,
+Middle DOUBLE(8,2) FLAG=1,
+Last DOUBLE(8,2) FLAG=1)
+ENGINE=CONNECT TABLE_TYPE=PIVOT
+SRCDEF='select who, what, case when week=3 then ''First'' when week=5 then ''Last'' else ''Middle'' end as wk, sum(amount) * 6.56 as amnt from expenses group by who, what, wk';
+--replace_result $PORT PORT
+--eval ALTER TABLE pivex OPTION_LIST='PivotCol=wk,FncCol=amnt,port=$PORT'
+SELECT * FROM pivex;
+DROP TABLE pivex;
+DROP TABLE expenses;
+
+--echo #
+--echo # Make the PETS table
+--echo #
+CREATE TABLE pets (
+Name VARCHAR(12) NOT NULL,
+Race CHAR(6) NOT NULL,
+Number INT NOT NULL) ENGINE=MYISAM;
+INSERT INTO pets VALUES('John','dog',2);
+INSERT INTO pets VALUES('Bill','cat',1);
+INSERT INTO pets VALUES('Mary','dog',1);
+INSERT INTO pets VALUES('Mary','cat',1);
+INSERT INTO pets VALUES('Lisbeth','rabbit',2);
+INSERT INTO pets VALUES('Kevin','cat',2);
+INSERT INTO pets VALUES('Kevin','bird',6);
+INSERT INTO pets VALUES('Donald','dog',1);
+INSERT INTO pets VALUES('Donald','fish',3);
+SELECT * FROM pets;
+
+--echo #
+--echo # Pivot the PETS table
+--echo #
+CREATE TABLE pivet (
+name VARCHAR(12) NOT NULL,
+dog INT NOT NULL DEFAULT 0 FLAG=1,
+cat INT NOT NULL DEFAULT 0 FLAG=1,
+rabbit INT NOT NULL DEFAULT 0 FLAG=1,
+bird INT NOT NULL DEFAULT 0 FLAG=1,
+fish INT NOT NULL DEFAULT 0 FLAG=1)
+ENGINE=CONNECT TABLE_TYPE=PIVOT TABNAME=pets OPTION_LIST='PivotCol=race,groupby=1';
+SELECT * FROM pivet;
+DROP TABLE pivet;
+
+--echo #
+--echo # Testing the "data" column list
+--echo #
+CREATE TABLE pivet (
+name VARCHAR(12) NOT NULL,
+dog INT NOT NULL DEFAULT 0 FLAG=1,
+cat INT NOT NULL DEFAULT 0 FLAG=1)
+ENGINE=CONNECT TABLE_TYPE=PIVOT TABNAME=pets OPTION_LIST='PivotCol=race,groupby=1';
+--error ER_GET_ERRMSG
+SELECT * FROM pivet;
+ALTER TABLE pivet OPTION_LIST='PivotCol=race,groupby=1,accept=1';
+SELECT * FROM pivet;
+DROP TABLE pivet;
+
+--echo #
+--echo # Adding a "dump" column
+--echo #
+CREATE TABLE pivet (
+name VARCHAR(12) NOT NULL,
+dog INT NOT NULL DEFAULT 0 FLAG=1,
+cat INT NOT NULL DEFAULT 0 FLAG=1,
+other INT NOT NULL DEFAULT 0 FLAG=2)
+ENGINE=CONNECT TABLE_TYPE=PIVOT TABNAME=pets OPTION_LIST='PivotCol=race,groupby=1';
+SELECT * FROM pivet;
+
+DROP TABLE pivet;
+DROP TABLE pets;
+
+--echo #
+--echo # MDEV-5734
+--echo #
+CREATE TABLE fruit (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `name` varchar(32) NOT NULL,
+ `cnt` int(11) DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;
+INSERT INTO fruit VALUES (1,'apple',1),(2,'banana',1),(3,'apple',2),(4,'cherry',4),(5,'durazno',2);
+SELECT * FROM fruit;
+CREATE TABLE fruit_pivot ENGINE=CONNECT TABLE_TYPE=pivot TABNAME=fruit;
+SELECT * FROM fruit_pivot;
+
+DROP TABLE fruit_pivot;
+DROP TABLE fruit;
+--remove_file $MYSQLD_DATADIR/test/expenses.txt
diff --git a/storage/connect/mysql-test/connect/t/tbl.test b/storage/connect/mysql-test/connect/t/tbl.test
index bdd928366ef..43c506c9403 100644
--- a/storage/connect/mysql-test/connect/t/tbl.test
+++ b/storage/connect/mysql-test/connect/t/tbl.test
@@ -1,53 +1,53 @@
--- source include/not_embedded.inc
-
-let $MYSQLD_DATADIR= `select @@datadir`;
-let $PORT= `select @@port`;
-
---echo #
---echo # Checking TBL tables
---echo #
-CREATE TABLE t1 (
-a INT NOT NULL,
-message CHAR(10)) ENGINE=connect;
-INSERT INTO t1 VALUES (1,'Testing'),(2,'dos table'),(3,'t1');
-SELECT * FROM t1;
-
-CREATE TABLE t2 (
-a INT NOT NULL,
-message CHAR(10)) ENGINE=connect TABLE_TYPE=BIN;
-INSERT INTO t2 VALUES (1,'Testing'),(2,NULL),(3,'t2');
-SELECT * FROM t2;
-
-CREATE TABLE t3 (
-a INT NOT NULL,
-message CHAR(10)) ENGINE=connect TABLE_TYPE=CSV;
-INSERT INTO t3 VALUES (1,'Testing'),(2,'csv table'),(3,'t3');
-SELECT * FROM t3;
-
-CREATE TABLE t4 (
-ta INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
-message CHAR(20)) ENGINE=MyISAM;
-INSERT INTO t4 (message) VALUES ('Testing'),('myisam table'),('t4');
-SELECT * FROM t4;
-
---replace_result $PORT PORT
---eval CREATE TABLE total (tabname CHAR(8) NOT NULL SPECIAL='TABID', ta TINYINT NOT NULL FLAG=1, message CHAR(20)) engine=CONNECT table_type=TBL table_list='t1,t2,t3,t4' option_list='port=$PORT'
-
-select * from total;
-select * from total where tabname = 't2';
-select * from total where tabname = 't2' and ta = 3;
-select * from total where tabname in ('t1','t4');
-select * from total where ta = 3 and tabname in ('t1','t2');
-select * from total where tabname <> 't2';
-select * from total where tabname != 't2' and ta = 3;
-select * from total where tabname not in ('t2','t3');
-select * from total where ta = 3 and tabname in ('t2','t3');
-select * from total where ta = 3 or tabname in ('t2','t4');
-select * from total where not tabname = 't2';
-select * from total where tabname = 't2' or tabname = 't1';
-
-DROP TABLE total;
-DROP TABLE t1;
-DROP TABLE t2;
-DROP TABLE t3;
-DROP TABLE t4;
+-- source include/not_embedded.inc
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+let $PORT= `select @@port`;
+
+--echo #
+--echo # Checking TBL tables
+--echo #
+CREATE TABLE t1 (
+a INT NOT NULL,
+message CHAR(10)) ENGINE=connect;
+INSERT INTO t1 VALUES (1,'Testing'),(2,'dos table'),(3,'t1');
+SELECT * FROM t1;
+
+CREATE TABLE t2 (
+a INT NOT NULL,
+message CHAR(10)) ENGINE=connect TABLE_TYPE=BIN;
+INSERT INTO t2 VALUES (1,'Testing'),(2,NULL),(3,'t2');
+SELECT * FROM t2;
+
+CREATE TABLE t3 (
+a INT NOT NULL,
+message CHAR(10)) ENGINE=connect TABLE_TYPE=CSV;
+INSERT INTO t3 VALUES (1,'Testing'),(2,'csv table'),(3,'t3');
+SELECT * FROM t3;
+
+CREATE TABLE t4 (
+ta INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+message CHAR(20)) ENGINE=MyISAM;
+INSERT INTO t4 (message) VALUES ('Testing'),('myisam table'),('t4');
+SELECT * FROM t4;
+
+--replace_result $PORT PORT
+--eval CREATE TABLE total (tabname CHAR(8) NOT NULL SPECIAL='TABID', ta TINYINT NOT NULL FLAG=1, message CHAR(20)) engine=CONNECT table_type=TBL table_list='t1,t2,t3,t4' option_list='port=$PORT'
+
+select * from total;
+select * from total where tabname = 't2';
+select * from total where tabname = 't2' and ta = 3;
+select * from total where tabname in ('t1','t4');
+select * from total where ta = 3 and tabname in ('t1','t2');
+select * from total where tabname <> 't2';
+select * from total where tabname != 't2' and ta = 3;
+select * from total where tabname not in ('t2','t3');
+select * from total where ta = 3 and tabname in ('t2','t3');
+select * from total where ta = 3 or tabname in ('t2','t4');
+select * from total where not tabname = 't2';
+select * from total where tabname = 't2' or tabname = 't1';
+
+DROP TABLE total;
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP TABLE t4;
diff --git a/storage/connect/mysql-test/connect/t/unsigned.test b/storage/connect/mysql-test/connect/t/unsigned.test
index 4374566086d..44eb832f8ae 100644
--- a/storage/connect/mysql-test/connect/t/unsigned.test
+++ b/storage/connect/mysql-test/connect/t/unsigned.test
@@ -1,35 +1,35 @@
---echo #
---echo # Testing unsigned types
---echo #
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 (
-a TINYINT UNSIGNED NOT NULL,
-b SMALLINT ZEROFILL NOT NULL,
-c INT UNSIGNED NOT NULL,
-d BIGINT UNSIGNED NOT NULL,
-e CHAR(32) NOT NULL DEFAULT '???') ENGINE=CONNECT TABLE_TYPE=FIX;
-DESCRIBE t1;
-INSERT INTO t1(a,b,c,d) VALUES(255,65535,4294967295,18446744073709551615);
-SELECT * FROM t1;
-UPDATE t1 SET e = d;
-SELECT * FROM t1;
-UPDATE t1 SET c = d;
-SELECT * FROM t1;
-UPDATE t1 SET c = e;
-SELECT * FROM t1;
-UPDATE t1 SET d = e;
-SELECT * FROM t1;
-
-DROP TABLE IF EXISTS t2;
-CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=PROXY TABNAME=t1;
-DESCRIBE t2;
-SELECT * FROM t2;
-
-# Moved to mysql.test (cannot be executed if embedded)
-#DROP TABLE t2;
-#CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME=t1;
-#DESCRIBE t2;
-#SELECT * FROM t2;
-
-DROP TABLE t2;
-DROP TABLE t1;
+--echo #
+--echo # Testing unsigned types
+--echo #
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (
+a TINYINT UNSIGNED NOT NULL,
+b SMALLINT ZEROFILL NOT NULL,
+c INT UNSIGNED NOT NULL,
+d BIGINT UNSIGNED NOT NULL,
+e CHAR(32) NOT NULL DEFAULT '???') ENGINE=CONNECT TABLE_TYPE=FIX;
+DESCRIBE t1;
+INSERT INTO t1(a,b,c,d) VALUES(255,65535,4294967295,18446744073709551615);
+SELECT * FROM t1;
+UPDATE t1 SET e = d;
+SELECT * FROM t1;
+UPDATE t1 SET c = d;
+SELECT * FROM t1;
+UPDATE t1 SET c = e;
+SELECT * FROM t1;
+UPDATE t1 SET d = e;
+SELECT * FROM t1;
+
+DROP TABLE IF EXISTS t2;
+CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=PROXY TABNAME=t1;
+DESCRIBE t2;
+SELECT * FROM t2;
+
+# Moved to mysql.test (cannot be executed if embedded)
+#DROP TABLE t2;
+#CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME=t1;
+#DESCRIBE t2;
+#SELECT * FROM t2;
+
+DROP TABLE t2;
+DROP TABLE t1;
diff --git a/storage/connect/mysql-test/connect/t/upd.test b/storage/connect/mysql-test/connect/t/upd.test
index f6461bfed96..a3716694c4a 100644
--- a/storage/connect/mysql-test/connect/t/upd.test
+++ b/storage/connect/mysql-test/connect/t/upd.test
@@ -1,153 +1,153 @@
-let $MYSQLD_DATADIR= `select @@datadir`;
---copy_file $MTR_SUITE_DIR/std_data/employee.dat $MYSQLD_DATADIR/test/employee.dat
-
-CREATE TABLE employee
-(
-serialno CHAR(5) NOT NULL,
-name VARCHAR(12) NOT NULL FLAG=6,
-sex TINYINT(1) NOT NULL,
-title VARCHAR(15) NOT NULL FLAG=20,
-manager CHAR(5) NOT NULL,
-department CHAR(4) NOT NULL FLAG=41,
-secretary CHAR(5) NOT NULL FLAG=46,
-salary DOUBLE(8,2) NOT NULL FLAG=52
-) ENGINE=connect TABLE_TYPE=fix FILE_NAME='employee.dat' ENDING=1;
-SELECT * FROM employee;
-
-DELIMITER //;
-CREATE PROCEDURE test.tst_up() DETERMINISTIC
-BEGIN
-SELECT * FROM t1;
-UPDATE t1 SET salary = salary + 1, title = 'RESEARCH' WHERE title = 'SCIENTIST';
-UPDATE t1 SET salary = salary + 1, title = 'TECHNICIAN' WHERE title = 'ENGINEER';
-UPDATE t1 SET title = 'PUPPET' WHERE name = 'TONGHO';
-UPDATE t1 SET salary = 0. WHERE title = 'XXX';
-SELECT * FROM t1;
-DELETE FROM t1 WHERE title = 'SECRETARY';
-DELETE FROM t1 WHERE title = 'DIRECTOR';
-DELETE FROM t1 WHERE title = 'TYPIST';
-SELECT * FROM t1;
-DELETE FROM t1 LIMIT 3;
-INSERT INTO t1(serialno, name, title, salary) VALUES('66666','NEWMAN','ENGINEER',10000.80);
-SELECT * FROM t1;
-DROP TABLE t1;
-END//
-DELIMITER ;//
-
---echo #
---echo # Testing DOS table changes
---echo #
-CREATE TABLE t1 ENGINE=connect AS SELECT * FROM employee;
-CALL test.tst_up();
-
---echo #
---echo # Testing DOS table changes
---echo #
-CREATE TABLE t1 ENGINE=connect mapped=yes AS SELECT * FROM employee;
-CALL test.tst_up();
-
---echo #
---echo # Testing FIX table changes
---echo #
-CREATE TABLE t1 ENGINE=connect TABLE_TYPE=fix AS SELECT * FROM employee;
-CALL test.tst_up();
-
---echo #
---echo # Testing FIX table changes
---echo #
-CREATE TABLE t1 ENGINE=connect TABLE_TYPE=fix mapped=yes AS SELECT * FROM employee;
-CALL test.tst_up();
-
---echo #
---echo # Testing FIX table changes
---echo #
-CREATE TABLE t1 ENGINE=connect TABLE_TYPE=fix huge=yes AS SELECT * FROM employee;
-CALL test.tst_up();
-
---echo #
---echo # Testing CSV table changes
---echo #
-CREATE TABLE t1 ENGINE=connect TABLE_TYPE=csv AS SELECT * FROM employee;
-CALL test.tst_up();
-
---echo #
---echo # Testing CSV table changes
---echo #
-CREATE TABLE t1 ENGINE=connect TABLE_TYPE=csv mapped=yes AS SELECT * FROM employee;
-CALL test.tst_up();
-
---echo #
---echo # Testing DBF table changes
---echo #
-CREATE TABLE t1 ENGINE=connect TABLE_TYPE=dbf AS SELECT * FROM employee;
-CALL test.tst_up();
-
---echo #
---echo # Testing DBF table changes
---echo #
-CREATE TABLE t1 ENGINE=connect TABLE_TYPE=dbf mapped=yes AS SELECT * FROM employee;
-CALL test.tst_up();
-
---echo #
---echo # Testing BIN table changes
---echo #
-CREATE TABLE t1 ENGINE=connect TABLE_TYPE=bin AS SELECT * FROM employee;
-CALL test.tst_up();
-
---echo #
---echo # Testing BIN table changes
---echo #
-CREATE TABLE t1 ENGINE=connect TABLE_TYPE=bin mapped=yes AS SELECT * FROM employee;
-CALL test.tst_up();
-
---echo #
---echo # Testing BIN table changes
---echo #
-CREATE TABLE t1 ENGINE=connect TABLE_TYPE=bin huge=yes AS SELECT * FROM employee;
-CALL test.tst_up();
-
---echo #
---echo # Testing VEC table changes
---echo #
-CREATE TABLE t1 ENGINE=connect TABLE_TYPE=vec MAX_ROWS=30 AS SELECT * FROM employee;
-CALL test.tst_up();
-
---echo #
---echo # Testing VEC table changes
---echo #
-CREATE TABLE t1 ENGINE=connect TABLE_TYPE=vec mapped=yes MAX_ROWS=30 AS SELECT * FROM employee;
-CALL test.tst_up();
-
---echo #
---echo # Testing VEC table changes
---echo #
-CREATE TABLE t1 ENGINE=connect TABLE_TYPE=vec huge=yes MAX_ROWS=30 AS SELECT * FROM employee;
-CALL test.tst_up();
-
---echo #
---echo # Testing INI table changes
---echo #
-CREATE TABLE t1
-(
-serialno CHAR(5) NOT NULL FLAG=1,
-name VARCHAR(12) NOT NULL,
-sex TINYINT(1),
-title VARCHAR(15) NOT NULL,
-manager CHAR(5),
-department CHAR(4),
-secretary CHAR(5),
-salary DOUBLE(8,2) NOT NULL
-) ENGINE=connect TABLE_TYPE=ini;
-INSERT INTO t1 SELECT * FROM employee;
-CALL test.tst_up();
-
---echo #
---echo # Testing XML table changes (must be in a separate test)
---echo #
-#CREATE TABLE t1 ENGINE=connect TABLE_TYPE=xml option_list='rownode=dd' AS SELECT * FROM employee;
-#CALL test.tst_up();
-
-DROP PROCEDURE test.tst_up;
-DROP TABLE employee;
-
---remove_file $MYSQLD_DATADIR/test/employee.dat
+let $MYSQLD_DATADIR= `select @@datadir`;
+--copy_file $MTR_SUITE_DIR/std_data/employee.dat $MYSQLD_DATADIR/test/employee.dat
+
+CREATE TABLE employee
+(
+serialno CHAR(5) NOT NULL,
+name VARCHAR(12) NOT NULL FLAG=6,
+sex TINYINT(1) NOT NULL,
+title VARCHAR(15) NOT NULL FLAG=20,
+manager CHAR(5) NOT NULL,
+department CHAR(4) NOT NULL FLAG=41,
+secretary CHAR(5) NOT NULL FLAG=46,
+salary DOUBLE(8,2) NOT NULL FLAG=52
+) ENGINE=connect TABLE_TYPE=fix FILE_NAME='employee.dat' ENDING=1;
+SELECT * FROM employee;
+
+DELIMITER //;
+CREATE PROCEDURE test.tst_up() DETERMINISTIC
+BEGIN
+SELECT * FROM t1;
+UPDATE t1 SET salary = salary + 1, title = 'RESEARCH' WHERE title = 'SCIENTIST';
+UPDATE t1 SET salary = salary + 1, title = 'TECHNICIAN' WHERE title = 'ENGINEER';
+UPDATE t1 SET title = 'PUPPET' WHERE name = 'TONGHO';
+UPDATE t1 SET salary = 0. WHERE title = 'XXX';
+SELECT * FROM t1;
+DELETE FROM t1 WHERE title = 'SECRETARY';
+DELETE FROM t1 WHERE title = 'DIRECTOR';
+DELETE FROM t1 WHERE title = 'TYPIST';
+SELECT * FROM t1;
+DELETE FROM t1 LIMIT 3;
+INSERT INTO t1(serialno, name, title, salary) VALUES('66666','NEWMAN','ENGINEER',10000.80);
+SELECT * FROM t1;
+DROP TABLE t1;
+END//
+DELIMITER ;//
+
+--echo #
+--echo # Testing DOS table changes
+--echo #
+CREATE TABLE t1 ENGINE=connect AS SELECT * FROM employee;
+CALL test.tst_up();
+
+--echo #
+--echo # Testing DOS table changes
+--echo #
+CREATE TABLE t1 ENGINE=connect mapped=yes AS SELECT * FROM employee;
+CALL test.tst_up();
+
+--echo #
+--echo # Testing FIX table changes
+--echo #
+CREATE TABLE t1 ENGINE=connect TABLE_TYPE=fix AS SELECT * FROM employee;
+CALL test.tst_up();
+
+--echo #
+--echo # Testing FIX table changes
+--echo #
+CREATE TABLE t1 ENGINE=connect TABLE_TYPE=fix mapped=yes AS SELECT * FROM employee;
+CALL test.tst_up();
+
+--echo #
+--echo # Testing FIX table changes
+--echo #
+CREATE TABLE t1 ENGINE=connect TABLE_TYPE=fix huge=yes AS SELECT * FROM employee;
+CALL test.tst_up();
+
+--echo #
+--echo # Testing CSV table changes
+--echo #
+CREATE TABLE t1 ENGINE=connect TABLE_TYPE=csv AS SELECT * FROM employee;
+CALL test.tst_up();
+
+--echo #
+--echo # Testing CSV table changes
+--echo #
+CREATE TABLE t1 ENGINE=connect TABLE_TYPE=csv mapped=yes AS SELECT * FROM employee;
+CALL test.tst_up();
+
+--echo #
+--echo # Testing DBF table changes
+--echo #
+CREATE TABLE t1 ENGINE=connect TABLE_TYPE=dbf AS SELECT * FROM employee;
+CALL test.tst_up();
+
+--echo #
+--echo # Testing DBF table changes
+--echo #
+CREATE TABLE t1 ENGINE=connect TABLE_TYPE=dbf mapped=yes AS SELECT * FROM employee;
+CALL test.tst_up();
+
+--echo #
+--echo # Testing BIN table changes
+--echo #
+CREATE TABLE t1 ENGINE=connect TABLE_TYPE=bin AS SELECT * FROM employee;
+CALL test.tst_up();
+
+--echo #
+--echo # Testing BIN table changes
+--echo #
+CREATE TABLE t1 ENGINE=connect TABLE_TYPE=bin mapped=yes AS SELECT * FROM employee;
+CALL test.tst_up();
+
+--echo #
+--echo # Testing BIN table changes
+--echo #
+CREATE TABLE t1 ENGINE=connect TABLE_TYPE=bin huge=yes AS SELECT * FROM employee;
+CALL test.tst_up();
+
+--echo #
+--echo # Testing VEC table changes
+--echo #
+CREATE TABLE t1 ENGINE=connect TABLE_TYPE=vec MAX_ROWS=30 AS SELECT * FROM employee;
+CALL test.tst_up();
+
+--echo #
+--echo # Testing VEC table changes
+--echo #
+CREATE TABLE t1 ENGINE=connect TABLE_TYPE=vec mapped=yes MAX_ROWS=30 AS SELECT * FROM employee;
+CALL test.tst_up();
+
+--echo #
+--echo # Testing VEC table changes
+--echo #
+CREATE TABLE t1 ENGINE=connect TABLE_TYPE=vec huge=yes MAX_ROWS=30 AS SELECT * FROM employee;
+CALL test.tst_up();
+
+--echo #
+--echo # Testing INI table changes
+--echo #
+CREATE TABLE t1
+(
+serialno CHAR(5) NOT NULL FLAG=1,
+name VARCHAR(12) NOT NULL,
+sex TINYINT(1),
+title VARCHAR(15) NOT NULL,
+manager CHAR(5),
+department CHAR(4),
+secretary CHAR(5),
+salary DOUBLE(8,2) NOT NULL
+) ENGINE=connect TABLE_TYPE=ini;
+INSERT INTO t1 SELECT * FROM employee;
+CALL test.tst_up();
+
+--echo #
+--echo # Testing XML table changes (must be in a separate test)
+--echo #
+#CREATE TABLE t1 ENGINE=connect TABLE_TYPE=xml option_list='rownode=dd' AS SELECT * FROM employee;
+#CALL test.tst_up();
+
+DROP PROCEDURE test.tst_up;
+DROP TABLE employee;
+
+--remove_file $MYSQLD_DATADIR/test/employee.dat
diff --git a/storage/connect/mysql-test/connect/t/updelx.test b/storage/connect/mysql-test/connect/t/updelx.test
index ab336d4b168..19d0d790a30 100644
--- a/storage/connect/mysql-test/connect/t/updelx.test
+++ b/storage/connect/mysql-test/connect/t/updelx.test
@@ -1,96 +1,96 @@
--- source include/not_embedded.inc
-let $MYSQLD_DATADIR= `select @@datadir`;
-
---echo #
---echo # Testing indexed UPDATE and DELETE for all table types
---echo #
-
---echo # CSV table
-CREATE TABLE t1 (
-id INT KEY NOT NULL,
-msg VARCHAR(32))
-ENGINE=CONNECT TABLE_TYPE=CSV AVG_ROW_LENGTH=6;
--- source updelx.inc
-ALTER TABLE t1 MAPPED=YES;
--- source updelx.inc
-ALTER TABLE t1 MAPPED=NO BLOCK_SIZE=6;
--- source updelx.inc
-ALTER TABLE t1 MAPPED=YES;
--- source updelx.inc
-DROP TABLE t1;
-
---echo # DOS table
-CREATE TABLE t1 (
-id INT(4) KEY NOT NULL,
-msg VARCHAR(16))
-ENGINE=CONNECT TABLE_TYPE=DOS;
--- source updelx.inc
-ALTER TABLE t1 MAPPED=YES;
--- source updelx.inc
-ALTER TABLE t1 MAPPED=NO BLOCK_SIZE=4;
--- source updelx.inc
-ALTER TABLE t1 MAPPED=YES;
--- source updelx.inc
-DROP TABLE t1;
-
---echo # FIX table
-CREATE TABLE t1 (
-id INT(4) KEY NOT NULL,
-msg VARCHAR(16) CHARSET BINARY DISTRIB=CLUSTERED)
-ENGINE=CONNECT TABLE_TYPE=FIX BLOCK_SIZE=4;
--- source updelx.inc
-ALTER TABLE t1 MAPPED=YES;
--- source updelx.inc
-ALTER TABLE t1 MAPPED=NO HUGE=YES;
--- source updelx.inc
-DROP TABLE t1;
-
---echo # BIN table
-CREATE TABLE t1 (
-id INT(4) KEY NOT NULL,
-msg VARCHAR(16) CHARSET BINARY DISTRIB=CLUSTERED)
-ENGINE=CONNECT TABLE_TYPE=BIN BLOCK_SIZE=8;
--- source updelx.inc
-ALTER TABLE t1 MAPPED=YES;
--- source updelx.inc
-ALTER TABLE t1 MAPPED=NO HUGE=YES;
--- source updelx.inc
-DROP TABLE t1;
-
---echo # DBF table
-CREATE TABLE t1 (
-id INT(4) KEY NOT NULL,
-msg VARCHAR(16))
-ENGINE=CONNECT TABLE_TYPE=DBF BLOCK_SIZE=12;
--- source updelx.inc
-ALTER TABLE t1 MAPPED=YES;
--- source updelx.inc
-#ALTER TABLE t1 MAPPED=NO HUGE=YES;
-#-- source updelx.inc
-DROP TABLE t1;
-
---echo # VEC table
-CREATE TABLE t1 (
-id INT(4) KEY NOT NULL,
-msg VARCHAR(16))
-ENGINE=CONNECT TABLE_TYPE=VEC BLOCK_SIZE=6 MAX_ROWS=16;
--- source updelx.inc
-ALTER TABLE t1 MAPPED=YES;
--- source updelx.inc
-ALTER TABLE t1 MAPPED=NO HUGE=YES;
--- source updelx.inc
-DROP TABLE t1;
-
---echo # Split VEC table (outward)
-CREATE TABLE t1 (
-id INT(4) KEY NOT NULL,
-msg VARCHAR(16))
-ENGINE=CONNECT TABLE_TYPE=VEC BLOCK_SIZE=6 FILE_NAME='tx.vec';
--- source updelx.inc
-ALTER TABLE t1 MAPPED=YES;
--- source updelx.inc
-DROP TABLE t1;
-
-# Cleanup
---remove_file $MYSQLD_DATADIR/test/tx1.vec
---remove_file $MYSQLD_DATADIR/test/tx2.vec
+-- source include/not_embedded.inc
+let $MYSQLD_DATADIR= `select @@datadir`;
+
+--echo #
+--echo # Testing indexed UPDATE and DELETE for all table types
+--echo #
+
+--echo # CSV table
+CREATE TABLE t1 (
+id INT KEY NOT NULL,
+msg VARCHAR(32))
+ENGINE=CONNECT TABLE_TYPE=CSV AVG_ROW_LENGTH=6;
+-- source updelx.inc
+ALTER TABLE t1 MAPPED=YES;
+-- source updelx.inc
+ALTER TABLE t1 MAPPED=NO BLOCK_SIZE=6;
+-- source updelx.inc
+ALTER TABLE t1 MAPPED=YES;
+-- source updelx.inc
+DROP TABLE t1;
+
+--echo # DOS table
+CREATE TABLE t1 (
+id INT(4) KEY NOT NULL,
+msg VARCHAR(16))
+ENGINE=CONNECT TABLE_TYPE=DOS;
+-- source updelx.inc
+ALTER TABLE t1 MAPPED=YES;
+-- source updelx.inc
+ALTER TABLE t1 MAPPED=NO BLOCK_SIZE=4;
+-- source updelx.inc
+ALTER TABLE t1 MAPPED=YES;
+-- source updelx.inc
+DROP TABLE t1;
+
+--echo # FIX table
+CREATE TABLE t1 (
+id INT(4) KEY NOT NULL,
+msg VARCHAR(16) CHARSET BINARY DISTRIB=CLUSTERED)
+ENGINE=CONNECT TABLE_TYPE=FIX BLOCK_SIZE=4;
+-- source updelx.inc
+ALTER TABLE t1 MAPPED=YES;
+-- source updelx.inc
+ALTER TABLE t1 MAPPED=NO HUGE=YES;
+-- source updelx.inc
+DROP TABLE t1;
+
+--echo # BIN table
+CREATE TABLE t1 (
+id INT(4) KEY NOT NULL,
+msg VARCHAR(16) CHARSET BINARY DISTRIB=CLUSTERED)
+ENGINE=CONNECT TABLE_TYPE=BIN BLOCK_SIZE=8;
+-- source updelx.inc
+ALTER TABLE t1 MAPPED=YES;
+-- source updelx.inc
+ALTER TABLE t1 MAPPED=NO HUGE=YES;
+-- source updelx.inc
+DROP TABLE t1;
+
+--echo # DBF table
+CREATE TABLE t1 (
+id INT(4) KEY NOT NULL,
+msg VARCHAR(16))
+ENGINE=CONNECT TABLE_TYPE=DBF BLOCK_SIZE=12;
+-- source updelx.inc
+ALTER TABLE t1 MAPPED=YES;
+-- source updelx.inc
+#ALTER TABLE t1 MAPPED=NO HUGE=YES;
+#-- source updelx.inc
+DROP TABLE t1;
+
+--echo # VEC table
+CREATE TABLE t1 (
+id INT(4) KEY NOT NULL,
+msg VARCHAR(16))
+ENGINE=CONNECT TABLE_TYPE=VEC BLOCK_SIZE=6 MAX_ROWS=16;
+-- source updelx.inc
+ALTER TABLE t1 MAPPED=YES;
+-- source updelx.inc
+ALTER TABLE t1 MAPPED=NO HUGE=YES;
+-- source updelx.inc
+DROP TABLE t1;
+
+--echo # Split VEC table (outward)
+CREATE TABLE t1 (
+id INT(4) KEY NOT NULL,
+msg VARCHAR(16))
+ENGINE=CONNECT TABLE_TYPE=VEC BLOCK_SIZE=6 FILE_NAME='tx.vec';
+-- source updelx.inc
+ALTER TABLE t1 MAPPED=YES;
+-- source updelx.inc
+DROP TABLE t1;
+
+# Cleanup
+--remove_file $MYSQLD_DATADIR/test/tx1.vec
+--remove_file $MYSQLD_DATADIR/test/tx2.vec
diff --git a/storage/connect/mysql-test/connect/t/updelx2.test b/storage/connect/mysql-test/connect/t/updelx2.test
index bf5434636ee..8b90851a127 100644
--- a/storage/connect/mysql-test/connect/t/updelx2.test
+++ b/storage/connect/mysql-test/connect/t/updelx2.test
@@ -1,22 +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;
+-- 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 8f0edc2b268..e0183f01db8 100644
--- a/storage/connect/mysql-test/connect/t/xcol.test
+++ b/storage/connect/mysql-test/connect/t/xcol.test
@@ -1,41 +1,41 @@
---echo #
---echo # Make the children list table
---echo #
-CREATE TABLE chlist (
-mother char(12) NOT NULL COMMENT 'The mother of the listed children',
-children varchar(30) DEFAULT NULL COMMENT 'The comma separated list of children'
-) ENGINE=CONNECT;
-INSERT INTO chlist VALUES('Sophia','Vivian, Antony');
-INSERT INTO chlist VALUES('Lisbeth','Lucy,Charles,Diana');
-INSERT INTO chlist VALUES('Corinne',NULL);
-INSERT INTO chlist VALUES('Claude','Marc');
-INSERT INTO chlist VALUES('Janet','Arthur,Sandra,Peter,John');
-SELECT * FROM chlist;
-
---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;
-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;
+--echo #
+--echo # Make the children list table
+--echo #
+CREATE TABLE chlist (
+mother char(12) NOT NULL COMMENT 'The mother of the listed children',
+children varchar(30) DEFAULT NULL COMMENT 'The comma separated list of children'
+) ENGINE=CONNECT;
+INSERT INTO chlist VALUES('Sophia','Vivian, Antony');
+INSERT INTO chlist VALUES('Lisbeth','Lucy,Charles,Diana');
+INSERT INTO chlist VALUES('Corinne',NULL);
+INSERT INTO chlist VALUES('Claude','Marc');
+INSERT INTO chlist VALUES('Janet','Arthur,Sandra,Peter,John');
+SELECT * FROM chlist;
+
+--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;
+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/mysql-test/connect/t/xml_html.test b/storage/connect/mysql-test/connect/t/xml_html.test
new file mode 100644
index 00000000000..1c84b46ec38
--- /dev/null
+++ b/storage/connect/mysql-test/connect/t/xml_html.test
@@ -0,0 +1,39 @@
+--source have_libxml2.inc
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+
+SET NAMES utf8;
+
+--copy_file $MTR_SUITE_DIR/std_data/beers.xml $MYSQLD_DATADIR/test/beers.xml
+--copy_file $MTR_SUITE_DIR/std_data/coffee.htm $MYSQLD_DATADIR/test/coffee.htm
+
+--echo #
+--echo # Testing HTML like XML file
+--echo #
+CREATE TABLE beers (
+`Name` CHAR(16) FIELD_FORMAT='brandName',
+`Origin` CHAR(16) FIELD_FORMAT='origin',
+`Description` CHAR(32) FIELD_FORMAT='details')
+ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='beers.xml'
+TABNAME='table' OPTION_LIST='xmlsup=libxml2,rownode=tr,colnode=td';
+SELECT * FROM beers;
+DROP TABLE beers;
+
+--echo #
+--echo # Testing HTML file
+--echo #
+CREATE TABLE coffee (
+`Name` CHAR(16),
+`Cups` INT(8),
+`Type` CHAR(16),
+`Sugar` CHAR(4))
+ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='coffee.htm'
+TABNAME='TABLE' HEADER=1 OPTION_LIST='xmlsup=libxml2,Coltype=HTML';
+SELECT * FROM coffee;
+DROP TABLE coffee;
+
+#
+# Clean up
+#
+--remove_file $MYSQLD_DATADIR/test/beers.xml
+--remove_file $MYSQLD_DATADIR/test/coffee.htm
diff --git a/storage/connect/mysql-test/connect/t/xml_mdev5261.test b/storage/connect/mysql-test/connect/t/xml_mdev5261.test
index 214900a68d6..b554f251e09 100644
--- a/storage/connect/mysql-test/connect/t/xml_mdev5261.test
+++ b/storage/connect/mysql-test/connect/t/xml_mdev5261.test
@@ -1,27 +1,27 @@
---source have_libxml2.inc
-
-let $MYSQLD_DATADIR= `select @@datadir`;
-
-SET NAMES utf8;
-
-#
-#--echo Testing indexing on not indexable table type
-#
---error ER_UNKNOWN_ERROR
-CREATE TABLE t1 (i INT UNIQUE NOT NULL) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xt1.xml' OPTION_LIST='Rownode=N';
-CREATE TABLE t1 (i INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xt1.xml' OPTION_LIST='Rownode=N';
-DESCRIBE t1;
-# one could *add* an index to an existing table
---error ER_UNKNOWN_ERROR
-ALTER TABLE t1 ADD UNIQUE(i);
---error ER_UNKNOWN_ERROR
-CREATE UNIQUE INDEX i ON t1(i);
-DESCRIBE t1;
-INSERT INTO t1 VALUES(2),(5),(7);
-SELECT * FROM t1 WHERE i = 5;
---error ER_CANT_DROP_FIELD_OR_KEY
-ALTER TABLE t1 DROP INDEX i;
---error ER_CANT_DROP_FIELD_OR_KEY
-DROP INDEX i ON t1;
-DROP TABLE t1;
---remove_file $MYSQLD_DATADIR/test/xt1.xml
+--source have_libxml2.inc
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+
+SET NAMES utf8;
+
+#
+#--echo Testing indexing on not indexable table type
+#
+--error ER_UNKNOWN_ERROR
+CREATE TABLE t1 (i INT UNIQUE NOT NULL) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xt1.xml' OPTION_LIST='Rownode=N';
+CREATE TABLE t1 (i INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xt1.xml' OPTION_LIST='Rownode=N';
+DESCRIBE t1;
+# one could *add* an index to an existing table
+--error ER_UNKNOWN_ERROR
+ALTER TABLE t1 ADD UNIQUE(i);
+--error ER_UNKNOWN_ERROR
+CREATE UNIQUE INDEX i ON t1(i);
+DESCRIBE t1;
+INSERT INTO t1 VALUES(2),(5),(7);
+SELECT * FROM t1 WHERE i = 5;
+--error ER_CANT_DROP_FIELD_OR_KEY
+ALTER TABLE t1 DROP INDEX i;
+--error ER_CANT_DROP_FIELD_OR_KEY
+DROP INDEX i ON t1;
+DROP TABLE t1;
+--remove_file $MYSQLD_DATADIR/test/xt1.xml
diff --git a/storage/connect/myutil.cpp b/storage/connect/myutil.cpp
index 0d9a1e2fe16..d4416e188c8 100644
--- a/storage/connect/myutil.cpp
+++ b/storage/connect/myutil.cpp
@@ -13,11 +13,11 @@
/************************************************************************/
#include "my_global.h"
#include <mysql.h>
-#if defined(WIN32)
+#if defined(__WIN__)
//#include <windows.h>
-#else // !WIN32
+#else // !__WIN__
#include "osutil.h"
-#endif // !WIN32
+#endif // !__WIN__
#include "global.h"
#include "plgdbsem.h"
@@ -26,14 +26,16 @@
#include "myutil.h"
#define DLL_EXPORT // Items are exported from this DLL
-extern "C" int xconv;
+//extern "C" int xconv;
+TYPCONV GetTypeConv(void);
/************************************************************************/
/* Convert from MySQL type name to PlugDB type number */
/************************************************************************/
int MYSQLtoPLG(char *typname, char *var)
{
- int type;
+ int type;
+ TYPCONV xconv = GetTypeConv();
if (!stricmp(typname, "int") || !stricmp(typname, "mediumint") ||
!stricmp(typname, "integer"))
@@ -57,13 +59,13 @@ int MYSQLtoPLG(char *typname, char *var)
type = TYPE_TINY;
else if (!stricmp(typname, "text") && var) {
switch (xconv) {
- case 1:
+ case TPC_YES:
type = TYPE_STRING;
*var = 'X';
break;
- case 2:
+ case TPC_SKIP:
*var = 'K';
- default:
+ default: // TPC_NO
type = TYPE_ERROR;
} // endswitch xconv
@@ -88,7 +90,7 @@ int MYSQLtoPLG(char *typname, char *var)
} else if (type == TYPE_STRING && !stricmp(typname, "varchar"))
// This is to make the difference between CHAR and VARCHAR
*var = 'V';
- else if (type == TYPE_ERROR && xconv == 2)
+ else if (type == TYPE_ERROR && xconv == TPC_SKIP)
*var = 'K';
else
*var = 0;
@@ -174,7 +176,7 @@ const char *PLGtoMYSQLtype(int type, bool dbf, char v)
/************************************************************************/
int MYSQLtoPLG(int mytype, char *var)
{
- int type;
+ int type, xconv = GetTypeConv();
switch (mytype) {
case MYSQL_TYPE_SHORT:
@@ -221,7 +223,7 @@ int MYSQLtoPLG(int mytype, char *var)
case MYSQL_TYPE_LONG_BLOB:
if (var) {
switch (xconv) {
- case 1:
+ case TPC_YES:
if (*var != 'B') {
// This is a TEXT column
type = TYPE_STRING;
@@ -230,9 +232,9 @@ int MYSQLtoPLG(int mytype, char *var)
type = TYPE_ERROR;
break;
- case 2:
+ case TPC_SKIP:
*var = 'K'; // Skip
- default:
+ default: // TPC_NO
type = TYPE_ERROR;
} // endswitch xconv
diff --git a/storage/connect/odbccat.h b/storage/connect/odbccat.h
index 8642d915211..1b5febadd3a 100644
--- a/storage/connect/odbccat.h
+++ b/storage/connect/odbccat.h
@@ -2,6 +2,14 @@
#define DEFAULT_LOGIN_TIMEOUT -1 // means do not set
#define DEFAULT_QUERY_TIMEOUT -1 // means do not set
+typedef struct odbc_parms {
+ char *User; // User connect info
+ char *Pwd; // Password connect info
+ int Cto; // Connect timeout
+ int Qto; // Query timeout
+ bool UseCnc; // Use SQLConnect (!SQLDriverConnect)
+ } ODBCPARM, *POPARM;
+
/***********************************************************************/
/* ODBC catalog function prototypes. */
/***********************************************************************/
@@ -10,8 +18,8 @@ char *ODBCCheckConnection(PGLOBAL g, char *dsn, int cop);
#endif // PROMPT_OK
PQRYRES ODBCDataSources(PGLOBAL g, int maxres, bool info);
PQRYRES ODBCColumns(PGLOBAL g, char *dsn, char *db, char *table,
- char *colpat, int maxres, int cto, int qto, bool info);
-PQRYRES ODBCSrcCols(PGLOBAL g, char *dsn, char *src, int cto, int qto);
+ char *colpat, int maxres, bool info, POPARM sop);
+PQRYRES ODBCSrcCols(PGLOBAL g, char *dsn, char *src, POPARM sop);
PQRYRES ODBCTables(PGLOBAL g, char *dsn, char *db, char *tabpat,
- int maxres, int cto, int qto, bool info);
+ int maxres, bool info, POPARM sop);
PQRYRES ODBCDrivers(PGLOBAL g, int maxres, bool info);
diff --git a/storage/connect/odbconn.cpp b/storage/connect/odbconn.cpp
index 3e616ec8f04..6aaa048de81 100644
--- a/storage/connect/odbconn.cpp
+++ b/storage/connect/odbconn.cpp
@@ -1,5 +1,5 @@
/************ Odbconn C++ Functions Source Code File (.CPP) ************/
-/* Name: ODBCONN.CPP Version 2.1 */
+/* Name: ODBCONN.CPP Version 2.2 */
/* */
/* (C) Copyright to the author Olivier BERTRAND 1998-2015 */
/* */
@@ -11,7 +11,7 @@
/***********************************************************************/
#include <my_global.h>
#include <m_string.h>
-#if defined(WIN32)
+#if defined(__WIN__)
//nclude <io.h>
//nclude <fcntl.h>
#include <direct.h> // for getcwd
@@ -37,21 +37,23 @@
#include "xobject.h"
//#include "kindex.h"
#include "xtable.h"
-#include "tabodbc.h"
#include "odbccat.h"
+#include "tabodbc.h"
#include "plgcnx.h" // For DB types
#include "resource.h"
#include "valblk.h"
#include "osutil.h"
-#if defined(WIN32)
+#if defined(__WIN__)
/***********************************************************************/
/* For dynamic load of ODBC32.DLL */
/***********************************************************************/
#pragma comment(lib, "odbc32.lib")
extern "C" HINSTANCE s_hModule; // Saved module handle
-#endif // WIN32
+#endif // __WIN__
+
+int GetConvSize();
/***********************************************************************/
/* Some macro's (should be defined elsewhere to be more accessible) */
@@ -100,7 +102,12 @@ static int GetSQLCType(int type)
case TYPE_BIGINT: tp = SQL_C_SBIGINT; break;
case TYPE_DOUBLE: tp = SQL_C_DOUBLE; break;
case TYPE_TINY : tp = SQL_C_TINYINT; break;
+//#if (ODBCVER >= 0x0300)
+// case TYPE_DECIM: tp = SQL_C_NUMERIC; break; (CRASH!!!)
+//#else
case TYPE_DECIM: tp = SQL_C_CHAR; break;
+//#endif
+
} // endswitch type
return tp;
@@ -109,20 +116,28 @@ static int GetSQLCType(int type)
/***********************************************************************/
/* TranslateSQLType: translate a SQL Type to a PLG type. */
/***********************************************************************/
-int TranslateSQLType(int stp, int prec, int& len, char& v)
+int TranslateSQLType(int stp, int prec, int& len, char& v, bool& w)
{
int type;
switch (stp) {
+ case SQL_WVARCHAR: // (-9)
+ w = true;
case SQL_VARCHAR: // 12
v = 'V';
+ type = TYPE_STRING;
+ break;
+ case SQL_WCHAR: // (-8)
+ w = true;
case SQL_CHAR: // 1
type = TYPE_STRING;
break;
+ case SQL_WLONGVARCHAR: // (-10)
+ w = true;
case SQL_LONGVARCHAR: // (-1)
v = 'V';
type = TYPE_STRING;
- len = MY_MIN(abs(len), 256);
+ len = MY_MIN(abs(len), GetConvSize());
break;
case SQL_NUMERIC: // 2
case SQL_DECIMAL: // 3
@@ -173,7 +188,6 @@ int TranslateSQLType(int stp, int prec, int& len, char& v)
case SQL_BINARY: // (-2)
case SQL_VARBINARY: // (-3)
case SQL_LONGVARBINARY: // (-4)
-// case SQL_BIT: // (-7)
case SQL_GUID: // (-11)
default:
type = TYPE_ERROR;
@@ -291,7 +305,7 @@ static void ResetNullValues(CATPARM *cap)
/* of an ODBC table that will be retrieved by GetData commands. */
/***********************************************************************/
PQRYRES ODBCColumns(PGLOBAL g, char *dsn, char *db, char *table,
- char *colpat, int maxres, int cto, int qto, bool info)
+ char *colpat, int maxres, bool info, POPARM sop)
{
int buftyp[] = {TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_STRING,
TYPE_SHORT, TYPE_STRING, TYPE_INT, TYPE_INT,
@@ -310,10 +324,8 @@ PQRYRES ODBCColumns(PGLOBAL g, char *dsn, char *db, char *table,
/************************************************************************/
if (!info) {
ocp = new(g) ODBConn(g, NULL);
- ocp->SetLoginTimeout((DWORD)cto);
- ocp->SetQueryTimeout((DWORD)qto);
- if (ocp->Open(dsn, 10) < 1) // openReadOnly + noODBCdialog
+ if (ocp->Open(dsn, sop, 10) < 1) // openReadOnly + noODBCdialog
return NULL;
if (table && !strchr(table, '%')) {
@@ -342,7 +354,7 @@ PQRYRES ODBCColumns(PGLOBAL g, char *dsn, char *db, char *table,
} // endif ocp
if (trace)
- htrc("ODBCColumns: max=%d len=%d,%d,%d\n",
+ htrc("ODBCColumns: max=%d len=%d,%d,%d,%d\n",
maxres, length[0], length[1], length[2], length[3]);
/************************************************************************/
@@ -388,12 +400,13 @@ PQRYRES ODBCColumns(PGLOBAL g, char *dsn, char *db, char *table,
/* ODBCSrcCols: constructs the result blocks containing the */
/* description of all the columns of a Srcdef option. */
/**************************************************************************/
-PQRYRES ODBCSrcCols(PGLOBAL g, char *dsn, char *src, int cto, int qto)
+PQRYRES ODBCSrcCols(PGLOBAL g, char *dsn, char *src, POPARM sop)
{
ODBConn *ocp = new(g) ODBConn(g, NULL);
- ocp->SetLoginTimeout((DWORD)cto);
- ocp->SetQueryTimeout((DWORD)qto);
+ if (ocp->Open(dsn, sop, 10) < 1) // openReadOnly + noOdbcDialog
+ return NULL;
+
return ocp->GetMetaData(g, dsn, src);
} // end of ODBCSrcCols
@@ -404,6 +417,7 @@ PQRYRES ODBCSrcCols(PGLOBAL g, char *dsn, char *src, int cto, int qto)
PQRYRES MyODBCCols(PGLOBAL g, char *dsn, char *tab, bool info)
{
// int i, type, len, prec;
+ bool w = false;
// PCOLRES crp, crpt, crpl, crpp;
PQRYRES qrp;
ODBConn *ocp;
@@ -449,7 +463,7 @@ PQRYRES MyODBCCols(PGLOBAL g, char *dsn, char *tab, bool info)
type = crpt->Kdata->GetIntValue(i);
len = crpl->Kdata->GetIntValue(i);
prec = crpp->Kdata->GetIntValue(i);
- type = TranslateSQLType(type, prec, len);
+ type = TranslateSQLType(type, prec, len, w);
crpt->Kdata->SetValue(type, i);
// Some data sources do not count prec in length
@@ -574,7 +588,7 @@ PQRYRES ODBCDataSources(PGLOBAL g, int maxres, bool info)
/* an ODBC database that will be retrieved by GetData commands. */
/**************************************************************************/
PQRYRES ODBCTables(PGLOBAL g, char *dsn, char *db, char *tabpat,
- int maxres, int cto, int qto, bool info)
+ int maxres, bool info, POPARM sop)
{
int buftyp[] = {TYPE_STRING, TYPE_STRING, TYPE_STRING,
TYPE_STRING, TYPE_STRING};
@@ -594,10 +608,8 @@ PQRYRES ODBCTables(PGLOBAL g, char *dsn, char *db, char *tabpat,
/* Open the connection with the ODBC data source. */
/**********************************************************************/
ocp = new(g) ODBConn(g, NULL);
- ocp->SetLoginTimeout((DWORD)cto);
- ocp->SetQueryTimeout((DWORD)qto);
- if (ocp->Open(dsn, 2) < 1) // 2 is openReadOnly
+ if (ocp->Open(dsn, sop, 2) < 1) // 2 is openReadOnly
return NULL;
if (!maxres)
@@ -863,8 +875,7 @@ bool DBX::BuildErrorMessage(ODBConn* pdb, HSTMT hstmt)
for (int i = 0; i < MAX_NUM_OF_MSG
&& (rc == SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO)
&& strcmp((char*)state, "00000"); i++) {
- m_ErrMsg[i] = (PSZ)PlugSubAlloc(g, NULL, strlen((char*)msg) + 1);
- strcpy(m_ErrMsg[i], (char*)msg);
+ m_ErrMsg[i] = (PSZ)PlugDup(g, (char*)msg);
if (trace)
htrc("%s: %s, Native=%d\n", state, msg, native);
@@ -878,8 +889,7 @@ bool DBX::BuildErrorMessage(ODBConn* pdb, HSTMT hstmt)
} else {
snprintf((char*)msg, SQL_MAX_MESSAGE_LENGTH + 1, "%s: %s", m_Msg,
MSG(BAD_HANDLE_VAL));
- m_ErrMsg[0] = (PSZ)PlugSubAlloc(g, NULL, strlen((char*)msg) + 1);
- strcpy(m_ErrMsg[0], (char*)msg);
+ m_ErrMsg[0] = (PSZ)PlugDup(g, (char*)msg);
if (trace)
htrc("%s: rc=%hd\n", SVP(m_ErrMsg[0]), m_RC);
@@ -924,12 +934,15 @@ ODBConn::ODBConn(PGLOBAL g, TDBODBC *tdbp)
m_RowsetSize = (DWORD)((tdbp) ? tdbp->Rows : 10);
m_Catver = (tdbp) ? tdbp->Catver : 0;
m_Rows = 0;
+ m_Fetch = 0;
m_Connect = NULL;
+ m_User = NULL;
+ m_Pwd = NULL;
m_Updatable = true;
m_Transact = false;
m_Scrollable = (tdbp) ? tdbp->Scrollable : false;
- m_First = true;
m_Full = false;
+ m_UseCnc = false;
m_IDQuoteChar[0] = '"';
m_IDQuoteChar[1] = 0;
//*m_ErrMsg = '\0';
@@ -982,7 +995,7 @@ void ODBConn::ThrowDBX(RETCODE rc, PSZ msg, HSTMT hstmt)
void ODBConn::ThrowDBX(PSZ msg)
{
- DBX* xp = new(m_G) DBX(0, msg);
+ DBX* xp = new(m_G) DBX(0, "Error");
xp->m_ErrMsg[0] = msg;
throw xp;
@@ -1005,8 +1018,7 @@ PSZ ODBConn::GetStringInfo(ushort infotype)
// *buffer = '\0';
} // endif rc
- p = (char *)PlugSubAlloc(m_G, NULL, strlen(buffer) + 1);
- strcpy(p, buffer);
+ p = PlugDup(m_G, buffer);
return p;
} // end of GetStringInfo
@@ -1061,7 +1073,7 @@ void ODBConn::OnSetOptions(HSTMT hstmt)
/***********************************************************************/
/* Open: connect to a data source. */
/***********************************************************************/
-int ODBConn::Open(PSZ ConnectString, DWORD options)
+int ODBConn::Open(PSZ ConnectString, POPARM sop, DWORD options)
{
PGLOBAL& g = m_G;
//ASSERT_VALID(this);
@@ -1070,6 +1082,11 @@ int ODBConn::Open(PSZ ConnectString, DWORD options)
m_Updatable = !(options & openReadOnly);
m_Connect = ConnectString;
+ m_User = sop->User;
+ m_Pwd = sop->Pwd;
+ m_LoginTimeout = sop->Cto;
+ m_QueryTimeout = sop->Qto;
+ m_UseCnc = sop->UseCnc;
// Allocate the HDBC and make connection
try {
@@ -1078,18 +1095,21 @@ int ODBConn::Open(PSZ ConnectString, DWORD options)
AllocConnect(options);
/*ver = GetStringInfo(SQL_ODBC_VER);*/
- if (Connect(options)) {
- strcpy(g->Message, MSG(CONNECT_CANCEL));
- return 0;
- } // endif
+ if (!m_UseCnc) {
+ if (DriverConnect(options)) {
+ strcpy(g->Message, MSG(CONNECT_CANCEL));
+ return 0;
+ } // endif
+
+ } else // Connect using SQLConnect
+ Connect();
/*ver = GetStringInfo(SQL_DRIVER_ODBC_VER);*/
// Verify support for required functionality and cache info
// VerifyConnect(); Deprecated
GetConnectInfo();
} catch(DBX *xp) {
-// strcpy(g->Message, xp->m_ErrMsg[0]);
- strcpy(g->Message, xp->GetErrorMessage(0));
+ sprintf(g->Message, "%s: %s", xp->m_Msg, xp->GetErrorMessage(0));
Close();
// Free();
return -1;
@@ -1164,23 +1184,40 @@ void ODBConn::AllocConnect(DWORD Options)
} // end of AllocConnect
/***********************************************************************/
+/* Connect to data source using SQLConnect. */
+/***********************************************************************/
+void ODBConn::Connect(void)
+ {
+ SQLRETURN rc;
+ SQLSMALLINT ul = (m_User ? SQL_NTS : 0);
+ SQLSMALLINT pl = (m_Pwd ? SQL_NTS : 0);
+
+ rc = SQLConnect(m_hdbc, (SQLCHAR*)m_Connect, SQL_NTS,
+ (SQLCHAR*)m_User, ul, (SQLCHAR*)m_Pwd, pl);
+
+ if (!Check(rc))
+ ThrowDBX(rc, "SQLConnect");
+
+ } // end of Connect
+
+/***********************************************************************/
/* Connect to data source using SQLDriverConnect. */
/***********************************************************************/
-bool ODBConn::Connect(DWORD Options)
+bool ODBConn::DriverConnect(DWORD Options)
{
RETCODE rc;
SWORD nResult;
PUCHAR ConnOut = (PUCHAR)PlugSubAlloc(m_G, NULL, MAX_CONNECT_LEN);
UWORD wConnectOption = SQL_DRIVER_COMPLETE;
-#if defined(WIN32)
+#if defined(__WIN__)
HWND hWndTop = GetForegroundWindow();
HWND hWnd = GetParent(hWndTop);
if (hWnd == NULL)
hWnd = GetDesktopWindow();
-#else // !WIN32
+#else // !__WIN__
HWND hWnd = (HWND)1;
-#endif // !WIN32
+#endif // !__WIN__
PGLOBAL& g = m_G;
PDBUSER dup = PlgGetUser(g);
@@ -1193,10 +1230,10 @@ bool ODBConn::Connect(DWORD Options)
SQL_NTS, ConnOut, MAX_CONNECT_LEN,
&nResult, wConnectOption);
-#if defined(WIN32)
+#if defined(__WIN__)
if (hWndTop)
EnableWindow(hWndTop, true);
-#endif // WIN32
+#endif // __WIN__
// If user hit 'Cancel'
if (rc == SQL_NO_DATA_FOUND) {
@@ -1213,7 +1250,7 @@ bool ODBConn::Connect(DWORD Options)
// All done
return false;
- } // end of Connect
+ } // end of DriverConnect
void ODBConn::VerifyConnect()
{
@@ -1328,7 +1365,7 @@ int ODBConn::ExecDirectSQL(char *sql, ODBCCOL *tocols)
rc = SQLFreeStmt(m_hstmt, SQL_CLOSE);
if (!Check(rc))
- ThrowDBX(rc, "SQLFreeStmt");
+ ThrowDBX(rc, "SQLFreeStmt", m_hstmt);
m_hstmt = NULL;
} // endif m_hstmt
@@ -1343,7 +1380,7 @@ int ODBConn::ExecDirectSQL(char *sql, ODBCCOL *tocols)
(void*)SQL_SCROLLABLE, 0);
if (!Check(rc))
- ThrowDBX(rc, "SQLSetStmtAttr");
+ ThrowDBX(rc, "Scrollable", hstmt);
} // endif m_Scrollable
@@ -1394,7 +1431,7 @@ int ODBConn::ExecDirectSQL(char *sql, ODBCCOL *tocols)
for (n = 0, colp = tocols; colp; colp = (PODBCCOL)colp->GetNext())
if (!colp->IsSpecial())
- n++;
+ n++;
// n can be 0 for query such as Select count(*) from table
if (n && n != (UWORD)ncol)
@@ -1430,7 +1467,7 @@ int ODBConn::ExecDirectSQL(char *sql, ODBCCOL *tocols)
for (int i = 0; i < MAX_NUM_OF_MSG && x->m_ErrMsg[i]; i++)
htrc(x->m_ErrMsg[i]);
- strcpy(m_G->Message, x->GetErrorMessage(0));
+ sprintf(m_G->Message, "%s: %s", x->m_Msg, x->GetErrorMessage(0));
if (b)
SQLCancel(hstmt);
@@ -1493,7 +1530,7 @@ int ODBConn::GetResultSize(char *sql, ODBCCOL *colp)
/***********************************************************************/
/* Fetch next row. */
/***********************************************************************/
-int ODBConn::Fetch()
+int ODBConn::Fetch(int pos)
{
ASSERT(m_hstmt);
int irc;
@@ -1503,7 +1540,9 @@ int ODBConn::Fetch()
try {
// do {
- if (m_RowsetSize) {
+ if (pos) {
+ rc = SQLExtendedFetch(m_hstmt, SQL_FETCH_ABSOLUTE, pos, &crow, NULL);
+ } else if (m_RowsetSize) {
rc = SQLExtendedFetch(m_hstmt, SQL_FETCH_NEXT, 1, &crow, NULL);
} else {
rc = SQLFetch(m_hstmt);
@@ -1516,29 +1555,22 @@ int ODBConn::Fetch()
m_hstmt, m_RowsetSize, rc);
if (!Check(rc))
- ThrowDBX(rc, "Fetch", m_hstmt);
-
- irc = (rc == SQL_NO_DATA_FOUND) ? 0 : (int)crow;
-
- if (m_First) {
- // First fetch. Check whether the full table was read
- if ((m_Full = irc < (signed)m_RowsetSize)) {
- m_Tdb->Memory = 0; // Not needed anymore
- m_Rows = irc; // Table size
- } // endif m_Full
-
- m_First = false;
- } // endif m_First
+ ThrowDBX(rc, "Fetching", m_hstmt);
- if (m_Tdb->Memory == 1)
- m_Rows += irc;
+ if (rc == SQL_NO_DATA_FOUND) {
+ m_Full = (m_Fetch == 1);
+ irc = 0;
+ } else
+ irc = (int)crow;
+ m_Fetch++;
+ m_Rows += irc;
} catch(DBX *x) {
if (trace)
for (int i = 0; i < MAX_NUM_OF_MSG && x->m_ErrMsg[i]; i++)
htrc(x->m_ErrMsg[i]);
- strcpy(g->Message, x->GetErrorMessage(0));
+ sprintf(g->Message, "%s: %s", x->m_Msg, x->GetErrorMessage(0));
irc = -1;
} // end try/catch
@@ -1574,7 +1606,7 @@ int ODBConn::PrepareSQL(char *sql)
for (int i = 0; i < MAX_NUM_OF_MSG && x->m_ErrMsg[i]; i++)
htrc(x->m_ErrMsg[i]);
- strcpy(g->Message, x->GetErrorMessage(0));
+ sprintf(g->Message, "%s: %s", x->m_Msg, x->GetErrorMessage(0));
} // end try/catch
} // endif Mode
@@ -1620,7 +1652,7 @@ int ODBConn::PrepareSQL(char *sql)
for (int i = 0; i < MAX_NUM_OF_MSG && x->m_ErrMsg[i]; i++)
htrc(x->m_ErrMsg[i]);
- strcpy(g->Message, x->GetErrorMessage(0));
+ sprintf(g->Message, "%s: %s", x->m_Msg, x->GetErrorMessage(0));
if (b)
SQLCancel(hstmt);
@@ -1672,7 +1704,7 @@ int ODBConn::ExecuteSQL(void)
} // endif ncol
} catch(DBX *x) {
- strcpy(m_G->Message, x->GetErrorMessage(0));
+ sprintf(m_G->Message, "%s: %s", x->m_Msg, x->GetErrorMessage(0));
SQLCancel(m_hstmt);
rc = SQLFreeStmt(m_hstmt, SQL_DROP);
m_hstmt = NULL;
@@ -1709,9 +1741,11 @@ bool ODBConn::BindParam(ODBCCOL *colp)
ThrowDBX(rc, "SQLDescribeParam", m_hstmt);
} catch(DBX *x) {
- strcpy(m_G->Message, x->GetErrorMessage(0));
+ sprintf(m_G->Message, "%s: %s", x->m_Msg, x->GetErrorMessage(0));
colsize = colp->GetPrecision();
sqlt = GetSQLType(buftype);
+ dec = IsTypeChar(buftype) ? 0 : colp->GetScale();
+ nul = SQL_NULLABLE_UNKNOWN;
} // end try/catch
buf = colp->GetBuffer(0);
@@ -1815,7 +1849,7 @@ bool ODBConn::ExecSQLcommand(char *sql)
for (int i = 0; i < MAX_NUM_OF_MSG && x->m_ErrMsg[i]; i++)
htrc(x->m_ErrMsg[i]);
- sprintf(g->Message, "Remote: %s", x->GetErrorMessage(0));
+ sprintf(g->Message, "Remote %s: %s", x->m_Msg, x->GetErrorMessage(0));
if (b)
SQLCancel(hstmt);
@@ -1865,9 +1899,6 @@ PQRYRES ODBConn::GetMetaData(PGLOBAL g, char *dsn, char *src)
RETCODE rc;
HSTMT hstmt;
- if (Open(dsn, 10) < 1) // openReadOnly + noOdbcDialog
- return NULL;
-
try {
rc = SQLAllocStmt(m_hdbc, &hstmt);
@@ -1903,7 +1934,7 @@ PQRYRES ODBConn::GetMetaData(PGLOBAL g, char *dsn, char *src)
} // endfor i
} catch(DBX *x) {
- strcpy(g->Message, x->GetErrorMessage(0));
+ sprintf(g->Message, "%s: %s", x->m_Msg, x->GetErrorMessage(0));
goto err;
} // end try/catch
@@ -1954,7 +1985,7 @@ PQRYRES ODBConn::GetMetaData(PGLOBAL g, char *dsn, char *src)
} // endfor i
} catch(DBX *x) {
- strcpy(g->Message, x->GetErrorMessage(0));
+ sprintf(g->Message, "%s: %s", x->m_Msg, x->GetErrorMessage(0));
qrp = NULL;
} // end try/catch
@@ -2006,7 +2037,7 @@ bool ODBConn::GetDataSources(PQRYRES qrp)
} // endfor i
} catch(DBX *x) {
- strcpy(m_G->Message, x->GetErrorMessage(0));
+ sprintf(m_G->Message, "%s: %s", x->m_Msg, x->GetErrorMessage(0));
rv = true;
} // end try/catch
@@ -2057,7 +2088,7 @@ bool ODBConn::GetDrivers(PQRYRES qrp)
} // endfor n
} catch(DBX *x) {
- strcpy(m_G->Message, x->GetErrorMessage(0));
+ sprintf(m_G->Message, "%s: %s", x->m_Msg, x->GetErrorMessage(0));
rv = true;
} // end try/catch
@@ -2375,7 +2406,7 @@ int ODBConn::GetCatInfo(CATPARM *cap)
for (int i = 0; i < MAX_NUM_OF_MSG && x->m_ErrMsg[i]; i++)
htrc(x->m_ErrMsg[i]);
- strcpy(g->Message, x->GetErrorMessage(0));
+ sprintf(g->Message, "%s: %s", x->m_Msg, x->GetErrorMessage(0));
irc = -1;
} // end try/catch
@@ -2479,7 +2510,7 @@ int ODBConn::Rewind(char *sql, ODBCCOL *tocols)
rbuf = (int)crow;
} catch(DBX *x) {
- strcpy(m_G->Message, x->GetErrorMessage(0));
+ sprintf(m_G->Message, "%s: %s", x->m_Msg, x->GetErrorMessage(0));
rbuf = -1;
} // end try/catch
diff --git a/storage/connect/odbconn.h b/storage/connect/odbconn.h
index dfdb9fe7f56..6a24334f08c 100644
--- a/storage/connect/odbconn.h
+++ b/storage/connect/odbconn.h
@@ -29,9 +29,9 @@
//efine MAX_CURSOR_NAME 18 // Max size of a cursor name
#define DEFAULT_FIELD_TYPE SQL_TYPE_NULL // pick "C" data type to match SQL data type
-#if !defined(WIN32)
+#if !defined(__WIN__)
typedef unsigned char *PUCHAR;
-#endif // !WIN32
+#endif // !__WIN__
// Field Flags, used to indicate status of fields
//efine SQL_FIELD_FLAG_DIRTY 0x1
@@ -119,7 +119,7 @@ class ODBConn : public BLOCK {
noOdbcDialog = 0x0008, // Don't display ODBC Connect dialog
forceOdbcDialog = 0x0010}; // Always display ODBC connect dialog
- int Open(PSZ ConnectString, DWORD Options = 0);
+ int Open(PSZ ConnectString, POPARM sop, DWORD Options = 0);
int Rewind(char *sql, ODBCCOL *tocols);
void Close(void);
PQRYRES AllocateResult(PGLOBAL g);
@@ -135,11 +135,13 @@ class ODBConn : public BLOCK {
public:
// Operations
- void SetLoginTimeout(DWORD sec) {m_LoginTimeout = sec;}
- void SetQueryTimeout(DWORD sec) {m_QueryTimeout = sec;}
+//void SetLoginTimeout(DWORD sec) {m_LoginTimeout = sec;}
+//void SetQueryTimeout(DWORD sec) {m_QueryTimeout = sec;}
+//void SetUserName(PSZ user) {m_User = user;}
+//void SetUserPwd(PSZ pwd) {m_Pwd = pwd;}
int GetResultSize(char *sql, ODBCCOL *colp);
int ExecDirectSQL(char *sql, ODBCCOL *tocols);
- int Fetch(void);
+ int Fetch(int pos = 0);
int PrepareSQL(char *sql);
int ExecuteSQL(void);
bool BindParam(ODBCCOL *colp);
@@ -155,7 +157,7 @@ class ODBConn : public BLOCK {
// Implementation
public:
-// virtual ~ODBConn();
+//virtual ~ODBConn();
// ODBC operations
protected:
@@ -163,7 +165,8 @@ class ODBConn : public BLOCK {
void ThrowDBX(RETCODE rc, PSZ msg, HSTMT hstmt = SQL_NULL_HSTMT);
void ThrowDBX(PSZ msg);
void AllocConnect(DWORD dwOptions);
- bool Connect(DWORD Options);
+ void Connect(void);
+ bool DriverConnect(DWORD Options);
void VerifyConnect(void);
void GetConnectInfo(void);
void Free(void);
@@ -185,11 +188,14 @@ class ODBConn : public BLOCK {
DWORD m_RowsetSize;
char m_IDQuoteChar[2];
PSZ m_Connect;
+ PSZ m_User;
+ PSZ m_Pwd;
int m_Catver;
int m_Rows;
+ int m_Fetch;
bool m_Updatable;
bool m_Transact;
bool m_Scrollable;
- bool m_First;
+ bool m_UseCnc;
bool m_Full;
}; // end of ODBConn class definition
diff --git a/storage/connect/os.h b/storage/connect/os.h
index 8f77a0ad39f..2dc603fdcda 100644
--- a/storage/connect/os.h
+++ b/storage/connect/os.h
@@ -15,16 +15,16 @@ typedef off_t off64_t;
#endif
#endif
-#if defined(WIN32)
+#if defined(__WIN__)
typedef __int64 BIGINT;
-#else // !WIN32
+#else // !__WIN__
typedef longlong BIGINT;
#define FILE_BEGIN SEEK_SET
#define FILE_CURRENT SEEK_CUR
#define FILE_END SEEK_END
-#endif // !WIN32
+#endif // !__WIN__
-#if !defined(WIN32)
+#if !defined(__WIN__)
typedef const void *LPCVOID;
typedef const char *LPCTSTR;
typedef const char *LPCSTR;
@@ -61,6 +61,6 @@ typedef int HANDLE;
#define _MAX_EXT FN_EXTLEN
#define INVALID_HANDLE_VALUE (-1)
#define __stdcall
-#endif /* !WIN32 */
+#endif /* !__WIN__ */
#endif /* _OS_H_INCLUDED */
diff --git a/storage/connect/osutil.c b/storage/connect/osutil.c
index 66985847ce7..2e9e120b0c8 100644
--- a/storage/connect/osutil.c
+++ b/storage/connect/osutil.c
@@ -4,7 +4,7 @@
#include <stdio.h>
#include "osutil.h"
-#ifdef WIN32
+#ifdef __WIN__
my_bool CloseFileHandle(HANDLE h)
{
return !CloseHandle(h);
diff --git a/storage/connect/plgdbsem.h b/storage/connect/plgdbsem.h
index e61a49ba9f9..b57d9e20ceb 100644
--- a/storage/connect/plgdbsem.h
+++ b/storage/connect/plgdbsem.h
@@ -1,7 +1,7 @@
/************** PlgDBSem H Declares Source Code File (.H) **************/
/* Name: PLGDBSEM.H Version 3.6 */
/* */
-/* (C) Copyright to the author Olivier BERTRAND 1998-2014 */
+/* (C) Copyright to the author Olivier BERTRAND 1998-2015 */
/* */
/* This file contains the PlugDB++ application type definitions. */
/***********************************************************************/
@@ -389,6 +389,7 @@ typedef struct _qryres *PQRYRES;
typedef struct _colres *PCOLRES;
typedef struct _datpar *PDTP;
typedef struct indx_used *PXUSED;
+typedef struct ha_table_option_struct TOS, *PTOS;
/***********************************************************************/
/* Utility blocks for file and storage. */
@@ -504,9 +505,10 @@ enum XFLD {FLD_NO = 0, /* Not a field definition item */
FLD_EXTRA = 13, /* Field extra info */
FLD_PRIV = 14, /* Field priviledges */
FLD_DATEFMT = 15, /* Field date format */
- FLD_CAT = 16, /* Table catalog */
- FLD_SCHEM = 17, /* Table schema */
- FLD_TABNAME = 18}; /* Column Table name */
+ FLD_FORMAT = 16, /* Field format */
+ FLD_CAT = 17, /* Table catalog */
+ FLD_SCHEM = 18, /* Table schema */
+ FLD_TABNAME = 19}; /* Column Table name */
/***********************************************************************/
/* Result of last SQL noconv query. */
@@ -542,11 +544,11 @@ typedef struct _colres {
char Var; /* Type added information */
} COLRES;
-#if defined(WIN32) && !defined(NOEX)
+#if defined(__WIN__) && !defined(NOEX)
#define DllExport __declspec( dllexport )
-#else // !WIN32
+#else // !__WIN__
#define DllExport
-#endif // !WIN32
+#endif // !__WIN__
/***********************************************************************/
/* Utility routines. */
@@ -584,6 +586,7 @@ DllExport PCATLG PlgGetCatalog(PGLOBAL g, bool jump = true);
DllExport bool PlgSetXdbPath(PGLOBAL g, PSZ, PSZ, char *, int, char *, int);
DllExport void PlgDBfree(MBLOCK&);
DllExport void *PlgDBSubAlloc(PGLOBAL g, void *memp, size_t size);
+DllExport char *PlgDBDup(PGLOBAL g, const char *str);
DllExport void *PlgDBalloc(PGLOBAL, void *, MBLOCK&);
DllExport void *PlgDBrealloc(PGLOBAL, void *, MBLOCK&, size_t);
DllExport void NewPointer(PTABS, void *, void *);
@@ -591,6 +594,9 @@ DllExport void NewPointer(PTABS, void *, void *);
DllExport void SetTrc(void);
DllExport char *GetListOption(PGLOBAL, const char *, const char *,
const char *def=NULL);
+DllExport char *GetStringTableOption(PGLOBAL, PTOS, char *, char *);
+DllExport bool GetBooleanTableOption(PGLOBAL, PTOS, char *, bool);
+DllExport int GetIntegerTableOption(PGLOBAL, PTOS, char *, int);
#define MSGID_NONE 0
#define MSGID_CANNOT_OPEN 1
diff --git a/storage/connect/plgdbutl.cpp b/storage/connect/plgdbutl.cpp
index d8009bcc71f..9e236da2d93 100644
--- a/storage/connect/plgdbutl.cpp
+++ b/storage/connect/plgdbutl.cpp
@@ -5,7 +5,7 @@
/* */
/* COPYRIGHT: */
/* ---------- */
-/* (C) Copyright to the author Olivier BERTRAND 1998-2014 */
+/* (C) Copyright to the author Olivier BERTRAND 1998-2015 */
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
@@ -38,12 +38,12 @@
/* Include relevant MariaDB header file. */
/***********************************************************************/
#include "my_global.h"
-#if defined(WIN32)
+#if defined(__WIN__)
#include <io.h>
#include <fcntl.h>
#include <errno.h>
#define BIGMEM 1048576 // 1 Megabyte
-#else // !WIN32
+#else // !__WIN__
#include <unistd.h>
#include <fcntl.h>
#if defined(THREAD)
@@ -51,7 +51,7 @@
#endif // THREAD
#include <stdarg.h>
#define BIGMEM 2147483647 // Max int value
-#endif // !WIN32
+#endif // !__WIN__
#include <locale.h>
/***********************************************************************/
@@ -73,11 +73,11 @@
/* Macro or external routine definition */
/***********************************************************************/
#if defined(THREAD)
-#if defined(WIN32)
+#if defined(__WIN__)
extern CRITICAL_SECTION parsec; // Used calling the Flex parser
-#else // !WIN32
+#else // !__WIN__
extern pthread_mutex_t parmut;
-#endif // !WIN32
+#endif // !__WIN__
#endif // THREAD
/***********************************************************************/
@@ -294,8 +294,7 @@ PQRYRES PlgAllocResult(PGLOBAL g, int ncol, int maxres, int ids,
#else // !XMSG
GetRcString(ids + crp->Ncol, cname, sizeof(cname));
#endif // !XMSG
- crp->Name = (PSZ)PlugSubAlloc(g, NULL, strlen(cname) + 1);
- strcpy(crp->Name, cname);
+ crp->Name = (PSZ)PlugDup(g, cname);
} else
crp->Name = NULL; // Will be set by caller
@@ -311,7 +310,7 @@ PQRYRES PlgAllocResult(PGLOBAL g, int ncol, int maxres, int ids,
else
crp->Kdata = NULL;
- if (g->Trace)
+ if (trace)
htrc("Column(%d) %s type=%d len=%d value=%p\n",
crp->Ncol, crp->Name, crp->Type, crp->Length, crp->Kdata);
@@ -404,11 +403,11 @@ char *SetPath(PGLOBAL g, const char *path)
} // endif path
if (*path != '.') {
-#if defined(WIN32)
+#if defined(__WIN__)
char *s= "\\";
-#else // !WIN32
+#else // !__WIN__
char *s= "/";
-#endif // !WIN32
+#endif // !__WIN__
strcat(strcat(strcat(strcpy(buf, "."), s), path), s);
} else
strcpy(buf, path);
@@ -427,7 +426,7 @@ char *ExtractFromPath(PGLOBAL g, char *pBuff, char *FileName, OPVAL op)
char *drive = NULL, *direc = NULL, *fname = NULL, *ftype = NULL;
switch (op) { // Determine which part to extract
-#if !defined(UNIX)
+#if defined(__WIN__)
case OP_FDISK: drive = pBuff; break;
#endif // !UNIX
case OP_FPATH: direc = pBuff; break;
@@ -703,19 +702,19 @@ PDTP MakeDateFormat(PGLOBAL g, PSZ dfmt, bool in, bool out, int flag)
/* instruction is included in an Enter/LeaveCriticalSection bracket. */
/*********************************************************************/
#if defined(THREAD)
-#if defined(WIN32)
+#if defined(__WIN__)
EnterCriticalSection((LPCRITICAL_SECTION)&parsec);
-#else // !WIN32
+#else // !__WIN__
pthread_mutex_lock(&parmut);
-#endif // !WIN32
+#endif // !__WIN__
#endif // THREAD
/*int rc =*/ fmdflex(pdp);
#if defined(THREAD)
-#if defined(WIN32)
+#if defined(__WIN__)
LeaveCriticalSection((LPCRITICAL_SECTION)&parsec);
-#else // !WIN32
+#else // !__WIN__
pthread_mutex_unlock(&parmut);
-#endif // !WIN32
+#endif // !__WIN__
#endif // THREAD
if (trace)
@@ -853,8 +852,7 @@ FILE *PlugOpenFile(PGLOBAL g, LPCSTR fname, LPCSTR ftype)
htrc(" fp=%p\n", fp);
// fname may be in volatile memory such as stack
- fp->Fname = (char*)PlugSubAlloc(g, NULL, strlen(fname) + 1);
- strcpy((char*)fp->Fname, fname);
+ fp->Fname = PlugDup(g, fname);
fp->Count = 1;
fp->Type = TYPE_FB_FILE;
fp->File = fop;
@@ -890,7 +888,7 @@ FILE *PlugReopenFile(PGLOBAL g, PFBLOCK fp, LPCSTR md)
/* Close file routine: the purpose of this routine is to avoid */
/* double closing that freeze the system on some Unix platforms. */
/***********************************************************************/
-int PlugCloseFile(PGLOBAL g, PFBLOCK fp, bool all)
+int PlugCloseFile(PGLOBAL g __attribute__((unused)), PFBLOCK fp, bool all)
{
int rc = 0;
@@ -1111,7 +1109,7 @@ char *GetAmName(PGLOBAL g, AMT am, void *memp)
return amn;
} // end of GetAmName
-#if defined(WIN32) && !defined(NOCATCH)
+#if defined(__WIN__) && !defined(NOCATCH)
/***********************************************************************/
/* GetExceptionDesc: return the description of an exception code. */
/***********************************************************************/
@@ -1199,7 +1197,7 @@ char *GetExceptionDesc(PGLOBAL g, unsigned int e)
return p;
} // end of GetExceptionDesc
-#endif // WIN32 && !NOCATCH
+#endif // __WIN__ && !NOCATCH
/***********************************************************************/
/* PlgDBalloc: allocates or suballocates memory conditionally. */
@@ -1241,7 +1239,7 @@ void *PlgDBalloc(PGLOBAL g, void *area, MBLOCK& mp)
if (!mp.Sub) {
// For allocations greater than one fourth of remaining storage
// in the area, do allocate from virtual storage.
-#if defined(WIN32)
+#if defined(__WIN__)
if (mp.Size >= BIGMEM)
mp.Memp = VirtualAlloc(NULL, mp.Size, MEM_COMMIT, PAGE_READWRITE);
else
@@ -1338,7 +1336,7 @@ void PlgDBfree(MBLOCK& mp)
htrc("PlgDBfree: %p sub=%d size=%d\n", mp.Memp, mp.Sub, mp.Size);
if (!mp.Sub && mp.Memp)
-#if defined(WIN32)
+#if defined(__WIN__)
if (mp.Size >= BIGMEM)
VirtualFree(mp.Memp, 0, MEM_RELEASE);
else
@@ -1401,6 +1399,23 @@ void *PlgDBSubAlloc(PGLOBAL g, void *memp, size_t size)
} // end of PlgDBSubAlloc
/***********************************************************************/
+/* Program for sub-allocating and copying a string in a storage area. */
+/***********************************************************************/
+char *PlgDBDup(PGLOBAL g, const char *str)
+ {
+ if (str) {
+ char *sm = (char*)PlgDBSubAlloc(g, NULL, strlen(str) + 1);
+
+ if (sm)
+ strcpy(sm, str);
+
+ return sm;
+ } else
+ return NULL;
+
+ } // end of PlgDBDup
+
+/***********************************************************************/
/* PUTOUT: Plug DB object typing routine. */
/***********************************************************************/
void PlugPutOut(PGLOBAL g, FILE *f, short t, void *v, uint n)
@@ -1517,11 +1532,11 @@ int FileComp(PGLOBAL g, char *file1, char *file2)
bp[0] = buff1; bp[1] = buff2;
for (i = 0; i < 2; i++) {
-#if defined(WIN32)
+#if defined(__WIN__)
h[i]= global_open(g, MSGID_NONE, fn[i], _O_RDONLY | _O_BINARY);
-#else // !WIN32
+#else // !__WIN__
h[i]= global_open(g, MSGOD_NONE, fn[i], O_RDONLY);
-#endif // !WIN32
+#endif // !__WIN__
if (h[i] == -1) {
// if (errno != ENOENT) {
diff --git a/storage/connect/plgxml.h b/storage/connect/plgxml.h
index 74a16fd4823..b8e914e0bf1 100644
--- a/storage/connect/plgxml.h
+++ b/storage/connect/plgxml.h
@@ -1,5 +1,5 @@
/******************************************************************/
-/* Dual XML implementation base classes defines. */
+/* Dual XML implementation base classes defines. */
/******************************************************************/
#if !defined(BASE_BUFFER_SIZE)
enum ElementType { // libxml2
@@ -43,7 +43,7 @@ enum NodeType { // MS DOM
NODE_NOTATION = 12};
#endif // !NODE_TYPE_LIST
-typedef class XMLDOCUMENT *PXDOC; // Document
+typedef class XMLDOCUMENT *PXDOC; // Document
typedef class XMLNODE *PXNODE; // Node (Element)
typedef class XMLNODELIST *PXLIST; // Node list
typedef class XMLATTRIBUTE *PXATTR; // Attribute
@@ -93,9 +93,9 @@ class XMLDOCUMENT : public BLOCK {
bool MakeNSlist(PGLOBAL g);
// Members
- PNS Namespaces; /* To the namespaces */
+ PNS Namespaces; /* To the namespaces */
char *Encoding; /* The document encoding */
- char *Nslist; /* Namespace list */
+ char *Nslist; /* Namespace list */
char *DefNs; /* Default namespace */
}; // end of class XMLDOCUMENT
@@ -109,6 +109,7 @@ class XMLNODE : public BLOCK {
virtual int GetType(void) = 0;
virtual PXNODE GetNext(PGLOBAL) = 0;
virtual PXNODE GetChild(PGLOBAL) = 0;
+ virtual int GetLen(void) {return Len;}
// Methods
virtual RCODE GetContent(PGLOBAL, char *, int) = 0;
@@ -163,10 +164,12 @@ class XMLNODELIST : public BLOCK {
class XMLATTRIBUTE : public BLOCK {
public:
// Properties
-//virtual char *GetText(void) = 0;
+ virtual char *GetName(PGLOBAL) = 0;
+ virtual PXATTR GetNext(PGLOBAL) = 0;
// Methods
- virtual bool SetText(PGLOBAL, char *, int) = 0;
+ virtual RCODE GetText(PGLOBAL, char *, int) = 0;
+ virtual bool SetText(PGLOBAL, char *, int) = 0;
protected:
// Constructor
diff --git a/storage/connect/plugutil.c b/storage/connect/plugutil.c
index c77975e5e30..c0e249adf12 100644
--- a/storage/connect/plugutil.c
+++ b/storage/connect/plugutil.c
@@ -6,7 +6,7 @@
/* */
/* COPYRIGHT: */
/* ---------- */
-/* (C) Copyright to the author Olivier BERTRAND 1993-2014 */
+/* (C) Copyright to the author Olivier BERTRAND 1993-2015 */
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
@@ -44,7 +44,7 @@
/* */
/***********************************************************************/
#include "my_global.h"
-#if defined(WIN32)
+#if defined(__WIN__)
//#include <windows.h>
#else
#if defined(UNIX) || defined(UNIV_LINUX)
@@ -80,9 +80,9 @@
#include "rcmsg.h"
#endif // NEWMSG
-#if defined(WIN32)
+#if defined(__WIN__)
extern HINSTANCE s_hModule; /* Saved module handle */
-#endif // WIN32
+#endif // __WIN__
#if defined(XMSG)
extern char *msg_path;
@@ -144,12 +144,12 @@ PGLOBAL PlugInit(LPCSTR Language, uint worksize)
return NULL;
} else {
g->Sarea_Size = worksize;
- g->Trace = 0;
g->Createas = 0;
g->Alchecked = 0;
g->Mrr = 0;
g->Activityp = g->ActivityStart = NULL;
g->Xchk = NULL;
+ g->N = 0;
strcpy(g->Message, "");
/*******************************************************************/
@@ -192,7 +192,7 @@ int PlugExit(PGLOBAL g)
/***********************************************************************/
LPSTR PlugRemoveType(LPSTR pBuff, LPCSTR FileName)
{
-#if !defined(UNIX) && !defined(UNIV_LINUX)
+#if defined(__WIN__)
char drive[_MAX_DRIVE];
#else
char *drive = NULL;
@@ -220,7 +220,7 @@ LPSTR PlugRemoveType(LPSTR pBuff, LPCSTR FileName)
BOOL PlugIsAbsolutePath(LPCSTR path)
{
-#if defined(WIN32)
+#if defined(__WIN__)
return ((path[0] >= 'a' && path[0] <= 'z') ||
(path[0] >= 'A' && path[0] <= 'Z')) && path[1] == ':';
#else
@@ -228,7 +228,6 @@ BOOL PlugIsAbsolutePath(LPCSTR path)
#endif
}
-
/***********************************************************************/
/* Set the full path of a file relatively to a given path. */
/* Note: this routine is not really implemented for Unix. */
@@ -239,7 +238,7 @@ LPCSTR PlugSetPath(LPSTR pBuff, LPCSTR prefix, LPCSTR FileName, LPCSTR defpath)
char direc[_MAX_DIR], defdir[_MAX_DIR], tmpdir[_MAX_DIR];
char fname[_MAX_FNAME];
char ftype[_MAX_EXT];
-#if !defined(UNIX) && !defined(UNIV_LINUX)
+#if defined(__WIN__)
char drive[_MAX_DRIVE], defdrv[_MAX_DRIVE];
#else
char *drive = NULL, *defdrv = NULL;
@@ -256,7 +255,7 @@ LPCSTR PlugSetPath(LPSTR pBuff, LPCSTR prefix, LPCSTR FileName, LPCSTR defpath)
return pBuff;
} // endif
-#if !defined(WIN32)
+#if !defined(__WIN__)
if (*FileName == '~') {
if (_fullpath(pBuff, FileName, _MAX_PATH)) {
if (trace > 1)
@@ -267,7 +266,7 @@ LPCSTR PlugSetPath(LPSTR pBuff, LPCSTR prefix, LPCSTR FileName, LPCSTR defpath)
return FileName; // Error, return unchanged name
} // endif FileName
-#endif // !WIN32
+#endif // !__WIN__
if (prefix && strcmp(prefix, ".") && !PlugIsAbsolutePath(defpath))
{
@@ -296,11 +295,11 @@ LPCSTR PlugSetPath(LPSTR pBuff, LPCSTR prefix, LPCSTR FileName, LPCSTR defpath)
if (trace > 1) {
htrc("after _splitpath: FileName=%s\n", FileName);
-#if defined(UNIX) || defined(UNIV_LINUX)
- htrc("dir=%s fname=%s ext=%s\n", direc, fname, ftype);
-#else
+#if defined(__WIN__)
htrc("drive=%s dir=%s fname=%s ext=%s\n", drive, direc, fname, ftype);
htrc("defdrv=%s defdir=%s\n", defdrv, defdir);
+#else
+ htrc("dir=%s fname=%s ext=%s\n", direc, fname, ftype);
#endif
} // endif trace
@@ -385,8 +384,7 @@ char *PlugReadMessage(PGLOBAL g, int mid, char *m)
err:
if (g) {
// Called by STEP
- msg = (char *)PlugSubAlloc(g, NULL, strlen(stmsg) + 1);
- strcpy(msg, stmsg);
+ msg = PlugDup(g, stmsg);
} else // Called by MSG or PlgGetErrorMsg
msg = stmsg;
@@ -421,8 +419,7 @@ char *PlugGetMessage(PGLOBAL g, int mid)
if (g) {
// Called by STEP
- msg = (char *)PlugSubAlloc(g, NULL, strlen(stmsg) + 1);
- strcpy(msg, stmsg);
+ msg = PlugDup(g, stmsg);
} else // Called by MSG or PlgGetErrorMsg
msg = stmsg;
@@ -430,7 +427,7 @@ char *PlugGetMessage(PGLOBAL g, int mid)
} // end of PlugGetMessage
#endif // NEWMSG
-#if defined(WIN32)
+#if defined(__WIN__)
/***********************************************************************/
/* Return the line length of the console screen buffer. */
/***********************************************************************/
@@ -442,7 +439,7 @@ short GetLineLength(PGLOBAL g)
return (b) ? coninfo.dwSize.X : 0;
} // end of GetLineLength
-#endif // WIN32
+#endif // __WIN__
/***********************************************************************/
/* Program for memory allocation of work and language areas. */
@@ -505,7 +502,7 @@ void *PlugSubAlloc(PGLOBAL g, void *memp, size_t size)
size = ((size + 7) / 8) * 8; /* Round up size to multiple of 8 */
pph = (PPOOLHEADER)memp;
- if (trace > 2)
+ if (trace > 3)
htrc("SubAlloc in %p size=%d used=%d free=%d\n",
memp, size, pph->To_Free, pph->FreeBlk);
@@ -529,7 +526,7 @@ void *PlugSubAlloc(PGLOBAL g, void *memp, size_t size)
pph->To_Free += size; /* New offset of pool free block */
pph->FreeBlk -= size; /* New size of pool free block */
- if (trace > 2)
+ if (trace > 3)
htrc("Done memp=%p used=%d free=%d\n",
memp, pph->To_Free, pph->FreeBlk);
@@ -537,6 +534,22 @@ void *PlugSubAlloc(PGLOBAL g, void *memp, size_t size)
} /* end of PlugSubAlloc */
/***********************************************************************/
+/* Program for sub-allocating and copying a string in a storage area. */
+/***********************************************************************/
+char *PlugDup(PGLOBAL g, const char *str)
+ {
+ if (str) {
+ char *sm = (char*)PlugSubAlloc(g, NULL, strlen(str) + 1);
+
+ strcpy(sm, str);
+ return sm;
+ } else
+ return NULL;
+
+ } // end of PlugDup
+
+#if 0
+/***********************************************************************/
/* This routine suballocate a copy of the passed string. */
/***********************************************************************/
char *PlugDup(PGLOBAL g, const char *str)
@@ -552,6 +565,7 @@ char *PlugDup(PGLOBAL g, const char *str)
return(buf);
} /* end of PlugDup */
+#endif // 0
/***********************************************************************/
/* This routine makes a pointer from an offset to a memory pointer. */
diff --git a/storage/connect/rcmsg.c b/storage/connect/rcmsg.c
index 9eea944c697..75759e03314 100644
--- a/storage/connect/rcmsg.c
+++ b/storage/connect/rcmsg.c
@@ -1,68 +1,68 @@
-/**************** 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 <stdio.h>
-#include <string.h>
-#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;
-
- // This conditional until a real fix is found for MDEV-7304
-#if defined(FRENCH)
- if (!stricmp(msglang(), "french"))
- switch (id) {
-#include "frids.h"
-#if defined(NEWMSG)
-#include "frcas.h"
-#endif // NEWMSG
- } // endswitch(id)
-
- else // English
-#endif // FRENCH
- 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
+/**************** 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 <stdio.h>
+#include <string.h>
+#include "resource.h"
+#include "rcmsg.h"
+#if defined(NEWMSG)
+#include "msgid.h"
+#endif // NEWMSG
+
+#if !defined(__WIN__)
+#define stricmp strcasecmp
+#endif // !__WIN__
+
+char *msglang(void);
+
+char *GetMsgid(int id)
+ {
+ char *p = NULL;
+
+ // This conditional until a real fix is found for MDEV-7304
+#if defined(FRENCH)
+ if (!stricmp(msglang(), "french"))
+ switch (id) {
+#include "frids.h"
+#if defined(NEWMSG)
+#include "frcas.h"
+#endif // NEWMSG
+ } // endswitch(id)
+
+ else // English
+#endif // FRENCH
+ 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 51d777a7d17..60d515a61ca 100644
--- a/storage/connect/reldef.cpp
+++ b/storage/connect/reldef.cpp
@@ -1,11 +1,11 @@
/************* RelDef CPP Program Source Code File (.CPP) **************/
-/* PROGRAM NAME: REFDEF */
+/* PROGRAM NAME: RELDEF */
/* ------------- */
/* Version 1.4 */
/* */
/* COPYRIGHT: */
/* ---------- */
-/* (C) Copyright to the author Olivier BERTRAND 2004-2014 */
+/* (C) Copyright to the author Olivier BERTRAND 2004-2015 */
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
@@ -17,7 +17,7 @@
/* Include relevant MariaDB header file. */
/***********************************************************************/
#include "my_global.h"
-#if defined(WIN32)
+#if defined(__WIN__)
#include <sqlext.h>
#else
#include <dlfcn.h> // dlopen(), dlclose(), dlsym() ...
@@ -35,7 +35,6 @@
/***********************************************************************/
#include "global.h"
#include "plgdbsem.h"
-#include "mycat.h"
#include "reldef.h"
#include "colblk.h"
#include "filamap.h"
@@ -49,14 +48,15 @@
#include "tabmul.h"
#include "ha_connect.h"
-#if !defined(WIN32)
+#if !defined(__WIN__)
extern handlerton *connect_hton;
-#endif // !WIN32
+#endif // !__WIN__
/***********************************************************************/
/* External function. */
/***********************************************************************/
USETEMP UseTemp(void);
+char *GetPluginDir(void);
/* --------------------------- Class RELDEF -------------------------- */
@@ -74,6 +74,14 @@ RELDEF::RELDEF(void)
} // end of RELDEF constructor
/***********************************************************************/
+/* This function return a pointer to the Table Option Struct. */
+/***********************************************************************/
+PTOS RELDEF::GetTopt(void)
+ {
+ return Hc->GetTableOptionStruct();
+ } // end of GetTopt
+
+/***********************************************************************/
/* This function sets an integer table information. */
/***********************************************************************/
bool RELDEF::SetIntCatInfo(PSZ what, int n)
@@ -153,10 +161,9 @@ char *RELDEF::GetStringCatInfo(PGLOBAL g, PSZ what, PSZ sdef)
if (s) {
if (!Hc->IsPartitioned() ||
(stricmp(what, "filename") && stricmp(what, "tabname")
- && stricmp(what, "connect"))) {
- sval= (char*)PlugSubAlloc(g, NULL, strlen(s) + 1);
- strcpy(sval, s);
- } else
+ && stricmp(what, "connect")))
+ sval= PlugDup(g, s);
+ else
sval= s;
} else if (!stricmp(what, "filename")) {
@@ -213,8 +220,7 @@ bool TABDEF::Define(PGLOBAL g, PCATLG cat, LPCSTR name, LPCSTR am)
{
int poff = 0;
- Name = (PSZ)PlugSubAlloc(g, NULL, strlen(name) + 1);
- strcpy(Name, name);
+ Name = (PSZ)PlugDup(g, name);
Cat = cat;
Hc = ((MYCAT*)cat)->GetHandler();
Catfunc = GetFuncID(GetStringCatInfo(g, "Catfunc", NULL));
@@ -241,7 +247,7 @@ bool TABDEF::Define(PGLOBAL g, PCATLG cat, LPCSTR name, LPCSTR am)
/***********************************************************************/
PSZ TABDEF::GetPath(void)
{
- return (Database) ? (PSZ)Database : Hc->GetDataPath();
+ return (Database) ? (PSZ)Database : (Hc) ? Hc->GetDataPath() : NULL;
} // end of GetPath
/***********************************************************************/
@@ -250,7 +256,8 @@ PSZ TABDEF::GetPath(void)
int TABDEF::GetColCatInfo(PGLOBAL g)
{
char *type= GetStringCatInfo(g, "Type", "*");
- int i, loff, poff, nof, nlg;
+ char c, fty, eds;
+ int i, n, loff, poff, nof, nlg;
void *field= NULL;
TABTYPE tc;
PCOLDEF cdp, lcdp= NULL, tocols= NULL;
@@ -317,7 +324,7 @@ int TABDEF::GetColCatInfo(PGLOBAL g)
if ((nof= cdp->Define(g, NULL, pcf, poff)) < 0)
return -1; // Error, probably unhandled type
- else if (nof)
+ else
loff= cdp->GetOffset();
switch (tc) {
@@ -325,20 +332,52 @@ int TABDEF::GetColCatInfo(PGLOBAL g)
cdp->SetOffset(0); // Not to have shift
case TAB_BIN:
// BIN/VEC are packed by default
- if (nof)
+ if (nof) {
// Field width is the internal representation width
// that can also depend on the column format
- switch (cdp->Fmt ? *cdp->Fmt : 'X') {
- case 'C': break;
+ fty = cdp->Decode ? 'C' : 'X';
+ eds = 0;
+ n = 0;
+
+ if (cdp->Fmt && !cdp->Decode) {
+ for (i = 0; cdp->Fmt[i]; i++) {
+ c = toupper(cdp->Fmt[i]);
+
+ if (isdigit(c))
+ n = (n * 10 + (c - '0'));
+ else if (c == 'L' || c == 'B' || c == 'H')
+ eds = c;
+ else
+ fty = c;
+
+ } // endfor i
+
+ } // endif Fmt
+
+ if (n)
+ nof = n;
+ else switch (fty) {
+ case 'X':
+ if (eds && IsTypeChar(cdp->Buf_Type))
+ nof = sizeof(longlong);
+ else
+ nof= cdp->Clen;
+
+ break;
+ case 'C': break;
case 'R':
- case 'F':
- case 'L':
- case 'I': nof= 4; break;
- case 'D': nof= 8; break;
- case 'S': nof= 2; break;
- case 'T': nof= 1; break;
- default: nof= cdp->Clen;
- } // endswitch Fmt
+ case 'F': nof = sizeof(float); break;
+ case 'I': nof = sizeof(int); break;
+ case 'D': nof = sizeof(double); break;
+ case 'S': nof = sizeof(short); break;
+ case 'T': nof = sizeof(char); break;
+ case 'G': nof = sizeof(longlong); break;
+ default: /* Wrong format */
+ sprintf(g->Message, "Invalid format %c", fty);
+ return -1;
+ } // endswitch fty
+
+ } // endif nof
default:
break;
@@ -364,20 +403,16 @@ int TABDEF::GetColCatInfo(PGLOBAL g)
// not specified (for instance if quoted is specified)
// if ((ending= Hc->GetIntegerOption("Ending")) < 0) {
if ((ending= Hc->GetIntegerOption("Ending")) <= 0) {
-#if defined(WIN32)
- ending= 2;
-#else
- ending= 1;
-#endif
+ ending= (tc == TAB_BIN || tc == TAB_VEC) ? 0 : CRLF;
Hc->SetIntegerOption("Ending", ending);
} // endif ending
// Calculate the default record size
switch (tc) {
case TAB_FIX:
+ case TAB_BIN:
recln= nlg + ending; // + length of line ending
break;
- case TAB_BIN:
case TAB_VEC:
recln= nlg;
@@ -428,20 +463,31 @@ void TABDEF::SetIndexInfo(void)
PTABDEF OEMDEF::GetXdef(PGLOBAL g)
{
typedef PTABDEF (__stdcall *XGETDEF) (PGLOBAL, void *);
- char c, getname[40] = "Get";
+ char c, soname[_MAX_PATH], getname[40] = "Get";
PTABDEF xdefp;
XGETDEF getdef = NULL;
PCATLG cat = Cat;
-#if defined(WIN32)
+ /*********************************************************************/
+ /* Ensure that the .dll doesn't have a path. */
+ /* This is done to ensure that only approved dll from the system */
+ /* directories are used (to make this even remotely secure). */
+ /*********************************************************************/
+ if (check_valid_path(Module, strlen(Module))) {
+ strcpy(g->Message, "Module cannot contain a path");
+ return NULL;
+ } else
+ PlugSetPath(soname, Module, GetPluginDir());
+
+#if defined(__WIN__)
// Is the DLL already loaded?
- if (!Hdll && !(Hdll = GetModuleHandle(Module)))
+ if (!Hdll && !(Hdll = GetModuleHandle(soname)))
// No, load the Dll implementing the function
- if (!(Hdll = LoadLibrary(Module))) {
+ if (!(Hdll = LoadLibrary(soname))) {
char buf[256];
DWORD rc = GetLastError();
- sprintf(g->Message, MSG(DLL_LOAD_ERROR), rc, Module);
+ sprintf(g->Message, MSG(DLL_LOAD_ERROR), rc, soname);
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS, NULL, rc, 0,
(LPTSTR)buf, sizeof(buf), NULL);
@@ -462,10 +508,11 @@ PTABDEF OEMDEF::GetXdef(PGLOBAL g)
FreeLibrary((HMODULE)Hdll);
return NULL;
} // endif getdef
-#else // !WIN32
+#else // !__WIN__
const char *error = NULL;
Dl_info dl_info;
-
+
+#if 0 // Don't know what all this stuff does
// 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) {
@@ -479,15 +526,16 @@ PTABDEF OEMDEF::GetXdef(PGLOBAL g)
sprintf(g->Message, "dladdr failed: %s, OEM not supported", SVP(error));
return NULL;
} // endif dladdr
+#endif // 0
// Is the library already loaded?
-// if (!Hdll && !(Hdll = ???))
- // Load the desired shared library
- if (!(Hdll = dlopen(Module, RTLD_LAZY))) {
- error = dlerror();
- sprintf(g->Message, MSG(SHARED_LIB_ERR), Module, SVP(error));
- return NULL;
- } // endif Hdll
+ if (!Hdll && !(Hdll = dlopen(soname, RTLD_NOLOAD)))
+ // Load the desired shared library
+ if (!(Hdll = dlopen(soname, RTLD_LAZY))) {
+ error = dlerror();
+ sprintf(g->Message, MSG(SHARED_LIB_ERR), soname, SVP(error));
+ return NULL;
+ } // endif Hdll
// The exported name is always in uppercase
for (int i = 0; ; i++) {
@@ -503,7 +551,7 @@ PTABDEF OEMDEF::GetXdef(PGLOBAL g)
dlclose(Hdll);
return NULL;
} // endif getdef
-#endif // !WIN32
+#endif // !__WIN__
// Just in case the external Get function does not set error messages
sprintf(g->Message, MSG(DEF_ALLOC_ERROR), Subtype);
@@ -543,7 +591,7 @@ bool OEMDEF::DeleteTableFile(PGLOBAL g)
/***********************************************************************/
/* Define: initialize the table definition block from XDB file. */
/***********************************************************************/
-bool OEMDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
+bool OEMDEF::DefineAM(PGLOBAL g, LPCSTR, int)
{
Module = GetStringCatInfo(g, "Module", "");
Subtype = GetStringCatInfo(g, "Subtype", Module);
@@ -710,10 +758,9 @@ COLDEF::COLDEF(void) : COLCRT()
/***********************************************************************/
/* Define: initialize a column definition from a COLINFO structure. */
/***********************************************************************/
-int COLDEF::Define(PGLOBAL g, void *memp, PCOLINFO cfp, int poff)
+int COLDEF::Define(PGLOBAL g, void *, PCOLINFO cfp, int poff)
{
- Name = (PSZ)PlugSubAlloc(g, memp, strlen(cfp->Name) + 1);
- strcpy(Name, cfp->Name);
+ Name = (PSZ)PlugDup(g, cfp->Name);
if (!(cfp->Flags & U_SPECIAL)) {
Poff = poff;
@@ -735,22 +782,17 @@ int COLDEF::Define(PGLOBAL g, void *memp, PCOLINFO cfp, int poff)
Key = cfp->Key;
Freq = cfp->Freq;
- if (cfp->Remark && *cfp->Remark) {
- Desc = (PSZ)PlugSubAlloc(g, memp, strlen(cfp->Remark) + 1);
- strcpy(Desc, cfp->Remark);
- } // endif Remark
+ if (cfp->Remark && *cfp->Remark)
+ Desc = (PSZ)PlugDup(g, cfp->Remark);
- if (cfp->Datefmt) {
- Decode = (PSZ)PlugSubAlloc(g, memp, strlen(cfp->Datefmt) + 1);
- strcpy(Decode, cfp->Datefmt);
- } // endif Datefmt
+ if (cfp->Datefmt)
+ Decode = (PSZ)PlugDup(g, cfp->Datefmt);
- } // endif special
+ } else
+ Offset = poff;
- if (cfp->Fieldfmt) {
- Fmt = (PSZ)PlugSubAlloc(g, memp, strlen(cfp->Fieldfmt) + 1);
- strcpy(Fmt, cfp->Fieldfmt);
- } // endif Fieldfmt
+ if (cfp->Fieldfmt)
+ Fmt = (PSZ)PlugDup(g, cfp->Fieldfmt);
Flags = cfp->Flags;
return (Flags & (U_VIRTUAL|U_SPECIAL)) ? 0 : Long;
diff --git a/storage/connect/reldef.h b/storage/connect/reldef.h
index 6160ea71680..4aa29037dfc 100644
--- a/storage/connect/reldef.h
+++ b/storage/connect/reldef.h
@@ -1,7 +1,7 @@
/*************** RelDef H Declares Source Code File (.H) ***************/
/* Name: RELDEF.H Version 1.5 */
/* */
-/* (C) Copyright to the author Olivier BERTRAND 2004-2014 */
+/* (C) Copyright to the author Olivier BERTRAND 2004-2015 */
/* */
/* This file contains the DEF classes definitions. */
/***********************************************************************/
@@ -12,6 +12,7 @@
#include "block.h"
#include "catalog.h"
#include "my_sys.h"
+#include "mycat.h"
typedef class INDEXDEF *PIXDEF;
typedef class ha_connect *PHC;
@@ -40,6 +41,7 @@ class DllExport RELDEF : public BLOCK { // Relation definition block
void SetCat(PCATLG cat) { Cat=cat; }
// Methods
+ PTOS GetTopt(void);
bool GetBoolCatInfo(PSZ what, bool bdef);
bool SetIntCatInfo(PSZ what, int ival);
bool Partitioned(void);
@@ -87,7 +89,7 @@ class DllExport TABDEF : public RELDEF { /* Logical table descriptor */
bool IsReadOnly(void) {return Read_Only;}
virtual AMT GetDefType(void) {return TYPE_AM_TAB;}
virtual PIXDEF GetIndx(void) {return NULL;}
- virtual void SetIndx(PIXDEF xp) {}
+ virtual void SetIndx(PIXDEF) {}
virtual bool IsHuge(void) {return false;}
const CHARSET_INFO *data_charset() {return m_data_charset;}
@@ -137,11 +139,11 @@ class DllExport OEMDEF : public TABDEF { /* OEM table */
PTABDEF GetXdef(PGLOBAL g);
// Members
-#if defined(WIN32)
+#if defined(__WIN__)
HANDLE Hdll; /* Handle to the external DLL */
-#else // !WIN32
+#else // !__WIN__
void *Hdll; /* Handle for the loaded shared library */
-#endif // !WIN32
+#endif // !__WIN__
PTABDEF Pxdef; /* Pointer to the external TABDEF class */
char *Module; /* Path/Name of the DLL implenting it */
char *Subtype; /* The name of the OEM table sub type */
diff --git a/storage/connect/tabcol.cpp b/storage/connect/tabcol.cpp
index 8f350c6f074..662c0b514cf 100644
--- a/storage/connect/tabcol.cpp
+++ b/storage/connect/tabcol.cpp
@@ -1,7 +1,7 @@
/************* TabCol C++ Functions Source Code File (.CPP) ************/
/* Name: TABCOL.CPP Version 2.7 */
/* */
-/* (C) Copyright to the author Olivier BERTRAND 1998-2013 */
+/* (C) Copyright to the author Olivier BERTRAND 1998-2015 */
/* */
/* This file contains the PlugDB++ XTAB, COLUMN and XORDER methods. */
/***********************************************************************/
@@ -91,7 +91,7 @@ void XTAB::Print(PGLOBAL g, FILE *f, uint n)
/***********************************************************************/
/* Make string output of XTAB contents. */
/***********************************************************************/
-void XTAB::Print(PGLOBAL g, char *ps, uint z)
+void XTAB::Print(PGLOBAL, char *ps, uint z)
{
char buf[128];
int i, n = (int)z - 1;
@@ -125,7 +125,7 @@ COLUMN::COLUMN(LPCSTR name) : Name(name)
/***********************************************************************/
/* COLUMN SetFormat: should never be called. */
/***********************************************************************/
-bool COLUMN::SetFormat(PGLOBAL g, FORMAT& fmt)
+bool COLUMN::SetFormat(PGLOBAL g, FORMAT&)
{
strcpy(g->Message, MSG(NO_FORMAT_COL));
return true;
@@ -154,7 +154,7 @@ void COLUMN::Print(PGLOBAL g, FILE *f, uint n)
/***********************************************************************/
/* Make string output of COLUMN contents. */
/***********************************************************************/
-void COLUMN::Print(PGLOBAL g, char *ps, uint z)
+void COLUMN::Print(PGLOBAL, char *ps, uint z)
{
char buf[80];
diff --git a/storage/connect/tabdos.cpp b/storage/connect/tabdos.cpp
index ba22da52998..a1e58ab3344 100644
--- a/storage/connect/tabdos.cpp
+++ b/storage/connect/tabdos.cpp
@@ -5,7 +5,7 @@
/* */
/* COPYRIGHT: */
/* ---------- */
-/* (C) Copyright to the author Olivier BERTRAND 1998-2014 */
+/* (C) Copyright to the author Olivier BERTRAND 1998-2015 */
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
@@ -17,7 +17,7 @@
/* Include relevant sections of the System header files. */
/***********************************************************************/
#include "my_global.h"
-#if defined(WIN32)
+#if defined(__WIN__)
#include <io.h>
#include <sys\timeb.h> // For testing only
#include <fcntl.h>
@@ -26,7 +26,7 @@
#define __MFC_COMPAT__ // To define min/max as macro
#endif // __BORLANDC__
//#include <windows.h>
-#else // !WIN32
+#else // !__WIN__
#if defined(UNIX)
#include <errno.h>
#include <unistd.h>
@@ -34,7 +34,7 @@
#include <io.h>
#endif // !UNIX
#include <fcntl.h>
-#endif // !WIN32
+#endif // !__WIN__
/***********************************************************************/
/* Include application header files: */
@@ -112,12 +112,13 @@ DOSDEF::DOSDEF(void)
Maxerr = 0;
ReadMode = 0;
Ending = 0;
+ Teds = 0;
} // end of DOSDEF constructor
/***********************************************************************/
/* DefineAM: define specific AM block values from XDB file. */
/***********************************************************************/
-bool DOSDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
+bool DOSDEF::DefineAM(PGLOBAL g, LPCSTR am, int)
{
char buf[8];
bool map = (am && (*am == 'M' || *am == 'm'));
@@ -146,6 +147,7 @@ bool DOSDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
Padded = GetBoolCatInfo("Padded", false);
Blksize = GetIntCatInfo("Blksize", 0);
Eof = (GetIntCatInfo("EOF", 0) != 0);
+ Teds = toupper(*GetStringCatInfo(g, "Endian", ""));
} else if (Recfm == RECFM_DBF) {
Maxerr = GetIntCatInfo("Maxerr", 0);
Accept = GetBoolCatInfo("Accept", false);
@@ -206,11 +208,11 @@ void DOSDEF::RemoveOptValues(PGLOBAL g)
// Delete any eventually ill formed non matching optimization file
if (!GetOptFileName(g, filename))
-#if defined(WIN32)
+#if defined(__WIN__)
DeleteFile(filename);
#else // UNIX
remove(filename);
-#endif // WIN32
+#endif // __WIN__
Optimized = 0;
} // end of RemoveOptValues
@@ -251,7 +253,7 @@ bool DOSDEF::DeleteIndexFile(PGLOBAL g, PIXDEF pxdf)
/*********************************************************************/
if (sep) {
// Indexes are save in separate files
-#if !defined(UNIX)
+#if defined(__WIN__)
char drive[_MAX_DRIVE];
#else
char *drive = NULL;
@@ -268,7 +270,7 @@ bool DOSDEF::DeleteIndexFile(PGLOBAL g, PIXDEF pxdf)
strcat(strcat(fname, "_"), pxdf->GetName());
_makepath(filename, drive, direc, fname, ftype);
PlugSetPath(filename, filename, GetPath());
-#if defined(WIN32)
+#if defined(__WIN__)
if (!DeleteFile(filename))
rc |= (GetLastError() != ERROR_FILE_NOT_FOUND);
#else // UNIX
@@ -285,7 +287,7 @@ bool DOSDEF::DeleteIndexFile(PGLOBAL g, PIXDEF pxdf)
// Drop all indexes, delete the common file
PlugSetPath(filename, Ofn, GetPath());
strcat(PlugRemoveType(filename, filename), ftype);
-#if defined(WIN32)
+#if defined(__WIN__)
if (!DeleteFile(filename))
rc = (GetLastError() != ERROR_FILE_NOT_FOUND);
#else // UNIX
@@ -303,7 +305,7 @@ bool DOSDEF::DeleteIndexFile(PGLOBAL g, PIXDEF pxdf)
/***********************************************************************/
/* InvalidateIndex: mark all indexes as invalid. */
/***********************************************************************/
-bool DOSDEF::InvalidateIndex(PGLOBAL g)
+bool DOSDEF::InvalidateIndex(PGLOBAL)
{
if (To_Indx)
for (PIXDEF xp = To_Indx; xp; xp = xp->Next)
@@ -954,7 +956,7 @@ bool TDBDOS::GetBlockValues(PGLOBAL g)
#if 0
if (Mode == MODE_INSERT && Txfp->GetAmType() == TYPE_AM_DOS)
return false;
-#endif // WIN32
+#endif // __WIN__
if (defp->Optimized)
return false; // Already done or to be redone
@@ -1736,15 +1738,16 @@ err:
/***********************************************************************/
/* Make a dynamic index. */
/***********************************************************************/
-bool TDBDOS::InitialyzeIndex(PGLOBAL g, PIXDEF xdp, bool sorted)
+bool TDBDOS::InitialyzeIndex(PGLOBAL g, volatile PIXDEF xdp, bool sorted)
{
int k, rc;
- bool brc, dynamic;
+ volatile bool dynamic;
+ bool brc;
PCOL colp;
PCOLDEF cdp;
PVAL valp;
PXLOAD pxp;
- PKXBASE kxp;
+ volatile PKXBASE kxp;
PKPDEF kdp;
if (!xdp && !(xdp = To_Xdp)) {
@@ -1864,7 +1867,7 @@ int TDBDOS::GetProgCur(void)
/***********************************************************************/
/* RowNumber: return the ordinal number of the current row. */
/***********************************************************************/
-int TDBDOS::RowNumber(PGLOBAL g, bool b)
+int TDBDOS::RowNumber(PGLOBAL g, bool)
{
if (To_Kindex) {
/*******************************************************************/
@@ -1944,7 +1947,7 @@ int TDBDOS::Cardinality(PGLOBAL g)
rec = ((PDOSDEF)To_Def)->Ending;
if (AvgLen <= 0) // No given average estimate
- rec += EstimatedLength(g);
+ rec += EstimatedLength();
else // An estimate was given for the average record length
rec += AvgLen;
@@ -1988,7 +1991,7 @@ int TDBDOS::GetMaxSize(PGLOBAL g)
/* Estimate the number of lines in the table (if not known) by */
/* dividing the file length by minimum record length. */
/*****************************************************************/
- rec = EstimatedLength(g) + ((PDOSDEF)To_Def)->Ending;
+ rec = EstimatedLength() + ((PDOSDEF)To_Def)->Ending;
MaxSize = (len + rec - 1) / rec;
if (trace)
@@ -2005,7 +2008,7 @@ int TDBDOS::GetMaxSize(PGLOBAL g)
/***********************************************************************/
/* DOS EstimatedLength. Returns an estimated minimum line length. */
/***********************************************************************/
-int TDBDOS::EstimatedLength(PGLOBAL g)
+int TDBDOS::EstimatedLength(void)
{
int dep = 0;
PCOLDEF cdp = To_Def->GetCols();
@@ -2023,7 +2026,7 @@ int TDBDOS::EstimatedLength(PGLOBAL g)
/***********************************************************************/
/* DOS tables favor the use temporary files for Update. */
/***********************************************************************/
-bool TDBDOS::IsUsingTemp(PGLOBAL g)
+bool TDBDOS::IsUsingTemp(PGLOBAL)
{
USETEMP utp = UseTemp();
@@ -2183,7 +2186,7 @@ int TDBDOS::ReadDB(PGLOBAL g)
/***********************************************************************/
/* PrepareWriting: Prepare the line to write. */
/***********************************************************************/
-bool TDBDOS::PrepareWriting(PGLOBAL g)
+bool TDBDOS::PrepareWriting(PGLOBAL)
{
if (!Ftype && (Mode == MODE_INSERT || Txfp->GetUseTemp())) {
char *p;
diff --git a/storage/connect/tabdos.h b/storage/connect/tabdos.h
index 156d46b9791..c098886f14b 100644
--- a/storage/connect/tabdos.h
+++ b/storage/connect/tabdos.h
@@ -1,7 +1,7 @@
/*************** TabDos H Declares Source Code File (.H) ***************/
/* Name: TABDOS.H Version 3.3 */
/* */
-/* (C) Copyright to the author Olivier BERTRAND 1999-2014 */
+/* (C) Copyright to the author Olivier BERTRAND 1999-2015 */
/* */
/* This file contains the DOS classes declares. */
/***********************************************************************/
@@ -91,6 +91,7 @@ class DllExport DOSDEF : public TABDEF { /* Logical table description */
int Maxerr; /* Maximum number of bad records (DBF) */
int ReadMode; /* Specific to DBF */
int Ending; /* Length of end of lines */
+ int Teds; /* Binary table default endian setting */
}; // end of DOSDEF
/***********************************************************************/
@@ -123,11 +124,11 @@ class DllExport TDBDOS : public TDBASE {
// Implementation
virtual AMT GetAmType(void) {return Txfp->GetAmType();}
- virtual PSZ GetFile(PGLOBAL g) {return Txfp->To_File;}
- virtual void SetFile(PGLOBAL g, PSZ fn) {Txfp->To_File = fn;}
+ virtual PSZ GetFile(PGLOBAL) {return Txfp->To_File;}
+ virtual void SetFile(PGLOBAL, PSZ fn) {Txfp->To_File = fn;}
virtual void SetAbort(bool b) {Abort = b;}
virtual RECFM GetFtype(void) {return Ftype;}
- virtual bool SkipHeader(PGLOBAL g) {return false;}
+ virtual bool SkipHeader(PGLOBAL) {return false;}
virtual void RestoreNrec(void) {Txfp->SetNrec(1);}
virtual PTDB Duplicate(PGLOBAL g)
{return (PTDB)new(g) TDBDOS(g, this);}
@@ -149,7 +150,7 @@ class DllExport TDBDOS : public TDBASE {
// Database routines
virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n);
- virtual char *GetOpenMode(PGLOBAL g, char *opmode) {return NULL;}
+ virtual char *GetOpenMode(PGLOBAL, char*) {return NULL;}
virtual int GetFileLength(PGLOBAL g) {return Txfp->GetFileLength(g);}
virtual int GetProgMax(PGLOBAL g);
virtual int GetProgCur(void);
@@ -168,7 +169,7 @@ class DllExport TDBDOS : public TDBASE {
virtual int ReadBuffer(PGLOBAL g) {return Txfp->ReadBuffer(g);}
// Specific routine
- virtual int EstimatedLength(PGLOBAL g);
+ virtual int EstimatedLength(void);
// Optimization routines
virtual int MakeIndex(PGLOBAL g, PIXDEF pxdf, bool add);
@@ -222,6 +223,7 @@ class DllExport DOSCOL : public COLBLK {
virtual PVBLK GetDval(void) {return Dval;}
// Methods
+ using COLBLK::Print;
virtual bool VarSize(void);
virtual bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check);
virtual void ReadColumn(PGLOBAL g);
diff --git a/storage/connect/tabfix.cpp b/storage/connect/tabfix.cpp
index 77e47e6f8dd..acd548c86ab 100644
--- a/storage/connect/tabfix.cpp
+++ b/storage/connect/tabfix.cpp
@@ -5,7 +5,7 @@
/* */
/* COPYRIGHT: */
/* ---------- */
-/* (C) Copyright to the author Olivier BERTRAND 1998-2014 */
+/* (C) Copyright to the author Olivier BERTRAND 1998-2015 */
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
@@ -17,7 +17,7 @@
/* Include relevant section of system dependant header files. */
/***********************************************************************/
#include "my_global.h"
-#if defined(WIN32)
+#if defined(__WIN__)
#include <io.h>
#include <fcntl.h>
#include <errno.h>
@@ -25,7 +25,7 @@
#define __MFC_COMPAT__ // To define min/max as macro
#endif // __BORLANDC__
//#include <windows.h>
-#else // !WIN32
+#else // !__WIN__
#if defined(UNIX)
#include <sys/types.h>
#include <sys/stat.h>
@@ -35,7 +35,7 @@
#include <io.h>
#endif // !UNIX
#include <fcntl.h>
-#endif // !WIN32
+#endif // !__WIN__
/***********************************************************************/
/* Include application header files: */
@@ -54,6 +54,7 @@
extern int num_read, num_there, num_eq[2]; // Statistics
static const longlong M2G = 0x80000000;
static const longlong M4G = (longlong)2 * M2G;
+char BINCOL::Endian = 'H';
/***********************************************************************/
/* External function. */
@@ -67,10 +68,12 @@ USETEMP UseTemp(void);
/***********************************************************************/
TDBFIX::TDBFIX(PDOSDEF tdp, PTXF txfp) : TDBDOS(tdp, txfp)
{
+ Teds = tdp->Teds; // For BIN tables
} // end of TDBFIX standard constructor
TDBFIX::TDBFIX(PGLOBAL g, PTDBFIX tdbp) : TDBDOS(g, tdbp)
{
+ Teds = tdbp->Teds;
} // end of TDBFIX copy constructor
// Method
@@ -271,7 +274,7 @@ int TDBFIX::RowNumber(PGLOBAL g, bool b)
/***********************************************************************/
/* FIX tables don't use temporary files except if specified as do it. */
/***********************************************************************/
-bool TDBFIX::IsUsingTemp(PGLOBAL g)
+bool TDBFIX::IsUsingTemp(PGLOBAL)
{
// Not ready yet to handle using a temporary file with mapping
// or while deleting from DBF files.
@@ -373,19 +376,94 @@ int TDBFIX::WriteDB(PGLOBAL g)
BINCOL::BINCOL(PGLOBAL g, PCOLDEF cdp, PTDB tp, PCOL cp, int i, PSZ am)
: DOSCOL(g, cdp, tp, cp, i, am)
{
- Fmt = (cdp->GetFmt()) ? toupper(*cdp->GetFmt()) : 'X';
+ char c, *fmt = cdp->GetFmt();
+
+ Fmt = GetDomain() ? 'C' : 'X';
+ Buff = NULL;
+ Eds = ((PTDBFIX)tp)->Teds;
+ N = 0;
+ M = GetTypeSize(Buf_Type, sizeof(longlong));
+ Lim = 0;
+
+ if (fmt) {
+ for (N = 0, i = 0; fmt[i]; i++) {
+ c = toupper(fmt[i]);
+
+ if (isdigit(c))
+ N = (N * 10 + (c - '0'));
+ else if (c == 'L' || c == 'B' || c == 'H')
+ Eds = c;
+ else
+ Fmt = c;
+
+ } // endfor i
+
+ // M is the size of the source value
+ switch (Fmt) {
+ case 'C': Eds = 0; break;
+ case 'X': break;
+ case 'S': M = sizeof(short); break;
+ case 'T': M = sizeof(char); break;
+ case 'I': M = sizeof(int); break;
+ case 'G': M = sizeof(longlong); break;
+ case 'R': // Real
+ case 'F': M = sizeof(float); break;
+ case 'D': M = sizeof(double); break;
+ default:
+ sprintf(g->Message, MSG(BAD_BIN_FMT), Fmt, Name);
+ longjmp(g->jumper[g->jump_level], 11);
+ } // endswitch Fmt
+
+ } else if (IsTypeChar(Buf_Type))
+ Eds = 0;
+
+ if (Eds) {
+ // This is a byte order specification
+ if (!N)
+ N = M;
+
+ if (Eds != 'L' && Eds != 'B')
+ Eds = Endian;
+
+ if (N != M || Eds != Endian || IsTypeChar(Buf_Type)) {
+ Buff = (char*)PlugSubAlloc(g, NULL, M);
+ memset(Buff, 0, M);
+ Lim = MY_MIN(N, M);
+ } else
+ Eds = 0; // New format is a no op
+
+ } // endif Eds
+
} // end of BINCOL constructor
/***********************************************************************/
-/* FIXCOL constructor used for copying columns. */
+/* BINCOL constructor used for copying columns. */
/* tdbp is the pointer to the new table descriptor. */
/***********************************************************************/
BINCOL::BINCOL(BINCOL *col1, PTDB tdbp) : DOSCOL(col1, tdbp)
{
+ Eds = col1->Eds;
Fmt = col1->Fmt;
+ N = col1->N;
+ M = col1->M;
+ Lim = col1->Lim;
} // end of BINCOL copy constructor
/***********************************************************************/
+/* Set Endian according to the host setting. */
+/***********************************************************************/
+void BINCOL::SetEndian(void)
+ {
+ union {
+ short S;
+ char C[sizeof(short)];
+ };
+
+ S = 1;
+ Endian = (C[0] == 1) ? 'L' : 'B';
+ } // end of SetEndian
+
+/***********************************************************************/
/* ReadColumn: what this routine does is to access the last line */
/* read from the corresponding table and extract from it the field */
/* corresponding to this column. */
@@ -416,22 +494,40 @@ void BINCOL::ReadColumn(PGLOBAL g)
/*********************************************************************/
/* Set Value from the line field. */
/*********************************************************************/
+ if (Eds) {
+ for (int i = 0; i < Lim; i++)
+ if (Eds == 'B' && Endian == 'L')
+ Buff[i] = p[N - i - 1];
+ else if (Eds == 'L' && Endian == 'B')
+ Buff[M - i - 1] = p[i];
+ else if (Endian == 'B')
+ Buff[M - i - 1] = p[N - i - 1];
+ else
+ Buff[i] = p[i];
+
+ p = Buff;
+ } // endif Eds
+
switch (Fmt) {
case 'X': // Standard not converted values
- Value->SetBinValue(p);
+ if (Eds && IsTypeChar(Buf_Type))
+ Value->SetValue(*(longlong*)p);
+ else
+ Value->SetBinValue(p);
+
break;
case 'S': // Short integer
- Value->SetValue((int)*(short*)p);
+ Value->SetValue(*(short*)p);
break;
case 'T': // Tiny integer
- Value->SetValue((int)*p);
+ Value->SetValue(*p);
break;
- case 'L': // Long Integer
- strcpy(g->Message, "Format L is deprecated, use I");
- longjmp(g->jumper[g->jump_level], 11);
case 'I': // Integer
Value->SetValue(*(int*)p);
break;
+ case 'G': // Large (great) integer
+ Value->SetValue(*(longlong*)p);
+ break;
case 'F': // Float
case 'R': // Real
Value->SetValue((double)*(float*)p);
@@ -483,7 +579,7 @@ void BINCOL::WriteColumn(PGLOBAL g)
if (Value != To_Val)
Value->SetValue_pval(To_Val, false); // Convert the updated value
- p = tdbp->To_Line + Deplac;
+ p = (Eds) ? Buff : tdbp->To_Line + Deplac;
/*********************************************************************/
/* Check whether updating is Ok, meaning col value is not too long. */
@@ -493,11 +589,13 @@ void BINCOL::WriteColumn(PGLOBAL g)
switch (Fmt) {
case 'X':
// Standard not converted values
- if (Value->GetBinValue(p, Long, Status)) {
+ if (Eds && IsTypeChar(Buf_Type))
+ *(longlong *)p = Value->GetBigintValue();
+ else if (Value->GetBinValue(p, Long, Status)) {
sprintf(g->Message, MSG(BIN_F_TOO_LONG),
Name, Value->GetSize(), Long);
longjmp(g->jumper[g->jump_level], 31);
- } // endif Fmt
+ } // endif p
break;
case 'S': // Short integer
@@ -520,9 +618,6 @@ void BINCOL::WriteColumn(PGLOBAL g)
*p = (char)n;
break;
- case 'L': // Long Integer
- strcpy(g->Message, "Format L is deprecated, use I");
- longjmp(g->jumper[g->jump_level], 11);
case 'I': // Integer
n = Value->GetBigintValue();
@@ -533,9 +628,9 @@ void BINCOL::WriteColumn(PGLOBAL g)
*(int *)p = Value->GetIntValue();
break;
- case 'B': // Large (big) integer
+ case 'G': // Large (great) integer
if (Status)
- *(longlong *)p = (longlong)Value->GetBigintValue();
+ *(longlong *)p = Value->GetBigintValue();
break;
case 'F': // Float
@@ -567,6 +662,21 @@ void BINCOL::WriteColumn(PGLOBAL g)
longjmp(g->jumper[g->jump_level], 11);
} // endswitch Fmt
+ if (Eds && Status) {
+ p = tdbp->To_Line + Deplac;
+
+ for (int i = 0; i < Lim; i++)
+ if (Eds == 'B' && Endian == 'L')
+ p[N - i - 1] = Buff[i];
+ else if (Eds == 'L' && Endian == 'B')
+ p[i] = Buff[M - i - 1];
+ else if (Endian == 'B')
+ p[N - i - 1] = Buff[M - i - 1];
+ else
+ p[i] = Buff[i];
+
+ } // endif Eds
+
} // end of WriteColumn
/* ------------------------ End of TabFix ---------------------------- */
diff --git a/storage/connect/tabfix.h b/storage/connect/tabfix.h
index 7d5b964da2a..49956ba0711 100644
--- a/storage/connect/tabfix.h
+++ b/storage/connect/tabfix.h
@@ -1,7 +1,7 @@
/*************** TabDos H Declares Source Code File (.H) ***************/
-/* Name: TABFIX.H Version 2.3 */
+/* Name: TABFIX.H Version 2.4 */
/* */
-/* (C) Copyright to the author Olivier BERTRAND 1999-2012 */
+/* (C) Copyright to the author Olivier BERTRAND 1999-2015 */
/* */
/* This file contains the TDBFIX and (FIX/BIN)COL classes declares. */
/***********************************************************************/
@@ -12,7 +12,7 @@
typedef class FIXCOL *PFIXCOL;
typedef class BINCOL *PBINCOL;
-typedef class TXTFAM *PTXF;
+typedef class TXTFAM *PTXF;
/***********************************************************************/
/* This is the DOS/UNIX Access Method class declaration for files */
@@ -53,7 +53,8 @@ class DllExport TDBFIX : public TDBDOS {
protected:
virtual bool PrepareWriting(PGLOBAL g) {return false;}
- // Members are inherited from TDBDOS
+ // Members
+ char Teds; /* Binary table default endian setting */
}; // end of class TDBFIX
/***********************************************************************/
@@ -68,17 +69,29 @@ class DllExport BINCOL : public DOSCOL {
BINCOL(BINCOL *colp, PTDB tdbp); // Constructor used in copy process
// Implementation
- virtual int GetAmType(void) {return TYPE_AM_BIN;}
+ virtual int GetAmType(void) {return TYPE_AM_BIN;}
+ int GetDeplac(void) {return Deplac;}
+ int GetFileSize(void)
+ {return N ? N : GetTypeSize(Buf_Type, Long);}
// Methods
- virtual void ReadColumn(PGLOBAL g);
- virtual void WriteColumn(PGLOBAL g);
+ virtual void ReadColumn(PGLOBAL g);
+ virtual void WriteColumn(PGLOBAL g);
+
+ // Static
+ static void SetEndian(void);
protected:
BINCOL(void) {} // Default constructor not to be used
// Members
- char Fmt; // The column numeric format
+ static char Endian; // The host endian setting (L or B)
+ char *Buff; // Utility buffer
+ char Eds; // The file endian setting
+ char Fmt; // The converted value format
+ int N; // The number of bytes in the file
+ int M; // The buffer type size
+ int Lim; // Min(N,M)
}; // end of class BINCOL
/***********************************************************************/
diff --git a/storage/connect/tabfmt.cpp b/storage/connect/tabfmt.cpp
index d5f8dc50a89..015f8d93b15 100644
--- a/storage/connect/tabfmt.cpp
+++ b/storage/connect/tabfmt.cpp
@@ -5,7 +5,7 @@
/* */
/* COPYRIGHT: */
/* ---------- */
-/* (C) Copyright to the author Olivier BERTRAND 2001 - 2014 */
+/* (C) Copyright to the author Olivier BERTRAND 2001 - 2015 */
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
@@ -20,7 +20,7 @@
/***********************************************************************/
#include "my_global.h"
-#if defined(WIN32)
+#if defined(__WIN__)
#include <io.h>
#include <fcntl.h>
#include <errno.h>
@@ -102,14 +102,14 @@ PQRYRES CSVColumns(PGLOBAL g, char *dp, const char *fn, char sep,
} // endif info
// num_max = atoi(p+1); // Max num of record to test
-#if defined(WIN32)
+#if defined(__WIN__)
if (sep == ',' || strnicmp(setlocale(LC_NUMERIC, NULL), "French", 6))
dechar = '.';
else
dechar = ',';
-#else // !WIN32
+#else // !__WIN__
dechar = '.';
-#endif // !WIN32
+#endif // !__WIN__
if (trace)
htrc("File %s sep=%c q=%c hdr=%d mxr=%d\n",
@@ -147,7 +147,7 @@ PQRYRES CSVColumns(PGLOBAL g, char *dp, const char *fn, char sep,
if (fgets(buf, sizeof(buf), infile)) {
n = strlen(buf) + 1;
buf[n - 2] = '\0';
-#if defined(UNIX)
+#if !defined(__WIN__)
// The file can be imported from Windows
if (buf[n - 3] == '\r')
buf[n - 3] = 0;
@@ -204,7 +204,7 @@ PQRYRES CSVColumns(PGLOBAL g, char *dp, const char *fn, char sep,
if (fgets(buf, sizeof(buf), infile)) {
n = strlen(buf);
buf[n - 1] = '\0';
-#if defined(UNIX)
+#if !defined(__WIN__)
// The file can be imported from Windows
if (buf[n - 2] == '\r')
buf[n - 2] = 0;
@@ -625,7 +625,7 @@ bool TDBCSV::CheckErr(void)
/***********************************************************************/
/* CSV EstimatedLength. Returns an estimated minimum line length. */
/***********************************************************************/
-int TDBCSV::EstimatedLength(PGLOBAL g)
+int TDBCSV::EstimatedLength(void)
{
int n = 0;
PCOLDEF cdp;
@@ -1118,7 +1118,7 @@ PCOL TDBFMT::MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n)
/* FMT EstimatedLength. Returns an estimated minimum line length. */
/* The big problem here is how can we astimated that minimum ? */
/***********************************************************************/
-int TDBFMT::EstimatedLength(PGLOBAL g)
+int TDBFMT::EstimatedLength(void)
{
// This is rather stupid !!!
return ((PDOSDEF)To_Def)->GetEnding() + (int)((Lrecl / 10) + 1);
diff --git a/storage/connect/tabfmt.h b/storage/connect/tabfmt.h
index 8a1e1f17561..ce80a276cdc 100644
--- a/storage/connect/tabfmt.h
+++ b/storage/connect/tabfmt.h
@@ -75,7 +75,7 @@ class TDBCSV : public TDBDOS {
virtual int ReadBuffer(PGLOBAL g); // Physical file read
// Specific routines
- virtual int EstimatedLength(PGLOBAL g);
+ virtual int EstimatedLength(void);
virtual bool SkipHeader(PGLOBAL g);
virtual bool CheckErr(void);
@@ -157,7 +157,7 @@ class TDBFMT : public TDBCSV {
virtual int ReadBuffer(PGLOBAL g); // Physical file read
// Specific routines
- virtual int EstimatedLength(PGLOBAL g);
+ virtual int EstimatedLength(void);
protected:
virtual bool PrepareWriting(PGLOBAL g)
diff --git a/storage/connect/tabjson.cpp b/storage/connect/tabjson.cpp
index a3c56965794..fafba6228b9 100644
--- a/storage/connect/tabjson.cpp
+++ b/storage/connect/tabjson.cpp
@@ -1,5 +1,5 @@
/************* tabjson C++ Program Source Code File (.CPP) *************/
-/* PROGRAM NAME: tabxjson Version 1.0 */
+/* PROGRAM NAME: tabjson Version 1.1 */
/* (C) Copyright to the author Olivier BERTRAND 2014 - 2015 */
/* This program are the JSON class DB execution routines. */
/***********************************************************************/
@@ -19,7 +19,6 @@
#include "global.h"
#include "plgdbsem.h"
//#include "xtable.h"
-//#include "mycat.h" // for FNC_COL
#include "maputil.h"
#include "filamtxt.h"
#include "tabdos.h"
@@ -31,12 +30,324 @@
#endif // ZIP_SUPPORT
#include "tabmul.h"
#include "checklvl.h"
+#include "resource.h"
+#include "mycat.h" // for FNC_COL
+
+/***********************************************************************/
+/* This should be an option. */
+/***********************************************************************/
+#define MAXCOL 200 /* Default max column nb in result */
+#define TYPE_UNKNOWN 12 /* Must be greater than other types */
/***********************************************************************/
/* External function. */
/***********************************************************************/
USETEMP UseTemp(void);
+typedef struct _jncol {
+ struct _jncol *Next;
+ char *Name;
+ char *Fmt;
+ int Type;
+ int Len;
+ int Scale;
+ bool Cbn;
+ bool Found;
+} JCOL, *PJCL;
+
+/***********************************************************************/
+/* JSONColumns: construct the result blocks containing the description */
+/* of all the columns of a table contained inside a JSON file. */
+/***********************************************************************/
+PQRYRES JSONColumns(PGLOBAL g, char *db, PTOS topt, bool info)
+{
+ static int buftyp[] = {TYPE_STRING, TYPE_SHORT, TYPE_STRING, TYPE_INT,
+ TYPE_INT, TYPE_SHORT, TYPE_SHORT, TYPE_STRING};
+ static XFLD fldtyp[] = {FLD_NAME, FLD_TYPE, FLD_TYPENAME, FLD_PREC,
+ FLD_LENGTH, FLD_SCALE, FLD_NULL, FLD_FORMAT};
+ static unsigned int length[] = {0, 6, 8, 10, 10, 6, 6, 0};
+ char *fn, colname[65], fmt[129];
+ int i, j, lvl, n = 0;
+ int ncol = sizeof(buftyp) / sizeof(int);
+ PVAL valp;
+ JCOL jcol;
+ PJCL jcp, fjcp = NULL, pjcp = NULL;
+ PJPR *jrp, jpp;
+ PJSON jsp;
+ PJVAL jvp;
+ PJOB row;
+ PJDEF tdp;
+ TDBJSN *tjnp = NULL;
+ PJTDB tjsp = NULL;
+ PQRYRES qrp;
+ PCOLRES crp;
+
+ jcol.Name = jcol.Fmt = NULL;
+
+ if (info) {
+ length[0] = 128;
+ length[7] = 256;
+ goto skipit;
+ } // endif info
+
+ /*********************************************************************/
+ /* Open the input file. */
+ /*********************************************************************/
+ if (!(fn = GetStringTableOption(g, topt, "Filename", NULL))) {
+ strcpy(g->Message, MSG(MISSING_FNAME));
+ return NULL;
+ } else {
+ lvl = GetIntegerTableOption(g, topt, "Level", 0);
+ lvl = (lvl < 0) ? 0 : (lvl > 16) ? 16 : lvl;
+ } // endif fn
+
+ tdp = new(g) JSONDEF;
+ tdp->Fn = fn;
+ tdp->Database = SetPath(g, db);
+ tdp->Objname = GetStringTableOption(g, topt, "Object", NULL);
+ tdp->Base = GetIntegerTableOption(g, topt, "Base", 0) ? 1 : 0;
+ tdp->Pretty = GetIntegerTableOption(g, topt, "Pretty", 2);
+
+ if (trace)
+ htrc("File %s objname=%s pretty=%d lvl=%d\n",
+ tdp->Fn, tdp->Objname, tdp->Pretty, lvl);
+
+ if (tdp->Pretty == 2) {
+ tjsp = new(g) TDBJSON(tdp, new(g) MAPFAM(tdp));
+
+ if (tjsp->MakeDocument(g))
+ return NULL;
+
+ jsp = (tjsp->GetDoc()) ? tjsp->GetDoc()->GetValue(0) : NULL;
+ } else {
+ if (!(tdp->Lrecl = GetIntegerTableOption(g, topt, "Lrecl", 0))) {
+ sprintf(g->Message, "LRECL must be specified for pretty=%d", tdp->Pretty);
+ return NULL;
+ } // endif lrecl
+
+ tdp->Ending = GetIntegerTableOption(g, topt, "Ending", CRLF);
+ tjnp = new(g) TDBJSN(tdp, new(g) DOSFAM(tdp));
+ tjnp->SetMode(MODE_READ);
+
+ if (tjnp->OpenDB(g))
+ return NULL;
+
+ switch (tjnp->ReadDB(g)) {
+ case RC_EF:
+ strcpy(g->Message, "Void json table");
+ case RC_FX:
+ goto err;
+ default:
+ jsp = tjnp->GetRow();
+ } // endswitch ReadDB
+
+ } // endif pretty
+
+ if (!(row = (jsp) ? jsp->GetObject() : NULL)) {
+ strcpy(g->Message, "Can only retrieve columns from object rows");
+ goto err;
+ } // endif row
+
+ jcol.Next = NULL;
+ jcol.Found = true;
+ colname[64] = 0;
+ fmt[128] = 0;
+ jrp = (PJPR*)PlugSubAlloc(g, NULL, sizeof(PJPR) * lvl);
+
+ /*********************************************************************/
+ /* Analyse the JSON tree and define columns. */
+ /*********************************************************************/
+ for (i = 1; ; i++) {
+ for (jpp = row->GetFirst(); jpp; jpp = jpp->GetNext()) {
+ for (j = 0; j < lvl; j++)
+ jrp[j] = NULL;
+
+ more:
+ strncpy(colname, jpp->GetKey(), 64);
+ *fmt = 0;
+ j = 0;
+ jvp = jpp->GetVal();
+
+ retry:
+ if ((valp = jvp ? jvp->GetValue() : NULL)) {
+ jcol.Type = valp->GetType();
+ jcol.Len = valp->GetValLen();
+ jcol.Scale = valp->GetValPrec();
+ jcol.Cbn = valp->IsNull();
+ } else if (!jvp || jvp->IsNull()) {
+ jcol.Type = TYPE_UNKNOWN;
+ jcol.Len = jcol.Scale = 0;
+ jcol.Cbn = true;
+ } else if (j < lvl) {
+ if (!*fmt)
+ strcpy(fmt, colname);
+
+ jsp = jvp->GetJson();
+
+ switch (jsp->GetType()) {
+ case TYPE_JOB:
+ if (!jrp[j])
+ jrp[j] = jsp->GetFirst();
+
+ strncat(strncat(fmt, ":", 128), jrp[j]->GetKey(), 128);
+ strncat(strncat(colname, "_", 64), jrp[j]->GetKey(), 64);
+ jvp = jrp[j]->GetVal();
+ j++;
+ break;
+ case TYPE_JAR:
+ strncat(fmt, ":", 128);
+ jvp = jsp->GetValue(0);
+ break;
+ default:
+ sprintf(g->Message, "Logical error after %s", fmt);
+ goto err;
+ } // endswitch jsp
+
+ goto retry;
+ } else {
+ jcol.Type = TYPE_STRING;
+ jcol.Len = 256;
+ jcol.Scale = 0;
+ jcol.Cbn = true;
+ } // endif's
+
+ // Check whether this column was already found
+ for (jcp = fjcp; jcp; jcp = jcp->Next)
+ if (!strcmp(colname, jcp->Name))
+ break;
+
+ if (jcp) {
+ if (jcp->Type != jcol.Type)
+ jcp->Type = TYPE_STRING;
+
+ if (*fmt && (!jcp->Fmt || strlen(jcp->Fmt) < strlen(fmt))) {
+ jcp->Fmt = PlugDup(g, fmt);
+ length[7] = MY_MAX(length[7], strlen(fmt));
+ } // endif *fmt
+
+ jcp->Len = MY_MAX(jcp->Len, jcol.Len);
+ jcp->Scale = MY_MAX(jcp->Scale, jcol.Scale);
+ jcp->Cbn |= jcol.Cbn;
+ jcp->Found = true;
+ } else {
+ // New column
+ jcp = (PJCL)PlugSubAlloc(g, NULL, sizeof(JCOL));
+ *jcp = jcol;
+ jcp->Cbn |= (i > 1);
+ jcp->Name = PlugDup(g, colname);
+ length[0] = MY_MAX(length[0], strlen(colname));
+
+ if (*fmt) {
+ jcp->Fmt = PlugDup(g, fmt);
+ length[7] = MY_MAX(length[7], strlen(fmt));
+ } else
+ jcp->Fmt = NULL;
+
+ if (pjcp) {
+ jcp->Next = pjcp->Next;
+ pjcp->Next = jcp;
+ } else
+ fjcp = jcp;
+
+ n++;
+ } // endif jcp
+
+ pjcp = jcp;
+
+ for (j = lvl - 1; j >= 0; j--)
+ if (jrp[j] && (jrp[j] = jrp[j]->GetNext()))
+ goto more;
+
+ } // endfor jpp
+
+ // Missing column can be null
+ for (jcp = fjcp; jcp; jcp = jcp->Next) {
+ jcp->Cbn |= !jcp->Found;
+ jcp->Found = false;
+ } // endfor jcp
+
+ if (tdp->Pretty != 2) {
+ // Read next record
+ switch (tjnp->ReadDB(g)) {
+ case RC_EF:
+ jsp = NULL;
+ break;
+ case RC_FX:
+ goto err;
+ default:
+ jsp = tjnp->GetRow();
+ } // endswitch ReadDB
+
+ } else
+ jsp = tjsp->GetDoc()->GetValue(i);
+
+ if (!(row = (jsp) ? jsp->GetObject() : NULL))
+ break;
+
+ } // endor i
+
+ if (tdp->Pretty != 2)
+ tjnp->CloseDB(g);
+
+ skipit:
+ if (trace)
+ htrc("CSVColumns: n=%d len=%d\n", n, length[0]);
+
+ /*********************************************************************/
+ /* Allocate the structures used to refer to the result set. */
+ /*********************************************************************/
+ qrp = PlgAllocResult(g, ncol, n, IDS_COLUMNS + 3,
+ buftyp, fldtyp, length, false, false);
+
+ crp = qrp->Colresp->Next->Next->Next->Next->Next->Next;
+ crp->Name = "Nullable";
+ crp->Next->Name = "Jpath";
+
+ if (info || !qrp)
+ return qrp;
+
+ qrp->Nblin = n;
+
+ /*********************************************************************/
+ /* Now get the results into blocks. */
+ /*********************************************************************/
+ for (i = 0, jcp = fjcp; jcp; i++, jcp = jcp->Next) {
+ if (jcp->Type == TYPE_UNKNOWN) // Void column
+ jcp->Type = TYPE_STRING;
+
+ crp = qrp->Colresp; // Column Name
+ crp->Kdata->SetValue(jcp->Name, i);
+ crp = crp->Next; // Data Type
+ crp->Kdata->SetValue(jcp->Type, i);
+ crp = crp->Next; // Type Name
+ crp->Kdata->SetValue(GetTypeName(jcp->Type), i);
+ crp = crp->Next; // Precision
+ crp->Kdata->SetValue(jcp->Len, i);
+ crp = crp->Next; // Length
+ crp->Kdata->SetValue(jcp->Len, i);
+ crp = crp->Next; // Scale (precision)
+ crp->Kdata->SetValue(jcp->Scale, i);
+ crp = crp->Next; // Nullable
+ crp->Kdata->SetValue(jcp->Cbn ? 1 : 0, i);
+ crp = crp->Next; // Field format
+
+ if (crp->Kdata)
+ crp->Kdata->SetValue(jcp->Fmt, i);
+
+ } // endfor i
+
+ /*********************************************************************/
+ /* Return the result pointer. */
+ /*********************************************************************/
+ return qrp;
+
+err:
+ if (tdp->Pretty != 2)
+ tjnp->CloseDB(g);
+
+ return NULL;
+ } // end of JSONColumns
+
/* -------------------------- Class JSONDEF -------------------------- */
JSONDEF::JSONDEF(void)
@@ -44,20 +355,23 @@ JSONDEF::JSONDEF(void)
Jmode = MODE_OBJECT;
Objname = NULL;
Xcol = NULL;
+ Pretty = 2;
Limit = 1;
- ReadMode = 0;
+ Base = 0;
+ Strict = false;
} // end of JSONDEF constructor
/***********************************************************************/
/* DefineAM: define specific AM block values. */
/***********************************************************************/
-bool JSONDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
+bool JSONDEF::DefineAM(PGLOBAL g, LPCSTR, int poff)
{
Jmode = (JMODE)GetIntCatInfo("Jmode", MODE_OBJECT);
Objname = GetStringCatInfo(g, "Object", NULL);
Xcol = GetStringCatInfo(g, "Expand", NULL);
Pretty = GetIntCatInfo("Pretty", 2);
Limit = GetIntCatInfo("Limit", 10);
+ Base = GetIntCatInfo("Base", 0) ? 1 : 0;
return DOSDEF::DefineAM(g, "DOS", poff);
} // end of DefineAM
@@ -66,6 +380,9 @@ bool JSONDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
/***********************************************************************/
PTDB JSONDEF::GetTable(PGLOBAL g, MODE m)
{
+ if (Catfunc == FNC_COL)
+ return new(g)TDBJCL(this);
+
PTDBASE tdbp;
PTXF txfp = NULL;
@@ -95,7 +412,7 @@ PTDB JSONDEF::GetTable(PGLOBAL g, MODE m)
// Txfp must be set for TDBDOS
tdbp = new(g) TDBJSN(this, txfp);
} else {
- txfp = new(g) DOSFAM(this);
+ txfp = new(g) MAPFAM(this);
tdbp = new(g) TDBJSON(this, txfp);
} // endif Pretty
@@ -112,37 +429,57 @@ PTDB JSONDEF::GetTable(PGLOBAL g, MODE m)
/***********************************************************************/
TDBJSN::TDBJSN(PJDEF tdp, PTXF txfp) : TDBDOS(tdp, txfp)
{
+ Top = NULL;
Row = NULL;
+ Val = NULL;
Colp = NULL;
- Jmode = tdp->Jmode;
- Xcol = tdp->Xcol;
+
+ if (tdp) {
+ Jmode = tdp->Jmode;
+ Objname = tdp->Objname;
+ Xcol = tdp->Xcol;
+ Limit = tdp->Limit;
+ Pretty = tdp->Pretty;
+ B = tdp->Base ? 1 : 0;
+ Strict = tdp->Strict;
+ } else {
+ Jmode = MODE_OBJECT;
+ Objname = NULL;
+ Xcol = NULL;
+ Limit = 1;
+ Pretty = 0;
+ B = 0;
+ Strict = false;
+ } // endif tdp
+
Fpos = -1;
- Spos = N = 0;
- Limit = tdp->Limit;
- Pretty = tdp->Pretty;
- Strict = tdp->Strict;
- NextSame = false;
- Comma = false;
+ N = M = 0;
+ NextSame = 0;
SameRow = 0;
Xval = -1;
+ Comma = false;
} // end of TDBJSN standard constructor
TDBJSN::TDBJSN(TDBJSN *tdbp) : TDBDOS(NULL, tdbp)
{
+ Top = tdbp->Top;
Row = tdbp->Row;
+ Val = tdbp->Val;
Colp = tdbp->Colp;
Jmode = tdbp->Jmode;
+ Objname = tdbp->Objname;
Xcol = tdbp->Xcol;
Fpos = tdbp->Fpos;
- Spos = tdbp->Spos;
N = tdbp->N;
+ M = tdbp->M;
Limit = tdbp->Limit;
- Pretty = tdbp->Pretty;
- Strict = tdbp->Strict;
NextSame = tdbp->NextSame;
- Comma = tdbp->Comma;
SameRow = tdbp->SameRow;
Xval = tdbp->Xval;
+ B = tdbp->B;
+ Pretty = tdbp->Pretty;
+ Strict = tdbp->Strict;
+ Comma = tdbp->Comma;
} // end of TDBJSN copy constructor
// Used for update
@@ -175,7 +512,7 @@ PCOL TDBJSN::MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n)
/***********************************************************************/
/* InsertSpecialColumn: Put a special column ahead of the column list.*/
/***********************************************************************/
-PCOL TDBJSN::InsertSpecialColumn(PGLOBAL g, PCOL colp)
+PCOL TDBJSN::InsertSpecialColumn(PCOL colp)
{
if (!colp->IsSpecial())
return NULL;
@@ -213,6 +550,34 @@ int TDBJSN::GetMaxSize(PGLOBAL g)
} // end of GetMaxSize
/***********************************************************************/
+/* Find the row in the tree structure. */
+/***********************************************************************/
+PJSON TDBJSN::FindRow(PGLOBAL g)
+{
+ char *p, *objpath;
+ PJSON jsp = Row;
+ PJVAL val = NULL;
+
+ for (objpath = PlugDup(g, Objname); jsp && objpath; objpath = p) {
+ if ((p = strchr(objpath, ':')))
+ *p++ = 0;
+
+ if (*objpath != '[') { // objpass is a key
+ val = (jsp->GetType() == TYPE_JOB) ?
+ jsp->GetObject()->GetValue(objpath) : NULL;
+ } else if (objpath[strlen(objpath)-1] == ']') {
+ val = (jsp->GetType() == TYPE_JAR) ?
+ jsp->GetArray()->GetValue(atoi(objpath+1) - B) : NULL;
+ } else
+ val = NULL;
+
+ jsp = (val) ? val->GetJson() : NULL;
+ } // endfor objpath
+
+ return jsp;
+} // end of FindRow
+
+/***********************************************************************/
/* OpenDB: Data Base open routine for JSN access method. */
/***********************************************************************/
bool TDBJSN::OpenDB(PGLOBAL g)
@@ -221,14 +586,8 @@ bool TDBJSN::OpenDB(PGLOBAL g)
/*******************************************************************/
/* Table already open replace it at its beginning. */
/*******************************************************************/
- for (PJCOL cp = (PJCOL)Columns; cp; cp = (PJCOL)cp->GetNext()) {
- cp->Nx = 0;
- cp->Arp = NULL;
- } // endfor cp
-
Fpos= -1;
- Spos = 0;
- NextSame = false;
+ NextSame = 0;
SameRow = 0;
} else {
/*******************************************************************/
@@ -264,11 +623,11 @@ bool TDBJSN::SkipHeader(PGLOBAL g)
return true;
#endif // _DEBUG
-#if defined(WIN32)
+#if defined(__WIN__)
#define Ending 2
-#else // !WIN32
+#else // !__WIN__
#define Ending 1
-#endif // !WIN32
+#endif // !__WIN__
if (Pretty == 1) {
if (Mode == MODE_INSERT || Mode == MODE_DELETE) {
@@ -292,7 +651,9 @@ int TDBJSN::ReadDB(PGLOBAL g)
N++;
if (NextSame) {
- SameRow++;
+ SameRow = NextSame;
+ NextSame = 0;
+ M++;
return RC_OK;
} else if ((rc = TDBDOS::ReadDB(g)) == RC_OK)
if (!IsRead() && ((rc = ReadBuffer(g)) != RC_OK)) {
@@ -301,8 +662,10 @@ int TDBJSN::ReadDB(PGLOBAL g)
strlen(To_Line), Pretty, &Comma))) {
rc = (Pretty == 1 && !strcmp(To_Line, "]")) ? RC_EF : RC_FX;
} else {
+ Row = FindRow(g);
SameRow = 0;
Fpos++;
+ M = 1;
rc = RC_OK;
} // endif's
@@ -310,19 +673,85 @@ int TDBJSN::ReadDB(PGLOBAL g)
} // end of ReadDB
/***********************************************************************/
+/* Make the top tree from the object path. */
+/***********************************************************************/
+int TDBJSN::MakeTopTree(PGLOBAL g, PJSON jsp)
+ {
+ if (Objname) {
+ if (!Val) {
+ // Parse and allocate Objname item(s)
+ char *p;
+ char *objpath = PlugDup(g, Objname);
+ int i;
+ PJOB objp;
+ PJAR arp;
+ PJVAL val = NULL;
+
+ Top = NULL;
+
+ for (; objpath; objpath = p) {
+ if ((p = strchr(objpath, ':')))
+ *p++ = 0;
+
+ if (*objpath != '[') {
+ objp = new(g) JOBJECT;
+
+ if (!Top)
+ Top = objp;
+
+ if (val)
+ val->SetValue(objp);
+
+ val = new(g) JVALUE;
+ objp->SetValue(g, val, objpath);
+ } else if (objpath[strlen(objpath)-1] == ']') {
+ arp = new(g) JARRAY;
+
+ if (!Top)
+ Top = arp;
+
+ if (val)
+ val->SetValue(arp);
+
+ val = new(g) JVALUE;
+ i = atoi(objpath+1) - B;
+ arp->SetValue(g, val, i);
+ arp->InitArray(g);
+ } else {
+ sprintf(g->Message, "Invalid Table path %s", Objname);
+ return RC_FX;
+ } // endif objpath
+
+ } // endfor p
+
+ Val = val;
+ } // endif Val
+
+ Val->SetValue(jsp);
+ } else
+ Top = jsp;
+
+ return RC_OK;
+ } // end of MakeTopTree
+
+/***********************************************************************/
/* PrepareWriting: Prepare the line for WriteDB. */
/***********************************************************************/
bool TDBJSN::PrepareWriting(PGLOBAL g)
{
- PSZ s = Serialize(g, Row, NULL, Pretty);
+ PSZ s;
- if (s) {
+ if (MakeTopTree(g, Row))
+ return true;
+
+ if ((s = Serialize(g, Top, NULL, Pretty))) {
if (Comma)
strcat(s, ",");
if ((signed)strlen(s) > Lrecl) {
- sprintf(g->Message, "Line would be truncated (lrecl=%d)", Lrecl);
- return true;
+ strncpy(To_Line, s, Lrecl);
+ sprintf(g->Message, "Line truncated (lrecl=%d)", Lrecl);
+ return PushWarning(g, this);
} else
strcpy(To_Line, s);
@@ -333,21 +762,20 @@ int TDBJSN::ReadDB(PGLOBAL g)
} // end of PrepareWriting
-/* ----------------------------- JSNCOL ------------------------------- */
+/* ---------------------------- JSONCOL ------------------------------ */
/***********************************************************************/
-/* JSNCOL public constructor. */
+/* JSONCOL public constructor. */
/***********************************************************************/
JSONCOL::JSONCOL(PGLOBAL g, PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i)
: DOSCOL(g, cdp, tdbp, cprec, i, "DOS")
{
Tjp = (TDBJSN *)(tdbp->GetOrig() ? tdbp->GetOrig() : tdbp);
- Arp = NULL;
Jpath = cdp->GetFmt();
MulVal = NULL;
Nodes = NULL;
- Nod = Nx =0;
- Ival = -1;
+ Nod = 0;
+ Xnod = -1;
Xpd = false;
Parsed = false;
} // end of JSONCOL constructor
@@ -359,13 +787,11 @@ JSONCOL::JSONCOL(PGLOBAL g, PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i)
JSONCOL::JSONCOL(JSONCOL *col1, PTDB tdbp) : DOSCOL(col1, tdbp)
{
Tjp = col1->Tjp;
- Arp = col1->Arp;
Jpath = col1->Jpath;
MulVal = col1->MulVal;
Nodes = col1->Nodes;
Nod = col1->Nod;
- Ival = col1->Ival;
- Nx = col1->Nx;
+ Xnod = col1->Xnod;
Xpd = col1->Xpd;
Parsed = col1->Parsed;
} // end of JSONCOL copy constructor
@@ -387,17 +813,16 @@ bool JSONCOL::SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check)
} // end of SetBuffer
/***********************************************************************/
-/* Analyse array processing options. */
+/* Check whether this object is expanded. */
/***********************************************************************/
bool JSONCOL::CheckExpand(PGLOBAL g, int i, PSZ nm, bool b)
{
- if (Tjp->Xcol && nm && !strcmp(nm, Tjp->Xcol) &&
- (Tjp->Xval < 0 || Tjp->Xval == i)) {
+ if ((Tjp->Xcol && nm && !strcmp(nm, Tjp->Xcol) &&
+ (Tjp->Xval < 0 || Tjp->Xval == i)) || Xpd) {
Xpd = true; // Expandable object
- Nodes[i].Op = OP_XX;
- Tjp->Xval = i;
+ Nodes[i].Op = OP_EXP;
} else if (b) {
- strcpy(g->Message, "Cannot expand more than one array");
+ strcpy(g->Message, "Cannot expand more than one branch");
return true;
} // endif Xcol
@@ -410,7 +835,7 @@ bool JSONCOL::CheckExpand(PGLOBAL g, int i, PSZ nm, bool b)
bool JSONCOL::SetArrayOptions(PGLOBAL g, char *p, int i, PSZ nm)
{
int n = (int)strlen(p);
- bool dg = true;
+ bool dg = true, b = false;
PJNODE jnp = &Nodes[i];
if (*p) {
@@ -424,7 +849,8 @@ bool JSONCOL::SetArrayOptions(PGLOBAL g, char *p, int i, PSZ nm)
return true;
} // endif p
- } // endif *p
+ } else
+ b = true;
// To check whether a numeric Rank was specified
for (int k = 0; dg && p[k]; k++)
@@ -434,21 +860,23 @@ bool JSONCOL::SetArrayOptions(PGLOBAL g, char *p, int i, PSZ nm)
// Default specifications
if (CheckExpand(g, i, nm, false))
return true;
- else if (jnp->Op != OP_XX)
- if (!Value->IsTypeNum()) {
+ else if (jnp->Op != OP_EXP) {
+ if (b) {
+ // Return 1st value (B is the index base)
+ jnp->Rank = Tjp->B;
+ jnp->Op = OP_EQ;
+ } else if (!Value->IsTypeNum()) {
jnp->CncVal = AllocateValue(g, (void*)", ", TYPE_STRING);
jnp->Op = OP_CNC;
} else
jnp->Op = OP_ADD;
- } else if (dg) {
- if (atoi(p) > 0) {
- // Return nth value
- jnp->Rank = atoi(p);
- jnp->Op = OP_EQ;
- } else // Ignore array
- jnp->Op = OP_NULL;
+ } // endif OP
+ } else if (dg) {
+ // Return nth value
+ jnp->Rank = atoi(p) - Tjp->B;
+ jnp->Op = OP_EQ;
} else if (n == 1) {
// Set the Op value;
switch (*p) {
@@ -456,13 +884,13 @@ bool JSONCOL::SetArrayOptions(PGLOBAL g, char *p, int i, PSZ nm)
case '*': jnp->Op = OP_MULT; break;
case '>': jnp->Op = OP_MAX; break;
case '<': jnp->Op = OP_MIN; break;
- case '#': jnp->Op = OP_NUM; break;
case '!': jnp->Op = OP_SEP; break; // Average
+ case '#': jnp->Op = OP_NUM; break;
case 'x':
case 'X': // Expand this array
if (!Tjp->Xcol && nm) {
Xpd = true;
- jnp->Op = OP_XX;
+ jnp->Op = OP_EXP;
Tjp->Xval = i;
Tjp->Xcol = nm;
} else if (CheckExpand(g, i, nm, true))
@@ -490,6 +918,38 @@ bool JSONCOL::SetArrayOptions(PGLOBAL g, char *p, int i, PSZ nm)
return true;
} // endif's
+ // For calculated arrays, a local Value must be used
+ switch (jnp->Op) {
+ case OP_NUM:
+ jnp->Valp = AllocateValue(g, TYPE_INT);
+ break;
+ case OP_ADD:
+ case OP_MULT:
+ case OP_SEP:
+ if (!IsTypeChar(Buf_Type))
+ jnp->Valp = AllocateValue(g, Buf_Type, 0, GetPrecision());
+ else
+ jnp->Valp = AllocateValue(g, TYPE_DOUBLE, 0, 2);
+
+ break;
+ case OP_MIN:
+ case OP_MAX:
+ jnp->Valp = AllocateValue(g, Buf_Type, Long, GetPrecision());
+ break;
+ case OP_CNC:
+ if (IsTypeChar(Buf_Type))
+ jnp->Valp = AllocateValue(g, TYPE_STRING, Long, GetPrecision());
+ else
+ jnp->Valp = AllocateValue(g, TYPE_STRING, 512);
+
+ break;
+ default:
+ break;
+ } // endswitch Op
+
+ if (jnp->Valp)
+ MulVal = AllocateValue(g, jnp->Valp);
+
return false;
} // end of SetArrayOptions
@@ -512,8 +972,21 @@ bool JSONCOL::ParseJpath(PGLOBAL g)
else if (!Jpath)
Jpath = Name;
- pbuf = (char*)PlugSubAlloc(g, NULL, strlen(Jpath) + 1);
- strcpy(pbuf, Jpath);
+ if (To_Tdb->GetOrig()) {
+ // This is an updated column, get nodes from origin
+ for (PJCOL colp = (PJCOL)Tjp->GetColumns(); colp;
+ colp = (PJCOL)colp->GetNext())
+ if (!stricmp(Name, colp->GetName())) {
+ Nod = colp->Nod;
+ Nodes = colp->Nodes;
+ goto fin;
+ } // endif Name
+
+ sprintf(g->Message, "Cannot parse updated column %s", Name);
+ return true;
+ } // endif To_Orig
+
+ pbuf = PlugDup(g, Jpath);
// The Jpath must be analyzed
for (i = 0, p = pbuf; (p = strchr(p, ':')); i++, p++)
@@ -533,6 +1006,9 @@ bool JSONCOL::ParseJpath(PGLOBAL g)
if (SetArrayOptions(g, p, i, Nodes[i-1].Key))
return true;
+ } else if (*p == '*') {
+ // Return JSON
+ Nodes[i].Op = OP_XX;
} else {
Nodes[i].Key = p;
Nodes[i].Op = OP_EXIST;
@@ -540,48 +1016,57 @@ bool JSONCOL::ParseJpath(PGLOBAL g)
} // endfor i, p
+ fin:
MulVal = AllocateValue(g, Value);
Parsed = true;
return false;
} // end of ParseJpath
/***********************************************************************/
+/* MakeJson: Serialize the json item and set value to it. */
+/***********************************************************************/
+PVAL JSONCOL::MakeJson(PGLOBAL g, PJSON jsp)
+ {
+ if (Value->IsTypeNum()) {
+ strcpy(g->Message, "Cannot make Json for a numeric column");
+ Value->Reset();
+ } else
+ Value->SetValue_psz(Serialize(g, jsp, NULL, 0));
+
+ return Value;
+ } // end of MakeJson
+
+/***********************************************************************/
/* SetValue: Set a value from a JVALUE contains. */
/***********************************************************************/
void JSONCOL::SetJsonValue(PGLOBAL g, PVAL vp, PJVAL val, int n)
{
if (val) {
- if (Nodes[n].Op == OP_NUM)
- vp->SetValue(1);
- else {
- again:
- switch (val->GetValType()) {
- case TYPE_STRG:
- case TYPE_INTG:
- case TYPE_DBL:
- vp->SetValue_pval(val->GetValue());
- break;
- case TYPE_BOOL:
- if (vp->IsTypeNum())
- vp->SetValue(val->GetInteger() ? 1 : 0);
- else
- vp->SetValue_psz((PSZ)(val->GetInteger() ? "true" : "false"));
-
+ switch (val->GetValType()) {
+ case TYPE_STRG:
+ case TYPE_INTG:
+ case TYPE_DBL:
+ vp->SetValue_pval(val->GetValue());
+ break;
+ case TYPE_BOOL:
+ if (vp->IsTypeNum())
+ vp->SetValue(val->GetInteger() ? 1 : 0);
+ else
+ vp->SetValue_psz((PSZ)(val->GetInteger() ? "true" : "false"));
+
+ break;
+ case TYPE_JAR:
+ SetJsonValue(g, vp, val->GetArray()->GetValue(0), n);
+ break;
+ case TYPE_JOB:
+// if (!vp->IsTypeNum() || !Strict) {
+ vp->SetValue_psz(val->GetObject()->GetText(g, NULL));
break;
- case TYPE_JAR:
- val = val->GetArray()->GetValue(0);
- goto again;
- case TYPE_JOB:
- if (!vp->IsTypeNum()) {
- vp->SetValue_psz(val->GetObject()->GetText(g));
- break;
- } // endif Type
+// } // endif Type
- default:
- vp->Reset();
- } // endswitch Type
-
- } // endelse
+ default:
+ vp->Reset();
+ } // endswitch Type
} else
vp->Reset();
@@ -589,16 +1074,210 @@ void JSONCOL::SetJsonValue(PGLOBAL g, PVAL vp, PJVAL val, int n)
} // end of SetJsonValue
/***********************************************************************/
+/* ReadColumn: */
+/***********************************************************************/
+void JSONCOL::ReadColumn(PGLOBAL g)
+ {
+ if (!Tjp->SameRow || Xnod >= Tjp->SameRow)
+ Value->SetValue_pval(GetColumnValue(g, Tjp->Row, 0));
+
+ // Set null when applicable
+ if (Nullable)
+ Value->SetNull(Value->IsZero());
+
+ } // end of ReadColumn
+
+/***********************************************************************/
+/* GetColumnValue: */
+/***********************************************************************/
+PVAL JSONCOL::GetColumnValue(PGLOBAL g, PJSON row, int i)
+ {
+ int n = Nod - 1;
+ bool expd = false;
+ PJAR arp;
+ PJVAL val = NULL;
+
+ for (; i < Nod && row; i++) {
+ if (Nodes[i].Op == OP_NUM) {
+ Value->SetValue(row->GetType() == TYPE_JAR ? row->size() : 1);
+ return(Value);
+ } else if (Nodes[i].Op == OP_XX) {
+ return MakeJson(g, row);
+ } else switch (row->GetType()) {
+ case TYPE_JOB:
+ if (!Nodes[i].Key) {
+ // Expected Array was not there
+ if (i < Nod-1)
+ continue;
+ else
+ val = new(g) JVALUE(row);
+
+ } else
+ val = ((PJOB)row)->GetValue(Nodes[i].Key);
+
+ break;
+ case TYPE_JAR:
+ arp = (PJAR)row;
+
+ if (!Nodes[i].Key) {
+ if (Nodes[i].Op == OP_EQ)
+ val = arp->GetValue(Nodes[i].Rank);
+ else if (Nodes[i].Op == OP_EXP)
+ return ExpandArray(g, arp, i);
+ else
+ return CalculateArray(g, arp, i);
+
+ } else if (i < Nod-1) {
+ strcpy(g->Message, "Unexpected array");
+ val = NULL; // Not an expected array
+ } else
+ val = arp->GetValue(0);
+
+ break;
+ case TYPE_JVAL:
+ val = (PJVAL)row;
+ break;
+ default:
+ sprintf(g->Message, "Invalid row JSON type %d", row->GetType());
+ val = NULL;
+ } // endswitch Type
+
+ if (i < Nod-1)
+ row = (val) ? val->GetJson() : NULL;
+
+ } // endfor i
+
+ SetJsonValue(g, Value, val, n);
+ return Value;
+ } // end of GetColumnValue
+
+/***********************************************************************/
+/* ExpandArray: */
+/***********************************************************************/
+PVAL JSONCOL::ExpandArray(PGLOBAL g, PJAR arp, int n)
+ {
+ int ars;
+ PJVAL jvp;
+ JVALUE jval;
+
+ ars = MY_MIN(Tjp->Limit, arp->size());
+
+ if (!(jvp = arp->GetValue((Nodes[n].Rx = Nodes[n].Nx)))) {
+ strcpy(g->Message, "Logical error expanding array");
+ longjmp(g->jumper[g->jump_level], 666);
+ } // endif jvp
+
+ if (n < Nod - 1 && jvp->GetJson()) {
+ jval.SetValue(GetColumnValue(g, jvp->GetJson(), n + 1));
+ jvp = &jval;
+ } // endif n
+
+ if (n >= Tjp->NextSame) {
+ if (++Nodes[n].Nx == ars) {
+ Nodes[n].Nx = 0;
+ Xnod = 0;
+ } else
+ Xnod = n;
+
+ Tjp->NextSame = Xnod;
+ } // endif NextSame
+
+ SetJsonValue(g, Value, jvp, n);
+ return Value;
+ } // end of ExpandArray
+
+/***********************************************************************/
+/* CalculateArray: */
+/***********************************************************************/
+PVAL JSONCOL::CalculateArray(PGLOBAL g, PJAR arp, int n)
+ {
+ int i, ars, nv = 0, nextsame = Tjp->NextSame;
+ bool err;
+ OPVAL op = Nodes[n].Op;
+ PVAL val[2], vp = Nodes[n].Valp;
+ PJVAL jvrp, jvp;
+ JVALUE jval;
+
+ vp->Reset();
+ ars = MY_MIN(Tjp->Limit, arp->size());
+
+ for (i = 0; i < ars; i++) {
+ jvrp = arp->GetValue(i);
+
+ do {
+ if (n < Nod - 1 && jvrp->GetJson()) {
+ Tjp->NextSame = nextsame;
+ jval.SetValue(GetColumnValue(g, jvrp->GetJson(), n + 1));
+ jvp = &jval;
+ } else
+ jvp = jvrp;
+
+ if (!nv++) {
+ SetJsonValue(g, vp, jvp, n);
+ continue;
+ } else
+ SetJsonValue(g, MulVal, jvp, n);
+
+ if (!MulVal->IsZero()) {
+ switch (op) {
+ case OP_CNC:
+ if (Nodes[n].CncVal) {
+ val[0] = Nodes[n].CncVal;
+ err = vp->Compute(g, val, 1, op);
+ } // endif CncVal
+
+ val[0] = MulVal;
+ err = vp->Compute(g, val, 1, op);
+ break;
+// case OP_NUM:
+ case OP_SEP:
+ val[0] = Nodes[n].Valp;
+ val[1] = MulVal;
+ err = vp->Compute(g, val, 2, OP_ADD);
+ break;
+ default:
+ val[0] = Nodes[n].Valp;
+ val[1] = MulVal;
+ err = vp->Compute(g, val, 2, op);
+ } // endswitch Op
+
+ if (err)
+ vp->Reset();
+
+ } // endif Zero
+
+ } while (Tjp->NextSame > nextsame);
+
+ } // endfor i
+
+ if (op == OP_SEP) {
+ // Calculate average
+ MulVal->SetValue(nv);
+ val[0] = vp;
+ val[1] = MulVal;
+
+ if (vp->Compute(g, val, 2, OP_DIV))
+ vp->Reset();
+
+ } // endif Op
+
+ Tjp->NextSame = nextsame;
+ return vp;
+ } // end of CalculateArray
+
+/***********************************************************************/
/* GetRow: Get the object containing this column. */
/***********************************************************************/
-PJSON JSONCOL::GetRow(PGLOBAL g, int mode)
+PJSON JSONCOL::GetRow(PGLOBAL g)
{
- PJVAL val;
+ PJVAL val = NULL;
PJAR arp;
PJSON nwr, row = Tjp->Row;
for (int i = 0; i < Nod-1 && row; i++) {
- switch (row->GetType()) {
+ if (Nodes[i+1].Op == OP_XX)
+ break;
+ else switch (row->GetType()) {
case TYPE_JOB:
if (!Nodes[i].Key)
// Expected Array was not there
@@ -608,24 +1287,12 @@ PJSON JSONCOL::GetRow(PGLOBAL g, int mode)
break;
case TYPE_JAR:
if (!Nodes[i].Key) {
- if (Nodes[i].Op != OP_NULL) {
- Ival = i;
- arp = (PJAR)row;
+ arp = (PJAR)row;
- if (mode < 2) // First pass
- Arp = arp;
-
- if (Nodes[i].Op != OP_XX) {
- if (Nodes[i].Rank)
- val = arp->GetValue(Nodes[i].Rank - 1);
- else
- val = arp->GetValue(arp == Arp ? Nx : 0);
-
- } else
- val = arp->GetValue(Tjp->SameRow);
-
- } else
- val = NULL;
+ if (Nodes[i].Op == OP_EQ)
+ val = arp->GetValue(Nodes[i].Rank);
+ else
+ val = arp->GetValue(Nodes[i].Rx);
} else {
strcpy(g->Message, "Unexpected array");
@@ -643,15 +1310,16 @@ PJSON JSONCOL::GetRow(PGLOBAL g, int mode)
if (val) {
row = val->GetJson();
- } else if (mode == 1) { // mode write
+ } else {
// Construct missing objects
for (i++; row && i < Nod; i++) {
- if (!Nodes[i].Key) {
+ if (Nodes[i].Op == OP_XX)
+ break;
+ else if (!Nodes[i].Key)
// Construct intermediate array
nwr = new(g) JARRAY;
- } else {
+ else
nwr = new(g) JOBJECT;
- } // endif Nodes
if (row->GetType() == TYPE_JOB) {
((PJOB)row)->SetValue(g, new(g) JVALUE(nwr), Nodes[i-1].Key);
@@ -667,8 +1335,7 @@ PJSON JSONCOL::GetRow(PGLOBAL g, int mode)
} // endfor i
break;
- } else
- row = NULL;
+ } // endelse
} // endfor i
@@ -676,131 +1343,6 @@ PJSON JSONCOL::GetRow(PGLOBAL g, int mode)
} // end of GetRow
/***********************************************************************/
-/* ReadColumn: */
-/***********************************************************************/
-void JSONCOL::ReadColumn(PGLOBAL g)
- {
- int mode = 0, n = Nod - 1;
- PJSON row;
- PJVAL val = NULL;
-
- evenmore:
- row = GetRow(g, mode);
-
- more:
- if (row) switch (row->GetType()) {
- case TYPE_JOB:
- if (Nodes[n].Key)
- val = row->GetValue(Nodes[n].Key);
- else
- val = new(g) JVALUE(row);
-
- break;
- case TYPE_JAR:
- // Multiple column ?
- if (Nodes[n].Op != OP_NULL) {
- Arp = (PJAR)row;
- val = Arp->GetValue(Nodes[n].Rank > 0 ?
- Nodes[n].Rank - 1 :
- Nodes[n].Op == OP_XX ? Tjp->SameRow : Nx);
- Ival = n;
- } else
- val = NULL;
-
- break;
- case TYPE_JVAL:
- val = (PJVAL)row;
- break;
- default:
- sprintf(g->Message, "Wrong return value type %d", row->GetType());
- Value->Reset();
- return;
- } // endswitch Type
-
- if (!Nx /*|| (Xpd)*/)
- SetJsonValue(g, Value, val, n);
-
- if (Arp) {
- // Multiple column
- int ars = (Nodes[Ival].Rank > 0) ? 1 : MY_MIN(Tjp->Limit, Arp->size());
-
- if (Nodes[Ival].Op == OP_XX) {
- if (ars > Tjp->SameRow + 1)
- Tjp->NextSame = true; // More to come
- else {
- Tjp->NextSame = false;
- Arp = NULL;
- } // endelse
-
- } else {
- if (Nx && val) {
- SetJsonValue(g, MulVal, val, Ival);
-
- if (!MulVal->IsZero()) {
- PVAL val[2];
- bool err;
-
- switch (Nodes[Ival].Op) {
- case OP_CNC:
- if (Nodes[Ival].CncVal) {
- val[0] = Nodes[Ival].CncVal;
- err = Value->Compute(g, val, 1, Nodes[Ival].Op);
- } // endif CncVal
-
- val[0] = MulVal;
- err = Value->Compute(g, val, 1, Nodes[Ival].Op);
- break;
- case OP_NUM:
- case OP_SEP:
- val[0] = Value;
- val[1] = MulVal;
- err = Value->Compute(g, val, 2, OP_ADD);
- break;
- default:
- val[0] = Value;
- val[1] = MulVal;
- err = Value->Compute(g, val, 2, Nodes[Ival].Op);
- } // endswitch Op
-
- if (err)
- Value->Reset();
-
- } // endif Zero
-
- } // endif Nx
-
- if (ars > ++Nx) {
- if (Ival != n) {
- mode = 2;
- goto evenmore;
- } else
- goto more;
-
- } else {
- if (Nodes[Ival].Op == OP_SEP) {
- // Calculate average
- PVAL val[2];
-
- MulVal->SetValue(ars);
- val[0] = Value;
- val[1] = MulVal;
-
- if (Value->Compute(g, val, 2, OP_DIV))
- Value->Reset();
-
- } // endif Op
-
- Arp = NULL;
- Nx = 0;
- } // endif ars
-
- } // endif Op
-
- } // endif Arp
-
- } // end of ReadColumn
-
-/***********************************************************************/
/* WriteColumn: */
/***********************************************************************/
void JSONCOL::WriteColumn(PGLOBAL g)
@@ -817,10 +1359,11 @@ void JSONCOL::WriteColumn(PGLOBAL g)
if (Value->IsNull() && Tjp->Mode == MODE_INSERT)
return;
+ char *s;
PJOB objp = NULL;
PJAR arp = NULL;
PJVAL jvp = NULL;
- PJSON row = GetRow(g, 1);
+ PJSON jsp, row = GetRow(g);
JTYP type = row->GetType();
switch (row->GetType()) {
@@ -832,12 +1375,38 @@ void JSONCOL::WriteColumn(PGLOBAL g)
if (row) switch (Buf_Type) {
case TYPE_STRING:
+ if (Nodes[Nod-1].Op == OP_XX) {
+ s = Value->GetCharValue();
+
+ if (!(jsp = ParseJson(g, s, (int)strlen(s), 0))) {
+ strcpy(g->Message, s);
+ longjmp(g->jumper[g->jump_level], 666);
+ } // endif jsp
+
+ if (arp) {
+ if (Nod > 1 && Nodes[Nod-2].Op == OP_EQ)
+ arp->SetValue(g, new(g) JVALUE(jsp), Nodes[Nod-2].Rank);
+ else
+ arp->AddValue(g, new(g) JVALUE(jsp));
+
+ arp->InitArray(g);
+ } else if (objp) {
+ if (Nod > 1 && Nodes[Nod-2].Key)
+ objp->SetValue(g, new(g) JVALUE(jsp), Nodes[Nod-2].Key);
+
+ } else if (jvp)
+ jvp->SetValue(jsp);
+
+ break;
+ } // endif Op
+
+ // Passthru
case TYPE_DATE:
case TYPE_INT:
case TYPE_DOUBLE:
if (arp) {
- if (Nodes[Nod-1].Rank)
- arp->SetValue(g, new(g) JVALUE(g, Value), Nodes[Nod-1].Rank-1);
+ if (Nodes[Nod-1].Op == OP_EQ)
+ arp->SetValue(g, new(g) JVALUE(g, Value), Nodes[Nod-1].Rank);
else
arp->AddValue(g, new(g) JVALUE(g, Value));
@@ -863,18 +1432,14 @@ void JSONCOL::WriteColumn(PGLOBAL g)
/***********************************************************************/
TDBJSON::TDBJSON(PJDEF tdp, PTXF txfp) : TDBJSN(tdp, txfp)
{
- Top = NULL;
Doc = NULL;
- Objname = tdp->Objname;
Multiple = tdp->Multiple;
Done = Changed = false;
} // end of TDBJSON standard constructor
TDBJSON::TDBJSON(PJTDB tdbp) : TDBJSN(tdbp)
{
- Top = tdbp->Top;
Doc = tdbp->Doc;
- Objname = tdbp->Objname;
Multiple = tdbp->Multiple;
Done = tdbp->Done;
Changed = tdbp->Changed;
@@ -898,64 +1463,17 @@ PTDB TDBJSON::CopyOne(PTABS t)
} // end of CopyOne
/***********************************************************************/
-/* Make the document tree from a file. */
+/* Make the document tree from the object path. */
/***********************************************************************/
int TDBJSON::MakeNewDoc(PGLOBAL g)
{
// Create a void table that will be populated
Doc = new(g) JARRAY;
- if (Objname) {
- // Parse and allocate Objname item(s)
- char *p;
- char *objpath = (char*)PlugSubAlloc(g, NULL, strlen(Objname)+1);
- int i;
- PJOB objp;
- PJAR arp;
- PJVAL val = NULL;
-
- strcpy(objpath, Objname);
- Top = NULL;
-
- for (; objpath; objpath = p) {
- if ((p = strchr(objpath, ':')))
- *p++ = 0;
-
- if (*objpath != '[') {
- objp = new(g) JOBJECT;
-
- if (!Top)
- Top = objp;
-
- if (val)
- val->SetValue(objp);
-
- val = new(g) JVALUE;
- objp->SetValue(g, val, objpath);
- } else if (objpath[strlen(objpath)-1] == ']') {
- arp = new(g) JARRAY;
-
- if (!Top)
- Top = arp;
-
- if (val)
- val->SetValue(arp);
-
- val = new(g) JVALUE;
- i = atoi(objpath+1) - 1;
- arp->SetValue(g, val, i);
- arp->InitArray(g);
- } else {
- sprintf(g->Message, "Invalid Table path %s", Objname);
- return RC_FX;
- } // endif objpath
-
- } // endfor p
-
- val->SetValue(Doc);
- } else
- Top = Doc;
+ if (MakeTopTree(g, Doc))
+ return RC_FX;
+ Done = true;
return RC_OK;
} // end of MakeNewDoc
@@ -964,10 +1482,9 @@ int TDBJSON::MakeNewDoc(PGLOBAL g)
/***********************************************************************/
int TDBJSON::MakeDocument(PGLOBAL g)
{
- char *p, *memory, *objpath, *key, filename[_MAX_PATH];
+ char *p, *memory, *objpath, *key = NULL;
int len, i = 0;
- HANDLE hFile;
- MEMMAP mm;
+ MODE mode = Mode;
PJSON jsp;
PJOB objp = NULL;
PJAR arp = NULL;
@@ -975,70 +1492,38 @@ int TDBJSON::MakeDocument(PGLOBAL g)
if (Done)
return RC_OK;
- else
- Done = true;
-
- // Now open the JSON file
- PlugSetPath(filename, Txfp->To_File, GetPath());
-
- /*********************************************************************/
- /* Create the mapping file object. */
- /*********************************************************************/
- hFile = CreateFileMap(g, filename, &mm, MODE_READ, false);
-
- if (hFile == INVALID_HANDLE_VALUE) {
- DWORD drc = GetLastError();
-
- if (drc != ENOENT || Mode != MODE_INSERT) {
- if (!(*g->Message))
- sprintf(g->Message, MSG(OPEN_MODE_ERROR),
- "map", (int)drc, filename);
-
- return RC_FX;
- } else
- return MakeNewDoc(g);
-
- } // endif hFile
/*********************************************************************/
- /* Get the file size (assuming file is smaller than 4 GB) */
+ /* Create the mapping file object in mode read. */
/*********************************************************************/
- len = mm.lenL;
- memory = (char *)mm.memory;
+ Mode = MODE_READ;
- if (!len) { // Empty file
- CloseFileHandle(hFile);
- CloseMemMap(memory, len);
+ if (!Txfp->OpenTableFile(g)) {
+ PFBLOCK fp = Txfp->GetTo_Fb();
- if (Mode == MODE_INSERT)
- return MakeNewDoc(g);
-
- } // endif len
+ if (fp) {
+ len = fp->Length;
+ memory = fp->Memory;
+ } else {
+ Mode = mode; // Restore saved Mode
+ return MakeNewDoc(g);
+ } // endif fp
- if (!memory) {
- CloseFileHandle(hFile);
- sprintf(g->Message, MSG(MAP_VIEW_ERROR), filename, GetLastError());
+ } else
return RC_FX;
- } // endif Memory
-
- CloseFileHandle(hFile); // Not used anymore
- hFile = INVALID_HANDLE_VALUE; // For Fblock
/*********************************************************************/
/* Parse the json file and allocate its tree structure. */
/*********************************************************************/
g->Message[0] = 0;
jsp = Top = ParseJson(g, memory, len, Pretty);
- CloseMemMap(memory, len);
+ Txfp->CloseTableFile(g, false);
+ Mode = mode; // Restore saved Mode
if (!jsp && g->Message[0])
return RC_FX;
- if (Objname) {
- objpath = (char*)PlugSubAlloc(g, NULL, strlen(Objname) + 1);
- strcpy(objpath, Objname);
- } else
- objpath = NULL;
+ objpath = PlugDup(g, Objname);
/*********************************************************************/
/* Find the table in the tree structure. */
@@ -1071,7 +1556,7 @@ int TDBJSON::MakeDocument(PGLOBAL g)
arp = jsp->GetArray();
objp = NULL;
- i = atoi(objpath+1) - 1;
+ i = atoi(objpath+1) - B;
val = arp->GetValue(i);
if (!val) {
@@ -1110,6 +1595,7 @@ int TDBJSON::MakeDocument(PGLOBAL g)
} // endif jsp
+ Done = true;
return RC_OK;
} // end of MakeDocument
@@ -1156,7 +1642,7 @@ void TDBJSON::ResetSize(void)
/***********************************************************************/
/* TDBJSON is not indexable. */
/***********************************************************************/
-int TDBJSON::MakeIndex(PGLOBAL g, PIXDEF pxdf, bool add)
+int TDBJSON::MakeIndex(PGLOBAL g, PIXDEF pxdf, bool)
{
if (pxdf) {
strcpy(g->Message, "JSON not indexable when pretty = 2");
@@ -1167,6 +1653,51 @@ int TDBJSON::MakeIndex(PGLOBAL g, PIXDEF pxdf, bool add)
} // end of MakeIndex
/***********************************************************************/
+/* Return the position in the table. */
+/***********************************************************************/
+int TDBJSON::GetRecpos(void)
+ {
+#if 0
+ union {
+ uint Rpos;
+ BYTE Spos[4];
+ };
+
+ Rpos = htonl(Fpos);
+ Spos[0] = (BYTE)NextSame;
+ return Rpos;
+#endif // 0
+ return Fpos;
+ } // end of GetRecpos
+
+/***********************************************************************/
+/* Set the position in the table. */
+/***********************************************************************/
+bool TDBJSON::SetRecpos(PGLOBAL, int recpos)
+ {
+#if 0
+ union {
+ uint Rpos;
+ BYTE Spos[4];
+ };
+
+ Rpos = recpos;
+ NextSame = Spos[0];
+ Spos[0] = 0;
+ Fpos = (signed)ntohl(Rpos);
+
+//if (Fpos != (signed)ntohl(Rpos)) {
+// Fpos = ntohl(Rpos);
+// same = false;
+//} else
+// same = true;
+#endif // 0
+
+ Fpos = recpos - 1;
+ return false;
+ } // end of SetRecpos
+
+/***********************************************************************/
/* JSON Access Method opening routine. */
/***********************************************************************/
bool TDBJSON::OpenDB(PGLOBAL g)
@@ -1175,13 +1706,7 @@ bool TDBJSON::OpenDB(PGLOBAL g)
/*******************************************************************/
/* Table already open replace it at its beginning. */
/*******************************************************************/
- for (PJCOL cp = (PJCOL)Columns; cp; cp = (PJCOL)cp->GetNext()) {
- cp->Nx = 0;
- cp->Arp = NULL;
- } // endfor cp
-
Fpos= -1;
- Spos = 0;
NextSame = false;
SameRow = 0;
return false;
@@ -1210,14 +1735,16 @@ bool TDBJSON::OpenDB(PGLOBAL g)
/***********************************************************************/
/* ReadDB: Data Base read routine for JSON access method. */
/***********************************************************************/
-int TDBJSON::ReadDB(PGLOBAL g)
+int TDBJSON::ReadDB(PGLOBAL)
{
- int rc;
+ int rc;
N++;
if (NextSame) {
- SameRow++;
+ SameRow = NextSame;
+ NextSame = false;
+ M++;
rc = RC_OK;
} else if (++Fpos < (signed)Doc->size()) {
Row = Doc->GetValue(Fpos);
@@ -1226,6 +1753,7 @@ int TDBJSON::ReadDB(PGLOBAL g)
Row = ((PJVAL)Row)->GetJson();
SameRow = 0;
+ M = 1;
rc = RC_OK;
} else
rc = RC_EF;
@@ -1257,9 +1785,10 @@ int TDBJSON::WriteDB(PGLOBAL g)
return RC_FX;
} else { // if (Jmode == MODE_VALUE)
- if (Mode == MODE_INSERT)
+ if (Mode == MODE_INSERT) {
Doc->AddValue(g, (PJVAL)Row);
- else if (Doc->SetValue(g, (PJVAL)Row, Fpos))
+ Row = new(g) JVALUE;
+ } else if (Doc->SetValue(g, (PJVAL)Row, Fpos))
return RC_FX;
} // endif Jmode
@@ -1319,4 +1848,23 @@ void TDBJSON::CloseDB(PGLOBAL g)
} // end of CloseDB
-/* -------------------------- End of json --------------------------- */
+/* ---------------------------TDBJCL class --------------------------- */
+
+/***********************************************************************/
+/* TDBJCL class constructor. */
+/***********************************************************************/
+TDBJCL::TDBJCL(PJDEF tdp) : TDBCAT(tdp)
+ {
+ Topt = tdp->GetTopt();
+ Db = (char*)tdp->GetDB();
+ } // end of TDBJCL constructor
+
+/***********************************************************************/
+/* GetResult: Get the list the JSON file columns. */
+/***********************************************************************/
+PQRYRES TDBJCL::GetResult(PGLOBAL g)
+ {
+ return JSONColumns(g, Db, Topt, false);
+ } // end of GetResult
+
+/* --------------------------- End of json --------------------------- */
diff --git a/storage/connect/tabjson.h b/storage/connect/tabjson.h
index 68f79a1526a..4505d30a21c 100644
--- a/storage/connect/tabjson.h
+++ b/storage/connect/tabjson.h
@@ -1,5 +1,5 @@
/*************** tabjson H Declares Source Code File (.H) **************/
-/* Name: tabjson.h Version 1.0 */
+/* Name: tabjson.h Version 1.1 */
/* */
/* (C) Copyright to the author Olivier BERTRAND 2014 - 2015 */
/* */
@@ -16,8 +16,6 @@ typedef class JSONDEF *PJDEF;
typedef class TDBJSON *PJTDB;
typedef class JSONCOL *PJCOL;
-class TDBJSN;
-
/***********************************************************************/
/* The JSON tree node. Can be an Object or an Array. */
/***********************************************************************/
@@ -25,7 +23,10 @@ typedef struct _jnode {
PSZ Key; // The key used for object
OPVAL Op; // Operator used for this node
PVAL CncVal; // To cont value used for OP_CNC
+ PVAL Valp; // The internal array VALUE
int Rank; // The rank in array
+ int Rx; // Read row number
+ int Nx; // Next to read row number
} JNODE, *PJNODE;
/***********************************************************************/
@@ -34,6 +35,8 @@ typedef struct _jnode {
class JSONDEF : public DOSDEF { /* Table description */
friend class TDBJSON;
friend class TDBJSN;
+ friend class TDBJCL;
+ friend PQRYRES JSONColumns(PGLOBAL, char*, PTOS, bool);
public:
// Constructor
JSONDEF(void);
@@ -52,6 +55,8 @@ class JSONDEF : public DOSDEF { /* Table description */
char *Xcol; /* Name of expandable column */
int Limit; /* Limit of multiple values */
int Pretty; /* Depends on file structure */
+ int Level; /* Used for catalog table */
+ int Base; /* Tne array index base */
bool Strict; /* Strict syntax checking */
}; // end of JSONDEF
@@ -69,40 +74,48 @@ class TDBJSN : public TDBDOS {
TDBJSN(TDBJSN *tdbp);
// Implementation
- virtual AMT GetAmType(void) {return TYPE_AM_JSN;}
- virtual bool SkipHeader(PGLOBAL g);
- virtual PTDB Duplicate(PGLOBAL g) {return (PTDB)new(g) TDBJSN(this);}
+ virtual AMT GetAmType(void) {return TYPE_AM_JSN;}
+ virtual bool SkipHeader(PGLOBAL g);
+ virtual PTDB Duplicate(PGLOBAL g) {return (PTDB)new(g) TDBJSN(this);}
+ PJSON GetRow(void) {return Row;}
// Methods
- virtual PTDB CopyOne(PTABS t);
- virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n);
- virtual PCOL InsertSpecialColumn(PGLOBAL g, PCOL colp);
- virtual int RowNumber(PGLOBAL g, BOOL b = FALSE)
- {return (b) ? N : Fpos + 1;}
+ virtual PTDB CopyOne(PTABS t);
+ virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n);
+ virtual PCOL InsertSpecialColumn(PCOL colp);
+ virtual int RowNumber(PGLOBAL g, bool b = FALSE)
+ {return (b) ? M : N;}
// Database routines
- virtual int Cardinality(PGLOBAL g);
- virtual int GetMaxSize(PGLOBAL g);
- virtual bool OpenDB(PGLOBAL g);
- virtual bool PrepareWriting(PGLOBAL g);
- virtual int ReadDB(PGLOBAL g);
+ virtual int Cardinality(PGLOBAL g);
+ virtual int GetMaxSize(PGLOBAL g);
+ virtual bool OpenDB(PGLOBAL g);
+ virtual bool PrepareWriting(PGLOBAL g);
+ virtual int ReadDB(PGLOBAL g);
protected:
+ PJSON FindRow(PGLOBAL g);
+ int MakeTopTree(PGLOBAL g, PJSON jsp);
+
// Members
+ PJSON Top; // The top JSON tree
PJSON Row; // The current row
+ PJSON Val; // The value of the current row
PJCOL Colp; // The multiple column
JMODE Jmode; // MODE_OBJECT by default
+ char *Objname; // The table object name
char *Xcol; // Name of expandable column
int Fpos; // The current row index
- int Spos; // DELETE start index
int N; // The current Rownum
+ int M; // Index of multiple value
int Limit; // Limit of multiple values
int Pretty; // Depends on file structure
- bool Strict; // Strict syntax checking
- bool NextSame; // Same next row
- bool Comma; // Row has final comma
+ int NextSame; // Same next row
int SameRow; // Same row nb
int Xval; // Index of expandable array
+ int B; // Array index base
+ bool Strict; // Strict syntax checking
+ bool Comma; // Row has final comma
}; // end of class TDBJSN
/* -------------------------- JSONCOL class -------------------------- */
@@ -130,8 +143,12 @@ class JSONCOL : public DOSCOL {
protected:
bool CheckExpand(PGLOBAL g, int i, PSZ nm, bool b);
bool SetArrayOptions(PGLOBAL g, char *p, int i, PSZ nm);
- PJSON GetRow(PGLOBAL g, int mode);
+ PVAL GetColumnValue(PGLOBAL g, PJSON row, int i);
+ PVAL ExpandArray(PGLOBAL g, PJAR arp, int n);
+ PVAL CalculateArray(PGLOBAL g, PJAR arp, int n);
+ PVAL MakeJson(PGLOBAL g, PJSON jsp);
void SetJsonValue(PGLOBAL g, PVAL vp, PJVAL val, int n);
+ PJSON GetRow(PGLOBAL g);
// Default constructor not to be used
JSONCOL(void) {}
@@ -139,12 +156,10 @@ class JSONCOL : public DOSCOL {
// Members
TDBJSN *Tjp; // To the JSN table block
PVAL MulVal; // To value used by multiple column
- PJAR Arp; // The intermediate array
char *Jpath; // The json path
- JNODE *Nodes ; // The intermediate objects
+ JNODE *Nodes; // The intermediate objects
int Nod; // The number of intermediate objects
- int Ival; // Index of multiple values
- int Nx; // The last read sub-row
+ int Xnod; // Index of multiple values
bool Xpd; // True for expandable column
bool Parsed; // True when parsed
}; // end of class JSONCOL
@@ -164,6 +179,7 @@ class TDBJSON : public TDBJSN {
// Implementation
virtual AMT GetAmType(void) {return TYPE_AM_JSON;}
virtual PTDB Duplicate(PGLOBAL g) {return (PTDB)new(g) TDBJSON(this);}
+ PJAR GetDoc(void) {return Doc;}
// Methods
virtual PTDB CopyOne(PTABS t);
@@ -172,26 +188,43 @@ class TDBJSON : public TDBJSN {
virtual int Cardinality(PGLOBAL g);
virtual int GetMaxSize(PGLOBAL g);
virtual void ResetSize(void);
- virtual int GetRecpos(void) {return Fpos;}
+ virtual int GetProgCur(void) {return N;}
+ virtual int GetRecpos(void);
+ virtual bool SetRecpos(PGLOBAL g, int recpos);
virtual bool OpenDB(PGLOBAL g);
virtual int ReadDB(PGLOBAL g);
virtual bool PrepareWriting(PGLOBAL g) {return false;}
virtual int WriteDB(PGLOBAL g);
virtual int DeleteDB(PGLOBAL g, int irc);
virtual void CloseDB(PGLOBAL g);
+ int MakeDocument(PGLOBAL g);
// Optimization routines
virtual int MakeIndex(PGLOBAL g, PIXDEF pxdf, bool add);
protected:
int MakeNewDoc(PGLOBAL g);
- int MakeDocument(PGLOBAL g);
// Members
- PJSON Top; // The file JSON tree
PJAR Doc; // The document array
- char *Objname; // The table object name
int Multiple; // 0: No 1: DIR 2: Section 3: filelist
bool Done; // True when document parsing is done
bool Changed; // After Update, Insert or Delete
}; // end of class TDBJSON
+
+/***********************************************************************/
+/* This is the class declaration for the JSON catalog table. */
+/***********************************************************************/
+class TDBJCL : public TDBCAT {
+ public:
+ // Constructor
+ TDBJCL(PJDEF tdp);
+
+ protected:
+ // Specific routines
+ virtual PQRYRES GetResult(PGLOBAL g);
+
+ // Members
+ PTOS Topt;
+ char *Db;
+ }; // end of class TDBJCL
diff --git a/storage/connect/table.cpp b/storage/connect/table.cpp
index cbd5910d8c8..933e072c1bb 100644
--- a/storage/connect/table.cpp
+++ b/storage/connect/table.cpp
@@ -1,7 +1,7 @@
/************** Table C++ Functions Source Code File (.CPP) ************/
/* Name: TABLE.CPP Version 2.7 */
/* */
-/* (C) Copyright to the author Olivier BERTRAND 1999-2014 */
+/* (C) Copyright to the author Olivier BERTRAND 1999-2015 */
/* */
/* This file contains the TBX, TDB and OPJOIN classes functions. */
/***********************************************************************/
@@ -74,7 +74,7 @@ TDB::TDB(PTDB tdbp) : Tdb_No(++Tnum)
/***********************************************************************/
/* RowNumber: returns the current row ordinal number. */
/***********************************************************************/
-int TDB::RowNumber(PGLOBAL g, bool b)
+int TDB::RowNumber(PGLOBAL g, bool)
{
sprintf(g->Message, MSG(ROWID_NOT_IMPL), GetAmName(g, GetAmType()));
return 0;
@@ -122,7 +122,7 @@ void TDB::Print(PGLOBAL g, FILE *f, uint n)
} // end of Print
-void TDB::Print(PGLOBAL g, char *ps, uint z)
+void TDB::Print(PGLOBAL, char *ps, uint)
{
sprintf(ps, "R%d.%s", Tdb_No, Name);
} // end of Print
@@ -263,7 +263,7 @@ PCOL TDBASE::ColDB(PGLOBAL g, PSZ name, int num)
/***********************************************************************/
/* InsertSpecialColumn: Put a special column ahead of the column list.*/
/***********************************************************************/
-PCOL TDBASE::InsertSpecialColumn(PGLOBAL g, PCOL colp)
+PCOL TDBASE::InsertSpecialColumn(PCOL colp)
{
if (!colp->IsSpecial())
return NULL;
@@ -327,7 +327,7 @@ PCOL TDBASE::InsertSpcBlk(PGLOBAL g, PCOLDEF cdp)
return NULL;
} // endif's name
- if (!(colp = InsertSpecialColumn(g, colp))) {
+ if (!(colp = InsertSpecialColumn(colp))) {
sprintf(g->Message, MSG(BAD_SPECIAL_COL), name);
return NULL;
} // endif Insert
@@ -338,7 +338,7 @@ PCOL TDBASE::InsertSpcBlk(PGLOBAL g, PCOLDEF cdp)
/***********************************************************************/
/* ResetTableOpt: Wrong for this table type. */
/***********************************************************************/
-int TDBASE::ResetTableOpt(PGLOBAL g, bool dop, bool dox)
+int TDBASE::ResetTableOpt(PGLOBAL g, bool, bool)
{
strcpy(g->Message, "This table is not indexable");
return RC_INFO;
@@ -365,7 +365,7 @@ void TDBASE::ResetKindex(PGLOBAL g, PKXBASE kxp)
/***********************************************************************/
/* SetRecpos: Replace the table at the specified position. */
/***********************************************************************/
-bool TDBASE::SetRecpos(PGLOBAL g, int recpos)
+bool TDBASE::SetRecpos(PGLOBAL g, int)
{
strcpy(g->Message, MSG(SETRECPOS_NIY));
return true;
@@ -386,7 +386,7 @@ void TDBASE::PrintAM(FILE *f, char *m)
/* Two questions here: exact meaning of U_J_INT ? */
/* Why is the eventual reference to To_Key_Col not marked U_J_EXT ? */
/***********************************************************************/
-void TDBASE::MarkDB(PGLOBAL g, PTDB tdb2)
+void TDBASE::MarkDB(PGLOBAL, PTDB tdb2)
{
if (trace)
htrc("DOS MarkDB: tdbp=%p tdb2=%p\n", this, tdb2);
@@ -453,7 +453,7 @@ bool TDBCAT::Initialize(PGLOBAL g)
/***********************************************************************/
/* CAT: Get the number of properties. */
/***********************************************************************/
-int TDBCAT::GetMaxSize(PGLOBAL g)
+int TDBCAT::GetMaxSize(PGLOBAL g __attribute__((unused)))
{
if (MaxSize < 0) {
// if (Initialize(g))
@@ -528,7 +528,7 @@ bool TDBCAT::InitCol(PGLOBAL g)
/***********************************************************************/
/* SetRecpos: Replace the table at the specified position. */
/***********************************************************************/
-bool TDBCAT::SetRecpos(PGLOBAL g, int recpos)
+bool TDBCAT::SetRecpos(PGLOBAL, int recpos)
{
N = recpos - 1;
return false;
@@ -537,7 +537,7 @@ bool TDBCAT::SetRecpos(PGLOBAL g, int recpos)
/***********************************************************************/
/* Data Base read routine for CAT access method. */
/***********************************************************************/
-int TDBCAT::ReadDB(PGLOBAL g)
+int TDBCAT::ReadDB(PGLOBAL)
{
return (++N < Qrp->Nblin) ? RC_OK : RC_EF;
} // end of ReadDB
@@ -554,7 +554,7 @@ int TDBCAT::WriteDB(PGLOBAL g)
/***********************************************************************/
/* Data Base delete line routine for CAT access methods. */
/***********************************************************************/
-int TDBCAT::DeleteDB(PGLOBAL g, int irc)
+int TDBCAT::DeleteDB(PGLOBAL g, int)
{
strcpy(g->Message, "Delete not enabled for CAT tables");
return RC_FX;
@@ -563,7 +563,7 @@ int TDBCAT::DeleteDB(PGLOBAL g, int irc)
/***********************************************************************/
/* Data Base close routine for WMI access method. */
/***********************************************************************/
-void TDBCAT::CloseDB(PGLOBAL g)
+void TDBCAT::CloseDB(PGLOBAL)
{
// Nothing to do
} // end of CloseDB
@@ -584,9 +584,13 @@ CATCOL::CATCOL(PCOLDEF cdp, PTDB tdbp, int n)
/***********************************************************************/
/* Read the next Data Source elements. */
/***********************************************************************/
-void CATCOL::ReadColumn(PGLOBAL g)
+void CATCOL::ReadColumn(PGLOBAL)
{
// Get the value of the Name or Description property
- Value->SetValue_pvblk(Crp->Kdata, Tdbp->N);
+ if (Crp->Kdata)
+ Value->SetValue_pvblk(Crp->Kdata, Tdbp->N);
+ else
+ Value->Reset();
+
} // end of ReadColumn
diff --git a/storage/connect/tabmac.cpp b/storage/connect/tabmac.cpp
index f072465ced5..e6e2abb54e2 100644
--- a/storage/connect/tabmac.cpp
+++ b/storage/connect/tabmac.cpp
@@ -3,12 +3,12 @@
/* From the article and sample code by Khalid Shaikh. */
/* TABMAC: virtual table to get the list of MAC addresses. */
/***********************************************************************/
-#if defined(WIN32)
+#if defined(__WIN__)
#include "my_global.h"
//#include <iphlpapi.h>
-#else // !WIN32
-#error This is a WIN32 only table type
-#endif // !WIN32
+#else // !__WIN__
+#error This is a WINDOWS only table type
+#endif // !__WIN__
#include "global.h"
#include "plgdbsem.h"
//#include "catalog.h"
diff --git a/storage/connect/tabmac.h b/storage/connect/tabmac.h
index 5e6c98d68fb..f9a66e82eaa 100644
--- a/storage/connect/tabmac.h
+++ b/storage/connect/tabmac.h
@@ -1,11 +1,11 @@
// TABMAC.H Olivier Bertrand 2011-2012
// MAC: virtual table to Get Mac Addresses via GetAdaptersInfo
-#if defined(WIN32)
+#if defined(__WIN__)
#include <windows.h>
#include <iphlpapi.h>
-#else // !WIN32
-#error This is a WIN32 only table TYPE
-#endif // !WIN32
+#else // !__WIN__
+#error This is a WINDOWS only table TYPE
+#endif // !__WIN__
/***********************************************************************/
/* Definitions. */
diff --git a/storage/connect/tabmul.cpp b/storage/connect/tabmul.cpp
index 415a1523d30..3008ca1b8ca 100644
--- a/storage/connect/tabmul.cpp
+++ b/storage/connect/tabmul.cpp
@@ -5,7 +5,7 @@
/* */
/* COPYRIGHT: */
/* ---------- */
-/* (C) Copyright to PlugDB Software Development 2003 - 2012 */
+/* (C) Copyright to PlugDB Software Development 2003 - 2015 */
/* Author: Olivier BERTRAND */
/* */
/* WHAT THIS PROGRAM DOES: */
@@ -37,7 +37,7 @@
/* Include relevant section of system dependant header files. */
/***********************************************************************/
#include "my_global.h"
-#if defined(WIN32)
+#if defined(__WIN__)
#include <stdlib.h>
#include <stdio.h>
#if defined(__BORLANDC__)
@@ -145,7 +145,7 @@ bool TDBMUL::InitFileNames(PGLOBAL g)
/*******************************************************************/
/* To_File is a multiple name with special characters */
/*******************************************************************/
-#if defined(WIN32)
+#if defined(__WIN__)
char drive[_MAX_DRIVE], direc[_MAX_DIR];
WIN32_FIND_DATA FileData;
HANDLE hSearch;
@@ -171,9 +171,10 @@ bool TDBMUL::InitFileNames(PGLOBAL g)
} // endif hSearch
while (n < PFNZ) {
- strcat(strcat(strcpy(filename, drive), direc), FileData.cFileName);
- pfn[n] = (char*)PlugSubAlloc(g, NULL, strlen(filename) + 1);
- strcpy(pfn[n++], filename);
+ if (!(FileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
+ strcat(strcat(strcpy(filename, drive), direc), FileData.cFileName);
+ pfn[n++] = PlugDup(g, filename);
+ } // endif dwFileAttributes
if (!FindNextFile(hSearch, &FileData)) {
rc = GetLastError();
@@ -195,7 +196,7 @@ bool TDBMUL::InitFileNames(PGLOBAL g)
return true;
} // endif FindClose
-#else // !WIN32
+#else // !__WIN__
struct stat fileinfo;
char fn[FN_REFLEN], direc[FN_REFLEN], pattern[FN_HEADLEN], ftype[FN_EXTLEN];
DIR *dir;
@@ -239,8 +240,7 @@ bool TDBMUL::InitFileNames(PGLOBAL g)
continue; // Not a match
strcat(strcpy(filename, direc), entry->d_name);
- pfn[n] = (char*)PlugSubAlloc(g, NULL, strlen(filename) + 1);
- strcpy(pfn[n++], filename);
+ pfn[n++] = PlugDup(g, filename);
if (trace)
htrc("Adding pfn[%d] %s\n", n, filename);
@@ -249,7 +249,7 @@ bool TDBMUL::InitFileNames(PGLOBAL g)
// Close the dir handle.
closedir(dir);
-#endif // !WIN32
+#endif // !__WIN__
} else {
/*******************************************************************/
@@ -269,7 +269,7 @@ bool TDBMUL::InitFileNames(PGLOBAL g)
p = filename + strlen(filename) - 1;
-#if defined(UNIX)
+#if !defined(__WIN__)
// Data files can be imported from Windows (having CRLF)
if (*p == '\n' || *p == '\r') {
// is this enough for Unix ???
@@ -292,13 +292,12 @@ bool TDBMUL::InitFileNames(PGLOBAL g)
*(++p) = '\0';
// Suballocate the file name
- pfn[n] = (char*)PlugSubAlloc(g, NULL, strlen(filename) + 1);
- strcpy(pfn[n++], filename);
+ pfn[n++] = PlugDup(g, filename);
} // endfor n
} // endif Mul
-#if defined(WIN32)
+#if defined(__WIN__)
suite:
#endif
@@ -562,7 +561,7 @@ int TDBMUL::WriteDB(PGLOBAL g)
/***********************************************************************/
/* Data Base delete line routine for MUL access method. */
/***********************************************************************/
-int TDBMUL::DeleteDB(PGLOBAL g, int irc)
+int TDBMUL::DeleteDB(PGLOBAL g, int)
{
// When implementing DELETE_MODE InitFileNames must be updated to
// eliminate CRLF under Windows if the file is read in binary.
@@ -587,7 +586,7 @@ void TDBMUL::CloseDB(PGLOBAL g)
/***********************************************************************/
/* DefineAM: define specific AM block values from XDB file. */
/***********************************************************************/
-bool DIRDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
+bool DIRDEF::DefineAM(PGLOBAL g, LPCSTR, int)
{
Desc = Fn = GetStringCatInfo(g, "Filename", NULL);
Incl = (GetIntCatInfo("Subdir", 0) != 0);
@@ -598,7 +597,7 @@ bool DIRDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
/***********************************************************************/
/* GetTable: makes a new Table Description Block. */
/***********************************************************************/
-PTDB DIRDEF::GetTable(PGLOBAL g, MODE m)
+PTDB DIRDEF::GetTable(PGLOBAL g, MODE)
{
#if 0
if (Huge)
@@ -621,17 +620,17 @@ TDBDIR::TDBDIR(PDIRDEF tdp) : TDBASE(tdp)
{
To_File = tdp->Fn;
iFile = 0;
-#if defined(WIN32)
+#if defined(__WIN__)
memset(&FileData, 0, sizeof(_finddata_t));
Hsearch = -1;
*Drive = '\0';
-#else // !WIN32
+#else // !__WIN__
memset(&Fileinfo, 0, sizeof(struct stat));
Entry = NULL;
Dir = NULL;
Done = false;
*Pattern = '\0';
-#endif // !WIN32
+#endif // !__WIN__
*Fpath = '\0';
*Direc = '\0';
*Fname = '\0';
@@ -642,17 +641,17 @@ TDBDIR::TDBDIR(PTDBDIR tdbp) : TDBASE(tdbp)
{
To_File = tdbp->To_File;
iFile = tdbp->iFile;
-#if defined(WIN32)
+#if defined(__WIN__)
FileData = tdbp->FileData;
Hsearch = tdbp->Hsearch;
strcpy(Drive, tdbp->Drive);
-#else // !WIN32
+#else // !__WIN__
Fileinfo = tdbp->Fileinfo;
Entry = tdbp->Entry;
Dir = tdbp->Dir;
Done = tdbp->Done;
strcpy(Pattern, tdbp->Pattern);
-#endif // !WIN32
+#endif // !__WIN__
strcpy(Direc, tdbp->Direc);
strcpy(Fname, tdbp->Fname);
strcpy(Ftype, tdbp->Ftype);
@@ -676,7 +675,7 @@ char* TDBDIR::Path(PGLOBAL g)
{
PCATLG cat = PlgGetCatalog(g);
-#if defined(WIN32)
+#if defined(__WIN__)
if (!*Drive) {
PlugSetPath(Fpath, To_File, ((PTABDEF)To_Def)->GetPath());
_splitpath(Fpath, Drive, Direc, Fname, Ftype);
@@ -684,7 +683,7 @@ char* TDBDIR::Path(PGLOBAL g)
_makepath(Fpath, Drive, Direc, Fname, Ftype); // Usefull ???
return Fpath;
-#else // !WIN32
+#else // !__WIN__
if (!Done) {
PlugSetPath(Fpath, To_File, ((PTABDEF)To_Def)->GetPath());
_splitpath(Fpath, NULL, Direc, Fname, Ftype);
@@ -693,7 +692,7 @@ char* TDBDIR::Path(PGLOBAL g)
} // endif Done
return Pattern;
-#endif // !WIN32
+#endif // !__WIN__
} // end of Path
/***********************************************************************/
@@ -711,7 +710,7 @@ int TDBDIR::GetMaxSize(PGLOBAL g)
{
if (MaxSize < 0) {
int n = -1;
-#if defined(WIN32)
+#if defined(__WIN__)
int h;
// Start searching files in the target directory.
@@ -727,7 +726,7 @@ int TDBDIR::GetMaxSize(PGLOBAL g)
} else
n = 0;
-#else // !WIN32
+#else // !__WIN__
Path(g);
// Start searching files in the target directory.
@@ -751,7 +750,7 @@ int TDBDIR::GetMaxSize(PGLOBAL g)
// Close the DIR handle.
closedir(Dir);
-#endif // !WIN32
+#endif // !__WIN__
MaxSize = n;
} // endif MaxSize
@@ -777,10 +776,10 @@ bool TDBDIR::OpenDB(PGLOBAL g)
} // endif use
Use = USE_OPEN;
-#if !defined(WIN32)
+#if !defined(__WIN__)
Path(g); // Be sure it is done
Dir = NULL; // For ReadDB
-#endif // !WIN32
+#endif // !__WIN__
return false;
} // end of OpenDB
@@ -791,7 +790,7 @@ int TDBDIR::ReadDB(PGLOBAL g)
{
int rc = RC_OK;
-#if defined(WIN32)
+#if defined(__WIN__)
if (Hsearch == -1) {
/*******************************************************************/
/* Start searching files in the target directory. The use of the */
@@ -849,7 +848,7 @@ int TDBDIR::ReadDB(PGLOBAL g)
rc = RC_EF;
} // endif Entry
-#endif // !WIN32
+#endif // !__WIN__
return rc;
} // end of ReadDB
@@ -866,7 +865,7 @@ int TDBDIR::WriteDB(PGLOBAL g)
/***********************************************************************/
/* Data Base delete line routine for DIR access method. */
/***********************************************************************/
-int TDBDIR::DeleteDB(PGLOBAL g, int irc)
+int TDBDIR::DeleteDB(PGLOBAL g, int)
{
strcpy(g->Message, MSG(TABDIR_READONLY));
return RC_FX; // NIY
@@ -875,19 +874,19 @@ int TDBDIR::DeleteDB(PGLOBAL g, int irc)
/***********************************************************************/
/* Data Base close routine for MUL access method. */
/***********************************************************************/
-void TDBDIR::CloseDB(PGLOBAL g)
+void TDBDIR::CloseDB(PGLOBAL)
{
-#if defined(WIN32)
+#if defined(__WIN__)
// Close the search handle.
_findclose(Hsearch);
Hsearch = -1;
-#else // !WIN32
+#else // !__WIN__
// Close the DIR handle
if (Dir) {
closedir(Dir);
Dir = NULL;
} // endif dir
-#endif // !WIN32
+#endif // !__WIN__
iFile = 0;
} // end of CloseDB
@@ -896,7 +895,7 @@ void TDBDIR::CloseDB(PGLOBAL g)
/***********************************************************************/
/* DIRCOL public constructor. */
/***********************************************************************/
-DIRCOL::DIRCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PSZ am)
+DIRCOL::DIRCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PSZ)
: COLBLK(cdp, tdbp, i)
{
if (cprec) {
@@ -936,19 +935,19 @@ void DIRCOL::ReadColumn(PGLOBAL g)
/* Retrieve the information corresponding to the column number. */
/*********************************************************************/
switch (N) {
-#if defined(WIN32)
+#if defined(__WIN__)
case 0: Value->SetValue_psz(tdbp->Drive); break;
-#endif // WIN32
+#endif // __WIN__
case 1: Value->SetValue_psz(tdbp->Direc); break;
case 2: Value->SetValue_psz(tdbp->Fname); break;
case 3: Value->SetValue_psz(tdbp->Ftype); break;
-#if defined(WIN32)
+#if defined(__WIN__)
case 4: Value->SetValue((int)tdbp->FileData.attrib); break;
case 5: Value->SetValue((int)tdbp->FileData.size); break;
case 6: Value->SetValue((int)tdbp->FileData.time_write); break;
case 7: Value->SetValue((int)tdbp->FileData.time_create); break;
case 8: Value->SetValue((int)tdbp->FileData.time_access); break;
-#else // !WIN32
+#else // !__WIN__
case 4: Value->SetValue((int)tdbp->Fileinfo.st_mode); break;
case 5: Value->SetValue((int)tdbp->Fileinfo.st_size); break;
case 6: Value->SetValue((int)tdbp->Fileinfo.st_mtime); break;
@@ -956,7 +955,7 @@ void DIRCOL::ReadColumn(PGLOBAL g)
case 8: Value->SetValue((int)tdbp->Fileinfo.st_atime); break;
case 9: Value->SetValue((int)tdbp->Fileinfo.st_uid); break;
case 10: Value->SetValue((int)tdbp->Fileinfo.st_gid); break;
-#endif // !WIN32
+#endif // !__WIN__
default:
sprintf(g->Message, MSG(INV_DIRCOL_OFST), N);
longjmp(g->jumper[g->jump_level], GetAmType());
@@ -1007,7 +1006,7 @@ int TDBSDR::FindInDir(PGLOBAL g)
size_t m = strlen(Direc);
// Start searching files in the target directory.
-#if defined(WIN32)
+#if defined(__WIN__)
int h = _findfirst(Path(g), &FileData);
if (h != -1) {
@@ -1040,7 +1039,7 @@ int TDBSDR::FindInDir(PGLOBAL g)
// Close the search handle.
_findclose(h);
} // endif h
-#else // !WIN32
+#else // !__WIN__
int k;
DIR *dir = opendir(Direc);
@@ -1074,7 +1073,7 @@ int TDBSDR::FindInDir(PGLOBAL g)
// Close the DIR handle.
closedir(dir);
-#endif // !WIN32
+#endif // !__WIN__
return n;
} // end of FindInDir
@@ -1090,13 +1089,13 @@ bool TDBSDR::OpenDB(PGLOBAL g)
Sub = (PSUBDIR)PlugSubAlloc(g, NULL, sizeof(SUBDIR));
Sub->Next = NULL;
Sub->Prev = NULL;
-#if defined(WIN32)
+#if defined(__WIN__)
Sub->H = -1;
Sub->Len = strlen(Direc);
-#else // !WIN32
+#else // !__WIN__
Sub->D = NULL;
Sub->Len = 0;
-#endif // !WIN32
+#endif // !__WIN__
} // endif To_Sub
return TDBDIR::OpenDB(g);
@@ -1109,7 +1108,7 @@ int TDBSDR::ReadDB(PGLOBAL g)
{
int rc;
-#if defined(WIN32)
+#if defined(__WIN__)
again:
rc = TDBDIR::ReadDB(g);
@@ -1161,7 +1160,7 @@ int TDBSDR::ReadDB(PGLOBAL g)
} // endif H
} // endif rc
-#else // !WIN32
+#else // !__WIN__
rc = RC_NF;
again:
@@ -1218,7 +1217,7 @@ int TDBSDR::ReadDB(PGLOBAL g)
} // endif Entry
-#endif // !WIN32
+#endif // !__WIN__
return rc;
} // end of ReadDB
diff --git a/storage/connect/tabmul.h b/storage/connect/tabmul.h
index 379e8f88e93..433cc3a2ee3 100644
--- a/storage/connect/tabmul.h
+++ b/storage/connect/tabmul.h
@@ -6,14 +6,14 @@
/* */
/* This file contains the TDBMUL and TDBDIR classes declares. */
/***********************************************************************/
-#if defined(WIN32)
+#if defined(__WIN__)
#include <io.h>
-#else // !WIN32
+#else // !__WIN__
#include <sys/types.h>
#include <unistd.h>
#include <sys/stat.h>
#include <dirent.h>
-#endif // !WIN32
+#endif // !__WIN__
//#include "osutil.h"
#include "block.h"
@@ -132,17 +132,17 @@ class TDBDIR : public TDBASE {
// Members
PSZ To_File; // Points to file search pathname
int iFile; // Index of currently retrieved file
-#if defined(WIN32)
+#if defined(__WIN__)
_finddata_t FileData; // Find data structure
int Hsearch; // Search handle
char Drive[_MAX_DRIVE]; // Drive name
-#else // !WIN32
+#else // !__WIN__
struct stat Fileinfo; // File info structure
struct dirent *Entry; // Point to directory entry structure
DIR *Dir; // To searched directory structure
bool Done; // true when _splipath is done
char Pattern[_MAX_FNAME+_MAX_EXT];
-#endif // !WIN32
+#endif // !__WIN__
char Fpath[_MAX_PATH]; // Absolute file search pattern
char Direc[_MAX_DIR]; // Search path
char Fname[_MAX_FNAME]; // File name
@@ -183,11 +183,11 @@ class TDBSDR : public TDBDIR {
typedef struct _Sub_Dir {
struct _Sub_Dir *Next;
struct _Sub_Dir *Prev;
-#if defined(WIN32)
+#if defined(__WIN__)
int H; // Search handle
-#else // !WIN32
+#else // !__WIN__
DIR *D;
-#endif // !WIN32
+#endif // !__WIN__
size_t Len; // Initial directory name length
} SUBDIR, *PSUBDIR;
diff --git a/storage/connect/tabmysql.cpp b/storage/connect/tabmysql.cpp
index 54627ba43fd..19a5dfd758f 100644
--- a/storage/connect/tabmysql.cpp
+++ b/storage/connect/tabmysql.cpp
@@ -5,7 +5,7 @@
/* */
/* AUTHOR: */
/* ------- */
-/* Olivier BERTRAND 2007-2014 */
+/* Olivier BERTRAND 2007-2015 */
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
@@ -35,9 +35,9 @@
#include "my_global.h"
#include "sql_class.h"
#include "sql_servers.h"
-#if defined(WIN32)
+#if defined(__WIN__)
//#include <windows.h>
-#else // !WIN32
+#else // !__WIN__
//#include <fnmatch.h>
//#include <errno.h>
#include <stdlib.h>
@@ -46,7 +46,7 @@
#include "osutil.h"
//#include <io.h>
//#include <fcntl.h>
-#endif // !WIN32
+#endif // !__WIN__
/***********************************************************************/
/* Include application header files: */
@@ -56,7 +56,6 @@
#include "xtable.h"
#include "tabcol.h"
#include "colblk.h"
-#include "mycat.h"
#include "reldef.h"
#include "tabmysql.h"
#include "valblk.h"
@@ -308,7 +307,7 @@ bool MYSQLDEF::ParseURL(PGLOBAL g, char *url, bool b)
/***********************************************************************/
/* DefineAM: define specific AM block values from XCV file. */
/***********************************************************************/
-bool MYSQLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
+bool MYSQLDEF::DefineAM(PGLOBAL g, LPCSTR am, int)
{
char *url;
@@ -381,7 +380,7 @@ bool MYSQLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
/***********************************************************************/
/* GetTable: makes a new TDB of the proper type. */
/***********************************************************************/
-PTDB MYSQLDEF::GetTable(PGLOBAL g, MODE m)
+PTDB MYSQLDEF::GetTable(PGLOBAL g, MODE)
{
if (Xsrc)
return new(g) TDBMYEXC(this);
@@ -439,7 +438,7 @@ TDBMYSQL::TDBMYSQL(PMYDEF tdp) : TDBASE(tdp)
Nparm = 0;
} // end of TDBMYSQL constructor
-TDBMYSQL::TDBMYSQL(PGLOBAL g, PTDBMY tdbp) : TDBASE(tdbp)
+TDBMYSQL::TDBMYSQL(PTDBMY tdbp) : TDBASE(tdbp)
{
Host = tdbp->Host;
Database = tdbp->Database;
@@ -469,7 +468,7 @@ PTDB TDBMYSQL::CopyOne(PTABS t)
PCOL cp1, cp2;
PGLOBAL g = t->G;
- tp = new(g) TDBMYSQL(g, this);
+ tp = new(g) TDBMYSQL(this);
for (cp1 = Columns; cp1; cp1 = cp1->GetNext()) {
cp2 = new(g) MYSQLCOL((PMYCOL)cp1, tp);
@@ -817,7 +816,7 @@ int TDBMYSQL::GetMaxSize(PGLOBAL g)
/***********************************************************************/
/* This a fake routine as ROWID does not exist in MySQL. */
/***********************************************************************/
-int TDBMYSQL::RowNumber(PGLOBAL g, bool b)
+int TDBMYSQL::RowNumber(PGLOBAL, bool)
{
return N + 1;
} // end of RowNumber
@@ -833,7 +832,7 @@ int TDBMYSQL::GetProgMax(PGLOBAL g)
/***********************************************************************/
/* MySQL Bind Parameter function. */
/***********************************************************************/
-int TDBMYSQL::BindColumns(PGLOBAL g)
+int TDBMYSQL::BindColumns(PGLOBAL g __attribute__((unused)))
{
#if defined(MYSQL_PREPARED_STATEMENTS)
if (Prep) {
@@ -1061,9 +1060,16 @@ bool TDBMYSQL::ReadKey(PGLOBAL g, OPVAL op, const void *key, int len)
int oldlen = Query->GetLength();
if (!key || op == OP_NEXT ||
- Mode == MODE_UPDATE || Mode == MODE_DELETE)
+ Mode == MODE_UPDATE || Mode == MODE_DELETE) {
+ if (!key && Mode == MODE_READX) {
+ // This is a false indexed read
+ m_Rc = Myc.ExecSQL(g, Query->GetStr());
+ Mode = MODE_READ;
+ return (m_Rc == RC_FX) ? true : false;
+ } // endif key
+
return false;
- else if (op == OP_FIRST) {
+ } else if (op == OP_FIRST) {
if (To_CondFil) {
oom = Query->Append(" WHERE ");
@@ -1078,8 +1084,7 @@ bool TDBMYSQL::ReadKey(PGLOBAL g, OPVAL op, const void *key, int len)
if (Myc.m_Res)
Myc.FreeResult();
- To_Def->GetHandler()->MakeKeyWhere(g, Query->GetStr(),
- op, "`", key, len);
+ To_Def->GetHandler()->MakeKeyWhere(g, Query, op, '`', key, len);
if (To_CondFil) {
oom = Query->Append(" AND (");
@@ -1141,19 +1146,16 @@ int TDBMYSQL::WriteDB(PGLOBAL g)
int rc;
uint len = Query->GetLength();
char buf[64];
- bool b, oom = false;
+ bool oom = false;
// Make the Insert command value list
for (PCOL colp = Columns; colp; colp = colp->GetNext()) {
if (!colp->GetValue()->IsNull()) {
- 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('\'');
+ if (colp->GetResultType() == TYPE_STRING ||
+ colp->GetResultType() == TYPE_DATE)
+ oom |= Query->Append_quoted(colp->GetValue()->GetCharString(buf));
+ else
+ oom |= Query->Append(colp->GetValue()->GetCharString(buf));
} else
oom |= Query->Append("NULL");
@@ -1423,7 +1425,7 @@ void MYSQLCOL::ReadColumn(PGLOBAL g)
/***********************************************************************/
/* WriteColumn: make sure the bind buffer is updated. */
/***********************************************************************/
-void MYSQLCOL::WriteColumn(PGLOBAL g)
+void MYSQLCOL::WriteColumn(PGLOBAL)
{
/*********************************************************************/
/* Do convert the column value if necessary. */
@@ -1461,7 +1463,7 @@ TDBMYEXC::TDBMYEXC(PMYDEF tdp) : TDBMYSQL(tdp)
Nerr = 0;
} // end of TDBMYEXC constructor
-TDBMYEXC::TDBMYEXC(PGLOBAL g, PTDBMYX tdbp) : TDBMYSQL(g, tdbp)
+TDBMYEXC::TDBMYEXC(PTDBMYX tdbp) : TDBMYSQL(tdbp)
{
Cmdlist = tdbp->Cmdlist;
Cmdcol = tdbp->Cmdcol;
@@ -1479,7 +1481,7 @@ PTDB TDBMYEXC::CopyOne(PTABS t)
PCOL cp1, cp2;
PGLOBAL g = t->G;
- tp = new(g) TDBMYEXC(g, this);
+ tp = new(g) TDBMYEXC(this);
for (cp1 = Columns; cp1; cp1 = cp1->GetNext()) {
cp2 = new(g) MYXCOL((PMYXCOL)cp1, tp);
@@ -1532,7 +1534,7 @@ PCMD TDBMYEXC::MakeCMD(PGLOBAL g)
/***********************************************************************/
/* EXC GetMaxSize: returns the maximum number of rows in the table. */
/***********************************************************************/
-int TDBMYEXC::GetMaxSize(PGLOBAL g)
+int TDBMYEXC::GetMaxSize(PGLOBAL)
{
if (MaxSize < 0) {
MaxSize = 10; // a guess
@@ -1709,7 +1711,7 @@ void MYXCOL::ReadColumn(PGLOBAL g)
/***********************************************************************/
/* WriteColumn: should never be called. */
/***********************************************************************/
-void MYXCOL::WriteColumn(PGLOBAL g)
+void MYXCOL::WriteColumn(PGLOBAL)
{
assert(false);
} // end of WriteColumn
diff --git a/storage/connect/tabmysql.h b/storage/connect/tabmysql.h
index 99930d43a57..17d7b190340 100644
--- a/storage/connect/tabmysql.h
+++ b/storage/connect/tabmysql.h
@@ -73,11 +73,11 @@ class TDBMYSQL : public TDBASE {
public:
// Constructor
TDBMYSQL(PMYDEF tdp);
- TDBMYSQL(PGLOBAL g, PTDBMY tdbp);
+ TDBMYSQL(PTDBMY tdbp);
// Implementation
virtual AMT GetAmType(void) {return TYPE_AM_MYSQL;}
- virtual PTDB Duplicate(PGLOBAL g) {return (PTDB)new(g) TDBMYSQL(g, this);}
+ virtual PTDB Duplicate(PGLOBAL g) {return (PTDB)new(g) TDBMYSQL(this);}
// Methods
virtual PTDB CopyOne(PTABS t);
@@ -180,11 +180,11 @@ class TDBMYEXC : public TDBMYSQL {
public:
// Constructors
TDBMYEXC(PMYDEF tdp);
- TDBMYEXC(PGLOBAL g, PTDBMYX tdbp);
+ TDBMYEXC(PTDBMYX tdbp);
// Implementation
virtual AMT GetAmType(void) {return TYPE_AM_MYX;}
- virtual PTDB Duplicate(PGLOBAL g) {return (PTDB)new(g) TDBMYEXC(g, this);}
+ virtual PTDB Duplicate(PGLOBAL g) {return (PTDB)new(g) TDBMYEXC(this);}
// Methods
virtual PTDB CopyOne(PTABS t);
diff --git a/storage/connect/taboccur.cpp b/storage/connect/taboccur.cpp
index 86f0bd20d47..07e260154e0 100644
--- a/storage/connect/taboccur.cpp
+++ b/storage/connect/taboccur.cpp
@@ -1,7 +1,7 @@
/************ TabOccur CPP Declares Source Code File (.CPP) ************/
/* Name: TABOCCUR.CPP Version 1.1 */
/* */
-/* (C) Copyright to the author Olivier BERTRAND 2013 */
+/* (C) Copyright to the author Olivier BERTRAND 2013 - 2015 */
/* */
/* OCCUR: Table that provides a view of a source table where the */
/* contain of several columns of the source table is placed in only */
@@ -13,7 +13,7 @@
/***********************************************************************/
#include "my_global.h"
#include "table.h" // MySQL table definitions
-#if defined(WIN32)
+#if defined(__WIN__)
#include <stdlib.h>
#include <stdio.h>
#if defined(__BORLANDC__)
@@ -45,11 +45,8 @@
#include "tabcol.h"
#include "taboccur.h"
#include "xtable.h"
-#if defined(MYSQL_SUPPORT)
#include "tabmysql.h"
-#endif // MYSQL_SUPPORT
#include "ha_connect.h"
-#include "mycat.h"
/***********************************************************************/
/* Prepare and count columns in the column list. */
@@ -93,8 +90,7 @@ bool OcrColumns(PGLOBAL g, PQRYRES qrp, const char *col,
} // endif col
// Prepare the column list
- colist = (char*)PlugSubAlloc(g, NULL, strlen(col) + 1);
- strcpy(colist, col);
+ colist = PlugDup(g, col);
m = PrepareColist(colist);
if ((rk = (rank && *rank))) {
@@ -191,8 +187,7 @@ bool OcrSrcCols(PGLOBAL g, PQRYRES qrp, const char *col,
} // endif col
// Prepare the column list
- colist = (char*)PlugSubAlloc(g, NULL, strlen(col) + 1);
- strcpy(colist, col);
+ colist = PlugDup(g, col);
m = PrepareColist(colist);
if ((rk = (rank && *rank)))
@@ -271,7 +266,7 @@ bool OCCURDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
/***********************************************************************/
/* GetTable: makes a new TDB of the proper type. */
/***********************************************************************/
-PTDB OCCURDEF::GetTable(PGLOBAL g, MODE m)
+PTDB OCCURDEF::GetTable(PGLOBAL g, MODE)
{
if (Catfunc != FNC_COL)
return new(g) TDBOCCUR(this);
@@ -355,7 +350,7 @@ bool TDBOCCUR::MakeColumnList(PGLOBAL g)
for (colp = Columns; colp; colp = colp->GetNext())
if (colp->GetAmType() == TYPE_AM_PRX)
- if (((PPRXCOL)colp)->Init(g))
+ if (((PPRXCOL)colp)->Init(g, NULL))
return true;
Col = (PCOL*)PlugSubAlloc(g, NULL, Mult * sizeof(PCOL));
@@ -437,7 +432,7 @@ int TDBOCCUR::GetMaxSize(PGLOBAL g)
/* In this sample, ROWID will be the (virtual) row number, */
/* while ROWNUM will be the occurence rank in the multiple column. */
/***********************************************************************/
-int TDBOCCUR::RowNumber(PGLOBAL g, bool b)
+int TDBOCCUR::RowNumber(PGLOBAL, bool b)
{
return (b) ? M : N;
} // end of RowNumber
@@ -572,7 +567,7 @@ void OCCURCOL::ReadColumn(PGLOBAL g)
/* ReadColumn: what this routine does is to access the Mth columns of */
/* list, extract its name and set to it the rank column value. */
/***********************************************************************/
-void RANKCOL::ReadColumn(PGLOBAL g)
+void RANKCOL::ReadColumn(PGLOBAL)
{
PTDBOCCUR tdbp = (PTDBOCCUR)To_Tdb;
PCOL *col = tdbp->Col;
diff --git a/storage/connect/tabodbc.cpp b/storage/connect/tabodbc.cpp
index 2b771bcbead..307509848f4 100644
--- a/storage/connect/tabodbc.cpp
+++ b/storage/connect/tabodbc.cpp
@@ -35,7 +35,7 @@
/* Include relevant MariaDB header file. */
/***********************************************************************/
#include "my_global.h"
-#if defined(WIN32)
+#if defined(__WIN__)
#include <io.h>
#include <fcntl.h>
#if defined(__BORLANDC__)
@@ -66,8 +66,8 @@
#include "plgdbsem.h"
#include "mycat.h"
#include "xtable.h"
-#include "tabodbc.h"
#include "odbccat.h"
+#include "tabodbc.h"
#include "tabmul.h"
#include "reldef.h"
#include "tabcol.h"
@@ -93,9 +93,10 @@ bool ExactInfo(void);
/***********************************************************************/
ODBCDEF::ODBCDEF(void)
{
- Connect= Tabname= Tabschema= Tabcat= Srcdef= Qchar= Qrystr= Sep= NULL;
+ Connect = Tabname = Tabschema = Username = Password = NULL;
+ Tabcat = Srcdef = Qchar = Qrystr = Sep = NULL;
Catver = Options = Cto = Qto = Quoted = Maxerr = Maxres = 0;
- Scrollable = Memory = Xsrc = false;
+ Scrollable = Memory = Xsrc = UseCnc = false;
} // end of ODBCDEF constructor
/***********************************************************************/
@@ -117,6 +118,8 @@ bool ODBCDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
Tabschema = GetStringCatInfo(g, "Schema", Tabschema);
Tabcat = GetStringCatInfo(g, "Qualifier", NULL);
Tabcat = GetStringCatInfo(g, "Catalog", Tabcat);
+ Username = GetStringCatInfo(g, "User", NULL);
+ Password = GetStringCatInfo(g, "Password", NULL);
if ((Srcdef = GetStringCatInfo(g, "Srcdef", NULL)))
Read_Only = true;
@@ -132,8 +135,16 @@ bool ODBCDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
//Options = ODBConn::noOdbcDialog | ODBConn::useCursorLib;
Cto= GetIntCatInfo("ConnectTimeout", DEFAULT_LOGIN_TIMEOUT);
Qto= GetIntCatInfo("QueryTimeout", DEFAULT_QUERY_TIMEOUT);
- Scrollable = GetBoolCatInfo("Scrollable", false);
- Memory = GetBoolCatInfo("Memory", false);
+
+ if ((Scrollable = GetBoolCatInfo("Scrollable", false)) && !Elemt)
+ Elemt = 1; // Cannot merge SQLFetch and SQLExtendedFetch
+
+ UseCnc = GetBoolCatInfo("UseDSN", false);
+
+ // Memory was Boolean, it is now integer
+ if (!(Memory = GetIntCatInfo("Memory", 0)))
+ Memory = GetBoolCatInfo("Memory", false) ? 1 : 0;
+
Pseudo = 2; // FILID is Ok but not ROWID
return false;
} // end of DefineAM
@@ -190,34 +201,40 @@ TDBODBC::TDBODBC(PODEF tdp) : TDBASE(tdp)
Connect = tdp->Connect;
TableName = tdp->Tabname;
Schema = tdp->Tabschema;
+ Ops.User = tdp->Username;
+ Ops.Pwd = tdp->Password;
Catalog = tdp->Tabcat;
Srcdef = tdp->Srcdef;
Qrystr = tdp->Qrystr;
Sep = tdp->GetSep();
Options = tdp->Options;
- Cto = tdp->Cto;
- Qto = tdp->Qto;
+ Ops.Cto = tdp->Cto;
+ Ops.Qto = tdp->Qto;
Quoted = MY_MAX(0, tdp->GetQuoted());
Rows = tdp->GetElemt();
Catver = tdp->Catver;
- Memory = (tdp->Memory) ? 1 : 0;
+ Memory = tdp->Memory;
Scrollable = tdp->Scrollable;
+ Ops.UseCnc = tdp->UseCnc;
} else {
Connect = NULL;
TableName = NULL;
Schema = NULL;
+ Ops.User = NULL;
+ Ops.Pwd = NULL;
Catalog = NULL;
Srcdef = NULL;
Qrystr = NULL;
Sep = 0;
Options = 0;
- Cto = DEFAULT_LOGIN_TIMEOUT;
- Qto = DEFAULT_QUERY_TIMEOUT;
+ Ops.Cto = DEFAULT_LOGIN_TIMEOUT;
+ Ops.Qto = DEFAULT_QUERY_TIMEOUT;
Quoted = 0;
Rows = 0;
Catver = 0;
Memory = 0;
Scrollable = false;
+ Ops.UseCnc = false;
} // endif tdp
Quote = NULL;
@@ -228,11 +245,13 @@ TDBODBC::TDBODBC(PODEF tdp) : TDBASE(tdp)
DBQ = NULL;
Qrp = NULL;
Fpos = 0;
+ Curpos = 0;
AftRows = 0;
CurNum = 0;
Rbuf = 0;
BufSize = 0;
Nparm = 0;
+ Placed = false;
} // end of TDBODBC standard constructor
TDBODBC::TDBODBC(PTDBODBC tdbp) : TDBASE(tdbp)
@@ -242,6 +261,7 @@ TDBODBC::TDBODBC(PTDBODBC tdbp) : TDBASE(tdbp)
Connect = tdbp->Connect;
TableName = tdbp->TableName;
Schema = tdbp->Schema;
+ Ops = tdbp->Ops;
Catalog = tdbp->Catalog;
Srcdef = tdbp->Srcdef;
Qrystr = tdbp->Qrystr;
@@ -254,19 +274,17 @@ TDBODBC::TDBODBC(PTDBODBC tdbp) : TDBASE(tdbp)
MulConn = tdbp->MulConn;
DBQ = tdbp->DBQ;
Options = tdbp->Options;
- Cto = tdbp->Cto;
- Qto = tdbp->Qto;
Quoted = tdbp->Quoted;
Rows = tdbp->Rows;
- Fpos = tdbp->Fpos;
- AftRows = tdbp->AftRows;
-//Tpos = tdbp->Tpos;
-//Spos = tdbp->Spos;
- CurNum = tdbp->CurNum;
- Rbuf = tdbp->Rbuf;
+ Fpos = 0;
+ Curpos = 0;
+ AftRows = 0;
+ CurNum = 0;
+ Rbuf = 0;
BufSize = tdbp->BufSize;
Nparm = tdbp->Nparm;
Qrp = tdbp->Qrp;
+ Placed = false;
} // end of TDBODBC copy constructor
// Method
@@ -370,7 +388,7 @@ int TDBODBC::Decode(char *txt, char *buf, size_t n)
/***********************************************************************/
char *TDBODBC::MakeSQL(PGLOBAL g, bool cnt)
{
- char *colist, *tabname, *sql, buf[64];
+ char *colist, *tabname, *sql, buf[NAM_LEN * 3];
LPCSTR schmp = NULL, catp = NULL;
int len, ncol = 0;
bool first = true;
@@ -474,6 +492,9 @@ char *TDBODBC::MakeSQL(PGLOBAL g, bool cnt)
if (To_CondFil)
strcat(strcat(sql, " WHERE "), To_CondFil->Body);
+
+ if (trace)
+ htrc("sql: '%s'\n", sql);
return sql;
} // end of MakeSQL
@@ -483,7 +504,7 @@ char *TDBODBC::MakeSQL(PGLOBAL g, bool cnt)
/***********************************************************************/
char *TDBODBC::MakeInsert(PGLOBAL g)
{
- char *stmt, *colist, *valist;
+ char *stmt, *colist, *valist, buf[NAM_LEN * 3];
// char *tk = "`";
int len = 0;
bool b = FALSE;
@@ -510,10 +531,13 @@ char *TDBODBC::MakeInsert(PGLOBAL g)
} else
b = true;
+ // Column name can be in UTF-8 encoding
+ Decode(colp->GetName(), buf, sizeof(buf));
+
if (Quote)
- strcat(strcat(strcat(colist, Quote), colp->GetName()), Quote);
+ strcat(strcat(strcat(colist, Quote), buf), Quote);
else
- strcat(colist, colp->GetName());
+ strcat(colist, buf);
strcat(valist, "?"); // Parameter marker
} // endfor colp
@@ -558,8 +582,7 @@ bool TDBODBC::BindParameters(PGLOBAL g)
/***********************************************************************/
char *TDBODBC::MakeCommand(PGLOBAL g)
{
- char *p, name[68], *qc = Ocp->GetQuoteChar();
- char *stmt = (char*)PlugSubAlloc(g, NULL, strlen(Qrystr) + 64);
+ char *p, *stmt, name[68], *body = NULL, *qc = Ocp->GetQuoteChar();
char *qrystr = (char*)PlugSubAlloc(g, NULL, strlen(Qrystr) + 1);
bool qtd = Quoted > 0;
int i = 0, k = 0;
@@ -570,6 +593,15 @@ char *TDBODBC::MakeCommand(PGLOBAL g)
qrystr[i] = (Qrystr[i] == '`') ? *qc : tolower(Qrystr[i]);
} while (Qrystr[i++]);
+ if (To_CondFil && (p = strstr(qrystr, " where "))) {
+ p[7] = 0; // Remove where clause
+ Qrystr[(p - qrystr) + 7] = 0;
+ body = To_CondFil->Body;
+ stmt = (char*)PlugSubAlloc(g, NULL, strlen(qrystr)
+ + strlen(body) + 64);
+ } else
+ stmt = (char*)PlugSubAlloc(g, NULL, strlen(Qrystr) + 64);
+
// Check whether the table name is equal to a keyword
// If so, it must be quoted in the original query
strlwr(strcat(strcat(strcpy(name, " "), Name), " "));
@@ -597,6 +629,9 @@ char *TDBODBC::MakeCommand(PGLOBAL g)
stmt[i++] = (Qrystr[k] == '`') ? *qc : Qrystr[k];
} while (Qrystr[k++]);
+ if (body)
+ strcat(stmt, body);
+
} else {
sprintf(g->Message, "Cannot use this %s command",
(Mode == MODE_UPDATE) ? "UPDATE" : "DELETE");
@@ -698,10 +733,7 @@ int TDBODBC::Cardinality(PGLOBAL g)
char qry[96], tbn[64];
ODBConn *ocp = new(g) ODBConn(g, this);
- ocp->SetLoginTimeout((DWORD)Cto);
- ocp->SetQueryTimeout((DWORD)Qto);
-
- if (ocp->Open(Connect, Options) < 1)
+ if (ocp->Open(Connect, &Ops, Options) < 1)
return -1;
// Table name can be encoded in UTF-8
@@ -762,9 +794,9 @@ int TDBODBC::GetProgMax(PGLOBAL g)
/***********************************************************************/
bool TDBODBC::OpenDB(PGLOBAL g)
{
- bool rc = false;
+ bool rc = true;
- if (g->Trace)
+ if (trace)
htrc("ODBC OpenDB: tdbp=%p tdb=R%d use=%dmode=%d\n",
this, Tdb_No, Use, Mode);
@@ -788,10 +820,12 @@ bool TDBODBC::OpenDB(PGLOBAL g)
return true;
} // endif Rewind
- } // endif Memory
+ } else
+ Rbuf = Qrp->Nblin;
CurNum = 0;
Fpos = 0;
+ Curpos = 1;
return false;
} // endif use
@@ -802,14 +836,12 @@ bool TDBODBC::OpenDB(PGLOBAL g)
/* and if so to allocate just a new result set. But this only for */
/* drivers allowing concurency in getting results ??? */
/*********************************************************************/
- if (!Ocp) {
+ if (!Ocp)
Ocp = new(g) ODBConn(g, this);
- Ocp->SetLoginTimeout((DWORD)Cto);
- Ocp->SetQueryTimeout((DWORD)Qto);
- } else if (Ocp->IsOpen())
+ else if (Ocp->IsOpen())
Ocp->Close();
- if (Ocp->Open(Connect, Options) < 1)
+ if (Ocp->Open(Connect, &Ops, Options) < 1)
return true;
else if (Quoted)
Quote = Ocp->GetQuoteChar();
@@ -820,6 +852,37 @@ bool TDBODBC::OpenDB(PGLOBAL g)
/* Make the command and allocate whatever is used for getting results. */
/*********************************************************************/
if (Mode == MODE_READ || Mode == MODE_READX) {
+ if (Memory > 1 && !Srcdef) {
+ char *Sql;
+ int n;
+
+ if ((Sql = MakeSQL(g, true))) {
+ // Allocate a Count(*) column
+ Cnp = new(g) ODBCCOL;
+ Cnp->InitValue(g);
+
+ if ((n = Ocp->GetResultSize(Sql, Cnp)) < 0) {
+ strcpy(g->Message, "Cannot get result size");
+ return true;
+ } // endif n
+
+ Ocp->m_Rows = n;
+
+ if ((Qrp = Ocp->AllocateResult(g)))
+ Memory = 2; // Must be filled
+ else {
+ strcpy(g->Message, "Memory allocation failed");
+ return true;
+ } // endif n
+
+ Ocp->m_Rows = 0;
+ } else {
+ strcpy(g->Message, "MakeSQL failed");
+ return true;
+ } // endif Sql
+
+ } // endif Memory
+
if ((Query = MakeSQL(g, false))) {
for (PODBCCOL colp = (PODBCCOL)Columns; colp;
colp = (PODBCCOL)colp->GetNext())
@@ -839,12 +902,12 @@ bool TDBODBC::OpenDB(PGLOBAL g)
} // endif Query
- } else if (Mode == MODE_UPDATE || Mode == MODE_DELETE)
- Query = MakeCommand(g);
- else
+ } else if (Mode == MODE_UPDATE || Mode == MODE_DELETE) {
+ rc = false; // wait for CheckCond before calling MakeCommand(g);
+ } else
sprintf(g->Message, "Invalid mode %d", Mode);
- if (!Query || rc) {
+ if (rc) {
Ocp->Close();
return true;
} // endif rc
@@ -861,10 +924,41 @@ bool TDBODBC::OpenDB(PGLOBAL g)
/***********************************************************************/
int TDBODBC::GetRecpos(void)
{
- return Fpos; // To be really implemented
+ return Fpos;
} // end of GetRecpos
/***********************************************************************/
+/* SetRecpos: set the position of next read record. */
+/***********************************************************************/
+bool TDBODBC::SetRecpos(PGLOBAL g, int recpos)
+ {
+ if (Ocp->m_Full) {
+ Fpos = 0;
+ CurNum = recpos - 1;
+ } else if (Memory == 3) {
+ Fpos = recpos;
+ CurNum = -1;
+ } else if (Scrollable) {
+ // Is new position in the current row set?
+ if (recpos >= Curpos && recpos < Curpos + Rbuf) {
+ CurNum = recpos - Curpos;
+ Fpos = 0;
+ } else {
+ Fpos = recpos;
+ CurNum = 0;
+ } // endif recpos
+
+ } else {
+ strcpy(g->Message, "This action requires a scrollable cursor");
+ return true;
+ } // endif's
+
+ // Indicate the table position was externally set
+ Placed = true;
+ return false;
+ } // end of SetRecpos
+
+/***********************************************************************/
/* VRDNDOS: Data Base read routine for odbc access method. */
/***********************************************************************/
int TDBODBC::ReadDB(PGLOBAL g)
@@ -876,6 +970,9 @@ int TDBODBC::ReadDB(PGLOBAL g)
GetTdb_No(), Mode, To_Key_Col, To_Link, To_Kindex);
if (Mode == MODE_UPDATE || Mode == MODE_DELETE) {
+ if (!Query && !(Query = MakeCommand(g)))
+ return RC_FX;
+
// Send the UPDATE/DELETE command to the remote table
if (!Ocp->ExecSQLcommand(Query)) {
sprintf(g->Message, "%s: %d affected rows", TableName, AftRows);
@@ -900,22 +997,32 @@ int TDBODBC::ReadDB(PGLOBAL g)
/* Now start the reading process. */
/* Here is the place to fetch the line(s). */
/*********************************************************************/
- if (Memory != 3) {
- if (++CurNum >= Rbuf) {
- Rbuf = Ocp->Fetch();
- CurNum = 0;
- } // endif CurNum
+ if (Placed) {
+ if (Fpos && CurNum >= 0)
+ Rbuf = Ocp->Fetch((Curpos = Fpos));
rc = (Rbuf > 0) ? RC_OK : (Rbuf == 0) ? RC_EF : RC_FX;
- } else // Getting result from memory
- rc = (Fpos < Qrp->Nblin) ? RC_OK : RC_EF;
+ Placed = false;
+ } else {
+ if (Memory != 3) {
+ if (++CurNum >= Rbuf) {
+ Rbuf = Ocp->Fetch();
+ Curpos = Fpos + 1;
+ CurNum = 0;
+ } // endif CurNum
- if (rc == RC_OK) {
- if (Memory == 2)
- Qrp->Nblin++;
+ rc = (Rbuf > 0) ? RC_OK : (Rbuf == 0) ? RC_EF : RC_FX;
+ } else // Getting result from memory
+ rc = (Fpos < Qrp->Nblin) ? RC_OK : RC_EF;
- Fpos++; // Used for memory
- } // endif rc
+ if (rc == RC_OK) {
+ if (Memory == 2)
+ Qrp->Nblin++;
+
+ Fpos++; // Used for memory and pos
+ } // endif rc
+
+ } // endif Placed
if (trace > 1)
htrc(" Read: Rbuf=%d rc=%d\n", Rbuf, rc);
@@ -945,6 +1052,9 @@ int TDBODBC::WriteDB(PGLOBAL g)
int TDBODBC::DeleteDB(PGLOBAL g, int irc)
{
if (irc == RC_FX) {
+ if (!Query && !(Query = MakeCommand(g)))
+ return RC_FX;
+
// Send the DELETE (all) command to the remote table
if (!Ocp->ExecSQLcommand(Query)) {
sprintf(g->Message, "%s: %d affected rows", TableName, AftRows);
@@ -1158,12 +1268,16 @@ void ODBCCOL::ReadColumn(PGLOBAL g)
} // endif Buf_Type
- if (g->Trace) {
+ // Handle null values
+ if (Value->IsZero())
+ Value->SetNull(Nullable);
+
+ if (trace) {
char buf[64];
htrc("ODBC Column %s: rows=%d buf=%p type=%d value=%s\n",
Name, tdbp->Rows, Bufp, Buf_Type, Value->GetCharString(buf));
- } // endif Trace
+ } // endif trace
put:
if (tdbp->Memory != 2)
@@ -1283,7 +1397,7 @@ void ODBCCOL::WriteColumn(PGLOBAL g)
/* -------------------------- Class TDBXDBC -------------------------- */
/***********************************************************************/
-/* Implementation of the TDBODBC class. */
+/* Implementation of the TDBXDBC class. */
/***********************************************************************/
TDBXDBC::TDBXDBC(PODEF tdp) : TDBODBC(tdp)
{
@@ -1397,7 +1511,7 @@ bool TDBXDBC::OpenDB(PGLOBAL g)
{
bool rc = false;
- if (g->Trace)
+ if (trace)
htrc("ODBC OpenDB: tdbp=%p tdb=R%d use=%dmode=%d\n",
this, Tdb_No, Use, Mode);
@@ -1415,12 +1529,10 @@ bool TDBXDBC::OpenDB(PGLOBAL g)
/*********************************************************************/
if (!Ocp) {
Ocp = new(g) ODBConn(g, this);
- Ocp->SetLoginTimeout((DWORD)Cto);
- Ocp->SetQueryTimeout((DWORD)Qto);
} else if (Ocp->IsOpen())
Ocp->Close();
- if (Ocp->Open(Connect, Options) < 1)
+ if (Ocp->Open(Connect, &Ops, Options) < 1)
return true;
Use = USE_OPEN; // Do it now in case we are recursively called
@@ -1554,8 +1666,11 @@ TDBOTB::TDBOTB(PODEF tdp) : TDBDRV(tdp)
Dsn = tdp->GetConnect();
Schema = tdp->GetTabschema();
Tab = tdp->GetTabname();
- Cto = tdp->Cto;
- Qto = tdp->Qto;
+ Ops.User = tdp->Username;
+ Ops.Pwd = tdp->Password;
+ Ops.Cto = tdp->Cto;
+ Ops.Qto = tdp->Qto;
+ Ops.UseCnc = tdp->UseCnc;
} // end of TDBOTB constructor
/***********************************************************************/
@@ -1563,7 +1678,7 @@ TDBOTB::TDBOTB(PODEF tdp) : TDBDRV(tdp)
/***********************************************************************/
PQRYRES TDBOTB::GetResult(PGLOBAL g)
{
- return ODBCTables(g, Dsn, Schema, Tab, Maxres, Cto, Qto, false);
+ return ODBCTables(g, Dsn, Schema, Tab, Maxres, false, &Ops);
} // end of GetResult
/* ---------------------------TDBOCL class --------------------------- */
@@ -1573,7 +1688,7 @@ PQRYRES TDBOTB::GetResult(PGLOBAL g)
/***********************************************************************/
PQRYRES TDBOCL::GetResult(PGLOBAL g)
{
- return ODBCColumns(g, Dsn, Schema, Tab, NULL, Maxres, Cto, Qto, false);
+ return ODBCColumns(g, Dsn, Schema, Tab, NULL, Maxres, false, &Ops);
} // end of GetResult
/* ------------------------ End of Tabodbc --------------------------- */
diff --git a/storage/connect/tabodbc.h b/storage/connect/tabodbc.h
index d8644c8b6de..b8c9d85aae5 100644
--- a/storage/connect/tabodbc.h
+++ b/storage/connect/tabodbc.h
@@ -50,6 +50,8 @@ class DllExport ODBCDEF : public TABDEF { /* Logical table description */
PSZ Connect; /* ODBC connection string */
PSZ Tabname; /* External table name */
PSZ Tabschema; /* External table schema */
+ PSZ Username; /* User connect name */
+ PSZ Password; /* Password connect info */
PSZ Tabcat; /* External table catalog */
PSZ Srcdef; /* The source table SQL definition */
PSZ Qchar; /* Identifier quoting character */
@@ -62,9 +64,10 @@ 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 */
+ int Memory; /* Put result set in memory */
bool Scrollable; /* Use scrollable cursor */
- bool Memory; /* Put result set in memory */
bool Xsrc; /* Execution type */
+ bool UseCnc; /* Use SQLConnect (!SQLDriverConnect) */
}; // end of ODBCDEF
#if !defined(NODBC)
@@ -90,6 +93,7 @@ class TDBODBC : public TDBASE {
// Methods
virtual PTDB CopyOne(PTABS t);
virtual int GetRecpos(void);
+ virtual bool SetRecpos(PGLOBAL g, int recpos);
virtual PSZ GetFile(PGLOBAL g);
virtual void SetFile(PGLOBAL g, PSZ fn);
virtual void ResetSize(void);
@@ -124,9 +128,12 @@ class TDBODBC : public TDBASE {
// Members
ODBConn *Ocp; // Points to an ODBC connection class
ODBCCOL *Cnp; // Points to count(*) column
+ ODBCPARM Ops; // Additional parameters
char *Connect; // Points to connection string
char *TableName; // Points to ODBC table name
char *Schema; // Points to ODBC table Schema
+ char *User; // User connect info
+ char *Pwd; // Password connect info
char *Catalog; // Points to ODBC table Catalog
char *Srcdef; // The source table SQL definition
char *Query; // Points to SQL statement
@@ -142,6 +149,7 @@ class TDBODBC : public TDBASE {
int Qto; // Query timeout
int Quoted; // The identifier quoting level
int Fpos; // Position of last read record
+ int Curpos; // Cursor position of last fetch
int AftRows; // The number of affected rows
int Rows; // Rowset size
int Catver; // Catalog ODBC version
@@ -151,6 +159,8 @@ class TDBODBC : public TDBASE {
int Nparm; // The number of statement parameters
int Memory; // 0: No 1: Alloc 2: Put 3: Get
bool Scrollable; // Use scrollable cursor
+ bool Placed; // True for position reading
+ bool UseCnc; // Use SQLConnect (!SQLDriverConnect)
PQRYRES Qrp; // Points to storage result
}; // end of class TDBODBC
@@ -316,8 +326,7 @@ class TDBOTB : public TDBDRV {
char *Dsn; // Points to connection string
char *Schema; // Points to schema name or NULL
char *Tab; // Points to ODBC table name or pattern
- int Cto; // Connect timeout
- int Qto; // Query timeout
+ ODBCPARM Ops; // Additional parameters
}; // end of class TDBOTB
/***********************************************************************/
diff --git a/storage/connect/tabpivot.cpp b/storage/connect/tabpivot.cpp
index 94e9d7187f0..b628e26d3c7 100644
--- a/storage/connect/tabpivot.cpp
+++ b/storage/connect/tabpivot.cpp
@@ -5,7 +5,7 @@
/* */
/* COPYRIGHT: */
/* ---------- */
-/* (C) Copyright to the author Olivier BERTRAND 2005-2013 */
+/* (C) Copyright to the author Olivier BERTRAND 2005-2015 */
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
@@ -17,7 +17,7 @@
/***********************************************************************/
#include "my_global.h"
#include "table.h" // MySQL table definitions
-#if defined(WIN32)
+#if defined(__WIN__)
#if defined(__BORLANDC__)
#define __MFC_COMPAT__ // To define min/max as macro
#endif
@@ -49,7 +49,6 @@
#include "tabpivot.h"
#include "valblk.h"
#include "ha_connect.h"
-#include "mycat.h" // For GetHandler
/***********************************************************************/
/* Make the Pivot table column list. */
@@ -150,11 +149,18 @@ PQRYRES PIVAID::MakePivotColumns(PGLOBAL g)
query = Tabsrc;
// Open a MySQL connection for this table
- if (Myc.Open(g, Host, Database, User, Pwd, Port))
- return NULL;
- else
+ if (!Myc.Open(g, Host, Database, User, Pwd, Port)) {
b = true;
+ // Returned values must be in their original character set
+ if (Myc.ExecSQL(g, "SET character_set_results=NULL", &w) == RC_FX)
+ goto err;
+ else
+ Myc.FreeResult();
+
+ } else
+ return NULL;
+
// Send the source command to MySQL
if (Myc.ExecSQL(g, query, &w) == RC_FX)
goto err;
@@ -241,6 +247,10 @@ PQRYRES PIVAID::MakePivotColumns(PGLOBAL g)
} else {
// The query was limited, we must get pivot column values
+ // Returned values must be in their original character set
+// if (Myc.ExecSQL(g, "SET character_set_results=NULL", &w) == RC_FX)
+// goto err;
+
query = (char*)PlugSubAlloc(g, NULL, 0);
sprintf(query, "SELECT DISTINCT `%s` FROM `%s`", Picol, Tabname);
PlugSubAlloc(g, NULL, strlen(query) + 1);
@@ -284,8 +294,7 @@ PQRYRES PIVAID::MakePivotColumns(PGLOBAL g)
valp->SetValue_pvblk(Rblkp, i);
colname = valp->GetCharString(buf);
- crp->Name = (char*)PlugSubAlloc(g, NULL, strlen(colname) + 1);
- strcpy(crp->Name, colname);
+ crp->Name = PlugDup(g, colname);
crp->Flag = 1;
// Add this column
@@ -367,7 +376,7 @@ bool PIVOTDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
/***********************************************************************/
/* GetTable: makes a new TDB of the proper type. */
/***********************************************************************/
-PTDB PIVOTDEF::GetTable(PGLOBAL g, MODE m)
+PTDB PIVOTDEF::GetTable(PGLOBAL g, MODE)
{
return new(g) TDBPIVOT(this);
} // end of GetTable
@@ -558,7 +567,7 @@ bool TDBPIVOT::MakePivotColumns(PGLOBAL g)
// Check and initialize the subtable columns
for (PCOL cp = Columns; cp; cp = cp->GetNext())
if (cp->GetAmType() == TYPE_AM_SRC) {
- if (((PSRCCOL)cp)->Init(g))
+ if (((PSRCCOL)cp)->Init(g, NULL))
return TRUE;
} else if (cp->GetAmType() == TYPE_AM_FNC)
@@ -625,7 +634,7 @@ bool TDBPIVOT::MakeViewColumns(PGLOBAL g)
/***********************************************************************/
/* PIVOT GetMaxSize: returns the maximum number of rows in the table. */
/***********************************************************************/
-int TDBPIVOT::GetMaxSize(PGLOBAL g)
+int TDBPIVOT::GetMaxSize(PGLOBAL g __attribute__((unused)))
{
#if 0
if (MaxSize < 0)
@@ -640,7 +649,7 @@ int TDBPIVOT::GetMaxSize(PGLOBAL g)
/* In this sample, ROWID will be the (virtual) row number, */
/* while ROWNUM will be the occurence rank in the multiple column. */
/***********************************************************************/
-int TDBPIVOT::RowNumber(PGLOBAL g, bool b)
+int TDBPIVOT::RowNumber(PGLOBAL, bool b)
{
return (b) ? M : N;
} // end of RowNumber
@@ -797,7 +806,7 @@ int TDBPIVOT::WriteDB(PGLOBAL g)
/***********************************************************************/
/* Data Base delete line routine for PIVOT access methods. */
/***********************************************************************/
-int TDBPIVOT::DeleteDB(PGLOBAL g, int irc)
+int TDBPIVOT::DeleteDB(PGLOBAL g, int)
{
sprintf(g->Message, MSG(NO_TABLE_DEL), "PIVOT");
return RC_FX;
@@ -874,9 +883,9 @@ SRCCOL::SRCCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int n)
/***********************************************************************/
/* Initialize the column as pointing to the source column. */
/***********************************************************************/
-bool SRCCOL::Init(PGLOBAL g)
+bool SRCCOL::Init(PGLOBAL g, PTDBASE tp)
{
- if (PRXCOL::Init(g))
+ if (PRXCOL::Init(g, tp))
return true;
AddStatus(BUF_READ); // All is done here
diff --git a/storage/connect/tabpivot.h b/storage/connect/tabpivot.h
index 25d139e895f..c397af05234 100644
--- a/storage/connect/tabpivot.h
+++ b/storage/connect/tabpivot.h
@@ -180,9 +180,10 @@ class SRCCOL : public PRXCOL {
virtual int GetAmType(void) {return TYPE_AM_SRC;}
// Methods
+ using PRXCOL::Init;
virtual void Reset(void) {}
void SetColumn(void);
- bool Init(PGLOBAL g);
+ virtual bool Init(PGLOBAL g, PTDBASE tp);
bool CompareLast(void);
protected:
diff --git a/storage/connect/tabsys.cpp b/storage/connect/tabsys.cpp
index 3ed182c5e33..76890e84429 100644
--- a/storage/connect/tabsys.cpp
+++ b/storage/connect/tabsys.cpp
@@ -3,7 +3,7 @@
/* ------------- */
/* Version 2.3 */
/* */
-/* Author Olivier BERTRAND 2004-2014 */
+/* Author Olivier BERTRAND 2004-2015 */
/* */
/* This program are the INI/CFG tables classes. */
/***********************************************************************/
@@ -12,12 +12,12 @@
/* Include relevant sections of the System header files. */
/***********************************************************************/
#include "my_global.h"
-#if defined(WIN32)
+#if defined(__WIN__)
#if defined(__BORLANDC__)
#define __MFC_COMPAT__ // To define min/max as macro
#endif // __BORLANDC__
//#include <windows.h>
-#else // !WIN32
+#else // !__WIN__
#if defined(UNIX)
#include <errno.h>
#include <unistd.h>
@@ -25,7 +25,7 @@
#include <io.h>
#endif // !UNIX
#include <fcntl.h>
-#endif // !WIN32
+#endif // !__WIN__
/***********************************************************************/
/* Include application header files: */
@@ -36,9 +36,9 @@
#include "global.h"
#include "plgdbsem.h"
#include "reldef.h"
-#if !defined(WIN32)
+#if !defined(__WIN__)
#include "osutil.h"
-#endif // !WIN32
+#endif // !__WIN__
#include "filamtxt.h"
#include "tabdos.h"
#include "tabsys.h"
@@ -48,10 +48,10 @@
#define CSZ 36 // Column section name length
#define CDZ 256 // Column definition length
-#if !defined(WIN32)
+#if !defined(__WIN__)
#define GetPrivateProfileSectionNames(S,L,I) \
GetPrivateProfileString(NULL,NULL,"",S,L,I)
-#endif // !WIN32
+#endif // !__WIN__
/* -------------- Implementation of the INI classes ------------------ */
@@ -70,7 +70,7 @@ INIDEF::INIDEF(void)
/***********************************************************************/
/* DefineAM: define specific AM block values from XDB file. */
/***********************************************************************/
-bool INIDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
+bool INIDEF::DefineAM(PGLOBAL g, LPCSTR, int)
{
char buf[8];
@@ -96,7 +96,7 @@ bool INIDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
/***********************************************************************/
/* GetTable: makes a new TDB of the proper type. */
/***********************************************************************/
-PTDB INIDEF::GetTable(PGLOBAL g, MODE m)
+PTDB INIDEF::GetTable(PGLOBAL g, MODE)
{
PTDBASE tdbp;
@@ -123,7 +123,7 @@ bool INIDEF::DeleteTableFile(PGLOBAL g)
// Delete the INI table file if not protected
if (!IsReadOnly()) {
PlugSetPath(filename, Fn, GetPath());
-#if defined(WIN32)
+#if defined(__WIN__)
rc = !DeleteFile(filename);
#else // UNIX
rc = remove(filename);
@@ -277,49 +277,27 @@ bool TDBINI::OpenDB(PGLOBAL g)
/***********************************************************************/
/* Data Base read routine for INI access method. */
/***********************************************************************/
-int TDBINI::ReadDB(PGLOBAL g)
+int TDBINI::ReadDB(PGLOBAL)
{
/*********************************************************************/
/* Now start the pseudo reading process. */
/*********************************************************************/
-#if 0 // INI tables are not indexable
- if (To_Kindex) {
- /*******************************************************************/
- /* Reading is by an index table. */
- /*******************************************************************/
- int recpos = To_Kindex->Fetch(g);
-
- switch (recpos) {
- case -1: // End of file reached
- return RC_EF;
- case -2: // No match for join
- return RC_NF;
- case -3: // Same record as last non null one
- return RC_OK;
- default:
- Section = (char*)recpos; // No good on 64 bit machines
- } // endswitch recpos
-
- } else {
-#endif // 0
- if (!Section)
- Section = Seclist;
- else
- Section += (strlen(Section) + 1);
-
- if (trace > 1)
- htrc("INI ReadDB: section=%s N=%d\n", Section, N);
+ if (!Section)
+ Section = Seclist;
+ else
+ Section += (strlen(Section) + 1);
- N++;
-//} // endif To_Kindex
+ if (trace > 1)
+ htrc("INI ReadDB: section=%s N=%d\n", Section, N);
+ N++;
return (*Section) ? RC_OK : RC_EF;
} // end of ReadDB
/***********************************************************************/
/* WriteDB: Data Base write routine for INI access methods. */
/***********************************************************************/
-int TDBINI::WriteDB(PGLOBAL g)
+int TDBINI::WriteDB(PGLOBAL)
{
// This is to check that section name was given when inserting
if (Mode == MODE_INSERT)
@@ -365,11 +343,11 @@ int TDBINI::DeleteDB(PGLOBAL g, int irc)
/***********************************************************************/
/* Data Base close routine for INI access methods. */
/***********************************************************************/
-void TDBINI::CloseDB(PGLOBAL g)
+void TDBINI::CloseDB(PGLOBAL)
{
-#if !defined(WIN32)
+#if !defined(__WIN__)
PROFILE_Close(Ifile);
-#endif // !WIN32
+#endif // !__WIN__
} // end of CloseDB
// ------------------------ INICOL functions ----------------------------
@@ -377,7 +355,7 @@ void TDBINI::CloseDB(PGLOBAL g)
/***********************************************************************/
/* INICOL public constructor. */
/***********************************************************************/
-INICOL::INICOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PSZ am)
+INICOL::INICOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PSZ)
: COLBLK(cdp, tdbp, i)
{
if (cprec) {
@@ -471,7 +449,7 @@ bool INICOL::SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check)
/* from the corresponding section, extract from it the key value */
/* corresponding to this column name and convert it to buffer type. */
/***********************************************************************/
-void INICOL::ReadColumn(PGLOBAL g)
+void INICOL::ReadColumn(PGLOBAL)
{
PTDBINI tdbp = (PTDBINI)To_Tdb;
@@ -747,7 +725,7 @@ int TDBXIN::ReadDB(PGLOBAL g)
/***********************************************************************/
/* WriteDB: Data Base write routine for XIN access methods. */
/***********************************************************************/
-int TDBXIN::WriteDB(PGLOBAL g)
+int TDBXIN::WriteDB(PGLOBAL)
{
// To check that section and key names were given when inserting
if (Mode == MODE_INSERT) {
@@ -809,7 +787,7 @@ XINCOL::XINCOL(XINCOL *col1, PTDB tdbp) : INICOL(col1, tdbp)
/* from the corresponding section, extract from it the key value */
/* corresponding to this column name and convert it to buffer type. */
/***********************************************************************/
-void XINCOL::ReadColumn(PGLOBAL g)
+void XINCOL::ReadColumn(PGLOBAL)
{
PTDBXIN tdbp = (PTDBXIN)To_Tdb;
diff --git a/storage/connect/tabsys.h b/storage/connect/tabsys.h
index aa45c260bc2..6b454322906 100644
--- a/storage/connect/tabsys.h
+++ b/storage/connect/tabsys.h
@@ -1,182 +1,182 @@
-/*************** TabSys H Declares Source Code File (.H) ***************/
-/* Name: TABSYS.H Version 2.3 */
-/* */
-/* (C) Copyright to the author Olivier BERTRAND 2004-2014 */
-/* */
-/* This file contains the XDB system tables classes declares. */
-/***********************************************************************/
-typedef class INIDEF *PINIDEF;
-typedef class TDBINI *PTDBINI;
-typedef class INICOL *PINICOL;
-typedef class TDBXIN *PTDBXIN;
-typedef class XINCOL *PXINCOL;
-
-/* --------------------------- INI classes --------------------------- */
-
-/***********************************************************************/
-/* INI, XDB and XCL tables. */
-/***********************************************************************/
-class DllExport INIDEF : public TABDEF { /* INI table description */
- friend class TDBINI;
- friend class TDBXIN;
- friend class TDBXTB;
- friend class TDBRTB;
- friend class TDBXCL;
- public:
- // Constructor
- INIDEF(void);
-
- // Implementation
- virtual const char *GetType(void) {return "INI";}
-
- // Methods
- virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff);
- virtual PTDB GetTable(PGLOBAL g, MODE m);
-
- protected:
- // Members
- char *Fn; /* Path/Name of corresponding file */
- char *Xname; /* The eventual table name */
- char Layout; /* R: Row, C: Column */
- int Ln; /* Length of section list buffer */
- }; // end of INIDEF
-
-/***********************************************************************/
-/* This is the class declaration for the INI tables. */
-/* These are tables represented by a INI like file. */
-/***********************************************************************/
-class TDBINI : public TDBASE {
- friend class INICOL;
- public:
- // Constructor
- TDBINI(PINIDEF tdp);
- TDBINI(PTDBINI tdbp);
-
- // Implementation
- virtual AMT GetAmType(void) {return TYPE_AM_INI;}
- virtual PTDB Duplicate(PGLOBAL g) {return (PTDB)new(g) TDBINI(this);}
-
- // Methods
- virtual PTDB CopyOne(PTABS t);
- virtual int GetRecpos(void) {return N;}
- virtual int GetProgCur(void) {return N;}
-//virtual int GetAffectedRows(void) {return 0;}
- virtual PSZ GetFile(PGLOBAL g) {return Ifile;}
- virtual void SetFile(PGLOBAL g, PSZ fn) {Ifile = fn;}
- virtual void ResetDB(void) {Seclist = Section = NULL; N = 0;}
- virtual void ResetSize(void) {MaxSize = -1; Seclist = NULL;}
- virtual int RowNumber(PGLOBAL g, bool b = false) {return N;}
- char *GetSeclist(PGLOBAL g);
-
- // Database routines
- virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n);
- virtual int Cardinality(PGLOBAL 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:
- // Members
- char *Ifile; // The INI file
- char *Seclist; // The section list
- char *Section; // The current section
- int Seclen; // Length of seclist buffer
- int N; // The current section index
- }; // end of class TDBINI
-
-/***********************************************************************/
-/* Class INICOL: XDB table access method column descriptor. */
-/***********************************************************************/
-class INICOL : public COLBLK {
- public:
- // Constructors
- INICOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PSZ am = "INI");
- INICOL(INICOL *colp, PTDB tdbp); // Constructor used in copy process
-
- // Implementation
- virtual int GetAmType(void) {return TYPE_AM_INI;}
- virtual void SetTo_Val(PVAL valp) {To_Val = valp;}
-
- // Methods
- virtual bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check);
- virtual void ReadColumn(PGLOBAL g);
- virtual void WriteColumn(PGLOBAL g);
- virtual void AllocBuf(PGLOBAL g);
-
- protected:
- // Default constructor not to be used
- INICOL(void) {}
-
- // Members
- char *Valbuf; // To the key value buffer
- int Flag; // Tells what set in value
- int Long; // Buffer length
- PVAL To_Val; // To value used for Update/Insert
- }; // end of class INICOL
-
-/* --------------------------- XINI class ---------------------------- */
-
-/***********************************************************************/
-/* This is the class declaration for the XINI tables. */
-/* These are tables represented by a INI like file */
-/* having 3 columns Section, Key, and Value. */
-/***********************************************************************/
-class TDBXIN : public TDBINI {
- friend class XINCOL;
- public:
- // Constructor
- TDBXIN(PINIDEF tdp);
- TDBXIN(PTDBXIN tdbp);
-
- // Implementation
- virtual AMT GetAmType(void) {return TYPE_AM_INI;}
- virtual PTDB Duplicate(PGLOBAL g) {return (PTDB)new(g) TDBXIN(this);}
-
- // Methods
- virtual PTDB CopyOne(PTABS t);
- virtual int GetRecpos(void);
- virtual bool SetRecpos(PGLOBAL g, int recpos);
- virtual void ResetDB(void)
- {Seclist = Section = Keycur = NULL; N = 0; Oldsec = -1;}
- char *GetKeylist(PGLOBAL g, char *sec);
-
- // Database routines
- virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n);
- virtual int Cardinality(PGLOBAL g);
- virtual bool OpenDB(PGLOBAL g);
- virtual int ReadDB(PGLOBAL g);
- virtual int WriteDB(PGLOBAL g);
- virtual int DeleteDB(PGLOBAL g, int irc);
-
- protected:
- // Members
- char *Keylist; // The key list
- char *Keycur; // The current key
- int Keylen; // Length of keylist buffer
- short Oldsec; // Last current section
- }; // end of class TDBXIN
-
-/***********************************************************************/
-/* Class XINCOL: XIN table access method column descriptor. */
-/***********************************************************************/
-class XINCOL : public INICOL {
- public:
- // Constructors
- XINCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PSZ am = "INI");
- XINCOL(XINCOL *colp, PTDB tdbp); // Constructor used in copy process
-
- // Implementation
-
- // Methods
- virtual void ReadColumn(PGLOBAL g);
- virtual void WriteColumn(PGLOBAL g);
-
- protected:
- // Default constructor not to be used
- XINCOL(void) {}
-
- // Members
- }; // end of class XINICOL
+/*************** TabSys H Declares Source Code File (.H) ***************/
+/* Name: TABSYS.H Version 2.3 */
+/* */
+/* (C) Copyright to the author Olivier BERTRAND 2004-2014 */
+/* */
+/* This file contains the XDB system tables classes declares. */
+/***********************************************************************/
+typedef class INIDEF *PINIDEF;
+typedef class TDBINI *PTDBINI;
+typedef class INICOL *PINICOL;
+typedef class TDBXIN *PTDBXIN;
+typedef class XINCOL *PXINCOL;
+
+/* --------------------------- INI classes --------------------------- */
+
+/***********************************************************************/
+/* INI, XDB and XCL tables. */
+/***********************************************************************/
+class DllExport INIDEF : public TABDEF { /* INI table description */
+ friend class TDBINI;
+ friend class TDBXIN;
+ friend class TDBXTB;
+ friend class TDBRTB;
+ friend class TDBXCL;
+ public:
+ // Constructor
+ INIDEF(void);
+
+ // Implementation
+ virtual const char *GetType(void) {return "INI";}
+
+ // Methods
+ virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff);
+ virtual PTDB GetTable(PGLOBAL g, MODE m);
+
+ protected:
+ // Members
+ char *Fn; /* Path/Name of corresponding file */
+ char *Xname; /* The eventual table name */
+ char Layout; /* R: Row, C: Column */
+ int Ln; /* Length of section list buffer */
+ }; // end of INIDEF
+
+/***********************************************************************/
+/* This is the class declaration for the INI tables. */
+/* These are tables represented by a INI like file. */
+/***********************************************************************/
+class TDBINI : public TDBASE {
+ friend class INICOL;
+ public:
+ // Constructor
+ TDBINI(PINIDEF tdp);
+ TDBINI(PTDBINI tdbp);
+
+ // Implementation
+ virtual AMT GetAmType(void) {return TYPE_AM_INI;}
+ virtual PTDB Duplicate(PGLOBAL g) {return (PTDB)new(g) TDBINI(this);}
+
+ // Methods
+ virtual PTDB CopyOne(PTABS t);
+ virtual int GetRecpos(void) {return N;}
+ virtual int GetProgCur(void) {return N;}
+//virtual int GetAffectedRows(void) {return 0;}
+ virtual PSZ GetFile(PGLOBAL g) {return Ifile;}
+ virtual void SetFile(PGLOBAL g, PSZ fn) {Ifile = fn;}
+ virtual void ResetDB(void) {Seclist = Section = NULL; N = 0;}
+ virtual void ResetSize(void) {MaxSize = -1; Seclist = NULL;}
+ virtual int RowNumber(PGLOBAL g, bool b = false) {return N;}
+ char *GetSeclist(PGLOBAL g);
+
+ // Database routines
+ virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n);
+ virtual int Cardinality(PGLOBAL 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:
+ // Members
+ char *Ifile; // The INI file
+ char *Seclist; // The section list
+ char *Section; // The current section
+ int Seclen; // Length of seclist buffer
+ int N; // The current section index
+ }; // end of class TDBINI
+
+/***********************************************************************/
+/* Class INICOL: XDB table access method column descriptor. */
+/***********************************************************************/
+class INICOL : public COLBLK {
+ public:
+ // Constructors
+ INICOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PSZ am = "INI");
+ INICOL(INICOL *colp, PTDB tdbp); // Constructor used in copy process
+
+ // Implementation
+ virtual int GetAmType(void) {return TYPE_AM_INI;}
+ virtual void SetTo_Val(PVAL valp) {To_Val = valp;}
+
+ // Methods
+ virtual bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check);
+ virtual void ReadColumn(PGLOBAL g);
+ virtual void WriteColumn(PGLOBAL g);
+ virtual void AllocBuf(PGLOBAL g);
+
+ protected:
+ // Default constructor not to be used
+ INICOL(void) {}
+
+ // Members
+ char *Valbuf; // To the key value buffer
+ int Flag; // Tells what set in value
+ int Long; // Buffer length
+ PVAL To_Val; // To value used for Update/Insert
+ }; // end of class INICOL
+
+/* --------------------------- XINI class ---------------------------- */
+
+/***********************************************************************/
+/* This is the class declaration for the XINI tables. */
+/* These are tables represented by a INI like file */
+/* having 3 columns Section, Key, and Value. */
+/***********************************************************************/
+class TDBXIN : public TDBINI {
+ friend class XINCOL;
+ public:
+ // Constructor
+ TDBXIN(PINIDEF tdp);
+ TDBXIN(PTDBXIN tdbp);
+
+ // Implementation
+ virtual AMT GetAmType(void) {return TYPE_AM_INI;}
+ virtual PTDB Duplicate(PGLOBAL g) {return (PTDB)new(g) TDBXIN(this);}
+
+ // Methods
+ virtual PTDB CopyOne(PTABS t);
+ virtual int GetRecpos(void);
+ virtual bool SetRecpos(PGLOBAL g, int recpos);
+ virtual void ResetDB(void)
+ {Seclist = Section = Keycur = NULL; N = 0; Oldsec = -1;}
+ char *GetKeylist(PGLOBAL g, char *sec);
+
+ // Database routines
+ virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n);
+ virtual int Cardinality(PGLOBAL g);
+ virtual bool OpenDB(PGLOBAL g);
+ virtual int ReadDB(PGLOBAL g);
+ virtual int WriteDB(PGLOBAL g);
+ virtual int DeleteDB(PGLOBAL g, int irc);
+
+ protected:
+ // Members
+ char *Keylist; // The key list
+ char *Keycur; // The current key
+ int Keylen; // Length of keylist buffer
+ short Oldsec; // Last current section
+ }; // end of class TDBXIN
+
+/***********************************************************************/
+/* Class XINCOL: XIN table access method column descriptor. */
+/***********************************************************************/
+class XINCOL : public INICOL {
+ public:
+ // Constructors
+ XINCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PSZ am = "INI");
+ XINCOL(XINCOL *colp, PTDB tdbp); // Constructor used in copy process
+
+ // Implementation
+
+ // Methods
+ virtual void ReadColumn(PGLOBAL g);
+ virtual void WriteColumn(PGLOBAL g);
+
+ protected:
+ // Default constructor not to be used
+ XINCOL(void) {}
+
+ // Members
+ }; // end of class XINICOL
diff --git a/storage/connect/tabtbl.cpp b/storage/connect/tabtbl.cpp
index 22ec3849b6f..7f979eaf4be 100644
--- a/storage/connect/tabtbl.cpp
+++ b/storage/connect/tabtbl.cpp
@@ -5,7 +5,7 @@
/* */
/* COPYRIGHT: */
/* ---------- */
-/* (C) Copyright to PlugDB Software Development 2008-2014 */
+/* (C) Copyright to PlugDB Software Development 2008-2015 */
/* Author: Olivier BERTRAND */
/* */
/* WHAT THIS PROGRAM DOES: */
@@ -39,7 +39,7 @@
//#include "sql_base.h"
#include "my_global.h"
#include "table.h" // MySQL table definitions
-#if defined(WIN32)
+#if defined(__WIN__)
#include <stdlib.h>
#include <stdio.h>
#if defined(__BORLANDC__)
@@ -70,21 +70,18 @@
#include "tabcol.h"
#include "tabdos.h" // TDBDOS and DOSCOL class dcls
#include "tabtbl.h"
-#if defined(MYSQL_SUPPORT)
#include "tabmysql.h"
-#endif // MYSQL_SUPPORT
#include "ha_connect.h"
-#include "mycat.h" // For GetHandler
-#if defined(WIN32)
+#if defined(__WIN__)
#if defined(__BORLANDC__)
#define SYSEXIT void _USERENTRY
#else
#define SYSEXIT void
#endif
-#else // !WIN32
+#else // !__WIN__
#define SYSEXIT void *
-#endif // !WIN32
+#endif // !__WIN__
/* ---------------------------- Class TBLDEF ---------------------------- */
@@ -104,7 +101,7 @@ TBLDEF::TBLDEF(void)
/**************************************************************************/
/* DefineAM: define specific AM block values from XDB file. */
/**************************************************************************/
-bool TBLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
+bool TBLDEF::DefineAM(PGLOBAL g, LPCSTR, int)
{
char *tablist, *dbname, *def = NULL;
@@ -164,7 +161,7 @@ bool TBLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
/***********************************************************************/
/* GetTable: makes a new Table Description Block. */
/***********************************************************************/
-PTDB TBLDEF::GetTable(PGLOBAL g, MODE m)
+PTDB TBLDEF::GetTable(PGLOBAL g, MODE)
{
if (Catfunc == FNC_COL)
return new(g) TDBTBC(this);
@@ -205,7 +202,7 @@ PCOL TDBTBL::MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n)
/***********************************************************************/
/* InsertSpecialColumn: Put a special column ahead of the column list.*/
/***********************************************************************/
-PCOL TDBTBL::InsertSpecialColumn(PGLOBAL g, PCOL scp)
+PCOL TDBTBL::InsertSpecialColumn(PCOL scp)
{
PCOL colp;
@@ -266,7 +263,7 @@ bool TDBTBL::InitTableList(PGLOBAL g)
// Real initialization will be done later.
for (colp = Columns; colp; colp = colp->GetNext())
if (!colp->IsSpecial())
- if (((PPRXCOL)colp)->Init(g) && !Accept)
+ if (((PPRXCOL)colp)->Init(g, NULL) && !Accept)
return TRUE;
if (Tablist)
@@ -352,7 +349,9 @@ bool TDBTBL::TestFil(PGLOBAL g, PCFIL filp, PTABLE tabp)
/***********************************************************************/
int TDBTBL::Cardinality(PGLOBAL g)
{
- if (Cardinal < 0) {
+ if (!g)
+ return 0; // Cannot make the table list
+ else if (Cardinal < 0) {
int tsz;
if (!Tablist && InitTableList(g))
@@ -468,7 +467,7 @@ bool TDBTBL::OpenDB(PGLOBAL g)
for (PCOL cp = Columns; cp; cp = cp->GetNext())
if (cp->GetAmType() == TYPE_AM_TABID)
cp->COLBLK::Reset();
- else if (((PPRXCOL)cp)->Init(g) && !Accept)
+ else if (((PPRXCOL)cp)->Init(g, NULL) && !Accept)
return TRUE;
if (trace)
@@ -523,7 +522,7 @@ int TDBTBL::ReadDB(PGLOBAL g)
if (cp->GetAmType() == TYPE_AM_TABID ||
cp->GetAmType() == TYPE_AM_SRVID)
cp->COLBLK::Reset();
- else if (((PPRXCOL)cp)->Init(g) && !Accept)
+ else if (((PPRXCOL)cp)->Init(g, NULL) && !Accept)
return RC_FX;
if (trace)
@@ -549,7 +548,7 @@ int TDBTBL::ReadDB(PGLOBAL g)
/***********************************************************************/
/* ReadColumn: */
/***********************************************************************/
-void TBTBLK::ReadColumn(PGLOBAL g)
+void TBTBLK::ReadColumn(PGLOBAL)
{
if (trace)
htrc("TBT ReadColumn: name=%s\n", Name);
@@ -716,7 +715,7 @@ bool TDBTBM::OpenDB(PGLOBAL g)
for (PCOL cp = Columns; cp; cp = cp->GetNext())
if (cp->GetAmType() == TYPE_AM_TABID)
cp->COLBLK::Reset();
- else if (((PPRXCOL)cp)->Init(g) && !Accept)
+ else if (((PPRXCOL)cp)->Init(g, NULL) && !Accept)
return TRUE;
if (trace)
@@ -807,7 +806,7 @@ int TDBTBM::ReadNextRemote(PGLOBAL g)
for (PCOL cp = Columns; cp; cp = cp->GetNext())
if (cp->GetAmType() == TYPE_AM_TABID)
cp->COLBLK::Reset();
- else if (((PPRXCOL)cp)->Init(g) && !Accept)
+ else if (((PPRXCOL)cp)->Init(g, NULL) && !Accept)
return RC_FX;
if (trace)
diff --git a/storage/connect/tabtbl.h b/storage/connect/tabtbl.h
index 8bf440985ea..9d3f297f9e7 100644
--- a/storage/connect/tabtbl.h
+++ b/storage/connect/tabtbl.h
@@ -81,7 +81,7 @@ class DllExport TDBTBL : public TDBPRX {
virtual int Cardinality(PGLOBAL g);
virtual int GetMaxSize(PGLOBAL g);
virtual int RowNumber(PGLOBAL g, bool b = FALSE);
- virtual PCOL InsertSpecialColumn(PGLOBAL g, PCOL scp);
+ virtual PCOL InsertSpecialColumn(PCOL scp);
virtual bool OpenDB(PGLOBAL g);
virtual int ReadDB(PGLOBAL g);
diff --git a/storage/connect/tabutil.cpp b/storage/connect/tabutil.cpp
index d469594916f..331a7f45d4d 100644
--- a/storage/connect/tabutil.cpp
+++ b/storage/connect/tabutil.cpp
@@ -1,7 +1,7 @@
/************* Tabutil cpp Declares Source Code File (.CPP) ************/
-/* Name: TABUTIL.CPP Version 1.0 */
+/* Name: TABUTIL.CPP Version 1.1 */
/* */
-/* (C) Copyright to the author Olivier BERTRAND 2013 */
+/* (C) Copyright to the author Olivier BERTRAND 2013 - 2015 */
/* */
/* Utility function used by the PROXY, XCOL, OCCUR, and TBL tables. */
/***********************************************************************/
@@ -9,11 +9,12 @@
/***********************************************************************/
/* Include relevant section of system dependant header files. */
/***********************************************************************/
-#include "my_global.h"
+#define MYSQL_SERVER 1
+#include <my_global.h>
#include "sql_class.h"
#include "table.h"
#include "field.h"
-#if defined(WIN32)
+#if defined(__WIN__)
#include <stdlib.h>
#include <stdio.h>
#if defined(__BORLANDC__)
@@ -42,19 +43,16 @@
#include "plgdbsem.h"
#include "plgcnx.h" // For DB types
#include "myutil.h"
-#include "mycat.h"
#include "valblk.h"
#include "resource.h"
#include "reldef.h"
#include "xtable.h"
-#if defined(MYSQL_SUPPORT)
#include "tabmysql.h"
-#endif // MYSQL_SUPPORT
#include "tabcol.h"
#include "tabutil.h"
#include "ha_connect.h"
-extern "C" int zconv;
+int GetConvSize(void);
/************************************************************************/
/* Used by MYSQL tables to get MySQL parameters from the calling proxy */
@@ -73,11 +71,8 @@ TABLE_SHARE *GetTableShare(PGLOBAL g, THD *thd, const char *db,
{
char key[256];
uint k;
-//TABLE_LIST table_list;
TABLE_SHARE *s;
-//table_list.init_one_table(db, strlen(db), name, strlen(name),
-// NULL, TL_IGNORE);
k = sprintf(key, "%s", db) + 1;
k += sprintf(key + k, "%s", name);
key[++k] = 0;
@@ -87,26 +82,20 @@ TABLE_SHARE *GetTableShare(PGLOBAL g, THD *thd, const char *db,
return NULL;
} // endif s
-// 1 2 4 8
-//flags = GTS_TABLE | GTS_VIEW | GTS_NOLOCK | GTS_FORCE_DISCOVERY;
-
if (!open_table_def(thd, s, GTS_TABLE | GTS_VIEW)) {
if (!s->is_view) {
- if (stricmp(plugin_name(s->db_plugin)->str, "connect")) {
-#if defined(MYSQL_SUPPORT)
+ if (stricmp(plugin_name(s->db_plugin)->str, "connect"))
mysql = true;
-#else // !MYSQL_SUPPORT
- sprintf(g->Message, "%s.%s is not a CONNECT table", db, name);
- return NULL;
-#endif // MYSQL_SUPPORT
- } else
+ else
mysql = false;
- } else {
+ } else
mysql = true;
- } // endif is_view
} else {
+ if (thd->is_error())
+ thd->clear_error(); // Avoid stopping info commands
+
sprintf(g->Message, "Error %d opening share\n", s->error);
free_table_share(s);
return NULL;
@@ -132,6 +121,7 @@ PQRYRES TabColumns(PGLOBAL g, THD *thd, const char *db,
char *fld, *colname, *chset, *fmt, v;
int i, n, ncol = sizeof(buftyp) / sizeof(int);
int prec, len, type, scale;
+ int zconv = GetConvSize();
bool mysql;
TABLE_SHARE *s = NULL;
Field* *field;
@@ -302,7 +292,7 @@ PRXDEF::PRXDEF(void)
/***********************************************************************/
/* DefineAM: define specific AM block values from XCOL file. */
/***********************************************************************/
-bool PRXDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
+bool PRXDEF::DefineAM(PGLOBAL g, LPCSTR, int)
{
char *pn, *db, *tab, *def = NULL;
@@ -332,7 +322,7 @@ bool PRXDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
/***********************************************************************/
/* GetTable: makes a new TDB of the proper type. */
/***********************************************************************/
-PTDB PRXDEF::GetTable(PGLOBAL g, MODE mode)
+PTDB PRXDEF::GetTable(PGLOBAL g, MODE)
{
if (Catfunc == FNC_COL)
return new(g) TDBTBC(this);
@@ -351,7 +341,7 @@ TDBPRX::TDBPRX(PPRXDEF tdp) : TDBASE(tdp)
Tdbp = NULL; // The object table
} // end of TDBPRX constructor
-TDBPRX::TDBPRX(PGLOBAL g, PTDBPRX tdbp) : TDBASE(tdbp)
+TDBPRX::TDBPRX(PTDBPRX tdbp) : TDBASE(tdbp)
{
Tdbp = tdbp->Tdbp;
} // end of TDBPRX copy constructor
@@ -363,7 +353,7 @@ PTDB TDBPRX::CopyOne(PTABS t)
PPRXCOL cp1, cp2;
PGLOBAL g = t->G;
- tp = new(g) TDBPRX(g, this);
+ tp = new(g) TDBPRX(this);
for (cp1 = (PPRXCOL)Columns; cp1; cp1 = (PPRXCOL)cp1->GetNext()) {
cp2 = new(g) PRXCOL(cp1, tp); // Make a copy
@@ -422,7 +412,6 @@ PTDBASE TDBPRX::GetSubTable(PGLOBAL g, PTABLE tabp, bool b)
} // endif srcdef
if (mysql) {
-#if defined(MYSQL_SUPPORT)
// Access sub-table via MySQL API
if (!(tdbp= cat->GetTable(g, tabp, Mode, "MYPRX"))) {
char buf[MAX_STR];
@@ -439,11 +428,6 @@ PTDBASE TDBPRX::GetSubTable(PGLOBAL g, PTABLE tabp, bool b)
if (Mode == MODE_UPDATE || Mode == MODE_DELETE)
tdbp->SetName(Name); // For Make_Command
-#else // !MYSQL_SUPPORT
- sprintf(g->Message, "%s.%s is not a CONNECT table",
- db, tblp->Name);
- goto err;
-#endif // MYSQL_SUPPORT
} else {
// Sub-table is a CONNECT table
tabp->Next = To_Table; // For loop checking
@@ -669,6 +653,22 @@ PRXCOL::PRXCOL(PRXCOL *col1, PTDB tdbp) : COLBLK(col1, tdbp)
} // end of PRXCOL copy constructor
/***********************************************************************/
+/* Convert an UTF-8 name to latin characters. */
+/***********************************************************************/
+char *PRXCOL::Decode(PGLOBAL g, const char *cnm)
+ {
+ char *buf= (char*)PlugSubAlloc(g, NULL, strlen(cnm) + 1);
+ uint dummy_errors;
+ uint32 len= copy_and_convert(buf, strlen(cnm) + 1,
+ &my_charset_latin1,
+ cnm, strlen(cnm),
+ &my_charset_utf8_general_ci,
+ &dummy_errors);
+ buf[len]= '\0';
+ return buf;
+ } // end of Decode
+
+/***********************************************************************/
/* PRXCOL initialization routine. */
/* Look for the matching column in the object table. */
/***********************************************************************/
@@ -683,6 +683,9 @@ bool PRXCOL::Init(PGLOBAL g, PTDBASE tp)
if (Colp) {
MODE mode = To_Tdb->GetMode();
+ // Needed for MYSQL subtables
+ ((XCOLBLK*)Colp)->Name = Decode(g, Colp->GetName());
+
// May not have been done elsewhere
Colp->InitValue(g);
To_Val = Colp->GetValue();
diff --git a/storage/connect/tabutil.h b/storage/connect/tabutil.h
index 606e532d526..b320d169b36 100644
--- a/storage/connect/tabutil.h
+++ b/storage/connect/tabutil.h
@@ -59,12 +59,12 @@ class DllExport TDBPRX : public TDBASE {
public:
// Constructors
TDBPRX(PPRXDEF tdp);
- TDBPRX(PGLOBAL g, PTDBPRX tdbp);
+ TDBPRX(PTDBPRX tdbp);
// Implementation
virtual AMT GetAmType(void) {return TYPE_AM_PRX;}
virtual PTDB Duplicate(PGLOBAL g)
- {return (PTDB)new(g) TDBPRX(g, this);}
+ {return (PTDB)new(g) TDBPRX(this);}
// Methods
virtual PTDB CopyOne(PTABS t);
@@ -108,15 +108,18 @@ class DllExport PRXCOL : public COLBLK {
virtual int GetAmType(void) {return TYPE_AM_PRX;}
// Methods
+ using COLBLK::Init;
virtual void Reset(void);
virtual bool IsSpecial(void) {return Pseudo;}
virtual bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check)
{return false;}
virtual void ReadColumn(PGLOBAL g);
virtual void WriteColumn(PGLOBAL g);
- virtual bool Init(PGLOBAL g, PTDBASE tp = NULL);
+ virtual bool Init(PGLOBAL g, PTDBASE tp);
protected:
+ char *Decode(PGLOBAL g, const char *cnm);
+
// Default constructor not to be used
PRXCOL(void) {}
@@ -144,4 +147,8 @@ class TDBTBC : public TDBCAT {
PSZ Tab; // Table name
}; // end of class TDBMCL
+class XCOLBLK : public COLBLK {
+ friend class PRXCOL;
+}; // end of class XCOLBLK
+
#endif // TABUTIL
diff --git a/storage/connect/tabvct.cpp b/storage/connect/tabvct.cpp
index 3ed40540395..e788529075f 100644
--- a/storage/connect/tabvct.cpp
+++ b/storage/connect/tabvct.cpp
@@ -5,7 +5,7 @@
/* */
/* COPYRIGHT: */
/* ---------- */
-/* (C) Copyright to the author Olivier BERTRAND 1999-2014 */
+/* (C) Copyright to the author Olivier BERTRAND 1999-2015 */
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
@@ -35,7 +35,7 @@
/* Include relevant MariaDB header file. */
/***********************************************************************/
#include "my_global.h"
-#if defined(WIN32)
+#if defined(__WIN__)
#include <io.h>
#include <fcntl.h>
#if defined(__BORLANDC__)
@@ -94,7 +94,7 @@ PVBLK AllocValBlock(PGLOBAL, void *, int, int, int, int,
/***********************************************************************/
/* DefineAM: define specific AM block values from XDB file. */
/***********************************************************************/
-bool VCTDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
+bool VCTDEF::DefineAM(PGLOBAL g, LPCSTR, int poff)
{
DOSDEF::DefineAM(g, "BIN", poff);
@@ -146,7 +146,7 @@ bool VCTDEF::Erase(char *filename)
for (i = 1, cdp = To_Cols; cdp; i++, cdp = cdp->GetNext()) {
sprintf(filename, fpat, i);
-//#if defined(WIN32)
+//#if defined(__WIN__)
// rc |= !DeleteFile(filename);
//#else // UNIX
rc |= remove(filename);
@@ -175,7 +175,7 @@ bool VCTDEF::Erase(char *filename)
int VCTDEF::MakeFnPattern(char *fpat)
{
char pat[8];
-#if !defined(UNIX)
+#if defined(__WIN__)
char drive[_MAX_DRIVE];
#else
char *drive = NULL;
@@ -290,7 +290,7 @@ PCOL TDBVCT::MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n)
/***********************************************************************/
/* VEC tables are not ready yet to use temporary files. */
/***********************************************************************/
-bool TDBVCT::IsUsingTemp(PGLOBAL g)
+bool TDBVCT::IsUsingTemp(PGLOBAL)
{
// For developpers
return (UseTemp() == TMP_TEST);
@@ -570,7 +570,7 @@ void VCTCOL::ReadColumn(PGLOBAL g)
/* On each change of block the buffer is written back to file and */
/* in mode Insert the buffer is filled with the block to update. */
/***********************************************************************/
-void VCTCOL::WriteColumn(PGLOBAL g)
+void VCTCOL::WriteColumn(PGLOBAL)
{
PTXF txfp = ((PTDBVCT)To_Tdb)->Txfp;;
diff --git a/storage/connect/tabvir.cpp b/storage/connect/tabvir.cpp
index b4c76f5ad56..356fc981357 100644
--- a/storage/connect/tabvir.cpp
+++ b/storage/connect/tabvir.cpp
@@ -29,7 +29,7 @@
/***********************************************************************/
/* Return the unique column definition to MariaDB. */
/***********************************************************************/
-PQRYRES VirColumns(PGLOBAL g, char *tab, char *db, bool info)
+PQRYRES VirColumns(PGLOBAL g, bool info)
{
int buftyp[] = {TYPE_STRING, TYPE_SHORT, TYPE_STRING,
TYPE_INT, TYPE_STRING, TYPE_STRING};
@@ -95,7 +95,7 @@ PQRYRES VirColumns(PGLOBAL g, char *tab, char *db, bool info)
/***********************************************************************/
/* GetTable: makes a new Table Description Block. */
/***********************************************************************/
-PTDB VIRDEF::GetTable(PGLOBAL g, MODE m)
+PTDB VIRDEF::GetTable(PGLOBAL g, MODE)
{
// Column blocks will be allocated only when needed.
if (Catfunc == FNC_COL)
@@ -241,7 +241,7 @@ bool TDBVIR::OpenDB(PGLOBAL g)
/***********************************************************************/
/* Data Base read routine for the VIR access method. */
/***********************************************************************/
-int TDBVIR::ReadDB(PGLOBAL g)
+int TDBVIR::ReadDB(PGLOBAL)
{
return (++N >= Size) ? RC_EF : RC_OK;
} // end of ReadDB
@@ -258,7 +258,7 @@ int TDBVIR::WriteDB(PGLOBAL g)
/***********************************************************************/
/* Data Base delete line routine for the VIR access methods. */
/***********************************************************************/
-int TDBVIR::DeleteDB(PGLOBAL g, int irc)
+int TDBVIR::DeleteDB(PGLOBAL g, int)
{
sprintf(g->Message, MSG(VIR_NO_DELETE), To_Def->GetType());
return RC_FX;
@@ -269,7 +269,7 @@ int TDBVIR::DeleteDB(PGLOBAL g, int irc)
/***********************************************************************/
/* VIRCOL public constructor. */
/***********************************************************************/
-VIRCOL::VIRCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PSZ am)
+VIRCOL::VIRCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PSZ)
: COLBLK(cdp, tdbp, i)
{
if (cprec) {
@@ -299,7 +299,7 @@ void VIRCOL::ReadColumn(PGLOBAL g)
/***********************************************************************/
PQRYRES TDBVICL::GetResult(PGLOBAL g)
{
- return VirColumns(g, NULL, NULL, false);
+ return VirColumns(g, false);
} // end of GetResult
/* ------------------------- End of Virtual -------------------------- */
diff --git a/storage/connect/tabvir.h b/storage/connect/tabvir.h
index 8d0caa257e7..a53aceaeceb 100644
--- a/storage/connect/tabvir.h
+++ b/storage/connect/tabvir.h
@@ -11,7 +11,7 @@ typedef class TDBVIR *PTDBVIR;
/***********************************************************************/
/* Return the unique column definition to MariaDB. */
/***********************************************************************/
-PQRYRES VirColumns(PGLOBAL g, char *tab, char *db, bool info);
+PQRYRES VirColumns(PGLOBAL g, bool info);
/* --------------------------- VIR classes --------------------------- */
diff --git a/storage/connect/tabwmi.cpp b/storage/connect/tabwmi.cpp
index 7c69426a066..98a44b9d635 100644
--- a/storage/connect/tabwmi.cpp
+++ b/storage/connect/tabwmi.cpp
@@ -2,9 +2,9 @@
/* TABWMI: Author Olivier Bertrand -- PlugDB -- 2012 - 2013 */
/* TABWMI: Virtual table to get WMI information. */
/***********************************************************************/
-#if !defined(WIN32)
-#error This is a WIN32 only table type
-#endif // !WIN32
+#if !defined(__WIN__)
+#error This is a WINDOWS only table type
+#endif // !__WIN__
#include "my_global.h"
#include <stdio.h>
diff --git a/storage/connect/tabxcl.cpp b/storage/connect/tabxcl.cpp
index 57f0e1e03b9..add61431493 100644
--- a/storage/connect/tabxcl.cpp
+++ b/storage/connect/tabxcl.cpp
@@ -17,7 +17,7 @@
/***********************************************************************/
#include "my_global.h"
#include "table.h" // MySQL table definitions
-#if defined(WIN32)
+#if defined(__WIN__)
#include <stdlib.h>
#include <stdio.h>
#if defined(__BORLANDC__)
@@ -51,11 +51,8 @@
#include "tabcol.h"
#include "tabxcl.h"
#include "xtable.h"
-#if defined(MYSQL_SUPPORT)
#include "tabmysql.h"
-#endif // MYSQL_SUPPORT
#include "ha_connect.h"
-#include "mycat.h"
/* -------------- Implementation of the XCOL classes ---------------- */
@@ -86,7 +83,7 @@ bool XCLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
/***********************************************************************/
/* GetTable: makes a new TDB of the proper type. */
/***********************************************************************/
-PTDB XCLDEF::GetTable(PGLOBAL g, MODE mode)
+PTDB XCLDEF::GetTable(PGLOBAL g, MODE)
{
if (Catfunc == FNC_COL)
return new(g) TDBTBC(this);
@@ -120,7 +117,7 @@ PCOL TDBXCL::MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n)
PCOL colp;
if (!stricmp(cdp->GetName(), Xcolumn)) {
- Xcolp = new(g) XCLCOL(g, cdp, this, cprec, n);
+ Xcolp = new(g) XCLCOL(cdp, this, cprec, n);
colp = Xcolp;
} else
colp = new(g) PRXCOL(cdp, this, cprec, n);
@@ -147,7 +144,7 @@ int TDBXCL::GetMaxSize(PGLOBAL g)
/* For this table type, ROWID is the (virtual) row number, */
/* while ROWNUM is be the occurence rank in the multiple column. */
/***********************************************************************/
-int TDBXCL::RowNumber(PGLOBAL g, bool b)
+int TDBXCL::RowNumber(PGLOBAL, bool b)
{
return (b) ? M : N;
} // end of RowNumber
@@ -183,7 +180,7 @@ bool TDBXCL::OpenDB(PGLOBAL g)
/*********************************************************************/
for (PCOL cp = Columns; cp; cp = cp->GetNext())
if (!cp->IsSpecial())
- if (((PPRXCOL)cp)->Init(g))
+ if (((PPRXCOL)cp)->Init(g, NULL))
return TRUE;
/*********************************************************************/
@@ -235,7 +232,7 @@ int TDBXCL::ReadDB(PGLOBAL g)
/***********************************************************************/
/* XCLCOL public constructor. */
/***********************************************************************/
-XCLCOL::XCLCOL(PGLOBAL g, PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i)
+XCLCOL::XCLCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i)
: PRXCOL(cdp, tdbp, cprec, i, "XCL")
{
// Set additional XXL access method information for column.
diff --git a/storage/connect/tabxcl.h b/storage/connect/tabxcl.h
index 7e11600c090..291f0b4263a 100644
--- a/storage/connect/tabxcl.h
+++ b/storage/connect/tabxcl.h
@@ -85,9 +85,10 @@ class XCLCOL : public PRXCOL {
friend class TDBXCL;
public:
// Constructors
- XCLCOL(PGLOBAL g, PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i);
+ XCLCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i);
// Methods
+ using PRXCOL::Init;
virtual void Reset(void) {} // Evaluated only by TDBXCL
virtual void ReadColumn(PGLOBAL g);
virtual bool Init(PGLOBAL g, PTDBASE tp = NULL);
diff --git a/storage/connect/tabxml.cpp b/storage/connect/tabxml.cpp
index 8c73907c7ee..49fa9a1c554 100644
--- a/storage/connect/tabxml.cpp
+++ b/storage/connect/tabxml.cpp
@@ -1,9 +1,9 @@
/************* Tabxml C++ Program Source Code File (.CPP) **************/
/* PROGRAM NAME: TABXML */
/* ------------- */
-/* Version 2.7 */
+/* Version 2.8 */
/* */
-/* Author Olivier BERTRAND 2007 - 2014 */
+/* Author Olivier BERTRAND 2007 - 2015 */
/* */
/* This program are the XML tables classes using MS-DOM or libxml2. */
/***********************************************************************/
@@ -15,12 +15,12 @@
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
-#if defined(WIN32)
+#if defined(__WIN__)
#include <io.h>
#include <winsock2.h>
//#include <windows.h>
#include <comdef.h>
-#else // !WIN32
+#else // !__WIN__
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
@@ -28,7 +28,8 @@
//#include <ctype.h>
#include "osutil.h"
#define _O_RDONLY O_RDONLY
-#endif // !WIN32
+#endif // !__WIN__
+#include "resource.h" // for IDS_COLUMNS
#define INCLUDE_TDBXML
#define NODE_TYPE_LIST
@@ -44,6 +45,7 @@
#include "reldef.h"
#include "xtable.h"
#include "colblk.h"
+#include "mycat.h"
#include "xindex.h"
#include "plgxml.h"
#include "tabxml.h"
@@ -51,11 +53,355 @@
extern "C" char version[];
-#if defined(WIN32) && defined(DOMDOC_SUPPORT)
+#if defined(__WIN__) && defined(DOMDOC_SUPPORT)
#define XMLSUP "MS-DOM"
-#else // !WIN32
+#else // !__WIN__
#define XMLSUP "libxml2"
-#endif // !WIN32
+#endif // !__WIN__
+
+#define TYPE_UNKNOWN 12 /* Must be greater than other types */
+
+/***********************************************************************/
+/* Class and structure used by XMLColumns. */
+/***********************************************************************/
+typedef class XMCOL *PXCL;
+
+class XMCOL : public BLOCK {
+ public:
+ // Constructors
+ XMCOL(void) {Next = NULL;
+ Name[0] = 0;
+ Fmt = NULL;
+ Type = 1;
+ Len = Scale = 0;
+ Cbn = false;
+ Found = true;}
+ XMCOL(PGLOBAL g, PXCL xp, char *fmt, int i) {
+ Next = NULL;
+ strcpy(Name, xp->Name);
+ Fmt = (*fmt) ? PlugDup(g, fmt) : NULL;
+ Type = xp->Type;
+ Len = xp->Len;
+ Scale = xp->Scale;
+ Cbn = (xp->Cbn || i > 1);
+ Found = true;}
+
+ // Members
+ PXCL Next;
+ char Name[64];
+ char *Fmt;
+ int Type;
+ int Len;
+ int Scale;
+ bool Cbn;
+ bool Found;
+}; // end of class XMCOL
+
+typedef struct LVL {
+ PXNODE pn;
+ PXLIST nl;
+ PXATTR atp;
+ bool b;
+ long k;
+ int m, n;
+} *PLVL;
+
+/***********************************************************************/
+/* XMLColumns: construct the result blocks containing the description */
+/* of all the columns of a table contained inside an XML file. */
+/***********************************************************************/
+PQRYRES XMLColumns(PGLOBAL g, char *db, char *tab, PTOS topt, bool info)
+{
+ static int buftyp[] = {TYPE_STRING, TYPE_SHORT, TYPE_STRING, TYPE_INT,
+ TYPE_INT, TYPE_SHORT, TYPE_SHORT, TYPE_STRING};
+ static XFLD fldtyp[] = {FLD_NAME, FLD_TYPE, FLD_TYPENAME, FLD_PREC,
+ FLD_LENGTH, FLD_SCALE, FLD_NULL, FLD_FORMAT};
+ static unsigned int length[] = {0, 6, 8, 10, 10, 6, 6, 0};
+ char *fn, *op, colname[65], fmt[129], buf[512];
+ int i, j, lvl, n = 0;
+ int ncol = sizeof(buftyp) / sizeof(int);
+ bool ok = true;
+ PXCL xcol, xcp, fxcp = NULL, pxcp = NULL;
+ PLVL *lvlp, vp;
+ PXNODE node = NULL;
+ PXMLDEF tdp;
+ PTDBXML txmp;
+ PQRYRES qrp;
+ PCOLRES crp;
+
+ if (info) {
+ length[0] = 128;
+ length[7] = 256;
+ goto skipit;
+ } // endif info
+
+ /*********************************************************************/
+ /* Open the input file. */
+ /*********************************************************************/
+ if (!(fn = GetStringTableOption(g, topt, "Filename", NULL))) {
+ strcpy(g->Message, MSG(MISSING_FNAME));
+ return NULL;
+ } else {
+ lvl = GetIntegerTableOption(g, topt, "Level", 0);
+ lvl = (lvl < 0) ? 0 : (lvl > 16) ? 16 : lvl;
+ } // endif fn
+
+ if (trace)
+ htrc("File %s lvl=%d\n", topt->filename, lvl);
+
+ tdp = new(g) XMLDEF;
+ tdp->Fn = fn;
+ tdp->Database = SetPath(g, db);
+ tdp->Tabname = tab;
+
+ if (!(op = GetStringTableOption(g, topt, "Xmlsup", NULL)))
+#if defined(__WIN__)
+ tdp->Usedom = true;
+#else // !__WIN__
+ tdp->Usedom = false;
+#endif // !__WIN__
+ else
+ tdp->Usedom = (toupper(*op) == 'M' || toupper(*op) == 'D');
+
+ txmp = new(g) TDBXML(tdp);
+
+ if (txmp->Initialize(g))
+ goto err;
+
+ xcol = new(g) XMCOL;
+ colname[64] = 0;
+ fmt[128] = 0;
+ lvlp = (PLVL*)PlugSubAlloc(g, NULL, sizeof(PLVL) * (lvl + 1));
+
+ for (j = 0; j <= lvl; j++)
+ lvlp[j] = (PLVL)PlugSubAlloc(g, NULL, sizeof(LVL));
+
+ /*********************************************************************/
+ /* Analyse the XML tree and define columns. */
+ /*********************************************************************/
+ for (i = 1; ; i++) {
+ // Get next row
+ switch (txmp->ReadDB(g)) {
+ case RC_EF:
+ vp = NULL;
+ break;
+ case RC_FX:
+ goto err;
+ default:
+ vp = lvlp[0];
+ vp->pn = txmp->RowNode;
+ vp->atp = vp->pn->GetAttribute(g, NULL);
+ vp->nl = vp->pn->GetChildElements(g);
+ vp->b = true;
+ vp->k = 0;
+ vp->m = vp->n = 0;
+ j = 0;
+ } // endswitch ReadDB
+
+ if (!vp)
+ break;
+
+ while (true) {
+ if (!vp->atp &&
+ !(node = (vp->nl) ? vp->nl->GetItem(g, vp->k++, node) : NULL))
+ if (j) {
+ vp = lvlp[--j];
+
+ if (!tdp->Usedom) // nl was destroyed
+ vp->nl = vp->pn->GetChildElements(g);
+
+ if (!lvlp[j+1]->b) {
+ vp->k--;
+ ok = false;
+ } // endif b
+
+ continue;
+ } else
+ break;
+
+ xcol->Name[vp->n] = 0;
+ fmt[vp->m] = 0;
+
+ more:
+ if (vp->atp) {
+ strncpy(colname, vp->atp->GetName(g), sizeof(colname));
+ strncat(xcol->Name, colname, 64);
+
+ switch (vp->atp->GetText(g, buf, sizeof(buf))) {
+ case RC_INFO:
+ PushWarning(g, txmp);
+ case RC_OK:
+ strncat(fmt, "@", sizeof(fmt));
+ break;
+ default:
+ goto err;
+ } // enswitch rc
+
+ if (j)
+ strncat(fmt, colname, sizeof(fmt));
+
+ } else {
+ if (tdp->Usedom && node->GetType() != 1)
+ continue;
+
+ strncpy(colname, node->GetName(g), sizeof(colname));
+ strncat(xcol->Name, colname, 64);
+
+ if (j)
+ strncat(fmt, colname, sizeof(fmt));
+
+ if (j < lvl && ok) {
+ vp = lvlp[j+1];
+ vp->k = 0;
+ vp->atp = node->GetAttribute(g, NULL);
+ vp->nl = node->GetChildElements(g);
+
+ if (tdp->Usedom && vp->nl->GetLength() == 1) {
+ node = vp->nl->GetItem(g, 0, node);
+ vp->b = (node->GetType() == 1); // Must be ab element
+ } else
+ vp->b = (vp->nl && vp->nl->GetLength());
+
+ if (vp->atp || vp->b) {
+ if (!vp->atp)
+ node = vp->nl->GetItem(g, vp->k++, node);
+
+ strncat(strncat(fmt, colname, 125), "/", 125);
+ strncat(xcol->Name, "_", 64);
+ j++;
+ vp->n = (int)strlen(xcol->Name);
+ vp->m = (int)strlen(fmt);
+ goto more;
+ } else {
+ vp = lvlp[j];
+
+ if (!tdp->Usedom) // nl was destroyed
+ vp->nl = vp->pn->GetChildElements(g);
+
+ } // endif vp
+
+ } else
+ ok = true;
+
+ switch (node->GetContent(g, buf, sizeof(buf))) {
+ case RC_INFO:
+ PushWarning(g, txmp);
+ case RC_OK:
+ break;
+ default:
+ goto err;
+ } // enswitch rc
+
+ } // endif atp;
+
+ xcol->Len = strlen(buf);
+
+ // Check whether this column was already found
+ for (xcp = fxcp; xcp; xcp = xcp->Next)
+ if (!strcmp(xcol->Name, xcp->Name))
+ break;
+
+ if (xcp) {
+ if (xcp->Type != xcol->Type)
+ xcp->Type = TYPE_STRING;
+
+ if (*fmt && (!xcp->Fmt || strlen(xcp->Fmt) < strlen(fmt))) {
+ xcp->Fmt = PlugDup(g, fmt);
+ length[7] = MY_MAX(length[7], strlen(fmt));
+ } // endif *fmt
+
+ xcp->Len = MY_MAX(xcp->Len, xcol->Len);
+ xcp->Scale = MY_MAX(xcp->Scale, xcol->Scale);
+ xcp->Cbn |= xcol->Cbn;
+ xcp->Found = true;
+ } else {
+ // New column
+ xcp = new(g) XMCOL(g, xcol, fmt, i);
+ length[0] = MY_MAX(length[0], strlen(xcol->Name));
+ length[7] = MY_MAX(length[7], strlen(fmt));
+
+ if (pxcp) {
+ xcp->Next = pxcp->Next;
+ pxcp->Next = xcp;
+ } else
+ fxcp = xcp;
+
+ n++;
+ } // endif xcp
+
+ pxcp = xcp;
+
+ if (vp->atp)
+ vp->atp = vp->atp->GetNext(g);
+
+ } // endwhile
+
+ // Missing column can be null
+ for (xcp = fxcp; xcp; xcp = xcp->Next) {
+ xcp->Cbn |= !xcp->Found;
+ xcp->Found = false;
+ } // endfor xcp
+
+ } // endor i
+
+ txmp->CloseDB(g);
+
+ skipit:
+ if (trace)
+ htrc("CSVColumns: n=%d len=%d\n", n, length[0]);
+
+ /*********************************************************************/
+ /* Allocate the structures used to refer to the result set. */
+ /*********************************************************************/
+ qrp = PlgAllocResult(g, ncol, n, IDS_COLUMNS + 3,
+ buftyp, fldtyp, length, false, false);
+
+ crp = qrp->Colresp->Next->Next->Next->Next->Next->Next;
+ crp->Name = "Nullable";
+ crp->Next->Name = "Xpath";
+
+ if (info || !qrp)
+ return qrp;
+
+ qrp->Nblin = n;
+
+ /*********************************************************************/
+ /* Now get the results into blocks. */
+ /*********************************************************************/
+ for (i = 0, xcp = fxcp; xcp; i++, xcp = xcp->Next) {
+ if (xcp->Type == TYPE_UNKNOWN) // Void column
+ xcp->Type = TYPE_STRING;
+
+ crp = qrp->Colresp; // Column Name
+ crp->Kdata->SetValue(xcp->Name, i);
+ crp = crp->Next; // Data Type
+ crp->Kdata->SetValue(xcp->Type, i);
+ crp = crp->Next; // Type Name
+ crp->Kdata->SetValue(GetTypeName(xcp->Type), i);
+ crp = crp->Next; // Precision
+ crp->Kdata->SetValue(xcp->Len, i);
+ crp = crp->Next; // Length
+ crp->Kdata->SetValue(xcp->Len, i);
+ crp = crp->Next; // Scale (precision)
+ crp->Kdata->SetValue(xcp->Scale, i);
+ crp = crp->Next; // Nullable
+ crp->Kdata->SetValue(xcp->Cbn ? 1 : 0, i);
+ crp = crp->Next; // Field format
+
+ if (crp->Kdata)
+ crp->Kdata->SetValue(xcp->Fmt, i);
+
+ } // endfor i
+
+ /*********************************************************************/
+ /* Return the result pointer. */
+ /*********************************************************************/
+ return qrp;
+
+err:
+ txmp->CloseDB(g);
+ return NULL;
+ } // end of XMLColumns
/* -------------- Implementation of the XMLDEF class ---------------- */
@@ -88,9 +434,7 @@ XMLDEF::XMLDEF(void)
/***********************************************************************/
bool XMLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
{
- char *defrow, *defcol, buf[10];
-//void *memp = Cat->GetDescp();
-//PSZ dbfile = Cat->GetDescFile();
+ char *defrow, *defcol, buf[10];
Fn = GetStringCatInfo(g, "Filename", NULL);
Encoding = GetStringCatInfo(g, "Encoding", "UTF-8");
@@ -105,7 +449,7 @@ bool XMLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
return true;
} // endif flag
- defrow = defcol = "";
+ defrow = defcol = NULL;
GetCharCatInfo("Coltype", "", buf, sizeof(buf));
switch (toupper(*buf)) {
@@ -138,36 +482,29 @@ bool XMLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
Tabname = GetStringCatInfo(g, "Tabname", Tabname);
Rowname = GetStringCatInfo(g, "Rownode", defrow);
Colname = GetStringCatInfo(g, "Colnode", defcol);
- Mulnode = GetStringCatInfo(g, "Mulnode", "");
- XmlDB = GetStringCatInfo(g, "XmlDB", "");
- Nslist = GetStringCatInfo(g, "Nslist", "");
- DefNs = GetStringCatInfo(g, "DefNs", "");
+ Mulnode = GetStringCatInfo(g, "Mulnode", NULL);
+ XmlDB = GetStringCatInfo(g, "XmlDB", NULL);
+ Nslist = GetStringCatInfo(g, "Nslist", NULL);
+ DefNs = GetStringCatInfo(g, "DefNs", NULL);
Limit = GetIntCatInfo("Limit", 10);
- Xpand = (GetIntCatInfo("Expand", 0) != 0);
+ Xpand = GetBoolCatInfo("Expand", false);
Header = GetIntCatInfo("Header", 0);
GetCharCatInfo("Xmlsup", "*", buf, sizeof(buf));
-//if (*buf == '*') // Try the old (deprecated) option
-// GetCharCatInfo("Method", "*", buf, sizeof(buf));
-
-//if (*buf == '*') // Is there a default for the database?
-// GetCharCatInfo("Defxml", XMLSUP, buf, sizeof(buf));
-
// Note that if no support is specified, the default is MS-DOM
// on Windows and libxml2 otherwise
if (*buf == '*')
-#if defined(WIN32)
+#if defined(__WIN__)
Usedom = true;
-#else // !WIN32
+#else // !__WIN__
Usedom = false;
-#endif // !WIN32
+#endif // !__WIN__
else
Usedom = (toupper(*buf) == 'M' || toupper(*buf) == 'D');
// Get eventual table node attribute
- Attrib = GetStringCatInfo(g, "Attribute", "");
- Hdattr = GetStringCatInfo(g, "HeadAttr", "");
-
+ Attrib = GetStringCatInfo(g, "Attribute", NULL);
+ Hdattr = GetStringCatInfo(g, "HeadAttr", NULL);
return false;
} // end of DefineAM
@@ -176,6 +513,9 @@ bool XMLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
/***********************************************************************/
PTDB XMLDEF::GetTable(PGLOBAL g, MODE m)
{
+ if (Catfunc == FNC_COL)
+ return new(g) TDBXCT(this);
+
PTDBASE tdbp = new(g) TDBXML(this);
if (Multiple)
@@ -184,30 +524,6 @@ PTDB XMLDEF::GetTable(PGLOBAL g, MODE m)
return tdbp;
} // end of GetTable
-#if 0
-/***********************************************************************/
-/* DeleteTableFile: Delete XML table files using platform API. */
-/***********************************************************************/
-bool XMLDEF::DeleteTableFile(PGLOBAL g)
- {
- char filename[_MAX_PATH];
- bool rc;
-
- // Delete the XML table file if not protected
- if (!IsReadOnly()) {
- PlugSetPath(filename, Fn, GetPath());
-#if defined(WIN32)
- rc = !DeleteFile(filename);
-#else // UNIX
- rc = remove(filename);
-#endif // UNIX
- } else
- rc =true;
-
- return rc; // Return true if error
- } // end of DeleteTableFile
-#endif // 0
-
/* ------------------------- TDBXML Class ---------------------------- */
/***********************************************************************/
@@ -229,14 +545,14 @@ TDBXML::TDBXML(PXMLDEF tdp) : TDBASE(tdp)
Xfile = tdp->Fn;
Enc = tdp->Encoding;
Tabname = tdp->Tabname;
- Rowname = (*tdp->Rowname) ? tdp->Rowname : NULL;
- Colname = (*tdp->Colname) ? tdp->Colname : NULL;
- Mulnode = (*tdp->Mulnode) ? tdp->Mulnode : NULL;
- XmlDB = (*tdp->XmlDB) ? tdp->XmlDB : NULL;
- Nslist = (*tdp->Nslist) ? tdp->Nslist : NULL;
- DefNs = (*tdp->DefNs) ? tdp->DefNs : NULL;
- Attrib = (*tdp->Attrib) ? tdp->Attrib : NULL;
- Hdattr = (*tdp->Hdattr) ? tdp->Hdattr : NULL;
+ Rowname = (tdp->Rowname) ? tdp->Rowname : NULL;
+ Colname = (tdp->Colname) ? tdp->Colname : NULL;
+ Mulnode = (tdp->Mulnode) ? tdp->Mulnode : NULL;
+ XmlDB = (tdp->XmlDB) ? tdp->XmlDB : NULL;
+ Nslist = (tdp->Nslist) ? tdp->Nslist : NULL;
+ DefNs = (tdp->DefNs) ? tdp->DefNs : NULL;
+ Attrib = (tdp->Attrib) ? tdp->Attrib : NULL;
+ Hdattr = (tdp->Hdattr) ? tdp->Hdattr : NULL;
Coltype = tdp->Coltype;
Limit = tdp->Limit;
Xpand = tdp->Xpand;
@@ -332,7 +648,7 @@ PCOL TDBXML::MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n)
/***********************************************************************/
/* InsertSpecialColumn: Put a special column ahead of the column list.*/
/***********************************************************************/
-PCOL TDBXML::InsertSpecialColumn(PGLOBAL g, PCOL colp)
+PCOL TDBXML::InsertSpecialColumn(PCOL colp)
{
if (!colp->IsSpecial())
return NULL;
@@ -519,7 +835,6 @@ bool TDBXML::Initialize(PGLOBAL g)
To_Xb = Docp->LinkXblock(g, Mode, rc, filename);
// Add a CONNECT comment node
-// sprintf(buf, " Created by CONNECT %s ", version);
strcpy(buf, " Created by the MariaDB CONNECT Storage Engine");
Docp->AddComment(g, buf);
@@ -563,7 +878,7 @@ bool TDBXML::Initialize(PGLOBAL g)
Nlist = TabNode->GetChildElements(g);
Docp->SetNofree(true); // For libxml2
-#if defined(WIN32)
+#if defined(__WIN__)
} catch(_com_error e) {
// We come here if a DOM command threw an error
char buf[128];
@@ -577,7 +892,7 @@ bool TDBXML::Initialize(PGLOBAL g)
sprintf(g->Message, "%s hr=%p", MSG(COM_ERROR), e.Error());
goto error;
-#endif // WIN32
+#endif // __WIN__
#if !defined(UNIX)
} catch(...) {
// Other errors
@@ -702,7 +1017,7 @@ int TDBXML::GetMaxSize(PGLOBAL g)
else
MaxSize = 10;
- } // endif MaxSize
+ } // endif MaxSize
return MaxSize;
} // end of GetMaxSize
@@ -771,7 +1086,6 @@ bool TDBXML::OpenDB(PGLOBAL g)
NewRow = (Mode == MODE_INSERT);
Nsub = 0;
Use = USE_OPEN; // Do it now in case we are recursively called
-
return false;
} // end of OpenDB
@@ -944,8 +1258,7 @@ void TDBXML::CloseDB(PGLOBAL g)
{
if (Docp) {
if (Changed) {
- char filename[_MAX_PATH];
-// PDBUSER dup = (PDBUSER)g->Activityp->Aptr;
+ char filename[_MAX_PATH];
// We used the file name relative to recorded datapath
PlugSetPath(filename, Xfile, GetPath());
@@ -987,7 +1300,6 @@ void TDBXML::CloseDB(PGLOBAL g)
NewRow = false;
Hasnod = false;
Write = false;
-// Bufdone = false;
Nodedone = false;
Void = false;
Nrow = -1;
@@ -1079,8 +1391,6 @@ bool XMLCOL::AllocBuf(PGLOBAL g, bool mode)
if (Valbuf)
return false; // Already done
-//Valbuf = (char*)PlugSubAlloc(g, NULL, Long + 1);
-//Valbuf[Long] = '\0';
return ParseXpath(g, mode);
} // end of AllocBuf
@@ -1171,8 +1481,7 @@ bool XMLCOL::ParseXpath(PGLOBAL g, bool mode)
} else if (Type == 2) {
// HTML like table, columns are retrieved by position
new(this) XPOSCOL(Value); // Change the class of this column
- Tdbp->Hasnod = true;
- return false;
+ Inod = -1;
} else if (Type == 0 && !mode) {
strcat(strcat(pbuf, "@"), Name);
} else { // Type == 1
@@ -1322,7 +1631,6 @@ void XMLCOL::WriteColumn(PGLOBAL g)
int done = 0;
int i, n, k = 0;
PXNODE TopNode = NULL;
-//PXATTR AttNode = NULL;
if (trace > 1)
htrc("XML WriteColumn: col %s R%d coluse=%.4X status=%.4X\n",
@@ -1354,7 +1662,7 @@ void XMLCOL::WriteColumn(PGLOBAL g)
/*********************************************************************/
/* Null values are represented by no node. */
/*********************************************************************/
- if (Value->IsNull())
+ if (Value->IsNull())
return;
/*********************************************************************/
@@ -1557,7 +1865,6 @@ void XMULCOL::WriteColumn(PGLOBAL g)
int done = 0;
int i, n, len, k = 0;
PXNODE TopNode = NULL;
-//PXATTR AttNode = NULL;
if (trace)
htrc("XML WriteColumn: col %s R%d coluse=%.4X status=%.4X\n",
@@ -1847,4 +2154,24 @@ void XPOSCOL::WriteColumn(PGLOBAL g)
} // end of WriteColumn
+/* ---------------------------TDBXCT class --------------------------- */
+
+/***********************************************************************/
+/* TDBXCT class constructor. */
+/***********************************************************************/
+TDBXCT::TDBXCT(PXMLDEF tdp) : TDBCAT(tdp)
+ {
+ Topt = tdp->GetTopt();
+ Db = (char*)tdp->GetDB();
+ Tabn = tdp->Tabname;
+ } // end of TDBXCT constructor
+
+/***********************************************************************/
+/* GetResult: Get the list the JSON file columns. */
+/***********************************************************************/
+PQRYRES TDBXCT::GetResult(PGLOBAL g)
+ {
+ return XMLColumns(g, Db, Tabn, Topt, false);
+ } // end of GetResult
+
/* ------------------------ End of Tabxml ---------------------------- */
diff --git a/storage/connect/tabxml.h b/storage/connect/tabxml.h
index a3dc0a2b54c..7ba3166881d 100644
--- a/storage/connect/tabxml.h
+++ b/storage/connect/tabxml.h
@@ -1,7 +1,7 @@
/*************** Tabxml H Declares Source Code File (.H) ***************/
/* Name: TABXML.H Version 1.6 */
/* */
-/* (C) Copyright to the author Olivier BERTRAND 2007-2013 */
+/* (C) Copyright to the author Olivier BERTRAND 2007-2015 */
/* */
/* This file contains the XML table classes declares. */
/***********************************************************************/
@@ -16,6 +16,8 @@ typedef class XMLCOL *PXMLCOL;
/***********************************************************************/
class DllExport XMLDEF : public TABDEF { /* Logical table description */
friend class TDBXML;
+ friend class TDBXCT;
+ friend PQRYRES XMLColumns(PGLOBAL, char*, char*, PTOS, bool);
public:
// Constructor
XMLDEF(void);
@@ -55,6 +57,7 @@ class DllExport TDBXML : public TDBASE {
friend class XMLCOL;
friend class XMULCOL;
friend class XPOSCOL;
+ friend PQRYRES XMLColumns(PGLOBAL, char*, char*, PTOS, bool);
public:
// Constructor
TDBXML(PXMLDEF tdp);
@@ -81,7 +84,7 @@ class DllExport TDBXML : public TDBASE {
// Database routines
virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n);
- virtual PCOL InsertSpecialColumn(PGLOBAL g, PCOL colp);
+ virtual PCOL InsertSpecialColumn(PCOL colp);
//virtual int GetMaxSame(PGLOBAL g) {return (Xpand) ? Limit : 1;}
virtual int Cardinality(PGLOBAL g);
virtual int GetMaxSize(PGLOBAL g);
@@ -237,4 +240,23 @@ class XPOSCOL : public XMLCOLX {
virtual void ReadColumn(PGLOBAL g);
virtual void WriteColumn(PGLOBAL g);
}; // end of class XPOSCOL
+
+/***********************************************************************/
+/* This is the class declaration for the XML catalog table. */
+/***********************************************************************/
+class TDBXCT : public TDBCAT {
+ public:
+ // Constructor
+ TDBXCT(PXMLDEF tdp);
+
+ protected:
+ // Specific routines
+ virtual PQRYRES GetResult(PGLOBAL g);
+
+ // Members
+ PTOS Topt;
+ char *Db;
+ char *Tabn;
+ }; // end of class TDBXCT
+
#endif // INCLUDE_TDBXML
diff --git a/storage/connect/user_connect.cc b/storage/connect/user_connect.cc
index 4affe447b00..34d192361a5 100644
--- a/storage/connect/user_connect.cc
+++ b/storage/connect/user_connect.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) Olivier Bertrand 2004 - 2014
+/* Copyright (C) Olivier Bertrand 2004 - 2015
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
@@ -28,7 +28,7 @@
*/
/****************************************************************************/
-/* Author: Olivier Bertrand -- bertrandop@gmail.com -- 2004-2014 */
+/* Author: Olivier Bertrand -- bertrandop@gmail.com -- 2004-2015 */
/****************************************************************************/
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
@@ -63,7 +63,7 @@ void SetWorkSize(uint);
/****************************************************************************/
/* Constructor. */
/****************************************************************************/
-user_connect::user_connect(THD *thd, const char *dbn)
+user_connect::user_connect(THD *thd)
{
thdp= thd;
next= NULL;
diff --git a/storage/connect/user_connect.h b/storage/connect/user_connect.h
index 44e4e94fa8a..7f37973f378 100644
--- a/storage/connect/user_connect.h
+++ b/storage/connect/user_connect.h
@@ -45,7 +45,7 @@ class user_connect
friend int connect_done_func(void *);
public:
// Constructor
- user_connect(THD *thd, const char *dbn);
+ user_connect(THD *thd);
// Destructor
virtual ~user_connect();
diff --git a/storage/connect/valblk.cpp b/storage/connect/valblk.cpp
index df7011583cd..5fefcba5856 100644
--- a/storage/connect/valblk.cpp
+++ b/storage/connect/valblk.cpp
@@ -1,7 +1,7 @@
/************ Valblk C++ Functions Source Code File (.CPP) *************/
/* Name: VALBLK.CPP Version 2.1 */
/* */
-/* (C) Copyright to the author Olivier BERTRAND 2005-2014 */
+/* (C) Copyright to the author Olivier BERTRAND 2005-2015 */
/* */
/* This file contains the VALBLK and derived classes functions. */
/* Second family is VALBLK, representing simple suballocated arrays */
@@ -23,7 +23,7 @@
/* Include relevant MariaDB header file. */
/***********************************************************************/
#include "my_global.h"
-#if defined(WIN32)
+#if defined(__WIN__)
//#include <windows.h>
#else
#include "osutil.h"
@@ -132,7 +132,7 @@ VALBLK::VALBLK(void *mp, int type, int nval, bool un)
/***********************************************************************/
/* Raise error for numeric types. */
/***********************************************************************/
-PSZ VALBLK::GetCharValue(int n)
+PSZ VALBLK::GetCharValue(int)
{
PGLOBAL& g = Global;
@@ -145,7 +145,7 @@ PSZ VALBLK::GetCharValue(int n)
/***********************************************************************/
/* Set format so formatted dates can be converted on input. */
/***********************************************************************/
-bool VALBLK::SetFormat(PGLOBAL g, PSZ fmt, int len, int year)
+bool VALBLK::SetFormat(PGLOBAL g, PSZ, int, int)
{
sprintf(g->Message, MSG(NO_DATE_FMT), Type);
return true;
@@ -752,7 +752,7 @@ double CHRBLK::GetFloatValue(int n)
/***********************************************************************/
/* STRING GetCharString: get string representation of a char value. */
/***********************************************************************/
-char *CHRBLK::GetCharString(char *p, int n)
+char *CHRBLK::GetCharString(char *, int n)
{
return (char *)GetValPtrEx(n);
} // end of GetCharString
@@ -1155,10 +1155,9 @@ void STRBLK::SetValue(PVAL valp, int n)
void STRBLK::SetValue(PSZ p, int n)
{
if (p) {
- if (!Sorted || !n || !Strp[n-1] || strcmp(p, Strp[n-1])) {
- Strp[n] = (PSZ)PlugSubAlloc(Global, NULL, strlen(p) + 1);
- strcpy(Strp[n], p);
- } else
+ if (!Sorted || !n || !Strp[n-1] || strcmp(p, Strp[n-1]))
+ Strp[n] = (PSZ)PlugDup(Global, p);
+ else
Strp[n] = Strp[n-1];
} else
diff --git a/storage/connect/valblk.h b/storage/connect/valblk.h
index 654db0b57b7..f6eb7258a77 100644
--- a/storage/connect/valblk.h
+++ b/storage/connect/valblk.h
@@ -95,17 +95,17 @@ class VALBLK : public BLOCK {
virtual bool IsCi(void) {return false;}
// Methods
- virtual void SetValue(short sval, int n) {assert(false);}
- virtual void SetValue(ushort sval, int n) {assert(false);}
- virtual void SetValue(int lval, int n) {assert(false);}
- virtual void SetValue(uint lval, int n) {assert(false);}
- virtual void SetValue(longlong lval, int n) {assert(false);}
- virtual void SetValue(ulonglong lval, int n) {assert(false);}
- virtual void SetValue(double fval, int n) {assert(false);}
- virtual void SetValue(char cval, int n) {assert(false);}
- virtual void SetValue(uchar cval, int n) {assert(false);}
- virtual void SetValue(PSZ sp, int n) {assert(false);}
- virtual void SetValue(char *sp, uint len, int n) {assert(false);}
+ virtual void SetValue(short, int) {assert(false);}
+ virtual void SetValue(ushort, int) {assert(false);}
+ virtual void SetValue(int, int) {assert(false);}
+ virtual void SetValue(uint, int) {assert(false);}
+ virtual void SetValue(longlong, int) {assert(false);}
+ virtual void SetValue(ulonglong, int) {assert(false);}
+ virtual void SetValue(double, int) {assert(false);}
+ virtual void SetValue(char, int) {assert(false);}
+ virtual void SetValue(uchar, int) {assert(false);}
+ virtual void SetValue(PSZ, int) {assert(false);}
+ virtual void SetValue(char *, uint, int) {assert(false);}
virtual void SetValue(PVAL valp, int n) = 0;
virtual void SetValue(PVBLK pv, int n1, int n2) = 0;
virtual void SetMin(PVAL valp, int n) = 0;
@@ -163,6 +163,7 @@ class TYPBLK : public VALBLK {
virtual void Reset(int n) {Typp[n] = 0;}
// Methods
+ using VALBLK::SetValue;
virtual void SetValue(PSZ sp, int n);
virtual void SetValue(char *sp, uint len, int n);
virtual void SetValue(short sval, int n)
@@ -233,6 +234,7 @@ class CHRBLK : public VALBLK {
virtual bool IsCi(void) {return Ci;}
// Methods
+ using VALBLK::SetValue;
virtual void SetValue(PSZ sp, int n);
virtual void SetValue(char *sp, uint len, int n);
virtual void SetValue(PVAL valp, int n);
@@ -269,7 +271,7 @@ class STRBLK : public VALBLK {
// Implementation
virtual void SetNull(int n, bool b) {if (b) {Strp[n] = NULL;}}
virtual bool IsNull(int n) {return Strp[n] == NULL;}
- virtual void SetNullable(bool b) {} // Always nullable
+ virtual void SetNullable(bool) {} // Always nullable
virtual bool Init(PGLOBAL g, bool check);
virtual int GetVlen(void) {return sizeof(PSZ);}
virtual PSZ GetCharValue(int n) {return Strp[n];}
@@ -282,10 +284,11 @@ class STRBLK : public VALBLK {
virtual longlong GetBigintValue(int n);
virtual ulonglong GetUBigintValue(int n);
virtual double GetFloatValue(int n) {return atof(Strp[n]);}
- virtual char *GetCharString(char *p, int n) {return Strp[n];}
+ virtual char *GetCharString(char *, int n) {return Strp[n];}
virtual void Reset(int n) {Strp[n] = NULL;}
// Methods
+ using VALBLK::SetValue;
virtual void SetValue(PSZ sp, int n);
virtual void SetValue(char *sp, uint len, int n);
virtual void SetValue(PVAL valp, int n);
@@ -322,6 +325,7 @@ class DATBLK : public TYPBLK<int> {
virtual char *GetCharString(char *p, int n);
// Methods
+ using TYPBLK<int>::SetValue;
virtual void SetValue(PSZ sp, int n);
protected:
@@ -345,6 +349,8 @@ class PTRBLK : public STRBLK {
// Implementation
// Methods
+ using STRBLK::SetValue;
+ using STRBLK::CompVal;
virtual void SetValue(PSZ p, int n) {Strp[n] = p;}
virtual int CompVal(int i1, int i2);
diff --git a/storage/connect/value.cpp b/storage/connect/value.cpp
index 1cc40473433..03ec0eb8e40 100644
--- a/storage/connect/value.cpp
+++ b/storage/connect/value.cpp
@@ -1,7 +1,7 @@
/************* Value C++ Functions Source Code File (.CPP) *************/
/* Name: VALUE.CPP Version 2.5 */
/* */
-/* (C) Copyright to the author Olivier BERTRAND 2001-2014 */
+/* (C) Copyright to the author Olivier BERTRAND 2001-2015 */
/* */
/* This file contains the VALUE and derived classes family functions. */
/* These classes contain values of different types. They are used so */
@@ -30,11 +30,11 @@
#include "sql_class.h"
#include "sql_time.h"
-#if defined(WIN32)
+#if defined(__WIN__)
//#include <windows.h>
-#else // !WIN32
+#else // !__WIN__
#include <string.h>
-#endif // !WIN32
+#endif // !__WIN__
#include <math.h>
@@ -77,12 +77,12 @@ int DTVAL::Shift = 0;
/***********************************************************************/
bool PlugEvalLike(PGLOBAL, LPCSTR, LPCSTR, bool);
-#if !defined(WIN32)
+#if !defined(__WIN__)
extern "C" {
PSZ strupr(PSZ s);
PSZ strlwr(PSZ s);
}
-#endif // !WIN32
+#endif // !__WIN__
/***********************************************************************/
/* Get a long long number from its character representation. */
@@ -436,6 +436,9 @@ PVAL AllocateValue(PGLOBAL g, PVAL valp, int newtype, int uns)
bool un = (uns < 0) ? false : (uns > 0) ? true : valp->IsUnsigned();
PVAL vp;
+ if (!valp)
+ return NULL;
+
if (newtype == TYPE_VOID) // Means allocate a value of the same type
newtype = valp->GetType();
@@ -443,8 +446,8 @@ PVAL AllocateValue(PGLOBAL g, PVAL valp, int newtype, int uns)
case TYPE_STRING:
p = (PSZ)PlugSubAlloc(g, NULL, 1 + valp->GetValLen());
- if ((sp = valp->GetCharString(p)) != p)
- strcpy (p, sp);
+ if ((sp = valp->GetCharString(p)) != p && sp)
+ strcpy(p, sp);
vp = new(g) TYPVAL<PSZ>(g, p, valp->GetValLen(), valp->GetValPrec());
break;
@@ -472,7 +475,7 @@ PVAL AllocateValue(PGLOBAL g, PVAL valp, int newtype, int uns)
break;
case TYPE_DATE:
- vp = new(g) DTVAL(g, valp->GetIntValue());
+ vp = new(g) DTVAL(valp->GetIntValue());
break;
case TYPE_DOUBLE:
vp = new(g) TYPVAL<double>(valp->GetFloatValue(), TYPE_DOUBLE,
@@ -548,7 +551,7 @@ BYTE VALUE::TestValue(PVAL vp)
/***********************************************************************/
/* Compute a function on a string. */
/***********************************************************************/
-bool VALUE::Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op)
+bool VALUE::Compute(PGLOBAL g, PVAL *, int, OPVAL)
{
strcpy(g->Message, "Compute not implemented for this value type");
return true;
@@ -624,13 +627,16 @@ int TYPVAL<double>::GetValLen(void)
template <class TYPE>
bool TYPVAL<TYPE>::SetValue_pval(PVAL valp, bool chktype)
{
- if (chktype && Type != valp->GetType())
- return true;
+ if (valp != this) {
+ if (chktype && Type != valp->GetType())
+ return true;
- if (!(Null = valp->IsNull() && Nullable))
- Tval = GetTypedValue(valp);
- else
- Reset();
+ if (!(Null = valp->IsNull() && Nullable))
+ Tval = GetTypedValue(valp);
+ else
+ Reset();
+
+ } // endif valp
return false;
} // end of SetValue
@@ -970,7 +976,7 @@ ulonglong TYPVAL<ulonglong>::MinMaxVal(bool b)
{return (b) ? 0xFFFFFFFFFFFFFFFFLL : 0;}
template <>
-double TYPVAL<double>::MinMaxVal(bool b)
+double TYPVAL<double>::MinMaxVal(bool)
{assert(false); return 0.0;}
template <>
@@ -1216,12 +1222,12 @@ TYPVAL<PSZ>::TYPVAL(PSZ s) : VALUE(TYPE_STRING)
TYPVAL<PSZ>::TYPVAL(PGLOBAL g, PSZ s, int n, int c)
: VALUE(TYPE_STRING)
{
- Len = (g) ? n : strlen(s);
+ Len = (g) ? n : (s) ? strlen(s) : 0;
if (!s) {
if (g) {
if ((Strp = (char *)PlgDBSubAlloc(g, NULL, Len + 1)))
- Strp[Len] = '\0';
+ memset(Strp, 0, Len + 1);
else
Len = 0;
@@ -1316,15 +1322,18 @@ ulonglong TYPVAL<PSZ>::GetUBigintValue(void)
/***********************************************************************/
bool TYPVAL<PSZ>::SetValue_pval(PVAL valp, bool chktype)
{
- if (chktype && (valp->GetType() != Type || valp->GetSize() > Len))
- return true;
+ if (valp != this) {
+ if (chktype && (valp->GetType() != Type || valp->GetSize() > Len))
+ return true;
- char buf[64];
+ char buf[64];
- if (!(Null = valp->IsNull() && Nullable))
- strncpy(Strp, valp->GetCharString(buf), Len);
- else
- Reset();
+ if (!(Null = valp->IsNull() && Nullable))
+ strncpy(Strp, valp->GetCharString(buf), Len);
+ else
+ Reset();
+
+ } // endif valp
return false;
} // end of SetValue_pval
@@ -1557,7 +1566,7 @@ bool TYPVAL<PSZ>::GetBinValue(void *buf, int buflen, bool go)
/***********************************************************************/
/* STRING ShowValue: get string representation of a char value. */
/***********************************************************************/
-char *TYPVAL<PSZ>::ShowValue(char *buf, int len)
+char *TYPVAL<PSZ>::ShowValue(char *, int)
{
return Strp;
} // end of ShowValue
@@ -1565,7 +1574,7 @@ char *TYPVAL<PSZ>::ShowValue(char *buf, int len)
/***********************************************************************/
/* STRING GetCharString: get string representation of a char value. */
/***********************************************************************/
-char *TYPVAL<PSZ>::GetCharString(char *p)
+char *TYPVAL<PSZ>::GetCharString(char *)
{
return Strp;
} // end of GetCharString
@@ -1609,10 +1618,10 @@ int TYPVAL<PSZ>::CompareValue(PVAL vp)
else
n = strcmp(Strp, vp->GetCharValue());
-#if defined(WIN32)
+#if defined(__WIN__)
if (n == _NLSCMPERROR)
return n; // Here we should raise an error
-#endif // WIN32
+#endif // __WIN__
return (n > 0) ? 1 : (n < 0) ? -1 : 0;
} // end of CompareValue
@@ -1672,7 +1681,7 @@ bool TYPVAL<PSZ>::FormatValue(PVAL vp, char *fmt)
/***********************************************************************/
/* STRING SetFormat function (used to set SELECT output format). */
/***********************************************************************/
-bool TYPVAL<PSZ>::SetConstFormat(PGLOBAL g, FORMAT& fmt)
+bool TYPVAL<PSZ>::SetConstFormat(PGLOBAL, FORMAT& fmt)
{
fmt.Type[0] = 'C';
fmt.Length = Len;
@@ -2060,18 +2069,21 @@ double BINVAL::GetFloatValue(void)
/***********************************************************************/
bool BINVAL::SetValue_pval(PVAL valp, bool chktype)
{
- if (chktype && (valp->GetType() != Type || valp->GetSize() > Clen))
- return true;
-
bool rc = false;
-
- if (!(Null = valp->IsNull() && Nullable)) {
- if ((rc = (Len = valp->GetSize()) > Clen))
- Len = Clen;
+
+ if (valp != this) {
+ if (chktype && (valp->GetType() != Type || valp->GetSize() > Clen))
+ return true;
- memcpy(Binp, valp->GetTo_Val(), Len);
- } else
- Reset();
+ if (!(Null = valp->IsNull() && Nullable)) {
+ if ((rc = (Len = valp->GetSize()) > Clen))
+ Len = Clen;
+
+ memcpy(Binp, valp->GetTo_Val(), Len);
+ } else
+ Reset();
+
+ } // endif valp
return rc;
} // end of SetValue_pval
@@ -2288,7 +2300,7 @@ char *BINVAL::ShowValue(char *buf, int len)
/***********************************************************************/
/* BINVAL GetCharString: get string representation of a binary value. */
/***********************************************************************/
-char *BINVAL::GetCharString(char *p)
+char *BINVAL::GetCharString(char *)
{
if (!Chrp)
Chrp = (char*)PlugSubAlloc(Global, NULL, Clen * 2 + 1);
@@ -2337,7 +2349,7 @@ bool BINVAL::FormatValue(PVAL vp, char *fmt)
/***********************************************************************/
/* BINVAL SetFormat function (used to set SELECT output format). */
/***********************************************************************/
-bool BINVAL::SetConstFormat(PGLOBAL g, FORMAT& fmt)
+bool BINVAL::SetConstFormat(PGLOBAL, FORMAT& fmt)
{
fmt.Type[0] = 'B';
fmt.Length = Clen;
@@ -2367,7 +2379,7 @@ DTVAL::DTVAL(PGLOBAL g, int n, int prec, PSZ fmt)
/***********************************************************************/
/* DTVAL public constructor from int. */
/***********************************************************************/
-DTVAL::DTVAL(PGLOBAL g, int n) : TYPVAL<int>(n, TYPE_DATE)
+DTVAL::DTVAL(int n) : TYPVAL<int>(n, TYPE_DATE)
{
Pdtp = NULL;
Len = 19;
@@ -2626,21 +2638,24 @@ bool DTVAL::MakeDate(PGLOBAL g, int *val, int nval)
/***********************************************************************/
bool DTVAL::SetValue_pval(PVAL valp, bool chktype)
{
- if (chktype && Type != valp->GetType())
- return true;
+ if (valp != this) {
+ if (chktype && Type != valp->GetType())
+ return true;
- if (!(Null = valp->IsNull() && Nullable)) {
- if (Pdtp && !valp->IsTypeNum()) {
- int ndv;
- int dval[6];
+ if (!(Null = valp->IsNull() && Nullable)) {
+ if (Pdtp && !valp->IsTypeNum()) {
+ int ndv;
+ int dval[6];
+
+ ndv = ExtractDate(valp->GetCharValue(), Pdtp, DefYear, dval);
+ MakeDate(NULL, dval, ndv);
+ } else
+ Tval = valp->GetIntValue();
- ndv = ExtractDate(valp->GetCharValue(), Pdtp, DefYear, dval);
- MakeDate(NULL, dval, ndv);
} else
- Tval = valp->GetIntValue();
+ Reset();
- } else
- Reset();
+ } // endif valp
return false;
} // end of SetValue
diff --git a/storage/connect/value.h b/storage/connect/value.h
index c5aeb5c2a2f..780917c9962 100644
--- a/storage/connect/value.h
+++ b/storage/connect/value.h
@@ -36,8 +36,9 @@ typedef struct _datpar *PDTP; // For DTVAL
DllExport PSZ GetTypeName(int);
DllExport int GetTypeSize(int, int);
#ifdef ODBC_SUPPORT
-/* This function is exported for use in EOM table type DLLs */
-DllExport int TranslateSQLType(int stp, int prec, int& len, char& v);
+/* This function is exported for use in OEM table type DLLs */
+DllExport int TranslateSQLType(int stp, int prec,
+ int& len, char& v, bool& w);
#endif
DllExport char *GetFormatType(int);
DllExport int GetFormatType(char);
@@ -94,18 +95,18 @@ class DllExport VALUE : public BLOCK {
virtual bool SetValue_pval(PVAL valp, bool chktype = false) = 0;
virtual bool SetValue_char(char *p, int n) = 0;
virtual void SetValue_psz(PSZ s) = 0;
- virtual void SetValue_bool(bool b) {assert(FALSE);}
+ virtual void SetValue_bool(bool) {assert(FALSE);}
virtual int CompareValue(PVAL vp) = 0;
virtual BYTE TestValue(PVAL vp);
- virtual void SetValue(char c) {assert(false);}
- virtual void SetValue(uchar c) {assert(false);}
- virtual void SetValue(short i) {assert(false);}
- virtual void SetValue(ushort i) {assert(false);}
- virtual void SetValue(int n) {assert(false);}
- virtual void SetValue(uint n) {assert(false);}
- virtual void SetValue(longlong n) {assert(false);}
- virtual void SetValue(ulonglong n) {assert(false);}
- virtual void SetValue(double f) {assert(false);}
+ virtual void SetValue(char) {assert(false);}
+ virtual void SetValue(uchar) {assert(false);}
+ virtual void SetValue(short) {assert(false);}
+ virtual void SetValue(ushort) {assert(false);}
+ virtual void SetValue(int) {assert(false);}
+ virtual void SetValue(uint) {assert(false);}
+ virtual void SetValue(longlong) {assert(false);}
+ virtual void SetValue(ulonglong) {assert(false);}
+ virtual void SetValue(double) {assert(false);}
virtual void SetValue_pvblk(PVBLK blk, int n) = 0;
virtual void SetBinValue(void *p) = 0;
virtual bool GetBinValue(void *buf, int buflen, bool go) = 0;
@@ -338,7 +339,7 @@ class DllExport BINVAL: public VALUE {
virtual void SetValue(double f);
virtual void SetBinValue(void *p);
virtual bool GetBinValue(void *buf, int buflen, bool go);
- virtual int CompareValue(PVAL vp) {assert(false); return 0;}
+ virtual int CompareValue(PVAL) {assert(false); return 0;}
virtual char *ShowValue(char *buf, int);
virtual char *GetCharString(char *p);
virtual bool IsEqual(PVAL vp, bool chktype);
@@ -359,14 +360,9 @@ class DllExport DTVAL : public TYPVAL<int> {
public:
// Constructors
DTVAL(PGLOBAL g, int n, int p, PSZ fmt);
- DTVAL(PGLOBAL g, PSZ s, int n);
- DTVAL(PGLOBAL g, short i);
- DTVAL(PGLOBAL g, int n);
- DTVAL(PGLOBAL g, longlong n);
- DTVAL(PGLOBAL g, double f);
+ DTVAL(int n);
// 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 024a9c081cd..a2d75cec8ab 100755
--- a/storage/connect/xindex.cpp
+++ b/storage/connect/xindex.cpp
@@ -1,7 +1,7 @@
/***************** Xindex C++ Class Xindex Code (.CPP) *****************/
/* Name: XINDEX.CPP Version 2.9 */
/* */
-/* (C) Copyright to the author Olivier BERTRAND 2004-2014 */
+/* (C) Copyright to the author Olivier BERTRAND 2004-2015 */
/* */
/* This file contains the class XINDEX implementation code. */
/***********************************************************************/
@@ -10,12 +10,12 @@
/* Include relevant sections of the System header files. */
/***********************************************************************/
#include "my_global.h"
-#if defined(WIN32)
+#if defined(__WIN__)
#include <io.h>
#include <fcntl.h>
#include <errno.h>
//#include <windows.h>
-#else // !WIN32
+#else // !__WIN__
#if defined(UNIX)
#include <sys/types.h>
#include <sys/stat.h>
@@ -25,7 +25,7 @@
#include <io.h>
#endif // !UNIX
#include <fcntl.h>
-#endif // !WIN32
+#endif // !__WIN__
/***********************************************************************/
/* Include required application header files */
@@ -179,7 +179,7 @@ XXBASE::XXBASE(PTDBDOS tbxp, bool b) : CSORT(b),
/***********************************************************************/
/* Make file output of XINDEX contents. */
/***********************************************************************/
-void XXBASE::Print(PGLOBAL g, FILE *f, uint n)
+void XXBASE::Print(PGLOBAL, FILE *f, uint n)
{
char m[64];
@@ -191,7 +191,7 @@ void XXBASE::Print(PGLOBAL g, FILE *f, uint n)
/***********************************************************************/
/* Make string output of XINDEX contents. */
/***********************************************************************/
-void XXBASE::Print(PGLOBAL g, char *ps, uint z)
+void XXBASE::Print(PGLOBAL, char *ps, uint z)
{
*ps = '\0';
strncat(ps, "Xindex", z);
@@ -287,7 +287,7 @@ int XINDEX::Qcompare(int *i1, int *i2)
/* Sure enough, it is done while records are read and permit to avoid */
/* reading the table while doing the join (Dynamic index only) */
/***********************************************************************/
-bool XINDEX::AddColumns(PIXDEF xdp)
+bool XINDEX::AddColumns(void)
{
if (!Dynamic)
return false; // Not applying to static index
@@ -340,6 +340,9 @@ bool XINDEX::Make(PGLOBAL g, PIXDEF sxp)
} // endif n
+ if (trace)
+ htrc("XINDEX Make: n=%d\n", n);
+
// File position must be stored
Record.Size = n * sizeof(int);
@@ -377,7 +380,7 @@ bool XINDEX::Make(PGLOBAL g, PIXDEF sxp)
To_LastCol = prev;
- if (AddColumns(sxp)) {
+ if (AddColumns()) {
PCOL kolp = To_Cols[0]; // Temporary while imposing Nk = 1
i = 0;
@@ -477,6 +480,9 @@ bool XINDEX::Make(PGLOBAL g, PIXDEF sxp)
} else
To_Rec[nkey] = Tdbp->GetRecpos();
+ if (trace > 1)
+ htrc("Make: To_Rec[%d]=%d\n", nkey, To_Rec[nkey]);
+
/*******************************************************************/
/* Get the keys and place them in the key blocks. */
/*******************************************************************/
@@ -733,7 +739,7 @@ int XINDEX::ColMaxSame(PXCOL kp)
/* Reorder: use the sort index to reorder the data in storage so */
/* it will be physically sorted and sort index can be removed. */
/***********************************************************************/
-bool XINDEX::Reorder(PGLOBAL g)
+bool XINDEX::Reorder(PGLOBAL g __attribute__((unused)))
{
register int i, j, k, n;
bool sorted = true;
@@ -835,7 +841,7 @@ bool XINDEX::SaveIndex(PGLOBAL g, PIXDEF sxp)
if ((sep = defp->GetBoolCatInfo("SepIndex", false))) {
// Index is saved in a separate file
-#if !defined(UNIX)
+#if defined(__WIN__)
char drive[_MAX_DRIVE];
#else
char *drive = NULL;
@@ -988,7 +994,7 @@ bool XINDEX::Init(PGLOBAL g)
if (defp->SepIndex()) {
// Index was saved in a separate file
-#if !defined(UNIX)
+#if defined(__WIN__)
char drive[_MAX_DRIVE];
#else
char *drive = NULL;
@@ -1241,7 +1247,7 @@ bool XINDEX::MapInit(PGLOBAL g)
if (defp->SepIndex()) {
// Index was save in a separate file
-#if !defined(UNIX)
+#if defined(__WIN__)
char drive[_MAX_DRIVE];
#else
char *drive = NULL;
@@ -1454,7 +1460,7 @@ bool XINDEX::GetAllSizes(PGLOBAL g,/* int &ndif,*/ int &numk)
if (defp->SepIndex()) {
// Index was saved in a separate file
-#if !defined(UNIX)
+#if defined(__WIN__)
char drive[_MAX_DRIVE];
#else
char *drive = NULL;
@@ -1585,7 +1591,7 @@ int XINDEX::Range(PGLOBAL g, int limit, bool incl)
if (++i == Nval) break;
} // endfor kp
- if ((k = FastFind(Nval)) < Num_K)
+ if ((k = FastFind()) < Num_K)
n = k;
// if (limit)
// n = (Mul) ? k : kp->Val_K;
@@ -1759,6 +1765,9 @@ int XINDEX::Fetch(PGLOBAL g)
if (Num_K == 0)
return -1; // means end of file
+ if (trace > 1)
+ htrc("XINDEX Fetch: Op=%d\n", Op);
+
/*********************************************************************/
/* Table read through a sorted index. */
/*********************************************************************/
@@ -1776,9 +1785,6 @@ int XINDEX::Fetch(PGLOBAL g)
break;
case OP_SAME: // Read next same
// Logically the key values should be the same as before
- if (trace > 1)
- htrc("looking for next same value\n");
-
if (NextVal(true)) {
Op = OP_EQ;
return -2; // no more equal values
@@ -1824,9 +1830,9 @@ int XINDEX::Fetch(PGLOBAL g)
Nth++;
if (trace > 1)
- htrc("Fetch: Looking for new value\n");
+ htrc("Fetch: Looking for new value Nth=%d\n", Nth);
- Cur_K = FastFind(Nval);
+ Cur_K = FastFind();
if (Cur_K >= Num_K)
/*************************************************************/
@@ -1857,12 +1863,12 @@ int XINDEX::Fetch(PGLOBAL g)
/* FastFind: Returns the index of matching record in a join using an */
/* optimized algorithm based on dichotomie and optimized comparing. */
/***********************************************************************/
-int XINDEX::FastFind(int nv)
+int XINDEX::FastFind(void)
{
register int curk, sup, inf, i= 0, k, n = 2;
register PXCOL kp, kcp;
- assert((int)nv == Nval);
+//assert((int)nv == Nval);
if (Nblk && Op == OP_EQ) {
// Look in block values to find in which block to search
@@ -1896,6 +1902,10 @@ int XINDEX::FastFind(int nv)
sup = To_KeyCol->Ndf;
} // endif Nblk
+ if (trace > 2)
+ htrc("XINDEX FastFind: Nblk=%d Op=%d inf=%d sup=%d\n",
+ Nblk, Op, inf, sup);
+
for (k = 0, kcp = To_KeyCol; kcp; kcp = kcp->Next) {
while (sup - inf > 1) {
i = (inf + sup) >> 1;
@@ -1970,6 +1980,9 @@ int XINDEX::FastFind(int nv)
curk = (kcp->Kof) ? kcp->Kof[kcp->Val_K] : kcp->Val_K;
} // endfor kcp
+ if (trace > 2)
+ htrc("XINDEX FastFind: curk=%d\n", curk);
+
return curk;
} // end of FastFind
@@ -2018,7 +2031,7 @@ int XINDXS::Range(PGLOBAL g, int limit, bool incl)
/*********************************************************************/
if (xp->GetType() == TYPE_CONST) {
kp->Valp->SetValue_pval(xp->GetValue(), !kp->Prefix);
- k = FastFind(Nval);
+ k = FastFind();
if (k < Num_K || Op != OP_EQ)
if (limit)
@@ -2043,8 +2056,7 @@ int XINDXS::GroupSize(void)
#if defined(_DEBUG)
assert(To_KeyCol->Val_K >= 0 && To_KeyCol->Val_K < Ndif);
#endif // _DEBUG
- return (Pof) ? Pof[To_KeyCol->Val_K + 1] - Pof[To_KeyCol->Val_K]
- : 1;
+ return (Pof) ? Pof[To_KeyCol->Val_K + 1] - Pof[To_KeyCol->Val_K] : 1;
} // end of GroupSize
/***********************************************************************/
@@ -2106,6 +2118,9 @@ int XINDXS::Fetch(PGLOBAL g)
if (Num_K == 0)
return -1; // means end of file
+ if (trace > 1)
+ htrc("XINDXS Fetch: Op=%d\n", Op);
+
/*********************************************************************/
/* Table read through a sorted index. */
/*********************************************************************/
@@ -2120,9 +2135,6 @@ int XINDXS::Fetch(PGLOBAL g)
Op = OP_NEXT;
break;
case OP_SAME: // Read next same
- if (trace > 1)
- htrc("looking for next same value\n");
-
if (!Mul || NextVal(true)) {
Op = OP_EQ;
return -2; // No more equal values
@@ -2160,9 +2172,9 @@ int XINDXS::Fetch(PGLOBAL g)
Nth++;
if (trace > 1)
- htrc("Fetch: Looking for new value\n");
+ htrc("Fetch: Looking for new value Nth=%d\n", Nth);
- Cur_K = FastFind(1);
+ Cur_K = FastFind();
if (Cur_K >= Num_K)
// Rank not whithin index table, signal record not found
@@ -2190,9 +2202,9 @@ int XINDXS::Fetch(PGLOBAL g)
/* FastFind: Returns the index of matching indexed record using an */
/* optimized algorithm based on dichotomie and optimized comparing. */
/***********************************************************************/
-int XINDXS::FastFind(int nk)
+int XINDXS::FastFind(void)
{
- register int sup, inf, i= 0, n = 2;
+ register int sup, inf, i= 0, n = 2;
register PXCOL kcp = To_KeyCol;
if (Nblk && Op == OP_EQ) {
@@ -2215,7 +2227,6 @@ int XINDXS::FastFind(int nk)
if (inf < 0)
return Num_K;
-// i = inf;
inf *= Sblk;
if ((sup = inf + Sblk) > Ndif)
@@ -2227,6 +2238,10 @@ int XINDXS::FastFind(int nk)
sup = Ndif;
} // endif Nblk
+ if (trace > 2)
+ htrc("XINDXS FastFind: Nblk=%d Op=%d inf=%d sup=%d\n",
+ Nblk, Op, inf, sup);
+
while (sup - inf > 1) {
i = (inf + sup) >> 1;
@@ -2249,6 +2264,9 @@ int XINDXS::FastFind(int nk)
n = 0;
} // endif sup
+ if (trace > 2)
+ htrc("XINDXS FastFind: n=%d i=%d\n", n, i);
+
// Loop on kcp because of dynamic indexing
for (; kcp; kcp = kcp->Next)
kcp->Val_K = i; // Used by FillValue
@@ -2330,6 +2348,10 @@ bool XFILE::Open(PGLOBAL g, char *filename, int id, MODE mode)
} // endif
NewOff.Low = (int)ftell(Xfile);
+
+ if (trace)
+ htrc("XFILE Open: NewOff.Low=%d\n", NewOff.Low);
+
} else if (mode == MODE_WRITE) {
if (id >= 0) {
// New not sep index file. Write the header.
@@ -2337,6 +2359,10 @@ bool XFILE::Open(PGLOBAL g, char *filename, int id, MODE mode)
Write(g, noff, sizeof(IOFF), MAX_INDX, rc);
fseek(Xfile, 0, SEEK_END);
NewOff.Low = (int)ftell(Xfile);
+
+ if (trace)
+ htrc("XFILE Open: NewOff.Low=%d\n", NewOff.Low);
+
} // endif id
} else if (mode == MODE_READ && id >= 0) {
@@ -2346,6 +2372,9 @@ bool XFILE::Open(PGLOBAL g, char *filename, int id, MODE mode)
return true;
} // endif MAX_INDX
+ if (trace)
+ htrc("XFILE Open: noff[%d].Low=%d\n", id, noff[id].Low);
+
// Position the cursor at the offset of this index
if (fseek(Xfile, noff[id].Low, SEEK_SET)) {
sprintf(g->Message, MSG(FUNC_ERRNO), errno, "Xseek");
@@ -2360,7 +2389,8 @@ bool XFILE::Open(PGLOBAL g, char *filename, int id, MODE mode)
/***********************************************************************/
/* Move into an index file. */
/***********************************************************************/
-bool XFILE::Seek(PGLOBAL g, int low, int high, int origin)
+bool XFILE::Seek(PGLOBAL g, int low, int high __attribute__((unused)),
+ int origin)
{
#if defined(_DEBUG)
assert(high == 0);
@@ -2371,7 +2401,6 @@ bool XFILE::Seek(PGLOBAL g, int low, int high, int origin)
return true;
} // endif
-//ftell(Xfile);
return false;
} // end of Seek
@@ -2479,7 +2508,7 @@ bool XHUGE::Open(PGLOBAL g, char *filename, int id, MODE mode)
if (trace)
htrc(" Xopen: filename=%s id=%d mode=%d\n", filename, id, mode);
-#if defined(WIN32)
+#if defined(__WIN__)
LONG high = 0;
DWORD rc, drc, access, share, creation;
@@ -2655,7 +2684,7 @@ bool XHUGE::Open(PGLOBAL g, char *filename, int id, MODE mode)
/***********************************************************************/
bool XHUGE::Seek(PGLOBAL g, int low, int high, int origin)
{
-#if defined(WIN32)
+#if defined(__WIN__)
LONG hi = high;
DWORD rc = SetFilePointer(Hfile, low, &hi, origin);
@@ -2691,7 +2720,7 @@ bool XHUGE::Read(PGLOBAL g, void *buf, int n, int size)
{
bool rc = false;
-#if defined(WIN32)
+#if defined(__WIN__)
bool brc;
DWORD nbr, count = (DWORD)(n * size);
@@ -2737,7 +2766,7 @@ bool XHUGE::Read(PGLOBAL g, void *buf, int n, int size)
/***********************************************************************/
int XHUGE::Write(PGLOBAL g, void *buf, int n, int size, bool& rc)
{
-#if defined(WIN32)
+#if defined(__WIN__)
bool brc;
DWORD nbw, count = (DWORD)n * (DWORD) size;
@@ -2779,7 +2808,7 @@ void XHUGE::Close(char *fn, int id)
if (trace)
htrc("XHUGE::Close: fn=%s id=%d NewOff=%lld\n", fn, id, NewOff.Val);
-#if defined(WIN32)
+#if defined(__WIN__)
if (id >= 0 && fn) {
CloseFileHandle(Hfile);
Hfile = CreateFile(fn, GENERIC_READ | GENERIC_WRITE, 0, NULL,
@@ -2794,7 +2823,7 @@ void XHUGE::Close(char *fn, int id)
} // endif SetFilePointer
} // endif id
-#else // !WIN32
+#else // !__WIN__
if (id >= 0 && fn) {
if (Hfile != INVALID_HANDLE_VALUE) {
if (lseek64(Hfile, id * sizeof(IOFF), SEEK_SET) >= 0) {
@@ -2810,7 +2839,7 @@ void XHUGE::Close(char *fn, int id)
htrc("(XHUGE)error reopening %s: %s\n", fn, strerror(errno));
} // endif id
-#endif // !WIN32
+#endif // !__WIN__
XLOAD::Close();
} // end of Close
@@ -2819,7 +2848,7 @@ void XHUGE::Close(char *fn, int id)
/***********************************************************************/
/* Don't know whether this is possible for huge files. */
/***********************************************************************/
-void *XHUGE::FileView(PGLOBAL g, char *fn)
+void *XHUGE::FileView(PGLOBAL g, char *)
{
strcpy(g->Message, MSG(NO_PART_MAP));
return NULL;
@@ -2879,7 +2908,7 @@ bool XXROW::Init(PGLOBAL g)
/***********************************************************************/
/* RANGE: Tell how many record exist in a given value range. */
/***********************************************************************/
-int XXROW::Range(PGLOBAL g, int limit, bool incl)
+int XXROW::Range(PGLOBAL, int limit, bool incl)
{
int n = Valp->GetIntValue();
@@ -2895,7 +2924,7 @@ int XXROW::Range(PGLOBAL g, int limit, bool incl)
/***********************************************************************/
/* XXROW: Fetch a physical or logical record. */
/***********************************************************************/
-int XXROW::Fetch(PGLOBAL g)
+int XXROW::Fetch(PGLOBAL)
{
if (Num_K == 0)
return -1; // means end of file
@@ -2904,7 +2933,7 @@ int XXROW::Fetch(PGLOBAL g)
/* Look for a key equal to the link column of previous table, */
/* and return its rank whithin the index table. */
/*********************************************************************/
- Cur_K = FastFind(1);
+ Cur_K = FastFind();
if (Cur_K >= Num_K)
/*******************************************************************/
@@ -2926,7 +2955,7 @@ int XXROW::Fetch(PGLOBAL g)
/***********************************************************************/
/* FastFind: Returns the index of matching record in a join. */
/***********************************************************************/
-int XXROW::FastFind(int nk)
+int XXROW::FastFind(void)
{
int n = Valp->GetIntValue();
@@ -3158,12 +3187,18 @@ bool KXYCOL::InitFind(PGLOBAL g, PXOB xp)
xp->Reset();
xp->Eval(g);
Valp->SetValue_pval(xp->GetValue(), false);
-// Valp->SetValue_pval(xp->GetValue(), !Prefix);
} // endif Type
+ if (trace > 1) {
+ char buf[32];
+
+ htrc("KCOL InitFind: value=%s\n", Valp->GetCharString(buf));
+ } // endif trace
+
return false;
} // end of InitFind
+#if 0
/***********************************************************************/
/* InitBinFind: initialize Value to the value pointed by vp. */
/***********************************************************************/
@@ -3171,6 +3206,7 @@ void KXYCOL::InitBinFind(void *vp)
{
Valp->SetBinValue(vp);
} // end of InitBinFind
+#endif // 0
/***********************************************************************/
/* KXYCOL FillValue: called by COLBLK::Eval when a column value is */
diff --git a/storage/connect/xindex.h b/storage/connect/xindex.h
index c702baeec83..51b678992ea 100644
--- a/storage/connect/xindex.h
+++ b/storage/connect/xindex.h
@@ -1,7 +1,7 @@
/*************** Xindex H Declares Source Code File (.H) ***************/
/* Name: XINDEX.H Version 3.5 */
/* */
-/* (C) Copyright to the author Olivier BERTRAND 2004 - 2013 */
+/* (C) Copyright to the author Olivier BERTRAND 2004 - 2015 */
/* */
/* This file contains the XINDEX class declares. */
/***********************************************************************/
@@ -65,7 +65,11 @@ typedef struct index_def : public BLOCK {
typedef struct index_off {
union {
+#if defined(WORDS_BIGENDIAN)
+ struct {int High; int Low;};
+#else // !WORDS_BIGENDIAN
struct {int Low; int High;};
+#endif //!WORDS_BIGENDIAN
longlong Val; // File position
}; // end of union
} IOFF;
@@ -205,12 +209,11 @@ class DllExport XXBASE : public CSORT, public BLOCK {
#endif // XMAP
virtual int MaxRange(void) {return 1;}
virtual int Fetch(PGLOBAL g) = 0;
- virtual bool NextVal(bool eq) {return true;}
+ virtual bool NextVal(bool) {return true;}
virtual bool PrevVal(void) {return true;}
- virtual int FastFind(int nk) = 0;
- virtual bool Reorder(PGLOBAL g) {return true;}
- virtual int Range(PGLOBAL g, int limit = 0, bool incl = true)
- {return -1;} // Means error
+ virtual int FastFind(void) = 0;
+ virtual bool Reorder(PGLOBAL) {return true;}
+ virtual int Range(PGLOBAL, int = 0, bool = true) {return -1;} // Means error
virtual int Qcompare(int *, int *) = 0;
virtual int GroupSize(void) {return 1;}
virtual void Close(void) = 0;
@@ -266,7 +269,7 @@ class DllExport XINDEX : public XXBASE {
#endif // XMAP
virtual int Qcompare(int *, int *);
virtual int Fetch(PGLOBAL g);
- virtual int FastFind(int nk);
+ virtual int FastFind(void);
virtual int GroupSize(void);
virtual int Range(PGLOBAL g, int limit = 0, bool incl = true);
virtual int MaxRange(void) {return MaxSame;}
@@ -280,7 +283,7 @@ class DllExport XINDEX : public XXBASE {
bool GetAllSizes(PGLOBAL g,/* int &ndif,*/ int &numk);
protected:
- bool AddColumns(PIXDEF xdp);
+ bool AddColumns(void);
bool NextValDif(void);
// Members
@@ -312,7 +315,7 @@ class DllExport XINDXS : public XINDEX {
// Methods
virtual int Qcompare(int *, int *);
virtual int Fetch(PGLOBAL g);
- virtual int FastFind(int nk);
+ virtual int FastFind(void);
virtual bool NextVal(bool eq);
virtual bool PrevVal(void);
virtual int Range(PGLOBAL g, int limit = 0, bool incl = true);
@@ -347,7 +350,7 @@ class DllExport XLOAD : public BLOCK {
protected:
// Members
-#if defined(WIN32)
+#if defined(__WIN__)
HANDLE Hfile; // Handle to file or map
#else // UNIX
int Hfile; // Descriptor to file or map
@@ -391,6 +394,7 @@ class DllExport XHUGE : public XLOAD {
XHUGE(void) : XLOAD() {}
// Methods
+ using XLOAD::Close;
virtual bool Open(PGLOBAL g, char *filename, int id, MODE mode);
virtual bool Seek(PGLOBAL g, int low, int high, int origin);
virtual bool Read(PGLOBAL g, void *buf, int n, int size);
@@ -420,14 +424,14 @@ class DllExport XXROW : public XXBASE {
// Methods
virtual bool Init(PGLOBAL g);
#if defined(XMAP)
- virtual bool MapInit(PGLOBAL g) {return true;}
+ virtual bool MapInit(PGLOBAL) {return true;}
#endif // XMAP
virtual int Fetch(PGLOBAL g);
- virtual int FastFind(int nk);
+ virtual int FastFind(void);
virtual int MaxRange(void) {return 1;}
virtual int Range(PGLOBAL g, int limit = 0, bool incl = true);
virtual int Qcompare(int *, int *) {assert(false); return 0;}
- virtual bool Make(PGLOBAL g, PIXDEF sxp) {return false;}
+ virtual bool Make(PGLOBAL, PIXDEF) {return false;}
virtual void Close(void) {}
protected:
@@ -462,7 +466,7 @@ class KXYCOL: public BLOCK {
virtual void FreeData(void);
virtual void FillValue(PVAL valp);
virtual int CompVal(int i);
- void InitBinFind(void *vp);
+// void InitBinFind(void *vp);
bool MakeBlockArray(PGLOBAL g, int nb, int size);
int Compare(int i1, int i2);
int CompBval(int i);
diff --git a/storage/connect/xobject.cpp b/storage/connect/xobject.cpp
index 4ddd4f5b30f..a6faebf3c2b 100644
--- a/storage/connect/xobject.cpp
+++ b/storage/connect/xobject.cpp
@@ -11,6 +11,7 @@
/* Include mariaDB header file. */
/***********************************************************************/
#include "my_global.h"
+#include "m_string.h"
/***********************************************************************/
/* Include required application header files */
@@ -290,6 +291,34 @@ bool STRING::Set(char *s, uint n)
} // end of Set
/***********************************************************************/
+/* Append a char* to a STRING. */
+/***********************************************************************/
+bool STRING::Append(const char *s, uint ln)
+{
+ if (!s)
+ return false;
+
+ uint len = Length + ln + 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
+
+ strncpy(Strp + Length, s, ln);
+ Length = len - 1;
+ Strp[Length] = 0;
+ return false;
+} // end of Append
+
+/***********************************************************************/
/* Append a PSZ to a STRING. */
/***********************************************************************/
bool STRING::Append(PSZ s)
@@ -347,6 +376,31 @@ bool STRING::Append(char c)
} // end of Append
/***********************************************************************/
+/* Append a quoted PSZ to a STRING. */
+/***********************************************************************/
+bool STRING::Append_quoted(PSZ s)
+{
+ bool b = Append('\'');
+
+ if (s) for (char *p = s; !b && *p; p++)
+ switch (*p) {
+ case '\'':
+ case '\\':
+ case '\t':
+ case '\n':
+ case '\r':
+ case '\b':
+ case '\f': b |= Append('\\');
+ // passthru
+ default:
+ b |= Append(*p);
+ break;
+ } // endswitch *p
+
+ return (b |= Append('\''));
+} // end of Append_quoted
+
+/***********************************************************************/
/* Resize to given length but only when last suballocated. */
/* New size should be greater than string length. */
/***********************************************************************/
diff --git a/storage/connect/xobject.h b/storage/connect/xobject.h
index bb7b0150ed8..82ff9e21225 100644
--- a/storage/connect/xobject.h
+++ b/storage/connect/xobject.h
@@ -42,9 +42,9 @@ class DllExport XOBJECT : public BLOCK {
virtual int GetResultType(void) {return TYPE_VOID;}
virtual int GetKey(void) {return 0;}
#if defined(_DEBUG)
- virtual void SetKey(int k) {assert(false);}
+ virtual void SetKey(int) {assert(false);}
#else // !_DEBUG
- virtual void SetKey(int k) {} // Only defined for COLBLK
+ virtual void SetKey(int) {} // Only defined for COLBLK
#endif // !_DEBUG
virtual int GetLength(void) = 0;
virtual int GetLengthEx(void) = 0;
@@ -134,10 +134,12 @@ class DllExport STRING : public BLOCK {
inline void Reset(void) {*Strp = 0;}
bool Set(PSZ s);
bool Set(char *s, uint n);
+ bool Append(const char *s, uint ln);
bool Append(PSZ s);
bool Append(STRING &str);
bool Append(char c);
bool Resize(uint n);
+ bool Append_quoted(PSZ s);
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;}
diff --git a/storage/connect/xtable.h b/storage/connect/xtable.h
index 501a5e87cfa..1a75d97bafa 100644
--- a/storage/connect/xtable.h
+++ b/storage/connect/xtable.h
@@ -1,7 +1,7 @@
/**************** Table H Declares Source Code File (.H) ***************/
/* Name: TABLE.H Version 2.3 */
/* */
-/* (C) Copyright to the author Olivier BERTRAND 1999-2014 */
+/* (C) Copyright to the author Olivier BERTRAND 1999-2015 */
/* */
/* This file contains the TBX, OPJOIN and TDB class definitions. */
/***********************************************************************/
@@ -24,9 +24,7 @@ typedef class CMD *PCMD;
class CMD : public BLOCK {
public:
// Constructor
- CMD(PGLOBAL g, char *cmd) {
- Cmd = (char*)PlugSubAlloc(g, NULL, strlen(cmd) + 1);
- strcpy(Cmd, cmd); Next = NULL; }
+ CMD(PGLOBAL g, char *cmd) {Cmd = PlugDup(g, cmd); Next = NULL;}
// Members
PCMD Next;
@@ -79,21 +77,21 @@ class DllExport TDB: public BLOCK { // Table Descriptor Block.
virtual int GetTdb_No(void) {return Tdb_No;}
virtual PTDB GetNext(void) {return Next;}
virtual PCATLG GetCat(void) {return NULL;}
- virtual void SetAbort(bool b) {;}
+ virtual void SetAbort(bool) {;}
// 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 bool GetBlockValues(PGLOBAL) {return false;}
+ virtual int Cardinality(PGLOBAL) {return 0;}
virtual int GetMaxSize(PGLOBAL) = 0;
virtual int GetProgMax(PGLOBAL) = 0;
virtual int GetProgCur(void) = 0;
virtual int RowNumber(PGLOBAL g, bool b = false);
virtual bool IsReadOnly(void) {return true;}
virtual const CHARSET_INFO *data_charset() {return NULL;}
- virtual PTDB Duplicate(PGLOBAL g) {return NULL;}
- virtual PTDB CopyOne(PTABS t) {return this;}
+ virtual PTDB Duplicate(PGLOBAL) {return NULL;}
+ virtual PTDB CopyOne(PTABS) {return this;}
virtual PTDB Copy(PTABS t);
virtual void PrintAM(FILE *f, char *m)
{fprintf(f, "%s AM(%d)\n", m, GetAmType());}
@@ -110,7 +108,7 @@ class DllExport TDB: public BLOCK { // Table Descriptor Block.
virtual int WriteDB(PGLOBAL) = 0;
virtual int DeleteDB(PGLOBAL, int) = 0;
virtual void CloseDB(PGLOBAL) = 0;
- virtual int CheckWrite(PGLOBAL g) {return 0;}
+ virtual int CheckWrite(PGLOBAL) {return 0;}
virtual bool ReadKey(PGLOBAL, OPVAL, const void *, int) = 0;
protected:
@@ -157,7 +155,7 @@ class DllExport TDBASE : public TDB {
PCOL Key(int i) {return (To_Key_Col) ? To_Key_Col[i] : NULL;}
// Methods
- virtual bool IsUsingTemp(PGLOBAL g) {return false;}
+ virtual bool IsUsingTemp(PGLOBAL) {return false;}
virtual bool IsIndexed(void) {return false;}
virtual bool IsSpecial(PSZ name);
virtual PCATLG GetCat(void);
@@ -172,9 +170,9 @@ class DllExport TDBASE : public TDB {
virtual CHARSET_INFO *data_charset(void);
virtual int GetProgMax(PGLOBAL g) {return GetMaxSize(g);}
virtual int GetProgCur(void) {return GetRecpos();}
- virtual PSZ GetFile(PGLOBAL g) {return "Not a file";}
+ virtual PSZ GetFile(PGLOBAL) {return "Not a file";}
virtual int GetRemote(void) {return 0;}
- virtual void SetFile(PGLOBAL g, PSZ fn) {}
+ virtual void SetFile(PGLOBAL, PSZ) {}
virtual void ResetDB(void) {}
virtual void ResetSize(void) {MaxSize = -1;}
virtual void RestoreNrec(void) {}
@@ -185,12 +183,12 @@ class DllExport TDBASE : public TDB {
virtual PCOL ColDB(PGLOBAL g, PSZ name, int num);
virtual PCOL MakeCol(PGLOBAL, PCOLDEF, PCOL, int)
{assert(false); return NULL;}
- virtual PCOL InsertSpecialColumn(PGLOBAL g, PCOL colp);
+ virtual PCOL InsertSpecialColumn(PCOL colp);
virtual PCOL InsertSpcBlk(PGLOBAL g, PCOLDEF cdp);
virtual void MarkDB(PGLOBAL g, PTDB tdb2);
- virtual int MakeIndex(PGLOBAL g, PIXDEF pxdf, bool add)
+ virtual int MakeIndex(PGLOBAL g, PIXDEF, bool)
{strcpy(g->Message, "Remote index"); return RC_INFO;}
- virtual bool ReadKey(PGLOBAL g, OPVAL op, const void *key, int len)
+ virtual bool ReadKey(PGLOBAL, OPVAL, const void *, int)
{assert(false); return true;}
protected:
@@ -227,7 +225,7 @@ class DllExport TDBCAT : public TDBASE {
// Methods
virtual int GetRecpos(void) {return N;}
virtual int GetProgCur(void) {return N;}
- virtual int RowNumber(PGLOBAL g, bool b = false) {return N + 1;}
+ virtual int RowNumber(PGLOBAL, bool = false) {return N + 1;}
virtual bool SetRecpos(PGLOBAL g, int recpos);
// Database routines
diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc
index 6d3d665b9f1..ee44898f7bd 100644
--- a/storage/federated/ha_federated.cc
+++ b/storage/federated/ha_federated.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2004, 2013, Oracle and/or its affiliates.
+/* Copyright (c) 2004, 2015, 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
@@ -1665,9 +1665,9 @@ int ha_federated::close(void)
DBUG_ENTER("ha_federated::close");
free_result();
-
+
delete_dynamic(&results);
-
+
/* Disconnect from mysql */
mysql_close(mysql);
mysql= NULL;
@@ -2883,7 +2883,7 @@ int ha_federated::info(uint flag)
}
- if (flag & HA_STATUS_AUTO)
+ if ((flag & HA_STATUS_AUTO) && mysql)
stats.auto_increment_value= mysql->insert_id;
mysql_free_result(result);
diff --git a/storage/federatedx/README.windows b/storage/federatedx/README.windows
index 3f1f2a3c79a..74de15c6521 100644
--- a/storage/federatedx/README.windows
+++ b/storage/federatedx/README.windows
@@ -1,23 +1,23 @@
-The following files are changed in order to build a new engine on Windows:
-
-- Update win\configure.js with
-case "WITH_FEDERATEDX_STORAGE_ENGINE":
-to make sure it will pass WITH_FEDERATEDX_STORAGE_ENGINE in.
-
-- Update CMakeFiles.txt under mysql root:
- IF(WITH_FEDERATEDX_STORAGE_ENGINE)
- ADD_DEFINITIONS(-D WITH_FEDERATEDX_STORAGE_ENGINE)
- SET (mysql_plugin_defs
- "${mysql_plugin_defs},builtin_skeleton_plugin")
- ENDIF(WITH_FEDERATEDX_STORAGE_ENGINE)
-
- and,
-
- IF(WITH_FEDERATEDX_STORAGE_ENGINE)
- ADD_SUBDIRECTORY(storage/skeleton/src)
- ENDIF(WITH_FEDERATEDX_STORAGE_ENGINE)
-
- - Update CMakeFiles.txt under sql:
- IF(WITH_FEDERATEDX_STORAGE_ENGINE)
- TARGET_LINK_LIBRARIES(mysqld skeleton)
- ENDIF(WITH_FEDERATEDX_STORAGE_ENGINE)
+The following files are changed in order to build a new engine on Windows:
+
+- Update win\configure.js with
+case "WITH_FEDERATEDX_STORAGE_ENGINE":
+to make sure it will pass WITH_FEDERATEDX_STORAGE_ENGINE in.
+
+- Update CMakeFiles.txt under mysql root:
+ IF(WITH_FEDERATEDX_STORAGE_ENGINE)
+ ADD_DEFINITIONS(-D WITH_FEDERATEDX_STORAGE_ENGINE)
+ SET (mysql_plugin_defs
+ "${mysql_plugin_defs},builtin_skeleton_plugin")
+ ENDIF(WITH_FEDERATEDX_STORAGE_ENGINE)
+
+ and,
+
+ IF(WITH_FEDERATEDX_STORAGE_ENGINE)
+ ADD_SUBDIRECTORY(storage/skeleton/src)
+ ENDIF(WITH_FEDERATEDX_STORAGE_ENGINE)
+
+ - Update CMakeFiles.txt under sql:
+ IF(WITH_FEDERATEDX_STORAGE_ENGINE)
+ TARGET_LINK_LIBRARIES(mysqld skeleton)
+ ENDIF(WITH_FEDERATEDX_STORAGE_ENGINE)
diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt
index f88cc12b1f2..eb94f6ba703 100644
--- a/storage/innobase/CMakeLists.txt
+++ b/storage/innobase/CMakeLists.txt
@@ -210,6 +210,8 @@ IF(HAVE_IB_ATOMIC_PTHREAD_T_GCC)
ADD_DEFINITIONS(-DHAVE_IB_ATOMIC_PTHREAD_T_GCC=1)
ENDIF()
+CHECK_C_SOURCE_COMPILES("struct t1{ int a; char *b; }; struct t1 c= { .a=1, .b=0 }; main() { }" HAVE_C99_INITIALIZERS)
+
ENDIF(NOT MSVC)
CHECK_FUNCTION_EXISTS(asprintf HAVE_ASPRINTF)
diff --git a/storage/innobase/api/api0api.cc b/storage/innobase/api/api0api.cc
index 3859fb84b81..0fe21423232 100644
--- a/storage/innobase/api/api0api.cc
+++ b/storage/innobase/api/api0api.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2008, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2008, 2015, 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
@@ -318,35 +318,6 @@ ib_wake_master_thread(void)
}
}
-/*********************************************************************//**
-Calculate the max row size of the columns in a cluster index.
-@return max row length */
-UNIV_INLINE
-ulint
-ib_get_max_row_len(
-/*===============*/
- dict_index_t* cluster) /*!< in: cluster index */
-{
- ulint i;
- ulint max_len = 0;
- ulint n_fields = cluster->n_fields;
-
- /* Add the size of the ordering columns in the
- clustered index. */
- for (i = 0; i < n_fields; ++i) {
- const dict_col_t* col;
-
- col = dict_index_get_nth_col(cluster, i);
-
- /* Use the maximum output size of
- mach_write_compressed(), although the encoded
- length should always fit in 2 bytes. */
- max_len += dict_col_get_max_size(col);
- }
-
- return(max_len);
-}
-
/*****************************************************************//**
Read the columns from a rec into a tuple. */
static
@@ -624,6 +595,21 @@ ib_trx_begin(
return(static_cast<ib_trx_t>(trx));
}
+
+/*****************************************************************//**
+Check if transaction is read_only
+@return transaction read_only status */
+UNIV_INTERN
+ib_u32_t
+ib_trx_read_only(
+/*=============*/
+ ib_trx_t ib_trx) /*!< in: trx handle */
+{
+ trx_t* trx = (trx_t*) ib_trx;
+
+ return(trx->read_only);
+}
+
/*****************************************************************//**
Get the transaction's state.
@return transaction state */
@@ -710,120 +696,6 @@ ib_trx_rollback(
return(err);
}
-/*****************************************************************//**
-Find an index definition from the index vector using index name.
-@return index def. if found else NULL */
-UNIV_INLINE
-const ib_index_def_t*
-ib_table_find_index(
-/*================*/
- ib_vector_t* indexes, /*!< in: vector of indexes */
- const char* name) /*!< in: index name */
-{
- ulint i;
-
- for (i = 0; i < ib_vector_size(indexes); ++i) {
- const ib_index_def_t* index_def;
-
- index_def = (ib_index_def_t*) ib_vector_get(indexes, i);
-
- if (innobase_strcasecmp(name, index_def->name) == 0) {
- return(index_def);
- }
- }
-
- return(NULL);
-}
-
-/*****************************************************************//**
-Get the InnoDB internal precise type from the schema column definition.
-@return precise type in api format */
-UNIV_INLINE
-ulint
-ib_col_get_prtype(
-/*==============*/
- const ib_col_t* ib_col) /*!< in: column definition */
-{
- ulint prtype = 0;
-
- if (ib_col->ib_col_attr & IB_COL_UNSIGNED) {
- prtype |= DATA_UNSIGNED;
-
- ut_a(ib_col->ib_col_type == IB_INT);
- }
-
- if (ib_col->ib_col_attr & IB_COL_NOT_NULL) {
- prtype |= DATA_NOT_NULL;
- }
-
- return(prtype);
-}
-
-/*****************************************************************//**
-Get the InnoDB internal main type from the schema column definition.
-@return column main type */
-UNIV_INLINE
-ulint
-ib_col_get_mtype(
-/*==============*/
- const ib_col_t* ib_col) /*!< in: column definition */
-{
- /* Note: The api0api.h types should map directly to
- the internal numeric codes. */
- return(ib_col->ib_col_type);
-}
-
-/*****************************************************************//**
-Find a column in the the column vector with the same name.
-@return col. def. if found else NULL */
-UNIV_INLINE
-const ib_col_t*
-ib_table_find_col(
-/*==============*/
- const ib_vector_t* cols, /*!< in: column list head */
- const char* name) /*!< in: column name to find */
-{
- ulint i;
-
- for (i = 0; i < ib_vector_size(cols); ++i) {
- const ib_col_t* ib_col;
-
- ib_col = static_cast<const ib_col_t*>(
- ib_vector_get((ib_vector_t*) cols, i));
-
- if (innobase_strcasecmp(ib_col->name, name) == 0) {
- return(ib_col);
- }
- }
-
- return(NULL);
-}
-
-/*****************************************************************//**
-Find a column in the the column list with the same name.
-@return col. def. if found else NULL */
-UNIV_INLINE
-const ib_key_col_t*
-ib_index_find_col(
-/*==============*/
- ib_vector_t* cols, /*!< in: column list head */
- const char* name) /*!< in: column name to find */
-{
- ulint i;
-
- for (i = 0; i < ib_vector_size(cols); ++i) {
- const ib_key_col_t* ib_col;
-
- ib_col = static_cast<ib_key_col_t*>(ib_vector_get(cols, i));
-
- if (innobase_strcasecmp(ib_col->name, name) == 0) {
- return(ib_col);
- }
- }
-
- return(NULL);
-}
-
#ifdef __WIN__
/*****************************************************************//**
Convert a string to lower case. */
@@ -947,34 +819,6 @@ ib_table_name_check(
/*****************************************************************//**
-Get an index definition that is tagged as a clustered index.
-@return cluster index schema */
-UNIV_INLINE
-ib_index_def_t*
-ib_find_clustered_index(
-/*====================*/
- ib_vector_t* indexes) /*!< in: index defs. to search */
-{
- ulint i;
- ulint n_indexes;
-
- n_indexes = ib_vector_size(indexes);
-
- for (i = 0; i < n_indexes; ++i) {
- ib_index_def_t* ib_index_def;
-
- ib_index_def = static_cast<ib_index_def_t*>(
- ib_vector_get(indexes, i));
-
- if (ib_index_def->clustered) {
- return(ib_index_def);
- }
- }
-
- return(NULL);
-}
-
-/*****************************************************************//**
Get a table id. The caller must have acquired the dictionary mutex.
@return DB_SUCCESS if found */
static
@@ -3564,41 +3408,6 @@ ib_cursor_set_cluster_access(
prebuilt->need_to_access_clustered = TRUE;
}
-/*************************************************************//**
-Convert and write an INT column value to an InnoDB tuple.
-@return DB_SUCCESS or error */
-UNIV_INLINE
-ib_err_t
-ib_tuple_write_int(
-/*===============*/
- ib_tpl_t ib_tpl, /*!< in/out: tuple to write to */
- ulint col_no, /*!< in: column number */
- const void* value, /*!< in: integer value */
- ulint value_len) /*!< in: sizeof value type */
-{
- const dfield_t* dfield;
- ulint data_len;
- ulint type_len;
- ib_tuple_t* tuple = (ib_tuple_t*) ib_tpl;
-
- ut_a(col_no < ib_tuple_get_n_cols(ib_tpl));
-
- dfield = ib_col_get_dfield(tuple, col_no);
-
- data_len = dfield_get_len(dfield);
- type_len = dtype_get_len(dfield_get_type(dfield));
-
- if (dtype_get_mtype(dfield_get_type(dfield)) != DATA_INT
- || value_len != data_len) {
-
- return(DB_DATA_MISMATCH);
- }
-
- return(ib_col_set_value(
- ib_tpl, static_cast<ib_ulint_t>(col_no),
- value, static_cast<ib_ulint_t>(type_len), true));
-}
-
/*****************************************************************//**
Write an integer value to a column. Integers are stored in big-endian
format and will need to be converted from the host format.
diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc
index e68179a5c19..315a1d1b558 100644
--- a/storage/innobase/btr/btr0cur.cc
+++ b/storage/innobase/btr/btr0cur.cc
@@ -2372,15 +2372,15 @@ btr_cur_pess_upd_restore_supremum(
Check if the total length of the modified blob for the row is within 10%
of the total redo log size. This constraint on the blob length is to
avoid overwriting the redo logs beyond the last checkpoint lsn.
-@return DB_SUCCESS or DB_TOO_BIG_RECORD. */
+@return DB_SUCCESS or DB_TOO_BIG_FOR_REDO. */
static
dberr_t
btr_check_blob_limit(const big_rec_t* big_rec_vec)
{
const ib_uint64_t redo_size = srv_n_log_files * srv_log_file_size
* UNIV_PAGE_SIZE;
- const ulint redo_10p = redo_size / 10;
- ulint total_blob_len = 0;
+ const ib_uint64_t redo_10p = redo_size / 10;
+ ib_uint64_t total_blob_len = 0;
dberr_t err = DB_SUCCESS;
/* Calculate the total number of bytes for blob data */
@@ -2390,11 +2390,11 @@ btr_check_blob_limit(const big_rec_t* big_rec_vec)
if (total_blob_len > redo_10p) {
ib_logf(IB_LOG_LEVEL_ERROR, "The total blob data"
- " length (" ULINTPF ") is greater than"
+ " length (" UINT64PF ") is greater than"
" 10%% of the total redo log size (" UINT64PF
"). Please increase total redo log size.",
total_blob_len, redo_size);
- err = DB_TOO_BIG_RECORD;
+ err = DB_TOO_BIG_FOR_REDO;
}
return(err);
@@ -4457,7 +4457,7 @@ Stores the fields in big_rec_vec to the tablespace and puts pointers to
them in rec. The extern flags in rec will have to be set beforehand.
The fields are stored on pages allocated from leaf node
file segment of the index tree.
-@return DB_SUCCESS or DB_OUT_OF_FILE_SPACE */
+@return DB_SUCCESS or DB_OUT_OF_FILE_SPACE or DB_TOO_BIG_FOR_REDO */
UNIV_INTERN
dberr_t
btr_store_big_rec_extern_fields(
diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc
index 9c569691ef0..46f7f5a49df 100644
--- a/storage/innobase/buf/buf0buf.cc
+++ b/storage/innobase/buf/buf0buf.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Copyright (c) 2013, SkySQL Ab. All Rights Reserved.
@@ -487,6 +487,79 @@ buf_page_is_zeroes(
return(true);
}
+/** Checks if the page is in crc32 checksum format.
+@param[in] read_buf database page
+@param[in] checksum_field1 new checksum field
+@param[in] checksum_field2 old checksum field
+@return true if the page is in crc32 checksum format */
+UNIV_INLINE
+bool
+buf_page_is_checksum_valid_crc32(
+ const byte* read_buf,
+ ulint checksum_field1,
+ ulint checksum_field2)
+{
+ ib_uint32_t crc32 = buf_calc_page_crc32(read_buf);
+
+ return(checksum_field1 == crc32 && checksum_field2 == crc32);
+}
+
+/** Checks if the page is in innodb checksum format.
+@param[in] read_buf database page
+@param[in] checksum_field1 new checksum field
+@param[in] checksum_field2 old checksum field
+@return true if the page is in innodb checksum format */
+UNIV_INLINE
+bool
+buf_page_is_checksum_valid_innodb(
+ const byte* read_buf,
+ ulint checksum_field1,
+ ulint checksum_field2)
+{
+ /* There are 2 valid formulas for
+ checksum_field2 (old checksum field) which algo=innodb could have
+ written to the page:
+
+ 1. Very old versions of InnoDB only stored 8 byte lsn to the
+ start and the end of the page.
+
+ 2. Newer InnoDB versions store the old formula checksum
+ (buf_calc_page_old_checksum()). */
+
+ if (checksum_field2 != mach_read_from_4(read_buf + FIL_PAGE_LSN)
+ && checksum_field2 != buf_calc_page_old_checksum(read_buf)) {
+ return(false);
+ }
+
+ /* old field is fine, check the new field */
+
+ /* InnoDB versions < 4.0.14 and < 4.1.1 stored the space id
+ (always equal to 0), to FIL_PAGE_SPACE_OR_CHKSUM */
+
+ if (checksum_field1 != 0
+ && checksum_field1 != buf_calc_page_new_checksum(read_buf)) {
+ return(false);
+ }
+
+ return(true);
+}
+
+/** Checks if the page is in none checksum format.
+@param[in] read_buf database page
+@param[in] checksum_field1 new checksum field
+@param[in] checksum_field2 old checksum field
+@return true if the page is in none checksum format */
+UNIV_INLINE
+bool
+buf_page_is_checksum_valid_none(
+ const byte* read_buf,
+ ulint checksum_field1,
+ ulint checksum_field2)
+{
+ return(checksum_field1 == checksum_field2
+ && checksum_field1 == BUF_NO_CHECKSUM_MAGIC);
+}
+
/********************************************************************//**
Checks if a page is corrupt.
@return TRUE if corrupted */
@@ -502,8 +575,6 @@ buf_page_is_corrupted(
{
ulint checksum_field1;
ulint checksum_field2;
- ibool crc32_inited = FALSE;
- ib_uint32_t crc32 = ULINT32_UNDEFINED;
if (!zip_size
&& memcmp(read_buf + FIL_PAGE_LSN + 4,
@@ -583,148 +654,121 @@ buf_page_is_corrupted(
return(FALSE);
}
- switch ((srv_checksum_algorithm_t) srv_checksum_algorithm) {
- case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
-
- crc32 = buf_calc_page_crc32(read_buf);
-
- return(checksum_field1 != crc32 || checksum_field2 != crc32);
-
- case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
-
- return(checksum_field1
- != buf_calc_page_new_checksum(read_buf)
- || checksum_field2
- != buf_calc_page_old_checksum(read_buf));
-
- case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
+ DBUG_EXECUTE_IF("buf_page_is_corrupt_failure", return(TRUE); );
- return(checksum_field1 != BUF_NO_CHECKSUM_MAGIC
- || checksum_field2 != BUF_NO_CHECKSUM_MAGIC);
+ ulint page_no = mach_read_from_4(read_buf + FIL_PAGE_OFFSET);
+ ulint space_id = mach_read_from_4(read_buf + FIL_PAGE_SPACE_ID);
+ const srv_checksum_algorithm_t curr_algo =
+ static_cast<srv_checksum_algorithm_t>(srv_checksum_algorithm);
+ switch (curr_algo) {
case SRV_CHECKSUM_ALGORITHM_CRC32:
- case SRV_CHECKSUM_ALGORITHM_INNODB:
- /* There are 3 valid formulas for
- checksum_field2 (old checksum field):
-
- 1. Very old versions of InnoDB only stored 8 byte lsn to the
- start and the end of the page.
-
- 2. InnoDB versions before MySQL 5.6.3 store the old formula
- checksum (buf_calc_page_old_checksum()).
-
- 3. InnoDB versions 5.6.3 and newer with
- innodb_checksum_algorithm=strict_crc32|crc32 store CRC32. */
-
- /* since innodb_checksum_algorithm is not strict_* allow
- any of the algos to match for the old field */
-
- if (checksum_field2
- != mach_read_from_4(read_buf + FIL_PAGE_LSN)
- && checksum_field2 != BUF_NO_CHECKSUM_MAGIC) {
-
- /* The checksum does not match any of the
- fast to check. First check the selected algorithm
- for writing checksums because we assume that the
- chance of it matching is higher. */
-
- if (srv_checksum_algorithm
- == SRV_CHECKSUM_ALGORITHM_CRC32) {
-
- crc32 = buf_calc_page_crc32(read_buf);
- crc32_inited = TRUE;
-
- if (checksum_field2 != crc32
- && checksum_field2
- != buf_calc_page_old_checksum(read_buf)) {
+ case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
- return(TRUE);
- }
- } else {
- ut_ad(srv_checksum_algorithm
- == SRV_CHECKSUM_ALGORITHM_INNODB);
+ if (buf_page_is_checksum_valid_crc32(read_buf,
+ checksum_field1, checksum_field2)) {
+ return(FALSE);
+ }
- if (checksum_field2
- != buf_calc_page_old_checksum(read_buf)) {
+ if (buf_page_is_checksum_valid_none(read_buf,
+ checksum_field1, checksum_field2)) {
+ if (curr_algo
+ == SRV_CHECKSUM_ALGORITHM_STRICT_CRC32) {
+ page_warn_strict_checksum(
+ curr_algo,
+ SRV_CHECKSUM_ALGORITHM_NONE,
+ space_id, page_no);
+ }
- crc32 = buf_calc_page_crc32(read_buf);
- crc32_inited = TRUE;
+ return(FALSE);
+ }
- if (checksum_field2 != crc32) {
- return(TRUE);
- }
- }
+ if (buf_page_is_checksum_valid_innodb(read_buf,
+ checksum_field1, checksum_field2)) {
+ if (curr_algo
+ == SRV_CHECKSUM_ALGORITHM_STRICT_CRC32) {
+ page_warn_strict_checksum(
+ curr_algo,
+ SRV_CHECKSUM_ALGORITHM_INNODB,
+ space_id, page_no);
}
- }
- /* old field is fine, check the new field */
+ return(FALSE);
+ }
- /* InnoDB versions < 4.0.14 and < 4.1.1 stored the space id
- (always equal to 0), to FIL_PAGE_SPACE_OR_CHKSUM */
+ return(TRUE);
- if (checksum_field1 != 0
- && checksum_field1 != BUF_NO_CHECKSUM_MAGIC) {
+ case SRV_CHECKSUM_ALGORITHM_INNODB:
+ case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
- /* The checksum does not match any of the
- fast to check. First check the selected algorithm
- for writing checksums because we assume that the
- chance of it matching is higher. */
+ if (buf_page_is_checksum_valid_innodb(read_buf,
+ checksum_field1, checksum_field2)) {
+ return(FALSE);
+ }
- if (srv_checksum_algorithm
- == SRV_CHECKSUM_ALGORITHM_CRC32) {
+ if (buf_page_is_checksum_valid_none(read_buf,
+ checksum_field1, checksum_field2)) {
+ if (curr_algo
+ == SRV_CHECKSUM_ALGORITHM_STRICT_INNODB) {
+ page_warn_strict_checksum(
+ curr_algo,
+ SRV_CHECKSUM_ALGORITHM_NONE,
+ space_id, page_no);
+ }
- if (!crc32_inited) {
- crc32 = buf_calc_page_crc32(read_buf);
- crc32_inited = TRUE;
- }
+ return(FALSE);
+ }
- if (checksum_field1 != crc32
- && checksum_field1
- != buf_calc_page_new_checksum(read_buf)) {
+ if (buf_page_is_checksum_valid_crc32(read_buf,
+ checksum_field1, checksum_field2)) {
+ if (curr_algo
+ == SRV_CHECKSUM_ALGORITHM_STRICT_INNODB) {
+ page_warn_strict_checksum(
+ curr_algo,
+ SRV_CHECKSUM_ALGORITHM_CRC32,
+ space_id, page_no);
+ }
- return(TRUE);
- }
- } else {
- ut_ad(srv_checksum_algorithm
- == SRV_CHECKSUM_ALGORITHM_INNODB);
+ return(FALSE);
+ }
- if (checksum_field1
- != buf_calc_page_new_checksum(read_buf)) {
+ return(TRUE);
- if (!crc32_inited) {
- crc32 = buf_calc_page_crc32(
- read_buf);
- crc32_inited = TRUE;
- }
+ case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
- if (checksum_field1 != crc32) {
- return(TRUE);
- }
- }
- }
+ if (buf_page_is_checksum_valid_none(read_buf,
+ checksum_field1, checksum_field2)) {
+ return(FALSE);
}
- /* If CRC32 is stored in at least one of the fields, then the
- other field must also be CRC32 */
- if (crc32_inited
- && ((checksum_field1 == crc32
- && checksum_field2 != crc32)
- || (checksum_field1 != crc32
- && checksum_field2 == crc32))) {
+ if (buf_page_is_checksum_valid_crc32(read_buf,
+ checksum_field1, checksum_field2)) {
+ page_warn_strict_checksum(
+ curr_algo,
+ SRV_CHECKSUM_ALGORITHM_CRC32,
+ space_id, page_no);
+ return(FALSE);
+ }
- return(TRUE);
+ if (buf_page_is_checksum_valid_innodb(read_buf,
+ checksum_field1, checksum_field2)) {
+ page_warn_strict_checksum(
+ curr_algo,
+ SRV_CHECKSUM_ALGORITHM_INNODB,
+ space_id, page_no);
+ return(FALSE);
}
- break;
+ return(TRUE);
+
case SRV_CHECKSUM_ALGORITHM_NONE:
/* should have returned FALSE earlier */
- ut_error;
+ break;
/* no default so the compiler will emit a warning if new enum
is added and not handled here */
}
- DBUG_EXECUTE_IF("buf_page_is_corrupt_failure", return(TRUE); );
-
+ ut_error;
return(FALSE);
}
@@ -1679,6 +1723,9 @@ page_found:
goto page_found;
}
+ /* The maximum number of purge threads should never exceed
+ BUF_POOL_WATCH_SIZE. So there is no way for purge thread
+ instance to hold a watch when setting another watch. */
for (i = 0; i < BUF_POOL_WATCH_SIZE; i++) {
bpage = &buf_pool->watch[i];
diff --git a/storage/innobase/buf/buf0checksum.cc b/storage/innobase/buf/buf0checksum.cc
index 4ba65d6f2d0..f95eba39ab4 100644
--- a/storage/innobase/buf/buf0checksum.cc
+++ b/storage/innobase/buf/buf0checksum.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2011, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2015, 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
@@ -139,14 +139,17 @@ buf_checksum_algorithm_name(
{
switch (algo) {
case SRV_CHECKSUM_ALGORITHM_CRC32:
- case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
return("crc32");
+ case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
+ return("strict_crc32");
case SRV_CHECKSUM_ALGORITHM_INNODB:
- case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
return("innodb");
+ case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
+ return("strict_innodb");
case SRV_CHECKSUM_ALGORITHM_NONE:
- case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
return("none");
+ case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
+ return("strict_none");
}
ut_error;
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc
index 56205536a45..52a9bb686df 100644
--- a/storage/innobase/dict/dict0dict.cc
+++ b/storage/innobase/dict/dict0dict.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
Copyright (c) 2013, SkySQL Ab. All Rights Reserved.
@@ -649,7 +649,68 @@ dict_table_get_col_name(
return(s);
}
+/**********************************************************************//**
+Returns a column's name.
+@return column name. NOTE: not guaranteed to stay valid if table is
+modified in any way (columns added, etc.). */
+UNIV_INTERN
+const char*
+dict_table_get_col_name_for_mysql(
+/*==============================*/
+ const dict_table_t* table, /*!< in: table */
+ const char* col_name)/*! in: MySQL table column name */
+{
+ ulint i;
+ const char* s;
+
+ ut_ad(table);
+ ut_ad(col_name);
+ ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
+
+ s = table->col_names;
+ if (s) {
+ /* If we have many virtual columns MySQL key_part->fieldnr
+ could be larger than number of columns in InnoDB table
+ when creating new indexes. */
+ for (i = 0; i < table->n_def; i++) {
+
+ if (!innobase_strcasecmp(s, col_name)) {
+ break; /* Found */
+ }
+ s += strlen(s) + 1;
+ }
+ }
+
+ return(s);
+}
#ifndef UNIV_HOTBACKUP
+/** Allocate and init the autoinc latch of a given table.
+This function must not be called concurrently on the same table object.
+@param[in,out] table_void table whose autoinc latch to create */
+void
+dict_table_autoinc_alloc(
+ void* table_void)
+{
+ dict_table_t* table = static_cast<dict_table_t*>(table_void);
+ table->autoinc_mutex = new (std::nothrow) ib_mutex_t();
+ ut_a(table->autoinc_mutex != NULL);
+ mutex_create(autoinc_mutex_key,
+ table->autoinc_mutex, SYNC_DICT_AUTOINC_MUTEX);
+}
+
+/** Allocate and init the zip_pad_mutex of a given index.
+This function must not be called concurrently on the same index object.
+@param[in,out] index_void index whose zip_pad_mutex to create */
+void
+dict_index_zip_pad_alloc(
+ void* index_void)
+{
+ dict_index_t* index = static_cast<dict_index_t*>(index_void);
+ index->zip_pad.mutex = new (std::nothrow) os_fast_mutex_t;
+ ut_a(index->zip_pad.mutex != NULL);
+ os_fast_mutex_init(zip_pad_mutex_key, index->zip_pad.mutex);
+}
+
/********************************************************************//**
Acquire the autoinc lock. */
UNIV_INTERN
@@ -658,7 +719,32 @@ dict_table_autoinc_lock(
/*====================*/
dict_table_t* table) /*!< in/out: table */
{
- mutex_enter(&table->autoinc_mutex);
+#ifdef HAVE_ATOMIC_BUILTINS
+ os_once::do_or_wait_for_done(
+ &table->autoinc_mutex_created,
+ dict_table_autoinc_alloc, table);
+#else /* HAVE_ATOMIC_BUILTINS */
+ ut_ad(table->autoinc_mutex_created == os_once::DONE);
+#endif /* HAVE_ATOMIC_BUILTINS */
+
+ mutex_enter(table->autoinc_mutex);
+}
+
+/** Acquire the zip_pad_mutex latch.
+@param[in,out] index the index whose zip_pad_mutex to acquire.*/
+void
+dict_index_zip_pad_lock(
+ dict_index_t* index)
+{
+#ifdef HAVE_ATOMIC_BUILTINS
+ os_once::do_or_wait_for_done(
+ &index->zip_pad.mutex_created,
+ dict_index_zip_pad_alloc, index);
+#else /* HAVE_ATOMIC_BUILTINS */
+ ut_ad(index->zip_pad.mutex_created == os_once::DONE);
+#endif /* HAVE_ATOMIC_BUILTINS */
+
+ os_fast_mutex_lock(index->zip_pad.mutex);
}
/********************************************************************//**
@@ -670,7 +756,7 @@ dict_table_autoinc_initialize(
dict_table_t* table, /*!< in/out: table */
ib_uint64_t value) /*!< in: next value to assign to a row */
{
- ut_ad(mutex_own(&table->autoinc_mutex));
+ ut_ad(dict_table_autoinc_own(table));
table->autoinc = value;
}
@@ -712,7 +798,7 @@ dict_table_autoinc_read(
/*====================*/
const dict_table_t* table) /*!< in: table */
{
- ut_ad(mutex_own(&table->autoinc_mutex));
+ ut_ad(dict_table_autoinc_own(table));
return(table->autoinc);
}
@@ -728,7 +814,7 @@ dict_table_autoinc_update_if_greater(
dict_table_t* table, /*!< in/out: table */
ib_uint64_t value) /*!< in: value which was assigned to a row */
{
- ut_ad(mutex_own(&table->autoinc_mutex));
+ ut_ad(dict_table_autoinc_own(table));
if (value > table->autoinc) {
@@ -744,7 +830,7 @@ dict_table_autoinc_unlock(
/*======================*/
dict_table_t* table) /*!< in/out: table */
{
- mutex_exit(&table->autoinc_mutex);
+ mutex_exit(table->autoinc_mutex);
}
#endif /* !UNIV_HOTBACKUP */
@@ -1583,15 +1669,18 @@ dict_table_rename_in_cache(
} else if (table->space != TRX_SYS_SPACE) {
char* new_path = NULL;
- if (table->dir_path_of_temp_table != NULL) {
+ if (DICT_TF2_FLAG_IS_SET(table, DICT_TF2_TEMPORARY)) {
ut_print_timestamp(stderr);
fputs(" InnoDB: Error: trying to rename a"
" TEMPORARY TABLE ", stderr);
ut_print_name(stderr, NULL, TRUE, old_name);
- fputs(" (", stderr);
- ut_print_filename(stderr,
- table->dir_path_of_temp_table);
- fputs(" )\n", stderr);
+ if (table->dir_path_of_temp_table != NULL) {
+ fputs(" (", stderr);
+ ut_print_filename(
+ stderr, table->dir_path_of_temp_table);
+ fputs(" )\n", stderr);
+ }
+
return(DB_ERROR);
} else if (DICT_TF_HAS_DATA_DIR(table->flags)) {
@@ -2428,10 +2517,10 @@ too_big:
dict_mem_index_free(new_index);
dict_mem_index_free(index);
return(DB_TOO_BIG_RECORD);
- } else {
-
+ } else if (current_thd != NULL) {
+ /* Avoid the warning to be printed
+ during recovery. */
ib_warn_row_too_big(table);
-
}
}
@@ -4111,16 +4200,25 @@ dict_table_get_highest_foreign_id(
for (dict_foreign_set::iterator it = table->foreign_set.begin();
it != table->foreign_set.end();
++it) {
+ char fkid[MAX_TABLE_NAME_LEN+20];
foreign = *it;
- if (ut_strlen(foreign->id) > ((sizeof dict_ibfk) - 1) + len
- && 0 == ut_memcmp(foreign->id, table->name, len)
- && 0 == ut_memcmp(foreign->id + len,
+ strcpy(fkid, foreign->id);
+ /* Convert foreign key identifier on dictionary memory
+ cache to filename charset. */
+ innobase_convert_to_filename_charset(
+ strchr(fkid, '/') + 1,
+ strchr(foreign->id, '/') + 1,
+ MAX_TABLE_NAME_LEN);
+
+ if (ut_strlen(fkid) > ((sizeof dict_ibfk) - 1) + len
+ && 0 == ut_memcmp(fkid, table->name, len)
+ && 0 == ut_memcmp(fkid + len,
dict_ibfk, (sizeof dict_ibfk) - 1)
- && foreign->id[len + ((sizeof dict_ibfk) - 1)] != '0') {
+ && fkid[len + ((sizeof dict_ibfk) - 1)] != '0') {
/* It is of the >= 4.0.18 format */
- id = strtoul(foreign->id + len
+ id = strtoul(fkid + len
+ ((sizeof dict_ibfk) - 1),
&endp, 10);
if (*endp == '\0') {
@@ -6679,10 +6777,10 @@ dict_index_zip_success(
return;
}
- os_fast_mutex_lock(&index->zip_pad.mutex);
+ dict_index_zip_pad_lock(index);
++index->zip_pad.success;
dict_index_zip_pad_update(&index->zip_pad, zip_threshold);
- os_fast_mutex_unlock(&index->zip_pad.mutex);
+ dict_index_zip_pad_unlock(index);
}
/*********************************************************************//**
@@ -6702,10 +6800,10 @@ dict_index_zip_failure(
return;
}
- os_fast_mutex_lock(&index->zip_pad.mutex);
+ dict_index_zip_pad_lock(index);
++index->zip_pad.failure;
dict_index_zip_pad_update(&index->zip_pad, zip_threshold);
- os_fast_mutex_unlock(&index->zip_pad.mutex);
+ dict_index_zip_pad_unlock(index);
}
@@ -6737,9 +6835,9 @@ dict_index_zip_pad_optimal_page_size(
#ifdef HAVE_ATOMIC_BUILTINS
pad = os_atomic_increment_ulint(&index->zip_pad.pad, 0);
#else /* HAVE_ATOMIC_BUILTINS */
- os_fast_mutex_lock(&index->zip_pad.mutex);
+ dict_index_zip_pad_lock(index);
pad = index->zip_pad.pad;
- os_fast_mutex_unlock(&index->zip_pad.mutex);
+ dict_index_zip_pad_unlock(index);
#endif /* HAVE_ATOMIC_BUILTINS */
ut_ad(pad < UNIV_PAGE_SIZE);
diff --git a/storage/innobase/dict/dict0mem.cc b/storage/innobase/dict/dict0mem.cc
index 58781fce1d4..e830a8430b7 100644
--- a/storage/innobase/dict/dict0mem.cc
+++ b/storage/innobase/dict/dict0mem.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
This program is free software; you can redistribute it and/or modify it under
@@ -118,8 +118,7 @@ dict_mem_table_create(
table->autoinc_lock = static_cast<ib_lock_t*>(
mem_heap_alloc(heap, lock_get_size()));
- mutex_create(autoinc_mutex_key,
- &table->autoinc_mutex, SYNC_DICT_AUTOINC_MUTEX);
+ dict_table_autoinc_create_lazy(table);
table->autoinc = 0;
@@ -199,7 +198,7 @@ dict_mem_table_free(
}
}
#ifndef UNIV_HOTBACKUP
- mutex_free(&(table->autoinc_mutex));
+ dict_table_autoinc_destroy(table);
#endif /* UNIV_HOTBACKUP */
dict_table_stats_latch_destroy(table);
@@ -319,6 +318,9 @@ dict_mem_table_col_rename_low(
ut_ad(from_len <= NAME_LEN);
ut_ad(to_len <= NAME_LEN);
+ char from[NAME_LEN];
+ strncpy(from, s, NAME_LEN);
+
if (from_len == to_len) {
/* The easy case: simply replace the column name in
table->col_names. */
@@ -386,14 +388,53 @@ dict_mem_table_col_rename_low(
foreign = *it;
- for (unsigned f = 0; f < foreign->n_fields; f++) {
- /* These can point straight to
- table->col_names, because the foreign key
- constraints will be freed at the same time
- when the table object is freed. */
- foreign->foreign_col_names[f]
- = dict_index_get_nth_field(
- foreign->foreign_index, f)->name;
+ if (foreign->foreign_index == NULL) {
+ /* We may go here when we set foreign_key_checks to 0,
+ and then try to rename a column and modify the
+ corresponding foreign key constraint. The index
+ would have been dropped, we have to find an equivalent
+ one */
+ for (unsigned f = 0; f < foreign->n_fields; f++) {
+ if (strcmp(foreign->foreign_col_names[f], from)
+ == 0) {
+
+ char** rc = const_cast<char**>(
+ foreign->foreign_col_names
+ + f);
+
+ if (to_len <= strlen(*rc)) {
+ memcpy(*rc, to, to_len + 1);
+ } else {
+ *rc = static_cast<char*>(
+ mem_heap_dup(
+ foreign->heap,
+ to,
+ to_len + 1));
+ }
+ }
+ }
+
+ dict_index_t* new_index = dict_foreign_find_index(
+ foreign->foreign_table, NULL,
+ foreign->foreign_col_names,
+ foreign->n_fields, NULL, true, false);
+ /* There must be an equivalent index in this case. */
+ ut_ad(new_index != NULL);
+
+ foreign->foreign_index = new_index;
+
+ } else {
+
+ for (unsigned f = 0; f < foreign->n_fields; f++) {
+ /* These can point straight to
+ table->col_names, because the foreign key
+ constraints will be freed at the same time
+ when the table object is freed. */
+ foreign->foreign_col_names[f]
+ = dict_index_get_nth_field(
+ foreign->foreign_index,
+ f)->name;
+ }
}
}
@@ -403,6 +444,8 @@ dict_mem_table_col_rename_low(
foreign = *it;
+ ut_ad(foreign->referenced_index != NULL);
+
for (unsigned f = 0; f < foreign->n_fields; f++) {
/* foreign->referenced_col_names[] need to be
copies, because the constraint may become
@@ -520,8 +563,7 @@ dict_mem_index_create(
dict_mem_fill_index_struct(index, heap, table_name, index_name,
space, type, n_fields);
- os_fast_mutex_init(zip_pad_mutex_key, &index->zip_pad.mutex);
-
+ dict_index_zip_pad_mutex_create_lazy(index);
return(index);
}
@@ -654,7 +696,7 @@ dict_mem_index_free(
}
#endif /* UNIV_BLOB_DEBUG */
- os_fast_mutex_free(&index->zip_pad.mutex);
+ dict_index_zip_pad_mutex_destroy(index);
mem_heap_free(index->heap);
}
@@ -728,7 +770,7 @@ dict_foreign_set_validate(
{
dict_foreign_not_exists not_exists(fk_set);
- dict_foreign_set::iterator it = std::find_if(
+ dict_foreign_set::const_iterator it = std::find_if(
fk_set.begin(), fk_set.end(), not_exists);
if (it == fk_set.end()) {
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index d93d96de80c..cb43477ed59 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -5052,6 +5052,9 @@ retry:
success = TRUE;
}
+ DBUG_EXECUTE_IF("ib_os_aio_func_io_failure_28",
+ success = FALSE; errno = 28; os_has_said_disk_full = TRUE;);
+
mutex_enter(&fil_system->mutex);
if (success) {
@@ -5095,6 +5098,11 @@ retry:
offset, page_size * n_pages,
node, NULL, 0, FALSE, 0);
#endif /* UNIV_HOTBACKUP */
+
+
+ DBUG_EXECUTE_IF("ib_os_aio_func_io_failure_28",
+ success = FALSE; errno = 28; os_has_said_disk_full = TRUE;);
+
if (success) {
os_has_said_disk_full = FALSE;
} else {
diff --git a/storage/innobase/fsp/fsp0fsp.cc b/storage/innobase/fsp/fsp0fsp.cc
index d1bb22ed7a9..6ecf97aaeb6 100644
--- a/storage/innobase/fsp/fsp0fsp.cc
+++ b/storage/innobase/fsp/fsp0fsp.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2015, 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
@@ -301,44 +301,6 @@ xdes_find_bit(
}
/**********************************************************************//**
-Looks for a descriptor bit having the desired value. Scans the extent in
-a direction opposite to xdes_find_bit.
-@return bit index of the bit, ULINT_UNDEFINED if not found */
-UNIV_INLINE
-ulint
-xdes_find_bit_downward(
-/*===================*/
- xdes_t* descr, /*!< in: descriptor */
- ulint bit, /*!< in: XDES_FREE_BIT or XDES_CLEAN_BIT */
- ibool val, /*!< in: desired bit value */
- ulint hint, /*!< in: hint of which bit position would
- be desirable */
- mtr_t* mtr) /*!< in/out: mini-transaction */
-{
- ulint i;
-
- ut_ad(descr && mtr);
- ut_ad(val <= TRUE);
- ut_ad(hint < FSP_EXTENT_SIZE);
- ut_ad(mtr_memo_contains_page(mtr, descr, MTR_MEMO_PAGE_X_FIX));
- for (i = hint + 1; i > 0; i--) {
- if (val == xdes_mtr_get_bit(descr, bit, i - 1, mtr)) {
-
- return(i - 1);
- }
- }
-
- for (i = FSP_EXTENT_SIZE - 1; i > hint; i--) {
- if (val == xdes_mtr_get_bit(descr, bit, i, mtr)) {
-
- return(i);
- }
- }
-
- return(ULINT_UNDEFINED);
-}
-
-/**********************************************************************//**
Returns the number of used pages in a descriptor.
@return number of pages used */
UNIV_INLINE
diff --git a/storage/innobase/fts/fts0ast.cc b/storage/innobase/fts/fts0ast.cc
index dd48ffee14d..030b972440f 100644
--- a/storage/innobase/fts/fts0ast.cc
+++ b/storage/innobase/fts/fts0ast.cc
@@ -694,3 +694,51 @@ fts_ast_string_print(
printf("\n");
}
+
+#ifdef UNIV_DEBUG
+const char*
+fts_ast_oper_name_get(fts_ast_oper_t oper)
+{
+ switch(oper) {
+ case FTS_NONE:
+ return("FTS_NONE");
+ case FTS_IGNORE:
+ return("FTS_IGNORE");
+ case FTS_EXIST:
+ return("FTS_EXIST");
+ case FTS_NEGATE:
+ return("FTS_NEGATE");
+ case FTS_INCR_RATING:
+ return("FTS_INCR_RATING");
+ case FTS_DECR_RATING:
+ return("FTS_DECR_RATING");
+ case FTS_DISTANCE:
+ return("FTS_DISTANCE");
+ case FTS_IGNORE_SKIP:
+ return("FTS_IGNORE_SKIP");
+ case FTS_EXIST_SKIP:
+ return("FTS_EXIST_SKIP");
+ }
+ ut_ad(0);
+}
+
+const char*
+fts_ast_node_type_get(fts_ast_type_t type)
+{
+ switch (type) {
+ case FTS_AST_OPER:
+ return("FTS_AST_OPER");
+ case FTS_AST_NUMB:
+ return("FTS_AST_NUMB");
+ case FTS_AST_TERM:
+ return("FTS_AST_TERM");
+ case FTS_AST_TEXT:
+ return("FTS_AST_TEXT");
+ case FTS_AST_LIST:
+ return("FTS_AST_LIST");
+ case FTS_AST_SUBEXP_LIST:
+ return("FTS_AST_SUBEXP_LIST");
+ }
+ ut_ad(0);
+}
+#endif /* UNIV_DEBUG */
diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc
index e1b9c95c26e..4351dc0b765 100644
--- a/storage/innobase/fts/fts0fts.cc
+++ b/storage/innobase/fts/fts0fts.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2011, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2011, 2015, 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
@@ -81,11 +81,13 @@ ulint n_nodes = 0;
/** Error condition reported by fts_utf8_decode() */
const ulint UTF8_ERROR = 0xFFFFFFFF;
+#ifdef FTS_CACHE_SIZE_DEBUG
/** The cache size permissible lower limit (1K) */
static const ulint FTS_CACHE_SIZE_LOWER_LIMIT_IN_MB = 1;
/** The cache size permissible upper limit (1G) */
static const ulint FTS_CACHE_SIZE_UPPER_LIMIT_IN_MB = 1024;
+#endif /* FTS_CACHE_SIZE_DEBUG */
/** Time to sleep after DEADLOCK error before retrying operation. */
static const ulint FTS_DEADLOCK_RETRY_WAIT = 100000;
@@ -191,7 +193,7 @@ static const char* fts_create_common_tables_sql = {
""
"CREATE TABLE \"%s_CONFIG\" (\n"
" key CHAR(50),\n"
- " value CHAR(50) NOT NULL\n"
+ " value CHAR(200) NOT NULL\n"
") COMPACT;\n"
"CREATE UNIQUE CLUSTERED INDEX IND ON \"%s_CONFIG\"(key);\n"
};
@@ -329,27 +331,6 @@ fts_update_sync_doc_id(
doc_id_t doc_id, /*!< in: last document id */
trx_t* trx) /*!< in: update trx, or NULL */
__attribute__((nonnull(1)));
-/********************************************************************
-Check if we should stop. */
-UNIV_INLINE
-ibool
-fts_is_stop_signalled(
-/*==================*/
- fts_t* fts) /*!< in: fts instance */
-{
- ibool stop_signalled = FALSE;
-
- mutex_enter(&fts->bg_threads_mutex);
-
- if (fts->fts_status & BG_THREAD_STOP) {
-
- stop_signalled = TRUE;
- }
-
- mutex_exit(&fts->bg_threads_mutex);
-
- return(stop_signalled);
-}
/****************************************************************//**
This function loads the default InnoDB stopword list */
@@ -3409,7 +3390,7 @@ fts_fetch_doc_from_rec(
doc->charset = get_doc->index_cache->charset;
/* Null Field */
- if (doc->text.f_len == UNIV_SQL_NULL) {
+ if (doc->text.f_len == UNIV_SQL_NULL || doc->text.f_len == 0) {
continue;
}
@@ -5545,7 +5526,7 @@ fts_savepoint_lookup(
/*********************************************************************//**
Release the savepoint data identified by name. All savepoints created
-after the named savepoint are also released.
+after the named savepoint are kept.
@return DB_SUCCESS or error code */
UNIV_INTERN
void
@@ -5554,81 +5535,37 @@ fts_savepoint_release(
trx_t* trx, /*!< in: transaction */
const char* name) /*!< in: savepoint name */
{
- ulint i;
- ib_vector_t* savepoints;
- ulint top_of_stack = 0;
-
ut_a(name != NULL);
- savepoints = trx->fts_trx->savepoints;
+ ib_vector_t* savepoints = trx->fts_trx->savepoints;
ut_a(ib_vector_size(savepoints) > 0);
- /* Skip the implied savepoint (first element). */
- for (i = 1; i < ib_vector_size(savepoints); ++i) {
- fts_savepoint_t* savepoint;
+ ulint i = fts_savepoint_lookup(savepoints, name);
+ if (i != ULINT_UNDEFINED) {
+ ut_a(i >= 1);
+ fts_savepoint_t* savepoint;
savepoint = static_cast<fts_savepoint_t*>(
ib_vector_get(savepoints, i));
- /* Even though we release the resources that are part
- of the savepoint, we don't (always) actually delete the
- entry. We simply set the savepoint name to NULL. Therefore
- we have to skip deleted/released entries. */
- if (savepoint->name != NULL
- && strcmp(name, savepoint->name) == 0) {
- break;
+ if (i == ib_vector_size(savepoints) - 1) {
+ /* If the savepoint is the last, we save its
+ tables to the previous savepoint. */
+ fts_savepoint_t* prev_savepoint;
+ prev_savepoint = static_cast<fts_savepoint_t*>(
+ ib_vector_get(savepoints, i - 1));
- /* Track the previous savepoint instance that will
- be at the top of the stack after the release. */
- } else if (savepoint->name != NULL) {
- /* We need to delete all entries
- greater than this element. */
- top_of_stack = i;
+ ib_rbt_t* tables = savepoint->tables;
+ savepoint->tables = prev_savepoint->tables;
+ prev_savepoint->tables = tables;
}
- }
-
- /* Only if we found and element to release. */
- if (i < ib_vector_size(savepoints)) {
- fts_savepoint_t* last_savepoint;
- fts_savepoint_t* top_savepoint;
- ib_rbt_t* tables;
-
- ut_a(top_of_stack < ib_vector_size(savepoints));
- /* Exchange tables between last savepoint and top savepoint */
- last_savepoint = static_cast<fts_savepoint_t*>(
- ib_vector_last(trx->fts_trx->savepoints));
- top_savepoint = static_cast<fts_savepoint_t*>(
- ib_vector_get(savepoints, top_of_stack));
- tables = top_savepoint->tables;
- top_savepoint->tables = last_savepoint->tables;
- last_savepoint->tables = tables;
-
- /* Skip the implied savepoint. */
- for (i = ib_vector_size(savepoints) - 1;
- i > top_of_stack;
- --i) {
-
- fts_savepoint_t* savepoint;
-
- savepoint = static_cast<fts_savepoint_t*>(
- ib_vector_get(savepoints, i));
-
- /* Skip savepoints that were released earlier. */
- if (savepoint->name != NULL) {
- savepoint->name = NULL;
- fts_savepoint_free(savepoint);
- }
-
- ib_vector_pop(savepoints);
- }
+ fts_savepoint_free(savepoint);
+ ib_vector_remove(savepoints, *(void**)savepoint);
/* Make sure we don't delete the implied savepoint. */
ut_a(ib_vector_size(savepoints) > 0);
-
- /* This must hold. */
- ut_a(ib_vector_size(savepoints) == (top_of_stack + 1));
}
}
@@ -6330,7 +6267,7 @@ fts_fake_hex_to_dec(
{
ib_id_t dec_id = 0;
char tmp_id[FTS_AUX_MIN_TABLE_ID_LENGTH];
- int ret;
+ int ret __attribute__((unused));
ret = sprintf(tmp_id, UINT64PFx, id);
ut_ad(ret == 16);
diff --git a/storage/innobase/fts/fts0opt.cc b/storage/innobase/fts/fts0opt.cc
index 2e2bd061d07..e096b8bf6d6 100644
--- a/storage/innobase/fts/fts0opt.cc
+++ b/storage/innobase/fts/fts0opt.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2007, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2007, 2015, 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
@@ -42,9 +42,6 @@ Completed 2011/7/10 Sunny and Jimmy Yang
/** The FTS optimize thread's work queue. */
static ib_wqueue_t* fts_optimize_wq;
-/** The number of document ids to delete in one statement. */
-static const ulint FTS_MAX_DELETE_DOC_IDS = 1000;
-
/** Time to wait for a message. */
static const ulint FTS_QUEUE_WAIT_IN_USECS = 5000000;
@@ -1154,6 +1151,7 @@ fts_optimize_encode_node(
}
/* Calculate the space required to store the ilist. */
+ ut_ad(doc_id > node->last_doc_id);
doc_id_delta = doc_id - node->last_doc_id;
enc_len = fts_get_encoded_len(static_cast<ulint>(doc_id_delta));
@@ -1396,7 +1394,8 @@ fts_optimize_word(
src_node = (fts_node_t*) ib_vector_get(word->nodes, i);
- if (!dst_node) {
+ if (dst_node == NULL
+ || dst_node->last_doc_id > src_node->first_doc_id) {
dst_node = static_cast<fts_node_t*>(
ib_vector_push(nodes, NULL));
@@ -2577,8 +2576,6 @@ fts_optimize_add_table(
return;
}
- ut_ad(table->cached && table->fts != NULL);
-
/* Make sure table with FTS index cannot be evicted */
if (table->can_be_evicted) {
dict_table_move_from_lru_to_non_lru(table);
diff --git a/storage/innobase/fts/fts0que.cc b/storage/innobase/fts/fts0que.cc
index 8f4813e4b3f..9fa38cde561 100644
--- a/storage/innobase/fts/fts0que.cc
+++ b/storage/innobase/fts/fts0que.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2007, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2007, 2015, 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
@@ -57,9 +57,6 @@ Completed 2011/7/10 Sunny and Jimmy Yang
/*Initial byte length for 'words' in fts_ranking_t */
#define RANKING_WORDS_INIT_LEN 4
-/* Coeffecient to use for normalize relevance ranking. */
-static const double FTS_NORMALIZE_COEFF = 0.0115F;
-
// FIXME: Need to have a generic iterator that traverses the ilist.
typedef std::vector<fts_string_t> word_vector_t;
@@ -1534,7 +1531,8 @@ fts_merge_doc_ids(
{
const ib_rbt_node_t* node;
- ut_a(!rbt_empty(doc_ids));
+ DBUG_ENTER("fts_merge_doc_ids");
+
ut_a(!query->intersection);
/* To process FTS_EXIST operation (intersection), we need
@@ -1559,7 +1557,7 @@ fts_merge_doc_ids(
query, ranking->doc_id, ranking->rank);
if (query->error != DB_SUCCESS) {
- return(query->error);
+ DBUG_RETURN(query->error);
}
/* Merge words. Don't need to take operator into account. */
@@ -1578,7 +1576,7 @@ fts_merge_doc_ids(
query->intersection = NULL;
}
- return(DB_SUCCESS);
+ DBUG_RETURN(DB_SUCCESS);
}
/*****************************************************************//**
@@ -2839,11 +2837,11 @@ fts_query_visitor(
fts_query_t* query = static_cast<fts_query_t*>(arg);
ut_a(node);
+ DBUG_ENTER("fts_query_visitor");
+ DBUG_PRINT("fts", ("nodetype: %s", fts_ast_node_type_get(node->type)));
token.f_n_char = 0;
-
query->oper = oper;
-
query->cur_node = node;
switch (node->type) {
@@ -2905,7 +2903,7 @@ fts_query_visitor(
query->multi_exist = true;
}
- return(query->error);
+ DBUG_RETURN(query->error);
}
/*****************************************************************//**
@@ -2929,6 +2927,8 @@ fts_ast_visit_sub_exp(
bool will_be_ignored = false;
bool multi_exist;
+ DBUG_ENTER("fts_ast_visit_sub_exp");
+
ut_a(node->type == FTS_AST_SUBEXP_LIST);
cur_oper = query->oper;
@@ -2957,14 +2957,14 @@ fts_ast_visit_sub_exp(
/* Merge the sub-expression result with the parent result set. */
subexpr_doc_ids = query->doc_ids;
query->doc_ids = parent_doc_ids;
- if (error == DB_SUCCESS && !rbt_empty(subexpr_doc_ids)) {
+ if (error == DB_SUCCESS) {
error = fts_merge_doc_ids(query, subexpr_doc_ids);
}
/* Free current result set. Result already merged into parent. */
fts_query_free_doc_ids(query, subexpr_doc_ids);
- return(error);
+ DBUG_RETURN(error);
}
#if 0
@@ -3440,8 +3440,10 @@ fts_retrieve_ranking(
ib_rbt_bound_t parent;
fts_ranking_t new_ranking;
+ DBUG_ENTER("fts_retrieve_ranking");
+
if (!result || !result->rankings_by_id) {
- return(0);
+ DBUG_RETURN(0);
}
new_ranking.doc_id = doc_id;
@@ -3452,10 +3454,10 @@ fts_retrieve_ranking(
ranking = rbt_value(fts_ranking_t, parent.last);
- return(ranking->rank);
+ DBUG_RETURN(ranking->rank);
}
- return(0);
+ DBUG_RETURN(0);
}
/*****************************************************************//**
@@ -3472,6 +3474,8 @@ fts_query_prepare_result(
const ib_rbt_node_t* node;
bool result_is_null = false;
+ DBUG_ENTER("fts_query_prepare_result");
+
if (result == NULL) {
result = static_cast<fts_result_t*>(ut_malloc(sizeof(*result)));
@@ -3520,7 +3524,7 @@ fts_query_prepare_result(
if (query->total_size > fts_result_cache_limit) {
query->error = DB_FTS_EXCEED_RESULT_CACHE_LIMIT;
fts_query_free_result(result);
- return(NULL);
+ DBUG_RETURN(NULL);
}
}
@@ -3543,7 +3547,7 @@ fts_query_prepare_result(
ranking->rank * word_freq->idf * word_freq->idf);
}
- return(result);
+ DBUG_RETURN(result);
}
ut_a(rbt_size(query->doc_ids) > 0);
@@ -3570,7 +3574,7 @@ fts_query_prepare_result(
if (query->total_size > fts_result_cache_limit) {
query->error = DB_FTS_EXCEED_RESULT_CACHE_LIMIT;
fts_query_free_result(result);
- return(NULL);
+ DBUG_RETURN(NULL);
}
}
}
@@ -3582,7 +3586,7 @@ fts_query_prepare_result(
query->doc_ids = NULL;
}
- return(result);
+ DBUG_RETURN(result);
}
/*****************************************************************//**
@@ -3594,6 +3598,8 @@ fts_query_get_result(
fts_query_t* query, /*!< in: query instance */
fts_result_t* result) /*!< in: result */
{
+ DBUG_ENTER("fts_query_get_result");
+
if (rbt_size(query->doc_ids) > 0 || query->flags == FTS_OPT_RANKING) {
/* Copy the doc ids to the result. */
result = fts_query_prepare_result(query, result);
@@ -3603,7 +3609,7 @@ fts_query_get_result(
memset(result, 0, sizeof(*result));
}
- return(result);
+ DBUG_RETURN(result);
}
/*****************************************************************//**
@@ -3681,6 +3687,7 @@ fts_query_parse(
int error;
fts_ast_state_t state;
bool mode = query->boolean_mode;
+ DBUG_ENTER("fts_query_parse");
memset(&state, 0x0, sizeof(state));
@@ -3699,7 +3706,7 @@ fts_query_parse(
query->root = state.root;
}
- return(state.root);
+ DBUG_RETURN(state.root);
}
/*******************************************************************//**
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 2c77e6c9efb..10fc11eff5e 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2000, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2000, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, 2009 Google Inc.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2012, Facebook Inc.
@@ -499,7 +499,8 @@ ib_cb_t innodb_api_cb[] = {
(ib_cb_t) ib_get_idx_field_name,
(ib_cb_t) ib_trx_get_start_time,
(ib_cb_t) ib_cfg_bk_commit_interval,
- (ib_cb_t) ib_cursor_stmt_begin
+ (ib_cb_t) ib_cursor_stmt_begin,
+ (ib_cb_t) ib_trx_read_only
};
/**
@@ -1615,6 +1616,15 @@ convert_error_code_to_mysql(
return(HA_ERR_TO_BIG_ROW);
}
+
+ case DB_TOO_BIG_FOR_REDO:
+ my_printf_error(ER_TOO_BIG_ROWSIZE, "%s" , MYF(0),
+ "The size of BLOB/TEXT data inserted"
+ " in one transaction is greater than"
+ " 10% of redo log size. Increase the"
+ " redo log size using innodb_log_file_size.");
+ return(HA_ERR_TO_BIG_ROW);
+
case DB_TOO_BIG_INDEX_COL:
my_error(ER_INDEX_COLUMN_TOO_LONG, MYF(0),
DICT_MAX_FIELD_LEN_BY_FORMAT_FLAG(flags));
@@ -2835,19 +2845,6 @@ trx_is_strict(
return(trx && trx->mysql_thd && THDVAR(trx->mysql_thd, strict_mode));
}
-/**********************************************************************//**
-Determines if the current MySQL thread is running in strict mode.
-If thd==NULL, THDVAR returns the global value of innodb-strict-mode.
-@return TRUE if strict */
-UNIV_INLINE
-ibool
-thd_is_strict(
-/*==========*/
- THD* thd) /*!< in: MySQL thread descriptor */
-{
- return(THDVAR(thd, strict_mode));
-}
-
/**************************************************************//**
Resets some fields of a prebuilt struct. The template is used in fast
retrieval of just those column values MySQL needs in its processing. */
@@ -4238,7 +4235,10 @@ innobase_release_savepoint(
DBUG_ASSERT(hton == innodb_hton_ptr);
trx = check_trx_exists(thd);
- trx_start_if_not_started(trx);
+
+ if (trx->state == TRX_STATE_NOT_STARTED) {
+ trx_start_if_not_started(trx);
+ }
/* TODO: use provided savepoint data area to store savepoint data */
@@ -4907,6 +4907,8 @@ innobase_match_index_columns(
if (innodb_idx_fld >= innodb_idx_fld_end) {
DBUG_RETURN(FALSE);
}
+
+ mtype = innodb_idx_fld->col->mtype;
}
// MariaDB-5.5 compatibility
@@ -6903,12 +6905,15 @@ ha_innobase::innobase_lock_autoinc(void)
break;
case AUTOINC_NEW_STYLE_LOCKING:
- /* For simple (single/multi) row INSERTs, we fallback to the
- old style only if another transaction has already acquired
- the AUTOINC lock on behalf of a LOAD FILE or INSERT ... SELECT
- etc. type of statement. */
+ /* For simple (single/multi) row INSERTs/REPLACEs and RBR
+ events, we fallback to the old style only if another
+ transaction has already acquired the AUTOINC lock on
+ behalf of a LOAD FILE or INSERT ... SELECT etc. type of
+ statement. */
if (thd_sql_command(user_thd) == SQLCOM_INSERT
- || thd_sql_command(user_thd) == SQLCOM_REPLACE) {
+ || thd_sql_command(user_thd) == SQLCOM_REPLACE
+ || thd_sql_command(user_thd) == SQLCOM_END // RBR event
+ ) {
dict_table_t* ib_table = prebuilt->table;
/* Acquire the AUTOINC mutex. */
@@ -6917,9 +6922,11 @@ ha_innobase::innobase_lock_autoinc(void)
/* We need to check that another transaction isn't
already holding the AUTOINC lock on the table. */
if (ib_table->n_waiting_or_granted_auto_inc_locks) {
- /* Release the mutex to avoid deadlocks. */
+ /* Release the mutex to avoid deadlocks and
+ fall back to old style locking. */
dict_table_autoinc_unlock(ib_table);
} else {
+ /* Do not fall back to old style locking. */
break;
}
}
@@ -8312,6 +8319,11 @@ ha_innobase::general_fetch(
DBUG_ENTER("general_fetch");
+ /* If transaction is not startted do not continue, instead return a error code. */
+ if(!(prebuilt->sql_stat_start || (prebuilt->trx && prebuilt->trx->state == 1))) {
+ DBUG_RETURN(HA_ERR_END_OF_FILE);
+ }
+
ut_a(prebuilt->trx == thd_to_trx(user_thd));
innobase_srv_conc_enter_innodb(prebuilt->trx);
@@ -11200,6 +11212,13 @@ ha_innobase::estimate_rows_upper_bound()
prebuilt->trx->op_info = "";
+ /* Set num_rows less than MERGEBUFF to simulate the case where we do
+ not have enough space to merge the externally sorted file blocks. */
+ DBUG_EXECUTE_IF("set_num_rows_lt_MERGEBUFF",
+ estimate = 2;
+ DBUG_SET("-d,set_num_rows_lt_MERGEBUFF");
+ );
+
DBUG_RETURN((ha_rows) estimate);
}
@@ -11465,7 +11484,6 @@ ha_innobase::info_low(
dict_table_t* ib_table;
ha_rows rec_per_key;
ib_uint64_t n_rows;
- char path[FN_REFLEN];
os_file_stat_t stat_info;
DBUG_ENTER("info");
@@ -11523,17 +11541,6 @@ ha_innobase::info_low(
"returning various info to MySQL";
}
- my_snprintf(path, sizeof(path), "%s/%s%s",
- mysql_data_home, ib_table->name, reg_ext);
-
- unpack_filename(path,path);
-
- /* Note that we do not know the access time of the table,
- nor the CHECK TABLE time, nor the UPDATE or INSERT time. */
-
- if (os_file_get_status(path, &stat_info, false) == DB_SUCCESS) {
- stats.create_time = (ulong) stat_info.ctime;
- }
}
if (flag & HA_STATUS_VARIABLE) {
@@ -11665,6 +11672,7 @@ ha_innobase::info_low(
if (flag & HA_STATUS_CONST) {
ulong i;
+ char path[FN_REFLEN];
/* Verify the number of index in InnoDB and MySQL
matches up. If prebuilt->clust_index_was_generated
holds, InnoDB defines GEN_CLUST_INDEX internally */
@@ -11818,6 +11826,20 @@ ha_innobase::info_low(
if (!(flag & HA_STATUS_NO_LOCK)) {
dict_table_stats_unlock(ib_table, RW_S_LATCH);
}
+
+ my_snprintf(path, sizeof(path), "%s/%s%s",
+ mysql_data_home,
+ table->s->normalized_path.str,
+ reg_ext);
+
+ unpack_filename(path,path);
+
+ /* Note that we do not know the access time of the table,
+ nor the CHECK TABLE time, nor the UPDATE or INSERT time. */
+
+ if (os_file_get_status(path, &stat_info, false) == DB_SUCCESS) {
+ stats.create_time = (ulong) stat_info.ctime;
+ }
}
if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) {
@@ -14123,10 +14145,8 @@ ha_innobase::cmp_ref(
len1 = innobase_read_from_2_little_endian(ref1);
len2 = innobase_read_from_2_little_endian(ref2);
- ref1 += 2;
- ref2 += 2;
result = ((Field_blob*) field)->cmp(
- ref1, len1, ref2, len2);
+ ref1 + 2, len1, ref2 + 2, len2);
} else {
result = field->key_cmp(ref1, ref2);
}
@@ -18009,6 +18029,7 @@ innodb_compression_algorithm_validate(
/**********************************************************************
Issue a warning that the row is too big. */
+UNIV_INTERN
void
ib_warn_row_too_big(const dict_table_t* table)
{
@@ -18022,6 +18043,10 @@ ib_warn_row_too_big(const dict_table_t* table)
THD* thd = current_thd;
+ if (thd == NULL) {
+ return;
+ }
+
push_warning_printf(
thd, Sql_condition::WARN_LEVEL_WARN, HA_ERR_TO_BIG_ROW,
"Row size too large (> %lu). Changing some columns to TEXT"
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index 4291d32b206..96a779868fb 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -129,6 +129,7 @@ my_error_innodb(
break;
case DB_OUT_OF_FILE_SPACE:
my_error(ER_RECORD_FILE_FULL, MYF(0), table);
+ ut_error;
break;
case DB_TEMP_FILE_WRITE_FAILURE:
my_error(ER_GET_ERRMSG, MYF(0),
@@ -1457,8 +1458,9 @@ innobase_create_index_field_def(
if a new clustered index is
not being created */
const KEY_PART_INFO* key_part, /*!< in: MySQL key definition */
- index_field_t* index_field) /*!< out: index field
+ index_field_t* index_field, /*!< out: index field
definition for key_part */
+ const Field** fields) /*!< in: MySQL table fields */
{
const Field* field;
ibool is_unsigned;
@@ -1475,6 +1477,7 @@ innobase_create_index_field_def(
ut_a(field);
index_field->col_no = key_part->fieldnr;
+ index_field->col_name = altered_table ? field->field_name : fields[key_part->fieldnr]->field_name;
col_type = get_innobase_type_from_mysql_type(&is_unsigned, field);
@@ -1509,8 +1512,9 @@ innobase_create_index_def(
bool key_clustered, /*!< in: true if this is
the new clustered index */
index_def_t* index, /*!< out: index definition */
- mem_heap_t* heap) /*!< in: heap where memory
+ mem_heap_t* heap, /*!< in: heap where memory
is allocated */
+ const Field** fields) /*!z in: MySQL table fields */
{
const KEY* key = &keys[key_number];
ulint i;
@@ -1523,6 +1527,7 @@ innobase_create_index_def(
index->fields = static_cast<index_field_t*>(
mem_heap_alloc(heap, n_fields * sizeof *index->fields));
+ memset(index->fields, 0, n_fields * sizeof *index->fields);
index->ind_type = 0;
index->key_number = key_number;
@@ -1560,7 +1565,7 @@ innobase_create_index_def(
for (i = 0; i < n_fields; i++) {
innobase_create_index_field_def(
- altered_table, &key->key_part[i], &index->fields[i]);
+ altered_table, &key->key_part[i], &index->fields[i], fields);
}
DBUG_VOID_RETURN;
@@ -1891,7 +1896,7 @@ innobase_create_key_defs(
/* Create the PRIMARY key index definition */
innobase_create_index_def(
altered_table, key_info, primary_key_number,
- TRUE, TRUE, indexdef++, heap);
+ TRUE, TRUE, indexdef++, heap, (const Field **)altered_table->field);
created_clustered:
n_add = 1;
@@ -1903,7 +1908,7 @@ created_clustered:
/* Copy the index definitions. */
innobase_create_index_def(
altered_table, key_info, i, TRUE, FALSE,
- indexdef, heap);
+ indexdef, heap, (const Field **)altered_table->field);
if (indexdef->ind_type & DICT_FTS) {
n_fts_add++;
@@ -1948,7 +1953,7 @@ created_clustered:
for (ulint i = 0; i < n_add; i++) {
innobase_create_index_def(
altered_table, key_info, add[i], FALSE, FALSE,
- indexdef, heap);
+ indexdef, heap, (const Field **)altered_table->field);
if (indexdef->ind_type & DICT_FTS) {
n_fts_add++;
@@ -1965,6 +1970,7 @@ created_clustered:
index->fields = static_cast<index_field_t*>(
mem_heap_alloc(heap, sizeof *index->fields));
+ memset(index->fields, 0, sizeof *index->fields);
index->n_fields = 1;
index->fields->col_no = fts_doc_id_col;
index->fields->prefix_len = 0;
@@ -4463,11 +4469,15 @@ err_exit:
rename_foreign:
trx->op_info = "renaming column in SYS_FOREIGN_COLS";
+ std::list<dict_foreign_t*> fk_evict;
+ bool foreign_modified;
+
for (dict_foreign_set::const_iterator it = user_table->foreign_set.begin();
it != user_table->foreign_set.end();
++it) {
dict_foreign_t* foreign = *it;
+ foreign_modified = false;
for (unsigned i = 0; i < foreign->n_fields; i++) {
if (strcmp(foreign->foreign_col_names[i], from)) {
@@ -4495,6 +4505,11 @@ rename_foreign:
if (error != DB_SUCCESS) {
goto err_exit;
}
+ foreign_modified = true;
+ }
+
+ if (foreign_modified) {
+ fk_evict.push_back(foreign);
}
}
@@ -4503,7 +4518,9 @@ rename_foreign:
it != user_table->referenced_set.end();
++it) {
+ foreign_modified = false;
dict_foreign_t* foreign = *it;
+
for (unsigned i = 0; i < foreign->n_fields; i++) {
if (strcmp(foreign->referenced_col_names[i], from)) {
continue;
@@ -4530,7 +4547,17 @@ rename_foreign:
if (error != DB_SUCCESS) {
goto err_exit;
}
+ foreign_modified = true;
}
+
+ if (foreign_modified) {
+ fk_evict.push_back(foreign);
+ }
+ }
+
+ if (new_clustered) {
+ std::for_each(fk_evict.begin(), fk_evict.end(),
+ dict_foreign_remove_from_cache);
}
trx->op_info = "";
diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
index 20a411a6b08..2211243fbf3 100644
--- a/storage/innobase/handler/i_s.cc
+++ b/storage/innobase/handler/i_s.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2007, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2007, 2015, 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
@@ -158,9 +158,12 @@ do { \
} \
} while (0)
-#if !defined __STRICT_ANSI__ && defined __GNUC__ && (__GNUC__) > 2 && \
- !defined __INTEL_COMPILER && !defined __clang__
+#if !defined __STRICT_ANSI__ && defined __GNUC__ && (__GNUC__) > 2 && !defined __INTEL_COMPILER && !defined __clang__
+#ifdef HAVE_C99_INITIALIZERS
+#define STRUCT_FLD(name, value) .name = value
+#else
#define STRUCT_FLD(name, value) name: value
+#endif /* HAVE_C99_INITIALIZERS */
#else
#define STRUCT_FLD(name, value) value
#endif
@@ -3261,8 +3264,6 @@ i_s_fts_index_cache_fill_one_index(
for (rbt_node = rbt_first(index_cache->words);
rbt_node;
rbt_node = rbt_next(index_cache->words, rbt_node)) {
- doc_id_t doc_id = 0;
-
fts_tokenizer_word_t* word;
word = rbt_value(fts_tokenizer_word_t, rbt_node);
@@ -3288,6 +3289,7 @@ i_s_fts_index_cache_fill_one_index(
fts_node_t* node;
byte* ptr;
ulint decoded = 0;
+ doc_id_t doc_id = 0;
node = static_cast<fts_node_t*> (ib_vector_get(
word->nodes, i));
@@ -3961,10 +3963,14 @@ i_s_fts_config_fill(
if (!user_table) {
DBUG_RETURN(0);
+ } else if (!dict_table_has_fts_index(user_table)) {
+ dict_table_close(user_table, FALSE, FALSE);
+
+ DBUG_RETURN(0);
}
trx = trx_allocate_for_background();
- trx->op_info = "Select for FTS DELETE TABLE";
+ trx->op_info = "Select for FTS CONFIG TABLE";
FTS_INIT_FTS_TABLE(&fts_table, "CONFIG", FTS_COMMON_TABLE, user_table);
diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc
index 2082c0d194b..5fd0fdcb10a 100644
--- a/storage/innobase/ibuf/ibuf0ibuf.cc
+++ b/storage/innobase/ibuf/ibuf0ibuf.cc
@@ -2837,6 +2837,14 @@ ibuf_contract_in_background(
mutex_exit(&ibuf_mutex);
}
+#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
+ if (ibuf_debug) {
+ return(0);
+ }
+#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
+
+
+
while (sum_pages < n_pages) {
ulint n_bytes;
@@ -3885,7 +3893,7 @@ check_watch:
{
buf_page_t* bpage;
buf_pool_t* buf_pool = buf_pool_get(space, page_no);
- bpage = buf_page_hash_get(buf_pool, space, page_no);
+ bpage = buf_page_get_also_watch(buf_pool, space, page_no);
if (UNIV_LIKELY_NULL(bpage)) {
/* A buffer pool watch has been set or the
diff --git a/storage/innobase/include/api0api.h b/storage/innobase/include/api0api.h
index d77d691becc..e4c9c941de5 100644
--- a/storage/innobase/include/api0api.h
+++ b/storage/innobase/include/api0api.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2011, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2011, 2015, 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
@@ -494,6 +494,14 @@ ib_trx_state(
/*=========*/
ib_trx_t ib_trx); /*!< in: trx handle */
+
+/*****************************************************************//**
+Check if the transaction is read_only */
+ib_u32_t
+ib_trx_read_only(
+/*=============*/
+ ib_trx_t ib_trx); /*!< in: trx handle */
+
/*****************************************************************//**
Release the resources of the transaction. If the transaction was
selected as a victim by InnoDB and rolled back then use this function
diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
index 16bfaac2efc..ebed2bb62a6 100644
--- a/storage/innobase/include/buf0buf.h
+++ b/storage/innobase/include/buf0buf.h
@@ -1269,7 +1269,7 @@ page_hash lock is acquired in the specified lock mode. Otherwise,
mode value is ignored. It is up to the caller to release the
lock. If the block is found and the lock is NULL then the page_hash
lock is released by this function.
-@return block, NULL if not found */
+@return block, NULL if not found, or watch sentinel (if watch is true) */
UNIV_INLINE
buf_page_t*
buf_page_hash_get_locked(
@@ -1285,9 +1285,11 @@ buf_page_hash_get_locked(
found. NULL otherwise. If NULL
is passed then the hash_lock
is released by this function */
- ulint lock_mode); /*!< in: RW_LOCK_EX or
+ ulint lock_mode, /*!< in: RW_LOCK_EX or
RW_LOCK_SHARED. Ignored if
lock == NULL */
+ bool watch = false); /*!< in: if true, return watch
+ sentinel also. */
/******************************************************************//**
Returns the control block of a file page, NULL if not found.
If the block is found and lock is not NULL then the appropriate
@@ -1327,6 +1329,8 @@ buf_page_hash_get_low() function.
buf_page_hash_get_locked(b, s, o, l, RW_LOCK_EX)
#define buf_page_hash_get(b, s, o) \
buf_page_hash_get_locked(b, s, o, NULL, 0)
+#define buf_page_get_also_watch(b, s, o) \
+ buf_page_hash_get_locked(b, s, o, NULL, 0, true)
#define buf_block_hash_get_s_locked(b, s, o, l) \
buf_block_hash_get_locked(b, s, o, l, RW_LOCK_SHARED)
diff --git a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0buf.ic
index 6e419674f98..56616c6deeb 100644
--- a/storage/innobase/include/buf0buf.ic
+++ b/storage/innobase/include/buf0buf.ic
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2014, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@@ -1172,7 +1172,7 @@ page_hash lock is acquired in the specified lock mode. Otherwise,
mode value is ignored. It is up to the caller to release the
lock. If the block is found and the lock is NULL then the page_hash
lock is released by this function.
-@return block, NULL if not found */
+@return block, NULL if not found, or watch sentinel (if watch is true) */
UNIV_INLINE
buf_page_t*
buf_page_hash_get_locked(
@@ -1188,9 +1188,11 @@ buf_page_hash_get_locked(
found. NULL otherwise. If NULL
is passed then the hash_lock
is released by this function */
- ulint lock_mode) /*!< in: RW_LOCK_EX or
+ ulint lock_mode, /*!< in: RW_LOCK_EX or
RW_LOCK_SHARED. Ignored if
lock == NULL */
+ bool watch) /*!< in: if true, return watch
+ sentinel also. */
{
buf_page_t* bpage = NULL;
ulint fold;
@@ -1221,7 +1223,9 @@ buf_page_hash_get_locked(
bpage = buf_page_hash_get_low(buf_pool, space, offset, fold);
if (!bpage || buf_pool_watch_is_sentinel(buf_pool, bpage)) {
- bpage = NULL;
+ if (!watch) {
+ bpage = NULL;
+ }
goto unlock_and_exit;
}
diff --git a/storage/innobase/include/db0err.h b/storage/innobase/include/db0err.h
index 71916cb33f2..1e87ce3fdb8 100644
--- a/storage/innobase/include/db0err.h
+++ b/storage/innobase/include/db0err.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2012, 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
@@ -130,7 +130,8 @@ enum dberr_t {
DB_TEMP_FILE_WRITE_FAILURE, /*!< Temp file write failure */
DB_FTS_TOO_MANY_WORDS_IN_PHRASE,
/*< Too many words in a phrase */
-
+ DB_TOO_BIG_FOR_REDO, /* Record length greater than 10%
+ of redo log */
/* The following are partial failure codes */
DB_FAIL = 1000,
DB_OVERFLOW,
diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h
index 8d6243e1aaa..db39d502db6 100644
--- a/storage/innobase/include/dict0dict.h
+++ b/storage/innobase/include/dict0dict.h
@@ -600,6 +600,17 @@ dict_table_get_col_name(
ulint col_nr) /*!< in: column number */
__attribute__((nonnull, warn_unused_result));
/**********************************************************************//**
+Returns a column's name.
+@return column name. NOTE: not guaranteed to stay valid if table is
+modified in any way (columns added, etc.). */
+UNIV_INTERN
+const char*
+dict_table_get_col_name_for_mysql(
+/*==============================*/
+ const dict_table_t* table, /*!< in: table */
+ const char* col_name)/*!< in: MySQL table column name */
+ __attribute__((nonnull, warn_unused_result));
+/**********************************************************************//**
Prints a table data. */
UNIV_INTERN
void
diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h
index 5e690128042..e64b4e18a2e 100644
--- a/storage/innobase/include/dict0mem.h
+++ b/storage/innobase/include/dict0mem.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
Copyright (c) 2013, SkySQL Ab. All Rights Reserved.
@@ -51,6 +51,7 @@ Created 1/8/1996 Heikki Tuuri
#include <set>
#include <algorithm>
#include <iterator>
+#include <ostream>
/* Forward declaration. */
struct ib_rbt_t;
@@ -599,11 +600,12 @@ extern ulong zip_failure_threshold_pct;
compression failures */
extern ulong zip_pad_max;
-/** Data structure to hold information about about how much space in
+/** Data structure to hold information about how much space in
an uncompressed page should be left as padding to avoid compression
failures. This estimate is based on a self-adapting heuristic. */
struct zip_pad_info_t {
- os_fast_mutex_t mutex; /*!< mutex protecting the info */
+ os_fast_mutex_t*
+ mutex; /*!< mutex protecting the info */
ulint pad; /*!< number of bytes used as pad */
ulint success;/*!< successful compression ops during
current round */
@@ -611,6 +613,9 @@ struct zip_pad_info_t {
current round */
ulint n_rounds;/*!< number of currently successful
rounds */
+ volatile os_once::state_t
+ mutex_created;
+ /*!< Creation state of mutex member */
};
/** Data structure for an index. Most fields will be
@@ -1211,9 +1216,14 @@ struct dict_table_t{
space from the lock heap of the trx:
otherwise the lock heap would grow rapidly
if we do a large insert from a select */
- ib_mutex_t autoinc_mutex;
+ ib_mutex_t* autoinc_mutex;
/*!< mutex protecting the autoincrement
counter */
+
+ /** Creation state of autoinc_mutex member */
+ volatile os_once::state_t
+ autoinc_mutex_created;
+
ib_uint64_t autoinc;/*!< autoinc counter value to give to the
next inserted row */
ulong n_waiting_or_granted_auto_inc_locks;
@@ -1276,6 +1286,111 @@ struct dict_foreign_add_to_referenced_table {
}
};
+/** Destroy the autoinc latch of the given table.
+This function is only called from either single threaded environment
+or from a thread that has not shared the table object with other threads.
+@param[in,out] table table whose stats latch to destroy */
+inline
+void
+dict_table_autoinc_destroy(
+ dict_table_t* table)
+{
+ if (table->autoinc_mutex_created == os_once::DONE
+ && table->autoinc_mutex != NULL) {
+ mutex_free(table->autoinc_mutex);
+ delete table->autoinc_mutex;
+ }
+}
+
+/** Allocate and init the autoinc latch of a given table.
+This function must not be called concurrently on the same table object.
+@param[in,out] table_void table whose autoinc latch to create */
+void
+dict_table_autoinc_alloc(
+ void* table_void);
+
+/** Allocate and init the zip_pad_mutex of a given index.
+This function must not be called concurrently on the same index object.
+@param[in,out] index_void index whose zip_pad_mutex to create */
+void
+dict_index_zip_pad_alloc(
+ void* index_void);
+
+/** Request for lazy creation of the autoinc latch of a given table.
+This function is only called from either single threaded environment
+or from a thread that has not shared the table object with other threads.
+@param[in,out] table table whose autoinc latch is to be created. */
+inline
+void
+dict_table_autoinc_create_lazy(
+ dict_table_t* table)
+{
+#ifdef HAVE_ATOMIC_BUILTINS
+ table->autoinc_mutex = NULL;
+ table->autoinc_mutex_created = os_once::NEVER_DONE;
+#else /* HAVE_ATOMIC_BUILTINS */
+ dict_table_autoinc_alloc(table);
+ table->autoinc_mutex_created = os_once::DONE;
+#endif /* HAVE_ATOMIC_BUILTINS */
+}
+
+/** Request a lazy creation of dict_index_t::zip_pad::mutex.
+This function is only called from either single threaded environment
+or from a thread that has not shared the table object with other threads.
+@param[in,out] index index whose zip_pad mutex is to be created */
+inline
+void
+dict_index_zip_pad_mutex_create_lazy(
+ dict_index_t* index)
+{
+#ifdef HAVE_ATOMIC_BUILTINS
+ index->zip_pad.mutex = NULL;
+ index->zip_pad.mutex_created = os_once::NEVER_DONE;
+#else /* HAVE_ATOMIC_BUILTINS */
+ dict_index_zip_pad_alloc(index);
+ index->zip_pad.mutex_created = os_once::DONE;
+#endif /* HAVE_ATOMIC_BUILTINS */
+}
+
+/** Destroy the zip_pad_mutex of the given index.
+This function is only called from either single threaded environment
+or from a thread that has not shared the table object with other threads.
+@param[in,out] table table whose stats latch to destroy */
+inline
+void
+dict_index_zip_pad_mutex_destroy(
+ dict_index_t* index)
+{
+ if (index->zip_pad.mutex_created == os_once::DONE
+ && index->zip_pad.mutex != NULL) {
+ os_fast_mutex_free(index->zip_pad.mutex);
+ delete index->zip_pad.mutex;
+ }
+}
+
+/** Release the zip_pad_mutex of a given index.
+@param[in,out] index index whose zip_pad_mutex is to be released */
+inline
+void
+dict_index_zip_pad_unlock(
+ dict_index_t* index)
+{
+ os_fast_mutex_unlock(index->zip_pad.mutex);
+}
+
+#ifdef UNIV_DEBUG
+/** Check if the current thread owns the autoinc_mutex of a given table.
+@param[in] table the autoinc_mutex belongs to this table
+@return true, if the current thread owns the autoinc_mutex, false otherwise.*/
+inline
+bool
+dict_table_autoinc_own(
+ const dict_table_t* table)
+{
+ return(mutex_own(table->autoinc_mutex));
+}
+#endif /* UNIV_DEBUG */
+
#ifndef UNIV_NONINL
#include "dict0mem.ic"
#endif
diff --git a/storage/innobase/include/fts0ast.h b/storage/innobase/include/fts0ast.h
index 50ee587e282..b2380f78b39 100644
--- a/storage/innobase/include/fts0ast.h
+++ b/storage/innobase/include/fts0ast.h
@@ -329,4 +329,11 @@ struct fts_ast_state_t {
tokenization */
};
+#ifdef UNIV_DEBUG
+const char*
+fts_ast_oper_name_get(fts_ast_oper_t oper);
+const char*
+fts_ast_node_type_get(fts_ast_type_t type);
+#endif /* UNIV_DEBUG */
+
#endif /* INNOBASE_FSTS0AST_H */
diff --git a/storage/innobase/include/ha_prototypes.h b/storage/innobase/include/ha_prototypes.h
index a02b8f1893a..20409f85e0c 100644
--- a/storage/innobase/include/ha_prototypes.h
+++ b/storage/innobase/include/ha_prototypes.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2006, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2006, 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
diff --git a/storage/innobase/include/lock0priv.h b/storage/innobase/include/lock0priv.h
index 9f7ab9f76b6..16423e6a282 100644
--- a/storage/innobase/include/lock0priv.h
+++ b/storage/innobase/include/lock0priv.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2007, 2011, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2015, MariaDB Corporation
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
@@ -72,6 +73,12 @@ struct lock_t {
hash_node_t hash; /*!< hash chain node for a record
lock */
dict_index_t* index; /*!< index for a record lock */
+
+ /* Statistics for how long lock has been held and time
+ how long this lock had to be waited before it was granted */
+ time_t requested_time; /*!< Lock request time */
+ ulint wait_time; /*!< Time waited this lock or 0 */
+
union {
lock_table_t tab_lock;/*!< table lock */
lock_rec_t rec_lock;/*!< record lock */
diff --git a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h
index 8f8aef4f45c..4126be51ae9 100644
--- a/storage/innobase/include/os0file.h
+++ b/storage/innobase/include/os0file.h
@@ -1,6 +1,6 @@
/***********************************************************************
-Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2013, SkySQL Ab. All Rights Reserved.
@@ -386,10 +386,10 @@ to original un-instrumented file I/O APIs */
enum os_file_type_t {
OS_FILE_TYPE_UNKNOWN = 0,
- OS_FILE_TYPE_FILE, /* regular file */
+ OS_FILE_TYPE_FILE, /* regular file
+ (or a character/block device) */
OS_FILE_TYPE_DIR, /* directory */
- OS_FILE_TYPE_LINK, /* symbolic link */
- OS_FILE_TYPE_BLOCK /* block device */
+ OS_FILE_TYPE_LINK /* symbolic link */
};
/* Maximum path string length in bytes when referring to tables with in the
diff --git a/storage/innobase/include/os0sync.h b/storage/innobase/include/os0sync.h
index b16a99b51c0..feb64fb1e41 100644
--- a/storage/innobase/include/os0sync.h
+++ b/storage/innobase/include/os0sync.h
@@ -452,7 +452,7 @@ Returns the old value of *ptr, atomically sets *ptr to new_val */
# define os_atomic_test_and_set_ulint(ptr, new_val) \
__sync_lock_test_and_set(ptr, new_val)
-#ifdef __powerpc__
+#if defined(__powerpc__) || defined(__aarch64__)
/*
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
diff --git a/storage/innobase/include/page0page.h b/storage/innobase/include/page0page.h
index cb6633bb941..bd9bce75e57 100644
--- a/storage/innobase/include/page0page.h
+++ b/storage/innobase/include/page0page.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1994, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1994, 2015, 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
@@ -1121,6 +1121,20 @@ page_find_rec_with_heap_no(
const rec_t*
page_find_rec_max_not_deleted(
const page_t* page);
+
+/** Issue a warning when the checksum that is stored in the page is valid,
+but different than the global setting innodb_checksum_algorithm.
+@param[in] current_algo current checksum algorithm
+@param[in] page_checksum page valid checksum
+@param[in] space_id tablespace id
+@param[in] page_no page number */
+void
+page_warn_strict_checksum(
+ srv_checksum_algorithm_t curr_algo,
+ srv_checksum_algorithm_t page_checksum,
+ ulint space_id,
+ ulint page_no);
+
#ifdef UNIV_MATERIALIZE
#undef UNIV_INLINE
#define UNIV_INLINE UNIV_INLINE_ORIGINAL
diff --git a/storage/innobase/include/page0zip.h b/storage/innobase/include/page0zip.h
index 6fe6934e35c..0c2abef4b09 100644
--- a/storage/innobase/include/page0zip.h
+++ b/storage/innobase/include/page0zip.h
@@ -545,6 +545,21 @@ from outside the buffer pool.
# define UNIV_INLINE UNIV_INLINE_ORIGINAL
#endif
+#ifdef UNIV_INNOCHECKSUM
+/** Issue a warning when the checksum that is stored in the page is valid,
+but different than the global setting innodb_checksum_algorithm.
+@param[in] current_algo current checksum algorithm
+@param[in] page_checksum page valid checksum
+@param[in] space_id tablespace id
+@param[in] page_no page number */
+void
+page_warn_strict_checksum(
+ srv_checksum_algorithm_t curr_algo,
+ srv_checksum_algorithm_t page_checksum,
+ ulint space_id,
+ ulint page_no);
+#endif /* UNIV_INNOCHECKSUM */
+
#ifndef UNIV_INNOCHECKSUM
#ifndef UNIV_NONINL
# include "page0zip.ic"
diff --git a/storage/innobase/include/row0merge.h b/storage/innobase/include/row0merge.h
index 390c0ce038b..de353d46202 100644
--- a/storage/innobase/include/row0merge.h
+++ b/storage/innobase/include/row0merge.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2005, 2013, 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 the Free Software
@@ -95,6 +95,7 @@ struct index_field_t {
ulint col_no; /*!< column offset */
ulint prefix_len; /*!< column prefix length, or 0
if indexing the whole column */
+ const char* col_name; /*!< column name or NULL */
};
/** Definition of an index being created */
diff --git a/storage/innobase/include/sync0rw.ic b/storage/innobase/include/sync0rw.ic
index bb05ae7daf1..69251da6e35 100644
--- a/storage/innobase/include/sync0rw.ic
+++ b/storage/innobase/include/sync0rw.ic
@@ -386,6 +386,7 @@ rw_lock_x_lock_func_nowait(
ulint line) /*!< in: line where requested */
{
ibool success;
+ ibool local_recursive= lock->recursive;
#ifdef INNODB_RW_LOCKS_USE_ATOMICS
success = os_compare_and_swap_lint(&lock->lock_word, X_LOCK_DECR, 0);
@@ -400,10 +401,14 @@ rw_lock_x_lock_func_nowait(
mutex_exit(&(lock->mutex));
#endif
+ /* Note: recursive must be loaded before writer_thread see
+ comment for rw_lock_set_writer_id_and_recursion_flag().
+ To achieve this we load it before os_compare_and_swap_lint(),
+ which implies full memory barrier in current implementation. */
if (success) {
rw_lock_set_writer_id_and_recursion_flag(lock, TRUE);
- } else if (lock->recursive
+ } else if (local_recursive
&& os_thread_eq(lock->writer_thread,
os_thread_get_curr_id())) {
/* Relock: this lock_word modification is safe since no other
diff --git a/storage/innobase/include/trx0roll.h b/storage/innobase/include/trx0roll.h
index 9d020a10725..d5ab83d7767 100644
--- a/storage/innobase/include/trx0roll.h
+++ b/storage/innobase/include/trx0roll.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2012, 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
@@ -32,6 +32,8 @@ Created 3/26/1996 Heikki Tuuri
#include "mtr0mtr.h"
#include "trx0sys.h"
+extern bool trx_rollback_or_clean_is_active;
+
/*******************************************************************//**
Determines if this transaction is rolling back an incomplete transaction
in crash recovery.
diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h
index fcc9ed05081..57b91844aca 100644
--- a/storage/innobase/include/trx0trx.h
+++ b/storage/innobase/include/trx0trx.h
@@ -1009,6 +1009,19 @@ struct trx_t{
/*------------------------------*/
char detailed_error[256]; /*!< detailed error message for last
error, or empty. */
+ /* Lock wait statistics */
+ ulint n_rec_lock_waits;
+ /*!< Number of record lock waits,
+ might not be exactly correct. */
+ ulint n_table_lock_waits;
+ /*!< Number of table lock waits,
+ might not be exactly correct. */
+ ulint total_rec_lock_wait_time;
+ /*!< Total rec lock wait time up
+ to this moment. */
+ ulint total_table_lock_wait_time;
+ /*!< Total table lock wait time
+ up to this moment. */
};
/* Transaction isolation levels (trx->isolation_level) */
diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i
index 9e3a9eda60c..76c0d21fab8 100644
--- a/storage/innobase/include/univ.i
+++ b/storage/innobase/include/univ.i
@@ -45,7 +45,7 @@ Created 1/20/1994 Heikki Tuuri
#define INNODB_VERSION_MAJOR 5
#define INNODB_VERSION_MINOR 6
-#define INNODB_VERSION_BUGFIX 22
+#define INNODB_VERSION_BUGFIX 25
/* The following is the InnoDB version as shown in
SELECT plugin_version FROM information_schema.plugins;
diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc
index 5ea187bdb3c..7755d6d5ef1 100644
--- a/storage/innobase/lock/lock0lock.cc
+++ b/storage/innobase/lock/lock0lock.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
-Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2014, 2015, MariaDB Corporation
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
@@ -374,7 +375,7 @@ struct lock_stack_t {
ulint heap_no; /*!< heap number if rec lock */
};
-extern "C" void thd_report_wait_for(const MYSQL_THD thd, MYSQL_THD other_thd);
+extern "C" void thd_report_wait_for(MYSQL_THD thd, MYSQL_THD other_thd);
extern "C" int thd_need_wait_for(const MYSQL_THD thd);
extern "C"
int thd_need_ordering_with(const MYSQL_THD thd, const MYSQL_THD other_thd);
@@ -384,8 +385,10 @@ because there is no parallel deadlock check. This stack is protected by
the lock_sys_t::mutex. */
static lock_stack_t* lock_stack;
+#ifdef UNIV_DEBUG
/** The count of the types of locks. */
static const ulint lock_types = UT_ARR_SIZE(lock_compatibility_matrix);
+#endif /* UNIV_DEBUG */
#ifdef UNIV_PFS_MUTEX
/* Key to register mutex with performance schema */
@@ -1886,6 +1889,9 @@ lock_rec_create(
/* Set the bit corresponding to rec */
lock_rec_set_nth_bit(lock, heap_no);
+ lock->requested_time = ut_time();
+ lock->wait_time = 0;
+
index->table->n_rec_locks++;
ut_ad(index->table->n_ref_count > 0 || !index->table->can_be_evicted);
@@ -2034,6 +2040,8 @@ lock_rec_enqueue_waiting(
MONITOR_INC(MONITOR_LOCKREC_WAIT);
+ trx->n_rec_lock_waits++;
+
return(DB_LOCK_WAIT);
}
@@ -2066,7 +2074,8 @@ lock_rec_add_to_queue(
ut_ad(lock_mutex_own());
ut_ad(caller_owns_trx_mutex == trx_mutex_own(trx));
- ut_ad(dict_index_is_clust(index) || !dict_index_is_online_ddl(index));
+ ut_ad(dict_index_is_clust(index)
+ || dict_index_get_online_status(index) != ONLINE_INDEX_CREATION);
#ifdef UNIV_DEBUG
switch (type_mode & LOCK_MODE_MASK) {
case LOCK_X:
@@ -2453,6 +2462,17 @@ lock_grant(
}
}
+ /* Cumulate total lock wait time for statistics */
+ if (lock_get_type_low(lock) & LOCK_TABLE) {
+ lock->trx->total_table_lock_wait_time +=
+ (ulint)difftime(ut_time(), lock->trx->lock.wait_started);
+ } else {
+ lock->trx->total_rec_lock_wait_time +=
+ (ulint)difftime(ut_time(), lock->trx->lock.wait_started);
+ }
+
+ lock->wait_time = (ulint)difftime(ut_time(), lock->requested_time);
+
trx_mutex_exit(lock->trx);
}
@@ -4214,6 +4234,8 @@ lock_table_create(
lock->type_mode = type_mode | LOCK_TABLE;
lock->trx = trx;
+ lock->requested_time = ut_time();
+ lock->wait_time = 0;
lock->un_member.tab_lock.table = table;
@@ -4457,6 +4479,7 @@ lock_table_enqueue_waiting(
trx->lock.wait_started = ut_time();
trx->lock.was_chosen_as_deadlock_victim = FALSE;
+ trx->n_table_lock_waits++;
ut_a(que_thr_stop(thr));
@@ -5132,6 +5155,10 @@ lock_table_print(
fputs(" waiting", file);
}
+ fprintf(file, " lock hold time %lu wait time before grant %lu ",
+ (ulint)difftime(ut_time(), lock->requested_time),
+ lock->wait_time);
+
putc('\n', file);
}
@@ -5163,7 +5190,14 @@ lock_rec_print(
fprintf(file, "RECORD LOCKS space id %lu page no %lu n bits %lu ",
(ulong) space, (ulong) page_no,
(ulong) lock_rec_get_n_bits(lock));
+
dict_index_name_print(file, lock->trx, lock->index);
+
+ /* Print number of table locks */
+ fprintf(file, " trx table locks %lu total table locks %lu ",
+ ib_vector_size(lock->trx->lock.table_locks),
+ UT_LIST_GET_LEN(lock->index->table->locks));
+
fprintf(file, " trx id " TRX_ID_FMT, lock->trx->id);
if (lock_get_mode(lock) == LOCK_S) {
@@ -5192,6 +5226,10 @@ lock_rec_print(
mtr_start(&mtr);
+ fprintf(file, " lock hold time %lu wait time before grant %lu ",
+ (ulint)difftime(ut_time(), lock->requested_time),
+ lock->wait_time);
+
putc('\n', file);
block = buf_page_try_get(space, page_no, &mtr);
@@ -5450,6 +5488,14 @@ loop:
trx->read_view->up_limit_id);
}
+ /* Total trx lock waits and times */
+ fprintf(file, "Trx #rec lock waits %lu #table lock waits %lu\n",
+ trx->n_rec_lock_waits, trx->n_table_lock_waits);
+ fprintf(file, "Trx total rec lock wait time %lu SEC\n",
+ trx->total_rec_lock_wait_time);
+ fprintf(file, "Trx total table lock wait time %lu SEC\n",
+ trx->total_table_lock_wait_time);
+
if (trx->lock.que_state == TRX_QUE_LOCK_WAIT) {
fprintf(file,
diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc
index d0f17a43cf3..d65baa316d8 100644
--- a/storage/innobase/log/log0log.cc
+++ b/storage/innobase/log/log0log.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2014, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Google Inc.
Copyright (c) 2013, SkySQL Ab. All Rights Reserved.
@@ -49,7 +49,7 @@ Created 12/9/1995 Heikki Tuuri
#include "srv0start.h"
#include "trx0sys.h"
#include "trx0trx.h"
-#include "ha_prototypes.h"
+#include "trx0roll.h"
#include "srv0mon.h"
/*
@@ -3213,6 +3213,12 @@ logs_empty_and_mark_files_at_shutdown(void)
ib_logf(IB_LOG_LEVEL_INFO, "Starting shutdown...");
+ while (srv_fast_shutdown == 0 && trx_rollback_or_clean_is_active) {
+ /* we should wait until rollback after recovery end
+ for slow shutdown */
+ os_thread_sleep(100000);
+ }
+
/* Wait until the master thread and all other operations are idle: our
algorithm only works if the server is idle at shutdown */
diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc
index 0143ecf1c1e..3632c45d603 100644
--- a/storage/innobase/log/log0recv.cc
+++ b/storage/innobase/log/log0recv.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1997, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1997, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
Copyright (c) 2013, SkySQL Ab. All Rights Reserved.
@@ -1863,7 +1863,7 @@ loop:
goto loop;
}
- ut_ad(!allow_ibuf == mutex_own(&log_sys->mutex));
+ ut_ad((!allow_ibuf) == mutex_own(&log_sys->mutex));
if (!allow_ibuf) {
recv_no_ibuf_operations = TRUE;
@@ -3487,6 +3487,7 @@ recv_recovery_rollback_active(void)
/* Rollback the uncommitted transactions which have no user
session */
+ trx_rollback_or_clean_is_active = true;
os_thread_create(trx_rollback_or_clean_all_recovered, 0, 0);
}
}
diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc
index 4c1529ac835..525b537ddd7 100644
--- a/storage/innobase/os/os0file.cc
+++ b/storage/innobase/os/os0file.cc
@@ -1,6 +1,6 @@
/***********************************************************************
-Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2013, 2015, MariaDB Corporation.
@@ -800,7 +800,7 @@ os_file_handle_error_cond_exit(
os_has_said_disk_full = TRUE;
fflush(stderr);
-
+ ut_error;
return(FALSE);
case OS_FILE_AIO_RESOURCES_RESERVED:
@@ -2937,13 +2937,18 @@ try_again:
if (fil_page_is_compressed((byte *)buf)) {
fil_decompress_page(NULL, (byte *)buf, n, NULL);
}
-
return(TRUE);
+ } else if (ret == -1) {
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Error in system call pread(). The operating"
+ " system error number is %lu.",(ulint) errno);
+ } else {
+ /* Partial read occured */
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Tried to read " ULINTPF " bytes at offset "
+ UINT64PF ". Was only able to read %ld.",
+ n, offset, (lint) ret);
}
-
- ib_logf(IB_LOG_LEVEL_ERROR,
- "Tried to read " ULINTPF " bytes at offset " UINT64PF ". "
- "Was only able to read %ld.", n, offset, (lint) ret);
#endif /* __WIN__ */
#ifdef __WIN__
error_handling:
@@ -3081,8 +3086,17 @@ try_again:
if (fil_page_is_compressed((byte *)buf)) {
fil_decompress_page(NULL, (byte *)buf, n, NULL);
}
-
return(TRUE);
+ } else if (ret == -1) {
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Error in system call pread(). The operating"
+ " system error number is %lu.",(ulint) errno);
+ } else {
+ /* Partial read occured */
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Tried to read " ULINTPF " bytes at offset "
+ UINT64PF ". Was only able to read %ld.",
+ n, offset, (lint) ret);
}
#endif /* __WIN__ */
#ifdef __WIN__
@@ -3302,18 +3316,26 @@ retry:
if (!os_has_said_disk_full) {
ut_print_timestamp(stderr);
- fprintf(stderr,
- " InnoDB: Error: Write to file %s failed"
- " at offset " UINT64PF ".\n"
- "InnoDB: %lu bytes should have been written,"
- " only %ld were written.\n"
- "InnoDB: Operating system error number %lu.\n"
- "InnoDB: Check that your OS and file system"
- " support files of this size.\n"
- "InnoDB: Check also that the disk is not full"
- " or a disk quota exceeded.\n",
- name, offset, n, (lint) ret,
- (ulint) errno);
+ if(ret == -1) {
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Failure of system call pwrite(). Operating"
+ " system error number is %lu.",
+ (ulint) errno);
+ } else {
+ fprintf(stderr,
+ " InnoDB: Error: Write to file %s failed"
+ " at offset " UINT64PF ".\n"
+ "InnoDB: %lu bytes should have been written,"
+ " only %ld were written.\n"
+ "InnoDB: Operating system error number %lu.\n"
+ "InnoDB: Check that your OS and file system"
+ " support files of this size.\n"
+ "InnoDB: Check also that the disk is not full"
+ " or a disk quota exceeded.\n",
+ name, offset, n, (lint) ret,
+ (ulint) errno);
+ }
+
if (strerror(errno) != NULL) {
fprintf(stderr,
"InnoDB: Error number %d means '%s'.\n",
@@ -3500,8 +3522,9 @@ os_file_get_status(
stat_info->type = OS_FILE_TYPE_LINK;
break;
case S_IFBLK:
- stat_info->type = OS_FILE_TYPE_BLOCK;
- break;
+ /* Handle block device as regular file. */
+ case S_IFCHR:
+ /* Handle character device as regular file. */
case S_IFREG:
stat_info->type = OS_FILE_TYPE_FILE;
break;
@@ -3510,8 +3533,8 @@ os_file_get_status(
}
- if (check_rw_perm && (stat_info->type == OS_FILE_TYPE_FILE
- || stat_info->type == OS_FILE_TYPE_BLOCK)) {
+ if (check_rw_perm && stat_info->type == OS_FILE_TYPE_FILE) {
+
int fh;
int access;
@@ -4977,7 +5000,7 @@ os_aio_func(
mode = mode & (~OS_AIO_SIMULATED_WAKE_LATER);
DBUG_EXECUTE_IF("ib_os_aio_func_io_failure_28",
- mode = OS_AIO_SYNC;);
+ mode = OS_AIO_SYNC; os_has_said_disk_full = FALSE;);
if (mode == OS_AIO_SYNC
#ifdef WIN_ASYNC_IO
@@ -5011,6 +5034,10 @@ os_aio_func(
DBUG_EXECUTE_IF("ib_os_aio_func_io_failure_28",
os_has_said_disk_full = FALSE; ret = 0; errno = 28;);
+
+ if (!ret) {
+ os_file_handle_error_cond_exit(name, "os_file_write_func", TRUE, FALSE, __FILE__, __LINE__);
+ }
}
return ret;
}
@@ -5906,18 +5933,20 @@ consecutive_loop:
ret = os_file_write(
aio_slot->name, aio_slot->file, combined_buf,
aio_slot->offset, total_len);
- } else {
- ret = os_file_read(
- aio_slot->file, combined_buf,
- aio_slot->offset, total_len,
- aio_slot->page_compression);
- }
- if (aio_slot->type == OS_FILE_WRITE) {
DBUG_EXECUTE_IF("ib_os_aio_func_io_failure_28",
os_has_said_disk_full = FALSE;
ret = 0;
errno = 28;);
+
+ if (!ret) {
+ os_file_handle_error_cond_exit(aio_slot->name, "os_file_write_func", TRUE, FALSE, __FILE__, __LINE__);
+ }
+
+ } else {
+ ret = os_file_read(
+ aio_slot->file, combined_buf,
+ aio_slot->offset, total_len, aio_slot->page_compression);
}
srv_set_io_thread_op_info(global_segment, "file i/o done");
diff --git a/storage/innobase/os/os0sync.cc b/storage/innobase/os/os0sync.cc
index 451ba5285e3..03c53848832 100644
--- a/storage/innobase/os/os0sync.cc
+++ b/storage/innobase/os/os0sync.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2011, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2015, 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
@@ -234,24 +234,6 @@ os_cond_broadcast(
}
/*********************************************************//**
-Wakes one thread waiting for condition variable */
-UNIV_INLINE
-void
-os_cond_signal(
-/*==========*/
- os_cond_t* cond) /*!< in: condition variable. */
-{
- ut_a(cond);
-
-#ifdef __WIN__
- ut_a(wake_condition_variable != NULL);
- wake_condition_variable(cond);
-#else
- ut_a(pthread_cond_signal(cond) == 0);
-#endif
-}
-
-/*********************************************************//**
Destroys condition variable */
UNIV_INLINE
void
diff --git a/storage/innobase/page/page0page.cc b/storage/innobase/page/page0page.cc
index bd5fb36af8f..cb2381df48c 100644
--- a/storage/innobase/page/page0page.cc
+++ b/storage/innobase/page/page0page.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1994, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1994, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
This program is free software; you can redistribute it and/or modify it under
@@ -2811,3 +2811,45 @@ page_find_rec_max_not_deleted(
}
return(prev_rec);
}
+
+/** Issue a warning when the checksum that is stored in the page is valid,
+but different than the global setting innodb_checksum_algorithm.
+@param[in] current_algo current checksum algorithm
+@param[in] page_checksum page valid checksum
+@param[in] space_id tablespace id
+@param[in] page_no page number */
+void
+page_warn_strict_checksum(
+ srv_checksum_algorithm_t curr_algo,
+ srv_checksum_algorithm_t page_checksum,
+ ulint space_id,
+ ulint page_no)
+{
+ srv_checksum_algorithm_t curr_algo_nonstrict;
+ switch (curr_algo) {
+ case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
+ curr_algo_nonstrict = SRV_CHECKSUM_ALGORITHM_CRC32;
+ break;
+ case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
+ curr_algo_nonstrict = SRV_CHECKSUM_ALGORITHM_INNODB;
+ break;
+ case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
+ curr_algo_nonstrict = SRV_CHECKSUM_ALGORITHM_NONE;
+ break;
+ default:
+ ut_error;
+ }
+
+ ib_logf(IB_LOG_LEVEL_WARN,
+ "innodb_checksum_algorithm is set to \"%s\""
+ " but the page [page id: space=" ULINTPF ","
+ " page number=" ULINTPF "] contains a valid checksum \"%s\"."
+ " Accepting the page as valid. Change innodb_checksum_algorithm"
+ " to \"%s\" to silently accept such pages or rewrite all pages"
+ " so that they contain \"%s\" checksum.",
+ buf_checksum_algorithm_name(curr_algo),
+ space_id, page_no,
+ buf_checksum_algorithm_name(page_checksum),
+ buf_checksum_algorithm_name(curr_algo_nonstrict),
+ buf_checksum_algorithm_name(curr_algo_nonstrict));
+}
diff --git a/storage/innobase/page/page0zip.cc b/storage/innobase/page/page0zip.cc
index 677a2ba4f70..68a8bb1532f 100644
--- a/storage/innobase/page/page0zip.cc
+++ b/storage/innobase/page/page0zip.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2005, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2005, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
This program is free software; you can redistribute it and/or modify it under
@@ -47,6 +47,8 @@ using namespace std;
#include "btr0cur.h"
#include "page0types.h"
#include "log0recv.h"
+#else
+#define page_warn_strict_checksum(A,B,C,D)
#endif /* !UNIV_INNOCHECKSUM */
#include "zlib.h"
#ifndef UNIV_HOTBACKUP
@@ -1608,7 +1610,7 @@ page_zip_fields_free(
{
if (index) {
dict_table_t* table = index->table;
- os_fast_mutex_free(&index->zip_pad.mutex);
+ dict_index_zip_pad_mutex_destroy(index);
mem_heap_free(index->heap);
dict_mem_table_free(table);
@@ -4926,6 +4928,10 @@ page_zip_verify_checksum(
stored = static_cast<ib_uint32_t>(mach_read_from_4(
static_cast<const unsigned char*>(data) + FIL_PAGE_SPACE_OR_CHKSUM));
+ ulint page_no = mach_read_from_4(static_cast<const unsigned char*> (data) + FIL_PAGE_OFFSET);
+ ulint space_id = mach_read_from_4(static_cast<const unsigned char*>
+ (data) + FIL_PAGE_SPACE_ID);
+
#if FIL_PAGE_LSN % 8
#error "FIL_PAGE_LSN must be 64 bit aligned"
#endif
@@ -4951,40 +4957,113 @@ page_zip_verify_checksum(
}
#endif
+ const srv_checksum_algorithm_t curr_algo =
+ static_cast<srv_checksum_algorithm_t>(srv_checksum_algorithm);
+
+ if (curr_algo == SRV_CHECKSUM_ALGORITHM_NONE) {
+ return(TRUE);
+ }
+
calc = static_cast<ib_uint32_t>(page_zip_calc_checksum(
- data, size, static_cast<srv_checksum_algorithm_t>(
- srv_checksum_algorithm)));
+ data, size, curr_algo));
if (stored == calc) {
return(TRUE);
}
- switch ((srv_checksum_algorithm_t) srv_checksum_algorithm) {
+ switch (curr_algo) {
case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
- case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
- case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
- return(stored == calc);
case SRV_CHECKSUM_ALGORITHM_CRC32:
+
if (stored == BUF_NO_CHECKSUM_MAGIC) {
+ if (curr_algo
+ == SRV_CHECKSUM_ALGORITHM_STRICT_CRC32) {
+ page_warn_strict_checksum(
+ curr_algo,
+ SRV_CHECKSUM_ALGORITHM_NONE,
+ space_id, page_no);
+ }
+
return(TRUE);
}
- crc32 = calc;
+
innodb = static_cast<ib_uint32_t>(page_zip_calc_checksum(
data, size, SRV_CHECKSUM_ALGORITHM_INNODB));
+
+ if (stored == innodb) {
+ if (curr_algo
+ == SRV_CHECKSUM_ALGORITHM_STRICT_CRC32) {
+ page_warn_strict_checksum(
+ curr_algo,
+ SRV_CHECKSUM_ALGORITHM_INNODB,
+ space_id, page_no);
+ }
+
+ return(TRUE);
+ }
+
break;
+ case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
case SRV_CHECKSUM_ALGORITHM_INNODB:
+
if (stored == BUF_NO_CHECKSUM_MAGIC) {
+ if (curr_algo
+ == SRV_CHECKSUM_ALGORITHM_STRICT_INNODB) {
+ page_warn_strict_checksum(
+ curr_algo,
+ SRV_CHECKSUM_ALGORITHM_NONE,
+ space_id, page_no);
+ }
+
+ return(TRUE);
+ }
+
+ crc32 = static_cast<ib_uint32_t>(page_zip_calc_checksum(
+ data, size, SRV_CHECKSUM_ALGORITHM_CRC32));
+
+ if (stored == crc32) {
+ if (curr_algo
+ == SRV_CHECKSUM_ALGORITHM_STRICT_INNODB) {
+ page_warn_strict_checksum(
+ curr_algo,
+ SRV_CHECKSUM_ALGORITHM_CRC32,
+ space_id, page_no);
+ }
+
return(TRUE);
}
+
+ break;
+ case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
+
crc32 = static_cast<ib_uint32_t>(page_zip_calc_checksum(
data, size, SRV_CHECKSUM_ALGORITHM_CRC32));
- innodb = calc;
+
+ if (stored == crc32) {
+ page_warn_strict_checksum(
+ curr_algo, SRV_CHECKSUM_ALGORITHM_CRC32,
+ space_id, page_no);
+
+ return(TRUE);
+ }
+
+ innodb = static_cast<ib_uint32_t>(page_zip_calc_checksum(
+ data, size, SRV_CHECKSUM_ALGORITHM_INNODB));
+
+ if (stored == innodb) {
+ page_warn_strict_checksum(
+ curr_algo,
+ SRV_CHECKSUM_ALGORITHM_INNODB,
+ space_id, page_no);
+ return(TRUE);
+ }
+
break;
case SRV_CHECKSUM_ALGORITHM_NONE:
- return(TRUE);
+ ut_error;
/* no default so the compiler will emit a warning if new enum
is added and not handled here */
}
- return(stored == crc32 || stored == innodb);
+ return(FALSE);
}
diff --git a/storage/innobase/que/que0que.cc b/storage/innobase/que/que0que.cc
index fb185959d56..957a90e71b3 100644
--- a/storage/innobase/que/que0que.cc
+++ b/storage/innobase/que/que0que.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1996, 2015, 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
@@ -380,32 +380,6 @@ que_fork_start_command(
return(thr);
}
-/****************************************************************//**
-Tests if all the query threads in the same fork have a given state.
-@return TRUE if all the query threads in the same fork were in the
-given state */
-UNIV_INLINE
-ibool
-que_fork_all_thrs_in_state(
-/*=======================*/
- que_fork_t* fork, /*!< in: query fork */
- ulint state) /*!< in: state */
-{
- que_thr_t* thr_node;
-
- for (thr_node = UT_LIST_GET_FIRST(fork->thrs);
- thr_node != NULL;
- thr_node = UT_LIST_GET_NEXT(thrs, thr_node)) {
-
- if (thr_node->state != state) {
-
- return(FALSE);
- }
- }
-
- return(TRUE);
-}
-
/**********************************************************************//**
Calls que_graph_free_recursive for statements in a statement list. */
static
diff --git a/storage/innobase/row/row0ftsort.cc b/storage/innobase/row/row0ftsort.cc
index b11a9f0d85a..621a14d27c2 100644
--- a/storage/innobase/row/row0ftsort.cc
+++ b/storage/innobase/row/row0ftsort.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2010, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2010, 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
diff --git a/storage/innobase/row/row0log.cc b/storage/innobase/row/row0log.cc
index 3c5beb86bc2..018bf44fb8d 100644
--- a/storage/innobase/row/row0log.cc
+++ b/storage/innobase/row/row0log.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2011, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2011, 2015, 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
@@ -1381,6 +1381,27 @@ blob_done:
dfield_set_data(dfield, data, len);
}
+ if (len != UNIV_SQL_NULL && col->mtype == DATA_MYSQL
+ && col->len != len && !dict_table_is_comp(log->table)) {
+
+ ut_ad(col->len >= len);
+ if (dict_table_is_comp(index->table)) {
+ byte* buf = (byte*) mem_heap_alloc(heap,
+ col->len);
+ memcpy(buf, dfield->data, len);
+ memset(buf + len, 0x20, col->len - len);
+
+ dfield_set_data(dfield, buf, col->len);
+ } else {
+ /* field length mismatch should not happen
+ when rebuilding the redundant row format
+ table. */
+ ut_ad(0);
+ *error = DB_CORRUPTION;
+ return(NULL);
+ }
+ }
+
/* See if any columns were changed to NULL or NOT NULL. */
const dict_col_t* new_col
= dict_table_get_nth_col(log->table, col_no);
diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc
index cb219e29d6e..7ebcdefdc3a 100644
--- a/storage/innobase/row/row0merge.cc
+++ b/storage/innobase/row/row0merge.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2005, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2005, 2015, 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
@@ -235,22 +235,86 @@ row_merge_buf_free(
mem_heap_free(buf->heap);
}
-/******************************************************//**
-Insert a data tuple into a sort buffer.
-@return number of rows added, 0 if out of space */
+/** Convert the field data from compact to redundant format.
+@param[in] row_field field to copy from
+@param[out] field field to copy to
+@param[in] len length of the field data
+@param[in] zip_size compressed BLOB page size,
+ zero for uncompressed BLOBs
+@param[in,out] heap memory heap where to allocate data when
+ converting to ROW_FORMAT=REDUNDANT, or NULL
+ when not to invoke
+ row_merge_buf_redundant_convert(). */
+static
+void
+row_merge_buf_redundant_convert(
+ const dfield_t* row_field,
+ dfield_t* field,
+ ulint len,
+ ulint zip_size,
+ mem_heap_t* heap)
+{
+ ut_ad(DATA_MBMINLEN(field->type.mbminmaxlen) == 1);
+ ut_ad(DATA_MBMAXLEN(field->type.mbminmaxlen) > 1);
+
+ byte* buf = (byte*) mem_heap_alloc(heap, len);
+ ulint field_len = row_field->len;
+ ut_ad(field_len <= len);
+
+ if (row_field->ext) {
+ const byte* field_data = static_cast<byte*>(
+ dfield_get_data(row_field));
+ ulint ext_len;
+
+ ut_a(field_len >= BTR_EXTERN_FIELD_REF_SIZE);
+ ut_a(memcmp(field_data + field_len - BTR_EXTERN_FIELD_REF_SIZE,
+ field_ref_zero, BTR_EXTERN_FIELD_REF_SIZE));
+
+ byte* data = btr_copy_externally_stored_field(
+ &ext_len, field_data, zip_size, field_len, heap, NULL);
+
+ ut_ad(ext_len < len);
+
+ memcpy(buf, data, ext_len);
+ field_len = ext_len;
+ } else {
+ memcpy(buf, row_field->data, field_len);
+ }
+
+ memset(buf + field_len, 0x20, len - field_len);
+
+ dfield_set_data(field, buf, len);
+}
+
+/** Insert a data tuple into a sort buffer.
+@param[in,out] buf sort buffer
+@param[in] fts_index fts index to be created
+@param[in] old_table original table
+@param[in,out] psort_info parallel sort info
+@param[in] row table row
+@param[in] ext cache of externally stored
+ column prefixes, or NULL
+@param[in,out] doc_id Doc ID if we are creating
+ FTS index
+@param[in,out] conv_heap memory heap where to allocate data when
+ converting to ROW_FORMAT=REDUNDANT, or NULL
+ when not to invoke
+ row_merge_buf_redundant_convert()
+@param[in,out] exceed_page set if the record size exceeds the page size
+ when converting to ROW_FORMAT=REDUNDANT
+@return number of rows added, 0 if out of space */
static
ulint
row_merge_buf_add(
-/*==============*/
- row_merge_buf_t* buf, /*!< in/out: sort buffer */
- dict_index_t* fts_index,/*!< in: fts index to be created */
- const dict_table_t* old_table,/*!< in: original table */
- fts_psort_t* psort_info, /*!< in: parallel sort info */
- const dtuple_t* row, /*!< in: table row */
- const row_ext_t* ext, /*!< in: cache of externally stored
- column prefixes, or NULL */
- doc_id_t* doc_id) /*!< in/out: Doc ID if we are
- creating FTS index */
+ row_merge_buf_t* buf,
+ dict_index_t* fts_index,
+ const dict_table_t* old_table,
+ fts_psort_t* psort_info,
+ const dtuple_t* row,
+ const row_ext_t* ext,
+ doc_id_t* doc_id,
+ mem_heap_t* conv_heap,
+ bool* exceed_page)
{
ulint i;
const dict_index_t* index;
@@ -400,6 +464,23 @@ row_merge_buf_add(
n_row_added = 1;
continue;
}
+
+ if (field->len != UNIV_SQL_NULL
+ && col->mtype == DATA_MYSQL
+ && col->len != field->len) {
+
+ if (conv_heap != NULL) {
+ row_merge_buf_redundant_convert(
+ row_field, field, col->len,
+ dict_table_zip_size(old_table),
+ conv_heap);
+ } else {
+ /* Field length mismatch should not
+ happen when rebuilding redundant row
+ format table. */
+ ut_ad(dict_table_is_comp(index->table));
+ }
+ }
}
len = dfield_get_len(field);
@@ -508,6 +589,14 @@ row_merge_buf_add(
of extra_size. */
data_size += (extra_size + 1) + ((extra_size + 1) >= 0x80);
+ /* Record size can exceed page size while converting to
+ redundant row format. But there is assert
+ ut_ad(size < UNIV_PAGE_SIZE) in rec_offs_data_size().
+ It may hit the assert before attempting to insert the row. */
+ if (conv_heap != NULL && data_size > UNIV_PAGE_SIZE) {
+ *exceed_page = true;
+ }
+
ut_ad(data_size < srv_sort_buf_size);
/* Reserve one byte for the end marker of row_merge_block_t. */
@@ -527,6 +616,10 @@ row_merge_buf_add(
dfield_dup(field++, buf->heap);
} while (--n_fields);
+ if (conv_heap != NULL) {
+ mem_heap_empty(conv_heap);
+ }
+
DBUG_RETURN(n_row_added);
}
@@ -1209,6 +1302,7 @@ row_merge_read_clustered_index(
os_event_t fts_parallel_sort_event = NULL;
ibool fts_pll_sort = FALSE;
ib_int64_t sig_count = 0;
+ mem_heap_t* conv_heap = NULL;
DBUG_ENTER("row_merge_read_clustered_index");
ut_ad((old_table == new_table) == !col_map);
@@ -1304,6 +1398,11 @@ row_merge_read_clustered_index(
row_heap = mem_heap_create(sizeof(mrec_buf_t));
+ if (dict_table_is_comp(old_table)
+ && !dict_table_is_comp(new_table)) {
+ conv_heap = mem_heap_create(sizeof(mrec_buf_t));
+ }
+
/* Scan the clustered index. */
for (;;) {
const rec_t* rec;
@@ -1582,16 +1681,24 @@ write_buffers:
row_merge_buf_t* buf = merge_buf[i];
merge_file_t* file = &files[i];
ulint rows_added = 0;
+ bool exceed_page = false;
if (UNIV_LIKELY
(row && (rows_added = row_merge_buf_add(
buf, fts_index, old_table,
- psort_info, row, ext, &doc_id)))) {
+ psort_info, row, ext, &doc_id,
+ conv_heap, &exceed_page)))) {
/* If we are creating FTS index,
a single row can generate more
records for tokenized word */
file->n_rec += rows_added;
+
+ if (exceed_page) {
+ err = DB_TOO_BIG_RECORD;
+ break;
+ }
+
if (doc_id > max_doc_id) {
max_doc_id = doc_id;
}
@@ -1692,12 +1799,18 @@ write_buffers:
(!(rows_added = row_merge_buf_add(
buf, fts_index, old_table,
psort_info, row, ext,
- &doc_id)))) {
+ &doc_id, conv_heap,
+ &exceed_page)))) {
/* An empty buffer should have enough
room for at least one record. */
ut_error;
}
+ if (exceed_page) {
+ err = DB_TOO_BIG_RECORD;
+ break;
+ }
+
file->n_rec += rows_added;
}
}
@@ -1722,6 +1835,10 @@ func_exit:
}
all_done:
+ if (conv_heap != NULL) {
+ mem_heap_free(conv_heap);
+ }
+
#ifdef FTS_INTERNAL_DIAG_PRINT
DEBUG_FTS_SORT_PRINT("FTS_SORT: Complete Scan Table\n");
#endif
@@ -2100,6 +2217,7 @@ row_merge(
/* Copy the last blocks, if there are any. */
while (foffs0 < ihalf) {
+
if (UNIV_UNLIKELY(trx_is_interrupted(trx))) {
return(DB_INTERRUPTED);
}
@@ -2116,6 +2234,7 @@ row_merge(
ut_ad(foffs0 == ihalf);
while (foffs1 < file->offset) {
+
if (trx_is_interrupted(trx)) {
return(DB_INTERRUPTED);
}
@@ -2175,6 +2294,7 @@ row_merge_sort(
{
const ulint half = file->offset / 2;
ulint num_runs;
+ ulint cur_run = 0;
ulint* run_offset;
dberr_t error = DB_SUCCESS;
DBUG_ENTER("row_merge_sort");
@@ -2198,11 +2318,19 @@ row_merge_sort(
of file marker). Thus, it must be at least one block. */
ut_ad(file->offset > 0);
+ thd_progress_init(trx->mysql_thd, num_runs);
+
/* Merge the runs until we have one big run */
do {
+ cur_run++;
+
error = row_merge(trx, dup, file, block, tmpfd,
&num_runs, run_offset);
+ /* Report progress of merge sort to MySQL for
+ show processlist progress field */
+ thd_progress_report(trx->mysql_thd, cur_run, num_runs);
+
if (error != DB_SUCCESS) {
break;
}
@@ -2212,6 +2340,8 @@ row_merge_sort(
mem_free(run_offset);
+ thd_progress_end(trx->mysql_thd);
+
DBUG_RETURN(error);
}
@@ -3337,9 +3467,13 @@ row_merge_create_index(
for (i = 0; i < n_fields; i++) {
index_field_t* ifield = &index_def->fields[i];
+ const char * col_name = ifield->col_name ?
+ dict_table_get_col_name_for_mysql(table, ifield->col_name) :
+ dict_table_get_col_name(table, ifield->col_no);
dict_mem_index_add_field(
- index, dict_table_get_col_name(table, ifield->col_no),
+ index,
+ col_name,
ifield->prefix_len);
}
diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc
index 2717d39b4c0..6184bcddcb5 100644
--- a/storage/innobase/row/row0mysql.cc
+++ b/storage/innobase/row/row0mysql.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2000, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2000, 2015, 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
@@ -610,6 +610,7 @@ handle_new_error:
case DB_DUPLICATE_KEY:
case DB_FOREIGN_DUPLICATE_KEY:
case DB_TOO_BIG_RECORD:
+ case DB_TOO_BIG_FOR_REDO:
case DB_UNDO_RECORD_TOO_BIG:
case DB_ROW_IS_REFERENCED:
case DB_NO_REFERENCED_ROW:
@@ -1324,18 +1325,14 @@ row_insert_for_mysql(
mem_analyze_corruption(prebuilt);
ut_error;
- } else if (srv_created_new_raw || srv_force_recovery) {
- fputs("InnoDB: A new raw disk partition was initialized or\n"
- "InnoDB: innodb_force_recovery is on: we do not allow\n"
+ } else if (srv_force_recovery) {
+ fputs("InnoDB: innodb_force_recovery is on: we do not allow\n"
"InnoDB: database modifications by the user. Shut down\n"
"InnoDB: mysqld and edit my.cnf so that"
- " newraw is replaced\n"
- "InnoDB: with raw, and innodb_force_... is removed.\n",
+ "InnoDB: innodb_force_... is removed.\n",
stderr);
- if(srv_force_recovery) {
- return(DB_READ_ONLY);
- }
- return(DB_ERROR);
+
+ return(DB_READ_ONLY);
}
trx->op_info = "inserting";
@@ -1460,6 +1457,11 @@ error_exit:
with a latch. */
dict_table_n_rows_inc(table);
+ if (prebuilt->clust_index_was_generated) {
+ /* set row id to prebuilt */
+ ut_memcpy(prebuilt->row_id, node->row_id_buf, DATA_ROW_ID_LEN);
+ }
+
row_update_statistics_if_needed(table);
trx->op_info = "";
@@ -1721,18 +1723,14 @@ row_update_for_mysql(
ut_error;
}
- if (UNIV_UNLIKELY(srv_created_new_raw || srv_force_recovery)) {
- fputs("InnoDB: A new raw disk partition was initialized or\n"
- "InnoDB: innodb_force_recovery is on: we do not allow\n"
+ if (UNIV_UNLIKELY(srv_force_recovery)) {
+ fputs("InnoDB: innodb_force_recovery is on: we do not allow\n"
"InnoDB: database modifications by the user. Shut down\n"
- "InnoDB: mysqld and edit my.cnf so that newraw"
- " is replaced\n"
- "InnoDB: with raw, and innodb_force_... is removed.\n",
+ "InnoDB: mysqld and edit my.cnf so that"
+ "InnoDB: innodb_force_... is removed.\n",
stderr);
- if(srv_force_recovery) {
- return(DB_READ_ONLY);
- }
- return(DB_ERROR);
+
+ return(DB_READ_ONLY);
}
DEBUG_SYNC_C("innodb_row_update_for_mysql_begin");
@@ -2231,22 +2229,6 @@ row_create_table_for_mysql(
goto err_exit;
);
- if (srv_created_new_raw) {
- fputs("InnoDB: A new raw disk partition was initialized:\n"
- "InnoDB: we do not allow database modifications"
- " by the user.\n"
- "InnoDB: Shut down mysqld and edit my.cnf so that newraw"
- " is replaced with raw.\n", stderr);
-err_exit:
- dict_mem_table_free(table);
-
- if (commit) {
- trx_commit_for_mysql(trx);
- }
-
- return(DB_ERROR);
- }
-
trx->op_info = "creating table";
if (row_mysql_is_system_table(table->name)) {
@@ -2257,7 +2239,19 @@ err_exit:
"InnoDB: MySQL system tables must be"
" of the MyISAM type!\n",
table->name);
- goto err_exit;
+
+#ifndef DBUG_OFF
+err_exit:
+#endif /* !DBUG_OFF */
+ dict_mem_table_free(table);
+
+ if (commit) {
+ trx_commit_for_mysql(trx);
+ }
+
+ trx->op_info = "";
+
+ return(DB_ERROR);
}
trx_start_if_not_started_xa(trx);
@@ -3307,16 +3301,6 @@ row_truncate_table_for_mysql(
ut_ad(table);
- if (srv_created_new_raw) {
- fputs("InnoDB: A new raw disk partition was initialized:\n"
- "InnoDB: we do not allow database modifications"
- " by the user.\n"
- "InnoDB: Shut down mysqld and edit my.cnf so that newraw"
- " is replaced with raw.\n", stderr);
-
- return(DB_ERROR);
- }
-
if (dict_table_is_discarded(table)) {
return(DB_TABLESPACE_DELETED);
} else if (table->ibd_file_missing) {
@@ -3438,13 +3422,11 @@ row_truncate_table_for_mysql(
goto funct_exit;
}
- if (table->space && !table->dir_path_of_temp_table) {
+ if (table->space && !DICT_TF2_FLAG_IS_SET(table, DICT_TF2_TEMPORARY)) {
/* Discard and create the single-table tablespace. */
ulint space = table->space;
ulint flags = fil_space_get_flags(space);
- ut_a(!DICT_TF2_FLAG_IS_SET(table, DICT_TF2_TEMPORARY));
-
dict_get_and_save_data_dir_path(table, true);
if (flags != ULINT_UNDEFINED
@@ -3798,16 +3780,6 @@ row_drop_table_for_mysql(
ut_a(name != NULL);
- if (srv_created_new_raw) {
- fputs("InnoDB: A new raw disk partition was initialized:\n"
- "InnoDB: we do not allow database modifications"
- " by the user.\n"
- "InnoDB: Shut down mysqld and edit my.cnf so that newraw"
- " is replaced with raw.\n", stderr);
-
- DBUG_RETURN(DB_ERROR);
- }
-
/* The table name is prefixed with the database name and a '/'.
Certain table names starting with 'innodb_' have their special
meaning regardless of the database name. Thus, we need to
@@ -4244,8 +4216,9 @@ row_drop_table_for_mysql(
is_temp = DICT_TF2_FLAG_IS_SET(table, DICT_TF2_TEMPORARY);
/* If there is a temp path then the temp flag is set.
- However, during recovery, we might have a temp flag but
- not know the temp path */
+ However, during recovery or reloading the table object
+ after eviction from data dictionary cache, we might
+ have a temp flag but not know the temp path */
ut_a(table->dir_path_of_temp_table == NULL || is_temp);
if (dict_table_is_discarded(table)
|| table->ibd_file_missing) {
@@ -4373,7 +4346,7 @@ row_drop_table_for_mysql(
case DB_OUT_OF_FILE_SPACE:
err = DB_MUST_GET_MORE_FILE_SPACE;
-
+ trx->error_state = err;
row_mysql_handle_errors(&err, trx, NULL, NULL);
/* raise error */
@@ -4813,24 +4786,22 @@ row_rename_table_for_mysql(
ibool old_is_tmp, new_is_tmp;
pars_info_t* info = NULL;
int retry;
+ bool aux_fts_rename = false;
ut_a(old_name != NULL);
ut_a(new_name != NULL);
ut_ad(trx->state == TRX_STATE_ACTIVE);
- if (srv_created_new_raw || srv_force_recovery) {
- fputs("InnoDB: A new raw disk partition was initialized or\n"
- "InnoDB: innodb_force_recovery is on: we do not allow\n"
+ if (srv_force_recovery) {
+ fputs("InnoDB: innodb_force_recovery is on: we do not allow\n"
"InnoDB: database modifications by the user. Shut down\n"
- "InnoDB: mysqld and edit my.cnf so that newraw"
- " is replaced\n"
- "InnoDB: with raw, and innodb_force_... is removed.\n",
+ "InnoDB: mysqld and edit my.cnf so that"
+ "InnoDB: innodb_force_... is removed.\n",
stderr);
- if(srv_force_recovery) {
- err = DB_READ_ONLY;
- }
+ err = DB_READ_ONLY;
goto funct_exit;
+
} else if (row_mysql_is_system_table(new_name)) {
fprintf(stderr,
@@ -5099,34 +5070,8 @@ row_rename_table_for_mysql(
if (dict_table_has_fts_index(table)
&& !dict_tables_have_same_db(old_name, new_name)) {
err = fts_rename_aux_tables(table, new_name, trx);
-
- if (err != DB_SUCCESS && (table->space != 0)) {
- char* orig_name = table->name;
- trx_t* trx_bg = trx_allocate_for_background();
-
- /* If the first fts_rename fails, the trx would
- be rolled back and committed, we can't use it any more,
- so we have to start a new background trx here. */
- ut_a(trx_state_eq(trx, TRX_STATE_NOT_STARTED));
- trx_bg->op_info = "Revert the failing rename "
- "for fts aux tables";
- trx_bg->dict_operation_lock_mode = RW_X_LATCH;
- trx_start_for_ddl(trx_bg, TRX_DICT_OP_TABLE);
-
- /* If rename fails and table has its own tablespace,
- we need to call fts_rename_aux_tables again to
- revert the ibd file rename, which is not under the
- control of trx. Also notice the parent table name
- in cache is not changed yet. If the reverting fails,
- the ibd data may be left in the new database, which
- can be fixed only manually. */
- table->name = const_cast<char*>(new_name);
- fts_rename_aux_tables(table, old_name, trx_bg);
- table->name = orig_name;
-
- trx_bg->dict_operation_lock_mode = 0;
- trx_commit_for_mysql(trx_bg);
- trx_free_for_background(trx_bg);
+ if (err != DB_TABLE_NOT_FOUND) {
+ aux_fts_rename = true;
}
}
@@ -5239,6 +5184,37 @@ end:
}
funct_exit:
+ if (aux_fts_rename && err != DB_SUCCESS
+ && table != NULL && (table->space != 0)) {
+
+ char* orig_name = table->name;
+ trx_t* trx_bg = trx_allocate_for_background();
+
+ /* If the first fts_rename fails, the trx would
+ be rolled back and committed, we can't use it any more,
+ so we have to start a new background trx here. */
+ ut_a(trx_state_eq(trx_bg, TRX_STATE_NOT_STARTED));
+ trx_bg->op_info = "Revert the failing rename "
+ "for fts aux tables";
+ trx_bg->dict_operation_lock_mode = RW_X_LATCH;
+ trx_start_for_ddl(trx_bg, TRX_DICT_OP_TABLE);
+
+ /* If rename fails and table has its own tablespace,
+ we need to call fts_rename_aux_tables again to
+ revert the ibd file rename, which is not under the
+ control of trx. Also notice the parent table name
+ in cache is not changed yet. If the reverting fails,
+ the ibd data may be left in the new database, which
+ can be fixed only manually. */
+ table->name = const_cast<char*>(new_name);
+ fts_rename_aux_tables(table, old_name, trx_bg);
+ table->name = orig_name;
+
+ trx_bg->dict_operation_lock_mode = 0;
+ trx_commit_for_mysql(trx_bg);
+ trx_free_for_background(trx_bg);
+ }
+
if (table != NULL) {
dict_table_close(table, dict_locked, FALSE);
}
diff --git a/storage/innobase/row/row0quiesce.cc b/storage/innobase/row/row0quiesce.cc
index 1d67d5a9717..ecd6f47947b 100644
--- a/storage/innobase/row/row0quiesce.cc
+++ b/storage/innobase/row/row0quiesce.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2012, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2012, 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
@@ -680,7 +680,6 @@ row_quiesce_set_state(
switch (state) {
case QUIESCE_START:
- ut_a(table->quiesce == QUIESCE_NONE);
break;
case QUIESCE_COMPLETE:
diff --git a/storage/innobase/srv/srv0mon.cc b/storage/innobase/srv/srv0mon.cc
index 57409243f5e..5e15dd15db2 100644
--- a/storage/innobase/srv/srv0mon.cc
+++ b/storage/innobase/srv/srv0mon.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2010, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2010, 2014, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
Copyright (c) 2013, 2014, MariaDB Corporation
@@ -1003,7 +1003,8 @@ static monitor_info_t innodb_counter_info[] =
{"adaptive_hash_searches_btree", "adaptive_hash_index",
"Number of searches using B-tree on an index search",
- MONITOR_NONE,
+ static_cast<monitor_type_t>(
+ MONITOR_EXISTING | MONITOR_DEFAULT_ON),
MONITOR_DEFAULT_START, MONITOR_OVLD_ADAPTIVE_HASH_SEARCH_BTREE},
{"adaptive_hash_pages_added", "adaptive_hash_index",
diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc
index 4f72ab3f4f2..129b33f0da9 100644
--- a/storage/innobase/srv/srv0srv.cc
+++ b/storage/innobase/srv/srv0srv.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2014, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, 2009 Google Inc.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2013, 2014, SkySQL Ab. All Rights Reserved.
@@ -2687,7 +2687,9 @@ srv_do_purge(
*n_total_purged += n_pages_purged;
- } while (!srv_purge_should_exit(n_pages_purged) && n_pages_purged > 0);
+ } while (!srv_purge_should_exit(n_pages_purged)
+ && n_pages_purged > 0
+ && purge_sys->state == PURGE_STATE_RUN);
return(rseg_history_len);
}
diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc
index cdf08b4cde1..f2de5e954ad 100644
--- a/storage/innobase/srv/srv0start.cc
+++ b/storage/innobase/srv/srv0start.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
+Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2008, Google Inc.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2013, 2014, SkySQL Ab. All Rights Reserved.
@@ -138,7 +138,7 @@ static os_thread_id_t thread_ids[SRV_MAX_N_IO_THREADS + 6 + 32 + MTFLUSH_MAX_WOR
void *mtflush_ctx=NULL;
/** Thead handles */
-static os_thread_t thread_handles[SRV_MAX_N_IO_THREADS + 6 + 32];
+static os_thread_t thread_handles[SRV_MAX_N_IO_THREADS + 6 + 32 + MTFLUSH_MAX_WORKER];
static os_thread_t buf_flush_page_cleaner_thread_handle;
static os_thread_t buf_dump_thread_handle;
static os_thread_t dict_stats_thread_handle;
@@ -239,8 +239,8 @@ srv_file_check_mode(
/* Note: stat.rw_perm is only valid of files */
- if (stat.type == OS_FILE_TYPE_FILE
- || stat.type == OS_FILE_TYPE_BLOCK) {
+ if (stat.type == OS_FILE_TYPE_FILE) {
+
if (!stat.rw_perm) {
ib_logf(IB_LOG_LEVEL_ERROR,
@@ -437,14 +437,16 @@ srv_parse_data_file_paths_and_sizes(
&& *(str + 1) == 'e'
&& *(str + 2) == 'w') {
str += 3;
+ /* Initialize new raw device only during bootstrap */
(srv_data_file_is_raw_partition)[i] = SRV_NEW_RAW;
}
if (*str == 'r' && *(str + 1) == 'a' && *(str + 2) == 'w') {
str += 3;
+ /* Initialize new raw device only during bootstrap */
if ((srv_data_file_is_raw_partition)[i] == 0) {
- (srv_data_file_is_raw_partition)[i] = SRV_OLD_RAW;
+ (srv_data_file_is_raw_partition)[i] = SRV_NEW_RAW;
}
}
@@ -897,6 +899,24 @@ open_or_create_data_files(
return(DB_ERROR);
}
+
+ const char* check_msg;
+ check_msg = fil_read_first_page(
+ files[i], FALSE, &flags, &space,
+#ifdef UNIV_LOG_ARCHIVE
+ min_arch_log_no, max_arch_log_no,
+#endif /* UNIV_LOG_ARCHIVE */
+ min_flushed_lsn, max_flushed_lsn, ULINT_UNDEFINED);
+
+ /* If first page is valid, don't overwrite DB.
+ It prevents overwriting DB when mysql_install_db
+ starts mysqld multiple times during bootstrap. */
+ if (check_msg == NULL) {
+
+ srv_created_new_raw = FALSE;
+ ret = FALSE;
+ }
+
} else if (srv_data_file_is_raw_partition[i] == SRV_OLD_RAW) {
srv_start_raw_disk_in_use = TRUE;
@@ -3121,9 +3141,9 @@ innobase_shutdown_for_mysql(void)
ibuf_close();
log_shutdown();
- lock_sys_close();
trx_sys_file_format_close();
trx_sys_close();
+ lock_sys_close();
/* We don't create these mutexes in RO mode because we don't create
the temp files that the cover. */
diff --git a/storage/innobase/sync/sync0arr.cc b/storage/innobase/sync/sync0arr.cc
index 10c201e990e..c7163695a3f 100644
--- a/storage/innobase/sync/sync0arr.cc
+++ b/storage/innobase/sync/sync0arr.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@@ -1101,8 +1101,8 @@ sync_array_print_info_low(
os_thread_id_t r = 0;
fprintf(file,
- "OS WAIT ARRAY INFO: reservation count %ld\n",
- (long) arr->res_count);
+ "OS WAIT ARRAY INFO: reservation count " ULINTPF "\n",
+ arr->res_count);
for (i = 0; count < arr->n_reserved; ++i) {
sync_cell_t* cell;
@@ -1197,7 +1197,7 @@ sync_array_print(
}
fprintf(file,
- "OS WAIT ARRAY INFO: signal count %ld\n", (long) sg_count);
+ "OS WAIT ARRAY INFO: signal count " ULINTPF "\n", sg_count);
}
diff --git a/storage/innobase/sync/sync0rw.cc b/storage/innobase/sync/sync0rw.cc
index 4ff330791a0..e77c7a9b396 100644
--- a/storage/innobase/sync/sync0rw.cc
+++ b/storage/innobase/sync/sync0rw.cc
@@ -545,6 +545,8 @@ rw_lock_x_lock_low(
const char* file_name,/*!< in: file name where lock requested */
ulint line) /*!< in: line where requested */
{
+ ibool local_recursive= lock->recursive;
+
if (rw_lock_lock_word_decr(lock, X_LOCK_DECR)) {
/* lock->recursive also tells us if the writer_thread
@@ -566,12 +568,12 @@ rw_lock_x_lock_low(
} else {
os_thread_id_t thread_id = os_thread_get_curr_id();
- if (!pass) {
- os_rmb;
- }
-
- /* Decrement failed: relock or failed lock */
- if (!pass && lock->recursive
+ /* Decrement failed: relock or failed lock
+ Note: recursive must be loaded before writer_thread see
+ comment for rw_lock_set_writer_id_and_recursion_flag().
+ To achieve this we load it before rw_lock_lock_word_decr(),
+ which implies full memory barrier in current implementation. */
+ if (!pass && local_recursive
&& os_thread_eq(lock->writer_thread, thread_id)) {
/* Relock */
if (lock->lock_word == 0) {
diff --git a/storage/innobase/sync/sync0sync.cc b/storage/innobase/sync/sync0sync.cc
index fb559f26bd4..e0f132574c9 100644
--- a/storage/innobase/sync/sync0sync.cc
+++ b/storage/innobase/sync/sync0sync.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@@ -47,6 +47,8 @@ Created 9/5/1995 Heikki Tuuri
#include "ha_prototypes.h"
#include "my_cpu.h"
+#include <vector>
+
/*
REASONS FOR IMPLEMENTING THE SPIN LOCK MUTEX
============================================
@@ -224,14 +226,8 @@ UNIV_INTERN ibool sync_order_checks_on = FALSE;
static const ulint SYNC_THREAD_N_LEVELS = 10000;
/** Array for tracking sync levels per thread. */
-struct sync_arr_t {
- ulint in_use; /*!< Number of active cells */
- ulint n_elems; /*!< Number of elements in the array */
- ulint max_elems; /*!< Maximum elements */
- ulint next_free; /*!< ULINT_UNDEFINED or index of next
- free slot */
- sync_level_t* elems; /*!< Array elements */
-};
+typedef std::vector<sync_level_t> sync_arr_t;
+
/** Mutexes or rw-locks held by a thread */
struct sync_thread_t{
@@ -299,9 +295,9 @@ mutex_create_func(
/* NOTE! The very first mutexes are not put to the mutex list */
- if ((mutex == &mutex_list_mutex)
+ if (mutex == &mutex_list_mutex
#ifdef UNIV_SYNC_DEBUG
- || (mutex == &sync_thread_mutex)
+ || mutex == &sync_thread_mutex
#endif /* UNIV_SYNC_DEBUG */
) {
@@ -844,10 +840,10 @@ sync_thread_levels_g(
{
ulint i;
- for (i = 0; i < arr->n_elems; i++) {
+ for (i = 0; i < arr->size(); i++) {
const sync_level_t* slot;
- slot = &arr->elems[i];
+ slot = (const sync_level_t*)&(arr->at(i));
if (slot->latch != NULL && slot->level <= limit) {
if (warn) {
@@ -879,10 +875,10 @@ sync_thread_levels_contain(
{
ulint i;
- for (i = 0; i < arr->n_elems; i++) {
+ for (i = 0; i < arr->size(); i++) {
const sync_level_t* slot;
- slot = &arr->elems[i];
+ slot = (const sync_level_t*)&(arr->at(i));
if (slot->latch != NULL && slot->level == level) {
@@ -926,10 +922,10 @@ sync_thread_levels_contains(
arr = thread_slot->levels;
- for (i = 0; i < arr->n_elems; i++) {
+ for (i = 0; i < arr->size(); i++) {
sync_level_t* slot;
- slot = &arr->elems[i];
+ slot = (sync_level_t*)&(arr->at(i));
if (slot->latch != NULL && slot->level == level) {
@@ -975,10 +971,10 @@ sync_thread_levels_nonempty_gen(
arr = thread_slot->levels;
- for (i = 0; i < arr->n_elems; ++i) {
+ for (i = 0; i < arr->size(); ++i) {
const sync_level_t* slot;
- slot = &arr->elems[i];
+ slot = (const sync_level_t*)&(arr->at(i));
if (slot->latch != NULL
&& (!dict_mutex_allowed
@@ -1035,10 +1031,10 @@ sync_thread_levels_nonempty_trx(
arr = thread_slot->levels;
- for (i = 0; i < arr->n_elems; ++i) {
+ for (i = 0; i < arr->size(); ++i) {
const sync_level_t* slot;
- slot = &arr->elems[i];
+ slot = (const sync_level_t*)&(arr->at(i));
if (slot->latch != NULL
&& (!has_search_latch
@@ -1069,10 +1065,9 @@ sync_thread_add_level(
SYNC_LEVEL_VARYING, nothing is done */
ibool relock) /*!< in: TRUE if re-entering an x-lock */
{
- ulint i;
- sync_level_t* slot;
sync_arr_t* array;
sync_thread_t* thread_slot;
+ sync_level_t sync_level;
if (!sync_order_checks_on) {
@@ -1097,21 +1092,11 @@ sync_thread_add_level(
thread_slot = sync_thread_level_arrays_find_slot();
if (thread_slot == NULL) {
- ulint sz;
-
- sz = sizeof(*array)
- + (sizeof(*array->elems) * SYNC_THREAD_N_LEVELS);
/* We have to allocate the level array for a new thread */
- array = static_cast<sync_arr_t*>(calloc(sz, sizeof(char)));
+ array = new sync_arr_t();
ut_a(array != NULL);
-
- array->next_free = ULINT_UNDEFINED;
- array->max_elems = SYNC_THREAD_N_LEVELS;
- array->elems = (sync_level_t*) &array[1];
-
thread_slot = sync_thread_level_arrays_find_free();
-
thread_slot->levels = array;
thread_slot->id = os_thread_get_curr_id();
}
@@ -1321,26 +1306,10 @@ sync_thread_add_level(
}
levels_ok:
- if (array->next_free == ULINT_UNDEFINED) {
- ut_a(array->n_elems < array->max_elems);
-
- i = array->n_elems++;
- } else {
- i = array->next_free;
- array->next_free = array->elems[i].level;
- }
-
- ut_a(i < array->n_elems);
- ut_a(i != ULINT_UNDEFINED);
-
- ++array->in_use;
- slot = &array->elems[i];
-
- ut_a(slot->latch == NULL);
-
- slot->latch = latch;
- slot->level = level;
+ sync_level.latch = latch;
+ sync_level.level = level;
+ array->push_back(sync_level);
mutex_exit(&sync_thread_mutex);
}
@@ -1358,7 +1327,6 @@ sync_thread_reset_level(
{
sync_arr_t* array;
sync_thread_t* thread_slot;
- ulint i;
if (!sync_order_checks_on) {
@@ -1387,36 +1355,15 @@ sync_thread_reset_level(
array = thread_slot->levels;
- for (i = 0; i < array->n_elems; i++) {
- sync_level_t* slot;
-
- slot = &array->elems[i];
+ for (std::vector<sync_level_t>::iterator it = array->begin(); it != array->end(); ++it) {
+ sync_level_t level = *it;
- if (slot->latch != latch) {
+ if (level.latch != latch) {
continue;
}
- slot->latch = NULL;
-
- /* Update the free slot list. See comment in sync_level_t
- for the level field. */
- slot->level = array->next_free;
- array->next_free = i;
-
- ut_a(array->in_use >= 1);
- --array->in_use;
-
- /* If all cells are idle then reset the free
- list. The assumption is that this will save
- time when we need to scan up to n_elems. */
-
- if (array->in_use == 0) {
- array->n_elems = 0;
- array->next_free = ULINT_UNDEFINED;
- }
-
+ array->erase(it);
mutex_exit(&sync_thread_mutex);
-
return(TRUE);
}
@@ -1502,8 +1449,7 @@ sync_thread_level_arrays_free(void)
/* If this slot was allocated then free the slot memory too. */
if (slot->levels != NULL) {
- free(slot->levels);
- slot->levels = NULL;
+ delete slot->levels;
}
}
diff --git a/storage/innobase/trx/trx0roll.cc b/storage/innobase/trx/trx0roll.cc
index a64367c4ba7..e2c3c0b949c 100644
--- a/storage/innobase/trx/trx0roll.cc
+++ b/storage/innobase/trx/trx0roll.cc
@@ -50,6 +50,9 @@ Created 3/26/1996 Heikki Tuuri
rollback */
#define TRX_ROLL_TRUNC_THRESHOLD 1
+/** true if trx_rollback_or_clean_all_recovered() thread is active */
+bool trx_rollback_or_clean_is_active;
+
/** In crash recovery, the current trx to be rolled back; NULL otherwise */
static const trx_t* trx_roll_crash_recv_trx = NULL;
@@ -492,7 +495,7 @@ trx_release_savepoint_for_mysql(
{
trx_named_savept_t* savep;
- ut_ad(trx_state_eq(trx, TRX_STATE_ACTIVE));
+ ut_ad(trx_state_eq(trx, TRX_STATE_ACTIVE) || trx_state_eq(trx, TRX_STATE_PREPARED));
ut_ad(trx->in_mysql_trx_list);
savep = trx_savepoint_find(trx, savepoint_name);
@@ -805,6 +808,8 @@ DECLARE_THREAD(trx_rollback_or_clean_all_recovered)(
trx_rollback_or_clean_recovered(TRUE);
+ trx_rollback_or_clean_is_active = false;
+
/* We count the number of threads in os_thread_exit(). A created
thread should always use that to exit and not use return() to exit. */
diff --git a/storage/innobase/trx/trx0sys.cc b/storage/innobase/trx/trx0sys.cc
index 52830a77b12..5eb3cef46c1 100644
--- a/storage/innobase/trx/trx0sys.cc
+++ b/storage/innobase/trx/trx0sys.cc
@@ -1187,8 +1187,6 @@ trx_sys_close(void)
/* Free the double write data structures. */
buf_dblwr_free();
- mutex_enter(&trx_sys->mutex);
-
ut_a(UT_LIST_GET_LEN(trx_sys->ro_trx_list) == 0);
/* Only prepared transactions may be left in the system. Free them. */
@@ -1228,8 +1226,6 @@ trx_sys_close(void)
ut_a(UT_LIST_GET_LEN(trx_sys->rw_trx_list) == 0);
ut_a(UT_LIST_GET_LEN(trx_sys->mysql_trx_list) == 0);
- mutex_exit(&trx_sys->mutex);
-
mutex_free(&trx_sys->mutex);
mem_free(trx_sys);
diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc
index 405d4ef958f..f072cc6e9c4 100644
--- a/storage/innobase/trx/trx0trx.cc
+++ b/storage/innobase/trx/trx0trx.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1996, 2015, 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
@@ -307,11 +307,10 @@ trx_free_prepared(
/*==============*/
trx_t* trx) /*!< in, own: trx object */
{
- ut_ad(mutex_own(&trx_sys->mutex));
-
ut_a(trx_state_eq(trx, TRX_STATE_PREPARED));
ut_a(trx->magic_n == TRX_MAGIC_N);
+ lock_trx_release_locks(trx);
trx_undo_free_prepared(trx);
assert_trx_in_rw_list(trx);
diff --git a/storage/innobase/ut/ut0ut.cc b/storage/innobase/ut/ut0ut.cc
index b273b5a117e..68446cc85ef 100644
--- a/storage/innobase/ut/ut0ut.cc
+++ b/storage/innobase/ut/ut0ut.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1994, 2012, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1994, 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
@@ -822,6 +822,8 @@ ut_strerr(
return("Temp file write failure");
case DB_FTS_TOO_MANY_WORDS_IN_PHRASE:
return("Too many words in a FTS phrase or proximity search");
+ case DB_TOO_BIG_FOR_REDO:
+ return("BLOB record length is greater than 10%% of redo log");
/* do not add default: in order to produce a warning if new code
is added to the enum but not added here */
diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c
index 0a89babb205..73c5b2be503 100644
--- a/storage/maria/ma_check.c
+++ b/storage/maria/ma_check.c
@@ -3119,10 +3119,8 @@ int maria_sort_index(HA_CHECK *param, register MARIA_HA *info, char *name)
for (key= 0,keyinfo= &share->keyinfo[0]; key < share->base.keys ;
key++,keyinfo++)
{
- if (! maria_is_key_active(share->state.key_map, key))
- continue;
-
- if (share->state.key_root[key] != HA_OFFSET_ERROR)
+ if (maria_is_key_active(share->state.key_map, key) &&
+ share->state.key_root[key] != HA_OFFSET_ERROR)
{
index_pos[key]=param->new_file_pos; /* Write first block here */
if (sort_one_index(param,info,keyinfo,share->state.key_root[key],
diff --git a/storage/mroonga/CMakeLists.txt b/storage/mroonga/CMakeLists.txt
index faad871fa95..f728c944bbf 100644
--- a/storage/mroonga/CMakeLists.txt
+++ b/storage/mroonga/CMakeLists.txt
@@ -1,6 +1,6 @@
# -*- indent-tabs-mode: nil -*-
#
-# Copyright(C) 2012-2014 Kouhei Sutou <kou@clear-code.com>
+# Copyright(C) 2012-2015 Kouhei Sutou <kou@clear-code.com>
# Copyright(C) 2013 Kentoku SHIBA
#
# This library is free software; you can redistribute it and/or
@@ -20,26 +20,42 @@
cmake_minimum_required(VERSION 2.6)
project(mroonga)
+if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
+ set(MRN_BUNDLED FALSE)
+else()
+ set(MRN_BUNDLED TRUE)
+endif()
+
include(TestBigEndian)
test_big_endian(BIG_ENDIAN)
if(BIG_ENDIAN)
- message(STATUS "Mroonga is not supported on big-endian")
+ set(MRN_BIG_ENDIAN_NOT_SUPPORTED_MESSAGE
+ "Mroonga doesn't support on big-endian")
+ if(MRN_BUNDLED)
+ message(STATUS ${MRN_BIG_ENDIAN_NOT_SUPPORTED_MESSAGE})
+ return()
+ else()
+ message(FATAL_ERROR ${MRN_BIG_ENDIAN_NOT_SUPPORTED_MESSAGE})
+ endif()
+endif()
+
+if(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
+ message(STATUS "Mroonga is not supported on Solaris")
return()
endif()
if(MSVC)
- if(MSVC_VERSION LESS 1600)
- message(STATUS "Mroonga supports only MSVC 2010 or later")
- return()
+ if(MSVC_VERSION LESS 1800)
+ set(MRN_OLD_MSVC_MESSAGE "Mroonga supports only MSVC 2013 or later")
+ if(MRN_BUNDLED)
+ message(STATUS ${MRN_OLD_MSVC_MESSAGE})
+ return()
+ else()
+ message(FATAL_ERROR ${MRN_OLD_MSVC_MESSAGE})
+ endif()
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()
@@ -75,6 +91,28 @@ 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)
+ option(MRN_GROONGA_EMBED
+ "Embed libgroonga"
+ ON)
+ if(MRN_GROONGA_EMBED)
+ set(GRN_EMBED ON)
+ endif()
+
+ set(MRN_BUNDLED_GROONGA_NORMALIZER_MYSQL_DIR
+ "${MRN_BUNDLED_GROONGA_DIR}/vendor/plugins/groonga-normalizer-mysql")
+ option(MRN_GROONGA_NORMALIZER_MYSQL_EMBED
+ "Embed groonga-normalizer-mysql Groonga plugin"
+ ON)
+ if(EXISTS ${MRN_BUNDLED_GROONGA_NORMALIZER_MYSQL_DIR})
+ set(GROONGA_NORMALIZER_MYSQL_FOUND ON)
+ else()
+ set(GROONGA_NORMALIZER_MYSQL_FOUND OFF)
+ set(MRN_GROONGA_NORMALIZER_MYSQL_EMBED OFF)
+ endif()
+ if(MRN_GROONGA_NORMALIZER_MYSQL_EMBED)
+ set(GROONGA_NORMALIZER_MYSQL_EMBED ON)
+ endif()
+
add_subdirectory("${MRN_BUNDLED_GROONGA_RELATIVE_DIR}")
else()
file(READ ${MRN_SOURCE_DIR}/required_groonga_version REQUIRED_GROONGA_VERSION)
@@ -98,15 +136,21 @@ 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})
+ string(REGEX REPLACE "[-=]" "_" temporary_variable_name ${flag})
+ string(TOUPPER "${temporary_variable_name}" temporary_variable_name)
+ set(temporary_variable_name "CFLAG${temporary_variable_name}")
+ check_c_compiler_flag(${flag} ${temporary_variable_name})
+ if(${temporary_variable_name})
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})
+ string(REGEX REPLACE "[-=]" "_" temporary_variable_name ${flag})
+ string(TOUPPER "${temporary_variable_name}" temporary_variable_name)
+ set(temporary_variable_name "CXXFLAG${temporary_variable_name}")
+ check_cxx_compiler_flag(${flag} ${temporary_variable_name})
+ if(${temporary_variable_name})
set(MRN_CXX_COMPILE_FLAGS "${MRN_CXX_COMPILE_FLAGS} ${flag}")
endif()
endmacro()
@@ -122,7 +166,7 @@ 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}/sources.am MRN_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"
@@ -151,17 +195,42 @@ else()
endif()
find_path(MYSQL_CONFIG "${MYSQL_CONFIG}")
+if(EXISTS "${MYSQL_SOURCE_DIR}/storage/maria")
+ set(MYSQL_VARIANT "MariaDB")
+else()
+ set(MYSQL_VARIANT "MySQL")
+endif()
+
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()
+if(EXISTS "${MYSQL_SOURCE_DIR}/extra/rapidjson")
+ set(MYSQL_RAPIDJSON_INCLUDE_DIR "${MYSQL_SOURCE_DIR}/extra/rapidjson/include")
+else()
+ set(MYSQL_RAPIDJSON_INCLUDE_DIR)
+endif()
+
+if(EXISTS "${MYSQL_SOURCE_DIR}/libbinlogevents")
+ set(MYSQL_LIBBINLOGEVENTS_EXPORT_DIR
+ "${MYSQL_SOURCE_DIR}/libbinlogevents/export")
+ set(MYSQL_LIBBINLOGEVENTS_INCLUDE_DIR
+ "${MYSQL_SOURCE_DIR}/libbinlogevents/include")
+else()
+ set(MYSQL_LIBBINLOGEVENTS_EXPORT_DIR)
+ set(MYSQL_LIBBINLOGEVENTS_INCLUDE_DIR)
+endif()
+
set(MYSQL_INCLUDE_DIRS
"${MYSQL_BUILD_DIR}/include"
"${MYSQL_SOURCE_DIR}/sql"
"${MYSQL_SOURCE_DIR}/include"
"${MYSQL_REGEX_INCLUDE_DIR}"
+ "${MYSQL_RAPIDJSON_INCLUDE_DIR}"
+ "${MYSQL_LIBBINLOGEVENTS_EXPORT_DIR}"
+ "${MYSQL_LIBBINLOGEVENTS_INCLUDE_DIR}"
"${MYSQL_SOURCE_DIR}")
if(MRN_BUNDLED)
@@ -190,6 +259,12 @@ else()
set_mysql_config_value("--version" MYSQL_VERSION)
endif()
+if(${MYSQL_VERSION} VERSION_LESS "5.5.0")
+ message(FATAL_ERROR
+ "Mroonga doesn't support MySQL < 5.5.0: <${MYSQL_VERSION}>")
+ return()
+endif()
+
if(${MYSQL_VERSION} VERSION_GREATER "10.0.0" AND
${MYSQL_VERSION} VERSION_LESS "10.0.9")
message(FATAL_ERROR
@@ -201,22 +276,23 @@ 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)
+
+ set(MRN_LIBRARY_DIRS ${GROONGA_LIBRARY_DIRS})
+ set(MRN_LIBRARIES ${GROONGA_LIBRARIES})
+ if(MRN_GROONGA_NORMALIZER_MYSQL_EMBED)
+ set(MRN_LIBRARY_DIRS
+ ${MRN_LIBRARY_DIRS}
+ "${MRN_BUNDLED_GROONGA_NORMALIZER_MYSQL_DIR}/normalizers")
+ set(MRN_LIBRARIES ${MRN_LIBRARIES} mysql_normalizer)
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}")
+ set(MRN_LIBRARY_DIRS
+ ${MRN_LIBRARY_DIRS}
+ ${GROONGA_LIBRARY_DIRS})
endif()
include_directories(
@@ -235,28 +311,23 @@ else()
"${MYSQL_SERVICES_LIB_DIR}")
endif()
link_directories(
- ${GROONGA_LIBRARY_DIRS}
+ ${MRN_LIBRARY_DIRS}
${MYSQL_LIBRARY_DIRS})
+set(MRN_ALL_SOURCES
+ ${MRN_SOURCES}
+ ${MRN_UDF_SOURCES}
+ ${LIBMRN_NO_MYSQL_SOURCES}
+ ${LIBMRN_NEED_MYSQL_SOURCES})
+
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()
+ mysql_add_plugin(mroonga
+ ${MRN_ALL_SOURCES}
+ STORAGE_ENGINE MODULE_ONLY
+ RECOMPILE_FOR_EMBEDDED
+ LINK_LIBRARIES ${MRN_LIBRARIES})
else()
- add_library(mroonga MODULE
- ${MROONGA_SOURCES}
- ${MRN_UDF_SOURCES}
- ${LIBMRN_NO_MYSQL_SOURCES}
- ${LIBMRN_NEED_MYSQL_SOURCES})
+ add_library(mroonga MODULE ${MRN_ALL_SOURCES})
set(MYSQL_LIBRARIES "mysqlservices")
target_link_libraries(mroonga ${GROONGA_LIBRARIES} ${MYSQL_LIBRARIES})
@@ -299,18 +370,22 @@ else()
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")
+ if(("${MYSQL_VARIANT}" STREQUAL "MariaDB") OR
+ ("${MYSQL_VARIANT}" STREQUAL "MySQL" AND
+ ${MYSQL_VERSION} VERSION_LESS "5.7.0"))
+ mrn_check_cxxflag("-fno-exceptions")
+ mrn_check_cxxflag("-fno-rtti")
+ endif()
mrn_check_cxxflag("-felide-constructors")
endif()
- set_source_files_properties(${MROONGA_SOURCES} PROPERTIES
+ set_source_files_properties(${MRN_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}")
+ COMPILE_FLAGS "${MRN_CXX_COMPILE_FLAGS}")
set_source_files_properties(${LIBMRN_NO_MYSQL_SOURCES} PROPERTIES
- COMPILE_FLAGS "${MRN_C_COMPILE_FLAGS}")
+ COMPILE_FLAGS "${MRN_CXX_COMPILE_FLAGS}")
set_property(TARGET mroonga APPEND PROPERTY
COMPILE_DEFINITIONS "MYSQL_DYNAMIC_PLUGIN")
set_target_properties(mroonga PROPERTIES
@@ -321,19 +396,20 @@ else()
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)
+ set_property(TARGET mroonga APPEND PROPERTY
+ COMPILE_DEFINITIONS "WITH_GROONGA_NORMALIZER_MYSQL=1")
+ if(MRN_GROONGA_NORMALIZER_MYSQL_EMBED)
+ set_property(TARGET mroonga APPEND PROPERTY
+ COMPILE_DEFINITIONS "MRN_GROONGA_NORMALIZER_MYSQL_EMBED")
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}")
+set_property(TARGET mroonga APPEND PROPERTY
+ COMPILE_DEFINITIONS "MRN_PARSER_DEFAULT=\"${MRN_DEFAULT_PARSER}\"")
configure_file(
"${PROJECT_SOURCE_DIR}/mrn_version.h.in"
diff --git a/storage/mroonga/COPYING b/storage/mroonga/COPYING
new file mode 100644
index 00000000000..be8dfebc1c0
--- /dev/null
+++ b/storage/mroonga/COPYING
@@ -0,0 +1,504 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should 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
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
diff --git a/storage/mroonga/Makefile.am b/storage/mroonga/Makefile.am
index 32fc88ad061..d783ec883f9 100644
--- a/storage/mroonga/Makefile.am
+++ b/storage/mroonga/Makefile.am
@@ -40,7 +40,6 @@ SUBDIRS = \
EXTRA_DIST = \
AUTHORS \
gpg_uid \
- plug.in \
CMakeLists.txt
installcheck-local: install
@@ -67,8 +66,6 @@ update-latest-release: misc
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 \
diff --git a/storage/mroonga/appveyor.yml b/storage/mroonga/appveyor.yml
new file mode 100644
index 00000000000..de368b85660
--- /dev/null
+++ b/storage/mroonga/appveyor.yml
@@ -0,0 +1,54 @@
+version: "{build}"
+clone_depth: 10
+install:
+ - cd ..
+ - choco install -y curl 7zip.commandline
+ - curl -O http://mirror.jmu.edu/pub/mariadb/mariadb-10.0.17/source/mariadb-10.0.17.tar.gz
+ - 7z x mariadb-10.0.17.tar.gz
+ - 7z x mariadb-10.0.17.tar > nul
+ - cd mariadb-10.0.17
+ - rmdir /S /Q storage\mroonga\
+ - move ..\mroonga storage\mroonga
+ - git clone --quiet --depth 1 https://github.com/groonga/groonga.git ..\groonga
+ - cd ..\groonga
+ - git submodule update --init
+ - cd ..\mariadb-10.0.17
+ - rmdir /S /Q ..\groonga\test\
+ - mkdir storage\mroonga\vendor
+ - move ..\groonga storage\mroonga\vendor\groonga
+ - git clone --quiet --depth 1 https://github.com/groonga/groonga-normalizer-mysql.git storage\mroonga\vendor\groonga\vendor\plugins\groonga-normalizer-mysql
+build_script:
+ - "echo # > win\\packaging\\CMakeLists.txt"
+ - cmake . -G "Visual Studio 12 Win64"
+ -DCMAKE_BUILD_TYPE=Debug
+ -DWITHOUT_ARCHIVE=ON
+ -DWITHOUT_BLACKHOLE=ON
+ -DWITHOUT_CASSANDRA=ON
+ -DWITHOUT_CONNECT=ON
+ -DWITHOUT_CSV=ON
+ -DWITHOUT_EXAMPLE=ON
+ -DWITHOUT_FEDERATED=ON
+ -DWITHOUT_FEDERATEDX=ON
+ -DWITHOUT_HEAP=ON
+ -DWITHOUT_INNOBASE=ON
+ -DWITHOUT_MYISAM=ON
+ -DWITHOUT_MYISAMMRG=ON
+ -DWITHOUT_OQGRAPH=ON
+ -DWITHOUT_PERFSCHEMA=OFF
+ -DWITHOUT_SEQUENCE=ON
+ -DWITHOUT_SPHINX=ON
+ -DWITHOUT_SPIDER=ON
+ -DWITHOUT_TEST_SQL_DISCOVERY=ON
+ -DWITHOUT_TOKUDB=ON
+ -DWITHOUT_XTRADB=ON
+ -DWITH_UNIT_TESTS=OFF
+ - cmake --build . --config Debug
+
+notifications:
+ - provider: Email
+ to:
+ - groonga-mysql-commit@lists.sourceforge.jp
+ - kou@clear-code.com
+ on_build_status_changed: true
+
+test: off
diff --git a/storage/mroonga/configure.ac b/storage/mroonga/configure.ac
index 48312a44c8c..dc127c17838 100644
--- a/storage/mroonga/configure.ac
+++ b/storage/mroonga/configure.ac
@@ -174,12 +174,20 @@ AC_DEFUN([CONFIG_OPTION_MYSQL],[
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/extra/rapidjson"; then
+ mysql_rapidjson_include_dir="$ac_mysql_source_dir/extra/rapidjson/include"
+ MYSQL_INCLUDES="$MYSQL_INCLUDES -I$mysql_rapidjson_include_dir"
+ fi
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"
+ if test -d "$ac_mysql_source_dir/libbinlogevents"; then
+ MYSQL_INCLUDES="$MYSQL_INCLUDES -I$ac_mysql_source_dir/libbinlogevents/export"
+ MYSQL_INCLUDES="$MYSQL_INCLUDES -I$ac_mysql_source_dir/libbinlogevents/include"
+ fi
MYSQL_INCLUDES="$MYSQL_INCLUDES -I$ac_mysql_source_dir"
MYSQL_INCLUDES="$MYSQL_INCLUDES $($ac_mysql_config --include)"
AC_SUBST(MYSQL_INCLUDES)
@@ -187,8 +195,19 @@ AC_DEFUN([CONFIG_OPTION_MYSQL],[
MYSQL_VERSION="$($ac_mysql_config --version)"
AC_SUBST(MYSQL_VERSION)
+ MYSQL_MAJOR_MINOR_VERSION=["$(echo $MYSQL_VERSION | sed -e 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*[a-z]*\)[.0-9a-z-]*$/\1.\2/')"]
+
+ MYSQL_CXXFLAGS="-fno-implicit-templates -felide-constructors"
+ case "$MYSQL_MAJOR_MINOR_VERSION" in
+ 5.7)
+ :
+ ;;
+ *)
+ MYSQL_CXXFLAGS="$MYSQL_CXXFLAGS -fno-exceptions -fno-rtti"
+ ;;
+ esac
+
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=""
@@ -447,7 +466,7 @@ AC_SUBST(DOCUMENT_VERSION)
AC_SUBST(DOCUMENT_VERSION_FULL)
CFLAGS="$CFLAGS"
-CXXFLAGS="$CXXFLAGS -fno-implicit-templates -fno-exceptions -fno-rtti -felide-constructors"
+CXXFLAGS="$CXXFLAGS $MYSQL_CXXFLAGS"
AC_CONFIG_FILES([
Makefile
@@ -461,7 +480,6 @@ AC_CONFIG_FILES([
packages/Makefile
packages/rpm/Makefile
packages/rpm/centos/Makefile
- packages/rpm/fedora/Makefile
packages/yum/Makefile
packages/apt/Makefile
packages/source/Makefile
@@ -486,8 +504,7 @@ AC_OUTPUT([
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/rpm/centos/percona-server-56-mroonga.spec
packages/yum/env.sh
data/install.sql
])
diff --git a/storage/mroonga/ha_mroonga.cpp b/storage/mroonga/ha_mroonga.cpp
index 8b9a08b59dc..83f03fcb272 100644
--- a/storage/mroonga/ha_mroonga.cpp
+++ b/storage/mroonga/ha_mroonga.cpp
@@ -2,7 +2,7 @@
/*
Copyright(C) 2010 Tetsuro IKEDA
Copyright(C) 2010-2013 Kentoku SHIBA
- Copyright(C) 2011-2014 Kouhei Sutou <kou@clear-code.com>
+ Copyright(C) 2011-2015 Kouhei Sutou <kou@clear-code.com>
Copyright(C) 2013 Kenji Maruyama <mmmaru777@gmail.com>
This library is free software; you can redistribute it and/or
@@ -21,6 +21,7 @@
*/
#include "mrn_mysql.h"
+#include "mrn_mysql_compat.h"
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation
@@ -35,6 +36,11 @@
#endif
#include <sql_select.h>
+#include <item_sum.h>
+
+#ifdef MRN_HAVE_BINLOG_H
+# include <binlog.h>
+#endif
#ifdef MRN_HAVE_SQL_OPTIMIZER_H
# include <sql_optimizer.h>
@@ -49,9 +55,6 @@
#ifdef WIN32
# include <math.h>
# include <direct.h>
-# 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
@@ -64,11 +67,14 @@
#else
# include <dirent.h>
# include <unistd.h>
-# 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
+#define MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(type, variable_name, variable_size) \
+ type *variable_name = \
+ (type *)mrn_my_malloc(sizeof(type) * (variable_size), MYF(MY_WME))
+#define MRN_FREE_VARIABLE_LENGTH_ARRAYS(variable_name) \
+ my_free(variable_name)
+
#include "mrn_err.h"
#include "mrn_table.hpp"
#include "ha_mroonga.hpp"
@@ -89,6 +95,8 @@
#include <mrn_smart_grn_obj.hpp>
#include <mrn_database_manager.hpp>
#include <mrn_grn.hpp>
+#include <mrn_value_decoder.hpp>
+#include <mrn_database_repairer.hpp>
#ifdef MRN_SUPPORT_FOREIGN_KEYS
# include <sql_table.h>
@@ -116,23 +124,14 @@
} \
} 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
+# ifdef DBUG_OFF
# ifndef _WIN32
-extern pthread_mutex_t LOCK_open;
+extern mysql_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
+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)
#endif
#if MYSQL_VERSION_ID >= 50600
@@ -157,7 +156,11 @@ static pthread_mutex_t *mrn_LOCK_open;
# 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)
+# if MYSQL_VERSION_ID >= 100000
+# define MRN_ABORT_ON_WARNING(thd) thd_kill_level(thd)
+# else
+# define MRN_ABORT_ON_WARNING(thd) thd->abort_on_warning
+# endif
#else
# define mrn_declare_plugin(NAME) mysql_declare_plugin(NAME)
# define mrn_declare_plugin_end mysql_declare_plugin_end
@@ -166,15 +169,10 @@ static pthread_mutex_t *mrn_LOCK_open;
# 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;
+# if MYSQL_VERSION_ID >= 50706
+# define MRN_ABORT_ON_WARNING(thd) false
+# else
+# define MRN_ABORT_ON_WARNING(thd) thd->abort_on_warning
# endif
#endif
@@ -190,12 +188,69 @@ static pthread_mutex_t *mrn_LOCK_open;
# define MRN_GET_ERR_MSG(code) ER(code)
#endif
+#if MYSQL_VERSION_ID >= 50706 && !defined(MRN_MARIADB_P)
+# define MRN_LEX_GET_TABLE_LIST(lex) (lex)->select_lex->table_list.first
+#else
+# define MRN_LEX_GET_TABLE_LIST(lex) (lex)->select_lex.table_list.first
+#endif
+
+#if MYSQL_VERSION_ID >= 50706 && !defined(MRN_MARIADB_P)
+# define MRN_KEYTYPE_FOREIGN KEYTYPE_FOREIGN
+#else
+# define MRN_KEYTYPE_FOREIGN Key::FOREIGN_KEY
+#endif
+
+#if MYSQL_VERSION_ID >= 50706 && !defined(MRN_MARIADB_P)
+# define mrn_calculate_key_len(table, key_index, buffer, keypart_map) \
+ calculate_key_len(table, key_index, keypart_map)
+#else
+# define mrn_calculate_key_len(table, key_index, buffer, keypart_map) \
+ calculate_key_len(table, key_index, buffer, keypart_map)
+#endif
+
+#if MYSQL_VERSION_ID >= 50706 && !defined(MRN_MARIADB_P)
+# define MRN_SELECT_LEX_GET_WHERE_COND(select_lex) \
+ ((select_lex)->where_cond())
+# define MRN_SELECT_LEX_GET_HAVING_COND(select_lex) \
+ ((select_lex)->having_cond())
+# define MRN_SELECT_LEX_GET_ACTIVE_OPTIONS(select_lex) \
+ ((select_lex)->active_options())
+#else
+# define MRN_SELECT_LEX_GET_WHERE_COND(select_lex) \
+ ((select_lex)->where)
+# define MRN_SELECT_LEX_GET_HAVING_COND(select_lex) \
+ ((select_lex)->having)
+# define MRN_SELECT_LEX_GET_ACTIVE_OPTIONS(select_lex) \
+ ((select_lex)->options)
+#endif
+
+#if MYSQL_VERSION_ID >= 50706 && !defined(MRN_MARIADB_P)
+# define MRN_TABLE_LIST_GET_DERIVED(table_list) NULL
+#else
+# define MRN_TABLE_LIST_GET_DERIVED(table_list) (table_list)->derived
+#endif
+
+#if MYSQL_VERSION_ID >= 50706 && !defined(MRN_MARIADB_P)
+# define MRN_GEOMETRY_FREE(geometry)
+#else
+# define MRN_GEOMETRY_FREE(geometry) delete (geometry)
+#endif
+
Rpl_filter *mrn_binlog_filter;
Time_zone *mrn_my_tz_UTC;
#ifdef MRN_HAVE_TABLE_DEF_CACHE
HASH *mrn_table_def_cache;
#endif
+#ifdef MRN_HAVE_PSI_MEMORY_KEY
+PSI_memory_key mrn_memory_key;
+
+static PSI_memory_info mrn_all_memory_keys[]=
+{
+ {&mrn_memory_key, "Mroonga", 0}
+};
+#endif
+
static const char *INDEX_COLUMN_NAME = "index";
static const char *MRN_PLUGIN_AUTHOR = "The Mroonga project";
@@ -207,20 +262,55 @@ extern "C" {
int grn_atoi(const char *nptr, const char *end, const char **rest);
uint grn_atoui(const char *nptr, const char *end, const char **rest);
+#ifdef HAVE_PSI_INTERFACE
+# 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
+static PSI_mutex_key mrn_open_tables_mutex_key;
+static PSI_mutex_key mrn_long_term_share_mutex_key;
+static PSI_mutex_key mrn_allocated_thds_mutex_key;
+PSI_mutex_key mrn_share_mutex_key;
+PSI_mutex_key mrn_long_term_share_auto_inc_mutex_key;
+static PSI_mutex_key mrn_log_mutex_key;
+static PSI_mutex_key mrn_db_manager_mutex_key;
+
+static PSI_mutex_info mrn_mutexes[] =
+{
+ {&mrn_open_tables_mutex_key, "open_tables", PSI_FLAG_GLOBAL},
+ {&mrn_long_term_share_mutex_key, "long_term_share", PSI_FLAG_GLOBAL},
+ {&mrn_allocated_thds_mutex_key, "allocated_thds", PSI_FLAG_GLOBAL},
+ {&mrn_share_mutex_key, "share", 0},
+ {&mrn_long_term_share_auto_inc_mutex_key,
+ "long_term_share::auto_inc", 0},
+ {&mrn_log_mutex_key, "log", PSI_FLAG_GLOBAL},
+ {&mrn_db_manager_mutex_key, "DatabaseManager", PSI_FLAG_GLOBAL}
+};
+#endif
+
/* global variables */
-static pthread_mutex_t mrn_log_mutex;
handlerton *mrn_hton_ptr;
HASH mrn_open_tables;
-pthread_mutex_t mrn_open_tables_mutex;
+mysql_mutex_t mrn_open_tables_mutex;
HASH mrn_long_term_share;
-pthread_mutex_t mrn_long_term_share_mutex;
+mysql_mutex_t mrn_long_term_share_mutex;
+
+HASH mrn_allocated_thds;
+mysql_mutex_t mrn_allocated_thds_mutex;
/* internal variables */
static grn_ctx mrn_ctx;
+static mysql_mutex_t mrn_log_mutex;
static grn_obj *mrn_db;
static grn_ctx mrn_db_manager_ctx;
+static mysql_mutex_t mrn_db_manager_mutex;
mrn::DatabaseManager *mrn_db_manager = NULL;
+
#ifdef WIN32
static inline double round(double x)
{
@@ -272,12 +362,19 @@ static const char *mrn_inspect_thr_lock_type(enum thr_lock_type lock_type)
inspected = "TL_WRITE_ALLOW_READ";
break;
#endif
+#ifdef MRN_HAVE_TL_WRITE_CONCURRENT_DEFAULT
+ case TL_WRITE_CONCURRENT_DEFAULT:
+ inspected = "TL_WRITE_CONCURRENT_DEFAULT";
+ break;
+#endif
case TL_WRITE_CONCURRENT_INSERT:
inspected = "TL_WRITE_CONCURRENT_INSERT";
break;
+#ifdef MRN_HAVE_TL_WRITE_DELAYED
case TL_WRITE_DELAYED:
inspected = "TL_WRITE_DELAYED";
break;
+#endif
case TL_WRITE_DEFAULT:
inspected = "TL_WRITE_DEFAULT";
break;
@@ -506,6 +603,33 @@ static int mrn_lock_timeout = grn_get_lock_timeout();
static char *mrn_libgroonga_version = const_cast<char *>(grn_get_version());
static char *mrn_version = const_cast<char *>(MRN_VERSION);
static char *mrn_vector_column_delimiter = NULL;
+static my_bool mrn_libgroonga_support_zlib = FALSE;
+static my_bool mrn_libgroonga_support_lz4 = FALSE;
+typedef enum {
+ MRN_BOOLEAN_MODE_SYNTAX_FLAG_DEFAULT = (1 << 0),
+ MRN_BOOLEAN_MODE_SYNTAX_FLAG_SYNTAX_QUERY = (1 << 1),
+ MRN_BOOLEAN_MODE_SYNTAX_FLAG_SYNTAX_SCRIPT = (1 << 2),
+ MRN_BOOLEAN_MODE_SYNTAX_FLAG_ALLOW_COLUMN = (1 << 3),
+ MRN_BOOLEAN_MODE_SYNTAX_FLAG_ALLOW_UPDATE = (1 << 4),
+ MRN_BOOLEAN_MODE_SYNTAX_FLAG_ALLOW_LEADING_NOT = (1 << 5)
+} mrn_boolean_mode_syntax_flag;
+#ifdef MRN_SUPPORT_THDVAR_SET
+static const char *mrn_boolean_mode_sytnax_flag_names[] = {
+ "DEFAULT",
+ "SYNTAX_QUERY",
+ "SYNTAX_SCRIPT",
+ "ALLOW_COLUMN",
+ "ALLOW_UPDATE",
+ "ALLOW_LEADING_NOT",
+ NullS
+};
+static TYPELIB mrn_boolean_mode_syntax_flags_typelib = {
+ array_elements(mrn_boolean_mode_sytnax_flag_names) - 1,
+ "",
+ mrn_boolean_mode_sytnax_flag_names,
+ NULL
+};
+#endif
typedef enum {
MRN_ACTION_ON_ERROR_ERROR,
@@ -552,9 +676,6 @@ static grn_logger mrn_logger = {
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)))
@@ -569,22 +690,42 @@ static uchar *mrn_allocated_thds_get_key(const uchar *record,
static struct st_mysql_storage_engine storage_engine_structure =
{ MYSQL_HANDLERTON_INTERFACE_VERSION };
+#if MYSQL_VERSION_ID >= 50706 && !defined(MRN_MARIADB_P)
+# define MRN_STATUS_VARIABLE_ENTRY(name, value, type, scope) \
+ {name, value, type, scope}
+#else
+# define MRN_STATUS_VARIABLE_ENTRY(name, value, type, scope) \
+ {name, value, type}
+#endif
+
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}
+ MRN_STATUS_VARIABLE_ENTRY(MRN_STATUS_VARIABLE_NAME_PREFIX_STRING "_count_skip",
+ (char *)&mrn_count_skip,
+ SHOW_LONG,
+ SHOW_SCOPE_GLOBAL),
+ MRN_STATUS_VARIABLE_ENTRY(MRN_STATUS_VARIABLE_NAME_PREFIX_STRING "_fast_order_limit",
+ (char *)&mrn_fast_order_limit,
+ SHOW_LONG,
+ SHOW_SCOPE_GLOBAL),
+ MRN_STATUS_VARIABLE_ENTRY(NullS, NullS, SHOW_LONG, SHOW_SCOPE_GLOBAL)
};
-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,
+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
@@ -677,10 +818,10 @@ static void mrn_log_file_update(THD *thd, struct st_mysql_sys_var *var,
#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));
+ *old_value_ptr = mrn_my_strdup(new_log_file_name, MYF(MY_WME));
+ my_free(old_log_file_name);
#else
- *old_value_ptr = my_strdup(new_log_file_name, MYF(MY_WME));
+ *old_value_ptr = mrn_my_strdup(new_log_file_name, MYF(MY_WME));
#endif
grn_ctx_fin(&ctx);
@@ -717,8 +858,8 @@ static void mrn_default_parser_update(THD *thd, struct st_mysql_sys_var *var,
}
#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));
+ my_free(*old_value_ptr);
+ *old_value_ptr = mrn_my_strdup(new_value, MYF(MY_WME));
#else
*old_value_ptr = (char *)new_value;
#endif
@@ -760,7 +901,7 @@ static MYSQL_THDVAR_LONGLONG(match_escalation_threshold,
NULL,
grn_get_default_match_escalation_threshold(),
-1,
- LONGLONG_MAX,
+ INT_MAX64,
0);
static void mrn_vector_column_delimiter_update(THD *thd, struct st_mysql_sys_var *var,
@@ -771,8 +912,8 @@ static void mrn_vector_column_delimiter_update(THD *thd, struct st_mysql_sys_var
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));
+ my_free(*old_value_ptr);
+ *old_value_ptr = mrn_my_strdup(new_value, MYF(MY_WME));
#else
*old_value_ptr = (char *)new_value;
#endif
@@ -796,9 +937,9 @@ static void mrn_database_path_prefix_update(THD *thd,
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));
+ my_free(*old_value_ptr);
if (new_value)
- *old_value_ptr = my_strdup(new_value, MYF(MY_WME));
+ *old_value_ptr = mrn_my_strdup(new_value, MYF(MY_WME));
else
*old_value_ptr = NULL;
#else
@@ -876,6 +1017,73 @@ static MYSQL_SYSVAR_STR(version, mrn_version,
NULL,
MRN_VERSION);
+static my_bool grn_check_zlib_support()
+{
+ bool is_zlib_support = false;
+ grn_obj grn_support_p;
+
+ GRN_BOOL_INIT(&grn_support_p, 0);
+ grn_obj_get_info(&mrn_ctx, NULL, GRN_INFO_SUPPORT_ZLIB, &grn_support_p);
+ is_zlib_support = (GRN_BOOL_VALUE(&grn_support_p));
+ grn_obj_unlink(&mrn_ctx, &grn_support_p);
+
+ return is_zlib_support;
+}
+
+static my_bool grn_check_lz4_support()
+{
+ bool is_lz4_support = false;
+ grn_obj grn_support_p;
+
+ GRN_BOOL_INIT(&grn_support_p, 0);
+ grn_obj_get_info(&mrn_ctx, NULL, GRN_INFO_SUPPORT_LZ4, &grn_support_p);
+ is_lz4_support = (GRN_BOOL_VALUE(&grn_support_p));
+ grn_obj_unlink(&mrn_ctx, &grn_support_p);
+
+ return is_lz4_support;
+}
+
+static MYSQL_SYSVAR_BOOL(libgroonga_support_zlib, mrn_libgroonga_support_zlib,
+ PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
+ "The status of libgroonga supports zlib",
+ NULL,
+ NULL,
+ grn_check_zlib_support());
+
+static MYSQL_SYSVAR_BOOL(libgroonga_support_lz4, mrn_libgroonga_support_lz4,
+ PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
+ "The status of libgroonga supports LZ4",
+ NULL,
+ NULL,
+ grn_check_lz4_support());
+
+#ifdef MRN_SUPPORT_THDVAR_SET
+static MYSQL_THDVAR_SET(boolean_mode_syntax_flags,
+ PLUGIN_VAR_RQCMDARG,
+ "The flags to custom syntax in BOOLEAN MODE. "
+ "Available flags: "
+ "DEFAULT(=SYNTAX_QUERY,ALLOW_LEADING_NOT), "
+ "SYNTAX_QUERY, SYNTAX_SCRIPT, "
+ "ALLOW_COLUMN, ALLOW_UPDATE and ALLOW_LEADING_NOT",
+ NULL,
+ NULL,
+ MRN_BOOLEAN_MODE_SYNTAX_FLAG_DEFAULT,
+ &mrn_boolean_mode_syntax_flags_typelib);
+#endif
+
+static const int MRN_MAX_N_RECORDS_FOR_ESTIMATE_DEFAULT = 1000;
+
+static MYSQL_THDVAR_INT(max_n_records_for_estimate,
+ PLUGIN_VAR_RQCMDARG,
+ "The max number of records to "
+ "estimate the number of matched records",
+ NULL,
+ NULL,
+ MRN_MAX_N_RECORDS_FOR_ESTIMATE_DEFAULT,
+ -1,
+ INT_MAX,
+ 0);
+
static struct st_mysql_sys_var *mrn_system_variables[] =
{
MYSQL_SYSVAR(log_level),
@@ -891,6 +1099,12 @@ static struct st_mysql_sys_var *mrn_system_variables[] =
MYSQL_SYSVAR(libgroonga_version),
MYSQL_SYSVAR(version),
MYSQL_SYSVAR(vector_column_delimiter),
+ MYSQL_SYSVAR(libgroonga_support_zlib),
+ MYSQL_SYSVAR(libgroonga_support_lz4),
+#ifdef MRN_SUPPORT_THDVAR_SET
+ MYSQL_SYSVAR(boolean_mode_syntax_flags),
+#endif
+ MYSQL_SYSVAR(max_n_records_for_estimate),
NULL
};
@@ -917,7 +1131,7 @@ static ST_FIELD_INFO i_s_mrn_stats_fields_info[] =
MYSQL_TYPE_LONG,
0,
0,
- "Rows written to groonga",
+ "Rows written to Groonga",
SKIP_OPEN_TABLE
},
{
@@ -926,7 +1140,7 @@ static ST_FIELD_INFO i_s_mrn_stats_fields_info[] =
MYSQL_TYPE_LONG,
0,
0,
- "Rows read from groonga",
+ "Rows read from Groonga",
SKIP_OPEN_TABLE
}
};
@@ -1010,7 +1224,11 @@ static int mrn_close_connection(handlerton *hton, THD *thd)
DBUG_RETURN(0);
}
+#ifdef MRN_FLUSH_LOGS_HAVE_BINLOG_GROUP_FLUSH
+static bool mrn_flush_logs(handlerton *hton, bool binlog_group_flush)
+#else
static bool mrn_flush_logs(handlerton *hton)
+#endif
{
MRN_DBUG_ENTER_FUNCTION();
bool result = 0;
@@ -1191,7 +1409,112 @@ static grn_builtin_type mrn_grn_type_from_field(grn_ctx *ctx, Field *field,
return type;
}
-#ifdef HAVE_SPATIAL
+grn_obj_flags mrn_parse_grn_column_create_flags(THD *thd,
+ grn_ctx *ctx,
+ const char *flag_names,
+ uint flag_names_length)
+{
+ grn_obj_flags flags = 0;
+ const char *flag_names_end = flag_names + flag_names_length;
+
+ while (flag_names < flag_names_end) {
+ uint rest_length = flag_names_end - flag_names;
+
+ if (*flag_names == '|' || *flag_names == ' ') {
+ flag_names += 1;
+ continue;
+ }
+ if (rest_length >= 13 && !memcmp(flag_names, "COLUMN_SCALAR", 13)) {
+ flags |= GRN_OBJ_COLUMN_SCALAR;
+ flag_names += 13;
+ } else if (rest_length >= 13 && !memcmp(flag_names, "COLUMN_VECTOR", 13)) {
+ flags |= GRN_OBJ_COLUMN_VECTOR;
+ flag_names += 13;
+ } else if (rest_length >= 13 && !memcmp(flag_names, "COMPRESS_ZLIB", 13)) {
+ if (mrn_libgroonga_support_zlib) {
+ flags |= GRN_OBJ_COMPRESS_ZLIB;
+ } else {
+ push_warning_printf(thd, MRN_SEVERITY_WARNING,
+ ER_MRN_UNSUPPORTED_COLUMN_FLAG_NUM,
+ ER_MRN_UNSUPPORTED_COLUMN_FLAG_STR,
+ "COMPRESS_ZLIB");
+ }
+ flag_names += 13;
+ } else if (rest_length >= 12 && !memcmp(flag_names, "COMPRESS_LZ4", 12)) {
+ if (mrn_libgroonga_support_lz4) {
+ flags |= GRN_OBJ_COMPRESS_LZ4;
+ } else {
+ push_warning_printf(thd, MRN_SEVERITY_WARNING,
+ ER_MRN_UNSUPPORTED_COLUMN_FLAG_NUM,
+ ER_MRN_UNSUPPORTED_COLUMN_FLAG_STR,
+ "COMPRESS_LZ4");
+ }
+ flag_names += 12;
+ } else {
+ char invalid_flag_name[MRN_MESSAGE_BUFFER_SIZE];
+ snprintf(invalid_flag_name, MRN_MESSAGE_BUFFER_SIZE,
+ "%.*s",
+ static_cast<int>(rest_length),
+ flag_names);
+ push_warning_printf(thd, MRN_SEVERITY_WARNING,
+ ER_MRN_INVALID_COLUMN_FLAG_NUM,
+ ER_MRN_INVALID_COLUMN_FLAG_STR,
+ invalid_flag_name,
+ "COLUMN_SCALAR");
+ flags |= GRN_OBJ_COLUMN_SCALAR;
+ break;
+ }
+ }
+ return flags;
+}
+
+bool mrn_parse_grn_index_column_flags(THD *thd,
+ grn_ctx *ctx,
+ const char *flag_names,
+ uint flag_names_length,
+ grn_obj_flags *index_column_flags)
+{
+ const char *flag_names_end = flag_names + flag_names_length;
+ bool found = false;
+
+ while (flag_names < flag_names_end) {
+ uint rest_length = flag_names_end - flag_names;
+
+ if (*flag_names == '|' || *flag_names == ' ') {
+ flag_names += 1;
+ continue;
+ }
+ if (rest_length >= 4 && !memcmp(flag_names, "NONE", 4)) {
+ flag_names += 4;
+ found = true;
+ } else if (rest_length >= 13 && !memcmp(flag_names, "WITH_POSITION", 13)) {
+ *index_column_flags |= GRN_OBJ_WITH_POSITION;
+ flag_names += 13;
+ found = true;
+ } else if (rest_length >= 12 && !memcmp(flag_names, "WITH_SECTION", 12)) {
+ *index_column_flags |= GRN_OBJ_WITH_SECTION;
+ flag_names += 12;
+ found = true;
+ } else if (rest_length >= 11 && !memcmp(flag_names, "WITH_WEIGHT", 11)) {
+ *index_column_flags |= GRN_OBJ_WITH_WEIGHT;
+ flag_names += 11;
+ found = true;
+ } else {
+ char invalid_flag_name[MRN_MESSAGE_BUFFER_SIZE];
+ snprintf(invalid_flag_name, MRN_MESSAGE_BUFFER_SIZE,
+ "%.*s",
+ static_cast<int>(rest_length),
+ flag_names);
+ push_warning_printf(thd, MRN_SEVERITY_WARNING,
+ ER_MRN_INVALID_INDEX_FLAG_NUM,
+ ER_MRN_INVALID_INDEX_FLAG_STR,
+ invalid_flag_name);
+ }
+ }
+ return found;
+}
+
+#ifdef MRN_HAVE_SPATIAL
static int mrn_set_geometry(grn_ctx *ctx, grn_obj *buf,
const char *wkb, uint wkb_size)
{
@@ -1228,12 +1551,13 @@ static int mrn_set_geometry(grn_ctx *ctx, grn_obj *buf,
error = ER_MRN_GEOMETRY_NOT_SUPPORT_NUM;
break;
}
- delete geometry;
+ MRN_GEOMETRY_FREE(geometry);
return error;
}
#endif
+#ifdef MRN_HAVE_HTON_ALTER_TABLE_FLAGS
static uint mrn_alter_table_flags(uint flags)
{
uint alter_flags = 0;
@@ -1254,18 +1578,15 @@ static uint mrn_alter_table_flags(uint flags)
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;
+ HA_INPLACE_DROP_UNIQUE_INDEX_NO_WRITE;
}
#endif
return alter_flags;
}
+#endif
static int mrn_init(void *p)
{
@@ -1275,11 +1596,16 @@ static int mrn_init(void *p)
hton = (handlerton *)p;
hton->state = SHOW_OPTION_YES;
hton->create = mrn_handler_create;
- hton->flags = HTON_NO_PARTITION;
+ hton->flags = HTON_NO_FLAGS;
+#ifndef MRN_SUPPORT_PARTITION
+ hton->flags |= HTON_NO_PARTITION;
+#endif
hton->drop_database = mrn_drop_database;
hton->close_connection = mrn_close_connection;
hton->flush_logs = mrn_flush_logs;
+#ifdef MRN_HAVE_HTON_ALTER_TABLE_FLAGS
hton->alter_table_flags = mrn_alter_table_flags;
+#endif
mrn_hton_ptr = hton;
#ifdef _WIN32
@@ -1294,21 +1620,20 @@ static int mrn_init(void *p)
# 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);
+# ifdef HAVE_PSI_INTERFACE
+# 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
# endif
#else
mrn_binlog_filter = binlog_filter;
@@ -1321,7 +1646,14 @@ static int mrn_init(void *p)
# endif
#endif
- // init groonga
+#ifdef HAVE_PSI_INTERFACE
+ if (PSI_server) {
+ const char *category = "mroonga";
+ int n_mutexes = array_elements(mrn_mutexes);
+ PSI_server->register_mutex(category, mrn_mutexes, n_mutexes);
+ }
+#endif
+
if (grn_init() != GRN_SUCCESS) {
goto err_grn_init;
}
@@ -1335,7 +1667,17 @@ static int mrn_init(void *p)
if (mrn_change_encoding(ctx, system_charset_info))
goto err_mrn_change_encoding;
- if (pthread_mutex_init(&mrn_log_mutex, NULL) != 0) {
+#ifdef MRN_HAVE_PSI_MEMORY_KEY
+ {
+ const char *category = "ha_mroonga";
+ int n_keys = array_elements(mrn_all_memory_keys);
+ mysql_memory_register(category, mrn_all_memory_keys, n_keys);
+ }
+#endif
+
+ if (mysql_mutex_init(mrn_log_mutex_key,
+ &mrn_log_mutex,
+ MY_MUTEX_INIT_FAST) != 0) {
goto err_log_mutex_init;
}
@@ -1358,25 +1700,39 @@ static int mrn_init(void *p)
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 (mysql_mutex_init(mrn_db_manager_mutex_key,
+ &mrn_db_manager_mutex,
+ MY_MUTEX_INIT_FAST) != 0) {
+ GRN_LOG(&mrn_db_manager_ctx, GRN_LOG_ERROR,
+ "failed to initialize mutex for database manager");
+ goto err_db_manager_mutex_init;
+ }
+ mrn_db_manager = new mrn::DatabaseManager(&mrn_db_manager_ctx,
+ &mrn_db_manager_mutex);
if (!mrn_db_manager->init()) {
goto err_db_manager_init;
}
- if ((pthread_mutex_init(&mrn_allocated_thds_mutex, NULL) != 0)) {
+ if ((mysql_mutex_init(mrn_allocated_thds_mutex_key,
+ &mrn_allocated_thds_mutex,
+ MY_MUTEX_INIT_FAST) != 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)) {
+ if ((mysql_mutex_init(mrn_open_tables_mutex_key,
+ &mrn_open_tables_mutex,
+ MY_MUTEX_INIT_FAST) != 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)) {
+ if ((mysql_mutex_init(mrn_long_term_share_mutex_key,
+ &mrn_long_term_share_mutex,
+ MY_MUTEX_INIT_FAST) != 0)) {
goto error_allocated_long_term_share_mutex_init;
}
if (my_hash_init(&mrn_long_term_share, system_charset_info, 32, 0, 0,
@@ -1391,18 +1747,20 @@ static int mrn_init(void *p)
return 0;
error_allocated_long_term_share_hash_init:
- pthread_mutex_destroy(&mrn_long_term_share_mutex);
+ mysql_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);
+ mysql_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);
+ mysql_mutex_destroy(&mrn_allocated_thds_mutex);
err_allocated_thds_mutex_init:
err_db_manager_init:
delete mrn_db_manager;
+ mysql_mutex_destroy(&mrn_db_manager_mutex);
+err_db_manager_mutex_init:
grn_ctx_fin(&mrn_db_manager_ctx);
grn_obj_unlink(ctx, mrn_db);
err_db_create:
@@ -1411,7 +1769,7 @@ err_db_create:
mrn_log_file_opened = false;
}
err_log_file_open:
- pthread_mutex_destroy(&mrn_log_mutex);
+ mysql_mutex_destroy(&mrn_log_mutex);
err_log_mutex_init:
err_mrn_change_encoding:
grn_ctx_fin(ctx);
@@ -1450,12 +1808,13 @@ static int mrn_deinit(void *p)
}
my_hash_free(&mrn_long_term_share);
- pthread_mutex_destroy(&mrn_long_term_share_mutex);
+ mysql_mutex_destroy(&mrn_long_term_share_mutex);
my_hash_free(&mrn_open_tables);
- pthread_mutex_destroy(&mrn_open_tables_mutex);
+ mysql_mutex_destroy(&mrn_open_tables_mutex);
my_hash_free(&mrn_allocated_thds);
- pthread_mutex_destroy(&mrn_allocated_thds_mutex);
+ mysql_mutex_destroy(&mrn_allocated_thds_mutex);
delete mrn_db_manager;
+ mysql_mutex_destroy(&mrn_db_manager_mutex);
grn_ctx_fin(&mrn_db_manager_ctx);
grn_obj_unlink(ctx, mrn_db);
@@ -1466,7 +1825,7 @@ static int mrn_deinit(void *p)
fclose(mrn_log_file);
mrn_log_file_opened = false;
}
- pthread_mutex_destroy(&mrn_log_mutex);
+ mysql_mutex_destroy(&mrn_log_mutex);
return 0;
}
@@ -1489,6 +1848,18 @@ mrn_declare_plugin(MRN_PLUGIN_NAME)
i_s_mrn_stats
mrn_declare_plugin_end;
+static double mrn_get_score_value(grn_obj *score)
+{
+ MRN_DBUG_ENTER_FUNCTION();
+ double score_value;
+ if (score->header.domain == GRN_DB_FLOAT) {
+ score_value = GRN_FLOAT_VALUE(score);
+ } else {
+ score_value = (double)GRN_INT32_VALUE(score);
+ }
+ DBUG_RETURN(score_value);
+}
+
static void mrn_generic_ft_clear(FT_INFO *handler)
{
MRN_DBUG_ENTER_FUNCTION();
@@ -1555,7 +1926,7 @@ static float mrn_wrapper_ft_find_relevance(FT_INFO *handler, uchar *record,
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));
+ score = mrn_get_score_value(&(info->score));
}
}
@@ -1593,7 +1964,7 @@ static float mrn_wrapper_ft_get_relevance(FT_INFO *handler)
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));
+ score = mrn_get_score_value(&(info->score));
}
}
@@ -1640,7 +2011,7 @@ static float mrn_storage_ft_find_relevance(FT_INFO *handler, uchar *record,
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));
+ score = mrn_get_score_value(&(info->score));
}
}
DBUG_PRINT("info", ("mroonga: record_id=%d score=%g",
@@ -1672,7 +2043,7 @@ static float mrn_storage_ft_get_relevance(FT_INFO *handler)
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));
+ score = mrn_get_score_value(&(info->score));
}
}
DBUG_PRINT("info",
@@ -1916,7 +2287,6 @@ ha_mroonga::ha_mroonga(handlerton *hton, TABLE_SHARE *share_arg)
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),
@@ -1967,6 +2337,9 @@ ha_mroonga::~ha_mroonga()
if (share_for_create.wrapper_mode) {
plugin_unlock(NULL, share_for_create.plugin);
}
+ if (share_for_create.table_name) {
+ my_free(share_for_create.table_name);
+ }
mrn_free_share_alloc(&share_for_create);
free_root(&mem_root_for_create, MYF(0));
}
@@ -2126,7 +2499,7 @@ uint ha_mroonga::wrapper_max_supported_key_length() const
uint ha_mroonga::storage_max_supported_key_length() const
{
MRN_DBUG_ENTER_METHOD();
- DBUG_RETURN(HA_MAX_REC_LENGTH);
+ DBUG_RETURN(GRN_TABLE_MAX_KEY_SIZE);
}
uint ha_mroonga::max_supported_key_length() const
@@ -2173,7 +2546,7 @@ uint ha_mroonga::wrapper_max_supported_key_part_length() const
uint ha_mroonga::storage_max_supported_key_part_length() const
{
MRN_DBUG_ENTER_METHOD();
- DBUG_RETURN(HA_MAX_REC_LENGTH);
+ DBUG_RETURN(GRN_TABLE_MAX_KEY_SIZE);
}
uint ha_mroonga::max_supported_key_part_length() const
@@ -2348,7 +2721,7 @@ int ha_mroonga::create_share_for_create() const
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;
+ TABLE_LIST *table_list = MRN_LEX_GET_TABLE_LIST(lex);
MRN_DBUG_ENTER_METHOD();
wrap_handler_for_create = NULL;
memset(&table_for_create, 0, sizeof(TABLE));
@@ -2392,10 +2765,12 @@ int ha_mroonga::create_share_for_create() const
}
}
}
- init_alloc_root(&mem_root_for_create, 1024, 0, MYF(0));
+ mrn_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 = mrn_my_strndup(table_list->table_name,
+ table_list->table_name_length,
+ MYF(MY_WME));
share_for_create.table_name_length = table_list->table_name_length;
}
share_for_create.table_share = &table_share_for_create;
@@ -2467,7 +2842,7 @@ int ha_mroonga::wrapper_create(const char *name, TABLE *table,
share = NULL;
if (wrap_key_info)
{
- my_free(wrap_key_info, MYF(0));
+ my_free(wrap_key_info);
wrap_key_info = NULL;
}
base_key_info = NULL;
@@ -2486,7 +2861,7 @@ int ha_mroonga::wrapper_create(const char *name, TABLE *table,
if (wrap_key_info)
{
- my_free(wrap_key_info, MYF(0));
+ my_free(wrap_key_info);
wrap_key_info = NULL;
}
base_key_info = NULL;
@@ -2544,10 +2919,13 @@ int ha_mroonga::wrapper_create_index_fulltext(const char *grn_table_name,
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;
+ grn_obj_flags index_column_flags = GRN_OBJ_COLUMN_INDEX | GRN_OBJ_PERSISTENT;
+
+ if (!find_index_column_flags(key_info, &index_column_flags)) {
+ index_column_flags |= GRN_OBJ_WITH_POSITION;
+ 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);
@@ -2832,15 +3210,16 @@ int ha_mroonga::storage_create(const char *name, TABLE *table,
DBUG_RETURN(error);
}
- if (table_flags == (GRN_OBJ_PERSISTENT | GRN_OBJ_TABLE_PAT_KEY)) {
+ if (table_flags == (GRN_OBJ_PERSISTENT | GRN_OBJ_TABLE_PAT_KEY) ||
+ table_flags == (GRN_OBJ_PERSISTENT | GRN_OBJ_TABLE_HASH_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);
+ 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)) {
@@ -2902,12 +3281,10 @@ int ha_mroonga::storage_create(const char *name, TABLE *table,
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;
- }
+ col_flags |= mrn_parse_grn_column_create_flags(ha_thd(),
+ ctx,
+ tmp_share->col_flags[i],
+ tmp_share->col_flags_length[i]);
} else {
col_flags |= GRN_OBJ_COLUMN_SCALAR;
}
@@ -2987,7 +3364,7 @@ bool ha_mroonga::storage_create_foreign_key(TABLE *table,
char ref_db_buff[NAME_LEN + 1], ref_table_buff[NAME_LEN + 1];
while ((key = key_iterator++))
{
- if (key->type != Key::FOREIGN_KEY)
+ if (key->type != MRN_KEYTYPE_FOREIGN)
{
continue;
}
@@ -3012,7 +3389,11 @@ bool ha_mroonga::storage_create_foreign_key(TABLE *table,
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));
+#ifdef MRN_FOREIGN_KEY_USE_CONST_STRING
+ LEX_CSTRING ref_db_name = fk->ref_db;
+#else
LEX_STRING ref_db_name = fk->ref_db;
+#endif
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);
@@ -3020,7 +3401,11 @@ bool ha_mroonga::storage_create_foreign_key(TABLE *table,
ref_db_name.str = ref_db_buff;
DBUG_PRINT("info", ("mroonga: casedn ref_db_name=%s", ref_db_name.str));
}
+#ifdef MRN_FOREIGN_KEY_USE_CONST_STRING
+ LEX_CSTRING ref_table_name = fk->ref_table;
+#else
LEX_STRING ref_table_name = fk->ref_table;
+#endif
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);
@@ -3350,10 +3735,13 @@ int ha_mroonga::storage_create_index(TABLE *table, const char *grn_table_name,
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;
+ grn_obj_flags index_column_flags = GRN_OBJ_COLUMN_INDEX | GRN_OBJ_PERSISTENT;
+
+ if (!find_index_column_flags(key_info, &index_column_flags)) {
+ index_column_flags |= GRN_OBJ_WITH_POSITION;
+ if (is_multiple_column_index) {
+ index_column_flags |= GRN_OBJ_WITH_SECTION;
+ }
}
index_table = index_tables[i];
@@ -3448,7 +3836,8 @@ int ha_mroonga::storage_create_indexes(TABLE *table, const char *grn_table_name,
}
if (error) {
while (true) {
- if (index_tables[i]) {
+ if (index_tables[i] &&
+ !(tmp_share->index_table && tmp_share->index_table[i])) {
grn_obj_remove(ctx, index_tables[i]);
}
if (!i)
@@ -3557,7 +3946,7 @@ int ha_mroonga::wrapper_open(const char *name, int mode, uint test_if_locked)
}
}
- init_alloc_root(&mem_root, 1024, 0, MYF(0));
+ mrn_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);
@@ -3574,7 +3963,7 @@ int ha_mroonga::wrapper_open(const char *name, int mode, uint test_if_locked)
MRN_SET_BASE_TABLE_KEY(this, table);
if (wrap_key_info)
{
- my_free(wrap_key_info, MYF(0));
+ my_free(wrap_key_info);
wrap_key_info = NULL;
}
base_key_info = NULL;
@@ -3598,7 +3987,7 @@ int ha_mroonga::wrapper_open(const char *name, int mode, uint test_if_locked)
MRN_SET_BASE_TABLE_KEY(this, table);
if (wrap_key_info)
{
- my_free(wrap_key_info, MYF(0));
+ my_free(wrap_key_info);
wrap_key_info = NULL;
}
base_key_info = NULL;
@@ -3626,7 +4015,7 @@ int ha_mroonga::wrapper_open(const char *name, int mode, uint test_if_locked)
wrap_handler = NULL;
if (wrap_key_info)
{
- my_free(wrap_key_info, MYF(0));
+ my_free(wrap_key_info);
wrap_key_info = NULL;
}
base_key_info = NULL;
@@ -3792,67 +4181,20 @@ int ha_mroonga::storage_open(const char *name, int mode, uint test_if_locked)
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;
- }
+ if (!(ha_thd()->open_options & HA_OPEN_FOR_REPAIR)) {
+ 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);
}
- grn_table_cursor_close(ctx, cursor);
+ storage_set_keys_in_use();
}
- DBUG_VOID_RETURN;
+ ref_length = sizeof(grn_id);
+ DBUG_RETURN(0);
}
int ha_mroonga::open_table(const char *name)
@@ -3881,8 +4223,6 @@ int ha_mroonga::open_table(const char *name)
DBUG_RETURN(error);
}
- update_grn_table_is_referenced();
-
DBUG_RETURN(0);
}
@@ -3898,6 +4238,11 @@ int ha_mroonga::storage_open_columns(void)
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);
+ for (int i = 0; i < n_columns; i++) {
+ grn_columns[i] = NULL;
+ grn_column_ranges[i] = NULL;
+ }
+
if (table_share->blob_fields)
{
if (blob_buffers)
@@ -3910,8 +4255,7 @@ int ha_mroonga::storage_open_columns(void)
}
}
- int i;
- for (i = 0; i < n_columns; i++) {
+ for (int 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);
@@ -3920,24 +4264,46 @@ int ha_mroonga::storage_open_columns(void)
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);
+ if (!grn_columns[i]) {
+ error = ER_CANT_OPEN_FILE;
+ my_message(error, ctx->errbuf, MYF(0));
+ break;
+ }
+
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;
+ if (!grn_column_ranges[i]) {
+ error = ER_CANT_OPEN_FILE;
my_message(error, ctx->errbuf, MYF(0));
- DBUG_RETURN(error);
+ break;
}
}
- DBUG_RETURN(0);
+ if (error != 0) {
+ for (int i = 0; i < n_columns; i++) {
+ grn_obj *column = grn_columns[i];
+ if (column) {
+ grn_obj_unlink(ctx, column);
+ }
+
+ grn_obj *range = grn_column_ranges[i];
+ if (range) {
+ grn_obj_unlink(ctx, range);
+ }
+ }
+
+ free(grn_columns);
+ grn_columns = NULL;
+ free(grn_column_ranges);
+ grn_column_ranges = NULL;
+ }
+
+ DBUG_RETURN(error);
}
int ha_mroonga::storage_open_indexes(const char *name)
@@ -4002,7 +4368,7 @@ int ha_mroonga::storage_open_indexes(const char *name)
grn_index_tables[i],
INDEX_COLUMN_NAME,
strlen(INDEX_COLUMN_NAME));
- if (!grn_index_columns[i]) {
+ if (!grn_index_columns[i] && ctx->rc == GRN_SUCCESS) {
/* 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],
@@ -4104,7 +4470,7 @@ int ha_mroonga::wrapper_close()
wrap_handler = NULL;
if (wrap_key_info)
{
- my_free(wrap_key_info, MYF(0));
+ my_free(wrap_key_info);
wrap_key_info = NULL;
}
base_key_info = NULL;
@@ -4323,7 +4689,6 @@ int ha_mroonga::delete_table(const char *name)
}
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(),
@@ -5032,7 +5397,7 @@ int ha_mroonga::wrapper_write_row_index(uchar *buf)
(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,
+ push_warning(ha_thd(), MRN_SEVERITY_WARNING, error,
error_message);
DBUG_RETURN(0);
}
@@ -5090,6 +5455,7 @@ int ha_mroonga::storage_write_row(uchar *buf)
{
MRN_DBUG_ENTER_METHOD();
int error = 0;
+ bool unique_indexes_are_processed = false;
if (is_dry_write()) {
DBUG_PRINT("info", ("mroonga: dry write: ha_mroonga::%s", __FUNCTION__));
@@ -5098,7 +5464,6 @@ int ha_mroonga::storage_write_row(uchar *buf)
THD *thd = ha_thd();
int i;
- uint j;
int n_columns = table->s->fields;
if (table->next_number_field && buf == table->record[0])
@@ -5115,7 +5480,7 @@ int ha_mroonga::storage_write_row(uchar *buf)
if (field->is_null()) continue;
if (strcmp(MRN_COLUMN_NAME_ID, column_name) == 0) {
- push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ push_warning_printf(thd, MRN_SEVERITY_WARNING,
WARN_DATA_TRUNCATED, MRN_GET_ERR_MSG(WARN_DATA_TRUNCATED),
MRN_COLUMN_NAME_ID,
MRN_GET_CURRENT_ROW_FOR_WARNING(thd));
@@ -5156,6 +5521,11 @@ int ha_mroonga::storage_write_row(uchar *buf)
}
}
+ if (grn_table->header.type != GRN_TABLE_NO_KEY && pkey_size == 0) {
+ my_message(ER_ERROR_ON_WRITE, "primary key is empty", MYF(0));
+ DBUG_RETURN(ER_ERROR_ON_WRITE);
+ }
+
int added;
record_id = grn_table_add(ctx, grn_table, pkey, pkey_size, &added);
if (ctx->rc) {
@@ -5179,6 +5549,7 @@ int ha_mroonga::storage_write_row(uchar *buf)
{
goto err;
}
+ unique_indexes_are_processed = true;
grn_obj colbuf;
GRN_VOID_INIT(&colbuf);
@@ -5189,7 +5560,7 @@ int ha_mroonga::storage_write_row(uchar *buf)
if (field->is_null())
continue;
-#ifdef HAVE_SPATIAL
+#ifdef MRN_HAVE_SPATIAL
bool is_null_geometry_value =
field->real_type() == MYSQL_TYPE_GEOMETRY &&
static_cast<Field_geom *>(field)->get_length() == 0;
@@ -5270,13 +5641,16 @@ int ha_mroonga::storage_write_row(uchar *buf)
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]);
+ if (unique_indexes_are_processed) {
+ uint j;
+ 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);
@@ -5363,6 +5737,7 @@ err:
int ha_mroonga::storage_write_row_unique_index(uchar *buf,
KEY *key_info,
grn_obj *index_table,
+ grn_obj *index_column,
grn_id *key_id)
{
char *ukey = NULL;
@@ -5398,7 +5773,29 @@ int ha_mroonga::storage_write_row_unique_index(uchar *buf,
if (!added) {
// duplicated error
error = HA_ERR_FOUND_DUPP_KEY;
- memcpy(dup_ref, key_id, sizeof(grn_id));
+ grn_id duplicated_record_id = GRN_ID_NIL;
+ {
+ grn_table_cursor *table_cursor;
+ table_cursor = grn_table_cursor_open(ctx, index_table,
+ ukey, ukey_size,
+ ukey, ukey_size,
+ 0, -1, 0);
+ if (table_cursor) {
+ grn_obj *index_cursor;
+ index_cursor = grn_index_cursor_open(ctx, table_cursor, index_column,
+ GRN_ID_NIL, GRN_ID_MAX, 0);
+ if (index_cursor) {
+ grn_posting *posting;
+ posting = grn_index_cursor_next(ctx, index_cursor, NULL);
+ if (posting) {
+ duplicated_record_id = posting->rid;
+ }
+ }
+ grn_obj_unlink(ctx, index_cursor);
+ }
+ grn_table_cursor_close(ctx, table_cursor);
+ }
+ memcpy(dup_ref, &duplicated_record_id, sizeof(grn_id));
if (!ignoring_duplicated_key) {
GRN_LOG(ctx, GRN_LOG_ERROR,
"duplicated id on insert: update unique index: <%.*s>",
@@ -5431,9 +5828,14 @@ int ha_mroonga::storage_write_row_unique_indexes(uchar *buf)
if (!index_table) {
continue;
}
+ grn_obj *index_column = grn_index_columns[i];
+ if (!index_column) {
+ continue;
+ }
if ((error = storage_write_row_unique_index(buf, key_info,
- index_table, &key_id[i])))
+ index_table, index_column,
+ &key_id[i])))
{
if (error == HA_ERR_FOUND_DUPP_KEY)
{
@@ -5449,7 +5851,16 @@ err:
mrn_change_encoding(ctx, NULL);
do {
i--;
+
+ if (i == table->s->primary_key) {
+ continue;
+ }
+
KEY *key_info = &table->key_info[i];
+ if (!(key_info->flags & HA_NOSAME)) {
+ continue;
+ }
+
if (key_info->flags & HA_NOSAME) {
grn_table_delete_by_id(ctx, grn_index_tables[i], key_id[i]);
}
@@ -5497,7 +5908,7 @@ int ha_mroonga::wrapper_get_record_id(uchar *data, grn_id *record_id,
"%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,
+ push_warning(ha_thd(), MRN_SEVERITY_WARNING, error,
error_message);
}
grn_obj_unlink(ctx, &key);
@@ -5661,7 +6072,7 @@ int ha_mroonga::storage_update_row(const uchar *old_data, uchar *new_data)
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,
+ push_warning_printf(thd, MRN_SEVERITY_WARNING,
WARN_DATA_TRUNCATED, MRN_GET_ERR_MSG(WARN_DATA_TRUNCATED),
MRN_COLUMN_NAME_ID,
MRN_GET_CURRENT_ROW_FOR_WARNING(thd));
@@ -5719,7 +6130,7 @@ int ha_mroonga::storage_update_row(const uchar *old_data, uchar *new_data)
snprintf(message, MRN_BUFFER_SIZE,
"data truncated for primary key column: <%s>",
column_name);
- push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
+ push_warning(thd, MRN_SEVERITY_WARNING,
WARN_DATA_TRUNCATED, message);
}
have_pkey = true;
@@ -5914,6 +6325,13 @@ int ha_mroonga::storage_update_row_unique_indexes(uchar *new_data)
continue;
}
+ grn_obj *index_column = grn_index_columns[i];
+ if (!index_column) {
+ 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,
@@ -5926,7 +6344,8 @@ int ha_mroonga::storage_update_row_unique_indexes(uchar *new_data)
}
if ((error = storage_write_row_unique_index(new_data, key_info,
- index_table, &key_id[i])))
+ index_table, index_column,
+ &key_id[i])))
{
if (error == HA_ERR_FOUND_DUPP_KEY)
{
@@ -6276,28 +6695,40 @@ int ha_mroonga::delete_row(const uchar *buf)
DBUG_RETURN(error);
}
-uint ha_mroonga::wrapper_max_supported_key_parts()
+uint ha_mroonga::wrapper_max_supported_key_parts() const
{
MRN_DBUG_ENTER_METHOD();
DBUG_RETURN(MAX_REF_PARTS);
}
-uint ha_mroonga::storage_max_supported_key_parts()
+uint ha_mroonga::storage_max_supported_key_parts() const
{
MRN_DBUG_ENTER_METHOD();
- DBUG_RETURN(1);
+ DBUG_RETURN(MAX_REF_PARTS);
}
-uint ha_mroonga::max_supported_key_parts()
+uint ha_mroonga::max_supported_key_parts() const
{
MRN_DBUG_ENTER_METHOD();
+
uint parts;
- if (share->wrapper_mode)
- {
+ 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) {
+ parts = wrapper_max_supported_key_parts();
+ } else if (wrap_handler && share && share->wrapper_mode) {
parts = wrapper_max_supported_key_parts();
} else {
parts = storage_max_supported_key_parts();
}
+
DBUG_RETURN(parts);
}
@@ -6393,6 +6824,7 @@ ha_rows ha_mroonga::storage_records_in_range(uint key_nr, key_range *range_min,
}
}
+ int cursor_limit = THDVAR(ha_thd(), max_n_records_for_estimate);
uint pkey_nr = table->s->primary_key;
if (key_nr == pkey_nr) {
DBUG_PRINT("info", ("mroonga: use primary key"));
@@ -6400,7 +6832,7 @@ ha_rows ha_mroonga::storage_records_in_range(uint key_nr, key_range *range_min,
cursor = grn_table_cursor_open(ctx, grn_table,
key_min, size_min,
key_max, size_max,
- 0, -1, flags);
+ 0, cursor_limit, flags);
while (grn_table_cursor_next(ctx, cursor) != GRN_ID_NIL) {
row_count++;
}
@@ -6413,18 +6845,13 @@ ha_rows ha_mroonga::storage_records_in_range(uint key_nr, key_range *range_min,
}
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);
+ 0, cursor_limit, flags);
+ grn_obj *index_column = grn_index_columns[key_nr];
+ grn_ii *ii = reinterpret_cast<grn_ii *>(index_column);
+ row_count = grn_ii_estimate_size_for_lexicon_cursor(ctx, ii, cursor);
grn_table_cursor_close(ctx, cursor);
}
DBUG_RETURN(row_count);
@@ -6606,7 +7033,8 @@ int ha_mroonga::storage_index_read_map(uchar *buf, const uchar *key,
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);
+ uint key_length =
+ mrn_calculate_key_len(table, active_index, key, keypart_map);
DBUG_PRINT("info",
("mroonga: multiple column index: "
"search key length=<%u>, "
@@ -6624,6 +7052,10 @@ int ha_mroonga::storage_index_read_map(uchar *buf, const uchar *key,
storage_encode_multiple_column_key(&key_info,
key, key_length,
key_min, &size_min);
+ if (find_flag == HA_READ_KEY_EXACT) {
+ key_max = key_min;
+ size_max = size_min;
+ }
}
} else {
flags |= GRN_CURSOR_PREFIX;
@@ -6810,7 +7242,8 @@ int ha_mroonga::storage_index_read_last_map(uchar *buf, const uchar *key,
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);
+ uint key_length =
+ mrn_calculate_key_len(table, active_index, key, keypart_map);
key_min = key_min_entity;
storage_encode_multiple_column_key(&key_info,
key, key_length,
@@ -7422,7 +7855,8 @@ void ha_mroonga::generic_ft_init_ext_add_conditions_fast_order_limit(
{
MRN_DBUG_ENTER_METHOD();
- Item *where = table->pos_in_table_list->select_lex->where;
+ Item *where =
+ MRN_SELECT_LEX_GET_WHERE_COND(table->pos_in_table_list->select_lex);
bool is_storage_mode = !(share->wrapper_mode);
mrn::ConditionConverter converter(info->ctx, grn_table, is_storage_mode);
@@ -7594,6 +8028,37 @@ bool ha_mroonga::generic_ft_init_ext_parse_pragma_w(struct st_mrn_ft_info *info,
DBUG_RETURN(n_weights > 0);
}
+grn_expr_flags ha_mroonga::expr_flags_in_boolean_mode()
+{
+ MRN_DBUG_ENTER_METHOD();
+
+ ulonglong syntax_flags = MRN_BOOLEAN_MODE_SYNTAX_FLAG_DEFAULT;
+#ifdef MRN_SUPPORT_THDVAR_SET
+ syntax_flags = THDVAR(ha_thd(), boolean_mode_syntax_flags);
+#endif
+ grn_expr_flags expression_flags = 0;
+ if (syntax_flags == MRN_BOOLEAN_MODE_SYNTAX_FLAG_DEFAULT) {
+ expression_flags = GRN_EXPR_SYNTAX_QUERY | GRN_EXPR_ALLOW_LEADING_NOT;
+ } else {
+ if (syntax_flags & MRN_BOOLEAN_MODE_SYNTAX_FLAG_SYNTAX_SCRIPT) {
+ expression_flags |= GRN_EXPR_SYNTAX_SCRIPT;
+ } else {
+ expression_flags |= GRN_EXPR_SYNTAX_QUERY;
+ }
+ if (syntax_flags & MRN_BOOLEAN_MODE_SYNTAX_FLAG_ALLOW_COLUMN) {
+ expression_flags |= GRN_EXPR_ALLOW_COLUMN;
+ }
+ if (syntax_flags & MRN_BOOLEAN_MODE_SYNTAX_FLAG_ALLOW_UPDATE) {
+ expression_flags |= GRN_EXPR_ALLOW_UPDATE;
+ }
+ if (syntax_flags & MRN_BOOLEAN_MODE_SYNTAX_FLAG_ALLOW_LEADING_NOT) {
+ expression_flags |= GRN_EXPR_ALLOW_LEADING_NOT;
+ }
+ }
+
+ DBUG_RETURN(expression_flags);
+}
+
grn_rc ha_mroonga::generic_ft_init_ext_prepare_expression_in_boolean_mode(
struct st_mrn_ft_info *info,
String *key,
@@ -7674,12 +8139,10 @@ grn_rc ha_mroonga::generic_ft_init_ext_prepare_expression_in_boolean_mode(
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);
+ expr_flags_in_boolean_mode());
if (rc) {
char error_message[MRN_MESSAGE_BUFFER_SIZE];
snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE,
@@ -7859,7 +8322,7 @@ FT_INFO *ha_mroonga::generic_ft_init_ext(uint flags, uint key_nr, String *key)
for (int i = 0; i < n_sort_keys; i++) {
grn_obj_unlink(info->ctx, sort_keys[i].key);
}
- free(sort_keys);
+ my_free(sort_keys);
}
DBUG_RETURN((FT_INFO *)info);
@@ -8138,7 +8601,7 @@ void ha_mroonga::push_warning_unsupported_spatial_index_search(enum ha_rkey_func
sprintf(search_name, "unknown: %d", flag);
}
push_warning_printf(ha_thd(),
- Sql_condition::WARN_LEVEL_WARN,
+ MRN_SEVERITY_WARNING,
ER_UNSUPPORTED_EXTENSION,
"spatial index search "
"except MBRContains aren't supported: <%s>",
@@ -8351,7 +8814,8 @@ int ha_mroonga::drop_index(MRN_SHARE *target_share, uint 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));
+ target_name_length = strlen(target_name);
+ grn_obj *index_column = grn_ctx_get(ctx, target_name, target_name_length);
if (index_column) {
rc = grn_obj_remove(ctx, index_column);
}
@@ -8366,6 +8830,8 @@ int ha_mroonga::drop_index(MRN_SHARE *target_share, uint key_index)
target_name_length = grn_obj_name(ctx, index_table,
target_name, GRN_TABLE_MAX_KEY_SIZE);
rc = grn_obj_remove(ctx, index_table);
+ } else {
+ target_name_length = 0;
}
}
@@ -8401,7 +8867,7 @@ grn_obj *ha_mroonga::find_tokenizer(const char *name, int name_length)
name_length, name,
MRN_PARSER_DEFAULT);
push_warning(ha_thd(),
- Sql_condition::WARN_LEVEL_WARN, ER_UNSUPPORTED_EXTENSION,
+ MRN_SEVERITY_WARNING, ER_UNSUPPORTED_EXTENSION,
message);
tokenizer = grn_ctx_get(ctx,
MRN_PARSER_DEFAULT,
@@ -8409,7 +8875,7 @@ grn_obj *ha_mroonga::find_tokenizer(const char *name, int name_length)
}
if (!tokenizer) {
push_warning(ha_thd(),
- Sql_condition::WARN_LEVEL_WARN, ER_UNSUPPORTED_EXTENSION,
+ MRN_SEVERITY_WARNING, ER_UNSUPPORTED_EXTENSION,
"couldn't find fulltext parser. "
"Bigram fulltext parser is used instead.");
tokenizer = grn_ctx_at(ctx, GRN_DB_BIGRAM);
@@ -8421,6 +8887,7 @@ grn_obj *ha_mroonga::find_normalizer(KEY *key_info)
{
MRN_DBUG_ENTER_METHOD();
grn_obj *normalizer = NULL;
+ bool use_normalizer = true;
#if MYSQL_VERSION_ID >= 50500
if (key_info->comment.length > 0) {
mrn::ParametersParser parser(key_info->comment.str,
@@ -8428,11 +8895,15 @@ grn_obj *ha_mroonga::find_normalizer(KEY *key_info)
parser.parse();
const char *normalizer_name = parser["normalizer"];
if (normalizer_name) {
- normalizer = grn_ctx_get(ctx, normalizer_name, -1);
+ if (strcmp(normalizer_name, "none") == 0) {
+ use_normalizer = false;
+ } else {
+ normalizer = grn_ctx_get(ctx, normalizer_name, -1);
+ }
}
}
#endif
- if (!normalizer) {
+ if (use_normalizer && !normalizer) {
Field *field = key_info->key_part[0].field;
mrn::FieldNormalizer field_normalizer(ctx, ha_thd(), field);
normalizer = field_normalizer.find_grn_normalizer();
@@ -8440,6 +8911,28 @@ grn_obj *ha_mroonga::find_normalizer(KEY *key_info)
DBUG_RETURN(normalizer);
}
+bool ha_mroonga::find_index_column_flags(KEY *key_info, grn_obj_flags *index_column_flags)
+{
+ 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["index_flags"];
+ if (names) {
+ found = mrn_parse_grn_index_column_flags(ha_thd(),
+ ctx,
+ names,
+ strlen(names),
+ index_column_flags);
+ }
+ }
+#endif
+ DBUG_RETURN(found);
+}
+
bool ha_mroonga::find_token_filters(KEY *key_info, grn_obj *token_filters)
{
MRN_DBUG_ENTER_METHOD();
@@ -8476,7 +8969,7 @@ bool ha_mroonga::find_token_filters_put(grn_obj *token_filters,
"nonexistent token filter: <%.*s>",
token_filter_name_length, token_filter_name);
push_warning(ha_thd(),
- Sql_condition::WARN_LEVEL_WARN, ER_UNSUPPORTED_EXTENSION,
+ MRN_SEVERITY_WARNING, ER_UNSUPPORTED_EXTENSION,
message);
return false;
}
@@ -8536,7 +9029,7 @@ break_loop:
(int)(current - last_name_end), last_name_end,
(int)(end - current), current);
push_warning(ha_thd(),
- Sql_condition::WARN_LEVEL_WARN, ER_UNSUPPORTED_EXTENSION,
+ MRN_SEVERITY_WARNING, ER_UNSUPPORTED_EXTENSION,
message);
return false;
}
@@ -8808,9 +9301,9 @@ void ha_mroonga::check_count_skip(key_part_map start_key_part_map,
if (
thd_sql_command(ha_thd()) == SQLCOM_SELECT &&
- !select_lex->non_agg_fields.elements &&
+ select_lex->item_list.elements == 1 &&
!select_lex->group_list.elements &&
- !select_lex->having &&
+ !MRN_SELECT_LEX_GET_HAVING_COND(select_lex) &&
select_lex->table_list.elements == 1
) {
Item *info = (Item *) select_lex->item_list.first_node()->info;
@@ -8831,7 +9324,7 @@ void ha_mroonga::check_count_skip(key_part_map start_key_part_map,
Item *where;
if (fulltext) {
DBUG_PRINT("info", ("mroonga: count skip: fulltext"));
- where = select_lex->where;
+ where = MRN_SELECT_LEX_GET_WHERE_COND(select_lex);
if (!where ||
where->type() != Item::FUNC_ITEM ||
((Item_func *)where)->functype() != Item_func::FT_FUNC) {
@@ -8839,20 +9332,10 @@ void ha_mroonga::check_count_skip(key_part_map start_key_part_map,
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"));
+ if (select_lex->select_n_where_fields != 1) {
+ DBUG_PRINT("info",
+ ("mroonga: count skip: "
+ "where clause is not fulltext search only"));
count_skip = false;
DBUG_VOID_RETURN;
}
@@ -8875,10 +9358,29 @@ void ha_mroonga::check_count_skip(key_part_map start_key_part_map,
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)
+ for (where = MRN_SELECT_LEX_GET_WHERE_COND(select_lex);
+ where;
+ where = where->next) {
+ Item *target = where;
+
+ if (where->type() == Item::FUNC_ITEM) {
+ Item_func *func_item = static_cast<Item_func *>(where);
+ if (func_item->arg_count == 0) {
+ break;
+ }
+ target = func_item->key_item();
+ where = where->next;
+ if (func_item->arguments()[0] == where) {
+ uint n_args = func_item->arg_count;
+ for (; n_args > 0; --n_args) {
+ where = where->next;
+ }
+ }
+ }
+
+ if (target->type() == Item::FIELD_ITEM)
{
- Field *field = ((Item_field *)where)->field;
+ Field *field = ((Item_field *)target)->field;
if (!field)
break;
if (field->table != table)
@@ -8932,6 +9434,27 @@ bool ha_mroonga::is_grn_zero_column_value(grn_obj *column, grn_obj *value)
DBUG_RETURN(true);
}
+bool ha_mroonga::is_primary_key_field(Field *field) const
+{
+ MRN_DBUG_ENTER_METHOD();
+
+ if (table->s->primary_key == MAX_INDEXES) {
+ DBUG_RETURN(false);
+ }
+
+ KEY *key_info = &(table->s->key_info[table->s->primary_key]);
+ if (KEY_N_KEY_PARTS(key_info) != 1) {
+ DBUG_RETURN(false);
+ }
+
+ if (strcmp(field->field_name,
+ key_info->key_part[0].field->field_name) == 0) {
+ DBUG_RETURN(true);
+ } else {
+ DBUG_RETURN(false);
+ }
+}
+
void ha_mroonga::check_fast_order_limit(grn_table_sort_key **sort_keys,
int *n_sort_keys,
longlong *limit)
@@ -8946,7 +9469,7 @@ void ha_mroonga::check_fast_order_limit(grn_table_sort_key **sort_keys,
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;
+ SELECT_LEX_UNIT *unit = MRN_TABLE_LIST_GET_DERIVED(table_list);
st_select_lex *first_select_lex;
if (unit)
{
@@ -8956,13 +9479,13 @@ void ha_mroonga::check_fast_order_limit(grn_table_sort_key **sort_keys,
}
DBUG_PRINT("info",
("mroonga: first_select_lex->options=%llu",
- first_select_lex ? first_select_lex->options : 0));
+ first_select_lex ? MRN_SELECT_LEX_GET_ACTIVE_OPTIONS(first_select_lex) : 0));
if (
thd_sql_command(ha_thd()) == SQLCOM_SELECT &&
!select_lex->with_sum_func &&
!select_lex->group_list.elements &&
- !select_lex->having &&
+ !MRN_SELECT_LEX_GET_HAVING_COND(select_lex) &&
select_lex->table_list.elements == 1 &&
select_lex->order_list.elements &&
select_lex->explicit_limit &&
@@ -8983,17 +9506,18 @@ void ha_mroonga::check_fast_order_limit(grn_table_sort_key **sort_keys,
fast_order_limit = false;
DBUG_VOID_RETURN;
}
- if (first_select_lex && (first_select_lex->options & OPTION_FOUND_ROWS)) {
+ if (first_select_lex &&
+ (MRN_SELECT_LEX_GET_ACTIVE_OPTIONS(first_select_lex) & 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;
+ bool is_storage_mode = !(share->wrapper_mode);
+ Item *where = MRN_SELECT_LEX_GET_WHERE_COND(select_lex);
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",
@@ -9011,18 +9535,22 @@ void ha_mroonga::check_fast_order_limit(grn_table_sort_key **sort_keys,
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);
+ int n_max_sort_keys = select_lex->order_list.elements;
+ *n_sort_keys = 0;
+ size_t sort_keys_size = sizeof(grn_table_sort_key) * n_max_sort_keys;
+ *sort_keys = (grn_table_sort_key *)mrn_my_malloc(sort_keys_size,
+ MYF(MY_WME));
+ memset(*sort_keys, 0, sort_keys_size);
ORDER *order;
int i;
mrn_change_encoding(ctx, system_charset_info);
- for (order = (ORDER *) select_lex->order_list.first, i = 0; order;
+ 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)
+ if (item->type() == Item::FIELD_ITEM)
{
- Field *field = ((Item_field *) (*order->item))->field;
+ Field *field = static_cast<Item_field *>(item)->field;
const char *column_name = field->field_name;
int column_name_size = strlen(column_name);
@@ -9031,14 +9559,31 @@ void ha_mroonga::check_fast_order_limit(grn_table_sort_key **sort_keys,
DBUG_PRINT("info", ("mroonga: fast_order_limit = false: "
"sort by collated value isn't supported yet."));
fast_order_limit = false;
- free(*sort_keys);
+ my_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);
+ if (is_storage_mode) {
+ (*sort_keys)[i].key = grn_obj_column(ctx, matched_record_keys,
+ column_name, column_name_size);
+ } else {
+ if (is_primary_key_field(field)) {
+ (*sort_keys)[i].key = grn_obj_column(ctx, matched_record_keys,
+ MRN_COLUMN_NAME_KEY,
+ strlen(MRN_COLUMN_NAME_KEY));
+ } else {
+ DBUG_PRINT("info", ("mroonga: fast_order_limit = false: "
+ "sort by not primary key value "
+ "isn't supported in wrapper mode."));
+ fast_order_limit = false;
+ my_free(*sort_keys);
+ *sort_keys = NULL;
+ *n_sort_keys = 0;
+ DBUG_VOID_RETURN;
+ }
+ }
} else if (!match_against || match_against->eq(item, true)) {
(*sort_keys)[i].key = grn_obj_column(ctx, matched_record_keys,
MRN_COLUMN_NAME_SCORE,
@@ -9047,7 +9592,7 @@ void ha_mroonga::check_fast_order_limit(grn_table_sort_key **sort_keys,
DBUG_PRINT("info", ("mroonga: fast_order_limit = false: "
"sort by computed value isn't supported."));
fast_order_limit = false;
- free(*sort_keys);
+ my_free(*sort_keys);
*sort_keys = NULL;
*n_sort_keys = 0;
DBUG_VOID_RETURN;
@@ -9059,6 +9604,7 @@ void ha_mroonga::check_fast_order_limit(grn_table_sort_key **sort_keys,
} else {
(*sort_keys)[i].flags = GRN_TABLE_SORT_DESC;
}
+ (*n_sort_keys)++;
}
DBUG_PRINT("info", ("mroonga: fast_order_limit = true"));
fast_order_limit = true;
@@ -9087,7 +9633,8 @@ int ha_mroonga::generic_store_bulk_variable_size_string(Field *field,
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: length=%" MRN_FORMAT_STRING_LENGTH,
+ value.length()));
DBUG_PRINT("info", ("mroonga: value=%s", value.c_ptr_safe()));
GRN_TEXT_SET(ctx, buf, value.ptr(), value.length());
DBUG_RETURN(error);
@@ -9150,7 +9697,7 @@ int ha_mroonga::generic_store_bulk_integer(Field *field, grn_obj *buf)
"unknown integer value size: <%u>: "
"available sizes: [1, 2, 3, 4, 8]",
size);
- push_warning(ha_thd(), Sql_condition::WARN_LEVEL_WARN,
+ push_warning(ha_thd(), MRN_SEVERITY_WARNING,
error, error_message);
break;
}
@@ -9190,7 +9737,7 @@ int ha_mroonga::generic_store_bulk_unsigned_integer(Field *field, grn_obj *buf)
"unknown unsigned integer value size: <%u>: "
"available sizes: [1, 2, 3, 4, 8]",
size);
- push_warning(ha_thd(), Sql_condition::WARN_LEVEL_WARN,
+ push_warning(ha_thd(), MRN_SEVERITY_WARNING,
error, error_message);
break;
}
@@ -9217,7 +9764,7 @@ int ha_mroonga::generic_store_bulk_float(Field *field, grn_obj *buf)
"unknown float value size: <%u>: "
"available sizes: [4, 8]",
size);
- push_warning(ha_thd(), Sql_condition::WARN_LEVEL_WARN,
+ push_warning(ha_thd(), MRN_SEVERITY_WARNING,
error, error_message);
break;
}
@@ -9277,7 +9824,7 @@ int ha_mroonga::generic_store_bulk_date(Field *field, grn_obj *buf)
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,
+ field->set_warning(MRN_SEVERITY_WARNING,
WARN_DATA_TRUNCATED, 1);
}
grn_obj_reinit(ctx, buf, GRN_DB_TIME, 0);
@@ -9297,7 +9844,7 @@ int ha_mroonga::generic_store_bulk_time(Field *field, grn_obj *buf)
long long int time = time_converter.mysql_time_to_grn_time(&mysql_time,
&truncated);
if (truncated) {
- field->set_warning(Sql_condition::WARN_LEVEL_WARN,
+ field->set_warning(MRN_SEVERITY_WARNING,
WARN_DATA_TRUNCATED, 1);
}
grn_obj_reinit(ctx, buf, GRN_DB_TIME, 0);
@@ -9317,7 +9864,7 @@ int ha_mroonga::generic_store_bulk_datetime(Field *field, grn_obj *buf)
long long int time = time_converter.mysql_time_to_grn_time(&mysql_time,
&truncated);
if (truncated) {
- field->set_warning(Sql_condition::WARN_LEVEL_WARN,
+ field->set_warning(MRN_SEVERITY_WARNING,
WARN_DATA_TRUNCATED, 1);
}
grn_obj_reinit(ctx, buf, GRN_DB_TIME, 0);
@@ -9349,7 +9896,7 @@ int ha_mroonga::generic_store_bulk_year(Field *field, grn_obj *buf)
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,
+ field->set_warning(MRN_SEVERITY_WARNING,
WARN_DATA_TRUNCATED, 1);
}
grn_obj_reinit(ctx, buf, GRN_DB_TIME, 0);
@@ -9370,7 +9917,7 @@ int ha_mroonga::generic_store_bulk_datetime2(Field *field, grn_obj *buf)
long long int time = time_converter.mysql_time_to_grn_time(&mysql_time,
&truncated);
if (truncated) {
- field->set_warning(Sql_condition::WARN_LEVEL_WARN,
+ field->set_warning(MRN_SEVERITY_WARNING,
WARN_DATA_TRUNCATED, 1);
}
grn_obj_reinit(ctx, buf, GRN_DB_TIME, 0);
@@ -9391,7 +9938,7 @@ int ha_mroonga::generic_store_bulk_time2(Field *field, grn_obj *buf)
long long int time = time_converter.mysql_time_to_grn_time(&mysql_time,
&truncated);
if (truncated) {
- field->set_warning(Sql_condition::WARN_LEVEL_WARN,
+ field->set_warning(MRN_SEVERITY_WARNING,
WARN_DATA_TRUNCATED, 1);
}
grn_obj_reinit(ctx, buf, GRN_DB_TIME, 0);
@@ -9412,7 +9959,7 @@ int ha_mroonga::generic_store_bulk_new_date(Field *field, grn_obj *buf)
long long int time = time_converter.mysql_time_to_grn_time(&mysql_date,
&truncated);
if (truncated) {
- field->set_warning(Sql_condition::WARN_LEVEL_WARN,
+ field->set_warning(MRN_SEVERITY_WARNING,
WARN_DATA_TRUNCATED, 1);
}
grn_obj_reinit(ctx, buf, GRN_DB_TIME, 0);
@@ -9438,9 +9985,9 @@ int ha_mroonga::generic_store_bulk_blob(Field *field, grn_obj *buf)
int error = 0;
String buffer;
Field_blob *blob = (Field_blob *)field;
- const char *value = blob->val_str(0, &buffer)->ptr();
+ String *value = blob->val_str(0, &buffer);
grn_obj_reinit(ctx, buf, GRN_DB_TEXT, 0);
- GRN_TEXT_SET(ctx, buf, value, blob->get_length());
+ GRN_TEXT_SET(ctx, buf, value->ptr(), value->length());
DBUG_RETURN(error);
}
@@ -9448,11 +9995,12 @@ int ha_mroonga::generic_store_bulk_geometry(Field *field, grn_obj *buf)
{
MRN_DBUG_ENTER_METHOD();
int error = 0;
-#ifdef HAVE_SPATIAL
+#ifdef MRN_HAVE_SPATIAL
String buffer;
Field_geom *geometry = (Field_geom *)field;
- const char *wkb = geometry->val_str(0, &buffer)->ptr();
- int len = geometry->get_length();
+ String *value = geometry->val_str(0, &buffer);
+ const char *wkb = value->ptr();
+ int len = value->length();
error = mrn_set_geometry(ctx, buf, wkb, len);
#endif
DBUG_RETURN(error);
@@ -9633,7 +10181,7 @@ void ha_mroonga::storage_store_field_integer(Field *field,
"unknown integer value size: <%d>: "
"available sizes: [1, 2, 4, 8]",
value_length);
- push_warning(ha_thd(), Sql_condition::WARN_LEVEL_WARN,
+ push_warning(ha_thd(), MRN_SEVERITY_WARNING,
HA_ERR_UNSUPPORTED, error_message);
storage_store_field_string(field, value, value_length);
break;
@@ -9685,7 +10233,7 @@ void ha_mroonga::storage_store_field_unsigned_integer(Field *field,
"unknown integer value size: <%d>: "
"available sizes: [1, 2, 4, 8]",
value_length);
- push_warning(ha_thd(), Sql_condition::WARN_LEVEL_WARN,
+ push_warning(ha_thd(), MRN_SEVERITY_WARNING,
HA_ERR_UNSUPPORTED, error_message);
storage_store_field_string(field, value, value_length);
break;
@@ -9878,7 +10426,7 @@ void ha_mroonga::storage_store_field_geometry(Field *field,
uint value_length)
{
MRN_DBUG_ENTER_METHOD();
-#ifdef HAVE_SPATIAL
+#ifdef MRN_HAVE_SPATIAL
uchar wkb[SRID_SIZE + WKB_HEADER_SIZE + POINT_DATA_SIZE];
grn_geo_point *field_value = (grn_geo_point *)value;
int latitude, longitude;
@@ -9994,7 +10542,7 @@ void ha_mroonga::storage_store_field(Field *field,
}
}
-void ha_mroonga::storage_store_field_column(Field *field,
+void ha_mroonga::storage_store_field_column(Field *field, bool is_primary_key,
int nth_column, grn_id record_id)
{
MRN_DBUG_ENTER_METHOD();
@@ -10009,7 +10557,6 @@ void ha_mroonga::storage_store_field_column(Field *field,
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);
@@ -10042,7 +10589,15 @@ void ha_mroonga::storage_store_field_column(Field *field,
} 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));
+ if (is_primary_key && GRN_BULK_VSIZE(value) == 0) {
+ 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(field, GRN_BULK_HEAD(value), GRN_BULK_VSIZE(value));
+ }
}
DBUG_VOID_RETURN;
@@ -10056,9 +10611,11 @@ void ha_mroonga::storage_store_fields(uchar *buf, grn_id 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) {
+ if (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;
+ if (KEY_N_KEY_PARTS(key_info) == 1) {
+ primary_key_field = key_info->key_part[0].field;
+ }
}
int i;
@@ -10087,13 +10644,9 @@ void ha_mroonga::storage_store_fields(uchar *buf, grn_id 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);
+ storage_store_field_column(field, true, i, record_id);
} else {
- storage_store_field_column(field, i ,record_id);
+ storage_store_field_column(field, false, i, record_id);
}
field->move_field_offset(-ptr_diff);
}
@@ -10278,7 +10831,7 @@ int ha_mroonga::storage_encode_key_timestamp(Field *field, const uchar *key,
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,
+ field->set_warning(MRN_SEVERITY_WARNING,
WARN_DATA_TRUNCATED, 1);
}
memcpy(buf, &time, 8);
@@ -10325,7 +10878,7 @@ int ha_mroonga::storage_encode_key_time(Field *field, const uchar *key,
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,
+ field->set_warning(MRN_SEVERITY_WARNING,
WARN_DATA_TRUNCATED, 1);
}
#else
@@ -10360,7 +10913,7 @@ int ha_mroonga::storage_encode_key_year(Field *field, const uchar *key,
long long int time = time_converter.tm_to_grn_time(&datetime, usec,
&truncated);
if (truncated) {
- field->set_warning(Sql_condition::WARN_LEVEL_WARN,
+ field->set_warning(MRN_SEVERITY_WARNING,
WARN_DATA_TRUNCATED, 1);
}
memcpy(buf, &time, 8);
@@ -10409,7 +10962,7 @@ int ha_mroonga::storage_encode_key_datetime(Field *field, const uchar *key,
time = time_converter.tm_to_grn_time(&date, usec, &truncated);
}
if (truncated) {
- field->set_warning(Sql_condition::WARN_LEVEL_WARN,
+ field->set_warning(MRN_SEVERITY_WARNING,
WARN_DATA_TRUNCATED, 1);
}
memcpy(buf, &time, 8);
@@ -10435,7 +10988,7 @@ int ha_mroonga::storage_encode_key_timestamp2(Field *field, const uchar *key,
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,
+ field->set_warning(MRN_SEVERITY_WARNING,
WARN_DATA_TRUNCATED, 1);
}
memcpy(buf, &grn_time, 8);
@@ -10462,7 +11015,7 @@ int ha_mroonga::storage_encode_key_datetime2(Field *field, const uchar *key,
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,
+ field->set_warning(MRN_SEVERITY_WARNING,
WARN_DATA_TRUNCATED, 1);
}
memcpy(buf, &grn_time, 8);
@@ -10489,7 +11042,7 @@ int ha_mroonga::storage_encode_key_time2(Field *field, const uchar *key,
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,
+ field->set_warning(MRN_SEVERITY_WARNING,
WARN_DATA_TRUNCATED, 1);
}
memcpy(buf, &grn_time, 8);
@@ -10511,7 +11064,7 @@ int ha_mroonga::storage_encode_key_enum(Field *field, const uchar *key,
memcpy(buf, &value, *size);
} else {
uint16 value;
- shortget(value, key);
+ mrn::value_decoder::decode(&value, key);
*size = 2;
memcpy(buf, &value, *size);
}
@@ -10623,7 +11176,7 @@ int ha_mroonga::storage_encode_key(Field *field, const uchar *key,
{
float float_value;
double double_value;
- float4get(float_value, ptr);
+ mrn::value_decoder::decode(&float_value, ptr);
double_value = float_value;
memcpy(buf, &double_value, 8);
*size = 8;
@@ -10632,7 +11185,7 @@ int ha_mroonga::storage_encode_key(Field *field, const uchar *key,
case MYSQL_TYPE_DOUBLE:
{
double val;
- float8get(val, ptr);
+ mrn::value_decoder::decode(&val, ptr);
memcpy(buf, &val, 8);
*size = 8;
break;
@@ -10659,7 +11212,7 @@ int ha_mroonga::storage_encode_key(Field *field, const uchar *key,
long long int time = time_converter.tm_to_grn_time(&date, usec,
&truncated);
if (truncated) {
- field->set_warning(Sql_condition::WARN_LEVEL_WARN,
+ field->set_warning(MRN_SEVERITY_WARNING,
WARN_DATA_TRUNCATED, 1);
}
memcpy(buf, &time, 8);
@@ -10746,16 +11299,29 @@ 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<Item_func_match> iterator(*(select_lex->ftfunc_list));
- Item_func_match *item;
- while ((item = iterator++)) {
- if (item->ft_handler) {
- mrn_generic_ft_clear(item->ft_handler);
- }
+
+ if (thd_sql_command(ha_thd()) != SQLCOM_SELECT) {
+ DBUG_RETURN(error);
+ }
+
+ TABLE_LIST *table_list = table->pos_in_table_list;
+ if (!table_list) {
+ DBUG_RETURN(error);
+ }
+
+ st_select_lex *select_lex = table_list->select_lex;
+ if (!select_lex) {
+ DBUG_RETURN(error);
+ }
+
+ List_iterator<Item_func_match> 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);
}
@@ -10770,12 +11336,12 @@ int ha_mroonga::wrapper_reset()
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));
+ my_free(alter_key_info_buffer);
alter_key_info_buffer = NULL;
}
#else
if (wrap_alter_key_info) {
- my_free(wrap_alter_key_info, MYF(0));
+ my_free(wrap_alter_key_info);
wrap_alter_key_info = NULL;
}
#endif
@@ -11787,24 +12353,24 @@ void ha_mroonga::update_create_info(HA_CREATE_INFO* create_info)
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));
+ my_free(slot_data->alter_connect_string);
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));
+ mrn_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));
+ my_free(slot_data->alter_comment);
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));
+ mrn_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;
@@ -12117,14 +12683,15 @@ bool ha_mroonga::wrapper_is_crashed() const
bool ha_mroonga::storage_is_crashed() const
{
MRN_DBUG_ENTER_METHOD();
- bool crashed = handler::is_crashed();
+ mrn::DatabaseRepairer repairer(ctx, ha_thd());
+ bool crashed = repairer.is_crashed();
DBUG_RETURN(crashed);
}
bool ha_mroonga::is_crashed() const
{
MRN_DBUG_ENTER_METHOD();
- int crashed;
+ bool crashed;
if (share->wrapper_mode)
{
crashed = wrapper_is_crashed();
@@ -12136,52 +12703,90 @@ bool ha_mroonga::is_crashed() const
bool ha_mroonga::wrapper_auto_repair(int error) const
{
- bool crashed;
+ bool repaired;
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);
+ repaired = wrap_handler->auto_repair(error);
#else
- crashed = wrap_handler->auto_repair();
+ repaired = wrap_handler->auto_repair();
#endif
MRN_SET_BASE_SHARE_KEY(share, table->s);
MRN_SET_BASE_TABLE_KEY(this, table);
- DBUG_RETURN(crashed);
+ DBUG_RETURN(repaired);
}
bool ha_mroonga::storage_auto_repair(int error) const
{
MRN_DBUG_ENTER_METHOD();
- bool crashed;
+ bool repaired;
#ifdef MRN_HANDLER_AUTO_REPAIR_HAVE_ERROR
- crashed = handler::auto_repair(error);
+ repaired = handler::auto_repair(error);
#else
- crashed = handler::auto_repair();
+ repaired = handler::auto_repair();
#endif
- DBUG_RETURN(crashed);
+ DBUG_RETURN(repaired);
}
bool ha_mroonga::auto_repair(int error) const
{
MRN_DBUG_ENTER_METHOD();
- bool crashed;
+ bool repaired;
// 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);
+ repaired = wrapper_auto_repair(error);
} else {
- crashed = storage_auto_repair(error);
+ repaired = storage_auto_repair(error);
}
- DBUG_RETURN(crashed);
+ DBUG_RETURN(repaired);
}
bool ha_mroonga::auto_repair() const
{
MRN_DBUG_ENTER_METHOD();
- bool crashed = auto_repair(HA_ERR_CRASHED_ON_USAGE);
- DBUG_RETURN(crashed);
+ bool repaired = auto_repair(HA_ERR_CRASHED_ON_USAGE);
+ DBUG_RETURN(repaired);
+}
+
+int ha_mroonga::generic_disable_index(int i, KEY *key_info)
+{
+ MRN_DBUG_ENTER_METHOD();
+
+ int error = 0;
+ if (share->index_table[i]) {
+ char index_column_name[GRN_TABLE_MAX_KEY_SIZE];
+ snprintf(index_column_name, GRN_TABLE_MAX_KEY_SIZE - 1,
+ "%s.%s", share->index_table[i], key_info[i].name);
+ grn_obj *index_column = grn_ctx_get(ctx,
+ index_column_name,
+ strlen(index_column_name));
+ if (index_column) {
+ grn_obj_remove(ctx, index_column);
+ }
+ } else {
+ mrn::PathMapper mapper(share->table_name);
+ 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);
+ }
+ }
+ if (ctx->rc == GRN_SUCCESS) {
+ grn_index_tables[i] = NULL;
+ grn_index_columns[i] = NULL;
+ } else {
+ // TODO: Implement ctx->rc to error converter and use it.
+ error = ER_ERROR_ON_WRITE;
+ my_message(error, ctx->errbuf, MYF(0));
+ }
+
+ DBUG_RETURN(error);
}
int ha_mroonga::wrapper_disable_indexes(uint mode)
@@ -12212,23 +12817,16 @@ int ha_mroonga::wrapper_disable_indexes(uint mode)
}
}
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);
+ int sub_error = generic_disable_index(i, key_info);
+ if (error != 0 && sub_error != 0) {
+ error = sub_error;
}
- grn_index_tables[i] = NULL;
- grn_index_columns[i] = NULL;
}
} else {
error = HA_ERR_WRONG_COMMAND;
@@ -12239,6 +12837,7 @@ int ha_mroonga::wrapper_disable_indexes(uint mode)
int ha_mroonga::storage_disable_indexes(uint mode)
{
+ int error = 0;
MRN_DBUG_ENTER_METHOD();
if (mode == HA_KEY_SWITCH_NONUNIQ_SAVE || mode == HA_KEY_SWITCH_ALL) {
uint i;
@@ -12252,7 +12851,6 @@ int ha_mroonga::storage_disable_indexes(uint mode)
}
}
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;
@@ -12262,21 +12860,15 @@ int ha_mroonga::storage_disable_indexes(uint mode)
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);
+ int sub_error = generic_disable_index(i, key_info);
+ if (error != 0 && sub_error != 0) {
+ error = sub_error;
}
- grn_index_tables[i] = NULL;
- grn_index_columns[i] = NULL;
}
} else {
DBUG_RETURN(HA_ERR_WRONG_COMMAND);
}
- DBUG_RETURN(0);
+ DBUG_RETURN(error);
}
int ha_mroonga::disable_indexes(uint mode)
@@ -12305,7 +12897,7 @@ int ha_mroonga::wrapper_enable_indexes(uint mode)
if (share->wrap_key_nr[i] < MAX_KEY) {
continue;
}
- if (!grn_index_tables[i]) {
+ if (!grn_index_columns[i]) {
break;
}
}
@@ -12334,7 +12926,7 @@ int ha_mroonga::wrapper_enable_indexes(uint mode)
}
index_tables[i] = NULL;
index_columns[i] = NULL;
- if (!grn_index_tables[i]) {
+ if (!grn_index_columns[i]) {
if (
(key_info[i].flags & HA_FULLTEXT) &&
(error = wrapper_create_index_fulltext(mapper.table_name(),
@@ -12394,7 +12986,7 @@ int ha_mroonga::storage_enable_indexes(uint mode)
if (i == table->s->primary_key) {
continue;
}
- if (!grn_index_tables[i]) {
+ if (!grn_index_columns[i]) {
break;
}
}
@@ -12420,7 +13012,7 @@ int ha_mroonga::storage_enable_indexes(uint mode)
break;
}
index_tables[i] = NULL;
- if (!grn_index_tables[i]) {
+ if (!grn_index_columns[i]) {
if ((error = storage_create_index(table, mapper.table_name(), grn_table,
share, &key_info[i], index_tables,
index_columns, i)))
@@ -12434,6 +13026,8 @@ int ha_mroonga::storage_enable_indexes(uint mode)
mrn_set_bitmap_by_key(table->read_set, &key_info[i]);
have_multiple_column_index = true;
}
+ grn_index_tables[i] = index_tables[i];
+ grn_index_columns[i] = index_columns[i];
} else {
index_columns[i] = NULL;
}
@@ -12485,7 +13079,12 @@ int ha_mroonga::wrapper_check(THD* thd, HA_CHECK_OPT* check_opt)
int ha_mroonga::storage_check(THD* thd, HA_CHECK_OPT* check_opt)
{
MRN_DBUG_ENTER_METHOD();
- DBUG_RETURN(HA_ADMIN_NOT_IMPLEMENTED);
+ mrn::DatabaseRepairer repairer(ctx, thd);
+ if (repairer.repair()) {
+ DBUG_RETURN(HA_ADMIN_OK);
+ } else {
+ DBUG_RETURN(HA_ADMIN_CORRUPT);
+ }
}
int ha_mroonga::check(THD* thd, HA_CHECK_OPT* check_opt)
@@ -12654,6 +13253,58 @@ int ha_mroonga::wrapper_recreate_indexes(THD *thd)
DBUG_RETURN(error);
}
+int ha_mroonga::storage_recreate_indexes(THD *thd)
+{
+ MRN_DBUG_ENTER_METHOD();
+
+ if (share->disable_keys)
+ DBUG_RETURN(HA_ADMIN_OK);
+
+ clear_indexes();
+
+ int n_columns = table->s->fields;
+ for (int i = 0; i < n_columns; i++) {
+ grn_obj *column = grn_columns[i];
+
+ if (!column)
+ continue;
+
+ int n_hooks = grn_obj_get_nhooks(ctx, column, GRN_HOOK_SET);
+ for (int j = 0; j < n_hooks; j++) {
+ grn_obj_delete_hook(ctx, column, GRN_HOOK_SET, j);
+ }
+ }
+
+ uint n_keys = table_share->keys;
+ mrn::PathMapper mapper(table_share->normalized_path.str);
+ for (uint i = 0; i < n_keys; i++) {
+ if (share->index_table && share->index_table[i])
+ continue;
+
+ if (i == table_share->primary_key)
+ 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());
+ }
+
+ int error;
+ error = storage_create_indexes(table, mapper.table_name(), grn_table, share);
+ if (error)
+ DBUG_RETURN(HA_ADMIN_FAILED);
+
+ error = storage_open_indexes(table_share->normalized_path.str);
+ if (error)
+ DBUG_RETURN(HA_ADMIN_FAILED);
+
+ DBUG_RETURN(HA_ADMIN_OK);
+}
+
int ha_mroonga::wrapper_repair(THD* thd, HA_CHECK_OPT* check_opt)
{
int error;
@@ -12672,7 +13323,8 @@ int ha_mroonga::wrapper_repair(THD* thd, HA_CHECK_OPT* check_opt)
int ha_mroonga::storage_repair(THD* thd, HA_CHECK_OPT* check_opt)
{
MRN_DBUG_ENTER_METHOD();
- DBUG_RETURN(HA_ADMIN_NOT_IMPLEMENTED);
+ int error = storage_recreate_indexes(thd);
+ DBUG_RETURN(error);
}
int ha_mroonga::repair(THD* thd, HA_CHECK_OPT* check_opt)
@@ -12691,35 +13343,36 @@ int ha_mroonga::repair(THD* thd, HA_CHECK_OPT* check_opt)
bool ha_mroonga::wrapper_check_and_repair(THD *thd)
{
- // XXX: success is valid variable name?
- bool success;
+ bool is_error_or_not_supported;
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);
+ is_error_or_not_supported = 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);
+ DBUG_RETURN(is_error_or_not_supported);
}
bool ha_mroonga::storage_check_and_repair(THD *thd)
{
MRN_DBUG_ENTER_METHOD();
- DBUG_RETURN(true);
+ bool is_error = false;
+ mrn::DatabaseRepairer repairer(ctx, thd);
+ is_error = !repairer.repair();
+ DBUG_RETURN(is_error);
}
bool ha_mroonga::check_and_repair(THD *thd)
{
MRN_DBUG_ENTER_METHOD();
- // XXX: success is valid variable name?
- bool success;
+ bool is_error_or_not_supported;
if (share->wrapper_mode)
{
- success = wrapper_check_and_repair(thd);
+ is_error_or_not_supported = wrapper_check_and_repair(thd);
} else {
- success = storage_check_and_repair(thd);
+ is_error_or_not_supported = storage_check_and_repair(thd);
}
- DBUG_RETURN(success);
+ DBUG_RETURN(is_error_or_not_supported);
}
int ha_mroonga::wrapper_analyze(THD* thd, HA_CHECK_OPT* check_opt)
@@ -12784,7 +13437,11 @@ bool ha_mroonga::wrapper_is_fatal_error(int error_num, uint flags)
MRN_DBUG_ENTER_METHOD();
MRN_SET_WRAP_SHARE_KEY(share, table->s);
MRN_SET_WRAP_TABLE_KEY(this, table);
+#ifdef MRN_HANDLER_IS_FATAL_ERROR_HAVE_FLAGS
res = wrap_handler->is_fatal_error(error_num, flags);
+#else
+ res = wrap_handler->is_fatal_error(error_num);
+#endif
MRN_SET_BASE_SHARE_KEY(share, table->s);
MRN_SET_BASE_TABLE_KEY(this, table);
DBUG_RETURN(res);
@@ -12793,7 +13450,11 @@ bool ha_mroonga::wrapper_is_fatal_error(int error_num, uint flags)
bool ha_mroonga::storage_is_fatal_error(int error_num, uint flags)
{
MRN_DBUG_ENTER_METHOD();
+#ifdef MRN_HANDLER_IS_FATAL_ERROR_HAVE_FLAGS
bool is_fatal_error = handler::is_fatal_error(error_num, flags);
+#else
+ bool is_fatal_error = handler::is_fatal_error(error_num);
+#endif
DBUG_RETURN(is_fatal_error);
}
@@ -12902,6 +13563,7 @@ int ha_mroonga::storage_add_index_multiple_columns(KEY *key_info,
if ((error = storage_write_row_unique_index(table->record[0],
current_key_info,
index_tables[i],
+ index_columns[i],
&key_id)))
{
if (error == HA_ERR_FOUND_DUPP_KEY)
@@ -12958,7 +13620,9 @@ enum_alter_inplace_result ha_mroonga::wrapper_check_if_supported_inplace_alter(
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));
+ DBUG_PRINT("info",
+ ("mroonga: handler_flags=%lu",
+ static_cast<ulong>(ha_alter_info->handler_flags)));
if (wrapper_is_comment_changed(table, altered_table)) {
DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
@@ -12991,7 +13655,7 @@ enum_alter_inplace_result ha_mroonga::wrapper_check_if_supported_inplace_alter(
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),
+ mrn_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,
@@ -13086,8 +13750,6 @@ enum_alter_inplace_result ha_mroonga::storage_check_if_supported_inplace_alter(
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;
@@ -13204,7 +13866,7 @@ bool ha_mroonga::wrapper_inplace_alter_table(
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),
+ mrn_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),
@@ -13308,7 +13970,7 @@ bool ha_mroonga::wrapper_inplace_alter_table(
result = true;
}
mrn_free_share_alloc(tmp_share);
- my_free(tmp_share, MYF(0));
+ my_free(tmp_share);
MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_tables);
MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_columns);
DBUG_RETURN(result);
@@ -13353,7 +14015,7 @@ bool ha_mroonga::storage_inplace_alter_table_index(
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),
+ mrn_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,
@@ -13434,6 +14096,12 @@ bool ha_mroonga::storage_inplace_alter_table_index(
ha_alter_info->key_count,
index_tables,
index_columns, false);
+ if (error == HA_ERR_FOUND_DUPP_UNIQUE) {
+ my_printf_error(ER_DUP_UNIQUE, ER(ER_DUP_UNIQUE), MYF(0),
+ table_share->table_name);
+ } else if (error) {
+ my_message(error, "failed to create multiple column index", MYF(0));
+ }
for (i = 0; i < n_columns; ++i) {
Field *field = altered_table->field[i];
field->move_field_offset(-ptr_diff);
@@ -13460,7 +14128,7 @@ bool ha_mroonga::storage_inplace_alter_table_index(
have_error = true;
}
mrn_free_share_alloc(tmp_share);
- my_free(tmp_share, MYF(0));
+ my_free(tmp_share);
MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_tables);
MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_columns);
@@ -13481,7 +14149,7 @@ bool ha_mroonga::storage_inplace_alter_table_add_column(
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(
+ tmp_share = (MRN_SHARE *)mrn_my_multi_malloc(
MYF(MY_WME | MY_ZEROFILL),
&tmp_share, sizeof(*tmp_share),
&index_table, sizeof(char *) * tmp_table_share.keys,
@@ -13532,12 +14200,10 @@ bool ha_mroonga::storage_inplace_alter_table_add_column(
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;
- }
+ col_flags |= mrn_parse_grn_column_create_flags(ha_thd(),
+ ctx,
+ tmp_share->col_flags[i],
+ tmp_share->col_flags_length[i]);
} else {
col_flags |= GRN_OBJ_COLUMN_SCALAR;
}
@@ -13570,7 +14236,7 @@ bool ha_mroonga::storage_inplace_alter_table_add_column(
grn_obj_unlink(ctx, table_obj);
mrn_free_share_alloc(tmp_share);
- my_free(tmp_share, MYF(0));
+ my_free(tmp_share);
DBUG_RETURN(have_error);
}
@@ -13752,7 +14418,7 @@ bool ha_mroonga::wrapper_commit_inplace_alter_table(
bool result;
MRN_DBUG_ENTER_METHOD();
if (!alter_handler_flags) {
- my_free(alter_key_info_buffer, MYF(0));
+ my_free(alter_key_info_buffer);
alter_key_info_buffer = NULL;
DBUG_RETURN(false);
}
@@ -13765,7 +14431,7 @@ bool ha_mroonga::wrapper_commit_inplace_alter_table(
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));
+ my_free(alter_key_info_buffer);
alter_key_info_buffer = NULL;
DBUG_RETURN(result);
}
@@ -13875,8 +14541,8 @@ int ha_mroonga::wrapper_add_index(TABLE *table_arg, KEY *key_info,
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)))) {
+ if (!(wrap_alter_key_info = (KEY *) mrn_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);
@@ -13885,7 +14551,7 @@ int ha_mroonga::wrapper_add_index(TABLE *table_arg, KEY *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),
+ mrn_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),
@@ -13990,7 +14656,7 @@ int ha_mroonga::wrapper_add_index(TABLE *table_arg, KEY *key_info,
}
#endif
mrn_free_share_alloc(tmp_share);
- my_free(tmp_share, MYF(0));
+ my_free(tmp_share);
MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_tables);
MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_columns);
DBUG_RETURN(error);
@@ -14019,7 +14685,7 @@ int ha_mroonga::storage_add_index(TABLE *table_arg, KEY *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),
+ mrn_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,
@@ -14104,7 +14770,7 @@ int ha_mroonga::storage_add_index(TABLE *table_arg, KEY *key_info,
}
#endif
mrn_free_share_alloc(tmp_share);
- my_free(tmp_share, MYF(0));
+ my_free(tmp_share);
MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_tables);
MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_columns);
DBUG_RETURN(error);
@@ -14383,7 +15049,7 @@ void ha_mroonga::storage_get_auto_increment(ulonglong offset,
*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;
+ *nb_reserved_values = UINT_MAX64;
} else {
handler::get_auto_increment(offset, increment, nb_desired_values,
first_value, nb_reserved_values);
@@ -14531,6 +15197,7 @@ int ha_mroonga::check_for_upgrade(HA_CHECK_OPT *check_opt)
DBUG_RETURN(error);
}
+#ifdef MRN_HANDLER_HAVE_RESET_AUTO_INCREMENT
int ha_mroonga::wrapper_reset_auto_increment(ulonglong value)
{
int res;
@@ -14567,6 +15234,7 @@ int ha_mroonga::reset_auto_increment(ulonglong value)
}
DBUG_RETURN(res);
}
+#endif
void ha_mroonga::set_pk_bitmap()
{
@@ -14919,8 +15587,8 @@ char *ha_mroonga::storage_get_foreign_key_create_info()
}
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)))) {
+ if (!(create_info = (char *) mrn_my_malloc(create_info_str.length() + 1,
+ MYF(MY_WME)))) {
DBUG_RETURN(NULL);
}
memcpy(create_info, create_info_str.ptr(), create_info_str.length());
@@ -15277,7 +15945,7 @@ void ha_mroonga::wrapper_free_foreign_key_create_info(char* str)
void ha_mroonga::storage_free_foreign_key_create_info(char* str)
{
MRN_DBUG_ENTER_METHOD();
- my_free(str, MYF(0));
+ my_free(str);
DBUG_VOID_RETURN;
}
#else
diff --git a/storage/mroonga/ha_mroonga.hpp b/storage/mroonga/ha_mroonga.hpp
index 224abb09732..78d5c3d2465 100644
--- a/storage/mroonga/ha_mroonga.hpp
+++ b/storage/mroonga/ha_mroonga.hpp
@@ -98,7 +98,13 @@ extern "C" {
# define MRN_TABLE_LIST_INIT_REQUIRE_ALIAS
#endif
-#ifdef BIG_TABLES
+#if MYSQL_VERSION_ID >= 50706 && !defined(MRN_MARIADB_P)
+# define MRN_BIG_TABLES
+#elif defined(BIG_TABLES)
+# define MRN_BIG_TABLES
+#endif
+
+#ifdef MRN_BIG_TABLES
# define MRN_HA_ROWS_FORMAT "llu"
#else
# define MRN_HA_ROWS_FORMAT "lu"
@@ -145,6 +151,14 @@ extern "C" {
# define MRN_HAVE_TL_WRITE_ALLOW_READ
#endif
+#if MYSQL_VERSION_ID < 50706 || defined(MRN_MARIADB_P)
+# define MRN_HAVE_TL_WRITE_DELAYED
+#endif
+
+#if MYSQL_VERSION_ID >= 50706 && !defined(MRN_MARIADB_P)
+# define MRN_HAVE_TL_WRITE_CONCURRENT_DEFAULT
+#endif
+
#if (defined(MRN_MARIADB_P) && \
((MYSQL_VERSION_ID >= 50306 && MYSQL_VERSION_ID < 50500) || \
MYSQL_VERSION_ID >= 50523))
@@ -179,6 +193,44 @@ extern "C" {
# define MRN_HAVE_TDC_LOCK_TABLE_SHARE
#endif
+#ifdef MRN_MARIADB_P
+# if MYSQL_VERSION_ID >= 50542 && MYSQL_VERSION_ID < 100000
+# define MRN_SUPPORT_THDVAR_SET
+# elif MYSQL_VERSION_ID >= 100017
+# define MRN_SUPPORT_THDVAR_SET
+# endif
+#else
+# define MRN_SUPPORT_THDVAR_SET
+#endif
+
+#ifdef MRN_MARIADB_P
+# if MYSQL_VERSION_ID < 100000
+# define MRN_SUPPORT_PARTITION
+# endif
+#else
+# define MRN_SUPPORT_PARTITION
+#endif
+
+#if MYSQL_VERSION_ID >= 50706 && !defined(MRN_MARIADB_P)
+# define MRN_FLUSH_LOGS_HAVE_BINLOG_GROUP_FLUSH
+#endif
+
+#if MYSQL_VERSION_ID < 50706 || defined(MRN_MARIADB_P)
+# define MRN_HAVE_HTON_ALTER_TABLE_FLAGS
+#endif
+
+#if MYSQL_VERSION_ID >= 50706 && !defined(MRN_MARIADB_P)
+# define MRN_FOREIGN_KEY_USE_CONST_STRING
+#endif
+
+#if MYSQL_VERSION_ID < 50706 || defined(MRN_MARIADB_P)
+# define MRN_HANDLER_IS_FATAL_ERROR_HAVE_FLAGS
+#endif
+
+#if MYSQL_VERSION_ID < 50706 || defined(MRN_MARIADB_P)
+# define MRN_HANDLER_HAVE_RESET_AUTO_INCREMENT
+#endif
+
class ha_mroonga;
/* structs */
@@ -263,7 +315,6 @@ private:
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;
@@ -349,7 +400,7 @@ public:
uint max_supported_record_length() const;
uint max_supported_keys() const;
- uint max_supported_key_parts();
+ uint max_supported_key_parts() const;
uint max_supported_key_length() const;
uint max_supported_key_part_length() const;
@@ -449,7 +500,7 @@ public:
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 is_fatal_error(int error_num, uint flags=0);
bool check_if_incompatible_data(HA_CREATE_INFO *create_info,
uint table_changes);
#ifdef MRN_HANDLER_HAVE_CHECK_IF_SUPPORTED_INPLACE_ALTER
@@ -475,7 +526,9 @@ public:
void restore_auto_increment(ulonglong prev_insert_id);
void release_auto_increment();
int check_for_upgrade(HA_CHECK_OPT *check_opt);
+#ifdef MRN_HANDLER_HAVE_RESET_AUTO_INCREMENT
int reset_auto_increment(ulonglong value);
+#endif
bool was_semi_consistent_read();
void try_semi_consistent_read(bool yes);
void unlock_row();
@@ -557,6 +610,7 @@ private:
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_index_column_flags(KEY *key_info, grn_obj_flags *index_column_flags);
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,
@@ -580,6 +634,7 @@ private:
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);
+ bool is_primary_key_field(Field *field) const;
void check_fast_order_limit(grn_table_sort_key **sort_keys, int *n_sort_keys,
longlong *limit);
@@ -641,7 +696,7 @@ private:
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,
+ void storage_store_field_column(Field *field, bool is_primary_key,
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,
@@ -742,7 +797,6 @@ private:
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);
@@ -785,7 +839,9 @@ private:
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,
+ KEY *key_info,
+ grn_obj *index_table,
+ grn_obj *index_column,
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);
@@ -812,8 +868,8 @@ private:
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_parts() const;
+ uint storage_max_supported_key_parts() const;
uint wrapper_max_supported_key_length() const;
uint storage_max_supported_key_length() const;
uint wrapper_max_supported_key_part_length() const;
@@ -904,6 +960,7 @@ private:
grn_obj *match_columns,
uint *consumed_keyword_length,
grn_obj *tmp_objects);
+ grn_expr_flags expr_flags_in_boolean_mode();
grn_rc generic_ft_init_ext_prepare_expression_in_boolean_mode(
struct st_mrn_ft_info *info,
String *key,
@@ -1029,6 +1086,7 @@ private:
bool storage_is_crashed() const;
bool wrapper_auto_repair(int error) const;
bool storage_auto_repair(int error) const;
+ int generic_disable_index(int i, KEY *key_info);
int wrapper_disable_indexes(uint mode);
int storage_disable_indexes(uint mode);
int wrapper_enable_indexes(uint mode);
@@ -1038,6 +1096,7 @@ private:
int wrapper_fill_indexes(THD *thd, KEY *key_info,
grn_obj **index_columns, uint n_keys);
int wrapper_recreate_indexes(THD *thd);
+ int storage_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);
@@ -1129,8 +1188,10 @@ private:
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);
+#ifdef MRN_HANDLER_HAVE_RESET_AUTO_INCREMENT
int wrapper_reset_auto_increment(ulonglong value);
int storage_reset_auto_increment(ulonglong value);
+#endif
bool wrapper_was_semi_consistent_read();
bool storage_was_semi_consistent_read();
void wrapper_try_semi_consistent_read(bool yes);
diff --git a/storage/mroonga/lib/libmrn_need_mysql_sources.am b/storage/mroonga/lib/libmrn_need_mysql_sources.am
index bd852829467..575f38adbd1 100644
--- a/storage/mroonga/lib/libmrn_need_mysql_sources.am
+++ b/storage/mroonga/lib/libmrn_need_mysql_sources.am
@@ -24,4 +24,8 @@ libmrn_need_mysql_la_SOURCES = \
mrn_time_converter.cpp \
mrn_time_converter.hpp \
mrn_database_manager.cpp \
- mrn_database_manager.hpp
+ mrn_database_manager.hpp \
+ mrn_value_decoder.cpp \
+ mrn_value_decoder.hpp \
+ mrn_database_repairer.cpp \
+ mrn_database_repairer.hpp
diff --git a/storage/mroonga/lib/mrn_condition_converter.hpp b/storage/mroonga/lib/mrn_condition_converter.hpp
index 3cf97c62bbe..bb85f5cdef5 100644
--- a/storage/mroonga/lib/mrn_condition_converter.hpp
+++ b/storage/mroonga/lib/mrn_condition_converter.hpp
@@ -23,6 +23,8 @@
#include <groonga.h>
#include <mrn_mysql_compat.h>
+#include <item_cmpfunc.h>
+
namespace mrn {
class ConditionConverter {
public:
diff --git a/storage/mroonga/lib/mrn_database_manager.cpp b/storage/mroonga/lib/mrn_database_manager.cpp
index 52ec78fccc0..365f47337fa 100644
--- a/storage/mroonga/lib/mrn_database_manager.cpp
+++ b/storage/mroonga/lib/mrn_database_manager.cpp
@@ -26,6 +26,8 @@
#include "mrn_lock.hpp"
#include "mrn_path_mapper.hpp"
+#include <groonga/plugin.h>
+
// for debug
#define MRN_CLASS_NAME "mrn::DatabaseManager"
@@ -38,19 +40,19 @@
# define MRN_MKDIR(pathname, mode) mkdir((pathname), (mode))
#endif
+extern "C" {
+ grn_rc GRN_PLUGIN_IMPL_NAME_TAGGED(init, normalizers_mysql)(grn_ctx *ctx);
+ grn_rc GRN_PLUGIN_IMPL_NAME_TAGGED(register, normalizers_mysql)(grn_ctx *ctx);
+}
+
namespace mrn {
- DatabaseManager::DatabaseManager(grn_ctx *ctx)
+ DatabaseManager::DatabaseManager(grn_ctx *ctx, mysql_mutex_t *mutex)
: ctx_(ctx),
cache_(NULL),
- mutex_(),
- mutex_initialized_(false) {
+ mutex_(mutex) {
}
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, {
@@ -75,13 +77,6 @@ namespace mrn {
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);
}
@@ -92,7 +87,7 @@ namespace mrn {
*db = NULL;
mrn::PathMapper mapper(path);
- mrn::Lock lock(&mutex_);
+ mrn::Lock lock(mutex_);
error = mrn::encoding::set(ctx_, system_charset_info);
if (error) {
@@ -145,7 +140,7 @@ namespace mrn {
MRN_DBUG_ENTER_METHOD();
mrn::PathMapper mapper(path);
- mrn::Lock lock(&mutex_);
+ mrn::Lock lock(mutex_);
grn_id id;
void *db_address;
@@ -171,7 +166,7 @@ namespace mrn {
MRN_DBUG_ENTER_METHOD();
mrn::PathMapper mapper(path);
- mrn::Lock lock(&mutex_);
+ mrn::Lock lock(mutex_);
grn_id id;
void *db_address;
@@ -211,7 +206,7 @@ namespace mrn {
int error = 0;
- mrn::Lock lock(&mutex_);
+ mrn::Lock lock(mutex_);
grn_hash_cursor *cursor;
cursor = grn_hash_cursor_open(ctx_, cache_,
@@ -323,15 +318,12 @@ namespace mrn {
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
+# ifdef MRN_GROONGA_NORMALIZER_MYSQL_EMBED
+ GRN_PLUGIN_IMPL_NAME_TAGGED(init, normalizers_mysql)(ctx_);
+ GRN_PLUGIN_IMPL_NAME_TAGGED(register, normalizers_mysql)(ctx_);
+# else
grn_plugin_register(ctx_, GROONGA_NORMALIZER_MYSQL_PLUGIN_NAME);
-#endif
+# endif
}
}
#endif
diff --git a/storage/mroonga/lib/mrn_database_manager.hpp b/storage/mroonga/lib/mrn_database_manager.hpp
index 46bce7ab1a5..76c76dab6d5 100644
--- a/storage/mroonga/lib/mrn_database_manager.hpp
+++ b/storage/mroonga/lib/mrn_database_manager.hpp
@@ -27,7 +27,7 @@
namespace mrn {
class DatabaseManager {
public:
- DatabaseManager(grn_ctx *ctx);
+ DatabaseManager(grn_ctx *ctx, mysql_mutex_t *mutex);
~DatabaseManager(void);
bool init(void);
int open(const char *path, grn_obj **db);
@@ -38,8 +38,7 @@ namespace mrn {
private:
grn_ctx *ctx_;
grn_hash *cache_;
- pthread_mutex_t mutex_;
- bool mutex_initialized_;
+ mysql_mutex_t *mutex_;
void mkdir_p(const char *directory);
void ensure_database_directory(void);
diff --git a/storage/mroonga/lib/mrn_database_repairer.cpp b/storage/mroonga/lib/mrn_database_repairer.cpp
new file mode 100644
index 00000000000..151330c9999
--- /dev/null
+++ b/storage/mroonga/lib/mrn_database_repairer.cpp
@@ -0,0 +1,246 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should 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>
+#include <mrn_mysql_compat.h>
+#include <mrn_constants.hpp>
+
+#include "mrn_database_repairer.hpp"
+#include "mrn_path_mapper.hpp"
+
+// for debug
+#define MRN_CLASS_NAME "mrn::DatabaseRepairer"
+
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <errno.h>
+
+#ifndef WIN32
+# include <dirent.h>
+#endif
+
+namespace mrn {
+ DatabaseRepairer::DatabaseRepairer(grn_ctx *ctx, THD *thd)
+ : ctx_(ctx),
+ thd_(thd),
+ base_directory_(NULL),
+ base_directory_buffer_(),
+ path_prefix_(NULL),
+ path_prefix_buffer_(),
+ path_prefix_length_(0),
+ mrn_db_file_suffix_length_(strlen(MRN_DB_FILE_SUFFIX)) {
+ }
+
+ DatabaseRepairer::~DatabaseRepairer() {
+ }
+
+ bool DatabaseRepairer::is_crashed(void) {
+ MRN_DBUG_ENTER_METHOD();
+
+ bool is_crashed = false;
+ each_database(&DatabaseRepairer::is_crashed_body, &is_crashed);
+
+ DBUG_RETURN(is_crashed);
+ }
+
+ bool DatabaseRepairer::repair(void) {
+ MRN_DBUG_ENTER_METHOD();
+
+ bool succeeded = true;
+ each_database(&DatabaseRepairer::repair_body, &succeeded);
+
+ DBUG_RETURN(succeeded);
+ }
+
+ void DatabaseRepairer::each_database(EachBodyFunc each_body_func,
+ void *user_data) {
+ MRN_DBUG_ENTER_METHOD();
+
+ detect_paths();
+
+#ifdef WIN32
+ WIN32_FIND_DATA data;
+ HANDLE finder = FindFirstFile(base_directory_, &data);
+ if (finder == INVALID_HANDLE_VALUE) {
+ DBUG_VOID_RETURN;
+ }
+
+ do {
+ each_database_body(data.cFileName, each_body_func, user_data);
+ } while (FindNextFile(finder, &data) != 0);
+ FindClose(finder);
+#else
+ DIR *dir = opendir(base_directory_);
+ if (!dir) {
+ DBUG_VOID_RETURN;
+ }
+
+ while (struct dirent *entry = readdir(dir)) {
+ each_database_body(entry->d_name, each_body_func, user_data);
+ }
+ closedir(dir);
+#endif
+
+ DBUG_VOID_RETURN;
+ }
+
+ void DatabaseRepairer::each_database_body(const char *base_path,
+ EachBodyFunc each_body_func,
+ void *user_data) {
+ MRN_DBUG_ENTER_METHOD();
+
+ if (path_prefix_length_ > 0 &&
+ strncmp(base_path, path_prefix_, path_prefix_length_) != 0) {
+ DBUG_VOID_RETURN;
+ }
+
+ size_t path_length = strlen(base_path);
+ if (path_length <= mrn_db_file_suffix_length_) {
+ DBUG_VOID_RETURN;
+ }
+
+ if (strncmp(base_path + (path_length - mrn_db_file_suffix_length_),
+ MRN_DB_FILE_SUFFIX, mrn_db_file_suffix_length_) != 0) {
+ DBUG_VOID_RETURN;
+ }
+
+ char db_path[MRN_MAX_PATH_SIZE];
+ snprintf(db_path, MRN_MAX_PATH_SIZE,
+ "%s%c%s", base_directory_, FN_LIBCHAR, base_path);
+ grn_obj *db = grn_db_open(ctx_, db_path);
+ if (!db) {
+ DBUG_VOID_RETURN;
+ }
+
+ (this->*each_body_func)(db, db_path, user_data);
+
+ grn_obj_close(ctx_, db);
+
+ DBUG_VOID_RETURN;
+ }
+
+ void DatabaseRepairer::detect_paths(void) {
+ MRN_DBUG_ENTER_METHOD();
+
+ const char *raw_path_prefix = mrn::PathMapper::default_path_prefix;
+
+ if (!raw_path_prefix) {
+ base_directory_ = ".";
+ path_prefix_ = NULL;
+ DBUG_VOID_RETURN;
+ }
+
+ strcpy(base_directory_buffer_, raw_path_prefix);
+ size_t raw_path_prefix_length = strlen(raw_path_prefix);
+ size_t separator_position = raw_path_prefix_length;
+ for (; separator_position > 0; separator_position--) {
+ if (base_directory_buffer_[separator_position] == FN_LIBCHAR ||
+ base_directory_buffer_[separator_position] == FN_LIBCHAR2) {
+ break;
+ }
+ }
+ if (separator_position == 0 ||
+ separator_position == raw_path_prefix_length) {
+ base_directory_ = ".";
+ } else {
+ base_directory_buffer_[separator_position] = '\0';
+ base_directory_ = base_directory_buffer_;
+ strcpy(path_prefix_buffer_, raw_path_prefix + separator_position + 1);
+ path_prefix_ = path_prefix_buffer_;
+ path_prefix_length_ = strlen(path_prefix_);
+ }
+
+ DBUG_VOID_RETURN;
+ }
+
+ void DatabaseRepairer::is_crashed_body(grn_obj *db,
+ const char *db_path,
+ void *user_data) {
+ MRN_DBUG_ENTER_METHOD();
+
+ bool *is_crashed = static_cast<bool *>(user_data);
+
+ if (grn_obj_is_locked(ctx_, db)) {
+ *is_crashed = true;
+ DBUG_VOID_RETURN;
+ }
+
+ grn_table_cursor *cursor;
+ cursor = grn_table_cursor_open(ctx_, db,
+ NULL, 0,
+ NULL, 0,
+ 0, -1, GRN_CURSOR_BY_ID);
+ if (!cursor) {
+ *is_crashed = true;
+ DBUG_VOID_RETURN;
+ }
+
+ grn_id id;
+ while ((id = grn_table_cursor_next(ctx_, cursor)) != GRN_ID_NIL) {
+ grn_obj *object = grn_ctx_at(ctx_, id);
+
+ if (!object) {
+ continue;
+ }
+
+ switch (object->header.type) {
+ case GRN_TABLE_HASH_KEY :
+ case GRN_TABLE_PAT_KEY:
+ case GRN_TABLE_DAT_KEY:
+ case GRN_TABLE_NO_KEY:
+ case GRN_COLUMN_FIX_SIZE:
+ case GRN_COLUMN_VAR_SIZE:
+ case GRN_COLUMN_INDEX:
+ grn_obj_is_locked(ctx_, object);
+ *is_crashed = true;
+ break;
+ default:
+ break;
+ }
+
+ grn_obj_unlink(ctx_, object);
+
+ if (*is_crashed) {
+ break;
+ }
+ }
+ grn_table_cursor_close(ctx_, cursor);
+
+ DBUG_VOID_RETURN;
+ }
+
+ void DatabaseRepairer::repair_body(grn_obj *db,
+ const char *db_path,
+ void *user_data) {
+ MRN_DBUG_ENTER_METHOD();
+
+ bool *succeeded = static_cast<bool *>(user_data);
+ if (grn_db_recover(ctx_, db) != GRN_SUCCESS) {
+ push_warning_printf(thd_,
+ Sql_condition::WARN_LEVEL_WARN,
+ ER_NOT_KEYFILE,
+ "mroonga: repair: "
+ "Failed to recover database: <%s>: <%s>",
+ db_path, ctx_->errbuf);
+ *succeeded = false;
+ }
+
+ DBUG_VOID_RETURN;
+ }
+}
diff --git a/storage/mroonga/lib/mrn_database_repairer.hpp b/storage/mroonga/lib/mrn_database_repairer.hpp
new file mode 100644
index 00000000000..12e2bbc9c79
--- /dev/null
+++ b/storage/mroonga/lib/mrn_database_repairer.hpp
@@ -0,0 +1,58 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should 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_REPAIRER_HPP_
+#define MRN_DATABASE_REPAIRER_HPP_
+
+#include <groonga.h>
+
+namespace mrn {
+ class DatabaseRepairer {
+ public:
+ DatabaseRepairer(grn_ctx *ctx, THD *thd);
+ ~DatabaseRepairer(void);
+ bool is_crashed(void);
+ bool repair(void);
+
+ private:
+ grn_ctx *ctx_;
+ THD *thd_;
+ const char *base_directory_;
+ char base_directory_buffer_[MRN_MAX_PATH_SIZE];
+ const char *path_prefix_;
+ char path_prefix_buffer_[MRN_MAX_PATH_SIZE];
+ size_t path_prefix_length_;
+ size_t mrn_db_file_suffix_length_;
+
+ typedef void (DatabaseRepairer::*EachBodyFunc)(grn_obj *db,
+ const char *db_path,
+ void *user_data);
+
+ void each_database(EachBodyFunc each_body_func, void *user_data);
+ void each_database_body(const char *base_path,
+ EachBodyFunc each_body_func,
+ void *user_data);
+ void detect_paths(void);
+
+ void is_crashed_body(grn_obj *db, const char *db_path, void *user_data);
+ void repair_body(grn_obj *db, const char *db_path, void *user_data);
+ };
+}
+
+#endif /* MRN_DATABASE_REPAIRER_HPP_ */
diff --git a/storage/mroonga/lib/mrn_encoding.cpp b/storage/mroonga/lib/mrn_encoding.cpp
index f6f66758b2f..35b8909fba2 100644
--- a/storage/mroonga/lib/mrn_encoding.cpp
+++ b/storage/mroonga/lib/mrn_encoding.cpp
@@ -18,6 +18,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <mrn_mysql.h>
#include <mrn_err.h>
#include "mrn_encoding.hpp"
diff --git a/storage/mroonga/lib/mrn_field_normalizer.cpp b/storage/mroonga/lib/mrn_field_normalizer.cpp
index c34f9975e37..f0b9d921599 100644
--- a/storage/mroonga/lib/mrn_field_normalizer.cpp
+++ b/storage/mroonga/lib/mrn_field_normalizer.cpp
@@ -17,6 +17,8 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <mrn_mysql.h>
+
#include "mrn_field_normalizer.hpp"
#include "mrn_encoding.hpp"
@@ -114,6 +116,9 @@ namespace mrn {
} else if ((strcmp(charset_info->name, "utf8_unicode_ci") == 0) ||
(strcmp(charset_info->name, "utf8mb4_unicode_ci") == 0)) {
normalizer_name = "NormalizerMySQLUnicodeCI";
+ } else if ((strcmp(charset_info->name, "utf8_unicode_520_ci") == 0) ||
+ (strcmp(charset_info->name, "utf8mb4_unicode_520_ci") == 0)) {
+ normalizer_name = "NormalizerMySQLUnicode520CI";
}
grn_obj *normalizer = NULL;
@@ -128,7 +133,7 @@ namespace mrn {
normalizer_name,
charset_info->name,
default_normalizer_name);
- push_warning(thread_, Sql_condition::WARN_LEVEL_WARN,
+ push_warning(thread_, MRN_SEVERITY_WARNING,
HA_ERR_UNSUPPORTED, error_message);
}
}
diff --git a/storage/mroonga/lib/mrn_lock.cpp b/storage/mroonga/lib/mrn_lock.cpp
index 94f8a4774af..3340149b237 100644
--- a/storage/mroonga/lib/mrn_lock.cpp
+++ b/storage/mroonga/lib/mrn_lock.cpp
@@ -20,12 +20,12 @@
#include "mrn_lock.hpp"
namespace mrn {
- Lock::Lock(pthread_mutex_t *mutex)
+ Lock::Lock(mysql_mutex_t *mutex)
: mutex_(mutex) {
- pthread_mutex_lock(mutex_);
+ mysql_mutex_lock(mutex_);
}
Lock::~Lock() {
- pthread_mutex_unlock(mutex_);
+ mysql_mutex_unlock(mutex_);
}
}
diff --git a/storage/mroonga/lib/mrn_lock.hpp b/storage/mroonga/lib/mrn_lock.hpp
index 31dd7b3e53b..08e47b39c58 100644
--- a/storage/mroonga/lib/mrn_lock.hpp
+++ b/storage/mroonga/lib/mrn_lock.hpp
@@ -26,10 +26,10 @@
namespace mrn {
class Lock {
public:
- Lock(pthread_mutex_t *mutex);
+ Lock(mysql_mutex_t *mutex);
~Lock();
private:
- pthread_mutex_t *mutex_;
+ mysql_mutex_t *mutex_;
};
}
diff --git a/storage/mroonga/lib/mrn_multiple_column_key_codec.cpp b/storage/mroonga/lib/mrn_multiple_column_key_codec.cpp
index 5ce736a49b8..1e55636f1bc 100644
--- a/storage/mroonga/lib/mrn_multiple_column_key_codec.cpp
+++ b/storage/mroonga/lib/mrn_multiple_column_key_codec.cpp
@@ -1,6 +1,6 @@
/* -*- c-basic-offset: 2 -*- */
/*
- Copyright(C) 2012-2014 Kouhei Sutou <kou@clear-code.com>
+ Copyright(C) 2012-2015 Kouhei Sutou <kou@clear-code.com>
Copyright(C) 2013 Kentoku SHIBA
This library is free software; you can redistribute it and/or
@@ -23,6 +23,7 @@
#include "mrn_multiple_column_key_codec.hpp"
#include "mrn_field_normalizer.hpp"
#include "mrn_smart_grn_obj.hpp"
+#include "mrn_value_decoder.hpp"
// for debug
#define MRN_CLASS_NAME "mrn::MultipleColumnKeyCodec"
@@ -121,14 +122,14 @@ namespace mrn {
case TYPE_FLOAT:
{
float value;
- float4get(value, current_mysql_key);
+ value_decoder::decode(&value, current_mysql_key);
encode_float(value, data_size, current_grn_key);
}
break;
case TYPE_DOUBLE:
{
double value;
- float8get(value, current_mysql_key);
+ value_decoder::decode(&value, current_mysql_key);
encode_double(value, data_size, current_grn_key);
}
break;
@@ -523,7 +524,7 @@ namespace mrn {
new_blob_data_length = normalized_length;
} else {
push_warning_printf(thread_,
- Sql_condition::WARN_LEVEL_WARN,
+ MRN_SEVERITY_WARNING,
WARN_DATA_TRUNCATED,
"normalized data truncated "
"for multiple column index: "
diff --git a/storage/mroonga/lib/mrn_parameters_parser.cpp b/storage/mroonga/lib/mrn_parameters_parser.cpp
index 9a05097e548..bc075b07068 100644
--- a/storage/mroonga/lib/mrn_parameters_parser.cpp
+++ b/storage/mroonga/lib/mrn_parameters_parser.cpp
@@ -1,7 +1,7 @@
/* -*- c-basic-offset: 2 -*- */
/*
Copyright(C) 2011-2013 Kentoku SHIBA
- Copyright(C) 2011-2013 Kouhei Sutou <kou@clear-code.com>
+ Copyright(C) 2011-2015 Kouhei Sutou <kou@clear-code.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -21,6 +21,7 @@
#include "mrn_parameters_parser.hpp"
#include <mrn_mysql_compat.h>
+#include <mrn_variables.hpp>
namespace mrn {
class Parameter {
@@ -30,15 +31,15 @@ namespace mrn {
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))) {
+ : key_(mrn_my_strndup(key, key_length, MYF(0))),
+ value_(mrn_my_strndup(value, value_length, MYF(0))) {
};
~Parameter() {
if (key_) {
- my_free(key_, MYF(0));
+ my_free(key_);
}
if (value_) {
- my_free(value_, MYF(0));
+ my_free(value_);
}
};
};
diff --git a/storage/mroonga/lib/mrn_path_mapper.cpp b/storage/mroonga/lib/mrn_path_mapper.cpp
index ee5432f16bb..7a595986f01 100644
--- a/storage/mroonga/lib/mrn_path_mapper.cpp
+++ b/storage/mroonga/lib/mrn_path_mapper.cpp
@@ -2,7 +2,7 @@
/*
Copyright(C) 2010 Tetsuro IKEDA
Copyright(C) 2011-2013 Kentoku SHIBA
- Copyright(C) 2011-2012 Kouhei Sutou <kou@clear-code.com>
+ Copyright(C) 2011-2015 Kouhei Sutou <kou@clear-code.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -29,16 +29,17 @@ namespace mrn {
char *PathMapper::default_path_prefix = NULL;
char *PathMapper::default_mysql_data_home_path = NULL;
- PathMapper::PathMapper(const char *mysql_path,
+ PathMapper::PathMapper(const char *original_mysql_path,
const char *path_prefix,
const char *mysql_data_home_path)
- : mysql_path_(mysql_path),
+ : original_mysql_path_(original_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';
+ mysql_path_[0] = '\0';
}
/**
@@ -52,22 +53,25 @@ namespace mrn {
return db_path_;
}
- if (mysql_path_[0] == FN_CURLIB && mysql_path_[1] == FN_LIBCHAR) {
+ if (original_mysql_path_[0] == FN_CURLIB &&
+ original_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++];
+ len = strlen(original_mysql_path_);
+ while (original_mysql_path_[i] != FN_LIBCHAR && i < len) {
+ db_path_[j++] = original_mysql_path_[i++];
}
db_path_[j] = '\0';
} else if (mysql_data_home_path_) {
- int len = strlen(mysql_path_);
+ int len = strlen(original_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)) {
+ !strncmp(original_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_);
@@ -87,19 +91,19 @@ namespace mrn {
}
}
- while (mysql_path_[i] != FN_LIBCHAR && i < len) {
- db_path_[j++] = mysql_path_[i++];
+ while (original_mysql_path_[i] != FN_LIBCHAR && i < len) {
+ db_path_[j++] = original_mysql_path_[i++];
}
if (i == len) {
- memcpy(db_path_, mysql_path_, len);
+ memcpy(db_path_, original_mysql_path_, len);
} else {
db_path_[j] = '\0';
}
} else {
- strcpy(db_path_, mysql_path_);
+ strcpy(db_path_, original_mysql_path_);
}
} else {
- strcpy(db_path_, mysql_path_);
+ strcpy(db_path_, original_mysql_path_);
}
strcat(db_path_, MRN_DB_FILE_SUFFIX);
return db_path_;
@@ -116,32 +120,35 @@ namespace mrn {
return db_name_;
}
- if (mysql_path_[0] == FN_CURLIB && mysql_path_[1] == FN_LIBCHAR) {
+ if (original_mysql_path_[0] == FN_CURLIB &&
+ original_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++];
+ len = strlen(original_mysql_path_);
+ while (original_mysql_path_[i] != FN_LIBCHAR && i < len) {
+ db_name_[j++] = original_mysql_path_[i++];
}
db_name_[j] = '\0';
} else if (mysql_data_home_path_) {
- int len = strlen(mysql_path_);
+ int len = strlen(original_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)) {
+ !strncmp(original_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++];
+ while (original_mysql_path_[i] != FN_LIBCHAR && i < len) {
+ db_name_[j++] = original_mysql_path_[i++];
}
if (i == len) {
- memcpy(db_name_, mysql_path_, len);
+ memcpy(db_name_, original_mysql_path_, len);
} else {
db_name_[j] = '\0';
}
} else {
- strcpy(db_name_, mysql_path_);
+ strcpy(db_name_, original_mysql_path_);
}
} else {
- strcpy(db_name_, mysql_path_);
+ strcpy(db_name_, original_mysql_path_);
}
return db_name_;
}
@@ -154,10 +161,10 @@ namespace mrn {
return table_name_;
}
- int len = strlen(mysql_path_);
+ int len = strlen(original_mysql_path_);
int i = len, j = 0;
- for (; mysql_path_[--i] != FN_LIBCHAR ;) {}
- if (mysql_path_[i + 1] == '_') {
+ for (; original_mysql_path_[--i] != FN_LIBCHAR ;) {}
+ if (original_mysql_path_[i + 1] == '_') {
table_name_[j++] = '@';
table_name_[j++] = '0';
table_name_[j++] = '0';
@@ -166,7 +173,7 @@ namespace mrn {
i++;
}
for (; i < len ;) {
- table_name_[j++] = mysql_path_[++i];
+ table_name_[j++] = original_mysql_path_[++i];
}
table_name_[j] = '\0';
return table_name_;
@@ -180,13 +187,39 @@ namespace mrn {
return mysql_table_name_;
}
- int len = strlen(mysql_path_);
+ int len = strlen(original_mysql_path_);
int i = len, j = 0;
- for (; mysql_path_[--i] != FN_LIBCHAR ;) {}
+ for (; original_mysql_path_[--i] != FN_LIBCHAR ;) {}
for (; i < len ;) {
- mysql_table_name_[j++] = mysql_path_[++i];
+ if (len - i - 1 >= 3 &&
+ strncmp(original_mysql_path_ + i + 1, "#P#", 3) == 0) {
+ break;
+ }
+ mysql_table_name_[j++] = original_mysql_path_[++i];
}
mysql_table_name_[j] = '\0';
return mysql_table_name_;
}
+
+ /**
+ * "./${db}/${table}" ==> "./${db}/${table}"
+ * "./${db}/${table}#P#xxx" ==> "./${db}/${table}"
+ */
+ const char *PathMapper::mysql_path() {
+ if (mysql_path_[0] != '\0') {
+ return mysql_path_;
+ }
+
+ int i;
+ int len = strlen(original_mysql_path_);
+ for (i = 0; i < len; i++) {
+ if (len - i >= 3 &&
+ strncmp(original_mysql_path_ + i, "#P#", 3) == 0) {
+ break;
+ }
+ mysql_path_[i] = original_mysql_path_[i];
+ }
+ mysql_path_[i] = '\0';
+ return mysql_path_;
+ }
}
diff --git a/storage/mroonga/lib/mrn_path_mapper.hpp b/storage/mroonga/lib/mrn_path_mapper.hpp
index f70cd7b5587..607bfe4cdce 100644
--- a/storage/mroonga/lib/mrn_path_mapper.hpp
+++ b/storage/mroonga/lib/mrn_path_mapper.hpp
@@ -2,7 +2,7 @@
/*
Copyright(C) 2010 Tetsuro IKEDA
Copyright(C) 2010-2013 Kentoku SHIBA
- Copyright(C) 2011-2012 Kouhei Sutou <kou@clear-code.com>
+ Copyright(C) 2011-2015 Kouhei Sutou <kou@clear-code.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -30,21 +30,23 @@ namespace mrn {
static char *default_path_prefix;
static char *default_mysql_data_home_path;
- PathMapper(const char *mysql_path,
+ PathMapper(const char *original_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();
+ const char *mysql_path();
private:
- const char *mysql_path_;
+ const char *original_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];
+ char mysql_path_[MRN_MAX_PATH_SIZE];
};
}
diff --git a/storage/mroonga/lib/mrn_value_decoder.cpp b/storage/mroonga/lib/mrn_value_decoder.cpp
new file mode 100644
index 00000000000..8356789915f
--- /dev/null
+++ b/storage/mroonga/lib/mrn_value_decoder.cpp
@@ -0,0 +1,64 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should 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_value_decoder.hpp"
+
+#if MYSQL_VERSION_ID >= 50706 && !defined(MRN_MARIADB_P)
+# define MRN_DEST_IS_POINTER
+#endif
+
+namespace mrn {
+ namespace value_decoder {
+ void decode(uint16 *dest, const uchar *source) {
+ MRN_DBUG_ENTER_FUNCTION();
+#ifdef MRN_DEST_IS_POINTER
+ ushortget(dest, source);
+#else
+ uint16 value;
+ ushortget(value, source);
+ *dest = value;
+#endif
+ DBUG_VOID_RETURN;
+ };
+
+ void decode(float *dest, const uchar *source) {
+ MRN_DBUG_ENTER_FUNCTION();
+#ifdef MRN_DEST_IS_POINTER
+ float4get(dest, source);
+#else
+ float value;
+ float4get(value, source);
+ *dest = value;
+#endif
+ DBUG_VOID_RETURN;
+ };
+
+ void decode(double *dest, const uchar *source) {
+ MRN_DBUG_ENTER_FUNCTION();
+#ifdef MRN_DEST_IS_POINTER
+ float8get(dest, source);
+#else
+ double value;
+ float8get(value, source);
+ *dest = value;
+#endif
+ DBUG_VOID_RETURN;
+ }
+ }
+}
diff --git a/storage/mroonga/lib/mrn_value_decoder.hpp b/storage/mroonga/lib/mrn_value_decoder.hpp
new file mode 100644
index 00000000000..8a48de0b003
--- /dev/null
+++ b/storage/mroonga/lib/mrn_value_decoder.hpp
@@ -0,0 +1,33 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should 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_VALUE_DECODER_HPP_
+#define MRN_VALUE_DECODER_HPP_
+
+#include <mrn_mysql.h>
+
+namespace mrn {
+ namespace value_decoder {
+ void decode(uint16 *dest, const uchar *source);
+ void decode(float *dest, const uchar *source);
+ void decode(double *dest, const uchar *source);
+ }
+}
+
+#endif // MRN_VALUE_DECODER_HPP_
diff --git a/storage/mroonga/mrn_constants.hpp b/storage/mroonga/mrn_constants.hpp
index 494e08721bd..5bc6da6b9b6 100644
--- a/storage/mroonga/mrn_constants.hpp
+++ b/storage/mroonga/mrn_constants.hpp
@@ -22,6 +22,8 @@
#ifndef MRN_CONSTANTS_HPP_
#define MRN_CONSTANTS_HPP_
+#include <limits.h>
+
#include <groonga.h>
#define MRN_BUFFER_SIZE 1024
diff --git a/storage/mroonga/mrn_err.h b/storage/mroonga/mrn_err.h
index c2ca885407a..cd4515a034e 100644
--- a/storage/mroonga/mrn_err.h
+++ b/storage/mroonga/mrn_err.h
@@ -28,5 +28,14 @@
#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"
+#define ER_MRN_UNSUPPORTED_COLUMN_FLAG_NUM 16506
+#define ER_MRN_UNSUPPORTED_COLUMN_FLAG_STR \
+ "The column flag '%-.64s' is unsupported. It is ignored"
+#define ER_MRN_INVALID_COLUMN_FLAG_NUM 16507
+#define ER_MRN_INVALID_COLUMN_FLAG_STR \
+ "The column flag '%-.64s' is invalid. '%-64s' is used instead"
+#define ER_MRN_INVALID_INDEX_FLAG_NUM 16508
+#define ER_MRN_INVALID_INDEX_FLAG_STR \
+ "The index flag '%-.64s' is invalid. It is ignored"
#endif /* MRN_ERR_H_ */
diff --git a/storage/mroonga/mrn_mysql.h b/storage/mroonga/mrn_mysql.h
index cf2a54621bb..644825dcf39 100644
--- a/storage/mroonga/mrn_mysql.h
+++ b/storage/mroonga/mrn_mysql.h
@@ -47,7 +47,7 @@
# include <mysql_priv.h>
# include <mysql/plugin.h>
#else
-# include <sql_priv.h>
+# include <sql_const.h>
# include <sql_class.h>
# include <probes_mysql.h>
# include <sql_partition.h>
@@ -58,12 +58,6 @@
# 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__)
diff --git a/storage/mroonga/mrn_mysql_compat.h b/storage/mroonga/mrn_mysql_compat.h
index 7312dd70827..a717220a35c 100644
--- a/storage/mroonga/mrn_mysql_compat.h
+++ b/storage/mroonga/mrn_mysql_compat.h
@@ -1,6 +1,6 @@
/* -*- c-basic-offset: 2 -*- */
/*
- Copyright(C) 2011-2013 Kouhei Sutou <kou@clear-code.com>
+ Copyright(C) 2011-2015 Kouhei Sutou <kou@clear-code.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -22,15 +22,6 @@
#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
@@ -70,26 +61,34 @@
# 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)
+#if defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 100000
+# define mrn_init_alloc_root(PTR, SZ1, SZ2, FLAG) \
+ init_alloc_root(PTR, SZ1, SZ2, FLAG)
+#elif MYSQL_VERSION_ID >= 50706
+# define mrn_init_alloc_root(PTR, SZ1, SZ2, FLAG) \
+ init_alloc_root(mrn_memory_key, PTR, SZ1, SZ2)
+#else
+# define mrn_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()
+# if MYSQL_VERSION_ID >= 50706
+# define MRN_GET_CURRENT_ROW_FOR_WARNING(thd) \
+ thd->get_stmt_da()->current_row_for_condition()
+# else
+# define MRN_GET_CURRENT_ROW_FOR_WARNING(thd) \
+ thd->get_stmt_da()->current_row_for_warning()
+# endif
# endif
#else
# if MYSQL_VERSION_ID >= 50500
@@ -105,7 +104,7 @@
# define MRN_ITEM_HAVE_ITEM_NAME
#endif
-#if MYSQL_VERSION_ID >= 50500 && MYSQL_VERSION_ID < 50700
+#if MYSQL_VERSION_ID >= 50500 && MYSQL_VERSION_ID < 100000
# define MRN_HAVE_TABLE_DEF_CACHE
#endif
@@ -140,4 +139,82 @@
# define MRN_USE_MYSQL_DATA_HOME
#endif
+#if MYSQL_VERSION_ID >= 50706 && !defined(MRN_MARIADB_P)
+# define MRN_SEVERITY_WARNING Sql_condition::SL_WARNING
+#else
+# define MRN_SEVERITY_WARNING Sql_condition::WARN_LEVEL_WARN
+#endif
+
+#if MYSQL_VERSION_ID >= 50706 && !defined(MRN_MARIADB_P)
+# define MRN_HAVE_PSI_MEMORY_KEY
+#endif
+
+#ifdef MRN_HAVE_PSI_MEMORY_KEY
+# define mrn_my_malloc(size, flags) \
+ my_malloc(mrn_memory_key, size, flags)
+# define mrn_my_strdup(string, flags) \
+ my_strdup(mrn_memory_key, string, flags)
+# define mrn_my_strndup(string, size, flags) \
+ my_strndup(mrn_memory_key, string, size, flags)
+# define mrn_my_multi_malloc(flags, ...) \
+ my_multi_malloc(mrn_memory_key, flags, __VA_ARGS__)
+#else
+# define mrn_my_malloc(size, flags) my_malloc(size, flags)
+# define mrn_my_strdup(string, flags) my_strdup(string, flags)
+# define mrn_my_strndup(string, size, flags) \
+ my_strndup(string, size, flags)
+# define mrn_my_multi_malloc(flags, ...) \
+ my_multi_malloc(flags, __VA_ARGS__)
+#endif
+
+#if MYSQL_VERSION_ID >= 50706 && !defined(MRN_MARIADB_P)
+# define MRN_STRING_FREE(string) string.mem_free();
+#else
+# define MRN_STRING_FREE(string) string.free();
+#endif
+
+#if MYSQL_VERSION_ID >= 50706 && !defined(MRN_MARIADB_P)
+# define MRN_THD_DB_PATH(thd) ((thd)->db().str)
+#else
+# define MRN_THD_DB_PATH(thd) ((thd)->db)
+#endif
+
+#ifndef INT_MAX64
+# define INT_MAX64 LONGLONG_MAX
+#endif
+
+#ifdef UINT_MAX
+# define UINT_MAX64 UINT_MAX
+#else
+# define UINT_MAX64 LONGLONG_MAX
+#endif
+
+#if MYSQL_VERSION_ID >= 50706 && !defined(MRN_MARIADB_P)
+# define mrn_my_stpmov(dst, src) my_stpmov(dst, src)
+#else
+# define mrn_my_stpmov(dst, src) strmov(dst, src)
+#endif
+
+#if MYSQL_VERSION_ID >= 50607
+# if !defined(MRN_MARIADB_P)
+# define MRN_HAVE_SQL_OPTIMIZER_H
+# endif
+#endif
+
+#if MYSQL_VERSION_ID >= 50600 && !defined(MRN_MARIADB_P)
+# define MRN_HAVE_BINLOG_H
+#endif
+
+#if MYSQL_VERSION_ID >= 50706 && !defined(MRN_MARIADB_P)
+# define MRN_HAVE_SPATIAL
+#elif defined(HAVE_SPATIAL)
+# define MRN_HAVE_SPATIAL
+#endif
+
+#if MYSQL_VERSION_ID >= 50706 && !defined(MRN_MARIADB_P)
+# define MRN_FORMAT_STRING_LENGTH "zu"
+#else
+# define MRN_FORMAT_STRING_LENGTH "u"
+#endif
+
#endif /* MRN_MYSQL_COMPAT_H_ */
diff --git a/storage/mroonga/mrn_table.cpp b/storage/mroonga/mrn_table.cpp
index fd406ac2dcf..ebd3e7e0528 100644
--- a/storage/mroonga/mrn_table.cpp
+++ b/storage/mroonga/mrn_table.cpp
@@ -1,7 +1,7 @@
/* -*- c-basic-offset: 2 -*- */
/*
Copyright(C) 2011-2013 Kentoku SHIBA
- Copyright(C) 2011-2014 Kouhei Sutou <kou@clear-code.com>
+ Copyright(C) 2011-2015 Kouhei Sutou <kou@clear-code.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -24,9 +24,15 @@
# include <sql_servers.h>
# include <sql_base.h>
#endif
+#ifdef WITH_PARTITION_STORAGE_ENGINE
+# include <partition_info.h>
+#endif
+#include <sql_plugin.h>
+
#include "mrn_err.h"
#include "mrn_table.hpp"
#include "mrn_mysql_compat.h"
+#include "mrn_variables.hpp"
#include <mrn_lock.hpp>
#if MYSQL_VERSION_ID >= 50603 && !defined(MRN_MARIADB_P)
@@ -35,6 +41,12 @@
# define MRN_HA_RESOLVE_BY_NAME(name) ha_resolve_by_name(NULL, (name))
#endif
+#if MYSQL_VERSION_ID >= 50706 && !defined(MRN_MARIADB_P)
+# define MRN_PLUGIN_DATA(plugin, type) plugin_data<type>(plugin)
+#else
+# define MRN_PLUGIN_DATA(plugin, type) plugin_data(plugin, type)
+#endif
+
#define LEX_STRING_IS_EMPTY(string) \
((string).length == 0 || !(string).str || (string).str[0] == '\0')
@@ -47,28 +59,32 @@
extern HASH *mrn_table_def_cache;
#endif
-#ifdef WIN32
-# ifdef MRN_TABLE_SHARE_HAVE_LOCK_SHARE
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef HAVE_PSI_INTERFACE
+# 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
+# endif
+# ifdef MRN_TABLE_SHARE_HAVE_LOCK_HA_DATA
extern PSI_mutex_key *mrn_table_share_lock_ha_data;
+# endif
# endif
-#endif
-
-#ifdef __cplusplus
-extern "C" {
+extern PSI_mutex_key mrn_share_mutex_key;
+extern PSI_mutex_key mrn_long_term_share_auto_inc_mutex_key;
#endif
extern HASH mrn_open_tables;
-extern pthread_mutex_t mrn_open_tables_mutex;
+extern mysql_mutex_t mrn_open_tables_mutex;
extern HASH mrn_long_term_share;
-extern pthread_mutex_t mrn_long_term_share_mutex;
+extern mysql_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;
+extern mysql_mutex_t mrn_allocated_thds_mutex;
static char *mrn_get_string_between_quote(const char *ptr)
{
@@ -131,7 +147,7 @@ static char *mrn_get_string_between_quote(const char *ptr)
DBUG_RETURN(NULL);
size_t length = end_ptr - start_ptr;
- char *extracted_string = (char *)my_malloc(length + 1, MYF(MY_WME));
+ char *extracted_string = (char *)mrn_my_malloc(length + 1, MYF(MY_WME));
if (esc_flg) {
size_t extracted_index = 0;
const char *current_ptr = start_ptr;
@@ -368,9 +384,9 @@ int mrn_parse_table_param(MRN_SHARE *share, TABLE *table)
}
{
- params_string = my_strndup(params_string_value,
- params_string_length,
- MYF(MY_WME));
+ params_string = mrn_my_strndup(params_string_value,
+ params_string_length,
+ MYF(MY_WME));
if (!params_string) {
error = HA_ERR_OUT_OF_MEM;
goto error;
@@ -424,7 +440,7 @@ int mrn_parse_table_param(MRN_SHARE *share, TABLE *table)
}
}
- my_free(params_string, MYF(0));
+ my_free(params_string);
params_string = NULL;
}
}
@@ -433,9 +449,9 @@ int mrn_parse_table_param(MRN_SHARE *share, TABLE *table)
{
share->engine_length = strlen(mrn_default_wrapper_engine);
if (
- !(share->engine = my_strndup(mrn_default_wrapper_engine,
- share->engine_length,
- MYF(MY_WME)))
+ !(share->engine = mrn_my_strndup(mrn_default_wrapper_engine,
+ share->engine_length,
+ MYF(MY_WME)))
) {
error = HA_ERR_OUT_OF_MEM;
goto error;
@@ -455,7 +471,7 @@ int mrn_parse_table_param(MRN_SHARE *share, TABLE *table)
!strncasecmp(share->engine, MRN_GROONGA_STR, MRN_GROONGA_LEN)
)
) {
- my_free(share->engine, MYF(0));
+ my_free(share->engine);
share->engine = NULL;
share->engine_length = 0;
} else {
@@ -467,14 +483,14 @@ int mrn_parse_table_param(MRN_SHARE *share, TABLE *table)
error = ER_UNKNOWN_STORAGE_ENGINE;
goto error;
}
- share->hton = plugin_data(share->plugin, handlerton *);
+ share->hton = MRN_PLUGIN_DATA(share->plugin, handlerton *);
share->wrapper_mode = TRUE;
}
}
error:
if (params_string)
- my_free(params_string, MYF(0));
+ my_free(params_string);
DBUG_RETURN(error);
}
@@ -500,10 +516,10 @@ int mrn_add_index_param(MRN_SHARE *share, KEY *key_info, int i)
if (key_info->comment.length == 0)
{
if (share->key_parser[i]) {
- my_free(share->key_parser[i], MYF(0));
+ my_free(share->key_parser[i]);
}
if (
- !(share->key_parser[i] = my_strdup(mrn_default_parser, MYF(MY_WME)))
+ !(share->key_parser[i] = mrn_my_strdup(mrn_default_parser, MYF(MY_WME)))
) {
error = HA_ERR_OUT_OF_MEM;
goto error;
@@ -513,9 +529,9 @@ int mrn_add_index_param(MRN_SHARE *share, KEY *key_info, int i)
}
DBUG_PRINT("info", ("mroonga create comment string"));
if (
- !(param_string = my_strndup(key_info->comment.str,
- key_info->comment.length,
- MYF(MY_WME)))
+ !(param_string = mrn_my_strndup(key_info->comment.str,
+ key_info->comment.length,
+ MYF(MY_WME)))
) {
error = HA_ERR_OUT_OF_MEM;
goto error_alloc_param_string;
@@ -565,7 +581,7 @@ int mrn_add_index_param(MRN_SHARE *share, KEY *key_info, int i)
#endif
if (!share->key_parser[i]) {
if (
- !(share->key_parser[i] = my_strdup(mrn_default_parser, MYF(MY_WME)))
+ !(share->key_parser[i] = mrn_my_strdup(mrn_default_parser, MYF(MY_WME)))
) {
error = HA_ERR_OUT_OF_MEM;
goto error;
@@ -574,12 +590,12 @@ int mrn_add_index_param(MRN_SHARE *share, KEY *key_info, int i)
}
if (param_string)
- my_free(param_string, MYF(0));
+ my_free(param_string);
DBUG_RETURN(0);
error:
if (param_string)
- my_free(param_string, MYF(0));
+ my_free(param_string);
#if MYSQL_VERSION_ID >= 50500
error_alloc_param_string:
#endif
@@ -626,9 +642,9 @@ int mrn_add_column_param(MRN_SHARE *share, Field *field, int i)
DBUG_PRINT("info", ("mroonga create comment string"));
if (
- !(param_string = my_strndup(field->comment.str,
- field->comment.length,
- MYF(MY_WME)))
+ !(param_string = mrn_my_strndup(field->comment.str,
+ field->comment.length,
+ MYF(MY_WME)))
) {
error = HA_ERR_OUT_OF_MEM;
goto error_alloc_param_string;
@@ -677,12 +693,12 @@ int mrn_add_column_param(MRN_SHARE *share, Field *field, int i)
}
if (param_string)
- my_free(param_string, MYF(0));
+ my_free(param_string);
DBUG_RETURN(0);
error:
if (param_string)
- my_free(param_string, MYF(0));
+ my_free(param_string);
error_alloc_param_string:
DBUG_RETURN(error);
}
@@ -714,26 +730,26 @@ int mrn_free_share_alloc(
uint i;
MRN_DBUG_ENTER_FUNCTION();
if (share->engine)
- my_free(share->engine, MYF(0));
+ my_free(share->engine);
if (share->default_tokenizer)
- my_free(share->default_tokenizer, MYF(0));
+ my_free(share->default_tokenizer);
if (share->normalizer)
- my_free(share->normalizer, MYF(0));
+ my_free(share->normalizer);
if (share->token_filters)
- my_free(share->token_filters, MYF(0));
+ my_free(share->token_filters);
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));
+ my_free(share->index_table[i]);
if (share->key_parser[i])
- my_free(share->key_parser[i], MYF(0));
+ my_free(share->key_parser[i]);
}
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));
+ my_free(share->col_flags[i]);
if (share->col_type && share->col_type[i])
- my_free(share->col_type[i], MYF(0));
+ my_free(share->col_type[i]);
}
DBUG_RETURN(0);
}
@@ -745,8 +761,8 @@ void mrn_free_long_term_share(MRN_LONG_TERM_SHARE *long_term_share)
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));
+ mysql_mutex_destroy(&long_term_share->auto_inc_mutex);
+ my_free(long_term_share);
DBUG_VOID_RETURN;
}
@@ -764,7 +780,7 @@ MRN_LONG_TERM_SHARE *mrn_get_long_term_share(const char *table_name,
table_name_length)))
{
if (!(long_term_share = (MRN_LONG_TERM_SHARE *)
- my_multi_malloc(MYF(MY_WME | MY_ZEROFILL),
+ mrn_my_multi_malloc(MYF(MY_WME | MY_ZEROFILL),
&long_term_share, sizeof(*long_term_share),
&tmp_name, table_name_length + 1,
NullS))
@@ -775,8 +791,9 @@ MRN_LONG_TERM_SHARE *mrn_get_long_term_share(const char *table_name,
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))
+ if (mysql_mutex_init(mrn_long_term_share_auto_inc_mutex_key,
+ &long_term_share->auto_inc_mutex,
+ MY_MUTEX_INIT_FAST) != 0)
{
*error = HA_ERR_OUT_OF_MEM;
goto error_init_auto_inc_mutex;
@@ -790,9 +807,9 @@ MRN_LONG_TERM_SHARE *mrn_get_long_term_share(const char *table_name,
DBUG_RETURN(long_term_share);
error_hash_insert:
- pthread_mutex_destroy(&long_term_share->auto_inc_mutex);
+ mysql_mutex_destroy(&long_term_share->auto_inc_mutex);
error_init_auto_inc_mutex:
- my_free(long_term_share, MYF(0));
+ my_free(long_term_share);
error_alloc_long_term_share:
DBUG_RETURN(NULL);
}
@@ -812,7 +829,7 @@ MRN_SHARE *mrn_get_share(const char *table_name, TABLE *table, int *error)
(uchar*) table_name, length)))
{
if (!(share = (MRN_SHARE *)
- my_multi_malloc(MYF(MY_WME | MY_ZEROFILL),
+ mrn_my_multi_malloc(MYF(MY_WME | MY_ZEROFILL),
&share, sizeof(*share),
&tmp_name, length + 1,
&index_table, sizeof(char *) * table->s->keys,
@@ -842,7 +859,7 @@ MRN_SHARE *mrn_get_share(const char *table_name, TABLE *table, int *error)
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);
+ mrn_my_stpmov(share->table_name, table_name);
share->table_share = table->s;
if (
@@ -912,7 +929,9 @@ MRN_SHARE *mrn_get_share(const char *table_name, TABLE *table, int *error)
share->wrap_table_share = wrap_table_share;
}
- if (pthread_mutex_init(&share->mutex, MY_MUTEX_INIT_FAST))
+ if (mysql_mutex_init(mrn_share_mutex_key,
+ &share->mutex,
+ MY_MUTEX_INIT_FAST) != 0)
{
*error = HA_ERR_OUT_OF_MEM;
goto error_init_mutex;
@@ -934,11 +953,11 @@ MRN_SHARE *mrn_get_share(const char *table_name, TABLE *table, int *error)
error_hash_insert:
error_get_long_term_share:
- pthread_mutex_destroy(&share->mutex);
+ mysql_mutex_destroy(&share->mutex);
error_init_mutex:
error_parse_table_param:
mrn_free_share_alloc(share);
- my_free(share, MYF(0));
+ my_free(share);
error_alloc_share:
DBUG_RETURN(NULL);
}
@@ -954,7 +973,7 @@ int mrn_free_share(MRN_SHARE *share)
plugin_unlock(NULL, share->plugin);
mrn_free_share_alloc(share);
thr_lock_delete(&share->lock);
- pthread_mutex_destroy(&share->mutex);
+ mysql_mutex_destroy(&share->mutex);
if (share->wrapper_mode) {
#ifdef MRN_TABLE_SHARE_HAVE_LOCK_SHARE
mysql_mutex_destroy(&(share->wrap_table_share->LOCK_share));
@@ -963,7 +982,7 @@ int mrn_free_share(MRN_SHARE *share)
mysql_mutex_destroy(&(share->wrap_table_share->LOCK_ha_data));
#endif
}
- my_free(share, MYF(0));
+ my_free(share);
}
DBUG_RETURN(0);
}
@@ -1025,9 +1044,9 @@ TABLE_SHARE *mrn_create_tmp_table_share(TABLE_LIST *table_list, const char *path
}
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;
+ share->path.length = strlen(share->path.str);
+ share->normalized_path.str = mrn_my_strdup(path, MYF(MY_WME));
+ share->normalized_path.length = strlen(share->normalized_path.str);
if (open_table_def(thd, share, GTS_TABLE))
{
*error = ER_CANT_OPEN_FILE;
@@ -1039,7 +1058,9 @@ TABLE_SHARE *mrn_create_tmp_table_share(TABLE_LIST *table_list, const char *path
void mrn_free_tmp_table_share(TABLE_SHARE *tmp_table_share)
{
MRN_DBUG_ENTER_FUNCTION();
+ char *normalized_path = tmp_table_share->normalized_path.str;
free_table_share(tmp_table_share);
+ my_free(normalized_path);
DBUG_VOID_RETURN;
}
@@ -1051,7 +1072,7 @@ KEY *mrn_create_key_info_for_table(MRN_SHARE *share, TABLE *table, int *error)
if (share->wrap_keys)
{
if (!(wrap_key_info = (KEY *)
- my_multi_malloc(MYF(MY_WME | MY_ZEROFILL),
+ mrn_my_multi_malloc(MYF(MY_WME | MY_ZEROFILL),
&wrap_key_info, sizeof(*wrap_key_info) * share->wrap_keys,
NullS))
) {
@@ -1131,11 +1152,11 @@ void mrn_clear_alter_share(THD *thd)
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));
+ my_free(slot_data->alter_connect_string);
slot_data->alter_connect_string = NULL;
}
if (slot_data->alter_comment) {
- my_free(slot_data->alter_comment, MYF(0));
+ my_free(slot_data->alter_comment);
slot_data->alter_comment = NULL;
}
}
diff --git a/storage/mroonga/mrn_table.hpp b/storage/mroonga/mrn_table.hpp
index 813e69e1023..9118455b53d 100644
--- a/storage/mroonga/mrn_table.hpp
+++ b/storage/mroonga/mrn_table.hpp
@@ -33,7 +33,7 @@ typedef struct st_mroonga_long_term_share
uint table_name_length;
// for auto_increment (storage mode only)
- pthread_mutex_t auto_inc_mutex;
+ mysql_mutex_t auto_inc_mutex;
bool auto_inc_inited;
ulonglong auto_inc_value;
} MRN_LONG_TERM_SHARE;
@@ -43,7 +43,7 @@ typedef struct st_mroonga_share
char *table_name;
uint table_name_length;
uint use_count;
- pthread_mutex_t mutex;
+ mysql_mutex_t mutex;
THR_LOCK lock;
TABLE_SHARE *table_share;
TABLE_SHARE *wrap_table_share;
diff --git a/storage/mroonga/mrn_variables.hpp b/storage/mroonga/mrn_variables.hpp
new file mode 100644
index 00000000000..6bc948a1cac
--- /dev/null
+++ b/storage/mroonga/mrn_variables.hpp
@@ -0,0 +1,29 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should 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_VARIABLES_HPP_
+#define MRN_VARIABLES_HPP_
+
+#include "mrn_mysql_compat.h"
+
+#ifdef MRN_HAVE_PSI_MEMORY_KEY
+extern PSI_memory_key mrn_memory_key;
+#endif
+
+#endif /* MRN_VARIABLES_HPP_ */
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_support_lz4.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_support_lz4.inc
new file mode 100644
index 00000000000..1c74cbffc46
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_support_lz4.inc
@@ -0,0 +1,20 @@
+# Copyright(C) 2014 Naoya Murakami <naoya@createfield.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# 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 $libgroonga_support_lz4 =
+ `SELECT @@mroonga_libgroonga_support_lz4;`;
+--enable_query_log
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_support_zlib.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_support_zlib.inc
new file mode 100644
index 00000000000..5ab5fcd2fb8
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_support_zlib.inc
@@ -0,0 +1,20 @@
+# Copyright(C) 2014 Naoya Murakami <naoya@createfield.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# 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 $libgroonga_support_zlib =
+ `SELECT @@mroonga_libgroonga_support_zlib;`;
+--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
index b59a981d822..b78e79558d7 100644
--- a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_version.inc
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_version.inc
@@ -1,4 +1,4 @@
-# Copyright(C) 2012-2013 Kouhei Sutou <kou@clear-code.com>
+# Copyright(C) 2012-2015 Kouhei Sutou <kou@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -20,9 +20,11 @@ let $version_major_minor =
let $version_55 = `SELECT $version_major_minor = 5.5`;
let $version_56 = `SELECT $version_major_minor = 5.6`;
+let $version_57 = `SELECT $version_major_minor = 5.7`;
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_57_or_later = `SELECT $version_major_minor >= 5.7`;
let $version_100_or_later = `SELECT $version_major_minor >= 10.0`;
--enable_query_log
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_57.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_57.inc
new file mode 100644
index 00000000000..1ab664ed6a8
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_57.inc
@@ -0,0 +1,21 @@
+# Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with 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_57) {
+ skip This test is for MySQL version 5.7.x;
+}
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_100_or_later.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_100_or_later.inc
new file mode 100644
index 00000000000..8c9f76cd45f
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_100_or_later.inc
@@ -0,0 +1,24 @@
+# Copyright(C) 2012-2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with 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_100_or_later) {
+ if ($mariadb) {
+ skip This test is not for MariaDB 10.x;
+ }
+}
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mysql_57.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mysql_57.inc
new file mode 100644
index 00000000000..f1b1651a0b1
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mysql_57.inc
@@ -0,0 +1,24 @@
+# Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with 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_57) {
+ if (!$mariadb) {
+ skip This test is not for MySQL 5.7.x;
+ }
+}
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/support_libgroonga_lz4.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/support_libgroonga_lz4.inc
new file mode 100644
index 00000000000..e67f826b0ce
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/support_libgroonga_lz4.inc
@@ -0,0 +1,22 @@
+# Copyright(C) 2014 Naoya Murakami <naoya@createfield.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with 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_libgroonga_support_lz4.inc
+
+if (!$libgroonga_support_lz4) {
+ --source ../../include/mroonga/have_mroonga_deinit.inc
+ skip "This test is for libgroonga supports lz4";
+}
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/support_libgroonga_zlib.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/support_libgroonga_zlib.inc
new file mode 100644
index 00000000000..9f5196f742b
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/support_libgroonga_zlib.inc
@@ -0,0 +1,22 @@
+# Copyright(C) 2014 Naoya Murakami <naoya@createfield.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with 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_libgroonga_support_zlib.inc
+
+if (!$libgroonga_support_zlib) {
+ --source ../../include/mroonga/have_mroonga_deinit.inc
+ skip "This test is for libgroonga supports zlib";
+}
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/unsupport_libgroonga_lz4.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/unsupport_libgroonga_lz4.inc
new file mode 100644
index 00000000000..80874a7a50b
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/unsupport_libgroonga_lz4.inc
@@ -0,0 +1,22 @@
+# Copyright(C) 2014 Naoya Murakami <naoya@createfield.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with 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_libgroonga_support_lz4.inc
+
+if ($libgroonga_support_lz4) {
+ --source ../../include/mroonga/have_mroonga_deinit.inc
+ skip "This test is for libgroonga doesn't support lz4";
+}
diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/unsupport_libgroonga_zlib.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/unsupport_libgroonga_zlib.inc
new file mode 100644
index 00000000000..d6c3f6dbeda
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/unsupport_libgroonga_zlib.inc
@@ -0,0 +1,22 @@
+# Copyright(C) 2014 Naoya Murakami <naoya@createfield.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with 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_libgroonga_support_zlib.inc
+
+if ($libgroonga_support_zlib) {
+ --source ../../include/mroonga/have_mroonga_deinit.inc
+ skip "This test is for libgroonga doesn't support zlib";
+}
diff --git a/storage/mroonga/mysql-test/mroonga/storage/disabled.def b/storage/mroonga/mysql-test/mroonga/storage/disabled.def
index 3f546dad2a4..6866adc1e35 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/disabled.def
+++ b/storage/mroonga/mysql-test/mroonga/storage/disabled.def
@@ -6,4 +6,5 @@ create_table_token_filters_index_comment_one_token_filter : Bundled Mroonga does
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.
+partition_insert : Bundled Mroonga does not support this test yet.
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
index 1bc15c6efe2..e441df32c92 100644
--- 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
@@ -2,8 +2,8 @@ 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")
+SELECT mroonga_command("dump --dump_plugins no");
+mroonga_command("dump --dump_plugins no")
table_create tags TABLE_PAT_KEY UInt32
column_create tags id COLUMN_SCALAR UInt32
column_create tags name COLUMN_VECTOR ShortText
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
index 6ff92ec8e99..b4c3044c7d5 100644
--- 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
@@ -5,12 +5,14 @@ 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")
+SELECT mroonga_command("dump --dump_plugins no");
+mroonga_command("dump --dump_plugins no")
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
index e0449e3e54b..21784decb88 100644
--- 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
@@ -5,15 +5,13 @@ 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")
+SELECT mroonga_command("dump --dump_plugins no");
+mroonga_command("dump --dump_plugins no")
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_multiple_column_duplicated.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_index_unique_multiple_column_duplicated.result
new file mode 100644
index 00000000000..8ab7ef22aca
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_index_unique_multiple_column_duplicated.result
@@ -0,0 +1,19 @@
+DROP TABLE IF EXISTS ids;
+CREATE TABLE ids (
+id1 INT,
+id2 INT
+) DEFAULT CHARSET=utf8mb4;
+INSERT INTO ids (id1, id2) values (1, 2), (1, 2);
+ALTER TABLE ids ADD UNIQUE INDEX (id1, id2);
+ERROR 23000: Can't write, because of unique constraint, to table 'ids'
+SHOW CREATE TABLE ids;
+Table Create Table
+ids CREATE TABLE `ids` (
+ `id1` int(11) DEFAULT NULL,
+ `id2` int(11) DEFAULT NULL
+) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4
+SELECT * FROM ids;
+id1 id2
+1 2
+1 2
+DROP TABLE ids;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_primary_key.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_primary_key.result
new file mode 100644
index 00000000000..439684ac5d6
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_primary_key.result
@@ -0,0 +1,17 @@
+DROP TABLE IF EXISTS ids;
+CREATE TABLE ids (
+id INT NOT NULL
+) ENGINE=Mroonga DEFAULT CHARSET=utf8;
+INSERT INTO ids VALUES (1);
+INSERT INTO ids VALUES (2);
+ALTER TABLE ids ADD PRIMARY KEY (id);
+SHOW CREATE TABLE ids;
+Table Create Table
+ids CREATE TABLE `ids` (
+ `id` int(11) NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=Mroonga DEFAULT CHARSET=utf8
+SELECT * FROM ids WHERE id = 2;
+id
+2
+DROP TABLE ids;
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
index 5046dc8e142..1c96236230b 100644
--- 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
@@ -10,23 +10,39 @@ 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")
+SELECT mroonga_command("dump --dump_plugins no");
+mroonga_command("dump --dump_plugins no")
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")
+SELECT mroonga_command("dump --dump_plugins no");
+mroonga_command("dump --dump_plugins no")
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
+ALTER TABLE memos DISABLE KEYS;
+ALTER TABLE memos ENABLE KEYS;
+SELECT mroonga_command("dump --dump_plugins no");
+mroonga_command("dump --dump_plugins no")
+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
+
+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/alter_table_disable_keys_fulltext_table.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_fulltext_table.result
new file mode 100644
index 00000000000..ba6cf6c24ed
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_fulltext_table.result
@@ -0,0 +1,31 @@
+SET NAMES utf8;
+CREATE TABLE terms (
+term varchar(256) NOT NULL PRIMARY KEY
+) COMMENT='default_tokenizer "TokenBigram", normalizer "NormalizerAuto"'
+ DEFAULT CHARSET=utf8;
+CREATE TABLE memos (
+id int PRIMARY KEY,
+content text NOT NULL,
+FULLTEXT INDEX content_index (content) COMMENT 'table "terms"'
+) DEFAULT CHARSET=utf8;
+SELECT mroonga_command("dump --dump_plugins no");
+mroonga_command("dump --dump_plugins no")
+table_create terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto
+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_index COLUMN_INDEX|WITH_POSITION memos content
+ALTER TABLE memos DISABLE KEYS;
+SELECT mroonga_command("dump --dump_plugins no");
+mroonga_command("dump --dump_plugins no")
+table_create terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto
+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
+DROP TABLE memos;
+DROP TABLE terms;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_drop_primary_key.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_drop_primary_key.result
new file mode 100644
index 00000000000..cbcf9a69b56
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_drop_primary_key.result
@@ -0,0 +1,16 @@
+DROP TABLE IF EXISTS ids;
+CREATE TABLE ids (
+id INT PRIMARY KEY
+) ENGINE=Mroonga DEFAULT CHARSET=utf8;
+INSERT INTO ids VALUES (1);
+INSERT INTO ids VALUES (2);
+ALTER TABLE ids DROP PRIMARY KEY;
+SHOW CREATE TABLE ids;
+Table Create Table
+ids CREATE TABLE `ids` (
+ `id` int(11) NOT NULL
+) ENGINE=Mroonga DEFAULT CHARSET=utf8
+SELECT * FROM ids WHERE id = 2;
+id
+2
+DROP TABLE ids;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_fulltext_table.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_fulltext_table.result
new file mode 100644
index 00000000000..452caa574f9
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_fulltext_table.result
@@ -0,0 +1,32 @@
+SET NAMES utf8;
+CREATE TABLE terms (
+term varchar(256) NOT NULL PRIMARY KEY
+) COMMENT='default_tokenizer "TokenBigram", normalizer "NormalizerAuto"'
+ DEFAULT CHARSET=utf8;
+CREATE TABLE memos (
+id int PRIMARY KEY,
+content text NOT NULL,
+FULLTEXT INDEX content_index (content) COMMENT 'table "terms"'
+) DEFAULT CHARSET=utf8;
+ALTER TABLE memos DISABLE KEYS;
+SELECT mroonga_command("dump --dump_plugins no");
+mroonga_command("dump --dump_plugins no")
+table_create terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto
+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
+ALTER TABLE memos ENABLE KEYS;
+SELECT mroonga_command("dump --dump_plugins no");
+mroonga_command("dump --dump_plugins no")
+table_create terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto
+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_index COLUMN_INDEX|WITH_POSITION memos content
+DROP TABLE memos;
+DROP TABLE terms;
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
index d8ed80a157d..ed36927e7b9 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_spatial.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_spatial.result
@@ -6,115 +6,115 @@ location GEOMETRY NOT NULL
);
INSERT INTO shops (name, location)
VALUES ('nezu-no-taiyaki',
-GeomFromText('POINT(139.762573 35.720253)'));
+ST_GeomFromText('POINT(139.762573 35.720253)'));
INSERT INTO shops (name, location)
VALUES ('taiyaki-kataoka',
-GeomFromText('POINT(139.715591 35.712521)'));
+ST_GeomFromText('POINT(139.715591 35.712521)'));
INSERT INTO shops (name, location)
VALUES ('soba-taiyaki-ku',
-GeomFromText('POINT(139.659088 35.683712)'));
+ST_GeomFromText('POINT(139.659088 35.683712)'));
INSERT INTO shops (name, location)
VALUES ('kuruma',
-GeomFromText('POINT(139.706207 35.721516)'));
+ST_GeomFromText('POINT(139.706207 35.721516)'));
INSERT INTO shops (name, location)
VALUES ('hirose-ya',
-GeomFromText('POINT(139.685608 35.714844)'));
+ST_GeomFromText('POINT(139.685608 35.714844)'));
INSERT INTO shops (name, location)
VALUES ('sazare',
-GeomFromText('POINT(139.685043 35.714653)'));
+ST_GeomFromText('POINT(139.685043 35.714653)'));
INSERT INTO shops (name, location)
VALUES ('omede-taiyaki',
-GeomFromText('POINT(139.817154 35.700516)'));
+ST_GeomFromText('POINT(139.817154 35.700516)'));
INSERT INTO shops (name, location)
VALUES ('onaga-ya',
-GeomFromText('POINT(139.81105 35.698254)'));
+ST_GeomFromText('POINT(139.81105 35.698254)'));
INSERT INTO shops (name, location)
VALUES ('shiro-ya',
-GeomFromText('POINT(139.638611 35.705517)'));
+ST_GeomFromText('POINT(139.638611 35.705517)'));
INSERT INTO shops (name, location)
VALUES ('fuji-ya',
-GeomFromText('POINT(139.637115 35.703938)'));
+ST_GeomFromText('POINT(139.637115 35.703938)'));
INSERT INTO shops (name, location)
VALUES ('miyoshi',
-GeomFromText('POINT(139.537323 35.644539)'));
+ST_GeomFromText('POINT(139.537323 35.644539)'));
INSERT INTO shops (name, location)
VALUES ('juju-ya',
-GeomFromText('POINT(139.695755 35.628922)'));
+ST_GeomFromText('POINT(139.695755 35.628922)'));
INSERT INTO shops (name, location)
VALUES ('tatsumi-ya',
-GeomFromText('POINT(139.638657 35.665501)'));
+ST_GeomFromText('POINT(139.638657 35.665501)'));
INSERT INTO shops (name, location)
VALUES ('tetsuji',
-GeomFromText('POINT(139.76857 35.680912)'));
+ST_GeomFromText('POINT(139.76857 35.680912)'));
INSERT INTO shops (name, location)
VALUES ('gazuma-ya',
-GeomFromText('POINT(139.647598 35.700817)'));
+ST_GeomFromText('POINT(139.647598 35.700817)'));
INSERT INTO shops (name, location)
VALUES ('honma-mon',
-GeomFromText('POINT(139.652573 35.722736)'));
+ST_GeomFromText('POINT(139.652573 35.722736)'));
INSERT INTO shops (name, location)
VALUES ('naniwa-ya',
-GeomFromText('POINT(139.796234 35.730061)'));
+ST_GeomFromText('POINT(139.796234 35.730061)'));
INSERT INTO shops (name, location)
VALUES ('kuro-dai',
-GeomFromText('POINT(139.704834 35.650345)'));
+ST_GeomFromText('POINT(139.704834 35.650345)'));
INSERT INTO shops (name, location)
VALUES ('daruma',
-GeomFromText('POINT(139.770599 35.681461)'));
+ST_GeomFromText('POINT(139.770599 35.681461)'));
INSERT INTO shops (name, location)
VALUES ('yanagi-ya',
-GeomFromText('POINT(139.783981 35.685341)'));
+ST_GeomFromText('POINT(139.783981 35.685341)'));
INSERT INTO shops (name, location)
VALUES ('sharaku',
-GeomFromText('POINT(139.794846 35.716969)'));
+ST_GeomFromText('POINT(139.794846 35.716969)'));
INSERT INTO shops (name, location)
VALUES ('takane',
-GeomFromText('POINT(139.560913 35.698601)'));
+ST_GeomFromText('POINT(139.560913 35.698601)'));
INSERT INTO shops (name, location)
VALUES ('chiyoda',
-GeomFromText('POINT(139.652817 35.642601)'));
+ST_GeomFromText('POINT(139.652817 35.642601)'));
INSERT INTO shops (name, location)
VALUES ('da-ka-po',
-GeomFromText('POINT(139.727356 35.627346)'));
+ST_GeomFromText('POINT(139.727356 35.627346)'));
INSERT INTO shops (name, location)
VALUES ('matsushima-ya',
-GeomFromText('POINT(139.737381 35.640556)'));
+ST_GeomFromText('POINT(139.737381 35.640556)'));
INSERT INTO shops (name, location)
VALUES ('kazuya',
-GeomFromText('POINT(139.760895 35.673508)'));
+ST_GeomFromText('POINT(139.760895 35.673508)'));
INSERT INTO shops (name, location)
VALUES ('furuya-kogane-an',
-GeomFromText('POINT(139.676071 35.680603)'));
+ST_GeomFromText('POINT(139.676071 35.680603)'));
INSERT INTO shops (name, location)
VALUES ('hachi-no-ie',
-GeomFromText('POINT(139.668106 35.608021)'));
+ST_GeomFromText('POINT(139.668106 35.608021)'));
INSERT INTO shops (name, location)
VALUES ('azuki-chan',
-GeomFromText('POINT(139.673203 35.64151)'));
+ST_GeomFromText('POINT(139.673203 35.64151)'));
INSERT INTO shops (name, location)
VALUES ('kuriko-an',
-GeomFromText('POINT(139.796829 35.712013)'));
+ST_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)'));
+ST_GeomFromText('POINT(139.712524 35.616199)'));
INSERT INTO shops (name, location)
VALUES ('naze-ya',
-GeomFromText('POINT(139.665833 35.609039)'));
+ST_GeomFromText('POINT(139.665833 35.609039)'));
INSERT INTO shops (name, location)
VALUES ('sanoki-ya',
-GeomFromText('POINT(139.770721 35.66592)'));
+ST_GeomFromText('POINT(139.770721 35.66592)'));
INSERT INTO shops (name, location)
VALUES ('shigeta',
-GeomFromText('POINT(139.780273 35.672626)'));
+ST_GeomFromText('POINT(139.780273 35.672626)'));
INSERT INTO shops (name, location)
VALUES ('nishimi-ya',
-GeomFromText('POINT(139.774628 35.671825)'));
+ST_GeomFromText('POINT(139.774628 35.671825)'));
INSERT INTO shops (name, location)
VALUES ('hiiragi',
-GeomFromText('POINT(139.711517 35.647701)'));
+ST_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)
+SELECT id, name, ST_AsText(location) AS location_text FROM shops
+WHERE MBRContains(ST_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)
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/collation_utf8_unicode_520_ci_french.result b/storage/mroonga/mysql-test/mroonga/storage/r/collation_utf8_unicode_520_ci_french.result
new file mode 100644
index 00000000000..b9e22da4e2d
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/collation_utf8_unicode_520_ci_french.result
@@ -0,0 +1,11 @@
+DROP TABLE IF EXISTS diaries;
+SET NAMES utf8mb4;
+CREATE TABLE diaries (
+content varchar(256) COLLATE utf8mb4_unicode_520_ci,
+FULLTEXT INDEX (content)
+) DEFAULT CHARSET=utf8mb4;
+INSERT INTO diaries VALUES ("Je suis un garçon.");
+SELECT * FROM diaries WHERE MATCH (content) AGAINST ("+garcon" IN BOOLEAN MODE);
+content
+Je suis un garçon.
+DROP TABLE diaries;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/collation_utf8_unicode_520_ci_japanese.result b/storage/mroonga/mysql-test/mroonga/storage/r/collation_utf8_unicode_520_ci_japanese.result
new file mode 100644
index 00000000000..29e55b7d9d5
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/collation_utf8_unicode_520_ci_japanese.result
@@ -0,0 +1,12 @@
+DROP TABLE IF EXISTS diaries;
+SET NAMES utf8mb4;
+CREATE TABLE diaries (
+content varchar(256) COLLATE utf8mb4_unicode_520_ci,
+FULLTEXT INDEX (content)
+) DEFAULT CHARSET=utf8mb4;
+INSERT INTO diaries VALUES ("ã²ã‚‰ãŒãªã¨ã‚«ã‚¿ã‚«ãƒŠã‚’覚ãˆã¾ã—ãŸã€‚");
+SELECT * FROM diaries
+WHERE MATCH (content) AGAINST ("+ã‹ãŸã‹ãª" IN BOOLEAN MODE);
+content
+ã²ã‚‰ãŒãªã¨ã‚«ã‚¿ã‚«ãƒŠã‚’覚ãˆã¾ã—ãŸã€‚
+DROP TABLE diaries;
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
index 87c14a98f15..767fe491e99 100644
--- 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
@@ -1,42 +1,30 @@
-DROP DATABASE IF EXISTS mroonga;
-CREATE DATABASE mroonga;
-USE mroonga;
-CREATE TABLE tags (
+CREATE TABLE terms (
name VARCHAR(64) PRIMARY KEY
) DEFAULT CHARSET=utf8
-COLLATE=utf8_bin
-COMMENT='default_tokenizer "TokenDelimit"';
+COMMENT='default_tokenizer "TokenBigram"';
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"'
+title TEXT,
+FULLTEXT INDEX (title) COMMENT 'table "terms"'
) 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
+INSERT INTO bugs (id, title) VALUES (1, "Mroonga can't build with MySQL X.Y.Z");
+SELECT * FROM terms ORDER BY name;
+name
+'
+.
+BUILD
+CAN
+MROONGA
+MYSQL
+T
+WITH
+X
+Y
+Z
+SELECT *, MATCH (title) 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
+WHERE MATCH (title) AGAINST ("+MySQL" IN BOOLEAN MODE);
+id title score
+1 Mroonga can't build with MySQL X.Y.Z 1
DROP TABLE bugs;
-DROP TABLE tags;
-DROP DATABASE mroonga;
+DROP TABLE terms;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_index_fulltext_vector_other_table.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_index_fulltext_vector_other_table.result
new file mode 100644
index 00000000000..724d20edd62
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_index_fulltext_vector_other_table.result
@@ -0,0 +1,33 @@
+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 --dump_plugins no --dump_records no");
+mroonga_command("dump --dump_plugins no --dump_records no")
+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
+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
index e46ed71d0fe..aa7735ef780 100644
--- 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
@@ -13,28 +13,17 @@ INDEX bugs_priority_index (priority) COMMENT 'table "priorities"'
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")
+SELECT mroonga_command("dump --dump_plugins no --dump_records no");
+mroonga_command("dump --dump_plugins no --dump_records no")
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;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_scalar_support_lz4.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_scalar_support_lz4.result
new file mode 100644
index 00000000000..11875e15018
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_scalar_support_lz4.result
@@ -0,0 +1,10 @@
+DROP TABLE IF EXISTS entries;
+CREATE TABLE entries (
+id INT UNSIGNED PRIMARY KEY,
+content TEXT COMMENT 'flags "COLUMN_SCALAR|COMPRESS_LZ4"'
+) DEFAULT CHARSET=utf8;
+INSERT INTO entries (id, content) VALUES (1, "I found Mroonga that is a MySQL storage engine to use Groonga!");
+SELECT * FROM entries;
+id content
+1 I found Mroonga that is a MySQL storage engine to use Groonga!
+DROP TABLE entries;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_scalar_support_zlib.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_scalar_support_zlib.result
new file mode 100644
index 00000000000..5d704e3ebec
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_scalar_support_zlib.result
@@ -0,0 +1,10 @@
+DROP TABLE IF EXISTS entries;
+CREATE TABLE entries (
+id INT UNSIGNED PRIMARY KEY,
+content TEXT COMMENT 'flags "COLUMN_SCALAR|COMPRESS_ZLIB"'
+) DEFAULT CHARSET=utf8;
+INSERT INTO entries (id, content) VALUES (1, "I found Mroonga that is a MySQL storage engine to use Groonga!");
+SELECT * FROM entries;
+id content
+1 I found Mroonga that is a MySQL storage engine to use Groonga!
+DROP TABLE entries;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_scalar_unsupport_lz4.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_scalar_unsupport_lz4.result
new file mode 100644
index 00000000000..a9a5f55fd7f
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_scalar_unsupport_lz4.result
@@ -0,0 +1,12 @@
+DROP TABLE IF EXISTS entries;
+CREATE TABLE entries (
+id INT UNSIGNED PRIMARY KEY,
+content TEXT COMMENT 'flags "COLUMN_SCALAR|COMPRESS_LZ4"'
+) DEFAULT CHARSET=utf8;
+Warnings:
+Warning 16506 The column flag 'COMPRESS_LZ4' is unsupported. It is ignored
+INSERT INTO entries (id, content) VALUES (1, "I found Mroonga that is a MySQL storage engine to use Groonga!");
+SELECT * FROM entries;
+id content
+1 I found Mroonga that is a MySQL storage engine to use Groonga!
+DROP TABLE entries;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_scalar_unsupport_zlib.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_scalar_unsupport_zlib.result
new file mode 100644
index 00000000000..068ce58bf74
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_scalar_unsupport_zlib.result
@@ -0,0 +1,12 @@
+DROP TABLE IF EXISTS entries;
+CREATE TABLE entries (
+id INT UNSIGNED PRIMARY KEY,
+content TEXT COMMENT 'flags "COLUMN_SCALAR|COMPRESS_ZLIB"'
+) DEFAULT CHARSET=utf8;
+Warnings:
+Warning 16506 The column flag 'COMPRESS_ZLIB' is unsupported. It is ignored
+INSERT INTO entries (id, content) VALUES (1, "I found Mroonga that is a MySQL storage engine to use Groonga!");
+SELECT * FROM entries;
+id content
+1 I found Mroonga that is a MySQL storage engine to use Groonga!
+DROP TABLE entries;
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
index e14c67291cd..9302037b7e1 100644
--- 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
@@ -3,8 +3,8 @@ name VARCHAR(64) PRIMARY KEY
) DEFAULT CHARSET=utf8
COLLATE=utf8_bin
COMMENT='default_tokenizer "TokenDelimit"';
-SELECT mroonga_command("dump");
-mroonga_command("dump")
+SELECT mroonga_command("dump --dump_plugins no");
+mroonga_command("dump --dump_plugins no")
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_index_flags_none.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_none.result
new file mode 100644
index 00000000000..c9283db72bb
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_none.result
@@ -0,0 +1,9 @@
+SET NAMES utf8;
+CREATE TABLE memos (
+content VARCHAR(64) NOT NULL,
+FULLTEXT INDEX (content) COMMENT 'index_flags "NONE"'
+) DEFAULT CHARSET=utf8;
+SELECT mroonga_command("dump --dump_plugins no --dump_schema no");
+mroonga_command("dump --dump_plugins no --dump_schema no")
+column_create memos-content index COLUMN_INDEX memos content
+DROP TABLE memos;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_with_position_and_with_weight.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_with_position_and_with_weight.result
new file mode 100644
index 00000000000..853845d5c15
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_with_position_and_with_weight.result
@@ -0,0 +1,9 @@
+SET NAMES utf8;
+CREATE TABLE memos (
+content VARCHAR(64) NOT NULL,
+FULLTEXT INDEX (content) COMMENT 'index_flags "WITH_POSITION|WITH_WEIGHT"'
+) DEFAULT CHARSET=utf8;
+SELECT mroonga_command("dump --dump_plugins no --dump_schema no");
+mroonga_command("dump --dump_plugins no --dump_schema no")
+column_create memos-content index COLUMN_INDEX|WITH_WEIGHT|WITH_POSITION memos content
+DROP TABLE memos;
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_comment.result
index e2d405a1e35..e2d405a1e35 100644
--- 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_comment.result
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_fulltext_index_no_utf8_charset_with_utf8_normalizer.result
index 9d12e2d0e39..9d12e2d0e39 100644
--- 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_fulltext_index_no_utf8_charset_with_utf8_normalizer.result
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_normalizer_fulltext_index_none.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_normalizer_fulltext_index_none.result
new file mode 100644
index 00000000000..52c6f055e88
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_normalizer_fulltext_index_none.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 "none"'
+) DEFAULT CHARSET=utf8;
+INSERT INTO diaries VALUES ("2013-04-23", "Mroonga");
+SELECT * FROM diaries
+WHERE MATCH (content) AGAINST ("+Mroonga" IN BOOLEAN MODE);
+day content
+2013-04-23 Mroonga
+SELECT * FROM diaries
+WHERE MATCH (content) AGAINST ("+mroonga" IN BOOLEAN MODE);
+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_primary_key_table_comment.result
index dbf69362ee7..dbf69362ee7 100644
--- 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_primary_key_table_comment.result
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_normalizer_primary_key_table_comment_with_using_hash.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_normalizer_primary_key_table_comment_with_using_hash.result
new file mode 100644
index 00000000000..5e4f4afa377
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_normalizer_primary_key_table_comment_with_using_hash.result
@@ -0,0 +1,19 @@
+DROP TABLE IF EXISTS memos;
+DROP TABLE IF EXISTS terms;
+SET NAMES utf8;
+CREATE TABLE terms (
+term VARCHAR(64) NOT NULL,
+PRIMARY KEY (term) USING HASH
+) 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
index 68a6bc8012f..dc3f39d286e 100644
--- 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
@@ -5,12 +5,14 @@ CREATE TABLE bugs (
id INT UNSIGNED PRIMARY KEY,
tag VARCHAR(64) COMMENT 'type "tags"'
) DEFAULT CHARSET=utf8;
-SELECT mroonga_command("dump");
-mroonga_command("dump")
+SELECT mroonga_command("dump --dump_plugins no");
+mroonga_command("dump --dump_plugins no")
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
index 7d762258e6f..785c5d785b9 100644
--- 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
@@ -6,10 +6,12 @@ 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")
+SELECT mroonga_command("dump --dump_plugins no");
+mroonga_command("dump --dump_plugins no")
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
index 6cc89a7b941..9ce60054300 100644
--- 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
@@ -6,10 +6,12 @@ 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")
+SELECT mroonga_command("dump --dump_plugins no");
+mroonga_command("dump --dump_plugins no")
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
index fe7e0059250..de1946e9214 100644
--- 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
@@ -10,14 +10,16 @@ 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")
+SELECT mroonga_command("dump --dump_plugins no");
+mroonga_command("dump --dump_plugins no")
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
index fe855b60f38..f3349980db1 100644
--- 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
@@ -10,14 +10,16 @@ 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")
+SELECT mroonga_command("dump --dump_plugins no");
+mroonga_command("dump --dump_plugins no")
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
index 561a266598f..af3c19e9bb0 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_vector.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_vector.result
@@ -2,8 +2,8 @@ CREATE TABLE bugs (
id INT UNSIGNED PRIMARY KEY,
tags TEXT COMMENT 'flags "COLUMN_VECTOR"'
) DEFAULT CHARSET=utf8;
-SELECT mroonga_command("dump");
-mroonga_command("dump")
+SELECT mroonga_command("dump --dump_plugins no");
+mroonga_command("dump --dump_plugins no")
table_create bugs TABLE_PAT_KEY UInt32
column_create bugs id COLUMN_SCALAR UInt32
column_create bugs tags COLUMN_VECTOR LongText
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_all.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_all.result
new file mode 100644
index 00000000000..c8270bc3dde
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_all.result
@@ -0,0 +1,21 @@
+DROP TABLE IF EXISTS memos;
+SET NAMES utf8;
+CREATE TABLE memos (
+id INT PRIMARY KEY,
+title VARCHAR(255),
+content TEXT,
+FULLTEXT INDEX (title, content)
+) DEFAULT CHARSET=utf8;
+INSERT INTO memos VALUES(1, "Groonga", "Groonga is fast.");
+INSERT INTO memos VALUES(2, "Mroonga", "Mroonga is also fast.");
+INSERT INTO memos VALUES(3, "Rroonga", "Rroonga is also fast.");
+SELECT *,
+MATCH(title, content)
+AGAINST("*W1:10,2:2DOR Groonga Mroonga" in BOOLEAN MODE) AS score
+FROM memos
+WHERE MATCH(title, content)
+AGAINST("*W1:10,2:2DOR Groonga Mroonga" in BOOLEAN MODE);
+id title content score
+1 Groonga Groonga is fast. 12
+2 Mroonga Mroonga is also fast. 12
+DROP TABLE memos;
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
index 6c268ff7641..c337bfcb8db 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_insert_select.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_insert_select.result
@@ -43,24 +43,4 @@ 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_order_different_against.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_boolean_mode_different_against.result
index d1f0d6bc0ab..d1f0d6bc0ab 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_different_against.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_boolean_mode_different_against.result
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_boolean_mode_different_match.result
index b4a07cd0b66..b4a07cd0b66 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_different_match.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_boolean_mode_different_match.result
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_boolean_mode_no_where.result
index 125b35fb96e..125b35fb96e 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_no_where.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_boolean_mode_no_where.result
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_boolean_mode_same_match_against.result
index a3a668c4445..a3a668c4445 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_same_match_against.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_boolean_mode_same_match_against.result
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_natural_language_mode_asc.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_natural_language_mode_asc.result
new file mode 100644
index 00000000000..7f0934d3094
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_natural_language_mode_asc.result
@@ -0,0 +1,34 @@
+DROP TABLE IF EXISTS logs;
+SET NAMES UTF8;
+CREATE TABLE logs(
+message TEXT,
+FULLTEXT KEY (message)
+) DEFAULT CHARSET=utf8;
+INSERT INTO logs VALUES("Error Error Error");
+INSERT INTO logs VALUES("Warning Warning Warning");
+INSERT INTO logs VALUES("Error Error");
+INSERT INTO logs VALUES("Warning Warning");
+INSERT INTO logs VALUES("Error");
+INSERT INTO logs VALUES("Warning");
+INSERT INTO logs VALUES("Error Error Error Error");
+INSERT INTO logs VALUES("Warning Warning Warning Warning");
+SELECT * FROM logs;
+message
+Error Error Error
+Warning Warning Warning
+Error Error
+Warning Warning
+Error
+Warning
+Error Error Error Error
+Warning Warning Warning Warning
+SELECT *, MATCH(message) AGAINST("Error" IN NATURAL LANGUAGE MODE) AS score
+FROM logs
+WHERE MATCH(message) AGAINST("Error" IN NATURAL LANGUAGE MODE)
+ORDER BY MATCH(message) AGAINST("Error" IN NATURAL LANGUAGE MODE) ASC;
+message score
+Error 174763
+Error Error 349526
+Error Error Error 524289
+Error Error Error Error 699052
+DROP TABLE logs;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_natural_language_mode_desc.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_natural_language_mode_desc.result
new file mode 100644
index 00000000000..fa577b17f83
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_natural_language_mode_desc.result
@@ -0,0 +1,34 @@
+DROP TABLE IF EXISTS logs;
+SET NAMES UTF8;
+CREATE TABLE logs(
+message TEXT,
+FULLTEXT KEY (message)
+) DEFAULT CHARSET=utf8;
+INSERT INTO logs VALUES("Error Error Error");
+INSERT INTO logs VALUES("Warning Warning Warning");
+INSERT INTO logs VALUES("Error Error");
+INSERT INTO logs VALUES("Warning Warning");
+INSERT INTO logs VALUES("Error");
+INSERT INTO logs VALUES("Warning");
+INSERT INTO logs VALUES("Error Error Error Error");
+INSERT INTO logs VALUES("Warning Warning Warning Warning");
+SELECT * FROM logs;
+message
+Error Error Error
+Warning Warning Warning
+Error Error
+Warning Warning
+Error
+Warning
+Error Error Error Error
+Warning Warning Warning Warning
+SELECT *, MATCH(message) AGAINST("Error" IN NATURAL LANGUAGE MODE) AS score
+FROM logs
+WHERE MATCH(message) AGAINST("Error" IN NATURAL LANGUAGE MODE)
+ORDER BY MATCH(message) AGAINST("Error" IN NATURAL LANGUAGE MODE) DESC;
+message score
+Error Error Error Error 699052
+Error Error Error 524289
+Error Error 349526
+Error 174763
+DROP TABLE logs;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_natural_language_mode_different_against.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_natural_language_mode_different_against.result
new file mode 100644
index 00000000000..958883e5841
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_natural_language_mode_different_against.result
@@ -0,0 +1,34 @@
+DROP TABLE IF EXISTS logs;
+SET NAMES UTF8;
+CREATE TABLE logs(
+message TEXT,
+FULLTEXT KEY (message)
+) DEFAULT CHARSET=utf8;
+INSERT INTO logs VALUES("Error Error Error");
+INSERT INTO logs VALUES("Warning Warning Warning");
+INSERT INTO logs VALUES("Error Error");
+INSERT INTO logs VALUES("Warning Warning");
+INSERT INTO logs VALUES("Error");
+INSERT INTO logs VALUES("Warning");
+INSERT INTO logs VALUES("Error Error Error Error");
+INSERT INTO logs VALUES("Warning Warning Warning Warning");
+SELECT * FROM logs;
+message
+Error Error Error
+Warning Warning Warning
+Error Error
+Warning Warning
+Error
+Warning
+Error Error Error Error
+Warning Warning Warning Warning
+SELECT *, MATCH(message) AGAINST("Error" IN NATURAL LANGUAGE MODE) AS score
+FROM logs
+WHERE MATCH(message) AGAINST("Error Warning" IN NATURAL LANGUAGE MODE)
+ORDER BY MATCH(message) AGAINST("Error" IN NATURAL LANGUAGE MODE);
+message score
+Error 174763
+Error Error 349526
+Error Error Error 524289
+Error Error Error Error 699052
+DROP TABLE logs;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_natural_language_mode_different_match.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_natural_language_mode_different_match.result
new file mode 100644
index 00000000000..76abb660c19
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_natural_language_mode_different_match.result
@@ -0,0 +1,36 @@
+DROP TABLE IF EXISTS logs;
+SET NAMES UTF8;
+CREATE TABLE logs(
+message TEXT,
+host TEXT,
+FULLTEXT KEY (message),
+FULLTEXT KEY (host)
+) DEFAULT CHARSET=utf8;
+INSERT INTO logs VALUES("Error Error Error", "host1");
+INSERT INTO logs VALUES("Warning Warning Warning", "host1");
+INSERT INTO logs VALUES("Error Error", "host2");
+INSERT INTO logs VALUES("Warning Warning", "host2");
+INSERT INTO logs VALUES("Error", "host2");
+INSERT INTO logs VALUES("Warning", "host2");
+INSERT INTO logs VALUES("Error Error Error Error", "host2");
+INSERT INTO logs VALUES("Warning Warning Warning Warning", "host2");
+SELECT * FROM logs;
+message host
+Error Error Error host1
+Warning Warning Warning host1
+Error Error host2
+Warning Warning host2
+Error host2
+Warning host2
+Error Error Error Error host2
+Warning Warning Warning Warning host2
+SELECT *, MATCH(host) AGAINST("host2" IN NATURAL LANGUAGE MODE) AS score
+FROM logs
+WHERE MATCH(message) AGAINST("Error" IN NATURAL LANGUAGE MODE)
+ORDER BY MATCH(host) AGAINST("host2" IN NATURAL LANGUAGE MODE);
+message host score
+Error Error Error host1 0
+Error Error host2 116509
+Error host2 116509
+Error Error Error Error host2 116509
+DROP TABLE logs;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_natural_language_mode_no_where.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_natural_language_mode_no_where.result
new file mode 100644
index 00000000000..30130e6c85b
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_natural_language_mode_no_where.result
@@ -0,0 +1,37 @@
+DROP TABLE IF EXISTS logs;
+SET NAMES UTF8;
+CREATE TABLE logs(
+message TEXT,
+FULLTEXT KEY (message)
+) DEFAULT CHARSET=utf8;
+INSERT INTO logs VALUES("Error Error Error");
+INSERT INTO logs VALUES("Warning Warning Warning");
+INSERT INTO logs VALUES("Error Error");
+INSERT INTO logs VALUES("Warning Warning");
+INSERT INTO logs VALUES("Error");
+INSERT INTO logs VALUES("Warning");
+INSERT INTO logs VALUES("Error Error Error Error");
+INSERT INTO logs VALUES("Warning Warning Warning Warning");
+SELECT * FROM logs;
+message
+Error Error Error
+Warning Warning Warning
+Error Error
+Warning Warning
+Error
+Warning
+Error Error Error Error
+Warning Warning Warning Warning
+SELECT *, MATCH(message) AGAINST("Error" IN NATURAL LANGUAGE MODE) AS score
+FROM logs
+ORDER BY MATCH(message) AGAINST("Error" IN NATURAL LANGUAGE MODE);
+message score
+Warning Warning Warning 0
+Warning Warning 0
+Warning 0
+Warning Warning Warning Warning 0
+Error 174763
+Error Error 349526
+Error Error Error 524289
+Error Error Error Error 699052
+DROP TABLE logs;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_natural_language_mode_same_match_against.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_natural_language_mode_same_match_against.result
new file mode 100644
index 00000000000..ac2e7522db7
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_natural_language_mode_same_match_against.result
@@ -0,0 +1,34 @@
+DROP TABLE IF EXISTS logs;
+SET NAMES UTF8;
+CREATE TABLE logs(
+message TEXT,
+FULLTEXT KEY (message)
+) DEFAULT CHARSET=utf8;
+INSERT INTO logs VALUES("Error Error Error");
+INSERT INTO logs VALUES("Warning Warning Warning");
+INSERT INTO logs VALUES("Error Error");
+INSERT INTO logs VALUES("Warning Warning");
+INSERT INTO logs VALUES("Error");
+INSERT INTO logs VALUES("Warning");
+INSERT INTO logs VALUES("Error Error Error Error");
+INSERT INTO logs VALUES("Warning Warning Warning Warning");
+SELECT * FROM logs;
+message
+Error Error Error
+Warning Warning Warning
+Error Error
+Warning Warning
+Error
+Warning
+Error Error Error Error
+Warning Warning Warning Warning
+SELECT *, MATCH(message) AGAINST("Error" IN NATURAL LANGUAGE MODE) AS score
+FROM logs
+WHERE MATCH(message) AGAINST("Error" IN NATURAL LANGUAGE MODE)
+ORDER BY MATCH(message) AGAINST("Error" IN NATURAL LANGUAGE MODE);
+message score
+Error 174763
+Error Error 349526
+Error Error Error 524289
+Error Error Error Error 699052
+DROP TABLE logs;
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
index 2e9314db109..5e831860c5e 100644
--- 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
@@ -6,8 +6,8 @@ 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)
+SELECT ST_AsText(location) FROM shops;
+ST_AsText(location)
POINT(0 0)
POINT(0 0)
DROP TABLE shops;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/geometry_bulk_insert_null_57.result b/storage/mroonga/mysql-test/mroonga/storage/r/geometry_bulk_insert_null_57.result
new file mode 100644
index 00000000000..271cf922fd5
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/geometry_bulk_insert_null_57.result
@@ -0,0 +1,14 @@
+DROP TABLE IF EXISTS shops;
+CREATE TABLE shops (
+location GEOMETRY NOT NULL
+);
+SET SESSION sql_mode = '';
+INSERT INTO shops VALUES (NULL), (NULL);
+Warnings:
+Warning 1048 Column 'location' cannot be null
+SET SESSION sql_mode = default;
+SELECT ST_AsText(location) FROM shops;
+ST_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
index e88402a10b4..29fd989b4f4 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/geometry_contains.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/geometry_contains.result
@@ -16,113 +16,113 @@ shops CREATE TABLE `shops` (
) ENGINE=Mroonga DEFAULT CHARSET=latin1
INSERT INTO shops (name, location)
VALUES ('nezu-no-taiyaki',
-GeomFromText('POINT(139.762573 35.720253)'));
+ST_GeomFromText('POINT(139.762573 35.720253)'));
INSERT INTO shops (name, location)
VALUES ('taiyaki-kataoka',
-GeomFromText('POINT(139.715591 35.712521)'));
+ST_GeomFromText('POINT(139.715591 35.712521)'));
INSERT INTO shops (name, location)
VALUES ('soba-taiyaki-ku',
-GeomFromText('POINT(139.659088 35.683712)'));
+ST_GeomFromText('POINT(139.659088 35.683712)'));
INSERT INTO shops (name, location)
VALUES ('kuruma',
-GeomFromText('POINT(139.706207 35.721516)'));
+ST_GeomFromText('POINT(139.706207 35.721516)'));
INSERT INTO shops (name, location)
VALUES ('hirose-ya',
-GeomFromText('POINT(139.685608 35.714844)'));
+ST_GeomFromText('POINT(139.685608 35.714844)'));
INSERT INTO shops (name, location)
VALUES ('sazare',
-GeomFromText('POINT(139.685043 35.714653)'));
+ST_GeomFromText('POINT(139.685043 35.714653)'));
INSERT INTO shops (name, location)
VALUES ('omede-taiyaki',
-GeomFromText('POINT(139.817154 35.700516)'));
+ST_GeomFromText('POINT(139.817154 35.700516)'));
INSERT INTO shops (name, location)
VALUES ('onaga-ya',
-GeomFromText('POINT(139.81105 35.698254)'));
+ST_GeomFromText('POINT(139.81105 35.698254)'));
INSERT INTO shops (name, location)
VALUES ('shiro-ya',
-GeomFromText('POINT(139.638611 35.705517)'));
+ST_GeomFromText('POINT(139.638611 35.705517)'));
INSERT INTO shops (name, location)
VALUES ('fuji-ya',
-GeomFromText('POINT(139.637115 35.703938)'));
+ST_GeomFromText('POINT(139.637115 35.703938)'));
INSERT INTO shops (name, location)
VALUES ('miyoshi',
-GeomFromText('POINT(139.537323 35.644539)'));
+ST_GeomFromText('POINT(139.537323 35.644539)'));
INSERT INTO shops (name, location)
VALUES ('juju-ya',
-GeomFromText('POINT(139.695755 35.628922)'));
+ST_GeomFromText('POINT(139.695755 35.628922)'));
INSERT INTO shops (name, location)
VALUES ('tatsumi-ya',
-GeomFromText('POINT(139.638657 35.665501)'));
+ST_GeomFromText('POINT(139.638657 35.665501)'));
INSERT INTO shops (name, location)
VALUES ('tetsuji',
-GeomFromText('POINT(139.76857 35.680912)'));
+ST_GeomFromText('POINT(139.76857 35.680912)'));
INSERT INTO shops (name, location)
VALUES ('gazuma-ya',
-GeomFromText('POINT(139.647598 35.700817)'));
+ST_GeomFromText('POINT(139.647598 35.700817)'));
INSERT INTO shops (name, location)
VALUES ('honma-mon',
-GeomFromText('POINT(139.652573 35.722736)'));
+ST_GeomFromText('POINT(139.652573 35.722736)'));
INSERT INTO shops (name, location)
VALUES ('naniwa-ya',
-GeomFromText('POINT(139.796234 35.730061)'));
+ST_GeomFromText('POINT(139.796234 35.730061)'));
INSERT INTO shops (name, location)
VALUES ('kuro-dai',
-GeomFromText('POINT(139.704834 35.650345)'));
+ST_GeomFromText('POINT(139.704834 35.650345)'));
INSERT INTO shops (name, location)
VALUES ('daruma',
-GeomFromText('POINT(139.770599 35.681461)'));
+ST_GeomFromText('POINT(139.770599 35.681461)'));
INSERT INTO shops (name, location)
VALUES ('yanagi-ya',
-GeomFromText('POINT(139.783981 35.685341)'));
+ST_GeomFromText('POINT(139.783981 35.685341)'));
INSERT INTO shops (name, location)
VALUES ('sharaku',
-GeomFromText('POINT(139.794846 35.716969)'));
+ST_GeomFromText('POINT(139.794846 35.716969)'));
INSERT INTO shops (name, location)
VALUES ('takane',
-GeomFromText('POINT(139.560913 35.698601)'));
+ST_GeomFromText('POINT(139.560913 35.698601)'));
INSERT INTO shops (name, location)
VALUES ('chiyoda',
-GeomFromText('POINT(139.652817 35.642601)'));
+ST_GeomFromText('POINT(139.652817 35.642601)'));
INSERT INTO shops (name, location)
VALUES ('da-ka-po',
-GeomFromText('POINT(139.727356 35.627346)'));
+ST_GeomFromText('POINT(139.727356 35.627346)'));
INSERT INTO shops (name, location)
VALUES ('matsushima-ya',
-GeomFromText('POINT(139.737381 35.640556)'));
+ST_GeomFromText('POINT(139.737381 35.640556)'));
INSERT INTO shops (name, location)
VALUES ('kazuya',
-GeomFromText('POINT(139.760895 35.673508)'));
+ST_GeomFromText('POINT(139.760895 35.673508)'));
INSERT INTO shops (name, location)
VALUES ('furuya-kogane-an',
-GeomFromText('POINT(139.676071 35.680603)'));
+ST_GeomFromText('POINT(139.676071 35.680603)'));
INSERT INTO shops (name, location)
VALUES ('hachi-no-ie',
-GeomFromText('POINT(139.668106 35.608021)'));
+ST_GeomFromText('POINT(139.668106 35.608021)'));
INSERT INTO shops (name, location)
VALUES ('azuki-chan',
-GeomFromText('POINT(139.673203 35.64151)'));
+ST_GeomFromText('POINT(139.673203 35.64151)'));
INSERT INTO shops (name, location)
VALUES ('kuriko-an',
-GeomFromText('POINT(139.796829 35.712013)'));
+ST_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)'));
+ST_GeomFromText('POINT(139.712524 35.616199)'));
INSERT INTO shops (name, location)
VALUES ('naze-ya',
-GeomFromText('POINT(139.665833 35.609039)'));
+ST_GeomFromText('POINT(139.665833 35.609039)'));
INSERT INTO shops (name, location)
VALUES ('sanoki-ya',
-GeomFromText('POINT(139.770721 35.66592)'));
+ST_GeomFromText('POINT(139.770721 35.66592)'));
INSERT INTO shops (name, location)
VALUES ('shigeta',
-GeomFromText('POINT(139.780273 35.672626)'));
+ST_GeomFromText('POINT(139.780273 35.672626)'));
INSERT INTO shops (name, location)
VALUES ('nishimi-ya',
-GeomFromText('POINT(139.774628 35.671825)'));
+ST_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;
+ST_GeomFromText('POINT(139.711517 35.647701)'));
+SELECT id, name, ST_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)
@@ -160,8 +160,8 @@ id name location_text
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)
+SELECT id, name, ST_AsText(location) AS location_text FROM shops
+WHERE MBRContains(ST_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)
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_range_normal_greater_than_asc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_normal_greater_than_asc.result
new file mode 100644
index 00000000000..c2adc1cde2d
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_normal_greater_than_asc.result
@@ -0,0 +1,18 @@
+DROP TABLE IF EXISTS ids;
+SET NAMES UTF8;
+CREATE TABLE ids (
+id INT(10) UNSIGNED PRIMARY KEY AUTO_INCREMENT,
+value INT(10),
+INDEX (value)
+) ENGINE=Mroonga DEFAULT CHARSET=utf8;
+INSERT INTO ids VALUES(1, 50);
+INSERT INTO ids VALUES(2, 70);
+INSERT INTO ids VALUES(3, 30);
+INSERT INTO ids VALUES(4, 90);
+INSERT INTO ids VALUES(5, 10);
+SELECT id, value FROM ids WHERE value > 10 ORDER BY value ASC LIMIT 3;
+id value
+3 30
+1 50
+2 70
+DROP TABLE ids;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_range_normal_greater_than_desc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_normal_greater_than_desc.result
new file mode 100644
index 00000000000..715d299d608
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_normal_greater_than_desc.result
@@ -0,0 +1,18 @@
+DROP TABLE IF EXISTS ids;
+SET NAMES UTF8;
+CREATE TABLE ids (
+id INT(10) UNSIGNED PRIMARY KEY AUTO_INCREMENT,
+value INT(10),
+INDEX (value)
+) ENGINE=Mroonga DEFAULT CHARSET=utf8;
+INSERT INTO ids VALUES(1, 50);
+INSERT INTO ids VALUES(2, 70);
+INSERT INTO ids VALUES(3, 30);
+INSERT INTO ids VALUES(4, 90);
+INSERT INTO ids VALUES(5, 10);
+SELECT id, value FROM ids WHERE value > 10 ORDER BY value DESC LIMIT 3;
+id value
+4 90
+2 70
+1 50
+DROP TABLE ids;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_range_normal_greater_than_or_equal_asc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_normal_greater_than_or_equal_asc.result
new file mode 100644
index 00000000000..d562fbbb644
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_normal_greater_than_or_equal_asc.result
@@ -0,0 +1,18 @@
+DROP TABLE IF EXISTS ids;
+SET NAMES UTF8;
+CREATE TABLE ids (
+id INT(10) UNSIGNED PRIMARY KEY AUTO_INCREMENT,
+value INT(10),
+INDEX (value)
+) ENGINE=Mroonga DEFAULT CHARSET=utf8;
+INSERT INTO ids VALUES(1, 50);
+INSERT INTO ids VALUES(2, 70);
+INSERT INTO ids VALUES(3, 30);
+INSERT INTO ids VALUES(4, 90);
+INSERT INTO ids VALUES(5, 10);
+SELECT id, value FROM ids WHERE value >= 30 ORDER BY value ASC LIMIT 3;
+id value
+3 30
+1 50
+2 70
+DROP TABLE ids;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_range_normal_greater_than_or_equal_desc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_normal_greater_than_or_equal_desc.result
new file mode 100644
index 00000000000..5ecb4699fac
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_normal_greater_than_or_equal_desc.result
@@ -0,0 +1,18 @@
+DROP TABLE IF EXISTS ids;
+SET NAMES UTF8;
+CREATE TABLE ids (
+id INT(10) UNSIGNED PRIMARY KEY AUTO_INCREMENT,
+value INT(10),
+INDEX (value)
+) ENGINE=Mroonga DEFAULT CHARSET=utf8;
+INSERT INTO ids VALUES(1, 50);
+INSERT INTO ids VALUES(2, 70);
+INSERT INTO ids VALUES(3, 30);
+INSERT INTO ids VALUES(4, 90);
+INSERT INTO ids VALUES(5, 10);
+SELECT id, value FROM ids WHERE value >= 30 ORDER BY value DESC LIMIT 3;
+id value
+4 90
+2 70
+1 50
+DROP TABLE ids;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_range_normal_less_than_asc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_normal_less_than_asc.result
new file mode 100644
index 00000000000..45b3fbe122a
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_normal_less_than_asc.result
@@ -0,0 +1,18 @@
+DROP TABLE IF EXISTS ids;
+SET NAMES UTF8;
+CREATE TABLE ids (
+id INT(10) UNSIGNED PRIMARY KEY AUTO_INCREMENT,
+value INT(10),
+INDEX (value)
+) ENGINE=Mroonga DEFAULT CHARSET=utf8;
+INSERT INTO ids VALUES(1, 50);
+INSERT INTO ids VALUES(2, 70);
+INSERT INTO ids VALUES(3, 30);
+INSERT INTO ids VALUES(4, 90);
+INSERT INTO ids VALUES(5, 10);
+SELECT id, value FROM ids WHERE value < 90 ORDER BY value ASC LIMIT 3;
+id value
+5 10
+3 30
+1 50
+DROP TABLE ids;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_range_normal_less_than_desc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_normal_less_than_desc.result
new file mode 100644
index 00000000000..2e896e5e650
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_normal_less_than_desc.result
@@ -0,0 +1,18 @@
+DROP TABLE IF EXISTS ids;
+SET NAMES UTF8;
+CREATE TABLE ids (
+id INT(10) UNSIGNED PRIMARY KEY AUTO_INCREMENT,
+value INT(10),
+INDEX (value)
+) ENGINE=Mroonga DEFAULT CHARSET=utf8;
+INSERT INTO ids VALUES(1, 50);
+INSERT INTO ids VALUES(2, 70);
+INSERT INTO ids VALUES(3, 30);
+INSERT INTO ids VALUES(4, 90);
+INSERT INTO ids VALUES(5, 10);
+SELECT id, value FROM ids WHERE value < 90 ORDER BY value DESC LIMIT 3;
+id value
+2 70
+1 50
+3 30
+DROP TABLE ids;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_range_normal_less_than_or_equal_asc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_normal_less_than_or_equal_asc.result
new file mode 100644
index 00000000000..d5313c9d0f4
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_normal_less_than_or_equal_asc.result
@@ -0,0 +1,18 @@
+DROP TABLE IF EXISTS ids;
+SET NAMES UTF8;
+CREATE TABLE ids (
+id INT(10) UNSIGNED PRIMARY KEY AUTO_INCREMENT,
+value INT(10),
+INDEX (value)
+) ENGINE=Mroonga DEFAULT CHARSET=utf8;
+INSERT INTO ids VALUES(1, 50);
+INSERT INTO ids VALUES(2, 70);
+INSERT INTO ids VALUES(3, 30);
+INSERT INTO ids VALUES(4, 90);
+INSERT INTO ids VALUES(5, 10);
+SELECT id, value FROM ids WHERE value <= 70 ORDER BY value ASC LIMIT 3;
+id value
+5 10
+3 30
+1 50
+DROP TABLE ids;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_range_normal_less_than_or_equal_desc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_normal_less_than_or_equal_desc.result
new file mode 100644
index 00000000000..c56a4332f1f
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_normal_less_than_or_equal_desc.result
@@ -0,0 +1,18 @@
+DROP TABLE IF EXISTS ids;
+SET NAMES UTF8;
+CREATE TABLE ids (
+id INT(10) UNSIGNED PRIMARY KEY AUTO_INCREMENT,
+value INT(10),
+INDEX (value)
+) ENGINE=Mroonga DEFAULT CHARSET=utf8;
+INSERT INTO ids VALUES(1, 50);
+INSERT INTO ids VALUES(2, 70);
+INSERT INTO ids VALUES(3, 30);
+INSERT INTO ids VALUES(4, 90);
+INSERT INTO ids VALUES(5, 10);
+SELECT id, value FROM ids WHERE value <= 70 ORDER BY value DESC LIMIT 3;
+id value
+2 70
+1 50
+3 30
+DROP TABLE ids;
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_primary_greater_than_asc.result
index 1ca4b145f54..1ca4b145f54 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/index_range_greater_than_asc.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_primary_greater_than_asc.result
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_primary_greater_than_desc.result
index 80dcb25ffe6..80dcb25ffe6 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/index_range_greater_than_desc.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_primary_greater_than_desc.result
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_primary_greater_than_or_equal_asc.result
index 4c1ff997d79..4c1ff997d79 100644
--- 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_primary_greater_than_or_equal_asc.result
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_primary_greater_than_or_equal_desc.result
index 4998725aef5..4998725aef5 100644
--- 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_primary_greater_than_or_equal_desc.result
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_primary_less_than_asc.result
index 8b142f30610..8b142f30610 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/index_range_less_than_asc.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_primary_less_than_asc.result
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_primary_less_than_desc.result
index eaf5b87e62c..eaf5b87e62c 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/index_range_less_than_desc.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_primary_less_than_desc.result
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_primary_less_than_or_equal_asc.result
index e1e96c9ca8b..e1e96c9ca8b 100644
--- 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_primary_less_than_or_equal_asc.result
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_primary_less_than_or_equal_desc.result
index e8124ca14c0..e8124ca14c0 100644
--- 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_primary_less_than_or_equal_desc.result
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_unique_search_after_duplicated.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_unique_search_after_duplicated.result
new file mode 100644
index 00000000000..1d9d5fbbf51
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_unique_search_after_duplicated.result
@@ -0,0 +1,18 @@
+DROP TABLE IF EXISTS users;
+CREATE TABLE users (
+id int PRIMARY KEY,
+name varchar(100) NOT NULL,
+UNIQUE KEY (name)
+) DEFAULT CHARSET=utf8;
+INSERT INTO users VALUES (1, "Alice");
+INSERT INTO users VALUES (2, "Bob");
+INSERT INTO users VALUES (3, "Bob");
+ERROR 23000: Duplicate entry 'Bob' for key 'name'
+SELECT * FROM users;
+id name
+1 Alice
+2 Bob
+SELECT * FROM users WHERE name = "Bob";
+id name
+2 Bob
+DROP TABLE users;
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
deleted file mode 100644
index 8d3decfa32a..00000000000
--- a/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_plugins.result
+++ /dev/null
@@ -1,4 +0,0 @@
-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/insert_on_duplicate_key_update_unique_key.result b/storage/mroonga/mysql-test/mroonga/storage/r/insert_on_duplicate_key_update_unique_key.result
index 288e9e3a2c8..fbec44527f7 100644
--- 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
@@ -15,16 +15,19 @@ diaries CREATE TABLE `diaries` (
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)";
+VALUES ("2012-02-14", "clear day1")
+ON DUPLICATE KEY UPDATE title = "clear day1 (duplicated)";
INSERT INTO diaries (day, title)
-VALUES ("2012-02-14", "rainy day")
-ON DUPLICATE KEY UPDATE title = "rainy day (duplicated)";
+VALUES ("2012-02-14", "clear day2")
+ON DUPLICATE KEY UPDATE title = "clear day2 (duplicated)";
+INSERT INTO diaries (day, title)
+VALUES ("2012-02-14", "clear day3")
+ON DUPLICATE KEY UPDATE title = "clear day3 (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
+1 2012-02-14 clear day3 (duplicated)
+4 2012-02-15 cloudy day
DROP TABLE diaries;
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_count_skip_TODO_SPLIT_ME.result
index b66801094bd..b66801094bd 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_skip_count_TODO_SPLIT_ME.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_TODO_SPLIT_ME.result
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_count_skip_after_insert_multithread.result
index c09ec340ccb..c09ec340ccb 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_skip_count_after_insert_multithread.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_after_insert_multithread.result
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_count_skip_after_insert_single_thread.result
index c09ec340ccb..c09ec340ccb 100644
--- 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_count_skip_after_insert_single_thread.result
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_skip_count_disabled.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_disabled.result
index 9971d21e386..9971d21e386 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_skip_count_disabled.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_disabled.result
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_count_skip_index_view.result
index 407347a4fa2..407347a4fa2 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_skip_count_index_view.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_view.result
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_duplicated_order_by_columns.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_duplicated_order_by_columns.result
new file mode 100644
index 00000000000..9ea8ea40093
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_duplicated_order_by_columns.result
@@ -0,0 +1,19 @@
+DROP TABLE IF EXISTS ids;
+FLUSH STATUS;
+SET NAMES utf8mb4;
+CREATE TABLE ids (
+id int PRIMARY KEY,
+text varchar(32),
+FULLTEXT INDEX (text)
+) DEFAULT CHARSET=utf8mb4;
+INSERT INTO ids VALUES (1, 'first');
+SELECT * FROM ids
+WHERE MATCH(text) AGAINST('+first' IN BOOLEAN MODE)
+ORDER BY id, id
+LIMIT 1;
+id text
+1 first
+SHOW STATUS LIKE 'mroonga_fast_order_limit';
+Variable_name Value
+Mroonga_fast_order_limit 1
+DROP TABLE ids;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/partition_insert.result b/storage/mroonga/mysql-test/mroonga/storage/r/partition_insert.result
new file mode 100644
index 00000000000..ea1e63e39d0
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/partition_insert.result
@@ -0,0 +1,42 @@
+DROP TABLE IF EXISTS logs;
+SET NAMES UTF8;
+CREATE TABLE logs (
+timestamp DATETIME,
+message TEXT
+) DEFAULT CHARSET=UTF8
+PARTITION BY RANGE (TO_DAYS(timestamp)) (
+PARTITION p201501 VALUES LESS THAN (TO_DAYS('2015-02-01')),
+PARTITION p201502 VALUES LESS THAN (TO_DAYS('2015-03-01')),
+PARTITION p201503 VALUES LESS THAN (TO_DAYS('2015-04-01')),
+PARTITION pfuture VALUES LESS THAN MAXVALUE
+);
+SHOW CREATE TABLE logs;
+Table Create Table
+logs CREATE TABLE `logs` (
+ `timestamp` datetime DEFAULT NULL,
+ `message` text
+) ENGINE=Mroonga DEFAULT CHARSET=utf8
+/*!50100 PARTITION BY RANGE (TO_DAYS(timestamp))
+(PARTITION p201501 VALUES LESS THAN (735995) ENGINE = Mroonga,
+ PARTITION p201502 VALUES LESS THAN (736023) ENGINE = Mroonga,
+ PARTITION p201503 VALUES LESS THAN (736054) ENGINE = Mroonga,
+ PARTITION pfuture VALUES LESS THAN MAXVALUE ENGINE = Mroonga) */
+INSERT INTO logs VALUES('2015-01-01 00:00:00', 'Start');
+INSERT INTO logs VALUES('2015-01-31 23:59:59', 'Shutdown');
+INSERT INTO logs VALUES('2015-02-01 00:00:00', 'Start');
+INSERT INTO logs VALUES('2015-02-28 23:59:59', 'Shutdown');
+INSERT INTO logs VALUES('2015-03-01 00:00:00', 'Start');
+INSERT INTO logs VALUES('2015-03-31 23:59:59', 'Shutdown');
+INSERT INTO logs VALUES('2015-04-01 00:00:00', 'Start');
+INSERT INTO logs VALUES('2015-04-30 23:59:59', 'Shutdown');
+SELECT * FROM logs ORDER BY timestamp;
+timestamp message
+2015-01-01 00:00:00 Start
+2015-01-31 23:59:59 Shutdown
+2015-02-01 00:00:00 Start
+2015-02-28 23:59:59 Shutdown
+2015-03-01 00:00:00 Start
+2015-03-31 23:59:59 Shutdown
+2015-04-01 00:00:00 Start
+2015-04-30 23:59:59 Shutdown
+DROP TABLE logs;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/partition_update.result b/storage/mroonga/mysql-test/mroonga/storage/r/partition_update.result
new file mode 100644
index 00000000000..8d8208f81a9
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/partition_update.result
@@ -0,0 +1,43 @@
+DROP TABLE IF EXISTS logs;
+SET NAMES UTF8;
+CREATE TABLE logs (
+timestamp DATETIME,
+message TEXT
+) DEFAULT CHARSET=UTF8
+PARTITION BY RANGE (TO_DAYS(timestamp)) (
+PARTITION p201501 VALUES LESS THAN (TO_DAYS('2015-02-01')),
+PARTITION p201502 VALUES LESS THAN (TO_DAYS('2015-03-01')),
+PARTITION p201503 VALUES LESS THAN (TO_DAYS('2015-04-01')),
+PARTITION pfuture VALUES LESS THAN MAXVALUE
+);
+SHOW CREATE TABLE logs;
+Table Create Table
+logs CREATE TABLE `logs` (
+ `timestamp` datetime DEFAULT NULL,
+ `message` text
+) ENGINE=Mroonga DEFAULT CHARSET=utf8
+/*!50100 PARTITION BY RANGE (TO_DAYS(timestamp))
+(PARTITION p201501 VALUES LESS THAN (735995) ENGINE = Mroonga,
+ PARTITION p201502 VALUES LESS THAN (736023) ENGINE = Mroonga,
+ PARTITION p201503 VALUES LESS THAN (736054) ENGINE = Mroonga,
+ PARTITION pfuture VALUES LESS THAN MAXVALUE ENGINE = Mroonga) */
+INSERT INTO logs VALUES('2015-01-01 00:00:00', 'Start');
+INSERT INTO logs VALUES('2015-02-01 00:00:00', 'Start');
+INSERT INTO logs VALUES('2015-03-01 00:00:00', 'Start');
+INSERT INTO logs VALUES('2015-04-01 00:00:00', 'Start');
+SELECT * FROM logs ORDER BY timestamp;
+timestamp message
+2015-01-01 00:00:00 Start
+2015-02-01 00:00:00 Start
+2015-03-01 00:00:00 Start
+2015-04-01 00:00:00 Start
+UPDATE logs
+SET message = 'Started'
+ WHERE timestamp < '2015-03-01 00:00:00';
+SELECT * FROM logs ORDER BY timestamp;
+timestamp message
+2015-01-01 00:00:00 Started
+2015-02-01 00:00:00 Started
+2015-03-01 00:00:00 Start
+2015-04-01 00:00:00 Start
+DROP TABLE logs;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/repair_table_no_index_file.result b/storage/mroonga/mysql-test/mroonga/storage/r/repair_table_no_index_file.result
new file mode 100644
index 00000000000..0812fc1089b
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/repair_table_no_index_file.result
@@ -0,0 +1,40 @@
+CREATE DATABASE repair_test;
+USE repair_test;
+CREATE TABLE diaries (
+id INT PRIMARY KEY AUTO_INCREMENT,
+title TEXT,
+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,
+ `title` text,
+ `body` text,
+ PRIMARY KEY (`id`),
+ 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(body) AGAINST("+starting" IN BOOLEAN MODE);
+id title body
+2 Groonga (1) starting Groonga...
+FLUSH TABLES;
+SELECT * FROM diaries WHERE MATCH(body) AGAINST("+starting" IN BOOLEAN MODE);
+ERROR HY000: syscall error 'repair_test.mrn.000010A.c' (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" IN BOOLEAN MODE);
+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/storage/r/replace_geometry.result b/storage/mroonga/mysql-test/mroonga/storage/r/replace_geometry.result
index 94bd5167dbc..e88a799fe2f 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/replace_geometry.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/replace_geometry.result
@@ -5,19 +5,19 @@ 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)
+SELECT id, ST_AsText(geo) FROM geo_replace;
+id ST_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)
+SELECT id, ST_AsText(geo) FROM geo_replace;
+id ST_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)
+SELECT id, ST_AsText(geo) FROM geo_replace;
+id ST_AsText(geo)
1 POINT(200 200)
UPDATE geo_replace SET geo = POINT(200,300);
-SELECT id, ASTEXT(geo) FROM geo_replace;
-id ASTEXT(geo)
+SELECT id, ST_AsText(geo) FROM geo_replace;
+id ST_AsText(geo)
1 POINT(200 300)
DROP TABLE geo_replace;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/replace_without_key.result b/storage/mroonga/mysql-test/mroonga/storage/r/replace_without_key.result
new file mode 100644
index 00000000000..2c6c1cbc7e8
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/replace_without_key.result
@@ -0,0 +1,10 @@
+DROP TABLE IF EXISTS diaries;
+SET NAMES utf8;
+CREATE TABLE diaries (
+id varchar(32) NOT NULL PRIMARY KEY,
+content text,
+FULLTEXT INDEX (content)
+) DEFAULT CHARSET=utf8;
+REPLACE INTO diaries(content) VALUES("Hello");
+ERROR HY000: primary key is empty
+DROP TABLE diaries;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_boolean_mode_syntax_flags_allow_column.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_boolean_mode_syntax_flags_allow_column.result
new file mode 100644
index 00000000000..37826335b02
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_boolean_mode_syntax_flags_allow_column.result
@@ -0,0 +1,18 @@
+SET @mroonga_boolean_mode_syntax_flags_backup =
+@@mroonga_boolean_mode_syntax_flags;
+SET mroonga_boolean_mode_syntax_flags = "SYNTAX_QUERY,ALLOW_COLUMN";
+SET NAMES UTF8;
+CREATE TABLE diaries (
+title TEXT,
+content TEXT,
+FULLTEXT KEY (title),
+FULLTEXT KEY (content)
+) DEFAULT CHARSET=utf8;
+INSERT INTO diaries VALUES("Groonga", "Hello Groonga");
+SELECT * FROM diaries
+WHERE MATCH(title) AGAINST("content:@Hello" IN BOOLEAN MODE);
+title content
+Groonga Hello Groonga
+DROP TABLE diaries;
+SET mroonga_boolean_mode_syntax_flags =
+@mroonga_boolean_mode_syntax_flags_backup;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_boolean_mode_syntax_flags_allow_leading_not.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_boolean_mode_syntax_flags_allow_leading_not.result
new file mode 100644
index 00000000000..d3ccb150eab
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_boolean_mode_syntax_flags_allow_leading_not.result
@@ -0,0 +1,16 @@
+SET @mroonga_boolean_mode_syntax_flags_backup =
+@@mroonga_boolean_mode_syntax_flags;
+SET mroonga_boolean_mode_syntax_flags = "SYNTAX_QUERY,ALLOW_LEADING_NOT";
+SET NAMES UTF8;
+CREATE TABLE diaries (
+title TEXT,
+FULLTEXT KEY (title)
+) DEFAULT CHARSET=utf8;
+INSERT INTO diaries VALUES("Groonga");
+INSERT INTO diaries VALUES("Mroonga");
+SELECT * FROM diaries WHERE MATCH(title) AGAINST("-Groonga" IN BOOLEAN MODE);
+title
+Mroonga
+DROP TABLE diaries;
+SET mroonga_boolean_mode_syntax_flags =
+@mroonga_boolean_mode_syntax_flags_backup;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_boolean_mode_syntax_flags_allow_update.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_boolean_mode_syntax_flags_allow_update.result
new file mode 100644
index 00000000000..55cd8742758
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_boolean_mode_syntax_flags_allow_update.result
@@ -0,0 +1,18 @@
+SET @mroonga_boolean_mode_syntax_flags_backup =
+@@mroonga_boolean_mode_syntax_flags;
+SET mroonga_boolean_mode_syntax_flags = "SYNTAX_QUERY,ALLOW_COLUMN,ALLOW_UPDATE";
+SET NAMES UTF8;
+CREATE TABLE diaries (
+title TEXT,
+content TEXT,
+FULLTEXT KEY (title),
+FULLTEXT KEY (content)
+) DEFAULT CHARSET=utf8;
+INSERT INTO diaries VALUES("Groonga", "Hello Groonga");
+SELECT * FROM diaries
+WHERE MATCH(title) AGAINST('content:="Hello Mroonga"' IN BOOLEAN MODE);
+title content
+Groonga Hello Mroonga
+DROP TABLE diaries;
+SET mroonga_boolean_mode_syntax_flags =
+@mroonga_boolean_mode_syntax_flags_backup;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_boolean_mode_syntax_flags_syntax_query.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_boolean_mode_syntax_flags_syntax_query.result
new file mode 100644
index 00000000000..5736fd52c89
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_boolean_mode_syntax_flags_syntax_query.result
@@ -0,0 +1,15 @@
+SET @mroonga_boolean_mode_syntax_flags_backup =
+@@mroonga_boolean_mode_syntax_flags;
+SET mroonga_boolean_mode_syntax_flags = "SYNTAX_QUERY";
+SET NAMES UTF8;
+CREATE TABLE diaries (
+title TEXT,
+FULLTEXT KEY (title)
+) DEFAULT CHARSET=utf8;
+INSERT INTO diaries VALUES("Re:Mroonga");
+SELECT * FROM diaries WHERE MATCH(title) AGAINST("Re:Mroonga" IN BOOLEAN MODE);
+title
+Re:Mroonga
+DROP TABLE diaries;
+SET mroonga_boolean_mode_syntax_flags =
+@mroonga_boolean_mode_syntax_flags_backup;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_boolean_mode_syntax_flags_syntax_script.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_boolean_mode_syntax_flags_syntax_script.result
new file mode 100644
index 00000000000..e42fa259e4a
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_boolean_mode_syntax_flags_syntax_script.result
@@ -0,0 +1,16 @@
+SET @mroonga_boolean_mode_syntax_flags_backup =
+@@mroonga_boolean_mode_syntax_flags;
+SET mroonga_boolean_mode_syntax_flags = "SYNTAX_SCRIPT";
+SET NAMES UTF8;
+CREATE TABLE diaries (
+title TEXT,
+FULLTEXT KEY (title)
+) DEFAULT CHARSET=utf8;
+INSERT INTO diaries VALUES("Re:Mroonga");
+SELECT * FROM diaries
+WHERE MATCH(title) AGAINST("title @ 'Re:Mroonga'" IN BOOLEAN MODE);
+title
+Re:Mroonga
+DROP TABLE diaries;
+SET mroonga_boolean_mode_syntax_flags =
+@mroonga_boolean_mode_syntax_flags_backup;
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
index 4536dded9d7..beca93b62ad 100644
--- 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
@@ -13,5 +13,5 @@ id
1
DROP TABLE counts;
DROP DATABASE clean_test;
-USE test;
SET GLOBAL mroonga_database_path_prefix = NULL;
+USE test;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_global.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_global.result
new file mode 100644
index 00000000000..0181fe02d84
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_global.result
@@ -0,0 +1,20 @@
+DROP TABLE IF EXISTS ids;
+CREATE TABLE ids (
+id INT PRIMARY KEY AUTO_INCREMENT
+) DEFAULT CHARSET=UTF8;
+INSERT INTO ids VALUES (1);
+INSERT INTO ids VALUES (2);
+INSERT INTO ids VALUES (3);
+INSERT INTO ids VALUES (4);
+INSERT INTO ids VALUES (5);
+INSERT INTO ids VALUES (6);
+INSERT INTO ids VALUES (7);
+INSERT INTO ids VALUES (8);
+INSERT INTO ids VALUES (9);
+INSERT INTO ids VALUES (10);
+SET GLOBAL mroonga_max_n_records_for_estimate = 1;
+EXPLAIN SELECT * FROM ids WHERE id > 5;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE ids range PRIMARY PRIMARY 4 NULL 1 Using where; Using index
+SET GLOBAL mroonga_max_n_records_for_estimate = DEFAULT;
+DROP TABLE ids;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_session.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_session.result
new file mode 100644
index 00000000000..aca9d75c20f
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_session.result
@@ -0,0 +1,20 @@
+DROP TABLE IF EXISTS ids;
+CREATE TABLE ids (
+id INT PRIMARY KEY AUTO_INCREMENT
+) DEFAULT CHARSET=UTF8;
+INSERT INTO ids VALUES (1);
+INSERT INTO ids VALUES (2);
+INSERT INTO ids VALUES (3);
+INSERT INTO ids VALUES (4);
+INSERT INTO ids VALUES (5);
+INSERT INTO ids VALUES (6);
+INSERT INTO ids VALUES (7);
+INSERT INTO ids VALUES (8);
+INSERT INTO ids VALUES (9);
+INSERT INTO ids VALUES (10);
+SET mroonga_max_n_records_for_estimate = 1;
+EXPLAIN SELECT * FROM ids WHERE id > 5;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE ids range PRIMARY PRIMARY 4 NULL 1 Using where; Using index
+SET mroonga_max_n_records_for_estimate = DEFAULT;
+DROP TABLE ids;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result
deleted file mode 100644
index aae83fe2b38..00000000000
--- a/storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result
+++ /dev/null
@@ -1,3 +0,0 @@
-show variables like 'mroonga_version';
-Variable_name Value
-mroonga_version 4.06
diff --git a/storage/mroonga/mysql-test/mroonga/storage/suite.pm b/storage/mroonga/mysql-test/mroonga/storage/suite.pm
index 528ccc5d693..6b345c0fd6f 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/suite.pm
+++ b/storage/mroonga/mysql-test/mroonga/storage/suite.pm
@@ -5,6 +5,11 @@ package My::Suite::Mroonga;
return "No Mroonga engine" unless $ENV{HA_MROONGA_SO} or
$::mysqld_variables{'mroonga'} eq "ON";
+# RECOMPILE_FOR_EMBEDDED also means that a plugin
+# cannot be dynamically loaded into embedded
+return "Not run for embedded server" if $::opt_embedded_server and
+ $ENV{HA_MROONGA_SO};
+
sub is_default { 1 }
my $groonga_normalizer_mysql_dir=$::basedir . '/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql';
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
index c93ae13a19e..96c99612190 100644
--- 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
@@ -30,7 +30,7 @@ CREATE TABLE tags (
ALTER TABLE tags ADD COLUMN name VARCHAR(64) COMMENT 'flags "COLUMN_VECTOR"';
-SELECT mroonga_command("dump");
+SELECT mroonga_command("dump --dump_plugins no");
DROP TABLE tags;
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
index 2f39d52777a..dd05765585d 100644
--- 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
@@ -34,7 +34,7 @@ CREATE TABLE bugs (
ALTER TABLE bugs ADD COLUMN name VARCHAR(64) COMMENT 'type "tags"';
-SELECT mroonga_command("dump");
+SELECT mroonga_command("dump --dump_plugins no");
DROP TABLE bugs;
DROP TABLE tags;
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
index aee355fdfc1..9c01dc27e3e 100644
--- 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
@@ -31,11 +31,9 @@ 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");
+SELECT mroonga_command("dump --dump_plugins no");
DROP TABLE memos;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_unique_multiple_column_duplicated.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_unique_multiple_column_duplicated.test
new file mode 100644
index 00000000000..72e0ebc14a4
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_unique_multiple_column_duplicated.test
@@ -0,0 +1,39 @@
+# Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along 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 (
+ id1 INT,
+ id2 INT
+) DEFAULT CHARSET=utf8mb4;
+
+INSERT INTO ids (id1, id2) values (1, 2), (1, 2);
+
+--error ER_DUP_UNIQUE
+ALTER TABLE ids ADD UNIQUE INDEX (id1, id2);
+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_primary_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_primary_key.test
new file mode 100644
index 00000000000..3dbfe5e24f0
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_primary_key.test
@@ -0,0 +1,37 @@
+# Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# 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 NOT NULL
+) ENGINE=Mroonga DEFAULT CHARSET=utf8;
+
+INSERT INTO ids VALUES (1);
+INSERT INTO ids VALUES (2);
+
+ALTER TABLE ids ADD PRIMARY KEY (id);
+SHOW CREATE TABLE ids;
+
+SELECT * FROM ids WHERE id = 2;
+
+DROP TABLE ids;
+
+--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
index fd47d2a60f0..7ec047818e3 100644
--- 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
@@ -36,11 +36,16 @@ CREATE TABLE memos (
FULLTEXT INDEX (content) COMMENT 'table "terms"'
) DEFAULT CHARSET=utf8;
-SELECT mroonga_command("dump");
+SELECT mroonga_command("dump --dump_plugins no");
ALTER TABLE terms COMMENT='default_tokenizer "TokenBigram", token_filters "TokenFilterStopWord"';
-SELECT mroonga_command("dump");
+SELECT mroonga_command("dump --dump_plugins no");
+
+ALTER TABLE memos DISABLE KEYS;
+ALTER TABLE memos ENABLE KEYS;
+
+SELECT mroonga_command("dump --dump_plugins no");
DROP TABLE memos;
DROP TABLE terms;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_table.test
new file mode 100644
index 00000000000..97d2d2ed5ec
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_table.test
@@ -0,0 +1,46 @@
+# Copyright(C) 2014 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if 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
+
+SET NAMES utf8;
+CREATE TABLE terms (
+ term varchar(256) NOT NULL PRIMARY KEY
+) COMMENT='default_tokenizer "TokenBigram", normalizer "NormalizerAuto"'
+ DEFAULT CHARSET=utf8;
+
+CREATE TABLE memos (
+ id int PRIMARY KEY,
+ content text NOT NULL,
+ FULLTEXT INDEX content_index (content) COMMENT 'table "terms"'
+) DEFAULT CHARSET=utf8;
+
+SELECT mroonga_command("dump --dump_plugins no");
+ALTER TABLE memos DISABLE KEYS;
+SELECT mroonga_command("dump --dump_plugins no");
+
+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_drop_primary_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_primary_key.test
new file mode 100644
index 00000000000..87de166cbfd
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_primary_key.test
@@ -0,0 +1,37 @@
+# Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# 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
+) ENGINE=Mroonga DEFAULT CHARSET=utf8;
+
+INSERT INTO ids VALUES (1);
+INSERT INTO ids VALUES (2);
+
+ALTER TABLE ids DROP PRIMARY KEY;
+SHOW CREATE TABLE ids;
+
+SELECT * FROM ids WHERE id = 2;
+
+DROP TABLE ids;
+
+--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_table.test
new file mode 100644
index 00000000000..4ff4af63534
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_table.test
@@ -0,0 +1,47 @@
+# Copyright(C) 2014 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if 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
+
+SET NAMES utf8;
+CREATE TABLE terms (
+ term varchar(256) NOT NULL PRIMARY KEY
+) COMMENT='default_tokenizer "TokenBigram", normalizer "NormalizerAuto"'
+ DEFAULT CHARSET=utf8;
+
+CREATE TABLE memos (
+ id int PRIMARY KEY,
+ content text NOT NULL,
+ FULLTEXT INDEX content_index (content) COMMENT 'table "terms"'
+) DEFAULT CHARSET=utf8;
+
+ALTER TABLE memos DISABLE KEYS;
+SELECT mroonga_command("dump --dump_plugins no");
+ALTER TABLE memos ENABLE KEYS;
+SELECT mroonga_command("dump --dump_plugins no");
+
+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_spatial.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_spatial.test
index 8a41792bdae..9072d837a83 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_spatial.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_spatial.test
@@ -16,6 +16,7 @@
--source include/not_embedded.inc
--source include/have_geometry.inc
+--source ../../include/mroonga/have_version_56_or_later.inc
--source ../../include/mroonga/have_mroonga.inc
--disable_warnings
@@ -30,117 +31,117 @@ CREATE TABLE shops (
INSERT INTO shops (name, location)
VALUES ('nezu-no-taiyaki',
- GeomFromText('POINT(139.762573 35.720253)'));
+ ST_GeomFromText('POINT(139.762573 35.720253)'));
INSERT INTO shops (name, location)
VALUES ('taiyaki-kataoka',
- GeomFromText('POINT(139.715591 35.712521)'));
+ ST_GeomFromText('POINT(139.715591 35.712521)'));
INSERT INTO shops (name, location)
VALUES ('soba-taiyaki-ku',
- GeomFromText('POINT(139.659088 35.683712)'));
+ ST_GeomFromText('POINT(139.659088 35.683712)'));
INSERT INTO shops (name, location)
VALUES ('kuruma',
- GeomFromText('POINT(139.706207 35.721516)'));
+ ST_GeomFromText('POINT(139.706207 35.721516)'));
INSERT INTO shops (name, location)
VALUES ('hirose-ya',
- GeomFromText('POINT(139.685608 35.714844)'));
+ ST_GeomFromText('POINT(139.685608 35.714844)'));
INSERT INTO shops (name, location)
VALUES ('sazare',
- GeomFromText('POINT(139.685043 35.714653)'));
+ ST_GeomFromText('POINT(139.685043 35.714653)'));
INSERT INTO shops (name, location)
VALUES ('omede-taiyaki',
- GeomFromText('POINT(139.817154 35.700516)'));
+ ST_GeomFromText('POINT(139.817154 35.700516)'));
INSERT INTO shops (name, location)
VALUES ('onaga-ya',
- GeomFromText('POINT(139.81105 35.698254)'));
+ ST_GeomFromText('POINT(139.81105 35.698254)'));
INSERT INTO shops (name, location)
VALUES ('shiro-ya',
- GeomFromText('POINT(139.638611 35.705517)'));
+ ST_GeomFromText('POINT(139.638611 35.705517)'));
INSERT INTO shops (name, location)
VALUES ('fuji-ya',
- GeomFromText('POINT(139.637115 35.703938)'));
+ ST_GeomFromText('POINT(139.637115 35.703938)'));
INSERT INTO shops (name, location)
VALUES ('miyoshi',
- GeomFromText('POINT(139.537323 35.644539)'));
+ ST_GeomFromText('POINT(139.537323 35.644539)'));
INSERT INTO shops (name, location)
VALUES ('juju-ya',
- GeomFromText('POINT(139.695755 35.628922)'));
+ ST_GeomFromText('POINT(139.695755 35.628922)'));
INSERT INTO shops (name, location)
VALUES ('tatsumi-ya',
- GeomFromText('POINT(139.638657 35.665501)'));
+ ST_GeomFromText('POINT(139.638657 35.665501)'));
INSERT INTO shops (name, location)
VALUES ('tetsuji',
- GeomFromText('POINT(139.76857 35.680912)'));
+ ST_GeomFromText('POINT(139.76857 35.680912)'));
INSERT INTO shops (name, location)
VALUES ('gazuma-ya',
- GeomFromText('POINT(139.647598 35.700817)'));
+ ST_GeomFromText('POINT(139.647598 35.700817)'));
INSERT INTO shops (name, location)
VALUES ('honma-mon',
- GeomFromText('POINT(139.652573 35.722736)'));
+ ST_GeomFromText('POINT(139.652573 35.722736)'));
INSERT INTO shops (name, location)
VALUES ('naniwa-ya',
- GeomFromText('POINT(139.796234 35.730061)'));
+ ST_GeomFromText('POINT(139.796234 35.730061)'));
INSERT INTO shops (name, location)
VALUES ('kuro-dai',
- GeomFromText('POINT(139.704834 35.650345)'));
+ ST_GeomFromText('POINT(139.704834 35.650345)'));
INSERT INTO shops (name, location)
VALUES ('daruma',
- GeomFromText('POINT(139.770599 35.681461)'));
+ ST_GeomFromText('POINT(139.770599 35.681461)'));
INSERT INTO shops (name, location)
VALUES ('yanagi-ya',
- GeomFromText('POINT(139.783981 35.685341)'));
+ ST_GeomFromText('POINT(139.783981 35.685341)'));
INSERT INTO shops (name, location)
VALUES ('sharaku',
- GeomFromText('POINT(139.794846 35.716969)'));
+ ST_GeomFromText('POINT(139.794846 35.716969)'));
INSERT INTO shops (name, location)
VALUES ('takane',
- GeomFromText('POINT(139.560913 35.698601)'));
+ ST_GeomFromText('POINT(139.560913 35.698601)'));
INSERT INTO shops (name, location)
VALUES ('chiyoda',
- GeomFromText('POINT(139.652817 35.642601)'));
+ ST_GeomFromText('POINT(139.652817 35.642601)'));
INSERT INTO shops (name, location)
VALUES ('da-ka-po',
- GeomFromText('POINT(139.727356 35.627346)'));
+ ST_GeomFromText('POINT(139.727356 35.627346)'));
INSERT INTO shops (name, location)
VALUES ('matsushima-ya',
- GeomFromText('POINT(139.737381 35.640556)'));
+ ST_GeomFromText('POINT(139.737381 35.640556)'));
INSERT INTO shops (name, location)
VALUES ('kazuya',
- GeomFromText('POINT(139.760895 35.673508)'));
+ ST_GeomFromText('POINT(139.760895 35.673508)'));
INSERT INTO shops (name, location)
VALUES ('furuya-kogane-an',
- GeomFromText('POINT(139.676071 35.680603)'));
+ ST_GeomFromText('POINT(139.676071 35.680603)'));
INSERT INTO shops (name, location)
VALUES ('hachi-no-ie',
- GeomFromText('POINT(139.668106 35.608021)'));
+ ST_GeomFromText('POINT(139.668106 35.608021)'));
INSERT INTO shops (name, location)
VALUES ('azuki-chan',
- GeomFromText('POINT(139.673203 35.64151)'));
+ ST_GeomFromText('POINT(139.673203 35.64151)'));
INSERT INTO shops (name, location)
VALUES ('kuriko-an',
- GeomFromText('POINT(139.796829 35.712013)'));
+ ST_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)'));
+ ST_GeomFromText('POINT(139.712524 35.616199)'));
INSERT INTO shops (name, location)
VALUES ('naze-ya',
- GeomFromText('POINT(139.665833 35.609039)'));
+ ST_GeomFromText('POINT(139.665833 35.609039)'));
INSERT INTO shops (name, location)
VALUES ('sanoki-ya',
- GeomFromText('POINT(139.770721 35.66592)'));
+ ST_GeomFromText('POINT(139.770721 35.66592)'));
INSERT INTO shops (name, location)
VALUES ('shigeta',
- GeomFromText('POINT(139.780273 35.672626)'));
+ ST_GeomFromText('POINT(139.780273 35.672626)'));
INSERT INTO shops (name, location)
VALUES ('nishimi-ya',
- GeomFromText('POINT(139.774628 35.671825)'));
+ ST_GeomFromText('POINT(139.774628 35.671825)'));
INSERT INTO shops (name, location)
VALUES ('hiiragi',
- GeomFromText('POINT(139.711517 35.647701)'));
+ ST_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)
+SELECT id, name, ST_AsText(location) AS location_text FROM shops
+ WHERE MBRContains(ST_GeomFromText('LineString(139.7727 35.6684, 139.7038 35.7121)'), location)
ORDER BY id;
SHOW CREATE TABLE shops;
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/version_55_performance_schema.test b/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_520_ci_french.test
index 809b6fa29b1..204b1f416ad 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/version_55_performance_schema.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_520_ci_french.test
@@ -1,4 +1,4 @@
-# Copyright(C) 2012 Kouhei Sutou <kou@clear-code.com>
+# Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -14,27 +14,22 @@
# License along with this 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_version_56_or_later.inc
--source ../../include/mroonga/have_mroonga.inc
--disable_warnings
DROP TABLE IF EXISTS diaries;
--enable_warnings
-SHOW VARIABLES LIKE 'performance_schema';
-
+SET NAMES utf8mb4;
CREATE TABLE diaries (
- id INT PRIMARY KEY AUTO_INCREMENT,
- content VARCHAR(255),
+ content varchar(256) COLLATE utf8mb4_unicode_520_ci,
FULLTEXT INDEX (content)
-) DEFAULT CHARSET UTF8 COMMENT = 'ENGINE "InnoDB"';
-SHOW CREATE TABLE diaries;
+) DEFAULT CHARSET=utf8mb4;
-INSERT INTO diaries (content) VALUES ("Tommorow will be shiny day!");
+INSERT INTO diaries VALUES ("Je suis un garçon.");
-SHOW TABLES FROM performance_schema;
+SELECT * FROM diaries WHERE MATCH (content) AGAINST ("+garcon" IN BOOLEAN MODE);
DROP TABLE diaries;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_520_ci_japanese.test b/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_520_ci_japanese.test
new file mode 100644
index 00000000000..a6a18dc4846
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_520_ci_japanese.test
@@ -0,0 +1,37 @@
+# Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this 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/mroonga/have_mroonga.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS diaries;
+--enable_warnings
+
+SET NAMES utf8mb4;
+CREATE TABLE diaries (
+ content varchar(256) COLLATE utf8mb4_unicode_520_ci,
+ FULLTEXT INDEX (content)
+) DEFAULT CHARSET=utf8mb4;
+
+INSERT INTO diaries VALUES ("ã²ã‚‰ãŒãªã¨ã‚«ã‚¿ã‚«ãƒŠã‚’覚ãˆã¾ã—ãŸã€‚");
+
+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/column_groonga_index_fulltext_other_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_fulltext_other_table.test
index 805c744236f..dbaf2fb429f 100644
--- 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
@@ -1,4 +1,4 @@
-# Copyright(C) 2013 Kouhei Sutou <kou@clear-code.com>
+# Copyright(C) 2014 Kouhei Sutou <kou@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -16,39 +16,27 @@
--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 (
+CREATE TABLE terms (
name VARCHAR(64) PRIMARY KEY
) DEFAULT CHARSET=utf8
- COLLATE=utf8_bin
- COMMENT='default_tokenizer "TokenDelimit"';
+ COMMENT='default_tokenizer "TokenBigram"';
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"'
+ title TEXT,
+ FULLTEXT INDEX (title) COMMENT 'table "terms"'
) DEFAULT CHARSET=utf8;
-INSERT INTO bugs (id, tags) VALUES (1, "Linux MySQL groonga");
+INSERT INTO bugs (id, title) VALUES (1, "Mroonga can't build with MySQL X.Y.Z");
-SELECT mroonga_command("dump");
+SELECT * FROM terms ORDER BY name;
-SELECT *, MATCH (tags) AGAINST ("MySQL" IN BOOLEAN MODE) AS score
+SELECT *, MATCH (title) AGAINST ("+MySQL" IN BOOLEAN MODE) AS score
FROM bugs
- WHERE MATCH (tags) AGAINST ("MySQL" IN BOOLEAN MODE);
+ WHERE MATCH (title) AGAINST ("+MySQL" IN BOOLEAN MODE);
DROP TABLE bugs;
-DROP TABLE tags;
-
-DROP DATABASE mroonga;
+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/column_groonga_index_fulltext_vector_other_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_fulltext_vector_other_table.test
new file mode 100644
index 00000000000..e9c9bb9b5ee
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_fulltext_vector_other_table.test
@@ -0,0 +1,54 @@
+# Copyright(C) 2013 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along 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 --dump_plugins no --dump_records no");
+
+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
index 91f204133dd..27cf85033cb 100644
--- 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
@@ -40,7 +40,7 @@ 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 mroonga_command("dump --dump_plugins no --dump_records no");
SELECT *
FROM bugs
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_support_lz4.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_support_lz4.test
new file mode 100644
index 00000000000..5de8f951d8f
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_support_lz4.test
@@ -0,0 +1,37 @@
+# Copyright(C) 2014 Naoya Murakami <naoya@createfield.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if 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/support_libgroonga_lz4.inc
+--source ../../include/mroonga/load_mroonga_functions.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS entries;
+--enable_warnings
+
+CREATE TABLE entries (
+ id INT UNSIGNED PRIMARY KEY,
+ content TEXT COMMENT 'flags "COLUMN_SCALAR|COMPRESS_LZ4"'
+) DEFAULT CHARSET=utf8;
+
+INSERT INTO entries (id, content) VALUES (1, "I found Mroonga that is a MySQL storage engine to use Groonga!");
+
+SELECT * FROM entries;
+
+DROP TABLE entries;
+
+--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_support_zlib.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_support_zlib.test
new file mode 100644
index 00000000000..3ec14ebef76
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_support_zlib.test
@@ -0,0 +1,37 @@
+# Copyright(C) 2014 Naoya Murakami <naoya@createfield.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if 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/support_libgroonga_zlib.inc
+--source ../../include/mroonga/load_mroonga_functions.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS entries;
+--enable_warnings
+
+CREATE TABLE entries (
+ id INT UNSIGNED PRIMARY KEY,
+ content TEXT COMMENT 'flags "COLUMN_SCALAR|COMPRESS_ZLIB"'
+) DEFAULT CHARSET=utf8;
+
+INSERT INTO entries (id, content) VALUES (1, "I found Mroonga that is a MySQL storage engine to use Groonga!");
+
+SELECT * FROM entries;
+
+DROP TABLE entries;
+
+--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_unsupport_lz4.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_unsupport_lz4.test
new file mode 100644
index 00000000000..324b7ac89f5
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_unsupport_lz4.test
@@ -0,0 +1,37 @@
+# Copyright(C) 2014 Naoya Murakami <naoya@createfield.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if 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/unsupport_libgroonga_lz4.inc
+--source ../../include/mroonga/load_mroonga_functions.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS entries;
+--enable_warnings
+
+CREATE TABLE entries (
+ id INT UNSIGNED PRIMARY KEY,
+ content TEXT COMMENT 'flags "COLUMN_SCALAR|COMPRESS_LZ4"'
+) DEFAULT CHARSET=utf8;
+
+INSERT INTO entries (id, content) VALUES (1, "I found Mroonga that is a MySQL storage engine to use Groonga!");
+
+SELECT * FROM entries;
+
+DROP TABLE entries;
+
+--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_unsupport_zlib.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_unsupport_zlib.test
new file mode 100644
index 00000000000..10e77e40e3d
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_unsupport_zlib.test
@@ -0,0 +1,37 @@
+# Copyright(C) 2014 Naoya Murakami <naoya@createfield.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if 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/unsupport_libgroonga_zlib.inc
+--source ../../include/mroonga/load_mroonga_functions.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS entries;
+--enable_warnings
+
+CREATE TABLE entries (
+ id INT UNSIGNED PRIMARY KEY,
+ content TEXT COMMENT 'flags "COLUMN_SCALAR|COMPRESS_ZLIB"'
+) DEFAULT CHARSET=utf8;
+
+INSERT INTO entries (id, content) VALUES (1, "I found Mroonga that is a MySQL storage engine to use Groonga!");
+
+SELECT * FROM entries;
+
+DROP TABLE entries;
+
+--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
index 7c8cd3f32a0..30b53f8eee0 100644
--- 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
@@ -30,7 +30,7 @@ CREATE TABLE tags (
COLLATE=utf8_bin
COMMENT='default_tokenizer "TokenDelimit"';
-SELECT mroonga_command("dump");
+SELECT mroonga_command("dump --dump_plugins no");
DROP TABLE tags;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_none.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_none.test
new file mode 100644
index 00000000000..039c518e673
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_none.test
@@ -0,0 +1,38 @@
+# Copyright(C) 2015 Naoya Murakami <naoya@createfield.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if 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
+
+SET NAMES utf8;
+
+CREATE TABLE memos (
+ content VARCHAR(64) NOT NULL,
+ FULLTEXT INDEX (content) COMMENT 'index_flags "NONE"'
+) DEFAULT CHARSET=utf8;
+
+SELECT mroonga_command("dump --dump_plugins no --dump_schema no");
+
+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_index_flags_with_position_and_with_weight.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_with_position_and_with_weight.test
new file mode 100644
index 00000000000..9a67644d2c5
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_with_position_and_with_weight.test
@@ -0,0 +1,38 @@
+# Copyright(C) 2015 Naoya Murakami <naoya@createfield.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if 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
+
+SET NAMES utf8;
+
+CREATE TABLE memos (
+ content VARCHAR(64) NOT NULL,
+ FULLTEXT INDEX (content) COMMENT 'index_flags "WITH_POSITION|WITH_WEIGHT"'
+) DEFAULT CHARSET=utf8;
+
+SELECT mroonga_command("dump --dump_plugins no --dump_schema no");
+
+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_normalizer_fulltext_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_normalizer_fulltext_index_comment.test
index 02e2cb9e81a..02e2cb9e81a 100644
--- 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_comment.test
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_fulltext_index_no_utf8_charset_with_utf8_normalizer.test
index f28fb5b8695..f28fb5b8695 100644
--- 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_fulltext_index_no_utf8_charset_with_utf8_normalizer.test
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_normalizer_fulltext_index_none.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_normalizer_fulltext_index_none.test
new file mode 100644
index 00000000000..ae4d4cb9f1b
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_normalizer_fulltext_index_none.test
@@ -0,0 +1,42 @@
+# Copyright(C) 2014 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if 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 "none"'
+) DEFAULT CHARSET=utf8;
+
+INSERT INTO diaries VALUES ("2013-04-23", "Mroonga");
+
+SELECT * FROM diaries
+ WHERE MATCH (content) AGAINST ("+Mroonga" IN BOOLEAN MODE);
+SELECT * FROM diaries
+ WHERE MATCH (content) AGAINST ("+mroonga" 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_table_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_normalizer_primary_key_table_comment.test
index 1da8026f56d..1da8026f56d 100644
--- 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_primary_key_table_comment.test
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_normalizer_primary_key_table_comment_with_using_hash.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_normalizer_primary_key_table_comment_with_using_hash.test
new file mode 100644
index 00000000000..14b9ea9ab87
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_normalizer_primary_key_table_comment_with_using_hash.test
@@ -0,0 +1,47 @@
+# Copyright(C) 2015 Naoya Murakami <naoya@createfield.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if 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 (term) USING HASH
+) 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
index eb1095e75a7..0a1340d24d1 100644
--- 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
@@ -33,7 +33,7 @@ CREATE TABLE bugs (
tag VARCHAR(64) COMMENT 'type "tags"'
) DEFAULT CHARSET=utf8;
-SELECT mroonga_command("dump");
+SELECT mroonga_command("dump --dump_plugins no");
DROP TABLE bugs;
DROP TABLE tags;
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
index 66bf9cef699..18a2607fa0b 100644
--- 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
@@ -32,7 +32,7 @@ CREATE TABLE memos (
FULLTEXT INDEX (content) COMMENT 'token_filters "TokenFilterStopWord,TokenFilterStopWord"'
) DEFAULT CHARSET=utf8;
-SELECT mroonga_command("dump");
+SELECT mroonga_command("dump --dump_plugins no");
DROP TABLE memos;
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
index 49a23ec6b74..20df762d31b 100644
--- 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
@@ -32,7 +32,7 @@ CREATE TABLE memos (
FULLTEXT INDEX (content) COMMENT 'token_filters "TokenFilterStopWord"'
) DEFAULT CHARSET=utf8;
-SELECT mroonga_command("dump");
+SELECT mroonga_command("dump --dump_plugins no");
DROP TABLE memos;
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
index 7d890aff9d3..e4d7d8618fa 100644
--- 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
@@ -36,7 +36,7 @@ CREATE TABLE memos (
FULLTEXT INDEX (content) COMMENT 'table "terms"'
) DEFAULT CHARSET=utf8;
-SELECT mroonga_command("dump");
+SELECT mroonga_command("dump --dump_plugins no");
DROP TABLE memos;
DROP TABLE terms;
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
index f391647a538..905181175d0 100644
--- 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
@@ -36,7 +36,7 @@ CREATE TABLE memos (
FULLTEXT INDEX (content) COMMENT 'table "terms"'
) DEFAULT CHARSET=utf8;
-SELECT mroonga_command("dump");
+SELECT mroonga_command("dump --dump_plugins no");
DROP TABLE memos;
DROP TABLE terms;
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
index 8707ce0e34b..2d5498c99c8 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_vector.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_vector.test
@@ -29,7 +29,7 @@ CREATE TABLE bugs (
tags TEXT COMMENT 'flags "COLUMN_VECTOR"'
) DEFAULT CHARSET=utf8;
-SELECT mroonga_command("dump");
+SELECT mroonga_command("dump --dump_plugins no");
DROP TABLE bugs;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_all.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_all.test
new file mode 100644
index 00000000000..b94172c1c72
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_all.test
@@ -0,0 +1,44 @@
+# Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# 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 (
+ id INT PRIMARY KEY,
+ title VARCHAR(255),
+ content TEXT,
+ FULLTEXT INDEX (title, content)
+) DEFAULT CHARSET=utf8;
+
+INSERT INTO memos VALUES(1, "Groonga", "Groonga is fast.");
+INSERT INTO memos VALUES(2, "Mroonga", "Mroonga is also fast.");
+INSERT INTO memos VALUES(3, "Rroonga", "Rroonga is also fast.");
+
+SELECT *,
+ MATCH(title, content)
+ AGAINST("*W1:10,2:2DOR Groonga Mroonga" in BOOLEAN MODE) AS score
+ FROM memos
+ WHERE MATCH(title, content)
+ AGAINST("*W1:10,2:2DOR Groonga Mroonga" in BOOLEAN MODE);
+
+DROP TABLE memos;
+
+--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
index 641bbc3c4bd..3dffb2fb458 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_insert_select.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_insert_select.test
@@ -36,10 +36,6 @@ 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_order_different_against.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_different_against.test
index f2859f99dba..f2859f99dba 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_different_against.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_different_against.test
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_boolean_mode_different_match.test
index dc97db87487..dc97db87487 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_different_match.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_different_match.test
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_boolean_mode_no_where.test
index 50dd652e2d0..50dd652e2d0 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_no_where.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_no_where.test
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_boolean_mode_same_match_against.test
index 0873849a1e7..0873849a1e7 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_same_match_against.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_same_match_against.test
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_asc.test
new file mode 100644
index 00000000000..1b29b5b9284
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_asc.test
@@ -0,0 +1,47 @@
+# Copyright(C) 2015 Kouhei Sutou
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+--source ../../include/mroonga/have_mroonga.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS logs;
+--enable_warnings
+
+SET NAMES UTF8;
+CREATE TABLE logs(
+ message TEXT,
+ FULLTEXT KEY (message)
+) DEFAULT CHARSET=utf8;
+
+INSERT INTO logs VALUES("Error Error Error");
+INSERT INTO logs VALUES("Warning Warning Warning");
+INSERT INTO logs VALUES("Error Error");
+INSERT INTO logs VALUES("Warning Warning");
+INSERT INTO logs VALUES("Error");
+INSERT INTO logs VALUES("Warning");
+INSERT INTO logs VALUES("Error Error Error Error");
+INSERT INTO logs VALUES("Warning Warning Warning Warning");
+
+SELECT * FROM logs;
+
+SELECT *, MATCH(message) AGAINST("Error" IN NATURAL LANGUAGE MODE) AS score
+ FROM logs
+ WHERE MATCH(message) AGAINST("Error" IN NATURAL LANGUAGE MODE)
+ ORDER BY MATCH(message) AGAINST("Error" IN NATURAL LANGUAGE MODE) ASC;
+
+DROP TABLE logs;
+
+--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_desc.test
new file mode 100644
index 00000000000..761c7259057
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_desc.test
@@ -0,0 +1,47 @@
+# Copyright(C) 2015 Kouhei Sutou
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+--source ../../include/mroonga/have_mroonga.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS logs;
+--enable_warnings
+
+SET NAMES UTF8;
+CREATE TABLE logs(
+ message TEXT,
+ FULLTEXT KEY (message)
+) DEFAULT CHARSET=utf8;
+
+INSERT INTO logs VALUES("Error Error Error");
+INSERT INTO logs VALUES("Warning Warning Warning");
+INSERT INTO logs VALUES("Error Error");
+INSERT INTO logs VALUES("Warning Warning");
+INSERT INTO logs VALUES("Error");
+INSERT INTO logs VALUES("Warning");
+INSERT INTO logs VALUES("Error Error Error Error");
+INSERT INTO logs VALUES("Warning Warning Warning Warning");
+
+SELECT * FROM logs;
+
+SELECT *, MATCH(message) AGAINST("Error" IN NATURAL LANGUAGE MODE) AS score
+ FROM logs
+ WHERE MATCH(message) AGAINST("Error" IN NATURAL LANGUAGE MODE)
+ ORDER BY MATCH(message) AGAINST("Error" IN NATURAL LANGUAGE MODE) DESC;
+
+DROP TABLE logs;
+
+--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_different_against.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_different_against.test
new file mode 100644
index 00000000000..eef4e08c5d1
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_different_against.test
@@ -0,0 +1,47 @@
+# Copyright(C) 2015 Kouhei Sutou
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+--source ../../include/mroonga/have_mroonga.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS logs;
+--enable_warnings
+
+SET NAMES UTF8;
+CREATE TABLE logs(
+ message TEXT,
+ FULLTEXT KEY (message)
+) DEFAULT CHARSET=utf8;
+
+INSERT INTO logs VALUES("Error Error Error");
+INSERT INTO logs VALUES("Warning Warning Warning");
+INSERT INTO logs VALUES("Error Error");
+INSERT INTO logs VALUES("Warning Warning");
+INSERT INTO logs VALUES("Error");
+INSERT INTO logs VALUES("Warning");
+INSERT INTO logs VALUES("Error Error Error Error");
+INSERT INTO logs VALUES("Warning Warning Warning Warning");
+
+SELECT * FROM logs;
+
+SELECT *, MATCH(message) AGAINST("Error" IN NATURAL LANGUAGE MODE) AS score
+ FROM logs
+ WHERE MATCH(message) AGAINST("Error Warning" IN NATURAL LANGUAGE MODE)
+ ORDER BY MATCH(message) AGAINST("Error" IN NATURAL LANGUAGE MODE);
+
+DROP TABLE logs;
+
+--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_different_match.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_different_match.test
new file mode 100644
index 00000000000..42b621f4401
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_different_match.test
@@ -0,0 +1,49 @@
+# Copyright(C) 2015 Kouhei Sutou
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+--source ../../include/mroonga/have_mroonga.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS logs;
+--enable_warnings
+
+SET NAMES UTF8;
+CREATE TABLE logs(
+ message TEXT,
+ host TEXT,
+ FULLTEXT KEY (message),
+ FULLTEXT KEY (host)
+) DEFAULT CHARSET=utf8;
+
+INSERT INTO logs VALUES("Error Error Error", "host1");
+INSERT INTO logs VALUES("Warning Warning Warning", "host1");
+INSERT INTO logs VALUES("Error Error", "host2");
+INSERT INTO logs VALUES("Warning Warning", "host2");
+INSERT INTO logs VALUES("Error", "host2");
+INSERT INTO logs VALUES("Warning", "host2");
+INSERT INTO logs VALUES("Error Error Error Error", "host2");
+INSERT INTO logs VALUES("Warning Warning Warning Warning", "host2");
+
+SELECT * FROM logs;
+
+SELECT *, MATCH(host) AGAINST("host2" IN NATURAL LANGUAGE MODE) AS score
+ FROM logs
+ WHERE MATCH(message) AGAINST("Error" IN NATURAL LANGUAGE MODE)
+ ORDER BY MATCH(host) AGAINST("host2" IN NATURAL LANGUAGE MODE);
+
+DROP TABLE logs;
+
+--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_no_where.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_no_where.test
new file mode 100644
index 00000000000..2078e59f042
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_no_where.test
@@ -0,0 +1,46 @@
+# Copyright(C) 2015 Kouhei Sutou
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+--source ../../include/mroonga/have_mroonga.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS logs;
+--enable_warnings
+
+SET NAMES UTF8;
+CREATE TABLE logs(
+ message TEXT,
+ FULLTEXT KEY (message)
+) DEFAULT CHARSET=utf8;
+
+INSERT INTO logs VALUES("Error Error Error");
+INSERT INTO logs VALUES("Warning Warning Warning");
+INSERT INTO logs VALUES("Error Error");
+INSERT INTO logs VALUES("Warning Warning");
+INSERT INTO logs VALUES("Error");
+INSERT INTO logs VALUES("Warning");
+INSERT INTO logs VALUES("Error Error Error Error");
+INSERT INTO logs VALUES("Warning Warning Warning Warning");
+
+SELECT * FROM logs;
+
+SELECT *, MATCH(message) AGAINST("Error" IN NATURAL LANGUAGE MODE) AS score
+ FROM logs
+ ORDER BY MATCH(message) AGAINST("Error" IN NATURAL LANGUAGE MODE);
+
+DROP TABLE logs;
+
+--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_same_match_against.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_same_match_against.test
new file mode 100644
index 00000000000..9a8c93c3470
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_same_match_against.test
@@ -0,0 +1,47 @@
+# Copyright(C) 2015 Kouhei Sutou
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+--source ../../include/mroonga/have_mroonga.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS logs;
+--enable_warnings
+
+SET NAMES UTF8;
+CREATE TABLE logs(
+ message TEXT,
+ FULLTEXT KEY (message)
+) DEFAULT CHARSET=utf8;
+
+INSERT INTO logs VALUES("Error Error Error");
+INSERT INTO logs VALUES("Warning Warning Warning");
+INSERT INTO logs VALUES("Error Error");
+INSERT INTO logs VALUES("Warning Warning");
+INSERT INTO logs VALUES("Error");
+INSERT INTO logs VALUES("Warning");
+INSERT INTO logs VALUES("Error Error Error Error");
+INSERT INTO logs VALUES("Warning Warning Warning Warning");
+
+SELECT * FROM logs;
+
+SELECT *, MATCH(message) AGAINST("Error" IN NATURAL LANGUAGE MODE) AS score
+ FROM logs
+ WHERE MATCH(message) AGAINST("Error" IN NATURAL LANGUAGE MODE)
+ ORDER BY MATCH(message) AGAINST("Error" IN NATURAL LANGUAGE MODE);
+
+DROP TABLE logs;
+
+--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
index 39462257f9d..a5f42e2c9f3 100644
--- 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
@@ -15,6 +15,8 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--source include/have_geometry.inc
+--source ../../include/mroonga/have_version_56_or_later.inc
+--source ../../include/mroonga/skip_mysql_57.inc
--source ../../include/mroonga/have_mroonga.inc
--disable_warnings
@@ -27,7 +29,7 @@ CREATE TABLE shops (
INSERT INTO shops VALUES (NULL), (NULL);
-SELECT AsText(location) FROM shops;
+SELECT ST_AsText(location) FROM shops;
DROP TABLE shops;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/geometry_bulk_insert_null_57.test b/storage/mroonga/mysql-test/mroonga/storage/t/geometry_bulk_insert_null_57.test
new file mode 100644
index 00000000000..84ce595621e
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/geometry_bulk_insert_null_57.test
@@ -0,0 +1,38 @@
+# Copyright(C) 2014 Kenji Maruyama <mmmaru777@gmail.com>
+# Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along 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_version_57.inc
+--source ../../include/mroonga/have_mroonga.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS shops;
+--enable_warnings
+
+CREATE TABLE shops (
+ location GEOMETRY NOT NULL
+);
+
+SET SESSION sql_mode = '';
+INSERT INTO shops VALUES (NULL), (NULL);
+SET SESSION sql_mode = default;
+
+SELECT ST_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
index c8ec649f181..2fcf7ec5e4b 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/geometry_contains.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/geometry_contains.test
@@ -15,6 +15,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--source include/have_geometry.inc
+--source ../../include/mroonga/have_version_56_or_later.inc
--source ../../include/mroonga/have_mroonga.inc
--disable_warnings
@@ -31,116 +32,116 @@ SHOW CREATE TABLE shops;
INSERT INTO shops (name, location)
VALUES ('nezu-no-taiyaki',
- GeomFromText('POINT(139.762573 35.720253)'));
+ ST_GeomFromText('POINT(139.762573 35.720253)'));
INSERT INTO shops (name, location)
VALUES ('taiyaki-kataoka',
- GeomFromText('POINT(139.715591 35.712521)'));
+ ST_GeomFromText('POINT(139.715591 35.712521)'));
INSERT INTO shops (name, location)
VALUES ('soba-taiyaki-ku',
- GeomFromText('POINT(139.659088 35.683712)'));
+ ST_GeomFromText('POINT(139.659088 35.683712)'));
INSERT INTO shops (name, location)
VALUES ('kuruma',
- GeomFromText('POINT(139.706207 35.721516)'));
+ ST_GeomFromText('POINT(139.706207 35.721516)'));
INSERT INTO shops (name, location)
VALUES ('hirose-ya',
- GeomFromText('POINT(139.685608 35.714844)'));
+ ST_GeomFromText('POINT(139.685608 35.714844)'));
INSERT INTO shops (name, location)
VALUES ('sazare',
- GeomFromText('POINT(139.685043 35.714653)'));
+ ST_GeomFromText('POINT(139.685043 35.714653)'));
INSERT INTO shops (name, location)
VALUES ('omede-taiyaki',
- GeomFromText('POINT(139.817154 35.700516)'));
+ ST_GeomFromText('POINT(139.817154 35.700516)'));
INSERT INTO shops (name, location)
VALUES ('onaga-ya',
- GeomFromText('POINT(139.81105 35.698254)'));
+ ST_GeomFromText('POINT(139.81105 35.698254)'));
INSERT INTO shops (name, location)
VALUES ('shiro-ya',
- GeomFromText('POINT(139.638611 35.705517)'));
+ ST_GeomFromText('POINT(139.638611 35.705517)'));
INSERT INTO shops (name, location)
VALUES ('fuji-ya',
- GeomFromText('POINT(139.637115 35.703938)'));
+ ST_GeomFromText('POINT(139.637115 35.703938)'));
INSERT INTO shops (name, location)
VALUES ('miyoshi',
- GeomFromText('POINT(139.537323 35.644539)'));
+ ST_GeomFromText('POINT(139.537323 35.644539)'));
INSERT INTO shops (name, location)
VALUES ('juju-ya',
- GeomFromText('POINT(139.695755 35.628922)'));
+ ST_GeomFromText('POINT(139.695755 35.628922)'));
INSERT INTO shops (name, location)
VALUES ('tatsumi-ya',
- GeomFromText('POINT(139.638657 35.665501)'));
+ ST_GeomFromText('POINT(139.638657 35.665501)'));
INSERT INTO shops (name, location)
VALUES ('tetsuji',
- GeomFromText('POINT(139.76857 35.680912)'));
+ ST_GeomFromText('POINT(139.76857 35.680912)'));
INSERT INTO shops (name, location)
VALUES ('gazuma-ya',
- GeomFromText('POINT(139.647598 35.700817)'));
+ ST_GeomFromText('POINT(139.647598 35.700817)'));
INSERT INTO shops (name, location)
VALUES ('honma-mon',
- GeomFromText('POINT(139.652573 35.722736)'));
+ ST_GeomFromText('POINT(139.652573 35.722736)'));
INSERT INTO shops (name, location)
VALUES ('naniwa-ya',
- GeomFromText('POINT(139.796234 35.730061)'));
+ ST_GeomFromText('POINT(139.796234 35.730061)'));
INSERT INTO shops (name, location)
VALUES ('kuro-dai',
- GeomFromText('POINT(139.704834 35.650345)'));
+ ST_GeomFromText('POINT(139.704834 35.650345)'));
INSERT INTO shops (name, location)
VALUES ('daruma',
- GeomFromText('POINT(139.770599 35.681461)'));
+ ST_GeomFromText('POINT(139.770599 35.681461)'));
INSERT INTO shops (name, location)
VALUES ('yanagi-ya',
- GeomFromText('POINT(139.783981 35.685341)'));
+ ST_GeomFromText('POINT(139.783981 35.685341)'));
INSERT INTO shops (name, location)
VALUES ('sharaku',
- GeomFromText('POINT(139.794846 35.716969)'));
+ ST_GeomFromText('POINT(139.794846 35.716969)'));
INSERT INTO shops (name, location)
VALUES ('takane',
- GeomFromText('POINT(139.560913 35.698601)'));
+ ST_GeomFromText('POINT(139.560913 35.698601)'));
INSERT INTO shops (name, location)
VALUES ('chiyoda',
- GeomFromText('POINT(139.652817 35.642601)'));
+ ST_GeomFromText('POINT(139.652817 35.642601)'));
INSERT INTO shops (name, location)
VALUES ('da-ka-po',
- GeomFromText('POINT(139.727356 35.627346)'));
+ ST_GeomFromText('POINT(139.727356 35.627346)'));
INSERT INTO shops (name, location)
VALUES ('matsushima-ya',
- GeomFromText('POINT(139.737381 35.640556)'));
+ ST_GeomFromText('POINT(139.737381 35.640556)'));
INSERT INTO shops (name, location)
VALUES ('kazuya',
- GeomFromText('POINT(139.760895 35.673508)'));
+ ST_GeomFromText('POINT(139.760895 35.673508)'));
INSERT INTO shops (name, location)
VALUES ('furuya-kogane-an',
- GeomFromText('POINT(139.676071 35.680603)'));
+ ST_GeomFromText('POINT(139.676071 35.680603)'));
INSERT INTO shops (name, location)
VALUES ('hachi-no-ie',
- GeomFromText('POINT(139.668106 35.608021)'));
+ ST_GeomFromText('POINT(139.668106 35.608021)'));
INSERT INTO shops (name, location)
VALUES ('azuki-chan',
- GeomFromText('POINT(139.673203 35.64151)'));
+ ST_GeomFromText('POINT(139.673203 35.64151)'));
INSERT INTO shops (name, location)
VALUES ('kuriko-an',
- GeomFromText('POINT(139.796829 35.712013)'));
+ ST_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)'));
+ ST_GeomFromText('POINT(139.712524 35.616199)'));
INSERT INTO shops (name, location)
VALUES ('naze-ya',
- GeomFromText('POINT(139.665833 35.609039)'));
+ ST_GeomFromText('POINT(139.665833 35.609039)'));
INSERT INTO shops (name, location)
VALUES ('sanoki-ya',
- GeomFromText('POINT(139.770721 35.66592)'));
+ ST_GeomFromText('POINT(139.770721 35.66592)'));
INSERT INTO shops (name, location)
VALUES ('shigeta',
- GeomFromText('POINT(139.780273 35.672626)'));
+ ST_GeomFromText('POINT(139.780273 35.672626)'));
INSERT INTO shops (name, location)
VALUES ('nishimi-ya',
- GeomFromText('POINT(139.774628 35.671825)'));
+ ST_GeomFromText('POINT(139.774628 35.671825)'));
INSERT INTO shops (name, location)
VALUES ('hiiragi',
- GeomFromText('POINT(139.711517 35.647701)'));
+ ST_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)
+SELECT id, name, ST_AsText(location) AS location_text FROM shops;
+SELECT id, name, ST_AsText(location) AS location_text FROM shops
+ WHERE MBRContains(ST_GeomFromText('LineString(139.7727 35.6684, 139.7038 35.7121)'), location)
ORDER BY id;
DROP TABLE shops;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_asc.test
new file mode 100644
index 00000000000..6bab6708ba7
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_asc.test
@@ -0,0 +1,41 @@
+# Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# 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,
+ value INT(10),
+ INDEX (value)
+) ENGINE=Mroonga DEFAULT CHARSET=utf8;
+
+INSERT INTO ids VALUES(1, 50);
+INSERT INTO ids VALUES(2, 70);
+INSERT INTO ids VALUES(3, 30);
+INSERT INTO ids VALUES(4, 90);
+INSERT INTO ids VALUES(5, 10);
+
+SELECT id, value FROM ids WHERE value > 10 ORDER BY value 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_normal_greater_than_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_desc.test
new file mode 100644
index 00000000000..e1bbd5b338c
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_desc.test
@@ -0,0 +1,41 @@
+# Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# 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,
+ value INT(10),
+ INDEX (value)
+) ENGINE=Mroonga DEFAULT CHARSET=utf8;
+
+INSERT INTO ids VALUES(1, 50);
+INSERT INTO ids VALUES(2, 70);
+INSERT INTO ids VALUES(3, 30);
+INSERT INTO ids VALUES(4, 90);
+INSERT INTO ids VALUES(5, 10);
+
+SELECT id, value FROM ids WHERE value > 10 ORDER BY value 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_normal_greater_than_or_equal_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_or_equal_asc.test
new file mode 100644
index 00000000000..680a4d624a7
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_or_equal_asc.test
@@ -0,0 +1,41 @@
+# Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# 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,
+ value INT(10),
+ INDEX (value)
+) ENGINE=Mroonga DEFAULT CHARSET=utf8;
+
+INSERT INTO ids VALUES(1, 50);
+INSERT INTO ids VALUES(2, 70);
+INSERT INTO ids VALUES(3, 30);
+INSERT INTO ids VALUES(4, 90);
+INSERT INTO ids VALUES(5, 10);
+
+SELECT id, value FROM ids WHERE value >= 30 ORDER BY value 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_normal_greater_than_or_equal_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_or_equal_desc.test
new file mode 100644
index 00000000000..25260c48c4b
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_or_equal_desc.test
@@ -0,0 +1,41 @@
+# Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# 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,
+ value INT(10),
+ INDEX (value)
+) ENGINE=Mroonga DEFAULT CHARSET=utf8;
+
+INSERT INTO ids VALUES(1, 50);
+INSERT INTO ids VALUES(2, 70);
+INSERT INTO ids VALUES(3, 30);
+INSERT INTO ids VALUES(4, 90);
+INSERT INTO ids VALUES(5, 10);
+
+SELECT id, value FROM ids WHERE value >= 30 ORDER BY value 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_normal_less_than_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_asc.test
new file mode 100644
index 00000000000..6c183ddec21
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_asc.test
@@ -0,0 +1,41 @@
+# Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# 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,
+ value INT(10),
+ INDEX (value)
+) ENGINE=Mroonga DEFAULT CHARSET=utf8;
+
+INSERT INTO ids VALUES(1, 50);
+INSERT INTO ids VALUES(2, 70);
+INSERT INTO ids VALUES(3, 30);
+INSERT INTO ids VALUES(4, 90);
+INSERT INTO ids VALUES(5, 10);
+
+SELECT id, value FROM ids WHERE value < 90 ORDER BY value 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_normal_less_than_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_desc.test
new file mode 100644
index 00000000000..aa1ba7602ee
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_desc.test
@@ -0,0 +1,41 @@
+# Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# 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,
+ value INT(10),
+ INDEX (value)
+) ENGINE=Mroonga DEFAULT CHARSET=utf8;
+
+INSERT INTO ids VALUES(1, 50);
+INSERT INTO ids VALUES(2, 70);
+INSERT INTO ids VALUES(3, 30);
+INSERT INTO ids VALUES(4, 90);
+INSERT INTO ids VALUES(5, 10);
+
+SELECT id, value FROM ids WHERE value < 90 ORDER BY value 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_normal_less_than_or_equal_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_or_equal_asc.test
new file mode 100644
index 00000000000..e083afdf4f5
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_or_equal_asc.test
@@ -0,0 +1,41 @@
+# Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# 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,
+ value INT(10),
+ INDEX (value)
+) ENGINE=Mroonga DEFAULT CHARSET=utf8;
+
+INSERT INTO ids VALUES(1, 50);
+INSERT INTO ids VALUES(2, 70);
+INSERT INTO ids VALUES(3, 30);
+INSERT INTO ids VALUES(4, 90);
+INSERT INTO ids VALUES(5, 10);
+
+SELECT id, value FROM ids WHERE value <= 70 ORDER BY value 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_normal_less_than_or_equal_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_or_equal_desc.test
new file mode 100644
index 00000000000..155a51506a9
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_or_equal_desc.test
@@ -0,0 +1,41 @@
+# Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# 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,
+ value INT(10),
+ INDEX (value)
+) ENGINE=Mroonga DEFAULT CHARSET=utf8;
+
+INSERT INTO ids VALUES(1, 50);
+INSERT INTO ids VALUES(2, 70);
+INSERT INTO ids VALUES(3, 30);
+INSERT INTO ids VALUES(4, 90);
+INSERT INTO ids VALUES(5, 10);
+
+SELECT id, value FROM ids WHERE value <= 70 ORDER BY value 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_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_asc.test
index a622dfbf70d..a622dfbf70d 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_greater_than_asc.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_asc.test
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_primary_greater_than_desc.test
index 63dc820ccfd..63dc820ccfd 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_greater_than_desc.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_desc.test
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_primary_greater_than_or_equal_asc.test
index a51e6c5da47..a51e6c5da47 100644
--- 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_primary_greater_than_or_equal_asc.test
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_primary_greater_than_or_equal_desc.test
index ea5c150bf0f..ea5c150bf0f 100644
--- 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_primary_greater_than_or_equal_desc.test
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_primary_less_than_asc.test
index 12761c0f4d8..12761c0f4d8 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_less_than_asc.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_asc.test
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_primary_less_than_desc.test
index a4f4a781ead..a4f4a781ead 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_less_than_desc.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_desc.test
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_primary_less_than_or_equal_asc.test
index 2fba0d13f5f..2fba0d13f5f 100644
--- 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_primary_less_than_or_equal_asc.test
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_primary_less_than_or_equal_desc.test
index e4661fc7047..e4661fc7047 100644
--- 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_primary_less_than_or_equal_desc.test
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_search_after_duplicated.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_search_after_duplicated.test
new file mode 100644
index 00000000000..533422ec087
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_search_after_duplicated.test
@@ -0,0 +1,40 @@
+# Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# 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)
+) DEFAULT CHARSET=utf8;
+
+INSERT INTO users VALUES (1, "Alice");
+
+INSERT INTO users VALUES (2, "Bob");
+-- error ER_DUP_ENTRY
+INSERT INTO users VALUES (3, "Bob");
+
+SELECT * FROM users;
+SELECT * FROM users WHERE name = "Bob";
+
+DROP TABLE users;
+
+--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
index 782b7bee9ca..350440515c1 100644
--- 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
@@ -29,11 +29,14 @@ CREATE TABLE diaries (
SHOW CREATE TABLE diaries;
INSERT INTO diaries (day, title)
- VALUES ("2012-02-14", "clear day")
- ON DUPLICATE KEY UPDATE title = "clear day (duplicated)";
+ VALUES ("2012-02-14", "clear day1")
+ ON DUPLICATE KEY UPDATE title = "clear day1 (duplicated)";
INSERT INTO diaries (day, title)
- VALUES ("2012-02-14", "rainy day")
- ON DUPLICATE KEY UPDATE title = "rainy day (duplicated)";
+ VALUES ("2012-02-14", "clear day2")
+ ON DUPLICATE KEY UPDATE title = "clear day2 (duplicated)";
+INSERT INTO diaries (day, title)
+ VALUES ("2012-02-14", "clear day3")
+ ON DUPLICATE KEY UPDATE title = "clear day3 (duplicated)";
INSERT INTO diaries (day, title)
VALUES ("2012-02-15", "cloudy day")
ON DUPLICATE KEY UPDATE title = "cloudy day (duplicated)";
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_count_skip_TODO_SPLIT_ME.test
index 669868c6c7f..669868c6c7f 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_skip_count_TODO_SPLIT_ME.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_TODO_SPLIT_ME.test
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_count_skip_after_insert_multithread.test
index bca2311ffbc..bca2311ffbc 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_skip_count_after_insert_multithread.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_after_insert_multithread.test
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_count_skip_after_insert_single_thread.test
index fa960be850f..fa960be850f 100644
--- 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_count_skip_after_insert_single_thread.test
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_skip_count_disabled.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_disabled.test
index e94702e8159..e94702e8159 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_skip_count_disabled.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_disabled.test
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_count_skip_index_view.test
index 11457b1e05a..11457b1e05a 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_skip_count_index_view.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_view.test
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_duplicated_order_by_columns.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_duplicated_order_by_columns.test
new file mode 100644
index 00000000000..832c1c5cb27
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_duplicated_order_by_columns.test
@@ -0,0 +1,45 @@
+# Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
+# Copyright(C) 2015 GMO Media, Inc.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# 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
+
+FLUSH STATUS;
+
+SET NAMES utf8mb4;
+
+CREATE TABLE ids (
+ id int PRIMARY KEY,
+ text varchar(32),
+ FULLTEXT INDEX (text)
+) DEFAULT CHARSET=utf8mb4;
+
+INSERT INTO ids VALUES (1, 'first');
+
+SELECT * FROM ids
+ WHERE MATCH(text) AGAINST('+first' IN BOOLEAN MODE)
+ ORDER BY id, id
+ LIMIT 1;
+
+SHOW STATUS LIKE 'mroonga_fast_order_limit';
+
+DROP TABLE ids;
+
+--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/partition_insert.test b/storage/mroonga/mysql-test/mroonga/storage/t/partition_insert.test
new file mode 100644
index 00000000000..fdd45ecc3a3
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/partition_insert.test
@@ -0,0 +1,51 @@
+# Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with 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_100_or_later.inc
+--source include/have_partition.inc
+--source ../../include/mroonga/have_mroonga.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS logs;
+--enable_warnings
+
+SET NAMES UTF8;
+CREATE TABLE logs (
+ timestamp DATETIME,
+ message TEXT
+) DEFAULT CHARSET=UTF8
+ PARTITION BY RANGE (TO_DAYS(timestamp)) (
+ PARTITION p201501 VALUES LESS THAN (TO_DAYS('2015-02-01')),
+ PARTITION p201502 VALUES LESS THAN (TO_DAYS('2015-03-01')),
+ PARTITION p201503 VALUES LESS THAN (TO_DAYS('2015-04-01')),
+ PARTITION pfuture VALUES LESS THAN MAXVALUE
+);
+SHOW CREATE TABLE logs;
+
+INSERT INTO logs VALUES('2015-01-01 00:00:00', 'Start');
+INSERT INTO logs VALUES('2015-01-31 23:59:59', 'Shutdown');
+INSERT INTO logs VALUES('2015-02-01 00:00:00', 'Start');
+INSERT INTO logs VALUES('2015-02-28 23:59:59', 'Shutdown');
+INSERT INTO logs VALUES('2015-03-01 00:00:00', 'Start');
+INSERT INTO logs VALUES('2015-03-31 23:59:59', 'Shutdown');
+INSERT INTO logs VALUES('2015-04-01 00:00:00', 'Start');
+INSERT INTO logs VALUES('2015-04-30 23:59:59', 'Shutdown');
+
+SELECT * FROM logs ORDER BY timestamp;
+
+DROP TABLE logs;
+
+--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/partition_update.test b/storage/mroonga/mysql-test/mroonga/storage/t/partition_update.test
new file mode 100644
index 00000000000..8ec55268b38
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/partition_update.test
@@ -0,0 +1,53 @@
+# Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with 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_100_or_later.inc
+--source include/have_partition.inc
+--source ../../include/mroonga/have_mroonga.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS logs;
+--enable_warnings
+
+SET NAMES UTF8;
+CREATE TABLE logs (
+ timestamp DATETIME,
+ message TEXT
+) DEFAULT CHARSET=UTF8
+ PARTITION BY RANGE (TO_DAYS(timestamp)) (
+ PARTITION p201501 VALUES LESS THAN (TO_DAYS('2015-02-01')),
+ PARTITION p201502 VALUES LESS THAN (TO_DAYS('2015-03-01')),
+ PARTITION p201503 VALUES LESS THAN (TO_DAYS('2015-04-01')),
+ PARTITION pfuture VALUES LESS THAN MAXVALUE
+);
+SHOW CREATE TABLE logs;
+
+INSERT INTO logs VALUES('2015-01-01 00:00:00', 'Start');
+INSERT INTO logs VALUES('2015-02-01 00:00:00', 'Start');
+INSERT INTO logs VALUES('2015-03-01 00:00:00', 'Start');
+INSERT INTO logs VALUES('2015-04-01 00:00:00', 'Start');
+
+SELECT * FROM logs ORDER BY timestamp;
+
+UPDATE logs
+ SET message = 'Started'
+ WHERE timestamp < '2015-03-01 00:00:00';
+
+SELECT * FROM logs ORDER BY timestamp;
+
+DROP TABLE logs;
+
+--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/repair_table_no_index_file.test b/storage/mroonga/mysql-test/mroonga/storage/t/repair_table_no_index_file.test
new file mode 100644
index 00000000000..bdbcfefcd85
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/repair_table_no_index_file.test
@@ -0,0 +1,57 @@
+# Copyright(C) 2014 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along 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
+
+CREATE DATABASE repair_test;
+USE repair_test;
+
+CREATE TABLE diaries (
+ id INT PRIMARY KEY AUTO_INCREMENT,
+ title TEXT,
+ body TEXT,
+ 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(body) AGAINST("+starting" IN BOOLEAN MODE);
+
+--remove_file $MYSQLD_DATADIR/repair_test.mrn.000010A.c
+
+FLUSH TABLES;
+
+# Error ER_CANT_OPEN_FILE syscall error 'repair_test.mrn.000010A.c' (No such file or directory)
+--error ER_CANT_OPEN_FILE
+SELECT * FROM diaries WHERE MATCH(body) AGAINST("+starting" IN BOOLEAN MODE);
+
+REPAIR TABLE diaries;
+
+SELECT * FROM diaries;
+
+SELECT * FROM diaries WHERE MATCH(body) AGAINST("+starting" IN BOOLEAN MODE);
+
+DROP TABLE diaries;
+
+DROP DATABASE repair_test;
+USE test;
+
+--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
index 5f160af239f..65144ecc9e3 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/replace_geometry.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/replace_geometry.test
@@ -14,6 +14,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
+--source include/have_geometry.inc
+--source ../../include/mroonga/have_version_56_or_later.inc
--source ../../include/mroonga/have_mroonga.inc
--disable_warnings
@@ -26,13 +28,13 @@ CREATE TABLE geo_replace (
PRIMARY KEY(id)
) DEFAULT CHARSET=utf8;
INSERT INTO geo_replace VALUES(1, POINT(100,100));
-SELECT id, ASTEXT(geo) FROM geo_replace;
+SELECT id, ST_AsText(geo) FROM geo_replace;
REPLACE INTO geo_replace VALUES(1, POINT(100,200));
-SELECT id, ASTEXT(geo) FROM geo_replace;
+SELECT id, ST_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;
+SELECT id, ST_AsText(geo) FROM geo_replace;
UPDATE geo_replace SET geo = POINT(200,300);
-SELECT id, ASTEXT(geo) FROM geo_replace;
+SELECT id, ST_AsText(geo) FROM geo_replace;
DROP TABLE geo_replace;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/replace_without_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/replace_without_key.test
new file mode 100644
index 00000000000..a38c4953e67
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/replace_without_key.test
@@ -0,0 +1,35 @@
+# Copyright(C) 2014 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# 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 varchar(32) NOT NULL PRIMARY KEY,
+ content text,
+ FULLTEXT INDEX (content)
+) DEFAULT CHARSET=utf8;
+
+-- error ER_ERROR_ON_WRITE
+REPLACE INTO diaries(content) VALUES("Hello");
+
+DROP TABLE diaries;
+
+--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_allow_column.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_allow_column.test
new file mode 100644
index 00000000000..b2cdf053bdb
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_allow_column.test
@@ -0,0 +1,46 @@
+# Copyright(C) 2014 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+# TODO: Remove the check after MariaDB 5.5.42 and MariaDB 10.0.17 are released.
+--source ../../include/mroonga/have_mysql.inc
+
+--source ../../include/mroonga/have_mroonga.inc
+
+SET @mroonga_boolean_mode_syntax_flags_backup =
+ @@mroonga_boolean_mode_syntax_flags;
+
+SET mroonga_boolean_mode_syntax_flags = "SYNTAX_QUERY,ALLOW_COLUMN";
+
+SET NAMES UTF8;
+
+CREATE TABLE diaries (
+ title TEXT,
+ content TEXT,
+ FULLTEXT KEY (title),
+ FULLTEXT KEY (content)
+) DEFAULT CHARSET=utf8;
+
+INSERT INTO diaries VALUES("Groonga", "Hello Groonga");
+
+SELECT * FROM diaries
+ WHERE MATCH(title) AGAINST("content:@Hello" IN BOOLEAN MODE);
+
+DROP TABLE diaries;
+
+SET mroonga_boolean_mode_syntax_flags =
+ @mroonga_boolean_mode_syntax_flags_backup;
+
+--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_allow_leading_not.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_allow_leading_not.test
new file mode 100644
index 00000000000..08afc2cb39e
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_allow_leading_not.test
@@ -0,0 +1,44 @@
+# Copyright(C) 2014 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+# TODO: Remove the check after MariaDB 5.5.42 and MariaDB 10.0.17 are released.
+--source ../../include/mroonga/have_mysql.inc
+
+--source ../../include/mroonga/have_mroonga.inc
+
+SET @mroonga_boolean_mode_syntax_flags_backup =
+ @@mroonga_boolean_mode_syntax_flags;
+
+SET mroonga_boolean_mode_syntax_flags = "SYNTAX_QUERY,ALLOW_LEADING_NOT";
+
+SET NAMES UTF8;
+
+CREATE TABLE diaries (
+ title TEXT,
+ FULLTEXT KEY (title)
+) DEFAULT CHARSET=utf8;
+
+INSERT INTO diaries VALUES("Groonga");
+INSERT INTO diaries VALUES("Mroonga");
+
+SELECT * FROM diaries WHERE MATCH(title) AGAINST("-Groonga" IN BOOLEAN MODE);
+
+DROP TABLE diaries;
+
+SET mroonga_boolean_mode_syntax_flags =
+ @mroonga_boolean_mode_syntax_flags_backup;
+
+--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_allow_update.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_allow_update.test
new file mode 100644
index 00000000000..4987dbe2b7a
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_allow_update.test
@@ -0,0 +1,46 @@
+# Copyright(C) 2014 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+# TODO: Remove the check after MariaDB 5.5.42 and MariaDB 10.0.17 are released.
+--source ../../include/mroonga/have_mysql.inc
+
+--source ../../include/mroonga/have_mroonga.inc
+
+SET @mroonga_boolean_mode_syntax_flags_backup =
+ @@mroonga_boolean_mode_syntax_flags;
+
+SET mroonga_boolean_mode_syntax_flags = "SYNTAX_QUERY,ALLOW_COLUMN,ALLOW_UPDATE";
+
+SET NAMES UTF8;
+
+CREATE TABLE diaries (
+ title TEXT,
+ content TEXT,
+ FULLTEXT KEY (title),
+ FULLTEXT KEY (content)
+) DEFAULT CHARSET=utf8;
+
+INSERT INTO diaries VALUES("Groonga", "Hello Groonga");
+
+SELECT * FROM diaries
+ WHERE MATCH(title) AGAINST('content:="Hello Mroonga"' IN BOOLEAN MODE);
+
+DROP TABLE diaries;
+
+SET mroonga_boolean_mode_syntax_flags =
+ @mroonga_boolean_mode_syntax_flags_backup;
+
+--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_syntax_query.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_syntax_query.test
new file mode 100644
index 00000000000..84cac40b16a
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_syntax_query.test
@@ -0,0 +1,43 @@
+# Copyright(C) 2014 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+# TODO: Remove the check after MariaDB 5.5.42 and MariaDB 10.0.17 are released.
+--source ../../include/mroonga/have_mysql.inc
+
+--source ../../include/mroonga/have_mroonga.inc
+
+SET @mroonga_boolean_mode_syntax_flags_backup =
+ @@mroonga_boolean_mode_syntax_flags;
+
+SET mroonga_boolean_mode_syntax_flags = "SYNTAX_QUERY";
+
+SET NAMES UTF8;
+
+CREATE TABLE diaries (
+ title TEXT,
+ FULLTEXT KEY (title)
+) DEFAULT CHARSET=utf8;
+
+INSERT INTO diaries VALUES("Re:Mroonga");
+
+SELECT * FROM diaries WHERE MATCH(title) AGAINST("Re:Mroonga" IN BOOLEAN MODE);
+
+DROP TABLE diaries;
+
+SET mroonga_boolean_mode_syntax_flags =
+ @mroonga_boolean_mode_syntax_flags_backup;
+
+--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_syntax_script.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_syntax_script.test
new file mode 100644
index 00000000000..dea8212bda1
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_syntax_script.test
@@ -0,0 +1,44 @@
+# Copyright(C) 2014 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+# TODO: Remove the check after MariaDB 5.5.42 and MariaDB 10.0.17 are released.
+--source ../../include/mroonga/have_mysql.inc
+
+--source ../../include/mroonga/have_mroonga.inc
+
+SET @mroonga_boolean_mode_syntax_flags_backup =
+ @@mroonga_boolean_mode_syntax_flags;
+
+SET mroonga_boolean_mode_syntax_flags = "SYNTAX_SCRIPT";
+
+SET NAMES UTF8;
+
+CREATE TABLE diaries (
+ title TEXT,
+ FULLTEXT KEY (title)
+) DEFAULT CHARSET=utf8;
+
+INSERT INTO diaries VALUES("Re:Mroonga");
+
+SELECT * FROM diaries
+ WHERE MATCH(title) AGAINST("title @ 'Re:Mroonga'" IN BOOLEAN MODE);
+
+DROP TABLE diaries;
+
+SET mroonga_boolean_mode_syntax_flags =
+ @mroonga_boolean_mode_syntax_flags_backup;
+
+--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
index c7b2094906b..7a0c70a53b7 100644
--- 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
@@ -1,4 +1,4 @@
-# Copyright(C) 2012 Kouhei Sutou <kou@clear-code.com>
+# Copyright(C) 2012-2015 Kouhei Sutou <kou@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -35,8 +35,10 @@ SELECT * FROM counts;
DROP TABLE counts;
DROP DATABASE clean_test;
+SET GLOBAL mroonga_database_path_prefix = NULL;
+
USE test;
-SET GLOBAL mroonga_database_path_prefix = NULL;
+--rmdir $MYSQLD_DATADIR/test/mroonga.data
--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_global.result b/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_global.result
new file mode 100644
index 00000000000..0181fe02d84
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_global.result
@@ -0,0 +1,20 @@
+DROP TABLE IF EXISTS ids;
+CREATE TABLE ids (
+id INT PRIMARY KEY AUTO_INCREMENT
+) DEFAULT CHARSET=UTF8;
+INSERT INTO ids VALUES (1);
+INSERT INTO ids VALUES (2);
+INSERT INTO ids VALUES (3);
+INSERT INTO ids VALUES (4);
+INSERT INTO ids VALUES (5);
+INSERT INTO ids VALUES (6);
+INSERT INTO ids VALUES (7);
+INSERT INTO ids VALUES (8);
+INSERT INTO ids VALUES (9);
+INSERT INTO ids VALUES (10);
+SET GLOBAL mroonga_max_n_records_for_estimate = 1;
+EXPLAIN SELECT * FROM ids WHERE id > 5;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE ids range PRIMARY PRIMARY 4 NULL 1 Using where; Using index
+SET GLOBAL mroonga_max_n_records_for_estimate = DEFAULT;
+DROP TABLE ids;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_global.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_global.test
new file mode 100644
index 00000000000..264bf95fd22
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_global.test
@@ -0,0 +1,55 @@
+# Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# 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 AUTO_INCREMENT
+) DEFAULT CHARSET=UTF8;
+
+INSERT INTO ids VALUES (1);
+INSERT INTO ids VALUES (2);
+INSERT INTO ids VALUES (3);
+INSERT INTO ids VALUES (4);
+INSERT INTO ids VALUES (5);
+INSERT INTO ids VALUES (6);
+INSERT INTO ids VALUES (7);
+INSERT INTO ids VALUES (8);
+INSERT INTO ids VALUES (9);
+INSERT INTO ids VALUES (10);
+
+
+SET GLOBAL mroonga_max_n_records_for_estimate = 1;
+
+CONNECT (new_connection, localhost, root, ,);
+CONNECTION new_connection;
+
+EXPLAIN SELECT * FROM ids WHERE id > 5;
+
+CONNECTION default;
+DISCONNECT new_connection;
+
+SET GLOBAL mroonga_max_n_records_for_estimate = DEFAULT;
+
+
+DROP TABLE ids;
+
+
+--source ../../include/mroonga/have_mroonga_deinit.inc
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_session.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_session.test
new file mode 100644
index 00000000000..3abc3c532d3
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_session.test
@@ -0,0 +1,46 @@
+# Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# 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 AUTO_INCREMENT
+) DEFAULT CHARSET=UTF8;
+
+INSERT INTO ids VALUES (1);
+INSERT INTO ids VALUES (2);
+INSERT INTO ids VALUES (3);
+INSERT INTO ids VALUES (4);
+INSERT INTO ids VALUES (5);
+INSERT INTO ids VALUES (6);
+INSERT INTO ids VALUES (7);
+INSERT INTO ids VALUES (8);
+INSERT INTO ids VALUES (9);
+INSERT INTO ids VALUES (10);
+
+SET mroonga_max_n_records_for_estimate = 1;
+
+EXPLAIN SELECT * FROM ids WHERE id > 5;
+
+SET mroonga_max_n_records_for_estimate = DEFAULT;
+
+DROP TABLE ids;
+
+--source ../../include/mroonga/have_mroonga_deinit.inc
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
index fc38afc72d8..0e2f4c3bcca 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_spatial.result
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_spatial.result
@@ -6,115 +6,115 @@ location GEOMETRY NOT NULL
) COMMENT = 'ENGINE "InnoDB"';
INSERT INTO shops (name, location)
VALUES ('nezu-no-taiyaki',
-GeomFromText('POINT(139.762573 35.720253)'));
+ST_GeomFromText('POINT(139.762573 35.720253)'));
INSERT INTO shops (name, location)
VALUES ('taiyaki-kataoka',
-GeomFromText('POINT(139.715591 35.712521)'));
+ST_GeomFromText('POINT(139.715591 35.712521)'));
INSERT INTO shops (name, location)
VALUES ('soba-taiyaki-ku',
-GeomFromText('POINT(139.659088 35.683712)'));
+ST_GeomFromText('POINT(139.659088 35.683712)'));
INSERT INTO shops (name, location)
VALUES ('kuruma',
-GeomFromText('POINT(139.706207 35.721516)'));
+ST_GeomFromText('POINT(139.706207 35.721516)'));
INSERT INTO shops (name, location)
VALUES ('hirose-ya',
-GeomFromText('POINT(139.685608 35.714844)'));
+ST_GeomFromText('POINT(139.685608 35.714844)'));
INSERT INTO shops (name, location)
VALUES ('sazare',
-GeomFromText('POINT(139.685043 35.714653)'));
+ST_GeomFromText('POINT(139.685043 35.714653)'));
INSERT INTO shops (name, location)
VALUES ('omede-taiyaki',
-GeomFromText('POINT(139.817154 35.700516)'));
+ST_GeomFromText('POINT(139.817154 35.700516)'));
INSERT INTO shops (name, location)
VALUES ('onaga-ya',
-GeomFromText('POINT(139.81105 35.698254)'));
+ST_GeomFromText('POINT(139.81105 35.698254)'));
INSERT INTO shops (name, location)
VALUES ('shiro-ya',
-GeomFromText('POINT(139.638611 35.705517)'));
+ST_GeomFromText('POINT(139.638611 35.705517)'));
INSERT INTO shops (name, location)
VALUES ('fuji-ya',
-GeomFromText('POINT(139.637115 35.703938)'));
+ST_GeomFromText('POINT(139.637115 35.703938)'));
INSERT INTO shops (name, location)
VALUES ('miyoshi',
-GeomFromText('POINT(139.537323 35.644539)'));
+ST_GeomFromText('POINT(139.537323 35.644539)'));
INSERT INTO shops (name, location)
VALUES ('juju-ya',
-GeomFromText('POINT(139.695755 35.628922)'));
+ST_GeomFromText('POINT(139.695755 35.628922)'));
INSERT INTO shops (name, location)
VALUES ('tatsumi-ya',
-GeomFromText('POINT(139.638657 35.665501)'));
+ST_GeomFromText('POINT(139.638657 35.665501)'));
INSERT INTO shops (name, location)
VALUES ('tetsuji',
-GeomFromText('POINT(139.76857 35.680912)'));
+ST_GeomFromText('POINT(139.76857 35.680912)'));
INSERT INTO shops (name, location)
VALUES ('gazuma-ya',
-GeomFromText('POINT(139.647598 35.700817)'));
+ST_GeomFromText('POINT(139.647598 35.700817)'));
INSERT INTO shops (name, location)
VALUES ('honma-mon',
-GeomFromText('POINT(139.652573 35.722736)'));
+ST_GeomFromText('POINT(139.652573 35.722736)'));
INSERT INTO shops (name, location)
VALUES ('naniwa-ya',
-GeomFromText('POINT(139.796234 35.730061)'));
+ST_GeomFromText('POINT(139.796234 35.730061)'));
INSERT INTO shops (name, location)
VALUES ('kuro-dai',
-GeomFromText('POINT(139.704834 35.650345)'));
+ST_GeomFromText('POINT(139.704834 35.650345)'));
INSERT INTO shops (name, location)
VALUES ('daruma',
-GeomFromText('POINT(139.770599 35.681461)'));
+ST_GeomFromText('POINT(139.770599 35.681461)'));
INSERT INTO shops (name, location)
VALUES ('yanagi-ya',
-GeomFromText('POINT(139.783981 35.685341)'));
+ST_GeomFromText('POINT(139.783981 35.685341)'));
INSERT INTO shops (name, location)
VALUES ('sharaku',
-GeomFromText('POINT(139.794846 35.716969)'));
+ST_GeomFromText('POINT(139.794846 35.716969)'));
INSERT INTO shops (name, location)
VALUES ('takane',
-GeomFromText('POINT(139.560913 35.698601)'));
+ST_GeomFromText('POINT(139.560913 35.698601)'));
INSERT INTO shops (name, location)
VALUES ('chiyoda',
-GeomFromText('POINT(139.652817 35.642601)'));
+ST_GeomFromText('POINT(139.652817 35.642601)'));
INSERT INTO shops (name, location)
VALUES ('da-ka-po',
-GeomFromText('POINT(139.727356 35.627346)'));
+ST_GeomFromText('POINT(139.727356 35.627346)'));
INSERT INTO shops (name, location)
VALUES ('matsushima-ya',
-GeomFromText('POINT(139.737381 35.640556)'));
+ST_GeomFromText('POINT(139.737381 35.640556)'));
INSERT INTO shops (name, location)
VALUES ('kazuya',
-GeomFromText('POINT(139.760895 35.673508)'));
+ST_GeomFromText('POINT(139.760895 35.673508)'));
INSERT INTO shops (name, location)
VALUES ('furuya-kogane-an',
-GeomFromText('POINT(139.676071 35.680603)'));
+ST_GeomFromText('POINT(139.676071 35.680603)'));
INSERT INTO shops (name, location)
VALUES ('hachi-no-ie',
-GeomFromText('POINT(139.668106 35.608021)'));
+ST_GeomFromText('POINT(139.668106 35.608021)'));
INSERT INTO shops (name, location)
VALUES ('azuki-chan',
-GeomFromText('POINT(139.673203 35.64151)'));
+ST_GeomFromText('POINT(139.673203 35.64151)'));
INSERT INTO shops (name, location)
VALUES ('kuriko-an',
-GeomFromText('POINT(139.796829 35.712013)'));
+ST_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)'));
+ST_GeomFromText('POINT(139.712524 35.616199)'));
INSERT INTO shops (name, location)
VALUES ('naze-ya',
-GeomFromText('POINT(139.665833 35.609039)'));
+ST_GeomFromText('POINT(139.665833 35.609039)'));
INSERT INTO shops (name, location)
VALUES ('sanoki-ya',
-GeomFromText('POINT(139.770721 35.66592)'));
+ST_GeomFromText('POINT(139.770721 35.66592)'));
INSERT INTO shops (name, location)
VALUES ('shigeta',
-GeomFromText('POINT(139.780273 35.672626)'));
+ST_GeomFromText('POINT(139.780273 35.672626)'));
INSERT INTO shops (name, location)
VALUES ('nishimi-ya',
-GeomFromText('POINT(139.774628 35.671825)'));
+ST_GeomFromText('POINT(139.774628 35.671825)'));
INSERT INTO shops (name, location)
VALUES ('hiiragi',
-GeomFromText('POINT(139.711517 35.647701)'));
+ST_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);
+SELECT id, name, ST_AsText(location) AS location_text FROM shops
+WHERE MBRContains(ST_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)
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
index 6b29be5edb7..a6d2f7862af 100644
--- 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
@@ -1,5 +1,3 @@
-DROP TABLE IF EXISTS diaries_innodb;
-DROP TABLE IF EXISTS diaries_mroonga;
CREATE TABLE diaries_innodb (
id INT PRIMARY KEY AUTO_INCREMENT,
body TEXT,
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_index_flags_none.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_index_flags_none.result
new file mode 100644
index 00000000000..08bdd72ee03
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_index_flags_none.result
@@ -0,0 +1,9 @@
+SET NAMES utf8;
+CREATE TABLE memos (
+content VARCHAR(64) NOT NULL PRIMARY KEY,
+FULLTEXT INDEX (content) COMMENT 'index_flags "NONE"'
+) COMMENT='engine "InnoDB"' DEFAULT CHARSET=utf8;
+SELECT mroonga_command("dump --dump_plugins no --dump_schema no");
+mroonga_command("dump --dump_plugins no --dump_schema no")
+column_create memos-content index COLUMN_INDEX memos
+DROP TABLE memos;
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_index_flags_with_position_and_with_weight.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_index_flags_with_position_and_with_weight.result
new file mode 100644
index 00000000000..a5ac716d38e
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_index_flags_with_position_and_with_weight.result
@@ -0,0 +1,9 @@
+SET NAMES utf8;
+CREATE TABLE memos (
+content VARCHAR(64) NOT NULL PRIMARY KEY,
+FULLTEXT INDEX (content) COMMENT 'index_flags "WITH_POSITION|WITH_WEIGHT"'
+) COMMENT='engine "InnoDB"' DEFAULT CHARSET=utf8;
+SELECT mroonga_command("dump --dump_plugins no --dump_schema no");
+mroonga_command("dump --dump_plugins no --dump_schema no")
+column_create memos-content index COLUMN_INDEX|WITH_WEIGHT|WITH_POSITION memos
+DROP TABLE memos;
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
index 0c0af7a9db2..68319844df8 100644
--- 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
@@ -7,9 +7,11 @@ 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")
+SELECT mroonga_command("dump --dump_plugins no");
+mroonga_command("dump --dump_plugins no")
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
index aef34c0bc26..fa3012705ad 100644
--- 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
@@ -7,9 +7,11 @@ 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")
+SELECT mroonga_command("dump --dump_plugins no");
+mroonga_command("dump --dump_plugins no")
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/function_last_insert_grn_id.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/function_last_insert_grn_id.result
deleted file mode 100644
index 9edbd3c9b3b..00000000000
--- a/storage/mroonga/mysql-test/mroonga/wrapper/r/function_last_insert_grn_id.result
+++ /dev/null
@@ -1,17 +0,0 @@
-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/geometry_contains.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/geometry_contains.result
index 29163384e6a..b3f5bee27d7 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/r/geometry_contains.result
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/geometry_contains.result
@@ -16,113 +16,113 @@ shops CREATE TABLE `shops` (
) ENGINE=Mroonga DEFAULT CHARSET=latin1 COMMENT='engine "innodb"'
insert into shops (name, location)
values ('nezu-no-taiyaki',
-GeomFromText('POINT(139.762573 35.720253)'));
+ST_GeomFromText('POINT(139.762573 35.720253)'));
insert into shops (name, location)
values ('taiyaki-kataoka',
-GeomFromText('POINT(139.715591 35.712521)'));
+ST_GeomFromText('POINT(139.715591 35.712521)'));
insert into shops (name, location)
values ('soba-taiyaki-ku',
-GeomFromText('POINT(139.659088 35.683712)'));
+ST_GeomFromText('POINT(139.659088 35.683712)'));
insert into shops (name, location)
values ('kuruma',
-GeomFromText('POINT(139.706207 35.721516)'));
+ST_GeomFromText('POINT(139.706207 35.721516)'));
insert into shops (name, location)
values ('hirose-ya',
-GeomFromText('POINT(139.685608 35.714844)'));
+ST_GeomFromText('POINT(139.685608 35.714844)'));
insert into shops (name, location)
values ('sazare',
-GeomFromText('POINT(139.685043 35.714653)'));
+ST_GeomFromText('POINT(139.685043 35.714653)'));
insert into shops (name, location)
values ('omede-taiyaki',
-GeomFromText('POINT(139.817154 35.700516)'));
+ST_GeomFromText('POINT(139.817154 35.700516)'));
insert into shops (name, location)
values ('onaga-ya',
-GeomFromText('POINT(139.81105 35.698254)'));
+ST_GeomFromText('POINT(139.81105 35.698254)'));
insert into shops (name, location)
values ('shiro-ya',
-GeomFromText('POINT(139.638611 35.705517)'));
+ST_GeomFromText('POINT(139.638611 35.705517)'));
insert into shops (name, location)
values ('fuji-ya',
-GeomFromText('POINT(139.637115 35.703938)'));
+ST_GeomFromText('POINT(139.637115 35.703938)'));
insert into shops (name, location)
values ('miyoshi',
-GeomFromText('POINT(139.537323 35.644539)'));
+ST_GeomFromText('POINT(139.537323 35.644539)'));
insert into shops (name, location)
values ('juju-ya',
-GeomFromText('POINT(139.695755 35.628922)'));
+ST_GeomFromText('POINT(139.695755 35.628922)'));
insert into shops (name, location)
values ('tatsumi-ya',
-GeomFromText('POINT(139.638657 35.665501)'));
+ST_GeomFromText('POINT(139.638657 35.665501)'));
insert into shops (name, location)
values ('tetsuji',
-GeomFromText('POINT(139.76857 35.680912)'));
+ST_GeomFromText('POINT(139.76857 35.680912)'));
insert into shops (name, location)
values ('gazuma-ya',
-GeomFromText('POINT(139.647598 35.700817)'));
+ST_GeomFromText('POINT(139.647598 35.700817)'));
insert into shops (name, location)
values ('honma-mon',
-GeomFromText('POINT(139.652573 35.722736)'));
+ST_GeomFromText('POINT(139.652573 35.722736)'));
insert into shops (name, location)
values ('naniwa-ya',
-GeomFromText('POINT(139.796234 35.730061)'));
+ST_GeomFromText('POINT(139.796234 35.730061)'));
insert into shops (name, location)
values ('kuro-dai',
-GeomFromText('POINT(139.704834 35.650345)'));
+ST_GeomFromText('POINT(139.704834 35.650345)'));
insert into shops (name, location)
values ('daruma',
-GeomFromText('POINT(139.770599 35.681461)'));
+ST_GeomFromText('POINT(139.770599 35.681461)'));
insert into shops (name, location)
values ('yanagi-ya',
-GeomFromText('POINT(139.783981 35.685341)'));
+ST_GeomFromText('POINT(139.783981 35.685341)'));
insert into shops (name, location)
values ('sharaku',
-GeomFromText('POINT(139.794846 35.716969)'));
+ST_GeomFromText('POINT(139.794846 35.716969)'));
insert into shops (name, location)
values ('takane',
-GeomFromText('POINT(139.560913 35.698601)'));
+ST_GeomFromText('POINT(139.560913 35.698601)'));
insert into shops (name, location)
values ('chiyoda',
-GeomFromText('POINT(139.652817 35.642601)'));
+ST_GeomFromText('POINT(139.652817 35.642601)'));
insert into shops (name, location)
values ('da-ka-po',
-GeomFromText('POINT(139.727356 35.627346)'));
+ST_GeomFromText('POINT(139.727356 35.627346)'));
insert into shops (name, location)
values ('matsushima-ya',
-GeomFromText('POINT(139.737381 35.640556)'));
+ST_GeomFromText('POINT(139.737381 35.640556)'));
insert into shops (name, location)
values ('kazuya',
-GeomFromText('POINT(139.760895 35.673508)'));
+ST_GeomFromText('POINT(139.760895 35.673508)'));
insert into shops (name, location)
values ('furuya-kogane-an',
-GeomFromText('POINT(139.676071 35.680603)'));
+ST_GeomFromText('POINT(139.676071 35.680603)'));
insert into shops (name, location)
values ('hachi-no-ie',
-GeomFromText('POINT(139.668106 35.608021)'));
+ST_GeomFromText('POINT(139.668106 35.608021)'));
insert into shops (name, location)
values ('azuki-chan',
-GeomFromText('POINT(139.673203 35.64151)'));
+ST_GeomFromText('POINT(139.673203 35.64151)'));
insert into shops (name, location)
values ('kuriko-an',
-GeomFromText('POINT(139.796829 35.712013)'));
+ST_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)'));
+ST_GeomFromText('POINT(139.712524 35.616199)'));
insert into shops (name, location)
values ('naze-ya',
-GeomFromText('POINT(139.665833 35.609039)'));
+ST_GeomFromText('POINT(139.665833 35.609039)'));
insert into shops (name, location)
values ('sanoki-ya',
-GeomFromText('POINT(139.770721 35.66592)'));
+ST_GeomFromText('POINT(139.770721 35.66592)'));
insert into shops (name, location)
values ('shigeta',
-GeomFromText('POINT(139.780273 35.672626)'));
+ST_GeomFromText('POINT(139.780273 35.672626)'));
insert into shops (name, location)
values ('nishimi-ya',
-GeomFromText('POINT(139.774628 35.671825)'));
+ST_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;
+ST_GeomFromText('POINT(139.711517 35.647701)'));
+select id, name, ST_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)
@@ -160,8 +160,8 @@ id name location_text
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);
+select id, name, ST_AsText(location) as location_text from shops
+where MBRContains(ST_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)
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/geometry_delete.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/geometry_delete.result
index 53aa00ecbab..28b981f9c7b 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/r/geometry_delete.result
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/geometry_delete.result
@@ -16,16 +16,16 @@ shops CREATE TABLE `shops` (
) 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);
+ST_GeomFromText('POINT(139.685043 35.714653)'));
+select id, name, ST_AsText(location) as location_text from shops
+where MBRContains(ST_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);
+where MBRContains(ST_GeomFromText('LineString(139.68466 35.71592, 139.68804 35.71411)'), location);
+select id, name, ST_AsText(location) as location_text from shops
+where MBRContains(ST_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;
+select id, name, ST_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
index e982e0b95ce..20de4a32cfa 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/r/geometry_update.result
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/geometry_update.result
@@ -16,21 +16,21 @@ shops CREATE TABLE `shops` (
) 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);
+ST_GeomFromText('POINT(139.685043 35.714653)'));
+select id, name, ST_AsText(location) as location_text from shops
+where MBRContains(ST_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);
+select id, name, ST_AsText(location) as location_text from shops
+where MBRContains(ST_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)')
+update shops set location = ST_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, ST_AsText(location) as location_text from shops
+where MBRContains(ST_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);
+select id, name, ST_AsText(location) as location_text from shops
+where MBRContains(ST_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/optimization_order_limit_TODO_SPLIT_ME.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/optimization_order_limit_TODO_SPLIT_ME.result
index 5f43aee6997..660700602b7 100644
--- 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
@@ -12,20 +12,6 @@ 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")
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/optimization_order_limit_no_direction.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/optimization_order_limit_no_direction.result
new file mode 100644
index 00000000000..9dd3e6eaa1b
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/optimization_order_limit_no_direction.result
@@ -0,0 +1,27 @@
+DROP TABLE IF EXISTS memos;
+FLUSH STATUS;
+CREATE TABLE memos (
+id int PRIMARY KEY,
+content TEXT,
+FULLTEXT INDEX (content)
+) COMMENT = 'engine "InnoDB"';
+INSERT INTO memos VALUES(1, "Groonga is fast");
+INSERT INTO memos VALUES(2, "Mroonga is fast");
+INSERT INTO memos VALUES(3, "Mroonga is easy");
+INSERT INTO memos VALUES(4, "Mroonga is useful");
+INSERT INTO memos VALUES(5, "Mroonga is great");
+SHOW STATUS LIKE 'mroonga_fast_order_limit';
+Variable_name Value
+Mroonga_fast_order_limit 0
+SELECT id, content
+FROM memos
+WHERE MATCH(content) AGAINST("+Mroonga" IN BOOLEAN MODE)
+ORDER BY id
+LIMIT 2;
+id content
+2 Mroonga is fast
+3 Mroonga is easy
+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/wrapper/r/optimization_order_limit_order_by_primary_key.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/optimization_order_limit_order_by_primary_key.result
new file mode 100644
index 00000000000..eb5e04fcc0c
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/optimization_order_limit_order_by_primary_key.result
@@ -0,0 +1,27 @@
+DROP TABLE IF EXISTS memos;
+FLUSH STATUS;
+CREATE TABLE memos (
+id int PRIMARY KEY,
+content TEXT,
+FULLTEXT INDEX (content)
+) COMMENT = 'engine "InnoDB"';
+INSERT INTO memos VALUES(1, "Mroonga is fast");
+INSERT INTO memos VALUES(2, "Mroonga is easy");
+INSERT INTO memos VALUES(3, "Mroonga is useful");
+INSERT INTO memos VALUES(4, "Mroonga is great");
+INSERT INTO memos VALUES(5, "Groonga is fast");
+SHOW STATUS LIKE 'mroonga_fast_order_limit';
+Variable_name Value
+Mroonga_fast_order_limit 0
+SELECT id, content
+FROM memos
+WHERE MATCH(content) AGAINST("+Mroonga" IN BOOLEAN MODE)
+ORDER BY id DESC
+LIMIT 2;
+id content
+4 Mroonga is great
+3 Mroonga is useful
+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/wrapper/r/version_55_performance_schema.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/performance_schema.result
index f6e3bbdca82..c9af869f20c 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/r/version_55_performance_schema.result
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/performance_schema.result
@@ -16,23 +16,7 @@ diaries CREATE TABLE `diaries` (
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
+SHOW TABLES FROM performance_schema LIKE 'threads';
+Tables_in_performance_schema (threads)
threads
DROP TABLE diaries;
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
index 61c8e18b17d..e330fa18c89 100644
--- 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
@@ -1,7 +1,5 @@
-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,
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
index 140b5a92b75..a5012384889 100644
--- 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
@@ -1,7 +1,5 @@
-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,
@@ -25,7 +23,7 @@ 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)
+ERROR HY000: syscall error 'repair_test.mrn.0000106' (No such file or directory)
REPAIR TABLE diaries;
Table Op Msg_type Msg_text
repair_test.diaries repair status OK
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
index 0cf3d49c3c3..c98847cb50a 100644
--- 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
@@ -1,5 +1,4 @@
DROP TABLE IF EXISTS diaries;
-SET GLOBAL mroonga_match_escalation_threshold = -1;
CREATE TABLE diaries (
id INT PRIMARY KEY AUTO_INCREMENT,
title TEXT,
@@ -17,17 +16,12 @@ diaries CREATE TABLE `diaries` (
) 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;
+1 Hello groonga! groonga install
+SET GLOBAL mroonga_match_escalation_threshold = -1;
+USE test;
SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("gr" IN BOOLEAN MODE);
id title tags
-1 Hello groonga! groonga install
+SET GLOBAL mroonga_match_escalation_threshold = DEFAULT;
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
deleted file mode 100644
index 548dc32707f..00000000000
--- a/storage/mroonga/mysql-test/mroonga/wrapper/r/version_56_or_later_performance_schema.result
+++ /dev/null
@@ -1,73 +0,0 @@
-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.pm b/storage/mroonga/mysql-test/mroonga/wrapper/suite.pm
index 528ccc5d693..b6e2d741674 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/suite.pm
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/suite.pm
@@ -4,6 +4,11 @@ package My::Suite::Mroonga;
return "No Mroonga engine" unless $ENV{HA_MROONGA_SO} or
$::mysqld_variables{'mroonga'} eq "ON";
+#
+# RECOMPILE_FOR_EMBEDDED also means that a plugin
+# cannot be dynamically loaded into embedded
+return "Not run for embedded server" if $::opt_embedded_server and
+ $ENV{HA_MROONGA_SO};
sub is_default { 1 }
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
index 37ea8aaf149..6a62ae312b2 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_spatial.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_spatial.test
@@ -17,6 +17,7 @@
--source include/have_innodb.inc
--source include/not_embedded.inc
--source include/have_geometry.inc
+--source ../../include/mroonga/have_version_56_or_later.inc
--source ../../include/mroonga/have_mroonga.inc
--disable_warnings
@@ -31,117 +32,117 @@ CREATE TABLE shops (
INSERT INTO shops (name, location)
VALUES ('nezu-no-taiyaki',
- GeomFromText('POINT(139.762573 35.720253)'));
+ ST_GeomFromText('POINT(139.762573 35.720253)'));
INSERT INTO shops (name, location)
VALUES ('taiyaki-kataoka',
- GeomFromText('POINT(139.715591 35.712521)'));
+ ST_GeomFromText('POINT(139.715591 35.712521)'));
INSERT INTO shops (name, location)
VALUES ('soba-taiyaki-ku',
- GeomFromText('POINT(139.659088 35.683712)'));
+ ST_GeomFromText('POINT(139.659088 35.683712)'));
INSERT INTO shops (name, location)
VALUES ('kuruma',
- GeomFromText('POINT(139.706207 35.721516)'));
+ ST_GeomFromText('POINT(139.706207 35.721516)'));
INSERT INTO shops (name, location)
VALUES ('hirose-ya',
- GeomFromText('POINT(139.685608 35.714844)'));
+ ST_GeomFromText('POINT(139.685608 35.714844)'));
INSERT INTO shops (name, location)
VALUES ('sazare',
- GeomFromText('POINT(139.685043 35.714653)'));
+ ST_GeomFromText('POINT(139.685043 35.714653)'));
INSERT INTO shops (name, location)
VALUES ('omede-taiyaki',
- GeomFromText('POINT(139.817154 35.700516)'));
+ ST_GeomFromText('POINT(139.817154 35.700516)'));
INSERT INTO shops (name, location)
VALUES ('onaga-ya',
- GeomFromText('POINT(139.81105 35.698254)'));
+ ST_GeomFromText('POINT(139.81105 35.698254)'));
INSERT INTO shops (name, location)
VALUES ('shiro-ya',
- GeomFromText('POINT(139.638611 35.705517)'));
+ ST_GeomFromText('POINT(139.638611 35.705517)'));
INSERT INTO shops (name, location)
VALUES ('fuji-ya',
- GeomFromText('POINT(139.637115 35.703938)'));
+ ST_GeomFromText('POINT(139.637115 35.703938)'));
INSERT INTO shops (name, location)
VALUES ('miyoshi',
- GeomFromText('POINT(139.537323 35.644539)'));
+ ST_GeomFromText('POINT(139.537323 35.644539)'));
INSERT INTO shops (name, location)
VALUES ('juju-ya',
- GeomFromText('POINT(139.695755 35.628922)'));
+ ST_GeomFromText('POINT(139.695755 35.628922)'));
INSERT INTO shops (name, location)
VALUES ('tatsumi-ya',
- GeomFromText('POINT(139.638657 35.665501)'));
+ ST_GeomFromText('POINT(139.638657 35.665501)'));
INSERT INTO shops (name, location)
VALUES ('tetsuji',
- GeomFromText('POINT(139.76857 35.680912)'));
+ ST_GeomFromText('POINT(139.76857 35.680912)'));
INSERT INTO shops (name, location)
VALUES ('gazuma-ya',
- GeomFromText('POINT(139.647598 35.700817)'));
+ ST_GeomFromText('POINT(139.647598 35.700817)'));
INSERT INTO shops (name, location)
VALUES ('honma-mon',
- GeomFromText('POINT(139.652573 35.722736)'));
+ ST_GeomFromText('POINT(139.652573 35.722736)'));
INSERT INTO shops (name, location)
VALUES ('naniwa-ya',
- GeomFromText('POINT(139.796234 35.730061)'));
+ ST_GeomFromText('POINT(139.796234 35.730061)'));
INSERT INTO shops (name, location)
VALUES ('kuro-dai',
- GeomFromText('POINT(139.704834 35.650345)'));
+ ST_GeomFromText('POINT(139.704834 35.650345)'));
INSERT INTO shops (name, location)
VALUES ('daruma',
- GeomFromText('POINT(139.770599 35.681461)'));
+ ST_GeomFromText('POINT(139.770599 35.681461)'));
INSERT INTO shops (name, location)
VALUES ('yanagi-ya',
- GeomFromText('POINT(139.783981 35.685341)'));
+ ST_GeomFromText('POINT(139.783981 35.685341)'));
INSERT INTO shops (name, location)
VALUES ('sharaku',
- GeomFromText('POINT(139.794846 35.716969)'));
+ ST_GeomFromText('POINT(139.794846 35.716969)'));
INSERT INTO shops (name, location)
VALUES ('takane',
- GeomFromText('POINT(139.560913 35.698601)'));
+ ST_GeomFromText('POINT(139.560913 35.698601)'));
INSERT INTO shops (name, location)
VALUES ('chiyoda',
- GeomFromText('POINT(139.652817 35.642601)'));
+ ST_GeomFromText('POINT(139.652817 35.642601)'));
INSERT INTO shops (name, location)
VALUES ('da-ka-po',
- GeomFromText('POINT(139.727356 35.627346)'));
+ ST_GeomFromText('POINT(139.727356 35.627346)'));
INSERT INTO shops (name, location)
VALUES ('matsushima-ya',
- GeomFromText('POINT(139.737381 35.640556)'));
+ ST_GeomFromText('POINT(139.737381 35.640556)'));
INSERT INTO shops (name, location)
VALUES ('kazuya',
- GeomFromText('POINT(139.760895 35.673508)'));
+ ST_GeomFromText('POINT(139.760895 35.673508)'));
INSERT INTO shops (name, location)
VALUES ('furuya-kogane-an',
- GeomFromText('POINT(139.676071 35.680603)'));
+ ST_GeomFromText('POINT(139.676071 35.680603)'));
INSERT INTO shops (name, location)
VALUES ('hachi-no-ie',
- GeomFromText('POINT(139.668106 35.608021)'));
+ ST_GeomFromText('POINT(139.668106 35.608021)'));
INSERT INTO shops (name, location)
VALUES ('azuki-chan',
- GeomFromText('POINT(139.673203 35.64151)'));
+ ST_GeomFromText('POINT(139.673203 35.64151)'));
INSERT INTO shops (name, location)
VALUES ('kuriko-an',
- GeomFromText('POINT(139.796829 35.712013)'));
+ ST_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)'));
+ ST_GeomFromText('POINT(139.712524 35.616199)'));
INSERT INTO shops (name, location)
VALUES ('naze-ya',
- GeomFromText('POINT(139.665833 35.609039)'));
+ ST_GeomFromText('POINT(139.665833 35.609039)'));
INSERT INTO shops (name, location)
VALUES ('sanoki-ya',
- GeomFromText('POINT(139.770721 35.66592)'));
+ ST_GeomFromText('POINT(139.770721 35.66592)'));
INSERT INTO shops (name, location)
VALUES ('shigeta',
- GeomFromText('POINT(139.780273 35.672626)'));
+ ST_GeomFromText('POINT(139.780273 35.672626)'));
INSERT INTO shops (name, location)
VALUES ('nishimi-ya',
- GeomFromText('POINT(139.774628 35.671825)'));
+ ST_GeomFromText('POINT(139.774628 35.671825)'));
INSERT INTO shops (name, location)
VALUES ('hiiragi',
- GeomFromText('POINT(139.711517 35.647701)'));
+ ST_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);
+SELECT id, name, ST_AsText(location) AS location_text FROM shops
+ WHERE MBRContains(ST_GeomFromText('LineString(139.7727 35.6684, 139.7038 35.7121)'), location);
SHOW CREATE TABLE shops;
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
index f8b77becdde..70c176b5116 100644
--- 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
@@ -1,4 +1,4 @@
-# Copyright(C) 2011 Kouhei Sutou <kou@clear-code.com>
+# Copyright(C) 2011-2015 Kouhei Sutou <kou@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -18,10 +18,11 @@
--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
+--disable_query_log
+DROP DATABASE test;
+CREATE DATABASE test;
+USE test;
+--enable_query_log
CREATE TABLE diaries_innodb (
id INT PRIMARY KEY AUTO_INCREMENT,
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_index_flags_none.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_index_flags_none.test
new file mode 100644
index 00000000000..da1e5e736ea
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_index_flags_none.test
@@ -0,0 +1,39 @@
+# Copyright(C) 2015 Naoya Murakami <naoya@createfield.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along 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
+
+SET NAMES utf8;
+
+CREATE TABLE memos (
+ content VARCHAR(64) NOT NULL PRIMARY KEY,
+ FULLTEXT INDEX (content) COMMENT 'index_flags "NONE"'
+) COMMENT='engine "InnoDB"' DEFAULT CHARSET=utf8;
+
+SELECT mroonga_command("dump --dump_plugins no --dump_schema no");
+
+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_index_flags_with_position_and_with_weight.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_index_flags_with_position_and_with_weight.test
new file mode 100644
index 00000000000..8d0d585d56d
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_index_flags_with_position_and_with_weight.test
@@ -0,0 +1,39 @@
+# Copyright(C) 2015 Naoya Murakami <naoya@createfield.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along 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
+
+SET NAMES utf8;
+
+CREATE TABLE memos (
+ content VARCHAR(64) NOT NULL PRIMARY KEY,
+ FULLTEXT INDEX (content) COMMENT 'index_flags "WITH_POSITION|WITH_WEIGHT"'
+) COMMENT='engine "InnoDB"' DEFAULT CHARSET=utf8;
+
+SELECT mroonga_command("dump --dump_plugins no --dump_schema no");
+
+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_multiple_token_filters.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_comment_multiple_token_filters.test
index 9ba941f8701..9ff8e4448d9 100644
--- 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
@@ -34,7 +34,7 @@ CREATE TABLE memos (
FULLTEXT INDEX (content) COMMENT 'token_filters "TokenFilterStopWord,TokenFilterStopWord"'
) COMMENT='engine "InnoDB"' DEFAULT CHARSET=utf8;
-SELECT mroonga_command("dump");
+SELECT mroonga_command("dump --dump_plugins no");
DROP TABLE memos;
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
index 91ac84c04d5..eee08309f76 100644
--- 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
@@ -34,7 +34,7 @@ CREATE TABLE memos (
FULLTEXT INDEX (content) COMMENT 'token_filters "TokenFilterStopWord"'
) COMMENT='engine "InnoDB"' DEFAULT CHARSET=utf8;
-SELECT mroonga_command("dump");
+SELECT mroonga_command("dump --dump_plugins no");
DROP TABLE memos;
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_contains.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_contains.test
index 4676fc61331..af6242a9ad1 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_contains.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_contains.test
@@ -16,6 +16,7 @@
--source include/have_innodb.inc
--source include/have_geometry.inc
+--source ../../include/mroonga/have_version_56_or_later.inc
--source ../../include/mroonga/have_mroonga.inc
--disable_warnings
@@ -31,115 +32,115 @@ create table shops (
show create table shops;
insert into shops (name, location)
values ('nezu-no-taiyaki',
- GeomFromText('POINT(139.762573 35.720253)'));
+ ST_GeomFromText('POINT(139.762573 35.720253)'));
insert into shops (name, location)
values ('taiyaki-kataoka',
- GeomFromText('POINT(139.715591 35.712521)'));
+ ST_GeomFromText('POINT(139.715591 35.712521)'));
insert into shops (name, location)
values ('soba-taiyaki-ku',
- GeomFromText('POINT(139.659088 35.683712)'));
+ ST_GeomFromText('POINT(139.659088 35.683712)'));
insert into shops (name, location)
values ('kuruma',
- GeomFromText('POINT(139.706207 35.721516)'));
+ ST_GeomFromText('POINT(139.706207 35.721516)'));
insert into shops (name, location)
values ('hirose-ya',
- GeomFromText('POINT(139.685608 35.714844)'));
+ ST_GeomFromText('POINT(139.685608 35.714844)'));
insert into shops (name, location)
values ('sazare',
- GeomFromText('POINT(139.685043 35.714653)'));
+ ST_GeomFromText('POINT(139.685043 35.714653)'));
insert into shops (name, location)
values ('omede-taiyaki',
- GeomFromText('POINT(139.817154 35.700516)'));
+ ST_GeomFromText('POINT(139.817154 35.700516)'));
insert into shops (name, location)
values ('onaga-ya',
- GeomFromText('POINT(139.81105 35.698254)'));
+ ST_GeomFromText('POINT(139.81105 35.698254)'));
insert into shops (name, location)
values ('shiro-ya',
- GeomFromText('POINT(139.638611 35.705517)'));
+ ST_GeomFromText('POINT(139.638611 35.705517)'));
insert into shops (name, location)
values ('fuji-ya',
- GeomFromText('POINT(139.637115 35.703938)'));
+ ST_GeomFromText('POINT(139.637115 35.703938)'));
insert into shops (name, location)
values ('miyoshi',
- GeomFromText('POINT(139.537323 35.644539)'));
+ ST_GeomFromText('POINT(139.537323 35.644539)'));
insert into shops (name, location)
values ('juju-ya',
- GeomFromText('POINT(139.695755 35.628922)'));
+ ST_GeomFromText('POINT(139.695755 35.628922)'));
insert into shops (name, location)
values ('tatsumi-ya',
- GeomFromText('POINT(139.638657 35.665501)'));
+ ST_GeomFromText('POINT(139.638657 35.665501)'));
insert into shops (name, location)
values ('tetsuji',
- GeomFromText('POINT(139.76857 35.680912)'));
+ ST_GeomFromText('POINT(139.76857 35.680912)'));
insert into shops (name, location)
values ('gazuma-ya',
- GeomFromText('POINT(139.647598 35.700817)'));
+ ST_GeomFromText('POINT(139.647598 35.700817)'));
insert into shops (name, location)
values ('honma-mon',
- GeomFromText('POINT(139.652573 35.722736)'));
+ ST_GeomFromText('POINT(139.652573 35.722736)'));
insert into shops (name, location)
values ('naniwa-ya',
- GeomFromText('POINT(139.796234 35.730061)'));
+ ST_GeomFromText('POINT(139.796234 35.730061)'));
insert into shops (name, location)
values ('kuro-dai',
- GeomFromText('POINT(139.704834 35.650345)'));
+ ST_GeomFromText('POINT(139.704834 35.650345)'));
insert into shops (name, location)
values ('daruma',
- GeomFromText('POINT(139.770599 35.681461)'));
+ ST_GeomFromText('POINT(139.770599 35.681461)'));
insert into shops (name, location)
values ('yanagi-ya',
- GeomFromText('POINT(139.783981 35.685341)'));
+ ST_GeomFromText('POINT(139.783981 35.685341)'));
insert into shops (name, location)
values ('sharaku',
- GeomFromText('POINT(139.794846 35.716969)'));
+ ST_GeomFromText('POINT(139.794846 35.716969)'));
insert into shops (name, location)
values ('takane',
- GeomFromText('POINT(139.560913 35.698601)'));
+ ST_GeomFromText('POINT(139.560913 35.698601)'));
insert into shops (name, location)
values ('chiyoda',
- GeomFromText('POINT(139.652817 35.642601)'));
+ ST_GeomFromText('POINT(139.652817 35.642601)'));
insert into shops (name, location)
values ('da-ka-po',
- GeomFromText('POINT(139.727356 35.627346)'));
+ ST_GeomFromText('POINT(139.727356 35.627346)'));
insert into shops (name, location)
values ('matsushima-ya',
- GeomFromText('POINT(139.737381 35.640556)'));
+ ST_GeomFromText('POINT(139.737381 35.640556)'));
insert into shops (name, location)
values ('kazuya',
- GeomFromText('POINT(139.760895 35.673508)'));
+ ST_GeomFromText('POINT(139.760895 35.673508)'));
insert into shops (name, location)
values ('furuya-kogane-an',
- GeomFromText('POINT(139.676071 35.680603)'));
+ ST_GeomFromText('POINT(139.676071 35.680603)'));
insert into shops (name, location)
values ('hachi-no-ie',
- GeomFromText('POINT(139.668106 35.608021)'));
+ ST_GeomFromText('POINT(139.668106 35.608021)'));
insert into shops (name, location)
values ('azuki-chan',
- GeomFromText('POINT(139.673203 35.64151)'));
+ ST_GeomFromText('POINT(139.673203 35.64151)'));
insert into shops (name, location)
values ('kuriko-an',
- GeomFromText('POINT(139.796829 35.712013)'));
+ ST_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)'));
+ ST_GeomFromText('POINT(139.712524 35.616199)'));
insert into shops (name, location)
values ('naze-ya',
- GeomFromText('POINT(139.665833 35.609039)'));
+ ST_GeomFromText('POINT(139.665833 35.609039)'));
insert into shops (name, location)
values ('sanoki-ya',
- GeomFromText('POINT(139.770721 35.66592)'));
+ ST_GeomFromText('POINT(139.770721 35.66592)'));
insert into shops (name, location)
values ('shigeta',
- GeomFromText('POINT(139.780273 35.672626)'));
+ ST_GeomFromText('POINT(139.780273 35.672626)'));
insert into shops (name, location)
values ('nishimi-ya',
- GeomFromText('POINT(139.774628 35.671825)'));
+ ST_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);
+ ST_GeomFromText('POINT(139.711517 35.647701)'));
+select id, name, ST_AsText(location) as location_text from shops;
+select id, name, ST_AsText(location) as location_text from shops
+ where MBRContains(ST_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
index 25814635b22..9f3589a66d1 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_delete.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_delete.test
@@ -16,6 +16,7 @@
--source include/have_innodb.inc
--source include/have_geometry.inc
+--source ../../include/mroonga/have_version_56_or_later.inc
--source ../../include/mroonga/have_mroonga.inc
--disable_warnings
@@ -32,16 +33,16 @@ 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);
+ ST_GeomFromText('POINT(139.685043 35.714653)'));
+select id, name, ST_AsText(location) as location_text from shops
+ where MBRContains(ST_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);
+ where MBRContains(ST_GeomFromText('LineString(139.68466 35.71592, 139.68804 35.71411)'), location);
+select id, name, ST_AsText(location) as location_text from shops
+ where MBRContains(ST_GeomFromText('LineString(139.68466 35.71592, 139.68804 35.71411)'), location);
-select id, name, AsText(location) as location_text from shops;
+select id, name, ST_AsText(location) as location_text from shops;
drop table shops;
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_update.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_update.test
index c6bb8a1d4e6..aff5c52c786 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_update.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_update.test
@@ -16,6 +16,7 @@
--source include/have_innodb.inc
--source include/have_geometry.inc
+--source ../../include/mroonga/have_version_56_or_later.inc
--source ../../include/mroonga/have_mroonga.inc
--disable_warnings
@@ -32,18 +33,18 @@ 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);
+ ST_GeomFromText('POINT(139.685043 35.714653)'));
+select id, name, ST_AsText(location) as location_text from shops
+ where MBRContains(ST_GeomFromText('LineString(139.68466 35.71592, 139.68804 35.71411)'), location);
+select id, name, ST_AsText(location) as location_text from shops
+ where MBRContains(ST_GeomFromText('LineString(139.65659 35.57903, 139.66489 35.57262)'), location);
-update shops set location = GeomFromText('POINT(139.66116 35.57566)')
+update shops set location = ST_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);
+select id, name, ST_AsText(location) as location_text from shops
+ where MBRContains(ST_GeomFromText('LineString(139.68466 35.71592, 139.68804 35.71411)'), location);
+select id, name, ST_AsText(location) as location_text from shops
+ where MBRContains(ST_GeomFromText('LineString(139.65659 35.57903, 139.66489 35.57262)'), location);
drop table shops;
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
index 39772e5d78d..776fd27a2f2 100644
--- 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
@@ -36,14 +36,6 @@ 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';
diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/function_last_insert_grn_id.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_no_direction.test
index c4961756a26..69be84e2619 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/function_last_insert_grn_id.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_no_direction.test
@@ -1,5 +1,4 @@
-# Copyright(C) 2012 Kouhei Sutou <kou@clear-code.com>
-# Copyright(C) 2013 Kentoku SHIBA
+# Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -16,37 +15,36 @@
# 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;
+DROP TABLE IF EXISTS memos;
--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
+FLUSH STATUS;
-CREATE TABLE ids (
- id int AUTO_INCREMENT PRIMARY KEY
-) COMMENT='ENGINE "InnoDB"';
+CREATE TABLE memos (
+ id int PRIMARY KEY,
+ content TEXT,
+ FULLTEXT INDEX (content)
+) COMMENT = 'engine "InnoDB"';
-SELECT last_insert_grn_id();
+INSERT INTO memos VALUES(1, "Groonga is fast");
+INSERT INTO memos VALUES(2, "Mroonga is fast");
+INSERT INTO memos VALUES(3, "Mroonga is easy");
+INSERT INTO memos VALUES(4, "Mroonga is useful");
+INSERT INTO memos VALUES(5, "Mroonga is great");
-INSERT INTO ids VALUES();
-SELECT last_insert_grn_id();
-SELECT * FROM ids;
+SHOW STATUS LIKE 'mroonga_fast_order_limit';
-DROP TABLE ids;
+SELECT id, content
+ FROM memos
+ WHERE MATCH(content) AGAINST("+Mroonga" IN BOOLEAN MODE)
+ ORDER BY id
+ LIMIT 2;
-DROP FUNCTION last_insert_grn_id;
+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/wrapper/t/optimization_order_limit_order_by_primary_key.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_order_by_primary_key.test
new file mode 100644
index 00000000000..f7b858e75f0
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_order_by_primary_key.test
@@ -0,0 +1,50 @@
+# Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along 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
+
+FLUSH STATUS;
+
+CREATE TABLE memos (
+ id int PRIMARY KEY,
+ content TEXT,
+ FULLTEXT INDEX (content)
+) COMMENT = 'engine "InnoDB"';
+
+INSERT INTO memos VALUES(1, "Mroonga is fast");
+INSERT INTO memos VALUES(2, "Mroonga is easy");
+INSERT INTO memos VALUES(3, "Mroonga is useful");
+INSERT INTO memos VALUES(4, "Mroonga is great");
+INSERT INTO memos VALUES(5, "Groonga is fast");
+
+SHOW STATUS LIKE 'mroonga_fast_order_limit';
+
+SELECT id, content
+ FROM memos
+ WHERE MATCH(content) AGAINST("+Mroonga" IN BOOLEAN MODE)
+ ORDER BY id DESC
+ LIMIT 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/wrapper/t/performance_schema-master.opt b/storage/mroonga/mysql-test/mroonga/wrapper/t/performance_schema-master.opt
new file mode 100644
index 00000000000..611d08f0c78
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/performance_schema-master.opt
@@ -0,0 +1 @@
+--performance-schema
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/performance_schema.test
index 20cb2107ec2..31c3e0a26ff 100644
--- a/storage/mroonga/mysql-test/mroonga/wrapper/t/version_56_or_later_performance_schema.test
+++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/performance_schema.test
@@ -1,4 +1,4 @@
-# Copyright(C) 2012 Kouhei Sutou <kou@clear-code.com>
+# Copyright(C) 2012-2015 Kouhei Sutou <kou@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -14,7 +14,6 @@
# License along with this 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
@@ -35,7 +34,7 @@ SHOW CREATE TABLE diaries;
INSERT INTO diaries (content) VALUES ("Tommorow will be shiny day!");
-SHOW TABLES FROM performance_schema;
+SHOW TABLES FROM performance_schema LIKE 'threads';
DROP TABLE diaries;
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
index b333991d27e..8f0d01d52fb 100644
--- 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
@@ -19,14 +19,9 @@
--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,
@@ -44,10 +39,10 @@ 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
+--remove_file $MYSQLD_DATADIR/repair_test.mrn.0000106
+--remove_file $MYSQLD_DATADIR/repair_test.mrn.0000107
+--remove_file $MYSQLD_DATADIR/repair_test.mrn.0000107.c
FLUSH TABLES;
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
index ce6e1d23280..147d9672eae 100644
--- 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
@@ -19,14 +19,9 @@
--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,
@@ -41,7 +36,7 @@ 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
+--remove_file $MYSQLD_DATADIR/repair_test.mrn.0000106
FLUSH TABLES;
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
index b272649c732..065b78d44a7 100644
--- 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
@@ -1,4 +1,4 @@
-# Copyright(C) 2012 Kouhei Sutou <kou@clear-code.com>
+# Copyright(C) 2012-2015 Kouhei Sutou <kou@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -22,12 +22,6 @@
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,
@@ -40,17 +34,23 @@ 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);
+# MySQL <= 5.5 reports a wrong warning. :<
+# It has been fixed in MySQL >= 5.6 and MariaDB >= 5.3.
+--disable_warnings
+SET GLOBAL mroonga_match_escalation_threshold = -1;
+--enable_warnings
-SET mroonga_match_escalation_threshold = 0;
+CONNECT(search_connection, localhost, root);
+USE test;
SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("gr" IN BOOLEAN MODE);
+DISCONNECT search_connection;
+CONNECTION default;
+SET GLOBAL mroonga_match_escalation_threshold = DEFAULT;
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
index bf22001bb10..b47dcef3967 100644
--- 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
@@ -38,7 +38,7 @@ 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. :<
+# MySQL <= 5.5 reports a wrong warning. :<
# It has been fixed in MySQL >= 5.6 and MariaDB >= 5.3.
--disable_warnings
SET mroonga_match_escalation_threshold = -1;
diff --git a/storage/mroonga/packages/Makefile.am b/storage/mroonga/packages/Makefile.am
new file mode 100644
index 00000000000..fed925c3dfc
--- /dev/null
+++ b/storage/mroonga/packages/Makefile.am
@@ -0,0 +1,7 @@
+SUBDIRS = \
+ apt \
+ rpm \
+ source \
+ ubuntu \
+ windows \
+ yum
diff --git a/storage/mroonga/packages/apt/Makefile.am b/storage/mroonga/packages/apt/Makefile.am
new file mode 100644
index 00000000000..ca0e1dcb19d
--- /dev/null
+++ b/storage/mroonga/packages/apt/Makefile.am
@@ -0,0 +1,67 @@
+REPOSITORIES_PATH = repositories
+DISTRIBUTIONS = debian
+ARCHITECTURES = i386 amd64
+CODE_NAMES = wheezy jessie
+
+all:
+
+release: build sign-packages update-repository sign-repository upload
+
+remove-existing-packages:
+ for distribution in $(DISTRIBUTIONS); do \
+ find $(REPOSITORIES_PATH)/$${distribution}/pool \
+ -type f -delete; \
+ done
+
+download:
+ for distribution in $(DISTRIBUTIONS); do \
+ rsync -avz --progress --delete \
+ $(RSYNC_PATH)/$${distribution} $(REPOSITORIES_PATH)/; \
+ done
+
+sign-packages:
+ ./sign-packages.sh '$(GPG_UID)' '$(REPOSITORIES_PATH)/' '$(CODE_NAMES)'
+
+update-repository:
+ ./update-repository.sh '$(PACKAGE_NAME)' '$(REPOSITORIES_PATH)/' \
+ '$(ARCHITECTURES)' '$(CODE_NAMES)'
+
+sign-repository:
+ ./sign-repository.sh '$(GPG_UID)' '$(REPOSITORIES_PATH)/' '$(CODE_NAMES)'
+
+ensure-rsync-path:
+ @if test -z "$(RSYNC_PATH)"; then \
+ echo "--with-rsync-path configure option must be specified."; \
+ false; \
+ fi
+
+upload: ensure-rsync-path
+ for distribution in $(DISTRIBUTIONS); do \
+ (cd $(REPOSITORIES_PATH)/$${distribution}; \
+ rsync -avz --progress --delete \
+ dists pool $(RSYNC_PATH)/$${distribution}; \
+ ); \
+ done
+
+build: build-package-deb
+
+build-package-deb: prepare-build-package-deb
+ vagrant destroy --force
+ for architecture in $(ARCHITECTURES); do \
+ for code_name in $(CODE_NAMES); do \
+ id=debian-$$code_name-$$architecture; \
+ vagrant up $$id || exit 1; \
+ vagrant destroy --force $$id; \
+ done; \
+ done
+
+prepare-build-package-deb: source env.sh
+ cp env.sh tmp/
+ rm -rf tmp/debian
+ cp -rp $(srcdir)/../debian tmp/
+
+source: tmp/$(PACKAGE)-$(VERSION).tar.gz
+
+tmp/$(PACKAGE)-$(VERSION).tar.gz: $(abs_top_builddir)/$(PACKAGE)-$(VERSION).tar.gz
+ mkdir -p tmp
+ cp $(abs_top_builddir)/$(PACKAGE)-$(VERSION).tar.gz $@
diff --git a/storage/mroonga/packages/apt/Vagrantfile b/storage/mroonga/packages/apt/Vagrantfile
new file mode 100644
index 00000000000..2829da879dd
--- /dev/null
+++ b/storage/mroonga/packages/apt/Vagrantfile
@@ -0,0 +1,37 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+
+# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
+VAGRANTFILE_API_VERSION = "2"
+
+Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
+ vms = [
+ {
+ :id => "debian-wheezy-i386",
+ :box_url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_debian-7.8-i386_chef-provisionerless.box",
+ },
+ {
+ :id => "debian-wheezy-amd64",
+ :box_url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_debian-7.8_chef-provisionerless.box",
+ },
+ {
+ :id => "debian-jessie-i386",
+ :box_url => "http://packages.groonga.org/tmp/opscode_debian-8.0-i386_chef-provisionerless.box",
+ },
+ {
+ :id => "debian-jessie-amd64",
+ :box_url => "http://packages.groonga.org/tmp/opscode_debian-8.0_chef-provisionerless.box",
+ },
+ ]
+
+ vms.each do |vm|
+ config.vm.define(vm[:id]) do |node|
+ node.vm.box = vm[:id]
+ node.vm.box_url = vm[:box_url]
+ node.vm.provision(:shell, :path => "build-deb.sh")
+ node.vm.provider("virtualbox") do |virtual_box|
+ virtual_box.memory = 768
+ end
+ end
+ end
+end
diff --git a/storage/mroonga/packages/apt/build-deb.sh b/storage/mroonga/packages/apt/build-deb.sh
new file mode 100755
index 00000000000..7db24068a7c
--- /dev/null
+++ b/storage/mroonga/packages/apt/build-deb.sh
@@ -0,0 +1,78 @@
+#!/bin/sh
+
+LANG=C
+
+mysql_server_package=mysql-server
+
+run()
+{
+ "$@"
+ if test $? -ne 0; then
+ echo "Failed $@"
+ exit 1
+ fi
+}
+
+. /vagrant/tmp/env.sh
+
+grep '^deb ' /etc/apt/sources.list | \
+ sed -e 's/^deb /deb-src /' > /etc/apt/sources.list.d/base-source.list
+
+run apt-get update
+run apt-get install -y lsb-release
+
+distribution=$(lsb_release --id --short | tr 'A-Z' 'a-z')
+code_name=$(lsb_release --codename --short)
+case "${distribution}" in
+ debian)
+ component=main
+ run cat <<EOF > /etc/apt/sources.list.d/groonga.list
+deb http://packages.groonga.org/debian/ wheezy main
+deb-src http://packages.groonga.org/debian/ wheezy main
+EOF
+ if ! grep --quiet security /etc/apt/sources.list; then
+ run cat <<EOF > /etc/apt/sources.list.d/security.list
+deb http://security.debian.org/ ${code_name}/updates main
+deb-src http://security.debian.org/ ${code_name}/updates main
+EOF
+ fi
+ run apt-get update
+ run apt-get install -y --allow-unauthenticated groonga-keyring
+ run apt-get update
+ ;;
+ ubuntu)
+ component=universe
+ run cat <<EOF > /etc/apt/sources.list.d/security.list
+deb http://security.ubuntu.com/ubuntu ${code_name}-security main restricted
+deb-src http://security.ubuntu.com/ubuntu ${code_name}-security main restricted
+EOF
+ run sed -e 's/main/universe/' /etc/apt/sources.list > \
+ /etc/apt/sources.list.d/universe.list
+ run apt-get -y install software-properties-common
+ run add-apt-repository -y universe
+ run add-apt-repository -y ppa:groonga/ppa
+ run apt-get update
+ ;;
+esac
+
+run apt-get install -V -y build-essential devscripts ${DEPENDED_PACKAGES}
+run apt-get build-dep -y ${mysql_server_package}
+
+run mkdir -p build
+run cp /vagrant/tmp/${PACKAGE}-${VERSION}.tar.gz \
+ build/${PACKAGE}_${VERSION}.orig.tar.gz
+run cd build
+run tar xfz ${PACKAGE}_${VERSION}.orig.tar.gz
+run cd ${PACKAGE}-${VERSION}/
+run cp -rp /vagrant/tmp/debian debian
+# export DEB_BUILD_OPTIONS=noopt
+MYSQL_PACKAGE_INFO=$(apt-cache show mysql-server | grep Version | sort | tail -1)
+MYSQL_PACKAGE_VERSION=${MYSQL_PACKAGE_INFO##Version: }
+sed -i "s/MYSQL_VERSION/$MYSQL_PACKAGE_VERSION/" debian/control
+run debuild -us -uc
+run cd -
+
+package_initial=$(echo "${PACKAGE}" | sed -e 's/\(.\).*/\1/')
+pool_dir="/vagrant/repositories/${distribution}/pool/${code_name}/${component}/${package_initial}/${PACKAGE}"
+run mkdir -p "${pool_dir}/"
+run cp *.tar.gz *.diff.gz *.dsc *.deb "${pool_dir}/"
diff --git a/storage/mroonga/packages/apt/env.sh.in b/storage/mroonga/packages/apt/env.sh.in
new file mode 100644
index 00000000000..a44d6b36871
--- /dev/null
+++ b/storage/mroonga/packages/apt/env.sh.in
@@ -0,0 +1,15 @@
+PACKAGE=@PACKAGE@
+VERSION=@VERSION@
+DEPENDED_PACKAGES="
+debhelper
+autotools-dev
+libgroonga-dev
+pkg-config
+libmecab-dev
+mecab-utils
+libmysqlclient-dev
+libmysqld-dev
+libssl-dev
+groonga-normalizer-mysql
+wget
+"
diff --git a/storage/mroonga/packages/apt/sign-packages.sh b/storage/mroonga/packages/apt/sign-packages.sh
new file mode 100755
index 00000000000..11a4aea26db
--- /dev/null
+++ b/storage/mroonga/packages/apt/sign-packages.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+script_base_dir=`dirname $0`
+
+if [ $# != 3 ]; then
+ echo "Usage: $0 GPG_UID DESITINATION CODES"
+ echo " e.g.: $0 'F10399C0' repositories/ 'lenny unstable hardy karmic'"
+ exit 1
+fi
+
+GPG_UID=$1
+DESTINATION=$2
+CODES=$3
+
+run()
+{
+ "$@"
+ if test $? -ne 0; then
+ echo "Failed $@"
+ exit 1
+ fi
+}
+
+for code_name in ${CODES}; do
+ case ${code_name} in
+ squeeze|wheezy|jessie|unstable)
+ distribution=debian
+ ;;
+ *)
+ distribution=ubuntu
+ ;;
+ esac
+
+ base_directory=${DESTINATION}${distribution}
+ debsign -pgpg2 --re-sign -k${GPG_UID} \
+ $(find ${base_directory} -name '*.dsc' -or -name '*.changes') &
+ if [ "${PARALLEL}" != "yes" ]; then
+ wait
+ fi
+done
+
+wait
diff --git a/storage/mroonga/packages/apt/sign-repository.sh b/storage/mroonga/packages/apt/sign-repository.sh
new file mode 100755
index 00000000000..fb0de850d6f
--- /dev/null
+++ b/storage/mroonga/packages/apt/sign-repository.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+script_base_dir=`dirname $0`
+
+if [ $# != 3 ]; then
+ echo "Usage: $0 GPG_UID DESTINATION CODES"
+ echo " e.g.: $0 'F10399C0' repositories/ 'lenny unstable hardy karmic'"
+ exit 1
+fi
+
+GPG_UID=$1
+DESTINATION=$2
+CODES=$3
+
+run()
+{
+ "$@"
+ if test $? -ne 0; then
+ echo "Failed $@"
+ exit 1
+ fi
+}
+
+for code_name in ${CODES}; do
+ case ${code_name} in
+ squeeze|wheezy|jessie|unstable)
+ distribution=debian
+ ;;
+ *)
+ distribution=ubuntu
+ ;;
+ esac
+
+ release=${DESTINATION}${distribution}/dists/${code_name}/Release
+ rm -f ${release}.gpg
+ gpg2 --sign --detach-sign --armor \
+ --local-user ${GPG_UID} \
+ --output ${release}.gpg \
+ ${release} &
+
+ if [ "${PARALLEL}" != "yes" ]; then
+ wait
+ fi
+done
+
+wait
diff --git a/storage/mroonga/packages/apt/update-repository.sh b/storage/mroonga/packages/apt/update-repository.sh
new file mode 100755
index 00000000000..da1f8cd121c
--- /dev/null
+++ b/storage/mroonga/packages/apt/update-repository.sh
@@ -0,0 +1,130 @@
+#!/bin/sh
+
+script_base_dir=`dirname $0`
+
+if [ $# != 4 ]; then
+ echo "Usage: $0 PROJECT_NAME DESTINATION ARCHITECTURES CODES"
+ echo " e.g.: $0 mroonga repositories/ 'i386 amd64' 'lenny unstable hardy karmic'"
+ exit 1
+fi
+
+PROJECT_NAME=$1
+DESTINATION=$2
+ARCHITECTURES=$3
+CODES=$4
+
+run()
+{
+ "$@"
+ if test $? -ne 0; then
+ echo "Failed $@"
+ exit 1
+ fi
+}
+
+update_repository()
+{
+ distribution=$1
+ code_name=$2
+ component=$3
+
+ rm -rf dists/${code_name}
+ mkdir -p dists/${code_name}/${component}/binary-i386/
+ mkdir -p dists/${code_name}/${component}/binary-amd64/
+ mkdir -p dists/${code_name}/${component}/source/
+
+ cat <<EOF > dists/.htaccess
+Options +Indexes
+EOF
+
+ cat <<EOF > dists/${code_name}/${component}/binary-i386/Release
+Archive: ${code_name}
+Component: ${component}
+Origin: The ${PROJECT_NAME} project
+Label: The ${PROJECT_NAME} project
+Architecture: i386
+EOF
+
+ cat <<EOF > dists/${code_name}/${component}/binary-amd64/Release
+Archive: ${code_name}
+Component: ${component}
+Origin: The ${PROJECT_NAME} project
+Label: The ${PROJECT_NAME} project
+Architecture: amd64
+EOF
+
+ cat <<EOF > dists/${code_name}/${component}/source/Release
+Archive: ${code_name}
+Component: ${component}
+Origin: The ${PROJECT_NAME} project
+Label: The ${PROJECT_NAME} project
+Architecture: source
+EOF
+
+ cat <<EOF > generate-${code_name}.conf
+Dir::ArchiveDir ".";
+Dir::CacheDir ".";
+TreeDefault::Directory "pool/${code_name}/${component}";
+TreeDefault::SrcDirectory "pool/${code_name}/${component}";
+Default::Packages::Extensions ".deb";
+Default::Packages::Compress ". gzip bzip2";
+Default::Sources::Compress ". gzip bzip2";
+Default::Contents::Compress "gzip bzip2";
+
+BinDirectory "dists/${code_name}/${component}/binary-i386" {
+ Packages "dists/${code_name}/${component}/binary-i386/Packages";
+ Contents "dists/${code_name}/Contents-i386";
+ SrcPackages "dists/${code_name}/${component}/source/Sources";
+};
+
+BinDirectory "dists/${code_name}/${component}/binary-amd64" {
+ Packages "dists/${code_name}/${component}/binary-amd64/Packages";
+ Contents "dists/${code_name}/Contents-amd64";
+ SrcPackages "dists/${code_name}/${component}/source/Sources";
+};
+
+Tree "dists/${code_name}" {
+ Sections "${component}";
+ Architectures "i386 amd64 source";
+};
+EOF
+ apt-ftparchive generate generate-${code_name}.conf
+ chmod 644 dists/${code_name}/Contents-*
+
+ rm -f dists/${code_name}/Release*
+ rm -f *.db
+ cat <<EOF > release-${code_name}.conf
+APT::FTPArchive::Release::Origin "The ${PROJECT_NAME} project";
+APT::FTPArchive::Release::Label "The ${PROJECT_NAME} project";
+APT::FTPArchive::Release::Architectures "i386 amd64";
+APT::FTPArchive::Release::Codename "${code_name}";
+APT::FTPArchive::Release::Suite "${code_name}";
+APT::FTPArchive::Release::Components "${component}";
+APT::FTPArchive::Release::Description "${PACKAGE_NAME} packages";
+EOF
+ apt-ftparchive -c release-${code_name}.conf \
+ release dists/${code_name} > /tmp/Release
+ mv /tmp/Release dists/${code_name}
+}
+
+for code_name in ${CODES}; do
+ case ${code_name} in
+ squeeze|wheezy|jessie|unstable)
+ distribution=debian
+ component=main
+ ;;
+ *)
+ distribution=ubuntu
+ component=universe
+ ;;
+ esac
+
+ mkdir -p ${DESTINATION}${distribution}
+ (cd ${DESTINATION}${distribution}
+ update_repository $distribution $code_name $component) &
+ if [ "${PARALLEL}" != "yes" ]; then
+ wait
+ fi
+done
+
+wait
diff --git a/storage/mroonga/packages/check-utility.sh b/storage/mroonga/packages/check-utility.sh
new file mode 100755
index 00000000000..211e231a473
--- /dev/null
+++ b/storage/mroonga/packages/check-utility.sh
@@ -0,0 +1,665 @@
+#!/bin/sh
+
+# Usage: check-utility.sh [--install-groonga]
+# [--check-install]
+# [--check-address]
+# [--enable-repository]
+#
+# CODES="squeeze wheezy unstable lucid natty oneiric precise"
+# DISTRIBUTIONS="centos fedora"
+
+CHROOT_ROOT=/var/lib/chroot
+CHECK_ADDRESS=0
+CHECK_INSTALL=0
+CHECK_INSTALL_PACKAGE=mysql-server-mroonga
+CHECK_BUILD=0
+CHECK_DEPENDS=0
+CHECK_PROVIDES=0
+ENABLE_REPOSITORY=0
+DISABLE_REPOSITORY=0
+INSTALL_SCRIPT=0
+INSTALL_MROONGA=0
+UNINSTALL_MROONGA=0
+
+common_deb_procedure ()
+{
+ for code in $CODES; do
+ for arch in $DEB_ARCHITECTURES; do
+ root_dir=$CHROOT_ROOT/$code-$arch
+ eval $1 $code $arch $root_dir
+ done
+ done
+}
+
+common_rpm_procedure ()
+{
+ for dist in $DISTRIBUTIONS; do
+ case $dist in
+ "fedora")
+ DISTRIBUTIONS_VERSION="19"
+ ;;
+ "centos")
+ DISTRIBUTIONS_VERSION="5 6"
+ ;;
+ esac
+ for ver in $DISTRIBUTIONS_VERSION; do
+ for arch in $RPM_ARCHITECTURES; do
+ root_dir=$CHROOT_ROOT/$dist-$ver-$arch
+ eval $1 $dist $arch $ver $root_dir
+ done
+ done
+ done
+}
+
+echo_packages_repository_address ()
+{
+ root_dir=$1
+ code=$2
+ arch=$3
+ address=`grep "packages.groonga.org" $root_dir/etc/hosts | grep -v "#"`
+ if [ -z "$address" ]; then
+ echo "$code-$arch: default"
+ else
+ echo "$code-$arch: $address"
+ fi
+}
+
+setup_distributions ()
+{
+ if [ -z "$DISTRIBUTIONS" ]; then
+ DISTRIBUTIONS="centos fedora"
+ fi
+}
+
+setup_rpm_architectures ()
+{
+ if [ -z "$RPM_ARCHITECTURES" ]; then
+ RPM_ARCHITECTURES="i386 x86_64"
+ fi
+}
+
+setup_codes ()
+{
+ if [ -z "$CODES" ]; then
+ CODES="squeeze wheezy jessie unstable lucid precise quantal raring"
+ fi
+}
+setup_deb_architectures ()
+{
+ if [ -z "$DEB_ARCHITECTURES" ]; then
+ DEB_ARCHITECTURES="i386 amd64"
+ fi
+}
+
+check_packages_repository_address ()
+{
+ common_deb_procedure "check_packages_deb_repository_address"
+ common_rpm_procedure "check_packages_rpm_repository_address"
+}
+
+check_packages_deb_repository_address ()
+{
+ code=$1
+ arch=$2
+ root_dir=$4
+ echo_packages_repository_address "$root_dir" "$code" "$arch"
+}
+
+check_packages_rpm_repository_address ()
+{
+ dist=$1
+ arch=$2
+ ver=$3
+ root_dir=$4
+ echo_packages_repository_address "$root_dir" "$dist-$ver" "$arch"
+}
+
+host_address ()
+{
+ ifconfig_result=`LANG=C /sbin/ifconfig wlan0`
+ inet_addr=`echo "$ifconfig_result" | grep "inet addr:192"`
+ address=`echo $inet_addr | ruby -ne '/inet addr:(.+?)\s/ =~ $_ && puts($1)'`
+ HOST_ADDRESS=$address
+}
+
+check_build_packages ()
+{
+ common_deb_procedure "check_build_deb_packages"
+ common_rpm_procedure "check_build_rpm_packages"
+}
+
+check_build_deb_packages ()
+{
+ code=$1
+ arch=$2
+ BASE_VERSION=`cat ../version`
+ RESULT_SET=`find apt/repositories -name "*$BASE_VERSION*" | grep $code | grep $arch`
+ if [ -z "$RESULT_SET" ]; then
+ printf "%8s %5s %s => 0 deb\n" $code $arch $BASE_VERSION
+ else
+ PACKAGE_COUNT=`find apt/repositories -name "*$BASE_VERSION*" | grep $code | grep $arch | wc | awk '{print \$1}'`
+ printf "%8s %5s %s => %2d debs\n" $code $arch $BASE_VERSION $PACKAGE_COUNT
+ fi
+}
+
+check_build_rpm_packages ()
+{
+ dist=$1
+ arch=$2
+ ver=$3
+ BASE_VERSION=`cat ../version`
+ FIND_PATH=yum/repositories/$dist/$ver/$arch
+ RESULT_SET=`find $FIND_PATH -name "*$BASE_VERSION*"`
+ if [ -z "$RESULT_SET" ]; then
+ printf "%8s %6s %s => 0 rpm\n" $dist$ver $arch $BASE_VERSION
+ else
+ PACKAGE_COUNT=`find $FIND_PATH -name "*$BASE_VERSION*" | wc -l`
+ printf "%8s %6s %s => %2d rpms\n" $dist$ver $arch $BASE_VERSION $PACKAGE_COUNT
+ fi
+}
+
+check_depends_packages ()
+{
+ common_deb_procedure "check_depends_deb_packages"
+ common_rpm_procedure "check_depends_rpm_packages"
+}
+
+check_depends_deb_packages ()
+{
+ code=$1
+ arch=$2
+ BASE_VERSION=`cat ../version`
+ FIND_PATH=apt/repositories/*/pool/$code
+ RESULT_SET=`find $FIND_PATH -name "*$BASE_VERSION*.deb"`
+ if [ -z "$RESULT_SET" ]; then
+ printf "%8s %5s %s => 404 deb\n" $code $arch $BASE_VERSION
+ else
+ for pkg in $RESULT_SET; do
+ DEB_NAME=`basename $pkg`
+ DEPENDS=`dpkg -I $pkg | grep "Depends"`
+ printf "%8s %5s %s => %s\n" $code $arch $DEB_NAME "$DEPENDS"
+ done
+ fi
+}
+
+check_depends_rpm_packages ()
+{
+ dist=$1
+ arch=$2
+ ver=$3
+ BASE_VERSION=`cat ../version`
+ FIND_PATH=yum/repositories/$dist/$ver/$arch
+ RESULT_SET=`find $FIND_PATH -name "*$BASE_VERSION*"`
+ if [ -z "$RESULT_SET" ]; then
+ printf "%8s %6s %s => 404 rpm\n" $dist$ver $arch $BASE_VERSION
+ else
+ for pkg in $RESULT_SET; do
+ RPM_NAME=`basename $pkg`
+ DEPENDS=`rpm -qp --requires $pkg | grep -i "mysql" | tr -t '\n' ' '`
+ printf "%9s %6s %s => %s\n" $dist$ver $arch $RPM_NAME "$DEPENDS"
+ done
+ fi
+}
+
+check_provided_mysql_packages ()
+{
+ common_deb_procedure "check_provided_mysql_deb_packages"
+ common_rpm_procedure "check_provided_mysql_rpm_packages"
+ for code in $CODES; do
+ echo $code
+ cat tmp/$code-amd64-mysql-server.txt
+ done
+ for dist in $DISTRIBUTIONS; do
+ echo $dist
+ cat tmp/$dist-x86_64-mysql-server.txt
+ done
+}
+
+check_provided_mysql_deb_packages ()
+{
+ code=$1
+ arch=$2
+ root_dir=$3
+ cat > tmp/check-provided-mysql.sh <<EOF
+#!/bin/sh
+apt-get update > /dev/null
+apt-cache show mysql-server | grep "Version" | head -1 > /tmp/$code-$arch-mysql-server.txt
+EOF
+ if [ -d $root_dir ]; then
+ CHECK_SCRIPT=check-provided-mysql.sh
+ echo "copy check script $CHECK_SCRIPT to $root_dir/tmp"
+ sudo rm -f $root_dir/tmp/$CHECK_SCRIPT
+ cp tmp/$CHECK_SCRIPT $root_dir/tmp
+ sudo chmod 755 $root_dir/tmp/$CHECK_SCRIPT
+ sudo chname $code-$arch chroot $root_dir /tmp/$CHECK_SCRIPT
+ cp $root_dir/tmp/$code-$arch-mysql-server.txt tmp
+ fi
+}
+
+check_provided_mysql_rpm_packages ()
+{
+ dist=$1
+ arch=$2
+ ver=$3
+ root_dir=$4
+ cat > tmp/check-provided-mysql.sh <<EOF
+#!/bin/sh
+yum update > /dev/null
+yum info mysql-server | grep "Version" > /tmp/$code-$arch-mysql-server.txt
+EOF
+ if [ -d $root_dir ]; then
+ CHECK_SCRIPT=check-provided-mysql.sh
+ echo "copy check script $CHECK_SCRIPT to $root_dir/tmp"
+ sudo rm -f $root_dir/tmp/$CHECK_SCRIPT
+ cp tmp/$CHECK_SCRIPT $root_dir/tmp
+ sudo chmod 755 $root_dir/tmp/$CHECK_SCRIPT
+ sudo chname $code-$arch chroot $root_dir /tmp/$CHECK_SCRIPT
+ cp $root_dir/tmp/$code-$arch-mysql-server.txt tmp
+ fi
+}
+
+check_installed_mroonga_packages ()
+{
+ common_deb_procedure "check_installed_mroonga_deb_packages"
+ common_rpm_procedure "check_installed_mroonga_rpm_packages"
+}
+
+check_installed_mroonga_deb_packages ()
+{
+ code=$1
+ arch=$2
+ root_dir=$3
+ cat > tmp/check-deb-mroonga.sh <<EOF
+#!/bin/sh
+dpkg -l | grep $CHECK_INSTALL_PACKAGE
+EOF
+ if [ -d $root_dir ]; then
+ CHECK_SCRIPT=check-deb-mroonga.sh
+ echo "copy check script $CHECK_SCRIPT to $root_dir/tmp"
+ sudo rm -f $root_dir/tmp/$CHECK_SCRIPT
+ cp tmp/$CHECK_SCRIPT $root_dir/tmp
+ sudo chmod 755 $root_dir/tmp/$CHECK_SCRIPT
+ sudo chname $code-$arch chroot $root_dir /tmp/$CHECK_SCRIPT
+ fi
+}
+
+check_installed_mroonga_rpm_packages ()
+{
+ dist=$1
+ arch=$2
+ ver=$3
+ root_dir=$4
+ cat > tmp/check-rpm-mroonga.sh <<EOF
+#!/bin/sh
+rpm -qa | grep $CHECK_INSTALL_PACKAGE
+EOF
+ CHECK_SCRIPT=check-rpm-mroonga.sh
+ if [ -d $root_dir ]; then
+ echo "copy check script $CHECK_SCRIPT to $root_dir/tmp"
+ sudo rm -f $root_dir/tmp/$CHECK_SCRIPT
+ cp tmp/$CHECK_SCRIPT $root_dir/tmp
+ sudo chmod 755 $root_dir/tmp/$CHECK_SCRIPT
+ sudo chname $code-$ver-$arch chroot $root_dir /tmp/$CHECK_SCRIPT
+ fi
+}
+
+install_mroonga_packages ()
+{
+ common_deb_procedure "install_mroonga_deb_packages"
+ common_rpm_procedure "install_mroonga_rpm_packages"
+}
+
+install_mroonga_deb_packages ()
+{
+ code=$1
+ arch=$2
+ root_dir=$4
+ cat > tmp/install-aptitude-mroonga.sh <<EOF
+#!/bin/sh
+sudo aptitude clean
+rm -f /var/lib/apt/lists/packages.groonga.org_*
+rm -f /var/lib/apt/lists/partial/packages.groonga.org_*
+sudo aptitude update
+sudo aptitude -V -D -y --allow-untrusted install groonga-keyring
+sudo aptitude update
+sudo aptitude -V -D install mysql-server-mroonga
+sudo aptitude -V -D install groonga-tokenizer-mecab
+EOF
+ cat > tmp/install-aptget-mroonga.sh <<EOF
+#!/bin/sh
+sudo apt-get clean
+rm -f /var/lib/apt/lists/packages.groonga.org_*
+rm -f /var/lib/apt/lists/partial/packages.groonga.org_*
+sudo apt-get update
+sudo apt-get -y --allow-unauthenticated install groonga-keyring
+sudo apt-get update
+sudo apt-get -V -y install mysql-server-mroonga
+sudo apt-get -V -y install groonga-tokenizer-mecab
+EOF
+ root_dir=$CHROOT_ROOT/$code-$arch
+ INSTALL_SCRIPT=""
+ case $code in
+ squeeze|unstable)
+ INSTALL_SCRIPT=install-aptitude-mroonga.sh
+ ;;
+ *)
+ INSTALL_SCRIPT=install-aptget-mroonga.sh
+ ;;
+ esac
+ if [ -d $root_dir ]; then
+ echo "copy install script $INSTALL_SCRIPT to $root_dir/tmp"
+ sudo rm -f $root_dir/tmp/$INSTALL_SCRIPT
+ cp tmp/$INSTALL_SCRIPT $root_dir/tmp
+ chmod 755 $root_dir/tmp/$INSTALL_SCRIPT
+ sudo chname $code-$arch chroot $root_dir /tmp/$INSTALL_SCRIPT
+ fi
+}
+
+install_mroonga_rpm_packages ()
+{
+ dist=$1
+ arch=$2
+ ver=$3
+ root_dir=$4
+ cat > tmp/install-centos5-mroonga.sh <<EOF
+sudo rpm -ivh http://packages.groonga.org/centos/groonga-release-1.1.0-0.noarch.rpm
+sudo yum makecache
+sudo yum install -y MySQL-server
+sudo service mysql start
+sudo yum install -y mysql-mroonga
+sudo yum install -y groonga-tokenizer-mecab
+EOF
+ cat > tmp/install-centos6-mroonga.sh <<EOF
+sudo rpm -ivh http://packages.groonga.org/centos/groonga-release-1.1.0-0.noarch.rpm
+sudo yum makecache
+sudo yum install -y mysql-server
+sudo service mysql start
+sudo yum install -y mysql-mroonga
+sudo yum install -y groonga-tokenizer-mecab
+EOF
+ cat > tmp/install-fedora-mroonga.sh <<EOF
+sudo rpm -ivh http://packages.groonga.org/fedora/groonga-release-1.1.0-0.noarch.rpm
+sudo yum makecache
+sudo yum install -y mysql-mroonga
+sudo yum install -y groonga-tokenizer-mecab
+EOF
+ INSTALL_SCRIPT=""
+ case "$dist-$ver" in
+ centos-5)
+ INSTALL_SCRIPT=install-centos5-mroonga.sh
+ ;;
+ centos-6)
+ INSTALL_SCRIPT=install-centos6-mroonga.sh
+ ;;
+ fedora-18)
+ INSTALL_SCRIPT=install-fedora-mroonga.sh
+ ;;
+ *)
+ ;;
+ esac
+ if [ -d $root_dir ]; then
+ echo "copy install script $INSTALL_SCRIPT to $root_dir/tmp"
+ sudo rm -f $root_dir/tmp/$INSTALL_SCRIPT
+ cp tmp/$INSTALL_SCRIPT $root_dir/tmp
+ chmod 755 $root_dir/tmp/$INSTALL_SCRIPT
+ sudo chname $code-$ver-$arch chroot $root_dir /tmp/$INSTALL_SCRIPT
+ fi
+}
+
+
+uninstall_mroonga_packages ()
+{
+ common_deb_procedure "uninstall_mroonga_deb_packages"
+ common_rpm_procedure "uninstall_mroonga_rpm_packages"
+}
+
+uninstall_mroonga_deb_packages ()
+{
+ code=$1
+ arch=$2
+ root_dir=$4
+ UNINSTALL_SCRIPT=uninstall-deb-mroonga.sh
+ cat > $UNINSTALL_SCRIPT <<EOF
+#!/bin/sh
+sudo apt-get purge mroonga-* mysql-*
+EOF
+ if [ -d $root_dir ]; then
+ echo "copy uninstall script $UNINSTALL_SCRIPT to $root_dir/tmp"
+ sudo rm -f $root_dir/tmp/$UNINSTALL_SCRIPT
+ cp $UNINSTALL_SCRIPT $root_dir/tmp
+ chmod 755 $root_dir/tmp/$UNINSTALL_SCRIPT
+ sudo chname $code-$arch chroot $root_dir /tmp/$UNINSTALL_SCRIPT
+ fi
+}
+
+uninstall_mroonga_rpm_packages ()
+{
+ dist=$1
+ arch=$2
+ ver=$3
+ root_dir=$4
+ UNINSTALL_SCRIPT=uninstall-rpm-mroonga.sh
+ cat > tmp/$UNINSTALL_SCRIPT <<EOF
+#!/bin/sh
+sudo yum remove mroonga-* mysql-*
+EOF
+ if [ -d $root_dir ]; then
+ echo "copy install script $UNINSTALL_SCRIPT to $root_dir/tmp"
+ sudo rm -f $root_dir/tmp/$UNINSTALL_SCRIPT
+ cp tmp/$UNINSTALL_SCRIPT $root_dir/tmp
+ chmod 755 $root_dir/tmp/$UNINSTALL_SCRIPT
+ sudo chname $code-$ver-$arch chroot $root_dir /tmp/$UNINSTALL_SCRIPT
+ fi
+}
+
+
+enable_temporaly_mroonga_repository ()
+{
+ cat > tmp/enable-repository.sh <<EOF
+#!/bin/sh
+
+grep -v "packages.groonga.org" /etc/hosts > /tmp/hosts
+echo "$HOST_ADDRESS packages.groonga.org" >> /tmp/hosts
+cp -f /tmp/hosts /etc/hosts
+EOF
+ common_deb_procedure "enable_temporaly_mroonga_deb_repository"
+ common_rpm_procedure "enable_temporaly_mroonga_rpm_repository"
+ check_packages_repository_address
+}
+
+enable_temporaly_mroonga_deb_repository ()
+{
+ code=$1
+ arch=$2
+ root_dir=$4
+ today=`date '+%Y%m%d.%s'`
+ if [ -d $root_dir ]; then
+ sudo cp $root_dir/etc/hosts $root_dir/etc/hosts.$today
+ sudo cp tmp/enable-repository.sh $root_dir/tmp
+ sudo chname $code-$arch chroot $root_dir /tmp/enable-repository.sh
+ fi
+}
+
+enable_temporaly_mroonga_rpm_repository ()
+{
+ dist=$1
+ arch=$2
+ ver=$3
+ root_dir=$4
+ today=`date '+%Y%m%d.%s'`
+ if [ -d $root_dir ]; then
+ sudo cp $root_dir/etc/hosts $root_dir/etc/hosts.$today
+ sudo cp tmp/enable-repository.sh $root_dir/tmp
+ sudo chname $code-$arch chroot $root_dir /tmp/enable-repository.sh
+ fi
+}
+
+disable_temporaly_mroonga_repository ()
+{
+ cat > tmp/disable-repository.sh <<EOF
+#!/bin/sh
+
+grep -v "packages.groonga.org" /etc/hosts > /tmp/hosts
+cp -f /tmp/hosts /etc/hosts
+EOF
+ common_deb_procedure "disable_temporaly_mroonga_deb_repository"
+ common_rpm_procedure "disable_temporaly_mroonga_rpm_repository"
+ check_packages_repository_address
+}
+
+disable_temporaly_mroonga_deb_repository ()
+{
+ code=$1
+ arch=$2
+ root_dir=$4
+ DISABLE_SCRIPT=disable-repository.sh
+ today=`date '+%Y%m%d.%s'`
+ if [ -d $root_dir ]; then
+ sudo cp $root_dir/etc/hosts $root_dir/etc/hosts.$today
+ cp tmp/$DISABLE_SCRIPT $root_dir/tmp
+ chmod 755 $root_dir/tmp/$DISABLE_SCRIPT
+ sudo chname $code-$arch chroot $root_dir /tmp/$DISABLE_SCRIPT
+ fi
+
+}
+
+disable_temporaly_mroonga_rpm_repository ()
+{
+ dist=$1
+ arch=$2
+ ver=$3
+ root_dir=$4
+ DISABLE_SCRIPT=disable-repository.sh
+ today=`date '+%Y%m%d.%s'`
+ if [ -d $root_dir ]; then
+ sudo cp $root_dir/etc/hosts $root_dir/etc/hosts.$today
+ cp tmp/$DISABLE_SCRIPT $root_dir/tmp
+ chmod 755 $root_dir/tmp/$DISABLE_SCRIPT
+ sudo chname $code-$arch chroot $root_dir /tmp/$DISABLE_SCRIPT
+ fi
+}
+
+host_address
+echo $HOST_ADDRESS
+
+while [ $# -ne 0 ]; do
+ case $1 in
+ --check-install)
+ CHECK_INSTALL=1
+ shift
+ if [ ! -z "$1" ]; then
+ case $1 in
+ groonga|mroonga|roonga|mecab|mysql)
+ CHECK_INSTALL_PACKAGE=$1
+ ;;
+ *)
+ ;;
+ esac
+ fi
+ ;;
+ --check-address)
+ CHECK_ADDRESS=1
+ shift
+ ;;
+ --check-depends)
+ CHECK_DEPENDS=1
+ shift
+ ;;
+ --check-provides)
+ CHECK_PROVIDES=1
+ shift
+ ;;
+ --check-build)
+ CHECK_BUILD=1
+ shift
+ ;;
+ --enable-repository)
+ ENABLE_REPOSITORY=1
+ shift
+ ;;
+ --disable-repository)
+ DISABLE_REPOSITORY=1
+ shift
+ ;;
+ --install-mroonga)
+ INSTALL_MROONGA=1
+ shift
+ ;;
+ --uninstall-mroonga)
+ UNINSTALL_MROONGA=1
+ shift
+ ;;
+ --code)
+ shift
+ if [ "$1" = "all" ]; then
+ setup_codes
+ else
+ CODES=$1
+ fi
+ shift
+ ;;
+ --code-arch)
+ shift
+ if [ "$1" = "all" ]; then
+ setup_deb_architectures
+ else
+ DEB_ARCHITECTURES=$1
+ fi
+ shift
+ ;;
+ --dist)
+ shift
+ if [ "$1" = "all" ]; then
+ setup_distributions
+ else
+ DISTRIBUTIONS=$1
+ fi
+ shift
+ ;;
+ --dist-arch)
+ shift
+ if [ "$1" = "all" ]; then
+ setup_rpm_architectures
+ else
+ RPM_ARCHITECTURES=$1
+ fi
+ shift
+ ;;
+ *)
+ shift
+ ;;
+ esac
+done
+
+mkdir -p tmp
+setup_deb_architectures
+setup_rpm_architectures
+
+if [ $CHECK_INSTALL -ne 0 ]; then
+ check_installed_mroonga_packages
+fi
+if [ $CHECK_ADDRESS -ne 0 ]; then
+ check_packages_repository_address
+fi
+if [ $CHECK_BUILD -ne 0 ]; then
+ check_build_packages
+fi
+if [ $CHECK_DEPENDS -ne 0 ]; then
+ check_depends_packages
+fi
+if [ $CHECK_PROVIDES -ne 0 ]; then
+ check_provided_mysql_packages
+fi
+if [ $ENABLE_REPOSITORY -ne 0 ]; then
+ enable_temporaly_mroonga_repository
+fi
+if [ $DISABLE_REPOSITORY -ne 0 ]; then
+ disable_temporaly_mroonga_repository
+fi
+if [ $INSTALL_MROONGA -ne 0 ]; then
+ install_mroonga_packages
+fi
+if [ $UNINSTALL_MROONGA -ne 0 ]; then
+ uninstall_mroonga_packages
+fi
+
diff --git a/storage/mroonga/packages/debian/apparmor/mysql-server-mroonga b/storage/mroonga/packages/debian/apparmor/mysql-server-mroonga
new file mode 100644
index 00000000000..259f8d1dc0c
--- /dev/null
+++ b/storage/mroonga/packages/debian/apparmor/mysql-server-mroonga
@@ -0,0 +1,5 @@
+/usr/lib/groonga/plugins/ r,
+/usr/lib/groonga/plugins/** rm,
+/etc/mecabrc r,
+/var/lib/mecab/dic/** r,
+#include <local/mysql-server-mroonga>
diff --git a/storage/mroonga/packages/debian/changelog b/storage/mroonga/packages/debian/changelog
new file mode 100644
index 00000000000..d3025d96100
--- /dev/null
+++ b/storage/mroonga/packages/debian/changelog
@@ -0,0 +1,403 @@
+mroonga (5.02-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- HAYASHI Kentaro <hayashi@clear-code.com> Wed, 29 Apr 2015 00:00:00 +0900
+
+mroonga (5.01-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- HAYASHI Kentaro <hayashi@clear-code.com> Sun, 29 Mar 2015 00:00:00 +0900
+
+mroonga (5.00-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- <hayashi@clear-code.com> Mon, 09 Feb 2015 00:00:00 +0900
+
+mroonga (4.10-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- HAYASHI Kentaro <hayashi@clear-code.com> Thu, 29 Jan 2015 00:00:00 +0900
+
+mroonga (4.09-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- Kouhei Sutou <kou@cozmixng.org> Mon, 29 Dec 2014 00:00:00 +0900
+
+mroonga (4.08-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- HAYASHI Kentaro <hayashi@clear-code.com> Sat, 29 Nov 2014 00:00:00 +0900
+
+mroonga (4.07-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- Kouhei Sutou <kou@clear-code.com> Wed, 29 Oct 2014 00:00:00 +0900
+
+mroonga (4.06-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- Kouhei Sutou <kou@clear-code.com> Mon, 29 Sep 2014 00:00:00 +0900
+
+mroonga (4.05-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- Kouhei Sutou <kou@clear-code.com> Fri, 29 Aug 2014 00:00:00 +0900
+
+mroonga (4.04-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- HAYASHI Kentaro <hayashi@clear-code.com> Tue, 29 Jul 2014 00:00:00 +0900
+
+mroonga (4.03-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- Kouhei Sutou <kou@clear-code.com> Thu, 29 May 2014 00:00:00 +0900
+
+mroonga (4.02-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- Kouhei Sutou <kou@clear-code.com> Tue, 29 Apr 2014 00:00:00 +0900
+
+mroonga (4.01-2) unstable; urgency=low
+
+ * Built for mysql-server 5.5.37
+
+ -- HAYASHI Kentaro <hayashi@clear-code.com> Mon, 28 Apr 2014 00:00:00 +0900
+
+mroonga (4.01-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- HAYASHI Kentaro <hayashi@clear-code.com> Sat, 29 Mar 2014 00:00:00 +0900
+
+mroonga (4.00-2) unstable; urgency=low
+
+ * Built for mysql-server 5.5.35+dfsg-2 on Debian jessie
+ * Built for mysql-server 5.5.35+dfsg-2 on Debian sid
+
+ -- HAYASHI Kentaro <hayashi@clear-code.com> Thu, 06 Mar 2014 00:00:00 +0900
+
+mroonga (4.00-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- HAYASHI Kentaro <hayashi@clear-code.com> Sun, 09 Feb 2014 00:00:00 +0900
+
+mroonga (3.12-2) unstable; urgency=low
+
+ * Built for mysql-server updates on Ubuntu 12.04,12.10, and 13.10.
+
+ -- HAYASHI Kentaro <hayashi@clear-code.com> Wed, 29 Jan 2014 13:12:56 +0900
+
+mroonga (3.12-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- HAYASHI Kentaro <hayashi@clear-code.com> Wed, 29 Jan 2014 00:00:00 +0900
+
+mroonga (3.11-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- HAYASHI Kentaro <hayashi@clear-code.com> Sun, 29 Dec 2013 00:00:00 +0900
+
+mroonga (3.10-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- HAYASHI Kentaro <hayashi@clear-code.com> Fri, 29 Nov 2013 00:00:00 +0900
+
+mroonga (3.09-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- HAYASHI Kentaro <hayashi@clear-code.com> Tue, 29 Oct 2013 00:00:00 +0900
+
+mroonga (3.08-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- HAYASHI Kentaro <hayashi@clear-code.com> Sun, 29 Sep 2013 00:00:00 +0900
+
+mroonga (3.07-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- HAYASHI Kentaro <hayashi@clear-code.com> Thu, 29 Aug 2013 00:00:00 +0900
+
+mroonga (3.06-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- HAYASHI Kentaro <hayashi@clear-code.com> Mon, 29 Jul 2013 00:00:00 +0900
+
+mroonga (3.05-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- HAYASHI Kentaro <hayashi@clear-code.com> Sat, 29 Jun 2013 00:00:00 +0900
+
+mroonga (3.04-2) unstable; urgency=low
+
+ * Built for mysql-server 5.5.31-0ubuntu0.12.04.2 on Ubuntu 12.04 (precise)
+
+ -- HAYASHI Kentaro <hayashi@clear-code.com> Thu, 13 Jun 2013 00:00:00 +0900
+
+mroonga (3.04-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- HAYASHI Kentaro <hayashi@clear-code.com> Wed, 29 May 2013 00:00:00 +0900
+
+mroonga (3.03-2) unstable; urgency=low
+
+ * Built for mysql-server 5.5.31+dfsg-0+wheezy1 on Debian wheezy
+ * Built for mysql-server 5.5.31+dfsg-1 on Debian unstable
+
+ -- HAYASHI Kentaro <hayashi@clear-code.com> Thu, 16 May 2013 00:00:00 +0900
+
+mroonga (3.03-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- HAYASHI Kentaro <hayashi@clear-code.com> Mon, 29 Apr 2013 00:00:00 +0900
+
+mroonga (3.02-2) unstable; urgency=low
+
+ * Built for mysql-server 5.5.29-0ubuntu0.12.04.2 on Ubuntu 12.04 (precise)
+
+ -- HAYASHI Kentaro <hayashi@clear-code.com> Fri, 29 Mar 2013 22:15:39 +0900
+
+mroonga (3.02-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- HAYASHI Kentaro <hayashi@clear-code.com> Fri, 29 Mar 2013 00:00:00 +0900
+
+mroonga (3.01-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- HAYASHI Kentaro <hayashi@clear-code.com> Thu, 28 Feb 2013 00:00:00 +0900
+
+mroonga (3.00-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- HAYASHI Kentaro <hayashi@clear-code.com> Sat, 09 Feb 2013 00:00:00 +0900
+
+mroonga (2.10-2) unstable; urgency=low
+
+ * Built for mysql-server 5.5.29+dfsg-1 on Debian/unstable.
+ * Built for mysql-server 5.1.67-0ubuntu0.10.04.1 on Ubuntu 10.04(lucid).
+ * Built for mysql-server 5.1.67-0ubuntu0.11.10.1 on Ubuntu 11.10(oneiric).
+ * Built for mysql-server 5.5.29-0ubuntu0.12.04.1 on Ubuntu 12.04(precise).
+ * Built for mysql-server 5.5.29-0ubuntu0.12.10.1 on Ubuntu 12.10(quantal).
+
+ -- HAYASHI Kentaro <hayashi@clear-code.com> Thu, 24 Jan 2013 10:28:16 +0900
+
+mroonga (2.10-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- HAYASHI Kentaro <hayashi@clear-code.com> Sat, 29 Dec 2012 00:00:00 +0900
+
+mroonga (2.09-2) unstable; urgency=low
+
+ * Built for mysql-server 5.5.28-0ubuntu0.12.10.2 on Ubuntu 12.10.
+ Reported by @watanabekiyokaz
+
+ -- HAYASHI Kentaro <hayashi@clear-code.com> Wed, 12 Dec 2012 13:28:00 +0900
+
+mroonga (2.09-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- HAYASHI Kentaro <hayashi@clear-code.com> Thu, 29 Nov 2012 00:00:00 +0900
+
+mroonga (2.08-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- HAYASHI Kentaro <hayashi@clear-code.com> Mon, 29 Oct 2012 00:00:00 +0900
+
+mroonga (2.07-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- HAYASHI Kentaro <hayashi@clear-code.com> Sat, 29 Sep 2012 00:00:00 +0900
+
+mroonga (2.06-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- Kouhei Sutou <kou@clear-code.com> Wed, 29 Aug 2012 00:00:00 +0900
+
+mroonga (2.05-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- HAYASHI Kentaro <hayashi@clear-code.com> Sun, 29 Jul 2012 00:00:00 +0900
+
+mroonga (2.04-1) unstable; urgency=low
+
+ * New upstream release.
+ * Ensure deleting mroonga plugin before install.
+ Suggested by Kazuhiro Isobe. Thanks!!!
+
+ -- Kouhei Sutou <kou@clear-code.com> Fri, 29 Jun 2012 00:00:00 +0900
+
+mroonga (2.03-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- Kouhei Sutou <kou@clear-code.com> Tue, 29 May 2012 00:00:00 +0900
+
+mroonga (2.02-1) unstable; urgency=low
+
+ * New upstream release.
+ * Require groonga >= 2.0.2.
+
+ -- Kouhei Sutou <kou@clear-code.com> Sun, 29 Apr 2012 00:00:00 +0900
+
+mroonga (2.01-1) unstable; urgency=low
+
+ * New upstream release.
+ * Ensure plugin is uninstalled by closing all tables use mroonga.
+
+ -- Kouhei Sutou <kou@clear-code.com> Thu, 29 Mar 2012 00:00:00 +0900
+
+mroonga (2.00-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- Kouhei Sutou <kou@clear-code.com> Wed, 29 Feb 2012 00:00:00 +0900
+
+mroonga (1.20-1) unstable; urgency=low
+
+ * New upstream release.
+ * Add mysql-server-mroonga-compatible package for "groonga" storage engine.
+
+ -- Kouhei Sutou <kou@clear-code.com> Sun, 29 Jan 2012 00:00:00 +0900
+
+mroonga (1.11-1) unstable; urgency=low
+
+ * New upstream release.
+ * Change apparmor configuration file name:
+ mysql-server-groonga -> mysql-server-mroonga
+
+ -- Kouhei Sutou <kou@clear-code.com> Thu, 29 Dec 2011 00:00:00 +0900
+
+mroonga (1.10-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- Kouhei Sutou <kou@clear-code.com> Sat, 29 Oct 2011 00:00:00 +0900
+
+groonga-storage-engine (1.0.0-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- Kouhei Sutou <kou@clear-code.com> Thu, 29 Sep 2011 00:00:00 +0900
+
+groonga-storage-engine (0.9-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- Kouhei Sutou <kou@clear-code.com> Mon, 29 Aug 2011 00:00:00 +0900
+
+groonga-storage-engine (0.8-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- Kouhei Sutou <kou@clear-code.com> Fri, 29 Jul 2011 00:00:00 +0900
+
+groonga-storage-engine (0.7-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- Kouhei Sutou <kou@clear-code.com> Wed, 29 Jun 2011 00:00:00 +0900
+
+groonga-storage-engine (0.6-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- Kouhei Sutou <kou@clear-code.com> Sun, 29 May 2011 00:00:00 +0900
+
+groonga-storage-engine (0.5-4) unstable; urgency=low
+
+ * fix a typo.
+
+ -- Kouhei Sutou <kou@clear-code.com> Tue, 30 Mar 2011 01:05:00 +0900
+
+groonga-storage-engine (0.5-3) unstable; urgency=low
+
+ * fix AppArmor files.
+
+ -- Kouhei Sutou <kou@clear-code.com> Tue, 30 Mar 2011 00:59:00 +0900
+
+groonga-storage-engine (0.5-2) unstable; urgency=low
+
+ * hook script fix.
+
+ -- Kouhei Sutou <kou@clear-code.com> Tue, 30 Mar 2011 00:58:00 +0900
+
+groonga-storage-engine (0.5-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- Kouhei Sutou <kou@clear-code.com> Tue, 29 Mar 2011 00:00:00 +0900
+
+groonga-storage-engine (0.4-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- Kouhei Sutou <kou@clear-code.com> Mon, 29 Nov 2010 00:00:00 +0900
+
+groonga-storage-engine (0.3-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- Kouhei Sutou <kou@clear-code.com> Fri, 29 Oct 2010 16:34:04 +0900
+
+groonga-storage-engine (0.2-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- Kouhei Sutou <kou@clear-code.com> Sat, 25 Sep 2010 14:52:49 +0900
+
+groonga-storage-engine (0.1-4) unstable; urgency=low
+
+ * follow configure option changes.
+
+ -- Kouhei Sutou <kou@cozmixng.org> Fri, 10 Sep 2010 08:45:53 +0900
+
+groonga-storage-engine (0.1-3) unstable; urgency=low
+
+ * Use HEAD.
+
+ -- Kouhei Sutou <kou@clear-code.com> Thu, 02 Sep 2010 12:03:46 +0900
+
+groonga-storage-engine (0.1-2) unstable; urgency=low
+
+ * Built with groonga 1.0.0.
+
+ -- Kouhei Sutou <kou@cozmixng.org> Mon, 30 Aug 2010 13:26:25 +0900
+
+groonga-storage-engine (0.1-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- Kouhei Sutou <kou@clear-code.com> Mon, 23 Aug 2010 13:52:01 +0900
diff --git a/storage/mroonga/packages/debian/compat b/storage/mroonga/packages/debian/compat
new file mode 100644
index 00000000000..ec635144f60
--- /dev/null
+++ b/storage/mroonga/packages/debian/compat
@@ -0,0 +1 @@
+9
diff --git a/storage/mroonga/packages/debian/control.in b/storage/mroonga/packages/debian/control.in
new file mode 100644
index 00000000000..d6d03fa9a4e
--- /dev/null
+++ b/storage/mroonga/packages/debian/control.in
@@ -0,0 +1,51 @@
+Source: mroonga
+Section: database
+Priority: optional
+Maintainer: Kouhei Sutou <kou@clear-code.com>
+Build-Depends:
+ debhelper (>= 7.0.50),
+ autotools-dev,
+ pkg-config,
+ libgroonga-dev (>= @REQUIRED_GROONGA_VERSION@),
+ groonga-normalizer-mysql,
+ libmysqlclient-dev,
+ libmysqld-dev,
+ libssl-dev,
+ wget,
+ lsb-release
+Standards-Version: 3.9.1
+Homepage: http://mroonga.org/
+
+Package: mysql-server-mroonga
+Section: database
+Architecture: any
+Replaces: mysql-server-groonga (<< 1.10-1)
+Breaks: mysql-server-groonga (<< 1.10-1)
+Depends:
+ ${misc:Depends},
+ ${shlibs:Depends},
+ libgroonga0 (>= @REQUIRED_GROONGA_VERSION@),
+ mysql-server (= MYSQL_VERSION),
+ groonga-normalizer-mysql
+Description: A fast fulltext searchable storage engine for MySQL.
+ Mroonga is a fast fulltext searchable storage engine for MySQL.
+ It is based on Groonga, a fast fulltext search engine and column store.
+ Groonga is good at real time update.
+ .
+ This package provides a MySQL storage engine as a shared library.
+ This provides "mroonga" storage engine. It means you can use
+ "ENGINE = mroonga" in "CREATE TABLE".
+
+Package: mysql-server-mroonga-doc
+Section: doc
+Architecture: all
+Replaces: mysql-server-groonga-doc (<< 1.10-1)
+Breaks: mysql-server-groonga-doc (<< 1.10-1)
+Depends:
+ ${misc:Depends}
+Description: Documentation of Mroonga.
+ Mroonga is a fast fulltext searchable storage engine for MySQL.
+ It is based on Groonga, a fast fulltext search engine and column store.
+ Groonga is good at real time update.
+ .
+ This package provides documentation of Mroonga.
diff --git a/storage/mroonga/packages/debian/copyright b/storage/mroonga/packages/debian/copyright
new file mode 100644
index 00000000000..bb41984e8e4
--- /dev/null
+++ b/storage/mroonga/packages/debian/copyright
@@ -0,0 +1,27 @@
+This work was packaged for Debian by:
+
+ Kouhei Sutou <kou@clear-code.com> on Thu, 02 Sep 2010 13:51:56 +0900.
+
+It was downloaded:
+
+ <http://github.com/mroonga/mroonga/downloads>
+
+Upstream Author(s):
+
+ Tetsuro IKEDA <ikdttr at gmail.com>
+ Daijiro MORI <morita at razil. jp>
+ Tasuku SUENAGA <a at razil. jp>
+ Kouhei Sutou <kou at clear-code. com>
+
+Copyright:
+
+ Copyright(C) 2009-2010 Tetsuro IKEDA
+
+License:
+
+ LGPLv2.1
+
+ See `/usr/share/common-licenses/LGPL-2.1'.
+
+The Debian packaging is done by Kouhei Sutou <kou@clear-code.com> in 2010,
+and put into public domain, anyone can use it for any purpose.
diff --git a/storage/mroonga/packages/debian/mysql-server-mroonga-doc.install b/storage/mroonga/packages/debian/mysql-server-mroonga-doc.install
new file mode 100644
index 00000000000..ad2e27ef7dd
--- /dev/null
+++ b/storage/mroonga/packages/debian/mysql-server-mroonga-doc.install
@@ -0,0 +1 @@
+usr/share/doc/mysql-server-mroonga-doc/
diff --git a/storage/mroonga/packages/debian/mysql-server-mroonga.install b/storage/mroonga/packages/debian/mysql-server-mroonga.install
new file mode 100644
index 00000000000..03f64cfedb4
--- /dev/null
+++ b/storage/mroonga/packages/debian/mysql-server-mroonga.install
@@ -0,0 +1,3 @@
+usr/lib/mysql/plugin/ha_mroonga.so*
+usr/share/mroonga/*
+debian/apparmor/mysql-server-mroonga etc/apparmor.d/abstractions/
diff --git a/storage/mroonga/packages/debian/mysql-server-mroonga.postinst b/storage/mroonga/packages/debian/mysql-server-mroonga.postinst
new file mode 100755
index 00000000000..9a3db8784a2
--- /dev/null
+++ b/storage/mroonga/packages/debian/mysql-server-mroonga.postinst
@@ -0,0 +1,72 @@
+#! /bin/sh
+
+set -e
+
+prevver="$2"
+
+install_plugin() {
+ cat /usr/share/mroonga/install.sql | \
+ mysql --defaults-file=/etc/mysql/debian.cnf || true
+}
+
+install_apparmor() {
+ mysql_apparmor_profile_name=usr.sbin.mysqld
+ mysql_apparmor_profile=/etc/apparmor.d/${mysql_apparmor_profile_name}
+ mysql_local_apparmor_profile=/etc/apparmor.d/local/${mysql_apparmor_profile_name}
+ apparmor_profile_name=mysql-server-mroonga
+ include_profile="#include <abstractions/${apparmor_profile_name}>"
+ local_apparmor_profile=/etc/apparmor.d/local/${apparmor_profile_name}
+ if test -f "${mysql_local_apparmor_profile}"; then
+ if ! grep -q "${include_profile}" "${mysql_local_apparmor_profile}"; then
+ echo >> "${mysql_local_apparmor_profile}"
+ echo "${include_profile}" >> "${mysql_local_apparmor_profile}"
+ fi
+ else
+ mysql_abstraction_apparmor_profile=/etc/apparmor.d/abstractions/mysql
+ mysql_plugin_dir=/usr/lib/mysql/plugin
+ if test -f "${mysql_abstraction_apparmor_profile}" && \
+ ! grep -q "${mysql_plugin_dir}" \
+ "${mysql_abstraction_apparmor_profile}"; then
+ # For Lucid.
+ cat <<EOF >> "${mysql_abstraction_apparmor_profile}"
+
+# ${apparmor_profile_name}: START
+# Added by mysql-server-mroonga.
+${mysql_plugin_dir}/ r,
+${mysql_plugin_dir}/*.so* mr,
+${include_profile}
+# ${apparmor_profile_name}: END
+EOF
+ fi
+ fi
+
+ if ! test -e "$local_apparmor_profile"; then
+ mkdir -p $(dirname "$local_apparmor_profile")
+ cat <<EOF > "$local_apparmor_profile"
+# Site-specific additions and overrides for ${apparmor_profile_name}.
+# For more details, please see /etc/apparmor.d/local/README.
+EOF
+ fi
+
+ if aa-status --enabled 2>/dev/null; then
+ apparmor_parser -r -T -W "${mysql_apparmor_profile}" || true
+ fi
+
+ true
+}
+
+case "$1" in
+ configure)
+ install_apparmor
+ install_plugin
+ ;;
+ abort-upgrade|abort-deconfigure|abort-remove)
+ :
+ ;;
+ *)
+ echo "Called with unknown argument $1, bailing out."
+ exit 1
+ ;;
+esac
+
+#DEBHELPER#
diff --git a/storage/mroonga/packages/debian/mysql-server-mroonga.postrm b/storage/mroonga/packages/debian/mysql-server-mroonga.postrm
new file mode 100755
index 00000000000..84d7f1ef4ab
--- /dev/null
+++ b/storage/mroonga/packages/debian/mysql-server-mroonga.postrm
@@ -0,0 +1,38 @@
+#! /bin/sh
+
+set -e
+
+if [ "$1" = "purge" ]; then
+ mysql_apparmor_profile_name=usr.sbin.mysqld
+ mysql_apparmor_profile=/etc/apparmor.d/${mysql_apparmor_profile_name}
+ mysql_local_apparmor_profile=/etc/apparmor.d/local/${mysql_apparmor_profile_name}
+ mysql_abstraction_apparmor_profile=/etc/apparmor.d/abstractions/mysql
+ apparmor_profile_name=mysql-server-mroonga
+ if test -f "${mysql_local_apparmor_profile}"; then
+ include_profile="#include <abstractions/${apparmor_profile_name}>"
+ if grep -q "${include_profile}" "${mysql_local_apparmor_profile}"; then
+ sed -i'' -e "s,${include_profile},," \
+ "${mysql_local_apparmor_profile}"
+ fi
+ else
+ start_marker_re="^# ${apparmor_profile_name}: START$"
+ end_marker_re="^# ${apparmor_profile_name}: END$"
+ if test -f "${mysql_abstraction_apparmor_profile}" && \
+ grep -q "${start_marker_re}" \
+ "${mysql_abstraction_apparmor_profile}"; then
+ sed -i'' -e "/${start_marker_re}/,/${end_marker_re}/d" \
+ "${mysql_abstraction_apparmor_profile}"
+ fi
+ fi
+
+ rm -f "/etc/apparmor.d/local/${apparmor_profile_name}" || true
+ rmdir /etc/apparmor.d/local 2>/dev/null || true
+
+ if aa-status --enabled 2>/dev/null; then
+ apparmor_parser -r -T -W "${mysql_apparmor_profile}" || true
+ fi
+fi
+
+#DEBHELPER#
+
+exit 0
diff --git a/storage/mroonga/packages/debian/mysql-server-mroonga.prerm b/storage/mroonga/packages/debian/mysql-server-mroonga.prerm
new file mode 100755
index 00000000000..7fad990d75f
--- /dev/null
+++ b/storage/mroonga/packages/debian/mysql-server-mroonga.prerm
@@ -0,0 +1,10 @@
+#! /bin/sh
+
+set -e
+
+cat /usr/share/mroonga/uninstall.sql | \
+ mysql --defaults-file=/etc/mysql/debian.cnf || true
+
+#DEBHELPER#
+
+exit 0
diff --git a/storage/mroonga/packages/debian/rules b/storage/mroonga/packages/debian/rules
new file mode 100755
index 00000000000..2a397b333e1
--- /dev/null
+++ b/storage/mroonga/packages/debian/rules
@@ -0,0 +1,39 @@
+#!/usr/bin/make -f
+# -*- makefile-gmake -*-
+#
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+# This has to be exported to make some magic below work.
+export DH_OPTIONS
+
+export MYSQL_VERSION := $(shell apt-cache show mysql-server-5.5 | grep Version | head -n 1 | awk '{print $$2}' | awk -F '-' '{print $$1}')
+
+%:
+ dh $@
+
+override_dh_auto_configure:
+ path=main/m/mysql-5.5/mysql-5.5_$(MYSQL_VERSION).orig.tar.gz; \
+ if [ "$$(lsb_release --id --short)" = "Ubuntu" ]; then \
+ base_url=http://archive.ubuntu.com/ubuntu/pool; \
+ security_base_url=http://security.ubuntu.com/ubuntu/pool; \
+ else \
+ base_url=http://ftp.debian.org/debian/pool; \
+ security_base_url=http://security.debian.org/pool/updates; \
+ fi; \
+ wget $${security_base_url}/$${path} || \
+ wget $${base_url}/$${path}
+ tar xf mysql-5.5_$(MYSQL_VERSION).orig.tar.gz
+ dh_auto_configure -- --with-mysql-source=./mysql-$(MYSQL_VERSION)
+
+# disable 'make check'.
+override_dh_auto_test:
+
+override_dh_install:
+ mv debian/tmp/usr/share/doc/mroonga/ \
+ debian/tmp/usr/share/doc/mysql-server-mroonga-doc/
+ dh_install
+# if test -x /usr/bin/dh_apparmor; then \
+# dh_apparmor \
+# -pmysql-server-mroonga \
+# --profile-name=usr.lib.mysql.plugin.ha_mroonga; \
+# fi
diff --git a/storage/mroonga/packages/rpm/Makefile.am b/storage/mroonga/packages/rpm/Makefile.am
new file mode 100644
index 00000000000..aa1ba3ad9c6
--- /dev/null
+++ b/storage/mroonga/packages/rpm/Makefile.am
@@ -0,0 +1,2 @@
+SUBDIRS = \
+ centos
diff --git a/storage/mroonga/packages/rpm/centos/Makefile.am b/storage/mroonga/packages/rpm/centos/Makefile.am
new file mode 100644
index 00000000000..e7b22cfa025
--- /dev/null
+++ b/storage/mroonga/packages/rpm/centos/Makefile.am
@@ -0,0 +1,9 @@
+EXTRA_DIST = \
+ mysql55-mroonga.spec.in \
+ mysql56-community-mroonga.spec.in \
+ mariadb-mroonga.spec.in
+
+noinst_DATA = \
+ mysql55-mroonga.spec \
+ mysql56-community-mroonga.spec \
+ mariadb-mroonga.spec
diff --git a/storage/mroonga/packages/rpm/centos/mariadb-mroonga.spec.in b/storage/mroonga/packages/rpm/centos/mariadb-mroonga.spec.in
new file mode 100644
index 00000000000..ca48e59aaec
--- /dev/null
+++ b/storage/mroonga/packages/rpm/centos/mariadb-mroonga.spec.in
@@ -0,0 +1,402 @@
+%define mariadb_epoch_default 1
+%define mariadb_version_default 5.5.41
+%define mariadb_release_default 2
+%define mariadb_dist_default .el7_0
+%define mariadb_download_base_url_default http://vault.centos.org/7.1.1503/os/Source/SPackages
+%define mariadb_spec_file_default mariadb.spec
+
+%{!?mariadb_epoch:%define mariadb_epoch %{mariadb_epoch_default}}
+%{!?mariadb_version:%define mariadb_version %{mariadb_version_default}}
+%{!?mariadb_release:%define mariadb_release %{mariadb_release_default}}
+%{!?mariadb_dist:%define mariadb_dist %{mariadb_dist_default}}
+%{!?mariadb_download_base_url:%define mariadb_download_base_url %{mariadb_download_base_url_default}}
+%{!?mariadb_spec_file:%define mariadb_spec_file %{mariadb_spec_file_default}}
+
+%define mariadb_package_version %{mariadb_epoch}:%{mariadb_version}-%{mariadb_release}%{mariadb_dist}
+
+%define groonga_required_version @REQUIRED_GROONGA_VERSION@
+
+Name: mariadb-mroonga
+Version: @VERSION@
+Release: 1%{?dist}
+Summary: A fast fulltext searchable storage engine for MariaDB
+
+Group: Applications/Databases
+License: LGPLv2.1
+URL: http://mroonga.org/
+Source0: http://packages.groonga.org/source/mroonga/mroonga-%{version}.tar.gz
+
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-%(%{__id_u} -n)
+BuildRequires: groonga-devel >= %{groonga_required_version}
+BuildRequires: groonga-normalizer-mysql-devel
+BuildRequires: wget
+BuildRequires: mariadb-devel = %{mariadb_package_version}
+Requires: mariadb-server = %{mariadb_package_version}
+Requires: mariadb = %{mariadb_package_version}
+Requires: groonga-libs >= %{groonga_required_version}
+Requires: groonga-normalizer-mysql
+
+%description
+Mroonga is a fast fulltext searchable storage plugin for MariaDB.
+It is based on Groonga that is a fast fulltext search engine and
+column store. Groonga is good at real-time update.
+
+%package doc
+Summary: Documentation for Mroonga
+Group: Documentation
+License: LGPLv2.1
+
+%description doc
+Documentation for Mroonga
+
+
+%prep
+%setup -q -n mroonga-%{version}
+
+mariadb_full_version=%{mariadb_version}-%{mariadb_release}%{mariadb_dist}
+srpm=mariadb-${mariadb_full_version}.src.rpm
+if [ ! -f ../../SRPMS/$srpm ]; then
+ wget --continue -O ../../SRPMS/$srpm %{mariadb_download_base_url}/$srpm
+ rpm -Uvh ../../SRPMS/$srpm
+ rm ../../SRPMS/$srpm
+fi
+
+%build
+mariadb_source=../mariadb-%{mariadb_version}
+if [ ! -d ${mariadb_source} ]; then
+ rpmbuild -bc \
+ --define 'runselftest 0' \
+ --define 'optflags -O0' \
+ ../../SPECS/%{mariadb_spec_file}
+fi
+%configure \
+ --disable-static \
+ --with-mysql-source=${mariadb_source} \
+ %{?mroonga_configure_options}
+make %{?_smp_mflags}
+
+
+%install
+rm -rf $RPM_BUILD_ROOT
+make install DESTDIR=$RPM_BUILD_ROOT
+rm $RPM_BUILD_ROOT%{_libdir}/mysql/plugin/*.la
+mv $RPM_BUILD_ROOT%{_datadir}/doc/mroonga/ mysql-mroonga-doc/
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post
+if /usr/bin/mysql -u root -e "quit"; then
+ password_option=""
+else
+ password_option="-p"
+fi
+current_version=0
+version=$(echo %{groonga_required_version} | sed -e 's/\.//g')
+required_version=$(expr $version)
+version=$(/usr/bin/mysql -e "SHOW VARIABLES LIKE 'mroonga_libgroonga_version'" | \
+ grep mroonga | cut -f 2 | sed -e 's/\.//g')
+if [ -n "$version" ]; then
+ current_version=$(expr $version)
+fi
+install_sql=%{_datadir}/mroonga/install.sql
+uninstall_sql=%{_datadir}/mroonga/uninstall.sql
+
+if [ "$1" = 2 ] ; then
+ if [ $current_version -lt $required_version ]; then
+ command="/usr/bin/mysql -u root $password_option"
+ echo "run the following command after restarting MySQL server:";
+ echo " $command < ${uninstall_sql}"
+ echo " $command < ${install_sql}"
+ exit 0
+ else
+ command="/usr/bin/mysql -u root $password_option"
+ command="${command} < ${uninstall_sql}"
+ echo $command
+ eval $command || \
+ (echo "run the following command to unregister Mroonga:"; \
+ echo " $command")
+ fi
+fi
+
+command="/usr/bin/mysql -u root $password_option < ${install_sql}"
+echo $command
+eval $command || \
+ (echo "run the following command to register Mroonga:"; \
+ echo " $command")
+
+%preun
+uninstall_sql=%{_datadir}/mroonga/uninstall.sql
+
+if mysql -u root -e "quit"; then
+ password_option=""
+else
+ password_option="-p"
+fi
+if [ "$1" = 0 ]; then
+ command="/usr/bin/mysql -u root $password_option < ${uninstall_sql}"
+ echo $command
+ eval $command || \
+ (echo "run the following command to unregister Mroonga:"; \
+ echo " $command")
+fi
+
+%files
+%defattr(-,root,root,-)
+%{_libdir}/mysql/plugin/
+%{_datadir}/mroonga/*
+%{_datadir}/man/man1/*
+%{_datadir}/man/*/man1/*
+
+%files doc
+%defattr(-,root,root,-)
+%doc README COPYING
+%doc mysql-mroonga-doc/*
+
+%changelog
+* Wed Apr 29 2015 HAYASHI Kentaro <hayashi@clear-code.com> - 5.02-1
+- new upstream release.
+
+* Sun Mar 29 2015 HAYASHI Kentaro <hayashi@clear-code.com> - 5.01-1
+- new upstream release.
+
+* Mon Feb 09 2015 <hayashi@clear-code.com> - 5.00-1
+- new upstream release.
+
+* Thu Jan 29 2015 HAYASHI Kentaro <hayashi@clear-code.com> - 4.10-1
+- new upstream release.
+
+* Wed Jan 14 2015 HAYASHI Kentaro <hayashi@clear-code.com> - 4.09-2
+- build against mariadb-5.5.40-2.el7_0.
+
+* Mon Dec 29 2014 Kouhei Sutou <kou@cozmixng.org> - 4.09-1
+- new upstream release.
+
+* Sat Nov 29 2014 HAYASHI Kentaro <hayashi@clear-code.com> - 4.08-1
+- new upstream release.
+
+* Wed Oct 29 2014 Kouhei Sutou <kou@clear-code.com> - 4.07-1
+- new upstream release.
+
+* Mon Sep 29 2014 Kouhei Sutou <kou@clear-code.com> - 4.06-1
+- new upstream release.
+
+* Fri Aug 29 2014 Kouhei Sutou <kou@clear-code.com> - 4.05-1
+- new upstream release.
+
+* Thu Aug 14 2014 Kouhei Sutou <kou@clear-code.com> - 4.04-4
+- build MariaDB for libmysqlservices.a.
+
+* Thu Aug 14 2014 Kouhei Sutou <kou@clear-code.com> - 4.04-3
+- support epoch in MariaDB.
+
+* Wed Aug 13 2014 Kouhei Sutou <kou@clear-code.com> - 4.04-2
+- build against mariadb-5.5.37-1.el7_0.
+
+* Sun Aug 10 2014 Kouhei Sutou <kou@clear-code.com> - 4.04-1
+- initial packaging for CentOS 7 based on mysql-mroogna package.
+
+* Tue Jul 29 2014 HAYASHI Kentaro <hayashi@clear-code.com> - 4.04-1
+- new upstream release.
+
+* Thu May 29 2014 Kouhei Sutou <kou@clear-code.com> - 4.03-1
+- new upstream release.
+
+* Tue Apr 29 2014 Kouhei Sutou <kou@clear-code.com> - 4.02-1
+- new upstream release.
+
+* Sat Mar 29 2014 HAYASHI Kentaro <hayashi@clear-code.com> - 4.01-1
+- new upstream release.
+
+* Thu Feb 13 2014 HAYASHI Kentaro <hayashi@clear-code.com> - 4.00-2
+- use MySQL 5.1.73-3 on CentOS 6.
+
+* Sun Feb 09 2014 HAYASHI Kentaro <hayashi@clear-code.com> - 4.00-1
+- new upstream release.
+
+* Wed Jan 29 2014 HAYASHI Kentaro <hayashi@clear-code.com> - 3.12-1
+- new upstream release.
+
+* Sun Dec 29 2013 HAYASHI Kentaro <hayashi@clear-code.com> - 3.11-1
+- new upstream release.
+
+* Sat Dec 7 2013 HAYASHI Kentaro <hayashi@clear-code.com> - 3.10-2
+- use MySQL 5.1.71-1 on CentOS 6.
+
+* Fri Nov 29 2013 HAYASHI Kentaro <hayashi@clear-code.com> - 3.10-1
+- new upstream release.
+
+* Tue Oct 29 2013 HAYASHI Kentaro <hayashi@clear-code.com> - 3.09-1
+- new upstream release.
+
+* Sun Sep 29 2013 HAYASHI Kentaro <hayashi@clear-code.com> - 3.08-1
+- new upstream release.
+- use MySQL 5.6.14-1 on CentOS 5.
+
+* Wed Sep 4 2013 HAYASHI Kentaro <hayashi@clear-code.com> - 3.07-2
+- fix a bug that mroonga is removed accidentally on upgrade #1918.
+ Reported by @ceekz. Thanks!!!
+
+* Thu Aug 29 2013 HAYASHI Kentaro <hayashi@clear-code.com> - 3.07-1
+- new upstream release.
+- use MySQL 5.6.13-1 on CentOS 5.
+
+* Mon Jul 29 2013 HAYASHI Kentaro <hayashi@clear-code.com> - 3.06-1
+- new upstream release.
+- use MySQL 5.6.12-2 on CentOS 5.
+
+* Sat Jun 29 2013 HAYASHI Kentaro <hayashi@clear-code.com> - 3.05-1
+- new upstream release.
+- use MySQL 5.6.12 on CentOS 5.
+
+* Wed May 29 2013 HAYASHI Kentaro <hayashi@clear-code.com> - 3.04-1
+- new upstream release.
+
+* Fri May 10 2013 HAYASHI Kentaro <hayashi@clear-code.com> - 3.03-2
+- use MySQL 5.6.11-2 on CentOS 5. see http://bugs.mysql.com/bug.php?id=69027
+ Reported by Y.Kentaro. Thanks!!!
+
+* Mon Apr 29 2013 HAYASHI Kentaro <hayashi@clear-code.com> - 3.03-1
+- new upstream release.
+
+* Fri Mar 29 2013 HAYASHI Kentaro <hayashi@clear-code.com> - 3.02-0
+- new upstream release.
+
+* Thu Feb 28 2013 HAYASHI Kentaro <hayashi@clear-code.com> - 3.01-0
+- new upstream release.
+
+* Sat Feb 09 2013 HAYASHI Kentaro <hayashi@clear-code.com> - 3.00-0
+- new upstream release.
+- require groonga 3.0.0 or later
+
+* Tue Feb 05 2013 HAYASHI Kentaro <hayashi@clear-code.com> - 2.10-2
+- use MySQL 5.1.67-1 on CentOS 6.
+ Reported by wakisuke.ua. Thanks!!!
+
+* Sat Dec 29 2012 HAYASHI Kentaro <hayashi@clear-code.com> - 2.10-0
+- new upstream release.
+
+* Mon Dec 10 2012 HAYASHI Kentaro <hayashi@clear-code.com> - 2.09-1
+- use MySQL 5.1.66-2 on CentOS 6.
+ Reported by wakisuke.ua. Thanks!!!
+
+* Thu Nov 29 2012 HAYASHI Kentaro <hayashi@clear-code.com> - 2.09-0
+- new upstream release.
+- use MySQL 5.5.28 on CentOS 5.
+- use MySQL 5.1.66 on CentOS 6.
+
+* Mon Oct 29 2012 HAYASHI Kentaro <hayashi@clear-code.com> - 2.08-0
+- new upstream release.
+- add missing "DROP FUNCTION mroonga_snippet".
+ Reported by @tokuhy. Thanks!!!
+
+* Sat Sep 29 2012 HAYASHI Kentaro <hayashi@clear-code.com> - 2.07-0
+- new upstream release.
+
+* Wed Aug 29 2012 Kouhei Sutou <kou@clear-code.com> - 2.06-0
+- new upstream release.
+- make MySQL spec file name customizable.
+- make mroonga configure options customizable.
+- add missing mysql-devel BuildRequires. Reported by wing. Thanks!!!
+- use MySQL 5.5.27.
+
+* Sun Jul 29 2012 HAYASHI Kentaro <hayashi@clear-code.com> - 2.05-0
+- new upstream release.
+- use MySQL 5.5.25a.
+
+* Fri Jun 29 2012 Kouhei Sutou <kou@clear-code.com> - 2.04-0
+- new upstream release.
+- ensure deleting mroonga plugin before install.
+ Suggested by Kazuhiro Isobe. Thanks!!!
+- use MySQL 5.5.25.
+
+* Tue May 29 2012 Kouhei Sutou <kou@clear-code.com> - 2.03-0
+- new upstream release.
+- use MySQL 5.5.24.
+- make mysql_* variables customizable
+- require groonga 2.0.3 or later.
+
+* Sun Apr 29 2012 Kouhei Sutou <kou@clear-code.com> - 2.02-0
+- new upstream release.
+- use MySQL 5.5.23.
+- require groonga 2.0.2 or later.
+
+* Thu Mar 29 2012 Kouhei Sutou <kou@clear-code.com> - 2.01-0
+- new upstream release.
+- ensure plugin is uninstalled by closing all tables use mroonga.
+
+* Wed Feb 29 2012 Kouhei Sutou <kou@clear-code.com> - 2.00-0
+- new upstream release.
+- always install/uninstall plugin.
+- use MySQL 5.1.61 and 5.5.21.
+- require groonga 2.0.0 or later.
+
+* Sun Jan 29 2012 Kouhei Sutou <kou@clear-code.com> - 1.20-0
+- new upstream release.
+- require groonga 1.3.0.
+- groonga -> mroonga.
+- use MySQL 5.5.20.
+
+* Thu Dec 29 2011 Kouhei Sutou <kou@clear-code.com> - 1.11-0
+- new upstream release.
+
+* Sat Oct 29 2011 Kouhei Sutou <kou@clear-code.com> - 1.10-0
+- new upstream release.
+- groonga storage engine -> mroonga.
+
+* Thu Sep 29 2011 Kouhei Sutou <kou@clear-code.com> - 1.0.0-0
+- new upstream release.
+
+* Mon Aug 29 2011 Kouhei Sutou <kou@clear-code.com> - 0.9-0
+- new upstream release.
+
+* Fri Jul 29 2011 Kouhei Sutou <kou@clear-code.com> - 0.8-0
+- new upstream release.
+
+* Wed Jun 29 2011 Kouhei Sutou <kou@clear-code.com> - 0.7-0
+- new upstream release.
+
+* Sun May 29 2011 Kouhei Sutou <kou@clear-code.com> - 0.6-0
+- new upstream release.
+
+* Tue May 17 2011 Kouhei Sutou <kou@clear-code.com> - 0.5-2
+- use MySQL 5.5.12.
+
+* Tue Mar 29 2011 Kouhei Sutou <kou@clear-code.com> - 0.5-1
+- new upstream release.
+
+* Sat Jan 29 2011 Kouhei Sutou <kou@clear-code.com> - 0.4-4
+- do not remove plugin on upgrade.
+
+* Wed Jan 12 2011 Kouhei Sutou <kou@clear-code.com> - 0.4-3
+- rebuild without debug symbol.
+
+* Thu Dec 30 2010 Kouhei Sutou <kou@clear-code.com> - 0.4-2
+- use MySQL 5.5.8-1.
+- fix SQL literal notation.
+
+* Mon Nov 29 2010 Kouhei Sutou <kou@clear-code.com> - 0.4-1
+- use the latest MySQL.
+- new upstream release.
+
+* Sun Nov 21 2010 Kouhei Sutou <kou@clear-code.com> - 0.3-2
+- install user define function.
+
+* Fri Oct 29 2010 Kouhei Sutou <kou@clear-code.com> - 0.3-1
+- new upstream release.
+
+* Fri Oct 08 2010 Kouhei Sutou <kou@clear-code.com> - 0.2-2
+- specify target MySQL version.
+- use %{version}.
+
+* Wed Sep 29 2010 Kouhei Sutou <kou@clear-code.com> - 0.2-1
+- new upstream release.
+
+* Sun Sep 12 2010 Kouhei Sutou <kou@clear-code.com> - 0.1-3
+- require MySQL-client-community.
+
+* Fri Sep 10 2010 Kouhei Sutou <kou@clear-code.com> - 0.1-2
+- use MySQL-devel-community.
+
+* Fri Sep 03 2010 Kouhei Sutou <kou@clear-code.com> - 0.1-1
+- initial packaging for CentOS.
diff --git a/storage/mroonga/packages/rpm/centos/mysql55-mroonga.spec.in b/storage/mroonga/packages/rpm/centos/mysql55-mroonga.spec.in
new file mode 100644
index 00000000000..1fc641b9bca
--- /dev/null
+++ b/storage/mroonga/packages/rpm/centos/mysql55-mroonga.spec.in
@@ -0,0 +1,224 @@
+%{?scl:%scl_package mroonga}
+%{!?scl:%global pkg_name %{name}}
+%{!?centos_ver:%define centos_ver 5}
+
+%if %{centos_ver} == 6
+%define mysql_version_default 5.5.41
+%define mysql_release_default 2
+%define mysql_dist_default el6.centos.alt
+%define mysql_download_base_url_default http://vault.centos.org/6.6/SCL/Source/SPackages
+%define mysql_spec_file_default mysql.spec
+%else
+%define mysql_version_default 5.5.40
+%define mysql_release_default 2
+%define mysql_dist_default el5
+%define mysql_download_base_url_default http://vault.centos.org/5.11/updates/SRPMS
+%define mysql_spec_file_default mysql.spec
+%endif
+
+%{!?mysql_version:%define mysql_version %{mysql_version_default}}
+%{!?mysql_release:%define mysql_release %{mysql_release_default}}
+%{!?mysql_dist:%define mysql_dist %{mysql_dist_default}}
+%{!?mysql_download_base_url:%define mysql_download_base_url %{mysql_download_base_url_default}}
+%{!?mysql_spec_file:%define mysql_spec_file %{mysql_spec_file_default}}
+
+%define groonga_required_version @REQUIRED_GROONGA_VERSION@
+
+Name: %{?scl_prefix}mroonga
+Version: @VERSION@
+Release: 1%{?dist}
+Summary: A fast fulltext searchable storage engine for MySQL
+
+Group: Applications/Databases
+License: LGPLv2.1
+URL: http://mroonga.org/
+Source0: http://packages.groonga.org/source/mroonga/mroonga-%{version}.tar.gz
+
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-%(%{__id_u} -n)
+BuildRequires: groonga-devel >= %{groonga_required_version}
+BuildRequires: groonga-normalizer-mysql-devel
+BuildRequires: wget
+BuildRequires: which
+BuildRequires: mysql55-mysql-devel = %{mysql_version}-%{mysql_release}.%{mysql_dist}
+BuildRequires: mysql55-build
+Requires: mysql55-mysql-server = %{mysql_version}-%{mysql_release}.%{mysql_dist}
+Requires: mysql55-mysql = %{mysql_version}-%{mysql_release}.%{mysql_dist}
+Requires: groonga-libs >= %{groonga_required_version}
+Requires: groonga-normalizer-mysql
+%{?scl:Requires: %scl_runtime}
+
+%description
+Mroonga is a fast fulltext searchable storage plugin for MySQL.
+It is based on Groonga that is a fast fulltext search engine and
+column store. Groonga is good at real-time update.
+
+%package doc
+Summary: Documentation for Mroonga
+Group: Documentation
+License: LGPLv2.1
+
+%description doc
+Documentation for Mroonga
+
+
+%prep
+%setup -q -n %{pkg_name}-%{version}
+
+mysql_full_version=%{mysql_version}-%{mysql_release}.%{mysql_dist}
+srpm=mysql55-mysql-${mysql_full_version}.src.rpm
+if [ ! -f ../../SRPMS/$srpm ]; then
+ wget --continue -O ../../SRPMS/$srpm %{mysql_download_base_url}/$srpm
+ rpm -Uvh ../../SRPMS/$srpm
+fi
+
+%build
+mysql_source=../mysql-%{mysql_version}
+if [ ! -d ${mysql_source} ]; then
+ specs_dir=
+ MYSQL_RPMBUILD_TEST=no rpmbuild -bp \
+ --define 'runselftest 0' \
+ --define 'optflags -O0' \
+ ../../SPECS/%{mysql_spec_file}
+fi
+%configure --disable-static --with-mysql-source=${mysql_source} \
+ --disable-fast-mutexes \
+ --with-mysql-config=`scl enable mysql55 'which mysql_config'` \
+ %{?mroonga_configure_options}
+make %{?_smp_mflags}
+
+%install
+rm -rf $RPM_BUILD_ROOT
+make install DESTDIR=$RPM_BUILD_ROOT
+rm $RPM_BUILD_ROOT%{_libdir}/mysql/plugin/*.la
+mv $RPM_BUILD_ROOT%{_datadir}/doc/mroonga/ mysql-mroonga-doc/
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post
+mysql_command=`scl enable mysql55 'which mysql'`
+password_option=""
+$mysql_command -u root -e "quit"
+if [ $? -ne 0 ]; then
+ password_option="-p"
+fi
+current_version=0
+version=`echo %{groonga_required_version} | sed -e 's/\.//g'`
+required_version=`expr $version`
+version=`$mysql_command -e "SHOW VARIABLES LIKE 'mroonga_libgroonga_version'" | \
+ grep mroonga | cut -f 2 | sed -e 's/\.//g'`
+if [ -n "$version" ]; then
+ current_version=`expr $version`
+fi
+install_sql=%{_datadir}/mroonga/install.sql
+uninstall_sql=%{_datadir}/mroonga/uninstall.sql
+
+if [ "$1" = 2 ] ; then
+ if [ $current_version -lt $required_version ]; then
+ command="$mysql_command -u root $password_option"
+ echo "run the following command after restarting MySQL server:";
+ echo " $command < ${uninstall_sql}"
+ echo " $command < ${install_sql}"
+ exit 0
+ else
+ command="$mysql_command -u root $password_option < ${uninstall_sql}"
+ echo $command
+ eval $command || \
+ (echo "run the following command to unregister Mroonga:"; \
+ echo " $command")
+ fi
+fi
+command="$mysql_command -u root $password_option < ${install_sql}"
+echo $command
+eval $command || \
+ (echo "run the following command to register Mroonga:"; \
+ echo " $command")
+
+%preun
+uninstall_sql=%{_datadir}/mroonga/uninstall.sql
+mysql_command=`scl enable mysql55 'which mysql'`
+if $mysql_command -u root -e "quit"; then
+ password_option=""
+else
+ password_option="-p"
+fi
+if [ "$1" = 0 ]; then
+ command="$mysql_command -u root $password_option < ${uninstall_sql}"
+ echo $command
+ eval $command || \
+ (echo "run the following command to unregister Mroonga:"; \
+ echo " $command")
+fi
+
+%files
+%defattr(-,root,root,-)
+%{_libdir}/mysql/plugin/
+%{_datadir}/mroonga/*
+%{_datadir}/man/man1/*
+%{_datadir}/man/*/man1/*
+
+%files doc
+%defattr(-,root,root,-)
+%doc README COPYING
+%doc mysql-mroonga-doc/*
+
+%changelog
+* Wed Apr 29 2015 HAYASHI Kentaro <hayashi@clear-code.com> - 5.02-1
+- new upstream release.
+
+* Sun Mar 29 2015 HAYASHI Kentaro <hayashi@clear-code.com> - 5.01-1
+- new upstream release.
+
+* Mon Feb 09 2015 <hayashi@clear-code.com> - 5.00-1
+- new upstream release.
+
+* Thu Jan 29 2015 HAYASHI Kentaro <hayashi@clear-code.com> - 4.10-1
+- new upstream release.
+
+* Mon Dec 29 2014 Kouhei Sutou <kou@cozmixng.org> - 4.09-1
+- new upstream release.
+
+* Sat Nov 29 2014 HAYASHI Kentaro <hayashi@clear-code.com> - 4.08-1
+- new upstream release.
+
+* Wed Oct 29 2014 Kouhei Sutou <kou@clear-code.com> - 4.07-1
+- new upstream release.
+
+* Mon Sep 29 2014 Kouhei Sutou <kou@clear-code.com> - 4.06-1
+- new upstream release.
+
+* Fri Aug 29 2014 Kouhei Sutou <kou@clear-code.com> - 4.05-1
+- new upstream release.
+
+* Tue Jul 29 2014 HAYASHI Kentaro <hayashi@clear-code.com> - 4.04-1
+- new upstream release.
+
+* Thu May 29 2014 Kouhei Sutou <kou@clear-code.com> - 4.03-2
+- build against MySQL 5.6.37. Reported by YOSHIDA Mitsuo. Thanks!!!
+
+* Thu May 29 2014 Kouhei Sutou <kou@clear-code.com> - 4.03-1
+- new upstream release.
+
+* Tue Apr 29 2014 Kouhei Sutou <kou@clear-code.com> - 4.02-1
+- new upstream release.
+
+* Sat Mar 29 2014 HAYASHI Kentaro <hayashi@clear-code.com> - 4.01-1
+- new upstream release.
+
+* Thu Mar 06 2014 HAYASHI Kentaro <hayashi@clear-code.com> - 4.00-2
+- use MySQL 5.5.36 on CentOS 5.
+
+* Sun Feb 09 2014 HAYASHI Kentaro <hayashi@clear-code.com> - 4.00-1
+- new upstream release.
+
+* Wed Jan 29 2014 HAYASHI Kentaro <hayashi@clear-code.com> - 3.12-1
+- new upstream release.
+
+* Sun Dec 29 2013 HAYASHI Kentaro <hayashi@clear-code.com> - 3.11-1
+- new upstream release.
+
+* Fri Nov 29 2013 HAYASHI Kentaro <hayashi@clear-code.com> - 3.10-1
+- new upstream release.
+
+* Tue Oct 29 2013 HAYASHI Kentaro <hayashi@clear-code.com> - 3.09-1
+- initial packaging for MySQL 5.5 on CentOS 5.
diff --git a/storage/mroonga/packages/rpm/centos/mysql56-community-mroonga.spec.in b/storage/mroonga/packages/rpm/centos/mysql56-community-mroonga.spec.in
new file mode 100644
index 00000000000..53759e0c778
--- /dev/null
+++ b/storage/mroonga/packages/rpm/centos/mysql56-community-mroonga.spec.in
@@ -0,0 +1,231 @@
+%{!?centos_ver:%define centos_ver 6}
+
+%if %{centos_ver} == 7
+%define mysql_version_default 5.6.24
+%define mysql_release_default 3
+%define mysql_dist_default el7
+%define mysql_download_base_url_default http://repo.mysql.com/yum/mysql-5.6-community/el/7/SRPMS
+%define mysql_spec_file_default mysql.spec
+%else
+%define mysql_version_default 5.6.24
+%define mysql_release_default 3
+%define mysql_dist_default el6
+%define mysql_download_base_url_default http://repo.mysql.com/yum/mysql-5.6-community/el/6/SRPMS
+%define mysql_spec_file_default mysql.spec
+%endif
+
+%{!?mysql_version:%define mysql_version %{mysql_version_default}}
+%{!?mysql_release:%define mysql_release %{mysql_release_default}}
+%{!?mysql_dist:%define mysql_dist %{mysql_dist_default}}
+%{!?mysql_download_base_url:%define mysql_download_base_url %{mysql_download_base_url_default}}
+%{!?mysql_spec_file:%define mysql_spec_file %{mysql_spec_file_default}}
+
+%define groonga_required_version @REQUIRED_GROONGA_VERSION@
+
+Name: mysql-community-mroonga
+Version: @VERSION@
+Release: 1%{?dist}
+Summary: A fast fulltext searchable storage engine for MySQL
+
+Group: Applications/Databases
+License: LGPLv2.1
+URL: http://mroonga.org/
+Source0: http://packages.groonga.org/source/mroonga/mroonga-%{version}.tar.gz
+
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-%(%{__id_u} -n)
+BuildRequires: groonga-devel >= %{groonga_required_version}
+BuildRequires: groonga-normalizer-mysql-devel
+BuildRequires: wget
+BuildRequires: which
+BuildRequires: gcc, gcc-c++
+BuildRequires: mysql-community-devel = %{mysql_version}-%{mysql_release}.%{mysql_dist}
+Requires: mysql-community-server = %{mysql_version}-%{mysql_release}.%{mysql_dist}
+Requires: mysql-community-client = %{mysql_version}-%{mysql_release}.%{mysql_dist}
+Requires: groonga-libs >= %{groonga_required_version}
+Requires: groonga-normalizer-mysql
+
+%description
+Mroonga is a fast fulltext searchable storage plugin for MySQL.
+It is based on Groonga that is a fast fulltext search engine and
+column store. Groonga is good at real-time update.
+
+%package doc
+Summary: Documentation for Mroonga
+Group: Documentation
+License: LGPLv2.1
+
+%description doc
+Documentation for Mroonga
+
+
+%prep
+%setup -q -n mroonga-%{version}
+
+mysql_full_version=%{mysql_version}-%{mysql_release}.%{mysql_dist}
+srpm=mysql-community-${mysql_full_version}.src.rpm
+if [ ! -f ../../SRPMS/$srpm ]; then
+ wget --continue -O ../../SRPMS/$srpm %{mysql_download_base_url}/$srpm
+ rpm -Uvh ../../SRPMS/$srpm
+fi
+
+%build
+mysql_source=../mysql-%{mysql_version}/mysql-%{mysql_version}
+if [ ! -d ${mysql_source} ]; then
+ specs_dir=
+ MYSQL_RPMBUILD_TEST=no rpmbuild -bp \
+ --define 'runselftest 0' \
+ --define 'optflags -O0' \
+ ../../SPECS/%{mysql_spec_file}
+fi
+%configure --disable-static --with-mysql-source=${mysql_source} \
+ %{?mroonga_configure_options}
+make %{?_smp_mflags}
+
+%install
+rm -rf $RPM_BUILD_ROOT
+make install DESTDIR=$RPM_BUILD_ROOT
+rm $RPM_BUILD_ROOT%{_libdir}/mysql/plugin/*.la
+mv $RPM_BUILD_ROOT%{_datadir}/doc/mroonga/ mysql-mroonga-doc/
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post
+mysql_command=`which mysql`
+password_option=""
+$mysql_command -u root -e "quit"
+if [ $? -ne 0 ]; then
+ password_option="-p"
+fi
+current_version=0
+version=`echo %{groonga_required_version} | sed -e 's/\.//g'`
+required_version=`expr $version`
+version=`$mysql_command -e "SHOW VARIABLES LIKE 'mroonga_libgroonga_version'" | \
+ grep mroonga | cut -f 2 | sed -e 's/\.//g'`
+if [ -n "$version" ]; then
+ current_version=`expr $version`
+fi
+install_sql=%{_datadir}/mroonga/install.sql
+uninstall_sql=%{_datadir}/mroonga/uninstall.sql
+
+if [ "$1" = 2 ] ; then
+ if [ $current_version -lt $required_version ]; then
+ command="$mysql_command -u root $password_option"
+ echo "run the following command after restarting MySQL server:";
+ echo " $command < ${uninstall_sql}"
+ echo " $command < ${install_sql}"
+ exit 0
+ else
+ command="$mysql_command -u root $password_option < ${uninstall_sql}"
+ echo $command
+ eval $command || \
+ (echo "run the following command to unregister Mroonga:"; \
+ echo " $command")
+ fi
+fi
+command="$mysql_command -u root $password_option < ${install_sql}"
+echo $command
+eval $command || \
+ (echo "run the following command to register Mroonga:"; \
+ echo " $command")
+
+%preun
+uninstall_sql=%{_datadir}/mroonga/uninstall.sql
+mysql_command=`which mysql`
+if $mysql_command -u root -e "quit"; then
+ password_option=""
+else
+ password_option="-p"
+fi
+if [ "$1" = 0 ]; then
+ command="$mysql_command -u root $password_option < ${uninstall_sql}"
+ echo $command
+ eval $command || \
+ (echo "run the following command to unregister Mroonga:"; \
+ echo " $command")
+fi
+
+%files
+%defattr(-,root,root,-)
+%{_libdir}/mysql/plugin/
+%{_datadir}/mroonga/*
+%{_datadir}/man/man1/*
+%{_datadir}/man/*/man1/*
+
+%files doc
+%defattr(-,root,root,-)
+%doc README COPYING
+%doc mysql-mroonga-doc/*
+
+%changelog
+* Wed Apr 29 2015 HAYASHI Kentaro <hayashi@clear-code.com> - 5.02-1
+- new upstream release.
+
+* Fri Apr 10 2015 Kouhei Sutou <kou@clear-code.com> - 5.01-2
+- build against MySQL 5.6.24.
+
+* Sun Mar 29 2015 HAYASHI Kentaro <hayashi@clear-code.com> - 5.01-1
+- new upstream release.
+
+* Mon Feb 09 2015 HAYASHI Kentaro <hayashi@clear-code.com> - 5.00-1
+- new upstream release.
+
+* Wed Feb 04 2015 HAYASHI Kentaro <hayashi@clear-code.com> - 4.10-2
+- build against MySQL 5.6.23-2 on MySQL yum repository.
+
+* Thu Jan 29 2015 HAYASHI Kentaro <hayashi@clear-code.com> - 4.10-1
+- new upstream release.
+
+* Mon Dec 29 2014 Kouhei Sutou <kou@cozmixng.org> - 4.09-1
+- new upstream release.
+
+* Sat Nov 29 2014 HAYASHI Kentaro <hayashi@clear-code.com> - 4.08-1
+- new upstream release.
+
+* Wed Oct 29 2014 Kouhei Sutou <kou@clear-code.com> - 4.07-1
+- new upstream release.
+
+* Mon Sep 29 2014 Kouhei Sutou <kou@clear-code.com> - 4.06-1
+- new upstream release.
+
+* Sat Sep 27 2014 Eiichi Sato <miko@cafelounge.net> - 4.05-2
+- build against MySQL 5.6.21-2 on MySQL yum repository.
+
+* Fri Aug 29 2014 Kouhei Sutou <kou@clear-code.com> - 4.05-1
+- new upstream release.
+
+* Sat Aug 09 2014 Eiichi Sato <miko@cafelounge.net> - 4.04-2
+- build against MySQL 5.6.20-4 on MySQL yum repository.
+
+* Tue Jul 29 2014 HAYASHI Kentaro <hayashi@clear-code.com> - 4.04-1
+- new upstream release.
+
+* Thu May 29 2014 Kouhei Sutou <kou@clear-code.com> - 4.03-2
+- build against MySQL 5.6.37. Reported by YOSHIDA Mitsuo. Thanks!!!
+
+* Thu May 29 2014 Kouhei Sutou <kou@clear-code.com> - 4.03-1
+- new upstream release.
+
+* Tue Apr 29 2014 Kouhei Sutou <kou@clear-code.com> - 4.02-1
+- new upstream release.
+
+* Sat Mar 29 2014 HAYASHI Kentaro <hayashi@clear-code.com> - 4.01-1
+- new upstream release.
+
+* Thu Mar 06 2014 HAYASHI Kentaro <hayashi@clear-code.com> - 4.00-2
+- use MySQL 5.5.36 on CentOS 5.
+
+* Sun Feb 09 2014 HAYASHI Kentaro <hayashi@clear-code.com> - 4.00-1
+- new upstream release.
+
+* Wed Jan 29 2014 HAYASHI Kentaro <hayashi@clear-code.com> - 3.12-1
+- new upstream release.
+
+* Sun Dec 29 2013 HAYASHI Kentaro <hayashi@clear-code.com> - 3.11-1
+- new upstream release.
+
+* Fri Nov 29 2013 HAYASHI Kentaro <hayashi@clear-code.com> - 3.10-1
+- new upstream release.
+
+* Tue Oct 29 2013 HAYASHI Kentaro <hayashi@clear-code.com> - 3.09-1
+- initial packaging for MySQL 5.5 on CentOS 5.
diff --git a/storage/mroonga/packages/rpm/centos/percona-server-56-mroonga.spec.in b/storage/mroonga/packages/rpm/centos/percona-server-56-mroonga.spec.in
new file mode 100644
index 00000000000..f0306cace24
--- /dev/null
+++ b/storage/mroonga/packages/rpm/centos/percona-server-56-mroonga.spec.in
@@ -0,0 +1,156 @@
+%{!?centos_ver:%define centos_ver 6}
+
+%define mysql_version_default 5.6.23
+%define mysql_release_default rel72.1
+%define mysql_dist_default %{?dist}
+%define mysql_download_base_url_default http://repo.percona.com/centos/%{centos_ver}/SRPMS
+%define mysql_spec_file_default percona-server.spec
+
+%{!?mysql_version:%define mysql_version %{mysql_version_default}}
+%{!?mysql_release:%define mysql_release %{mysql_release_default}}
+%{!?mysql_dist:%define mysql_dist %{mysql_dist_default}}
+%{!?mysql_download_base_url:%define mysql_download_base_url %{mysql_download_base_url_default}}
+%{!?mysql_spec_file:%define mysql_spec_file %{mysql_spec_file_default}}
+
+%define groonga_required_version @REQUIRED_GROONGA_VERSION@
+
+Name: percona-server-56-mroonga
+Version: @VERSION@
+Release: 1%{?dist}
+Summary: A fast fulltext searchable storage engine for MySQL
+
+Group: Applications/Databases
+License: LGPLv2.1
+URL: http://mroonga.org/
+Source0: http://packages.groonga.org/source/mroonga/mroonga-%{version}.tar.gz
+
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-%(%{__id_u} -n)
+BuildRequires: groonga-devel >= %{groonga_required_version}
+BuildRequires: groonga-normalizer-mysql-devel
+BuildRequires: wget
+BuildRequires: which
+BuildRequires: gcc
+BuildRequires: gcc-c++
+BuildRequires: Percona-Server-devel-56 = %{mysql_version}-%{mysql_release}%{mysql_dist}
+BuildRequires: selinux-policy-devel
+Requires: Percona-Server-server-56 = %{mysql_version}-%{mysql_release}%{mysql_dist}
+Requires: Percona-Server-client-56 = %{mysql_version}-%{mysql_release}%{mysql_dist}
+Requires: groonga-libs >= %{groonga_required_version}
+Requires: groonga-normalizer-mysql
+
+%description
+Mroonga is a fast fulltext searchable storage plugin for MySQL.
+It is based on Groonga that is a fast fulltext search engine and
+column store. Groonga is good at real-time update.
+
+%package doc
+Summary: Documentation for Mroonga
+Group: Documentation
+License: LGPLv2.1
+
+%description doc
+Documentation for Mroonga
+
+
+%prep
+%setup -q -n mroonga-%{version}
+
+mysql_full_version=%{mysql_version}-%{mysql_release}.generic
+srpm=Percona-Server-56-${mysql_full_version}.src.rpm
+if [ ! -f ../../SRPMS/$srpm ]; then
+ wget --continue -O ../../SRPMS/$srpm %{mysql_download_base_url}/$srpm
+ rpm -Uvh ../../SRPMS/$srpm
+fi
+
+%build
+mysql_source=../percona-server-%{mysql_version}-$(echo %{mysql_release} | sed -e 's/rel//')
+if [ ! -d ${mysql_source} ]; then
+ specs_dir=
+ rpmbuild -bp \
+ --define 'runselftest 0' \
+ --define 'optflags -O0' \
+ ../../SPECS/%{mysql_spec_file}
+fi
+%configure --disable-static --with-mysql-source=${mysql_source} \
+ %{?mroonga_configure_options}
+make %{?_smp_mflags}
+
+%install
+rm -rf $RPM_BUILD_ROOT
+make install DESTDIR=$RPM_BUILD_ROOT
+rm $RPM_BUILD_ROOT%{_libdir}/mysql/plugin/*.la
+mv $RPM_BUILD_ROOT%{_datadir}/doc/mroonga/ mysql-mroonga-doc/
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post
+mysql_command=`which mysql`
+password_option=""
+$mysql_command -u root -e "quit"
+if [ $? -ne 0 ]; then
+ password_option="-p"
+fi
+current_version=0
+version=`echo %{groonga_required_version} | sed -e 's/\.//g'`
+required_version=`expr $version`
+version=`$mysql_command -e "SHOW VARIABLES LIKE 'mroonga_libgroonga_version'" | \
+ grep mroonga | cut -f 2 | sed -e 's/\.//g'`
+if [ -n "$version" ]; then
+ current_version=`expr $version`
+fi
+install_sql=%{_datadir}/mroonga/install.sql
+uninstall_sql=%{_datadir}/mroonga/uninstall.sql
+
+if [ "$1" = 2 ] ; then
+ if [ $current_version -lt $required_version ]; then
+ command="$mysql_command -u root $password_option"
+ echo "run the following command after restarting MySQL server:";
+ echo " $command < ${uninstall_sql}"
+ echo " $command < ${install_sql}"
+ exit 0
+ else
+ command="$mysql_command -u root $password_option < ${uninstall_sql}"
+ echo $command
+ eval $command || \
+ (echo "run the following command to unregister Mroonga:"; \
+ echo " $command")
+ fi
+fi
+command="$mysql_command -u root $password_option < ${install_sql}"
+echo $command
+eval $command || \
+ (echo "run the following command to register Mroonga:"; \
+ echo " $command")
+
+%preun
+uninstall_sql=%{_datadir}/mroonga/uninstall.sql
+mysql_command=`which mysql`
+if $mysql_command -u root -e "quit"; then
+ password_option=""
+else
+ password_option="-p"
+fi
+if [ "$1" = 0 ]; then
+ command="$mysql_command -u root $password_option < ${uninstall_sql}"
+ echo $command
+ eval $command || \
+ (echo "run the following command to unregister Mroonga:"; \
+ echo " $command")
+fi
+
+%files
+%defattr(-,root,root,-)
+%{_libdir}/mysql/plugin/
+%{_datadir}/mroonga/*
+%{_datadir}/man/man1/*
+%{_datadir}/man/*/man1/*
+
+%files doc
+%defattr(-,root,root,-)
+%doc README COPYING
+%doc mysql-mroonga-doc/*
+
+%changelog
+* Tue Mar 17 2015 Kouhei Sutou <kou@clear-code.com> - 5.00-1
+- initial release.
diff --git a/storage/mroonga/packages/source/Makefile.am b/storage/mroonga/packages/source/Makefile.am
new file mode 100644
index 00000000000..0f242c4e038
--- /dev/null
+++ b/storage/mroonga/packages/source/Makefile.am
@@ -0,0 +1,123 @@
+MROONGA_BASE = $(PACKAGE)-$(VERSION)
+MROONGA_TAR_GZ = $(MROONGA_BASE).tar.gz
+
+GROONGA_VERSION = 5.0.3
+GROONGA_BASE = groonga-$(GROONGA_VERSION)
+GROONGA_TAR_GZ = $(GROONGA_BASE).tar.gz
+
+GROONGA_NORMALIZER_MYSQL_VERSION = 1.0.9
+GROONGA_NORMALIZER_MYSQL_BASE = \
+ groonga-normalizer-mysql-$(GROONGA_NORMALIZER_MYSQL_VERSION)
+GROONGA_NORMALIZER_MYSQL_TAR_GZ = \
+ $(GROONGA_NORMALIZER_MYSQL_BASE).tar.gz
+
+MARIADB_VERSION = 10.0.17
+MARIADB_BASE = mariadb-$(MARIADB_VERSION)
+MARIADB_TAR_GZ = $(MARIADB_BASE).tar.gz
+
+MARIADB_WITH_MROONGA_BASE = $(MARIADB_BASE)-with-$(MROONGA_BASE)
+MARIADB_WITH_MROONGA_FOR_WINDOWS_BASE = $(MARIADB_WITH_MROONGA_BASE)-for-windows
+
+GROONGA_PROJECT_DOWNLOAD_BASE = http://packages.groonga.org/source
+GROONGA_DOWNLOAD_BASE = $(GROONGA_PROJECT_DOWNLOAD_BASE)/groonga
+GROONGA_NORMALIZER_MYSQL_DOWNLOAD_BASE = \
+ $(GROONGA_PROJECT_DOWNLOAD_BASE)/groonga-normalizer-mysql
+MARIADB_DOWNLOAD_BASE = http://ftp.yz.yamagata-u.ac.jp/pub/dbms/mariadb
+
+
+CURL = curl --fail --silent --show-error
+
+all:
+
+release: archive upload
+
+ensure-rsync-path:
+ @if test -z "$(RSYNC_PATH)"; then \
+ echo "--with-rsync-path configure option must be specified."; \
+ false; \
+ fi
+
+download: ensure-rsync-path
+ rsync -avz --progress --delete $(RSYNC_PATH)/source/mroonga/ files
+
+ARCHIVES = \
+ files/$(MROONGA_TAR_GZ) \
+ files/$(MARIADB_WITH_MROONGA_BASE).tar.gz \
+ files/$(MARIADB_WITH_MROONGA_FOR_WINDOWS_BASE).zip
+
+archive: $(ARCHIVES)
+
+upload: ensure-rsync-path
+ rsync -avz --progress --delete files/ $(RSYNC_PATH)/source/mroonga
+
+files/$(MROONGA_TAR_GZ): $(top_builddir)/$(MROONGA_TAR_GZ)
+ mkdir -p files
+ cp -p $< $@
+
+tmp/$(GROONGA_TAR_GZ):
+ mkdir -p tmp
+ $(CURL) --output $@ $(GROONGA_DOWNLOAD_BASE)/$(GROONGA_TAR_GZ)
+
+tmp/$(GROONGA_NORMALIZER_MYSQL_TAR_GZ):
+ mkdir -p tmp
+ $(CURL) --output $@ $(GROONGA_NORMALIZER_MYSQL_DOWNLOAD_BASE)/$(GROONGA_NORMALIZER_MYSQL_TAR_GZ)
+
+tmp/$(MARIADB_TAR_GZ):
+ mkdir -p tmp
+ $(CURL) --output $@ $(MARIADB_DOWNLOAD_BASE)/mariadb-$(MARIADB_VERSION)/source/$(MARIADB_TAR_GZ)
+
+MARIADB_WITH_MROONGA_ARCHIVES = \
+ tmp/$(GROONGA_TAR_GZ) \
+ tmp/$(GROONGA_NORMALIZER_MYSQL_TAR_GZ) \
+ tmp/$(MARIADB_TAR_GZ) \
+ $(top_builddir)/$(MROONGA_TAR_GZ)
+
+BUNDLED_MROONGA_PATH = $(MARIADB_BASE)/storage/$(PACKAGE)
+BUNDLED_GROONGA_PATH = $(BUNDLED_MROONGA_PATH)/vendor/groonga
+BUNDLED_GROONGA_NORMALIZER_MYSQL_PATH = \
+ $(BUNDLED_GROONGA_PATH)/vendor/plugins/groonga-normalizer-mysql
+
+tmp/$(MARIADB_WITH_MROONGA_BASE).stamp: $(MARIADB_WITH_MROONGA_ARCHIVES)
+ rm -rf $(MARIADB_BASE)
+ tar xf tmp/$(MARIADB_TAR_GZ)
+
+ rm -fr $(MARIADB_BASE)/storage/mroonga
+ tar xf $(top_builddir)/$(MROONGA_TAR_GZ)
+ mv $(MROONGA_BASE) $(BUNDLED_MROONGA_PATH)
+
+ mkdir -p $$(dirname $(BUNDLED_GROONGA_PATH))
+ tar xf tmp/$(GROONGA_TAR_GZ)
+ rm -rf $(GROONGA_BASE)/test
+ mv $(GROONGA_BASE) $(BUNDLED_GROONGA_PATH)
+
+ tar xf tmp/$(GROONGA_NORMALIZER_MYSQL_TAR_GZ)
+ rm -rf $(GROONGA_NORMALIZER_MYSQL_BASE)/test
+ mv $(GROONGA_NORMALIZER_MYSQL_BASE) $(BUNDLED_GROONGA_NORMALIZER_MYSQL_PATH)
+
+ rm -rf tmp/$(MARIADB_WITH_MROONGA_BASE)
+ mv $(MARIADB_BASE) tmp/$(MARIADB_WITH_MROONGA_BASE)
+
+ touch $@
+
+files/$(MARIADB_WITH_MROONGA_BASE).tar.gz: tmp/$(MARIADB_WITH_MROONGA_BASE).stamp
+ mkdir -p files/
+ (cd tmp && tar czf ../$@ $(MARIADB_WITH_MROONGA_BASE))
+
+PATCHES = \
+ patches/mariadb-10.0.3-windows-build.diff
+
+tmp/$(MARIADB_WITH_MROONGA_FOR_WINDOWS_BASE).stamp: tmp/$(MARIADB_WITH_MROONGA_BASE).stamp $(PATCHES)
+ rm -rf tmp/$(MARIADB_WITH_MROONGA_FOR_WINDOWS_BASE)
+ cp -a \
+ tmp/$(MARIADB_WITH_MROONGA_BASE) \
+ tmp/$(MARIADB_WITH_MROONGA_FOR_WINDOWS_BASE)
+ for patch in $(PATCHES); do \
+ (cd tmp/$(MARIADB_WITH_MROONGA_FOR_WINDOWS_BASE) && \
+ patch -p1 < $(abs_srcdir)/$${patch}); \
+ done
+
+ touch $@
+
+files/$(MARIADB_WITH_MROONGA_FOR_WINDOWS_BASE).zip: tmp/$(MARIADB_WITH_MROONGA_FOR_WINDOWS_BASE).stamp
+ mkdir -p files/
+ (cd tmp && zip -q -r ../$@ $(MARIADB_WITH_MROONGA_FOR_WINDOWS_BASE))
diff --git a/storage/mroonga/packages/source/patches/mariadb-10.0.3-windows-build.diff b/storage/mroonga/packages/source/patches/mariadb-10.0.3-windows-build.diff
new file mode 100644
index 00000000000..c135088b8cc
--- /dev/null
+++ b/storage/mroonga/packages/source/patches/mariadb-10.0.3-windows-build.diff
@@ -0,0 +1,9 @@
+diff -ur mariadb-10.0.2.orig/sql/sql_locale.cc mariadb-10.0.2/sql/sql_locale.cc
+--- mariadb-10.0.2.orig/sql/sql_locale.cc 2013-04-23 13:13:59.000000000 +0900
++++ mariadb-10.0.2/sql/sql_locale.cc 2013-05-19 12:55:27.590366542 +0900
+@@ -1,4 +1,4 @@
+-/* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
++/* Copyright (c) 2005, 2010, 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
diff --git a/storage/mroonga/packages/ubuntu/Makefile.am b/storage/mroonga/packages/ubuntu/Makefile.am
new file mode 100644
index 00000000000..2297a50bfc9
--- /dev/null
+++ b/storage/mroonga/packages/ubuntu/Makefile.am
@@ -0,0 +1,24 @@
+CODE_NAMES = precise,trusty,utopic,vivid
+SOURCE = ../$(PACKAGE)-$(VERSION).tar.gz
+
+all:
+
+ensure-launchpad-configuration:
+ @if test -z "$(LAUNCHPAD_UPLOADER_PGP_KEY)"; then \
+ echo "--with-launchpad-uploader-pgp-key configure option must be specified."; \
+ false; \
+ fi
+
+upload: source ensure-launchpad-configuration
+ ./upload.rb \
+ --package '$(PACKAGE)' \
+ --version '$(VERSION)' \
+ --source-archive '$(SOURCE)' \
+ --code-names '$(CODE_NAMES)' \
+ --debian-directory '$(srcdir)/../debian/' \
+ --pgp-sign-key '$(LAUNCHPAD_UPLOADER_PGP_KEY)'
+
+source: $(SOURCE)
+
+$(SOURCE):
+ ln -s $(abs_top_builddir)/$(PACKAGE)-$(VERSION).tar.gz $(SOURCE)
diff --git a/storage/mroonga/packages/ubuntu/upload.rb b/storage/mroonga/packages/ubuntu/upload.rb
new file mode 100755
index 00000000000..79331a06c8d
--- /dev/null
+++ b/storage/mroonga/packages/ubuntu/upload.rb
@@ -0,0 +1,174 @@
+#!/usr/bin/env ruby
+#
+# Copyright(C) 2014 Kouhei Sutou <kou@clear-code.com>
+# Copyright(C) 2014 HAYASHI Kentaro <hayashi@clear-code.com>
+#
+# 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
+
+require "optparse"
+require "fileutils"
+require "pathname"
+require "open-uri"
+
+class Uploader
+ def initialize
+ @dput_configuration_name = "groonga-ppa"
+ end
+
+ def run
+ ensure_dput_configuration
+
+ parse_command_line!
+
+ ensure_mysql_version
+
+ @required_groonga_version = required_groonga_version
+
+ @code_names.each do |code_name|
+ upload(code_name)
+ end
+ end
+
+ private
+ def ensure_dput_configuration
+ dput_cf_path = Pathname.new("~/.dput.cf").expand_path
+ if dput_cf_path.exist?
+ dput_cf_content = dput_cf_path.read
+ else
+ dput_cf_content = ""
+ end
+ dput_cf_content.each_line do |line|
+ return if line.chomp == "[#{@dput_configuration_name}]"
+ end
+
+ dput_cf_path.open("w") do |dput_cf|
+ dput_cf.puts(dput_cf_content)
+ dput_cf.puts(<<-CONFIGURATION)
+[#{@dput_configuration_name}]
+fqdn = ppa.launchpad.net
+method = ftp
+incoming = ~groonga/ppa/ubuntu/
+login = anonymous
+allow_unsigned_uploads = 0
+ CONFIGURATION
+ end
+ end
+
+ def ensure_mysql_version
+ @mysql_version = {}
+ @code_names.each do |code_name|
+ open("http://packages.ubuntu.com/#{code_name}/allpackages?format=txt.gz") do |file|
+ file.each_line do |line|
+ @mysql_version[code_name] = $1 if line =~ /\Amysql-server \((.+?)\).+/
+ end
+ end
+ end
+ end
+
+ def parse_command_line!
+
+ parser = OptionParser.new
+ parser.on("--package=NAME",
+ "The package name") do |name|
+ @package = name
+ end
+ parser.on("--version=VERSION",
+ "The version") do |version|
+ @version = version
+ end
+ parser.on("--source-archive=ARCHIVE",
+ "The source archive") do |source_archive|
+ @source_archive = Pathname.new(source_archive).expand_path
+ end
+ parser.on("--code-names=CODE_NAME1,CODE_NAME2,CODE_NAME3,...", Array,
+ "The target code names") do |code_names|
+ @code_names = code_names
+ end
+ parser.on("--debian-directory=DIRECTORY",
+ "The debian/ directory") do |debian_directory|
+ @debian_directory = Pathname.new(debian_directory).expand_path
+ end
+ parser.on("--pgp-sign-key=KEY",
+ "The PGP key to sign .changes and .dsc") do |pgp_sign_key|
+ @pgp_sign_key = pgp_sign_key
+ end
+ parser.on("--pbuilder",
+ "Use pbuilder for build check") do |pbuilder|
+ @use_pbuilder = pbuilder
+ end
+
+ parser.parse!
+ end
+
+ def upload(code_name)
+ in_temporary_directory do
+ FileUtils.cp(@source_archive.to_s,
+ "#{@package}_#{@version}.orig.tar.gz")
+ run_command("tar", "xf", @source_archive.to_s)
+ directory_name = "#{@package}-#{@version}"
+ Dir.chdir(directory_name) do
+ FileUtils.cp_r(@debian_directory.to_s, "debian")
+ deb_version = "#{current_deb_version.succ}~#{code_name}1"
+ run_command("dch",
+ "--distribution", code_name,
+ "--newversion", deb_version,
+ "Build for #{code_name}.")
+ case code_name
+ when "vivid"
+ run_command("sed",
+ "-i", "-e", "s,5\.5,5\.6,g",
+ "debian/rules")
+ end
+ run_command("sed",
+ "-i", "-e", "s,MYSQL_VERSION,#{@mysql_version[code_name]},",
+ "debian/control")
+ run_command("debuild", "-S", "-sa", "-pgpg2", "-k#{@pgp_sign_key}")
+ if @use_pbuilder
+ run_command("pbuilder-dist", code_name, "build",
+ "../#{@package}_#{deb_version}.dsc")
+ else
+ run_command("dput", @dput_configuration_name,
+ "../#{@package}_#{deb_version}_source.changes")
+ end
+ end
+ end
+ end
+
+ def required_groonga_version
+ File.read("../../required_groonga_version").lines.first.chomp
+ end
+
+ def current_deb_version
+ /\((.+)\)/ =~ File.read("debian/changelog").lines.first
+ $1
+ end
+
+ def in_temporary_directory
+ name = "tmp"
+ FileUtils.rm_rf(name)
+ FileUtils.mkdir_p(name)
+ Dir.chdir(name) do
+ yield
+ end
+ end
+
+ def run_command(*command_line)
+ unless system(*command_line)
+ raise "failed to run command: #{command_line.join(' ')}"
+ end
+ end
+end
+
+uploader = Uploader.new
+uploader.run
diff --git a/storage/mroonga/packages/windows/Makefile.am b/storage/mroonga/packages/windows/Makefile.am
new file mode 100644
index 00000000000..192709fac6d
--- /dev/null
+++ b/storage/mroonga/packages/windows/Makefile.am
@@ -0,0 +1,12 @@
+EXTRA_DIST = \
+ README.md \
+ build-vc2013.bat \
+ build-vc2013-zip-32.bat \
+ build-vc2013-zip-64.bat \
+ build-vc2013-msi-32.bat \
+ build-vc2013-msi-64.bat \
+ build-vc2015.bat \
+ build-vc2015-zip-32.bat \
+ build-vc2015-zip-64.bat \
+ build-vc2015-msi-32.bat \
+ build-vc2015-msi-64.bat
diff --git a/storage/mroonga/packages/windows/README.md b/storage/mroonga/packages/windows/README.md
new file mode 100644
index 00000000000..f220634b1e7
--- /dev/null
+++ b/storage/mroonga/packages/windows/README.md
@@ -0,0 +1,21 @@
+# How to build Windows binaries
+
+## Preparation
+
+TODO...
+
+## Build with Visual C++ Express
+
+You need to use Visual C++ 2013 or later to build Mroonga with Express
+edition. `build-vc2013.bat` is a build batch script to build with
+Visual C++ Express 2013.
+
+Note that you can't build MSI file with Express edition. You need to
+use Professional edition or upper editions to build MSI file.
+
+## Build with Visual C++ Professional
+
+You can build both zip file MSI file with Professional edition.
+But now, this feature is temporary disabled.
+If you want to create MSI package, please uncomment in `build-vc2013.bat`.
+And then, you can build MSI package with Visual Studio 2013 Professional.
diff --git a/storage/mroonga/packages/windows/build-vc2013-msi-32.bat b/storage/mroonga/packages/windows/build-vc2013-msi-32.bat
new file mode 100644
index 00000000000..22b29972885
--- /dev/null
+++ b/storage/mroonga/packages/windows/build-vc2013-msi-32.bat
@@ -0,0 +1,8 @@
+rmdir /S /Q build-vc2013-msi-32
+mkdir build-vc2013-msi-32
+cd build-vc2013-msi-32
+cmake ..\source -G "Visual Studio 12" > config.log
+cmake --build . --config RelWithDebInfo > build.log
+cmake --build . --config RelWithDebInfo --target msi > msi.log
+move *.msi ..\
+cd ..
diff --git a/storage/mroonga/packages/windows/build-vc2013-msi-64.bat b/storage/mroonga/packages/windows/build-vc2013-msi-64.bat
new file mode 100644
index 00000000000..c83a376cdb9
--- /dev/null
+++ b/storage/mroonga/packages/windows/build-vc2013-msi-64.bat
@@ -0,0 +1,8 @@
+rmdir /S /Q build-vc2013-msi-64
+mkdir build-vc2013-msi-64
+cd build-vc2013-msi-64
+cmake ..\source -G "Visual Studio 12 Win64" > config.log
+cmake --build . --config RelWithDebInfo > build.log
+cmake --build . --config RelWithDebInfo --target msi > msi.log
+move *.msi ..\
+cd ..
diff --git a/storage/mroonga/packages/windows/build-vc2013-zip-32.bat b/storage/mroonga/packages/windows/build-vc2013-zip-32.bat
new file mode 100644
index 00000000000..d3e0e4f8b8e
--- /dev/null
+++ b/storage/mroonga/packages/windows/build-vc2013-zip-32.bat
@@ -0,0 +1,8 @@
+rmdir /S /Q build-vc2013-zip-32
+mkdir build-vc2013-zip-32
+cd build-vc2013-zip-32
+cmake ..\source -G "Visual Studio 12" -DMRN_GROONGA_EMBED=OFF -DMRN_GROONGA_NORMALIZER_MYSQL_EMBED=OFF > config.log
+cmake --build . --config RelWithDebInfo > build.log
+cmake --build . --config RelWithDebInfo --target package > zip.log
+move *.zip ..\
+cd ..
diff --git a/storage/mroonga/packages/windows/build-vc2013-zip-64.bat b/storage/mroonga/packages/windows/build-vc2013-zip-64.bat
new file mode 100644
index 00000000000..6ca288b6a8b
--- /dev/null
+++ b/storage/mroonga/packages/windows/build-vc2013-zip-64.bat
@@ -0,0 +1,8 @@
+rmdir /S /Q build-vc2013-zip-64
+mkdir build-vc2013-zip-64
+cd build-vc2013-zip-64
+cmake ..\source -G "Visual Studio 12 Win64" -DMRN_GROONGA_EMBED=OFF -DMRN_GROONGA_NORMALIZER_MYSQL_EMBED=OFF > config.log
+cmake --build . --config RelWithDebInfo > build.log
+cmake --build . --config RelWithDebInfo --target package > zip.log
+move *.zip ..\
+cd ..
diff --git a/storage/mroonga/packages/windows/build-vc2013.bat b/storage/mroonga/packages/windows/build-vc2013.bat
new file mode 100644
index 00000000000..99d7e4042c5
--- /dev/null
+++ b/storage/mroonga/packages/windows/build-vc2013.bat
@@ -0,0 +1,4 @@
+build-vc2013-zip-32.bat
+build-vc2013-zip-64.bat
+REM build-vc2013-msi-32.bat
+REM build-vc2013-msi-64.bat
diff --git a/storage/mroonga/packages/windows/build-vc2015-msi-32.bat b/storage/mroonga/packages/windows/build-vc2015-msi-32.bat
new file mode 100644
index 00000000000..4c92b5c02cc
--- /dev/null
+++ b/storage/mroonga/packages/windows/build-vc2015-msi-32.bat
@@ -0,0 +1,8 @@
+rmdir /S /Q build-vc2015-msi-32
+mkdir build-vc2015-msi-32
+cd build-vc2015-msi-32
+cmake ..\source -G "Visual Studio 14" > config.log
+cmake --build . --config RelWithDebInfo > build.log
+cmake --build . --config RelWithDebInfo --target msi > msi.log
+move *.msi ..\
+cd ..
diff --git a/storage/mroonga/packages/windows/build-vc2015-msi-64.bat b/storage/mroonga/packages/windows/build-vc2015-msi-64.bat
new file mode 100644
index 00000000000..82bc2a148ec
--- /dev/null
+++ b/storage/mroonga/packages/windows/build-vc2015-msi-64.bat
@@ -0,0 +1,8 @@
+rmdir /S /Q build-vc2015-msi-64
+mkdir build-vc2015-msi-64
+cd build-vc2015-msi-64
+cmake ..\source -G "Visual Studio 14 Win64" > config.log
+cmake --build . --config RelWithDebInfo > build.log
+cmake --build . --config RelWithDebInfo --target msi > msi.log
+move *.msi ..\
+cd ..
diff --git a/storage/mroonga/packages/windows/build-vc2015-zip-32.bat b/storage/mroonga/packages/windows/build-vc2015-zip-32.bat
new file mode 100644
index 00000000000..5cef259afe5
--- /dev/null
+++ b/storage/mroonga/packages/windows/build-vc2015-zip-32.bat
@@ -0,0 +1,8 @@
+rmdir /S /Q build-vc2015-zip-32
+mkdir build-vc2015-zip-32
+cd build-vc2015-zip-32
+cmake ..\source -G "Visual Studio 14" -DMRN_GROONGA_EMBED=OFF -DMRN_GROONGA_NORMALIZER_MYSQL_EMBED=OFF > config.log
+cmake --build . --config RelWithDebInfo > build.log
+cmake --build . --config RelWithDebInfo --target package > zip.log
+move *.zip ..\
+cd ..
diff --git a/storage/mroonga/packages/windows/build-vc2015-zip-64.bat b/storage/mroonga/packages/windows/build-vc2015-zip-64.bat
new file mode 100644
index 00000000000..caabca179e7
--- /dev/null
+++ b/storage/mroonga/packages/windows/build-vc2015-zip-64.bat
@@ -0,0 +1,8 @@
+rmdir /S /Q build-vc2015-zip-64
+mkdir build-vc2015-zip-64
+cd build-vc2015-zip-64
+cmake ..\source -G "Visual Studio 14 Win64" -DMRN_GROONGA_EMBED=OFF -DMRN_GROONGA_NORMALIZER_MYSQL_EMBED=OFF > config.log
+cmake --build . --config RelWithDebInfo > build.log
+cmake --build . --config RelWithDebInfo --target package > zip.log
+move *.zip ..\
+cd ..
diff --git a/storage/mroonga/packages/windows/build-vc2015.bat b/storage/mroonga/packages/windows/build-vc2015.bat
new file mode 100644
index 00000000000..f9ac1765792
--- /dev/null
+++ b/storage/mroonga/packages/windows/build-vc2015.bat
@@ -0,0 +1,4 @@
+build-vc2015-zip-32.bat
+build-vc2015-zip-64.bat
+REM build-vc2015-msi-32.bat
+REM build-vc2015--msi-64.bat
diff --git a/storage/mroonga/packages/yum/Makefile.am b/storage/mroonga/packages/yum/Makefile.am
new file mode 100644
index 00000000000..8321619868f
--- /dev/null
+++ b/storage/mroonga/packages/yum/Makefile.am
@@ -0,0 +1,64 @@
+REPOSITORIES_PATH = repositories
+DISTRIBUTIONS = centos
+ARCHITECTURES = i386 x86_64
+MYSQL_VARIANTS = mysql55 mysql56-community mariadb percona-server-56
+SPEC_DIR = $(builddir)/../rpm/centos
+
+all:
+
+release: download build sign-packages update-repository upload
+
+remove-existing-packages:
+ for distribution in $(DISTRIBUTIONS); do \
+ find $${distribution} -name "*.rpm" -delete; \
+ done
+
+ensure-rsync-path:
+ @if test -z "$(RSYNC_PATH)"; then \
+ echo "--with-rsync-path configure option must be specified."; \
+ false; \
+ fi
+
+sign-packages:
+ ./sign-rpm.sh '$(GPG_UID)' '$(REPOSITORIES_PATH)/' '$(DISTRIBUTIONS)'
+
+update-repository:
+ ./update-repository.sh '$(REPOSITORIES_PATH)/' '$(DISTRIBUTIONS)'
+
+upload: ensure-rsync-path
+ for distribution in $(DISTRIBUTIONS); do \
+ rsync -avz --progress --delete --exclude .gitignore \
+ $(REPOSITORIES_PATH)/$${distribution}/ \
+ $(RSYNC_PATH)/$${distribution}; \
+ done
+
+download: ensure-rsync-path
+ mkdir -p $(REPOSITORIES_PATH)
+ for distribution in $(DISTRIBUTIONS); do \
+ rsync -avz --progress --delete \
+ $(RSYNC_PATH)/$${distribution}/ \
+ $(REPOSITORIES_PATH)/$${distribution}; \
+ done
+
+build: build-in-vm
+
+build-in-vm: source specs env.sh
+ ./build-in-vm.sh \
+ "$(PACKAGE)" \
+ "$(SPEC_DIR)" \
+ "$(MYSQL_VARIANTS)" \
+ "$(ARCHITECTURES)"
+
+source: tmp/$(PACKAGE)-$(VERSION).tar.gz
+
+tmp/$(PACKAGE)-$(VERSION).tar.gz: $(abs_top_builddir)/$(PACKAGE)-$(VERSION).tar.gz
+ mkdir -p tmp/
+ cp $(abs_top_builddir)/$(PACKAGE)-$(VERSION).tar.gz tmp/
+
+$(abs_top_builddir)/$(PACKAGE)-$(VERSION).tar.gz:
+ cd $(abs_top_builddir) && $(MAKE) dist
+
+specs: $(SPEC_DIR)/mysql55-$(PACKAGE).spec
+specs: $(SPEC_DIR)/mysql56-community-$(PACKAGE).spec
+specs: $(SPEC_DIR)/mariadb-$(PACKAGE).spec
+specs: $(SPEC_DIR)/percona-server-56-$(PACKAGE).spec
diff --git a/storage/mroonga/packages/yum/Vagrantfile b/storage/mroonga/packages/yum/Vagrantfile
new file mode 100644
index 00000000000..da41350eed3
--- /dev/null
+++ b/storage/mroonga/packages/yum/Vagrantfile
@@ -0,0 +1,50 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+
+# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
+VAGRANTFILE_API_VERSION = "2"
+
+Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
+ vms = [
+ {
+ :id => "centos-5-i386",
+ :box_url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-5.11-i386_chef-provisionerless.box",
+ },
+ {
+ :id => "centos-5-x86_64",
+ :box_url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-5.11_chef-provisionerless.box",
+ },
+ {
+ :id => "centos-6-i386",
+ :box_url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-6.6-i386_chef-provisionerless.box",
+ },
+ {
+ :id => "centos-6-x86_64",
+ :box_url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-6.6_chef-provisionerless.box",
+ },
+ {
+ :id => "centos-7-x86_64",
+ :box_url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-7.1_chef-provisionerless.box",
+ },
+ ]
+
+ vms.each do |vm|
+ config.vm.define(vm[:id]) do |node|
+ node.vm.box = vm[:id]
+ node.vm.box_url = vm[:box_url]
+ node.vm.provision(:shell, :path => "build-rpm.sh")
+ node.vm.provider("virtualbox") do |virtual_box|
+ system_n_cpus = 1
+ if File.exist?("/proc/cpuinfo")
+ system_n_cpus = File.readlines("/proc/cpuinfo").grep(/^processor/).size
+ end
+ if system_n_cpus > 1
+ vm_n_cpus = system_n_cpus / 2
+ else
+ vm_n_cpus = 1
+ end
+ virtual_box.cpus = vm_n_cpus
+ end
+ end
+ end
+end
diff --git a/storage/mroonga/packages/yum/build-in-vm.sh b/storage/mroonga/packages/yum/build-in-vm.sh
new file mode 100755
index 00000000000..cf9ef581fd0
--- /dev/null
+++ b/storage/mroonga/packages/yum/build-in-vm.sh
@@ -0,0 +1,63 @@
+#!/bin/sh
+
+if [ $# != 4 ]; then
+ echo "Usage: $0 PACKAGE SPEC_DIR MYSQL_VARIANTS ARCHITECTURES"
+ echo " e.g.: $0 mroonga ../rpm/centos 'mysql55 mariadb' 'i386 x86_64'"
+ exit 1
+fi
+
+PACKAGE="$1"
+SPEC_DIR="$2"
+MYSQL_VARIANTS="$3"
+ARCHITECTURES="$4"
+
+run()
+{
+ "$@"
+ if test $? -ne 0; then
+ echo "Failed $@"
+ exit 1
+ fi
+}
+
+run vagrant destroy --force
+
+for mysql_variant in ${MYSQL_VARIANTS}; do
+ rm -rf tmp/centos/
+ mkdir -p tmp/centos/
+ cp ${SPEC_DIR}/${mysql_variant}-${PACKAGE}.spec tmp/centos/
+
+ architectures="${ARCHITECTURES}"
+ case ${mysql_variant} in
+ mysql55)
+ centos_versions="5 6"
+ ;;
+ mysql56-community)
+ centos_versions="6 7"
+ ;;
+ mariadb)
+ centos_versions="7"
+ ;;
+ percona-server-56)
+ centos_versions="6 7"
+ ;;
+ esac
+
+ for architecture in ${architectures}; do
+ for centos_version in ${centos_versions}; do
+ if [ ${mysql_variant} = mysql55 -a ${centos_version} = 6 -a ${architecture} = i386 ]; then
+ continue
+ fi
+ if [ ${centos_version} = 7 -a ${architecture} = i386 ]; then
+ continue
+ fi
+ id=centos-${centos_version}-${architecture}
+ vagrant up ${id}
+ build_status=$?
+ if [ $build_status -ne 0 ]; then
+ exit $build_status
+ fi
+ vagrant destroy --force ${id}
+ done
+ done
+done
diff --git a/storage/mroonga/packages/yum/build-rpm.sh b/storage/mroonga/packages/yum/build-rpm.sh
new file mode 100755
index 00000000000..8661e659390
--- /dev/null
+++ b/storage/mroonga/packages/yum/build-rpm.sh
@@ -0,0 +1,119 @@
+#!/bin/sh
+
+LANG=C
+
+run()
+{
+ "$@"
+ if test $? -ne 0; then
+ echo "Failed $@"
+ exit 1
+ fi
+}
+
+rpmbuild_options=
+
+. /vagrant/env.sh
+
+distribution=$(cut -d " " -f 1 /etc/redhat-release | tr "A-Z" "a-z")
+if grep -q Linux /etc/redhat-release; then
+ distribution_version=$(cut -d " " -f 4 /etc/redhat-release)
+else
+ distribution_version=$(cut -d " " -f 3 /etc/redhat-release)
+fi
+distribution_version=$(echo ${distribution_version} | sed -e 's/\..*$//g')
+
+architecture="$(arch)"
+case "${architecture}" in
+ i*86)
+ architecture=i386
+ ;;
+esac
+
+run yum groupinstall -y "Development Tools"
+run yum install -y rpm-build rpmdevtools tar wget
+
+if [ -x /usr/bin/rpmdev-setuptree ]; then
+ rm -rf .rpmmacros
+ run rpmdev-setuptree
+else
+ run cat <<EOM > ~/.rpmmacros
+%_topdir ${HOME}/rpmbuild
+EOM
+ run mkdir -p ~/rpmbuild/SOURCES
+ run mkdir -p ~/rpmbuild/SPECS
+ run mkdir -p ~/rpmbuild/BUILD
+ run mkdir -p ~/rpmbuild/RPMS
+ run mkdir -p ~/rpmbuild/SRPMS
+fi
+
+repository="/vagrant/repositories/${distribution}/${distribution_version}"
+rpm_dir="${repository}/${architecture}/Packages"
+srpm_dir="${repository}/source/SRPMS"
+run mkdir -p "${rpm_dir}" "${srpm_dir}"
+
+rpmbuild_options=""
+
+# for debug
+# rpmbuild_options="${rpmbuild_options} --define 'optflags -O0 -g3'"
+
+cd
+
+run cp /vagrant/tmp/${PACKAGE}-${VERSION}.* rpmbuild/SOURCES/
+run cp /vagrant/tmp/${distribution}/*.spec rpmbuild/SPECS/
+
+package_name=$(cd rpmbuild/SPECS; echo *.spec | sed -e 's/\.spec$//g')
+
+case ${distribution} in
+ fedora)
+ USE_MYSQLSERVICES_COMPAT=yes
+ run yum install -y mariadb-devel
+ ;;
+ centos)
+ case ${package_name} in
+ mysql55-${PACKAGE})
+ USE_MYSQLSERVICES_COMPAT=yes
+ run yum install -y scl-utils-build
+ if [ ${distribution_version} = 6 ]; then
+ run yum install -y centos-release-SCL
+ fi
+ run yum install -y mysql55-mysql-devel mysql55-build
+ ;;
+ mysql56-community-${PACKAGE})
+ release_rpm=mysql-community-release-el${distribution_version}-5.noarch.rpm
+ run yum -y install http://repo.mysql.com/${release_rpm}
+ run yum -y install mysql-community-devel
+ ;;
+ mariadb-${PACKAGE})
+ run yum -y install mariadb-devel
+ ;;
+ percona-server-56-${PACKAGE})
+ release_rpm_version=0.1-3
+ release_rpm=percona-release-${release_rpm_version}.noarch.rpm
+ run yum -y install http://www.percona.com/downloads/percona-release/redhat/${release_rpm_version}/${release_rpm}
+ run yum -y install Percona-Server-devel-56
+ ;;
+ esac
+
+ release_rpm=groonga-release-1.1.0-1.noarch.rpm
+ wget http://packages.groonga.org/${distribution}/${release_rpm}
+ run rpm -U ${release_rpm}
+ rm -f ${release_rpm}
+ run yum makecache
+ ;;
+esac
+run yum install -y ${DEPENDED_PACKAGES}
+
+if [ "${package_name}" = "percona-server-56-${PACKAGE}" ]; then
+ if [ "${distribution_version}" = "7" ]; then
+ rpmbuild_options="$rpmbuild_options --define 'dist .el7'"
+ fi
+fi
+if [ "${USE_MYSQLSERVICES_COMPAT}" = "yes" ]; then
+ rpmbuild_options="$rpmbuild_options --define 'mroonga_configure_options --with-libmysqlservices-compat'"
+fi
+
+run eval rpmbuild -ba ${rpmbuild_options} rpmbuild/SPECS/${package_name}.spec
+
+run mv rpmbuild/RPMS/*/* "${rpm_dir}/"
+run mv rpmbuild/SRPMS/* "${srpm_dir}/"
diff --git a/storage/mroonga/packages/yum/env.sh.in b/storage/mroonga/packages/yum/env.sh.in
new file mode 100644
index 00000000000..8c6d05baf5c
--- /dev/null
+++ b/storage/mroonga/packages/yum/env.sh.in
@@ -0,0 +1,28 @@
+PACKAGE=@PACKAGE@
+VERSION=@VERSION@
+DEPENDED_PACKAGES="
+intltool
+libtool
+gcc
+gcc-c++
+make
+gperf
+readline-devel
+openssl-devel
+time
+wget
+ncurses-devel
+sudo
+pkgconfig
+tar
+cmake
+libaio-devel
+systemtap-sdt-devel
+perl-Time-HiRes
+perl-Env
+perl-Test-Simple
+pam-devel
+selinux-policy-devel
+groonga-devel
+groonga-normalizer-mysql-devel
+"
diff --git a/storage/mroonga/packages/yum/sign-rpm.sh b/storage/mroonga/packages/yum/sign-rpm.sh
new file mode 100755
index 00000000000..b3a45afe7f5
--- /dev/null
+++ b/storage/mroonga/packages/yum/sign-rpm.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+
+script_base_dir=`dirname $0`
+
+if [ $# != 3 ]; then
+ echo "Usage: $0 GPG_UID DESTINATION DISTRIBUTIONS"
+ echo " e.g.: $0 'F10399C0' repositories/ 'fedora centos'"
+ exit 1
+fi
+
+GPG_UID=$1
+DESTINATION=$2
+DISTRIBUTIONS=$3
+
+run()
+{
+ "$@"
+ if test $? -ne 0; then
+ echo "Failed $@"
+ exit 1
+ fi
+}
+
+unsigned_rpms()
+{
+ while read rpm; do
+ rpm --checksig "$rpm" | grep -v 'gpg OK' | cut -d":" -f1
+ done
+}
+
+if ! gpg --list-keys "${GPG_UID}" > /dev/null 2>&1; then
+ run gpg --keyserver keyserver.ubuntu.com --recv-key "${GPG_UID}"
+fi
+run mkdir -p tmp
+run gpg --armor --export "${GPG_UID}" > tmp/sign-key
+run rpm --import tmp/sign-key
+run rm -rf tmp/sign-key
+
+rpms=""
+for distribution in ${DISTRIBUTIONS}; do
+ rpms="${rpms} $(find ${DESTINATION}${distribution} -name '*.rpm' | unsigned_rpms)"
+done
+
+echo "NOTE: YOU JUST ENTER! YOU DON'T NEED TO INPUT PASSWORD!"
+echo " IT'S JUST FOR rpm COMMAND RESTRICTION!"
+run echo $rpms | xargs rpm \
+ -D "_gpg_name ${GPG_UID}" \
+ -D "_gpg_digest_algo sha1" \
+ -D "__gpg /usr/bin/gpg2" \
+ -D "__gpg_check_password_cmd /bin/true true" \
+ -D "__gpg_sign_cmd %{__gpg} gpg --batch --no-verbose --no-armor %{?_gpg_digest_algo:--digest-algo %{_gpg_digest_algo}} --no-secmem-warning -u \"%{_gpg_name}\" -sbo %{__signature_filename} %{__plaintext_filename}" \
+ --resign
diff --git a/storage/mroonga/packages/yum/update-repository.sh b/storage/mroonga/packages/yum/update-repository.sh
new file mode 100755
index 00000000000..630b6c87422
--- /dev/null
+++ b/storage/mroonga/packages/yum/update-repository.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+script_base_dir=`dirname $0`
+
+if [ $# != 2 ]; then
+ echo "Usage: $0 DESTINATION DISTRIBUTIONS"
+ echo " e.g.: $0 repositories/ 'fedora centos'"
+ exit 1
+fi
+
+DESTINATION=$1
+DISTRIBUTIONS=$2
+
+run()
+{
+ "$@"
+ if test $? -ne 0; then
+ echo "Failed $@"
+ exit 1
+ fi
+}
+
+for distribution in ${DISTRIBUTIONS}; do
+ for dir in ${DESTINATION}${distribution}/*/*; do
+ # "--checksum sha" is for CentOS 5. If we drop CentOS 5 support,
+ # we can remove the option.
+ test -d $dir && run createrepo --checksum sha $dir
+ done;
+done
diff --git a/storage/mroonga/plug.in b/storage/mroonga/plug.in
deleted file mode 100644
index 2c9c15f6c86..00000000000
--- a/storage/mroonga/plug.in
+++ /dev/null
@@ -1,6 +0,0 @@
-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
index be9fc83102e..341d0b550fd 100644
--- a/storage/mroonga/plugin_version
+++ b/storage/mroonga/plugin_version
@@ -1 +1 @@
-4.6 \ No newline at end of file
+5.2 \ No newline at end of file
diff --git a/storage/mroonga/required_groonga_normalizer_mysql_version b/storage/mroonga/required_groonga_normalizer_mysql_version
index af0b7ddbffd..66c4c2263e5 100644
--- a/storage/mroonga/required_groonga_normalizer_mysql_version
+++ b/storage/mroonga/required_groonga_normalizer_mysql_version
@@ -1 +1 @@
-1.0.6
+1.0.9
diff --git a/storage/mroonga/required_groonga_version b/storage/mroonga/required_groonga_version
index fcdb2e109f6..a1ef0cae183 100644
--- a/storage/mroonga/required_groonga_version
+++ b/storage/mroonga/required_groonga_version
@@ -1 +1 @@
-4.0.0
+5.0.2
diff --git a/storage/mroonga/sources.am b/storage/mroonga/sources.am
index 0cf4a64b504..c7ddcfa5acc 100644
--- a/storage/mroonga/sources.am
+++ b/storage/mroonga/sources.am
@@ -7,5 +7,6 @@ sources = \
mrn_table.hpp \
mrn_err.h \
mrn_mysql.h \
- mrn_mysql_compat.h \
+ mrn_mysql_compat.h \
+ mrn_variables.hpp \
ha_mroonga.def
diff --git a/storage/mroonga/test/unit/test_mrn_path_mapper.cpp b/storage/mroonga/test/unit/test_mrn_path_mapper.cpp
index 70009c5b32e..316c4770115 100644
--- a/storage/mroonga/test/unit/test_mrn_path_mapper.cpp
+++ b/storage/mroonga/test/unit/test_mrn_path_mapper.cpp
@@ -1,6 +1,6 @@
/* -*- c-basic-offset: 2 -*- */
/*
- Copyright(C) 2012 Kouhei Sutou <kou@clear-code.com>
+ Copyright(C) 2012-2015 Kouhei Sutou <kou@clear-code.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -112,5 +112,23 @@ namespace test_mrn_path_mapper {
cppcut_assert_equal("_table", mapper.mysql_table_name());
}
}
+
+ namespace mysql_path {
+ void test_normal_table() {
+ mrn::PathMapper mapper("./db/table");
+ cppcut_assert_equal("./db/table", mapper.mysql_path());
+ }
+
+ void test_temporary_table() {
+ mrn::PathMapper mapper("/tmp/mysqld.1/#sql27c5_1_0");
+ cppcut_assert_equal("/tmp/mysqld.1/#sql27c5_1_0",
+ mapper.mysql_path());
+ }
+
+ void test_partition_table_path() {
+ mrn::PathMapper mapper("./db/table#P#p1");
+ cppcut_assert_equal("./db/table", mapper.mysql_path());
+ }
+ }
}
diff --git a/storage/mroonga/tools/travis/before_script.sh b/storage/mroonga/tools/travis/before_script.sh
index 8fd3f78f1db..7d4d7dcec5f 100755
--- a/storage/mroonga/tools/travis/before_script.sh
+++ b/storage/mroonga/tools/travis/before_script.sh
@@ -1,6 +1,6 @@
#!/bin/bash
#
-# Copyright(C) 2012-2014 Kouhei Sutou <kou@clear-code.com>
+# Copyright(C) 2012-2015 Kouhei Sutou <kou@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -20,17 +20,17 @@
set -e
if [ "${MROONGA_BUNDLED}" = "yes" ]; then
- cmake_args=(-DCMAKE_BUILD_TYPE=Debug)
- if [ "${MROONGA_TEST_EMBEDDED}" = "yes" ]; then
- cmake_args=("${cmake_args[@]}" "-DWITH_EMBEDDED_SERVER=TRUE")
- fi
- cmake . "${cmake_args[@]}"
+ cmake_args=(-DCMAKE_BUILD_TYPE=Debug)
+ if [ "${MROONGA_TEST_EMBEDDED}" = "yes" ]; then
+ cmake_args=("${cmake_args[@]}" "-DWITH_EMBEDDED_SERVER=TRUE")
+ fi
+ cmake . "${cmake_args[@]}"
else
- ./autogen.sh
+ ./autogen.sh
- if [ -d /opt/mysql/ ]; then
- PATH=$(echo /opt/mysql/server-*/bin/):$PATH
- fi
- ./configure \
- --with-mysql-source=$PWD/vendor/mysql
+ if [ -d /opt/mysql/ ]; then
+ PATH=$(echo /opt/mysql/server-*/bin/):$PATH
+ fi
+ ./configure \
+ --with-mysql-source=$PWD/vendor/mysql
fi
diff --git a/storage/mroonga/tools/travis/install.sh b/storage/mroonga/tools/travis/install.sh
index fd3d2187914..d9b090cd154 100755
--- a/storage/mroonga/tools/travis/install.sh
+++ b/storage/mroonga/tools/travis/install.sh
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Copyright(C) 2012-2013 Kouhei Sutou <kou@clear-code.com>
+# Copyright(C) 2012-2015 Kouhei Sutou <kou@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -24,80 +24,91 @@ mariadb_download_base=http://mirror.jmu.edu/pub/mariadb
export GROONGA_MASTER=yes
export GROONGA_NORMALIZER_MYSQL_MASTER=yes
-curl --silent --location https://github.com/groonga/groonga/raw/master/data/travis/setup.sh | sh
-curl --silent --location https://github.com/groonga/groonga-normalizer-mysql/raw/master/data/travis/setup.sh | sh
-# curl --silent --location https://github.com/clear-code/cutter/raw/master/data/travis/setup.sh | sh
+if [ "${MROONGA_BUNDLED}" = "yes" ]; then
+ mkdir -p .mroonga
+ mv * .mroonga/
+ mv .mroonga/tools ./
+ sudo apt-get -qq -y build-dep mysql-server
+ # Support MariaDB for now.
+ download_base=${mariadb_download_base}/${MYSQL_VERSION}
+ tar_gz=${MYSQL_VERSION}.tar.gz
+ curl -O ${download_base}/source/${tar_gz}
+ tar xzf $tar_gz
+ mv ${MYSQL_VERSION}/* ./
+ rm -rf storage/mroonga
+ mv .mroonga storage/mroonga
+ rm -rf ${MYSQL_VERSION}
+ git clone --recursive --depth 1 \
+ https://github.com/groonga/groonga.git \
+ storage/mroonga/vendor/groonga
+ git clone --recursive --depth 1 \
+ https://github.com/groonga/groonga-normalizer-mysql.git \
+ storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql
+else
+ curl --silent --location \
+ https://github.com/groonga/groonga/raw/master/data/travis/setup.sh | sh
+ curl --silent --location \
+ https://github.com/groonga/groonga-normalizer-mysql/raw/master/data/travis/setup.sh | sh
+ # curl --silent --location \
+ # https://github.com/clear-code/cutter/raw/master/data/travis/setup.sh | sh
-if [ ! -f /usr/lib/groonga/plugins/tokenizers/mecab.so ]; then
+ if [ ! -f /usr/lib/groonga/plugins/tokenizers/mecab.so ]; then
sudo apt-get -qq -y install groonga-tokenizer-mecab
-fi
+ fi
-if [ "${MROONGA_BUNDLED}" = "yes" ]; then
- mkdir -p .mroonga
- mv * .mroonga/
- mv .mroonga/tools ./
- sudo apt-get -qq -y build-dep mysql-server
- # Support MariaDB for now.
- download_base=${mariadb_download_base}/${MYSQL_VERSION}
- tar_gz=${MYSQL_VERSION}.tar.gz
- curl -O ${download_base}/source/${tar_gz}
- tar xzf $tar_gz
- mv ${MYSQL_VERSION}/* ./
- mv .mroonga storage/mroonga
- rm -rf ${MYSQL_VERSION}
-else
- mkdir -p vendor
- cd vendor
+ mkdir -p vendor
+ cd vendor
- version=$(echo "$MYSQL_VERSION" | sed -e 's/^\(mysql\|mariadb\)-//')
- series=$(echo "$version" | sed -e 's/\.[0-9]*\(-\?[a-z]*\)\?$//g')
- case "$MYSQL_VERSION" in
- mysql-*)
- sudo apt-get -qq update
- sudo apt-get -qq -y build-dep mysql-server
- if [ "$version" = "system" ]; then
- sudo apt-get -qq -y install \
- mysql-server mysql-testsuite libmysqld-dev
- apt-get -qq source mysql-server
- ln -s $(find . -maxdepth 1 -type d | sort | tail -1) mysql
- else
- download_base="http://cdn.mysql.com/Downloads/MySQL-${series}/"
- if [ "$(uname -m)" = "x86_64" ]; then
- architecture=x86_64
- else
- architecture=i686
- fi
- deb=mysql-${version}-debian6.0-${architecture}.deb
- tar_gz=mysql-${version}.tar.gz
- curl -O ${download_base}${deb} &
- curl -O ${download_base}${tar_gz} &
- wait
- sudo apt-get -qq -y install libaio1
- sudo dpkg -i $deb
- tar xzf $tar_gz
- ln -s mysql-${version} mysql
- fi
- ;;
- mariadb-*)
- sudo apt-get -qq -y remove --purge mysql-common
+ version=$(echo "$MYSQL_VERSION" | sed -e 's/^\(mysql\|mariadb\)-//')
+ series=$(echo "$version" | sed -e 's/\.[0-9]*\(-\?[a-z]*\)\?$//g')
+ case "$MYSQL_VERSION" in
+ mysql-*)
+ sudo apt-get -qq update
+ sudo apt-get -qq -y build-dep mysql-server
+ if [ "$version" = "system" ]; then
+ sudo apt-get -qq -y install \
+ mysql-server mysql-server-5.5 mysql-server-core-5.5 \
+ mysql-testsuite libmysqld-dev
+ apt-get -qq source mysql-server
+ ln -s $(find . -maxdepth 1 -type d | sort | tail -1) mysql
+ else
+ download_base="http://cdn.mysql.com/Downloads/MySQL-${series}/"
+ if [ "$(uname -m)" = "x86_64" ]; then
+ architecture=x86_64
+ else
+ architecture=i686
+ fi
+ deb=mysql-${version}-debian6.0-${architecture}.deb
+ tar_gz=mysql-${version}.tar.gz
+ curl -O ${download_base}${deb} &
+ curl -O ${download_base}${tar_gz} &
+ wait
+ sudo apt-get -qq -y install libaio1
+ sudo dpkg -i $deb
+ tar xzf $tar_gz
+ ln -s mysql-${version} mysql
+ fi
+ ;;
+ mariadb-*)
+ sudo apt-get -qq -y remove --purge mysql-common
- distribution=$(lsb_release --short --id | tr 'A-Z' 'a-z')
- code_name=$(lsb_release --short --codename)
- component=main
- apt_url_base="${mariadb_download_base}/repo/${series}"
- cat <<EOF | sudo tee /etc/apt/sources.list.d/mariadb.list
+ distribution=$(lsb_release --short --id | tr 'A-Z' 'a-z')
+ code_name=$(lsb_release --short --codename)
+ component=main
+ apt_url_base="${mariadb_download_base}/repo/${series}"
+ cat <<EOF | sudo tee /etc/apt/sources.list.d/mariadb.list
deb ${apt_url_base}/${distribution}/ ${code_name} ${component}
deb-src ${apt_url_base}/${distribution}/ ${code_name} ${component}
EOF
- sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db
- sudo apt-get -qq update
- sudo apt-get -qq -y build-dep mariadb-server
- sudo apt-get -qq -y install \
- mariadb-server libmariadbclient-dev mariadb-test
- apt-get -qq source mariadb-server
- ln -s $(find . -maxdepth 1 -type d | sort | tail -1) mysql
- ;;
- esac
+ sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db
+ sudo apt-get -qq update
+ sudo apt-get -qq -y build-dep mariadb-server
+ sudo apt-get -qq -y install \
+ mariadb-server libmariadbclient-dev mariadb-test
+ apt-get -qq source mariadb-server
+ ln -s $(find . -maxdepth 1 -type d | sort | tail -1) mysql
+ ;;
+ esac
- cd ..
+ cd ..
fi
diff --git a/storage/mroonga/tools/travis/script.sh b/storage/mroonga/tools/travis/script.sh
index 632a4db7a7e..6ea5c86068b 100755
--- a/storage/mroonga/tools/travis/script.sh
+++ b/storage/mroonga/tools/travis/script.sh
@@ -1,6 +1,6 @@
#!/bin/bash
#
-# Copyright(C) 2012-2014 Kouhei Sutou <kou@clear-code.com>
+# Copyright(C) 2012-2015 Kouhei Sutou <kou@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -24,95 +24,95 @@ top_dir="${base_dir}/../.."
bundled_mroonga_dir="${top_dir}/storage/mroonga"
if [ -f "${bundled_mroonga_dir}/config.sh" ]; then
- mroonga_dir="${bundled_mroonga_dir}"
- . "${bundled_mroonga_dir}/config.sh"
+ mroonga_dir="${bundled_mroonga_dir}"
+ . "${bundled_mroonga_dir}/config.sh"
else
- mroonga_dir="${top_dir}"
- . "${top_dir}/config.sh"
+ mroonga_dir="${top_dir}"
+ . "${top_dir}/config.sh"
fi
n_processors="$(grep '^processor' /proc/cpuinfo | wc -l)"
max_n_processors=8
if (( $n_processors > $max_n_processors )); then
- n_processors=$max_n_processors
+ n_processors=$max_n_processors
fi
build()
{
- if [ "${MROONGA_BUNDLED}" = "yes" ]; then
- make > /dev/null
- else
- make -j${n_processors} > /dev/null
- fi
+ if [ "${MROONGA_BUNDLED}" = "yes" ]; then
+ make -j${n_processors} > /dev/null
+ else
+ make -j${n_processors} > /dev/null
+ fi
}
run_unit_test()
{
- if [ "${MROONGA_BUNDLED}" != "yes" ]; then
- NO_MAKE=yes ${mroonga_dir}/test/run-unit-test.sh
- fi
+ if [ "${MROONGA_BUNDLED}" != "yes" ]; then
+ NO_MAKE=yes ${mroonga_dir}/test/run-unit-test.sh
+ fi
}
prepare_mysql_test_dir()
{
- mysql_test_dir=/usr/mysql-test
- if [ -d /usr/lib/mysql-testsuite/ ]; then
- sudo cp -a /usr/lib/mysql-testsuite/ ${mysql_test_dir}/
- elif [ -d /usr/share/mysql/mysql-test/ ]; then
- sudo cp -a /usr/share/mysql/mysql-test/ ${mysql_test_dir}/
- elif [ -d /opt/mysql/ ]; then
- mysql_test_dir=$(echo /opt/mysql/server-*/mysql-test)
- else
- sudo cp -a ${MYSQL_SOURCE_DIR}/mysql-test/ ${mysql_test_dir}/
- fi
- sudo chown -R $(id -u):$(id -g) ${mysql_test_dir}/
+ mysql_test_dir=/usr/mysql-test
+ if [ -d /usr/lib/mysql-testsuite/ ]; then
+ sudo cp -a /usr/lib/mysql-testsuite/ ${mysql_test_dir}/
+ elif [ -d /usr/share/mysql/mysql-test/ ]; then
+ sudo cp -a /usr/share/mysql/mysql-test/ ${mysql_test_dir}/
+ elif [ -d /opt/mysql/ ]; then
+ mysql_test_dir=$(echo /opt/mysql/server-*/mysql-test)
+ else
+ sudo cp -a ${MYSQL_SOURCE_DIR}/mysql-test/ ${mysql_test_dir}/
+ fi
+ sudo chown -R $(id -u):$(id -g) ${mysql_test_dir}/
- cp -a ${mroonga_dir}/mysql-test/mroonga/ ${mysql_test_dir}/suite/
+ cp -a ${mroonga_dir}/mysql-test/mroonga/ ${mysql_test_dir}/suite/
}
collect_test_suite_names()
{
- cd ${mysql_test_dir}/suite/
- test_suite_names=""
- for test_suite_name in $(find mroonga -type d '!' -name '[tr]'); do
- if [ -n "${test_suite_names}" ]; then
- test_suite_names="${test_suite_names},"
- fi
- test_suite_names="${test_suite_names}${test_suite_name}"
- done
- cd -
+ cd ${mysql_test_dir}/suite/
+ test_suite_names=""
+ for test_suite_name in $(find mroonga -type d '!' -name '[tr]'); do
+ if [ -n "${test_suite_names}" ]; then
+ test_suite_names="${test_suite_names},"
+ fi
+ test_suite_names="${test_suite_names}${test_suite_name}"
+ done
+ cd -
}
prepare_sql_test()
{
- sudo make install > /dev/null
- prepare_mysql_test_dir
- collect_test_suite_names
+ sudo make install > /dev/null
+ prepare_mysql_test_dir
+ collect_test_suite_names
}
run_sql_test()
{
- test_args=()
- if [ "${MROONGA_TEST_EMBEDDED}" = "yes" ]; then
- test_args=("${test_args[@]}" "--embedded-server")
- fi
+ test_args=()
+ if [ "${MROONGA_TEST_EMBEDDED}" = "yes" ]; then
+ test_args=("${test_args[@]}" "--embedded-server")
+ fi
- if [ "${MROONGA_BUNDLED}" = "yes" ]; then
- ${mroonga_dir}/test/run-sql-test.sh \
- "${test_args[@]}" \
- --parallel="${n_processors}"
- else
- prepare_sql_test
+ if [ "${MROONGA_BUNDLED}" = "yes" ]; then
+ ${mroonga_dir}/test/run-sql-test.sh \
+ "${test_args[@]}" \
+ --parallel="${n_processors}"
+ else
+ prepare_sql_test
- cd ${mysql_test_dir}/
- ./mysql-test-run.pl \
- "${test_args[@]}" \
- --no-check-testcases \
- --parallel="${n_processors}" \
- --retry=1 \
- --suite="${test_suite_names}" \
- --force
- fi
+ cd ${mysql_test_dir}/
+ ./mysql-test-run.pl \
+ "${test_args[@]}" \
+ --no-check-testcases \
+ --parallel="${n_processors}" \
+ --retry=1 \
+ --suite="${test_suite_names}" \
+ --force
+ fi
}
build
diff --git a/storage/mroonga/udf/mrn_udf_command.cpp b/storage/mroonga/udf/mrn_udf_command.cpp
index ba92e8daa26..d14f3ffd49d 100644
--- a/storage/mroonga/udf/mrn_udf_command.cpp
+++ b/storage/mroonga/udf/mrn_udf_command.cpp
@@ -25,11 +25,12 @@
#include <mrn_windows.hpp>
#include <mrn_macro.hpp>
#include <mrn_database_manager.hpp>
-
-extern mrn::DatabaseManager *mrn_db_manager;
+#include <mrn_variables.hpp>
MRN_BEGIN_DECLS
+extern mrn::DatabaseManager *mrn_db_manager;
+
struct CommandInfo
{
grn_ctx ctx;
@@ -58,8 +59,8 @@ MRN_API my_bool mroonga_command_init(UDF_INIT *initid, UDF_ARGS *args,
initid->maybe_null = 1;
initid->const_item = 1;
- info = (CommandInfo *)my_malloc(sizeof(CommandInfo),
- MYF(MY_WME | MY_ZEROFILL));
+ info = (CommandInfo *)mrn_my_malloc(sizeof(CommandInfo),
+ MYF(MY_WME | MY_ZEROFILL));
if (!info) {
strcpy(message, "mroonga_command(): out of memory");
goto error;
@@ -67,7 +68,7 @@ MRN_API my_bool mroonga_command_init(UDF_INIT *initid, UDF_ARGS *args,
grn_ctx_init(&(info->ctx), 0);
{
- const char *current_db_path = current_thd->db;
+ const char *current_db_path = MRN_THD_DB_PATH(current_thd);
const char *action;
if (current_db_path) {
action = "open database";
@@ -100,7 +101,7 @@ error:
grn_obj_close(&(info->ctx), info->db);
}
grn_ctx_fin(&(info->ctx));
- my_free(info, MYF(0));
+ my_free(info);
}
return TRUE;
}
@@ -163,8 +164,8 @@ MRN_API void mroonga_command_deinit(UDF_INIT *initid)
grn_obj_close(&(info->ctx), info->db);
}
grn_ctx_fin(&(info->ctx));
- info->result.free();
- my_free(info, MYF(0));
+ MRN_STRING_FREE(info->result);
+ my_free(info);
}
}
diff --git a/storage/mroonga/udf/mrn_udf_escape.cpp b/storage/mroonga/udf/mrn_udf_escape.cpp
index ff997e7581f..89b08a1c6d5 100644
--- a/storage/mroonga/udf/mrn_udf_escape.cpp
+++ b/storage/mroonga/udf/mrn_udf_escape.cpp
@@ -1,6 +1,6 @@
/* -*- c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
- Copyright(C) 2013 Kouhei Sutou <kou@clear-code.com>
+ Copyright(C) 2013-2015 Kouhei Sutou <kou@clear-code.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -22,6 +22,7 @@
#include <mrn_path_mapper.hpp>
#include <mrn_windows.hpp>
#include <mrn_macro.hpp>
+#include <mrn_variables.hpp>
MRN_BEGIN_DECLS
@@ -62,8 +63,8 @@ MRN_API my_bool mroonga_escape_init(UDF_INIT *initid, UDF_ARGS *args,
initid->maybe_null = 1;
initid->const_item = 1;
- info = (EscapeInfo *)my_malloc(sizeof(EscapeInfo),
- MYF(MY_WME | MY_ZEROFILL));
+ info = (EscapeInfo *)mrn_my_malloc(sizeof(EscapeInfo),
+ MYF(MY_WME | MY_ZEROFILL));
if (!info) {
strcpy(message, "mroonga_escape(): out of memory");
goto error;
@@ -81,7 +82,7 @@ MRN_API my_bool mroonga_escape_init(UDF_INIT *initid, UDF_ARGS *args,
error:
if (info) {
grn_ctx_fin(&(info->ctx));
- my_free(info, MYF(0));
+ my_free(info);
}
return TRUE;
}
@@ -147,7 +148,7 @@ MRN_API void mroonga_escape_deinit(UDF_INIT *initid)
grn_obj_unlink(&(info->ctx), &(info->target_characters));
grn_obj_unlink(&(info->ctx), &(info->escaped_query));
grn_ctx_fin(&(info->ctx));
- my_free(info, MYF(0));
+ my_free(info);
}
}
diff --git a/storage/mroonga/udf/mrn_udf_snippet.cpp b/storage/mroonga/udf/mrn_udf_snippet.cpp
index 84166a36f16..22ec0884014 100644
--- a/storage/mroonga/udf/mrn_udf_snippet.cpp
+++ b/storage/mroonga/udf/mrn_udf_snippet.cpp
@@ -26,6 +26,7 @@
#include <mrn_windows.hpp>
#include <mrn_table.hpp>
#include <mrn_macro.hpp>
+#include <mrn_variables.hpp>
MRN_BEGIN_DECLS
@@ -170,8 +171,8 @@ MRN_API my_bool mroonga_snippet_init(UDF_INIT *initid, UDF_ARGS *args, char *mes
initid->maybe_null = 1;
initid->const_item = 1;
- if (!(snip_info = (st_mrn_snip_info *) my_malloc(sizeof(st_mrn_snip_info),
- MYF(MY_WME | MY_ZEROFILL))))
+ if (!(snip_info = (st_mrn_snip_info *) mrn_my_malloc(sizeof(st_mrn_snip_info),
+ MYF(MY_WME | MY_ZEROFILL))))
{
strcpy(message, "mroonga_snippet() out of memory");
goto error;
@@ -198,7 +199,7 @@ error:
if (snip_info) {
grn_obj_close(&snip_info->ctx, grn_ctx_db(&snip_info->ctx));
grn_ctx_fin(&snip_info->ctx);
- my_free(snip_info, MYF(0));
+ my_free(snip_info);
}
return TRUE;
}
@@ -292,10 +293,10 @@ MRN_API void mroonga_snippet_deinit(UDF_INIT *initid)
if (snip_info->snippet) {
grn_obj_close(&snip_info->ctx, snip_info->snippet);
}
- snip_info->result_str.free();
+ MRN_STRING_FREE(snip_info->result_str);
grn_obj_close(&snip_info->ctx, grn_ctx_db(&snip_info->ctx));
grn_ctx_fin(&snip_info->ctx);
- my_free(snip_info, MYF(0));
+ my_free(snip_info);
}
}
diff --git a/storage/mroonga/vendor/groonga/CMakeLists.txt b/storage/mroonga/vendor/groonga/CMakeLists.txt
index abaa9911fd6..f1ca174ed50 100644
--- a/storage/mroonga/vendor/groonga/CMakeLists.txt
+++ b/storage/mroonga/vendor/groonga/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright(C) 2012-2014 Brazil
+# Copyright(C) 2012-2015 Brazil
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -20,12 +20,37 @@ cmake_minimum_required(VERSION 2.6.2)
set(GRN_PROJECT_NAME "groonga")
project("${GRN_PROJECT_NAME}")
+if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
+ set(GRN_BUNDLED FALSE)
+else()
+ set(GRN_BUNDLED TRUE)
+endif()
+
+if(MSVC)
+ if(MSVC_VERSION LESS 1800)
+ set(GRN_OLD_MSVC_MESSAGE "Groonga supports only MSVC 2013 or later")
+ if(GRN_BUNDLED)
+ message(STATUS ${GRN_OLD_MSVC_MESSAGE})
+ return()
+ else()
+ message(FATAL_ERROR ${GRN_OLD_MSVC_MESSAGE})
+ endif()
+ endif()
+endif()
+
+if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
+ set(CMAKE_COMPILER_IS_CLANGC ON)
+endif()
+if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+ set(CMAKE_COMPILER_IS_CLANGCXX ON)
+endif()
+
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/base_version" VERSION)
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/version.sh")
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/version.sh" GRN_VERSION)
else()
if(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/version.sh")
- if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
+ if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git" AND EXISTS "/bin/sh")
execute_process(COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/version-gen.sh")
file(READ "${CMAKE_CURRENT_BINARY_DIR}/version.sh" GRN_VERSION)
else()
@@ -44,6 +69,15 @@ include(CheckCXXCompilerFlag)
include(FindPkgConfig)
include(${CMAKE_CURRENT_SOURCE_DIR}/build/cmake_modules/ReadFileList.cmake)
+if(DEFINED GRN_EMBED)
+ set(GRN_EMBED_DEFAULT ${GRN_EMBED})
+else()
+ set(GRN_EMBED_DEFAULT OFF)
+endif()
+option(GRN_EMBED
+ "Build as a static library to embed into an application"
+ ${GRN_EMBED_DEFAULT})
+
set(BIN_DIR "bin")
set(SBIN_DIR "sbin")
set(LIB_DIR "lib")
@@ -53,10 +87,14 @@ set(DATA_DIR "share")
set(GRN_DATA_DIR "${DATA_DIR}/${GRN_PROJECT_NAME}")
set(CONFIG_DIR "etc")
set(GRN_CONFIG_DIR "${CONFIG_DIR}/${GRN_PROJECT_NAME}")
+set(GRN_CONFIG_PATH "${CMAKE_INSTALL_PREFIX}/${GRN_CONFIG_DIR}/groonga.conf")
set(GRN_LOG_PATH
"${CMAKE_INSTALL_PREFIX}/var/log/${GRN_PROJECT_NAME}/${GRN_PROJECT_NAME}.log"
CACHE FILEPATH "log file path")
+set(GRN_DEFAULT_ENCODING
+ "utf8"
+ CACHE STRING "Groonga's default encoding")
set(GRN_DEFAULT_MATCH_ESCALATION_THRESHOLD
0
CACHE STRING "groonga default match escalation threshold")
@@ -69,6 +107,9 @@ set(GRN_DEFAULT_RELATIVE_DOCUMENT_ROOT
set(GRN_DEFAULT_DOCUMENT_ROOT
"${CMAKE_INSTALL_PREFIX}/${GRN_DATA_DIR}/${GRN_DEFAULT_DOCUMENT_ROOT_BASE}"
CACHE PATH "groonga default document root")
+set(GRN_DEFAULT_DB_KEY
+ "auto"
+ CACHE STRING "Groonga's default DB key management algorithm")
set(GRN_STACK_SIZE
1024
CACHE STRING
@@ -96,16 +137,28 @@ set(GRN_RELATIVE_RUBY_SCRIPTS_DIR
set(GRN_RUBY_SCRIPTS_DIR
"${CMAKE_INSTALL_PREFIX}/${GRN_RELATIVE_RUBY_SCRIPTS_DIR}")
+
+if(CMAKE_COMPILER_IS_GNUCC)
+ set(GRN_C_COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS} -std=gnu99")
+endif()
+
+
macro(check_cflag flag)
- check_c_compiler_flag(${flag} "HAVE_C_${flag}")
- if(HAVE_C_${flag})
+ string(REGEX REPLACE "[-=]" "_" temporary_variable_name ${flag})
+ string(TOUPPER "${temporary_variable_name}" temporary_variable_name)
+ set(temporary_variable_name "CFLAG${temporary_variable_name}")
+ check_c_compiler_flag(${flag} ${temporary_variable_name})
+ if(${temporary_variable_name})
set(GRN_C_COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS} ${flag}")
endif()
endmacro()
macro(check_cxxflag flag)
- check_cxx_compiler_flag(${flag} "HAVE_CXX_${flag}")
- if(HAVE_CXX_${flag})
+ string(REGEX REPLACE "[-=]" "_" temporary_variable_name ${flag})
+ string(TOUPPER "${temporary_variable_name}" temporary_variable_name)
+ set(temporary_variable_name "CXXFLAG${temporary_variable_name}")
+ check_cxx_compiler_flag(${flag} ${temporary_variable_name})
+ if(${temporary_variable_name})
set(GRN_CXX_COMPILE_FLAGS "${GRN_CXX_COMPILE_FLAGS} ${flag}")
endif()
endmacro()
@@ -115,7 +168,7 @@ macro(check_build_flag flag)
check_cxxflag(${flag})
endmacro()
-if(CMAKE_COMPILER_IS_GNUCXX)
+if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGCXX)
check_build_flag("-Wall")
check_build_flag("-Wextra")
check_build_flag("-Wno-unused-but-set-variable")
@@ -137,14 +190,18 @@ if(CMAKE_COMPILER_IS_GNUCXX)
check_cxxflag("-fexceptions")
check_cxxflag("-fimplicit-templates")
check_build_flag("-Wno-clobbered")
- if(MRN_GROONGA_BUNDLED)
+endif()
+
+if(NOT DEFINED CMAKE_C_COMPILE_OPTIONS_PIC)
+ # For old CMake
+ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGCXX)
check_build_flag("-fPIC")
endif()
endif()
option(GRN_WITH_DEBUG "enable debug build." OFF)
if(GRN_WITH_DEBUG)
- if(CMAKE_COMPILER_IS_GNUCXX)
+ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGCXX)
set(GRN_C_COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS} -g3 -O0")
set(GRN_CXX_COMPILE_FLAGS "${GRN_CXX_COMPILE_FLAGS} -g3 -O0")
endif()
@@ -154,17 +211,15 @@ add_definitions(
-DHAVE_CONFIG_H
)
-if(CMAKE_COMPILER_IS_GNUC OR
- CMAKE_COMPILER_IS_GNUCXX OR
- CMAKE_C_COMPILER_ID STREQUAL "Clang")
+if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGCXX)
set(_GNU_SOURCE TRUE)
endif()
include_directories(
BEFORE
${CMAKE_CURRENT_BINARY_DIR}
- ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/include
+ ${CMAKE_CURRENT_SOURCE_DIR}/lib
)
macro(ac_check_headers header)
@@ -202,6 +257,7 @@ include(build/ac_macros/check_headers.m4)
include(build/ac_macros/check_functions.m4)
ac_check_symbols(fpclassify math.h)
+ac_check_lib(m fpclassify)
ac_check_lib(dl dlopen)
ac_check_lib(execinfo backtrace)
@@ -214,8 +270,7 @@ ac_check_lib(rt clock_gettime)
if(HAVE_LIBRT)
set(HAVE_CLOCK_GETTIME TRUE)
endif()
-if(MRN_GROONGA_BUNDLED)
- ac_check_lib(m sincos)
+if(GRN_EMBED)
check_library_exists(stdc++ __cxa_begin_catch "${ARG2}"
STDCPP)
if(STDCPP)
@@ -293,19 +348,29 @@ else()
endif()
endif()
-option(GRN_WITH_ZLIB "use zlib for data compression." OFF)
-if(GRN_WITH_ZLIB)
+set(GRN_WITH_ZLIB "auto"
+ CACHE STRING "Support data compression by zlib.")
+if(NOT ${GRN_WITH_ZLIB} STREQUAL "no")
ac_check_lib(z compress)
if(NOT HAVE_LIBZ)
- message(FATAL_ERROR "No libz found")
+ if(${GRN_WITH_ZLIB} STREQUAL "yes")
+ message(FATAL_ERROR "No libz found")
+ endif()
+ set(GRN_WITH_ZLIB "no")
endif()
endif()
-option(GRN_WITH_LZO "use LZO for data compression." OFF)
-if(GRN_WITH_LZO)
- ac_check_lib(lzo2 lzo1_compress)
- if(NOT HAVE_LIBLZO2)
- message(FATAL_ERROR "No liblzo2 found")
+set(GRN_WITH_LZ4 "auto"
+ CACHE STRING "Support data compression by LZ4.")
+if(NOT ${GRN_WITH_LZ4} STREQUAL "no")
+ pkg_check_modules(LIBLZ4 liblz4)
+ if(LIBLZ4_FOUND)
+ set(GRN_WITH_LZ4 TRUE)
+ else()
+ if(${GRN_WITH_LZ4} STREQUAL "yes")
+ message(FATAL_ERROR "No LZ4 found")
+ endif()
+ set(GRN_WITH_LZ4 FALSE)
endif()
endif()
@@ -362,6 +427,38 @@ else()
set(GRN_WITH_KYTEA FALSE)
endif()
+set(GRN_WITH_LIBSTEMMER "auto"
+ CACHE STRING "use libstemmer for stemming token filter")
+if(NOT ${GRN_WITH_LIBSTEMMER} STREQUAL "no")
+ if(NOT ("${GRN_WITH_LIBSTEMMER}" STREQUAL "yes" OR
+ "${GRN_WITH_LIBSTEMMER}" STREQUAL "auto"))
+ if("${LIBSTEMMER_INCLUDE_DIRS}" STREQUAL "")
+ set(LIBSTEMMER_INCLUDE_DIRS "${GRN_WITH_LIBSTEMMER}/include")
+ endif()
+ if("${LIBSTEMMER_LIBRARY_DIRS}" STREQUAL "")
+ set(LIBSTEMMER_LIBRARY_DIRS "${GRN_WITH_LIBSTEMMER}/lib")
+ endif()
+ endif()
+ set(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES})
+ set(CMAKE_REQUIRED_INCLUDES
+ ${CMAKE_REQUIRED_INCLUDES}
+ ${LIBSTEMMER_INCLUDE_DIRS})
+ ac_check_headers(libstemmer.h)
+ ac_check_lib(stemmer sb_stemmer_list "${LIBSTEMMER_LIBRARY_DIRS}")
+ set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE})
+ if(HAVE_LIBSTEMMER_H AND HAVE_LIBSTEMMER)
+ set(LIBSTEMMER_LIBRARIES "stemmer")
+ set(GRN_WITH_LIBSTEMMER TRUE)
+ else()
+ if(${GRN_WITH_LIBSTEMMER} STREQUAL "yes")
+ message(FATAL_ERROR "No libstemmer found")
+ endif()
+ set(GRN_WITH_LIBSTEMMER FALSE)
+ endif()
+else()
+ set(GRN_WITH_LIBSTEMMER FALSE)
+endif()
+
set(GRN_WITH_ZEROMQ "auto"
CACHE STRING "use ZeroMQ for suggestion")
if(NOT ${GRN_WITH_ZEROMQ} STREQUAL "no")
@@ -408,55 +505,67 @@ endif()
set(GRN_WITH_MESSAGE_PACK "auto"
CACHE STRING "use MessagePack for suggestion")
if(NOT ${GRN_WITH_MESSAGE_PACK} STREQUAL "no")
- if("${GRN_WITH_MESSAGE_PACK}" STREQUAL "yes" OR
- "${GRN_WITH_MESSAGE_PACK}" STREQUAL "auto")
- set(MESSAGE_PACK_INCLUDE_DIRS "")
- set(MESSAGE_PACK_LIBRARY_DIRS "")
- else()
- set(MESSAGE_PACK_INCLUDE_DIRS "${GRN_WITH_MESSAGE_PACK}/include")
- set(MESSAGE_PACK_LIBRARY_DIRS "${GRN_WITH_MESSAGE_PACK}/lib")
- endif()
- set(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES})
- ac_check_lib(msgpack msgpack_version "${MESSAGE_PACK_LIBRARY_DIRS}")
- set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE})
- if(HAVE_LIBMSGPACK)
- set(MESSAGE_PACK_LIBRARIES "msgpack")
+ pkg_check_modules(MESSAGE_PACK msgpack)
+ if(MESSAGE_PACK_FOUND)
set(GRN_WITH_MESSAGE_PACK TRUE)
else()
- if(${GRN_WITH_MESSAGE_PACK} STREQUAL "yes")
- message(FATAL_ERROR "No MessagePack found")
+ if("${GRN_WITH_MESSAGE_PACK}" STREQUAL "yes" OR
+ "${GRN_WITH_MESSAGE_PACK}" STREQUAL "auto")
+ set(MESSAGE_PACK_INCLUDE_DIRS "")
+ set(MESSAGE_PACK_LIBRARY_DIRS "")
+ else()
+ set(MESSAGE_PACK_INCLUDE_DIRS "${GRN_WITH_MESSAGE_PACK}/include")
+ set(MESSAGE_PACK_LIBRARY_DIRS "${GRN_WITH_MESSAGE_PACK}/lib")
+ endif()
+ set(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES})
+ ac_check_lib(msgpack msgpack_version "${MESSAGE_PACK_LIBRARY_DIRS}")
+ set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE})
+ if(HAVE_LIBMSGPACK)
+ set(MESSAGE_PACK_LIBRARIES "msgpack")
+ set(GRN_WITH_MESSAGE_PACK TRUE)
+ else()
+ if(${GRN_WITH_MESSAGE_PACK} STREQUAL "yes")
+ message(FATAL_ERROR "No MessagePack found")
+ endif()
+ set(GRN_WITH_MESSAGE_PACK FALSE)
endif()
- set(GRN_WITH_MESSAGE_PACK FALSE)
endif()
else()
set(GRN_WITH_MESSAGE_PACK FALSE)
endif()
+find_program(RUBY NAMES "ruby2.1" "ruby21" "ruby")
+
option(GRN_WITH_MRUBY "use mruby" OFF)
if(GRN_WITH_MRUBY)
- if(CMAKE_VERSION VERSION_LESS "2.8.8")
- message(FATAL_ERROR
- "Your CMake (${CMAKE_VERSION}) is old. "
- "CMake 2.8.8 or later is required for mruby supported build")
- endif()
set(MRUBY_INCLUDE_DIRS
"${CMAKE_CURRENT_SOURCE_DIR}/vendor/mruby-source/include")
- set(MRUBY_LIBS "$<TARGET_OBJECTS:mruby>")
+ set(MRUBY_LIBS mruby)
else()
set(MRUBY_INCLUDE_DIRS "")
set(MRUBY_LIBS "")
endif()
-#add_subdirectory(vendor)
+# TODO: Support using system Onigmo instead of bundled Onigmo.
+# set(GRN_WITH_ONIGMO ON)
+# set(ONIGMO_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/vendor/onigmo-source")
+# set(ONIGMO_LIBS onigmo)
+
+# TODO: It's for Onigmo static link case. If we support system Onigmo,
+# we need to remove it and add -DEXPORT to Onigmo build.
+add_definitions(-DONIG_EXTERN=extern)
+
+add_subdirectory(vendor)
add_subdirectory(lib)
-add_subdirectory(src)
-#add_subdirectory(plugins)
-add_subdirectory(include)
-#add_subdirectory(data)
+if(NOT GRN_EMBED)
+ add_subdirectory(src)
+ add_subdirectory(plugins)
+ add_subdirectory(include)
+ add_subdirectory(data)
+endif()
configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
-set(RUBY "ruby") # TODO: support customization
set(GROONGA "${CMAKE_CURRENT_BINARY_DIR}/src/groonga")
set(GROONGA_SUGGEST_CREATE_DATASET
"${CMAKE_CURRENT_BINARY_DIR}/src/suggest/groonga-suggest-create-dataset")
@@ -476,10 +585,10 @@ set(GRN_EXPANDED_DEFAULT_DOCUMENT_ROOT "${GRN_DEFAULT_DOCUMENT_ROOT}")
set(EXEEXT "${CMAKE_EXECUTABLE_SUFFIX}")
configure_file(groonga.pc.in "${CMAKE_CURRENT_BINARY_DIR}/groonga.pc" @ONLY)
-if(NOT MRN_GROONGA_BUNDLED)
+if(NOT GRN_EMBED)
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/groonga.pc"
DESTINATION "${LIB_DIR}/pkgconfig/")
endif()
-#add_subdirectory(vendor/plugins)
+add_subdirectory(vendor/plugins)
diff --git a/storage/mroonga/vendor/groonga/COPYING b/storage/mroonga/vendor/groonga/COPYING
new file mode 100644
index 00000000000..4362b49151d
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/COPYING
@@ -0,0 +1,502 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should 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
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
diff --git a/storage/mroonga/vendor/groonga/Makefile.am b/storage/mroonga/vendor/groonga/Makefile.am
index a5bf404d471..6f760a52b30 100644
--- a/storage/mroonga/vendor/groonga/Makefile.am
+++ b/storage/mroonga/vendor/groonga/Makefile.am
@@ -69,7 +69,6 @@ update-latest-release: misc
misc/update-latest-release.rb \
$(PACKAGE) $(OLD_RELEASE) $(OLD_RELEASE_DATE) \
$(VERSION) $(NEW_RELEASE_DATE) \
- packages/rpm/fedora/groonga.spec.in \
packages/rpm/centos/groonga.spec.in \
packages/debian/changelog \
doc/source/install.rst \
@@ -86,7 +85,7 @@ update-po:
update-document:
@if test -z "$(GROONGA_ORG_PATH)"; then \
echo "\$$(GROONGA_ORG_PATH) is missing"; \
- echo "add --with-groonga-github-com-path in configure"; \
+ echo "add --with-groonga-org-path in configure"; \
exit 1; \
fi
rm -rf tmp-doc
diff --git a/storage/mroonga/vendor/groonga/appveyor.yml b/storage/mroonga/vendor/groonga/appveyor.yml
new file mode 100644
index 00000000000..d755e6b49fd
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/appveyor.yml
@@ -0,0 +1,19 @@
+version: "{build}"
+clone_depth: 10
+build_script:
+ - git submodule update --init
+ - cmake . -G "Visual Studio 12 2013 Win64"
+ - cmake --build . --config Debug
+
+notifications:
+ - provider: Email
+ to:
+ - kou@clear-code.com
+ - groonga-commit@lists.sourceforge.jp
+ on_build_status_changed: true
+
+test: off
+# before_test:
+# - gem install grntest
+# test_script:
+# - grntest --groonga src\groonga.exe --base-directory test\command test\command\suite
diff --git a/storage/mroonga/vendor/groonga/autogen.sh b/storage/mroonga/vendor/groonga/autogen.sh
index 9b3a98eab5d..66184bf13be 100755
--- a/storage/mroonga/vendor/groonga/autogen.sh
+++ b/storage/mroonga/vendor/groonga/autogen.sh
@@ -18,4 +18,9 @@ FreeBSD)
;;
esac
+if [ ! -e vendor/mruby-source/.git ]; then
+ rm -rf vendor/mruby-source
+fi
+git submodule update --init
+
${AUTORECONF:-autoreconf} --force --install
diff --git a/storage/mroonga/vendor/groonga/base_version b/storage/mroonga/vendor/groonga/base_version
index 9eefef7bd65..26611488b0a 100644
--- a/storage/mroonga/vendor/groonga/base_version
+++ b/storage/mroonga/vendor/groonga/base_version
@@ -1 +1 @@
-4.0.6 \ No newline at end of file
+5.0.3 \ No newline at end of file
diff --git a/storage/mroonga/vendor/groonga/benchmark/bench-geo-distance.c b/storage/mroonga/vendor/groonga/benchmark/bench-geo-distance.c
index 8e1d819538b..72d1d79b73f 100644
--- a/storage/mroonga/vendor/groonga/benchmark/bench-geo-distance.c
+++ b/storage/mroonga/vendor/groonga/benchmark/bench-geo-distance.c
@@ -49,7 +49,7 @@
#include <string.h>
-#include <db.h>
+#include <grn_db.h>
#include <groonga.h>
#include "lib/benchmark.h"
diff --git a/storage/mroonga/vendor/groonga/benchmark/bench-geo-select.c b/storage/mroonga/vendor/groonga/benchmark/bench-geo-select.c
index b934f225330..7b57eaaffdc 100644
--- a/storage/mroonga/vendor/groonga/benchmark/bench-geo-select.c
+++ b/storage/mroonga/vendor/groonga/benchmark/bench-geo-select.c
@@ -58,7 +58,7 @@
#include <string.h>
-#include <db.h>
+#include <grn_db.h>
#include <groonga.h>
#include "lib/benchmark.h"
diff --git a/storage/mroonga/vendor/groonga/benchmark/bench-range-select.c b/storage/mroonga/vendor/groonga/benchmark/bench-range-select.c
index 4c0b500aae2..d45d453cba6 100644
--- a/storage/mroonga/vendor/groonga/benchmark/bench-range-select.c
+++ b/storage/mroonga/vendor/groonga/benchmark/bench-range-select.c
@@ -53,7 +53,7 @@
#include <stdio.h>
#include <string.h>
-#include <db.h>
+#include <grn_db.h>
#include <groonga.h>
#include "lib/benchmark.h"
diff --git a/storage/mroonga/vendor/groonga/bindings/php/groonga.dsp b/storage/mroonga/vendor/groonga/bindings/php/groonga.dsp
new file mode 100644
index 00000000000..dd7c91ce736
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/bindings/php/groonga.dsp
@@ -0,0 +1,112 @@
+# Microsoft Developer Studio Project File - Name="groonga" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=groonga - Win32 Debug_TS
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "groonga.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "groonga.mak" CFG="groonga - Win32 Debug_TS"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "groonga - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "groonga - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "groonga - Win32 Release_TS"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release_TS"
+# PROP BASE Intermediate_Dir "Release_TS"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release_TS"
+# PROP Intermediate_Dir "Release_TS"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GROONGA_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D "WIN32" /D "PHP_EXPORTS" /D "COMPILE_DL_GROONGA" /D ZTS=1 /D HAVE_GROONGA=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x407 /d "NDEBUG"
+# ADD RSC /l 0x407 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS\php_groonga.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
+
+!ELSEIF "$(CFG)" == "groonga - Win32 Debug_TS"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug_TS"
+# PROP BASE Intermediate_Dir "Debug_TS"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug_TS"
+# PROP Intermediate_Dir "Debug_TS"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GROONGA_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "PHP_EXPORTS" /D "COMPILE_DL_GROONGA" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GROONGA=1 /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x407 /d "_DEBUG"
+# ADD RSC /l 0x407 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS\php_groonga.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
+
+!ENDIF
+
+# Begin Target
+
+# Name "groonga - Win32 Release_TS"
+# Name "groonga - Win32 Debug_TS"
+
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+
+# Begin Source File
+
+SOURCE=./groonga.c
+# End Source File
+
+# End Group
+
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+
+# Begin Source File
+
+SOURCE=.\php_groonga.h
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/storage/mroonga/vendor/groonga/build/ac_macros/check_functions.m4 b/storage/mroonga/vendor/groonga/build/ac_macros/check_functions.m4
index 5046e8ce6ab..02eb52f30a6 100644
--- a/storage/mroonga/vendor/groonga/build/ac_macros/check_functions.m4
+++ b/storage/mroonga/vendor/groonga/build/ac_macros/check_functions.m4
@@ -1,13 +1,13 @@
# -*- autoconf -*-
+AC_CHECK_FUNCS(_gmtime64_s)
+AC_CHECK_FUNCS(_localtime64_s)
+AC_CHECK_FUNCS(_stricmp)
AC_CHECK_FUNCS(_strnicmp)
AC_CHECK_FUNCS(_strtoui64)
-AC_CHECK_FUNCS(close)
AC_CHECK_FUNCS(gmtime_r)
AC_CHECK_FUNCS(localtime_r)
-AC_CHECK_FUNCS(mkostemp)
-AC_CHECK_FUNCS(open)
-AC_CHECK_FUNCS(read)
+AC_CHECK_FUNCS(mkstemp)
+AC_CHECK_FUNCS(strcasecmp)
AC_CHECK_FUNCS(strncasecmp)
AC_CHECK_FUNCS(strtoull)
-AC_CHECK_FUNCS(write)
diff --git a/storage/mroonga/vendor/groonga/build/ac_macros/check_headers.m4 b/storage/mroonga/vendor/groonga/build/ac_macros/check_headers.m4
index 513f61afac4..2a7e0f03acc 100644
--- a/storage/mroonga/vendor/groonga/build/ac_macros/check_headers.m4
+++ b/storage/mroonga/vendor/groonga/build/ac_macros/check_headers.m4
@@ -1,15 +1,20 @@
# -*- autoconf -*-
+AC_CHECK_HEADERS(dirent.h)
AC_CHECK_HEADERS(dlfcn.h)
AC_CHECK_HEADERS(errno.h)
AC_CHECK_HEADERS(execinfo.h)
AC_CHECK_HEADERS(inttypes.h)
+AC_CHECK_HEADERS(io.h)
AC_CHECK_HEADERS(netdb.h)
AC_CHECK_HEADERS(netinet/in.h)
AC_CHECK_HEADERS(netinet/tcp.h)
AC_CHECK_HEADERS(signal.h)
+AC_CHECK_HEADERS(stdarg.h)
AC_CHECK_HEADERS(stdint.h)
AC_CHECK_HEADERS(stdlib.h)
+AC_CHECK_HEADERS(string.h)
+AC_CHECK_HEADERS(strings.h)
AC_CHECK_HEADERS(sys/mman.h)
AC_CHECK_HEADERS(sys/param.h)
AC_CHECK_HEADERS(sys/resource.h)
diff --git a/storage/mroonga/vendor/groonga/build/makefiles/gettext.am b/storage/mroonga/vendor/groonga/build/makefiles/gettext.am
index 9706b485dd1..9cea8ce63c1 100644
--- a/storage/mroonga/vendor/groonga/build/makefiles/gettext.am
+++ b/storage/mroonga/vendor/groonga/build/makefiles/gettext.am
@@ -1,6 +1,8 @@
include $(top_srcdir)/doc/files.am
include $(top_srcdir)/build/makefiles/sphinx-build.am
+CLEANFILES =
+
EXTRA_DIST += \
$(po_files)
@@ -11,9 +13,11 @@ endif
if DOCUMENT_BUILDABLE
BUILT_SOURCES += \
+ mo-build-stamp
+CLEANFILES += \
pot-build-stamp \
edit-po-build-stamp \
- $(mo_files)
+ mo-build-stamp
endif
SUFFIXES += .pot .po .mo .edit
@@ -47,8 +51,8 @@ SUFFIXES += .pot .po .mo .edit
msgfmt -o $@ $<
if DOCUMENT_BUILDABLE
-update: pot-build-stamp edit-po-build-stamp
-build: update $(mo_files)
+update: edit-po-build-stamp
+build: mo-build-stamp
else
update:
build:
@@ -68,6 +72,15 @@ pot-build-stamp: $(absolute_source_files)
$(MAKE) gettext
@touch $@
-edit-po-build-stamp: $(absolute_source_files)
+edit-po-build-stamp: pot-build-stamp
$(MAKE) $(edit_po_files)
@touch $@
+
+mo_build_stamp_dependencies = edit-po-build-stamp
+if DOCUMENT_BUILDABLE
+mo_build_stamp_dependencies += $(edit_po_files)
+endif
+
+mo-build-stamp: $(mo_build_stamp_dependencies)
+ $(MAKE) $(mo_files)
+ @touch $@
diff --git a/storage/mroonga/vendor/groonga/build/makefiles/sphinx.am b/storage/mroonga/vendor/groonga/build/makefiles/sphinx.am
index f84fb23b739..c68f62e26ec 100644
--- a/storage/mroonga/vendor/groonga/build/makefiles/sphinx.am
+++ b/storage/mroonga/vendor/groonga/build/makefiles/sphinx.am
@@ -106,7 +106,7 @@ help:
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
man: man-build-stamp
-html: html-build-stamp
+html: html-recursive html-build-stamp
dirhtml: dirhtml-build-stamp
pickle: pickle-build-stamp
json: json-build-stamp
diff --git a/storage/mroonga/vendor/groonga/config.h.cmake b/storage/mroonga/vendor/groonga/config.h.cmake
index d172bc36dba..cd8e4f6cc2d 100644
--- a/storage/mroonga/vendor/groonga/config.h.cmake
+++ b/storage/mroonga/vendor/groonga/config.h.cmake
@@ -83,20 +83,22 @@
#cmakedefine GRN_WITH_BENCHMARK
#cmakedefine GRN_WITH_CUTTER
#cmakedefine GRN_WITH_KYTEA
-#cmakedefine GRN_WITH_LIBMEMCACHED
-#cmakedefine GRN_WITH_LZO
+#cmakedefine GRN_WITH_LZ4
#cmakedefine GRN_WITH_MECAB
#cmakedefine GRN_WITH_MESSAGE_PACK
#cmakedefine GRN_WITH_MRUBY
#cmakedefine GRN_WITH_NFKC
+#cmakedefine GRN_WITH_ONIGMO
#cmakedefine GRN_WITH_ZEROMQ
#cmakedefine GRN_WITH_ZLIB
/* headers */
+#cmakedefine HAVE_DIRENT_H
#cmakedefine HAVE_DLFCN_H
#cmakedefine HAVE_ERRNO_H
#cmakedefine HAVE_EXECINFO_H
#cmakedefine HAVE_INTTYPES_H
+#cmakedefine HAVE_IO_H
#cmakedefine HAVE_LINUX_FUTEX_H
#cmakedefine HAVE_MEMORY_H
#cmakedefine HAVE_NETDB_H
@@ -104,6 +106,7 @@
#cmakedefine HAVE_NETINET_TCP_H
#cmakedefine HAVE_PTHREAD_H
#cmakedefine HAVE_SIGNAL_H
+#cmakedefine HAVE_STDARG_H
#cmakedefine HAVE_STDINT_H
#cmakedefine HAVE_STDLIB_H
#cmakedefine HAVE_STRINGS_H
@@ -133,20 +136,20 @@
#cmakedefine HAVE_MECAB_DICTIONARY_INFO_T
/* functions */
+#cmakedefine HAVE__GMTIME64_S
+#cmakedefine HAVE__LOCALTIME64_S
+#cmakedefine HAVE__STRICMP
#cmakedefine HAVE__STRNICMP
#cmakedefine HAVE__STRTOUI64
#cmakedefine HAVE_BACKTRACE
#cmakedefine HAVE_CLOCK
#cmakedefine HAVE_CLOCK_GETTIME
-#cmakedefine HAVE_CLOSE
#cmakedefine HAVE_FPCLASSIFY
#cmakedefine HAVE_GMTIME_R
#cmakedefine HAVE_LOCALTIME_R
-#cmakedefine HAVE_MKOSTEMP
-#cmakedefine HAVE_OPEN
-#cmakedefine HAVE_READ
+#cmakedefine HAVE_MKSTEMP
+#cmakedefine HAVE_STRCASECMP
#cmakedefine HAVE_STRNCASECMP
#cmakedefine HAVE_STRTOULL
-#cmakedefine HAVE_WRITE
#cmakedefine HAVE_PTHREAD_MUTEXATTR_SETPSHARED
#cmakedefine HAVE_PTHREAD_CONDATTR_SETPSHARED
diff --git a/storage/mroonga/vendor/groonga/config.sh.in b/storage/mroonga/vendor/groonga/config.sh.in
index b4cec3caba1..d15e5e366e7 100644
--- a/storage/mroonga/vendor/groonga/config.sh.in
+++ b/storage/mroonga/vendor/groonga/config.sh.in
@@ -4,3 +4,4 @@ export GROONGA="@GROONGA@"
export GROONGA_HTTPD="@GROONGA_HTTPD@"
export GROONGA_SUGGEST_CREATE_DATASET="@GROONGA_SUGGEST_CREATE_DATASET@"
export GROONGA_BENCHMARK="@GROONGA_BENCHMARK@"
+export GROONGA_MRUBY="@GROONGA_MRUBY@"
diff --git a/storage/mroonga/vendor/groonga/configure.ac b/storage/mroonga/vendor/groonga/configure.ac
index 2be82a165e2..17f3abcc2ed 100644
--- a/storage/mroonga/vendor/groonga/configure.ac
+++ b/storage/mroonga/vendor/groonga/configure.ac
@@ -75,7 +75,8 @@ AC_MSG_RESULT([$solaris])
AC_C_BIGENDIAN
AC_PROG_CXX
AC_PROG_CC
-AC_PROG_CC_C99
+m4_ifdef([AC_PROG_CC_C99],
+ [AC_PROG_CC_C99])
AM_PROG_CC_C_O
m4_ifdef([PKG_PROG_PKG_CONFIG],
[PKG_PROG_PKG_CONFIG([0.19])
@@ -140,6 +141,7 @@ AC_DEFUN([REMOVE_CXXFLAG], [
TEST_CFLAGS=""
TEST_CXXFLAGS=""
NO_STRICT_ALIASING_CFLAGS=""
+NO_FLOAT_EQUAL_CFLAGS=""
if test "$GCC" = "yes"; then
CHECK_BUILD_FLAG([-Wall])
CHECK_BUILD_FLAG([-Wextra])
@@ -159,8 +161,10 @@ if test "$GCC" = "yes"; then
fi
CHECK_BUILD_FLAG([-Wdisabled-optimization])
CHECK_BUILD_FLAG([-Wfloat-equal])
+ if test "x$check_cflag" = "xyes"; then
+ NO_FLOAT_EQUAL_CFLAGS="-Wno-float-equal"
+ fi
CHECK_BUILD_FLAG([-Wpointer-arith])
- CHECK_CFLAG([-Wdeclaration-after-statement])
CHECK_CFLAG([-Wbad-function-cast])
if test "$CLANG" = "no"; then
CHECK_BUILD_FLAG([-Wcast-align])
@@ -192,6 +196,7 @@ fi
AC_SUBST(TEST_CFLAGS)
AC_SUBST(TEST_CXXFLAGS)
AC_SUBST(NO_STRICT_ALIASING_CFLAGS)
+AC_SUBST(NO_FLOAT_EQUAL_CFLAGS)
AC_LIBTOOL_WIN32_DLL
AM_PROG_LIBTOOL
@@ -210,7 +215,7 @@ GRN_DLL_FILENAME="libgroonga-\$(LT_CURRENT).dll"
AC_SUBST(GRN_DLL_FILENAME)
if test "$srcdir/version.sh"; then
- source "$srcdir/version.sh"
+ . "$srcdir/version.sh"
AC_SUBST(GRN_VERSION)
AC_DEFINE_UNQUOTED(GRN_VERSION, ["$GRN_VERSION"], [groonga version])
fi
@@ -226,6 +231,10 @@ AC_CONFIG_FILES([
lib/dat/Makefile
lib/mrb/Makefile
lib/mrb/scripts/Makefile
+ lib/mrb/scripts/command_line/Makefile
+ lib/mrb/scripts/context/Makefile
+ lib/mrb/scripts/initialize/Makefile
+ lib/mrb/scripts/logger/Makefile
include/Makefile
include/groonga/Makefile
plugins/Makefile
@@ -235,6 +244,8 @@ AC_CONFIG_FILES([
plugins/query_expanders/Makefile
plugins/ruby/Makefile
plugins/token_filters/Makefile
+ plugins/sharding/Makefile
+ plugins/functions/Makefile
examples/Makefile
examples/dictionary/Makefile
examples/dictionary/edict/Makefile
@@ -246,7 +257,6 @@ AC_CONFIG_FILES([
packages/ubuntu/Makefile
packages/rpm/Makefile
packages/rpm/centos/Makefile
- packages/rpm/fedora/Makefile
packages/yum/Makefile
packages/source/Makefile
packages/windows/Makefile
@@ -684,6 +694,10 @@ AC_SUBST(GROONGA_BENCHMARK)
GROONGA_SUGGEST_CREATE_DATASET="${ac_pwd}/src/suggest/groonga-suggest-create-dataset"
AC_SUBST(GROONGA_SUGGEST_CREATE_DATASET)
+# groonga-mruby binary path
+GROONGA_MRUBY="${ac_pwd}/src/groonga-mruby"
+AC_SUBST(GROONGA_MRUBY)
+
# check Cutter with GLib support if available
REQUIRED_MINIMUM_CUTTER_VERSION=1.1.6
REQUIRED_MINIMUM_CPPCUTTER_VERSION=1.2.0
@@ -867,28 +881,64 @@ fi
# zlib
AC_ARG_WITH(zlib,
[AS_HELP_STRING([--with-zlib],
- [use zlib for data compression. [default=no]])],
+ [Support data compression by zlib. [default=auto]])],
[with_zlib="$withval"],
- [with_zlib="no"])
+ [with_zlib="auto"])
GRN_WITH_ZLIB=no
-if test "x$with_zlib" = "xyes"; then
- AC_DEFINE(GRN_WITH_ZLIB, [1], [with zlib])
- AC_SEARCH_LIBS(compress, z, [GRN_WITH_ZLIB=yes],
- [AC_MSG_ERROR("No libz found")])
-else
- AC_SEARCH_LIBS(compress, z, [GRN_WITH_ZLIB=yes], [])
+if test "x$with_zlib" != "xno"; then
+ # TODO: Support custom zlib include and lib directory by --with-zlib.
+ AC_SEARCH_LIBS(compress, z,
+ [
+ GRN_WITH_ZLIB=yes
+ AC_DEFINE(GRN_WITH_ZLIB, [1],
+ [Support data compression by zlib.])
+ ],
+ [
+ if test "x$with_zlib" != "xauto"; then
+ AC_MSG_ERROR("No libz found")
+ fi
+ ])
fi
AC_SUBST(GRN_WITH_ZLIB)
-# LZO
-AC_ARG_WITH(lzo,
- [AS_HELP_STRING([--with-lzo],
- [use LZO for data compression. [default=no]])],
- [with_lzo="$withval"],
- [with_lzo="no"])
-if test "x$with_lzo" = "xyes"; then
- AC_DEFINE(GRN_WITH_LZO, [1], [with lzo])
- AC_SEARCH_LIBS(lzo1_compress, lzo2, [], [AC_MSG_ERROR("No liblzo2 found")])
+# LZ4
+AC_ARG_WITH(lz4,
+ [AS_HELP_STRING([--with-lz4],
+ [Support data compression by LZ4. [default=auto]])],
+ [with_lz4="$withval"],
+ [with_lz4="auto"])
+if test "x$with_lz4" != "xno"; then
+ m4_ifdef([PKG_CHECK_MODULES], [
+ PKG_CHECK_MODULES([LIBLZ4],
+ [liblz4],
+ [GRN_WITH_LZ4=yes],
+ [GRN_WITH_LZ4=no])
+ ],
+ [GRN_WITH_LZ4=no])
+ if test "$GRN_WITH_LZ4" = "yes"; then
+ AC_DEFINE(GRN_WITH_LZ4, [1],
+ [Support data compression by LZ4.])
+ else
+ if test "x$with_lz4" != "xauto"; then
+ AC_MSG_ERROR("No liblz4 found")
+ fi
+ fi
+fi
+
+# jemalloc
+AC_ARG_WITH(jemalloc,
+ [AS_HELP_STRING([--with-jemalloc],
+ [Use jemalloc for memory allocation. [default=no]])],
+ [with_jemalloc="$withval"],
+ [with_jemalloc="no"])
+jemalloc_available="no"
+if test "x$with_jemalloc" != "xno"; then
+ if test "x$with_jemalloc" != "xyes"; then
+ LDFLAGS="-L$with_jemalloc $LDFLAGS"
+ fi
+ AC_SEARCH_LIBS(malloc_conf, jemalloc,
+ [jemalloc_available="yes"],
+ [AC_MSG_ERROR("No libjemalloc found")])
fi
# MeCab
@@ -973,6 +1023,63 @@ if test "x$with_kytea" = "xyes"; then
fi
AM_CONDITIONAL(WITH_KYTEA, test "x$with_kytea" = "xyes")
+# libstemmer
+AC_ARG_WITH(libstemmer,
+ [AS_HELP_STRING([--with-libstemmer],
+ [use libstemmer for stemming. [default=auto]])],
+ [with_libstemmer="$withval"],
+ [with_libstemmer="auto"])
+AC_ARG_WITH(libstemmer-include,
+ [AS_HELP_STRING([--with-libstemmer-include],
+ [path to libstemmer.h. [default=auto]])])
+AC_ARG_WITH(libstemmer-lib,
+ [AS_HELP_STRING([--with-libstemmer-lib],
+ [path to libstemmer.so. [default=auto]])])
+AC_MSG_CHECKING([whether enable libstemmer])
+AC_MSG_RESULT($with_libstemmer)
+if test "x$with_libstemmer" != "xno"; then
+ LIBSTEMMER_CFLAGS=""
+ LIBSTEMMER_LDFLAGS=""
+ LIBSTEMMER_LIBS=""
+
+ CFLAGS_save="${CFLAGS}"
+ LDFLAGS_save="${LDFLAGS}"
+ if test "x$with_libstemmer" != "xauto"; then
+ if test -z "${with_libstemmer_include}"; then
+ with_libstemmer_include="${with_libstemmer}/include"
+ fi
+ LIBSTEMMER_CFLAGS="-I${with_libstemmer_include}"
+ if test -z "${with_libstemmer_lib}"; then
+ with_libstemmer_lib="${with_libstemmer}/lib"
+ fi
+ LIBSTEMMER_LDFLAGS="-L${with_libstemmer_lib}"
+ CFLAGS="${CFLAGS} ${LIBSTEMMER_CFLAGS}"
+ LDFLAGS="${LDFLAGS} ${LIBSTEMMER_LDFLAGS}"
+ fi
+ AC_CHECK_HEADERS(libstemmer.h,
+ [libstemmer_exists=yes],
+ [libstemmer_exists=no])
+ if test "$libstemmer_exists" = "yes"; then
+ AC_CHECK_LIB(stemmer, sb_stemmer_list,
+ [LIBSTEMMER_LIBS="-lstemmer"],
+ [libstemmer_exists=no])
+ fi
+ CFLAGS="${CFLAGS_save}"
+ LDFLAGS="${LDFLAGS_save}"
+
+ if test "$libstemmer_exists" = "no" -a "x$with_libstemmer" != "xauto"; then
+ AC_MSG_ERROR("No libstemmer found at ${with_libstemmer_include} and ${with_libstemmer_lib}.")
+ fi
+ with_libstemmer="$libstemmer_exists"
+fi
+if test "x$with_libstemmer" = "xyes"; then
+ AC_SUBST(LIBSTEMMER_CFLAGS)
+ AC_SUBST(LIBSTEMMER_LDFLAGS)
+ AC_SUBST(LIBSTEMMER_LIBS)
+ AC_DEFINE(GRN_WITH_LIBSTEMMER, [1], [use libstemmer])
+fi
+AM_CONDITIONAL(WITH_LIBSTEMMER, test "x$with_libstemmer" = "xyes")
+
# futex check
AC_ARG_ENABLE(futex,
[AS_HELP_STRING([--enable-futex],
@@ -1063,30 +1170,48 @@ AC_SUBST(LIBEVENT_CFLAGS)
AC_SUBST(LIBEVENT_LIBS)
# MessagePack
-AC_ARG_WITH(message-pack,
- [AS_HELP_STRING([--without-message-pack],
- [Disable MessagePack used for suggestion. [default=/usr]])],
- [with_message_pack="$withval"],
- [with_message_pack="/usr"])
-if test "x$with_message_pack" != "xno"; then
- _SAVE_CFLAGS="$CFLAGS"
- _SAVE_LDFLAGS="$LDFLAGS"
- _SAVE_LIBS="$LIBS"
- CFLAGS="$CFLAGS -I$with_message_pack/include"
- LDFLAGS="$LDFLAGS -L$with_message_pack/lib"
- AC_SEARCH_LIBS(msgpack_version, msgpack,
- [message_pack_available=yes],
- [message_pack_available=no])
- CFLAGS="$_SAVE_CFLAGS"
- LDFLAGS="$_SAVE_LDFLAGS"
- LIBS="$_SAVE_LIBS"
+AC_ARG_ENABLE(message-pack,
+ [AS_HELP_STRING([--disable-message-pack],
+ [Disable MessagePack support. [default=auto-detect]])],
+ [enable_message_pack="$enableval"],
+ [enable_message_pack="auto"])
+if test "x$enable_message_pack" != "xno"; then
+ m4_ifdef([PKG_CHECK_MODULES], [
+ PKG_CHECK_MODULES([MESSAGE_PACK], [msgpack],
+ [message_pack_available=yes],
+ [message_pack_available=no])
+ ],
+ [message_pack_vailable=no])
+
+ if test "$message_pack_available" = "no"; then
+ AC_ARG_WITH(message-pack,
+ [AS_HELP_STRING([--with-message-pack],
+ [Specify prefix where MessagePack is installed. [default=/usr]])],
+ [with_message_pack="$withval"],
+ [with_message_pack="/usr"])
+ _SAVE_CFLAGS="$CFLAGS"
+ _SAVE_LDFLAGS="$LDFLAGS"
+ _SAVE_LIBS="$LIBS"
+ CFLAGS="$CFLAGS -I$with_message_pack/include"
+ LDFLAGS="$LDFLAGS -L$with_message_pack/lib"
+ AC_SEARCH_LIBS(msgpack_version, msgpack,
+ [message_pack_available=yes],
+ [message_pack_available=no])
+ CFLAGS="$_SAVE_CFLAGS"
+ LDFLAGS="$_SAVE_LDFLAGS"
+ LIBS="$_SAVE_LIBS"
+
+ if test "x$message_pack_available" = "xyes"; then
+ MESSAGE_PACK_CFLAGS="-I$with_message_pack/include"
+ MESSAGE_PACK_LIBS="-L$with_message_pack/lib -lmsgpack"
+ fi
+ fi
+
if test "x$message_pack_available" = "xyes"; then
AC_DEFINE(GRN_WITH_MESSAGE_PACK, [1],
[Define to 1 if MessagePack is available.])
- MESSAGE_PACK_CFLAGS="-I$with_message_pack/include"
- MESSAGE_PACK_LIBS="-L$with_message_pack/lib -lmsgpack"
else
- if test "x$with_message_pack" = "xyes"; then
+ if test "x$enable_message_pack" = "xyes"; then
AC_MSG_ERROR("No MessagePack found")
fi
fi
@@ -1136,15 +1261,15 @@ 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
+ % sudo apt-get install -y python-sphinx
For Red Hat based system like CentOS:
% sudo yum install -y python-pip
% sudo pip install sphinx
For OS X with Homebrew:
- % brew install pip
+ % brew install python
+ % brew install gettext
% export PATH="`brew --prefix gettext`/bin:\$PATH"
% pip install sphinx])
fi
@@ -1247,6 +1372,12 @@ AC_SUBST(ruby_pluginsdir)
token_filter_pluginsdir="\${pluginsdir}/token_filters"
AC_SUBST(token_filter_pluginsdir)
+sharding_pluginsdir="\${pluginsdir}/sharding"
+AC_SUBST(sharding_pluginsdir)
+
+function_pluginsdir="\${pluginsdir}/functions"
+AC_SUBST(function_pluginsdir)
+
AC_MSG_CHECKING(for the suffix of plugin shared libraries)
shrext_cmds=$(./libtool --config | grep '^shrext_cmds=')
eval $shrext_cmds
@@ -1355,21 +1486,16 @@ fi
AC_MSG_RESULT($enable_mruby)
if test "$enable_mruby" = "yes"; then
- if test ! -f "$srcdir/vendor/mruby/mruby-build.timestamp" -a \
+ if test ! -f "$srcdir/vendor/mruby/mruby_build.timestamp" -a \
"$ac_cv_ruby_available" != "yes"; then
- AC_MSG_ERROR(--enable-ruby requires --with-ruby)
+ AC_MSG_ERROR(--enable-mruby requires --with-ruby)
fi
AC_DEFINE(GRN_WITH_MRUBY, [1], [Define to 1 if mruby is enabled.])
MRUBY_CFLAGS="-I\$(top_srcdir)/vendor/mruby-source/include"
- MRUBY_LIBS="\$(top_builddir)/vendor/mruby/libmruby.la"
- MRUBY_LIBS="${MRUBY_LIBS} \$(top_builddir)/vendor/onigmo-source/libonig.la"
- AC_CONFIG_SUBDIRS([vendor/onigmo])
else
- MRUBY_CFLAGS=
- MRUBY_LIBS=
+ MRUBY_CFLAGS=""
fi
AC_SUBST(MRUBY_CFLAGS)
-AC_SUBST(MRUBY_LIBS)
AM_CONDITIONAL(WITH_MRUBY, test "$enable_mruby" = "yes")
# This option is used in vendor/onigmo/configure
@@ -1380,12 +1506,21 @@ AC_ARG_ENABLE(shared-onigmo,
[enable_shared_onigmo="no"])
AM_CONDITIONAL(WITH_SHARED_ONIGMO, test "$enable_shared_onigmo" = "yes")
+# TODO: Support using system Onigmo instead of bundled Onigmo.
+AC_DEFINE(GRN_WITH_ONIGMO, [1], [Use Onigmo.])
+AC_CONFIG_SUBDIRS([vendor/onigmo])
+
+ONIGMO_CFLAGS="-I\$(top_srcdir)/vendor/onigmo-source"
+ONIGMO_LIBS="\$(top_builddir)/vendor/onigmo-source/libonig.la"
+AC_SUBST(ONIGMO_CFLAGS)
+AC_SUBST(ONIGMO_LIBS)
+
# PCRE
GRN_WITH_PCRE=no
AC_ARG_WITH(pcre,
[AS_HELP_STRING([--without-pcre],
- [use PCRE for groonga-httpd. [default=auto-detect]])],
- [with_pcre="$witheval"],
+ [Don't use PCRE for groonga-httpd. [default=auto-detect]])],
+ [with_pcre="$withval"],
[with_pcre="auto"])
if test "x$with_pcre" != "xno"; then
m4_ifdef([PKG_CHECK_MODULES], [
@@ -1446,7 +1581,6 @@ AC_SUBST(GROONGA_HTTPD_DEFAULT_DATABASE_PATH)
AC_OUTPUT([
packages/rpm/centos/groonga.spec
- packages/rpm/fedora/groonga.spec
packages/apt/debian/groonga-keyring.postrm
packages/apt/env.sh
packages/yum/env.sh
@@ -1489,6 +1623,14 @@ if test "x$with_kytea" = "xyes"; then
fi
echo
+echo "Token filters:"
+echo " libstemmer: $with_libstemmer"
+if test "x$with_libstemmer" = "xyes"; then
+ echo " CFLAGS: $LIBSTEMMER_CFLAGS"
+ echo " LIBS: $LIBSTEMMER_LIBS"
+fi
+echo
+
echo "Libraries:"
echo " ZeroMQ: $zeromq_available"
if test "x$zeromq_available" = "xyes"; then
@@ -1506,6 +1648,7 @@ if test "x$message_pack_available" = "xyes"; then
echo " LIBS: ${MESSAGE_PACK_LIBS}"
fi
echo " mruby: $enable_mruby"
+echo " jemalloc: $jemalloc_available"
echo
echo "groonga-httpd:"
diff --git a/storage/mroonga/vendor/groonga/examples/Makefile.am b/storage/mroonga/vendor/groonga/examples/Makefile.am
new file mode 100644
index 00000000000..f436342d053
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/examples/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = dictionary
diff --git a/storage/mroonga/vendor/groonga/examples/dictionary/Makefile.am b/storage/mroonga/vendor/groonga/examples/dictionary/Makefile.am
new file mode 100644
index 00000000000..ee618a213bd
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/examples/dictionary/Makefile.am
@@ -0,0 +1,34 @@
+SUBDIRS = \
+ edict \
+ eijiro \
+ gene95 \
+ jmdict
+
+dist_examples_dictionary_SCRIPTS = \
+ init-db.sh
+
+nobase_dist_examples_dictionary_DATA = \
+ readme.txt \
+ $(html_files)
+
+# find html -type f | sort | sed -e 's,^,\t,g'
+html_files = \
+ html/css/dictionary.css \
+ html/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png \
+ html/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png \
+ html/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png \
+ html/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png \
+ html/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png \
+ html/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png \
+ html/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png \
+ html/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png \
+ html/css/smoothness/images/ui-icons_222222_256x240.png \
+ html/css/smoothness/images/ui-icons_2e83ff_256x240.png \
+ html/css/smoothness/images/ui-icons_454545_256x240.png \
+ html/css/smoothness/images/ui-icons_888888_256x240.png \
+ html/css/smoothness/images/ui-icons_cd0a0a_256x240.png \
+ html/css/smoothness/jquery-ui-1.8.12.custom.css \
+ html/index.html \
+ html/js/dictionary.js \
+ html/js/jquery-1.7.2.js \
+ html/js/jquery-ui-1.8.18.custom.js
diff --git a/storage/mroonga/vendor/groonga/examples/dictionary/edict/Makefile.am b/storage/mroonga/vendor/groonga/examples/dictionary/edict/Makefile.am
new file mode 100644
index 00000000000..376f9d520ab
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/examples/dictionary/edict/Makefile.am
@@ -0,0 +1,4 @@
+edictdir = $(examples_dictionarydir)/edict
+dist_edict_SCRIPTS = \
+ edict2grn.rb \
+ edict-import.sh
diff --git a/storage/mroonga/vendor/groonga/examples/dictionary/edict/edict-import.sh b/storage/mroonga/vendor/groonga/examples/dictionary/edict/edict-import.sh
new file mode 100755
index 00000000000..b98397be05a
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/examples/dictionary/edict/edict-import.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+base_dir=$(dirname $0)
+
+if [ 1 != $# -a 2 != $# ]; then
+ echo "usage: $0 db_path [edict.gz_path]"
+ exit 1
+fi
+
+if [ -z $2 ]; then
+ edict_gz=edict.gz
+ if [ ! -f $edict_gz ]; then
+ wget -O $edict_gz http://ftp.monash.edu.au/pub/nihongo/edict.gz
+ fi
+else
+ edict_gz=$2
+fi
+
+if zcat $edict_gz | ${base_dir}/edict2grn.rb | groonga $1 > /dev/null; then
+ echo "edict data loaded."
+fi
diff --git a/storage/mroonga/vendor/groonga/examples/dictionary/edict/edict2grn.rb b/storage/mroonga/vendor/groonga/examples/dictionary/edict/edict2grn.rb
new file mode 100755
index 00000000000..664b12c2148
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/examples/dictionary/edict/edict2grn.rb
@@ -0,0 +1,56 @@
+#!/usr/bin/env ruby
+# -*- coding: utf-8 -*-
+
+$KCODE = 'u'
+
+require 'English'
+require 'kconv'
+
+class String
+ def to_json
+ a = split(//).map {|char|
+ case char
+ when '"' then '\\"'
+ when '\\' then '\\\\'
+ when "\b" then '\b'
+ when "\f" then '\f'
+ when "\n" then '\n'
+ when "\r" then ''
+ when "\t" then '\t'
+ else char
+ end
+ }
+ "\"#{a.join('')}\""
+ end
+end
+
+class Array
+ def to_json
+ '[' + map {|element|
+ element.to_json
+ }.join(',') + ']'
+ end
+end
+
+puts <<END
+column_create item_dictionary edict_desc COLUMN_SCALAR ShortText
+column_create bigram item_dictionary_edict_desc COLUMN_INDEX|WITH_POSITION item_dictionary edict_desc
+load --table item_dictionary
+[["_key","edict_desc","kana"],
+END
+
+while !STDIN.eof?
+ line = Kconv.toutf8(gets)
+ key, body = line.strip.split('/', 2)
+ key = key.strip
+ if /\s*\[(.+)\]\z/ =~ key
+ key = $PREMATCH
+ reading = $1
+ body = "[#{reading}] #{body}"
+ kana = NKF.nkf("-Ww --katakana", reading)
+ else
+ kana = NKF.nkf("-Ww --katakana", key)
+ end
+ puts [key, body, kana].to_json
+end
+puts ']'
diff --git a/storage/mroonga/vendor/groonga/examples/dictionary/eijiro/Makefile.am b/storage/mroonga/vendor/groonga/examples/dictionary/eijiro/Makefile.am
new file mode 100644
index 00000000000..4059a529cef
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/examples/dictionary/eijiro/Makefile.am
@@ -0,0 +1,4 @@
+eijirodir = $(examples_dictionarydir)/eijiro
+dist_eijiro_SCRIPTS = \
+ eijiro2grn.rb \
+ eijiro-import.sh
diff --git a/storage/mroonga/vendor/groonga/examples/dictionary/eijiro/eijiro-import.sh b/storage/mroonga/vendor/groonga/examples/dictionary/eijiro/eijiro-import.sh
new file mode 100755
index 00000000000..4042d7fbf56
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/examples/dictionary/eijiro/eijiro-import.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+base_dir=$(dirname $0)
+
+if [ 2 != $# ]; then
+ echo "usage: $0 db_path eijiro.csv_path"
+ exit 1
+fi
+
+if iconv -f UCS2 -t UTF8 $2 | ${base_dir}/eijiro2grn.rb | groonga $1 > /dev/null; then
+ echo "eijiro data loaded."
+fi
diff --git a/storage/mroonga/vendor/groonga/examples/dictionary/eijiro/eijiro2grn.rb b/storage/mroonga/vendor/groonga/examples/dictionary/eijiro/eijiro2grn.rb
new file mode 100755
index 00000000000..62c1e1309bf
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/examples/dictionary/eijiro/eijiro2grn.rb
@@ -0,0 +1,61 @@
+#!/usr/bin/env ruby
+# -*- coding: utf-8 -*-
+
+$KCODE = 'u'
+
+require 'rubygems'
+require 'fastercsv'
+
+class String
+ def to_json
+ a = split(//).map {|char|
+ case char
+ when '"' then '\\"'
+ when '\\' then '\\\\'
+ when "\b" then '\b'
+ when "\f" then '\f'
+ when "\n" then '\n'
+ when "\r" then ''
+ when "\t" then '\t'
+ else char
+ end
+ }
+ "\"#{a.join('')}\""
+ end
+end
+
+class Array
+ def to_json
+ '[' + map {|element|
+ element.to_json
+ }.join(',') + ']'
+ end
+end
+
+puts <<END
+column_create item_dictionary eijiro_trans COLUMN_SCALAR ShortText
+column_create item_dictionary eijiro_exp COLUMN_SCALAR ShortText
+column_create item_dictionary eijiro_level COLUMN_SCALAR Int32
+column_create item_dictionary eijiro_memory COLUMN_SCALAR Int32
+column_create item_dictionary eijiro_modify COLUMN_SCALAR Int32
+column_create item_dictionary eijiro_pron COLUMN_SCALAR ShortText
+column_create item_dictionary eijiro_filelink COLUMN_SCALAR ShortText
+column_create bigram item_dictionary_eijiro_trans COLUMN_INDEX|WITH_POSITION item_dictionary eijiro_trans
+load --table item_dictionary
+[["_key","norm","eijiro_trans","eijiro_exp","eijiro_level","eijiro_memory","eijiro_modify","eijiro_pron","eijiro_filelink","kana"],
+END
+
+n = 0
+FasterCSV.new(ARGF, :row_sep => "\r\n").each {|l|
+ if n > 0
+ keyword,word,trans,exp,level,memory,modify,pron,filelink = l
+ kana = ''
+ if trans =~ /ã€ï¼ ã€‘(.*?)(ã€|$)/
+ kana = $1.split("ã€")
+ end
+ puts [word,keyword,trans,exp,level,memory,modify,pron,filelink,kana].map{|e| e || ''}.to_json
+ end
+ n += 1
+}
+
+puts "]"
diff --git a/storage/mroonga/vendor/groonga/examples/dictionary/gene95/Makefile.am b/storage/mroonga/vendor/groonga/examples/dictionary/gene95/Makefile.am
new file mode 100644
index 00000000000..e89f13f595c
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/examples/dictionary/gene95/Makefile.am
@@ -0,0 +1,4 @@
+gene95dir = $(examples_dictionarydir)/gene95
+dist_gene95_SCRIPTS = \
+ gene2grn.rb \
+ gene-import.sh
diff --git a/storage/mroonga/vendor/groonga/examples/dictionary/gene95/gene-import.sh b/storage/mroonga/vendor/groonga/examples/dictionary/gene95/gene-import.sh
new file mode 100755
index 00000000000..488d6c83adc
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/examples/dictionary/gene95/gene-import.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+base_dir=$(dirname $0)
+
+if [ 1 != $# -a 2 != $# ]; then
+ echo "usage: $0 db_path [gene.txt_path]"
+ exit 1
+fi
+
+if [ -z $2 ]; then
+ dictionary_dir=gene95-dictionary
+ gene_txt=${dictionary_dir}/gene.txt
+ if [ ! -f $gene_txt ]; then
+ gene95_tar_gz=gene95.tar.gz
+ wget -O $gene95_tar_gz \
+ http://www.namazu.org/~tsuchiya/sdic/data/gene95.tar.gz
+ mkdir -p ${dictionary_dir}
+ tar xvzf ${gene95_tar_gz} -C ${dictionary_dir}
+ fi
+else
+ gene_txt=$2
+fi
+
+if cat $gene_txt | ${base_dir}/gene2grn.rb | groonga $1 > /dev/null; then
+ echo "gene95 data loaded."
+fi
diff --git a/storage/mroonga/vendor/groonga/examples/dictionary/gene95/gene2grn.rb b/storage/mroonga/vendor/groonga/examples/dictionary/gene95/gene2grn.rb
new file mode 100755
index 00000000000..0d10cfd1085
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/examples/dictionary/gene95/gene2grn.rb
@@ -0,0 +1,46 @@
+#!/usr/bin/env ruby
+# -*- coding: utf-8 -*-
+
+$KCODE = 'u'
+
+require 'kconv'
+
+class String
+ def to_json
+ a = split(//).map {|char|
+ case char
+ when '"' then '\\"'
+ when '\\' then '\\\\'
+ when "\b" then '\b'
+ when "\f" then '\f'
+ when "\n" then '\n'
+ when "\r" then ''
+ when "\t" then '\t'
+ else char
+ end
+ }
+ "\"#{a.join('')}\""
+ end
+end
+
+class Array
+ def to_json
+ '[' + map {|element|
+ element.to_json
+ }.join(',') + ']'
+ end
+end
+
+puts <<END
+column_create item_dictionary gene95_desc COLUMN_SCALAR ShortText
+column_create bigram item_dictionary_gene95_desc COLUMN_INDEX|WITH_POSITION item_dictionary gene95_desc
+load --table item_dictionary
+[["_key","gene95_desc"],
+END
+
+while !STDIN.eof?
+ key = Kconv.toutf8(gets.strip)
+ body = Kconv.toutf8(gets.strip)
+ puts [key, body].to_json
+end
+puts ']'
diff --git a/storage/mroonga/vendor/groonga/examples/dictionary/html/css/dictionary.css b/storage/mroonga/vendor/groonga/examples/dictionary/html/css/dictionary.css
new file mode 100644
index 00000000000..72b5a6749b3
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/examples/dictionary/html/css/dictionary.css
@@ -0,0 +1,3 @@
+#result {
+ margin-top: 7em;
+}
diff --git a/storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png b/storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png
new file mode 100644
index 00000000000..5b5dab2ab7b
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png
Binary files differ
diff --git a/storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png b/storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png
new file mode 100644
index 00000000000..ac8b229af95
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png
Binary files differ
diff --git a/storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png b/storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png
new file mode 100644
index 00000000000..ad3d6346e00
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png
Binary files differ
diff --git a/storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png b/storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png
new file mode 100644
index 00000000000..42ccba269b6
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png
Binary files differ
diff --git a/storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png b/storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png
new file mode 100644
index 00000000000..5a46b47cb16
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png
Binary files differ
diff --git a/storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png b/storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png
new file mode 100644
index 00000000000..86c2baa655e
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png
Binary files differ
diff --git a/storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png b/storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png
new file mode 100644
index 00000000000..4443fdc1a15
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png
Binary files differ
diff --git a/storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png b/storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png
new file mode 100644
index 00000000000..7c9fa6c6edc
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png
Binary files differ
diff --git a/storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-icons_222222_256x240.png b/storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-icons_222222_256x240.png
new file mode 100644
index 00000000000..b273ff111d2
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-icons_222222_256x240.png
Binary files differ
diff --git a/storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-icons_2e83ff_256x240.png b/storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-icons_2e83ff_256x240.png
new file mode 100644
index 00000000000..09d1cdc856c
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-icons_2e83ff_256x240.png
Binary files differ
diff --git a/storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-icons_454545_256x240.png b/storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-icons_454545_256x240.png
new file mode 100644
index 00000000000..59bd45b907c
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-icons_454545_256x240.png
Binary files differ
diff --git a/storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-icons_888888_256x240.png b/storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-icons_888888_256x240.png
new file mode 100644
index 00000000000..6d02426c114
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-icons_888888_256x240.png
Binary files differ
diff --git a/storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-icons_cd0a0a_256x240.png b/storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-icons_cd0a0a_256x240.png
new file mode 100644
index 00000000000..2ab019b73ec
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-icons_cd0a0a_256x240.png
Binary files differ
diff --git a/storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/jquery-ui-1.8.12.custom.css b/storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/jquery-ui-1.8.12.custom.css
new file mode 100644
index 00000000000..c85aabaec06
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/jquery-ui-1.8.12.custom.css
@@ -0,0 +1,578 @@
+/*
+ * jQuery UI CSS Framework 1.8.12
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Theming/API
+ */
+
+/* Layout helpers
+----------------------------------*/
+.ui-helper-hidden { display: none; }
+.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
+.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
+.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
+.ui-helper-clearfix { display: inline-block; }
+/* required comment for clearfix to work in Opera \*/
+* html .ui-helper-clearfix { height:1%; }
+.ui-helper-clearfix { display:block; }
+/* end clearfix */
+.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
+
+
+/* Interaction Cues
+----------------------------------*/
+.ui-state-disabled { cursor: default !important; }
+
+
+/* Icons
+----------------------------------*/
+
+/* states and images */
+.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
+
+
+/* Misc visuals
+----------------------------------*/
+
+/* Overlays */
+.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
+
+
+/*
+ * jQuery UI CSS Framework 1.8.12
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Theming/API
+ *
+ * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana,Arial,sans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=03_highlight_soft.png&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=01_flat.png&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=02_glass.png&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=02_glass.png&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=02_glass.png&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
+ */
+
+
+/* Component containers
+----------------------------------*/
+.ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; }
+.ui-widget .ui-widget { font-size: 1em; }
+.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; }
+.ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; }
+.ui-widget-content a { color: #222222; }
+.ui-widget-header { border: 1px solid #aaaaaa; background: #cccccc url(images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x; color: #222222; font-weight: bold; }
+.ui-widget-header a { color: #222222; }
+
+/* Interaction states
+----------------------------------*/
+.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3; background: #e6e6e6 url(images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #555555; }
+.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555; text-decoration: none; }
+.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999; background: #dadada url(images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
+.ui-state-hover a, .ui-state-hover a:hover { color: #212121; text-decoration: none; }
+.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
+.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121; text-decoration: none; }
+.ui-widget :active { outline: none; }
+
+/* Interaction Cues
+----------------------------------*/
+.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1; background: #fbf9ee url(images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x; color: #363636; }
+.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
+.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; }
+.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a; }
+.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a; }
+.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
+.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
+.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
+
+/* Icons
+----------------------------------*/
+
+/* states and images */
+.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); }
+.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
+.ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
+.ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png); }
+.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
+.ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
+.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); }
+.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); }
+
+/* positioning */
+.ui-icon-carat-1-n { background-position: 0 0; }
+.ui-icon-carat-1-ne { background-position: -16px 0; }
+.ui-icon-carat-1-e { background-position: -32px 0; }
+.ui-icon-carat-1-se { background-position: -48px 0; }
+.ui-icon-carat-1-s { background-position: -64px 0; }
+.ui-icon-carat-1-sw { background-position: -80px 0; }
+.ui-icon-carat-1-w { background-position: -96px 0; }
+.ui-icon-carat-1-nw { background-position: -112px 0; }
+.ui-icon-carat-2-n-s { background-position: -128px 0; }
+.ui-icon-carat-2-e-w { background-position: -144px 0; }
+.ui-icon-triangle-1-n { background-position: 0 -16px; }
+.ui-icon-triangle-1-ne { background-position: -16px -16px; }
+.ui-icon-triangle-1-e { background-position: -32px -16px; }
+.ui-icon-triangle-1-se { background-position: -48px -16px; }
+.ui-icon-triangle-1-s { background-position: -64px -16px; }
+.ui-icon-triangle-1-sw { background-position: -80px -16px; }
+.ui-icon-triangle-1-w { background-position: -96px -16px; }
+.ui-icon-triangle-1-nw { background-position: -112px -16px; }
+.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
+.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
+.ui-icon-arrow-1-n { background-position: 0 -32px; }
+.ui-icon-arrow-1-ne { background-position: -16px -32px; }
+.ui-icon-arrow-1-e { background-position: -32px -32px; }
+.ui-icon-arrow-1-se { background-position: -48px -32px; }
+.ui-icon-arrow-1-s { background-position: -64px -32px; }
+.ui-icon-arrow-1-sw { background-position: -80px -32px; }
+.ui-icon-arrow-1-w { background-position: -96px -32px; }
+.ui-icon-arrow-1-nw { background-position: -112px -32px; }
+.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
+.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
+.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
+.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
+.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
+.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
+.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
+.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
+.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
+.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
+.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
+.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
+.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
+.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
+.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
+.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
+.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
+.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
+.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
+.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
+.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
+.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
+.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
+.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
+.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
+.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
+.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
+.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
+.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
+.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
+.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
+.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
+.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
+.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
+.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
+.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
+.ui-icon-arrow-4 { background-position: 0 -80px; }
+.ui-icon-arrow-4-diag { background-position: -16px -80px; }
+.ui-icon-extlink { background-position: -32px -80px; }
+.ui-icon-newwin { background-position: -48px -80px; }
+.ui-icon-refresh { background-position: -64px -80px; }
+.ui-icon-shuffle { background-position: -80px -80px; }
+.ui-icon-transfer-e-w { background-position: -96px -80px; }
+.ui-icon-transferthick-e-w { background-position: -112px -80px; }
+.ui-icon-folder-collapsed { background-position: 0 -96px; }
+.ui-icon-folder-open { background-position: -16px -96px; }
+.ui-icon-document { background-position: -32px -96px; }
+.ui-icon-document-b { background-position: -48px -96px; }
+.ui-icon-note { background-position: -64px -96px; }
+.ui-icon-mail-closed { background-position: -80px -96px; }
+.ui-icon-mail-open { background-position: -96px -96px; }
+.ui-icon-suitcase { background-position: -112px -96px; }
+.ui-icon-comment { background-position: -128px -96px; }
+.ui-icon-person { background-position: -144px -96px; }
+.ui-icon-print { background-position: -160px -96px; }
+.ui-icon-trash { background-position: -176px -96px; }
+.ui-icon-locked { background-position: -192px -96px; }
+.ui-icon-unlocked { background-position: -208px -96px; }
+.ui-icon-bookmark { background-position: -224px -96px; }
+.ui-icon-tag { background-position: -240px -96px; }
+.ui-icon-home { background-position: 0 -112px; }
+.ui-icon-flag { background-position: -16px -112px; }
+.ui-icon-calendar { background-position: -32px -112px; }
+.ui-icon-cart { background-position: -48px -112px; }
+.ui-icon-pencil { background-position: -64px -112px; }
+.ui-icon-clock { background-position: -80px -112px; }
+.ui-icon-disk { background-position: -96px -112px; }
+.ui-icon-calculator { background-position: -112px -112px; }
+.ui-icon-zoomin { background-position: -128px -112px; }
+.ui-icon-zoomout { background-position: -144px -112px; }
+.ui-icon-search { background-position: -160px -112px; }
+.ui-icon-wrench { background-position: -176px -112px; }
+.ui-icon-gear { background-position: -192px -112px; }
+.ui-icon-heart { background-position: -208px -112px; }
+.ui-icon-star { background-position: -224px -112px; }
+.ui-icon-link { background-position: -240px -112px; }
+.ui-icon-cancel { background-position: 0 -128px; }
+.ui-icon-plus { background-position: -16px -128px; }
+.ui-icon-plusthick { background-position: -32px -128px; }
+.ui-icon-minus { background-position: -48px -128px; }
+.ui-icon-minusthick { background-position: -64px -128px; }
+.ui-icon-close { background-position: -80px -128px; }
+.ui-icon-closethick { background-position: -96px -128px; }
+.ui-icon-key { background-position: -112px -128px; }
+.ui-icon-lightbulb { background-position: -128px -128px; }
+.ui-icon-scissors { background-position: -144px -128px; }
+.ui-icon-clipboard { background-position: -160px -128px; }
+.ui-icon-copy { background-position: -176px -128px; }
+.ui-icon-contact { background-position: -192px -128px; }
+.ui-icon-image { background-position: -208px -128px; }
+.ui-icon-video { background-position: -224px -128px; }
+.ui-icon-script { background-position: -240px -128px; }
+.ui-icon-alert { background-position: 0 -144px; }
+.ui-icon-info { background-position: -16px -144px; }
+.ui-icon-notice { background-position: -32px -144px; }
+.ui-icon-help { background-position: -48px -144px; }
+.ui-icon-check { background-position: -64px -144px; }
+.ui-icon-bullet { background-position: -80px -144px; }
+.ui-icon-radio-off { background-position: -96px -144px; }
+.ui-icon-radio-on { background-position: -112px -144px; }
+.ui-icon-pin-w { background-position: -128px -144px; }
+.ui-icon-pin-s { background-position: -144px -144px; }
+.ui-icon-play { background-position: 0 -160px; }
+.ui-icon-pause { background-position: -16px -160px; }
+.ui-icon-seek-next { background-position: -32px -160px; }
+.ui-icon-seek-prev { background-position: -48px -160px; }
+.ui-icon-seek-end { background-position: -64px -160px; }
+.ui-icon-seek-start { background-position: -80px -160px; }
+/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
+.ui-icon-seek-first { background-position: -80px -160px; }
+.ui-icon-stop { background-position: -96px -160px; }
+.ui-icon-eject { background-position: -112px -160px; }
+.ui-icon-volume-off { background-position: -128px -160px; }
+.ui-icon-volume-on { background-position: -144px -160px; }
+.ui-icon-power { background-position: 0 -176px; }
+.ui-icon-signal-diag { background-position: -16px -176px; }
+.ui-icon-signal { background-position: -32px -176px; }
+.ui-icon-battery-0 { background-position: -48px -176px; }
+.ui-icon-battery-1 { background-position: -64px -176px; }
+.ui-icon-battery-2 { background-position: -80px -176px; }
+.ui-icon-battery-3 { background-position: -96px -176px; }
+.ui-icon-circle-plus { background-position: 0 -192px; }
+.ui-icon-circle-minus { background-position: -16px -192px; }
+.ui-icon-circle-close { background-position: -32px -192px; }
+.ui-icon-circle-triangle-e { background-position: -48px -192px; }
+.ui-icon-circle-triangle-s { background-position: -64px -192px; }
+.ui-icon-circle-triangle-w { background-position: -80px -192px; }
+.ui-icon-circle-triangle-n { background-position: -96px -192px; }
+.ui-icon-circle-arrow-e { background-position: -112px -192px; }
+.ui-icon-circle-arrow-s { background-position: -128px -192px; }
+.ui-icon-circle-arrow-w { background-position: -144px -192px; }
+.ui-icon-circle-arrow-n { background-position: -160px -192px; }
+.ui-icon-circle-zoomin { background-position: -176px -192px; }
+.ui-icon-circle-zoomout { background-position: -192px -192px; }
+.ui-icon-circle-check { background-position: -208px -192px; }
+.ui-icon-circlesmall-plus { background-position: 0 -208px; }
+.ui-icon-circlesmall-minus { background-position: -16px -208px; }
+.ui-icon-circlesmall-close { background-position: -32px -208px; }
+.ui-icon-squaresmall-plus { background-position: -48px -208px; }
+.ui-icon-squaresmall-minus { background-position: -64px -208px; }
+.ui-icon-squaresmall-close { background-position: -80px -208px; }
+.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
+.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
+.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
+.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
+.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
+.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
+
+
+/* Misc visuals
+----------------------------------*/
+
+/* Corner radius */
+.ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; }
+.ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; }
+.ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
+.ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
+.ui-corner-top { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; }
+.ui-corner-bottom { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
+.ui-corner-right { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
+.ui-corner-left { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
+.ui-corner-all { -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; }
+
+/* Overlays */
+.ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); }
+.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }/*
+ * jQuery UI Resizable 1.8.12
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Resizable#theming
+ */
+.ui-resizable { position: relative;}
+.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block;
+ /* http://bugs.jqueryui.com/ticket/7233
+ - Resizable: resizable handles fail to work in IE if transparent and content overlaps
+ */
+ background-image:url(data:);
+}
+.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
+.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
+.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
+.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }
+.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }
+.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
+.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
+.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
+.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/*
+ * jQuery UI Selectable 1.8.12
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Selectable#theming
+ */
+.ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; }
+/*
+ * jQuery UI Accordion 1.8.12
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Accordion#theming
+ */
+/* IE/Win - Fix animation bug - #4615 */
+.ui-accordion { width: 100%; }
+.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }
+.ui-accordion .ui-accordion-li-fix { display: inline; }
+.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }
+.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; }
+.ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; }
+.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
+.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; }
+.ui-accordion .ui-accordion-content-active { display: block; }
+/*
+ * jQuery UI Autocomplete 1.8.12
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Autocomplete#theming
+ */
+.ui-autocomplete { position: absolute; cursor: default; }
+
+/* workarounds */
+* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
+
+/*
+ * jQuery UI Menu 1.8.12
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Menu#theming
+ */
+.ui-menu {
+ list-style:none;
+ padding: 2px;
+ margin: 0;
+ display:block;
+ float: left;
+}
+.ui-menu .ui-menu {
+ margin-top: -3px;
+}
+.ui-menu .ui-menu-item {
+ margin:0;
+ padding: 0;
+ zoom: 1;
+ float: left;
+ clear: left;
+ width: 100%;
+}
+.ui-menu .ui-menu-item a {
+ text-decoration:none;
+ display:block;
+ padding:.2em .4em;
+ line-height:1.5;
+ zoom:1;
+}
+.ui-menu .ui-menu-item a.ui-state-hover,
+.ui-menu .ui-menu-item a.ui-state-active {
+ font-weight: normal;
+ margin: -1px;
+}
+/*
+ * jQuery UI Button 1.8.12
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Button#theming
+ */
+.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */
+.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
+button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
+.ui-button-icons-only { width: 3.4em; }
+button.ui-button-icons-only { width: 3.7em; }
+
+/*button text element */
+.ui-button .ui-button-text { display: block; line-height: 1.4; }
+.ui-button-text-only .ui-button-text { padding: .4em 1em; }
+.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }
+.ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }
+.ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; }
+.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }
+/* no icon support for input elements, provide padding by default */
+input.ui-button { padding: .4em 1em; }
+
+/*button icon element(s) */
+.ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }
+.ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }
+.ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; }
+.ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
+.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
+
+/*button sets*/
+.ui-buttonset { margin-right: 7px; }
+.ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; }
+
+/* workarounds */
+button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */
+/*
+ * jQuery UI Dialog 1.8.12
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Dialog#theming
+ */
+.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; }
+.ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; }
+.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; }
+.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
+.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
+.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
+.ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
+.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
+.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; }
+.ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; }
+.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
+.ui-draggable .ui-dialog-titlebar { cursor: move; }
+/*
+ * jQuery UI Slider 1.8.12
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Slider#theming
+ */
+.ui-slider { position: relative; text-align: left; }
+.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
+.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
+
+.ui-slider-horizontal { height: .8em; }
+.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
+.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
+.ui-slider-horizontal .ui-slider-range-min { left: 0; }
+.ui-slider-horizontal .ui-slider-range-max { right: 0; }
+
+.ui-slider-vertical { width: .8em; height: 100px; }
+.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
+.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
+.ui-slider-vertical .ui-slider-range-min { bottom: 0; }
+.ui-slider-vertical .ui-slider-range-max { top: 0; }/*
+ * jQuery UI Tabs 1.8.12
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Tabs#theming
+ */
+.ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
+.ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; }
+.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; }
+.ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; }
+.ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; }
+.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; }
+.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
+.ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; }
+.ui-tabs .ui-tabs-hide { display: none !important; }
+/*
+ * jQuery UI Datepicker 1.8.12
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Datepicker#theming
+ */
+.ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; }
+.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
+.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
+.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
+.ui-datepicker .ui-datepicker-prev { left:2px; }
+.ui-datepicker .ui-datepicker-next { right:2px; }
+.ui-datepicker .ui-datepicker-prev-hover { left:1px; }
+.ui-datepicker .ui-datepicker-next-hover { right:1px; }
+.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
+.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
+.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
+.ui-datepicker select.ui-datepicker-month-year {width: 100%;}
+.ui-datepicker select.ui-datepicker-month,
+.ui-datepicker select.ui-datepicker-year { width: 49%;}
+.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
+.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
+.ui-datepicker td { border: 0; padding: 1px; }
+.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
+.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
+.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
+.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
+
+/* with multiple calendars */
+.ui-datepicker.ui-datepicker-multi { width:auto; }
+.ui-datepicker-multi .ui-datepicker-group { float:left; }
+.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
+.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
+.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
+.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
+.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
+.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
+.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
+.ui-datepicker-row-break { clear:both; width:100%; }
+
+/* RTL support */
+.ui-datepicker-rtl { direction: rtl; }
+.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
+.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
+.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
+.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
+.ui-datepicker-rtl .ui-datepicker-group { float:right; }
+.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
+.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
+
+/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
+.ui-datepicker-cover {
+ display: none; /*sorry for IE5*/
+ display/**/: block; /*sorry for IE5*/
+ position: absolute; /*must have*/
+ z-index: -1; /*must have*/
+ filter: mask(); /*must have*/
+ top: -4px; /*must have*/
+ left: -4px; /*must have*/
+ width: 200px; /*must have*/
+ height: 200px; /*must have*/
+}/*
+ * jQuery UI Progressbar 1.8.12
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Progressbar#theming
+ */
+.ui-progressbar { height:2em; text-align: left; }
+.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; } \ No newline at end of file
diff --git a/storage/mroonga/vendor/groonga/examples/dictionary/html/index.html b/storage/mroonga/vendor/groonga/examples/dictionary/html/index.html
new file mode 100644
index 00000000000..aaad128a290
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/examples/dictionary/html/index.html
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
+<head>
+<meta http-equiv="Content-Language" content="ja" />
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<title>groonga dictionary search</title>
+<meta http-equiv="content-style-type" content="text/css" />
+<meta http-equiv="content-script-type" content="text/javascript" />
+<link type="text/css" href="css/smoothness/jquery-ui-1.8.12.custom.css" rel="stylesheet" />
+<link type="text/css" rel="stylesheet" href="css/dictionary.css" />
+</head>
+<body>
+<form action="javascript:(function(){$('.search').blur()})()" name="search" id="search">
+<input type="text" size="60" maxlength="60" name="key" class="search" />
+<input type="submit" value="検索"/>
+</form>
+<script type="text/javascript" src="js/jquery-1.7.2.js"></script>
+<script type="text/javascript" src="js/jquery-ui-1.8.18.custom.min.js"></script>
+<script type="text/javascript" src="js/dictionary.js"></script>
+<script type="text/javascript">
+$(document).ready(function(){
+ $(".search").autocomplete({source: dictionarySource("http://" + location.host + "/d/suggest")});
+});
+</script>
+<div id="result"></div>
+</body>
+</html>
diff --git a/storage/mroonga/vendor/groonga/examples/dictionary/html/js/dictionary.js b/storage/mroonga/vendor/groonga/examples/dictionary/html/js/dictionary.js
new file mode 100644
index 00000000000..850c64cc667
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/examples/dictionary/html/js/dictionary.js
@@ -0,0 +1,82 @@
+function dictionarySource(url) {
+ function displayItems(items) {
+ var results = $("<dl />");
+ $.each(items,
+ function(i, val) {
+ results.append($("<dt />")
+ .append($("<span />")
+ .text(val[0])
+ .click(function() {
+ $(".search").val($(this).text());
+ $("#search").submit();
+ })));
+ results.append($("<dd />")
+ .append($("<span />").text(val[1]))
+ .append($("<span />").text(val[2]))
+ );
+ });
+ $("#result")
+ .empty()
+ .append(results);
+ };
+
+ var request_index = 0;
+ var columns = "_key,gene95_desc,edict_desc";
+ var xhr;
+ function source(request, response) {
+ function onSuccess(data, status) {
+ if (this.autocomplete_request != request_index) {
+ return;
+ }
+ var completions = data[1]["complete"];
+ var items = [];
+ if (completions && completions.length > 2) {
+ completions.shift();
+ completions.shift();
+ $.each(completions,
+ function(i, item) {
+ var key = item[0];
+ items.push(key);
+ if (items.length >= 3) {
+ return false;
+ }
+ return true;
+ });
+ }
+ if (completions.length > 0) {
+ displayItems(completions);
+ }
+ response(items);
+ }
+
+ function onError() {
+ if (this.autocomplete_request != request_index) {
+ return;
+ }
+ response([]);
+ }
+
+ if (xhr) {
+ xhr.abort();
+ }
+ xhr = $.ajax(url,
+ {
+ data: {
+ query: request.term,
+ types: 'complete',
+ table: 'item_dictionary',
+ column: 'kana',
+ limit: 25,
+ output_columns: columns,
+ frequency_threshold: 1,
+ prefix_search: "yes"
+ },
+ dataType: "jsonp",
+ autocomplete_request: ++request_index,
+ success: onSuccess,
+ error: onError
+ });
+ };
+
+ return source;
+}
diff --git a/storage/mroonga/vendor/groonga/examples/dictionary/html/js/jquery-1.7.2.js b/storage/mroonga/vendor/groonga/examples/dictionary/html/js/jquery-1.7.2.js
new file mode 100644
index 00000000000..3774ff98613
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/examples/dictionary/html/js/jquery-1.7.2.js
@@ -0,0 +1,9404 @@
+/*!
+ * jQuery JavaScript Library v1.7.2
+ * http://jquery.com/
+ *
+ * Copyright 2011, John Resig
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * Includes Sizzle.js
+ * http://sizzlejs.com/
+ * Copyright 2011, The Dojo Foundation
+ * Released under the MIT, BSD, and GPL Licenses.
+ *
+ * Date: Wed Mar 21 12:46:34 2012 -0700
+ */
+(function( window, undefined ) {
+
+// Use the correct document accordingly with window argument (sandbox)
+var document = window.document,
+ navigator = window.navigator,
+ location = window.location;
+var jQuery = (function() {
+
+// Define a local copy of jQuery
+var jQuery = function( selector, context ) {
+ // The jQuery object is actually just the init constructor 'enhanced'
+ return new jQuery.fn.init( selector, context, rootjQuery );
+ },
+
+ // Map over jQuery in case of overwrite
+ _jQuery = window.jQuery,
+
+ // Map over the $ in case of overwrite
+ _$ = window.$,
+
+ // A central reference to the root jQuery(document)
+ rootjQuery,
+
+ // A simple way to check for HTML strings or ID strings
+ // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
+ quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,
+
+ // Check if a string has a non-whitespace character in it
+ rnotwhite = /\S/,
+
+ // Used for trimming whitespace
+ trimLeft = /^\s+/,
+ trimRight = /\s+$/,
+
+ // Match a standalone tag
+ rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
+
+ // JSON RegExp
+ rvalidchars = /^[\],:{}\s]*$/,
+ rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
+ rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
+ rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
+
+ // Useragent RegExp
+ rwebkit = /(webkit)[ \/]([\w.]+)/,
+ ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
+ rmsie = /(msie) ([\w.]+)/,
+ rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
+
+ // Matches dashed string for camelizing
+ rdashAlpha = /-([a-z]|[0-9])/ig,
+ rmsPrefix = /^-ms-/,
+
+ // Used by jQuery.camelCase as callback to replace()
+ fcamelCase = function( all, letter ) {
+ return ( letter + "" ).toUpperCase();
+ },
+
+ // Keep a UserAgent string for use with jQuery.browser
+ userAgent = navigator.userAgent,
+
+ // For matching the engine and version of the browser
+ browserMatch,
+
+ // The deferred used on DOM ready
+ readyList,
+
+ // The ready event handler
+ DOMContentLoaded,
+
+ // Save a reference to some core methods
+ toString = Object.prototype.toString,
+ hasOwn = Object.prototype.hasOwnProperty,
+ push = Array.prototype.push,
+ slice = Array.prototype.slice,
+ trim = String.prototype.trim,
+ indexOf = Array.prototype.indexOf,
+
+ // [[Class]] -> type pairs
+ class2type = {};
+
+jQuery.fn = jQuery.prototype = {
+ constructor: jQuery,
+ init: function( selector, context, rootjQuery ) {
+ var match, elem, ret, doc;
+
+ // Handle $(""), $(null), or $(undefined)
+ if ( !selector ) {
+ return this;
+ }
+
+ // Handle $(DOMElement)
+ if ( selector.nodeType ) {
+ this.context = this[0] = selector;
+ this.length = 1;
+ return this;
+ }
+
+ // The body element only exists once, optimize finding it
+ if ( selector === "body" && !context && document.body ) {
+ this.context = document;
+ this[0] = document.body;
+ this.selector = selector;
+ this.length = 1;
+ return this;
+ }
+
+ // Handle HTML strings
+ if ( typeof selector === "string" ) {
+ // Are we dealing with HTML string or an ID?
+ if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
+ // Assume that strings that start and end with <> are HTML and skip the regex check
+ match = [ null, selector, null ];
+
+ } else {
+ match = quickExpr.exec( selector );
+ }
+
+ // Verify a match, and that no context was specified for #id
+ if ( match && (match[1] || !context) ) {
+
+ // HANDLE: $(html) -> $(array)
+ if ( match[1] ) {
+ context = context instanceof jQuery ? context[0] : context;
+ doc = ( context ? context.ownerDocument || context : document );
+
+ // If a single string is passed in and it's a single tag
+ // just do a createElement and skip the rest
+ ret = rsingleTag.exec( selector );
+
+ if ( ret ) {
+ if ( jQuery.isPlainObject( context ) ) {
+ selector = [ document.createElement( ret[1] ) ];
+ jQuery.fn.attr.call( selector, context, true );
+
+ } else {
+ selector = [ doc.createElement( ret[1] ) ];
+ }
+
+ } else {
+ ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
+ selector = ( ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment ).childNodes;
+ }
+
+ return jQuery.merge( this, selector );
+
+ // HANDLE: $("#id")
+ } else {
+ elem = document.getElementById( match[2] );
+
+ // Check parentNode to catch when Blackberry 4.6 returns
+ // nodes that are no longer in the document #6963
+ if ( elem && elem.parentNode ) {
+ // Handle the case where IE and Opera return items
+ // by name instead of ID
+ if ( elem.id !== match[2] ) {
+ return rootjQuery.find( selector );
+ }
+
+ // Otherwise, we inject the element directly into the jQuery object
+ this.length = 1;
+ this[0] = elem;
+ }
+
+ this.context = document;
+ this.selector = selector;
+ return this;
+ }
+
+ // HANDLE: $(expr, $(...))
+ } else if ( !context || context.jquery ) {
+ return ( context || rootjQuery ).find( selector );
+
+ // HANDLE: $(expr, context)
+ // (which is just equivalent to: $(context).find(expr)
+ } else {
+ return this.constructor( context ).find( selector );
+ }
+
+ // HANDLE: $(function)
+ // Shortcut for document ready
+ } else if ( jQuery.isFunction( selector ) ) {
+ return rootjQuery.ready( selector );
+ }
+
+ if ( selector.selector !== undefined ) {
+ this.selector = selector.selector;
+ this.context = selector.context;
+ }
+
+ return jQuery.makeArray( selector, this );
+ },
+
+ // Start with an empty selector
+ selector: "",
+
+ // The current version of jQuery being used
+ jquery: "1.7.2",
+
+ // The default length of a jQuery object is 0
+ length: 0,
+
+ // The number of elements contained in the matched element set
+ size: function() {
+ return this.length;
+ },
+
+ toArray: function() {
+ return slice.call( this, 0 );
+ },
+
+ // Get the Nth element in the matched element set OR
+ // Get the whole matched element set as a clean array
+ get: function( num ) {
+ return num == null ?
+
+ // Return a 'clean' array
+ this.toArray() :
+
+ // Return just the object
+ ( num < 0 ? this[ this.length + num ] : this[ num ] );
+ },
+
+ // Take an array of elements and push it onto the stack
+ // (returning the new matched element set)
+ pushStack: function( elems, name, selector ) {
+ // Build a new jQuery matched element set
+ var ret = this.constructor();
+
+ if ( jQuery.isArray( elems ) ) {
+ push.apply( ret, elems );
+
+ } else {
+ jQuery.merge( ret, elems );
+ }
+
+ // Add the old object onto the stack (as a reference)
+ ret.prevObject = this;
+
+ ret.context = this.context;
+
+ if ( name === "find" ) {
+ ret.selector = this.selector + ( this.selector ? " " : "" ) + selector;
+ } else if ( name ) {
+ ret.selector = this.selector + "." + name + "(" + selector + ")";
+ }
+
+ // Return the newly-formed element set
+ return ret;
+ },
+
+ // Execute a callback for every element in the matched set.
+ // (You can seed the arguments with an array of args, but this is
+ // only used internally.)
+ each: function( callback, args ) {
+ return jQuery.each( this, callback, args );
+ },
+
+ ready: function( fn ) {
+ // Attach the listeners
+ jQuery.bindReady();
+
+ // Add the callback
+ readyList.add( fn );
+
+ return this;
+ },
+
+ eq: function( i ) {
+ i = +i;
+ return i === -1 ?
+ this.slice( i ) :
+ this.slice( i, i + 1 );
+ },
+
+ first: function() {
+ return this.eq( 0 );
+ },
+
+ last: function() {
+ return this.eq( -1 );
+ },
+
+ slice: function() {
+ return this.pushStack( slice.apply( this, arguments ),
+ "slice", slice.call(arguments).join(",") );
+ },
+
+ map: function( callback ) {
+ return this.pushStack( jQuery.map(this, function( elem, i ) {
+ return callback.call( elem, i, elem );
+ }));
+ },
+
+ end: function() {
+ return this.prevObject || this.constructor(null);
+ },
+
+ // For internal use only.
+ // Behaves like an Array's method, not like a jQuery method.
+ push: push,
+ sort: [].sort,
+ splice: [].splice
+};
+
+// Give the init function the jQuery prototype for later instantiation
+jQuery.fn.init.prototype = jQuery.fn;
+
+jQuery.extend = jQuery.fn.extend = function() {
+ var options, name, src, copy, copyIsArray, clone,
+ target = arguments[0] || {},
+ i = 1,
+ length = arguments.length,
+ deep = false;
+
+ // Handle a deep copy situation
+ if ( typeof target === "boolean" ) {
+ deep = target;
+ target = arguments[1] || {};
+ // skip the boolean and the target
+ i = 2;
+ }
+
+ // Handle case when target is a string or something (possible in deep copy)
+ if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
+ target = {};
+ }
+
+ // extend jQuery itself if only one argument is passed
+ if ( length === i ) {
+ target = this;
+ --i;
+ }
+
+ for ( ; i < length; i++ ) {
+ // Only deal with non-null/undefined values
+ if ( (options = arguments[ i ]) != null ) {
+ // Extend the base object
+ for ( name in options ) {
+ src = target[ name ];
+ copy = options[ name ];
+
+ // Prevent never-ending loop
+ if ( target === copy ) {
+ continue;
+ }
+
+ // Recurse if we're merging plain objects or arrays
+ if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
+ if ( copyIsArray ) {
+ copyIsArray = false;
+ clone = src && jQuery.isArray(src) ? src : [];
+
+ } else {
+ clone = src && jQuery.isPlainObject(src) ? src : {};
+ }
+
+ // Never move original objects, clone them
+ target[ name ] = jQuery.extend( deep, clone, copy );
+
+ // Don't bring in undefined values
+ } else if ( copy !== undefined ) {
+ target[ name ] = copy;
+ }
+ }
+ }
+ }
+
+ // Return the modified object
+ return target;
+};
+
+jQuery.extend({
+ noConflict: function( deep ) {
+ if ( window.$ === jQuery ) {
+ window.$ = _$;
+ }
+
+ if ( deep && window.jQuery === jQuery ) {
+ window.jQuery = _jQuery;
+ }
+
+ return jQuery;
+ },
+
+ // Is the DOM ready to be used? Set to true once it occurs.
+ isReady: false,
+
+ // A counter to track how many items to wait for before
+ // the ready event fires. See #6781
+ readyWait: 1,
+
+ // Hold (or release) the ready event
+ holdReady: function( hold ) {
+ if ( hold ) {
+ jQuery.readyWait++;
+ } else {
+ jQuery.ready( true );
+ }
+ },
+
+ // Handle when the DOM is ready
+ ready: function( wait ) {
+ // Either a released hold or an DOMready/load event and not yet ready
+ if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) {
+ // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
+ if ( !document.body ) {
+ return setTimeout( jQuery.ready, 1 );
+ }
+
+ // Remember that the DOM is ready
+ jQuery.isReady = true;
+
+ // If a normal DOM Ready event fired, decrement, and wait if need be
+ if ( wait !== true && --jQuery.readyWait > 0 ) {
+ return;
+ }
+
+ // If there are functions bound, to execute
+ readyList.fireWith( document, [ jQuery ] );
+
+ // Trigger any bound ready events
+ if ( jQuery.fn.trigger ) {
+ jQuery( document ).trigger( "ready" ).off( "ready" );
+ }
+ }
+ },
+
+ bindReady: function() {
+ if ( readyList ) {
+ return;
+ }
+
+ readyList = jQuery.Callbacks( "once memory" );
+
+ // Catch cases where $(document).ready() is called after the
+ // browser event has already occurred.
+ if ( document.readyState === "complete" ) {
+ // Handle it asynchronously to allow scripts the opportunity to delay ready
+ return setTimeout( jQuery.ready, 1 );
+ }
+
+ // Mozilla, Opera and webkit nightlies currently support this event
+ if ( document.addEventListener ) {
+ // Use the handy event callback
+ document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
+
+ // A fallback to window.onload, that will always work
+ window.addEventListener( "load", jQuery.ready, false );
+
+ // If IE event model is used
+ } else if ( document.attachEvent ) {
+ // ensure firing before onload,
+ // maybe late but safe also for iframes
+ document.attachEvent( "onreadystatechange", DOMContentLoaded );
+
+ // A fallback to window.onload, that will always work
+ window.attachEvent( "onload", jQuery.ready );
+
+ // If IE and not a frame
+ // continually check to see if the document is ready
+ var toplevel = false;
+
+ try {
+ toplevel = window.frameElement == null;
+ } catch(e) {}
+
+ if ( document.documentElement.doScroll && toplevel ) {
+ doScrollCheck();
+ }
+ }
+ },
+
+ // See test/unit/core.js for details concerning isFunction.
+ // Since version 1.3, DOM methods and functions like alert
+ // aren't supported. They return false on IE (#2968).
+ isFunction: function( obj ) {
+ return jQuery.type(obj) === "function";
+ },
+
+ isArray: Array.isArray || function( obj ) {
+ return jQuery.type(obj) === "array";
+ },
+
+ isWindow: function( obj ) {
+ return obj != null && obj == obj.window;
+ },
+
+ isNumeric: function( obj ) {
+ return !isNaN( parseFloat(obj) ) && isFinite( obj );
+ },
+
+ type: function( obj ) {
+ return obj == null ?
+ String( obj ) :
+ class2type[ toString.call(obj) ] || "object";
+ },
+
+ isPlainObject: function( obj ) {
+ // Must be an Object.
+ // Because of IE, we also have to check the presence of the constructor property.
+ // Make sure that DOM nodes and window objects don't pass through, as well
+ if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
+ return false;
+ }
+
+ try {
+ // Not own constructor property must be Object
+ if ( obj.constructor &&
+ !hasOwn.call(obj, "constructor") &&
+ !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
+ return false;
+ }
+ } catch ( e ) {
+ // IE8,9 Will throw exceptions on certain host objects #9897
+ return false;
+ }
+
+ // Own properties are enumerated firstly, so to speed up,
+ // if last one is own, then all properties are own.
+
+ var key;
+ for ( key in obj ) {}
+
+ return key === undefined || hasOwn.call( obj, key );
+ },
+
+ isEmptyObject: function( obj ) {
+ for ( var name in obj ) {
+ return false;
+ }
+ return true;
+ },
+
+ error: function( msg ) {
+ throw new Error( msg );
+ },
+
+ parseJSON: function( data ) {
+ if ( typeof data !== "string" || !data ) {
+ return null;
+ }
+
+ // Make sure leading/trailing whitespace is removed (IE can't handle it)
+ data = jQuery.trim( data );
+
+ // Attempt to parse using the native JSON parser first
+ if ( window.JSON && window.JSON.parse ) {
+ return window.JSON.parse( data );
+ }
+
+ // Make sure the incoming data is actual JSON
+ // Logic borrowed from http://json.org/json2.js
+ if ( rvalidchars.test( data.replace( rvalidescape, "@" )
+ .replace( rvalidtokens, "]" )
+ .replace( rvalidbraces, "")) ) {
+
+ return ( new Function( "return " + data ) )();
+
+ }
+ jQuery.error( "Invalid JSON: " + data );
+ },
+
+ // Cross-browser xml parsing
+ parseXML: function( data ) {
+ if ( typeof data !== "string" || !data ) {
+ return null;
+ }
+ var xml, tmp;
+ try {
+ if ( window.DOMParser ) { // Standard
+ tmp = new DOMParser();
+ xml = tmp.parseFromString( data , "text/xml" );
+ } else { // IE
+ xml = new ActiveXObject( "Microsoft.XMLDOM" );
+ xml.async = "false";
+ xml.loadXML( data );
+ }
+ } catch( e ) {
+ xml = undefined;
+ }
+ if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
+ jQuery.error( "Invalid XML: " + data );
+ }
+ return xml;
+ },
+
+ noop: function() {},
+
+ // Evaluates a script in a global context
+ // Workarounds based on findings by Jim Driscoll
+ // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
+ globalEval: function( data ) {
+ if ( data && rnotwhite.test( data ) ) {
+ // We use execScript on Internet Explorer
+ // We use an anonymous function so that context is window
+ // rather than jQuery in Firefox
+ ( window.execScript || function( data ) {
+ window[ "eval" ].call( window, data );
+ } )( data );
+ }
+ },
+
+ // Convert dashed to camelCase; used by the css and data modules
+ // Microsoft forgot to hump their vendor prefix (#9572)
+ camelCase: function( string ) {
+ return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
+ },
+
+ nodeName: function( elem, name ) {
+ return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
+ },
+
+ // args is for internal usage only
+ each: function( object, callback, args ) {
+ var name, i = 0,
+ length = object.length,
+ isObj = length === undefined || jQuery.isFunction( object );
+
+ if ( args ) {
+ if ( isObj ) {
+ for ( name in object ) {
+ if ( callback.apply( object[ name ], args ) === false ) {
+ break;
+ }
+ }
+ } else {
+ for ( ; i < length; ) {
+ if ( callback.apply( object[ i++ ], args ) === false ) {
+ break;
+ }
+ }
+ }
+
+ // A special, fast, case for the most common use of each
+ } else {
+ if ( isObj ) {
+ for ( name in object ) {
+ if ( callback.call( object[ name ], name, object[ name ] ) === false ) {
+ break;
+ }
+ }
+ } else {
+ for ( ; i < length; ) {
+ if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) {
+ break;
+ }
+ }
+ }
+ }
+
+ return object;
+ },
+
+ // Use native String.trim function wherever possible
+ trim: trim ?
+ function( text ) {
+ return text == null ?
+ "" :
+ trim.call( text );
+ } :
+
+ // Otherwise use our own trimming functionality
+ function( text ) {
+ return text == null ?
+ "" :
+ text.toString().replace( trimLeft, "" ).replace( trimRight, "" );
+ },
+
+ // results is for internal usage only
+ makeArray: function( array, results ) {
+ var ret = results || [];
+
+ if ( array != null ) {
+ // The window, strings (and functions) also have 'length'
+ // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
+ var type = jQuery.type( array );
+
+ if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) {
+ push.call( ret, array );
+ } else {
+ jQuery.merge( ret, array );
+ }
+ }
+
+ return ret;
+ },
+
+ inArray: function( elem, array, i ) {
+ var len;
+
+ if ( array ) {
+ if ( indexOf ) {
+ return indexOf.call( array, elem, i );
+ }
+
+ len = array.length;
+ i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
+
+ for ( ; i < len; i++ ) {
+ // Skip accessing in sparse arrays
+ if ( i in array && array[ i ] === elem ) {
+ return i;
+ }
+ }
+ }
+
+ return -1;
+ },
+
+ merge: function( first, second ) {
+ var i = first.length,
+ j = 0;
+
+ if ( typeof second.length === "number" ) {
+ for ( var l = second.length; j < l; j++ ) {
+ first[ i++ ] = second[ j ];
+ }
+
+ } else {
+ while ( second[j] !== undefined ) {
+ first[ i++ ] = second[ j++ ];
+ }
+ }
+
+ first.length = i;
+
+ return first;
+ },
+
+ grep: function( elems, callback, inv ) {
+ var ret = [], retVal;
+ inv = !!inv;
+
+ // Go through the array, only saving the items
+ // that pass the validator function
+ for ( var i = 0, length = elems.length; i < length; i++ ) {
+ retVal = !!callback( elems[ i ], i );
+ if ( inv !== retVal ) {
+ ret.push( elems[ i ] );
+ }
+ }
+
+ return ret;
+ },
+
+ // arg is for internal usage only
+ map: function( elems, callback, arg ) {
+ var value, key, ret = [],
+ i = 0,
+ length = elems.length,
+ // jquery objects are treated as arrays
+ isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ;
+
+ // Go through the array, translating each of the items to their
+ if ( isArray ) {
+ for ( ; i < length; i++ ) {
+ value = callback( elems[ i ], i, arg );
+
+ if ( value != null ) {
+ ret[ ret.length ] = value;
+ }
+ }
+
+ // Go through every key on the object,
+ } else {
+ for ( key in elems ) {
+ value = callback( elems[ key ], key, arg );
+
+ if ( value != null ) {
+ ret[ ret.length ] = value;
+ }
+ }
+ }
+
+ // Flatten any nested arrays
+ return ret.concat.apply( [], ret );
+ },
+
+ // A global GUID counter for objects
+ guid: 1,
+
+ // Bind a function to a context, optionally partially applying any
+ // arguments.
+ proxy: function( fn, context ) {
+ if ( typeof context === "string" ) {
+ var tmp = fn[ context ];
+ context = fn;
+ fn = tmp;
+ }
+
+ // Quick check to determine if target is callable, in the spec
+ // this throws a TypeError, but we will just return undefined.
+ if ( !jQuery.isFunction( fn ) ) {
+ return undefined;
+ }
+
+ // Simulated bind
+ var args = slice.call( arguments, 2 ),
+ proxy = function() {
+ return fn.apply( context, args.concat( slice.call( arguments ) ) );
+ };
+
+ // Set the guid of unique handler to the same of original handler, so it can be removed
+ proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
+
+ return proxy;
+ },
+
+ // Mutifunctional method to get and set values to a collection
+ // The value/s can optionally be executed if it's a function
+ access: function( elems, fn, key, value, chainable, emptyGet, pass ) {
+ var exec,
+ bulk = key == null,
+ i = 0,
+ length = elems.length;
+
+ // Sets many values
+ if ( key && typeof key === "object" ) {
+ for ( i in key ) {
+ jQuery.access( elems, fn, i, key[i], 1, emptyGet, value );
+ }
+ chainable = 1;
+
+ // Sets one value
+ } else if ( value !== undefined ) {
+ // Optionally, function values get executed if exec is true
+ exec = pass === undefined && jQuery.isFunction( value );
+
+ if ( bulk ) {
+ // Bulk operations only iterate when executing function values
+ if ( exec ) {
+ exec = fn;
+ fn = function( elem, key, value ) {
+ return exec.call( jQuery( elem ), value );
+ };
+
+ // Otherwise they run against the entire set
+ } else {
+ fn.call( elems, value );
+ fn = null;
+ }
+ }
+
+ if ( fn ) {
+ for (; i < length; i++ ) {
+ fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
+ }
+ }
+
+ chainable = 1;
+ }
+
+ return chainable ?
+ elems :
+
+ // Gets
+ bulk ?
+ fn.call( elems ) :
+ length ? fn( elems[0], key ) : emptyGet;
+ },
+
+ now: function() {
+ return ( new Date() ).getTime();
+ },
+
+ // Use of jQuery.browser is frowned upon.
+ // More details: http://docs.jquery.com/Utilities/jQuery.browser
+ uaMatch: function( ua ) {
+ ua = ua.toLowerCase();
+
+ var match = rwebkit.exec( ua ) ||
+ ropera.exec( ua ) ||
+ rmsie.exec( ua ) ||
+ ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||
+ [];
+
+ return { browser: match[1] || "", version: match[2] || "0" };
+ },
+
+ sub: function() {
+ function jQuerySub( selector, context ) {
+ return new jQuerySub.fn.init( selector, context );
+ }
+ jQuery.extend( true, jQuerySub, this );
+ jQuerySub.superclass = this;
+ jQuerySub.fn = jQuerySub.prototype = this();
+ jQuerySub.fn.constructor = jQuerySub;
+ jQuerySub.sub = this.sub;
+ jQuerySub.fn.init = function init( selector, context ) {
+ if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
+ context = jQuerySub( context );
+ }
+
+ return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
+ };
+ jQuerySub.fn.init.prototype = jQuerySub.fn;
+ var rootjQuerySub = jQuerySub(document);
+ return jQuerySub;
+ },
+
+ browser: {}
+});
+
+// Populate the class2type map
+jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
+ class2type[ "[object " + name + "]" ] = name.toLowerCase();
+});
+
+browserMatch = jQuery.uaMatch( userAgent );
+if ( browserMatch.browser ) {
+ jQuery.browser[ browserMatch.browser ] = true;
+ jQuery.browser.version = browserMatch.version;
+}
+
+// Deprecated, use jQuery.browser.webkit instead
+if ( jQuery.browser.webkit ) {
+ jQuery.browser.safari = true;
+}
+
+// IE doesn't match non-breaking spaces with \s
+if ( rnotwhite.test( "\xA0" ) ) {
+ trimLeft = /^[\s\xA0]+/;
+ trimRight = /[\s\xA0]+$/;
+}
+
+// All jQuery objects should point back to these
+rootjQuery = jQuery(document);
+
+// Cleanup functions for the document ready method
+if ( document.addEventListener ) {
+ DOMContentLoaded = function() {
+ document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
+ jQuery.ready();
+ };
+
+} else if ( document.attachEvent ) {
+ DOMContentLoaded = function() {
+ // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
+ if ( document.readyState === "complete" ) {
+ document.detachEvent( "onreadystatechange", DOMContentLoaded );
+ jQuery.ready();
+ }
+ };
+}
+
+// The DOM ready check for Internet Explorer
+function doScrollCheck() {
+ if ( jQuery.isReady ) {
+ return;
+ }
+
+ try {
+ // If IE is used, use the trick by Diego Perini
+ // http://javascript.nwbox.com/IEContentLoaded/
+ document.documentElement.doScroll("left");
+ } catch(e) {
+ setTimeout( doScrollCheck, 1 );
+ return;
+ }
+
+ // and execute any waiting functions
+ jQuery.ready();
+}
+
+return jQuery;
+
+})();
+
+
+// String to Object flags format cache
+var flagsCache = {};
+
+// Convert String-formatted flags into Object-formatted ones and store in cache
+function createFlags( flags ) {
+ var object = flagsCache[ flags ] = {},
+ i, length;
+ flags = flags.split( /\s+/ );
+ for ( i = 0, length = flags.length; i < length; i++ ) {
+ object[ flags[i] ] = true;
+ }
+ return object;
+}
+
+/*
+ * Create a callback list using the following parameters:
+ *
+ * flags: an optional list of space-separated flags that will change how
+ * the callback list behaves
+ *
+ * By default a callback list will act like an event callback list and can be
+ * "fired" multiple times.
+ *
+ * Possible flags:
+ *
+ * once: will ensure the callback list can only be fired once (like a Deferred)
+ *
+ * memory: will keep track of previous values and will call any callback added
+ * after the list has been fired right away with the latest "memorized"
+ * values (like a Deferred)
+ *
+ * unique: will ensure a callback can only be added once (no duplicate in the list)
+ *
+ * stopOnFalse: interrupt callings when a callback returns false
+ *
+ */
+jQuery.Callbacks = function( flags ) {
+
+ // Convert flags from String-formatted to Object-formatted
+ // (we check in cache first)
+ flags = flags ? ( flagsCache[ flags ] || createFlags( flags ) ) : {};
+
+ var // Actual callback list
+ list = [],
+ // Stack of fire calls for repeatable lists
+ stack = [],
+ // Last fire value (for non-forgettable lists)
+ memory,
+ // Flag to know if list was already fired
+ fired,
+ // Flag to know if list is currently firing
+ firing,
+ // First callback to fire (used internally by add and fireWith)
+ firingStart,
+ // End of the loop when firing
+ firingLength,
+ // Index of currently firing callback (modified by remove if needed)
+ firingIndex,
+ // Add one or several callbacks to the list
+ add = function( args ) {
+ var i,
+ length,
+ elem,
+ type,
+ actual;
+ for ( i = 0, length = args.length; i < length; i++ ) {
+ elem = args[ i ];
+ type = jQuery.type( elem );
+ if ( type === "array" ) {
+ // Inspect recursively
+ add( elem );
+ } else if ( type === "function" ) {
+ // Add if not in unique mode and callback is not in
+ if ( !flags.unique || !self.has( elem ) ) {
+ list.push( elem );
+ }
+ }
+ }
+ },
+ // Fire callbacks
+ fire = function( context, args ) {
+ args = args || [];
+ memory = !flags.memory || [ context, args ];
+ fired = true;
+ firing = true;
+ firingIndex = firingStart || 0;
+ firingStart = 0;
+ firingLength = list.length;
+ for ( ; list && firingIndex < firingLength; firingIndex++ ) {
+ if ( list[ firingIndex ].apply( context, args ) === false && flags.stopOnFalse ) {
+ memory = true; // Mark as halted
+ break;
+ }
+ }
+ firing = false;
+ if ( list ) {
+ if ( !flags.once ) {
+ if ( stack && stack.length ) {
+ memory = stack.shift();
+ self.fireWith( memory[ 0 ], memory[ 1 ] );
+ }
+ } else if ( memory === true ) {
+ self.disable();
+ } else {
+ list = [];
+ }
+ }
+ },
+ // Actual Callbacks object
+ self = {
+ // Add a callback or a collection of callbacks to the list
+ add: function() {
+ if ( list ) {
+ var length = list.length;
+ add( arguments );
+ // Do we need to add the callbacks to the
+ // current firing batch?
+ if ( firing ) {
+ firingLength = list.length;
+ // With memory, if we're not firing then
+ // we should call right away, unless previous
+ // firing was halted (stopOnFalse)
+ } else if ( memory && memory !== true ) {
+ firingStart = length;
+ fire( memory[ 0 ], memory[ 1 ] );
+ }
+ }
+ return this;
+ },
+ // Remove a callback from the list
+ remove: function() {
+ if ( list ) {
+ var args = arguments,
+ argIndex = 0,
+ argLength = args.length;
+ for ( ; argIndex < argLength ; argIndex++ ) {
+ for ( var i = 0; i < list.length; i++ ) {
+ if ( args[ argIndex ] === list[ i ] ) {
+ // Handle firingIndex and firingLength
+ if ( firing ) {
+ if ( i <= firingLength ) {
+ firingLength--;
+ if ( i <= firingIndex ) {
+ firingIndex--;
+ }
+ }
+ }
+ // Remove the element
+ list.splice( i--, 1 );
+ // If we have some unicity property then
+ // we only need to do this once
+ if ( flags.unique ) {
+ break;
+ }
+ }
+ }
+ }
+ }
+ return this;
+ },
+ // Control if a given callback is in the list
+ has: function( fn ) {
+ if ( list ) {
+ var i = 0,
+ length = list.length;
+ for ( ; i < length; i++ ) {
+ if ( fn === list[ i ] ) {
+ return true;
+ }
+ }
+ }
+ return false;
+ },
+ // Remove all callbacks from the list
+ empty: function() {
+ list = [];
+ return this;
+ },
+ // Have the list do nothing anymore
+ disable: function() {
+ list = stack = memory = undefined;
+ return this;
+ },
+ // Is it disabled?
+ disabled: function() {
+ return !list;
+ },
+ // Lock the list in its current state
+ lock: function() {
+ stack = undefined;
+ if ( !memory || memory === true ) {
+ self.disable();
+ }
+ return this;
+ },
+ // Is it locked?
+ locked: function() {
+ return !stack;
+ },
+ // Call all callbacks with the given context and arguments
+ fireWith: function( context, args ) {
+ if ( stack ) {
+ if ( firing ) {
+ if ( !flags.once ) {
+ stack.push( [ context, args ] );
+ }
+ } else if ( !( flags.once && memory ) ) {
+ fire( context, args );
+ }
+ }
+ return this;
+ },
+ // Call all the callbacks with the given arguments
+ fire: function() {
+ self.fireWith( this, arguments );
+ return this;
+ },
+ // To know if the callbacks have already been called at least once
+ fired: function() {
+ return !!fired;
+ }
+ };
+
+ return self;
+};
+
+
+
+
+var // Static reference to slice
+ sliceDeferred = [].slice;
+
+jQuery.extend({
+
+ Deferred: function( func ) {
+ var doneList = jQuery.Callbacks( "once memory" ),
+ failList = jQuery.Callbacks( "once memory" ),
+ progressList = jQuery.Callbacks( "memory" ),
+ state = "pending",
+ lists = {
+ resolve: doneList,
+ reject: failList,
+ notify: progressList
+ },
+ promise = {
+ done: doneList.add,
+ fail: failList.add,
+ progress: progressList.add,
+
+ state: function() {
+ return state;
+ },
+
+ // Deprecated
+ isResolved: doneList.fired,
+ isRejected: failList.fired,
+
+ then: function( doneCallbacks, failCallbacks, progressCallbacks ) {
+ deferred.done( doneCallbacks ).fail( failCallbacks ).progress( progressCallbacks );
+ return this;
+ },
+ always: function() {
+ deferred.done.apply( deferred, arguments ).fail.apply( deferred, arguments );
+ return this;
+ },
+ pipe: function( fnDone, fnFail, fnProgress ) {
+ return jQuery.Deferred(function( newDefer ) {
+ jQuery.each( {
+ done: [ fnDone, "resolve" ],
+ fail: [ fnFail, "reject" ],
+ progress: [ fnProgress, "notify" ]
+ }, function( handler, data ) {
+ var fn = data[ 0 ],
+ action = data[ 1 ],
+ returned;
+ if ( jQuery.isFunction( fn ) ) {
+ deferred[ handler ](function() {
+ returned = fn.apply( this, arguments );
+ if ( returned && jQuery.isFunction( returned.promise ) ) {
+ returned.promise().then( newDefer.resolve, newDefer.reject, newDefer.notify );
+ } else {
+ newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] );
+ }
+ });
+ } else {
+ deferred[ handler ]( newDefer[ action ] );
+ }
+ });
+ }).promise();
+ },
+ // Get a promise for this deferred
+ // If obj is provided, the promise aspect is added to the object
+ promise: function( obj ) {
+ if ( obj == null ) {
+ obj = promise;
+ } else {
+ for ( var key in promise ) {
+ obj[ key ] = promise[ key ];
+ }
+ }
+ return obj;
+ }
+ },
+ deferred = promise.promise({}),
+ key;
+
+ for ( key in lists ) {
+ deferred[ key ] = lists[ key ].fire;
+ deferred[ key + "With" ] = lists[ key ].fireWith;
+ }
+
+ // Handle state
+ deferred.done( function() {
+ state = "resolved";
+ }, failList.disable, progressList.lock ).fail( function() {
+ state = "rejected";
+ }, doneList.disable, progressList.lock );
+
+ // Call given func if any
+ if ( func ) {
+ func.call( deferred, deferred );
+ }
+
+ // All done!
+ return deferred;
+ },
+
+ // Deferred helper
+ when: function( firstParam ) {
+ var args = sliceDeferred.call( arguments, 0 ),
+ i = 0,
+ length = args.length,
+ pValues = new Array( length ),
+ count = length,
+ pCount = length,
+ deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ?
+ firstParam :
+ jQuery.Deferred(),
+ promise = deferred.promise();
+ function resolveFunc( i ) {
+ return function( value ) {
+ args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;
+ if ( !( --count ) ) {
+ deferred.resolveWith( deferred, args );
+ }
+ };
+ }
+ function progressFunc( i ) {
+ return function( value ) {
+ pValues[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;
+ deferred.notifyWith( promise, pValues );
+ };
+ }
+ if ( length > 1 ) {
+ for ( ; i < length; i++ ) {
+ if ( args[ i ] && args[ i ].promise && jQuery.isFunction( args[ i ].promise ) ) {
+ args[ i ].promise().then( resolveFunc(i), deferred.reject, progressFunc(i) );
+ } else {
+ --count;
+ }
+ }
+ if ( !count ) {
+ deferred.resolveWith( deferred, args );
+ }
+ } else if ( deferred !== firstParam ) {
+ deferred.resolveWith( deferred, length ? [ firstParam ] : [] );
+ }
+ return promise;
+ }
+});
+
+
+
+
+jQuery.support = (function() {
+
+ var support,
+ all,
+ a,
+ select,
+ opt,
+ input,
+ fragment,
+ tds,
+ events,
+ eventName,
+ i,
+ isSupported,
+ div = document.createElement( "div" ),
+ documentElement = document.documentElement;
+
+ // Preliminary tests
+ div.setAttribute("className", "t");
+ div.innerHTML = " <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
+
+ all = div.getElementsByTagName( "*" );
+ a = div.getElementsByTagName( "a" )[ 0 ];
+
+ // Can't get basic test support
+ if ( !all || !all.length || !a ) {
+ return {};
+ }
+
+ // First batch of supports tests
+ select = document.createElement( "select" );
+ opt = select.appendChild( document.createElement("option") );
+ input = div.getElementsByTagName( "input" )[ 0 ];
+
+ support = {
+ // IE strips leading whitespace when .innerHTML is used
+ leadingWhitespace: ( div.firstChild.nodeType === 3 ),
+
+ // Make sure that tbody elements aren't automatically inserted
+ // IE will insert them into empty tables
+ tbody: !div.getElementsByTagName("tbody").length,
+
+ // Make sure that link elements get serialized correctly by innerHTML
+ // This requires a wrapper element in IE
+ htmlSerialize: !!div.getElementsByTagName("link").length,
+
+ // Get the style information from getAttribute
+ // (IE uses .cssText instead)
+ style: /top/.test( a.getAttribute("style") ),
+
+ // Make sure that URLs aren't manipulated
+ // (IE normalizes it by default)
+ hrefNormalized: ( a.getAttribute("href") === "/a" ),
+
+ // Make sure that element opacity exists
+ // (IE uses filter instead)
+ // Use a regex to work around a WebKit issue. See #5145
+ opacity: /^0.55/.test( a.style.opacity ),
+
+ // Verify style float existence
+ // (IE uses styleFloat instead of cssFloat)
+ cssFloat: !!a.style.cssFloat,
+
+ // Make sure that if no value is specified for a checkbox
+ // that it defaults to "on".
+ // (WebKit defaults to "" instead)
+ checkOn: ( input.value === "on" ),
+
+ // Make sure that a selected-by-default option has a working selected property.
+ // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
+ optSelected: opt.selected,
+
+ // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
+ getSetAttribute: div.className !== "t",
+
+ // Tests for enctype support on a form(#6743)
+ enctype: !!document.createElement("form").enctype,
+
+ // Makes sure cloning an html5 element does not cause problems
+ // Where outerHTML is undefined, this still works
+ html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>",
+
+ // Will be defined later
+ submitBubbles: true,
+ changeBubbles: true,
+ focusinBubbles: false,
+ deleteExpando: true,
+ noCloneEvent: true,
+ inlineBlockNeedsLayout: false,
+ shrinkWrapBlocks: false,
+ reliableMarginRight: true,
+ pixelMargin: true
+ };
+
+ // jQuery.boxModel DEPRECATED in 1.3, use jQuery.support.boxModel instead
+ jQuery.boxModel = support.boxModel = (document.compatMode === "CSS1Compat");
+
+ // Make sure checked status is properly cloned
+ input.checked = true;
+ support.noCloneChecked = input.cloneNode( true ).checked;
+
+ // Make sure that the options inside disabled selects aren't marked as disabled
+ // (WebKit marks them as disabled)
+ select.disabled = true;
+ support.optDisabled = !opt.disabled;
+
+ // Test to see if it's possible to delete an expando from an element
+ // Fails in Internet Explorer
+ try {
+ delete div.test;
+ } catch( e ) {
+ support.deleteExpando = false;
+ }
+
+ if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
+ div.attachEvent( "onclick", function() {
+ // Cloning a node shouldn't copy over any
+ // bound event handlers (IE does this)
+ support.noCloneEvent = false;
+ });
+ div.cloneNode( true ).fireEvent( "onclick" );
+ }
+
+ // Check if a radio maintains its value
+ // after being appended to the DOM
+ input = document.createElement("input");
+ input.value = "t";
+ input.setAttribute("type", "radio");
+ support.radioValue = input.value === "t";
+
+ input.setAttribute("checked", "checked");
+
+ // #11217 - WebKit loses check when the name is after the checked attribute
+ input.setAttribute( "name", "t" );
+
+ div.appendChild( input );
+ fragment = document.createDocumentFragment();
+ fragment.appendChild( div.lastChild );
+
+ // WebKit doesn't clone checked state correctly in fragments
+ support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
+
+ // Check if a disconnected checkbox will retain its checked
+ // value of true after appended to the DOM (IE6/7)
+ support.appendChecked = input.checked;
+
+ fragment.removeChild( input );
+ fragment.appendChild( div );
+
+ // Technique from Juriy Zaytsev
+ // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/
+ // We only care about the case where non-standard event systems
+ // are used, namely in IE. Short-circuiting here helps us to
+ // avoid an eval call (in setAttribute) which can cause CSP
+ // to go haywire. See: https://developer.mozilla.org/en/Security/CSP
+ if ( div.attachEvent ) {
+ for ( i in {
+ submit: 1,
+ change: 1,
+ focusin: 1
+ }) {
+ eventName = "on" + i;
+ isSupported = ( eventName in div );
+ if ( !isSupported ) {
+ div.setAttribute( eventName, "return;" );
+ isSupported = ( typeof div[ eventName ] === "function" );
+ }
+ support[ i + "Bubbles" ] = isSupported;
+ }
+ }
+
+ fragment.removeChild( div );
+
+ // Null elements to avoid leaks in IE
+ fragment = select = opt = div = input = null;
+
+ // Run tests that need a body at doc ready
+ jQuery(function() {
+ var container, outer, inner, table, td, offsetSupport,
+ marginDiv, conMarginTop, style, html, positionTopLeftWidthHeight,
+ paddingMarginBorderVisibility, paddingMarginBorder,
+ body = document.getElementsByTagName("body")[0];
+
+ if ( !body ) {
+ // Return for frameset docs that don't have a body
+ return;
+ }
+
+ conMarginTop = 1;
+ paddingMarginBorder = "padding:0;margin:0;border:";
+ positionTopLeftWidthHeight = "position:absolute;top:0;left:0;width:1px;height:1px;";
+ paddingMarginBorderVisibility = paddingMarginBorder + "0;visibility:hidden;";
+ style = "style='" + positionTopLeftWidthHeight + paddingMarginBorder + "5px solid #000;";
+ html = "<div " + style + "display:block;'><div style='" + paddingMarginBorder + "0;display:block;overflow:hidden;'></div></div>" +
+ "<table " + style + "' cellpadding='0' cellspacing='0'>" +
+ "<tr><td></td></tr></table>";
+
+ container = document.createElement("div");
+ container.style.cssText = paddingMarginBorderVisibility + "width:0;height:0;position:static;top:0;margin-top:" + conMarginTop + "px";
+ body.insertBefore( container, body.firstChild );
+
+ // Construct the test element
+ div = document.createElement("div");
+ container.appendChild( div );
+
+ // Check if table cells still have offsetWidth/Height when they are set
+ // to display:none and there are still other visible table cells in a
+ // table row; if so, offsetWidth/Height are not reliable for use when
+ // determining if an element has been hidden directly using
+ // display:none (it is still safe to use offsets if a parent element is
+ // hidden; don safety goggles and see bug #4512 for more information).
+ // (only IE 8 fails this test)
+ div.innerHTML = "<table><tr><td style='" + paddingMarginBorder + "0;display:none'></td><td>t</td></tr></table>";
+ tds = div.getElementsByTagName( "td" );
+ isSupported = ( tds[ 0 ].offsetHeight === 0 );
+
+ tds[ 0 ].style.display = "";
+ tds[ 1 ].style.display = "none";
+
+ // Check if empty table cells still have offsetWidth/Height
+ // (IE <= 8 fail this test)
+ support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
+
+ // Check if div with explicit width and no margin-right incorrectly
+ // gets computed margin-right based on width of container. For more
+ // info see bug #3333
+ // Fails in WebKit before Feb 2011 nightlies
+ // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
+ if ( window.getComputedStyle ) {
+ div.innerHTML = "";
+ marginDiv = document.createElement( "div" );
+ marginDiv.style.width = "0";
+ marginDiv.style.marginRight = "0";
+ div.style.width = "2px";
+ div.appendChild( marginDiv );
+ support.reliableMarginRight =
+ ( parseInt( ( window.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0;
+ }
+
+ if ( typeof div.style.zoom !== "undefined" ) {
+ // Check if natively block-level elements act like inline-block
+ // elements when setting their display to 'inline' and giving
+ // them layout
+ // (IE < 8 does this)
+ div.innerHTML = "";
+ div.style.width = div.style.padding = "1px";
+ div.style.border = 0;
+ div.style.overflow = "hidden";
+ div.style.display = "inline";
+ div.style.zoom = 1;
+ support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );
+
+ // Check if elements with layout shrink-wrap their children
+ // (IE 6 does this)
+ div.style.display = "block";
+ div.style.overflow = "visible";
+ div.innerHTML = "<div style='width:5px;'></div>";
+ support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );
+ }
+
+ div.style.cssText = positionTopLeftWidthHeight + paddingMarginBorderVisibility;
+ div.innerHTML = html;
+
+ outer = div.firstChild;
+ inner = outer.firstChild;
+ td = outer.nextSibling.firstChild.firstChild;
+
+ offsetSupport = {
+ doesNotAddBorder: ( inner.offsetTop !== 5 ),
+ doesAddBorderForTableAndCells: ( td.offsetTop === 5 )
+ };
+
+ inner.style.position = "fixed";
+ inner.style.top = "20px";
+
+ // safari subtracts parent border width here which is 5px
+ offsetSupport.fixedPosition = ( inner.offsetTop === 20 || inner.offsetTop === 15 );
+ inner.style.position = inner.style.top = "";
+
+ outer.style.overflow = "hidden";
+ outer.style.position = "relative";
+
+ offsetSupport.subtractsBorderForOverflowNotVisible = ( inner.offsetTop === -5 );
+ offsetSupport.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== conMarginTop );
+
+ if ( window.getComputedStyle ) {
+ div.style.marginTop = "1%";
+ support.pixelMargin = ( window.getComputedStyle( div, null ) || { marginTop: 0 } ).marginTop !== "1%";
+ }
+
+ if ( typeof container.style.zoom !== "undefined" ) {
+ container.style.zoom = 1;
+ }
+
+ body.removeChild( container );
+ marginDiv = div = container = null;
+
+ jQuery.extend( support, offsetSupport );
+ });
+
+ return support;
+})();
+
+
+
+
+var rbrace = /^(?:\{.*\}|\[.*\])$/,
+ rmultiDash = /([A-Z])/g;
+
+jQuery.extend({
+ cache: {},
+
+ // Please use with caution
+ uuid: 0,
+
+ // Unique for each copy of jQuery on the page
+ // Non-digits removed to match rinlinejQuery
+ expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ),
+
+ // The following elements throw uncatchable exceptions if you
+ // attempt to add expando properties to them.
+ noData: {
+ "embed": true,
+ // Ban all objects except for Flash (which handle expandos)
+ "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
+ "applet": true
+ },
+
+ hasData: function( elem ) {
+ elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
+ return !!elem && !isEmptyDataObject( elem );
+ },
+
+ data: function( elem, name, data, pvt /* Internal Use Only */ ) {
+ if ( !jQuery.acceptData( elem ) ) {
+ return;
+ }
+
+ var privateCache, thisCache, ret,
+ internalKey = jQuery.expando,
+ getByName = typeof name === "string",
+
+ // We have to handle DOM nodes and JS objects differently because IE6-7
+ // can't GC object references properly across the DOM-JS boundary
+ isNode = elem.nodeType,
+
+ // Only DOM nodes need the global jQuery cache; JS object data is
+ // attached directly to the object so GC can occur automatically
+ cache = isNode ? jQuery.cache : elem,
+
+ // Only defining an ID for JS objects if its cache already exists allows
+ // the code to shortcut on the same path as a DOM node with no cache
+ id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey,
+ isEvents = name === "events";
+
+ // Avoid doing any more work than we need to when trying to get data on an
+ // object that has no data at all
+ if ( (!id || !cache[id] || (!isEvents && !pvt && !cache[id].data)) && getByName && data === undefined ) {
+ return;
+ }
+
+ if ( !id ) {
+ // Only DOM nodes need a new unique ID for each element since their data
+ // ends up in the global cache
+ if ( isNode ) {
+ elem[ internalKey ] = id = ++jQuery.uuid;
+ } else {
+ id = internalKey;
+ }
+ }
+
+ if ( !cache[ id ] ) {
+ cache[ id ] = {};
+
+ // Avoids exposing jQuery metadata on plain JS objects when the object
+ // is serialized using JSON.stringify
+ if ( !isNode ) {
+ cache[ id ].toJSON = jQuery.noop;
+ }
+ }
+
+ // An object can be passed to jQuery.data instead of a key/value pair; this gets
+ // shallow copied over onto the existing cache
+ if ( typeof name === "object" || typeof name === "function" ) {
+ if ( pvt ) {
+ cache[ id ] = jQuery.extend( cache[ id ], name );
+ } else {
+ cache[ id ].data = jQuery.extend( cache[ id ].data, name );
+ }
+ }
+
+ privateCache = thisCache = cache[ id ];
+
+ // jQuery data() is stored in a separate object inside the object's internal data
+ // cache in order to avoid key collisions between internal data and user-defined
+ // data.
+ if ( !pvt ) {
+ if ( !thisCache.data ) {
+ thisCache.data = {};
+ }
+
+ thisCache = thisCache.data;
+ }
+
+ if ( data !== undefined ) {
+ thisCache[ jQuery.camelCase( name ) ] = data;
+ }
+
+ // Users should not attempt to inspect the internal events object using jQuery.data,
+ // it is undocumented and subject to change. But does anyone listen? No.
+ if ( isEvents && !thisCache[ name ] ) {
+ return privateCache.events;
+ }
+
+ // Check for both converted-to-camel and non-converted data property names
+ // If a data property was specified
+ if ( getByName ) {
+
+ // First Try to find as-is property data
+ ret = thisCache[ name ];
+
+ // Test for null|undefined property data
+ if ( ret == null ) {
+
+ // Try to find the camelCased property
+ ret = thisCache[ jQuery.camelCase( name ) ];
+ }
+ } else {
+ ret = thisCache;
+ }
+
+ return ret;
+ },
+
+ removeData: function( elem, name, pvt /* Internal Use Only */ ) {
+ if ( !jQuery.acceptData( elem ) ) {
+ return;
+ }
+
+ var thisCache, i, l,
+
+ // Reference to internal data cache key
+ internalKey = jQuery.expando,
+
+ isNode = elem.nodeType,
+
+ // See jQuery.data for more information
+ cache = isNode ? jQuery.cache : elem,
+
+ // See jQuery.data for more information
+ id = isNode ? elem[ internalKey ] : internalKey;
+
+ // If there is already no cache entry for this object, there is no
+ // purpose in continuing
+ if ( !cache[ id ] ) {
+ return;
+ }
+
+ if ( name ) {
+
+ thisCache = pvt ? cache[ id ] : cache[ id ].data;
+
+ if ( thisCache ) {
+
+ // Support array or space separated string names for data keys
+ if ( !jQuery.isArray( name ) ) {
+
+ // try the string as a key before any manipulation
+ if ( name in thisCache ) {
+ name = [ name ];
+ } else {
+
+ // split the camel cased version by spaces unless a key with the spaces exists
+ name = jQuery.camelCase( name );
+ if ( name in thisCache ) {
+ name = [ name ];
+ } else {
+ name = name.split( " " );
+ }
+ }
+ }
+
+ for ( i = 0, l = name.length; i < l; i++ ) {
+ delete thisCache[ name[i] ];
+ }
+
+ // If there is no data left in the cache, we want to continue
+ // and let the cache object itself get destroyed
+ if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) {
+ return;
+ }
+ }
+ }
+
+ // See jQuery.data for more information
+ if ( !pvt ) {
+ delete cache[ id ].data;
+
+ // Don't destroy the parent cache unless the internal data object
+ // had been the only thing left in it
+ if ( !isEmptyDataObject(cache[ id ]) ) {
+ return;
+ }
+ }
+
+ // Browsers that fail expando deletion also refuse to delete expandos on
+ // the window, but it will allow it on all other JS objects; other browsers
+ // don't care
+ // Ensure that `cache` is not a window object #10080
+ if ( jQuery.support.deleteExpando || !cache.setInterval ) {
+ delete cache[ id ];
+ } else {
+ cache[ id ] = null;
+ }
+
+ // We destroyed the cache and need to eliminate the expando on the node to avoid
+ // false lookups in the cache for entries that no longer exist
+ if ( isNode ) {
+ // IE does not allow us to delete expando properties from nodes,
+ // nor does it have a removeAttribute function on Document nodes;
+ // we must handle all of these cases
+ if ( jQuery.support.deleteExpando ) {
+ delete elem[ internalKey ];
+ } else if ( elem.removeAttribute ) {
+ elem.removeAttribute( internalKey );
+ } else {
+ elem[ internalKey ] = null;
+ }
+ }
+ },
+
+ // For internal use only.
+ _data: function( elem, name, data ) {
+ return jQuery.data( elem, name, data, true );
+ },
+
+ // A method for determining if a DOM node can handle the data expando
+ acceptData: function( elem ) {
+ if ( elem.nodeName ) {
+ var match = jQuery.noData[ elem.nodeName.toLowerCase() ];
+
+ if ( match ) {
+ return !(match === true || elem.getAttribute("classid") !== match);
+ }
+ }
+
+ return true;
+ }
+});
+
+jQuery.fn.extend({
+ data: function( key, value ) {
+ var parts, part, attr, name, l,
+ elem = this[0],
+ i = 0,
+ data = null;
+
+ // Gets all values
+ if ( key === undefined ) {
+ if ( this.length ) {
+ data = jQuery.data( elem );
+
+ if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
+ attr = elem.attributes;
+ for ( l = attr.length; i < l; i++ ) {
+ name = attr[i].name;
+
+ if ( name.indexOf( "data-" ) === 0 ) {
+ name = jQuery.camelCase( name.substring(5) );
+
+ dataAttr( elem, name, data[ name ] );
+ }
+ }
+ jQuery._data( elem, "parsedAttrs", true );
+ }
+ }
+
+ return data;
+ }
+
+ // Sets multiple values
+ if ( typeof key === "object" ) {
+ return this.each(function() {
+ jQuery.data( this, key );
+ });
+ }
+
+ parts = key.split( ".", 2 );
+ parts[1] = parts[1] ? "." + parts[1] : "";
+ part = parts[1] + "!";
+
+ return jQuery.access( this, function( value ) {
+
+ if ( value === undefined ) {
+ data = this.triggerHandler( "getData" + part, [ parts[0] ] );
+
+ // Try to fetch any internally stored data first
+ if ( data === undefined && elem ) {
+ data = jQuery.data( elem, key );
+ data = dataAttr( elem, key, data );
+ }
+
+ return data === undefined && parts[1] ?
+ this.data( parts[0] ) :
+ data;
+ }
+
+ parts[1] = value;
+ this.each(function() {
+ var self = jQuery( this );
+
+ self.triggerHandler( "setData" + part, parts );
+ jQuery.data( this, key, value );
+ self.triggerHandler( "changeData" + part, parts );
+ });
+ }, null, value, arguments.length > 1, null, false );
+ },
+
+ removeData: function( key ) {
+ return this.each(function() {
+ jQuery.removeData( this, key );
+ });
+ }
+});
+
+function dataAttr( elem, key, data ) {
+ // If nothing was found internally, try to fetch any
+ // data from the HTML5 data-* attribute
+ if ( data === undefined && elem.nodeType === 1 ) {
+
+ var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
+
+ data = elem.getAttribute( name );
+
+ if ( typeof data === "string" ) {
+ try {
+ data = data === "true" ? true :
+ data === "false" ? false :
+ data === "null" ? null :
+ jQuery.isNumeric( data ) ? +data :
+ rbrace.test( data ) ? jQuery.parseJSON( data ) :
+ data;
+ } catch( e ) {}
+
+ // Make sure we set the data so it isn't changed later
+ jQuery.data( elem, key, data );
+
+ } else {
+ data = undefined;
+ }
+ }
+
+ return data;
+}
+
+// checks a cache object for emptiness
+function isEmptyDataObject( obj ) {
+ for ( var name in obj ) {
+
+ // if the public data object is empty, the private is still empty
+ if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
+ continue;
+ }
+ if ( name !== "toJSON" ) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+
+
+
+function handleQueueMarkDefer( elem, type, src ) {
+ var deferDataKey = type + "defer",
+ queueDataKey = type + "queue",
+ markDataKey = type + "mark",
+ defer = jQuery._data( elem, deferDataKey );
+ if ( defer &&
+ ( src === "queue" || !jQuery._data(elem, queueDataKey) ) &&
+ ( src === "mark" || !jQuery._data(elem, markDataKey) ) ) {
+ // Give room for hard-coded callbacks to fire first
+ // and eventually mark/queue something else on the element
+ setTimeout( function() {
+ if ( !jQuery._data( elem, queueDataKey ) &&
+ !jQuery._data( elem, markDataKey ) ) {
+ jQuery.removeData( elem, deferDataKey, true );
+ defer.fire();
+ }
+ }, 0 );
+ }
+}
+
+jQuery.extend({
+
+ _mark: function( elem, type ) {
+ if ( elem ) {
+ type = ( type || "fx" ) + "mark";
+ jQuery._data( elem, type, (jQuery._data( elem, type ) || 0) + 1 );
+ }
+ },
+
+ _unmark: function( force, elem, type ) {
+ if ( force !== true ) {
+ type = elem;
+ elem = force;
+ force = false;
+ }
+ if ( elem ) {
+ type = type || "fx";
+ var key = type + "mark",
+ count = force ? 0 : ( (jQuery._data( elem, key ) || 1) - 1 );
+ if ( count ) {
+ jQuery._data( elem, key, count );
+ } else {
+ jQuery.removeData( elem, key, true );
+ handleQueueMarkDefer( elem, type, "mark" );
+ }
+ }
+ },
+
+ queue: function( elem, type, data ) {
+ var q;
+ if ( elem ) {
+ type = ( type || "fx" ) + "queue";
+ q = jQuery._data( elem, type );
+
+ // Speed up dequeue by getting out quickly if this is just a lookup
+ if ( data ) {
+ if ( !q || jQuery.isArray(data) ) {
+ q = jQuery._data( elem, type, jQuery.makeArray(data) );
+ } else {
+ q.push( data );
+ }
+ }
+ return q || [];
+ }
+ },
+
+ dequeue: function( elem, type ) {
+ type = type || "fx";
+
+ var queue = jQuery.queue( elem, type ),
+ fn = queue.shift(),
+ hooks = {};
+
+ // If the fx queue is dequeued, always remove the progress sentinel
+ if ( fn === "inprogress" ) {
+ fn = queue.shift();
+ }
+
+ if ( fn ) {
+ // Add a progress sentinel to prevent the fx queue from being
+ // automatically dequeued
+ if ( type === "fx" ) {
+ queue.unshift( "inprogress" );
+ }
+
+ jQuery._data( elem, type + ".run", hooks );
+ fn.call( elem, function() {
+ jQuery.dequeue( elem, type );
+ }, hooks );
+ }
+
+ if ( !queue.length ) {
+ jQuery.removeData( elem, type + "queue " + type + ".run", true );
+ handleQueueMarkDefer( elem, type, "queue" );
+ }
+ }
+});
+
+jQuery.fn.extend({
+ queue: function( type, data ) {
+ var setter = 2;
+
+ if ( typeof type !== "string" ) {
+ data = type;
+ type = "fx";
+ setter--;
+ }
+
+ if ( arguments.length < setter ) {
+ return jQuery.queue( this[0], type );
+ }
+
+ return data === undefined ?
+ this :
+ this.each(function() {
+ var queue = jQuery.queue( this, type, data );
+
+ if ( type === "fx" && queue[0] !== "inprogress" ) {
+ jQuery.dequeue( this, type );
+ }
+ });
+ },
+ dequeue: function( type ) {
+ return this.each(function() {
+ jQuery.dequeue( this, type );
+ });
+ },
+ // Based off of the plugin by Clint Helfers, with permission.
+ // http://blindsignals.com/index.php/2009/07/jquery-delay/
+ delay: function( time, type ) {
+ time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
+ type = type || "fx";
+
+ return this.queue( type, function( next, hooks ) {
+ var timeout = setTimeout( next, time );
+ hooks.stop = function() {
+ clearTimeout( timeout );
+ };
+ });
+ },
+ clearQueue: function( type ) {
+ return this.queue( type || "fx", [] );
+ },
+ // Get a promise resolved when queues of a certain type
+ // are emptied (fx is the type by default)
+ promise: function( type, object ) {
+ if ( typeof type !== "string" ) {
+ object = type;
+ type = undefined;
+ }
+ type = type || "fx";
+ var defer = jQuery.Deferred(),
+ elements = this,
+ i = elements.length,
+ count = 1,
+ deferDataKey = type + "defer",
+ queueDataKey = type + "queue",
+ markDataKey = type + "mark",
+ tmp;
+ function resolve() {
+ if ( !( --count ) ) {
+ defer.resolveWith( elements, [ elements ] );
+ }
+ }
+ while( i-- ) {
+ if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) ||
+ ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) ||
+ jQuery.data( elements[ i ], markDataKey, undefined, true ) ) &&
+ jQuery.data( elements[ i ], deferDataKey, jQuery.Callbacks( "once memory" ), true ) )) {
+ count++;
+ tmp.add( resolve );
+ }
+ }
+ resolve();
+ return defer.promise( object );
+ }
+});
+
+
+
+
+var rclass = /[\n\t\r]/g,
+ rspace = /\s+/,
+ rreturn = /\r/g,
+ rtype = /^(?:button|input)$/i,
+ rfocusable = /^(?:button|input|object|select|textarea)$/i,
+ rclickable = /^a(?:rea)?$/i,
+ rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
+ getSetAttribute = jQuery.support.getSetAttribute,
+ nodeHook, boolHook, fixSpecified;
+
+jQuery.fn.extend({
+ attr: function( name, value ) {
+ return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 );
+ },
+
+ removeAttr: function( name ) {
+ return this.each(function() {
+ jQuery.removeAttr( this, name );
+ });
+ },
+
+ prop: function( name, value ) {
+ return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 );
+ },
+
+ removeProp: function( name ) {
+ name = jQuery.propFix[ name ] || name;
+ return this.each(function() {
+ // try/catch handles cases where IE balks (such as removing a property on window)
+ try {
+ this[ name ] = undefined;
+ delete this[ name ];
+ } catch( e ) {}
+ });
+ },
+
+ addClass: function( value ) {
+ var classNames, i, l, elem,
+ setClass, c, cl;
+
+ if ( jQuery.isFunction( value ) ) {
+ return this.each(function( j ) {
+ jQuery( this ).addClass( value.call(this, j, this.className) );
+ });
+ }
+
+ if ( value && typeof value === "string" ) {
+ classNames = value.split( rspace );
+
+ for ( i = 0, l = this.length; i < l; i++ ) {
+ elem = this[ i ];
+
+ if ( elem.nodeType === 1 ) {
+ if ( !elem.className && classNames.length === 1 ) {
+ elem.className = value;
+
+ } else {
+ setClass = " " + elem.className + " ";
+
+ for ( c = 0, cl = classNames.length; c < cl; c++ ) {
+ if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) {
+ setClass += classNames[ c ] + " ";
+ }
+ }
+ elem.className = jQuery.trim( setClass );
+ }
+ }
+ }
+ }
+
+ return this;
+ },
+
+ removeClass: function( value ) {
+ var classNames, i, l, elem, className, c, cl;
+
+ if ( jQuery.isFunction( value ) ) {
+ return this.each(function( j ) {
+ jQuery( this ).removeClass( value.call(this, j, this.className) );
+ });
+ }
+
+ if ( (value && typeof value === "string") || value === undefined ) {
+ classNames = ( value || "" ).split( rspace );
+
+ for ( i = 0, l = this.length; i < l; i++ ) {
+ elem = this[ i ];
+
+ if ( elem.nodeType === 1 && elem.className ) {
+ if ( value ) {
+ className = (" " + elem.className + " ").replace( rclass, " " );
+ for ( c = 0, cl = classNames.length; c < cl; c++ ) {
+ className = className.replace(" " + classNames[ c ] + " ", " ");
+ }
+ elem.className = jQuery.trim( className );
+
+ } else {
+ elem.className = "";
+ }
+ }
+ }
+ }
+
+ return this;
+ },
+
+ toggleClass: function( value, stateVal ) {
+ var type = typeof value,
+ isBool = typeof stateVal === "boolean";
+
+ if ( jQuery.isFunction( value ) ) {
+ return this.each(function( i ) {
+ jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
+ });
+ }
+
+ return this.each(function() {
+ if ( type === "string" ) {
+ // toggle individual class names
+ var className,
+ i = 0,
+ self = jQuery( this ),
+ state = stateVal,
+ classNames = value.split( rspace );
+
+ while ( (className = classNames[ i++ ]) ) {
+ // check each className given, space seperated list
+ state = isBool ? state : !self.hasClass( className );
+ self[ state ? "addClass" : "removeClass" ]( className );
+ }
+
+ } else if ( type === "undefined" || type === "boolean" ) {
+ if ( this.className ) {
+ // store className if set
+ jQuery._data( this, "__className__", this.className );
+ }
+
+ // toggle whole className
+ this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
+ }
+ });
+ },
+
+ hasClass: function( selector ) {
+ var className = " " + selector + " ",
+ i = 0,
+ l = this.length;
+ for ( ; i < l; i++ ) {
+ if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {
+ return true;
+ }
+ }
+
+ return false;
+ },
+
+ val: function( value ) {
+ var hooks, ret, isFunction,
+ elem = this[0];
+
+ if ( !arguments.length ) {
+ if ( elem ) {
+ hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
+
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
+ return ret;
+ }
+
+ ret = elem.value;
+
+ return typeof ret === "string" ?
+ // handle most common string cases
+ ret.replace(rreturn, "") :
+ // handle cases where value is null/undef or number
+ ret == null ? "" : ret;
+ }
+
+ return;
+ }
+
+ isFunction = jQuery.isFunction( value );
+
+ return this.each(function( i ) {
+ var self = jQuery(this), val;
+
+ if ( this.nodeType !== 1 ) {
+ return;
+ }
+
+ if ( isFunction ) {
+ val = value.call( this, i, self.val() );
+ } else {
+ val = value;
+ }
+
+ // Treat null/undefined as ""; convert numbers to string
+ if ( val == null ) {
+ val = "";
+ } else if ( typeof val === "number" ) {
+ val += "";
+ } else if ( jQuery.isArray( val ) ) {
+ val = jQuery.map(val, function ( value ) {
+ return value == null ? "" : value + "";
+ });
+ }
+
+ hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
+
+ // If set returns undefined, fall back to normal setting
+ if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
+ this.value = val;
+ }
+ });
+ }
+});
+
+jQuery.extend({
+ valHooks: {
+ option: {
+ get: function( elem ) {
+ // attributes.value is undefined in Blackberry 4.7 but
+ // uses .value. See #6932
+ var val = elem.attributes.value;
+ return !val || val.specified ? elem.value : elem.text;
+ }
+ },
+ select: {
+ get: function( elem ) {
+ var value, i, max, option,
+ index = elem.selectedIndex,
+ values = [],
+ options = elem.options,
+ one = elem.type === "select-one";
+
+ // Nothing was selected
+ if ( index < 0 ) {
+ return null;
+ }
+
+ // Loop through all the selected options
+ i = one ? index : 0;
+ max = one ? index + 1 : options.length;
+ for ( ; i < max; i++ ) {
+ option = options[ i ];
+
+ // Don't return options that are disabled or in a disabled optgroup
+ if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
+ (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
+
+ // Get the specific value for the option
+ value = jQuery( option ).val();
+
+ // We don't need an array for one selects
+ if ( one ) {
+ return value;
+ }
+
+ // Multi-Selects return an array
+ values.push( value );
+ }
+ }
+
+ // Fixes Bug #2551 -- select.val() broken in IE after form.reset()
+ if ( one && !values.length && options.length ) {
+ return jQuery( options[ index ] ).val();
+ }
+
+ return values;
+ },
+
+ set: function( elem, value ) {
+ var values = jQuery.makeArray( value );
+
+ jQuery(elem).find("option").each(function() {
+ this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
+ });
+
+ if ( !values.length ) {
+ elem.selectedIndex = -1;
+ }
+ return values;
+ }
+ }
+ },
+
+ attrFn: {
+ val: true,
+ css: true,
+ html: true,
+ text: true,
+ data: true,
+ width: true,
+ height: true,
+ offset: true
+ },
+
+ attr: function( elem, name, value, pass ) {
+ var ret, hooks, notxml,
+ nType = elem.nodeType;
+
+ // don't get/set attributes on text, comment and attribute nodes
+ if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
+ return;
+ }
+
+ if ( pass && name in jQuery.attrFn ) {
+ return jQuery( elem )[ name ]( value );
+ }
+
+ // Fallback to prop when attributes are not supported
+ if ( typeof elem.getAttribute === "undefined" ) {
+ return jQuery.prop( elem, name, value );
+ }
+
+ notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
+
+ // All attributes are lowercase
+ // Grab necessary hook if one is defined
+ if ( notxml ) {
+ name = name.toLowerCase();
+ hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook );
+ }
+
+ if ( value !== undefined ) {
+
+ if ( value === null ) {
+ jQuery.removeAttr( elem, name );
+ return;
+
+ } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) {
+ return ret;
+
+ } else {
+ elem.setAttribute( name, "" + value );
+ return value;
+ }
+
+ } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) {
+ return ret;
+
+ } else {
+
+ ret = elem.getAttribute( name );
+
+ // Non-existent attributes return null, we normalize to undefined
+ return ret === null ?
+ undefined :
+ ret;
+ }
+ },
+
+ removeAttr: function( elem, value ) {
+ var propName, attrNames, name, l, isBool,
+ i = 0;
+
+ if ( value && elem.nodeType === 1 ) {
+ attrNames = value.toLowerCase().split( rspace );
+ l = attrNames.length;
+
+ for ( ; i < l; i++ ) {
+ name = attrNames[ i ];
+
+ if ( name ) {
+ propName = jQuery.propFix[ name ] || name;
+ isBool = rboolean.test( name );
+
+ // See #9699 for explanation of this approach (setting first, then removal)
+ // Do not do this for boolean attributes (see #10870)
+ if ( !isBool ) {
+ jQuery.attr( elem, name, "" );
+ }
+ elem.removeAttribute( getSetAttribute ? name : propName );
+
+ // Set corresponding property to false for boolean attributes
+ if ( isBool && propName in elem ) {
+ elem[ propName ] = false;
+ }
+ }
+ }
+ }
+ },
+
+ attrHooks: {
+ type: {
+ set: function( elem, value ) {
+ // We can't allow the type property to be changed (since it causes problems in IE)
+ if ( rtype.test( elem.nodeName ) && elem.parentNode ) {
+ jQuery.error( "type property can't be changed" );
+ } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
+ // Setting the type on a radio button after the value resets the value in IE6-9
+ // Reset value to it's default in case type is set after value
+ // This is for element creation
+ var val = elem.value;
+ elem.setAttribute( "type", value );
+ if ( val ) {
+ elem.value = val;
+ }
+ return value;
+ }
+ }
+ },
+ // Use the value property for back compat
+ // Use the nodeHook for button elements in IE6/7 (#1954)
+ value: {
+ get: function( elem, name ) {
+ if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
+ return nodeHook.get( elem, name );
+ }
+ return name in elem ?
+ elem.value :
+ null;
+ },
+ set: function( elem, value, name ) {
+ if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
+ return nodeHook.set( elem, value, name );
+ }
+ // Does not return so that setAttribute is also used
+ elem.value = value;
+ }
+ }
+ },
+
+ propFix: {
+ tabindex: "tabIndex",
+ readonly: "readOnly",
+ "for": "htmlFor",
+ "class": "className",
+ maxlength: "maxLength",
+ cellspacing: "cellSpacing",
+ cellpadding: "cellPadding",
+ rowspan: "rowSpan",
+ colspan: "colSpan",
+ usemap: "useMap",
+ frameborder: "frameBorder",
+ contenteditable: "contentEditable"
+ },
+
+ prop: function( elem, name, value ) {
+ var ret, hooks, notxml,
+ nType = elem.nodeType;
+
+ // don't get/set properties on text, comment and attribute nodes
+ if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
+ return;
+ }
+
+ notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
+
+ if ( notxml ) {
+ // Fix name and attach hooks
+ name = jQuery.propFix[ name ] || name;
+ hooks = jQuery.propHooks[ name ];
+ }
+
+ if ( value !== undefined ) {
+ if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
+ return ret;
+
+ } else {
+ return ( elem[ name ] = value );
+ }
+
+ } else {
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
+ return ret;
+
+ } else {
+ return elem[ name ];
+ }
+ }
+ },
+
+ propHooks: {
+ tabIndex: {
+ get: function( elem ) {
+ // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
+ // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
+ var attributeNode = elem.getAttributeNode("tabindex");
+
+ return attributeNode && attributeNode.specified ?
+ parseInt( attributeNode.value, 10 ) :
+ rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
+ 0 :
+ undefined;
+ }
+ }
+ }
+});
+
+// Add the tabIndex propHook to attrHooks for back-compat (different case is intentional)
+jQuery.attrHooks.tabindex = jQuery.propHooks.tabIndex;
+
+// Hook for boolean attributes
+boolHook = {
+ get: function( elem, name ) {
+ // Align boolean attributes with corresponding properties
+ // Fall back to attribute presence where some booleans are not supported
+ var attrNode,
+ property = jQuery.prop( elem, name );
+ return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?
+ name.toLowerCase() :
+ undefined;
+ },
+ set: function( elem, value, name ) {
+ var propName;
+ if ( value === false ) {
+ // Remove boolean attributes when set to false
+ jQuery.removeAttr( elem, name );
+ } else {
+ // value is true since we know at this point it's type boolean and not false
+ // Set boolean attributes to the same name and set the DOM property
+ propName = jQuery.propFix[ name ] || name;
+ if ( propName in elem ) {
+ // Only set the IDL specifically if it already exists on the element
+ elem[ propName ] = true;
+ }
+
+ elem.setAttribute( name, name.toLowerCase() );
+ }
+ return name;
+ }
+};
+
+// IE6/7 do not support getting/setting some attributes with get/setAttribute
+if ( !getSetAttribute ) {
+
+ fixSpecified = {
+ name: true,
+ id: true,
+ coords: true
+ };
+
+ // Use this for any attribute in IE6/7
+ // This fixes almost every IE6/7 issue
+ nodeHook = jQuery.valHooks.button = {
+ get: function( elem, name ) {
+ var ret;
+ ret = elem.getAttributeNode( name );
+ return ret && ( fixSpecified[ name ] ? ret.nodeValue !== "" : ret.specified ) ?
+ ret.nodeValue :
+ undefined;
+ },
+ set: function( elem, value, name ) {
+ // Set the existing or create a new attribute node
+ var ret = elem.getAttributeNode( name );
+ if ( !ret ) {
+ ret = document.createAttribute( name );
+ elem.setAttributeNode( ret );
+ }
+ return ( ret.nodeValue = value + "" );
+ }
+ };
+
+ // Apply the nodeHook to tabindex
+ jQuery.attrHooks.tabindex.set = nodeHook.set;
+
+ // Set width and height to auto instead of 0 on empty string( Bug #8150 )
+ // This is for removals
+ jQuery.each([ "width", "height" ], function( i, name ) {
+ jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
+ set: function( elem, value ) {
+ if ( value === "" ) {
+ elem.setAttribute( name, "auto" );
+ return value;
+ }
+ }
+ });
+ });
+
+ // Set contenteditable to false on removals(#10429)
+ // Setting to empty string throws an error as an invalid value
+ jQuery.attrHooks.contenteditable = {
+ get: nodeHook.get,
+ set: function( elem, value, name ) {
+ if ( value === "" ) {
+ value = "false";
+ }
+ nodeHook.set( elem, value, name );
+ }
+ };
+}
+
+
+// Some attributes require a special call on IE
+if ( !jQuery.support.hrefNormalized ) {
+ jQuery.each([ "href", "src", "width", "height" ], function( i, name ) {
+ jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
+ get: function( elem ) {
+ var ret = elem.getAttribute( name, 2 );
+ return ret === null ? undefined : ret;
+ }
+ });
+ });
+}
+
+if ( !jQuery.support.style ) {
+ jQuery.attrHooks.style = {
+ get: function( elem ) {
+ // Return undefined in the case of empty string
+ // Normalize to lowercase since IE uppercases css property names
+ return elem.style.cssText.toLowerCase() || undefined;
+ },
+ set: function( elem, value ) {
+ return ( elem.style.cssText = "" + value );
+ }
+ };
+}
+
+// Safari mis-reports the default selected property of an option
+// Accessing the parent's selectedIndex property fixes it
+if ( !jQuery.support.optSelected ) {
+ jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {
+ get: function( elem ) {
+ var parent = elem.parentNode;
+
+ if ( parent ) {
+ parent.selectedIndex;
+
+ // Make sure that it also works with optgroups, see #5701
+ if ( parent.parentNode ) {
+ parent.parentNode.selectedIndex;
+ }
+ }
+ return null;
+ }
+ });
+}
+
+// IE6/7 call enctype encoding
+if ( !jQuery.support.enctype ) {
+ jQuery.propFix.enctype = "encoding";
+}
+
+// Radios and checkboxes getter/setter
+if ( !jQuery.support.checkOn ) {
+ jQuery.each([ "radio", "checkbox" ], function() {
+ jQuery.valHooks[ this ] = {
+ get: function( elem ) {
+ // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
+ return elem.getAttribute("value") === null ? "on" : elem.value;
+ }
+ };
+ });
+}
+jQuery.each([ "radio", "checkbox" ], function() {
+ jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {
+ set: function( elem, value ) {
+ if ( jQuery.isArray( value ) ) {
+ return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
+ }
+ }
+ });
+});
+
+
+
+
+var rformElems = /^(?:textarea|input|select)$/i,
+ rtypenamespace = /^([^\.]*)?(?:\.(.+))?$/,
+ rhoverHack = /(?:^|\s)hover(\.\S+)?\b/,
+ rkeyEvent = /^key/,
+ rmouseEvent = /^(?:mouse|contextmenu)|click/,
+ rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
+ rquickIs = /^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,
+ quickParse = function( selector ) {
+ var quick = rquickIs.exec( selector );
+ if ( quick ) {
+ // 0 1 2 3
+ // [ _, tag, id, class ]
+ quick[1] = ( quick[1] || "" ).toLowerCase();
+ quick[3] = quick[3] && new RegExp( "(?:^|\\s)" + quick[3] + "(?:\\s|$)" );
+ }
+ return quick;
+ },
+ quickIs = function( elem, m ) {
+ var attrs = elem.attributes || {};
+ return (
+ (!m[1] || elem.nodeName.toLowerCase() === m[1]) &&
+ (!m[2] || (attrs.id || {}).value === m[2]) &&
+ (!m[3] || m[3].test( (attrs[ "class" ] || {}).value ))
+ );
+ },
+ hoverHack = function( events ) {
+ return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );
+ };
+
+/*
+ * Helper functions for managing events -- not part of the public interface.
+ * Props to Dean Edwards' addEvent library for many of the ideas.
+ */
+jQuery.event = {
+
+ add: function( elem, types, handler, data, selector ) {
+
+ var elemData, eventHandle, events,
+ t, tns, type, namespaces, handleObj,
+ handleObjIn, quick, handlers, special;
+
+ // Don't attach events to noData or text/comment nodes (allow plain objects tho)
+ if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) {
+ return;
+ }
+
+ // Caller can pass in an object of custom data in lieu of the handler
+ if ( handler.handler ) {
+ handleObjIn = handler;
+ handler = handleObjIn.handler;
+ selector = handleObjIn.selector;
+ }
+
+ // Make sure that the handler has a unique ID, used to find/remove it later
+ if ( !handler.guid ) {
+ handler.guid = jQuery.guid++;
+ }
+
+ // Init the element's event structure and main handler, if this is the first
+ events = elemData.events;
+ if ( !events ) {
+ elemData.events = events = {};
+ }
+ eventHandle = elemData.handle;
+ if ( !eventHandle ) {
+ elemData.handle = eventHandle = function( e ) {
+ // Discard the second event of a jQuery.event.trigger() and
+ // when an event is called after a page has unloaded
+ return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ?
+ jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
+ undefined;
+ };
+ // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
+ eventHandle.elem = elem;
+ }
+
+ // Handle multiple events separated by a space
+ // jQuery(...).bind("mouseover mouseout", fn);
+ types = jQuery.trim( hoverHack(types) ).split( " " );
+ for ( t = 0; t < types.length; t++ ) {
+
+ tns = rtypenamespace.exec( types[t] ) || [];
+ type = tns[1];
+ namespaces = ( tns[2] || "" ).split( "." ).sort();
+
+ // If event changes its type, use the special event handlers for the changed type
+ special = jQuery.event.special[ type ] || {};
+
+ // If selector defined, determine special event api type, otherwise given type
+ type = ( selector ? special.delegateType : special.bindType ) || type;
+
+ // Update special based on newly reset type
+ special = jQuery.event.special[ type ] || {};
+
+ // handleObj is passed to all event handlers
+ handleObj = jQuery.extend({
+ type: type,
+ origType: tns[1],
+ data: data,
+ handler: handler,
+ guid: handler.guid,
+ selector: selector,
+ quick: selector && quickParse( selector ),
+ namespace: namespaces.join(".")
+ }, handleObjIn );
+
+ // Init the event handler queue if we're the first
+ handlers = events[ type ];
+ if ( !handlers ) {
+ handlers = events[ type ] = [];
+ handlers.delegateCount = 0;
+
+ // Only use addEventListener/attachEvent if the special events handler returns false
+ if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
+ // Bind the global event handler to the element
+ if ( elem.addEventListener ) {
+ elem.addEventListener( type, eventHandle, false );
+
+ } else if ( elem.attachEvent ) {
+ elem.attachEvent( "on" + type, eventHandle );
+ }
+ }
+ }
+
+ if ( special.add ) {
+ special.add.call( elem, handleObj );
+
+ if ( !handleObj.handler.guid ) {
+ handleObj.handler.guid = handler.guid;
+ }
+ }
+
+ // Add to the element's handler list, delegates in front
+ if ( selector ) {
+ handlers.splice( handlers.delegateCount++, 0, handleObj );
+ } else {
+ handlers.push( handleObj );
+ }
+
+ // Keep track of which events have ever been used, for event optimization
+ jQuery.event.global[ type ] = true;
+ }
+
+ // Nullify elem to prevent memory leaks in IE
+ elem = null;
+ },
+
+ global: {},
+
+ // Detach an event or set of events from an element
+ remove: function( elem, types, handler, selector, mappedTypes ) {
+
+ var elemData = jQuery.hasData( elem ) && jQuery._data( elem ),
+ t, tns, type, origType, namespaces, origCount,
+ j, events, special, handle, eventType, handleObj;
+
+ if ( !elemData || !(events = elemData.events) ) {
+ return;
+ }
+
+ // Once for each type.namespace in types; type may be omitted
+ types = jQuery.trim( hoverHack( types || "" ) ).split(" ");
+ for ( t = 0; t < types.length; t++ ) {
+ tns = rtypenamespace.exec( types[t] ) || [];
+ type = origType = tns[1];
+ namespaces = tns[2];
+
+ // Unbind all events (on this namespace, if provided) for the element
+ if ( !type ) {
+ for ( type in events ) {
+ jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
+ }
+ continue;
+ }
+
+ special = jQuery.event.special[ type ] || {};
+ type = ( selector? special.delegateType : special.bindType ) || type;
+ eventType = events[ type ] || [];
+ origCount = eventType.length;
+ namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.)?") + "(\\.|$)") : null;
+
+ // Remove matching events
+ for ( j = 0; j < eventType.length; j++ ) {
+ handleObj = eventType[ j ];
+
+ if ( ( mappedTypes || origType === handleObj.origType ) &&
+ ( !handler || handler.guid === handleObj.guid ) &&
+ ( !namespaces || namespaces.test( handleObj.namespace ) ) &&
+ ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
+ eventType.splice( j--, 1 );
+
+ if ( handleObj.selector ) {
+ eventType.delegateCount--;
+ }
+ if ( special.remove ) {
+ special.remove.call( elem, handleObj );
+ }
+ }
+ }
+
+ // Remove generic event handler if we removed something and no more handlers exist
+ // (avoids potential for endless recursion during removal of special event handlers)
+ if ( eventType.length === 0 && origCount !== eventType.length ) {
+ if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
+ jQuery.removeEvent( elem, type, elemData.handle );
+ }
+
+ delete events[ type ];
+ }
+ }
+
+ // Remove the expando if it's no longer used
+ if ( jQuery.isEmptyObject( events ) ) {
+ handle = elemData.handle;
+ if ( handle ) {
+ handle.elem = null;
+ }
+
+ // removeData also checks for emptiness and clears the expando if empty
+ // so use it instead of delete
+ jQuery.removeData( elem, [ "events", "handle" ], true );
+ }
+ },
+
+ // Events that are safe to short-circuit if no handlers are attached.
+ // Native DOM events should not be added, they may have inline handlers.
+ customEvent: {
+ "getData": true,
+ "setData": true,
+ "changeData": true
+ },
+
+ trigger: function( event, data, elem, onlyHandlers ) {
+ // Don't do events on text and comment nodes
+ if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) {
+ return;
+ }
+
+ // Event object or event type
+ var type = event.type || event,
+ namespaces = [],
+ cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType;
+
+ // focus/blur morphs to focusin/out; ensure we're not firing them right now
+ if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
+ return;
+ }
+
+ if ( type.indexOf( "!" ) >= 0 ) {
+ // Exclusive events trigger only for the exact event (no namespaces)
+ type = type.slice(0, -1);
+ exclusive = true;
+ }
+
+ if ( type.indexOf( "." ) >= 0 ) {
+ // Namespaced trigger; create a regexp to match event type in handle()
+ namespaces = type.split(".");
+ type = namespaces.shift();
+ namespaces.sort();
+ }
+
+ if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) {
+ // No jQuery handlers for this event type, and it can't have inline handlers
+ return;
+ }
+
+ // Caller can pass in an Event, Object, or just an event type string
+ event = typeof event === "object" ?
+ // jQuery.Event object
+ event[ jQuery.expando ] ? event :
+ // Object literal
+ new jQuery.Event( type, event ) :
+ // Just the event type (string)
+ new jQuery.Event( type );
+
+ event.type = type;
+ event.isTrigger = true;
+ event.exclusive = exclusive;
+ event.namespace = namespaces.join( "." );
+ event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)") : null;
+ ontype = type.indexOf( ":" ) < 0 ? "on" + type : "";
+
+ // Handle a global trigger
+ if ( !elem ) {
+
+ // TODO: Stop taunting the data cache; remove global events and always attach to document
+ cache = jQuery.cache;
+ for ( i in cache ) {
+ if ( cache[ i ].events && cache[ i ].events[ type ] ) {
+ jQuery.event.trigger( event, data, cache[ i ].handle.elem, true );
+ }
+ }
+ return;
+ }
+
+ // Clean up the event in case it is being reused
+ event.result = undefined;
+ if ( !event.target ) {
+ event.target = elem;
+ }
+
+ // Clone any incoming data and prepend the event, creating the handler arg list
+ data = data != null ? jQuery.makeArray( data ) : [];
+ data.unshift( event );
+
+ // Allow special events to draw outside the lines
+ special = jQuery.event.special[ type ] || {};
+ if ( special.trigger && special.trigger.apply( elem, data ) === false ) {
+ return;
+ }
+
+ // Determine event propagation path in advance, per W3C events spec (#9951)
+ // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
+ eventPath = [[ elem, special.bindType || type ]];
+ if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
+
+ bubbleType = special.delegateType || type;
+ cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode;
+ old = null;
+ for ( ; cur; cur = cur.parentNode ) {
+ eventPath.push([ cur, bubbleType ]);
+ old = cur;
+ }
+
+ // Only add window if we got to document (e.g., not plain obj or detached DOM)
+ if ( old && old === elem.ownerDocument ) {
+ eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]);
+ }
+ }
+
+ // Fire handlers on the event path
+ for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) {
+
+ cur = eventPath[i][0];
+ event.type = eventPath[i][1];
+
+ handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );
+ if ( handle ) {
+ handle.apply( cur, data );
+ }
+ // Note that this is a bare JS function and not a jQuery handler
+ handle = ontype && cur[ ontype ];
+ if ( handle && jQuery.acceptData( cur ) && handle.apply( cur, data ) === false ) {
+ event.preventDefault();
+ }
+ }
+ event.type = type;
+
+ // If nobody prevented the default action, do it now
+ if ( !onlyHandlers && !event.isDefaultPrevented() ) {
+
+ if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) &&
+ !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {
+
+ // Call a native DOM method on the target with the same name name as the event.
+ // Can't use an .isFunction() check here because IE6/7 fails that test.
+ // Don't do default actions on window, that's where global variables be (#6170)
+ // IE<9 dies on focus/blur to hidden element (#1486)
+ if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) {
+
+ // Don't re-trigger an onFOO event when we call its FOO() method
+ old = elem[ ontype ];
+
+ if ( old ) {
+ elem[ ontype ] = null;
+ }
+
+ // Prevent re-triggering of the same event, since we already bubbled it above
+ jQuery.event.triggered = type;
+ elem[ type ]();
+ jQuery.event.triggered = undefined;
+
+ if ( old ) {
+ elem[ ontype ] = old;
+ }
+ }
+ }
+ }
+
+ return event.result;
+ },
+
+ dispatch: function( event ) {
+
+ // Make a writable jQuery.Event from the native event object
+ event = jQuery.event.fix( event || window.event );
+
+ var handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []),
+ delegateCount = handlers.delegateCount,
+ args = [].slice.call( arguments, 0 ),
+ run_all = !event.exclusive && !event.namespace,
+ special = jQuery.event.special[ event.type ] || {},
+ handlerQueue = [],
+ i, j, cur, jqcur, ret, selMatch, matched, matches, handleObj, sel, related;
+
+ // Use the fix-ed jQuery.Event rather than the (read-only) native event
+ args[0] = event;
+ event.delegateTarget = this;
+
+ // Call the preDispatch hook for the mapped type, and let it bail if desired
+ if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
+ return;
+ }
+
+ // Determine handlers that should run if there are delegated events
+ // Avoid non-left-click bubbling in Firefox (#3861)
+ if ( delegateCount && !(event.button && event.type === "click") ) {
+
+ // Pregenerate a single jQuery object for reuse with .is()
+ jqcur = jQuery(this);
+ jqcur.context = this.ownerDocument || this;
+
+ for ( cur = event.target; cur != this; cur = cur.parentNode || this ) {
+
+ // Don't process events on disabled elements (#6911, #8165)
+ if ( cur.disabled !== true ) {
+ selMatch = {};
+ matches = [];
+ jqcur[0] = cur;
+ for ( i = 0; i < delegateCount; i++ ) {
+ handleObj = handlers[ i ];
+ sel = handleObj.selector;
+
+ if ( selMatch[ sel ] === undefined ) {
+ selMatch[ sel ] = (
+ handleObj.quick ? quickIs( cur, handleObj.quick ) : jqcur.is( sel )
+ );
+ }
+ if ( selMatch[ sel ] ) {
+ matches.push( handleObj );
+ }
+ }
+ if ( matches.length ) {
+ handlerQueue.push({ elem: cur, matches: matches });
+ }
+ }
+ }
+ }
+
+ // Add the remaining (directly-bound) handlers
+ if ( handlers.length > delegateCount ) {
+ handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) });
+ }
+
+ // Run delegates first; they may want to stop propagation beneath us
+ for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) {
+ matched = handlerQueue[ i ];
+ event.currentTarget = matched.elem;
+
+ for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) {
+ handleObj = matched.matches[ j ];
+
+ // Triggered event must either 1) be non-exclusive and have no namespace, or
+ // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
+ if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) {
+
+ event.data = handleObj.data;
+ event.handleObj = handleObj;
+
+ ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
+ .apply( matched.elem, args );
+
+ if ( ret !== undefined ) {
+ event.result = ret;
+ if ( ret === false ) {
+ event.preventDefault();
+ event.stopPropagation();
+ }
+ }
+ }
+ }
+ }
+
+ // Call the postDispatch hook for the mapped type
+ if ( special.postDispatch ) {
+ special.postDispatch.call( this, event );
+ }
+
+ return event.result;
+ },
+
+ // Includes some event props shared by KeyEvent and MouseEvent
+ // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 ***
+ props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
+
+ fixHooks: {},
+
+ keyHooks: {
+ props: "char charCode key keyCode".split(" "),
+ filter: function( event, original ) {
+
+ // Add which for key events
+ if ( event.which == null ) {
+ event.which = original.charCode != null ? original.charCode : original.keyCode;
+ }
+
+ return event;
+ }
+ },
+
+ mouseHooks: {
+ props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
+ filter: function( event, original ) {
+ var eventDoc, doc, body,
+ button = original.button,
+ fromElement = original.fromElement;
+
+ // Calculate pageX/Y if missing and clientX/Y available
+ if ( event.pageX == null && original.clientX != null ) {
+ eventDoc = event.target.ownerDocument || document;
+ doc = eventDoc.documentElement;
+ body = eventDoc.body;
+
+ event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
+ event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
+ }
+
+ // Add relatedTarget, if necessary
+ if ( !event.relatedTarget && fromElement ) {
+ event.relatedTarget = fromElement === event.target ? original.toElement : fromElement;
+ }
+
+ // Add which for click: 1 === left; 2 === middle; 3 === right
+ // Note: button is not normalized, so don't use it
+ if ( !event.which && button !== undefined ) {
+ event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
+ }
+
+ return event;
+ }
+ },
+
+ fix: function( event ) {
+ if ( event[ jQuery.expando ] ) {
+ return event;
+ }
+
+ // Create a writable copy of the event object and normalize some properties
+ var i, prop,
+ originalEvent = event,
+ fixHook = jQuery.event.fixHooks[ event.type ] || {},
+ copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
+
+ event = jQuery.Event( originalEvent );
+
+ for ( i = copy.length; i; ) {
+ prop = copy[ --i ];
+ event[ prop ] = originalEvent[ prop ];
+ }
+
+ // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2)
+ if ( !event.target ) {
+ event.target = originalEvent.srcElement || document;
+ }
+
+ // Target should not be a text node (#504, Safari)
+ if ( event.target.nodeType === 3 ) {
+ event.target = event.target.parentNode;
+ }
+
+ // For mouse/key events; add metaKey if it's not there (#3368, IE6/7/8)
+ if ( event.metaKey === undefined ) {
+ event.metaKey = event.ctrlKey;
+ }
+
+ return fixHook.filter? fixHook.filter( event, originalEvent ) : event;
+ },
+
+ special: {
+ ready: {
+ // Make sure the ready event is setup
+ setup: jQuery.bindReady
+ },
+
+ load: {
+ // Prevent triggered image.load events from bubbling to window.load
+ noBubble: true
+ },
+
+ focus: {
+ delegateType: "focusin"
+ },
+ blur: {
+ delegateType: "focusout"
+ },
+
+ beforeunload: {
+ setup: function( data, namespaces, eventHandle ) {
+ // We only want to do this special case on windows
+ if ( jQuery.isWindow( this ) ) {
+ this.onbeforeunload = eventHandle;
+ }
+ },
+
+ teardown: function( namespaces, eventHandle ) {
+ if ( this.onbeforeunload === eventHandle ) {
+ this.onbeforeunload = null;
+ }
+ }
+ }
+ },
+
+ simulate: function( type, elem, event, bubble ) {
+ // Piggyback on a donor event to simulate a different one.
+ // Fake originalEvent to avoid donor's stopPropagation, but if the
+ // simulated event prevents default then we do the same on the donor.
+ var e = jQuery.extend(
+ new jQuery.Event(),
+ event,
+ { type: type,
+ isSimulated: true,
+ originalEvent: {}
+ }
+ );
+ if ( bubble ) {
+ jQuery.event.trigger( e, null, elem );
+ } else {
+ jQuery.event.dispatch.call( elem, e );
+ }
+ if ( e.isDefaultPrevented() ) {
+ event.preventDefault();
+ }
+ }
+};
+
+// Some plugins are using, but it's undocumented/deprecated and will be removed.
+// The 1.7 special event interface should provide all the hooks needed now.
+jQuery.event.handle = jQuery.event.dispatch;
+
+jQuery.removeEvent = document.removeEventListener ?
+ function( elem, type, handle ) {
+ if ( elem.removeEventListener ) {
+ elem.removeEventListener( type, handle, false );
+ }
+ } :
+ function( elem, type, handle ) {
+ if ( elem.detachEvent ) {
+ elem.detachEvent( "on" + type, handle );
+ }
+ };
+
+jQuery.Event = function( src, props ) {
+ // Allow instantiation without the 'new' keyword
+ if ( !(this instanceof jQuery.Event) ) {
+ return new jQuery.Event( src, props );
+ }
+
+ // Event object
+ if ( src && src.type ) {
+ this.originalEvent = src;
+ this.type = src.type;
+
+ // Events bubbling up the document may have been marked as prevented
+ // by a handler lower down the tree; reflect the correct value.
+ this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false ||
+ src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;
+
+ // Event type
+ } else {
+ this.type = src;
+ }
+
+ // Put explicitly provided properties onto the event object
+ if ( props ) {
+ jQuery.extend( this, props );
+ }
+
+ // Create a timestamp if incoming event doesn't have one
+ this.timeStamp = src && src.timeStamp || jQuery.now();
+
+ // Mark it as fixed
+ this[ jQuery.expando ] = true;
+};
+
+function returnFalse() {
+ return false;
+}
+function returnTrue() {
+ return true;
+}
+
+// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
+// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
+jQuery.Event.prototype = {
+ preventDefault: function() {
+ this.isDefaultPrevented = returnTrue;
+
+ var e = this.originalEvent;
+ if ( !e ) {
+ return;
+ }
+
+ // if preventDefault exists run it on the original event
+ if ( e.preventDefault ) {
+ e.preventDefault();
+
+ // otherwise set the returnValue property of the original event to false (IE)
+ } else {
+ e.returnValue = false;
+ }
+ },
+ stopPropagation: function() {
+ this.isPropagationStopped = returnTrue;
+
+ var e = this.originalEvent;
+ if ( !e ) {
+ return;
+ }
+ // if stopPropagation exists run it on the original event
+ if ( e.stopPropagation ) {
+ e.stopPropagation();
+ }
+ // otherwise set the cancelBubble property of the original event to true (IE)
+ e.cancelBubble = true;
+ },
+ stopImmediatePropagation: function() {
+ this.isImmediatePropagationStopped = returnTrue;
+ this.stopPropagation();
+ },
+ isDefaultPrevented: returnFalse,
+ isPropagationStopped: returnFalse,
+ isImmediatePropagationStopped: returnFalse
+};
+
+// Create mouseenter/leave events using mouseover/out and event-time checks
+jQuery.each({
+ mouseenter: "mouseover",
+ mouseleave: "mouseout"
+}, function( orig, fix ) {
+ jQuery.event.special[ orig ] = {
+ delegateType: fix,
+ bindType: fix,
+
+ handle: function( event ) {
+ var target = this,
+ related = event.relatedTarget,
+ handleObj = event.handleObj,
+ selector = handleObj.selector,
+ ret;
+
+ // For mousenter/leave call the handler if related is outside the target.
+ // NB: No relatedTarget if the mouse left/entered the browser window
+ if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
+ event.type = handleObj.origType;
+ ret = handleObj.handler.apply( this, arguments );
+ event.type = fix;
+ }
+ return ret;
+ }
+ };
+});
+
+// IE submit delegation
+if ( !jQuery.support.submitBubbles ) {
+
+ jQuery.event.special.submit = {
+ setup: function() {
+ // Only need this for delegated form submit events
+ if ( jQuery.nodeName( this, "form" ) ) {
+ return false;
+ }
+
+ // Lazy-add a submit handler when a descendant form may potentially be submitted
+ jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
+ // Node name check avoids a VML-related crash in IE (#9807)
+ var elem = e.target,
+ form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined;
+ if ( form && !form._submit_attached ) {
+ jQuery.event.add( form, "submit._submit", function( event ) {
+ event._submit_bubble = true;
+ });
+ form._submit_attached = true;
+ }
+ });
+ // return undefined since we don't need an event listener
+ },
+
+ postDispatch: function( event ) {
+ // If form was submitted by the user, bubble the event up the tree
+ if ( event._submit_bubble ) {
+ delete event._submit_bubble;
+ if ( this.parentNode && !event.isTrigger ) {
+ jQuery.event.simulate( "submit", this.parentNode, event, true );
+ }
+ }
+ },
+
+ teardown: function() {
+ // Only need this for delegated form submit events
+ if ( jQuery.nodeName( this, "form" ) ) {
+ return false;
+ }
+
+ // Remove delegated handlers; cleanData eventually reaps submit handlers attached above
+ jQuery.event.remove( this, "._submit" );
+ }
+ };
+}
+
+// IE change delegation and checkbox/radio fix
+if ( !jQuery.support.changeBubbles ) {
+
+ jQuery.event.special.change = {
+
+ setup: function() {
+
+ if ( rformElems.test( this.nodeName ) ) {
+ // IE doesn't fire change on a check/radio until blur; trigger it on click
+ // after a propertychange. Eat the blur-change in special.change.handle.
+ // This still fires onchange a second time for check/radio after blur.
+ if ( this.type === "checkbox" || this.type === "radio" ) {
+ jQuery.event.add( this, "propertychange._change", function( event ) {
+ if ( event.originalEvent.propertyName === "checked" ) {
+ this._just_changed = true;
+ }
+ });
+ jQuery.event.add( this, "click._change", function( event ) {
+ if ( this._just_changed && !event.isTrigger ) {
+ this._just_changed = false;
+ jQuery.event.simulate( "change", this, event, true );
+ }
+ });
+ }
+ return false;
+ }
+ // Delegated event; lazy-add a change handler on descendant inputs
+ jQuery.event.add( this, "beforeactivate._change", function( e ) {
+ var elem = e.target;
+
+ if ( rformElems.test( elem.nodeName ) && !elem._change_attached ) {
+ jQuery.event.add( elem, "change._change", function( event ) {
+ if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
+ jQuery.event.simulate( "change", this.parentNode, event, true );
+ }
+ });
+ elem._change_attached = true;
+ }
+ });
+ },
+
+ handle: function( event ) {
+ var elem = event.target;
+
+ // Swallow native change events from checkbox/radio, we already triggered them above
+ if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {
+ return event.handleObj.handler.apply( this, arguments );
+ }
+ },
+
+ teardown: function() {
+ jQuery.event.remove( this, "._change" );
+
+ return rformElems.test( this.nodeName );
+ }
+ };
+}
+
+// Create "bubbling" focus and blur events
+if ( !jQuery.support.focusinBubbles ) {
+ jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
+
+ // Attach a single capturing handler while someone wants focusin/focusout
+ var attaches = 0,
+ handler = function( event ) {
+ jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
+ };
+
+ jQuery.event.special[ fix ] = {
+ setup: function() {
+ if ( attaches++ === 0 ) {
+ document.addEventListener( orig, handler, true );
+ }
+ },
+ teardown: function() {
+ if ( --attaches === 0 ) {
+ document.removeEventListener( orig, handler, true );
+ }
+ }
+ };
+ });
+}
+
+jQuery.fn.extend({
+
+ on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
+ var origFn, type;
+
+ // Types can be a map of types/handlers
+ if ( typeof types === "object" ) {
+ // ( types-Object, selector, data )
+ if ( typeof selector !== "string" ) { // && selector != null
+ // ( types-Object, data )
+ data = data || selector;
+ selector = undefined;
+ }
+ for ( type in types ) {
+ this.on( type, selector, data, types[ type ], one );
+ }
+ return this;
+ }
+
+ if ( data == null && fn == null ) {
+ // ( types, fn )
+ fn = selector;
+ data = selector = undefined;
+ } else if ( fn == null ) {
+ if ( typeof selector === "string" ) {
+ // ( types, selector, fn )
+ fn = data;
+ data = undefined;
+ } else {
+ // ( types, data, fn )
+ fn = data;
+ data = selector;
+ selector = undefined;
+ }
+ }
+ if ( fn === false ) {
+ fn = returnFalse;
+ } else if ( !fn ) {
+ return this;
+ }
+
+ if ( one === 1 ) {
+ origFn = fn;
+ fn = function( event ) {
+ // Can use an empty set, since event contains the info
+ jQuery().off( event );
+ return origFn.apply( this, arguments );
+ };
+ // Use same guid so caller can remove using origFn
+ fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
+ }
+ return this.each( function() {
+ jQuery.event.add( this, types, fn, data, selector );
+ });
+ },
+ one: function( types, selector, data, fn ) {
+ return this.on( types, selector, data, fn, 1 );
+ },
+ off: function( types, selector, fn ) {
+ if ( types && types.preventDefault && types.handleObj ) {
+ // ( event ) dispatched jQuery.Event
+ var handleObj = types.handleObj;
+ jQuery( types.delegateTarget ).off(
+ handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
+ handleObj.selector,
+ handleObj.handler
+ );
+ return this;
+ }
+ if ( typeof types === "object" ) {
+ // ( types-object [, selector] )
+ for ( var type in types ) {
+ this.off( type, selector, types[ type ] );
+ }
+ return this;
+ }
+ if ( selector === false || typeof selector === "function" ) {
+ // ( types [, fn] )
+ fn = selector;
+ selector = undefined;
+ }
+ if ( fn === false ) {
+ fn = returnFalse;
+ }
+ return this.each(function() {
+ jQuery.event.remove( this, types, fn, selector );
+ });
+ },
+
+ bind: function( types, data, fn ) {
+ return this.on( types, null, data, fn );
+ },
+ unbind: function( types, fn ) {
+ return this.off( types, null, fn );
+ },
+
+ live: function( types, data, fn ) {
+ jQuery( this.context ).on( types, this.selector, data, fn );
+ return this;
+ },
+ die: function( types, fn ) {
+ jQuery( this.context ).off( types, this.selector || "**", fn );
+ return this;
+ },
+
+ delegate: function( selector, types, data, fn ) {
+ return this.on( types, selector, data, fn );
+ },
+ undelegate: function( selector, types, fn ) {
+ // ( namespace ) or ( selector, types [, fn] )
+ return arguments.length == 1? this.off( selector, "**" ) : this.off( types, selector, fn );
+ },
+
+ trigger: function( type, data ) {
+ return this.each(function() {
+ jQuery.event.trigger( type, data, this );
+ });
+ },
+ triggerHandler: function( type, data ) {
+ if ( this[0] ) {
+ return jQuery.event.trigger( type, data, this[0], true );
+ }
+ },
+
+ toggle: function( fn ) {
+ // Save reference to arguments for access in closure
+ var args = arguments,
+ guid = fn.guid || jQuery.guid++,
+ i = 0,
+ toggler = function( event ) {
+ // Figure out which function to execute
+ var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
+ jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
+
+ // Make sure that clicks stop
+ event.preventDefault();
+
+ // and execute the function
+ return args[ lastToggle ].apply( this, arguments ) || false;
+ };
+
+ // link all the functions, so any of them can unbind this click handler
+ toggler.guid = guid;
+ while ( i < args.length ) {
+ args[ i++ ].guid = guid;
+ }
+
+ return this.click( toggler );
+ },
+
+ hover: function( fnOver, fnOut ) {
+ return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
+ }
+});
+
+jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
+ "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
+ "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
+
+ // Handle event binding
+ jQuery.fn[ name ] = function( data, fn ) {
+ if ( fn == null ) {
+ fn = data;
+ data = null;
+ }
+
+ return arguments.length > 0 ?
+ this.on( name, null, data, fn ) :
+ this.trigger( name );
+ };
+
+ if ( jQuery.attrFn ) {
+ jQuery.attrFn[ name ] = true;
+ }
+
+ if ( rkeyEvent.test( name ) ) {
+ jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks;
+ }
+
+ if ( rmouseEvent.test( name ) ) {
+ jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks;
+ }
+});
+
+
+
+/*!
+ * Sizzle CSS Selector Engine
+ * Copyright 2011, The Dojo Foundation
+ * Released under the MIT, BSD, and GPL Licenses.
+ * More information: http://sizzlejs.com/
+ */
+(function(){
+
+var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
+ expando = "sizcache" + (Math.random() + '').replace('.', ''),
+ done = 0,
+ toString = Object.prototype.toString,
+ hasDuplicate = false,
+ baseHasDuplicate = true,
+ rBackslash = /\\/g,
+ rReturn = /\r\n/g,
+ rNonWord = /\W/;
+
+// Here we check if the JavaScript engine is using some sort of
+// optimization where it does not always call our comparision
+// function. If that is the case, discard the hasDuplicate value.
+// Thus far that includes Google Chrome.
+[0, 0].sort(function() {
+ baseHasDuplicate = false;
+ return 0;
+});
+
+var Sizzle = function( selector, context, results, seed ) {
+ results = results || [];
+ context = context || document;
+
+ var origContext = context;
+
+ if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
+ return [];
+ }
+
+ if ( !selector || typeof selector !== "string" ) {
+ return results;
+ }
+
+ var m, set, checkSet, extra, ret, cur, pop, i,
+ prune = true,
+ contextXML = Sizzle.isXML( context ),
+ parts = [],
+ soFar = selector;
+
+ // Reset the position of the chunker regexp (start from head)
+ do {
+ chunker.exec( "" );
+ m = chunker.exec( soFar );
+
+ if ( m ) {
+ soFar = m[3];
+
+ parts.push( m[1] );
+
+ if ( m[2] ) {
+ extra = m[3];
+ break;
+ }
+ }
+ } while ( m );
+
+ if ( parts.length > 1 && origPOS.exec( selector ) ) {
+
+ if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
+ set = posProcess( parts[0] + parts[1], context, seed );
+
+ } else {
+ set = Expr.relative[ parts[0] ] ?
+ [ context ] :
+ Sizzle( parts.shift(), context );
+
+ while ( parts.length ) {
+ selector = parts.shift();
+
+ if ( Expr.relative[ selector ] ) {
+ selector += parts.shift();
+ }
+
+ set = posProcess( selector, set, seed );
+ }
+ }
+
+ } else {
+ // Take a shortcut and set the context if the root selector is an ID
+ // (but not if it'll be faster if the inner selector is an ID)
+ if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
+ Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
+
+ ret = Sizzle.find( parts.shift(), context, contextXML );
+ context = ret.expr ?
+ Sizzle.filter( ret.expr, ret.set )[0] :
+ ret.set[0];
+ }
+
+ if ( context ) {
+ ret = seed ?
+ { expr: parts.pop(), set: makeArray(seed) } :
+ Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );
+
+ set = ret.expr ?
+ Sizzle.filter( ret.expr, ret.set ) :
+ ret.set;
+
+ if ( parts.length > 0 ) {
+ checkSet = makeArray( set );
+
+ } else {
+ prune = false;
+ }
+
+ while ( parts.length ) {
+ cur = parts.pop();
+ pop = cur;
+
+ if ( !Expr.relative[ cur ] ) {
+ cur = "";
+ } else {
+ pop = parts.pop();
+ }
+
+ if ( pop == null ) {
+ pop = context;
+ }
+
+ Expr.relative[ cur ]( checkSet, pop, contextXML );
+ }
+
+ } else {
+ checkSet = parts = [];
+ }
+ }
+
+ if ( !checkSet ) {
+ checkSet = set;
+ }
+
+ if ( !checkSet ) {
+ Sizzle.error( cur || selector );
+ }
+
+ if ( toString.call(checkSet) === "[object Array]" ) {
+ if ( !prune ) {
+ results.push.apply( results, checkSet );
+
+ } else if ( context && context.nodeType === 1 ) {
+ for ( i = 0; checkSet[i] != null; i++ ) {
+ if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) {
+ results.push( set[i] );
+ }
+ }
+
+ } else {
+ for ( i = 0; checkSet[i] != null; i++ ) {
+ if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
+ results.push( set[i] );
+ }
+ }
+ }
+
+ } else {
+ makeArray( checkSet, results );
+ }
+
+ if ( extra ) {
+ Sizzle( extra, origContext, results, seed );
+ Sizzle.uniqueSort( results );
+ }
+
+ return results;
+};
+
+Sizzle.uniqueSort = function( results ) {
+ if ( sortOrder ) {
+ hasDuplicate = baseHasDuplicate;
+ results.sort( sortOrder );
+
+ if ( hasDuplicate ) {
+ for ( var i = 1; i < results.length; i++ ) {
+ if ( results[i] === results[ i - 1 ] ) {
+ results.splice( i--, 1 );
+ }
+ }
+ }
+ }
+
+ return results;
+};
+
+Sizzle.matches = function( expr, set ) {
+ return Sizzle( expr, null, null, set );
+};
+
+Sizzle.matchesSelector = function( node, expr ) {
+ return Sizzle( expr, null, null, [node] ).length > 0;
+};
+
+Sizzle.find = function( expr, context, isXML ) {
+ var set, i, len, match, type, left;
+
+ if ( !expr ) {
+ return [];
+ }
+
+ for ( i = 0, len = Expr.order.length; i < len; i++ ) {
+ type = Expr.order[i];
+
+ if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
+ left = match[1];
+ match.splice( 1, 1 );
+
+ if ( left.substr( left.length - 1 ) !== "\\" ) {
+ match[1] = (match[1] || "").replace( rBackslash, "" );
+ set = Expr.find[ type ]( match, context, isXML );
+
+ if ( set != null ) {
+ expr = expr.replace( Expr.match[ type ], "" );
+ break;
+ }
+ }
+ }
+ }
+
+ if ( !set ) {
+ set = typeof context.getElementsByTagName !== "undefined" ?
+ context.getElementsByTagName( "*" ) :
+ [];
+ }
+
+ return { set: set, expr: expr };
+};
+
+Sizzle.filter = function( expr, set, inplace, not ) {
+ var match, anyFound,
+ type, found, item, filter, left,
+ i, pass,
+ old = expr,
+ result = [],
+ curLoop = set,
+ isXMLFilter = set && set[0] && Sizzle.isXML( set[0] );
+
+ while ( expr && set.length ) {
+ for ( type in Expr.filter ) {
+ if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {
+ filter = Expr.filter[ type ];
+ left = match[1];
+
+ anyFound = false;
+
+ match.splice(1,1);
+
+ if ( left.substr( left.length - 1 ) === "\\" ) {
+ continue;
+ }
+
+ if ( curLoop === result ) {
+ result = [];
+ }
+
+ if ( Expr.preFilter[ type ] ) {
+ match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
+
+ if ( !match ) {
+ anyFound = found = true;
+
+ } else if ( match === true ) {
+ continue;
+ }
+ }
+
+ if ( match ) {
+ for ( i = 0; (item = curLoop[i]) != null; i++ ) {
+ if ( item ) {
+ found = filter( item, match, i, curLoop );
+ pass = not ^ found;
+
+ if ( inplace && found != null ) {
+ if ( pass ) {
+ anyFound = true;
+
+ } else {
+ curLoop[i] = false;
+ }
+
+ } else if ( pass ) {
+ result.push( item );
+ anyFound = true;
+ }
+ }
+ }
+ }
+
+ if ( found !== undefined ) {
+ if ( !inplace ) {
+ curLoop = result;
+ }
+
+ expr = expr.replace( Expr.match[ type ], "" );
+
+ if ( !anyFound ) {
+ return [];
+ }
+
+ break;
+ }
+ }
+ }
+
+ // Improper expression
+ if ( expr === old ) {
+ if ( anyFound == null ) {
+ Sizzle.error( expr );
+
+ } else {
+ break;
+ }
+ }
+
+ old = expr;
+ }
+
+ return curLoop;
+};
+
+Sizzle.error = function( msg ) {
+ throw new Error( "Syntax error, unrecognized expression: " + msg );
+};
+
+/**
+ * Utility function for retreiving the text value of an array of DOM nodes
+ * @param {Array|Element} elem
+ */
+var getText = Sizzle.getText = function( elem ) {
+ var i, node,
+ nodeType = elem.nodeType,
+ ret = "";
+
+ if ( nodeType ) {
+ if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
+ // Use textContent || innerText for elements
+ if ( typeof elem.textContent === 'string' ) {
+ return elem.textContent;
+ } else if ( typeof elem.innerText === 'string' ) {
+ // Replace IE's carriage returns
+ return elem.innerText.replace( rReturn, '' );
+ } else {
+ // Traverse it's children
+ for ( elem = elem.firstChild; elem; elem = elem.nextSibling) {
+ ret += getText( elem );
+ }
+ }
+ } else if ( nodeType === 3 || nodeType === 4 ) {
+ return elem.nodeValue;
+ }
+ } else {
+
+ // If no nodeType, this is expected to be an array
+ for ( i = 0; (node = elem[i]); i++ ) {
+ // Do not traverse comment nodes
+ if ( node.nodeType !== 8 ) {
+ ret += getText( node );
+ }
+ }
+ }
+ return ret;
+};
+
+var Expr = Sizzle.selectors = {
+ order: [ "ID", "NAME", "TAG" ],
+
+ match: {
+ ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
+ CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
+ NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,
+ ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,
+ TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,
+ CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,
+ POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,
+ PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
+ },
+
+ leftMatch: {},
+
+ attrMap: {
+ "class": "className",
+ "for": "htmlFor"
+ },
+
+ attrHandle: {
+ href: function( elem ) {
+ return elem.getAttribute( "href" );
+ },
+ type: function( elem ) {
+ return elem.getAttribute( "type" );
+ }
+ },
+
+ relative: {
+ "+": function(checkSet, part){
+ var isPartStr = typeof part === "string",
+ isTag = isPartStr && !rNonWord.test( part ),
+ isPartStrNotTag = isPartStr && !isTag;
+
+ if ( isTag ) {
+ part = part.toLowerCase();
+ }
+
+ for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
+ if ( (elem = checkSet[i]) ) {
+ while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
+
+ checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ?
+ elem || false :
+ elem === part;
+ }
+ }
+
+ if ( isPartStrNotTag ) {
+ Sizzle.filter( part, checkSet, true );
+ }
+ },
+
+ ">": function( checkSet, part ) {
+ var elem,
+ isPartStr = typeof part === "string",
+ i = 0,
+ l = checkSet.length;
+
+ if ( isPartStr && !rNonWord.test( part ) ) {
+ part = part.toLowerCase();
+
+ for ( ; i < l; i++ ) {
+ elem = checkSet[i];
+
+ if ( elem ) {
+ var parent = elem.parentNode;
+ checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;
+ }
+ }
+
+ } else {
+ for ( ; i < l; i++ ) {
+ elem = checkSet[i];
+
+ if ( elem ) {
+ checkSet[i] = isPartStr ?
+ elem.parentNode :
+ elem.parentNode === part;
+ }
+ }
+
+ if ( isPartStr ) {
+ Sizzle.filter( part, checkSet, true );
+ }
+ }
+ },
+
+ "": function(checkSet, part, isXML){
+ var nodeCheck,
+ doneName = done++,
+ checkFn = dirCheck;
+
+ if ( typeof part === "string" && !rNonWord.test( part ) ) {
+ part = part.toLowerCase();
+ nodeCheck = part;
+ checkFn = dirNodeCheck;
+ }
+
+ checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML );
+ },
+
+ "~": function( checkSet, part, isXML ) {
+ var nodeCheck,
+ doneName = done++,
+ checkFn = dirCheck;
+
+ if ( typeof part === "string" && !rNonWord.test( part ) ) {
+ part = part.toLowerCase();
+ nodeCheck = part;
+ checkFn = dirNodeCheck;
+ }
+
+ checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML );
+ }
+ },
+
+ find: {
+ ID: function( match, context, isXML ) {
+ if ( typeof context.getElementById !== "undefined" && !isXML ) {
+ var m = context.getElementById(match[1]);
+ // Check parentNode to catch when Blackberry 4.6 returns
+ // nodes that are no longer in the document #6963
+ return m && m.parentNode ? [m] : [];
+ }
+ },
+
+ NAME: function( match, context ) {
+ if ( typeof context.getElementsByName !== "undefined" ) {
+ var ret = [],
+ results = context.getElementsByName( match[1] );
+
+ for ( var i = 0, l = results.length; i < l; i++ ) {
+ if ( results[i].getAttribute("name") === match[1] ) {
+ ret.push( results[i] );
+ }
+ }
+
+ return ret.length === 0 ? null : ret;
+ }
+ },
+
+ TAG: function( match, context ) {
+ if ( typeof context.getElementsByTagName !== "undefined" ) {
+ return context.getElementsByTagName( match[1] );
+ }
+ }
+ },
+ preFilter: {
+ CLASS: function( match, curLoop, inplace, result, not, isXML ) {
+ match = " " + match[1].replace( rBackslash, "" ) + " ";
+
+ if ( isXML ) {
+ return match;
+ }
+
+ for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
+ if ( elem ) {
+ if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) {
+ if ( !inplace ) {
+ result.push( elem );
+ }
+
+ } else if ( inplace ) {
+ curLoop[i] = false;
+ }
+ }
+ }
+
+ return false;
+ },
+
+ ID: function( match ) {
+ return match[1].replace( rBackslash, "" );
+ },
+
+ TAG: function( match, curLoop ) {
+ return match[1].replace( rBackslash, "" ).toLowerCase();
+ },
+
+ CHILD: function( match ) {
+ if ( match[1] === "nth" ) {
+ if ( !match[2] ) {
+ Sizzle.error( match[0] );
+ }
+
+ match[2] = match[2].replace(/^\+|\s*/g, '');
+
+ // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
+ var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec(
+ match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||
+ !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
+
+ // calculate the numbers (first)n+(last) including if they are negative
+ match[2] = (test[1] + (test[2] || 1)) - 0;
+ match[3] = test[3] - 0;
+ }
+ else if ( match[2] ) {
+ Sizzle.error( match[0] );
+ }
+
+ // TODO: Move to normal caching system
+ match[0] = done++;
+
+ return match;
+ },
+
+ ATTR: function( match, curLoop, inplace, result, not, isXML ) {
+ var name = match[1] = match[1].replace( rBackslash, "" );
+
+ if ( !isXML && Expr.attrMap[name] ) {
+ match[1] = Expr.attrMap[name];
+ }
+
+ // Handle if an un-quoted value was used
+ match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" );
+
+ if ( match[2] === "~=" ) {
+ match[4] = " " + match[4] + " ";
+ }
+
+ return match;
+ },
+
+ PSEUDO: function( match, curLoop, inplace, result, not ) {
+ if ( match[1] === "not" ) {
+ // If we're dealing with a complex expression, or a simple one
+ if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {
+ match[3] = Sizzle(match[3], null, null, curLoop);
+
+ } else {
+ var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
+
+ if ( !inplace ) {
+ result.push.apply( result, ret );
+ }
+
+ return false;
+ }
+
+ } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
+ return true;
+ }
+
+ return match;
+ },
+
+ POS: function( match ) {
+ match.unshift( true );
+
+ return match;
+ }
+ },
+
+ filters: {
+ enabled: function( elem ) {
+ return elem.disabled === false && elem.type !== "hidden";
+ },
+
+ disabled: function( elem ) {
+ return elem.disabled === true;
+ },
+
+ checked: function( elem ) {
+ return elem.checked === true;
+ },
+
+ selected: function( elem ) {
+ // Accessing this property makes selected-by-default
+ // options in Safari work properly
+ if ( elem.parentNode ) {
+ elem.parentNode.selectedIndex;
+ }
+
+ return elem.selected === true;
+ },
+
+ parent: function( elem ) {
+ return !!elem.firstChild;
+ },
+
+ empty: function( elem ) {
+ return !elem.firstChild;
+ },
+
+ has: function( elem, i, match ) {
+ return !!Sizzle( match[3], elem ).length;
+ },
+
+ header: function( elem ) {
+ return (/h\d/i).test( elem.nodeName );
+ },
+
+ text: function( elem ) {
+ var attr = elem.getAttribute( "type" ), type = elem.type;
+ // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
+ // use getAttribute instead to test this case
+ return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null );
+ },
+
+ radio: function( elem ) {
+ return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type;
+ },
+
+ checkbox: function( elem ) {
+ return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type;
+ },
+
+ file: function( elem ) {
+ return elem.nodeName.toLowerCase() === "input" && "file" === elem.type;
+ },
+
+ password: function( elem ) {
+ return elem.nodeName.toLowerCase() === "input" && "password" === elem.type;
+ },
+
+ submit: function( elem ) {
+ var name = elem.nodeName.toLowerCase();
+ return (name === "input" || name === "button") && "submit" === elem.type;
+ },
+
+ image: function( elem ) {
+ return elem.nodeName.toLowerCase() === "input" && "image" === elem.type;
+ },
+
+ reset: function( elem ) {
+ var name = elem.nodeName.toLowerCase();
+ return (name === "input" || name === "button") && "reset" === elem.type;
+ },
+
+ button: function( elem ) {
+ var name = elem.nodeName.toLowerCase();
+ return name === "input" && "button" === elem.type || name === "button";
+ },
+
+ input: function( elem ) {
+ return (/input|select|textarea|button/i).test( elem.nodeName );
+ },
+
+ focus: function( elem ) {
+ return elem === elem.ownerDocument.activeElement;
+ }
+ },
+ setFilters: {
+ first: function( elem, i ) {
+ return i === 0;
+ },
+
+ last: function( elem, i, match, array ) {
+ return i === array.length - 1;
+ },
+
+ even: function( elem, i ) {
+ return i % 2 === 0;
+ },
+
+ odd: function( elem, i ) {
+ return i % 2 === 1;
+ },
+
+ lt: function( elem, i, match ) {
+ return i < match[3] - 0;
+ },
+
+ gt: function( elem, i, match ) {
+ return i > match[3] - 0;
+ },
+
+ nth: function( elem, i, match ) {
+ return match[3] - 0 === i;
+ },
+
+ eq: function( elem, i, match ) {
+ return match[3] - 0 === i;
+ }
+ },
+ filter: {
+ PSEUDO: function( elem, match, i, array ) {
+ var name = match[1],
+ filter = Expr.filters[ name ];
+
+ if ( filter ) {
+ return filter( elem, i, match, array );
+
+ } else if ( name === "contains" ) {
+ return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0;
+
+ } else if ( name === "not" ) {
+ var not = match[3];
+
+ for ( var j = 0, l = not.length; j < l; j++ ) {
+ if ( not[j] === elem ) {
+ return false;
+ }
+ }
+
+ return true;
+
+ } else {
+ Sizzle.error( name );
+ }
+ },
+
+ CHILD: function( elem, match ) {
+ var first, last,
+ doneName, parent, cache,
+ count, diff,
+ type = match[1],
+ node = elem;
+
+ switch ( type ) {
+ case "only":
+ case "first":
+ while ( (node = node.previousSibling) ) {
+ if ( node.nodeType === 1 ) {
+ return false;
+ }
+ }
+
+ if ( type === "first" ) {
+ return true;
+ }
+
+ node = elem;
+
+ /* falls through */
+ case "last":
+ while ( (node = node.nextSibling) ) {
+ if ( node.nodeType === 1 ) {
+ return false;
+ }
+ }
+
+ return true;
+
+ case "nth":
+ first = match[2];
+ last = match[3];
+
+ if ( first === 1 && last === 0 ) {
+ return true;
+ }
+
+ doneName = match[0];
+ parent = elem.parentNode;
+
+ if ( parent && (parent[ expando ] !== doneName || !elem.nodeIndex) ) {
+ count = 0;
+
+ for ( node = parent.firstChild; node; node = node.nextSibling ) {
+ if ( node.nodeType === 1 ) {
+ node.nodeIndex = ++count;
+ }
+ }
+
+ parent[ expando ] = doneName;
+ }
+
+ diff = elem.nodeIndex - last;
+
+ if ( first === 0 ) {
+ return diff === 0;
+
+ } else {
+ return ( diff % first === 0 && diff / first >= 0 );
+ }
+ }
+ },
+
+ ID: function( elem, match ) {
+ return elem.nodeType === 1 && elem.getAttribute("id") === match;
+ },
+
+ TAG: function( elem, match ) {
+ return (match === "*" && elem.nodeType === 1) || !!elem.nodeName && elem.nodeName.toLowerCase() === match;
+ },
+
+ CLASS: function( elem, match ) {
+ return (" " + (elem.className || elem.getAttribute("class")) + " ")
+ .indexOf( match ) > -1;
+ },
+
+ ATTR: function( elem, match ) {
+ var name = match[1],
+ result = Sizzle.attr ?
+ Sizzle.attr( elem, name ) :
+ Expr.attrHandle[ name ] ?
+ Expr.attrHandle[ name ]( elem ) :
+ elem[ name ] != null ?
+ elem[ name ] :
+ elem.getAttribute( name ),
+ value = result + "",
+ type = match[2],
+ check = match[4];
+
+ return result == null ?
+ type === "!=" :
+ !type && Sizzle.attr ?
+ result != null :
+ type === "=" ?
+ value === check :
+ type === "*=" ?
+ value.indexOf(check) >= 0 :
+ type === "~=" ?
+ (" " + value + " ").indexOf(check) >= 0 :
+ !check ?
+ value && result !== false :
+ type === "!=" ?
+ value !== check :
+ type === "^=" ?
+ value.indexOf(check) === 0 :
+ type === "$=" ?
+ value.substr(value.length - check.length) === check :
+ type === "|=" ?
+ value === check || value.substr(0, check.length + 1) === check + "-" :
+ false;
+ },
+
+ POS: function( elem, match, i, array ) {
+ var name = match[2],
+ filter = Expr.setFilters[ name ];
+
+ if ( filter ) {
+ return filter( elem, i, match, array );
+ }
+ }
+ }
+};
+
+var origPOS = Expr.match.POS,
+ fescape = function(all, num){
+ return "\\" + (num - 0 + 1);
+ };
+
+for ( var type in Expr.match ) {
+ Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );
+ Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) );
+}
+// Expose origPOS
+// "global" as in regardless of relation to brackets/parens
+Expr.match.globalPOS = origPOS;
+
+var makeArray = function( array, results ) {
+ array = Array.prototype.slice.call( array, 0 );
+
+ if ( results ) {
+ results.push.apply( results, array );
+ return results;
+ }
+
+ return array;
+};
+
+// Perform a simple check to determine if the browser is capable of
+// converting a NodeList to an array using builtin methods.
+// Also verifies that the returned array holds DOM nodes
+// (which is not the case in the Blackberry browser)
+try {
+ Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;
+
+// Provide a fallback method if it does not work
+} catch( e ) {
+ makeArray = function( array, results ) {
+ var i = 0,
+ ret = results || [];
+
+ if ( toString.call(array) === "[object Array]" ) {
+ Array.prototype.push.apply( ret, array );
+
+ } else {
+ if ( typeof array.length === "number" ) {
+ for ( var l = array.length; i < l; i++ ) {
+ ret.push( array[i] );
+ }
+
+ } else {
+ for ( ; array[i]; i++ ) {
+ ret.push( array[i] );
+ }
+ }
+ }
+
+ return ret;
+ };
+}
+
+var sortOrder, siblingCheck;
+
+if ( document.documentElement.compareDocumentPosition ) {
+ sortOrder = function( a, b ) {
+ if ( a === b ) {
+ hasDuplicate = true;
+ return 0;
+ }
+
+ if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {
+ return a.compareDocumentPosition ? -1 : 1;
+ }
+
+ return a.compareDocumentPosition(b) & 4 ? -1 : 1;
+ };
+
+} else {
+ sortOrder = function( a, b ) {
+ // The nodes are identical, we can exit early
+ if ( a === b ) {
+ hasDuplicate = true;
+ return 0;
+
+ // Fallback to using sourceIndex (in IE) if it's available on both nodes
+ } else if ( a.sourceIndex && b.sourceIndex ) {
+ return a.sourceIndex - b.sourceIndex;
+ }
+
+ var al, bl,
+ ap = [],
+ bp = [],
+ aup = a.parentNode,
+ bup = b.parentNode,
+ cur = aup;
+
+ // If the nodes are siblings (or identical) we can do a quick check
+ if ( aup === bup ) {
+ return siblingCheck( a, b );
+
+ // If no parents were found then the nodes are disconnected
+ } else if ( !aup ) {
+ return -1;
+
+ } else if ( !bup ) {
+ return 1;
+ }
+
+ // Otherwise they're somewhere else in the tree so we need
+ // to build up a full list of the parentNodes for comparison
+ while ( cur ) {
+ ap.unshift( cur );
+ cur = cur.parentNode;
+ }
+
+ cur = bup;
+
+ while ( cur ) {
+ bp.unshift( cur );
+ cur = cur.parentNode;
+ }
+
+ al = ap.length;
+ bl = bp.length;
+
+ // Start walking down the tree looking for a discrepancy
+ for ( var i = 0; i < al && i < bl; i++ ) {
+ if ( ap[i] !== bp[i] ) {
+ return siblingCheck( ap[i], bp[i] );
+ }
+ }
+
+ // We ended someplace up the tree so do a sibling check
+ return i === al ?
+ siblingCheck( a, bp[i], -1 ) :
+ siblingCheck( ap[i], b, 1 );
+ };
+
+ siblingCheck = function( a, b, ret ) {
+ if ( a === b ) {
+ return ret;
+ }
+
+ var cur = a.nextSibling;
+
+ while ( cur ) {
+ if ( cur === b ) {
+ return -1;
+ }
+
+ cur = cur.nextSibling;
+ }
+
+ return 1;
+ };
+}
+
+// Check to see if the browser returns elements by name when
+// querying by getElementById (and provide a workaround)
+(function(){
+ // We're going to inject a fake input element with a specified name
+ var form = document.createElement("div"),
+ id = "script" + (new Date()).getTime(),
+ root = document.documentElement;
+
+ form.innerHTML = "<a name='" + id + "'/>";
+
+ // Inject it into the root element, check its status, and remove it quickly
+ root.insertBefore( form, root.firstChild );
+
+ // The workaround has to do additional checks after a getElementById
+ // Which slows things down for other browsers (hence the branching)
+ if ( document.getElementById( id ) ) {
+ Expr.find.ID = function( match, context, isXML ) {
+ if ( typeof context.getElementById !== "undefined" && !isXML ) {
+ var m = context.getElementById(match[1]);
+
+ return m ?
+ m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ?
+ [m] :
+ undefined :
+ [];
+ }
+ };
+
+ Expr.filter.ID = function( elem, match ) {
+ var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
+
+ return elem.nodeType === 1 && node && node.nodeValue === match;
+ };
+ }
+
+ root.removeChild( form );
+
+ // release memory in IE
+ root = form = null;
+})();
+
+(function(){
+ // Check to see if the browser returns only elements
+ // when doing getElementsByTagName("*")
+
+ // Create a fake element
+ var div = document.createElement("div");
+ div.appendChild( document.createComment("") );
+
+ // Make sure no comments are found
+ if ( div.getElementsByTagName("*").length > 0 ) {
+ Expr.find.TAG = function( match, context ) {
+ var results = context.getElementsByTagName( match[1] );
+
+ // Filter out possible comments
+ if ( match[1] === "*" ) {
+ var tmp = [];
+
+ for ( var i = 0; results[i]; i++ ) {
+ if ( results[i].nodeType === 1 ) {
+ tmp.push( results[i] );
+ }
+ }
+
+ results = tmp;
+ }
+
+ return results;
+ };
+ }
+
+ // Check to see if an attribute returns normalized href attributes
+ div.innerHTML = "<a href='#'></a>";
+
+ if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
+ div.firstChild.getAttribute("href") !== "#" ) {
+
+ Expr.attrHandle.href = function( elem ) {
+ return elem.getAttribute( "href", 2 );
+ };
+ }
+
+ // release memory in IE
+ div = null;
+})();
+
+if ( document.querySelectorAll ) {
+ (function(){
+ var oldSizzle = Sizzle,
+ div = document.createElement("div"),
+ id = "__sizzle__";
+
+ div.innerHTML = "<p class='TEST'></p>";
+
+ // Safari can't handle uppercase or unicode characters when
+ // in quirks mode.
+ if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
+ return;
+ }
+
+ Sizzle = function( query, context, extra, seed ) {
+ context = context || document;
+
+ // Only use querySelectorAll on non-XML documents
+ // (ID selectors don't work in non-HTML documents)
+ if ( !seed && !Sizzle.isXML(context) ) {
+ // See if we find a selector to speed up
+ var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query );
+
+ if ( match && (context.nodeType === 1 || context.nodeType === 9) ) {
+ // Speed-up: Sizzle("TAG")
+ if ( match[1] ) {
+ return makeArray( context.getElementsByTagName( query ), extra );
+
+ // Speed-up: Sizzle(".CLASS")
+ } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) {
+ return makeArray( context.getElementsByClassName( match[2] ), extra );
+ }
+ }
+
+ if ( context.nodeType === 9 ) {
+ // Speed-up: Sizzle("body")
+ // The body element only exists once, optimize finding it
+ if ( query === "body" && context.body ) {
+ return makeArray( [ context.body ], extra );
+
+ // Speed-up: Sizzle("#ID")
+ } else if ( match && match[3] ) {
+ var elem = context.getElementById( match[3] );
+
+ // Check parentNode to catch when Blackberry 4.6 returns
+ // nodes that are no longer in the document #6963
+ if ( elem && elem.parentNode ) {
+ // Handle the case where IE and Opera return items
+ // by name instead of ID
+ if ( elem.id === match[3] ) {
+ return makeArray( [ elem ], extra );
+ }
+
+ } else {
+ return makeArray( [], extra );
+ }
+ }
+
+ try {
+ return makeArray( context.querySelectorAll(query), extra );
+ } catch(qsaError) {}
+
+ // qSA works strangely on Element-rooted queries
+ // We can work around this by specifying an extra ID on the root
+ // and working up from there (Thanks to Andrew Dupont for the technique)
+ // IE 8 doesn't work on object elements
+ } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
+ var oldContext = context,
+ old = context.getAttribute( "id" ),
+ nid = old || id,
+ hasParent = context.parentNode,
+ relativeHierarchySelector = /^\s*[+~]/.test( query );
+
+ if ( !old ) {
+ context.setAttribute( "id", nid );
+ } else {
+ nid = nid.replace( /'/g, "\\$&" );
+ }
+ if ( relativeHierarchySelector && hasParent ) {
+ context = context.parentNode;
+ }
+
+ try {
+ if ( !relativeHierarchySelector || hasParent ) {
+ return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra );
+ }
+
+ } catch(pseudoError) {
+ } finally {
+ if ( !old ) {
+ oldContext.removeAttribute( "id" );
+ }
+ }
+ }
+ }
+
+ return oldSizzle(query, context, extra, seed);
+ };
+
+ for ( var prop in oldSizzle ) {
+ Sizzle[ prop ] = oldSizzle[ prop ];
+ }
+
+ // release memory in IE
+ div = null;
+ })();
+}
+
+(function(){
+ var html = document.documentElement,
+ matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector;
+
+ if ( matches ) {
+ // Check to see if it's possible to do matchesSelector
+ // on a disconnected node (IE 9 fails this)
+ var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ),
+ pseudoWorks = false;
+
+ try {
+ // This should fail with an exception
+ // Gecko does not error, returns false instead
+ matches.call( document.documentElement, "[test!='']:sizzle" );
+
+ } catch( pseudoError ) {
+ pseudoWorks = true;
+ }
+
+ Sizzle.matchesSelector = function( node, expr ) {
+ // Make sure that attribute selectors are quoted
+ expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
+
+ if ( !Sizzle.isXML( node ) ) {
+ try {
+ if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {
+ var ret = matches.call( node, expr );
+
+ // IE 9's matchesSelector returns false on disconnected nodes
+ if ( ret || !disconnectedMatch ||
+ // As well, disconnected nodes are said to be in a document
+ // fragment in IE 9, so check for that
+ node.document && node.document.nodeType !== 11 ) {
+ return ret;
+ }
+ }
+ } catch(e) {}
+ }
+
+ return Sizzle(expr, null, null, [node]).length > 0;
+ };
+ }
+})();
+
+(function(){
+ var div = document.createElement("div");
+
+ div.innerHTML = "<div class='test e'></div><div class='test'></div>";
+
+ // Opera can't find a second classname (in 9.6)
+ // Also, make sure that getElementsByClassName actually exists
+ if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) {
+ return;
+ }
+
+ // Safari caches class attributes, doesn't catch changes (in 3.2)
+ div.lastChild.className = "e";
+
+ if ( div.getElementsByClassName("e").length === 1 ) {
+ return;
+ }
+
+ Expr.order.splice(1, 0, "CLASS");
+ Expr.find.CLASS = function( match, context, isXML ) {
+ if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
+ return context.getElementsByClassName(match[1]);
+ }
+ };
+
+ // release memory in IE
+ div = null;
+})();
+
+function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
+ for ( var i = 0, l = checkSet.length; i < l; i++ ) {
+ var elem = checkSet[i];
+
+ if ( elem ) {
+ var match = false;
+
+ elem = elem[dir];
+
+ while ( elem ) {
+ if ( elem[ expando ] === doneName ) {
+ match = checkSet[elem.sizset];
+ break;
+ }
+
+ if ( elem.nodeType === 1 && !isXML ){
+ elem[ expando ] = doneName;
+ elem.sizset = i;
+ }
+
+ if ( elem.nodeName.toLowerCase() === cur ) {
+ match = elem;
+ break;
+ }
+
+ elem = elem[dir];
+ }
+
+ checkSet[i] = match;
+ }
+ }
+}
+
+function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
+ for ( var i = 0, l = checkSet.length; i < l; i++ ) {
+ var elem = checkSet[i];
+
+ if ( elem ) {
+ var match = false;
+
+ elem = elem[dir];
+
+ while ( elem ) {
+ if ( elem[ expando ] === doneName ) {
+ match = checkSet[elem.sizset];
+ break;
+ }
+
+ if ( elem.nodeType === 1 ) {
+ if ( !isXML ) {
+ elem[ expando ] = doneName;
+ elem.sizset = i;
+ }
+
+ if ( typeof cur !== "string" ) {
+ if ( elem === cur ) {
+ match = true;
+ break;
+ }
+
+ } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
+ match = elem;
+ break;
+ }
+ }
+
+ elem = elem[dir];
+ }
+
+ checkSet[i] = match;
+ }
+ }
+}
+
+if ( document.documentElement.contains ) {
+ Sizzle.contains = function( a, b ) {
+ return a !== b && (a.contains ? a.contains(b) : true);
+ };
+
+} else if ( document.documentElement.compareDocumentPosition ) {
+ Sizzle.contains = function( a, b ) {
+ return !!(a.compareDocumentPosition(b) & 16);
+ };
+
+} else {
+ Sizzle.contains = function() {
+ return false;
+ };
+}
+
+Sizzle.isXML = function( elem ) {
+ // documentElement is verified for cases where it doesn't yet exist
+ // (such as loading iframes in IE - #4833)
+ var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
+
+ return documentElement ? documentElement.nodeName !== "HTML" : false;
+};
+
+var posProcess = function( selector, context, seed ) {
+ var match,
+ tmpSet = [],
+ later = "",
+ root = context.nodeType ? [context] : context;
+
+ // Position selectors must be done after the filter
+ // And so must :not(positional) so we move all PSEUDOs to the end
+ while ( (match = Expr.match.PSEUDO.exec( selector )) ) {
+ later += match[0];
+ selector = selector.replace( Expr.match.PSEUDO, "" );
+ }
+
+ selector = Expr.relative[selector] ? selector + "*" : selector;
+
+ for ( var i = 0, l = root.length; i < l; i++ ) {
+ Sizzle( selector, root[i], tmpSet, seed );
+ }
+
+ return Sizzle.filter( later, tmpSet );
+};
+
+// EXPOSE
+// Override sizzle attribute retrieval
+Sizzle.attr = jQuery.attr;
+Sizzle.selectors.attrMap = {};
+jQuery.find = Sizzle;
+jQuery.expr = Sizzle.selectors;
+jQuery.expr[":"] = jQuery.expr.filters;
+jQuery.unique = Sizzle.uniqueSort;
+jQuery.text = Sizzle.getText;
+jQuery.isXMLDoc = Sizzle.isXML;
+jQuery.contains = Sizzle.contains;
+
+
+})();
+
+
+var runtil = /Until$/,
+ rparentsprev = /^(?:parents|prevUntil|prevAll)/,
+ // Note: This RegExp should be improved, or likely pulled from Sizzle
+ rmultiselector = /,/,
+ isSimple = /^.[^:#\[\.,]*$/,
+ slice = Array.prototype.slice,
+ POS = jQuery.expr.match.globalPOS,
+ // methods guaranteed to produce a unique set when starting from a unique set
+ guaranteedUnique = {
+ children: true,
+ contents: true,
+ next: true,
+ prev: true
+ };
+
+jQuery.fn.extend({
+ find: function( selector ) {
+ var self = this,
+ i, l;
+
+ if ( typeof selector !== "string" ) {
+ return jQuery( selector ).filter(function() {
+ for ( i = 0, l = self.length; i < l; i++ ) {
+ if ( jQuery.contains( self[ i ], this ) ) {
+ return true;
+ }
+ }
+ });
+ }
+
+ var ret = this.pushStack( "", "find", selector ),
+ length, n, r;
+
+ for ( i = 0, l = this.length; i < l; i++ ) {
+ length = ret.length;
+ jQuery.find( selector, this[i], ret );
+
+ if ( i > 0 ) {
+ // Make sure that the results are unique
+ for ( n = length; n < ret.length; n++ ) {
+ for ( r = 0; r < length; r++ ) {
+ if ( ret[r] === ret[n] ) {
+ ret.splice(n--, 1);
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ return ret;
+ },
+
+ has: function( target ) {
+ var targets = jQuery( target );
+ return this.filter(function() {
+ for ( var i = 0, l = targets.length; i < l; i++ ) {
+ if ( jQuery.contains( this, targets[i] ) ) {
+ return true;
+ }
+ }
+ });
+ },
+
+ not: function( selector ) {
+ return this.pushStack( winnow(this, selector, false), "not", selector);
+ },
+
+ filter: function( selector ) {
+ return this.pushStack( winnow(this, selector, true), "filter", selector );
+ },
+
+ is: function( selector ) {
+ return !!selector && (
+ typeof selector === "string" ?
+ // If this is a positional selector, check membership in the returned set
+ // so $("p:first").is("p:last") won't return true for a doc with two "p".
+ POS.test( selector ) ?
+ jQuery( selector, this.context ).index( this[0] ) >= 0 :
+ jQuery.filter( selector, this ).length > 0 :
+ this.filter( selector ).length > 0 );
+ },
+
+ closest: function( selectors, context ) {
+ var ret = [], i, l, cur = this[0];
+
+ // Array (deprecated as of jQuery 1.7)
+ if ( jQuery.isArray( selectors ) ) {
+ var level = 1;
+
+ while ( cur && cur.ownerDocument && cur !== context ) {
+ for ( i = 0; i < selectors.length; i++ ) {
+
+ if ( jQuery( cur ).is( selectors[ i ] ) ) {
+ ret.push({ selector: selectors[ i ], elem: cur, level: level });
+ }
+ }
+
+ cur = cur.parentNode;
+ level++;
+ }
+
+ return ret;
+ }
+
+ // String
+ var pos = POS.test( selectors ) || typeof selectors !== "string" ?
+ jQuery( selectors, context || this.context ) :
+ 0;
+
+ for ( i = 0, l = this.length; i < l; i++ ) {
+ cur = this[i];
+
+ while ( cur ) {
+ if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
+ ret.push( cur );
+ break;
+
+ } else {
+ cur = cur.parentNode;
+ if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) {
+ break;
+ }
+ }
+ }
+ }
+
+ ret = ret.length > 1 ? jQuery.unique( ret ) : ret;
+
+ return this.pushStack( ret, "closest", selectors );
+ },
+
+ // Determine the position of an element within
+ // the matched set of elements
+ index: function( elem ) {
+
+ // No argument, return index in parent
+ if ( !elem ) {
+ return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1;
+ }
+
+ // index in selector
+ if ( typeof elem === "string" ) {
+ return jQuery.inArray( this[0], jQuery( elem ) );
+ }
+
+ // Locate the position of the desired element
+ return jQuery.inArray(
+ // If it receives a jQuery object, the first element is used
+ elem.jquery ? elem[0] : elem, this );
+ },
+
+ add: function( selector, context ) {
+ var set = typeof selector === "string" ?
+ jQuery( selector, context ) :
+ jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
+ all = jQuery.merge( this.get(), set );
+
+ return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?
+ all :
+ jQuery.unique( all ) );
+ },
+
+ andSelf: function() {
+ return this.add( this.prevObject );
+ }
+});
+
+// A painfully simple check to see if an element is disconnected
+// from a document (should be improved, where feasible).
+function isDisconnected( node ) {
+ return !node || !node.parentNode || node.parentNode.nodeType === 11;
+}
+
+jQuery.each({
+ parent: function( elem ) {
+ var parent = elem.parentNode;
+ return parent && parent.nodeType !== 11 ? parent : null;
+ },
+ parents: function( elem ) {
+ return jQuery.dir( elem, "parentNode" );
+ },
+ parentsUntil: function( elem, i, until ) {
+ return jQuery.dir( elem, "parentNode", until );
+ },
+ next: function( elem ) {
+ return jQuery.nth( elem, 2, "nextSibling" );
+ },
+ prev: function( elem ) {
+ return jQuery.nth( elem, 2, "previousSibling" );
+ },
+ nextAll: function( elem ) {
+ return jQuery.dir( elem, "nextSibling" );
+ },
+ prevAll: function( elem ) {
+ return jQuery.dir( elem, "previousSibling" );
+ },
+ nextUntil: function( elem, i, until ) {
+ return jQuery.dir( elem, "nextSibling", until );
+ },
+ prevUntil: function( elem, i, until ) {
+ return jQuery.dir( elem, "previousSibling", until );
+ },
+ siblings: function( elem ) {
+ return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
+ },
+ children: function( elem ) {
+ return jQuery.sibling( elem.firstChild );
+ },
+ contents: function( elem ) {
+ return jQuery.nodeName( elem, "iframe" ) ?
+ elem.contentDocument || elem.contentWindow.document :
+ jQuery.makeArray( elem.childNodes );
+ }
+}, function( name, fn ) {
+ jQuery.fn[ name ] = function( until, selector ) {
+ var ret = jQuery.map( this, fn, until );
+
+ if ( !runtil.test( name ) ) {
+ selector = until;
+ }
+
+ if ( selector && typeof selector === "string" ) {
+ ret = jQuery.filter( selector, ret );
+ }
+
+ ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;
+
+ if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) {
+ ret = ret.reverse();
+ }
+
+ return this.pushStack( ret, name, slice.call( arguments ).join(",") );
+ };
+});
+
+jQuery.extend({
+ filter: function( expr, elems, not ) {
+ if ( not ) {
+ expr = ":not(" + expr + ")";
+ }
+
+ return elems.length === 1 ?
+ jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
+ jQuery.find.matches(expr, elems);
+ },
+
+ dir: function( elem, dir, until ) {
+ var matched = [],
+ cur = elem[ dir ];
+
+ while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
+ if ( cur.nodeType === 1 ) {
+ matched.push( cur );
+ }
+ cur = cur[dir];
+ }
+ return matched;
+ },
+
+ nth: function( cur, result, dir, elem ) {
+ result = result || 1;
+ var num = 0;
+
+ for ( ; cur; cur = cur[dir] ) {
+ if ( cur.nodeType === 1 && ++num === result ) {
+ break;
+ }
+ }
+
+ return cur;
+ },
+
+ sibling: function( n, elem ) {
+ var r = [];
+
+ for ( ; n; n = n.nextSibling ) {
+ if ( n.nodeType === 1 && n !== elem ) {
+ r.push( n );
+ }
+ }
+
+ return r;
+ }
+});
+
+// Implement the identical functionality for filter and not
+function winnow( elements, qualifier, keep ) {
+
+ // Can't pass null or undefined to indexOf in Firefox 4
+ // Set to 0 to skip string check
+ qualifier = qualifier || 0;
+
+ if ( jQuery.isFunction( qualifier ) ) {
+ return jQuery.grep(elements, function( elem, i ) {
+ var retVal = !!qualifier.call( elem, i, elem );
+ return retVal === keep;
+ });
+
+ } else if ( qualifier.nodeType ) {
+ return jQuery.grep(elements, function( elem, i ) {
+ return ( elem === qualifier ) === keep;
+ });
+
+ } else if ( typeof qualifier === "string" ) {
+ var filtered = jQuery.grep(elements, function( elem ) {
+ return elem.nodeType === 1;
+ });
+
+ if ( isSimple.test( qualifier ) ) {
+ return jQuery.filter(qualifier, filtered, !keep);
+ } else {
+ qualifier = jQuery.filter( qualifier, filtered );
+ }
+ }
+
+ return jQuery.grep(elements, function( elem, i ) {
+ return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep;
+ });
+}
+
+
+
+
+function createSafeFragment( document ) {
+ var list = nodeNames.split( "|" ),
+ safeFrag = document.createDocumentFragment();
+
+ if ( safeFrag.createElement ) {
+ while ( list.length ) {
+ safeFrag.createElement(
+ list.pop()
+ );
+ }
+ }
+ return safeFrag;
+}
+
+var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" +
+ "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
+ rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
+ rleadingWhitespace = /^\s+/,
+ rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,
+ rtagName = /<([\w:]+)/,
+ rtbody = /<tbody/i,
+ rhtml = /<|&#?\w+;/,
+ rnoInnerhtml = /<(?:script|style)/i,
+ rnocache = /<(?:script|object|embed|option|style)/i,
+ rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),
+ // checked="checked" or checked
+ rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
+ rscriptType = /\/(java|ecma)script/i,
+ rcleanScript = /^\s*<!(?:\[CDATA\[|\-\-)/,
+ wrapMap = {
+ option: [ 1, "<select multiple='multiple'>", "</select>" ],
+ legend: [ 1, "<fieldset>", "</fieldset>" ],
+ thead: [ 1, "<table>", "</table>" ],
+ tr: [ 2, "<table><tbody>", "</tbody></table>" ],
+ td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
+ col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
+ area: [ 1, "<map>", "</map>" ],
+ _default: [ 0, "", "" ]
+ },
+ safeFragment = createSafeFragment( document );
+
+wrapMap.optgroup = wrapMap.option;
+wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
+wrapMap.th = wrapMap.td;
+
+// IE can't serialize <link> and <script> tags normally
+if ( !jQuery.support.htmlSerialize ) {
+ wrapMap._default = [ 1, "div<div>", "</div>" ];
+}
+
+jQuery.fn.extend({
+ text: function( value ) {
+ return jQuery.access( this, function( value ) {
+ return value === undefined ?
+ jQuery.text( this ) :
+ this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) );
+ }, null, value, arguments.length );
+ },
+
+ wrapAll: function( html ) {
+ if ( jQuery.isFunction( html ) ) {
+ return this.each(function(i) {
+ jQuery(this).wrapAll( html.call(this, i) );
+ });
+ }
+
+ if ( this[0] ) {
+ // The elements to wrap the target around
+ var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
+
+ if ( this[0].parentNode ) {
+ wrap.insertBefore( this[0] );
+ }
+
+ wrap.map(function() {
+ var elem = this;
+
+ while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
+ elem = elem.firstChild;
+ }
+
+ return elem;
+ }).append( this );
+ }
+
+ return this;
+ },
+
+ wrapInner: function( html ) {
+ if ( jQuery.isFunction( html ) ) {
+ return this.each(function(i) {
+ jQuery(this).wrapInner( html.call(this, i) );
+ });
+ }
+
+ return this.each(function() {
+ var self = jQuery( this ),
+ contents = self.contents();
+
+ if ( contents.length ) {
+ contents.wrapAll( html );
+
+ } else {
+ self.append( html );
+ }
+ });
+ },
+
+ wrap: function( html ) {
+ var isFunction = jQuery.isFunction( html );
+
+ return this.each(function(i) {
+ jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
+ });
+ },
+
+ unwrap: function() {
+ return this.parent().each(function() {
+ if ( !jQuery.nodeName( this, "body" ) ) {
+ jQuery( this ).replaceWith( this.childNodes );
+ }
+ }).end();
+ },
+
+ append: function() {
+ return this.domManip(arguments, true, function( elem ) {
+ if ( this.nodeType === 1 ) {
+ this.appendChild( elem );
+ }
+ });
+ },
+
+ prepend: function() {
+ return this.domManip(arguments, true, function( elem ) {
+ if ( this.nodeType === 1 ) {
+ this.insertBefore( elem, this.firstChild );
+ }
+ });
+ },
+
+ before: function() {
+ if ( this[0] && this[0].parentNode ) {
+ return this.domManip(arguments, false, function( elem ) {
+ this.parentNode.insertBefore( elem, this );
+ });
+ } else if ( arguments.length ) {
+ var set = jQuery.clean( arguments );
+ set.push.apply( set, this.toArray() );
+ return this.pushStack( set, "before", arguments );
+ }
+ },
+
+ after: function() {
+ if ( this[0] && this[0].parentNode ) {
+ return this.domManip(arguments, false, function( elem ) {
+ this.parentNode.insertBefore( elem, this.nextSibling );
+ });
+ } else if ( arguments.length ) {
+ var set = this.pushStack( this, "after", arguments );
+ set.push.apply( set, jQuery.clean(arguments) );
+ return set;
+ }
+ },
+
+ // keepData is for internal use only--do not document
+ remove: function( selector, keepData ) {
+ for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
+ if ( !selector || jQuery.filter( selector, [ elem ] ).length ) {
+ if ( !keepData && elem.nodeType === 1 ) {
+ jQuery.cleanData( elem.getElementsByTagName("*") );
+ jQuery.cleanData( [ elem ] );
+ }
+
+ if ( elem.parentNode ) {
+ elem.parentNode.removeChild( elem );
+ }
+ }
+ }
+
+ return this;
+ },
+
+ empty: function() {
+ for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
+ // Remove element nodes and prevent memory leaks
+ if ( elem.nodeType === 1 ) {
+ jQuery.cleanData( elem.getElementsByTagName("*") );
+ }
+
+ // Remove any remaining nodes
+ while ( elem.firstChild ) {
+ elem.removeChild( elem.firstChild );
+ }
+ }
+
+ return this;
+ },
+
+ clone: function( dataAndEvents, deepDataAndEvents ) {
+ dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
+ deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
+
+ return this.map( function () {
+ return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
+ });
+ },
+
+ html: function( value ) {
+ return jQuery.access( this, function( value ) {
+ var elem = this[0] || {},
+ i = 0,
+ l = this.length;
+
+ if ( value === undefined ) {
+ return elem.nodeType === 1 ?
+ elem.innerHTML.replace( rinlinejQuery, "" ) :
+ null;
+ }
+
+
+ if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
+ ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
+ !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) {
+
+ value = value.replace( rxhtmlTag, "<$1></$2>" );
+
+ try {
+ for (; i < l; i++ ) {
+ // Remove element nodes and prevent memory leaks
+ elem = this[i] || {};
+ if ( elem.nodeType === 1 ) {
+ jQuery.cleanData( elem.getElementsByTagName( "*" ) );
+ elem.innerHTML = value;
+ }
+ }
+
+ elem = 0;
+
+ // If using innerHTML throws an exception, use the fallback method
+ } catch(e) {}
+ }
+
+ if ( elem ) {
+ this.empty().append( value );
+ }
+ }, null, value, arguments.length );
+ },
+
+ replaceWith: function( value ) {
+ if ( this[0] && this[0].parentNode ) {
+ // Make sure that the elements are removed from the DOM before they are inserted
+ // this can help fix replacing a parent with child elements
+ if ( jQuery.isFunction( value ) ) {
+ return this.each(function(i) {
+ var self = jQuery(this), old = self.html();
+ self.replaceWith( value.call( this, i, old ) );
+ });
+ }
+
+ if ( typeof value !== "string" ) {
+ value = jQuery( value ).detach();
+ }
+
+ return this.each(function() {
+ var next = this.nextSibling,
+ parent = this.parentNode;
+
+ jQuery( this ).remove();
+
+ if ( next ) {
+ jQuery(next).before( value );
+ } else {
+ jQuery(parent).append( value );
+ }
+ });
+ } else {
+ return this.length ?
+ this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) :
+ this;
+ }
+ },
+
+ detach: function( selector ) {
+ return this.remove( selector, true );
+ },
+
+ domManip: function( args, table, callback ) {
+ var results, first, fragment, parent,
+ value = args[0],
+ scripts = [];
+
+ // We can't cloneNode fragments that contain checked, in WebKit
+ if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) {
+ return this.each(function() {
+ jQuery(this).domManip( args, table, callback, true );
+ });
+ }
+
+ if ( jQuery.isFunction(value) ) {
+ return this.each(function(i) {
+ var self = jQuery(this);
+ args[0] = value.call(this, i, table ? self.html() : undefined);
+ self.domManip( args, table, callback );
+ });
+ }
+
+ if ( this[0] ) {
+ parent = value && value.parentNode;
+
+ // If we're in a fragment, just use that instead of building a new one
+ if ( jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) {
+ results = { fragment: parent };
+
+ } else {
+ results = jQuery.buildFragment( args, this, scripts );
+ }
+
+ fragment = results.fragment;
+
+ if ( fragment.childNodes.length === 1 ) {
+ first = fragment = fragment.firstChild;
+ } else {
+ first = fragment.firstChild;
+ }
+
+ if ( first ) {
+ table = table && jQuery.nodeName( first, "tr" );
+
+ for ( var i = 0, l = this.length, lastIndex = l - 1; i < l; i++ ) {
+ callback.call(
+ table ?
+ root(this[i], first) :
+ this[i],
+ // Make sure that we do not leak memory by inadvertently discarding
+ // the original fragment (which might have attached data) instead of
+ // using it; in addition, use the original fragment object for the last
+ // item instead of first because it can end up being emptied incorrectly
+ // in certain situations (Bug #8070).
+ // Fragments from the fragment cache must always be cloned and never used
+ // in place.
+ results.cacheable || ( l > 1 && i < lastIndex ) ?
+ jQuery.clone( fragment, true, true ) :
+ fragment
+ );
+ }
+ }
+
+ if ( scripts.length ) {
+ jQuery.each( scripts, function( i, elem ) {
+ if ( elem.src ) {
+ jQuery.ajax({
+ type: "GET",
+ global: false,
+ url: elem.src,
+ async: false,
+ dataType: "script"
+ });
+ } else {
+ jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "/*$0*/" ) );
+ }
+
+ if ( elem.parentNode ) {
+ elem.parentNode.removeChild( elem );
+ }
+ });
+ }
+ }
+
+ return this;
+ }
+});
+
+function root( elem, cur ) {
+ return jQuery.nodeName(elem, "table") ?
+ (elem.getElementsByTagName("tbody")[0] ||
+ elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
+ elem;
+}
+
+function cloneCopyEvent( src, dest ) {
+
+ if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
+ return;
+ }
+
+ var type, i, l,
+ oldData = jQuery._data( src ),
+ curData = jQuery._data( dest, oldData ),
+ events = oldData.events;
+
+ if ( events ) {
+ delete curData.handle;
+ curData.events = {};
+
+ for ( type in events ) {
+ for ( i = 0, l = events[ type ].length; i < l; i++ ) {
+ jQuery.event.add( dest, type, events[ type ][ i ] );
+ }
+ }
+ }
+
+ // make the cloned public data object a copy from the original
+ if ( curData.data ) {
+ curData.data = jQuery.extend( {}, curData.data );
+ }
+}
+
+function cloneFixAttributes( src, dest ) {
+ var nodeName;
+
+ // We do not need to do anything for non-Elements
+ if ( dest.nodeType !== 1 ) {
+ return;
+ }
+
+ // clearAttributes removes the attributes, which we don't want,
+ // but also removes the attachEvent events, which we *do* want
+ if ( dest.clearAttributes ) {
+ dest.clearAttributes();
+ }
+
+ // mergeAttributes, in contrast, only merges back on the
+ // original attributes, not the events
+ if ( dest.mergeAttributes ) {
+ dest.mergeAttributes( src );
+ }
+
+ nodeName = dest.nodeName.toLowerCase();
+
+ // IE6-8 fail to clone children inside object elements that use
+ // the proprietary classid attribute value (rather than the type
+ // attribute) to identify the type of content to display
+ if ( nodeName === "object" ) {
+ dest.outerHTML = src.outerHTML;
+
+ } else if ( nodeName === "input" && (src.type === "checkbox" || src.type === "radio") ) {
+ // IE6-8 fails to persist the checked state of a cloned checkbox
+ // or radio button. Worse, IE6-7 fail to give the cloned element
+ // a checked appearance if the defaultChecked value isn't also set
+ if ( src.checked ) {
+ dest.defaultChecked = dest.checked = src.checked;
+ }
+
+ // IE6-7 get confused and end up setting the value of a cloned
+ // checkbox/radio button to an empty string instead of "on"
+ if ( dest.value !== src.value ) {
+ dest.value = src.value;
+ }
+
+ // IE6-8 fails to return the selected option to the default selected
+ // state when cloning options
+ } else if ( nodeName === "option" ) {
+ dest.selected = src.defaultSelected;
+
+ // IE6-8 fails to set the defaultValue to the correct value when
+ // cloning other types of input fields
+ } else if ( nodeName === "input" || nodeName === "textarea" ) {
+ dest.defaultValue = src.defaultValue;
+
+ // IE blanks contents when cloning scripts
+ } else if ( nodeName === "script" && dest.text !== src.text ) {
+ dest.text = src.text;
+ }
+
+ // Event data gets referenced instead of copied if the expando
+ // gets copied too
+ dest.removeAttribute( jQuery.expando );
+
+ // Clear flags for bubbling special change/submit events, they must
+ // be reattached when the newly cloned events are first activated
+ dest.removeAttribute( "_submit_attached" );
+ dest.removeAttribute( "_change_attached" );
+}
+
+jQuery.buildFragment = function( args, nodes, scripts ) {
+ var fragment, cacheable, cacheresults, doc,
+ first = args[ 0 ];
+
+ // nodes may contain either an explicit document object,
+ // a jQuery collection or context object.
+ // If nodes[0] contains a valid object to assign to doc
+ if ( nodes && nodes[0] ) {
+ doc = nodes[0].ownerDocument || nodes[0];
+ }
+
+ // Ensure that an attr object doesn't incorrectly stand in as a document object
+ // Chrome and Firefox seem to allow this to occur and will throw exception
+ // Fixes #8950
+ if ( !doc.createDocumentFragment ) {
+ doc = document;
+ }
+
+ // Only cache "small" (1/2 KB) HTML strings that are associated with the main document
+ // Cloning options loses the selected state, so don't cache them
+ // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment
+ // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache
+ // Lastly, IE6,7,8 will not correctly reuse cached fragments that were created from unknown elems #10501
+ if ( args.length === 1 && typeof first === "string" && first.length < 512 && doc === document &&
+ first.charAt(0) === "<" && !rnocache.test( first ) &&
+ (jQuery.support.checkClone || !rchecked.test( first )) &&
+ (jQuery.support.html5Clone || !rnoshimcache.test( first )) ) {
+
+ cacheable = true;
+
+ cacheresults = jQuery.fragments[ first ];
+ if ( cacheresults && cacheresults !== 1 ) {
+ fragment = cacheresults;
+ }
+ }
+
+ if ( !fragment ) {
+ fragment = doc.createDocumentFragment();
+ jQuery.clean( args, doc, fragment, scripts );
+ }
+
+ if ( cacheable ) {
+ jQuery.fragments[ first ] = cacheresults ? fragment : 1;
+ }
+
+ return { fragment: fragment, cacheable: cacheable };
+};
+
+jQuery.fragments = {};
+
+jQuery.each({
+ appendTo: "append",
+ prependTo: "prepend",
+ insertBefore: "before",
+ insertAfter: "after",
+ replaceAll: "replaceWith"
+}, function( name, original ) {
+ jQuery.fn[ name ] = function( selector ) {
+ var ret = [],
+ insert = jQuery( selector ),
+ parent = this.length === 1 && this[0].parentNode;
+
+ if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {
+ insert[ original ]( this[0] );
+ return this;
+
+ } else {
+ for ( var i = 0, l = insert.length; i < l; i++ ) {
+ var elems = ( i > 0 ? this.clone(true) : this ).get();
+ jQuery( insert[i] )[ original ]( elems );
+ ret = ret.concat( elems );
+ }
+
+ return this.pushStack( ret, name, insert.selector );
+ }
+ };
+});
+
+function getAll( elem ) {
+ if ( typeof elem.getElementsByTagName !== "undefined" ) {
+ return elem.getElementsByTagName( "*" );
+
+ } else if ( typeof elem.querySelectorAll !== "undefined" ) {
+ return elem.querySelectorAll( "*" );
+
+ } else {
+ return [];
+ }
+}
+
+// Used in clean, fixes the defaultChecked property
+function fixDefaultChecked( elem ) {
+ if ( elem.type === "checkbox" || elem.type === "radio" ) {
+ elem.defaultChecked = elem.checked;
+ }
+}
+// Finds all inputs and passes them to fixDefaultChecked
+function findInputs( elem ) {
+ var nodeName = ( elem.nodeName || "" ).toLowerCase();
+ if ( nodeName === "input" ) {
+ fixDefaultChecked( elem );
+ // Skip scripts, get other children
+ } else if ( nodeName !== "script" && typeof elem.getElementsByTagName !== "undefined" ) {
+ jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked );
+ }
+}
+
+// Derived From: http://www.iecss.com/shimprove/javascript/shimprove.1-0-1.js
+function shimCloneNode( elem ) {
+ var div = document.createElement( "div" );
+ safeFragment.appendChild( div );
+
+ div.innerHTML = elem.outerHTML;
+ return div.firstChild;
+}
+
+jQuery.extend({
+ clone: function( elem, dataAndEvents, deepDataAndEvents ) {
+ var srcElements,
+ destElements,
+ i,
+ // IE<=8 does not properly clone detached, unknown element nodes
+ clone = jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ?
+ elem.cloneNode( true ) :
+ shimCloneNode( elem );
+
+ if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
+ (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
+ // IE copies events bound via attachEvent when using cloneNode.
+ // Calling detachEvent on the clone will also remove the events
+ // from the original. In order to get around this, we use some
+ // proprietary methods to clear the events. Thanks to MooTools
+ // guys for this hotness.
+
+ cloneFixAttributes( elem, clone );
+
+ // Using Sizzle here is crazy slow, so we use getElementsByTagName instead
+ srcElements = getAll( elem );
+ destElements = getAll( clone );
+
+ // Weird iteration because IE will replace the length property
+ // with an element if you are cloning the body and one of the
+ // elements on the page has a name or id of "length"
+ for ( i = 0; srcElements[i]; ++i ) {
+ // Ensure that the destination node is not null; Fixes #9587
+ if ( destElements[i] ) {
+ cloneFixAttributes( srcElements[i], destElements[i] );
+ }
+ }
+ }
+
+ // Copy the events from the original to the clone
+ if ( dataAndEvents ) {
+ cloneCopyEvent( elem, clone );
+
+ if ( deepDataAndEvents ) {
+ srcElements = getAll( elem );
+ destElements = getAll( clone );
+
+ for ( i = 0; srcElements[i]; ++i ) {
+ cloneCopyEvent( srcElements[i], destElements[i] );
+ }
+ }
+ }
+
+ srcElements = destElements = null;
+
+ // Return the cloned set
+ return clone;
+ },
+
+ clean: function( elems, context, fragment, scripts ) {
+ var checkScriptType, script, j,
+ ret = [];
+
+ context = context || document;
+
+ // !context.createElement fails in IE with an error but returns typeof 'object'
+ if ( typeof context.createElement === "undefined" ) {
+ context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
+ }
+
+ for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
+ if ( typeof elem === "number" ) {
+ elem += "";
+ }
+
+ if ( !elem ) {
+ continue;
+ }
+
+ // Convert html string into DOM nodes
+ if ( typeof elem === "string" ) {
+ if ( !rhtml.test( elem ) ) {
+ elem = context.createTextNode( elem );
+ } else {
+ // Fix "XHTML"-style tags in all browsers
+ elem = elem.replace(rxhtmlTag, "<$1></$2>");
+
+ // Trim whitespace, otherwise indexOf won't work as expected
+ var tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(),
+ wrap = wrapMap[ tag ] || wrapMap._default,
+ depth = wrap[0],
+ div = context.createElement("div"),
+ safeChildNodes = safeFragment.childNodes,
+ remove;
+
+ // Append wrapper element to unknown element safe doc fragment
+ if ( context === document ) {
+ // Use the fragment we've already created for this document
+ safeFragment.appendChild( div );
+ } else {
+ // Use a fragment created with the owner document
+ createSafeFragment( context ).appendChild( div );
+ }
+
+ // Go to html and back, then peel off extra wrappers
+ div.innerHTML = wrap[1] + elem + wrap[2];
+
+ // Move to the right depth
+ while ( depth-- ) {
+ div = div.lastChild;
+ }
+
+ // Remove IE's autoinserted <tbody> from table fragments
+ if ( !jQuery.support.tbody ) {
+
+ // String was a <table>, *may* have spurious <tbody>
+ var hasBody = rtbody.test(elem),
+ tbody = tag === "table" && !hasBody ?
+ div.firstChild && div.firstChild.childNodes :
+
+ // String was a bare <thead> or <tfoot>
+ wrap[1] === "<table>" && !hasBody ?
+ div.childNodes :
+ [];
+
+ for ( j = tbody.length - 1; j >= 0 ; --j ) {
+ if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) {
+ tbody[ j ].parentNode.removeChild( tbody[ j ] );
+ }
+ }
+ }
+
+ // IE completely kills leading whitespace when innerHTML is used
+ if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
+ div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild );
+ }
+
+ elem = div.childNodes;
+
+ // Clear elements from DocumentFragment (safeFragment or otherwise)
+ // to avoid hoarding elements. Fixes #11356
+ if ( div ) {
+ div.parentNode.removeChild( div );
+
+ // Guard against -1 index exceptions in FF3.6
+ if ( safeChildNodes.length > 0 ) {
+ remove = safeChildNodes[ safeChildNodes.length - 1 ];
+
+ if ( remove && remove.parentNode ) {
+ remove.parentNode.removeChild( remove );
+ }
+ }
+ }
+ }
+ }
+
+ // Resets defaultChecked for any radios and checkboxes
+ // about to be appended to the DOM in IE 6/7 (#8060)
+ var len;
+ if ( !jQuery.support.appendChecked ) {
+ if ( elem[0] && typeof (len = elem.length) === "number" ) {
+ for ( j = 0; j < len; j++ ) {
+ findInputs( elem[j] );
+ }
+ } else {
+ findInputs( elem );
+ }
+ }
+
+ if ( elem.nodeType ) {
+ ret.push( elem );
+ } else {
+ ret = jQuery.merge( ret, elem );
+ }
+ }
+
+ if ( fragment ) {
+ checkScriptType = function( elem ) {
+ return !elem.type || rscriptType.test( elem.type );
+ };
+ for ( i = 0; ret[i]; i++ ) {
+ script = ret[i];
+ if ( scripts && jQuery.nodeName( script, "script" ) && (!script.type || rscriptType.test( script.type )) ) {
+ scripts.push( script.parentNode ? script.parentNode.removeChild( script ) : script );
+
+ } else {
+ if ( script.nodeType === 1 ) {
+ var jsTags = jQuery.grep( script.getElementsByTagName( "script" ), checkScriptType );
+
+ ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
+ }
+ fragment.appendChild( script );
+ }
+ }
+ }
+
+ return ret;
+ },
+
+ cleanData: function( elems ) {
+ var data, id,
+ cache = jQuery.cache,
+ special = jQuery.event.special,
+ deleteExpando = jQuery.support.deleteExpando;
+
+ for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
+ if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
+ continue;
+ }
+
+ id = elem[ jQuery.expando ];
+
+ if ( id ) {
+ data = cache[ id ];
+
+ if ( data && data.events ) {
+ for ( var type in data.events ) {
+ if ( special[ type ] ) {
+ jQuery.event.remove( elem, type );
+
+ // This is a shortcut to avoid jQuery.event.remove's overhead
+ } else {
+ jQuery.removeEvent( elem, type, data.handle );
+ }
+ }
+
+ // Null the DOM reference to avoid IE6/7/8 leak (#7054)
+ if ( data.handle ) {
+ data.handle.elem = null;
+ }
+ }
+
+ if ( deleteExpando ) {
+ delete elem[ jQuery.expando ];
+
+ } else if ( elem.removeAttribute ) {
+ elem.removeAttribute( jQuery.expando );
+ }
+
+ delete cache[ id ];
+ }
+ }
+ }
+});
+
+
+
+
+var ralpha = /alpha\([^)]*\)/i,
+ ropacity = /opacity=([^)]*)/,
+ // fixed for IE9, see #8346
+ rupper = /([A-Z]|^ms)/g,
+ rnum = /^[\-+]?(?:\d*\.)?\d+$/i,
+ rnumnonpx = /^-?(?:\d*\.)?\d+(?!px)[^\d\s]+$/i,
+ rrelNum = /^([\-+])=([\-+.\de]+)/,
+ rmargin = /^margin/,
+
+ cssShow = { position: "absolute", visibility: "hidden", display: "block" },
+
+ // order is important!
+ cssExpand = [ "Top", "Right", "Bottom", "Left" ],
+
+ curCSS,
+
+ getComputedStyle,
+ currentStyle;
+
+jQuery.fn.css = function( name, value ) {
+ return jQuery.access( this, function( elem, name, value ) {
+ return value !== undefined ?
+ jQuery.style( elem, name, value ) :
+ jQuery.css( elem, name );
+ }, name, value, arguments.length > 1 );
+};
+
+jQuery.extend({
+ // Add in style property hooks for overriding the default
+ // behavior of getting and setting a style property
+ cssHooks: {
+ opacity: {
+ get: function( elem, computed ) {
+ if ( computed ) {
+ // We should always get a number back from opacity
+ var ret = curCSS( elem, "opacity" );
+ return ret === "" ? "1" : ret;
+
+ } else {
+ return elem.style.opacity;
+ }
+ }
+ }
+ },
+
+ // Exclude the following css properties to add px
+ cssNumber: {
+ "fillOpacity": true,
+ "fontWeight": true,
+ "lineHeight": true,
+ "opacity": true,
+ "orphans": true,
+ "widows": true,
+ "zIndex": true,
+ "zoom": true
+ },
+
+ // Add in properties whose names you wish to fix before
+ // setting or getting the value
+ cssProps: {
+ // normalize float css property
+ "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
+ },
+
+ // Get and set the style property on a DOM Node
+ style: function( elem, name, value, extra ) {
+ // Don't set styles on text and comment nodes
+ if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
+ return;
+ }
+
+ // Make sure that we're working with the right name
+ var ret, type, origName = jQuery.camelCase( name ),
+ style = elem.style, hooks = jQuery.cssHooks[ origName ];
+
+ name = jQuery.cssProps[ origName ] || origName;
+
+ // Check if we're setting a value
+ if ( value !== undefined ) {
+ type = typeof value;
+
+ // convert relative number strings (+= or -=) to relative numbers. #7345
+ if ( type === "string" && (ret = rrelNum.exec( value )) ) {
+ value = ( +( ret[1] + 1) * +ret[2] ) + parseFloat( jQuery.css( elem, name ) );
+ // Fixes bug #9237
+ type = "number";
+ }
+
+ // Make sure that NaN and null values aren't set. See: #7116
+ if ( value == null || type === "number" && isNaN( value ) ) {
+ return;
+ }
+
+ // If a number was passed in, add 'px' to the (except for certain CSS properties)
+ if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
+ value += "px";
+ }
+
+ // If a hook was provided, use that value, otherwise just set the specified value
+ if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value )) !== undefined ) {
+ // Wrapped to prevent IE from throwing errors when 'invalid' values are provided
+ // Fixes bug #5509
+ try {
+ style[ name ] = value;
+ } catch(e) {}
+ }
+
+ } else {
+ // If a hook was provided get the non-computed value from there
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
+ return ret;
+ }
+
+ // Otherwise just get the value from the style object
+ return style[ name ];
+ }
+ },
+
+ css: function( elem, name, extra ) {
+ var ret, hooks;
+
+ // Make sure that we're working with the right name
+ name = jQuery.camelCase( name );
+ hooks = jQuery.cssHooks[ name ];
+ name = jQuery.cssProps[ name ] || name;
+
+ // cssFloat needs a special treatment
+ if ( name === "cssFloat" ) {
+ name = "float";
+ }
+
+ // If a hook was provided get the computed value from there
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) {
+ return ret;
+
+ // Otherwise, if a way to get the computed value exists, use that
+ } else if ( curCSS ) {
+ return curCSS( elem, name );
+ }
+ },
+
+ // A method for quickly swapping in/out CSS properties to get correct calculations
+ swap: function( elem, options, callback ) {
+ var old = {},
+ ret, name;
+
+ // Remember the old values, and insert the new ones
+ for ( name in options ) {
+ old[ name ] = elem.style[ name ];
+ elem.style[ name ] = options[ name ];
+ }
+
+ ret = callback.call( elem );
+
+ // Revert the old values
+ for ( name in options ) {
+ elem.style[ name ] = old[ name ];
+ }
+
+ return ret;
+ }
+});
+
+// DEPRECATED in 1.3, Use jQuery.css() instead
+jQuery.curCSS = jQuery.css;
+
+if ( document.defaultView && document.defaultView.getComputedStyle ) {
+ getComputedStyle = function( elem, name ) {
+ var ret, defaultView, computedStyle, width,
+ style = elem.style;
+
+ name = name.replace( rupper, "-$1" ).toLowerCase();
+
+ if ( (defaultView = elem.ownerDocument.defaultView) &&
+ (computedStyle = defaultView.getComputedStyle( elem, null )) ) {
+
+ ret = computedStyle.getPropertyValue( name );
+ if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
+ ret = jQuery.style( elem, name );
+ }
+ }
+
+ // A tribute to the "awesome hack by Dean Edwards"
+ // WebKit uses "computed value (percentage if specified)" instead of "used value" for margins
+ // which is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
+ if ( !jQuery.support.pixelMargin && computedStyle && rmargin.test( name ) && rnumnonpx.test( ret ) ) {
+ width = style.width;
+ style.width = ret;
+ ret = computedStyle.width;
+ style.width = width;
+ }
+
+ return ret;
+ };
+}
+
+if ( document.documentElement.currentStyle ) {
+ currentStyle = function( elem, name ) {
+ var left, rsLeft, uncomputed,
+ ret = elem.currentStyle && elem.currentStyle[ name ],
+ style = elem.style;
+
+ // Avoid setting ret to empty string here
+ // so we don't default to auto
+ if ( ret == null && style && (uncomputed = style[ name ]) ) {
+ ret = uncomputed;
+ }
+
+ // From the awesome hack by Dean Edwards
+ // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
+
+ // If we're not dealing with a regular pixel number
+ // but a number that has a weird ending, we need to convert it to pixels
+ if ( rnumnonpx.test( ret ) ) {
+
+ // Remember the original values
+ left = style.left;
+ rsLeft = elem.runtimeStyle && elem.runtimeStyle.left;
+
+ // Put in the new values to get a computed value out
+ if ( rsLeft ) {
+ elem.runtimeStyle.left = elem.currentStyle.left;
+ }
+ style.left = name === "fontSize" ? "1em" : ret;
+ ret = style.pixelLeft + "px";
+
+ // Revert the changed values
+ style.left = left;
+ if ( rsLeft ) {
+ elem.runtimeStyle.left = rsLeft;
+ }
+ }
+
+ return ret === "" ? "auto" : ret;
+ };
+}
+
+curCSS = getComputedStyle || currentStyle;
+
+function getWidthOrHeight( elem, name, extra ) {
+
+ // Start with offset property
+ var val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
+ i = name === "width" ? 1 : 0,
+ len = 4;
+
+ if ( val > 0 ) {
+ if ( extra !== "border" ) {
+ for ( ; i < len; i += 2 ) {
+ if ( !extra ) {
+ val -= parseFloat( jQuery.css( elem, "padding" + cssExpand[ i ] ) ) || 0;
+ }
+ if ( extra === "margin" ) {
+ val += parseFloat( jQuery.css( elem, extra + cssExpand[ i ] ) ) || 0;
+ } else {
+ val -= parseFloat( jQuery.css( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0;
+ }
+ }
+ }
+
+ return val + "px";
+ }
+
+ // Fall back to computed then uncomputed css if necessary
+ val = curCSS( elem, name );
+ if ( val < 0 || val == null ) {
+ val = elem.style[ name ];
+ }
+
+ // Computed unit is not pixels. Stop here and return.
+ if ( rnumnonpx.test(val) ) {
+ return val;
+ }
+
+ // Normalize "", auto, and prepare for extra
+ val = parseFloat( val ) || 0;
+
+ // Add padding, border, margin
+ if ( extra ) {
+ for ( ; i < len; i += 2 ) {
+ val += parseFloat( jQuery.css( elem, "padding" + cssExpand[ i ] ) ) || 0;
+ if ( extra !== "padding" ) {
+ val += parseFloat( jQuery.css( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0;
+ }
+ if ( extra === "margin" ) {
+ val += parseFloat( jQuery.css( elem, extra + cssExpand[ i ]) ) || 0;
+ }
+ }
+ }
+
+ return val + "px";
+}
+
+jQuery.each([ "height", "width" ], function( i, name ) {
+ jQuery.cssHooks[ name ] = {
+ get: function( elem, computed, extra ) {
+ if ( computed ) {
+ if ( elem.offsetWidth !== 0 ) {
+ return getWidthOrHeight( elem, name, extra );
+ } else {
+ return jQuery.swap( elem, cssShow, function() {
+ return getWidthOrHeight( elem, name, extra );
+ });
+ }
+ }
+ },
+
+ set: function( elem, value ) {
+ return rnum.test( value ) ?
+ value + "px" :
+ value;
+ }
+ };
+});
+
+if ( !jQuery.support.opacity ) {
+ jQuery.cssHooks.opacity = {
+ get: function( elem, computed ) {
+ // IE uses filters for opacity
+ return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
+ ( parseFloat( RegExp.$1 ) / 100 ) + "" :
+ computed ? "1" : "";
+ },
+
+ set: function( elem, value ) {
+ var style = elem.style,
+ currentStyle = elem.currentStyle,
+ opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",
+ filter = currentStyle && currentStyle.filter || style.filter || "";
+
+ // IE has trouble with opacity if it does not have layout
+ // Force it by setting the zoom level
+ style.zoom = 1;
+
+ // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652
+ if ( value >= 1 && jQuery.trim( filter.replace( ralpha, "" ) ) === "" ) {
+
+ // Setting style.filter to null, "" & " " still leave "filter:" in the cssText
+ // if "filter:" is present at all, clearType is disabled, we want to avoid this
+ // style.removeAttribute is IE Only, but so apparently is this code path...
+ style.removeAttribute( "filter" );
+
+ // if there there is no filter style applied in a css rule, we are done
+ if ( currentStyle && !currentStyle.filter ) {
+ return;
+ }
+ }
+
+ // otherwise, set new filter values
+ style.filter = ralpha.test( filter ) ?
+ filter.replace( ralpha, opacity ) :
+ filter + " " + opacity;
+ }
+ };
+}
+
+jQuery(function() {
+ // This hook cannot be added until DOM ready because the support test
+ // for it is not run until after DOM ready
+ if ( !jQuery.support.reliableMarginRight ) {
+ jQuery.cssHooks.marginRight = {
+ get: function( elem, computed ) {
+ // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
+ // Work around by temporarily setting element display to inline-block
+ return jQuery.swap( elem, { "display": "inline-block" }, function() {
+ if ( computed ) {
+ return curCSS( elem, "margin-right" );
+ } else {
+ return elem.style.marginRight;
+ }
+ });
+ }
+ };
+ }
+});
+
+if ( jQuery.expr && jQuery.expr.filters ) {
+ jQuery.expr.filters.hidden = function( elem ) {
+ var width = elem.offsetWidth,
+ height = elem.offsetHeight;
+
+ return ( width === 0 && height === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none");
+ };
+
+ jQuery.expr.filters.visible = function( elem ) {
+ return !jQuery.expr.filters.hidden( elem );
+ };
+}
+
+// These hooks are used by animate to expand properties
+jQuery.each({
+ margin: "",
+ padding: "",
+ border: "Width"
+}, function( prefix, suffix ) {
+
+ jQuery.cssHooks[ prefix + suffix ] = {
+ expand: function( value ) {
+ var i,
+
+ // assumes a single number if not a string
+ parts = typeof value === "string" ? value.split(" ") : [ value ],
+ expanded = {};
+
+ for ( i = 0; i < 4; i++ ) {
+ expanded[ prefix + cssExpand[ i ] + suffix ] =
+ parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
+ }
+
+ return expanded;
+ }
+ };
+});
+
+
+
+
+var r20 = /%20/g,
+ rbracket = /\[\]$/,
+ rCRLF = /\r?\n/g,
+ rhash = /#.*$/,
+ rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
+ rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
+ // #7653, #8125, #8152: local protocol detection
+ rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,
+ rnoContent = /^(?:GET|HEAD)$/,
+ rprotocol = /^\/\//,
+ rquery = /\?/,
+ rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
+ rselectTextarea = /^(?:select|textarea)/i,
+ rspacesAjax = /\s+/,
+ rts = /([?&])_=[^&]*/,
+ rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,
+
+ // Keep a copy of the old load method
+ _load = jQuery.fn.load,
+
+ /* Prefilters
+ * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
+ * 2) These are called:
+ * - BEFORE asking for a transport
+ * - AFTER param serialization (s.data is a string if s.processData is true)
+ * 3) key is the dataType
+ * 4) the catchall symbol "*" can be used
+ * 5) execution will start with transport dataType and THEN continue down to "*" if needed
+ */
+ prefilters = {},
+
+ /* Transports bindings
+ * 1) key is the dataType
+ * 2) the catchall symbol "*" can be used
+ * 3) selection will start with transport dataType and THEN go to "*" if needed
+ */
+ transports = {},
+
+ // Document location
+ ajaxLocation,
+
+ // Document location segments
+ ajaxLocParts,
+
+ // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
+ allTypes = ["*/"] + ["*"];
+
+// #8138, IE may throw an exception when accessing
+// a field from window.location if document.domain has been set
+try {
+ ajaxLocation = location.href;
+} catch( e ) {
+ // Use the href attribute of an A element
+ // since IE will modify it given document.location
+ ajaxLocation = document.createElement( "a" );
+ ajaxLocation.href = "";
+ ajaxLocation = ajaxLocation.href;
+}
+
+// Segment location into parts
+ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
+
+// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
+function addToPrefiltersOrTransports( structure ) {
+
+ // dataTypeExpression is optional and defaults to "*"
+ return function( dataTypeExpression, func ) {
+
+ if ( typeof dataTypeExpression !== "string" ) {
+ func = dataTypeExpression;
+ dataTypeExpression = "*";
+ }
+
+ if ( jQuery.isFunction( func ) ) {
+ var dataTypes = dataTypeExpression.toLowerCase().split( rspacesAjax ),
+ i = 0,
+ length = dataTypes.length,
+ dataType,
+ list,
+ placeBefore;
+
+ // For each dataType in the dataTypeExpression
+ for ( ; i < length; i++ ) {
+ dataType = dataTypes[ i ];
+ // We control if we're asked to add before
+ // any existing element
+ placeBefore = /^\+/.test( dataType );
+ if ( placeBefore ) {
+ dataType = dataType.substr( 1 ) || "*";
+ }
+ list = structure[ dataType ] = structure[ dataType ] || [];
+ // then we add to the structure accordingly
+ list[ placeBefore ? "unshift" : "push" ]( func );
+ }
+ }
+ };
+}
+
+// Base inspection function for prefilters and transports
+function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR,
+ dataType /* internal */, inspected /* internal */ ) {
+
+ dataType = dataType || options.dataTypes[ 0 ];
+ inspected = inspected || {};
+
+ inspected[ dataType ] = true;
+
+ var list = structure[ dataType ],
+ i = 0,
+ length = list ? list.length : 0,
+ executeOnly = ( structure === prefilters ),
+ selection;
+
+ for ( ; i < length && ( executeOnly || !selection ); i++ ) {
+ selection = list[ i ]( options, originalOptions, jqXHR );
+ // If we got redirected to another dataType
+ // we try there if executing only and not done already
+ if ( typeof selection === "string" ) {
+ if ( !executeOnly || inspected[ selection ] ) {
+ selection = undefined;
+ } else {
+ options.dataTypes.unshift( selection );
+ selection = inspectPrefiltersOrTransports(
+ structure, options, originalOptions, jqXHR, selection, inspected );
+ }
+ }
+ }
+ // If we're only executing or nothing was selected
+ // we try the catchall dataType if not done already
+ if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) {
+ selection = inspectPrefiltersOrTransports(
+ structure, options, originalOptions, jqXHR, "*", inspected );
+ }
+ // unnecessary when only executing (prefilters)
+ // but it'll be ignored by the caller in that case
+ return selection;
+}
+
+// A special extend for ajax options
+// that takes "flat" options (not to be deep extended)
+// Fixes #9887
+function ajaxExtend( target, src ) {
+ var key, deep,
+ flatOptions = jQuery.ajaxSettings.flatOptions || {};
+ for ( key in src ) {
+ if ( src[ key ] !== undefined ) {
+ ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
+ }
+ }
+ if ( deep ) {
+ jQuery.extend( true, target, deep );
+ }
+}
+
+jQuery.fn.extend({
+ load: function( url, params, callback ) {
+ if ( typeof url !== "string" && _load ) {
+ return _load.apply( this, arguments );
+
+ // Don't do a request if no elements are being requested
+ } else if ( !this.length ) {
+ return this;
+ }
+
+ var off = url.indexOf( " " );
+ if ( off >= 0 ) {
+ var selector = url.slice( off, url.length );
+ url = url.slice( 0, off );
+ }
+
+ // Default to a GET request
+ var type = "GET";
+
+ // If the second parameter was provided
+ if ( params ) {
+ // If it's a function
+ if ( jQuery.isFunction( params ) ) {
+ // We assume that it's the callback
+ callback = params;
+ params = undefined;
+
+ // Otherwise, build a param string
+ } else if ( typeof params === "object" ) {
+ params = jQuery.param( params, jQuery.ajaxSettings.traditional );
+ type = "POST";
+ }
+ }
+
+ var self = this;
+
+ // Request the remote document
+ jQuery.ajax({
+ url: url,
+ type: type,
+ dataType: "html",
+ data: params,
+ // Complete callback (responseText is used internally)
+ complete: function( jqXHR, status, responseText ) {
+ // Store the response as specified by the jqXHR object
+ responseText = jqXHR.responseText;
+ // If successful, inject the HTML into all the matched elements
+ if ( jqXHR.isResolved() ) {
+ // #4825: Get the actual response in case
+ // a dataFilter is present in ajaxSettings
+ jqXHR.done(function( r ) {
+ responseText = r;
+ });
+ // See if a selector was specified
+ self.html( selector ?
+ // Create a dummy div to hold the results
+ jQuery("<div>")
+ // inject the contents of the document in, removing the scripts
+ // to avoid any 'Permission Denied' errors in IE
+ .append(responseText.replace(rscript, ""))
+
+ // Locate the specified elements
+ .find(selector) :
+
+ // If not, just inject the full result
+ responseText );
+ }
+
+ if ( callback ) {
+ self.each( callback, [ responseText, status, jqXHR ] );
+ }
+ }
+ });
+
+ return this;
+ },
+
+ serialize: function() {
+ return jQuery.param( this.serializeArray() );
+ },
+
+ serializeArray: function() {
+ return this.map(function(){
+ return this.elements ? jQuery.makeArray( this.elements ) : this;
+ })
+ .filter(function(){
+ return this.name && !this.disabled &&
+ ( this.checked || rselectTextarea.test( this.nodeName ) ||
+ rinput.test( this.type ) );
+ })
+ .map(function( i, elem ){
+ var val = jQuery( this ).val();
+
+ return val == null ?
+ null :
+ jQuery.isArray( val ) ?
+ jQuery.map( val, function( val, i ){
+ return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
+ }) :
+ { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
+ }).get();
+ }
+});
+
+// Attach a bunch of functions for handling common AJAX events
+jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){
+ jQuery.fn[ o ] = function( f ){
+ return this.on( o, f );
+ };
+});
+
+jQuery.each( [ "get", "post" ], function( i, method ) {
+ jQuery[ method ] = function( url, data, callback, type ) {
+ // shift arguments if data argument was omitted
+ if ( jQuery.isFunction( data ) ) {
+ type = type || callback;
+ callback = data;
+ data = undefined;
+ }
+
+ return jQuery.ajax({
+ type: method,
+ url: url,
+ data: data,
+ success: callback,
+ dataType: type
+ });
+ };
+});
+
+jQuery.extend({
+
+ getScript: function( url, callback ) {
+ return jQuery.get( url, undefined, callback, "script" );
+ },
+
+ getJSON: function( url, data, callback ) {
+ return jQuery.get( url, data, callback, "json" );
+ },
+
+ // Creates a full fledged settings object into target
+ // with both ajaxSettings and settings fields.
+ // If target is omitted, writes into ajaxSettings.
+ ajaxSetup: function( target, settings ) {
+ if ( settings ) {
+ // Building a settings object
+ ajaxExtend( target, jQuery.ajaxSettings );
+ } else {
+ // Extending ajaxSettings
+ settings = target;
+ target = jQuery.ajaxSettings;
+ }
+ ajaxExtend( target, settings );
+ return target;
+ },
+
+ ajaxSettings: {
+ url: ajaxLocation,
+ isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
+ global: true,
+ type: "GET",
+ contentType: "application/x-www-form-urlencoded; charset=UTF-8",
+ processData: true,
+ async: true,
+ /*
+ timeout: 0,
+ data: null,
+ dataType: null,
+ username: null,
+ password: null,
+ cache: null,
+ traditional: false,
+ headers: {},
+ */
+
+ accepts: {
+ xml: "application/xml, text/xml",
+ html: "text/html",
+ text: "text/plain",
+ json: "application/json, text/javascript",
+ "*": allTypes
+ },
+
+ contents: {
+ xml: /xml/,
+ html: /html/,
+ json: /json/
+ },
+
+ responseFields: {
+ xml: "responseXML",
+ text: "responseText"
+ },
+
+ // List of data converters
+ // 1) key format is "source_type destination_type" (a single space in-between)
+ // 2) the catchall symbol "*" can be used for source_type
+ converters: {
+
+ // Convert anything to text
+ "* text": window.String,
+
+ // Text to html (true = no transformation)
+ "text html": true,
+
+ // Evaluate text as a json expression
+ "text json": jQuery.parseJSON,
+
+ // Parse text as xml
+ "text xml": jQuery.parseXML
+ },
+
+ // For options that shouldn't be deep extended:
+ // you can add your own custom options here if
+ // and when you create one that shouldn't be
+ // deep extended (see ajaxExtend)
+ flatOptions: {
+ context: true,
+ url: true
+ }
+ },
+
+ ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
+ ajaxTransport: addToPrefiltersOrTransports( transports ),
+
+ // Main method
+ ajax: function( url, options ) {
+
+ // If url is an object, simulate pre-1.5 signature
+ if ( typeof url === "object" ) {
+ options = url;
+ url = undefined;
+ }
+
+ // Force options to be an object
+ options = options || {};
+
+ var // Create the final options object
+ s = jQuery.ajaxSetup( {}, options ),
+ // Callbacks context
+ callbackContext = s.context || s,
+ // Context for global events
+ // It's the callbackContext if one was provided in the options
+ // and if it's a DOM node or a jQuery collection
+ globalEventContext = callbackContext !== s &&
+ ( callbackContext.nodeType || callbackContext instanceof jQuery ) ?
+ jQuery( callbackContext ) : jQuery.event,
+ // Deferreds
+ deferred = jQuery.Deferred(),
+ completeDeferred = jQuery.Callbacks( "once memory" ),
+ // Status-dependent callbacks
+ statusCode = s.statusCode || {},
+ // ifModified key
+ ifModifiedKey,
+ // Headers (they are sent all at once)
+ requestHeaders = {},
+ requestHeadersNames = {},
+ // Response headers
+ responseHeadersString,
+ responseHeaders,
+ // transport
+ transport,
+ // timeout handle
+ timeoutTimer,
+ // Cross-domain detection vars
+ parts,
+ // The jqXHR state
+ state = 0,
+ // To know if global events are to be dispatched
+ fireGlobals,
+ // Loop variable
+ i,
+ // Fake xhr
+ jqXHR = {
+
+ readyState: 0,
+
+ // Caches the header
+ setRequestHeader: function( name, value ) {
+ if ( !state ) {
+ var lname = name.toLowerCase();
+ name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
+ requestHeaders[ name ] = value;
+ }
+ return this;
+ },
+
+ // Raw string
+ getAllResponseHeaders: function() {
+ return state === 2 ? responseHeadersString : null;
+ },
+
+ // Builds headers hashtable if needed
+ getResponseHeader: function( key ) {
+ var match;
+ if ( state === 2 ) {
+ if ( !responseHeaders ) {
+ responseHeaders = {};
+ while( ( match = rheaders.exec( responseHeadersString ) ) ) {
+ responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
+ }
+ }
+ match = responseHeaders[ key.toLowerCase() ];
+ }
+ return match === undefined ? null : match;
+ },
+
+ // Overrides response content-type header
+ overrideMimeType: function( type ) {
+ if ( !state ) {
+ s.mimeType = type;
+ }
+ return this;
+ },
+
+ // Cancel the request
+ abort: function( statusText ) {
+ statusText = statusText || "abort";
+ if ( transport ) {
+ transport.abort( statusText );
+ }
+ done( 0, statusText );
+ return this;
+ }
+ };
+
+ // Callback for when everything is done
+ // It is defined here because jslint complains if it is declared
+ // at the end of the function (which would be more logical and readable)
+ function done( status, nativeStatusText, responses, headers ) {
+
+ // Called once
+ if ( state === 2 ) {
+ return;
+ }
+
+ // State is "done" now
+ state = 2;
+
+ // Clear timeout if it exists
+ if ( timeoutTimer ) {
+ clearTimeout( timeoutTimer );
+ }
+
+ // Dereference transport for early garbage collection
+ // (no matter how long the jqXHR object will be used)
+ transport = undefined;
+
+ // Cache response headers
+ responseHeadersString = headers || "";
+
+ // Set readyState
+ jqXHR.readyState = status > 0 ? 4 : 0;
+
+ var isSuccess,
+ success,
+ error,
+ statusText = nativeStatusText,
+ response = responses ? ajaxHandleResponses( s, jqXHR, responses ) : undefined,
+ lastModified,
+ etag;
+
+ // If successful, handle type chaining
+ if ( status >= 200 && status < 300 || status === 304 ) {
+
+ // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
+ if ( s.ifModified ) {
+
+ if ( ( lastModified = jqXHR.getResponseHeader( "Last-Modified" ) ) ) {
+ jQuery.lastModified[ ifModifiedKey ] = lastModified;
+ }
+ if ( ( etag = jqXHR.getResponseHeader( "Etag" ) ) ) {
+ jQuery.etag[ ifModifiedKey ] = etag;
+ }
+ }
+
+ // If not modified
+ if ( status === 304 ) {
+
+ statusText = "notmodified";
+ isSuccess = true;
+
+ // If we have data
+ } else {
+
+ try {
+ success = ajaxConvert( s, response );
+ statusText = "success";
+ isSuccess = true;
+ } catch(e) {
+ // We have a parsererror
+ statusText = "parsererror";
+ error = e;
+ }
+ }
+ } else {
+ // We extract error from statusText
+ // then normalize statusText and status for non-aborts
+ error = statusText;
+ if ( !statusText || status ) {
+ statusText = "error";
+ if ( status < 0 ) {
+ status = 0;
+ }
+ }
+ }
+
+ // Set data for the fake xhr object
+ jqXHR.status = status;
+ jqXHR.statusText = "" + ( nativeStatusText || statusText );
+
+ // Success/Error
+ if ( isSuccess ) {
+ deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
+ } else {
+ deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
+ }
+
+ // Status-dependent callbacks
+ jqXHR.statusCode( statusCode );
+ statusCode = undefined;
+
+ if ( fireGlobals ) {
+ globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ),
+ [ jqXHR, s, isSuccess ? success : error ] );
+ }
+
+ // Complete
+ completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
+
+ if ( fireGlobals ) {
+ globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
+ // Handle the global AJAX counter
+ if ( !( --jQuery.active ) ) {
+ jQuery.event.trigger( "ajaxStop" );
+ }
+ }
+ }
+
+ // Attach deferreds
+ deferred.promise( jqXHR );
+ jqXHR.success = jqXHR.done;
+ jqXHR.error = jqXHR.fail;
+ jqXHR.complete = completeDeferred.add;
+
+ // Status-dependent callbacks
+ jqXHR.statusCode = function( map ) {
+ if ( map ) {
+ var tmp;
+ if ( state < 2 ) {
+ for ( tmp in map ) {
+ statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ];
+ }
+ } else {
+ tmp = map[ jqXHR.status ];
+ jqXHR.then( tmp, tmp );
+ }
+ }
+ return this;
+ };
+
+ // Remove hash character (#7531: and string promotion)
+ // Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
+ // We also use the url parameter if available
+ s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
+
+ // Extract dataTypes list
+ s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( rspacesAjax );
+
+ // Determine if a cross-domain request is in order
+ if ( s.crossDomain == null ) {
+ parts = rurl.exec( s.url.toLowerCase() );
+ s.crossDomain = !!( parts &&
+ ( parts[ 1 ] != ajaxLocParts[ 1 ] || parts[ 2 ] != ajaxLocParts[ 2 ] ||
+ ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=
+ ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) )
+ );
+ }
+
+ // Convert data if not already a string
+ if ( s.data && s.processData && typeof s.data !== "string" ) {
+ s.data = jQuery.param( s.data, s.traditional );
+ }
+
+ // Apply prefilters
+ inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
+
+ // If request was aborted inside a prefilter, stop there
+ if ( state === 2 ) {
+ return false;
+ }
+
+ // We can fire global events as of now if asked to
+ fireGlobals = s.global;
+
+ // Uppercase the type
+ s.type = s.type.toUpperCase();
+
+ // Determine if request has content
+ s.hasContent = !rnoContent.test( s.type );
+
+ // Watch for a new set of requests
+ if ( fireGlobals && jQuery.active++ === 0 ) {
+ jQuery.event.trigger( "ajaxStart" );
+ }
+
+ // More options handling for requests with no content
+ if ( !s.hasContent ) {
+
+ // If data is available, append data to url
+ if ( s.data ) {
+ s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data;
+ // #9682: remove data so that it's not used in an eventual retry
+ delete s.data;
+ }
+
+ // Get ifModifiedKey before adding the anti-cache parameter
+ ifModifiedKey = s.url;
+
+ // Add anti-cache in url if needed
+ if ( s.cache === false ) {
+
+ var ts = jQuery.now(),
+ // try replacing _= if it is there
+ ret = s.url.replace( rts, "$1_=" + ts );
+
+ // if nothing was replaced, add timestamp to the end
+ s.url = ret + ( ( ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" );
+ }
+ }
+
+ // Set the correct header, if data is being sent
+ if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
+ jqXHR.setRequestHeader( "Content-Type", s.contentType );
+ }
+
+ // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
+ if ( s.ifModified ) {
+ ifModifiedKey = ifModifiedKey || s.url;
+ if ( jQuery.lastModified[ ifModifiedKey ] ) {
+ jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ ifModifiedKey ] );
+ }
+ if ( jQuery.etag[ ifModifiedKey ] ) {
+ jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ ifModifiedKey ] );
+ }
+ }
+
+ // Set the Accepts header for the server, depending on the dataType
+ jqXHR.setRequestHeader(
+ "Accept",
+ s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
+ s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
+ s.accepts[ "*" ]
+ );
+
+ // Check for headers option
+ for ( i in s.headers ) {
+ jqXHR.setRequestHeader( i, s.headers[ i ] );
+ }
+
+ // Allow custom headers/mimetypes and early abort
+ if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
+ // Abort if not done already
+ jqXHR.abort();
+ return false;
+
+ }
+
+ // Install callbacks on deferreds
+ for ( i in { success: 1, error: 1, complete: 1 } ) {
+ jqXHR[ i ]( s[ i ] );
+ }
+
+ // Get transport
+ transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
+
+ // If no transport, we auto-abort
+ if ( !transport ) {
+ done( -1, "No Transport" );
+ } else {
+ jqXHR.readyState = 1;
+ // Send global event
+ if ( fireGlobals ) {
+ globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
+ }
+ // Timeout
+ if ( s.async && s.timeout > 0 ) {
+ timeoutTimer = setTimeout( function(){
+ jqXHR.abort( "timeout" );
+ }, s.timeout );
+ }
+
+ try {
+ state = 1;
+ transport.send( requestHeaders, done );
+ } catch (e) {
+ // Propagate exception as error if not done
+ if ( state < 2 ) {
+ done( -1, e );
+ // Simply rethrow otherwise
+ } else {
+ throw e;
+ }
+ }
+ }
+
+ return jqXHR;
+ },
+
+ // Serialize an array of form elements or a set of
+ // key/values into a query string
+ param: function( a, traditional ) {
+ var s = [],
+ add = function( key, value ) {
+ // If value is a function, invoke it and return its value
+ value = jQuery.isFunction( value ) ? value() : value;
+ s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
+ };
+
+ // Set traditional to true for jQuery <= 1.3.2 behavior.
+ if ( traditional === undefined ) {
+ traditional = jQuery.ajaxSettings.traditional;
+ }
+
+ // If an array was passed in, assume that it is an array of form elements.
+ if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
+ // Serialize the form elements
+ jQuery.each( a, function() {
+ add( this.name, this.value );
+ });
+
+ } else {
+ // If traditional, encode the "old" way (the way 1.3.2 or older
+ // did it), otherwise encode params recursively.
+ for ( var prefix in a ) {
+ buildParams( prefix, a[ prefix ], traditional, add );
+ }
+ }
+
+ // Return the resulting serialization
+ return s.join( "&" ).replace( r20, "+" );
+ }
+});
+
+function buildParams( prefix, obj, traditional, add ) {
+ if ( jQuery.isArray( obj ) ) {
+ // Serialize array item.
+ jQuery.each( obj, function( i, v ) {
+ if ( traditional || rbracket.test( prefix ) ) {
+ // Treat each array item as a scalar.
+ add( prefix, v );
+
+ } else {
+ // If array item is non-scalar (array or object), encode its
+ // numeric index to resolve deserialization ambiguity issues.
+ // Note that rack (as of 1.0.0) can't currently deserialize
+ // nested arrays properly, and attempting to do so may cause
+ // a server error. Possible fixes are to modify rack's
+ // deserialization algorithm or to provide an option or flag
+ // to force array serialization to be shallow.
+ buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
+ }
+ });
+
+ } else if ( !traditional && jQuery.type( obj ) === "object" ) {
+ // Serialize object item.
+ for ( var name in obj ) {
+ buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
+ }
+
+ } else {
+ // Serialize scalar item.
+ add( prefix, obj );
+ }
+}
+
+// This is still on the jQuery object... for now
+// Want to move this to jQuery.ajax some day
+jQuery.extend({
+
+ // Counter for holding the number of active queries
+ active: 0,
+
+ // Last-Modified header cache for next request
+ lastModified: {},
+ etag: {}
+
+});
+
+/* Handles responses to an ajax request:
+ * - sets all responseXXX fields accordingly
+ * - finds the right dataType (mediates between content-type and expected dataType)
+ * - returns the corresponding response
+ */
+function ajaxHandleResponses( s, jqXHR, responses ) {
+
+ var contents = s.contents,
+ dataTypes = s.dataTypes,
+ responseFields = s.responseFields,
+ ct,
+ type,
+ finalDataType,
+ firstDataType;
+
+ // Fill responseXXX fields
+ for ( type in responseFields ) {
+ if ( type in responses ) {
+ jqXHR[ responseFields[type] ] = responses[ type ];
+ }
+ }
+
+ // Remove auto dataType and get content-type in the process
+ while( dataTypes[ 0 ] === "*" ) {
+ dataTypes.shift();
+ if ( ct === undefined ) {
+ ct = s.mimeType || jqXHR.getResponseHeader( "content-type" );
+ }
+ }
+
+ // Check if we're dealing with a known content-type
+ if ( ct ) {
+ for ( type in contents ) {
+ if ( contents[ type ] && contents[ type ].test( ct ) ) {
+ dataTypes.unshift( type );
+ break;
+ }
+ }
+ }
+
+ // Check to see if we have a response for the expected dataType
+ if ( dataTypes[ 0 ] in responses ) {
+ finalDataType = dataTypes[ 0 ];
+ } else {
+ // Try convertible dataTypes
+ for ( type in responses ) {
+ if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
+ finalDataType = type;
+ break;
+ }
+ if ( !firstDataType ) {
+ firstDataType = type;
+ }
+ }
+ // Or just use first one
+ finalDataType = finalDataType || firstDataType;
+ }
+
+ // If we found a dataType
+ // We add the dataType to the list if needed
+ // and return the corresponding response
+ if ( finalDataType ) {
+ if ( finalDataType !== dataTypes[ 0 ] ) {
+ dataTypes.unshift( finalDataType );
+ }
+ return responses[ finalDataType ];
+ }
+}
+
+// Chain conversions given the request and the original response
+function ajaxConvert( s, response ) {
+
+ // Apply the dataFilter if provided
+ if ( s.dataFilter ) {
+ response = s.dataFilter( response, s.dataType );
+ }
+
+ var dataTypes = s.dataTypes,
+ converters = {},
+ i,
+ key,
+ length = dataTypes.length,
+ tmp,
+ // Current and previous dataTypes
+ current = dataTypes[ 0 ],
+ prev,
+ // Conversion expression
+ conversion,
+ // Conversion function
+ conv,
+ // Conversion functions (transitive conversion)
+ conv1,
+ conv2;
+
+ // For each dataType in the chain
+ for ( i = 1; i < length; i++ ) {
+
+ // Create converters map
+ // with lowercased keys
+ if ( i === 1 ) {
+ for ( key in s.converters ) {
+ if ( typeof key === "string" ) {
+ converters[ key.toLowerCase() ] = s.converters[ key ];
+ }
+ }
+ }
+
+ // Get the dataTypes
+ prev = current;
+ current = dataTypes[ i ];
+
+ // If current is auto dataType, update it to prev
+ if ( current === "*" ) {
+ current = prev;
+ // If no auto and dataTypes are actually different
+ } else if ( prev !== "*" && prev !== current ) {
+
+ // Get the converter
+ conversion = prev + " " + current;
+ conv = converters[ conversion ] || converters[ "* " + current ];
+
+ // If there is no direct converter, search transitively
+ if ( !conv ) {
+ conv2 = undefined;
+ for ( conv1 in converters ) {
+ tmp = conv1.split( " " );
+ if ( tmp[ 0 ] === prev || tmp[ 0 ] === "*" ) {
+ conv2 = converters[ tmp[1] + " " + current ];
+ if ( conv2 ) {
+ conv1 = converters[ conv1 ];
+ if ( conv1 === true ) {
+ conv = conv2;
+ } else if ( conv2 === true ) {
+ conv = conv1;
+ }
+ break;
+ }
+ }
+ }
+ }
+ // If we found no converter, dispatch an error
+ if ( !( conv || conv2 ) ) {
+ jQuery.error( "No conversion from " + conversion.replace(" "," to ") );
+ }
+ // If found converter is not an equivalence
+ if ( conv !== true ) {
+ // Convert with 1 or 2 converters accordingly
+ response = conv ? conv( response ) : conv2( conv1(response) );
+ }
+ }
+ }
+ return response;
+}
+
+
+
+
+var jsc = jQuery.now(),
+ jsre = /(\=)\?(&|$)|\?\?/i;
+
+// Default jsonp settings
+jQuery.ajaxSetup({
+ jsonp: "callback",
+ jsonpCallback: function() {
+ return jQuery.expando + "_" + ( jsc++ );
+ }
+});
+
+// Detect, normalize options and install callbacks for jsonp requests
+jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
+
+ var inspectData = ( typeof s.data === "string" ) && /^application\/x\-www\-form\-urlencoded/.test( s.contentType );
+
+ if ( s.dataTypes[ 0 ] === "jsonp" ||
+ s.jsonp !== false && ( jsre.test( s.url ) ||
+ inspectData && jsre.test( s.data ) ) ) {
+
+ var responseContainer,
+ jsonpCallback = s.jsonpCallback =
+ jQuery.isFunction( s.jsonpCallback ) ? s.jsonpCallback() : s.jsonpCallback,
+ previous = window[ jsonpCallback ],
+ url = s.url,
+ data = s.data,
+ replace = "$1" + jsonpCallback + "$2";
+
+ if ( s.jsonp !== false ) {
+ url = url.replace( jsre, replace );
+ if ( s.url === url ) {
+ if ( inspectData ) {
+ data = data.replace( jsre, replace );
+ }
+ if ( s.data === data ) {
+ // Add callback manually
+ url += (/\?/.test( url ) ? "&" : "?") + s.jsonp + "=" + jsonpCallback;
+ }
+ }
+ }
+
+ s.url = url;
+ s.data = data;
+
+ // Install callback
+ window[ jsonpCallback ] = function( response ) {
+ responseContainer = [ response ];
+ };
+
+ // Clean-up function
+ jqXHR.always(function() {
+ // Set callback back to previous value
+ window[ jsonpCallback ] = previous;
+ // Call if it was a function and we have a response
+ if ( responseContainer && jQuery.isFunction( previous ) ) {
+ window[ jsonpCallback ]( responseContainer[ 0 ] );
+ }
+ });
+
+ // Use data converter to retrieve json after script execution
+ s.converters["script json"] = function() {
+ if ( !responseContainer ) {
+ jQuery.error( jsonpCallback + " was not called" );
+ }
+ return responseContainer[ 0 ];
+ };
+
+ // force json dataType
+ s.dataTypes[ 0 ] = "json";
+
+ // Delegate to script
+ return "script";
+ }
+});
+
+
+
+
+// Install script dataType
+jQuery.ajaxSetup({
+ accepts: {
+ script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
+ },
+ contents: {
+ script: /javascript|ecmascript/
+ },
+ converters: {
+ "text script": function( text ) {
+ jQuery.globalEval( text );
+ return text;
+ }
+ }
+});
+
+// Handle cache's special case and global
+jQuery.ajaxPrefilter( "script", function( s ) {
+ if ( s.cache === undefined ) {
+ s.cache = false;
+ }
+ if ( s.crossDomain ) {
+ s.type = "GET";
+ s.global = false;
+ }
+});
+
+// Bind script tag hack transport
+jQuery.ajaxTransport( "script", function(s) {
+
+ // This transport only deals with cross domain requests
+ if ( s.crossDomain ) {
+
+ var script,
+ head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement;
+
+ return {
+
+ send: function( _, callback ) {
+
+ script = document.createElement( "script" );
+
+ script.async = "async";
+
+ if ( s.scriptCharset ) {
+ script.charset = s.scriptCharset;
+ }
+
+ script.src = s.url;
+
+ // Attach handlers for all browsers
+ script.onload = script.onreadystatechange = function( _, isAbort ) {
+
+ if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
+
+ // Handle memory leak in IE
+ script.onload = script.onreadystatechange = null;
+
+ // Remove the script
+ if ( head && script.parentNode ) {
+ head.removeChild( script );
+ }
+
+ // Dereference the script
+ script = undefined;
+
+ // Callback if not abort
+ if ( !isAbort ) {
+ callback( 200, "success" );
+ }
+ }
+ };
+ // Use insertBefore instead of appendChild to circumvent an IE6 bug.
+ // This arises when a base node is used (#2709 and #4378).
+ head.insertBefore( script, head.firstChild );
+ },
+
+ abort: function() {
+ if ( script ) {
+ script.onload( 0, 1 );
+ }
+ }
+ };
+ }
+});
+
+
+
+
+var // #5280: Internet Explorer will keep connections alive if we don't abort on unload
+ xhrOnUnloadAbort = window.ActiveXObject ? function() {
+ // Abort all pending requests
+ for ( var key in xhrCallbacks ) {
+ xhrCallbacks[ key ]( 0, 1 );
+ }
+ } : false,
+ xhrId = 0,
+ xhrCallbacks;
+
+// Functions to create xhrs
+function createStandardXHR() {
+ try {
+ return new window.XMLHttpRequest();
+ } catch( e ) {}
+}
+
+function createActiveXHR() {
+ try {
+ return new window.ActiveXObject( "Microsoft.XMLHTTP" );
+ } catch( e ) {}
+}
+
+// Create the request object
+// (This is still attached to ajaxSettings for backward compatibility)
+jQuery.ajaxSettings.xhr = window.ActiveXObject ?
+ /* Microsoft failed to properly
+ * implement the XMLHttpRequest in IE7 (can't request local files),
+ * so we use the ActiveXObject when it is available
+ * Additionally XMLHttpRequest can be disabled in IE7/IE8 so
+ * we need a fallback.
+ */
+ function() {
+ return !this.isLocal && createStandardXHR() || createActiveXHR();
+ } :
+ // For all other browsers, use the standard XMLHttpRequest object
+ createStandardXHR;
+
+// Determine support properties
+(function( xhr ) {
+ jQuery.extend( jQuery.support, {
+ ajax: !!xhr,
+ cors: !!xhr && ( "withCredentials" in xhr )
+ });
+})( jQuery.ajaxSettings.xhr() );
+
+// Create transport if the browser can provide an xhr
+if ( jQuery.support.ajax ) {
+
+ jQuery.ajaxTransport(function( s ) {
+ // Cross domain only allowed if supported through XMLHttpRequest
+ if ( !s.crossDomain || jQuery.support.cors ) {
+
+ var callback;
+
+ return {
+ send: function( headers, complete ) {
+
+ // Get a new xhr
+ var xhr = s.xhr(),
+ handle,
+ i;
+
+ // Open the socket
+ // Passing null username, generates a login popup on Opera (#2865)
+ if ( s.username ) {
+ xhr.open( s.type, s.url, s.async, s.username, s.password );
+ } else {
+ xhr.open( s.type, s.url, s.async );
+ }
+
+ // Apply custom fields if provided
+ if ( s.xhrFields ) {
+ for ( i in s.xhrFields ) {
+ xhr[ i ] = s.xhrFields[ i ];
+ }
+ }
+
+ // Override mime type if needed
+ if ( s.mimeType && xhr.overrideMimeType ) {
+ xhr.overrideMimeType( s.mimeType );
+ }
+
+ // X-Requested-With header
+ // For cross-domain requests, seeing as conditions for a preflight are
+ // akin to a jigsaw puzzle, we simply never set it to be sure.
+ // (it can always be set on a per-request basis or even using ajaxSetup)
+ // For same-domain requests, won't change header if already provided.
+ if ( !s.crossDomain && !headers["X-Requested-With"] ) {
+ headers[ "X-Requested-With" ] = "XMLHttpRequest";
+ }
+
+ // Need an extra try/catch for cross domain requests in Firefox 3
+ try {
+ for ( i in headers ) {
+ xhr.setRequestHeader( i, headers[ i ] );
+ }
+ } catch( _ ) {}
+
+ // Do send the request
+ // This may raise an exception which is actually
+ // handled in jQuery.ajax (so no try/catch here)
+ xhr.send( ( s.hasContent && s.data ) || null );
+
+ // Listener
+ callback = function( _, isAbort ) {
+
+ var status,
+ statusText,
+ responseHeaders,
+ responses,
+ xml;
+
+ // Firefox throws exceptions when accessing properties
+ // of an xhr when a network error occured
+ // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)
+ try {
+
+ // Was never called and is aborted or complete
+ if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
+
+ // Only called once
+ callback = undefined;
+
+ // Do not keep as active anymore
+ if ( handle ) {
+ xhr.onreadystatechange = jQuery.noop;
+ if ( xhrOnUnloadAbort ) {
+ delete xhrCallbacks[ handle ];
+ }
+ }
+
+ // If it's an abort
+ if ( isAbort ) {
+ // Abort it manually if needed
+ if ( xhr.readyState !== 4 ) {
+ xhr.abort();
+ }
+ } else {
+ status = xhr.status;
+ responseHeaders = xhr.getAllResponseHeaders();
+ responses = {};
+ xml = xhr.responseXML;
+
+ // Construct response list
+ if ( xml && xml.documentElement /* #4958 */ ) {
+ responses.xml = xml;
+ }
+
+ // When requesting binary data, IE6-9 will throw an exception
+ // on any attempt to access responseText (#11426)
+ try {
+ responses.text = xhr.responseText;
+ } catch( _ ) {
+ }
+
+ // Firefox throws an exception when accessing
+ // statusText for faulty cross-domain requests
+ try {
+ statusText = xhr.statusText;
+ } catch( e ) {
+ // We normalize with Webkit giving an empty statusText
+ statusText = "";
+ }
+
+ // Filter status for non standard behaviors
+
+ // If the request is local and we have data: assume a success
+ // (success with no data won't get notified, that's the best we
+ // can do given current implementations)
+ if ( !status && s.isLocal && !s.crossDomain ) {
+ status = responses.text ? 200 : 404;
+ // IE - #1450: sometimes returns 1223 when it should be 204
+ } else if ( status === 1223 ) {
+ status = 204;
+ }
+ }
+ }
+ } catch( firefoxAccessException ) {
+ if ( !isAbort ) {
+ complete( -1, firefoxAccessException );
+ }
+ }
+
+ // Call complete if needed
+ if ( responses ) {
+ complete( status, statusText, responses, responseHeaders );
+ }
+ };
+
+ // if we're in sync mode or it's in cache
+ // and has been retrieved directly (IE6 & IE7)
+ // we need to manually fire the callback
+ if ( !s.async || xhr.readyState === 4 ) {
+ callback();
+ } else {
+ handle = ++xhrId;
+ if ( xhrOnUnloadAbort ) {
+ // Create the active xhrs callbacks list if needed
+ // and attach the unload handler
+ if ( !xhrCallbacks ) {
+ xhrCallbacks = {};
+ jQuery( window ).unload( xhrOnUnloadAbort );
+ }
+ // Add to list of active xhrs callbacks
+ xhrCallbacks[ handle ] = callback;
+ }
+ xhr.onreadystatechange = callback;
+ }
+ },
+
+ abort: function() {
+ if ( callback ) {
+ callback(0,1);
+ }
+ }
+ };
+ }
+ });
+}
+
+
+
+
+var elemdisplay = {},
+ iframe, iframeDoc,
+ rfxtypes = /^(?:toggle|show|hide)$/,
+ rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,
+ timerId,
+ fxAttrs = [
+ // height animations
+ [ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ],
+ // width animations
+ [ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],
+ // opacity animations
+ [ "opacity" ]
+ ],
+ fxNow;
+
+jQuery.fn.extend({
+ show: function( speed, easing, callback ) {
+ var elem, display;
+
+ if ( speed || speed === 0 ) {
+ return this.animate( genFx("show", 3), speed, easing, callback );
+
+ } else {
+ for ( var i = 0, j = this.length; i < j; i++ ) {
+ elem = this[ i ];
+
+ if ( elem.style ) {
+ display = elem.style.display;
+
+ // Reset the inline display of this element to learn if it is
+ // being hidden by cascaded rules or not
+ if ( !jQuery._data(elem, "olddisplay") && display === "none" ) {
+ display = elem.style.display = "";
+ }
+
+ // Set elements which have been overridden with display: none
+ // in a stylesheet to whatever the default browser style is
+ // for such an element
+ if ( (display === "" && jQuery.css(elem, "display") === "none") ||
+ !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
+ jQuery._data( elem, "olddisplay", defaultDisplay(elem.nodeName) );
+ }
+ }
+ }
+
+ // Set the display of most of the elements in a second loop
+ // to avoid the constant reflow
+ for ( i = 0; i < j; i++ ) {
+ elem = this[ i ];
+
+ if ( elem.style ) {
+ display = elem.style.display;
+
+ if ( display === "" || display === "none" ) {
+ elem.style.display = jQuery._data( elem, "olddisplay" ) || "";
+ }
+ }
+ }
+
+ return this;
+ }
+ },
+
+ hide: function( speed, easing, callback ) {
+ if ( speed || speed === 0 ) {
+ return this.animate( genFx("hide", 3), speed, easing, callback);
+
+ } else {
+ var elem, display,
+ i = 0,
+ j = this.length;
+
+ for ( ; i < j; i++ ) {
+ elem = this[i];
+ if ( elem.style ) {
+ display = jQuery.css( elem, "display" );
+
+ if ( display !== "none" && !jQuery._data( elem, "olddisplay" ) ) {
+ jQuery._data( elem, "olddisplay", display );
+ }
+ }
+ }
+
+ // Set the display of the elements in a second loop
+ // to avoid the constant reflow
+ for ( i = 0; i < j; i++ ) {
+ if ( this[i].style ) {
+ this[i].style.display = "none";
+ }
+ }
+
+ return this;
+ }
+ },
+
+ // Save the old toggle function
+ _toggle: jQuery.fn.toggle,
+
+ toggle: function( fn, fn2, callback ) {
+ var bool = typeof fn === "boolean";
+
+ if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) {
+ this._toggle.apply( this, arguments );
+
+ } else if ( fn == null || bool ) {
+ this.each(function() {
+ var state = bool ? fn : jQuery(this).is(":hidden");
+ jQuery(this)[ state ? "show" : "hide" ]();
+ });
+
+ } else {
+ this.animate(genFx("toggle", 3), fn, fn2, callback);
+ }
+
+ return this;
+ },
+
+ fadeTo: function( speed, to, easing, callback ) {
+ return this.filter(":hidden").css("opacity", 0).show().end()
+ .animate({opacity: to}, speed, easing, callback);
+ },
+
+ animate: function( prop, speed, easing, callback ) {
+ var optall = jQuery.speed( speed, easing, callback );
+
+ if ( jQuery.isEmptyObject( prop ) ) {
+ return this.each( optall.complete, [ false ] );
+ }
+
+ // Do not change referenced properties as per-property easing will be lost
+ prop = jQuery.extend( {}, prop );
+
+ function doAnimation() {
+ // XXX 'this' does not always have a nodeName when running the
+ // test suite
+
+ if ( optall.queue === false ) {
+ jQuery._mark( this );
+ }
+
+ var opt = jQuery.extend( {}, optall ),
+ isElement = this.nodeType === 1,
+ hidden = isElement && jQuery(this).is(":hidden"),
+ name, val, p, e, hooks, replace,
+ parts, start, end, unit,
+ method;
+
+ // will store per property easing and be used to determine when an animation is complete
+ opt.animatedProperties = {};
+
+ // first pass over propertys to expand / normalize
+ for ( p in prop ) {
+ name = jQuery.camelCase( p );
+ if ( p !== name ) {
+ prop[ name ] = prop[ p ];
+ delete prop[ p ];
+ }
+
+ if ( ( hooks = jQuery.cssHooks[ name ] ) && "expand" in hooks ) {
+ replace = hooks.expand( prop[ name ] );
+ delete prop[ name ];
+
+ // not quite $.extend, this wont overwrite keys already present.
+ // also - reusing 'p' from above because we have the correct "name"
+ for ( p in replace ) {
+ if ( ! ( p in prop ) ) {
+ prop[ p ] = replace[ p ];
+ }
+ }
+ }
+ }
+
+ for ( name in prop ) {
+ val = prop[ name ];
+ // easing resolution: per property > opt.specialEasing > opt.easing > 'swing' (default)
+ if ( jQuery.isArray( val ) ) {
+ opt.animatedProperties[ name ] = val[ 1 ];
+ val = prop[ name ] = val[ 0 ];
+ } else {
+ opt.animatedProperties[ name ] = opt.specialEasing && opt.specialEasing[ name ] || opt.easing || 'swing';
+ }
+
+ if ( val === "hide" && hidden || val === "show" && !hidden ) {
+ return opt.complete.call( this );
+ }
+
+ if ( isElement && ( name === "height" || name === "width" ) ) {
+ // Make sure that nothing sneaks out
+ // Record all 3 overflow attributes because IE does not
+ // change the overflow attribute when overflowX and
+ // overflowY are set to the same value
+ opt.overflow = [ this.style.overflow, this.style.overflowX, this.style.overflowY ];
+
+ // Set display property to inline-block for height/width
+ // animations on inline elements that are having width/height animated
+ if ( jQuery.css( this, "display" ) === "inline" &&
+ jQuery.css( this, "float" ) === "none" ) {
+
+ // inline-level elements accept inline-block;
+ // block-level elements need to be inline with layout
+ if ( !jQuery.support.inlineBlockNeedsLayout || defaultDisplay( this.nodeName ) === "inline" ) {
+ this.style.display = "inline-block";
+
+ } else {
+ this.style.zoom = 1;
+ }
+ }
+ }
+ }
+
+ if ( opt.overflow != null ) {
+ this.style.overflow = "hidden";
+ }
+
+ for ( p in prop ) {
+ e = new jQuery.fx( this, opt, p );
+ val = prop[ p ];
+
+ if ( rfxtypes.test( val ) ) {
+
+ // Tracks whether to show or hide based on private
+ // data attached to the element
+ method = jQuery._data( this, "toggle" + p ) || ( val === "toggle" ? hidden ? "show" : "hide" : 0 );
+ if ( method ) {
+ jQuery._data( this, "toggle" + p, method === "show" ? "hide" : "show" );
+ e[ method ]();
+ } else {
+ e[ val ]();
+ }
+
+ } else {
+ parts = rfxnum.exec( val );
+ start = e.cur();
+
+ if ( parts ) {
+ end = parseFloat( parts[2] );
+ unit = parts[3] || ( jQuery.cssNumber[ p ] ? "" : "px" );
+
+ // We need to compute starting value
+ if ( unit !== "px" ) {
+ jQuery.style( this, p, (end || 1) + unit);
+ start = ( (end || 1) / e.cur() ) * start;
+ jQuery.style( this, p, start + unit);
+ }
+
+ // If a +=/-= token was provided, we're doing a relative animation
+ if ( parts[1] ) {
+ end = ( (parts[ 1 ] === "-=" ? -1 : 1) * end ) + start;
+ }
+
+ e.custom( start, end, unit );
+
+ } else {
+ e.custom( start, val, "" );
+ }
+ }
+ }
+
+ // For JS strict compliance
+ return true;
+ }
+
+ return optall.queue === false ?
+ this.each( doAnimation ) :
+ this.queue( optall.queue, doAnimation );
+ },
+
+ stop: function( type, clearQueue, gotoEnd ) {
+ if ( typeof type !== "string" ) {
+ gotoEnd = clearQueue;
+ clearQueue = type;
+ type = undefined;
+ }
+ if ( clearQueue && type !== false ) {
+ this.queue( type || "fx", [] );
+ }
+
+ return this.each(function() {
+ var index,
+ hadTimers = false,
+ timers = jQuery.timers,
+ data = jQuery._data( this );
+
+ // clear marker counters if we know they won't be
+ if ( !gotoEnd ) {
+ jQuery._unmark( true, this );
+ }
+
+ function stopQueue( elem, data, index ) {
+ var hooks = data[ index ];
+ jQuery.removeData( elem, index, true );
+ hooks.stop( gotoEnd );
+ }
+
+ if ( type == null ) {
+ for ( index in data ) {
+ if ( data[ index ] && data[ index ].stop && index.indexOf(".run") === index.length - 4 ) {
+ stopQueue( this, data, index );
+ }
+ }
+ } else if ( data[ index = type + ".run" ] && data[ index ].stop ){
+ stopQueue( this, data, index );
+ }
+
+ for ( index = timers.length; index--; ) {
+ if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
+ if ( gotoEnd ) {
+
+ // force the next step to be the last
+ timers[ index ]( true );
+ } else {
+ timers[ index ].saveState();
+ }
+ hadTimers = true;
+ timers.splice( index, 1 );
+ }
+ }
+
+ // start the next in the queue if the last step wasn't forced
+ // timers currently will call their complete callbacks, which will dequeue
+ // but only if they were gotoEnd
+ if ( !( gotoEnd && hadTimers ) ) {
+ jQuery.dequeue( this, type );
+ }
+ });
+ }
+
+});
+
+// Animations created synchronously will run synchronously
+function createFxNow() {
+ setTimeout( clearFxNow, 0 );
+ return ( fxNow = jQuery.now() );
+}
+
+function clearFxNow() {
+ fxNow = undefined;
+}
+
+// Generate parameters to create a standard animation
+function genFx( type, num ) {
+ var obj = {};
+
+ jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice( 0, num )), function() {
+ obj[ this ] = type;
+ });
+
+ return obj;
+}
+
+// Generate shortcuts for custom animations
+jQuery.each({
+ slideDown: genFx( "show", 1 ),
+ slideUp: genFx( "hide", 1 ),
+ slideToggle: genFx( "toggle", 1 ),
+ fadeIn: { opacity: "show" },
+ fadeOut: { opacity: "hide" },
+ fadeToggle: { opacity: "toggle" }
+}, function( name, props ) {
+ jQuery.fn[ name ] = function( speed, easing, callback ) {
+ return this.animate( props, speed, easing, callback );
+ };
+});
+
+jQuery.extend({
+ speed: function( speed, easing, fn ) {
+ var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
+ complete: fn || !fn && easing ||
+ jQuery.isFunction( speed ) && speed,
+ duration: speed,
+ easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
+ };
+
+ opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
+ opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
+
+ // normalize opt.queue - true/undefined/null -> "fx"
+ if ( opt.queue == null || opt.queue === true ) {
+ opt.queue = "fx";
+ }
+
+ // Queueing
+ opt.old = opt.complete;
+
+ opt.complete = function( noUnmark ) {
+ if ( jQuery.isFunction( opt.old ) ) {
+ opt.old.call( this );
+ }
+
+ if ( opt.queue ) {
+ jQuery.dequeue( this, opt.queue );
+ } else if ( noUnmark !== false ) {
+ jQuery._unmark( this );
+ }
+ };
+
+ return opt;
+ },
+
+ easing: {
+ linear: function( p ) {
+ return p;
+ },
+ swing: function( p ) {
+ return ( -Math.cos( p*Math.PI ) / 2 ) + 0.5;
+ }
+ },
+
+ timers: [],
+
+ fx: function( elem, options, prop ) {
+ this.options = options;
+ this.elem = elem;
+ this.prop = prop;
+
+ options.orig = options.orig || {};
+ }
+
+});
+
+jQuery.fx.prototype = {
+ // Simple function for setting a style value
+ update: function() {
+ if ( this.options.step ) {
+ this.options.step.call( this.elem, this.now, this );
+ }
+
+ ( jQuery.fx.step[ this.prop ] || jQuery.fx.step._default )( this );
+ },
+
+ // Get the current size
+ cur: function() {
+ if ( this.elem[ this.prop ] != null && (!this.elem.style || this.elem.style[ this.prop ] == null) ) {
+ return this.elem[ this.prop ];
+ }
+
+ var parsed,
+ r = jQuery.css( this.elem, this.prop );
+ // Empty strings, null, undefined and "auto" are converted to 0,
+ // complex values such as "rotate(1rad)" are returned as is,
+ // simple values such as "10px" are parsed to Float.
+ return isNaN( parsed = parseFloat( r ) ) ? !r || r === "auto" ? 0 : r : parsed;
+ },
+
+ // Start an animation from one number to another
+ custom: function( from, to, unit ) {
+ var self = this,
+ fx = jQuery.fx;
+
+ this.startTime = fxNow || createFxNow();
+ this.end = to;
+ this.now = this.start = from;
+ this.pos = this.state = 0;
+ this.unit = unit || this.unit || ( jQuery.cssNumber[ this.prop ] ? "" : "px" );
+
+ function t( gotoEnd ) {
+ return self.step( gotoEnd );
+ }
+
+ t.queue = this.options.queue;
+ t.elem = this.elem;
+ t.saveState = function() {
+ if ( jQuery._data( self.elem, "fxshow" + self.prop ) === undefined ) {
+ if ( self.options.hide ) {
+ jQuery._data( self.elem, "fxshow" + self.prop, self.start );
+ } else if ( self.options.show ) {
+ jQuery._data( self.elem, "fxshow" + self.prop, self.end );
+ }
+ }
+ };
+
+ if ( t() && jQuery.timers.push(t) && !timerId ) {
+ timerId = setInterval( fx.tick, fx.interval );
+ }
+ },
+
+ // Simple 'show' function
+ show: function() {
+ var dataShow = jQuery._data( this.elem, "fxshow" + this.prop );
+
+ // Remember where we started, so that we can go back to it later
+ this.options.orig[ this.prop ] = dataShow || jQuery.style( this.elem, this.prop );
+ this.options.show = true;
+
+ // Begin the animation
+ // Make sure that we start at a small width/height to avoid any flash of content
+ if ( dataShow !== undefined ) {
+ // This show is picking up where a previous hide or show left off
+ this.custom( this.cur(), dataShow );
+ } else {
+ this.custom( this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur() );
+ }
+
+ // Start by showing the element
+ jQuery( this.elem ).show();
+ },
+
+ // Simple 'hide' function
+ hide: function() {
+ // Remember where we started, so that we can go back to it later
+ this.options.orig[ this.prop ] = jQuery._data( this.elem, "fxshow" + this.prop ) || jQuery.style( this.elem, this.prop );
+ this.options.hide = true;
+
+ // Begin the animation
+ this.custom( this.cur(), 0 );
+ },
+
+ // Each step of an animation
+ step: function( gotoEnd ) {
+ var p, n, complete,
+ t = fxNow || createFxNow(),
+ done = true,
+ elem = this.elem,
+ options = this.options;
+
+ if ( gotoEnd || t >= options.duration + this.startTime ) {
+ this.now = this.end;
+ this.pos = this.state = 1;
+ this.update();
+
+ options.animatedProperties[ this.prop ] = true;
+
+ for ( p in options.animatedProperties ) {
+ if ( options.animatedProperties[ p ] !== true ) {
+ done = false;
+ }
+ }
+
+ if ( done ) {
+ // Reset the overflow
+ if ( options.overflow != null && !jQuery.support.shrinkWrapBlocks ) {
+
+ jQuery.each( [ "", "X", "Y" ], function( index, value ) {
+ elem.style[ "overflow" + value ] = options.overflow[ index ];
+ });
+ }
+
+ // Hide the element if the "hide" operation was done
+ if ( options.hide ) {
+ jQuery( elem ).hide();
+ }
+
+ // Reset the properties, if the item has been hidden or shown
+ if ( options.hide || options.show ) {
+ for ( p in options.animatedProperties ) {
+ jQuery.style( elem, p, options.orig[ p ] );
+ jQuery.removeData( elem, "fxshow" + p, true );
+ // Toggle data is no longer needed
+ jQuery.removeData( elem, "toggle" + p, true );
+ }
+ }
+
+ // Execute the complete function
+ // in the event that the complete function throws an exception
+ // we must ensure it won't be called twice. #5684
+
+ complete = options.complete;
+ if ( complete ) {
+
+ options.complete = false;
+ complete.call( elem );
+ }
+ }
+
+ return false;
+
+ } else {
+ // classical easing cannot be used with an Infinity duration
+ if ( options.duration == Infinity ) {
+ this.now = t;
+ } else {
+ n = t - this.startTime;
+ this.state = n / options.duration;
+
+ // Perform the easing function, defaults to swing
+ this.pos = jQuery.easing[ options.animatedProperties[this.prop] ]( this.state, n, 0, 1, options.duration );
+ this.now = this.start + ( (this.end - this.start) * this.pos );
+ }
+ // Perform the next step of the animation
+ this.update();
+ }
+
+ return true;
+ }
+};
+
+jQuery.extend( jQuery.fx, {
+ tick: function() {
+ var timer,
+ timers = jQuery.timers,
+ i = 0;
+
+ for ( ; i < timers.length; i++ ) {
+ timer = timers[ i ];
+ // Checks the timer has not already been removed
+ if ( !timer() && timers[ i ] === timer ) {
+ timers.splice( i--, 1 );
+ }
+ }
+
+ if ( !timers.length ) {
+ jQuery.fx.stop();
+ }
+ },
+
+ interval: 13,
+
+ stop: function() {
+ clearInterval( timerId );
+ timerId = null;
+ },
+
+ speeds: {
+ slow: 600,
+ fast: 200,
+ // Default speed
+ _default: 400
+ },
+
+ step: {
+ opacity: function( fx ) {
+ jQuery.style( fx.elem, "opacity", fx.now );
+ },
+
+ _default: function( fx ) {
+ if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) {
+ fx.elem.style[ fx.prop ] = fx.now + fx.unit;
+ } else {
+ fx.elem[ fx.prop ] = fx.now;
+ }
+ }
+ }
+});
+
+// Ensure props that can't be negative don't go there on undershoot easing
+jQuery.each( fxAttrs.concat.apply( [], fxAttrs ), function( i, prop ) {
+ // exclude marginTop, marginLeft, marginBottom and marginRight from this list
+ if ( prop.indexOf( "margin" ) ) {
+ jQuery.fx.step[ prop ] = function( fx ) {
+ jQuery.style( fx.elem, prop, Math.max(0, fx.now) + fx.unit );
+ };
+ }
+});
+
+if ( jQuery.expr && jQuery.expr.filters ) {
+ jQuery.expr.filters.animated = function( elem ) {
+ return jQuery.grep(jQuery.timers, function( fn ) {
+ return elem === fn.elem;
+ }).length;
+ };
+}
+
+// Try to restore the default display value of an element
+function defaultDisplay( nodeName ) {
+
+ if ( !elemdisplay[ nodeName ] ) {
+
+ var body = document.body,
+ elem = jQuery( "<" + nodeName + ">" ).appendTo( body ),
+ display = elem.css( "display" );
+ elem.remove();
+
+ // If the simple way fails,
+ // get element's real default display by attaching it to a temp iframe
+ if ( display === "none" || display === "" ) {
+ // No iframe to use yet, so create it
+ if ( !iframe ) {
+ iframe = document.createElement( "iframe" );
+ iframe.frameBorder = iframe.width = iframe.height = 0;
+ }
+
+ body.appendChild( iframe );
+
+ // Create a cacheable copy of the iframe document on first call.
+ // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML
+ // document to it; WebKit & Firefox won't allow reusing the iframe document.
+ if ( !iframeDoc || !iframe.createElement ) {
+ iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;
+ iframeDoc.write( ( jQuery.support.boxModel ? "<!doctype html>" : "" ) + "<html><body>" );
+ iframeDoc.close();
+ }
+
+ elem = iframeDoc.createElement( nodeName );
+
+ iframeDoc.body.appendChild( elem );
+
+ display = jQuery.css( elem, "display" );
+ body.removeChild( iframe );
+ }
+
+ // Store the correct default display
+ elemdisplay[ nodeName ] = display;
+ }
+
+ return elemdisplay[ nodeName ];
+}
+
+
+
+
+var getOffset,
+ rtable = /^t(?:able|d|h)$/i,
+ rroot = /^(?:body|html)$/i;
+
+if ( "getBoundingClientRect" in document.documentElement ) {
+ getOffset = function( elem, doc, docElem, box ) {
+ try {
+ box = elem.getBoundingClientRect();
+ } catch(e) {}
+
+ // Make sure we're not dealing with a disconnected DOM node
+ if ( !box || !jQuery.contains( docElem, elem ) ) {
+ return box ? { top: box.top, left: box.left } : { top: 0, left: 0 };
+ }
+
+ var body = doc.body,
+ win = getWindow( doc ),
+ clientTop = docElem.clientTop || body.clientTop || 0,
+ clientLeft = docElem.clientLeft || body.clientLeft || 0,
+ scrollTop = win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop,
+ scrollLeft = win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft,
+ top = box.top + scrollTop - clientTop,
+ left = box.left + scrollLeft - clientLeft;
+
+ return { top: top, left: left };
+ };
+
+} else {
+ getOffset = function( elem, doc, docElem ) {
+ var computedStyle,
+ offsetParent = elem.offsetParent,
+ prevOffsetParent = elem,
+ body = doc.body,
+ defaultView = doc.defaultView,
+ prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle,
+ top = elem.offsetTop,
+ left = elem.offsetLeft;
+
+ while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
+ if ( jQuery.support.fixedPosition && prevComputedStyle.position === "fixed" ) {
+ break;
+ }
+
+ computedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle;
+ top -= elem.scrollTop;
+ left -= elem.scrollLeft;
+
+ if ( elem === offsetParent ) {
+ top += elem.offsetTop;
+ left += elem.offsetLeft;
+
+ if ( jQuery.support.doesNotAddBorder && !(jQuery.support.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) {
+ top += parseFloat( computedStyle.borderTopWidth ) || 0;
+ left += parseFloat( computedStyle.borderLeftWidth ) || 0;
+ }
+
+ prevOffsetParent = offsetParent;
+ offsetParent = elem.offsetParent;
+ }
+
+ if ( jQuery.support.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) {
+ top += parseFloat( computedStyle.borderTopWidth ) || 0;
+ left += parseFloat( computedStyle.borderLeftWidth ) || 0;
+ }
+
+ prevComputedStyle = computedStyle;
+ }
+
+ if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) {
+ top += body.offsetTop;
+ left += body.offsetLeft;
+ }
+
+ if ( jQuery.support.fixedPosition && prevComputedStyle.position === "fixed" ) {
+ top += Math.max( docElem.scrollTop, body.scrollTop );
+ left += Math.max( docElem.scrollLeft, body.scrollLeft );
+ }
+
+ return { top: top, left: left };
+ };
+}
+
+jQuery.fn.offset = function( options ) {
+ if ( arguments.length ) {
+ return options === undefined ?
+ this :
+ this.each(function( i ) {
+ jQuery.offset.setOffset( this, options, i );
+ });
+ }
+
+ var elem = this[0],
+ doc = elem && elem.ownerDocument;
+
+ if ( !doc ) {
+ return null;
+ }
+
+ if ( elem === doc.body ) {
+ return jQuery.offset.bodyOffset( elem );
+ }
+
+ return getOffset( elem, doc, doc.documentElement );
+};
+
+jQuery.offset = {
+
+ bodyOffset: function( body ) {
+ var top = body.offsetTop,
+ left = body.offsetLeft;
+
+ if ( jQuery.support.doesNotIncludeMarginInBodyOffset ) {
+ top += parseFloat( jQuery.css(body, "marginTop") ) || 0;
+ left += parseFloat( jQuery.css(body, "marginLeft") ) || 0;
+ }
+
+ return { top: top, left: left };
+ },
+
+ setOffset: function( elem, options, i ) {
+ var position = jQuery.css( elem, "position" );
+
+ // set position first, in-case top/left are set even on static elem
+ if ( position === "static" ) {
+ elem.style.position = "relative";
+ }
+
+ var curElem = jQuery( elem ),
+ curOffset = curElem.offset(),
+ curCSSTop = jQuery.css( elem, "top" ),
+ curCSSLeft = jQuery.css( elem, "left" ),
+ calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1,
+ props = {}, curPosition = {}, curTop, curLeft;
+
+ // need to be able to calculate position if either top or left is auto and position is either absolute or fixed
+ if ( calculatePosition ) {
+ curPosition = curElem.position();
+ curTop = curPosition.top;
+ curLeft = curPosition.left;
+ } else {
+ curTop = parseFloat( curCSSTop ) || 0;
+ curLeft = parseFloat( curCSSLeft ) || 0;
+ }
+
+ if ( jQuery.isFunction( options ) ) {
+ options = options.call( elem, i, curOffset );
+ }
+
+ if ( options.top != null ) {
+ props.top = ( options.top - curOffset.top ) + curTop;
+ }
+ if ( options.left != null ) {
+ props.left = ( options.left - curOffset.left ) + curLeft;
+ }
+
+ if ( "using" in options ) {
+ options.using.call( elem, props );
+ } else {
+ curElem.css( props );
+ }
+ }
+};
+
+
+jQuery.fn.extend({
+
+ position: function() {
+ if ( !this[0] ) {
+ return null;
+ }
+
+ var elem = this[0],
+
+ // Get *real* offsetParent
+ offsetParent = this.offsetParent(),
+
+ // Get correct offsets
+ offset = this.offset(),
+ parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();
+
+ // Subtract element margins
+ // note: when an element has margin: auto the offsetLeft and marginLeft
+ // are the same in Safari causing offset.left to incorrectly be 0
+ offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0;
+ offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0;
+
+ // Add offsetParent borders
+ parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0;
+ parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0;
+
+ // Subtract the two offsets
+ return {
+ top: offset.top - parentOffset.top,
+ left: offset.left - parentOffset.left
+ };
+ },
+
+ offsetParent: function() {
+ return this.map(function() {
+ var offsetParent = this.offsetParent || document.body;
+ while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) {
+ offsetParent = offsetParent.offsetParent;
+ }
+ return offsetParent;
+ });
+ }
+});
+
+
+// Create scrollLeft and scrollTop methods
+jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) {
+ var top = /Y/.test( prop );
+
+ jQuery.fn[ method ] = function( val ) {
+ return jQuery.access( this, function( elem, method, val ) {
+ var win = getWindow( elem );
+
+ if ( val === undefined ) {
+ return win ? (prop in win) ? win[ prop ] :
+ jQuery.support.boxModel && win.document.documentElement[ method ] ||
+ win.document.body[ method ] :
+ elem[ method ];
+ }
+
+ if ( win ) {
+ win.scrollTo(
+ !top ? val : jQuery( win ).scrollLeft(),
+ top ? val : jQuery( win ).scrollTop()
+ );
+
+ } else {
+ elem[ method ] = val;
+ }
+ }, method, val, arguments.length, null );
+ };
+});
+
+function getWindow( elem ) {
+ return jQuery.isWindow( elem ) ?
+ elem :
+ elem.nodeType === 9 ?
+ elem.defaultView || elem.parentWindow :
+ false;
+}
+
+
+
+
+// Create width, height, innerHeight, innerWidth, outerHeight and outerWidth methods
+jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
+ var clientProp = "client" + name,
+ scrollProp = "scroll" + name,
+ offsetProp = "offset" + name;
+
+ // innerHeight and innerWidth
+ jQuery.fn[ "inner" + name ] = function() {
+ var elem = this[0];
+ return elem ?
+ elem.style ?
+ parseFloat( jQuery.css( elem, type, "padding" ) ) :
+ this[ type ]() :
+ null;
+ };
+
+ // outerHeight and outerWidth
+ jQuery.fn[ "outer" + name ] = function( margin ) {
+ var elem = this[0];
+ return elem ?
+ elem.style ?
+ parseFloat( jQuery.css( elem, type, margin ? "margin" : "border" ) ) :
+ this[ type ]() :
+ null;
+ };
+
+ jQuery.fn[ type ] = function( value ) {
+ return jQuery.access( this, function( elem, type, value ) {
+ var doc, docElemProp, orig, ret;
+
+ if ( jQuery.isWindow( elem ) ) {
+ // 3rd condition allows Nokia support, as it supports the docElem prop but not CSS1Compat
+ doc = elem.document;
+ docElemProp = doc.documentElement[ clientProp ];
+ return jQuery.support.boxModel && docElemProp ||
+ doc.body && doc.body[ clientProp ] || docElemProp;
+ }
+
+ // Get document width or height
+ if ( elem.nodeType === 9 ) {
+ // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
+ doc = elem.documentElement;
+
+ // when a window > document, IE6 reports a offset[Width/Height] > client[Width/Height]
+ // so we can't use max, as it'll choose the incorrect offset[Width/Height]
+ // instead we use the correct client[Width/Height]
+ // support:IE6
+ if ( doc[ clientProp ] >= doc[ scrollProp ] ) {
+ return doc[ clientProp ];
+ }
+
+ return Math.max(
+ elem.body[ scrollProp ], doc[ scrollProp ],
+ elem.body[ offsetProp ], doc[ offsetProp ]
+ );
+ }
+
+ // Get width or height on the element
+ if ( value === undefined ) {
+ orig = jQuery.css( elem, type );
+ ret = parseFloat( orig );
+ return jQuery.isNumeric( ret ) ? ret : orig;
+ }
+
+ // Set the width or height on the element
+ jQuery( elem ).css( type, value );
+ }, type, value, arguments.length, null );
+ };
+});
+
+
+
+
+// Expose jQuery to the global object
+window.jQuery = window.$ = jQuery;
+
+// Expose jQuery as an AMD module, but only for AMD loaders that
+// understand the issues with loading multiple versions of jQuery
+// in a page that all might call define(). The loader will indicate
+// they have special allowances for multiple jQuery versions by
+// specifying define.amd.jQuery = true. Register as a named module,
+// since jQuery can be concatenated with other files that may use define,
+// but not use a proper concatenation script that understands anonymous
+// AMD modules. A named AMD is safest and most robust way to register.
+// Lowercase jquery is used because AMD module names are derived from
+// file names, and jQuery is normally delivered in a lowercase file name.
+// Do this after creating the global so that if an AMD module wants to call
+// noConflict to hide this version of jQuery, it will work.
+if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
+ define( "jquery", [], function () { return jQuery; } );
+}
+
+
+
+})( window );
diff --git a/storage/mroonga/vendor/groonga/examples/dictionary/html/js/jquery-ui-1.8.18.custom.js b/storage/mroonga/vendor/groonga/examples/dictionary/html/js/jquery-ui-1.8.18.custom.js
new file mode 100644
index 00000000000..d4444b2bd11
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/examples/dictionary/html/js/jquery-ui-1.8.18.custom.js
@@ -0,0 +1,11802 @@
+/*!
+ * jQuery UI 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI
+ */
+(function( $, undefined ) {
+
+// prevent duplicate loading
+// this is only a problem because we proxy existing functions
+// and we don't want to double proxy them
+$.ui = $.ui || {};
+if ( $.ui.version ) {
+ return;
+}
+
+$.extend( $.ui, {
+ version: "1.8.18",
+
+ keyCode: {
+ ALT: 18,
+ BACKSPACE: 8,
+ CAPS_LOCK: 20,
+ COMMA: 188,
+ COMMAND: 91,
+ COMMAND_LEFT: 91, // COMMAND
+ COMMAND_RIGHT: 93,
+ CONTROL: 17,
+ DELETE: 46,
+ DOWN: 40,
+ END: 35,
+ ENTER: 13,
+ ESCAPE: 27,
+ HOME: 36,
+ INSERT: 45,
+ LEFT: 37,
+ MENU: 93, // COMMAND_RIGHT
+ NUMPAD_ADD: 107,
+ NUMPAD_DECIMAL: 110,
+ NUMPAD_DIVIDE: 111,
+ NUMPAD_ENTER: 108,
+ NUMPAD_MULTIPLY: 106,
+ NUMPAD_SUBTRACT: 109,
+ PAGE_DOWN: 34,
+ PAGE_UP: 33,
+ PERIOD: 190,
+ RIGHT: 39,
+ SHIFT: 16,
+ SPACE: 32,
+ TAB: 9,
+ UP: 38,
+ WINDOWS: 91 // COMMAND
+ }
+});
+
+// plugins
+$.fn.extend({
+ propAttr: $.fn.prop || $.fn.attr,
+
+ _focus: $.fn.focus,
+ focus: function( delay, fn ) {
+ return typeof delay === "number" ?
+ this.each(function() {
+ var elem = this;
+ setTimeout(function() {
+ $( elem ).focus();
+ if ( fn ) {
+ fn.call( elem );
+ }
+ }, delay );
+ }) :
+ this._focus.apply( this, arguments );
+ },
+
+ scrollParent: function() {
+ var scrollParent;
+ if (($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) {
+ scrollParent = this.parents().filter(function() {
+ return (/(relative|absolute|fixed)/).test($.curCSS(this,'position',1)) && (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
+ }).eq(0);
+ } else {
+ scrollParent = this.parents().filter(function() {
+ return (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
+ }).eq(0);
+ }
+
+ return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent;
+ },
+
+ zIndex: function( zIndex ) {
+ if ( zIndex !== undefined ) {
+ return this.css( "zIndex", zIndex );
+ }
+
+ if ( this.length ) {
+ var elem = $( this[ 0 ] ), position, value;
+ while ( elem.length && elem[ 0 ] !== document ) {
+ // Ignore z-index if position is set to a value where z-index is ignored by the browser
+ // This makes behavior of this function consistent across browsers
+ // WebKit always returns auto if the element is positioned
+ position = elem.css( "position" );
+ if ( position === "absolute" || position === "relative" || position === "fixed" ) {
+ // IE returns 0 when zIndex is not specified
+ // other browsers return a string
+ // we ignore the case of nested elements with an explicit value of 0
+ // <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
+ value = parseInt( elem.css( "zIndex" ), 10 );
+ if ( !isNaN( value ) && value !== 0 ) {
+ return value;
+ }
+ }
+ elem = elem.parent();
+ }
+ }
+
+ return 0;
+ },
+
+ disableSelection: function() {
+ return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) +
+ ".ui-disableSelection", function( event ) {
+ event.preventDefault();
+ });
+ },
+
+ enableSelection: function() {
+ return this.unbind( ".ui-disableSelection" );
+ }
+});
+
+$.each( [ "Width", "Height" ], function( i, name ) {
+ var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
+ type = name.toLowerCase(),
+ orig = {
+ innerWidth: $.fn.innerWidth,
+ innerHeight: $.fn.innerHeight,
+ outerWidth: $.fn.outerWidth,
+ outerHeight: $.fn.outerHeight
+ };
+
+ function reduce( elem, size, border, margin ) {
+ $.each( side, function() {
+ size -= parseFloat( $.curCSS( elem, "padding" + this, true) ) || 0;
+ if ( border ) {
+ size -= parseFloat( $.curCSS( elem, "border" + this + "Width", true) ) || 0;
+ }
+ if ( margin ) {
+ size -= parseFloat( $.curCSS( elem, "margin" + this, true) ) || 0;
+ }
+ });
+ return size;
+ }
+
+ $.fn[ "inner" + name ] = function( size ) {
+ if ( size === undefined ) {
+ return orig[ "inner" + name ].call( this );
+ }
+
+ return this.each(function() {
+ $( this ).css( type, reduce( this, size ) + "px" );
+ });
+ };
+
+ $.fn[ "outer" + name] = function( size, margin ) {
+ if ( typeof size !== "number" ) {
+ return orig[ "outer" + name ].call( this, size );
+ }
+
+ return this.each(function() {
+ $( this).css( type, reduce( this, size, true, margin ) + "px" );
+ });
+ };
+});
+
+// selectors
+function focusable( element, isTabIndexNotNaN ) {
+ var nodeName = element.nodeName.toLowerCase();
+ if ( "area" === nodeName ) {
+ var map = element.parentNode,
+ mapName = map.name,
+ img;
+ if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
+ return false;
+ }
+ img = $( "img[usemap=#" + mapName + "]" )[0];
+ return !!img && visible( img );
+ }
+ return ( /input|select|textarea|button|object/.test( nodeName )
+ ? !element.disabled
+ : "a" == nodeName
+ ? element.href || isTabIndexNotNaN
+ : isTabIndexNotNaN)
+ // the element and all of its ancestors must be visible
+ && visible( element );
+}
+
+function visible( element ) {
+ return !$( element ).parents().andSelf().filter(function() {
+ return $.curCSS( this, "visibility" ) === "hidden" ||
+ $.expr.filters.hidden( this );
+ }).length;
+}
+
+$.extend( $.expr[ ":" ], {
+ data: function( elem, i, match ) {
+ return !!$.data( elem, match[ 3 ] );
+ },
+
+ focusable: function( element ) {
+ return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) );
+ },
+
+ tabbable: function( element ) {
+ var tabIndex = $.attr( element, "tabindex" ),
+ isTabIndexNaN = isNaN( tabIndex );
+ return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN );
+ }
+});
+
+// support
+$(function() {
+ var body = document.body,
+ div = body.appendChild( div = document.createElement( "div" ) );
+
+ // access offsetHeight before setting the style to prevent a layout bug
+ // in IE 9 which causes the elemnt to continue to take up space even
+ // after it is removed from the DOM (#8026)
+ div.offsetHeight;
+
+ $.extend( div.style, {
+ minHeight: "100px",
+ height: "auto",
+ padding: 0,
+ borderWidth: 0
+ });
+
+ $.support.minHeight = div.offsetHeight === 100;
+ $.support.selectstart = "onselectstart" in div;
+
+ // set display to none to avoid a layout bug in IE
+ // http://dev.jquery.com/ticket/4014
+ body.removeChild( div ).style.display = "none";
+});
+
+
+
+
+
+// deprecated
+$.extend( $.ui, {
+ // $.ui.plugin is deprecated. Use the proxy pattern instead.
+ plugin: {
+ add: function( module, option, set ) {
+ var proto = $.ui[ module ].prototype;
+ for ( var i in set ) {
+ proto.plugins[ i ] = proto.plugins[ i ] || [];
+ proto.plugins[ i ].push( [ option, set[ i ] ] );
+ }
+ },
+ call: function( instance, name, args ) {
+ var set = instance.plugins[ name ];
+ if ( !set || !instance.element[ 0 ].parentNode ) {
+ return;
+ }
+
+ for ( var i = 0; i < set.length; i++ ) {
+ if ( instance.options[ set[ i ][ 0 ] ] ) {
+ set[ i ][ 1 ].apply( instance.element, args );
+ }
+ }
+ }
+ },
+
+ // will be deprecated when we switch to jQuery 1.4 - use jQuery.contains()
+ contains: function( a, b ) {
+ return document.compareDocumentPosition ?
+ a.compareDocumentPosition( b ) & 16 :
+ a !== b && a.contains( b );
+ },
+
+ // only used by resizable
+ hasScroll: function( el, a ) {
+
+ //If overflow is hidden, the element might have extra content, but the user wants to hide it
+ if ( $( el ).css( "overflow" ) === "hidden") {
+ return false;
+ }
+
+ var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
+ has = false;
+
+ if ( el[ scroll ] > 0 ) {
+ return true;
+ }
+
+ // TODO: determine which cases actually cause this to happen
+ // if the element doesn't have the scroll set, see if it's possible to
+ // set the scroll
+ el[ scroll ] = 1;
+ has = ( el[ scroll ] > 0 );
+ el[ scroll ] = 0;
+ return has;
+ },
+
+ // these are odd functions, fix the API or move into individual plugins
+ isOverAxis: function( x, reference, size ) {
+ //Determines when x coordinate is over "b" element axis
+ return ( x > reference ) && ( x < ( reference + size ) );
+ },
+ isOver: function( y, x, top, left, height, width ) {
+ //Determines when x, y coordinates is over "b" element
+ return $.ui.isOverAxis( y, top, height ) && $.ui.isOverAxis( x, left, width );
+ }
+});
+
+})( jQuery );
+/*!
+ * jQuery UI Widget 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Widget
+ */
+(function( $, undefined ) {
+
+// jQuery 1.4+
+if ( $.cleanData ) {
+ var _cleanData = $.cleanData;
+ $.cleanData = function( elems ) {
+ for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
+ try {
+ $( elem ).triggerHandler( "remove" );
+ // http://bugs.jquery.com/ticket/8235
+ } catch( e ) {}
+ }
+ _cleanData( elems );
+ };
+} else {
+ var _remove = $.fn.remove;
+ $.fn.remove = function( selector, keepData ) {
+ return this.each(function() {
+ if ( !keepData ) {
+ if ( !selector || $.filter( selector, [ this ] ).length ) {
+ $( "*", this ).add( [ this ] ).each(function() {
+ try {
+ $( this ).triggerHandler( "remove" );
+ // http://bugs.jquery.com/ticket/8235
+ } catch( e ) {}
+ });
+ }
+ }
+ return _remove.call( $(this), selector, keepData );
+ });
+ };
+}
+
+$.widget = function( name, base, prototype ) {
+ var namespace = name.split( "." )[ 0 ],
+ fullName;
+ name = name.split( "." )[ 1 ];
+ fullName = namespace + "-" + name;
+
+ if ( !prototype ) {
+ prototype = base;
+ base = $.Widget;
+ }
+
+ // create selector for plugin
+ $.expr[ ":" ][ fullName ] = function( elem ) {
+ return !!$.data( elem, name );
+ };
+
+ $[ namespace ] = $[ namespace ] || {};
+ $[ namespace ][ name ] = function( options, element ) {
+ // allow instantiation without initializing for simple inheritance
+ if ( arguments.length ) {
+ this._createWidget( options, element );
+ }
+ };
+
+ var basePrototype = new base();
+ // we need to make the options hash a property directly on the new instance
+ // otherwise we'll modify the options hash on the prototype that we're
+ // inheriting from
+// $.each( basePrototype, function( key, val ) {
+// if ( $.isPlainObject(val) ) {
+// basePrototype[ key ] = $.extend( {}, val );
+// }
+// });
+ basePrototype.options = $.extend( true, {}, basePrototype.options );
+ $[ namespace ][ name ].prototype = $.extend( true, basePrototype, {
+ namespace: namespace,
+ widgetName: name,
+ widgetEventPrefix: $[ namespace ][ name ].prototype.widgetEventPrefix || name,
+ widgetBaseClass: fullName
+ }, prototype );
+
+ $.widget.bridge( name, $[ namespace ][ name ] );
+};
+
+$.widget.bridge = function( name, object ) {
+ $.fn[ name ] = function( options ) {
+ var isMethodCall = typeof options === "string",
+ args = Array.prototype.slice.call( arguments, 1 ),
+ returnValue = this;
+
+ // allow multiple hashes to be passed on init
+ options = !isMethodCall && args.length ?
+ $.extend.apply( null, [ true, options ].concat(args) ) :
+ options;
+
+ // prevent calls to internal methods
+ if ( isMethodCall && options.charAt( 0 ) === "_" ) {
+ return returnValue;
+ }
+
+ if ( isMethodCall ) {
+ this.each(function() {
+ var instance = $.data( this, name ),
+ methodValue = instance && $.isFunction( instance[options] ) ?
+ instance[ options ].apply( instance, args ) :
+ instance;
+ // TODO: add this back in 1.9 and use $.error() (see #5972)
+// if ( !instance ) {
+// throw "cannot call methods on " + name + " prior to initialization; " +
+// "attempted to call method '" + options + "'";
+// }
+// if ( !$.isFunction( instance[options] ) ) {
+// throw "no such method '" + options + "' for " + name + " widget instance";
+// }
+// var methodValue = instance[ options ].apply( instance, args );
+ if ( methodValue !== instance && methodValue !== undefined ) {
+ returnValue = methodValue;
+ return false;
+ }
+ });
+ } else {
+ this.each(function() {
+ var instance = $.data( this, name );
+ if ( instance ) {
+ instance.option( options || {} )._init();
+ } else {
+ $.data( this, name, new object( options, this ) );
+ }
+ });
+ }
+
+ return returnValue;
+ };
+};
+
+$.Widget = function( options, element ) {
+ // allow instantiation without initializing for simple inheritance
+ if ( arguments.length ) {
+ this._createWidget( options, element );
+ }
+};
+
+$.Widget.prototype = {
+ widgetName: "widget",
+ widgetEventPrefix: "",
+ options: {
+ disabled: false
+ },
+ _createWidget: function( options, element ) {
+ // $.widget.bridge stores the plugin instance, but we do it anyway
+ // so that it's stored even before the _create function runs
+ $.data( element, this.widgetName, this );
+ this.element = $( element );
+ this.options = $.extend( true, {},
+ this.options,
+ this._getCreateOptions(),
+ options );
+
+ var self = this;
+ this.element.bind( "remove." + this.widgetName, function() {
+ self.destroy();
+ });
+
+ this._create();
+ this._trigger( "create" );
+ this._init();
+ },
+ _getCreateOptions: function() {
+ return $.metadata && $.metadata.get( this.element[0] )[ this.widgetName ];
+ },
+ _create: function() {},
+ _init: function() {},
+
+ destroy: function() {
+ this.element
+ .unbind( "." + this.widgetName )
+ .removeData( this.widgetName );
+ this.widget()
+ .unbind( "." + this.widgetName )
+ .removeAttr( "aria-disabled" )
+ .removeClass(
+ this.widgetBaseClass + "-disabled " +
+ "ui-state-disabled" );
+ },
+
+ widget: function() {
+ return this.element;
+ },
+
+ option: function( key, value ) {
+ var options = key;
+
+ if ( arguments.length === 0 ) {
+ // don't return a reference to the internal hash
+ return $.extend( {}, this.options );
+ }
+
+ if (typeof key === "string" ) {
+ if ( value === undefined ) {
+ return this.options[ key ];
+ }
+ options = {};
+ options[ key ] = value;
+ }
+
+ this._setOptions( options );
+
+ return this;
+ },
+ _setOptions: function( options ) {
+ var self = this;
+ $.each( options, function( key, value ) {
+ self._setOption( key, value );
+ });
+
+ return this;
+ },
+ _setOption: function( key, value ) {
+ this.options[ key ] = value;
+
+ if ( key === "disabled" ) {
+ this.widget()
+ [ value ? "addClass" : "removeClass"](
+ this.widgetBaseClass + "-disabled" + " " +
+ "ui-state-disabled" )
+ .attr( "aria-disabled", value );
+ }
+
+ return this;
+ },
+
+ enable: function() {
+ return this._setOption( "disabled", false );
+ },
+ disable: function() {
+ return this._setOption( "disabled", true );
+ },
+
+ _trigger: function( type, event, data ) {
+ var prop, orig,
+ callback = this.options[ type ];
+
+ data = data || {};
+ event = $.Event( event );
+ event.type = ( type === this.widgetEventPrefix ?
+ type :
+ this.widgetEventPrefix + type ).toLowerCase();
+ // the original event may come from any element
+ // so we need to reset the target on the new event
+ event.target = this.element[ 0 ];
+
+ // copy original event properties over to the new event
+ orig = event.originalEvent;
+ if ( orig ) {
+ for ( prop in orig ) {
+ if ( !( prop in event ) ) {
+ event[ prop ] = orig[ prop ];
+ }
+ }
+ }
+
+ this.element.trigger( event, data );
+
+ return !( $.isFunction(callback) &&
+ callback.call( this.element[0], event, data ) === false ||
+ event.isDefaultPrevented() );
+ }
+};
+
+})( jQuery );
+/*!
+ * jQuery UI Mouse 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Mouse
+ *
+ * Depends:
+ * jquery.ui.widget.js
+ */
+(function( $, undefined ) {
+
+var mouseHandled = false;
+$( document ).mouseup( function( e ) {
+ mouseHandled = false;
+});
+
+$.widget("ui.mouse", {
+ options: {
+ cancel: ':input,option',
+ distance: 1,
+ delay: 0
+ },
+ _mouseInit: function() {
+ var self = this;
+
+ this.element
+ .bind('mousedown.'+this.widgetName, function(event) {
+ return self._mouseDown(event);
+ })
+ .bind('click.'+this.widgetName, function(event) {
+ if (true === $.data(event.target, self.widgetName + '.preventClickEvent')) {
+ $.removeData(event.target, self.widgetName + '.preventClickEvent');
+ event.stopImmediatePropagation();
+ return false;
+ }
+ });
+
+ this.started = false;
+ },
+
+ // TODO: make sure destroying one instance of mouse doesn't mess with
+ // other instances of mouse
+ _mouseDestroy: function() {
+ this.element.unbind('.'+this.widgetName);
+ },
+
+ _mouseDown: function(event) {
+ // don't let more than one widget handle mouseStart
+ if( mouseHandled ) { return };
+
+ // we may have missed mouseup (out of window)
+ (this._mouseStarted && this._mouseUp(event));
+
+ this._mouseDownEvent = event;
+
+ var self = this,
+ btnIsLeft = (event.which == 1),
+ // event.target.nodeName works around a bug in IE 8 with
+ // disabled inputs (#7620)
+ elIsCancel = (typeof this.options.cancel == "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false);
+ if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
+ return true;
+ }
+
+ this.mouseDelayMet = !this.options.delay;
+ if (!this.mouseDelayMet) {
+ this._mouseDelayTimer = setTimeout(function() {
+ self.mouseDelayMet = true;
+ }, this.options.delay);
+ }
+
+ if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
+ this._mouseStarted = (this._mouseStart(event) !== false);
+ if (!this._mouseStarted) {
+ event.preventDefault();
+ return true;
+ }
+ }
+
+ // Click event may never have fired (Gecko & Opera)
+ if (true === $.data(event.target, this.widgetName + '.preventClickEvent')) {
+ $.removeData(event.target, this.widgetName + '.preventClickEvent');
+ }
+
+ // these delegates are required to keep context
+ this._mouseMoveDelegate = function(event) {
+ return self._mouseMove(event);
+ };
+ this._mouseUpDelegate = function(event) {
+ return self._mouseUp(event);
+ };
+ $(document)
+ .bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
+ .bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
+
+ event.preventDefault();
+
+ mouseHandled = true;
+ return true;
+ },
+
+ _mouseMove: function(event) {
+ // IE mouseup check - mouseup happened when mouse was out of window
+ if ($.browser.msie && !(document.documentMode >= 9) && !event.button) {
+ return this._mouseUp(event);
+ }
+
+ if (this._mouseStarted) {
+ this._mouseDrag(event);
+ return event.preventDefault();
+ }
+
+ if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
+ this._mouseStarted =
+ (this._mouseStart(this._mouseDownEvent, event) !== false);
+ (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
+ }
+
+ return !this._mouseStarted;
+ },
+
+ _mouseUp: function(event) {
+ $(document)
+ .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
+ .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
+
+ if (this._mouseStarted) {
+ this._mouseStarted = false;
+
+ if (event.target == this._mouseDownEvent.target) {
+ $.data(event.target, this.widgetName + '.preventClickEvent', true);
+ }
+
+ this._mouseStop(event);
+ }
+
+ return false;
+ },
+
+ _mouseDistanceMet: function(event) {
+ return (Math.max(
+ Math.abs(this._mouseDownEvent.pageX - event.pageX),
+ Math.abs(this._mouseDownEvent.pageY - event.pageY)
+ ) >= this.options.distance
+ );
+ },
+
+ _mouseDelayMet: function(event) {
+ return this.mouseDelayMet;
+ },
+
+ // These are placeholder methods, to be overriden by extending plugin
+ _mouseStart: function(event) {},
+ _mouseDrag: function(event) {},
+ _mouseStop: function(event) {},
+ _mouseCapture: function(event) { return true; }
+});
+
+})(jQuery);
+/*
+ * jQuery UI Draggable 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Draggables
+ *
+ * Depends:
+ * jquery.ui.core.js
+ * jquery.ui.mouse.js
+ * jquery.ui.widget.js
+ */
+(function( $, undefined ) {
+
+$.widget("ui.draggable", $.ui.mouse, {
+ widgetEventPrefix: "drag",
+ options: {
+ addClasses: true,
+ appendTo: "parent",
+ axis: false,
+ connectToSortable: false,
+ containment: false,
+ cursor: "auto",
+ cursorAt: false,
+ grid: false,
+ handle: false,
+ helper: "original",
+ iframeFix: false,
+ opacity: false,
+ refreshPositions: false,
+ revert: false,
+ revertDuration: 500,
+ scope: "default",
+ scroll: true,
+ scrollSensitivity: 20,
+ scrollSpeed: 20,
+ snap: false,
+ snapMode: "both",
+ snapTolerance: 20,
+ stack: false,
+ zIndex: false
+ },
+ _create: function() {
+
+ if (this.options.helper == 'original' && !(/^(?:r|a|f)/).test(this.element.css("position")))
+ this.element[0].style.position = 'relative';
+
+ (this.options.addClasses && this.element.addClass("ui-draggable"));
+ (this.options.disabled && this.element.addClass("ui-draggable-disabled"));
+
+ this._mouseInit();
+
+ },
+
+ destroy: function() {
+ if(!this.element.data('draggable')) return;
+ this.element
+ .removeData("draggable")
+ .unbind(".draggable")
+ .removeClass("ui-draggable"
+ + " ui-draggable-dragging"
+ + " ui-draggable-disabled");
+ this._mouseDestroy();
+
+ return this;
+ },
+
+ _mouseCapture: function(event) {
+
+ var o = this.options;
+
+ // among others, prevent a drag on a resizable-handle
+ if (this.helper || o.disabled || $(event.target).is('.ui-resizable-handle'))
+ return false;
+
+ //Quit if we're not on a valid handle
+ this.handle = this._getHandle(event);
+ if (!this.handle)
+ return false;
+
+ if ( o.iframeFix ) {
+ $(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() {
+ $('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>')
+ .css({
+ width: this.offsetWidth+"px", height: this.offsetHeight+"px",
+ position: "absolute", opacity: "0.001", zIndex: 1000
+ })
+ .css($(this).offset())
+ .appendTo("body");
+ });
+ }
+
+ return true;
+
+ },
+
+ _mouseStart: function(event) {
+
+ var o = this.options;
+
+ //Create and append the visible helper
+ this.helper = this._createHelper(event);
+
+ //Cache the helper size
+ this._cacheHelperProportions();
+
+ //If ddmanager is used for droppables, set the global draggable
+ if($.ui.ddmanager)
+ $.ui.ddmanager.current = this;
+
+ /*
+ * - Position generation -
+ * This block generates everything position related - it's the core of draggables.
+ */
+
+ //Cache the margins of the original element
+ this._cacheMargins();
+
+ //Store the helper's css position
+ this.cssPosition = this.helper.css("position");
+ this.scrollParent = this.helper.scrollParent();
+
+ //The element's absolute position on the page minus margins
+ this.offset = this.positionAbs = this.element.offset();
+ this.offset = {
+ top: this.offset.top - this.margins.top,
+ left: this.offset.left - this.margins.left
+ };
+
+ $.extend(this.offset, {
+ click: { //Where the click happened, relative to the element
+ left: event.pageX - this.offset.left,
+ top: event.pageY - this.offset.top
+ },
+ parent: this._getParentOffset(),
+ relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
+ });
+
+ //Generate the original position
+ this.originalPosition = this.position = this._generatePosition(event);
+ this.originalPageX = event.pageX;
+ this.originalPageY = event.pageY;
+
+ //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied
+ (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
+
+ //Set a containment if given in the options
+ if(o.containment)
+ this._setContainment();
+
+ //Trigger event + callbacks
+ if(this._trigger("start", event) === false) {
+ this._clear();
+ return false;
+ }
+
+ //Recache the helper size
+ this._cacheHelperProportions();
+
+ //Prepare the droppable offsets
+ if ($.ui.ddmanager && !o.dropBehaviour)
+ $.ui.ddmanager.prepareOffsets(this, event);
+
+ this.helper.addClass("ui-draggable-dragging");
+ this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position
+
+ //If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003)
+ if ( $.ui.ddmanager ) $.ui.ddmanager.dragStart(this, event);
+
+ return true;
+ },
+
+ _mouseDrag: function(event, noPropagation) {
+
+ //Compute the helpers position
+ this.position = this._generatePosition(event);
+ this.positionAbs = this._convertPositionTo("absolute");
+
+ //Call plugins and callbacks and use the resulting position if something is returned
+ if (!noPropagation) {
+ var ui = this._uiHash();
+ if(this._trigger('drag', event, ui) === false) {
+ this._mouseUp({});
+ return false;
+ }
+ this.position = ui.position;
+ }
+
+ if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px';
+ if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px';
+ if($.ui.ddmanager) $.ui.ddmanager.drag(this, event);
+
+ return false;
+ },
+
+ _mouseStop: function(event) {
+
+ //If we are using droppables, inform the manager about the drop
+ var dropped = false;
+ if ($.ui.ddmanager && !this.options.dropBehaviour)
+ dropped = $.ui.ddmanager.drop(this, event);
+
+ //if a drop comes from outside (a sortable)
+ if(this.dropped) {
+ dropped = this.dropped;
+ this.dropped = false;
+ }
+
+ //if the original element is removed, don't bother to continue if helper is set to "original"
+ if((!this.element[0] || !this.element[0].parentNode) && this.options.helper == "original")
+ return false;
+
+ if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) {
+ var self = this;
+ $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() {
+ if(self._trigger("stop", event) !== false) {
+ self._clear();
+ }
+ });
+ } else {
+ if(this._trigger("stop", event) !== false) {
+ this._clear();
+ }
+ }
+
+ return false;
+ },
+
+ _mouseUp: function(event) {
+ if (this.options.iframeFix === true) {
+ $("div.ui-draggable-iframeFix").each(function() {
+ this.parentNode.removeChild(this);
+ }); //Remove frame helpers
+ }
+
+ //If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003)
+ if( $.ui.ddmanager ) $.ui.ddmanager.dragStop(this, event);
+
+ return $.ui.mouse.prototype._mouseUp.call(this, event);
+ },
+
+ cancel: function() {
+
+ if(this.helper.is(".ui-draggable-dragging")) {
+ this._mouseUp({});
+ } else {
+ this._clear();
+ }
+
+ return this;
+
+ },
+
+ _getHandle: function(event) {
+
+ var handle = !this.options.handle || !$(this.options.handle, this.element).length ? true : false;
+ $(this.options.handle, this.element)
+ .find("*")
+ .andSelf()
+ .each(function() {
+ if(this == event.target) handle = true;
+ });
+
+ return handle;
+
+ },
+
+ _createHelper: function(event) {
+
+ var o = this.options;
+ var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper == 'clone' ? this.element.clone().removeAttr('id') : this.element);
+
+ if(!helper.parents('body').length)
+ helper.appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo));
+
+ if(helper[0] != this.element[0] && !(/(fixed|absolute)/).test(helper.css("position")))
+ helper.css("position", "absolute");
+
+ return helper;
+
+ },
+
+ _adjustOffsetFromHelper: function(obj) {
+ if (typeof obj == 'string') {
+ obj = obj.split(' ');
+ }
+ if ($.isArray(obj)) {
+ obj = {left: +obj[0], top: +obj[1] || 0};
+ }
+ if ('left' in obj) {
+ this.offset.click.left = obj.left + this.margins.left;
+ }
+ if ('right' in obj) {
+ this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
+ }
+ if ('top' in obj) {
+ this.offset.click.top = obj.top + this.margins.top;
+ }
+ if ('bottom' in obj) {
+ this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
+ }
+ },
+
+ _getParentOffset: function() {
+
+ //Get the offsetParent and cache its position
+ this.offsetParent = this.helper.offsetParent();
+ var po = this.offsetParent.offset();
+
+ // This is a special case where we need to modify a offset calculated on start, since the following happened:
+ // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
+ // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
+ // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
+ if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) {
+ po.left += this.scrollParent.scrollLeft();
+ po.top += this.scrollParent.scrollTop();
+ }
+
+ if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information
+ || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.browser.msie)) //Ugly IE fix
+ po = { top: 0, left: 0 };
+
+ return {
+ top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
+ left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
+ };
+
+ },
+
+ _getRelativeOffset: function() {
+
+ if(this.cssPosition == "relative") {
+ var p = this.element.position();
+ return {
+ top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
+ left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
+ };
+ } else {
+ return { top: 0, left: 0 };
+ }
+
+ },
+
+ _cacheMargins: function() {
+ this.margins = {
+ left: (parseInt(this.element.css("marginLeft"),10) || 0),
+ top: (parseInt(this.element.css("marginTop"),10) || 0),
+ right: (parseInt(this.element.css("marginRight"),10) || 0),
+ bottom: (parseInt(this.element.css("marginBottom"),10) || 0)
+ };
+ },
+
+ _cacheHelperProportions: function() {
+ this.helperProportions = {
+ width: this.helper.outerWidth(),
+ height: this.helper.outerHeight()
+ };
+ },
+
+ _setContainment: function() {
+
+ var o = this.options;
+ if(o.containment == 'parent') o.containment = this.helper[0].parentNode;
+ if(o.containment == 'document' || o.containment == 'window') this.containment = [
+ o.containment == 'document' ? 0 : $(window).scrollLeft() - this.offset.relative.left - this.offset.parent.left,
+ o.containment == 'document' ? 0 : $(window).scrollTop() - this.offset.relative.top - this.offset.parent.top,
+ (o.containment == 'document' ? 0 : $(window).scrollLeft()) + $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left,
+ (o.containment == 'document' ? 0 : $(window).scrollTop()) + ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
+ ];
+
+ if(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor != Array) {
+ var c = $(o.containment);
+ var ce = c[0]; if(!ce) return;
+ var co = c.offset();
+ var over = ($(ce).css("overflow") != 'hidden');
+
+ this.containment = [
+ (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0),
+ (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0),
+ (over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left - this.margins.right,
+ (over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top - this.margins.bottom
+ ];
+ this.relative_container = c;
+
+ } else if(o.containment.constructor == Array) {
+ this.containment = o.containment;
+ }
+
+ },
+
+ _convertPositionTo: function(d, pos) {
+
+ if(!pos) pos = this.position;
+ var mod = d == "absolute" ? 1 : -1;
+ var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
+
+ return {
+ top: (
+ pos.top // The absolute mouse position
+ + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent
+ + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border)
+ - ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
+ ),
+ left: (
+ pos.left // The absolute mouse position
+ + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent
+ + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border)
+ - ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
+ )
+ };
+
+ },
+
+ _generatePosition: function(event) {
+
+ var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
+ var pageX = event.pageX;
+ var pageY = event.pageY;
+
+ /*
+ * - Position constraining -
+ * Constrain the position to a mix of grid, containment.
+ */
+
+ if(this.originalPosition) { //If we are not dragging yet, we won't check for options
+ var containment;
+ if(this.containment) {
+ if (this.relative_container){
+ var co = this.relative_container.offset();
+ containment = [ this.containment[0] + co.left,
+ this.containment[1] + co.top,
+ this.containment[2] + co.left,
+ this.containment[3] + co.top ];
+ }
+ else {
+ containment = this.containment;
+ }
+
+ if(event.pageX - this.offset.click.left < containment[0]) pageX = containment[0] + this.offset.click.left;
+ if(event.pageY - this.offset.click.top < containment[1]) pageY = containment[1] + this.offset.click.top;
+ if(event.pageX - this.offset.click.left > containment[2]) pageX = containment[2] + this.offset.click.left;
+ if(event.pageY - this.offset.click.top > containment[3]) pageY = containment[3] + this.offset.click.top;
+ }
+
+ if(o.grid) {
+ //Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950)
+ var top = o.grid[1] ? this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY;
+ pageY = containment ? (!(top - this.offset.click.top < containment[1] || top - this.offset.click.top > containment[3]) ? top : (!(top - this.offset.click.top < containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
+
+ var left = o.grid[0] ? this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : this.originalPageX;
+ pageX = containment ? (!(left - this.offset.click.left < containment[0] || left - this.offset.click.left > containment[2]) ? left : (!(left - this.offset.click.left < containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
+ }
+
+ }
+
+ return {
+ top: (
+ pageY // The absolute mouse position
+ - this.offset.click.top // Click offset (relative to the element)
+ - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent
+ - this.offset.parent.top // The offsetParent's offset without borders (offset + border)
+ + ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
+ ),
+ left: (
+ pageX // The absolute mouse position
+ - this.offset.click.left // Click offset (relative to the element)
+ - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent
+ - this.offset.parent.left // The offsetParent's offset without borders (offset + border)
+ + ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
+ )
+ };
+
+ },
+
+ _clear: function() {
+ this.helper.removeClass("ui-draggable-dragging");
+ if(this.helper[0] != this.element[0] && !this.cancelHelperRemoval) this.helper.remove();
+ //if($.ui.ddmanager) $.ui.ddmanager.current = null;
+ this.helper = null;
+ this.cancelHelperRemoval = false;
+ },
+
+ // From now on bulk stuff - mainly helpers
+
+ _trigger: function(type, event, ui) {
+ ui = ui || this._uiHash();
+ $.ui.plugin.call(this, type, [event, ui]);
+ if(type == "drag") this.positionAbs = this._convertPositionTo("absolute"); //The absolute position has to be recalculated after plugins
+ return $.Widget.prototype._trigger.call(this, type, event, ui);
+ },
+
+ plugins: {},
+
+ _uiHash: function(event) {
+ return {
+ helper: this.helper,
+ position: this.position,
+ originalPosition: this.originalPosition,
+ offset: this.positionAbs
+ };
+ }
+
+});
+
+$.extend($.ui.draggable, {
+ version: "1.8.18"
+});
+
+$.ui.plugin.add("draggable", "connectToSortable", {
+ start: function(event, ui) {
+
+ var inst = $(this).data("draggable"), o = inst.options,
+ uiSortable = $.extend({}, ui, { item: inst.element });
+ inst.sortables = [];
+ $(o.connectToSortable).each(function() {
+ var sortable = $.data(this, 'sortable');
+ if (sortable && !sortable.options.disabled) {
+ inst.sortables.push({
+ instance: sortable,
+ shouldRevert: sortable.options.revert
+ });
+ sortable.refreshPositions(); // Call the sortable's refreshPositions at drag start to refresh the containerCache since the sortable container cache is used in drag and needs to be up to date (this will ensure it's initialised as well as being kept in step with any changes that might have happened on the page).
+ sortable._trigger("activate", event, uiSortable);
+ }
+ });
+
+ },
+ stop: function(event, ui) {
+
+ //If we are still over the sortable, we fake the stop event of the sortable, but also remove helper
+ var inst = $(this).data("draggable"),
+ uiSortable = $.extend({}, ui, { item: inst.element });
+
+ $.each(inst.sortables, function() {
+ if(this.instance.isOver) {
+
+ this.instance.isOver = 0;
+
+ inst.cancelHelperRemoval = true; //Don't remove the helper in the draggable instance
+ this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work)
+
+ //The sortable revert is supported, and we have to set a temporary dropped variable on the draggable to support revert: 'valid/invalid'
+ if(this.shouldRevert) this.instance.options.revert = true;
+
+ //Trigger the stop of the sortable
+ this.instance._mouseStop(event);
+
+ this.instance.options.helper = this.instance.options._helper;
+
+ //If the helper has been the original item, restore properties in the sortable
+ if(inst.options.helper == 'original')
+ this.instance.currentItem.css({ top: 'auto', left: 'auto' });
+
+ } else {
+ this.instance.cancelHelperRemoval = false; //Remove the helper in the sortable instance
+ this.instance._trigger("deactivate", event, uiSortable);
+ }
+
+ });
+
+ },
+ drag: function(event, ui) {
+
+ var inst = $(this).data("draggable"), self = this;
+
+ var checkPos = function(o) {
+ var dyClick = this.offset.click.top, dxClick = this.offset.click.left;
+ var helperTop = this.positionAbs.top, helperLeft = this.positionAbs.left;
+ var itemHeight = o.height, itemWidth = o.width;
+ var itemTop = o.top, itemLeft = o.left;
+
+ return $.ui.isOver(helperTop + dyClick, helperLeft + dxClick, itemTop, itemLeft, itemHeight, itemWidth);
+ };
+
+ $.each(inst.sortables, function(i) {
+
+ //Copy over some variables to allow calling the sortable's native _intersectsWith
+ this.instance.positionAbs = inst.positionAbs;
+ this.instance.helperProportions = inst.helperProportions;
+ this.instance.offset.click = inst.offset.click;
+
+ if(this.instance._intersectsWith(this.instance.containerCache)) {
+
+ //If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once
+ if(!this.instance.isOver) {
+
+ this.instance.isOver = 1;
+ //Now we fake the start of dragging for the sortable instance,
+ //by cloning the list group item, appending it to the sortable and using it as inst.currentItem
+ //We can then fire the start event of the sortable with our passed browser event, and our own helper (so it doesn't create a new one)
+ this.instance.currentItem = $(self).clone().removeAttr('id').appendTo(this.instance.element).data("sortable-item", true);
+ this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it
+ this.instance.options.helper = function() { return ui.helper[0]; };
+
+ event.target = this.instance.currentItem[0];
+ this.instance._mouseCapture(event, true);
+ this.instance._mouseStart(event, true, true);
+
+ //Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes
+ this.instance.offset.click.top = inst.offset.click.top;
+ this.instance.offset.click.left = inst.offset.click.left;
+ this.instance.offset.parent.left -= inst.offset.parent.left - this.instance.offset.parent.left;
+ this.instance.offset.parent.top -= inst.offset.parent.top - this.instance.offset.parent.top;
+
+ inst._trigger("toSortable", event);
+ inst.dropped = this.instance.element; //draggable revert needs that
+ //hack so receive/update callbacks work (mostly)
+ inst.currentItem = inst.element;
+ this.instance.fromOutside = inst;
+
+ }
+
+ //Provided we did all the previous steps, we can fire the drag event of the sortable on every draggable drag, when it intersects with the sortable
+ if(this.instance.currentItem) this.instance._mouseDrag(event);
+
+ } else {
+
+ //If it doesn't intersect with the sortable, and it intersected before,
+ //we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval
+ if(this.instance.isOver) {
+
+ this.instance.isOver = 0;
+ this.instance.cancelHelperRemoval = true;
+
+ //Prevent reverting on this forced stop
+ this.instance.options.revert = false;
+
+ // The out event needs to be triggered independently
+ this.instance._trigger('out', event, this.instance._uiHash(this.instance));
+
+ this.instance._mouseStop(event, true);
+ this.instance.options.helper = this.instance.options._helper;
+
+ //Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size
+ this.instance.currentItem.remove();
+ if(this.instance.placeholder) this.instance.placeholder.remove();
+
+ inst._trigger("fromSortable", event);
+ inst.dropped = false; //draggable revert needs that
+ }
+
+ };
+
+ });
+
+ }
+});
+
+$.ui.plugin.add("draggable", "cursor", {
+ start: function(event, ui) {
+ var t = $('body'), o = $(this).data('draggable').options;
+ if (t.css("cursor")) o._cursor = t.css("cursor");
+ t.css("cursor", o.cursor);
+ },
+ stop: function(event, ui) {
+ var o = $(this).data('draggable').options;
+ if (o._cursor) $('body').css("cursor", o._cursor);
+ }
+});
+
+$.ui.plugin.add("draggable", "opacity", {
+ start: function(event, ui) {
+ var t = $(ui.helper), o = $(this).data('draggable').options;
+ if(t.css("opacity")) o._opacity = t.css("opacity");
+ t.css('opacity', o.opacity);
+ },
+ stop: function(event, ui) {
+ var o = $(this).data('draggable').options;
+ if(o._opacity) $(ui.helper).css('opacity', o._opacity);
+ }
+});
+
+$.ui.plugin.add("draggable", "scroll", {
+ start: function(event, ui) {
+ var i = $(this).data("draggable");
+ if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') i.overflowOffset = i.scrollParent.offset();
+ },
+ drag: function(event, ui) {
+
+ var i = $(this).data("draggable"), o = i.options, scrolled = false;
+
+ if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') {
+
+ if(!o.axis || o.axis != 'x') {
+ if((i.overflowOffset.top + i.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity)
+ i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop + o.scrollSpeed;
+ else if(event.pageY - i.overflowOffset.top < o.scrollSensitivity)
+ i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop - o.scrollSpeed;
+ }
+
+ if(!o.axis || o.axis != 'y') {
+ if((i.overflowOffset.left + i.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity)
+ i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft + o.scrollSpeed;
+ else if(event.pageX - i.overflowOffset.left < o.scrollSensitivity)
+ i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft - o.scrollSpeed;
+ }
+
+ } else {
+
+ if(!o.axis || o.axis != 'x') {
+ if(event.pageY - $(document).scrollTop() < o.scrollSensitivity)
+ scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
+ else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity)
+ scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
+ }
+
+ if(!o.axis || o.axis != 'y') {
+ if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity)
+ scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
+ else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
+ scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
+ }
+
+ }
+
+ if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour)
+ $.ui.ddmanager.prepareOffsets(i, event);
+
+ }
+});
+
+$.ui.plugin.add("draggable", "snap", {
+ start: function(event, ui) {
+
+ var i = $(this).data("draggable"), o = i.options;
+ i.snapElements = [];
+
+ $(o.snap.constructor != String ? ( o.snap.items || ':data(draggable)' ) : o.snap).each(function() {
+ var $t = $(this); var $o = $t.offset();
+ if(this != i.element[0]) i.snapElements.push({
+ item: this,
+ width: $t.outerWidth(), height: $t.outerHeight(),
+ top: $o.top, left: $o.left
+ });
+ });
+
+ },
+ drag: function(event, ui) {
+
+ var inst = $(this).data("draggable"), o = inst.options;
+ var d = o.snapTolerance;
+
+ var x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,
+ y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height;
+
+ for (var i = inst.snapElements.length - 1; i >= 0; i--){
+
+ var l = inst.snapElements[i].left, r = l + inst.snapElements[i].width,
+ t = inst.snapElements[i].top, b = t + inst.snapElements[i].height;
+
+ //Yes, I know, this is insane ;)
+ if(!((l-d < x1 && x1 < r+d && t-d < y1 && y1 < b+d) || (l-d < x1 && x1 < r+d && t-d < y2 && y2 < b+d) || (l-d < x2 && x2 < r+d && t-d < y1 && y1 < b+d) || (l-d < x2 && x2 < r+d && t-d < y2 && y2 < b+d))) {
+ if(inst.snapElements[i].snapping) (inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
+ inst.snapElements[i].snapping = false;
+ continue;
+ }
+
+ if(o.snapMode != 'inner') {
+ var ts = Math.abs(t - y2) <= d;
+ var bs = Math.abs(b - y1) <= d;
+ var ls = Math.abs(l - x2) <= d;
+ var rs = Math.abs(r - x1) <= d;
+ if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
+ if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top - inst.margins.top;
+ if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left - inst.margins.left;
+ if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left - inst.margins.left;
+ }
+
+ var first = (ts || bs || ls || rs);
+
+ if(o.snapMode != 'outer') {
+ var ts = Math.abs(t - y1) <= d;
+ var bs = Math.abs(b - y2) <= d;
+ var ls = Math.abs(l - x1) <= d;
+ var rs = Math.abs(r - x2) <= d;
+ if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top - inst.margins.top;
+ if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
+ if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left - inst.margins.left;
+ if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left - inst.margins.left;
+ }
+
+ if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first))
+ (inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
+ inst.snapElements[i].snapping = (ts || bs || ls || rs || first);
+
+ };
+
+ }
+});
+
+$.ui.plugin.add("draggable", "stack", {
+ start: function(event, ui) {
+
+ var o = $(this).data("draggable").options;
+
+ var group = $.makeArray($(o.stack)).sort(function(a,b) {
+ return (parseInt($(a).css("zIndex"),10) || 0) - (parseInt($(b).css("zIndex"),10) || 0);
+ });
+ if (!group.length) { return; }
+
+ var min = parseInt(group[0].style.zIndex) || 0;
+ $(group).each(function(i) {
+ this.style.zIndex = min + i;
+ });
+
+ this[0].style.zIndex = min + group.length;
+
+ }
+});
+
+$.ui.plugin.add("draggable", "zIndex", {
+ start: function(event, ui) {
+ var t = $(ui.helper), o = $(this).data("draggable").options;
+ if(t.css("zIndex")) o._zIndex = t.css("zIndex");
+ t.css('zIndex', o.zIndex);
+ },
+ stop: function(event, ui) {
+ var o = $(this).data("draggable").options;
+ if(o._zIndex) $(ui.helper).css('zIndex', o._zIndex);
+ }
+});
+
+})(jQuery);
+/*
+ * jQuery UI Droppable 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Droppables
+ *
+ * Depends:
+ * jquery.ui.core.js
+ * jquery.ui.widget.js
+ * jquery.ui.mouse.js
+ * jquery.ui.draggable.js
+ */
+(function( $, undefined ) {
+
+$.widget("ui.droppable", {
+ widgetEventPrefix: "drop",
+ options: {
+ accept: '*',
+ activeClass: false,
+ addClasses: true,
+ greedy: false,
+ hoverClass: false,
+ scope: 'default',
+ tolerance: 'intersect'
+ },
+ _create: function() {
+
+ var o = this.options, accept = o.accept;
+ this.isover = 0; this.isout = 1;
+
+ this.accept = $.isFunction(accept) ? accept : function(d) {
+ return d.is(accept);
+ };
+
+ //Store the droppable's proportions
+ this.proportions = { width: this.element[0].offsetWidth, height: this.element[0].offsetHeight };
+
+ // Add the reference and positions to the manager
+ $.ui.ddmanager.droppables[o.scope] = $.ui.ddmanager.droppables[o.scope] || [];
+ $.ui.ddmanager.droppables[o.scope].push(this);
+
+ (o.addClasses && this.element.addClass("ui-droppable"));
+
+ },
+
+ destroy: function() {
+ var drop = $.ui.ddmanager.droppables[this.options.scope];
+ for ( var i = 0; i < drop.length; i++ )
+ if ( drop[i] == this )
+ drop.splice(i, 1);
+
+ this.element
+ .removeClass("ui-droppable ui-droppable-disabled")
+ .removeData("droppable")
+ .unbind(".droppable");
+
+ return this;
+ },
+
+ _setOption: function(key, value) {
+
+ if(key == 'accept') {
+ this.accept = $.isFunction(value) ? value : function(d) {
+ return d.is(value);
+ };
+ }
+ $.Widget.prototype._setOption.apply(this, arguments);
+ },
+
+ _activate: function(event) {
+ var draggable = $.ui.ddmanager.current;
+ if(this.options.activeClass) this.element.addClass(this.options.activeClass);
+ (draggable && this._trigger('activate', event, this.ui(draggable)));
+ },
+
+ _deactivate: function(event) {
+ var draggable = $.ui.ddmanager.current;
+ if(this.options.activeClass) this.element.removeClass(this.options.activeClass);
+ (draggable && this._trigger('deactivate', event, this.ui(draggable)));
+ },
+
+ _over: function(event) {
+
+ var draggable = $.ui.ddmanager.current;
+ if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
+
+ if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
+ if(this.options.hoverClass) this.element.addClass(this.options.hoverClass);
+ this._trigger('over', event, this.ui(draggable));
+ }
+
+ },
+
+ _out: function(event) {
+
+ var draggable = $.ui.ddmanager.current;
+ if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
+
+ if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
+ if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);
+ this._trigger('out', event, this.ui(draggable));
+ }
+
+ },
+
+ _drop: function(event,custom) {
+
+ var draggable = custom || $.ui.ddmanager.current;
+ if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element
+
+ var childrenIntersection = false;
+ this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function() {
+ var inst = $.data(this, 'droppable');
+ if(
+ inst.options.greedy
+ && !inst.options.disabled
+ && inst.options.scope == draggable.options.scope
+ && inst.accept.call(inst.element[0], (draggable.currentItem || draggable.element))
+ && $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance)
+ ) { childrenIntersection = true; return false; }
+ });
+ if(childrenIntersection) return false;
+
+ if(this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
+ if(this.options.activeClass) this.element.removeClass(this.options.activeClass);
+ if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);
+ this._trigger('drop', event, this.ui(draggable));
+ return this.element;
+ }
+
+ return false;
+
+ },
+
+ ui: function(c) {
+ return {
+ draggable: (c.currentItem || c.element),
+ helper: c.helper,
+ position: c.position,
+ offset: c.positionAbs
+ };
+ }
+
+});
+
+$.extend($.ui.droppable, {
+ version: "1.8.18"
+});
+
+$.ui.intersect = function(draggable, droppable, toleranceMode) {
+
+ if (!droppable.offset) return false;
+
+ var x1 = (draggable.positionAbs || draggable.position.absolute).left, x2 = x1 + draggable.helperProportions.width,
+ y1 = (draggable.positionAbs || draggable.position.absolute).top, y2 = y1 + draggable.helperProportions.height;
+ var l = droppable.offset.left, r = l + droppable.proportions.width,
+ t = droppable.offset.top, b = t + droppable.proportions.height;
+
+ switch (toleranceMode) {
+ case 'fit':
+ return (l <= x1 && x2 <= r
+ && t <= y1 && y2 <= b);
+ break;
+ case 'intersect':
+ return (l < x1 + (draggable.helperProportions.width / 2) // Right Half
+ && x2 - (draggable.helperProportions.width / 2) < r // Left Half
+ && t < y1 + (draggable.helperProportions.height / 2) // Bottom Half
+ && y2 - (draggable.helperProportions.height / 2) < b ); // Top Half
+ break;
+ case 'pointer':
+ var draggableLeft = ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left),
+ draggableTop = ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top),
+ isOver = $.ui.isOver(draggableTop, draggableLeft, t, l, droppable.proportions.height, droppable.proportions.width);
+ return isOver;
+ break;
+ case 'touch':
+ return (
+ (y1 >= t && y1 <= b) || // Top edge touching
+ (y2 >= t && y2 <= b) || // Bottom edge touching
+ (y1 < t && y2 > b) // Surrounded vertically
+ ) && (
+ (x1 >= l && x1 <= r) || // Left edge touching
+ (x2 >= l && x2 <= r) || // Right edge touching
+ (x1 < l && x2 > r) // Surrounded horizontally
+ );
+ break;
+ default:
+ return false;
+ break;
+ }
+
+};
+
+/*
+ This manager tracks offsets of draggables and droppables
+*/
+$.ui.ddmanager = {
+ current: null,
+ droppables: { 'default': [] },
+ prepareOffsets: function(t, event) {
+
+ var m = $.ui.ddmanager.droppables[t.options.scope] || [];
+ var type = event ? event.type : null; // workaround for #2317
+ var list = (t.currentItem || t.element).find(":data(droppable)").andSelf();
+
+ droppablesLoop: for (var i = 0; i < m.length; i++) {
+
+ if(m[i].options.disabled || (t && !m[i].accept.call(m[i].element[0],(t.currentItem || t.element)))) continue; //No disabled and non-accepted
+ for (var j=0; j < list.length; j++) { if(list[j] == m[i].element[0]) { m[i].proportions.height = 0; continue droppablesLoop; } }; //Filter out elements in the current dragged item
+ m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue; //If the element is not visible, continue
+
+ if(type == "mousedown") m[i]._activate.call(m[i], event); //Activate the droppable if used directly from draggables
+
+ m[i].offset = m[i].element.offset();
+ m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight };
+
+ }
+
+ },
+ drop: function(draggable, event) {
+
+ var dropped = false;
+ $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() {
+
+ if(!this.options) return;
+ if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance))
+ dropped = this._drop.call(this, event) || dropped;
+
+ if (!this.options.disabled && this.visible && this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
+ this.isout = 1; this.isover = 0;
+ this._deactivate.call(this, event);
+ }
+
+ });
+ return dropped;
+
+ },
+ dragStart: function( draggable, event ) {
+ //Listen for scrolling so that if the dragging causes scrolling the position of the droppables can be recalculated (see #5003)
+ draggable.element.parents( ":not(body,html)" ).bind( "scroll.droppable", function() {
+ if( !draggable.options.refreshPositions ) $.ui.ddmanager.prepareOffsets( draggable, event );
+ });
+ },
+ drag: function(draggable, event) {
+
+ //If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse.
+ if(draggable.options.refreshPositions) $.ui.ddmanager.prepareOffsets(draggable, event);
+
+ //Run through all droppables and check their positions based on specific tolerance options
+ $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() {
+
+ if(this.options.disabled || this.greedyChild || !this.visible) return;
+ var intersects = $.ui.intersect(draggable, this, this.options.tolerance);
+
+ var c = !intersects && this.isover == 1 ? 'isout' : (intersects && this.isover == 0 ? 'isover' : null);
+ if(!c) return;
+
+ var parentInstance;
+ if (this.options.greedy) {
+ var parent = this.element.parents(':data(droppable):eq(0)');
+ if (parent.length) {
+ parentInstance = $.data(parent[0], 'droppable');
+ parentInstance.greedyChild = (c == 'isover' ? 1 : 0);
+ }
+ }
+
+ // we just moved into a greedy child
+ if (parentInstance && c == 'isover') {
+ parentInstance['isover'] = 0;
+ parentInstance['isout'] = 1;
+ parentInstance._out.call(parentInstance, event);
+ }
+
+ this[c] = 1; this[c == 'isout' ? 'isover' : 'isout'] = 0;
+ this[c == "isover" ? "_over" : "_out"].call(this, event);
+
+ // we just moved out of a greedy child
+ if (parentInstance && c == 'isout') {
+ parentInstance['isout'] = 0;
+ parentInstance['isover'] = 1;
+ parentInstance._over.call(parentInstance, event);
+ }
+ });
+
+ },
+ dragStop: function( draggable, event ) {
+ draggable.element.parents( ":not(body,html)" ).unbind( "scroll.droppable" );
+ //Call prepareOffsets one final time since IE does not fire return scroll events when overflow was caused by drag (see #5003)
+ if( !draggable.options.refreshPositions ) $.ui.ddmanager.prepareOffsets( draggable, event );
+ }
+};
+
+})(jQuery);
+/*
+ * jQuery UI Resizable 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Resizables
+ *
+ * Depends:
+ * jquery.ui.core.js
+ * jquery.ui.mouse.js
+ * jquery.ui.widget.js
+ */
+(function( $, undefined ) {
+
+$.widget("ui.resizable", $.ui.mouse, {
+ widgetEventPrefix: "resize",
+ options: {
+ alsoResize: false,
+ animate: false,
+ animateDuration: "slow",
+ animateEasing: "swing",
+ aspectRatio: false,
+ autoHide: false,
+ containment: false,
+ ghost: false,
+ grid: false,
+ handles: "e,s,se",
+ helper: false,
+ maxHeight: null,
+ maxWidth: null,
+ minHeight: 10,
+ minWidth: 10,
+ zIndex: 1000
+ },
+ _create: function() {
+
+ var self = this, o = this.options;
+ this.element.addClass("ui-resizable");
+
+ $.extend(this, {
+ _aspectRatio: !!(o.aspectRatio),
+ aspectRatio: o.aspectRatio,
+ originalElement: this.element,
+ _proportionallyResizeElements: [],
+ _helper: o.helper || o.ghost || o.animate ? o.helper || 'ui-resizable-helper' : null
+ });
+
+ //Wrap the element if it cannot hold child nodes
+ if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)) {
+
+ //Create a wrapper element and set the wrapper to the new current internal element
+ this.element.wrap(
+ $('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({
+ position: this.element.css('position'),
+ width: this.element.outerWidth(),
+ height: this.element.outerHeight(),
+ top: this.element.css('top'),
+ left: this.element.css('left')
+ })
+ );
+
+ //Overwrite the original this.element
+ this.element = this.element.parent().data(
+ "resizable", this.element.data('resizable')
+ );
+
+ this.elementIsWrapper = true;
+
+ //Move margins to the wrapper
+ this.element.css({ marginLeft: this.originalElement.css("marginLeft"), marginTop: this.originalElement.css("marginTop"), marginRight: this.originalElement.css("marginRight"), marginBottom: this.originalElement.css("marginBottom") });
+ this.originalElement.css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0});
+
+ //Prevent Safari textarea resize
+ this.originalResizeStyle = this.originalElement.css('resize');
+ this.originalElement.css('resize', 'none');
+
+ //Push the actual element to our proportionallyResize internal array
+ this._proportionallyResizeElements.push(this.originalElement.css({ position: 'static', zoom: 1, display: 'block' }));
+
+ // avoid IE jump (hard set the margin)
+ this.originalElement.css({ margin: this.originalElement.css('margin') });
+
+ // fix handlers offset
+ this._proportionallyResize();
+
+ }
+
+ this.handles = o.handles || (!$('.ui-resizable-handle', this.element).length ? "e,s,se" : { n: '.ui-resizable-n', e: '.ui-resizable-e', s: '.ui-resizable-s', w: '.ui-resizable-w', se: '.ui-resizable-se', sw: '.ui-resizable-sw', ne: '.ui-resizable-ne', nw: '.ui-resizable-nw' });
+ if(this.handles.constructor == String) {
+
+ if(this.handles == 'all') this.handles = 'n,e,s,w,se,sw,ne,nw';
+ var n = this.handles.split(","); this.handles = {};
+
+ for(var i = 0; i < n.length; i++) {
+
+ var handle = $.trim(n[i]), hname = 'ui-resizable-'+handle;
+ var axis = $('<div class="ui-resizable-handle ' + hname + '"></div>');
+
+ // increase zIndex of sw, se, ne, nw axis
+ //TODO : this modifies original option
+ if(/sw|se|ne|nw/.test(handle)) axis.css({ zIndex: ++o.zIndex });
+
+ //TODO : What's going on here?
+ if ('se' == handle) {
+ axis.addClass('ui-icon ui-icon-gripsmall-diagonal-se');
+ };
+
+ //Insert into internal handles object and append to element
+ this.handles[handle] = '.ui-resizable-'+handle;
+ this.element.append(axis);
+ }
+
+ }
+
+ this._renderAxis = function(target) {
+
+ target = target || this.element;
+
+ for(var i in this.handles) {
+
+ if(this.handles[i].constructor == String)
+ this.handles[i] = $(this.handles[i], this.element).show();
+
+ //Apply pad to wrapper element, needed to fix axis position (textarea, inputs, scrolls)
+ if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/textarea|input|select|button/i)) {
+
+ var axis = $(this.handles[i], this.element), padWrapper = 0;
+
+ //Checking the correct pad and border
+ padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth();
+
+ //The padding type i have to apply...
+ var padPos = [ 'padding',
+ /ne|nw|n/.test(i) ? 'Top' :
+ /se|sw|s/.test(i) ? 'Bottom' :
+ /^e$/.test(i) ? 'Right' : 'Left' ].join("");
+
+ target.css(padPos, padWrapper);
+
+ this._proportionallyResize();
+
+ }
+
+ //TODO: What's that good for? There's not anything to be executed left
+ if(!$(this.handles[i]).length)
+ continue;
+
+ }
+ };
+
+ //TODO: make renderAxis a prototype function
+ this._renderAxis(this.element);
+
+ this._handles = $('.ui-resizable-handle', this.element)
+ .disableSelection();
+
+ //Matching axis name
+ this._handles.mouseover(function() {
+ if (!self.resizing) {
+ if (this.className)
+ var axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);
+ //Axis, default = se
+ self.axis = axis && axis[1] ? axis[1] : 'se';
+ }
+ });
+
+ //If we want to auto hide the elements
+ if (o.autoHide) {
+ this._handles.hide();
+ $(this.element)
+ .addClass("ui-resizable-autohide")
+ .hover(function() {
+ if (o.disabled) return;
+ $(this).removeClass("ui-resizable-autohide");
+ self._handles.show();
+ },
+ function(){
+ if (o.disabled) return;
+ if (!self.resizing) {
+ $(this).addClass("ui-resizable-autohide");
+ self._handles.hide();
+ }
+ });
+ }
+
+ //Initialize the mouse interaction
+ this._mouseInit();
+
+ },
+
+ destroy: function() {
+
+ this._mouseDestroy();
+
+ var _destroy = function(exp) {
+ $(exp).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing")
+ .removeData("resizable").unbind(".resizable").find('.ui-resizable-handle').remove();
+ };
+
+ //TODO: Unwrap at same DOM position
+ if (this.elementIsWrapper) {
+ _destroy(this.element);
+ var wrapper = this.element;
+ wrapper.after(
+ this.originalElement.css({
+ position: wrapper.css('position'),
+ width: wrapper.outerWidth(),
+ height: wrapper.outerHeight(),
+ top: wrapper.css('top'),
+ left: wrapper.css('left')
+ })
+ ).remove();
+ }
+
+ this.originalElement.css('resize', this.originalResizeStyle);
+ _destroy(this.originalElement);
+
+ return this;
+ },
+
+ _mouseCapture: function(event) {
+ var handle = false;
+ for (var i in this.handles) {
+ if ($(this.handles[i])[0] == event.target) {
+ handle = true;
+ }
+ }
+
+ return !this.options.disabled && handle;
+ },
+
+ _mouseStart: function(event) {
+
+ var o = this.options, iniPos = this.element.position(), el = this.element;
+
+ this.resizing = true;
+ this.documentScroll = { top: $(document).scrollTop(), left: $(document).scrollLeft() };
+
+ // bugfix for http://dev.jquery.com/ticket/1749
+ if (el.is('.ui-draggable') || (/absolute/).test(el.css('position'))) {
+ el.css({ position: 'absolute', top: iniPos.top, left: iniPos.left });
+ }
+
+ this._renderProxy();
+
+ var curleft = num(this.helper.css('left')), curtop = num(this.helper.css('top'));
+
+ if (o.containment) {
+ curleft += $(o.containment).scrollLeft() || 0;
+ curtop += $(o.containment).scrollTop() || 0;
+ }
+
+ //Store needed variables
+ this.offset = this.helper.offset();
+ this.position = { left: curleft, top: curtop };
+ this.size = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
+ this.originalSize = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
+ this.originalPosition = { left: curleft, top: curtop };
+ this.sizeDiff = { width: el.outerWidth() - el.width(), height: el.outerHeight() - el.height() };
+ this.originalMousePosition = { left: event.pageX, top: event.pageY };
+
+ //Aspect Ratio
+ this.aspectRatio = (typeof o.aspectRatio == 'number') ? o.aspectRatio : ((this.originalSize.width / this.originalSize.height) || 1);
+
+ var cursor = $('.ui-resizable-' + this.axis).css('cursor');
+ $('body').css('cursor', cursor == 'auto' ? this.axis + '-resize' : cursor);
+
+ el.addClass("ui-resizable-resizing");
+ this._propagate("start", event);
+ return true;
+ },
+
+ _mouseDrag: function(event) {
+
+ //Increase performance, avoid regex
+ var el = this.helper, o = this.options, props = {},
+ self = this, smp = this.originalMousePosition, a = this.axis;
+
+ var dx = (event.pageX-smp.left)||0, dy = (event.pageY-smp.top)||0;
+ var trigger = this._change[a];
+ if (!trigger) return false;
+
+ // Calculate the attrs that will be change
+ var data = trigger.apply(this, [event, dx, dy]), ie6 = $.browser.msie && $.browser.version < 7, csdif = this.sizeDiff;
+
+ // Put this in the mouseDrag handler since the user can start pressing shift while resizing
+ this._updateVirtualBoundaries(event.shiftKey);
+ if (this._aspectRatio || event.shiftKey)
+ data = this._updateRatio(data, event);
+
+ data = this._respectSize(data, event);
+
+ // plugins callbacks need to be called first
+ this._propagate("resize", event);
+
+ el.css({
+ top: this.position.top + "px", left: this.position.left + "px",
+ width: this.size.width + "px", height: this.size.height + "px"
+ });
+
+ if (!this._helper && this._proportionallyResizeElements.length)
+ this._proportionallyResize();
+
+ this._updateCache(data);
+
+ // calling the user callback at the end
+ this._trigger('resize', event, this.ui());
+
+ return false;
+ },
+
+ _mouseStop: function(event) {
+
+ this.resizing = false;
+ var o = this.options, self = this;
+
+ if(this._helper) {
+ var pr = this._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName),
+ soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height,
+ soffsetw = ista ? 0 : self.sizeDiff.width;
+
+ var s = { width: (self.helper.width() - soffsetw), height: (self.helper.height() - soffseth) },
+ left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null,
+ top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null;
+
+ if (!o.animate)
+ this.element.css($.extend(s, { top: top, left: left }));
+
+ self.helper.height(self.size.height);
+ self.helper.width(self.size.width);
+
+ if (this._helper && !o.animate) this._proportionallyResize();
+ }
+
+ $('body').css('cursor', 'auto');
+
+ this.element.removeClass("ui-resizable-resizing");
+
+ this._propagate("stop", event);
+
+ if (this._helper) this.helper.remove();
+ return false;
+
+ },
+
+ _updateVirtualBoundaries: function(forceAspectRatio) {
+ var o = this.options, pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b;
+
+ b = {
+ minWidth: isNumber(o.minWidth) ? o.minWidth : 0,
+ maxWidth: isNumber(o.maxWidth) ? o.maxWidth : Infinity,
+ minHeight: isNumber(o.minHeight) ? o.minHeight : 0,
+ maxHeight: isNumber(o.maxHeight) ? o.maxHeight : Infinity
+ };
+
+ if(this._aspectRatio || forceAspectRatio) {
+ // We want to create an enclosing box whose aspect ration is the requested one
+ // First, compute the "projected" size for each dimension based on the aspect ratio and other dimension
+ pMinWidth = b.minHeight * this.aspectRatio;
+ pMinHeight = b.minWidth / this.aspectRatio;
+ pMaxWidth = b.maxHeight * this.aspectRatio;
+ pMaxHeight = b.maxWidth / this.aspectRatio;
+
+ if(pMinWidth > b.minWidth) b.minWidth = pMinWidth;
+ if(pMinHeight > b.minHeight) b.minHeight = pMinHeight;
+ if(pMaxWidth < b.maxWidth) b.maxWidth = pMaxWidth;
+ if(pMaxHeight < b.maxHeight) b.maxHeight = pMaxHeight;
+ }
+ this._vBoundaries = b;
+ },
+
+ _updateCache: function(data) {
+ var o = this.options;
+ this.offset = this.helper.offset();
+ if (isNumber(data.left)) this.position.left = data.left;
+ if (isNumber(data.top)) this.position.top = data.top;
+ if (isNumber(data.height)) this.size.height = data.height;
+ if (isNumber(data.width)) this.size.width = data.width;
+ },
+
+ _updateRatio: function(data, event) {
+
+ var o = this.options, cpos = this.position, csize = this.size, a = this.axis;
+
+ if (isNumber(data.height)) data.width = (data.height * this.aspectRatio);
+ else if (isNumber(data.width)) data.height = (data.width / this.aspectRatio);
+
+ if (a == 'sw') {
+ data.left = cpos.left + (csize.width - data.width);
+ data.top = null;
+ }
+ if (a == 'nw') {
+ data.top = cpos.top + (csize.height - data.height);
+ data.left = cpos.left + (csize.width - data.width);
+ }
+
+ return data;
+ },
+
+ _respectSize: function(data, event) {
+
+ var el = this.helper, o = this._vBoundaries, pRatio = this._aspectRatio || event.shiftKey, a = this.axis,
+ ismaxw = isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), ismaxh = isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height),
+ isminw = isNumber(data.width) && o.minWidth && (o.minWidth > data.width), isminh = isNumber(data.height) && o.minHeight && (o.minHeight > data.height);
+
+ if (isminw) data.width = o.minWidth;
+ if (isminh) data.height = o.minHeight;
+ if (ismaxw) data.width = o.maxWidth;
+ if (ismaxh) data.height = o.maxHeight;
+
+ var dw = this.originalPosition.left + this.originalSize.width, dh = this.position.top + this.size.height;
+ var cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a);
+
+ if (isminw && cw) data.left = dw - o.minWidth;
+ if (ismaxw && cw) data.left = dw - o.maxWidth;
+ if (isminh && ch) data.top = dh - o.minHeight;
+ if (ismaxh && ch) data.top = dh - o.maxHeight;
+
+ // fixing jump error on top/left - bug #2330
+ var isNotwh = !data.width && !data.height;
+ if (isNotwh && !data.left && data.top) data.top = null;
+ else if (isNotwh && !data.top && data.left) data.left = null;
+
+ return data;
+ },
+
+ _proportionallyResize: function() {
+
+ var o = this.options;
+ if (!this._proportionallyResizeElements.length) return;
+ var element = this.helper || this.element;
+
+ for (var i=0; i < this._proportionallyResizeElements.length; i++) {
+
+ var prel = this._proportionallyResizeElements[i];
+
+ if (!this.borderDif) {
+ var b = [prel.css('borderTopWidth'), prel.css('borderRightWidth'), prel.css('borderBottomWidth'), prel.css('borderLeftWidth')],
+ p = [prel.css('paddingTop'), prel.css('paddingRight'), prel.css('paddingBottom'), prel.css('paddingLeft')];
+
+ this.borderDif = $.map(b, function(v, i) {
+ var border = parseInt(v,10)||0, padding = parseInt(p[i],10)||0;
+ return border + padding;
+ });
+ }
+
+ if ($.browser.msie && !(!($(element).is(':hidden') || $(element).parents(':hidden').length)))
+ continue;
+
+ prel.css({
+ height: (element.height() - this.borderDif[0] - this.borderDif[2]) || 0,
+ width: (element.width() - this.borderDif[1] - this.borderDif[3]) || 0
+ });
+
+ };
+
+ },
+
+ _renderProxy: function() {
+
+ var el = this.element, o = this.options;
+ this.elementOffset = el.offset();
+
+ if(this._helper) {
+
+ this.helper = this.helper || $('<div style="overflow:hidden;"></div>');
+
+ // fix ie6 offset TODO: This seems broken
+ var ie6 = $.browser.msie && $.browser.version < 7, ie6offset = (ie6 ? 1 : 0),
+ pxyoffset = ( ie6 ? 2 : -1 );
+
+ this.helper.addClass(this._helper).css({
+ width: this.element.outerWidth() + pxyoffset,
+ height: this.element.outerHeight() + pxyoffset,
+ position: 'absolute',
+ left: this.elementOffset.left - ie6offset +'px',
+ top: this.elementOffset.top - ie6offset +'px',
+ zIndex: ++o.zIndex //TODO: Don't modify option
+ });
+
+ this.helper
+ .appendTo("body")
+ .disableSelection();
+
+ } else {
+ this.helper = this.element;
+ }
+
+ },
+
+ _change: {
+ e: function(event, dx, dy) {
+ return { width: this.originalSize.width + dx };
+ },
+ w: function(event, dx, dy) {
+ var o = this.options, cs = this.originalSize, sp = this.originalPosition;
+ return { left: sp.left + dx, width: cs.width - dx };
+ },
+ n: function(event, dx, dy) {
+ var o = this.options, cs = this.originalSize, sp = this.originalPosition;
+ return { top: sp.top + dy, height: cs.height - dy };
+ },
+ s: function(event, dx, dy) {
+ return { height: this.originalSize.height + dy };
+ },
+ se: function(event, dx, dy) {
+ return $.extend(this._change.s.apply(this, arguments), this._change.e.apply(this, [event, dx, dy]));
+ },
+ sw: function(event, dx, dy) {
+ return $.extend(this._change.s.apply(this, arguments), this._change.w.apply(this, [event, dx, dy]));
+ },
+ ne: function(event, dx, dy) {
+ return $.extend(this._change.n.apply(this, arguments), this._change.e.apply(this, [event, dx, dy]));
+ },
+ nw: function(event, dx, dy) {
+ return $.extend(this._change.n.apply(this, arguments), this._change.w.apply(this, [event, dx, dy]));
+ }
+ },
+
+ _propagate: function(n, event) {
+ $.ui.plugin.call(this, n, [event, this.ui()]);
+ (n != "resize" && this._trigger(n, event, this.ui()));
+ },
+
+ plugins: {},
+
+ ui: function() {
+ return {
+ originalElement: this.originalElement,
+ element: this.element,
+ helper: this.helper,
+ position: this.position,
+ size: this.size,
+ originalSize: this.originalSize,
+ originalPosition: this.originalPosition
+ };
+ }
+
+});
+
+$.extend($.ui.resizable, {
+ version: "1.8.18"
+});
+
+/*
+ * Resizable Extensions
+ */
+
+$.ui.plugin.add("resizable", "alsoResize", {
+
+ start: function (event, ui) {
+ var self = $(this).data("resizable"), o = self.options;
+
+ var _store = function (exp) {
+ $(exp).each(function() {
+ var el = $(this);
+ el.data("resizable-alsoresize", {
+ width: parseInt(el.width(), 10), height: parseInt(el.height(), 10),
+ left: parseInt(el.css('left'), 10), top: parseInt(el.css('top'), 10)
+ });
+ });
+ };
+
+ if (typeof(o.alsoResize) == 'object' && !o.alsoResize.parentNode) {
+ if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); }
+ else { $.each(o.alsoResize, function (exp) { _store(exp); }); }
+ }else{
+ _store(o.alsoResize);
+ }
+ },
+
+ resize: function (event, ui) {
+ var self = $(this).data("resizable"), o = self.options, os = self.originalSize, op = self.originalPosition;
+
+ var delta = {
+ height: (self.size.height - os.height) || 0, width: (self.size.width - os.width) || 0,
+ top: (self.position.top - op.top) || 0, left: (self.position.left - op.left) || 0
+ },
+
+ _alsoResize = function (exp, c) {
+ $(exp).each(function() {
+ var el = $(this), start = $(this).data("resizable-alsoresize"), style = {},
+ css = c && c.length ? c : el.parents(ui.originalElement[0]).length ? ['width', 'height'] : ['width', 'height', 'top', 'left'];
+
+ $.each(css, function (i, prop) {
+ var sum = (start[prop]||0) + (delta[prop]||0);
+ if (sum && sum >= 0)
+ style[prop] = sum || null;
+ });
+
+ el.css(style);
+ });
+ };
+
+ if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) {
+ $.each(o.alsoResize, function (exp, c) { _alsoResize(exp, c); });
+ }else{
+ _alsoResize(o.alsoResize);
+ }
+ },
+
+ stop: function (event, ui) {
+ $(this).removeData("resizable-alsoresize");
+ }
+});
+
+$.ui.plugin.add("resizable", "animate", {
+
+ stop: function(event, ui) {
+ var self = $(this).data("resizable"), o = self.options;
+
+ var pr = self._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName),
+ soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height,
+ soffsetw = ista ? 0 : self.sizeDiff.width;
+
+ var style = { width: (self.size.width - soffsetw), height: (self.size.height - soffseth) },
+ left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null,
+ top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null;
+
+ self.element.animate(
+ $.extend(style, top && left ? { top: top, left: left } : {}), {
+ duration: o.animateDuration,
+ easing: o.animateEasing,
+ step: function() {
+
+ var data = {
+ width: parseInt(self.element.css('width'), 10),
+ height: parseInt(self.element.css('height'), 10),
+ top: parseInt(self.element.css('top'), 10),
+ left: parseInt(self.element.css('left'), 10)
+ };
+
+ if (pr && pr.length) $(pr[0]).css({ width: data.width, height: data.height });
+
+ // propagating resize, and updating values for each animation step
+ self._updateCache(data);
+ self._propagate("resize", event);
+
+ }
+ }
+ );
+ }
+
+});
+
+$.ui.plugin.add("resizable", "containment", {
+
+ start: function(event, ui) {
+ var self = $(this).data("resizable"), o = self.options, el = self.element;
+ var oc = o.containment, ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc;
+ if (!ce) return;
+
+ self.containerElement = $(ce);
+
+ if (/document/.test(oc) || oc == document) {
+ self.containerOffset = { left: 0, top: 0 };
+ self.containerPosition = { left: 0, top: 0 };
+
+ self.parentData = {
+ element: $(document), left: 0, top: 0,
+ width: $(document).width(), height: $(document).height() || document.body.parentNode.scrollHeight
+ };
+ }
+
+ // i'm a node, so compute top, left, right, bottom
+ else {
+ var element = $(ce), p = [];
+ $([ "Top", "Right", "Left", "Bottom" ]).each(function(i, name) { p[i] = num(element.css("padding" + name)); });
+
+ self.containerOffset = element.offset();
+ self.containerPosition = element.position();
+ self.containerSize = { height: (element.innerHeight() - p[3]), width: (element.innerWidth() - p[1]) };
+
+ var co = self.containerOffset, ch = self.containerSize.height, cw = self.containerSize.width,
+ width = ($.ui.hasScroll(ce, "left") ? ce.scrollWidth : cw ), height = ($.ui.hasScroll(ce) ? ce.scrollHeight : ch);
+
+ self.parentData = {
+ element: ce, left: co.left, top: co.top, width: width, height: height
+ };
+ }
+ },
+
+ resize: function(event, ui) {
+ var self = $(this).data("resizable"), o = self.options,
+ ps = self.containerSize, co = self.containerOffset, cs = self.size, cp = self.position,
+ pRatio = self._aspectRatio || event.shiftKey, cop = { top:0, left:0 }, ce = self.containerElement;
+
+ if (ce[0] != document && (/static/).test(ce.css('position'))) cop = co;
+
+ if (cp.left < (self._helper ? co.left : 0)) {
+ self.size.width = self.size.width + (self._helper ? (self.position.left - co.left) : (self.position.left - cop.left));
+ if (pRatio) self.size.height = self.size.width / o.aspectRatio;
+ self.position.left = o.helper ? co.left : 0;
+ }
+
+ if (cp.top < (self._helper ? co.top : 0)) {
+ self.size.height = self.size.height + (self._helper ? (self.position.top - co.top) : self.position.top);
+ if (pRatio) self.size.width = self.size.height * o.aspectRatio;
+ self.position.top = self._helper ? co.top : 0;
+ }
+
+ self.offset.left = self.parentData.left+self.position.left;
+ self.offset.top = self.parentData.top+self.position.top;
+
+ var woset = Math.abs( (self._helper ? self.offset.left - cop.left : (self.offset.left - cop.left)) + self.sizeDiff.width ),
+ hoset = Math.abs( (self._helper ? self.offset.top - cop.top : (self.offset.top - co.top)) + self.sizeDiff.height );
+
+ var isParent = self.containerElement.get(0) == self.element.parent().get(0),
+ isOffsetRelative = /relative|absolute/.test(self.containerElement.css('position'));
+
+ if(isParent && isOffsetRelative) woset -= self.parentData.left;
+
+ if (woset + self.size.width >= self.parentData.width) {
+ self.size.width = self.parentData.width - woset;
+ if (pRatio) self.size.height = self.size.width / self.aspectRatio;
+ }
+
+ if (hoset + self.size.height >= self.parentData.height) {
+ self.size.height = self.parentData.height - hoset;
+ if (pRatio) self.size.width = self.size.height * self.aspectRatio;
+ }
+ },
+
+ stop: function(event, ui){
+ var self = $(this).data("resizable"), o = self.options, cp = self.position,
+ co = self.containerOffset, cop = self.containerPosition, ce = self.containerElement;
+
+ var helper = $(self.helper), ho = helper.offset(), w = helper.outerWidth() - self.sizeDiff.width, h = helper.outerHeight() - self.sizeDiff.height;
+
+ if (self._helper && !o.animate && (/relative/).test(ce.css('position')))
+ $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
+
+ if (self._helper && !o.animate && (/static/).test(ce.css('position')))
+ $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
+
+ }
+});
+
+$.ui.plugin.add("resizable", "ghost", {
+
+ start: function(event, ui) {
+
+ var self = $(this).data("resizable"), o = self.options, cs = self.size;
+
+ self.ghost = self.originalElement.clone();
+ self.ghost
+ .css({ opacity: .25, display: 'block', position: 'relative', height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 })
+ .addClass('ui-resizable-ghost')
+ .addClass(typeof o.ghost == 'string' ? o.ghost : '');
+
+ self.ghost.appendTo(self.helper);
+
+ },
+
+ resize: function(event, ui){
+ var self = $(this).data("resizable"), o = self.options;
+ if (self.ghost) self.ghost.css({ position: 'relative', height: self.size.height, width: self.size.width });
+ },
+
+ stop: function(event, ui){
+ var self = $(this).data("resizable"), o = self.options;
+ if (self.ghost && self.helper) self.helper.get(0).removeChild(self.ghost.get(0));
+ }
+
+});
+
+$.ui.plugin.add("resizable", "grid", {
+
+ resize: function(event, ui) {
+ var self = $(this).data("resizable"), o = self.options, cs = self.size, os = self.originalSize, op = self.originalPosition, a = self.axis, ratio = o._aspectRatio || event.shiftKey;
+ o.grid = typeof o.grid == "number" ? [o.grid, o.grid] : o.grid;
+ var ox = Math.round((cs.width - os.width) / (o.grid[0]||1)) * (o.grid[0]||1), oy = Math.round((cs.height - os.height) / (o.grid[1]||1)) * (o.grid[1]||1);
+
+ if (/^(se|s|e)$/.test(a)) {
+ self.size.width = os.width + ox;
+ self.size.height = os.height + oy;
+ }
+ else if (/^(ne)$/.test(a)) {
+ self.size.width = os.width + ox;
+ self.size.height = os.height + oy;
+ self.position.top = op.top - oy;
+ }
+ else if (/^(sw)$/.test(a)) {
+ self.size.width = os.width + ox;
+ self.size.height = os.height + oy;
+ self.position.left = op.left - ox;
+ }
+ else {
+ self.size.width = os.width + ox;
+ self.size.height = os.height + oy;
+ self.position.top = op.top - oy;
+ self.position.left = op.left - ox;
+ }
+ }
+
+});
+
+var num = function(v) {
+ return parseInt(v, 10) || 0;
+};
+
+var isNumber = function(value) {
+ return !isNaN(parseInt(value, 10));
+};
+
+})(jQuery);
+/*
+ * jQuery UI Selectable 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Selectables
+ *
+ * Depends:
+ * jquery.ui.core.js
+ * jquery.ui.mouse.js
+ * jquery.ui.widget.js
+ */
+(function( $, undefined ) {
+
+$.widget("ui.selectable", $.ui.mouse, {
+ options: {
+ appendTo: 'body',
+ autoRefresh: true,
+ distance: 0,
+ filter: '*',
+ tolerance: 'touch'
+ },
+ _create: function() {
+ var self = this;
+
+ this.element.addClass("ui-selectable");
+
+ this.dragged = false;
+
+ // cache selectee children based on filter
+ var selectees;
+ this.refresh = function() {
+ selectees = $(self.options.filter, self.element[0]);
+ selectees.addClass("ui-selectee");
+ selectees.each(function() {
+ var $this = $(this);
+ var pos = $this.offset();
+ $.data(this, "selectable-item", {
+ element: this,
+ $element: $this,
+ left: pos.left,
+ top: pos.top,
+ right: pos.left + $this.outerWidth(),
+ bottom: pos.top + $this.outerHeight(),
+ startselected: false,
+ selected: $this.hasClass('ui-selected'),
+ selecting: $this.hasClass('ui-selecting'),
+ unselecting: $this.hasClass('ui-unselecting')
+ });
+ });
+ };
+ this.refresh();
+
+ this.selectees = selectees.addClass("ui-selectee");
+
+ this._mouseInit();
+
+ this.helper = $("<div class='ui-selectable-helper'></div>");
+ },
+
+ destroy: function() {
+ this.selectees
+ .removeClass("ui-selectee")
+ .removeData("selectable-item");
+ this.element
+ .removeClass("ui-selectable ui-selectable-disabled")
+ .removeData("selectable")
+ .unbind(".selectable");
+ this._mouseDestroy();
+
+ return this;
+ },
+
+ _mouseStart: function(event) {
+ var self = this;
+
+ this.opos = [event.pageX, event.pageY];
+
+ if (this.options.disabled)
+ return;
+
+ var options = this.options;
+
+ this.selectees = $(options.filter, this.element[0]);
+
+ this._trigger("start", event);
+
+ $(options.appendTo).append(this.helper);
+ // position helper (lasso)
+ this.helper.css({
+ "left": event.clientX,
+ "top": event.clientY,
+ "width": 0,
+ "height": 0
+ });
+
+ if (options.autoRefresh) {
+ this.refresh();
+ }
+
+ this.selectees.filter('.ui-selected').each(function() {
+ var selectee = $.data(this, "selectable-item");
+ selectee.startselected = true;
+ if (!event.metaKey && !event.ctrlKey) {
+ selectee.$element.removeClass('ui-selected');
+ selectee.selected = false;
+ selectee.$element.addClass('ui-unselecting');
+ selectee.unselecting = true;
+ // selectable UNSELECTING callback
+ self._trigger("unselecting", event, {
+ unselecting: selectee.element
+ });
+ }
+ });
+
+ $(event.target).parents().andSelf().each(function() {
+ var selectee = $.data(this, "selectable-item");
+ if (selectee) {
+ var doSelect = (!event.metaKey && !event.ctrlKey) || !selectee.$element.hasClass('ui-selected');
+ selectee.$element
+ .removeClass(doSelect ? "ui-unselecting" : "ui-selected")
+ .addClass(doSelect ? "ui-selecting" : "ui-unselecting");
+ selectee.unselecting = !doSelect;
+ selectee.selecting = doSelect;
+ selectee.selected = doSelect;
+ // selectable (UN)SELECTING callback
+ if (doSelect) {
+ self._trigger("selecting", event, {
+ selecting: selectee.element
+ });
+ } else {
+ self._trigger("unselecting", event, {
+ unselecting: selectee.element
+ });
+ }
+ return false;
+ }
+ });
+
+ },
+
+ _mouseDrag: function(event) {
+ var self = this;
+ this.dragged = true;
+
+ if (this.options.disabled)
+ return;
+
+ var options = this.options;
+
+ var x1 = this.opos[0], y1 = this.opos[1], x2 = event.pageX, y2 = event.pageY;
+ if (x1 > x2) { var tmp = x2; x2 = x1; x1 = tmp; }
+ if (y1 > y2) { var tmp = y2; y2 = y1; y1 = tmp; }
+ this.helper.css({left: x1, top: y1, width: x2-x1, height: y2-y1});
+
+ this.selectees.each(function() {
+ var selectee = $.data(this, "selectable-item");
+ //prevent helper from being selected if appendTo: selectable
+ if (!selectee || selectee.element == self.element[0])
+ return;
+ var hit = false;
+ if (options.tolerance == 'touch') {
+ hit = ( !(selectee.left > x2 || selectee.right < x1 || selectee.top > y2 || selectee.bottom < y1) );
+ } else if (options.tolerance == 'fit') {
+ hit = (selectee.left > x1 && selectee.right < x2 && selectee.top > y1 && selectee.bottom < y2);
+ }
+
+ if (hit) {
+ // SELECT
+ if (selectee.selected) {
+ selectee.$element.removeClass('ui-selected');
+ selectee.selected = false;
+ }
+ if (selectee.unselecting) {
+ selectee.$element.removeClass('ui-unselecting');
+ selectee.unselecting = false;
+ }
+ if (!selectee.selecting) {
+ selectee.$element.addClass('ui-selecting');
+ selectee.selecting = true;
+ // selectable SELECTING callback
+ self._trigger("selecting", event, {
+ selecting: selectee.element
+ });
+ }
+ } else {
+ // UNSELECT
+ if (selectee.selecting) {
+ if ((event.metaKey || event.ctrlKey) && selectee.startselected) {
+ selectee.$element.removeClass('ui-selecting');
+ selectee.selecting = false;
+ selectee.$element.addClass('ui-selected');
+ selectee.selected = true;
+ } else {
+ selectee.$element.removeClass('ui-selecting');
+ selectee.selecting = false;
+ if (selectee.startselected) {
+ selectee.$element.addClass('ui-unselecting');
+ selectee.unselecting = true;
+ }
+ // selectable UNSELECTING callback
+ self._trigger("unselecting", event, {
+ unselecting: selectee.element
+ });
+ }
+ }
+ if (selectee.selected) {
+ if (!event.metaKey && !event.ctrlKey && !selectee.startselected) {
+ selectee.$element.removeClass('ui-selected');
+ selectee.selected = false;
+
+ selectee.$element.addClass('ui-unselecting');
+ selectee.unselecting = true;
+ // selectable UNSELECTING callback
+ self._trigger("unselecting", event, {
+ unselecting: selectee.element
+ });
+ }
+ }
+ }
+ });
+
+ return false;
+ },
+
+ _mouseStop: function(event) {
+ var self = this;
+
+ this.dragged = false;
+
+ var options = this.options;
+
+ $('.ui-unselecting', this.element[0]).each(function() {
+ var selectee = $.data(this, "selectable-item");
+ selectee.$element.removeClass('ui-unselecting');
+ selectee.unselecting = false;
+ selectee.startselected = false;
+ self._trigger("unselected", event, {
+ unselected: selectee.element
+ });
+ });
+ $('.ui-selecting', this.element[0]).each(function() {
+ var selectee = $.data(this, "selectable-item");
+ selectee.$element.removeClass('ui-selecting').addClass('ui-selected');
+ selectee.selecting = false;
+ selectee.selected = true;
+ selectee.startselected = true;
+ self._trigger("selected", event, {
+ selected: selectee.element
+ });
+ });
+ this._trigger("stop", event);
+
+ this.helper.remove();
+
+ return false;
+ }
+
+});
+
+$.extend($.ui.selectable, {
+ version: "1.8.18"
+});
+
+})(jQuery);
+/*
+ * jQuery UI Sortable 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Sortables
+ *
+ * Depends:
+ * jquery.ui.core.js
+ * jquery.ui.mouse.js
+ * jquery.ui.widget.js
+ */
+(function( $, undefined ) {
+
+$.widget("ui.sortable", $.ui.mouse, {
+ widgetEventPrefix: "sort",
+ ready: false,
+ options: {
+ appendTo: "parent",
+ axis: false,
+ connectWith: false,
+ containment: false,
+ cursor: 'auto',
+ cursorAt: false,
+ dropOnEmpty: true,
+ forcePlaceholderSize: false,
+ forceHelperSize: false,
+ grid: false,
+ handle: false,
+ helper: "original",
+ items: '> *',
+ opacity: false,
+ placeholder: false,
+ revert: false,
+ scroll: true,
+ scrollSensitivity: 20,
+ scrollSpeed: 20,
+ scope: "default",
+ tolerance: "intersect",
+ zIndex: 1000
+ },
+ _create: function() {
+
+ var o = this.options;
+ this.containerCache = {};
+ this.element.addClass("ui-sortable");
+
+ //Get the items
+ this.refresh();
+
+ //Let's determine if the items are being displayed horizontally
+ this.floating = this.items.length ? o.axis === 'x' || (/left|right/).test(this.items[0].item.css('float')) || (/inline|table-cell/).test(this.items[0].item.css('display')) : false;
+
+ //Let's determine the parent's offset
+ this.offset = this.element.offset();
+
+ //Initialize mouse events for interaction
+ this._mouseInit();
+
+ //We're ready to go
+ this.ready = true
+
+ },
+
+ destroy: function() {
+ $.Widget.prototype.destroy.call( this );
+ this.element
+ .removeClass("ui-sortable ui-sortable-disabled");
+ this._mouseDestroy();
+
+ for ( var i = this.items.length - 1; i >= 0; i-- )
+ this.items[i].item.removeData(this.widgetName + "-item");
+
+ return this;
+ },
+
+ _setOption: function(key, value){
+ if ( key === "disabled" ) {
+ this.options[ key ] = value;
+
+ this.widget()
+ [ value ? "addClass" : "removeClass"]( "ui-sortable-disabled" );
+ } else {
+ // Don't call widget base _setOption for disable as it adds ui-state-disabled class
+ $.Widget.prototype._setOption.apply(this, arguments);
+ }
+ },
+
+ _mouseCapture: function(event, overrideHandle) {
+ var that = this;
+
+ if (this.reverting) {
+ return false;
+ }
+
+ if(this.options.disabled || this.options.type == 'static') return false;
+
+ //We have to refresh the items data once first
+ this._refreshItems(event);
+
+ //Find out if the clicked node (or one of its parents) is a actual item in this.items
+ var currentItem = null, self = this, nodes = $(event.target).parents().each(function() {
+ if($.data(this, that.widgetName + '-item') == self) {
+ currentItem = $(this);
+ return false;
+ }
+ });
+ if($.data(event.target, that.widgetName + '-item') == self) currentItem = $(event.target);
+
+ if(!currentItem) return false;
+ if(this.options.handle && !overrideHandle) {
+ var validHandle = false;
+
+ $(this.options.handle, currentItem).find("*").andSelf().each(function() { if(this == event.target) validHandle = true; });
+ if(!validHandle) return false;
+ }
+
+ this.currentItem = currentItem;
+ this._removeCurrentsFromItems();
+ return true;
+
+ },
+
+ _mouseStart: function(event, overrideHandle, noActivation) {
+
+ var o = this.options, self = this;
+ this.currentContainer = this;
+
+ //We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture
+ this.refreshPositions();
+
+ //Create and append the visible helper
+ this.helper = this._createHelper(event);
+
+ //Cache the helper size
+ this._cacheHelperProportions();
+
+ /*
+ * - Position generation -
+ * This block generates everything position related - it's the core of draggables.
+ */
+
+ //Cache the margins of the original element
+ this._cacheMargins();
+
+ //Get the next scrolling parent
+ this.scrollParent = this.helper.scrollParent();
+
+ //The element's absolute position on the page minus margins
+ this.offset = this.currentItem.offset();
+ this.offset = {
+ top: this.offset.top - this.margins.top,
+ left: this.offset.left - this.margins.left
+ };
+
+ // Only after we got the offset, we can change the helper's position to absolute
+ // TODO: Still need to figure out a way to make relative sorting possible
+ this.helper.css("position", "absolute");
+ this.cssPosition = this.helper.css("position");
+
+ $.extend(this.offset, {
+ click: { //Where the click happened, relative to the element
+ left: event.pageX - this.offset.left,
+ top: event.pageY - this.offset.top
+ },
+ parent: this._getParentOffset(),
+ relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
+ });
+
+ //Generate the original position
+ this.originalPosition = this._generatePosition(event);
+ this.originalPageX = event.pageX;
+ this.originalPageY = event.pageY;
+
+ //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied
+ (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
+
+ //Cache the former DOM position
+ this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] };
+
+ //If the helper is not the original, hide the original so it's not playing any role during the drag, won't cause anything bad this way
+ if(this.helper[0] != this.currentItem[0]) {
+ this.currentItem.hide();
+ }
+
+ //Create the placeholder
+ this._createPlaceholder();
+
+ //Set a containment if given in the options
+ if(o.containment)
+ this._setContainment();
+
+ if(o.cursor) { // cursor option
+ if ($('body').css("cursor")) this._storedCursor = $('body').css("cursor");
+ $('body').css("cursor", o.cursor);
+ }
+
+ if(o.opacity) { // opacity option
+ if (this.helper.css("opacity")) this._storedOpacity = this.helper.css("opacity");
+ this.helper.css("opacity", o.opacity);
+ }
+
+ if(o.zIndex) { // zIndex option
+ if (this.helper.css("zIndex")) this._storedZIndex = this.helper.css("zIndex");
+ this.helper.css("zIndex", o.zIndex);
+ }
+
+ //Prepare scrolling
+ if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML')
+ this.overflowOffset = this.scrollParent.offset();
+
+ //Call callbacks
+ this._trigger("start", event, this._uiHash());
+
+ //Recache the helper size
+ if(!this._preserveHelperProportions)
+ this._cacheHelperProportions();
+
+
+ //Post 'activate' events to possible containers
+ if(!noActivation) {
+ for (var i = this.containers.length - 1; i >= 0; i--) { this.containers[i]._trigger("activate", event, self._uiHash(this)); }
+ }
+
+ //Prepare possible droppables
+ if($.ui.ddmanager)
+ $.ui.ddmanager.current = this;
+
+ if ($.ui.ddmanager && !o.dropBehaviour)
+ $.ui.ddmanager.prepareOffsets(this, event);
+
+ this.dragging = true;
+
+ this.helper.addClass("ui-sortable-helper");
+ this._mouseDrag(event); //Execute the drag once - this causes the helper not to be visible before getting its correct position
+ return true;
+
+ },
+
+ _mouseDrag: function(event) {
+
+ //Compute the helpers position
+ this.position = this._generatePosition(event);
+ this.positionAbs = this._convertPositionTo("absolute");
+
+ if (!this.lastPositionAbs) {
+ this.lastPositionAbs = this.positionAbs;
+ }
+
+ //Do scrolling
+ if(this.options.scroll) {
+ var o = this.options, scrolled = false;
+ if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') {
+
+ if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity)
+ this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed;
+ else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity)
+ this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;
+
+ if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity)
+ this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed;
+ else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity)
+ this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed;
+
+ } else {
+
+ if(event.pageY - $(document).scrollTop() < o.scrollSensitivity)
+ scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
+ else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity)
+ scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
+
+ if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity)
+ scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
+ else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
+ scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
+
+ }
+
+ if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour)
+ $.ui.ddmanager.prepareOffsets(this, event);
+ }
+
+ //Regenerate the absolute position used for position checks
+ this.positionAbs = this._convertPositionTo("absolute");
+
+ //Set the helper position
+ if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px';
+ if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px';
+
+ //Rearrange
+ for (var i = this.items.length - 1; i >= 0; i--) {
+
+ //Cache variables and intersection, continue if no intersection
+ var item = this.items[i], itemElement = item.item[0], intersection = this._intersectsWithPointer(item);
+ if (!intersection) continue;
+
+ if(itemElement != this.currentItem[0] //cannot intersect with itself
+ && this.placeholder[intersection == 1 ? "next" : "prev"]()[0] != itemElement //no useless actions that have been done before
+ && !$.ui.contains(this.placeholder[0], itemElement) //no action if the item moved is the parent of the item checked
+ && (this.options.type == 'semi-dynamic' ? !$.ui.contains(this.element[0], itemElement) : true)
+ //&& itemElement.parentNode == this.placeholder[0].parentNode // only rearrange items within the same container
+ ) {
+
+ this.direction = intersection == 1 ? "down" : "up";
+
+ if (this.options.tolerance == "pointer" || this._intersectsWithSides(item)) {
+ this._rearrange(event, item);
+ } else {
+ break;
+ }
+
+ this._trigger("change", event, this._uiHash());
+ break;
+ }
+ }
+
+ //Post events to containers
+ this._contactContainers(event);
+
+ //Interconnect with droppables
+ if($.ui.ddmanager) $.ui.ddmanager.drag(this, event);
+
+ //Call callbacks
+ this._trigger('sort', event, this._uiHash());
+
+ this.lastPositionAbs = this.positionAbs;
+ return false;
+
+ },
+
+ _mouseStop: function(event, noPropagation) {
+
+ if(!event) return;
+
+ //If we are using droppables, inform the manager about the drop
+ if ($.ui.ddmanager && !this.options.dropBehaviour)
+ $.ui.ddmanager.drop(this, event);
+
+ if(this.options.revert) {
+ var self = this;
+ var cur = self.placeholder.offset();
+
+ self.reverting = true;
+
+ $(this.helper).animate({
+ left: cur.left - this.offset.parent.left - self.margins.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft),
+ top: cur.top - this.offset.parent.top - self.margins.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop)
+ }, parseInt(this.options.revert, 10) || 500, function() {
+ self._clear(event);
+ });
+ } else {
+ this._clear(event, noPropagation);
+ }
+
+ return false;
+
+ },
+
+ cancel: function() {
+
+ var self = this;
+
+ if(this.dragging) {
+
+ this._mouseUp({ target: null });
+
+ if(this.options.helper == "original")
+ this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
+ else
+ this.currentItem.show();
+
+ //Post deactivating events to containers
+ for (var i = this.containers.length - 1; i >= 0; i--){
+ this.containers[i]._trigger("deactivate", null, self._uiHash(this));
+ if(this.containers[i].containerCache.over) {
+ this.containers[i]._trigger("out", null, self._uiHash(this));
+ this.containers[i].containerCache.over = 0;
+ }
+ }
+
+ }
+
+ if (this.placeholder) {
+ //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
+ if(this.placeholder[0].parentNode) this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
+ if(this.options.helper != "original" && this.helper && this.helper[0].parentNode) this.helper.remove();
+
+ $.extend(this, {
+ helper: null,
+ dragging: false,
+ reverting: false,
+ _noFinalSort: null
+ });
+
+ if(this.domPosition.prev) {
+ $(this.domPosition.prev).after(this.currentItem);
+ } else {
+ $(this.domPosition.parent).prepend(this.currentItem);
+ }
+ }
+
+ return this;
+
+ },
+
+ serialize: function(o) {
+
+ var items = this._getItemsAsjQuery(o && o.connected);
+ var str = []; o = o || {};
+
+ $(items).each(function() {
+ var res = ($(o.item || this).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/));
+ if(res) str.push((o.key || res[1]+'[]')+'='+(o.key && o.expression ? res[1] : res[2]));
+ });
+
+ if(!str.length && o.key) {
+ str.push(o.key + '=');
+ }
+
+ return str.join('&');
+
+ },
+
+ toArray: function(o) {
+
+ var items = this._getItemsAsjQuery(o && o.connected);
+ var ret = []; o = o || {};
+
+ items.each(function() { ret.push($(o.item || this).attr(o.attribute || 'id') || ''); });
+ return ret;
+
+ },
+
+ /* Be careful with the following core functions */
+ _intersectsWith: function(item) {
+
+ var x1 = this.positionAbs.left,
+ x2 = x1 + this.helperProportions.width,
+ y1 = this.positionAbs.top,
+ y2 = y1 + this.helperProportions.height;
+
+ var l = item.left,
+ r = l + item.width,
+ t = item.top,
+ b = t + item.height;
+
+ var dyClick = this.offset.click.top,
+ dxClick = this.offset.click.left;
+
+ var isOverElement = (y1 + dyClick) > t && (y1 + dyClick) < b && (x1 + dxClick) > l && (x1 + dxClick) < r;
+
+ if( this.options.tolerance == "pointer"
+ || this.options.forcePointerForContainers
+ || (this.options.tolerance != "pointer" && this.helperProportions[this.floating ? 'width' : 'height'] > item[this.floating ? 'width' : 'height'])
+ ) {
+ return isOverElement;
+ } else {
+
+ return (l < x1 + (this.helperProportions.width / 2) // Right Half
+ && x2 - (this.helperProportions.width / 2) < r // Left Half
+ && t < y1 + (this.helperProportions.height / 2) // Bottom Half
+ && y2 - (this.helperProportions.height / 2) < b ); // Top Half
+
+ }
+ },
+
+ _intersectsWithPointer: function(item) {
+
+ var isOverElementHeight = $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height),
+ isOverElementWidth = $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width),
+ isOverElement = isOverElementHeight && isOverElementWidth,
+ verticalDirection = this._getDragVerticalDirection(),
+ horizontalDirection = this._getDragHorizontalDirection();
+
+ if (!isOverElement)
+ return false;
+
+ return this.floating ?
+ ( ((horizontalDirection && horizontalDirection == "right") || verticalDirection == "down") ? 2 : 1 )
+ : ( verticalDirection && (verticalDirection == "down" ? 2 : 1) );
+
+ },
+
+ _intersectsWithSides: function(item) {
+
+ var isOverBottomHalf = $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height/2), item.height),
+ isOverRightHalf = $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width),
+ verticalDirection = this._getDragVerticalDirection(),
+ horizontalDirection = this._getDragHorizontalDirection();
+
+ if (this.floating && horizontalDirection) {
+ return ((horizontalDirection == "right" && isOverRightHalf) || (horizontalDirection == "left" && !isOverRightHalf));
+ } else {
+ return verticalDirection && ((verticalDirection == "down" && isOverBottomHalf) || (verticalDirection == "up" && !isOverBottomHalf));
+ }
+
+ },
+
+ _getDragVerticalDirection: function() {
+ var delta = this.positionAbs.top - this.lastPositionAbs.top;
+ return delta != 0 && (delta > 0 ? "down" : "up");
+ },
+
+ _getDragHorizontalDirection: function() {
+ var delta = this.positionAbs.left - this.lastPositionAbs.left;
+ return delta != 0 && (delta > 0 ? "right" : "left");
+ },
+
+ refresh: function(event) {
+ this._refreshItems(event);
+ this.refreshPositions();
+ return this;
+ },
+
+ _connectWith: function() {
+ var options = this.options;
+ return options.connectWith.constructor == String
+ ? [options.connectWith]
+ : options.connectWith;
+ },
+
+ _getItemsAsjQuery: function(connected) {
+
+ var self = this;
+ var items = [];
+ var queries = [];
+ var connectWith = this._connectWith();
+
+ if(connectWith && connected) {
+ for (var i = connectWith.length - 1; i >= 0; i--){
+ var cur = $(connectWith[i]);
+ for (var j = cur.length - 1; j >= 0; j--){
+ var inst = $.data(cur[j], this.widgetName);
+ if(inst && inst != this && !inst.options.disabled) {
+ queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), inst]);
+ }
+ };
+ };
+ }
+
+ queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), this]);
+
+ for (var i = queries.length - 1; i >= 0; i--){
+ queries[i][0].each(function() {
+ items.push(this);
+ });
+ };
+
+ return $(items);
+
+ },
+
+ _removeCurrentsFromItems: function() {
+
+ var list = this.currentItem.find(":data(" + this.widgetName + "-item)");
+
+ for (var i=0; i < this.items.length; i++) {
+
+ for (var j=0; j < list.length; j++) {
+ if(list[j] == this.items[i].item[0])
+ this.items.splice(i,1);
+ };
+
+ };
+
+ },
+
+ _refreshItems: function(event) {
+
+ this.items = [];
+ this.containers = [this];
+ var items = this.items;
+ var self = this;
+ var queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]];
+ var connectWith = this._connectWith();
+
+ if(connectWith && this.ready) { //Shouldn't be run the first time through due to massive slow-down
+ for (var i = connectWith.length - 1; i >= 0; i--){
+ var cur = $(connectWith[i]);
+ for (var j = cur.length - 1; j >= 0; j--){
+ var inst = $.data(cur[j], this.widgetName);
+ if(inst && inst != this && !inst.options.disabled) {
+ queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]);
+ this.containers.push(inst);
+ }
+ };
+ };
+ }
+
+ for (var i = queries.length - 1; i >= 0; i--) {
+ var targetData = queries[i][1];
+ var _queries = queries[i][0];
+
+ for (var j=0, queriesLength = _queries.length; j < queriesLength; j++) {
+ var item = $(_queries[j]);
+
+ item.data(this.widgetName + '-item', targetData); // Data for target checking (mouse manager)
+
+ items.push({
+ item: item,
+ instance: targetData,
+ width: 0, height: 0,
+ left: 0, top: 0
+ });
+ };
+ };
+
+ },
+
+ refreshPositions: function(fast) {
+
+ //This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change
+ if(this.offsetParent && this.helper) {
+ this.offset.parent = this._getParentOffset();
+ }
+
+ for (var i = this.items.length - 1; i >= 0; i--){
+ var item = this.items[i];
+
+ //We ignore calculating positions of all connected containers when we're not over them
+ if(item.instance != this.currentContainer && this.currentContainer && item.item[0] != this.currentItem[0])
+ continue;
+
+ var t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item;
+
+ if (!fast) {
+ item.width = t.outerWidth();
+ item.height = t.outerHeight();
+ }
+
+ var p = t.offset();
+ item.left = p.left;
+ item.top = p.top;
+ };
+
+ if(this.options.custom && this.options.custom.refreshContainers) {
+ this.options.custom.refreshContainers.call(this);
+ } else {
+ for (var i = this.containers.length - 1; i >= 0; i--){
+ var p = this.containers[i].element.offset();
+ this.containers[i].containerCache.left = p.left;
+ this.containers[i].containerCache.top = p.top;
+ this.containers[i].containerCache.width = this.containers[i].element.outerWidth();
+ this.containers[i].containerCache.height = this.containers[i].element.outerHeight();
+ };
+ }
+
+ return this;
+ },
+
+ _createPlaceholder: function(that) {
+
+ var self = that || this, o = self.options;
+
+ if(!o.placeholder || o.placeholder.constructor == String) {
+ var className = o.placeholder;
+ o.placeholder = {
+ element: function() {
+
+ var el = $(document.createElement(self.currentItem[0].nodeName))
+ .addClass(className || self.currentItem[0].className+" ui-sortable-placeholder")
+ .removeClass("ui-sortable-helper")[0];
+
+ if(!className)
+ el.style.visibility = "hidden";
+
+ return el;
+ },
+ update: function(container, p) {
+
+ // 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that
+ // 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified
+ if(className && !o.forcePlaceholderSize) return;
+
+ //If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item
+ if(!p.height()) { p.height(self.currentItem.innerHeight() - parseInt(self.currentItem.css('paddingTop')||0, 10) - parseInt(self.currentItem.css('paddingBottom')||0, 10)); };
+ if(!p.width()) { p.width(self.currentItem.innerWidth() - parseInt(self.currentItem.css('paddingLeft')||0, 10) - parseInt(self.currentItem.css('paddingRight')||0, 10)); };
+ }
+ };
+ }
+
+ //Create the placeholder
+ self.placeholder = $(o.placeholder.element.call(self.element, self.currentItem));
+
+ //Append it after the actual current item
+ self.currentItem.after(self.placeholder);
+
+ //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
+ o.placeholder.update(self, self.placeholder);
+
+ },
+
+ _contactContainers: function(event) {
+
+ // get innermost container that intersects with item
+ var innermostContainer = null, innermostIndex = null;
+
+
+ for (var i = this.containers.length - 1; i >= 0; i--){
+
+ // never consider a container that's located within the item itself
+ if($.ui.contains(this.currentItem[0], this.containers[i].element[0]))
+ continue;
+
+ if(this._intersectsWith(this.containers[i].containerCache)) {
+
+ // if we've already found a container and it's more "inner" than this, then continue
+ if(innermostContainer && $.ui.contains(this.containers[i].element[0], innermostContainer.element[0]))
+ continue;
+
+ innermostContainer = this.containers[i];
+ innermostIndex = i;
+
+ } else {
+ // container doesn't intersect. trigger "out" event if necessary
+ if(this.containers[i].containerCache.over) {
+ this.containers[i]._trigger("out", event, this._uiHash(this));
+ this.containers[i].containerCache.over = 0;
+ }
+ }
+
+ }
+
+ // if no intersecting containers found, return
+ if(!innermostContainer) return;
+
+ // move the item into the container if it's not there already
+ if(this.containers.length === 1) {
+ this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
+ this.containers[innermostIndex].containerCache.over = 1;
+ } else if(this.currentContainer != this.containers[innermostIndex]) {
+
+ //When entering a new container, we will find the item with the least distance and append our item near it
+ var dist = 10000; var itemWithLeastDistance = null; var base = this.positionAbs[this.containers[innermostIndex].floating ? 'left' : 'top'];
+ for (var j = this.items.length - 1; j >= 0; j--) {
+ if(!$.ui.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) continue;
+ var cur = this.items[j][this.containers[innermostIndex].floating ? 'left' : 'top'];
+ if(Math.abs(cur - base) < dist) {
+ dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j];
+ }
+ }
+
+ if(!itemWithLeastDistance && !this.options.dropOnEmpty) //Check if dropOnEmpty is enabled
+ return;
+
+ this.currentContainer = this.containers[innermostIndex];
+ itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true);
+ this._trigger("change", event, this._uiHash());
+ this.containers[innermostIndex]._trigger("change", event, this._uiHash(this));
+
+ //Update the placeholder
+ this.options.placeholder.update(this.currentContainer, this.placeholder);
+
+ this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
+ this.containers[innermostIndex].containerCache.over = 1;
+ }
+
+
+ },
+
+ _createHelper: function(event) {
+
+ var o = this.options;
+ var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper == 'clone' ? this.currentItem.clone() : this.currentItem);
+
+ if(!helper.parents('body').length) //Add the helper to the DOM if that didn't happen already
+ $(o.appendTo != 'parent' ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]);
+
+ if(helper[0] == this.currentItem[0])
+ this._storedCSS = { width: this.currentItem[0].style.width, height: this.currentItem[0].style.height, position: this.currentItem.css("position"), top: this.currentItem.css("top"), left: this.currentItem.css("left") };
+
+ if(helper[0].style.width == '' || o.forceHelperSize) helper.width(this.currentItem.width());
+ if(helper[0].style.height == '' || o.forceHelperSize) helper.height(this.currentItem.height());
+
+ return helper;
+
+ },
+
+ _adjustOffsetFromHelper: function(obj) {
+ if (typeof obj == 'string') {
+ obj = obj.split(' ');
+ }
+ if ($.isArray(obj)) {
+ obj = {left: +obj[0], top: +obj[1] || 0};
+ }
+ if ('left' in obj) {
+ this.offset.click.left = obj.left + this.margins.left;
+ }
+ if ('right' in obj) {
+ this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
+ }
+ if ('top' in obj) {
+ this.offset.click.top = obj.top + this.margins.top;
+ }
+ if ('bottom' in obj) {
+ this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
+ }
+ },
+
+ _getParentOffset: function() {
+
+
+ //Get the offsetParent and cache its position
+ this.offsetParent = this.helper.offsetParent();
+ var po = this.offsetParent.offset();
+
+ // This is a special case where we need to modify a offset calculated on start, since the following happened:
+ // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
+ // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
+ // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
+ if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) {
+ po.left += this.scrollParent.scrollLeft();
+ po.top += this.scrollParent.scrollTop();
+ }
+
+ if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information
+ || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.browser.msie)) //Ugly IE fix
+ po = { top: 0, left: 0 };
+
+ return {
+ top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
+ left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
+ };
+
+ },
+
+ _getRelativeOffset: function() {
+
+ if(this.cssPosition == "relative") {
+ var p = this.currentItem.position();
+ return {
+ top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
+ left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
+ };
+ } else {
+ return { top: 0, left: 0 };
+ }
+
+ },
+
+ _cacheMargins: function() {
+ this.margins = {
+ left: (parseInt(this.currentItem.css("marginLeft"),10) || 0),
+ top: (parseInt(this.currentItem.css("marginTop"),10) || 0)
+ };
+ },
+
+ _cacheHelperProportions: function() {
+ this.helperProportions = {
+ width: this.helper.outerWidth(),
+ height: this.helper.outerHeight()
+ };
+ },
+
+ _setContainment: function() {
+
+ var o = this.options;
+ if(o.containment == 'parent') o.containment = this.helper[0].parentNode;
+ if(o.containment == 'document' || o.containment == 'window') this.containment = [
+ 0 - this.offset.relative.left - this.offset.parent.left,
+ 0 - this.offset.relative.top - this.offset.parent.top,
+ $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left,
+ ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
+ ];
+
+ if(!(/^(document|window|parent)$/).test(o.containment)) {
+ var ce = $(o.containment)[0];
+ var co = $(o.containment).offset();
+ var over = ($(ce).css("overflow") != 'hidden');
+
+ this.containment = [
+ co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left,
+ co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top,
+ co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left,
+ co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top
+ ];
+ }
+
+ },
+
+ _convertPositionTo: function(d, pos) {
+
+ if(!pos) pos = this.position;
+ var mod = d == "absolute" ? 1 : -1;
+ var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
+
+ return {
+ top: (
+ pos.top // The absolute mouse position
+ + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent
+ + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border)
+ - ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
+ ),
+ left: (
+ pos.left // The absolute mouse position
+ + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent
+ + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border)
+ - ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
+ )
+ };
+
+ },
+
+ _generatePosition: function(event) {
+
+ var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
+
+ // This is another very weird special case that only happens for relative elements:
+ // 1. If the css position is relative
+ // 2. and the scroll parent is the document or similar to the offset parent
+ // we have to refresh the relative offset during the scroll so there are no jumps
+ if(this.cssPosition == 'relative' && !(this.scrollParent[0] != document && this.scrollParent[0] != this.offsetParent[0])) {
+ this.offset.relative = this._getRelativeOffset();
+ }
+
+ var pageX = event.pageX;
+ var pageY = event.pageY;
+
+ /*
+ * - Position constraining -
+ * Constrain the position to a mix of grid, containment.
+ */
+
+ if(this.originalPosition) { //If we are not dragging yet, we won't check for options
+
+ if(this.containment) {
+ if(event.pageX - this.offset.click.left < this.containment[0]) pageX = this.containment[0] + this.offset.click.left;
+ if(event.pageY - this.offset.click.top < this.containment[1]) pageY = this.containment[1] + this.offset.click.top;
+ if(event.pageX - this.offset.click.left > this.containment[2]) pageX = this.containment[2] + this.offset.click.left;
+ if(event.pageY - this.offset.click.top > this.containment[3]) pageY = this.containment[3] + this.offset.click.top;
+ }
+
+ if(o.grid) {
+ var top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];
+ pageY = this.containment ? (!(top - this.offset.click.top < this.containment[1] || top - this.offset.click.top > this.containment[3]) ? top : (!(top - this.offset.click.top < this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
+
+ var left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0];
+ pageX = this.containment ? (!(left - this.offset.click.left < this.containment[0] || left - this.offset.click.left > this.containment[2]) ? left : (!(left - this.offset.click.left < this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
+ }
+
+ }
+
+ return {
+ top: (
+ pageY // The absolute mouse position
+ - this.offset.click.top // Click offset (relative to the element)
+ - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent
+ - this.offset.parent.top // The offsetParent's offset without borders (offset + border)
+ + ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
+ ),
+ left: (
+ pageX // The absolute mouse position
+ - this.offset.click.left // Click offset (relative to the element)
+ - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent
+ - this.offset.parent.left // The offsetParent's offset without borders (offset + border)
+ + ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
+ )
+ };
+
+ },
+
+ _rearrange: function(event, i, a, hardRefresh) {
+
+ a ? a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction == 'down' ? i.item[0] : i.item[0].nextSibling));
+
+ //Various things done here to improve the performance:
+ // 1. we create a setTimeout, that calls refreshPositions
+ // 2. on the instance, we have a counter variable, that get's higher after every append
+ // 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same
+ // 4. this lets only the last addition to the timeout stack through
+ this.counter = this.counter ? ++this.counter : 1;
+ var self = this, counter = this.counter;
+
+ window.setTimeout(function() {
+ if(counter == self.counter) self.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove
+ },0);
+
+ },
+
+ _clear: function(event, noPropagation) {
+
+ this.reverting = false;
+ // We delay all events that have to be triggered to after the point where the placeholder has been removed and
+ // everything else normalized again
+ var delayedTriggers = [], self = this;
+
+ // We first have to update the dom position of the actual currentItem
+ // Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088)
+ if(!this._noFinalSort && this.currentItem.parent().length) this.placeholder.before(this.currentItem);
+ this._noFinalSort = null;
+
+ if(this.helper[0] == this.currentItem[0]) {
+ for(var i in this._storedCSS) {
+ if(this._storedCSS[i] == 'auto' || this._storedCSS[i] == 'static') this._storedCSS[i] = '';
+ }
+ this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
+ } else {
+ this.currentItem.show();
+ }
+
+ if(this.fromOutside && !noPropagation) delayedTriggers.push(function(event) { this._trigger("receive", event, this._uiHash(this.fromOutside)); });
+ if((this.fromOutside || this.domPosition.prev != this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent != this.currentItem.parent()[0]) && !noPropagation) delayedTriggers.push(function(event) { this._trigger("update", event, this._uiHash()); }); //Trigger update callback if the DOM position has changed
+ if(!$.ui.contains(this.element[0], this.currentItem[0])) { //Node was moved out of the current element
+ if(!noPropagation) delayedTriggers.push(function(event) { this._trigger("remove", event, this._uiHash()); });
+ for (var i = this.containers.length - 1; i >= 0; i--){
+ if($.ui.contains(this.containers[i].element[0], this.currentItem[0]) && !noPropagation) {
+ delayedTriggers.push((function(c) { return function(event) { c._trigger("receive", event, this._uiHash(this)); }; }).call(this, this.containers[i]));
+ delayedTriggers.push((function(c) { return function(event) { c._trigger("update", event, this._uiHash(this)); }; }).call(this, this.containers[i]));
+ }
+ };
+ };
+
+ //Post events to containers
+ for (var i = this.containers.length - 1; i >= 0; i--){
+ if(!noPropagation) delayedTriggers.push((function(c) { return function(event) { c._trigger("deactivate", event, this._uiHash(this)); }; }).call(this, this.containers[i]));
+ if(this.containers[i].containerCache.over) {
+ delayedTriggers.push((function(c) { return function(event) { c._trigger("out", event, this._uiHash(this)); }; }).call(this, this.containers[i]));
+ this.containers[i].containerCache.over = 0;
+ }
+ }
+
+ //Do what was originally in plugins
+ if(this._storedCursor) $('body').css("cursor", this._storedCursor); //Reset cursor
+ if(this._storedOpacity) this.helper.css("opacity", this._storedOpacity); //Reset opacity
+ if(this._storedZIndex) this.helper.css("zIndex", this._storedZIndex == 'auto' ? '' : this._storedZIndex); //Reset z-index
+
+ this.dragging = false;
+ if(this.cancelHelperRemoval) {
+ if(!noPropagation) {
+ this._trigger("beforeStop", event, this._uiHash());
+ for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events
+ this._trigger("stop", event, this._uiHash());
+ }
+ return false;
+ }
+
+ if(!noPropagation) this._trigger("beforeStop", event, this._uiHash());
+
+ //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
+ this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
+
+ if(this.helper[0] != this.currentItem[0]) this.helper.remove(); this.helper = null;
+
+ if(!noPropagation) {
+ for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events
+ this._trigger("stop", event, this._uiHash());
+ }
+
+ this.fromOutside = false;
+ return true;
+
+ },
+
+ _trigger: function() {
+ if ($.Widget.prototype._trigger.apply(this, arguments) === false) {
+ this.cancel();
+ }
+ },
+
+ _uiHash: function(inst) {
+ var self = inst || this;
+ return {
+ helper: self.helper,
+ placeholder: self.placeholder || $([]),
+ position: self.position,
+ originalPosition: self.originalPosition,
+ offset: self.positionAbs,
+ item: self.currentItem,
+ sender: inst ? inst.element : null
+ };
+ }
+
+});
+
+$.extend($.ui.sortable, {
+ version: "1.8.18"
+});
+
+})(jQuery);
+/*
+ * jQuery UI Effects 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Effects/
+ */
+;jQuery.effects || (function($, undefined) {
+
+$.effects = {};
+
+
+
+/******************************************************************************/
+/****************************** COLOR ANIMATIONS ******************************/
+/******************************************************************************/
+
+// override the animation for color styles
+$.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor',
+ 'borderRightColor', 'borderTopColor', 'borderColor', 'color', 'outlineColor'],
+function(i, attr) {
+ $.fx.step[attr] = function(fx) {
+ if (!fx.colorInit) {
+ fx.start = getColor(fx.elem, attr);
+ fx.end = getRGB(fx.end);
+ fx.colorInit = true;
+ }
+
+ fx.elem.style[attr] = 'rgb(' +
+ Math.max(Math.min(parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0], 10), 255), 0) + ',' +
+ Math.max(Math.min(parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1], 10), 255), 0) + ',' +
+ Math.max(Math.min(parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2], 10), 255), 0) + ')';
+ };
+});
+
+// Color Conversion functions from highlightFade
+// By Blair Mitchelmore
+// http://jquery.offput.ca/highlightFade/
+
+// Parse strings looking for color tuples [255,255,255]
+function getRGB(color) {
+ var result;
+
+ // Check if we're already dealing with an array of colors
+ if ( color && color.constructor == Array && color.length == 3 )
+ return color;
+
+ // Look for rgb(num,num,num)
+ if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
+ return [parseInt(result[1],10), parseInt(result[2],10), parseInt(result[3],10)];
+
+ // Look for rgb(num%,num%,num%)
+ if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
+ return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];
+
+ // Look for #a0b1c2
+ if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
+ return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];
+
+ // Look for #fff
+ if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
+ return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];
+
+ // Look for rgba(0, 0, 0, 0) == transparent in Safari 3
+ if (result = /rgba\(0, 0, 0, 0\)/.exec(color))
+ return colors['transparent'];
+
+ // Otherwise, we're most likely dealing with a named color
+ return colors[$.trim(color).toLowerCase()];
+}
+
+function getColor(elem, attr) {
+ var color;
+
+ do {
+ color = $.curCSS(elem, attr);
+
+ // Keep going until we find an element that has color, or we hit the body
+ if ( color != '' && color != 'transparent' || $.nodeName(elem, "body") )
+ break;
+
+ attr = "backgroundColor";
+ } while ( elem = elem.parentNode );
+
+ return getRGB(color);
+};
+
+// Some named colors to work with
+// From Interface by Stefan Petre
+// http://interface.eyecon.ro/
+
+var colors = {
+ aqua:[0,255,255],
+ azure:[240,255,255],
+ beige:[245,245,220],
+ black:[0,0,0],
+ blue:[0,0,255],
+ brown:[165,42,42],
+ cyan:[0,255,255],
+ darkblue:[0,0,139],
+ darkcyan:[0,139,139],
+ darkgrey:[169,169,169],
+ darkgreen:[0,100,0],
+ darkkhaki:[189,183,107],
+ darkmagenta:[139,0,139],
+ darkolivegreen:[85,107,47],
+ darkorange:[255,140,0],
+ darkorchid:[153,50,204],
+ darkred:[139,0,0],
+ darksalmon:[233,150,122],
+ darkviolet:[148,0,211],
+ fuchsia:[255,0,255],
+ gold:[255,215,0],
+ green:[0,128,0],
+ indigo:[75,0,130],
+ khaki:[240,230,140],
+ lightblue:[173,216,230],
+ lightcyan:[224,255,255],
+ lightgreen:[144,238,144],
+ lightgrey:[211,211,211],
+ lightpink:[255,182,193],
+ lightyellow:[255,255,224],
+ lime:[0,255,0],
+ magenta:[255,0,255],
+ maroon:[128,0,0],
+ navy:[0,0,128],
+ olive:[128,128,0],
+ orange:[255,165,0],
+ pink:[255,192,203],
+ purple:[128,0,128],
+ violet:[128,0,128],
+ red:[255,0,0],
+ silver:[192,192,192],
+ white:[255,255,255],
+ yellow:[255,255,0],
+ transparent: [255,255,255]
+};
+
+
+
+/******************************************************************************/
+/****************************** CLASS ANIMATIONS ******************************/
+/******************************************************************************/
+
+var classAnimationActions = ['add', 'remove', 'toggle'],
+ shorthandStyles = {
+ border: 1,
+ borderBottom: 1,
+ borderColor: 1,
+ borderLeft: 1,
+ borderRight: 1,
+ borderTop: 1,
+ borderWidth: 1,
+ margin: 1,
+ padding: 1
+ };
+
+function getElementStyles() {
+ var style = document.defaultView
+ ? document.defaultView.getComputedStyle(this, null)
+ : this.currentStyle,
+ newStyle = {},
+ key,
+ camelCase;
+
+ // webkit enumerates style porperties
+ if (style && style.length && style[0] && style[style[0]]) {
+ var len = style.length;
+ while (len--) {
+ key = style[len];
+ if (typeof style[key] == 'string') {
+ camelCase = key.replace(/\-(\w)/g, function(all, letter){
+ return letter.toUpperCase();
+ });
+ newStyle[camelCase] = style[key];
+ }
+ }
+ } else {
+ for (key in style) {
+ if (typeof style[key] === 'string') {
+ newStyle[key] = style[key];
+ }
+ }
+ }
+
+ return newStyle;
+}
+
+function filterStyles(styles) {
+ var name, value;
+ for (name in styles) {
+ value = styles[name];
+ if (
+ // ignore null and undefined values
+ value == null ||
+ // ignore functions (when does this occur?)
+ $.isFunction(value) ||
+ // shorthand styles that need to be expanded
+ name in shorthandStyles ||
+ // ignore scrollbars (break in IE)
+ (/scrollbar/).test(name) ||
+
+ // only colors or values that can be converted to numbers
+ (!(/color/i).test(name) && isNaN(parseFloat(value)))
+ ) {
+ delete styles[name];
+ }
+ }
+
+ return styles;
+}
+
+function styleDifference(oldStyle, newStyle) {
+ var diff = { _: 0 }, // http://dev.jquery.com/ticket/5459
+ name;
+
+ for (name in newStyle) {
+ if (oldStyle[name] != newStyle[name]) {
+ diff[name] = newStyle[name];
+ }
+ }
+
+ return diff;
+}
+
+$.effects.animateClass = function(value, duration, easing, callback) {
+ if ($.isFunction(easing)) {
+ callback = easing;
+ easing = null;
+ }
+
+ return this.queue(function() {
+ var that = $(this),
+ originalStyleAttr = that.attr('style') || ' ',
+ originalStyle = filterStyles(getElementStyles.call(this)),
+ newStyle,
+ className = that.attr('class');
+
+ $.each(classAnimationActions, function(i, action) {
+ if (value[action]) {
+ that[action + 'Class'](value[action]);
+ }
+ });
+ newStyle = filterStyles(getElementStyles.call(this));
+ that.attr('class', className);
+
+ that.animate(styleDifference(originalStyle, newStyle), {
+ queue: false,
+ duration: duration,
+ easing: easing,
+ complete: function() {
+ $.each(classAnimationActions, function(i, action) {
+ if (value[action]) { that[action + 'Class'](value[action]); }
+ });
+ // work around bug in IE by clearing the cssText before setting it
+ if (typeof that.attr('style') == 'object') {
+ that.attr('style').cssText = '';
+ that.attr('style').cssText = originalStyleAttr;
+ } else {
+ that.attr('style', originalStyleAttr);
+ }
+ if (callback) { callback.apply(this, arguments); }
+ $.dequeue( this );
+ }
+ });
+ });
+};
+
+$.fn.extend({
+ _addClass: $.fn.addClass,
+ addClass: function(classNames, speed, easing, callback) {
+ return speed ? $.effects.animateClass.apply(this, [{ add: classNames },speed,easing,callback]) : this._addClass(classNames);
+ },
+
+ _removeClass: $.fn.removeClass,
+ removeClass: function(classNames,speed,easing,callback) {
+ return speed ? $.effects.animateClass.apply(this, [{ remove: classNames },speed,easing,callback]) : this._removeClass(classNames);
+ },
+
+ _toggleClass: $.fn.toggleClass,
+ toggleClass: function(classNames, force, speed, easing, callback) {
+ if ( typeof force == "boolean" || force === undefined ) {
+ if ( !speed ) {
+ // without speed parameter;
+ return this._toggleClass(classNames, force);
+ } else {
+ return $.effects.animateClass.apply(this, [(force?{add:classNames}:{remove:classNames}),speed,easing,callback]);
+ }
+ } else {
+ // without switch parameter;
+ return $.effects.animateClass.apply(this, [{ toggle: classNames },force,speed,easing]);
+ }
+ },
+
+ switchClass: function(remove,add,speed,easing,callback) {
+ return $.effects.animateClass.apply(this, [{ add: add, remove: remove },speed,easing,callback]);
+ }
+});
+
+
+
+/******************************************************************************/
+/*********************************** EFFECTS **********************************/
+/******************************************************************************/
+
+$.extend($.effects, {
+ version: "1.8.18",
+
+ // Saves a set of properties in a data storage
+ save: function(element, set) {
+ for(var i=0; i < set.length; i++) {
+ if(set[i] !== null) element.data("ec.storage."+set[i], element[0].style[set[i]]);
+ }
+ },
+
+ // Restores a set of previously saved properties from a data storage
+ restore: function(element, set) {
+ for(var i=0; i < set.length; i++) {
+ if(set[i] !== null) element.css(set[i], element.data("ec.storage."+set[i]));
+ }
+ },
+
+ setMode: function(el, mode) {
+ if (mode == 'toggle') mode = el.is(':hidden') ? 'show' : 'hide'; // Set for toggle
+ return mode;
+ },
+
+ getBaseline: function(origin, original) { // Translates a [top,left] array into a baseline value
+ // this should be a little more flexible in the future to handle a string & hash
+ var y, x;
+ switch (origin[0]) {
+ case 'top': y = 0; break;
+ case 'middle': y = 0.5; break;
+ case 'bottom': y = 1; break;
+ default: y = origin[0] / original.height;
+ };
+ switch (origin[1]) {
+ case 'left': x = 0; break;
+ case 'center': x = 0.5; break;
+ case 'right': x = 1; break;
+ default: x = origin[1] / original.width;
+ };
+ return {x: x, y: y};
+ },
+
+ // Wraps the element around a wrapper that copies position properties
+ createWrapper: function(element) {
+
+ // if the element is already wrapped, return it
+ if (element.parent().is('.ui-effects-wrapper')) {
+ return element.parent();
+ }
+
+ // wrap the element
+ var props = {
+ width: element.outerWidth(true),
+ height: element.outerHeight(true),
+ 'float': element.css('float')
+ },
+ wrapper = $('<div></div>')
+ .addClass('ui-effects-wrapper')
+ .css({
+ fontSize: '100%',
+ background: 'transparent',
+ border: 'none',
+ margin: 0,
+ padding: 0
+ }),
+ active = document.activeElement;
+
+ element.wrap(wrapper);
+
+ // Fixes #7595 - Elements lose focus when wrapped.
+ if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
+ $( active ).focus();
+ }
+
+ wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually loose the reference to the wrapped element
+
+ // transfer positioning properties to the wrapper
+ if (element.css('position') == 'static') {
+ wrapper.css({ position: 'relative' });
+ element.css({ position: 'relative' });
+ } else {
+ $.extend(props, {
+ position: element.css('position'),
+ zIndex: element.css('z-index')
+ });
+ $.each(['top', 'left', 'bottom', 'right'], function(i, pos) {
+ props[pos] = element.css(pos);
+ if (isNaN(parseInt(props[pos], 10))) {
+ props[pos] = 'auto';
+ }
+ });
+ element.css({position: 'relative', top: 0, left: 0, right: 'auto', bottom: 'auto' });
+ }
+
+ return wrapper.css(props).show();
+ },
+
+ removeWrapper: function(element) {
+ var parent,
+ active = document.activeElement;
+
+ if (element.parent().is('.ui-effects-wrapper')) {
+ parent = element.parent().replaceWith(element);
+ // Fixes #7595 - Elements lose focus when wrapped.
+ if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
+ $( active ).focus();
+ }
+ return parent;
+ }
+
+ return element;
+ },
+
+ setTransition: function(element, list, factor, value) {
+ value = value || {};
+ $.each(list, function(i, x){
+ unit = element.cssUnit(x);
+ if (unit[0] > 0) value[x] = unit[0] * factor + unit[1];
+ });
+ return value;
+ }
+});
+
+
+function _normalizeArguments(effect, options, speed, callback) {
+ // shift params for method overloading
+ if (typeof effect == 'object') {
+ callback = options;
+ speed = null;
+ options = effect;
+ effect = options.effect;
+ }
+ if ($.isFunction(options)) {
+ callback = options;
+ speed = null;
+ options = {};
+ }
+ if (typeof options == 'number' || $.fx.speeds[options]) {
+ callback = speed;
+ speed = options;
+ options = {};
+ }
+ if ($.isFunction(speed)) {
+ callback = speed;
+ speed = null;
+ }
+
+ options = options || {};
+
+ speed = speed || options.duration;
+ speed = $.fx.off ? 0 : typeof speed == 'number'
+ ? speed : speed in $.fx.speeds ? $.fx.speeds[speed] : $.fx.speeds._default;
+
+ callback = callback || options.complete;
+
+ return [effect, options, speed, callback];
+}
+
+function standardSpeed( speed ) {
+ // valid standard speeds
+ if ( !speed || typeof speed === "number" || $.fx.speeds[ speed ] ) {
+ return true;
+ }
+
+ // invalid strings - treat as "normal" speed
+ if ( typeof speed === "string" && !$.effects[ speed ] ) {
+ return true;
+ }
+
+ return false;
+}
+
+$.fn.extend({
+ effect: function(effect, options, speed, callback) {
+ var args = _normalizeArguments.apply(this, arguments),
+ // TODO: make effects take actual parameters instead of a hash
+ args2 = {
+ options: args[1],
+ duration: args[2],
+ callback: args[3]
+ },
+ mode = args2.options.mode,
+ effectMethod = $.effects[effect];
+
+ if ( $.fx.off || !effectMethod ) {
+ // delegate to the original method (e.g., .show()) if possible
+ if ( mode ) {
+ return this[ mode ]( args2.duration, args2.callback );
+ } else {
+ return this.each(function() {
+ if ( args2.callback ) {
+ args2.callback.call( this );
+ }
+ });
+ }
+ }
+
+ return effectMethod.call(this, args2);
+ },
+
+ _show: $.fn.show,
+ show: function(speed) {
+ if ( standardSpeed( speed ) ) {
+ return this._show.apply(this, arguments);
+ } else {
+ var args = _normalizeArguments.apply(this, arguments);
+ args[1].mode = 'show';
+ return this.effect.apply(this, args);
+ }
+ },
+
+ _hide: $.fn.hide,
+ hide: function(speed) {
+ if ( standardSpeed( speed ) ) {
+ return this._hide.apply(this, arguments);
+ } else {
+ var args = _normalizeArguments.apply(this, arguments);
+ args[1].mode = 'hide';
+ return this.effect.apply(this, args);
+ }
+ },
+
+ // jQuery core overloads toggle and creates _toggle
+ __toggle: $.fn.toggle,
+ toggle: function(speed) {
+ if ( standardSpeed( speed ) || typeof speed === "boolean" || $.isFunction( speed ) ) {
+ return this.__toggle.apply(this, arguments);
+ } else {
+ var args = _normalizeArguments.apply(this, arguments);
+ args[1].mode = 'toggle';
+ return this.effect.apply(this, args);
+ }
+ },
+
+ // helper functions
+ cssUnit: function(key) {
+ var style = this.css(key), val = [];
+ $.each( ['em','px','%','pt'], function(i, unit){
+ if(style.indexOf(unit) > 0)
+ val = [parseFloat(style), unit];
+ });
+ return val;
+ }
+});
+
+
+
+/******************************************************************************/
+/*********************************** EASING ***********************************/
+/******************************************************************************/
+
+/*
+ * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
+ *
+ * Uses the built in easing capabilities added In jQuery 1.1
+ * to offer multiple easing options
+ *
+ * TERMS OF USE - jQuery Easing
+ *
+ * Open source under the BSD License.
+ *
+ * Copyright 2008 George McGinley Smith
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * Neither the name of the author nor the names of contributors may be used to endorse
+ * or promote products derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+*/
+
+// t: current time, b: begInnIng value, c: change In value, d: duration
+$.easing.jswing = $.easing.swing;
+
+$.extend($.easing,
+{
+ def: 'easeOutQuad',
+ swing: function (x, t, b, c, d) {
+ //alert($.easing.default);
+ return $.easing[$.easing.def](x, t, b, c, d);
+ },
+ easeInQuad: function (x, t, b, c, d) {
+ return c*(t/=d)*t + b;
+ },
+ easeOutQuad: function (x, t, b, c, d) {
+ return -c *(t/=d)*(t-2) + b;
+ },
+ easeInOutQuad: function (x, t, b, c, d) {
+ if ((t/=d/2) < 1) return c/2*t*t + b;
+ return -c/2 * ((--t)*(t-2) - 1) + b;
+ },
+ easeInCubic: function (x, t, b, c, d) {
+ return c*(t/=d)*t*t + b;
+ },
+ easeOutCubic: function (x, t, b, c, d) {
+ return c*((t=t/d-1)*t*t + 1) + b;
+ },
+ easeInOutCubic: function (x, t, b, c, d) {
+ if ((t/=d/2) < 1) return c/2*t*t*t + b;
+ return c/2*((t-=2)*t*t + 2) + b;
+ },
+ easeInQuart: function (x, t, b, c, d) {
+ return c*(t/=d)*t*t*t + b;
+ },
+ easeOutQuart: function (x, t, b, c, d) {
+ return -c * ((t=t/d-1)*t*t*t - 1) + b;
+ },
+ easeInOutQuart: function (x, t, b, c, d) {
+ if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
+ return -c/2 * ((t-=2)*t*t*t - 2) + b;
+ },
+ easeInQuint: function (x, t, b, c, d) {
+ return c*(t/=d)*t*t*t*t + b;
+ },
+ easeOutQuint: function (x, t, b, c, d) {
+ return c*((t=t/d-1)*t*t*t*t + 1) + b;
+ },
+ easeInOutQuint: function (x, t, b, c, d) {
+ if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
+ return c/2*((t-=2)*t*t*t*t + 2) + b;
+ },
+ easeInSine: function (x, t, b, c, d) {
+ return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
+ },
+ easeOutSine: function (x, t, b, c, d) {
+ return c * Math.sin(t/d * (Math.PI/2)) + b;
+ },
+ easeInOutSine: function (x, t, b, c, d) {
+ return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
+ },
+ easeInExpo: function (x, t, b, c, d) {
+ return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
+ },
+ easeOutExpo: function (x, t, b, c, d) {
+ return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
+ },
+ easeInOutExpo: function (x, t, b, c, d) {
+ if (t==0) return b;
+ if (t==d) return b+c;
+ if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
+ return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
+ },
+ easeInCirc: function (x, t, b, c, d) {
+ return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
+ },
+ easeOutCirc: function (x, t, b, c, d) {
+ return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
+ },
+ easeInOutCirc: function (x, t, b, c, d) {
+ if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
+ return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
+ },
+ easeInElastic: function (x, t, b, c, d) {
+ var s=1.70158;var p=0;var a=c;
+ if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
+ if (a < Math.abs(c)) { a=c; var s=p/4; }
+ else var s = p/(2*Math.PI) * Math.asin (c/a);
+ return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
+ },
+ easeOutElastic: function (x, t, b, c, d) {
+ var s=1.70158;var p=0;var a=c;
+ if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
+ if (a < Math.abs(c)) { a=c; var s=p/4; }
+ else var s = p/(2*Math.PI) * Math.asin (c/a);
+ return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
+ },
+ easeInOutElastic: function (x, t, b, c, d) {
+ var s=1.70158;var p=0;var a=c;
+ if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
+ if (a < Math.abs(c)) { a=c; var s=p/4; }
+ else var s = p/(2*Math.PI) * Math.asin (c/a);
+ if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
+ return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
+ },
+ easeInBack: function (x, t, b, c, d, s) {
+ if (s == undefined) s = 1.70158;
+ return c*(t/=d)*t*((s+1)*t - s) + b;
+ },
+ easeOutBack: function (x, t, b, c, d, s) {
+ if (s == undefined) s = 1.70158;
+ return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
+ },
+ easeInOutBack: function (x, t, b, c, d, s) {
+ if (s == undefined) s = 1.70158;
+ if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
+ return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
+ },
+ easeInBounce: function (x, t, b, c, d) {
+ return c - $.easing.easeOutBounce (x, d-t, 0, c, d) + b;
+ },
+ easeOutBounce: function (x, t, b, c, d) {
+ if ((t/=d) < (1/2.75)) {
+ return c*(7.5625*t*t) + b;
+ } else if (t < (2/2.75)) {
+ return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
+ } else if (t < (2.5/2.75)) {
+ return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
+ } else {
+ return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
+ }
+ },
+ easeInOutBounce: function (x, t, b, c, d) {
+ if (t < d/2) return $.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
+ return $.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
+ }
+});
+
+/*
+ *
+ * TERMS OF USE - EASING EQUATIONS
+ *
+ * Open source under the BSD License.
+ *
+ * Copyright 2001 Robert Penner
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * Neither the name of the author nor the names of contributors may be used to endorse
+ * or promote products derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+})(jQuery);
+/*
+ * jQuery UI Effects Blind 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Effects/Blind
+ *
+ * Depends:
+ * jquery.effects.core.js
+ */
+(function( $, undefined ) {
+
+$.effects.blind = function(o) {
+
+ return this.queue(function() {
+
+ // Create element
+ var el = $(this), props = ['position','top','bottom','left','right'];
+
+ // Set options
+ var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
+ var direction = o.options.direction || 'vertical'; // Default direction
+
+ // Adjust
+ $.effects.save(el, props); el.show(); // Save & Show
+ var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
+ var ref = (direction == 'vertical') ? 'height' : 'width';
+ var distance = (direction == 'vertical') ? wrapper.height() : wrapper.width();
+ if(mode == 'show') wrapper.css(ref, 0); // Shift
+
+ // Animation
+ var animation = {};
+ animation[ref] = mode == 'show' ? distance : 0;
+
+ // Animate
+ wrapper.animate(animation, o.duration, o.options.easing, function() {
+ if(mode == 'hide') el.hide(); // Hide
+ $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
+ if(o.callback) o.callback.apply(el[0], arguments); // Callback
+ el.dequeue();
+ });
+
+ });
+
+};
+
+})(jQuery);
+/*
+ * jQuery UI Effects Bounce 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Effects/Bounce
+ *
+ * Depends:
+ * jquery.effects.core.js
+ */
+(function( $, undefined ) {
+
+$.effects.bounce = function(o) {
+
+ return this.queue(function() {
+
+ // Create element
+ var el = $(this), props = ['position','top','bottom','left','right'];
+
+ // Set options
+ var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
+ var direction = o.options.direction || 'up'; // Default direction
+ var distance = o.options.distance || 20; // Default distance
+ var times = o.options.times || 5; // Default # of times
+ var speed = o.duration || 250; // Default speed per bounce
+ if (/show|hide/.test(mode)) props.push('opacity'); // Avoid touching opacity to prevent clearType and PNG issues in IE
+
+ // Adjust
+ $.effects.save(el, props); el.show(); // Save & Show
+ $.effects.createWrapper(el); // Create Wrapper
+ var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
+ var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
+ var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) / 3 : el.outerWidth({margin:true}) / 3);
+ if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift
+ if (mode == 'hide') distance = distance / (times * 2);
+ if (mode != 'hide') times--;
+
+ // Animate
+ if (mode == 'show') { // Show Bounce
+ var animation = {opacity: 1};
+ animation[ref] = (motion == 'pos' ? '+=' : '-=') + distance;
+ el.animate(animation, speed / 2, o.options.easing);
+ distance = distance / 2;
+ times--;
+ };
+ for (var i = 0; i < times; i++) { // Bounces
+ var animation1 = {}, animation2 = {};
+ animation1[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
+ animation2[ref] = (motion == 'pos' ? '+=' : '-=') + distance;
+ el.animate(animation1, speed / 2, o.options.easing).animate(animation2, speed / 2, o.options.easing);
+ distance = (mode == 'hide') ? distance * 2 : distance / 2;
+ };
+ if (mode == 'hide') { // Last Bounce
+ var animation = {opacity: 0};
+ animation[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
+ el.animate(animation, speed / 2, o.options.easing, function(){
+ el.hide(); // Hide
+ $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
+ if(o.callback) o.callback.apply(this, arguments); // Callback
+ });
+ } else {
+ var animation1 = {}, animation2 = {};
+ animation1[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
+ animation2[ref] = (motion == 'pos' ? '+=' : '-=') + distance;
+ el.animate(animation1, speed / 2, o.options.easing).animate(animation2, speed / 2, o.options.easing, function(){
+ $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
+ if(o.callback) o.callback.apply(this, arguments); // Callback
+ });
+ };
+ el.queue('fx', function() { el.dequeue(); });
+ el.dequeue();
+ });
+
+};
+
+})(jQuery);
+/*
+ * jQuery UI Effects Clip 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Effects/Clip
+ *
+ * Depends:
+ * jquery.effects.core.js
+ */
+(function( $, undefined ) {
+
+$.effects.clip = function(o) {
+
+ return this.queue(function() {
+
+ // Create element
+ var el = $(this), props = ['position','top','bottom','left','right','height','width'];
+
+ // Set options
+ var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
+ var direction = o.options.direction || 'vertical'; // Default direction
+
+ // Adjust
+ $.effects.save(el, props); el.show(); // Save & Show
+ var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
+ var animate = el[0].tagName == 'IMG' ? wrapper : el;
+ var ref = {
+ size: (direction == 'vertical') ? 'height' : 'width',
+ position: (direction == 'vertical') ? 'top' : 'left'
+ };
+ var distance = (direction == 'vertical') ? animate.height() : animate.width();
+ if(mode == 'show') { animate.css(ref.size, 0); animate.css(ref.position, distance / 2); } // Shift
+
+ // Animation
+ var animation = {};
+ animation[ref.size] = mode == 'show' ? distance : 0;
+ animation[ref.position] = mode == 'show' ? 0 : distance / 2;
+
+ // Animate
+ animate.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
+ if(mode == 'hide') el.hide(); // Hide
+ $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
+ if(o.callback) o.callback.apply(el[0], arguments); // Callback
+ el.dequeue();
+ }});
+
+ });
+
+};
+
+})(jQuery);
+/*
+ * jQuery UI Effects Drop 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Effects/Drop
+ *
+ * Depends:
+ * jquery.effects.core.js
+ */
+(function( $, undefined ) {
+
+$.effects.drop = function(o) {
+
+ return this.queue(function() {
+
+ // Create element
+ var el = $(this), props = ['position','top','bottom','left','right','opacity'];
+
+ // Set options
+ var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
+ var direction = o.options.direction || 'left'; // Default Direction
+
+ // Adjust
+ $.effects.save(el, props); el.show(); // Save & Show
+ $.effects.createWrapper(el); // Create Wrapper
+ var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
+ var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
+ var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) / 2 : el.outerWidth({margin:true}) / 2);
+ if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift
+
+ // Animation
+ var animation = {opacity: mode == 'show' ? 1 : 0};
+ animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance;
+
+ // Animate
+ el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
+ if(mode == 'hide') el.hide(); // Hide
+ $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
+ if(o.callback) o.callback.apply(this, arguments); // Callback
+ el.dequeue();
+ }});
+
+ });
+
+};
+
+})(jQuery);
+/*
+ * jQuery UI Effects Explode 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Effects/Explode
+ *
+ * Depends:
+ * jquery.effects.core.js
+ */
+(function( $, undefined ) {
+
+$.effects.explode = function(o) {
+
+ return this.queue(function() {
+
+ var rows = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3;
+ var cells = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3;
+
+ o.options.mode = o.options.mode == 'toggle' ? ($(this).is(':visible') ? 'hide' : 'show') : o.options.mode;
+ var el = $(this).show().css('visibility', 'hidden');
+ var offset = el.offset();
+
+ //Substract the margins - not fixing the problem yet.
+ offset.top -= parseInt(el.css("marginTop"),10) || 0;
+ offset.left -= parseInt(el.css("marginLeft"),10) || 0;
+
+ var width = el.outerWidth(true);
+ var height = el.outerHeight(true);
+
+ for(var i=0;i<rows;i++) { // =
+ for(var j=0;j<cells;j++) { // ||
+ el
+ .clone()
+ .appendTo('body')
+ .wrap('<div></div>')
+ .css({
+ position: 'absolute',
+ visibility: 'visible',
+ left: -j*(width/cells),
+ top: -i*(height/rows)
+ })
+ .parent()
+ .addClass('ui-effects-explode')
+ .css({
+ position: 'absolute',
+ overflow: 'hidden',
+ width: width/cells,
+ height: height/rows,
+ left: offset.left + j*(width/cells) + (o.options.mode == 'show' ? (j-Math.floor(cells/2))*(width/cells) : 0),
+ top: offset.top + i*(height/rows) + (o.options.mode == 'show' ? (i-Math.floor(rows/2))*(height/rows) : 0),
+ opacity: o.options.mode == 'show' ? 0 : 1
+ }).animate({
+ left: offset.left + j*(width/cells) + (o.options.mode == 'show' ? 0 : (j-Math.floor(cells/2))*(width/cells)),
+ top: offset.top + i*(height/rows) + (o.options.mode == 'show' ? 0 : (i-Math.floor(rows/2))*(height/rows)),
+ opacity: o.options.mode == 'show' ? 1 : 0
+ }, o.duration || 500);
+ }
+ }
+
+ // Set a timeout, to call the callback approx. when the other animations have finished
+ setTimeout(function() {
+
+ o.options.mode == 'show' ? el.css({ visibility: 'visible' }) : el.css({ visibility: 'visible' }).hide();
+ if(o.callback) o.callback.apply(el[0]); // Callback
+ el.dequeue();
+
+ $('div.ui-effects-explode').remove();
+
+ }, o.duration || 500);
+
+
+ });
+
+};
+
+})(jQuery);
+/*
+ * jQuery UI Effects Fade 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Effects/Fade
+ *
+ * Depends:
+ * jquery.effects.core.js
+ */
+(function( $, undefined ) {
+
+$.effects.fade = function(o) {
+ return this.queue(function() {
+ var elem = $(this),
+ mode = $.effects.setMode(elem, o.options.mode || 'hide');
+
+ elem.animate({ opacity: mode }, {
+ queue: false,
+ duration: o.duration,
+ easing: o.options.easing,
+ complete: function() {
+ (o.callback && o.callback.apply(this, arguments));
+ elem.dequeue();
+ }
+ });
+ });
+};
+
+})(jQuery);
+/*
+ * jQuery UI Effects Fold 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Effects/Fold
+ *
+ * Depends:
+ * jquery.effects.core.js
+ */
+(function( $, undefined ) {
+
+$.effects.fold = function(o) {
+
+ return this.queue(function() {
+
+ // Create element
+ var el = $(this), props = ['position','top','bottom','left','right'];
+
+ // Set options
+ var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
+ var size = o.options.size || 15; // Default fold size
+ var horizFirst = !(!o.options.horizFirst); // Ensure a boolean value
+ var duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2;
+
+ // Adjust
+ $.effects.save(el, props); el.show(); // Save & Show
+ var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
+ var widthFirst = ((mode == 'show') != horizFirst);
+ var ref = widthFirst ? ['width', 'height'] : ['height', 'width'];
+ var distance = widthFirst ? [wrapper.width(), wrapper.height()] : [wrapper.height(), wrapper.width()];
+ var percent = /([0-9]+)%/.exec(size);
+ if(percent) size = parseInt(percent[1],10) / 100 * distance[mode == 'hide' ? 0 : 1];
+ if(mode == 'show') wrapper.css(horizFirst ? {height: 0, width: size} : {height: size, width: 0}); // Shift
+
+ // Animation
+ var animation1 = {}, animation2 = {};
+ animation1[ref[0]] = mode == 'show' ? distance[0] : size;
+ animation2[ref[1]] = mode == 'show' ? distance[1] : 0;
+
+ // Animate
+ wrapper.animate(animation1, duration, o.options.easing)
+ .animate(animation2, duration, o.options.easing, function() {
+ if(mode == 'hide') el.hide(); // Hide
+ $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
+ if(o.callback) o.callback.apply(el[0], arguments); // Callback
+ el.dequeue();
+ });
+
+ });
+
+};
+
+})(jQuery);
+/*
+ * jQuery UI Effects Highlight 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Effects/Highlight
+ *
+ * Depends:
+ * jquery.effects.core.js
+ */
+(function( $, undefined ) {
+
+$.effects.highlight = function(o) {
+ return this.queue(function() {
+ var elem = $(this),
+ props = ['backgroundImage', 'backgroundColor', 'opacity'],
+ mode = $.effects.setMode(elem, o.options.mode || 'show'),
+ animation = {
+ backgroundColor: elem.css('backgroundColor')
+ };
+
+ if (mode == 'hide') {
+ animation.opacity = 0;
+ }
+
+ $.effects.save(elem, props);
+ elem
+ .show()
+ .css({
+ backgroundImage: 'none',
+ backgroundColor: o.options.color || '#ffff99'
+ })
+ .animate(animation, {
+ queue: false,
+ duration: o.duration,
+ easing: o.options.easing,
+ complete: function() {
+ (mode == 'hide' && elem.hide());
+ $.effects.restore(elem, props);
+ (mode == 'show' && !$.support.opacity && this.style.removeAttribute('filter'));
+ (o.callback && o.callback.apply(this, arguments));
+ elem.dequeue();
+ }
+ });
+ });
+};
+
+})(jQuery);
+/*
+ * jQuery UI Effects Pulsate 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Effects/Pulsate
+ *
+ * Depends:
+ * jquery.effects.core.js
+ */
+(function( $, undefined ) {
+
+$.effects.pulsate = function(o) {
+ return this.queue(function() {
+ var elem = $(this),
+ mode = $.effects.setMode(elem, o.options.mode || 'show');
+ times = ((o.options.times || 5) * 2) - 1;
+ duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2,
+ isVisible = elem.is(':visible'),
+ animateTo = 0;
+
+ if (!isVisible) {
+ elem.css('opacity', 0).show();
+ animateTo = 1;
+ }
+
+ if ((mode == 'hide' && isVisible) || (mode == 'show' && !isVisible)) {
+ times--;
+ }
+
+ for (var i = 0; i < times; i++) {
+ elem.animate({ opacity: animateTo }, duration, o.options.easing);
+ animateTo = (animateTo + 1) % 2;
+ }
+
+ elem.animate({ opacity: animateTo }, duration, o.options.easing, function() {
+ if (animateTo == 0) {
+ elem.hide();
+ }
+ (o.callback && o.callback.apply(this, arguments));
+ });
+
+ elem
+ .queue('fx', function() { elem.dequeue(); })
+ .dequeue();
+ });
+};
+
+})(jQuery);
+/*
+ * jQuery UI Effects Scale 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Effects/Scale
+ *
+ * Depends:
+ * jquery.effects.core.js
+ */
+(function( $, undefined ) {
+
+$.effects.puff = function(o) {
+ return this.queue(function() {
+ var elem = $(this),
+ mode = $.effects.setMode(elem, o.options.mode || 'hide'),
+ percent = parseInt(o.options.percent, 10) || 150,
+ factor = percent / 100,
+ original = { height: elem.height(), width: elem.width() };
+
+ $.extend(o.options, {
+ fade: true,
+ mode: mode,
+ percent: mode == 'hide' ? percent : 100,
+ from: mode == 'hide'
+ ? original
+ : {
+ height: original.height * factor,
+ width: original.width * factor
+ }
+ });
+
+ elem.effect('scale', o.options, o.duration, o.callback);
+ elem.dequeue();
+ });
+};
+
+$.effects.scale = function(o) {
+
+ return this.queue(function() {
+
+ // Create element
+ var el = $(this);
+
+ // Set options
+ var options = $.extend(true, {}, o.options);
+ var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
+ var percent = parseInt(o.options.percent,10) || (parseInt(o.options.percent,10) == 0 ? 0 : (mode == 'hide' ? 0 : 100)); // Set default scaling percent
+ var direction = o.options.direction || 'both'; // Set default axis
+ var origin = o.options.origin; // The origin of the scaling
+ if (mode != 'effect') { // Set default origin and restore for show/hide
+ options.origin = origin || ['middle','center'];
+ options.restore = true;
+ }
+ var original = {height: el.height(), width: el.width()}; // Save original
+ el.from = o.options.from || (mode == 'show' ? {height: 0, width: 0} : original); // Default from state
+
+ // Adjust
+ var factor = { // Set scaling factor
+ y: direction != 'horizontal' ? (percent / 100) : 1,
+ x: direction != 'vertical' ? (percent / 100) : 1
+ };
+ el.to = {height: original.height * factor.y, width: original.width * factor.x}; // Set to state
+
+ if (o.options.fade) { // Fade option to support puff
+ if (mode == 'show') {el.from.opacity = 0; el.to.opacity = 1;};
+ if (mode == 'hide') {el.from.opacity = 1; el.to.opacity = 0;};
+ };
+
+ // Animation
+ options.from = el.from; options.to = el.to; options.mode = mode;
+
+ // Animate
+ el.effect('size', options, o.duration, o.callback);
+ el.dequeue();
+ });
+
+};
+
+$.effects.size = function(o) {
+
+ return this.queue(function() {
+
+ // Create element
+ var el = $(this), props = ['position','top','bottom','left','right','width','height','overflow','opacity'];
+ var props1 = ['position','top','bottom','left','right','overflow','opacity']; // Always restore
+ var props2 = ['width','height','overflow']; // Copy for children
+ var cProps = ['fontSize'];
+ var vProps = ['borderTopWidth', 'borderBottomWidth', 'paddingTop', 'paddingBottom'];
+ var hProps = ['borderLeftWidth', 'borderRightWidth', 'paddingLeft', 'paddingRight'];
+
+ // Set options
+ var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
+ var restore = o.options.restore || false; // Default restore
+ var scale = o.options.scale || 'both'; // Default scale mode
+ var origin = o.options.origin; // The origin of the sizing
+ var original = {height: el.height(), width: el.width()}; // Save original
+ el.from = o.options.from || original; // Default from state
+ el.to = o.options.to || original; // Default to state
+ // Adjust
+ if (origin) { // Calculate baseline shifts
+ var baseline = $.effects.getBaseline(origin, original);
+ el.from.top = (original.height - el.from.height) * baseline.y;
+ el.from.left = (original.width - el.from.width) * baseline.x;
+ el.to.top = (original.height - el.to.height) * baseline.y;
+ el.to.left = (original.width - el.to.width) * baseline.x;
+ };
+ var factor = { // Set scaling factor
+ from: {y: el.from.height / original.height, x: el.from.width / original.width},
+ to: {y: el.to.height / original.height, x: el.to.width / original.width}
+ };
+ if (scale == 'box' || scale == 'both') { // Scale the css box
+ if (factor.from.y != factor.to.y) { // Vertical props scaling
+ props = props.concat(vProps);
+ el.from = $.effects.setTransition(el, vProps, factor.from.y, el.from);
+ el.to = $.effects.setTransition(el, vProps, factor.to.y, el.to);
+ };
+ if (factor.from.x != factor.to.x) { // Horizontal props scaling
+ props = props.concat(hProps);
+ el.from = $.effects.setTransition(el, hProps, factor.from.x, el.from);
+ el.to = $.effects.setTransition(el, hProps, factor.to.x, el.to);
+ };
+ };
+ if (scale == 'content' || scale == 'both') { // Scale the content
+ if (factor.from.y != factor.to.y) { // Vertical props scaling
+ props = props.concat(cProps);
+ el.from = $.effects.setTransition(el, cProps, factor.from.y, el.from);
+ el.to = $.effects.setTransition(el, cProps, factor.to.y, el.to);
+ };
+ };
+ $.effects.save(el, restore ? props : props1); el.show(); // Save & Show
+ $.effects.createWrapper(el); // Create Wrapper
+ el.css('overflow','hidden').css(el.from); // Shift
+
+ // Animate
+ if (scale == 'content' || scale == 'both') { // Scale the children
+ vProps = vProps.concat(['marginTop','marginBottom']).concat(cProps); // Add margins/font-size
+ hProps = hProps.concat(['marginLeft','marginRight']); // Add margins
+ props2 = props.concat(vProps).concat(hProps); // Concat
+ el.find("*[width]").each(function(){
+ child = $(this);
+ if (restore) $.effects.save(child, props2);
+ var c_original = {height: child.height(), width: child.width()}; // Save original
+ child.from = {height: c_original.height * factor.from.y, width: c_original.width * factor.from.x};
+ child.to = {height: c_original.height * factor.to.y, width: c_original.width * factor.to.x};
+ if (factor.from.y != factor.to.y) { // Vertical props scaling
+ child.from = $.effects.setTransition(child, vProps, factor.from.y, child.from);
+ child.to = $.effects.setTransition(child, vProps, factor.to.y, child.to);
+ };
+ if (factor.from.x != factor.to.x) { // Horizontal props scaling
+ child.from = $.effects.setTransition(child, hProps, factor.from.x, child.from);
+ child.to = $.effects.setTransition(child, hProps, factor.to.x, child.to);
+ };
+ child.css(child.from); // Shift children
+ child.animate(child.to, o.duration, o.options.easing, function(){
+ if (restore) $.effects.restore(child, props2); // Restore children
+ }); // Animate children
+ });
+ };
+
+ // Animate
+ el.animate(el.to, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
+ if (el.to.opacity === 0) {
+ el.css('opacity', el.from.opacity);
+ }
+ if(mode == 'hide') el.hide(); // Hide
+ $.effects.restore(el, restore ? props : props1); $.effects.removeWrapper(el); // Restore
+ if(o.callback) o.callback.apply(this, arguments); // Callback
+ el.dequeue();
+ }});
+
+ });
+
+};
+
+})(jQuery);
+/*
+ * jQuery UI Effects Shake 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Effects/Shake
+ *
+ * Depends:
+ * jquery.effects.core.js
+ */
+(function( $, undefined ) {
+
+$.effects.shake = function(o) {
+
+ return this.queue(function() {
+
+ // Create element
+ var el = $(this), props = ['position','top','bottom','left','right'];
+
+ // Set options
+ var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
+ var direction = o.options.direction || 'left'; // Default direction
+ var distance = o.options.distance || 20; // Default distance
+ var times = o.options.times || 3; // Default # of times
+ var speed = o.duration || o.options.duration || 140; // Default speed per shake
+
+ // Adjust
+ $.effects.save(el, props); el.show(); // Save & Show
+ $.effects.createWrapper(el); // Create Wrapper
+ var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
+ var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
+
+ // Animation
+ var animation = {}, animation1 = {}, animation2 = {};
+ animation[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
+ animation1[ref] = (motion == 'pos' ? '+=' : '-=') + distance * 2;
+ animation2[ref] = (motion == 'pos' ? '-=' : '+=') + distance * 2;
+
+ // Animate
+ el.animate(animation, speed, o.options.easing);
+ for (var i = 1; i < times; i++) { // Shakes
+ el.animate(animation1, speed, o.options.easing).animate(animation2, speed, o.options.easing);
+ };
+ el.animate(animation1, speed, o.options.easing).
+ animate(animation, speed / 2, o.options.easing, function(){ // Last shake
+ $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
+ if(o.callback) o.callback.apply(this, arguments); // Callback
+ });
+ el.queue('fx', function() { el.dequeue(); });
+ el.dequeue();
+ });
+
+};
+
+})(jQuery);
+/*
+ * jQuery UI Effects Slide 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Effects/Slide
+ *
+ * Depends:
+ * jquery.effects.core.js
+ */
+(function( $, undefined ) {
+
+$.effects.slide = function(o) {
+
+ return this.queue(function() {
+
+ // Create element
+ var el = $(this), props = ['position','top','bottom','left','right'];
+
+ // Set options
+ var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode
+ var direction = o.options.direction || 'left'; // Default Direction
+
+ // Adjust
+ $.effects.save(el, props); el.show(); // Save & Show
+ $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
+ var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
+ var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
+ var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) : el.outerWidth({margin:true}));
+ if (mode == 'show') el.css(ref, motion == 'pos' ? (isNaN(distance) ? "-" + distance : -distance) : distance); // Shift
+
+ // Animation
+ var animation = {};
+ animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance;
+
+ // Animate
+ el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
+ if(mode == 'hide') el.hide(); // Hide
+ $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
+ if(o.callback) o.callback.apply(this, arguments); // Callback
+ el.dequeue();
+ }});
+
+ });
+
+};
+
+})(jQuery);
+/*
+ * jQuery UI Effects Transfer 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Effects/Transfer
+ *
+ * Depends:
+ * jquery.effects.core.js
+ */
+(function( $, undefined ) {
+
+$.effects.transfer = function(o) {
+ return this.queue(function() {
+ var elem = $(this),
+ target = $(o.options.to),
+ endPosition = target.offset(),
+ animation = {
+ top: endPosition.top,
+ left: endPosition.left,
+ height: target.innerHeight(),
+ width: target.innerWidth()
+ },
+ startPosition = elem.offset(),
+ transfer = $('<div class="ui-effects-transfer"></div>')
+ .appendTo(document.body)
+ .addClass(o.options.className)
+ .css({
+ top: startPosition.top,
+ left: startPosition.left,
+ height: elem.innerHeight(),
+ width: elem.innerWidth(),
+ position: 'absolute'
+ })
+ .animate(animation, o.duration, o.options.easing, function() {
+ transfer.remove();
+ (o.callback && o.callback.apply(elem[0], arguments));
+ elem.dequeue();
+ });
+ });
+};
+
+})(jQuery);
+/*
+ * jQuery UI Accordion 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Accordion
+ *
+ * Depends:
+ * jquery.ui.core.js
+ * jquery.ui.widget.js
+ */
+(function( $, undefined ) {
+
+$.widget( "ui.accordion", {
+ options: {
+ active: 0,
+ animated: "slide",
+ autoHeight: true,
+ clearStyle: false,
+ collapsible: false,
+ event: "click",
+ fillSpace: false,
+ header: "> li > :first-child,> :not(li):even",
+ icons: {
+ header: "ui-icon-triangle-1-e",
+ headerSelected: "ui-icon-triangle-1-s"
+ },
+ navigation: false,
+ navigationFilter: function() {
+ return this.href.toLowerCase() === location.href.toLowerCase();
+ }
+ },
+
+ _create: function() {
+ var self = this,
+ options = self.options;
+
+ self.running = 0;
+
+ self.element
+ .addClass( "ui-accordion ui-widget ui-helper-reset" )
+ // in lack of child-selectors in CSS
+ // we need to mark top-LIs in a UL-accordion for some IE-fix
+ .children( "li" )
+ .addClass( "ui-accordion-li-fix" );
+
+ self.headers = self.element.find( options.header )
+ .addClass( "ui-accordion-header ui-helper-reset ui-state-default ui-corner-all" )
+ .bind( "mouseenter.accordion", function() {
+ if ( options.disabled ) {
+ return;
+ }
+ $( this ).addClass( "ui-state-hover" );
+ })
+ .bind( "mouseleave.accordion", function() {
+ if ( options.disabled ) {
+ return;
+ }
+ $( this ).removeClass( "ui-state-hover" );
+ })
+ .bind( "focus.accordion", function() {
+ if ( options.disabled ) {
+ return;
+ }
+ $( this ).addClass( "ui-state-focus" );
+ })
+ .bind( "blur.accordion", function() {
+ if ( options.disabled ) {
+ return;
+ }
+ $( this ).removeClass( "ui-state-focus" );
+ });
+
+ self.headers.next()
+ .addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" );
+
+ if ( options.navigation ) {
+ var current = self.element.find( "a" ).filter( options.navigationFilter ).eq( 0 );
+ if ( current.length ) {
+ var header = current.closest( ".ui-accordion-header" );
+ if ( header.length ) {
+ // anchor within header
+ self.active = header;
+ } else {
+ // anchor within content
+ self.active = current.closest( ".ui-accordion-content" ).prev();
+ }
+ }
+ }
+
+ self.active = self._findActive( self.active || options.active )
+ .addClass( "ui-state-default ui-state-active" )
+ .toggleClass( "ui-corner-all" )
+ .toggleClass( "ui-corner-top" );
+ self.active.next().addClass( "ui-accordion-content-active" );
+
+ self._createIcons();
+ self.resize();
+
+ // ARIA
+ self.element.attr( "role", "tablist" );
+
+ self.headers
+ .attr( "role", "tab" )
+ .bind( "keydown.accordion", function( event ) {
+ return self._keydown( event );
+ })
+ .next()
+ .attr( "role", "tabpanel" );
+
+ self.headers
+ .not( self.active || "" )
+ .attr({
+ "aria-expanded": "false",
+ "aria-selected": "false",
+ tabIndex: -1
+ })
+ .next()
+ .hide();
+
+ // make sure at least one header is in the tab order
+ if ( !self.active.length ) {
+ self.headers.eq( 0 ).attr( "tabIndex", 0 );
+ } else {
+ self.active
+ .attr({
+ "aria-expanded": "true",
+ "aria-selected": "true",
+ tabIndex: 0
+ });
+ }
+
+ // only need links in tab order for Safari
+ if ( !$.browser.safari ) {
+ self.headers.find( "a" ).attr( "tabIndex", -1 );
+ }
+
+ if ( options.event ) {
+ self.headers.bind( options.event.split(" ").join(".accordion ") + ".accordion", function(event) {
+ self._clickHandler.call( self, event, this );
+ event.preventDefault();
+ });
+ }
+ },
+
+ _createIcons: function() {
+ var options = this.options;
+ if ( options.icons ) {
+ $( "<span></span>" )
+ .addClass( "ui-icon " + options.icons.header )
+ .prependTo( this.headers );
+ this.active.children( ".ui-icon" )
+ .toggleClass(options.icons.header)
+ .toggleClass(options.icons.headerSelected);
+ this.element.addClass( "ui-accordion-icons" );
+ }
+ },
+
+ _destroyIcons: function() {
+ this.headers.children( ".ui-icon" ).remove();
+ this.element.removeClass( "ui-accordion-icons" );
+ },
+
+ destroy: function() {
+ var options = this.options;
+
+ this.element
+ .removeClass( "ui-accordion ui-widget ui-helper-reset" )
+ .removeAttr( "role" );
+
+ this.headers
+ .unbind( ".accordion" )
+ .removeClass( "ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top" )
+ .removeAttr( "role" )
+ .removeAttr( "aria-expanded" )
+ .removeAttr( "aria-selected" )
+ .removeAttr( "tabIndex" );
+
+ this.headers.find( "a" ).removeAttr( "tabIndex" );
+ this._destroyIcons();
+ var contents = this.headers.next()
+ .css( "display", "" )
+ .removeAttr( "role" )
+ .removeClass( "ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled" );
+ if ( options.autoHeight || options.fillHeight ) {
+ contents.css( "height", "" );
+ }
+
+ return $.Widget.prototype.destroy.call( this );
+ },
+
+ _setOption: function( key, value ) {
+ $.Widget.prototype._setOption.apply( this, arguments );
+
+ if ( key == "active" ) {
+ this.activate( value );
+ }
+ if ( key == "icons" ) {
+ this._destroyIcons();
+ if ( value ) {
+ this._createIcons();
+ }
+ }
+ // #5332 - opacity doesn't cascade to positioned elements in IE
+ // so we need to add the disabled class to the headers and panels
+ if ( key == "disabled" ) {
+ this.headers.add(this.headers.next())
+ [ value ? "addClass" : "removeClass" ](
+ "ui-accordion-disabled ui-state-disabled" );
+ }
+ },
+
+ _keydown: function( event ) {
+ if ( this.options.disabled || event.altKey || event.ctrlKey ) {
+ return;
+ }
+
+ var keyCode = $.ui.keyCode,
+ length = this.headers.length,
+ currentIndex = this.headers.index( event.target ),
+ toFocus = false;
+
+ switch ( event.keyCode ) {
+ case keyCode.RIGHT:
+ case keyCode.DOWN:
+ toFocus = this.headers[ ( currentIndex + 1 ) % length ];
+ break;
+ case keyCode.LEFT:
+ case keyCode.UP:
+ toFocus = this.headers[ ( currentIndex - 1 + length ) % length ];
+ break;
+ case keyCode.SPACE:
+ case keyCode.ENTER:
+ this._clickHandler( { target: event.target }, event.target );
+ event.preventDefault();
+ }
+
+ if ( toFocus ) {
+ $( event.target ).attr( "tabIndex", -1 );
+ $( toFocus ).attr( "tabIndex", 0 );
+ toFocus.focus();
+ return false;
+ }
+
+ return true;
+ },
+
+ resize: function() {
+ var options = this.options,
+ maxHeight;
+
+ if ( options.fillSpace ) {
+ if ( $.browser.msie ) {
+ var defOverflow = this.element.parent().css( "overflow" );
+ this.element.parent().css( "overflow", "hidden");
+ }
+ maxHeight = this.element.parent().height();
+ if ($.browser.msie) {
+ this.element.parent().css( "overflow", defOverflow );
+ }
+
+ this.headers.each(function() {
+ maxHeight -= $( this ).outerHeight( true );
+ });
+
+ this.headers.next()
+ .each(function() {
+ $( this ).height( Math.max( 0, maxHeight -
+ $( this ).innerHeight() + $( this ).height() ) );
+ })
+ .css( "overflow", "auto" );
+ } else if ( options.autoHeight ) {
+ maxHeight = 0;
+ this.headers.next()
+ .each(function() {
+ maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() );
+ })
+ .height( maxHeight );
+ }
+
+ return this;
+ },
+
+ activate: function( index ) {
+ // TODO this gets called on init, changing the option without an explicit call for that
+ this.options.active = index;
+ // call clickHandler with custom event
+ var active = this._findActive( index )[ 0 ];
+ this._clickHandler( { target: active }, active );
+
+ return this;
+ },
+
+ _findActive: function( selector ) {
+ return selector
+ ? typeof selector === "number"
+ ? this.headers.filter( ":eq(" + selector + ")" )
+ : this.headers.not( this.headers.not( selector ) )
+ : selector === false
+ ? $( [] )
+ : this.headers.filter( ":eq(0)" );
+ },
+
+ // TODO isn't event.target enough? why the separate target argument?
+ _clickHandler: function( event, target ) {
+ var options = this.options;
+ if ( options.disabled ) {
+ return;
+ }
+
+ // called only when using activate(false) to close all parts programmatically
+ if ( !event.target ) {
+ if ( !options.collapsible ) {
+ return;
+ }
+ this.active
+ .removeClass( "ui-state-active ui-corner-top" )
+ .addClass( "ui-state-default ui-corner-all" )
+ .children( ".ui-icon" )
+ .removeClass( options.icons.headerSelected )
+ .addClass( options.icons.header );
+ this.active.next().addClass( "ui-accordion-content-active" );
+ var toHide = this.active.next(),
+ data = {
+ options: options,
+ newHeader: $( [] ),
+ oldHeader: options.active,
+ newContent: $( [] ),
+ oldContent: toHide
+ },
+ toShow = ( this.active = $( [] ) );
+ this._toggle( toShow, toHide, data );
+ return;
+ }
+
+ // get the click target
+ var clicked = $( event.currentTarget || target ),
+ clickedIsActive = clicked[0] === this.active[0];
+
+ // TODO the option is changed, is that correct?
+ // TODO if it is correct, shouldn't that happen after determining that the click is valid?
+ options.active = options.collapsible && clickedIsActive ?
+ false :
+ this.headers.index( clicked );
+
+ // if animations are still active, or the active header is the target, ignore click
+ if ( this.running || ( !options.collapsible && clickedIsActive ) ) {
+ return;
+ }
+
+ // find elements to show and hide
+ var active = this.active,
+ toShow = clicked.next(),
+ toHide = this.active.next(),
+ data = {
+ options: options,
+ newHeader: clickedIsActive && options.collapsible ? $([]) : clicked,
+ oldHeader: this.active,
+ newContent: clickedIsActive && options.collapsible ? $([]) : toShow,
+ oldContent: toHide
+ },
+ down = this.headers.index( this.active[0] ) > this.headers.index( clicked[0] );
+
+ // when the call to ._toggle() comes after the class changes
+ // it causes a very odd bug in IE 8 (see #6720)
+ this.active = clickedIsActive ? $([]) : clicked;
+ this._toggle( toShow, toHide, data, clickedIsActive, down );
+
+ // switch classes
+ active
+ .removeClass( "ui-state-active ui-corner-top" )
+ .addClass( "ui-state-default ui-corner-all" )
+ .children( ".ui-icon" )
+ .removeClass( options.icons.headerSelected )
+ .addClass( options.icons.header );
+ if ( !clickedIsActive ) {
+ clicked
+ .removeClass( "ui-state-default ui-corner-all" )
+ .addClass( "ui-state-active ui-corner-top" )
+ .children( ".ui-icon" )
+ .removeClass( options.icons.header )
+ .addClass( options.icons.headerSelected );
+ clicked
+ .next()
+ .addClass( "ui-accordion-content-active" );
+ }
+
+ return;
+ },
+
+ _toggle: function( toShow, toHide, data, clickedIsActive, down ) {
+ var self = this,
+ options = self.options;
+
+ self.toShow = toShow;
+ self.toHide = toHide;
+ self.data = data;
+
+ var complete = function() {
+ if ( !self ) {
+ return;
+ }
+ return self._completed.apply( self, arguments );
+ };
+
+ // trigger changestart event
+ self._trigger( "changestart", null, self.data );
+
+ // count elements to animate
+ self.running = toHide.size() === 0 ? toShow.size() : toHide.size();
+
+ if ( options.animated ) {
+ var animOptions = {};
+
+ if ( options.collapsible && clickedIsActive ) {
+ animOptions = {
+ toShow: $( [] ),
+ toHide: toHide,
+ complete: complete,
+ down: down,
+ autoHeight: options.autoHeight || options.fillSpace
+ };
+ } else {
+ animOptions = {
+ toShow: toShow,
+ toHide: toHide,
+ complete: complete,
+ down: down,
+ autoHeight: options.autoHeight || options.fillSpace
+ };
+ }
+
+ if ( !options.proxied ) {
+ options.proxied = options.animated;
+ }
+
+ if ( !options.proxiedDuration ) {
+ options.proxiedDuration = options.duration;
+ }
+
+ options.animated = $.isFunction( options.proxied ) ?
+ options.proxied( animOptions ) :
+ options.proxied;
+
+ options.duration = $.isFunction( options.proxiedDuration ) ?
+ options.proxiedDuration( animOptions ) :
+ options.proxiedDuration;
+
+ var animations = $.ui.accordion.animations,
+ duration = options.duration,
+ easing = options.animated;
+
+ if ( easing && !animations[ easing ] && !$.easing[ easing ] ) {
+ easing = "slide";
+ }
+ if ( !animations[ easing ] ) {
+ animations[ easing ] = function( options ) {
+ this.slide( options, {
+ easing: easing,
+ duration: duration || 700
+ });
+ };
+ }
+
+ animations[ easing ]( animOptions );
+ } else {
+ if ( options.collapsible && clickedIsActive ) {
+ toShow.toggle();
+ } else {
+ toHide.hide();
+ toShow.show();
+ }
+
+ complete( true );
+ }
+
+ // TODO assert that the blur and focus triggers are really necessary, remove otherwise
+ toHide.prev()
+ .attr({
+ "aria-expanded": "false",
+ "aria-selected": "false",
+ tabIndex: -1
+ })
+ .blur();
+ toShow.prev()
+ .attr({
+ "aria-expanded": "true",
+ "aria-selected": "true",
+ tabIndex: 0
+ })
+ .focus();
+ },
+
+ _completed: function( cancel ) {
+ this.running = cancel ? 0 : --this.running;
+ if ( this.running ) {
+ return;
+ }
+
+ if ( this.options.clearStyle ) {
+ this.toShow.add( this.toHide ).css({
+ height: "",
+ overflow: ""
+ });
+ }
+
+ // other classes are removed before the animation; this one needs to stay until completed
+ this.toHide.removeClass( "ui-accordion-content-active" );
+ // Work around for rendering bug in IE (#5421)
+ if ( this.toHide.length ) {
+ this.toHide.parent()[0].className = this.toHide.parent()[0].className;
+ }
+
+ this._trigger( "change", null, this.data );
+ }
+});
+
+$.extend( $.ui.accordion, {
+ version: "1.8.18",
+ animations: {
+ slide: function( options, additions ) {
+ options = $.extend({
+ easing: "swing",
+ duration: 300
+ }, options, additions );
+ if ( !options.toHide.size() ) {
+ options.toShow.animate({
+ height: "show",
+ paddingTop: "show",
+ paddingBottom: "show"
+ }, options );
+ return;
+ }
+ if ( !options.toShow.size() ) {
+ options.toHide.animate({
+ height: "hide",
+ paddingTop: "hide",
+ paddingBottom: "hide"
+ }, options );
+ return;
+ }
+ var overflow = options.toShow.css( "overflow" ),
+ percentDone = 0,
+ showProps = {},
+ hideProps = {},
+ fxAttrs = [ "height", "paddingTop", "paddingBottom" ],
+ originalWidth;
+ // fix width before calculating height of hidden element
+ var s = options.toShow;
+ originalWidth = s[0].style.width;
+ s.width( s.parent().width()
+ - parseFloat( s.css( "paddingLeft" ) )
+ - parseFloat( s.css( "paddingRight" ) )
+ - ( parseFloat( s.css( "borderLeftWidth" ) ) || 0 )
+ - ( parseFloat( s.css( "borderRightWidth" ) ) || 0 ) );
+
+ $.each( fxAttrs, function( i, prop ) {
+ hideProps[ prop ] = "hide";
+
+ var parts = ( "" + $.css( options.toShow[0], prop ) ).match( /^([\d+-.]+)(.*)$/ );
+ showProps[ prop ] = {
+ value: parts[ 1 ],
+ unit: parts[ 2 ] || "px"
+ };
+ });
+ options.toShow.css({ height: 0, overflow: "hidden" }).show();
+ options.toHide
+ .filter( ":hidden" )
+ .each( options.complete )
+ .end()
+ .filter( ":visible" )
+ .animate( hideProps, {
+ step: function( now, settings ) {
+ // only calculate the percent when animating height
+ // IE gets very inconsistent results when animating elements
+ // with small values, which is common for padding
+ if ( settings.prop == "height" ) {
+ percentDone = ( settings.end - settings.start === 0 ) ? 0 :
+ ( settings.now - settings.start ) / ( settings.end - settings.start );
+ }
+
+ options.toShow[ 0 ].style[ settings.prop ] =
+ ( percentDone * showProps[ settings.prop ].value )
+ + showProps[ settings.prop ].unit;
+ },
+ duration: options.duration,
+ easing: options.easing,
+ complete: function() {
+ if ( !options.autoHeight ) {
+ options.toShow.css( "height", "" );
+ }
+ options.toShow.css({
+ width: originalWidth,
+ overflow: overflow
+ });
+ options.complete();
+ }
+ });
+ },
+ bounceslide: function( options ) {
+ this.slide( options, {
+ easing: options.down ? "easeOutBounce" : "swing",
+ duration: options.down ? 1000 : 200
+ });
+ }
+ }
+});
+
+})( jQuery );
+/*
+ * jQuery UI Autocomplete 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Autocomplete
+ *
+ * Depends:
+ * jquery.ui.core.js
+ * jquery.ui.widget.js
+ * jquery.ui.position.js
+ */
+(function( $, undefined ) {
+
+// used to prevent race conditions with remote data sources
+var requestIndex = 0;
+
+$.widget( "ui.autocomplete", {
+ options: {
+ appendTo: "body",
+ autoFocus: false,
+ delay: 300,
+ minLength: 1,
+ position: {
+ my: "left top",
+ at: "left bottom",
+ collision: "none"
+ },
+ source: null
+ },
+
+ pending: 0,
+
+ _create: function() {
+ var self = this,
+ doc = this.element[ 0 ].ownerDocument,
+ suppressKeyPress;
+
+ this.element
+ .addClass( "ui-autocomplete-input" )
+ .attr( "autocomplete", "off" )
+ // TODO verify these actually work as intended
+ .attr({
+ role: "textbox",
+ "aria-autocomplete": "list",
+ "aria-haspopup": "true"
+ })
+ .bind( "keydown.autocomplete", function( event ) {
+ if ( self.options.disabled || self.element.propAttr( "readOnly" ) ) {
+ return;
+ }
+
+ suppressKeyPress = false;
+ var keyCode = $.ui.keyCode;
+ switch( event.keyCode ) {
+ case keyCode.PAGE_UP:
+ self._move( "previousPage", event );
+ break;
+ case keyCode.PAGE_DOWN:
+ self._move( "nextPage", event );
+ break;
+ case keyCode.UP:
+ self._move( "previous", event );
+ // prevent moving cursor to beginning of text field in some browsers
+ event.preventDefault();
+ break;
+ case keyCode.DOWN:
+ self._move( "next", event );
+ // prevent moving cursor to end of text field in some browsers
+ event.preventDefault();
+ break;
+ case keyCode.ENTER:
+ case keyCode.NUMPAD_ENTER:
+ // when menu is open and has focus
+ if ( self.menu.active ) {
+ // #6055 - Opera still allows the keypress to occur
+ // which causes forms to submit
+ suppressKeyPress = true;
+ event.preventDefault();
+ }
+ //passthrough - ENTER and TAB both select the current element
+ case keyCode.TAB:
+ if ( !self.menu.active ) {
+ return;
+ }
+ self.menu.select( event );
+ break;
+ case keyCode.ESCAPE:
+ self.element.val( self.term );
+ self.close( event );
+ break;
+ default:
+ // keypress is triggered before the input value is changed
+ clearTimeout( self.searching );
+ self.searching = setTimeout(function() {
+ // only search if the value has changed
+ if ( self.term != self.element.val() ) {
+ self.selectedItem = null;
+ self.search( null, event );
+ }
+ }, self.options.delay );
+ break;
+ }
+ })
+ .bind( "keypress.autocomplete", function( event ) {
+ if ( suppressKeyPress ) {
+ suppressKeyPress = false;
+ event.preventDefault();
+ }
+ })
+ .bind( "focus.autocomplete", function() {
+ if ( self.options.disabled ) {
+ return;
+ }
+
+ self.selectedItem = null;
+ self.previous = self.element.val();
+ })
+ .bind( "blur.autocomplete", function( event ) {
+ if ( self.options.disabled ) {
+ return;
+ }
+
+ clearTimeout( self.searching );
+ // clicks on the menu (or a button to trigger a search) will cause a blur event
+ self.closing = setTimeout(function() {
+ self.close( event );
+ self._change( event );
+ }, 150 );
+ });
+ this._initSource();
+ this.response = function() {
+ return self._response.apply( self, arguments );
+ };
+ this.menu = $( "<ul></ul>" )
+ .addClass( "ui-autocomplete" )
+ .appendTo( $( this.options.appendTo || "body", doc )[0] )
+ // prevent the close-on-blur in case of a "slow" click on the menu (long mousedown)
+ .mousedown(function( event ) {
+ // clicking on the scrollbar causes focus to shift to the body
+ // but we can't detect a mouseup or a click immediately afterward
+ // so we have to track the next mousedown and close the menu if
+ // the user clicks somewhere outside of the autocomplete
+ var menuElement = self.menu.element[ 0 ];
+ if ( !$( event.target ).closest( ".ui-menu-item" ).length ) {
+ setTimeout(function() {
+ $( document ).one( 'mousedown', function( event ) {
+ if ( event.target !== self.element[ 0 ] &&
+ event.target !== menuElement &&
+ !$.ui.contains( menuElement, event.target ) ) {
+ self.close();
+ }
+ });
+ }, 1 );
+ }
+
+ // use another timeout to make sure the blur-event-handler on the input was already triggered
+ setTimeout(function() {
+ clearTimeout( self.closing );
+ }, 13);
+ })
+ .menu({
+ focus: function( event, ui ) {
+ var item = ui.item.data( "item.autocomplete" );
+ if ( false !== self._trigger( "focus", event, { item: item } ) ) {
+ // use value to match what will end up in the input, if it was a key event
+ if ( /^key/.test(event.originalEvent.type) ) {
+ self.element.val( item.value );
+ }
+ }
+ },
+ selected: function( event, ui ) {
+ var item = ui.item.data( "item.autocomplete" ),
+ previous = self.previous;
+
+ // only trigger when focus was lost (click on menu)
+ if ( self.element[0] !== doc.activeElement ) {
+ self.element.focus();
+ self.previous = previous;
+ // #6109 - IE triggers two focus events and the second
+ // is asynchronous, so we need to reset the previous
+ // term synchronously and asynchronously :-(
+ setTimeout(function() {
+ self.previous = previous;
+ self.selectedItem = item;
+ }, 1);
+ }
+
+ if ( false !== self._trigger( "select", event, { item: item } ) ) {
+ self.element.val( item.value );
+ }
+ // reset the term after the select event
+ // this allows custom select handling to work properly
+ self.term = self.element.val();
+
+ self.close( event );
+ self.selectedItem = item;
+ },
+ blur: function( event, ui ) {
+ // don't set the value of the text field if it's already correct
+ // this prevents moving the cursor unnecessarily
+ if ( self.menu.element.is(":visible") &&
+ ( self.element.val() !== self.term ) ) {
+ self.element.val( self.term );
+ }
+ }
+ })
+ .zIndex( this.element.zIndex() + 1 )
+ // workaround for jQuery bug #5781 http://dev.jquery.com/ticket/5781
+ .css({ top: 0, left: 0 })
+ .hide()
+ .data( "menu" );
+ if ( $.fn.bgiframe ) {
+ this.menu.element.bgiframe();
+ }
+ // turning off autocomplete prevents the browser from remembering the
+ // value when navigating through history, so we re-enable autocomplete
+ // if the page is unloaded before the widget is destroyed. #7790
+ self.beforeunloadHandler = function() {
+ self.element.removeAttr( "autocomplete" );
+ };
+ $( window ).bind( "beforeunload", self.beforeunloadHandler );
+ },
+
+ destroy: function() {
+ this.element
+ .removeClass( "ui-autocomplete-input" )
+ .removeAttr( "autocomplete" )
+ .removeAttr( "role" )
+ .removeAttr( "aria-autocomplete" )
+ .removeAttr( "aria-haspopup" );
+ this.menu.element.remove();
+ $( window ).unbind( "beforeunload", this.beforeunloadHandler );
+ $.Widget.prototype.destroy.call( this );
+ },
+
+ _setOption: function( key, value ) {
+ $.Widget.prototype._setOption.apply( this, arguments );
+ if ( key === "source" ) {
+ this._initSource();
+ }
+ if ( key === "appendTo" ) {
+ this.menu.element.appendTo( $( value || "body", this.element[0].ownerDocument )[0] )
+ }
+ if ( key === "disabled" && value && this.xhr ) {
+ this.xhr.abort();
+ }
+ },
+
+ _initSource: function() {
+ var self = this,
+ array,
+ url;
+ if ( $.isArray(this.options.source) ) {
+ array = this.options.source;
+ this.source = function( request, response ) {
+ response( $.ui.autocomplete.filter(array, request.term) );
+ };
+ } else if ( typeof this.options.source === "string" ) {
+ url = this.options.source;
+ this.source = function( request, response ) {
+ if ( self.xhr ) {
+ self.xhr.abort();
+ }
+ self.xhr = $.ajax({
+ url: url,
+ data: request,
+ dataType: "json",
+ context: {
+ autocompleteRequest: ++requestIndex
+ },
+ success: function( data, status ) {
+ if ( this.autocompleteRequest === requestIndex ) {
+ response( data );
+ }
+ },
+ error: function() {
+ if ( this.autocompleteRequest === requestIndex ) {
+ response( [] );
+ }
+ }
+ });
+ };
+ } else {
+ this.source = this.options.source;
+ }
+ },
+
+ search: function( value, event ) {
+ value = value != null ? value : this.element.val();
+
+ // always save the actual value, not the one passed as an argument
+ this.term = this.element.val();
+
+ if ( value.length < this.options.minLength ) {
+ return this.close( event );
+ }
+
+ clearTimeout( this.closing );
+ if ( this._trigger( "search", event ) === false ) {
+ return;
+ }
+
+ return this._search( value );
+ },
+
+ _search: function( value ) {
+ this.pending++;
+ this.element.addClass( "ui-autocomplete-loading" );
+
+ this.source( { term: value }, this.response );
+ },
+
+ _response: function( content ) {
+ if ( !this.options.disabled && content && content.length ) {
+ content = this._normalize( content );
+ this._suggest( content );
+ this._trigger( "open" );
+ } else {
+ this.close();
+ }
+ this.pending--;
+ if ( !this.pending ) {
+ this.element.removeClass( "ui-autocomplete-loading" );
+ }
+ },
+
+ close: function( event ) {
+ clearTimeout( this.closing );
+ if ( this.menu.element.is(":visible") ) {
+ this.menu.element.hide();
+ this.menu.deactivate();
+ this._trigger( "close", event );
+ }
+ },
+
+ _change: function( event ) {
+ if ( this.previous !== this.element.val() ) {
+ this._trigger( "change", event, { item: this.selectedItem } );
+ }
+ },
+
+ _normalize: function( items ) {
+ // assume all items have the right format when the first item is complete
+ if ( items.length && items[0].label && items[0].value ) {
+ return items;
+ }
+ return $.map( items, function(item) {
+ if ( typeof item === "string" ) {
+ return {
+ label: item,
+ value: item
+ };
+ }
+ return $.extend({
+ label: item.label || item.value,
+ value: item.value || item.label
+ }, item );
+ });
+ },
+
+ _suggest: function( items ) {
+ var ul = this.menu.element
+ .empty()
+ .zIndex( this.element.zIndex() + 1 );
+ this._renderMenu( ul, items );
+ // TODO refresh should check if the active item is still in the dom, removing the need for a manual deactivate
+ this.menu.deactivate();
+ this.menu.refresh();
+
+ // size and position menu
+ ul.show();
+ this._resizeMenu();
+ ul.position( $.extend({
+ of: this.element
+ }, this.options.position ));
+
+ if ( this.options.autoFocus ) {
+ this.menu.next( new $.Event("mouseover") );
+ }
+ },
+
+ _resizeMenu: function() {
+ var ul = this.menu.element;
+ ul.outerWidth( Math.max(
+ // Firefox wraps long text (possibly a rounding bug)
+ // so we add 1px to avoid the wrapping (#7513)
+ ul.width( "" ).outerWidth() + 1,
+ this.element.outerWidth()
+ ) );
+ },
+
+ _renderMenu: function( ul, items ) {
+ var self = this;
+ $.each( items, function( index, item ) {
+ self._renderItem( ul, item );
+ });
+ },
+
+ _renderItem: function( ul, item) {
+ return $( "<li></li>" )
+ .data( "item.autocomplete", item )
+ .append( $( "<a></a>" ).text( item.label ) )
+ .appendTo( ul );
+ },
+
+ _move: function( direction, event ) {
+ if ( !this.menu.element.is(":visible") ) {
+ this.search( null, event );
+ return;
+ }
+ if ( this.menu.first() && /^previous/.test(direction) ||
+ this.menu.last() && /^next/.test(direction) ) {
+ this.element.val( this.term );
+ this.menu.deactivate();
+ return;
+ }
+ this.menu[ direction ]( event );
+ },
+
+ widget: function() {
+ return this.menu.element;
+ }
+});
+
+$.extend( $.ui.autocomplete, {
+ escapeRegex: function( value ) {
+ return value.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
+ },
+ filter: function(array, term) {
+ var matcher = new RegExp( $.ui.autocomplete.escapeRegex(term), "i" );
+ return $.grep( array, function(value) {
+ return matcher.test( value.label || value.value || value );
+ });
+ }
+});
+
+}( jQuery ));
+
+/*
+ * jQuery UI Menu (not officially released)
+ *
+ * This widget isn't yet finished and the API is subject to change. We plan to finish
+ * it for the next release. You're welcome to give it a try anyway and give us feedback,
+ * as long as you're okay with migrating your code later on. We can help with that, too.
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Menu
+ *
+ * Depends:
+ * jquery.ui.core.js
+ * jquery.ui.widget.js
+ */
+(function($) {
+
+$.widget("ui.menu", {
+ _create: function() {
+ var self = this;
+ this.element
+ .addClass("ui-menu ui-widget ui-widget-content ui-corner-all")
+ .attr({
+ role: "listbox",
+ "aria-activedescendant": "ui-active-menuitem"
+ })
+ .click(function( event ) {
+ if ( !$( event.target ).closest( ".ui-menu-item a" ).length ) {
+ return;
+ }
+ // temporary
+ event.preventDefault();
+ self.select( event );
+ });
+ this.refresh();
+ },
+
+ refresh: function() {
+ var self = this;
+
+ // don't refresh list items that are already adapted
+ var items = this.element.children("li:not(.ui-menu-item):has(a)")
+ .addClass("ui-menu-item")
+ .attr("role", "menuitem");
+
+ items.children("a")
+ .addClass("ui-corner-all")
+ .attr("tabindex", -1)
+ // mouseenter doesn't work with event delegation
+ .mouseenter(function( event ) {
+ self.activate( event, $(this).parent() );
+ })
+ .mouseleave(function() {
+ self.deactivate();
+ });
+ },
+
+ activate: function( event, item ) {
+ this.deactivate();
+ if (this.hasScroll()) {
+ var offset = item.offset().top - this.element.offset().top,
+ scroll = this.element.scrollTop(),
+ elementHeight = this.element.height();
+ if (offset < 0) {
+ this.element.scrollTop( scroll + offset);
+ } else if (offset >= elementHeight) {
+ this.element.scrollTop( scroll + offset - elementHeight + item.height());
+ }
+ }
+ this.active = item.eq(0)
+ .children("a")
+ .addClass("ui-state-hover")
+ .attr("id", "ui-active-menuitem")
+ .end();
+ this._trigger("focus", event, { item: item });
+ },
+
+ deactivate: function() {
+ if (!this.active) { return; }
+
+ this.active.children("a")
+ .removeClass("ui-state-hover")
+ .removeAttr("id");
+ this._trigger("blur");
+ this.active = null;
+ },
+
+ next: function(event) {
+ this.move("next", ".ui-menu-item:first", event);
+ },
+
+ previous: function(event) {
+ this.move("prev", ".ui-menu-item:last", event);
+ },
+
+ first: function() {
+ return this.active && !this.active.prevAll(".ui-menu-item").length;
+ },
+
+ last: function() {
+ return this.active && !this.active.nextAll(".ui-menu-item").length;
+ },
+
+ move: function(direction, edge, event) {
+ if (!this.active) {
+ this.activate(event, this.element.children(edge));
+ return;
+ }
+ var next = this.active[direction + "All"](".ui-menu-item").eq(0);
+ if (next.length) {
+ this.activate(event, next);
+ } else {
+ this.activate(event, this.element.children(edge));
+ }
+ },
+
+ // TODO merge with previousPage
+ nextPage: function(event) {
+ if (this.hasScroll()) {
+ // TODO merge with no-scroll-else
+ if (!this.active || this.last()) {
+ this.activate(event, this.element.children(".ui-menu-item:first"));
+ return;
+ }
+ var base = this.active.offset().top,
+ height = this.element.height(),
+ result = this.element.children(".ui-menu-item").filter(function() {
+ var close = $(this).offset().top - base - height + $(this).height();
+ // TODO improve approximation
+ return close < 10 && close > -10;
+ });
+
+ // TODO try to catch this earlier when scrollTop indicates the last page anyway
+ if (!result.length) {
+ result = this.element.children(".ui-menu-item:last");
+ }
+ this.activate(event, result);
+ } else {
+ this.activate(event, this.element.children(".ui-menu-item")
+ .filter(!this.active || this.last() ? ":first" : ":last"));
+ }
+ },
+
+ // TODO merge with nextPage
+ previousPage: function(event) {
+ if (this.hasScroll()) {
+ // TODO merge with no-scroll-else
+ if (!this.active || this.first()) {
+ this.activate(event, this.element.children(".ui-menu-item:last"));
+ return;
+ }
+
+ var base = this.active.offset().top,
+ height = this.element.height();
+ result = this.element.children(".ui-menu-item").filter(function() {
+ var close = $(this).offset().top - base + height - $(this).height();
+ // TODO improve approximation
+ return close < 10 && close > -10;
+ });
+
+ // TODO try to catch this earlier when scrollTop indicates the last page anyway
+ if (!result.length) {
+ result = this.element.children(".ui-menu-item:first");
+ }
+ this.activate(event, result);
+ } else {
+ this.activate(event, this.element.children(".ui-menu-item")
+ .filter(!this.active || this.first() ? ":last" : ":first"));
+ }
+ },
+
+ hasScroll: function() {
+ return this.element.height() < this.element[ $.fn.prop ? "prop" : "attr" ]("scrollHeight");
+ },
+
+ select: function( event ) {
+ this._trigger("selected", event, { item: this.active });
+ }
+});
+
+}(jQuery));
+/*
+ * jQuery UI Button 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Button
+ *
+ * Depends:
+ * jquery.ui.core.js
+ * jquery.ui.widget.js
+ */
+(function( $, undefined ) {
+
+var lastActive, startXPos, startYPos, clickDragged,
+ baseClasses = "ui-button ui-widget ui-state-default ui-corner-all",
+ stateClasses = "ui-state-hover ui-state-active ",
+ typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",
+ formResetHandler = function() {
+ var buttons = $( this ).find( ":ui-button" );
+ setTimeout(function() {
+ buttons.button( "refresh" );
+ }, 1 );
+ },
+ radioGroup = function( radio ) {
+ var name = radio.name,
+ form = radio.form,
+ radios = $( [] );
+ if ( name ) {
+ if ( form ) {
+ radios = $( form ).find( "[name='" + name + "']" );
+ } else {
+ radios = $( "[name='" + name + "']", radio.ownerDocument )
+ .filter(function() {
+ return !this.form;
+ });
+ }
+ }
+ return radios;
+ };
+
+$.widget( "ui.button", {
+ options: {
+ disabled: null,
+ text: true,
+ label: null,
+ icons: {
+ primary: null,
+ secondary: null
+ }
+ },
+ _create: function() {
+ this.element.closest( "form" )
+ .unbind( "reset.button" )
+ .bind( "reset.button", formResetHandler );
+
+ if ( typeof this.options.disabled !== "boolean" ) {
+ this.options.disabled = !!this.element.propAttr( "disabled" );
+ } else {
+ this.element.propAttr( "disabled", this.options.disabled );
+ }
+
+ this._determineButtonType();
+ this.hasTitle = !!this.buttonElement.attr( "title" );
+
+ var self = this,
+ options = this.options,
+ toggleButton = this.type === "checkbox" || this.type === "radio",
+ hoverClass = "ui-state-hover" + ( !toggleButton ? " ui-state-active" : "" ),
+ focusClass = "ui-state-focus";
+
+ if ( options.label === null ) {
+ options.label = this.buttonElement.html();
+ }
+
+ this.buttonElement
+ .addClass( baseClasses )
+ .attr( "role", "button" )
+ .bind( "mouseenter.button", function() {
+ if ( options.disabled ) {
+ return;
+ }
+ $( this ).addClass( "ui-state-hover" );
+ if ( this === lastActive ) {
+ $( this ).addClass( "ui-state-active" );
+ }
+ })
+ .bind( "mouseleave.button", function() {
+ if ( options.disabled ) {
+ return;
+ }
+ $( this ).removeClass( hoverClass );
+ })
+ .bind( "click.button", function( event ) {
+ if ( options.disabled ) {
+ event.preventDefault();
+ event.stopImmediatePropagation();
+ }
+ });
+
+ this.element
+ .bind( "focus.button", function() {
+ // no need to check disabled, focus won't be triggered anyway
+ self.buttonElement.addClass( focusClass );
+ })
+ .bind( "blur.button", function() {
+ self.buttonElement.removeClass( focusClass );
+ });
+
+ if ( toggleButton ) {
+ this.element.bind( "change.button", function() {
+ if ( clickDragged ) {
+ return;
+ }
+ self.refresh();
+ });
+ // if mouse moves between mousedown and mouseup (drag) set clickDragged flag
+ // prevents issue where button state changes but checkbox/radio checked state
+ // does not in Firefox (see ticket #6970)
+ this.buttonElement
+ .bind( "mousedown.button", function( event ) {
+ if ( options.disabled ) {
+ return;
+ }
+ clickDragged = false;
+ startXPos = event.pageX;
+ startYPos = event.pageY;
+ })
+ .bind( "mouseup.button", function( event ) {
+ if ( options.disabled ) {
+ return;
+ }
+ if ( startXPos !== event.pageX || startYPos !== event.pageY ) {
+ clickDragged = true;
+ }
+ });
+ }
+
+ if ( this.type === "checkbox" ) {
+ this.buttonElement.bind( "click.button", function() {
+ if ( options.disabled || clickDragged ) {
+ return false;
+ }
+ $( this ).toggleClass( "ui-state-active" );
+ self.buttonElement.attr( "aria-pressed", self.element[0].checked );
+ });
+ } else if ( this.type === "radio" ) {
+ this.buttonElement.bind( "click.button", function() {
+ if ( options.disabled || clickDragged ) {
+ return false;
+ }
+ $( this ).addClass( "ui-state-active" );
+ self.buttonElement.attr( "aria-pressed", "true" );
+
+ var radio = self.element[ 0 ];
+ radioGroup( radio )
+ .not( radio )
+ .map(function() {
+ return $( this ).button( "widget" )[ 0 ];
+ })
+ .removeClass( "ui-state-active" )
+ .attr( "aria-pressed", "false" );
+ });
+ } else {
+ this.buttonElement
+ .bind( "mousedown.button", function() {
+ if ( options.disabled ) {
+ return false;
+ }
+ $( this ).addClass( "ui-state-active" );
+ lastActive = this;
+ $( document ).one( "mouseup", function() {
+ lastActive = null;
+ });
+ })
+ .bind( "mouseup.button", function() {
+ if ( options.disabled ) {
+ return false;
+ }
+ $( this ).removeClass( "ui-state-active" );
+ })
+ .bind( "keydown.button", function(event) {
+ if ( options.disabled ) {
+ return false;
+ }
+ if ( event.keyCode == $.ui.keyCode.SPACE || event.keyCode == $.ui.keyCode.ENTER ) {
+ $( this ).addClass( "ui-state-active" );
+ }
+ })
+ .bind( "keyup.button", function() {
+ $( this ).removeClass( "ui-state-active" );
+ });
+
+ if ( this.buttonElement.is("a") ) {
+ this.buttonElement.keyup(function(event) {
+ if ( event.keyCode === $.ui.keyCode.SPACE ) {
+ // TODO pass through original event correctly (just as 2nd argument doesn't work)
+ $( this ).click();
+ }
+ });
+ }
+ }
+
+ // TODO: pull out $.Widget's handling for the disabled option into
+ // $.Widget.prototype._setOptionDisabled so it's easy to proxy and can
+ // be overridden by individual plugins
+ this._setOption( "disabled", options.disabled );
+ this._resetButton();
+ },
+
+ _determineButtonType: function() {
+
+ if ( this.element.is(":checkbox") ) {
+ this.type = "checkbox";
+ } else if ( this.element.is(":radio") ) {
+ this.type = "radio";
+ } else if ( this.element.is("input") ) {
+ this.type = "input";
+ } else {
+ this.type = "button";
+ }
+
+ if ( this.type === "checkbox" || this.type === "radio" ) {
+ // we don't search against the document in case the element
+ // is disconnected from the DOM
+ var ancestor = this.element.parents().filter(":last"),
+ labelSelector = "label[for='" + this.element.attr("id") + "']";
+ this.buttonElement = ancestor.find( labelSelector );
+ if ( !this.buttonElement.length ) {
+ ancestor = ancestor.length ? ancestor.siblings() : this.element.siblings();
+ this.buttonElement = ancestor.filter( labelSelector );
+ if ( !this.buttonElement.length ) {
+ this.buttonElement = ancestor.find( labelSelector );
+ }
+ }
+ this.element.addClass( "ui-helper-hidden-accessible" );
+
+ var checked = this.element.is( ":checked" );
+ if ( checked ) {
+ this.buttonElement.addClass( "ui-state-active" );
+ }
+ this.buttonElement.attr( "aria-pressed", checked );
+ } else {
+ this.buttonElement = this.element;
+ }
+ },
+
+ widget: function() {
+ return this.buttonElement;
+ },
+
+ destroy: function() {
+ this.element
+ .removeClass( "ui-helper-hidden-accessible" );
+ this.buttonElement
+ .removeClass( baseClasses + " " + stateClasses + " " + typeClasses )
+ .removeAttr( "role" )
+ .removeAttr( "aria-pressed" )
+ .html( this.buttonElement.find(".ui-button-text").html() );
+
+ if ( !this.hasTitle ) {
+ this.buttonElement.removeAttr( "title" );
+ }
+
+ $.Widget.prototype.destroy.call( this );
+ },
+
+ _setOption: function( key, value ) {
+ $.Widget.prototype._setOption.apply( this, arguments );
+ if ( key === "disabled" ) {
+ if ( value ) {
+ this.element.propAttr( "disabled", true );
+ } else {
+ this.element.propAttr( "disabled", false );
+ }
+ return;
+ }
+ this._resetButton();
+ },
+
+ refresh: function() {
+ var isDisabled = this.element.is( ":disabled" );
+ if ( isDisabled !== this.options.disabled ) {
+ this._setOption( "disabled", isDisabled );
+ }
+ if ( this.type === "radio" ) {
+ radioGroup( this.element[0] ).each(function() {
+ if ( $( this ).is( ":checked" ) ) {
+ $( this ).button( "widget" )
+ .addClass( "ui-state-active" )
+ .attr( "aria-pressed", "true" );
+ } else {
+ $( this ).button( "widget" )
+ .removeClass( "ui-state-active" )
+ .attr( "aria-pressed", "false" );
+ }
+ });
+ } else if ( this.type === "checkbox" ) {
+ if ( this.element.is( ":checked" ) ) {
+ this.buttonElement
+ .addClass( "ui-state-active" )
+ .attr( "aria-pressed", "true" );
+ } else {
+ this.buttonElement
+ .removeClass( "ui-state-active" )
+ .attr( "aria-pressed", "false" );
+ }
+ }
+ },
+
+ _resetButton: function() {
+ if ( this.type === "input" ) {
+ if ( this.options.label ) {
+ this.element.val( this.options.label );
+ }
+ return;
+ }
+ var buttonElement = this.buttonElement.removeClass( typeClasses ),
+ buttonText = $( "<span></span>", this.element[0].ownerDocument )
+ .addClass( "ui-button-text" )
+ .html( this.options.label )
+ .appendTo( buttonElement.empty() )
+ .text(),
+ icons = this.options.icons,
+ multipleIcons = icons.primary && icons.secondary,
+ buttonClasses = [];
+
+ if ( icons.primary || icons.secondary ) {
+ if ( this.options.text ) {
+ buttonClasses.push( "ui-button-text-icon" + ( multipleIcons ? "s" : ( icons.primary ? "-primary" : "-secondary" ) ) );
+ }
+
+ if ( icons.primary ) {
+ buttonElement.prepend( "<span class='ui-button-icon-primary ui-icon " + icons.primary + "'></span>" );
+ }
+
+ if ( icons.secondary ) {
+ buttonElement.append( "<span class='ui-button-icon-secondary ui-icon " + icons.secondary + "'></span>" );
+ }
+
+ if ( !this.options.text ) {
+ buttonClasses.push( multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only" );
+
+ if ( !this.hasTitle ) {
+ buttonElement.attr( "title", buttonText );
+ }
+ }
+ } else {
+ buttonClasses.push( "ui-button-text-only" );
+ }
+ buttonElement.addClass( buttonClasses.join( " " ) );
+ }
+});
+
+$.widget( "ui.buttonset", {
+ options: {
+ items: ":button, :submit, :reset, :checkbox, :radio, a, :data(button)"
+ },
+
+ _create: function() {
+ this.element.addClass( "ui-buttonset" );
+ },
+
+ _init: function() {
+ this.refresh();
+ },
+
+ _setOption: function( key, value ) {
+ if ( key === "disabled" ) {
+ this.buttons.button( "option", key, value );
+ }
+
+ $.Widget.prototype._setOption.apply( this, arguments );
+ },
+
+ refresh: function() {
+ var rtl = this.element.css( "direction" ) === "rtl";
+
+ this.buttons = this.element.find( this.options.items )
+ .filter( ":ui-button" )
+ .button( "refresh" )
+ .end()
+ .not( ":ui-button" )
+ .button()
+ .end()
+ .map(function() {
+ return $( this ).button( "widget" )[ 0 ];
+ })
+ .removeClass( "ui-corner-all ui-corner-left ui-corner-right" )
+ .filter( ":first" )
+ .addClass( rtl ? "ui-corner-right" : "ui-corner-left" )
+ .end()
+ .filter( ":last" )
+ .addClass( rtl ? "ui-corner-left" : "ui-corner-right" )
+ .end()
+ .end();
+ },
+
+ destroy: function() {
+ this.element.removeClass( "ui-buttonset" );
+ this.buttons
+ .map(function() {
+ return $( this ).button( "widget" )[ 0 ];
+ })
+ .removeClass( "ui-corner-left ui-corner-right" )
+ .end()
+ .button( "destroy" );
+
+ $.Widget.prototype.destroy.call( this );
+ }
+});
+
+}( jQuery ) );
+/*
+ * jQuery UI Datepicker 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Datepicker
+ *
+ * Depends:
+ * jquery.ui.core.js
+ */
+(function( $, undefined ) {
+
+$.extend($.ui, { datepicker: { version: "1.8.18" } });
+
+var PROP_NAME = 'datepicker';
+var dpuuid = new Date().getTime();
+var instActive;
+
+/* Date picker manager.
+ Use the singleton instance of this class, $.datepicker, to interact with the date picker.
+ Settings for (groups of) date pickers are maintained in an instance object,
+ allowing multiple different settings on the same page. */
+
+function Datepicker() {
+ this.debug = false; // Change this to true to start debugging
+ this._curInst = null; // The current instance in use
+ this._keyEvent = false; // If the last event was a key event
+ this._disabledInputs = []; // List of date picker inputs that have been disabled
+ this._datepickerShowing = false; // True if the popup picker is showing , false if not
+ this._inDialog = false; // True if showing within a "dialog", false if not
+ this._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division
+ this._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class
+ this._appendClass = 'ui-datepicker-append'; // The name of the append marker class
+ this._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class
+ this._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class
+ this._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class
+ this._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class
+ this._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class
+ this._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class
+ this.regional = []; // Available regional settings, indexed by language code
+ this.regional[''] = { // Default regional settings
+ closeText: 'Done', // Display text for close link
+ prevText: 'Prev', // Display text for previous month link
+ nextText: 'Next', // Display text for next month link
+ currentText: 'Today', // Display text for current month link
+ monthNames: ['January','February','March','April','May','June',
+ 'July','August','September','October','November','December'], // Names of months for drop-down and formatting
+ monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting
+ dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting
+ dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting
+ dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday
+ weekHeader: 'Wk', // Column header for week of the year
+ dateFormat: 'mm/dd/yy', // See format options on parseDate
+ firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...
+ isRTL: false, // True if right-to-left language, false if left-to-right
+ showMonthAfterYear: false, // True if the year select precedes month, false for month then year
+ yearSuffix: '' // Additional text to append to the year in the month headers
+ };
+ this._defaults = { // Global defaults for all the date picker instances
+ showOn: 'focus', // 'focus' for popup on focus,
+ // 'button' for trigger button, or 'both' for either
+ showAnim: 'fadeIn', // Name of jQuery animation for popup
+ showOptions: {}, // Options for enhanced animations
+ defaultDate: null, // Used when field is blank: actual date,
+ // +/-number for offset from today, null for today
+ appendText: '', // Display text following the input box, e.g. showing the format
+ buttonText: '...', // Text for trigger button
+ buttonImage: '', // URL for trigger button image
+ buttonImageOnly: false, // True if the image appears alone, false if it appears on a button
+ hideIfNoPrevNext: false, // True to hide next/previous month links
+ // if not applicable, false to just disable them
+ navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links
+ gotoCurrent: false, // True if today link goes back to current selection instead
+ changeMonth: false, // True if month can be selected directly, false if only prev/next
+ changeYear: false, // True if year can be selected directly, false if only prev/next
+ yearRange: 'c-10:c+10', // Range of years to display in drop-down,
+ // either relative to today's year (-nn:+nn), relative to currently displayed year
+ // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)
+ showOtherMonths: false, // True to show dates in other months, false to leave blank
+ selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable
+ showWeek: false, // True to show week of the year, false to not show it
+ calculateWeek: this.iso8601Week, // How to calculate the week of the year,
+ // takes a Date and returns the number of the week for it
+ shortYearCutoff: '+10', // Short year values < this are in the current century,
+ // > this are in the previous century,
+ // string value starting with '+' for current year + value
+ minDate: null, // The earliest selectable date, or null for no limit
+ maxDate: null, // The latest selectable date, or null for no limit
+ duration: 'fast', // Duration of display/closure
+ beforeShowDay: null, // Function that takes a date and returns an array with
+ // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '',
+ // [2] = cell title (optional), e.g. $.datepicker.noWeekends
+ beforeShow: null, // Function that takes an input field and
+ // returns a set of custom settings for the date picker
+ onSelect: null, // Define a callback function when a date is selected
+ onChangeMonthYear: null, // Define a callback function when the month or year is changed
+ onClose: null, // Define a callback function when the datepicker is closed
+ numberOfMonths: 1, // Number of months to show at a time
+ showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)
+ stepMonths: 1, // Number of months to step back/forward
+ stepBigMonths: 12, // Number of months to step back/forward for the big links
+ altField: '', // Selector for an alternate field to store selected dates into
+ altFormat: '', // The date format to use for the alternate field
+ constrainInput: true, // The input is constrained by the current date format
+ showButtonPanel: false, // True to show button panel, false to not show it
+ autoSize: false, // True to size the input for the date format, false to leave as is
+ disabled: false // The initial disabled state
+ };
+ $.extend(this._defaults, this.regional['']);
+ this.dpDiv = bindHover($('<div id="' + this._mainDivId + '" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'));
+}
+
+$.extend(Datepicker.prototype, {
+ /* Class name added to elements to indicate already configured with a date picker. */
+ markerClassName: 'hasDatepicker',
+
+ //Keep track of the maximum number of rows displayed (see #7043)
+ maxRows: 4,
+
+ /* Debug logging (if enabled). */
+ log: function () {
+ if (this.debug)
+ console.log.apply('', arguments);
+ },
+
+ // TODO rename to "widget" when switching to widget factory
+ _widgetDatepicker: function() {
+ return this.dpDiv;
+ },
+
+ /* Override the default settings for all instances of the date picker.
+ @param settings object - the new settings to use as defaults (anonymous object)
+ @return the manager object */
+ setDefaults: function(settings) {
+ extendRemove(this._defaults, settings || {});
+ return this;
+ },
+
+ /* Attach the date picker to a jQuery selection.
+ @param target element - the target input field or division or span
+ @param settings object - the new settings to use for this date picker instance (anonymous) */
+ _attachDatepicker: function(target, settings) {
+ // check for settings on the control itself - in namespace 'date:'
+ var inlineSettings = null;
+ for (var attrName in this._defaults) {
+ var attrValue = target.getAttribute('date:' + attrName);
+ if (attrValue) {
+ inlineSettings = inlineSettings || {};
+ try {
+ inlineSettings[attrName] = eval(attrValue);
+ } catch (err) {
+ inlineSettings[attrName] = attrValue;
+ }
+ }
+ }
+ var nodeName = target.nodeName.toLowerCase();
+ var inline = (nodeName == 'div' || nodeName == 'span');
+ if (!target.id) {
+ this.uuid += 1;
+ target.id = 'dp' + this.uuid;
+ }
+ var inst = this._newInst($(target), inline);
+ inst.settings = $.extend({}, settings || {}, inlineSettings || {});
+ if (nodeName == 'input') {
+ this._connectDatepicker(target, inst);
+ } else if (inline) {
+ this._inlineDatepicker(target, inst);
+ }
+ },
+
+ /* Create a new instance object. */
+ _newInst: function(target, inline) {
+ var id = target[0].id.replace(/([^A-Za-z0-9_-])/g, '\\\\$1'); // escape jQuery meta chars
+ return {id: id, input: target, // associated target
+ selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection
+ drawMonth: 0, drawYear: 0, // month being drawn
+ inline: inline, // is datepicker inline or not
+ dpDiv: (!inline ? this.dpDiv : // presentation div
+ bindHover($('<div class="' + this._inlineClass + ' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>')))};
+ },
+
+ /* Attach the date picker to an input field. */
+ _connectDatepicker: function(target, inst) {
+ var input = $(target);
+ inst.append = $([]);
+ inst.trigger = $([]);
+ if (input.hasClass(this.markerClassName))
+ return;
+ this._attachments(input, inst);
+ input.addClass(this.markerClassName).keydown(this._doKeyDown).
+ keypress(this._doKeyPress).keyup(this._doKeyUp).
+ bind("setData.datepicker", function(event, key, value) {
+ inst.settings[key] = value;
+ }).bind("getData.datepicker", function(event, key) {
+ return this._get(inst, key);
+ });
+ this._autoSize(inst);
+ $.data(target, PROP_NAME, inst);
+ //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665)
+ if( inst.settings.disabled ) {
+ this._disableDatepicker( target );
+ }
+ },
+
+ /* Make attachments based on settings. */
+ _attachments: function(input, inst) {
+ var appendText = this._get(inst, 'appendText');
+ var isRTL = this._get(inst, 'isRTL');
+ if (inst.append)
+ inst.append.remove();
+ if (appendText) {
+ inst.append = $('<span class="' + this._appendClass + '">' + appendText + '</span>');
+ input[isRTL ? 'before' : 'after'](inst.append);
+ }
+ input.unbind('focus', this._showDatepicker);
+ if (inst.trigger)
+ inst.trigger.remove();
+ var showOn = this._get(inst, 'showOn');
+ if (showOn == 'focus' || showOn == 'both') // pop-up date picker when in the marked field
+ input.focus(this._showDatepicker);
+ if (showOn == 'button' || showOn == 'both') { // pop-up date picker when button clicked
+ var buttonText = this._get(inst, 'buttonText');
+ var buttonImage = this._get(inst, 'buttonImage');
+ inst.trigger = $(this._get(inst, 'buttonImageOnly') ?
+ $('<img/>').addClass(this._triggerClass).
+ attr({ src: buttonImage, alt: buttonText, title: buttonText }) :
+ $('<button type="button"></button>').addClass(this._triggerClass).
+ html(buttonImage == '' ? buttonText : $('<img/>').attr(
+ { src:buttonImage, alt:buttonText, title:buttonText })));
+ input[isRTL ? 'before' : 'after'](inst.trigger);
+ inst.trigger.click(function() {
+ if ($.datepicker._datepickerShowing && $.datepicker._lastInput == input[0])
+ $.datepicker._hideDatepicker();
+ else if ($.datepicker._datepickerShowing && $.datepicker._lastInput != input[0]) {
+ $.datepicker._hideDatepicker();
+ $.datepicker._showDatepicker(input[0]);
+ } else
+ $.datepicker._showDatepicker(input[0]);
+ return false;
+ });
+ }
+ },
+
+ /* Apply the maximum length for the date format. */
+ _autoSize: function(inst) {
+ if (this._get(inst, 'autoSize') && !inst.inline) {
+ var date = new Date(2009, 12 - 1, 20); // Ensure double digits
+ var dateFormat = this._get(inst, 'dateFormat');
+ if (dateFormat.match(/[DM]/)) {
+ var findMax = function(names) {
+ var max = 0;
+ var maxI = 0;
+ for (var i = 0; i < names.length; i++) {
+ if (names[i].length > max) {
+ max = names[i].length;
+ maxI = i;
+ }
+ }
+ return maxI;
+ };
+ date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ?
+ 'monthNames' : 'monthNamesShort'))));
+ date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ?
+ 'dayNames' : 'dayNamesShort'))) + 20 - date.getDay());
+ }
+ inst.input.attr('size', this._formatDate(inst, date).length);
+ }
+ },
+
+ /* Attach an inline date picker to a div. */
+ _inlineDatepicker: function(target, inst) {
+ var divSpan = $(target);
+ if (divSpan.hasClass(this.markerClassName))
+ return;
+ divSpan.addClass(this.markerClassName).append(inst.dpDiv).
+ bind("setData.datepicker", function(event, key, value){
+ inst.settings[key] = value;
+ }).bind("getData.datepicker", function(event, key){
+ return this._get(inst, key);
+ });
+ $.data(target, PROP_NAME, inst);
+ this._setDate(inst, this._getDefaultDate(inst), true);
+ this._updateDatepicker(inst);
+ this._updateAlternate(inst);
+ //If disabled option is true, disable the datepicker before showing it (see ticket #5665)
+ if( inst.settings.disabled ) {
+ this._disableDatepicker( target );
+ }
+ // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements
+ // http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height
+ inst.dpDiv.css( "display", "block" );
+ },
+
+ /* Pop-up the date picker in a "dialog" box.
+ @param input element - ignored
+ @param date string or Date - the initial date to display
+ @param onSelect function - the function to call when a date is selected
+ @param settings object - update the dialog date picker instance's settings (anonymous object)
+ @param pos int[2] - coordinates for the dialog's position within the screen or
+ event - with x/y coordinates or
+ leave empty for default (screen centre)
+ @return the manager object */
+ _dialogDatepicker: function(input, date, onSelect, settings, pos) {
+ var inst = this._dialogInst; // internal instance
+ if (!inst) {
+ this.uuid += 1;
+ var id = 'dp' + this.uuid;
+ this._dialogInput = $('<input type="text" id="' + id +
+ '" style="position: absolute; top: -100px; width: 0px; z-index: -10;"/>');
+ this._dialogInput.keydown(this._doKeyDown);
+ $('body').append(this._dialogInput);
+ inst = this._dialogInst = this._newInst(this._dialogInput, false);
+ inst.settings = {};
+ $.data(this._dialogInput[0], PROP_NAME, inst);
+ }
+ extendRemove(inst.settings, settings || {});
+ date = (date && date.constructor == Date ? this._formatDate(inst, date) : date);
+ this._dialogInput.val(date);
+
+ this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null);
+ if (!this._pos) {
+ var browserWidth = document.documentElement.clientWidth;
+ var browserHeight = document.documentElement.clientHeight;
+ var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
+ var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
+ this._pos = // should use actual width/height below
+ [(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY];
+ }
+
+ // move input on screen for focus, but hidden behind dialog
+ this._dialogInput.css('left', (this._pos[0] + 20) + 'px').css('top', this._pos[1] + 'px');
+ inst.settings.onSelect = onSelect;
+ this._inDialog = true;
+ this.dpDiv.addClass(this._dialogClass);
+ this._showDatepicker(this._dialogInput[0]);
+ if ($.blockUI)
+ $.blockUI(this.dpDiv);
+ $.data(this._dialogInput[0], PROP_NAME, inst);
+ return this;
+ },
+
+ /* Detach a datepicker from its control.
+ @param target element - the target input field or division or span */
+ _destroyDatepicker: function(target) {
+ var $target = $(target);
+ var inst = $.data(target, PROP_NAME);
+ if (!$target.hasClass(this.markerClassName)) {
+ return;
+ }
+ var nodeName = target.nodeName.toLowerCase();
+ $.removeData(target, PROP_NAME);
+ if (nodeName == 'input') {
+ inst.append.remove();
+ inst.trigger.remove();
+ $target.removeClass(this.markerClassName).
+ unbind('focus', this._showDatepicker).
+ unbind('keydown', this._doKeyDown).
+ unbind('keypress', this._doKeyPress).
+ unbind('keyup', this._doKeyUp);
+ } else if (nodeName == 'div' || nodeName == 'span')
+ $target.removeClass(this.markerClassName).empty();
+ },
+
+ /* Enable the date picker to a jQuery selection.
+ @param target element - the target input field or division or span */
+ _enableDatepicker: function(target) {
+ var $target = $(target);
+ var inst = $.data(target, PROP_NAME);
+ if (!$target.hasClass(this.markerClassName)) {
+ return;
+ }
+ var nodeName = target.nodeName.toLowerCase();
+ if (nodeName == 'input') {
+ target.disabled = false;
+ inst.trigger.filter('button').
+ each(function() { this.disabled = false; }).end().
+ filter('img').css({opacity: '1.0', cursor: ''});
+ }
+ else if (nodeName == 'div' || nodeName == 'span') {
+ var inline = $target.children('.' + this._inlineClass);
+ inline.children().removeClass('ui-state-disabled');
+ inline.find("select.ui-datepicker-month, select.ui-datepicker-year").
+ removeAttr("disabled");
+ }
+ this._disabledInputs = $.map(this._disabledInputs,
+ function(value) { return (value == target ? null : value); }); // delete entry
+ },
+
+ /* Disable the date picker to a jQuery selection.
+ @param target element - the target input field or division or span */
+ _disableDatepicker: function(target) {
+ var $target = $(target);
+ var inst = $.data(target, PROP_NAME);
+ if (!$target.hasClass(this.markerClassName)) {
+ return;
+ }
+ var nodeName = target.nodeName.toLowerCase();
+ if (nodeName == 'input') {
+ target.disabled = true;
+ inst.trigger.filter('button').
+ each(function() { this.disabled = true; }).end().
+ filter('img').css({opacity: '0.5', cursor: 'default'});
+ }
+ else if (nodeName == 'div' || nodeName == 'span') {
+ var inline = $target.children('.' + this._inlineClass);
+ inline.children().addClass('ui-state-disabled');
+ inline.find("select.ui-datepicker-month, select.ui-datepicker-year").
+ attr("disabled", "disabled");
+ }
+ this._disabledInputs = $.map(this._disabledInputs,
+ function(value) { return (value == target ? null : value); }); // delete entry
+ this._disabledInputs[this._disabledInputs.length] = target;
+ },
+
+ /* Is the first field in a jQuery collection disabled as a datepicker?
+ @param target element - the target input field or division or span
+ @return boolean - true if disabled, false if enabled */
+ _isDisabledDatepicker: function(target) {
+ if (!target) {
+ return false;
+ }
+ for (var i = 0; i < this._disabledInputs.length; i++) {
+ if (this._disabledInputs[i] == target)
+ return true;
+ }
+ return false;
+ },
+
+ /* Retrieve the instance data for the target control.
+ @param target element - the target input field or division or span
+ @return object - the associated instance data
+ @throws error if a jQuery problem getting data */
+ _getInst: function(target) {
+ try {
+ return $.data(target, PROP_NAME);
+ }
+ catch (err) {
+ throw 'Missing instance data for this datepicker';
+ }
+ },
+
+ /* Update or retrieve the settings for a date picker attached to an input field or division.
+ @param target element - the target input field or division or span
+ @param name object - the new settings to update or
+ string - the name of the setting to change or retrieve,
+ when retrieving also 'all' for all instance settings or
+ 'defaults' for all global defaults
+ @param value any - the new value for the setting
+ (omit if above is an object or to retrieve a value) */
+ _optionDatepicker: function(target, name, value) {
+ var inst = this._getInst(target);
+ if (arguments.length == 2 && typeof name == 'string') {
+ return (name == 'defaults' ? $.extend({}, $.datepicker._defaults) :
+ (inst ? (name == 'all' ? $.extend({}, inst.settings) :
+ this._get(inst, name)) : null));
+ }
+ var settings = name || {};
+ if (typeof name == 'string') {
+ settings = {};
+ settings[name] = value;
+ }
+ if (inst) {
+ if (this._curInst == inst) {
+ this._hideDatepicker();
+ }
+ var date = this._getDateDatepicker(target, true);
+ var minDate = this._getMinMaxDate(inst, 'min');
+ var maxDate = this._getMinMaxDate(inst, 'max');
+ extendRemove(inst.settings, settings);
+ // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided
+ if (minDate !== null && settings['dateFormat'] !== undefined && settings['minDate'] === undefined)
+ inst.settings.minDate = this._formatDate(inst, minDate);
+ if (maxDate !== null && settings['dateFormat'] !== undefined && settings['maxDate'] === undefined)
+ inst.settings.maxDate = this._formatDate(inst, maxDate);
+ this._attachments($(target), inst);
+ this._autoSize(inst);
+ this._setDate(inst, date);
+ this._updateAlternate(inst);
+ this._updateDatepicker(inst);
+ }
+ },
+
+ // change method deprecated
+ _changeDatepicker: function(target, name, value) {
+ this._optionDatepicker(target, name, value);
+ },
+
+ /* Redraw the date picker attached to an input field or division.
+ @param target element - the target input field or division or span */
+ _refreshDatepicker: function(target) {
+ var inst = this._getInst(target);
+ if (inst) {
+ this._updateDatepicker(inst);
+ }
+ },
+
+ /* Set the dates for a jQuery selection.
+ @param target element - the target input field or division or span
+ @param date Date - the new date */
+ _setDateDatepicker: function(target, date) {
+ var inst = this._getInst(target);
+ if (inst) {
+ this._setDate(inst, date);
+ this._updateDatepicker(inst);
+ this._updateAlternate(inst);
+ }
+ },
+
+ /* Get the date(s) for the first entry in a jQuery selection.
+ @param target element - the target input field or division or span
+ @param noDefault boolean - true if no default date is to be used
+ @return Date - the current date */
+ _getDateDatepicker: function(target, noDefault) {
+ var inst = this._getInst(target);
+ if (inst && !inst.inline)
+ this._setDateFromField(inst, noDefault);
+ return (inst ? this._getDate(inst) : null);
+ },
+
+ /* Handle keystrokes. */
+ _doKeyDown: function(event) {
+ var inst = $.datepicker._getInst(event.target);
+ var handled = true;
+ var isRTL = inst.dpDiv.is('.ui-datepicker-rtl');
+ inst._keyEvent = true;
+ if ($.datepicker._datepickerShowing)
+ switch (event.keyCode) {
+ case 9: $.datepicker._hideDatepicker();
+ handled = false;
+ break; // hide on tab out
+ case 13: var sel = $('td.' + $.datepicker._dayOverClass + ':not(.' +
+ $.datepicker._currentClass + ')', inst.dpDiv);
+ if (sel[0])
+ $.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]);
+ var onSelect = $.datepicker._get(inst, 'onSelect');
+ if (onSelect) {
+ var dateStr = $.datepicker._formatDate(inst);
+
+ // trigger custom callback
+ onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]);
+ }
+ else
+ $.datepicker._hideDatepicker();
+ return false; // don't submit the form
+ break; // select the value on enter
+ case 27: $.datepicker._hideDatepicker();
+ break; // hide on escape
+ case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
+ -$.datepicker._get(inst, 'stepBigMonths') :
+ -$.datepicker._get(inst, 'stepMonths')), 'M');
+ break; // previous month/year on page up/+ ctrl
+ case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
+ +$.datepicker._get(inst, 'stepBigMonths') :
+ +$.datepicker._get(inst, 'stepMonths')), 'M');
+ break; // next month/year on page down/+ ctrl
+ case 35: if (event.ctrlKey || event.metaKey) $.datepicker._clearDate(event.target);
+ handled = event.ctrlKey || event.metaKey;
+ break; // clear on ctrl or command +end
+ case 36: if (event.ctrlKey || event.metaKey) $.datepicker._gotoToday(event.target);
+ handled = event.ctrlKey || event.metaKey;
+ break; // current on ctrl or command +home
+ case 37: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), 'D');
+ handled = event.ctrlKey || event.metaKey;
+ // -1 day on ctrl or command +left
+ if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ?
+ -$.datepicker._get(inst, 'stepBigMonths') :
+ -$.datepicker._get(inst, 'stepMonths')), 'M');
+ // next month/year on alt +left on Mac
+ break;
+ case 38: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, -7, 'D');
+ handled = event.ctrlKey || event.metaKey;
+ break; // -1 week on ctrl or command +up
+ case 39: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), 'D');
+ handled = event.ctrlKey || event.metaKey;
+ // +1 day on ctrl or command +right
+ if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ?
+ +$.datepicker._get(inst, 'stepBigMonths') :
+ +$.datepicker._get(inst, 'stepMonths')), 'M');
+ // next month/year on alt +right
+ break;
+ case 40: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, +7, 'D');
+ handled = event.ctrlKey || event.metaKey;
+ break; // +1 week on ctrl or command +down
+ default: handled = false;
+ }
+ else if (event.keyCode == 36 && event.ctrlKey) // display the date picker on ctrl+home
+ $.datepicker._showDatepicker(this);
+ else {
+ handled = false;
+ }
+ if (handled) {
+ event.preventDefault();
+ event.stopPropagation();
+ }
+ },
+
+ /* Filter entered characters - based on date format. */
+ _doKeyPress: function(event) {
+ var inst = $.datepicker._getInst(event.target);
+ if ($.datepicker._get(inst, 'constrainInput')) {
+ var chars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat'));
+ var chr = String.fromCharCode(event.charCode == undefined ? event.keyCode : event.charCode);
+ return event.ctrlKey || event.metaKey || (chr < ' ' || !chars || chars.indexOf(chr) > -1);
+ }
+ },
+
+ /* Synchronise manual entry and field/alternate field. */
+ _doKeyUp: function(event) {
+ var inst = $.datepicker._getInst(event.target);
+ if (inst.input.val() != inst.lastVal) {
+ try {
+ var date = $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'),
+ (inst.input ? inst.input.val() : null),
+ $.datepicker._getFormatConfig(inst));
+ if (date) { // only if valid
+ $.datepicker._setDateFromField(inst);
+ $.datepicker._updateAlternate(inst);
+ $.datepicker._updateDatepicker(inst);
+ }
+ }
+ catch (event) {
+ $.datepicker.log(event);
+ }
+ }
+ return true;
+ },
+
+ /* Pop-up the date picker for a given input field.
+ If false returned from beforeShow event handler do not show.
+ @param input element - the input field attached to the date picker or
+ event - if triggered by focus */
+ _showDatepicker: function(input) {
+ input = input.target || input;
+ if (input.nodeName.toLowerCase() != 'input') // find from button/image trigger
+ input = $('input', input.parentNode)[0];
+ if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput == input) // already here
+ return;
+ var inst = $.datepicker._getInst(input);
+ if ($.datepicker._curInst && $.datepicker._curInst != inst) {
+ $.datepicker._curInst.dpDiv.stop(true, true);
+ if ( inst && $.datepicker._datepickerShowing ) {
+ $.datepicker._hideDatepicker( $.datepicker._curInst.input[0] );
+ }
+ }
+ var beforeShow = $.datepicker._get(inst, 'beforeShow');
+ var beforeShowSettings = beforeShow ? beforeShow.apply(input, [input, inst]) : {};
+ if(beforeShowSettings === false){
+ //false
+ return;
+ }
+ extendRemove(inst.settings, beforeShowSettings);
+ inst.lastVal = null;
+ $.datepicker._lastInput = input;
+ $.datepicker._setDateFromField(inst);
+ if ($.datepicker._inDialog) // hide cursor
+ input.value = '';
+ if (!$.datepicker._pos) { // position below input
+ $.datepicker._pos = $.datepicker._findPos(input);
+ $.datepicker._pos[1] += input.offsetHeight; // add the height
+ }
+ var isFixed = false;
+ $(input).parents().each(function() {
+ isFixed |= $(this).css('position') == 'fixed';
+ return !isFixed;
+ });
+ if (isFixed && $.browser.opera) { // correction for Opera when fixed and scrolled
+ $.datepicker._pos[0] -= document.documentElement.scrollLeft;
+ $.datepicker._pos[1] -= document.documentElement.scrollTop;
+ }
+ var offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]};
+ $.datepicker._pos = null;
+ //to avoid flashes on Firefox
+ inst.dpDiv.empty();
+ // determine sizing offscreen
+ inst.dpDiv.css({position: 'absolute', display: 'block', top: '-1000px'});
+ $.datepicker._updateDatepicker(inst);
+ // fix width for dynamic number of date pickers
+ // and adjust position before showing
+ offset = $.datepicker._checkOffset(inst, offset, isFixed);
+ inst.dpDiv.css({position: ($.datepicker._inDialog && $.blockUI ?
+ 'static' : (isFixed ? 'fixed' : 'absolute')), display: 'none',
+ left: offset.left + 'px', top: offset.top + 'px'});
+ if (!inst.inline) {
+ var showAnim = $.datepicker._get(inst, 'showAnim');
+ var duration = $.datepicker._get(inst, 'duration');
+ var postProcess = function() {
+ var cover = inst.dpDiv.find('iframe.ui-datepicker-cover'); // IE6- only
+ if( !! cover.length ){
+ var borders = $.datepicker._getBorders(inst.dpDiv);
+ cover.css({left: -borders[0], top: -borders[1],
+ width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()});
+ }
+ };
+ inst.dpDiv.zIndex($(input).zIndex()+1);
+ $.datepicker._datepickerShowing = true;
+ if ($.effects && $.effects[showAnim])
+ inst.dpDiv.show(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);
+ else
+ inst.dpDiv[showAnim || 'show']((showAnim ? duration : null), postProcess);
+ if (!showAnim || !duration)
+ postProcess();
+ if (inst.input.is(':visible') && !inst.input.is(':disabled'))
+ inst.input.focus();
+ $.datepicker._curInst = inst;
+ }
+ },
+
+ /* Generate the date picker content. */
+ _updateDatepicker: function(inst) {
+ var self = this;
+ self.maxRows = 4; //Reset the max number of rows being displayed (see #7043)
+ var borders = $.datepicker._getBorders(inst.dpDiv);
+ instActive = inst; // for delegate hover events
+ inst.dpDiv.empty().append(this._generateHTML(inst));
+ var cover = inst.dpDiv.find('iframe.ui-datepicker-cover'); // IE6- only
+ if( !!cover.length ){ //avoid call to outerXXXX() when not in IE6
+ cover.css({left: -borders[0], top: -borders[1], width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()})
+ }
+ inst.dpDiv.find('.' + this._dayOverClass + ' a').mouseover();
+ var numMonths = this._getNumberOfMonths(inst);
+ var cols = numMonths[1];
+ var width = 17;
+ inst.dpDiv.removeClass('ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4').width('');
+ if (cols > 1)
+ inst.dpDiv.addClass('ui-datepicker-multi-' + cols).css('width', (width * cols) + 'em');
+ inst.dpDiv[(numMonths[0] != 1 || numMonths[1] != 1 ? 'add' : 'remove') +
+ 'Class']('ui-datepicker-multi');
+ inst.dpDiv[(this._get(inst, 'isRTL') ? 'add' : 'remove') +
+ 'Class']('ui-datepicker-rtl');
+ if (inst == $.datepicker._curInst && $.datepicker._datepickerShowing && inst.input &&
+ // #6694 - don't focus the input if it's already focused
+ // this breaks the change event in IE
+ inst.input.is(':visible') && !inst.input.is(':disabled') && inst.input[0] != document.activeElement)
+ inst.input.focus();
+ // deffered render of the years select (to avoid flashes on Firefox)
+ if( inst.yearshtml ){
+ var origyearshtml = inst.yearshtml;
+ setTimeout(function(){
+ //assure that inst.yearshtml didn't change.
+ if( origyearshtml === inst.yearshtml && inst.yearshtml ){
+ inst.dpDiv.find('select.ui-datepicker-year:first').replaceWith(inst.yearshtml);
+ }
+ origyearshtml = inst.yearshtml = null;
+ }, 0);
+ }
+ },
+
+ /* Retrieve the size of left and top borders for an element.
+ @param elem (jQuery object) the element of interest
+ @return (number[2]) the left and top borders */
+ _getBorders: function(elem) {
+ var convert = function(value) {
+ return {thin: 1, medium: 2, thick: 3}[value] || value;
+ };
+ return [parseFloat(convert(elem.css('border-left-width'))),
+ parseFloat(convert(elem.css('border-top-width')))];
+ },
+
+ /* Check positioning to remain on screen. */
+ _checkOffset: function(inst, offset, isFixed) {
+ var dpWidth = inst.dpDiv.outerWidth();
+ var dpHeight = inst.dpDiv.outerHeight();
+ var inputWidth = inst.input ? inst.input.outerWidth() : 0;
+ var inputHeight = inst.input ? inst.input.outerHeight() : 0;
+ var viewWidth = document.documentElement.clientWidth + $(document).scrollLeft();
+ var viewHeight = document.documentElement.clientHeight + $(document).scrollTop();
+
+ offset.left -= (this._get(inst, 'isRTL') ? (dpWidth - inputWidth) : 0);
+ offset.left -= (isFixed && offset.left == inst.input.offset().left) ? $(document).scrollLeft() : 0;
+ offset.top -= (isFixed && offset.top == (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0;
+
+ // now check if datepicker is showing outside window viewport - move to a better place if so.
+ offset.left -= Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ?
+ Math.abs(offset.left + dpWidth - viewWidth) : 0);
+ offset.top -= Math.min(offset.top, (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ?
+ Math.abs(dpHeight + inputHeight) : 0);
+
+ return offset;
+ },
+
+ /* Find an object's position on the screen. */
+ _findPos: function(obj) {
+ var inst = this._getInst(obj);
+ var isRTL = this._get(inst, 'isRTL');
+ while (obj && (obj.type == 'hidden' || obj.nodeType != 1 || $.expr.filters.hidden(obj))) {
+ obj = obj[isRTL ? 'previousSibling' : 'nextSibling'];
+ }
+ var position = $(obj).offset();
+ return [position.left, position.top];
+ },
+
+ /* Hide the date picker from view.
+ @param input element - the input field attached to the date picker */
+ _hideDatepicker: function(input) {
+ var inst = this._curInst;
+ if (!inst || (input && inst != $.data(input, PROP_NAME)))
+ return;
+ if (this._datepickerShowing) {
+ var showAnim = this._get(inst, 'showAnim');
+ var duration = this._get(inst, 'duration');
+ var self = this;
+ var postProcess = function() {
+ $.datepicker._tidyDialog(inst);
+ self._curInst = null;
+ };
+ if ($.effects && $.effects[showAnim])
+ inst.dpDiv.hide(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);
+ else
+ inst.dpDiv[(showAnim == 'slideDown' ? 'slideUp' :
+ (showAnim == 'fadeIn' ? 'fadeOut' : 'hide'))]((showAnim ? duration : null), postProcess);
+ if (!showAnim)
+ postProcess();
+ this._datepickerShowing = false;
+ var onClose = this._get(inst, 'onClose');
+ if (onClose)
+ onClose.apply((inst.input ? inst.input[0] : null),
+ [(inst.input ? inst.input.val() : ''), inst]);
+ this._lastInput = null;
+ if (this._inDialog) {
+ this._dialogInput.css({ position: 'absolute', left: '0', top: '-100px' });
+ if ($.blockUI) {
+ $.unblockUI();
+ $('body').append(this.dpDiv);
+ }
+ }
+ this._inDialog = false;
+ }
+ },
+
+ /* Tidy up after a dialog display. */
+ _tidyDialog: function(inst) {
+ inst.dpDiv.removeClass(this._dialogClass).unbind('.ui-datepicker-calendar');
+ },
+
+ /* Close date picker if clicked elsewhere. */
+ _checkExternalClick: function(event) {
+ if (!$.datepicker._curInst)
+ return;
+
+ var $target = $(event.target),
+ inst = $.datepicker._getInst($target[0]);
+
+ if ( ( ( $target[0].id != $.datepicker._mainDivId &&
+ $target.parents('#' + $.datepicker._mainDivId).length == 0 &&
+ !$target.hasClass($.datepicker.markerClassName) &&
+ !$target.closest("." + $.datepicker._triggerClass).length &&
+ $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI) ) ) ||
+ ( $target.hasClass($.datepicker.markerClassName) && $.datepicker._curInst != inst ) )
+ $.datepicker._hideDatepicker();
+ },
+
+ /* Adjust one of the date sub-fields. */
+ _adjustDate: function(id, offset, period) {
+ var target = $(id);
+ var inst = this._getInst(target[0]);
+ if (this._isDisabledDatepicker(target[0])) {
+ return;
+ }
+ this._adjustInstDate(inst, offset +
+ (period == 'M' ? this._get(inst, 'showCurrentAtPos') : 0), // undo positioning
+ period);
+ this._updateDatepicker(inst);
+ },
+
+ /* Action for current link. */
+ _gotoToday: function(id) {
+ var target = $(id);
+ var inst = this._getInst(target[0]);
+ if (this._get(inst, 'gotoCurrent') && inst.currentDay) {
+ inst.selectedDay = inst.currentDay;
+ inst.drawMonth = inst.selectedMonth = inst.currentMonth;
+ inst.drawYear = inst.selectedYear = inst.currentYear;
+ }
+ else {
+ var date = new Date();
+ inst.selectedDay = date.getDate();
+ inst.drawMonth = inst.selectedMonth = date.getMonth();
+ inst.drawYear = inst.selectedYear = date.getFullYear();
+ }
+ this._notifyChange(inst);
+ this._adjustDate(target);
+ },
+
+ /* Action for selecting a new month/year. */
+ _selectMonthYear: function(id, select, period) {
+ var target = $(id);
+ var inst = this._getInst(target[0]);
+ inst['selected' + (period == 'M' ? 'Month' : 'Year')] =
+ inst['draw' + (period == 'M' ? 'Month' : 'Year')] =
+ parseInt(select.options[select.selectedIndex].value,10);
+ this._notifyChange(inst);
+ this._adjustDate(target);
+ },
+
+ /* Action for selecting a day. */
+ _selectDay: function(id, month, year, td) {
+ var target = $(id);
+ if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) {
+ return;
+ }
+ var inst = this._getInst(target[0]);
+ inst.selectedDay = inst.currentDay = $('a', td).html();
+ inst.selectedMonth = inst.currentMonth = month;
+ inst.selectedYear = inst.currentYear = year;
+ this._selectDate(id, this._formatDate(inst,
+ inst.currentDay, inst.currentMonth, inst.currentYear));
+ },
+
+ /* Erase the input field and hide the date picker. */
+ _clearDate: function(id) {
+ var target = $(id);
+ var inst = this._getInst(target[0]);
+ this._selectDate(target, '');
+ },
+
+ /* Update the input field with the selected date. */
+ _selectDate: function(id, dateStr) {
+ var target = $(id);
+ var inst = this._getInst(target[0]);
+ dateStr = (dateStr != null ? dateStr : this._formatDate(inst));
+ if (inst.input)
+ inst.input.val(dateStr);
+ this._updateAlternate(inst);
+ var onSelect = this._get(inst, 'onSelect');
+ if (onSelect)
+ onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); // trigger custom callback
+ else if (inst.input)
+ inst.input.trigger('change'); // fire the change event
+ if (inst.inline)
+ this._updateDatepicker(inst);
+ else {
+ this._hideDatepicker();
+ this._lastInput = inst.input[0];
+ if (typeof(inst.input[0]) != 'object')
+ inst.input.focus(); // restore focus
+ this._lastInput = null;
+ }
+ },
+
+ /* Update any alternate field to synchronise with the main field. */
+ _updateAlternate: function(inst) {
+ var altField = this._get(inst, 'altField');
+ if (altField) { // update alternate field too
+ var altFormat = this._get(inst, 'altFormat') || this._get(inst, 'dateFormat');
+ var date = this._getDate(inst);
+ var dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst));
+ $(altField).each(function() { $(this).val(dateStr); });
+ }
+ },
+
+ /* Set as beforeShowDay function to prevent selection of weekends.
+ @param date Date - the date to customise
+ @return [boolean, string] - is this date selectable?, what is its CSS class? */
+ noWeekends: function(date) {
+ var day = date.getDay();
+ return [(day > 0 && day < 6), ''];
+ },
+
+ /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
+ @param date Date - the date to get the week for
+ @return number - the number of the week within the year that contains this date */
+ iso8601Week: function(date) {
+ var checkDate = new Date(date.getTime());
+ // Find Thursday of this week starting on Monday
+ checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7));
+ var time = checkDate.getTime();
+ checkDate.setMonth(0); // Compare with Jan 1
+ checkDate.setDate(1);
+ return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1;
+ },
+
+ /* Parse a string value into a date object.
+ See formatDate below for the possible formats.
+
+ @param format string - the expected format of the date
+ @param value string - the date in the above format
+ @param settings Object - attributes include:
+ shortYearCutoff number - the cutoff year for determining the century (optional)
+ dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
+ dayNames string[7] - names of the days from Sunday (optional)
+ monthNamesShort string[12] - abbreviated names of the months (optional)
+ monthNames string[12] - names of the months (optional)
+ @return Date - the extracted date value or null if value is blank */
+ parseDate: function (format, value, settings) {
+ if (format == null || value == null)
+ throw 'Invalid arguments';
+ value = (typeof value == 'object' ? value.toString() : value + '');
+ if (value == '')
+ return null;
+ var shortYearCutoff = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff;
+ shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff :
+ new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));
+ var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;
+ var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;
+ var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;
+ var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames;
+ var year = -1;
+ var month = -1;
+ var day = -1;
+ var doy = -1;
+ var literal = false;
+ // Check whether a format character is doubled
+ var lookAhead = function(match) {
+ var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
+ if (matches)
+ iFormat++;
+ return matches;
+ };
+ // Extract a number from the string value
+ var getNumber = function(match) {
+ var isDoubled = lookAhead(match);
+ var size = (match == '@' ? 14 : (match == '!' ? 20 :
+ (match == 'y' && isDoubled ? 4 : (match == 'o' ? 3 : 2))));
+ var digits = new RegExp('^\\d{1,' + size + '}');
+ var num = value.substring(iValue).match(digits);
+ if (!num)
+ throw 'Missing number at position ' + iValue;
+ iValue += num[0].length;
+ return parseInt(num[0], 10);
+ };
+ // Extract a name from the string value and convert to an index
+ var getName = function(match, shortNames, longNames) {
+ var names = $.map(lookAhead(match) ? longNames : shortNames, function (v, k) {
+ return [ [k, v] ];
+ }).sort(function (a, b) {
+ return -(a[1].length - b[1].length);
+ });
+ var index = -1;
+ $.each(names, function (i, pair) {
+ var name = pair[1];
+ if (value.substr(iValue, name.length).toLowerCase() == name.toLowerCase()) {
+ index = pair[0];
+ iValue += name.length;
+ return false;
+ }
+ });
+ if (index != -1)
+ return index + 1;
+ else
+ throw 'Unknown name at position ' + iValue;
+ };
+ // Confirm that a literal character matches the string value
+ var checkLiteral = function() {
+ if (value.charAt(iValue) != format.charAt(iFormat))
+ throw 'Unexpected literal at position ' + iValue;
+ iValue++;
+ };
+ var iValue = 0;
+ for (var iFormat = 0; iFormat < format.length; iFormat++) {
+ if (literal)
+ if (format.charAt(iFormat) == "'" && !lookAhead("'"))
+ literal = false;
+ else
+ checkLiteral();
+ else
+ switch (format.charAt(iFormat)) {
+ case 'd':
+ day = getNumber('d');
+ break;
+ case 'D':
+ getName('D', dayNamesShort, dayNames);
+ break;
+ case 'o':
+ doy = getNumber('o');
+ break;
+ case 'm':
+ month = getNumber('m');
+ break;
+ case 'M':
+ month = getName('M', monthNamesShort, monthNames);
+ break;
+ case 'y':
+ year = getNumber('y');
+ break;
+ case '@':
+ var date = new Date(getNumber('@'));
+ year = date.getFullYear();
+ month = date.getMonth() + 1;
+ day = date.getDate();
+ break;
+ case '!':
+ var date = new Date((getNumber('!') - this._ticksTo1970) / 10000);
+ year = date.getFullYear();
+ month = date.getMonth() + 1;
+ day = date.getDate();
+ break;
+ case "'":
+ if (lookAhead("'"))
+ checkLiteral();
+ else
+ literal = true;
+ break;
+ default:
+ checkLiteral();
+ }
+ }
+ if (iValue < value.length){
+ throw "Extra/unparsed characters found in date: " + value.substring(iValue);
+ }
+ if (year == -1)
+ year = new Date().getFullYear();
+ else if (year < 100)
+ year += new Date().getFullYear() - new Date().getFullYear() % 100 +
+ (year <= shortYearCutoff ? 0 : -100);
+ if (doy > -1) {
+ month = 1;
+ day = doy;
+ do {
+ var dim = this._getDaysInMonth(year, month - 1);
+ if (day <= dim)
+ break;
+ month++;
+ day -= dim;
+ } while (true);
+ }
+ var date = this._daylightSavingAdjust(new Date(year, month - 1, day));
+ if (date.getFullYear() != year || date.getMonth() + 1 != month || date.getDate() != day)
+ throw 'Invalid date'; // E.g. 31/02/00
+ return date;
+ },
+
+ /* Standard date formats. */
+ ATOM: 'yy-mm-dd', // RFC 3339 (ISO 8601)
+ COOKIE: 'D, dd M yy',
+ ISO_8601: 'yy-mm-dd',
+ RFC_822: 'D, d M y',
+ RFC_850: 'DD, dd-M-y',
+ RFC_1036: 'D, d M y',
+ RFC_1123: 'D, d M yy',
+ RFC_2822: 'D, d M yy',
+ RSS: 'D, d M y', // RFC 822
+ TICKS: '!',
+ TIMESTAMP: '@',
+ W3C: 'yy-mm-dd', // ISO 8601
+
+ _ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) +
+ Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000),
+
+ /* Format a date object into a string value.
+ The format can be combinations of the following:
+ d - day of month (no leading zero)
+ dd - day of month (two digit)
+ o - day of year (no leading zeros)
+ oo - day of year (three digit)
+ D - day name short
+ DD - day name long
+ m - month of year (no leading zero)
+ mm - month of year (two digit)
+ M - month name short
+ MM - month name long
+ y - year (two digit)
+ yy - year (four digit)
+ @ - Unix timestamp (ms since 01/01/1970)
+ ! - Windows ticks (100ns since 01/01/0001)
+ '...' - literal text
+ '' - single quote
+
+ @param format string - the desired format of the date
+ @param date Date - the date value to format
+ @param settings Object - attributes include:
+ dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
+ dayNames string[7] - names of the days from Sunday (optional)
+ monthNamesShort string[12] - abbreviated names of the months (optional)
+ monthNames string[12] - names of the months (optional)
+ @return string - the date in the above format */
+ formatDate: function (format, date, settings) {
+ if (!date)
+ return '';
+ var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;
+ var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;
+ var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;
+ var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames;
+ // Check whether a format character is doubled
+ var lookAhead = function(match) {
+ var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
+ if (matches)
+ iFormat++;
+ return matches;
+ };
+ // Format a number, with leading zero if necessary
+ var formatNumber = function(match, value, len) {
+ var num = '' + value;
+ if (lookAhead(match))
+ while (num.length < len)
+ num = '0' + num;
+ return num;
+ };
+ // Format a name, short or long as requested
+ var formatName = function(match, value, shortNames, longNames) {
+ return (lookAhead(match) ? longNames[value] : shortNames[value]);
+ };
+ var output = '';
+ var literal = false;
+ if (date)
+ for (var iFormat = 0; iFormat < format.length; iFormat++) {
+ if (literal)
+ if (format.charAt(iFormat) == "'" && !lookAhead("'"))
+ literal = false;
+ else
+ output += format.charAt(iFormat);
+ else
+ switch (format.charAt(iFormat)) {
+ case 'd':
+ output += formatNumber('d', date.getDate(), 2);
+ break;
+ case 'D':
+ output += formatName('D', date.getDay(), dayNamesShort, dayNames);
+ break;
+ case 'o':
+ output += formatNumber('o',
+ Math.round((new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000), 3);
+ break;
+ case 'm':
+ output += formatNumber('m', date.getMonth() + 1, 2);
+ break;
+ case 'M':
+ output += formatName('M', date.getMonth(), monthNamesShort, monthNames);
+ break;
+ case 'y':
+ output += (lookAhead('y') ? date.getFullYear() :
+ (date.getYear() % 100 < 10 ? '0' : '') + date.getYear() % 100);
+ break;
+ case '@':
+ output += date.getTime();
+ break;
+ case '!':
+ output += date.getTime() * 10000 + this._ticksTo1970;
+ break;
+ case "'":
+ if (lookAhead("'"))
+ output += "'";
+ else
+ literal = true;
+ break;
+ default:
+ output += format.charAt(iFormat);
+ }
+ }
+ return output;
+ },
+
+ /* Extract all possible characters from the date format. */
+ _possibleChars: function (format) {
+ var chars = '';
+ var literal = false;
+ // Check whether a format character is doubled
+ var lookAhead = function(match) {
+ var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
+ if (matches)
+ iFormat++;
+ return matches;
+ };
+ for (var iFormat = 0; iFormat < format.length; iFormat++)
+ if (literal)
+ if (format.charAt(iFormat) == "'" && !lookAhead("'"))
+ literal = false;
+ else
+ chars += format.charAt(iFormat);
+ else
+ switch (format.charAt(iFormat)) {
+ case 'd': case 'm': case 'y': case '@':
+ chars += '0123456789';
+ break;
+ case 'D': case 'M':
+ return null; // Accept anything
+ case "'":
+ if (lookAhead("'"))
+ chars += "'";
+ else
+ literal = true;
+ break;
+ default:
+ chars += format.charAt(iFormat);
+ }
+ return chars;
+ },
+
+ /* Get a setting value, defaulting if necessary. */
+ _get: function(inst, name) {
+ return inst.settings[name] !== undefined ?
+ inst.settings[name] : this._defaults[name];
+ },
+
+ /* Parse existing date and initialise date picker. */
+ _setDateFromField: function(inst, noDefault) {
+ if (inst.input.val() == inst.lastVal) {
+ return;
+ }
+ var dateFormat = this._get(inst, 'dateFormat');
+ var dates = inst.lastVal = inst.input ? inst.input.val() : null;
+ var date, defaultDate;
+ date = defaultDate = this._getDefaultDate(inst);
+ var settings = this._getFormatConfig(inst);
+ try {
+ date = this.parseDate(dateFormat, dates, settings) || defaultDate;
+ } catch (event) {
+ this.log(event);
+ dates = (noDefault ? '' : dates);
+ }
+ inst.selectedDay = date.getDate();
+ inst.drawMonth = inst.selectedMonth = date.getMonth();
+ inst.drawYear = inst.selectedYear = date.getFullYear();
+ inst.currentDay = (dates ? date.getDate() : 0);
+ inst.currentMonth = (dates ? date.getMonth() : 0);
+ inst.currentYear = (dates ? date.getFullYear() : 0);
+ this._adjustInstDate(inst);
+ },
+
+ /* Retrieve the default date shown on opening. */
+ _getDefaultDate: function(inst) {
+ return this._restrictMinMax(inst,
+ this._determineDate(inst, this._get(inst, 'defaultDate'), new Date()));
+ },
+
+ /* A date may be specified as an exact value or a relative one. */
+ _determineDate: function(inst, date, defaultDate) {
+ var offsetNumeric = function(offset) {
+ var date = new Date();
+ date.setDate(date.getDate() + offset);
+ return date;
+ };
+ var offsetString = function(offset) {
+ try {
+ return $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'),
+ offset, $.datepicker._getFormatConfig(inst));
+ }
+ catch (e) {
+ // Ignore
+ }
+ var date = (offset.toLowerCase().match(/^c/) ?
+ $.datepicker._getDate(inst) : null) || new Date();
+ var year = date.getFullYear();
+ var month = date.getMonth();
+ var day = date.getDate();
+ var pattern = /([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;
+ var matches = pattern.exec(offset);
+ while (matches) {
+ switch (matches[2] || 'd') {
+ case 'd' : case 'D' :
+ day += parseInt(matches[1],10); break;
+ case 'w' : case 'W' :
+ day += parseInt(matches[1],10) * 7; break;
+ case 'm' : case 'M' :
+ month += parseInt(matches[1],10);
+ day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
+ break;
+ case 'y': case 'Y' :
+ year += parseInt(matches[1],10);
+ day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
+ break;
+ }
+ matches = pattern.exec(offset);
+ }
+ return new Date(year, month, day);
+ };
+ var newDate = (date == null || date === '' ? defaultDate : (typeof date == 'string' ? offsetString(date) :
+ (typeof date == 'number' ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : new Date(date.getTime()))));
+ newDate = (newDate && newDate.toString() == 'Invalid Date' ? defaultDate : newDate);
+ if (newDate) {
+ newDate.setHours(0);
+ newDate.setMinutes(0);
+ newDate.setSeconds(0);
+ newDate.setMilliseconds(0);
+ }
+ return this._daylightSavingAdjust(newDate);
+ },
+
+ /* Handle switch to/from daylight saving.
+ Hours may be non-zero on daylight saving cut-over:
+ > 12 when midnight changeover, but then cannot generate
+ midnight datetime, so jump to 1AM, otherwise reset.
+ @param date (Date) the date to check
+ @return (Date) the corrected date */
+ _daylightSavingAdjust: function(date) {
+ if (!date) return null;
+ date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0);
+ return date;
+ },
+
+ /* Set the date(s) directly. */
+ _setDate: function(inst, date, noChange) {
+ var clear = !date;
+ var origMonth = inst.selectedMonth;
+ var origYear = inst.selectedYear;
+ var newDate = this._restrictMinMax(inst, this._determineDate(inst, date, new Date()));
+ inst.selectedDay = inst.currentDay = newDate.getDate();
+ inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth();
+ inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear();
+ if ((origMonth != inst.selectedMonth || origYear != inst.selectedYear) && !noChange)
+ this._notifyChange(inst);
+ this._adjustInstDate(inst);
+ if (inst.input) {
+ inst.input.val(clear ? '' : this._formatDate(inst));
+ }
+ },
+
+ /* Retrieve the date(s) directly. */
+ _getDate: function(inst) {
+ var startDate = (!inst.currentYear || (inst.input && inst.input.val() == '') ? null :
+ this._daylightSavingAdjust(new Date(
+ inst.currentYear, inst.currentMonth, inst.currentDay)));
+ return startDate;
+ },
+
+ /* Generate the HTML for the current state of the date picker. */
+ _generateHTML: function(inst) {
+ var today = new Date();
+ today = this._daylightSavingAdjust(
+ new Date(today.getFullYear(), today.getMonth(), today.getDate())); // clear time
+ var isRTL = this._get(inst, 'isRTL');
+ var showButtonPanel = this._get(inst, 'showButtonPanel');
+ var hideIfNoPrevNext = this._get(inst, 'hideIfNoPrevNext');
+ var navigationAsDateFormat = this._get(inst, 'navigationAsDateFormat');
+ var numMonths = this._getNumberOfMonths(inst);
+ var showCurrentAtPos = this._get(inst, 'showCurrentAtPos');
+ var stepMonths = this._get(inst, 'stepMonths');
+ var isMultiMonth = (numMonths[0] != 1 || numMonths[1] != 1);
+ var currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) :
+ new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
+ var minDate = this._getMinMaxDate(inst, 'min');
+ var maxDate = this._getMinMaxDate(inst, 'max');
+ var drawMonth = inst.drawMonth - showCurrentAtPos;
+ var drawYear = inst.drawYear;
+ if (drawMonth < 0) {
+ drawMonth += 12;
+ drawYear--;
+ }
+ if (maxDate) {
+ var maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(),
+ maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate()));
+ maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw);
+ while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) {
+ drawMonth--;
+ if (drawMonth < 0) {
+ drawMonth = 11;
+ drawYear--;
+ }
+ }
+ }
+ inst.drawMonth = drawMonth;
+ inst.drawYear = drawYear;
+ var prevText = this._get(inst, 'prevText');
+ prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText,
+ this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)),
+ this._getFormatConfig(inst)));
+ var prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ?
+ '<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery_' + dpuuid +
+ '.datepicker._adjustDate(\'#' + inst.id + '\', -' + stepMonths + ', \'M\');"' +
+ ' title="' + prevText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'e' : 'w') + '">' + prevText + '</span></a>' :
+ (hideIfNoPrevNext ? '' : '<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+ prevText +'"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'e' : 'w') + '">' + prevText + '</span></a>'));
+ var nextText = this._get(inst, 'nextText');
+ nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText,
+ this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)),
+ this._getFormatConfig(inst)));
+ var next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ?
+ '<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery_' + dpuuid +
+ '.datepicker._adjustDate(\'#' + inst.id + '\', +' + stepMonths + ', \'M\');"' +
+ ' title="' + nextText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'w' : 'e') + '">' + nextText + '</span></a>' :
+ (hideIfNoPrevNext ? '' : '<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+ nextText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'w' : 'e') + '">' + nextText + '</span></a>'));
+ var currentText = this._get(inst, 'currentText');
+ var gotoDate = (this._get(inst, 'gotoCurrent') && inst.currentDay ? currentDate : today);
+ currentText = (!navigationAsDateFormat ? currentText :
+ this.formatDate(currentText, gotoDate, this._getFormatConfig(inst)));
+ var controls = (!inst.inline ? '<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery_' + dpuuid +
+ '.datepicker._hideDatepicker();">' + this._get(inst, 'closeText') + '</button>' : '');
+ var buttonPanel = (showButtonPanel) ? '<div class="ui-datepicker-buttonpane ui-widget-content">' + (isRTL ? controls : '') +
+ (this._isInRange(inst, gotoDate) ? '<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery_' + dpuuid +
+ '.datepicker._gotoToday(\'#' + inst.id + '\');"' +
+ '>' + currentText + '</button>' : '') + (isRTL ? '' : controls) + '</div>' : '';
+ var firstDay = parseInt(this._get(inst, 'firstDay'),10);
+ firstDay = (isNaN(firstDay) ? 0 : firstDay);
+ var showWeek = this._get(inst, 'showWeek');
+ var dayNames = this._get(inst, 'dayNames');
+ var dayNamesShort = this._get(inst, 'dayNamesShort');
+ var dayNamesMin = this._get(inst, 'dayNamesMin');
+ var monthNames = this._get(inst, 'monthNames');
+ var monthNamesShort = this._get(inst, 'monthNamesShort');
+ var beforeShowDay = this._get(inst, 'beforeShowDay');
+ var showOtherMonths = this._get(inst, 'showOtherMonths');
+ var selectOtherMonths = this._get(inst, 'selectOtherMonths');
+ var calculateWeek = this._get(inst, 'calculateWeek') || this.iso8601Week;
+ var defaultDate = this._getDefaultDate(inst);
+ var html = '';
+ for (var row = 0; row < numMonths[0]; row++) {
+ var group = '';
+ this.maxRows = 4;
+ for (var col = 0; col < numMonths[1]; col++) {
+ var selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay));
+ var cornerClass = ' ui-corner-all';
+ var calender = '';
+ if (isMultiMonth) {
+ calender += '<div class="ui-datepicker-group';
+ if (numMonths[1] > 1)
+ switch (col) {
+ case 0: calender += ' ui-datepicker-group-first';
+ cornerClass = ' ui-corner-' + (isRTL ? 'right' : 'left'); break;
+ case numMonths[1]-1: calender += ' ui-datepicker-group-last';
+ cornerClass = ' ui-corner-' + (isRTL ? 'left' : 'right'); break;
+ default: calender += ' ui-datepicker-group-middle'; cornerClass = ''; break;
+ }
+ calender += '">';
+ }
+ calender += '<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix' + cornerClass + '">' +
+ (/all|left/.test(cornerClass) && row == 0 ? (isRTL ? next : prev) : '') +
+ (/all|right/.test(cornerClass) && row == 0 ? (isRTL ? prev : next) : '') +
+ this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate,
+ row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers
+ '</div><table class="ui-datepicker-calendar"><thead>' +
+ '<tr>';
+ var thead = (showWeek ? '<th class="ui-datepicker-week-col">' + this._get(inst, 'weekHeader') + '</th>' : '');
+ for (var dow = 0; dow < 7; dow++) { // days of the week
+ var day = (dow + firstDay) % 7;
+ thead += '<th' + ((dow + firstDay + 6) % 7 >= 5 ? ' class="ui-datepicker-week-end"' : '') + '>' +
+ '<span title="' + dayNames[day] + '">' + dayNamesMin[day] + '</span></th>';
+ }
+ calender += thead + '</tr></thead><tbody>';
+ var daysInMonth = this._getDaysInMonth(drawYear, drawMonth);
+ if (drawYear == inst.selectedYear && drawMonth == inst.selectedMonth)
+ inst.selectedDay = Math.min(inst.selectedDay, daysInMonth);
+ var leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7;
+ var curRows = Math.ceil((leadDays + daysInMonth) / 7); // calculate the number of rows to generate
+ var numRows = (isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows); //If multiple months, use the higher number of rows (see #7043)
+ this.maxRows = numRows;
+ var printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays));
+ for (var dRow = 0; dRow < numRows; dRow++) { // create date picker rows
+ calender += '<tr>';
+ var tbody = (!showWeek ? '' : '<td class="ui-datepicker-week-col">' +
+ this._get(inst, 'calculateWeek')(printDate) + '</td>');
+ for (var dow = 0; dow < 7; dow++) { // create date picker days
+ var daySettings = (beforeShowDay ?
+ beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, '']);
+ var otherMonth = (printDate.getMonth() != drawMonth);
+ var unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] ||
+ (minDate && printDate < minDate) || (maxDate && printDate > maxDate);
+ tbody += '<td class="' +
+ ((dow + firstDay + 6) % 7 >= 5 ? ' ui-datepicker-week-end' : '') + // highlight weekends
+ (otherMonth ? ' ui-datepicker-other-month' : '') + // highlight days from other months
+ ((printDate.getTime() == selectedDate.getTime() && drawMonth == inst.selectedMonth && inst._keyEvent) || // user pressed key
+ (defaultDate.getTime() == printDate.getTime() && defaultDate.getTime() == selectedDate.getTime()) ?
+ // or defaultDate is current printedDate and defaultDate is selectedDate
+ ' ' + this._dayOverClass : '') + // highlight selected day
+ (unselectable ? ' ' + this._unselectableClass + ' ui-state-disabled': '') + // highlight unselectable days
+ (otherMonth && !showOtherMonths ? '' : ' ' + daySettings[1] + // highlight custom dates
+ (printDate.getTime() == currentDate.getTime() ? ' ' + this._currentClass : '') + // highlight selected day
+ (printDate.getTime() == today.getTime() ? ' ui-datepicker-today' : '')) + '"' + // highlight today (if different)
+ ((!otherMonth || showOtherMonths) && daySettings[2] ? ' title="' + daySettings[2] + '"' : '') + // cell title
+ (unselectable ? '' : ' onclick="DP_jQuery_' + dpuuid + '.datepicker._selectDay(\'#' +
+ inst.id + '\',' + printDate.getMonth() + ',' + printDate.getFullYear() + ', this);return false;"') + '>' + // actions
+ (otherMonth && !showOtherMonths ? '&#xa0;' : // display for other months
+ (unselectable ? '<span class="ui-state-default">' + printDate.getDate() + '</span>' : '<a class="ui-state-default' +
+ (printDate.getTime() == today.getTime() ? ' ui-state-highlight' : '') +
+ (printDate.getTime() == currentDate.getTime() ? ' ui-state-active' : '') + // highlight selected day
+ (otherMonth ? ' ui-priority-secondary' : '') + // distinguish dates from other months
+ '" href="#">' + printDate.getDate() + '</a>')) + '</td>'; // display selectable date
+ printDate.setDate(printDate.getDate() + 1);
+ printDate = this._daylightSavingAdjust(printDate);
+ }
+ calender += tbody + '</tr>';
+ }
+ drawMonth++;
+ if (drawMonth > 11) {
+ drawMonth = 0;
+ drawYear++;
+ }
+ calender += '</tbody></table>' + (isMultiMonth ? '</div>' +
+ ((numMonths[0] > 0 && col == numMonths[1]-1) ? '<div class="ui-datepicker-row-break"></div>' : '') : '');
+ group += calender;
+ }
+ html += group;
+ }
+ html += buttonPanel + ($.browser.msie && parseInt($.browser.version,10) < 7 && !inst.inline ?
+ '<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>' : '');
+ inst._keyEvent = false;
+ return html;
+ },
+
+ /* Generate the month and year header. */
+ _generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate,
+ secondary, monthNames, monthNamesShort) {
+ var changeMonth = this._get(inst, 'changeMonth');
+ var changeYear = this._get(inst, 'changeYear');
+ var showMonthAfterYear = this._get(inst, 'showMonthAfterYear');
+ var html = '<div class="ui-datepicker-title">';
+ var monthHtml = '';
+ // month selection
+ if (secondary || !changeMonth)
+ monthHtml += '<span class="ui-datepicker-month">' + monthNames[drawMonth] + '</span>';
+ else {
+ var inMinYear = (minDate && minDate.getFullYear() == drawYear);
+ var inMaxYear = (maxDate && maxDate.getFullYear() == drawYear);
+ monthHtml += '<select class="ui-datepicker-month" ' +
+ 'onchange="DP_jQuery_' + dpuuid + '.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'M\');" ' +
+ '>';
+ for (var month = 0; month < 12; month++) {
+ if ((!inMinYear || month >= minDate.getMonth()) &&
+ (!inMaxYear || month <= maxDate.getMonth()))
+ monthHtml += '<option value="' + month + '"' +
+ (month == drawMonth ? ' selected="selected"' : '') +
+ '>' + monthNamesShort[month] + '</option>';
+ }
+ monthHtml += '</select>';
+ }
+ if (!showMonthAfterYear)
+ html += monthHtml + (secondary || !(changeMonth && changeYear) ? '&#xa0;' : '');
+ // year selection
+ if ( !inst.yearshtml ) {
+ inst.yearshtml = '';
+ if (secondary || !changeYear)
+ html += '<span class="ui-datepicker-year">' + drawYear + '</span>';
+ else {
+ // determine range of years to display
+ var years = this._get(inst, 'yearRange').split(':');
+ var thisYear = new Date().getFullYear();
+ var determineYear = function(value) {
+ var year = (value.match(/c[+-].*/) ? drawYear + parseInt(value.substring(1), 10) :
+ (value.match(/[+-].*/) ? thisYear + parseInt(value, 10) :
+ parseInt(value, 10)));
+ return (isNaN(year) ? thisYear : year);
+ };
+ var year = determineYear(years[0]);
+ var endYear = Math.max(year, determineYear(years[1] || ''));
+ year = (minDate ? Math.max(year, minDate.getFullYear()) : year);
+ endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear);
+ inst.yearshtml += '<select class="ui-datepicker-year" ' +
+ 'onchange="DP_jQuery_' + dpuuid + '.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'Y\');" ' +
+ '>';
+ for (; year <= endYear; year++) {
+ inst.yearshtml += '<option value="' + year + '"' +
+ (year == drawYear ? ' selected="selected"' : '') +
+ '>' + year + '</option>';
+ }
+ inst.yearshtml += '</select>';
+
+ html += inst.yearshtml;
+ inst.yearshtml = null;
+ }
+ }
+ html += this._get(inst, 'yearSuffix');
+ if (showMonthAfterYear)
+ html += (secondary || !(changeMonth && changeYear) ? '&#xa0;' : '') + monthHtml;
+ html += '</div>'; // Close datepicker_header
+ return html;
+ },
+
+ /* Adjust one of the date sub-fields. */
+ _adjustInstDate: function(inst, offset, period) {
+ var year = inst.drawYear + (period == 'Y' ? offset : 0);
+ var month = inst.drawMonth + (period == 'M' ? offset : 0);
+ var day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) +
+ (period == 'D' ? offset : 0);
+ var date = this._restrictMinMax(inst,
+ this._daylightSavingAdjust(new Date(year, month, day)));
+ inst.selectedDay = date.getDate();
+ inst.drawMonth = inst.selectedMonth = date.getMonth();
+ inst.drawYear = inst.selectedYear = date.getFullYear();
+ if (period == 'M' || period == 'Y')
+ this._notifyChange(inst);
+ },
+
+ /* Ensure a date is within any min/max bounds. */
+ _restrictMinMax: function(inst, date) {
+ var minDate = this._getMinMaxDate(inst, 'min');
+ var maxDate = this._getMinMaxDate(inst, 'max');
+ var newDate = (minDate && date < minDate ? minDate : date);
+ newDate = (maxDate && newDate > maxDate ? maxDate : newDate);
+ return newDate;
+ },
+
+ /* Notify change of month/year. */
+ _notifyChange: function(inst) {
+ var onChange = this._get(inst, 'onChangeMonthYear');
+ if (onChange)
+ onChange.apply((inst.input ? inst.input[0] : null),
+ [inst.selectedYear, inst.selectedMonth + 1, inst]);
+ },
+
+ /* Determine the number of months to show. */
+ _getNumberOfMonths: function(inst) {
+ var numMonths = this._get(inst, 'numberOfMonths');
+ return (numMonths == null ? [1, 1] : (typeof numMonths == 'number' ? [1, numMonths] : numMonths));
+ },
+
+ /* Determine the current maximum date - ensure no time components are set. */
+ _getMinMaxDate: function(inst, minMax) {
+ return this._determineDate(inst, this._get(inst, minMax + 'Date'), null);
+ },
+
+ /* Find the number of days in a given month. */
+ _getDaysInMonth: function(year, month) {
+ return 32 - this._daylightSavingAdjust(new Date(year, month, 32)).getDate();
+ },
+
+ /* Find the day of the week of the first of a month. */
+ _getFirstDayOfMonth: function(year, month) {
+ return new Date(year, month, 1).getDay();
+ },
+
+ /* Determines if we should allow a "next/prev" month display change. */
+ _canAdjustMonth: function(inst, offset, curYear, curMonth) {
+ var numMonths = this._getNumberOfMonths(inst);
+ var date = this._daylightSavingAdjust(new Date(curYear,
+ curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1));
+ if (offset < 0)
+ date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth()));
+ return this._isInRange(inst, date);
+ },
+
+ /* Is the given date in the accepted range? */
+ _isInRange: function(inst, date) {
+ var minDate = this._getMinMaxDate(inst, 'min');
+ var maxDate = this._getMinMaxDate(inst, 'max');
+ return ((!minDate || date.getTime() >= minDate.getTime()) &&
+ (!maxDate || date.getTime() <= maxDate.getTime()));
+ },
+
+ /* Provide the configuration settings for formatting/parsing. */
+ _getFormatConfig: function(inst) {
+ var shortYearCutoff = this._get(inst, 'shortYearCutoff');
+ shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff :
+ new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));
+ return {shortYearCutoff: shortYearCutoff,
+ dayNamesShort: this._get(inst, 'dayNamesShort'), dayNames: this._get(inst, 'dayNames'),
+ monthNamesShort: this._get(inst, 'monthNamesShort'), monthNames: this._get(inst, 'monthNames')};
+ },
+
+ /* Format the given date for display. */
+ _formatDate: function(inst, day, month, year) {
+ if (!day) {
+ inst.currentDay = inst.selectedDay;
+ inst.currentMonth = inst.selectedMonth;
+ inst.currentYear = inst.selectedYear;
+ }
+ var date = (day ? (typeof day == 'object' ? day :
+ this._daylightSavingAdjust(new Date(year, month, day))) :
+ this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
+ return this.formatDate(this._get(inst, 'dateFormat'), date, this._getFormatConfig(inst));
+ }
+});
+
+/*
+ * Bind hover events for datepicker elements.
+ * Done via delegate so the binding only occurs once in the lifetime of the parent div.
+ * Global instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker.
+ */
+function bindHover(dpDiv) {
+ var selector = 'button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a';
+ return dpDiv.bind('mouseout', function(event) {
+ var elem = $( event.target ).closest( selector );
+ if ( !elem.length ) {
+ return;
+ }
+ elem.removeClass( "ui-state-hover ui-datepicker-prev-hover ui-datepicker-next-hover" );
+ })
+ .bind('mouseover', function(event) {
+ var elem = $( event.target ).closest( selector );
+ if ($.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0]) ||
+ !elem.length ) {
+ return;
+ }
+ elem.parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover');
+ elem.addClass('ui-state-hover');
+ if (elem.hasClass('ui-datepicker-prev')) elem.addClass('ui-datepicker-prev-hover');
+ if (elem.hasClass('ui-datepicker-next')) elem.addClass('ui-datepicker-next-hover');
+ });
+}
+
+/* jQuery extend now ignores nulls! */
+function extendRemove(target, props) {
+ $.extend(target, props);
+ for (var name in props)
+ if (props[name] == null || props[name] == undefined)
+ target[name] = props[name];
+ return target;
+};
+
+/* Determine whether an object is an array. */
+function isArray(a) {
+ return (a && (($.browser.safari && typeof a == 'object' && a.length) ||
+ (a.constructor && a.constructor.toString().match(/\Array\(\)/))));
+};
+
+/* Invoke the datepicker functionality.
+ @param options string - a command, optionally followed by additional parameters or
+ Object - settings for attaching new datepicker functionality
+ @return jQuery object */
+$.fn.datepicker = function(options){
+
+ /* Verify an empty collection wasn't passed - Fixes #6976 */
+ if ( !this.length ) {
+ return this;
+ }
+
+ /* Initialise the date picker. */
+ if (!$.datepicker.initialized) {
+ $(document).mousedown($.datepicker._checkExternalClick).
+ find('body').append($.datepicker.dpDiv);
+ $.datepicker.initialized = true;
+ }
+
+ var otherArgs = Array.prototype.slice.call(arguments, 1);
+ if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate' || options == 'widget'))
+ return $.datepicker['_' + options + 'Datepicker'].
+ apply($.datepicker, [this[0]].concat(otherArgs));
+ if (options == 'option' && arguments.length == 2 && typeof arguments[1] == 'string')
+ return $.datepicker['_' + options + 'Datepicker'].
+ apply($.datepicker, [this[0]].concat(otherArgs));
+ return this.each(function() {
+ typeof options == 'string' ?
+ $.datepicker['_' + options + 'Datepicker'].
+ apply($.datepicker, [this].concat(otherArgs)) :
+ $.datepicker._attachDatepicker(this, options);
+ });
+};
+
+$.datepicker = new Datepicker(); // singleton instance
+$.datepicker.initialized = false;
+$.datepicker.uuid = new Date().getTime();
+$.datepicker.version = "1.8.18";
+
+// Workaround for #4055
+// Add another global to avoid noConflict issues with inline event handlers
+window['DP_jQuery_' + dpuuid] = $;
+
+})(jQuery);
+/*
+ * jQuery UI Dialog 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Dialog
+ *
+ * Depends:
+ * jquery.ui.core.js
+ * jquery.ui.widget.js
+ * jquery.ui.button.js
+ * jquery.ui.draggable.js
+ * jquery.ui.mouse.js
+ * jquery.ui.position.js
+ * jquery.ui.resizable.js
+ */
+(function( $, undefined ) {
+
+var uiDialogClasses =
+ 'ui-dialog ' +
+ 'ui-widget ' +
+ 'ui-widget-content ' +
+ 'ui-corner-all ',
+ sizeRelatedOptions = {
+ buttons: true,
+ height: true,
+ maxHeight: true,
+ maxWidth: true,
+ minHeight: true,
+ minWidth: true,
+ width: true
+ },
+ resizableRelatedOptions = {
+ maxHeight: true,
+ maxWidth: true,
+ minHeight: true,
+ minWidth: true
+ },
+ // support for jQuery 1.3.2 - handle common attrFn methods for dialog
+ attrFn = $.attrFn || {
+ val: true,
+ css: true,
+ html: true,
+ text: true,
+ data: true,
+ width: true,
+ height: true,
+ offset: true,
+ click: true
+ };
+
+$.widget("ui.dialog", {
+ options: {
+ autoOpen: true,
+ buttons: {},
+ closeOnEscape: true,
+ closeText: 'close',
+ dialogClass: '',
+ draggable: true,
+ hide: null,
+ height: 'auto',
+ maxHeight: false,
+ maxWidth: false,
+ minHeight: 150,
+ minWidth: 150,
+ modal: false,
+ position: {
+ my: 'center',
+ at: 'center',
+ collision: 'fit',
+ // ensure that the titlebar is never outside the document
+ using: function(pos) {
+ var topOffset = $(this).css(pos).offset().top;
+ if (topOffset < 0) {
+ $(this).css('top', pos.top - topOffset);
+ }
+ }
+ },
+ resizable: true,
+ show: null,
+ stack: true,
+ title: '',
+ width: 300,
+ zIndex: 1000
+ },
+
+ _create: function() {
+ this.originalTitle = this.element.attr('title');
+ // #5742 - .attr() might return a DOMElement
+ if ( typeof this.originalTitle !== "string" ) {
+ this.originalTitle = "";
+ }
+
+ this.options.title = this.options.title || this.originalTitle;
+ var self = this,
+ options = self.options,
+
+ title = options.title || '&#160;',
+ titleId = $.ui.dialog.getTitleId(self.element),
+
+ uiDialog = (self.uiDialog = $('<div></div>'))
+ .appendTo(document.body)
+ .hide()
+ .addClass(uiDialogClasses + options.dialogClass)
+ .css({
+ zIndex: options.zIndex
+ })
+ // setting tabIndex makes the div focusable
+ // setting outline to 0 prevents a border on focus in Mozilla
+ .attr('tabIndex', -1).css('outline', 0).keydown(function(event) {
+ if (options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode &&
+ event.keyCode === $.ui.keyCode.ESCAPE) {
+
+ self.close(event);
+ event.preventDefault();
+ }
+ })
+ .attr({
+ role: 'dialog',
+ 'aria-labelledby': titleId
+ })
+ .mousedown(function(event) {
+ self.moveToTop(false, event);
+ }),
+
+ uiDialogContent = self.element
+ .show()
+ .removeAttr('title')
+ .addClass(
+ 'ui-dialog-content ' +
+ 'ui-widget-content')
+ .appendTo(uiDialog),
+
+ uiDialogTitlebar = (self.uiDialogTitlebar = $('<div></div>'))
+ .addClass(
+ 'ui-dialog-titlebar ' +
+ 'ui-widget-header ' +
+ 'ui-corner-all ' +
+ 'ui-helper-clearfix'
+ )
+ .prependTo(uiDialog),
+
+ uiDialogTitlebarClose = $('<a href="#"></a>')
+ .addClass(
+ 'ui-dialog-titlebar-close ' +
+ 'ui-corner-all'
+ )
+ .attr('role', 'button')
+ .hover(
+ function() {
+ uiDialogTitlebarClose.addClass('ui-state-hover');
+ },
+ function() {
+ uiDialogTitlebarClose.removeClass('ui-state-hover');
+ }
+ )
+ .focus(function() {
+ uiDialogTitlebarClose.addClass('ui-state-focus');
+ })
+ .blur(function() {
+ uiDialogTitlebarClose.removeClass('ui-state-focus');
+ })
+ .click(function(event) {
+ self.close(event);
+ return false;
+ })
+ .appendTo(uiDialogTitlebar),
+
+ uiDialogTitlebarCloseText = (self.uiDialogTitlebarCloseText = $('<span></span>'))
+ .addClass(
+ 'ui-icon ' +
+ 'ui-icon-closethick'
+ )
+ .text(options.closeText)
+ .appendTo(uiDialogTitlebarClose),
+
+ uiDialogTitle = $('<span></span>')
+ .addClass('ui-dialog-title')
+ .attr('id', titleId)
+ .html(title)
+ .prependTo(uiDialogTitlebar);
+
+ //handling of deprecated beforeclose (vs beforeClose) option
+ //Ticket #4669 http://dev.jqueryui.com/ticket/4669
+ //TODO: remove in 1.9pre
+ if ($.isFunction(options.beforeclose) && !$.isFunction(options.beforeClose)) {
+ options.beforeClose = options.beforeclose;
+ }
+
+ uiDialogTitlebar.find("*").add(uiDialogTitlebar).disableSelection();
+
+ if (options.draggable && $.fn.draggable) {
+ self._makeDraggable();
+ }
+ if (options.resizable && $.fn.resizable) {
+ self._makeResizable();
+ }
+
+ self._createButtons(options.buttons);
+ self._isOpen = false;
+
+ if ($.fn.bgiframe) {
+ uiDialog.bgiframe();
+ }
+ },
+
+ _init: function() {
+ if ( this.options.autoOpen ) {
+ this.open();
+ }
+ },
+
+ destroy: function() {
+ var self = this;
+
+ if (self.overlay) {
+ self.overlay.destroy();
+ }
+ self.uiDialog.hide();
+ self.element
+ .unbind('.dialog')
+ .removeData('dialog')
+ .removeClass('ui-dialog-content ui-widget-content')
+ .hide().appendTo('body');
+ self.uiDialog.remove();
+
+ if (self.originalTitle) {
+ self.element.attr('title', self.originalTitle);
+ }
+
+ return self;
+ },
+
+ widget: function() {
+ return this.uiDialog;
+ },
+
+ close: function(event) {
+ var self = this,
+ maxZ, thisZ;
+
+ if (false === self._trigger('beforeClose', event)) {
+ return;
+ }
+
+ if (self.overlay) {
+ self.overlay.destroy();
+ }
+ self.uiDialog.unbind('keypress.ui-dialog');
+
+ self._isOpen = false;
+
+ if (self.options.hide) {
+ self.uiDialog.hide(self.options.hide, function() {
+ self._trigger('close', event);
+ });
+ } else {
+ self.uiDialog.hide();
+ self._trigger('close', event);
+ }
+
+ $.ui.dialog.overlay.resize();
+
+ // adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
+ if (self.options.modal) {
+ maxZ = 0;
+ $('.ui-dialog').each(function() {
+ if (this !== self.uiDialog[0]) {
+ thisZ = $(this).css('z-index');
+ if(!isNaN(thisZ)) {
+ maxZ = Math.max(maxZ, thisZ);
+ }
+ }
+ });
+ $.ui.dialog.maxZ = maxZ;
+ }
+
+ return self;
+ },
+
+ isOpen: function() {
+ return this._isOpen;
+ },
+
+ // the force parameter allows us to move modal dialogs to their correct
+ // position on open
+ moveToTop: function(force, event) {
+ var self = this,
+ options = self.options,
+ saveScroll;
+
+ if ((options.modal && !force) ||
+ (!options.stack && !options.modal)) {
+ return self._trigger('focus', event);
+ }
+
+ if (options.zIndex > $.ui.dialog.maxZ) {
+ $.ui.dialog.maxZ = options.zIndex;
+ }
+ if (self.overlay) {
+ $.ui.dialog.maxZ += 1;
+ self.overlay.$el.css('z-index', $.ui.dialog.overlay.maxZ = $.ui.dialog.maxZ);
+ }
+
+ //Save and then restore scroll since Opera 9.5+ resets when parent z-Index is changed.
+ // http://ui.jquery.com/bugs/ticket/3193
+ saveScroll = { scrollTop: self.element.scrollTop(), scrollLeft: self.element.scrollLeft() };
+ $.ui.dialog.maxZ += 1;
+ self.uiDialog.css('z-index', $.ui.dialog.maxZ);
+ self.element.attr(saveScroll);
+ self._trigger('focus', event);
+
+ return self;
+ },
+
+ open: function() {
+ if (this._isOpen) { return; }
+
+ var self = this,
+ options = self.options,
+ uiDialog = self.uiDialog;
+
+ self.overlay = options.modal ? new $.ui.dialog.overlay(self) : null;
+ self._size();
+ self._position(options.position);
+ uiDialog.show(options.show);
+ self.moveToTop(true);
+
+ // prevent tabbing out of modal dialogs
+ if ( options.modal ) {
+ uiDialog.bind( "keydown.ui-dialog", function( event ) {
+ if ( event.keyCode !== $.ui.keyCode.TAB ) {
+ return;
+ }
+
+ var tabbables = $(':tabbable', this),
+ first = tabbables.filter(':first'),
+ last = tabbables.filter(':last');
+
+ if (event.target === last[0] && !event.shiftKey) {
+ first.focus(1);
+ return false;
+ } else if (event.target === first[0] && event.shiftKey) {
+ last.focus(1);
+ return false;
+ }
+ });
+ }
+
+ // set focus to the first tabbable element in the content area or the first button
+ // if there are no tabbable elements, set focus on the dialog itself
+ $(self.element.find(':tabbable').get().concat(
+ uiDialog.find('.ui-dialog-buttonpane :tabbable').get().concat(
+ uiDialog.get()))).eq(0).focus();
+
+ self._isOpen = true;
+ self._trigger('open');
+
+ return self;
+ },
+
+ _createButtons: function(buttons) {
+ var self = this,
+ hasButtons = false,
+ uiDialogButtonPane = $('<div></div>')
+ .addClass(
+ 'ui-dialog-buttonpane ' +
+ 'ui-widget-content ' +
+ 'ui-helper-clearfix'
+ ),
+ uiButtonSet = $( "<div></div>" )
+ .addClass( "ui-dialog-buttonset" )
+ .appendTo( uiDialogButtonPane );
+
+ // if we already have a button pane, remove it
+ self.uiDialog.find('.ui-dialog-buttonpane').remove();
+
+ if (typeof buttons === 'object' && buttons !== null) {
+ $.each(buttons, function() {
+ return !(hasButtons = true);
+ });
+ }
+ if (hasButtons) {
+ $.each(buttons, function(name, props) {
+ props = $.isFunction( props ) ?
+ { click: props, text: name } :
+ props;
+ var button = $('<button type="button"></button>')
+ .click(function() {
+ props.click.apply(self.element[0], arguments);
+ })
+ .appendTo(uiButtonSet);
+ // can't use .attr( props, true ) with jQuery 1.3.2.
+ $.each( props, function( key, value ) {
+ if ( key === "click" ) {
+ return;
+ }
+ if ( key in attrFn ) {
+ button[ key ]( value );
+ } else {
+ button.attr( key, value );
+ }
+ });
+ if ($.fn.button) {
+ button.button();
+ }
+ });
+ uiDialogButtonPane.appendTo(self.uiDialog);
+ }
+ },
+
+ _makeDraggable: function() {
+ var self = this,
+ options = self.options,
+ doc = $(document),
+ heightBeforeDrag;
+
+ function filteredUi(ui) {
+ return {
+ position: ui.position,
+ offset: ui.offset
+ };
+ }
+
+ self.uiDialog.draggable({
+ cancel: '.ui-dialog-content, .ui-dialog-titlebar-close',
+ handle: '.ui-dialog-titlebar',
+ containment: 'document',
+ start: function(event, ui) {
+ heightBeforeDrag = options.height === "auto" ? "auto" : $(this).height();
+ $(this).height($(this).height()).addClass("ui-dialog-dragging");
+ self._trigger('dragStart', event, filteredUi(ui));
+ },
+ drag: function(event, ui) {
+ self._trigger('drag', event, filteredUi(ui));
+ },
+ stop: function(event, ui) {
+ options.position = [ui.position.left - doc.scrollLeft(),
+ ui.position.top - doc.scrollTop()];
+ $(this).removeClass("ui-dialog-dragging").height(heightBeforeDrag);
+ self._trigger('dragStop', event, filteredUi(ui));
+ $.ui.dialog.overlay.resize();
+ }
+ });
+ },
+
+ _makeResizable: function(handles) {
+ handles = (handles === undefined ? this.options.resizable : handles);
+ var self = this,
+ options = self.options,
+ // .ui-resizable has position: relative defined in the stylesheet
+ // but dialogs have to use absolute or fixed positioning
+ position = self.uiDialog.css('position'),
+ resizeHandles = (typeof handles === 'string' ?
+ handles :
+ 'n,e,s,w,se,sw,ne,nw'
+ );
+
+ function filteredUi(ui) {
+ return {
+ originalPosition: ui.originalPosition,
+ originalSize: ui.originalSize,
+ position: ui.position,
+ size: ui.size
+ };
+ }
+
+ self.uiDialog.resizable({
+ cancel: '.ui-dialog-content',
+ containment: 'document',
+ alsoResize: self.element,
+ maxWidth: options.maxWidth,
+ maxHeight: options.maxHeight,
+ minWidth: options.minWidth,
+ minHeight: self._minHeight(),
+ handles: resizeHandles,
+ start: function(event, ui) {
+ $(this).addClass("ui-dialog-resizing");
+ self._trigger('resizeStart', event, filteredUi(ui));
+ },
+ resize: function(event, ui) {
+ self._trigger('resize', event, filteredUi(ui));
+ },
+ stop: function(event, ui) {
+ $(this).removeClass("ui-dialog-resizing");
+ options.height = $(this).height();
+ options.width = $(this).width();
+ self._trigger('resizeStop', event, filteredUi(ui));
+ $.ui.dialog.overlay.resize();
+ }
+ })
+ .css('position', position)
+ .find('.ui-resizable-se').addClass('ui-icon ui-icon-grip-diagonal-se');
+ },
+
+ _minHeight: function() {
+ var options = this.options;
+
+ if (options.height === 'auto') {
+ return options.minHeight;
+ } else {
+ return Math.min(options.minHeight, options.height);
+ }
+ },
+
+ _position: function(position) {
+ var myAt = [],
+ offset = [0, 0],
+ isVisible;
+
+ if (position) {
+ // deep extending converts arrays to objects in jQuery <= 1.3.2 :-(
+ // if (typeof position == 'string' || $.isArray(position)) {
+ // myAt = $.isArray(position) ? position : position.split(' ');
+
+ if (typeof position === 'string' || (typeof position === 'object' && '0' in position)) {
+ myAt = position.split ? position.split(' ') : [position[0], position[1]];
+ if (myAt.length === 1) {
+ myAt[1] = myAt[0];
+ }
+
+ $.each(['left', 'top'], function(i, offsetPosition) {
+ if (+myAt[i] === myAt[i]) {
+ offset[i] = myAt[i];
+ myAt[i] = offsetPosition;
+ }
+ });
+
+ position = {
+ my: myAt.join(" "),
+ at: myAt.join(" "),
+ offset: offset.join(" ")
+ };
+ }
+
+ position = $.extend({}, $.ui.dialog.prototype.options.position, position);
+ } else {
+ position = $.ui.dialog.prototype.options.position;
+ }
+
+ // need to show the dialog to get the actual offset in the position plugin
+ isVisible = this.uiDialog.is(':visible');
+ if (!isVisible) {
+ this.uiDialog.show();
+ }
+ this.uiDialog
+ // workaround for jQuery bug #5781 http://dev.jquery.com/ticket/5781
+ .css({ top: 0, left: 0 })
+ .position($.extend({ of: window }, position));
+ if (!isVisible) {
+ this.uiDialog.hide();
+ }
+ },
+
+ _setOptions: function( options ) {
+ var self = this,
+ resizableOptions = {},
+ resize = false;
+
+ $.each( options, function( key, value ) {
+ self._setOption( key, value );
+
+ if ( key in sizeRelatedOptions ) {
+ resize = true;
+ }
+ if ( key in resizableRelatedOptions ) {
+ resizableOptions[ key ] = value;
+ }
+ });
+
+ if ( resize ) {
+ this._size();
+ }
+ if ( this.uiDialog.is( ":data(resizable)" ) ) {
+ this.uiDialog.resizable( "option", resizableOptions );
+ }
+ },
+
+ _setOption: function(key, value){
+ var self = this,
+ uiDialog = self.uiDialog;
+
+ switch (key) {
+ //handling of deprecated beforeclose (vs beforeClose) option
+ //Ticket #4669 http://dev.jqueryui.com/ticket/4669
+ //TODO: remove in 1.9pre
+ case "beforeclose":
+ key = "beforeClose";
+ break;
+ case "buttons":
+ self._createButtons(value);
+ break;
+ case "closeText":
+ // ensure that we always pass a string
+ self.uiDialogTitlebarCloseText.text("" + value);
+ break;
+ case "dialogClass":
+ uiDialog
+ .removeClass(self.options.dialogClass)
+ .addClass(uiDialogClasses + value);
+ break;
+ case "disabled":
+ if (value) {
+ uiDialog.addClass('ui-dialog-disabled');
+ } else {
+ uiDialog.removeClass('ui-dialog-disabled');
+ }
+ break;
+ case "draggable":
+ var isDraggable = uiDialog.is( ":data(draggable)" );
+ if ( isDraggable && !value ) {
+ uiDialog.draggable( "destroy" );
+ }
+
+ if ( !isDraggable && value ) {
+ self._makeDraggable();
+ }
+ break;
+ case "position":
+ self._position(value);
+ break;
+ case "resizable":
+ // currently resizable, becoming non-resizable
+ var isResizable = uiDialog.is( ":data(resizable)" );
+ if (isResizable && !value) {
+ uiDialog.resizable('destroy');
+ }
+
+ // currently resizable, changing handles
+ if (isResizable && typeof value === 'string') {
+ uiDialog.resizable('option', 'handles', value);
+ }
+
+ // currently non-resizable, becoming resizable
+ if (!isResizable && value !== false) {
+ self._makeResizable(value);
+ }
+ break;
+ case "title":
+ // convert whatever was passed in o a string, for html() to not throw up
+ $(".ui-dialog-title", self.uiDialogTitlebar).html("" + (value || '&#160;'));
+ break;
+ }
+
+ $.Widget.prototype._setOption.apply(self, arguments);
+ },
+
+ _size: function() {
+ /* If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
+ * divs will both have width and height set, so we need to reset them
+ */
+ var options = this.options,
+ nonContentHeight,
+ minContentHeight,
+ isVisible = this.uiDialog.is( ":visible" );
+
+ // reset content sizing
+ this.element.show().css({
+ width: 'auto',
+ minHeight: 0,
+ height: 0
+ });
+
+ if (options.minWidth > options.width) {
+ options.width = options.minWidth;
+ }
+
+ // reset wrapper sizing
+ // determine the height of all the non-content elements
+ nonContentHeight = this.uiDialog.css({
+ height: 'auto',
+ width: options.width
+ })
+ .height();
+ minContentHeight = Math.max( 0, options.minHeight - nonContentHeight );
+
+ if ( options.height === "auto" ) {
+ // only needed for IE6 support
+ if ( $.support.minHeight ) {
+ this.element.css({
+ minHeight: minContentHeight,
+ height: "auto"
+ });
+ } else {
+ this.uiDialog.show();
+ var autoHeight = this.element.css( "height", "auto" ).height();
+ if ( !isVisible ) {
+ this.uiDialog.hide();
+ }
+ this.element.height( Math.max( autoHeight, minContentHeight ) );
+ }
+ } else {
+ this.element.height( Math.max( options.height - nonContentHeight, 0 ) );
+ }
+
+ if (this.uiDialog.is(':data(resizable)')) {
+ this.uiDialog.resizable('option', 'minHeight', this._minHeight());
+ }
+ }
+});
+
+$.extend($.ui.dialog, {
+ version: "1.8.18",
+
+ uuid: 0,
+ maxZ: 0,
+
+ getTitleId: function($el) {
+ var id = $el.attr('id');
+ if (!id) {
+ this.uuid += 1;
+ id = this.uuid;
+ }
+ return 'ui-dialog-title-' + id;
+ },
+
+ overlay: function(dialog) {
+ this.$el = $.ui.dialog.overlay.create(dialog);
+ }
+});
+
+$.extend($.ui.dialog.overlay, {
+ instances: [],
+ // reuse old instances due to IE memory leak with alpha transparency (see #5185)
+ oldInstances: [],
+ maxZ: 0,
+ events: $.map('focus,mousedown,mouseup,keydown,keypress,click'.split(','),
+ function(event) { return event + '.dialog-overlay'; }).join(' '),
+ create: function(dialog) {
+ if (this.instances.length === 0) {
+ // prevent use of anchors and inputs
+ // we use a setTimeout in case the overlay is created from an
+ // event that we're going to be cancelling (see #2804)
+ setTimeout(function() {
+ // handle $(el).dialog().dialog('close') (see #4065)
+ if ($.ui.dialog.overlay.instances.length) {
+ $(document).bind($.ui.dialog.overlay.events, function(event) {
+ // stop events if the z-index of the target is < the z-index of the overlay
+ // we cannot return true when we don't want to cancel the event (#3523)
+ if ($(event.target).zIndex() < $.ui.dialog.overlay.maxZ) {
+ return false;
+ }
+ });
+ }
+ }, 1);
+
+ // allow closing by pressing the escape key
+ $(document).bind('keydown.dialog-overlay', function(event) {
+ if (dialog.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode &&
+ event.keyCode === $.ui.keyCode.ESCAPE) {
+
+ dialog.close(event);
+ event.preventDefault();
+ }
+ });
+
+ // handle window resize
+ $(window).bind('resize.dialog-overlay', $.ui.dialog.overlay.resize);
+ }
+
+ var $el = (this.oldInstances.pop() || $('<div></div>').addClass('ui-widget-overlay'))
+ .appendTo(document.body)
+ .css({
+ width: this.width(),
+ height: this.height()
+ });
+
+ if ($.fn.bgiframe) {
+ $el.bgiframe();
+ }
+
+ this.instances.push($el);
+ return $el;
+ },
+
+ destroy: function($el) {
+ var indexOf = $.inArray($el, this.instances);
+ if (indexOf != -1){
+ this.oldInstances.push(this.instances.splice(indexOf, 1)[0]);
+ }
+
+ if (this.instances.length === 0) {
+ $([document, window]).unbind('.dialog-overlay');
+ }
+
+ $el.remove();
+
+ // adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
+ var maxZ = 0;
+ $.each(this.instances, function() {
+ maxZ = Math.max(maxZ, this.css('z-index'));
+ });
+ this.maxZ = maxZ;
+ },
+
+ height: function() {
+ var scrollHeight,
+ offsetHeight;
+ // handle IE 6
+ if ($.browser.msie && $.browser.version < 7) {
+ scrollHeight = Math.max(
+ document.documentElement.scrollHeight,
+ document.body.scrollHeight
+ );
+ offsetHeight = Math.max(
+ document.documentElement.offsetHeight,
+ document.body.offsetHeight
+ );
+
+ if (scrollHeight < offsetHeight) {
+ return $(window).height() + 'px';
+ } else {
+ return scrollHeight + 'px';
+ }
+ // handle "good" browsers
+ } else {
+ return $(document).height() + 'px';
+ }
+ },
+
+ width: function() {
+ var scrollWidth,
+ offsetWidth;
+ // handle IE
+ if ( $.browser.msie ) {
+ scrollWidth = Math.max(
+ document.documentElement.scrollWidth,
+ document.body.scrollWidth
+ );
+ offsetWidth = Math.max(
+ document.documentElement.offsetWidth,
+ document.body.offsetWidth
+ );
+
+ if (scrollWidth < offsetWidth) {
+ return $(window).width() + 'px';
+ } else {
+ return scrollWidth + 'px';
+ }
+ // handle "good" browsers
+ } else {
+ return $(document).width() + 'px';
+ }
+ },
+
+ resize: function() {
+ /* If the dialog is draggable and the user drags it past the
+ * right edge of the window, the document becomes wider so we
+ * need to stretch the overlay. If the user then drags the
+ * dialog back to the left, the document will become narrower,
+ * so we need to shrink the overlay to the appropriate size.
+ * This is handled by shrinking the overlay before setting it
+ * to the full document size.
+ */
+ var $overlays = $([]);
+ $.each($.ui.dialog.overlay.instances, function() {
+ $overlays = $overlays.add(this);
+ });
+
+ $overlays.css({
+ width: 0,
+ height: 0
+ }).css({
+ width: $.ui.dialog.overlay.width(),
+ height: $.ui.dialog.overlay.height()
+ });
+ }
+});
+
+$.extend($.ui.dialog.overlay.prototype, {
+ destroy: function() {
+ $.ui.dialog.overlay.destroy(this.$el);
+ }
+});
+
+}(jQuery));
+/*
+ * jQuery UI Position 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Position
+ */
+(function( $, undefined ) {
+
+$.ui = $.ui || {};
+
+var horizontalPositions = /left|center|right/,
+ verticalPositions = /top|center|bottom/,
+ center = "center",
+ support = {},
+ _position = $.fn.position,
+ _offset = $.fn.offset;
+
+$.fn.position = function( options ) {
+ if ( !options || !options.of ) {
+ return _position.apply( this, arguments );
+ }
+
+ // make a copy, we don't want to modify arguments
+ options = $.extend( {}, options );
+
+ var target = $( options.of ),
+ targetElem = target[0],
+ collision = ( options.collision || "flip" ).split( " " ),
+ offset = options.offset ? options.offset.split( " " ) : [ 0, 0 ],
+ targetWidth,
+ targetHeight,
+ basePosition;
+
+ if ( targetElem.nodeType === 9 ) {
+ targetWidth = target.width();
+ targetHeight = target.height();
+ basePosition = { top: 0, left: 0 };
+ // TODO: use $.isWindow() in 1.9
+ } else if ( targetElem.setTimeout ) {
+ targetWidth = target.width();
+ targetHeight = target.height();
+ basePosition = { top: target.scrollTop(), left: target.scrollLeft() };
+ } else if ( targetElem.preventDefault ) {
+ // force left top to allow flipping
+ options.at = "left top";
+ targetWidth = targetHeight = 0;
+ basePosition = { top: options.of.pageY, left: options.of.pageX };
+ } else {
+ targetWidth = target.outerWidth();
+ targetHeight = target.outerHeight();
+ basePosition = target.offset();
+ }
+
+ // force my and at to have valid horizontal and veritcal positions
+ // if a value is missing or invalid, it will be converted to center
+ $.each( [ "my", "at" ], function() {
+ var pos = ( options[this] || "" ).split( " " );
+ if ( pos.length === 1) {
+ pos = horizontalPositions.test( pos[0] ) ?
+ pos.concat( [center] ) :
+ verticalPositions.test( pos[0] ) ?
+ [ center ].concat( pos ) :
+ [ center, center ];
+ }
+ pos[ 0 ] = horizontalPositions.test( pos[0] ) ? pos[ 0 ] : center;
+ pos[ 1 ] = verticalPositions.test( pos[1] ) ? pos[ 1 ] : center;
+ options[ this ] = pos;
+ });
+
+ // normalize collision option
+ if ( collision.length === 1 ) {
+ collision[ 1 ] = collision[ 0 ];
+ }
+
+ // normalize offset option
+ offset[ 0 ] = parseInt( offset[0], 10 ) || 0;
+ if ( offset.length === 1 ) {
+ offset[ 1 ] = offset[ 0 ];
+ }
+ offset[ 1 ] = parseInt( offset[1], 10 ) || 0;
+
+ if ( options.at[0] === "right" ) {
+ basePosition.left += targetWidth;
+ } else if ( options.at[0] === center ) {
+ basePosition.left += targetWidth / 2;
+ }
+
+ if ( options.at[1] === "bottom" ) {
+ basePosition.top += targetHeight;
+ } else if ( options.at[1] === center ) {
+ basePosition.top += targetHeight / 2;
+ }
+
+ basePosition.left += offset[ 0 ];
+ basePosition.top += offset[ 1 ];
+
+ return this.each(function() {
+ var elem = $( this ),
+ elemWidth = elem.outerWidth(),
+ elemHeight = elem.outerHeight(),
+ marginLeft = parseInt( $.curCSS( this, "marginLeft", true ) ) || 0,
+ marginTop = parseInt( $.curCSS( this, "marginTop", true ) ) || 0,
+ collisionWidth = elemWidth + marginLeft +
+ ( parseInt( $.curCSS( this, "marginRight", true ) ) || 0 ),
+ collisionHeight = elemHeight + marginTop +
+ ( parseInt( $.curCSS( this, "marginBottom", true ) ) || 0 ),
+ position = $.extend( {}, basePosition ),
+ collisionPosition;
+
+ if ( options.my[0] === "right" ) {
+ position.left -= elemWidth;
+ } else if ( options.my[0] === center ) {
+ position.left -= elemWidth / 2;
+ }
+
+ if ( options.my[1] === "bottom" ) {
+ position.top -= elemHeight;
+ } else if ( options.my[1] === center ) {
+ position.top -= elemHeight / 2;
+ }
+
+ // prevent fractions if jQuery version doesn't support them (see #5280)
+ if ( !support.fractions ) {
+ position.left = Math.round( position.left );
+ position.top = Math.round( position.top );
+ }
+
+ collisionPosition = {
+ left: position.left - marginLeft,
+ top: position.top - marginTop
+ };
+
+ $.each( [ "left", "top" ], function( i, dir ) {
+ if ( $.ui.position[ collision[i] ] ) {
+ $.ui.position[ collision[i] ][ dir ]( position, {
+ targetWidth: targetWidth,
+ targetHeight: targetHeight,
+ elemWidth: elemWidth,
+ elemHeight: elemHeight,
+ collisionPosition: collisionPosition,
+ collisionWidth: collisionWidth,
+ collisionHeight: collisionHeight,
+ offset: offset,
+ my: options.my,
+ at: options.at
+ });
+ }
+ });
+
+ if ( $.fn.bgiframe ) {
+ elem.bgiframe();
+ }
+ elem.offset( $.extend( position, { using: options.using } ) );
+ });
+};
+
+$.ui.position = {
+ fit: {
+ left: function( position, data ) {
+ var win = $( window ),
+ over = data.collisionPosition.left + data.collisionWidth - win.width() - win.scrollLeft();
+ position.left = over > 0 ? position.left - over : Math.max( position.left - data.collisionPosition.left, position.left );
+ },
+ top: function( position, data ) {
+ var win = $( window ),
+ over = data.collisionPosition.top + data.collisionHeight - win.height() - win.scrollTop();
+ position.top = over > 0 ? position.top - over : Math.max( position.top - data.collisionPosition.top, position.top );
+ }
+ },
+
+ flip: {
+ left: function( position, data ) {
+ if ( data.at[0] === center ) {
+ return;
+ }
+ var win = $( window ),
+ over = data.collisionPosition.left + data.collisionWidth - win.width() - win.scrollLeft(),
+ myOffset = data.my[ 0 ] === "left" ?
+ -data.elemWidth :
+ data.my[ 0 ] === "right" ?
+ data.elemWidth :
+ 0,
+ atOffset = data.at[ 0 ] === "left" ?
+ data.targetWidth :
+ -data.targetWidth,
+ offset = -2 * data.offset[ 0 ];
+ position.left += data.collisionPosition.left < 0 ?
+ myOffset + atOffset + offset :
+ over > 0 ?
+ myOffset + atOffset + offset :
+ 0;
+ },
+ top: function( position, data ) {
+ if ( data.at[1] === center ) {
+ return;
+ }
+ var win = $( window ),
+ over = data.collisionPosition.top + data.collisionHeight - win.height() - win.scrollTop(),
+ myOffset = data.my[ 1 ] === "top" ?
+ -data.elemHeight :
+ data.my[ 1 ] === "bottom" ?
+ data.elemHeight :
+ 0,
+ atOffset = data.at[ 1 ] === "top" ?
+ data.targetHeight :
+ -data.targetHeight,
+ offset = -2 * data.offset[ 1 ];
+ position.top += data.collisionPosition.top < 0 ?
+ myOffset + atOffset + offset :
+ over > 0 ?
+ myOffset + atOffset + offset :
+ 0;
+ }
+ }
+};
+
+// offset setter from jQuery 1.4
+if ( !$.offset.setOffset ) {
+ $.offset.setOffset = function( elem, options ) {
+ // set position first, in-case top/left are set even on static elem
+ if ( /static/.test( $.curCSS( elem, "position" ) ) ) {
+ elem.style.position = "relative";
+ }
+ var curElem = $( elem ),
+ curOffset = curElem.offset(),
+ curTop = parseInt( $.curCSS( elem, "top", true ), 10 ) || 0,
+ curLeft = parseInt( $.curCSS( elem, "left", true ), 10) || 0,
+ props = {
+ top: (options.top - curOffset.top) + curTop,
+ left: (options.left - curOffset.left) + curLeft
+ };
+
+ if ( 'using' in options ) {
+ options.using.call( elem, props );
+ } else {
+ curElem.css( props );
+ }
+ };
+
+ $.fn.offset = function( options ) {
+ var elem = this[ 0 ];
+ if ( !elem || !elem.ownerDocument ) { return null; }
+ if ( options ) {
+ return this.each(function() {
+ $.offset.setOffset( this, options );
+ });
+ }
+ return _offset.call( this );
+ };
+}
+
+// fraction support test (older versions of jQuery don't support fractions)
+(function () {
+ var body = document.getElementsByTagName( "body" )[ 0 ],
+ div = document.createElement( "div" ),
+ testElement, testElementParent, testElementStyle, offset, offsetTotal;
+
+ //Create a "fake body" for testing based on method used in jQuery.support
+ testElement = document.createElement( body ? "div" : "body" );
+ testElementStyle = {
+ visibility: "hidden",
+ width: 0,
+ height: 0,
+ border: 0,
+ margin: 0,
+ background: "none"
+ };
+ if ( body ) {
+ $.extend( testElementStyle, {
+ position: "absolute",
+ left: "-1000px",
+ top: "-1000px"
+ });
+ }
+ for ( var i in testElementStyle ) {
+ testElement.style[ i ] = testElementStyle[ i ];
+ }
+ testElement.appendChild( div );
+ testElementParent = body || document.documentElement;
+ testElementParent.insertBefore( testElement, testElementParent.firstChild );
+
+ div.style.cssText = "position: absolute; left: 10.7432222px; top: 10.432325px; height: 30px; width: 201px;";
+
+ offset = $( div ).offset( function( _, offset ) {
+ return offset;
+ }).offset();
+
+ testElement.innerHTML = "";
+ testElementParent.removeChild( testElement );
+
+ offsetTotal = offset.top + offset.left + ( body ? 2000 : 0 );
+ support.fractions = offsetTotal > 21 && offsetTotal < 22;
+})();
+
+}( jQuery ));
+/*
+ * jQuery UI Progressbar 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Progressbar
+ *
+ * Depends:
+ * jquery.ui.core.js
+ * jquery.ui.widget.js
+ */
+(function( $, undefined ) {
+
+$.widget( "ui.progressbar", {
+ options: {
+ value: 0,
+ max: 100
+ },
+
+ min: 0,
+
+ _create: function() {
+ this.element
+ .addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
+ .attr({
+ role: "progressbar",
+ "aria-valuemin": this.min,
+ "aria-valuemax": this.options.max,
+ "aria-valuenow": this._value()
+ });
+
+ this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" )
+ .appendTo( this.element );
+
+ this.oldValue = this._value();
+ this._refreshValue();
+ },
+
+ destroy: function() {
+ this.element
+ .removeClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
+ .removeAttr( "role" )
+ .removeAttr( "aria-valuemin" )
+ .removeAttr( "aria-valuemax" )
+ .removeAttr( "aria-valuenow" );
+
+ this.valueDiv.remove();
+
+ $.Widget.prototype.destroy.apply( this, arguments );
+ },
+
+ value: function( newValue ) {
+ if ( newValue === undefined ) {
+ return this._value();
+ }
+
+ this._setOption( "value", newValue );
+ return this;
+ },
+
+ _setOption: function( key, value ) {
+ if ( key === "value" ) {
+ this.options.value = value;
+ this._refreshValue();
+ if ( this._value() === this.options.max ) {
+ this._trigger( "complete" );
+ }
+ }
+
+ $.Widget.prototype._setOption.apply( this, arguments );
+ },
+
+ _value: function() {
+ var val = this.options.value;
+ // normalize invalid value
+ if ( typeof val !== "number" ) {
+ val = 0;
+ }
+ return Math.min( this.options.max, Math.max( this.min, val ) );
+ },
+
+ _percentage: function() {
+ return 100 * this._value() / this.options.max;
+ },
+
+ _refreshValue: function() {
+ var value = this.value();
+ var percentage = this._percentage();
+
+ if ( this.oldValue !== value ) {
+ this.oldValue = value;
+ this._trigger( "change" );
+ }
+
+ this.valueDiv
+ .toggle( value > this.min )
+ .toggleClass( "ui-corner-right", value === this.options.max )
+ .width( percentage.toFixed(0) + "%" );
+ this.element.attr( "aria-valuenow", value );
+ }
+});
+
+$.extend( $.ui.progressbar, {
+ version: "1.8.18"
+});
+
+})( jQuery );
+/*
+ * jQuery UI Slider 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Slider
+ *
+ * Depends:
+ * jquery.ui.core.js
+ * jquery.ui.mouse.js
+ * jquery.ui.widget.js
+ */
+(function( $, undefined ) {
+
+// number of pages in a slider
+// (how many times can you page up/down to go through the whole range)
+var numPages = 5;
+
+$.widget( "ui.slider", $.ui.mouse, {
+
+ widgetEventPrefix: "slide",
+
+ options: {
+ animate: false,
+ distance: 0,
+ max: 100,
+ min: 0,
+ orientation: "horizontal",
+ range: false,
+ step: 1,
+ value: 0,
+ values: null
+ },
+
+ _create: function() {
+ var self = this,
+ o = this.options,
+ existingHandles = this.element.find( ".ui-slider-handle" ).addClass( "ui-state-default ui-corner-all" ),
+ handle = "<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>",
+ handleCount = ( o.values && o.values.length ) || 1,
+ handles = [];
+
+ this._keySliding = false;
+ this._mouseSliding = false;
+ this._animateOff = true;
+ this._handleIndex = null;
+ this._detectOrientation();
+ this._mouseInit();
+
+ this.element
+ .addClass( "ui-slider" +
+ " ui-slider-" + this.orientation +
+ " ui-widget" +
+ " ui-widget-content" +
+ " ui-corner-all" +
+ ( o.disabled ? " ui-slider-disabled ui-disabled" : "" ) );
+
+ this.range = $([]);
+
+ if ( o.range ) {
+ if ( o.range === true ) {
+ if ( !o.values ) {
+ o.values = [ this._valueMin(), this._valueMin() ];
+ }
+ if ( o.values.length && o.values.length !== 2 ) {
+ o.values = [ o.values[0], o.values[0] ];
+ }
+ }
+
+ this.range = $( "<div></div>" )
+ .appendTo( this.element )
+ .addClass( "ui-slider-range" +
+ // note: this isn't the most fittingly semantic framework class for this element,
+ // but worked best visually with a variety of themes
+ " ui-widget-header" +
+ ( ( o.range === "min" || o.range === "max" ) ? " ui-slider-range-" + o.range : "" ) );
+ }
+
+ for ( var i = existingHandles.length; i < handleCount; i += 1 ) {
+ handles.push( handle );
+ }
+
+ this.handles = existingHandles.add( $( handles.join( "" ) ).appendTo( self.element ) );
+
+ this.handle = this.handles.eq( 0 );
+
+ this.handles.add( this.range ).filter( "a" )
+ .click(function( event ) {
+ event.preventDefault();
+ })
+ .hover(function() {
+ if ( !o.disabled ) {
+ $( this ).addClass( "ui-state-hover" );
+ }
+ }, function() {
+ $( this ).removeClass( "ui-state-hover" );
+ })
+ .focus(function() {
+ if ( !o.disabled ) {
+ $( ".ui-slider .ui-state-focus" ).removeClass( "ui-state-focus" );
+ $( this ).addClass( "ui-state-focus" );
+ } else {
+ $( this ).blur();
+ }
+ })
+ .blur(function() {
+ $( this ).removeClass( "ui-state-focus" );
+ });
+
+ this.handles.each(function( i ) {
+ $( this ).data( "index.ui-slider-handle", i );
+ });
+
+ this.handles
+ .keydown(function( event ) {
+ var index = $( this ).data( "index.ui-slider-handle" ),
+ allowed,
+ curVal,
+ newVal,
+ step;
+
+ if ( self.options.disabled ) {
+ return;
+ }
+
+ switch ( event.keyCode ) {
+ case $.ui.keyCode.HOME:
+ case $.ui.keyCode.END:
+ case $.ui.keyCode.PAGE_UP:
+ case $.ui.keyCode.PAGE_DOWN:
+ case $.ui.keyCode.UP:
+ case $.ui.keyCode.RIGHT:
+ case $.ui.keyCode.DOWN:
+ case $.ui.keyCode.LEFT:
+ event.preventDefault();
+ if ( !self._keySliding ) {
+ self._keySliding = true;
+ $( this ).addClass( "ui-state-active" );
+ allowed = self._start( event, index );
+ if ( allowed === false ) {
+ return;
+ }
+ }
+ break;
+ }
+
+ step = self.options.step;
+ if ( self.options.values && self.options.values.length ) {
+ curVal = newVal = self.values( index );
+ } else {
+ curVal = newVal = self.value();
+ }
+
+ switch ( event.keyCode ) {
+ case $.ui.keyCode.HOME:
+ newVal = self._valueMin();
+ break;
+ case $.ui.keyCode.END:
+ newVal = self._valueMax();
+ break;
+ case $.ui.keyCode.PAGE_UP:
+ newVal = self._trimAlignValue( curVal + ( (self._valueMax() - self._valueMin()) / numPages ) );
+ break;
+ case $.ui.keyCode.PAGE_DOWN:
+ newVal = self._trimAlignValue( curVal - ( (self._valueMax() - self._valueMin()) / numPages ) );
+ break;
+ case $.ui.keyCode.UP:
+ case $.ui.keyCode.RIGHT:
+ if ( curVal === self._valueMax() ) {
+ return;
+ }
+ newVal = self._trimAlignValue( curVal + step );
+ break;
+ case $.ui.keyCode.DOWN:
+ case $.ui.keyCode.LEFT:
+ if ( curVal === self._valueMin() ) {
+ return;
+ }
+ newVal = self._trimAlignValue( curVal - step );
+ break;
+ }
+
+ self._slide( event, index, newVal );
+ })
+ .keyup(function( event ) {
+ var index = $( this ).data( "index.ui-slider-handle" );
+
+ if ( self._keySliding ) {
+ self._keySliding = false;
+ self._stop( event, index );
+ self._change( event, index );
+ $( this ).removeClass( "ui-state-active" );
+ }
+
+ });
+
+ this._refreshValue();
+
+ this._animateOff = false;
+ },
+
+ destroy: function() {
+ this.handles.remove();
+ this.range.remove();
+
+ this.element
+ .removeClass( "ui-slider" +
+ " ui-slider-horizontal" +
+ " ui-slider-vertical" +
+ " ui-slider-disabled" +
+ " ui-widget" +
+ " ui-widget-content" +
+ " ui-corner-all" )
+ .removeData( "slider" )
+ .unbind( ".slider" );
+
+ this._mouseDestroy();
+
+ return this;
+ },
+
+ _mouseCapture: function( event ) {
+ var o = this.options,
+ position,
+ normValue,
+ distance,
+ closestHandle,
+ self,
+ index,
+ allowed,
+ offset,
+ mouseOverHandle;
+
+ if ( o.disabled ) {
+ return false;
+ }
+
+ this.elementSize = {
+ width: this.element.outerWidth(),
+ height: this.element.outerHeight()
+ };
+ this.elementOffset = this.element.offset();
+
+ position = { x: event.pageX, y: event.pageY };
+ normValue = this._normValueFromMouse( position );
+ distance = this._valueMax() - this._valueMin() + 1;
+ self = this;
+ this.handles.each(function( i ) {
+ var thisDistance = Math.abs( normValue - self.values(i) );
+ if ( distance > thisDistance ) {
+ distance = thisDistance;
+ closestHandle = $( this );
+ index = i;
+ }
+ });
+
+ // workaround for bug #3736 (if both handles of a range are at 0,
+ // the first is always used as the one with least distance,
+ // and moving it is obviously prevented by preventing negative ranges)
+ if( o.range === true && this.values(1) === o.min ) {
+ index += 1;
+ closestHandle = $( this.handles[index] );
+ }
+
+ allowed = this._start( event, index );
+ if ( allowed === false ) {
+ return false;
+ }
+ this._mouseSliding = true;
+
+ self._handleIndex = index;
+
+ closestHandle
+ .addClass( "ui-state-active" )
+ .focus();
+
+ offset = closestHandle.offset();
+ mouseOverHandle = !$( event.target ).parents().andSelf().is( ".ui-slider-handle" );
+ this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
+ left: event.pageX - offset.left - ( closestHandle.width() / 2 ),
+ top: event.pageY - offset.top -
+ ( closestHandle.height() / 2 ) -
+ ( parseInt( closestHandle.css("borderTopWidth"), 10 ) || 0 ) -
+ ( parseInt( closestHandle.css("borderBottomWidth"), 10 ) || 0) +
+ ( parseInt( closestHandle.css("marginTop"), 10 ) || 0)
+ };
+
+ if ( !this.handles.hasClass( "ui-state-hover" ) ) {
+ this._slide( event, index, normValue );
+ }
+ this._animateOff = true;
+ return true;
+ },
+
+ _mouseStart: function( event ) {
+ return true;
+ },
+
+ _mouseDrag: function( event ) {
+ var position = { x: event.pageX, y: event.pageY },
+ normValue = this._normValueFromMouse( position );
+
+ this._slide( event, this._handleIndex, normValue );
+
+ return false;
+ },
+
+ _mouseStop: function( event ) {
+ this.handles.removeClass( "ui-state-active" );
+ this._mouseSliding = false;
+
+ this._stop( event, this._handleIndex );
+ this._change( event, this._handleIndex );
+
+ this._handleIndex = null;
+ this._clickOffset = null;
+ this._animateOff = false;
+
+ return false;
+ },
+
+ _detectOrientation: function() {
+ this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal";
+ },
+
+ _normValueFromMouse: function( position ) {
+ var pixelTotal,
+ pixelMouse,
+ percentMouse,
+ valueTotal,
+ valueMouse;
+
+ if ( this.orientation === "horizontal" ) {
+ pixelTotal = this.elementSize.width;
+ pixelMouse = position.x - this.elementOffset.left - ( this._clickOffset ? this._clickOffset.left : 0 );
+ } else {
+ pixelTotal = this.elementSize.height;
+ pixelMouse = position.y - this.elementOffset.top - ( this._clickOffset ? this._clickOffset.top : 0 );
+ }
+
+ percentMouse = ( pixelMouse / pixelTotal );
+ if ( percentMouse > 1 ) {
+ percentMouse = 1;
+ }
+ if ( percentMouse < 0 ) {
+ percentMouse = 0;
+ }
+ if ( this.orientation === "vertical" ) {
+ percentMouse = 1 - percentMouse;
+ }
+
+ valueTotal = this._valueMax() - this._valueMin();
+ valueMouse = this._valueMin() + percentMouse * valueTotal;
+
+ return this._trimAlignValue( valueMouse );
+ },
+
+ _start: function( event, index ) {
+ var uiHash = {
+ handle: this.handles[ index ],
+ value: this.value()
+ };
+ if ( this.options.values && this.options.values.length ) {
+ uiHash.value = this.values( index );
+ uiHash.values = this.values();
+ }
+ return this._trigger( "start", event, uiHash );
+ },
+
+ _slide: function( event, index, newVal ) {
+ var otherVal,
+ newValues,
+ allowed;
+
+ if ( this.options.values && this.options.values.length ) {
+ otherVal = this.values( index ? 0 : 1 );
+
+ if ( ( this.options.values.length === 2 && this.options.range === true ) &&
+ ( ( index === 0 && newVal > otherVal) || ( index === 1 && newVal < otherVal ) )
+ ) {
+ newVal = otherVal;
+ }
+
+ if ( newVal !== this.values( index ) ) {
+ newValues = this.values();
+ newValues[ index ] = newVal;
+ // A slide can be canceled by returning false from the slide callback
+ allowed = this._trigger( "slide", event, {
+ handle: this.handles[ index ],
+ value: newVal,
+ values: newValues
+ } );
+ otherVal = this.values( index ? 0 : 1 );
+ if ( allowed !== false ) {
+ this.values( index, newVal, true );
+ }
+ }
+ } else {
+ if ( newVal !== this.value() ) {
+ // A slide can be canceled by returning false from the slide callback
+ allowed = this._trigger( "slide", event, {
+ handle: this.handles[ index ],
+ value: newVal
+ } );
+ if ( allowed !== false ) {
+ this.value( newVal );
+ }
+ }
+ }
+ },
+
+ _stop: function( event, index ) {
+ var uiHash = {
+ handle: this.handles[ index ],
+ value: this.value()
+ };
+ if ( this.options.values && this.options.values.length ) {
+ uiHash.value = this.values( index );
+ uiHash.values = this.values();
+ }
+
+ this._trigger( "stop", event, uiHash );
+ },
+
+ _change: function( event, index ) {
+ if ( !this._keySliding && !this._mouseSliding ) {
+ var uiHash = {
+ handle: this.handles[ index ],
+ value: this.value()
+ };
+ if ( this.options.values && this.options.values.length ) {
+ uiHash.value = this.values( index );
+ uiHash.values = this.values();
+ }
+
+ this._trigger( "change", event, uiHash );
+ }
+ },
+
+ value: function( newValue ) {
+ if ( arguments.length ) {
+ this.options.value = this._trimAlignValue( newValue );
+ this._refreshValue();
+ this._change( null, 0 );
+ return;
+ }
+
+ return this._value();
+ },
+
+ values: function( index, newValue ) {
+ var vals,
+ newValues,
+ i;
+
+ if ( arguments.length > 1 ) {
+ this.options.values[ index ] = this._trimAlignValue( newValue );
+ this._refreshValue();
+ this._change( null, index );
+ return;
+ }
+
+ if ( arguments.length ) {
+ if ( $.isArray( arguments[ 0 ] ) ) {
+ vals = this.options.values;
+ newValues = arguments[ 0 ];
+ for ( i = 0; i < vals.length; i += 1 ) {
+ vals[ i ] = this._trimAlignValue( newValues[ i ] );
+ this._change( null, i );
+ }
+ this._refreshValue();
+ } else {
+ if ( this.options.values && this.options.values.length ) {
+ return this._values( index );
+ } else {
+ return this.value();
+ }
+ }
+ } else {
+ return this._values();
+ }
+ },
+
+ _setOption: function( key, value ) {
+ var i,
+ valsLength = 0;
+
+ if ( $.isArray( this.options.values ) ) {
+ valsLength = this.options.values.length;
+ }
+
+ $.Widget.prototype._setOption.apply( this, arguments );
+
+ switch ( key ) {
+ case "disabled":
+ if ( value ) {
+ this.handles.filter( ".ui-state-focus" ).blur();
+ this.handles.removeClass( "ui-state-hover" );
+ this.handles.propAttr( "disabled", true );
+ this.element.addClass( "ui-disabled" );
+ } else {
+ this.handles.propAttr( "disabled", false );
+ this.element.removeClass( "ui-disabled" );
+ }
+ break;
+ case "orientation":
+ this._detectOrientation();
+ this.element
+ .removeClass( "ui-slider-horizontal ui-slider-vertical" )
+ .addClass( "ui-slider-" + this.orientation );
+ this._refreshValue();
+ break;
+ case "value":
+ this._animateOff = true;
+ this._refreshValue();
+ this._change( null, 0 );
+ this._animateOff = false;
+ break;
+ case "values":
+ this._animateOff = true;
+ this._refreshValue();
+ for ( i = 0; i < valsLength; i += 1 ) {
+ this._change( null, i );
+ }
+ this._animateOff = false;
+ break;
+ }
+ },
+
+ //internal value getter
+ // _value() returns value trimmed by min and max, aligned by step
+ _value: function() {
+ var val = this.options.value;
+ val = this._trimAlignValue( val );
+
+ return val;
+ },
+
+ //internal values getter
+ // _values() returns array of values trimmed by min and max, aligned by step
+ // _values( index ) returns single value trimmed by min and max, aligned by step
+ _values: function( index ) {
+ var val,
+ vals,
+ i;
+
+ if ( arguments.length ) {
+ val = this.options.values[ index ];
+ val = this._trimAlignValue( val );
+
+ return val;
+ } else {
+ // .slice() creates a copy of the array
+ // this copy gets trimmed by min and max and then returned
+ vals = this.options.values.slice();
+ for ( i = 0; i < vals.length; i+= 1) {
+ vals[ i ] = this._trimAlignValue( vals[ i ] );
+ }
+
+ return vals;
+ }
+ },
+
+ // returns the step-aligned value that val is closest to, between (inclusive) min and max
+ _trimAlignValue: function( val ) {
+ if ( val <= this._valueMin() ) {
+ return this._valueMin();
+ }
+ if ( val >= this._valueMax() ) {
+ return this._valueMax();
+ }
+ var step = ( this.options.step > 0 ) ? this.options.step : 1,
+ valModStep = (val - this._valueMin()) % step,
+ alignValue = val - valModStep;
+
+ if ( Math.abs(valModStep) * 2 >= step ) {
+ alignValue += ( valModStep > 0 ) ? step : ( -step );
+ }
+
+ // Since JavaScript has problems with large floats, round
+ // the final value to 5 digits after the decimal point (see #4124)
+ return parseFloat( alignValue.toFixed(5) );
+ },
+
+ _valueMin: function() {
+ return this.options.min;
+ },
+
+ _valueMax: function() {
+ return this.options.max;
+ },
+
+ _refreshValue: function() {
+ var oRange = this.options.range,
+ o = this.options,
+ self = this,
+ animate = ( !this._animateOff ) ? o.animate : false,
+ valPercent,
+ _set = {},
+ lastValPercent,
+ value,
+ valueMin,
+ valueMax;
+
+ if ( this.options.values && this.options.values.length ) {
+ this.handles.each(function( i, j ) {
+ valPercent = ( self.values(i) - self._valueMin() ) / ( self._valueMax() - self._valueMin() ) * 100;
+ _set[ self.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
+ $( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
+ if ( self.options.range === true ) {
+ if ( self.orientation === "horizontal" ) {
+ if ( i === 0 ) {
+ self.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { left: valPercent + "%" }, o.animate );
+ }
+ if ( i === 1 ) {
+ self.range[ animate ? "animate" : "css" ]( { width: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
+ }
+ } else {
+ if ( i === 0 ) {
+ self.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { bottom: ( valPercent ) + "%" }, o.animate );
+ }
+ if ( i === 1 ) {
+ self.range[ animate ? "animate" : "css" ]( { height: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
+ }
+ }
+ }
+ lastValPercent = valPercent;
+ });
+ } else {
+ value = this.value();
+ valueMin = this._valueMin();
+ valueMax = this._valueMax();
+ valPercent = ( valueMax !== valueMin ) ?
+ ( value - valueMin ) / ( valueMax - valueMin ) * 100 :
+ 0;
+ _set[ self.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
+ this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
+
+ if ( oRange === "min" && this.orientation === "horizontal" ) {
+ this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { width: valPercent + "%" }, o.animate );
+ }
+ if ( oRange === "max" && this.orientation === "horizontal" ) {
+ this.range[ animate ? "animate" : "css" ]( { width: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
+ }
+ if ( oRange === "min" && this.orientation === "vertical" ) {
+ this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { height: valPercent + "%" }, o.animate );
+ }
+ if ( oRange === "max" && this.orientation === "vertical" ) {
+ this.range[ animate ? "animate" : "css" ]( { height: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
+ }
+ }
+ }
+
+});
+
+$.extend( $.ui.slider, {
+ version: "1.8.18"
+});
+
+}(jQuery));
+/*
+ * jQuery UI Tabs 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Tabs
+ *
+ * Depends:
+ * jquery.ui.core.js
+ * jquery.ui.widget.js
+ */
+(function( $, undefined ) {
+
+var tabId = 0,
+ listId = 0;
+
+function getNextTabId() {
+ return ++tabId;
+}
+
+function getNextListId() {
+ return ++listId;
+}
+
+$.widget( "ui.tabs", {
+ options: {
+ add: null,
+ ajaxOptions: null,
+ cache: false,
+ cookie: null, // e.g. { expires: 7, path: '/', domain: 'jquery.com', secure: true }
+ collapsible: false,
+ disable: null,
+ disabled: [],
+ enable: null,
+ event: "click",
+ fx: null, // e.g. { height: 'toggle', opacity: 'toggle', duration: 200 }
+ idPrefix: "ui-tabs-",
+ load: null,
+ panelTemplate: "<div></div>",
+ remove: null,
+ select: null,
+ show: null,
+ spinner: "<em>Loading&#8230;</em>",
+ tabTemplate: "<li><a href='#{href}'><span>#{label}</span></a></li>"
+ },
+
+ _create: function() {
+ this._tabify( true );
+ },
+
+ _setOption: function( key, value ) {
+ if ( key == "selected" ) {
+ if (this.options.collapsible && value == this.options.selected ) {
+ return;
+ }
+ this.select( value );
+ } else {
+ this.options[ key ] = value;
+ this._tabify();
+ }
+ },
+
+ _tabId: function( a ) {
+ return a.title && a.title.replace( /\s/g, "_" ).replace( /[^\w\u00c0-\uFFFF-]/g, "" ) ||
+ this.options.idPrefix + getNextTabId();
+ },
+
+ _sanitizeSelector: function( hash ) {
+ // we need this because an id may contain a ":"
+ return hash.replace( /:/g, "\\:" );
+ },
+
+ _cookie: function() {
+ var cookie = this.cookie ||
+ ( this.cookie = this.options.cookie.name || "ui-tabs-" + getNextListId() );
+ return $.cookie.apply( null, [ cookie ].concat( $.makeArray( arguments ) ) );
+ },
+
+ _ui: function( tab, panel ) {
+ return {
+ tab: tab,
+ panel: panel,
+ index: this.anchors.index( tab )
+ };
+ },
+
+ _cleanup: function() {
+ // restore all former loading tabs labels
+ this.lis.filter( ".ui-state-processing" )
+ .removeClass( "ui-state-processing" )
+ .find( "span:data(label.tabs)" )
+ .each(function() {
+ var el = $( this );
+ el.html( el.data( "label.tabs" ) ).removeData( "label.tabs" );
+ });
+ },
+
+ _tabify: function( init ) {
+ var self = this,
+ o = this.options,
+ fragmentId = /^#.+/; // Safari 2 reports '#' for an empty hash
+
+ this.list = this.element.find( "ol,ul" ).eq( 0 );
+ this.lis = $( " > li:has(a[href])", this.list );
+ this.anchors = this.lis.map(function() {
+ return $( "a", this )[ 0 ];
+ });
+ this.panels = $( [] );
+
+ this.anchors.each(function( i, a ) {
+ var href = $( a ).attr( "href" );
+ // For dynamically created HTML that contains a hash as href IE < 8 expands
+ // such href to the full page url with hash and then misinterprets tab as ajax.
+ // Same consideration applies for an added tab with a fragment identifier
+ // since a[href=#fragment-identifier] does unexpectedly not match.
+ // Thus normalize href attribute...
+ var hrefBase = href.split( "#" )[ 0 ],
+ baseEl;
+ if ( hrefBase && ( hrefBase === location.toString().split( "#" )[ 0 ] ||
+ ( baseEl = $( "base" )[ 0 ]) && hrefBase === baseEl.href ) ) {
+ href = a.hash;
+ a.href = href;
+ }
+
+ // inline tab
+ if ( fragmentId.test( href ) ) {
+ self.panels = self.panels.add( self.element.find( self._sanitizeSelector( href ) ) );
+ // remote tab
+ // prevent loading the page itself if href is just "#"
+ } else if ( href && href !== "#" ) {
+ // required for restore on destroy
+ $.data( a, "href.tabs", href );
+
+ // TODO until #3808 is fixed strip fragment identifier from url
+ // (IE fails to load from such url)
+ $.data( a, "load.tabs", href.replace( /#.*$/, "" ) );
+
+ var id = self._tabId( a );
+ a.href = "#" + id;
+ var $panel = self.element.find( "#" + id );
+ if ( !$panel.length ) {
+ $panel = $( o.panelTemplate )
+ .attr( "id", id )
+ .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" )
+ .insertAfter( self.panels[ i - 1 ] || self.list );
+ $panel.data( "destroy.tabs", true );
+ }
+ self.panels = self.panels.add( $panel );
+ // invalid tab href
+ } else {
+ o.disabled.push( i );
+ }
+ });
+
+ // initialization from scratch
+ if ( init ) {
+ // attach necessary classes for styling
+ this.element.addClass( "ui-tabs ui-widget ui-widget-content ui-corner-all" );
+ this.list.addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" );
+ this.lis.addClass( "ui-state-default ui-corner-top" );
+ this.panels.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" );
+
+ // Selected tab
+ // use "selected" option or try to retrieve:
+ // 1. from fragment identifier in url
+ // 2. from cookie
+ // 3. from selected class attribute on <li>
+ if ( o.selected === undefined ) {
+ if ( location.hash ) {
+ this.anchors.each(function( i, a ) {
+ if ( a.hash == location.hash ) {
+ o.selected = i;
+ return false;
+ }
+ });
+ }
+ if ( typeof o.selected !== "number" && o.cookie ) {
+ o.selected = parseInt( self._cookie(), 10 );
+ }
+ if ( typeof o.selected !== "number" && this.lis.filter( ".ui-tabs-selected" ).length ) {
+ o.selected = this.lis.index( this.lis.filter( ".ui-tabs-selected" ) );
+ }
+ o.selected = o.selected || ( this.lis.length ? 0 : -1 );
+ } else if ( o.selected === null ) { // usage of null is deprecated, TODO remove in next release
+ o.selected = -1;
+ }
+
+ // sanity check - default to first tab...
+ o.selected = ( ( o.selected >= 0 && this.anchors[ o.selected ] ) || o.selected < 0 )
+ ? o.selected
+ : 0;
+
+ // Take disabling tabs via class attribute from HTML
+ // into account and update option properly.
+ // A selected tab cannot become disabled.
+ o.disabled = $.unique( o.disabled.concat(
+ $.map( this.lis.filter( ".ui-state-disabled" ), function( n, i ) {
+ return self.lis.index( n );
+ })
+ ) ).sort();
+
+ if ( $.inArray( o.selected, o.disabled ) != -1 ) {
+ o.disabled.splice( $.inArray( o.selected, o.disabled ), 1 );
+ }
+
+ // highlight selected tab
+ this.panels.addClass( "ui-tabs-hide" );
+ this.lis.removeClass( "ui-tabs-selected ui-state-active" );
+ // check for length avoids error when initializing empty list
+ if ( o.selected >= 0 && this.anchors.length ) {
+ self.element.find( self._sanitizeSelector( self.anchors[ o.selected ].hash ) ).removeClass( "ui-tabs-hide" );
+ this.lis.eq( o.selected ).addClass( "ui-tabs-selected ui-state-active" );
+
+ // seems to be expected behavior that the show callback is fired
+ self.element.queue( "tabs", function() {
+ self._trigger( "show", null,
+ self._ui( self.anchors[ o.selected ], self.element.find( self._sanitizeSelector( self.anchors[ o.selected ].hash ) )[ 0 ] ) );
+ });
+
+ this.load( o.selected );
+ }
+
+ // clean up to avoid memory leaks in certain versions of IE 6
+ // TODO: namespace this event
+ $( window ).bind( "unload", function() {
+ self.lis.add( self.anchors ).unbind( ".tabs" );
+ self.lis = self.anchors = self.panels = null;
+ });
+ // update selected after add/remove
+ } else {
+ o.selected = this.lis.index( this.lis.filter( ".ui-tabs-selected" ) );
+ }
+
+ // update collapsible
+ // TODO: use .toggleClass()
+ this.element[ o.collapsible ? "addClass" : "removeClass" ]( "ui-tabs-collapsible" );
+
+ // set or update cookie after init and add/remove respectively
+ if ( o.cookie ) {
+ this._cookie( o.selected, o.cookie );
+ }
+
+ // disable tabs
+ for ( var i = 0, li; ( li = this.lis[ i ] ); i++ ) {
+ $( li )[ $.inArray( i, o.disabled ) != -1 &&
+ // TODO: use .toggleClass()
+ !$( li ).hasClass( "ui-tabs-selected" ) ? "addClass" : "removeClass" ]( "ui-state-disabled" );
+ }
+
+ // reset cache if switching from cached to not cached
+ if ( o.cache === false ) {
+ this.anchors.removeData( "cache.tabs" );
+ }
+
+ // remove all handlers before, tabify may run on existing tabs after add or option change
+ this.lis.add( this.anchors ).unbind( ".tabs" );
+
+ if ( o.event !== "mouseover" ) {
+ var addState = function( state, el ) {
+ if ( el.is( ":not(.ui-state-disabled)" ) ) {
+ el.addClass( "ui-state-" + state );
+ }
+ };
+ var removeState = function( state, el ) {
+ el.removeClass( "ui-state-" + state );
+ };
+ this.lis.bind( "mouseover.tabs" , function() {
+ addState( "hover", $( this ) );
+ });
+ this.lis.bind( "mouseout.tabs", function() {
+ removeState( "hover", $( this ) );
+ });
+ this.anchors.bind( "focus.tabs", function() {
+ addState( "focus", $( this ).closest( "li" ) );
+ });
+ this.anchors.bind( "blur.tabs", function() {
+ removeState( "focus", $( this ).closest( "li" ) );
+ });
+ }
+
+ // set up animations
+ var hideFx, showFx;
+ if ( o.fx ) {
+ if ( $.isArray( o.fx ) ) {
+ hideFx = o.fx[ 0 ];
+ showFx = o.fx[ 1 ];
+ } else {
+ hideFx = showFx = o.fx;
+ }
+ }
+
+ // Reset certain styles left over from animation
+ // and prevent IE's ClearType bug...
+ function resetStyle( $el, fx ) {
+ $el.css( "display", "" );
+ if ( !$.support.opacity && fx.opacity ) {
+ $el[ 0 ].style.removeAttribute( "filter" );
+ }
+ }
+
+ // Show a tab...
+ var showTab = showFx
+ ? function( clicked, $show ) {
+ $( clicked ).closest( "li" ).addClass( "ui-tabs-selected ui-state-active" );
+ $show.hide().removeClass( "ui-tabs-hide" ) // avoid flicker that way
+ .animate( showFx, showFx.duration || "normal", function() {
+ resetStyle( $show, showFx );
+ self._trigger( "show", null, self._ui( clicked, $show[ 0 ] ) );
+ });
+ }
+ : function( clicked, $show ) {
+ $( clicked ).closest( "li" ).addClass( "ui-tabs-selected ui-state-active" );
+ $show.removeClass( "ui-tabs-hide" );
+ self._trigger( "show", null, self._ui( clicked, $show[ 0 ] ) );
+ };
+
+ // Hide a tab, $show is optional...
+ var hideTab = hideFx
+ ? function( clicked, $hide ) {
+ $hide.animate( hideFx, hideFx.duration || "normal", function() {
+ self.lis.removeClass( "ui-tabs-selected ui-state-active" );
+ $hide.addClass( "ui-tabs-hide" );
+ resetStyle( $hide, hideFx );
+ self.element.dequeue( "tabs" );
+ });
+ }
+ : function( clicked, $hide, $show ) {
+ self.lis.removeClass( "ui-tabs-selected ui-state-active" );
+ $hide.addClass( "ui-tabs-hide" );
+ self.element.dequeue( "tabs" );
+ };
+
+ // attach tab event handler, unbind to avoid duplicates from former tabifying...
+ this.anchors.bind( o.event + ".tabs", function() {
+ var el = this,
+ $li = $(el).closest( "li" ),
+ $hide = self.panels.filter( ":not(.ui-tabs-hide)" ),
+ $show = self.element.find( self._sanitizeSelector( el.hash ) );
+
+ // If tab is already selected and not collapsible or tab disabled or
+ // or is already loading or click callback returns false stop here.
+ // Check if click handler returns false last so that it is not executed
+ // for a disabled or loading tab!
+ if ( ( $li.hasClass( "ui-tabs-selected" ) && !o.collapsible) ||
+ $li.hasClass( "ui-state-disabled" ) ||
+ $li.hasClass( "ui-state-processing" ) ||
+ self.panels.filter( ":animated" ).length ||
+ self._trigger( "select", null, self._ui( this, $show[ 0 ] ) ) === false ) {
+ this.blur();
+ return false;
+ }
+
+ o.selected = self.anchors.index( this );
+
+ self.abort();
+
+ // if tab may be closed
+ if ( o.collapsible ) {
+ if ( $li.hasClass( "ui-tabs-selected" ) ) {
+ o.selected = -1;
+
+ if ( o.cookie ) {
+ self._cookie( o.selected, o.cookie );
+ }
+
+ self.element.queue( "tabs", function() {
+ hideTab( el, $hide );
+ }).dequeue( "tabs" );
+
+ this.blur();
+ return false;
+ } else if ( !$hide.length ) {
+ if ( o.cookie ) {
+ self._cookie( o.selected, o.cookie );
+ }
+
+ self.element.queue( "tabs", function() {
+ showTab( el, $show );
+ });
+
+ // TODO make passing in node possible, see also http://dev.jqueryui.com/ticket/3171
+ self.load( self.anchors.index( this ) );
+
+ this.blur();
+ return false;
+ }
+ }
+
+ if ( o.cookie ) {
+ self._cookie( o.selected, o.cookie );
+ }
+
+ // show new tab
+ if ( $show.length ) {
+ if ( $hide.length ) {
+ self.element.queue( "tabs", function() {
+ hideTab( el, $hide );
+ });
+ }
+ self.element.queue( "tabs", function() {
+ showTab( el, $show );
+ });
+
+ self.load( self.anchors.index( this ) );
+ } else {
+ throw "jQuery UI Tabs: Mismatching fragment identifier.";
+ }
+
+ // Prevent IE from keeping other link focussed when using the back button
+ // and remove dotted border from clicked link. This is controlled via CSS
+ // in modern browsers; blur() removes focus from address bar in Firefox
+ // which can become a usability and annoying problem with tabs('rotate').
+ if ( $.browser.msie ) {
+ this.blur();
+ }
+ });
+
+ // disable click in any case
+ this.anchors.bind( "click.tabs", function(){
+ return false;
+ });
+ },
+
+ _getIndex: function( index ) {
+ // meta-function to give users option to provide a href string instead of a numerical index.
+ // also sanitizes numerical indexes to valid values.
+ if ( typeof index == "string" ) {
+ index = this.anchors.index( this.anchors.filter( "[href$=" + index + "]" ) );
+ }
+
+ return index;
+ },
+
+ destroy: function() {
+ var o = this.options;
+
+ this.abort();
+
+ this.element
+ .unbind( ".tabs" )
+ .removeClass( "ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible" )
+ .removeData( "tabs" );
+
+ this.list.removeClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" );
+
+ this.anchors.each(function() {
+ var href = $.data( this, "href.tabs" );
+ if ( href ) {
+ this.href = href;
+ }
+ var $this = $( this ).unbind( ".tabs" );
+ $.each( [ "href", "load", "cache" ], function( i, prefix ) {
+ $this.removeData( prefix + ".tabs" );
+ });
+ });
+
+ this.lis.unbind( ".tabs" ).add( this.panels ).each(function() {
+ if ( $.data( this, "destroy.tabs" ) ) {
+ $( this ).remove();
+ } else {
+ $( this ).removeClass([
+ "ui-state-default",
+ "ui-corner-top",
+ "ui-tabs-selected",
+ "ui-state-active",
+ "ui-state-hover",
+ "ui-state-focus",
+ "ui-state-disabled",
+ "ui-tabs-panel",
+ "ui-widget-content",
+ "ui-corner-bottom",
+ "ui-tabs-hide"
+ ].join( " " ) );
+ }
+ });
+
+ if ( o.cookie ) {
+ this._cookie( null, o.cookie );
+ }
+
+ return this;
+ },
+
+ add: function( url, label, index ) {
+ if ( index === undefined ) {
+ index = this.anchors.length;
+ }
+
+ var self = this,
+ o = this.options,
+ $li = $( o.tabTemplate.replace( /#\{href\}/g, url ).replace( /#\{label\}/g, label ) ),
+ id = !url.indexOf( "#" ) ? url.replace( "#", "" ) : this._tabId( $( "a", $li )[ 0 ] );
+
+ $li.addClass( "ui-state-default ui-corner-top" ).data( "destroy.tabs", true );
+
+ // try to find an existing element before creating a new one
+ var $panel = self.element.find( "#" + id );
+ if ( !$panel.length ) {
+ $panel = $( o.panelTemplate )
+ .attr( "id", id )
+ .data( "destroy.tabs", true );
+ }
+ $panel.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide" );
+
+ if ( index >= this.lis.length ) {
+ $li.appendTo( this.list );
+ $panel.appendTo( this.list[ 0 ].parentNode );
+ } else {
+ $li.insertBefore( this.lis[ index ] );
+ $panel.insertBefore( this.panels[ index ] );
+ }
+
+ o.disabled = $.map( o.disabled, function( n, i ) {
+ return n >= index ? ++n : n;
+ });
+
+ this._tabify();
+
+ if ( this.anchors.length == 1 ) {
+ o.selected = 0;
+ $li.addClass( "ui-tabs-selected ui-state-active" );
+ $panel.removeClass( "ui-tabs-hide" );
+ this.element.queue( "tabs", function() {
+ self._trigger( "show", null, self._ui( self.anchors[ 0 ], self.panels[ 0 ] ) );
+ });
+
+ this.load( 0 );
+ }
+
+ this._trigger( "add", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
+ return this;
+ },
+
+ remove: function( index ) {
+ index = this._getIndex( index );
+ var o = this.options,
+ $li = this.lis.eq( index ).remove(),
+ $panel = this.panels.eq( index ).remove();
+
+ // If selected tab was removed focus tab to the right or
+ // in case the last tab was removed the tab to the left.
+ if ( $li.hasClass( "ui-tabs-selected" ) && this.anchors.length > 1) {
+ this.select( index + ( index + 1 < this.anchors.length ? 1 : -1 ) );
+ }
+
+ o.disabled = $.map(
+ $.grep( o.disabled, function(n, i) {
+ return n != index;
+ }),
+ function( n, i ) {
+ return n >= index ? --n : n;
+ });
+
+ this._tabify();
+
+ this._trigger( "remove", null, this._ui( $li.find( "a" )[ 0 ], $panel[ 0 ] ) );
+ return this;
+ },
+
+ enable: function( index ) {
+ index = this._getIndex( index );
+ var o = this.options;
+ if ( $.inArray( index, o.disabled ) == -1 ) {
+ return;
+ }
+
+ this.lis.eq( index ).removeClass( "ui-state-disabled" );
+ o.disabled = $.grep( o.disabled, function( n, i ) {
+ return n != index;
+ });
+
+ this._trigger( "enable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
+ return this;
+ },
+
+ disable: function( index ) {
+ index = this._getIndex( index );
+ var self = this, o = this.options;
+ // cannot disable already selected tab
+ if ( index != o.selected ) {
+ this.lis.eq( index ).addClass( "ui-state-disabled" );
+
+ o.disabled.push( index );
+ o.disabled.sort();
+
+ this._trigger( "disable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
+ }
+
+ return this;
+ },
+
+ select: function( index ) {
+ index = this._getIndex( index );
+ if ( index == -1 ) {
+ if ( this.options.collapsible && this.options.selected != -1 ) {
+ index = this.options.selected;
+ } else {
+ return this;
+ }
+ }
+ this.anchors.eq( index ).trigger( this.options.event + ".tabs" );
+ return this;
+ },
+
+ load: function( index ) {
+ index = this._getIndex( index );
+ var self = this,
+ o = this.options,
+ a = this.anchors.eq( index )[ 0 ],
+ url = $.data( a, "load.tabs" );
+
+ this.abort();
+
+ // not remote or from cache
+ if ( !url || this.element.queue( "tabs" ).length !== 0 && $.data( a, "cache.tabs" ) ) {
+ this.element.dequeue( "tabs" );
+ return;
+ }
+
+ // load remote from here on
+ this.lis.eq( index ).addClass( "ui-state-processing" );
+
+ if ( o.spinner ) {
+ var span = $( "span", a );
+ span.data( "label.tabs", span.html() ).html( o.spinner );
+ }
+
+ this.xhr = $.ajax( $.extend( {}, o.ajaxOptions, {
+ url: url,
+ success: function( r, s ) {
+ self.element.find( self._sanitizeSelector( a.hash ) ).html( r );
+
+ // take care of tab labels
+ self._cleanup();
+
+ if ( o.cache ) {
+ $.data( a, "cache.tabs", true );
+ }
+
+ self._trigger( "load", null, self._ui( self.anchors[ index ], self.panels[ index ] ) );
+ try {
+ o.ajaxOptions.success( r, s );
+ }
+ catch ( e ) {}
+ },
+ error: function( xhr, s, e ) {
+ // take care of tab labels
+ self._cleanup();
+
+ self._trigger( "load", null, self._ui( self.anchors[ index ], self.panels[ index ] ) );
+ try {
+ // Passing index avoid a race condition when this method is
+ // called after the user has selected another tab.
+ // Pass the anchor that initiated this request allows
+ // loadError to manipulate the tab content panel via $(a.hash)
+ o.ajaxOptions.error( xhr, s, index, a );
+ }
+ catch ( e ) {}
+ }
+ } ) );
+
+ // last, so that load event is fired before show...
+ self.element.dequeue( "tabs" );
+
+ return this;
+ },
+
+ abort: function() {
+ // stop possibly running animations
+ this.element.queue( [] );
+ this.panels.stop( false, true );
+
+ // "tabs" queue must not contain more than two elements,
+ // which are the callbacks for the latest clicked tab...
+ this.element.queue( "tabs", this.element.queue( "tabs" ).splice( -2, 2 ) );
+
+ // terminate pending requests from other tabs
+ if ( this.xhr ) {
+ this.xhr.abort();
+ delete this.xhr;
+ }
+
+ // take care of tab labels
+ this._cleanup();
+ return this;
+ },
+
+ url: function( index, url ) {
+ this.anchors.eq( index ).removeData( "cache.tabs" ).data( "load.tabs", url );
+ return this;
+ },
+
+ length: function() {
+ return this.anchors.length;
+ }
+});
+
+$.extend( $.ui.tabs, {
+ version: "1.8.18"
+});
+
+/*
+ * Tabs Extensions
+ */
+
+/*
+ * Rotate
+ */
+$.extend( $.ui.tabs.prototype, {
+ rotation: null,
+ rotate: function( ms, continuing ) {
+ var self = this,
+ o = this.options;
+
+ var rotate = self._rotate || ( self._rotate = function( e ) {
+ clearTimeout( self.rotation );
+ self.rotation = setTimeout(function() {
+ var t = o.selected;
+ self.select( ++t < self.anchors.length ? t : 0 );
+ }, ms );
+
+ if ( e ) {
+ e.stopPropagation();
+ }
+ });
+
+ var stop = self._unrotate || ( self._unrotate = !continuing
+ ? function(e) {
+ if (e.clientX) { // in case of a true click
+ self.rotate(null);
+ }
+ }
+ : function( e ) {
+ t = o.selected;
+ rotate();
+ });
+
+ // start rotation
+ if ( ms ) {
+ this.element.bind( "tabsshow", rotate );
+ this.anchors.bind( o.event + ".tabs", stop );
+ rotate();
+ // stop rotation
+ } else {
+ clearTimeout( self.rotation );
+ this.element.unbind( "tabsshow", rotate );
+ this.anchors.unbind( o.event + ".tabs", stop );
+ delete this._rotate;
+ delete this._unrotate;
+ }
+
+ return this;
+ }
+});
+
+})( jQuery );
diff --git a/storage/mroonga/vendor/groonga/examples/dictionary/html/js/jquery-ui-1.8.18.custom.min.js b/storage/mroonga/vendor/groonga/examples/dictionary/html/js/jquery-ui-1.8.18.custom.min.js
new file mode 100644
index 00000000000..f00a62f133f
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/examples/dictionary/html/js/jquery-ui-1.8.18.custom.min.js
@@ -0,0 +1,356 @@
+/*!
+ * jQuery UI 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI
+ */(function(a,b){function d(b){return!a(b).parents().andSelf().filter(function(){return a.curCSS(this,"visibility")==="hidden"||a.expr.filters.hidden(this)}).length}function c(b,c){var e=b.nodeName.toLowerCase();if("area"===e){var f=b.parentNode,g=f.name,h;if(!b.href||!g||f.nodeName.toLowerCase()!=="map")return!1;h=a("img[usemap=#"+g+"]")[0];return!!h&&d(h)}return(/input|select|textarea|button|object/.test(e)?!b.disabled:"a"==e?b.href||c:c)&&d(b)}a.ui=a.ui||{};a.ui.version||(a.extend(a.ui,{version:"1.8.18",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}}),a.fn.extend({propAttr:a.fn.prop||a.fn.attr,_focus:a.fn.focus,focus:function(b,c){return typeof b=="number"?this.each(function(){var d=this;setTimeout(function(){a(d).focus(),c&&c.call(d)},b)}):this._focus.apply(this,arguments)},scrollParent:function(){var b;a.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?b=this.parents().filter(function(){return/(relative|absolute|fixed)/.test(a.curCSS(this,"position",1))&&/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0):b=this.parents().filter(function(){return/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!b.length?a(document):b},zIndex:function(c){if(c!==b)return this.css("zIndex",c);if(this.length){var d=a(this[0]),e,f;while(d.length&&d[0]!==document){e=d.css("position");if(e==="absolute"||e==="relative"||e==="fixed"){f=parseInt(d.css("zIndex"),10);if(!isNaN(f)&&f!==0)return f}d=d.parent()}}return 0},disableSelection:function(){return this.bind((a.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),a.each(["Width","Height"],function(c,d){function h(b,c,d,f){a.each(e,function(){c-=parseFloat(a.curCSS(b,"padding"+this,!0))||0,d&&(c-=parseFloat(a.curCSS(b,"border"+this+"Width",!0))||0),f&&(c-=parseFloat(a.curCSS(b,"margin"+this,!0))||0)});return c}var e=d==="Width"?["Left","Right"]:["Top","Bottom"],f=d.toLowerCase(),g={innerWidth:a.fn.innerWidth,innerHeight:a.fn.innerHeight,outerWidth:a.fn.outerWidth,outerHeight:a.fn.outerHeight};a.fn["inner"+d]=function(c){if(c===b)return g["inner"+d].call(this);return this.each(function(){a(this).css(f,h(this,c)+"px")})},a.fn["outer"+d]=function(b,c){if(typeof b!="number")return g["outer"+d].call(this,b);return this.each(function(){a(this).css(f,h(this,b,!0,c)+"px")})}}),a.extend(a.expr[":"],{data:function(b,c,d){return!!a.data(b,d[3])},focusable:function(b){return c(b,!isNaN(a.attr(b,"tabindex")))},tabbable:function(b){var d=a.attr(b,"tabindex"),e=isNaN(d);return(e||d>=0)&&c(b,!e)}}),a(function(){var b=document.body,c=b.appendChild(c=document.createElement("div"));c.offsetHeight,a.extend(c.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0}),a.support.minHeight=c.offsetHeight===100,a.support.selectstart="onselectstart"in c,b.removeChild(c).style.display="none"}),a.extend(a.ui,{plugin:{add:function(b,c,d){var e=a.ui[b].prototype;for(var f in d)e.plugins[f]=e.plugins[f]||[],e.plugins[f].push([c,d[f]])},call:function(a,b,c){var d=a.plugins[b];if(!!d&&!!a.element[0].parentNode)for(var e=0;e<d.length;e++)a.options[d[e][0]]&&d[e][1].apply(a.element,c)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(b,c){if(a(b).css("overflow")==="hidden")return!1;var d=c&&c==="left"?"scrollLeft":"scrollTop",e=!1;if(b[d]>0)return!0;b[d]=1,e=b[d]>0,b[d]=0;return e},isOverAxis:function(a,b,c){return a>b&&a<b+c},isOver:function(b,c,d,e,f,g){return a.ui.isOverAxis(b,d,f)&&a.ui.isOverAxis(c,e,g)}}))})(jQuery);/*!
+ * jQuery UI Widget 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Widget
+ */(function(a,b){if(a.cleanData){var c=a.cleanData;a.cleanData=function(b){for(var d=0,e;(e=b[d])!=null;d++)try{a(e).triggerHandler("remove")}catch(f){}c(b)}}else{var d=a.fn.remove;a.fn.remove=function(b,c){return this.each(function(){c||(!b||a.filter(b,[this]).length)&&a("*",this).add([this]).each(function(){try{a(this).triggerHandler("remove")}catch(b){}});return d.call(a(this),b,c)})}}a.widget=function(b,c,d){var e=b.split(".")[0],f;b=b.split(".")[1],f=e+"-"+b,d||(d=c,c=a.Widget),a.expr[":"][f]=function(c){return!!a.data(c,b)},a[e]=a[e]||{},a[e][b]=function(a,b){arguments.length&&this._createWidget(a,b)};var g=new c;g.options=a.extend(!0,{},g.options),a[e][b].prototype=a.extend(!0,g,{namespace:e,widgetName:b,widgetEventPrefix:a[e][b].prototype.widgetEventPrefix||b,widgetBaseClass:f},d),a.widget.bridge(b,a[e][b])},a.widget.bridge=function(c,d){a.fn[c]=function(e){var f=typeof e=="string",g=Array.prototype.slice.call(arguments,1),h=this;e=!f&&g.length?a.extend.apply(null,[!0,e].concat(g)):e;if(f&&e.charAt(0)==="_")return h;f?this.each(function(){var d=a.data(this,c),f=d&&a.isFunction(d[e])?d[e].apply(d,g):d;if(f!==d&&f!==b){h=f;return!1}}):this.each(function(){var b=a.data(this,c);b?b.option(e||{})._init():a.data(this,c,new d(e,this))});return h}},a.Widget=function(a,b){arguments.length&&this._createWidget(a,b)},a.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:!1},_createWidget:function(b,c){a.data(c,this.widgetName,this),this.element=a(c),this.options=a.extend(!0,{},this.options,this._getCreateOptions(),b);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()}),this._create(),this._trigger("create"),this._init()},_getCreateOptions:function(){return a.metadata&&a.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName),this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled "+"ui-state-disabled")},widget:function(){return this.element},option:function(c,d){var e=c;if(arguments.length===0)return a.extend({},this.options);if(typeof c=="string"){if(d===b)return this.options[c];e={},e[c]=d}this._setOptions(e);return this},_setOptions:function(b){var c=this;a.each(b,function(a,b){c._setOption(a,b)});return this},_setOption:function(a,b){this.options[a]=b,a==="disabled"&&this.widget()[b?"addClass":"removeClass"](this.widgetBaseClass+"-disabled"+" "+"ui-state-disabled").attr("aria-disabled",b);return this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_trigger:function(b,c,d){var e,f,g=this.options[b];d=d||{},c=a.Event(c),c.type=(b===this.widgetEventPrefix?b:this.widgetEventPrefix+b).toLowerCase(),c.target=this.element[0],f=c.originalEvent;if(f)for(e in f)e in c||(c[e]=f[e]);this.element.trigger(c,d);return!(a.isFunction(g)&&g.call(this.element[0],c,d)===!1||c.isDefaultPrevented())}}})(jQuery);/*!
+ * jQuery UI Mouse 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Mouse
+ *
+ * Depends:
+ * jquery.ui.widget.js
+ */(function(a,b){var c=!1;a(document).mouseup(function(a){c=!1}),a.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var b=this;this.element.bind("mousedown."+this.widgetName,function(a){return b._mouseDown(a)}).bind("click."+this.widgetName,function(c){if(!0===a.data(c.target,b.widgetName+".preventClickEvent")){a.removeData(c.target,b.widgetName+".preventClickEvent"),c.stopImmediatePropagation();return!1}}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName)},_mouseDown:function(b){if(!c){this._mouseStarted&&this._mouseUp(b),this._mouseDownEvent=b;var d=this,e=b.which==1,f=typeof this.options.cancel=="string"&&b.target.nodeName?a(b.target).closest(this.options.cancel).length:!1;if(!e||f||!this._mouseCapture(b))return!0;this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){d.mouseDelayMet=!0},this.options.delay));if(this._mouseDistanceMet(b)&&this._mouseDelayMet(b)){this._mouseStarted=this._mouseStart(b)!==!1;if(!this._mouseStarted){b.preventDefault();return!0}}!0===a.data(b.target,this.widgetName+".preventClickEvent")&&a.removeData(b.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(a){return d._mouseMove(a)},this._mouseUpDelegate=function(a){return d._mouseUp(a)},a(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),b.preventDefault(),c=!0;return!0}},_mouseMove:function(b){if(a.browser.msie&&!(document.documentMode>=9)&&!b.button)return this._mouseUp(b);if(this._mouseStarted){this._mouseDrag(b);return b.preventDefault()}this._mouseDistanceMet(b)&&this._mouseDelayMet(b)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,b)!==!1,this._mouseStarted?this._mouseDrag(b):this._mouseUp(b));return!this._mouseStarted},_mouseUp:function(b){a(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,b.target==this._mouseDownEvent.target&&a.data(b.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(b));return!1},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(a){return this.mouseDelayMet},_mouseStart:function(a){},_mouseDrag:function(a){},_mouseStop:function(a){},_mouseCapture:function(a){return!0}})})(jQuery);/*
+ * jQuery UI Position 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Position
+ */(function(a,b){a.ui=a.ui||{};var c=/left|center|right/,d=/top|center|bottom/,e="center",f={},g=a.fn.position,h=a.fn.offset;a.fn.position=function(b){if(!b||!b.of)return g.apply(this,arguments);b=a.extend({},b);var h=a(b.of),i=h[0],j=(b.collision||"flip").split(" "),k=b.offset?b.offset.split(" "):[0,0],l,m,n;i.nodeType===9?(l=h.width(),m=h.height(),n={top:0,left:0}):i.setTimeout?(l=h.width(),m=h.height(),n={top:h.scrollTop(),left:h.scrollLeft()}):i.preventDefault?(b.at="left top",l=m=0,n={top:b.of.pageY,left:b.of.pageX}):(l=h.outerWidth(),m=h.outerHeight(),n=h.offset()),a.each(["my","at"],function(){var a=(b[this]||"").split(" ");a.length===1&&(a=c.test(a[0])?a.concat([e]):d.test(a[0])?[e].concat(a):[e,e]),a[0]=c.test(a[0])?a[0]:e,a[1]=d.test(a[1])?a[1]:e,b[this]=a}),j.length===1&&(j[1]=j[0]),k[0]=parseInt(k[0],10)||0,k.length===1&&(k[1]=k[0]),k[1]=parseInt(k[1],10)||0,b.at[0]==="right"?n.left+=l:b.at[0]===e&&(n.left+=l/2),b.at[1]==="bottom"?n.top+=m:b.at[1]===e&&(n.top+=m/2),n.left+=k[0],n.top+=k[1];return this.each(function(){var c=a(this),d=c.outerWidth(),g=c.outerHeight(),h=parseInt(a.curCSS(this,"marginLeft",!0))||0,i=parseInt(a.curCSS(this,"marginTop",!0))||0,o=d+h+(parseInt(a.curCSS(this,"marginRight",!0))||0),p=g+i+(parseInt(a.curCSS(this,"marginBottom",!0))||0),q=a.extend({},n),r;b.my[0]==="right"?q.left-=d:b.my[0]===e&&(q.left-=d/2),b.my[1]==="bottom"?q.top-=g:b.my[1]===e&&(q.top-=g/2),f.fractions||(q.left=Math.round(q.left),q.top=Math.round(q.top)),r={left:q.left-h,top:q.top-i},a.each(["left","top"],function(c,e){a.ui.position[j[c]]&&a.ui.position[j[c]][e](q,{targetWidth:l,targetHeight:m,elemWidth:d,elemHeight:g,collisionPosition:r,collisionWidth:o,collisionHeight:p,offset:k,my:b.my,at:b.at})}),a.fn.bgiframe&&c.bgiframe(),c.offset(a.extend(q,{using:b.using}))})},a.ui.position={fit:{left:function(b,c){var d=a(window),e=c.collisionPosition.left+c.collisionWidth-d.width()-d.scrollLeft();b.left=e>0?b.left-e:Math.max(b.left-c.collisionPosition.left,b.left)},top:function(b,c){var d=a(window),e=c.collisionPosition.top+c.collisionHeight-d.height()-d.scrollTop();b.top=e>0?b.top-e:Math.max(b.top-c.collisionPosition.top,b.top)}},flip:{left:function(b,c){if(c.at[0]!==e){var d=a(window),f=c.collisionPosition.left+c.collisionWidth-d.width()-d.scrollLeft(),g=c.my[0]==="left"?-c.elemWidth:c.my[0]==="right"?c.elemWidth:0,h=c.at[0]==="left"?c.targetWidth:-c.targetWidth,i=-2*c.offset[0];b.left+=c.collisionPosition.left<0?g+h+i:f>0?g+h+i:0}},top:function(b,c){if(c.at[1]!==e){var d=a(window),f=c.collisionPosition.top+c.collisionHeight-d.height()-d.scrollTop(),g=c.my[1]==="top"?-c.elemHeight:c.my[1]==="bottom"?c.elemHeight:0,h=c.at[1]==="top"?c.targetHeight:-c.targetHeight,i=-2*c.offset[1];b.top+=c.collisionPosition.top<0?g+h+i:f>0?g+h+i:0}}}},a.offset.setOffset||(a.offset.setOffset=function(b,c){/static/.test(a.curCSS(b,"position"))&&(b.style.position="relative");var d=a(b),e=d.offset(),f=parseInt(a.curCSS(b,"top",!0),10)||0,g=parseInt(a.curCSS(b,"left",!0),10)||0,h={top:c.top-e.top+f,left:c.left-e.left+g};"using"in c?c.using.call(b,h):d.css(h)},a.fn.offset=function(b){var c=this[0];if(!c||!c.ownerDocument)return null;if(b)return this.each(function(){a.offset.setOffset(this,b)});return h.call(this)}),function(){var b=document.getElementsByTagName("body")[0],c=document.createElement("div"),d,e,g,h,i;d=document.createElement(b?"div":"body"),g={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},b&&a.extend(g,{position:"absolute",left:"-1000px",top:"-1000px"});for(var j in g)d.style[j]=g[j];d.appendChild(c),e=b||document.documentElement,e.insertBefore(d,e.firstChild),c.style.cssText="position: absolute; left: 10.7432222px; top: 10.432325px; height: 30px; width: 201px;",h=a(c).offset(function(a,b){return b}).offset(),d.innerHTML="",e.removeChild(d),i=h.top+h.left+(b?2e3:0),f.fractions=i>21&&i<22}()})(jQuery);/*
+ * jQuery UI Draggable 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Draggables
+ *
+ * Depends:
+ * jquery.ui.core.js
+ * jquery.ui.mouse.js
+ * jquery.ui.widget.js
+ */(function(a,b){a.widget("ui.draggable",a.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1},_create:function(){this.options.helper=="original"&&!/^(?:r|a|f)/.test(this.element.css("position"))&&(this.element[0].style.position="relative"),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._mouseInit()},destroy:function(){if(!!this.element.data("draggable")){this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._mouseDestroy();return this}},_mouseCapture:function(b){var c=this.options;if(this.helper||c.disabled||a(b.target).is(".ui-resizable-handle"))return!1;this.handle=this._getHandle(b);if(!this.handle)return!1;c.iframeFix&&a(c.iframeFix===!0?"iframe":c.iframeFix).each(function(){a('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1e3}).css(a(this).offset()).appendTo("body")});return!0},_mouseStart:function(b){var c=this.options;this.helper=this._createHelper(b),this._cacheHelperProportions(),a.ui.ddmanager&&(a.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(),this.offset=this.positionAbs=this.element.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},a.extend(this.offset,{click:{left:b.pageX-this.offset.left,top:b.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.originalPosition=this.position=this._generatePosition(b),this.originalPageX=b.pageX,this.originalPageY=b.pageY,c.cursorAt&&this._adjustOffsetFromHelper(c.cursorAt),c.containment&&this._setContainment();if(this._trigger("start",b)===!1){this._clear();return!1}this._cacheHelperProportions(),a.ui.ddmanager&&!c.dropBehaviour&&a.ui.ddmanager.prepareOffsets(this,b),this.helper.addClass("ui-draggable-dragging"),this._mouseDrag(b,!0),a.ui.ddmanager&&a.ui.ddmanager.dragStart(this,b);return!0},_mouseDrag:function(b,c){this.position=this._generatePosition(b),this.positionAbs=this._convertPositionTo("absolute");if(!c){var d=this._uiHash();if(this._trigger("drag",b,d)===!1){this._mouseUp({});return!1}this.position=d.position}if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";a.ui.ddmanager&&a.ui.ddmanager.drag(this,b);return!1},_mouseStop:function(b){var c=!1;a.ui.ddmanager&&!this.options.dropBehaviour&&(c=a.ui.ddmanager.drop(this,b)),this.dropped&&(c=this.dropped,this.dropped=!1);if((!this.element[0]||!this.element[0].parentNode)&&this.options.helper=="original")return!1;if(this.options.revert=="invalid"&&!c||this.options.revert=="valid"&&c||this.options.revert===!0||a.isFunction(this.options.revert)&&this.options.revert.call(this.element,c)){var d=this;a(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){d._trigger("stop",b)!==!1&&d._clear()})}else this._trigger("stop",b)!==!1&&this._clear();return!1},_mouseUp:function(b){this.options.iframeFix===!0&&a("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)}),a.ui.ddmanager&&a.ui.ddmanager.dragStop(this,b);return a.ui.mouse.prototype._mouseUp.call(this,b)},cancel:function(){this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear();return this},_getHandle:function(b){var c=!this.options.handle||!a(this.options.handle,this.element).length?!0:!1;a(this.options.handle,this.element).find("*").andSelf().each(function(){this==b.target&&(c=!0)});return c},_createHelper:function(b){var c=this.options,d=a.isFunction(c.helper)?a(c.helper.apply(this.element[0],[b])):c.helper=="clone"?this.element.clone().removeAttr("id"):this.element;d.parents("body").length||d.appendTo(c.appendTo=="parent"?this.element[0].parentNode:c.appendTo),d[0]!=this.element[0]&&!/(fixed|absolute)/.test(d.css("position"))&&d.css("position","absolute");return d},_adjustOffsetFromHelper:function(b){typeof b=="string"&&(b=b.split(" ")),a.isArray(b)&&(b={left:+b[0],top:+b[1]||0}),"left"in b&&(this.offset.click.left=b.left+this.margins.left),"right"in b&&(this.offset.click.left=this.helperProportions.width-b.right+this.margins.left),"top"in b&&(this.offset.click.top=b.top+this.margins.top),"bottom"in b&&(this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var b=this.offsetParent.offset();this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])&&(b.left+=this.scrollParent.scrollLeft(),b.top+=this.scrollParent.scrollTop());if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&a.browser.msie)b={top:0,left:0};return{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=this.element.position();return{top:a.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var b=this.options;b.containment=="parent"&&(b.containment=this.helper[0].parentNode);if(b.containment=="document"||b.containment=="window")this.containment=[b.containment=="document"?0:a(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,b.containment=="document"?0:a(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,(b.containment=="document"?0:a(window).scrollLeft())+a(b.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(b.containment=="document"?0:a(window).scrollTop())+(a(b.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(b.containment)&&b.containment.constructor!=Array){var c=a(b.containment),d=c[0];if(!d)return;var e=c.offset(),f=a(d).css("overflow")!="hidden";this.containment=[(parseInt(a(d).css("borderLeftWidth"),10)||0)+(parseInt(a(d).css("paddingLeft"),10)||0),(parseInt(a(d).css("borderTopWidth"),10)||0)+(parseInt(a(d).css("paddingTop"),10)||0),(f?Math.max(d.scrollWidth,d.offsetWidth):d.offsetWidth)-(parseInt(a(d).css("borderLeftWidth"),10)||0)-(parseInt(a(d).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(f?Math.max(d.scrollHeight,d.offsetHeight):d.offsetHeight)-(parseInt(a(d).css("borderTopWidth"),10)||0)-(parseInt(a(d).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relative_container=c}else b.containment.constructor==Array&&(this.containment=b.containment)},_convertPositionTo:function(b,c){c||(c=this.position);var d=b=="absolute"?1:-1,e=this.options,f=this.cssPosition=="absolute"&&(this.scrollParent[0]==document||!a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=/(html|body)/i.test(f[0].tagName);return{top:c.top+this.offset.relative.top*d+this.offset.parent.top*d-(a.browser.safari&&a.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():g?0:f.scrollTop())*d),left:c.left+this.offset.relative.left*d+this.offset.parent.left*d-(a.browser.safari&&a.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:f.scrollLeft())*d)}},_generatePosition:function(b){var c=this.options,d=this.cssPosition=="absolute"&&(this.scrollParent[0]==document||!a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,e=/(html|body)/i.test(d[0].tagName),f=b.pageX,g=b.pageY;if(this.originalPosition){var h;if(this.containment){if(this.relative_container){var i=this.relative_container.offset();h=[this.containment[0]+i.left,this.containment[1]+i.top,this.containment[2]+i.left,this.containment[3]+i.top]}else h=this.containment;b.pageX-this.offset.click.left<h[0]&&(f=h[0]+this.offset.click.left),b.pageY-this.offset.click.top<h[1]&&(g=h[1]+this.offset.click.top),b.pageX-this.offset.click.left>h[2]&&(f=h[2]+this.offset.click.left),b.pageY-this.offset.click.top>h[3]&&(g=h[3]+this.offset.click.top)}if(c.grid){var j=c.grid[1]?this.originalPageY+Math.round((g-this.originalPageY)/c.grid[1])*c.grid[1]:this.originalPageY;g=h?j-this.offset.click.top<h[1]||j-this.offset.click.top>h[3]?j-this.offset.click.top<h[1]?j+c.grid[1]:j-c.grid[1]:j:j;var k=c.grid[0]?this.originalPageX+Math.round((f-this.originalPageX)/c.grid[0])*c.grid[0]:this.originalPageX;f=h?k-this.offset.click.left<h[0]||k-this.offset.click.left>h[2]?k-this.offset.click.left<h[0]?k+c.grid[0]:k-c.grid[0]:k:k}}return{top:g-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(a.browser.safari&&a.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollTop():e?0:d.scrollTop()),left:f-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(a.browser.safari&&a.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():e?0:d.scrollLeft())}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval&&this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1},_trigger:function(b,c,d){d=d||this._uiHash(),a.ui.plugin.call(this,b,[c,d]),b=="drag"&&(this.positionAbs=this._convertPositionTo("absolute"));return a.Widget.prototype._trigger.call(this,b,c,d)},plugins:{},_uiHash:function(a){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),a.extend(a.ui.draggable,{version:"1.8.18"}),a.ui.plugin.add("draggable","connectToSortable",{start:function(b,c){var d=a(this).data("draggable"),e=d.options,f=a.extend({},c,{item:d.element});d.sortables=[],a(e.connectToSortable).each(function(){var c=a.data(this,"sortable");c&&!c.options.disabled&&(d.sortables.push({instance:c,shouldRevert:c.options.revert}),c.refreshPositions(),c._trigger("activate",b,f))})},stop:function(b,c){var d=a(this).data("draggable"),e=a.extend({},c,{item:d.element});a.each(d.sortables,function(){this.instance.isOver?(this.instance.isOver=0,d.cancelHelperRemoval=!0,this.instance.cancelHelperRemoval=!1,this.shouldRevert&&(this.instance.options.revert=!0),this.instance._mouseStop(b),this.instance.options.helper=this.instance.options._helper,d.options.helper=="original"&&this.instance.currentItem.css({top:"auto",left:"auto"})):(this.instance.cancelHelperRemoval=!1,this.instance._trigger("deactivate",b,e))})},drag:function(b,c){var d=a(this).data("draggable"),e=this,f=function(b){var c=this.offset.click.top,d=this.offset.click.left,e=this.positionAbs.top,f=this.positionAbs.left,g=b.height,h=b.width,i=b.top,j=b.left;return a.ui.isOver(e+c,f+d,i,j,g,h)};a.each(d.sortables,function(f){this.instance.positionAbs=d.positionAbs,this.instance.helperProportions=d.helperProportions,this.instance.offset.click=d.offset.click,this.instance._intersectsWith(this.instance.containerCache)?(this.instance.isOver||(this.instance.isOver=1,this.instance.currentItem=a(e).clone().removeAttr("id").appendTo(this.instance.element).data("sortable-item",!0),this.instance.options._helper=this.instance.options.helper,this.instance.options.helper=function(){return c.helper[0]},b.target=this.instance.currentItem[0],this.instance._mouseCapture(b,!0),this.instance._mouseStart(b,!0,!0),this.instance.offset.click.top=d.offset.click.top,this.instance.offset.click.left=d.offset.click.left,this.instance.offset.parent.left-=d.offset.parent.left-this.instance.offset.parent.left,this.instance.offset.parent.top-=d.offset.parent.top-this.instance.offset.parent.top,d._trigger("toSortable",b),d.dropped=this.instance.element,d.currentItem=d.element,this.instance.fromOutside=d),this.instance.currentItem&&this.instance._mouseDrag(b)):this.instance.isOver&&(this.instance.isOver=0,this.instance.cancelHelperRemoval=!0,this.instance.options.revert=!1,this.instance._trigger("out",b,this.instance._uiHash(this.instance)),this.instance._mouseStop(b,!0),this.instance.options.helper=this.instance.options._helper,this.instance.currentItem.remove(),this.instance.placeholder&&this.instance.placeholder.remove(),d._trigger("fromSortable",b),d.dropped=!1)})}}),a.ui.plugin.add("draggable","cursor",{start:function(b,c){var d=a("body"),e=a(this).data("draggable").options;d.css("cursor")&&(e._cursor=d.css("cursor")),d.css("cursor",e.cursor)},stop:function(b,c){var d=a(this).data("draggable").options;d._cursor&&a("body").css("cursor",d._cursor)}}),a.ui.plugin.add("draggable","opacity",{start:function(b,c){var d=a(c.helper),e=a(this).data("draggable").options;d.css("opacity")&&(e._opacity=d.css("opacity")),d.css("opacity",e.opacity)},stop:function(b,c){var d=a(this).data("draggable").options;d._opacity&&a(c.helper).css("opacity",d._opacity)}}),a.ui.plugin.add("draggable","scroll",{start:function(b,c){var d=a(this).data("draggable");d.scrollParent[0]!=document&&d.scrollParent[0].tagName!="HTML"&&(d.overflowOffset=d.scrollParent.offset())},drag:function(b,c){var d=a(this).data("draggable"),e=d.options,f=!1;if(d.scrollParent[0]!=document&&d.scrollParent[0].tagName!="HTML"){if(!e.axis||e.axis!="x")d.overflowOffset.top+d.scrollParent[0].offsetHeight-b.pageY<e.scrollSensitivity?d.scrollParent[0].scrollTop=f=d.scrollParent[0].scrollTop+e.scrollSpeed:b.pageY-d.overflowOffset.top<e.scrollSensitivity&&(d.scrollParent[0].scrollTop=f=d.scrollParent[0].scrollTop-e.scrollSpeed);if(!e.axis||e.axis!="y")d.overflowOffset.left+d.scrollParent[0].offsetWidth-b.pageX<e.scrollSensitivity?d.scrollParent[0].scrollLeft=f=d.scrollParent[0].scrollLeft+e.scrollSpeed:b.pageX-d.overflowOffset.left<e.scrollSensitivity&&(d.scrollParent[0].scrollLeft=f=d.scrollParent[0].scrollLeft-e.scrollSpeed)}else{if(!e.axis||e.axis!="x")b.pageY-a(document).scrollTop()<e.scrollSensitivity?f=a(document).scrollTop(a(document).scrollTop()-e.scrollSpeed):a(window).height()-(b.pageY-a(document).scrollTop())<e.scrollSensitivity&&(f=a(document).scrollTop(a(document).scrollTop()+e.scrollSpeed));if(!e.axis||e.axis!="y")b.pageX-a(document).scrollLeft()<e.scrollSensitivity?f=a(document).scrollLeft(a(document).scrollLeft()-e.scrollSpeed):a(window).width()-(b.pageX-a(document).scrollLeft())<e.scrollSensitivity&&(f=a(document).scrollLeft(a(document).scrollLeft()+e.scrollSpeed))}f!==!1&&a.ui.ddmanager&&!e.dropBehaviour&&a.ui.ddmanager.prepareOffsets(d,b)}}),a.ui.plugin.add("draggable","snap",{start:function(b,c){var d=a(this).data("draggable"),e=d.options;d.snapElements=[],a(e.snap.constructor!=String?e.snap.items||":data(draggable)":e.snap).each(function(){var b=a(this),c=b.offset();this!=d.element[0]&&d.snapElements.push({item:this,width:b.outerWidth(),height:b.outerHeight(),top:c.top,left:c.left})})},drag:function(b,c){var d=a(this).data("draggable"),e=d.options,f=e.snapTolerance,g=c.offset.left,h=g+d.helperProportions.width,i=c.offset.top,j=i+d.helperProportions.height;for(var k=d.snapElements.length-1;k>=0;k--){var l=d.snapElements[k].left,m=l+d.snapElements[k].width,n=d.snapElements[k].top,o=n+d.snapElements[k].height;if(!(l-f<g&&g<m+f&&n-f<i&&i<o+f||l-f<g&&g<m+f&&n-f<j&&j<o+f||l-f<h&&h<m+f&&n-f<i&&i<o+f||l-f<h&&h<m+f&&n-f<j&&j<o+f)){d.snapElements[k].snapping&&d.options.snap.release&&d.options.snap.release.call(d.element,b,a.extend(d._uiHash(),{snapItem:d.snapElements[k].item})),d.snapElements[k].snapping=!1;continue}if(e.snapMode!="inner"){var p=Math.abs(n-j)<=f,q=Math.abs(o-i)<=f,r=Math.abs(l-h)<=f,s=Math.abs(m-g)<=f;p&&(c.position.top=d._convertPositionTo("relative",{top:n-d.helperProportions.height,left:0}).top-d.margins.top),q&&(c.position.top=d._convertPositionTo("relative",{top:o,left:0}).top-d.margins.top),r&&(c.position.left=d._convertPositionTo("relative",{top:0,left:l-d.helperProportions.width}).left-d.margins.left),s&&(c.position.left=d._convertPositionTo("relative",{top:0,left:m}).left-d.margins.left)}var t=p||q||r||s;if(e.snapMode!="outer"){var p=Math.abs(n-i)<=f,q=Math.abs(o-j)<=f,r=Math.abs(l-g)<=f,s=Math.abs(m-h)<=f;p&&(c.position.top=d._convertPositionTo("relative",{top:n,left:0}).top-d.margins.top),q&&(c.position.top=d._convertPositionTo("relative",{top:o-d.helperProportions.height,left:0}).top-d.margins.top),r&&(c.position.left=d._convertPositionTo("relative",{top:0,left:l}).left-d.margins.left),s&&(c.position.left=d._convertPositionTo("relative",{top:0,left:m-d.helperProportions.width}).left-d.margins.left)}!d.snapElements[k].snapping&&(p||q||r||s||t)&&d.options.snap.snap&&d.options.snap.snap.call(d.element,b,a.extend(d._uiHash(),{snapItem:d.snapElements[k].item})),d.snapElements[k].snapping=p||q||r||s||t}}}),a.ui.plugin.add("draggable","stack",{start:function(b,c){var d=a(this).data("draggable").options,e=a.makeArray(a(d.stack)).sort(function(b,c){return(parseInt(a(b).css("zIndex"),10)||0)-(parseInt(a(c).css("zIndex"),10)||0)});if(!!e.length){var f=parseInt(e[0].style.zIndex)||0;a(e).each(function(a){this.style.zIndex=f+a}),this[0].style.zIndex=f+e.length}}}),a.ui.plugin.add("draggable","zIndex",{start:function(b,c){var d=a(c.helper),e=a(this).data("draggable").options;d.css("zIndex")&&(e._zIndex=d.css("zIndex")),d.css("zIndex",e.zIndex)},stop:function(b,c){var d=a(this).data("draggable").options;d._zIndex&&a(c.helper).css("zIndex",d._zIndex)}})})(jQuery);/*
+ * jQuery UI Droppable 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Droppables
+ *
+ * Depends:
+ * jquery.ui.core.js
+ * jquery.ui.widget.js
+ * jquery.ui.mouse.js
+ * jquery.ui.draggable.js
+ */(function(a,b){a.widget("ui.droppable",{widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect"},_create:function(){var b=this.options,c=b.accept;this.isover=0,this.isout=1,this.accept=a.isFunction(c)?c:function(a){return a.is(c)},this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight},a.ui.ddmanager.droppables[b.scope]=a.ui.ddmanager.droppables[b.scope]||[],a.ui.ddmanager.droppables[b.scope].push(this),b.addClasses&&this.element.addClass("ui-droppable")},destroy:function(){var b=a.ui.ddmanager.droppables[this.options.scope];for(var c=0;c<b.length;c++)b[c]==this&&b.splice(c,1);this.element.removeClass("ui-droppable ui-droppable-disabled").removeData("droppable").unbind(".droppable");return this},_setOption:function(b,c){b=="accept"&&(this.accept=a.isFunction(c)?c:function(a){return a.is(c)}),a.Widget.prototype._setOption.apply(this,arguments)},_activate:function(b){var c=a.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass),c&&this._trigger("activate",b,this.ui(c))},_deactivate:function(b){var c=a.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass),c&&this._trigger("deactivate",b,this.ui(c))},_over:function(b){var c=a.ui.ddmanager.current;!!c&&(c.currentItem||c.element)[0]!=this.element[0]&&this.accept.call(this.element[0],c.currentItem||c.element)&&(this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",b,this.ui(c)))},_out:function(b){var c=a.ui.ddmanager.current;!!c&&(c.currentItem||c.element)[0]!=this.element[0]&&this.accept.call(this.element[0],c.currentItem||c.element)&&(this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",b,this.ui(c)))},_drop:function(b,c){var d=c||a.ui.ddmanager.current;if(!d||(d.currentItem||d.element)[0]==this.element[0])return!1;var e=!1;this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function(){var b=a.data(this,"droppable");if(b.options.greedy&&!b.options.disabled&&b.options.scope==d.options.scope&&b.accept.call(b.element[0],d.currentItem||d.element)&&a.ui.intersect(d,a.extend(b,{offset:b.element.offset()}),b.options.tolerance)){e=!0;return!1}});if(e)return!1;if(this.accept.call(this.element[0],d.currentItem||d.element)){this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",b,this.ui(d));return this.element}return!1},ui:function(a){return{draggable:a.currentItem||a.element,helper:a.helper,position:a.position,offset:a.positionAbs}}}),a.extend(a.ui.droppable,{version:"1.8.18"}),a.ui.intersect=function(b,c,d){if(!c.offset)return!1;var e=(b.positionAbs||b.position.absolute).left,f=e+b.helperProportions.width,g=(b.positionAbs||b.position.absolute).top,h=g+b.helperProportions.height,i=c.offset.left,j=i+c.proportions.width,k=c.offset.top,l=k+c.proportions.height;switch(d){case"fit":return i<=e&&f<=j&&k<=g&&h<=l;case"intersect":return i<e+b.helperProportions.width/2&&f-b.helperProportions.width/2<j&&k<g+b.helperProportions.height/2&&h-b.helperProportions.height/2<l;case"pointer":var m=(b.positionAbs||b.position.absolute).left+(b.clickOffset||b.offset.click).left,n=(b.positionAbs||b.position.absolute).top+(b.clickOffset||b.offset.click).top,o=a.ui.isOver(n,m,k,i,c.proportions.height,c.proportions.width);return o;case"touch":return(g>=k&&g<=l||h>=k&&h<=l||g<k&&h>l)&&(e>=i&&e<=j||f>=i&&f<=j||e<i&&f>j);default:return!1}},a.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(b,c){var d=a.ui.ddmanager.droppables[b.options.scope]||[],e=c?c.type:null,f=(b.currentItem||b.element).find(":data(droppable)").andSelf();droppablesLoop:for(var g=0;g<d.length;g++){if(d[g].options.disabled||b&&!d[g].accept.call(d[g].element[0],b.currentItem||b.element))continue;for(var h=0;h<f.length;h++)if(f[h]==d[g].element[0]){d[g].proportions.height=0;continue droppablesLoop}d[g].visible=d[g].element.css("display")!="none";if(!d[g].visible)continue;e=="mousedown"&&d[g]._activate.call(d[g],c),d[g].offset=d[g].element.offset(),d[g].proportions={width:d[g].element[0].offsetWidth,height:d[g].element[0].offsetHeight}}},drop:function(b,c){var d=!1;a.each(a.ui.ddmanager.droppables[b.options.scope]||[],function(){!this.options||(!this.options.disabled&&this.visible&&a.ui.intersect(b,this,this.options.tolerance)&&(d=this._drop.call(this,c)||d),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],b.currentItem||b.element)&&(this.isout=1,this.isover=0,this._deactivate.call(this,c)))});return d},dragStart:function(b,c){b.element.parents(":not(body,html)").bind("scroll.droppable",function(){b.options.refreshPositions||a.ui.ddmanager.prepareOffsets(b,c)})},drag:function(b,c){b.options.refreshPositions&&a.ui.ddmanager.prepareOffsets(b,c),a.each(a.ui.ddmanager.droppables[b.options.scope]||[],function(){if(!(this.options.disabled||this.greedyChild||!this.visible)){var d=a.ui.intersect(b,this,this.options.tolerance),e=!d&&this.isover==1?"isout":d&&this.isover==0?"isover":null;if(!e)return;var f;if(this.options.greedy){var g=this.element.parents(":data(droppable):eq(0)");g.length&&(f=a.data(g[0],"droppable"),f.greedyChild=e=="isover"?1:0)}f&&e=="isover"&&(f.isover=0,f.isout=1,f._out.call(f,c)),this[e]=1,this[e=="isout"?"isover":"isout"]=0,this[e=="isover"?"_over":"_out"].call(this,c),f&&e=="isout"&&(f.isout=0,f.isover=1,f._over.call(f,c))}})},dragStop:function(b,c){b.element.parents(":not(body,html)").unbind("scroll.droppable"),b.options.refreshPositions||a.ui.ddmanager.prepareOffsets(b,c)}}})(jQuery);/*
+ * jQuery UI Resizable 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Resizables
+ *
+ * Depends:
+ * jquery.ui.core.js
+ * jquery.ui.mouse.js
+ * jquery.ui.widget.js
+ */(function(a,b){a.widget("ui.resizable",a.ui.mouse,{widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1e3},_create:function(){var b=this,c=this.options;this.element.addClass("ui-resizable"),a.extend(this,{_aspectRatio:!!c.aspectRatio,aspectRatio:c.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:c.helper||c.ghost||c.animate?c.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)&&(this.element.wrap(a('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("resizable",this.element.data("resizable")),this.elementIsWrapper=!0,this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")}),this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0}),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css({margin:this.originalElement.css("margin")}),this._proportionallyResize()),this.handles=c.handles||(a(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se");if(this.handles.constructor==String){this.handles=="all"&&(this.handles="n,e,s,w,se,sw,ne,nw");var d=this.handles.split(",");this.handles={};for(var e=0;e<d.length;e++){var f=a.trim(d[e]),g="ui-resizable-"+f,h=a('<div class="ui-resizable-handle '+g+'"></div>');/sw|se|ne|nw/.test(f)&&h.css({zIndex:++c.zIndex}),"se"==f&&h.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[f]=".ui-resizable-"+f,this.element.append(h)}}this._renderAxis=function(b){b=b||this.element;for(var c in this.handles){this.handles[c].constructor==String&&(this.handles[c]=a(this.handles[c],this.element).show());if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var d=a(this.handles[c],this.element),e=0;e=/sw|ne|nw|se|n|s/.test(c)?d.outerHeight():d.outerWidth();var f=["padding",/ne|nw|n/.test(c)?"Top":/se|sw|s/.test(c)?"Bottom":/^e$/.test(c)?"Right":"Left"].join("");b.css(f,e),this._proportionallyResize()}if(!a(this.handles[c]).length)continue}},this._renderAxis(this.element),this._handles=a(".ui-resizable-handle",this.element).disableSelection(),this._handles.mouseover(function(){if(!b.resizing){if(this.className)var a=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);b.axis=a&&a[1]?a[1]:"se"}}),c.autoHide&&(this._handles.hide(),a(this.element).addClass("ui-resizable-autohide").hover(function(){c.disabled||(a(this).removeClass("ui-resizable-autohide"),b._handles.show())},function(){c.disabled||b.resizing||(a(this).addClass("ui-resizable-autohide"),b._handles.hide())})),this._mouseInit()},destroy:function(){this._mouseDestroy();var b=function(b){a(b).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){b(this.element);var c=this.element;c.after(this.originalElement.css({position:c.css("position"),width:c.outerWidth(),height:c.outerHeight(),top:c.css("top"),left:c.css("left")})).remove()}this.originalElement.css("resize",this.originalResizeStyle),b(this.originalElement);return this},_mouseCapture:function(b){var c=!1;for(var d in this.handles)a(this.handles[d])[0]==b.target&&(c=!0);return!this.options.disabled&&c},_mouseStart:function(b){var d=this.options,e=this.element.position(),f=this.element;this.resizing=!0,this.documentScroll={top:a(document).scrollTop(),left:a(document).scrollLeft()},(f.is(".ui-draggable")||/absolute/.test(f.css("position")))&&f.css({position:"absolute",top:e.top,left:e.left}),this._renderProxy();var g=c(this.helper.css("left")),h=c(this.helper.css("top"));d.containment&&(g+=a(d.containment).scrollLeft()||0,h+=a(d.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:g,top:h},this.size=this._helper?{width:f.outerWidth(),height:f.outerHeight()}:{width:f.width(),height:f.height()},this.originalSize=this._helper?{width:f.outerWidth(),height:f.outerHeight()}:{width:f.width(),height:f.height()},this.originalPosition={left:g,top:h},this.sizeDiff={width:f.outerWidth()-f.width(),height:f.outerHeight()-f.height()},this.originalMousePosition={left:b.pageX,top:b.pageY},this.aspectRatio=typeof d.aspectRatio=="number"?d.aspectRatio:this.originalSize.width/this.originalSize.height||1;var i=a(".ui-resizable-"+this.axis).css("cursor");a("body").css("cursor",i=="auto"?this.axis+"-resize":i),f.addClass("ui-resizable-resizing"),this._propagate("start",b);return!0},_mouseDrag:function(b){var c=this.helper,d=this.options,e={},f=this,g=this.originalMousePosition,h=this.axis,i=b.pageX-g.left||0,j=b.pageY-g.top||0,k=this._change[h];if(!k)return!1;var l=k.apply(this,[b,i,j]),m=a.browser.msie&&a.browser.version<7,n=this.sizeDiff;this._updateVirtualBoundaries(b.shiftKey);if(this._aspectRatio||b.shiftKey)l=this._updateRatio(l,b);l=this._respectSize(l,b),this._propagate("resize",b),c.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"}),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),this._updateCache(l),this._trigger("resize",b,this.ui());return!1},_mouseStop:function(b){this.resizing=!1;var c=this.options,d=this;if(this._helper){var e=this._proportionallyResizeElements,f=e.length&&/textarea/i.test(e[0].nodeName),g=f&&a.ui.hasScroll(e[0],"left")?0:d.sizeDiff.height,h=f?0:d.sizeDiff.width,i={width:d.helper.width()-h,height:d.helper.height()-g},j=parseInt(d.element.css("left"),10)+(d.position.left-d.originalPosition.left)||null,k=parseInt(d.element.css("top"),10)+(d.position.top-d.originalPosition.top)||null;c.animate||this.element.css(a.extend(i,{top:k,left:j})),d.helper.height(d.size.height),d.helper.width(d.size.width),this._helper&&!c.animate&&this._proportionallyResize()}a("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",b),this._helper&&this.helper.remove();return!1},_updateVirtualBoundaries:function(a){var b=this.options,c,e,f,g,h;h={minWidth:d(b.minWidth)?b.minWidth:0,maxWidth:d(b.maxWidth)?b.maxWidth:Infinity,minHeight:d(b.minHeight)?b.minHeight:0,maxHeight:d(b.maxHeight)?b.maxHeight:Infinity};if(this._aspectRatio||a)c=h.minHeight*this.aspectRatio,f=h.minWidth/this.aspectRatio,e=h.maxHeight*this.aspectRatio,g=h.maxWidth/this.aspectRatio,c>h.minWidth&&(h.minWidth=c),f>h.minHeight&&(h.minHeight=f),e<h.maxWidth&&(h.maxWidth=e),g<h.maxHeight&&(h.maxHeight=g);this._vBoundaries=h},_updateCache:function(a){var b=this.options;this.offset=this.helper.offset(),d(a.left)&&(this.position.left=a.left),d(a.top)&&(this.position.top=a.top),d(a.height)&&(this.size.height=a.height),d(a.width)&&(this.size.width=a.width)},_updateRatio:function(a,b){var c=this.options,e=this.position,f=this.size,g=this.axis;d(a.height)?a.width=a.height*this.aspectRatio:d(a.width)&&(a.height=a.width/this.aspectRatio),g=="sw"&&(a.left=e.left+(f.width-a.width),a.top=null),g=="nw"&&(a.top=e.top+(f.height-a.height),a.left=e.left+(f.width-a.width));return a},_respectSize:function(a,b){var c=this.helper,e=this._vBoundaries,f=this._aspectRatio||b.shiftKey,g=this.axis,h=d(a.width)&&e.maxWidth&&e.maxWidth<a.width,i=d(a.height)&&e.maxHeight&&e.maxHeight<a.height,j=d(a.width)&&e.minWidth&&e.minWidth>a.width,k=d(a.height)&&e.minHeight&&e.minHeight>a.height;j&&(a.width=e.minWidth),k&&(a.height=e.minHeight),h&&(a.width=e.maxWidth),i&&(a.height=e.maxHeight);var l=this.originalPosition.left+this.originalSize.width,m=this.position.top+this.size.height,n=/sw|nw|w/.test(g),o=/nw|ne|n/.test(g);j&&n&&(a.left=l-e.minWidth),h&&n&&(a.left=l-e.maxWidth),k&&o&&(a.top=m-e.minHeight),i&&o&&(a.top=m-e.maxHeight);var p=!a.width&&!a.height;p&&!a.left&&a.top?a.top=null:p&&!a.top&&a.left&&(a.left=null);return a},_proportionallyResize:function(){var b=this.options;if(!!this._proportionallyResizeElements.length){var c=this.helper||this.element;for(var d=0;d<this._proportionallyResizeElements.length;d++){var e=this._proportionallyResizeElements[d];if(!this.borderDif){var f=[e.css("borderTopWidth"),e.css("borderRightWidth"),e.css("borderBottomWidth"),e.css("borderLeftWidth")],g=[e.css("paddingTop"),e.css("paddingRight"),e.css("paddingBottom"),e.css("paddingLeft")];this.borderDif=a.map(f,function(a,b){var c=parseInt(a,10)||0,d=parseInt(g[b],10)||0;return c+d})}if(a.browser.msie&&(!!a(c).is(":hidden")||!!a(c).parents(":hidden").length))continue;e.css({height:c.height()-this.borderDif[0]-this.borderDif[2]||0,width:c.width()-this.borderDif[1]-this.borderDif[3]||0})}}},_renderProxy:function(){var b=this.element,c=this.options;this.elementOffset=b.offset();if(this._helper){this.helper=this.helper||a('<div style="overflow:hidden;"></div>');var d=a.browser.msie&&a.browser.version<7,e=d?1:0,f=d?2:-1;this.helper.addClass(this._helper).css({width:this.element.outerWidth()+f,height:this.element.outerHeight()+f,position:"absolute",left:this.elementOffset.left-e+"px",top:this.elementOffset.top-e+"px",zIndex:++c.zIndex}),this.helper.appendTo("body").disableSelection()}else this.helper=this.element},_change:{e:function(a,b,c){return{width:this.originalSize.width+b}},w:function(a,b,c){var d=this.options,e=this.originalSize,f=this.originalPosition;return{left:f.left+b,width:e.width-b}},n:function(a,b,c){var d=this.options,e=this.originalSize,f=this.originalPosition;return{top:f.top+c,height:e.height-c}},s:function(a,b,c){return{height:this.originalSize.height+c}},se:function(b,c,d){return a.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[b,c,d]))},sw:function(b,c,d){return a.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[b,c,d]))},ne:function(b,c,d){return a.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[b,c,d]))},nw:function(b,c,d){return a.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[b,c,d]))}},_propagate:function(b,c){a.ui.plugin.call(this,b,[c,this.ui()]),b!="resize"&&this._trigger(b,c,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),a.extend(a.ui.resizable,{version:"1.8.18"}),a.ui.plugin.add("resizable","alsoResize",{start:function(b,c){var d=a(this).data("resizable"),e=d.options,f=function(b){a(b).each(function(){var b=a(this);b.data("resizable-alsoresize",{width:parseInt(b.width(),10),height:parseInt(b.height(),10),left:parseInt(b.css("left"),10),top:parseInt(b.css("top"),10)})})};typeof e.alsoResize=="object"&&!e.alsoResize.parentNode?e.alsoResize.length?(e.alsoResize=e.alsoResize[0],f(e.alsoResize)):a.each(e.alsoResize,function(a){f(a)}):f(e.alsoResize)},resize:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d.originalSize,g=d.originalPosition,h={height:d.size.height-f.height||0,width:d.size.width-f.width||0,top:d.position.top-g.top||0,left:d.position.left-g.left||0},i=function(b,d){a(b).each(function(){var b=a(this),e=a(this).data("resizable-alsoresize"),f={},g=d&&d.length?d:b.parents(c.originalElement[0]).length?["width","height"]:["width","height","top","left"];a.each(g,function(a,b){var c=(e[b]||0)+(h[b]||0);c&&c>=0&&(f[b]=c||null)}),b.css(f)})};typeof e.alsoResize=="object"&&!e.alsoResize.nodeType?a.each(e.alsoResize,function(a,b){i(a,b)}):i(e.alsoResize)},stop:function(b,c){a(this).removeData("resizable-alsoresize")}}),a.ui.plugin.add("resizable","animate",{stop:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d._proportionallyResizeElements,g=f.length&&/textarea/i.test(f[0].nodeName),h=g&&a.ui.hasScroll(f[0],"left")?0:d.sizeDiff.height,i=g?0:d.sizeDiff.width,j={width:d.size.width-i,height:d.size.height-h},k=parseInt(d.element.css("left"),10)+(d.position.left-d.originalPosition.left)||null,l=parseInt(d.element.css("top"),10)+(d.position.top-d.originalPosition.top)||null;d.element.animate(a.extend(j,l&&k?{top:l,left:k}:{}),{duration:e.animateDuration,easing:e.animateEasing,step:function(){var c={width:parseInt(d.element.css("width"),10),height:parseInt(d.element.css("height"),10),top:parseInt(d.element.css("top"),10),left:parseInt(d.element.css("left"),10)};f&&f.length&&a(f[0]).css({width:c.width,height:c.height}),d._updateCache(c),d._propagate("resize",b)}})}}),a.ui.plugin.add("resizable","containment",{start:function(b,d){var e=a(this).data("resizable"),f=e.options,g=e.element,h=f.containment,i=h instanceof a?h.get(0):/parent/.test(h)?g.parent().get(0):h;if(!!i){e.containerElement=a(i);if(/document/.test(h)||h==document)e.containerOffset={left:0,top:0},e.containerPosition={left:0,top:0},e.parentData={element:a(document),left:0,top:0,width:a(document).width(),height:a(document).height()||document.body.parentNode.scrollHeight};else{var j=a(i),k=[];a(["Top","Right","Left","Bottom"]).each(function(a,b){k[a]=c(j.css("padding"+b))}),e.containerOffset=j.offset(),e.containerPosition=j.position(),e.containerSize={height:j.innerHeight()-k[3],width:j.innerWidth()-k[1]};var l=e.containerOffset,m=e.containerSize.height,n=e.containerSize.width,o=a.ui.hasScroll(i,"left")?i.scrollWidth:n,p=a.ui.hasScroll(i)?i.scrollHeight:m;e.parentData={element:i,left:l.left,top:l.top,width:o,height:p}}}},resize:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d.containerSize,g=d.containerOffset,h=d.size,i=d.position,j=d._aspectRatio||b.shiftKey,k={top:0,left:0},l=d.containerElement;l[0]!=document&&/static/.test(l.css("position"))&&(k=g),i.left<(d._helper?g.left:0)&&(d.size.width=d.size.width+(d._helper?d.position.left-g.left:d.position.left-k.left),j&&(d.size.height=d.size.width/e.aspectRatio),d.position.left=e.helper?g.left:0),i.top<(d._helper?g.top:0)&&(d.size.height=d.size.height+(d._helper?d.position.top-g.top:d.position.top),j&&(d.size.width=d.size.height*e.aspectRatio),d.position.top=d._helper?g.top:0),d.offset.left=d.parentData.left+d.position.left,d.offset.top=d.parentData.top+d.position.top;var m=Math.abs((d._helper?d.offset.left-k.left:d.offset.left-k.left)+d.sizeDiff.width),n=Math.abs((d._helper?d.offset.top-k.top:d.offset.top-g.top)+d.sizeDiff.height),o=d.containerElement.get(0)==d.element.parent().get(0),p=/relative|absolute/.test(d.containerElement.css("position"));o&&p&&(m-=d.parentData.left),m+d.size.width>=d.parentData.width&&(d.size.width=d.parentData.width-m,j&&(d.size.height=d.size.width/d.aspectRatio)),n+d.size.height>=d.parentData.height&&(d.size.height=d.parentData.height-n,j&&(d.size.width=d.size.height*d.aspectRatio))},stop:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d.position,g=d.containerOffset,h=d.containerPosition,i=d.containerElement,j=a(d.helper),k=j.offset(),l=j.outerWidth()-d.sizeDiff.width,m=j.outerHeight()-d.sizeDiff.height;d._helper&&!e.animate&&/relative/.test(i.css("position"))&&a(this).css({left:k.left-h.left-g.left,width:l,height:m}),d._helper&&!e.animate&&/static/.test(i.css("position"))&&a(this).css({left:k.left-h.left-g.left,width:l,height:m})}}),a.ui.plugin.add("resizable","ghost",{start:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d.size;d.ghost=d.originalElement.clone(),d.ghost.css({opacity:.25,display:"block",position:"relative",height:f.height,width:f.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof e.ghost=="string"?e.ghost:""),d.ghost.appendTo(d.helper)},resize:function(b,c){var d=a(this).data("resizable"),e=d.options;d.ghost&&d.ghost.css({position:"relative",height:d.size.height,width:d.size.width})},stop:function(b,c){var d=a(this).data("resizable"),e=d.options;d.ghost&&d.helper&&d.helper.get(0).removeChild(d.ghost.get(0))}}),a.ui.plugin.add("resizable","grid",{resize:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d.size,g=d.originalSize,h=d.originalPosition,i=d.axis,j=e._aspectRatio||b.shiftKey;e.grid=typeof e.grid=="number"?[e.grid,e.grid]:e.grid;var k=Math.round((f.width-g.width)/(e.grid[0]||1))*(e.grid[0]||1),l=Math.round((f.height-g.height)/(e.grid[1]||1))*(e.grid[1]||1);/^(se|s|e)$/.test(i)?(d.size.width=g.width+k,d.size.height=g.height+l):/^(ne)$/.test(i)?(d.size.width=g.width+k,d.size.height=g.height+l,d.position.top=h.top-l):/^(sw)$/.test(i)?(d.size.width=g.width+k,d.size.height=g.height+l,d.position.left=h.left-k):(d.size.width=g.width+k,d.size.height=g.height+l,d.position.top=h.top-l,d.position.left=h.left-k)}});var c=function(a){return parseInt(a,10)||0},d=function(a){return!isNaN(parseInt(a,10))}})(jQuery);/*
+ * jQuery UI Selectable 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Selectables
+ *
+ * Depends:
+ * jquery.ui.core.js
+ * jquery.ui.mouse.js
+ * jquery.ui.widget.js
+ */(function(a,b){a.widget("ui.selectable",a.ui.mouse,{options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch"},_create:function(){var b=this;this.element.addClass("ui-selectable"),this.dragged=!1;var c;this.refresh=function(){c=a(b.options.filter,b.element[0]),c.addClass("ui-selectee"),c.each(function(){var b=a(this),c=b.offset();a.data(this,"selectable-item",{element:this,$element:b,left:c.left,top:c.top,right:c.left+b.outerWidth(),bottom:c.top+b.outerHeight(),startselected:!1,selected:b.hasClass("ui-selected"),selecting:b.hasClass("ui-selecting"),unselecting:b.hasClass("ui-unselecting")})})},this.refresh(),this.selectees=c.addClass("ui-selectee"),this._mouseInit(),this.helper=a("<div class='ui-selectable-helper'></div>")},destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item"),this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable"),this._mouseDestroy();return this},_mouseStart:function(b){var c=this;this.opos=[b.pageX,b.pageY];if(!this.options.disabled){var d=this.options;this.selectees=a(d.filter,this.element[0]),this._trigger("start",b),a(d.appendTo).append(this.helper),this.helper.css({left:b.clientX,top:b.clientY,width:0,height:0}),d.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var d=a.data(this,"selectable-item");d.startselected=!0,!b.metaKey&&!b.ctrlKey&&(d.$element.removeClass("ui-selected"),d.selected=!1,d.$element.addClass("ui-unselecting"),d.unselecting=!0,c._trigger("unselecting",b,{unselecting:d.element}))}),a(b.target).parents().andSelf().each(function(){var d=a.data(this,"selectable-item");if(d){var e=!b.metaKey&&!b.ctrlKey||!d.$element.hasClass("ui-selected");d.$element.removeClass(e?"ui-unselecting":"ui-selected").addClass(e?"ui-selecting":"ui-unselecting"),d.unselecting=!e,d.selecting=e,d.selected=e,e?c._trigger("selecting",b,{selecting:d.element}):c._trigger("unselecting",b,{unselecting:d.element});return!1}})}},_mouseDrag:function(b){var c=this;this.dragged=!0;if(!this.options.disabled){var d=this.options,e=this.opos[0],f=this.opos[1],g=b.pageX,h=b.pageY;if(e>g){var i=g;g=e,e=i}if(f>h){var i=h;h=f,f=i}this.helper.css({left:e,top:f,width:g-e,height:h-f}),this.selectees.each(function(){var i=a.data(this,"selectable-item");if(!!i&&i.element!=c.element[0]){var j=!1;d.tolerance=="touch"?j=!(i.left>g||i.right<e||i.top>h||i.bottom<f):d.tolerance=="fit"&&(j=i.left>e&&i.right<g&&i.top>f&&i.bottom<h),j?(i.selected&&(i.$element.removeClass("ui-selected"),i.selected=!1),i.unselecting&&(i.$element.removeClass("ui-unselecting"),i.unselecting=!1),i.selecting||(i.$element.addClass("ui-selecting"),i.selecting=!0,c._trigger("selecting",b,{selecting:i.element}))):(i.selecting&&((b.metaKey||b.ctrlKey)&&i.startselected?(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.$element.addClass("ui-selected"),i.selected=!0):(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.startselected&&(i.$element.addClass("ui-unselecting"),i.unselecting=!0),c._trigger("unselecting",b,{unselecting:i.element}))),i.selected&&!b.metaKey&&!b.ctrlKey&&!i.startselected&&(i.$element.removeClass("ui-selected"),i.selected=!1,i.$element.addClass("ui-unselecting"),i.unselecting=!0,c._trigger("unselecting",b,{unselecting:i.element})))}});return!1}},_mouseStop:function(b){var c=this;this.dragged=!1;var d=this.options;a(".ui-unselecting",this.element[0]).each(function(){var d=a.data(this,"selectable-item");d.$element.removeClass("ui-unselecting"),d.unselecting=!1,d.startselected=!1,c._trigger("unselected",b,{unselected:d.element})}),a(".ui-selecting",this.element[0]).each(function(){var d=a.data(this,"selectable-item");d.$element.removeClass("ui-selecting").addClass("ui-selected"),d.selecting=!1,d.selected=!0,d.startselected=!0,c._trigger("selected",b,{selected:d.element})}),this._trigger("stop",b),this.helper.remove();return!1}}),a.extend(a.ui.selectable,{version:"1.8.18"})})(jQuery);/*
+ * jQuery UI Sortable 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Sortables
+ *
+ * Depends:
+ * jquery.ui.core.js
+ * jquery.ui.mouse.js
+ * jquery.ui.widget.js
+ */(function(a,b){a.widget("ui.sortable",a.ui.mouse,{widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3},_create:function(){var a=this.options;this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.floating=this.items.length?a.axis==="x"||/left|right/.test(this.items[0].item.css("float"))||/inline|table-cell/.test(this.items[0].item.css("display")):!1,this.offset=this.element.offset(),this._mouseInit(),this.ready=!0},destroy:function(){a.Widget.prototype.destroy.call(this),this.element.removeClass("ui-sortable ui-sortable-disabled"),this._mouseDestroy();for(var b=this.items.length-1;b>=0;b--)this.items[b].item.removeData(this.widgetName+"-item");return this},_setOption:function(b,c){b==="disabled"?(this.options[b]=c,this.widget()[c?"addClass":"removeClass"]("ui-sortable-disabled")):a.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(b,c){var d=this;if(this.reverting)return!1;if(this.options.disabled||this.options.type=="static")return!1;this._refreshItems(b);var e=null,f=this,g=a(b.target).parents().each(function(){if(a.data(this,d.widgetName+"-item")==f){e=a(this);return!1}});a.data(b.target,d.widgetName+"-item")==f&&(e=a(b.target));if(!e)return!1;if(this.options.handle&&!c){var h=!1;a(this.options.handle,e).find("*").andSelf().each(function(){this==b.target&&(h=!0)});if(!h)return!1}this.currentItem=e,this._removeCurrentsFromItems();return!0},_mouseStart:function(b,c,d){var e=this.options,f=this;this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(b),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),a.extend(this.offset,{click:{left:b.pageX-this.offset.left,top:b.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.originalPosition=this._generatePosition(b),this.originalPageX=b.pageX,this.originalPageY=b.pageY,e.cursorAt&&this._adjustOffsetFromHelper(e.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!=this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),e.containment&&this._setContainment(),e.cursor&&(a("body").css("cursor")&&(this._storedCursor=a("body").css("cursor")),a("body").css("cursor",e.cursor)),e.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",e.opacity)),e.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",e.zIndex)),this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",b,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions();if(!d)for(var g=this.containers.length-1;g>=0;g--)this.containers[g]._trigger("activate",b,f._uiHash(this));a.ui.ddmanager&&(a.ui.ddmanager.current=this),a.ui.ddmanager&&!e.dropBehaviour&&a.ui.ddmanager.prepareOffsets(this,b),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(b);return!0},_mouseDrag:function(b){this.position=this._generatePosition(b),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs);if(this.options.scroll){var c=this.options,d=!1;this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-b.pageY<c.scrollSensitivity?this.scrollParent[0].scrollTop=d=this.scrollParent[0].scrollTop+c.scrollSpeed:b.pageY-this.overflowOffset.top<c.scrollSensitivity&&(this.scrollParent[0].scrollTop=d=this.scrollParent[0].scrollTop-c.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-b.pageX<c.scrollSensitivity?this.scrollParent[0].scrollLeft=d=this.scrollParent[0].scrollLeft+c.scrollSpeed:b.pageX-this.overflowOffset.left<c.scrollSensitivity&&(this.scrollParent[0].scrollLeft=d=this.scrollParent[0].scrollLeft-c.scrollSpeed)):(b.pageY-a(document).scrollTop()<c.scrollSensitivity?d=a(document).scrollTop(a(document).scrollTop()-c.scrollSpeed):a(window).height()-(b.pageY-a(document).scrollTop())<c.scrollSensitivity&&(d=a(document).scrollTop(a(document).scrollTop()+c.scrollSpeed)),b.pageX-a(document).scrollLeft()<c.scrollSensitivity?d=a(document).scrollLeft(a(document).scrollLeft()-c.scrollSpeed):a(window).width()-(b.pageX-a(document).scrollLeft())<c.scrollSensitivity&&(d=a(document).scrollLeft(a(document).scrollLeft()+c.scrollSpeed))),d!==!1&&a.ui.ddmanager&&!c.dropBehaviour&&a.ui.ddmanager.prepareOffsets(this,b)}this.positionAbs=this._convertPositionTo("absolute");if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";for(var e=this.items.length-1;e>=0;e--){var f=this.items[e],g=f.item[0],h=this._intersectsWithPointer(f);if(!h)continue;if(g!=this.currentItem[0]&&this.placeholder[h==1?"next":"prev"]()[0]!=g&&!a.ui.contains(this.placeholder[0],g)&&(this.options.type=="semi-dynamic"?!a.ui.contains(this.element[0],g):!0)){this.direction=h==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(f))this._rearrange(b,f);else break;this._trigger("change",b,this._uiHash());break}}this._contactContainers(b),a.ui.ddmanager&&a.ui.ddmanager.drag(this,b),this._trigger("sort",b,this._uiHash()),this.lastPositionAbs=this.positionAbs;return!1},_mouseStop:function(b,c){if(!!b){a.ui.ddmanager&&!this.options.dropBehaviour&&a.ui.ddmanager.drop(this,b);if(this.options.revert){var d=this,e=d.placeholder.offset();d.reverting=!0,a(this.helper).animate({left:e.left-this.offset.parent.left-d.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:e.top-this.offset.parent.top-d.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){d._clear(b)})}else this._clear(b,c);return!1}},cancel:function(){var b=this;if(this.dragging){this._mouseUp({target:null}),this.options.helper=="original"?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var c=this.containers.length-1;c>=0;c--)this.containers[c]._trigger("deactivate",null,b._uiHash(this)),this.containers[c].containerCache.over&&(this.containers[c]._trigger("out",null,b._uiHash(this)),this.containers[c].containerCache.over=0)}this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.options.helper!="original"&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),a.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?a(this.domPosition.prev).after(this.currentItem):a(this.domPosition.parent).prepend(this.currentItem));return this},serialize:function(b){var c=this._getItemsAsjQuery(b&&b.connected),d=[];b=b||{},a(c).each(function(){var c=(a(b.item||this).attr(b.attribute||"id")||"").match(b.expression||/(.+)[-=_](.+)/);c&&d.push((b.key||c[1]+"[]")+"="+(b.key&&b.expression?c[1]:c[2]))}),!d.length&&b.key&&d.push(b.key+"=");return d.join("&")},toArray:function(b){var c=this._getItemsAsjQuery(b&&b.connected),d=[];b=b||{},c.each(function(){d.push(a(b.item||this).attr(b.attribute||"id")||"")});return d},_intersectsWith:function(a){var b=this.positionAbs.left,c=b+this.helperProportions.width,d=this.positionAbs.top,e=d+this.helperProportions.height,f=a.left,g=f+a.width,h=a.top,i=h+a.height,j=this.offset.click.top,k=this.offset.click.left,l=d+j>h&&d+j<i&&b+k>f&&b+k<g;return this.options.tolerance=="pointer"||this.options.forcePointerForContainers||this.options.tolerance!="pointer"&&this.helperProportions[this.floating?"width":"height"]>a[this.floating?"width":"height"]?l:f<b+this.helperProportions.width/2&&c-this.helperProportions.width/2<g&&h<d+this.helperProportions.height/2&&e-this.helperProportions.height/2<i},_intersectsWithPointer:function(b){var c=a.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,b.top,b.height),d=a.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,b.left,b.width),e=c&&d,f=this._getDragVerticalDirection(),g=this._getDragHorizontalDirection();if(!e)return!1;return this.floating?g&&g=="right"||f=="down"?2:1:f&&(f=="down"?2:1)},_intersectsWithSides:function(b){var c=a.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,b.top+b.height/2,b.height),d=a.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,b.left+b.width/2,b.width),e=this._getDragVerticalDirection(),f=this._getDragHorizontalDirection();return this.floating&&f?f=="right"&&d||f=="left"&&!d:e&&(e=="down"&&c||e=="up"&&!c)},_getDragVerticalDirection:function(){var a=this.positionAbs.top-this.lastPositionAbs.top;return a!=0&&(a>0?"down":"up")},_getDragHorizontalDirection:function(){var a=this.positionAbs.left-this.lastPositionAbs.left;return a!=0&&(a>0?"right":"left")},refresh:function(a){this._refreshItems(a),this.refreshPositions();return this},_connectWith:function(){var a=this.options;return a.connectWith.constructor==String?[a.connectWith]:a.connectWith},_getItemsAsjQuery:function(b){var c=this,d=[],e=[],f=this._connectWith();if(f&&b)for(var g=f.length-1;g>=0;g--){var h=a(f[g]);for(var i=h.length-1;i>=0;i--){var j=a.data(h[i],this.widgetName);j&&j!=this&&!j.options.disabled&&e.push([a.isFunction(j.options.items)?j.options.items.call(j.element):a(j.options.items,j.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),j])}}e.push([a.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):a(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]);for(var g=e.length-1;g>=0;g--)e[g][0].each(function(){d.push(this)});return a(d)},_removeCurrentsFromItems:function(){var a=this.currentItem.find(":data("+this.widgetName+"-item)");for(var b=0;b<this.items.length;b++)for(var c=0;c<a.length;c++)a[c]==this.items[b].item[0]&&this.items.splice(b,1)},_refreshItems:function(b){this.items=[],this.containers=[this];var c=this.items,d=this,e=[[a.isFunction(this.options.items)?this.options.items.call(this.element[0],b,{item:this.currentItem}):a(this.options.items,this.element),this]],f=this._connectWith();if(f&&this.ready)for(var g=f.length-1;g>=0;g--){var h=a(f[g]);for(var i=h.length-1;i>=0;i--){var j=a.data(h[i],this.widgetName);j&&j!=this&&!j.options.disabled&&(e.push([a.isFunction(j.options.items)?j.options.items.call(j.element[0],b,{item:this.currentItem}):a(j.options.items,j.element),j]),this.containers.push(j))}}for(var g=e.length-1;g>=0;g--){var k=e[g][1],l=e[g][0];for(var i=0,m=l.length;i<m;i++){var n=a(l[i]);n.data(this.widgetName+"-item",k),c.push({item:n,instance:k,width:0,height:0,left:0,top:0})}}},refreshPositions:function(b){this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());for(var c=this.items.length-1;c>=0;c--){var d=this.items[c];if(d.instance!=this.currentContainer&&this.currentContainer&&d.item[0]!=this.currentItem[0])continue;var e=this.options.toleranceElement?a(this.options.toleranceElement,d.item):d.item;b||(d.width=e.outerWidth(),d.height=e.outerHeight());var f=e.offset();d.left=f.left,d.top=f.top}if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(var c=this.containers.length-1;c>=0;c--){var f=this.containers[c].element.offset();this.containers[c].containerCache.left=f.left,this.containers[c].containerCache.top=f.top,this.containers[c].containerCache.width=this.containers[c].element.outerWidth(),this.containers[c].containerCache.height=this.containers[c].element.outerHeight()}return this},_createPlaceholder:function(b){var c=b||this,d=c.options;if(!d.placeholder||d.placeholder.constructor==String){var e=d.placeholder;d.placeholder={element:function(){var b=a(document.createElement(c.currentItem[0].nodeName)).addClass(e||c.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];e||(b.style.visibility="hidden");return b},update:function(a,b){if(!e||!!d.forcePlaceholderSize)b.height()||b.height(c.currentItem.innerHeight()-parseInt(c.currentItem.css("paddingTop")||0,10)-parseInt(c.currentItem.css("paddingBottom")||0,10)),b.width()||b.width(c.currentItem.innerWidth()-parseInt(c.currentItem.css("paddingLeft")||0,10)-parseInt(c.currentItem.css("paddingRight")||0,10))}}}c.placeholder=a(d.placeholder.element.call(c.element,c.currentItem)),c.currentItem.after(c.placeholder),d.placeholder.update(c,c.placeholder)},_contactContainers:function(b){var c=null,d=null;for(var e=this.containers.length-1;e>=0;e--){if(a.ui.contains(this.currentItem[0],this.containers[e].element[0]))continue;if(this._intersectsWith(this.containers[e].containerCache)){if(c&&a.ui.contains(this.containers[e].element[0],c.element[0]))continue;c=this.containers[e],d=e}else this.containers[e].containerCache.over&&(this.containers[e]._trigger("out",b,this._uiHash(this)),this.containers[e].containerCache.over=0)}if(!!c)if(this.containers.length===1)this.containers[d]._trigger("over",b,this._uiHash(this)),this.containers[d].containerCache.over=1;else if(this.currentContainer!=this.containers[d]){var f=1e4,g=null,h=this.positionAbs[this.containers[d].floating?"left":"top"];for(var i=this.items.length-1;i>=0;i--){if(!a.ui.contains(this.containers[d].element[0],this.items[i].item[0]))continue;var j=this.items[i][this.containers[d].floating?"left":"top"];Math.abs(j-h)<f&&(f=Math.abs(j-h),g=this.items[i])}if(!g&&!this.options.dropOnEmpty)return;this.currentContainer=this.containers[d],g?this._rearrange(b,g,null,!0):this._rearrange(b,null,this.containers[d].element,!0),this._trigger("change",b,this._uiHash()),this.containers[d]._trigger("change",b,this._uiHash(this)),this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[d]._trigger("over",b,this._uiHash(this)),this.containers[d].containerCache.over=1}},_createHelper:function(b){var c=this.options,d=a.isFunction(c.helper)?a(c.helper.apply(this.element[0],[b,this.currentItem])):c.helper=="clone"?this.currentItem.clone():this.currentItem;d.parents("body").length||a(c.appendTo!="parent"?c.appendTo:this.currentItem[0].parentNode)[0].appendChild(d[0]),d[0]==this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(d[0].style.width==""||c.forceHelperSize)&&d.width(this.currentItem.width()),(d[0].style.height==""||c.forceHelperSize)&&d.height(this.currentItem.height());return d},_adjustOffsetFromHelper:function(b){typeof b=="string"&&(b=b.split(" ")),a.isArray(b)&&(b={left:+b[0],top:+b[1]||0}),"left"in b&&(this.offset.click.left=b.left+this.margins.left),"right"in b&&(this.offset.click.left=this.helperProportions.width-b.right+this.margins.left),"top"in b&&(this.offset.click.top=b.top+this.margins.top),"bottom"in b&&(this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var b=this.offsetParent.offset();this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])&&(b.left+=this.scrollParent.scrollLeft(),b.top+=this.scrollParent.scrollTop());if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&a.browser.msie)b={top:0,left:0};return{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=this.currentItem.position();return{top:a.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var b=this.options;b.containment=="parent"&&(b.containment=this.helper[0].parentNode);if(b.containment=="document"||b.containment=="window")this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,a(b.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(a(b.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(b.containment)){var c=a(b.containment)[0],d=a(b.containment).offset(),e=a(c).css("overflow")!="hidden";this.containment=[d.left+(parseInt(a(c).css("borderLeftWidth"),10)||0)+(parseInt(a(c).css("paddingLeft"),10)||0)-this.margins.left,d.top+(parseInt(a(c).css("borderTopWidth"),10)||0)+(parseInt(a(c).css("paddingTop"),10)||0)-this.margins.top,d.left+(e?Math.max(c.scrollWidth,c.offsetWidth):c.offsetWidth)-(parseInt(a(c).css("borderLeftWidth"),10)||0)-(parseInt(a(c).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,d.top+(e?Math.max(c.scrollHeight,c.offsetHeight):c.offsetHeight)-(parseInt(a(c).css("borderTopWidth"),10)||0)-(parseInt(a(c).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}},_convertPositionTo:function(b,c){c||(c=this.position);var d=b=="absolute"?1:-1,e=this.options,f=this.cssPosition=="absolute"&&(this.scrollParent[0]==document||!a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=/(html|body)/i.test(f[0].tagName);return{top:c.top+this.offset.relative.top*d+this.offset.parent.top*d-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():g?0:f.scrollTop())*d),left:c.left+this.offset.relative.left*d+this.offset.parent.left*d-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:f.scrollLeft())*d)}},_generatePosition:function(b){var c=this.options,d=this.cssPosition=="absolute"&&(this.scrollParent[0]==document||!a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,e=/(html|body)/i.test(d[0].tagName);this.cssPosition=="relative"&&(this.scrollParent[0]==document||this.scrollParent[0]==this.offsetParent[0])&&(this.offset.relative=this._getRelativeOffset());var f=b.pageX,g=b.pageY;if(this.originalPosition){this.containment&&(b.pageX-this.offset.click.left<this.containment[0]&&(f=this.containment[0]+this.offset.click.left),b.pageY-this.offset.click.top<this.containment[1]&&(g=this.containment[1]+this.offset.click.top),b.pageX-this.offset.click.left>this.containment[2]&&(f=this.containment[2]+this.offset.click.left),b.pageY-this.offset.click.top>this.containment[3]&&(g=this.containment[3]+this.offset.click.top));if(c.grid){var h=this.originalPageY+Math.round((g-this.originalPageY)/c.grid[1])*c.grid[1];g=this.containment?h-this.offset.click.top<this.containment[1]||h-this.offset.click.top>this.containment[3]?h-this.offset.click.top<this.containment[1]?h+c.grid[1]:h-c.grid[1]:h:h;var i=this.originalPageX+Math.round((f-this.originalPageX)/c.grid[0])*c.grid[0];f=this.containment?i-this.offset.click.left<this.containment[0]||i-this.offset.click.left>this.containment[2]?i-this.offset.click.left<this.containment[0]?i+c.grid[0]:i-c.grid[0]:i:i}}return{top:g-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(a.browser.safari&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollTop():e?0:d.scrollTop()),left:f-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(a.browser.safari&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():e?0:d.scrollLeft())}},_rearrange:function(a,b,c,d){c?c[0].appendChild(this.placeholder[0]):b.item[0].parentNode.insertBefore(this.placeholder[0],this.direction=="down"?b.item[0]:b.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var e=this,f=this.counter;window.setTimeout(function(){f==e.counter&&e.refreshPositions(!d)},0)},_clear:function(b,c){this.reverting=!1;var d=[],e=this;!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null;if(this.helper[0]==this.currentItem[0]){for(var f in this._storedCSS)if(this._storedCSS[f]=="auto"||this._storedCSS[f]=="static")this._storedCSS[f]="";this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();this.fromOutside&&!c&&d.push(function(a){this._trigger("receive",a,this._uiHash(this.fromOutside))}),(this.fromOutside||this.domPosition.prev!=this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!=this.currentItem.parent()[0])&&!c&&d.push(function(a){this._trigger("update",a,this._uiHash())});if(!a.ui.contains(this.element[0],this.currentItem[0])){c||d.push(function(a){this._trigger("remove",a,this._uiHash())});for(var f=this.containers.length-1;f>=0;f--)a.ui.contains(this.containers[f].element[0],this.currentItem[0])&&!c&&(d.push(function(a){return function(b){a._trigger("receive",b,this._uiHash(this))}}.call(this,this.containers[f])),d.push(function(a){return function(b){a._trigger("update",b,this._uiHash(this))}}.call(this,this.containers[f])))}for(var f=this.containers.length-1;f>=0;f--)c||d.push(function(a){return function(b){a._trigger("deactivate",b,this._uiHash(this))}}.call(this,this.containers[f])),this.containers[f].containerCache.over&&(d.push(function(a){return function(b){a._trigger("out",b,this._uiHash(this))}}.call(this,this.containers[f])),this.containers[f].containerCache.over=0);this._storedCursor&&a("body").css("cursor",this._storedCursor),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex),this.dragging=!1;if(this.cancelHelperRemoval){if(!c){this._trigger("beforeStop",b,this._uiHash());for(var f=0;f<d.length;f++)d[f].call(this,b);this._trigger("stop",b,this._uiHash())}return!1}c||this._trigger("beforeStop",b,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.helper[0]!=this.currentItem[0]&&this.helper.remove(),this.helper=null;if(!c){for(var f=0;f<d.length;f++)d[f].call(this,b);this._trigger("stop",b,this._uiHash())}this.fromOutside=!1;return!0},_trigger:function(){a.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(b){var c=b||this;return{helper:c.helper,placeholder:c.placeholder||a([]),position:c.position,originalPosition:c.originalPosition,offset:c.positionAbs,item:c.currentItem,sender:b?b.element:null}}}),a.extend(a.ui.sortable,{version:"1.8.18"})})(jQuery);/*
+ * jQuery UI Accordion 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Accordion
+ *
+ * Depends:
+ * jquery.ui.core.js
+ * jquery.ui.widget.js
+ */(function(a,b){a.widget("ui.accordion",{options:{active:0,animated:"slide",autoHeight:!0,clearStyle:!1,collapsible:!1,event:"click",fillSpace:!1,header:"> li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:!1,navigationFilter:function(){return this.href.toLowerCase()===location.href.toLowerCase()}},_create:function(){var b=this,c=b.options;b.running=0,b.element.addClass("ui-accordion ui-widget ui-helper-reset").children("li").addClass("ui-accordion-li-fix"),b.headers=b.element.find(c.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){c.disabled||a(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){c.disabled||a(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){c.disabled||a(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){c.disabled||a(this).removeClass("ui-state-focus")}),b.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");if(c.navigation){var d=b.element.find("a").filter(c.navigationFilter).eq(0);if(d.length){var e=d.closest(".ui-accordion-header");e.length?b.active=e:b.active=d.closest(".ui-accordion-content").prev()}}b.active=b._findActive(b.active||c.active).addClass("ui-state-default ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top"),b.active.next().addClass("ui-accordion-content-active"),b._createIcons(),b.resize(),b.element.attr("role","tablist"),b.headers.attr("role","tab").bind("keydown.accordion",function(a){return b._keydown(a)}).next().attr("role","tabpanel"),b.headers.not(b.active||"").attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).next().hide(),b.active.length?b.active.attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}):b.headers.eq(0).attr("tabIndex",0),a.browser.safari||b.headers.find("a").attr("tabIndex",-1),c.event&&b.headers.bind(c.event.split(" ").join(".accordion ")+".accordion",function(a){b._clickHandler.call(b,a,this),a.preventDefault()})},_createIcons:function(){var b=this.options;b.icons&&(a("<span></span>").addClass("ui-icon "+b.icons.header).prependTo(this.headers),this.active.children(".ui-icon").toggleClass(b.icons.header).toggleClass(b.icons.headerSelected),this.element.addClass("ui-accordion-icons"))},_destroyIcons:function(){this.headers.children(".ui-icon").remove(),this.element.removeClass("ui-accordion-icons")},destroy:function(){var b=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role"),this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("tabIndex"),this.headers.find("a").removeAttr("tabIndex"),this._destroyIcons();var c=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled");(b.autoHeight||b.fillHeight)&&c.css("height","");return a.Widget.prototype.destroy.call(this)},_setOption:function(b,c){a.Widget.prototype._setOption.apply(this,arguments),b=="active"&&this.activate(c),b=="icons"&&(this._destroyIcons(),c&&this._createIcons()),b=="disabled"&&this.headers.add(this.headers.next())[c?"addClass":"removeClass"]("ui-accordion-disabled ui-state-disabled")},_keydown:function(b){if(!(this.options.disabled||b.altKey||b.ctrlKey)){var c=a.ui.keyCode,d=this.headers.length,e=this.headers.index(b.target),f=!1;switch(b.keyCode){case c.RIGHT:case c.DOWN:f=this.headers[(e+1)%d];break;case c.LEFT:case c.UP:f=this.headers[(e-1+d)%d];break;case c.SPACE:case c.ENTER:this._clickHandler({target:b.target},b.target),b.preventDefault()}if(f){a(b.target).attr("tabIndex",-1),a(f).attr("tabIndex",0),f.focus();return!1}return!0}},resize:function(){var b=this.options,c;if(b.fillSpace){if(a.browser.msie){var d=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden")}c=this.element.parent().height(),a.browser.msie&&this.element.parent().css("overflow",d),this.headers.each(function(){c-=a(this).outerHeight(!0)}),this.headers.next().each(function(){a(this).height(Math.max(0,c-a(this).innerHeight()+a(this).height()))}).css("overflow","auto")}else b.autoHeight&&(c=0,this.headers.next().each(function(){c=Math.max(c,a(this).height("").height())}).height(c));return this},activate:function(a){this.options.active=a;var b=this._findActive(a)[0];this._clickHandler({target:b},b);return this},_findActive:function(b){return b?typeof b=="number"?this.headers.filter(":eq("+b+")"):this.headers.not(this.headers.not(b)):b===!1?a([]):this.headers.filter(":eq(0)")},_clickHandler:function(b,c){var d=this.options;if(!d.disabled){if(!b.target){if(!d.collapsible)return;this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header),this.active.next().addClass("ui-accordion-content-active");var e=this.active.next(),f={options:d,newHeader:a([]),oldHeader:d.active,newContent:a([]),oldContent:e},g=this.active=a([]);this._toggle(g,e,f);return}var h=a(b.currentTarget||c),i=h[0]===this.active[0];d.active=d.collapsible&&i?!1:this.headers.index(h);if(this.running||!d.collapsible&&i)return;var j=this.active,g=h.next(),e=this.active.next(),f={options:d,newHeader:i&&d.collapsible?a([]):h,oldHeader:this.active,newContent:i&&d.collapsible?a([]):g,oldContent:e},k=this.headers.index(this.active[0])>this.headers.index(h[0]);this.active=i?a([]):h,this._toggle(g,e,f,i,k),j.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header),i||(h.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").children(".ui-icon").removeClass(d.icons.header).addClass(d.icons.headerSelected),h.next().addClass("ui-accordion-content-active"));return}},_toggle:function(b,c,d,e,f){var g=this,h=g.options;g.toShow=b,g.toHide=c,g.data=d;var i=function(){if(!!g)return g._completed.apply(g,arguments)};g._trigger("changestart",null,g.data),g.running=c.size()===0?b.size():c.size();if(h.animated){var j={};h.collapsible&&e?j={toShow:a([]),toHide:c,complete:i,down:f,autoHeight:h.autoHeight||h.fillSpace}:j={toShow:b,toHide:c,complete:i,down:f,autoHeight:h.autoHeight||h.fillSpace},h.proxied||(h.proxied=h.animated),h.proxiedDuration||(h.proxiedDuration=h.duration),h.animated=a.isFunction(h.proxied)?h.proxied(j):h.proxied,h.duration=a.isFunction(h.proxiedDuration)?h.proxiedDuration(j):h.proxiedDuration;var k=a.ui.accordion.animations,l=h.duration,m=h.animated;m&&!k[m]&&!a.easing[m]&&(m="slide"),k[m]||(k[m]=function(a){this.slide(a,{easing:m,duration:l||700})}),k[m](j)}else h.collapsible&&e?b.toggle():(c.hide(),b.show()),i(!0);c.prev().attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).blur(),b.prev().attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}).focus()},_completed:function(a){this.running=a?0:--this.running;this.running||(this.options.clearStyle&&this.toShow.add(this.toHide).css({height:"",overflow:""}),this.toHide.removeClass("ui-accordion-content-active"),this.toHide.length&&(this.toHide.parent()[0].className=this.toHide.parent()[0].className),this._trigger("change",null,this.data))}}),a.extend(a.ui.accordion,{version:"1.8.18",animations:{slide:function(b,c){b=a.extend({easing:"swing",duration:300},b,c);if(!b.toHide.size())b.toShow.animate({height:"show",paddingTop:"show",paddingBottom:"show"},b);else{if(!b.toShow.size()){b.toHide.animate({height:"hide",paddingTop:"hide",paddingBottom:"hide"},b);return}var d=b.toShow.css("overflow"),e=0,f={},g={},h=["height","paddingTop","paddingBottom"],i,j=b.toShow;i=j[0].style.width,j.width(j.parent().width()-parseFloat(j.css("paddingLeft"))-parseFloat(j.css("paddingRight"))-(parseFloat(j.css("borderLeftWidth"))||0)-(parseFloat(j.css("borderRightWidth"))||0)),a.each(h,function(c,d){g[d]="hide";var e=(""+a.css(b.toShow[0],d)).match(/^([\d+-.]+)(.*)$/);f[d]={value:e[1],unit:e[2]||"px"}}),b.toShow.css({height:0,overflow:"hidden"}).show(),b.toHide.filter(":hidden").each(b.complete).end().filter(":visible").animate(g,{step:function(a,c){c.prop=="height"&&(e=c.end-c.start===0?0:(c.now-c.start)/(c.end-c.start)),b.toShow[0].style[c.prop]=e*f[c.prop].value+f[c.prop].unit},duration:b.duration,easing:b.easing,complete:function(){b.autoHeight||b.toShow.css("height",""),b.toShow.css({width:i,overflow:d}),b.complete()}})}},bounceslide:function(a){this.slide(a,{easing:a.down?"easeOutBounce":"swing",duration:a.down?1e3:200})}}})})(jQuery);/*
+ * jQuery UI Autocomplete 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Autocomplete
+ *
+ * Depends:
+ * jquery.ui.core.js
+ * jquery.ui.widget.js
+ * jquery.ui.position.js
+ */(function(a,b){var c=0;a.widget("ui.autocomplete",{options:{appendTo:"body",autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null},pending:0,_create:function(){var b=this,c=this.element[0].ownerDocument,d;this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(c){if(!b.options.disabled&&!b.element.propAttr("readOnly")){d=!1;var e=a.ui.keyCode;switch(c.keyCode){case e.PAGE_UP:b._move("previousPage",c);break;case e.PAGE_DOWN:b._move("nextPage",c);break;case e.UP:b._move("previous",c),c.preventDefault();break;case e.DOWN:b._move("next",c),c.preventDefault();break;case e.ENTER:case e.NUMPAD_ENTER:b.menu.active&&(d=!0,c.preventDefault());case e.TAB:if(!b.menu.active)return;b.menu.select(c);break;case e.ESCAPE:b.element.val(b.term),b.close(c);break;default:clearTimeout(b.searching),b.searching=setTimeout(function(){b.term!=b.element.val()&&(b.selectedItem=null,b.search(null,c))},b.options.delay)}}}).bind("keypress.autocomplete",function(a){d&&(d=!1,a.preventDefault())}).bind("focus.autocomplete",function(){b.options.disabled||(b.selectedItem=null,b.previous=b.element.val())}).bind("blur.autocomplete",function(a){b.options.disabled||(clearTimeout(b.searching),b.closing=setTimeout(function(){b.close(a),b._change(a)},150))}),this._initSource(),this.response=function(){return b._response.apply(b,arguments)},this.menu=a("<ul></ul>").addClass("ui-autocomplete").appendTo(a(this.options.appendTo||"body",c)[0]).mousedown(function(c){var d=b.menu.element[0];a(c.target).closest(".ui-menu-item").length||setTimeout(function(){a(document).one("mousedown",function(c){c.target!==b.element[0]&&c.target!==d&&!a.ui.contains(d,c.target)&&b.close()})},1),setTimeout(function(){clearTimeout(b.closing)},13)}).menu({focus:function(a,c){var d=c.item.data("item.autocomplete");!1!==b._trigger("focus",a,{item:d})&&/^key/.test(a.originalEvent.type)&&b.element.val(d.value)},selected:function(a,d){var e=d.item.data("item.autocomplete"),f=b.previous;b.element[0]!==c.activeElement&&(b.element.focus(),b.previous=f,setTimeout(function(){b.previous=f,b.selectedItem=e},1)),!1!==b._trigger("select",a,{item:e})&&b.element.val(e.value),b.term=b.element.val(),b.close(a),b.selectedItem=e},blur:function(a,c){b.menu.element.is(":visible")&&b.element.val()!==b.term&&b.element.val(b.term)}}).zIndex(this.element.zIndex()+1).css({top:0,left:0}).hide().data("menu"),a.fn.bgiframe&&this.menu.element.bgiframe(),b.beforeunloadHandler=function(){b.element.removeAttr("autocomplete")},a(window).bind("beforeunload",b.beforeunloadHandler)},destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup"),this.menu.element.remove(),a(window).unbind("beforeunload",this.beforeunloadHandler),a.Widget.prototype.destroy.call(this)},_setOption:function(b,c){a.Widget.prototype._setOption.apply(this,arguments),b==="source"&&this._initSource(),b==="appendTo"&&this.menu.element.appendTo(a(c||"body",this.element[0].ownerDocument)[0]),b==="disabled"&&c&&this.xhr&&this.xhr.abort()},_initSource:function(){var b=this,d,e;a.isArray(this.options.source)?(d=this.options.source,this.source=function(b,c){c(a.ui.autocomplete.filter(d,b.term))}):typeof this.options.source=="string"?(e=this.options.source,this.source=function(d,f){b.xhr&&b.xhr.abort(),b.xhr=a.ajax({url:e,data:d,dataType:"json",context:{autocompleteRequest:++c},success:function(a,b){this.autocompleteRequest===c&&f(a)},error:function(){this.autocompleteRequest===c&&f([])}})}):this.source=this.options.source},search:function(a,b){a=a!=null?a:this.element.val(),this.term=this.element.val();if(a.length<this.options.minLength)return this.close(b);clearTimeout(this.closing);if(this._trigger("search",b)!==!1)return this._search(a)},_search:function(a){this.pending++,this.element.addClass("ui-autocomplete-loading"),this.source({term:a},this.response)},_response:function(a){!this.options.disabled&&a&&a.length?(a=this._normalize(a),this._suggest(a),this._trigger("open")):this.close(),this.pending--,this.pending||this.element.removeClass("ui-autocomplete-loading")},close:function(a){clearTimeout(this.closing),this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.deactivate(),this._trigger("close",a))},_change:function(a){this.previous!==this.element.val()&&this._trigger("change",a,{item:this.selectedItem})},_normalize:function(b){if(b.length&&b[0].label&&b[0].value)return b;return a.map(b,function(b){if(typeof b=="string")return{label:b,value:b};return a.extend({label:b.label||b.value,value:b.value||b.label},b)})},_suggest:function(b){var c=this.menu.element.empty().zIndex(this.element.zIndex()+1);this._renderMenu(c,b),this.menu.deactivate(),this.menu.refresh(),c.show(),this._resizeMenu(),c.position(a.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next(new a.Event("mouseover"))},_resizeMenu:function(){var a=this.menu.element;a.outerWidth(Math.max(a.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(b,c){var d=this;a.each(c,function(a,c){d._renderItem(b,c)})},_renderItem:function(b,c){return a("<li></li>").data("item.autocomplete",c).append(a("<a></a>").text(c.label)).appendTo(b)},_move:function(a,b){if(!this.menu.element.is(":visible"))this.search(null,b);else{if(this.menu.first()&&/^previous/.test(a)||this.menu.last()&&/^next/.test(a)){this.element.val(this.term),this.menu.deactivate();return}this.menu[a](b)}},widget:function(){return this.menu.element}}),a.extend(a.ui.autocomplete,{escapeRegex:function(a){return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")},filter:function(b,c){var d=new RegExp(a.ui.autocomplete.escapeRegex(c),"i");return a.grep(b,function(a){return d.test(a.label||a.value||a)})}})})(jQuery),function(a){a.widget("ui.menu",{_create:function(){var b=this;this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({role:"listbox","aria-activedescendant":"ui-active-menuitem"}).click(function(c){!a(c.target).closest(".ui-menu-item a").length||(c.preventDefault(),b.select(c))}),this.refresh()},refresh:function(){var b=this,c=this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","menuitem");c.children("a").addClass("ui-corner-all").attr("tabindex",-1).mouseenter(function(c){b.activate(c,a(this).parent())}).mouseleave(function(){b.deactivate()})},activate:function(a,b){this.deactivate();if(this.hasScroll()){var c=b.offset().top-this.element.offset().top,d=this.element.scrollTop(),e=this.element.height();c<0?this.element.scrollTop(d+c):c>=e&&this.element.scrollTop(d+c-e+b.height())}this.active=b.eq(0).children("a").addClass("ui-state-hover").attr("id","ui-active-menuitem").end(),this._trigger("focus",a,{item:b})},deactivate:function(){!this.active||(this.active.children("a").removeClass("ui-state-hover").removeAttr("id"),this._trigger("blur"),this.active=null)},next:function(a){this.move("next",".ui-menu-item:first",a)},previous:function(a){this.move("prev",".ui-menu-item:last",a)},first:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},last:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},move:function(a,b,c){if(!this.active)this.activate(c,this.element.children(b));else{var d=this.active[a+"All"](".ui-menu-item").eq(0);d.length?this.activate(c,d):this.activate(c,this.element.children(b))}},nextPage:function(b){if(this.hasScroll()){if(!this.active||this.last()){this.activate(b,this.element.children(".ui-menu-item:first"));return}var c=this.active.offset().top,d=this.element.height(),e=this.element.children(".ui-menu-item").filter(function(){var b=a(this).offset().top-c-d+a(this).height();return b<10&&b>-10});e.length||(e=this.element.children(".ui-menu-item:last")),this.activate(b,e)}else this.activate(b,this.element.children(".ui-menu-item").filter(!this.active||this.last()?":first":":last"))},previousPage:function(b){if(this.hasScroll()){if(!this.active||this.first()){this.activate(b,this.element.children(".ui-menu-item:last"));return}var c=this.active.offset().top,d=this.element.height();result=this.element.children(".ui-menu-item").filter(function(){var b=a(this).offset().top-c+d-a(this).height();return b<10&&b>-10}),result.length||(result=this.element.children(".ui-menu-item:first")),this.activate(b,result)}else this.activate(b,this.element.children(".ui-menu-item").filter(!this.active||this.first()?":last":":first"))},hasScroll:function(){return this.element.height()<this.element[a.fn.prop?"prop":"attr"]("scrollHeight")},select:function(a){this._trigger("selected",a,{item:this.active})}})}(jQuery);/*
+ * jQuery UI Button 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Button
+ *
+ * Depends:
+ * jquery.ui.core.js
+ * jquery.ui.widget.js
+ */(function(a,b){var c,d,e,f,g="ui-button ui-widget ui-state-default ui-corner-all",h="ui-state-hover ui-state-active ",i="ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",j=function(){var b=a(this).find(":ui-button");setTimeout(function(){b.button("refresh")},1)},k=function(b){var c=b.name,d=b.form,e=a([]);c&&(d?e=a(d).find("[name='"+c+"']"):e=a("[name='"+c+"']",b.ownerDocument).filter(function(){return!this.form}));return e};a.widget("ui.button",{options:{disabled:null,text:!0,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset.button").bind("reset.button",j),typeof this.options.disabled!="boolean"?this.options.disabled=!!this.element.propAttr("disabled"):this.element.propAttr("disabled",this.options.disabled),this._determineButtonType(),this.hasTitle=!!this.buttonElement.attr("title");var b=this,h=this.options,i=this.type==="checkbox"||this.type==="radio",l="ui-state-hover"+(i?"":" ui-state-active"),m="ui-state-focus";h.label===null&&(h.label=this.buttonElement.html()),this.buttonElement.addClass(g).attr("role","button").bind("mouseenter.button",function(){h.disabled||(a(this).addClass("ui-state-hover"),this===c&&a(this).addClass("ui-state-active"))}).bind("mouseleave.button",function(){h.disabled||a(this).removeClass(l)}).bind("click.button",function(a){h.disabled&&(a.preventDefault(),a.stopImmediatePropagation())}),this.element.bind("focus.button",function(){b.buttonElement.addClass(m)}).bind("blur.button",function(){b.buttonElement.removeClass(m)}),i&&(this.element.bind("change.button",function(){f||b.refresh()}),this.buttonElement.bind("mousedown.button",function(a){h.disabled||(f=!1,d=a.pageX,e=a.pageY)}).bind("mouseup.button",function(a){!h.disabled&&(d!==a.pageX||e!==a.pageY)&&(f=!0)})),this.type==="checkbox"?this.buttonElement.bind("click.button",function(){if(h.disabled||f)return!1;a(this).toggleClass("ui-state-active"),b.buttonElement.attr("aria-pressed",b.element[0].checked)}):this.type==="radio"?this.buttonElement.bind("click.button",function(){if(h.disabled||f)return!1;a(this).addClass("ui-state-active"),b.buttonElement.attr("aria-pressed","true");var c=b.element[0];k(c).not(c).map(function(){return a(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed","false")}):(this.buttonElement.bind("mousedown.button",function(){if(h.disabled)return!1;a(this).addClass("ui-state-active"),c=this,a(document).one("mouseup",function(){c=null})}).bind("mouseup.button",function(){if(h.disabled)return!1;a(this).removeClass("ui-state-active")}).bind("keydown.button",function(b){if(h.disabled)return!1;(b.keyCode==a.ui.keyCode.SPACE||b.keyCode==a.ui.keyCode.ENTER)&&a(this).addClass("ui-state-active")}).bind("keyup.button",function(){a(this).removeClass("ui-state-active")}),this.buttonElement.is("a")&&this.buttonElement.keyup(function(b){b.keyCode===a.ui.keyCode.SPACE&&a(this).click()})),this._setOption("disabled",h.disabled),this._resetButton()},_determineButtonType:function(){this.element.is(":checkbox")?this.type="checkbox":this.element.is(":radio")?this.type="radio":this.element.is("input")?this.type="input":this.type="button";if(this.type==="checkbox"||this.type==="radio"){var a=this.element.parents().filter(":last"),b="label[for='"+this.element.attr("id")+"']";this.buttonElement=a.find(b),this.buttonElement.length||(a=a.length?a.siblings():this.element.siblings(),this.buttonElement=a.filter(b),this.buttonElement.length||(this.buttonElement=a.find(b))),this.element.addClass("ui-helper-hidden-accessible");var c=this.element.is(":checked");c&&this.buttonElement.addClass("ui-state-active"),this.buttonElement.attr("aria-pressed",c)}else this.buttonElement=this.element},widget:function(){return this.buttonElement},destroy:function(){this.element.removeClass("ui-helper-hidden-accessible"),this.buttonElement.removeClass(g+" "+h+" "+i).removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html()),this.hasTitle||this.buttonElement.removeAttr("title"),a.Widget.prototype.destroy.call(this)},_setOption:function(b,c){a.Widget.prototype._setOption.apply(this,arguments);b==="disabled"?c?this.element.propAttr("disabled",!0):this.element.propAttr("disabled",!1):this._resetButton()},refresh:function(){var b=this.element.is(":disabled");b!==this.options.disabled&&this._setOption("disabled",b),this.type==="radio"?k(this.element[0]).each(function(){a(this).is(":checked")?a(this).button("widget").addClass("ui-state-active").attr("aria-pressed","true"):a(this).button("widget").removeClass("ui-state-active").attr("aria-pressed","false")}):this.type==="checkbox"&&(this.element.is(":checked")?this.buttonElement.addClass("ui-state-active").attr("aria-pressed","true"):this.buttonElement.removeClass("ui-state-active").attr("aria-pressed","false"))},_resetButton:function(){if(this.type==="input")this.options.label&&this.element.val(this.options.label);else{var b=this.buttonElement.removeClass(i),c=a("<span></span>",this.element[0].ownerDocument).addClass("ui-button-text").html(this.options.label).appendTo(b.empty()).text(),d=this.options.icons,e=d.primary&&d.secondary,f=[];d.primary||d.secondary?(this.options.text&&f.push("ui-button-text-icon"+(e?"s":d.primary?"-primary":"-secondary")),d.primary&&b.prepend("<span class='ui-button-icon-primary ui-icon "+d.primary+"'></span>"),d.secondary&&b.append("<span class='ui-button-icon-secondary ui-icon "+d.secondary+"'></span>"),this.options.text||(f.push(e?"ui-button-icons-only":"ui-button-icon-only"),this.hasTitle||b.attr("title",c))):f.push("ui-button-text-only"),b.addClass(f.join(" "))}}}),a.widget("ui.buttonset",{options:{items:":button, :submit, :reset, :checkbox, :radio, a, :data(button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(b,c){b==="disabled"&&this.buttons.button("option",b,c),a.Widget.prototype._setOption.apply(this,arguments)},refresh:function(){var b=this.element.css("direction")==="rtl";this.buttons=this.element.find(this.options.items).filter(":ui-button").button("refresh").end().not(":ui-button").button().end().map(function(){return a(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(b?"ui-corner-right":"ui-corner-left").end().filter(":last").addClass(b?"ui-corner-left":"ui-corner-right").end().end()},destroy:function(){this.element.removeClass("ui-buttonset"),this.buttons.map(function(){return a(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy"),a.Widget.prototype.destroy.call(this)}})})(jQuery);/*
+ * jQuery UI Dialog 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Dialog
+ *
+ * Depends:
+ * jquery.ui.core.js
+ * jquery.ui.widget.js
+ * jquery.ui.button.js
+ * jquery.ui.draggable.js
+ * jquery.ui.mouse.js
+ * jquery.ui.position.js
+ * jquery.ui.resizable.js
+ */(function(a,b){var c="ui-dialog ui-widget ui-widget-content ui-corner-all ",d={buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},e={maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0},f=a.attrFn||{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0,click:!0};a.widget("ui.dialog",{options:{autoOpen:!0,buttons:{},closeOnEscape:!0,closeText:"close",dialogClass:"",draggable:!0,hide:null,height:"auto",maxHeight:!1,maxWidth:!1,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",collision:"fit",using:function(b){var c=a(this).css(b).offset().top;c<0&&a(this).css("top",b.top-c)}},resizable:!0,show:null,stack:!0,title:"",width:300,zIndex:1e3},_create:function(){this.originalTitle=this.element.attr("title"),typeof this.originalTitle!="string"&&(this.originalTitle=""),this.options.title=this.options.title||this.originalTitle;var b=this,d=b.options,e=d.title||"&#160;",f=a.ui.dialog.getTitleId(b.element),g=(b.uiDialog=a("<div></div>")).appendTo(document.body).hide().addClass(c+d.dialogClass).css({zIndex:d.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(c){d.closeOnEscape&&!c.isDefaultPrevented()&&c.keyCode&&c.keyCode===a.ui.keyCode.ESCAPE&&(b.close(c),c.preventDefault())}).attr({role:"dialog","aria-labelledby":f}).mousedown(function(a){b.moveToTop(!1,a)}),h=b.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(g),i=(b.uiDialogTitlebar=a("<div></div>")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(g),j=a('<a href="#"></a>').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){j.addClass("ui-state-hover")},function(){j.removeClass("ui-state-hover")}).focus(function(){j.addClass("ui-state-focus")}).blur(function(){j.removeClass("ui-state-focus")}).click(function(a){b.close(a);return!1}).appendTo(i),k=(b.uiDialogTitlebarCloseText=a("<span></span>")).addClass("ui-icon ui-icon-closethick").text(d.closeText).appendTo(j),l=a("<span></span>").addClass("ui-dialog-title").attr("id",f).html(e).prependTo(i);a.isFunction(d.beforeclose)&&!a.isFunction(d.beforeClose)&&(d.beforeClose=d.beforeclose),i.find("*").add(i).disableSelection(),d.draggable&&a.fn.draggable&&b._makeDraggable(),d.resizable&&a.fn.resizable&&b._makeResizable(),b._createButtons(d.buttons),b._isOpen=!1,a.fn.bgiframe&&g.bgiframe()},_init:function(){this.options.autoOpen&&this.open()},destroy:function(){var a=this;a.overlay&&a.overlay.destroy(),a.uiDialog.hide(),a.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body"),a.uiDialog.remove(),a.originalTitle&&a.element.attr("title",a.originalTitle);return a},widget:function(){return this.uiDialog},close:function(b){var c=this,d,e;if(!1!==c._trigger("beforeClose",b)){c.overlay&&c.overlay.destroy(),c.uiDialog.unbind("keypress.ui-dialog"),c._isOpen=!1,c.options.hide?c.uiDialog.hide(c.options.hide,function(){c._trigger("close",b)}):(c.uiDialog.hide(),c._trigger("close",b)),a.ui.dialog.overlay.resize(),c.options.modal&&(d=0,a(".ui-dialog").each(function(){this!==c.uiDialog[0]&&(e=a(this).css("z-index"),isNaN(e)||(d=Math.max(d,e)))}),a.ui.dialog.maxZ=d);return c}},isOpen:function(){return this._isOpen},moveToTop:function(b,c){var d=this,e=d.options,f;if(e.modal&&!b||!e.stack&&!e.modal)return d._trigger("focus",c);e.zIndex>a.ui.dialog.maxZ&&(a.ui.dialog.maxZ=e.zIndex),d.overlay&&(a.ui.dialog.maxZ+=1,d.overlay.$el.css("z-index",a.ui.dialog.overlay.maxZ=a.ui.dialog.maxZ)),f={scrollTop:d.element.scrollTop(),scrollLeft:d.element.scrollLeft()},a.ui.dialog.maxZ+=1,d.uiDialog.css("z-index",a.ui.dialog.maxZ),d.element.attr(f),d._trigger("focus",c);return d},open:function(){if(!this._isOpen){var b=this,c=b.options,d=b.uiDialog;b.overlay=c.modal?new a.ui.dialog.overlay(b):null,b._size(),b._position(c.position),d.show(c.show),b.moveToTop(!0),c.modal&&d.bind("keydown.ui-dialog",function(b){if(b.keyCode===a.ui.keyCode.TAB){var c=a(":tabbable",this),d=c.filter(":first"),e=c.filter(":last");if(b.target===e[0]&&!b.shiftKey){d.focus(1);return!1}if(b.target===d[0]&&b.shiftKey){e.focus(1);return!1}}}),a(b.element.find(":tabbable").get().concat(d.find(".ui-dialog-buttonpane :tabbable").get().concat(d.get()))).eq(0).focus(),b._isOpen=!0,b._trigger("open");return b}},_createButtons:function(b){var c=this,d=!1,e=a("<div></div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),g=a("<div></div>").addClass("ui-dialog-buttonset").appendTo(e);c.uiDialog.find(".ui-dialog-buttonpane").remove(),typeof b=="object"&&b!==null&&a.each(b,function(){return!(d=!0)}),d&&(a.each(b,function(b,d){d=a.isFunction(d)?{click:d,text:b}:d;var e=a('<button type="button"></button>').click(function(){d.click.apply(c.element[0],arguments)}).appendTo(g);a.each(d,function(a,b){a!=="click"&&(a in f?e[a](b):e.attr(a,b))}),a.fn.button&&e.button()}),e.appendTo(c.uiDialog))},_makeDraggable:function(){function f(a){return{position:a.position,offset:a.offset}}var b=this,c=b.options,d=a(document),e;b.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(d,g){e=c.height==="auto"?"auto":a(this).height(),a(this).height(a(this).height()).addClass("ui-dialog-dragging"),b._trigger("dragStart",d,f(g))},drag:function(a,c){b._trigger("drag",a,f(c))},stop:function(g,h){c.position=[h.position.left-d.scrollLeft(),h.position.top-d.scrollTop()],a(this).removeClass("ui-dialog-dragging").height(e),b._trigger("dragStop",g,f(h)),a.ui.dialog.overlay.resize()}})},_makeResizable:function(c){function h(a){return{originalPosition:a.originalPosition,originalSize:a.originalSize,position:a.position,size:a.size}}c=c===b?this.options.resizable:c;var d=this,e=d.options,f=d.uiDialog.css("position"),g=typeof c=="string"?c:"n,e,s,w,se,sw,ne,nw";d.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:d.element,maxWidth:e.maxWidth,maxHeight:e.maxHeight,minWidth:e.minWidth,minHeight:d._minHeight(),handles:g,start:function(b,c){a(this).addClass("ui-dialog-resizing"),d._trigger("resizeStart",b,h(c))},resize:function(a,b){d._trigger("resize",a,h(b))},stop:function(b,c){a(this).removeClass("ui-dialog-resizing"),e.height=a(this).height(),e.width=a(this).width(),d._trigger("resizeStop",b,h(c)),a.ui.dialog.overlay.resize()}}).css("position",f).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_minHeight:function(){var a=this.options;return a.height==="auto"?a.minHeight:Math.min(a.minHeight,a.height)},_position:function(b){var c=[],d=[0,0],e;if(b){if(typeof b=="string"||typeof b=="object"&&"0"in b)c=b.split?b.split(" "):[b[0],b[1]],c.length===1&&(c[1]=c[0]),a.each(["left","top"],function(a,b){+c[a]===c[a]&&(d[a]=c[a],c[a]=b)}),b={my:c.join(" "),at:c.join(" "),offset:d.join(" ")};b=a.extend({},a.ui.dialog.prototype.options.position,b)}else b=a.ui.dialog.prototype.options.position;e=this.uiDialog.is(":visible"),e||this.uiDialog.show(),this.uiDialog.css({top:0,left:0}).position(a.extend({of:window},b)),e||this.uiDialog.hide()},_setOptions:function(b){var c=this,f={},g=!1;a.each(b,function(a,b){c._setOption(a,b),a in d&&(g=!0),a in e&&(f[a]=b)}),g&&this._size(),this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option",f)},_setOption:function(b,d){var e=this,f=e.uiDialog;switch(b){case"beforeclose":b="beforeClose";break;case"buttons":e._createButtons(d);break;case"closeText":e.uiDialogTitlebarCloseText.text(""+d);break;case"dialogClass":f.removeClass(e.options.dialogClass).addClass(c+d);break;case"disabled":d?f.addClass("ui-dialog-disabled"):f.removeClass("ui-dialog-disabled");break;case"draggable":var g=f.is(":data(draggable)");g&&!d&&f.draggable("destroy"),!g&&d&&e._makeDraggable();break;case"position":e._position(d);break;case"resizable":var h=f.is(":data(resizable)");h&&!d&&f.resizable("destroy"),h&&typeof d=="string"&&f.resizable("option","handles",d),!h&&d!==!1&&e._makeResizable(d);break;case"title":a(".ui-dialog-title",e.uiDialogTitlebar).html(""+(d||"&#160;"))}a.Widget.prototype._setOption.apply(e,arguments)},_size:function(){var b=this.options,c,d,e=this.uiDialog.is(":visible");this.element.show().css({width:"auto",minHeight:0,height:0}),b.minWidth>b.width&&(b.width=b.minWidth),c=this.uiDialog.css({height:"auto",width:b.width}).height(),d=Math.max(0,b.minHeight-c);if(b.height==="auto")if(a.support.minHeight)this.element.css({minHeight:d,height:"auto"});else{this.uiDialog.show();var f=this.element.css("height","auto").height();e||this.uiDialog.hide(),this.element.height(Math.max(f,d))}else this.element.height(Math.max(b.height-c,0));this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())}}),a.extend(a.ui.dialog,{version:"1.8.18",uuid:0,maxZ:0,getTitleId:function(a){var b=a.attr("id");b||(this.uuid+=1,b=this.uuid);return"ui-dialog-title-"+b},overlay:function(b){this.$el=a.ui.dialog.overlay.create(b)}}),a.extend(a.ui.dialog.overlay,{instances:[],oldInstances:[],maxZ:0,events:a.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(a){return a+".dialog-overlay"}).join(" "),create:function(b){this.instances.length===0&&(setTimeout(function(){a.ui.dialog.overlay.instances.length&&a(document).bind(a.ui.dialog.overlay.events,function(b){if(a(b.target).zIndex()<a.ui.dialog.overlay.maxZ)return!1})},1),a(document).bind("keydown.dialog-overlay",function(c){b.options.closeOnEscape&&!c.isDefaultPrevented()&&c.keyCode&&c.keyCode===a.ui.keyCode.ESCAPE&&(b.close(c),c.preventDefault())}),a(window).bind("resize.dialog-overlay",a.ui.dialog.overlay.resize));var c=(this.oldInstances.pop()||a("<div></div>").addClass("ui-widget-overlay")).appendTo(document.body).css({width:this.width(),height:this.height()});a.fn.bgiframe&&c.bgiframe(),this.instances.push(c);return c},destroy:function(b){var c=a.inArray(b,this.instances);c!=-1&&this.oldInstances.push(this.instances.splice(c,1)[0]),this.instances.length===0&&a([document,window]).unbind(".dialog-overlay"),b.remove();var d=0;a.each(this.instances,function(){d=Math.max(d,this.css("z-index"))}),this.maxZ=d},height:function(){var b,c;if(a.browser.msie&&a.browser.version<7){b=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight),c=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);return b<c?a(window).height()+"px":b+"px"}return a(document).height()+"px"},width:function(){var b,c;if(a.browser.msie){b=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth),c=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth);return b<c?a(window).width()+"px":b+"px"}return a(document).width()+"px"},resize:function(){var b=a([]);a.each(a.ui.dialog.overlay.instances,function(){b=b.add(this)}),b.css({width:0,height:0}).css({width:a.ui.dialog.overlay.width(),height:a.ui.dialog.overlay.height()})}}),a.extend(a.ui.dialog.overlay.prototype,{destroy:function(){a.ui.dialog.overlay.destroy(this.$el)}})})(jQuery);/*
+ * jQuery UI Slider 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Slider
+ *
+ * Depends:
+ * jquery.ui.core.js
+ * jquery.ui.mouse.js
+ * jquery.ui.widget.js
+ */(function(a,b){var c=5;a.widget("ui.slider",a.ui.mouse,{widgetEventPrefix:"slide",options:{animate:!1,distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null},_create:function(){var b=this,d=this.options,e=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),f="<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>",g=d.values&&d.values.length||1,h=[];this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget"+" ui-widget-content"+" ui-corner-all"+(d.disabled?" ui-slider-disabled ui-disabled":"")),this.range=a([]),d.range&&(d.range===!0&&(d.values||(d.values=[this._valueMin(),this._valueMin()]),d.values.length&&d.values.length!==2&&(d.values=[d.values[0],d.values[0]])),this.range=a("<div></div>").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+(d.range==="min"||d.range==="max"?" ui-slider-range-"+d.range:"")));for(var i=e.length;i<g;i+=1)h.push(f);this.handles=e.add(a(h.join("")).appendTo(b.element)),this.handle=this.handles.eq(0),this.handles.add(this.range).filter("a").click(function(a){a.preventDefault()}).hover(function(){d.disabled||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")}).focus(function(){d.disabled?a(this).blur():(a(".ui-slider .ui-state-focus").removeClass("ui-state-focus"),a(this).addClass("ui-state-focus"))}).blur(function(){a(this).removeClass("ui-state-focus")}),this.handles.each(function(b){a(this).data("index.ui-slider-handle",b)}),this.handles.keydown(function(d){var e=a(this).data("index.ui-slider-handle"),f,g,h,i;if(!b.options.disabled){switch(d.keyCode){case a.ui.keyCode.HOME:case a.ui.keyCode.END:case a.ui.keyCode.PAGE_UP:case a.ui.keyCode.PAGE_DOWN:case a.ui.keyCode.UP:case a.ui.keyCode.RIGHT:case a.ui.keyCode.DOWN:case a.ui.keyCode.LEFT:d.preventDefault();if(!b._keySliding){b._keySliding=!0,a(this).addClass("ui-state-active"),f=b._start(d,e);if(f===!1)return}}i=b.options.step,b.options.values&&b.options.values.length?g=h=b.values(e):g=h=b.value();switch(d.keyCode){case a.ui.keyCode.HOME:h=b._valueMin();break;case a.ui.keyCode.END:h=b._valueMax();break;case a.ui.keyCode.PAGE_UP:h=b._trimAlignValue(g+(b._valueMax()-b._valueMin())/c);break;case a.ui.keyCode.PAGE_DOWN:h=b._trimAlignValue(g-(b._valueMax()-b._valueMin())/c);break;case a.ui.keyCode.UP:case a.ui.keyCode.RIGHT:if(g===b._valueMax())return;h=b._trimAlignValue(g+i);break;case a.ui.keyCode.DOWN:case a.ui.keyCode.LEFT:if(g===b._valueMin())return;h=b._trimAlignValue(g-i)}b._slide(d,e,h)}}).keyup(function(c){var d=a(this).data("index.ui-slider-handle");b._keySliding&&(b._keySliding=!1,b._stop(c,d),b._change(c,d),a(this).removeClass("ui-state-active"))}),this._refreshValue(),this._animateOff=!1},destroy:function(){this.handles.remove(),this.range.remove(),this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider"),this._mouseDestroy();return this},_mouseCapture:function(b){var c=this.options,d,e,f,g,h,i,j,k,l;if(c.disabled)return!1;this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),d={x:b.pageX,y:b.pageY},e=this._normValueFromMouse(d),f=this._valueMax()-this._valueMin()+1,h=this,this.handles.each(function(b){var c=Math.abs(e-h.values(b));f>c&&(f=c,g=a(this),i=b)}),c.range===!0&&this.values(1)===c.min&&(i+=1,g=a(this.handles[i])),j=this._start(b,i);if(j===!1)return!1;this._mouseSliding=!0,h._handleIndex=i,g.addClass("ui-state-active").focus(),k=g.offset(),l=!a(b.target).parents().andSelf().is(".ui-slider-handle"),this._clickOffset=l?{left:0,top:0}:{left:b.pageX-k.left-g.width()/2,top:b.pageY-k.top-g.height()/2-(parseInt(g.css("borderTopWidth"),10)||0)-(parseInt(g.css("borderBottomWidth"),10)||0)+(parseInt(g.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(b,i,e),this._animateOff=!0;return!0},_mouseStart:function(a){return!0},_mouseDrag:function(a){var b={x:a.pageX,y:a.pageY},c=this._normValueFromMouse(b);this._slide(a,this._handleIndex,c);return!1},_mouseStop:function(a){this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(a,this._handleIndex),this._change(a,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1;return!1},_detectOrientation:function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(a){var b,c,d,e,f;this.orientation==="horizontal"?(b=this.elementSize.width,c=a.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(b=this.elementSize.height,c=a.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),d=c/b,d>1&&(d=1),d<0&&(d=0),this.orientation==="vertical"&&(d=1-d),e=this._valueMax()-this._valueMin(),f=this._valueMin()+d*e;return this._trimAlignValue(f)},_start:function(a,b){var c={handle:this.handles[b],value:this.value()};this.options.values&&this.options.values.length&&(c.value=this.values(b),c.values=this.values());return this._trigger("start",a,c)},_slide:function(a,b,c){var d,e,f;this.options.values&&this.options.values.length?(d=this.values(b?0:1),this.options.values.length===2&&this.options.range===!0&&(b===0&&c>d||b===1&&c<d)&&(c=d),c!==this.values(b)&&(e=this.values(),e[b]=c,f=this._trigger("slide",a,{handle:this.handles[b],value:c,values:e}),d=this.values(b?0:1),f!==!1&&this.values(b,c,!0))):c!==this.value()&&(f=this._trigger("slide",a,{handle:this.handles[b],value:c}),f!==!1&&this.value(c))},_stop:function(a,b){var c={handle:this.handles[b],value:this.value()};this.options.values&&this.options.values.length&&(c.value=this.values(b),c.values=this.values()),this._trigger("stop",a,c)},_change:function(a,b){if(!this._keySliding&&!this._mouseSliding){var c={handle:this.handles[b],value:this.value()};this.options.values&&this.options.values.length&&(c.value=this.values(b),c.values=this.values()),this._trigger("change",a,c)}},value:function(a){if(arguments.length)this.options.value=this._trimAlignValue(a),this._refreshValue(),this._change(null,0);else return this._value()},values:function(b,c){var d,e,f;if(arguments.length>1)this.options.values[b]=this._trimAlignValue(c),this._refreshValue(),this._change(null,b);else{if(!arguments.length)return this._values();if(!a.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(b):this.value();d=this.options.values,e=arguments[0];for(f=0;f<d.length;f+=1)d[f]=this._trimAlignValue(e[f]),this._change(null,f);this._refreshValue()}},_setOption:function(b,c){var d,e=0;a.isArray(this.options.values)&&(e=this.options.values.length),a.Widget.prototype._setOption.apply(this,arguments);switch(b){case"disabled":c?(this.handles.filter(".ui-state-focus").blur(),this.handles.removeClass("ui-state-hover"),this.handles.propAttr("disabled",!0),this.element.addClass("ui-disabled")):(this.handles.propAttr("disabled",!1),this.element.removeClass("ui-disabled"));break;case"orientation":this._detectOrientation(),this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation),this._refreshValue();break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":this._animateOff=!0,this._refreshValue();for(d=0;d<e;d+=1)this._change(null,d);this._animateOff=!1}},_value:function(){var a=this.options.value;a=this._trimAlignValue(a);return a},_values:function(a){var b,c,d;if(arguments.length){b=this.options.values[a],b=this._trimAlignValue(b);return b}c=this.options.values.slice();for(d=0;d<c.length;d+=1)c[d]=this._trimAlignValue(c[d]);return c},_trimAlignValue:function(a){if(a<=this._valueMin())return this._valueMin();if(a>=this._valueMax())return this._valueMax();var b=this.options.step>0?this.options.step:1,c=(a-this._valueMin())%b,d=a-c;Math.abs(c)*2>=b&&(d+=c>0?b:-b);return parseFloat(d.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var b=this.options.range,c=this.options,d=this,e=this._animateOff?!1:c.animate,f,g={},h,i,j,k;this.options.values&&this.options.values.length?this.handles.each(function(b,i){f=(d.values(b)-d._valueMin())/(d._valueMax()-d._valueMin())*100,g[d.orientation==="horizontal"?"left":"bottom"]=f+"%",a(this).stop(1,1)[e?"animate":"css"](g,c.animate),d.options.range===!0&&(d.orientation==="horizontal"?(b===0&&d.range.stop(1,1)[e?"animate":"css"]({left:f+"%"},c.animate),b===1&&d.range[e?"animate":"css"]({width:f-h+"%"},{queue:!1,duration:c.animate})):(b===0&&d.range.stop(1,1)[e?"animate":"css"]({bottom:f+"%"},c.animate),b===1&&d.range[e?"animate":"css"]({height:f-h+"%"},{queue:!1,duration:c.animate}))),h=f}):(i=this.value(),j=this._valueMin(),k=this._valueMax(),f=k!==j?(i-j)/(k-j)*100:0,g[d.orientation==="horizontal"?"left":"bottom"]=f+"%",this.handle.stop(1,1)[e?"animate":"css"](g,c.animate),b==="min"&&this.orientation==="horizontal"&&this.range.stop(1,1)[e?"animate":"css"]({width:f+"%"},c.animate),b==="max"&&this.orientation==="horizontal"&&this.range[e?"animate":"css"]({width:100-f+"%"},{queue:!1,duration:c.animate}),b==="min"&&this.orientation==="vertical"&&this.range.stop(1,1)[e?"animate":"css"]({height:f+"%"},c.animate),b==="max"&&this.orientation==="vertical"&&this.range[e?"animate":"css"]({height:100-f+"%"},{queue:!1,duration:c.animate}))}}),a.extend(a.ui.slider,{version:"1.8.18"})})(jQuery);/*
+ * jQuery UI Tabs 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Tabs
+ *
+ * Depends:
+ * jquery.ui.core.js
+ * jquery.ui.widget.js
+ */(function(a,b){function f(){return++d}function e(){return++c}var c=0,d=0;a.widget("ui.tabs",{options:{add:null,ajaxOptions:null,cache:!1,cookie:null,collapsible:!1,disable:null,disabled:[],enable:null,event:"click",fx:null,idPrefix:"ui-tabs-",load:null,panelTemplate:"<div></div>",remove:null,select:null,show:null,spinner:"<em>Loading&#8230;</em>",tabTemplate:"<li><a href='#{href}'><span>#{label}</span></a></li>"},_create:function(){this._tabify(!0)},_setOption:function(a,b){if(a=="selected"){if(this.options.collapsible&&b==this.options.selected)return;this.select(b)}else this.options[a]=b,this._tabify()},_tabId:function(a){return a.title&&a.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF-]/g,"")||this.options.idPrefix+e()},_sanitizeSelector:function(a){return a.replace(/:/g,"\\:")},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+f());return a.cookie.apply(null,[b].concat(a.makeArray(arguments)))},_ui:function(a,b){return{tab:a,panel:b,index:this.anchors.index(a)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var b=a(this);b.html(b.data("label.tabs")).removeData("label.tabs")})},_tabify:function(c){function m(b,c){b.css("display",""),!a.support.opacity&&c.opacity&&b[0].style.removeAttribute("filter")}var d=this,e=this.options,f=/^#.+/;this.list=this.element.find("ol,ul").eq(0),this.lis=a(" > li:has(a[href])",this.list),this.anchors=this.lis.map(function(){return a("a",this)[0]}),this.panels=a([]),this.anchors.each(function(b,c){var g=a(c).attr("href"),h=g.split("#")[0],i;h&&(h===location.toString().split("#")[0]||(i=a("base")[0])&&h===i.href)&&(g=c.hash,c.href=g);if(f.test(g))d.panels=d.panels.add(d.element.find(d._sanitizeSelector(g)));else if(g&&g!=="#"){a.data(c,"href.tabs",g),a.data(c,"load.tabs",g.replace(/#.*$/,""));var j=d._tabId(c);c.href="#"+j;var k=d.element.find("#"+j);k.length||(k=a(e.panelTemplate).attr("id",j).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(d.panels[b-1]||d.list),k.data("destroy.tabs",!0)),d.panels=d.panels.add(k)}else e.disabled.push(b)}),c?(this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all"),this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"),this.lis.addClass("ui-state-default ui-corner-top"),this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom"),e.selected===b?(location.hash&&this.anchors.each(function(a,b){if(b.hash==location.hash){e.selected=a;return!1}}),typeof e.selected!="number"&&e.cookie&&(e.selected=parseInt(d._cookie(),10)),typeof e.selected!="number"&&this.lis.filter(".ui-tabs-selected").length&&(e.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))),e.selected=e.selected||(this.lis.length?0:-1)):e.selected===null&&(e.selected=-1),e.selected=e.selected>=0&&this.anchors[e.selected]||e.selected<0?e.selected:0,e.disabled=a.unique(e.disabled.concat(a.map(this.lis.filter(".ui-state-disabled"),function(a,b){return d.lis.index(a)}))).sort(),a.inArray(e.selected,e.disabled)!=-1&&e.disabled.splice(a.inArray(e.selected,e.disabled),1),this.panels.addClass("ui-tabs-hide"),this.lis.removeClass("ui-tabs-selected ui-state-active"),e.selected>=0&&this.anchors.length&&(d.element.find(d._sanitizeSelector(d.anchors[e.selected].hash)).removeClass("ui-tabs-hide"),this.lis.eq(e.selected).addClass("ui-tabs-selected ui-state-active"),d.element.queue("tabs",function(){d._trigger("show",null,d._ui(d.anchors[e.selected],d.element.find(d._sanitizeSelector(d.anchors[e.selected].hash))[0]))}),this.load(e.selected)),a(window).bind("unload",function(){d.lis.add(d.anchors).unbind(".tabs"),d.lis=d.anchors=d.panels=null})):e.selected=this.lis.index(this.lis.filter(".ui-tabs-selected")),this.element[e.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible"),e.cookie&&this._cookie(e.selected,e.cookie);for(var g=0,h;h=this.lis[g];g++)a(h)[a.inArray(g,e.disabled)!=-1&&!a(h).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled");e.cache===!1&&this.anchors.removeData("cache.tabs"),this.lis.add(this.anchors).unbind(".tabs");if(e.event!=="mouseover"){var i=function(a,b){b.is(":not(.ui-state-disabled)")&&b.addClass("ui-state-"+a)},j=function(a,b){b.removeClass("ui-state-"+a)};this.lis.bind("mouseover.tabs",function(){i("hover",a(this))}),this.lis.bind("mouseout.tabs",function(){j("hover",a(this))}),this.anchors.bind("focus.tabs",function(){i("focus",a(this).closest("li"))}),this.anchors.bind("blur.tabs",function(){j("focus",a(this).closest("li"))})}var k,l;e.fx&&(a.isArray(e.fx)?(k=e.fx[0],l=e.fx[1]):k=l=e.fx);var n=l?function(b,c){a(b).closest("li").addClass("ui-tabs-selected ui-state-active"),c.hide().removeClass("ui-tabs-hide").animate(l,l.duration||"normal",function(){m(c,l),d._trigger("show",null,d._ui(b,c[0]))})}:function(b,c){a(b).closest("li").addClass("ui-tabs-selected ui-state-active"),c.removeClass("ui-tabs-hide"),d._trigger("show",null,d._ui(b,c[0]))},o=k?function(a,b){b.animate(k,k.duration||"normal",function(){d.lis.removeClass("ui-tabs-selected ui-state-active"),b.addClass("ui-tabs-hide"),m(b,k),d.element.dequeue("tabs")})}:function(a,b,c){d.lis.removeClass("ui-tabs-selected ui-state-active"),b.addClass("ui-tabs-hide"),d.element.dequeue("tabs")};this.anchors.bind(e.event+".tabs",function(){var b=this,c=a(b).closest("li"),f=d.panels.filter(":not(.ui-tabs-hide)"),g=d.element.find(d._sanitizeSelector(b.hash));if(c.hasClass("ui-tabs-selected")&&!e.collapsible||c.hasClass("ui-state-disabled")||c.hasClass("ui-state-processing")||d.panels.filter(":animated").length||d._trigger("select",null,d._ui(this,g[0]))===!1){this.blur();return!1}e.selected=d.anchors.index(this),d.abort();if(e.collapsible){if(c.hasClass("ui-tabs-selected")){e.selected=-1,e.cookie&&d._cookie(e.selected,e.cookie),d.element.queue("tabs",function(){o(b,f)}).dequeue("tabs"),this.blur();return!1}if(!f.length){e.cookie&&d._cookie(e.selected,e.cookie),d.element.queue("tabs",function(){n(b,g)}),d.load(d.anchors.index(this)),this.blur();return!1}}e.cookie&&d._cookie(e.selected,e.cookie);if(g.length)f.length&&d.element.queue("tabs",function(){o(b,f)}),d.element.queue("tabs",function(){n(b,g)}),d.load(d.anchors.index(this));else throw"jQuery UI Tabs: Mismatching fragment identifier.";a.browser.msie&&this.blur()}),this.anchors.bind("click.tabs",function(){return!1})},_getIndex:function(a){typeof a=="string"&&(a=this.anchors.index(this.anchors.filter("[href$="+a+"]")));return a},destroy:function(){var b=this.options;this.abort(),this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs"),this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"),this.anchors.each(function(){var b=a.data(this,"href.tabs");b&&(this.href=b);var c=a(this).unbind(".tabs");a.each(["href","load","cache"],function(a,b){c.removeData(b+".tabs")})}),this.lis.unbind(".tabs").add(this.panels).each(function(){a.data(this,"destroy.tabs")?a(this).remove():a(this).removeClass(["ui-state-default","ui-corner-top","ui-tabs-selected","ui-state-active","ui-state-hover","ui-state-focus","ui-state-disabled","ui-tabs-panel","ui-widget-content","ui-corner-bottom","ui-tabs-hide"].join(" "))}),b.cookie&&this._cookie(null,b.cookie);return this},add:function(c,d,e){e===b&&(e=this.anchors.length);var f=this,g=this.options,h=a(g.tabTemplate.replace(/#\{href\}/g,c).replace(/#\{label\}/g,d)),i=c.indexOf("#")?this._tabId(a("a",h)[0]):c.replace("#","");h.addClass("ui-state-default ui-corner-top").data("destroy.tabs",!0);var j=f.element.find("#"+i);j.length||(j=a(g.panelTemplate).attr("id",i).data("destroy.tabs",!0)),j.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide"),e>=this.lis.length?(h.appendTo(this.list),j.appendTo(this.list[0].parentNode)):(h.insertBefore(this.lis[e]),j.insertBefore(this.panels[e])),g.disabled=a.map(g.disabled,function(a,b){return a>=e?++a:a}),this._tabify(),this.anchors.length==1&&(g.selected=0,h.addClass("ui-tabs-selected ui-state-active"),j.removeClass("ui-tabs-hide"),this.element.queue("tabs",function(){f._trigger("show",null,f._ui(f.anchors[0],f.panels[0]))}),this.load(0)),this._trigger("add",null,this._ui(this.anchors[e],this.panels[e]));return this},remove:function(b){b=this._getIndex(b);var c=this.options,d=this.lis.eq(b).remove(),e=this.panels.eq(b).remove();d.hasClass("ui-tabs-selected")&&this.anchors.length>1&&this.select(b+(b+1<this.anchors.length?1:-1)),c.disabled=a.map(a.grep(c.disabled,function(a,c){return a!=b}),function(a,c){return a>=b?--a:a}),this._tabify(),this._trigger("remove",null,this._ui(d.find("a")[0],e[0]));return this},enable:function(b){b=this._getIndex(b);var c=this.options;if(a.inArray(b,c.disabled)!=-1){this.lis.eq(b).removeClass("ui-state-disabled"),c.disabled=a.grep(c.disabled,function(a,c){return a!=b}),this._trigger("enable",null,this._ui(this.anchors[b],this.panels[b]));return this}},disable:function(a){a=this._getIndex(a);var b=this,c=this.options;a!=c.selected&&(this.lis.eq(a).addClass("ui-state-disabled"),c.disabled.push(a),c.disabled.sort(),this._trigger("disable",null,this._ui(this.anchors[a],this.panels[a])));return this},select:function(a){a=this._getIndex(a);if(a==-1)if(this.options.collapsible&&this.options.selected!=-1)a=this.options.selected;else return this;this.anchors.eq(a).trigger(this.options.event+".tabs");return this},load:function(b){b=this._getIndex(b);var c=this,d=this.options,e=this.anchors.eq(b)[0],f=a.data(e,"load.tabs");this.abort();if(!f||this.element.queue("tabs").length!==0&&a.data(e,"cache.tabs"))this.element.dequeue("tabs");else{this.lis.eq(b).addClass("ui-state-processing");if(d.spinner){var g=a("span",e);g.data("label.tabs",g.html()).html(d.spinner)}this.xhr=a.ajax(a.extend({},d.ajaxOptions,{url:f,success:function(f,g){c.element.find(c._sanitizeSelector(e.hash)).html(f),c._cleanup(),d.cache&&a.data(e,"cache.tabs",!0),c._trigger("load",null,c._ui(c.anchors[b],c.panels[b]));try{d.ajaxOptions.success(f,g)}catch(h){}},error:function(a,f,g){c._cleanup(),c._trigger("load",null,c._ui(c.anchors[b],c.panels[b]));try{d.ajaxOptions.error(a,f,b,e)}catch(g){}}})),c.element.dequeue("tabs");return this}},abort:function(){this.element.queue([]),this.panels.stop(!1,!0),this.element.queue("tabs",this.element.queue("tabs").splice(-2,2)),this.xhr&&(this.xhr.abort(),delete this.xhr),this._cleanup();return this},url:function(a,b){this.anchors.eq(a).removeData("cache.tabs").data("load.tabs",b);return this},length:function(){return this.anchors.length}}),a.extend(a.ui.tabs,{version:"1.8.18"}),a.extend(a.ui.tabs.prototype,{rotation:null,rotate:function(a,b){var c=this,d=this.options,e=c._rotate||(c._rotate=function(b){clearTimeout(c.rotation),c.rotation=setTimeout(function(){var a=d.selected;c.select(++a<c.anchors.length?a:0)},a),b&&b.stopPropagation()}),f=c._unrotate||(c._unrotate=b?function(a){t=d.selected,e()}:function(a){a.clientX&&c.rotate(null)});a?(this.element.bind("tabsshow",e),this.anchors.bind(d.event+".tabs",f),e()):(clearTimeout(c.rotation),this.element.unbind("tabsshow",e),this.anchors.unbind(d.event+".tabs",f),delete this._rotate,delete this._unrotate);return this}})})(jQuery);/*
+ * jQuery UI Datepicker 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Datepicker
+ *
+ * Depends:
+ * jquery.ui.core.js
+ */(function($,undefined){function isArray(a){return a&&($.browser.safari&&typeof a=="object"&&a.length||a.constructor&&a.constructor.toString().match(/\Array\(\)/))}function extendRemove(a,b){$.extend(a,b);for(var c in b)if(b[c]==null||b[c]==undefined)a[c]=b[c];return a}function bindHover(a){var b="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return a.bind("mouseout",function(a){var c=$(a.target).closest(b);!c.length||c.removeClass("ui-state-hover ui-datepicker-prev-hover ui-datepicker-next-hover")}).bind("mouseover",function(c){var d=$(c.target).closest(b);!$.datepicker._isDisabledDatepicker(instActive.inline?a.parent()[0]:instActive.input[0])&&!!d.length&&(d.parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),d.addClass("ui-state-hover"),d.hasClass("ui-datepicker-prev")&&d.addClass("ui-datepicker-prev-hover"),d.hasClass("ui-datepicker-next")&&d.addClass("ui-datepicker-next-hover"))})}function Datepicker(){this.debug=!1,this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},$.extend(this._defaults,this.regional[""]),this.dpDiv=bindHover($('<div id="'+this._mainDivId+'" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))}$.extend($.ui,{datepicker:{version:"1.8.18"}});var PROP_NAME="datepicker",dpuuid=(new Date).getTime(),instActive;$.extend(Datepicker.prototype,{markerClassName:"hasDatepicker",maxRows:4,log:function(){this.debug&&console.log.apply("",arguments)},_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(a){extendRemove(this._defaults,a||{});return this},_attachDatepicker:function(target,settings){var inlineSettings=null;for(var attrName in this._defaults){var attrValue=target.getAttribute("date:"+attrName);if(attrValue){inlineSettings=inlineSettings||{};try{inlineSettings[attrName]=eval(attrValue)}catch(err){inlineSettings[attrName]=attrValue}}}var nodeName=target.nodeName.toLowerCase(),inline=nodeName=="div"||nodeName=="span";target.id||(this.uuid+=1,target.id="dp"+this.uuid);var inst=this._newInst($(target),inline);inst.settings=$.extend({},settings||{},inlineSettings||{}),nodeName=="input"?this._connectDatepicker(target,inst):inline&&this._inlineDatepicker(target,inst)},_newInst:function(a,b){var c=a[0].id.replace(/([^A-Za-z0-9_-])/g,"\\\\$1");return{id:c,input:a,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:b,dpDiv:b?bindHover($('<div class="'+this._inlineClass+' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>')):this.dpDiv}},_connectDatepicker:function(a,b){var c=$(a);b.append=$([]),b.trigger=$([]);c.hasClass(this.markerClassName)||(this._attachments(c,b),c.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",function(a,c,d){b.settings[c]=d}).bind("getData.datepicker",function(a,c){return this._get(b,c)}),this._autoSize(b),$.data(a,PROP_NAME,b),b.settings.disabled&&this._disableDatepicker(a))},_attachments:function(a,b){var c=this._get(b,"appendText"),d=this._get(b,"isRTL");b.append&&b.append.remove(),c&&(b.append=$('<span class="'+this._appendClass+'">'+c+"</span>"),a[d?"before":"after"](b.append)),a.unbind("focus",this._showDatepicker),b.trigger&&b.trigger.remove();var e=this._get(b,"showOn");(e=="focus"||e=="both")&&a.focus(this._showDatepicker);if(e=="button"||e=="both"){var f=this._get(b,"buttonText"),g=this._get(b,"buttonImage");b.trigger=$(this._get(b,"buttonImageOnly")?$("<img/>").addClass(this._triggerClass).attr({src:g,alt:f,title:f}):$('<button type="button"></button>').addClass(this._triggerClass).html(g==""?f:$("<img/>").attr({src:g,alt:f,title:f}))),a[d?"before":"after"](b.trigger),b.trigger.click(function(){$.datepicker._datepickerShowing&&$.datepicker._lastInput==a[0]?$.datepicker._hideDatepicker():$.datepicker._datepickerShowing&&$.datepicker._lastInput!=a[0]?($.datepicker._hideDatepicker(),$.datepicker._showDatepicker(a[0])):$.datepicker._showDatepicker(a[0]);return!1})}},_autoSize:function(a){if(this._get(a,"autoSize")&&!a.inline){var b=new Date(2009,11,20),c=this._get(a,"dateFormat");if(c.match(/[DM]/)){var d=function(a){var b=0,c=0;for(var d=0;d<a.length;d++)a[d].length>b&&(b=a[d].length,c=d);return c};b.setMonth(d(this._get(a,c.match(/MM/)?"monthNames":"monthNamesShort"))),b.setDate(d(this._get(a,c.match(/DD/)?"dayNames":"dayNamesShort"))+20-b.getDay())}a.input.attr("size",this._formatDate(a,b).length)}},_inlineDatepicker:function(a,b){var c=$(a);c.hasClass(this.markerClassName)||(c.addClass(this.markerClassName).append(b.dpDiv).bind("setData.datepicker",function(a,c,d){b.settings[c]=d}).bind("getData.datepicker",function(a,c){return this._get(b,c)}),$.data(a,PROP_NAME,b),this._setDate(b,this._getDefaultDate(b),!0),this._updateDatepicker(b),this._updateAlternate(b),b.settings.disabled&&this._disableDatepicker(a),b.dpDiv.css("display","block"))},_dialogDatepicker:function(a,b,c,d,e){var f=this._dialogInst;if(!f){this.uuid+=1;var g="dp"+this.uuid;this._dialogInput=$('<input type="text" id="'+g+'" style="position: absolute; top: -100px; width: 0px; z-index: -10;"/>'),this._dialogInput.keydown(this._doKeyDown),$("body").append(this._dialogInput),f=this._dialogInst=this._newInst(this._dialogInput,!1),f.settings={},$.data(this._dialogInput[0],PROP_NAME,f)}extendRemove(f.settings,d||{}),b=b&&b.constructor==Date?this._formatDate(f,b):b,this._dialogInput.val(b),this._pos=e?e.length?e:[e.pageX,e.pageY]:null;if(!this._pos){var h=document.documentElement.clientWidth,i=document.documentElement.clientHeight,j=document.documentElement.scrollLeft||document.body.scrollLeft,k=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[h/2-100+j,i/2-150+k]}this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),f.settings.onSelect=c,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),$.blockUI&&$.blockUI(this.dpDiv),$.data(this._dialogInput[0],PROP_NAME,f);return this},_destroyDatepicker:function(a){var b=$(a),c=$.data(a,PROP_NAME);if(!!b.hasClass(this.markerClassName)){var d=a.nodeName.toLowerCase();$.removeData(a,PROP_NAME),d=="input"?(c.append.remove(),c.trigger.remove(),b.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):(d=="div"||d=="span")&&b.removeClass(this.markerClassName).empty()}},_enableDatepicker:function(a){var b=$(a),c=$.data(a,PROP_NAME);if(!!b.hasClass(this.markerClassName)){var d=a.nodeName.toLowerCase();if(d=="input")a.disabled=!1,c.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""});else if(d=="div"||d=="span"){var e=b.children("."+this._inlineClass);e.children().removeClass("ui-state-disabled"),e.find("select.ui-datepicker-month, select.ui-datepicker-year").removeAttr("disabled")}this._disabledInputs=$.map(this._disabledInputs,function(b){return b==a?null:b})}},_disableDatepicker:function(a){var b=$(a),c=$.data(a,PROP_NAME);if(!!b.hasClass(this.markerClassName)){var d=a.nodeName.toLowerCase();if(d=="input")a.disabled=!0,c.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"});else if(d=="div"||d=="span"){var e=b.children("."+this._inlineClass);e.children().addClass("ui-state-disabled"),e.find("select.ui-datepicker-month, select.ui-datepicker-year").attr("disabled","disabled")}this._disabledInputs=$.map(this._disabledInputs,function(b){return b==a?null:b}),this._disabledInputs[this._disabledInputs.length]=a}},_isDisabledDatepicker:function(a){if(!a)return!1;for(var b=0;b<this._disabledInputs.length;b++)if(this._disabledInputs[b]==a)return!0;return!1},_getInst:function(a){try{return $.data(a,PROP_NAME)}catch(b){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(a,b,c){var d=this._getInst(a);if(arguments.length==2&&typeof b=="string")return b=="defaults"?$.extend({},$.datepicker._defaults):d?b=="all"?$.extend({},d.settings):this._get(d,b):null;var e=b||{};typeof b=="string"&&(e={},e[b]=c);if(d){this._curInst==d&&this._hideDatepicker();var f=this._getDateDatepicker(a,!0),g=this._getMinMaxDate(d,"min"),h=this._getMinMaxDate(d,"max");extendRemove(d.settings,e),g!==null&&e.dateFormat!==undefined&&e.minDate===undefined&&(d.settings.minDate=this._formatDate(d,g)),h!==null&&e.dateFormat!==undefined&&e.maxDate===undefined&&(d.settings.maxDate=this._formatDate(d,h)),this._attachments($(a),d),this._autoSize(d),this._setDate(d,f),this._updateAlternate(d),this._updateDatepicker(d)}},_changeDatepicker:function(a,b,c){this._optionDatepicker(a,b,c)},_refreshDatepicker:function(a){var b=this._getInst(a);b&&this._updateDatepicker(b)},_setDateDatepicker:function(a,b){var c=this._getInst(a);c&&(this._setDate(c,b),this._updateDatepicker(c),this._updateAlternate(c))},_getDateDatepicker:function(a,b){var c=this._getInst(a);c&&!c.inline&&this._setDateFromField(c,b);return c?this._getDate(c):null},_doKeyDown:function(a){var b=$.datepicker._getInst(a.target),c=!0,d=b.dpDiv.is(".ui-datepicker-rtl");b._keyEvent=!0;if($.datepicker._datepickerShowing)switch(a.keyCode){case 9:$.datepicker._hideDatepicker(),c=!1;break;case 13:var e=$("td."+$.datepicker._dayOverClass+":not(."+$.datepicker._currentClass+")",b.dpDiv);e[0]&&$.datepicker._selectDay(a.target,b.selectedMonth,b.selectedYear,e[0]);var f=$.datepicker._get(b,"onSelect");if(f){var g=$.datepicker._formatDate(b);f.apply(b.input?b.input[0]:null,[g,b])}else $.datepicker._hideDatepicker();return!1;case 27:$.datepicker._hideDatepicker();break;case 33:$.datepicker._adjustDate(a.target,a.ctrlKey?-$.datepicker._get(b,"stepBigMonths"):-$.datepicker._get(b,"stepMonths"),"M");break;case 34:$.datepicker._adjustDate(a.target,a.ctrlKey?+$.datepicker._get(b,"stepBigMonths"):+$.datepicker._get(b,"stepMonths"),"M");break;case 35:(a.ctrlKey||a.metaKey)&&$.datepicker._clearDate(a.target),c=a.ctrlKey||a.metaKey;break;case 36:(a.ctrlKey||a.metaKey)&&$.datepicker._gotoToday(a.target),c=a.ctrlKey||a.metaKey;break;case 37:(a.ctrlKey||a.metaKey)&&$.datepicker._adjustDate(a.target,d?1:-1,"D"),c=a.ctrlKey||a.metaKey,a.originalEvent.altKey&&$.datepicker._adjustDate(a.target,a.ctrlKey?-$.datepicker._get(b,"stepBigMonths"):-$.datepicker._get(b,"stepMonths"),"M");break;case 38:(a.ctrlKey||a.metaKey)&&$.datepicker._adjustDate(a.target,-7,"D"),c=a.ctrlKey||a.metaKey;break;case 39:(a.ctrlKey||a.metaKey)&&$.datepicker._adjustDate(a.target,d?-1:1,"D"),c=a.ctrlKey||a.metaKey,a.originalEvent.altKey&&$.datepicker._adjustDate(a.target,a.ctrlKey?+$.datepicker._get(b,"stepBigMonths"):+$.datepicker._get(b,"stepMonths"),"M");break;case 40:(a.ctrlKey||a.metaKey)&&$.datepicker._adjustDate(a.target,7,"D"),c=a.ctrlKey||a.metaKey;break;default:c=!1}else a.keyCode==36&&a.ctrlKey?$.datepicker._showDatepicker(this):c=!1;c&&(a.preventDefault(),a.stopPropagation())},_doKeyPress:function(a){var b=$.datepicker._getInst(a.target);if($.datepicker._get(b,"constrainInput")){var c=$.datepicker._possibleChars($.datepicker._get(b,"dateFormat")),d=String.fromCharCode(a.charCode==undefined?a.keyCode:a.charCode);return a.ctrlKey||a.metaKey||d<" "||!c||c.indexOf(d)>-1}},_doKeyUp:function(a){var b=$.datepicker._getInst(a.target);if(b.input.val()!=b.lastVal)try{var c=$.datepicker.parseDate($.datepicker._get(b,"dateFormat"),b.input?b.input.val():null,$.datepicker._getFormatConfig(b));c&&($.datepicker._setDateFromField(b),$.datepicker._updateAlternate(b),$.datepicker._updateDatepicker(b))}catch(a){$.datepicker.log(a)}return!0},_showDatepicker:function(a){a=a.target||a,a.nodeName.toLowerCase()!="input"&&(a=$("input",a.parentNode)[0]);if(!$.datepicker._isDisabledDatepicker(a)&&$.datepicker._lastInput!=a){var b=$.datepicker._getInst(a);$.datepicker._curInst&&$.datepicker._curInst!=b&&($.datepicker._curInst.dpDiv.stop(!0,!0),b&&$.datepicker._datepickerShowing&&$.datepicker._hideDatepicker($.datepicker._curInst.input[0]));var c=$.datepicker._get(b,"beforeShow"),d=c?c.apply(a,[a,b]):{};if(d===!1)return;extendRemove(b.settings,d),b.lastVal=null,$.datepicker._lastInput=a,$.datepicker._setDateFromField(b),$.datepicker._inDialog&&(a.value=""),$.datepicker._pos||($.datepicker._pos=$.datepicker._findPos(a),$.datepicker._pos[1]+=a.offsetHeight);var e=!1;$(a).parents().each(function(){e|=$(this).css("position")=="fixed";return!e}),e&&$.browser.opera&&($.datepicker._pos[0]-=document.documentElement.scrollLeft,$.datepicker._pos[1]-=document.documentElement.scrollTop);var f={left:$.datepicker._pos[0],top:$.datepicker._pos[1]};$.datepicker._pos=null,b.dpDiv.empty(),b.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),$.datepicker._updateDatepicker(b),f=$.datepicker._checkOffset(b,f,e),b.dpDiv.css({position:$.datepicker._inDialog&&$.blockUI?"static":e?"fixed":"absolute",display:"none",left:f.left+"px",top:f.top+"px"});if(!b.inline){var g=$.datepicker._get(b,"showAnim"),h=$.datepicker._get(b,"duration"),i=function(){var a=b.dpDiv.find("iframe.ui-datepicker-cover");if(!!a.length){var c=$.datepicker._getBorders(b.dpDiv);a.css({left:-c[0],top:-c[1],width:b.dpDiv.outerWidth(),height:b.dpDiv.outerHeight()})}};b.dpDiv.zIndex($(a).zIndex()+1),$.datepicker._datepickerShowing=!0,$.effects&&$.effects[g]?b.dpDiv.show(g,$.datepicker._get(b,"showOptions"),h,i):b.dpDiv[g||"show"](g?h:null,i),(!g||!h)&&i(),b.input.is(":visible")&&!b.input.is(":disabled")&&b.input.focus(),$.datepicker._curInst=b}}},_updateDatepicker:function(a){var b=this;b.maxRows=4;var c=$.datepicker._getBorders(a.dpDiv);instActive=a,a.dpDiv.empty().append(this._generateHTML(a));var d=a.dpDiv.find("iframe.ui-datepicker-cover");!d.length||d.css({left:-c[0],top:-c[1],width:a.dpDiv.outerWidth(),height:a.dpDiv.outerHeight()}),a.dpDiv.find("."+this._dayOverClass+" a").mouseover();var e=this._getNumberOfMonths(a),f=e[1],g=17;a.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),f>1&&a.dpDiv.addClass("ui-datepicker-multi-"+f).css("width",g*f+"em"),a.dpDiv[(e[0]!=1||e[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi"),a.dpDiv[(this._get(a,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),a==$.datepicker._curInst&&$.datepicker._datepickerShowing&&a.input&&a.input.is(":visible")&&!a.input.is(":disabled")&&a.input[0]!=document.activeElement&&a.input.focus();if(a.yearshtml){var h=a.yearshtml;setTimeout(function(){h===a.yearshtml&&a.yearshtml&&a.dpDiv.find("select.ui-datepicker-year:first").replaceWith(a.yearshtml),h=a.yearshtml=null},0)}},_getBorders:function(a){var b=function(a){return{thin:1,medium:2,thick:3}[a]||a};return[parseFloat(b(a.css("border-left-width"))),parseFloat(b(a.css("border-top-width")))]},_checkOffset:function(a,b,c){var d=a.dpDiv.outerWidth(),e=a.dpDiv.outerHeight(),f=a.input?a.input.outerWidth():0,g=a.input?a.input.outerHeight():0,h=document.documentElement.clientWidth+$(document).scrollLeft(),i=document.documentElement.clientHeight+$(document).scrollTop();b.left-=this._get(a,"isRTL")?d-f:0,b.left-=c&&b.left==a.input.offset().left?$(document).scrollLeft():0,b.top-=c&&b.top==a.input.offset().top+g?$(document).scrollTop():0,b.left-=Math.min(b.left,b.left+d>h&&h>d?Math.abs(b.left+d-h):0),b.top-=Math.min(b.top,b.top+e>i&&i>e?Math.abs(e+g):0);return b},_findPos:function(a){var b=this._getInst(a),c=this._get(b,"isRTL");while(a&&(a.type=="hidden"||a.nodeType!=1||$.expr.filters.hidden(a)))a=a[c?"previousSibling":"nextSibling"];var d=$(a).offset();return[d.left,d.top]},_hideDatepicker:function(a){var b=this._curInst;if(!(!b||a&&b!=$.data(a,PROP_NAME))&&this._datepickerShowing){var c=this._get(b,"showAnim"),d=this._get(b,"duration"),e=this,f=function(){$.datepicker._tidyDialog(b),e._curInst=null};$.effects&&$.effects[c]?b.dpDiv.hide(c,$.datepicker._get(b,"showOptions"),d,f):b.dpDiv[c=="slideDown"?"slideUp":c=="fadeIn"?"fadeOut":"hide"](c?d:null,f),c||f(),this._datepickerShowing=!1;var g=this._get(b,"onClose");g&&g.apply(b.input?b.input[0]:null,[b.input?b.input.val():"",b]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),$.blockUI&&($.unblockUI(),$("body").append(this.dpDiv))),this._inDialog=!1}},_tidyDialog:function(a){a.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(a){if(!!$.datepicker._curInst){var b=$(a.target),c=$.datepicker._getInst(b[0]);(b[0].id!=$.datepicker._mainDivId&&b.parents("#"+$.datepicker._mainDivId).length==0&&!b.hasClass($.datepicker.markerClassName)&&!b.closest("."+$.datepicker._triggerClass).length&&$.datepicker._datepickerShowing&&(!$.datepicker._inDialog||!$.blockUI)||b.hasClass($.datepicker.markerClassName)&&$.datepicker._curInst!=c)&&$.datepicker._hideDatepicker()}},_adjustDate:function(a,b,c){var d=$(a),e=this._getInst(d[0]);this._isDisabledDatepicker(d[0])||(this._adjustInstDate(e,b+(c=="M"?this._get(e,"showCurrentAtPos"):0),c),this._updateDatepicker(e))},_gotoToday:function(a){var b=$(a),c=this._getInst(b[0]);if(this._get(c,"gotoCurrent")&&c.currentDay)c.selectedDay=c.currentDay,c.drawMonth=c.selectedMonth=c.currentMonth,c.drawYear=c.selectedYear=c.currentYear;else{var d=new Date;c.selectedDay=d.getDate(),c.drawMonth=c.selectedMonth=d.getMonth(),c.drawYear=c.selectedYear=d.getFullYear()}this._notifyChange(c),this._adjustDate(b)},_selectMonthYear:function(a,b,c){var d=$(a),e=this._getInst(d[0]);e["selected"+(c=="M"?"Month":"Year")]=e["draw"+(c=="M"?"Month":"Year")]=parseInt(b.options[b.selectedIndex].value,10),this._notifyChange(e),this._adjustDate(d)},_selectDay:function(a,b,c,d){var e=$(a);if(!$(d).hasClass(this._unselectableClass)&&!this._isDisabledDatepicker(e[0])){var f=this._getInst(e[0]);f.selectedDay=f.currentDay=$("a",d).html(),f.selectedMonth=f.currentMonth=b,f.selectedYear=f.currentYear=c,this._selectDate(a,this._formatDate(f,f.currentDay,f.currentMonth,f.currentYear))}},_clearDate:function(a){var b=$(a),c=this._getInst(b[0]);this._selectDate(b,"")},_selectDate:function(a,b){var c=$(a),d=this._getInst(c[0]);b=b!=null?b:this._formatDate(d),d.input&&d.input.val(b),this._updateAlternate(d);var e=this._get(d,"onSelect");e?e.apply(d.input?d.input[0]:null,[b,d]):d.input&&d.input.trigger("change"),d.inline?this._updateDatepicker(d):(this._hideDatepicker(),this._lastInput=d.input[0],typeof d.input[0]!="object"&&d.input.focus(),this._lastInput=null)},_updateAlternate:function(a){var b=this._get(a,"altField");if(b){var c=this._get(a,"altFormat")||this._get(a,"dateFormat"),d=this._getDate(a),e=this.formatDate(c,d,this._getFormatConfig(a));$(b).each(function(){$(this).val(e)})}},noWeekends:function(a){var b=a.getDay();return[b>0&&b<6,""]},iso8601Week:function(a){var b=new Date(a.getTime());b.setDate(b.getDate()+4-(b.getDay()||7));var c=b.getTime();b.setMonth(0),b.setDate(1);return Math.floor(Math.round((c-b)/864e5)/7)+1},parseDate:function(a,b,c){if(a==null||b==null)throw"Invalid arguments";b=typeof b=="object"?b.toString():b+"";if(b=="")return null;var d=(c?c.shortYearCutoff:null)||this._defaults.shortYearCutoff;d=typeof d!="string"?d:(new Date).getFullYear()%100+parseInt(d,10);var e=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,f=(c?c.dayNames:null)||this._defaults.dayNames,g=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,h=(c?c.monthNames:null)||this._defaults.monthNames,i=-1,j=-1,k=-1,l=-1,m=!1,n=function(b){var c=s+1<a.length&&a.charAt(s+1)==b;c&&s++;return c},o=function(a){var c=n(a),d=a=="@"?14:a=="!"?20:a=="y"&&c?4:a=="o"?3:2,e=new RegExp("^\\d{1,"+d+"}"),f=b.substring(r).match(e);if(!f)throw"Missing number at position "+r;r+=f[0].length;return parseInt(f[0],10)},p=function(a,c,d){var e=$.map(n(a)?d:c,function(a,b){return[[b,a]]}).sort(function(a,b){return-(a[1].length-b[1].length)}),f=-1;$.each(e,function(a,c){var d=c[1];if(b.substr(r,d.length).toLowerCase()==d.toLowerCase()){f=c[0],r+=d.length;return!1}});if(f!=-1)return f+1;throw"Unknown name at position "+r},q=function(){if(b.charAt(r)!=a.charAt(s))throw"Unexpected literal at position "+r;r++},r=0;for(var s=0;s<a.length;s++)if(m)a.charAt(s)=="'"&&!n("'")?m=!1:q();else switch(a.charAt(s)){case"d":k=o("d");break;case"D":p("D",e,f);break;case"o":l=o("o");break;case"m":j=o("m");break;case"M":j=p("M",g,h);break;case"y":i=o("y");break;case"@":var t=new Date(o("@"));i=t.getFullYear(),j=t.getMonth()+1,k=t.getDate();break;case"!":var t=new Date((o("!")-this._ticksTo1970)/1e4);i=t.getFullYear(),j=t.getMonth()+1,k=t.getDate();break;case"'":n("'")?q():m=!0;break;default:q()}if(r<b.length)throw"Extra/unparsed characters found in date: "+b.substring(r);i==-1?i=(new Date).getFullYear():i<100&&(i+=(new Date).getFullYear()-(new Date).getFullYear()%100+(i<=d?0:-100));if(l>-1){j=1,k=l;for(;;){var u=this._getDaysInMonth(i,j-1);if(k<=u)break;j++,k-=u}}var t=this._daylightSavingAdjust(new Date(i,j-1,k));if(t.getFullYear()!=i||t.getMonth()+1!=j||t.getDate()!=k)throw"Invalid date";return t},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*24*60*60*1e7,formatDate:function(a,b,c){if(!b)return"";var d=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,e=(c?c.dayNames:null)||this._defaults.dayNames,f=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,g=(c?c.monthNames:null)||this._defaults.monthNames,h=function(b){var c=m+1<a.length&&a.charAt(m+1)==b;c&&m++;return c},i=function(a,b,c){var d=""+b;if(h(a))while(d.length<c)d="0"+d;return d},j=function(a,b,c,d){return h(a)?d[b]:c[b]},k="",l=!1;if(b)for(var m=0;m<a.length;m++)if(l)a.charAt(m)=="'"&&!h("'")?l=!1:k+=a.charAt(m);else switch(a.charAt(m)){case"d":k+=i("d",b.getDate(),2);break;case"D":k+=j("D",b.getDay(),d,e);break;case"o":k+=i("o",Math.round(((new Date(b.getFullYear(),b.getMonth(),b.getDate())).getTime()-(new Date(b.getFullYear(),0,0)).getTime())/864e5),3);break;case"m":k+=i("m",b.getMonth()+1,2);break;case"M":k+=j("M",b.getMonth(),f,g);break;case"y":k+=h("y")?b.getFullYear():(b.getYear()%100<10?"0":"")+b.getYear()%100;break;case"@":k+=b.getTime();break;case"!":k+=b.getTime()*1e4+this._ticksTo1970;break;case"'":h("'")?k+="'":l=!0;break;default:k+=a.charAt(m)}return k},_possibleChars:function(a){var b="",c=!1,d=function(b){var c=e+1<a.length&&a.charAt(e+1)==b;c&&e++;return c};for(var e=0;e<a.length;e++)if(c)a.charAt(e)=="'"&&!d("'")?c=!1:b+=a.charAt(e);else switch(a.charAt(e)){case"d":case"m":case"y":case"@":b+="0123456789";break;case"D":case"M":return null;case"'":d("'")?b+="'":c=!0;break;default:b+=a.charAt(e)}return b},_get:function(a,b){return a.settings[b]!==undefined?a.settings[b]:this._defaults[b]},_setDateFromField:function(a,b){if(a.input.val()!=a.lastVal){var c=this._get(a,"dateFormat"),d=a.lastVal=a.input?a.input.val():null,e,f;e=f=this._getDefaultDate(a);var g=this._getFormatConfig(a);try{e=this.parseDate(c,d,g)||f}catch(h){this.log(h),d=b?"":d}a.selectedDay=e.getDate(),a.drawMonth=a.selectedMonth=e.getMonth(),a.drawYear=a.selectedYear=e.getFullYear(),a.currentDay=d?e.getDate():0,a.currentMonth=d?e.getMonth():0,a.currentYear=d?e.getFullYear():0,this._adjustInstDate(a)}},_getDefaultDate:function(a){return this._restrictMinMax(a,this._determineDate(a,this._get(a,"defaultDate"),new Date))},_determineDate:function(a,b,c){var d=function(a){var b=new Date;b.setDate(b.getDate()+a);return b},e=function(b){try{return $.datepicker.parseDate($.datepicker._get(a,"dateFormat"),b,$.datepicker._getFormatConfig(a))}catch(c){}var d=(b.toLowerCase().match(/^c/)?$.datepicker._getDate(a):null)||new Date,e=d.getFullYear(),f=d.getMonth(),g=d.getDate(),h=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,i=h.exec(b);while(i){switch(i[2]||"d"){case"d":case"D":g+=parseInt(i[1],10);break;case"w":case"W":g+=parseInt(i[1],10)*7;break;case"m":case"M":f+=parseInt(i[1],10),g=Math.min(g,$.datepicker._getDaysInMonth(e,f));break;case"y":case"Y":e+=parseInt(i[1],10),g=Math.min(g,$.datepicker._getDaysInMonth(e,f))}i=h.exec(b)}return new Date(e,f,g)},f=b==null||b===""?c:typeof b=="string"?e(b):typeof b=="number"?isNaN(b)?c:d(b):new Date(b.getTime());f=f&&f.toString()=="Invalid Date"?c:f,f&&(f.setHours(0),f.setMinutes(0),f.setSeconds(0),f.setMilliseconds(0));return this._daylightSavingAdjust(f)},_daylightSavingAdjust:function(a){if(!a)return null;a.setHours(a.getHours()>12?a.getHours()+2:0);return a},_setDate:function(a,b,c){var d=!b,e=a.selectedMonth,f=a.selectedYear,g=this._restrictMinMax(a,this._determineDate(a,b,new Date));a.selectedDay=a.currentDay=g.getDate(),a.drawMonth=a.selectedMonth=a.currentMonth=g.getMonth(),a.drawYear=a.selectedYear=a.currentYear=g.getFullYear(),(e!=a.selectedMonth||f!=a.selectedYear)&&!c&&this._notifyChange(a),this._adjustInstDate(a),a.input&&a.input.val(d?"":this._formatDate(a))},_getDate:function(a){var b=!a.currentYear||a.input&&a.input.val()==""?null:this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return b},_generateHTML:function(a){var b=new Date;b=this._daylightSavingAdjust(new Date(b.getFullYear(),b.getMonth(),b.getDate()));var c=this._get(a,"isRTL"),d=this._get(a,"showButtonPanel"),e=this._get(a,"hideIfNoPrevNext"),f=this._get(a,"navigationAsDateFormat"),g=this._getNumberOfMonths(a),h=this._get(a,"showCurrentAtPos"),i=this._get(a,"stepMonths"),j=g[0]!=1||g[1]!=1,k=this._daylightSavingAdjust(a.currentDay?new Date(a.currentYear,a.currentMonth,a.currentDay):new Date(9999,9,9)),l=this._getMinMaxDate(a,"min"),m=this._getMinMaxDate(a,"max"),n=a.drawMonth-h,o=a.drawYear;n<0&&(n+=12,o--);if(m){var p=this._daylightSavingAdjust(new Date(m.getFullYear(),m.getMonth()-g[0]*g[1]+1,m.getDate()));p=l&&p<l?l:p;while(this._daylightSavingAdjust(new Date(o,n,1))>p)n--,n<0&&(n=11,o--)}a.drawMonth=n,a.drawYear=o;var q=this._get(a,"prevText");q=f?this.formatDate(q,this._daylightSavingAdjust(new Date(o,n-i,1)),this._getFormatConfig(a)):q;var r=this._canAdjustMonth(a,-1,o,n)?'<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery_'+dpuuid+".datepicker._adjustDate('#"+a.id+"', -"+i+", 'M');\""+' title="'+q+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"e":"w")+'">'+q+"</span></a>":e?"":'<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+q+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"e":"w")+'">'+q+"</span></a>",s=this._get(a,"nextText");s=f?this.formatDate(s,this._daylightSavingAdjust(new Date(o,n+i,1)),this._getFormatConfig(a)):s;var t=this._canAdjustMonth(a,1,o,n)?'<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery_'+dpuuid+".datepicker._adjustDate('#"+a.id+"', +"+i+", 'M');\""+' title="'+s+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"w":"e")+'">'+s+"</span></a>":e?"":'<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+s+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"w":"e")+'">'+s+"</span></a>",u=this._get(a,"currentText"),v=this._get(a,"gotoCurrent")&&a.currentDay?k:b;u=f?this.formatDate(u,v,this._getFormatConfig(a)):u;var w=a.inline?"":'<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery_'+dpuuid+'.datepicker._hideDatepicker();">'+this._get(a,"closeText")+"</button>",x=d?'<div class="ui-datepicker-buttonpane ui-widget-content">'+(c?w:"")+(this._isInRange(a,v)?'<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery_'+dpuuid+".datepicker._gotoToday('#"+a.id+"');\""+">"+u+"</button>":"")+(c?"":w)+"</div>":"",y=parseInt(this._get(a,"firstDay"),10);y=isNaN(y)?0:y;var z=this._get(a,"showWeek"),A=this._get(a,"dayNames"),B=this._get(a,"dayNamesShort"),C=this._get(a,"dayNamesMin"),D=this._get(a,"monthNames"),E=this._get(a,"monthNamesShort"),F=this._get(a,"beforeShowDay"),G=this._get(a,"showOtherMonths"),H=this._get(a,"selectOtherMonths"),I=this._get(a,"calculateWeek")||this.iso8601Week,J=this._getDefaultDate(a),K="";for(var L=0;L<g[0];L++){var M="";this.maxRows=4;for(var N=0;N<g[1];N++){var O=this._daylightSavingAdjust(new Date(o,n,a.selectedDay)),P=" ui-corner-all",Q="";if(j){Q+='<div class="ui-datepicker-group';if(g[1]>1)switch(N){case 0:Q+=" ui-datepicker-group-first",P=" ui-corner-"+(c?"right":"left");break;case g[1]-1:Q+=" ui-datepicker-group-last",P=" ui-corner-"+(c?"left":"right");break;default:Q+=" ui-datepicker-group-middle",P=""}Q+='">'}Q+='<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix'+P+'">'+(/all|left/.test(P)&&L==0?c?t:r:"")+(/all|right/.test(P)&&L==0?c?r:t:"")+this._generateMonthYearHeader(a,n,o,l,m,L>0||N>0,D,E)+'</div><table class="ui-datepicker-calendar"><thead>'+"<tr>";var R=z?'<th class="ui-datepicker-week-col">'+this._get(a,"weekHeader")+"</th>":"";for(var S=0;S<7;S++){var T=(S+y)%7;R+="<th"+((S+y+6)%7>=5?' class="ui-datepicker-week-end"':"")+">"+'<span title="'+A[T]+'">'+C[T]+"</span></th>"}Q+=R+"</tr></thead><tbody>";var U=this._getDaysInMonth(o,n);o==a.selectedYear&&n==a.selectedMonth&&(a.selectedDay=Math.min(a.selectedDay,U));var V=(this._getFirstDayOfMonth(o,n)-y+7)%7,W=Math.ceil((V+U)/7),X=j?this.maxRows>W?this.maxRows:W:W;this.maxRows=X;var Y=this._daylightSavingAdjust(new Date(o,n,1-V));for(var Z=0;Z<X;Z++){Q+="<tr>";var _=z?'<td class="ui-datepicker-week-col">'+this._get(a,"calculateWeek")(Y)+"</td>":"";for(var S=0;S<7;S++){var ba=F?F.apply(a.input?a.input[0]:null,[Y]):[!0,""],bb=Y.getMonth()!=n,bc=bb&&!H||!ba[0]||l&&Y<l||m&&Y>m;_+='<td class="'+((S+y+6)%7>=5?" ui-datepicker-week-end":"")+(bb?" ui-datepicker-other-month":"")+(Y.getTime()==O.getTime()&&n==a.selectedMonth&&a._keyEvent||J.getTime()==Y.getTime()&&J.getTime()==O.getTime()?" "+this._dayOverClass:"")+(bc?" "+this._unselectableClass+" ui-state-disabled":"")+(bb&&!G?"":" "+ba[1]+(Y.getTime()==k.getTime()?" "+this._currentClass:"")+(Y.getTime()==b.getTime()?" ui-datepicker-today":""))+'"'+((!bb||G)&&ba[2]?' title="'+ba[2]+'"':"")+(bc?"":' onclick="DP_jQuery_'+dpuuid+".datepicker._selectDay('#"+a.id+"',"+Y.getMonth()+","+Y.getFullYear()+', this);return false;"')+">"+(bb&&!G?"&#xa0;":bc?'<span class="ui-state-default">'+Y.getDate()+"</span>":'<a class="ui-state-default'+(Y.getTime()==b.getTime()?" ui-state-highlight":"")+(Y.getTime()==k.getTime()?" ui-state-active":"")+(bb?" ui-priority-secondary":"")+'" href="#">'+Y.getDate()+"</a>")+"</td>",Y.setDate(Y.getDate()+1),Y=this._daylightSavingAdjust(Y)}Q+=_+"</tr>"}n++,n>11&&(n=0,o++),Q+="</tbody></table>"+(j?"</div>"+(g[0]>0&&N==g[1]-1?'<div class="ui-datepicker-row-break"></div>':""):""),M+=Q}K+=M}K+=x+($.browser.msie&&parseInt($.browser.version,10)<7&&!a.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>':""),
+a._keyEvent=!1;return K},_generateMonthYearHeader:function(a,b,c,d,e,f,g,h){var i=this._get(a,"changeMonth"),j=this._get(a,"changeYear"),k=this._get(a,"showMonthAfterYear"),l='<div class="ui-datepicker-title">',m="";if(f||!i)m+='<span class="ui-datepicker-month">'+g[b]+"</span>";else{var n=d&&d.getFullYear()==c,o=e&&e.getFullYear()==c;m+='<select class="ui-datepicker-month" onchange="DP_jQuery_'+dpuuid+".datepicker._selectMonthYear('#"+a.id+"', this, 'M');\" "+">";for(var p=0;p<12;p++)(!n||p>=d.getMonth())&&(!o||p<=e.getMonth())&&(m+='<option value="'+p+'"'+(p==b?' selected="selected"':"")+">"+h[p]+"</option>");m+="</select>"}k||(l+=m+(f||!i||!j?"&#xa0;":""));if(!a.yearshtml){a.yearshtml="";if(f||!j)l+='<span class="ui-datepicker-year">'+c+"</span>";else{var q=this._get(a,"yearRange").split(":"),r=(new Date).getFullYear(),s=function(a){var b=a.match(/c[+-].*/)?c+parseInt(a.substring(1),10):a.match(/[+-].*/)?r+parseInt(a,10):parseInt(a,10);return isNaN(b)?r:b},t=s(q[0]),u=Math.max(t,s(q[1]||""));t=d?Math.max(t,d.getFullYear()):t,u=e?Math.min(u,e.getFullYear()):u,a.yearshtml+='<select class="ui-datepicker-year" onchange="DP_jQuery_'+dpuuid+".datepicker._selectMonthYear('#"+a.id+"', this, 'Y');\" "+">";for(;t<=u;t++)a.yearshtml+='<option value="'+t+'"'+(t==c?' selected="selected"':"")+">"+t+"</option>";a.yearshtml+="</select>",l+=a.yearshtml,a.yearshtml=null}}l+=this._get(a,"yearSuffix"),k&&(l+=(f||!i||!j?"&#xa0;":"")+m),l+="</div>";return l},_adjustInstDate:function(a,b,c){var d=a.drawYear+(c=="Y"?b:0),e=a.drawMonth+(c=="M"?b:0),f=Math.min(a.selectedDay,this._getDaysInMonth(d,e))+(c=="D"?b:0),g=this._restrictMinMax(a,this._daylightSavingAdjust(new Date(d,e,f)));a.selectedDay=g.getDate(),a.drawMonth=a.selectedMonth=g.getMonth(),a.drawYear=a.selectedYear=g.getFullYear(),(c=="M"||c=="Y")&&this._notifyChange(a)},_restrictMinMax:function(a,b){var c=this._getMinMaxDate(a,"min"),d=this._getMinMaxDate(a,"max"),e=c&&b<c?c:b;e=d&&e>d?d:e;return e},_notifyChange:function(a){var b=this._get(a,"onChangeMonthYear");b&&b.apply(a.input?a.input[0]:null,[a.selectedYear,a.selectedMonth+1,a])},_getNumberOfMonths:function(a){var b=this._get(a,"numberOfMonths");return b==null?[1,1]:typeof b=="number"?[1,b]:b},_getMinMaxDate:function(a,b){return this._determineDate(a,this._get(a,b+"Date"),null)},_getDaysInMonth:function(a,b){return 32-this._daylightSavingAdjust(new Date(a,b,32)).getDate()},_getFirstDayOfMonth:function(a,b){return(new Date(a,b,1)).getDay()},_canAdjustMonth:function(a,b,c,d){var e=this._getNumberOfMonths(a),f=this._daylightSavingAdjust(new Date(c,d+(b<0?b:e[0]*e[1]),1));b<0&&f.setDate(this._getDaysInMonth(f.getFullYear(),f.getMonth()));return this._isInRange(a,f)},_isInRange:function(a,b){var c=this._getMinMaxDate(a,"min"),d=this._getMinMaxDate(a,"max");return(!c||b.getTime()>=c.getTime())&&(!d||b.getTime()<=d.getTime())},_getFormatConfig:function(a){var b=this._get(a,"shortYearCutoff");b=typeof b!="string"?b:(new Date).getFullYear()%100+parseInt(b,10);return{shortYearCutoff:b,dayNamesShort:this._get(a,"dayNamesShort"),dayNames:this._get(a,"dayNames"),monthNamesShort:this._get(a,"monthNamesShort"),monthNames:this._get(a,"monthNames")}},_formatDate:function(a,b,c,d){b||(a.currentDay=a.selectedDay,a.currentMonth=a.selectedMonth,a.currentYear=a.selectedYear);var e=b?typeof b=="object"?b:this._daylightSavingAdjust(new Date(d,c,b)):this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return this.formatDate(this._get(a,"dateFormat"),e,this._getFormatConfig(a))}}),$.fn.datepicker=function(a){if(!this.length)return this;$.datepicker.initialized||($(document).mousedown($.datepicker._checkExternalClick).find("body").append($.datepicker.dpDiv),$.datepicker.initialized=!0);var b=Array.prototype.slice.call(arguments,1);if(typeof a=="string"&&(a=="isDisabled"||a=="getDate"||a=="widget"))return $.datepicker["_"+a+"Datepicker"].apply($.datepicker,[this[0]].concat(b));if(a=="option"&&arguments.length==2&&typeof arguments[1]=="string")return $.datepicker["_"+a+"Datepicker"].apply($.datepicker,[this[0]].concat(b));return this.each(function(){typeof a=="string"?$.datepicker["_"+a+"Datepicker"].apply($.datepicker,[this].concat(b)):$.datepicker._attachDatepicker(this,a)})},$.datepicker=new Datepicker,$.datepicker.initialized=!1,$.datepicker.uuid=(new Date).getTime(),$.datepicker.version="1.8.18",window["DP_jQuery_"+dpuuid]=$})(jQuery);/*
+ * jQuery UI Progressbar 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Progressbar
+ *
+ * Depends:
+ * jquery.ui.core.js
+ * jquery.ui.widget.js
+ */(function(a,b){a.widget("ui.progressbar",{options:{value:0,max:100},min:0,_create:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min,"aria-valuemax":this.options.max,"aria-valuenow":this._value()}),this.valueDiv=a("<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>").appendTo(this.element),this.oldValue=this._value(),this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.valueDiv.remove(),a.Widget.prototype.destroy.apply(this,arguments)},value:function(a){if(a===b)return this._value();this._setOption("value",a);return this},_setOption:function(b,c){b==="value"&&(this.options.value=c,this._refreshValue(),this._value()===this.options.max&&this._trigger("complete")),a.Widget.prototype._setOption.apply(this,arguments)},_value:function(){var a=this.options.value;typeof a!="number"&&(a=0);return Math.min(this.options.max,Math.max(this.min,a))},_percentage:function(){return 100*this._value()/this.options.max},_refreshValue:function(){var a=this.value(),b=this._percentage();this.oldValue!==a&&(this.oldValue=a,this._trigger("change")),this.valueDiv.toggle(a>this.min).toggleClass("ui-corner-right",a===this.options.max).width(b.toFixed(0)+"%"),this.element.attr("aria-valuenow",a)}}),a.extend(a.ui.progressbar,{version:"1.8.18"})})(jQuery);/*
+ * jQuery UI Effects 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Effects/
+ */jQuery.effects||function(a,b){function l(b){if(!b||typeof b=="number"||a.fx.speeds[b])return!0;if(typeof b=="string"&&!a.effects[b])return!0;return!1}function k(b,c,d,e){typeof b=="object"&&(e=c,d=null,c=b,b=c.effect),a.isFunction(c)&&(e=c,d=null,c={});if(typeof c=="number"||a.fx.speeds[c])e=d,d=c,c={};a.isFunction(d)&&(e=d,d=null),c=c||{},d=d||c.duration,d=a.fx.off?0:typeof d=="number"?d:d in a.fx.speeds?a.fx.speeds[d]:a.fx.speeds._default,e=e||c.complete;return[b,c,d,e]}function j(a,b){var c={_:0},d;for(d in b)a[d]!=b[d]&&(c[d]=b[d]);return c}function i(b){var c,d;for(c in b)d=b[c],(d==null||a.isFunction(d)||c in g||/scrollbar/.test(c)||!/color/i.test(c)&&isNaN(parseFloat(d)))&&delete b[c];return b}function h(){var a=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle,b={},c,d;if(a&&a.length&&a[0]&&a[a[0]]){var e=a.length;while(e--)c=a[e],typeof a[c]=="string"&&(d=c.replace(/\-(\w)/g,function(a,b){return b.toUpperCase()}),b[d]=a[c])}else for(c in a)typeof a[c]=="string"&&(b[c]=a[c]);return b}function d(b,d){var e;do{e=a.curCSS(b,d);if(e!=""&&e!="transparent"||a.nodeName(b,"body"))break;d="backgroundColor"}while(b=b.parentNode);return c(e)}function c(b){var c;if(b&&b.constructor==Array&&b.length==3)return b;if(c=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(b))return[parseInt(c[1],10),parseInt(c[2],10),parseInt(c[3],10)];if(c=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(b))return[parseFloat(c[1])*2.55,parseFloat(c[2])*2.55,parseFloat(c[3])*2.55];if(c=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(b))return[parseInt(c[1],16),parseInt(c[2],16),parseInt(c[3],16)];if(c=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(b))return[parseInt(c[1]+c[1],16),parseInt(c[2]+c[2],16),parseInt(c[3]+c[3],16)];if(c=/rgba\(0, 0, 0, 0\)/.exec(b))return e.transparent;return e[a.trim(b).toLowerCase()]}a.effects={},a.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","borderColor","color","outlineColor"],function(b,e){a.fx.step[e]=function(a){a.colorInit||(a.start=d(a.elem,e),a.end=c(a.end),a.colorInit=!0),a.elem.style[e]="rgb("+Math.max(Math.min(parseInt(a.pos*(a.end[0]-a.start[0])+a.start[0],10),255),0)+","+Math.max(Math.min(parseInt(a.pos*(a.end[1]-a.start[1])+a.start[1],10),255),0)+","+Math.max(Math.min(parseInt(a.pos*(a.end[2]-a.start[2])+a.start[2],10),255),0)+")"}});var e={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]},f=["add","remove","toggle"],g={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};a.effects.animateClass=function(b,c,d,e){a.isFunction(d)&&(e=d,d=null);return this.queue(function(){var g=a(this),k=g.attr("style")||" ",l=i(h.call(this)),m,n=g.attr("class");a.each(f,function(a,c){b[c]&&g[c+"Class"](b[c])}),m=i(h.call(this)),g.attr("class",n),g.animate(j(l,m),{queue:!1,duration:c,easing:d,complete:function(){a.each(f,function(a,c){b[c]&&g[c+"Class"](b[c])}),typeof g.attr("style")=="object"?(g.attr("style").cssText="",g.attr("style").cssText=k):g.attr("style",k),e&&e.apply(this,arguments),a.dequeue(this)}})})},a.fn.extend({_addClass:a.fn.addClass,addClass:function(b,c,d,e){return c?a.effects.animateClass.apply(this,[{add:b},c,d,e]):this._addClass(b)},_removeClass:a.fn.removeClass,removeClass:function(b,c,d,e){return c?a.effects.animateClass.apply(this,[{remove:b},c,d,e]):this._removeClass(b)},_toggleClass:a.fn.toggleClass,toggleClass:function(c,d,e,f,g){return typeof d=="boolean"||d===b?e?a.effects.animateClass.apply(this,[d?{add:c}:{remove:c},e,f,g]):this._toggleClass(c,d):a.effects.animateClass.apply(this,[{toggle:c},d,e,f])},switchClass:function(b,c,d,e,f){return a.effects.animateClass.apply(this,[{add:c,remove:b},d,e,f])}}),a.extend(a.effects,{version:"1.8.18",save:function(a,b){for(var c=0;c<b.length;c++)b[c]!==null&&a.data("ec.storage."+b[c],a[0].style[b[c]])},restore:function(a,b){for(var c=0;c<b.length;c++)b[c]!==null&&a.css(b[c],a.data("ec.storage."+b[c]))},setMode:function(a,b){b=="toggle"&&(b=a.is(":hidden")?"show":"hide");return b},getBaseline:function(a,b){var c,d;switch(a[0]){case"top":c=0;break;case"middle":c=.5;break;case"bottom":c=1;break;default:c=a[0]/b.height}switch(a[1]){case"left":d=0;break;case"center":d=.5;break;case"right":d=1;break;default:d=a[1]/b.width}return{x:d,y:c}},createWrapper:function(b){if(b.parent().is(".ui-effects-wrapper"))return b.parent();var c={width:b.outerWidth(!0),height:b.outerHeight(!0),"float":b.css("float")},d=a("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),e=document.activeElement;b.wrap(d),(b[0]===e||a.contains(b[0],e))&&a(e).focus(),d=b.parent(),b.css("position")=="static"?(d.css({position:"relative"}),b.css({position:"relative"})):(a.extend(c,{position:b.css("position"),zIndex:b.css("z-index")}),a.each(["top","left","bottom","right"],function(a,d){c[d]=b.css(d),isNaN(parseInt(c[d],10))&&(c[d]="auto")}),b.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"}));return d.css(c).show()},removeWrapper:function(b){var c,d=document.activeElement;if(b.parent().is(".ui-effects-wrapper")){c=b.parent().replaceWith(b),(b[0]===d||a.contains(b[0],d))&&a(d).focus();return c}return b},setTransition:function(b,c,d,e){e=e||{},a.each(c,function(a,c){unit=b.cssUnit(c),unit[0]>0&&(e[c]=unit[0]*d+unit[1])});return e}}),a.fn.extend({effect:function(b,c,d,e){var f=k.apply(this,arguments),g={options:f[1],duration:f[2],callback:f[3]},h=g.options.mode,i=a.effects[b];if(a.fx.off||!i)return h?this[h](g.duration,g.callback):this.each(function(){g.callback&&g.callback.call(this)});return i.call(this,g)},_show:a.fn.show,show:function(a){if(l(a))return this._show.apply(this,arguments);var b=k.apply(this,arguments);b[1].mode="show";return this.effect.apply(this,b)},_hide:a.fn.hide,hide:function(a){if(l(a))return this._hide.apply(this,arguments);var b=k.apply(this,arguments);b[1].mode="hide";return this.effect.apply(this,b)},__toggle:a.fn.toggle,toggle:function(b){if(l(b)||typeof b=="boolean"||a.isFunction(b))return this.__toggle.apply(this,arguments);var c=k.apply(this,arguments);c[1].mode="toggle";return this.effect.apply(this,c)},cssUnit:function(b){var c=this.css(b),d=[];a.each(["em","px","%","pt"],function(a,b){c.indexOf(b)>0&&(d=[parseFloat(c),b])});return d}}),a.easing.jswing=a.easing.swing,a.extend(a.easing,{def:"easeOutQuad",swing:function(b,c,d,e,f){return a.easing[a.easing.def](b,c,d,e,f)},easeInQuad:function(a,b,c,d,e){return d*(b/=e)*b+c},easeOutQuad:function(a,b,c,d,e){return-d*(b/=e)*(b-2)+c},easeInOutQuad:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b+c;return-d/2*(--b*(b-2)-1)+c},easeInCubic:function(a,b,c,d,e){return d*(b/=e)*b*b+c},easeOutCubic:function(a,b,c,d,e){return d*((b=b/e-1)*b*b+1)+c},easeInOutCubic:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b*b+c;return d/2*((b-=2)*b*b+2)+c},easeInQuart:function(a,b,c,d,e){return d*(b/=e)*b*b*b+c},easeOutQuart:function(a,b,c,d,e){return-d*((b=b/e-1)*b*b*b-1)+c},easeInOutQuart:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b*b*b+c;return-d/2*((b-=2)*b*b*b-2)+c},easeInQuint:function(a,b,c,d,e){return d*(b/=e)*b*b*b*b+c},easeOutQuint:function(a,b,c,d,e){return d*((b=b/e-1)*b*b*b*b+1)+c},easeInOutQuint:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b*b*b*b+c;return d/2*((b-=2)*b*b*b*b+2)+c},easeInSine:function(a,b,c,d,e){return-d*Math.cos(b/e*(Math.PI/2))+d+c},easeOutSine:function(a,b,c,d,e){return d*Math.sin(b/e*(Math.PI/2))+c},easeInOutSine:function(a,b,c,d,e){return-d/2*(Math.cos(Math.PI*b/e)-1)+c},easeInExpo:function(a,b,c,d,e){return b==0?c:d*Math.pow(2,10*(b/e-1))+c},easeOutExpo:function(a,b,c,d,e){return b==e?c+d:d*(-Math.pow(2,-10*b/e)+1)+c},easeInOutExpo:function(a,b,c,d,e){if(b==0)return c;if(b==e)return c+d;if((b/=e/2)<1)return d/2*Math.pow(2,10*(b-1))+c;return d/2*(-Math.pow(2,-10*--b)+2)+c},easeInCirc:function(a,b,c,d,e){return-d*(Math.sqrt(1-(b/=e)*b)-1)+c},easeOutCirc:function(a,b,c,d,e){return d*Math.sqrt(1-(b=b/e-1)*b)+c},easeInOutCirc:function(a,b,c,d,e){if((b/=e/2)<1)return-d/2*(Math.sqrt(1-b*b)-1)+c;return d/2*(Math.sqrt(1-(b-=2)*b)+1)+c},easeInElastic:function(a,b,c,d,e){var f=1.70158,g=0,h=d;if(b==0)return c;if((b/=e)==1)return c+d;g||(g=e*.3);if(h<Math.abs(d)){h=d;var f=g/4}else var f=g/(2*Math.PI)*Math.asin(d/h);return-(h*Math.pow(2,10*(b-=1))*Math.sin((b*e-f)*2*Math.PI/g))+c},easeOutElastic:function(a,b,c,d,e){var f=1.70158,g=0,h=d;if(b==0)return c;if((b/=e)==1)return c+d;g||(g=e*.3);if(h<Math.abs(d)){h=d;var f=g/4}else var f=g/(2*Math.PI)*Math.asin(d/h);return h*Math.pow(2,-10*b)*Math.sin((b*e-f)*2*Math.PI/g)+d+c},easeInOutElastic:function(a,b,c,d,e){var f=1.70158,g=0,h=d;if(b==0)return c;if((b/=e/2)==2)return c+d;g||(g=e*.3*1.5);if(h<Math.abs(d)){h=d;var f=g/4}else var f=g/(2*Math.PI)*Math.asin(d/h);if(b<1)return-0.5*h*Math.pow(2,10*(b-=1))*Math.sin((b*e-f)*2*Math.PI/g)+c;return h*Math.pow(2,-10*(b-=1))*Math.sin((b*e-f)*2*Math.PI/g)*.5+d+c},easeInBack:function(a,c,d,e,f,g){g==b&&(g=1.70158);return e*(c/=f)*c*((g+1)*c-g)+d},easeOutBack:function(a,c,d,e,f,g){g==b&&(g=1.70158);return e*((c=c/f-1)*c*((g+1)*c+g)+1)+d},easeInOutBack:function(a,c,d,e,f,g){g==b&&(g=1.70158);if((c/=f/2)<1)return e/2*c*c*(((g*=1.525)+1)*c-g)+d;return e/2*((c-=2)*c*(((g*=1.525)+1)*c+g)+2)+d},easeInBounce:function(b,c,d,e,f){return e-a.easing.easeOutBounce(b,f-c,0,e,f)+d},easeOutBounce:function(a,b,c,d,e){return(b/=e)<1/2.75?d*7.5625*b*b+c:b<2/2.75?d*(7.5625*(b-=1.5/2.75)*b+.75)+c:b<2.5/2.75?d*(7.5625*(b-=2.25/2.75)*b+.9375)+c:d*(7.5625*(b-=2.625/2.75)*b+.984375)+c},easeInOutBounce:function(b,c,d,e,f){if(c<f/2)return a.easing.easeInBounce(b,c*2,0,e,f)*.5+d;return a.easing.easeOutBounce(b,c*2-f,0,e,f)*.5+e*.5+d}})}(jQuery);/*
+ * jQuery UI Effects Blind 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Effects/Blind
+ *
+ * Depends:
+ * jquery.effects.core.js
+ */(function(a,b){a.effects.blind=function(b){return this.queue(function(){var c=a(this),d=["position","top","bottom","left","right"],e=a.effects.setMode(c,b.options.mode||"hide"),f=b.options.direction||"vertical";a.effects.save(c,d),c.show();var g=a.effects.createWrapper(c).css({overflow:"hidden"}),h=f=="vertical"?"height":"width",i=f=="vertical"?g.height():g.width();e=="show"&&g.css(h,0);var j={};j[h]=e=="show"?i:0,g.animate(j,b.duration,b.options.easing,function(){e=="hide"&&c.hide(),a.effects.restore(c,d),a.effects.removeWrapper(c),b.callback&&b.callback.apply(c[0],arguments),c.dequeue()})})}})(jQuery);/*
+ * jQuery UI Effects Bounce 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Effects/Bounce
+ *
+ * Depends:
+ * jquery.effects.core.js
+ */(function(a,b){a.effects.bounce=function(b){return this.queue(function(){var c=a(this),d=["position","top","bottom","left","right"],e=a.effects.setMode(c,b.options.mode||"effect"),f=b.options.direction||"up",g=b.options.distance||20,h=b.options.times||5,i=b.duration||250;/show|hide/.test(e)&&d.push("opacity"),a.effects.save(c,d),c.show(),a.effects.createWrapper(c);var j=f=="up"||f=="down"?"top":"left",k=f=="up"||f=="left"?"pos":"neg",g=b.options.distance||(j=="top"?c.outerHeight({margin:!0})/3:c.outerWidth({margin:!0})/3);e=="show"&&c.css("opacity",0).css(j,k=="pos"?-g:g),e=="hide"&&(g=g/(h*2)),e!="hide"&&h--;if(e=="show"){var l={opacity:1};l[j]=(k=="pos"?"+=":"-=")+g,c.animate(l,i/2,b.options.easing),g=g/2,h--}for(var m=0;m<h;m++){var n={},p={};n[j]=(k=="pos"?"-=":"+=")+g,p[j]=(k=="pos"?"+=":"-=")+g,c.animate(n,i/2,b.options.easing).animate(p,i/2,b.options.easing),g=e=="hide"?g*2:g/2}if(e=="hide"){var l={opacity:0};l[j]=(k=="pos"?"-=":"+=")+g,c.animate(l,i/2,b.options.easing,function(){c.hide(),a.effects.restore(c,d),a.effects.removeWrapper(c),b.callback&&b.callback.apply(this,arguments)})}else{var n={},p={};n[j]=(k=="pos"?"-=":"+=")+g,p[j]=(k=="pos"?"+=":"-=")+g,c.animate(n,i/2,b.options.easing).animate(p,i/2,b.options.easing,function(){a.effects.restore(c,d),a.effects.removeWrapper(c),b.callback&&b.callback.apply(this,arguments)})}c.queue("fx",function(){c.dequeue()}),c.dequeue()})}})(jQuery);/*
+ * jQuery UI Effects Clip 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Effects/Clip
+ *
+ * Depends:
+ * jquery.effects.core.js
+ */(function(a,b){a.effects.clip=function(b){return this.queue(function(){var c=a(this),d=["position","top","bottom","left","right","height","width"],e=a.effects.setMode(c,b.options.mode||"hide"),f=b.options.direction||"vertical";a.effects.save(c,d),c.show();var g=a.effects.createWrapper(c).css({overflow:"hidden"}),h=c[0].tagName=="IMG"?g:c,i={size:f=="vertical"?"height":"width",position:f=="vertical"?"top":"left"},j=f=="vertical"?h.height():h.width();e=="show"&&(h.css(i.size,0),h.css(i.position,j/2));var k={};k[i.size]=e=="show"?j:0,k[i.position]=e=="show"?0:j/2,h.animate(k,{queue:!1,duration:b.duration,easing:b.options.easing,complete:function(){e=="hide"&&c.hide(),a.effects.restore(c,d),a.effects.removeWrapper(c),b.callback&&b.callback.apply(c[0],arguments),c.dequeue()}})})}})(jQuery);/*
+ * jQuery UI Effects Drop 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Effects/Drop
+ *
+ * Depends:
+ * jquery.effects.core.js
+ */(function(a,b){a.effects.drop=function(b){return this.queue(function(){var c=a(this),d=["position","top","bottom","left","right","opacity"],e=a.effects.setMode(c,b.options.mode||"hide"),f=b.options.direction||"left";a.effects.save(c,d),c.show(),a.effects.createWrapper(c);var g=f=="up"||f=="down"?"top":"left",h=f=="up"||f=="left"?"pos":"neg",i=b.options.distance||(g=="top"?c.outerHeight({margin:!0})/2:c.outerWidth({margin:!0})/2);e=="show"&&c.css("opacity",0).css(g,h=="pos"?-i:i);var j={opacity:e=="show"?1:0};j[g]=(e=="show"?h=="pos"?"+=":"-=":h=="pos"?"-=":"+=")+i,c.animate(j,{queue:!1,duration:b.duration,easing:b.options.easing,complete:function(){e=="hide"&&c.hide(),a.effects.restore(c,d),a.effects.removeWrapper(c),b.callback&&b.callback.apply(this,arguments),c.dequeue()}})})}})(jQuery);/*
+ * jQuery UI Effects Explode 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Effects/Explode
+ *
+ * Depends:
+ * jquery.effects.core.js
+ */(function(a,b){a.effects.explode=function(b){return this.queue(function(){var c=b.options.pieces?Math.round(Math.sqrt(b.options.pieces)):3,d=b.options.pieces?Math.round(Math.sqrt(b.options.pieces)):3;b.options.mode=b.options.mode=="toggle"?a(this).is(":visible")?"hide":"show":b.options.mode;var e=a(this).show().css("visibility","hidden"),f=e.offset();f.top-=parseInt(e.css("marginTop"),10)||0,f.left-=parseInt(e.css("marginLeft"),10)||0;var g=e.outerWidth(!0),h=e.outerHeight(!0);for(var i=0;i<c;i++)for(var j=0;j<d;j++)e.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-j*(g/d),top:-i*(h/c)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:g/d,height:h/c,left:f.left+j*(g/d)+(b.options.mode=="show"?(j-Math.floor(d/2))*(g/d):0),top:f.top+i*(h/c)+(b.options.mode=="show"?(i-Math.floor(c/2))*(h/c):0),opacity:b.options.mode=="show"?0:1}).animate({left:f.left+j*(g/d)+(b.options.mode=="show"?0:(j-Math.floor(d/2))*(g/d)),top:f.top+i*(h/c)+(b.options.mode=="show"?0:(i-Math.floor(c/2))*(h/c)),opacity:b.options.mode=="show"?1:0},b.duration||500);setTimeout(function(){b.options.mode=="show"?e.css({visibility:"visible"}):e.css({visibility:"visible"}).hide(),b.callback&&b.callback.apply(e[0]),e.dequeue(),a("div.ui-effects-explode").remove()},b.duration||500)})}})(jQuery);/*
+ * jQuery UI Effects Fade 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Effects/Fade
+ *
+ * Depends:
+ * jquery.effects.core.js
+ */(function(a,b){a.effects.fade=function(b){return this.queue(function(){var c=a(this),d=a.effects.setMode(c,b.options.mode||"hide");c.animate({opacity:d},{queue:!1,duration:b.duration,easing:b.options.easing,complete:function(){b.callback&&b.callback.apply(this,arguments),c.dequeue()}})})}})(jQuery);/*
+ * jQuery UI Effects Fold 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Effects/Fold
+ *
+ * Depends:
+ * jquery.effects.core.js
+ */(function(a,b){a.effects.fold=function(b){return this.queue(function(){var c=a(this),d=["position","top","bottom","left","right"],e=a.effects.setMode(c,b.options.mode||"hide"),f=b.options.size||15,g=!!b.options.horizFirst,h=b.duration?b.duration/2:a.fx.speeds._default/2;a.effects.save(c,d),c.show();var i=a.effects.createWrapper(c).css({overflow:"hidden"}),j=e=="show"!=g,k=j?["width","height"]:["height","width"],l=j?[i.width(),i.height()]:[i.height(),i.width()],m=/([0-9]+)%/.exec(f);m&&(f=parseInt(m[1],10)/100*l[e=="hide"?0:1]),e=="show"&&i.css(g?{height:0,width:f}:{height:f,width:0});var n={},p={};n[k[0]]=e=="show"?l[0]:f,p[k[1]]=e=="show"?l[1]:0,i.animate(n,h,b.options.easing).animate(p,h,b.options.easing,function(){e=="hide"&&c.hide(),a.effects.restore(c,d),a.effects.removeWrapper(c),b.callback&&b.callback.apply(c[0],arguments),c.dequeue()})})}})(jQuery);/*
+ * jQuery UI Effects Highlight 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Effects/Highlight
+ *
+ * Depends:
+ * jquery.effects.core.js
+ */(function(a,b){a.effects.highlight=function(b){return this.queue(function(){var c=a(this),d=["backgroundImage","backgroundColor","opacity"],e=a.effects.setMode(c,b.options.mode||"show"),f={backgroundColor:c.css("backgroundColor")};e=="hide"&&(f.opacity=0),a.effects.save(c,d),c.show().css({backgroundImage:"none",backgroundColor:b.options.color||"#ffff99"}).animate(f,{queue:!1,duration:b.duration,easing:b.options.easing,complete:function(){e=="hide"&&c.hide(),a.effects.restore(c,d),e=="show"&&!a.support.opacity&&this.style.removeAttribute("filter"),b.callback&&b.callback.apply(this,arguments),c.dequeue()}})})}})(jQuery);/*
+ * jQuery UI Effects Pulsate 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Effects/Pulsate
+ *
+ * Depends:
+ * jquery.effects.core.js
+ */(function(a,b){a.effects.pulsate=function(b){return this.queue(function(){var c=a(this),d=a.effects.setMode(c,b.options.mode||"show");times=(b.options.times||5)*2-1,duration=b.duration?b.duration/2:a.fx.speeds._default/2,isVisible=c.is(":visible"),animateTo=0,isVisible||(c.css("opacity",0).show(),animateTo=1),(d=="hide"&&isVisible||d=="show"&&!isVisible)&&times--;for(var e=0;e<times;e++)c.animate({opacity:animateTo},duration,b.options.easing),animateTo=(animateTo+1)%2;c.animate({opacity:animateTo},duration,b.options.easing,function(){animateTo==0&&c.hide(),b.callback&&b.callback.apply(this,arguments)}),c.queue("fx",function(){c.dequeue()}).dequeue()})}})(jQuery);/*
+ * jQuery UI Effects Scale 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Effects/Scale
+ *
+ * Depends:
+ * jquery.effects.core.js
+ */(function(a,b){a.effects.puff=function(b){return this.queue(function(){var c=a(this),d=a.effects.setMode(c,b.options.mode||"hide"),e=parseInt(b.options.percent,10)||150,f=e/100,g={height:c.height(),width:c.width()};a.extend(b.options,{fade:!0,mode:d,percent:d=="hide"?e:100,from:d=="hide"?g:{height:g.height*f,width:g.width*f}}),c.effect("scale",b.options,b.duration,b.callback),c.dequeue()})},a.effects.scale=function(b){return this.queue(function(){var c=a(this),d=a.extend(!0,{},b.options),e=a.effects.setMode(c,b.options.mode||"effect"),f=parseInt(b.options.percent,10)||(parseInt(b.options.percent,10)==0?0:e=="hide"?0:100),g=b.options.direction||"both",h=b.options.origin;e!="effect"&&(d.origin=h||["middle","center"],d.restore=!0);var i={height:c.height(),width:c.width()};c.from=b.options.from||(e=="show"?{height:0,width:0}:i);var j={y:g!="horizontal"?f/100:1,x:g!="vertical"?f/100:1};c.to={height:i.height*j.y,width:i.width*j.x},b.options.fade&&(e=="show"&&(c.from.opacity=0,c.to.opacity=1),e=="hide"&&(c.from.opacity=1,c.to.opacity=0)),d.from=c.from,d.to=c.to,d.mode=e,c.effect("size",d,b.duration,b.callback),c.dequeue()})},a.effects.size=function(b){return this.queue(function(){var c=a(this),d=["position","top","bottom","left","right","width","height","overflow","opacity"],e=["position","top","bottom","left","right","overflow","opacity"],f=["width","height","overflow"],g=["fontSize"],h=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],i=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],j=a.effects.setMode(c,b.options.mode||"effect"),k=b.options.restore||!1,l=b.options.scale||"both",m=b.options.origin,n={height:c.height(),width:c.width()};c.from=b.options.from||n,c.to=b.options.to||n;if(m){var p=a.effects.getBaseline(m,n);c.from.top=(n.height-c.from.height)*p.y,c.from.left=(n.width-c.from.width)*p.x,c.to.top=(n.height-c.to.height)*p.y,c.to.left=(n.width-c.to.width)*p.x}var q={from:{y:c.from.height/n.height,x:c.from.width/n.width},to:{y:c.to.height/n.height,x:c.to.width/n.width}};if(l=="box"||l=="both")q.from.y!=q.to.y&&(d=d.concat(h),c.from=a.effects.setTransition(c,h,q.from.y,c.from),c.to=a.effects.setTransition(c,h,q.to.y,c.to)),q.from.x!=q.to.x&&(d=d.concat(i),c.from=a.effects.setTransition(c,i,q.from.x,c.from),c.to=a.effects.setTransition(c,i,q.to.x,c.to));(l=="content"||l=="both")&&q.from.y!=q.to.y&&(d=d.concat(g),c.from=a.effects.setTransition(c,g,q.from.y,c.from),c.to=a.effects.setTransition(c,g,q.to.y,c.to)),a.effects.save(c,k?d:e),c.show(),a.effects.createWrapper(c),c.css("overflow","hidden").css(c.from);if(l=="content"||l=="both")h=h.concat(["marginTop","marginBottom"]).concat(g),i=i.concat(["marginLeft","marginRight"]),f=d.concat(h).concat(i),c.find("*[width]").each(function(){child=a(this),k&&a.effects.save(child,f);var c={height:child.height(),width:child.width()};child.from={height:c.height*q.from.y,width:c.width*q.from.x},child.to={height:c.height*q.to.y,width:c.width*q.to.x},q.from.y!=q.to.y&&(child.from=a.effects.setTransition(child,h,q.from.y,child.from),child.to=a.effects.setTransition(child,h,q.to.y,child.to)),q.from.x!=q.to.x&&(child.from=a.effects.setTransition(child,i,q.from.x,child.from),child.to=a.effects.setTransition(child,i,q.to.x,child.to)),child.css(child.from),child.animate(child.to,b.duration,b.options.easing,function(){k&&a.effects.restore(child,f)})});c.animate(c.to,{queue:!1,duration:b.duration,easing:b.options.easing,complete:function(){c.to.opacity===0&&c.css("opacity",c.from.opacity),j=="hide"&&c.hide(),a.effects.restore(c,k?d:e),a.effects.removeWrapper(c),b.callback&&b.callback.apply(this,arguments),c.dequeue()}})})}})(jQuery);/*
+ * jQuery UI Effects Shake 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Effects/Shake
+ *
+ * Depends:
+ * jquery.effects.core.js
+ */(function(a,b){a.effects.shake=function(b){return this.queue(function(){var c=a(this),d=["position","top","bottom","left","right"],e=a.effects.setMode(c,b.options.mode||"effect"),f=b.options.direction||"left",g=b.options.distance||20,h=b.options.times||3,i=b.duration||b.options.duration||140;a.effects.save(c,d),c.show(),a.effects.createWrapper(c);var j=f=="up"||f=="down"?"top":"left",k=f=="up"||f=="left"?"pos":"neg",l={},m={},n={};l[j]=(k=="pos"?"-=":"+=")+g,m[j]=(k=="pos"?"+=":"-=")+g*2,n[j]=(k=="pos"?"-=":"+=")+g*2,c.animate(l,i,b.options.easing);for(var p=1;p<h;p++)c.animate(m,i,b.options.easing).animate(n,i,b.options.easing);c.animate(m,i,b.options.easing).animate(l,i/2,b.options.easing,function(){a.effects.restore(c,d),a.effects.removeWrapper(c),b.callback&&b.callback.apply(this,arguments)}),c.queue("fx",function(){c.dequeue()}),c.dequeue()})}})(jQuery);/*
+ * jQuery UI Effects Slide 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Effects/Slide
+ *
+ * Depends:
+ * jquery.effects.core.js
+ */(function(a,b){a.effects.slide=function(b){return this.queue(function(){var c=a(this),d=["position","top","bottom","left","right"],e=a.effects.setMode(c,b.options.mode||"show"),f=b.options.direction||"left";a.effects.save(c,d),c.show(),a.effects.createWrapper(c).css({overflow:"hidden"});var g=f=="up"||f=="down"?"top":"left",h=f=="up"||f=="left"?"pos":"neg",i=b.options.distance||(g=="top"?c.outerHeight({margin:!0}):c.outerWidth({margin:!0}));e=="show"&&c.css(g,h=="pos"?isNaN(i)?"-"+i:-i:i);var j={};j[g]=(e=="show"?h=="pos"?"+=":"-=":h=="pos"?"-=":"+=")+i,c.animate(j,{queue:!1,duration:b.duration,easing:b.options.easing,complete:function(){e=="hide"&&c.hide(),a.effects.restore(c,d),a.effects.removeWrapper(c),b.callback&&b.callback.apply(this,arguments),c.dequeue()}})})}})(jQuery);/*
+ * jQuery UI Effects Transfer 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Effects/Transfer
+ *
+ * Depends:
+ * jquery.effects.core.js
+ */(function(a,b){a.effects.transfer=function(b){return this.queue(function(){var c=a(this),d=a(b.options.to),e=d.offset(),f={top:e.top,left:e.left,height:d.innerHeight(),width:d.innerWidth()},g=c.offset(),h=a('<div class="ui-effects-transfer"></div>').appendTo(document.body).addClass(b.options.className).css({top:g.top,left:g.left,height:c.innerHeight(),width:c.innerWidth(),position:"absolute"}).animate(f,b.duration,b.options.easing,function(){h.remove(),b.callback&&b.callback.apply(c[0],arguments),c.dequeue()})})}})(jQuery); \ No newline at end of file
diff --git a/storage/mroonga/vendor/groonga/examples/dictionary/init-db.sh b/storage/mroonga/vendor/groonga/examples/dictionary/init-db.sh
new file mode 100755
index 00000000000..351d90e7b30
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/examples/dictionary/init-db.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+if [ 1 != $# ]; then
+ echo "usage: $0 db_path"
+ exit 1
+fi
+
+if groonga-suggest-create-dataset $1 dictionary > /dev/null; then
+ echo "db initialized."
+fi
diff --git a/storage/mroonga/vendor/groonga/examples/dictionary/jmdict/Makefile.am b/storage/mroonga/vendor/groonga/examples/dictionary/jmdict/Makefile.am
new file mode 100644
index 00000000000..70b4a5bc010
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/examples/dictionary/jmdict/Makefile.am
@@ -0,0 +1,3 @@
+jmdictdir = $(examples_dictionarydir)/jmdict
+dist_jmdict_SCRIPTS = \
+ jmdict.rb
diff --git a/storage/mroonga/vendor/groonga/examples/dictionary/jmdict/jmdict.rb b/storage/mroonga/vendor/groonga/examples/dictionary/jmdict/jmdict.rb
new file mode 100755
index 00000000000..bf8926783cb
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/examples/dictionary/jmdict/jmdict.rb
@@ -0,0 +1,42 @@
+#!/usr/bin/env ruby
+# -*- coding: utf-8 -*-
+
+require 'rexml/document'
+require 'rexml/parsers/streamparser'
+require 'rexml/parsers/baseparser'
+require 'rexml/streamlistener'
+
+#REXML::Document.new(STDIN)
+
+class MyListener
+ include REXML::StreamListener
+ def tag_start(name, attrs)
+ # p name, attrs
+ case name
+ when 'entry'
+ @n = 0
+ end
+ end
+ def tag_end name
+ # p "tag_end: #{x}"
+ case name
+ when 'sense'
+ @n += 1
+ when 'entry'
+ @n_ents += 1
+ puts "#{@ent}:#{@n}" if (@n > 8)
+ when 'ent_seq'
+ @ent = @text
+ end
+ end
+
+ def text(text)
+ @text = text
+ end
+
+ def xmldecl(version, encoding, standalone)
+ @n_ents = 0
+ end
+end
+
+REXML::Parsers::StreamParser.new(STDIN, MyListener.new).parse
diff --git a/storage/mroonga/vendor/groonga/examples/dictionary/readme.txt b/storage/mroonga/vendor/groonga/examples/dictionary/readme.txt
new file mode 100644
index 00000000000..555706e0061
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/examples/dictionary/readme.txt
@@ -0,0 +1,71 @@
+.. highlightlang:: none
+
+辞書検索ツール
+==============
+
+åå‰
+----
+
+groonga辞書検索ツール
+
+説明
+----
+
+様々ãªå•†ç”¨ãƒ»éžå•†ç”¨ã®è¾žæ›¸ãƒ•ァイルをインãƒãƒ¼ãƒˆã—ã¦groongaã§æ¤œç´¢ã§ãるよã†ã«ã—ã¾ã™ã€‚
+
+対応ã—ã¦ã„る辞書
+++++++++++++++++
+
+ç¾çжã§ã¯ä¸‹è¨˜ã®è¾žæ›¸ã«å¯¾å¿œã—ã¦ã„ã¾ã™ã€‚
+
+* EDICT
+
+EDICTã¯ã€Monash大学Jim Breenæ•™æŽˆãŒæä¾›ã—ã¦ã„る和英辞書ã§ã™ã€‚下記ã‹ã‚‰å…¥æ‰‹ã§ãã¾ã™ã€‚
+
+http://ftp.monash.edu.au/pub/nihongo/edict.gz
+
+* GENE95
+
+GENE95ã¯ã€Kurumiã•ã‚“(NiftyID: GGD00145)ãŒä½œæˆã•れãŸè‹±å’Œè¾žæ›¸ã§ã™ã€‚下記ã‹ã‚‰å…¥æ‰‹ã§ãã¾ã™ã€‚
+
+http://www.namazu.org/~tsuchiya/sdic/data/gene95.tar.gz
+
+* 英辞郎
+
+英辞郎ã¯ã€EDPã¨ã„ã†å›£ä½“ã«ã‚ˆã£ã¦ç·¨çº‚ã•れã¦ã„る英和・和英辞書ã§ã™ã€‚
+
+http://www.eijiro.jp/
+
+書店やオンラインショップãªã©ã§è³¼å…¥ã§ãã¾ã™ã€‚
+
+データベースã®åˆæœŸåŒ–
+++++++++++++++++++++
+
+本ディレクトリã§ä¸‹è¨˜ã®ã‚ˆã†ã«å®Ÿè¡Œã—ã€è¾žæ›¸ãƒ‡ãƒ¼ã‚¿ã‚’æ ¼ç´ã™ã‚‹ãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹ãƒ•ァイルを下記ã®ã‚ˆã†ã«ã—ã¦åˆæœŸåŒ–ã—ã¾ã™ã€‚
+
+ ./init-db.sh データベースパスå
+
+ã“ã®ã‚ˆã†ã«ã—ã¦ä½œæˆã—ãŸãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹ã«ã¤ã„ã¦ã€æ§˜ã€…ãªè¾žæ›¸ã®ãƒ‡ãƒ¼ã‚¿ã‚’インãƒãƒ¼ãƒˆã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚
+
+インãƒãƒ¼ãƒˆã®æ–¹æ³•
+++++++++++++++++
+
+* EDICT
+
+edictディレクトリé…下ã§ä»¥ä¸‹ã®ã‚ˆã†ã«å®Ÿè¡Œã—ã¾ã™ã€‚ edict.gzã¯è‡ªå‹•ã§ãƒ€ã‚¦ãƒ³ãƒ­ãƒ¼ãƒ‰ã—ã¾ã™ã€‚
+
+ ./edict-import.sh データベースパスå
+
+* GENE95
+
+gene95ディレクトリé…下ã§ä¸‹è¨˜ã®ã‚ˆã†ã«å®Ÿè¡Œã—ã¾ã™ã€‚ gene95.tar.gzã¯è‡ªå‹•ã§ãƒ€ã‚¦ãƒ³ãƒ­ãƒ¼ãƒ‰ã—ã¾ã™ã€‚
+
+ ./gene-import.sh データベースパスå
+
+* 英辞郎
+
+英辞郎ã«ä»˜å±žã®PDICツールを用ã„ã¦CSVファイル形å¼ã«è¾žæ›¸ã‚’エクスãƒãƒ¼ãƒˆã—ã¾ã™ã€‚(ã“ã®ã¨ã「登録項目ã€ã§ã™ã¹ã¦ã®é …目を出力ã™ã‚‹ã‚ˆã†ã«ã—ã¾ã™) eijiroディレクトリé…下ã§ä¸‹è¨˜ã®ã‚ˆã†ã«å®Ÿè¡Œã—ã¾ã™ã€‚
+
+ ./eijiro-import.sh データベースパスå 出力ã—ãŸCSVファイルã®ãƒ‘スå
+
+(英辞郎第四版ã§å‹•作を確èªã—ã¦ã„ã¾ã™)
diff --git a/storage/mroonga/vendor/groonga/groonga-httpd-conf.sh.in b/storage/mroonga/vendor/groonga/groonga-httpd-conf.sh.in
index 22a90d82430..380495bb391 100644
--- a/storage/mroonga/vendor/groonga/groonga-httpd-conf.sh.in
+++ b/storage/mroonga/vendor/groonga/groonga-httpd-conf.sh.in
@@ -6,13 +6,15 @@ sysconfdir="@sysconfdir@"
pkgsysconfdir="@pkgsysconfdir@"
localstatedir="@localstatedir@"
+EXEEXT="@EXEEXT@"
+
SED="@SED@"
export GROONGA_HTTPD_MODULE_PATH="@abs_top_srcdir@/src/httpd/nginx-module"
export GROONGA_HTTPD_IN_TREE_INCLUDE_PATH="@abs_top_srcdir@/include"
export GROONGA_HTTPD_IN_TREE_LINK_PATH="@abs_top_builddir@/lib/.libs"
export GROONGA_HTTPD_PREFIX="${pkgsysconfdir}/httpd"
-export GROONGA_HTTPD_BIN_PATH="${sbindir}/groonga-httpd"
+export GROONGA_HTTPD_BIN_PATH="${sbindir}/groonga-httpd${EXEEXT}"
export GROONGA_HTTPD_CONF_PATH="${pkgsysconfdir}/httpd/groonga-httpd.conf"
export GROONGA_HTTPD_ERROR_LOG_PATH="${localstatedir}/log/groonga/httpd/error.log"
export GROONGA_HTTPD_HTTP_LOG_PATH="${localstatedir}/log/groonga/httpd/access.log"
diff --git a/storage/mroonga/vendor/groonga/include/CMakeLists.txt b/storage/mroonga/vendor/groonga/include/CMakeLists.txt
index 96e22474cbf..7594c6e6c66 100644
--- a/storage/mroonga/vendor/groonga/include/CMakeLists.txt
+++ b/storage/mroonga/vendor/groonga/include/CMakeLists.txt
@@ -13,8 +13,6 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-if(NOT MRN_GROONGA_BUNDLED)
- install(FILES groonga.h DESTINATION "${GRN_INCLUDE_DIR}")
- install(DIRECTORY groonga DESTINATION "${GRN_INCLUDE_DIR}"
- FILES_MATCHING PATTERN "*.h")
-endif()
+install(FILES groonga.h DESTINATION "${GRN_INCLUDE_DIR}")
+install(DIRECTORY groonga DESTINATION "${GRN_INCLUDE_DIR}"
+ FILES_MATCHING PATTERN "*.h")
diff --git a/storage/mroonga/vendor/groonga/include/groonga.h b/storage/mroonga/vendor/groonga/include/groonga.h
index d1cf1e24a56..db2303a32c6 100644
--- a/storage/mroonga/vendor/groonga/include/groonga.h
+++ b/storage/mroonga/vendor/groonga/include/groonga.h
@@ -1,5 +1,5 @@
/*
- Copyright(C) 2009-2014 Brazil
+ Copyright(C) 2014-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -18,2089 +18,13 @@
#ifndef GROONGA_H
#define GROONGA_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdarg.h>
-
-#ifndef GRN_API
-#if defined(_WIN32) || defined(_WIN64)
-#define GRN_API __declspec(dllimport)
-#else
-#define GRN_API
-#endif /* defined(_WIN32) || defined(_WIN64) */
-#endif /* GRN_API */
-
-typedef unsigned int grn_id;
-typedef unsigned char grn_bool;
-
-#define GRN_ID_NIL (0x00)
-#define GRN_ID_MAX (0x3fffffff)
-
-#define GRN_TRUE (1)
-#define GRN_FALSE (0)
-
-typedef enum {
- GRN_SUCCESS = 0,
- GRN_END_OF_DATA = 1,
- GRN_UNKNOWN_ERROR = -1,
- GRN_OPERATION_NOT_PERMITTED = -2,
- GRN_NO_SUCH_FILE_OR_DIRECTORY = -3,
- GRN_NO_SUCH_PROCESS = -4,
- GRN_INTERRUPTED_FUNCTION_CALL = -5,
- GRN_INPUT_OUTPUT_ERROR = -6,
- GRN_NO_SUCH_DEVICE_OR_ADDRESS = -7,
- GRN_ARG_LIST_TOO_LONG = -8,
- GRN_EXEC_FORMAT_ERROR = -9,
- GRN_BAD_FILE_DESCRIPTOR = -10,
- GRN_NO_CHILD_PROCESSES = -11,
- GRN_RESOURCE_TEMPORARILY_UNAVAILABLE = -12,
- GRN_NOT_ENOUGH_SPACE = -13,
- GRN_PERMISSION_DENIED = -14,
- GRN_BAD_ADDRESS = -15,
- GRN_RESOURCE_BUSY = -16,
- GRN_FILE_EXISTS = -17,
- GRN_IMPROPER_LINK = -18,
- GRN_NO_SUCH_DEVICE = -19,
- GRN_NOT_A_DIRECTORY = -20,
- GRN_IS_A_DIRECTORY = -21,
- GRN_INVALID_ARGUMENT = -22,
- GRN_TOO_MANY_OPEN_FILES_IN_SYSTEM = -23,
- GRN_TOO_MANY_OPEN_FILES = -24,
- GRN_INAPPROPRIATE_I_O_CONTROL_OPERATION = -25,
- GRN_FILE_TOO_LARGE = -26,
- GRN_NO_SPACE_LEFT_ON_DEVICE = -27,
- GRN_INVALID_SEEK = -28,
- GRN_READ_ONLY_FILE_SYSTEM = -29,
- GRN_TOO_MANY_LINKS = -30,
- GRN_BROKEN_PIPE = -31,
- GRN_DOMAIN_ERROR = -32,
- GRN_RESULT_TOO_LARGE = -33,
- GRN_RESOURCE_DEADLOCK_AVOIDED = -34,
- GRN_NO_MEMORY_AVAILABLE = -35,
- GRN_FILENAME_TOO_LONG = -36,
- GRN_NO_LOCKS_AVAILABLE = -37,
- GRN_FUNCTION_NOT_IMPLEMENTED = -38,
- GRN_DIRECTORY_NOT_EMPTY = -39,
- GRN_ILLEGAL_BYTE_SEQUENCE = -40,
- GRN_SOCKET_NOT_INITIALIZED = -41,
- GRN_OPERATION_WOULD_BLOCK = -42,
- GRN_ADDRESS_IS_NOT_AVAILABLE = -43,
- GRN_NETWORK_IS_DOWN = -44,
- GRN_NO_BUFFER = -45,
- GRN_SOCKET_IS_ALREADY_CONNECTED = -46,
- GRN_SOCKET_IS_NOT_CONNECTED = -47,
- GRN_SOCKET_IS_ALREADY_SHUTDOWNED = -48,
- GRN_OPERATION_TIMEOUT = -49,
- GRN_CONNECTION_REFUSED = -50,
- GRN_RANGE_ERROR = -51,
- GRN_TOKENIZER_ERROR = -52,
- GRN_FILE_CORRUPT = -53,
- GRN_INVALID_FORMAT = -54,
- GRN_OBJECT_CORRUPT = -55,
- GRN_TOO_MANY_SYMBOLIC_LINKS = -56,
- GRN_NOT_SOCKET = -57,
- GRN_OPERATION_NOT_SUPPORTED = -58,
- GRN_ADDRESS_IS_IN_USE = -59,
- GRN_ZLIB_ERROR = -60,
- GRN_LZO_ERROR = -61,
- GRN_STACK_OVER_FLOW = -62,
- GRN_SYNTAX_ERROR = -63,
- GRN_RETRY_MAX = -64,
- GRN_INCOMPATIBLE_FILE_FORMAT = -65,
- GRN_UPDATE_NOT_ALLOWED = -66,
- GRN_TOO_SMALL_OFFSET = -67,
- GRN_TOO_LARGE_OFFSET = -68,
- GRN_TOO_SMALL_LIMIT = -69,
- GRN_CAS_ERROR = -70,
- GRN_UNSUPPORTED_COMMAND_VERSION = -71,
- GRN_NORMALIZER_ERROR = -72,
- GRN_TOKEN_FILTER_ERROR = -73,
-} grn_rc;
-
-GRN_API grn_rc grn_init(void);
-GRN_API grn_rc grn_fin(void);
-
-typedef enum {
- GRN_ENC_DEFAULT = 0,
- GRN_ENC_NONE,
- GRN_ENC_EUC_JP,
- GRN_ENC_UTF8,
- GRN_ENC_SJIS,
- GRN_ENC_LATIN1,
- GRN_ENC_KOI8R
-} grn_encoding;
-
-typedef enum {
- GRN_COMMAND_VERSION_DEFAULT = 0,
- GRN_COMMAND_VERSION_1,
- GRN_COMMAND_VERSION_2
-} grn_command_version;
-
-#define GRN_COMMAND_VERSION_MIN GRN_COMMAND_VERSION_1
-#define GRN_COMMAND_VERSION_STABLE GRN_COMMAND_VERSION_1
-#define GRN_COMMAND_VERSION_MAX GRN_COMMAND_VERSION_2
-
-typedef enum {
- GRN_LOG_NONE = 0,
- GRN_LOG_EMERG,
- GRN_LOG_ALERT,
- GRN_LOG_CRIT,
- GRN_LOG_ERROR,
- GRN_LOG_WARNING,
- GRN_LOG_NOTICE,
- GRN_LOG_INFO,
- GRN_LOG_DEBUG,
- GRN_LOG_DUMP
-} grn_log_level;
-
-/* query log flags */
-#define GRN_QUERY_LOG_NONE (0x00)
-#define GRN_QUERY_LOG_COMMAND (0x01<<0)
-#define GRN_QUERY_LOG_RESULT_CODE (0x01<<1)
-#define GRN_QUERY_LOG_DESTINATION (0x01<<2)
-#define GRN_QUERY_LOG_CACHE (0x01<<3)
-#define GRN_QUERY_LOG_SIZE (0x01<<4)
-#define GRN_QUERY_LOG_SCORE (0x01<<5)
-#define GRN_QUERY_LOG_ALL\
- (GRN_QUERY_LOG_COMMAND |\
- GRN_QUERY_LOG_RESULT_CODE |\
- GRN_QUERY_LOG_DESTINATION |\
- GRN_QUERY_LOG_CACHE |\
- GRN_QUERY_LOG_SIZE |\
- GRN_QUERY_LOG_SCORE)
-#define GRN_QUERY_LOG_DEFAULT GRN_QUERY_LOG_ALL
-
-typedef enum {
- GRN_CONTENT_NONE = 0,
- GRN_CONTENT_TSV,
- GRN_CONTENT_JSON,
- GRN_CONTENT_XML,
- GRN_CONTENT_MSGPACK
-} grn_content_type;
-
-typedef struct _grn_obj grn_obj;
-typedef struct _grn_ctx grn_ctx;
-
-#define GRN_CTX_MSGSIZE (0x80)
-#define GRN_CTX_FIN (0xff)
-
-typedef union {
- int int_value;
- grn_id id;
- void *ptr;
-} grn_user_data;
-
-typedef grn_obj *grn_proc_func(grn_ctx *ctx, int nargs, grn_obj **args,
- grn_user_data *user_data);
-
-struct _grn_ctx {
- grn_rc rc;
- int flags;
- grn_encoding encoding;
- unsigned char ntrace;
- unsigned char errlvl;
- unsigned char stat;
- unsigned int seqno;
- unsigned int subno;
- unsigned int seqno2;
- unsigned int errline;
- grn_user_data user_data;
- grn_ctx *prev;
- grn_ctx *next;
- const char *errfile;
- const char *errfunc;
- struct _grn_ctx_impl *impl;
- void *trace[16];
- char errbuf[GRN_CTX_MSGSIZE];
-};
-
-#define GRN_CTX_USER_DATA(ctx) (&((ctx)->user_data))
-
-/* Deprecated since 4.0.3. Don't use it. */
-#define GRN_CTX_USE_QL (0x03)
-/* Deprecated since 4.0.3. Don't use it. */
-#define GRN_CTX_BATCH_MODE (0x04)
-#define GRN_CTX_PER_DB (0x08)
-
-GRN_API grn_rc grn_ctx_init(grn_ctx *ctx, int flags);
-GRN_API grn_rc grn_ctx_fin(grn_ctx *ctx);
-GRN_API grn_ctx *grn_ctx_open(int flags);
-GRN_API grn_rc grn_ctx_close(grn_ctx *ctx);
-GRN_API grn_rc grn_ctx_set_finalizer(grn_ctx *ctx, grn_proc_func *func);
-
-GRN_API grn_encoding grn_get_default_encoding(void);
-GRN_API grn_rc grn_set_default_encoding(grn_encoding encoding);
-
-#define GRN_CTX_GET_ENCODING(ctx) ((ctx)->encoding)
-#define GRN_CTX_SET_ENCODING(ctx,enc) \
- ((ctx)->encoding = (enc == GRN_ENC_DEFAULT) ? grn_get_default_encoding() : enc)
-
-GRN_API const char *grn_get_version(void);
-GRN_API const char *grn_get_package(void);
-
-GRN_API grn_command_version grn_get_default_command_version(void);
-GRN_API grn_rc grn_set_default_command_version(grn_command_version version);
-GRN_API grn_command_version grn_ctx_get_command_version(grn_ctx *ctx);
-GRN_API grn_rc grn_ctx_set_command_version(grn_ctx *ctx, grn_command_version version);
-GRN_API long long int grn_ctx_get_match_escalation_threshold(grn_ctx *ctx);
-GRN_API grn_rc grn_ctx_set_match_escalation_threshold(grn_ctx *ctx, long long int threshold);
-GRN_API long long int grn_get_default_match_escalation_threshold(void);
-GRN_API grn_rc grn_set_default_match_escalation_threshold(long long int threshold);
-
-GRN_API int grn_get_lock_timeout(void);
-GRN_API grn_rc grn_set_lock_timeout(int timeout);
-
-/* cache */
-#define GRN_CACHE_DEFAULT_MAX_N_ENTRIES 100
-typedef struct _grn_cache grn_cache;
-
-GRN_API grn_cache *grn_cache_open(grn_ctx *ctx);
-GRN_API grn_rc grn_cache_close(grn_ctx *ctx, grn_cache *cache);
-
-GRN_API grn_rc grn_cache_current_set(grn_ctx *ctx, grn_cache *cache);
-GRN_API grn_cache *grn_cache_current_get(grn_ctx *ctx);
-
-GRN_API grn_rc grn_cache_set_max_n_entries(grn_ctx *ctx,
- grn_cache *cache,
- unsigned int n);
-GRN_API unsigned int grn_cache_get_max_n_entries(grn_ctx *ctx,
- grn_cache *cache);
-
-/* grn_encoding */
-
-GRN_API const char *grn_encoding_to_string(grn_encoding encoding);
-GRN_API grn_encoding grn_encoding_parse(const char *name);
-
-/* obj */
-
-typedef unsigned short int grn_obj_flags;
-
-#define GRN_OBJ_TABLE_TYPE_MASK (0x07)
-#define GRN_OBJ_TABLE_HASH_KEY (0x00)
-#define GRN_OBJ_TABLE_PAT_KEY (0x01)
-#define GRN_OBJ_TABLE_DAT_KEY (0x02)
-#define GRN_OBJ_TABLE_NO_KEY (0x03)
-
-#define GRN_OBJ_KEY_MASK (0x07<<3)
-#define GRN_OBJ_KEY_UINT (0x00<<3)
-#define GRN_OBJ_KEY_INT (0x01<<3)
-#define GRN_OBJ_KEY_FLOAT (0x02<<3)
-#define GRN_OBJ_KEY_GEO_POINT (0x03<<3)
-
-#define GRN_OBJ_KEY_WITH_SIS (0x01<<6)
-#define GRN_OBJ_KEY_NORMALIZE (0x01<<7)
-
-#define GRN_OBJ_COLUMN_TYPE_MASK (0x07)
-#define GRN_OBJ_COLUMN_SCALAR (0x00)
-#define GRN_OBJ_COLUMN_VECTOR (0x01)
-#define GRN_OBJ_COLUMN_INDEX (0x02)
-
-#define GRN_OBJ_COMPRESS_MASK (0x07<<4)
-#define GRN_OBJ_COMPRESS_NONE (0x00<<4)
-#define GRN_OBJ_COMPRESS_ZLIB (0x01<<4)
-#define GRN_OBJ_COMPRESS_LZO (0x02<<4)
-
-#define GRN_OBJ_WITH_SECTION (0x01<<7)
-#define GRN_OBJ_WITH_WEIGHT (0x01<<8)
-#define GRN_OBJ_WITH_POSITION (0x01<<9)
-#define GRN_OBJ_RING_BUFFER (0x01<<10)
-
-#define GRN_OBJ_UNIT_MASK (0x0f<<8)
-#define GRN_OBJ_UNIT_DOCUMENT_NONE (0x00<<8)
-#define GRN_OBJ_UNIT_DOCUMENT_SECTION (0x01<<8)
-#define GRN_OBJ_UNIT_DOCUMENT_POSITION (0x02<<8)
-#define GRN_OBJ_UNIT_SECTION_NONE (0x03<<8)
-#define GRN_OBJ_UNIT_SECTION_POSITION (0x04<<8)
-#define GRN_OBJ_UNIT_POSITION_NONE (0x05<<8)
-#define GRN_OBJ_UNIT_USERDEF_DOCUMENT (0x06<<8)
-#define GRN_OBJ_UNIT_USERDEF_SECTION (0x07<<8)
-#define GRN_OBJ_UNIT_USERDEF_POSITION (0x08<<8)
-
-#define GRN_OBJ_NO_SUBREC (0x00<<13)
-#define GRN_OBJ_WITH_SUBREC (0x01<<13)
-
-#define GRN_OBJ_KEY_VAR_SIZE (0x01<<14)
-
-#define GRN_OBJ_TEMPORARY (0x00<<15)
-#define GRN_OBJ_PERSISTENT (0x01<<15)
-
-/* obj types */
-
-#define GRN_VOID (0x00)
-#define GRN_BULK (0x02)
-#define GRN_PTR (0x03)
-#define GRN_UVECTOR (0x04) /* vector of grn_id */
-#define GRN_PVECTOR (0x05) /* vector of grn_obj* */
-#define GRN_VECTOR (0x06) /* vector of arbitrary data */
-#define GRN_MSG (0x07)
-#define GRN_QUERY (0x08)
-#define GRN_ACCESSOR (0x09)
-#define GRN_SNIP (0x0b)
-#define GRN_PATSNIP (0x0c)
-#define GRN_STRING (0x0d)
-#define GRN_CURSOR_TABLE_HASH_KEY (0x10)
-#define GRN_CURSOR_TABLE_PAT_KEY (0x11)
-#define GRN_CURSOR_TABLE_DAT_KEY (0x12)
-#define GRN_CURSOR_TABLE_NO_KEY (0x13)
-#define GRN_CURSOR_COLUMN_INDEX (0x18)
-#define GRN_CURSOR_COLUMN_GEO_INDEX (0x1a)
-#define GRN_TYPE (0x20)
-#define GRN_PROC (0x21)
-#define GRN_EXPR (0x22)
-#define GRN_TABLE_HASH_KEY (0x30)
-#define GRN_TABLE_PAT_KEY (0x31)
-#define GRN_TABLE_DAT_KEY (0x32)
-#define GRN_TABLE_NO_KEY (0x33)
-#define GRN_DB (0x37)
-#define GRN_COLUMN_FIX_SIZE (0x40)
-#define GRN_COLUMN_VAR_SIZE (0x41)
-#define GRN_COLUMN_INDEX (0x48)
-
-typedef struct _grn_section grn_section;
-typedef struct _grn_obj_header grn_obj_header;
-
-struct _grn_section {
- unsigned int offset;
- unsigned int length;
- unsigned int weight;
- grn_id domain;
-};
-
-struct _grn_obj_header {
- unsigned char type;
- unsigned char impl_flags;
- grn_obj_flags flags;
- grn_id domain;
-};
-
-struct _grn_obj {
- grn_obj_header header;
- union {
- struct {
- char *head;
- char *curr;
- char *tail;
- } b;
- struct {
- grn_obj *body;
- grn_section *sections;
- int n_sections;
- } v;
- } u;
-};
-
-#define GRN_OBJ_REFER (0x01<<0)
-#define GRN_OBJ_OUTPLACE (0x01<<1)
-
-#define GRN_OBJ_INIT(obj,obj_type,obj_flags,obj_domain) do { \
- (obj)->header.type = (obj_type);\
- (obj)->header.impl_flags = (obj_flags);\
- (obj)->header.flags = 0;\
- (obj)->header.domain = (obj_domain);\
- (obj)->u.b.head = NULL;\
- (obj)->u.b.curr = NULL;\
- (obj)->u.b.tail = NULL;\
-} while (0)
-
-#define GRN_OBJ_FIN(ctx,obj) (grn_obj_close((ctx), (obj)))
-
-typedef struct _grn_db_create_optarg grn_db_create_optarg;
-
-struct _grn_db_create_optarg {
- char **builtin_type_names;
- int n_builtin_type_names;
-};
-
-GRN_API grn_obj *grn_db_create(grn_ctx *ctx, const char *path, grn_db_create_optarg *optarg);
-
-#define GRN_DB_OPEN_OR_CREATE(ctx,path,optarg,db) \
- (((db) = grn_db_open((ctx), (path))) || (db = grn_db_create((ctx), (path), (optarg))))
-
-GRN_API grn_obj *grn_db_open(grn_ctx *ctx, const char *path);
-GRN_API void grn_db_touch(grn_ctx *ctx, grn_obj *db);
-
-GRN_API grn_rc grn_ctx_use(grn_ctx *ctx, grn_obj *db);
-GRN_API grn_obj *grn_ctx_db(grn_ctx *ctx);
-GRN_API grn_obj *grn_ctx_get(grn_ctx *ctx, const char *name, int name_size);
-
-typedef enum {
- GRN_DB_VOID = 0,
- GRN_DB_DB,
- GRN_DB_OBJECT,
- GRN_DB_BOOL,
- GRN_DB_INT8,
- GRN_DB_UINT8,
- GRN_DB_INT16,
- GRN_DB_UINT16,
- GRN_DB_INT32,
- GRN_DB_UINT32,
- GRN_DB_INT64,
- GRN_DB_UINT64,
- GRN_DB_FLOAT,
- GRN_DB_TIME,
- GRN_DB_SHORT_TEXT,
- GRN_DB_TEXT,
- GRN_DB_LONG_TEXT,
- GRN_DB_TOKYO_GEO_POINT,
- GRN_DB_WGS84_GEO_POINT
-} grn_builtin_type;
-
-typedef enum {
- GRN_DB_MECAB = 64,
- GRN_DB_DELIMIT,
- GRN_DB_UNIGRAM,
- GRN_DB_BIGRAM,
- GRN_DB_TRIGRAM
-} grn_builtin_tokenizer;
-
-GRN_API grn_obj *grn_ctx_at(grn_ctx *ctx, grn_id id);
-
-GRN_API grn_obj *grn_type_create(grn_ctx *ctx, const char *name, unsigned int name_size,
- grn_obj_flags flags, unsigned int size);
-
-GRN_API grn_rc grn_plugin_register(grn_ctx *ctx, const char *name);
-GRN_API grn_rc grn_plugin_register_by_path(grn_ctx *ctx, const char *path);
-GRN_API const char *grn_plugin_get_system_plugins_dir(void);
-GRN_API const char *grn_plugin_get_suffix(void);
-
-typedef struct {
- const char *name;
- unsigned int name_size;
- grn_obj value;
-} grn_expr_var;
-
-typedef grn_rc (*grn_plugin_func)(grn_ctx *ctx);
-
-typedef enum {
- GRN_PROC_INVALID = 0,
- GRN_PROC_TOKENIZER,
- GRN_PROC_COMMAND,
- GRN_PROC_FUNCTION,
- GRN_PROC_HOOK,
- GRN_PROC_NORMALIZER,
- GRN_PROC_TOKEN_FILTER
-} grn_proc_type;
-
-GRN_API grn_obj *grn_proc_create(grn_ctx *ctx,
- const char *name, int name_size, grn_proc_type type,
- grn_proc_func *init, grn_proc_func *next, grn_proc_func *fin,
- unsigned int nvars, grn_expr_var *vars);
-GRN_API grn_obj *grn_proc_get_info(grn_ctx *ctx, grn_user_data *user_data,
- grn_expr_var **vars, unsigned int *nvars, grn_obj **caller);
-GRN_API grn_proc_type grn_proc_get_type(grn_ctx *ctx, grn_obj *proc);
-
-/*-------------------------------------------------------------
- * API for table
- */
-
-#define GRN_TABLE_MAX_KEY_SIZE (0x1000)
-
-GRN_API grn_obj *grn_table_create(grn_ctx *ctx,
- const char *name, unsigned int name_size,
- const char *path, grn_obj_flags flags,
- grn_obj *key_type, grn_obj *value_type);
-
-#define GRN_TABLE_OPEN_OR_CREATE(ctx,name,name_size,path,flags,key_type,value_type,table) \
- (((table) = grn_ctx_get((ctx), (name), (name_size))) ||\
- ((table) = grn_table_create((ctx), (name), (name_size), (path), (flags), (key_type), (value_type))))
-
-/* TODO: int *added -> grn_bool *added */
-GRN_API grn_id grn_table_add(grn_ctx *ctx, grn_obj *table,
- const void *key, unsigned int key_size, int *added);
-GRN_API grn_id grn_table_get(grn_ctx *ctx, grn_obj *table,
- const void *key, unsigned int key_size);
-GRN_API grn_id grn_table_at(grn_ctx *ctx, grn_obj *table, grn_id id);
-GRN_API grn_id grn_table_lcp_search(grn_ctx *ctx, grn_obj *table,
- const void *key, unsigned int key_size);
-GRN_API int grn_table_get_key(grn_ctx *ctx, grn_obj *table,
- grn_id id, void *keybuf, int buf_size);
-GRN_API grn_rc grn_table_delete(grn_ctx *ctx, grn_obj *table,
- const void *key, unsigned int key_size);
-GRN_API grn_rc grn_table_delete_by_id(grn_ctx *ctx, grn_obj *table, grn_id id);
-GRN_API grn_rc grn_table_update_by_id(grn_ctx *ctx, grn_obj *table, grn_id id,
- const void *dest_key, unsigned int dest_key_size);
-GRN_API grn_rc grn_table_update(grn_ctx *ctx, grn_obj *table,
- const void *src_key, unsigned int src_key_size,
- const void *dest_key, unsigned int dest_key_size);
-GRN_API grn_rc grn_table_truncate(grn_ctx *ctx, grn_obj *table);
-
-typedef grn_obj grn_table_cursor;
-
-#define GRN_CURSOR_ASCENDING (0x00<<0)
-#define GRN_CURSOR_DESCENDING (0x01<<0)
-#define GRN_CURSOR_GE (0x00<<1)
-#define GRN_CURSOR_GT (0x01<<1)
-#define GRN_CURSOR_LE (0x00<<2)
-#define GRN_CURSOR_LT (0x01<<2)
-#define GRN_CURSOR_BY_KEY (0x00<<3)
-#define GRN_CURSOR_BY_ID (0x01<<3)
-#define GRN_CURSOR_PREFIX (0x01<<4)
-#define GRN_CURSOR_SIZE_BY_BIT (0x01<<5)
-#define GRN_CURSOR_RK (0x01<<6)
-
-GRN_API grn_table_cursor *grn_table_cursor_open(grn_ctx *ctx, grn_obj *table,
- const void *min, unsigned int min_size,
- const void *max, unsigned int max_size,
- int offset, int limit, int flags);
-GRN_API grn_rc grn_table_cursor_close(grn_ctx *ctx, grn_table_cursor *tc);
-GRN_API grn_id grn_table_cursor_next(grn_ctx *ctx, grn_table_cursor *tc);
-GRN_API int grn_table_cursor_get_key(grn_ctx *ctx, grn_table_cursor *tc, void **key);
-GRN_API int grn_table_cursor_get_value(grn_ctx *ctx, grn_table_cursor *tc, void **value);
-GRN_API grn_rc grn_table_cursor_set_value(grn_ctx *ctx, grn_table_cursor *tc,
- const void *value, int flags);
-GRN_API grn_rc grn_table_cursor_delete(grn_ctx *ctx, grn_table_cursor *tc);
-GRN_API grn_obj *grn_table_cursor_table(grn_ctx *ctx, grn_table_cursor *tc);
-
-typedef struct {
- grn_id rid;
- grn_id sid;
- unsigned int pos;
- unsigned int tf;
- unsigned int weight;
- unsigned int rest;
-} grn_posting;
-
-GRN_API grn_obj *grn_index_cursor_open(grn_ctx *ctx, grn_table_cursor *tc, grn_obj *index,
- grn_id rid_min, grn_id rid_max, int flags);
-GRN_API grn_posting *grn_index_cursor_next(grn_ctx *ctx, grn_obj *ic, grn_id *tid);
-
-#define GRN_TABLE_EACH(ctx,table,head,tail,id,key,key_size,value,block) do {\
- (ctx)->errlvl = GRN_LOG_NOTICE;\
- (ctx)->rc = GRN_SUCCESS;\
- if ((ctx)->seqno & 1) {\
- (ctx)->subno++;\
- } else {\
- (ctx)->seqno++;\
- }\
- if (table) {\
- switch ((table)->header.type) {\
- case GRN_TABLE_PAT_KEY :\
- GRN_PAT_EACH((ctx), (grn_pat *)(table), (id), (key), (key_size), (value), block);\
- break;\
- case GRN_TABLE_DAT_KEY :\
- GRN_DAT_EACH((ctx), (grn_dat *)(table), (id), (key), (key_size), block);\
- break;\
- case GRN_TABLE_HASH_KEY :\
- GRN_HASH_EACH((ctx), (grn_hash *)(table), (id), (key), (key_size), (value), block);\
- break;\
- case GRN_TABLE_NO_KEY :\
- GRN_ARRAY_EACH((ctx), (grn_array *)(table), (head), (tail), (id), (value), block);\
- break;\
- }\
- }\
- if ((ctx)->subno) {\
- (ctx)->subno--;\
- } else {\
- (ctx)->seqno++;\
- }\
-} while (0)
-
-typedef struct _grn_table_sort_key grn_table_sort_key;
-typedef unsigned char grn_table_sort_flags;
-
-#define GRN_TABLE_SORT_ASC (0x00<<0)
-#define GRN_TABLE_SORT_DESC (0x01<<0)
-
-struct _grn_table_sort_key {
- grn_obj *key;
- grn_table_sort_flags flags;
- int offset;
-};
-
-GRN_API int grn_table_sort(grn_ctx *ctx, grn_obj *table, int offset, int limit,
- grn_obj *result, grn_table_sort_key *keys, int n_keys);
-
-typedef struct _grn_table_group_result grn_table_group_result;
-typedef unsigned int grn_table_group_flags;
-
-#define GRN_TABLE_GROUP_CALC_COUNT (0x01<<3)
-#define GRN_TABLE_GROUP_CALC_MAX (0x01<<4)
-#define GRN_TABLE_GROUP_CALC_MIN (0x01<<5)
-#define GRN_TABLE_GROUP_CALC_SUM (0x01<<6)
-#define GRN_TABLE_GROUP_CALC_AVG (0x01<<7)
-
-typedef enum {
- GRN_OP_PUSH = 0,
- GRN_OP_POP,
- GRN_OP_NOP,
- GRN_OP_CALL,
- GRN_OP_INTERN,
- GRN_OP_GET_REF,
- GRN_OP_GET_VALUE,
- GRN_OP_AND,
- GRN_OP_AND_NOT,
- /* Deprecated. Just for backward compatibility. */
-#define GRN_OP_BUT GRN_OP_AND_NOT
- GRN_OP_OR,
- GRN_OP_ASSIGN,
- GRN_OP_STAR_ASSIGN,
- GRN_OP_SLASH_ASSIGN,
- GRN_OP_MOD_ASSIGN,
- GRN_OP_PLUS_ASSIGN,
- GRN_OP_MINUS_ASSIGN,
- GRN_OP_SHIFTL_ASSIGN,
- GRN_OP_SHIFTR_ASSIGN,
- GRN_OP_SHIFTRR_ASSIGN,
- GRN_OP_AND_ASSIGN,
- GRN_OP_XOR_ASSIGN,
- GRN_OP_OR_ASSIGN,
- GRN_OP_JUMP,
- GRN_OP_CJUMP,
- GRN_OP_COMMA,
- GRN_OP_BITWISE_OR,
- GRN_OP_BITWISE_XOR,
- GRN_OP_BITWISE_AND,
- GRN_OP_BITWISE_NOT,
- GRN_OP_EQUAL,
- GRN_OP_NOT_EQUAL,
- GRN_OP_LESS,
- GRN_OP_GREATER,
- GRN_OP_LESS_EQUAL,
- GRN_OP_GREATER_EQUAL,
- GRN_OP_IN,
- GRN_OP_MATCH,
- GRN_OP_NEAR,
- GRN_OP_NEAR2,
- GRN_OP_SIMILAR,
- GRN_OP_TERM_EXTRACT,
- GRN_OP_SHIFTL,
- GRN_OP_SHIFTR,
- GRN_OP_SHIFTRR,
- GRN_OP_PLUS,
- GRN_OP_MINUS,
- GRN_OP_STAR,
- GRN_OP_SLASH,
- GRN_OP_MOD,
- GRN_OP_DELETE,
- GRN_OP_INCR,
- GRN_OP_DECR,
- GRN_OP_INCR_POST,
- GRN_OP_DECR_POST,
- GRN_OP_NOT,
- GRN_OP_ADJUST,
- GRN_OP_EXACT,
- GRN_OP_LCP,
- GRN_OP_PARTIAL,
- GRN_OP_UNSPLIT,
- GRN_OP_PREFIX,
- GRN_OP_SUFFIX,
- GRN_OP_GEO_DISTANCE1,
- GRN_OP_GEO_DISTANCE2,
- GRN_OP_GEO_DISTANCE3,
- GRN_OP_GEO_DISTANCE4,
- GRN_OP_GEO_WITHINP5,
- GRN_OP_GEO_WITHINP6,
- GRN_OP_GEO_WITHINP8,
- GRN_OP_OBJ_SEARCH,
- GRN_OP_EXPR_GET_VAR,
- GRN_OP_TABLE_CREATE,
- GRN_OP_TABLE_SELECT,
- GRN_OP_TABLE_SORT,
- GRN_OP_TABLE_GROUP,
- GRN_OP_JSON_PUT,
- GRN_OP_GET_MEMBER
-} grn_operator;
-
-struct _grn_table_group_result {
- grn_obj *table;
- unsigned char key_begin;
- unsigned char key_end;
- int limit;
- grn_table_group_flags flags;
- grn_operator op;
-};
-
-GRN_API grn_rc grn_table_group(grn_ctx *ctx, grn_obj *table,
- grn_table_sort_key *keys, int n_keys,
- grn_table_group_result *results, int n_results);
-GRN_API grn_rc grn_table_setoperation(grn_ctx *ctx, grn_obj *table1, grn_obj *table2,
- grn_obj *res, grn_operator op);
-GRN_API grn_rc grn_table_difference(grn_ctx *ctx, grn_obj *table1, grn_obj *table2,
- grn_obj *res1, grn_obj *res2);
-GRN_API int grn_table_columns(grn_ctx *ctx, grn_obj *table,
- const char *name, unsigned int name_size,
- grn_obj *res);
-
-GRN_API grn_obj *grn_obj_column(grn_ctx *ctx, grn_obj *table,
- const char *name, unsigned int name_size);
-
-GRN_API unsigned int grn_table_size(grn_ctx *ctx, grn_obj *table);
-
-/*-------------------------------------------------------------
- * API for column
- */
-
-#define GRN_COLUMN_NAME_ID "_id"
-#define GRN_COLUMN_NAME_ID_LEN (sizeof(GRN_COLUMN_NAME_ID) - 1)
-#define GRN_COLUMN_NAME_KEY "_key"
-#define GRN_COLUMN_NAME_KEY_LEN (sizeof(GRN_COLUMN_NAME_KEY) - 1)
-#define GRN_COLUMN_NAME_VALUE "_value"
-#define GRN_COLUMN_NAME_VALUE_LEN (sizeof(GRN_COLUMN_NAME_VALUE) - 1)
-#define GRN_COLUMN_NAME_SCORE "_score"
-#define GRN_COLUMN_NAME_SCORE_LEN (sizeof(GRN_COLUMN_NAME_SCORE) - 1)
-#define GRN_COLUMN_NAME_NSUBRECS "_nsubrecs"
-#define GRN_COLUMN_NAME_NSUBRECS_LEN (sizeof(GRN_COLUMN_NAME_NSUBRECS) - 1)
-
-GRN_API grn_obj *grn_column_create(grn_ctx *ctx, grn_obj *table,
- const char *name, unsigned int name_size,
- const char *path, grn_obj_flags flags, grn_obj *type);
-
-#define GRN_COLUMN_OPEN_OR_CREATE(ctx,table,name,name_size,path,flags,type,column) \
- (((column) = grn_obj_column((ctx), (table), (name), (name_size))) ||\
- ((column) = grn_column_create((ctx), (table), (name), (name_size), (path), (flags), (type))))
-
-GRN_API grn_rc grn_column_index_update(grn_ctx *ctx, grn_obj *column,
- grn_id id, unsigned int section,
- grn_obj *oldvalue, grn_obj *newvalue);
-GRN_API grn_obj *grn_column_table(grn_ctx *ctx, grn_obj *column);
-
-/*-------------------------------------------------------------
- * API for db, table and/or column
- */
-
-typedef enum {
- GRN_INFO_ENCODING = 0,
- GRN_INFO_SOURCE,
- GRN_INFO_DEFAULT_TOKENIZER,
- GRN_INFO_ELEMENT_SIZE,
- GRN_INFO_CURR_MAX,
- GRN_INFO_MAX_ELEMENT_SIZE,
- GRN_INFO_SEG_SIZE,
- GRN_INFO_CHUNK_SIZE,
- GRN_INFO_MAX_SECTION,
- GRN_INFO_HOOK_LOCAL_DATA,
- GRN_INFO_ELEMENT_A,
- GRN_INFO_ELEMENT_CHUNK,
- GRN_INFO_ELEMENT_CHUNK_SIZE,
- GRN_INFO_ELEMENT_BUFFER_FREE,
- GRN_INFO_ELEMENT_NTERMS,
- GRN_INFO_ELEMENT_NTERMS_VOID,
- GRN_INFO_ELEMENT_SIZE_IN_CHUNK,
- GRN_INFO_ELEMENT_POS_IN_CHUNK,
- GRN_INFO_ELEMENT_SIZE_IN_BUFFER,
- GRN_INFO_ELEMENT_POS_IN_BUFFER,
- GRN_INFO_ELEMENT_ESTIMATE_SIZE,
- GRN_INFO_NGRAM_UNIT_SIZE,
- /*
- GRN_INFO_VERSION,
- GRN_INFO_CONFIGURE_OPTIONS,
- GRN_INFO_CONFIG_PATH,
- */
- GRN_INFO_PARTIAL_MATCH_THRESHOLD,
- GRN_INFO_II_SPLIT_THRESHOLD,
- GRN_INFO_SUPPORT_ZLIB,
- GRN_INFO_SUPPORT_LZO,
- GRN_INFO_NORMALIZER,
- GRN_INFO_TOKEN_FILTERS
-} grn_info_type;
-
-GRN_API grn_obj *grn_obj_get_info(grn_ctx *ctx, grn_obj *obj, grn_info_type type, grn_obj *valuebuf);
-GRN_API grn_rc grn_obj_set_info(grn_ctx *ctx, grn_obj *obj, grn_info_type type, grn_obj *value);
-GRN_API grn_obj *grn_obj_get_element_info(grn_ctx *ctx, grn_obj *obj, grn_id id,
- grn_info_type type, grn_obj *value);
-GRN_API grn_rc grn_obj_set_element_info(grn_ctx *ctx, grn_obj *obj, grn_id id,
- grn_info_type type, grn_obj *value);
-
-GRN_API grn_bool grn_obj_is_builtin(grn_ctx *ctx, grn_obj *obj);
-
-GRN_API grn_obj *grn_obj_get_value(grn_ctx *ctx, grn_obj *obj, grn_id id, grn_obj *value);
-GRN_API int grn_obj_get_values(grn_ctx *ctx, grn_obj *obj, grn_id offset, void **values);
-
-#define GRN_COLUMN_EACH(ctx,column,id,value,block) do {\
- int _n;\
- grn_id id = 1;\
- while ((_n = grn_obj_get_values(ctx, column, id, (void **)&value)) > 0) {\
- for (; _n; _n--, id++, value++) {\
- block\
- }\
- }\
-} while (0)
-
-#define GRN_OBJ_SET_MASK (0x07)
-#define GRN_OBJ_SET (0x01)
-#define GRN_OBJ_INCR (0x02)
-#define GRN_OBJ_DECR (0x03)
-#define GRN_OBJ_APPEND (0x04)
-#define GRN_OBJ_PREPEND (0x05)
-#define GRN_OBJ_GET (0x01<<4)
-#define GRN_OBJ_COMPARE (0x01<<5)
-#define GRN_OBJ_LOCK (0x01<<6)
-#define GRN_OBJ_UNLOCK (0x01<<7)
-
-GRN_API grn_rc grn_obj_set_value(grn_ctx *ctx, grn_obj *obj, grn_id id, grn_obj *value, int flags);
-GRN_API grn_rc grn_obj_remove(grn_ctx *ctx, grn_obj *obj);
-GRN_API grn_rc grn_obj_rename(grn_ctx *ctx, grn_obj *obj,
- const char *name, unsigned int name_size);
-GRN_API grn_rc grn_table_rename(grn_ctx *ctx, grn_obj *table,
- const char *name, unsigned int name_size);
-
-GRN_API grn_rc grn_column_rename(grn_ctx *ctx, grn_obj *column,
- const char *name, unsigned int name_size);
-
-GRN_API grn_rc grn_obj_close(grn_ctx *ctx, grn_obj *obj);
-GRN_API grn_rc grn_obj_reinit(grn_ctx *ctx, grn_obj *obj, grn_id domain, unsigned char flags);
-GRN_API void grn_obj_unlink(grn_ctx *ctx, grn_obj *obj);
-
-GRN_API grn_user_data *grn_obj_user_data(grn_ctx *ctx, grn_obj *obj);
-
-GRN_API grn_rc grn_obj_set_finalizer(grn_ctx *ctx, grn_obj *obj, grn_proc_func *func);
-
-GRN_API const char *grn_obj_path(grn_ctx *ctx, grn_obj *obj);
-GRN_API int grn_obj_name(grn_ctx *ctx, grn_obj *obj, char *namebuf, int buf_size);
-
-GRN_API int grn_column_name(grn_ctx *ctx, grn_obj *obj, char *namebuf, int buf_size);
-
-GRN_API grn_id grn_obj_get_range(grn_ctx *ctx, grn_obj *obj);
-
-#define GRN_OBJ_GET_DOMAIN(obj) \
- ((obj)->header.type == GRN_TABLE_NO_KEY ? GRN_ID_NIL : (obj)->header.domain)
-
-GRN_API int grn_obj_expire(grn_ctx *ctx, grn_obj *obj, int threshold);
-GRN_API int grn_obj_check(grn_ctx *ctx, grn_obj *obj);
-GRN_API grn_rc grn_obj_lock(grn_ctx *ctx, grn_obj *obj, grn_id id, int timeout);
-GRN_API grn_rc grn_obj_unlock(grn_ctx *ctx, grn_obj *obj, grn_id id);
-GRN_API grn_rc grn_obj_clear_lock(grn_ctx *ctx, grn_obj *obj);
-GRN_API unsigned int grn_obj_is_locked(grn_ctx *ctx, grn_obj *obj);
-GRN_API int grn_obj_defrag(grn_ctx *ctx, grn_obj *obj, int threshold);
-
-GRN_API grn_obj *grn_obj_db(grn_ctx *ctx, grn_obj *obj);
-
-GRN_API grn_id grn_obj_id(grn_ctx *ctx, grn_obj *obj);
-
-typedef struct _grn_search_optarg grn_search_optarg;
-
-struct _grn_search_optarg {
- grn_operator mode;
- int similarity_threshold;
- int max_interval;
- int *weight_vector;
- int vector_size;
- grn_obj *proc;
- int max_size;
-};
-
-GRN_API grn_rc grn_obj_search(grn_ctx *ctx, grn_obj *obj, grn_obj *query,
- grn_obj *res, grn_operator op, grn_search_optarg *optarg);
-
-typedef grn_rc grn_selector_func(grn_ctx *ctx, grn_obj *table, grn_obj *index,
- int nargs, grn_obj **args,
- grn_obj *res, grn_operator op);
-
-GRN_API grn_rc grn_proc_set_selector(grn_ctx *ctx, grn_obj *proc,
- grn_selector_func selector);
-
-/*-------------------------------------------------------------
- * grn_vector
-*/
-
-GRN_API unsigned int grn_vector_size(grn_ctx *ctx, grn_obj *vector);
-
-GRN_API grn_rc grn_vector_add_element(grn_ctx *ctx, grn_obj *vector,
- const char *str, unsigned int str_len,
- unsigned int weight, grn_id domain);
-
-GRN_API unsigned int grn_vector_get_element(grn_ctx *ctx, grn_obj *vector,
- unsigned int offset, const char **str,
- unsigned int *weight, grn_id *domain);
-
-/*-------------------------------------------------------------
- * grn_uvector
-*/
-
-GRN_API unsigned int grn_uvector_size(grn_ctx *ctx, grn_obj *uvector);
-
-GRN_API grn_rc grn_uvector_add_element(grn_ctx *ctx, grn_obj *vector,
- grn_id id, unsigned int weight);
-
-GRN_API grn_id grn_uvector_get_element(grn_ctx *ctx, grn_obj *uvector,
- unsigned int offset,
- unsigned int *weight);
-
-/*-------------------------------------------------------------
- * API for hook
- */
-
-GRN_API int grn_proc_call_next(grn_ctx *ctx, grn_obj *exec_info, grn_obj *in, grn_obj *out);
-GRN_API void *grn_proc_get_ctx_local_data(grn_ctx *ctx, grn_obj *exec_info);
-GRN_API void *grn_proc_get_hook_local_data(grn_ctx *ctx, grn_obj *exec_info);
-
-typedef enum {
- GRN_HOOK_SET = 0,
- GRN_HOOK_GET,
- GRN_HOOK_INSERT,
- GRN_HOOK_DELETE,
- GRN_HOOK_SELECT
-} grn_hook_entry;
-
-GRN_API grn_rc grn_obj_add_hook(grn_ctx *ctx, grn_obj *obj, grn_hook_entry entry,
- int offset, grn_obj *proc, grn_obj *data);
-GRN_API int grn_obj_get_nhooks(grn_ctx *ctx, grn_obj *obj, grn_hook_entry entry);
-GRN_API grn_obj *grn_obj_get_hook(grn_ctx *ctx, grn_obj *obj, grn_hook_entry entry,
- int offset, grn_obj *data);
-GRN_API grn_rc grn_obj_delete_hook(grn_ctx *ctx, grn_obj *obj, grn_hook_entry entry, int offset);
-
-GRN_API grn_obj *grn_obj_open(grn_ctx *ctx, unsigned char type, grn_obj_flags flags, grn_id domain);
-
-GRN_API int grn_column_index(grn_ctx *ctx, grn_obj *column, grn_operator op,
- grn_obj **indexbuf, int buf_size, int *section);
-
-GRN_API grn_rc grn_obj_delete_by_id(grn_ctx *ctx, grn_obj *db, grn_id id, grn_bool removep);
-GRN_API grn_rc grn_obj_path_by_id(grn_ctx *ctx, grn_obj *db, grn_id id, char *buffer);
-
-/* geo */
-
-typedef struct {
- int latitude;
- int longitude;
-} grn_geo_point;
-
-GRN_API grn_rc grn_geo_select_in_rectangle(grn_ctx *ctx,
- grn_obj *index,
- grn_obj *top_left_point,
- grn_obj *bottom_right_point,
- grn_obj *res,
- grn_operator op);
-GRN_API int grn_geo_estimate_in_rectangle(grn_ctx *ctx,
- grn_obj *index,
- grn_obj *top_left_point,
- grn_obj *bottom_right_point);
-GRN_API grn_obj *grn_geo_cursor_open_in_rectangle(grn_ctx *ctx,
- grn_obj *index,
- grn_obj *top_left_point,
- grn_obj *bottom_right_point,
- int offset,
- int limit);
-GRN_API grn_posting *grn_geo_cursor_next(grn_ctx *ctx, grn_obj *cursor);
-
-
-/* query & snippet */
-
-#ifndef GRN_QUERY_AND
-#define GRN_QUERY_AND '+'
-#endif /* GRN_QUERY_AND */
-#ifndef GRN_QUERY_AND_NOT
-# ifdef GRN_QUERY_BUT
- /* Deprecated. Just for backward compatibility. */
-# define GRN_QUERY_AND_NOT GRN_QUERY_BUT
-# else
-# define GRN_QUERY_AND_NOT '-'
-# endif /* GRN_QUERY_BUT */
-#endif /* GRN_QUERY_AND_NOT */
-#ifndef GRN_QUERY_ADJ_INC
-#define GRN_QUERY_ADJ_INC '>'
-#endif /* GRN_QUERY_ADJ_POS2 */
-#ifndef GRN_QUERY_ADJ_DEC
-#define GRN_QUERY_ADJ_DEC '<'
-#endif /* GRN_QUERY_ADJ_POS1 */
-#ifndef GRN_QUERY_ADJ_NEG
-#define GRN_QUERY_ADJ_NEG '~'
-#endif /* GRN_QUERY_ADJ_NEG */
-#ifndef GRN_QUERY_PREFIX
-#define GRN_QUERY_PREFIX '*'
-#endif /* GRN_QUERY_PREFIX */
-#ifndef GRN_QUERY_PARENL
-#define GRN_QUERY_PARENL '('
-#endif /* GRN_QUERY_PARENL */
-#ifndef GRN_QUERY_PARENR
-#define GRN_QUERY_PARENR ')'
-#endif /* GRN_QUERY_PARENR */
-#ifndef GRN_QUERY_QUOTEL
-#define GRN_QUERY_QUOTEL '"'
-#endif /* GRN_QUERY_QUOTEL */
-#ifndef GRN_QUERY_QUOTER
-#define GRN_QUERY_QUOTER '"'
-#endif /* GRN_QUERY_QUOTER */
-#ifndef GRN_QUERY_ESCAPE
-#define GRN_QUERY_ESCAPE '\\'
-#endif /* GRN_QUERY_ESCAPE */
-#ifndef GRN_QUERY_COLUMN
-#define GRN_QUERY_COLUMN ':'
-#endif /* GRN_QUERY_COLUMN */
-
-typedef struct _grn_snip_mapping grn_snip_mapping;
-
-struct _grn_snip_mapping {
- void *dummy;
-};
-
-#define GRN_SNIP_NORMALIZE (0x01<<0)
-#define GRN_SNIP_COPY_TAG (0x01<<1)
-#define GRN_SNIP_SKIP_LEADING_SPACES (0x01<<2)
-
-#define GRN_SNIP_MAPPING_HTML_ESCAPE ((grn_snip_mapping *)-1)
-
-GRN_API grn_obj *grn_snip_open(grn_ctx *ctx, int flags, unsigned int width,
- unsigned int max_results,
- const char *defaultopentag, unsigned int defaultopentag_len,
- const char *defaultclosetag, unsigned int defaultclosetag_len,
- grn_snip_mapping *mapping);
-GRN_API grn_rc grn_snip_add_cond(grn_ctx *ctx, grn_obj *snip,
- const char *keyword, unsigned int keyword_len,
- const char *opentag, unsigned int opentag_len,
- const char *closetag, unsigned int closetag_len);
-GRN_API grn_rc grn_snip_set_normalizer(grn_ctx *ctx, grn_obj *snip,
- grn_obj *normalizer);
-GRN_API grn_obj *grn_snip_get_normalizer(grn_ctx *ctx, grn_obj *snip);
-GRN_API grn_rc grn_snip_exec(grn_ctx *ctx, grn_obj *snip,
- const char *string, unsigned int string_len,
- unsigned int *nresults, unsigned int *max_tagged_len);
-GRN_API grn_rc grn_snip_get_result(grn_ctx *ctx, grn_obj *snip, const unsigned int index,
- char *result, unsigned int *result_len);
-
-/* log */
-
-#define GRN_LOG_TIME (0x01<<0)
-#define GRN_LOG_TITLE (0x01<<1)
-#define GRN_LOG_MESSAGE (0x01<<2)
-#define GRN_LOG_LOCATION (0x01<<3)
-
-/* Deprecated since 2.1.2. Use grn_logger instead. */
-typedef struct _grn_logger_info grn_logger_info;
-
-/* Deprecated since 2.1.2. Use grn_logger instead. */
-struct _grn_logger_info {
- grn_log_level max_level;
- int flags;
- void (*func)(int, const char *, const char *, const char *, const char *, void *);
- void *func_arg;
-};
-
-/* Deprecated since 2.1.2. Use grn_logger_set() instead. */
-GRN_API grn_rc grn_logger_info_set(grn_ctx *ctx, const grn_logger_info *info);
-
-typedef struct _grn_logger grn_logger;
-
-struct _grn_logger {
- grn_log_level max_level;
- int flags;
- void *user_data;
- void (*log)(grn_ctx *ctx, grn_log_level level,
- const char *timestamp, const char *title, const char *message,
- const char *location, void *user_data);
- void (*reopen)(grn_ctx *ctx, void *user_data);
- void (*fin)(grn_ctx *ctx, void *user_data);
-};
-
-GRN_API grn_rc grn_logger_set(grn_ctx *ctx, const grn_logger *logger);
-
-GRN_API void grn_logger_set_max_level(grn_ctx *ctx, grn_log_level max_level);
-GRN_API grn_log_level grn_logger_get_max_level(grn_ctx *ctx);
-
-#ifdef __GNUC__
-#define GRN_ATTRIBUTE_PRINTF(fmt_pos) \
- __attribute__ ((format(printf, fmt_pos, fmt_pos + 1)))
-#else
-#define GRN_ATTRIBUTE_PRINTF(fmt_pos)
-#endif /* __GNUC__ */
-
-GRN_API void grn_logger_put(grn_ctx *ctx, grn_log_level level,
- const char *file, int line, const char *func, const char *fmt, ...) GRN_ATTRIBUTE_PRINTF(6);
-GRN_API void grn_logger_reopen(grn_ctx *ctx);
-
-GRN_API grn_bool grn_logger_pass(grn_ctx *ctx, grn_log_level level);
-
-#ifndef GRN_LOG_DEFAULT_LEVEL
-#define GRN_LOG_DEFAULT_LEVEL GRN_LOG_NOTICE
-#endif /* GRN_LOG_DEFAULT_LEVEL */
-
-GRN_API void grn_default_logger_set_max_level(grn_log_level level);
-GRN_API grn_log_level grn_default_logger_get_max_level(void);
-GRN_API void grn_default_logger_set_path(const char *path);
-GRN_API const char *grn_default_logger_get_path(void);
-
-#define GRN_LOG(ctx,level,...) do {\
- if (grn_logger_pass(ctx, level)) {\
- grn_logger_put(ctx, (level), __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__); \
- }\
-} while (0)
-
-typedef struct _grn_query_logger grn_query_logger;
-
-struct _grn_query_logger {
- unsigned int flags;
- void *user_data;
- void (*log)(grn_ctx *ctx, unsigned int flag,
- const char *timestamp, const char *info, const char *message,
- void *user_data);
- void (*reopen)(grn_ctx *ctx, void *user_data);
- void (*fin)(grn_ctx *ctx, void *user_data);
-};
-
-GRN_API grn_rc grn_query_logger_set(grn_ctx *ctx, const grn_query_logger *logger);
-
-GRN_API void grn_query_logger_put(grn_ctx *ctx, unsigned int flag,
- const char *mark,
- const char *format, ...) GRN_ATTRIBUTE_PRINTF(4);
-GRN_API void grn_query_logger_reopen(grn_ctx *ctx);
-
-GRN_API grn_bool grn_query_logger_pass(grn_ctx *ctx, unsigned int flag);
-
-GRN_API void grn_default_query_logger_set_flags(unsigned int flags);
-GRN_API unsigned int grn_default_query_logger_get_flags(void);
-GRN_API void grn_default_query_logger_set_path(const char *path);
-GRN_API const char *grn_default_query_logger_get_path(void);
-
-#define GRN_QUERY_LOG(ctx, flag, mark, format, ...) do {\
- if (grn_query_logger_pass(ctx, flag)) {\
- grn_query_logger_put(ctx, (flag), (mark), format, __VA_ARGS__);\
- }\
-} while (0)
-
-/* grn_bulk */
-
-#define GRN_BULK_BUFSIZE (sizeof(grn_obj) - sizeof(grn_obj_header))
-/* This assumes that GRN_BULK_BUFSIZE is less than 32 (= 0x20). */
-#define GRN_BULK_BUFSIZE_MAX 0x1f
-#define GRN_BULK_SIZE_IN_FLAGS(flags) ((flags) & GRN_BULK_BUFSIZE_MAX)
-#define GRN_BULK_OUTP(bulk) ((bulk)->header.impl_flags & GRN_OBJ_OUTPLACE)
-#define GRN_BULK_REWIND(bulk) do {\
- if ((bulk)->header.type == GRN_VECTOR) {\
- grn_obj *_body = (bulk)->u.v.body;\
- if (_body) {\
- if (GRN_BULK_OUTP(_body)) {\
- (_body)->u.b.curr = (_body)->u.b.head;\
- } else {\
- (_body)->header.flags &= ~GRN_BULK_BUFSIZE_MAX;\
- }\
- }\
- (bulk)->u.v.n_sections = 0;\
- } else {\
- if (GRN_BULK_OUTP(bulk)) {\
- (bulk)->u.b.curr = (bulk)->u.b.head;\
- } else {\
- (bulk)->header.flags &= ~GRN_BULK_BUFSIZE_MAX;\
- }\
- }\
-} while (0)
-#define GRN_BULK_WSIZE(bulk) \
- (GRN_BULK_OUTP(bulk)\
- ? ((bulk)->u.b.tail - (bulk)->u.b.head)\
- : GRN_BULK_BUFSIZE)
-#define GRN_BULK_REST(bulk) \
- (GRN_BULK_OUTP(bulk)\
- ? ((bulk)->u.b.tail - (bulk)->u.b.curr)\
- : GRN_BULK_BUFSIZE - (bulk)->header.flags)
-#define GRN_BULK_VSIZE(bulk) \
- (GRN_BULK_OUTP(bulk)\
- ? ((bulk)->u.b.curr - (bulk)->u.b.head)\
- : GRN_BULK_SIZE_IN_FLAGS((bulk)->header.flags))
-#define GRN_BULK_EMPTYP(bulk) \
- (GRN_BULK_OUTP(bulk)\
- ? ((bulk)->u.b.curr == (bulk)->u.b.head)\
- : !(GRN_BULK_SIZE_IN_FLAGS((bulk)->header.flags)))
-#define GRN_BULK_HEAD(bulk) \
- (GRN_BULK_OUTP(bulk)\
- ? ((bulk)->u.b.head)\
- : (char *)&((bulk)->u.b.head))
-#define GRN_BULK_CURR(bulk) \
- (GRN_BULK_OUTP(bulk)\
- ? ((bulk)->u.b.curr)\
- : (char *)&((bulk)->u.b.head) + GRN_BULK_SIZE_IN_FLAGS((bulk)->header.flags))
-#define GRN_BULK_TAIL(bulk) \
- (GRN_BULK_OUTP(bulk)\
- ? ((bulk)->u.b.tail)\
- : (char *)&((bulk)[1]))
-
-GRN_API grn_rc grn_bulk_reinit(grn_ctx *ctx, grn_obj *bulk, unsigned int size);
-GRN_API grn_rc grn_bulk_resize(grn_ctx *ctx, grn_obj *bulk, unsigned int newsize);
-GRN_API grn_rc grn_bulk_write(grn_ctx *ctx, grn_obj *bulk,
- const char *str, unsigned int len);
-GRN_API grn_rc grn_bulk_write_from(grn_ctx *ctx, grn_obj *bulk,
- const char *str, unsigned int from, unsigned int len);
-GRN_API grn_rc grn_bulk_reserve(grn_ctx *ctx, grn_obj *bulk, unsigned int len);
-GRN_API grn_rc grn_bulk_space(grn_ctx *ctx, grn_obj *bulk, unsigned int len);
-GRN_API grn_rc grn_bulk_truncate(grn_ctx *ctx, grn_obj *bulk, unsigned int len);
-GRN_API grn_rc grn_bulk_fin(grn_ctx *ctx, grn_obj *bulk);
-
-/* grn_text */
-
-GRN_API grn_rc grn_text_itoa(grn_ctx *ctx, grn_obj *bulk, int i);
-GRN_API grn_rc grn_text_itoa_padded(grn_ctx *ctx, grn_obj *bulk, int i, char ch, unsigned int len);
-GRN_API grn_rc grn_text_lltoa(grn_ctx *ctx, grn_obj *bulk, long long int i);
-GRN_API grn_rc grn_text_ftoa(grn_ctx *ctx, grn_obj *bulk, double d);
-GRN_API grn_rc grn_text_itoh(grn_ctx *ctx, grn_obj *bulk, int i, unsigned int len);
-GRN_API grn_rc grn_text_itob(grn_ctx *ctx, grn_obj *bulk, grn_id id);
-GRN_API grn_rc grn_text_lltob32h(grn_ctx *ctx, grn_obj *bulk, long long int i);
-GRN_API grn_rc grn_text_benc(grn_ctx *ctx, grn_obj *bulk, unsigned int v);
-GRN_API grn_rc grn_text_esc(grn_ctx *ctx, grn_obj *bulk, const char *s, unsigned int len);
-GRN_API grn_rc grn_text_urlenc(grn_ctx *ctx, grn_obj *buf,
- const char *str, unsigned int len);
-GRN_API const char *grn_text_urldec(grn_ctx *ctx, grn_obj *buf,
- const char *s, const char *e, char d);
-GRN_API grn_rc grn_text_escape_xml(grn_ctx *ctx, grn_obj *buf,
- const char *s, unsigned int len);
-GRN_API grn_rc grn_text_time2rfc1123(grn_ctx *ctx, grn_obj *bulk, int sec);
-GRN_API grn_rc grn_text_printf(grn_ctx *ctx, grn_obj *bulk,
- const char *format, ...) GRN_ATTRIBUTE_PRINTF(3);
-GRN_API grn_rc grn_text_vprintf(grn_ctx *ctx, grn_obj *bulk,
- const char *format, va_list args);
-
-typedef struct _grn_obj_format grn_obj_format;
-
-#define GRN_OBJ_FORMAT_WITH_COLUMN_NAMES (0x01<<0)
-#define GRN_OBJ_FORMAT_AS_ARRAY (0x01<<3)
-/* Deprecated since 4.0.1. It will be removed at 5.0.0.
- Use GRN_OBJ_FORMAT_AS_ARRAY instead.*/
-#define GRN_OBJ_FORMAT_ASARRAY GRN_OBJ_FORMAT_AS_ARRAY
-#define GRN_OBJ_FORMAT_WITH_WEIGHT (0x01<<4)
-
-struct _grn_obj_format {
- grn_obj columns;
- const void *min;
- const void *max;
- unsigned int min_size;
- unsigned int max_size;
- int nhits;
- int offset;
- int limit;
- int hits_offset;
- int flags;
- grn_obj *expression;
-};
-
-#define GRN_OBJ_FORMAT_INIT(format,format_nhits,format_offset,format_limit,format_hits_offset) do { \
- GRN_PTR_INIT(&(format)->columns, GRN_OBJ_VECTOR, GRN_ID_NIL);\
- (format)->nhits = (format_nhits);\
- (format)->offset = (format_offset);\
- (format)->limit = (format_limit);\
- (format)->hits_offset = (format_hits_offset);\
- (format)->flags = 0;\
- (format)->expression = NULL;\
-} while (0)
-
-#define GRN_OBJ_FORMAT_FIN(ctx,format) do {\
- int ncolumns = GRN_BULK_VSIZE(&(format)->columns) / sizeof(grn_obj *);\
- grn_obj **columns = (grn_obj **)GRN_BULK_HEAD(&(format)->columns);\
- while (ncolumns--) { grn_obj_unlink((ctx), *columns++); }\
- GRN_OBJ_FIN((ctx), &(format)->columns);\
- if ((format)->expression) { GRN_OBJ_FIN((ctx), (format)->expression); } \
-} while (0)
-
-GRN_API void grn_output_obj(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type,
- grn_obj *obj, grn_obj_format *format);
-GRN_API void grn_output_envelope(grn_ctx *ctx, grn_rc rc,
- grn_obj *head, grn_obj *body, grn_obj *foot,
- const char *file, int line);
-
-GRN_API void grn_ctx_output_array_open(grn_ctx *ctx,
- const char *name, int nelements);
-GRN_API void grn_ctx_output_array_close(grn_ctx *ctx);
-GRN_API void grn_ctx_output_map_open(grn_ctx *ctx,
- const char *name, int nelements);
-GRN_API void grn_ctx_output_map_close(grn_ctx *ctx);
-GRN_API void grn_ctx_output_int32(grn_ctx *ctx, int value);
-GRN_API void grn_ctx_output_int64(grn_ctx *ctx, long long int value);
-GRN_API void grn_ctx_output_float(grn_ctx *ctx, double value);
-GRN_API void grn_ctx_output_cstr(grn_ctx *ctx, const char *value);
-GRN_API void grn_ctx_output_str(grn_ctx *ctx,
- const char *value, unsigned int value_len);
-GRN_API void grn_ctx_output_bool(grn_ctx *ctx, grn_bool value);
-GRN_API void grn_ctx_output_obj(grn_ctx *ctx,
- grn_obj *value, grn_obj_format *format);
-
-
-GRN_API const char *grn_ctx_get_mime_type(grn_ctx *ctx);
-GRN_API void grn_ctx_recv_handler_set(grn_ctx *,
- void (*func)(grn_ctx *, int, void *),
- void *func_arg);
-
-/* obsolete */
-GRN_API grn_rc grn_text_otoj(grn_ctx *ctx, grn_obj *bulk, grn_obj *obj,
- grn_obj_format *format);
-
-/* various values exchanged via grn_obj */
-
-#define GRN_OBJ_DO_SHALLOW_COPY (GRN_OBJ_REFER|GRN_OBJ_OUTPLACE)
-#define GRN_OBJ_VECTOR (0x01<<7)
-
-#define GRN_OBJ_MUTABLE(obj) ((obj) && (obj)->header.type <= GRN_VECTOR)
-
-#define GRN_VALUE_FIX_SIZE_INIT(obj,flags,domain)\
- GRN_OBJ_INIT((obj), ((flags) & GRN_OBJ_VECTOR) ? GRN_UVECTOR : GRN_BULK,\
- ((flags) & GRN_OBJ_DO_SHALLOW_COPY), (domain))
-#define GRN_VALUE_VAR_SIZE_INIT(obj,flags,domain)\
- GRN_OBJ_INIT((obj), ((flags) & GRN_OBJ_VECTOR) ? GRN_VECTOR : GRN_BULK,\
- ((flags) & GRN_OBJ_DO_SHALLOW_COPY), (domain))
-
-#define GRN_VOID_INIT(obj) GRN_OBJ_INIT((obj), GRN_VOID, 0, GRN_DB_VOID)
-#define GRN_TEXT_INIT(obj,flags) \
- GRN_VALUE_VAR_SIZE_INIT(obj, flags, GRN_DB_TEXT)
-#define GRN_SHORT_TEXT_INIT(obj,flags) \
- GRN_VALUE_VAR_SIZE_INIT(obj, flags, GRN_DB_SHORT_TEXT)
-#define GRN_LONG_TEXT_INIT(obj,flags) \
- GRN_VALUE_VAR_SIZE_INIT(obj, flags, GRN_DB_LONG_TEXT)
-#define GRN_TEXT_SET_REF(obj,str,len) do {\
- (obj)->u.b.head = (char *)(str);\
- (obj)->u.b.curr = (char *)(str) + (len);\
-} while (0)
-#define GRN_TEXT_SET(ctx,obj,str,len) do {\
- if ((obj)->header.impl_flags & GRN_OBJ_REFER) {\
- GRN_TEXT_SET_REF((obj), (str), (len));\
- } else {\
- grn_bulk_write_from((ctx), (obj), (const char *)(str), 0, (unsigned int)(len));\
- }\
-} while (0)
-#define GRN_TEXT_PUT(ctx,obj,str,len) \
- grn_bulk_write((ctx), (obj), (const char *)(str), (unsigned int)(len))
-#define GRN_TEXT_PUTC(ctx,obj,c) do {\
- char _c = (c); grn_bulk_write((ctx), (obj), &_c, 1);\
-} while (0)
-
-#define GRN_TEXT_PUTS(ctx,obj,str) GRN_TEXT_PUT((ctx), (obj), (str), strlen(str))
-#define GRN_TEXT_SETS(ctx,obj,str) GRN_TEXT_SET((ctx), (obj), (str), strlen(str))
-#define GRN_TEXT_VALUE(obj) GRN_BULK_HEAD(obj)
-#define GRN_TEXT_LEN(obj) GRN_BULK_VSIZE(obj)
-
-#define GRN_BOOL_INIT(obj,flags) \
- GRN_VALUE_FIX_SIZE_INIT(obj, flags, GRN_DB_BOOL)
-#define GRN_INT8_INIT(obj,flags) \
- GRN_VALUE_FIX_SIZE_INIT(obj, flags, GRN_DB_INT8)
-#define GRN_UINT8_INIT(obj,flags) \
- GRN_VALUE_FIX_SIZE_INIT(obj, flags, GRN_DB_UINT8)
-#define GRN_INT16_INIT(obj,flags) \
- GRN_VALUE_FIX_SIZE_INIT(obj, flags, GRN_DB_INT16)
-#define GRN_UINT16_INIT(obj,flags) \
- GRN_VALUE_FIX_SIZE_INIT(obj, flags, GRN_DB_UINT16)
-#define GRN_INT32_INIT(obj,flags) \
- GRN_VALUE_FIX_SIZE_INIT(obj, flags, GRN_DB_INT32)
-#define GRN_UINT32_INIT(obj,flags) \
- GRN_VALUE_FIX_SIZE_INIT(obj, flags, GRN_DB_UINT32)
-#define GRN_INT64_INIT(obj,flags) \
- GRN_VALUE_FIX_SIZE_INIT(obj, flags, GRN_DB_INT64)
-#define GRN_UINT64_INIT(obj,flags) \
- GRN_VALUE_FIX_SIZE_INIT(obj, flags, GRN_DB_UINT64)
-#define GRN_FLOAT_INIT(obj,flags) \
- GRN_VALUE_FIX_SIZE_INIT(obj, flags, GRN_DB_FLOAT)
-#define GRN_TIME_INIT(obj,flags) \
- GRN_VALUE_FIX_SIZE_INIT(obj, flags, GRN_DB_TIME)
-#define GRN_RECORD_INIT GRN_VALUE_FIX_SIZE_INIT
-#define GRN_PTR_INIT(obj,flags,domain)\
- GRN_OBJ_INIT((obj), ((flags) & GRN_OBJ_VECTOR) ? GRN_PVECTOR : GRN_PTR,\
- ((flags) & GRN_OBJ_DO_SHALLOW_COPY), (domain))
-#define GRN_TOKYO_GEO_POINT_INIT(obj,flags) \
- GRN_VALUE_FIX_SIZE_INIT(obj, flags, GRN_DB_TOKYO_GEO_POINT)
-#define GRN_WGS84_GEO_POINT_INIT(obj,flags) \
- GRN_VALUE_FIX_SIZE_INIT(obj, flags, GRN_DB_WGS84_GEO_POINT)
-
-#define GRN_BOOL_SET(ctx,obj,val) do {\
- unsigned char _val = (unsigned char)(val);\
- grn_bulk_write_from((ctx), (obj), (char *)&_val, 0, sizeof(unsigned char));\
-} while (0)
-#define GRN_INT8_SET(ctx,obj,val) do {\
- signed char _val = (signed char)(val);\
- grn_bulk_write_from((ctx), (obj), (char *)&_val, 0, sizeof(signed char));\
-} while (0)
-#define GRN_UINT8_SET(ctx,obj,val) do {\
- unsigned char _val = (unsigned char)(val);\
- grn_bulk_write_from((ctx), (obj), (char *)&_val, 0, sizeof(unsigned char));\
-} while (0)
-#define GRN_INT16_SET(ctx,obj,val) do {\
- signed short _val = (signed short)(val);\
- grn_bulk_write_from((ctx), (obj), (char *)&_val, 0, sizeof(signed short));\
-} while (0)
-#define GRN_UINT16_SET(ctx,obj,val) do {\
- unsigned short _val = (unsigned short)(val);\
- grn_bulk_write_from((ctx), (obj), (char *)&_val, 0, sizeof(unsigned short));\
-} while (0)
-#define GRN_INT32_SET(ctx,obj,val) do {\
- int _val = (int)(val);\
- grn_bulk_write_from((ctx), (obj), (char *)&_val, 0, sizeof(int));\
-} while (0)
-#define GRN_UINT32_SET(ctx,obj,val) do {\
- unsigned int _val = (unsigned int)(val);\
- grn_bulk_write_from((ctx), (obj), (char *)&_val, 0, sizeof(unsigned int));\
-} while (0)
-#define GRN_INT64_SET(ctx,obj,val) do {\
- long long int _val = (long long int)(val);\
- grn_bulk_write_from((ctx), (obj), (char *)&_val, 0, sizeof(long long int));\
-} while (0)
-#define GRN_UINT64_SET(ctx,obj,val) do {\
- long long unsigned int _val = (long long unsigned int)(val);\
- grn_bulk_write_from((ctx), (obj), (char *)&_val, 0, sizeof(long long unsigned int));\
-} while (0)
-#define GRN_FLOAT_SET(ctx,obj,val) do {\
- double _val = (double)(val);\
- grn_bulk_write_from((ctx), (obj), (char *)&_val, 0, sizeof(double));\
-} while (0)
-#define GRN_TIME_SET GRN_INT64_SET
-#define GRN_RECORD_SET(ctx,obj,val) do {\
- grn_id _val = (grn_id)(val);\
- grn_bulk_write_from((ctx), (obj), (char *)&_val, 0, sizeof(grn_id));\
-} while (0)
-#define GRN_PTR_SET(ctx,obj,val) do {\
- grn_obj *_val = (grn_obj *)(val);\
- grn_bulk_write_from((ctx), (obj), (char *)&_val, 0, sizeof(grn_obj *));\
-} while (0)
-
-#define GRN_GEO_DEGREE2MSEC(degree)\
- ((int)((degree) * 3600 * 1000 + ((degree) > 0 ? 0.5 : -0.5)))
-#define GRN_GEO_MSEC2DEGREE(msec)\
- ((((int)(msec)) / 3600.0) * 0.001)
-
-#define GRN_GEO_POINT_SET(ctx,obj,_latitude,_longitude) do {\
- grn_geo_point _val;\
- _val.latitude = (int)(_latitude);\
- _val.longitude = (int)(_longitude);\
- grn_bulk_write_from((ctx), (obj), (char *)&_val, 0, sizeof(grn_geo_point));\
-} while (0)
-
-#define GRN_BOOL_SET_AT(ctx,obj,offset,val) do {\
- unsigned char _val = (unsigned char)(val);\
- grn_bulk_write_from((ctx), (obj), (char *)&_val,\
- (offset), sizeof(unsigned char));\
-} while (0)
-#define GRN_INT8_SET_AT(ctx,obj,offset,val) do {\
- signed char _val = (signed char)(val);\
- grn_bulk_write_from((ctx), (obj), (char *)&_val,\
- (offset) * sizeof(signed char), sizeof(signed char));\
-} while (0)
-#define GRN_UINT8_SET_AT(ctx,obj,offset,val) do { \
- unsigned char _val = (unsigned char)(val);\
- grn_bulk_write_from((ctx), (obj), (char *)&_val,\
- (offset) * sizeof(unsigned char), sizeof(unsigned char));\
-} while (0)
-#define GRN_INT16_SET_AT(ctx,obj,offset,val) do {\
- signed short _val = (signed short)(val);\
- grn_bulk_write_from((ctx), (obj), (char *)&_val,\
- (offset) * sizeof(signed short), sizeof(signed short));\
-} while (0)
-#define GRN_UINT16_SET_AT(ctx,obj,offset,val) do { \
- unsigned short _val = (unsigned short)(val);\
- grn_bulk_write_from((ctx), (obj), (char *)&_val,\
- (offset) * sizeof(unsigned short), sizeof(unsigned short));\
-} while (0)
-#define GRN_INT32_SET_AT(ctx,obj,offset,val) do {\
- int _val = (int)(val);\
- grn_bulk_write_from((ctx), (obj), (char *)&_val,\
- (offset) * sizeof(int), sizeof(int));\
-} while (0)
-#define GRN_UINT32_SET_AT(ctx,obj,offset,val) do { \
- unsigned int _val = (unsigned int)(val);\
- grn_bulk_write_from((ctx), (obj), (char *)&_val,\
- (offset) * sizeof(unsigned int), sizeof(unsigned int));\
-} while (0)
-#define GRN_INT64_SET_AT(ctx,obj,offset,val) do {\
- long long int _val = (long long int)(val);\
- grn_bulk_write_from((ctx), (obj), (char *)&_val,\
- (offset) * sizeof(long long int), sizeof(long long int));\
-} while (0)
-#define GRN_UINT64_SET_AT(ctx,obj,offset,val) do {\
- long long unsigned int _val = (long long unsigned int)(val);\
- grn_bulk_write_from((ctx), (obj), (char *)&_val,\
- (offset) * sizeof(long long unsigned int),\
- sizeof(long long unsigned int));\
-} while (0)
-#define GRN_FLOAT_SET_AT(ctx,obj,offset,val) do {\
- double _val = (double)(val);\
- grn_bulk_write_from((ctx), (obj), (char *)&_val,\
- (offset) * sizeof(double), sizeof(double));\
-} while (0)
-#define GRN_TIME_SET_AT GRN_INT64_SET_AT
-#define GRN_RECORD_SET_AT(ctx,obj,offset,val) do {\
- grn_id _val = (grn_id)(val);\
- grn_bulk_write_from((ctx), (obj), (char *)&_val,\
- (offset) * sizeof(grn_id), sizeof(grn_id));\
-} while (0)
-#define GRN_PTR_SET_AT(ctx,obj,offset,val) do {\
- grn_obj *_val = (grn_obj *)(val);\
- grn_bulk_write_from((ctx), (obj), (char *)&_val,\
- (offset) * sizeof(grn_obj *), sizeof(grn_obj *));\
-} while (0)
-
-#define GRN_TIME_USEC_PER_SEC 1000000
-#define GRN_TIME_PACK(sec, usec) ((long long int)(sec) * GRN_TIME_USEC_PER_SEC + (usec))
-#define GRN_TIME_UNPACK(time_value, sec, usec) do {\
- sec = (time_value) / GRN_TIME_USEC_PER_SEC;\
- usec = (time_value) % GRN_TIME_USEC_PER_SEC;\
-} while (0)
-
-GRN_API void grn_time_now(grn_ctx *ctx, grn_obj *obj);
-
-#define GRN_TIME_NOW(ctx,obj) (grn_time_now((ctx), (obj)))
-
-#define GRN_BOOL_VALUE(obj) (*((unsigned char *)GRN_BULK_HEAD(obj)))
-#define GRN_INT8_VALUE(obj) (*((signed char *)GRN_BULK_HEAD(obj)))
-#define GRN_UINT8_VALUE(obj) (*((unsigned char *)GRN_BULK_HEAD(obj)))
-#define GRN_INT16_VALUE(obj) (*((signed short *)GRN_BULK_HEAD(obj)))
-#define GRN_UINT16_VALUE(obj) (*((unsigned short *)GRN_BULK_HEAD(obj)))
-#define GRN_INT32_VALUE(obj) (*((int *)GRN_BULK_HEAD(obj)))
-#define GRN_UINT32_VALUE(obj) (*((unsigned int *)GRN_BULK_HEAD(obj)))
-#define GRN_INT64_VALUE(obj) (*((long long int *)GRN_BULK_HEAD(obj)))
-#define GRN_UINT64_VALUE(obj) (*((long long unsigned int *)GRN_BULK_HEAD(obj)))
-#define GRN_FLOAT_VALUE(obj) (*((double *)GRN_BULK_HEAD(obj)))
-#define GRN_TIME_VALUE GRN_INT64_VALUE
-#define GRN_RECORD_VALUE(obj) (*((grn_id *)GRN_BULK_HEAD(obj)))
-#define GRN_PTR_VALUE(obj) (*((grn_obj **)GRN_BULK_HEAD(obj)))
-#define GRN_GEO_POINT_VALUE(obj,_latitude,_longitude) do {\
- grn_geo_point *_val = (grn_geo_point *)GRN_BULK_HEAD(obj);\
- _latitude = _val->latitude;\
- _longitude = _val->longitude;\
-} while (0)
-
-#define GRN_BOOL_VALUE_AT(obj,offset) (((unsigned char *)GRN_BULK_HEAD(obj))[offset])
-#define GRN_INT8_VALUE_AT(obj,offset) (((signed char *)GRN_BULK_HEAD(obj))[offset])
-#define GRN_UINT8_VALUE_AT(obj,offset) (((unsigned char *)GRN_BULK_HEAD(obj))[offset])
-#define GRN_INT16_VALUE_AT(obj,offset) (((signed short *)GRN_BULK_HEAD(obj))[offset])
-#define GRN_UINT16_VALUE_AT(obj,offset) (((unsigned short *)GRN_BULK_HEAD(obj))[offset])
-#define GRN_INT32_VALUE_AT(obj,offset) (((int *)GRN_BULK_HEAD(obj))[offset])
-#define GRN_UINT32_VALUE_AT(obj,offset) (((unsigned int *)GRN_BULK_HEAD(obj))[offset])
-#define GRN_INT64_VALUE_AT(obj,offset) (((long long int *)GRN_BULK_HEAD(obj))[offset])
-#define GRN_UINT64_VALUE_AT(obj,offset) (((long long unsigned int *)GRN_BULK_HEAD(obj))[offset])
-#define GRN_FLOAT_VALUE_AT(obj,offset) (((double *)GRN_BULK_HEAD(obj))[offset])
-#define GRN_TIME_VALUE_AT GRN_INT64_VALUE_AT
-#define GRN_RECORD_VALUE_AT(obj,offset) (((grn_id *)GRN_BULK_HEAD(obj))[offset])
-#define GRN_PTR_VALUE_AT(obj,offset) (((grn_obj **)GRN_BULK_HEAD(obj))[offset])
-
-#define GRN_BOOL_PUT(ctx,obj,val) do {\
- unsigned char _val = (unsigned char)(val);\
- grn_bulk_write((ctx), (obj), (char *)&_val, sizeof(unsigned char));\
-} while (0)
-#define GRN_INT8_PUT(ctx,obj,val) do {\
- signed char _val = (signed char)(val); grn_bulk_write((ctx), (obj), (char *)&_val, sizeof(signed char));\
-} while (0)
-#define GRN_UINT8_PUT(ctx,obj,val) do {\
- unsigned char _val = (unsigned char)(val);\
- grn_bulk_write((ctx), (obj), (char *)&_val, sizeof(unsigned char));\
-} while (0)
-#define GRN_INT16_PUT(ctx,obj,val) do {\
- signed short _val = (signed short)(val); grn_bulk_write((ctx), (obj), (char *)&_val, sizeof(signed short));\
-} while (0)
-#define GRN_UINT16_PUT(ctx,obj,val) do {\
- unsigned short _val = (unsigned short)(val);\
- grn_bulk_write((ctx), (obj), (char *)&_val, sizeof(unsigned short));\
-} while (0)
-#define GRN_INT32_PUT(ctx,obj,val) do {\
- int _val = (int)(val); grn_bulk_write((ctx), (obj), (char *)&_val, sizeof(int));\
-} while (0)
-#define GRN_UINT32_PUT(ctx,obj,val) do {\
- unsigned int _val = (unsigned int)(val);\
- grn_bulk_write((ctx), (obj), (char *)&_val, sizeof(unsigned int));\
-} while (0)
-#define GRN_INT64_PUT(ctx,obj,val) do {\
- long long int _val = (long long int)(val);\
- grn_bulk_write((ctx), (obj), (char *)&_val, sizeof(long long int));\
-} while (0)
-#define GRN_UINT64_PUT(ctx,obj,val) do {\
- long long unsigned int _val = (long long unsigned int)(val);\
- grn_bulk_write((ctx), (obj), (char *)&_val, sizeof(long long unsigned int));\
-} while (0)
-#define GRN_FLOAT_PUT(ctx,obj,val) do {\
- double _val = (double)(val); grn_bulk_write((ctx), (obj), (char *)&_val, sizeof(double));\
-} while (0)
-#define GRN_TIME_PUT GRN_INT64_PUT
-#define GRN_RECORD_PUT(ctx,obj,val) do {\
- grn_id _val = (grn_id)(val); grn_bulk_write((ctx), (obj), (char *)&_val, sizeof(grn_id));\
-} while (0)
-#define GRN_PTR_PUT(ctx,obj,val) do {\
- grn_obj *_val = (grn_obj *)(val);\
- grn_bulk_write((ctx), (obj), (char *)&_val, sizeof(grn_obj *));\
-} while (0)
-
-/* grn_str: deprecated. use grn_string instead. */
-
-typedef struct {
- const char *orig;
- char *norm;
- short *checks;
- unsigned char *ctypes;
- int flags;
- unsigned int orig_blen;
- unsigned int norm_blen;
- unsigned int length;
- grn_encoding encoding;
-} grn_str;
-
-#define GRN_STR_REMOVEBLANK (0x01<<0)
-#define GRN_STR_WITH_CTYPES (0x01<<1)
-#define GRN_STR_WITH_CHECKS (0x01<<2)
-#define GRN_STR_NORMALIZE GRN_OBJ_KEY_NORMALIZE
-
-GRN_API grn_str *grn_str_open(grn_ctx *ctx, const char *str, unsigned int str_len,
- int flags);
-GRN_API grn_rc grn_str_close(grn_ctx *ctx, grn_str *nstr);
-
-/* grn_string */
-
-#define GRN_STRING_REMOVE_BLANK (0x01<<0)
-#define GRN_STRING_WITH_TYPES (0x01<<1)
-#define GRN_STRING_WITH_CHECKS (0x01<<2)
-#define GRN_STRING_REMOVE_TOKENIZED_DELIMITER (0x01<<3)
-
-#define GRN_NORMALIZER_AUTO ((grn_obj *)1)
-
-#define GRN_CHAR_BLANK 0x80
-#define GRN_CHAR_IS_BLANK(c) ((c) & (GRN_CHAR_BLANK))
-#define GRN_CHAR_TYPE(c) ((c) & 0x7f)
-
-typedef enum {
- GRN_CHAR_NULL = 0,
- GRN_CHAR_ALPHA,
- GRN_CHAR_DIGIT,
- GRN_CHAR_SYMBOL,
- GRN_CHAR_HIRAGANA,
- GRN_CHAR_KATAKANA,
- GRN_CHAR_KANJI,
- GRN_CHAR_OTHERS
-} grn_char_type;
-
-GRN_API grn_obj *grn_string_open(grn_ctx *ctx,
- const char *string,
- unsigned int length_in_bytes,
- grn_obj *normalizer, int flags);
-GRN_API grn_rc grn_string_get_original(grn_ctx *ctx, grn_obj *string,
- const char **original,
- unsigned int *length_in_bytes);
-GRN_API int grn_string_get_flags(grn_ctx *ctx, grn_obj *string);
-GRN_API grn_rc grn_string_get_normalized(grn_ctx *ctx, grn_obj *string,
- const char **normalized,
- unsigned int *length_in_bytes,
- unsigned int *n_characters);
-GRN_API grn_rc grn_string_set_normalized(grn_ctx *ctx, grn_obj *string,
- char *normalized,
- unsigned int length_in_bytes,
- unsigned int n_characters);
-GRN_API const short *grn_string_get_checks(grn_ctx *ctx, grn_obj *string);
-GRN_API grn_rc grn_string_set_checks(grn_ctx *ctx,
- grn_obj *string,
- short *checks);
-GRN_API const unsigned char *grn_string_get_types(grn_ctx *ctx, grn_obj *string);
-GRN_API grn_rc grn_string_set_types(grn_ctx *ctx,
- grn_obj *string,
- unsigned char *types);
-GRN_API grn_encoding grn_string_get_encoding(grn_ctx *ctx, grn_obj *string);
-
-
-GRN_API int grn_charlen(grn_ctx *ctx, const char *str, const char *end);
-
-/* expr */
-
-GRN_API grn_obj *grn_expr_create(grn_ctx *ctx, const char *name, unsigned int name_size);
-GRN_API grn_rc grn_expr_close(grn_ctx *ctx, grn_obj *expr);
-GRN_API grn_obj *grn_expr_add_var(grn_ctx *ctx, grn_obj *expr,
- const char *name, unsigned int name_size);
-GRN_API grn_obj *grn_expr_get_var(grn_ctx *ctx, grn_obj *expr,
- const char *name, unsigned int name_size);
-GRN_API grn_obj *grn_expr_get_var_by_offset(grn_ctx *ctx, grn_obj *expr, unsigned int offset);
-
-GRN_API grn_obj *grn_expr_append_obj(grn_ctx *ctx, grn_obj *expr, grn_obj *obj,
- grn_operator op, int nargs);
-GRN_API grn_obj *grn_expr_append_const(grn_ctx *ctx, grn_obj *expr, grn_obj *obj,
- grn_operator op, int nargs);
-GRN_API grn_obj *grn_expr_append_const_str(grn_ctx *ctx, grn_obj *expr,
- const char *str, unsigned int str_size,
- grn_operator op, int nargs);
-GRN_API grn_obj *grn_expr_append_const_int(grn_ctx *ctx, grn_obj *expr, int i,
- grn_operator op, int nargs);
-GRN_API grn_rc grn_expr_append_op(grn_ctx *ctx, grn_obj *expr, grn_operator op, int nargs);
-
-GRN_API grn_rc grn_expr_get_keywords(grn_ctx *ctx, grn_obj *expr, grn_obj *keywords);
-
-GRN_API grn_rc grn_expr_syntax_escape(grn_ctx *ctx,
- const char *query, int query_size,
- const char *target_characters,
- char escape_character,
- grn_obj *escaped_query);
-GRN_API grn_rc grn_expr_syntax_escape_query(grn_ctx *ctx,
- const char *query, int query_size,
- grn_obj *escaped_query);
-
-GRN_API grn_rc grn_expr_compile(grn_ctx *ctx, grn_obj *expr);
-GRN_API grn_obj *grn_expr_exec(grn_ctx *ctx, grn_obj *expr, int nargs);
-GRN_API grn_rc grn_ctx_push(grn_ctx *ctx, grn_obj *obj);
-GRN_API grn_obj *grn_ctx_pop(grn_ctx *ctx);
-
-GRN_API grn_obj *grn_expr_alloc(grn_ctx *ctx, grn_obj *expr,
- grn_id domain, grn_obj_flags flags);
-
-GRN_API grn_obj *grn_table_select(grn_ctx *ctx, grn_obj *table, grn_obj *expr,
- grn_obj *res, grn_operator op);
-
-GRN_API int grn_obj_columns(grn_ctx *ctx, grn_obj *table,
- const char *str, unsigned int str_size, grn_obj *res);
-
-#define GRN_EXPR_CREATE_FOR_QUERY(ctx,table,expr,var) do {\
- if (((expr) = grn_expr_create((ctx), NULL, 0)) &&\
- ((var) = grn_expr_add_var((ctx), (expr), NULL, 0))) {\
- GRN_RECORD_INIT((var), 0, grn_obj_id((ctx), (table)));\
- } else {\
- (var) = NULL;\
- }\
-} while (0)
-
-typedef unsigned int grn_expr_flags;
-
-#define GRN_EXPR_SYNTAX_QUERY (0x00)
-#define GRN_EXPR_SYNTAX_SCRIPT (0x01)
-#define GRN_EXPR_SYNTAX_OUTPUT_COLUMNS (0x20)
-#define GRN_EXPR_SYNTAX_ADJUSTER (0x40)
-#define GRN_EXPR_ALLOW_PRAGMA (0x02)
-#define GRN_EXPR_ALLOW_COLUMN (0x04)
-#define GRN_EXPR_ALLOW_UPDATE (0x08)
-#define GRN_EXPR_ALLOW_LEADING_NOT (0x10)
-
-GRN_API grn_rc grn_expr_parse(grn_ctx *ctx, grn_obj *expr,
- const char *str, unsigned int str_size,
- grn_obj *default_column, grn_operator default_mode,
- grn_operator default_op, grn_expr_flags flags);
-
-GRN_API grn_obj *grn_expr_snip(grn_ctx *ctx, grn_obj *expr, int flags,
- unsigned int width, unsigned int max_results,
- unsigned int n_tags,
- const char **opentags, unsigned int *opentag_lens,
- const char **closetags, unsigned int *closetag_lens,
- grn_snip_mapping *mapping);
-GRN_API grn_rc grn_expr_snip_add_conditions(grn_ctx *ctx,
- grn_obj *expr,
- grn_obj *snip,
- unsigned int n_tags,
- const char **opentags,
- unsigned int *opentag_lens,
- const char **closetags,
- unsigned int *closetag_lens);
-
-GRN_API grn_table_sort_key *grn_table_sort_key_from_str(grn_ctx *ctx,
- const char *str, unsigned int str_size,
- grn_obj *table, unsigned int *nkeys);
-GRN_API grn_rc grn_table_sort_key_close(grn_ctx *ctx,
- grn_table_sort_key *keys, unsigned int nkeys);
-
-GRN_API grn_bool grn_table_is_grouped(grn_ctx *ctx, grn_obj *table);
-
-GRN_API unsigned int grn_table_max_n_subrecs(grn_ctx *ctx, grn_obj *table);
-
-GRN_API grn_obj *grn_table_create_for_group(grn_ctx *ctx,
- const char *name,
- unsigned int name_size,
- const char *path,
- grn_obj *group_key,
- grn_obj *value_type,
- unsigned int max_n_subrecs);
-
-GRN_API unsigned int grn_table_get_subrecs(grn_ctx *ctx, grn_obj *table,
- grn_id id, grn_id *subrecbuf,
- int *scorebuf, int buf_size);
-
-GRN_API grn_obj *grn_table_tokenize(grn_ctx *ctx, grn_obj *table,
- const char *str, unsigned int str_len,
- grn_obj *buf, grn_bool addp);
-
-GRN_API grn_rc grn_load(grn_ctx *ctx, grn_content_type input_type,
- const char *table, unsigned int table_len,
- const char *columns, unsigned int columns_len,
- const char *values, unsigned int values_len,
- const char *ifexists, unsigned int ifexists_len,
- const char *each, unsigned int each_len);
-
-#define GRN_CTX_MORE (0x01<<0)
-#define GRN_CTX_TAIL (0x01<<1)
-#define GRN_CTX_HEAD (0x01<<2)
-#define GRN_CTX_QUIET (0x01<<3)
-#define GRN_CTX_QUIT (0x01<<4)
-
-GRN_API grn_rc grn_ctx_connect(grn_ctx *ctx, const char *host, int port, int flags);
-GRN_API unsigned int grn_ctx_send(grn_ctx *ctx, const char *str, unsigned int str_len, int flags);
-GRN_API unsigned int grn_ctx_recv(grn_ctx *ctx, char **str, unsigned int *str_len, int *flags);
-
-typedef struct _grn_ctx_info grn_ctx_info;
-
-struct _grn_ctx_info {
- int fd;
- unsigned int com_status;
- grn_obj *outbuf;
- unsigned char stat;
-};
-
-GRN_API grn_rc grn_ctx_info_get(grn_ctx *ctx, grn_ctx_info *info);
-
-GRN_API grn_rc grn_set_segv_handler(void);
-GRN_API grn_rc grn_set_int_handler(void);
-GRN_API grn_rc grn_set_term_handler(void);
-
-/* hash */
-
-typedef struct _grn_hash grn_hash;
-typedef struct _grn_hash_cursor grn_hash_cursor;
-
-GRN_API grn_hash *grn_hash_create(grn_ctx *ctx, const char *path, unsigned int key_size,
- unsigned int value_size, unsigned int flags);
-
-GRN_API grn_hash *grn_hash_open(grn_ctx *ctx, const char *path);
-
-GRN_API grn_rc grn_hash_close(grn_ctx *ctx, grn_hash *hash);
-
-GRN_API grn_id grn_hash_add(grn_ctx *ctx, grn_hash *hash, const void *key,
- unsigned int key_size, void **value, int *added);
-GRN_API grn_id grn_hash_get(grn_ctx *ctx, grn_hash *hash, const void *key,
- unsigned int key_size, void **value);
-
-GRN_API int grn_hash_get_key(grn_ctx *ctx, grn_hash *hash, grn_id id, void *keybuf, int bufsize);
-GRN_API int grn_hash_get_key2(grn_ctx *ctx, grn_hash *hash, grn_id id, grn_obj *bulk);
-GRN_API int grn_hash_get_value(grn_ctx *ctx, grn_hash *hash, grn_id id, void *valuebuf);
-GRN_API grn_rc grn_hash_set_value(grn_ctx *ctx, grn_hash *hash, grn_id id,
- const void *value, int flags);
-
-typedef struct _grn_table_delete_optarg grn_table_delete_optarg;
-
-struct _grn_table_delete_optarg {
- int flags;
- int (*func)(grn_ctx *ctx, grn_obj *, grn_id, void *);
- void *func_arg;
-};
-
-GRN_API grn_rc grn_hash_delete_by_id(grn_ctx *ctx, grn_hash *hash, grn_id id,
- grn_table_delete_optarg *optarg);
-GRN_API grn_rc grn_hash_delete(grn_ctx *ctx, grn_hash *hash,
- const void *key, unsigned int key_size,
- grn_table_delete_optarg *optarg);
-
-GRN_API grn_hash_cursor *grn_hash_cursor_open(grn_ctx *ctx, grn_hash *hash,
- const void *min, unsigned int min_size,
- const void *max, unsigned int max_size,
- int offset, int limit, int flags);
-GRN_API grn_id grn_hash_cursor_next(grn_ctx *ctx, grn_hash_cursor *c);
-GRN_API void grn_hash_cursor_close(grn_ctx *ctx, grn_hash_cursor *c);
-
-GRN_API int grn_hash_cursor_get_key(grn_ctx *ctx, grn_hash_cursor *c, void **key);
-GRN_API int grn_hash_cursor_get_value(grn_ctx *ctx, grn_hash_cursor *c, void **value);
-GRN_API grn_rc grn_hash_cursor_set_value(grn_ctx *ctx, grn_hash_cursor *c,
- const void *value, int flags);
-
-GRN_API int grn_hash_cursor_get_key_value(grn_ctx *ctx, grn_hash_cursor *c,
- void **key, unsigned int *key_size, void **value);
-
-GRN_API grn_rc grn_hash_cursor_delete(grn_ctx *ctx, grn_hash_cursor *c,
- grn_table_delete_optarg *optarg);
-
-#define GRN_HASH_EACH(ctx,hash,id,key,key_size,value,block) do {\
- grn_hash_cursor *_sc = grn_hash_cursor_open(ctx, hash, NULL, 0, NULL, 0, 0, -1, 0); \
- if (_sc) {\
- grn_id id;\
- while ((id = grn_hash_cursor_next(ctx, _sc))) {\
- grn_hash_cursor_get_key_value(ctx, _sc, (void **)(key),\
- (key_size), (void **)(value));\
- block\
- }\
- grn_hash_cursor_close(ctx, _sc);\
- }\
-} while (0)
-
-/* array */
-
-typedef struct _grn_array grn_array;
-typedef struct _grn_array_cursor grn_array_cursor;
-
-GRN_API grn_array *grn_array_create(grn_ctx *ctx, const char *path,
- unsigned int value_size, unsigned int flags);
-GRN_API grn_array *grn_array_open(grn_ctx *ctx, const char *path);
-GRN_API grn_rc grn_array_close(grn_ctx *ctx, grn_array *array);
-GRN_API grn_id grn_array_add(grn_ctx *ctx, grn_array *array, void **value);
-GRN_API grn_id grn_array_push(grn_ctx *ctx, grn_array *array,
- void (*func)(grn_ctx *ctx, grn_array *array,
- grn_id id, void *func_arg),
- void *func_arg);
-GRN_API grn_id grn_array_pull(grn_ctx *ctx, grn_array *array, grn_bool blockp,
- void (*func)(grn_ctx *ctx, grn_array *array,
- grn_id id, void *func_arg),
- void *func_arg);
-GRN_API void grn_array_unblock(grn_ctx *ctx, grn_array *array);
-GRN_API int grn_array_get_value(grn_ctx *ctx, grn_array *array, grn_id id, void *valuebuf);
-GRN_API grn_rc grn_array_set_value(grn_ctx *ctx, grn_array *array, grn_id id,
- const void *value, int flags);
-GRN_API grn_array_cursor *grn_array_cursor_open(grn_ctx *ctx, grn_array *array,
- grn_id min, grn_id max,
- int offset, int limit, int flags);
-GRN_API grn_id grn_array_cursor_next(grn_ctx *ctx, grn_array_cursor *cursor);
-GRN_API int grn_array_cursor_get_value(grn_ctx *ctx, grn_array_cursor *cursor, void **value);
-GRN_API grn_rc grn_array_cursor_set_value(grn_ctx *ctx, grn_array_cursor *cursor,
- const void *value, int flags);
-GRN_API grn_rc grn_array_cursor_delete(grn_ctx *ctx, grn_array_cursor *cursor,
- grn_table_delete_optarg *optarg);
-GRN_API void grn_array_cursor_close(grn_ctx *ctx, grn_array_cursor *cursor);
-GRN_API grn_rc grn_array_delete_by_id(grn_ctx *ctx, grn_array *array, grn_id id,
- grn_table_delete_optarg *optarg);
-
-GRN_API grn_id grn_array_next(grn_ctx *ctx, grn_array *array, grn_id id);
-
-GRN_API void *_grn_array_get_value(grn_ctx *ctx, grn_array *array, grn_id id);
-
-#define GRN_ARRAY_EACH(ctx,array,head,tail,id,value,block) do {\
- grn_array_cursor *_sc = grn_array_cursor_open(ctx, array, head, tail, 0, -1, 0); \
- if (_sc) {\
- grn_id id;\
- while ((id = grn_array_cursor_next(ctx, _sc))) {\
- grn_array_cursor_get_value(ctx, _sc, (void **)(value));\
- block\
- }\
- grn_array_cursor_close(ctx, _sc); \
- }\
-} while (0)
-
-/* pat */
-
-typedef struct _grn_pat grn_pat;
-typedef struct _grn_pat_cursor grn_pat_cursor;
-
-GRN_API grn_pat *grn_pat_create(grn_ctx *ctx, const char *path, unsigned int key_size,
- unsigned int value_size, unsigned int flags);
-
-GRN_API grn_pat *grn_pat_open(grn_ctx *ctx, const char *path);
-
-GRN_API grn_rc grn_pat_close(grn_ctx *ctx, grn_pat *pat);
-
-GRN_API grn_rc grn_pat_remove(grn_ctx *ctx, const char *path);
-
-GRN_API grn_id grn_pat_get(grn_ctx *ctx, grn_pat *pat, const void *key,
- unsigned int key_size, void **value);
-GRN_API grn_id grn_pat_add(grn_ctx *ctx, grn_pat *pat, const void *key,
- unsigned int key_size, void **value, int *added);
-
-GRN_API int grn_pat_get_key(grn_ctx *ctx, grn_pat *pat, grn_id id, void *keybuf, int bufsize);
-GRN_API int grn_pat_get_key2(grn_ctx *ctx, grn_pat *pat, grn_id id, grn_obj *bulk);
-GRN_API int grn_pat_get_value(grn_ctx *ctx, grn_pat *pat, grn_id id, void *valuebuf);
-GRN_API grn_rc grn_pat_set_value(grn_ctx *ctx, grn_pat *pat, grn_id id,
- const void *value, int flags);
-
-GRN_API grn_rc grn_pat_delete_by_id(grn_ctx *ctx, grn_pat *pat, grn_id id,
- grn_table_delete_optarg *optarg);
-GRN_API grn_rc grn_pat_delete(grn_ctx *ctx, grn_pat *pat, const void *key, unsigned int key_size,
- grn_table_delete_optarg *optarg);
-GRN_API int grn_pat_delete_with_sis(grn_ctx *ctx, grn_pat *pat, grn_id id,
- grn_table_delete_optarg *optarg);
-
-typedef struct _grn_pat_scan_hit grn_pat_scan_hit;
-
-struct _grn_pat_scan_hit {
- grn_id id;
- unsigned int offset;
- unsigned int length;
-};
-
-GRN_API int grn_pat_scan(grn_ctx *ctx, grn_pat *pat, const char *str, unsigned int str_len,
- grn_pat_scan_hit *sh, unsigned int sh_size, const char **rest);
-
-GRN_API grn_rc grn_pat_prefix_search(grn_ctx *ctx, grn_pat *pat,
- const void *key, unsigned int key_size, grn_hash *h);
-GRN_API grn_rc grn_pat_suffix_search(grn_ctx *ctx, grn_pat *pat,
- const void *key, unsigned int key_size, grn_hash *h);
-GRN_API grn_id grn_pat_lcp_search(grn_ctx *ctx, grn_pat *pat,
- const void *key, unsigned int key_size);
-
-GRN_API unsigned int grn_pat_size(grn_ctx *ctx, grn_pat *pat);
-
-GRN_API grn_pat_cursor *grn_pat_cursor_open(grn_ctx *ctx, grn_pat *pat,
- const void *min, unsigned int min_size,
- const void *max, unsigned int max_size,
- int offset, int limit, int flags);
-GRN_API grn_id grn_pat_cursor_next(grn_ctx *ctx, grn_pat_cursor *c);
-GRN_API void grn_pat_cursor_close(grn_ctx *ctx, grn_pat_cursor *c);
-
-GRN_API int grn_pat_cursor_get_key(grn_ctx *ctx, grn_pat_cursor *c, void **key);
-GRN_API int grn_pat_cursor_get_value(grn_ctx *ctx, grn_pat_cursor *c, void **value);
-
-GRN_API int grn_pat_cursor_get_key_value(grn_ctx *ctx, grn_pat_cursor *c,
- void **key, unsigned int *key_size, void **value);
-GRN_API grn_rc grn_pat_cursor_set_value(grn_ctx *ctx, grn_pat_cursor *c,
- const void *value, int flags);
-GRN_API grn_rc grn_pat_cursor_delete(grn_ctx *ctx, grn_pat_cursor *c,
- grn_table_delete_optarg *optarg);
-
-#define GRN_PAT_EACH(ctx,pat,id,key,key_size,value,block) do { \
- grn_pat_cursor *_sc = grn_pat_cursor_open(ctx, pat, NULL, 0, NULL, 0, 0, -1, 0); \
- if (_sc) {\
- grn_id id;\
- while ((id = grn_pat_cursor_next(ctx, _sc))) {\
- grn_pat_cursor_get_key_value(ctx, _sc, (void **)(key),\
- (key_size), (void **)(value));\
- block\
- }\
- grn_pat_cursor_close(ctx, _sc);\
- }\
-} while (0)
-
-/* dat */
-
-typedef struct _grn_dat grn_dat;
-typedef struct _grn_dat_cursor grn_dat_cursor;
-
-GRN_API grn_dat *grn_dat_create(grn_ctx *ctx, const char *path, unsigned int key_size,
- unsigned int value_size, unsigned int flags);
-
-GRN_API grn_dat *grn_dat_open(grn_ctx *ctx, const char *path);
-
-GRN_API grn_rc grn_dat_close(grn_ctx *ctx, grn_dat *dat);
-
-GRN_API grn_rc grn_dat_remove(grn_ctx *ctx, const char *path);
-
-GRN_API grn_id grn_dat_get(grn_ctx *ctx, grn_dat *dat, const void *key,
- unsigned int key_size, void **value);
-GRN_API grn_id grn_dat_add(grn_ctx *ctx, grn_dat *dat, const void *key,
- unsigned int key_size, void **value, int *added);
-
-GRN_API int grn_dat_get_key(grn_ctx *ctx, grn_dat *dat, grn_id id, void *keybuf, int bufsize);
-GRN_API int grn_dat_get_key2(grn_ctx *ctx, grn_dat *dat, grn_id id, grn_obj *bulk);
-
-GRN_API grn_rc grn_dat_delete_by_id(grn_ctx *ctx, grn_dat *dat, grn_id id,
- grn_table_delete_optarg *optarg);
-GRN_API grn_rc grn_dat_delete(grn_ctx *ctx, grn_dat *dat, const void *key, unsigned int key_size,
- grn_table_delete_optarg *optarg);
-
-GRN_API grn_rc grn_dat_update_by_id(grn_ctx *ctx, grn_dat *dat, grn_id src_key_id,
- const void *dest_key, unsigned int dest_key_size);
-GRN_API grn_rc grn_dat_update(grn_ctx *ctx, grn_dat *dat,
- const void *src_key, unsigned int src_key_size,
- const void *dest_key, unsigned int dest_key_size);
-
-GRN_API unsigned int grn_dat_size(grn_ctx *ctx, grn_dat *dat);
-
-GRN_API grn_dat_cursor *grn_dat_cursor_open(grn_ctx *ctx, grn_dat *dat,
- const void *min, unsigned int min_size,
- const void *max, unsigned int max_size,
- int offset, int limit, int flags);
-GRN_API grn_id grn_dat_cursor_next(grn_ctx *ctx, grn_dat_cursor *c);
-GRN_API void grn_dat_cursor_close(grn_ctx *ctx, grn_dat_cursor *c);
-
-GRN_API int grn_dat_cursor_get_key(grn_ctx *ctx, grn_dat_cursor *c, const void **key);
-GRN_API grn_rc grn_dat_cursor_delete(grn_ctx *ctx, grn_dat_cursor *c,
- grn_table_delete_optarg *optarg);
-
-#define GRN_DAT_EACH(ctx,dat,id,key,key_size,block) do {\
- grn_dat_cursor *_sc = grn_dat_cursor_open(ctx, dat, NULL, 0, NULL, 0, 0, -1, 0);\
- if (_sc) {\
- grn_id id;\
- unsigned int *_ks = (key_size);\
- if (_ks) {\
- while ((id = grn_dat_cursor_next(ctx, _sc))) {\
- int _ks_raw = grn_dat_cursor_get_key(ctx, _sc, (const void **)(key));\
- *(_ks) = (unsigned int)_ks_raw;\
- block\
- }\
- } else {\
- while ((id = grn_dat_cursor_next(ctx, _sc))) {\
- grn_dat_cursor_get_key(ctx, _sc, (const void **)(key));\
- block\
- }\
- }\
- grn_dat_cursor_close(ctx, _sc);\
- }\
-} while (0)
-
-/* buffered index builder */
-
-typedef struct _grn_ii grn_ii;
-typedef struct _grn_ii_buffer grn_ii_buffer;
-
-grn_ii_buffer *grn_ii_buffer_open(grn_ctx *ctx, grn_ii *ii,
- long long unsigned int update_buffer_size);
-grn_rc grn_ii_buffer_append(grn_ctx *ctx, grn_ii_buffer *ii_buffer,
- grn_id rid, unsigned int section, grn_obj *value);
-grn_rc grn_ii_buffer_commit(grn_ctx *ctx, grn_ii_buffer *ii_buffer);
-grn_rc grn_ii_buffer_close(grn_ctx *ctx, grn_ii_buffer *ii_buffer);
-
-
-#ifdef __cplusplus
-}
-#endif
+#include "groonga/portability.h"
+#include "groonga/groonga.h"
+#include "groonga/obj.h"
+#include "groonga/ii.h"
+#include "groonga/expr.h"
+#include "groonga/output.h"
+#include "groonga/util.h"
+#include "groonga/request_canceler.h"
#endif /* GROONGA_H */
diff --git a/storage/mroonga/vendor/groonga/include/groonga/Makefile.am b/storage/mroonga/vendor/groonga/include/groonga/Makefile.am
index 5cfb61937fb..37a2b6f45a8 100644
--- a/storage/mroonga/vendor/groonga/include/groonga/Makefile.am
+++ b/storage/mroonga/vendor/groonga/include/groonga/Makefile.am
@@ -1,7 +1,18 @@
groonga_includedir = $(pkgincludedir)/groonga
groonga_include_HEADERS = \
+ command.h \
+ expr.h \
+ groonga.h \
+ ii.h \
+ obj.h \
+ output.h \
plugin.h \
+ portability.h \
+ request_canceler.h \
+ scorer.h \
+ token.h \
tokenizer.h \
token_filter.h \
nfkc.h \
- normalizer.h
+ normalizer.h \
+ util.h
diff --git a/storage/mroonga/vendor/groonga/include/groonga/command.h b/storage/mroonga/vendor/groonga/include/groonga/command.h
new file mode 100644
index 00000000000..101956a04f9
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/command.h
@@ -0,0 +1,79 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2015 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
+*/
+#ifndef GROONGA_COMMAND_H
+#define GROONGA_COMMAND_H
+
+#include <groonga/plugin.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+typedef struct _grn_command_input grn_command_input;
+
+GRN_PLUGIN_EXPORT grn_command_input *grn_command_input_open(grn_ctx *ctx,
+ grn_obj *command);
+GRN_PLUGIN_EXPORT grn_rc grn_command_input_close(grn_ctx *ctx,
+ grn_command_input *input);
+
+GRN_PLUGIN_EXPORT grn_obj *grn_command_input_add(grn_ctx *ctx,
+ grn_command_input *input,
+ const char *name,
+ int name_size,
+ grn_bool *added);
+GRN_PLUGIN_EXPORT grn_obj *grn_command_input_get(grn_ctx *ctx,
+ grn_command_input *input,
+ const char *name,
+ int name_size);
+GRN_PLUGIN_EXPORT grn_obj *grn_command_input_at(grn_ctx *ctx,
+ grn_command_input *input,
+ unsigned int offset);
+
+typedef void grn_command_run_func(grn_ctx *ctx,
+ grn_obj *command,
+ grn_command_input *input,
+ void *user_data);
+
+/*
+ grn_command_register() registers a command to the database which is
+ associated with `ctx'. `command_name' and `command_name_size'
+ specify the command name. Alphabetic letters ('A'-'Z' and 'a'-'z'),
+ digits ('0'-'9') and an underscore ('_') are capable characters.
+
+ `run' is called for running the command.
+
+ grn_command_register() returns GRN_SUCCESS on success, an error
+ code on failure.
+ */
+GRN_PLUGIN_EXPORT grn_rc grn_command_register(grn_ctx *ctx,
+ const char *command_name,
+ int command_name_size,
+ grn_command_run_func *run,
+ grn_expr_var *vars,
+ unsigned int n_vars,
+ void *user_data);
+
+GRN_PLUGIN_EXPORT grn_rc grn_command_run(grn_ctx *ctx,
+ grn_obj *command,
+ grn_command_input *input);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* GROONGA_COMMAND_H */
diff --git a/storage/mroonga/vendor/groonga/include/groonga/expr.h b/storage/mroonga/vendor/groonga/include/groonga/expr.h
new file mode 100644
index 00000000000..63cbb6ebc7a
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/expr.h
@@ -0,0 +1,110 @@
+/*
+ Copyright(C) 2009-2014 Brazil
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should 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 GROONGA_EXPR_H
+#define GROONGA_EXPR_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+GRN_API grn_obj *grn_expr_create(grn_ctx *ctx, const char *name, unsigned int name_size);
+GRN_API grn_rc grn_expr_close(grn_ctx *ctx, grn_obj *expr);
+GRN_API grn_obj *grn_expr_add_var(grn_ctx *ctx, grn_obj *expr,
+ const char *name, unsigned int name_size);
+GRN_API grn_obj *grn_expr_get_var(grn_ctx *ctx, grn_obj *expr,
+ const char *name, unsigned int name_size);
+GRN_API grn_obj *grn_expr_get_var_by_offset(grn_ctx *ctx, grn_obj *expr, unsigned int offset);
+GRN_API grn_rc grn_expr_clear_vars(grn_ctx *ctx, grn_obj *expr);
+
+
+GRN_API grn_obj *grn_expr_append_obj(grn_ctx *ctx, grn_obj *expr, grn_obj *obj,
+ grn_operator op, int nargs);
+GRN_API grn_obj *grn_expr_append_const(grn_ctx *ctx, grn_obj *expr, grn_obj *obj,
+ grn_operator op, int nargs);
+GRN_API grn_obj *grn_expr_append_const_str(grn_ctx *ctx, grn_obj *expr,
+ const char *str, unsigned int str_size,
+ grn_operator op, int nargs);
+GRN_API grn_obj *grn_expr_append_const_int(grn_ctx *ctx, grn_obj *expr, int i,
+ grn_operator op, int nargs);
+GRN_API grn_rc grn_expr_append_op(grn_ctx *ctx, grn_obj *expr, grn_operator op, int nargs);
+
+GRN_API grn_rc grn_expr_get_keywords(grn_ctx *ctx, grn_obj *expr, grn_obj *keywords);
+
+GRN_API grn_rc grn_expr_syntax_escape(grn_ctx *ctx,
+ const char *query, int query_size,
+ const char *target_characters,
+ char escape_character,
+ grn_obj *escaped_query);
+GRN_API grn_rc grn_expr_syntax_escape_query(grn_ctx *ctx,
+ const char *query, int query_size,
+ grn_obj *escaped_query);
+
+GRN_API grn_rc grn_expr_compile(grn_ctx *ctx, grn_obj *expr);
+GRN_API grn_rc grn_expr_dump_plan(grn_ctx *ctx, grn_obj *expr, grn_obj *buffer);
+GRN_API grn_obj *grn_expr_exec(grn_ctx *ctx, grn_obj *expr, int nargs);
+
+GRN_API grn_obj *grn_expr_alloc(grn_ctx *ctx, grn_obj *expr,
+ grn_id domain, grn_obj_flags flags);
+
+#define GRN_EXPR_CREATE_FOR_QUERY(ctx,table,expr,var) do {\
+ if (((expr) = grn_expr_create((ctx), NULL, 0)) &&\
+ ((var) = grn_expr_add_var((ctx), (expr), NULL, 0))) {\
+ GRN_RECORD_INIT((var), 0, grn_obj_id((ctx), (table)));\
+ } else {\
+ (var) = NULL;\
+ }\
+} while (0)
+
+typedef unsigned int grn_expr_flags;
+
+#define GRN_EXPR_SYNTAX_QUERY (0x00)
+#define GRN_EXPR_SYNTAX_SCRIPT (0x01)
+#define GRN_EXPR_SYNTAX_OUTPUT_COLUMNS (0x20)
+#define GRN_EXPR_SYNTAX_ADJUSTER (0x40)
+#define GRN_EXPR_ALLOW_PRAGMA (0x02)
+#define GRN_EXPR_ALLOW_COLUMN (0x04)
+#define GRN_EXPR_ALLOW_UPDATE (0x08)
+#define GRN_EXPR_ALLOW_LEADING_NOT (0x10)
+
+GRN_API grn_rc grn_expr_parse(grn_ctx *ctx, grn_obj *expr,
+ const char *str, unsigned int str_size,
+ grn_obj *default_column, grn_operator default_mode,
+ grn_operator default_op, grn_expr_flags flags);
+
+GRN_API grn_obj *grn_expr_snip(grn_ctx *ctx, grn_obj *expr, int flags,
+ unsigned int width, unsigned int max_results,
+ unsigned int n_tags,
+ const char **opentags, unsigned int *opentag_lens,
+ const char **closetags, unsigned int *closetag_lens,
+ grn_snip_mapping *mapping);
+GRN_API grn_rc grn_expr_snip_add_conditions(grn_ctx *ctx,
+ grn_obj *expr,
+ grn_obj *snip,
+ unsigned int n_tags,
+ const char **opentags,
+ unsigned int *opentag_lens,
+ const char **closetags,
+ unsigned int *closetag_lens);
+
+GRN_API unsigned int grn_expr_estimate_size(grn_ctx *ctx, grn_obj *expr);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GROONGA_EXPR_H */
diff --git a/storage/mroonga/vendor/groonga/include/groonga/groonga.h b/storage/mroonga/vendor/groonga/include/groonga/groonga.h
new file mode 100644
index 00000000000..6f2aae79c01
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/groonga.h
@@ -0,0 +1,2025 @@
+/*
+ Copyright(C) 2009-2015 Brazil
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should 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 GROONGA_GROONGA_H
+#define GROONGA_GROONGA_H
+
+#include <stdarg.h>
+#include <sys/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef GRN_API
+# if defined(_WIN32) || defined(_WIN64)
+# define GRN_API __declspec(dllimport)
+# else
+# define GRN_API
+# endif /* defined(_WIN32) || defined(_WIN64) */
+#endif /* GRN_API */
+
+typedef unsigned int grn_id;
+typedef unsigned char grn_bool;
+
+#define GRN_ID_NIL (0x00)
+#define GRN_ID_MAX (0x3fffffff)
+
+#define GRN_TRUE (1)
+#define GRN_FALSE (0)
+
+typedef enum {
+ GRN_SUCCESS = 0,
+ GRN_END_OF_DATA = 1,
+ GRN_UNKNOWN_ERROR = -1,
+ GRN_OPERATION_NOT_PERMITTED = -2,
+ GRN_NO_SUCH_FILE_OR_DIRECTORY = -3,
+ GRN_NO_SUCH_PROCESS = -4,
+ GRN_INTERRUPTED_FUNCTION_CALL = -5,
+ GRN_INPUT_OUTPUT_ERROR = -6,
+ GRN_NO_SUCH_DEVICE_OR_ADDRESS = -7,
+ GRN_ARG_LIST_TOO_LONG = -8,
+ GRN_EXEC_FORMAT_ERROR = -9,
+ GRN_BAD_FILE_DESCRIPTOR = -10,
+ GRN_NO_CHILD_PROCESSES = -11,
+ GRN_RESOURCE_TEMPORARILY_UNAVAILABLE = -12,
+ GRN_NOT_ENOUGH_SPACE = -13,
+ GRN_PERMISSION_DENIED = -14,
+ GRN_BAD_ADDRESS = -15,
+ GRN_RESOURCE_BUSY = -16,
+ GRN_FILE_EXISTS = -17,
+ GRN_IMPROPER_LINK = -18,
+ GRN_NO_SUCH_DEVICE = -19,
+ GRN_NOT_A_DIRECTORY = -20,
+ GRN_IS_A_DIRECTORY = -21,
+ GRN_INVALID_ARGUMENT = -22,
+ GRN_TOO_MANY_OPEN_FILES_IN_SYSTEM = -23,
+ GRN_TOO_MANY_OPEN_FILES = -24,
+ GRN_INAPPROPRIATE_I_O_CONTROL_OPERATION = -25,
+ GRN_FILE_TOO_LARGE = -26,
+ GRN_NO_SPACE_LEFT_ON_DEVICE = -27,
+ GRN_INVALID_SEEK = -28,
+ GRN_READ_ONLY_FILE_SYSTEM = -29,
+ GRN_TOO_MANY_LINKS = -30,
+ GRN_BROKEN_PIPE = -31,
+ GRN_DOMAIN_ERROR = -32,
+ GRN_RESULT_TOO_LARGE = -33,
+ GRN_RESOURCE_DEADLOCK_AVOIDED = -34,
+ GRN_NO_MEMORY_AVAILABLE = -35,
+ GRN_FILENAME_TOO_LONG = -36,
+ GRN_NO_LOCKS_AVAILABLE = -37,
+ GRN_FUNCTION_NOT_IMPLEMENTED = -38,
+ GRN_DIRECTORY_NOT_EMPTY = -39,
+ GRN_ILLEGAL_BYTE_SEQUENCE = -40,
+ GRN_SOCKET_NOT_INITIALIZED = -41,
+ GRN_OPERATION_WOULD_BLOCK = -42,
+ GRN_ADDRESS_IS_NOT_AVAILABLE = -43,
+ GRN_NETWORK_IS_DOWN = -44,
+ GRN_NO_BUFFER = -45,
+ GRN_SOCKET_IS_ALREADY_CONNECTED = -46,
+ GRN_SOCKET_IS_NOT_CONNECTED = -47,
+ GRN_SOCKET_IS_ALREADY_SHUTDOWNED = -48,
+ GRN_OPERATION_TIMEOUT = -49,
+ GRN_CONNECTION_REFUSED = -50,
+ GRN_RANGE_ERROR = -51,
+ GRN_TOKENIZER_ERROR = -52,
+ GRN_FILE_CORRUPT = -53,
+ GRN_INVALID_FORMAT = -54,
+ GRN_OBJECT_CORRUPT = -55,
+ GRN_TOO_MANY_SYMBOLIC_LINKS = -56,
+ GRN_NOT_SOCKET = -57,
+ GRN_OPERATION_NOT_SUPPORTED = -58,
+ GRN_ADDRESS_IS_IN_USE = -59,
+ GRN_ZLIB_ERROR = -60,
+ GRN_LZ4_ERROR = -61,
+/* Just for backward compatibility. We'll remove it at 5.0.0. */
+#define GRN_LZO_ERROR GRN_LZ4_ERROR
+ GRN_STACK_OVER_FLOW = -62,
+ GRN_SYNTAX_ERROR = -63,
+ GRN_RETRY_MAX = -64,
+ GRN_INCOMPATIBLE_FILE_FORMAT = -65,
+ GRN_UPDATE_NOT_ALLOWED = -66,
+ GRN_TOO_SMALL_OFFSET = -67,
+ GRN_TOO_LARGE_OFFSET = -68,
+ GRN_TOO_SMALL_LIMIT = -69,
+ GRN_CAS_ERROR = -70,
+ GRN_UNSUPPORTED_COMMAND_VERSION = -71,
+ GRN_NORMALIZER_ERROR = -72,
+ GRN_TOKEN_FILTER_ERROR = -73,
+ GRN_COMMAND_ERROR = -74,
+ GRN_PLUGIN_ERROR = -75,
+ GRN_SCORER_ERROR = -76
+} grn_rc;
+
+GRN_API grn_rc grn_init(void);
+GRN_API grn_rc grn_fin(void);
+
+typedef enum {
+ GRN_ENC_DEFAULT = 0,
+ GRN_ENC_NONE,
+ GRN_ENC_EUC_JP,
+ GRN_ENC_UTF8,
+ GRN_ENC_SJIS,
+ GRN_ENC_LATIN1,
+ GRN_ENC_KOI8R
+} grn_encoding;
+
+typedef enum {
+ GRN_COMMAND_VERSION_DEFAULT = 0,
+ GRN_COMMAND_VERSION_1,
+ GRN_COMMAND_VERSION_2
+} grn_command_version;
+
+#define GRN_COMMAND_VERSION_MIN GRN_COMMAND_VERSION_1
+#define GRN_COMMAND_VERSION_STABLE GRN_COMMAND_VERSION_1
+#define GRN_COMMAND_VERSION_MAX GRN_COMMAND_VERSION_2
+
+typedef enum {
+ GRN_LOG_NONE = 0,
+ GRN_LOG_EMERG,
+ GRN_LOG_ALERT,
+ GRN_LOG_CRIT,
+ GRN_LOG_ERROR,
+ GRN_LOG_WARNING,
+ GRN_LOG_NOTICE,
+ GRN_LOG_INFO,
+ GRN_LOG_DEBUG,
+ GRN_LOG_DUMP
+} grn_log_level;
+
+/* query log flags */
+#define GRN_QUERY_LOG_NONE (0x00)
+#define GRN_QUERY_LOG_COMMAND (0x01<<0)
+#define GRN_QUERY_LOG_RESULT_CODE (0x01<<1)
+#define GRN_QUERY_LOG_DESTINATION (0x01<<2)
+#define GRN_QUERY_LOG_CACHE (0x01<<3)
+#define GRN_QUERY_LOG_SIZE (0x01<<4)
+#define GRN_QUERY_LOG_SCORE (0x01<<5)
+#define GRN_QUERY_LOG_ALL\
+ (GRN_QUERY_LOG_COMMAND |\
+ GRN_QUERY_LOG_RESULT_CODE |\
+ GRN_QUERY_LOG_DESTINATION |\
+ GRN_QUERY_LOG_CACHE |\
+ GRN_QUERY_LOG_SIZE |\
+ GRN_QUERY_LOG_SCORE)
+#define GRN_QUERY_LOG_DEFAULT GRN_QUERY_LOG_ALL
+
+typedef enum {
+ GRN_CONTENT_NONE = 0,
+ GRN_CONTENT_TSV,
+ GRN_CONTENT_JSON,
+ GRN_CONTENT_XML,
+ GRN_CONTENT_MSGPACK,
+ GRN_CONTENT_GROONGA_COMMAND_LIST
+} grn_content_type;
+
+typedef struct _grn_obj grn_obj;
+typedef struct _grn_ctx grn_ctx;
+
+#define GRN_CTX_MSGSIZE (0x80)
+#define GRN_CTX_FIN (0xff)
+
+typedef union {
+ int int_value;
+ grn_id id;
+ void *ptr;
+} grn_user_data;
+
+typedef grn_obj *grn_proc_func(grn_ctx *ctx, int nargs, grn_obj **args,
+ grn_user_data *user_data);
+
+struct _grn_ctx {
+ grn_rc rc;
+ int flags;
+ grn_encoding encoding;
+ unsigned char ntrace;
+ unsigned char errlvl;
+ unsigned char stat;
+ unsigned int seqno;
+ unsigned int subno;
+ unsigned int seqno2;
+ unsigned int errline;
+ grn_user_data user_data;
+ grn_ctx *prev;
+ grn_ctx *next;
+ const char *errfile;
+ const char *errfunc;
+ struct _grn_ctx_impl *impl;
+ void *trace[16];
+ char errbuf[GRN_CTX_MSGSIZE];
+};
+
+#define GRN_CTX_USER_DATA(ctx) (&((ctx)->user_data))
+
+/* Deprecated since 4.0.3. Don't use it. */
+#define GRN_CTX_USE_QL (0x03)
+/* Deprecated since 4.0.3. Don't use it. */
+#define GRN_CTX_BATCH_MODE (0x04)
+#define GRN_CTX_PER_DB (0x08)
+
+GRN_API grn_rc grn_ctx_init(grn_ctx *ctx, int flags);
+GRN_API grn_rc grn_ctx_fin(grn_ctx *ctx);
+GRN_API grn_ctx *grn_ctx_open(int flags);
+GRN_API grn_rc grn_ctx_close(grn_ctx *ctx);
+GRN_API grn_rc grn_ctx_set_finalizer(grn_ctx *ctx, grn_proc_func *func);
+
+GRN_API grn_encoding grn_get_default_encoding(void);
+GRN_API grn_rc grn_set_default_encoding(grn_encoding encoding);
+
+#define GRN_CTX_GET_ENCODING(ctx) ((ctx)->encoding)
+#define GRN_CTX_SET_ENCODING(ctx,enc) \
+ ((ctx)->encoding = (enc == GRN_ENC_DEFAULT) ? grn_get_default_encoding() : enc)
+
+GRN_API const char *grn_get_version(void);
+GRN_API const char *grn_get_package(void);
+
+GRN_API grn_command_version grn_get_default_command_version(void);
+GRN_API grn_rc grn_set_default_command_version(grn_command_version version);
+GRN_API grn_command_version grn_ctx_get_command_version(grn_ctx *ctx);
+GRN_API grn_rc grn_ctx_set_command_version(grn_ctx *ctx, grn_command_version version);
+GRN_API long long int grn_ctx_get_match_escalation_threshold(grn_ctx *ctx);
+GRN_API grn_rc grn_ctx_set_match_escalation_threshold(grn_ctx *ctx, long long int threshold);
+GRN_API long long int grn_get_default_match_escalation_threshold(void);
+GRN_API grn_rc grn_set_default_match_escalation_threshold(long long int threshold);
+
+GRN_API int grn_get_lock_timeout(void);
+GRN_API grn_rc grn_set_lock_timeout(int timeout);
+
+/* cache */
+#define GRN_CACHE_DEFAULT_MAX_N_ENTRIES 100
+typedef struct _grn_cache grn_cache;
+
+GRN_API grn_cache *grn_cache_open(grn_ctx *ctx);
+GRN_API grn_rc grn_cache_close(grn_ctx *ctx, grn_cache *cache);
+
+GRN_API grn_rc grn_cache_current_set(grn_ctx *ctx, grn_cache *cache);
+GRN_API grn_cache *grn_cache_current_get(grn_ctx *ctx);
+
+GRN_API grn_rc grn_cache_set_max_n_entries(grn_ctx *ctx,
+ grn_cache *cache,
+ unsigned int n);
+GRN_API unsigned int grn_cache_get_max_n_entries(grn_ctx *ctx,
+ grn_cache *cache);
+
+/* grn_encoding */
+
+GRN_API const char *grn_encoding_to_string(grn_encoding encoding);
+GRN_API grn_encoding grn_encoding_parse(const char *name);
+
+/* obj */
+
+typedef unsigned short int grn_obj_flags;
+
+#define GRN_OBJ_TABLE_TYPE_MASK (0x07)
+#define GRN_OBJ_TABLE_HASH_KEY (0x00)
+#define GRN_OBJ_TABLE_PAT_KEY (0x01)
+#define GRN_OBJ_TABLE_DAT_KEY (0x02)
+#define GRN_OBJ_TABLE_NO_KEY (0x03)
+
+#define GRN_OBJ_KEY_MASK (0x07<<3)
+#define GRN_OBJ_KEY_UINT (0x00<<3)
+#define GRN_OBJ_KEY_INT (0x01<<3)
+#define GRN_OBJ_KEY_FLOAT (0x02<<3)
+#define GRN_OBJ_KEY_GEO_POINT (0x03<<3)
+
+#define GRN_OBJ_KEY_WITH_SIS (0x01<<6)
+#define GRN_OBJ_KEY_NORMALIZE (0x01<<7)
+
+#define GRN_OBJ_COLUMN_TYPE_MASK (0x07)
+#define GRN_OBJ_COLUMN_SCALAR (0x00)
+#define GRN_OBJ_COLUMN_VECTOR (0x01)
+#define GRN_OBJ_COLUMN_INDEX (0x02)
+
+#define GRN_OBJ_COMPRESS_MASK (0x07<<4)
+#define GRN_OBJ_COMPRESS_NONE (0x00<<4)
+#define GRN_OBJ_COMPRESS_ZLIB (0x01<<4)
+#define GRN_OBJ_COMPRESS_LZ4 (0x02<<4)
+/* Just for backward compatibility. We'll remove it at 5.0.0. */
+#define GRN_OBJ_COMPRESS_LZO GRN_OBJ_COMPRESS_LZ4
+
+#define GRN_OBJ_WITH_SECTION (0x01<<7)
+#define GRN_OBJ_WITH_WEIGHT (0x01<<8)
+#define GRN_OBJ_WITH_POSITION (0x01<<9)
+#define GRN_OBJ_RING_BUFFER (0x01<<10)
+
+#define GRN_OBJ_UNIT_MASK (0x0f<<8)
+#define GRN_OBJ_UNIT_DOCUMENT_NONE (0x00<<8)
+#define GRN_OBJ_UNIT_DOCUMENT_SECTION (0x01<<8)
+#define GRN_OBJ_UNIT_DOCUMENT_POSITION (0x02<<8)
+#define GRN_OBJ_UNIT_SECTION_NONE (0x03<<8)
+#define GRN_OBJ_UNIT_SECTION_POSITION (0x04<<8)
+#define GRN_OBJ_UNIT_POSITION_NONE (0x05<<8)
+#define GRN_OBJ_UNIT_USERDEF_DOCUMENT (0x06<<8)
+#define GRN_OBJ_UNIT_USERDEF_SECTION (0x07<<8)
+#define GRN_OBJ_UNIT_USERDEF_POSITION (0x08<<8)
+
+#define GRN_OBJ_NO_SUBREC (0x00<<13)
+#define GRN_OBJ_WITH_SUBREC (0x01<<13)
+
+#define GRN_OBJ_KEY_VAR_SIZE (0x01<<14)
+
+#define GRN_OBJ_TEMPORARY (0x00<<15)
+#define GRN_OBJ_PERSISTENT (0x01<<15)
+
+/* obj types */
+
+#define GRN_VOID (0x00)
+#define GRN_BULK (0x02)
+#define GRN_PTR (0x03)
+#define GRN_UVECTOR (0x04) /* vector of fixed size data especially grn_id */
+#define GRN_PVECTOR (0x05) /* vector of grn_obj* */
+#define GRN_VECTOR (0x06) /* vector of arbitrary data */
+#define GRN_MSG (0x07)
+#define GRN_QUERY (0x08)
+#define GRN_ACCESSOR (0x09)
+#define GRN_SNIP (0x0b)
+#define GRN_PATSNIP (0x0c)
+#define GRN_STRING (0x0d)
+#define GRN_CURSOR_TABLE_HASH_KEY (0x10)
+#define GRN_CURSOR_TABLE_PAT_KEY (0x11)
+#define GRN_CURSOR_TABLE_DAT_KEY (0x12)
+#define GRN_CURSOR_TABLE_NO_KEY (0x13)
+#define GRN_CURSOR_COLUMN_INDEX (0x18)
+#define GRN_CURSOR_COLUMN_GEO_INDEX (0x1a)
+#define GRN_TYPE (0x20)
+#define GRN_PROC (0x21)
+#define GRN_EXPR (0x22)
+#define GRN_TABLE_HASH_KEY (0x30)
+#define GRN_TABLE_PAT_KEY (0x31)
+#define GRN_TABLE_DAT_KEY (0x32)
+#define GRN_TABLE_NO_KEY (0x33)
+#define GRN_DB (0x37)
+#define GRN_COLUMN_FIX_SIZE (0x40)
+#define GRN_COLUMN_VAR_SIZE (0x41)
+#define GRN_COLUMN_INDEX (0x48)
+
+typedef struct _grn_section grn_section;
+typedef struct _grn_obj_header grn_obj_header;
+
+struct _grn_section {
+ unsigned int offset;
+ unsigned int length;
+ unsigned int weight;
+ grn_id domain;
+};
+
+struct _grn_obj_header {
+ unsigned char type;
+ unsigned char impl_flags;
+ grn_obj_flags flags;
+ grn_id domain;
+};
+
+struct _grn_obj {
+ grn_obj_header header;
+ union {
+ struct {
+ char *head;
+ char *curr;
+ char *tail;
+ } b;
+ struct {
+ grn_obj *body;
+ grn_section *sections;
+ int n_sections;
+ } v;
+ } u;
+};
+
+#define GRN_OBJ_REFER (0x01<<0)
+#define GRN_OBJ_OUTPLACE (0x01<<1)
+
+#define GRN_OBJ_INIT(obj,obj_type,obj_flags,obj_domain) do { \
+ (obj)->header.type = (obj_type);\
+ (obj)->header.impl_flags = (obj_flags);\
+ (obj)->header.flags = 0;\
+ (obj)->header.domain = (obj_domain);\
+ (obj)->u.b.head = NULL;\
+ (obj)->u.b.curr = NULL;\
+ (obj)->u.b.tail = NULL;\
+} while (0)
+
+#define GRN_OBJ_FIN(ctx,obj) (grn_obj_close((ctx), (obj)))
+
+typedef struct _grn_db_create_optarg grn_db_create_optarg;
+
+struct _grn_db_create_optarg {
+ char **builtin_type_names;
+ int n_builtin_type_names;
+};
+
+GRN_API grn_obj *grn_db_create(grn_ctx *ctx, const char *path, grn_db_create_optarg *optarg);
+
+#define GRN_DB_OPEN_OR_CREATE(ctx,path,optarg,db) \
+ (((db) = grn_db_open((ctx), (path))) || (db = grn_db_create((ctx), (path), (optarg))))
+
+GRN_API grn_obj *grn_db_open(grn_ctx *ctx, const char *path);
+GRN_API void grn_db_touch(grn_ctx *ctx, grn_obj *db);
+GRN_API grn_rc grn_db_recover(grn_ctx *ctx, grn_obj *db);
+
+GRN_API grn_rc grn_ctx_use(grn_ctx *ctx, grn_obj *db);
+GRN_API grn_obj *grn_ctx_db(grn_ctx *ctx);
+GRN_API grn_obj *grn_ctx_get(grn_ctx *ctx, const char *name, int name_size);
+GRN_API grn_rc grn_ctx_get_all_tables(grn_ctx *ctx, grn_obj *tables_buffer);
+
+typedef enum {
+ GRN_DB_VOID = 0,
+ GRN_DB_DB,
+ GRN_DB_OBJECT,
+ GRN_DB_BOOL,
+ GRN_DB_INT8,
+ GRN_DB_UINT8,
+ GRN_DB_INT16,
+ GRN_DB_UINT16,
+ GRN_DB_INT32,
+ GRN_DB_UINT32,
+ GRN_DB_INT64,
+ GRN_DB_UINT64,
+ GRN_DB_FLOAT,
+ GRN_DB_TIME,
+ GRN_DB_SHORT_TEXT,
+ GRN_DB_TEXT,
+ GRN_DB_LONG_TEXT,
+ GRN_DB_TOKYO_GEO_POINT,
+ GRN_DB_WGS84_GEO_POINT
+} grn_builtin_type;
+
+typedef enum {
+ GRN_DB_MECAB = 64,
+ GRN_DB_DELIMIT,
+ GRN_DB_UNIGRAM,
+ GRN_DB_BIGRAM,
+ GRN_DB_TRIGRAM
+} grn_builtin_tokenizer;
+
+GRN_API grn_obj *grn_ctx_at(grn_ctx *ctx, grn_id id);
+
+GRN_API grn_obj *grn_type_create(grn_ctx *ctx, const char *name, unsigned int name_size,
+ grn_obj_flags flags, unsigned int size);
+
+GRN_API grn_rc grn_plugin_register(grn_ctx *ctx, const char *name);
+GRN_API grn_rc grn_plugin_unregister(grn_ctx *ctx, const char *name);
+GRN_API grn_rc grn_plugin_register_by_path(grn_ctx *ctx, const char *path);
+GRN_API grn_rc grn_plugin_unregister_by_path(grn_ctx *ctx, const char *path);
+GRN_API const char *grn_plugin_get_system_plugins_dir(void);
+GRN_API const char *grn_plugin_get_suffix(void);
+GRN_API const char *grn_plugin_get_ruby_suffix(void);
+
+typedef struct {
+ const char *name;
+ unsigned int name_size;
+ grn_obj value;
+} grn_expr_var;
+
+typedef grn_rc (*grn_plugin_func)(grn_ctx *ctx);
+
+typedef enum {
+ GRN_PROC_INVALID = 0,
+ GRN_PROC_TOKENIZER,
+ GRN_PROC_COMMAND,
+ GRN_PROC_FUNCTION,
+ GRN_PROC_HOOK,
+ GRN_PROC_NORMALIZER,
+ GRN_PROC_TOKEN_FILTER,
+ GRN_PROC_SCORER
+} grn_proc_type;
+
+GRN_API grn_obj *grn_proc_create(grn_ctx *ctx,
+ const char *name, int name_size, grn_proc_type type,
+ grn_proc_func *init, grn_proc_func *next, grn_proc_func *fin,
+ unsigned int nvars, grn_expr_var *vars);
+GRN_API grn_obj *grn_proc_get_info(grn_ctx *ctx, grn_user_data *user_data,
+ grn_expr_var **vars, unsigned int *nvars, grn_obj **caller);
+GRN_API grn_proc_type grn_proc_get_type(grn_ctx *ctx, grn_obj *proc);
+
+/*-------------------------------------------------------------
+ * API for table
+ */
+
+#define GRN_TABLE_MAX_KEY_SIZE (0x1000)
+
+GRN_API grn_obj *grn_table_create(grn_ctx *ctx,
+ const char *name, unsigned int name_size,
+ const char *path, grn_obj_flags flags,
+ grn_obj *key_type, grn_obj *value_type);
+
+#define GRN_TABLE_OPEN_OR_CREATE(ctx,name,name_size,path,flags,key_type,value_type,table) \
+ (((table) = grn_ctx_get((ctx), (name), (name_size))) ||\
+ ((table) = grn_table_create((ctx), (name), (name_size), (path), (flags), (key_type), (value_type))))
+
+/* TODO: int *added -> grn_bool *added */
+GRN_API grn_id grn_table_add(grn_ctx *ctx, grn_obj *table,
+ const void *key, unsigned int key_size, int *added);
+GRN_API grn_id grn_table_get(grn_ctx *ctx, grn_obj *table,
+ const void *key, unsigned int key_size);
+GRN_API grn_id grn_table_at(grn_ctx *ctx, grn_obj *table, grn_id id);
+GRN_API grn_id grn_table_lcp_search(grn_ctx *ctx, grn_obj *table,
+ const void *key, unsigned int key_size);
+GRN_API int grn_table_get_key(grn_ctx *ctx, grn_obj *table,
+ grn_id id, void *keybuf, int buf_size);
+GRN_API grn_rc grn_table_delete(grn_ctx *ctx, grn_obj *table,
+ const void *key, unsigned int key_size);
+GRN_API grn_rc grn_table_delete_by_id(grn_ctx *ctx, grn_obj *table, grn_id id);
+GRN_API grn_rc grn_table_update_by_id(grn_ctx *ctx, grn_obj *table, grn_id id,
+ const void *dest_key, unsigned int dest_key_size);
+GRN_API grn_rc grn_table_update(grn_ctx *ctx, grn_obj *table,
+ const void *src_key, unsigned int src_key_size,
+ const void *dest_key, unsigned int dest_key_size);
+GRN_API grn_rc grn_table_truncate(grn_ctx *ctx, grn_obj *table);
+
+typedef grn_obj grn_table_cursor;
+
+#define GRN_CURSOR_ASCENDING (0x00<<0)
+#define GRN_CURSOR_DESCENDING (0x01<<0)
+#define GRN_CURSOR_GE (0x00<<1)
+#define GRN_CURSOR_GT (0x01<<1)
+#define GRN_CURSOR_LE (0x00<<2)
+#define GRN_CURSOR_LT (0x01<<2)
+#define GRN_CURSOR_BY_KEY (0x00<<3)
+#define GRN_CURSOR_BY_ID (0x01<<3)
+#define GRN_CURSOR_PREFIX (0x01<<4)
+#define GRN_CURSOR_SIZE_BY_BIT (0x01<<5)
+#define GRN_CURSOR_RK (0x01<<6)
+
+GRN_API grn_table_cursor *grn_table_cursor_open(grn_ctx *ctx, grn_obj *table,
+ const void *min, unsigned int min_size,
+ const void *max, unsigned int max_size,
+ int offset, int limit, int flags);
+GRN_API grn_rc grn_table_cursor_close(grn_ctx *ctx, grn_table_cursor *tc);
+GRN_API grn_id grn_table_cursor_next(grn_ctx *ctx, grn_table_cursor *tc);
+GRN_API int grn_table_cursor_get_key(grn_ctx *ctx, grn_table_cursor *tc, void **key);
+GRN_API int grn_table_cursor_get_value(grn_ctx *ctx, grn_table_cursor *tc, void **value);
+GRN_API grn_rc grn_table_cursor_set_value(grn_ctx *ctx, grn_table_cursor *tc,
+ const void *value, int flags);
+GRN_API grn_rc grn_table_cursor_delete(grn_ctx *ctx, grn_table_cursor *tc);
+GRN_API grn_obj *grn_table_cursor_table(grn_ctx *ctx, grn_table_cursor *tc);
+
+typedef struct {
+ grn_id rid;
+ grn_id sid;
+ unsigned int pos;
+ unsigned int tf;
+ unsigned int weight;
+ unsigned int rest;
+} grn_posting;
+
+GRN_API grn_obj *grn_index_cursor_open(grn_ctx *ctx, grn_table_cursor *tc, grn_obj *index,
+ grn_id rid_min, grn_id rid_max, int flags);
+GRN_API grn_posting *grn_index_cursor_next(grn_ctx *ctx, grn_obj *ic, grn_id *tid);
+
+#define GRN_TABLE_EACH(ctx,table,head,tail,id,key,key_size,value,block) do {\
+ (ctx)->errlvl = GRN_LOG_NOTICE;\
+ (ctx)->rc = GRN_SUCCESS;\
+ if ((ctx)->seqno & 1) {\
+ (ctx)->subno++;\
+ } else {\
+ (ctx)->seqno++;\
+ }\
+ if (table) {\
+ switch ((table)->header.type) {\
+ case GRN_TABLE_PAT_KEY :\
+ GRN_PAT_EACH((ctx), (grn_pat *)(table), (id), (key), (key_size), (value), block);\
+ break;\
+ case GRN_TABLE_DAT_KEY :\
+ GRN_DAT_EACH((ctx), (grn_dat *)(table), (id), (key), (key_size), block);\
+ break;\
+ case GRN_TABLE_HASH_KEY :\
+ GRN_HASH_EACH((ctx), (grn_hash *)(table), (id), (key), (key_size), (value), block);\
+ break;\
+ case GRN_TABLE_NO_KEY :\
+ GRN_ARRAY_EACH((ctx), (grn_array *)(table), (head), (tail), (id), (value), block);\
+ break;\
+ }\
+ }\
+ if ((ctx)->subno) {\
+ (ctx)->subno--;\
+ } else {\
+ (ctx)->seqno++;\
+ }\
+} while (0)
+
+typedef struct _grn_table_sort_key grn_table_sort_key;
+typedef unsigned char grn_table_sort_flags;
+
+#define GRN_TABLE_SORT_ASC (0x00<<0)
+#define GRN_TABLE_SORT_DESC (0x01<<0)
+
+struct _grn_table_sort_key {
+ grn_obj *key;
+ grn_table_sort_flags flags;
+ int offset;
+};
+
+GRN_API int grn_table_sort(grn_ctx *ctx, grn_obj *table, int offset, int limit,
+ grn_obj *result, grn_table_sort_key *keys, int n_keys);
+
+typedef struct _grn_table_group_result grn_table_group_result;
+typedef unsigned int grn_table_group_flags;
+
+#define GRN_TABLE_GROUP_CALC_COUNT (0x01<<3)
+#define GRN_TABLE_GROUP_CALC_MAX (0x01<<4)
+#define GRN_TABLE_GROUP_CALC_MIN (0x01<<5)
+#define GRN_TABLE_GROUP_CALC_SUM (0x01<<6)
+#define GRN_TABLE_GROUP_CALC_AVG (0x01<<7)
+
+typedef enum {
+ GRN_OP_PUSH = 0,
+ GRN_OP_POP,
+ GRN_OP_NOP,
+ GRN_OP_CALL,
+ GRN_OP_INTERN,
+ GRN_OP_GET_REF,
+ GRN_OP_GET_VALUE,
+ GRN_OP_AND,
+ GRN_OP_AND_NOT,
+ /* Deprecated. Just for backward compatibility. */
+#define GRN_OP_BUT GRN_OP_AND_NOT
+ GRN_OP_OR,
+ GRN_OP_ASSIGN,
+ GRN_OP_STAR_ASSIGN,
+ GRN_OP_SLASH_ASSIGN,
+ GRN_OP_MOD_ASSIGN,
+ GRN_OP_PLUS_ASSIGN,
+ GRN_OP_MINUS_ASSIGN,
+ GRN_OP_SHIFTL_ASSIGN,
+ GRN_OP_SHIFTR_ASSIGN,
+ GRN_OP_SHIFTRR_ASSIGN,
+ GRN_OP_AND_ASSIGN,
+ GRN_OP_XOR_ASSIGN,
+ GRN_OP_OR_ASSIGN,
+ GRN_OP_JUMP,
+ GRN_OP_CJUMP,
+ GRN_OP_COMMA,
+ GRN_OP_BITWISE_OR,
+ GRN_OP_BITWISE_XOR,
+ GRN_OP_BITWISE_AND,
+ GRN_OP_BITWISE_NOT,
+ GRN_OP_EQUAL,
+ GRN_OP_NOT_EQUAL,
+ GRN_OP_LESS,
+ GRN_OP_GREATER,
+ GRN_OP_LESS_EQUAL,
+ GRN_OP_GREATER_EQUAL,
+ GRN_OP_IN,
+ GRN_OP_MATCH,
+ GRN_OP_NEAR,
+ GRN_OP_NEAR2,
+ GRN_OP_SIMILAR,
+ GRN_OP_TERM_EXTRACT,
+ GRN_OP_SHIFTL,
+ GRN_OP_SHIFTR,
+ GRN_OP_SHIFTRR,
+ GRN_OP_PLUS,
+ GRN_OP_MINUS,
+ GRN_OP_STAR,
+ GRN_OP_SLASH,
+ GRN_OP_MOD,
+ GRN_OP_DELETE,
+ GRN_OP_INCR,
+ GRN_OP_DECR,
+ GRN_OP_INCR_POST,
+ GRN_OP_DECR_POST,
+ GRN_OP_NOT,
+ GRN_OP_ADJUST,
+ GRN_OP_EXACT,
+ GRN_OP_LCP,
+ GRN_OP_PARTIAL,
+ GRN_OP_UNSPLIT,
+ GRN_OP_PREFIX,
+ GRN_OP_SUFFIX,
+ GRN_OP_GEO_DISTANCE1,
+ GRN_OP_GEO_DISTANCE2,
+ GRN_OP_GEO_DISTANCE3,
+ GRN_OP_GEO_DISTANCE4,
+ GRN_OP_GEO_WITHINP5,
+ GRN_OP_GEO_WITHINP6,
+ GRN_OP_GEO_WITHINP8,
+ GRN_OP_OBJ_SEARCH,
+ GRN_OP_EXPR_GET_VAR,
+ GRN_OP_TABLE_CREATE,
+ GRN_OP_TABLE_SELECT,
+ GRN_OP_TABLE_SORT,
+ GRN_OP_TABLE_GROUP,
+ GRN_OP_JSON_PUT,
+ GRN_OP_GET_MEMBER,
+ GRN_OP_REGEXP
+} grn_operator;
+
+GRN_API const char *grn_operator_to_string(grn_operator op);
+GRN_API grn_bool grn_operator_exec_equal(grn_ctx *ctx, grn_obj *x, grn_obj *y);
+GRN_API grn_bool grn_operator_exec_not_equal(grn_ctx *ctx,
+ grn_obj *x, grn_obj *y);
+GRN_API grn_bool grn_operator_exec_less(grn_ctx *ctx, grn_obj *x, grn_obj *y);
+GRN_API grn_bool grn_operator_exec_greater(grn_ctx *ctx, grn_obj *x, grn_obj *y);
+GRN_API grn_bool grn_operator_exec_less_equal(grn_ctx *ctx,
+ grn_obj *x, grn_obj *y);
+GRN_API grn_bool grn_operator_exec_greater_equal(grn_ctx *ctx,
+ grn_obj *x, grn_obj *y);
+GRN_API grn_bool grn_operator_exec_match(grn_ctx *ctx,
+ grn_obj *target, grn_obj *sub_text);
+GRN_API grn_bool grn_operator_exec_prefix(grn_ctx *ctx,
+ grn_obj *target, grn_obj *prefix);
+GRN_API grn_bool grn_operator_exec_regexp(grn_ctx *ctx,
+ grn_obj *target, grn_obj *pattern);
+
+struct _grn_table_group_result {
+ grn_obj *table;
+ unsigned char key_begin;
+ unsigned char key_end;
+ int limit;
+ grn_table_group_flags flags;
+ grn_operator op;
+ unsigned int max_n_subrecs;
+ grn_obj *calc_target;
+};
+
+GRN_API grn_rc grn_table_group(grn_ctx *ctx, grn_obj *table,
+ grn_table_sort_key *keys, int n_keys,
+ grn_table_group_result *results, int n_results);
+GRN_API grn_rc grn_table_setoperation(grn_ctx *ctx, grn_obj *table1, grn_obj *table2,
+ grn_obj *res, grn_operator op);
+GRN_API grn_rc grn_table_difference(grn_ctx *ctx, grn_obj *table1, grn_obj *table2,
+ grn_obj *res1, grn_obj *res2);
+GRN_API int grn_table_columns(grn_ctx *ctx, grn_obj *table,
+ const char *name, unsigned int name_size,
+ grn_obj *res);
+
+GRN_API grn_obj *grn_obj_column(grn_ctx *ctx, grn_obj *table,
+ const char *name, unsigned int name_size);
+
+GRN_API unsigned int grn_table_size(grn_ctx *ctx, grn_obj *table);
+
+/*-------------------------------------------------------------
+ * API for column
+ */
+
+#define GRN_COLUMN_NAME_ID "_id"
+#define GRN_COLUMN_NAME_ID_LEN (sizeof(GRN_COLUMN_NAME_ID) - 1)
+#define GRN_COLUMN_NAME_KEY "_key"
+#define GRN_COLUMN_NAME_KEY_LEN (sizeof(GRN_COLUMN_NAME_KEY) - 1)
+#define GRN_COLUMN_NAME_VALUE "_value"
+#define GRN_COLUMN_NAME_VALUE_LEN (sizeof(GRN_COLUMN_NAME_VALUE) - 1)
+#define GRN_COLUMN_NAME_SCORE "_score"
+#define GRN_COLUMN_NAME_SCORE_LEN (sizeof(GRN_COLUMN_NAME_SCORE) - 1)
+#define GRN_COLUMN_NAME_NSUBRECS "_nsubrecs"
+#define GRN_COLUMN_NAME_NSUBRECS_LEN (sizeof(GRN_COLUMN_NAME_NSUBRECS) - 1)
+#define GRN_COLUMN_NAME_MAX "_max"
+#define GRN_COLUMN_NAME_MAX_LEN (sizeof(GRN_COLUMN_NAME_MAX) - 1)
+#define GRN_COLUMN_NAME_MIN "_min"
+#define GRN_COLUMN_NAME_MIN_LEN (sizeof(GRN_COLUMN_NAME_MIN) - 1)
+#define GRN_COLUMN_NAME_SUM "_sum"
+#define GRN_COLUMN_NAME_SUM_LEN (sizeof(GRN_COLUMN_NAME_SUM) - 1)
+#define GRN_COLUMN_NAME_AVG "_avg"
+#define GRN_COLUMN_NAME_AVG_LEN (sizeof(GRN_COLUMN_NAME_AVG) - 1)
+
+GRN_API grn_obj *grn_column_create(grn_ctx *ctx, grn_obj *table,
+ const char *name, unsigned int name_size,
+ const char *path, grn_obj_flags flags, grn_obj *type);
+
+#define GRN_COLUMN_OPEN_OR_CREATE(ctx,table,name,name_size,path,flags,type,column) \
+ (((column) = grn_obj_column((ctx), (table), (name), (name_size))) ||\
+ ((column) = grn_column_create((ctx), (table), (name), (name_size), (path), (flags), (type))))
+
+GRN_API grn_rc grn_column_index_update(grn_ctx *ctx, grn_obj *column,
+ grn_id id, unsigned int section,
+ grn_obj *oldvalue, grn_obj *newvalue);
+GRN_API grn_obj *grn_column_table(grn_ctx *ctx, grn_obj *column);
+GRN_API grn_rc grn_column_truncate(grn_ctx *ctx, grn_obj *column);
+
+/*-------------------------------------------------------------
+ * API for db, table and/or column
+ */
+
+typedef enum {
+ GRN_INFO_ENCODING = 0,
+ GRN_INFO_SOURCE,
+ GRN_INFO_DEFAULT_TOKENIZER,
+ GRN_INFO_ELEMENT_SIZE,
+ GRN_INFO_CURR_MAX,
+ GRN_INFO_MAX_ELEMENT_SIZE,
+ GRN_INFO_SEG_SIZE,
+ GRN_INFO_CHUNK_SIZE,
+ GRN_INFO_MAX_SECTION,
+ GRN_INFO_HOOK_LOCAL_DATA,
+ GRN_INFO_ELEMENT_A,
+ GRN_INFO_ELEMENT_CHUNK,
+ GRN_INFO_ELEMENT_CHUNK_SIZE,
+ GRN_INFO_ELEMENT_BUFFER_FREE,
+ GRN_INFO_ELEMENT_NTERMS,
+ GRN_INFO_ELEMENT_NTERMS_VOID,
+ GRN_INFO_ELEMENT_SIZE_IN_CHUNK,
+ GRN_INFO_ELEMENT_POS_IN_CHUNK,
+ GRN_INFO_ELEMENT_SIZE_IN_BUFFER,
+ GRN_INFO_ELEMENT_POS_IN_BUFFER,
+ GRN_INFO_ELEMENT_ESTIMATE_SIZE,
+ GRN_INFO_NGRAM_UNIT_SIZE,
+ /*
+ GRN_INFO_VERSION,
+ GRN_INFO_CONFIGURE_OPTIONS,
+ GRN_INFO_CONFIG_PATH,
+ */
+ GRN_INFO_PARTIAL_MATCH_THRESHOLD,
+ GRN_INFO_II_SPLIT_THRESHOLD,
+ GRN_INFO_SUPPORT_ZLIB,
+ GRN_INFO_SUPPORT_LZ4,
+/* Just for backward compatibility. We'll remove it at 5.0.0. */
+#define GRN_INFO_SUPPORT_LZO GRN_INFO_SUPPORT_LZ4
+ GRN_INFO_NORMALIZER,
+ GRN_INFO_TOKEN_FILTERS
+} grn_info_type;
+
+GRN_API grn_obj *grn_obj_get_info(grn_ctx *ctx, grn_obj *obj, grn_info_type type, grn_obj *valuebuf);
+GRN_API grn_rc grn_obj_set_info(grn_ctx *ctx, grn_obj *obj, grn_info_type type, grn_obj *value);
+GRN_API grn_obj *grn_obj_get_element_info(grn_ctx *ctx, grn_obj *obj, grn_id id,
+ grn_info_type type, grn_obj *value);
+GRN_API grn_rc grn_obj_set_element_info(grn_ctx *ctx, grn_obj *obj, grn_id id,
+ grn_info_type type, grn_obj *value);
+
+GRN_API grn_obj *grn_obj_get_value(grn_ctx *ctx, grn_obj *obj, grn_id id, grn_obj *value);
+GRN_API int grn_obj_get_values(grn_ctx *ctx, grn_obj *obj, grn_id offset, void **values);
+
+#define GRN_COLUMN_EACH(ctx,column,id,value,block) do {\
+ int _n;\
+ grn_id id = 1;\
+ while ((_n = grn_obj_get_values(ctx, column, id, (void **)&value)) > 0) {\
+ for (; _n; _n--, id++, value++) {\
+ block\
+ }\
+ }\
+} while (0)
+
+#define GRN_OBJ_SET_MASK (0x07)
+#define GRN_OBJ_SET (0x01)
+#define GRN_OBJ_INCR (0x02)
+#define GRN_OBJ_DECR (0x03)
+#define GRN_OBJ_APPEND (0x04)
+#define GRN_OBJ_PREPEND (0x05)
+#define GRN_OBJ_GET (0x01<<4)
+#define GRN_OBJ_COMPARE (0x01<<5)
+#define GRN_OBJ_LOCK (0x01<<6)
+#define GRN_OBJ_UNLOCK (0x01<<7)
+
+GRN_API grn_rc grn_obj_set_value(grn_ctx *ctx, grn_obj *obj, grn_id id, grn_obj *value, int flags);
+GRN_API grn_rc grn_obj_remove(grn_ctx *ctx, grn_obj *obj);
+GRN_API grn_rc grn_obj_rename(grn_ctx *ctx, grn_obj *obj,
+ const char *name, unsigned int name_size);
+GRN_API grn_rc grn_table_rename(grn_ctx *ctx, grn_obj *table,
+ const char *name, unsigned int name_size);
+
+GRN_API grn_rc grn_column_rename(grn_ctx *ctx, grn_obj *column,
+ const char *name, unsigned int name_size);
+
+GRN_API grn_rc grn_obj_close(grn_ctx *ctx, grn_obj *obj);
+GRN_API grn_rc grn_obj_reinit(grn_ctx *ctx, grn_obj *obj, grn_id domain, unsigned char flags);
+GRN_API void grn_obj_unlink(grn_ctx *ctx, grn_obj *obj);
+
+GRN_API grn_user_data *grn_obj_user_data(grn_ctx *ctx, grn_obj *obj);
+
+GRN_API grn_rc grn_obj_set_finalizer(grn_ctx *ctx, grn_obj *obj, grn_proc_func *func);
+
+GRN_API const char *grn_obj_path(grn_ctx *ctx, grn_obj *obj);
+GRN_API int grn_obj_name(grn_ctx *ctx, grn_obj *obj, char *namebuf, int buf_size);
+
+GRN_API int grn_column_name(grn_ctx *ctx, grn_obj *obj, char *namebuf, int buf_size);
+
+GRN_API grn_id grn_obj_get_range(grn_ctx *ctx, grn_obj *obj);
+
+#define GRN_OBJ_GET_DOMAIN(obj) \
+ ((obj)->header.type == GRN_TABLE_NO_KEY ? GRN_ID_NIL : (obj)->header.domain)
+
+GRN_API int grn_obj_expire(grn_ctx *ctx, grn_obj *obj, int threshold);
+GRN_API int grn_obj_check(grn_ctx *ctx, grn_obj *obj);
+GRN_API grn_rc grn_obj_lock(grn_ctx *ctx, grn_obj *obj, grn_id id, int timeout);
+GRN_API grn_rc grn_obj_unlock(grn_ctx *ctx, grn_obj *obj, grn_id id);
+GRN_API grn_rc grn_obj_clear_lock(grn_ctx *ctx, grn_obj *obj);
+GRN_API unsigned int grn_obj_is_locked(grn_ctx *ctx, grn_obj *obj);
+GRN_API int grn_obj_defrag(grn_ctx *ctx, grn_obj *obj, int threshold);
+
+GRN_API grn_obj *grn_obj_db(grn_ctx *ctx, grn_obj *obj);
+
+GRN_API grn_id grn_obj_id(grn_ctx *ctx, grn_obj *obj);
+
+typedef struct _grn_search_optarg grn_search_optarg;
+
+struct _grn_search_optarg {
+ grn_operator mode;
+ int similarity_threshold;
+ int max_interval;
+ int *weight_vector;
+ int vector_size;
+ grn_obj *proc;
+ int max_size;
+ grn_obj *scorer;
+ grn_obj *scorer_args_expr;
+ unsigned int scorer_args_expr_offset;
+};
+
+GRN_API grn_rc grn_obj_search(grn_ctx *ctx, grn_obj *obj, grn_obj *query,
+ grn_obj *res, grn_operator op, grn_search_optarg *optarg);
+
+typedef grn_rc grn_selector_func(grn_ctx *ctx, grn_obj *table, grn_obj *index,
+ int nargs, grn_obj **args,
+ grn_obj *res, grn_operator op);
+
+GRN_API grn_rc grn_proc_set_selector(grn_ctx *ctx, grn_obj *proc,
+ grn_selector_func selector);
+
+/*-------------------------------------------------------------
+ * grn_vector
+*/
+
+GRN_API unsigned int grn_vector_size(grn_ctx *ctx, grn_obj *vector);
+
+GRN_API grn_rc grn_vector_add_element(grn_ctx *ctx, grn_obj *vector,
+ const char *str, unsigned int str_len,
+ unsigned int weight, grn_id domain);
+
+GRN_API unsigned int grn_vector_get_element(grn_ctx *ctx, grn_obj *vector,
+ unsigned int offset, const char **str,
+ unsigned int *weight, grn_id *domain);
+
+/*-------------------------------------------------------------
+ * grn_uvector
+*/
+
+GRN_API unsigned int grn_uvector_size(grn_ctx *ctx, grn_obj *uvector);
+GRN_API unsigned int grn_uvector_element_size(grn_ctx *ctx, grn_obj *uvector);
+
+GRN_API grn_rc grn_uvector_add_element(grn_ctx *ctx, grn_obj *vector,
+ grn_id id, unsigned int weight);
+
+GRN_API grn_id grn_uvector_get_element(grn_ctx *ctx, grn_obj *uvector,
+ unsigned int offset,
+ unsigned int *weight);
+
+/*-------------------------------------------------------------
+ * API for hook
+ */
+
+GRN_API int grn_proc_call_next(grn_ctx *ctx, grn_obj *exec_info, grn_obj *in, grn_obj *out);
+GRN_API void *grn_proc_get_ctx_local_data(grn_ctx *ctx, grn_obj *exec_info);
+GRN_API void *grn_proc_get_hook_local_data(grn_ctx *ctx, grn_obj *exec_info);
+
+typedef enum {
+ GRN_HOOK_SET = 0,
+ GRN_HOOK_GET,
+ GRN_HOOK_INSERT,
+ GRN_HOOK_DELETE,
+ GRN_HOOK_SELECT
+} grn_hook_entry;
+
+GRN_API grn_rc grn_obj_add_hook(grn_ctx *ctx, grn_obj *obj, grn_hook_entry entry,
+ int offset, grn_obj *proc, grn_obj *data);
+GRN_API int grn_obj_get_nhooks(grn_ctx *ctx, grn_obj *obj, grn_hook_entry entry);
+GRN_API grn_obj *grn_obj_get_hook(grn_ctx *ctx, grn_obj *obj, grn_hook_entry entry,
+ int offset, grn_obj *data);
+GRN_API grn_rc grn_obj_delete_hook(grn_ctx *ctx, grn_obj *obj, grn_hook_entry entry, int offset);
+
+GRN_API grn_obj *grn_obj_open(grn_ctx *ctx, unsigned char type, grn_obj_flags flags, grn_id domain);
+
+/* Deprecated since 5.0.1. Use grn_column_find_index_data() instead. */
+GRN_API int grn_column_index(grn_ctx *ctx, grn_obj *column, grn_operator op,
+ grn_obj **indexbuf, int buf_size, int *section);
+
+/* @since 5.0.1. */
+typedef struct _grn_index_datum {
+ grn_obj *index;
+ unsigned int section;
+} grn_index_datum;
+
+/* @since 5.0.1. */
+GRN_API unsigned int grn_column_find_index_data(grn_ctx *ctx, grn_obj *column,
+ grn_operator op,
+ grn_index_datum *index_data,
+ unsigned int n_index_data);
+
+GRN_API grn_rc grn_obj_delete_by_id(grn_ctx *ctx, grn_obj *db, grn_id id, grn_bool removep);
+GRN_API grn_rc grn_obj_path_by_id(grn_ctx *ctx, grn_obj *db, grn_id id, char *buffer);
+
+/* geo */
+
+typedef struct {
+ int latitude;
+ int longitude;
+} grn_geo_point;
+
+GRN_API grn_rc grn_geo_select_in_rectangle(grn_ctx *ctx,
+ grn_obj *index,
+ grn_obj *top_left_point,
+ grn_obj *bottom_right_point,
+ grn_obj *res,
+ grn_operator op);
+GRN_API unsigned int grn_geo_estimate_size_in_rectangle(grn_ctx *ctx,
+ grn_obj *index,
+ grn_obj *top_left_point,
+ grn_obj *bottom_right_point);
+/* Deprecated since 4.0.8. Use grn_geo_estimate_size_in_rectangle() instead. */
+GRN_API int grn_geo_estimate_in_rectangle(grn_ctx *ctx,
+ grn_obj *index,
+ grn_obj *top_left_point,
+ grn_obj *bottom_right_point);
+GRN_API grn_obj *grn_geo_cursor_open_in_rectangle(grn_ctx *ctx,
+ grn_obj *index,
+ grn_obj *top_left_point,
+ grn_obj *bottom_right_point,
+ int offset,
+ int limit);
+GRN_API grn_posting *grn_geo_cursor_next(grn_ctx *ctx, grn_obj *cursor);
+
+
+/* query & snippet */
+
+#ifndef GRN_QUERY_AND
+#define GRN_QUERY_AND '+'
+#endif /* GRN_QUERY_AND */
+#ifndef GRN_QUERY_AND_NOT
+# ifdef GRN_QUERY_BUT
+ /* Deprecated. Just for backward compatibility. */
+# define GRN_QUERY_AND_NOT GRN_QUERY_BUT
+# else
+# define GRN_QUERY_AND_NOT '-'
+# endif /* GRN_QUERY_BUT */
+#endif /* GRN_QUERY_AND_NOT */
+#ifndef GRN_QUERY_ADJ_INC
+#define GRN_QUERY_ADJ_INC '>'
+#endif /* GRN_QUERY_ADJ_POS2 */
+#ifndef GRN_QUERY_ADJ_DEC
+#define GRN_QUERY_ADJ_DEC '<'
+#endif /* GRN_QUERY_ADJ_POS1 */
+#ifndef GRN_QUERY_ADJ_NEG
+#define GRN_QUERY_ADJ_NEG '~'
+#endif /* GRN_QUERY_ADJ_NEG */
+#ifndef GRN_QUERY_PREFIX
+#define GRN_QUERY_PREFIX '*'
+#endif /* GRN_QUERY_PREFIX */
+#ifndef GRN_QUERY_PARENL
+#define GRN_QUERY_PARENL '('
+#endif /* GRN_QUERY_PARENL */
+#ifndef GRN_QUERY_PARENR
+#define GRN_QUERY_PARENR ')'
+#endif /* GRN_QUERY_PARENR */
+#ifndef GRN_QUERY_QUOTEL
+#define GRN_QUERY_QUOTEL '"'
+#endif /* GRN_QUERY_QUOTEL */
+#ifndef GRN_QUERY_QUOTER
+#define GRN_QUERY_QUOTER '"'
+#endif /* GRN_QUERY_QUOTER */
+#ifndef GRN_QUERY_ESCAPE
+#define GRN_QUERY_ESCAPE '\\'
+#endif /* GRN_QUERY_ESCAPE */
+#ifndef GRN_QUERY_COLUMN
+#define GRN_QUERY_COLUMN ':'
+#endif /* GRN_QUERY_COLUMN */
+
+typedef struct _grn_snip_mapping grn_snip_mapping;
+
+struct _grn_snip_mapping {
+ void *dummy;
+};
+
+#define GRN_SNIP_NORMALIZE (0x01<<0)
+#define GRN_SNIP_COPY_TAG (0x01<<1)
+#define GRN_SNIP_SKIP_LEADING_SPACES (0x01<<2)
+
+#define GRN_SNIP_MAPPING_HTML_ESCAPE ((grn_snip_mapping *)-1)
+
+GRN_API grn_obj *grn_snip_open(grn_ctx *ctx, int flags, unsigned int width,
+ unsigned int max_results,
+ const char *defaultopentag, unsigned int defaultopentag_len,
+ const char *defaultclosetag, unsigned int defaultclosetag_len,
+ grn_snip_mapping *mapping);
+GRN_API grn_rc grn_snip_add_cond(grn_ctx *ctx, grn_obj *snip,
+ const char *keyword, unsigned int keyword_len,
+ const char *opentag, unsigned int opentag_len,
+ const char *closetag, unsigned int closetag_len);
+GRN_API grn_rc grn_snip_set_normalizer(grn_ctx *ctx, grn_obj *snip,
+ grn_obj *normalizer);
+GRN_API grn_obj *grn_snip_get_normalizer(grn_ctx *ctx, grn_obj *snip);
+GRN_API grn_rc grn_snip_exec(grn_ctx *ctx, grn_obj *snip,
+ const char *string, unsigned int string_len,
+ unsigned int *nresults, unsigned int *max_tagged_len);
+GRN_API grn_rc grn_snip_get_result(grn_ctx *ctx, grn_obj *snip, const unsigned int index,
+ char *result, unsigned int *result_len);
+
+/* log */
+
+#define GRN_LOG_TIME (0x01<<0)
+#define GRN_LOG_TITLE (0x01<<1)
+#define GRN_LOG_MESSAGE (0x01<<2)
+#define GRN_LOG_LOCATION (0x01<<3)
+
+/* Deprecated since 2.1.2. Use grn_logger instead. */
+typedef struct _grn_logger_info grn_logger_info;
+
+/* Deprecated since 2.1.2. Use grn_logger instead. */
+struct _grn_logger_info {
+ grn_log_level max_level;
+ int flags;
+ void (*func)(int, const char *, const char *, const char *, const char *, void *);
+ void *func_arg;
+};
+
+/* Deprecated since 2.1.2. Use grn_logger_set() instead. */
+GRN_API grn_rc grn_logger_info_set(grn_ctx *ctx, const grn_logger_info *info);
+
+typedef struct _grn_logger grn_logger;
+
+struct _grn_logger {
+ grn_log_level max_level;
+ int flags;
+ void *user_data;
+ void (*log)(grn_ctx *ctx, grn_log_level level,
+ const char *timestamp, const char *title, const char *message,
+ const char *location, void *user_data);
+ void (*reopen)(grn_ctx *ctx, void *user_data);
+ void (*fin)(grn_ctx *ctx, void *user_data);
+};
+
+GRN_API grn_rc grn_logger_set(grn_ctx *ctx, const grn_logger *logger);
+
+GRN_API void grn_logger_set_max_level(grn_ctx *ctx, grn_log_level max_level);
+GRN_API grn_log_level grn_logger_get_max_level(grn_ctx *ctx);
+
+#ifdef __GNUC__
+# define GRN_ATTRIBUTE_PRINTF(fmt_pos) \
+ __attribute__ ((format(printf, fmt_pos, fmt_pos + 1)))
+#else
+# define GRN_ATTRIBUTE_PRINTF(fmt_pos)
+#endif /* __GNUC__ */
+
+GRN_API void grn_logger_put(grn_ctx *ctx, grn_log_level level,
+ const char *file, int line, const char *func, const char *fmt, ...) GRN_ATTRIBUTE_PRINTF(6);
+GRN_API void grn_logger_reopen(grn_ctx *ctx);
+
+GRN_API grn_bool grn_logger_pass(grn_ctx *ctx, grn_log_level level);
+
+#ifndef GRN_LOG_DEFAULT_LEVEL
+# define GRN_LOG_DEFAULT_LEVEL GRN_LOG_NOTICE
+#endif /* GRN_LOG_DEFAULT_LEVEL */
+
+GRN_API void grn_default_logger_set_max_level(grn_log_level level);
+GRN_API grn_log_level grn_default_logger_get_max_level(void);
+GRN_API void grn_default_logger_set_path(const char *path);
+GRN_API const char *grn_default_logger_get_path(void);
+GRN_API void grn_default_logger_set_rotate_threshold_size(off_t threshold);
+GRN_API off_t grn_default_logger_get_rotate_threshold_size(void);
+
+#define GRN_LOG(ctx,level,...) do {\
+ if (grn_logger_pass(ctx, level)) {\
+ grn_logger_put(ctx, (level), __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__); \
+ }\
+} while (0)
+
+typedef struct _grn_query_logger grn_query_logger;
+
+struct _grn_query_logger {
+ unsigned int flags;
+ void *user_data;
+ void (*log)(grn_ctx *ctx, unsigned int flag,
+ const char *timestamp, const char *info, const char *message,
+ void *user_data);
+ void (*reopen)(grn_ctx *ctx, void *user_data);
+ void (*fin)(grn_ctx *ctx, void *user_data);
+};
+
+GRN_API grn_rc grn_query_logger_set(grn_ctx *ctx, const grn_query_logger *logger);
+
+GRN_API void grn_query_logger_put(grn_ctx *ctx, unsigned int flag,
+ const char *mark,
+ const char *format, ...) GRN_ATTRIBUTE_PRINTF(4);
+GRN_API void grn_query_logger_reopen(grn_ctx *ctx);
+
+GRN_API grn_bool grn_query_logger_pass(grn_ctx *ctx, unsigned int flag);
+
+GRN_API void grn_default_query_logger_set_flags(unsigned int flags);
+GRN_API unsigned int grn_default_query_logger_get_flags(void);
+GRN_API void grn_default_query_logger_set_path(const char *path);
+GRN_API const char *grn_default_query_logger_get_path(void);
+GRN_API void grn_default_query_logger_set_rotate_threshold_size(off_t threshold);
+GRN_API off_t grn_default_query_logger_get_rotate_threshold_size(void);
+
+#define GRN_QUERY_LOG(ctx, flag, mark, format, ...) do {\
+ if (grn_query_logger_pass(ctx, flag)) {\
+ grn_query_logger_put(ctx, (flag), (mark), format, __VA_ARGS__);\
+ }\
+} while (0)
+
+/* grn_bulk */
+
+#define GRN_BULK_BUFSIZE (sizeof(grn_obj) - sizeof(grn_obj_header))
+/* This assumes that GRN_BULK_BUFSIZE is less than 32 (= 0x20). */
+#define GRN_BULK_BUFSIZE_MAX 0x1f
+#define GRN_BULK_SIZE_IN_FLAGS(flags) ((flags) & GRN_BULK_BUFSIZE_MAX)
+#define GRN_BULK_OUTP(bulk) ((bulk)->header.impl_flags & GRN_OBJ_OUTPLACE)
+#define GRN_BULK_REWIND(bulk) do {\
+ if ((bulk)->header.type == GRN_VECTOR) {\
+ grn_obj *_body = (bulk)->u.v.body;\
+ if (_body) {\
+ if (GRN_BULK_OUTP(_body)) {\
+ (_body)->u.b.curr = (_body)->u.b.head;\
+ } else {\
+ (_body)->header.flags &= ~GRN_BULK_BUFSIZE_MAX;\
+ }\
+ }\
+ (bulk)->u.v.n_sections = 0;\
+ } else {\
+ if (GRN_BULK_OUTP(bulk)) {\
+ (bulk)->u.b.curr = (bulk)->u.b.head;\
+ } else {\
+ (bulk)->header.flags &= ~GRN_BULK_BUFSIZE_MAX;\
+ }\
+ }\
+} while (0)
+#define GRN_BULK_WSIZE(bulk) \
+ (GRN_BULK_OUTP(bulk)\
+ ? ((bulk)->u.b.tail - (bulk)->u.b.head)\
+ : GRN_BULK_BUFSIZE)
+#define GRN_BULK_REST(bulk) \
+ (GRN_BULK_OUTP(bulk)\
+ ? ((bulk)->u.b.tail - (bulk)->u.b.curr)\
+ : GRN_BULK_BUFSIZE - GRN_BULK_SIZE_IN_FLAGS((bulk)->header.flags))
+#define GRN_BULK_VSIZE(bulk) \
+ (GRN_BULK_OUTP(bulk)\
+ ? ((bulk)->u.b.curr - (bulk)->u.b.head)\
+ : GRN_BULK_SIZE_IN_FLAGS((bulk)->header.flags))
+#define GRN_BULK_EMPTYP(bulk) \
+ (GRN_BULK_OUTP(bulk)\
+ ? ((bulk)->u.b.curr == (bulk)->u.b.head)\
+ : !(GRN_BULK_SIZE_IN_FLAGS((bulk)->header.flags)))
+#define GRN_BULK_HEAD(bulk) \
+ (GRN_BULK_OUTP(bulk)\
+ ? ((bulk)->u.b.head)\
+ : (char *)&((bulk)->u.b.head))
+#define GRN_BULK_CURR(bulk) \
+ (GRN_BULK_OUTP(bulk)\
+ ? ((bulk)->u.b.curr)\
+ : (char *)&((bulk)->u.b.head) + GRN_BULK_SIZE_IN_FLAGS((bulk)->header.flags))
+#define GRN_BULK_TAIL(bulk) \
+ (GRN_BULK_OUTP(bulk)\
+ ? ((bulk)->u.b.tail)\
+ : (char *)&((bulk)[1]))
+
+GRN_API grn_rc grn_bulk_reinit(grn_ctx *ctx, grn_obj *bulk, unsigned int size);
+GRN_API grn_rc grn_bulk_resize(grn_ctx *ctx, grn_obj *bulk, unsigned int newsize);
+GRN_API grn_rc grn_bulk_write(grn_ctx *ctx, grn_obj *bulk,
+ const char *str, unsigned int len);
+GRN_API grn_rc grn_bulk_write_from(grn_ctx *ctx, grn_obj *bulk,
+ const char *str, unsigned int from, unsigned int len);
+GRN_API grn_rc grn_bulk_reserve(grn_ctx *ctx, grn_obj *bulk, unsigned int len);
+GRN_API grn_rc grn_bulk_space(grn_ctx *ctx, grn_obj *bulk, unsigned int len);
+GRN_API grn_rc grn_bulk_truncate(grn_ctx *ctx, grn_obj *bulk, unsigned int len);
+GRN_API grn_rc grn_bulk_fin(grn_ctx *ctx, grn_obj *bulk);
+
+/* grn_text */
+
+GRN_API grn_rc grn_text_itoa(grn_ctx *ctx, grn_obj *bulk, int i);
+GRN_API grn_rc grn_text_itoa_padded(grn_ctx *ctx, grn_obj *bulk, int i, char ch, unsigned int len);
+GRN_API grn_rc grn_text_lltoa(grn_ctx *ctx, grn_obj *bulk, long long int i);
+GRN_API grn_rc grn_text_ftoa(grn_ctx *ctx, grn_obj *bulk, double d);
+GRN_API grn_rc grn_text_itoh(grn_ctx *ctx, grn_obj *bulk, int i, unsigned int len);
+GRN_API grn_rc grn_text_itob(grn_ctx *ctx, grn_obj *bulk, grn_id id);
+GRN_API grn_rc grn_text_lltob32h(grn_ctx *ctx, grn_obj *bulk, long long int i);
+GRN_API grn_rc grn_text_benc(grn_ctx *ctx, grn_obj *bulk, unsigned int v);
+GRN_API grn_rc grn_text_esc(grn_ctx *ctx, grn_obj *bulk, const char *s, unsigned int len);
+GRN_API grn_rc grn_text_urlenc(grn_ctx *ctx, grn_obj *buf,
+ const char *str, unsigned int len);
+GRN_API const char *grn_text_urldec(grn_ctx *ctx, grn_obj *buf,
+ const char *s, const char *e, char d);
+GRN_API grn_rc grn_text_escape_xml(grn_ctx *ctx, grn_obj *buf,
+ const char *s, unsigned int len);
+GRN_API grn_rc grn_text_time2rfc1123(grn_ctx *ctx, grn_obj *bulk, int sec);
+GRN_API grn_rc grn_text_printf(grn_ctx *ctx, grn_obj *bulk,
+ const char *format, ...) GRN_ATTRIBUTE_PRINTF(3);
+GRN_API grn_rc grn_text_vprintf(grn_ctx *ctx, grn_obj *bulk,
+ const char *format, va_list args);
+
+GRN_API void grn_ctx_recv_handler_set(grn_ctx *,
+ void (*func)(grn_ctx *, int, void *),
+ void *func_arg);
+
+/* various values exchanged via grn_obj */
+
+#define GRN_OBJ_DO_SHALLOW_COPY (GRN_OBJ_REFER|GRN_OBJ_OUTPLACE)
+#define GRN_OBJ_VECTOR (0x01<<7)
+
+#define GRN_OBJ_MUTABLE(obj) ((obj) && (obj)->header.type <= GRN_VECTOR)
+
+#define GRN_VALUE_FIX_SIZE_INIT(obj,flags,domain)\
+ GRN_OBJ_INIT((obj), ((flags) & GRN_OBJ_VECTOR) ? GRN_UVECTOR : GRN_BULK,\
+ ((flags) & GRN_OBJ_DO_SHALLOW_COPY), (domain))
+#define GRN_VALUE_VAR_SIZE_INIT(obj,flags,domain)\
+ GRN_OBJ_INIT((obj), ((flags) & GRN_OBJ_VECTOR) ? GRN_VECTOR : GRN_BULK,\
+ ((flags) & GRN_OBJ_DO_SHALLOW_COPY), (domain))
+
+#define GRN_VOID_INIT(obj) GRN_OBJ_INIT((obj), GRN_VOID, 0, GRN_DB_VOID)
+#define GRN_TEXT_INIT(obj,flags) \
+ GRN_VALUE_VAR_SIZE_INIT(obj, flags, GRN_DB_TEXT)
+#define GRN_SHORT_TEXT_INIT(obj,flags) \
+ GRN_VALUE_VAR_SIZE_INIT(obj, flags, GRN_DB_SHORT_TEXT)
+#define GRN_LONG_TEXT_INIT(obj,flags) \
+ GRN_VALUE_VAR_SIZE_INIT(obj, flags, GRN_DB_LONG_TEXT)
+#define GRN_TEXT_SET_REF(obj,str,len) do {\
+ (obj)->u.b.head = (char *)(str);\
+ (obj)->u.b.curr = (char *)(str) + (len);\
+} while (0)
+#define GRN_TEXT_SET(ctx,obj,str,len) do {\
+ if ((obj)->header.impl_flags & GRN_OBJ_REFER) {\
+ GRN_TEXT_SET_REF((obj), (str), (len));\
+ } else {\
+ grn_bulk_write_from((ctx), (obj), (const char *)(str), 0, (unsigned int)(len));\
+ }\
+} while (0)
+#define GRN_TEXT_PUT(ctx,obj,str,len) \
+ grn_bulk_write((ctx), (obj), (const char *)(str), (unsigned int)(len))
+#define GRN_TEXT_PUTC(ctx,obj,c) do {\
+ char _c = (c); grn_bulk_write((ctx), (obj), &_c, 1);\
+} while (0)
+
+#define GRN_TEXT_PUTS(ctx,obj,str) GRN_TEXT_PUT((ctx), (obj), (str), strlen(str))
+#define GRN_TEXT_SETS(ctx,obj,str) GRN_TEXT_SET((ctx), (obj), (str), strlen(str))
+#define GRN_TEXT_VALUE(obj) GRN_BULK_HEAD(obj)
+#define GRN_TEXT_LEN(obj) GRN_BULK_VSIZE(obj)
+
+#define GRN_BOOL_INIT(obj,flags) \
+ GRN_VALUE_FIX_SIZE_INIT(obj, flags, GRN_DB_BOOL)
+#define GRN_INT8_INIT(obj,flags) \
+ GRN_VALUE_FIX_SIZE_INIT(obj, flags, GRN_DB_INT8)
+#define GRN_UINT8_INIT(obj,flags) \
+ GRN_VALUE_FIX_SIZE_INIT(obj, flags, GRN_DB_UINT8)
+#define GRN_INT16_INIT(obj,flags) \
+ GRN_VALUE_FIX_SIZE_INIT(obj, flags, GRN_DB_INT16)
+#define GRN_UINT16_INIT(obj,flags) \
+ GRN_VALUE_FIX_SIZE_INIT(obj, flags, GRN_DB_UINT16)
+#define GRN_INT32_INIT(obj,flags) \
+ GRN_VALUE_FIX_SIZE_INIT(obj, flags, GRN_DB_INT32)
+#define GRN_UINT32_INIT(obj,flags) \
+ GRN_VALUE_FIX_SIZE_INIT(obj, flags, GRN_DB_UINT32)
+#define GRN_INT64_INIT(obj,flags) \
+ GRN_VALUE_FIX_SIZE_INIT(obj, flags, GRN_DB_INT64)
+#define GRN_UINT64_INIT(obj,flags) \
+ GRN_VALUE_FIX_SIZE_INIT(obj, flags, GRN_DB_UINT64)
+#define GRN_FLOAT_INIT(obj,flags) \
+ GRN_VALUE_FIX_SIZE_INIT(obj, flags, GRN_DB_FLOAT)
+#define GRN_TIME_INIT(obj,flags) \
+ GRN_VALUE_FIX_SIZE_INIT(obj, flags, GRN_DB_TIME)
+#define GRN_RECORD_INIT GRN_VALUE_FIX_SIZE_INIT
+#define GRN_PTR_INIT(obj,flags,domain)\
+ GRN_OBJ_INIT((obj), ((flags) & GRN_OBJ_VECTOR) ? GRN_PVECTOR : GRN_PTR,\
+ ((flags) & GRN_OBJ_DO_SHALLOW_COPY), (domain))
+#define GRN_TOKYO_GEO_POINT_INIT(obj,flags) \
+ GRN_VALUE_FIX_SIZE_INIT(obj, flags, GRN_DB_TOKYO_GEO_POINT)
+#define GRN_WGS84_GEO_POINT_INIT(obj,flags) \
+ GRN_VALUE_FIX_SIZE_INIT(obj, flags, GRN_DB_WGS84_GEO_POINT)
+
+#define GRN_BOOL_SET(ctx,obj,val) do {\
+ unsigned char _val = (unsigned char)(val);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val, 0, sizeof(unsigned char));\
+} while (0)
+#define GRN_INT8_SET(ctx,obj,val) do {\
+ signed char _val = (signed char)(val);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val, 0, sizeof(signed char));\
+} while (0)
+#define GRN_UINT8_SET(ctx,obj,val) do {\
+ unsigned char _val = (unsigned char)(val);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val, 0, sizeof(unsigned char));\
+} while (0)
+#define GRN_INT16_SET(ctx,obj,val) do {\
+ signed short _val = (signed short)(val);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val, 0, sizeof(signed short));\
+} while (0)
+#define GRN_UINT16_SET(ctx,obj,val) do {\
+ unsigned short _val = (unsigned short)(val);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val, 0, sizeof(unsigned short));\
+} while (0)
+#define GRN_INT32_SET(ctx,obj,val) do {\
+ int _val = (int)(val);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val, 0, sizeof(int));\
+} while (0)
+#define GRN_UINT32_SET(ctx,obj,val) do {\
+ unsigned int _val = (unsigned int)(val);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val, 0, sizeof(unsigned int));\
+} while (0)
+#define GRN_INT64_SET(ctx,obj,val) do {\
+ long long int _val = (long long int)(val);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val, 0, sizeof(long long int));\
+} while (0)
+#define GRN_UINT64_SET(ctx,obj,val) do {\
+ long long unsigned int _val = (long long unsigned int)(val);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val, 0, sizeof(long long unsigned int));\
+} while (0)
+#define GRN_FLOAT_SET(ctx,obj,val) do {\
+ double _val = (double)(val);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val, 0, sizeof(double));\
+} while (0)
+#define GRN_TIME_SET GRN_INT64_SET
+#define GRN_RECORD_SET(ctx,obj,val) do {\
+ grn_id _val = (grn_id)(val);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val, 0, sizeof(grn_id));\
+} while (0)
+#define GRN_PTR_SET(ctx,obj,val) do {\
+ grn_obj *_val = (grn_obj *)(val);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val, 0, sizeof(grn_obj *));\
+} while (0)
+
+#define GRN_GEO_DEGREE2MSEC(degree)\
+ ((int)((degree) * 3600 * 1000 + ((degree) > 0 ? 0.5 : -0.5)))
+#define GRN_GEO_MSEC2DEGREE(msec)\
+ ((((int)(msec)) / 3600.0) * 0.001)
+
+#define GRN_GEO_POINT_SET(ctx,obj,_latitude,_longitude) do {\
+ grn_geo_point _val;\
+ _val.latitude = (int)(_latitude);\
+ _val.longitude = (int)(_longitude);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val, 0, sizeof(grn_geo_point));\
+} while (0)
+
+#define GRN_BOOL_SET_AT(ctx,obj,offset,val) do {\
+ unsigned char _val = (unsigned char)(val);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val,\
+ (offset), sizeof(unsigned char));\
+} while (0)
+#define GRN_INT8_SET_AT(ctx,obj,offset,val) do {\
+ signed char _val = (signed char)(val);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val,\
+ (offset) * sizeof(signed char), sizeof(signed char));\
+} while (0)
+#define GRN_UINT8_SET_AT(ctx,obj,offset,val) do { \
+ unsigned char _val = (unsigned char)(val);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val,\
+ (offset) * sizeof(unsigned char), sizeof(unsigned char));\
+} while (0)
+#define GRN_INT16_SET_AT(ctx,obj,offset,val) do {\
+ signed short _val = (signed short)(val);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val,\
+ (offset) * sizeof(signed short), sizeof(signed short));\
+} while (0)
+#define GRN_UINT16_SET_AT(ctx,obj,offset,val) do { \
+ unsigned short _val = (unsigned short)(val);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val,\
+ (offset) * sizeof(unsigned short), sizeof(unsigned short));\
+} while (0)
+#define GRN_INT32_SET_AT(ctx,obj,offset,val) do {\
+ int _val = (int)(val);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val,\
+ (offset) * sizeof(int), sizeof(int));\
+} while (0)
+#define GRN_UINT32_SET_AT(ctx,obj,offset,val) do { \
+ unsigned int _val = (unsigned int)(val);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val,\
+ (offset) * sizeof(unsigned int), sizeof(unsigned int));\
+} while (0)
+#define GRN_INT64_SET_AT(ctx,obj,offset,val) do {\
+ long long int _val = (long long int)(val);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val,\
+ (offset) * sizeof(long long int), sizeof(long long int));\
+} while (0)
+#define GRN_UINT64_SET_AT(ctx,obj,offset,val) do {\
+ long long unsigned int _val = (long long unsigned int)(val);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val,\
+ (offset) * sizeof(long long unsigned int),\
+ sizeof(long long unsigned int));\
+} while (0)
+#define GRN_FLOAT_SET_AT(ctx,obj,offset,val) do {\
+ double _val = (double)(val);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val,\
+ (offset) * sizeof(double), sizeof(double));\
+} while (0)
+#define GRN_TIME_SET_AT GRN_INT64_SET_AT
+#define GRN_RECORD_SET_AT(ctx,obj,offset,val) do {\
+ grn_id _val = (grn_id)(val);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val,\
+ (offset) * sizeof(grn_id), sizeof(grn_id));\
+} while (0)
+#define GRN_PTR_SET_AT(ctx,obj,offset,val) do {\
+ grn_obj *_val = (grn_obj *)(val);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val,\
+ (offset) * sizeof(grn_obj *), sizeof(grn_obj *));\
+} while (0)
+
+#define GRN_TIME_USEC_PER_SEC 1000000
+#define GRN_TIME_PACK(sec, usec) ((long long int)(sec) * GRN_TIME_USEC_PER_SEC + (usec))
+#define GRN_TIME_UNPACK(time_value, sec, usec) do {\
+ sec = (time_value) / GRN_TIME_USEC_PER_SEC;\
+ usec = (time_value) % GRN_TIME_USEC_PER_SEC;\
+} while (0)
+
+GRN_API void grn_time_now(grn_ctx *ctx, grn_obj *obj);
+
+#define GRN_TIME_NOW(ctx,obj) (grn_time_now((ctx), (obj)))
+
+#define GRN_BOOL_VALUE(obj) (*((unsigned char *)GRN_BULK_HEAD(obj)))
+#define GRN_INT8_VALUE(obj) (*((signed char *)GRN_BULK_HEAD(obj)))
+#define GRN_UINT8_VALUE(obj) (*((unsigned char *)GRN_BULK_HEAD(obj)))
+#define GRN_INT16_VALUE(obj) (*((signed short *)GRN_BULK_HEAD(obj)))
+#define GRN_UINT16_VALUE(obj) (*((unsigned short *)GRN_BULK_HEAD(obj)))
+#define GRN_INT32_VALUE(obj) (*((int *)GRN_BULK_HEAD(obj)))
+#define GRN_UINT32_VALUE(obj) (*((unsigned int *)GRN_BULK_HEAD(obj)))
+#define GRN_INT64_VALUE(obj) (*((long long int *)GRN_BULK_HEAD(obj)))
+#define GRN_UINT64_VALUE(obj) (*((long long unsigned int *)GRN_BULK_HEAD(obj)))
+#define GRN_FLOAT_VALUE(obj) (*((double *)GRN_BULK_HEAD(obj)))
+#define GRN_TIME_VALUE GRN_INT64_VALUE
+#define GRN_RECORD_VALUE(obj) (*((grn_id *)GRN_BULK_HEAD(obj)))
+#define GRN_PTR_VALUE(obj) (*((grn_obj **)GRN_BULK_HEAD(obj)))
+#define GRN_GEO_POINT_VALUE(obj,_latitude,_longitude) do {\
+ grn_geo_point *_val = (grn_geo_point *)GRN_BULK_HEAD(obj);\
+ _latitude = _val->latitude;\
+ _longitude = _val->longitude;\
+} while (0)
+
+#define GRN_BOOL_VALUE_AT(obj,offset) (((unsigned char *)GRN_BULK_HEAD(obj))[offset])
+#define GRN_INT8_VALUE_AT(obj,offset) (((signed char *)GRN_BULK_HEAD(obj))[offset])
+#define GRN_UINT8_VALUE_AT(obj,offset) (((unsigned char *)GRN_BULK_HEAD(obj))[offset])
+#define GRN_INT16_VALUE_AT(obj,offset) (((signed short *)GRN_BULK_HEAD(obj))[offset])
+#define GRN_UINT16_VALUE_AT(obj,offset) (((unsigned short *)GRN_BULK_HEAD(obj))[offset])
+#define GRN_INT32_VALUE_AT(obj,offset) (((int *)GRN_BULK_HEAD(obj))[offset])
+#define GRN_UINT32_VALUE_AT(obj,offset) (((unsigned int *)GRN_BULK_HEAD(obj))[offset])
+#define GRN_INT64_VALUE_AT(obj,offset) (((long long int *)GRN_BULK_HEAD(obj))[offset])
+#define GRN_UINT64_VALUE_AT(obj,offset) (((long long unsigned int *)GRN_BULK_HEAD(obj))[offset])
+#define GRN_FLOAT_VALUE_AT(obj,offset) (((double *)GRN_BULK_HEAD(obj))[offset])
+#define GRN_TIME_VALUE_AT GRN_INT64_VALUE_AT
+#define GRN_RECORD_VALUE_AT(obj,offset) (((grn_id *)GRN_BULK_HEAD(obj))[offset])
+#define GRN_PTR_VALUE_AT(obj,offset) (((grn_obj **)GRN_BULK_HEAD(obj))[offset])
+
+#define GRN_BOOL_PUT(ctx,obj,val) do {\
+ unsigned char _val = (unsigned char)(val);\
+ grn_bulk_write((ctx), (obj), (char *)&_val, sizeof(unsigned char));\
+} while (0)
+#define GRN_INT8_PUT(ctx,obj,val) do {\
+ signed char _val = (signed char)(val); grn_bulk_write((ctx), (obj), (char *)&_val, sizeof(signed char));\
+} while (0)
+#define GRN_UINT8_PUT(ctx,obj,val) do {\
+ unsigned char _val = (unsigned char)(val);\
+ grn_bulk_write((ctx), (obj), (char *)&_val, sizeof(unsigned char));\
+} while (0)
+#define GRN_INT16_PUT(ctx,obj,val) do {\
+ signed short _val = (signed short)(val); grn_bulk_write((ctx), (obj), (char *)&_val, sizeof(signed short));\
+} while (0)
+#define GRN_UINT16_PUT(ctx,obj,val) do {\
+ unsigned short _val = (unsigned short)(val);\
+ grn_bulk_write((ctx), (obj), (char *)&_val, sizeof(unsigned short));\
+} while (0)
+#define GRN_INT32_PUT(ctx,obj,val) do {\
+ int _val = (int)(val); grn_bulk_write((ctx), (obj), (char *)&_val, sizeof(int));\
+} while (0)
+#define GRN_UINT32_PUT(ctx,obj,val) do {\
+ unsigned int _val = (unsigned int)(val);\
+ grn_bulk_write((ctx), (obj), (char *)&_val, sizeof(unsigned int));\
+} while (0)
+#define GRN_INT64_PUT(ctx,obj,val) do {\
+ long long int _val = (long long int)(val);\
+ grn_bulk_write((ctx), (obj), (char *)&_val, sizeof(long long int));\
+} while (0)
+#define GRN_UINT64_PUT(ctx,obj,val) do {\
+ long long unsigned int _val = (long long unsigned int)(val);\
+ grn_bulk_write((ctx), (obj), (char *)&_val, sizeof(long long unsigned int));\
+} while (0)
+#define GRN_FLOAT_PUT(ctx,obj,val) do {\
+ double _val = (double)(val); grn_bulk_write((ctx), (obj), (char *)&_val, sizeof(double));\
+} while (0)
+#define GRN_TIME_PUT GRN_INT64_PUT
+#define GRN_RECORD_PUT(ctx,obj,val) do {\
+ grn_id _val = (grn_id)(val); grn_bulk_write((ctx), (obj), (char *)&_val, sizeof(grn_id));\
+} while (0)
+#define GRN_PTR_PUT(ctx,obj,val) do {\
+ grn_obj *_val = (grn_obj *)(val);\
+ grn_bulk_write((ctx), (obj), (char *)&_val, sizeof(grn_obj *));\
+} while (0)
+
+/* grn_str: deprecated. use grn_string instead. */
+
+typedef struct {
+ const char *orig;
+ char *norm;
+ short *checks;
+ unsigned char *ctypes;
+ int flags;
+ unsigned int orig_blen;
+ unsigned int norm_blen;
+ unsigned int length;
+ grn_encoding encoding;
+} grn_str;
+
+#define GRN_STR_REMOVEBLANK (0x01<<0)
+#define GRN_STR_WITH_CTYPES (0x01<<1)
+#define GRN_STR_WITH_CHECKS (0x01<<2)
+#define GRN_STR_NORMALIZE GRN_OBJ_KEY_NORMALIZE
+
+GRN_API grn_str *grn_str_open(grn_ctx *ctx, const char *str, unsigned int str_len,
+ int flags);
+GRN_API grn_rc grn_str_close(grn_ctx *ctx, grn_str *nstr);
+
+/* grn_string */
+
+#define GRN_STRING_REMOVE_BLANK (0x01<<0)
+#define GRN_STRING_WITH_TYPES (0x01<<1)
+#define GRN_STRING_WITH_CHECKS (0x01<<2)
+#define GRN_STRING_REMOVE_TOKENIZED_DELIMITER (0x01<<3)
+
+#define GRN_NORMALIZER_AUTO ((grn_obj *)1)
+
+#define GRN_CHAR_BLANK 0x80
+#define GRN_CHAR_IS_BLANK(c) ((c) & (GRN_CHAR_BLANK))
+#define GRN_CHAR_TYPE(c) ((c) & 0x7f)
+
+typedef enum {
+ GRN_CHAR_NULL = 0,
+ GRN_CHAR_ALPHA,
+ GRN_CHAR_DIGIT,
+ GRN_CHAR_SYMBOL,
+ GRN_CHAR_HIRAGANA,
+ GRN_CHAR_KATAKANA,
+ GRN_CHAR_KANJI,
+ GRN_CHAR_OTHERS
+} grn_char_type;
+
+GRN_API grn_obj *grn_string_open(grn_ctx *ctx,
+ const char *string,
+ unsigned int length_in_bytes,
+ grn_obj *normalizer, int flags);
+GRN_API grn_rc grn_string_get_original(grn_ctx *ctx, grn_obj *string,
+ const char **original,
+ unsigned int *length_in_bytes);
+GRN_API int grn_string_get_flags(grn_ctx *ctx, grn_obj *string);
+GRN_API grn_rc grn_string_get_normalized(grn_ctx *ctx, grn_obj *string,
+ const char **normalized,
+ unsigned int *length_in_bytes,
+ unsigned int *n_characters);
+GRN_API grn_rc grn_string_set_normalized(grn_ctx *ctx, grn_obj *string,
+ char *normalized,
+ unsigned int length_in_bytes,
+ unsigned int n_characters);
+GRN_API const short *grn_string_get_checks(grn_ctx *ctx, grn_obj *string);
+GRN_API grn_rc grn_string_set_checks(grn_ctx *ctx,
+ grn_obj *string,
+ short *checks);
+GRN_API const unsigned char *grn_string_get_types(grn_ctx *ctx, grn_obj *string);
+GRN_API grn_rc grn_string_set_types(grn_ctx *ctx,
+ grn_obj *string,
+ unsigned char *types);
+GRN_API grn_encoding grn_string_get_encoding(grn_ctx *ctx, grn_obj *string);
+
+
+GRN_API int grn_charlen(grn_ctx *ctx, const char *str, const char *end);
+
+GRN_API grn_rc grn_ctx_push(grn_ctx *ctx, grn_obj *obj);
+GRN_API grn_obj *grn_ctx_pop(grn_ctx *ctx);
+
+GRN_API grn_obj *grn_table_select(grn_ctx *ctx, grn_obj *table, grn_obj *expr,
+ grn_obj *res, grn_operator op);
+
+GRN_API int grn_obj_columns(grn_ctx *ctx, grn_obj *table,
+ const char *str, unsigned int str_size, grn_obj *res);
+
+GRN_API grn_table_sort_key *grn_table_sort_key_from_str(grn_ctx *ctx,
+ const char *str, unsigned int str_size,
+ grn_obj *table, unsigned int *nkeys);
+GRN_API grn_rc grn_table_sort_key_close(grn_ctx *ctx,
+ grn_table_sort_key *keys, unsigned int nkeys);
+
+GRN_API grn_bool grn_table_is_grouped(grn_ctx *ctx, grn_obj *table);
+
+GRN_API unsigned int grn_table_max_n_subrecs(grn_ctx *ctx, grn_obj *table);
+
+GRN_API grn_obj *grn_table_create_for_group(grn_ctx *ctx,
+ const char *name,
+ unsigned int name_size,
+ const char *path,
+ grn_obj *group_key,
+ grn_obj *value_type,
+ unsigned int max_n_subrecs);
+
+GRN_API unsigned int grn_table_get_subrecs(grn_ctx *ctx, grn_obj *table,
+ grn_id id, grn_id *subrecbuf,
+ int *scorebuf, int buf_size);
+
+GRN_API grn_obj *grn_table_tokenize(grn_ctx *ctx, grn_obj *table,
+ const char *str, unsigned int str_len,
+ grn_obj *buf, grn_bool addp);
+
+GRN_API grn_rc grn_load(grn_ctx *ctx, grn_content_type input_type,
+ const char *table, unsigned int table_len,
+ const char *columns, unsigned int columns_len,
+ const char *values, unsigned int values_len,
+ const char *ifexists, unsigned int ifexists_len,
+ const char *each, unsigned int each_len);
+
+#define GRN_CTX_MORE (0x01<<0)
+#define GRN_CTX_TAIL (0x01<<1)
+#define GRN_CTX_HEAD (0x01<<2)
+#define GRN_CTX_QUIET (0x01<<3)
+#define GRN_CTX_QUIT (0x01<<4)
+
+GRN_API grn_rc grn_ctx_connect(grn_ctx *ctx, const char *host, int port, int flags);
+GRN_API unsigned int grn_ctx_send(grn_ctx *ctx, const char *str, unsigned int str_len, int flags);
+GRN_API unsigned int grn_ctx_recv(grn_ctx *ctx, char **str, unsigned int *str_len, int *flags);
+
+typedef struct _grn_ctx_info grn_ctx_info;
+
+struct _grn_ctx_info {
+ int fd;
+ unsigned int com_status;
+ grn_obj *outbuf;
+ unsigned char stat;
+};
+
+GRN_API grn_rc grn_ctx_info_get(grn_ctx *ctx, grn_ctx_info *info);
+
+GRN_API grn_rc grn_set_segv_handler(void);
+GRN_API grn_rc grn_set_int_handler(void);
+GRN_API grn_rc grn_set_term_handler(void);
+
+/* hash */
+
+typedef struct _grn_hash grn_hash;
+typedef struct _grn_hash_cursor grn_hash_cursor;
+
+GRN_API grn_hash *grn_hash_create(grn_ctx *ctx, const char *path, unsigned int key_size,
+ unsigned int value_size, unsigned int flags);
+
+GRN_API grn_hash *grn_hash_open(grn_ctx *ctx, const char *path);
+
+GRN_API grn_rc grn_hash_close(grn_ctx *ctx, grn_hash *hash);
+
+GRN_API grn_id grn_hash_add(grn_ctx *ctx, grn_hash *hash, const void *key,
+ unsigned int key_size, void **value, int *added);
+GRN_API grn_id grn_hash_get(grn_ctx *ctx, grn_hash *hash, const void *key,
+ unsigned int key_size, void **value);
+
+GRN_API int grn_hash_get_key(grn_ctx *ctx, grn_hash *hash, grn_id id, void *keybuf, int bufsize);
+GRN_API int grn_hash_get_key2(grn_ctx *ctx, grn_hash *hash, grn_id id, grn_obj *bulk);
+GRN_API int grn_hash_get_value(grn_ctx *ctx, grn_hash *hash, grn_id id, void *valuebuf);
+GRN_API grn_rc grn_hash_set_value(grn_ctx *ctx, grn_hash *hash, grn_id id,
+ const void *value, int flags);
+
+typedef struct _grn_table_delete_optarg grn_table_delete_optarg;
+
+struct _grn_table_delete_optarg {
+ int flags;
+ int (*func)(grn_ctx *ctx, grn_obj *, grn_id, void *);
+ void *func_arg;
+};
+
+GRN_API grn_rc grn_hash_delete_by_id(grn_ctx *ctx, grn_hash *hash, grn_id id,
+ grn_table_delete_optarg *optarg);
+GRN_API grn_rc grn_hash_delete(grn_ctx *ctx, grn_hash *hash,
+ const void *key, unsigned int key_size,
+ grn_table_delete_optarg *optarg);
+
+GRN_API grn_hash_cursor *grn_hash_cursor_open(grn_ctx *ctx, grn_hash *hash,
+ const void *min, unsigned int min_size,
+ const void *max, unsigned int max_size,
+ int offset, int limit, int flags);
+GRN_API grn_id grn_hash_cursor_next(grn_ctx *ctx, grn_hash_cursor *c);
+GRN_API void grn_hash_cursor_close(grn_ctx *ctx, grn_hash_cursor *c);
+
+GRN_API int grn_hash_cursor_get_key(grn_ctx *ctx, grn_hash_cursor *c, void **key);
+GRN_API int grn_hash_cursor_get_value(grn_ctx *ctx, grn_hash_cursor *c, void **value);
+GRN_API grn_rc grn_hash_cursor_set_value(grn_ctx *ctx, grn_hash_cursor *c,
+ const void *value, int flags);
+
+GRN_API int grn_hash_cursor_get_key_value(grn_ctx *ctx, grn_hash_cursor *c,
+ void **key, unsigned int *key_size, void **value);
+
+GRN_API grn_rc grn_hash_cursor_delete(grn_ctx *ctx, grn_hash_cursor *c,
+ grn_table_delete_optarg *optarg);
+
+#define GRN_HASH_EACH(ctx,hash,id,key,key_size,value,block) do {\
+ grn_hash_cursor *_sc = grn_hash_cursor_open(ctx, hash, NULL, 0, NULL, 0, 0, -1, 0); \
+ if (_sc) {\
+ grn_id id;\
+ while ((id = grn_hash_cursor_next(ctx, _sc))) {\
+ grn_hash_cursor_get_key_value(ctx, _sc, (void **)(key),\
+ (key_size), (void **)(value));\
+ block\
+ }\
+ grn_hash_cursor_close(ctx, _sc);\
+ }\
+} while (0)
+
+/* array */
+
+typedef struct _grn_array grn_array;
+typedef struct _grn_array_cursor grn_array_cursor;
+
+GRN_API grn_array *grn_array_create(grn_ctx *ctx, const char *path,
+ unsigned int value_size, unsigned int flags);
+GRN_API grn_array *grn_array_open(grn_ctx *ctx, const char *path);
+GRN_API grn_rc grn_array_close(grn_ctx *ctx, grn_array *array);
+GRN_API grn_id grn_array_add(grn_ctx *ctx, grn_array *array, void **value);
+GRN_API grn_id grn_array_push(grn_ctx *ctx, grn_array *array,
+ void (*func)(grn_ctx *ctx, grn_array *array,
+ grn_id id, void *func_arg),
+ void *func_arg);
+GRN_API grn_id grn_array_pull(grn_ctx *ctx, grn_array *array, grn_bool blockp,
+ void (*func)(grn_ctx *ctx, grn_array *array,
+ grn_id id, void *func_arg),
+ void *func_arg);
+GRN_API void grn_array_unblock(grn_ctx *ctx, grn_array *array);
+GRN_API int grn_array_get_value(grn_ctx *ctx, grn_array *array, grn_id id, void *valuebuf);
+GRN_API grn_rc grn_array_set_value(grn_ctx *ctx, grn_array *array, grn_id id,
+ const void *value, int flags);
+GRN_API grn_array_cursor *grn_array_cursor_open(grn_ctx *ctx, grn_array *array,
+ grn_id min, grn_id max,
+ int offset, int limit, int flags);
+GRN_API grn_id grn_array_cursor_next(grn_ctx *ctx, grn_array_cursor *cursor);
+GRN_API int grn_array_cursor_get_value(grn_ctx *ctx, grn_array_cursor *cursor, void **value);
+GRN_API grn_rc grn_array_cursor_set_value(grn_ctx *ctx, grn_array_cursor *cursor,
+ const void *value, int flags);
+GRN_API grn_rc grn_array_cursor_delete(grn_ctx *ctx, grn_array_cursor *cursor,
+ grn_table_delete_optarg *optarg);
+GRN_API void grn_array_cursor_close(grn_ctx *ctx, grn_array_cursor *cursor);
+GRN_API grn_rc grn_array_delete_by_id(grn_ctx *ctx, grn_array *array, grn_id id,
+ grn_table_delete_optarg *optarg);
+
+GRN_API grn_id grn_array_next(grn_ctx *ctx, grn_array *array, grn_id id);
+
+GRN_API void *_grn_array_get_value(grn_ctx *ctx, grn_array *array, grn_id id);
+
+#define GRN_ARRAY_EACH(ctx,array,head,tail,id,value,block) do {\
+ grn_array_cursor *_sc = grn_array_cursor_open(ctx, array, head, tail, 0, -1, 0); \
+ if (_sc) {\
+ grn_id id;\
+ while ((id = grn_array_cursor_next(ctx, _sc))) {\
+ grn_array_cursor_get_value(ctx, _sc, (void **)(value));\
+ block\
+ }\
+ grn_array_cursor_close(ctx, _sc); \
+ }\
+} while (0)
+
+/* pat */
+
+typedef struct _grn_pat grn_pat;
+typedef struct _grn_pat_cursor grn_pat_cursor;
+
+GRN_API grn_pat *grn_pat_create(grn_ctx *ctx, const char *path, unsigned int key_size,
+ unsigned int value_size, unsigned int flags);
+
+GRN_API grn_pat *grn_pat_open(grn_ctx *ctx, const char *path);
+
+GRN_API grn_rc grn_pat_close(grn_ctx *ctx, grn_pat *pat);
+
+GRN_API grn_rc grn_pat_remove(grn_ctx *ctx, const char *path);
+
+GRN_API grn_id grn_pat_get(grn_ctx *ctx, grn_pat *pat, const void *key,
+ unsigned int key_size, void **value);
+GRN_API grn_id grn_pat_add(grn_ctx *ctx, grn_pat *pat, const void *key,
+ unsigned int key_size, void **value, int *added);
+
+GRN_API int grn_pat_get_key(grn_ctx *ctx, grn_pat *pat, grn_id id, void *keybuf, int bufsize);
+GRN_API int grn_pat_get_key2(grn_ctx *ctx, grn_pat *pat, grn_id id, grn_obj *bulk);
+GRN_API int grn_pat_get_value(grn_ctx *ctx, grn_pat *pat, grn_id id, void *valuebuf);
+GRN_API grn_rc grn_pat_set_value(grn_ctx *ctx, grn_pat *pat, grn_id id,
+ const void *value, int flags);
+
+GRN_API grn_rc grn_pat_delete_by_id(grn_ctx *ctx, grn_pat *pat, grn_id id,
+ grn_table_delete_optarg *optarg);
+GRN_API grn_rc grn_pat_delete(grn_ctx *ctx, grn_pat *pat, const void *key, unsigned int key_size,
+ grn_table_delete_optarg *optarg);
+GRN_API int grn_pat_delete_with_sis(grn_ctx *ctx, grn_pat *pat, grn_id id,
+ grn_table_delete_optarg *optarg);
+
+typedef struct _grn_table_scan_hit grn_pat_scan_hit;
+typedef struct _grn_table_scan_hit grn_dat_scan_hit;
+
+struct _grn_table_scan_hit {
+ grn_id id;
+ unsigned int offset;
+ unsigned int length;
+};
+
+GRN_API int grn_pat_scan(grn_ctx *ctx, grn_pat *pat, const char *str, unsigned int str_len,
+ grn_pat_scan_hit *sh, unsigned int sh_size, const char **rest);
+
+GRN_API grn_rc grn_pat_prefix_search(grn_ctx *ctx, grn_pat *pat,
+ const void *key, unsigned int key_size, grn_hash *h);
+GRN_API grn_rc grn_pat_suffix_search(grn_ctx *ctx, grn_pat *pat,
+ const void *key, unsigned int key_size, grn_hash *h);
+GRN_API grn_id grn_pat_lcp_search(grn_ctx *ctx, grn_pat *pat,
+ const void *key, unsigned int key_size);
+
+GRN_API unsigned int grn_pat_size(grn_ctx *ctx, grn_pat *pat);
+
+GRN_API grn_pat_cursor *grn_pat_cursor_open(grn_ctx *ctx, grn_pat *pat,
+ const void *min, unsigned int min_size,
+ const void *max, unsigned int max_size,
+ int offset, int limit, int flags);
+GRN_API grn_id grn_pat_cursor_next(grn_ctx *ctx, grn_pat_cursor *c);
+GRN_API void grn_pat_cursor_close(grn_ctx *ctx, grn_pat_cursor *c);
+
+GRN_API int grn_pat_cursor_get_key(grn_ctx *ctx, grn_pat_cursor *c, void **key);
+GRN_API int grn_pat_cursor_get_value(grn_ctx *ctx, grn_pat_cursor *c, void **value);
+
+GRN_API int grn_pat_cursor_get_key_value(grn_ctx *ctx, grn_pat_cursor *c,
+ void **key, unsigned int *key_size, void **value);
+GRN_API grn_rc grn_pat_cursor_set_value(grn_ctx *ctx, grn_pat_cursor *c,
+ const void *value, int flags);
+GRN_API grn_rc grn_pat_cursor_delete(grn_ctx *ctx, grn_pat_cursor *c,
+ grn_table_delete_optarg *optarg);
+
+#define GRN_PAT_EACH(ctx,pat,id,key,key_size,value,block) do { \
+ grn_pat_cursor *_sc = grn_pat_cursor_open(ctx, pat, NULL, 0, NULL, 0, 0, -1, 0); \
+ if (_sc) {\
+ grn_id id;\
+ while ((id = grn_pat_cursor_next(ctx, _sc))) {\
+ grn_pat_cursor_get_key_value(ctx, _sc, (void **)(key),\
+ (key_size), (void **)(value));\
+ block\
+ }\
+ grn_pat_cursor_close(ctx, _sc);\
+ }\
+} while (0)
+
+/* dat */
+
+typedef struct _grn_dat grn_dat;
+typedef struct _grn_dat_cursor grn_dat_cursor;
+
+GRN_API int grn_dat_scan(grn_ctx *ctx, grn_dat *dat, const char *str,
+ unsigned int str_size, grn_dat_scan_hit *scan_hits,
+ unsigned int max_num_scan_hits, const char **str_rest);
+
+GRN_API grn_id grn_dat_lcp_search(grn_ctx *ctx, grn_dat *dat,
+ const void *key, unsigned int key_size);
+
+GRN_API grn_dat *grn_dat_create(grn_ctx *ctx, const char *path, unsigned int key_size,
+ unsigned int value_size, unsigned int flags);
+
+GRN_API grn_dat *grn_dat_open(grn_ctx *ctx, const char *path);
+
+GRN_API grn_rc grn_dat_close(grn_ctx *ctx, grn_dat *dat);
+
+GRN_API grn_rc grn_dat_remove(grn_ctx *ctx, const char *path);
+
+GRN_API grn_id grn_dat_get(grn_ctx *ctx, grn_dat *dat, const void *key,
+ unsigned int key_size, void **value);
+GRN_API grn_id grn_dat_add(grn_ctx *ctx, grn_dat *dat, const void *key,
+ unsigned int key_size, void **value, int *added);
+
+GRN_API int grn_dat_get_key(grn_ctx *ctx, grn_dat *dat, grn_id id, void *keybuf, int bufsize);
+GRN_API int grn_dat_get_key2(grn_ctx *ctx, grn_dat *dat, grn_id id, grn_obj *bulk);
+
+GRN_API grn_rc grn_dat_delete_by_id(grn_ctx *ctx, grn_dat *dat, grn_id id,
+ grn_table_delete_optarg *optarg);
+GRN_API grn_rc grn_dat_delete(grn_ctx *ctx, grn_dat *dat, const void *key, unsigned int key_size,
+ grn_table_delete_optarg *optarg);
+
+GRN_API grn_rc grn_dat_update_by_id(grn_ctx *ctx, grn_dat *dat, grn_id src_key_id,
+ const void *dest_key, unsigned int dest_key_size);
+GRN_API grn_rc grn_dat_update(grn_ctx *ctx, grn_dat *dat,
+ const void *src_key, unsigned int src_key_size,
+ const void *dest_key, unsigned int dest_key_size);
+
+GRN_API unsigned int grn_dat_size(grn_ctx *ctx, grn_dat *dat);
+
+GRN_API grn_dat_cursor *grn_dat_cursor_open(grn_ctx *ctx, grn_dat *dat,
+ const void *min, unsigned int min_size,
+ const void *max, unsigned int max_size,
+ int offset, int limit, int flags);
+GRN_API grn_id grn_dat_cursor_next(grn_ctx *ctx, grn_dat_cursor *c);
+GRN_API void grn_dat_cursor_close(grn_ctx *ctx, grn_dat_cursor *c);
+
+GRN_API int grn_dat_cursor_get_key(grn_ctx *ctx, grn_dat_cursor *c, const void **key);
+GRN_API grn_rc grn_dat_cursor_delete(grn_ctx *ctx, grn_dat_cursor *c,
+ grn_table_delete_optarg *optarg);
+
+#define GRN_DAT_EACH(ctx,dat,id,key,key_size,block) do {\
+ grn_dat_cursor *_sc = grn_dat_cursor_open(ctx, dat, NULL, 0, NULL, 0, 0, -1, 0);\
+ if (_sc) {\
+ grn_id id;\
+ unsigned int *_ks = (key_size);\
+ if (_ks) {\
+ while ((id = grn_dat_cursor_next(ctx, _sc))) {\
+ int _ks_raw = grn_dat_cursor_get_key(ctx, _sc, (const void **)(key));\
+ *(_ks) = (unsigned int)_ks_raw;\
+ block\
+ }\
+ } else {\
+ while ((id = grn_dat_cursor_next(ctx, _sc))) {\
+ grn_dat_cursor_get_key(ctx, _sc, (const void **)(key));\
+ block\
+ }\
+ }\
+ grn_dat_cursor_close(ctx, _sc);\
+ }\
+} while (0)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GROONGA_GROONGA_H */
diff --git a/storage/mroonga/vendor/groonga/include/groonga/ii.h b/storage/mroonga/vendor/groonga/include/groonga/ii.h
new file mode 100644
index 00000000000..176e137480c
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/ii.h
@@ -0,0 +1,53 @@
+/*
+ Copyright(C) 2009-2014 Brazil
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should 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 GROONGA_II_H
+#define GROONGA_II_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* buffered index builder */
+
+typedef struct _grn_ii grn_ii;
+typedef struct _grn_ii_buffer grn_ii_buffer;
+
+GRN_API unsigned int grn_ii_estimate_size(grn_ctx *ctx, grn_ii *ii, grn_id tid);
+GRN_API unsigned int grn_ii_estimate_size_for_query(grn_ctx *ctx, grn_ii *ii,
+ const char *query,
+ unsigned int query_len,
+ grn_search_optarg *optarg);
+GRN_API unsigned int grn_ii_estimate_size_for_lexicon_cursor(grn_ctx *ctx,
+ grn_ii *ii,
+ grn_table_cursor *lexicon_cursor);
+
+GRN_API grn_ii_buffer *grn_ii_buffer_open(grn_ctx *ctx, grn_ii *ii,
+ long long unsigned int update_buffer_size);
+GRN_API grn_rc grn_ii_buffer_append(grn_ctx *ctx,
+ grn_ii_buffer *ii_buffer,
+ grn_id rid,
+ unsigned int section,
+ grn_obj *value);
+GRN_API grn_rc grn_ii_buffer_commit(grn_ctx *ctx, grn_ii_buffer *ii_buffer);
+GRN_API grn_rc grn_ii_buffer_close(grn_ctx *ctx, grn_ii_buffer *ii_buffer);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GROONGA_II_H */
diff --git a/storage/mroonga/vendor/groonga/include/groonga/nfkc.h b/storage/mroonga/vendor/groonga/include/groonga/nfkc.h
index 3b7e294fb97..f4e628de53c 100644
--- a/storage/mroonga/vendor/groonga/include/groonga/nfkc.h
+++ b/storage/mroonga/vendor/groonga/include/groonga/nfkc.h
@@ -14,8 +14,8 @@
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 GRN_NFKC_H
-#define GRN_NFKC_H
+#ifndef GROONGA_NFKC_H
+#define GROONGA_NFKC_H
#include <groonga.h>
@@ -29,4 +29,4 @@ GRN_API grn_char_type grn_nfkc_char_type(const unsigned char *str);
}
#endif
-#endif /* GRN_NFKC_H */
+#endif /* GROONGA_NFKC_H */
diff --git a/storage/mroonga/vendor/groonga/include/groonga/obj.h b/storage/mroonga/vendor/groonga/include/groonga/obj.h
new file mode 100644
index 00000000000..7544a6cb382
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/obj.h
@@ -0,0 +1,37 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2015 Brazil
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should 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 GROONGA_OBJ_H
+#define GROONGA_OBJ_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+GRN_API grn_bool grn_obj_is_builtin(grn_ctx *ctx, grn_obj *obj);
+GRN_API grn_bool grn_obj_is_table(grn_ctx *ctx, grn_obj *obj);
+GRN_API grn_bool grn_obj_is_proc(grn_ctx *ctx, grn_obj *obj);
+GRN_API grn_bool grn_obj_is_function_proc(grn_ctx *ctx, grn_obj *obj);
+GRN_API grn_bool grn_obj_is_selector_proc(grn_ctx *ctx, grn_obj *obj);
+GRN_API grn_bool grn_obj_is_scorer_proc(grn_ctx *ctx, grn_obj *obj);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GROONGA_OBJ_H */
diff --git a/storage/mroonga/vendor/groonga/include/groonga/output.h b/storage/mroonga/vendor/groonga/include/groonga/output.h
new file mode 100644
index 00000000000..fc23bb2db01
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/output.h
@@ -0,0 +1,108 @@
+/*
+ Copyright(C) 2009-2015 Brazil
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should 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 GROONGA_OUTPUT_H
+#define GROONGA_OUTPUT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct _grn_obj_format grn_obj_format;
+
+#define GRN_OBJ_FORMAT_WITH_COLUMN_NAMES (0x01<<0)
+#define GRN_OBJ_FORMAT_AS_ARRAY (0x01<<3)
+/* Deprecated since 4.0.1. It will be removed at 5.0.0.
+ Use GRN_OBJ_FORMAT_AS_ARRAY instead.*/
+#define GRN_OBJ_FORMAT_ASARRAY GRN_OBJ_FORMAT_AS_ARRAY
+#define GRN_OBJ_FORMAT_WITH_WEIGHT (0x01<<4)
+
+struct _grn_obj_format {
+ grn_obj columns;
+ const void *min;
+ const void *max;
+ unsigned int min_size;
+ unsigned int max_size;
+ int nhits;
+ int offset;
+ int limit;
+ int hits_offset;
+ int flags;
+ grn_obj *expression;
+};
+
+#define GRN_OBJ_FORMAT_INIT(format,format_nhits,format_offset,format_limit,format_hits_offset) do { \
+ GRN_PTR_INIT(&(format)->columns, GRN_OBJ_VECTOR, GRN_ID_NIL);\
+ (format)->nhits = (format_nhits);\
+ (format)->offset = (format_offset);\
+ (format)->limit = (format_limit);\
+ (format)->hits_offset = (format_hits_offset);\
+ (format)->flags = 0;\
+ (format)->expression = NULL;\
+} while (0)
+
+#define GRN_OBJ_FORMAT_FIN(ctx,format) do {\
+ int ncolumns = GRN_BULK_VSIZE(&(format)->columns) / sizeof(grn_obj *);\
+ grn_obj **columns = (grn_obj **)GRN_BULK_HEAD(&(format)->columns);\
+ while (ncolumns--) { grn_obj_unlink((ctx), *columns++); }\
+ GRN_OBJ_FIN((ctx), &(format)->columns);\
+ if ((format)->expression) { GRN_OBJ_FIN((ctx), (format)->expression); } \
+} while (0)
+
+GRN_API void grn_output_obj(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type,
+ grn_obj *obj, grn_obj_format *format);
+GRN_API void grn_output_envelope(grn_ctx *ctx, grn_rc rc,
+ grn_obj *head, grn_obj *body, grn_obj *foot,
+ const char *file, int line);
+
+GRN_API void grn_ctx_output_flush(grn_ctx *ctx, int flags);
+GRN_API void grn_ctx_output_array_open(grn_ctx *ctx,
+ const char *name, int nelements);
+GRN_API void grn_ctx_output_array_close(grn_ctx *ctx);
+GRN_API void grn_ctx_output_map_open(grn_ctx *ctx,
+ const char *name, int nelements);
+GRN_API void grn_ctx_output_map_close(grn_ctx *ctx);
+GRN_API void grn_ctx_output_int32(grn_ctx *ctx, int value);
+GRN_API void grn_ctx_output_int64(grn_ctx *ctx, long long int value);
+GRN_API void grn_ctx_output_float(grn_ctx *ctx, double value);
+GRN_API void grn_ctx_output_cstr(grn_ctx *ctx, const char *value);
+GRN_API void grn_ctx_output_str(grn_ctx *ctx,
+ const char *value, unsigned int value_len);
+GRN_API void grn_ctx_output_bool(grn_ctx *ctx, grn_bool value);
+GRN_API void grn_ctx_output_obj(grn_ctx *ctx,
+ grn_obj *value, grn_obj_format *format);
+GRN_API void grn_ctx_output_table_columns(grn_ctx *ctx,
+ grn_obj *table,
+ grn_obj_format *format);
+GRN_API void grn_ctx_output_table_records(grn_ctx *ctx,
+ grn_obj *table,
+ grn_obj_format *format);
+
+
+GRN_API grn_content_type grn_ctx_get_output_type(grn_ctx *ctx);
+GRN_API grn_rc grn_ctx_set_output_type(grn_ctx *ctx, grn_content_type type);
+GRN_API const char *grn_ctx_get_mime_type(grn_ctx *ctx);
+
+/* obsolete */
+GRN_API grn_rc grn_text_otoj(grn_ctx *ctx, grn_obj *bulk, grn_obj *obj,
+ grn_obj_format *format);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GROONGA_OUTPUT_H */
diff --git a/storage/mroonga/vendor/groonga/include/groonga/plugin.h b/storage/mroonga/vendor/groonga/include/groonga/plugin.h
index 98676acf6be..bbd8923e5d6 100644
--- a/storage/mroonga/vendor/groonga/include/groonga/plugin.h
+++ b/storage/mroonga/vendor/groonga/include/groonga/plugin.h
@@ -15,8 +15,8 @@
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 GRN_PLUGIN_H
-#define GRN_PLUGIN_H
+#ifndef GROONGA_PLUGIN_H
+#define GROONGA_PLUGIN_H
#include <stddef.h>
@@ -26,9 +26,24 @@
extern "C" {
#endif
-#define GRN_PLUGIN_INIT grn_plugin_impl_init
-#define GRN_PLUGIN_REGISTER grn_plugin_impl_register
-#define GRN_PLUGIN_FIN grn_plugin_impl_fin
+# define GRN_PLUGIN_IMPL_NAME_RAW(type) \
+ grn_plugin_impl_ ## type
+# define GRN_PLUGIN_IMPL_NAME_TAGGED(type, tag) \
+ GRN_PLUGIN_IMPL_NAME_RAW(type ## _ ## tag)
+# define GRN_PLUGIN_IMPL_NAME_TAGGED_EXPANDABLE(type, tag) \
+ GRN_PLUGIN_IMPL_NAME_TAGGED(type, tag)
+
+#ifdef GRN_PLUGIN_FUNCTION_TAG
+# define GRN_PLUGIN_IMPL_NAME(type) \
+ GRN_PLUGIN_IMPL_NAME_TAGGED_EXPANDABLE(type, GRN_PLUGIN_FUNCTION_TAG)
+#else /* GRN_PLUGIN_FUNCTION_TAG */
+# define GRN_PLUGIN_IMPL_NAME(type) \
+ GRN_PLUGIN_IMPL_NAME_RAW(type)
+#endif /* GRN_PLUGIN_FUNCTION_TAG */
+
+#define GRN_PLUGIN_INIT GRN_PLUGIN_IMPL_NAME(init)
+#define GRN_PLUGIN_REGISTER GRN_PLUGIN_IMPL_NAME(register)
+#define GRN_PLUGIN_FIN GRN_PLUGIN_IMPL_NAME(fin)
#if defined(_WIN32) || defined(_WIN64)
# define GRN_PLUGIN_EXPORT __declspec(dllexport)
@@ -117,6 +132,8 @@ GRN_API void grn_plugin_mutex_unlock(grn_ctx *ctx, grn_plugin_mutex *mutex);
GRN_API grn_obj *grn_plugin_proc_alloc(grn_ctx *ctx, grn_user_data *user_data,
grn_id domain, grn_obj_flags flags);
+GRN_API grn_obj *grn_plugin_proc_get_vars(grn_ctx *ctx, grn_user_data *user_data);
+
GRN_API grn_obj *grn_plugin_proc_get_var(grn_ctx *ctx, grn_user_data *user_data,
const char *name, int name_size);
@@ -149,4 +166,4 @@ GRN_API grn_obj * grn_plugin_command_create(grn_ctx *ctx,
}
#endif
-#endif /* GRN_PLUGIN_H */
+#endif /* GROONGA_PLUGIN_H */
diff --git a/storage/mroonga/vendor/groonga/include/groonga/portability.h b/storage/mroonga/vendor/groonga/include/groonga/portability.h
new file mode 100644
index 00000000000..1d763765c2c
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/portability.h
@@ -0,0 +1,158 @@
+/*
+ Copyright(C) 2015 Brazil
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should 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 GROONGA_PORTABILITY_H
+#define GROONGA_PORTABILITY_H
+
+#ifdef WIN32
+# ifdef __cplusplus
+# define grn_memcpy(dest, src, n) ::memcpy_s((dest), (n), (src), (n))
+# else /* __cplusplus */
+# define grn_memcpy(dest, src, n) memcpy_s((dest), (n), (src), (n))
+# endif /* __cplusplus */
+#else /* WIN32 */
+# ifdef __cplusplus
+# define grn_memcpy(dest, src, n) std::memcpy((dest), (src), (n))
+# else /* __cplusplus */
+# define grn_memcpy(dest, src, n) memcpy((dest), (src), (n))
+# endif /* __cplusplus */
+#endif /* WIN32 */
+
+#ifdef WIN32
+# define grn_memmove(dest, src, n) memmove_s((dest), (n), (src), (n))
+#else /* WIN32 */
+# define grn_memmove(dest, src, n) memmove((dest), (src), (n))
+#endif /* WIN32 */
+
+#define GRN_ENV_BUFFER_SIZE 1024
+
+#ifdef WIN32
+# define grn_getenv(name, dest, dest_size) do { \
+ char *dest_ = (dest); \
+ size_t dest_size_ = (dest_size); \
+ if (dest_size_ > 0) { \
+ DWORD env_size; \
+ env_size = GetEnvironmentVariableA((name), dest_, dest_size_); \
+ if (env_size == 0 || env_size > dest_size_) { \
+ dest_[0] = '\0'; \
+ } \
+ } \
+ } while (0)
+#else /* WIN32 */
+# define grn_getenv(name, dest, dest_size) do { \
+ const char *env_value = getenv((name)); \
+ char *dest_ = (dest); \
+ size_t dest_size_ = (dest_size); \
+ if (dest_size_ > 0) { \
+ if (env_value) { \
+ strncpy(dest_, env_value, dest_size_ - 1); \
+ } else { \
+ dest_[0] = '\0'; \
+ } \
+ } \
+ } while (0)
+#endif /* WIN32 */
+
+#ifdef WIN32
+# define grn_fopen(name, mode) _fsopen((name), (mode), _SH_DENYNO)
+#else /* WIN32 */
+# define grn_fopen(name, mode) fopen((name), (mode))
+#endif /* WIN32 */
+
+#ifdef WIN32
+# define grn_strdup_raw(string) _strdup((string))
+#else /* WIN32 */
+# define grn_strdup_raw(string) strdup((string))
+#endif /* WIN32 */
+
+#ifdef WIN32
+# define grn_unlink(filename) _unlink((filename))
+#else /* WIN32 */
+# define grn_unlink(filename) unlink((filename))
+#endif /* WIN32 */
+
+#ifdef WIN32
+# define grn_strncat(dest, dest_size, src, n) \
+ strncat_s((dest), (dest_size), (src), (n))
+#else /* WIN32 */
+# define grn_strncat(dest, dest_size, src, n) \
+ strncat((dest), (src), (n))
+#endif /* WIN32 */
+
+#ifdef WIN32
+# define grn_strcpy(dest, dest_size, src) \
+ strcpy_s((dest), (dest_size), (src))
+#else /* WIN32 */
+# define grn_strcpy(dest, dest_size, src) \
+ strcpy((dest), (src))
+#endif /* WIN32 */
+
+#ifdef WIN32
+# define grn_strncpy(dest, dest_size, src, n) \
+ strncpy_s((dest), (dest_size), (src), (n))
+#else /* WIN32 */
+# define grn_strncpy(dest, dest_size, src, n) \
+ strncpy((dest), (src), (n))
+#endif /* WIN32 */
+
+#ifdef WIN32
+# define grn_strcat(dest, dest_size, src) \
+ strcat_s((dest), (dest_size), (src))
+#else /* WIN32 */
+# define grn_strcat(dest, dest_size, src) \
+ strcat((dest), (src))
+#endif /* WIN32 */
+
+#ifdef WIN32
+# define grn_snprintf(dest, dest_size, n, format, ...) \
+ _snprintf_s((dest), (dest_size), (n) - 1, (format), __VA_ARGS__)
+#else /* WIN32 */
+# define grn_snprintf(dest, dest_size, n, format, ...) \
+ snprintf((dest), (n), (format), __VA_ARGS__)
+#endif /* WIN32 */
+
+#ifdef WIN32
+# define grn_write(fd, buf, count) _write((fd), (buf), (count))
+#else /* WIN32 */
+# define grn_write(fd, buf, count) write((fd), (buf), (count))
+#endif /* WIN32 */
+
+#ifdef WIN32
+# define grn_read(fd, buf, count) _read((fd), (buf), (count))
+#else /* WIN32 */
+# define grn_read(fd, buf, count) read((fd), (buf), (count))
+#endif /* WIN32 */
+
+#ifdef WIN32
+# define GRN_OPEN_CREATE_MODE (_S_IREAD | _S_IWRITE)
+# define GRN_OPEN_FLAG_BINARY _O_BINARY
+# define grn_open(fd, pathname, flags) \
+ _sopen_s(&(fd), (pathname), (flags), _SH_DENYNO, GRN_OPEN_CREATE_MODE)
+#else /* WIN32 */
+# define GRN_OPEN_CREATE_MODE (S_IRUSR | S_IWUSR | S_IRGRP)
+# define GRN_OPEN_FLAG_BINARY 0
+# define grn_open(fd, pathname, flags) \
+ (fd) = open((pathname), (flags), GRN_OPEN_CREATE_MODE)
+#endif /* WIN32 */
+
+#ifdef WIN32
+# define grn_close(fd) _close((fd))
+#else /* WIN32 */
+# define grn_close(fd) close((fd))
+#endif /* WIN32 */
+
+#endif /* GROONGA_PORTABILITY_H */
diff --git a/storage/mroonga/vendor/groonga/include/groonga/request_canceler.h b/storage/mroonga/vendor/groonga/include/groonga/request_canceler.h
new file mode 100644
index 00000000000..0032a778c25
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/request_canceler.h
@@ -0,0 +1,39 @@
+/*
+ Copyright(C) 2014 Brazil
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should 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 GROONGA_REQUEST_CANCELER_H
+#define GROONGA_REQUEST_CANCELER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+GRN_API void grn_request_canceler_register(grn_ctx *ctx,
+ const char *request_id,
+ unsigned int size);
+GRN_API void grn_request_canceler_unregister(grn_ctx *ctx,
+ const char *request_id,
+ unsigned int size);
+GRN_API grn_bool grn_request_canceler_cancel(const char *request_id,
+ unsigned int size);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GROONGA_REQUEST_CANCELER_H */
diff --git a/storage/mroonga/vendor/groonga/include/groonga/scorer.h b/storage/mroonga/vendor/groonga/include/groonga/scorer.h
new file mode 100644
index 00000000000..6f9c589affb
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/scorer.h
@@ -0,0 +1,95 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2015 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
+*/
+#ifndef GROONGA_SCORER_H
+#define GROONGA_SCORER_H
+
+#include <groonga/plugin.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+typedef struct _grn_scorer_matched_record grn_scorer_matched_record;
+
+GRN_API grn_obj *
+ grn_scorer_matched_record_get_table(grn_ctx *ctx,
+ grn_scorer_matched_record *record);
+GRN_API grn_obj *
+ grn_scorer_matched_record_get_lexicon(grn_ctx *ctx,
+ grn_scorer_matched_record *record);
+GRN_API grn_id
+ grn_scorer_matched_record_get_id(grn_ctx *ctx,
+ grn_scorer_matched_record *record);
+GRN_API grn_obj *
+ grn_scorer_matched_record_get_terms(grn_ctx *ctx,
+ grn_scorer_matched_record *record);
+GRN_API grn_obj *
+ grn_scorer_matched_record_get_term_weights(grn_ctx *ctx,
+ grn_scorer_matched_record *record);
+GRN_API unsigned int
+ grn_scorer_matched_record_get_total_term_weights(grn_ctx *ctx,
+ grn_scorer_matched_record *record);
+GRN_API long long unsigned int
+ grn_scorer_matched_record_get_n_documents(grn_ctx *ctx,
+ grn_scorer_matched_record *record);
+GRN_API unsigned int
+ grn_scorer_matched_record_get_n_occurrences(grn_ctx *ctx,
+ grn_scorer_matched_record *record);
+GRN_API long long unsigned int
+ grn_scorer_matched_record_get_n_candidates(grn_ctx *ctx,
+ grn_scorer_matched_record *record);
+GRN_API unsigned int
+ grn_scorer_matched_record_get_n_tokens(grn_ctx *ctx,
+ grn_scorer_matched_record *record);
+GRN_API int
+ grn_scorer_matched_record_get_weight(grn_ctx *ctx,
+ grn_scorer_matched_record *record);
+GRN_API grn_obj *
+ grn_scorer_matched_record_get_arg(grn_ctx *ctx,
+ grn_scorer_matched_record *record,
+ unsigned int i);
+GRN_API unsigned int
+ grn_scorer_matched_record_get_n_args(grn_ctx *ctx,
+ grn_scorer_matched_record *record);
+
+
+
+typedef double grn_scorer_score_func(grn_ctx *ctx,
+ grn_scorer_matched_record *record);
+
+/*
+ grn_scorer_register() registers a plugin to the database which is
+ associated with `ctx'. `plugin_name_ptr' and `plugin_name_length' specify the
+ plugin name. Alphabetic letters ('A'-'Z' and 'a'-'z'), digits ('0'-'9') and
+ an underscore ('_') are capable characters.
+
+ `score' is called for scoring matched records one by one.
+
+ grn_scorer_register() returns GRN_SUCCESS on success, an error
+ code on failure.
+ */
+GRN_PLUGIN_EXPORT grn_rc grn_scorer_register(grn_ctx *ctx,
+ const char *plugin_name_ptr,
+ int plugin_name_length,
+ grn_scorer_score_func *score);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* GROONGA_SCORER_H */
diff --git a/storage/mroonga/vendor/groonga/include/groonga/token.h b/storage/mroonga/vendor/groonga/include/groonga/token.h
new file mode 100644
index 00000000000..5aeaf0b4361
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/token.h
@@ -0,0 +1,136 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2014 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
+*/
+#ifndef GROONGA_TOKEN_H
+#define GROONGA_TOKEN_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/*
+ * grn_tokenize_mode describes propose for tokenization.
+ *
+ * `GRN_TOKENIZE_GET`: Tokenize for search.
+ *
+ * `GRN_TOKENIZE_ADD`: Tokenize for adding token to index.
+ *
+ * `GRN_TOKENIZE_DELETE`: Tokenize for deleting token from index.
+ *
+ * @since 4.0.8
+ */
+typedef enum {
+ GRN_TOKENIZE_GET = 0,
+ GRN_TOKENIZE_ADD,
+ GRN_TOKENIZE_DELETE
+} grn_tokenize_mode;
+
+/*
+ grn_token_mode describes propose for tokenization.
+
+ `GRN_TOKEN_GET`: Tokenization for search.
+
+ `GRN_TOKEN_ADD`: Tokenization for adding token to index.
+
+ `GRN_TOKEN_DEL`: Tokenization for deleting token from index.
+
+ @since 4.0.7
+ @deprecated since 4.0.8. Use grn_tokenize_mode instead.
+ */
+typedef grn_tokenize_mode grn_token_mode;
+
+#define GRN_TOKEN_GET GRN_TOKENIZE_GET
+#define GRN_TOKEN_ADD GRN_TOKENIZE_ADD
+#define GRN_TOKEN_DEL GRN_TOKENIZE_DELETE
+
+/*
+ * grn_token_status is a flag set for tokenizer status codes.
+ * If a document or query contains no tokens, push an empty string with
+ * GRN_TOKEN_LAST as a token.
+ *
+ * @since 4.0.8
+ */
+typedef unsigned int grn_token_status;
+
+/*
+ * GRN_TOKEN_CONTINUE means that the next token is not the last one.
+ *
+ * @since 4.0.8
+ */
+#define GRN_TOKEN_CONTINUE (0)
+/*
+ * GRN_TOKEN_LAST means that the next token is the last one.
+ *
+ * @since 4.0.8
+ */
+#define GRN_TOKEN_LAST (0x01L<<0)
+/*
+ * GRN_TOKEN_OVERLAP means that ...
+ *
+ * @since 4.0.8
+ */
+#define GRN_TOKEN_OVERLAP (0x01L<<1)
+/*
+ * GRN_TOKEN_UNMATURED means that ...
+ *
+ * @since 4.0.8
+ */
+#define GRN_TOKEN_UNMATURED (0x01L<<2)
+/*
+ * GRN_TOKEN_REACH_END means that ...
+ *
+ * @since 4.0.8
+ */
+#define GRN_TOKEN_REACH_END (0x01L<<3)
+/*
+ * GRN_TOKEN_SKIP means that the token is skipped
+ *
+ * @since 4.0.8
+ */
+#define GRN_TOKEN_SKIP (0x01L<<4)
+/*
+ * GRN_TOKEN_SKIP_WITH_POSITION means that the token and postion is skipped
+ *
+ * @since 4.0.8
+ */
+#define GRN_TOKEN_SKIP_WITH_POSITION (0x01L<<5)
+/*
+ * GRN_TOKEN_FORCE_PREIX that the token is used common prefix search
+ *
+ * @since 4.0.8
+ */
+#define GRN_TOKEN_FORCE_PREFIX (0x01L<<6)
+
+typedef struct _grn_token grn_token;
+
+GRN_PLUGIN_EXPORT grn_obj *grn_token_get_data(grn_ctx *ctx,
+ grn_token *token);
+GRN_PLUGIN_EXPORT grn_rc grn_token_set_data(grn_ctx *ctx,
+ grn_token *token,
+ const char *str_ptr,
+ int str_length);
+GRN_PLUGIN_EXPORT grn_token_status grn_token_get_status(grn_ctx *ctx,
+ grn_token *token);
+GRN_PLUGIN_EXPORT grn_rc grn_token_set_status(grn_ctx *ctx,
+ grn_token *token,
+ grn_token_status status);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* GROONGA_TOKEN_H */
diff --git a/storage/mroonga/vendor/groonga/include/groonga/token_filter.h b/storage/mroonga/vendor/groonga/include/groonga/token_filter.h
index 2ae553b8630..9c5a3567b3b 100644
--- a/storage/mroonga/vendor/groonga/include/groonga/token_filter.h
+++ b/storage/mroonga/vendor/groonga/include/groonga/token_filter.h
@@ -15,10 +15,8 @@
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 GRN_PLUGIN_TOKEN_FILTER_H
-#define GRN_PLUGIN_TOKEN_FILTER_H
-
-#include <stddef.h>
+#ifndef GROONGA_TOKEN_FILTER_H
+#define GROONGA_TOKEN_FILTER_H
#include <groonga/tokenizer.h>
@@ -28,7 +26,7 @@ extern "C" {
typedef void *grn_token_filter_init_func(grn_ctx *ctx,
grn_obj *table,
- grn_token_mode mode);
+ grn_tokenize_mode mode);
typedef void grn_token_filter_filter_func(grn_ctx *ctx,
grn_token *current_token,
@@ -68,4 +66,4 @@ GRN_PLUGIN_EXPORT grn_rc grn_token_filter_register(grn_ctx *ctx,
} /* extern "C" */
#endif /* __cplusplus */
-#endif /* GRN_PLUGIN_TOKEN_FILTER_H */
+#endif /* GROONGA_TOKEN_FILTER_H */
diff --git a/storage/mroonga/vendor/groonga/include/groonga/tokenizer.h b/storage/mroonga/vendor/groonga/include/groonga/tokenizer.h
index 9792e018b31..8ad7f6757f4 100644
--- a/storage/mroonga/vendor/groonga/include/groonga/tokenizer.h
+++ b/storage/mroonga/vendor/groonga/include/groonga/tokenizer.h
@@ -15,12 +15,11 @@
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 GRN_PLUGIN_TOKENIZER_H
-#define GRN_PLUGIN_TOKENIZER_H
-
-#include <stddef.h>
+#ifndef GROONGA_TOKENIZER_H
+#define GROONGA_TOKENIZER_H
#include <groonga/plugin.h>
+#include <groonga/token.h>
#ifdef __cplusplus
extern "C" {
@@ -30,23 +29,6 @@ extern "C" {
#define GRN_TOKENIZER_TOKENIZED_DELIMITER_UTF8_LEN 3
/*
- grn_token_mode describes propose for tokenization.
-
- `GRN_TOKEN_GET`: Tokenization for search.
-
- `GRN_TOKEN_ADD`: Tokenization for adding token to index.
-
- `GRN_TOKEN_DEL`: Tokenization for deleting token from index.
-
- @since 4.0.7
- */
-typedef enum {
- GRN_TOKEN_GET = 0,
- GRN_TOKEN_ADD,
- GRN_TOKEN_DEL
-} grn_token_mode;
-
-/*
grn_tokenizer_charlen() returns the length (#bytes) of the first character
in the string specified by `str_ptr' and `str_length'. If the starting bytes
are invalid as a character, grn_tokenizer_charlen() returns 0. See
@@ -101,7 +83,9 @@ struct _grn_tokenizer_query {
grn_encoding encoding;
unsigned int flags;
grn_bool have_tokenized_delimiter;
+ /* Deprecated since 4.0.8. Use tokenize_mode instead. */
grn_token_mode token_mode;
+ grn_tokenize_mode tokenize_mode;
};
/*
@@ -166,23 +150,59 @@ GRN_PLUGIN_EXPORT void grn_tokenizer_token_fin(grn_ctx *ctx, grn_tokenizer_token
* grn_tokenizer_status is a flag set for tokenizer status codes.
* If a document or query contains no tokens, push an empty string with
* GRN_TOKENIZER_TOKEN_LAST as a token.
+ *
+ * @deprecated since 4.0.8. Use grn_token_status instead.
+ */
+typedef grn_token_status grn_tokenizer_status;
+
+/*
+ * GRN_TOKENIZER_TOKEN_CONTINUE means that the next token is not the last one.
+ *
+ * @deprecated since 4.0.8. Use GRN_TOKEN_CONTINUE instead.
+ */
+#define GRN_TOKENIZER_TOKEN_CONTINUE GRN_TOKEN_CONTINUE
+/*
+ * GRN_TOKENIZER_TOKEN_LAST means that the next token is the last one.
+ *
+ * @deprecated since 4.0.8. Use GRN_TOKEN_LAST instead.
+ */
+#define GRN_TOKENIZER_TOKEN_LAST GRN_TOKEN_LAST
+/*
+ * GRN_TOKENIZER_TOKEN_OVERLAP means that ...
+ *
+ * @deprecated since 4.0.8. Use GRN_TOKEN_OVERLAP instead.
+ */
+#define GRN_TOKENIZER_TOKEN_OVERLAP GRN_TOKEN_OVERLAP
+/*
+ * GRN_TOKENIZER_TOKEN_UNMATURED means that ...
+ *
+ * @deprecated since 4.0.8. Use GRN_TOKEN_UNMATURED instead.
+ */
+#define GRN_TOKENIZER_TOKEN_UNMATURED GRN_TOKEN_UNMATURED
+/*
+ * GRN_TOKENIZER_TOKEN_REACH_END means that ...
+ *
+ * @deprecated since 4.0.8. Use GRN_TOKEN_REACH_END instead.
+ */
+#define GRN_TOKENIZER_TOKEN_REACH_END GRN_TOKEN_REACH_END
+/*
+ * GRN_TOKENIZER_TOKEN_SKIP means that the token is skipped
+ *
+ * @deprecated since 4.0.8. Use GRN_TOKEN_SKIP instead.
*/
-typedef unsigned int grn_tokenizer_status;
-
-/* GRN_TOKENIZER_TOKEN_CONTINUE means that the next token is not the last one. */
-#define GRN_TOKENIZER_TOKEN_CONTINUE (0)
-/* GRN_TOKENIZER_TOKEN_LAST means that the next token is the last one. */
-#define GRN_TOKENIZER_TOKEN_LAST (0x01L<<0)
-/* GRN_TOKENIZER_TOKEN_OVERLAP means that ... */
-#define GRN_TOKENIZER_TOKEN_OVERLAP (0x01L<<1)
-/* GRN_TOKENIZER_TOKEN_UNMATURED means that ... */
-#define GRN_TOKENIZER_TOKEN_UNMATURED (0x01L<<2)
-/* GRN_TOKENIZER_TOKEN_REACH_END means that ... */
-#define GRN_TOKENIZER_TOKEN_REACH_END (0x01L<<3)
-/* GRN_TOKENIZER_TOKEN_SKIP means that the token is skipped */
-#define GRN_TOKENIZER_TOKEN_SKIP (0x01L<<4)
-/* GRN_TOKENIZER_TOKEN_SKIP_WITH_POSITION means that the token and postion is skipped */
-#define GRN_TOKENIZER_TOKEN_SKIP_WITH_POSITION (0x01L<<5)
+#define GRN_TOKENIZER_TOKEN_SKIP GRN_TOKEN_SKIP
+/*
+ * GRN_TOKENIZER_TOKEN_SKIP_WITH_POSITION means that the token and postion is skipped
+ *
+ * @deprecated since 4.0.8. Use GRN_TOKEN_SKIP_WITH_POSITION instead.
+ */
+#define GRN_TOKENIZER_TOKEN_SKIP_WITH_POSITION GRN_TOKEN_SKIP_WITH_POSITION
+/*
+ * GRN_TOKENIZER_TOKEN_FORCE_PREIX that the token is used common prefix search
+ *
+ * @deprecated since 4.0.8. Use GRN_TOKEN_FORCE_PREIX instead.
+ */
+#define GRN_TOKENIZER_TOKEN_FORCE_PREFIX GRN_TOKEN_FORCE_PREFIX
/*
* GRN_TOKENIZER_CONTINUE and GRN_TOKENIZER_LAST are deprecated. They
@@ -193,32 +213,17 @@ typedef unsigned int grn_tokenizer_status;
#define GRN_TOKENIZER_CONTINUE GRN_TOKENIZER_TOKEN_CONTINUE
#define GRN_TOKENIZER_LAST GRN_TOKENIZER_TOKEN_LAST
-typedef struct _grn_token grn_token;
-
-GRN_PLUGIN_EXPORT grn_obj *grn_token_get_data(grn_ctx *ctx,
- grn_token *token);
-GRN_PLUGIN_EXPORT grn_rc grn_token_set_data(grn_ctx *ctx,
- grn_token *token,
- const char *str_ptr,
- int str_length);
-GRN_PLUGIN_EXPORT grn_tokenizer_status grn_token_get_status(grn_ctx *ctx,
- grn_token *token);
-GRN_PLUGIN_EXPORT grn_rc grn_token_set_status(grn_ctx *ctx,
- grn_token *token,
- grn_tokenizer_status status);
-
-
/*
grn_tokenizer_token_push() pushes the next token into `token'. Note that
grn_tokenizer_token_push() does not make a copy of the given string. This
means that you have to maintain a memory space allocated to the string.
Also note that the grn_tokenizer_token object must be maintained until the
- request for the next token or finalization comes. See grn_tokenizer_status in
+ request for the next token or finalization comes. See grn_token_status in
this header for more details of `status'.
*/
GRN_PLUGIN_EXPORT void grn_tokenizer_token_push(grn_ctx *ctx, grn_tokenizer_token *token,
const char *str_ptr, unsigned int str_length,
- grn_tokenizer_status status);
+ grn_token_status status);
/*
grn_tokenizer_tokenized_delimiter_next() extracts the next token
@@ -254,4 +259,4 @@ GRN_PLUGIN_EXPORT grn_rc grn_tokenizer_register(grn_ctx *ctx, const char *plugin
} /* extern "C" */
#endif /* __cplusplus */
-#endif /* GRN_PLUGIN_TOKENIZER_H */
+#endif /* GROONGA_TOKENIZER_H */
diff --git a/storage/mroonga/vendor/groonga/lib/util.h b/storage/mroonga/vendor/groonga/include/groonga/util.h
index b4dbb000aed..446cb88f8c3 100644
--- a/storage/mroonga/vendor/groonga/lib/util.h
+++ b/storage/mroonga/vendor/groonga/include/groonga/util.h
@@ -1,9 +1,10 @@
-/* -*- c-basic-offset: 2 -*- */
-/* Copyright(C) 2010-2011 Brazil
+/*
+ Copyright(C) 2010-2014 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.
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -14,35 +15,26 @@
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 GRN_UTIL_H
-#define GRN_UTIL_H
+#ifndef GROONGA_UTIL_H
+#define GROONGA_UTIL_H
-#ifndef GROONGA_IN_H
-#include "groonga_in.h"
-#endif /* GROONGA_IN_H */
-
-#ifndef GRN_CTX_H
-#include "ctx.h"
-#endif /* GRN_CTX_H */
-
-#ifdef __cplusplus
+#ifdef __cplusplus
extern "C" {
#endif
-GRN_API grn_rc grn_normalize_offset_and_limit(grn_ctx *ctx, int size, int *offset, int *limit);
-
GRN_API grn_obj *grn_inspect(grn_ctx *ctx, grn_obj *buffer, grn_obj *obj);
+GRN_API grn_obj *grn_inspect_indented(grn_ctx *ctx, grn_obj *buffer,
+ grn_obj *obj, const char *indent);
GRN_API grn_obj *grn_inspect_name(grn_ctx *ctx, grn_obj *buffer, grn_obj *obj);
GRN_API grn_obj *grn_inspect_encoding(grn_ctx *ctx, grn_obj *buffer, grn_encoding encoding);
GRN_API grn_obj *grn_inspect_type(grn_ctx *ctx, grn_obj *buffer, unsigned char type);
-void grn_p(grn_ctx *ctx, grn_obj *obj);
-void grn_p_geo_point(grn_ctx *ctx, grn_geo_point *point);
-GRN_API const char *grn_win32_base_dir(void);
-GRN_API char *grn_path_separator_to_system(char *dest, char *groonga_path);
+GRN_API void grn_p(grn_ctx *ctx, grn_obj *obj);
+GRN_API void grn_p_geo_point(grn_ctx *ctx, grn_geo_point *point);
+GRN_API void grn_p_ii_values(grn_ctx *ctx, grn_obj *obj);
#ifdef __cplusplus
}
#endif
-#endif /* GRN_UTIL_H */
+#endif /* GROONGA_UTIL_H */
diff --git a/storage/mroonga/vendor/groonga/lib/CMakeLists.txt b/storage/mroonga/vendor/groonga/lib/CMakeLists.txt
index d19c88e4311..8959f883ca3 100644
--- a/storage/mroonga/vendor/groonga/lib/CMakeLists.txt
+++ b/storage/mroonga/vendor/groonga/lib/CMakeLists.txt
@@ -19,7 +19,11 @@ add_definitions(
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/dat
- ${MRUBY_INCLUDE_DIRS})
+ ${ONIGMO_INCLUDE_DIRS}
+ ${MRUBY_INCLUDE_DIRS}
+ ${LIBLZ4_INCLUDE_DIRS})
+link_directories(
+ ${LIBLZ4_LIBRARY_DIRS})
read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/sources.am LIBGROONGA_SOURCES)
read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/dat/sources.am LIBGRNDAT_SOURCES)
@@ -36,44 +40,43 @@ set_source_files_properties(dat.cpp ${LIBGRNDAT_SOURCES}
PROPERTIES
COMPILE_FLAGS "${GRN_CXX_COMPILE_FLAGS}")
-if(MRN_GROONGA_BUNDLED)
- add_library(libgroonga STATIC
- ${LIBGROONGA_SOURCES}
- ${LIBGRNDAT_SOURCES}
- ${LIBGRNMRB_SOURCES}
- ${MRUBY_LIBS})
+set(GRN_ALL_SOURCES
+ ${LIBGROONGA_SOURCES}
+ ${LIBGRNDAT_SOURCES}
+ ${LIBGRNMRB_SOURCES})
+if(GRN_EMBED)
+ add_library(libgroonga STATIC ${GRN_ALL_SOURCES})
+ set_target_properties(
+ libgroonga
+ PROPERTIES
+ POSITION_INDEPENDENT_CODE ON)
else()
- add_library(libgroonga SHARED
- ${LIBGROONGA_SOURCES}
- ${LIBGRNDAT_SOURCES}
- ${LIBGRNMRB_SOURCES}
- ${MRUBY_LIBS})
+ add_library(libgroonga SHARED ${GRN_ALL_SOURCES})
endif()
set_target_properties(libgroonga PROPERTIES OUTPUT_NAME "groonga")
-if(NOT MRN_GROONGA_BUNDLED)
- target_link_libraries(libgroonga
+
+set(GRN_ALL_LIBRARIES
${EXECINFO_LIBS}
${RT_LIBS}
${PTHREAD_LIBS}
${Z_LIBS}
- ${LZO2_LIBS}
+ ${LIBLZ4_LIBRARIES}
${DL_LIBS}
- ${WS2_32_LIBS})
+ ${M_LIBS}
+ ${WS2_32_LIBS}
+ ${MRUBY_LIBS}
+ ${ONIGMO_LIBS})
+if(GRN_EMBED)
+ target_link_libraries(libgroonga
+ ${GRN_ALL_LIBRARIES}
+ ${STDCPP_LIBS})
+else()
+ target_link_libraries(libgroonga
+ ${GRN_ALL_LIBRARIES})
install(TARGETS libgroonga
ARCHIVE DESTINATION "${LIB_DIR}"
LIBRARY DESTINATION "${LIB_DIR}"
RUNTIME DESTINATION "${BIN_DIR}")
-else()
- target_link_libraries(libgroonga
- ${EXECINFO_LIBS}
- ${RT_LIBS}
- ${PTHREAD_LIBS}
- ${Z_LIBS}
- ${LZO2_LIBS}
- ${DL_LIBS}
- ${M_LIBS}
- ${STDCPP_LIBS}
- ${WS2_32_LIBS})
endif()
if(GRN_WITH_MRUBY)
@@ -81,9 +84,39 @@ if(GRN_WITH_MRUBY)
RUBY_SCRIPTS)
string(REGEX REPLACE "([^;]+)" "mrb/scripts/\\1"
RUBY_SCRIPTS "${RUBY_SCRIPTS}")
- if(NOT MRN_GROONGA_BUNDLED)
- install(
- FILES ${RUBY_SCRIPTS}
- DESTINATION "${GRN_RELATIVE_RUBY_SCRIPTS_DIR}")
- endif()
+ install(
+ FILES ${RUBY_SCRIPTS}
+ DESTINATION "${GRN_RELATIVE_RUBY_SCRIPTS_DIR}")
+
+ read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/mrb/scripts/command_line/sources.am
+ COMMANE_LINE_RUBY_SCRIPTS)
+ string(REGEX REPLACE "([^;]+)" "mrb/scripts/command_line/\\1"
+ COMMANE_LINE_RUBY_SCRIPTS "${COMMANE_LINE_RUBY_SCRIPTS}")
+ install(
+ FILES ${COMMANE_LINE_RUBY_SCRIPTS}
+ DESTINATION "${GRN_RELATIVE_RUBY_SCRIPTS_DIR}/command_line")
+
+ read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/mrb/scripts/context/sources.am
+ CONTEXT_RUBY_SCRIPTS)
+ string(REGEX REPLACE "([^;]+)" "mrb/scripts/context/\\1"
+ CONTEXT_RUBY_SCRIPTS "${CONTEXT_RUBY_SCRIPTS}")
+ install(
+ FILES ${CONTEXT_RUBY_SCRIPTS}
+ DESTINATION "${GRN_RELATIVE_RUBY_SCRIPTS_DIR}/context")
+
+ read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/mrb/scripts/initialize/sources.am
+ INITIALIZE_RUBY_SCRIPTS)
+ string(REGEX REPLACE "([^;]+)" "mrb/scripts/initialize/\\1"
+ INITIALIZE_RUBY_SCRIPTS "${INITIALIZE_RUBY_SCRIPTS}")
+ install(
+ FILES ${INITIALIZE_RUBY_SCRIPTS}
+ DESTINATION "${GRN_RELATIVE_RUBY_SCRIPTS_DIR}/initialize")
+
+ read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/mrb/scripts/logger/sources.am
+ LOGGER_RUBY_SCRIPTS)
+ string(REGEX REPLACE "([^;]+)" "mrb/scripts/logger/\\1"
+ LOGGER_RUBY_SCRIPTS "${LOGGER_RUBY_SCRIPTS}")
+ install(
+ FILES ${LOGGER_RUBY_SCRIPTS}
+ DESTINATION "${GRN_RELATIVE_RUBY_SCRIPTS_DIR}/logger")
endif()
diff --git a/storage/mroonga/vendor/groonga/lib/Makefile.am b/storage/mroonga/vendor/groonga/lib/Makefile.am
index 047c41a25da..8f4e76ea212 100644
--- a/storage/mroonga/vendor/groonga/lib/Makefile.am
+++ b/storage/mroonga/vendor/groonga/lib/Makefile.am
@@ -10,8 +10,17 @@ AM_CFLAGS = \
$(COVERAGE_CFLAGS) \
$(GRN_CFLAGS) \
$(MESSAGE_PACK_CFLAGS) \
- $(MRUBY_CFLAGS)
-DEFAULT_INCLUDES = -I$(top_builddir) -I$(top_srcdir)/include
+ $(LIBLZ4_CFLAGS)
+
+BUNDLED_LIBRARIES_CFLAGS = \
+ $(MRUBY_CFLAGS) \
+ $(ONIGMO_CFLAGS)
+
+DEFAULT_INCLUDES = \
+ -I$(top_builddir) \
+ -I$(top_srcdir)/include \
+ $(BUNDLED_LIBRARIES_CFLAGS)
+
DEFS += -D_REENTRANT $(GRN_DEFS) -DGRN_DAT_EXPORT
include sources.am
@@ -24,12 +33,20 @@ libgroonga_la_LDFLAGS = \
libgroonga_la_LIBADD = \
dat/libgrndat.la \
mrb/libgrnmrb.la \
- $(MESSAGE_PACK_LIBS) \
- $(MRUBY_LIBS)
+ $(MESSAGE_PACK_LIBS)
+
+if WITH_MRUBY
+libgroonga_la_LIBADD += \
+ ../vendor/mruby/libmruby.la
+endif
+
+libgroonga_la_LIBADD += \
+ $(ONIGMO_LIBS) \
+ $(LIBLZ4_LIBS)
if WITH_LEMON
BUILT_SOURCES = \
- ecmascript.c
+ grn_ecmascript.c
SUFFIXES = .lemon .c
@@ -38,9 +55,9 @@ SUFFIXES = .lemon .c
endif
EXTRA_DIST = \
- ecmascript.c \
- ecmascript.h \
- ecmascript.lemon \
+ grn_ecmascript.c \
+ grn_ecmascript.h \
+ grn_ecmascript.lemon \
CMakeLists.txt
CLEANFILES = *.gcno *.gcda
diff --git a/storage/mroonga/vendor/groonga/lib/com.c b/storage/mroonga/vendor/groonga/lib/com.c
index 172ad91ed1e..eb1cacfd4c1 100644
--- a/storage/mroonga/vendor/groonga/lib/com.c
+++ b/storage/mroonga/vendor/groonga/lib/com.c
@@ -15,11 +15,11 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "groonga_in.h"
+#include "grn.h"
#include <stdio.h>
#include <string.h>
-#include "ctx_impl.h"
+#include "grn_ctx_impl.h"
#ifdef WIN32
# include <ws2tcpip.h>
@@ -38,8 +38,8 @@
# endif /* HAVE_SIGNAL_H */
#endif /* WIN32 */
-#include "ctx.h"
-#include "com.h"
+#include "grn_ctx.h"
+#include "grn_com.h"
#ifndef PF_INET
#define PF_INET AF_INET
@@ -193,7 +193,7 @@ grn_msg_send(grn_ctx *ctx, grn_obj *msg, int flags)
{
ssize_t ret;
ret = send(peer->fd, GRN_BULK_HEAD(msg), GRN_BULK_VSIZE(msg), MSG_NOSIGNAL);
- if (ret == -1) { SERR("send"); }
+ if (ret == -1) { SOERR("send"); }
if (ctx->rc != GRN_OPERATION_WOULD_BLOCK) {
grn_com_queue_enque(ctx, m->old, (grn_com_queue_entry *)msg);
return ctx->rc;
@@ -251,7 +251,7 @@ grn_com_init(void)
WSADATA wd;
if (WSAStartup(MAKEWORD(2, 0), &wd) != 0) {
grn_ctx *ctx = &grn_gctx;
- SERR("WSAStartup");
+ SOERR("WSAStartup");
}
#else /* WIN32 */
#ifndef USE_MSG_NOSIGNAL
@@ -281,7 +281,7 @@ grn_com_event_init(grn_ctx *ctx, grn_com_event *ev, int max_nevents, int data_si
COND_INIT(ev->cond);
GRN_COM_QUEUE_INIT(&ev->recv_old);
#ifndef USE_SELECT
-#ifdef USE_EPOLL
+# ifdef USE_EPOLL
if ((ev->events = GRN_MALLOC(sizeof(struct epoll_event) * max_nevents))) {
if ((ev->epfd = epoll_create(max_nevents)) != -1) {
goto exit;
@@ -290,8 +290,8 @@ grn_com_event_init(grn_ctx *ctx, grn_com_event *ev, int max_nevents, int data_si
}
GRN_FREE(ev->events);
}
-#else /* USE_EPOLL */
-#ifdef USE_KQUEUE
+# else /* USE_EPOLL */
+# ifdef USE_KQUEUE
if ((ev->events = GRN_MALLOC(sizeof(struct kevent) * max_nevents))) {
if ((ev->kqfd = kqueue()) != -1) {
goto exit;
@@ -300,17 +300,17 @@ grn_com_event_init(grn_ctx *ctx, grn_com_event *ev, int max_nevents, int data_si
}
GRN_FREE(ev->events);
}
-#else /* USE_KQUEUE */
+# else /* USE_KQUEUE */
if ((ev->events = GRN_MALLOC(sizeof(struct pollfd) * max_nevents))) {
goto exit;
}
-#endif /* USE_KQUEUE*/
-#endif /* USE_EPOLL */
+# endif /* USE_KQUEUE*/
+# endif /* USE_EPOLL */
grn_hash_close(ctx, ev->hash);
ev->hash = NULL;
ev->events = NULL;
#else /* USE_SELECT */
-
+ goto exit;
#endif /* USE_SELECT */
}
exit :
@@ -327,12 +327,12 @@ grn_com_event_fin(grn_ctx *ctx, grn_com_event *ev)
if (ev->hash) { grn_hash_close(ctx, ev->hash); }
#ifndef USE_SELECT
if (ev->events) { GRN_FREE(ev->events); }
-#ifdef USE_EPOLL
- GRN_CLOSE(ev->epfd);
-#endif /* USE_EPOLL */
-#ifdef USE_KQUEUE
- GRN_CLOSE(ev->kqfd);
-#endif /* USE_KQUEUE*/
+# ifdef USE_EPOLL
+ grn_close(ev->epfd);
+# endif /* USE_EPOLL */
+# ifdef USE_KQUEUE
+ grn_close(ev->kqfd);
+# endif /* USE_KQUEUE*/
#endif /* USE_SELECT */
return GRN_SUCCESS;
}
@@ -387,7 +387,10 @@ grn_com_event_mod(grn_ctx *ctx, grn_com_event *ev, grn_sock fd, int events, grn_
if (!ev) { return GRN_INVALID_ARGUMENT; }
if (grn_hash_get(ctx, ev->hash, &fd, sizeof(grn_sock), (void **)&c)) {
if (c->fd != fd) {
- GRN_LOG(ctx, GRN_LOG_ERROR, "grn_com_event_mod fd unmatch %d != %d", c->fd, fd);
+ GRN_LOG(ctx, GRN_LOG_ERROR,
+ "grn_com_event_mod fd unmatch "
+ "%" GRN_FMT_SOCKET " != %" GRN_FMT_SOCKET,
+ c->fd, fd);
return GRN_OBJECT_CORRUPT;
}
if (com) { *com = c; }
@@ -449,7 +452,9 @@ grn_com_event_del(grn_ctx *ctx, grn_com_event *ev, grn_sock fd)
#endif /* USE_KQUEUE */
return grn_hash_delete_by_id(ctx, ev->hash, id, NULL);
} else {
- GRN_LOG(ctx, GRN_LOG_ERROR, "%04x| fd(%d) not found in ev(%p)", getpid(), fd, ev);
+ GRN_LOG(ctx, GRN_LOG_ERROR,
+ "%04x| fd(%" GRN_FMT_SOCKET ") not found in ev(%p)",
+ getpid(), fd, ev);
return GRN_INVALID_ARGUMENT;
}
}
@@ -469,7 +474,7 @@ grn_com_event_start_accept(grn_ctx *ctx, grn_com_event *ev)
if (listen(com->fd, LISTEN_BACKLOG) == 0) {
com->accepting = GRN_TRUE;
} else {
- SERR("listen - start accept");
+ SOERR("listen - start accept");
}
}
GRN_API_RETURN(ctx->rc);
@@ -487,7 +492,7 @@ grn_com_event_stop_accept(grn_ctx *ctx, grn_com_event *ev)
if (listen(com->fd, 0) == 0) {
com->accepting = GRN_FALSE;
} else {
- SERR("listen - disable accept");
+ SOERR("listen - disable accept");
}
}
GRN_API_RETURN(ctx->rc);
@@ -505,7 +510,7 @@ grn_com_receiver(grn_ctx *ctx, grn_com *com)
if (errno == EMFILE) {
grn_com_event_stop_accept(ctx, ev);
} else {
- SERR("accept");
+ SOERR("accept");
}
return;
}
@@ -523,7 +528,7 @@ grn_com_receiver(grn_ctx *ctx, grn_com *com)
grn_msg *msg = (grn_msg *)grn_msg_open(ctx, com, &ev->recv_old);
grn_com_recv(ctx, msg->u.peer, &msg->header, (grn_obj *)msg);
if (msg->u.peer /* is_edge_request(msg)*/) {
- memcpy(&msg->edge_id, &ev->curr_edge_id, sizeof(grn_com_addr));
+ grn_memcpy(&msg->edge_id, &ev->curr_edge_id, sizeof(grn_com_addr));
if (!com->has_sid) {
com->has_sid = 1;
com->sid = ev->curr_edge_id.sid++;
@@ -555,14 +560,29 @@ grn_com_event_poll(grn_ctx *ctx, grn_com_event *ev, int timeout)
FD_ZERO(&wfds);
ctx->errlvl = GRN_OK;
ctx->rc = GRN_SUCCESS;
- GRN_HASH_EACH(ctx, ev->hash, eh, &pfd, &dummy, &com, {
- if ((com->events & GRN_COM_POLLIN)) { FD_SET(*pfd, &rfds); }
- if ((com->events & GRN_COM_POLLOUT)) { FD_SET(*pfd, &wfds); }
- if (*pfd > nfds) { nfds = *pfd; }
- });
+ {
+ grn_hash_cursor *cursor;
+ cursor = grn_hash_cursor_open(ctx, ev->hash, NULL, 0, NULL, 0, 0, -1, 0);
+ if (cursor) {
+ grn_id id;
+ while ((id = grn_hash_cursor_next(ctx, cursor))) {
+ grn_hash_cursor_get_key_value(ctx,
+ cursor,
+ (void **)(&pfd),
+ &dummy,
+ (void **)(&com));
+ if ((com->events & GRN_COM_POLLIN)) { FD_SET(*pfd, &rfds); }
+ if ((com->events & GRN_COM_POLLOUT)) { FD_SET(*pfd, &wfds); }
+# ifndef WIN32
+ if (*pfd > nfds) { nfds = *pfd; }
+# endif /* WIN32 */
+ }
+ grn_hash_cursor_close(ctx, cursor);
+ }
+ }
nevents = select(nfds + 1, &rfds, &wfds, NULL, (timeout >= 0) ? &tv : NULL);
if (nevents < 0) {
- SERR("select");
+ SOERR("select");
if (ctx->rc == GRN_INTERRUPTED_FUNCTION_CALL) { ERRCLR(ctx); }
return ctx->rc;
}
@@ -571,7 +591,7 @@ grn_com_event_poll(grn_ctx *ctx, grn_com_event *ev, int timeout)
if (FD_ISSET(*pfd, &rfds)) { grn_com_receiver(ctx, com); }
});
#else /* USE_SELECT */
-#ifdef USE_EPOLL
+# ifdef USE_EPOLL
struct epoll_event *ep;
ctx->errlvl = GRN_OK;
ctx->rc = GRN_SUCCESS;
@@ -579,8 +599,8 @@ grn_com_event_poll(grn_ctx *ctx, grn_com_event *ev, int timeout)
if (nevents < 0) {
SERR("epoll_wait");
}
-#else /* USE_EPOLL */
-#ifdef USE_KQUEUE
+# else /* USE_EPOLL */
+# ifdef USE_KQUEUE
struct kevent *ep;
struct timespec tv;
if (timeout >= 0) {
@@ -591,7 +611,7 @@ grn_com_event_poll(grn_ctx *ctx, grn_com_event *ev, int timeout)
if (nevents < 0) {
SERR("kevent");
}
-#else /* USE_KQUEUE */
+# else /* USE_KQUEUE */
uint32_t dummy;
int nfd = 0, *pfd;
struct pollfd *ep = ev->events;
@@ -609,8 +629,8 @@ grn_com_event_poll(grn_ctx *ctx, grn_com_event *ev, int timeout)
if (nevents < 0) {
SERR("poll");
}
-#endif /* USE_KQUEUE */
-#endif /* USE_EPOLL */
+# endif /* USE_KQUEUE */
+# endif /* USE_EPOLL */
if (ctx->rc != GRN_SUCCESS) {
if (ctx->rc == GRN_INTERRUPTED_FUNCTION_CALL) {
ERRCLR(ctx);
@@ -620,7 +640,7 @@ grn_com_event_poll(grn_ctx *ctx, grn_com_event *ev, int timeout)
if (timeout < 0 && !nevents) { GRN_LOG(ctx, GRN_LOG_NOTICE, "poll returns 0 events"); }
for (ep = ev->events; nevents; ep++) {
int efd;
-#ifdef USE_EPOLL
+# ifdef USE_EPOLL
efd = ep->data.fd;
nevents--;
// todo : com = ep->data.ptr;
@@ -631,12 +651,12 @@ grn_com_event_poll(grn_ctx *ctx, grn_com_event *ev, int timeout)
e.data.fd = efd;
e.events = ep->events;
if (epoll_ctl(ev->epfd, EPOLL_CTL_DEL, efd, &e) == -1) { SERR("epoll_ctl"); }
- if (grn_sock_close(efd) == -1) { SERR("close"); }
+ if (grn_sock_close(efd) == -1) { SOERR("close"); }
continue;
}
if ((ep->events & GRN_COM_POLLIN)) { grn_com_receiver(ctx, com); }
-#else /* USE_EPOLL */
-#ifdef USE_KQUEUE
+# else /* USE_EPOLL */
+# ifdef USE_KQUEUE
efd = ep->ident;
nevents--;
// todo : com = ep->udata;
@@ -645,22 +665,22 @@ grn_com_event_poll(grn_ctx *ctx, grn_com_event *ev, int timeout)
GRN_LOG(ctx, GRN_LOG_ERROR, "fd(%d) not found in ev->set", efd);
EV_SET(&e, efd, ep->filter, EV_DELETE, 0, 0, NULL);
if (kevent(ev->kqfd, &e, 1, NULL, 0, NULL) == -1) { SERR("kevent"); }
- if (grn_sock_close(efd) == -1) { SERR("close"); }
+ if (grn_sock_close(efd) == -1) { SOERR("close"); }
continue;
}
if ((ep->filter == GRN_COM_POLLIN)) { grn_com_receiver(ctx, com); }
-#else
+# else
efd = ep->fd;
if (!(ep->events & ep->revents)) { continue; }
nevents--;
if (!grn_hash_get(ctx, ev->hash, &efd, sizeof(grn_sock), (void *)&com)) {
GRN_LOG(ctx, GRN_LOG_ERROR, "fd(%d) not found in ev->hash", efd);
- if (grn_sock_close(efd) == -1) { SERR("close"); }
+ if (grn_sock_close(efd) == -1) { SOERR("close"); }
continue;
}
if ((ep->revents & GRN_COM_POLLIN)) { grn_com_receiver(ctx, com); }
-#endif /* USE_KQUEUE */
-#endif /* USE_EPOLL */
+# endif /* USE_KQUEUE */
+# endif /* USE_EPOLL */
}
#endif /* USE_SELECT */
/* todo :
@@ -682,7 +702,7 @@ grn_com_send_http(grn_ctx *ctx, grn_com *cs, const char *path, uint32_t path_len
GRN_TEXT_PUTS(ctx, &buf, " HTTP/1.0\r\n\r\n");
// todo : refine
if ((ret = send(cs->fd, GRN_BULK_HEAD(&buf), GRN_BULK_VSIZE(&buf), MSG_NOSIGNAL|flags)) == -1) {
- SERR("send");
+ SOERR("send");
}
if (ret != GRN_BULK_VSIZE(&buf)) {
GRN_LOG(ctx, GRN_LOG_NOTICE, "send %d != %d", (int)ret, (int)GRN_BULK_VSIZE(&buf));
@@ -710,7 +730,7 @@ grn_com_send(grn_ctx *ctx, grn_com *cs,
wsabufs[1].buf = (char *)body;
wsabufs[1].len = size;
if (WSASend(cs->fd, wsabufs, 2, &n_sent, 0, NULL, NULL) == SOCKET_ERROR) {
- SERR("WSASend");
+ SOERR("WSASend");
}
ret = n_sent;
#else /* WIN32 */
@@ -728,18 +748,19 @@ grn_com_send(grn_ctx *ctx, grn_com *cs,
msg_iov[1].iov_base = (char *)body;
msg_iov[1].iov_len = size;
if ((ret = sendmsg(cs->fd, &msg, MSG_NOSIGNAL|flags)) == -1) {
- SERR("sendmsg");
+ SOERR("sendmsg");
rc = ctx->rc;
}
#endif /* WIN32 */
} else {
if ((ret = send(cs->fd, (const void *)header, whole_size, MSG_NOSIGNAL|flags)) == -1) {
- SERR("send");
+ SOERR("send");
rc = ctx->rc;
}
}
if (ret != whole_size) {
- GRN_LOG(ctx, GRN_LOG_ERROR, "sendmsg(%d): %" GRN_FMT_LLD " < %" GRN_FMT_LLU,
+ GRN_LOG(ctx, GRN_LOG_ERROR,
+ "sendmsg(%" GRN_FMT_SOCKET "): %" GRN_FMT_LLD " < %" GRN_FMT_LLU,
cs->fd, (long long int)ret, (unsigned long long int)whole_size);
rc = ctx->rc;
}
@@ -781,7 +802,7 @@ grn_com_recv_text(grn_ctx *ctx, grn_com *com,
for (;;) {
if (grn_bulk_reserve(ctx, buf, BUFSIZE)) { return ctx->rc; }
if ((ret = recv(com->fd, GRN_BULK_CURR(buf), BUFSIZE, 0)) < 0) {
- SERR("recv text");
+ SOERR("recv text");
if (ctx->rc == GRN_OPERATION_WOULD_BLOCK ||
ctx->rc == GRN_INTERRUPTED_FUNCTION_CALL) {
ERRCLR(ctx);
@@ -813,7 +834,7 @@ exit :
GRN_BULK_REWIND(buf);
grn_bulk_reserve(ctx, buf, BUFSIZE);
if ((ret = recv(com->fd, GRN_BULK_CURR(buf), BUFSIZE, 0)) < 0) {
- SERR("recv text body");
+ SOERR("recv text body");
} else {
GRN_BULK_CURR(buf) += ret;
}
@@ -831,8 +852,8 @@ grn_com_recv(grn_ctx *ctx, grn_com *com, grn_com_header *header, grn_obj *buf)
size_t rest = sizeof(grn_com_header);
do {
if ((ret = recv(com->fd, p, rest, 0)) < 0) {
- SERR("recv size");
- GRN_LOG(ctx, GRN_LOG_ERROR, "recv error (%d)", com->fd);
+ SOERR("recv size");
+ GRN_LOG(ctx, GRN_LOG_ERROR, "recv error (%" GRN_FMT_SOCKET ")", com->fd);
if (ctx->rc == GRN_OPERATION_WOULD_BLOCK ||
ctx->rc == GRN_INTERRUPTED_FUNCTION_CALL) {
ERRCLR(ctx);
@@ -852,7 +873,14 @@ grn_com_recv(grn_ctx *ctx, grn_com *com, grn_com_header *header, grn_obj *buf)
}
}
} while (rest);
- GRN_LOG(ctx, GRN_LOG_INFO, "recv (%d,%x,%d,%02x,%02x,%04x)", ntohl(header->size), header->flags, header->proto, header->qtype, header->level, header->status);
+ GRN_LOG(ctx, GRN_LOG_INFO,
+ "recv (%u,%x,%d,%02x,%02x,%04x)",
+ (uint32_t)ntohl(header->size),
+ header->flags,
+ header->proto,
+ header->qtype,
+ header->level,
+ header->status);
{
uint8_t proto = header->proto;
size_t value_size = ntohl(header->size);
@@ -868,7 +896,7 @@ grn_com_recv(grn_ctx *ctx, grn_com *com, grn_com_header *header, grn_obj *buf)
retry = 0;
for (rest = value_size; rest;) {
if ((ret = recv(com->fd, GRN_BULK_CURR(buf), rest, MSG_WAITALL)) < 0) {
- SERR("recv body");
+ SOERR("recv body");
if (ctx->rc == GRN_OPERATION_WOULD_BLOCK ||
ctx->rc == GRN_INTERRUPTED_FUNCTION_CALL) {
ERRCLR(ctx);
@@ -913,7 +941,8 @@ grn_com_copen(grn_ctx *ctx, grn_com_event *ev, const char *dest, int port)
#ifdef AI_NUMERICSERV
hints.ai_flags = AI_NUMERICSERV;
#endif
- snprintf(port_string, sizeof(port_string), "%d", port);
+ grn_snprintf(port_string, sizeof(port_string), sizeof(port_string),
+ "%d", port);
getaddrinfo_result = getaddrinfo(dest, port_string, &hints, &addrinfo_list);
if (getaddrinfo_result != 0) {
@@ -926,7 +955,7 @@ grn_com_copen(grn_ctx *ctx, grn_com_event *ev, const char *dest, int port)
#endif
#ifdef EAI_SYSTEM
case EAI_SYSTEM:
- SERR("getaddrinfo");
+ SOERR("getaddrinfo");
break;
#endif
default:
@@ -943,12 +972,13 @@ grn_com_copen(grn_ctx *ctx, grn_com_event *ev, const char *dest, int port)
fd = socket(addrinfo_ptr->ai_family, addrinfo_ptr->ai_socktype,
addrinfo_ptr->ai_protocol);
if (fd == -1) {
- SERR("socket");
- } else if (setsockopt(fd, 6, TCP_NODELAY, &value, sizeof(value))) {
- SERR("setsockopt");
+ SOERR("socket");
+ } else if (setsockopt(fd, 6, TCP_NODELAY,
+ (const char *)&value, sizeof(value))) {
+ SOERR("setsockopt");
grn_sock_close(fd);
} else if (connect(fd, addrinfo_ptr->ai_addr, addrinfo_ptr->ai_addrlen)) {
- SERR("connect");
+ SOERR("connect");
grn_sock_close(fd);
} else {
break;
@@ -981,9 +1011,9 @@ void
grn_com_close_(grn_ctx *ctx, grn_com *com)
{
grn_sock fd = com->fd;
- if (shutdown(fd, SHUT_RDWR) == -1) { /* SERR("shutdown"); */ }
+ if (shutdown(fd, SHUT_RDWR) == -1) { /* SOERR("shutdown"); */ }
if (grn_sock_close(fd) == -1) {
- SERR("close");
+ SOERR("close");
} else {
com->closed = 1;
}
@@ -1020,7 +1050,8 @@ grn_com_sopen(grn_ctx *ctx, grn_com_event *ev,
if (!bind_address) {
bind_address = "0.0.0.0";
}
- snprintf(port_string, sizeof(port_string), "%d", port);
+ grn_snprintf(port_string, sizeof(port_string), sizeof(port_string),
+ "%d", port);
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = PF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
@@ -1040,7 +1071,7 @@ grn_com_sopen(grn_ctx *ctx, grn_com_event *ev,
#endif
#ifdef EAI_SYSTEM
case EAI_SYSTEM:
- SERR("getaddrinfo");
+ SOERR("getaddrinfo");
break;
#endif
default:
@@ -1052,29 +1083,29 @@ grn_com_sopen(grn_ctx *ctx, grn_com_event *ev,
goto exit;
}
if ((lfd = socket(bind_address_info->ai_family, SOCK_STREAM, 0)) == -1) {
- SERR("socket");
+ SOERR("socket");
goto exit;
}
- memcpy(&ev->curr_edge_id.addr, he->h_addr, he->h_length);
+ grn_memcpy(&ev->curr_edge_id.addr, he->h_addr, he->h_length);
ev->curr_edge_id.port = htons(port);
ev->curr_edge_id.sid = 0;
{
int v = 1;
if (setsockopt(lfd, SOL_TCP, TCP_NODELAY, (void *) &v, sizeof(int)) == -1) {
- SERR("setsockopt");
+ SOERR("setsockopt");
goto exit;
}
if (setsockopt(lfd, SOL_SOCKET, SO_REUSEADDR, (void *) &v, sizeof(int)) == -1) {
- SERR("setsockopt");
+ SOERR("setsockopt");
goto exit;
}
}
if (bind(lfd, bind_address_info->ai_addr, bind_address_info->ai_addrlen) < 0) {
- SERR("bind");
+ SOERR("bind");
goto exit;
}
if (listen(lfd, LISTEN_BACKLOG) < 0) {
- SERR("listen");
+ SOERR("listen");
goto exit;
}
if (ev) {
diff --git a/storage/mroonga/vendor/groonga/lib/command.c b/storage/mroonga/vendor/groonga/lib/command.c
new file mode 100644
index 00000000000..e4be0d1ff92
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/command.c
@@ -0,0 +1,194 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2015 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
+*/
+
+#include <string.h>
+
+#include "grn.h"
+#include "grn_db.h"
+#include "grn_ctx_impl.h"
+
+struct _grn_command_input {
+ grn_obj *command;
+ grn_hash *arguments;
+};
+
+grn_command_input *
+grn_command_input_open(grn_ctx *ctx, grn_obj *command)
+{
+ grn_command_input *input = NULL;
+
+ GRN_API_ENTER;
+ input = GRN_MALLOC(sizeof(grn_command_input));
+ if (!input) {
+ ERR(GRN_NO_MEMORY_AVAILABLE,
+ "[command-input] failed to allocate grn_command_input");
+ goto exit;
+ }
+
+ input->command = command;
+ /* TODO: Allocate by self. */
+ {
+ uint32_t n;
+ input->arguments = grn_expr_get_vars(ctx, input->command, &n);
+ }
+
+exit :
+ GRN_API_RETURN(input);
+}
+
+grn_rc
+grn_command_input_close(grn_ctx *ctx, grn_command_input *input)
+{
+ GRN_API_ENTER;
+
+ /* TODO: Free input->arguments by self. */
+ /* grn_expr_clear_vars(ctx, input->command); */
+ GRN_FREE(input);
+
+ GRN_API_RETURN(ctx->rc);
+}
+
+grn_obj *
+grn_command_input_add(grn_ctx *ctx,
+ grn_command_input *input,
+ const char *name,
+ int name_size,
+ grn_bool *added)
+{
+ grn_obj *argument = NULL;
+ /* TODO: Use grn_bool */
+ int internal_added = GRN_FALSE;
+
+ GRN_API_ENTER;
+
+ if (name_size == -1) {
+ name_size = strlen(name);
+ }
+ if (input->arguments) {
+ grn_hash_add(ctx, input->arguments, name, name_size, (void **)&argument,
+ &internal_added);
+ if (internal_added) {
+ GRN_TEXT_INIT(argument, 0);
+ }
+ }
+ if (added) {
+ *added = internal_added;
+ }
+
+ GRN_API_RETURN(argument);
+}
+
+grn_obj *
+grn_command_input_get(grn_ctx *ctx,
+ grn_command_input *input,
+ const char *name,
+ int name_size)
+{
+ grn_obj *argument = NULL;
+
+ GRN_API_ENTER;
+
+ if (name_size == -1) {
+ name_size = strlen(name);
+ }
+ if (input->arguments) {
+ grn_hash_get(ctx, input->arguments, name, name_size, (void **)&argument);
+ }
+
+ GRN_API_RETURN(argument);
+}
+
+grn_obj *
+grn_command_input_at(grn_ctx *ctx,
+ grn_command_input *input,
+ unsigned int offset)
+{
+ grn_obj *argument = NULL;
+
+ GRN_API_ENTER;
+ if (input->arguments) {
+ uint32_t size;
+ argument = (grn_obj *)grn_hash_get_value_(ctx, input->arguments,
+ offset + 1, &size);
+ }
+ GRN_API_RETURN(argument);
+}
+
+grn_rc
+grn_command_register(grn_ctx *ctx,
+ const char *command_name,
+ int command_name_size,
+ grn_command_run_func *run,
+ grn_expr_var *vars,
+ unsigned int n_vars,
+ void *user_data)
+{
+ GRN_API_ENTER;
+
+ if (command_name_size == -1) {
+ command_name_size = strlen(command_name);
+ }
+
+ {
+ grn_obj *command_object;
+ command_object = grn_proc_create(ctx,
+ command_name,
+ command_name_size,
+ GRN_PROC_COMMAND,
+ NULL, NULL, NULL, n_vars, vars);
+ if (!command_object) {
+ GRN_PLUGIN_ERROR(ctx, GRN_COMMAND_ERROR,
+ "[command][%.*s] failed to grn_proc_create()",
+ command_name_size, command_name);
+ GRN_API_RETURN(ctx->rc);
+ }
+
+ {
+ grn_proc *command = (grn_proc *)command_object;
+ command->callbacks.command.run = run;
+ command->user_data = user_data;
+ }
+ }
+
+ GRN_API_RETURN(GRN_SUCCESS);
+}
+
+grn_rc
+grn_command_run(grn_ctx *ctx,
+ grn_obj *command,
+ grn_command_input *input)
+{
+ grn_proc *proc;
+
+ GRN_API_ENTER;
+
+ proc = (grn_proc *)command;
+ if (proc->callbacks.command.run) {
+ proc->callbacks.command.run(ctx, command, input, proc->user_data);
+ } else {
+ /* TODO: REMOVE ME. For backward compatibility. */
+ uint32_t stack_curr = ctx->impl->stack_curr;
+ grn_proc_call(ctx, command, 0, command);
+ if (ctx->impl->stack_curr > stack_curr) {
+ grn_ctx_pop(ctx);
+ }
+ }
+
+ GRN_API_RETURN(ctx->rc);
+}
+
diff --git a/storage/mroonga/vendor/groonga/lib/ctx.c b/storage/mroonga/vendor/groonga/lib/ctx.c
index a419081635f..85878036dc2 100644
--- a/storage/mroonga/vendor/groonga/lib/ctx.c
+++ b/storage/mroonga/vendor/groonga/lib/ctx.c
@@ -1,6 +1,6 @@
/* -*- c-basic-offset: 2 -*- */
/*
- Copyright(C) 2009-2014 Brazil
+ Copyright(C) 2009-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,23 +16,37 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "groonga_in.h"
+#include "grn.h"
#include <string.h>
-#include "token.h"
-#include "ctx_impl.h"
-#include "pat.h"
-#include "plugin_in.h"
-#include "snip.h"
-#include "output.h"
-#include "normalizer_in.h"
-#include "ctx_impl_mrb.h"
+#include "grn_request_canceler.h"
+#include "grn_tokenizers.h"
+#include "grn_ctx_impl.h"
+#include "grn_pat.h"
+#include "grn_plugin.h"
+#include "grn_snip.h"
+#include "grn_output.h"
+#include "grn_normalizer.h"
+#include "grn_ctx_impl_mrb.h"
+#include "grn_logger.h"
#include <stdio.h>
#include <stdarg.h>
#include <time.h>
#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
+# include <netinet/in.h>
#endif /* HAVE_NETINET_IN_H */
+#ifdef WIN32
+# include <share.h>
+#endif /* WIN32 */
+
+#if defined(HAVE__LOCALTIME64_S) && defined(__GNUC__)
+# ifdef _WIN64
+# define localtime_s(tm, time) _localtime64_s(tm, time)
+# else /* _WIN64 */
+# define localtime_s(tm, time) _localtime32_s(tm, time)
+# endif /* _WIN64 */
+#endif /* defined(HAVE__LOCALTIME64_S) && defined(__GNUC__) */
+
#define GRN_CTX_INITIALIZER(enc) \
{ GRN_SUCCESS, 0, enc, 0, GRN_LOG_NOTICE,\
GRN_CTX_FIN, 0, 0, 0, 0, {0}, NULL, NULL, NULL, NULL, NULL }
@@ -128,24 +142,48 @@ grn_time_now(grn_ctx *ctx, grn_obj *obj)
GRN_TIME_NSEC_TO_USEC(tv.tv_nsec)));
}
-grn_rc
-grn_timeval2str(grn_ctx *ctx, grn_timeval *tv, char *buf)
+struct tm *
+grn_timeval2tm(grn_ctx *ctx, grn_timeval *tv, struct tm *tm_buffer)
{
struct tm *ltm;
-#ifdef HAVE_LOCALTIME_R
- struct tm tm;
+ const char *function_name;
+#ifdef HAVE__LOCALTIME64_S
time_t t = tv->tv_sec;
- ltm = localtime_r(&t, &tm);
-#else /* HAVE_LOCALTIME_R */
+ function_name = "localtime_s";
+ ltm = (localtime_s(tm_buffer, &t) == 0) ? tm_buffer : NULL;
+#else /* HAVE__LOCALTIME64_S */
+# ifdef HAVE_LOCALTIME_R
+ time_t t = tv->tv_sec;
+ function_name = "localtime_r";
+ ltm = localtime_r(&t, tm_buffer);
+# else /* HAVE_LOCALTIME_R */
time_t tvsec = (time_t) tv->tv_sec;
+ function_name = "localtime";
ltm = localtime(&tvsec);
-#endif /* HAVE_LOCALTIME_R */
- if (!ltm) { SERR("localtime"); }
- snprintf(buf, GRN_TIMEVAL_STR_SIZE - 1, GRN_TIMEVAL_STR_FORMAT,
- ltm->tm_year + 1900, ltm->tm_mon + 1, ltm->tm_mday,
- ltm->tm_hour, ltm->tm_min, ltm->tm_sec,
- (int)(GRN_TIME_NSEC_TO_USEC(tv->tv_nsec)));
- buf[GRN_TIMEVAL_STR_SIZE - 1] = '\0';
+# endif /* HAVE_LOCALTIME_R */
+#endif /* HAVE__LOCALTIME64_S */
+ if (!ltm) {
+ SERR(function_name);
+ }
+ return ltm;
+}
+
+grn_rc
+grn_timeval2str(grn_ctx *ctx, grn_timeval *tv, char *buf, size_t buf_size)
+{
+ struct tm tm;
+ struct tm *ltm;
+ ltm = grn_timeval2tm(ctx, tv, &tm);
+ grn_snprintf(buf, buf_size, GRN_TIMEVAL_STR_SIZE,
+ GRN_TIMEVAL_STR_FORMAT,
+ ltm->tm_year + 1900, ltm->tm_mon + 1, ltm->tm_mday,
+ ltm->tm_hour, ltm->tm_min, ltm->tm_sec,
+ (int)(GRN_TIME_NSEC_TO_USEC(tv->tv_nsec)));
+ if (buf_size > GRN_TIMEVAL_STR_SIZE) {
+ buf[GRN_TIMEVAL_STR_SIZE - 1] = '\0';
+ } else {
+ buf[buf_size - 1] = '\0';
+ }
return ctx->rc;
}
@@ -224,7 +262,7 @@ grn_alloc_info_set_backtrace(char *buffer, size_t size)
if (symbol_length + 2 > rest) {
break;
}
- memcpy(buffer, symbols[i], symbol_length);
+ grn_memcpy(buffer, symbols[i], symbol_length);
buffer += symbol_length;
rest -= symbol_length;
buffer[0] = '\n';
@@ -241,7 +279,7 @@ grn_alloc_info_set_backtrace(char *buffer, size_t size)
}
inline static void
-grn_alloc_info_add(void *address)
+grn_alloc_info_add(void *address, const char *file, int line, const char *func)
{
grn_ctx *ctx;
grn_alloc_info *new_alloc_info;
@@ -254,6 +292,17 @@ grn_alloc_info_add(void *address)
new_alloc_info->freed = GRN_FALSE;
grn_alloc_info_set_backtrace(new_alloc_info->alloc_backtrace,
sizeof(new_alloc_info->alloc_backtrace));
+ if (file) {
+ new_alloc_info->file = strdup(file);
+ } else {
+ new_alloc_info->file = NULL;
+ }
+ new_alloc_info->line = line;
+ if (func) {
+ new_alloc_info->func = strdup(func);
+ } else {
+ new_alloc_info->func = NULL;
+ }
new_alloc_info->next = ctx->impl->alloc_info;
ctx->impl->alloc_info = new_alloc_info;
}
@@ -291,8 +340,13 @@ grn_alloc_info_dump(grn_ctx *ctx)
if (alloc_info->freed) {
printf("address[%d][freed]: %p\n", i, alloc_info->address);
} else {
- printf("address[%d][not-freed]: %p:\n%s",
- i, alloc_info->address, alloc_info->alloc_backtrace);
+ printf("address[%d][not-freed]: %p: %s:%d: %s()\n%s",
+ i,
+ alloc_info->address,
+ alloc_info->file ? alloc_info->file : "(unknown)",
+ alloc_info->line,
+ alloc_info->func ? alloc_info->func : "(unknown)",
+ alloc_info->alloc_backtrace);
}
i++;
}
@@ -340,13 +394,15 @@ grn_alloc_info_free(grn_ctx *ctx)
grn_alloc_info *current_alloc_info = alloc_info;
alloc_info = alloc_info->next;
current_alloc_info->next = NULL;
+ free(current_alloc_info->file);
+ free(current_alloc_info->func);
free(current_alloc_info);
}
ctx->impl->alloc_info = NULL;
}
#else /* USE_MEMORY_DEBUG */
-# define grn_alloc_info_add(address)
+# define grn_alloc_info_add(address, file, line, func)
# define grn_alloc_info_change(old_address, new_address)
# define grn_alloc_info_check(address)
# define grn_alloc_info_dump(ctx)
@@ -372,17 +428,17 @@ int grn_fmalloc_line = 0;
static void
grn_ctx_impl_init_malloc(grn_ctx *ctx)
{
-# ifdef USE_FAIL_MALLOC
+# ifdef USE_FAIL_MALLOC
ctx->impl->malloc_func = grn_malloc_fail;
ctx->impl->calloc_func = grn_calloc_fail;
ctx->impl->realloc_func = grn_realloc_fail;
ctx->impl->strdup_func = grn_strdup_fail;
-# else
+# else
ctx->impl->malloc_func = grn_malloc_default;
ctx->impl->calloc_func = grn_calloc_default;
ctx->impl->realloc_func = grn_realloc_default;
ctx->impl->strdup_func = grn_strdup_default;
-# endif
+# endif
}
#endif
@@ -423,8 +479,8 @@ grn_ctx_loader_clear(grn_ctx *ctx)
#define IMPL_SIZE ((sizeof(struct _grn_ctx_impl) + (grn_pagesize - 1)) & ~(grn_pagesize - 1))
#ifdef GRN_WITH_MESSAGE_PACK
-static inline int
-grn_msgpack_buffer_write(void *data, const char *buf, unsigned int len)
+static int
+grn_msgpack_buffer_write(void *data, const char *buf, msgpack_size_t len)
{
grn_ctx *ctx = (grn_ctx *)data;
return grn_bulk_write(ctx, ctx->impl->outbuf, buf, len);
@@ -434,7 +490,6 @@ grn_msgpack_buffer_write(void *data, const char *buf, unsigned int len)
static void
grn_ctx_impl_init(grn_ctx *ctx)
{
-
grn_io_mapinfo mi;
if (!(ctx->impl = grn_io_anon_map(ctx, &mi, IMPL_SIZE))) {
ctx->impl = NULL;
@@ -522,7 +577,7 @@ grn_ctx_set_next_expr(grn_ctx *ctx, grn_obj *expr)
}
static void
-grn_ctx_impl_clear_n_same_error_mssagges(grn_ctx *ctx)
+grn_ctx_impl_clear_n_same_error_messagges(grn_ctx *ctx)
{
if (ctx->impl->n_same_error_messages == 0) {
return;
@@ -555,19 +610,25 @@ grn_ctx_impl_set_current_error_message(grn_ctx *ctx)
return;
}
- grn_ctx_impl_clear_n_same_error_mssagges(ctx);
- strcpy(ctx->impl->previous_errbuf, ctx->errbuf);
+ grn_ctx_impl_clear_n_same_error_messagges(ctx);
+ grn_strcpy(ctx->impl->previous_errbuf, GRN_CTX_MSGSIZE, ctx->errbuf);
}
-grn_rc
-grn_ctx_init(grn_ctx *ctx, int flags)
+static grn_rc
+grn_ctx_init_internal(grn_ctx *ctx, int flags)
{
if (!ctx) { return GRN_INVALID_ARGUMENT; }
// if (ctx->stat != GRN_CTX_FIN) { return GRN_INVALID_ARGUMENT; }
ERRCLR(ctx);
ctx->flags = flags;
- if (getenv("GRN_CTX_PER_DB") && strcmp(getenv("GRN_CTX_PER_DB"), "yes") == 0) {
- ctx->flags |= GRN_CTX_PER_DB;
+ {
+ char grn_ctx_per_db_env[GRN_ENV_BUFFER_SIZE];
+ grn_getenv("GRN_CTX_PER_DB",
+ grn_ctx_per_db_env,
+ GRN_ENV_BUFFER_SIZE);
+ if (grn_ctx_per_db_env[0] && strcmp(grn_ctx_per_db_env, "yes") == 0) {
+ ctx->flags |= GRN_CTX_PER_DB;
+ }
}
if (ERRP(ctx, GRN_ERROR)) { return ctx->rc; }
ctx->stat = GRN_CTX_INITED;
@@ -591,6 +652,20 @@ grn_ctx_init(grn_ctx *ctx, int flags)
return ctx->rc;
}
+grn_rc
+grn_ctx_init(grn_ctx *ctx, int flags)
+{
+ grn_rc rc;
+
+ rc = grn_ctx_init_internal(ctx, flags);
+ if (rc == GRN_SUCCESS) {
+ grn_ctx_impl_init(ctx);
+ rc = ctx->rc;
+ }
+
+ return rc;
+}
+
grn_ctx *
grn_ctx_open(int flags)
{
@@ -619,7 +694,7 @@ grn_ctx_fin(grn_ctx *ctx)
CRITICAL_SECTION_LEAVE(grn_glock);
}
if (ctx->impl) {
- grn_ctx_impl_clear_n_same_error_mssagges(ctx);
+ grn_ctx_impl_clear_n_same_error_messagges(ctx);
if (ctx->impl->finalizer) {
ctx->impl->finalizer(ctx, 0, NULL, &(ctx->user_data));
}
@@ -706,7 +781,6 @@ grn_ctx_set_finalizer(grn_ctx *ctx, grn_proc_func *finalizer)
{
if (!ctx) { return GRN_INVALID_ARGUMENT; }
if (!ctx->impl) {
- grn_ctx_impl_init(ctx);
if (ERRP(ctx, GRN_ERROR)) { return ctx->rc; }
}
ctx->impl->finalizer = finalizer;
@@ -715,474 +789,12 @@ grn_ctx_set_finalizer(grn_ctx *ctx, grn_proc_func *finalizer)
grn_timeval grn_starttime;
-static char *default_logger_path = NULL;
-static FILE *default_logger_file = NULL;
-static grn_critical_section default_logger_lock;
-
-static void
-default_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 slev[] = " EACewnid-";
- if (default_logger_path) {
- CRITICAL_SECTION_ENTER(default_logger_lock);
- if (!default_logger_file) {
- default_logger_file = fopen(default_logger_path, "a");
- }
- if (default_logger_file) {
- if (location && *location) {
- fprintf(default_logger_file, "%s|%c|%s %s %s\n",
- timestamp, *(slev + level), title, message, location);
- } else {
- fprintf(default_logger_file, "%s|%c|%s %s\n", timestamp,
- *(slev + level), title, message);
- }
- fflush(default_logger_file);
- }
- CRITICAL_SECTION_LEAVE(default_logger_lock);
- }
-}
-
-static void
-default_logger_reopen(grn_ctx *ctx, void *user_data)
-{
- GRN_LOG(ctx, GRN_LOG_NOTICE, "log will be closed.");
- CRITICAL_SECTION_ENTER(default_logger_lock);
- if (default_logger_file) {
- fclose(default_logger_file);
- default_logger_file = NULL;
- }
- CRITICAL_SECTION_LEAVE(default_logger_lock);
- GRN_LOG(ctx, GRN_LOG_NOTICE, "log opened.");
-}
-
-static void
-default_logger_fin(grn_ctx *ctx, void *user_data)
-{
- CRITICAL_SECTION_ENTER(default_logger_lock);
- if (default_logger_file) {
- fclose(default_logger_file);
- default_logger_file = NULL;
- }
- CRITICAL_SECTION_LEAVE(default_logger_lock);
-}
-
-static grn_logger default_logger = {
- GRN_LOG_DEFAULT_LEVEL,
- GRN_LOG_TIME|GRN_LOG_MESSAGE,
- NULL,
- default_logger_log,
- default_logger_reopen,
- default_logger_fin
-};
-
-static grn_logger current_logger = {
- GRN_LOG_DEFAULT_LEVEL,
- GRN_LOG_TIME|GRN_LOG_MESSAGE,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-void
-grn_default_logger_set_max_level(grn_log_level max_level)
-{
- default_logger.max_level = max_level;
- if (current_logger.log == default_logger_log) {
- current_logger.max_level = max_level;
- }
-}
-
-grn_log_level
-grn_default_logger_get_max_level(void)
-{
- return default_logger.max_level;
-}
-
-void
-grn_default_logger_set_path(const char *path)
-{
- if (default_logger_path) {
- free(default_logger_path);
- }
-
- if (path) {
- default_logger_path = strdup(path);
- } else {
- default_logger_path = NULL;
- }
-}
-
-const char *
-grn_default_logger_get_path(void)
-{
- return default_logger_path;
-}
-
-void
-grn_logger_reopen(grn_ctx *ctx)
-{
- if (current_logger.reopen) {
- current_logger.reopen(ctx, current_logger.user_data);
- }
-}
-
-static void
-grn_logger_fin(grn_ctx *ctx)
-{
- if (current_logger.fin) {
- current_logger.fin(ctx, current_logger.user_data);
- }
-}
-
-static void
-logger_info_func_wrapper(grn_ctx *ctx, grn_log_level level,
- const char *timestamp, const char *title,
- const char *message, const char *location,
- void *user_data)
-{
- grn_logger_info *info = user_data;
- info->func(level, timestamp, title, message, location, info->func_arg);
-}
-
-/* Deprecated since 2.1.2. */
-grn_rc
-grn_logger_info_set(grn_ctx *ctx, const grn_logger_info *info)
-{
- if (info) {
- grn_logger logger;
-
- memset(&logger, 0, sizeof(grn_logger));
- logger.max_level = info->max_level;
- logger.flags = info->flags;
- if (info->func) {
- logger.log = logger_info_func_wrapper;
- logger.user_data = (grn_logger_info *)info;
- } else {
- logger.log = default_logger_log;
- logger.reopen = default_logger_reopen;
- logger.fin = default_logger_fin;
- }
- return grn_logger_set(ctx, &logger);
- } else {
- return grn_logger_set(ctx, NULL);
- }
-}
-
-grn_rc
-grn_logger_set(grn_ctx *ctx, const grn_logger *logger)
-{
- grn_logger_fin(ctx);
- if (logger) {
- current_logger = *logger;
- } else {
- current_logger = default_logger;
- }
- return GRN_SUCCESS;
-}
-
-void
-grn_logger_set_max_level(grn_ctx *ctx, grn_log_level max_level)
-{
- current_logger.max_level = max_level;
-}
-
-grn_log_level
-grn_logger_get_max_level(grn_ctx *ctx)
-{
- return current_logger.max_level;
-}
-
-grn_bool
-grn_logger_pass(grn_ctx *ctx, grn_log_level level)
-{
- return level <= current_logger.max_level;
-}
-
-#define TBUFSIZE GRN_TIMEVAL_STR_SIZE
-#define MBUFSIZE 0x1000
-#define LBUFSIZE 0x400
-
-void
-grn_logger_put(grn_ctx *ctx, grn_log_level level,
- const char *file, int line, const char *func, const char *fmt, ...)
-{
- if (level <= current_logger.max_level && current_logger.log) {
- char tbuf[TBUFSIZE];
- char mbuf[MBUFSIZE];
- char lbuf[LBUFSIZE];
- tbuf[0] = '\0';
- if (current_logger.flags & GRN_LOG_TIME) {
- grn_timeval tv;
- grn_timeval_now(ctx, &tv);
- grn_timeval2str(ctx, &tv, tbuf);
- }
- if (current_logger.flags & GRN_LOG_MESSAGE) {
- va_list argp;
- va_start(argp, fmt);
- vsnprintf(mbuf, MBUFSIZE - 1, fmt, argp);
- va_end(argp);
- mbuf[MBUFSIZE - 1] = '\0';
- } else {
- mbuf[0] = '\0';
- }
- if (current_logger.flags & GRN_LOG_LOCATION) {
- snprintf(lbuf, LBUFSIZE - 1, "%d %s:%d %s()", getpid(), file, line, func);
- lbuf[LBUFSIZE - 1] = '\0';
- } else {
- lbuf[0] = '\0';
- }
- current_logger.log(ctx, level, tbuf, "", mbuf, lbuf,
- current_logger.user_data);
- }
-}
-
-static void
-logger_init(void)
-{
- if (!default_logger_path) {
- default_logger_path = strdup(GRN_LOG_PATH);
- }
- memcpy(&current_logger, &default_logger, sizeof(grn_logger));
- CRITICAL_SECTION_INIT(default_logger_lock);
-}
-
-static void
-logger_fin(grn_ctx *ctx)
-{
- grn_logger_fin(ctx);
- if (default_logger_path) {
- free(default_logger_path);
- default_logger_path = NULL;
- }
- CRITICAL_SECTION_FIN(default_logger_lock);
-}
-
-
-static char *default_query_logger_path = NULL;
-static FILE *default_query_logger_file = NULL;
-static grn_critical_section default_query_logger_lock;
-
-static void
-default_query_logger_log(grn_ctx *ctx, unsigned int flag,
- const char *timestamp, const char *info,
- const char *message, void *user_data)
-{
- if (default_query_logger_path) {
- CRITICAL_SECTION_ENTER(default_query_logger_lock);
- if (!default_query_logger_file) {
- default_query_logger_file = fopen(default_query_logger_path, "a");
- }
- if (default_query_logger_file) {
- fprintf(default_query_logger_file, "%s|%s%s\n", timestamp, info, message);
- fflush(default_query_logger_file);
- }
- CRITICAL_SECTION_LEAVE(default_query_logger_lock);
- }
-}
-
-static void
-default_query_logger_close(grn_ctx *ctx, void *user_data)
-{
- GRN_QUERY_LOG(ctx, GRN_QUERY_LOG_DESTINATION, " ",
- "query log will be closed: <%s>", default_query_logger_path);
- CRITICAL_SECTION_ENTER(default_query_logger_lock);
- if (default_query_logger_file) {
- fclose(default_query_logger_file);
- default_query_logger_file = NULL;
- }
- CRITICAL_SECTION_LEAVE(default_query_logger_lock);
-}
-
-static void
-default_query_logger_reopen(grn_ctx *ctx, void *user_data)
-{
- default_query_logger_close(ctx, user_data);
- if (default_query_logger_path) {
- GRN_QUERY_LOG(ctx, GRN_QUERY_LOG_DESTINATION, " ",
- "query log is opened: <%s>", default_query_logger_path);
- }
-}
-
-static void
-default_query_logger_fin(grn_ctx *ctx, void *user_data)
-{
- if (default_query_logger_file) {
- default_query_logger_close(ctx, user_data);
- }
-}
-
-static grn_query_logger default_query_logger = {
- GRN_QUERY_LOG_DEFAULT,
- NULL,
- default_query_logger_log,
- default_query_logger_reopen,
- default_query_logger_fin
-};
-
-static grn_query_logger current_query_logger = {
- GRN_QUERY_LOG_DEFAULT,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-void
-grn_default_query_logger_set_flags(unsigned int flags)
-{
- default_query_logger.flags = flags;
- if (current_query_logger.log == default_query_logger_log) {
- current_query_logger.flags = flags;
- }
-}
-
-unsigned int
-grn_default_query_logger_get_flags(void)
-{
- return default_query_logger.flags;
-}
-
-void
-grn_default_query_logger_set_path(const char *path)
-{
- if (default_query_logger_path) {
- free(default_query_logger_path);
- }
-
- if (path) {
- default_query_logger_path = strdup(path);
- } else {
- default_query_logger_path = NULL;
- }
-}
-
-const char *
-grn_default_query_logger_get_path(void)
-{
- return default_query_logger_path;
-}
-
-void
-grn_query_logger_reopen(grn_ctx *ctx)
-{
- if (current_query_logger.reopen) {
- current_query_logger.reopen(ctx, current_query_logger.user_data);
- }
-}
-
-static void
-grn_query_logger_fin(grn_ctx *ctx)
-{
- if (current_query_logger.fin) {
- current_query_logger.fin(ctx, current_query_logger.user_data);
- }
-}
-
-grn_rc
-grn_query_logger_set(grn_ctx *ctx, const grn_query_logger *logger)
-{
- grn_query_logger_fin(ctx);
- if (logger) {
- current_query_logger = *logger;
- } else {
- current_query_logger = default_query_logger;
- }
- return GRN_SUCCESS;
-}
-
-grn_bool
-grn_query_logger_pass(grn_ctx *ctx, unsigned int flag)
-{
- return current_query_logger.flags & flag;
-}
-
-#define TIMESTAMP_BUFFER_SIZE TBUFSIZE
-/* 8+a(%p) + 1(|) + 1(mark) + 15(elapsed time) = 25+a */
-#define INFO_BUFFER_SIZE 40
-
-void
-grn_query_logger_put(grn_ctx *ctx, unsigned int flag, const char *mark,
- const char *format, ...)
-{
- char timestamp[TIMESTAMP_BUFFER_SIZE];
- char info[INFO_BUFFER_SIZE];
- grn_obj *message = &ctx->impl->query_log_buf;
-
- if (!current_query_logger.log) {
- return;
- }
-
- {
- grn_timeval tv;
- timestamp[0] = '\0';
- grn_timeval_now(ctx, &tv);
- grn_timeval2str(ctx, &tv, timestamp);
- }
-
- if (flag & (GRN_QUERY_LOG_COMMAND | GRN_QUERY_LOG_DESTINATION)) {
- snprintf(info, INFO_BUFFER_SIZE - 1, "%p|%s", ctx, mark);
- info[INFO_BUFFER_SIZE - 1] = '\0';
- } else {
- grn_timeval tv;
- uint64_t elapsed_time;
- grn_timeval_now(ctx, &tv);
- elapsed_time =
- (uint64_t)(tv.tv_sec - ctx->impl->tv.tv_sec) * GRN_TIME_NSEC_PER_SEC +
- (tv.tv_nsec - ctx->impl->tv.tv_nsec);
-
- snprintf(info, INFO_BUFFER_SIZE - 1,
- "%p|%s%015" GRN_FMT_INT64U " ", ctx, mark, elapsed_time);
- info[INFO_BUFFER_SIZE - 1] = '\0';
- }
-
- {
- va_list args;
-
- va_start(args, format);
- GRN_BULK_REWIND(message);
- grn_text_vprintf(ctx, message, format, args);
- va_end(args);
- GRN_TEXT_PUTC(ctx, message, '\0');
- }
-
- current_query_logger.log(ctx, flag, timestamp, info, GRN_TEXT_VALUE(message),
- current_query_logger.user_data);
-}
-
-static void
-query_logger_init(void)
-{
- memcpy(&current_query_logger, &default_query_logger, sizeof(grn_query_logger));
- CRITICAL_SECTION_INIT(default_query_logger_lock);
-}
-
-static void
-query_logger_fin(grn_ctx *ctx)
-{
- grn_query_logger_fin(ctx);
- if (default_query_logger_path) {
- free(default_query_logger_path);
- }
- CRITICAL_SECTION_FIN(default_query_logger_lock);
-}
-
-void
-grn_log_reopen(grn_ctx *ctx)
-{
- grn_logger_reopen(ctx);
- grn_query_logger_reopen(ctx);
-}
-
-
static void
check_overcommit_memory(grn_ctx *ctx)
{
FILE *file;
int value;
- file = fopen("/proc/sys/vm/overcommit_memory", "r");
+ file = grn_fopen("/proc/sys/vm/overcommit_memory", "r");
if (!file) { return; }
value = fgetc(file);
if (value != '1') {
@@ -1204,30 +816,18 @@ check_overcommit_memory(grn_ctx *ctx)
fclose(file);
}
-static void
-check_grn_ja_skip_same_value_put(grn_ctx *ctx)
-{
- const char *grn_ja_skip_same_value_put_env;
-
- grn_ja_skip_same_value_put_env = getenv("GRN_JA_SKIP_SAME_VALUE_PUT");
- if (grn_ja_skip_same_value_put_env &&
- strcmp(grn_ja_skip_same_value_put_env, "no") == 0) {
- grn_ja_skip_same_value_put = GRN_FALSE;
- }
-}
-
grn_rc
grn_init(void)
{
grn_rc rc;
grn_ctx *ctx = &grn_gctx;
- logger_init();
- query_logger_init();
+ grn_logger_init();
+ grn_query_logger_init();
CRITICAL_SECTION_INIT(grn_glock);
grn_gtick = 0;
ctx->next = ctx;
ctx->prev = ctx;
- grn_ctx_init(ctx, 0);
+ grn_ctx_init_internal(ctx, 0);
ctx->encoding = grn_encoding_parse(GRN_DEFAULT_ENCODING);
grn_timeval_now(ctx, &grn_starttime);
#ifdef WIN32
@@ -1247,22 +847,50 @@ grn_init(void)
}
// expand_stack();
#ifdef USE_FAIL_MALLOC
- if (getenv("GRN_FMALLOC_PROB")) {
- grn_fmalloc_prob = strtod(getenv("GRN_FMALLOC_PROB"), 0) * RAND_MAX;
- if (getenv("GRN_FMALLOC_SEED")) {
- srand((unsigned int)atoi(getenv("GRN_FMALLOC_SEED")));
- } else {
- srand((unsigned int)time(NULL));
+ {
+ char grn_fmalloc_prob_env[GRN_ENV_BUFFER_SIZE];
+ grn_getenv("GRN_FMALLOC_PROB",
+ grn_fmalloc_prob_env,
+ GRN_ENV_BUFFER_SIZE);
+ if (grn_fmalloc_prob_env[0]) {
+ char grn_fmalloc_seed_env[GRN_ENV_BUFFER_SIZE];
+ grn_fmalloc_prob = strtod(grn_fmalloc_prob_env, 0) * RAND_MAX;
+ grn_getenv("GRN_FMALLOC_SEED",
+ grn_fmalloc_seed_env,
+ GRN_ENV_BUFFER_SIZE);
+ if (grn_fmalloc_seed_env[0]) {
+ srand((unsigned int)atoi(grn_fmalloc_seed_env));
+ } else {
+ srand((unsigned int)time(NULL));
+ }
}
}
- if (getenv("GRN_FMALLOC_FUNC")) {
- grn_fmalloc_func = getenv("GRN_FMALLOC_FUNC");
+ {
+ static char grn_fmalloc_func_env[GRN_ENV_BUFFER_SIZE];
+ grn_getenv("GRN_FMALLOC_FUNC",
+ grn_fmalloc_func_env,
+ GRN_ENV_BUFFER_SIZE);
+ if (grn_fmalloc_func_env[0]) {
+ grn_fmalloc_func = grn_fmalloc_func_env;
+ }
}
- if (getenv("GRN_FMALLOC_FILE")) {
- grn_fmalloc_file = getenv("GRN_FMALLOC_FILE");
+ {
+ static char grn_fmalloc_file_env[GRN_ENV_BUFFER_SIZE];
+ grn_getenv("GRN_FMALLOC_FILE",
+ grn_fmalloc_file_env,
+ GRN_ENV_BUFFER_SIZE);
+ if (grn_fmalloc_file_env[0]) {
+ grn_fmalloc_file = grn_fmalloc_file_env;
+ }
}
- if (getenv("GRN_FMALLOC_LINE")) {
- grn_fmalloc_line = atoi(getenv("GRN_FMALLOC_LINE"));
+ {
+ char grn_fmalloc_line_env[GRN_ENV_BUFFER_SIZE];
+ grn_getenv("GRN_FMALLOC_LINE",
+ grn_fmalloc_line_env,
+ GRN_ENV_BUFFER_SIZE);
+ if (grn_fmalloc_line_env[0]) {
+ grn_fmalloc_line = atoi(grn_fmalloc_line_env);
+ }
}
#endif /* USE_FAIL_MALLOC */
if ((rc = grn_com_init())) {
@@ -1282,8 +910,8 @@ grn_init(void)
GRN_LOG(ctx, GRN_LOG_ALERT, "grn_normalizer_init failed (%d)", rc);
return rc;
}
- if ((rc = grn_token_init())) {
- GRN_LOG(ctx, GRN_LOG_ALERT, "grn_token_init failed (%d)", rc);
+ if ((rc = grn_tokenizers_init())) {
+ GRN_LOG(ctx, GRN_LOG_ALERT, "grn_tokenizers_init failed (%d)", rc);
return rc;
}
/*
@@ -1293,9 +921,15 @@ grn_init(void)
}
*/
grn_cache_init();
+ if (!grn_request_canceler_init()) {
+ rc = ctx->rc;
+ grn_cache_fin();
+ GRN_LOG(ctx, GRN_LOG_ALERT,
+ "failed to initialize request canceler (%d)", rc);
+ return rc;
+ }
GRN_LOG(ctx, GRN_LOG_NOTICE, "grn_init");
check_overcommit_memory(ctx);
- check_grn_ja_skip_same_value_put(ctx);
return rc;
}
@@ -1378,16 +1012,17 @@ grn_fin(void)
GRN_GFREE(ctx);
}
}
- query_logger_fin(ctx);
+ grn_query_logger_fin(ctx);
+ grn_request_canceler_fin();
grn_cache_fin();
- grn_token_fin();
+ grn_tokenizers_fin();
grn_normalizer_fin();
grn_plugins_fin();
grn_io_fin();
grn_ctx_fin(ctx);
grn_com_fin();
GRN_LOG(ctx, GRN_LOG_NOTICE, "grn_fin (%d)", alloc_count);
- logger_fin(ctx);
+ grn_logger_fin(ctx);
CRITICAL_SECTION_FIN(grn_glock);
return GRN_SUCCESS;
}
@@ -1396,7 +1031,6 @@ grn_rc
grn_ctx_connect(grn_ctx *ctx, const char *host, int port, int flags)
{
GRN_API_ENTER;
- if (!ctx->impl) { grn_ctx_impl_init(ctx); }
if (!ctx->impl) { goto exit; }
{
grn_com *com = grn_com_copen(ctx, NULL, host, port);
@@ -1428,16 +1062,6 @@ grn_ctx_get_command_version(grn_ctx *ctx)
}
}
-const char *
-grn_ctx_get_mime_type(grn_ctx *ctx)
-{
- if (ctx->impl) {
- return ctx->impl->mime_type;
- } else {
- return NULL;
- }
-}
-
grn_rc
grn_ctx_set_command_version(grn_ctx *ctx, grn_command_version version)
{
@@ -1456,6 +1080,60 @@ grn_ctx_set_command_version(grn_ctx *ctx, grn_command_version version)
}
}
+grn_content_type
+grn_ctx_get_output_type(grn_ctx *ctx)
+{
+ if (ctx->impl) {
+ return ctx->impl->output_type;
+ } else {
+ return GRN_CONTENT_NONE;
+ }
+}
+
+grn_rc
+grn_ctx_set_output_type(grn_ctx *ctx, grn_content_type type)
+{
+ grn_rc rc = GRN_SUCCESS;
+
+ if (ctx->impl) {
+ ctx->impl->output_type = type;
+ switch (ctx->impl->output_type) {
+ case GRN_CONTENT_NONE :
+ ctx->impl->mime_type = "application/octet-stream";
+ break;
+ case GRN_CONTENT_TSV :
+ ctx->impl->mime_type = "text/tab-separated-values";
+ break;
+ case GRN_CONTENT_JSON :
+ ctx->impl->mime_type = "application/json";
+ break;
+ case GRN_CONTENT_XML :
+ ctx->impl->mime_type = "text/xml";
+ break;
+ case GRN_CONTENT_MSGPACK :
+ ctx->impl->mime_type = "application/x-msgpack";
+ break;
+ case GRN_CONTENT_GROONGA_COMMAND_LIST :
+ ctx->impl->mime_type = "text/x-groonga-command-list";
+ break;
+ }
+ } else {
+ rc = GRN_INVALID_ARGUMENT;
+ }
+
+ return rc;
+}
+
+const char *
+grn_ctx_get_mime_type(grn_ctx *ctx)
+{
+ if (ctx->impl) {
+ return ctx->impl->mime_type;
+ } else {
+ return NULL;
+ }
+}
+
long long int
grn_ctx_get_match_escalation_threshold(grn_ctx *ctx)
{
@@ -1558,7 +1236,7 @@ get_content_mime_type(grn_ctx *ctx, const char *p, const char *pe)
ctx->impl->mime_type = "text/plain";
} else if (p + 3 == pe && !memcmp(p, "tsv", 3)) {
ctx->impl->output_type = GRN_CONTENT_TSV;
- ctx->impl->mime_type = "text/plain";
+ ctx->impl->mime_type = "text/tab-separated-values";
}
break;
case 'x':
@@ -1613,9 +1291,11 @@ get_command_version(grn_ctx *ctx, const char *p, const char *pe)
#define INDEX_HTML "index.html"
#define OUTPUT_TYPE "output_type"
#define COMMAND_VERSION "command_version"
+#define REQUEST_ID "request_id"
#define EXPR_MISSING "expr_missing"
#define OUTPUT_TYPE_LEN (sizeof(OUTPUT_TYPE) - 1)
#define COMMAND_VERSION_LEN (sizeof(COMMAND_VERSION) - 1)
+#define REQUEST_ID_LEN (sizeof(REQUEST_ID) - 1)
#define HTTP_QUERY_PAIR_DELIMITER "="
#define HTTP_QUERY_PAIRS_DELIMITERS "&;"
@@ -1631,8 +1311,10 @@ grn_obj *
grn_ctx_qe_exec_uri(grn_ctx *ctx, const char *path, uint32_t path_len)
{
grn_obj buf, *expr, *val;
+ grn_obj request_id;
const char *p = path, *e = path + path_len, *v, *key_end, *filename_end;
GRN_TEXT_INIT(&buf, 0);
+ GRN_TEXT_INIT(&request_id, 0);
p = grn_text_urldec(ctx, &buf, p, e, '?');
if (!GRN_TEXT_LEN(&buf)) { GRN_TEXT_SETS(ctx, &buf, INDEX_HTML); }
v = GRN_TEXT_VALUE(&buf);
@@ -1659,6 +1341,12 @@ grn_ctx_qe_exec_uri(grn_ctx *ctx, const char *path, uint32_t path_len)
p = grn_text_cgidec(ctx, &buf, p, e, HTTP_QUERY_PAIRS_DELIMITERS);
get_command_version(ctx, GRN_TEXT_VALUE(&buf), GRN_BULK_CURR(&buf));
if (ctx->rc) { goto exit; }
+ } else if (l == REQUEST_ID_LEN &&
+ !memcmp(v, REQUEST_ID, REQUEST_ID_LEN)) {
+ GRN_BULK_REWIND(&request_id);
+ p = grn_text_cgidec(ctx, &request_id, p, e,
+ HTTP_QUERY_PAIRS_DELIMITERS);
+ if (ctx->rc) { goto exit; }
} else {
if (!(val = grn_expr_get_or_add_var(ctx, expr, v, l))) {
val = &buf;
@@ -1667,8 +1355,18 @@ grn_ctx_qe_exec_uri(grn_ctx *ctx, const char *path, uint32_t path_len)
p = grn_text_cgidec(ctx, val, p, e, HTTP_QUERY_PAIRS_DELIMITERS);
}
}
+ if (GRN_TEXT_LEN(&request_id) > 0) {
+ grn_request_canceler_register(ctx,
+ GRN_TEXT_VALUE(&request_id),
+ GRN_TEXT_LEN(&request_id));
+ }
ctx->impl->curr_expr = expr;
grn_expr_exec(ctx, expr, 0);
+ if (GRN_TEXT_LEN(&request_id) > 0) {
+ grn_request_canceler_unregister(ctx,
+ GRN_TEXT_VALUE(&request_id),
+ GRN_TEXT_LEN(&request_id));
+ }
} else {
ERR(GRN_INVALID_ARGUMENT, "invalid command name: %.*s",
command_name_size, command_name);
@@ -1693,8 +1391,10 @@ grn_ctx_qe_exec(grn_ctx *ctx, const char *str, uint32_t str_len)
char tok_type;
int offset = 0;
grn_obj buf, *expr = NULL, *val = NULL;
+ grn_obj request_id;
const char *p = str, *e = str + str_len, *v;
GRN_TEXT_INIT(&buf, 0);
+ GRN_TEXT_INIT(&request_id, 0);
p = grn_text_unesc_tok(ctx, &buf, p, e, &tok_type);
expr = grn_ctx_get(ctx, GRN_TEXT_VALUE(&buf), GRN_TEXT_LEN(&buf));
while (p < e) {
@@ -1720,6 +1420,11 @@ grn_ctx_qe_exec(grn_ctx *ctx, const char *str, uint32_t str_len)
p = grn_text_unesc_tok(ctx, &buf, p, e, &tok_type);
get_command_version(ctx, GRN_TEXT_VALUE(&buf), GRN_BULK_CURR(&buf));
if (ctx->rc) { goto exit; }
+ } else if (l == REQUEST_ID_LEN &&
+ !memcmp(v, REQUEST_ID, REQUEST_ID_LEN)) {
+ GRN_BULK_REWIND(&request_id);
+ p = grn_text_unesc_tok(ctx, &request_id, p, e, &tok_type);
+ if (ctx->rc) { goto exit; }
} else if (expr && (val = grn_expr_get_or_add_var(ctx, expr, v, l))) {
grn_obj_reinit(ctx, val, GRN_DB_TEXT, 0);
p = grn_text_unesc_tok(ctx, val, p, e, &tok_type);
@@ -1740,6 +1445,11 @@ grn_ctx_qe_exec(grn_ctx *ctx, const char *str, uint32_t str_len)
break;
}
}
+ if (GRN_TEXT_LEN(&request_id) > 0) {
+ grn_request_canceler_register(ctx,
+ GRN_TEXT_VALUE(&request_id),
+ GRN_TEXT_LEN(&request_id));
+ }
ctx->impl->curr_expr = expr;
if (expr && command_proc_p(expr)) {
grn_expr_exec(ctx, expr, 0);
@@ -1751,7 +1461,13 @@ grn_ctx_qe_exec(grn_ctx *ctx, const char *str, uint32_t str_len)
(int)GRN_TEXT_LEN(&buf), GRN_TEXT_VALUE(&buf));
}
}
+ if (GRN_TEXT_LEN(&request_id) > 0) {
+ grn_request_canceler_unregister(ctx,
+ GRN_TEXT_VALUE(&request_id),
+ GRN_TEXT_LEN(&request_id));
+ }
exit :
+ GRN_OBJ_FIN(ctx, &request_id);
GRN_OBJ_FIN(ctx, &buf);
return expr;
}
@@ -1760,6 +1476,7 @@ grn_rc
grn_ctx_sendv(grn_ctx *ctx, int argc, char **argv, int flags)
{
grn_obj buf;
+ GRN_API_ENTER;
GRN_TEXT_INIT(&buf, 0);
while (argc--) {
// todo : encode into json like syntax
@@ -1769,7 +1486,7 @@ grn_ctx_sendv(grn_ctx *ctx, int argc, char **argv, int flags)
}
grn_ctx_send(ctx, GRN_TEXT_VALUE(&buf), GRN_TEXT_LEN(&buf), flags);
GRN_OBJ_FIN(ctx, &buf);
- return ctx->rc;
+ GRN_API_RETURN(ctx->rc);
}
static int
@@ -1991,9 +1708,9 @@ grn_cache_open(grn_ctx *ctx)
goto exit;
}
- cache->next = (grn_cache_entry*)cache;
+ cache->next = (grn_cache_entry *)cache;
cache->prev = (grn_cache_entry *)cache;
- cache->hash = grn_hash_create(&grn_gctx, NULL, GRN_TABLE_MAX_KEY_SIZE,
+ cache->hash = grn_hash_create(&grn_gctx, NULL, GRN_CACHE_MAX_KEY_SIZE,
sizeof(grn_cache_entry), GRN_OBJ_KEY_VAR_SIZE);
MUTEX_INIT(cache->mutex);
cache->max_nentries = GRN_CACHE_DEFAULT_MAX_N_ENTRIES;
@@ -2047,10 +1764,18 @@ grn_cache_init(void)
grn_rc
grn_cache_set_max_n_entries(grn_ctx *ctx, grn_cache *cache, unsigned int n)
{
+ uint32_t current_max_n_entries;
+
if (!cache) {
return GRN_INVALID_ARGUMENT;
}
+
+ current_max_n_entries = cache->max_nentries;
cache->max_nentries = n;
+ if (n < current_max_n_entries) {
+ grn_cache_expire(cache, current_max_n_entries - n);
+ }
+
return GRN_SUCCESS;
}
@@ -2208,7 +1933,6 @@ grn_ctx_alloc(grn_ctx *ctx, size_t size, int flags,
void *res = NULL;
if (!ctx) { return res; }
if (!ctx->impl) {
- grn_ctx_impl_init(ctx);
if (ERRP(ctx, GRN_ERROR)) { return res; }
}
CRITICAL_SECTION_ENTER(ctx->impl->lock);
@@ -2220,7 +1944,7 @@ grn_ctx_alloc(grn_ctx *ctx, size_t size, int flags,
if (size > GRN_CTX_SEGMENT_SIZE) {
uint64_t npages = (size + (grn_pagesize - 1)) / grn_pagesize;
if (npages >= (1LL<<32)) {
- MERR("too long request size=%zu", size);
+ MERR("too long request size=%" GRN_FMT_SIZE, size);
goto exit;
}
for (i = 0, mi = ctx->impl->segs;; i++, mi++) {
@@ -2303,7 +2027,7 @@ grn_ctx_realloc(grn_ctx *ctx, void *ptr, size_t size,
if (res && ptr) {
int32_t *header = &((int32_t *)ptr)[-2];
size_t size_ = header[1];
- memcpy(res, ptr, size_ > size ? size : size_);
+ grn_memcpy(res, ptr, size_ > size ? size : size_);
grn_ctx_free(ctx, ptr, file, line, func);
}
} else {
@@ -2319,7 +2043,7 @@ grn_ctx_strdup(grn_ctx *ctx, const char *s, const char* file, int line, const ch
if (s) {
size_t size = strlen(s) + 1;
if ((res = grn_ctx_alloc(ctx, size, 0, file, line, func))) {
- memcpy(res, s, size);
+ grn_memcpy(res, s, size);
}
}
return res;
@@ -2395,7 +2119,6 @@ grn_ctx_use(grn_ctx *ctx, grn_obj *db)
if (db && !DB_P(db)) {
ctx->rc = GRN_INVALID_ARGUMENT;
} else {
- if (!ctx->impl) { grn_ctx_impl_init(ctx); }
if (!ctx->rc) {
ctx->impl->db = db;
if (db) {
@@ -2416,7 +2139,6 @@ grn_ctx_alloc_lifo(grn_ctx *ctx, size_t size,
{
if (!ctx) { return NULL; }
if (!ctx->impl) {
- grn_ctx_impl_init(ctx);
if (ERRP(ctx, GRN_ERROR)) { return NULL; }
}
{
@@ -2425,7 +2147,7 @@ grn_ctx_alloc_lifo(grn_ctx *ctx, size_t size,
if (size > GRN_CTX_SEGMENT_SIZE) {
uint64_t npages = (size + (grn_pagesize - 1)) / grn_pagesize;
if (npages >= (1LL<<32)) {
- MERR("too long request size=%zu", size);
+ MERR("too long request size=%" GRN_FMT_SIZE, size);
return NULL;
}
for (;;) {
@@ -2562,6 +2284,20 @@ grn_ctx_set_strdup(grn_ctx *ctx, grn_strdup_func strdup_func)
ctx->impl->strdup_func = strdup_func;
}
+grn_free_func
+grn_ctx_get_free(grn_ctx *ctx)
+{
+ if (!ctx || !ctx->impl) { return NULL; }
+ return ctx->impl->free_func;
+}
+
+void
+grn_ctx_set_free(grn_ctx *ctx, grn_free_func free_func)
+{
+ if (!ctx || !ctx->impl) { return; }
+ ctx->impl->free_func = free_func;
+}
+
void *
grn_malloc(grn_ctx *ctx, size_t size, const char* file, int line, const char *func)
{
@@ -2601,6 +2337,16 @@ grn_strdup(grn_ctx *ctx, const char *string, const char* file, int line, const c
return grn_strdup_default(ctx, string, file, line, func);
}
}
+
+void
+grn_free(grn_ctx *ctx, void *ptr, const char* file, int line, const char *func)
+{
+ if (ctx && ctx->impl && ctx->impl->free_func) {
+ return ctx->impl->free_func(ctx, ptr, file, line, func);
+ } else {
+ return grn_free_default(ctx, ptr, file, line, func);
+ }
+}
#endif
void *
@@ -2611,14 +2357,14 @@ grn_malloc_default(grn_ctx *ctx, size_t size, const char* file, int line, const
void *res = malloc(size);
if (res) {
GRN_ADD_ALLOC_COUNT(1);
- grn_alloc_info_add(res);
+ grn_alloc_info_add(res, file, line, func);
} else {
if (!(res = malloc(size))) {
- MERR("malloc fail (%zu)=%p (%s:%d) <%d>",
+ MERR("malloc fail (%" GRN_FMT_SIZE ")=%p (%s:%d) <%d>",
size, res, file, line, alloc_count);
} else {
GRN_ADD_ALLOC_COUNT(1);
- grn_alloc_info_add(res);
+ grn_alloc_info_add(res, file, line, func);
}
}
return res;
@@ -2633,7 +2379,7 @@ grn_calloc_default(grn_ctx *ctx, size_t size, const char* file, int line, const
void *res = calloc(size, 1);
if (res) {
GRN_ADD_ALLOC_COUNT(1);
- grn_alloc_info_add(res);
+ grn_alloc_info_add(res, file, line, func);
} else {
if (!(res = calloc(size, 1))) {
MERR("calloc fail (%" GRN_FMT_LLU ")=%p (%s:%d) <%" GRN_FMT_LLU ">",
@@ -2641,7 +2387,7 @@ grn_calloc_default(grn_ctx *ctx, size_t size, const char* file, int line, const
(unsigned long long int)alloc_count);
} else {
GRN_ADD_ALLOC_COUNT(1);
- grn_alloc_info_add(res);
+ grn_alloc_info_add(res, file, line, func);
}
}
return res;
@@ -2671,7 +2417,8 @@ grn_realloc_default(grn_ctx *ctx, void *ptr, size_t size, const char* file, int
if (size) {
if (!(res = realloc(ptr, size))) {
if (!(res = realloc(ptr, size))) {
- MERR("realloc fail (%p,%zu)=%p (%s:%d) <%d>", ptr, size, res, file, line, alloc_count);
+ MERR("realloc fail (%p,%" GRN_FMT_SIZE ")=%p (%s:%d) <%d>",
+ ptr, size, res, file, line, alloc_count);
return NULL;
}
}
@@ -2679,7 +2426,7 @@ grn_realloc_default(grn_ctx *ctx, void *ptr, size_t size, const char* file, int
grn_alloc_info_change(ptr, res);
} else {
GRN_ADD_ALLOC_COUNT(1);
- grn_alloc_info_add(res);
+ grn_alloc_info_add(res, file, line, func);
}
} else {
if (!ptr) { return NULL; }
@@ -2702,12 +2449,16 @@ grn_strdup_default(grn_ctx *ctx, const char *s, const char* file, int line, cons
{
if (!ctx) { return NULL; }
{
- char *res = strdup(s);
+ char *res = grn_strdup_raw(s);
if (res) {
GRN_ADD_ALLOC_COUNT(1);
+ grn_alloc_info_add(res, file, line, func);
} else {
- if (!(res = strdup(s))) {
+ if (!(res = grn_strdup_raw(s))) {
MERR("strdup(%p)=%p (%s:%d) <%d>", s, res, file, line, alloc_count);
+ } else {
+ GRN_ADD_ALLOC_COUNT(1);
+ grn_alloc_info_add(res, file, line, func);
}
}
return res;
@@ -2735,7 +2486,8 @@ grn_malloc_fail(grn_ctx *ctx, size_t size, const char* file, int line, const cha
if (grn_fail_malloc_check(size, file, line, func)) {
return grn_malloc_default(ctx, size, file, line, func);
} else {
- MERR("fail_malloc (%d) (%s:%d@%s) <%d>", size, file, line, func, alloc_count);
+ MERR("fail_malloc (%" GRN_FMT_SIZE ") (%s:%d@%s) <%d>",
+ size, file, line, func, alloc_count);
return NULL;
}
}
@@ -2746,7 +2498,8 @@ grn_calloc_fail(grn_ctx *ctx, size_t size, const char* file, int line, const cha
if (grn_fail_malloc_check(size, file, line, func)) {
return grn_calloc_default(ctx, size, file, line, func);
} else {
- MERR("fail_calloc (%d) (%s:%d@%s) <%d>", size, file, line, func, alloc_count);
+ MERR("fail_calloc (%" GRN_FMT_SIZE ") (%s:%d@%s) <%d>",
+ size, file, line, func, alloc_count);
return NULL;
}
}
@@ -2758,7 +2511,8 @@ grn_realloc_fail(grn_ctx *ctx, void *ptr, size_t size, const char* file, int lin
if (grn_fail_malloc_check(size, file, line, func)) {
return grn_realloc_default(ctx, ptr, size, file, line, func);
} else {
- MERR("fail_realloc (%p,%zu) (%s:%d@%s) <%d>", ptr, size, file, line, func, alloc_count);
+ MERR("fail_realloc (%p,%" GRN_FMT_SIZE ") (%s:%d@%s) <%d>",
+ ptr, size, file, line, func, alloc_count);
return NULL;
}
}
@@ -2922,6 +2676,18 @@ grn_set_term_handler(void)
}
void
+grn_ctx_output_flush(grn_ctx *ctx, int flags)
+{
+ if (flags & GRN_CTX_QUIET) {
+ return;
+ }
+ if (!ctx->impl->output) {
+ return;
+ }
+ ctx->impl->output(ctx, 0, ctx->impl->data.ptr);
+}
+
+void
grn_ctx_output_array_open(grn_ctx *ctx, const char *name, int nelements)
{
grn_output_array_open(ctx, ctx->impl->outbuf, ctx->impl->output_type,
@@ -2990,3 +2756,25 @@ grn_ctx_output_obj(grn_ctx *ctx, grn_obj *value, grn_obj_format *format)
grn_output_obj(ctx, ctx->impl->outbuf, ctx->impl->output_type,
value, format);
}
+
+void
+grn_ctx_output_table_columns(grn_ctx *ctx, grn_obj *table,
+ grn_obj_format *format)
+{
+ grn_output_table_columns(ctx,
+ ctx->impl->outbuf,
+ ctx->impl->output_type,
+ table,
+ format);
+}
+
+void
+grn_ctx_output_table_records(grn_ctx *ctx, grn_obj *table,
+ grn_obj_format *format)
+{
+ grn_output_table_records(ctx,
+ ctx->impl->outbuf,
+ ctx->impl->output_type,
+ table,
+ format);
+}
diff --git a/storage/mroonga/vendor/groonga/lib/ctx_impl_mrb.c b/storage/mroonga/vendor/groonga/lib/ctx_impl_mrb.c
index 21531e4a837..4c1a2a3b4f9 100644
--- a/storage/mroonga/vendor/groonga/lib/ctx_impl_mrb.c
+++ b/storage/mroonga/vendor/groonga/lib/ctx_impl_mrb.c
@@ -1,6 +1,6 @@
/* -*- c-basic-offset: 2 -*- */
/*
- Copyright(C) 2013-2014 Brazil
+ Copyright(C) 2013-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,27 +16,69 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "ctx_impl_mrb.h"
-#include "ctx_impl.h"
-
-#include "mrb.h"
-#include "mrb/mrb_error.h"
-#include "mrb/mrb_id.h"
-#include "mrb/mrb_operator.h"
-#include "mrb/mrb_ctx.h"
-#include "mrb/mrb_logger.h"
-#include "mrb/mrb_void.h"
-#include "mrb/mrb_bulk.h"
-#include "mrb/mrb_obj.h"
-#include "mrb/mrb_column.h"
-#include "mrb/mrb_fixed_size_column.h"
-#include "mrb/mrb_variable_size_column.h"
-#include "mrb/mrb_index_column.h"
-#include "mrb/mrb_expr.h"
-#include "mrb/mrb_accessor.h"
-#include "mrb/mrb_procedure.h"
+#include "grn_ctx_impl.h"
#ifdef GRN_WITH_MRUBY
+# include <string.h>
+
+# include "grn_ctx_impl_mrb.h"
+
+# include "grn_mrb.h"
+# include "mrb/mrb_converter.h"
+# include "mrb/mrb_error.h"
+# include "mrb/mrb_id.h"
+# include "mrb/mrb_operator.h"
+# include "mrb/mrb_ctx.h"
+# include "mrb/mrb_logger.h"
+# include "mrb/mrb_void.h"
+# include "mrb/mrb_bulk.h"
+# include "mrb/mrb_object.h"
+# include "mrb/mrb_object_flags.h"
+# include "mrb/mrb_database.h"
+# include "mrb/mrb_table.h"
+# include "mrb/mrb_array.h"
+# include "mrb/mrb_hash_table.h"
+# include "mrb/mrb_patricia_trie.h"
+# include "mrb/mrb_double_array_trie.h"
+# include "mrb/mrb_column.h"
+# include "mrb/mrb_fixed_size_column.h"
+# include "mrb/mrb_variable_size_column.h"
+# include "mrb/mrb_index_column.h"
+# include "mrb/mrb_index_cursor.h"
+# include "mrb/mrb_type.h"
+# include "mrb/mrb_expr.h"
+# include "mrb/mrb_accessor.h"
+# include "mrb/mrb_procedure.h"
+# include "mrb/mrb_command.h"
+# include "mrb/mrb_command_input.h"
+# include "mrb/mrb_table_cursor.h"
+# include "mrb/mrb_table_cursor_flags.h"
+# include "mrb/mrb_content_type.h"
+# include "mrb/mrb_writer.h"
+
+# include <mruby/array.h>
+# include <mruby/variable.h>
+#endif /* GRN_WITH_MRUBY */
+
+#ifdef GRN_WITH_MRUBY
+static mrb_value
+mrb_kernel_load(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ char *path;
+
+ mrb_get_args(mrb, "z", &path);
+
+ grn_mrb_load(ctx, path);
+ if (mrb->exc) {
+ mrb_exc_raise(mrb, mrb_obj_value(mrb->exc));
+ }
+
+ grn_mrb_ctx_check(mrb);
+
+ return mrb_true_value();
+}
+
static void
grn_ctx_impl_mrb_init_bindings(grn_ctx *ctx)
{
@@ -45,8 +87,29 @@ grn_ctx_impl_mrb_init_bindings(grn_ctx *ctx)
mrb->ud = ctx;
ctx->impl->mrb.module = mrb_define_module(mrb, "Groonga");
- grn_mrb_load(ctx, "backtrace_entry.rb");
+ mrb_define_class(mrb, "LoadError", mrb_class_get(mrb, "ScriptError"));
+ mrb_define_method(mrb, mrb->kernel_module,
+ "load", mrb_kernel_load, MRB_ARGS_REQ(1));
+
+ {
+ mrb_value load_path;
+ const char *plugins_dir;
+ const char *system_ruby_scripts_dir;
+
+ load_path = mrb_ary_new(mrb);
+ plugins_dir = grn_plugin_get_system_plugins_dir();
+ mrb_ary_push(mrb, load_path,
+ mrb_str_new_cstr(mrb, plugins_dir));
+ system_ruby_scripts_dir = grn_mrb_get_system_ruby_scripts_dir(ctx);
+ mrb_ary_push(mrb, load_path,
+ mrb_str_new_cstr(mrb, system_ruby_scripts_dir));
+ mrb_gv_set(mrb, mrb_intern_cstr(mrb, "$LOAD_PATH"), load_path);
+ }
+
+ grn_mrb_load(ctx, "require.rb");
+ grn_mrb_load(ctx, "initialize/pre.rb");
+ grn_mrb_converter_init(ctx);
grn_mrb_error_init(ctx);
grn_mrb_id_init(ctx);
grn_mrb_operator_init(ctx);
@@ -54,34 +117,67 @@ grn_ctx_impl_mrb_init_bindings(grn_ctx *ctx)
grn_mrb_logger_init(ctx);
grn_mrb_void_init(ctx);
grn_mrb_bulk_init(ctx);
- grn_mrb_obj_init(ctx);
+ grn_mrb_object_init(ctx);
+ grn_mrb_object_flags_init(ctx);
+ grn_mrb_database_init(ctx);
+ grn_mrb_table_init(ctx);
+ grn_mrb_array_init(ctx);
+ grn_mrb_hash_table_init(ctx);
+ grn_mrb_patricia_trie_init(ctx);
+ grn_mrb_double_array_trie_init(ctx);
grn_mrb_column_init(ctx);
grn_mrb_fixed_size_column_init(ctx);
grn_mrb_variable_size_column_init(ctx);
grn_mrb_index_column_init(ctx);
+ grn_mrb_index_cursor_init(ctx);
+ grn_mrb_type_init(ctx);
grn_mrb_expr_init(ctx);
grn_mrb_accessor_init(ctx);
grn_mrb_procedure_init(ctx);
-}
+ grn_mrb_command_init(ctx);
+ grn_mrb_command_input_init(ctx);
+ grn_mrb_table_cursor_init(ctx);
+ grn_mrb_table_cursor_flags_init(ctx);
+ grn_mrb_content_type_init(ctx);
+ grn_mrb_writer_init(ctx);
-static void
-grn_ctx_impl_mrb_init_eval(grn_ctx *ctx)
-{
- grn_mrb_load(ctx, "eval_context.rb");
+ grn_mrb_load(ctx, "initialize/post.rb");
}
void
grn_ctx_impl_mrb_init(grn_ctx *ctx)
{
- const char *grn_mruby_enabled;
- grn_mruby_enabled = getenv("GRN_MRUBY_ENABLED");
- if (grn_mruby_enabled && strcmp(grn_mruby_enabled, "no") == 0) {
+ char grn_mruby_enabled[GRN_ENV_BUFFER_SIZE];
+ grn_getenv("GRN_MRUBY_ENABLED",
+ grn_mruby_enabled,
+ GRN_ENV_BUFFER_SIZE);
+ if (grn_mruby_enabled[0] && strcmp(grn_mruby_enabled, "no") == 0) {
ctx->impl->mrb.state = NULL;
+ ctx->impl->mrb.base_directory[0] = '\0';
ctx->impl->mrb.module = NULL;
+ ctx->impl->mrb.object_class = NULL;
+ ctx->impl->mrb.checked_procs = NULL;
+ ctx->impl->mrb.registered_plugins = NULL;
+ ctx->impl->mrb.builtin.time_class = NULL;
+ ctx->impl->mrb.groonga.operator_class = NULL;
} else {
- ctx->impl->mrb.state = mrb_open();
+ mrb_state *mrb;
+
+ mrb = mrb_open();
+ ctx->impl->mrb.state = mrb;
+ ctx->impl->mrb.base_directory[0] = '\0';
grn_ctx_impl_mrb_init_bindings(ctx);
- grn_ctx_impl_mrb_init_eval(ctx);
+ /* TODO: Implement better error handling on init. */
+ if (ctx->impl->mrb.state->exc) {
+ mrb_print_error(mrb);
+ }
+ ctx->impl->mrb.checked_procs =
+ grn_hash_create(ctx, NULL, sizeof(grn_id), 0, GRN_HASH_TINY);
+ ctx->impl->mrb.registered_plugins =
+ grn_hash_create(ctx, NULL, sizeof(grn_id), 0, GRN_HASH_TINY);
+ GRN_VOID_INIT(&(ctx->impl->mrb.buffer.from));
+ GRN_VOID_INIT(&(ctx->impl->mrb.buffer.to));
+ ctx->impl->mrb.builtin.time_class = mrb_class_get(mrb, "Time");
}
}
@@ -91,9 +187,13 @@ grn_ctx_impl_mrb_fin(grn_ctx *ctx)
if (ctx->impl->mrb.state) {
mrb_close(ctx->impl->mrb.state);
ctx->impl->mrb.state = NULL;
+ grn_hash_close(ctx, ctx->impl->mrb.checked_procs);
+ grn_hash_close(ctx, ctx->impl->mrb.registered_plugins);
+ GRN_OBJ_FIN(ctx, &(ctx->impl->mrb.buffer.from));
+ GRN_OBJ_FIN(ctx, &(ctx->impl->mrb.buffer.to));
}
}
-#else
+#else /* GRN_WITH_MRUBY */
void
grn_ctx_impl_mrb_init(grn_ctx *ctx)
{
@@ -103,4 +203,4 @@ void
grn_ctx_impl_mrb_fin(grn_ctx *ctx)
{
}
-#endif
+#endif /* GRN_WITH_MRUBY */
diff --git a/storage/mroonga/vendor/groonga/lib/dat.cpp b/storage/mroonga/vendor/groonga/lib/dat.cpp
index 8588857cd5d..60588d55710 100644
--- a/storage/mroonga/vendor/groonga/lib/dat.cpp
+++ b/storage/mroonga/vendor/groonga/lib/dat.cpp
@@ -14,16 +14,16 @@
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 "groonga_in.h"
+#include "grn.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <cstring>
#include <new>
-#include "str.h"
-#include "io.h"
-#include "dat.h"
-#include "util.h"
-#include "normalizer_in.h"
+#include "grn_str.h"
+#include "grn_io.h"
+#include "grn_dat.h"
+#include "grn_util.h"
+#include "grn_normalizer.h"
#include "dat/trie.hpp"
#include "dat/cursor-factory.hpp"
@@ -70,7 +70,7 @@ bool
grn_dat_remove_file(grn_ctx *ctx, const char *path)
{
struct stat stat;
- return !::stat(path, &stat) && !unlink(path);
+ return !::stat(path, &stat) && !grn_unlink(path);
}
grn_rc
@@ -144,7 +144,7 @@ grn_dat_generate_trie_path(const char *base_path, char *trie_path, uint32_t file
return;
}
const size_t len = std::strlen(base_path);
- std::memcpy(trie_path, base_path, len);
+ grn_memcpy(trie_path, base_path, len);
trie_path[len] = '.';
grn_itoh(file_id % (1U << (4 * FILE_ID_LENGTH)),
trie_path + len + 1, FILE_ID_LENGTH);
@@ -502,7 +502,7 @@ grn_dat_get_key(grn_ctx *ctx, grn_dat *dat, grn_id id, void *keybuf, int bufsize
return 0;
}
if (keybuf && (bufsize >= (int)key.length())) {
- std::memcpy(keybuf, key.ptr(), key.length());
+ grn_memcpy(keybuf, key.ptr(), key.length());
}
return (int)key.length();
}
@@ -678,12 +678,18 @@ grn_dat_scan(grn_ctx *ctx, grn_dat *dat, const char *str,
{
if (!grn_dat_open_trie_if_needed(ctx, dat) || !str ||
!(dat->obj.header.flags & GRN_OBJ_KEY_VAR_SIZE) || !scan_hits) {
+ if (str_rest) {
+ *str_rest = str;
+ }
return -1;
}
grn::dat::Trie * const trie = static_cast<grn::dat::Trie *>(dat->trie);
if (!trie) {
- return -1;
+ if (str_rest) {
+ *str_rest = str + str_size;
+ }
+ return 0;
}
if (!max_num_scan_hits || !str_size) {
@@ -701,7 +707,9 @@ grn_dat_scan(grn_ctx *ctx, grn_dat *dat, const char *str,
dat->normalizer,
flags);
if (!normalized_string) {
- *str_rest = str;
+ if (str_rest) {
+ *str_rest = str;
+ }
return -1;
}
grn_string_get_normalized(ctx, normalized_string, &str, &str_size, NULL);
@@ -778,6 +786,9 @@ grn_dat_scan(grn_ctx *ctx, grn_dat *dat, const char *str,
} catch (const grn::dat::Exception &ex) {
ERR(grn_dat_translate_error_code(ex.code()),
"grn::dat::lcp_search failed");
+ if (str_rest) {
+ *str_rest = str;
+ }
return -1;
}
return static_cast<int>(num_scan_hits);
diff --git a/storage/mroonga/vendor/groonga/lib/dat/Makefile.am b/storage/mroonga/vendor/groonga/lib/dat/Makefile.am
index 6bad7730de4..0a58629cc77 100644
--- a/storage/mroonga/vendor/groonga/lib/dat/Makefile.am
+++ b/storage/mroonga/vendor/groonga/lib/dat/Makefile.am
@@ -2,8 +2,7 @@ DEFS += -D_REENTRANT $(GRN_DEFS) -DGRN_DAT_EXPORT
DEFAULT_INCLUDES = \
-I$(top_builddir) \
- -I$(top_srcdir)/include \
- -I$(top_srcdir)/lib
+ -I$(top_srcdir)/include
noinst_LTLIBRARIES = libgrndat.la
diff --git a/storage/mroonga/vendor/groonga/lib/dat/dat.hpp b/storage/mroonga/vendor/groonga/lib/dat/dat.hpp
index a2b225a9cf4..c941bf25523 100644
--- a/storage/mroonga/vendor/groonga/lib/dat/dat.hpp
+++ b/storage/mroonga/vendor/groonga/lib/dat/dat.hpp
@@ -42,6 +42,12 @@
# endif // WIN32
#endif // GRN_DAT_API
+#ifdef WIN32
+# define grn_memcpy(dest, src, n) ::memcpy_s((dest), (n), (src), (n))
+#else // WIN32
+# define grn_memcpy(dest, src, n) std::memcpy((dest), (src), (n))
+#endif // WIN32
+
namespace grn {
namespace dat {
@@ -175,13 +181,6 @@ class Exception : public std::exception {
what_(ex.what_) {}
virtual ~Exception() throw() {}
- virtual Exception &operator=(const Exception &ex) throw() {
- file_ = ex.file_;
- line_ = ex.line_;
- what_ = ex.what_;
- return *this;
- }
-
virtual ErrorCode code() const throw() = 0;
virtual const char *file() const throw() {
return file_;
@@ -210,11 +209,6 @@ class Error : public Exception {
: Exception(ex) {}
virtual ~Error() throw() {}
- virtual Error &operator=(const Error &ex) throw() {
- *static_cast<Exception *>(this) = ex;
- return *this;
- }
-
virtual ErrorCode code() const throw() {
return T;
}
diff --git a/storage/mroonga/vendor/groonga/lib/dat/file-impl.cpp b/storage/mroonga/vendor/groonga/lib/dat/file-impl.cpp
index 6382ae965a9..3643a806292 100644
--- a/storage/mroonga/vendor/groonga/lib/dat/file-impl.cpp
+++ b/storage/mroonga/vendor/groonga/lib/dat/file-impl.cpp
@@ -36,6 +36,12 @@
#include <algorithm>
#include <limits>
+#ifdef WIN32
+# define GRN_IO_FILE_CREATE_MODE (GENERIC_READ | GENERIC_WRITE)
+#else /* WIN32 */
+# define GRN_IO_FILE_CREATE_MODE 0644
+#endif /* WIN32 */
+
namespace grn {
namespace dat {
@@ -119,7 +125,7 @@ void FileImpl::swap(FileImpl *rhs) {
void FileImpl::create_(const char *path, UInt64 size) {
if ((path != NULL) && (path[0] != '\0')) {
- file_ = ::CreateFileA(path, GENERIC_READ | GENERIC_WRITE,
+ file_ = ::CreateFileA(path, GRN_IO_FILE_CREATE_MODE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
GRN_DAT_THROW_IF(IO_ERROR, file_ == INVALID_HANDLE_VALUE);
@@ -162,7 +168,7 @@ void FileImpl::open_(const char *path) {
GRN_DAT_THROW_IF(IO_ERROR,
static_cast<UInt64>(st.st_size) > std::numeric_limits< ::size_t>::max());
- file_ = ::CreateFileA(path, GENERIC_READ | GENERIC_WRITE,
+ file_ = ::CreateFileA(path, GRN_IO_FILE_CREATE_MODE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
GRN_DAT_THROW_IF(IO_ERROR, file_ == NULL);
@@ -192,7 +198,7 @@ void FileImpl::create_(const char *path, UInt64 size) {
size > static_cast<UInt64>(std::numeric_limits< ::off_t>::max()));
if ((path != NULL) && (path[0] != '\0')) {
- fd_ = ::open(path, O_RDWR | O_CREAT | O_TRUNC, 0666);
+ fd_ = ::open(path, O_RDWR | O_CREAT | O_TRUNC, GRN_IO_FILE_CREATE_MODE);
GRN_DAT_THROW_IF(IO_ERROR, fd_ == -1);
const ::off_t file_size = static_cast< ::off_t>(size);
diff --git a/storage/mroonga/vendor/groonga/lib/dat/key-cursor.cpp b/storage/mroonga/vendor/groonga/lib/dat/key-cursor.cpp
index 90ba25eca53..6bf864dba55 100644
--- a/storage/mroonga/vendor/groonga/lib/dat/key-cursor.cpp
+++ b/storage/mroonga/vendor/groonga/lib/dat/key-cursor.cpp
@@ -133,7 +133,7 @@ void KeyCursor::ascending_init(const String &min_str, const String &max_str) {
if (max_str.ptr() != NULL) {
if (max_str.length() != 0) {
end_buf_ = new UInt8[max_str.length()];
- std::memcpy(end_buf_, max_str.ptr(), max_str.length());
+ grn_memcpy(end_buf_, max_str.ptr(), max_str.length());
end_str_.assign(end_buf_, max_str.length());
}
}
@@ -206,7 +206,7 @@ void KeyCursor::descending_init(const String &min_str, const String &max_str) {
if (min_str.ptr() != NULL) {
if (min_str.length() != 0) {
end_buf_ = new UInt8[min_str.length()];
- std::memcpy(end_buf_, min_str.ptr(), min_str.length());
+ grn_memcpy(end_buf_, min_str.ptr(), min_str.length());
end_str_.assign(end_buf_, min_str.length());
}
}
diff --git a/storage/mroonga/vendor/groonga/lib/db.c b/storage/mroonga/vendor/groonga/lib/db.c
index f948dc7353a..357df82e314 100644
--- a/storage/mroonga/vendor/groonga/lib/db.c
+++ b/storage/mroonga/vendor/groonga/lib/db.c
@@ -1,5 +1,5 @@
/* -*- c-basic-offset: 2 -*- */
-/* Copyright(C) 2009-2014 Brazil
+/* Copyright(C) 2009-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -14,23 +14,24 @@
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 "groonga_in.h"
-#include "db.h"
-#include "hash.h"
-#include "pat.h"
-#include "dat.h"
-#include "ii.h"
-#include "ctx_impl.h"
-#include "token.h"
-#include "proc.h"
-#include "plugin_in.h"
-#include "geo.h"
-#include "snip.h"
-#include "string_in.h"
-#include "normalizer_in.h"
-#include "util.h"
+#include "grn.h"
+#include "grn_db.h"
+#include "grn_hash.h"
+#include "grn_pat.h"
+#include "grn_dat.h"
+#include "grn_ii.h"
+#include "grn_ctx_impl.h"
+#include "grn_token_cursor.h"
+#include "grn_tokenizers.h"
+#include "grn_proc.h"
+#include "grn_plugin.h"
+#include "grn_geo.h"
+#include "grn_scorers.h"
+#include "grn_snip.h"
+#include "grn_string.h"
+#include "grn_normalizer.h"
+#include "grn_util.h"
#include <string.h>
-#include <float.h>
typedef struct {
grn_id id;
@@ -46,6 +47,9 @@ typedef struct {
((table)->header.impl_flags & GRN_TABLE_GROUPED)
#define GRN_TABLE_GROUPED_ON(table)\
((table)->header.impl_flags |= GRN_TABLE_GROUPED)
+#define GRN_TABLE_IS_MULTI_KEYS_GROUPED(table)\
+ (GRN_TABLE_IS_GROUPED(table) &&\
+ table->header.domain == GRN_ID_NIL)
#define WITH_NORMALIZE(table,key,key_size,block) do {\
if ((table)->normalizer && key && key_size > 0) {\
@@ -67,7 +71,7 @@ inline static grn_id
grn_table_add_v_inline(grn_ctx *ctx, grn_obj *table, const void *key, int key_size,
void **value, int *added);
inline static void
-grn_table_add_subrec_inline(grn_obj *table, grn_rset_recinfo *ri, int score,
+grn_table_add_subrec_inline(grn_obj *table, grn_rset_recinfo *ri, double score,
grn_rset_posinfo *pi, int dir);
inline static grn_id
grn_table_cursor_next_inline(grn_ctx *ctx, grn_table_cursor *tc);
@@ -78,10 +82,14 @@ static void grn_obj_ensure_bulk(grn_ctx *ctx, grn_obj *obj);
static void grn_obj_ensure_vector(grn_ctx *ctx, grn_obj *obj);
inline static void
+grn_obj_get_range_info(grn_ctx *ctx, grn_obj *obj,
+ grn_id *range_id, grn_obj_flags *range_flags);
+
+inline static void
gen_pathname(const char *path, char *buffer, int fno)
{
size_t len = strlen(path);
- memcpy(buffer, path, len);
+ grn_memcpy(buffer, path, len);
if (fno >= 0) {
buffer[len] = '.';
grn_itoh(fno, buffer + len + 1, 7);
@@ -147,11 +155,15 @@ grn_db_create(grn_ctx *ctx, const char *path, grn_db_create_optarg *optarg)
if ((s = GRN_MALLOC(sizeof(grn_db)))) {
grn_bool use_default_db_key = GRN_TRUE;
grn_bool use_pat_as_db_keys = GRN_FALSE;
- if (getenv("GRN_DB_KEY")) {
- if (!strcmp(getenv("GRN_DB_KEY"), "pat")) {
+ char grn_db_key_env[GRN_ENV_BUFFER_SIZE];
+ grn_getenv("GRN_DB_KEY",
+ grn_db_key_env,
+ GRN_ENV_BUFFER_SIZE);
+ if (grn_db_key_env[0]) {
+ if (!strcmp(grn_db_key_env, "pat")) {
use_default_db_key = GRN_FALSE;
use_pat_as_db_keys = GRN_TRUE;
- } else if (!strcmp(getenv("GRN_DB_KEY"), "dat")) {
+ } else if (!strcmp(grn_db_key_env, "dat")) {
use_default_db_key = GRN_FALSE;
}
}
@@ -252,6 +264,7 @@ grn_db_open(grn_ctx *ctx, const char *path)
#endif
grn_db_init_builtin_tokenizers(ctx);
grn_db_init_builtin_normalizers(ctx);
+ grn_db_init_builtin_scorers(ctx);
grn_db_init_builtin_query(ctx);
GRN_API_RETURN((grn_obj *)s);
}
@@ -582,12 +595,17 @@ grn_proc_create(grn_ctx *ctx, const char *name, int name_size, grn_proc_type typ
if (!added) {
db_value *vp;
if ((vp = grn_tiny_array_at(&s->values, id)) && (res = (grn_proc *)vp->ptr)) {
+ /* TODO: Do more robust check. */
if (res->funcs[PROC_INIT] ||
res->funcs[PROC_NEXT] ||
res->funcs[PROC_FIN]) {
ERR(GRN_INVALID_ARGUMENT, "already used name");
GRN_API_RETURN(NULL);
}
+ if (range != GRN_ID_NIL) {
+ grn_plugin_close(ctx, range);
+ }
+ GRN_API_RETURN((grn_obj *)res);
} else {
added = 1;
}
@@ -609,6 +627,7 @@ grn_proc_create(grn_ctx *ctx, const char *name, int name_size, grn_proc_type typ
res->funcs[PROC_NEXT] = next;
res->funcs[PROC_FIN] = fin;
res->selector = NULL;
+ memset(&(res->callbacks), 0, sizeof(res->callbacks));
GRN_TEXT_INIT(&res->name_buf, 0);
res->vars = NULL;
res->nvars = 0;
@@ -633,6 +652,7 @@ grn_proc_create(grn_ctx *ctx, const char *name, int name_size, grn_proc_type typ
static void
calc_rec_size(grn_obj_flags flags, uint32_t max_n_subrecs, uint32_t range_size,
+ uint32_t additional_value_size,
uint8_t *subrec_size, uint8_t *subrec_offset,
uint32_t *key_size, uint32_t *value_size)
{
@@ -676,6 +696,7 @@ calc_rec_size(grn_obj_flags flags, uint32_t max_n_subrecs, uint32_t range_size,
} else {
*value_size = range_size;
}
+ *value_size += additional_value_size;
}
static void _grn_obj_remove(grn_ctx *ctx, grn_obj *obj);
@@ -728,7 +749,9 @@ static grn_obj *
grn_table_create_with_max_n_subrecs(grn_ctx *ctx, const char *name,
unsigned int name_size, const char *path,
grn_obj_flags flags, grn_obj *key_type,
- grn_obj *value_type, uint32_t max_n_subrecs)
+ grn_obj *value_type,
+ uint32_t max_n_subrecs,
+ uint32_t additional_value_size)
{
grn_id id;
grn_id domain = GRN_ID_NIL, range = GRN_ID_NIL;
@@ -862,8 +885,8 @@ grn_table_create_with_max_n_subrecs(grn_ctx *ctx, const char *name,
return NULL;
}
}
- calc_rec_size(flags, max_n_subrecs, range_size, &subrec_size,
- &subrec_offset, &key_size, &value_size);
+ calc_rec_size(flags, max_n_subrecs, range_size, additional_value_size,
+ &subrec_size, &subrec_offset, &key_size, &value_size);
switch (flags & GRN_OBJ_TABLE_TYPE_MASK) {
case GRN_OBJ_TABLE_HASH_KEY :
res = (grn_obj *)grn_hash_create(ctx, path, key_size, value_size, flags);
@@ -886,6 +909,7 @@ grn_table_create_with_max_n_subrecs(grn_ctx *ctx, const char *name,
DB_OBJ(res)->max_n_subrecs = max_n_subrecs;
DB_OBJ(res)->subrec_size = subrec_size;
DB_OBJ(res)->subrec_offset = subrec_offset;
+ DB_OBJ(res)->flags.group = 0;
if (grn_db_obj_init(ctx, db, id, DB_OBJ(res))) {
_grn_obj_remove(ctx, res);
res = NULL;
@@ -904,7 +928,8 @@ grn_table_create(grn_ctx *ctx, const char *name, unsigned int name_size,
grn_obj *res;
GRN_API_ENTER;
res = grn_table_create_with_max_n_subrecs(ctx, name, name_size, path,
- flags, key_type, value_type, 0);
+ flags, key_type, value_type,
+ 0, 0);
GRN_API_RETURN(res);
}
@@ -915,15 +940,27 @@ grn_table_create_for_group(grn_ctx *ctx, const char *name,
unsigned int max_n_subrecs)
{
grn_obj *res = NULL;
- grn_obj *key_type;
GRN_API_ENTER;
- key_type = grn_ctx_at(ctx, grn_obj_get_range(ctx, group_key));
- if (key_type) {
+ if (group_key) {
+ grn_obj *key_type;
+ key_type = grn_ctx_at(ctx, grn_obj_get_range(ctx, group_key));
+ if (key_type) {
+ res = grn_table_create_with_max_n_subrecs(ctx, name, name_size, path,
+ GRN_TABLE_HASH_KEY|
+ GRN_OBJ_WITH_SUBREC|
+ GRN_OBJ_UNIT_USERDEF_DOCUMENT,
+ key_type, value_type,
+ max_n_subrecs, 0);
+ grn_obj_unlink(ctx, key_type);
+ }
+ } else {
res = grn_table_create_with_max_n_subrecs(ctx, name, name_size, path,
GRN_TABLE_HASH_KEY|
+ GRN_OBJ_KEY_VAR_SIZE|
GRN_OBJ_WITH_SUBREC|
GRN_OBJ_UNIT_USERDEF_DOCUMENT,
- key_type, value_type, max_n_subrecs);
+ NULL, value_type,
+ max_n_subrecs, 0);
}
GRN_API_RETURN(res);
}
@@ -957,7 +994,7 @@ grn_table_get_subrecs(grn_ctx *ctx, grn_obj *table, grn_id id,
}
for (; count < limit; count++) {
if (scorebuf) {
- scorebuf[count] = *((int *)psubrec);
+ scorebuf[count] = *((double *)psubrec);
}
psubrec += GRN_RSET_SCORE_SIZE;
if (subrecbuf) {
@@ -1681,6 +1718,22 @@ delete_reference_records(grn_ctx *ctx, grn_obj *table, grn_id id)
return ctx->rc;
}
+static grn_rc
+grn_table_delete_prepare(grn_ctx *ctx, grn_obj *table,
+ grn_id id, const void *key, unsigned int key_size)
+{
+ grn_rc rc;
+
+ rc = delete_reference_records(ctx, table, id);
+ if (rc != GRN_SUCCESS) {
+ return rc;
+ }
+ call_delete_hook(ctx, table, id, key, key_size);
+ clear_column_values(ctx, table, id);
+
+ return rc;
+}
+
grn_rc
grn_table_delete(grn_ctx *ctx, grn_obj *table, const void *key, unsigned int key_size)
{
@@ -1690,12 +1743,10 @@ grn_table_delete(grn_ctx *ctx, grn_obj *table, const void *key, unsigned int key
if (table) {
if (key && key_size) { rid = grn_table_get(ctx, table, key, key_size); }
if (rid) {
- rc = delete_reference_records(ctx, table, rid);
+ rc = grn_table_delete_prepare(ctx, table, rid, key, key_size);
if (rc != GRN_SUCCESS) {
goto exit;
}
- call_delete_hook(ctx, table, rid, key, key_size);
- clear_column_values(ctx, table, rid);
switch (table->header.type) {
case GRN_DB :
/* todo : delete tables and columns from db */
@@ -1740,10 +1791,12 @@ grn_table_delete(grn_ctx *ctx, grn_obj *table, const void *key, unsigned int key
});
break;
}
- grn_obj_touch(ctx, table, NULL);
+ if (rc == GRN_SUCCESS) {
+ grn_obj_touch(ctx, table, NULL);
+ }
}
}
-exit:
+exit :
GRN_API_RETURN(rc);
}
@@ -1753,16 +1806,17 @@ _grn_table_delete_by_id(grn_ctx *ctx, grn_obj *table, grn_id id,
{
grn_rc rc = GRN_INVALID_ARGUMENT;
if (table) {
- const void *key;
- unsigned int key_size;
if (id) {
- rc = delete_reference_records(ctx, table, id);
+ const void *key = NULL;
+ unsigned int key_size = 0;
+
+ if (table->header.type != GRN_TABLE_NO_KEY) {
+ key = _grn_table_key(ctx, table, id, &key_size);
+ }
+ rc = grn_table_delete_prepare(ctx, table, id, key, key_size);
if (rc != GRN_SUCCESS) {
goto exit;
}
- if ((key = _grn_table_key(ctx, table, id, &key_size))) {
- call_delete_hook(ctx, table, id, key, key_size);
- }
// todo : support optarg
switch (table->header.type) {
case GRN_TABLE_PAT_KEY :
@@ -1778,12 +1832,9 @@ _grn_table_delete_by_id(grn_ctx *ctx, grn_obj *table, grn_id id,
rc = grn_array_delete_by_id(ctx, (grn_array *)table, id, optarg);
break;
}
- if (rc == GRN_SUCCESS) {
- clear_column_values(ctx, table, id);
- }
}
}
-exit:
+exit :
return rc;
}
@@ -1801,7 +1852,9 @@ grn_table_delete_by_id(grn_ctx *ctx, grn_obj *table, grn_id id)
} else {
rc = _grn_table_delete_by_id(ctx, table, id, NULL);
}
- grn_obj_touch(ctx, table, NULL);
+ if (rc == GRN_SUCCESS) {
+ grn_obj_touch(ctx, table, NULL);
+ }
GRN_API_RETURN(rc);
}
@@ -1839,6 +1892,9 @@ grn_column_truncate(grn_ctx *ctx, grn_obj *column)
rc = grn_ra_truncate(ctx, (grn_ra *)column);
break;
}
+ if (rc == GRN_SUCCESS) {
+ grn_obj_touch(ctx, column, NULL);
+ }
}
exit :
GRN_API_RETURN(rc);
@@ -1866,9 +1922,11 @@ grn_table_truncate(grn_ctx *ctx, grn_obj *table)
}
grn_hash_close(ctx, cols);
}
- grn_table_get_info(ctx, table, NULL, NULL, &tokenizer, &normalizer, NULL);
- GRN_PTR_INIT(&token_filters, GRN_OBJ_VECTOR, GRN_ID_NIL);
- grn_obj_get_info(ctx, table, GRN_INFO_TOKEN_FILTERS, &token_filters);
+ if (table->header.type != GRN_TABLE_NO_KEY) {
+ grn_table_get_info(ctx, table, NULL, NULL, &tokenizer, &normalizer, NULL);
+ GRN_PTR_INIT(&token_filters, GRN_OBJ_VECTOR, GRN_ID_NIL);
+ grn_obj_get_info(ctx, table, GRN_INFO_TOKEN_FILTERS, &token_filters);
+ }
switch (table->header.type) {
case GRN_TABLE_PAT_KEY :
for (hooks = DB_OBJ(table)->hooks[GRN_HOOK_INSERT]; hooks; hooks = hooks->next) {
@@ -1901,11 +1959,15 @@ grn_table_truncate(grn_ctx *ctx, grn_obj *table)
rc = grn_array_truncate(ctx, (grn_array *)table);
break;
}
- grn_obj_set_info(ctx, table, GRN_INFO_DEFAULT_TOKENIZER, tokenizer);
- grn_obj_set_info(ctx, table, GRN_INFO_NORMALIZER, normalizer);
- grn_obj_set_info(ctx, table, GRN_INFO_TOKEN_FILTERS, &token_filters);
- GRN_OBJ_FIN(ctx, &token_filters);
- grn_obj_touch(ctx, table, NULL);
+ if (table->header.type != GRN_TABLE_NO_KEY) {
+ grn_obj_set_info(ctx, table, GRN_INFO_DEFAULT_TOKENIZER, tokenizer);
+ grn_obj_set_info(ctx, table, GRN_INFO_NORMALIZER, normalizer);
+ grn_obj_set_info(ctx, table, GRN_INFO_TOKEN_FILTERS, &token_filters);
+ GRN_OBJ_FIN(ctx, &token_filters);
+ }
+ if (rc == GRN_SUCCESS) {
+ grn_obj_touch(ctx, table, NULL);
+ }
}
exit :
GRN_API_RETURN(rc);
@@ -1948,7 +2010,7 @@ grn_table_get_info(grn_ctx *ctx, grn_obj *table, grn_obj_flags *flags,
case GRN_TABLE_NO_KEY :
if (flags) { *flags = 0; }
if (encoding) { *encoding = GRN_ENC_NONE; }
- if (tokenizer) { *tokenizer = grn_token_uvector; }
+ if (tokenizer) { *tokenizer = grn_tokenizer_uvector; }
if (normalizer) { *normalizer = NULL; }
if (token_filters) { *token_filters = NULL; }
rc = GRN_SUCCESS;
@@ -1991,10 +2053,10 @@ grn_table_size(grn_ctx *ctx, grn_obj *table)
}
inline static void
-subrecs_push(byte *subrecs, int size, int n_subrecs, int score, void *body, int dir)
+subrecs_push(byte *subrecs, int size, int n_subrecs, double score, void *body, int dir)
{
byte *v;
- int *c2;
+ double *c2;
int n = n_subrecs - 1, n2;
while (n) {
n2 = (n - 1) >> 1;
@@ -2004,15 +2066,16 @@ subrecs_push(byte *subrecs, int size, int n_subrecs, int score, void *body, int
n = n2;
}
v = subrecs + n * (GRN_RSET_SCORE_SIZE + size);
- *((int *)v) = score;
- memcpy(v + GRN_RSET_SCORE_SIZE, body, size);
+ *((double *)v) = score;
+ grn_memcpy(v + GRN_RSET_SCORE_SIZE, body, size);
}
inline static void
-subrecs_replace_min(byte *subrecs, int size, int n_subrecs, int score, void *body, int dir)
+subrecs_replace_min(byte *subrecs, int size, int n_subrecs, double score, void *body, int dir)
{
byte *v;
- int n = 0, n1, n2, *c1, *c2;
+ int n = 0, n1, n2;
+ double *c1, *c2;
for (;;) {
n1 = n * 2 + 1;
n2 = n1 + 1;
@@ -2038,12 +2101,12 @@ subrecs_replace_min(byte *subrecs, int size, int n_subrecs, int score, void *bod
}
}
v = subrecs + n * (GRN_RSET_SCORE_SIZE + size);
- memcpy(v, &score, GRN_RSET_SCORE_SIZE);
- memcpy(v + GRN_RSET_SCORE_SIZE, body, size);
+ grn_memcpy(v, &score, GRN_RSET_SCORE_SIZE);
+ grn_memcpy(v + GRN_RSET_SCORE_SIZE, body, size);
}
inline static void
-grn_table_add_subrec_inline(grn_obj *table, grn_rset_recinfo *ri, int score,
+grn_table_add_subrec_inline(grn_obj *table, grn_rset_recinfo *ri, double score,
grn_rset_posinfo *pi, int dir)
{
if (DB_OBJ(table)->header.flags & GRN_OBJ_WITH_SUBREC) {
@@ -2056,7 +2119,7 @@ grn_table_add_subrec_inline(grn_obj *table, grn_rset_recinfo *ri, int score,
if (pi) {
byte *body = (byte *)pi + DB_OBJ(table)->subrec_offset;
if (limit < n_subrecs) {
- if (GRN_RSET_SUBRECS_CMP(score, *ri->subrecs, dir) > 0) {
+ if (GRN_RSET_SUBRECS_CMP(score, *((double *)(ri->subrecs)), dir) > 0) {
subrecs_replace_min((byte *)ri->subrecs, subrec_size, limit, score, body, dir);
}
} else {
@@ -2068,7 +2131,7 @@ grn_table_add_subrec_inline(grn_obj *table, grn_rset_recinfo *ri, int score,
}
void
-grn_table_add_subrec(grn_obj *table, grn_rset_recinfo *ri, int score,
+grn_table_add_subrec(grn_obj *table, grn_rset_recinfo *ri, double score,
grn_rset_posinfo *pi, int dir)
{
grn_table_add_subrec_inline(table, ri, score, pi, dir);
@@ -2389,24 +2452,58 @@ grn_table_cursor_delete(grn_ctx *ctx, grn_table_cursor *tc)
if (!tc) {
ERR(GRN_INVALID_ARGUMENT, "tc is null");
} else {
+ grn_id id;
+ grn_obj *table;
+ const void *key = NULL;
+ unsigned int key_size = 0;
switch (tc->header.type) {
case GRN_CURSOR_TABLE_PAT_KEY :
- rc = grn_pat_cursor_delete(ctx, (grn_pat_cursor *)tc, NULL);
+ {
+ grn_pat_cursor *pc = (grn_pat_cursor *)tc;
+ id = pc->curr_rec;
+ table = (grn_obj *)(pc->pat);
+ key = _grn_pat_key(ctx, pc->pat, id, &key_size);
+ rc = grn_table_delete_prepare(ctx, table, id, key, key_size);
+ if (rc != GRN_SUCCESS) {
+ goto exit;
+ }
+ rc = grn_pat_cursor_delete(ctx, pc, NULL);
+ }
break;
case GRN_CURSOR_TABLE_DAT_KEY :
rc = GRN_OPERATION_NOT_SUPPORTED;
break;
case GRN_CURSOR_TABLE_HASH_KEY :
- rc = grn_hash_cursor_delete(ctx, (grn_hash_cursor *)tc, NULL);
+ {
+ grn_hash_cursor *hc = (grn_hash_cursor *)tc;
+ id = hc->curr_rec;
+ table = (grn_obj *)(hc->hash);
+ key = _grn_hash_key(ctx, hc->hash, id, &key_size);
+ rc = grn_table_delete_prepare(ctx, table, id, key, key_size);
+ if (rc != GRN_SUCCESS) {
+ goto exit;
+ }
+ rc = grn_hash_cursor_delete(ctx, hc, NULL);
+ }
break;
case GRN_CURSOR_TABLE_NO_KEY :
- rc = grn_array_cursor_delete(ctx, (grn_array_cursor *)tc, NULL);
+ {
+ grn_array_cursor *ac = (grn_array_cursor *)tc;
+ id = ac->curr_rec;
+ table = (grn_obj *)(ac->array);
+ rc = grn_table_delete_prepare(ctx, table, id, key, key_size);
+ if (rc != GRN_SUCCESS) {
+ goto exit;
+ }
+ rc = grn_array_cursor_delete(ctx, ac, NULL);
+ }
break;
default :
ERR(GRN_INVALID_ARGUMENT, "invalid type %d", tc->header.type);
break;
}
}
+exit :
GRN_API_RETURN(rc);
}
@@ -2694,16 +2791,8 @@ grn_accessor_resolve(grn_ctx *ctx, grn_obj *accessor, int deep,
{
grn_id *tid;
- grn_obj *domain;
grn_obj *next_res;
- grn_search_optarg next_optarg;
grn_rset_recinfo *recinfo;
- if (optarg) {
- next_optarg = *optarg;
- next_optarg.mode = GRN_OP_EXACT;
- } else {
- memset(&next_optarg, 0, sizeof(grn_search_optarg));
- }
{
grn_obj *range = grn_ctx_at(ctx, DB_OBJ(index)->range);
next_res = grn_table_create(ctx, NULL, 0, NULL,
@@ -2718,29 +2807,33 @@ grn_accessor_resolve(grn_ctx *ctx, grn_obj *accessor, int deep,
break;
}
}
- domain = grn_ctx_at(ctx, index->header.domain);
GRN_HASH_EACH(ctx, (grn_hash *)current_res, id, &tid, NULL, &recinfo, {
- next_optarg.weight_vector = NULL;
- next_optarg.vector_size = recinfo->score;
- if (domain->header.type == GRN_TABLE_NO_KEY) {
- rc = grn_ii_sel(ctx, (grn_ii *)index,
- (const char *)tid, sizeof(grn_id),
- (grn_hash *)next_res, GRN_OP_OR,
- &next_optarg);
- } else {
- char key[GRN_TABLE_MAX_KEY_SIZE];
- int key_len;
- key_len = grn_table_get_key(ctx, domain, *tid,
- key, GRN_TABLE_MAX_KEY_SIZE);
- rc = grn_ii_sel(ctx, (grn_ii *)index, key, key_len,
- (grn_hash *)next_res, GRN_OP_OR,
- &next_optarg);
+ grn_ii *ii = (grn_ii *)index;
+ grn_ii_cursor *ii_cursor;
+ grn_ii_posting *posting;
+
+ ii_cursor = grn_ii_cursor_open(ctx, ii, *tid,
+ GRN_ID_NIL, GRN_ID_MAX,
+ ii->n_elements,
+ 0);
+ if (!ii_cursor) {
+ continue;
}
+
+ while ((posting = grn_ii_cursor_next(ctx, ii_cursor))) {
+ grn_ii_posting add_posting = *posting;
+ add_posting.weight += recinfo->score - 1;
+ grn_ii_posting_add(ctx,
+ &add_posting,
+ (grn_hash *)next_res,
+ GRN_OP_OR);
+ }
+ grn_ii_cursor_close(ctx, ii_cursor);
+
if (rc != GRN_SUCCESS) {
break;
}
});
- grn_obj_unlink(ctx, domain);
if (current_res != base_res) {
grn_obj_unlink(ctx, current_res);
}
@@ -2975,9 +3068,42 @@ grn_obj_search(grn_ctx *ctx, grn_obj *obj, grn_obj *query,
#define GRN_TABLE_GROUP_FILTER_PREFIX 0
#define GRN_TABLE_GROUP_FILTER_SUFFIX (1L<<2)
-static int
-accelerated_table_group(grn_ctx *ctx, grn_obj *table, grn_obj *key, grn_obj *res)
+inline static void
+grn_table_group_add_subrec(grn_ctx *ctx,
+ grn_obj *table,
+ grn_rset_recinfo *ri, double score,
+ grn_rset_posinfo *pi, int dir,
+ grn_obj *calc_target,
+ grn_obj *value_buffer)
{
+ grn_table_group_flags flags;
+
+ if (!(DB_OBJ(table)->header.flags & GRN_OBJ_WITH_SUBREC)) {
+ return;
+ }
+
+ grn_table_add_subrec_inline(table, ri, score, pi, dir);
+
+ flags = DB_OBJ(table)->flags.group;
+
+ if (!(flags & (GRN_TABLE_GROUP_CALC_MAX |
+ GRN_TABLE_GROUP_CALC_MIN |
+ GRN_TABLE_GROUP_CALC_SUM |
+ GRN_TABLE_GROUP_CALC_AVG))) {
+ return;
+ }
+
+ GRN_BULK_REWIND(value_buffer);
+ grn_obj_get_value(ctx, calc_target, pi->rid, value_buffer);
+ grn_rset_recinfo_update_calc_values(ctx, ri, table, value_buffer);
+}
+
+static grn_bool
+accelerated_table_group(grn_ctx *ctx, grn_obj *table, grn_obj *key,
+ grn_table_group_result *result)
+{
+ grn_obj *res = result->table;
+ grn_obj *calc_target = result->calc_target;
if (key->header.type == GRN_ACCESSOR) {
grn_accessor *a = (grn_accessor *)key;
if (a->action == GRN_ACCESSOR_GET_KEY &&
@@ -2987,6 +3113,9 @@ accelerated_table_group(grn_ctx *ctx, grn_obj *table, grn_obj *key, grn_obj *res
int idp = GRN_OBJ_TABLEP(range);
grn_table_cursor *tc;
if ((tc = grn_table_cursor_open(ctx, table, NULL, 0, NULL, 0, 0, -1, 0))) {
+ grn_bool processed = GRN_TRUE;
+ grn_obj value_buffer;
+ GRN_VOID_INIT(&value_buffer);
switch (a->next->obj->header.type) {
case GRN_COLUMN_FIX_SIZE :
{
@@ -3011,8 +3140,11 @@ accelerated_table_group(grn_ctx *ctx, grn_obj *table, grn_obj *key, grn_obj *res
}
if ((!idp || *((grn_id *)v)) &&
grn_table_add_v_inline(ctx, res, v, element_size, &value, NULL)) {
- grn_table_add_subrec_inline(res, value, ri ? ri->score : 0,
- (grn_rset_posinfo *)&id, 0);
+ grn_table_group_add_subrec(ctx, res, value,
+ ri ? ri->score : 0,
+ (grn_rset_posinfo *)&id, 0,
+ calc_target,
+ &value_buffer);
}
}
GRN_RA_CACHE_FIN(ra, &cache);
@@ -3037,8 +3169,11 @@ accelerated_table_group(grn_ctx *ctx, grn_obj *table, grn_obj *key, grn_obj *res
while (len) {
if ((*v != GRN_ID_NIL) &&
grn_table_add_v_inline(ctx, res, v, sizeof(grn_id), &value, NULL)) {
- grn_table_add_subrec_inline(res, value, ri ? ri->score : 0,
- (grn_rset_posinfo *)&id, 0);
+ grn_table_group_add_subrec(ctx, res, value,
+ ri ? ri->score : 0,
+ (grn_rset_posinfo *)&id, 0,
+ calc_target,
+ &value_buffer);
}
v++;
len -= sizeof(grn_id);
@@ -3047,18 +3182,109 @@ accelerated_table_group(grn_ctx *ctx, grn_obj *table, grn_obj *key, grn_obj *res
}
}
} else {
- return 0;
+ processed = GRN_FALSE;
}
break;
default :
- return 0;
+ processed = GRN_FALSE;
+ break;
}
+ GRN_OBJ_FIN(ctx, &value_buffer);
grn_table_cursor_close(ctx, tc);
- return 1;
+ return processed;
}
}
}
- return 0;
+ return GRN_FALSE;
+}
+
+static void
+grn_table_group_single_key_records(grn_ctx *ctx, grn_obj *table,
+ grn_obj *key, grn_table_group_result *result)
+{
+ grn_obj bulk;
+ grn_obj value_buffer;
+ grn_table_cursor *tc;
+ grn_obj *res = result->table;
+ grn_obj *calc_target = result->calc_target;
+
+ GRN_TEXT_INIT(&bulk, 0);
+ GRN_VOID_INIT(&value_buffer);
+ if ((tc = grn_table_cursor_open(ctx, table, NULL, 0, NULL, 0, 0, -1, 0))) {
+ grn_id id;
+ grn_obj *range = grn_ctx_at(ctx, grn_obj_get_range(ctx, key));
+ int idp = GRN_OBJ_TABLEP(range);
+ while ((id = grn_table_cursor_next_inline(ctx, tc))) {
+ void *value;
+ grn_rset_recinfo *ri = NULL;
+ GRN_BULK_REWIND(&bulk);
+ if (DB_OBJ(table)->header.flags & GRN_OBJ_WITH_SUBREC) {
+ grn_table_cursor_get_value_inline(ctx, tc, (void **)&ri);
+ }
+ grn_obj_get_value(ctx, key, id, &bulk);
+ switch (bulk.header.type) {
+ case GRN_UVECTOR :
+ {
+ // todo : support objects except grn_id
+ grn_id *v = (grn_id *)GRN_BULK_HEAD(&bulk);
+ grn_id *ve = (grn_id *)GRN_BULK_CURR(&bulk);
+ while (v < ve) {
+ if ((*v != GRN_ID_NIL) &&
+ grn_table_add_v_inline(ctx, res,
+ v, sizeof(grn_id), &value, NULL)) {
+ grn_table_group_add_subrec(ctx, res, value,
+ ri ? ri->score : 0,
+ (grn_rset_posinfo *)&id, 0,
+ calc_target,
+ &value_buffer);
+ }
+ v++;
+ }
+ }
+ break;
+ case GRN_VECTOR :
+ {
+ unsigned int i, n_elements;
+ n_elements = grn_vector_size(ctx, &bulk);
+ for (i = 0; i < n_elements; i++) {
+ const char *content;
+ unsigned int content_length;
+ content_length = grn_vector_get_element(ctx, &bulk, i,
+ &content, NULL, NULL);
+ if (grn_table_add_v_inline(ctx, res,
+ content, content_length,
+ &value, NULL)) {
+ grn_table_group_add_subrec(ctx, res, value,
+ ri ? ri->score : 0,
+ (grn_rset_posinfo *)&id, 0,
+ calc_target,
+ &value_buffer);
+ }
+ }
+ }
+ break;
+ case GRN_BULK :
+ {
+ if ((!idp || *((grn_id *)GRN_BULK_HEAD(&bulk))) &&
+ grn_table_add_v_inline(ctx, res,
+ GRN_BULK_HEAD(&bulk), GRN_BULK_VSIZE(&bulk),
+ &value, NULL)) {
+ grn_table_group_add_subrec(ctx, res, value,
+ ri ? ri->score : 0,
+ (grn_rset_posinfo *)&id, 0,
+ calc_target,
+ &value_buffer);
+ }
+ }
+ break;
+ default :
+ ERR(GRN_INVALID_ARGUMENT, "invalid column");
+ break;
+ }
+ }
+ grn_table_cursor_close(ctx, tc);
+ }
+ grn_obj_close(ctx, &bulk);
}
grn_rc
@@ -3164,6 +3390,263 @@ grn_table_group_with_range_gap(grn_ctx *ctx, grn_obj *table,
return 0;
}
+static inline void
+grn_table_group_multi_keys_add_record(grn_ctx *ctx,
+ grn_table_sort_key *keys,
+ int n_keys,
+ grn_table_group_result *results,
+ int n_results,
+ grn_id id,
+ grn_rset_recinfo *ri,
+ grn_obj *vector,
+ grn_obj *bulk)
+{
+ int r;
+ grn_table_group_result *rp;
+
+ for (r = 0, rp = results; r < n_results; r++, rp++) {
+ void *value;
+ int i;
+ int end;
+
+ if (rp->key_end > n_keys) {
+ end = n_keys;
+ } else {
+ end = rp->key_end + 1;
+ }
+ GRN_BULK_REWIND(bulk);
+ grn_text_benc(ctx, bulk, end - rp->key_begin);
+ for (i = rp->key_begin; i < end; i++) {
+ grn_section section = vector->u.v.sections[i];
+ grn_text_benc(ctx, bulk, section.length);
+ }
+ {
+ grn_obj *body = vector->u.v.body;
+ if (body) {
+ GRN_TEXT_PUT(ctx, bulk, GRN_BULK_HEAD(body), GRN_BULK_VSIZE(body));
+ }
+ }
+ for (i = rp->key_begin; i < end; i++) {
+ grn_section section = vector->u.v.sections[i];
+ grn_text_benc(ctx, bulk, section.weight);
+ grn_text_benc(ctx, bulk, section.domain);
+ }
+
+ // todo : cut off GRN_ID_NIL
+ if (grn_table_add_v_inline(ctx, rp->table,
+ GRN_BULK_HEAD(bulk), GRN_BULK_VSIZE(bulk),
+ &value, NULL)) {
+ grn_table_group_add_subrec(ctx, rp->table, value,
+ ri ? ri->score : 0,
+ (grn_rset_posinfo *)&id, 0,
+ rp->calc_target,
+ bulk);
+ }
+ }
+}
+
+static void
+grn_table_group_multi_keys_scalar_records(grn_ctx *ctx,
+ grn_obj *table,
+ grn_table_sort_key *keys,
+ int n_keys,
+ grn_table_group_result *results,
+ int n_results)
+{
+ grn_id id;
+ grn_table_cursor *tc;
+ grn_obj bulk;
+ grn_obj vector;
+
+ tc = grn_table_cursor_open(ctx, table, NULL, 0, NULL, 0, 0, -1, 0);
+ if (!tc) {
+ return;
+ }
+
+ GRN_TEXT_INIT(&bulk, 0);
+ GRN_OBJ_INIT(&vector, GRN_VECTOR, 0, GRN_DB_VOID);
+ while ((id = grn_table_cursor_next_inline(ctx, tc))) {
+ int k;
+ grn_table_sort_key *kp;
+ grn_rset_recinfo *ri = NULL;
+
+ if (DB_OBJ(table)->header.flags & GRN_OBJ_WITH_SUBREC) {
+ grn_table_cursor_get_value_inline(ctx, tc, (void **)&ri);
+ }
+
+ GRN_BULK_REWIND(&vector);
+ for (k = 0, kp = keys; k < n_keys; k++, kp++) {
+ GRN_BULK_REWIND(&bulk);
+ grn_obj_get_value(ctx, kp->key, id, &bulk);
+ grn_vector_add_element(ctx, &vector,
+ GRN_BULK_HEAD(&bulk), GRN_BULK_VSIZE(&bulk),
+ 0,
+ bulk.header.domain);
+ }
+
+ grn_table_group_multi_keys_add_record(ctx, keys, n_keys, results, n_results,
+ id, ri, &vector, &bulk);
+ }
+ GRN_OBJ_FIN(ctx, &vector);
+ GRN_OBJ_FIN(ctx, &bulk);
+ grn_table_cursor_close(ctx, tc);
+}
+
+static inline void
+grn_table_group_multi_keys_vector_record(grn_ctx *ctx,
+ grn_table_sort_key *keys,
+ grn_obj *key_buffers,
+ int nth_key,
+ int n_keys,
+ grn_table_group_result *results,
+ int n_results,
+ grn_id id,
+ grn_rset_recinfo *ri,
+ grn_obj *vector,
+ grn_obj *bulk)
+{
+ int k;
+ grn_table_sort_key *kp;
+
+ for (k = nth_key, kp = &(keys[nth_key]); k < n_keys; k++, kp++) {
+ grn_obj *key_buffer = &(key_buffers[k]);
+ switch (key_buffer->header.type) {
+ case GRN_UVECTOR :
+ {
+ unsigned int n_vector_elements;
+ grn_id domain;
+ grn_id *ids;
+ unsigned int i, n_ids;
+
+ n_vector_elements = grn_vector_size(ctx, vector);
+ domain = key_buffer->header.domain;
+ ids = (grn_id *)GRN_BULK_HEAD(key_buffer);
+ n_ids = GRN_BULK_VSIZE(key_buffer) / sizeof(grn_id);
+ for (i = 0; i < n_ids; i++) {
+ grn_id element_id = ids[i];
+ grn_vector_add_element(ctx, vector,
+ (const char *)(&element_id), sizeof(grn_id),
+ 0,
+ domain);
+ grn_table_group_multi_keys_vector_record(ctx,
+ keys, key_buffers,
+ k + 1, n_keys,
+ results, n_results,
+ id, ri, vector, bulk);
+ while (grn_vector_size(ctx, vector) != n_vector_elements) {
+ const char *content;
+ grn_vector_pop_element(ctx, vector, &content, NULL, NULL);
+ }
+ }
+ return;
+ }
+ break;
+ case GRN_VECTOR :
+ {
+ unsigned int n_vector_elements;
+ unsigned int i, n_key_elements;
+
+ n_vector_elements = grn_vector_size(ctx, vector);
+ n_key_elements = grn_vector_size(ctx, key_buffer);
+ for (i = 0; i < n_key_elements; i++) {
+ const char *content;
+ unsigned int content_length;
+ grn_id domain;
+ content_length = grn_vector_get_element(ctx, key_buffer, i,
+ &content, NULL, &domain);
+ grn_vector_add_element(ctx, vector,
+ content, content_length,
+ 0,
+ domain);
+ grn_table_group_multi_keys_vector_record(ctx,
+ keys, key_buffers,
+ k + 1, n_keys,
+ results, n_results,
+ id, ri, vector, bulk);
+ while (grn_vector_size(ctx, vector) != n_vector_elements) {
+ grn_vector_pop_element(ctx, vector, &content, NULL, NULL);
+ }
+ }
+ return;
+ }
+ break;
+ default :
+ grn_vector_add_element(ctx, vector,
+ GRN_BULK_HEAD(key_buffer),
+ GRN_BULK_VSIZE(key_buffer),
+ 0,
+ key_buffer->header.domain);
+ }
+ }
+
+ if (k == n_keys) {
+ grn_table_group_multi_keys_add_record(ctx,
+ keys, n_keys,
+ results, n_results,
+ id, ri, vector, bulk);
+ }
+}
+
+static void
+grn_table_group_multi_keys_vector_records(grn_ctx *ctx,
+ grn_obj *table,
+ grn_table_sort_key *keys,
+ int n_keys,
+ grn_table_group_result *results,
+ int n_results)
+{
+ grn_id id;
+ grn_table_cursor *tc;
+ grn_obj bulk;
+ grn_obj vector;
+ grn_obj *key_buffers;
+ int k;
+
+ tc = grn_table_cursor_open(ctx, table, NULL, 0, NULL, 0, 0, -1, 0);
+ if (!tc) {
+ return;
+ }
+
+ key_buffers = GRN_MALLOCN(grn_obj, n_keys);
+ if (!key_buffers) {
+ grn_table_cursor_close(ctx, tc);
+ return;
+ }
+
+ GRN_TEXT_INIT(&bulk, 0);
+ GRN_OBJ_INIT(&vector, GRN_VECTOR, 0, GRN_DB_VOID);
+ for (k = 0; k < n_keys; k++) {
+ GRN_VOID_INIT(&(key_buffers[k]));
+ }
+ while ((id = grn_table_cursor_next_inline(ctx, tc))) {
+ grn_table_sort_key *kp;
+ grn_rset_recinfo *ri = NULL;
+
+ if (DB_OBJ(table)->header.flags & GRN_OBJ_WITH_SUBREC) {
+ grn_table_cursor_get_value_inline(ctx, tc, (void **)&ri);
+ }
+
+ for (k = 0, kp = keys; k < n_keys; k++, kp++) {
+ grn_obj *key_buffer = &(key_buffers[k]);
+ GRN_BULK_REWIND(key_buffer);
+ grn_obj_get_value(ctx, kp->key, id, key_buffer);
+ }
+
+ GRN_BULK_REWIND(&vector);
+ grn_table_group_multi_keys_vector_record(ctx,
+ keys, key_buffers, 0, n_keys,
+ results, n_results,
+ id, ri, &vector, &bulk);
+ }
+ for (k = 0; k < n_keys; k++) {
+ GRN_OBJ_FIN(ctx, &(key_buffers[k]));
+ }
+ GRN_FREE(key_buffers);
+ GRN_OBJ_FIN(ctx, &vector);
+ GRN_OBJ_FIN(ctx, &bulk);
+ grn_table_cursor_close(ctx, tc);
+}
+
grn_rc
grn_table_group(grn_ctx *ctx, grn_obj *table,
grn_table_sort_key *keys, int n_keys,
@@ -3177,9 +3660,6 @@ grn_table_group(grn_ctx *ctx, grn_obj *table,
GRN_API_ENTER;
{
int k, r;
- void *key;
- grn_obj bulk;
- grn_table_cursor *tc;
grn_table_sort_key *kp;
grn_table_group_result *rp;
for (k = 0, kp = keys; k < n_keys; k++, kp++) {
@@ -3190,94 +3670,59 @@ grn_table_group(grn_ctx *ctx, grn_obj *table,
}
for (r = 0, rp = results; r < n_results; r++, rp++) {
if (!rp->table) {
- ERR(GRN_INVALID_ARGUMENT, "table missing in (%d)", r);
- goto exit;
+ grn_obj_flags flags;
+ grn_obj *key_type = NULL;
+ uint32_t additional_value_size;
+
+ flags = GRN_TABLE_HASH_KEY|
+ GRN_OBJ_WITH_SUBREC|
+ GRN_OBJ_UNIT_USERDEF_DOCUMENT;
+ if (n_keys == 1) {
+ key_type = grn_ctx_at(ctx, grn_obj_get_range(ctx, keys[0].key));
+ } else {
+ flags |= GRN_OBJ_KEY_VAR_SIZE;
+ }
+ additional_value_size = grn_rset_recinfo_calc_values_size(ctx,
+ rp->flags);
+ rp->table = grn_table_create_with_max_n_subrecs(ctx, NULL, 0, NULL,
+ flags,
+ key_type, table,
+ rp->max_n_subrecs,
+ additional_value_size);
+ if (key_type) {
+ grn_obj_unlink(ctx, key_type);
+ }
+ if (!rp->table) {
+ goto exit;
+ }
+ DB_OBJ(rp->table)->flags.group = rp->flags;
}
}
- GRN_TEXT_INIT(&bulk, 0);
if (n_keys == 1 && n_results == 1) {
- if (!accelerated_table_group(ctx, table, keys->key, results->table)) {
- if ((tc = grn_table_cursor_open(ctx, table, NULL, 0, NULL, 0, 0, -1, 0))) {
- grn_id id;
- grn_obj *range = grn_ctx_at(ctx, grn_obj_get_range(ctx, keys->key));
- int idp = GRN_OBJ_TABLEP(range);
- while ((id = grn_table_cursor_next_inline(ctx, tc))) {
- void *value;
- grn_rset_recinfo *ri = NULL;
- GRN_BULK_REWIND(&bulk);
- if (DB_OBJ(table)->header.flags & GRN_OBJ_WITH_SUBREC) {
- grn_table_cursor_get_value_inline(ctx, tc, (void **)&ri);
- }
- grn_obj_get_value(ctx, keys->key, id, &bulk);
- switch (bulk.header.type) {
- case GRN_UVECTOR :
- {
- // todo : support objects except grn_id
- grn_id *v = (grn_id *)GRN_BULK_HEAD(&bulk);
- grn_id *ve = (grn_id *)GRN_BULK_CURR(&bulk);
- while (v < ve) {
- if ((*v != GRN_ID_NIL) &&
- grn_table_add_v_inline(ctx, results->table, v, sizeof(grn_id), &value, NULL)) {
- grn_table_add_subrec_inline(results->table, value, ri ? ri->score : 0,
- (grn_rset_posinfo *)&id, 0);
- }
- v++;
- }
- }
- break;
- case GRN_VECTOR :
- ERR(GRN_OPERATION_NOT_SUPPORTED, "sorry.. not implemented yet");
- /* todo */
- break;
- case GRN_BULK :
- {
- if ((!idp || *((grn_id *)GRN_BULK_HEAD(&bulk))) &&
- grn_table_add_v_inline(ctx, results->table,
- GRN_BULK_HEAD(&bulk), GRN_BULK_VSIZE(&bulk), &value, NULL)) {
- grn_table_add_subrec_inline(results->table, value, ri ? ri->score : 0,
- (grn_rset_posinfo *)&id, 0);
- }
- }
- break;
- default :
- ERR(GRN_INVALID_ARGUMENT, "invalid column");
- break;
- }
- }
- grn_table_cursor_close(ctx, tc);
- }
+ if (!accelerated_table_group(ctx, table, keys->key, results)) {
+ grn_table_group_single_key_records(ctx, table, keys->key, results);
}
} else {
- if ((tc = grn_table_cursor_open(ctx, table, NULL, 0, NULL, 0, 0, -1, 0))) {
- grn_id id;
- while ((id = grn_table_cursor_next_inline(ctx, tc))) {
- grn_rset_recinfo *ri = NULL;
- GRN_BULK_REWIND(&bulk);
- if (DB_OBJ(table)->header.flags & GRN_OBJ_WITH_SUBREC) {
- grn_table_cursor_get_value_inline(ctx, tc, (void **)&ri);
- }
- for (k = 0, kp = keys; k < n_keys; k++, kp++) {
- kp->offset = GRN_BULK_VSIZE(&bulk);
- grn_obj_get_value(ctx, kp->key, id, &bulk);
- }
- for (r = 0, rp = results; r < n_results; r++, rp++) {
- void *value;
- int begin = keys[rp->key_begin].offset;
- int end = rp->key_end >= n_keys
- ? GRN_BULK_VSIZE(&bulk)
- : keys[rp->key_end].offset;
- key = GRN_BULK_HEAD(&bulk) + begin;
- // todo : cut off GRN_ID_NIL
- if (grn_table_add_v_inline(ctx, rp->table, key, end - begin, &value, NULL)) {
- grn_table_add_subrec_inline(rp->table, value, ri ? ri->score : 0,
- (grn_rset_posinfo *)&id, 0);
- }
- }
+ grn_bool have_vector = GRN_FALSE;
+ for (k = 0, kp = keys; k < n_keys; k++, kp++) {
+ grn_id range_id;
+ grn_obj_flags range_flags = 0;
+ grn_obj_get_range_info(ctx, kp->key, &range_id, &range_flags);
+ if (range_flags == GRN_OBJ_VECTOR) {
+ have_vector = GRN_TRUE;
+ break;
}
- grn_table_cursor_close(ctx, tc);
+ }
+ if (have_vector) {
+ grn_table_group_multi_keys_vector_records(ctx, table,
+ keys, n_keys,
+ results, n_results);
+ } else {
+ grn_table_group_multi_keys_scalar_records(ctx, table,
+ keys, n_keys,
+ results, n_results);
}
}
- grn_obj_close(ctx, &bulk);
for (r = 0, rp = results; r < n_results; r++, rp++) {
GRN_TABLE_GROUPED_ON(rp->table);
}
@@ -3347,7 +3792,7 @@ grn_table_setoperation(grn_ctx *ctx, grn_obj *table1, grn_obj *table2, grn_obj *
GRN_TABLE_EACH(ctx, table2, 0, 0, id, &key, &key_size, &value2, {
if (grn_table_add_v_inline(ctx, table1, key, key_size, &value1, &added)) {
if (added) {
- memcpy(value1, value2, value_size);
+ grn_memcpy(value1, value2, value_size);
} else {
grn_rset_recinfo *ri1 = value1;
grn_rset_recinfo *ri2 = value2;
@@ -3358,7 +3803,7 @@ grn_table_setoperation(grn_ctx *ctx, grn_obj *table1, grn_obj *table2, grn_obj *
} else {
GRN_TABLE_EACH(ctx, table2, 0, 0, id, &key, &key_size, &value2, {
if (grn_table_add_v_inline(ctx, table1, key, key_size, &value1, NULL)) {
- memcpy(value1, value2, value_size);
+ grn_memcpy(value1, value2, value_size);
}
});
}
@@ -3390,7 +3835,7 @@ grn_table_setoperation(grn_ctx *ctx, grn_obj *table1, grn_obj *table2, grn_obj *
case GRN_OP_ADJUST :
GRN_TABLE_EACH(ctx, table2, 0, 0, id, &key, &key_size, &value2, {
if (grn_table_get_v(ctx, table1, key, key_size, &value1)) {
- memcpy(value1, value2, value_size);
+ grn_memcpy(value1, value2, value_size);
}
});
break;
@@ -3439,7 +3884,7 @@ grn_obj_column_(grn_ctx *ctx, grn_obj *table, const char *name, unsigned int nam
if (len) {
buf[len++] = GRN_DB_DELIMITER;
if (len + name_size <= GRN_TABLE_MAX_KEY_SIZE) {
- memcpy(buf + len, name, name_size);
+ grn_memcpy(buf + len, name, name_size);
column = grn_ctx_get(ctx, buf, len + name_size);
} else {
ERR(GRN_INVALID_ARGUMENT, "name is too long");
@@ -3585,7 +4030,7 @@ grn_column_create(grn_ctx *ctx, grn_obj *table,
goto exit;
}
fullname[len] = GRN_DB_DELIMITER;
- memcpy(fullname + len + 1, name, name_size);
+ grn_memcpy(fullname + len + 1, name, name_size);
name_size += len + 1;
} else {
ERR(GRN_FUNCTION_NOT_IMPLEMENTED,
@@ -3674,8 +4119,9 @@ grn_column_create(grn_ctx *ctx, grn_obj *table,
if (grn_db_obj_init(ctx, db, id, DB_OBJ(res))) {
_grn_obj_remove(ctx, res);
res = NULL;
+ } else {
+ grn_obj_touch(ctx, res, NULL);
}
- grn_obj_touch(ctx, res, NULL);
}
exit :
if (!res && id) { grn_obj_delete_by_id(ctx, db, id, GRN_TRUE); }
@@ -3712,7 +4158,7 @@ grn_column_open(grn_ctx *ctx, grn_obj *table,
goto exit;
}
fullname[len] = GRN_DB_DELIMITER;
- memcpy(fullname + len + 1, name, name_size);
+ grn_memcpy(fullname + len + 1, name, name_size);
name_size += len + 1;
} else {
ERR(GRN_INVALID_ARGUMENT, "todo : not supported yet");
@@ -3776,7 +4222,7 @@ default_column_set_value(grn_ctx *ctx, grn_proc_ctx *pctx, grn_obj *in, grn_obj
ERR(GRN_NO_MEMORY_AVAILABLE, "ra get failed");
return GRN_NO_MEMORY_AVAILABLE;
}
- memcpy(v, in->u.p.ptr, value_size);
+ grn_memcpy(v, in->u.p.ptr, value_size);
grn_ra_unref(ctx, (grn_ra *)pctx->obj, arg->id);
}
break;
@@ -3816,17 +4262,67 @@ grn_vector_delimit(grn_ctx *ctx, grn_obj *vector)
*/
static unsigned int
-grn_uvector_size_internal(grn_ctx *ctx, grn_obj *uvector)
+grn_uvector_element_size_internal(grn_ctx *ctx, grn_obj *uvector)
{
- unsigned int size;
+ unsigned int element_size;
if (IS_WEIGHT_UVECTOR(uvector)) {
- size = GRN_BULK_VSIZE(uvector) / sizeof(weight_uvector_entry);
+ element_size = sizeof(weight_uvector_entry);
} else {
- size = GRN_BULK_VSIZE(uvector) / sizeof(grn_id);
+ switch (uvector->header.domain) {
+ case GRN_DB_BOOL :
+ element_size = sizeof(grn_bool);
+ break;
+ case GRN_DB_INT8 :
+ element_size = sizeof(int8_t);
+ break;
+ case GRN_DB_UINT8 :
+ element_size = sizeof(uint8_t);
+ break;
+ case GRN_DB_INT16 :
+ element_size = sizeof(int16_t);
+ break;
+ case GRN_DB_UINT16 :
+ element_size = sizeof(uint16_t);
+ break;
+ case GRN_DB_INT32 :
+ element_size = sizeof(int32_t);
+ break;
+ case GRN_DB_UINT32 :
+ element_size = sizeof(uint32_t);
+ break;
+ case GRN_DB_INT64 :
+ element_size = sizeof(int64_t);
+ break;
+ case GRN_DB_UINT64 :
+ element_size = sizeof(uint64_t);
+ break;
+ case GRN_DB_FLOAT :
+ element_size = sizeof(double);
+ break;
+ case GRN_DB_TIME :
+ element_size = sizeof(int64_t);
+ break;
+ case GRN_DB_TOKYO_GEO_POINT :
+ case GRN_DB_WGS84_GEO_POINT :
+ element_size = sizeof(grn_geo_point);
+ break;
+ default :
+ element_size = sizeof(grn_id);
+ break;
+ }
}
- return size;
+ return element_size;
+}
+
+static unsigned int
+grn_uvector_size_internal(grn_ctx *ctx, grn_obj *uvector)
+{
+ unsigned int element_size;
+
+ element_size = grn_uvector_element_size_internal(ctx, uvector);
+ return GRN_BULK_VSIZE(uvector) / element_size;
}
unsigned int
@@ -4098,6 +4594,30 @@ grn_uvector_size(grn_ctx *ctx, grn_obj *uvector)
GRN_API_RETURN(size);
}
+unsigned int
+grn_uvector_element_size(grn_ctx *ctx, grn_obj *uvector)
+{
+ unsigned int element_size;
+
+ if (!uvector) {
+ ERR(GRN_INVALID_ARGUMENT, "uvector must not be NULL");
+ return 0;
+ }
+
+ if (uvector->header.type != GRN_UVECTOR) {
+ grn_obj type_name;
+ GRN_TEXT_INIT(&type_name, 0);
+ grn_inspect_type(ctx, &type_name, uvector->header.type);
+ ERR(GRN_INVALID_ARGUMENT, "must be GRN_UVECTOR: %.*s",
+ (int)GRN_TEXT_LEN(&type_name), GRN_TEXT_VALUE(&type_name));
+ GRN_OBJ_FIN(ctx, &type_name);
+ return 0;
+ }
+
+ GRN_API_ENTER;
+ element_size = grn_uvector_element_size_internal(ctx, uvector);
+ GRN_API_RETURN(element_size);
+}
grn_rc
grn_uvector_add_element(grn_ctx *ctx, grn_obj *uvector,
@@ -4184,6 +4704,68 @@ accessor_new(grn_ctx *ctx)
return res;
}
+inline static grn_bool
+grn_obj_get_accessor_rset_value(grn_ctx *ctx, grn_obj *obj,
+ grn_accessor **res, uint8_t action)
+{
+ grn_bool succeeded = GRN_FALSE;
+ grn_accessor **rp;
+
+ for (rp = res; GRN_TRUE; rp = &(*rp)->next) {
+ *rp = accessor_new(ctx);
+ (*rp)->obj = obj;
+
+ switch (action) {
+ case GRN_ACCESSOR_GET_SCORE :
+ if (DB_OBJ(obj)->header.flags & GRN_OBJ_WITH_SUBREC) {
+ (*rp)->action = action;
+ succeeded = GRN_TRUE;
+ goto exit;
+ }
+ break;
+ case GRN_ACCESSOR_GET_MAX :
+ case GRN_ACCESSOR_GET_MIN :
+ case GRN_ACCESSOR_GET_SUM :
+ case GRN_ACCESSOR_GET_AVG :
+ case GRN_ACCESSOR_GET_NSUBRECS :
+ if (GRN_TABLE_IS_GROUPED(obj)) {
+ (*rp)->action = action;
+ succeeded = GRN_TRUE;
+ goto exit;
+ }
+ break;
+ }
+
+ switch (obj->header.type) {
+ case GRN_TABLE_PAT_KEY :
+ case GRN_TABLE_DAT_KEY :
+ case GRN_TABLE_HASH_KEY :
+ (*rp)->action = GRN_ACCESSOR_GET_KEY;
+ break;
+ case GRN_TABLE_NO_KEY :
+ if (!obj->header.domain) {
+ goto exit;
+ }
+ (*rp)->action = GRN_ACCESSOR_GET_VALUE;
+ break;
+ default :
+ /* lookup failed */
+ goto exit;
+ }
+ if (!(obj = grn_ctx_at(ctx, obj->header.domain))) {
+ goto exit;
+ }
+ }
+
+exit :
+ if (!succeeded) {
+ grn_obj_close(ctx, (grn_obj *)*res);
+ *res = NULL;
+ }
+
+ return succeeded;
+}
+
static grn_obj *
grn_obj_get_accessor(grn_ctx *ctx, grn_obj *obj, const char *name, unsigned int name_size)
{
@@ -4203,6 +4785,10 @@ grn_obj_get_accessor(grn_ctx *ctx, grn_obj *obj, const char *name, unsigned int
case GRN_ACCESSOR_GET_VALUE :
case GRN_ACCESSOR_GET_SCORE :
case GRN_ACCESSOR_GET_NSUBRECS :
+ case GRN_ACCESSOR_GET_MAX :
+ case GRN_ACCESSOR_GET_MIN :
+ case GRN_ACCESSOR_GET_SUM :
+ case GRN_ACCESSOR_GET_AVG :
obj = grn_ctx_at(ctx, DB_OBJ(res->obj)->range);
break;
case GRN_ACCESSOR_GET_COLUMN_VALUE :
@@ -4240,6 +4826,11 @@ grn_obj_get_accessor(grn_ctx *ctx, grn_obj *obj, const char *name, unsigned int
for (rp = &res; !done; rp = &(*rp)->next) {
*rp = accessor_new(ctx);
(*rp)->obj = obj;
+ if (GRN_TABLE_IS_MULTI_KEYS_GROUPED(obj)) {
+ (*rp)->action = GRN_ACCESSOR_GET_KEY;
+ done++;
+ break;
+ }
if (!(obj = grn_ctx_at(ctx, obj->header.domain))) {
grn_obj_close(ctx, (grn_obj *)res);
res = NULL;
@@ -4366,42 +4957,23 @@ grn_obj_get_accessor(grn_ctx *ctx, grn_obj *obj, const char *name, unsigned int
}
}
break;
- case 's' : /* score */
- if (len != GRN_COLUMN_NAME_SCORE_LEN ||
- memcmp(name, GRN_COLUMN_NAME_SCORE, GRN_COLUMN_NAME_SCORE_LEN)) {
- goto exit;
- }
- for (rp = &res; !done; rp = &(*rp)->next) {
- *rp = accessor_new(ctx);
- (*rp)->obj = obj;
- if (DB_OBJ(obj)->header.flags & GRN_OBJ_WITH_SUBREC) {
- (*rp)->action = GRN_ACCESSOR_GET_SCORE;
- done++;
- } else {
- switch (obj->header.type) {
- case GRN_TABLE_PAT_KEY :
- case GRN_TABLE_DAT_KEY :
- case GRN_TABLE_HASH_KEY :
- (*rp)->action = GRN_ACCESSOR_GET_KEY;
- break;
- case GRN_TABLE_NO_KEY :
- if (obj->header.domain) {
- (*rp)->action = GRN_ACCESSOR_GET_VALUE;
- break;
- }
- /* fallthru */
- default :
- /* lookup failed */
- grn_obj_close(ctx, (grn_obj *)res);
- res = NULL;
- goto exit;
- }
- if (!(obj = grn_ctx_at(ctx, obj->header.domain))) {
- grn_obj_close(ctx, (grn_obj *)res);
- res = NULL;
- goto exit;
- }
+ case 's' : /* score, sum */
+ if (len == GRN_COLUMN_NAME_SCORE_LEN &&
+ memcmp(name, GRN_COLUMN_NAME_SCORE, GRN_COLUMN_NAME_SCORE_LEN) == 0) {
+ if (!grn_obj_get_accessor_rset_value(ctx, obj, &res,
+ GRN_ACCESSOR_GET_SCORE)) {
+ goto exit;
+ }
+ } else if (len == GRN_COLUMN_NAME_SUM_LEN &&
+ memcmp(name,
+ GRN_COLUMN_NAME_SUM,
+ GRN_COLUMN_NAME_SUM_LEN) == 0) {
+ if (!grn_obj_get_accessor_rset_value(ctx, obj, &res,
+ GRN_ACCESSOR_GET_SUM)) {
+ goto exit;
}
+ } else {
+ goto exit;
}
break;
case 'n' : /* nsubrecs */
@@ -4411,37 +4983,43 @@ grn_obj_get_accessor(grn_ctx *ctx, grn_obj *obj, const char *name, unsigned int
GRN_COLUMN_NAME_NSUBRECS_LEN)) {
goto exit;
}
- for (rp = &res; !done; rp = &(*rp)->next) {
- *rp = accessor_new(ctx);
- (*rp)->obj = obj;
- if (GRN_TABLE_IS_GROUPED(obj)) {
- (*rp)->action = GRN_ACCESSOR_GET_NSUBRECS;
- done++;
- } else {
- switch (obj->header.type) {
- case GRN_TABLE_PAT_KEY :
- case GRN_TABLE_DAT_KEY :
- case GRN_TABLE_HASH_KEY :
- (*rp)->action = GRN_ACCESSOR_GET_KEY;
- break;
- case GRN_TABLE_NO_KEY :
- if (obj->header.domain) {
- (*rp)->action = GRN_ACCESSOR_GET_VALUE;
- break;
- }
- /* fallthru */
- default :
- /* lookup failed */
- grn_obj_close(ctx, (grn_obj *)res);
- res = NULL;
- goto exit;
- }
- if (!(obj = grn_ctx_at(ctx, obj->header.domain))) {
- grn_obj_close(ctx, (grn_obj *)res);
- res = NULL;
- goto exit;
- }
+ if (!grn_obj_get_accessor_rset_value(ctx, obj, &res,
+ GRN_ACCESSOR_GET_NSUBRECS)) {
+ goto exit;
+ }
+ break;
+ case 'm' : /* max, min */
+ if (len == GRN_COLUMN_NAME_MAX_LEN &&
+ memcmp(name,
+ GRN_COLUMN_NAME_MAX,
+ GRN_COLUMN_NAME_MAX_LEN) == 0) {
+ if (!grn_obj_get_accessor_rset_value(ctx, obj, &res,
+ GRN_ACCESSOR_GET_MAX)) {
+ goto exit;
+ }
+ } else if (len == GRN_COLUMN_NAME_MIN_LEN &&
+ memcmp(name,
+ GRN_COLUMN_NAME_MIN,
+ GRN_COLUMN_NAME_MIN_LEN) == 0) {
+ if (!grn_obj_get_accessor_rset_value(ctx, obj, &res,
+ GRN_ACCESSOR_GET_MIN)) {
+ goto exit;
+ }
+ } else {
+ goto exit;
+ }
+ break;
+ case 'a' : /* avg */
+ if (len == GRN_COLUMN_NAME_AVG_LEN &&
+ memcmp(name,
+ GRN_COLUMN_NAME_AVG,
+ GRN_COLUMN_NAME_AVG_LEN) == 0) {
+ if (!grn_obj_get_accessor_rset_value(ctx, obj, &res,
+ GRN_ACCESSOR_GET_AVG)) {
+ goto exit;
}
+ } else {
+ goto exit;
}
break;
default :
@@ -4468,7 +5046,9 @@ grn_obj_get_accessor(grn_ctx *ctx, grn_obj *obj, const char *name, unsigned int
(*rp)->action = GRN_ACCESSOR_GET_COLUMN_VALUE;
break;
} else {
- if (!obj->header.domain) {
+ grn_id next_obj_id;
+ next_obj_id = obj->header.domain;
+ if (!next_obj_id) {
// ERR(GRN_INVALID_ARGUMENT, "no such column: <%s>", name);
if (!is_chained) {
grn_obj_close(ctx, (grn_obj *)res);
@@ -4478,7 +5058,8 @@ grn_obj_get_accessor(grn_ctx *ctx, grn_obj *obj, const char *name, unsigned int
}
*rp = accessor_new(ctx);
(*rp)->obj = obj;
- if (!(obj = grn_ctx_at(ctx, obj->header.domain))) {
+ obj = grn_ctx_at(ctx, next_obj_id);
+ if (!obj) {
grn_obj_close(ctx, (grn_obj *)res);
res = NULL;
goto exit;
@@ -4527,6 +5108,33 @@ grn_column_is_vector(grn_ctx *ctx, grn_obj *column)
return type == GRN_OBJ_COLUMN_VECTOR;
}
+inline static grn_bool
+grn_column_is_index(grn_ctx *ctx, grn_obj *column)
+{
+ grn_obj_flags type;
+
+ if (column->header.type == GRN_ACCESSOR) {
+ grn_accessor *a;
+ for (a = (grn_accessor *)column; a; a = a->next) {
+ if (a->next) {
+ continue;
+ }
+ if (a->action != GRN_ACCESSOR_GET_COLUMN_VALUE) {
+ return GRN_FALSE;
+ }
+
+ column = a->obj;
+ }
+ }
+
+ if (column->header.type != GRN_COLUMN_INDEX) {
+ return GRN_FALSE;
+ }
+
+ type = column->header.flags & GRN_OBJ_COLUMN_TYPE_MASK;
+ return type == GRN_OBJ_COLUMN_INDEX;
+}
+
inline static void
grn_obj_get_range_info(grn_ctx *ctx, grn_obj *obj,
grn_id *range_id, grn_obj_flags *range_flags)
@@ -4549,16 +5157,21 @@ grn_obj_get_range_info(grn_ctx *ctx, grn_obj *obj,
}
break;
case GRN_ACCESSOR_GET_SCORE :
+ *range_id = GRN_DB_FLOAT;
+ break;
case GRN_ACCESSOR_GET_NSUBRECS :
*range_id = GRN_DB_INT32;
break;
+ case GRN_ACCESSOR_GET_MAX :
+ case GRN_ACCESSOR_GET_MIN :
+ case GRN_ACCESSOR_GET_SUM :
+ *range_id = GRN_DB_INT64;
+ break;
+ case GRN_ACCESSOR_GET_AVG :
+ *range_id = GRN_DB_FLOAT;
+ break;
case GRN_ACCESSOR_GET_COLUMN_VALUE :
- if (GRN_DB_OBJP(a->obj)) {
- *range_id = DB_OBJ(a->obj)->range;
- if (grn_column_is_vector(ctx, a->obj)) {
- *range_flags = GRN_OBJ_VECTOR;
- }
- }
+ grn_obj_get_range_info(ctx, a->obj, range_id, range_flags);
break;
case GRN_ACCESSOR_GET_KEY :
if (GRN_DB_OBJP(a->obj)) { *range_id = DB_OBJ(a->obj)->header.domain; }
@@ -4594,6 +5207,10 @@ grn_obj_is_persistent(grn_ctx *ctx, grn_obj *obj)
switch (a->action) {
case GRN_ACCESSOR_GET_SCORE :
case GRN_ACCESSOR_GET_NSUBRECS :
+ case GRN_ACCESSOR_GET_MAX :
+ case GRN_ACCESSOR_GET_MIN :
+ case GRN_ACCESSOR_GET_SUM :
+ case GRN_ACCESSOR_GET_AVG :
res = 0;
break;
case GRN_ACCESSOR_GET_ID :
@@ -4626,7 +5243,11 @@ grn_obj_is_persistent(grn_ctx *ctx, grn_obj *obj)
if (GRN_BULK_VSIZE(p_key)) {\
id = addp ? grn_table_add_by_key(ctx, table, p_key, NULL)\
: grn_table_get_by_key(ctx, table, p_key);\
- if (id) { GRN_RECORD_SET(ctx, dest, id); }\
+ if (id) {\
+ GRN_RECORD_SET(ctx, dest, id);\
+ } else {\
+ rc = GRN_INVALID_ARGUMENT;\
+ }\
} else {\
GRN_RECORD_SET(ctx, dest, GRN_ID_NIL);\
}\
@@ -4636,7 +5257,11 @@ grn_obj_is_persistent(grn_ctx *ctx, grn_obj *obj)
GRN_UINT32_INIT(&record_id, 0);\
grn_obj_cast(ctx, src, &record_id, GRN_TRUE);\
id = GRN_UINT32_VALUE(&record_id);\
- if (id) { GRN_RECORD_SET(ctx, dest, id); }\
+ if (id) {\
+ GRN_RECORD_SET(ctx, dest, id);\
+ } else {\
+ rc = GRN_INVALID_ARGUMENT;\
+ }\
}\
} else {\
rc = GRN_FUNCTION_NOT_IMPLEMENTED;\
@@ -5071,7 +5696,7 @@ grn_accessor_get_value_(grn_ctx *ctx, grn_accessor *a, grn_id id, uint32_t *size
case GRN_ACCESSOR_GET_SCORE :
if ((value = grn_obj_get_value_(ctx, a->obj, id, size))) {
value = (const char *)&((grn_rset_recinfo *)value)->score;
- *size = sizeof(int);
+ *size = sizeof(double);
}
break;
case GRN_ACCESSOR_GET_NSUBRECS :
@@ -5080,6 +5705,42 @@ grn_accessor_get_value_(grn_ctx *ctx, grn_accessor *a, grn_id id, uint32_t *size
*size = sizeof(int);
}
break;
+ case GRN_ACCESSOR_GET_MAX :
+ if ((value = grn_obj_get_value_(ctx, a->obj, id, size))) {
+ value =
+ (const char *)grn_rset_recinfo_get_max_(ctx,
+ (grn_rset_recinfo *)value,
+ a->obj);
+ *size = GRN_RSET_MAX_SIZE;
+ }
+ break;
+ case GRN_ACCESSOR_GET_MIN :
+ if ((value = grn_obj_get_value_(ctx, a->obj, id, size))) {
+ value =
+ (const char *)grn_rset_recinfo_get_min_(ctx,
+ (grn_rset_recinfo *)value,
+ a->obj);
+ *size = GRN_RSET_MIN_SIZE;
+ }
+ break;
+ case GRN_ACCESSOR_GET_SUM :
+ if ((value = grn_obj_get_value_(ctx, a->obj, id, size))) {
+ value =
+ (const char *)grn_rset_recinfo_get_sum_(ctx,
+ (grn_rset_recinfo *)value,
+ a->obj);
+ *size = GRN_RSET_SUM_SIZE;
+ }
+ break;
+ case GRN_ACCESSOR_GET_AVG :
+ if ((value = grn_obj_get_value_(ctx, a->obj, id, size))) {
+ value =
+ (const char *)grn_rset_recinfo_get_avg_(ctx,
+ (grn_rset_recinfo *)value,
+ a->obj);
+ *size = GRN_RSET_AVG_SIZE;
+ }
+ break;
case GRN_ACCESSOR_GET_COLUMN_VALUE :
/* todo : support vector */
value = grn_obj_get_value_(ctx, a->obj, id, size);
@@ -5120,13 +5781,35 @@ grn_accessor_get_value(grn_ctx *ctx, grn_accessor *a, grn_id id, grn_obj *value)
switch (a->action) {
case GRN_ACCESSOR_GET_ID :
GRN_UINT32_PUT(ctx, value, id);
+ value->header.domain = GRN_DB_UINT32;
vp = GRN_BULK_HEAD(value) + size0;
vs = GRN_BULK_VSIZE(value) - size0;
break;
case GRN_ACCESSOR_GET_KEY :
- grn_table_get_key2(ctx, a->obj, id, value);
- vp = GRN_BULK_HEAD(value) + size0;
- vs = GRN_BULK_VSIZE(value) - size0;
+ if (!a->next && GRN_TABLE_IS_MULTI_KEYS_GROUPED(a->obj)) {
+ grn_obj_ensure_vector(ctx, value);
+ if (id) {
+ grn_obj raw_vector;
+ GRN_TEXT_INIT(&raw_vector, 0);
+ grn_table_get_key2(ctx, a->obj, id, &raw_vector);
+ grn_vector_decode(ctx, value,
+ GRN_BULK_HEAD(&raw_vector),
+ GRN_BULK_VSIZE(&raw_vector));
+ GRN_OBJ_FIN(ctx, &raw_vector);
+ }
+ vp = NULL;
+ vs = 0;
+ } else {
+ if (id) {
+ grn_table_get_key2(ctx, a->obj, id, value);
+ vp = GRN_BULK_HEAD(value) + size0;
+ vs = GRN_BULK_VSIZE(value) - size0;
+ } else {
+ vp = NULL;
+ vs = 0;
+ }
+ value->header.domain = a->obj->header.domain;
+ }
break;
case GRN_ACCESSOR_GET_VALUE :
grn_obj_get_value(ctx, a->obj, id, value);
@@ -5134,17 +5817,66 @@ grn_accessor_get_value(grn_ctx *ctx, grn_accessor *a, grn_id id, grn_obj *value)
vs = GRN_BULK_VSIZE(value) - size0;
break;
case GRN_ACCESSOR_GET_SCORE :
- grn_obj_get_value(ctx, a->obj, id, value);
- {
+ if (id) {
grn_rset_recinfo *ri = (grn_rset_recinfo *)grn_obj_get_value_(ctx, a->obj, id, &vs);
- GRN_INT32_PUT(ctx, value, ri->score);
+ GRN_FLOAT_PUT(ctx, value, ri->score);
+ } else {
+ GRN_FLOAT_PUT(ctx, value, 0.0);
}
+ value->header.domain = GRN_DB_FLOAT;
break;
case GRN_ACCESSOR_GET_NSUBRECS :
- {
+ if (id) {
grn_rset_recinfo *ri = (grn_rset_recinfo *)grn_obj_get_value_(ctx, a->obj, id, &vs);
GRN_INT32_PUT(ctx, value, ri->n_subrecs);
+ } else {
+ GRN_INT32_PUT(ctx, value, 0);
}
+ value->header.domain = GRN_DB_INT32;
+ break;
+ case GRN_ACCESSOR_GET_MAX :
+ if (id) {
+ grn_rset_recinfo *ri = (grn_rset_recinfo *)grn_obj_get_value_(ctx, a->obj, id, &vs);
+ int64_t max;
+ max = grn_rset_recinfo_get_max(ctx, ri, a->obj);
+ GRN_INT64_PUT(ctx, value, max);
+ } else {
+ GRN_INT64_PUT(ctx, value, 0);
+ }
+ value->header.domain = GRN_DB_INT64;
+ break;
+ case GRN_ACCESSOR_GET_MIN :
+ if (id) {
+ grn_rset_recinfo *ri = (grn_rset_recinfo *)grn_obj_get_value_(ctx, a->obj, id, &vs);
+ int64_t min;
+ min = grn_rset_recinfo_get_min(ctx, ri, a->obj);
+ GRN_INT64_PUT(ctx, value, min);
+ } else {
+ GRN_INT64_PUT(ctx, value, 0);
+ }
+ value->header.domain = GRN_DB_INT64;
+ break;
+ case GRN_ACCESSOR_GET_SUM :
+ if (id) {
+ grn_rset_recinfo *ri = (grn_rset_recinfo *)grn_obj_get_value_(ctx, a->obj, id, &vs);
+ int64_t sum;
+ sum = grn_rset_recinfo_get_sum(ctx, ri, a->obj);
+ GRN_INT64_PUT(ctx, value, sum);
+ } else {
+ GRN_INT64_PUT(ctx, value, 0);
+ }
+ value->header.domain = GRN_DB_INT64;
+ break;
+ case GRN_ACCESSOR_GET_AVG :
+ if (id) {
+ grn_rset_recinfo *ri = (grn_rset_recinfo *)grn_obj_get_value_(ctx, a->obj, id, &vs);
+ double avg;
+ avg = grn_rset_recinfo_get_avg(ctx, ri, a->obj);
+ GRN_FLOAT_PUT(ctx, value, avg);
+ } else {
+ GRN_FLOAT_PUT(ctx, value, 0.0);
+ }
+ value->header.domain = GRN_DB_FLOAT;
break;
case GRN_ACCESSOR_GET_COLUMN_VALUE :
/* todo : support vector */
@@ -5165,7 +5897,11 @@ grn_accessor_get_value(grn_ctx *ctx, grn_accessor *a, grn_id id, grn_obj *value)
break;
}
if ((a = a->next)) {
- id = *((grn_id *)vp);
+ if (vs > 0) {
+ id = *((grn_id *)vp);
+ } else {
+ id = GRN_ID_NIL;
+ }
} else {
break;
}
@@ -5208,15 +5944,14 @@ grn_accessor_set_value(grn_ctx *ctx, grn_accessor *a, grn_id id,
} else {
uint32_t size;
if ((ri = (grn_rset_recinfo *) grn_obj_get_value_(ctx, a->obj, id, &size))) {
- vp = &ri->score;
// todo : flags support
- if (value->header.domain == GRN_DB_INT32) {
- memcpy(vp, GRN_BULK_HEAD(value), sizeof(int));
+ if (value->header.domain == GRN_DB_FLOAT) {
+ ri->score = GRN_FLOAT_VALUE(value);
} else {
grn_obj buf;
- GRN_INT32_INIT(&buf, 0);
+ GRN_FLOAT_INIT(&buf, 0);
grn_obj_cast(ctx, value, &buf, GRN_FALSE);
- memcpy(vp, GRN_BULK_HEAD(&buf), sizeof(int));
+ ri->score = GRN_FLOAT_VALUE(&buf);
GRN_OBJ_FIN(ctx, &buf);
}
}
@@ -5230,6 +5965,74 @@ grn_accessor_set_value(grn_ctx *ctx, grn_accessor *a, grn_id id,
vp = &ri->n_subrecs;
}
break;
+ case GRN_ACCESSOR_GET_MAX :
+ grn_obj_get_value(ctx, a->obj, id, &buf);
+ {
+ grn_rset_recinfo *ri = (grn_rset_recinfo *)GRN_BULK_HEAD(&buf);
+ if (value->header.type == GRN_DB_INT64) {
+ grn_rset_recinfo_set_max(ctx, ri, a->obj, GRN_INT64_VALUE(value));
+ } else {
+ grn_obj value_int64;
+ GRN_INT64_INIT(&value_int64, 0);
+ if (!grn_obj_cast(ctx, value, &value_int64, GRN_FALSE)) {
+ grn_rset_recinfo_set_max(ctx, ri, a->obj,
+ GRN_INT64_VALUE(&value_int64));
+ }
+ GRN_OBJ_FIN(ctx, &value_int64);
+ }
+ }
+ break;
+ case GRN_ACCESSOR_GET_MIN :
+ grn_obj_get_value(ctx, a->obj, id, &buf);
+ {
+ grn_rset_recinfo *ri = (grn_rset_recinfo *)GRN_BULK_HEAD(&buf);
+ if (value->header.type == GRN_DB_INT64) {
+ grn_rset_recinfo_set_min(ctx, ri, a->obj, GRN_INT64_VALUE(value));
+ } else {
+ grn_obj value_int64;
+ GRN_INT64_INIT(&value_int64, 0);
+ if (!grn_obj_cast(ctx, value, &value_int64, GRN_FALSE)) {
+ grn_rset_recinfo_set_min(ctx, ri, a->obj,
+ GRN_INT64_VALUE(&value_int64));
+ }
+ GRN_OBJ_FIN(ctx, &value_int64);
+ }
+ }
+ break;
+ case GRN_ACCESSOR_GET_SUM :
+ grn_obj_get_value(ctx, a->obj, id, &buf);
+ {
+ grn_rset_recinfo *ri = (grn_rset_recinfo *)GRN_BULK_HEAD(&buf);
+ if (value->header.type == GRN_DB_INT64) {
+ grn_rset_recinfo_set_sum(ctx, ri, a->obj, GRN_INT64_VALUE(value));
+ } else {
+ grn_obj value_int64;
+ GRN_INT64_INIT(&value_int64, 0);
+ if (!grn_obj_cast(ctx, value, &value_int64, GRN_FALSE)) {
+ grn_rset_recinfo_set_sum(ctx, ri, a->obj,
+ GRN_INT64_VALUE(&value_int64));
+ }
+ GRN_OBJ_FIN(ctx, &value_int64);
+ }
+ }
+ break;
+ case GRN_ACCESSOR_GET_AVG :
+ grn_obj_get_value(ctx, a->obj, id, &buf);
+ {
+ grn_rset_recinfo *ri = (grn_rset_recinfo *)GRN_BULK_HEAD(&buf);
+ if (value->header.type == GRN_DB_FLOAT) {
+ grn_rset_recinfo_set_avg(ctx, ri, a->obj, GRN_FLOAT_VALUE(value));
+ } else {
+ grn_obj value_float;
+ GRN_FLOAT_INIT(&value_float, 0);
+ if (!grn_obj_cast(ctx, value, &value_float, GRN_FALSE)) {
+ grn_rset_recinfo_set_avg(ctx, ri, a->obj,
+ GRN_FLOAT_VALUE(&value_float));
+ }
+ GRN_OBJ_FIN(ctx, &value_float);
+ }
+ }
+ break;
case GRN_ACCESSOR_GET_COLUMN_VALUE :
/* todo : support vector */
if (a->next) {
@@ -5671,7 +6474,7 @@ grn_obj_set_value_column_var_size_vector(grn_ctx *ctx, grn_obj *obj, grn_id id,
if (v && s &&
(token_cursor = grn_token_cursor_open(ctx, lexicon, v, s,
GRN_TOKEN_ADD, token_flags))) {
- while (token_cursor->status == GRN_TOKEN_DOING) {
+ while (token_cursor->status == GRN_TOKEN_CURSOR_DOING) {
grn_id tid = grn_token_cursor_next(ctx, token_cursor);
grn_uvector_add_element(ctx, &uvector, tid, 0);
}
@@ -5813,13 +6616,13 @@ grn_obj_set_value_column_fix_size(grn_ctx *ctx, grn_obj *obj, grn_id id,
} else {
void *b;
if ((b = GRN_CALLOC(element_size))) {
- memcpy(b, v, s);
- memcpy(p, b, element_size);
+ grn_memcpy(b, v, s);
+ grn_memcpy(p, b, element_size);
GRN_FREE(b);
}
}
} else {
- memcpy(p, v, s);
+ grn_memcpy(p, v, s);
}
rc = GRN_SUCCESS;
break;
@@ -5952,12 +6755,45 @@ grn_obj_get_value_(grn_ctx *ctx, grn_obj *obj, grn_id id, uint32_t *size)
}
static void
+grn_obj_get_value_expr(grn_ctx *ctx, grn_obj *expr, grn_id id, grn_obj *value)
+{
+ grn_expr *e = (grn_expr *)expr;
+ grn_expr_code *code;
+
+ if (e->codes_curr != 1) {
+ return;
+ }
+
+ code = e->codes;
+ if (code->op != GRN_OP_GET_VALUE) {
+ return;
+ }
+
+ if (!code->value) {
+ return;
+ }
+
+ switch (code->value->header.type) {
+ case GRN_COLUMN_VAR_SIZE :
+ case GRN_COLUMN_FIX_SIZE :
+ grn_obj_get_value(ctx, code->value, id, value);
+ break;
+ default :
+ break;
+ }
+}
+
+static void
grn_obj_get_value_column_index(grn_ctx *ctx, grn_obj *index_column,
grn_id id, grn_obj *value)
{
grn_ii *ii = (grn_ii *)index_column;
grn_obj_ensure_bulk(ctx, value);
- GRN_UINT32_SET(ctx, value, grn_ii_estimate_size(ctx, ii, id));
+ if (id) {
+ GRN_UINT32_SET(ctx, value, grn_ii_estimate_size(ctx, ii, id));
+ } else {
+ GRN_UINT32_SET(ctx, value, 0);
+ }
value->header.domain = GRN_DB_UINT32;
}
@@ -5970,15 +6806,19 @@ grn_obj_get_value_column_vector(grn_ctx *ctx, grn_obj *obj,
lexicon = grn_ctx_at(ctx, DB_OBJ(obj)->range);
if (lexicon && !GRN_OBJ_TABLEP(lexicon) &&
(lexicon->header.flags & GRN_OBJ_KEY_VAR_SIZE)) {
- grn_obj v_;
grn_obj_ensure_vector(ctx, value);
- GRN_TEXT_INIT(&v_, 0);
- grn_ja_get_value(ctx, (grn_ja *)obj, id, &v_);
- grn_vector_decode(ctx, value, GRN_TEXT_VALUE(&v_), GRN_TEXT_LEN(&v_));
- GRN_OBJ_FIN(ctx, &v_);
+ if (id) {
+ grn_obj v_;
+ GRN_TEXT_INIT(&v_, 0);
+ grn_ja_get_value(ctx, (grn_ja *)obj, id, &v_);
+ grn_vector_decode(ctx, value, GRN_TEXT_VALUE(&v_), GRN_TEXT_LEN(&v_));
+ GRN_OBJ_FIN(ctx, &v_);
+ }
} else {
grn_obj_ensure_bulk(ctx, value);
- grn_ja_get_value(ctx, (grn_ja *)obj, id, value);
+ if (id) {
+ grn_ja_get_value(ctx, (grn_ja *)obj, id, value);
+ }
value->header.type = GRN_UVECTOR;
if (obj->header.flags & GRN_OBJ_WITH_WEIGHT) {
value->header.flags |= GRN_OBJ_WITH_WEIGHT;
@@ -5994,7 +6834,6 @@ grn_obj *
grn_obj_get_value(grn_ctx *ctx, grn_obj *obj, grn_id id, grn_obj *value)
{
GRN_API_ENTER;
- if (!id) { goto exit; }
if (!obj) {
ERR(GRN_INVALID_ARGUMENT, "grn_obj_get_value failed");
goto exit;
@@ -6022,20 +6861,24 @@ grn_obj_get_value(grn_ctx *ctx, grn_obj *obj, grn_id id, grn_obj *value)
case GRN_ACCESSOR :
grn_obj_ensure_bulk(ctx, value);
value = grn_accessor_get_value(ctx, (grn_accessor *)obj, id, value);
- value->header.domain = grn_obj_get_range(ctx, obj);
+ break;
+ case GRN_EXPR :
+ grn_obj_get_value_expr(ctx, obj, id, value);
break;
case GRN_TABLE_PAT_KEY :
{
grn_pat *pat = (grn_pat *)obj;
uint32_t size = pat->value_size;
grn_obj_ensure_bulk(ctx, value);
- if (grn_bulk_space(ctx, value, size)) {
- MERR("grn_bulk_space failed");
- goto exit;
- }
- {
- char *curr = GRN_BULK_CURR(value);
- grn_pat_get_value(ctx, pat, id, curr - size);
+ if (id) {
+ if (grn_bulk_space(ctx, value, size)) {
+ MERR("grn_bulk_space failed");
+ goto exit;
+ }
+ {
+ char *curr = GRN_BULK_CURR(value);
+ grn_pat_get_value(ctx, pat, id, curr - size);
+ }
}
value->header.type = GRN_BULK;
value->header.domain = grn_obj_get_range(ctx, obj);
@@ -6046,19 +6889,34 @@ grn_obj_get_value(grn_ctx *ctx, grn_obj *obj, grn_id id, grn_obj *value)
break;
case GRN_TABLE_HASH_KEY :
{
- grn_hash *hash = (grn_hash *)obj;
- uint32_t size = hash->value_size;
+ grn_bool processed = GRN_FALSE;
grn_obj_ensure_bulk(ctx, value);
- if (grn_bulk_space(ctx, value, size)) {
- MERR("grn_bulk_space failed");
- goto exit;
- }
- {
- char *curr = GRN_BULK_CURR(value);
- grn_hash_get_value(ctx, hash, id, curr - size);
- }
- value->header.type = GRN_BULK;
value->header.domain = grn_obj_get_range(ctx, obj);
+ if (id) {
+ if (GRN_TABLE_IS_MULTI_KEYS_GROUPED(obj)) {
+ grn_obj *domain;
+ domain = grn_ctx_at(ctx, value->header.domain);
+ if (GRN_OBJ_TABLEP(domain)) {
+ grn_id subrec_id;
+ if (grn_table_get_subrecs(ctx, obj, id, &subrec_id, NULL, 1) == 1) {
+ GRN_RECORD_SET(ctx, value, subrec_id);
+ processed = GRN_TRUE;
+ }
+ }
+ }
+ if (!processed) {
+ grn_hash *hash = (grn_hash *)obj;
+ uint32_t size = hash->value_size;
+ if (grn_bulk_space(ctx, value, size)) {
+ MERR("grn_bulk_space failed");
+ goto exit;
+ }
+ {
+ char *curr = GRN_BULK_CURR(value);
+ grn_hash_get_value(ctx, hash, id, curr - size);
+ }
+ }
+ }
}
break;
case GRN_TABLE_NO_KEY :
@@ -6066,13 +6924,15 @@ grn_obj_get_value(grn_ctx *ctx, grn_obj *obj, grn_id id, grn_obj *value)
grn_array *array = (grn_array *)obj;
uint32_t size = array->value_size;
grn_obj_ensure_bulk(ctx, value);
- if (grn_bulk_space(ctx, value, size)) {
- MERR("grn_bulk_space failed");
- goto exit;
- }
- {
- char *curr = GRN_BULK_CURR(value);
- grn_array_get_value(ctx, array, id, curr - size);
+ if (id) {
+ if (grn_bulk_space(ctx, value, size)) {
+ MERR("grn_bulk_space failed");
+ goto exit;
+ }
+ {
+ char *curr = GRN_BULK_CURR(value);
+ grn_array_get_value(ctx, array, id, curr - size);
+ }
}
value->header.type = GRN_BULK;
value->header.domain = grn_obj_get_range(ctx, obj);
@@ -6085,7 +6945,9 @@ grn_obj_get_value(grn_ctx *ctx, grn_obj *obj, grn_id id, grn_obj *value)
break;
case GRN_OBJ_COLUMN_SCALAR :
grn_obj_ensure_bulk(ctx, value);
- grn_ja_get_value(ctx, (grn_ja *)obj, id, value);
+ if (id) {
+ grn_ja_get_value(ctx, (grn_ja *)obj, id, value);
+ }
value->header.type = GRN_BULK;
break;
default :
@@ -6095,12 +6957,12 @@ grn_obj_get_value(grn_ctx *ctx, grn_obj *obj, grn_id id, grn_obj *value)
value->header.domain = grn_obj_get_range(ctx, obj);
break;
case GRN_COLUMN_FIX_SIZE :
- {
+ grn_obj_ensure_bulk(ctx, value);
+ value->header.type = GRN_BULK;
+ value->header.domain = grn_obj_get_range(ctx, obj);
+ if (id) {
unsigned int element_size;
void *v = grn_ra_ref(ctx, (grn_ra *)obj, id);
- grn_obj_ensure_bulk(ctx, value);
- value->header.type = GRN_BULK;
- value->header.domain = grn_obj_get_range(ctx, obj);
if (v) {
element_size = ((grn_ra *)obj)->header->element_size;
grn_bulk_write(ctx, value, v, element_size);
@@ -6195,17 +7057,17 @@ grn_obj_get_info(grn_ctx *ctx, grn_obj *obj, grn_info_type type, grn_obj *valueb
GRN_BOOL_PUT(ctx, valuebuf, GRN_FALSE);
#endif
break;
- case GRN_INFO_SUPPORT_LZO :
+ case GRN_INFO_SUPPORT_LZ4 :
if (!valuebuf && !(valuebuf = grn_obj_open(ctx, GRN_BULK, 0, GRN_DB_BOOL))) {
ERR(GRN_INVALID_ARGUMENT,
- "failed to open value buffer for GRN_INFO_LZO_SUPPORT");
+ "failed to open value buffer for GRN_INFO_LZ4_SUPPORT");
goto exit;
}
-#ifdef GRN_WITH_LZO
+#ifdef GRN_WITH_LZ4
GRN_BOOL_PUT(ctx, valuebuf, GRN_TRUE);
-#else /* GRN_WITH_LZO */
+#else /* GRN_WITH_LZ4 */
GRN_BOOL_PUT(ctx, valuebuf, GRN_FALSE);
-#endif /* GRN_WITH_LZO */
+#endif /* GRN_WITH_LZ4 */
break;
default :
if (!obj) {
@@ -6346,6 +7208,7 @@ build_index(grn_ctx *ctx, grn_obj *obj)
break;
default :
use_grn_ii_build = GRN_FALSE;
+ break;
}
if ((ii->header->flags & GRN_OBJ_WITH_WEIGHT)) {
use_grn_ii_build = GRN_FALSE;
@@ -6363,10 +7226,14 @@ build_index(grn_ctx *ctx, grn_obj *obj)
}
if (use_grn_ii_build) {
uint64_t sparsity = 10;
- if (getenv("GRN_INDEX_SPARSITY")) {
+ char grn_index_sparsity_env[GRN_ENV_BUFFER_SIZE];
+ grn_getenv("GRN_INDEX_SPARSITY",
+ grn_index_sparsity_env,
+ GRN_ENV_BUFFER_SIZE);
+ if (grn_index_sparsity_env[0]) {
uint64_t v;
errno = 0;
- v = strtoull(getenv("GRN_INDEX_SPARSITY"), NULL, 0);
+ v = strtoull(grn_index_sparsity_env, NULL, 0);
if (!errno) { sparsity = v; }
}
grn_ii_build(ctx, ii, sparsity);
@@ -6534,7 +7401,7 @@ grn_hook_unpack(grn_ctx *ctx, grn_db_obj *obj, const char *buf, uint32_t buf_siz
new->proc = NULL;
}
if ((new->hld_size = hld_size)) {
- memcpy(NEXT_ADDR(new), p, hld_size);
+ grn_memcpy(NEXT_ADDR(new), p, hld_size);
p += hld_size;
}
*last = new;
@@ -6631,8 +7498,10 @@ grn_obj_set_info_source_validate_report_error(grn_ctx *ctx,
source_name, GRN_TABLE_MAX_KEY_SIZE);
if (GRN_OBJ_TABLEP(source)) {
source_name[source_name_size] = '\0';
- strncat(source_name, "._key",
- GRN_TABLE_MAX_KEY_SIZE - source_name_size - 1);
+ grn_strncat(source_name,
+ GRN_TABLE_MAX_KEY_SIZE,
+ "._key",
+ GRN_TABLE_MAX_KEY_SIZE - source_name_size - 1);
source_name_size = strlen(source_name);
}
table_domain_name_size = grn_obj_name(ctx, table_domain,
@@ -6645,7 +7514,10 @@ grn_obj_set_info_source_validate_report_error(grn_ctx *ctx,
GRN_TABLE_MAX_KEY_SIZE);
grn_obj_unlink(ctx, source_type);
} else {
- strncpy(source_type_name, "(nil)", GRN_TABLE_MAX_KEY_SIZE);
+ grn_strncpy(source_type_name,
+ GRN_TABLE_MAX_KEY_SIZE,
+ "(nil)",
+ GRN_TABLE_MAX_KEY_SIZE);
source_type_name_size = strlen(source_type_name);
}
ERR(GRN_INVALID_ARGUMENT,
@@ -6768,7 +7640,7 @@ grn_obj_set_info_source_update(grn_ctx *ctx, grn_obj *obj, grn_obj *value)
if (!v2) {
return ctx->rc;
}
- memcpy(v2, v, s);
+ grn_memcpy(v2, v, s);
if (DB_OBJ(obj)->source) { GRN_FREE(DB_OBJ(obj)->source); }
DB_OBJ(obj)->source = v2;
DB_OBJ(obj)->source_size = s;
@@ -6810,7 +7682,7 @@ grn_obj_set_info_token_filters(grn_ctx *ctx,
grn_obj *token_filters)
{
grn_obj *current_token_filters;
- unsigned int i, n_token_filters;
+ unsigned int i, n_current_token_filters, n_token_filters;
grn_obj token_filter_names;
switch (table->header.type) {
@@ -6832,9 +7704,12 @@ grn_obj_set_info_token_filters(grn_ctx *ctx,
return ctx->rc;
}
+ n_current_token_filters =
+ GRN_BULK_VSIZE(current_token_filters) / sizeof(grn_obj *);
+ n_token_filters = GRN_BULK_VSIZE(token_filters) / sizeof(grn_obj *);
+
GRN_TEXT_INIT(&token_filter_names, 0);
GRN_BULK_REWIND(current_token_filters);
- n_token_filters = GRN_BULK_VSIZE(token_filters) / sizeof(grn_obj *);
for (i = 0; i < n_token_filters; i++) {
grn_obj *token_filter = GRN_PTR_VALUE_AT(token_filters, i);
char token_filter_name[GRN_TABLE_MAX_KEY_SIZE];
@@ -6842,6 +7717,9 @@ grn_obj_set_info_token_filters(grn_ctx *ctx,
GRN_PTR_PUT(ctx, current_token_filters, token_filter);
+ if (i > 0) {
+ GRN_TEXT_PUTC(ctx, &token_filter_names, ',');
+ }
token_filter_name_size = grn_obj_name(ctx,
token_filter,
token_filter_name,
@@ -6851,9 +7729,11 @@ grn_obj_set_info_token_filters(grn_ctx *ctx,
token_filter_name,
token_filter_name_size);
}
- GRN_LOG(ctx, GRN_LOG_NOTICE, "DDL:set_token_filters %.*s",
- (int)GRN_BULK_VSIZE(&token_filter_names),
- GRN_BULK_HEAD(&token_filter_names));
+ if (n_token_filters > 0 || n_token_filters != n_current_token_filters) {
+ GRN_LOG(ctx, GRN_LOG_NOTICE, "DDL:set_token_filters %.*s",
+ (int)GRN_BULK_VSIZE(&token_filter_names),
+ GRN_BULK_HEAD(&token_filter_names));
+ }
GRN_OBJ_FIN(ctx, &token_filter_names);
grn_obj_spec_save(ctx, DB_OBJ(table));
@@ -6882,7 +7762,7 @@ grn_obj_set_info(grn_ctx *ctx, grn_obj *obj, grn_info_type type, grn_obj *value)
switch (DB_OBJ(obj)->header.type) {
case GRN_TABLE_HASH_KEY :
((grn_hash *)obj)->tokenizer = value;
- ((grn_hash *)obj)->header->tokenizer = grn_obj_id(ctx, value);
+ ((grn_hash *)obj)->header.common->tokenizer = grn_obj_id(ctx, value);
rc = GRN_SUCCESS;
break;
case GRN_TABLE_PAT_KEY :
@@ -6903,7 +7783,7 @@ grn_obj_set_info(grn_ctx *ctx, grn_obj *obj, grn_info_type type, grn_obj *value)
switch (DB_OBJ(obj)->header.type) {
case GRN_TABLE_HASH_KEY :
((grn_hash *)obj)->normalizer = value;
- ((grn_hash *)obj)->header->normalizer = grn_obj_id(ctx, value);
+ ((grn_hash *)obj)->header.common->normalizer = grn_obj_id(ctx, value);
rc = GRN_SUCCESS;
break;
case GRN_TABLE_PAT_KEY :
@@ -6946,21 +7826,6 @@ grn_obj_set_element_info(grn_ctx *ctx, grn_obj *obj, grn_id id,
GRN_API_RETURN(GRN_SUCCESS);
}
-grn_bool
-grn_obj_is_builtin(grn_ctx *ctx, grn_obj *obj)
-{
- grn_id id;
-
- if (!obj) { return GRN_FALSE; }
-
- id = grn_obj_id(ctx, obj);
- if (id == GRN_ID_NIL) {
- return GRN_FALSE;
- } else {
- return id < GRN_N_RESERVED_TYPES;
- }
-}
-
static void
grn_hook_free(grn_ctx *ctx, grn_hook *h)
{
@@ -6995,7 +7860,7 @@ grn_obj_add_hook(grn_ctx *ctx, grn_obj *obj, grn_hook_entry entry,
new->proc = (grn_proc *)proc;
new->hld_size = hld_size;
if (hld_size) {
- memcpy(NEXT_ADDR(new), hld_value, hld_size);
+ grn_memcpy(NEXT_ADDR(new), hld_value, hld_size);
}
for (i = 0; i != offset && *last; i++) { last = &(*last)->next; }
new->next = *last;
@@ -7503,7 +8368,8 @@ _grn_obj_remove(grn_ctx *ctx, grn_obj *obj)
const char *n = _grn_table_key(ctx, ctx->impl->db, DB_OBJ(obj)->id, &s);
GRN_LOG(ctx, GRN_LOG_NOTICE, "DDL:obj_remove %.*s", s, n);
}
- if ((io_path = grn_obj_path(ctx, obj)) && *io_path != '\0') {
+ if (obj->header.type != GRN_PROC &&
+ (io_path = grn_obj_path(ctx, obj)) && *io_path != '\0') {
if (!(path = GRN_STRDUP(io_path))) {
ERR(GRN_NO_MEMORY_AVAILABLE, "cannot duplicate path: <%s>", io_path);
return;
@@ -7651,7 +8517,7 @@ grn_table_rename(grn_ctx *ctx, grn_obj *table, const char *name, unsigned int na
if (!(rc = grn_obj_rename(ctx, table, name, name_size))) {
grn_id *key;
char fullname[GRN_TABLE_MAX_KEY_SIZE];
- memcpy(fullname, name, name_size);
+ grn_memcpy(fullname, name, name_size);
fullname[name_size] = GRN_DB_DELIMITER;
GRN_HASH_EACH(ctx, cols, id, &key, NULL, NULL, {
grn_obj *col = grn_ctx_at(ctx, *key);
@@ -7692,7 +8558,7 @@ grn_column_rename(grn_ctx *ctx, grn_obj *column, const char *name, unsigned int
goto exit;
}
fullname[len] = GRN_DB_DELIMITER;
- memcpy(fullname + len + 1, name, name_size);
+ grn_memcpy(fullname + len + 1, name, name_size);
name_size += len + 1;
rc = grn_obj_rename(ctx, column, fullname, name_size);
}
@@ -7834,7 +8700,7 @@ grn_db_obj_init(grn_ctx *ctx, grn_obj *db, grn_id id, grn_db_obj *obj)
NULL,\
NULL);\
if (size > PATH_MAX) { ERR(GRN_FILENAME_TOO_LONG, "too long path"); }\
- memcpy(buffer, path, size);\
+ grn_memcpy(buffer, path, size);\
buffer[size] = '\0';\
} else {\
gen_pathname(grn_obj_io(s->keys)->path, buffer, id); \
@@ -7856,7 +8722,7 @@ grn_db_obj_init(grn_ctx *ctx, grn_obj *db, grn_id id, grn_db_obj *obj)
NULL);\
if (size) {\
if ((r->source = GRN_MALLOC(size))) {\
- memcpy(r->source, p, size);\
+ grn_memcpy(r->source, p, size);\
r->source_size = size;\
}\
}\
@@ -7879,7 +8745,7 @@ grn_token_filters_unpack(grn_ctx *ctx,
unsigned int element_size;
unsigned int i, n_token_filter_ids;
- if (grn_vector_size(ctx, spec_vector) < SERIALIZED_SPEC_INDEX_TOKEN_FILTERS) {
+ if (grn_vector_size(ctx, spec_vector) <= SERIALIZED_SPEC_INDEX_TOKEN_FILTERS) {
return;
}
@@ -8070,6 +8936,9 @@ grn_ctx_at(grn_ctx *ctx, grn_id id)
}
}
res = vp->ptr;
+ if (res && res->header.type == GRN_PROC) {
+ grn_plugin_ensure_registered(ctx, res);
+ }
}
}
exit :
@@ -8399,10 +9268,14 @@ grn_obj_reinit_for(grn_ctx *ctx, grn_obj *obj, grn_obj *domain_obj)
return ctx->rc;
}
- grn_obj_get_range_info(ctx, domain_obj, &domain, &flags);
- if (GRN_OBJ_TABLEP(domain_obj) &&
- domain_obj->header.type != GRN_TABLE_NO_KEY) {
- domain = domain_obj->header.domain;
+ if (grn_column_is_index(ctx, domain_obj)) {
+ domain = GRN_DB_UINT32;
+ } else {
+ grn_obj_get_range_info(ctx, domain_obj, &domain, &flags);
+ if (GRN_OBJ_TABLEP(domain_obj) &&
+ domain_obj->header.type != GRN_TABLE_NO_KEY) {
+ domain = domain_obj->header.domain;
+ }
}
return grn_obj_reinit(ctx, obj, domain, flags);
}
@@ -8457,7 +9330,7 @@ grn_column_name(grn_ctx *ctx, grn_obj *obj, char *namebuf, int buf_size)
}
len = pe - p0;
if (len && len <= buf_size) {
- memcpy(namebuf, p0, len);
+ grn_memcpy(namebuf, p0, len);
}
}
}
@@ -8481,6 +9354,18 @@ grn_column_name(grn_ctx *ctx, grn_obj *obj, char *namebuf, int buf_size)
case GRN_ACCESSOR_GET_NSUBRECS :
name = GRN_COLUMN_NAME_NSUBRECS;
break;
+ case GRN_ACCESSOR_GET_MAX :
+ name = GRN_COLUMN_NAME_MAX;
+ break;
+ case GRN_ACCESSOR_GET_MIN :
+ name = GRN_COLUMN_NAME_MIN;
+ break;
+ case GRN_ACCESSOR_GET_SUM :
+ name = GRN_COLUMN_NAME_SUM;
+ break;
+ case GRN_ACCESSOR_GET_AVG :
+ name = GRN_COLUMN_NAME_AVG;
+ break;
case GRN_ACCESSOR_GET_COLUMN_VALUE :
case GRN_ACCESSOR_GET_DB_OBJ :
case GRN_ACCESSOR_LOOKUP :
@@ -8491,7 +9376,7 @@ grn_column_name(grn_ctx *ctx, grn_obj *obj, char *namebuf, int buf_size)
if (name) {
len = strlen(name);
if (len <= buf_size) {
- memcpy(namebuf, name, len);
+ grn_memcpy(namebuf, name, len);
}
}
}
@@ -8544,6 +9429,26 @@ grn_column_name_(grn_ctx *ctx, grn_obj *obj, grn_obj *buf)
GRN_COLUMN_NAME_NSUBRECS,
GRN_COLUMN_NAME_NSUBRECS_LEN);
break;
+ case GRN_ACCESSOR_GET_MAX :
+ GRN_TEXT_PUT(ctx, buf,
+ GRN_COLUMN_NAME_MAX,
+ GRN_COLUMN_NAME_MAX_LEN);
+ break;
+ case GRN_ACCESSOR_GET_MIN :
+ GRN_TEXT_PUT(ctx, buf,
+ GRN_COLUMN_NAME_MIN,
+ GRN_COLUMN_NAME_MIN_LEN);
+ break;
+ case GRN_ACCESSOR_GET_SUM :
+ GRN_TEXT_PUT(ctx, buf,
+ GRN_COLUMN_NAME_SUM,
+ GRN_COLUMN_NAME_SUM_LEN);
+ break;
+ case GRN_ACCESSOR_GET_AVG :
+ GRN_TEXT_PUT(ctx, buf,
+ GRN_COLUMN_NAME_AVG,
+ GRN_COLUMN_NAME_AVG_LEN);
+ break;
case GRN_ACCESSOR_GET_COLUMN_VALUE :
grn_column_name_(ctx, a->obj, buf);
if (a->next) { GRN_TEXT_PUTC(ctx, buf, '.'); }
@@ -8751,7 +9656,7 @@ typedef struct {
grn_id id;
uint32_t size;
const void *value;
-} sort_entry;
+} sort_reference_entry;
enum {
KEY_ID = 0,
@@ -8783,8 +9688,9 @@ enum {
} while (0)
inline static int
-compare_value(grn_ctx *ctx, sort_entry *a, sort_entry *b,
- grn_table_sort_key *keys, int n_keys)
+compare_reference(grn_ctx *ctx,
+ sort_reference_entry *a, sort_reference_entry *b,
+ grn_table_sort_key *keys, int n_keys)
{
int i;
uint8_t type;
@@ -8880,73 +9786,325 @@ compare_value(grn_ctx *ctx, sort_entry *a, sort_entry *b,
}
inline static void
-swap(sort_entry *a, sort_entry *b)
+swap_reference(sort_reference_entry *a, sort_reference_entry *b)
{
- sort_entry c_ = *a;
+ sort_reference_entry c_ = *a;
*a = *b;
*b = c_;
}
-inline static sort_entry *
-part(grn_ctx *ctx, sort_entry *b, sort_entry *e, grn_table_sort_key *keys, int n_keys)
+inline static sort_reference_entry *
+part_reference(grn_ctx *ctx,
+ sort_reference_entry *b, sort_reference_entry *e,
+ grn_table_sort_key *keys, int n_keys)
{
- sort_entry *c;
+ sort_reference_entry *c;
intptr_t d = e - b;
- if (compare_value(ctx, b, e, keys, n_keys)) {
- swap(b, e);
+ if (compare_reference(ctx, b, e, keys, n_keys)) {
+ swap_reference(b, e);
}
if (d < 2) { return NULL; }
c = b + (d >> 1);
- if (compare_value(ctx, b, c, keys, n_keys)) {
- swap(b, c);
+ if (compare_reference(ctx, b, c, keys, n_keys)) {
+ swap_reference(b, c);
} else {
- if (compare_value(ctx, c, e, keys, n_keys)) {
- swap(c, e);
+ if (compare_reference(ctx, c, e, keys, n_keys)) {
+ swap_reference(c, e);
}
}
if (d < 3) { return NULL; }
b++;
- swap(b, c);
+ swap_reference(b, c);
c = b;
for (;;) {
do {
b++;
- } while (compare_value(ctx, c, b, keys, n_keys));
+ } while (compare_reference(ctx, c, b, keys, n_keys));
do {
e--;
- } while (compare_value(ctx, e, c, keys, n_keys));
+ } while (compare_reference(ctx, e, c, keys, n_keys));
if (b >= e) { break; }
- swap(b, e);
+ swap_reference(b, e);
}
- swap(c, e);
+ swap_reference(c, e);
return e;
}
static void
-_sort(grn_ctx *ctx, sort_entry *head, sort_entry *tail, int from, int to,
- grn_table_sort_key *keys, int n_keys)
+sort_reference(grn_ctx *ctx,
+ sort_reference_entry *head, sort_reference_entry *tail,
+ int from, int to,
+ grn_table_sort_key *keys, int n_keys)
{
- sort_entry *c;
- if (head < tail && (c = part(ctx, head, tail, keys, n_keys))) {
+ sort_reference_entry *c;
+ if (head < tail && (c = part_reference(ctx, head, tail, keys, n_keys))) {
intptr_t m = c - head + 1;
- if (from < m - 1) { _sort(ctx, head, c - 1, from, to, keys, n_keys); }
- if (m < to) { _sort(ctx, c + 1, tail, from - m, to - m, keys, n_keys); }
+ if (from < m - 1) {
+ sort_reference(ctx, head, c - 1, from, to, keys, n_keys);
+ }
+ if (m < to) {
+ sort_reference(ctx, c + 1, tail, from - m, to - m, keys, n_keys);
+ }
}
}
-static sort_entry *
-pack(grn_ctx *ctx, grn_obj *table, sort_entry *head, sort_entry *tail,
- grn_table_sort_key *keys, int n_keys)
+static sort_reference_entry *
+pack_reference(grn_ctx *ctx, grn_obj *table,
+ sort_reference_entry *head, sort_reference_entry *tail,
+ grn_table_sort_key *keys, int n_keys)
{
int i = 0;
- sort_entry e, c;
+ sort_reference_entry e, c;
grn_table_cursor *tc = grn_table_cursor_open(ctx, table, NULL, 0, NULL, 0, 0, -1, 0);
if (!tc) { return NULL; }
if ((c.id = grn_table_cursor_next_inline(ctx, tc))) {
c.value = grn_obj_get_value_(ctx, keys->key, c.id, &c.size);
while ((e.id = grn_table_cursor_next_inline(ctx, tc))) {
e.value = grn_obj_get_value_(ctx, keys->key, e.id, &e.size);
- if (compare_value(ctx, &c, &e, keys, n_keys)) {
+ if (compare_reference(ctx, &c, &e, keys, n_keys)) {
+ *head++ = e;
+ } else {
+ *tail-- = e;
+ }
+ i++;
+ }
+ *head = c;
+ i++;
+ }
+ grn_table_cursor_close(ctx, tc);
+ return i > 2 ? head : NULL;
+}
+
+static int
+grn_table_sort_reference(grn_ctx *ctx, grn_obj *table,
+ int offset, int limit,
+ grn_obj *result,
+ grn_table_sort_key *keys, int n_keys)
+{
+ int e, n;
+ sort_reference_entry *array, *ep;
+ e = offset + limit;
+ n = grn_table_size(ctx, table);
+ if (!(array = GRN_MALLOC(sizeof(sort_reference_entry) * n))) {
+ return 0;
+ }
+ if ((ep = pack_reference(ctx, table, array, array + n - 1, keys, n_keys))) {
+ intptr_t m = ep - array + 1;
+ if (offset < m - 1) {
+ sort_reference(ctx, array, ep - 1, offset, e, keys, n_keys);
+ }
+ if (m < e) {
+ sort_reference(ctx, ep + 1, array + n - 1, offset - m, e - m, keys, n_keys);
+ }
+ }
+ {
+ int i;
+ grn_id *v;
+ for (i = 0, ep = array + offset; i < limit && ep < array + n; i++, ep++) {
+ if (!grn_array_add(ctx, (grn_array *)result, (void **)&v)) { break; }
+ *v = ep->id;
+ }
+ GRN_FREE(array);
+ return i;
+ }
+}
+
+
+typedef struct {
+ grn_id id;
+ grn_obj value;
+} sort_value_entry;
+
+inline static int
+compare_value(grn_ctx *ctx,
+ sort_value_entry *a, sort_value_entry *b,
+ grn_table_sort_key *keys, int n_keys,
+ grn_obj *a_buffer, grn_obj *b_buffer)
+{
+ int i;
+ uint8_t type;
+ uint32_t as, bs;
+ const unsigned char *ap, *bp;
+ for (i = 0; i < n_keys; i++, keys++) {
+ if (i) {
+ GRN_BULK_REWIND(a_buffer);
+ GRN_BULK_REWIND(b_buffer);
+ if (keys->flags & GRN_TABLE_SORT_DESC) {
+ grn_obj_get_value(ctx, keys->key, b->id, a_buffer);
+ grn_obj_get_value(ctx, keys->key, a->id, b_buffer);
+ } else {
+ grn_obj_get_value(ctx, keys->key, a->id, a_buffer);
+ grn_obj_get_value(ctx, keys->key, b->id, b_buffer);
+ }
+ ap = (const unsigned char *)GRN_BULK_HEAD(a_buffer);
+ as = GRN_BULK_VSIZE(a_buffer);
+ bp = (const unsigned char *)GRN_BULK_HEAD(b_buffer);
+ bs = GRN_BULK_VSIZE(b_buffer);
+ } else {
+ if (keys->flags & GRN_TABLE_SORT_DESC) {
+ ap = (const unsigned char *)GRN_BULK_HEAD(&b->value);
+ as = GRN_BULK_VSIZE(&b->value);
+ bp = (const unsigned char *)GRN_BULK_HEAD(&a->value);
+ bs = GRN_BULK_VSIZE(&a->value);
+ } else {
+ ap = (const unsigned char *)GRN_BULK_HEAD(&a->value);
+ as = GRN_BULK_VSIZE(&a->value);
+ bp = (const unsigned char *)GRN_BULK_HEAD(&b->value);
+ bs = GRN_BULK_VSIZE(&b->value);
+ }
+ }
+ type = keys->offset;
+ switch (type) {
+ case KEY_ID :
+ if (ap != bp) { return ap > bp; }
+ break;
+ case KEY_BULK :
+ for (;; ap++, bp++, as--, bs--) {
+ if (!as) { if (bs) { return 0; } else { break; } }
+ if (!bs) { return 1; }
+ if (*ap < *bp) { return 0; }
+ if (*ap > *bp) { return 1; }
+ }
+ break;
+ case KEY_INT8 :
+ CMPNUM(int8_t);
+ break;
+ case KEY_INT16 :
+ CMPNUM(int16_t);
+ break;
+ case KEY_INT32 :
+ CMPNUM(int32_t);
+ break;
+ case KEY_INT64 :
+ CMPNUM(int64_t);
+ break;
+ case KEY_UINT8 :
+ CMPNUM(uint8_t);
+ break;
+ case KEY_UINT16 :
+ CMPNUM(uint16_t);
+ break;
+ case KEY_UINT32 :
+ CMPNUM(uint32_t);
+ break;
+ case KEY_UINT64 :
+ CMPNUM(uint64_t);
+ break;
+ case KEY_FLOAT32 :
+ if (as) {
+ if (bs) {
+ float va = *((float *)(ap));
+ float vb = *((float *)(bp));
+ if (va < vb || va > vb) { return va > vb; }
+ } else {
+ return 1;
+ }
+ } else {
+ if (bs) { return 0; }
+ }
+ break;
+ case KEY_FLOAT64 :
+ if (as) {
+ if (bs) {
+ double va = *((double *)(ap));
+ double vb = *((double *)(bp));
+ if (va < vb || va > vb) { return va > vb; }
+ } else {
+ return 1;
+ }
+ } else {
+ if (bs) { return 0; }
+ }
+ break;
+ }
+ }
+ return 0;
+}
+
+inline static void
+swap_value(sort_value_entry *a, sort_value_entry *b)
+{
+ sort_value_entry c_ = *a;
+ *a = *b;
+ *b = c_;
+}
+
+inline static sort_value_entry *
+part_value(grn_ctx *ctx,
+ sort_value_entry *b, sort_value_entry *e,
+ grn_table_sort_key *keys, int n_keys,
+ grn_obj *a_buffer, grn_obj *b_buffer)
+{
+ sort_value_entry *c;
+ intptr_t d = e - b;
+ if (compare_value(ctx, b, e, keys, n_keys, a_buffer, b_buffer)) {
+ swap_value(b, e);
+ }
+ if (d < 2) { return NULL; }
+ c = b + (d >> 1);
+ if (compare_value(ctx, b, c, keys, n_keys, a_buffer, b_buffer)) {
+ swap_value(b, c);
+ } else {
+ if (compare_value(ctx, c, e, keys, n_keys, a_buffer, b_buffer)) {
+ swap_value(c, e);
+ }
+ }
+ if (d < 3) { return NULL; }
+ b++;
+ swap_value(b, c);
+ c = b;
+ for (;;) {
+ do {
+ b++;
+ } while (compare_value(ctx, c, b, keys, n_keys, a_buffer, b_buffer));
+ do {
+ e--;
+ } while (compare_value(ctx, e, c, keys, n_keys, a_buffer, b_buffer));
+ if (b >= e) { break; }
+ swap_value(b, e);
+ }
+ swap_value(c, e);
+ return e;
+}
+
+static void
+sort_value(grn_ctx *ctx,
+ sort_value_entry *head, sort_value_entry *tail,
+ int from, int to,
+ grn_table_sort_key *keys, int n_keys,
+ grn_obj *a_buffer, grn_obj *b_buffer)
+{
+ sort_value_entry *c;
+ if (head < tail && (c = part_value(ctx, head, tail, keys, n_keys,
+ a_buffer, b_buffer))) {
+ intptr_t m = c - head + 1;
+ if (from < m - 1) {
+ sort_value(ctx, head, c - 1, from, to, keys, n_keys, a_buffer, b_buffer);
+ }
+ if (m < to) {
+ sort_value(ctx, c + 1, tail, from - m, to - m, keys, n_keys,
+ a_buffer, b_buffer);
+ }
+ }
+}
+
+static sort_value_entry *
+pack_value(grn_ctx *ctx, grn_obj *table,
+ sort_value_entry *head, sort_value_entry *tail,
+ grn_table_sort_key *keys, int n_keys,
+ grn_obj *a_buffer, grn_obj *b_buffer)
+{
+ int i = 0;
+ sort_value_entry e, c;
+ grn_table_cursor *tc = grn_table_cursor_open(ctx, table, NULL, 0, NULL, 0, 0, -1, 0);
+ if (!tc) { return NULL; }
+ if ((c.id = grn_table_cursor_next_inline(ctx, tc))) {
+ GRN_TEXT_INIT(&c.value, 0);
+ grn_obj_get_value(ctx, keys->key, c.id, &c.value);
+ while ((e.id = grn_table_cursor_next_inline(ctx, tc))) {
+ GRN_TEXT_INIT(&e.value, 0);
+ grn_obj_get_value(ctx, keys->key, e.id, &e.value);
+ if (compare_value(ctx, &c, &e, keys, n_keys, a_buffer, b_buffer)) {
*head++ = e;
} else {
*tail-- = e;
@@ -8961,6 +10119,93 @@ pack(grn_ctx *ctx, grn_obj *table, sort_entry *head, sort_entry *tail,
}
static int
+grn_table_sort_value(grn_ctx *ctx, grn_obj *table,
+ int offset, int limit,
+ grn_obj *result,
+ grn_table_sort_key *keys, int n_keys)
+{
+ int e, n;
+ sort_value_entry *array, *ep;
+ e = offset + limit;
+ n = grn_table_size(ctx, table);
+ if (!(array = GRN_MALLOC(sizeof(sort_value_entry) * n))) {
+ return 0;
+ }
+ {
+ grn_obj a_buffer;
+ grn_obj b_buffer;
+ GRN_TEXT_INIT(&a_buffer, 0);
+ GRN_TEXT_INIT(&b_buffer, 0);
+ if ((ep = pack_value(ctx, table, array, array + n - 1, keys, n_keys,
+ &a_buffer, &b_buffer))) {
+ intptr_t m = ep - array + 1;
+ if (offset < m - 1) {
+ sort_value(ctx, array, ep - 1, offset, e, keys, n_keys,
+ &a_buffer, &b_buffer);
+ }
+ if (m < e) {
+ sort_value(ctx, ep + 1, array + n - 1, offset - m, e - m, keys, n_keys,
+ &a_buffer, &b_buffer);
+ }
+ }
+ GRN_OBJ_FIN(ctx, &a_buffer);
+ GRN_OBJ_FIN(ctx, &b_buffer);
+ }
+ {
+ int i;
+ grn_id *v;
+ for (i = 0, ep = array + offset; i < limit && ep < array + n; i++, ep++) {
+ if (!grn_array_add(ctx, (grn_array *)result, (void **)&v)) { break; }
+ *v = ep->id;
+ }
+ GRN_FREE(array);
+ return i;
+ }
+}
+
+static grn_bool
+is_compressed_column(grn_ctx *ctx, grn_obj *obj)
+{
+ if (!obj) {
+ return GRN_FALSE;
+ }
+
+ if (obj->header.type != GRN_COLUMN_VAR_SIZE) {
+ return GRN_FALSE;
+ }
+
+ return (obj->header.flags & (GRN_OBJ_COMPRESS_ZLIB | GRN_OBJ_COMPRESS_LZ4));
+}
+
+static grn_bool
+is_sub_record_accessor(grn_ctx *ctx, grn_obj *obj)
+{
+ grn_accessor *accessor;
+
+ if (!obj) {
+ return GRN_FALSE;
+ }
+
+ if (obj->header.type != GRN_ACCESSOR) {
+ return GRN_FALSE;
+ }
+
+ for (accessor = (grn_accessor *)obj; accessor; accessor = accessor->next) {
+ switch (accessor->action) {
+ case GRN_ACCESSOR_GET_VALUE :
+ if (GRN_TABLE_IS_MULTI_KEYS_GROUPED(accessor->obj)) {
+ return GRN_TRUE;
+ }
+ break;
+ default :
+ break;
+ }
+ }
+
+ return GRN_FALSE;
+}
+
+static int
range_is_idp(grn_obj *obj)
{
if (obj && obj->header.type == GRN_ACCESSOR) {
@@ -8979,7 +10224,6 @@ grn_table_sort(grn_ctx *ctx, grn_obj *table, int offset, int limit,
grn_rc rc;
grn_obj *index;
int n, e, i = 0;
- sort_entry *array, *ep;
GRN_API_ENTER;
if (!n_keys || !keys) {
WARN(GRN_INVALID_ARGUMENT, "keys is null");
@@ -9034,8 +10278,17 @@ grn_table_sort(grn_ctx *ctx, grn_obj *table, int offset, int limit,
}
} else {
int j;
+ grn_bool have_compressed_column = GRN_FALSE;
+ grn_bool have_sub_record_accessor = GRN_FALSE;
+ grn_bool have_index_value_get = GRN_FALSE;
grn_table_sort_key *kp;
for (kp = keys, j = n_keys; j; kp++, j--) {
+ if (is_compressed_column(ctx, kp->key)) {
+ have_compressed_column = GRN_TRUE;
+ }
+ if (is_sub_record_accessor(ctx, kp->key)) {
+ have_sub_record_accessor = GRN_TRUE;
+ }
if (range_is_idp(kp->key)) {
kp->offset = KEY_ID;
} else {
@@ -9101,25 +10354,21 @@ grn_table_sort(grn_ctx *ctx, grn_obj *table, int offset, int limit,
}
}
} else {
+ if (kp->key->header.type == GRN_COLUMN_INDEX) {
+ have_index_value_get = GRN_TRUE;
+ }
kp->offset = KEY_UINT32;
}
}
}
- if (!(array = GRN_MALLOC(sizeof(sort_entry) * n))) {
- goto exit;
- }
- if ((ep = pack(ctx, table, array, array + n - 1, keys, n_keys))) {
- intptr_t m = ep - array + 1;
- if (offset < m - 1) { _sort(ctx, array, ep - 1, offset, e, keys, n_keys); }
- if (m < e) { _sort(ctx, ep + 1, array + n - 1, offset - m, e - m, keys, n_keys); }
- }
- {
- grn_id *v;
- for (i = 0, ep = array + offset; i < limit && ep < array + n; i++, ep++) {
- if (!grn_array_add(ctx, (grn_array *)result, (void **)&v)) { break; }
- *v = ep->id;
- }
- GRN_FREE(array);
+ if (have_compressed_column ||
+ have_sub_record_accessor ||
+ have_index_value_get) {
+ i = grn_table_sort_value(ctx, table, offset, limit, result,
+ keys, n_keys);
+ } else {
+ i = grn_table_sort_reference(ctx, table, offset, limit, result,
+ keys, n_keys);
}
}
exit :
@@ -9207,6 +10456,7 @@ grn_db_init_builtin_types(grn_ctx *ctx)
#endif
grn_db_init_builtin_tokenizers(ctx);
grn_db_init_builtin_normalizers(ctx);
+ grn_db_init_builtin_scorers(ctx);
for (id = grn_db_curr_id(ctx, db) + 1; id < 128; id++) {
grn_itoh(id, buf + 3, 2);
grn_obj_register(ctx, db, buf, 5);
@@ -9222,18 +10472,24 @@ grn_db_init_builtin_types(grn_ctx *ctx)
#define MULTI_COLUMN_INDEXP(i) (DB_OBJ(i)->source_size > sizeof(grn_id))
static inline int
-grn_column_index_column_equal(grn_ctx *ctx, grn_obj *obj, grn_operator op,
- grn_obj **indexbuf, int buf_size, int *section)
+grn_column_find_index_data_column_equal(grn_ctx *ctx, grn_obj *obj,
+ grn_operator op,
+ grn_index_datum *index_data,
+ unsigned int n_index_data,
+ grn_obj **index_buf, int buf_size,
+ int *section_buf)
{
int n = 0;
- grn_obj **ip = indexbuf;
+ grn_obj **ip = index_buf;
grn_hook *hooks;
for (hooks = DB_OBJ(obj)->hooks[GRN_HOOK_SET]; hooks; hooks = hooks->next) {
default_set_value_hook_data *data = (void *)NEXT_ADDR(hooks);
grn_obj *target = grn_ctx_at(ctx, data->target);
+ int section;
if (target->header.type != GRN_COLUMN_INDEX) { continue; }
- if (section) { *section = (MULTI_COLUMN_INDEXP(target)) ? data->section : 0; }
+ section = (MULTI_COLUMN_INDEXP(target)) ? data->section : 0;
+ if (section_buf) { *section_buf = section; }
if (obj->header.type != GRN_COLUMN_FIX_SIZE) {
grn_obj *tokenizer, *lexicon = grn_ctx_at(ctx, target->header.domain);
if (!lexicon) { continue; }
@@ -9243,28 +10499,79 @@ grn_column_index_column_equal(grn_ctx *ctx, grn_obj *obj, grn_operator op,
if (n < buf_size) {
*ip++ = target;
}
+ if (n < n_index_data) {
+ index_data[n].index = target;
+ index_data[n].section = section;
+ }
n++;
}
return n;
}
+static inline grn_bool
+is_valid_regexp_index(grn_ctx *ctx, grn_obj *index_column)
+{
+ grn_obj *tokenizer;
+ grn_obj *lexicon;
+
+ lexicon = grn_ctx_at(ctx, index_column->header.domain);
+ if (!lexicon) {
+ return GRN_FALSE;
+ }
+
+ grn_table_get_info(ctx, lexicon, NULL, NULL, &tokenizer, NULL, NULL);
+ grn_obj_unlink(ctx, lexicon);
+ if (!tokenizer) {
+ return GRN_FALSE;
+ }
+
+ /* TODO: Restrict to TokenRegexp? */
+ return GRN_TRUE;
+}
+
static inline int
-grn_column_index_column_match(grn_ctx *ctx, grn_obj *obj, grn_operator op,
- grn_obj **indexbuf, int buf_size, int *section)
+grn_column_find_index_data_column_match(grn_ctx *ctx, grn_obj *obj,
+ grn_operator op,
+ grn_index_datum *index_data,
+ unsigned int n_index_data,
+ grn_obj **index_buf, int buf_size,
+ int *section_buf)
{
int n = 0;
- grn_obj **ip = indexbuf;
+ grn_obj **ip = index_buf;
+ grn_hook_entry hook_entry;
grn_hook *hooks;
- for (hooks = DB_OBJ(obj)->hooks[GRN_HOOK_SET]; hooks; hooks = hooks->next) {
+ switch (obj->header.type) {
+ case GRN_TABLE_HASH_KEY :
+ case GRN_TABLE_PAT_KEY :
+ case GRN_TABLE_DAT_KEY :
+ case GRN_TABLE_NO_KEY :
+ hook_entry = GRN_HOOK_INSERT;
+ break;
+ default :
+ hook_entry = GRN_HOOK_SET;
+ break;
+ }
+
+ for (hooks = DB_OBJ(obj)->hooks[hook_entry]; hooks; hooks = hooks->next) {
default_set_value_hook_data *data = (void *)NEXT_ADDR(hooks);
grn_obj *target = grn_ctx_at(ctx, data->target);
+ int section;
if (target->header.type != GRN_COLUMN_INDEX) { continue; }
- if (section) { *section = (MULTI_COLUMN_INDEXP(target)) ? data->section : 0; }
+ if (op == GRN_OP_REGEXP && !is_valid_regexp_index(ctx, target)) {
+ continue;
+ }
+ section = (MULTI_COLUMN_INDEXP(target)) ? data->section : 0;
+ if (section_buf) { *section_buf = section; }
if (n < buf_size) {
*ip++ = target;
}
+ if (n < n_index_data) {
+ index_data[n].index = target;
+ index_data[n].section = section;
+ }
n++;
}
@@ -9272,11 +10579,15 @@ grn_column_index_column_match(grn_ctx *ctx, grn_obj *obj, grn_operator op,
}
static inline int
-grn_column_index_column_range(grn_ctx *ctx, grn_obj *obj, grn_operator op,
- grn_obj **indexbuf, int buf_size, int *section)
+grn_column_find_index_data_column_range(grn_ctx *ctx, grn_obj *obj,
+ grn_operator op,
+ grn_index_datum *index_data,
+ unsigned int n_index_data,
+ grn_obj **index_buf, int buf_size,
+ int *section_buf)
{
int n = 0;
- grn_obj **ip = indexbuf;
+ grn_obj **ip = index_buf;
grn_hook_entry hook_entry;
grn_hook *hooks;
@@ -9295,8 +10606,10 @@ grn_column_index_column_range(grn_ctx *ctx, grn_obj *obj, grn_operator op,
for (hooks = DB_OBJ(obj)->hooks[hook_entry]; hooks; hooks = hooks->next) {
default_set_value_hook_data *data = (void *)NEXT_ADDR(hooks);
grn_obj *target = grn_ctx_at(ctx, data->target);
+ int section;
if (target->header.type != GRN_COLUMN_INDEX) { continue; }
- if (section) { *section = (MULTI_COLUMN_INDEXP(target)) ? data->section : 0; }
+ section = (MULTI_COLUMN_INDEXP(target)) ? data->section : 0;
+ if (section_buf) { *section_buf = section; }
{
grn_obj *tokenizer, *lexicon = grn_ctx_at(ctx, target->header.domain);
if (!lexicon) { continue; }
@@ -9308,6 +10621,10 @@ grn_column_index_column_range(grn_ctx *ctx, grn_obj *obj, grn_operator op,
if (n < buf_size) {
*ip++ = target;
}
+ if (n < n_index_data) {
+ index_data[n].index = target;
+ index_data[n].section = section;
+ }
n++;
}
@@ -9358,6 +10675,9 @@ is_valid_index(grn_ctx *ctx, grn_obj *index_column, grn_operator op)
case GRN_OP_CALL :
return is_valid_range_index(ctx, index_column);
break;
+ case GRN_OP_REGEXP :
+ return is_valid_regexp_index(ctx, index_column);
+ break;
default :
return GRN_FALSE;
break;
@@ -9388,12 +10708,16 @@ find_section(grn_ctx *ctx, grn_obj *index_column, grn_obj *indexed_column)
}
static int
-grn_column_index_accessor_index_column(grn_ctx *ctx, grn_accessor *a,
- grn_operator op,
- grn_obj **indexbuf, int buf_size,
- int *section)
+grn_column_find_index_data_accessor_index_column(grn_ctx *ctx, grn_accessor *a,
+ grn_operator op,
+ grn_index_datum *index_data,
+ unsigned int n_index_data,
+ grn_obj **index_buf,
+ int buf_size,
+ int *section_buf)
{
grn_obj *index_column = a->obj;
+ int section = 0;
if (!is_valid_index(ctx, index_column, op)) {
return 0;
@@ -9410,34 +10734,47 @@ grn_column_index_accessor_index_column(grn_ctx *ctx, grn_accessor *a,
if (is_invalid_section) {
return 0;
}
- if (section) {
- *section = specified_section;
+ section = specified_section;
+ if (section_buf) {
+ *section_buf = section;
}
}
if (buf_size > 0) {
- *indexbuf = index_column;
+ *index_buf = index_column;
+ }
+ if (n_index_data > 0) {
+ index_data[0].index = index_column;
+ index_data[0].section = section;
}
return 1;
}
static inline int
-grn_column_index_accessor(grn_ctx *ctx, grn_obj *obj, grn_operator op,
- grn_obj **indexbuf, int buf_size, int *section)
+grn_column_find_index_data_accessor_match(grn_ctx *ctx, grn_obj *obj,
+ grn_operator op,
+ grn_index_datum *index_data,
+ unsigned n_index_data,
+ grn_obj **index_buf, int buf_size,
+ int *section_buf)
{
int n = 0;
- grn_obj **ip = indexbuf;
+ grn_obj **ip = index_buf;
grn_accessor *a = (grn_accessor *)obj;
while (a) {
grn_hook *hooks;
grn_bool found = GRN_FALSE;
- grn_hook_entry entry = -1;
+ grn_hook_entry entry = (grn_hook_entry)-1;
if (a->action == GRN_ACCESSOR_GET_COLUMN_VALUE &&
GRN_OBJ_INDEX_COLUMNP(a->obj)) {
- return grn_column_index_accessor_index_column(ctx, a, op, indexbuf,
- buf_size, section);
+ return grn_column_find_index_data_accessor_index_column(ctx, a, op,
+ index_data,
+ n_index_data,
+ index_buf,
+ buf_size,
+ section_buf);
}
switch (a->action) {
@@ -9451,7 +10788,7 @@ grn_column_index_accessor(grn_ctx *ctx, grn_obj *obj, grn_operator op,
break;
}
- if (entry == -1) {
+ if (entry == (grn_hook_entry)-1) {
break;
}
@@ -9463,16 +10800,23 @@ grn_column_index_accessor(grn_ctx *ctx, grn_obj *obj, grn_operator op,
found = GRN_TRUE;
if (!a->next) {
+ int section;
+
if (!is_valid_index(ctx, target, op)) {
continue;
}
- if (section) {
- *section = (MULTI_COLUMN_INDEXP(target)) ? data->section : 0;
+ section = (MULTI_COLUMN_INDEXP(target)) ? data->section : 0;
+ if (section_buf) {
+ *section_buf = section;
}
if (n < buf_size) {
*ip++ = target;
}
+ if (n < n_index_data) {
+ index_data[n].index = target;
+ index_data[n].section = section;
+ }
n++;
}
}
@@ -9486,17 +10830,102 @@ grn_column_index_accessor(grn_ctx *ctx, grn_obj *obj, grn_operator op,
return n;
}
+static inline int
+grn_column_find_index_data_accessor(grn_ctx *ctx, grn_obj *obj,
+ grn_operator op,
+ grn_index_datum *index_data,
+ unsigned n_index_data,
+ grn_obj **index_buf, int buf_size,
+ int *section_buf)
+{
+ int n = 0;
+
+ if (section_buf) {
+ *section_buf = 0;
+ }
+ switch (op) {
+ case GRN_OP_EQUAL :
+ case GRN_OP_TERM_EXTRACT :
+ if (buf_size > 0) {
+ index_buf[n] = obj;
+ }
+ if (n_index_data > 0) {
+ index_data[n].index = obj;
+ index_data[n].section = 0;
+ }
+ n++;
+ break;
+ case GRN_OP_PREFIX :
+ {
+ grn_accessor *a = (grn_accessor *)obj;
+ if (a->action == GRN_ACCESSOR_GET_KEY) {
+ if (a->obj->header.type == GRN_TABLE_PAT_KEY) {
+ if (buf_size > 0) {
+ index_buf[n] = obj;
+ }
+ if (n_index_data > 0) {
+ index_data[n].index = obj;
+ index_data[n].section = 0;
+ }
+ n++;
+ }
+ /* FIXME: GRN_TABLE_DAT_KEY should be supported */
+ }
+ }
+ break;
+ case GRN_OP_SUFFIX :
+ {
+ grn_accessor *a = (grn_accessor *)obj;
+ if (a->action == GRN_ACCESSOR_GET_KEY) {
+ if (a->obj->header.type == GRN_TABLE_PAT_KEY &&
+ a->obj->header.flags & GRN_OBJ_KEY_WITH_SIS) {
+ if (buf_size > 0) {
+ index_buf[n] = obj;
+ }
+ if (n_index_data > 0) {
+ index_data[n].index = obj;
+ index_data[n].section = 0;
+ }
+ n++;
+ }
+ }
+ }
+ break;
+ case GRN_OP_MATCH :
+ case GRN_OP_NEAR :
+ case GRN_OP_NEAR2 :
+ case GRN_OP_SIMILAR :
+ case GRN_OP_LESS :
+ case GRN_OP_GREATER :
+ case GRN_OP_LESS_EQUAL :
+ case GRN_OP_GREATER_EQUAL :
+ case GRN_OP_CALL :
+ case GRN_OP_REGEXP :
+ n = grn_column_find_index_data_accessor_match(ctx, obj, op,
+ index_data, n_index_data,
+ index_buf, buf_size,
+ section_buf);
+ break;
+ default :
+ break;
+ }
+
+ return n;
+}
+
int
grn_column_index(grn_ctx *ctx, grn_obj *obj, grn_operator op,
- grn_obj **indexbuf, int buf_size, int *section)
+ grn_obj **index_buf, int buf_size, int *section_buf)
{
int n = 0;
GRN_API_ENTER;
if (GRN_DB_OBJP(obj)) {
switch (op) {
case GRN_OP_EQUAL :
- n = grn_column_index_column_equal(ctx, obj, op,
- indexbuf, buf_size, section);
+ n = grn_column_find_index_data_column_equal(ctx, obj, op,
+ NULL, 0,
+ index_buf, buf_size,
+ section_buf);
break;
case GRN_OP_PREFIX :
case GRN_OP_SUFFIX :
@@ -9504,68 +10933,75 @@ grn_column_index(grn_ctx *ctx, grn_obj *obj, grn_operator op,
case GRN_OP_NEAR :
case GRN_OP_NEAR2 :
case GRN_OP_SIMILAR :
- n = grn_column_index_column_match(ctx, obj, op,
- indexbuf, buf_size, section);
+ case GRN_OP_REGEXP :
+ n = grn_column_find_index_data_column_match(ctx, obj, op,
+ NULL, 0,
+ index_buf, buf_size,
+ section_buf);
break;
case GRN_OP_LESS :
case GRN_OP_GREATER :
case GRN_OP_LESS_EQUAL :
case GRN_OP_GREATER_EQUAL :
case GRN_OP_CALL :
- n = grn_column_index_column_range(ctx, obj, op,
- indexbuf, buf_size, section);
+ n = grn_column_find_index_data_column_range(ctx, obj, op,
+ NULL, 0,
+ index_buf, buf_size,
+ section_buf);
break;
default :
break;
}
} else if (GRN_ACCESSORP(obj)) {
- if (section) {
- *section = 0;
- }
+ n = grn_column_find_index_data_accessor(ctx, obj, op,
+ NULL, 0,
+ index_buf, buf_size,
+ section_buf);
+ }
+ GRN_API_RETURN(n);
+}
+
+unsigned int
+grn_column_find_index_data(grn_ctx *ctx, grn_obj *obj, grn_operator op,
+ grn_index_datum *index_data,
+ unsigned int n_index_data)
+{
+ unsigned int n = 0;
+ GRN_API_ENTER;
+ if (GRN_DB_OBJP(obj)) {
switch (op) {
case GRN_OP_EQUAL :
- case GRN_OP_TERM_EXTRACT :
- if (buf_size) { indexbuf[n] = obj; }
- n++;
+ n = grn_column_find_index_data_column_equal(ctx, obj, op,
+ index_data, n_index_data,
+ NULL, 0, NULL);
break;
case GRN_OP_PREFIX :
- {
- grn_accessor *a = (grn_accessor *)obj;
- if (a->action == GRN_ACCESSOR_GET_KEY) {
- if (a->obj->header.type == GRN_TABLE_PAT_KEY) {
- if (buf_size) { indexbuf[n] = obj; }
- n++;
- }
- /* FIXME: GRN_TABLE_DAT_KEY should be supported */
- }
- }
- break;
case GRN_OP_SUFFIX :
- {
- grn_accessor *a = (grn_accessor *)obj;
- if (a->action == GRN_ACCESSOR_GET_KEY) {
- if (a->obj->header.type == GRN_TABLE_PAT_KEY &&
- a->obj->header.flags & GRN_OBJ_KEY_WITH_SIS) {
- if (buf_size) { indexbuf[n] = obj; }
- n++;
- }
- }
- }
- break;
case GRN_OP_MATCH :
case GRN_OP_NEAR :
case GRN_OP_NEAR2 :
case GRN_OP_SIMILAR :
+ case GRN_OP_REGEXP :
+ n = grn_column_find_index_data_column_match(ctx, obj, op,
+ index_data, n_index_data,
+ NULL, 0, NULL);
+ break;
case GRN_OP_LESS :
case GRN_OP_GREATER :
case GRN_OP_LESS_EQUAL :
case GRN_OP_GREATER_EQUAL :
case GRN_OP_CALL :
- n = grn_column_index_accessor(ctx, obj, op, indexbuf, buf_size, section);
+ n = grn_column_find_index_data_column_range(ctx, obj, op,
+ index_data, n_index_data,
+ NULL, 0, NULL);
break;
default :
break;
}
+ } else if (GRN_ACCESSORP(obj)) {
+ n = grn_column_find_index_data_accessor(ctx, obj, op,
+ index_data, n_index_data,
+ NULL, 0, NULL);
}
GRN_API_RETURN(n);
}
@@ -9832,7 +11268,7 @@ grn_table_tokenize(grn_ctx *ctx, grn_obj *table,
grn_obj *buf, grn_bool addp)
{
grn_token_cursor *token_cursor = NULL;
- grn_token_mode mode = addp ? GRN_TOKEN_ADD : GRN_TOKEN_GET;
+ grn_tokenize_mode mode = addp ? GRN_TOKENIZE_ADD : GRN_TOKENIZE_GET;
GRN_API_ENTER;
if (!(token_cursor = grn_token_cursor_open(ctx, table, str, str_len, mode, 0))) {
goto exit;
@@ -9844,7 +11280,7 @@ grn_table_tokenize(grn_ctx *ctx, grn_obj *table,
goto exit;
}
}
- while (token_cursor->status != GRN_TOKEN_DONE && token_cursor->status != GRN_TOKEN_DONE_SKIP) {
+ while (token_cursor->status != GRN_TOKEN_CURSOR_DONE && token_cursor->status != GRN_TOKEN_CURSOR_DONE_SKIP) {
grn_id tid;
if ((tid = grn_token_cursor_next(ctx, token_cursor))) {
GRN_RECORD_PUT(ctx, buf, tid);
@@ -10258,7 +11694,7 @@ brace_close(grn_ctx *ctx, grn_loader *loader)
(int)GRN_TEXT_LEN(key_column_name),
GRN_TEXT_VALUE(key_column_name),
column_name_size, column_name);
- return;
+ goto exit;
}
key_column_name = value;
v++;
@@ -10271,7 +11707,62 @@ brace_close(grn_ctx *ctx, grn_loader *loader)
}
break;
case GRN_TABLE_NO_KEY :
- id = grn_table_add(ctx, loader->table, NULL, 0, NULL);
+ {
+ grn_obj *v;
+ grn_bool found_id_column = GRN_FALSE;
+ for (v = value; v + 1 < ve; v = values_next(ctx, v)) {
+ char *column_name = GRN_TEXT_VALUE(v);
+ unsigned int column_name_size = GRN_TEXT_LEN(v);
+ if (v->header.domain == GRN_DB_TEXT &&
+ (name_equal(column_name, column_name_size,
+ GRN_COLUMN_NAME_ID))) {
+ grn_obj *id_column;
+ grn_obj *id_value;
+ if (found_id_column) {
+ GRN_LOG(ctx, GRN_LOG_ERROR, "duplicated '_id' column");
+ goto exit;
+ }
+ found_id_column = GRN_TRUE;
+ id_column = v;
+ v = values_next(ctx, v);
+ id_value = v;
+ switch (id_value->header.type) {
+ case GRN_DB_UINT32 :
+ id = GRN_UINT32_VALUE(id_value);
+ break;
+ case GRN_DB_INT32 :
+ id = GRN_INT32_VALUE(id_value);
+ break;
+ default :
+ {
+ grn_obj casted_id_value;
+ GRN_UINT32_INIT(&casted_id_value, 0);
+ if (grn_obj_cast(ctx, id_value, &casted_id_value, GRN_FALSE)) {
+ grn_obj inspected;
+ GRN_TEXT_INIT(&inspected, 0);
+ grn_inspect(ctx, &inspected, id_value);
+ ERR(GRN_INVALID_ARGUMENT,
+ "<%.*s>: failed to cast to <UInt32>: <%.*s>",
+ (int)column_name_size, column_name,
+ (int)GRN_TEXT_LEN(&inspected),
+ GRN_TEXT_VALUE(&inspected));
+ grn_obj_unlink(ctx, &inspected);
+ goto exit;
+ } else {
+ id = GRN_UINT32_VALUE(&casted_id_value);
+ }
+ GRN_OBJ_FIN(ctx, &casted_id_value);
+ }
+ break;
+ }
+ } else {
+ v = values_next(ctx, v);
+ }
+ }
+ }
+ if (id == GRN_ID_NIL) {
+ id = grn_table_add(ctx, loader->table, NULL, 0, NULL);
+ }
break;
default :
break;
@@ -10329,6 +11820,7 @@ brace_close(grn_ctx *ctx, grn_loader *loader)
GRN_LOG(ctx, GRN_LOG_ERROR, "neither _key nor _id is assigned");
}
}
+ exit:
loader->values_size = begin;
}
}
@@ -10362,7 +11854,6 @@ json_read(grn_ctx *ctx, grn_loader *loader, const char *str, unsigned int str_le
case GRN_LOADER_BEGIN :
if ((len = grn_isspace(str, ctx->encoding))) {
str += len;
- c = *str;
continue;
}
switch (c) {
@@ -10382,7 +11873,6 @@ json_read(grn_ctx *ctx, grn_loader *loader, const char *str, unsigned int str_le
case GRN_LOADER_TOKEN :
if ((len = grn_isspace(str, ctx->encoding))) {
str += len;
- c = *str;
continue;
}
switch (c) {
@@ -10776,6 +12266,7 @@ grn_load_(grn_ctx *ctx, grn_content_type input_type,
case GRN_CONTENT_TSV :
case GRN_CONTENT_XML :
case GRN_CONTENT_MSGPACK :
+ case GRN_CONTENT_GROONGA_COMMAND_LIST :
ERR(GRN_FUNCTION_NOT_IMPLEMENTED, "unsupported input_type");
// todo
break;
@@ -10800,3 +12291,161 @@ grn_load(grn_ctx *ctx, grn_content_type input_type,
ifexists, ifexists_len, each, each_len, 1);
GRN_API_RETURN(ctx->rc);
}
+
+static void
+grn_db_recover_database(grn_ctx *ctx, grn_obj *db)
+{
+ if (!grn_obj_is_locked(ctx, db)) {
+ return;
+ }
+
+ ERR(GRN_OBJECT_CORRUPT,
+ "[db][recover] database may be broken. Please re-create the database");
+}
+
+static void
+grn_db_recover_table(grn_ctx *ctx, grn_obj *table)
+{
+ if (!grn_obj_is_locked(ctx, table)) {
+ return;
+ }
+
+ {
+ char name[GRN_TABLE_MAX_KEY_SIZE];
+ unsigned int name_size;
+ name_size = grn_obj_name(ctx, table, name, GRN_TABLE_MAX_KEY_SIZE);
+ ERR(GRN_OBJECT_CORRUPT,
+ "[db][recover] table may be broken: <%.*s>: "
+ "please truncate the table (or clear lock of the table) "
+ "and load data again",
+ (int)name_size, name);
+ }
+}
+
+static void
+grn_db_recover_data_column(grn_ctx *ctx, grn_obj *data_column)
+{
+ if (!grn_obj_is_locked(ctx, data_column)) {
+ return;
+ }
+
+ {
+ char name[GRN_TABLE_MAX_KEY_SIZE];
+ unsigned int name_size;
+ name_size = grn_obj_name(ctx, data_column, name, GRN_TABLE_MAX_KEY_SIZE);
+ ERR(GRN_OBJECT_CORRUPT,
+ "[db][recover] column may be broken: <%.*s>: "
+ "please truncate the column (or clear lock of the column) "
+ "and load data again",
+ (int)name_size, name);
+ }
+}
+
+static void
+grn_db_recover_index_column(grn_ctx *ctx, grn_obj *index_column)
+{
+ grn_ii *ii = (grn_ii *)index_column;
+
+ if (!grn_obj_is_locked(ctx, index_column)) {
+ return;
+ }
+
+ grn_ii_truncate(ctx, ii);
+ build_index(ctx, index_column);
+}
+
+grn_rc
+grn_db_recover(grn_ctx *ctx, grn_obj *db)
+{
+ grn_table_cursor *cursor;
+ grn_id id;
+
+ GRN_API_ENTER;
+
+ grn_db_recover_database(ctx, db);
+ if (ctx->rc != GRN_SUCCESS) {
+ GRN_API_RETURN(ctx->rc);
+ }
+
+ cursor = grn_table_cursor_open(ctx, db,
+ NULL, 0, NULL, 0,
+ 0, -1,
+ GRN_CURSOR_BY_ID);
+ if (!cursor) {
+ GRN_API_RETURN(ctx->rc);
+ }
+
+ while ((id = grn_table_cursor_next(ctx, cursor)) != GRN_ID_NIL) {
+ grn_obj *object;
+
+ if ((object = grn_ctx_at(ctx, id))) {
+ switch (object->header.type) {
+ case GRN_TABLE_NO_KEY :
+ case GRN_TABLE_HASH_KEY :
+ case GRN_TABLE_PAT_KEY :
+ case GRN_TABLE_DAT_KEY :
+ grn_db_recover_table(ctx, object);
+ break;
+ case GRN_COLUMN_FIX_SIZE :
+ case GRN_COLUMN_VAR_SIZE :
+ grn_db_recover_data_column(ctx, object);
+ break;
+ case GRN_COLUMN_INDEX :
+ grn_db_recover_index_column(ctx, object);
+ break;
+ default:
+ break;
+ }
+ grn_obj_unlink(ctx, object);
+ } else {
+ ERRCLR(ctx);
+ }
+
+ if (ctx->rc != GRN_SUCCESS) {
+ break;
+ }
+ }
+ grn_table_cursor_close(ctx, cursor);
+
+ GRN_API_RETURN(ctx->rc);
+}
+
+grn_rc
+grn_ctx_get_all_tables(grn_ctx *ctx, grn_obj *tables_buffer)
+{
+ grn_obj *db;
+ grn_table_cursor *cursor;
+ grn_id id;
+
+ GRN_API_ENTER;
+
+ db = ctx->impl->db;
+ if (!db) {
+ ERR(GRN_INVALID_ARGUMENT, "DB isn't associated");
+ GRN_API_RETURN(ctx->rc);
+ }
+
+ cursor = grn_table_cursor_open(ctx, db, NULL, 0, NULL, 0, 0, -1, 0);
+ if (!cursor) {
+ GRN_API_RETURN(ctx->rc);
+ }
+
+ while ((id = grn_table_cursor_next(ctx, cursor)) != GRN_ID_NIL) {
+ grn_obj *object;
+
+ if ((object = grn_ctx_at(ctx, id))) {
+ if (grn_obj_is_table(ctx, object)) {
+ GRN_PTR_PUT(ctx, tables_buffer, object);
+ } else {
+ grn_obj_unlink(ctx, object);
+ }
+ } else {
+ if (ctx->rc != GRN_SUCCESS) {
+ ERRCLR(ctx);
+ }
+ }
+ }
+ grn_table_cursor_close(ctx, cursor);
+
+ GRN_API_RETURN(ctx->rc);
+}
diff --git a/storage/mroonga/vendor/groonga/lib/error.c b/storage/mroonga/vendor/groonga/lib/error.c
index 322b29bff7a..e14ef3754fd 100644
--- a/storage/mroonga/vendor/groonga/lib/error.c
+++ b/storage/mroonga/vendor/groonga/lib/error.c
@@ -15,7 +15,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "error.h"
+#include "grn_error.h"
#ifdef HAVE_ERRNO_H
#include <errno.h>
@@ -28,17 +28,28 @@ const char *
grn_current_error_message(void)
{
# define ERROR_MESSAGE_BUFFER_SIZE 4096
- int error_code = WSAGetLastError();
+ int error_code = GetLastError();
static char message[ERROR_MESSAGE_BUFFER_SIZE];
+ DWORD written_bytes;
- FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- error_code,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- message,
- ERROR_MESSAGE_BUFFER_SIZE,
- NULL);
+ written_bytes = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ error_code,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ message,
+ ERROR_MESSAGE_BUFFER_SIZE,
+ NULL);
+ if (written_bytes >= 2) {
+ if (message[written_bytes - 1] == '\n') {
+ message[written_bytes - 1] = '\0';
+ written_bytes--;
+ }
+ if (message[written_bytes - 1] == '\r') {
+ message[written_bytes - 1] = '\0';
+ written_bytes--;
+ }
+ }
return message;
diff --git a/storage/mroonga/vendor/groonga/lib/expr.c b/storage/mroonga/vendor/groonga/lib/expr.c
index dd70ebecb40..f13502a0f14 100644
--- a/storage/mroonga/vendor/groonga/lib/expr.c
+++ b/storage/mroonga/vendor/groonga/lib/expr.c
@@ -1,6 +1,6 @@
/* -*- c-basic-offset: 2 -*- */
/*
- Copyright(C) 2010-2014 Brazil
+ Copyright(C) 2010-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -15,33 +15,17 @@
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 "groonga_in.h"
-#include "db.h"
-#include "ctx_impl.h"
+#include "grn.h"
+#include "grn_db.h"
+#include "grn_ctx_impl.h"
#include <string.h>
-#include <float.h>
-#include "ii.h"
-#include "geo.h"
-#include "expr.h"
-#include "util.h"
-#include "normalizer_in.h"
-#include "mrb.h"
+#include "grn_ii.h"
+#include "grn_geo.h"
+#include "grn_expr.h"
+#include "grn_util.h"
+#include "grn_mrb.h"
#include "mrb/mrb_expr.h"
-static inline int
-function_proc_p(grn_obj *obj)
-{
- return (obj &&
- obj->header.type == GRN_PROC &&
- ((grn_proc *)obj)->type == GRN_PROC_FUNCTION);
-}
-
-static inline int
-selector_proc_p(grn_obj *obj)
-{
- return (function_proc_p(obj) && ((grn_proc *)obj)->selector);
-}
-
grn_obj *
grn_expr_alloc(grn_ctx *ctx, grn_obj *expr, grn_id domain, grn_obj_flags flags)
{
@@ -60,7 +44,7 @@ grn_expr_alloc(grn_ctx *ctx, grn_obj *expr, grn_id domain, grn_obj_flags flags)
return res;
}
-static grn_hash *
+grn_hash *
grn_expr_get_vars(grn_ctx *ctx, grn_obj *expr, unsigned int *nvars)
{
grn_hash *vars = NULL;
@@ -131,6 +115,18 @@ grn_proc_get_info(grn_ctx *ctx, grn_user_data *user_data,
}
grn_obj *
+grn_proc_get_vars(grn_ctx *ctx, grn_user_data *user_data)
+{
+ uint32_t n;
+ grn_proc_ctx *pctx = (grn_proc_ctx *)user_data;
+ if (pctx->proc) {
+ return (grn_obj *)grn_expr_get_vars(ctx, (grn_obj *)pctx->proc, &n);
+ } else {
+ return NULL;
+ }
+}
+
+grn_obj *
grn_proc_get_var(grn_ctx *ctx, grn_user_data *user_data, const char *name, unsigned int name_size)
{
grn_proc_ctx *pctx = (grn_proc_ctx *)user_data;
@@ -170,7 +166,7 @@ grn_rc
grn_proc_set_selector(grn_ctx *ctx, grn_obj *proc, grn_selector_func selector)
{
grn_proc *proc_ = (grn_proc *)proc;
- if (!function_proc_p(proc)) {
+ if (!grn_obj_is_function_proc(ctx, proc)) {
return GRN_INVALID_ARGUMENT;
}
proc_->selector = selector;
@@ -179,151 +175,6 @@ grn_proc_set_selector(grn_ctx *ctx, grn_obj *proc, grn_selector_func selector)
/* grn_expr */
-static const char *opstrs[] = {
- "PUSH",
- "POP",
- "NOP",
- "CALL",
- "INTERN",
- "GET_REF",
- "GET_VALUE",
- "AND",
- "AND_NOT",
- "OR",
- "ASSIGN",
- "STAR_ASSIGN",
- "SLASH_ASSIGN",
- "MOD_ASSIGN",
- "PLUS_ASSIGN",
- "MINUS_ASSIGN",
- "SHIFTL_ASSIGN",
- "SHIFTR_ASSIGN",
- "SHIFTRR_ASSIGN",
- "AND_ASSIGN",
- "XOR_ASSIGN",
- "OR_ASSIGN",
- "JUMP",
- "CJUMP",
- "COMMA",
- "BITWISE_OR",
- "BITWISE_XOR",
- "BITWISE_AND",
- "BITWISE_NOT",
- "EQUAL",
- "NOT_EQUAL",
- "LESS",
- "GREATER",
- "LESS_EQUAL",
- "GREATER_EQUAL",
- "IN",
- "MATCH",
- "NEAR",
- "NEAR2",
- "SIMILAR",
- "TERM_EXTRACT",
- "SHIFTL",
- "SHIFTR",
- "SHIFTRR",
- "PLUS",
- "MINUS",
- "STAR",
- "SLASH",
- "MOD",
- "DELETE",
- "INCR",
- "DECR",
- "INCR_POST",
- "DECR_POST",
- "NOT",
- "ADJUST",
- "EXACT",
- "LCP",
- "PARTIAL",
- "UNSPLIT",
- "PREFIX",
- "SUFFIX",
- "GEO_DISTANCE1",
- "GEO_DISTANCE2",
- "GEO_DISTANCE3",
- "GEO_DISTANCE4",
- "GEO_WITHINP5",
- "GEO_WITHINP6",
- "GEO_WITHINP8",
- "OBJ_SEARCH",
- "EXPR_GET_VAR",
- "TABLE_CREATE",
- "TABLE_SELECT",
- "TABLE_SORT",
- "TABLE_GROUP",
- "JSON_PUT"
-};
-
-static void
-put_value(grn_ctx *ctx, grn_obj *buf, grn_obj *obj)
-{
- int len;
- char namebuf[GRN_TABLE_MAX_KEY_SIZE];
- if ((len = grn_column_name(ctx, obj, namebuf, GRN_TABLE_MAX_KEY_SIZE))) {
- GRN_TEXT_PUT(ctx, buf, namebuf, len);
- } else {
- grn_text_otoj(ctx, buf, obj, NULL);
- }
-}
-
-grn_rc
-grn_expr_inspect(grn_ctx *ctx, grn_obj *buf, grn_obj *expr)
-{
- uint32_t i, j;
- grn_expr_var *var;
- grn_expr_code *code;
- grn_expr *e = (grn_expr *)expr;
- grn_hash *vars = grn_expr_get_vars(ctx, expr, &i);
- GRN_TEXT_PUTS(ctx, buf, "noname");
- GRN_TEXT_PUTC(ctx, buf, '(');
- {
- int i = 0;
- grn_obj *value;
- const char *name;
- uint32_t name_len;
- GRN_HASH_EACH(ctx, vars, id, &name, &name_len, &value, {
- if (i++) { GRN_TEXT_PUTC(ctx, buf, ','); }
- GRN_TEXT_PUT(ctx, buf, name, name_len);
- GRN_TEXT_PUTC(ctx, buf, ':');
- put_value(ctx, buf, value);
- });
- }
- GRN_TEXT_PUTC(ctx, buf, ')');
- GRN_TEXT_PUTC(ctx, buf, '{');
- for (j = 0, code = e->codes; j < e->codes_curr; j++, code++) {
- if (j) { GRN_TEXT_PUTC(ctx, buf, ','); }
- grn_text_itoa(ctx, buf, code->modify);
- if (code->op == GRN_OP_PUSH) {
- for (i = 0, var = e->vars; i < e->nvars; i++, var++) {
- if (&var->value == code->value) {
- GRN_TEXT_PUTC(ctx, buf, '?');
- if (var->name_size) {
- GRN_TEXT_PUT(ctx, buf, var->name, var->name_size);
- } else {
- grn_text_itoa(ctx, buf, (int)i);
- }
- break;
- }
- }
- if (i == e->nvars) {
- put_value(ctx, buf, code->value);
- }
- } else {
- if (code->value) {
- put_value(ctx, buf, code->value);
- GRN_TEXT_PUTC(ctx, buf, ' ');
- }
- GRN_TEXT_PUTS(ctx, buf, opstrs[code->op]);
- }
- }
- GRN_TEXT_PUTC(ctx, buf, '}');
- return GRN_SUCCESS;
-}
-
grn_obj *
grn_ctx_pop(grn_ctx *ctx)
{
@@ -504,7 +355,7 @@ grn_expr_open(grn_ctx *ctx, grn_obj_spec *spec, const uint8_t *p, const uint8_t
{
grn_expr *expr = NULL;
if ((expr = GRN_MALLOCN(grn_expr, 1))) {
- int size = 256;
+ int size = GRN_STACK_SIZE;
expr->consts = NULL;
expr->nconsts = 0;
GRN_TEXT_INIT(&expr->name_buf, 0);
@@ -869,6 +720,21 @@ grn_expr_get_var_by_offset(grn_ctx *ctx, grn_obj *expr, unsigned int offset)
DFI_PUT(e, type, domain, code); \
} while (0)
+static void
+grn_expr_append_obj_resolve_const(grn_ctx *ctx,
+ grn_obj *obj,
+ grn_id to_domain)
+{
+ grn_obj dest;
+
+ GRN_OBJ_INIT(&dest, GRN_BULK, 0, to_domain);
+ if (!grn_obj_cast(ctx, obj, &dest, GRN_FALSE)) {
+ grn_obj_reinit(ctx, obj, to_domain, 0);
+ grn_bulk_write(ctx, obj, GRN_BULK_HEAD(&dest), GRN_BULK_VSIZE(&dest));
+ }
+ GRN_OBJ_FIN(ctx, &dest);
+}
+
grn_obj *
grn_expr_append_obj(grn_ctx *ctx, grn_obj *expr, grn_obj *obj, grn_operator op, int nargs)
{
@@ -929,7 +795,8 @@ grn_expr_append_obj(grn_ctx *ctx, grn_obj *expr, grn_obj *obj, grn_operator op,
ERR(GRN_INVALID_ARGUMENT, "invalid function call expression");
goto exit;
}
- if (!function_proc_p(proc)) {
+ if (!(grn_obj_is_function_proc(ctx, proc) ||
+ grn_obj_is_scorer_proc(ctx, proc))) {
grn_obj buffer;
GRN_TEXT_INIT(&buffer, 0);
@@ -1000,26 +867,14 @@ grn_expr_append_obj(grn_ctx *ctx, grn_obj *expr, grn_obj *obj, grn_operator op,
if (CONSTP(y)) {
/* todo */
} else {
- grn_obj dest;
if (xd != yd) {
- GRN_OBJ_INIT(&dest, GRN_BULK, 0, yd);
- if (!grn_obj_cast(ctx, x, &dest, GRN_FALSE)) {
- grn_obj_reinit(ctx, x, yd, 0);
- grn_bulk_write(ctx, x, GRN_BULK_HEAD(&dest), GRN_BULK_VSIZE(&dest));
- }
- GRN_OBJ_FIN(ctx, &dest);
+ grn_expr_append_obj_resolve_const(ctx, x, yd);
}
}
} else {
if (CONSTP(y)) {
- grn_obj dest;
if (xd != yd) {
- GRN_OBJ_INIT(&dest, GRN_BULK, 0, xd);
- if (!grn_obj_cast(ctx, y, &dest, GRN_FALSE)) {
- grn_obj_reinit(ctx, y, xd, 0);
- grn_bulk_write(ctx, y, GRN_BULK_HEAD(&dest), GRN_BULK_VSIZE(&dest));
- }
- GRN_OBJ_FIN(ctx, &dest);
+ grn_expr_append_obj_resolve_const(ctx, y, xd);
}
}
}
@@ -1054,6 +909,7 @@ grn_expr_append_obj(grn_ctx *ctx, grn_obj *expr, grn_obj *obj, grn_operator op,
case GRN_OP_GET_REF :
case GRN_OP_ADJUST :
case GRN_OP_TERM_EXTRACT :
+ case GRN_OP_REGEXP :
PUSH_CODE(e, op, obj, nargs, code);
if (nargs) {
int i = nargs - 1;
@@ -1367,425 +1223,6 @@ grn_expr_compile(grn_ctx *ctx, grn_obj *expr)
s1 = sp[-2];\
} while (0)
-#define DO_COMPARE_SUB_NUMERIC(y,op) do {\
- switch ((y)->header.domain) {\
- case GRN_DB_INT8 :\
- r = (x_ op GRN_INT8_VALUE(y));\
- break;\
- case GRN_DB_UINT8 :\
- r = (x_ op GRN_UINT8_VALUE(y));\
- break;\
- case GRN_DB_INT16 :\
- r = (x_ op GRN_INT16_VALUE(y));\
- break;\
- case GRN_DB_UINT16 :\
- r = (x_ op GRN_UINT16_VALUE(y));\
- break;\
- case GRN_DB_INT32 :\
- r = (x_ op GRN_INT32_VALUE(y));\
- break;\
- case GRN_DB_UINT32 :\
- r = (x_ op GRN_UINT32_VALUE(y));\
- break;\
- case GRN_DB_INT64 :\
- r = (x_ op GRN_INT64_VALUE(y));\
- break;\
- case GRN_DB_TIME :\
- r = (GRN_TIME_PACK(x_,0) op GRN_INT64_VALUE(y));\
- break;\
- case GRN_DB_UINT64 :\
- r = (x_ op GRN_UINT64_VALUE(y));\
- break;\
- case GRN_DB_FLOAT :\
- r = (x_ op GRN_FLOAT_VALUE(y));\
- break;\
- default :\
- r = 0;\
- break;\
- }\
-} while (0)
-
-#define DO_COMPARE_SUB(op) do {\
- switch (y->header.domain) {\
- case GRN_DB_SHORT_TEXT :\
- case GRN_DB_TEXT :\
- case GRN_DB_LONG_TEXT :\
- {\
- grn_obj y_;\
- GRN_OBJ_INIT(&y_, GRN_BULK, 0, x->header.domain);\
- if (grn_obj_cast(ctx, y, &y_, GRN_FALSE)) {\
- r = 0;\
- } else {\
- DO_COMPARE_SUB_NUMERIC(&y_, op);\
- }\
- GRN_OBJ_FIN(ctx, &y_);\
- }\
- break;\
- default :\
- DO_COMPARE_SUB_NUMERIC(y,op);\
- break;\
- }\
-} while (0)
-
-#define DO_COMPARE_BUILTIN(x,y,r,op) do {\
- switch (x->header.domain) {\
- case GRN_DB_INT8 :\
- {\
- int8_t x_ = GRN_INT8_VALUE(x);\
- DO_COMPARE_SUB(op);\
- }\
- break;\
- case GRN_DB_UINT8 :\
- {\
- uint8_t x_ = GRN_UINT8_VALUE(x);\
- DO_COMPARE_SUB(op);\
- }\
- break;\
- case GRN_DB_INT16 :\
- {\
- int16_t x_ = GRN_INT16_VALUE(x);\
- DO_COMPARE_SUB(op);\
- }\
- break;\
- case GRN_DB_UINT16 :\
- {\
- uint16_t x_ = GRN_UINT16_VALUE(x);\
- DO_COMPARE_SUB(op);\
- }\
- break;\
- case GRN_DB_INT32 :\
- {\
- int32_t x_ = GRN_INT32_VALUE(x);\
- DO_COMPARE_SUB(op);\
- }\
- break;\
- case GRN_DB_UINT32 :\
- {\
- uint32_t x_ = GRN_UINT32_VALUE(x);\
- DO_COMPARE_SUB(op);\
- }\
- break;\
- case GRN_DB_TIME :\
- {\
- int64_t x_ = GRN_INT64_VALUE(x);\
- switch (y->header.domain) {\
- case GRN_DB_INT32 :\
- r = (x_ op GRN_TIME_PACK(GRN_INT32_VALUE(y), 0));\
- break;\
- case GRN_DB_UINT32 :\
- r = (x_ op GRN_TIME_PACK(GRN_UINT32_VALUE(y), 0));\
- break;\
- case GRN_DB_INT64 :\
- case GRN_DB_TIME :\
- r = (x_ op GRN_INT64_VALUE(y));\
- break;\
- case GRN_DB_UINT64 :\
- r = (x_ op GRN_UINT64_VALUE(y));\
- break;\
- case GRN_DB_FLOAT :\
- r = (x_ op GRN_TIME_PACK(GRN_FLOAT_VALUE(y), 0));\
- break;\
- case GRN_DB_SHORT_TEXT :\
- case GRN_DB_TEXT :\
- case GRN_DB_LONG_TEXT :\
- {\
- const char *p_ = GRN_TEXT_VALUE(y);\
- int i_ = grn_atoi(p_, p_ + GRN_TEXT_LEN(y), NULL);\
- r = (x_ op GRN_TIME_PACK(i_, 0));\
- }\
- break;\
- default :\
- r = 0;\
- break;\
- }\
- }\
- break;\
- case GRN_DB_INT64 :\
- {\
- int64_t x_ = GRN_INT64_VALUE(x);\
- DO_COMPARE_SUB(op);\
- }\
- break;\
- case GRN_DB_UINT64 :\
- {\
- uint64_t x_ = GRN_UINT64_VALUE(x);\
- DO_COMPARE_SUB(op);\
- }\
- break;\
- case GRN_DB_FLOAT :\
- {\
- double x_ = GRN_FLOAT_VALUE(x);\
- DO_COMPARE_SUB(op);\
- }\
- break;\
- case GRN_DB_SHORT_TEXT :\
- case GRN_DB_TEXT :\
- case GRN_DB_LONG_TEXT :\
- if (GRN_DB_SHORT_TEXT <= y->header.domain && y->header.domain <= GRN_DB_LONG_TEXT) {\
- int r_;\
- uint32_t la = GRN_TEXT_LEN(x), lb = GRN_TEXT_LEN(y);\
- if (la > lb) {\
- if (!(r_ = memcmp(GRN_TEXT_VALUE(x), GRN_TEXT_VALUE(y), lb))) {\
- r_ = 1;\
- }\
- } else {\
- if (!(r_ = memcmp(GRN_TEXT_VALUE(x), GRN_TEXT_VALUE(y), la))) {\
- r_ = la == lb ? 0 : -1;\
- }\
- }\
- r = (r_ op 0);\
- } else {\
- const char *q_ = GRN_TEXT_VALUE(x);\
- int x_ = grn_atoi(q_, q_ + GRN_TEXT_LEN(x), NULL);\
- DO_COMPARE_SUB(op);\
- }\
- break;\
- default :\
- r = 0;\
- break;\
- }\
-} while (0)
-
-#define DO_COMPARE(x, y, r, op) do {\
- if (x->header.domain >= GRN_N_RESERVED_TYPES) {\
- grn_obj *table;\
- table = grn_ctx_at(ctx, x->header.domain);\
- switch (table->header.type) {\
- case GRN_TABLE_HASH_KEY :\
- case GRN_TABLE_PAT_KEY :\
- {\
- grn_obj key;\
- int length;\
- GRN_OBJ_INIT(&key, GRN_BULK, 0, table->header.domain);\
- length = grn_table_get_key2(ctx, table, GRN_RECORD_VALUE(x), &key);\
- if (length > 0) {\
- grn_obj *x_original = x;\
- x = &key;\
- DO_COMPARE_BUILTIN((&key), y, r, op);\
- x = x_original;\
- } else {\
- r = 0;\
- }\
- GRN_OBJ_FIN(ctx, &key);\
- }\
- break;\
- default :\
- r = 0;\
- break;\
- }\
- grn_obj_unlink(ctx, table);\
- } else {\
- DO_COMPARE_BUILTIN(x, y, r, op);\
- }\
-} while (0)
-
-#define DO_EQ_SUB do {\
- switch (y->header.domain) {\
- case GRN_DB_INT8 :\
- r = (x_ == GRN_INT8_VALUE(y));\
- break;\
- case GRN_DB_UINT8 :\
- r = (x_ == GRN_UINT8_VALUE(y));\
- break;\
- case GRN_DB_INT16 :\
- r = (x_ == GRN_INT16_VALUE(y));\
- break;\
- case GRN_DB_UINT16 :\
- r = (x_ == GRN_UINT16_VALUE(y));\
- break;\
- case GRN_DB_INT32 :\
- r = (x_ == GRN_INT32_VALUE(y));\
- break;\
- case GRN_DB_UINT32 :\
- r = (x_ == GRN_UINT32_VALUE(y));\
- break;\
- case GRN_DB_INT64 :\
- r = (x_ == GRN_INT64_VALUE(y));\
- break;\
- case GRN_DB_TIME :\
- r = (GRN_TIME_PACK(x_,0) == GRN_INT64_VALUE(y));\
- break;\
- case GRN_DB_UINT64 :\
- r = (x_ == GRN_UINT64_VALUE(y));\
- break;\
- case GRN_DB_FLOAT :\
- r = ((x_ <= GRN_FLOAT_VALUE(y)) && (x_ >= GRN_FLOAT_VALUE(y)));\
- break;\
- case GRN_DB_SHORT_TEXT :\
- case GRN_DB_TEXT :\
- case GRN_DB_LONG_TEXT :\
- {\
- const char *p_ = GRN_TEXT_VALUE(y);\
- int i_ = grn_atoi(p_, p_ + GRN_TEXT_LEN(y), NULL);\
- r = (x_ == i_);\
- }\
- break;\
- default :\
- r = 0;\
- break;\
- }\
-} while (0)
-
-#define DO_EQ(x,y,r) do {\
- switch (x->header.domain) {\
- case GRN_DB_VOID :\
- r = 0;\
- break;\
- case GRN_DB_INT8 :\
- {\
- int8_t x_ = GRN_INT8_VALUE(x);\
- DO_EQ_SUB;\
- }\
- break;\
- case GRN_DB_UINT8 :\
- {\
- uint8_t x_ = GRN_UINT8_VALUE(x);\
- DO_EQ_SUB;\
- }\
- break;\
- case GRN_DB_INT16 :\
- {\
- int16_t x_ = GRN_INT16_VALUE(x);\
- DO_EQ_SUB;\
- }\
- break;\
- case GRN_DB_UINT16 :\
- {\
- uint16_t x_ = GRN_UINT16_VALUE(x);\
- DO_EQ_SUB;\
- }\
- break;\
- case GRN_DB_INT32 :\
- {\
- int32_t x_ = GRN_INT32_VALUE(x);\
- DO_EQ_SUB;\
- }\
- break;\
- case GRN_DB_UINT32 :\
- {\
- uint32_t x_ = GRN_UINT32_VALUE(x);\
- DO_EQ_SUB;\
- }\
- break;\
- case GRN_DB_INT64 :\
- {\
- int64_t x_ = GRN_INT64_VALUE(x);\
- DO_EQ_SUB;\
- }\
- break;\
- case GRN_DB_TIME :\
- {\
- int64_t x_ = GRN_INT64_VALUE(x);\
- switch (y->header.domain) {\
- case GRN_DB_INT32 :\
- r = (x_ == GRN_TIME_PACK(GRN_INT32_VALUE(y), 0));\
- break;\
- case GRN_DB_UINT32 :\
- r = (x_ == GRN_TIME_PACK(GRN_UINT32_VALUE(y), 0));\
- break;\
- case GRN_DB_INT64 :\
- case GRN_DB_TIME :\
- r = (x_ == GRN_INT64_VALUE(y));\
- break;\
- case GRN_DB_UINT64 :\
- r = (x_ == GRN_UINT64_VALUE(y));\
- break;\
- case GRN_DB_FLOAT :\
- r = (x_ == GRN_TIME_PACK(GRN_FLOAT_VALUE(y), 0));\
- break;\
- case GRN_DB_SHORT_TEXT :\
- case GRN_DB_TEXT :\
- case GRN_DB_LONG_TEXT :\
- {\
- const char *p_ = GRN_TEXT_VALUE(y);\
- int i_ = grn_atoi(p_, p_ + GRN_TEXT_LEN(y), NULL);\
- r = (x_ == GRN_TIME_PACK(i_, 0));\
- }\
- break;\
- default :\
- r = 0;\
- break;\
- }\
- }\
- break;\
- case GRN_DB_UINT64 :\
- {\
- uint64_t x_ = GRN_UINT64_VALUE(x);\
- DO_EQ_SUB;\
- }\
- break;\
- case GRN_DB_FLOAT :\
- {\
- double x_ = GRN_FLOAT_VALUE(x);\
- switch (y->header.domain) {\
- case GRN_DB_INT32 :\
- r = ((x_ <= GRN_INT32_VALUE(y)) && (x_ >= GRN_INT32_VALUE(y)));\
- break;\
- case GRN_DB_UINT32 :\
- r = ((x_ <= GRN_UINT32_VALUE(y)) && (x_ >= GRN_UINT32_VALUE(y)));\
- break;\
- case GRN_DB_INT64 :\
- case GRN_DB_TIME :\
- r = ((x_ <= GRN_INT64_VALUE(y)) && (x_ >= GRN_INT64_VALUE(y)));\
- break;\
- case GRN_DB_UINT64 :\
- r = ((x_ <= GRN_UINT64_VALUE(y)) && (x_ >= GRN_UINT64_VALUE(y)));\
- break;\
- case GRN_DB_FLOAT :\
- r = ((x_ <= GRN_FLOAT_VALUE(y)) && (x_ >= GRN_FLOAT_VALUE(y)));\
- break;\
- case GRN_DB_SHORT_TEXT :\
- case GRN_DB_TEXT :\
- case GRN_DB_LONG_TEXT :\
- {\
- const char *p_ = GRN_TEXT_VALUE(y);\
- int i_ = grn_atoi(p_, p_ + GRN_TEXT_LEN(y), NULL);\
- r = (x_ <= i_ && x_ >= i_);\
- }\
- break;\
- default :\
- r = 0;\
- break;\
- }\
- }\
- break;\
- case GRN_DB_SHORT_TEXT :\
- case GRN_DB_TEXT :\
- case GRN_DB_LONG_TEXT :\
- if (GRN_DB_SHORT_TEXT <= y->header.domain && y->header.domain <= GRN_DB_LONG_TEXT) {\
- uint32_t la = GRN_TEXT_LEN(x), lb = GRN_TEXT_LEN(y);\
- r = (la == lb && !memcmp(GRN_TEXT_VALUE(x), GRN_TEXT_VALUE(y), lb));\
- } else {\
- const char *q_ = GRN_TEXT_VALUE(x);\
- int x_ = grn_atoi(q_, q_ + GRN_TEXT_LEN(x), NULL);\
- DO_EQ_SUB;\
- }\
- break;\
- default :\
- if ((x->header.domain == y->header.domain)) {\
- r = (GRN_BULK_VSIZE(x) == GRN_BULK_VSIZE(y) &&\
- !(memcmp(GRN_BULK_HEAD(x), GRN_BULK_HEAD(y), GRN_BULK_VSIZE(x))));\
- } else {\
- grn_obj dest;\
- if (x->header.domain < y->header.domain) {\
- GRN_OBJ_INIT(&dest, GRN_BULK, 0, y->header.domain);\
- if (!grn_obj_cast(ctx, x, &dest, GRN_FALSE)) {\
- r = (GRN_BULK_VSIZE(&dest) == GRN_BULK_VSIZE(y) &&\
- !memcmp(GRN_BULK_HEAD(&dest), GRN_BULK_HEAD(y), GRN_BULK_VSIZE(y))); \
- }\
- } else {\
- GRN_OBJ_INIT(&dest, GRN_BULK, 0, x->header.domain);\
- if (!grn_obj_cast(ctx, y, &dest, GRN_FALSE)) {\
- r = (GRN_BULK_VSIZE(&dest) == GRN_BULK_VSIZE(x) &&\
- !memcmp(GRN_BULK_HEAD(&dest), GRN_BULK_HEAD(x), GRN_BULK_VSIZE(x))); \
- }\
- }\
- GRN_OBJ_FIN(ctx, &dest);\
- }\
- break;\
- }\
-} while (0)
-
#define GEO_RESOLUTION 3600000
#define GEO_RADIOUS 6357303
#define GEO_BES_C1 6334834
@@ -2230,7 +1667,8 @@ grn_proc_call(grn_ctx *ctx, grn_obj *proc, int nargs, grn_obj *caller)
code++; \
} while (0)
-#define ARITHMETIC_BINARY_OPERATION_DISPATCH(integer8_operation, \
+#define ARITHMETIC_BINARY_OPERATION_DISPATCH(operator, \
+ integer8_operation, \
integer16_operation, \
integer32_operation, \
integer64_operation, \
@@ -2242,6 +1680,23 @@ grn_proc_call(grn_ctx *ctx, grn_obj *proc, int nargs, grn_obj *caller)
grn_obj *x, *y; \
\
POP2ALLOC1(x, y, res); \
+ if (x->header.type == GRN_VECTOR || y->header.type == GRN_VECTOR) { \
+ grn_obj inspected_x; \
+ grn_obj inspected_y; \
+ GRN_TEXT_INIT(&inspected_x, 0); \
+ GRN_TEXT_INIT(&inspected_y, 0); \
+ grn_inspect(ctx, &inspected_x, x); \
+ grn_inspect(ctx, &inspected_y, y); \
+ ERR(GRN_INVALID_ARGUMENT, \
+ "<%s> doesn't support vector: <%.*s> %s <%.*s>", \
+ operator, \
+ (int)GRN_TEXT_LEN(&inspected_x), GRN_TEXT_VALUE(&inspected_x), \
+ operator, \
+ (int)GRN_TEXT_LEN(&inspected_y), GRN_TEXT_VALUE(&inspected_y)); \
+ GRN_OBJ_FIN(ctx, &inspected_x); \
+ GRN_OBJ_FIN(ctx, &inspected_y); \
+ goto exit; \
+ } \
if (y != res) { \
res->header.domain = x->header.domain; \
} \
@@ -2667,7 +2122,9 @@ grn_proc_call(grn_ctx *ctx, grn_obj *proc, int nargs, grn_obj *caller)
} \
if (GRN_BULK_VSIZE(var) != (sizeof(grn_obj *) + sizeof(grn_id))) { \
ERR(GRN_INVALID_ARGUMENT, \
- "invalid variable size: expected: %zu, actual: %zu", \
+ "invalid variable size: " \
+ "expected: %" GRN_FMT_SIZE \
+ "actual: %" GRN_FMT_SIZE, \
(sizeof(grn_obj *) + sizeof(grn_id)), GRN_BULK_VSIZE(var)); \
goto exit; \
} \
@@ -2768,52 +2225,6 @@ grn_proc_call(grn_ctx *ctx, grn_obj *proc, int nargs, grn_obj *caller)
} \
} while (0)
-static grn_bool
-pseudo_query_scan(grn_ctx *ctx, grn_obj *x, grn_obj *y)
-{
- grn_obj *normalizer;
- grn_obj *a = NULL, *b = NULL;
- grn_bool matched = GRN_FALSE;
-
- normalizer = grn_ctx_get(ctx, GRN_NORMALIZER_AUTO_NAME, -1);
- switch (x->header.domain) {
- case GRN_DB_SHORT_TEXT:
- case GRN_DB_TEXT:
- case GRN_DB_LONG_TEXT:
- a = grn_string_open(ctx, GRN_TEXT_VALUE(x), GRN_TEXT_LEN(x),
- normalizer, 0);
- break;
- default:
- break;
- }
-
- switch (y->header.domain) {
- case GRN_DB_SHORT_TEXT:
- case GRN_DB_TEXT:
- case GRN_DB_LONG_TEXT:
- b = grn_string_open(ctx, GRN_TEXT_VALUE(y), GRN_TEXT_LEN(y),
- normalizer, 0);
- break;
- default:
- break;
- }
-
- /* normalized str doesn't contain '\0'. */
- if (a && b) {
- const char *a_norm, *b_norm;
- grn_string_get_normalized(ctx, a, &a_norm, NULL, NULL);
- grn_string_get_normalized(ctx, b, &b_norm, NULL, NULL);
- matched = (strstr(a_norm, b_norm) != NULL);
- }
-
- if (a) { grn_obj_close(ctx, a); }
- if (b) { grn_obj_close(ctx, b); }
-
- if (normalizer) { grn_obj_unlink(ctx, normalizer); }
-
- return matched;
-}
-
inline static void
grn_expr_exec_get_member(grn_ctx *ctx,
grn_obj *expr,
@@ -2831,10 +2242,10 @@ grn_expr_exec_get_member(grn_ctx *ctx,
GRN_TEXT_INIT(&values, 0);
grn_obj_get_value(ctx, column, record_id, &values);
- grn_obj_reinit(ctx, result, DB_OBJ(column)->range, 0);
i = GRN_UINT32_VALUE(index);
if (values.header.type == GRN_UVECTOR) {
int n_elements;
+ grn_obj_reinit(ctx, result, DB_OBJ(column)->range, 0);
n_elements = GRN_BULK_VSIZE(&values) / sizeof(grn_id);
if (n_elements > i) {
grn_id value;
@@ -2843,25 +2254,70 @@ grn_expr_exec_get_member(grn_ctx *ctx,
}
} else {
if (values.u.v.n_sections > i) {
- grn_section *section = &(values.u.v.sections[i]);
- grn_obj *body = values.u.v.body;
- const char *value;
- value = GRN_BULK_HEAD(body) + section->offset;
- grn_bulk_write(ctx, result, value, section->length);
+ const char *content;
+ unsigned int content_length;
+ grn_id domain;
+
+ content_length = grn_vector_get_element(ctx, &values, i,
+ &content, NULL, &domain);
+ grn_obj_reinit(ctx, result, domain, 0);
+ grn_bulk_write(ctx, result, content, content_length);
}
}
GRN_OBJ_FIN(ctx, &values);
}
+static inline grn_bool
+grn_expr_exec_is_simple_expr(grn_ctx *ctx, grn_obj *expr)
+{
+ grn_expr *e = (grn_expr *)expr;
+
+ if (expr->header.type != GRN_EXPR) {
+ return GRN_FALSE;
+ }
+
+ if (e->codes_curr != 1) {
+ return GRN_FALSE;
+ }
+
+ switch (e->codes[0].op) {
+ case GRN_OP_PUSH :
+ return GRN_TRUE;
+ default :
+ return GRN_FALSE;
+ }
+}
+
+static inline grn_obj *
+grn_expr_exec_simple(grn_ctx *ctx, grn_obj *expr)
+{
+ grn_expr *e = (grn_expr *)expr;
+
+ return e->codes[0].value;
+}
+
grn_obj *
grn_expr_exec(grn_ctx *ctx, grn_obj *expr, int nargs)
{
grn_obj *val = NULL;
uint32_t stack_curr = ctx->impl->stack_curr;
GRN_API_ENTER;
+ if (grn_expr_exec_is_simple_expr(ctx, expr)) {
+ val = grn_expr_exec_simple(ctx, expr);
+ GRN_API_RETURN(val);
+ }
if (expr->header.type == GRN_PROC) {
- grn_proc_call(ctx, expr, nargs, expr);
+ grn_proc *proc = (grn_proc *)expr;
+ if (proc->type == GRN_PROC_COMMAND) {
+ grn_command_input *input;
+ input = grn_command_input_open(ctx, expr);
+ grn_command_run(ctx, expr, input);
+ grn_command_input_close(ctx, input);
+ GRN_API_RETURN(NULL);
+ } else {
+ grn_proc_call(ctx, expr, nargs, expr);
+ }
} else {
grn_expr *e = (grn_expr *)expr;
register grn_obj **s_ = ctx->impl->stack, *s0 = NULL, *s1 = NULL, **sp, *vp = e->values;
@@ -3218,12 +2674,7 @@ grn_expr_exec(grn_ctx *ctx, grn_obj *expr, int nargs)
case GRN_OP_GET_VALUE :
{
grn_obj *col, *rec;
- grn_obj pat_value;
- GRN_TEXT_INIT(&pat_value, 0);
do {
- uint32_t size;
- const char *value;
- grn_bool is_pat_key_accessor = GRN_FALSE;
if (code->nargs == 1) {
rec = v0;
if (code->value) {
@@ -3245,39 +2696,14 @@ grn_expr_exec(grn_ctx *ctx, grn_obj *expr, int nargs)
col = grn_obj_column(ctx, table, GRN_BULK_HEAD(col), GRN_BULK_VSIZE(col));
if (col) { grn_expr_take_obj(ctx, (grn_obj *)expr, col); }
}
- if (col) {
- grn_obj_reinit_for(ctx, res, col);
- if (col->header.type == GRN_ACCESSOR &&
- ((grn_accessor *)col)->action == GRN_ACCESSOR_GET_KEY &&
- ((grn_accessor *)col)->obj->header.type == GRN_TABLE_PAT_KEY) {
- is_pat_key_accessor = GRN_TRUE;
- GRN_BULK_REWIND(&pat_value);
- grn_obj_get_value(ctx, col, GRN_RECORD_VALUE(rec), &pat_value);
- value = GRN_BULK_HEAD(&pat_value);
- size = GRN_BULK_VSIZE(&pat_value);
- } else {
- value = grn_obj_get_value_(ctx, col, GRN_RECORD_VALUE(rec),
- &size);
- }
- } else {
+ if (!col) {
ERR(GRN_INVALID_ARGUMENT, "col resolve failed");
- GRN_OBJ_FIN(ctx, &pat_value);
goto exit;
}
- if (!is_pat_key_accessor && size == GRN_OBJ_GET_VALUE_IMD) {
- GRN_RECORD_SET(ctx, res, (uintptr_t)value);
- } else {
- if (value) {
- if (res->header.type == GRN_VECTOR) {
- grn_vector_decode(ctx, res, value, size);
- } else {
- grn_bulk_write_from(ctx, res, value, 0, size);
- }
- }
- }
+ grn_obj_reinit_for(ctx, res, col);
+ grn_obj_get_value(ctx, col, GRN_RECORD_VALUE(rec), res);
code++;
} while (code < ce && code->op == GRN_OP_GET_VALUE);
- GRN_OBJ_FIN(ctx, &pat_value);
}
break;
case GRN_OP_OBJ_SEARCH :
@@ -3511,7 +2937,7 @@ grn_expr_exec(grn_ctx *ctx, grn_obj *expr, int nargs)
POP1(y);
POP1(x);
WITH_SPSAVE({
- matched = pseudo_query_scan(ctx, x, y);
+ matched = grn_operator_exec_match(ctx, x, y);
});
ALLOC1(res);
grn_obj_reinit(ctx, res, GRN_DB_INT32, 0);
@@ -3521,35 +2947,38 @@ grn_expr_exec(grn_ctx *ctx, grn_obj *expr, int nargs)
break;
case GRN_OP_EQUAL :
{
- int r = GRN_FALSE;
+ grn_bool is_equal;
grn_obj *x, *y;
POP2ALLOC1(x, y, res);
- DO_EQ(x, y, r);
+ is_equal = grn_operator_exec_equal(ctx, x, y);
grn_obj_reinit(ctx, res, GRN_DB_INT32, 0);
- GRN_INT32_SET(ctx, res, r);
+ GRN_INT32_SET(ctx, res, is_equal ? 1 : 0);
}
code++;
break;
case GRN_OP_NOT_EQUAL :
{
- int r = GRN_FALSE;
+ grn_bool is_not_equal;
grn_obj *x, *y;
POP2ALLOC1(x, y, res);
- DO_EQ(x, y, r);
+ is_not_equal = grn_operator_exec_not_equal(ctx, x, y);
grn_obj_reinit(ctx, res, GRN_DB_INT32, 0);
- GRN_INT32_SET(ctx, res, 1 - r);
+ GRN_INT32_SET(ctx, res, is_not_equal ? 1 : 0);
}
code++;
break;
case GRN_OP_PREFIX :
{
grn_obj *x, *y;
- POP2ALLOC1(x, y, res);
- GRN_INT32_SET(ctx, res,
- (GRN_TEXT_LEN(x) >= GRN_TEXT_LEN(y) &&
- !memcmp(GRN_TEXT_VALUE(x), GRN_TEXT_VALUE(y), GRN_TEXT_LEN(y))));
- res->header.type = GRN_BULK;
- res->header.domain = GRN_DB_INT32;
+ grn_bool matched;
+ POP1(y);
+ POP1(x);
+ WITH_SPSAVE({
+ matched = grn_operator_exec_prefix(ctx, x, y);
+ });
+ ALLOC1(res);
+ grn_obj_reinit(ctx, res, GRN_DB_INT32, 0);
+ GRN_INT32_SET(ctx, res, matched ? 1 : 0);
}
code++;
break;
@@ -3568,11 +2997,11 @@ grn_expr_exec(grn_ctx *ctx, grn_obj *expr, int nargs)
break;
case GRN_OP_LESS :
{
- int r;
+ grn_bool r;
grn_obj *x, *y;
POP2ALLOC1(x, y, res);
- DO_COMPARE(x, y, r, <);
- GRN_INT32_SET(ctx, res, r);
+ r = grn_operator_exec_less(ctx, x, y);
+ GRN_INT32_SET(ctx, res, r ? 1 : 0);
res->header.type = GRN_BULK;
res->header.domain = GRN_DB_INT32;
}
@@ -3580,11 +3009,11 @@ grn_expr_exec(grn_ctx *ctx, grn_obj *expr, int nargs)
break;
case GRN_OP_GREATER :
{
- int r;
+ grn_bool r;
grn_obj *x, *y;
POP2ALLOC1(x, y, res);
- DO_COMPARE(x, y, r, >);
- GRN_INT32_SET(ctx, res, r);
+ r = grn_operator_exec_greater(ctx, x, y);
+ GRN_INT32_SET(ctx, res, r ? 1 : 0);
res->header.type = GRN_BULK;
res->header.domain = GRN_DB_INT32;
}
@@ -3592,11 +3021,11 @@ grn_expr_exec(grn_ctx *ctx, grn_obj *expr, int nargs)
break;
case GRN_OP_LESS_EQUAL :
{
- int r;
+ grn_bool r;
grn_obj *x, *y;
POP2ALLOC1(x, y, res);
- DO_COMPARE(x, y, r, <=);
- GRN_INT32_SET(ctx, res, r);
+ r = grn_operator_exec_less_equal(ctx, x, y);
+ GRN_INT32_SET(ctx, res, r ? 1 : 0);
res->header.type = GRN_BULK;
res->header.domain = GRN_DB_INT32;
}
@@ -3604,11 +3033,11 @@ grn_expr_exec(grn_ctx *ctx, grn_obj *expr, int nargs)
break;
case GRN_OP_GREATER_EQUAL :
{
- int r;
+ grn_bool r;
grn_obj *x, *y;
POP2ALLOC1(x, y, res);
- DO_COMPARE(x, y, r, >=);
- GRN_INT32_SET(ctx, res, r);
+ r = grn_operator_exec_greater_equal(ctx, x, y);
+ GRN_INT32_SET(ctx, res, r ? 1 : 0);
res->header.type = GRN_BULK;
res->header.domain = GRN_DB_INT32;
}
@@ -3799,6 +3228,7 @@ grn_expr_exec(grn_ctx *ctx, grn_obj *expr, int nargs)
break;
case GRN_OP_PLUS :
ARITHMETIC_BINARY_OPERATION_DISPATCH(
+ "+",
INTEGER_ARITHMETIC_OPERATION_PLUS,
INTEGER_ARITHMETIC_OPERATION_PLUS,
INTEGER_ARITHMETIC_OPERATION_PLUS,
@@ -3847,6 +3277,7 @@ grn_expr_exec(grn_ctx *ctx, grn_obj *expr, int nargs)
,);
} else {
ARITHMETIC_BINARY_OPERATION_DISPATCH(
+ "-",
INTEGER_ARITHMETIC_OPERATION_MINUS,
INTEGER_ARITHMETIC_OPERATION_MINUS,
INTEGER_ARITHMETIC_OPERATION_MINUS,
@@ -3865,6 +3296,7 @@ grn_expr_exec(grn_ctx *ctx, grn_obj *expr, int nargs)
break;
case GRN_OP_STAR :
ARITHMETIC_BINARY_OPERATION_DISPATCH(
+ "*",
INTEGER_ARITHMETIC_OPERATION_STAR,
INTEGER_ARITHMETIC_OPERATION_STAR,
INTEGER_ARITHMETIC_OPERATION_STAR,
@@ -3914,6 +3346,7 @@ grn_expr_exec(grn_ctx *ctx, grn_obj *expr, int nargs)
break;
case GRN_OP_BITWISE_OR :
ARITHMETIC_BINARY_OPERATION_DISPATCH(
+ "|",
INTEGER_ARITHMETIC_OPERATION_BITWISE_OR,
INTEGER_ARITHMETIC_OPERATION_BITWISE_OR,
INTEGER_ARITHMETIC_OPERATION_BITWISE_OR,
@@ -3925,6 +3358,7 @@ grn_expr_exec(grn_ctx *ctx, grn_obj *expr, int nargs)
break;
case GRN_OP_BITWISE_XOR :
ARITHMETIC_BINARY_OPERATION_DISPATCH(
+ "^",
INTEGER_ARITHMETIC_OPERATION_BITWISE_XOR,
INTEGER_ARITHMETIC_OPERATION_BITWISE_XOR,
INTEGER_ARITHMETIC_OPERATION_BITWISE_XOR,
@@ -3936,6 +3370,7 @@ grn_expr_exec(grn_ctx *ctx, grn_obj *expr, int nargs)
break;
case GRN_OP_BITWISE_AND :
ARITHMETIC_BINARY_OPERATION_DISPATCH(
+ "&",
INTEGER_ARITHMETIC_OPERATION_BITWISE_AND,
INTEGER_ARITHMETIC_OPERATION_BITWISE_AND,
INTEGER_ARITHMETIC_OPERATION_BITWISE_AND,
@@ -3947,6 +3382,7 @@ grn_expr_exec(grn_ctx *ctx, grn_obj *expr, int nargs)
break;
case GRN_OP_SHIFTL :
ARITHMETIC_BINARY_OPERATION_DISPATCH(
+ "<<",
INTEGER_ARITHMETIC_OPERATION_SHIFTL,
INTEGER_ARITHMETIC_OPERATION_SHIFTL,
INTEGER_ARITHMETIC_OPERATION_SHIFTL,
@@ -3958,6 +3394,7 @@ grn_expr_exec(grn_ctx *ctx, grn_obj *expr, int nargs)
break;
case GRN_OP_SHIFTR :
ARITHMETIC_BINARY_OPERATION_DISPATCH(
+ ">>",
INTEGER_ARITHMETIC_OPERATION_SHIFTR,
INTEGER_ARITHMETIC_OPERATION_SHIFTR,
INTEGER_ARITHMETIC_OPERATION_SHIFTR,
@@ -3969,6 +3406,7 @@ grn_expr_exec(grn_ctx *ctx, grn_obj *expr, int nargs)
break;
case GRN_OP_SHIFTRR :
ARITHMETIC_BINARY_OPERATION_DISPATCH(
+ ">>>",
INTEGER8_ARITHMETIC_OPERATION_SHIFTRR,
INTEGER16_ARITHMETIC_OPERATION_SHIFTRR,
INTEGER32_ARITHMETIC_OPERATION_SHIFTRR,
@@ -4010,10 +3448,11 @@ grn_expr_exec(grn_ctx *ctx, grn_obj *expr, int nargs)
case GRN_OP_NOT :
{
grn_obj *value;
+ grn_bool value_boolean;
POP1ALLOC1(value, res);
+ GRN_TRUEP(ctx, value, value_boolean);
grn_obj_reinit(ctx, res, GRN_DB_BOOL, 0);
- grn_obj_cast(ctx, value, res, GRN_FALSE);
- GRN_BOOL_SET(ctx, res, !GRN_BOOL_VALUE(res));
+ GRN_BOOL_SET(ctx, res, !value_boolean);
}
code++;
break;
@@ -4025,6 +3464,21 @@ grn_expr_exec(grn_ctx *ctx, grn_obj *expr, int nargs)
code++;
}
break;
+ case GRN_OP_REGEXP :
+ {
+ grn_obj *target, *pattern;
+ grn_bool matched;
+ POP1(pattern);
+ POP1(target);
+ WITH_SPSAVE({
+ matched = grn_operator_exec_regexp(ctx, target, pattern);
+ });
+ ALLOC1(res);
+ grn_obj_reinit(ctx, res, GRN_DB_BOOL, 0);
+ GRN_BOOL_SET(ctx, res, matched);
+ }
+ code++;
+ break;
default :
ERR(GRN_FUNCTION_NOT_IMPLEMENTED, "not implemented operator assigned");
goto exit;
@@ -4066,6 +3520,8 @@ grn_expr_get_value(grn_ctx *ctx, grn_obj *expr, int offset)
#define DEFAULT_TERM_EXTRACT_POLICY 0
#define DEFAULT_WEIGHT_VECTOR_SIZE 4096
+#define GRN_SCAN_INFO_MAX_N_ARGS 128
+
struct _grn_scan_info {
uint32_t start;
uint32_t end;
@@ -4076,14 +3532,20 @@ struct _grn_scan_info {
grn_obj wv;
grn_obj index;
grn_obj *query;
- grn_obj *args[8];
+ grn_obj *args[GRN_SCAN_INFO_MAX_N_ARGS];
int max_interval;
int similarity_threshold;
+ grn_obj scorers;
+ grn_obj scorer_args_exprs;
+ grn_obj scorer_args_expr_offsets;
};
#define SI_FREE(si) do {\
GRN_OBJ_FIN(ctx, &(si)->wv);\
GRN_OBJ_FIN(ctx, &(si)->index);\
+ GRN_OBJ_FIN(ctx, &(si)->scorers);\
+ GRN_OBJ_FIN(ctx, &(si)->scorer_args_exprs);\
+ GRN_OBJ_FIN(ctx, &(si)->scorer_args_expr_offsets);\
GRN_FREE(si);\
} while (0)
@@ -4102,6 +3564,9 @@ struct _grn_scan_info {
(si)->max_interval = DEFAULT_MAX_INTERVAL;\
(si)->similarity_threshold = DEFAULT_SIMILARITY_THRESHOLD;\
(si)->start = (st);\
+ GRN_PTR_INIT(&(si)->scorers, GRN_OBJ_VECTOR, GRN_ID_NIL);\
+ GRN_PTR_INIT(&(si)->scorer_args_exprs, GRN_OBJ_VECTOR, GRN_ID_NIL);\
+ GRN_UINT32_INIT(&(si)->scorer_args_expr_offsets, GRN_OBJ_VECTOR);\
} while (0)
static scan_info **
@@ -4145,9 +3610,9 @@ put_logical_op(grn_ctx *ctx, scan_info **sis, int *ip, grn_operator op, int star
} else {
s_->flags &= ~SCAN_PUSH;
s_->logical_op = op;
- memcpy(&sis[i], &sis[j], sizeof(scan_info *) * (r - j));
- memmove(&sis[j], &sis[r], sizeof(scan_info *) * (i - r));
- memcpy(&sis[i + j - r], &sis[i], sizeof(scan_info *) * (r - j));
+ grn_memcpy(&sis[i], &sis[j], sizeof(scan_info *) * (r - j));
+ grn_memmove(&sis[j], &sis[r], sizeof(scan_info *) * (i - r));
+ grn_memcpy(&sis[i + j - r], &sis[i], sizeof(scan_info *) * (r - j));
}
break;
}
@@ -4168,22 +3633,177 @@ put_logical_op(grn_ctx *ctx, scan_info **sis, int *ip, grn_operator op, int star
return sis;
}
+/* TODO: Remove me if nobody doesn't want to reuse the implementation again. */
+#if 0
+static const char *opstrs[] = {
+ "PUSH",
+ "POP",
+ "NOP",
+ "CALL",
+ "INTERN",
+ "GET_REF",
+ "GET_VALUE",
+ "AND",
+ "AND_NOT",
+ "OR",
+ "ASSIGN",
+ "STAR_ASSIGN",
+ "SLASH_ASSIGN",
+ "MOD_ASSIGN",
+ "PLUS_ASSIGN",
+ "MINUS_ASSIGN",
+ "SHIFTL_ASSIGN",
+ "SHIFTR_ASSIGN",
+ "SHIFTRR_ASSIGN",
+ "AND_ASSIGN",
+ "XOR_ASSIGN",
+ "OR_ASSIGN",
+ "JUMP",
+ "CJUMP",
+ "COMMA",
+ "BITWISE_OR",
+ "BITWISE_XOR",
+ "BITWISE_AND",
+ "BITWISE_NOT",
+ "EQUAL",
+ "NOT_EQUAL",
+ "LESS",
+ "GREATER",
+ "LESS_EQUAL",
+ "GREATER_EQUAL",
+ "IN",
+ "MATCH",
+ "NEAR",
+ "NEAR2",
+ "SIMILAR",
+ "TERM_EXTRACT",
+ "SHIFTL",
+ "SHIFTR",
+ "SHIFTRR",
+ "PLUS",
+ "MINUS",
+ "STAR",
+ "SLASH",
+ "MOD",
+ "DELETE",
+ "INCR",
+ "DECR",
+ "INCR_POST",
+ "DECR_POST",
+ "NOT",
+ "ADJUST",
+ "EXACT",
+ "LCP",
+ "PARTIAL",
+ "UNSPLIT",
+ "PREFIX",
+ "SUFFIX",
+ "GEO_DISTANCE1",
+ "GEO_DISTANCE2",
+ "GEO_DISTANCE3",
+ "GEO_DISTANCE4",
+ "GEO_WITHINP5",
+ "GEO_WITHINP6",
+ "GEO_WITHINP8",
+ "OBJ_SEARCH",
+ "EXPR_GET_VAR",
+ "TABLE_CREATE",
+ "TABLE_SELECT",
+ "TABLE_SORT",
+ "TABLE_GROUP",
+ "JSON_PUT"
+};
+
+static void
+put_value(grn_ctx *ctx, grn_obj *buf, grn_obj *obj)
+{
+ int len;
+ char namebuf[GRN_TABLE_MAX_KEY_SIZE];
+ if ((len = grn_column_name(ctx, obj, namebuf, GRN_TABLE_MAX_KEY_SIZE))) {
+ GRN_TEXT_PUT(ctx, buf, namebuf, len);
+ } else {
+ grn_text_otoj(ctx, buf, obj, NULL);
+ }
+}
+
+static grn_rc
+grn_expr_inspect_internal(grn_ctx *ctx, grn_obj *buf, grn_obj *expr)
+{
+ uint32_t i, j;
+ grn_expr_var *var;
+ grn_expr_code *code;
+ grn_expr *e = (grn_expr *)expr;
+ grn_hash *vars = grn_expr_get_vars(ctx, expr, &i);
+ GRN_TEXT_PUTS(ctx, buf, "noname");
+ GRN_TEXT_PUTC(ctx, buf, '(');
+ {
+ int i = 0;
+ grn_obj *value;
+ const char *name;
+ uint32_t name_len;
+ GRN_HASH_EACH(ctx, vars, id, &name, &name_len, &value, {
+ if (i++) { GRN_TEXT_PUTC(ctx, buf, ','); }
+ GRN_TEXT_PUT(ctx, buf, name, name_len);
+ GRN_TEXT_PUTC(ctx, buf, ':');
+ put_value(ctx, buf, value);
+ });
+ }
+ GRN_TEXT_PUTC(ctx, buf, ')');
+ GRN_TEXT_PUTC(ctx, buf, '{');
+ for (j = 0, code = e->codes; j < e->codes_curr; j++, code++) {
+ if (j) { GRN_TEXT_PUTC(ctx, buf, ','); }
+ grn_text_itoa(ctx, buf, code->modify);
+ if (code->op == GRN_OP_PUSH) {
+ for (i = 0, var = e->vars; i < e->nvars; i++, var++) {
+ if (&var->value == code->value) {
+ GRN_TEXT_PUTC(ctx, buf, '?');
+ if (var->name_size) {
+ GRN_TEXT_PUT(ctx, buf, var->name, var->name_size);
+ } else {
+ grn_text_itoa(ctx, buf, (int)i);
+ }
+ break;
+ }
+ }
+ if (i == e->nvars) {
+ put_value(ctx, buf, code->value);
+ }
+ } else {
+ if (code->value) {
+ put_value(ctx, buf, code->value);
+ GRN_TEXT_PUTC(ctx, buf, ' ');
+ }
+ GRN_TEXT_PUTS(ctx, buf, opstrs[code->op]);
+ }
+ }
+ GRN_TEXT_PUTC(ctx, buf, '}');
+ return GRN_SUCCESS;
+}
#define EXPRLOG(name,expr) do {\
grn_obj strbuf;\
GRN_TEXT_INIT(&strbuf, 0);\
- grn_expr_inspect(ctx, &strbuf, (expr));\
+ grn_expr_inspect_internal(ctx, &strbuf, (expr));\
GRN_TEXT_PUTC(ctx, &strbuf, '\0');\
GRN_LOG(ctx, GRN_LOG_NOTICE, "%s=(%s)", (name), GRN_TEXT_VALUE(&strbuf));\
GRN_OBJ_FIN(ctx, &strbuf);\
} while (0)
+#endif
+
static void
-scan_info_put_index(grn_ctx *ctx, scan_info *si, grn_obj *index, uint32_t sid, int32_t weight)
+scan_info_put_index(grn_ctx *ctx, scan_info *si,
+ grn_obj *index, uint32_t sid, int32_t weight,
+ grn_obj *scorer,
+ grn_obj *scorer_args_expr,
+ uint32_t scorer_args_expr_offset)
{
GRN_PTR_PUT(ctx, &si->index, index);
GRN_UINT32_PUT(ctx, &si->wv, sid);
GRN_INT32_PUT(ctx, &si->wv, weight);
+ GRN_PTR_PUT(ctx, &si->scorers, scorer);
+ GRN_PTR_PUT(ctx, &si->scorer_args_exprs, scorer_args_expr);
+ GRN_UINT32_PUT(ctx, &si->scorer_args_expr_offsets, scorer_args_expr_offset);
{
int i, ni = (GRN_BULK_VSIZE(&si->index) / sizeof(grn_obj *)) - 1;
grn_obj **pi = &GRN_PTR_VALUE_AT(&si->index, ni);
@@ -4191,10 +3811,10 @@ scan_info_put_index(grn_ctx *ctx, scan_info *si, grn_obj *index, uint32_t sid, i
if (index == pi[-1]) {
if (i) {
int32_t *pw = &GRN_INT32_VALUE_AT(&si->wv, (ni - i) * 2);
- memmove(pw + 2, pw, sizeof(int32_t) * 2 * i);
+ grn_memmove(pw + 2, pw, sizeof(int32_t) * 2 * i);
pw[0] = (int32_t) sid;
pw[1] = weight;
- memmove(pi + 1, pi, sizeof(grn_obj *) * i);
+ grn_memmove(pi + 1, pi, sizeof(grn_obj *) * i);
pi[0] = index;
}
return;
@@ -4204,10 +3824,13 @@ scan_info_put_index(grn_ctx *ctx, scan_info *si, grn_obj *index, uint32_t sid, i
}
static int32_t
-get_weight(grn_ctx *ctx, grn_expr_code *ec)
+get_weight(grn_ctx *ctx, grn_expr_code *ec, uint32_t *offset)
{
if (ec->modify == 2 && ec[2].op == GRN_OP_STAR &&
ec[1].value && ec[1].value->header.type == GRN_BULK) {
+ if (offset) {
+ *offset = 2;
+ }
if (ec[1].value->header.domain == GRN_DB_INT32 ||
ec[1].value->header.domain == GRN_DB_UINT32) {
return GRN_INT32_VALUE(ec[1].value);
@@ -4222,6 +3845,9 @@ get_weight(grn_ctx *ctx, grn_expr_code *ec)
return weight;
}
} else {
+ if (offset) {
+ *offset = 0;
+ }
return 1;
}
}
@@ -4243,6 +3869,9 @@ grn_scan_info_open(grn_ctx *ctx, int start)
si->max_interval = DEFAULT_MAX_INTERVAL;
si->similarity_threshold = DEFAULT_SIMILARITY_THRESHOLD;
si->start = start;
+ GRN_PTR_INIT(&si->scorers, GRN_OBJ_VECTOR, GRN_ID_NIL);
+ GRN_PTR_INIT(&si->scorer_args_exprs, GRN_OBJ_VECTOR, GRN_ID_NIL);
+ GRN_UINT32_INIT(&si->scorer_args_expr_offsets, GRN_OBJ_VECTOR);
return si;
}
@@ -4254,9 +3883,16 @@ grn_scan_info_close(grn_ctx *ctx, scan_info *si)
}
void
-grn_scan_info_put_index(grn_ctx *ctx, scan_info *si, grn_obj *index, uint32_t sid, int32_t weight)
+grn_scan_info_put_index(grn_ctx *ctx, scan_info *si,
+ grn_obj *index, uint32_t sid, int32_t weight,
+ grn_obj *scorer,
+ grn_obj *scorer_args_expr,
+ uint32_t scorer_args_expr_offset)
{
- scan_info_put_index(ctx, si, index, sid, weight);
+ scan_info_put_index(ctx, si, index, sid, weight,
+ scorer,
+ scorer_args_expr,
+ scorer_args_expr_offset);
}
scan_info **
@@ -4267,9 +3903,9 @@ grn_scan_info_put_logical_op(grn_ctx *ctx, scan_info **sis, int *ip,
}
int32_t
-grn_expr_code_get_weight(grn_ctx *ctx, grn_expr_code *ec)
+grn_expr_code_get_weight(grn_ctx *ctx, grn_expr_code *ec, uint32_t *offset)
{
- return get_weight(ctx, ec);
+ return get_weight(ctx, ec, offset);
}
int
@@ -4347,7 +3983,7 @@ grn_scan_info_set_similarity_threshold(scan_info *si, int similarity_threshold)
grn_bool
grn_scan_info_push_arg(scan_info *si, grn_obj *arg)
{
- if (si->nargs >= 8) {
+ if (si->nargs >= GRN_SCAN_INFO_MAX_N_ARGS) {
return GRN_FALSE;
}
@@ -4365,36 +4001,324 @@ grn_scan_info_get_arg(grn_ctx *ctx, scan_info *si, int i)
}
static uint32_t
-scan_info_build_find_index_column_index(grn_ctx *ctx,
- scan_info *si,
- grn_expr_code *ec,
- uint32_t n_rest_codes,
- grn_operator op)
+scan_info_build_match_expr_codes_find_index(grn_ctx *ctx, scan_info *si,
+ grn_expr *expr, uint32_t i,
+ grn_obj **index,
+ int *sid)
{
- uint32_t offset = 0;
- grn_obj *index;
+ grn_expr_code *ec;
+ uint32_t offset = 1;
+ grn_index_datum index_datum;
+ unsigned int n_index_data = 0;
+
+ ec = &(expr->codes[i]);
+ switch (ec->value->header.type) {
+ case GRN_ACCESSOR :
+ n_index_data = grn_column_find_index_data(ctx, ec->value, si->op,
+ &index_datum, 1);
+ if (n_index_data > 0) {
+ grn_accessor *a = (grn_accessor *)(ec->value);
+ *sid = index_datum.section;
+ if (a->next && a->obj != index_datum.index) {
+ *index = ec->value;
+ } else {
+ *index = index_datum.index;
+ }
+ }
+ break;
+ case GRN_COLUMN_FIX_SIZE :
+ case GRN_COLUMN_VAR_SIZE :
+ n_index_data = grn_column_find_index_data(ctx, ec->value, si->op,
+ &index_datum, 1);
+ if (n_index_data > 0) {
+ *index = index_datum.index;
+ *sid = index_datum.section;
+ }
+ break;
+ case GRN_COLUMN_INDEX :
+ {
+ uint32_t n_rest_codes;
+
+ *index = ec->value;
+
+ n_rest_codes = expr->codes_curr - i;
+ if (n_rest_codes >= 2 &&
+ ec[1].value &&
+ (ec[1].value->header.domain == GRN_DB_INT32 ||
+ ec[1].value->header.domain == GRN_DB_UINT32) &&
+ ec[2].op == GRN_OP_GET_MEMBER) {
+ if (ec[1].value->header.domain == GRN_DB_INT32) {
+ *sid = GRN_INT32_VALUE(ec[1].value) + 1;
+ } else {
+ *sid = GRN_UINT32_VALUE(ec[1].value) + 1;
+ }
+ offset += 2;
+ }
+ }
+ break;
+ default :
+ break;
+ }
+
+ return offset;
+}
+
+static uint32_t
+scan_info_build_match_expr_codes(grn_ctx *ctx, scan_info *si,
+ grn_expr *expr, uint32_t i)
+{
+ grn_expr_code *ec;
+ grn_obj *index = NULL;
int sid = 0;
- int32_t weight = 0;
-
- index = ec->value;
- if (n_rest_codes > 2 &&
- ec[1].value &&
- (ec[1].value->header.domain == GRN_DB_INT32 ||
- ec[1].value->header.domain == GRN_DB_UINT32) &&
- ec[2].op == GRN_OP_GET_MEMBER) {
- if (ec[1].value->header.domain == GRN_DB_INT32) {
- sid = GRN_INT32_VALUE(ec[1].value) + 1;
+ uint32_t offset = 0;
+
+ ec = &(expr->codes[i]);
+ if (!ec->value) {
+ return i + 1;
+ }
+
+ switch (ec->value->header.type) {
+ case GRN_ACCESSOR :
+ case GRN_COLUMN_FIX_SIZE :
+ case GRN_COLUMN_VAR_SIZE :
+ case GRN_COLUMN_INDEX :
+ offset = scan_info_build_match_expr_codes_find_index(ctx, si, expr, i,
+ &index, &sid);
+ i += offset - 1;
+ if (index) {
+ if (ec->value->header.type == GRN_ACCESSOR) {
+ si->flags |= SCAN_ACCESSOR;
+ }
+ scan_info_put_index(ctx, si, index, sid,
+ get_weight(ctx, &(expr->codes[i]), &offset),
+ NULL, NULL, 0);
+ i += offset;
+ }
+ break;
+ case GRN_PROC :
+ if (!grn_obj_is_scorer_proc(ctx, ec->value)) {
+ grn_obj inspected;
+ GRN_TEXT_INIT(&inspected, 0);
+ grn_inspect(ctx, &inspected, ec->value);
+ ERR(GRN_INVALID_ARGUMENT,
+ "procedure must be scorer: <%.*s>",
+ (int)GRN_TEXT_LEN(&inspected),
+ GRN_TEXT_VALUE(&inspected));
+ GRN_OBJ_FIN(ctx, &inspected);
+ return expr->codes_curr;
+ }
+ i++;
+ offset = scan_info_build_match_expr_codes_find_index(ctx, si, expr, i,
+ &index, &sid);
+ i += offset;
+ if (index) {
+ uint32_t scorer_args_expr_offset = 0;
+ if (expr->codes[i].op != GRN_OP_CALL) {
+ scorer_args_expr_offset = i;
+ }
+ while (i < expr->codes_curr && expr->codes[i].op != GRN_OP_CALL) {
+ i++;
+ }
+ scan_info_put_index(ctx, si, index, sid,
+ get_weight(ctx, &(expr->codes[i]), &offset),
+ ec->value,
+ (grn_obj *)expr,
+ scorer_args_expr_offset);
+ i += offset;
+ }
+ break;
+ default :
+ {
+ char name[GRN_TABLE_MAX_KEY_SIZE];
+ int name_size;
+ name_size = grn_obj_name(ctx, ec->value, name, GRN_TABLE_MAX_KEY_SIZE);
+ ERR(GRN_INVALID_ARGUMENT,
+ "invalid match target: <%.*s>",
+ name_size, name);
+ return expr->codes_curr;
+ }
+ break;
+ }
+
+ return i + 1;
+}
+
+static void
+scan_info_build_match_expr(grn_ctx *ctx, scan_info *si, grn_expr *expr)
+{
+ uint32_t i;
+ i = 0;
+ while (i < expr->codes_curr) {
+ i = scan_info_build_match_expr_codes(ctx, si, expr, i);
+ }
+}
+
+static grn_bool
+is_index_searchable_regexp(grn_ctx *ctx, grn_obj *regexp)
+{
+ const char *regexp_raw;
+ const char *regexp_raw_end;
+ grn_bool escaping = GRN_FALSE;
+
+ if (!(regexp->header.domain == GRN_DB_SHORT_TEXT ||
+ regexp->header.domain == GRN_DB_TEXT ||
+ regexp->header.domain == GRN_DB_LONG_TEXT)) {
+ return GRN_FALSE;
+ }
+
+ regexp_raw = GRN_TEXT_VALUE(regexp);
+ regexp_raw_end = regexp_raw + GRN_TEXT_LEN(regexp);
+
+ while (regexp_raw < regexp_raw_end) {
+ unsigned int char_len;
+
+ char_len = grn_charlen(ctx, regexp_raw, regexp_raw_end);
+ if (char_len == 0) {
+ return GRN_FALSE;
+ }
+
+ if (char_len == 1) {
+ if (escaping) {
+ escaping = GRN_FALSE;
+ switch (regexp_raw[0]) {
+ case 'Z' :
+ case 'b' :
+ case 'B' :
+ case 'd' :
+ case 'D' :
+ case 'h' :
+ case 'H' :
+ case 'p' :
+ case 's' :
+ case 'S' :
+ case 'w' :
+ case 'W' :
+ case 'X' :
+ case 'k' :
+ case 'g' :
+ case '1' :
+ case '2' :
+ case '3' :
+ case '4' :
+ case '5' :
+ case '6' :
+ case '7' :
+ case '8' :
+ case '9' :
+ return GRN_FALSE;
+ default :
+ break;
+ }
+ } else {
+ switch (regexp_raw[0]) {
+ case '.' :
+ case '[' :
+ case ']' :
+ case '|' :
+ case '?' :
+ case '+' :
+ case '*' :
+ case '{' :
+ case '}' :
+ case '^' :
+ case '$' :
+ case '(' :
+ case ')' :
+ escaping = GRN_FALSE;
+ return GRN_FALSE;
+ case '\\' :
+ escaping = GRN_TRUE;
+ break;
+ default :
+ escaping = GRN_FALSE;
+ break;
+ }
+ }
} else {
- sid = GRN_UINT32_VALUE(ec[1].value) + 1;
+ escaping = GRN_FALSE;
}
- offset = 2;
- weight = get_weight(ctx, ec + offset);
- } else {
- weight = get_weight(ctx, ec);
+
+ regexp_raw += char_len;
}
- scan_info_put_index(ctx, si, index, sid, weight);
- return offset;
+ return GRN_TRUE;
+}
+
+static void
+scan_info_build_match(grn_ctx *ctx, scan_info *si)
+{
+ grn_obj **p, **pe;
+
+ if (si->op == GRN_OP_REGEXP) {
+ p = si->args;
+ pe = si->args + si->nargs;
+ for (; p < pe; p++) {
+ if ((*p)->header.type == GRN_BULK &&
+ !is_index_searchable_regexp(ctx, *p)) {
+ return;
+ }
+ }
+ }
+
+ p = si->args;
+ pe = si->args + si->nargs;
+ for (; p < pe; p++) {
+ if ((*p)->header.type == GRN_EXPR) {
+ scan_info_build_match_expr(ctx, si, (grn_expr *)(*p));
+ } else if (GRN_DB_OBJP(*p)) {
+ grn_index_datum index_datum;
+ unsigned int n_index_data;
+ n_index_data = grn_column_find_index_data(ctx, *p, si->op,
+ &index_datum, 1);
+ if (n_index_data > 0) {
+ scan_info_put_index(ctx, si,
+ index_datum.index, index_datum.section, 1,
+ NULL, NULL, 0);
+ }
+ } else if (GRN_ACCESSORP(*p)) {
+ grn_index_datum index_datum;
+ unsigned int n_index_data;
+ si->flags |= SCAN_ACCESSOR;
+ n_index_data = grn_column_find_index_data(ctx, *p, si->op,
+ &index_datum, 1);
+ if (n_index_data > 0) {
+ grn_obj *index;
+ if (((grn_accessor *)(*p))->next) {
+ index = *p;
+ } else {
+ index = index_datum.index;
+ }
+ scan_info_put_index(ctx, si,
+ index, index_datum.section, 1,
+ NULL, NULL, 0);
+ }
+ } else {
+ switch (si->op) {
+ case GRN_OP_NEAR :
+ case GRN_OP_NEAR2 :
+ if (si->nargs == 3 &&
+ *p == si->args[2] &&
+ (*p)->header.domain == GRN_DB_INT32) {
+ si->max_interval = GRN_INT32_VALUE(*p);
+ } else {
+ si->query = *p;
+ }
+ break;
+ case GRN_OP_SIMILAR :
+ if (si->nargs == 3 &&
+ *p == si->args[2] &&
+ (*p)->header.domain == GRN_DB_INT32) {
+ si->similarity_threshold = GRN_INT32_VALUE(*p);
+ } else {
+ si->query = *p;
+ }
+ break;
+ default :
+ si->query = *p;
+ break;
+ }
+ }
+ }
}
static scan_info **
@@ -4431,10 +4355,26 @@ scan_info_build(grn_ctx *ctx, grn_obj *expr, int *n,
case GRN_OP_GEO_WITHINP6 :
case GRN_OP_GEO_WITHINP8 :
case GRN_OP_TERM_EXTRACT :
+ case GRN_OP_REGEXP :
if (stat < SCAN_COL1 || SCAN_CONST < stat) { return NULL; }
stat = SCAN_START;
m++;
break;
+ case GRN_OP_BITWISE_OR :
+ case GRN_OP_BITWISE_XOR :
+ case GRN_OP_BITWISE_AND :
+ case GRN_OP_BITWISE_NOT :
+ case GRN_OP_SHIFTL :
+ case GRN_OP_SHIFTR :
+ case GRN_OP_SHIFTRR :
+ case GRN_OP_PLUS :
+ case GRN_OP_MINUS :
+ case GRN_OP_STAR :
+ case GRN_OP_MOD :
+ if (stat < SCAN_COL1 || SCAN_CONST < stat) { return NULL; }
+ stat = SCAN_START;
+ if (m != o + 1) { return NULL; }
+ break;
case GRN_OP_AND :
case GRN_OP_OR :
case GRN_OP_AND_NOT :
@@ -4496,90 +4436,17 @@ scan_info_build(grn_ctx *ctx, grn_obj *expr, int *n,
case GRN_OP_GEO_WITHINP6 :
case GRN_OP_GEO_WITHINP8 :
case GRN_OP_TERM_EXTRACT :
+ case GRN_OP_REGEXP :
stat = SCAN_START;
si->op = c->op;
si->end = c - e->codes;
sis[i++] = si;
- {
- int sid;
- grn_obj *index, **p = si->args, **pe = si->args + si->nargs;
- for (; p < pe; p++) {
- if ((*p)->header.type == GRN_EXPR) {
- uint32_t j;
- grn_expr_code *ec;
- grn_expr *e = (grn_expr *)(*p);
- for (j = e->codes_curr, ec = e->codes; j--; ec++) {
- if (ec->value) {
- switch (ec->value->header.type) {
- case GRN_ACCESSOR :
- if (grn_column_index(ctx, ec->value, c->op, &index, 1, &sid)) {
- int32_t weight = get_weight(ctx, ec);
- si->flags |= SCAN_ACCESSOR;
- if (((grn_accessor *)ec->value)->next) {
- scan_info_put_index(ctx, si, ec->value, sid, weight);
- } else {
- scan_info_put_index(ctx, si, index, sid, weight);
- }
- }
- break;
- case GRN_COLUMN_FIX_SIZE :
- case GRN_COLUMN_VAR_SIZE :
- if (grn_column_index(ctx, ec->value, c->op, &index, 1, &sid)) {
- scan_info_put_index(ctx, si, index, sid, get_weight(ctx, ec));
- }
- break;
- case GRN_COLUMN_INDEX :
- {
- uint32_t offset;
- offset = scan_info_build_find_index_column_index(ctx, si, ec,
- j, c->op);
- j -= offset;
- ec += offset;
- }
- break;
- }
- }
- }
- } else if (GRN_DB_OBJP(*p)) {
- if (grn_column_index(ctx, *p, c->op, &index, 1, &sid)) {
- scan_info_put_index(ctx, si, index, sid, 1);
- }
- } else if (GRN_ACCESSORP(*p)) {
- si->flags |= SCAN_ACCESSOR;
- if (grn_column_index(ctx, *p, c->op, &index, 1, &sid)) {
- if (((grn_accessor *)(*p))->next) {
- scan_info_put_index(ctx, si, *p, sid, 1);
- } else {
- scan_info_put_index(ctx, si, index, sid, 1);
- }
- }
- } else {
- switch (c->op) {
- case GRN_OP_NEAR :
- case GRN_OP_NEAR2 :
- if (si->nargs == 3 &&
- *p == si->args[2] &&
- (*p)->header.domain == GRN_DB_INT32) {
- si->max_interval = GRN_INT32_VALUE(*p);
- } else {
- si->query = *p;
- }
- break;
- case GRN_OP_SIMILAR :
- if (si->nargs == 3 &&
- *p == si->args[2] &&
- (*p)->header.domain == GRN_DB_INT32) {
- si->similarity_threshold = GRN_INT32_VALUE(*p);
- } else {
- si->query = *p;
- }
- break;
- default :
- si->query = *p;
- break;
- }
- }
- }
+ scan_info_build_match(ctx, si);
+ if (ctx->rc != GRN_SUCCESS) {
+ int j;
+ for (j = 0; j < i; j++) { SI_FREE(sis[j]); }
+ GRN_FREE(sis);
+ return NULL;
}
si = NULL;
break;
@@ -4595,7 +4462,7 @@ scan_info_build(grn_ctx *ctx, grn_obj *expr, int *n,
if (c->value == var) {
stat = SCAN_VAR;
} else {
- if (si->nargs < 8) {
+ if (si->nargs < GRN_SCAN_INFO_MAX_N_ARGS) {
si->args[si->nargs++] = c->value;
}
if (stat == SCAN_START) { si->flags |= SCAN_PRE_CONST; }
@@ -4610,7 +4477,7 @@ scan_info_build(grn_ctx *ctx, grn_obj *expr, int *n,
case SCAN_CONST :
case SCAN_VAR :
stat = SCAN_COL1;
- if (si->nargs < 8) {
+ if (si->nargs < GRN_SCAN_INFO_MAX_N_ARGS) {
si->args[si->nargs++] = c->value;
}
break;
@@ -4628,6 +4495,7 @@ scan_info_build(grn_ctx *ctx, grn_obj *expr, int *n,
"invalid expression: can't use column as a value: %.*s",
(int)GRN_TEXT_LEN(&inspected), GRN_TEXT_VALUE(&inspected));
GRN_OBJ_FIN(ctx, &inspected);
+ SI_FREE(si);
for (j = 0; j < i; j++) { SI_FREE(sis[j]); }
GRN_FREE(sis);
return NULL;
@@ -4649,17 +4517,28 @@ scan_info_build(grn_ctx *ctx, grn_obj *expr, int *n,
sis[i++] = si;
/* better index resolving framework for functions should be implemented */
{
- int sid;
- grn_obj *index, **p = si->args, **pe = si->args + si->nargs;
+ grn_obj **p = si->args, **pe = si->args + si->nargs;
for (; p < pe; p++) {
if (GRN_DB_OBJP(*p)) {
- if (grn_column_index(ctx, *p, c->op, &index, 1, &sid)) {
- scan_info_put_index(ctx, si, index, sid, 1);
+ grn_index_datum index_datum;
+ unsigned int n_index_data;
+ n_index_data = grn_column_find_index_data(ctx, *p, c->op,
+ &index_datum, 1);
+ if (n_index_data > 0) {
+ scan_info_put_index(ctx, si,
+ index_datum.index, index_datum.section, 1,
+ NULL, NULL, 0);
}
} else if (GRN_ACCESSORP(*p)) {
+ grn_index_datum index_datum;
+ unsigned int n_index_data;
si->flags |= SCAN_ACCESSOR;
- if (grn_column_index(ctx, *p, c->op, &index, 1, &sid)) {
- scan_info_put_index(ctx, si, index, sid, 1);
+ n_index_data = grn_column_find_index_data(ctx, *p, c->op,
+ &index_datum, 1);
+ if (n_index_data > 0) {
+ scan_info_put_index(ctx, si,
+ index_datum.index, index_datum.section, 1,
+ NULL, NULL, 0);
}
} else {
si->query = *p;
@@ -4694,6 +4573,43 @@ scan_info_build(grn_ctx *ctx, grn_obj *expr, int *n,
return sis;
}
+void
+grn_inspect_scan_info_list(grn_ctx *ctx, grn_obj *buffer, scan_info **sis, int n)
+{
+ int i;
+
+ for (i = 0; i < n; i++) {
+ scan_info *si = sis[i];
+
+ grn_text_printf(ctx, buffer, "[%d]\n", i);
+ grn_text_printf(ctx, buffer,
+ " op: <%s>\n",
+ grn_operator_to_string(si->op));
+ grn_text_printf(ctx, buffer,
+ " logical_op: <%s>\n",
+ grn_operator_to_string(si->logical_op));
+
+ GRN_TEXT_PUTS(ctx, buffer, " query: <");
+ grn_inspect(ctx, buffer, si->query);
+ GRN_TEXT_PUTS(ctx, buffer, ">\n");
+
+ grn_text_printf(ctx, buffer,
+ " expr: <%d..%d>\n", si->start, si->end);
+ }
+}
+
+void
+grn_p_scan_info_list(grn_ctx *ctx, scan_info **sis, int n)
+{
+ grn_obj inspected;
+ GRN_TEXT_INIT(&inspected, 0);
+ grn_inspect_scan_info_list(ctx, &inspected, sis, n);
+ printf("%.*s\n",
+ (int)GRN_TEXT_LEN(&inspected),
+ GRN_TEXT_VALUE(&inspected));
+ GRN_OBJ_FIN(ctx, &inspected);
+}
+
inline static int32_t
exec_result_to_score(grn_ctx *ctx, grn_obj *result, grn_obj *score_buffer)
{
@@ -4719,8 +4635,8 @@ exec_result_to_score(grn_ctx *ctx, grn_obj *result, grn_obj *score_buffer)
}
static void
-grn_table_select_(grn_ctx *ctx, grn_obj *table, grn_obj *expr, grn_obj *v,
- grn_obj *res, grn_operator op)
+grn_table_select_sequential(grn_ctx *ctx, grn_obj *table, grn_obj *expr,
+ grn_obj *v, grn_obj *res, grn_operator op)
{
int32_t score;
grn_id id, *idp;
@@ -4737,6 +4653,9 @@ grn_table_select_(grn_ctx *ctx, grn_obj *table, grn_obj *expr, grn_obj *v,
while ((id = grn_table_cursor_next(ctx, tc))) {
GRN_RECORD_SET(ctx, v, id);
r = grn_expr_exec(ctx, expr, 0);
+ if (ctx->rc) {
+ break;
+ }
score = exec_result_to_score(ctx, r, &score_buffer);
if (score > 0) {
grn_rset_recinfo *ri;
@@ -4754,6 +4673,9 @@ grn_table_select_(grn_ctx *ctx, grn_obj *table, grn_obj *expr, grn_obj *v,
grn_hash_cursor_get_key(ctx, hc, (void **) &idp);
GRN_RECORD_SET(ctx, v, *idp);
r = grn_expr_exec(ctx, expr, 0);
+ if (ctx->rc) {
+ break;
+ }
score = exec_result_to_score(ctx, r, &score_buffer);
if (score > 0) {
grn_rset_recinfo *ri;
@@ -4772,6 +4694,9 @@ grn_table_select_(grn_ctx *ctx, grn_obj *table, grn_obj *expr, grn_obj *v,
grn_hash_cursor_get_key(ctx, hc, (void **) &idp);
GRN_RECORD_SET(ctx, v, *idp);
r = grn_expr_exec(ctx, expr, 0);
+ if (ctx->rc) {
+ break;
+ }
score = exec_result_to_score(ctx, r, &score_buffer);
if (score > 0) {
grn_hash_cursor_delete(ctx, hc, NULL);
@@ -4786,6 +4711,9 @@ grn_table_select_(grn_ctx *ctx, grn_obj *table, grn_obj *expr, grn_obj *v,
grn_hash_cursor_get_key(ctx, hc, (void **) &idp);
GRN_RECORD_SET(ctx, v, *idp);
r = grn_expr_exec(ctx, expr, 0);
+ if (ctx->rc) {
+ break;
+ }
score = exec_result_to_score(ctx, r, &score_buffer);
if (score > 0) {
grn_rset_recinfo *ri;
@@ -4854,13 +4782,29 @@ grn_table_select_index_range_column(grn_ctx *ctx, grn_obj *table,
min, min_size, max, max_size,
offset, limit, flags);
if (cursor) {
- grn_id index_id;
- while ((index_id = grn_table_cursor_next(ctx, cursor))) {
- grn_ii_at(ctx, (grn_ii *)index, index_id,
- (grn_hash *)res, logical_op);
+ uint32_t sid;
+ int32_t weight;
+ grn_obj *index_cursor;
+
+ sid = GRN_UINT32_VALUE_AT(&(si->wv), 0);
+ weight = GRN_INT32_VALUE_AT(&(si->wv), 1);
+ index_cursor = grn_index_cursor_open(ctx, cursor, index,
+ GRN_ID_NIL, GRN_ID_MAX, 0);
+ if (index_cursor) {
+ grn_posting *posting;
+ while ((posting = grn_index_cursor_next(ctx, index_cursor, NULL))) {
+ if (sid == 0 || posting->sid == sid) {
+ grn_ii_posting ii_posting;
+ ii_posting.rid = posting->rid;
+ ii_posting.sid = posting->sid;
+ ii_posting.weight = posting->weight * weight;
+ grn_ii_posting_add(ctx, &ii_posting, (grn_hash *)res, logical_op);
+ }
+ }
+ processed = GRN_TRUE;
+ grn_obj_unlink(ctx, index_cursor);
}
grn_table_cursor_close(ctx, cursor);
- processed = GRN_TRUE;
}
grn_ii_resolve_sel_and(ctx, (grn_hash *)res, logical_op);
@@ -4913,11 +4857,21 @@ grn_table_select_index_range_accessor(grn_ctx *ctx, grn_obj *table,
{
int i;
+ grn_obj weight_vector;
+ grn_search_optarg optarg;
+ GRN_INT32_INIT(&weight_vector, GRN_OBJ_VECTOR);
+ memset(&optarg, 0, sizeof(grn_search_optarg));
+ if (si->op == GRN_OP_MATCH) {
+ optarg.mode = GRN_OP_EXACT;
+ } else {
+ optarg.mode = si->op;
+ }
for (i = n_accessors - 1; i > 0; i--) {
grn_rc rc = GRN_SUCCESS;
grn_accessor *accessor;
grn_obj *index;
+ int section;
grn_obj *domain;
grn_obj *target;
grn_obj *next_res;
@@ -4926,10 +4880,34 @@ grn_table_select_index_range_accessor(grn_ctx *ctx, grn_obj *table,
accessor = (grn_accessor *)GRN_PTR_VALUE_AT(accessor_stack, i - 1);
target = accessor->obj;
- if (grn_column_index(ctx, target, GRN_OP_EQUAL, &index, 1, NULL) == 0) {
- grn_obj_unlink(ctx, current_res);
- current_res = NULL;
- break;
+ {
+ grn_index_datum index_datum;
+ unsigned int n_index_data;
+ n_index_data = grn_column_find_index_data(ctx, target, GRN_OP_EQUAL,
+ &index_datum, 1);
+ if (n_index_data == 0) {
+ grn_obj_unlink(ctx, current_res);
+ current_res = NULL;
+ break;
+ }
+ index = index_datum.index;
+ section = index_datum.section;
+ }
+
+ if (section > 0) {
+ int j;
+ int weight_position = section - 1;
+
+ GRN_BULK_REWIND(&weight_vector);
+ GRN_INT32_SET_AT(ctx, &weight_vector, weight_position, 1);
+ optarg.weight_vector = &(GRN_INT32_VALUE(&weight_vector));
+ optarg.vector_size = GRN_BULK_VSIZE(&weight_vector) / sizeof(int32_t);
+ for (j = 0; j < weight_position - 1; j++) {
+ optarg.weight_vector[j] = 0;
+ }
+ } else {
+ optarg.weight_vector = NULL;
+ optarg.vector_size = 1;
}
{
@@ -4954,14 +4932,14 @@ grn_table_select_index_range_accessor(grn_ctx *ctx, grn_obj *table,
if (domain->header.type == GRN_TABLE_NO_KEY) {
rc = grn_ii_sel(ctx, (grn_ii *)index,
(const char *)next_record_id, sizeof(grn_id),
- (grn_hash *)next_res, next_op, NULL);
+ (grn_hash *)next_res, next_op, &optarg);
} else {
char key[GRN_TABLE_MAX_KEY_SIZE];
int key_len;
key_len = grn_table_get_key(ctx, domain, *next_record_id,
key, GRN_TABLE_MAX_KEY_SIZE);
rc = grn_ii_sel(ctx, (grn_ii *)index, key, key_len,
- (grn_hash *)next_res, next_op, NULL);
+ (grn_hash *)next_res, next_op, &optarg);
}
if (rc != GRN_SUCCESS) {
break;
@@ -4986,6 +4964,7 @@ grn_table_select_index_range_accessor(grn_ctx *ctx, grn_obj *table,
break;
}
}
+ GRN_OBJ_FIN(ctx, &weight_vector);
}
return current_res == res;
@@ -5085,7 +5064,10 @@ grn_table_select_index(grn_ctx *ctx, grn_obj *table, scan_info *si,
GRN_BULK_HEAD(si->query),
GRN_BULK_VSIZE(si->query));
}
- grn_ii_at(ctx, (grn_ii *)index, tid, (grn_hash *)res, si->logical_op);
+ if (tid != GRN_ID_NIL) {
+ grn_ii_at(ctx, (grn_ii *)index, tid, (grn_hash *)res,
+ si->logical_op);
+ }
}
grn_ii_resolve_sel_and(ctx, (grn_hash *)res, si->logical_op);
processed = GRN_TRUE;
@@ -5173,9 +5155,11 @@ grn_table_select_index(grn_ctx *ctx, grn_obj *table, scan_info *si,
case GRN_OP_NEAR :
case GRN_OP_NEAR2 :
case GRN_OP_SIMILAR :
+ case GRN_OP_REGEXP :
{
grn_obj wv, **ip = &GRN_PTR_VALUE(&si->index);
- int j = GRN_BULK_VSIZE(&si->index)/sizeof(grn_obj *);
+ int j;
+ int n_indexes = GRN_BULK_VSIZE(&si->index)/sizeof(grn_obj *);
int32_t *wp = &GRN_INT32_VALUE(&si->wv);
grn_search_optarg optarg;
GRN_INT32_INIT(&wv, GRN_OBJ_VECTOR);
@@ -5203,19 +5187,30 @@ grn_table_select_index(grn_ctx *ctx, grn_obj *table, scan_info *si,
optarg.proc = NULL;
optarg.max_size = 0;
ctx->flags |= GRN_CTX_TEMPORARY_DISABLE_II_RESOLVE_SEL_AND;
- for (; j--; ip++, wp += 2) {
+ for (j = 0; j < n_indexes; j++, ip++, wp += 2) {
uint32_t sid = (uint32_t) wp[0];
int32_t weight = wp[1];
if (sid) {
int weight_index = sid - 1;
- GRN_INT32_SET_AT(ctx, &wv, weight_index, weight);
+ int current_vector_size;
+ current_vector_size = GRN_BULK_VSIZE(&wv)/sizeof(int32_t);
+ if (weight_index < current_vector_size) {
+ ((int *)GRN_BULK_HEAD(&wv))[weight_index] = weight;
+ } else {
+ GRN_INT32_SET_AT(ctx, &wv, weight_index, weight);
+ }
optarg.weight_vector = &GRN_INT32_VALUE(&wv);
optarg.vector_size = GRN_BULK_VSIZE(&wv)/sizeof(int32_t);
} else {
optarg.weight_vector = NULL;
optarg.vector_size = weight;
}
- if (j) {
+ optarg.scorer = GRN_PTR_VALUE_AT(&(si->scorers), j);
+ optarg.scorer_args_expr =
+ GRN_PTR_VALUE_AT(&(si->scorer_args_exprs), j);
+ optarg.scorer_args_expr_offset =
+ GRN_UINT32_VALUE_AT(&(si->scorer_args_expr_offsets), j);
+ if (j < n_indexes - 1) {
if (sid && ip[0] == ip[1]) { continue; }
} else {
ctx->flags &= ~GRN_CTX_TEMPORARY_DISABLE_II_RESOLVE_SEL_AND;
@@ -5250,7 +5245,7 @@ grn_table_select_index(grn_ctx *ctx, grn_obj *table, scan_info *si,
}
break;
case GRN_OP_CALL :
- if (selector_proc_p(si->args[0])) {
+ if (grn_obj_is_selector_proc(ctx, si->args[0])) {
grn_rc rc;
grn_proc *proc = (grn_proc *)(si->args[0]);
rc = proc->selector(ctx, table, index, si->nargs, si->args,
@@ -5276,7 +5271,7 @@ grn_table_select_index(grn_ctx *ctx, grn_obj *table, scan_info *si,
} else {
switch (si->op) {
case GRN_OP_CALL :
- if (selector_proc_p(si->args[0])) {
+ if (grn_obj_is_selector_proc(ctx, si->args[0])) {
grn_rc rc;
grn_proc *proc = (grn_proc *)(si->args[0]);
rc = proc->selector(ctx, table, NULL, si->nargs, si->args,
@@ -5361,11 +5356,13 @@ grn_table_select(grn_ctx *ctx, grn_obj *table, grn_obj *expr,
if (ctx->rc) { break; }
e->codes = codes + si->start;
e->codes_curr = si->end - si->start + 1;
- grn_table_select_(ctx, table, expr, v, res, si->logical_op);
+ grn_table_select_sequential(ctx, table, expr, v,
+ res, si->logical_op);
}
}
GRN_QUERY_LOG(ctx, GRN_QUERY_LOG_SIZE,
":", "filter(%d)", grn_table_size(ctx, res));
+ if (ctx->rc) { break; }
}
for (i = 0; i < n; i++) {
scan_info *si = sis[i];
@@ -5377,7 +5374,7 @@ grn_table_select(grn_ctx *ctx, grn_obj *table, grn_obj *expr,
e->codes_curr = codes_curr;
} else {
if (!ctx->rc) {
- grn_table_select_(ctx, table, expr, v, res, op);
+ grn_table_select_sequential(ctx, table, expr, v, res, op);
}
}
}
@@ -5408,7 +5405,7 @@ grn_int32_value_at(grn_obj *obj, int offset)
/* grn_expr_create_from_str */
-#include "snip.h"
+#include "grn_snip.h"
typedef struct {
grn_ctx *ctx;
@@ -5457,239 +5454,6 @@ skip_space(grn_ctx *ctx, efs_info *q)
}
}
-static grn_rc get_expr(grn_ctx *ctx, efs_info *q, grn_obj *column, grn_operator mode);
-static grn_rc get_token(grn_ctx *ctx, efs_info *q, efs_op *op, grn_obj *column, grn_operator mode);
-
-static grn_rc
-get_phrase(grn_ctx *ctx, efs_info *q, grn_obj *column, int mode, int option)
-{
- const char *start, *s;
- start = s = q->cur;
- GRN_BULK_REWIND(&q->buf);
- while (1) {
- unsigned int len;
- if (s >= q->str_end) {
- q->cur = s;
- break;
- }
- len = grn_charlen(ctx, s, q->str_end);
- if (len == 0) {
- /* invalid string containing malformed multibyte char */
- return GRN_END_OF_DATA;
- } else if (len == 1) {
- if (*s == GRN_QUERY_QUOTER) {
- q->cur = s + 1;
- break;
- } else if (*s == GRN_QUERY_ESCAPE && s + 1 < q->str_end) {
- s++;
- len = grn_charlen(ctx, s, q->str_end);
- }
- }
- GRN_TEXT_PUT(ctx, &q->buf, s, len);
- s += len;
- }
- grn_expr_append_obj(ctx, q->e, q->v, GRN_OP_PUSH, 1);
- grn_expr_append_const(ctx, q->e, column, GRN_OP_PUSH, 1);
- grn_expr_append_op(ctx, q->e, GRN_OP_GET_VALUE, 2);
- grn_expr_append_const(ctx, q->e, &q->buf, GRN_OP_PUSH, 1);
- if (mode == GRN_OP_MATCH || mode == GRN_OP_EXACT) {
- grn_expr_append_op(ctx, q->e, mode, 2);
- } else {
- grn_expr_append_const_int(ctx, q->e, option, GRN_OP_PUSH, 1);
- grn_expr_append_op(ctx, q->e, mode, 3);
- }
- return GRN_SUCCESS;
-}
-
-static grn_rc
-get_geocond(grn_ctx *ctx, efs_info *q, grn_obj *longitude, grn_obj *latitude)
-{
- unsigned int len;
- const char *start = q->cur, *end;
- for (end = q->cur;; ) {
- /* null check and length check */
- if (!(len = grn_charlen(ctx, end, q->str_end))) {
- q->cur = q->str_end;
- break;
- }
- if (grn_isspace(end, ctx->encoding) ||
- *end == GRN_QUERY_PARENR) {
- q->cur = end;
- break;
- }
- }
- {
- const char *tokbuf[8];
- int32_t lng0, lat0, lng1, lat1, lng2, lat2, r;
- int32_t n = grn_str_tok((char *)start, end - start, ',', tokbuf, 8, NULL);
- switch (n) {
- case 3 :
- lng0 = grn_atoi(start, tokbuf[0], NULL);
- lat0 = grn_atoi(tokbuf[0] + 1, tokbuf[1], NULL);
- r = grn_atoi(tokbuf[1] + 1, tokbuf[2], NULL);
- grn_expr_append_obj(ctx, q->e, q->v, GRN_OP_PUSH, 1);
- grn_expr_append_const(ctx, q->e, longitude, GRN_OP_PUSH, 1);
- grn_expr_append_op(ctx, q->e, GRN_OP_GET_VALUE, 2);
- grn_expr_append_obj(ctx, q->e, q->v, GRN_OP_PUSH, 1);
- grn_expr_append_const(ctx, q->e, latitude, GRN_OP_PUSH, 1);
- grn_expr_append_op(ctx, q->e, GRN_OP_GET_VALUE, 2);
- grn_expr_append_const_int(ctx, q->e, lng0, GRN_OP_PUSH, 1);
- grn_expr_append_const_int(ctx, q->e, lat0, GRN_OP_PUSH, 1);
- grn_expr_append_const_int(ctx, q->e, r, GRN_OP_PUSH, 1);
- grn_expr_append_op(ctx, q->e, GRN_OP_GEO_WITHINP5, 5);
- break;
- case 4 :
- lng0 = grn_atoi(start, tokbuf[0], NULL);
- lat0 = grn_atoi(tokbuf[0] + 1, tokbuf[1], NULL);
- lng1 = grn_atoi(tokbuf[1] + 1, tokbuf[2], NULL);
- lat1 = grn_atoi(tokbuf[2] + 1, tokbuf[3], NULL);
- grn_expr_append_obj(ctx, q->e, q->v, GRN_OP_PUSH, 1);
- grn_expr_append_const(ctx, q->e, longitude, GRN_OP_PUSH, 1);
- grn_expr_append_op(ctx, q->e, GRN_OP_GET_VALUE, 2);
- grn_expr_append_obj(ctx, q->e, q->v, GRN_OP_PUSH, 1);
- grn_expr_append_const(ctx, q->e, latitude, GRN_OP_PUSH, 1);
- grn_expr_append_op(ctx, q->e, GRN_OP_GET_VALUE, 2);
- grn_expr_append_const_int(ctx, q->e, lng0, GRN_OP_PUSH, 1);
- grn_expr_append_const_int(ctx, q->e, lat0, GRN_OP_PUSH, 1);
- grn_expr_append_const_int(ctx, q->e, lng1, GRN_OP_PUSH, 1);
- grn_expr_append_const_int(ctx, q->e, lat1, GRN_OP_PUSH, 1);
- grn_expr_append_op(ctx, q->e, GRN_OP_GEO_WITHINP6, 6);
- break;
- case 6 :
- lng0 = grn_atoi(start, tokbuf[0], NULL);
- lat0 = grn_atoi(tokbuf[0] + 1, tokbuf[1], NULL);
- lng1 = grn_atoi(tokbuf[1] + 1, tokbuf[2], NULL);
- lat1 = grn_atoi(tokbuf[2] + 1, tokbuf[3], NULL);
- lng2 = grn_atoi(tokbuf[3] + 1, tokbuf[4], NULL);
- lat2 = grn_atoi(tokbuf[4] + 1, tokbuf[5], NULL);
- grn_expr_append_obj(ctx, q->e, q->v, GRN_OP_PUSH, 1);
- grn_expr_append_const(ctx, q->e, longitude, GRN_OP_PUSH, 1);
- grn_expr_append_op(ctx, q->e, GRN_OP_GET_VALUE, 2);
- grn_expr_append_obj(ctx, q->e, q->v, GRN_OP_PUSH, 1);
- grn_expr_append_const(ctx, q->e, latitude, GRN_OP_PUSH, 1);
- grn_expr_append_op(ctx, q->e, GRN_OP_GET_VALUE, 2);
- grn_expr_append_const_int(ctx, q->e, lng0, GRN_OP_PUSH, 1);
- grn_expr_append_const_int(ctx, q->e, lat0, GRN_OP_PUSH, 1);
- grn_expr_append_const_int(ctx, q->e, lng1, GRN_OP_PUSH, 1);
- grn_expr_append_const_int(ctx, q->e, lat1, GRN_OP_PUSH, 1);
- grn_expr_append_const_int(ctx, q->e, lng2, GRN_OP_PUSH, 1);
- grn_expr_append_const_int(ctx, q->e, lat2, GRN_OP_PUSH, 1);
- grn_expr_append_op(ctx, q->e, GRN_OP_GEO_WITHINP8, 8);
- break;
- default :
- ERR(GRN_INVALID_ARGUMENT, "invalid geocond");
- break;
- }
- }
- return ctx->rc;
-}
-
-static grn_rc
-get_word(grn_ctx *ctx, efs_info *q, grn_obj *column, int mode, int option)
-{
- const char *start = q->cur, *end;
- unsigned int len;
- for (end = q->cur;; ) {
- /* null check and length check */
- if (!(len = grn_charlen(ctx, end, q->str_end))) {
- q->cur = q->str_end;
- break;
- }
- if (grn_isspace(end, ctx->encoding) ||
- *end == GRN_QUERY_PARENR) {
- q->cur = end;
- break;
- }
- if (*end == GRN_QUERY_COLUMN) {
- grn_obj *c = grn_obj_column(ctx, q->table, start, end - start);
- if (c && end + 1 < q->str_end) {
- efs_op op;
- switch (end[1]) {
- case '!' :
- mode = GRN_OP_NOT_EQUAL;
- q->cur = end + 2;
- break;
- case '=' :
- if (q->flags & GRN_EXPR_ALLOW_UPDATE) {
- mode = GRN_OP_ASSIGN;
- q->cur = end + 2;
- } else {
- get_token(ctx, q, &op, c, mode);
- }
- break;
- case '<' :
- if (end + 2 < q->str_end && end[2] == '=') {
- mode = GRN_OP_LESS_EQUAL;
- q->cur = end + 3;
- } else {
- mode = GRN_OP_LESS;
- q->cur = end + 2;
- }
- break;
- case '>' :
- if (end + 2 < q->str_end && end[2] == '=') {
- mode = GRN_OP_GREATER_EQUAL;
- q->cur = end + 3;
- } else {
- mode = GRN_OP_GREATER;
- q->cur = end + 2;
- }
- break;
- case '%' :
- mode = GRN_OP_MATCH;
- q->cur = end + 2;
- break;
- case '@' :
- q->cur = end + 2;
- return get_geocond(ctx, q, column, c);
- break;
- default :
- mode = GRN_OP_EQUAL;
- q->cur = end + 1;
- break;
- }
- return get_token(ctx, q, &op, c, mode);
- } else {
- ERR(GRN_INVALID_ARGUMENT, "column lookup failed");
- return ctx->rc;
- }
- } else if (*end == GRN_QUERY_PREFIX) {
- mode = GRN_OP_PREFIX;
- q->cur = end + 1;
- break;
- }
- end += len;
- }
- if (!column) {
- ERR(GRN_INVALID_ARGUMENT, "column missing");
- return ctx->rc;
- }
- if (mode == GRN_OP_ASSIGN) {
- grn_expr_append_obj(ctx, q->e, q->v, GRN_OP_PUSH, 1);
- grn_expr_append_const(ctx, q->e, column, GRN_OP_PUSH, 1);
- grn_expr_append_const_str(ctx, q->e, start, end - start, GRN_OP_PUSH, 1);
- grn_expr_append_op(ctx, q->e, GRN_OP_ASSIGN, 2);
- } else {
- grn_expr_append_obj(ctx, q->e, q->v, GRN_OP_PUSH, 1);
- grn_expr_append_const(ctx, q->e, column, GRN_OP_PUSH, 1);
- grn_expr_append_op(ctx, q->e, GRN_OP_GET_VALUE, 2);
- grn_expr_append_const_str(ctx, q->e, start, end - start, GRN_OP_PUSH, 1);
- switch (mode) {
- case GRN_OP_NEAR :
- case GRN_OP_NEAR2 :
- case GRN_OP_SIMILAR :
- case GRN_OP_TERM_EXTRACT :
- grn_expr_append_const_int(ctx, q->e, option, GRN_OP_PUSH, 1);
- grn_expr_append_op(ctx, q->e, mode, 3);
- break;
- default :
- grn_expr_append_op(ctx, q->e, mode, 2);
- break;
- }
- }
- return GRN_SUCCESS;
-}
-
static grn_bool
get_op(efs_info *q, efs_op *op, grn_operator *mode, int *option)
{
@@ -5738,90 +5502,6 @@ get_op(efs_info *q, efs_op *op, grn_operator *mode, int *option)
return found;
}
-static grn_rc
-get_token(grn_ctx *ctx, efs_info *q, efs_op *op, grn_obj *column, grn_operator mode)
-{
- int option = 0;
- op->op = q->default_op;
- op->weight = DEFAULT_WEIGHT;
- for (;;) {
- skip_space(ctx, q);
- if (q->cur >= q->str_end) { return GRN_END_OF_DATA; }
- switch (*q->cur) {
- case '\0' :
- return GRN_END_OF_DATA;
- break;
- case GRN_QUERY_PARENR :
- q->cur++;
- return GRN_END_OF_DATA;
- break;
- case GRN_QUERY_QUOTEL :
- q->cur++;
- return get_phrase(ctx, q, column, mode, option);
- break;
- case GRN_QUERY_PREFIX :
- q->cur++;
- get_op(q, op, &mode, &option);
- break;
- case GRN_QUERY_AND :
- q->cur++;
- op->op = GRN_OP_AND;
- break;
- case GRN_QUERY_AND_NOT :
- q->cur++;
- op->op = GRN_OP_AND_NOT;
- break;
- case GRN_QUERY_ADJ_INC :
- q->cur++;
- if (op->weight < 127) { op->weight++; }
- op->op = GRN_OP_ADJUST;
- break;
- case GRN_QUERY_ADJ_DEC :
- q->cur++;
- if (op->weight > -128) { op->weight--; }
- op->op = GRN_OP_ADJUST;
- break;
- case GRN_QUERY_ADJ_NEG :
- q->cur++;
- op->op = GRN_OP_ADJUST;
- op->weight = -1;
- break;
- case GRN_QUERY_PARENL :
- q->cur++;
- return get_expr(ctx, q, column, mode);
- break;
- case 'O' :
- if (q->cur[1] == 'R' && q->cur[2] == ' ') {
- q->cur += 2;
- op->op = GRN_OP_OR;
- break;
- }
- /* fallthru */
- default :
- return get_word(ctx, q, column, mode, option);
- break;
- }
- }
- return GRN_SUCCESS;
-}
-
-static grn_rc
-get_expr(grn_ctx *ctx, efs_info *q, grn_obj *column, grn_operator mode)
-{
- efs_op op;
- grn_rc rc = get_token(ctx, q, &op, column, mode);
- if (rc) { return rc; }
- while (!(rc = get_token(ctx, q, &op, column, mode))) {
- if (op.op == GRN_OP_ADJUST) {
- grn_expr_append_const_int(ctx, q->e, op.weight, GRN_OP_PUSH, 1);
- grn_expr_append_op(ctx, q->e, op.op, 3);
- } else {
- grn_expr_append_op(ctx, q->e, op.op, 2);
- }
- }
- return rc;
-}
-
#define DISABLE_UNUSED_CODE 1
#ifndef DISABLE_UNUSED_CODE
static const char *
@@ -5936,8 +5616,8 @@ section_weight_cb(grn_ctx *ctx, grn_hash *r, const void *rid, int sid, void *arg
}
#endif
-#include "ecmascript.h"
-#include "ecmascript.c"
+#include "grn_ecmascript.h"
+#include "grn_ecmascript.c"
static grn_rc
grn_expr_parser_open(grn_ctx *ctx)
@@ -6072,6 +5752,10 @@ get_word_(grn_ctx *ctx, efs_info *q)
mode = GRN_OP_SUFFIX;
q->cur = end + 2;
break;
+ case '~' :
+ mode = GRN_OP_REGEXP;
+ q->cur = end + 2;
+ break;
default :
mode = GRN_OP_EQUAL;
q->cur = end + 1;
@@ -6090,7 +5774,7 @@ get_word_(grn_ctx *ctx, efs_info *q)
GRN_INT32_PUT(ctx, &q->mode_stack, mode);
return GRN_SUCCESS;
- } else if (GRN_TEXT_LEN(&q->buf) > 1 && *end == GRN_QUERY_PREFIX) {
+ } else if (GRN_TEXT_LEN(&q->buf) > 0 && *end == GRN_QUERY_PREFIX) {
q->cur = end + 1;
GRN_INT32_PUT(ctx, &q->mode_stack, GRN_OP_PREFIX);
break;
@@ -6484,6 +6168,10 @@ parse_script(grn_ctx *ctx, efs_info *q)
PARSE(GRN_EXPR_TOKEN_SUFFIX);
q->cur += 2;
break;
+ case '~' :
+ PARSE(GRN_EXPR_TOKEN_REGEXP);
+ q->cur += 2;
+ break;
default :
PARSE(GRN_EXPR_TOKEN_MATCH);
q->cur++;
@@ -6912,7 +6600,7 @@ grn_expr_parse(grn_ctx *ctx, grn_obj *expr,
/*
grn_obj strbuf;
GRN_TEXT_INIT(&strbuf, 0);
- grn_expr_inspect(ctx, &strbuf, expr);
+ grn_expr_inspect_internal(ctx, &strbuf, expr);
GRN_TEXT_PUTC(ctx, &strbuf, '\0');
GRN_LOG(ctx, GRN_LOG_NOTICE, "query=(%s)", GRN_TEXT_VALUE(&strbuf));
GRN_OBJ_FIN(ctx, &strbuf);
@@ -7156,3 +6844,63 @@ grn_expr_syntax_escape_query(grn_ctx *ctx, const char *query, int query_size,
target_characters, GRN_QUERY_ESCAPE,
escaped_query);
}
+
+grn_rc
+grn_expr_dump_plan(grn_ctx *ctx, grn_obj *expr, grn_obj *buffer)
+{
+ int n;
+ scan_info **sis;
+
+ GRN_API_ENTER;
+ sis = scan_info_build(ctx, expr, &n, GRN_OP_OR, 0);
+ if (sis) {
+ int i;
+ grn_inspect_scan_info_list(ctx, buffer, sis, n);
+ for (i = 0; i < n; i++) {
+ SI_FREE(sis[i]);
+ }
+ GRN_FREE(sis);
+ } else {
+ GRN_TEXT_PUTS(ctx, buffer, "sequential search\n");
+ }
+ GRN_API_RETURN(GRN_SUCCESS);
+}
+
+static unsigned int
+grn_expr_estimate_size_raw(grn_ctx *ctx, grn_obj *expr, grn_obj *table)
+{
+ return grn_table_size(ctx, table);
+}
+
+unsigned int
+grn_expr_estimate_size(grn_ctx *ctx, grn_obj *expr)
+{
+ grn_obj *table;
+ grn_obj *variable;
+ unsigned int size;
+
+ variable = grn_expr_get_var_by_offset(ctx, expr, 0);
+ if (!variable) {
+ ERR(GRN_INVALID_ARGUMENT, "at least one variable must be defined");
+ return 0;
+ }
+
+ table = grn_ctx_at(ctx, variable->header.domain);
+ if (!table) {
+ ERR(GRN_INVALID_ARGUMENT,
+ "variable refers unknown domain: <%u>", variable->header.domain);
+ return 0;
+ }
+
+ GRN_API_ENTER;
+#ifdef GRN_WITH_MRUBY
+ if (ctx->impl->mrb.state) {
+ size = grn_mrb_expr_estimate_size(ctx, expr, table);
+ } else {
+ size = grn_expr_estimate_size_raw(ctx, expr, table);
+ }
+#else
+ size = grn_expr_estimate_size_raw(ctx, expr, table);
+#endif
+ GRN_API_RETURN(size);
+}
diff --git a/storage/mroonga/vendor/groonga/lib/geo.c b/storage/mroonga/vendor/groonga/lib/geo.c
index 1bb621487a8..d2eb049ce21 100644
--- a/storage/mroonga/vendor/groonga/lib/geo.c
+++ b/storage/mroonga/vendor/groonga/lib/geo.c
@@ -15,9 +15,9 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "geo.h"
-#include "pat.h"
-#include "util.h"
+#include "grn_geo.h"
+#include "grn_pat.h"
+#include "grn_util.h"
#include <string.h>
#include <stdlib.h>
@@ -91,18 +91,18 @@ compute_min_and_max_key(uint8_t *key_base, int diff_bit,
diff_bit_mask = 0xff >> (diff_bit % 8);
if (diff_byte == sizeof(grn_geo_point)) {
- if (key_min) { memcpy(key_min, key_base, diff_byte); }
- if (key_max) { memcpy(key_max, key_base, diff_byte); }
+ if (key_min) { grn_memcpy(key_min, key_base, diff_byte); }
+ if (key_max) { grn_memcpy(key_max, key_base, diff_byte); }
} else {
if (key_min) {
- memcpy(key_min, key_base, diff_byte + 1);
+ grn_memcpy(key_min, key_base, diff_byte + 1);
key_min[diff_byte] &= ~diff_bit_mask;
memset(key_min + diff_byte + 1, 0,
sizeof(grn_geo_point) - diff_byte - 1);
}
if (key_max) {
- memcpy(key_max, key_base, diff_byte + 1);
+ grn_memcpy(key_max, key_base, diff_byte + 1);
key_max[diff_byte] |= diff_bit_mask;
memset(key_max + diff_byte + 1, 0xff,
sizeof(grn_geo_point) - diff_byte - 1);
@@ -274,7 +274,7 @@ grn_geo_table_sort_detect_far_point(grn_ctx *ctx, grn_obj *table, grn_obj *index
grn_gton(geo_key_curr, base_point, sizeof(grn_geo_point));
*diff_bit = sizeof(grn_geo_point) * 8;
diff_bit_current = sizeof(grn_geo_point) * 8;
- memcpy(&point, base_point, sizeof(grn_geo_point));
+ grn_memcpy(&point, base_point, sizeof(grn_geo_point));
ep = entries;
inspect_mesh(ctx, &point, *diff_bit, -1);
while ((tid = grn_pat_cursor_next(ctx, pc))) {
@@ -862,7 +862,7 @@ grn_geo_select_in_circle(grn_ctx *ctx, grn_obj *index,
name_size = grn_obj_name(ctx, domain_object, name, GRN_TABLE_MAX_KEY_SIZE);
grn_obj_unlink(ctx, domain_object);
} else {
- strcpy(name, "(null)");
+ grn_strcpy(name, GRN_TABLE_MAX_KEY_SIZE, "(null)");
name_size = strlen(name);
}
ERR(GRN_INVALID_ARGUMENT,
@@ -1034,7 +1034,7 @@ in_rectangle_data_fill(grn_ctx *ctx, grn_obj *index,
name_size = grn_obj_name(ctx, domain_object, name, GRN_TABLE_MAX_KEY_SIZE);
grn_obj_unlink(ctx, domain_object);
} else {
- strcpy(name, "(null)");
+ grn_strcpy(name, GRN_TABLE_MAX_KEY_SIZE, "(null)");
name_size = strlen(name);
}
ERR(GRN_INVALID_ARGUMENT,
@@ -1419,8 +1419,8 @@ grn_geo_cursor_area_init(grn_ctx *ctx,
}
area->current_entry = 0;
- memcpy(&(area->top_left), &area_top_left, sizeof(grn_geo_point));
- memcpy(&(area->bottom_right), &area_bottom_right, sizeof(grn_geo_point));
+ grn_memcpy(&(area->top_left), &area_top_left, sizeof(grn_geo_point));
+ grn_memcpy(&(area->bottom_right), &area_bottom_right, sizeof(grn_geo_point));
grn_gton(area->top_left_key, &area_top_left, sizeof(grn_geo_point));
grn_gton(area->bottom_right_key, &area_bottom_right, sizeof(grn_geo_point));
@@ -1430,7 +1430,7 @@ grn_geo_cursor_area_init(grn_ctx *ctx,
&area_bottom_right,
&data);
entry->target_bit = data.rectangle_common_bit;
- memcpy(entry->key, data.rectangle_common_key, sizeof(grn_geo_point));
+ grn_memcpy(entry->key, data.rectangle_common_key, sizeof(grn_geo_point));
entry->status_flags =
GRN_GEO_CURSOR_ENTRY_STATUS_TOP_INCLUDED |
GRN_GEO_CURSOR_ENTRY_STATUS_BOTTOM_INCLUDED |
@@ -1474,8 +1474,8 @@ grn_geo_cursor_open_in_rectangle(grn_ctx *ctx,
cursor->pat = data.pat;
cursor->index = index;
- memcpy(&(cursor->top_left), data.top_left, sizeof(grn_geo_point));
- memcpy(&(cursor->bottom_right), data.bottom_right, sizeof(grn_geo_point));
+ grn_memcpy(&(cursor->top_left), data.top_left, sizeof(grn_geo_point));
+ grn_memcpy(&(cursor->bottom_right), data.bottom_right, sizeof(grn_geo_point));
cursor->pat_cursor = NULL;
cursor->ii_cursor = NULL;
cursor->offset = offset;
@@ -1494,10 +1494,12 @@ grn_geo_cursor_open_in_rectangle(grn_ctx *ctx,
}
}
{
- const char *minimum_reduce_bit_env;
+ char minimum_reduce_bit_env[GRN_ENV_BUFFER_SIZE];
cursor->minimum_reduce_bit = 0;
- minimum_reduce_bit_env = getenv("GRN_GEO_IN_RECTANGLE_MINIMUM_REDUCE_BIT");
- if (minimum_reduce_bit_env) {
+ grn_getenv("GRN_GEO_IN_RECTANGLE_MINIMUM_REDUCE_BIT",
+ minimum_reduce_bit_env,
+ GRN_ENV_BUFFER_SIZE);
+ if (minimum_reduce_bit_env[0]) {
cursor->minimum_reduce_bit = atoi(minimum_reduce_bit_env);
}
if (cursor->minimum_reduce_bit < 1) {
@@ -1544,7 +1546,7 @@ grn_geo_cursor_entry_next_push(grn_ctx *ctx,
grn_geo_cursor_area *area;
area = &(cursor->areas[cursor->current_area]);
next_entry = &(area->entries[++area->current_entry]);
- memcpy(next_entry, entry, sizeof(grn_geo_cursor_entry));
+ grn_memcpy(next_entry, entry, sizeof(grn_geo_cursor_entry));
pushed = GRN_TRUE;
}
grn_table_cursor_close(ctx, pat_cursor);
@@ -1578,9 +1580,9 @@ grn_geo_cursor_entry_next(grn_ctx *ctx,
top_left_key = area->top_left_key;
bottom_right_key = area->bottom_right_key;
- memcpy(entry,
- &(area->entries[area->current_entry--]),
- sizeof(grn_geo_cursor_entry));
+ grn_memcpy(entry,
+ &(area->entries[area->current_entry--]),
+ sizeof(grn_geo_cursor_entry));
while (GRN_TRUE) {
grn_geo_cursor_entry next_entry0, next_entry1;
grn_bool pushed = GRN_FALSE;
@@ -1663,9 +1665,9 @@ grn_geo_cursor_entry_next(grn_ctx *ctx,
break;
}
- memcpy(&next_entry0, entry, sizeof(grn_geo_cursor_entry));
+ grn_memcpy(&next_entry0, entry, sizeof(grn_geo_cursor_entry));
next_entry0.target_bit++;
- memcpy(&next_entry1, entry, sizeof(grn_geo_cursor_entry));
+ grn_memcpy(&next_entry1, entry, sizeof(grn_geo_cursor_entry));
next_entry1.target_bit++;
SET_N_BIT(next_entry1.key, next_entry1.target_bit);
@@ -1767,9 +1769,9 @@ grn_geo_cursor_entry_next(grn_ctx *ctx,
print_key_mark(ctx, stack_entry->target_bit);
}
#endif
- memcpy(entry,
- &(area->entries[area->current_entry--]),
- sizeof(grn_geo_cursor_entry));
+ grn_memcpy(entry,
+ &(area->entries[area->current_entry--]),
+ sizeof(grn_geo_cursor_entry));
#ifdef GEO_DEBUG
printf("%d: pop entry\n", entry->target_bit);
#endif
@@ -1979,7 +1981,7 @@ geo_point_get(grn_ctx *ctx, grn_obj *pat, int flags, grn_geo_point *geo_point)
void *key;
int key_size;
key_size = grn_table_cursor_get_key(ctx, cursor, &key);
- memcpy(geo_point, key, key_size);
+ grn_memcpy(geo_point, key, key_size);
}
exit:
@@ -1989,13 +1991,13 @@ exit:
return rc;
}
-int
-grn_geo_estimate_in_rectangle(grn_ctx *ctx,
- grn_obj *index,
- grn_obj *top_left_point,
- grn_obj *bottom_right_point)
+uint32_t
+grn_geo_estimate_size_in_rectangle(grn_ctx *ctx,
+ grn_obj *index,
+ grn_obj *top_left_point,
+ grn_obj *bottom_right_point)
{
- int n = 0;
+ uint32_t n = 0;
int total_records;
grn_rc rc;
in_rectangle_data data;
@@ -2004,7 +2006,6 @@ grn_geo_estimate_in_rectangle(grn_ctx *ctx,
GRN_VOID_INIT(&(data.bottom_right_point_buffer));
if (in_rectangle_data_prepare(ctx, index, top_left_point, bottom_right_point,
"grn_geo_estimate_in_rectangle()", &data)) {
- n = -1;
goto exit;
}
@@ -2025,8 +2026,6 @@ grn_geo_estimate_in_rectangle(grn_ctx *ctx,
if (rc == GRN_END_OF_DATA) {
n = total_records;
rc = GRN_SUCCESS;
- } else {
- n = -1;
}
goto exit;
}
@@ -2052,7 +2051,7 @@ grn_geo_estimate_in_rectangle(grn_ctx *ctx,
(double)total_longitude_distance);
}
estimated_n_records = ceil(total_records * select_ratio);
- n = (int)estimated_n_records;
+ n = (uint32_t)estimated_n_records;
}
exit :
@@ -2061,6 +2060,25 @@ exit :
return n;
}
+int
+grn_geo_estimate_in_rectangle(grn_ctx *ctx,
+ grn_obj *index,
+ grn_obj *top_left_point,
+ grn_obj *bottom_right_point)
+{
+ uint32_t size;
+
+ size = grn_geo_estimate_size_in_rectangle(ctx,
+ index,
+ top_left_point,
+ bottom_right_point);
+ if (ctx->rc != GRN_SUCCESS) {
+ return -1;
+ }
+
+ return size;
+}
+
grn_bool
grn_geo_in_circle(grn_ctx *ctx, grn_obj *point, grn_obj *center,
grn_obj *radius_or_point,
diff --git a/storage/mroonga/vendor/groonga/lib/groonga_in.h b/storage/mroonga/vendor/groonga/lib/grn.h
index d7ecff2808b..f4ee6e962a9 100644
--- a/storage/mroonga/vendor/groonga/lib/groonga_in.h
+++ b/storage/mroonga/vendor/groonga/lib/grn.h
@@ -1,5 +1,5 @@
/* -*- c-basic-offset: 2 -*- */
-/* Copyright(C) 2009-2012 Brazil
+/* Copyright(C) 2009-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,161 +16,144 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef GROONGA_IN_H
-#define GROONGA_IN_H
+#ifndef GRN_H
+#define GRN_H
#ifdef HAVE_CONFIG_H
-#include <config.h>
+# include <config.h>
#endif /* HAVE_CONFIG_H */
+#if defined(WIN32) && defined(__GNUC__)
+# define __MINGW_MSVC_COMPAT_WARNINGS
+#endif /* defined(WIN32) && defined(__GNUC__) */
+
#ifdef __cplusplus
-#define __STDC_LIMIT_MACROS
+# define __STDC_LIMIT_MACROS
#endif
#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
+# include <stdlib.h>
#endif /* HAVE_STDLIB_H */
#ifdef HAVE_STDINT_H
-#include <stdint.h>
+# include <stdint.h>
#endif /* HAVE_STDINT_H */
#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
+# include <sys/types.h>
#endif /* HAVE_SYS_TYPES_H */
#ifdef HAVE_SYS_PARAM_H
-#include <sys/param.h>
+# include <sys/param.h>
#endif /* HAVE_SYS_PARAM_H */
#ifdef HAVE_SYS_MMAN_H
-#include <sys/mman.h>
+# include <sys/mman.h>
#endif /* HAVE_SYS_MMAN_H */
#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
+# include <sys/time.h>
#endif /* HAVE_SYS_TIME_H */
#ifdef HAVE_SYS_RESOURCE_H
-#include <sys/resource.h>
+# include <sys/resource.h>
#endif /* HAVE_SYS_RESOURCE_H */
#ifdef WIN32
-# define GRN_API __declspec(dllexport)
+# define GRN_API __declspec(dllexport)
#ifdef GROONGA_MAIN
-# define GRN_VAR __declspec(dllimport)
+# define GRN_VAR __declspec(dllimport)
#else
-# define GRN_VAR __declspec(dllexport) extern
+# define GRN_VAR __declspec(dllexport) extern
#endif /* GROONGA_MAIN */
#else
-# define GRN_API
-# define GRN_VAR extern
+# define GRN_API
+# define GRN_VAR extern
#endif
-#ifdef HAVE_OPEN
-# define GRN_OPEN(pathname, ...) open(pathname, __VA_ARGS__)
-#else
-# define GRN_OPEN(pathname, ...) _open(pathname, __VA_ARGS__)
-#endif /* HAVE_OPEN */
-
-#ifdef HAVE_CLOSE
-# define GRN_CLOSE(fd) close(fd)
-#else
-# define GRN_CLOSE(fd) _close(fd)
-#endif /* HAVE_CLOSE */
-
-#ifdef HAVE_READ
-# define GRN_READ(fd, buf, count) read(fd, buf, count)
-#else
-# define GRN_READ(fd, buf, count) _read(fd, buf, count)
-#endif /* HAVE_READ */
-
-#ifdef HAVE_WRITE
-# define GRN_WRITE(fd, buf, count) write(fd, buf, count)
-#else
-# define GRN_WRITE(fd, buf, count) _write(fd, buf, count)
-#endif /* HAVE_WRITE */
-
#ifdef WIN32
-#if defined(__GNUC__) && !defined(WINVER)
+# if defined(__GNUC__) && !defined(WINVER)
# include <w32api.h>
# define WINVER WindowsXP
-#endif /* defined(__GNUC__) && !defined(WINVER) */
-
-#include <basetsd.h>
-#include <process.h>
-#include <winsock2.h>
-#include <ws2tcpip.h>
-#include <windows.h>
-#include <stddef.h>
-#include <windef.h>
-#include <float.h>
-#include <time.h>
-#include <sys/types.h>
-
-#ifndef __GNUC__
-# define PATH_MAX (MAX_PATH - 1)
-# ifndef __cplusplus
-# define inline _inline
+# endif /* defined(__GNUC__) && !defined(WINVER) */
+
+# include <basetsd.h>
+# include <process.h>
+# include <winsock2.h>
+# include <ws2tcpip.h>
+# include <windows.h>
+# include <stddef.h>
+# include <windef.h>
+# include <float.h>
+# include <time.h>
+# include <sys/types.h>
+
+# ifndef __GNUC__
+# define PATH_MAX (MAX_PATH - 1)
+# ifndef __cplusplus
+# define inline _inline
+# endif
# endif
-#endif
-
-#ifndef __GNUC__
-# define snprintf(str, size, ...) _snprintf(str, size, __VA_ARGS__)
-#endif /* __GNUC__ */
-#if !defined(__GNUC__) && _MSC_VER < 1500
-# define vsnprintf(str, size, format, ap) _vsnprintf(str, size, format, ap)
-#endif /* !defined(__GNUC__) && _MSC_VER < 1500 */
-#define unlink(pathname) _unlink(pathname)
-#define lseek(fd, offset, whence) _lseek(fd, offset, whence)
-#define getpid() _getpid()
-#if !defined(__GNUC__) && _MSC_VER < 1400
-# define fstat(fd, buf) _fstat(fd, buf)
-#endif /* !defined(__GNUC__) && _MSC_VER < 1400 */
-#if !defined(strcasecmp)
-# define strcasecmp(s1, s2) _stricmp(s1, s2)
-#endif /* !defined(strcasecmp) */
-#ifdef __GNUC__
-#include <stdint.h>
-#else
-#define uint8_t UINT8
-#define int8_t INT8
-#define int_least8_t INT8
-#define uint_least8_t UINT8
-#define int16_t INT16
-#define uint16_t UINT16
-#define int32_t INT32
-#define uint32_t UINT32
-#define int64_t INT64
-#define uint64_t UINT64
-#define ssize_t SSIZE_T
-#define pid_t int
-#endif
+# if !defined(__GNUC__) && _MSC_VER < 1500
+# define vsnprintf(str, size, format, ap) _vsnprintf(str, size, format, ap)
+# endif /* !defined(__GNUC__) && _MSC_VER < 1500 */
+# define getpid() _getpid()
+# if !defined(__GNUC__) && _MSC_VER < 1400
+# define fstat(fd, buf) _fstat(fd, buf)
+# endif /* !defined(__GNUC__) && _MSC_VER < 1400 */
+# ifdef HAVE__STRICMP
+# ifdef strcasecmp
+# undef strcasecmp
+# endif /* strcasecmp */
+# define strcasecmp(s1, s2) _stricmp(s1, s2)
+# endif /* defined(HAVE__STRICMP) */
+
+# ifdef __GNUC__
+# include <stdint.h>
+# else
+typedef UINT8 uint8_t;
+typedef INT8 int8_t;
+typedef INT8 int_least8_t;
+typedef UINT8 uint_least8_t;
+typedef INT16 int16_t;
+typedef UINT16 uint16_t;
+typedef INT32 int32_t;
+typedef UINT32 uint32_t;
+typedef INT64 int64_t;
+typedef UINT64 uint64_t;
+typedef SSIZE_T ssize_t;
+typedef int pid_t;
+typedef int64_t off64_t;
+# endif
-#undef MSG_WAITALL
-#define MSG_WAITALL 0 /* before Vista, not supported... */
-#define SHUT_RDWR SD_BOTH
+# undef MSG_WAITALL
+# define MSG_WAITALL 0 /* before Vista, not supported... */
+# define SHUT_RDWR SD_BOTH
typedef SOCKET grn_sock;
-#define grn_sock_close(sock) closesocket(sock)
+# define grn_sock_close(sock) closesocket(sock)
-#define CALLBACK __stdcall
+# define CALLBACK __stdcall
-#ifndef __GNUC__
-#include <intrin.h>
-#include <sys/timeb.h>
-#include <errno.h>
-#endif
+# ifndef __GNUC__
+# include <intrin.h>
+# include <sys/timeb.h>
+# include <errno.h>
+# endif
#else /* WIN32 */
-#define GROONGA_API
+# define GROONGA_API
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif /* HAVE_UNISTD_H */
+# ifdef HAVE_UNISTD_H
+# include <unistd.h>
+# endif /* HAVE_UNISTD_H */
+
+# ifndef __off64_t_defined
+typedef off_t off64_t;
+# endif
# ifndef PATH_MAX
# if defined(MAXPATHLEN)
@@ -192,90 +175,100 @@ typedef int grn_sock;
#endif /* WIN32 */
#ifndef INT8_MAX
-#define INT8_MAX (127)
+# define INT8_MAX (127)
#endif /* INT8_MAX */
#ifndef INT8_MIN
-#define INT8_MIN (-128)
+# define INT8_MIN (-128)
#endif /* INT8_MIN */
#ifndef INT16_MAX
-#define INT16_MAX (32767)
+# define INT16_MAX (32767)
#endif /* INT16_MAX */
#ifndef INT16_MIN
-#define INT16_MIN (-32768)
+# define INT16_MIN (-32768)
#endif /* INT16_MIN */
#ifndef INT32_MAX
-#define INT32_MAX (2147483647)
+# define INT32_MAX (2147483647)
#endif /* INT32_MAX */
#ifndef INT32_MIN
-#define INT32_MIN (-2147483648)
+# define INT32_MIN (-2147483648)
#endif /* INT32_MIN */
#ifndef UINT32_MAX
-#define UINT32_MAX (4294967295)
+# define UINT32_MAX (4294967295)
#endif /* UINT32_MAX */
#ifndef INT64_MAX
-#define INT64_MAX (9223372036854775807)
+# define INT64_MAX (9223372036854775807)
#endif /* INT64_MAX */
#ifndef INT64_MIN
-#define INT64_MIN (-9223372036854775808)
+# define INT64_MIN (-9223372036854775808)
#endif /* INT64_MIN */
+
+#ifdef WIN32
+# define grn_lseek(fd, offset, whence) _lseeki64(fd, offset, whence)
+#else /* WIN32 */
+# define grn_lseek(fd, offset, whence) lseek(fd, offset, whence)
+#endif /* WIN32 */
+
+
#ifdef HAVE_PTHREAD_H
-#include <pthread.h>
+# include <pthread.h>
typedef pthread_t grn_thread;
-#define THREAD_CREATE(thread,func,arg) \
+typedef void * grn_thread_func_result;
+# define GRN_THREAD_FUNC_RETURN_VALUE NULL
+# define THREAD_CREATE(thread,func,arg) \
(pthread_create(&(thread), NULL, (func), (arg)))
-#define THREAD_JOIN(thread) (pthread_join(thread, NULL))
+# define THREAD_JOIN(thread) (pthread_join(thread, NULL))
typedef pthread_mutex_t grn_mutex;
-#define MUTEX_INIT(m) pthread_mutex_init(&m, NULL)
-#define MUTEX_LOCK(m) pthread_mutex_lock(&m)
-#define MUTEX_UNLOCK(m) pthread_mutex_unlock(&m)
-#define MUTEX_FIN(m)
-#ifdef HAVE_PTHREAD_MUTEXATTR_SETPSHARED
-# define MUTEX_INIT_SHARED(m) do {\
+# define MUTEX_INIT(m) pthread_mutex_init(&m, NULL)
+# define MUTEX_LOCK(m) pthread_mutex_lock(&m)
+# define MUTEX_UNLOCK(m) pthread_mutex_unlock(&m)
+# define MUTEX_FIN(m)
+# ifdef HAVE_PTHREAD_MUTEXATTR_SETPSHARED
+# define MUTEX_INIT_SHARED(m) do {\
pthread_mutexattr_t mutexattr;\
pthread_mutexattr_init(&mutexattr);\
pthread_mutexattr_setpshared(&mutexattr, PTHREAD_PROCESS_SHARED);\
pthread_mutex_init(&m, &mutexattr);\
} while (0)
-#else
-# define MUTEX_INIT_SHARED MUTEX_INIT
-#endif /* HAVE_PTHREAD_MUTEXATTR_SETPSHARED */
+# else
+# define MUTEX_INIT_SHARED MUTEX_INIT
+# endif /* HAVE_PTHREAD_MUTEXATTR_SETPSHARED */
typedef pthread_mutex_t grn_critical_section;
-#define CRITICAL_SECTION_INIT(cs) pthread_mutex_init(&(cs), NULL)
-#define CRITICAL_SECTION_ENTER(cs) pthread_mutex_lock(&(cs))
-#define CRITICAL_SECTION_LEAVE(cs) pthread_mutex_unlock(&(cs))
-#define CRITICAL_SECTION_FIN(cs)
+# define CRITICAL_SECTION_INIT(cs) pthread_mutex_init(&(cs), NULL)
+# define CRITICAL_SECTION_ENTER(cs) pthread_mutex_lock(&(cs))
+# define CRITICAL_SECTION_LEAVE(cs) pthread_mutex_unlock(&(cs))
+# define CRITICAL_SECTION_FIN(cs)
typedef pthread_cond_t grn_cond;
-#define COND_INIT(c) pthread_cond_init(&c, NULL)
-#define COND_SIGNAL(c) pthread_cond_signal(&c)
-#define COND_WAIT(c,m) pthread_cond_wait(&c, &m)
-#define COND_BROADCAST(c) pthread_cond_broadcast(&c)
-#ifdef HAVE_PTHREAD_CONDATTR_SETPSHARED
-# define COND_INIT_SHARED(c) do {\
+# define COND_INIT(c) pthread_cond_init(&c, NULL)
+# define COND_SIGNAL(c) pthread_cond_signal(&c)
+# define COND_WAIT(c,m) pthread_cond_wait(&c, &m)
+# define COND_BROADCAST(c) pthread_cond_broadcast(&c)
+# ifdef HAVE_PTHREAD_CONDATTR_SETPSHARED
+# define COND_INIT_SHARED(c) do {\
pthread_condattr_t condattr;\
pthread_condattr_init(&condattr);\
pthread_condattr_setpshared(&condattr, PTHREAD_PROCESS_SHARED);\
pthread_cond_init(&c, &condattr);\
} while (0)
-#else
-# define COND_INIT_SHARED COND_INIT
-#endif /* HAVE_PTHREAD_CONDATTR_SETPSHARE */
+# else
+# define COND_INIT_SHARED COND_INIT
+# endif /* HAVE_PTHREAD_CONDATTR_SETPSHARE */
typedef pthread_key_t grn_thread_key;
-#define THREAD_KEY_CREATE(key, destr) pthread_key_create(key, destr)
-#define THREAD_KEY_DELETE(key) pthread_key_delete(key)
-#define THREAD_SETSPECIFIC(key, value) pthread_setspecific(key, value)
-#define THREAD_GETSPECIFIC(key) pthread_getspecific(key)
+# define THREAD_KEY_CREATE(key, destr) pthread_key_create(key, destr)
+# define THREAD_KEY_DELETE(key) pthread_key_delete(key)
+# define THREAD_SETSPECIFIC(key, value) pthread_setspecific(key, value)
+# define THREAD_GETSPECIFIC(key) pthread_getspecific(key)
#if USE_UYIELD
extern int grn_uyield_count;
@@ -305,35 +298,37 @@ typedef pthread_key_t grn_thread_key;
#if !defined(_POSIX_PRIORITY_SCHEDULING)
#define sched_yield() grn_nanosleep(1000000 * 20)
#endif
-#else /* USE_UYIELD */
+# else /* USE_UYIELD */
#define GRN_TEST_YIELD() do {} while (0)
-#endif /* USE_UYIELD */
+# endif /* USE_UYIELD */
#else /* HAVE_PTHREAD_H */
/* todo */
typedef int grn_thread_key;
-#define THREAD_KEY_CREATE(key,destr)
-#define THREAD_KEY_DELETE(key)
-#define THREAD_SETSPECIFIC(key)
-#define THREAD_GETSPECIFIC(key,value)
+# define THREAD_KEY_CREATE(key,destr)
+# define THREAD_KEY_DELETE(key)
+# define THREAD_SETSPECIFIC(key)
+# define THREAD_GETSPECIFIC(key,value)
-#ifdef WIN32
+# ifdef WIN32
typedef uintptr_t grn_thread;
-#define THREAD_CREATE(thread,func,arg) \
- (((thread)=_beginthreadex(NULL, 0, (func), (arg), 0, NULL)) == NULL)
-#define THREAD_JOIN(thread) \
- (WaitForSingleObject((thread), INFINITE) == WAIT_FAILED)
+typedef unsigned int grn_thread_func_result;
+# define GRN_THREAD_FUNC_RETURN_VALUE 0
+# define THREAD_CREATE(thread,func,arg) \
+ (((thread)=_beginthreadex(NULL, 0, (func), (arg), 0, NULL)) == (grn_thread)0)
+# define THREAD_JOIN(thread) \
+ (WaitForSingleObject((HANDLE)(thread), INFINITE) == WAIT_FAILED)
typedef HANDLE grn_mutex;
-#define MUTEX_INIT(m) ((m) = CreateMutex(0, FALSE, NULL))
-#define MUTEX_LOCK(m) WaitForSingleObject((m), INFINITE)
-#define MUTEX_UNLOCK(m) ReleaseMutex(m)
-#define MUTEX_FIN(m) CloseHandle(m)
+# define MUTEX_INIT(m) ((m) = CreateMutex(0, FALSE, NULL))
+# define MUTEX_LOCK(m) WaitForSingleObject((m), INFINITE)
+# define MUTEX_UNLOCK(m) ReleaseMutex(m)
+# define MUTEX_FIN(m) CloseHandle(m)
typedef CRITICAL_SECTION grn_critical_section;
-#define CRITICAL_SECTION_INIT(cs) InitializeCriticalSection(&(cs))
-#define CRITICAL_SECTION_ENTER(cs) EnterCriticalSection(&(cs))
-#define CRITICAL_SECTION_LEAVE(cs) LeaveCriticalSection(&(cs))
-#define CRITICAL_SECTION_FIN(cs) DeleteCriticalSection(&(cs))
+# define CRITICAL_SECTION_INIT(cs) InitializeCriticalSection(&(cs))
+# define CRITICAL_SECTION_ENTER(cs) EnterCriticalSection(&(cs))
+# define CRITICAL_SECTION_LEAVE(cs) LeaveCriticalSection(&(cs))
+# define CRITICAL_SECTION_FIN(cs) DeleteCriticalSection(&(cs))
typedef struct
{
@@ -344,14 +339,14 @@ typedef struct
size_t was_broadcast_;
} grn_cond;
-#define COND_INIT(c) do { \
+# define COND_INIT(c) do { \
(c).waiters_count_ = 0; \
(c).sema_ = CreateSemaphore(NULL, 0, 0x7fffffff, NULL); \
MUTEX_INIT((c).waiters_count_lock_); \
(c).waiters_done_ = CreateEvent(NULL, FALSE, FALSE, NULL); \
} while (0)
-#define COND_SIGNAL(c) do { \
+# define COND_SIGNAL(c) do { \
MUTEX_LOCK((c).waiters_count_lock_); \
{ \
int have_waiters = (c).waiters_count_ > 0; \
@@ -362,7 +357,7 @@ typedef struct
} \
} while (0)
-#define COND_BROADCAST(c) do { \
+# define COND_BROADCAST(c) do { \
MUTEX_LOCK((c).waiters_count_lock_); \
{ \
int have_waiters = (c).waiters_count_ > 0; \
@@ -382,7 +377,7 @@ typedef struct
} \
} while (0)
-#define COND_WAIT(c,m) do { \
+# define COND_WAIT(c,m) do { \
MUTEX_LOCK((c).waiters_count_lock_); \
(c).waiters_count_++; \
MUTEX_UNLOCK((c).waiters_count_lock_); \
@@ -401,24 +396,24 @@ typedef struct
} \
} while (0)
-#else /* WIN32 */
+# else /* WIN32 */
/* todo */
typedef int grn_cond;
-#define COND_INIT(c) ((c) = 0)
-#define COND_SIGNAL(c)
-#define COND_WAIT(c,m) do { \
+# define COND_INIT(c) ((c) = 0)
+# define COND_SIGNAL(c)
+# define COND_WAIT(c,m) do { \
MUTEX_UNLOCK(m); \
grn_nanosleep(1000000); \
MUTEX_LOCK(m); \
} while (0)
/* todo : must be enhanced! */
-#endif /* WIN32 */
+# endif /* WIN32 */
-#define MUTEX_INIT_SHARED MUTEX_INIT
-#define COND_INIT_SHARED COND_INIT
+# define MUTEX_INIT_SHARED MUTEX_INIT
+# define COND_INIT_SHARED COND_INIT
-#define GRN_TEST_YIELD() do {} while (0)
+# define GRN_TEST_YIELD() do {} while (0)
#endif /* HAVE_PTHREAD_H */
@@ -429,16 +424,12 @@ typedef int grn_cond;
# define GRN_FMT_INT32U PRIu32
# define GRN_FMT_INT64D PRId64
# define GRN_FMT_INT64U PRIu64
-# define GRN_FMT_LLD "lld"
-# define GRN_FMT_LLU "llu"
#else /* HAVE_INTTYPES_H */
# ifdef WIN32
# define GRN_FMT_INT32D "I32d"
# define GRN_FMT_INT32U "I32u"
# define GRN_FMT_INT64D "I64d"
# define GRN_FMT_INT64U "I64u"
-# define GRN_FMT_LLD "I64d"
-# define GRN_FMT_LLU "I64u"
# else /* WIN32 */
# define GRN_FMT_INT32D "d"
# define GRN_FMT_INT32U "u"
@@ -449,11 +440,29 @@ typedef int grn_cond;
# define GRN_FMT_INT64D "lld"
# define GRN_FMT_INT64U "llu"
# endif /* __x86_64__ */
-# define GRN_FMT_LLD "lld"
-# define GRN_FMT_LLU "llu"
# endif /* WIN32 */
#endif /* HAVE_INTTYPES_H */
+#ifdef WIN32
+# define GRN_FMT_LLD "I64d"
+# define GRN_FMT_LLU "I64u"
+# define GRN_FMT_SIZE "Iu"
+# define GRN_FMT_SSIZE "Id"
+# ifdef WIN64
+# define GRN_FMT_SOCKET GRN_FMT_INT64U
+# else /* WIN64 */
+# define GRN_FMT_SOCKET "u"
+# endif /* WIN64 */
+# define GRN_FMT_OFF64_T GRN_FMT_LLD
+#else /* WIN32 */
+# define GRN_FMT_LLD "lld"
+# define GRN_FMT_LLU "llu"
+# define GRN_FMT_SIZE "zu"
+# define GRN_FMT_SSIZE "zd"
+# define GRN_FMT_SOCKET "d"
+# define GRN_FMT_OFF64_T "jd"
+#endif /* WIN32 */
+
#ifdef __GNUC__
# if (defined(__i386__) || defined(__x86_64__)) /* ATOMIC ADD */
/*
@@ -486,6 +495,11 @@ typedef int grn_cond;
/* todo */
# define GRN_BIT_SCAN_REV(v,r) for (r = 31; r && !((1 << r) & v); r--)
# define GRN_BIT_SCAN_REV0(v,r) GRN_BIT_SCAN_REV(v,r)
+# elif defined(__ATOMIC_SEQ_CST) /* GCC atomic builtins */
+# define GRN_ATOMIC_ADD_EX(p,i,r) \
+ (r = __atomic_fetch_add(p, i, __ATOMIC_SEQ_CST))
+# define GRN_BIT_SCAN_REV(v,r) for (r = 31; r && !((1 << r) & v); r--)
+# define GRN_BIT_SCAN_REV0(v,r) GRN_BIT_SCAN_REV(v,r)
# else /* ATOMIC ADD */
/* todo */
# define GRN_BIT_SCAN_REV(v,r) for (r = 31; r && !((1 << r) & v); r--)
@@ -505,15 +519,12 @@ typedef int grn_cond;
# elif defined(__ATOMIC_SEQ_CST) /* GCC atomic builtins */
# define GRN_SET_64BIT(p,v) \
__atomic_store_n(p, v, __ATOMIC_SEQ_CST)
+# else
+# warning Need atomic 64bit operation support. The current implementation may break data.
+# define GRN_SET_64BIT(p,v) \
+ (*(p) = (v))
# endif /* ATOMIC 64BIT SET */
-# ifdef HAVE_MKOSTEMP
-# define GRN_MKOSTEMP(template,flags,mode) mkostemp(template,flags)
-# else /* HAVE_MKOSTEMP */
-# define GRN_MKOSTEMP(template,flags,mode) \
- (mktemp(template), GRN_OPEN((template),flags,mode))
-# endif /* HAVE_MKOSTEMP */
-
#elif (defined(WIN32) || defined (_WIN64)) /* __GNUC__ */
# define GRN_ATOMIC_ADD_EX(p,i,r) \
@@ -543,9 +554,6 @@ typedef int grn_cond;
# define GRN_BIT_SCAN_REV(v,r) for (r = 31; r && !((1 << r) & v); r--)
# define GRN_BIT_SCAN_REV0(v,r) GRN_BIT_SCAN_REV(v,r)
-# define GRN_MKOSTEMP(template,flags,mode) \
- (mktemp(template), GRN_OPEN((template),((flags)|O_BINARY),mode))
-
#else /* __GNUC__ */
# if (defined(__sun) && defined(__SVR4)) /* ATOMIC ADD */
@@ -554,9 +562,6 @@ typedef int grn_cond;
# define GRN_ATOMIC_ADD_EX(p,i,r) \
(r = atomic_add_32_nv(p, i) - i)
/* todo */
-# define GRN_BIT_SCAN_REV(v,r) for (r = 31; r && !((1 << r) & v); r--)
-# define GRN_BIT_SCAN_REV0(v,r) GRN_BIT_SCAN_REV(v,r)
-/* todo */
# define GRN_SET_64BIT(p,v) \
(void)atomic_swap_64(p, v)
# endif /* ATOMIC ADD */
@@ -564,9 +569,6 @@ typedef int grn_cond;
# define GRN_BIT_SCAN_REV(v,r) for (r = 31; r && !((1 << r) & v); r--)
# define GRN_BIT_SCAN_REV0(v,r) GRN_BIT_SCAN_REV(v,r)
-# define GRN_MKOSTEMP(template,flags,mode) \
- (mktemp(template), GRN_OPEN((template),flags,mode))
-
#endif /* __GNUC__ */
typedef uint8_t byte;
@@ -673,7 +675,7 @@ grn_str_greater(const uint8_t *ap, uint32_t as, const uint8_t *bp, uint32_t bs)
lo_ = (lo_ | (lo_ << 1)) & 0x5555555555555555ULL;\
result_ = (la_ << 1) | lo_;\
grn_hton_uint64(result_, result_);\
- memcpy(keybuf, &result_, sizeof(result_));\
+ grn_memcpy(keybuf, &result_, sizeof(result_));\
} while (0)
#define grn_ntog(keybuf,key,size) do {\
@@ -739,8 +741,6 @@ grn_str_greater(const uint8_t *ap, uint32_t as, const uint8_t *bp, uint32_t bs)
GRN_API void grn_sleep(uint32_t seconds);
GRN_API void grn_nanosleep(uint64_t nanoseconds);
-#ifndef GROONGA_H
-# include "groonga.h"
-#endif /* GROONGA_H */
+#include <groonga.h>
-#endif /* GROONGA_IN_H */
+#endif /* GRN_H */
diff --git a/storage/mroonga/vendor/groonga/lib/com.h b/storage/mroonga/vendor/groonga/lib/grn_com.h
index c0690ccfe76..203ed56c88d 100644
--- a/storage/mroonga/vendor/groonga/lib/com.h
+++ b/storage/mroonga/vendor/groonga/lib/grn_com.h
@@ -18,17 +18,9 @@
#ifndef GRN_COM_H
#define GRN_COM_H
-#ifndef GROONGA_H
-#include "groonga_in.h"
-#endif /* GROONGA_H */
-
-#ifndef GRN_STR_H
-#include "str.h"
-#endif /* GRN_STR_H */
-
-#ifndef GRN_HASH_H
-#include "hash.h"
-#endif /* GRN_HASH_H */
+#include "grn.h"
+#include "grn_str.h"
+#include "grn_hash.h"
#ifdef HAVE_NETDB_H
#include <netdb.h>
diff --git a/storage/mroonga/vendor/groonga/lib/ctx.h b/storage/mroonga/vendor/groonga/lib/grn_ctx.h
index 656abfa94b9..2f052f5f1c5 100644
--- a/storage/mroonga/vendor/groonga/lib/ctx.h
+++ b/storage/mroonga/vendor/groonga/lib/grn_ctx.h
@@ -1,6 +1,6 @@
/* -*- c-basic-offset: 2 -*- */
/*
- Copyright(C) 2009-2014 Brazil
+ Copyright(C) 2009-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -18,13 +18,10 @@
#ifndef GRN_CTX_H
#define GRN_CTX_H
-#ifndef GROONGA_IN_H
-#include "groonga_in.h"
-#endif /* GROONGA_IN_H */
+#include "grn.h"
+#include "grn_error.h"
-#ifdef HAVE_ERRNO_H
#include <errno.h>
-#endif /* HAVE_ERRNO_H */
#ifdef HAVE_SIGNAL_H
#include <signal.h>
@@ -35,9 +32,7 @@
#include <execinfo.h>
#endif /* HAVE_EXECINFO_H */
-#ifndef GRN_IO_H
-#include "io.h"
-#endif /* GRN_IO_H */
+#include "grn_io.h"
#ifdef __cplusplus
extern "C" {
@@ -157,8 +152,104 @@ GRN_API void grn_ctx_impl_set_current_error_message(grn_ctx *ctx);
} while (0)
#ifdef WIN32
+
+#define SYSTEM_ERROR_MESSAGE_BUFFER_SIZE 1024
#define SERR(str) do {\
grn_rc rc;\
+ const char *system_message;\
+ int error = GetLastError();\
+ system_message = grn_current_error_message();\
+ switch (error) {\
+ case ERROR_FILE_NOT_FOUND :\
+ case ERROR_PATH_NOT_FOUND :\
+ rc = GRN_NO_SUCH_FILE_OR_DIRECTORY;\
+ break;\
+ case ERROR_TOO_MANY_OPEN_FILES :\
+ rc = GRN_TOO_MANY_OPEN_FILES;\
+ break;\
+ case ERROR_ACCESS_DENIED :\
+ rc = GRN_PERMISSION_DENIED;\
+ break;\
+ case ERROR_INVALID_HANDLE :\
+ rc = GRN_INVALID_ARGUMENT;\
+ break;\
+ case ERROR_ARENA_TRASHED :\
+ rc = GRN_ADDRESS_IS_NOT_AVAILABLE;\
+ break;\
+ case ERROR_NOT_ENOUGH_MEMORY :\
+ rc = GRN_NO_MEMORY_AVAILABLE;\
+ break;\
+ case ERROR_INVALID_BLOCK :\
+ case ERROR_BAD_ENVIRONMENT :\
+ rc = GRN_INVALID_ARGUMENT;\
+ break;\
+ case ERROR_BAD_FORMAT :\
+ rc = GRN_INVALID_FORMAT;\
+ break;\
+ case ERROR_INVALID_DATA :\
+ rc = GRN_INVALID_ARGUMENT;\
+ break;\
+ case ERROR_OUTOFMEMORY :\
+ rc = GRN_NO_MEMORY_AVAILABLE;\
+ break;\
+ case ERROR_INVALID_DRIVE :\
+ rc = GRN_INVALID_ARGUMENT;\
+ break;\
+ case ERROR_WRITE_PROTECT :\
+ rc = GRN_PERMISSION_DENIED;\
+ break;\
+ case ERROR_BAD_LENGTH :\
+ rc = GRN_INVALID_ARGUMENT;\
+ break;\
+ case ERROR_SEEK :\
+ rc = GRN_INVALID_SEEK;\
+ break;\
+ case ERROR_NOT_SUPPORTED :\
+ rc = GRN_OPERATION_NOT_SUPPORTED;\
+ break;\
+ case ERROR_NETWORK_ACCESS_DENIED :\
+ rc = GRN_OPERATION_NOT_PERMITTED;\
+ break;\
+ case ERROR_FILE_EXISTS :\
+ rc = GRN_FILE_EXISTS;\
+ break;\
+ case ERROR_INVALID_PARAMETER :\
+ rc = GRN_INVALID_ARGUMENT;\
+ break;\
+ case ERROR_BROKEN_PIPE :\
+ rc = GRN_BROKEN_PIPE;\
+ break;\
+ case ERROR_CALL_NOT_IMPLEMENTED :\
+ rc = GRN_FUNCTION_NOT_IMPLEMENTED;\
+ break;\
+ case ERROR_INVALID_NAME :\
+ rc = GRN_INVALID_ARGUMENT;\
+ break;\
+ case ERROR_BUSY_DRIVE :\
+ case ERROR_PATH_BUSY :\
+ rc = GRN_RESOURCE_BUSY;\
+ break;\
+ case ERROR_BAD_ARGUMENTS :\
+ rc = GRN_INVALID_ARGUMENT;\
+ break;\
+ case ERROR_BUSY :\
+ rc = GRN_RESOURCE_BUSY;\
+ break;\
+ case ERROR_ALREADY_EXISTS :\
+ rc = GRN_FILE_EXISTS;\
+ break;\
+ case ERROR_BAD_EXE_FORMAT :\
+ rc = GRN_EXEC_FORMAT_ERROR;\
+ break;\
+ default:\
+ rc = GRN_UNKNOWN_ERROR;\
+ break;\
+ }\
+ ERR(rc, "syscall error '%s' (%s)[%d]", str, system_message, error);\
+} while (0)
+
+#define SOERR(str) do {\
+ grn_rc rc;\
const char *m;\
int e = WSAGetLastError();\
switch (e) {\
@@ -235,12 +326,68 @@ GRN_API void grn_ctx_impl_set_current_error_message(grn_ctx *ctx);
m = "unknown error";\
break;\
}\
- ERR(rc, "syscall error '%s' (%s)", str, m);\
+ ERR(rc, "socket error '%s' (%s)[%d]", str, m, e);\
} while (0)
+
+#define ERRNO_ERR(str) do {\
+ grn_rc rc;\
+ int errno_keep = errno;\
+ grn_bool show_errno = GRN_FALSE;\
+ char system_message[SYSTEM_ERROR_MESSAGE_BUFFER_SIZE];\
+ strerror_s(system_message, SYSTEM_ERROR_MESSAGE_BUFFER_SIZE, errno);\
+ switch (errno_keep) {\
+ case EPERM : rc = GRN_OPERATION_NOT_PERMITTED; break;\
+ case ENOENT : rc = GRN_NO_SUCH_FILE_OR_DIRECTORY; break;\
+ case ESRCH : rc = GRN_NO_SUCH_PROCESS; break;\
+ case EINTR : rc = GRN_INTERRUPTED_FUNCTION_CALL; break;\
+ case EIO : rc = GRN_INPUT_OUTPUT_ERROR; break;\
+ case E2BIG : rc = GRN_ARG_LIST_TOO_LONG; break;\
+ case ENOEXEC : rc = GRN_EXEC_FORMAT_ERROR; break;\
+ case EBADF : rc = GRN_BAD_FILE_DESCRIPTOR; break;\
+ case ECHILD : rc = GRN_NO_CHILD_PROCESSES; break;\
+ case EAGAIN: rc = GRN_OPERATION_WOULD_BLOCK; break;\
+ case ENOMEM : rc = GRN_NO_MEMORY_AVAILABLE; break;\
+ case EACCES : rc = GRN_PERMISSION_DENIED; break;\
+ case EFAULT : rc = GRN_BAD_ADDRESS; break;\
+ case EEXIST : rc = GRN_FILE_EXISTS; break;\
+ /* case EXDEV : */\
+ case ENODEV : rc = GRN_NO_SUCH_DEVICE; break;\
+ case ENOTDIR : rc = GRN_NOT_A_DIRECTORY; break;\
+ case EISDIR : rc = GRN_IS_A_DIRECTORY; break;\
+ case EINVAL : rc = GRN_INVALID_ARGUMENT; break;\
+ case EMFILE : rc = GRN_TOO_MANY_OPEN_FILES; break;\
+ case ENOTTY : rc = GRN_INAPPROPRIATE_I_O_CONTROL_OPERATION; break;\
+ case EFBIG : rc = GRN_FILE_TOO_LARGE; break;\
+ case ENOSPC : rc = GRN_NO_SPACE_LEFT_ON_DEVICE; break;\
+ case ESPIPE : rc = GRN_INVALID_SEEK; break;\
+ case EROFS : rc = GRN_READ_ONLY_FILE_SYSTEM; break;\
+ case EMLINK : rc = GRN_TOO_MANY_LINKS; break;\
+ case EPIPE : rc = GRN_BROKEN_PIPE; break;\
+ case EDOM : rc = GRN_DOMAIN_ERROR; break;\
+ case ERANGE : rc = GRN_RANGE_ERROR; break;\
+ case EDEADLOCK : rc = GRN_RESOURCE_DEADLOCK_AVOIDED; break;\
+ case ENAMETOOLONG : rc = GRN_FILENAME_TOO_LONG; break;\
+ case EILSEQ : rc = GRN_ILLEGAL_BYTE_SEQUENCE; break;\
+ /* case STRUNCATE : */\
+ default :\
+ rc = GRN_UNKNOWN_ERROR;\
+ show_errno = GRN_TRUE;\
+ break;\
+ }\
+ if (show_errno) {\
+ ERR(rc, "syscall error '%s' (%s)[%d]", str, system_message, errno_keep);\
+ } else {\
+ ERR(rc, "syscall error '%s' (%s)", str, system_message);\
+ }\
+} while (0)
+
#else /* WIN32 */
#define SERR(str) do {\
grn_rc rc;\
- switch (errno) {\
+ int errno_keep = errno;\
+ grn_bool show_errno = GRN_FALSE;\
+ const char *system_message = grn_current_error_message();\
+ switch (errno_keep) {\
case ELOOP : rc = GRN_TOO_MANY_SYMBOLIC_LINKS; break;\
case ENAMETOOLONG : rc = GRN_FILENAME_TOO_LONG; break;\
case ENOENT : rc = GRN_NO_SUCH_FILE_OR_DIRECTORY; break;\
@@ -286,10 +433,22 @@ GRN_API void grn_ctx_impl_set_current_error_message(grn_ctx *ctx);
case ETIMEDOUT : rc = GRN_OPERATION_TIMEOUT; break;\
case ECONNREFUSED: rc = GRN_CONNECTION_REFUSED; break;\
case EAGAIN: rc = GRN_OPERATION_WOULD_BLOCK; break;\
- default : rc = GRN_UNKNOWN_ERROR; break;\
+ default :\
+ rc = GRN_UNKNOWN_ERROR;\
+ show_errno = GRN_TRUE;\
+ break;\
+ }\
+ if (show_errno) {\
+ ERR(rc, "syscall error '%s' (%s)[%d]", str, system_message, errno_keep);\
+ } else {\
+ ERR(rc, "syscall error '%s' (%s)", str, system_message);\
}\
- ERR(rc, "syscall error '%s' (%s)", str, strerror(errno));\
} while (0)
+
+#define SOERR(str) SERR(str)
+
+#define ERRNO_ERR(str) SERR(str)
+
#endif /* WIN32 */
#define GERR(rc,...) ERRSET(&grn_gctx, GRN_ERROR, (rc), __VA_ARGS__)
@@ -345,6 +504,8 @@ typedef void *(*grn_realloc_func) (grn_ctx *ctx, void *ptr, size_t size,
const char *file, int line, const char *func);
typedef char *(*grn_strdup_func) (grn_ctx *ctx, const char *string,
const char *file, int line, const char *func);
+typedef void (*grn_free_func) (grn_ctx *ctx, void *ptr,
+ const char *file, int line, const char *func);
grn_malloc_func grn_ctx_get_malloc(grn_ctx *ctx);
void grn_ctx_set_malloc(grn_ctx *ctx, grn_malloc_func malloc_func);
grn_calloc_func grn_ctx_get_calloc(grn_ctx *ctx);
@@ -353,11 +514,14 @@ grn_realloc_func grn_ctx_get_realloc(grn_ctx *ctx);
void grn_ctx_set_realloc(grn_ctx *ctx, grn_realloc_func realloc_func);
grn_strdup_func grn_ctx_get_strdup(grn_ctx *ctx);
void grn_ctx_set_strdup(grn_ctx *ctx, grn_strdup_func strdup_func);
+grn_free_func grn_ctx_get_free(grn_ctx *ctx);
+void grn_ctx_set_free(grn_ctx *ctx, grn_free_func free_func);
void *grn_malloc(grn_ctx *ctx, size_t size, const char* file, int line, const char *func);
void *grn_calloc(grn_ctx *ctx, size_t size, const char* file, int line, const char *func);
void *grn_realloc(grn_ctx *ctx, void *ptr, size_t size, const char* file, int line, const char *func);
char *grn_strdup(grn_ctx *ctx, const char *s, const char* file, int line, const char *func);
+void grn_free(grn_ctx *ctx, void *ptr, const char *file, int line, const char *func);
#else
# define grn_malloc grn_malloc_default
# define grn_calloc grn_calloc_default
@@ -413,7 +577,8 @@ extern grn_timeval grn_starttime;
#define GRN_TIME_USEC_TO_NSEC(usec) ((usec) * GRN_TIME_NSEC_PER_USEC)
GRN_API grn_rc grn_timeval_now(grn_ctx *ctx, grn_timeval *tv);
-GRN_API grn_rc grn_timeval2str(grn_ctx *ctx, grn_timeval *tv, char *buf);
+GRN_API grn_rc grn_timeval2str(grn_ctx *ctx, grn_timeval *tv, char *buf, size_t buf_size);
+struct tm *grn_timeval2tm(grn_ctx *ctx, grn_timeval *tv, struct tm *tm_buffer);
grn_rc grn_str2timeval(const char *str, uint32_t str_len, grn_timeval *tv);
GRN_API void grn_ctx_log(grn_ctx *ctx, const char *fmt, ...) GRN_ATTRIBUTE_PRINTF(2);
@@ -453,6 +618,9 @@ typedef struct {
uint8_t subrec_offset;
uint8_t record_unit;
uint8_t subrec_unit;
+ union {
+ grn_table_group_flags group;
+ } flags;
// grn_obj_flags flags;
} grn_db_obj;
@@ -474,6 +642,8 @@ typedef struct {
/**** cache ****/
+#define GRN_CACHE_MAX_KEY_SIZE GRN_HASH_MAX_KEY_SIZE_LARGE
+
typedef struct {
uint32_t nentries;
uint32_t max_nentries;
diff --git a/storage/mroonga/vendor/groonga/lib/ctx_impl.h b/storage/mroonga/vendor/groonga/lib/grn_ctx_impl.h
index 33f1402e6e1..b653f35015b 100644
--- a/storage/mroonga/vendor/groonga/lib/ctx_impl.h
+++ b/storage/mroonga/vendor/groonga/lib/grn_ctx_impl.h
@@ -1,6 +1,6 @@
/* -*- c-basic-offset: 2 -*- */
/*
- Copyright(C) 2009-2014 Brazil
+ Copyright(C) 2009-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -19,16 +19,14 @@
#define GRN_CTX_IMPL_H
#ifndef GRN_CTX_H
-#include "ctx.h"
+# include "grn_ctx.h"
#endif /* GRN_CTX_H */
#ifndef GRN_COM_H
-#include "com.h"
+# include "grn_com.h"
#endif /* GRN_COM_H */
-#ifdef GRN_WITH_MESSAGE_PACK
-#include <msgpack.h>
-#endif
+#include "grn_msgpack.h"
#ifdef GRN_WITH_MRUBY
# include <mruby.h>
@@ -88,6 +86,9 @@ struct _grn_alloc_info
int freed;
char alloc_backtrace[4096];
char free_backtrace[4096];
+ char *file;
+ int line;
+ char *func;
grn_alloc_info *next;
};
#endif
@@ -96,8 +97,21 @@ struct _grn_alloc_info
typedef struct _grn_mrb_data grn_mrb_data;
struct _grn_mrb_data {
mrb_state *state;
+ char base_directory[PATH_MAX];
struct RClass *module;
struct RClass *object_class;
+ grn_hash *checked_procs;
+ grn_hash *registered_plugins;
+ struct {
+ grn_obj from;
+ grn_obj to;
+ } buffer;
+ struct {
+ struct RClass *time_class;
+ } builtin;
+ struct {
+ struct RClass *operator_class;
+ } groonga;
};
#endif
@@ -116,6 +130,7 @@ struct _grn_ctx_impl {
grn_calloc_func calloc_func;
grn_realloc_func realloc_func;
grn_strdup_func strdup_func;
+ grn_free_func free_func;
#endif
#ifdef USE_MEMORY_DEBUG
diff --git a/storage/mroonga/vendor/groonga/lib/ctx_impl_mrb.h b/storage/mroonga/vendor/groonga/lib/grn_ctx_impl_mrb.h
index 6810d1fc097..61cf088b2ae 100644
--- a/storage/mroonga/vendor/groonga/lib/ctx_impl_mrb.h
+++ b/storage/mroonga/vendor/groonga/lib/grn_ctx_impl_mrb.h
@@ -19,8 +19,8 @@
#ifndef GRN_CTX_IMPL_MRB_H
#define GRN_CTX_IMPL_MRB_H
-#include "groonga_in.h"
-#include "ctx.h"
+#include "grn.h"
+#include "grn_ctx.h"
#ifdef __cplusplus
extern "C" {
diff --git a/storage/mroonga/vendor/groonga/lib/dat.h b/storage/mroonga/vendor/groonga/lib/grn_dat.h
index d0c44b7035d..aefd044d0b7 100644
--- a/storage/mroonga/vendor/groonga/lib/dat.h
+++ b/storage/mroonga/vendor/groonga/lib/grn_dat.h
@@ -17,11 +17,11 @@
#ifndef GRN_DAT_H
#define GRN_DAT_H
-#ifndef GROONGA_IN_H
-# include "groonga_in.h"
-#endif /* GROONGA_IN_H */
+#ifndef GRN_H
+# include "grn.h"
+#endif /* GRN_H */
-#include "db.h"
+#include "grn_db.h"
#ifdef __cplusplus
extern "C" {
@@ -58,20 +58,6 @@ struct _grn_dat_cursor {
grn_id curr_rec;
};
-typedef struct _grn_dat_scan_hit grn_dat_scan_hit;
-
-struct _grn_dat_scan_hit {
- grn_id id;
- unsigned int offset;
- unsigned int length;
-};
-
-GRN_API int grn_dat_scan(grn_ctx *ctx, grn_dat *dat, const char *str,
- unsigned int str_size, grn_dat_scan_hit *scan_hits,
- unsigned int max_num_scan_hits, const char **str_rest);
-GRN_API grn_id grn_dat_lcp_search(grn_ctx *ctx, grn_dat *dat,
- const void *key, unsigned int key_size);
-
GRN_API grn_id grn_dat_curr_id(grn_ctx *ctx, grn_dat *dat);
/*
diff --git a/storage/mroonga/vendor/groonga/lib/db.h b/storage/mroonga/vendor/groonga/lib/grn_db.h
index f2f95560b08..cbc2cccaf4e 100644
--- a/storage/mroonga/vendor/groonga/lib/db.h
+++ b/storage/mroonga/vendor/groonga/lib/grn_db.h
@@ -1,5 +1,5 @@
/* -*- c-basic-offset: 2 -*- */
-/* Copyright(C) 2009-2013 Brazil
+/* Copyright(C) 2009-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -17,19 +17,16 @@
#ifndef GRN_DB_H
#define GRN_DB_H
-#ifndef GROONGA_IN_H
-#include "groonga_in.h"
-#endif /* GROONGA_IN_H */
-
-#ifndef GRN_CTX_H
-#include "ctx.h"
-#endif /* GRN_CTX_H */
-
-#ifndef GRN_STORE_H
-#include "store.h"
-#endif /* GRN_STORE_H */
+#include "grn.h"
+#include "grn_ctx.h"
+#include "grn_store.h"
+#include "grn_rset.h"
+#include <groonga/command.h>
#include <groonga/token_filter.h>
+#include <groonga/scorer.h>
+
+#include <float.h>
#ifdef __cplusplus
extern "C" {
@@ -40,30 +37,6 @@ extern "C" {
#define GRN_N_RESERVED_TYPES 256
-typedef struct {
- int score;
- int n_subrecs;
- int subrecs[1];
-} grn_rset_recinfo;
-
-typedef struct {
- grn_id rid;
- uint32_t sid;
- uint32_t pos;
-} grn_rset_posinfo;
-
-#define GRN_RSET_UTIL_BIT (0x80000000)
-
-#define GRN_RSET_SCORE_SIZE (sizeof(int))
-
-#define GRN_RSET_N_SUBRECS(ri) ((ri)->n_subrecs & ~GRN_RSET_UTIL_BIT)
-
-#define GRN_RSET_SUBRECS_CMP(a,b,dir) (((a) - (b))*(dir))
-#define GRN_RSET_SUBRECS_NTH(subrecs,size,n) \
- ((int *)((byte *)subrecs + n * (GRN_RSET_SCORE_SIZE + size)))
-#define GRN_RSET_SUBRECS_COPY(subrecs,size,n,src) \
- (memcpy(GRN_RSET_SUBRECS_NTH(subrecs, size, n), src, GRN_RSET_SCORE_SIZE + size))
-
#define GRN_JSON_LOAD_OPEN_BRACKET 0x40000000
#define GRN_JSON_LOAD_OPEN_BRACE 0x40000001
@@ -113,7 +86,7 @@ int grn_table_get_key2(grn_ctx *ctx, grn_obj *table, grn_id id, grn_obj *bulk);
grn_table_cursor *grn_table_cursor_open_by_id(grn_ctx *ctx, grn_obj *table,
grn_id min, grn_id max, int flags);
-void grn_table_add_subrec(grn_obj *table, grn_rset_recinfo *ri, int score,
+void grn_table_add_subrec(grn_obj *table, grn_rset_recinfo *ri, double score,
grn_rset_posinfo *pi, int dir);
grn_obj *grn_obj_graft(grn_ctx *ctx, grn_obj *obj);
@@ -189,10 +162,16 @@ struct _grn_proc {
union {
struct {
+ grn_command_run_func *run;
+ } command;
+ struct {
grn_token_filter_init_func *init;
grn_token_filter_filter_func *filter;
grn_token_filter_fin_func *fin;
} token_filter;
+ struct {
+ grn_scorer_score_func *score;
+ } scorer;
} callbacks;
void *user_data;
@@ -203,11 +182,14 @@ struct _grn_proc {
// grn_obj results[16];
};
+#define GRN_PROC_GET_VARS() (grn_proc_get_vars(ctx, user_data))
#define GRN_PROC_GET_VAR(name) (grn_proc_get_var(ctx, user_data, name, strlen(name)))
#define GRN_PROC_GET_VAR_BY_OFFSET(offset) (grn_proc_get_var_by_offset(ctx, user_data, offset))
#define GRN_PROC_GET_OR_ADD_VAR(name) (grn_proc_get_or_add_var(ctx, user_data, name, strlen(name)))
#define GRN_PROC_ALLOC(domain, flags) (grn_proc_alloc(ctx, user_data, domain, flags))
+grn_obj *grn_proc_get_vars(grn_ctx *ctx, grn_user_data *user_data);
+
grn_obj *grn_proc_get_var(grn_ctx *ctx, grn_user_data *user_data,
const char *name, unsigned int name_size);
@@ -245,6 +227,10 @@ enum {
GRN_ACCESSOR_GET_VALUE,
GRN_ACCESSOR_GET_SCORE,
GRN_ACCESSOR_GET_NSUBRECS,
+ GRN_ACCESSOR_GET_MAX,
+ GRN_ACCESSOR_GET_MIN,
+ GRN_ACCESSOR_GET_SUM,
+ GRN_ACCESSOR_GET_AVG,
GRN_ACCESSOR_GET_COLUMN_VALUE,
GRN_ACCESSOR_GET_DB_OBJ,
GRN_ACCESSOR_LOOKUP,
@@ -329,8 +315,6 @@ struct _grn_expr {
grn_expr_code *code0;
};
-GRN_API grn_rc grn_expr_clear_vars(grn_ctx *ctx, grn_obj *expr);
-
grn_rc grn_expr_parser_close(grn_ctx *ctx);
GRN_API grn_rc grn_obj_cast(grn_ctx *ctx, grn_obj *src, grn_obj *dest, grn_bool addp);
@@ -451,6 +435,7 @@ grn_rc grn_obj_reinit_for(grn_ctx *ctx, grn_obj *obj, grn_obj *domain_obj);
void grn_expr_pack(grn_ctx *ctx, grn_obj *buf, grn_obj *expr);
GRN_API grn_rc grn_expr_inspect(grn_ctx *ctx, grn_obj *buf, grn_obj *expr);
+grn_hash *grn_expr_get_vars(grn_ctx *ctx, grn_obj *expr, unsigned int *nvars);
grn_obj *grn_expr_open(grn_ctx *ctx, grn_obj_spec *spec, const uint8_t *p, const uint8_t *pe);
GRN_API void grn_load_(grn_ctx *ctx, grn_content_type input_type,
diff --git a/storage/mroonga/vendor/groonga/lib/ecmascript.c b/storage/mroonga/vendor/groonga/lib/grn_ecmascript.c
index e973f1281a4..b3e4da09095 100644
--- a/storage/mroonga/vendor/groonga/lib/ecmascript.c
+++ b/storage/mroonga/vendor/groonga/lib/grn_ecmascript.c
@@ -4,10 +4,10 @@
/* First off, code is included that follows the "include" declaration
** in the input grammar file. */
#include <stdio.h>
-#line 4 "ecmascript.lemon"
+#line 4 "grn_ecmascript.lemon"
#define assert GRN_ASSERT
-#line 11 "ecmascript.c"
+#line 11 "grn_ecmascript.c"
/* Next is all token values, in a form suitable for use by makeheaders.
** This section will be null unless lemon is run with the -m switch.
*/
@@ -58,13 +58,13 @@
** defined, then do no error processing.
*/
#define YYCODETYPE unsigned char
-#define YYNOCODE 113
+#define YYNOCODE 114
#define YYACTIONTYPE unsigned short int
#define grn_expr_parserTOKENTYPE int
typedef union {
int yyinit;
grn_expr_parserTOKENTYPE yy0;
- void * yy81;
+ void * yy165;
} YYMINORTYPE;
#ifndef YYSTACKDEPTH
#define YYSTACKDEPTH 100
@@ -73,8 +73,8 @@ typedef union {
#define grn_expr_parserARG_PDECL , efs_info *efsi
#define grn_expr_parserARG_FETCH efs_info *efsi = yypParser->efsi
#define grn_expr_parserARG_STORE yypParser->efsi = efsi
-#define YYNSTATE 223
-#define YYNRULE 131
+#define YYNSTATE 225
+#define YYNRULE 132
#define YY_NO_ACTION (YYNSTATE+YYNRULE+2)
#define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1)
#define YY_ERROR_ACTION (YYNSTATE+YYNRULE)
@@ -143,392 +143,399 @@ static const YYMINORTYPE yyzerominor = { 0 };
** shifting non-terminals after a reduce.
** yy_default[] Default action for each state.
*/
-#define YY_ACTTAB_COUNT (1610)
+#define YY_ACTTAB_COUNT (1639)
static const YYACTIONTYPE yy_action[] = {
- /* 0 */ 2, 70, 52, 51, 50, 220, 1, 75, 79, 123,
- /* 10 */ 4, 219, 69, 355, 76, 107, 78, 150, 219, 189,
- /* 20 */ 192, 213, 84, 121, 120, 133, 132, 131, 115, 85,
- /* 30 */ 98, 111, 99, 178, 209, 195, 73, 188, 184, 188,
- /* 40 */ 184, 220, 71, 25, 79, 138, 9, 32, 69, 64,
- /* 50 */ 63, 215, 33, 28, 67, 66, 65, 62, 61, 60,
- /* 60 */ 59, 58, 57, 183, 182, 181, 180, 179, 3, 75,
- /* 70 */ 113, 34, 6, 219, 189, 192, 213, 84, 121, 120,
- /* 80 */ 133, 132, 131, 115, 85, 98, 111, 99, 178, 209,
- /* 90 */ 195, 73, 187, 105, 188, 184, 220, 1, 28, 79,
- /* 100 */ 123, 4, 122, 69, 31, 30, 189, 192, 213, 84,
- /* 110 */ 121, 120, 133, 132, 131, 115, 85, 98, 111, 99,
- /* 120 */ 178, 209, 195, 73, 139, 127, 188, 184, 36, 35,
- /* 130 */ 110, 68, 56, 55, 8, 24, 129, 197, 196, 29,
- /* 140 */ 64, 63, 54, 53, 124, 67, 66, 65, 62, 61,
- /* 150 */ 60, 59, 58, 57, 183, 182, 181, 180, 179, 3,
- /* 160 */ 7, 26, 165, 185, 83, 142, 127, 176, 189, 166,
- /* 170 */ 213, 84, 121, 120, 133, 132, 131, 115, 85, 98,
- /* 180 */ 111, 99, 178, 209, 195, 73, 173, 130, 188, 184,
- /* 190 */ 11, 82, 81, 80, 77, 220, 71, 148, 79, 138,
- /* 200 */ 9, 171, 69, 64, 63, 174, 28, 72, 67, 66,
- /* 210 */ 65, 62, 61, 60, 59, 58, 57, 183, 182, 181,
- /* 220 */ 180, 179, 3, 177, 7, 194, 193, 185, 83, 106,
- /* 230 */ 126, 176, 189, 144, 213, 84, 121, 120, 133, 132,
- /* 240 */ 131, 115, 85, 98, 111, 99, 178, 209, 195, 73,
- /* 250 */ 164, 224, 188, 184, 141, 171, 23, 171, 10, 110,
- /* 260 */ 143, 226, 191, 140, 221, 28, 218, 64, 63, 125,
- /* 270 */ 356, 356, 67, 66, 65, 62, 61, 60, 59, 58,
- /* 280 */ 57, 183, 182, 181, 180, 179, 3, 170, 7, 122,
- /* 290 */ 217, 185, 83, 189, 192, 213, 84, 121, 120, 133,
- /* 300 */ 132, 131, 115, 85, 98, 111, 99, 178, 209, 195,
- /* 310 */ 73, 74, 216, 188, 184, 225, 49, 48, 47, 46,
- /* 320 */ 45, 44, 43, 42, 41, 40, 39, 38, 37, 5,
- /* 330 */ 149, 64, 63, 146, 222, 356, 67, 66, 65, 62,
- /* 340 */ 61, 60, 59, 58, 57, 183, 182, 181, 180, 179,
- /* 350 */ 3, 116, 356, 145, 356, 189, 192, 213, 84, 121,
- /* 360 */ 120, 133, 132, 131, 115, 85, 98, 111, 99, 178,
- /* 370 */ 209, 195, 73, 113, 356, 188, 184, 189, 192, 213,
- /* 380 */ 84, 121, 120, 133, 132, 131, 115, 85, 98, 111,
- /* 390 */ 99, 178, 209, 195, 73, 356, 356, 188, 184, 223,
- /* 400 */ 356, 356, 81, 80, 77, 220, 71, 356, 79, 138,
- /* 410 */ 9, 356, 69, 189, 162, 213, 84, 121, 120, 133,
- /* 420 */ 132, 131, 115, 85, 98, 111, 99, 178, 209, 195,
- /* 430 */ 73, 356, 7, 188, 184, 185, 83, 356, 356, 167,
- /* 440 */ 109, 189, 144, 213, 84, 121, 120, 133, 132, 131,
- /* 450 */ 115, 85, 98, 111, 99, 178, 209, 195, 73, 356,
- /* 460 */ 7, 188, 184, 185, 83, 356, 356, 356, 356, 147,
- /* 470 */ 356, 356, 356, 356, 356, 64, 63, 356, 356, 356,
- /* 480 */ 67, 66, 65, 62, 61, 60, 59, 58, 57, 183,
- /* 490 */ 182, 181, 180, 179, 3, 356, 356, 356, 356, 356,
- /* 500 */ 356, 356, 356, 64, 63, 356, 356, 167, 67, 66,
- /* 510 */ 65, 62, 61, 60, 59, 58, 57, 183, 182, 181,
- /* 520 */ 180, 179, 3, 189, 214, 213, 84, 121, 120, 133,
- /* 530 */ 132, 131, 115, 85, 98, 111, 99, 178, 209, 195,
- /* 540 */ 73, 356, 356, 188, 184, 189, 212, 213, 84, 121,
- /* 550 */ 120, 133, 132, 131, 115, 85, 98, 111, 99, 178,
- /* 560 */ 209, 195, 73, 168, 356, 188, 184, 189, 137, 213,
- /* 570 */ 84, 121, 120, 133, 132, 131, 115, 85, 98, 111,
- /* 580 */ 99, 178, 209, 195, 73, 356, 356, 188, 184, 356,
- /* 590 */ 189, 211, 213, 84, 121, 120, 133, 132, 131, 115,
- /* 600 */ 85, 98, 111, 99, 178, 209, 195, 73, 356, 356,
- /* 610 */ 188, 184, 189, 172, 213, 84, 121, 120, 133, 132,
- /* 620 */ 131, 115, 85, 98, 111, 99, 178, 209, 195, 73,
- /* 630 */ 356, 356, 188, 184, 189, 163, 213, 84, 121, 120,
- /* 640 */ 133, 132, 131, 115, 85, 98, 111, 99, 178, 209,
- /* 650 */ 195, 73, 356, 356, 188, 184, 189, 161, 213, 84,
- /* 660 */ 121, 120, 133, 132, 131, 115, 85, 98, 111, 99,
- /* 670 */ 178, 209, 195, 73, 356, 356, 188, 184, 189, 160,
- /* 680 */ 213, 84, 121, 120, 133, 132, 131, 115, 85, 98,
- /* 690 */ 111, 99, 178, 209, 195, 73, 356, 356, 188, 184,
- /* 700 */ 189, 159, 213, 84, 121, 120, 133, 132, 131, 115,
- /* 710 */ 85, 98, 111, 99, 178, 209, 195, 73, 356, 356,
- /* 720 */ 188, 184, 189, 158, 213, 84, 121, 120, 133, 132,
- /* 730 */ 131, 115, 85, 98, 111, 99, 178, 209, 195, 73,
- /* 740 */ 356, 356, 188, 184, 189, 157, 213, 84, 121, 120,
- /* 750 */ 133, 132, 131, 115, 85, 98, 111, 99, 178, 209,
- /* 760 */ 195, 73, 356, 356, 188, 184, 189, 156, 213, 84,
- /* 770 */ 121, 120, 133, 132, 131, 115, 85, 98, 111, 99,
- /* 780 */ 178, 209, 195, 73, 356, 356, 188, 184, 189, 155,
- /* 790 */ 213, 84, 121, 120, 133, 132, 131, 115, 85, 98,
- /* 800 */ 111, 99, 178, 209, 195, 73, 356, 356, 188, 184,
- /* 810 */ 189, 154, 213, 84, 121, 120, 133, 132, 131, 115,
- /* 820 */ 85, 98, 111, 99, 178, 209, 195, 73, 356, 356,
- /* 830 */ 188, 184, 189, 153, 213, 84, 121, 120, 133, 132,
- /* 840 */ 131, 115, 85, 98, 111, 99, 178, 209, 195, 73,
- /* 850 */ 356, 356, 188, 184, 189, 152, 213, 84, 121, 120,
- /* 860 */ 133, 132, 131, 115, 85, 98, 111, 99, 178, 209,
- /* 870 */ 195, 73, 356, 356, 188, 184, 189, 151, 213, 84,
- /* 880 */ 121, 120, 133, 132, 131, 115, 85, 98, 111, 99,
- /* 890 */ 178, 209, 195, 73, 356, 356, 188, 184, 189, 175,
- /* 900 */ 213, 84, 121, 120, 133, 132, 131, 115, 85, 98,
- /* 910 */ 111, 99, 178, 209, 195, 73, 356, 356, 188, 184,
- /* 920 */ 189, 169, 213, 84, 121, 120, 133, 132, 131, 115,
- /* 930 */ 85, 98, 111, 99, 178, 209, 195, 73, 356, 189,
- /* 940 */ 188, 184, 117, 356, 108, 133, 132, 131, 115, 85,
- /* 950 */ 98, 111, 99, 178, 209, 195, 73, 356, 189, 188,
- /* 960 */ 184, 117, 356, 356, 136, 132, 131, 115, 85, 98,
- /* 970 */ 111, 99, 178, 209, 195, 73, 356, 356, 188, 184,
- /* 980 */ 189, 356, 356, 117, 356, 356, 128, 132, 131, 115,
- /* 990 */ 85, 98, 111, 99, 178, 209, 195, 73, 356, 356,
- /* 1000 */ 188, 184, 189, 356, 356, 117, 356, 356, 356, 135,
- /* 1010 */ 131, 115, 85, 98, 111, 99, 178, 209, 195, 73,
- /* 1020 */ 356, 356, 188, 184, 356, 27, 22, 21, 20, 19,
- /* 1030 */ 18, 17, 16, 15, 14, 13, 12, 189, 356, 356,
- /* 1040 */ 117, 356, 356, 356, 356, 134, 115, 85, 98, 111,
- /* 1050 */ 99, 178, 209, 195, 73, 356, 356, 188, 184, 356,
- /* 1060 */ 189, 356, 356, 117, 356, 356, 197, 196, 356, 119,
- /* 1070 */ 85, 98, 111, 99, 178, 209, 195, 73, 356, 189,
- /* 1080 */ 188, 184, 117, 7, 356, 356, 185, 83, 356, 87,
- /* 1090 */ 98, 111, 99, 178, 209, 195, 73, 356, 189, 188,
- /* 1100 */ 184, 117, 356, 356, 356, 356, 356, 356, 86, 98,
- /* 1110 */ 111, 99, 178, 209, 195, 73, 356, 189, 188, 184,
- /* 1120 */ 117, 356, 356, 356, 356, 356, 356, 356, 104, 111,
- /* 1130 */ 99, 178, 209, 195, 73, 356, 189, 188, 184, 117,
- /* 1140 */ 183, 182, 181, 180, 179, 3, 356, 102, 111, 99,
- /* 1150 */ 178, 209, 195, 73, 356, 189, 188, 184, 117, 356,
- /* 1160 */ 356, 356, 356, 356, 356, 356, 100, 111, 99, 178,
- /* 1170 */ 209, 195, 73, 356, 189, 188, 184, 117, 356, 356,
- /* 1180 */ 356, 356, 356, 356, 356, 97, 111, 99, 178, 209,
- /* 1190 */ 195, 73, 356, 189, 188, 184, 117, 356, 356, 356,
- /* 1200 */ 356, 356, 356, 356, 96, 111, 99, 178, 209, 195,
- /* 1210 */ 73, 356, 189, 188, 184, 117, 356, 356, 356, 356,
- /* 1220 */ 356, 356, 356, 95, 111, 99, 178, 209, 195, 73,
- /* 1230 */ 356, 189, 188, 184, 117, 356, 356, 356, 356, 356,
- /* 1240 */ 356, 356, 94, 111, 99, 178, 209, 195, 73, 356,
- /* 1250 */ 189, 188, 184, 117, 356, 356, 356, 356, 356, 356,
- /* 1260 */ 356, 93, 111, 99, 178, 209, 195, 73, 356, 189,
- /* 1270 */ 188, 184, 117, 356, 356, 356, 356, 356, 356, 356,
- /* 1280 */ 92, 111, 99, 178, 209, 195, 73, 356, 189, 188,
- /* 1290 */ 184, 117, 356, 356, 356, 356, 356, 356, 356, 91,
- /* 1300 */ 111, 99, 178, 209, 195, 73, 356, 189, 188, 184,
- /* 1310 */ 117, 356, 356, 356, 356, 356, 356, 356, 90, 111,
- /* 1320 */ 99, 178, 209, 195, 73, 356, 189, 188, 184, 117,
- /* 1330 */ 356, 356, 356, 356, 356, 356, 356, 89, 111, 99,
- /* 1340 */ 178, 209, 195, 73, 356, 189, 188, 184, 117, 356,
- /* 1350 */ 356, 356, 356, 356, 356, 356, 88, 111, 99, 178,
- /* 1360 */ 209, 195, 73, 356, 189, 188, 184, 117, 356, 356,
- /* 1370 */ 356, 356, 356, 356, 356, 356, 118, 99, 178, 209,
- /* 1380 */ 195, 73, 356, 189, 188, 184, 117, 356, 356, 356,
- /* 1390 */ 356, 356, 356, 356, 356, 114, 99, 178, 209, 195,
- /* 1400 */ 73, 356, 189, 188, 184, 117, 356, 356, 356, 356,
- /* 1410 */ 356, 356, 356, 356, 112, 99, 178, 209, 195, 73,
- /* 1420 */ 356, 189, 188, 184, 117, 356, 356, 356, 356, 356,
- /* 1430 */ 189, 356, 356, 117, 103, 178, 209, 195, 73, 356,
- /* 1440 */ 356, 188, 184, 101, 178, 209, 195, 73, 356, 189,
- /* 1450 */ 188, 184, 117, 356, 356, 356, 356, 356, 189, 356,
- /* 1460 */ 356, 117, 356, 210, 209, 195, 73, 356, 189, 188,
- /* 1470 */ 184, 117, 208, 209, 195, 73, 356, 189, 188, 184,
- /* 1480 */ 117, 356, 207, 209, 195, 73, 356, 189, 188, 184,
- /* 1490 */ 117, 206, 209, 195, 73, 356, 189, 188, 184, 117,
- /* 1500 */ 356, 205, 209, 195, 73, 356, 189, 188, 184, 117,
- /* 1510 */ 204, 209, 195, 73, 356, 189, 188, 184, 117, 356,
- /* 1520 */ 203, 209, 195, 73, 356, 189, 188, 184, 117, 202,
- /* 1530 */ 209, 195, 73, 356, 189, 188, 184, 117, 356, 201,
- /* 1540 */ 209, 195, 73, 356, 356, 188, 184, 356, 200, 209,
- /* 1550 */ 195, 73, 356, 189, 188, 184, 117, 356, 356, 356,
- /* 1560 */ 356, 189, 356, 356, 117, 356, 356, 199, 209, 195,
- /* 1570 */ 73, 356, 356, 188, 184, 198, 209, 195, 73, 356,
- /* 1580 */ 189, 188, 184, 117, 356, 356, 356, 356, 189, 356,
- /* 1590 */ 356, 117, 356, 356, 190, 209, 195, 73, 356, 356,
- /* 1600 */ 188, 184, 186, 209, 195, 73, 356, 356, 188, 184,
+ /* 0 */ 2, 71, 53, 52, 51, 222, 1, 76, 80, 125,
+ /* 10 */ 4, 221, 70, 358, 77, 109, 28, 152, 221, 191,
+ /* 20 */ 194, 215, 88, 123, 122, 135, 134, 133, 117, 85,
+ /* 30 */ 100, 113, 101, 180, 211, 197, 74, 190, 186, 190,
+ /* 40 */ 186, 222, 72, 79, 80, 140, 9, 189, 70, 25,
+ /* 50 */ 65, 64, 217, 28, 28, 68, 67, 66, 63, 62,
+ /* 60 */ 61, 60, 59, 58, 185, 184, 183, 182, 181, 3,
+ /* 70 */ 76, 115, 6, 193, 221, 191, 194, 215, 88, 123,
+ /* 80 */ 122, 135, 134, 133, 117, 85, 100, 113, 101, 180,
+ /* 90 */ 211, 197, 74, 166, 107, 190, 186, 222, 1, 23,
+ /* 100 */ 80, 125, 4, 124, 70, 31, 30, 191, 194, 215,
+ /* 110 */ 88, 123, 122, 135, 134, 133, 117, 85, 100, 113,
+ /* 120 */ 101, 180, 211, 197, 74, 141, 129, 190, 186, 36,
+ /* 130 */ 35, 112, 69, 57, 56, 8, 32, 131, 55, 54,
+ /* 140 */ 34, 29, 65, 64, 176, 33, 73, 68, 67, 66,
+ /* 150 */ 63, 62, 61, 60, 59, 58, 185, 184, 183, 182,
+ /* 160 */ 181, 3, 7, 26, 128, 187, 84, 199, 198, 178,
+ /* 170 */ 191, 168, 215, 88, 123, 122, 135, 134, 133, 117,
+ /* 180 */ 85, 100, 113, 101, 180, 211, 197, 74, 144, 129,
+ /* 190 */ 190, 186, 11, 83, 82, 81, 78, 222, 72, 150,
+ /* 200 */ 80, 140, 9, 173, 70, 24, 65, 64, 228, 169,
+ /* 210 */ 167, 68, 67, 66, 63, 62, 61, 60, 59, 58,
+ /* 220 */ 185, 184, 183, 182, 181, 3, 179, 7, 196, 195,
+ /* 230 */ 187, 84, 108, 143, 178, 191, 146, 215, 88, 123,
+ /* 240 */ 122, 135, 134, 133, 117, 85, 100, 113, 101, 180,
+ /* 250 */ 211, 197, 74, 226, 227, 190, 186, 126, 173, 75,
+ /* 260 */ 173, 175, 132, 145, 142, 112, 170, 28, 5, 10,
+ /* 270 */ 223, 65, 64, 220, 127, 219, 68, 67, 66, 63,
+ /* 280 */ 62, 61, 60, 59, 58, 185, 184, 183, 182, 181,
+ /* 290 */ 3, 172, 7, 124, 218, 187, 84, 191, 194, 215,
+ /* 300 */ 88, 123, 122, 135, 134, 133, 117, 85, 100, 113,
+ /* 310 */ 101, 180, 211, 197, 74, 151, 224, 190, 186, 359,
+ /* 320 */ 50, 49, 48, 47, 46, 45, 44, 43, 42, 41,
+ /* 330 */ 40, 39, 38, 37, 359, 359, 65, 64, 148, 359,
+ /* 340 */ 359, 68, 67, 66, 63, 62, 61, 60, 59, 58,
+ /* 350 */ 185, 184, 183, 182, 181, 3, 118, 359, 147, 359,
+ /* 360 */ 191, 194, 215, 88, 123, 122, 135, 134, 133, 117,
+ /* 370 */ 85, 100, 113, 101, 180, 211, 197, 74, 115, 359,
+ /* 380 */ 190, 186, 191, 194, 215, 88, 123, 122, 135, 134,
+ /* 390 */ 133, 117, 85, 100, 113, 101, 180, 211, 197, 74,
+ /* 400 */ 359, 359, 190, 186, 225, 359, 359, 82, 81, 78,
+ /* 410 */ 222, 72, 359, 80, 140, 9, 359, 70, 359, 191,
+ /* 420 */ 164, 215, 88, 123, 122, 135, 134, 133, 117, 85,
+ /* 430 */ 100, 113, 101, 180, 211, 197, 74, 359, 7, 190,
+ /* 440 */ 186, 187, 84, 359, 359, 169, 111, 191, 146, 215,
+ /* 450 */ 88, 123, 122, 135, 134, 133, 117, 85, 100, 113,
+ /* 460 */ 101, 180, 211, 197, 74, 359, 7, 190, 186, 187,
+ /* 470 */ 84, 359, 359, 359, 359, 149, 359, 359, 359, 359,
+ /* 480 */ 359, 359, 65, 64, 359, 359, 359, 68, 67, 66,
+ /* 490 */ 63, 62, 61, 60, 59, 58, 185, 184, 183, 182,
+ /* 500 */ 181, 3, 359, 359, 359, 359, 359, 359, 359, 359,
+ /* 510 */ 65, 64, 359, 359, 359, 68, 67, 66, 63, 62,
+ /* 520 */ 61, 60, 59, 58, 185, 184, 183, 182, 181, 3,
+ /* 530 */ 191, 216, 215, 88, 123, 122, 135, 134, 133, 117,
+ /* 540 */ 85, 100, 113, 101, 180, 211, 197, 74, 359, 359,
+ /* 550 */ 190, 186, 191, 214, 215, 88, 123, 122, 135, 134,
+ /* 560 */ 133, 117, 85, 100, 113, 101, 180, 211, 197, 74,
+ /* 570 */ 359, 359, 190, 186, 191, 139, 215, 88, 123, 122,
+ /* 580 */ 135, 134, 133, 117, 85, 100, 113, 101, 180, 211,
+ /* 590 */ 197, 74, 359, 359, 190, 186, 359, 359, 191, 213,
+ /* 600 */ 215, 88, 123, 122, 135, 134, 133, 117, 85, 100,
+ /* 610 */ 113, 101, 180, 211, 197, 74, 359, 359, 190, 186,
+ /* 620 */ 191, 174, 215, 88, 123, 122, 135, 134, 133, 117,
+ /* 630 */ 85, 100, 113, 101, 180, 211, 197, 74, 359, 359,
+ /* 640 */ 190, 186, 191, 165, 215, 88, 123, 122, 135, 134,
+ /* 650 */ 133, 117, 85, 100, 113, 101, 180, 211, 197, 74,
+ /* 660 */ 359, 359, 190, 186, 191, 163, 215, 88, 123, 122,
+ /* 670 */ 135, 134, 133, 117, 85, 100, 113, 101, 180, 211,
+ /* 680 */ 197, 74, 359, 359, 190, 186, 191, 162, 215, 88,
+ /* 690 */ 123, 122, 135, 134, 133, 117, 85, 100, 113, 101,
+ /* 700 */ 180, 211, 197, 74, 359, 359, 190, 186, 191, 161,
+ /* 710 */ 215, 88, 123, 122, 135, 134, 133, 117, 85, 100,
+ /* 720 */ 113, 101, 180, 211, 197, 74, 359, 359, 190, 186,
+ /* 730 */ 191, 160, 215, 88, 123, 122, 135, 134, 133, 117,
+ /* 740 */ 85, 100, 113, 101, 180, 211, 197, 74, 359, 359,
+ /* 750 */ 190, 186, 191, 159, 215, 88, 123, 122, 135, 134,
+ /* 760 */ 133, 117, 85, 100, 113, 101, 180, 211, 197, 74,
+ /* 770 */ 359, 359, 190, 186, 191, 158, 215, 88, 123, 122,
+ /* 780 */ 135, 134, 133, 117, 85, 100, 113, 101, 180, 211,
+ /* 790 */ 197, 74, 359, 359, 190, 186, 191, 157, 215, 88,
+ /* 800 */ 123, 122, 135, 134, 133, 117, 85, 100, 113, 101,
+ /* 810 */ 180, 211, 197, 74, 359, 359, 190, 186, 191, 156,
+ /* 820 */ 215, 88, 123, 122, 135, 134, 133, 117, 85, 100,
+ /* 830 */ 113, 101, 180, 211, 197, 74, 359, 359, 190, 186,
+ /* 840 */ 191, 155, 215, 88, 123, 122, 135, 134, 133, 117,
+ /* 850 */ 85, 100, 113, 101, 180, 211, 197, 74, 359, 359,
+ /* 860 */ 190, 186, 191, 154, 215, 88, 123, 122, 135, 134,
+ /* 870 */ 133, 117, 85, 100, 113, 101, 180, 211, 197, 74,
+ /* 880 */ 359, 359, 190, 186, 191, 153, 215, 88, 123, 122,
+ /* 890 */ 135, 134, 133, 117, 85, 100, 113, 101, 180, 211,
+ /* 900 */ 197, 74, 359, 359, 190, 186, 191, 177, 215, 88,
+ /* 910 */ 123, 122, 135, 134, 133, 117, 85, 100, 113, 101,
+ /* 920 */ 180, 211, 197, 74, 359, 359, 190, 186, 191, 171,
+ /* 930 */ 215, 88, 123, 122, 135, 134, 133, 117, 85, 100,
+ /* 940 */ 113, 101, 180, 211, 197, 74, 359, 191, 190, 186,
+ /* 950 */ 119, 359, 110, 135, 134, 133, 117, 85, 100, 113,
+ /* 960 */ 101, 180, 211, 197, 74, 359, 191, 190, 186, 119,
+ /* 970 */ 359, 359, 138, 134, 133, 117, 85, 100, 113, 101,
+ /* 980 */ 180, 211, 197, 74, 359, 359, 190, 186, 191, 359,
+ /* 990 */ 359, 119, 359, 359, 130, 134, 133, 117, 85, 100,
+ /* 1000 */ 113, 101, 180, 211, 197, 74, 359, 359, 190, 186,
+ /* 1010 */ 191, 359, 359, 119, 359, 359, 359, 137, 133, 117,
+ /* 1020 */ 85, 100, 113, 101, 180, 211, 197, 74, 359, 359,
+ /* 1030 */ 190, 186, 359, 27, 22, 21, 20, 19, 18, 17,
+ /* 1040 */ 16, 15, 14, 13, 12, 191, 359, 359, 119, 359,
+ /* 1050 */ 359, 359, 359, 136, 117, 85, 100, 113, 101, 180,
+ /* 1060 */ 211, 197, 74, 359, 359, 190, 186, 359, 359, 191,
+ /* 1070 */ 359, 359, 119, 359, 359, 199, 198, 359, 121, 85,
+ /* 1080 */ 100, 113, 101, 180, 211, 197, 74, 359, 191, 190,
+ /* 1090 */ 186, 119, 7, 359, 359, 187, 84, 359, 87, 100,
+ /* 1100 */ 113, 101, 180, 211, 197, 74, 359, 191, 190, 186,
+ /* 1110 */ 119, 359, 359, 359, 359, 359, 359, 86, 100, 113,
+ /* 1120 */ 101, 180, 211, 197, 74, 359, 191, 190, 186, 119,
+ /* 1130 */ 359, 359, 359, 359, 359, 359, 359, 106, 113, 101,
+ /* 1140 */ 180, 211, 197, 74, 359, 191, 190, 186, 119, 359,
+ /* 1150 */ 185, 184, 183, 182, 181, 3, 104, 113, 101, 180,
+ /* 1160 */ 211, 197, 74, 359, 191, 190, 186, 119, 359, 359,
+ /* 1170 */ 359, 359, 359, 359, 359, 102, 113, 101, 180, 211,
+ /* 1180 */ 197, 74, 359, 191, 190, 186, 119, 359, 359, 359,
+ /* 1190 */ 359, 359, 359, 359, 99, 113, 101, 180, 211, 197,
+ /* 1200 */ 74, 359, 191, 190, 186, 119, 359, 359, 359, 359,
+ /* 1210 */ 359, 359, 359, 98, 113, 101, 180, 211, 197, 74,
+ /* 1220 */ 359, 191, 190, 186, 119, 359, 359, 359, 359, 359,
+ /* 1230 */ 359, 359, 97, 113, 101, 180, 211, 197, 74, 359,
+ /* 1240 */ 191, 190, 186, 119, 359, 359, 359, 359, 359, 359,
+ /* 1250 */ 359, 96, 113, 101, 180, 211, 197, 74, 359, 191,
+ /* 1260 */ 190, 186, 119, 359, 359, 359, 359, 359, 359, 359,
+ /* 1270 */ 95, 113, 101, 180, 211, 197, 74, 359, 191, 190,
+ /* 1280 */ 186, 119, 359, 359, 359, 359, 359, 359, 359, 94,
+ /* 1290 */ 113, 101, 180, 211, 197, 74, 359, 191, 190, 186,
+ /* 1300 */ 119, 359, 359, 359, 359, 359, 359, 359, 93, 113,
+ /* 1310 */ 101, 180, 211, 197, 74, 359, 191, 190, 186, 119,
+ /* 1320 */ 359, 359, 359, 359, 359, 359, 359, 92, 113, 101,
+ /* 1330 */ 180, 211, 197, 74, 359, 191, 190, 186, 119, 359,
+ /* 1340 */ 359, 359, 359, 359, 359, 359, 91, 113, 101, 180,
+ /* 1350 */ 211, 197, 74, 359, 191, 190, 186, 119, 359, 359,
+ /* 1360 */ 359, 359, 359, 359, 359, 90, 113, 101, 180, 211,
+ /* 1370 */ 197, 74, 359, 191, 190, 186, 119, 359, 359, 359,
+ /* 1380 */ 359, 359, 359, 359, 89, 113, 101, 180, 211, 197,
+ /* 1390 */ 74, 359, 191, 190, 186, 119, 359, 359, 359, 359,
+ /* 1400 */ 359, 359, 359, 359, 120, 101, 180, 211, 197, 74,
+ /* 1410 */ 359, 191, 190, 186, 119, 359, 359, 359, 359, 359,
+ /* 1420 */ 359, 359, 359, 116, 101, 180, 211, 197, 74, 359,
+ /* 1430 */ 191, 190, 186, 119, 359, 359, 359, 359, 359, 359,
+ /* 1440 */ 359, 359, 114, 101, 180, 211, 197, 74, 359, 191,
+ /* 1450 */ 190, 186, 119, 359, 359, 359, 359, 359, 191, 359,
+ /* 1460 */ 359, 119, 105, 180, 211, 197, 74, 359, 359, 190,
+ /* 1470 */ 186, 103, 180, 211, 197, 74, 359, 191, 190, 186,
+ /* 1480 */ 119, 359, 359, 359, 359, 359, 359, 191, 359, 359,
+ /* 1490 */ 119, 212, 211, 197, 74, 359, 191, 190, 186, 119,
+ /* 1500 */ 359, 210, 211, 197, 74, 359, 191, 190, 186, 119,
+ /* 1510 */ 209, 211, 197, 74, 359, 191, 190, 186, 119, 359,
+ /* 1520 */ 208, 211, 197, 74, 359, 191, 190, 186, 119, 207,
+ /* 1530 */ 211, 197, 74, 359, 191, 190, 186, 119, 359, 206,
+ /* 1540 */ 211, 197, 74, 359, 191, 190, 186, 119, 205, 211,
+ /* 1550 */ 197, 74, 359, 191, 190, 186, 119, 359, 204, 211,
+ /* 1560 */ 197, 74, 359, 191, 190, 186, 119, 203, 211, 197,
+ /* 1570 */ 74, 359, 359, 190, 186, 359, 359, 202, 211, 197,
+ /* 1580 */ 74, 359, 191, 190, 186, 119, 359, 359, 359, 359,
+ /* 1590 */ 191, 359, 359, 119, 359, 359, 201, 211, 197, 74,
+ /* 1600 */ 359, 359, 190, 186, 200, 211, 197, 74, 359, 191,
+ /* 1610 */ 190, 186, 119, 359, 359, 359, 359, 191, 359, 359,
+ /* 1620 */ 119, 359, 359, 192, 211, 197, 74, 359, 359, 190,
+ /* 1630 */ 186, 188, 211, 197, 74, 359, 359, 190, 186,
};
static const YYCODETYPE yy_lookahead[] = {
- /* 0 */ 1, 2, 47, 48, 49, 6, 7, 76, 9, 10,
- /* 10 */ 11, 80, 13, 75, 76, 77, 9, 81, 80, 81,
- /* 20 */ 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
- /* 30 */ 92, 93, 94, 95, 96, 97, 98, 101, 102, 101,
- /* 40 */ 102, 6, 7, 28, 9, 10, 11, 29, 13, 50,
- /* 50 */ 51, 12, 30, 14, 55, 56, 57, 58, 59, 60,
- /* 60 */ 61, 62, 63, 64, 65, 66, 67, 68, 69, 76,
- /* 70 */ 77, 31, 7, 80, 81, 82, 83, 84, 85, 86,
+ /* 0 */ 1, 2, 48, 49, 50, 6, 7, 77, 9, 10,
+ /* 10 */ 11, 81, 13, 76, 77, 78, 14, 82, 81, 82,
+ /* 20 */ 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
+ /* 30 */ 93, 94, 95, 96, 97, 98, 99, 102, 103, 102,
+ /* 40 */ 103, 6, 7, 9, 9, 10, 11, 8, 13, 28,
+ /* 50 */ 51, 52, 12, 14, 14, 56, 57, 58, 59, 60,
+ /* 60 */ 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
+ /* 70 */ 77, 78, 7, 71, 81, 82, 83, 84, 85, 86,
/* 80 */ 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
- /* 90 */ 97, 98, 8, 79, 101, 102, 6, 7, 14, 9,
- /* 100 */ 10, 11, 77, 13, 3, 4, 81, 82, 83, 84,
+ /* 90 */ 97, 98, 99, 8, 80, 102, 103, 6, 7, 14,
+ /* 100 */ 9, 10, 11, 78, 13, 3, 4, 82, 83, 84,
/* 110 */ 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
- /* 120 */ 95, 96, 97, 98, 110, 111, 101, 102, 32, 33,
- /* 130 */ 105, 52, 53, 54, 69, 28, 71, 56, 57, 5,
- /* 140 */ 50, 51, 50, 51, 39, 55, 56, 57, 58, 59,
- /* 150 */ 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
- /* 160 */ 7, 27, 10, 10, 11, 110, 111, 14, 81, 82,
- /* 170 */ 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
- /* 180 */ 93, 94, 95, 96, 97, 98, 106, 107, 101, 102,
- /* 190 */ 103, 104, 3, 4, 5, 6, 7, 8, 9, 10,
- /* 200 */ 11, 10, 13, 50, 51, 12, 14, 14, 55, 56,
- /* 210 */ 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
- /* 220 */ 67, 68, 69, 70, 7, 99, 100, 10, 11, 78,
- /* 230 */ 52, 14, 81, 82, 83, 84, 85, 86, 87, 88,
- /* 240 */ 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,
- /* 250 */ 8, 0, 101, 102, 64, 64, 14, 66, 103, 105,
- /* 260 */ 109, 0, 70, 66, 80, 14, 80, 50, 51, 10,
- /* 270 */ 112, 112, 55, 56, 57, 58, 59, 60, 61, 62,
- /* 280 */ 63, 64, 65, 66, 67, 68, 69, 70, 7, 77,
- /* 290 */ 80, 10, 11, 81, 82, 83, 84, 85, 86, 87,
- /* 300 */ 88, 89, 90, 91, 92, 93, 94, 95, 96, 97,
- /* 310 */ 98, 50, 80, 101, 102, 0, 34, 35, 36, 37,
- /* 320 */ 38, 39, 40, 41, 42, 43, 44, 45, 46, 14,
- /* 330 */ 80, 50, 51, 52, 80, 112, 55, 56, 57, 58,
- /* 340 */ 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
- /* 350 */ 69, 77, 112, 72, 112, 81, 82, 83, 84, 85,
- /* 360 */ 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
- /* 370 */ 96, 97, 98, 77, 112, 101, 102, 81, 82, 83,
- /* 380 */ 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
- /* 390 */ 94, 95, 96, 97, 98, 112, 112, 101, 102, 0,
- /* 400 */ 112, 112, 3, 4, 5, 6, 7, 112, 9, 10,
- /* 410 */ 11, 112, 13, 81, 82, 83, 84, 85, 86, 87,
- /* 420 */ 88, 89, 90, 91, 92, 93, 94, 95, 96, 97,
- /* 430 */ 98, 112, 7, 101, 102, 10, 11, 112, 112, 14,
- /* 440 */ 108, 81, 82, 83, 84, 85, 86, 87, 88, 89,
- /* 450 */ 90, 91, 92, 93, 94, 95, 96, 97, 98, 112,
- /* 460 */ 7, 101, 102, 10, 11, 112, 112, 112, 112, 109,
- /* 470 */ 112, 112, 112, 112, 112, 50, 51, 112, 112, 112,
- /* 480 */ 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
- /* 490 */ 65, 66, 67, 68, 69, 112, 112, 112, 112, 112,
- /* 500 */ 112, 112, 112, 50, 51, 112, 112, 14, 55, 56,
- /* 510 */ 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
- /* 520 */ 67, 68, 69, 81, 82, 83, 84, 85, 86, 87,
- /* 530 */ 88, 89, 90, 91, 92, 93, 94, 95, 96, 97,
- /* 540 */ 98, 112, 112, 101, 102, 81, 82, 83, 84, 85,
- /* 550 */ 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
- /* 560 */ 96, 97, 98, 70, 112, 101, 102, 81, 82, 83,
- /* 570 */ 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
- /* 580 */ 94, 95, 96, 97, 98, 112, 112, 101, 102, 112,
- /* 590 */ 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
- /* 600 */ 91, 92, 93, 94, 95, 96, 97, 98, 112, 112,
- /* 610 */ 101, 102, 81, 82, 83, 84, 85, 86, 87, 88,
- /* 620 */ 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,
- /* 630 */ 112, 112, 101, 102, 81, 82, 83, 84, 85, 86,
- /* 640 */ 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
- /* 650 */ 97, 98, 112, 112, 101, 102, 81, 82, 83, 84,
- /* 660 */ 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
- /* 670 */ 95, 96, 97, 98, 112, 112, 101, 102, 81, 82,
- /* 680 */ 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
- /* 690 */ 93, 94, 95, 96, 97, 98, 112, 112, 101, 102,
- /* 700 */ 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
- /* 710 */ 91, 92, 93, 94, 95, 96, 97, 98, 112, 112,
- /* 720 */ 101, 102, 81, 82, 83, 84, 85, 86, 87, 88,
- /* 730 */ 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,
- /* 740 */ 112, 112, 101, 102, 81, 82, 83, 84, 85, 86,
- /* 750 */ 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
- /* 760 */ 97, 98, 112, 112, 101, 102, 81, 82, 83, 84,
- /* 770 */ 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
- /* 780 */ 95, 96, 97, 98, 112, 112, 101, 102, 81, 82,
- /* 790 */ 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
- /* 800 */ 93, 94, 95, 96, 97, 98, 112, 112, 101, 102,
- /* 810 */ 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
- /* 820 */ 91, 92, 93, 94, 95, 96, 97, 98, 112, 112,
- /* 830 */ 101, 102, 81, 82, 83, 84, 85, 86, 87, 88,
- /* 840 */ 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,
- /* 850 */ 112, 112, 101, 102, 81, 82, 83, 84, 85, 86,
- /* 860 */ 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
- /* 870 */ 97, 98, 112, 112, 101, 102, 81, 82, 83, 84,
- /* 880 */ 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
- /* 890 */ 95, 96, 97, 98, 112, 112, 101, 102, 81, 82,
- /* 900 */ 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
- /* 910 */ 93, 94, 95, 96, 97, 98, 112, 112, 101, 102,
- /* 920 */ 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
- /* 930 */ 91, 92, 93, 94, 95, 96, 97, 98, 112, 81,
- /* 940 */ 101, 102, 84, 112, 86, 87, 88, 89, 90, 91,
- /* 950 */ 92, 93, 94, 95, 96, 97, 98, 112, 81, 101,
- /* 960 */ 102, 84, 112, 112, 87, 88, 89, 90, 91, 92,
- /* 970 */ 93, 94, 95, 96, 97, 98, 112, 112, 101, 102,
- /* 980 */ 81, 112, 112, 84, 112, 112, 87, 88, 89, 90,
- /* 990 */ 91, 92, 93, 94, 95, 96, 97, 98, 112, 112,
- /* 1000 */ 101, 102, 81, 112, 112, 84, 112, 112, 112, 88,
- /* 1010 */ 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,
- /* 1020 */ 112, 112, 101, 102, 112, 15, 16, 17, 18, 19,
- /* 1030 */ 20, 21, 22, 23, 24, 25, 26, 81, 112, 112,
- /* 1040 */ 84, 112, 112, 112, 112, 89, 90, 91, 92, 93,
- /* 1050 */ 94, 95, 96, 97, 98, 112, 112, 101, 102, 112,
- /* 1060 */ 81, 112, 112, 84, 112, 112, 56, 57, 112, 90,
- /* 1070 */ 91, 92, 93, 94, 95, 96, 97, 98, 112, 81,
- /* 1080 */ 101, 102, 84, 7, 112, 112, 10, 11, 112, 91,
- /* 1090 */ 92, 93, 94, 95, 96, 97, 98, 112, 81, 101,
- /* 1100 */ 102, 84, 112, 112, 112, 112, 112, 112, 91, 92,
- /* 1110 */ 93, 94, 95, 96, 97, 98, 112, 81, 101, 102,
- /* 1120 */ 84, 112, 112, 112, 112, 112, 112, 112, 92, 93,
- /* 1130 */ 94, 95, 96, 97, 98, 112, 81, 101, 102, 84,
- /* 1140 */ 64, 65, 66, 67, 68, 69, 112, 92, 93, 94,
- /* 1150 */ 95, 96, 97, 98, 112, 81, 101, 102, 84, 112,
- /* 1160 */ 112, 112, 112, 112, 112, 112, 92, 93, 94, 95,
- /* 1170 */ 96, 97, 98, 112, 81, 101, 102, 84, 112, 112,
- /* 1180 */ 112, 112, 112, 112, 112, 92, 93, 94, 95, 96,
- /* 1190 */ 97, 98, 112, 81, 101, 102, 84, 112, 112, 112,
- /* 1200 */ 112, 112, 112, 112, 92, 93, 94, 95, 96, 97,
- /* 1210 */ 98, 112, 81, 101, 102, 84, 112, 112, 112, 112,
- /* 1220 */ 112, 112, 112, 92, 93, 94, 95, 96, 97, 98,
- /* 1230 */ 112, 81, 101, 102, 84, 112, 112, 112, 112, 112,
- /* 1240 */ 112, 112, 92, 93, 94, 95, 96, 97, 98, 112,
- /* 1250 */ 81, 101, 102, 84, 112, 112, 112, 112, 112, 112,
- /* 1260 */ 112, 92, 93, 94, 95, 96, 97, 98, 112, 81,
- /* 1270 */ 101, 102, 84, 112, 112, 112, 112, 112, 112, 112,
- /* 1280 */ 92, 93, 94, 95, 96, 97, 98, 112, 81, 101,
- /* 1290 */ 102, 84, 112, 112, 112, 112, 112, 112, 112, 92,
- /* 1300 */ 93, 94, 95, 96, 97, 98, 112, 81, 101, 102,
- /* 1310 */ 84, 112, 112, 112, 112, 112, 112, 112, 92, 93,
- /* 1320 */ 94, 95, 96, 97, 98, 112, 81, 101, 102, 84,
- /* 1330 */ 112, 112, 112, 112, 112, 112, 112, 92, 93, 94,
- /* 1340 */ 95, 96, 97, 98, 112, 81, 101, 102, 84, 112,
- /* 1350 */ 112, 112, 112, 112, 112, 112, 92, 93, 94, 95,
- /* 1360 */ 96, 97, 98, 112, 81, 101, 102, 84, 112, 112,
- /* 1370 */ 112, 112, 112, 112, 112, 112, 93, 94, 95, 96,
- /* 1380 */ 97, 98, 112, 81, 101, 102, 84, 112, 112, 112,
- /* 1390 */ 112, 112, 112, 112, 112, 93, 94, 95, 96, 97,
- /* 1400 */ 98, 112, 81, 101, 102, 84, 112, 112, 112, 112,
- /* 1410 */ 112, 112, 112, 112, 93, 94, 95, 96, 97, 98,
- /* 1420 */ 112, 81, 101, 102, 84, 112, 112, 112, 112, 112,
- /* 1430 */ 81, 112, 112, 84, 94, 95, 96, 97, 98, 112,
- /* 1440 */ 112, 101, 102, 94, 95, 96, 97, 98, 112, 81,
- /* 1450 */ 101, 102, 84, 112, 112, 112, 112, 112, 81, 112,
- /* 1460 */ 112, 84, 112, 95, 96, 97, 98, 112, 81, 101,
- /* 1470 */ 102, 84, 95, 96, 97, 98, 112, 81, 101, 102,
- /* 1480 */ 84, 112, 95, 96, 97, 98, 112, 81, 101, 102,
- /* 1490 */ 84, 95, 96, 97, 98, 112, 81, 101, 102, 84,
- /* 1500 */ 112, 95, 96, 97, 98, 112, 81, 101, 102, 84,
- /* 1510 */ 95, 96, 97, 98, 112, 81, 101, 102, 84, 112,
- /* 1520 */ 95, 96, 97, 98, 112, 81, 101, 102, 84, 95,
- /* 1530 */ 96, 97, 98, 112, 81, 101, 102, 84, 112, 95,
- /* 1540 */ 96, 97, 98, 112, 112, 101, 102, 112, 95, 96,
- /* 1550 */ 97, 98, 112, 81, 101, 102, 84, 112, 112, 112,
- /* 1560 */ 112, 81, 112, 112, 84, 112, 112, 95, 96, 97,
- /* 1570 */ 98, 112, 112, 101, 102, 95, 96, 97, 98, 112,
- /* 1580 */ 81, 101, 102, 84, 112, 112, 112, 112, 81, 112,
- /* 1590 */ 112, 84, 112, 112, 95, 96, 97, 98, 112, 112,
- /* 1600 */ 101, 102, 95, 96, 97, 98, 112, 112, 101, 102,
+ /* 120 */ 95, 96, 97, 98, 99, 111, 112, 102, 103, 32,
+ /* 130 */ 33, 106, 53, 54, 55, 70, 29, 72, 51, 52,
+ /* 140 */ 31, 5, 51, 52, 12, 30, 14, 56, 57, 58,
+ /* 150 */ 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
+ /* 160 */ 69, 70, 7, 27, 53, 10, 11, 57, 58, 14,
+ /* 170 */ 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
+ /* 180 */ 92, 93, 94, 95, 96, 97, 98, 99, 111, 112,
+ /* 190 */ 102, 103, 104, 105, 3, 4, 5, 6, 7, 8,
+ /* 200 */ 9, 10, 11, 10, 13, 28, 51, 52, 0, 14,
+ /* 210 */ 10, 56, 57, 58, 59, 60, 61, 62, 63, 64,
+ /* 220 */ 65, 66, 67, 68, 69, 70, 71, 7, 100, 101,
+ /* 230 */ 10, 11, 79, 65, 14, 82, 83, 84, 85, 86,
+ /* 240 */ 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
+ /* 250 */ 97, 98, 99, 0, 0, 102, 103, 39, 65, 51,
+ /* 260 */ 67, 107, 108, 110, 67, 106, 71, 14, 14, 104,
+ /* 270 */ 81, 51, 52, 81, 10, 81, 56, 57, 58, 59,
+ /* 280 */ 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
+ /* 290 */ 70, 71, 7, 78, 81, 10, 11, 82, 83, 84,
+ /* 300 */ 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
+ /* 310 */ 95, 96, 97, 98, 99, 81, 81, 102, 103, 113,
+ /* 320 */ 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
+ /* 330 */ 44, 45, 46, 47, 113, 113, 51, 52, 53, 113,
+ /* 340 */ 113, 56, 57, 58, 59, 60, 61, 62, 63, 64,
+ /* 350 */ 65, 66, 67, 68, 69, 70, 78, 113, 73, 113,
+ /* 360 */ 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
+ /* 370 */ 92, 93, 94, 95, 96, 97, 98, 99, 78, 113,
+ /* 380 */ 102, 103, 82, 83, 84, 85, 86, 87, 88, 89,
+ /* 390 */ 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
+ /* 400 */ 113, 113, 102, 103, 0, 113, 113, 3, 4, 5,
+ /* 410 */ 6, 7, 113, 9, 10, 11, 113, 13, 113, 82,
+ /* 420 */ 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
+ /* 430 */ 93, 94, 95, 96, 97, 98, 99, 113, 7, 102,
+ /* 440 */ 103, 10, 11, 113, 113, 14, 109, 82, 83, 84,
+ /* 450 */ 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
+ /* 460 */ 95, 96, 97, 98, 99, 113, 7, 102, 103, 10,
+ /* 470 */ 11, 113, 113, 113, 113, 110, 113, 113, 113, 113,
+ /* 480 */ 113, 113, 51, 52, 113, 113, 113, 56, 57, 58,
+ /* 490 */ 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
+ /* 500 */ 69, 70, 113, 113, 113, 113, 113, 113, 113, 113,
+ /* 510 */ 51, 52, 113, 113, 113, 56, 57, 58, 59, 60,
+ /* 520 */ 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
+ /* 530 */ 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
+ /* 540 */ 92, 93, 94, 95, 96, 97, 98, 99, 113, 113,
+ /* 550 */ 102, 103, 82, 83, 84, 85, 86, 87, 88, 89,
+ /* 560 */ 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
+ /* 570 */ 113, 113, 102, 103, 82, 83, 84, 85, 86, 87,
+ /* 580 */ 88, 89, 90, 91, 92, 93, 94, 95, 96, 97,
+ /* 590 */ 98, 99, 113, 113, 102, 103, 113, 113, 82, 83,
+ /* 600 */ 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
+ /* 610 */ 94, 95, 96, 97, 98, 99, 113, 113, 102, 103,
+ /* 620 */ 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
+ /* 630 */ 92, 93, 94, 95, 96, 97, 98, 99, 113, 113,
+ /* 640 */ 102, 103, 82, 83, 84, 85, 86, 87, 88, 89,
+ /* 650 */ 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
+ /* 660 */ 113, 113, 102, 103, 82, 83, 84, 85, 86, 87,
+ /* 670 */ 88, 89, 90, 91, 92, 93, 94, 95, 96, 97,
+ /* 680 */ 98, 99, 113, 113, 102, 103, 82, 83, 84, 85,
+ /* 690 */ 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
+ /* 700 */ 96, 97, 98, 99, 113, 113, 102, 103, 82, 83,
+ /* 710 */ 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
+ /* 720 */ 94, 95, 96, 97, 98, 99, 113, 113, 102, 103,
+ /* 730 */ 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
+ /* 740 */ 92, 93, 94, 95, 96, 97, 98, 99, 113, 113,
+ /* 750 */ 102, 103, 82, 83, 84, 85, 86, 87, 88, 89,
+ /* 760 */ 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
+ /* 770 */ 113, 113, 102, 103, 82, 83, 84, 85, 86, 87,
+ /* 780 */ 88, 89, 90, 91, 92, 93, 94, 95, 96, 97,
+ /* 790 */ 98, 99, 113, 113, 102, 103, 82, 83, 84, 85,
+ /* 800 */ 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
+ /* 810 */ 96, 97, 98, 99, 113, 113, 102, 103, 82, 83,
+ /* 820 */ 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
+ /* 830 */ 94, 95, 96, 97, 98, 99, 113, 113, 102, 103,
+ /* 840 */ 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
+ /* 850 */ 92, 93, 94, 95, 96, 97, 98, 99, 113, 113,
+ /* 860 */ 102, 103, 82, 83, 84, 85, 86, 87, 88, 89,
+ /* 870 */ 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
+ /* 880 */ 113, 113, 102, 103, 82, 83, 84, 85, 86, 87,
+ /* 890 */ 88, 89, 90, 91, 92, 93, 94, 95, 96, 97,
+ /* 900 */ 98, 99, 113, 113, 102, 103, 82, 83, 84, 85,
+ /* 910 */ 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
+ /* 920 */ 96, 97, 98, 99, 113, 113, 102, 103, 82, 83,
+ /* 930 */ 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
+ /* 940 */ 94, 95, 96, 97, 98, 99, 113, 82, 102, 103,
+ /* 950 */ 85, 113, 87, 88, 89, 90, 91, 92, 93, 94,
+ /* 960 */ 95, 96, 97, 98, 99, 113, 82, 102, 103, 85,
+ /* 970 */ 113, 113, 88, 89, 90, 91, 92, 93, 94, 95,
+ /* 980 */ 96, 97, 98, 99, 113, 113, 102, 103, 82, 113,
+ /* 990 */ 113, 85, 113, 113, 88, 89, 90, 91, 92, 93,
+ /* 1000 */ 94, 95, 96, 97, 98, 99, 113, 113, 102, 103,
+ /* 1010 */ 82, 113, 113, 85, 113, 113, 113, 89, 90, 91,
+ /* 1020 */ 92, 93, 94, 95, 96, 97, 98, 99, 113, 113,
+ /* 1030 */ 102, 103, 113, 15, 16, 17, 18, 19, 20, 21,
+ /* 1040 */ 22, 23, 24, 25, 26, 82, 113, 113, 85, 113,
+ /* 1050 */ 113, 113, 113, 90, 91, 92, 93, 94, 95, 96,
+ /* 1060 */ 97, 98, 99, 113, 113, 102, 103, 113, 113, 82,
+ /* 1070 */ 113, 113, 85, 113, 113, 57, 58, 113, 91, 92,
+ /* 1080 */ 93, 94, 95, 96, 97, 98, 99, 113, 82, 102,
+ /* 1090 */ 103, 85, 7, 113, 113, 10, 11, 113, 92, 93,
+ /* 1100 */ 94, 95, 96, 97, 98, 99, 113, 82, 102, 103,
+ /* 1110 */ 85, 113, 113, 113, 113, 113, 113, 92, 93, 94,
+ /* 1120 */ 95, 96, 97, 98, 99, 113, 82, 102, 103, 85,
+ /* 1130 */ 113, 113, 113, 113, 113, 113, 113, 93, 94, 95,
+ /* 1140 */ 96, 97, 98, 99, 113, 82, 102, 103, 85, 113,
+ /* 1150 */ 65, 66, 67, 68, 69, 70, 93, 94, 95, 96,
+ /* 1160 */ 97, 98, 99, 113, 82, 102, 103, 85, 113, 113,
+ /* 1170 */ 113, 113, 113, 113, 113, 93, 94, 95, 96, 97,
+ /* 1180 */ 98, 99, 113, 82, 102, 103, 85, 113, 113, 113,
+ /* 1190 */ 113, 113, 113, 113, 93, 94, 95, 96, 97, 98,
+ /* 1200 */ 99, 113, 82, 102, 103, 85, 113, 113, 113, 113,
+ /* 1210 */ 113, 113, 113, 93, 94, 95, 96, 97, 98, 99,
+ /* 1220 */ 113, 82, 102, 103, 85, 113, 113, 113, 113, 113,
+ /* 1230 */ 113, 113, 93, 94, 95, 96, 97, 98, 99, 113,
+ /* 1240 */ 82, 102, 103, 85, 113, 113, 113, 113, 113, 113,
+ /* 1250 */ 113, 93, 94, 95, 96, 97, 98, 99, 113, 82,
+ /* 1260 */ 102, 103, 85, 113, 113, 113, 113, 113, 113, 113,
+ /* 1270 */ 93, 94, 95, 96, 97, 98, 99, 113, 82, 102,
+ /* 1280 */ 103, 85, 113, 113, 113, 113, 113, 113, 113, 93,
+ /* 1290 */ 94, 95, 96, 97, 98, 99, 113, 82, 102, 103,
+ /* 1300 */ 85, 113, 113, 113, 113, 113, 113, 113, 93, 94,
+ /* 1310 */ 95, 96, 97, 98, 99, 113, 82, 102, 103, 85,
+ /* 1320 */ 113, 113, 113, 113, 113, 113, 113, 93, 94, 95,
+ /* 1330 */ 96, 97, 98, 99, 113, 82, 102, 103, 85, 113,
+ /* 1340 */ 113, 113, 113, 113, 113, 113, 93, 94, 95, 96,
+ /* 1350 */ 97, 98, 99, 113, 82, 102, 103, 85, 113, 113,
+ /* 1360 */ 113, 113, 113, 113, 113, 93, 94, 95, 96, 97,
+ /* 1370 */ 98, 99, 113, 82, 102, 103, 85, 113, 113, 113,
+ /* 1380 */ 113, 113, 113, 113, 93, 94, 95, 96, 97, 98,
+ /* 1390 */ 99, 113, 82, 102, 103, 85, 113, 113, 113, 113,
+ /* 1400 */ 113, 113, 113, 113, 94, 95, 96, 97, 98, 99,
+ /* 1410 */ 113, 82, 102, 103, 85, 113, 113, 113, 113, 113,
+ /* 1420 */ 113, 113, 113, 94, 95, 96, 97, 98, 99, 113,
+ /* 1430 */ 82, 102, 103, 85, 113, 113, 113, 113, 113, 113,
+ /* 1440 */ 113, 113, 94, 95, 96, 97, 98, 99, 113, 82,
+ /* 1450 */ 102, 103, 85, 113, 113, 113, 113, 113, 82, 113,
+ /* 1460 */ 113, 85, 95, 96, 97, 98, 99, 113, 113, 102,
+ /* 1470 */ 103, 95, 96, 97, 98, 99, 113, 82, 102, 103,
+ /* 1480 */ 85, 113, 113, 113, 113, 113, 113, 82, 113, 113,
+ /* 1490 */ 85, 96, 97, 98, 99, 113, 82, 102, 103, 85,
+ /* 1500 */ 113, 96, 97, 98, 99, 113, 82, 102, 103, 85,
+ /* 1510 */ 96, 97, 98, 99, 113, 82, 102, 103, 85, 113,
+ /* 1520 */ 96, 97, 98, 99, 113, 82, 102, 103, 85, 96,
+ /* 1530 */ 97, 98, 99, 113, 82, 102, 103, 85, 113, 96,
+ /* 1540 */ 97, 98, 99, 113, 82, 102, 103, 85, 96, 97,
+ /* 1550 */ 98, 99, 113, 82, 102, 103, 85, 113, 96, 97,
+ /* 1560 */ 98, 99, 113, 82, 102, 103, 85, 96, 97, 98,
+ /* 1570 */ 99, 113, 113, 102, 103, 113, 113, 96, 97, 98,
+ /* 1580 */ 99, 113, 82, 102, 103, 85, 113, 113, 113, 113,
+ /* 1590 */ 82, 113, 113, 85, 113, 113, 96, 97, 98, 99,
+ /* 1600 */ 113, 113, 102, 103, 96, 97, 98, 99, 113, 82,
+ /* 1610 */ 102, 103, 85, 113, 113, 113, 113, 82, 113, 113,
+ /* 1620 */ 85, 113, 113, 96, 97, 98, 99, 113, 113, 102,
+ /* 1630 */ 103, 96, 97, 98, 99, 113, 113, 102, 103,
};
-#define YY_SHIFT_USE_DFLT (-46)
-#define YY_SHIFT_COUNT (138)
-#define YY_SHIFT_MIN (-45)
-#define YY_SHIFT_MAX (1076)
+#define YY_SHIFT_USE_DFLT (-47)
+#define YY_SHIFT_COUNT (140)
+#define YY_SHIFT_MIN (-46)
+#define YY_SHIFT_MAX (1085)
static const short yy_shift_ofst[] = {
- /* 0 */ -1, 90, 281, 425, 453, 281, 453, 453, 453, 453,
- /* 10 */ 217, 153, 453, 453, 453, 453, 453, 453, 453, 453,
- /* 20 */ 453, 453, 453, 453, 453, 453, 453, 453, 453, 453,
- /* 30 */ 453, 453, 453, 453, 453, 453, 453, 453, 453, 453,
- /* 40 */ 453, 453, 453, 453, 453, 453, 453, 453, 453, 453,
- /* 50 */ 453, 453, 453, 453, 453, 453, 453, 453, 453, 453,
- /* 60 */ 453, 453, 453, 453, 453, 453, 453, 453, 453, 1076,
- /* 70 */ 259, 35, 191, 65, 259, 189, 399, 35, 35, 35,
- /* 80 */ 35, 35, 493, -46, 1010, 282, 282, 282, -45, -45,
- /* 90 */ -45, -45, -45, -45, -45, -45, -45, -45, -45, 79,
- /* 100 */ -45, 79, -45, 79, -45, 261, 315, 251, 101, 242,
- /* 110 */ 193, 92, 92, 84, 92, 96, 192, 81, 92, 96,
- /* 120 */ 101, 134, 39, 7, 197, 105, 190, 178, 18, 152,
- /* 130 */ 107, 40, 22, 18, 40, 22, 18, 15, 7,
+ /* 0 */ -1, 91, 285, 431, 459, 285, 459, 459, 459, 459,
+ /* 10 */ 220, 155, 459, 459, 459, 459, 459, 459, 459, 459,
+ /* 20 */ 459, 459, 459, 459, 459, 459, 459, 459, 459, 459,
+ /* 30 */ 459, 459, 459, 459, 459, 459, 459, 459, 459, 459,
+ /* 40 */ 459, 459, 459, 459, 459, 459, 459, 459, 459, 459,
+ /* 50 */ 459, 459, 459, 459, 459, 459, 459, 459, 459, 459,
+ /* 60 */ 459, 459, 459, 459, 459, 459, 459, 459, 459, 459,
+ /* 70 */ 1085, 264, 35, 193, 65, 264, 191, 404, 35, 35,
+ /* 80 */ 35, 35, 35, 195, -47, 286, 286, 286, 1018, -46,
+ /* 90 */ -46, -46, -46, -46, -46, -46, -46, -46, -46, -46,
+ /* 100 */ -46, 79, -46, 79, -46, 79, -46, 208, 254, 253,
+ /* 110 */ 102, 85, 132, 87, 87, 39, 87, 97, 2, 110,
+ /* 120 */ 87, 97, 102, 136, 40, 34, 197, 218, 168, 111,
+ /* 130 */ 107, 200, 177, 109, 115, 107, 109, 115, 107, 21,
+ /* 140 */ 34,
};
-#define YY_REDUCE_USE_DFLT (-70)
-#define YY_REDUCE_COUNT (83)
-#define YY_REDUCE_MIN (-69)
-#define YY_REDUCE_MAX (1507)
+#define YY_REDUCE_USE_DFLT (-71)
+#define YY_REDUCE_COUNT (84)
+#define YY_REDUCE_MIN (-70)
+#define YY_REDUCE_MAX (1535)
static const short yy_reduce_ofst[] = {
- /* 0 */ -62, -7, 151, 87, 25, 360, 332, 296, 274, 212,
- /* 10 */ 839, 817, 795, 773, 751, 729, 707, 685, 663, 641,
- /* 20 */ 619, 597, 575, 553, 531, 509, 486, 464, 442, 858,
- /* 30 */ 899, 877, 921, 956, 979, 1017, 998, 1264, 1245, 1226,
- /* 40 */ 1207, 1188, 1169, 1150, 1131, 1112, 1093, 1074, 1055, 1036,
- /* 50 */ 1321, 1302, 1283, 1349, 1340, 1507, 1499, 1480, 1472, 1453,
- /* 60 */ 1444, 1434, 1425, 1415, 1406, 1396, 1387, 1377, 1368, -64,
- /* 70 */ 14, -69, 80, 126, 55, 254, 254, 250, 232, 210,
- /* 80 */ 186, 184, 155, 154,
+ /* 0 */ -63, -7, 153, 88, 25, 365, 337, 300, 278, 215,
+ /* 10 */ 846, 824, 802, 780, 758, 736, 714, 692, 670, 648,
+ /* 20 */ 626, 604, 582, 560, 538, 516, 492, 470, 448, 865,
+ /* 30 */ 906, 884, 928, 963, 987, 1025, 1006, 1291, 1272, 1253,
+ /* 40 */ 1234, 1215, 1196, 1177, 1158, 1139, 1120, 1101, 1082, 1063,
+ /* 50 */ 1044, 1348, 1329, 1310, 1376, 1367, 1535, 1527, 1508, 1500,
+ /* 60 */ 1481, 1471, 1462, 1452, 1443, 1433, 1424, 1414, 1405, 1395,
+ /* 70 */ -65, 14, -70, 154, 128, 77, 235, 235, 234, 213,
+ /* 80 */ 194, 192, 189, 165, 159,
};
static const YYACTIONTYPE yy_default[] = {
- /* 0 */ 354, 354, 342, 354, 332, 354, 339, 354, 354, 354,
- /* 10 */ 354, 354, 354, 354, 354, 354, 354, 354, 354, 354,
- /* 20 */ 354, 354, 354, 354, 354, 354, 354, 354, 354, 354,
- /* 30 */ 354, 354, 354, 354, 354, 354, 354, 354, 354, 354,
- /* 40 */ 354, 354, 354, 354, 354, 354, 354, 354, 354, 354,
- /* 50 */ 354, 354, 354, 354, 354, 354, 354, 354, 354, 354,
- /* 60 */ 354, 354, 354, 354, 354, 354, 354, 354, 354, 354,
- /* 70 */ 348, 354, 354, 310, 354, 354, 354, 354, 354, 354,
- /* 80 */ 354, 354, 354, 332, 306, 266, 268, 267, 282, 281,
- /* 90 */ 280, 279, 278, 277, 276, 275, 274, 273, 269, 287,
- /* 100 */ 272, 289, 271, 288, 270, 354, 354, 354, 256, 354,
- /* 110 */ 354, 283, 286, 354, 285, 264, 354, 306, 284, 265,
- /* 120 */ 255, 253, 354, 316, 354, 354, 354, 351, 259, 354,
- /* 130 */ 354, 262, 260, 257, 263, 261, 258, 354, 354, 349,
- /* 140 */ 353, 352, 350, 343, 347, 346, 345, 344, 233, 231,
- /* 150 */ 237, 252, 251, 250, 249, 248, 247, 246, 245, 244,
- /* 160 */ 243, 242, 340, 341, 338, 337, 328, 326, 325, 330,
- /* 170 */ 324, 335, 334, 333, 331, 329, 327, 323, 290, 322,
- /* 180 */ 321, 320, 319, 318, 317, 316, 293, 315, 314, 312,
- /* 190 */ 292, 336, 238, 313, 311, 309, 308, 307, 305, 304,
- /* 200 */ 303, 302, 301, 300, 299, 298, 297, 296, 295, 294,
- /* 210 */ 291, 254, 241, 240, 239, 236, 235, 234, 230, 227,
- /* 220 */ 232, 229, 228,
+ /* 0 */ 357, 357, 345, 357, 335, 357, 342, 357, 357, 357,
+ /* 10 */ 357, 357, 357, 357, 357, 357, 357, 357, 357, 357,
+ /* 20 */ 357, 357, 357, 357, 357, 357, 357, 357, 357, 357,
+ /* 30 */ 357, 357, 357, 357, 357, 357, 357, 357, 357, 357,
+ /* 40 */ 357, 357, 357, 357, 357, 357, 357, 357, 357, 357,
+ /* 50 */ 357, 357, 357, 357, 357, 357, 357, 357, 357, 357,
+ /* 60 */ 357, 357, 357, 357, 357, 357, 357, 357, 357, 357,
+ /* 70 */ 357, 351, 357, 357, 313, 357, 357, 357, 357, 357,
+ /* 80 */ 357, 357, 357, 357, 335, 268, 270, 269, 309, 285,
+ /* 90 */ 284, 283, 282, 281, 280, 279, 278, 277, 276, 275,
+ /* 100 */ 271, 290, 274, 292, 273, 291, 272, 357, 357, 357,
+ /* 110 */ 258, 357, 357, 286, 289, 357, 288, 266, 357, 309,
+ /* 120 */ 287, 267, 257, 255, 357, 319, 357, 357, 357, 354,
+ /* 130 */ 261, 357, 357, 264, 262, 259, 265, 263, 260, 357,
+ /* 140 */ 357, 352, 356, 355, 353, 346, 350, 349, 348, 347,
+ /* 150 */ 235, 233, 239, 254, 253, 252, 251, 250, 249, 248,
+ /* 160 */ 247, 246, 245, 244, 343, 344, 341, 340, 331, 329,
+ /* 170 */ 328, 333, 327, 338, 337, 336, 334, 332, 330, 326,
+ /* 180 */ 293, 325, 324, 323, 322, 321, 320, 319, 296, 318,
+ /* 190 */ 317, 315, 295, 339, 240, 316, 314, 312, 311, 310,
+ /* 200 */ 308, 307, 306, 305, 304, 303, 302, 301, 300, 299,
+ /* 210 */ 298, 297, 294, 256, 243, 242, 241, 238, 237, 236,
+ /* 220 */ 232, 229, 234, 231, 230,
};
/* The next table maps tokens into fallback tokens. If a construct
@@ -632,23 +639,24 @@ static const char *const yyTokenName[] = {
"EQUAL", "NOT_EQUAL", "LESS", "GREATER",
"LESS_EQUAL", "GREATER_EQUAL", "IN", "MATCH",
"NEAR", "NEAR2", "SIMILAR", "TERM_EXTRACT",
- "LCP", "PREFIX", "SUFFIX", "SHIFTL",
- "SHIFTR", "SHIFTRR", "PLUS", "MINUS",
- "STAR", "SLASH", "MOD", "DELETE",
- "INCR", "DECR", "NOT", "BITWISE_NOT",
- "ADJUST", "EXACT", "PARTIAL", "UNSPLIT",
- "DECIMAL", "HEX_INTEGER", "STRING", "BOOLEAN",
- "NULL", "BRACKETL", "BRACKETR", "DOT",
- "NONEXISTENT_COLUMN", "error", "suppress_unused_variable_warning", "input",
- "query", "expression", "output_columns", "adjuster",
- "query_element", "primary_expression", "assignment_expression", "conditional_expression",
- "lefthand_side_expression", "logical_or_expression", "logical_and_expression", "bitwise_or_expression",
- "bitwise_xor_expression", "bitwise_and_expression", "equality_expression", "relational_expression",
- "shift_expression", "additive_expression", "multiplicative_expression", "unary_expression",
- "postfix_expression", "call_expression", "member_expression", "arguments",
- "member_expression_part", "object_literal", "array_literal", "elision",
- "element_list", "property_name_and_value_list", "property_name_and_value", "property_name",
- "argument_list", "output_column", "adjust_expression", "adjust_match_expression",
+ "LCP", "PREFIX", "SUFFIX", "REGEXP",
+ "SHIFTL", "SHIFTR", "SHIFTRR", "PLUS",
+ "MINUS", "STAR", "SLASH", "MOD",
+ "DELETE", "INCR", "DECR", "NOT",
+ "BITWISE_NOT", "ADJUST", "EXACT", "PARTIAL",
+ "UNSPLIT", "DECIMAL", "HEX_INTEGER", "STRING",
+ "BOOLEAN", "NULL", "BRACKETL", "BRACKETR",
+ "DOT", "NONEXISTENT_COLUMN", "error", "suppress_unused_variable_warning",
+ "input", "query", "expression", "output_columns",
+ "adjuster", "query_element", "primary_expression", "assignment_expression",
+ "conditional_expression", "lefthand_side_expression", "logical_or_expression", "logical_and_expression",
+ "bitwise_or_expression", "bitwise_xor_expression", "bitwise_and_expression", "equality_expression",
+ "relational_expression", "shift_expression", "additive_expression", "multiplicative_expression",
+ "unary_expression", "postfix_expression", "call_expression", "member_expression",
+ "arguments", "member_expression_part", "object_literal", "array_literal",
+ "elision", "element_list", "property_name_and_value_list", "property_name_and_value",
+ "property_name", "argument_list", "output_column", "adjust_expression",
+ "adjust_match_expression",
};
#endif /* NDEBUG */
@@ -716,77 +724,78 @@ static const char *const yyRuleName[] = {
/* 57 */ "relational_expression ::= relational_expression LCP shift_expression",
/* 58 */ "relational_expression ::= relational_expression PREFIX shift_expression",
/* 59 */ "relational_expression ::= relational_expression SUFFIX shift_expression",
- /* 60 */ "shift_expression ::= additive_expression",
- /* 61 */ "shift_expression ::= shift_expression SHIFTL additive_expression",
- /* 62 */ "shift_expression ::= shift_expression SHIFTR additive_expression",
- /* 63 */ "shift_expression ::= shift_expression SHIFTRR additive_expression",
- /* 64 */ "additive_expression ::= multiplicative_expression",
- /* 65 */ "additive_expression ::= additive_expression PLUS multiplicative_expression",
- /* 66 */ "additive_expression ::= additive_expression MINUS multiplicative_expression",
- /* 67 */ "multiplicative_expression ::= unary_expression",
- /* 68 */ "multiplicative_expression ::= multiplicative_expression STAR unary_expression",
- /* 69 */ "multiplicative_expression ::= multiplicative_expression SLASH unary_expression",
- /* 70 */ "multiplicative_expression ::= multiplicative_expression MOD unary_expression",
- /* 71 */ "unary_expression ::= postfix_expression",
- /* 72 */ "unary_expression ::= DELETE unary_expression",
- /* 73 */ "unary_expression ::= INCR unary_expression",
- /* 74 */ "unary_expression ::= DECR unary_expression",
- /* 75 */ "unary_expression ::= PLUS unary_expression",
- /* 76 */ "unary_expression ::= MINUS unary_expression",
- /* 77 */ "unary_expression ::= NOT unary_expression",
- /* 78 */ "unary_expression ::= BITWISE_NOT unary_expression",
- /* 79 */ "unary_expression ::= ADJUST unary_expression",
- /* 80 */ "unary_expression ::= EXACT unary_expression",
- /* 81 */ "unary_expression ::= PARTIAL unary_expression",
- /* 82 */ "unary_expression ::= UNSPLIT unary_expression",
- /* 83 */ "postfix_expression ::= lefthand_side_expression",
- /* 84 */ "postfix_expression ::= lefthand_side_expression INCR",
- /* 85 */ "postfix_expression ::= lefthand_side_expression DECR",
- /* 86 */ "lefthand_side_expression ::= call_expression",
- /* 87 */ "lefthand_side_expression ::= member_expression",
- /* 88 */ "call_expression ::= member_expression arguments",
- /* 89 */ "member_expression ::= primary_expression",
- /* 90 */ "member_expression ::= member_expression member_expression_part",
- /* 91 */ "primary_expression ::= object_literal",
- /* 92 */ "primary_expression ::= PARENL expression PARENR",
- /* 93 */ "primary_expression ::= IDENTIFIER",
- /* 94 */ "primary_expression ::= array_literal",
- /* 95 */ "primary_expression ::= DECIMAL",
- /* 96 */ "primary_expression ::= HEX_INTEGER",
- /* 97 */ "primary_expression ::= STRING",
- /* 98 */ "primary_expression ::= BOOLEAN",
- /* 99 */ "primary_expression ::= NULL",
- /* 100 */ "array_literal ::= BRACKETL elision BRACKETR",
- /* 101 */ "array_literal ::= BRACKETL element_list elision BRACKETR",
- /* 102 */ "array_literal ::= BRACKETL element_list BRACKETR",
- /* 103 */ "elision ::= COMMA",
- /* 104 */ "elision ::= elision COMMA",
- /* 105 */ "element_list ::= assignment_expression",
- /* 106 */ "element_list ::= elision assignment_expression",
- /* 107 */ "element_list ::= element_list elision assignment_expression",
- /* 108 */ "object_literal ::= BRACEL property_name_and_value_list BRACER",
- /* 109 */ "property_name_and_value_list ::=",
- /* 110 */ "property_name_and_value_list ::= property_name_and_value_list COMMA property_name_and_value",
- /* 111 */ "property_name_and_value ::= property_name COLON assignment_expression",
- /* 112 */ "property_name ::= IDENTIFIER|STRING|DECIMAL",
- /* 113 */ "member_expression_part ::= BRACKETL expression BRACKETR",
- /* 114 */ "member_expression_part ::= DOT IDENTIFIER",
- /* 115 */ "arguments ::= PARENL argument_list PARENR",
- /* 116 */ "argument_list ::=",
- /* 117 */ "argument_list ::= assignment_expression",
- /* 118 */ "argument_list ::= argument_list COMMA assignment_expression",
- /* 119 */ "output_columns ::=",
- /* 120 */ "output_columns ::= output_column",
- /* 121 */ "output_columns ::= output_columns COMMA output_column",
- /* 122 */ "output_column ::= STAR",
- /* 123 */ "output_column ::= NONEXISTENT_COLUMN",
- /* 124 */ "output_column ::= assignment_expression",
- /* 125 */ "adjuster ::=",
- /* 126 */ "adjuster ::= adjust_expression",
- /* 127 */ "adjuster ::= adjuster PLUS adjust_expression",
- /* 128 */ "adjust_expression ::= adjust_match_expression",
- /* 129 */ "adjust_expression ::= adjust_match_expression STAR DECIMAL",
- /* 130 */ "adjust_match_expression ::= IDENTIFIER MATCH STRING",
+ /* 60 */ "relational_expression ::= relational_expression REGEXP shift_expression",
+ /* 61 */ "shift_expression ::= additive_expression",
+ /* 62 */ "shift_expression ::= shift_expression SHIFTL additive_expression",
+ /* 63 */ "shift_expression ::= shift_expression SHIFTR additive_expression",
+ /* 64 */ "shift_expression ::= shift_expression SHIFTRR additive_expression",
+ /* 65 */ "additive_expression ::= multiplicative_expression",
+ /* 66 */ "additive_expression ::= additive_expression PLUS multiplicative_expression",
+ /* 67 */ "additive_expression ::= additive_expression MINUS multiplicative_expression",
+ /* 68 */ "multiplicative_expression ::= unary_expression",
+ /* 69 */ "multiplicative_expression ::= multiplicative_expression STAR unary_expression",
+ /* 70 */ "multiplicative_expression ::= multiplicative_expression SLASH unary_expression",
+ /* 71 */ "multiplicative_expression ::= multiplicative_expression MOD unary_expression",
+ /* 72 */ "unary_expression ::= postfix_expression",
+ /* 73 */ "unary_expression ::= DELETE unary_expression",
+ /* 74 */ "unary_expression ::= INCR unary_expression",
+ /* 75 */ "unary_expression ::= DECR unary_expression",
+ /* 76 */ "unary_expression ::= PLUS unary_expression",
+ /* 77 */ "unary_expression ::= MINUS unary_expression",
+ /* 78 */ "unary_expression ::= NOT unary_expression",
+ /* 79 */ "unary_expression ::= BITWISE_NOT unary_expression",
+ /* 80 */ "unary_expression ::= ADJUST unary_expression",
+ /* 81 */ "unary_expression ::= EXACT unary_expression",
+ /* 82 */ "unary_expression ::= PARTIAL unary_expression",
+ /* 83 */ "unary_expression ::= UNSPLIT unary_expression",
+ /* 84 */ "postfix_expression ::= lefthand_side_expression",
+ /* 85 */ "postfix_expression ::= lefthand_side_expression INCR",
+ /* 86 */ "postfix_expression ::= lefthand_side_expression DECR",
+ /* 87 */ "lefthand_side_expression ::= call_expression",
+ /* 88 */ "lefthand_side_expression ::= member_expression",
+ /* 89 */ "call_expression ::= member_expression arguments",
+ /* 90 */ "member_expression ::= primary_expression",
+ /* 91 */ "member_expression ::= member_expression member_expression_part",
+ /* 92 */ "primary_expression ::= object_literal",
+ /* 93 */ "primary_expression ::= PARENL expression PARENR",
+ /* 94 */ "primary_expression ::= IDENTIFIER",
+ /* 95 */ "primary_expression ::= array_literal",
+ /* 96 */ "primary_expression ::= DECIMAL",
+ /* 97 */ "primary_expression ::= HEX_INTEGER",
+ /* 98 */ "primary_expression ::= STRING",
+ /* 99 */ "primary_expression ::= BOOLEAN",
+ /* 100 */ "primary_expression ::= NULL",
+ /* 101 */ "array_literal ::= BRACKETL elision BRACKETR",
+ /* 102 */ "array_literal ::= BRACKETL element_list elision BRACKETR",
+ /* 103 */ "array_literal ::= BRACKETL element_list BRACKETR",
+ /* 104 */ "elision ::= COMMA",
+ /* 105 */ "elision ::= elision COMMA",
+ /* 106 */ "element_list ::= assignment_expression",
+ /* 107 */ "element_list ::= elision assignment_expression",
+ /* 108 */ "element_list ::= element_list elision assignment_expression",
+ /* 109 */ "object_literal ::= BRACEL property_name_and_value_list BRACER",
+ /* 110 */ "property_name_and_value_list ::=",
+ /* 111 */ "property_name_and_value_list ::= property_name_and_value_list COMMA property_name_and_value",
+ /* 112 */ "property_name_and_value ::= property_name COLON assignment_expression",
+ /* 113 */ "property_name ::= IDENTIFIER|STRING|DECIMAL",
+ /* 114 */ "member_expression_part ::= BRACKETL expression BRACKETR",
+ /* 115 */ "member_expression_part ::= DOT IDENTIFIER",
+ /* 116 */ "arguments ::= PARENL argument_list PARENR",
+ /* 117 */ "argument_list ::=",
+ /* 118 */ "argument_list ::= assignment_expression",
+ /* 119 */ "argument_list ::= argument_list COMMA assignment_expression",
+ /* 120 */ "output_columns ::=",
+ /* 121 */ "output_columns ::= output_column",
+ /* 122 */ "output_columns ::= output_columns COMMA output_column",
+ /* 123 */ "output_column ::= STAR",
+ /* 124 */ "output_column ::= NONEXISTENT_COLUMN",
+ /* 125 */ "output_column ::= assignment_expression",
+ /* 126 */ "adjuster ::=",
+ /* 127 */ "adjuster ::= adjust_expression",
+ /* 128 */ "adjuster ::= adjuster PLUS adjust_expression",
+ /* 129 */ "adjust_expression ::= adjust_match_expression",
+ /* 130 */ "adjust_expression ::= adjust_match_expression STAR DECIMAL",
+ /* 131 */ "adjust_match_expression ::= IDENTIFIER MATCH STRING",
};
#endif /* NDEBUG */
@@ -865,13 +874,13 @@ static void yy_destructor(
** which appear on the RHS of the rule, but which are not used
** inside the C code.
*/
- case 74: /* suppress_unused_variable_warning */
+ case 75: /* suppress_unused_variable_warning */
{
-#line 11 "ecmascript.lemon"
+#line 11 "grn_ecmascript.lemon"
(void)efsi;
-#line 875 "ecmascript.c"
+#line 884 "grn_ecmascript.c"
}
break;
default: break; /* If no destructor action specified: do nothing */
@@ -1109,137 +1118,138 @@ static const struct {
YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */
unsigned char nrhs; /* Number of right-hand side symbols in the rule */
} yyRuleInfo[] = {
- { 75, 1 },
- { 75, 1 },
- { 75, 2 },
- { 75, 2 },
+ { 76, 1 },
{ 76, 1 },
{ 76, 2 },
- { 76, 3 },
- { 76, 3 },
- { 76, 3 },
- { 80, 1 },
- { 80, 3 },
- { 80, 2 },
- { 80, 3 },
- { 80, 3 },
- { 80, 2 },
+ { 76, 2 },
{ 77, 1 },
+ { 77, 2 },
{ 77, 3 },
- { 82, 1 },
- { 82, 3 },
- { 82, 3 },
- { 82, 3 },
- { 82, 3 },
- { 82, 3 },
- { 82, 3 },
- { 82, 3 },
- { 82, 3 },
- { 82, 3 },
- { 82, 3 },
- { 82, 3 },
- { 82, 3 },
+ { 77, 3 },
+ { 77, 3 },
+ { 81, 1 },
+ { 81, 3 },
+ { 81, 2 },
+ { 81, 3 },
+ { 81, 3 },
+ { 81, 2 },
+ { 78, 1 },
+ { 78, 3 },
{ 83, 1 },
- { 83, 5 },
- { 85, 1 },
- { 85, 3 },
+ { 83, 3 },
+ { 83, 3 },
+ { 83, 3 },
+ { 83, 3 },
+ { 83, 3 },
+ { 83, 3 },
+ { 83, 3 },
+ { 83, 3 },
+ { 83, 3 },
+ { 83, 3 },
+ { 83, 3 },
+ { 83, 3 },
+ { 84, 1 },
+ { 84, 5 },
{ 86, 1 },
{ 86, 3 },
- { 86, 3 },
{ 87, 1 },
{ 87, 3 },
+ { 87, 3 },
{ 88, 1 },
{ 88, 3 },
{ 89, 1 },
{ 89, 3 },
{ 90, 1 },
{ 90, 3 },
- { 90, 3 },
{ 91, 1 },
{ 91, 3 },
{ 91, 3 },
- { 91, 3 },
- { 91, 3 },
- { 91, 3 },
- { 91, 3 },
- { 91, 3 },
- { 91, 3 },
- { 91, 3 },
- { 91, 3 },
- { 91, 3 },
- { 91, 3 },
- { 91, 3 },
{ 92, 1 },
{ 92, 3 },
{ 92, 3 },
{ 92, 3 },
+ { 92, 3 },
+ { 92, 3 },
+ { 92, 3 },
+ { 92, 3 },
+ { 92, 3 },
+ { 92, 3 },
+ { 92, 3 },
+ { 92, 3 },
+ { 92, 3 },
+ { 92, 3 },
+ { 92, 3 },
{ 93, 1 },
{ 93, 3 },
{ 93, 3 },
+ { 93, 3 },
{ 94, 1 },
{ 94, 3 },
{ 94, 3 },
- { 94, 3 },
{ 95, 1 },
- { 95, 2 },
- { 95, 2 },
- { 95, 2 },
- { 95, 2 },
- { 95, 2 },
- { 95, 2 },
- { 95, 2 },
- { 95, 2 },
- { 95, 2 },
- { 95, 2 },
- { 95, 2 },
+ { 95, 3 },
+ { 95, 3 },
+ { 95, 3 },
{ 96, 1 },
{ 96, 2 },
{ 96, 2 },
- { 84, 1 },
- { 84, 1 },
+ { 96, 2 },
+ { 96, 2 },
+ { 96, 2 },
+ { 96, 2 },
+ { 96, 2 },
+ { 96, 2 },
+ { 96, 2 },
+ { 96, 2 },
+ { 96, 2 },
+ { 97, 1 },
{ 97, 2 },
- { 98, 1 },
+ { 97, 2 },
+ { 85, 1 },
+ { 85, 1 },
{ 98, 2 },
- { 81, 1 },
- { 81, 3 },
- { 81, 1 },
- { 81, 1 },
- { 81, 1 },
- { 81, 1 },
- { 81, 1 },
- { 81, 1 },
- { 81, 1 },
- { 102, 3 },
- { 102, 4 },
- { 102, 3 },
- { 103, 1 },
- { 103, 2 },
+ { 99, 1 },
+ { 99, 2 },
+ { 82, 1 },
+ { 82, 3 },
+ { 82, 1 },
+ { 82, 1 },
+ { 82, 1 },
+ { 82, 1 },
+ { 82, 1 },
+ { 82, 1 },
+ { 82, 1 },
+ { 103, 3 },
+ { 103, 4 },
+ { 103, 3 },
{ 104, 1 },
{ 104, 2 },
- { 104, 3 },
- { 101, 3 },
- { 105, 0 },
+ { 105, 1 },
+ { 105, 2 },
{ 105, 3 },
+ { 102, 3 },
+ { 106, 0 },
{ 106, 3 },
- { 107, 1 },
- { 100, 3 },
- { 100, 2 },
- { 99, 3 },
- { 108, 0 },
+ { 107, 3 },
{ 108, 1 },
- { 108, 3 },
- { 78, 0 },
- { 78, 1 },
- { 78, 3 },
- { 109, 1 },
- { 109, 1 },
+ { 101, 3 },
+ { 101, 2 },
+ { 100, 3 },
+ { 109, 0 },
{ 109, 1 },
+ { 109, 3 },
{ 79, 0 },
{ 79, 1 },
{ 79, 3 },
{ 110, 1 },
- { 110, 3 },
+ { 110, 1 },
+ { 110, 1 },
+ { 80, 0 },
+ { 80, 1 },
+ { 80, 3 },
+ { 111, 1 },
{ 111, 3 },
+ { 112, 3 },
};
static void yy_accept(yyParser*); /* Forward Declaration */
@@ -1295,46 +1305,46 @@ static void yy_reduce(
** break;
*/
case 5: /* query ::= query query_element */
-#line 46 "ecmascript.lemon"
+#line 46 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, grn_int32_value_at(&efsi->op_stack, -1), 2);
}
-#line 1303 "ecmascript.c"
+#line 1313 "grn_ecmascript.c"
break;
case 6: /* query ::= query LOGICAL_AND query_element */
case 35: /* logical_and_expression ::= logical_and_expression LOGICAL_AND bitwise_or_expression */ yytestcase(yyruleno==35);
-#line 49 "ecmascript.lemon"
+#line 49 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_AND, 2);
}
-#line 1311 "ecmascript.c"
+#line 1321 "grn_ecmascript.c"
break;
case 7: /* query ::= query LOGICAL_AND_NOT query_element */
case 36: /* logical_and_expression ::= logical_and_expression LOGICAL_AND_NOT bitwise_or_expression */ yytestcase(yyruleno==36);
-#line 52 "ecmascript.lemon"
+#line 52 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_AND_NOT, 2);
}
-#line 1319 "ecmascript.c"
+#line 1329 "grn_ecmascript.c"
break;
case 8: /* query ::= query LOGICAL_OR query_element */
case 33: /* logical_or_expression ::= logical_or_expression LOGICAL_OR logical_and_expression */ yytestcase(yyruleno==33);
-#line 55 "ecmascript.lemon"
+#line 55 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_OR, 2);
}
-#line 1327 "ecmascript.c"
+#line 1337 "grn_ecmascript.c"
break;
case 11: /* query_element ::= RELATIVE_OP query_element */
-#line 62 "ecmascript.lemon"
+#line 62 "grn_ecmascript.lemon"
{
int mode;
GRN_INT32_POP(&efsi->mode_stack, mode);
}
-#line 1335 "ecmascript.c"
+#line 1345 "grn_ecmascript.c"
break;
case 12: /* query_element ::= IDENTIFIER RELATIVE_OP query_element */
-#line 66 "ecmascript.lemon"
+#line 66 "grn_ecmascript.lemon"
{
int mode;
grn_obj *c;
@@ -1358,310 +1368,317 @@ static void yy_reduce(
break;
}
}
-#line 1362 "ecmascript.c"
+#line 1372 "grn_ecmascript.c"
break;
case 13: /* query_element ::= BRACEL expression BRACER */
case 14: /* query_element ::= EVAL primary_expression */ yytestcase(yyruleno==14);
-#line 89 "ecmascript.lemon"
+#line 89 "grn_ecmascript.lemon"
{
efsi->flags = efsi->default_flags;
}
-#line 1370 "ecmascript.c"
+#line 1380 "grn_ecmascript.c"
break;
case 16: /* expression ::= expression COMMA assignment_expression */
-#line 97 "ecmascript.lemon"
+#line 97 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_COMMA, 2);
}
-#line 1377 "ecmascript.c"
+#line 1387 "grn_ecmascript.c"
break;
case 18: /* assignment_expression ::= lefthand_side_expression ASSIGN assignment_expression */
-#line 102 "ecmascript.lemon"
+#line 102 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_ASSIGN, 2);
}
-#line 1384 "ecmascript.c"
+#line 1394 "grn_ecmascript.c"
break;
case 19: /* assignment_expression ::= lefthand_side_expression STAR_ASSIGN assignment_expression */
-#line 105 "ecmascript.lemon"
+#line 105 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_STAR_ASSIGN, 2);
}
-#line 1391 "ecmascript.c"
+#line 1401 "grn_ecmascript.c"
break;
case 20: /* assignment_expression ::= lefthand_side_expression SLASH_ASSIGN assignment_expression */
-#line 108 "ecmascript.lemon"
+#line 108 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_SLASH_ASSIGN, 2);
}
-#line 1398 "ecmascript.c"
+#line 1408 "grn_ecmascript.c"
break;
case 21: /* assignment_expression ::= lefthand_side_expression MOD_ASSIGN assignment_expression */
-#line 111 "ecmascript.lemon"
+#line 111 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_MOD_ASSIGN, 2);
}
-#line 1405 "ecmascript.c"
+#line 1415 "grn_ecmascript.c"
break;
case 22: /* assignment_expression ::= lefthand_side_expression PLUS_ASSIGN assignment_expression */
-#line 114 "ecmascript.lemon"
+#line 114 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_PLUS_ASSIGN, 2);
}
-#line 1412 "ecmascript.c"
+#line 1422 "grn_ecmascript.c"
break;
case 23: /* assignment_expression ::= lefthand_side_expression MINUS_ASSIGN assignment_expression */
-#line 117 "ecmascript.lemon"
+#line 117 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_MINUS_ASSIGN, 2);
}
-#line 1419 "ecmascript.c"
+#line 1429 "grn_ecmascript.c"
break;
case 24: /* assignment_expression ::= lefthand_side_expression SHIFTL_ASSIGN assignment_expression */
-#line 120 "ecmascript.lemon"
+#line 120 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_SHIFTL_ASSIGN, 2);
}
-#line 1426 "ecmascript.c"
+#line 1436 "grn_ecmascript.c"
break;
case 25: /* assignment_expression ::= lefthand_side_expression SHIFTR_ASSIGN assignment_expression */
-#line 123 "ecmascript.lemon"
+#line 123 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_SHIFTR_ASSIGN, 2);
}
-#line 1433 "ecmascript.c"
+#line 1443 "grn_ecmascript.c"
break;
case 26: /* assignment_expression ::= lefthand_side_expression SHIFTRR_ASSIGN assignment_expression */
-#line 126 "ecmascript.lemon"
+#line 126 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_SHIFTRR_ASSIGN, 2);
}
-#line 1440 "ecmascript.c"
+#line 1450 "grn_ecmascript.c"
break;
case 27: /* assignment_expression ::= lefthand_side_expression AND_ASSIGN assignment_expression */
-#line 129 "ecmascript.lemon"
+#line 129 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_AND_ASSIGN, 2);
}
-#line 1447 "ecmascript.c"
+#line 1457 "grn_ecmascript.c"
break;
case 28: /* assignment_expression ::= lefthand_side_expression XOR_ASSIGN assignment_expression */
-#line 132 "ecmascript.lemon"
+#line 132 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_XOR_ASSIGN, 2);
}
-#line 1454 "ecmascript.c"
+#line 1464 "grn_ecmascript.c"
break;
case 29: /* assignment_expression ::= lefthand_side_expression OR_ASSIGN assignment_expression */
-#line 135 "ecmascript.lemon"
+#line 135 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_OR_ASSIGN, 2);
}
-#line 1461 "ecmascript.c"
+#line 1471 "grn_ecmascript.c"
break;
case 31: /* conditional_expression ::= logical_or_expression QUESTION assignment_expression COLON assignment_expression */
-#line 140 "ecmascript.lemon"
+#line 140 "grn_ecmascript.lemon"
{
grn_expr *e = (grn_expr *)efsi->e;
e->codes[yymsp[-3].minor.yy0].nargs = yymsp[-1].minor.yy0 - yymsp[-3].minor.yy0;
e->codes[yymsp[-1].minor.yy0].nargs = e->codes_curr - yymsp[-1].minor.yy0 - 1;
}
-#line 1470 "ecmascript.c"
+#line 1480 "grn_ecmascript.c"
break;
case 38: /* bitwise_or_expression ::= bitwise_or_expression BITWISE_OR bitwise_xor_expression */
-#line 160 "ecmascript.lemon"
+#line 160 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_BITWISE_OR, 2);
}
-#line 1477 "ecmascript.c"
+#line 1487 "grn_ecmascript.c"
break;
case 40: /* bitwise_xor_expression ::= bitwise_xor_expression BITWISE_XOR bitwise_and_expression */
-#line 165 "ecmascript.lemon"
+#line 165 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_BITWISE_XOR, 2);
}
-#line 1484 "ecmascript.c"
+#line 1494 "grn_ecmascript.c"
break;
case 42: /* bitwise_and_expression ::= bitwise_and_expression BITWISE_AND equality_expression */
-#line 170 "ecmascript.lemon"
+#line 170 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_BITWISE_AND, 2);
}
-#line 1491 "ecmascript.c"
+#line 1501 "grn_ecmascript.c"
break;
case 44: /* equality_expression ::= equality_expression EQUAL relational_expression */
-#line 175 "ecmascript.lemon"
+#line 175 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_EQUAL, 2);
}
-#line 1498 "ecmascript.c"
+#line 1508 "grn_ecmascript.c"
break;
case 45: /* equality_expression ::= equality_expression NOT_EQUAL relational_expression */
-#line 178 "ecmascript.lemon"
+#line 178 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_NOT_EQUAL, 2);
}
-#line 1505 "ecmascript.c"
+#line 1515 "grn_ecmascript.c"
break;
case 47: /* relational_expression ::= relational_expression LESS shift_expression */
-#line 183 "ecmascript.lemon"
+#line 183 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_LESS, 2);
}
-#line 1512 "ecmascript.c"
+#line 1522 "grn_ecmascript.c"
break;
case 48: /* relational_expression ::= relational_expression GREATER shift_expression */
-#line 186 "ecmascript.lemon"
+#line 186 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_GREATER, 2);
}
-#line 1519 "ecmascript.c"
+#line 1529 "grn_ecmascript.c"
break;
case 49: /* relational_expression ::= relational_expression LESS_EQUAL shift_expression */
-#line 189 "ecmascript.lemon"
+#line 189 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_LESS_EQUAL, 2);
}
-#line 1526 "ecmascript.c"
+#line 1536 "grn_ecmascript.c"
break;
case 50: /* relational_expression ::= relational_expression GREATER_EQUAL shift_expression */
-#line 192 "ecmascript.lemon"
+#line 192 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_GREATER_EQUAL, 2);
}
-#line 1533 "ecmascript.c"
+#line 1543 "grn_ecmascript.c"
break;
case 51: /* relational_expression ::= relational_expression IN shift_expression */
-#line 195 "ecmascript.lemon"
+#line 195 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_IN, 2);
}
-#line 1540 "ecmascript.c"
+#line 1550 "grn_ecmascript.c"
break;
case 52: /* relational_expression ::= relational_expression MATCH shift_expression */
- case 130: /* adjust_match_expression ::= IDENTIFIER MATCH STRING */ yytestcase(yyruleno==130);
-#line 198 "ecmascript.lemon"
+ case 131: /* adjust_match_expression ::= IDENTIFIER MATCH STRING */ yytestcase(yyruleno==131);
+#line 198 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_MATCH, 2);
}
-#line 1548 "ecmascript.c"
+#line 1558 "grn_ecmascript.c"
break;
case 53: /* relational_expression ::= relational_expression NEAR shift_expression */
-#line 201 "ecmascript.lemon"
+#line 201 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_NEAR, 2);
}
-#line 1555 "ecmascript.c"
+#line 1565 "grn_ecmascript.c"
break;
case 54: /* relational_expression ::= relational_expression NEAR2 shift_expression */
-#line 204 "ecmascript.lemon"
+#line 204 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_NEAR2, 2);
}
-#line 1562 "ecmascript.c"
+#line 1572 "grn_ecmascript.c"
break;
case 55: /* relational_expression ::= relational_expression SIMILAR shift_expression */
-#line 207 "ecmascript.lemon"
+#line 207 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_SIMILAR, 2);
}
-#line 1569 "ecmascript.c"
+#line 1579 "grn_ecmascript.c"
break;
case 56: /* relational_expression ::= relational_expression TERM_EXTRACT shift_expression */
-#line 210 "ecmascript.lemon"
+#line 210 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_TERM_EXTRACT, 2);
}
-#line 1576 "ecmascript.c"
+#line 1586 "grn_ecmascript.c"
break;
case 57: /* relational_expression ::= relational_expression LCP shift_expression */
-#line 213 "ecmascript.lemon"
+#line 213 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_LCP, 2);
}
-#line 1583 "ecmascript.c"
+#line 1593 "grn_ecmascript.c"
break;
case 58: /* relational_expression ::= relational_expression PREFIX shift_expression */
-#line 216 "ecmascript.lemon"
+#line 216 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_PREFIX, 2);
}
-#line 1590 "ecmascript.c"
+#line 1600 "grn_ecmascript.c"
break;
case 59: /* relational_expression ::= relational_expression SUFFIX shift_expression */
-#line 219 "ecmascript.lemon"
+#line 219 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_SUFFIX, 2);
}
-#line 1597 "ecmascript.c"
+#line 1607 "grn_ecmascript.c"
+ break;
+ case 60: /* relational_expression ::= relational_expression REGEXP shift_expression */
+#line 222 "grn_ecmascript.lemon"
+{
+ grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_REGEXP, 2);
+}
+#line 1614 "grn_ecmascript.c"
break;
- case 61: /* shift_expression ::= shift_expression SHIFTL additive_expression */
-#line 224 "ecmascript.lemon"
+ case 62: /* shift_expression ::= shift_expression SHIFTL additive_expression */
+#line 227 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_SHIFTL, 2);
}
-#line 1604 "ecmascript.c"
+#line 1621 "grn_ecmascript.c"
break;
- case 62: /* shift_expression ::= shift_expression SHIFTR additive_expression */
-#line 227 "ecmascript.lemon"
+ case 63: /* shift_expression ::= shift_expression SHIFTR additive_expression */
+#line 230 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_SHIFTR, 2);
}
-#line 1611 "ecmascript.c"
+#line 1628 "grn_ecmascript.c"
break;
- case 63: /* shift_expression ::= shift_expression SHIFTRR additive_expression */
-#line 230 "ecmascript.lemon"
+ case 64: /* shift_expression ::= shift_expression SHIFTRR additive_expression */
+#line 233 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_SHIFTRR, 2);
}
-#line 1618 "ecmascript.c"
+#line 1635 "grn_ecmascript.c"
break;
- case 65: /* additive_expression ::= additive_expression PLUS multiplicative_expression */
- case 127: /* adjuster ::= adjuster PLUS adjust_expression */ yytestcase(yyruleno==127);
-#line 235 "ecmascript.lemon"
+ case 66: /* additive_expression ::= additive_expression PLUS multiplicative_expression */
+ case 128: /* adjuster ::= adjuster PLUS adjust_expression */ yytestcase(yyruleno==128);
+#line 238 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_PLUS, 2);
}
-#line 1626 "ecmascript.c"
+#line 1643 "grn_ecmascript.c"
break;
- case 66: /* additive_expression ::= additive_expression MINUS multiplicative_expression */
-#line 238 "ecmascript.lemon"
+ case 67: /* additive_expression ::= additive_expression MINUS multiplicative_expression */
+#line 241 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_MINUS, 2);
}
-#line 1633 "ecmascript.c"
+#line 1650 "grn_ecmascript.c"
break;
- case 68: /* multiplicative_expression ::= multiplicative_expression STAR unary_expression */
- case 129: /* adjust_expression ::= adjust_match_expression STAR DECIMAL */ yytestcase(yyruleno==129);
-#line 243 "ecmascript.lemon"
+ case 69: /* multiplicative_expression ::= multiplicative_expression STAR unary_expression */
+ case 130: /* adjust_expression ::= adjust_match_expression STAR DECIMAL */ yytestcase(yyruleno==130);
+#line 246 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_STAR, 2);
}
-#line 1641 "ecmascript.c"
+#line 1658 "grn_ecmascript.c"
break;
- case 69: /* multiplicative_expression ::= multiplicative_expression SLASH unary_expression */
-#line 246 "ecmascript.lemon"
+ case 70: /* multiplicative_expression ::= multiplicative_expression SLASH unary_expression */
+#line 249 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_SLASH, 2);
}
-#line 1648 "ecmascript.c"
+#line 1665 "grn_ecmascript.c"
break;
- case 70: /* multiplicative_expression ::= multiplicative_expression MOD unary_expression */
-#line 249 "ecmascript.lemon"
+ case 71: /* multiplicative_expression ::= multiplicative_expression MOD unary_expression */
+#line 252 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_MOD, 2);
}
-#line 1655 "ecmascript.c"
+#line 1672 "grn_ecmascript.c"
break;
- case 72: /* unary_expression ::= DELETE unary_expression */
-#line 254 "ecmascript.lemon"
+ case 73: /* unary_expression ::= DELETE unary_expression */
+#line 257 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_DELETE, 1);
}
-#line 1662 "ecmascript.c"
+#line 1679 "grn_ecmascript.c"
break;
- case 73: /* unary_expression ::= INCR unary_expression */
-#line 257 "ecmascript.lemon"
+ case 74: /* unary_expression ::= INCR unary_expression */
+#line 260 "grn_ecmascript.lemon"
{
grn_ctx *ctx = efsi->ctx;
grn_expr *e = (grn_expr *)(efsi->e);
@@ -1679,10 +1696,10 @@ static void yy_reduce(
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_INCR, 1);
}
}
-#line 1683 "ecmascript.c"
+#line 1700 "grn_ecmascript.c"
break;
- case 74: /* unary_expression ::= DECR unary_expression */
-#line 274 "ecmascript.lemon"
+ case 75: /* unary_expression ::= DECR unary_expression */
+#line 277 "grn_ecmascript.lemon"
{
grn_ctx *ctx = efsi->ctx;
grn_expr *e = (grn_expr *)(efsi->e);
@@ -1700,66 +1717,66 @@ static void yy_reduce(
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_DECR, 1);
}
}
-#line 1704 "ecmascript.c"
+#line 1721 "grn_ecmascript.c"
break;
- case 75: /* unary_expression ::= PLUS unary_expression */
-#line 291 "ecmascript.lemon"
+ case 76: /* unary_expression ::= PLUS unary_expression */
+#line 294 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_PLUS, 1);
}
-#line 1711 "ecmascript.c"
+#line 1728 "grn_ecmascript.c"
break;
- case 76: /* unary_expression ::= MINUS unary_expression */
-#line 294 "ecmascript.lemon"
+ case 77: /* unary_expression ::= MINUS unary_expression */
+#line 297 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_MINUS, 1);
}
-#line 1718 "ecmascript.c"
+#line 1735 "grn_ecmascript.c"
break;
- case 77: /* unary_expression ::= NOT unary_expression */
-#line 297 "ecmascript.lemon"
+ case 78: /* unary_expression ::= NOT unary_expression */
+#line 300 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_NOT, 1);
}
-#line 1725 "ecmascript.c"
+#line 1742 "grn_ecmascript.c"
break;
- case 78: /* unary_expression ::= BITWISE_NOT unary_expression */
-#line 300 "ecmascript.lemon"
+ case 79: /* unary_expression ::= BITWISE_NOT unary_expression */
+#line 303 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_BITWISE_NOT, 1);
}
-#line 1732 "ecmascript.c"
+#line 1749 "grn_ecmascript.c"
break;
- case 79: /* unary_expression ::= ADJUST unary_expression */
-#line 303 "ecmascript.lemon"
+ case 80: /* unary_expression ::= ADJUST unary_expression */
+#line 306 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_ADJUST, 1);
}
-#line 1739 "ecmascript.c"
+#line 1756 "grn_ecmascript.c"
break;
- case 80: /* unary_expression ::= EXACT unary_expression */
-#line 306 "ecmascript.lemon"
+ case 81: /* unary_expression ::= EXACT unary_expression */
+#line 309 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_EXACT, 1);
}
-#line 1746 "ecmascript.c"
+#line 1763 "grn_ecmascript.c"
break;
- case 81: /* unary_expression ::= PARTIAL unary_expression */
-#line 309 "ecmascript.lemon"
+ case 82: /* unary_expression ::= PARTIAL unary_expression */
+#line 312 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_PARTIAL, 1);
}
-#line 1753 "ecmascript.c"
+#line 1770 "grn_ecmascript.c"
break;
- case 82: /* unary_expression ::= UNSPLIT unary_expression */
-#line 312 "ecmascript.lemon"
+ case 83: /* unary_expression ::= UNSPLIT unary_expression */
+#line 315 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_UNSPLIT, 1);
}
-#line 1760 "ecmascript.c"
+#line 1777 "grn_ecmascript.c"
break;
- case 84: /* postfix_expression ::= lefthand_side_expression INCR */
-#line 317 "ecmascript.lemon"
+ case 85: /* postfix_expression ::= lefthand_side_expression INCR */
+#line 320 "grn_ecmascript.lemon"
{
grn_ctx *ctx = efsi->ctx;
grn_expr *e = (grn_expr *)(efsi->e);
@@ -1777,10 +1794,10 @@ static void yy_reduce(
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_INCR_POST, 1);
}
}
-#line 1781 "ecmascript.c"
+#line 1798 "grn_ecmascript.c"
break;
- case 85: /* postfix_expression ::= lefthand_side_expression DECR */
-#line 334 "ecmascript.lemon"
+ case 86: /* postfix_expression ::= lefthand_side_expression DECR */
+#line 337 "grn_ecmascript.lemon"
{
grn_ctx *ctx = efsi->ctx;
grn_expr *e = (grn_expr *)(efsi->e);
@@ -1798,51 +1815,51 @@ static void yy_reduce(
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_DECR_POST, 1);
}
}
-#line 1802 "ecmascript.c"
+#line 1819 "grn_ecmascript.c"
break;
- case 88: /* call_expression ::= member_expression arguments */
-#line 355 "ecmascript.lemon"
+ case 89: /* call_expression ::= member_expression arguments */
+#line 358 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_CALL, yymsp[0].minor.yy0);
}
-#line 1809 "ecmascript.c"
+#line 1826 "grn_ecmascript.c"
break;
- case 113: /* member_expression_part ::= BRACKETL expression BRACKETR */
-#line 391 "ecmascript.lemon"
+ case 114: /* member_expression_part ::= BRACKETL expression BRACKETR */
+#line 394 "grn_ecmascript.lemon"
{
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_GET_MEMBER, 2);
}
-#line 1816 "ecmascript.c"
+#line 1833 "grn_ecmascript.c"
break;
- case 115: /* arguments ::= PARENL argument_list PARENR */
-#line 396 "ecmascript.lemon"
+ case 116: /* arguments ::= PARENL argument_list PARENR */
+#line 399 "grn_ecmascript.lemon"
{ yygotominor.yy0 = yymsp[-1].minor.yy0; }
-#line 1821 "ecmascript.c"
+#line 1838 "grn_ecmascript.c"
break;
- case 116: /* argument_list ::= */
-#line 397 "ecmascript.lemon"
+ case 117: /* argument_list ::= */
+#line 400 "grn_ecmascript.lemon"
{ yygotominor.yy0 = 0; }
-#line 1826 "ecmascript.c"
+#line 1843 "grn_ecmascript.c"
break;
- case 117: /* argument_list ::= assignment_expression */
-#line 398 "ecmascript.lemon"
+ case 118: /* argument_list ::= assignment_expression */
+#line 401 "grn_ecmascript.lemon"
{ yygotominor.yy0 = 1; }
-#line 1831 "ecmascript.c"
+#line 1848 "grn_ecmascript.c"
break;
- case 118: /* argument_list ::= argument_list COMMA assignment_expression */
-#line 399 "ecmascript.lemon"
+ case 119: /* argument_list ::= argument_list COMMA assignment_expression */
+#line 402 "grn_ecmascript.lemon"
{ yygotominor.yy0 = yymsp[-2].minor.yy0 + 1; }
-#line 1836 "ecmascript.c"
+#line 1853 "grn_ecmascript.c"
break;
- case 119: /* output_columns ::= */
-#line 401 "ecmascript.lemon"
+ case 120: /* output_columns ::= */
+#line 404 "grn_ecmascript.lemon"
{
yygotominor.yy0 = 0;
}
-#line 1843 "ecmascript.c"
+#line 1860 "grn_ecmascript.c"
break;
- case 120: /* output_columns ::= output_column */
-#line 404 "ecmascript.lemon"
+ case 121: /* output_columns ::= output_column */
+#line 407 "grn_ecmascript.lemon"
{
if (yymsp[0].minor.yy0) {
yygotominor.yy0 = 0;
@@ -1850,10 +1867,10 @@ static void yy_reduce(
yygotominor.yy0 = 1;
}
}
-#line 1854 "ecmascript.c"
+#line 1871 "grn_ecmascript.c"
break;
- case 121: /* output_columns ::= output_columns COMMA output_column */
-#line 412 "ecmascript.lemon"
+ case 122: /* output_columns ::= output_columns COMMA output_column */
+#line 415 "grn_ecmascript.lemon"
{
if (yymsp[0].minor.yy0) {
yygotominor.yy0 = yymsp[-2].minor.yy0;
@@ -1864,10 +1881,10 @@ static void yy_reduce(
yygotominor.yy0 = 1;
}
}
-#line 1868 "ecmascript.c"
+#line 1885 "grn_ecmascript.c"
break;
- case 122: /* output_column ::= STAR */
-#line 423 "ecmascript.lemon"
+ case 123: /* output_column ::= STAR */
+#line 426 "grn_ecmascript.lemon"
{
grn_ctx *ctx = efsi->ctx;
grn_obj *expr = efsi->e;
@@ -1905,21 +1922,21 @@ static void yy_reduce(
yygotominor.yy0 = GRN_TRUE;
}
}
-#line 1909 "ecmascript.c"
+#line 1926 "grn_ecmascript.c"
break;
- case 123: /* output_column ::= NONEXISTENT_COLUMN */
-#line 460 "ecmascript.lemon"
+ case 124: /* output_column ::= NONEXISTENT_COLUMN */
+#line 463 "grn_ecmascript.lemon"
{
yygotominor.yy0 = GRN_TRUE;
}
-#line 1916 "ecmascript.c"
+#line 1933 "grn_ecmascript.c"
break;
- case 124: /* output_column ::= assignment_expression */
-#line 463 "ecmascript.lemon"
+ case 125: /* output_column ::= assignment_expression */
+#line 466 "grn_ecmascript.lemon"
{
yygotominor.yy0 = GRN_FALSE;
}
-#line 1923 "ecmascript.c"
+#line 1940 "grn_ecmascript.c"
break;
default:
/* (0) input ::= query */ yytestcase(yyruleno==0);
@@ -1939,41 +1956,41 @@ static void yy_reduce(
/* (41) bitwise_and_expression ::= equality_expression */ yytestcase(yyruleno==41);
/* (43) equality_expression ::= relational_expression */ yytestcase(yyruleno==43);
/* (46) relational_expression ::= shift_expression */ yytestcase(yyruleno==46);
- /* (60) shift_expression ::= additive_expression */ yytestcase(yyruleno==60);
- /* (64) additive_expression ::= multiplicative_expression */ yytestcase(yyruleno==64);
- /* (67) multiplicative_expression ::= unary_expression */ yytestcase(yyruleno==67);
- /* (71) unary_expression ::= postfix_expression */ yytestcase(yyruleno==71);
- /* (83) postfix_expression ::= lefthand_side_expression */ yytestcase(yyruleno==83);
- /* (86) lefthand_side_expression ::= call_expression */ yytestcase(yyruleno==86);
- /* (87) lefthand_side_expression ::= member_expression */ yytestcase(yyruleno==87);
- /* (89) member_expression ::= primary_expression */ yytestcase(yyruleno==89);
- /* (90) member_expression ::= member_expression member_expression_part */ yytestcase(yyruleno==90);
- /* (91) primary_expression ::= object_literal */ yytestcase(yyruleno==91);
- /* (92) primary_expression ::= PARENL expression PARENR */ yytestcase(yyruleno==92);
- /* (93) primary_expression ::= IDENTIFIER */ yytestcase(yyruleno==93);
- /* (94) primary_expression ::= array_literal */ yytestcase(yyruleno==94);
- /* (95) primary_expression ::= DECIMAL */ yytestcase(yyruleno==95);
- /* (96) primary_expression ::= HEX_INTEGER */ yytestcase(yyruleno==96);
- /* (97) primary_expression ::= STRING */ yytestcase(yyruleno==97);
- /* (98) primary_expression ::= BOOLEAN */ yytestcase(yyruleno==98);
- /* (99) primary_expression ::= NULL */ yytestcase(yyruleno==99);
- /* (100) array_literal ::= BRACKETL elision BRACKETR */ yytestcase(yyruleno==100);
- /* (101) array_literal ::= BRACKETL element_list elision BRACKETR */ yytestcase(yyruleno==101);
- /* (102) array_literal ::= BRACKETL element_list BRACKETR */ yytestcase(yyruleno==102);
- /* (103) elision ::= COMMA */ yytestcase(yyruleno==103);
- /* (104) elision ::= elision COMMA */ yytestcase(yyruleno==104);
- /* (105) element_list ::= assignment_expression */ yytestcase(yyruleno==105);
- /* (106) element_list ::= elision assignment_expression */ yytestcase(yyruleno==106);
- /* (107) element_list ::= element_list elision assignment_expression */ yytestcase(yyruleno==107);
- /* (108) object_literal ::= BRACEL property_name_and_value_list BRACER */ yytestcase(yyruleno==108);
- /* (109) property_name_and_value_list ::= */ yytestcase(yyruleno==109);
- /* (110) property_name_and_value_list ::= property_name_and_value_list COMMA property_name_and_value */ yytestcase(yyruleno==110);
- /* (111) property_name_and_value ::= property_name COLON assignment_expression */ yytestcase(yyruleno==111);
- /* (112) property_name ::= IDENTIFIER|STRING|DECIMAL */ yytestcase(yyruleno==112);
- /* (114) member_expression_part ::= DOT IDENTIFIER */ yytestcase(yyruleno==114);
- /* (125) adjuster ::= */ yytestcase(yyruleno==125);
- /* (126) adjuster ::= adjust_expression */ yytestcase(yyruleno==126);
- /* (128) adjust_expression ::= adjust_match_expression */ yytestcase(yyruleno==128);
+ /* (61) shift_expression ::= additive_expression */ yytestcase(yyruleno==61);
+ /* (65) additive_expression ::= multiplicative_expression */ yytestcase(yyruleno==65);
+ /* (68) multiplicative_expression ::= unary_expression */ yytestcase(yyruleno==68);
+ /* (72) unary_expression ::= postfix_expression */ yytestcase(yyruleno==72);
+ /* (84) postfix_expression ::= lefthand_side_expression */ yytestcase(yyruleno==84);
+ /* (87) lefthand_side_expression ::= call_expression */ yytestcase(yyruleno==87);
+ /* (88) lefthand_side_expression ::= member_expression */ yytestcase(yyruleno==88);
+ /* (90) member_expression ::= primary_expression */ yytestcase(yyruleno==90);
+ /* (91) member_expression ::= member_expression member_expression_part */ yytestcase(yyruleno==91);
+ /* (92) primary_expression ::= object_literal */ yytestcase(yyruleno==92);
+ /* (93) primary_expression ::= PARENL expression PARENR */ yytestcase(yyruleno==93);
+ /* (94) primary_expression ::= IDENTIFIER */ yytestcase(yyruleno==94);
+ /* (95) primary_expression ::= array_literal */ yytestcase(yyruleno==95);
+ /* (96) primary_expression ::= DECIMAL */ yytestcase(yyruleno==96);
+ /* (97) primary_expression ::= HEX_INTEGER */ yytestcase(yyruleno==97);
+ /* (98) primary_expression ::= STRING */ yytestcase(yyruleno==98);
+ /* (99) primary_expression ::= BOOLEAN */ yytestcase(yyruleno==99);
+ /* (100) primary_expression ::= NULL */ yytestcase(yyruleno==100);
+ /* (101) array_literal ::= BRACKETL elision BRACKETR */ yytestcase(yyruleno==101);
+ /* (102) array_literal ::= BRACKETL element_list elision BRACKETR */ yytestcase(yyruleno==102);
+ /* (103) array_literal ::= BRACKETL element_list BRACKETR */ yytestcase(yyruleno==103);
+ /* (104) elision ::= COMMA */ yytestcase(yyruleno==104);
+ /* (105) elision ::= elision COMMA */ yytestcase(yyruleno==105);
+ /* (106) element_list ::= assignment_expression */ yytestcase(yyruleno==106);
+ /* (107) element_list ::= elision assignment_expression */ yytestcase(yyruleno==107);
+ /* (108) element_list ::= element_list elision assignment_expression */ yytestcase(yyruleno==108);
+ /* (109) object_literal ::= BRACEL property_name_and_value_list BRACER */ yytestcase(yyruleno==109);
+ /* (110) property_name_and_value_list ::= */ yytestcase(yyruleno==110);
+ /* (111) property_name_and_value_list ::= property_name_and_value_list COMMA property_name_and_value */ yytestcase(yyruleno==111);
+ /* (112) property_name_and_value ::= property_name COLON assignment_expression */ yytestcase(yyruleno==112);
+ /* (113) property_name ::= IDENTIFIER|STRING|DECIMAL */ yytestcase(yyruleno==113);
+ /* (115) member_expression_part ::= DOT IDENTIFIER */ yytestcase(yyruleno==115);
+ /* (126) adjuster ::= */ yytestcase(yyruleno==126);
+ /* (127) adjuster ::= adjust_expression */ yytestcase(yyruleno==127);
+ /* (129) adjust_expression ::= adjust_match_expression */ yytestcase(yyruleno==129);
break;
};
yygoto = yyRuleInfo[yyruleno].lhs;
@@ -2033,7 +2050,7 @@ static void yy_syntax_error(
){
grn_expr_parserARG_FETCH;
#define TOKEN (yyminor.yy0)
-#line 17 "ecmascript.lemon"
+#line 17 "grn_ecmascript.lemon"
{
grn_ctx *ctx = efsi->ctx;
@@ -2055,7 +2072,7 @@ static void yy_syntax_error(
GRN_OBJ_FIN(ctx, &message);
}
}
-#line 2059 "ecmascript.c"
+#line 2076 "grn_ecmascript.c"
grn_expr_parserARG_STORE; /* Suppress warning about unused %extra_argument variable */
}
diff --git a/storage/mroonga/vendor/groonga/lib/ecmascript.h b/storage/mroonga/vendor/groonga/lib/grn_ecmascript.h
index c8e74b2fb8f..6280690482b 100644
--- a/storage/mroonga/vendor/groonga/lib/ecmascript.h
+++ b/storage/mroonga/vendor/groonga/lib/grn_ecmascript.h
@@ -44,29 +44,30 @@
#define GRN_EXPR_TOKEN_LCP 44
#define GRN_EXPR_TOKEN_PREFIX 45
#define GRN_EXPR_TOKEN_SUFFIX 46
-#define GRN_EXPR_TOKEN_SHIFTL 47
-#define GRN_EXPR_TOKEN_SHIFTR 48
-#define GRN_EXPR_TOKEN_SHIFTRR 49
-#define GRN_EXPR_TOKEN_PLUS 50
-#define GRN_EXPR_TOKEN_MINUS 51
-#define GRN_EXPR_TOKEN_STAR 52
-#define GRN_EXPR_TOKEN_SLASH 53
-#define GRN_EXPR_TOKEN_MOD 54
-#define GRN_EXPR_TOKEN_DELETE 55
-#define GRN_EXPR_TOKEN_INCR 56
-#define GRN_EXPR_TOKEN_DECR 57
-#define GRN_EXPR_TOKEN_NOT 58
-#define GRN_EXPR_TOKEN_BITWISE_NOT 59
-#define GRN_EXPR_TOKEN_ADJUST 60
-#define GRN_EXPR_TOKEN_EXACT 61
-#define GRN_EXPR_TOKEN_PARTIAL 62
-#define GRN_EXPR_TOKEN_UNSPLIT 63
-#define GRN_EXPR_TOKEN_DECIMAL 64
-#define GRN_EXPR_TOKEN_HEX_INTEGER 65
-#define GRN_EXPR_TOKEN_STRING 66
-#define GRN_EXPR_TOKEN_BOOLEAN 67
-#define GRN_EXPR_TOKEN_NULL 68
-#define GRN_EXPR_TOKEN_BRACKETL 69
-#define GRN_EXPR_TOKEN_BRACKETR 70
-#define GRN_EXPR_TOKEN_DOT 71
-#define GRN_EXPR_TOKEN_NONEXISTENT_COLUMN 72
+#define GRN_EXPR_TOKEN_REGEXP 47
+#define GRN_EXPR_TOKEN_SHIFTL 48
+#define GRN_EXPR_TOKEN_SHIFTR 49
+#define GRN_EXPR_TOKEN_SHIFTRR 50
+#define GRN_EXPR_TOKEN_PLUS 51
+#define GRN_EXPR_TOKEN_MINUS 52
+#define GRN_EXPR_TOKEN_STAR 53
+#define GRN_EXPR_TOKEN_SLASH 54
+#define GRN_EXPR_TOKEN_MOD 55
+#define GRN_EXPR_TOKEN_DELETE 56
+#define GRN_EXPR_TOKEN_INCR 57
+#define GRN_EXPR_TOKEN_DECR 58
+#define GRN_EXPR_TOKEN_NOT 59
+#define GRN_EXPR_TOKEN_BITWISE_NOT 60
+#define GRN_EXPR_TOKEN_ADJUST 61
+#define GRN_EXPR_TOKEN_EXACT 62
+#define GRN_EXPR_TOKEN_PARTIAL 63
+#define GRN_EXPR_TOKEN_UNSPLIT 64
+#define GRN_EXPR_TOKEN_DECIMAL 65
+#define GRN_EXPR_TOKEN_HEX_INTEGER 66
+#define GRN_EXPR_TOKEN_STRING 67
+#define GRN_EXPR_TOKEN_BOOLEAN 68
+#define GRN_EXPR_TOKEN_NULL 69
+#define GRN_EXPR_TOKEN_BRACKETL 70
+#define GRN_EXPR_TOKEN_BRACKETR 71
+#define GRN_EXPR_TOKEN_DOT 72
+#define GRN_EXPR_TOKEN_NONEXISTENT_COLUMN 73
diff --git a/storage/mroonga/vendor/groonga/lib/ecmascript.lemon b/storage/mroonga/vendor/groonga/lib/grn_ecmascript.lemon
index 322d7ac8264..1d812655d70 100644
--- a/storage/mroonga/vendor/groonga/lib/ecmascript.lemon
+++ b/storage/mroonga/vendor/groonga/lib/grn_ecmascript.lemon
@@ -219,6 +219,9 @@ relational_expression ::= relational_expression PREFIX shift_expression. {
relational_expression ::= relational_expression SUFFIX shift_expression. {
grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_SUFFIX, 2);
}
+relational_expression ::= relational_expression REGEXP shift_expression. {
+ grn_expr_append_op(efsi->ctx, efsi->e, GRN_OP_REGEXP, 2);
+}
shift_expression ::= additive_expression.
shift_expression ::= shift_expression SHIFTL additive_expression. {
diff --git a/storage/mroonga/vendor/groonga/lib/error.h b/storage/mroonga/vendor/groonga/lib/grn_error.h
index f425e4644f1..2581f934135 100644
--- a/storage/mroonga/vendor/groonga/lib/error.h
+++ b/storage/mroonga/vendor/groonga/lib/grn_error.h
@@ -18,15 +18,15 @@
#ifndef GRN_ERROR_H
#define GRN_ERROR_H
-#ifndef GROONGA_IN_H
-#include "groonga_in.h"
-#endif /* GROONGA_IN_H */
+#ifndef GRN_H
+#include "grn.h"
+#endif /* GRN_H */
#ifdef __cplusplus
extern "C" {
#endif
-const char *grn_current_error_message(void);
+GRN_API const char *grn_current_error_message(void);
#ifdef __cplusplus
}
diff --git a/storage/mroonga/vendor/groonga/lib/expr.h b/storage/mroonga/vendor/groonga/lib/grn_expr.h
index 67e134e47b9..75871491d7c 100644
--- a/storage/mroonga/vendor/groonga/lib/expr.h
+++ b/storage/mroonga/vendor/groonga/lib/grn_expr.h
@@ -1,6 +1,6 @@
/* -*- c-basic-offset: 2 -*- */
/*
- Copyright(C) 2013-2014 Brazil
+ Copyright(C) 2013-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -19,7 +19,7 @@
#ifndef GRN_EXPR_H
#define GRN_EXPR_H
-#include "db.h"
+#include "grn_db.h"
#ifdef __cplusplus
extern "C" {
@@ -44,7 +44,10 @@ typedef grn_bool (*grn_scan_info_each_arg_callback)(grn_ctx *ctx, grn_obj *obj,
scan_info *grn_scan_info_open(grn_ctx *ctx, int start);
void grn_scan_info_close(grn_ctx *ctx, scan_info *si);
void grn_scan_info_put_index(grn_ctx *ctx, scan_info *si, grn_obj *index,
- uint32_t sid, int32_t weight);
+ uint32_t sid, int32_t weight,
+ grn_obj *scorer,
+ grn_obj *scorer_args_expr,
+ uint32_t scorer_args_expr_offset);
scan_info **grn_scan_info_put_logical_op(grn_ctx *ctx, scan_info **sis, int *ip,
grn_operator op, int start);
int grn_scan_info_get_flags(scan_info *si);
@@ -62,7 +65,13 @@ void grn_scan_info_set_similarity_threshold(scan_info *si, int similarity_thresh
grn_bool grn_scan_info_push_arg(scan_info *si, grn_obj *arg);
grn_obj *grn_scan_info_get_arg(grn_ctx *ctx, scan_info *si, int i);
-int32_t grn_expr_code_get_weight(grn_ctx *ctx, grn_expr_code *ec);
+int32_t grn_expr_code_get_weight(grn_ctx *ctx, grn_expr_code *ec, uint32_t *offset);
+grn_rc grn_expr_code_inspect_indented(grn_ctx *ctx,
+ grn_obj *buffer,
+ grn_expr_code *code,
+ const char *indent);
+void grn_p_expr_code(grn_ctx *ctx, grn_expr_code *code);
+
void grn_expr_take_obj(grn_ctx *ctx, grn_obj *expr, grn_obj *obj);
grn_obj *grn_expr_alloc_const(grn_ctx *ctx, grn_obj *expr);
@@ -71,3 +80,4 @@ grn_obj *grn_expr_alloc_const(grn_ctx *ctx, grn_obj *expr);
#endif
#endif /* GRN_EXPR_H */
+
diff --git a/storage/mroonga/vendor/groonga/lib/geo.h b/storage/mroonga/vendor/groonga/lib/grn_geo.h
index b1e04061876..5becbe4f45c 100644
--- a/storage/mroonga/vendor/groonga/lib/geo.h
+++ b/storage/mroonga/vendor/groonga/lib/grn_geo.h
@@ -17,12 +17,12 @@
#ifndef GRN_GEO_H
#define GRN_GEO_H
-#ifndef GROONGA_IN_H
-#include "groonga_in.h"
-#endif /* GROONGA_IN_H */
+#ifndef GRN_H
+#include "grn.h"
+#endif /* GRN_H */
-#include "ii.h"
-#include "db.h"
+#include "grn_ii.h"
+#include "grn_db.h"
#if defined(WIN32) || defined(__sun)
# define _USE_MATH_DEFINES
diff --git a/storage/mroonga/vendor/groonga/lib/hash.h b/storage/mroonga/vendor/groonga/lib/grn_hash.h
index 6f2e68de246..d50836d80f1 100644
--- a/storage/mroonga/vendor/groonga/lib/hash.h
+++ b/storage/mroonga/vendor/groonga/lib/grn_hash.h
@@ -1,5 +1,5 @@
/* -*- c-basic-offset: 2 -*- */
-/* Copyright(C) 2009-2012 Brazil
+/* Copyright(C) 2009-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -17,13 +17,8 @@
#ifndef GRN_HASH_H
#define GRN_HASH_H
-#ifndef GROONGA_IN_H
-#include "groonga_in.h"
-#endif /* GROONGA_IN_H */
-
-#ifndef GRN_CTX_H
-#include "ctx.h"
-#endif /* GRN_CTX_H */
+#include "grn.h"
+#include "grn_ctx.h"
#ifdef __cplusplus
extern "C" {
@@ -192,7 +187,15 @@ GRN_API grn_id grn_table_queue_tail(grn_table_queue *queue);
/**** grn_hash ****/
#define GRN_HASH_TINY (0x01<<6)
-#define GRN_HASH_MAX_KEY_SIZE GRN_TABLE_MAX_KEY_SIZE
+#define GRN_HASH_MAX_KEY_SIZE_NORMAL GRN_TABLE_MAX_KEY_SIZE
+#define GRN_HASH_MAX_KEY_SIZE_LARGE (0xffff)
+
+#define GRN_HASH_IS_LARGE_KEY(hash)\
+ ((hash)->key_size > GRN_HASH_MAX_KEY_SIZE_NORMAL)
+
+typedef struct _grn_hash_header_common grn_hash_header_common;
+typedef struct _grn_hash_header_normal grn_hash_header_normal;
+typedef struct _grn_hash_header_large grn_hash_header_large;
struct _grn_hash {
grn_db_obj obj;
@@ -210,7 +213,11 @@ struct _grn_hash {
/* For grn_io_hash. */
grn_io *io;
- struct grn_hash_header *header;
+ union {
+ grn_hash_header_common *common;
+ grn_hash_header_normal *normal;
+ grn_hash_header_large *large;
+ } header;
uint32_t *lock;
// uint32_t nref;
// unsigned int max_n_subrecs;
@@ -235,24 +242,36 @@ struct _grn_hash {
grn_tiny_bitmap bitmap;
};
-/* Header of grn_io_hash. */
-struct grn_hash_header {
- uint32_t flags;
- grn_encoding encoding;
- uint32_t key_size;
- uint32_t value_size;
- grn_id tokenizer;
- uint32_t curr_rec;
- int32_t curr_key;
- uint32_t idx_offset;
- uint32_t entry_size;
- uint32_t max_offset;
- uint32_t n_entries;
- uint32_t n_garbages;
- uint32_t lock;
- grn_id normalizer;
- uint32_t reserved[15];
- grn_id garbages[GRN_HASH_MAX_KEY_SIZE];
+#define GRN_HASH_HEADER_COMMON_FIELDS\
+ uint32_t flags;\
+ grn_encoding encoding;\
+ uint32_t key_size;\
+ uint32_t value_size;\
+ grn_id tokenizer;\
+ uint32_t curr_rec;\
+ int32_t curr_key;\
+ uint32_t idx_offset;\
+ uint32_t entry_size;\
+ uint32_t max_offset;\
+ uint32_t n_entries;\
+ uint32_t n_garbages;\
+ uint32_t lock;\
+ grn_id normalizer;\
+ uint32_t reserved[15]
+
+struct _grn_hash_header_common {
+ GRN_HASH_HEADER_COMMON_FIELDS;
+};
+
+struct _grn_hash_header_normal {
+ GRN_HASH_HEADER_COMMON_FIELDS;
+ grn_id garbages[GRN_HASH_MAX_KEY_SIZE_NORMAL];
+ grn_table_queue queue;
+};
+
+struct _grn_hash_header_large {
+ GRN_HASH_HEADER_COMMON_FIELDS;
+ grn_id garbages[GRN_HASH_MAX_KEY_SIZE_LARGE];
grn_table_queue queue;
};
diff --git a/storage/mroonga/vendor/groonga/lib/ii.h b/storage/mroonga/vendor/groonga/lib/grn_ii.h
index 877200fff7c..fe9b1ec26a4 100644
--- a/storage/mroonga/vendor/groonga/lib/ii.h
+++ b/storage/mroonga/vendor/groonga/lib/grn_ii.h
@@ -19,21 +19,10 @@
/* "ii" is for inverted index */
-#ifndef GROONGA_IN_H
-#include "groonga_in.h"
-#endif /* GROONGA_IN_H */
-
-#ifndef GRN_HASH_H
-#include "hash.h"
-#endif /* GRN_HASH_H */
-
-#ifndef GRN_IO_H
-#include "io.h"
-#endif /* GRN_IO_H */
-
-#ifndef GRN_STORE_H
-#include "store.h"
-#endif /* GRN_STORE_H */
+#include "grn.h"
+#include "grn_hash.h"
+#include "grn_io.h"
+#include "grn_store.h"
#ifdef __cplusplus
extern "C" {
@@ -113,8 +102,6 @@ grn_rc grn_ii_updspec_close(grn_ctx *ctx, grn_ii_updspec *u);
grn_rc grn_ii_updspec_add(grn_ctx *ctx, grn_ii_updspec *u, int pos, int32_t weight);
int grn_ii_updspec_cmp(grn_ii_updspec *a, grn_ii_updspec *b);
-uint32_t grn_ii_estimate_size(grn_ctx *ctx, grn_ii *ii, uint32_t key);
-
void grn_ii_expire(grn_ctx *ctx, grn_ii *ii);
typedef struct {
@@ -141,7 +128,6 @@ GRN_API grn_rc grn_ii_cursor_close(grn_ctx *ctx, grn_ii_cursor *c);
uint32_t grn_ii_max_section(grn_ii *ii);
-int grn_ii_check(grn_ii *ii);
const char *grn_ii_path(grn_ii *ii);
grn_obj *grn_ii_lexicon(grn_ii *ii);
@@ -165,6 +151,9 @@ struct _grn_select_optarg {
int (*func)(grn_ctx *, grn_hash *, const void *, int, void *);
void *func_arg;
int max_size;
+ grn_obj *scorer;
+ grn_obj *scorer_args_expr;
+ unsigned int scorer_args_expr_offset;
};
GRN_API grn_rc grn_ii_column_update(grn_ctx *ctx, grn_ii *ii, grn_id id,
@@ -184,7 +173,7 @@ void grn_ii_resolve_sel_and(grn_ctx *ctx, grn_hash *s, grn_operator op);
grn_rc grn_ii_at(grn_ctx *ctx, grn_ii *ii, grn_id id, grn_hash *s, grn_operator op);
-void grn_ii_inspect_elements(grn_ctx *ctx, grn_ii *ii, grn_obj *buf);
+void grn_ii_inspect_values(grn_ctx *ctx, grn_ii *ii, grn_obj *buf);
void grn_ii_cursor_inspect(grn_ctx *ctx, grn_ii_cursor *c, grn_obj *buf);
grn_rc grn_ii_build(grn_ctx *ctx, grn_ii *ii, uint64_t sparsity);
diff --git a/storage/mroonga/vendor/groonga/lib/io.h b/storage/mroonga/vendor/groonga/lib/grn_io.h
index 04c75919c5f..14f5e496f8b 100644
--- a/storage/mroonga/vendor/groonga/lib/io.h
+++ b/storage/mroonga/vendor/groonga/lib/grn_io.h
@@ -1,5 +1,5 @@
/* -*- c-basic-offset: 2 -*- */
-/* Copyright(C) 2009-2012 Brazil
+/* Copyright(C) 2009-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -17,30 +17,17 @@
#ifndef GRN_IO_H
#define GRN_IO_H
-#ifndef GROONGA_IN_H
-#include "groonga_in.h"
-#endif /* GROONGA_IN_H */
-
-#ifndef GRN_ERROR_H
-#include "error.h"
-#endif /* GRN_ERROR_H */
+#include "grn.h"
+#include "grn_error.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifdef WIN32
-#ifdef WIN32_FMO_EACH
-#define GRN_IO_FILE_SIZE 1073741824UL
-#else /* FMO_EACH */
-#define GRN_IO_FILE_SIZE 134217728L
-#endif /* FMO_EACH */
-#define GRN_IO_COPY grn_io_rdonly
-#define GRN_IO_UPDATE grn_io_wronly
+# define GRN_IO_FILE_CREATE_MODE (GENERIC_READ | GENERIC_WRITE)
#else /* WIN32 */
-#define GRN_IO_FILE_SIZE 1073741824UL
-#define GRN_IO_COPY grn_io_rdwr
-#define GRN_IO_UPDATE grn_io_rdwr
+# define GRN_IO_FILE_CREATE_MODE 0644
#endif /* WIN32 */
typedef enum {
@@ -72,19 +59,19 @@ typedef struct {
void *addr;
uint32_t diff;
int32_t cached;
-#if defined(WIN32) && defined(WIN32_FMO_EACH)
+#ifdef WIN32
HANDLE fmo;
-#endif /* defined(WIN32) && defined(WIN32_FMO_EACH) */
- void *value;
+#endif /* WIN32 */
+ void *uncompressed_value;
} grn_io_win;
typedef struct {
void *map;
uint32_t nref;
uint32_t count;
-#if defined(WIN32) && defined(WIN32_FMO_EACH)
+#ifdef WIN32
HANDLE fmo;
-#endif /* defined(WIN32) && defined(WIN32_FMO_EACH) */
+#endif /* WIN32 */
} grn_io_mapinfo;
typedef struct _grn_io_array_info grn_io_array_info;
@@ -135,13 +122,8 @@ GRN_API void *grn_io_header(grn_io *io);
void *grn_io_win_map(grn_io *io, grn_ctx *ctx, grn_io_win *iw, uint32_t segment,
uint32_t offset, uint32_t size, grn_io_rw_mode mode);
-grn_rc grn_io_win_mapv(grn_io_win **list, grn_ctx *ctx, int nent);
grn_rc grn_io_win_unmap(grn_io_win *iw);
-void *grn_io_win_map2(grn_io *io, grn_ctx *ctx, grn_io_win *iw, uint32_t segment,
- uint32_t offset, uint32_t size, grn_io_rw_mode mode);
-grn_rc grn_io_win_unmap2(grn_io_win *iw);
-
typedef struct _grn_io_ja_einfo grn_io_ja_einfo;
typedef struct _grn_io_ja_ehead grn_io_ja_ehead;
@@ -398,7 +380,7 @@ uint32_t grn_expire(grn_ctx *ctx, int count_thresh, uint32_t limit);
*_p++ = _v & 0xff; \
} else { \
*_p++ = 0x8f; \
- memcpy(_p, &_v, sizeof(uint32_t));\
+ grn_memcpy(_p, &_v, sizeof(uint32_t));\
_p += sizeof(uint32_t); \
} \
p = _p; \
@@ -413,7 +395,7 @@ uint32_t grn_expire(grn_ctx *ctx, int count_thresh, uint32_t limit);
switch (_v >> 4) { \
case 0x08 : \
if (_v == 0x8f) { \
- memcpy(&_v, _p, sizeof(uint32_t));\
+ grn_memcpy(&_v, _p, sizeof(uint32_t));\
_p += sizeof(uint32_t); \
} \
break; \
diff --git a/storage/mroonga/vendor/groonga/lib/grn_logger.h b/storage/mroonga/vendor/groonga/lib/grn_logger.h
new file mode 100644
index 00000000000..95186ca107a
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/grn_logger.h
@@ -0,0 +1,37 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2009-2015 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
+*/
+#ifndef GRN_LOGGER_H
+#define GRN_LOGGER_H
+
+#include "grn.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void grn_logger_init(void);
+void grn_logger_fin(grn_ctx *ctx);
+
+void grn_query_logger_init(void);
+void grn_query_logger_fin(grn_ctx *ctx);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRN_LOGGER_H */
diff --git a/storage/mroonga/vendor/groonga/lib/mrb.h b/storage/mroonga/vendor/groonga/lib/grn_mrb.h
index fe51e5e7670..7fae820d342 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb.h
+++ b/storage/mroonga/vendor/groonga/lib/grn_mrb.h
@@ -1,6 +1,6 @@
/* -*- c-basic-offset: 2 -*- */
/*
- Copyright(C) 2013 Brazil
+ Copyright(C) 2013-2014 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -19,8 +19,8 @@
#ifndef GRN_MRB_H
#define GRN_MRB_H
-#include "groonga_in.h"
-#include "ctx.h"
+#include "grn.h"
+#include "grn_ctx.h"
#ifdef GRN_WITH_MRUBY
# include <mruby.h>
@@ -34,6 +34,7 @@ extern "C" {
GRN_API mrb_value grn_mrb_eval(grn_ctx *ctx, const char *script, int script_length);
GRN_API mrb_value grn_mrb_load(grn_ctx *ctx, const char *path);
GRN_API grn_rc grn_mrb_to_grn(grn_ctx *ctx, mrb_value mrb_object, grn_obj *grn_object);
+GRN_API const char *grn_mrb_get_system_ruby_scripts_dir(grn_ctx *ctx);
#endif
#ifdef __cplusplus
diff --git a/storage/mroonga/vendor/groonga/lib/grn_msgpack.h b/storage/mroonga/vendor/groonga/lib/grn_msgpack.h
new file mode 100644
index 00000000000..db86987c08a
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/grn_msgpack.h
@@ -0,0 +1,48 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2009-2015 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
+*/
+#ifndef GRN_MSGPACK_H
+#define GRN_MSGPACK_H
+
+#ifdef GRN_WITH_MESSAGE_PACK
+# include <msgpack.h>
+
+# if MSGPACK_VERSION_MAJOR < 1
+typedef unsigned int msgpack_size_t;
+
+# define msgpack_pack_str(packer, size) msgpack_pack_raw(packer, size)
+# define msgpack_pack_str_body(packer, value, size) \
+ msgpack_pack_raw_body(packer, value, size)
+
+# define MSGPACK_OBJECT_STR MSGPACK_OBJECT_RAW
+# define MSGPACK_OBJECT_FLOAT MSGPACK_OBJECT_DOUBLE
+
+# define MSGPACK_OBJECT_STR_PTR(object) (object)->via.raw.ptr
+# define MSGPACK_OBJECT_STR_SIZE(object) (object)->via.raw.size
+
+# define MSGPACK_OBJECT_FLOAT_VALUE(object) (object)->via.dec
+# else /* MSGPACK_VERSION_MAJOR < 1 */
+typedef size_t msgpack_size_t;
+
+# define MSGPACK_OBJECT_STR_PTR(object) (object)->via.str.ptr
+# define MSGPACK_OBJECT_STR_SIZE(object) (object)->via.str.size
+
+# define MSGPACK_OBJECT_FLOAT_VALUE(object) (object)->via.f64
+# endif /* MSGPACK_VERSION_MAJOR < 1 */
+#endif /* GRN_WITH_MESSAGE_PACK */
+
+#endif /* GRN_MSGPACK_H */
diff --git a/storage/mroonga/vendor/groonga/lib/normalizer_in.h b/storage/mroonga/vendor/groonga/lib/grn_normalizer.h
index 201c789f626..8c7bfddf810 100644
--- a/storage/mroonga/vendor/groonga/lib/normalizer_in.h
+++ b/storage/mroonga/vendor/groonga/lib/grn_normalizer.h
@@ -15,20 +15,12 @@
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 GRN_NORMALIZER_IN_H
-#define GRN_NORMALIZER_IN_H
+#ifndef GRN_NORMALIZER_H
+#define GRN_NORMALIZER_H
-#ifndef GROONGA_IN_H
-#include "groonga_in.h"
-#endif /* GROONGA_IN_H */
-
-#ifndef GRN_CTX_H
-#include "ctx.h"
-#endif /* GRN_CTX_H */
-
-#ifndef GRN_DB_H
-#include "db.h"
-#endif /* GRN_DB_H */
+#include "grn.h"
+#include "grn_ctx.h"
+#include "grn_db.h"
#ifdef __cplusplus
extern "C" {
@@ -49,4 +41,4 @@ grn_rc grn_db_init_builtin_normalizers(grn_ctx *ctx);
}
#endif
-#endif /* GRN_NORMALIZER_IN_H */
+#endif /* GRN_NORMALIZER_H */
diff --git a/storage/mroonga/vendor/groonga/lib/output.h b/storage/mroonga/vendor/groonga/lib/grn_output.h
index 7c8a3f7a769..63752e90bd9 100644
--- a/storage/mroonga/vendor/groonga/lib/output.h
+++ b/storage/mroonga/vendor/groonga/lib/grn_output.h
@@ -17,21 +17,10 @@
#ifndef GRN_OUTPUT_H
#define GRN_OUTPUT_H
-#ifndef GROONGA_IN_H
-#include "groonga_in.h"
-#endif /* GROONGA_IN_H */
-
-#ifndef GRN_CTX_H
-#include "ctx.h"
-#endif /* GRN_CTX_H */
-
-#ifndef GRN_STORE_H
-#include "store.h"
-#endif /* GRN_STORE_H */
-
-#ifndef GRN_CTX_IMPL_H
-#include "ctx_impl.h"
-#endif /* GRN_CTX_IMPL_H */
+#include "grn.h"
+#include "grn_ctx.h"
+#include "grn_store.h"
+#include "grn_ctx_impl.h"
#ifdef __cplusplus
extern "C" {
@@ -59,6 +48,21 @@ GRN_API void grn_output_bool(grn_ctx *ctx, grn_obj *outbuf,
grn_content_type output_type,
grn_bool value);
+GRN_API void grn_output_table_columns(grn_ctx *ctx,
+ grn_obj *outbuf,
+ grn_content_type output_type,
+ grn_obj *table,
+ grn_obj_format *format);
+GRN_API void grn_output_table_records(grn_ctx *ctx,
+ grn_obj *outbuf,
+ grn_content_type output_type,
+ grn_obj *table,
+ grn_obj_format *format);
+
+grn_rc grn_output_format_set_columns(grn_ctx *ctx, grn_obj_format *format,
+ grn_obj *table,
+ const char *columns, int columns_len);
+
#define GRN_OUTPUT_ARRAY_OPEN(name,nelements) \
(grn_ctx_output_array_open(ctx, name, nelements))
#define GRN_OUTPUT_ARRAY_CLOSE() \
@@ -81,6 +85,10 @@ GRN_API void grn_output_bool(grn_ctx *ctx, grn_obj *outbuf,
(grn_ctx_output_bool(ctx, value))
#define GRN_OUTPUT_OBJ(obj,format)\
(grn_ctx_output_obj(ctx, obj, format))
+#define GRN_OUTPUT_TABLE_COLUMNS(table,format)\
+ (grn_ctx_output_table_columns(ctx, table, format))
+#define GRN_OUTPUT_TABLE_RECORDS(table,format)\
+ (grn_ctx_output_table_records(ctx, table, format))
#ifdef __cplusplus
}
diff --git a/storage/mroonga/vendor/groonga/lib/pat.h b/storage/mroonga/vendor/groonga/lib/grn_pat.h
index d2d10322c7c..763c6848a63 100644
--- a/storage/mroonga/vendor/groonga/lib/pat.h
+++ b/storage/mroonga/vendor/groonga/lib/grn_pat.h
@@ -17,12 +17,9 @@
#ifndef GRN_PAT_H
#define GRN_PAT_H
-#ifndef GROONGA_IN_H
-#include "groonga_in.h"
-#endif /* GROONGA_IN_H */
-
-#include "db.h"
-#include "hash.h"
+#include "grn.h"
+#include "grn_db.h"
+#include "grn_hash.h"
#ifdef __cplusplus
extern "C" {
diff --git a/storage/mroonga/vendor/groonga/lib/plugin_in.h b/storage/mroonga/vendor/groonga/lib/grn_plugin.h
index 6f983089dc9..75b29f56cc9 100644
--- a/storage/mroonga/vendor/groonga/lib/plugin_in.h
+++ b/storage/mroonga/vendor/groonga/lib/grn_plugin.h
@@ -14,20 +14,12 @@
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 GRN_PLUGIN_IN_H
-#define GRN_PLUGIN_IN_H
+#ifndef GRN_PLUGIN_H
+#define GRN_PLUGIN_H
-#ifndef GROONGA_IN_H
-#include "groonga_in.h"
-#endif /* GROONGA_IN_H */
-
-#ifndef GRN_CTX_H
-#include "ctx.h"
-#endif /* GRN_CTX_H */
-
-#ifndef GRN_STORE_H
-#include "store.h"
-#endif /* GRN_STORE_H */
+#include "grn.h"
+#include "grn_ctx.h"
+#include "grn_store.h"
#ifdef __cplusplus
extern "C" {
@@ -45,6 +37,7 @@ typedef void * grn_dl_symbol;
typedef struct _grn_plugin grn_plugin;
struct _grn_plugin {
+ char path[PATH_MAX];
grn_dl dl;
grn_plugin_func init_func;
grn_plugin_func register_func;
@@ -60,9 +53,10 @@ grn_rc grn_plugin_close(grn_ctx *ctx, grn_id id);
grn_id grn_plugin_reference(grn_ctx *ctx, const char *filename);
const char *grn_plugin_path(grn_ctx *ctx, grn_id id);
char *grn_plugin_find_path(grn_ctx *ctx, const char *name);
+void grn_plugin_ensure_registered(grn_ctx *ctx, grn_obj *proc);
#ifdef __cplusplus
}
#endif
-#endif /* GRN_PLUGIN_IN_H */
+#endif /* GRN_PLUGIN_H */
diff --git a/storage/mroonga/vendor/groonga/lib/proc.h b/storage/mroonga/vendor/groonga/lib/grn_proc.h
index 1f7f81d5d97..fb01698ea69 100644
--- a/storage/mroonga/vendor/groonga/lib/proc.h
+++ b/storage/mroonga/vendor/groonga/lib/grn_proc.h
@@ -17,9 +17,7 @@
#ifndef GRN_PROC_H
#define GRN_PROC_H
-#ifndef GROONGA_IN_H
-#include "groonga_in.h"
-#endif /* GROONGA_IN_H */
+#include "grn.h"
#ifdef __cplusplus
extern "C" {
diff --git a/storage/mroonga/vendor/groonga/lib/grn_request_canceler.h b/storage/mroonga/vendor/groonga/lib/grn_request_canceler.h
new file mode 100644
index 00000000000..4c77ea5246e
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/grn_request_canceler.h
@@ -0,0 +1,31 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2014 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
+*/
+
+#ifndef GRN_REQUEST_CANCELER_H
+#define GRN_REQUEST_CANCELER_H
+
+#include "grn.h"
+
+grn_bool grn_request_canceler_init(void);
+void grn_request_canceler_fin(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRN_REQUEST_CANCELER_H */
diff --git a/storage/mroonga/vendor/groonga/lib/grn_rset.h b/storage/mroonga/vendor/groonga/lib/grn_rset.h
new file mode 100644
index 00000000000..b92e21162df
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/grn_rset.h
@@ -0,0 +1,115 @@
+/* -*- c-basic-offset: 2 -*- */
+/* Copyright(C) 2009-2015 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
+*/
+#ifndef GRN_RSET_H
+#define GRN_RSET_H
+
+#include "grn.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct {
+ double score;
+ int n_subrecs;
+ int subrecs[1];
+} grn_rset_recinfo;
+
+typedef struct {
+ grn_id rid;
+ uint32_t sid;
+ uint32_t pos;
+} grn_rset_posinfo;
+
+#define GRN_RSET_UTIL_BIT (0x80000000)
+
+#define GRN_RSET_N_SUBRECS_SIZE (sizeof(int))
+#define GRN_RSET_MAX_SIZE (sizeof(int64_t))
+#define GRN_RSET_MIN_SIZE (sizeof(int64_t))
+#define GRN_RSET_SUM_SIZE (sizeof(int64_t))
+#define GRN_RSET_AVG_SIZE (sizeof(double))
+
+#define GRN_RSET_SCORE_SIZE (sizeof(double))
+
+#define GRN_RSET_N_SUBRECS(ri) ((ri)->n_subrecs & ~GRN_RSET_UTIL_BIT)
+
+#define GRN_RSET_SUBREC_SIZE(subrec_size) \
+ (GRN_RSET_SCORE_SIZE + subrec_size)
+#define GRN_RSET_SUBRECS_CMP(a,b,dir) (((a) - (b))*(dir))
+#define GRN_RSET_SUBRECS_NTH(subrecs,size,n) \
+ ((double *)((byte *)subrecs + n * GRN_RSET_SUBREC_SIZE(size)))
+#define GRN_RSET_SUBRECS_COPY(subrecs,size,n,src) \
+ (grn_memcpy(GRN_RSET_SUBRECS_NTH(subrecs, size, n), src, GRN_RSET_SUBREC_SIZE(size)))
+#define GRN_RSET_SUBRECS_SIZE(subrec_size,n) \
+ (GRN_RSET_SUBREC_SIZE(subrec_size) * n)
+
+uint32_t grn_rset_recinfo_calc_values_size(grn_ctx *ctx,
+ grn_table_group_flags flags);
+void grn_rset_recinfo_update_calc_values(grn_ctx *ctx,
+ grn_rset_recinfo *ri,
+ grn_obj *table,
+ grn_obj *value);
+
+int64_t *grn_rset_recinfo_get_max_(grn_ctx *ctx,
+ grn_rset_recinfo *ri,
+ grn_obj *table);
+int64_t grn_rset_recinfo_get_max(grn_ctx *ctx,
+ grn_rset_recinfo *ri,
+ grn_obj *table);
+void grn_rset_recinfo_set_max(grn_ctx *ctx,
+ grn_rset_recinfo *ri,
+ grn_obj *table,
+ int64_t max);
+
+int64_t *grn_rset_recinfo_get_min_(grn_ctx *ctx,
+ grn_rset_recinfo *ri,
+ grn_obj *table);
+int64_t grn_rset_recinfo_get_min(grn_ctx *ctx,
+ grn_rset_recinfo *ri,
+ grn_obj *table);
+void grn_rset_recinfo_set_min(grn_ctx *ctx,
+ grn_rset_recinfo *ri,
+ grn_obj *table,
+ int64_t min);
+
+int64_t *grn_rset_recinfo_get_sum_(grn_ctx *ctx,
+ grn_rset_recinfo *ri,
+ grn_obj *table);
+int64_t grn_rset_recinfo_get_sum(grn_ctx *ctx,
+ grn_rset_recinfo *ri,
+ grn_obj *table);
+void grn_rset_recinfo_set_sum(grn_ctx *ctx,
+ grn_rset_recinfo *ri,
+ grn_obj *table,
+ int64_t sum);
+
+double *grn_rset_recinfo_get_avg_(grn_ctx *ctx,
+ grn_rset_recinfo *ri,
+ grn_obj *table);
+double grn_rset_recinfo_get_avg(grn_ctx *ctx,
+ grn_rset_recinfo *ri,
+ grn_obj *table);
+void grn_rset_recinfo_set_avg(grn_ctx *ctx,
+ grn_rset_recinfo *ri,
+ grn_obj *table,
+ double avg);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRN_RSET_H */
diff --git a/storage/mroonga/vendor/groonga/lib/grn_scorer.h b/storage/mroonga/vendor/groonga/lib/grn_scorer.h
new file mode 100644
index 00000000000..05f982180db
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/grn_scorer.h
@@ -0,0 +1,51 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2015 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
+*/
+#ifndef GRN_SCORER_H
+#define GRN_SCORER_H
+
+#include "grn_ctx.h"
+#include "grn_db.h"
+
+#include <groonga/scorer.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct _grn_scorer_matched_record {
+ grn_obj *table;
+ grn_obj *lexicon;
+ grn_id id;
+ grn_obj terms;
+ grn_obj term_weights;
+ uint32_t total_term_weights;
+ uint64_t n_documents;
+ uint32_t n_occurrences;
+ uint64_t n_candidates;
+ uint32_t n_tokens;
+ int weight;
+ grn_obj *args_expr;
+ unsigned int args_expr_offset;
+};
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRN_SCORER_H */
diff --git a/storage/mroonga/vendor/groonga/lib/grn_scorers.h b/storage/mroonga/vendor/groonga/lib/grn_scorers.h
new file mode 100644
index 00000000000..ed6c18c211a
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/grn_scorers.h
@@ -0,0 +1,33 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2015 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
+*/
+#ifndef GRN_SCORERS_H
+#define GRN_SCORERS_H
+
+#include "grn_ctx.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+grn_rc grn_db_init_builtin_scorers(grn_ctx *ctx);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRN_SCORERS_H */
diff --git a/storage/mroonga/vendor/groonga/lib/snip.h b/storage/mroonga/vendor/groonga/lib/grn_snip.h
index 7a252921b3a..7c123e0c5f4 100644
--- a/storage/mroonga/vendor/groonga/lib/snip.h
+++ b/storage/mroonga/vendor/groonga/lib/grn_snip.h
@@ -17,15 +17,15 @@
#ifndef GRN_SNIP_H
#define GRN_SNIP_H
-#ifndef GROONGA_IN_H
-#include "groonga_in.h"
-#endif /* GROONGA_IN_H */
+#ifndef GRN_H
+#include "grn.h"
+#endif /* GRN_H */
#ifndef GRN_STR_H
-#include "str.h"
+#include "grn_str.h"
#endif /* GRN_STR_H */
-#include "db.h"
+#include "grn_db.h"
#define ASIZE 256U
#define MAX_SNIP_TAG_COUNT 512U
diff --git a/storage/mroonga/vendor/groonga/lib/store.h b/storage/mroonga/vendor/groonga/lib/grn_store.h
index 719fe775bd9..9e1223e0685 100644
--- a/storage/mroonga/vendor/groonga/lib/store.h
+++ b/storage/mroonga/vendor/groonga/lib/grn_store.h
@@ -17,21 +17,10 @@
#ifndef GRN_STORE_H
#define GRN_STORE_H
-#ifndef GROONGA_IN_H
-#include "groonga_in.h"
-#endif /* GROONGA_IN_H */
-
-#ifndef GRN_CTX_H
-#include "ctx.h"
-#endif /* GRN_CTX_H */
-
-#ifndef GRN_HASH_H
-#include "hash.h"
-#endif /* GRN_HASH_H */
-
-#ifndef GRN_IO_H
-#include "io.h"
-#endif /* GRN_IO_H */
+#include "grn.h"
+#include "grn_ctx.h"
+#include "grn_hash.h"
+#include "grn_io.h"
#ifdef __cplusplus
extern "C" {
@@ -82,8 +71,6 @@ void *grn_ra_ref_cache(grn_ctx *ctx, grn_ra *ra, grn_id id, grn_ra_cache *cache)
/**** variable sized elements ****/
-extern grn_bool grn_ja_skip_same_value_put;
-
typedef struct _grn_ja grn_ja;
struct _grn_ja {
diff --git a/storage/mroonga/vendor/groonga/lib/str.h b/storage/mroonga/vendor/groonga/lib/grn_str.h
index 069250a70d8..e6fab611ccd 100644
--- a/storage/mroonga/vendor/groonga/lib/str.h
+++ b/storage/mroonga/vendor/groonga/lib/grn_str.h
@@ -17,13 +17,8 @@
#ifndef GRN_STR_H
#define GRN_STR_H
-#ifndef GROONGA_IN_H
-#include "groonga_in.h"
-#endif /* GROONGA_IN_H */
-
-#ifndef GRN_NFKC_H
+#include "grn.h"
#include <groonga/nfkc.h>
-#endif /* GRN_NFKC_H */
#ifdef __cplusplus
extern "C" {
@@ -59,6 +54,7 @@ GRN_API int grn_atoi(const char *nptr, const char *end, const char **rest);
GRN_API unsigned int grn_atoui(const char *nptr, const char *end, const char **rest);
unsigned int grn_htoui(const char *nptr, const char *end, const char **rest);
GRN_API int64_t grn_atoll(const char *nptr, const char *end, const char **rest);
+GRN_API uint64_t grn_atoull(const char *nptr, const char *end, const char **rest);
grn_rc grn_itoa(int i, char *p, char *end, char **rest);
grn_rc grn_lltoa(int64_t i, char *p, char *end, char **rest);
grn_rc grn_ulltoa(uint64_t i, char *p, char *end, char **rest);
@@ -82,7 +78,7 @@ GRN_API grn_str *grn_str_open_(grn_ctx *ctx, const char *str, unsigned int str_l
if (GRN_BULK_OUTP(buf)) {\
(buf)->u.b.curr += (len);\
} else {\
- (buf)->header.flags += (len);\
+ (buf)->header.flags += (grn_obj_flags)(len);\
}\
} while (0)
diff --git a/storage/mroonga/vendor/groonga/lib/string_in.h b/storage/mroonga/vendor/groonga/lib/grn_string.h
index 55e2cb2cbcb..bb5905c84f8 100644
--- a/storage/mroonga/vendor/groonga/lib/string_in.h
+++ b/storage/mroonga/vendor/groonga/lib/grn_string.h
@@ -20,21 +20,21 @@
#ifndef GRN_STRING_H
#define GRN_STRING_H
-#ifndef GROONGA_IN_H
-# include "groonga_in.h"
-#endif /* GROONGA_IN_H */
+#ifndef GRN_H
+# include "grn.h"
+#endif /* GRN_H */
#ifndef GRN_CTX_H
-# include "ctx.h"
+# include "grn_ctx.h"
#endif /* GRN_CTX_H */
#ifndef GRN_DB_H
-# include "db.h"
+# include "grn_db.h"
#endif /* GRN_DB_H */
#ifndef GRN_STR_H
-# include "str.h"
-#endif /* GRN_STR_IN_H */
+# include "grn_str.h"
+#endif /* GRN_STR_H */
#ifdef __cplusplus
extern "C" {
@@ -62,4 +62,4 @@ grn_rc grn_string_inspect(grn_ctx *ctx, grn_obj *buffer, grn_obj *string);
}
#endif
-#endif /* GRN_STRING_IN_H */
+#endif /* GRN_STRING_H */
diff --git a/storage/mroonga/vendor/groonga/lib/token.h b/storage/mroonga/vendor/groonga/lib/grn_token_cursor.h
index 868930758ba..fec62224418 100644
--- a/storage/mroonga/vendor/groonga/lib/token.h
+++ b/storage/mroonga/vendor/groonga/lib/grn_token_cursor.h
@@ -14,24 +14,11 @@
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 GRN_TOKEN_H
-#define GRN_TOKEN_H
+#ifndef GRN_TOKEN_CURSOR_H
+#define GRN_TOKEN_CURSOR_H
-#ifndef GROONGA_IN_H
-#include "groonga_in.h"
-#endif /* GROONGA_IN_H */
-
-#ifndef GRN_CTX_H
-#include "ctx.h"
-#endif /* GRN_CTX_H */
-
-#ifndef GRN_DB_H
-#include "db.h"
-#endif /* GRN_DB_H */
-
-#ifndef GRN_STR_H
-#include "str.h"
-#endif /* GRN_STR_H */
+#include "grn_ctx.h"
+#include "grn_db.h"
#include <groonga/tokenizer.h>
@@ -39,16 +26,21 @@
extern "C" {
#endif
+#define GRN_TOKENIZER_BEGIN_MARK_UTF8 "\xEF\xBF\xAF"
+#define GRN_TOKENIZER_BEGIN_MARK_UTF8_LEN 3
+#define GRN_TOKENIZER_END_MARK_UTF8 "\xEF\xBF\xB0"
+#define GRN_TOKENIZER_END_MARK_UTF8_LEN 3
+
typedef enum {
- GRN_TOKEN_DOING = 0,
- GRN_TOKEN_DONE,
- GRN_TOKEN_DONE_SKIP,
- GRN_TOKEN_NOT_FOUND
-} grn_token_status;
+ GRN_TOKEN_CURSOR_DOING = 0,
+ GRN_TOKEN_CURSOR_DONE,
+ GRN_TOKEN_CURSOR_DONE_SKIP,
+ GRN_TOKEN_CURSOR_NOT_FOUND
+} grn_token_cursor_status;
struct _grn_token {
grn_obj data;
- grn_tokenizer_status status;
+ grn_token_status status;
};
typedef struct {
@@ -58,9 +50,9 @@ typedef struct {
uint32_t orig_blen;
uint32_t curr_size;
int32_t pos;
- grn_token_mode mode;
- grn_token_status status;
- uint8_t force_prefix;
+ grn_tokenize_mode mode;
+ grn_token_cursor_status status;
+ grn_bool force_prefix;
grn_obj_flags table_flags;
grn_encoding encoding;
grn_obj *tokenizer;
@@ -70,26 +62,18 @@ typedef struct {
grn_obj *nstr;
} grn_token_cursor;
-extern grn_obj *grn_token_uvector;
-
-grn_rc grn_token_init(void);
-grn_rc grn_token_fin(void);
-
-#define GRN_TOKEN_ENABLE_TOKENIZED_DELIMITER (0x01L<<0)
+#define GRN_TOKEN_CURSOR_ENABLE_TOKENIZED_DELIMITER (0x01L<<0)
GRN_API grn_token_cursor *grn_token_cursor_open(grn_ctx *ctx, grn_obj *table,
const char *str, size_t str_len,
- grn_token_mode mode,
+ grn_tokenize_mode mode,
unsigned int flags);
GRN_API grn_id grn_token_cursor_next(grn_ctx *ctx, grn_token_cursor *token_cursor);
GRN_API grn_rc grn_token_cursor_close(grn_ctx *ctx, grn_token_cursor *token_cursor);
-grn_rc grn_db_init_mecab_tokenizer(grn_ctx *ctx);
-grn_rc grn_db_init_builtin_tokenizers(grn_ctx *ctx);
-
#ifdef __cplusplus
}
#endif
-#endif /* GRN_TOKEN_H */
+#endif /* GRN_TOKEN_CURSOR_H */
diff --git a/storage/mroonga/vendor/groonga/lib/grn_tokenizers.h b/storage/mroonga/vendor/groonga/lib/grn_tokenizers.h
new file mode 100644
index 00000000000..fb85fb76a48
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/grn_tokenizers.h
@@ -0,0 +1,38 @@
+/* -*- c-basic-offset: 2 -*- */
+/* Copyright(C) 2009-2014 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
+*/
+#ifndef GRN_TOKENIZERS_H
+#define GRN_TOKENIZERS_H
+
+#include "grn_ctx.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern grn_obj *grn_tokenizer_uvector;
+
+grn_rc grn_tokenizers_init(void);
+grn_rc grn_tokenizers_fin(void);
+
+grn_rc grn_db_init_mecab_tokenizer(grn_ctx *ctx);
+grn_rc grn_db_init_builtin_tokenizers(grn_ctx *ctx);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRN_TOKENIZERS_H */
diff --git a/storage/mroonga/vendor/groonga/lib/grn_util.h b/storage/mroonga/vendor/groonga/lib/grn_util.h
new file mode 100644
index 00000000000..f94140dcb66
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/grn_util.h
@@ -0,0 +1,38 @@
+/* -*- c-basic-offset: 2 -*- */
+/* Copyright(C) 2010-2015 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
+*/
+#ifndef GRN_UTIL_H
+#define GRN_UTIL_H
+
+#include "grn.h"
+#include "grn_ctx.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+GRN_API grn_rc grn_normalize_offset_and_limit(grn_ctx *ctx, int size, int *offset, int *limit);
+
+GRN_API const char *grn_win32_base_dir(void);
+GRN_API char *grn_path_separator_to_system(char *dest, char *groonga_path);
+
+int grn_mkstemp(char *path_template);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRN_UTIL_H */
diff --git a/storage/mroonga/vendor/groonga/lib/hash.c b/storage/mroonga/vendor/groonga/lib/hash.c
index fa5854a6a93..2c44f25cc20 100644
--- a/storage/mroonga/vendor/groonga/lib/hash.c
+++ b/storage/mroonga/vendor/groonga/lib/hash.c
@@ -1,6 +1,6 @@
/* -*- c-basic-offset: 2 -*- */
/*
- Copyright(C) 2009-2012 Brazil
+ Copyright(C) 2009-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -15,13 +15,13 @@
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 "hash.h"
-#include "output.h"
+#include "grn_hash.h"
+#include "grn_output.h"
#include <string.h>
#include <limits.h>
-#include "store.h"
-#include "normalizer_in.h"
+#include "grn_store.h"
+#include "grn_normalizer.h"
/* grn_tiny_array */
@@ -700,7 +700,7 @@ grn_array_get_value(grn_ctx *ctx, grn_array *array, grn_id id, void *valuebuf)
void * const value = grn_array_get_value_inline(ctx, array, id);
if (value) {
if (valuebuf) {
- memcpy(valuebuf, value, array->value_size);
+ grn_memcpy(valuebuf, value, array->value_size);
}
return array->value_size;
}
@@ -724,7 +724,7 @@ grn_array_set_value_inline(grn_ctx *ctx, grn_array *array, grn_id id,
switch ((flags & GRN_OBJ_SET_MASK)) {
case GRN_OBJ_SET :
- memcpy(entry, value, array->value_size);
+ grn_memcpy(entry, value, array->value_size);
return GRN_SUCCESS;
case GRN_OBJ_INCR :
switch (array->value_size) {
@@ -863,7 +863,7 @@ grn_array_copy_sort_key(grn_ctx *ctx, grn_array *array,
if (!array->keys) {
return ctx->rc;
}
- memcpy(array->keys, keys, sizeof(grn_table_sort_key) * n_keys);
+ grn_memcpy(array->keys, keys, sizeof(grn_table_sort_key) * n_keys);
array->n_keys = n_keys;
return GRN_SUCCESS;
}
@@ -1167,7 +1167,11 @@ grn_array_unblock(grn_ctx *ctx, grn_array *array)
/* grn_hash : hash table */
#define GRN_HASH_MAX_SEGMENT 0x400
-#define GRN_HASH_HEADER_SIZE 0x9000
+#define GRN_HASH_HEADER_SIZE_NORMAL 0x9000
+#define GRN_HASH_HEADER_SIZE_LARGE\
+ (GRN_HASH_HEADER_SIZE_NORMAL +\
+ (sizeof(grn_id) *\
+ (GRN_HASH_MAX_KEY_SIZE_LARGE - GRN_HASH_MAX_KEY_SIZE_NORMAL)))
#define GRN_HASH_SEGMENT_SIZE 0x400000
#define W_OF_KEY_IN_A_SEGMENT 22
#define IDX_MASK_IN_A_SEGMENT 0xfffff
@@ -1298,7 +1302,7 @@ inline static grn_id *
grn_hash_idx_at(grn_ctx *ctx, grn_hash *hash, grn_id id)
{
if (grn_hash_is_io_hash(hash)) {
- id = (id & *hash->max_offset) + hash->header->idx_offset;
+ id = (id & *hash->max_offset) + hash->header.common->idx_offset;
return grn_io_hash_idx_at(ctx, hash, id);
} else {
return hash->index + (id & *hash->max_offset);
@@ -1380,15 +1384,18 @@ grn_io_hash_entry_put_key(grn_ctx *ctx, grn_hash *hash,
key_offset = entry->key.offset;
} else {
uint32_t segment_id;
+ grn_hash_header_common *header;
+
+ header = hash->header.common;
if (key_size >= GRN_HASH_SEGMENT_SIZE) {
return GRN_INVALID_ARGUMENT;
}
- key_offset = hash->header->curr_key;
+ key_offset = header->curr_key;
segment_id = (key_offset + key_size) >> W_OF_KEY_IN_A_SEGMENT;
if ((key_offset >> W_OF_KEY_IN_A_SEGMENT) != segment_id) {
- key_offset = hash->header->curr_key = segment_id << W_OF_KEY_IN_A_SEGMENT;
+ key_offset = header->curr_key = segment_id << W_OF_KEY_IN_A_SEGMENT;
}
- hash->header->curr_key += key_size;
+ header->curr_key += key_size;
entry->key.offset = key_offset;
}
@@ -1397,7 +1404,7 @@ grn_io_hash_entry_put_key(grn_ctx *ctx, grn_hash *hash,
if (!key_ptr) {
return GRN_NO_MEMORY_AVAILABLE;
}
- memcpy(key_ptr, key, key_size);
+ grn_memcpy(key_ptr, key, key_size);
}
return GRN_SUCCESS;
}
@@ -1410,7 +1417,7 @@ grn_hash_entry_put_key(grn_ctx *ctx, grn_hash *hash,
if (hash->obj.header.flags & GRN_OBJ_KEY_VAR_SIZE) {
if (grn_hash_is_io_hash(hash)) {
if (key_size <= sizeof(entry->io_entry.key.buf)) {
- memcpy(entry->io_entry.key.buf, key, key_size);
+ grn_memcpy(entry->io_entry.key.buf, key, key_size);
entry->io_entry.flag = HASH_IMMEDIATE;
} else {
const grn_rc rc =
@@ -1425,7 +1432,7 @@ grn_hash_entry_put_key(grn_ctx *ctx, grn_hash *hash,
entry->io_entry.key_size = key_size;
} else {
if (key_size <= sizeof(entry->tiny_entry.key.buf)) {
- memcpy(entry->tiny_entry.key.buf, key, key_size);
+ grn_memcpy(entry->tiny_entry.key.buf, key, key_size);
entry->tiny_entry.flag = HASH_IMMEDIATE;
} else {
grn_ctx * const ctx = hash->ctx;
@@ -1433,7 +1440,7 @@ grn_hash_entry_put_key(grn_ctx *ctx, grn_hash *hash,
if (!entry->tiny_entry.key.ptr) {
return GRN_NO_MEMORY_AVAILABLE;
}
- memcpy(entry->tiny_entry.key.ptr, key, key_size);
+ grn_memcpy(entry->tiny_entry.key.ptr, key, key_size);
entry->tiny_entry.flag = 0;
}
entry->tiny_entry.hash_value = hash_value;
@@ -1444,7 +1451,7 @@ grn_hash_entry_put_key(grn_ctx *ctx, grn_hash *hash,
*(uint32_t *)entry->plain_entry.key = hash_value;
} else {
entry->rich_entry.hash_value = hash_value;
- memcpy(entry->rich_entry.key_and_value, key, key_size);
+ grn_memcpy(entry->rich_entry.key_and_value, key, key_size);
}
}
return GRN_SUCCESS;
@@ -1537,7 +1544,8 @@ grn_io_hash_calculate_entry_size(uint32_t key_size, uint32_t value_size,
}
static grn_io *
-grn_io_hash_create_io(grn_ctx *ctx, const char *path, uint32_t entry_size)
+grn_io_hash_create_io(grn_ctx *ctx, const char *path,
+ uint32_t header_size, uint32_t entry_size)
{
uint32_t w_of_element = 0;
grn_io_array_spec array_spec[4];
@@ -1555,7 +1563,7 @@ grn_io_hash_create_io(grn_ctx *ctx, const char *path, uint32_t entry_size)
array_spec[GRN_HASH_INDEX_SEGMENT].max_n_segments = 1U << (30 - (22 - 2));
array_spec[GRN_HASH_BITMAP_SEGMENT].w_of_element = 0;
array_spec[GRN_HASH_BITMAP_SEGMENT].max_n_segments = 1U << (30 - (22 + 3));
- return grn_io_create_with_array(ctx, path, GRN_HASH_HEADER_SIZE,
+ return grn_io_create_with_array(ctx, path, header_size,
GRN_HASH_SEGMENT_SIZE,
grn_io_auto, 4, array_spec);
}
@@ -1566,12 +1574,17 @@ grn_io_hash_init(grn_ctx *ctx, grn_hash *hash, const char *path,
grn_encoding encoding, uint32_t init_size)
{
grn_io *io;
- struct grn_hash_header *header;
- uint32_t entry_size, max_offset;
+ grn_hash_header_common *header;
+ uint32_t header_size, entry_size, max_offset;
+ if (key_size <= GRN_HASH_MAX_KEY_SIZE_NORMAL) {
+ header_size = GRN_HASH_HEADER_SIZE_NORMAL;
+ } else {
+ header_size = GRN_HASH_HEADER_SIZE_LARGE;
+ }
entry_size = grn_io_hash_calculate_entry_size(key_size, value_size, flags);
- io = grn_io_hash_create_io(ctx, path, entry_size);
+ io = grn_io_hash_create_io(ctx, path, header_size, entry_size);
if (!io) {
return GRN_NO_MEMORY_AVAILABLE;
}
@@ -1587,6 +1600,8 @@ grn_io_hash_init(grn_ctx *ctx, grn_hash *hash, const char *path,
encoding = ctx->encoding;
}
+ hash->key_size = key_size;
+
header = grn_io_header(io);
header->flags = flags;
header->encoding = encoding;
@@ -1610,11 +1625,18 @@ grn_io_hash_init(grn_ctx *ctx, grn_hash *hash, const char *path,
header->normalizer = GRN_ID_NIL;
}
GRN_PTR_INIT(&(hash->token_filters), GRN_OBJ_VECTOR, GRN_ID_NIL);
- grn_table_queue_init(ctx, &header->queue);
+ {
+ grn_table_queue *queue;
+ if (GRN_HASH_IS_LARGE_KEY(hash)) {
+ queue = &(((grn_hash_header_large *)(header))->queue);
+ } else {
+ queue = &(((grn_hash_header_normal *)(header))->queue);
+ }
+ grn_table_queue_init(ctx, queue);
+ }
hash->obj.header.flags = header->flags;
hash->ctx = ctx;
- hash->key_size = key_size;
hash->encoding = encoding;
hash->value_size = value_size;
hash->entry_size = entry_size;
@@ -1622,7 +1644,7 @@ grn_io_hash_init(grn_ctx *ctx, grn_hash *hash, const char *path,
hash->n_entries = &header->n_entries;
hash->max_offset = &header->max_offset;
hash->io = io;
- hash->header = header;
+ hash->header.common = header;
hash->lock = &header->lock;
hash->tokenizer = NULL;
return GRN_SUCCESS;
@@ -1711,7 +1733,7 @@ grn_hash_create(grn_ctx *ctx, const char *path, uint32_t key_size, uint32_t valu
if (!ctx) {
return NULL;
}
- if (key_size > GRN_HASH_MAX_KEY_SIZE) {
+ if (key_size > GRN_HASH_MAX_KEY_SIZE_LARGE) {
return NULL;
}
hash = (grn_hash *)GRN_MALLOC(sizeof(grn_hash));
@@ -1732,7 +1754,7 @@ grn_hash_open(grn_ctx *ctx, const char *path)
if (ctx) {
grn_io * const io = grn_io_open(ctx, path, grn_io_auto);
if (io) {
- struct grn_hash_header * const header = grn_io_header(io);
+ grn_hash_header_common * const header = grn_io_header(io);
if (grn_io_get_type(io) == GRN_TABLE_HASH_KEY) {
grn_hash * const hash = (grn_hash *)GRN_MALLOC(sizeof(grn_hash));
if (hash) {
@@ -1747,7 +1769,7 @@ grn_hash_open(grn_ctx *ctx, const char *path)
hash->n_entries = &header->n_entries;
hash->max_offset = &header->max_offset;
hash->io = io;
- hash->header = header;
+ hash->header.common = header;
hash->lock = &header->lock;
hash->tokenizer = grn_ctx_at(ctx, header->tokenizer);
if (header->flags & GRN_OBJ_KEY_NORMALIZE) {
@@ -1911,7 +1933,7 @@ grn_hash_reset(grn_ctx *ctx, grn_hash *hash, uint32_t expected_n_entries)
if (grn_hash_is_io_hash(hash)) {
uint32_t i;
- src_offset = hash->header->idx_offset;
+ src_offset = hash->header.common->idx_offset;
dest_offset = MAX_INDEX_SIZE - src_offset;
for (i = 0; i < new_index_size; i += (IDX_MASK_IN_A_SEGMENT + 1)) {
/*
@@ -1979,7 +2001,7 @@ grn_hash_reset(grn_ctx *ctx, grn_hash *hash, uint32_t expected_n_entries)
}
if (grn_hash_is_io_hash(hash)) {
- hash->header->idx_offset = dest_offset;
+ hash->header.common->idx_offset = dest_offset;
} else {
grn_id * const old_index = hash->index;
hash->index = new_index;
@@ -2038,15 +2060,22 @@ grn_io_hash_add(grn_ctx *ctx, grn_hash *hash, uint32_t hash_value,
{
grn_id entry_id;
grn_hash_entry *entry;
- struct grn_hash_header * const header = hash->header;
+ grn_hash_header_common * const header = hash->header.common;
+ grn_id *garbages;
- entry_id = header->garbages[key_size - 1];
+ if (GRN_HASH_IS_LARGE_KEY(hash)) {
+ garbages = hash->header.large->garbages;
+ } else {
+ garbages = hash->header.normal->garbages;
+ }
+
+ entry_id = garbages[key_size - 1];
if (entry_id) {
entry = grn_io_hash_entry_at(ctx, hash, entry_id, GRN_TABLE_ADD);
if (!entry) {
return GRN_ID_NIL;
}
- header->garbages[key_size - 1] = *(grn_id *)entry;
+ garbages[key_size - 1] = *(grn_id *)entry;
if (hash->obj.header.flags & GRN_OBJ_KEY_VAR_SIZE) {
/* keep entry->io_entry's hash_value, flag, key_size and key. */
memset(entry->io_entry.value, 0, header->value_size);
@@ -2282,7 +2311,7 @@ grn_hash_get_key(grn_ctx *ctx, grn_hash *hash, grn_id id, void *keybuf, int bufs
}
key_size = grn_hash_entry_get_key_size(hash, entry);
if (bufsize >= key_size) {
- memcpy(keybuf, grn_hash_entry_get_key(ctx, hash, entry), key_size);
+ grn_memcpy(keybuf, grn_hash_entry_get_key(ctx, hash, entry), key_size);
}
return key_size;
}
@@ -2320,7 +2349,7 @@ grn_hash_get_value(grn_ctx *ctx, grn_hash *hash, grn_id id, void *valuebuf)
return 0;
}
if (valuebuf) {
- memcpy(valuebuf, value, hash->value_size);
+ grn_memcpy(valuebuf, value, hash->value_size);
}
return hash->value_size;
}
@@ -2353,14 +2382,14 @@ grn_hash_get_key_value(grn_ctx *ctx, grn_hash *hash, grn_id id,
}
key_size = grn_hash_entry_get_key_size(hash, entry);
if (bufsize >= key_size) {
- memcpy(keybuf, grn_hash_entry_get_key(ctx, hash, entry), key_size);
+ grn_memcpy(keybuf, grn_hash_entry_get_key(ctx, hash, entry), key_size);
}
value = grn_hash_entry_get_value(hash, entry);
if (!value) {
return 0;
}
if (valuebuf) {
- memcpy(valuebuf, value, hash->value_size);
+ grn_memcpy(valuebuf, value, hash->value_size);
}
return key_size;
}
@@ -2400,7 +2429,7 @@ grn_hash_set_value(grn_ctx *ctx, grn_hash *hash, grn_id id,
switch (flags & GRN_OBJ_SET_MASK) {
case GRN_OBJ_SET :
- memcpy(entry_value, value, hash->value_size);
+ grn_memcpy(entry_value, value, hash->value_size);
return GRN_SUCCESS;
case GRN_OBJ_INCR :
switch (hash->value_size) {
@@ -2436,9 +2465,14 @@ grn_hash_set_value(grn_ctx *ctx, grn_hash *hash, grn_id id,
*ep = GARBAGE;\
if (grn_hash_is_io_hash(hash)) {\
uint32_t size = key_size - 1;\
- struct grn_hash_header *hh = hash->header;\
- ee->key = hh->garbages[size];\
- hh->garbages[size] = e;\
+ grn_id *garbages;\
+ if (GRN_HASH_IS_LARGE_KEY(hash)) {\
+ garbages = hash->header.large->garbages;\
+ } else {\
+ garbages = hash->header.normal->garbages;\
+ }\
+ ee->key = garbages[size];\
+ garbages[size] = e;\
grn_io_array_bit_off(ctx, hash->io, GRN_HASH_BITMAP_SEGMENT, e);\
} else {\
ee->key = hash->garbages;\
@@ -2537,7 +2571,7 @@ grn_hash_cursor_close(grn_ctx *ctx, grn_hash_cursor *c)
}
#define HASH_CURR_MAX(hash) \
- ((grn_hash_is_io_hash(hash)) ? (hash)->header->curr_rec : (hash)->a.max)
+ ((grn_hash_is_io_hash(hash)) ? (hash)->header.common->curr_rec : (hash)->a.max)
grn_hash_cursor *
grn_hash_cursor_open(grn_ctx *ctx, grn_hash *hash,
@@ -3061,7 +3095,7 @@ void
grn_hash_check(grn_ctx *ctx, grn_hash *hash)
{
char buf[8];
- struct grn_hash_header *h = hash->header;
+ grn_hash_header_common *h = hash->header.common;
GRN_OUTPUT_ARRAY_OPEN("RESULT", 1);
GRN_OUTPUT_MAP_OPEN("SUMMARY", 25);
GRN_OUTPUT_CSTR("flags");
@@ -3158,7 +3192,7 @@ subrecs_push(byte *subrecs, int size, int n_subrecs, int score, void *body, int
}
v = subrecs + n * (size + GRN_RSET_SCORE_SIZE);
*((int *)v) = score;
- memcpy(v + GRN_RSET_SCORE_SIZE, body, size);
+ grn_memcpy(v + GRN_RSET_SCORE_SIZE, body, size);
}
inline static void
@@ -3191,8 +3225,8 @@ subrecs_replace_min(byte *subrecs, int size, int n_subrecs, int score, void *bod
}
}
v = subrecs + n * (size + GRN_RSET_SCORE_SIZE);
- memcpy(v, &score, GRN_RSET_SCORE_SIZE);
- memcpy(v + GRN_RSET_SCORE_SIZE, body, size);
+ grn_memcpy(v, &score, GRN_RSET_SCORE_SIZE);
+ grn_memcpy(v + GRN_RSET_SCORE_SIZE, body, size);
}
void
@@ -3252,7 +3286,7 @@ grn_rhash_group(grn_hash *s, int limit, grn_group_optarg *optarg)
if (gkey) { GRN_FREE(gkey); }
return NULL;
}
- memcpy(&h, s, sizeof(grn_hash));
+ grn_memcpy(&h, s, sizeof(grn_hash));
g = s;
s = &h;
if (grn_rhash_init(ctx, g, unit, rsize, s->record_unit, s->key_size, limit)) {
diff --git a/storage/mroonga/vendor/groonga/lib/ii.c b/storage/mroonga/vendor/groonga/lib/ii.c
index 5dc203865ad..2d32df2fd4d 100644
--- a/storage/mroonga/vendor/groonga/lib/ii.c
+++ b/storage/mroonga/vendor/groonga/lib/ii.c
@@ -1,5 +1,5 @@
/* -*- c-basic-offset: 2 -*- */
-/* Copyright(C) 2009-2014 Brazil
+/* Copyright(C) 2009-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -14,27 +14,42 @@
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 "groonga_in.h"
+#include "grn.h"
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#include <sys/stat.h>
+#include <math.h>
-#include "ii.h"
-#include "ctx_impl.h"
-#include "token.h"
-#include "pat.h"
-#include "db.h"
-#include "output.h"
-#include "util.h"
+#ifdef WIN32
+# include <io.h>
+# include <share.h>
+#endif /* WIN32 */
+
+#include "grn_ii.h"
+#include "grn_ctx_impl.h"
+#include "grn_token_cursor.h"
+#include "grn_pat.h"
+#include "grn_db.h"
+#include "grn_output.h"
+#include "grn_scorer.h"
+#include "grn_util.h"
+
+#ifdef GRN_WITH_ONIGMO
+# define GRN_II_SELECT_ENABLE_SEQUENTIAL_SEARCH
+#endif
+
+#ifdef GRN_II_SELECT_ENABLE_SEQUENTIAL_SEARCH
+# include "grn_string.h"
+# include <oniguruma.h>
+#endif
#define MAX_PSEG 0x20000
#define S_CHUNK (1 << GRN_II_W_CHUNK)
#define W_SEGMENT 18
#define S_SEGMENT (1 << W_SEGMENT)
-#define N_CHUNKS_PER_FILE (GRN_IO_FILE_SIZE >> W_SEGMENT)
-#define W_ARRAY_ELEMENT 3
-#define S_ARRAY_ELEMENT (1 << W_ARRAY_ELEMENT)
+#define W_ARRAY_ELEMENT 3
+#define S_ARRAY_ELEMENT (1 << W_ARRAY_ELEMENT)
#define W_ARRAY (W_SEGMENT - W_ARRAY_ELEMENT)
#define ARRAY_MASK_IN_A_SEGMENT ((1 << W_ARRAY) - 1)
#define NOT_ASSIGNED 0xffffffff
@@ -230,11 +245,11 @@ typedef struct {
uint32_t recs[N_GARBAGES];
} grn_ii_ginfo;
-#define WIN_MAP2(chunk,ctx,iw,seg,pos,size,mode)\
- grn_io_win_map2(chunk, ctx, iw,\
- ((seg) >> GRN_II_N_CHUNK_VARIATION),\
- (((seg) & ((1 << GRN_II_N_CHUNK_VARIATION) - 1)) << GRN_II_W_LEAST_CHUNK) + (pos),\
- size,mode)
+#define WIN_MAP(chunk,ctx,iw,seg,pos,size,mode)\
+ grn_io_win_map(chunk, ctx, iw,\
+ ((seg) >> GRN_II_N_CHUNK_VARIATION),\
+ (((seg) & ((1 << GRN_II_N_CHUNK_VARIATION) - 1)) << GRN_II_W_LEAST_CHUNK) + (pos),\
+ size,mode)
/*
static int new_histogram[32];
static int free_histogram[32];
@@ -285,10 +300,10 @@ chunk_new(grn_ctx *ctx, grn_ii *ii, uint32_t *res, uint32_t size)
iw_.addr = NULL;
gseg = &ii->header->garbages[m - GRN_II_W_LEAST_CHUNK];
while (*gseg != NOT_ASSIGNED) {
- ginfo = WIN_MAP2(ii->chunk, ctx, &iw, *gseg, 0, S_GARBAGE, grn_io_rdwr);
+ ginfo = WIN_MAP(ii->chunk, ctx, &iw, *gseg, 0, S_GARBAGE, grn_io_rdwr);
//GRN_IO_SEG_MAP2(ii->chunk, *gseg, ginfo);
if (!ginfo) {
- if (iw_.addr) { grn_io_win_unmap2(&iw_); }
+ if (iw_.addr) { grn_io_win_unmap(&iw_); }
return GRN_NO_MEMORY_AVAILABLE;
}
if (ginfo->next != NOT_ASSIGNED || ginfo->nrecs > N_GARBAGES_TH) {
@@ -300,15 +315,15 @@ chunk_new(grn_ctx *ctx, grn_ii *ii, uint32_t *res, uint32_t size)
HEADER_CHUNK_OFF(ii, *gseg);
*gseg = ginfo->next;
}
- if (iw_.addr) { grn_io_win_unmap2(&iw_); }
- grn_io_win_unmap2(&iw);
+ if (iw_.addr) { grn_io_win_unmap(&iw_); }
+ grn_io_win_unmap(&iw);
return GRN_SUCCESS;
}
- if (iw_.addr) { grn_io_win_unmap2(&iw_); }
+ if (iw_.addr) { grn_io_win_unmap(&iw_); }
iw_ = iw;
gseg = &ginfo->next;
}
- if (iw_.addr) { grn_io_win_unmap2(&iw_); }
+ if (iw_.addr) { grn_io_win_unmap(&iw_); }
}
vp = &ii->header->free_chunks[m - GRN_II_W_LEAST_CHUNK];
if (*vp == NOT_ASSIGNED) {
@@ -358,24 +373,24 @@ chunk_free(grn_ctx *ctx, grn_ii *ii, uint32_t offset, uint32_t dummy, uint32_t s
gseg = &ii->header->garbages[m - GRN_II_W_LEAST_CHUNK];
iw_.addr = NULL;
while (*gseg != NOT_ASSIGNED) {
- ginfo = WIN_MAP2(ii->chunk, ctx, &iw, *gseg, 0, S_GARBAGE, grn_io_rdwr);
+ ginfo = WIN_MAP(ii->chunk, ctx, &iw, *gseg, 0, S_GARBAGE, grn_io_rdwr);
// GRN_IO_SEG_MAP2(ii->chunk, *gseg, ginfo);
if (!ginfo) {
- if (iw_.addr) { grn_io_win_unmap2(&iw_); }
+ if (iw_.addr) { grn_io_win_unmap(&iw_); }
return GRN_NO_MEMORY_AVAILABLE;
}
if (ginfo->nrecs < N_GARBAGES) { break; }
- if (iw_.addr) { grn_io_win_unmap2(&iw_); }
+ if (iw_.addr) { grn_io_win_unmap(&iw_); }
iw_ = iw;
gseg = &ginfo->next;
}
if (*gseg == NOT_ASSIGNED) {
grn_rc rc;
if ((rc = chunk_new(ctx, ii, gseg, S_GARBAGE))) {
- if (iw_.addr) { grn_io_win_unmap2(&iw_); }
+ if (iw_.addr) { grn_io_win_unmap(&iw_); }
return rc;
}
- ginfo = WIN_MAP2(ii->chunk, ctx, &iw, *gseg, 0, S_GARBAGE, grn_io_rdwr);
+ ginfo = WIN_MAP(ii->chunk, ctx, &iw, *gseg, 0, S_GARBAGE, grn_io_rdwr);
/*
uint32_t i = 0;
while (HEADER_CHUNK_AT(ii, i)) {
@@ -386,7 +401,7 @@ chunk_free(grn_ctx *ctx, grn_ii *ii, uint32_t offset, uint32_t dummy, uint32_t s
GRN_IO_SEG_MAP2(ii->chunk, *gseg, ginfo);
*/
if (!ginfo) {
- if (iw_.addr) { grn_io_win_unmap2(&iw_); }
+ if (iw_.addr) { grn_io_win_unmap(&iw_); }
return GRN_NO_MEMORY_AVAILABLE;
}
ginfo->head = 0;
@@ -394,50 +409,15 @@ chunk_free(grn_ctx *ctx, grn_ii *ii, uint32_t offset, uint32_t dummy, uint32_t s
ginfo->nrecs = 0;
ginfo->next = NOT_ASSIGNED;
}
- if (iw_.addr) { grn_io_win_unmap2(&iw_); }
+ if (iw_.addr) { grn_io_win_unmap(&iw_); }
ginfo->recs[ginfo->head] = offset;
if (++ginfo->head == N_GARBAGES) { ginfo->head = 0; }
ginfo->nrecs++;
- grn_io_win_unmap2(&iw);
+ grn_io_win_unmap(&iw);
ii->header->ngarbages[m - GRN_II_W_LEAST_CHUNK]++;
return GRN_SUCCESS;
}
-/*
-inline static grn_rc
-chunk_new(grn_ii *ii, uint32_t *res, uint32_t size)
-{
- int i, j;
- uint32_t n = (size + S_CHUNK - 1) >> GRN_II_W_CHUNK;
- uint32_t base_seg = grn_io_base_seg(ii->chunk);
- for (i = 0, j = -1; i < GRN_II_MAX_CHUNK; i++) {
- if (HEADER_CHUNK_AT(ii, i)) {
- j = i;
- } else {
- if (i == j + n) {
- j++;
- if (res) { *res = j; }
- for (; j <= i; j++) { HEADER_CHUNK_ON(ii, j); }
- return GRN_SUCCESS;
- }
- // todo : cut off
- if ((i + base_seg)/ N_CHUNKS_PER_FILE !=
- (i + base_seg + 1) / N_CHUNKS_PER_FILE) { j = i; }
- }
- }
- GRN_LOG(ctx, GRN_LOG_CRIT, "index full.");
- return GRN_NO_MEMORY_AVAILABLE;
-}
-
-static void
-chunk_free(grn_ii *ii, int offset, uint32_t size1, uint32_t size2)
-{
- uint32_t i = offset + ((size1 + S_CHUNK - 1) >> GRN_II_W_CHUNK);
- uint32_t n = offset + ((size2 + S_CHUNK - 1) >> GRN_II_W_CHUNK);
- for (; i < n; i++) { HEADER_CHUNK_OFF(ii, i); }
-}
-*/
-
#define UNIT_SIZE 0x80
#define UNIT_MASK (UNIT_SIZE - 1)
@@ -1434,7 +1414,7 @@ pack(uint32_t *p, uint32_t i, uint8_t *freq, uint8_t *rp)
}
}
rp = pack_(p - i, i, w, rp);
- memcpy(rp, ebuf, ep - ebuf);
+ grn_memcpy(rp, ebuf, ep - ebuf);
return rp + (ep - ebuf);
}
@@ -1586,7 +1566,7 @@ grn_p_encv(grn_ctx *ctx, datavec *dv, uint32_t dvlen, uint8_t *res)
case 0x08 : \
if (_v == 0x8f) { \
if (_p + sizeof(uint32_t) > pe) { return 0; } \
- memcpy(&_v, _p, sizeof(uint32_t)); \
+ grn_memcpy(&_v, _p, sizeof(uint32_t)); \
_p += sizeof(uint32_t); \
} \
break; \
@@ -2030,7 +2010,7 @@ buffer_put(grn_ctx *ctx, grn_ii *ii, buffer *b, buffer_term *bt,
buffer_rec *r_curr, *r_start = NULL;
uint16_t last = 0, *lastp = &bt->pos_in_buffer, pos = BUFFER_REC_POS(b, rnew);
int vdelta = 0, delta, delta0 = 0, vhops = 0, nhops = 0, reset = 1;
- memcpy(NEXT_ADDR(rnew), bs, size - sizeof(buffer_rec));
+ grn_memcpy(NEXT_ADDR(rnew), bs, size - sizeof(buffer_rec));
for (;;) {
if (!*lastp) {
rnew->step = 0;
@@ -2487,21 +2467,25 @@ typedef struct {
static grn_rc
chunk_flush(grn_ctx *ctx, grn_ii *ii, chunk_info *cinfo, uint8_t *enc, uint32_t encsize)
{
- grn_rc rc;
+ grn_rc rc = GRN_SUCCESS;
uint8_t *dc;
uint32_t dcn;
grn_io_win dw;
- if (!(rc = chunk_new(ctx, ii, &dcn, encsize))) {
- if ((dc = WIN_MAP2(ii->chunk, ctx, &dw, dcn, 0, encsize, grn_io_wronly))) {
- memcpy(dc, enc, encsize);
- grn_io_win_unmap2(&dw);
- cinfo->segno = dcn;
- cinfo->size = encsize;
- rc = GRN_SUCCESS;
- } else {
- chunk_free(ctx, ii, dcn, 0, encsize);
- rc = GRN_NO_MEMORY_AVAILABLE;
+ if (encsize) {
+ if (!(rc = chunk_new(ctx, ii, &dcn, encsize))) {
+ if ((dc = WIN_MAP(ii->chunk, ctx, &dw, dcn, 0, encsize, grn_io_wronly))) {
+ grn_memcpy(dc, enc, encsize);
+ grn_io_win_unmap(&dw);
+ cinfo->segno = dcn;
+ cinfo->size = encsize;
+ } else {
+ chunk_free(ctx, ii, dcn, 0, encsize);
+ rc = GRN_NO_MEMORY_AVAILABLE;
+ }
}
+ } else {
+ cinfo->segno = 0;
+ cinfo->size = 0;
}
return rc;
}
@@ -2517,7 +2501,7 @@ chunk_merge(grn_ctx *ctx, grn_ii *ii, buffer *sb, buffer_term *bt,
uint32_t segno = cinfo->segno, size = cinfo->size, sdf = 0, ndf = 0;
uint32_t *ridp = NULL, *sidp = NULL, *tfp, *weightp = NULL, *posp = NULL;
docinfo cid = {0, 0, 0, 0, 0}, lid = {0, 0, 0, 0, 0}, bid = *bidp;
- uint8_t *scp = WIN_MAP2(ii->chunk, ctx, &sw, segno, 0, size, grn_io_rdonly);
+ uint8_t *scp = WIN_MAP(ii->chunk, ctx, &sw, segno, 0, size, grn_io_rdonly);
if (scp) {
uint16_t nextb = *nextbp;
uint32_t snn = 0, *srp, *ssp = NULL, *stp, *sop = NULL, *snp;
@@ -2558,7 +2542,7 @@ chunk_merge(grn_ctx *ctx, grn_ii *ii, buffer *sb, buffer_term *bt,
ndf = ridp - dv[0].data;
}
datavec_fin(ctx, rdv);
- grn_io_win_unmap2(&sw);
+ grn_io_win_unmap(&sw);
} else {
rc = GRN_NO_MEMORY_AVAILABLE;
}
@@ -2621,6 +2605,7 @@ buffer_merge(grn_ctx *ctx, grn_ii *ii, uint32_t seg, grn_hash *h,
uint64_t spos = 0;
int32_t balance = 0;
uint32_t *ridp, *sidp = NULL, *tfp, *weightp = NULL, *posp, nchunks = 0;
+ uint32_t nvchunks = 0;
chunk_info *cinfo = NULL;
grn_id crid = GRN_ID_NIL;
docinfo cid = {0, 0, 0, 0, 0}, lid = {0, 0, 0, 0, 0}, bid = {0, 0};
@@ -2633,7 +2618,7 @@ buffer_merge(grn_ctx *ctx, grn_ii *ii, uint32_t seg, grn_hash *h,
if (!bt->pos_in_buffer) {
GRN_ASSERT(!bt->size_in_buffer);
if (bt->size_in_chunk) {
- memcpy(dcp, sc + bt->pos_in_chunk, bt->size_in_chunk);
+ grn_memcpy(dcp, sc + bt->pos_in_chunk, bt->size_in_chunk);
bt->pos_in_chunk = (uint32_t)(dcp - dc);
dcp += bt->size_in_chunk;
}
@@ -2667,6 +2652,12 @@ buffer_merge(grn_ctx *ctx, grn_ii *ii, uint32_t seg, grn_hash *h,
return rc;
}
}
+ if (cinfo[i].size) {
+ nvchunks++;
+ } else {
+ crid -= cinfo[i].dgap;
+ cinfo[i + 1].dgap += cinfo[i].dgap;
+ }
}
}
if (sce > scp) {
@@ -2739,21 +2730,21 @@ buffer_merge(grn_ctx *ctx, grn_ii *ii, uint32_t seg, grn_hash *h,
memset(bt, 0, sizeof(buffer_term));
nterms_void++;
} else {
- if (!ndf && !nchunks) {
+ if (!ndf && !nvchunks) {
a[0] = 0;
a[1] = 0;
lexicon_delete(ctx, ii, tid, h);
memset(bt, 0, sizeof(buffer_term));
nterms_void++;
} else if ((ii->header->flags & GRN_OBJ_WITH_SECTION)
- && !nchunks && ndf == 1 && lid.rid < 0x100000 &&
+ && !nvchunks && ndf == 1 && lid.rid < 0x100000 &&
lid.sid < 0x800 && lid.tf == 1 && lid.weight == 0) {
a[0] = (lid.rid << 12) + (lid.sid << 1) + 1;
a[1] = (ii->header->flags & GRN_OBJ_WITH_POSITION) ? posp[-1] : 0;
memset(bt, 0, sizeof(buffer_term));
nterms_void++;
} else if (!(ii->header->flags & GRN_OBJ_WITH_SECTION)
- && !nchunks && ndf == 1 && lid.tf == 1 && lid.weight == 0) {
+ && !nvchunks && ndf == 1 && lid.tf == 1 && lid.weight == 0) {
a[0] = (lid.rid << 1) + 1;
a[1] = (ii->header->flags & GRN_OBJ_WITH_POSITION) ? posp[-1] : 0;
memset(bt, 0, sizeof(buffer_term));
@@ -2779,20 +2770,25 @@ buffer_merge(grn_ctx *ctx, grn_ii *ii, uint32_t seg, grn_hash *h,
}
dcp0 = dcp;
a[1] = (bt->size_in_chunk ? a[1] : 0) + (ndf - sdf) + balance;
- if (nchunks) {
+ if (nvchunks) {
int i;
- GRN_B_ENC(nchunks, dcp);
+ GRN_B_ENC(nvchunks, dcp);
for (i = 0; i < nchunks; i++) {
- GRN_B_ENC(cinfo[i].segno, dcp);
- GRN_B_ENC(cinfo[i].size, dcp);
- GRN_B_ENC(cinfo[i].dgap, dcp);
+ if (cinfo[i].size) {
+ GRN_B_ENC(cinfo[i].segno, dcp);
+ GRN_B_ENC(cinfo[i].size, dcp);
+ GRN_B_ENC(cinfo[i].dgap, dcp);
+ }
}
}
encsize = grn_p_encv(ctx, dv, ii->n_elements, dcp);
if (sb->header.chunk_size + S_SEGMENT <= (dcp - dc) + encsize) {
int i;
- char buf[255], *bufp;
+#define BUF_SIZE 255
+ char buf[BUF_SIZE], *bufp, *buf_end;
+ buf_end = buf + BUF_SIZE;
+#undef BUF_SIZE
GRN_LOG(ctx, GRN_LOG_NOTICE,
"cs(%d)+(%d)=(%d)<=(%" GRN_FMT_LLD ")+(%d)=(%" GRN_FMT_LLD ")",
sb->header.chunk_size, S_SEGMENT, sb->header.chunk_size + S_SEGMENT,
@@ -2801,7 +2797,10 @@ buffer_merge(grn_ctx *ctx, grn_ii *ii, uint32_t seg, grn_hash *h,
GRN_LOG(ctx, GRN_LOG_NOTICE, "rdv[%d] data_size=%d, flags=%d",
j, rdv[j].data_size, rdv[j].flags);
for (i = 0, bufp = buf; i < rdv[j].data_size;) {
- bufp += sprintf(bufp, " %d", rdv[j].data[i]);
+ bufp += grn_snprintf(bufp,
+ buf_end - bufp,
+ buf_end - bufp,
+ " %d", rdv[j].data[i]);
i++;
if (!(i % 32) || i == rdv[j].data_size) {
GRN_LOG(ctx, GRN_LOG_NOTICE, "rdv[%d].data[%d]%s", j, i, buf);
@@ -2814,7 +2813,10 @@ buffer_merge(grn_ctx *ctx, grn_ii *ii, uint32_t seg, grn_hash *h,
GRN_LOG(ctx, GRN_LOG_NOTICE, "dv[%d] data_size=%d, flags=%d",
j, dv[j].data_size, dv[j].flags);
for (i = 0, bufp = buf; i < dv[j].data_size;) {
- bufp += sprintf(bufp, " %d", dv[j].data[i]);
+ bufp += grn_snprintf(bufp,
+ buf_end - bufp,
+ buf_end - bufp,
+ " %d", dv[j].data[i]);
i++;
if (!(i % 32) || i == dv[j].data_size) {
GRN_LOG(ctx, GRN_LOG_NOTICE, "dv[%d].data[%d]%s", j, i, buf);
@@ -2830,18 +2832,23 @@ buffer_merge(grn_ctx *ctx, grn_ii *ii, uint32_t seg, grn_hash *h,
!chunk_flush(ctx, ii, &cinfo[nchunks], dcp, encsize)) {
int i;
cinfo[nchunks].dgap = lid.rid - crid;
- nchunks++;
+ nvchunks++;
dcp = dcp0;
- GRN_B_ENC(nchunks, dcp);
- for (i = 0; i < nchunks; i++) {
- GRN_B_ENC(cinfo[i].segno, dcp);
- GRN_B_ENC(cinfo[i].size, dcp);
- GRN_B_ENC(cinfo[i].dgap, dcp);
+ GRN_B_ENC(nvchunks, dcp);
+ for (i = 0; i <= nchunks; i++) {
+ if (cinfo[i].size) {
+ GRN_B_ENC(cinfo[i].segno, dcp);
+ GRN_B_ENC(cinfo[i].size, dcp);
+ GRN_B_ENC(cinfo[i].dgap, dcp);
+ }
}
GRN_LOG(ctx, GRN_LOG_NOTICE, "split (%d) encsize=%d", tid, encsize);
bt->tid |= CHUNK_SPLIT;
} else {
dcp += encsize;
+ if (!nvchunks) {
+ bt->tid &= ~CHUNK_SPLIT;
+ }
}
bt->pos_in_chunk = (uint32_t)(dcp0 - dc);
bt->size_in_chunk = (uint32_t)(dcp - dcp0);
@@ -2863,7 +2870,7 @@ buffer_merge(grn_ctx *ctx, grn_ii *ii, uint32_t seg, grn_hash *h,
}
static void
-fake_map2(grn_ctx *ctx, grn_io *io, grn_io_win *iw, void *addr, uint32_t seg, uint32_t size)
+fake_map(grn_ctx *ctx, grn_io *io, grn_io_win *iw, void *addr, uint32_t seg, uint32_t size)
{
iw->ctx = ctx;
iw->diff = 0;
@@ -2894,11 +2901,11 @@ buffer_flush(grn_ctx *ctx, grn_ii *ii, uint32_t seg, grn_hash *h)
uint32_t max_dest_chunk_size = sb->header.chunk_size + S_SEGMENT;
if ((dc = GRN_MALLOC(max_dest_chunk_size * 2))) {
if ((scn = sb->header.chunk) == NOT_ASSIGNED ||
- (sc = WIN_MAP2(ii->chunk, ctx, &sw, scn, 0,
- sb->header.chunk_size, grn_io_rdonly))) {
+ (sc = WIN_MAP(ii->chunk, ctx, &sw, scn, 0,
+ sb->header.chunk_size, grn_io_rdonly))) {
uint16_t n = sb->header.nterms;
memset(db, 0, S_SEGMENT);
- memcpy(db->terms, sb->terms, n * sizeof(buffer_term));
+ grn_memcpy(db->terms, sb->terms, n * sizeof(buffer_term));
db->header.nterms = n;
if (!(rc = buffer_merge(ctx, ii, seg, h, sb, sc, db, dc))) {
actual_chunk_size = db->header.chunk_size;
@@ -2908,12 +2915,12 @@ buffer_flush(grn_ctx *ctx, grn_ii *ii, uint32_t seg, grn_hash *h)
}
if (!actual_chunk_size || !(rc = chunk_new(ctx, ii, &dcn, actual_chunk_size))) {
db->header.chunk = actual_chunk_size ? dcn : NOT_ASSIGNED;
- fake_map2(ctx, ii->chunk, &dw, dc, dcn, actual_chunk_size);
- if (!(rc = grn_io_win_unmap2(&dw))) {
+ fake_map(ctx, ii->chunk, &dw, dc, dcn, actual_chunk_size);
+ if (!(rc = grn_io_win_unmap(&dw))) {
buffer_segment_update(ii, seg, ds);
ii->header->total_chunk_size += actual_chunk_size;
if (scn != NOT_ASSIGNED) {
- grn_io_win_unmap2(&sw);
+ grn_io_win_unmap(&sw);
chunk_free(ctx, ii, scn, 0, sb->header.chunk_size);
ii->header->total_chunk_size -= sb->header.chunk_size;
}
@@ -2922,15 +2929,15 @@ buffer_flush(grn_ctx *ctx, grn_ii *ii, uint32_t seg, grn_hash *h)
if (actual_chunk_size) {
chunk_free(ctx, ii, dcn, 0, actual_chunk_size);
}
- if (scn != NOT_ASSIGNED) { grn_io_win_unmap2(&sw); }
+ if (scn != NOT_ASSIGNED) { grn_io_win_unmap(&sw); }
}
} else {
GRN_FREE(dc);
- if (scn != NOT_ASSIGNED) { grn_io_win_unmap2(&sw); }
+ if (scn != NOT_ASSIGNED) { grn_io_win_unmap(&sw); }
}
} else {
GRN_FREE(dc);
- if (scn != NOT_ASSIGNED) { grn_io_win_unmap2(&sw); }
+ if (scn != NOT_ASSIGNED) { grn_io_win_unmap(&sw); }
}
} else {
GRN_FREE(dc);
@@ -2991,7 +2998,7 @@ grn_ii_buffer_check(grn_ctx *ctx, grn_ii *ii, uint32_t seg)
GRN_OUTPUT_CSTR("void chunk size");
GRN_OUTPUT_INT64(sb->header.chunk_size);
} else {
- if ((sc = WIN_MAP2(ii->chunk, ctx, &sw, scn, 0, sb->header.chunk_size, grn_io_rdonly))) {
+ if ((sc = WIN_MAP(ii->chunk, ctx, &sw, scn, 0, sb->header.chunk_size, grn_io_rdonly))) {
GRN_OUTPUT_CSTR("chunk size");
GRN_OUTPUT_INT64(sb->header.chunk_size);
} else {
@@ -3133,7 +3140,7 @@ grn_ii_buffer_check(grn_ctx *ctx, grn_ii *ii, uint32_t seg)
}
GRN_OUTPUT_MAP_CLOSE();
datavec_fin(ctx, rdv);
- if (sc) { grn_io_win_unmap2(&sw); }
+ if (sc) { grn_io_win_unmap(&sw); }
buffer_close(ctx, ii, pseg);
}
@@ -3176,7 +3183,7 @@ term_split(grn_ctx *ctx, grn_obj *lexicon, buffer *sb, buffer *db0, buffer *db1)
bt = db0->terms;
nt = &db0->header.nterms;
for (s = 0; n + 1 < i && s <= th; n++, bt++) {
- memcpy(bt, ts[n].bt, sizeof(buffer_term));
+ grn_memcpy(bt, ts[n].bt, sizeof(buffer_term));
(*nt)++;
s += ts[n].bt->size_in_chunk + 1;
}
@@ -3184,7 +3191,7 @@ term_split(grn_ctx *ctx, grn_obj *lexicon, buffer *sb, buffer *db0, buffer *db1)
bt = db1->terms;
nt = &db1->header.nterms;
for (; n < i; n++, bt++) {
- memcpy(bt, ts[n].bt, sizeof(buffer_term));
+ grn_memcpy(bt, ts[n].bt, sizeof(buffer_term));
(*nt)++;
}
GRN_FREE(ts);
@@ -3236,8 +3243,8 @@ buffer_split(grn_ctx *ctx, grn_ii *ii, uint32_t seg, grn_hash *h)
if ((dc0 = GRN_MALLOC(max_dest_chunk_size * 2))) {
if ((dc1 = GRN_MALLOC(max_dest_chunk_size * 2))) {
if ((scn = sb->header.chunk) == NOT_ASSIGNED ||
- (sc = WIN_MAP2(ii->chunk, ctx, &sw, scn, 0,
- sb->header.chunk_size, grn_io_rdonly))) {
+ (sc = WIN_MAP(ii->chunk, ctx, &sw, scn, 0,
+ sb->header.chunk_size, grn_io_rdonly))) {
term_split(ctx, ii->lexicon, sb, db0, db1);
if (!(rc = buffer_merge(ctx, ii, seg, h, sb, sc, db0, dc0))) {
actual_db0_chunk_size = db0->header.chunk_size;
@@ -3249,8 +3256,8 @@ buffer_split(grn_ctx *ctx, grn_ii *ii, uint32_t seg, grn_hash *h)
if (!actual_db0_chunk_size ||
!(rc = chunk_new(ctx, ii, &dcn0, actual_db0_chunk_size))) {
db0->header.chunk = actual_db0_chunk_size ? dcn0 : NOT_ASSIGNED;
- fake_map2(ctx, ii->chunk, &dw0, dc0, dcn0, actual_db0_chunk_size);
- if (!(rc = grn_io_win_unmap2(&dw0))) {
+ fake_map(ctx, ii->chunk, &dw0, dc0, dcn0, actual_db0_chunk_size);
+ if (!(rc = grn_io_win_unmap(&dw0))) {
if (!(rc = buffer_merge(ctx, ii, seg, h, sb, sc, db1, dc1))) {
actual_db1_chunk_size = db1->header.chunk_size;
if (actual_db1_chunk_size >= max_dest_chunk_size) {
@@ -3260,8 +3267,8 @@ buffer_split(grn_ctx *ctx, grn_ii *ii, uint32_t seg, grn_hash *h)
}
if (!actual_db1_chunk_size ||
!(rc = chunk_new(ctx, ii, &dcn1, actual_db1_chunk_size))) {
- fake_map2(ctx, ii->chunk, &dw1, dc1, dcn1, actual_db1_chunk_size);
- if (!(rc = grn_io_win_unmap2(&dw1))) {
+ fake_map(ctx, ii->chunk, &dw1, dc1, dcn1, actual_db1_chunk_size);
+ if (!(rc = grn_io_win_unmap(&dw1))) {
db1->header.chunk = actual_db1_chunk_size ? dcn1 : NOT_ASSIGNED;
buffer_segment_update(ii, dls0, dps0);
buffer_segment_update(ii, dls1, dps1);
@@ -3271,7 +3278,7 @@ buffer_split(grn_ctx *ctx, grn_ii *ii, uint32_t seg, grn_hash *h)
ii->header->total_chunk_size += actual_db0_chunk_size;
ii->header->total_chunk_size += actual_db1_chunk_size;
if (scn != NOT_ASSIGNED) {
- grn_io_win_unmap2(&sw);
+ grn_io_win_unmap(&sw);
chunk_free(ctx, ii, scn, 0, sb->header.chunk_size);
ii->header->total_chunk_size -= sb->header.chunk_size;
}
@@ -3283,21 +3290,21 @@ buffer_split(grn_ctx *ctx, grn_ii *ii, uint32_t seg, grn_hash *h)
chunk_free(ctx, ii, dcn0, 0, actual_db0_chunk_size);
}
GRN_FREE(dc1);
- if (scn != NOT_ASSIGNED) { grn_io_win_unmap2(&sw); }
+ if (scn != NOT_ASSIGNED) { grn_io_win_unmap(&sw); }
}
} else {
if (actual_db0_chunk_size) {
chunk_free(ctx, ii, dcn0, 0, actual_db0_chunk_size);
}
GRN_FREE(dc1);
- if (scn != NOT_ASSIGNED) { grn_io_win_unmap2(&sw); }
+ if (scn != NOT_ASSIGNED) { grn_io_win_unmap(&sw); }
}
} else {
if (actual_db0_chunk_size) {
chunk_free(ctx, ii, dcn0, 0, actual_db0_chunk_size);
}
GRN_FREE(dc1);
- if (scn != NOT_ASSIGNED) { grn_io_win_unmap2(&sw); }
+ if (scn != NOT_ASSIGNED) { grn_io_win_unmap(&sw); }
}
} else {
if (actual_db0_chunk_size) {
@@ -3305,17 +3312,17 @@ buffer_split(grn_ctx *ctx, grn_ii *ii, uint32_t seg, grn_hash *h)
}
GRN_FREE(dc1);
GRN_FREE(dc0);
- if (scn != NOT_ASSIGNED) { grn_io_win_unmap2(&sw); }
+ if (scn != NOT_ASSIGNED) { grn_io_win_unmap(&sw); }
}
} else {
GRN_FREE(dc1);
GRN_FREE(dc0);
- if (scn != NOT_ASSIGNED) { grn_io_win_unmap2(&sw); }
+ if (scn != NOT_ASSIGNED) { grn_io_win_unmap(&sw); }
}
} else {
GRN_FREE(dc1);
GRN_FREE(dc0);
- if (scn != NOT_ASSIGNED) { grn_io_win_unmap2(&sw); }
+ if (scn != NOT_ASSIGNED) { grn_io_win_unmap(&sw); }
}
} else {
GRN_FREE(dc1);
@@ -3476,8 +3483,8 @@ _grn_ii_create(grn_ctx *ctx, grn_ii *ii, const char *path, grn_obj *lexicon, uin
S_SEGMENT, MAX_PSEG, grn_io_auto, GRN_IO_EXPIRE_SEGMENT);
if (!seg) { return NULL; }
if (path) {
- strcpy(path2, path);
- strcat(path2, ".c");
+ grn_strcpy(path2, PATH_MAX, path);
+ grn_strcat(path2, PATH_MAX, ".c");
chunk = grn_io_create(ctx, path2, 0, S_CHUNK, GRN_II_MAX_CHUNK, grn_io_auto,
GRN_IO_EXPIRE_SEGMENT);
} else {
@@ -3533,7 +3540,8 @@ grn_ii_remove(grn_ctx *ctx, const char *path)
char buffer[PATH_MAX];
if (!path || strlen(path) > PATH_MAX - 4) { return GRN_INVALID_ARGUMENT; }
if ((rc = grn_io_remove(ctx, path))) { goto exit; }
- snprintf(buffer, PATH_MAX, "%s.c", path);
+ grn_snprintf(buffer, PATH_MAX, PATH_MAX,
+ "%s.c", path);
rc = grn_io_remove(ctx, buffer);
exit :
return rc;
@@ -3595,8 +3603,8 @@ grn_ii_open(grn_ctx *ctx, const char *path, grn_obj *lexicon)
return NULL;
}
if (strlen(path) + 6 >= PATH_MAX) { return NULL; }
- strcpy(path2, path);
- strcat(path2, ".c");
+ grn_strcpy(path2, PATH_MAX, path);
+ grn_strcat(path2, PATH_MAX, ".c");
seg = grn_io_open(ctx, path, grn_io_auto);
if (!seg) { return NULL; }
chunk = grn_io_open(ctx, path2, grn_io_auto);
@@ -3984,16 +3992,16 @@ chunk_is_reused(grn_ctx *ctx, grn_ii *ii, grn_ii_cursor *c, uint32_t offset, uin
gseg = ii->header->garbages[m - GRN_II_W_LEAST_CHUNK];
while (gseg != NOT_ASSIGNED) {
grn_io_win iw;
- grn_ii_ginfo *ginfo = WIN_MAP2(ii->chunk, ctx, &iw, gseg, 0, S_GARBAGE, grn_io_rdwr);
+ grn_ii_ginfo *ginfo = WIN_MAP(ii->chunk, ctx, &iw, gseg, 0, S_GARBAGE, grn_io_rdwr);
if (!ginfo) { break; }
for (i = 0; i < ginfo->nrecs; i++) {
if (ginfo->recs[i] == offset) {
- grn_io_win_unmap2(&iw);
+ grn_io_win_unmap(&iw);
return 0;
}
}
gseg = ginfo->next;
- grn_io_win_unmap2(&iw);
+ grn_io_win_unmap(&iw);
}
return 1;
}
@@ -4047,8 +4055,8 @@ grn_ii_cursor_open(grn_ctx *ctx, grn_ii *ii, grn_id tid,
}
c->ppseg = &ii->header->binfo[LSEG(pos)];
if (bt->size_in_chunk && (chunk = c->buf->header.chunk) != NOT_ASSIGNED) {
- if (!(c->cp = WIN_MAP2(ii->chunk, ctx, &c->iw, chunk, bt->pos_in_chunk,
- bt->size_in_chunk, grn_io_rdonly))) {
+ if (!(c->cp = WIN_MAP(ii->chunk, ctx, &c->iw, chunk, bt->pos_in_chunk,
+ bt->size_in_chunk, grn_io_rdonly))) {
buffer_close(ctx, ii, c->buffer_pseg);
GRN_FREE(c);
c = NULL;
@@ -4069,7 +4077,7 @@ grn_ii_cursor_open(grn_ctx *ctx, grn_ii *ii, grn_id tid,
}
if (!(c->cinfo = GRN_MALLOCN(chunk_info, c->nchunks))) {
buffer_close(ctx, ii, c->buffer_pseg);
- grn_io_win_unmap2(&c->iw);
+ grn_io_win_unmap(&c->iw);
GRN_FREE(c);
c = NULL;
goto exit;
@@ -4101,6 +4109,41 @@ exit :
return c;
}
+static inline void
+grn_ii_cursor_set_min(grn_ctx *ctx, grn_ii_cursor *c, grn_id min)
+{
+ char grn_ii_cursor_set_min_enable_env[GRN_ENV_BUFFER_SIZE];
+
+ if (c->min >= min) {
+ return;
+ }
+
+ grn_getenv("GRN_II_CURSOR_SET_MIN_ENABLE",
+ grn_ii_cursor_set_min_enable_env,
+ GRN_ENV_BUFFER_SIZE);
+ if (grn_ii_cursor_set_min_enable_env[0]) {
+ c->min = min;
+ if (c->buf && c->pc.rid < c->min && c->curr_chunk < c->nchunks) {
+ uint32_t i, skip_chunk = 0;
+ grn_id rid;
+ for (i = 0, rid = GRN_ID_NIL; i < c->nchunks; i++) {
+ rid += c->cinfo[i].dgap;
+ if (rid < c->min) {
+ skip_chunk = i + 1;
+ } else {
+ rid -= c->cinfo[i].dgap;
+ break;
+ }
+ }
+ if (skip_chunk > c->curr_chunk) {
+ c->pc.rid = rid;
+ c->curr_chunk = skip_chunk;
+ c->crp = c->cdp + c->cdf;
+ }
+ }
+ }
+}
+
grn_ii_posting *
grn_ii_cursor_next(grn_ctx *ctx, grn_ii_cursor *c)
{
@@ -4162,11 +4205,11 @@ grn_ii_cursor_next(grn_ctx *ctx, grn_ii_cursor *c)
uint8_t *cp;
grn_io_win iw;
uint32_t size = c->cinfo[c->curr_chunk].size;
- if (size && (cp = WIN_MAP2(c->ii->chunk, ctx, &iw,
- c->cinfo[c->curr_chunk].segno, 0,
- size, grn_io_rdonly))) {
+ if (size && (cp = WIN_MAP(c->ii->chunk, ctx, &iw,
+ c->cinfo[c->curr_chunk].segno, 0,
+ size, grn_io_rdonly))) {
grn_p_decv(ctx, cp, size, c->rdv, c->ii->n_elements);
- grn_io_win_unmap2(&iw);
+ grn_io_win_unmap(&iw);
if (chunk_is_reused(ctx, c->ii, c,
c->cinfo[c->curr_chunk].segno, size)) {
GRN_LOG(ctx, GRN_LOG_WARNING,
@@ -4206,34 +4249,55 @@ grn_ii_cursor_next(grn_ctx *ctx, grn_ii_cursor *c)
}
}
if (c->stat & BUFFER_USED) {
- if (c->nextb) {
- uint32_t lrid = c->pb.rid, lsid = c->pb.sid; /* for check */
- buffer_rec *br = BUFFER_REC_AT(c->buf, c->nextb);
- if (buffer_is_reused(ctx, c->ii, c)) {
- GRN_LOG(ctx, GRN_LOG_NOTICE, "buffer reused(%d,%d)", c->buffer_pseg, *c->ppseg);
- // todo : rewind;
- }
- c->bp = NEXT_ADDR(br);
- GRN_B_DEC(c->pb.rid, c->bp);
- if ((c->ii->header->flags & GRN_OBJ_WITH_SECTION)) {
- GRN_B_DEC(c->pb.sid, c->bp);
- } else {
- c->pb.sid = 1;
- }
- if (lrid > c->pb.rid || (lrid == c->pb.rid && lsid >= c->pb.sid)) {
- ERR(GRN_FILE_CORRUPT, "brokend!! (%d:%d) -> (%d:%d) (%d->%d)", lrid, lsid, c->pb.rid, c->pb.sid, c->buffer_pseg, *c->ppseg);
- }
- c->nextb = br->step;
- GRN_B_DEC(c->pb.tf, c->bp);
- if ((c->ii->header->flags & GRN_OBJ_WITH_WEIGHT)) {
- GRN_B_DEC(c->pb.weight, c->bp);
+ for (;;) {
+ if (c->nextb) {
+ uint32_t lrid = c->pb.rid, lsid = c->pb.sid; /* for check */
+ buffer_rec *br = BUFFER_REC_AT(c->buf, c->nextb);
+ if (buffer_is_reused(ctx, c->ii, c)) {
+ GRN_LOG(ctx, GRN_LOG_NOTICE, "buffer reused(%d,%d)", c->buffer_pseg, *c->ppseg);
+ // todo : rewind;
+ }
+ c->bp = NEXT_ADDR(br);
+ GRN_B_DEC(c->pb.rid, c->bp);
+ if ((c->ii->header->flags & GRN_OBJ_WITH_SECTION)) {
+ GRN_B_DEC(c->pb.sid, c->bp);
+ } else {
+ c->pb.sid = 1;
+ }
+ if (lrid > c->pb.rid || (lrid == c->pb.rid && lsid >= c->pb.sid)) {
+ ERR(GRN_FILE_CORRUPT, "brokend!! (%d:%d) -> (%d:%d) (%d->%d)", lrid, lsid, c->pb.rid, c->pb.sid, c->buffer_pseg, *c->ppseg);
+ }
+ if (c->pb.rid < c->min) {
+ c->pb.rid = 0;
+ if (br->jump > 0) {
+ buffer_rec *jump_br = BUFFER_REC_AT(c->buf, br->jump);
+ uint8_t *jump_bp;
+ uint32_t jump_rid;
+ jump_bp = NEXT_ADDR(jump_br);
+ GRN_B_DEC(jump_rid, jump_bp);
+ if (jump_rid < c->min) {
+ c->nextb = br->jump;
+ } else {
+ c->nextb = br->step;
+ }
+ } else {
+ c->nextb = br->step;
+ }
+ continue;
+ }
+ c->nextb = br->step;
+ GRN_B_DEC(c->pb.tf, c->bp);
+ if ((c->ii->header->flags & GRN_OBJ_WITH_WEIGHT)) {
+ GRN_B_DEC(c->pb.weight, c->bp);
+ } else {
+ c->pb.weight = 0;
+ }
+ c->pb.rest = c->pb.tf;
+ c->pb.pos = 0;
} else {
- c->pb.weight = 0;
+ c->pb.rid = 0;
}
- c->pb.rest = c->pb.tf;
- c->pb.pos = 0;
- } else {
- c->pb.rid = 0;
+ break;
}
}
if (c->pb.rid) {
@@ -4281,6 +4345,10 @@ grn_ii_cursor_next(grn_ctx *ctx, grn_ii_cursor *c)
} else {
c->post = &c->pb;
c->stat |= SOLE_DOC_USED;
+ if (c->post->rid < c->min) {
+ c->post = NULL;
+ return NULL;
+ }
}
}
return c->post;
@@ -4340,7 +4408,7 @@ grn_ii_cursor_close(grn_ctx *ctx, grn_ii_cursor *c)
datavec_fin(ctx, c->rdv);
if (c->cinfo) { GRN_FREE(c->cinfo); }
if (c->buf) { buffer_close(ctx, c->ii, c->buffer_pseg); }
- if (c->cp) { grn_io_win_unmap2(&c->iw); }
+ if (c->cp) { grn_io_win_unmap(&c->iw); }
GRN_FREE(c);
return GRN_SUCCESS;
}
@@ -4560,10 +4628,11 @@ cursor_heap_recalc_min(cursor_heap *h)
}
static inline void
-cursor_heap_pop(grn_ctx *ctx, cursor_heap *h)
+cursor_heap_pop(grn_ctx *ctx, cursor_heap *h, grn_id min)
{
if (h->n_entries) {
grn_ii_cursor *c = h->bins[0];
+ grn_ii_cursor_set_min(ctx, c, min);
if (!grn_ii_cursor_next(ctx, c)) {
grn_ii_cursor_close(ctx, c);
h->bins[0] = h->bins[--h->n_entries];
@@ -4670,6 +4739,7 @@ inline static grn_rc
index_del(grn_ctx *ctx, grn_id rid, grn_obj *lexicon, grn_ii *ii, grn_vgram *vgram,
const char *value, size_t value_len)
{
+ grn_rc rc = GRN_SUCCESS;
grn_hash *h;
unsigned int token_flags = 0;
grn_token_cursor *token_cursor;
@@ -4702,12 +4772,16 @@ index_del(grn_ctx *ctx, grn_id rid, grn_obj *lexicon, grn_ii *ii, grn_vgram *vgr
grn_token_cursor_close(ctx, token_cursor);
GRN_HASH_EACH(ctx, h, id, &tp, NULL, &u, {
if (*tp) {
- grn_ii_delete_one(ctx, ii, *tp, *u, NULL);
+ grn_rc r;
+ r = grn_ii_delete_one(ctx, ii, *tp, *u, NULL);
+ if (r) {
+ rc = r;
+ }
}
grn_ii_updspec_close(ctx, *u);
});
grn_hash_close(ctx, h);
- return GRN_SUCCESS;
+ return rc;
}
grn_rc
@@ -4842,7 +4916,11 @@ grn_ii_update(grn_ctx *ctx, grn_ii *ii, grn_id rid, grn_vgram *vgram, unsigned i
grn_hash_delete_by_id(ctx, new, eid, NULL);
}
} else {
- grn_ii_delete_one(ctx, ii, *tp, *u, new);
+ grn_rc r;
+ r = grn_ii_delete_one(ctx, ii, *tp, *u, new);
+ if (r) {
+ rc = r;
+ }
}
grn_ii_updspec_close(ctx, *u);
});
@@ -4867,7 +4945,8 @@ exit :
static grn_rc
grn_vector2updspecs(grn_ctx *ctx, grn_ii *ii, grn_id rid, unsigned int section,
- grn_obj *in, grn_obj *out, grn_token_mode mode, grn_obj *posting)
+ grn_obj *in, grn_obj *out, grn_tokenize_mode mode,
+ grn_obj *posting)
{
int j;
grn_id tid;
@@ -4911,8 +4990,65 @@ grn_vector2updspecs(grn_ctx *ctx, grn_ii *ii, grn_id rid, unsigned int section,
}
static grn_rc
-grn_uvector2updspecs(grn_ctx *ctx, grn_ii *ii, grn_id rid, unsigned int section,
- grn_obj *in, grn_obj *out)
+grn_uvector2updspecs_data(grn_ctx *ctx, grn_ii *ii, grn_id rid,
+ unsigned int section, grn_obj *in, grn_obj *out,
+ grn_tokenize_mode mode, grn_obj *posting)
+{
+ int i, n;
+ grn_hash *h = (grn_hash *)out;
+ grn_obj *lexicon = ii->lexicon;
+ unsigned int element_size;
+
+ n = grn_uvector_size(ctx, in);
+ element_size = grn_uvector_element_size(ctx, in);
+ for (i = 0; i < n; i++) {
+ grn_token_cursor *token_cursor;
+ unsigned int token_flags = 0;
+ const char *element;
+
+ element = GRN_BULK_HEAD(in) + (element_size * i);
+ token_cursor = grn_token_cursor_open(ctx, lexicon,
+ element, element_size,
+ mode, token_flags);
+ if (!token_cursor) {
+ continue;
+ }
+
+ while (!token_cursor->status) {
+ grn_id tid;
+ if ((tid = grn_token_cursor_next(ctx, token_cursor))) {
+ grn_ii_updspec **u;
+
+ if (posting) { GRN_RECORD_PUT(ctx, posting, tid); }
+ if (!grn_hash_add(ctx, h, &tid, sizeof(grn_id), (void **)&u, NULL)) {
+ break;
+ }
+ if (!*u) {
+ if (!(*u = grn_ii_updspec_open(ctx, rid, section))) {
+ GRN_LOG(ctx, GRN_LOG_ALERT,
+ "grn_ii_updspec_open on grn_uvector2updspecs_data failed!");
+ grn_token_cursor_close(ctx, token_cursor);
+ return GRN_NO_MEMORY_AVAILABLE;
+ }
+ }
+ if (grn_ii_updspec_add(ctx, *u, token_cursor->pos, 0)) {
+ GRN_LOG(ctx, GRN_LOG_ALERT,
+ "grn_ii_updspec_add on grn_uvector2updspecs failed!");
+ grn_token_cursor_close(ctx, token_cursor);
+ return GRN_NO_MEMORY_AVAILABLE;
+ }
+ }
+ }
+
+ grn_token_cursor_close(ctx, token_cursor);
+ }
+
+ return GRN_SUCCESS;
+}
+
+static grn_rc
+grn_uvector2updspecs_id(grn_ctx *ctx, grn_ii *ii, grn_id rid,
+ unsigned int section, grn_obj *in, grn_obj *out)
{
int i, n;
grn_ii_updspec **u;
@@ -4941,6 +5077,19 @@ grn_uvector2updspecs(grn_ctx *ctx, grn_ii *ii, grn_id rid, unsigned int section,
return GRN_SUCCESS;
}
+static grn_rc
+grn_uvector2updspecs(grn_ctx *ctx, grn_ii *ii, grn_id rid,
+ unsigned int section, grn_obj *in, grn_obj *out,
+ grn_tokenize_mode mode, grn_obj *posting)
+{
+ if (in->header.domain < GRN_N_RESERVED_TYPES) {
+ return grn_uvector2updspecs_data(ctx, ii, rid, section, in, out,
+ mode, posting);
+ } else {
+ return grn_uvector2updspecs_id(ctx, ii, rid, section, in, out);
+ }
+}
+
grn_rc
grn_ii_column_update(grn_ctx *ctx, grn_ii *ii, grn_id rid, unsigned int section,
grn_obj *oldvalue, grn_obj *newvalue, grn_obj *posting)
@@ -5001,7 +5150,8 @@ grn_ii_column_update(grn_ctx *ctx, grn_ii *ii, grn_id rid, unsigned int section,
rc = GRN_NO_MEMORY_AVAILABLE;
} else {
if (new_->header.type == GRN_UVECTOR) {
- rc = grn_uvector2updspecs(ctx, ii, rid, section, new_, new);
+ rc = grn_uvector2updspecs(ctx, ii, rid, section, new_, new,
+ GRN_TOKEN_ADD, post);
} else {
grn_obj uvector;
unsigned int weight = 0;
@@ -5010,7 +5160,8 @@ grn_ii_column_update(grn_ctx *ctx, grn_ii *ii, grn_id rid, unsigned int section,
uvector.header.impl_flags |= GRN_OBJ_WITH_WEIGHT;
}
grn_uvector_add_element(ctx, &uvector, GRN_RECORD_VALUE(new_), weight);
- rc = grn_uvector2updspecs(ctx, ii, rid, section, &uvector, new);
+ rc = grn_uvector2updspecs(ctx, ii, rid, section, &uvector, new,
+ GRN_TOKEN_ADD, post);
GRN_OBJ_FIN(ctx, &uvector);
}
}
@@ -5095,7 +5246,8 @@ grn_ii_column_update(grn_ctx *ctx, grn_ii *ii, grn_id rid, unsigned int section,
rc = GRN_NO_MEMORY_AVAILABLE;
} else {
if (old_->header.type == GRN_UVECTOR) {
- rc = grn_uvector2updspecs(ctx, ii, rid, section, old_, old);
+ rc = grn_uvector2updspecs(ctx, ii, rid, section, old_, old,
+ GRN_TOKEN_DEL, NULL);
} else {
grn_obj uvector;
unsigned int weight = 0;
@@ -5104,7 +5256,8 @@ grn_ii_column_update(grn_ctx *ctx, grn_ii *ii, grn_id rid, unsigned int section,
uvector.header.impl_flags |= GRN_OBJ_WITH_WEIGHT;
}
grn_uvector_add_element(ctx, &uvector, GRN_RECORD_VALUE(old_), weight);
- rc = grn_uvector2updspecs(ctx, ii, rid, section, &uvector, old);
+ rc = grn_uvector2updspecs(ctx, ii, rid, section, &uvector, old,
+ GRN_TOKEN_DEL, NULL);
GRN_OBJ_FIN(ctx, &uvector);
}
}
@@ -5130,7 +5283,11 @@ grn_ii_column_update(grn_ctx *ctx, grn_ii *ii, grn_id rid, unsigned int section,
grn_hash_delete_by_id(ctx, n, eid, NULL);
}
} else {
- grn_ii_delete_one(ctx, ii, *tp, *u, n);
+ grn_rc r;
+ r = grn_ii_delete_one(ctx, ii, *tp, *u, n);
+ if (r) {
+ rc = r;
+ }
}
grn_ii_updspec_close(ctx, *u);
});
@@ -5322,7 +5479,7 @@ token_info_skip(grn_ctx *ctx, token_info *ti, uint32_t rid, uint32_t sid)
if (!(c = cursor_heap_min(ti->cursors))) { return GRN_END_OF_DATA; }
p = c->post;
if (p->rid > rid || (p->rid == rid && p->sid >= sid)) { break; }
- cursor_heap_pop(ctx, ti->cursors);
+ cursor_heap_pop(ctx, ti->cursors, rid);
}
ti->pos = p->pos - ti->offset;
ti->p = p;
@@ -5362,7 +5519,7 @@ token_info_build(grn_ctx *ctx, grn_obj *lexicon, grn_ii *ii, const char *string,
const char *key;
uint32_t size;
grn_rc rc = GRN_END_OF_DATA;
- unsigned int token_flags = GRN_TOKEN_ENABLE_TOKENIZED_DELIMITER;
+ unsigned int token_flags = GRN_TOKEN_CURSOR_ENABLE_TOKENIZED_DELIMITER;
grn_token_cursor *token_cursor = grn_token_cursor_open(ctx, lexicon,
string, string_len,
GRN_TOKEN_GET,
@@ -5394,11 +5551,11 @@ token_info_build(grn_ctx *ctx, grn_obj *lexicon, grn_ii *ii, const char *string,
tid = grn_token_cursor_next(ctx, token_cursor);
if (token_cursor->force_prefix) { ef |= EX_PREFIX; }
switch (token_cursor->status) {
- case GRN_TOKEN_DOING :
+ case GRN_TOKEN_CURSOR_DOING :
key = _grn_table_key(ctx, lexicon, tid, &size);
ti = token_info_open(ctx, lexicon, ii, key, size, token_cursor->pos, ef & EX_SUFFIX);
break;
- case GRN_TOKEN_DONE :
+ case GRN_TOKEN_CURSOR_DONE :
ti = token_info_open(ctx, lexicon, ii, (const char *)token_cursor->curr,
token_cursor->curr_size, 0, ef);
/*
@@ -5408,11 +5565,11 @@ token_info_build(grn_ctx *ctx, grn_obj *lexicon, grn_ii *ii, const char *string,
token_cursor->orig_blen, token_cursor->pos, ef);
*/
break;
- case GRN_TOKEN_NOT_FOUND :
+ case GRN_TOKEN_CURSOR_NOT_FOUND :
ti = token_info_open(ctx, lexicon, ii, (char *)token_cursor->orig,
token_cursor->orig_blen, 0, ef);
break;
- case GRN_TOKEN_DONE_SKIP :
+ case GRN_TOKEN_CURSOR_DONE_SKIP :
*only_skip_token = GRN_TRUE;
goto exit;
default :
@@ -5420,16 +5577,17 @@ token_info_build(grn_ctx *ctx, grn_obj *lexicon, grn_ii *ii, const char *string,
}
if (!ti) { goto exit ; }
tis[(*n)++] = ti;
- while (token_cursor->status == GRN_TOKEN_DOING) {
+ while (token_cursor->status == GRN_TOKEN_CURSOR_DOING) {
tid = grn_token_cursor_next(ctx, token_cursor);
+ if (token_cursor->force_prefix) { ef |= EX_PREFIX; }
switch (token_cursor->status) {
- case GRN_TOKEN_DONE_SKIP :
+ case GRN_TOKEN_CURSOR_DONE_SKIP :
continue;
- case GRN_TOKEN_DOING :
+ case GRN_TOKEN_CURSOR_DOING :
key = _grn_table_key(ctx, lexicon, tid, &size);
ti = token_info_open(ctx, lexicon, ii, key, size, token_cursor->pos, EX_NONE);
break;
- case GRN_TOKEN_DONE :
+ case GRN_TOKEN_CURSOR_DONE :
if (tid) {
key = _grn_table_key(ctx, lexicon, tid, &size);
ti = token_info_open(ctx, lexicon, ii, key, size, token_cursor->pos, ef & EX_PREFIX);
@@ -5440,7 +5598,9 @@ token_info_build(grn_ctx *ctx, grn_obj *lexicon, grn_ii *ii, const char *string,
token_cursor->curr_size, token_cursor->pos, ef & EX_PREFIX);
break;
}
- if (!ti) { goto exit; }
+ if (!ti) {
+ goto exit;
+ }
tis[(*n)++] = ti;
}
rc = GRN_SUCCESS;
@@ -5460,7 +5620,7 @@ token_info_clear_offset(token_info **tis, uint32_t n)
/* select */
inline static void
-res_add(grn_ctx *ctx, grn_hash *s, grn_rset_posinfo *pi, uint32_t score,
+res_add(grn_ctx *ctx, grn_hash *s, grn_rset_posinfo *pi, double score,
grn_operator op)
{
grn_rset_recinfo *ri;
@@ -5619,7 +5779,7 @@ typedef enum {
grn_wv_constant
} grn_wv_mode;
-inline static int
+inline static double
get_weight(grn_ctx *ctx, grn_hash *s, grn_id rid, int sid,
grn_wv_mode wvm, grn_select_optarg *optarg)
{
@@ -5656,7 +5816,7 @@ grn_ii_similar_search(grn_ctx *ctx, grn_ii *ii,
grn_rc rc = GRN_SUCCESS;
grn_hash *h;
grn_token_cursor *token_cursor;
- unsigned int token_flags = GRN_TOKEN_ENABLE_TOKENIZED_DELIMITER;
+ unsigned int token_flags = GRN_TOKEN_CURSOR_ENABLE_TOKENIZED_DELIMITER;
grn_obj *lexicon = ii->lexicon;
if (!lexicon || !ii || !string || !string_len || !s || !optarg) { return GRN_INVALID_ARGUMENT; }
if (!(h = grn_hash_create(ctx, NULL, sizeof(grn_id), sizeof(int), 0))) {
@@ -5668,8 +5828,8 @@ grn_ii_similar_search(grn_ctx *ctx, grn_ii *ii,
return GRN_NO_MEMORY_AVAILABLE;
}
if (!(max_size = optarg->max_size)) { max_size = 1048576; }
- while (token_cursor->status != GRN_TOKEN_DONE &&
- token_cursor->status != GRN_TOKEN_DONE_SKIP) {
+ while (token_cursor->status != GRN_TOKEN_CURSOR_DONE &&
+ token_cursor->status != GRN_TOKEN_CURSOR_DONE_SKIP) {
if ((tid = grn_token_cursor_next(ctx, token_cursor))) {
if (grn_hash_add(ctx, h, &tid, sizeof(grn_id), (void **)&w1, NULL)) { (*w1)++; }
}
@@ -5749,7 +5909,7 @@ grn_ii_similar_search(grn_ctx *ctx, grn_ii *ii,
if (rep) {
while (grn_ii_cursor_next(ctx, c)) {
pos = c->post;
- if ((w2 = get_weight(ctx, s, pos->rid, pos->sid, wvm, optarg))) {
+ if ((w2 = get_weight(ctx, s, pos->rid, pos->sid, wvm, optarg)) > 0) {
while (grn_ii_cursor_next_pos(ctx, c)) {
res_add(ctx, s, (grn_rset_posinfo *) pos, *w1 * w2 * (1 + pos->weight), op);
}
@@ -5758,7 +5918,7 @@ grn_ii_similar_search(grn_ctx *ctx, grn_ii *ii,
} else {
while (grn_ii_cursor_next(ctx, c)) {
pos = c->post;
- if ((w2 = get_weight(ctx, s, pos->rid, pos->sid, wvm, optarg))) {
+ if ((w2 = get_weight(ctx, s, pos->rid, pos->sid, wvm, optarg)) > 0) {
res_add(ctx, s, (grn_rset_posinfo *) pos, *w1 * w2 * (pos->tf + pos->weight), op);
}
}
@@ -5859,6 +6019,215 @@ grn_ii_term_extract(grn_ctx *ctx, grn_ii *ii, const char *string,
return rc;
}
+#ifdef GRN_II_SELECT_ENABLE_SEQUENTIAL_SEARCH
+static grn_bool
+grn_ii_select_sequential_search_should_use(grn_ctx *ctx,
+ grn_ii *ii,
+ const char *raw_query,
+ unsigned int raw_query_len,
+ grn_hash *result,
+ grn_operator op,
+ grn_wv_mode wvm,
+ grn_select_optarg *optarg,
+ token_info **token_infos,
+ uint32_t n_token_infos,
+ double too_many_index_match_ratio)
+{
+ int n_sources;
+
+ if (too_many_index_match_ratio < 0.0) {
+ return GRN_FALSE;
+ }
+
+ if (op != GRN_OP_AND) {
+ return GRN_FALSE;
+ }
+
+ if (optarg->mode != GRN_OP_EXACT) {
+ return GRN_FALSE;
+ }
+
+ n_sources = ii->obj.source_size / sizeof(grn_id);
+ if (n_sources == 0) {
+ return GRN_FALSE;
+ }
+
+ {
+ uint32_t i;
+ int n_existing_records;
+
+ n_existing_records = GRN_HASH_SIZE(result);
+ for (i = 0; i < n_token_infos; i++) {
+ token_info *info = token_infos[i];
+ if (n_existing_records <= (info->size * too_many_index_match_ratio)) {
+ return GRN_TRUE;
+ }
+ }
+ return GRN_FALSE;
+ }
+}
+
+static void
+grn_ii_select_sequential_search_body(grn_ctx *ctx,
+ grn_ii *ii,
+ grn_obj *normalizer,
+ grn_encoding encoding,
+ OnigRegex regex,
+ grn_hash *result,
+ grn_operator op,
+ grn_wv_mode wvm,
+ grn_select_optarg *optarg)
+{
+ int i, n_sources;
+ grn_id *source_ids = ii->obj.source;
+ grn_obj buffer;
+
+ GRN_TEXT_INIT(&buffer, 0);
+ n_sources = ii->obj.source_size / sizeof(grn_id);
+ for (i = 0; i < n_sources; i++) {
+ grn_id source_id = source_ids[i];
+ grn_obj *source;
+ char column_name[GRN_TABLE_MAX_KEY_SIZE];
+ int column_name_size;
+ grn_obj *accessor;
+
+ source = grn_ctx_at(ctx, source_id);
+ column_name_size = grn_column_name(ctx, source,
+ column_name,
+ GRN_TABLE_MAX_KEY_SIZE);
+ accessor = grn_obj_column(ctx, (grn_obj *)result, column_name,
+ column_name_size);
+ {
+ grn_hash_cursor *cursor;
+ grn_id id;
+ cursor = grn_hash_cursor_open(ctx, result, NULL, 0, NULL, 0, 0, -1, 0);
+ while ((id = grn_hash_cursor_next(ctx, cursor)) != GRN_ID_NIL) {
+ OnigPosition position;
+ grn_obj *value;
+ const char *normalized_value;
+ unsigned int normalized_value_length;
+
+ GRN_BULK_REWIND(&buffer);
+ grn_obj_get_value(ctx, accessor, id, &buffer);
+ value = grn_string_open_(ctx,
+ GRN_TEXT_VALUE(&buffer),
+ GRN_TEXT_LEN(&buffer),
+ normalizer, 0, encoding);
+ grn_string_get_normalized(ctx, value,
+ &normalized_value, &normalized_value_length,
+ NULL);
+ position = onig_search(regex,
+ normalized_value,
+ normalized_value + normalized_value_length,
+ normalized_value,
+ normalized_value + normalized_value_length,
+ NULL,
+ 0);
+ if (position != ONIG_MISMATCH) {
+ grn_rset_posinfo info;
+ double score;
+ info.rid = id;
+ info.sid = i + 1;
+ info.pos = 0;
+ score = get_weight(ctx, result, info.rid, info.sid, wvm, optarg);
+ res_add(ctx, result, &info, score, op);
+ }
+ grn_obj_unlink(ctx, value);
+ }
+ grn_hash_cursor_close(ctx, cursor);
+ }
+ grn_obj_unlink(ctx, accessor);
+ }
+ grn_obj_unlink(ctx, &buffer);
+}
+
+static grn_bool
+grn_ii_select_sequential_search(grn_ctx *ctx,
+ grn_ii *ii,
+ const char *raw_query,
+ unsigned int raw_query_len,
+ grn_hash *result,
+ grn_operator op,
+ grn_wv_mode wvm,
+ grn_select_optarg *optarg,
+ token_info **token_infos,
+ uint32_t n_token_infos)
+{
+ grn_bool processed = GRN_TRUE;
+
+ {
+ /* Disabled by default. */
+ double too_many_index_match_ratio = -1;
+ char too_many_index_match_ratio_env[GRN_ENV_BUFFER_SIZE];
+ grn_getenv("GRN_II_SELECT_TOO_MANY_INDEX_MATCH_RATIO",
+ too_many_index_match_ratio_env,
+ GRN_ENV_BUFFER_SIZE);
+ if (too_many_index_match_ratio_env[0]) {
+ too_many_index_match_ratio = atof(too_many_index_match_ratio_env);
+ }
+
+ if (!grn_ii_select_sequential_search_should_use(ctx,
+ ii,
+ raw_query,
+ raw_query_len,
+ result,
+ op,
+ wvm,
+ optarg,
+ token_infos,
+ n_token_infos,
+ too_many_index_match_ratio)) {
+ return GRN_FALSE;
+ }
+ }
+
+ {
+ grn_encoding encoding;
+ grn_obj *normalizer;
+ int nflags = 0;
+ grn_obj *query;
+ const char *normalized_query;
+ unsigned int normalized_query_length;
+
+ grn_table_get_info(ctx, ii->lexicon,
+ NULL, &encoding, NULL, &normalizer, NULL);
+ query = grn_string_open_(ctx, raw_query, raw_query_len,
+ normalizer, nflags, encoding);
+ grn_string_get_normalized(ctx, query,
+ &normalized_query, &normalized_query_length,
+ NULL);
+ {
+ OnigRegex regex;
+ int onig_result;
+ OnigErrorInfo error_info;
+ onig_result = onig_new(&regex,
+ normalized_query,
+ normalized_query + normalized_query_length,
+ ONIG_OPTION_NONE,
+ ONIG_ENCODING_UTF8,
+ ONIG_SYNTAX_ASIS,
+ &error_info);
+ if (onig_result == ONIG_NORMAL) {
+ grn_ii_select_sequential_search_body(ctx, ii, normalizer, encoding,
+ regex, result, op, wvm, optarg);
+ onig_free(regex);
+ } else {
+ char message[ONIG_MAX_ERROR_MESSAGE_LEN];
+ onig_error_code_to_str(message, onig_result, error_info);
+ GRN_LOG(ctx, GRN_LOG_WARNING,
+ "[ii][select][sequential] "
+ "failed to create regular expression object: %s",
+ message);
+ processed = GRN_FALSE;
+ }
+ }
+ grn_obj_unlink(ctx, query);
+ }
+
+ return processed;
+}
+#endif
+
grn_rc
grn_ii_select(grn_ctx *ctx, grn_ii *ii, const char *string, unsigned int string_len,
grn_hash *s, grn_operator op, grn_select_optarg *optarg)
@@ -5872,6 +6241,9 @@ grn_ii_select(grn_ctx *ctx, grn_ii *ii, const char *string, unsigned int string_
grn_operator mode = GRN_OP_EXACT;
grn_wv_mode wvm = grn_wv_none;
grn_obj *lexicon = ii->lexicon;
+ grn_scorer_score_func *score_func = NULL;
+ grn_scorer_matched_record record;
+
if (!lexicon || !ii || !s) { return GRN_INVALID_ARGUMENT; }
if (optarg) {
mode = optarg->mode;
@@ -5938,6 +6310,31 @@ grn_ii_select(grn_ctx *ctx, grn_ii *ii, const char *string, unsigned int string_
goto exit;
}
*/
+#ifdef GRN_II_SELECT_ENABLE_SEQUENTIAL_SEARCH
+ if (grn_ii_select_sequential_search(ctx, ii, string, string_len,
+ s, op, wvm, optarg, tis, n)) {
+ goto exit;
+ }
+#endif
+
+ if (optarg && optarg->scorer) {
+ grn_proc *scorer = (grn_proc *)(optarg->scorer);
+ score_func = scorer->callbacks.scorer.score;
+ record.table = grn_ctx_at(ctx, s->obj.header.domain);
+ record.lexicon = lexicon;
+ record.id = GRN_ID_NIL;
+ GRN_RECORD_INIT(&(record.terms), GRN_OBJ_VECTOR, lexicon->header.domain);
+ GRN_UINT32_INIT(&(record.term_weights), GRN_OBJ_VECTOR);
+ record.total_term_weights = 0;
+ record.n_documents = grn_table_size(ctx, record.table);
+ record.n_occurrences = 0;
+ record.n_candidates = 0;
+ record.n_tokens = 0;
+ record.weight = 0;
+ record.args_expr = optarg->scorer_args_expr;
+ record.args_expr_offset = optarg->scorer_args_expr_offset;
+ }
+
for (;;) {
rid = (*tis)->p->rid;
sid = (*tis)->p->sid;
@@ -5951,11 +6348,18 @@ grn_ii_select(grn_ctx *ctx, grn_ii *ii, const char *string, unsigned int string_
}
}
weight = get_weight(ctx, s, rid, sid, wvm, optarg);
- if (tip == tie && weight) {
+ if (tip == tie && weight > 0) {
grn_rset_posinfo pi = {rid, sid, 0};
if (orp || grn_hash_get(ctx, s, &pi, s->key_size, NULL)) {
int count = 0, noccur = 0, pos = 0, score = 0, tscore = 0, min, max;
+ if (score_func) {
+ GRN_BULK_REWIND(&(record.terms));
+ GRN_BULK_REWIND(&(record.term_weights));
+ record.n_candidates = 0;
+ record.n_tokens = 0;
+ }
+
#define SKIP_OR_BREAK(pos) {\
if (token_info_skip_pos(ctx, ti, rid, sid, pos)) { break; } \
if (ti->p->rid != rid || ti->p->sid != sid) { \
@@ -5967,6 +6371,13 @@ grn_ii_select(grn_ctx *ctx, grn_ii *ii, const char *string, unsigned int string_
if (n == 1 && !rep) {
noccur = (*tis)->p->tf;
tscore = (*tis)->p->weight;
+ if (score_func) {
+ GRN_RECORD_PUT(ctx, &(record.terms), (*tis)->cursors->bins[0]->id);
+ GRN_UINT32_PUT(ctx, &(record.term_weights), tscore);
+ record.n_occurrences = noccur;
+ record.n_candidates = (*tis)->size;
+ record.n_tokens = (*tis)->ntoken;
+ }
} else if (mode == GRN_OP_NEAR) {
bt_zap(bt);
for (tip = tis; tip < tie; tip++) {
@@ -6003,6 +6414,18 @@ grn_ii_select(grn_ctx *ctx, grn_ii *ii, const char *string, unsigned int string_
score += ti->p->weight; count++;
} else {
score = ti->p->weight; count = 1; pos = ti->pos;
+ if (noccur == 0 && score_func) {
+ GRN_BULK_REWIND(&(record.terms));
+ GRN_BULK_REWIND(&(record.term_weights));
+ record.n_candidates = 0;
+ record.n_tokens = 0;
+ }
+ }
+ if (noccur == 0 && score_func) {
+ GRN_RECORD_PUT(ctx, &(record.terms), ti->cursors->bins[0]->id);
+ GRN_UINT32_PUT(ctx, &(record.term_weights), ti->p->weight);
+ record.n_candidates += ti->size;
+ record.n_tokens += ti->ntoken;
}
if (count == n) {
if (rep) { pi.pos = pos; res_add(ctx, s, &pi, (score + 1) * weight, op); }
@@ -6012,13 +6435,29 @@ grn_ii_select(grn_ctx *ctx, grn_ii *ii, const char *string, unsigned int string_
}
}
}
- if (noccur && !rep) { res_add(ctx, s, &pi, (noccur + tscore) * weight, op); }
+ if (noccur && !rep) {
+ double record_score;
+ if (score_func) {
+ record.id = rid;
+ record.weight = weight;
+ record.n_occurrences = noccur;
+ record.total_term_weights = tscore;
+ record_score = score_func(ctx, &record) * weight;
+ } else {
+ record_score = (noccur + tscore) * weight;
+ }
+ res_add(ctx, s, &pi, record_score, op);
+ }
#undef SKIP_OR_BREAK
}
}
if (token_info_skip(ctx, *tis, nrid, nsid)) { goto exit; }
}
exit :
+ if (score_func) {
+ GRN_OBJ_FIN(ctx, &(record.terms));
+ GRN_OBJ_FIN(ctx, &(record.term_weights));
+ }
for (tip = tis; tip < tis + n; tip++) {
if (*tip) { token_info_close(ctx, *tip); }
}
@@ -6039,6 +6478,93 @@ exit :
return rc;
}
+uint32_t
+grn_ii_estimate_size_for_query(grn_ctx *ctx, grn_ii *ii,
+ const char *query, unsigned int query_len,
+ grn_search_optarg *optarg)
+{
+ grn_rc rc;
+ grn_obj *lexicon = ii->lexicon;
+ token_info **tis = NULL;
+ uint32_t i;
+ uint32_t n_tis = 0;
+ grn_bool only_skip_token = GRN_FALSE;
+ grn_operator mode = GRN_OP_EXACT;
+ double estimated_size = 0;
+
+ if (query_len == 0) {
+ return 0;
+ }
+
+ tis = GRN_MALLOC(sizeof(token_info *) * query_len * 2);
+ if (!tis) {
+ return 0;
+ }
+
+ if (optarg) {
+ switch (optarg->mode) {
+ case GRN_OP_NEAR :
+ case GRN_OP_NEAR2 :
+ mode = optarg->mode;
+ break;
+ case GRN_OP_SIMILAR :
+ mode = optarg->mode;
+ break;
+ case GRN_OP_REGEXP :
+ mode = optarg->mode;
+ break;
+ default :
+ break;
+ }
+ }
+
+ rc = token_info_build(ctx, lexicon, ii, query, query_len,
+ tis, &n_tis, &only_skip_token, mode);
+ if (rc != GRN_SUCCESS) {
+ goto exit;
+ }
+
+ for (i = 0; i < n_tis; i++) {
+ token_info *ti = tis[i];
+ double term_estimated_size;
+ term_estimated_size = ((double)ti->size / ti->ntoken);
+ if (i == 0) {
+ estimated_size = term_estimated_size;
+ } else {
+ estimated_size = fmin(estimated_size, term_estimated_size);
+ }
+ }
+
+exit :
+ for (i = 0; i < n_tis; i++) {
+ token_info *ti = tis[i];
+ if (ti) {
+ token_info_close(ctx, ti);
+ }
+ }
+ if (tis) {
+ GRN_FREE(tis);
+ }
+
+ return estimated_size;
+}
+
+uint32_t
+grn_ii_estimate_size_for_lexicon_cursor(grn_ctx *ctx, grn_ii *ii,
+ grn_table_cursor *lexicon_cursor)
+{
+ grn_id term_id;
+ uint32_t estimated_size = 0;
+
+ while ((term_id = grn_table_cursor_next(ctx, lexicon_cursor)) != GRN_ID_NIL) {
+ uint32_t term_estimated_size;
+ term_estimated_size = grn_ii_estimate_size(ctx, ii, term_id);
+ estimated_size += term_estimated_size;
+ }
+
+ return estimated_size;
+}
+
grn_rc
grn_ii_sel(grn_ctx *ctx, grn_ii *ii, const char *string, unsigned int string_len,
grn_hash *s, grn_operator op, grn_search_optarg *optarg)
@@ -6046,7 +6572,7 @@ grn_ii_sel(grn_ctx *ctx, grn_ii *ii, const char *string, unsigned int string_len
ERRCLR(ctx);
GRN_LOG(ctx, GRN_LOG_INFO, "grn_ii_sel > (%.*s)", string_len, string);
{
- grn_select_optarg arg = {GRN_OP_EXACT, 0, 0, NULL, 0, NULL, NULL, 0};
+ grn_select_optarg arg = {GRN_OP_EXACT, 0, 0, NULL, 0, NULL, NULL, 0, NULL};
if (!s) { return GRN_INVALID_ARGUMENT; }
if (optarg) {
switch (optarg->mode) {
@@ -6059,6 +6585,9 @@ grn_ii_sel(grn_ctx *ctx, grn_ii *ii, const char *string, unsigned int string_len
arg.mode = optarg->mode;
arg.similarity_threshold = optarg->similarity_threshold;
break;
+ case GRN_OP_REGEXP :
+ arg.mode = optarg->mode;
+ break;
default :
break;
}
@@ -6066,6 +6595,9 @@ grn_ii_sel(grn_ctx *ctx, grn_ii *ii, const char *string, unsigned int string_len
arg.weight_vector = optarg->weight_vector;
arg.vector_size = optarg->vector_size;
}
+ arg.scorer = optarg->scorer;
+ arg.scorer_args_expr = optarg->scorer_args_expr;
+ arg.scorer_args_expr_offset = optarg->scorer_args_expr_offset;
}
/* todo : support subrec
grn_rset_init(ctx, s, grn_rec_document, 0, grn_rec_none, 0, 0);
@@ -6198,11 +6730,11 @@ grn_ii_cursor_next_all(grn_ctx *ctx, grn_ii_cursor *c)
uint8_t *cp;
grn_io_win iw;
uint32_t size = c->cinfo[c->curr_chunk].size;
- if (size && (cp = WIN_MAP2(c->ii->chunk, ctx, &iw,
- c->cinfo[c->curr_chunk].segno, 0,
- size, grn_io_rdonly))) {
+ if (size && (cp = WIN_MAP(c->ii->chunk, ctx, &iw,
+ c->cinfo[c->curr_chunk].segno, 0,
+ size, grn_io_rdonly))) {
grn_p_decv(ctx, cp, size, c->rdv, c->ii->n_elements);
- grn_io_win_unmap2(&iw);
+ grn_io_win_unmap(&iw);
} else {
c->pc.rid = 0;
break;
@@ -6367,7 +6899,7 @@ grn_ii_cursor_inspect(grn_ctx *ctx, grn_ii_cursor *c, grn_obj *buf)
}
void
-grn_ii_inspect_elements(grn_ctx *ctx, grn_ii *ii, grn_obj *buf)
+grn_ii_inspect_values(grn_ctx *ctx, grn_ii *ii, grn_obj *buf)
{
grn_table_cursor *tc;
GRN_TEXT_PUTS(ctx, buf, "[");
@@ -6396,8 +6928,12 @@ grn_ii_inspect_elements(grn_ctx *ctx, grn_ii *ii, grn_obj *buf)
/********************** buffered index builder ***********************/
-const grn_id II_BUFFER_RID_FLAG = 0x80000000;
-const grn_id II_BUFFER_WEIGHT_FLAG = 0x40000000;
+const grn_id II_BUFFER_TYPE_MASK = 0xc0000000;
+#define II_BUFFER_TYPE_RID 0x80000000
+#define II_BUFFER_TYPE_WEIGHT 0x40000000
+#define II_BUFFER_TYPE(id) (((id) & II_BUFFER_TYPE_MASK))
+#define II_BUFFER_PACK(value, type) ((value) | (type))
+#define II_BUFFER_UNPACK(id, type) ((id) & ~(type))
#ifdef II_BUFFER_ORDER_BY_ID
const int II_BUFFER_ORDER = GRN_CURSOR_BY_ID;
#else /* II_BUFFER_ORDER_BY_ID */
@@ -6426,8 +6962,8 @@ typedef struct {
} ii_buffer_counter;
typedef struct {
- off_t head;
- off_t tail;
+ off64_t head;
+ off64_t tail;
uint32_t nextsize;
uint8_t *buffer;
uint32_t buffersize;
@@ -6450,7 +6986,7 @@ struct _grn_ii_buffer {
char tmpfpath[PATH_MAX];
uint64_t update_buffer_size;
// stuff for parsing
- off_t filepos;
+ off64_t filepos;
grn_id *block_buf;
size_t block_buf_size;
size_t block_pos;
@@ -6521,7 +7057,7 @@ allocate_outbuf(grn_ctx *ctx, grn_ii_buffer *ii_buffer)
bufsize_ = bufsize;
}
}
- GRN_LOG(ctx, GRN_LOG_INFO, "flushing:%d bufsize:%zu",
+ GRN_LOG(ctx, GRN_LOG_INFO, "flushing:%d bufsize:%" GRN_FMT_SIZE,
ii_buffer->nblocks, bufsize);
return (uint8_t *)GRN_MALLOC(bufsize);
}
@@ -6573,7 +7109,7 @@ encode_terms(grn_ctx *ctx, grn_ii_buffer *ii_buffer,
}
if (outbufp_ + II_BUFFER_BLOCK_READ_UNIT_SIZE < outbufp) {
uint32_t size = outbufp - outbufp_ + sizeof(uint32_t);
- memcpy(pnext, &size, sizeof(uint32_t));
+ grn_memcpy(pnext, &size, sizeof(uint32_t));
pnext = outbufp;
outbufp += sizeof(uint32_t);
outbufp_ = outbufp;
@@ -6582,7 +7118,7 @@ encode_terms(grn_ctx *ctx, grn_ii_buffer *ii_buffer,
grn_table_cursor_close(ctx, tc);
if (outbufp_ < outbufp) {
uint32_t size = outbufp - outbufp_;
- memcpy(pnext, &size, sizeof(uint32_t));
+ grn_memcpy(pnext, &size, sizeof(uint32_t));
}
return outbufp - outbuf;
}
@@ -6599,59 +7135,66 @@ encode_postings(grn_ctx *ctx, grn_ii_buffer *ii_buffer, uint8_t *outbuf)
uint32_t flags = ii_buffer->ii->header->flags;
for (rest = ii_buffer->block_pos; rest; bp++, rest--) {
grn_id id = *bp;
- if (id & II_BUFFER_RID_FLAG) {
- rid = id - II_BUFFER_RID_FLAG;
+ switch (II_BUFFER_TYPE(id)) {
+ case II_BUFFER_TYPE_RID :
+ rid = II_BUFFER_UNPACK(id, II_BUFFER_TYPE_RID);
if ((flags & GRN_OBJ_WITH_SECTION) && rest) {
sid = *++bp;
rest--;
}
weight = 0;
pos = 0;
- } else if (id & II_BUFFER_WEIGHT_FLAG) {
- weight = id - II_BUFFER_WEIGHT_FLAG;
- } else {
- ii_buffer_counter *counter = &ii_buffer->counters[id - 1];
- if (counter->last_rid == rid && counter->last_sid == sid) {
- counter->last_tf++;
- counter->last_weight += weight;
- } else {
- if (counter->last_tf) {
- uint8_t *p = outbuf + counter->offset_tf;
- GRN_B_ENC(counter->last_tf - 1, p);
- counter->offset_tf = p - outbuf;
- if (flags & GRN_OBJ_WITH_WEIGHT) {
- p = outbuf + counter->offset_weight;
- GRN_B_ENC(counter->last_weight, p);
- counter->offset_weight = p - outbuf;
+ break;
+ case II_BUFFER_TYPE_WEIGHT :
+ weight = II_BUFFER_UNPACK(id, II_BUFFER_TYPE_WEIGHT);
+ break;
+ default :
+ {
+ ii_buffer_counter *counter = &ii_buffer->counters[id - 1];
+ if (counter->last_rid == rid && counter->last_sid == sid) {
+ counter->last_tf++;
+ counter->last_weight += weight;
+ } else {
+ if (counter->last_tf) {
+ uint8_t *p = outbuf + counter->offset_tf;
+ GRN_B_ENC(counter->last_tf - 1, p);
+ counter->offset_tf = p - outbuf;
+ if (flags & GRN_OBJ_WITH_WEIGHT) {
+ p = outbuf + counter->offset_weight;
+ GRN_B_ENC(counter->last_weight, p);
+ counter->offset_weight = p - outbuf;
+ }
}
- }
- {
- uint8_t *p = outbuf + counter->offset_rid;
- GRN_B_ENC(rid - counter->last_rid, p);
- counter->offset_rid = p - outbuf;
- }
- if (flags & GRN_OBJ_WITH_SECTION) {
- uint8_t *p = outbuf + counter->offset_sid;
- if (counter->last_rid != rid) {
- GRN_B_ENC(sid - 1, p);
- } else {
- GRN_B_ENC(sid - counter->last_sid - 1, p);
+ {
+ uint8_t *p = outbuf + counter->offset_rid;
+ GRN_B_ENC(rid - counter->last_rid, p);
+ counter->offset_rid = p - outbuf;
}
- counter->offset_sid = p - outbuf;
+ if (flags & GRN_OBJ_WITH_SECTION) {
+ uint8_t *p = outbuf + counter->offset_sid;
+ if (counter->last_rid != rid) {
+ GRN_B_ENC(sid - 1, p);
+ } else {
+ GRN_B_ENC(sid - counter->last_sid - 1, p);
+ }
+ counter->offset_sid = p - outbuf;
+ }
+ counter->last_rid = rid;
+ counter->last_sid = sid;
+ counter->last_tf = 1;
+ counter->last_weight = weight;
+ counter->last_pos = 0;
+ }
+ if ((flags & GRN_OBJ_WITH_POSITION) && rest) {
+ uint8_t *p = outbuf + counter->offset_pos;
+ pos = *++bp;
+ rest--;
+ GRN_B_ENC(pos - counter->last_pos, p);
+ counter->offset_pos = p - outbuf;
+ counter->last_pos = pos;
}
- counter->last_rid = rid;
- counter->last_sid = sid;
- counter->last_tf = 1;
- counter->last_weight = weight;
- counter->last_pos = 0;
- }
- if (flags & GRN_OBJ_WITH_POSITION) {
- uint8_t *p = outbuf + counter->offset_pos;
- GRN_B_ENC(pos - counter->last_pos, p);
- counter->offset_pos = p - outbuf;
- counter->last_pos = pos;
}
- pos++;
+ break;
}
}
}
@@ -6679,7 +7222,7 @@ grn_ii_buffer_flush(grn_ctx *ctx, grn_ii_buffer *ii_buffer)
size_t encsize;
uint8_t *outbuf;
ii_buffer_block *block;
- GRN_LOG(ctx, GRN_LOG_NOTICE, "flushing:%d npostings:%zu",
+ GRN_LOG(ctx, GRN_LOG_NOTICE, "flushing:%d npostings:%" GRN_FMT_SIZE,
ii_buffer->nblocks, ii_buffer->block_pos);
if (!(block = block_new(ctx, ii_buffer))) { return; }
if (!(outbuf = allocate_outbuf(ctx, ii_buffer))) { return; }
@@ -6687,7 +7230,7 @@ grn_ii_buffer_flush(grn_ctx *ctx, grn_ii_buffer *ii_buffer)
encode_postings(ctx, ii_buffer, outbuf);
encode_last_tf(ctx, ii_buffer, outbuf);
{
- ssize_t r = GRN_WRITE(ii_buffer->tmpfd, outbuf, encsize);
+ ssize_t r = grn_write(ii_buffer->tmpfd, outbuf, encsize);
if (r != encsize) {
ERR(GRN_INPUT_OUTPUT_ERROR, "write returned %" GRN_FMT_LLD " != %" GRN_FMT_LLU,
(long long int)r, (unsigned long long int)encsize);
@@ -6701,7 +7244,7 @@ grn_ii_buffer_flush(grn_ctx *ctx, grn_ii_buffer *ii_buffer)
grn_table_size(ctx, ii_buffer->tmp_lexicon) *
sizeof(ii_buffer_counter));
grn_obj_close(ctx, ii_buffer->tmp_lexicon);
- GRN_LOG(ctx, GRN_LOG_NOTICE, "flushed: %d encsize:%zu",
+ GRN_LOG(ctx, GRN_LOG_NOTICE, "flushed: %d encsize:%" GRN_FMT_SIZE,
ii_buffer->nblocks, encsize);
ii_buffer->tmp_lexicon = NULL;
ii_buffer->nblocks++;
@@ -6719,9 +7262,10 @@ get_tmp_lexicon(grn_ctx *ctx, grn_ii_buffer *ii_buffer)
grn_obj *range = grn_ctx_at(ctx, DB_OBJ(ii_buffer->lexicon)->range);
grn_obj *tokenizer;
grn_obj *normalizer;
+ grn_obj *token_filters;
grn_obj_flags flags;
grn_table_get_info(ctx, ii_buffer->lexicon, &flags, NULL,
- &tokenizer, &normalizer, NULL);
+ &tokenizer, &normalizer, &token_filters);
flags &= ~GRN_OBJ_PERSISTENT;
tmp_lexicon = grn_table_create(ctx, NULL, 0, NULL, flags, domain, range);
if (tmp_lexicon) {
@@ -6730,6 +7274,8 @@ get_tmp_lexicon(grn_ctx *ctx, grn_ii_buffer *ii_buffer)
GRN_INFO_DEFAULT_TOKENIZER, tokenizer);
grn_obj_set_info(ctx, tmp_lexicon,
GRN_INFO_NORMALIZER, normalizer);
+ grn_obj_set_info(ctx, tmp_lexicon,
+ GRN_INFO_TOKEN_FILTERS, token_filters);
if ((flags & GRN_OBJ_TABLE_TYPE_MASK) == GRN_OBJ_TABLE_PAT_KEY) {
grn_pat_cache_enable(ctx, (grn_pat *)tmp_lexicon, PAT_CACHE_SIZE);
}
@@ -6764,7 +7310,7 @@ grn_ii_buffer_tokenize(grn_ctx *ctx, grn_ii_buffer *ii_buffer, grn_id rid,
{
if (value_len) {
grn_obj *tmp_lexicon;
- uint32_t est_len = value_len + 2;
+ uint32_t est_len = value_len * 2 + 2;
if (ii_buffer->block_buf_size < ii_buffer->block_pos + est_len) {
grn_ii_buffer_flush(ctx, ii_buffer);
}
@@ -6780,24 +7326,27 @@ grn_ii_buffer_tokenize(grn_ctx *ctx, grn_ii_buffer *ii_buffer, grn_id rid,
grn_token_cursor *token_cursor;
grn_id *buffer = ii_buffer->block_buf;
uint32_t block_pos = ii_buffer->block_pos;
- buffer[block_pos++] = rid + II_BUFFER_RID_FLAG;
- if ((ii_buffer->ii->header->flags & GRN_OBJ_WITH_SECTION)) {
+ uint32_t ii_flags = ii_buffer->ii->header->flags;
+ buffer[block_pos++] = II_BUFFER_PACK(rid, II_BUFFER_TYPE_RID);
+ if (ii_flags & GRN_OBJ_WITH_SECTION) {
buffer[block_pos++] = sid;
}
if (weight) {
- buffer[block_pos++] = weight + II_BUFFER_WEIGHT_FLAG;
+ buffer[block_pos++] = II_BUFFER_PACK(weight, II_BUFFER_TYPE_WEIGHT);
}
if ((token_cursor = grn_token_cursor_open(ctx, tmp_lexicon,
value, value_len,
GRN_TOKEN_ADD, token_flags))) {
- uint32_t pos;
- for (pos = 0; !token_cursor->status; pos++) {
+ while (!token_cursor->status) {
grn_id tid;
if ((tid = grn_token_cursor_next(ctx, token_cursor))) {
ii_buffer_counter *counter;
counter = get_buffer_counter(ctx, ii_buffer, tmp_lexicon, tid);
if (!counter) { return; }
buffer[block_pos++] = tid;
+ if (ii_flags & GRN_OBJ_WITH_POSITION) {
+ buffer[block_pos++] = token_cursor->pos;
+ }
if (counter->last_rid != rid) {
counter->offset_rid += GRN_B_ENC_SIZE(rid - counter->last_rid);
counter->last_rid = rid;
@@ -6825,8 +7374,9 @@ grn_ii_buffer_tokenize(grn_ctx *ctx, grn_ii_buffer *ii_buffer, grn_id rid,
counter->last_pos = 0;
counter->nrecs++;
}
- counter->offset_pos += GRN_B_ENC_SIZE(pos - counter->last_pos);
- counter->last_pos = pos;
+ counter->offset_pos +=
+ GRN_B_ENC_SIZE(token_cursor->pos - counter->last_pos);
+ counter->last_pos = token_cursor->pos;
counter->last_tf++;
counter->last_weight += weight;
counter->nposts++;
@@ -6857,11 +7407,20 @@ grn_ii_buffer_fetch(grn_ctx *ctx, grn_ii_buffer *ii_buffer,
return;
}
}
- if (lseek(ii_buffer->tmpfd, block->head, SEEK_SET) != block->head) {
- SERR("lseek");
- return;
+ {
+ off64_t seeked_position;
+ seeked_position = grn_lseek(ii_buffer->tmpfd, block->head, SEEK_SET);
+ if (seeked_position != block->head) {
+ ERRNO_ERR("grn_lseek");
+ GRN_LOG(ctx, GRN_LOG_ERROR,
+ "failed to "
+ "grn_lseek(%" GRN_FMT_OFF64_T ") -> %" GRN_FMT_OFF64_T,
+ block->head,
+ seeked_position);
+ return;
+ }
}
- if (read(ii_buffer->tmpfd, block->buffer, bytesize) != bytesize) {
+ if (grn_read(ii_buffer->tmpfd, block->buffer, bytesize) != bytesize) {
SERR("read");
return;
}
@@ -6870,14 +7429,15 @@ grn_ii_buffer_fetch(grn_ctx *ctx, grn_ii_buffer *ii_buffer,
if (block->head >= block->tail) {
if (block->head > block->tail) {
GRN_LOG(ctx, GRN_LOG_WARNING,
- "fetch error: %jd > %jd", block->head, block->tail);
+ "fetch error: %" GRN_FMT_INT64D " > %" GRN_FMT_INT64D,
+ block->head, block->tail);
}
block->rest = block->nextsize;
block->nextsize = 0;
} else {
block->rest = block->nextsize - sizeof(uint32_t);
- memcpy(&block->nextsize,
- &block->buffer[block->rest], sizeof(uint32_t));
+ grn_memcpy(&block->nextsize,
+ &block->buffer[block->rest], sizeof(uint32_t));
}
}
}
@@ -6899,11 +7459,11 @@ grn_ii_buffer_chunk_flush(grn_ctx *ctx, grn_ii_buffer *ii_buffer)
grn_io_win io_win;
uint32_t chunk_number;
chunk_new(ctx, ii_buffer->ii, &chunk_number, ii_buffer->packed_len);
- GRN_LOG(ctx, GRN_LOG_INFO, "chunk:%d, packed_len:%zu",
+ GRN_LOG(ctx, GRN_LOG_INFO, "chunk:%d, packed_len:%" GRN_FMT_SIZE,
chunk_number, ii_buffer->packed_len);
- fake_map2(ctx, ii_buffer->ii->chunk, &io_win, ii_buffer->packed_buf,
- chunk_number, ii_buffer->packed_len);
- grn_io_win_unmap2(&io_win);
+ fake_map(ctx, ii_buffer->ii->chunk, &io_win, ii_buffer->packed_buf,
+ chunk_number, ii_buffer->packed_len);
+ grn_io_win_unmap(&io_win);
ii_buffer->term_buffer->header.chunk = chunk_number;
ii_buffer->term_buffer->header.chunk_size = ii_buffer->packed_len;
ii_buffer->term_buffer->header.buffer_free =
@@ -7165,12 +7725,10 @@ grn_ii_buffer_open(grn_ctx *ctx, grn_ii *ii,
if (ii_buffer->counters) {
ii_buffer->block_buf = GRN_MALLOCN(grn_id, II_BUFFER_BLOCK_SIZE);
if (ii_buffer->block_buf) {
- snprintf(ii_buffer->tmpfpath, PATH_MAX,
- "%sXXXXXX", grn_io_path(ii->seg));
+ grn_snprintf(ii_buffer->tmpfpath, PATH_MAX, PATH_MAX,
+ "%sXXXXXX", grn_io_path(ii->seg));
ii_buffer->block_buf_size = II_BUFFER_BLOCK_SIZE;
- ii_buffer->tmpfd = GRN_MKOSTEMP(ii_buffer->tmpfpath,
- O_WRONLY|O_CREAT|O_TRUNC,
- S_IRUSR|S_IWUSR);
+ ii_buffer->tmpfd = grn_mkstemp(ii_buffer->tmpfpath);
if (ii_buffer->tmpfd != -1) {
grn_obj_flags flags;
grn_table_get_info(ctx, ii->lexicon, &flags, NULL, NULL, NULL, NULL);
@@ -7210,7 +7768,7 @@ grn_ii_buffer_commit(grn_ctx *ctx, grn_ii_buffer *ii_buffer)
grn_ii_buffer_flush(ctx, ii_buffer);
}
if (ii_buffer->tmpfd != -1) {
- GRN_CLOSE(ii_buffer->tmpfd);
+ grn_close(ii_buffer->tmpfd);
}
if (ii_buffer->block_buf) {
GRN_FREE(ii_buffer->block_buf);
@@ -7237,13 +7795,11 @@ grn_ii_buffer_commit(grn_ctx *ctx, grn_ii_buffer *ii_buffer)
ii_buffer->nblocks, ii_buffer->update_buffer_size);
datavec_init(ctx, ii_buffer->data_vectors, ii_buffer->ii->n_elements, 0, 0);
-#ifdef WIN32
- ii_buffer->tmpfd = GRN_OPEN(ii_buffer->tmpfpath, O_RDONLY|O_BINARY);
-#else /* WIN32 */
- ii_buffer->tmpfd = GRN_OPEN(ii_buffer->tmpfpath, O_RDONLY);
-#endif /* WIN32 */
+ grn_open(ii_buffer->tmpfd,
+ ii_buffer->tmpfpath,
+ O_RDONLY | GRN_OPEN_FLAG_BINARY);
if (ii_buffer->tmpfd == -1) {
- SERR("oepn");
+ ERRNO_ERR("oepn");
return ctx->rc;
}
{
@@ -7283,10 +7839,10 @@ grn_ii_buffer_commit(grn_ctx *ctx, grn_ii_buffer *ii_buffer)
}
datavec_fin(ctx, ii_buffer->data_vectors);
GRN_LOG(ctx, GRN_LOG_NOTICE,
- "tmpfile_size:%jd > total_chunk_size:%" GRN_FMT_INT64U,
+ "tmpfile_size:%" GRN_FMT_INT64D " > total_chunk_size:%" GRN_FMT_SIZE,
ii_buffer->filepos, ii_buffer->total_chunk_size);
- GRN_CLOSE(ii_buffer->tmpfd);
- unlink(ii_buffer->tmpfpath);
+ grn_close(ii_buffer->tmpfd);
+ grn_unlink(ii_buffer->tmpfpath);
ii_buffer->tmpfd = -1;
return ctx->rc;
}
@@ -7304,8 +7860,8 @@ grn_ii_buffer_close(grn_ctx *ctx, grn_ii_buffer *ii_buffer)
grn_obj_close(ctx, ii_buffer->tmp_lexicon);
}
if (ii_buffer->tmpfd != -1) {
- GRN_CLOSE(ii_buffer->tmpfd);
- unlink(ii_buffer->tmpfpath);
+ grn_close(ii_buffer->tmpfd);
+ grn_unlink(ii_buffer->tmpfpath);
}
if (ii_buffer->block_buf) {
GRN_FREE(ii_buffer->block_buf);
@@ -7382,7 +7938,21 @@ grn_ii_buffer_parse(grn_ctx *ctx, grn_ii_buffer *ii_buffer,
grn_rc
grn_ii_build(grn_ctx *ctx, grn_ii *ii, uint64_t sparsity)
{
- grn_ii_buffer *ii_buffer = grn_ii_buffer_open(ctx, ii, sparsity);
+ grn_ii_buffer *ii_buffer;
+
+ {
+ grn_obj *data_table;
+
+ data_table = grn_ctx_at(ctx, DB_OBJ(ii)->range);
+ if (!data_table) {
+ return ctx->rc;
+ }
+ if (grn_table_size(ctx, data_table) == 0) {
+ return ctx->rc;
+ }
+ }
+
+ ii_buffer = grn_ii_buffer_open(ctx, ii, sparsity);
if (ii_buffer) {
grn_id *s = ii->obj.source;
if ((ii->obj.source_size) && s) {
diff --git a/storage/mroonga/vendor/groonga/lib/io.c b/storage/mroonga/vendor/groonga/lib/io.c
index 067832ee77b..a78c7f242c9 100644
--- a/storage/mroonga/vendor/groonga/lib/io.c
+++ b/storage/mroonga/vendor/groonga/lib/io.c
@@ -1,5 +1,5 @@
/* -*- c-basic-offset: 2 -*- */
-/* Copyright(C) 2009-2012 Brazil
+/* Copyright(C) 2009-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -15,32 +15,35 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "groonga_in.h"
+#include "grn.h"
+#include <stdlib.h>
#include <stdio.h>
-
-#ifndef __USE_GNU
-#define __USE_GNU /* O_DIRECT */
-#endif /* __USE_GNU */
#include <fcntl.h>
#include <string.h>
#include <sys/stat.h>
-#include "ctx.h"
-#include "io.h"
-#include "plugin_in.h"
-#include "hash.h"
-#include "ctx_impl.h"
+#include "grn_ctx.h"
+#include "grn_io.h"
+#include "grn_plugin.h"
+#include "grn_hash.h"
+#include "grn_ctx_impl.h"
+
+#ifdef WIN32
+# include <share.h>
+#endif /* WIN32 */
#define GRN_IO_IDSTR "GROONGA:IO:00001"
-#ifndef O_BINARY
-# ifdef _O_BINARY
-# define O_BINARY _O_BINARY
-# else
-# define O_BINARY 0
-# endif
-#endif
+#define GRN_IO_VERSION_DEFAULT 1
+
+#define GRN_IO_FILE_SIZE_V1 1073741824UL
+
+#ifdef WIN32
+# define GRN_IO_FILE_SIZE_V0 134217728L
+#else /* WIN32 */
+# define GRN_IO_FILE_SIZE_V0 GRN_IO_FILE_SIZE_V1
+#endif /* WIN32 */
typedef struct _grn_io_fileinfo {
#ifdef WIN32
@@ -56,31 +59,42 @@ typedef struct _grn_io_fileinfo {
#define IO_HEADER_SIZE 64
-inline static grn_rc grn_open(grn_ctx *ctx, fileinfo *fi, const char *path, int flags, size_t maxsize);
+static uint32_t grn_io_version_default = GRN_IO_VERSION_DEFAULT;
+
+inline static grn_rc grn_fileinfo_open(grn_ctx *ctx, fileinfo *fi, const char *path, int flags);
inline static void grn_fileinfo_init(fileinfo *fis, int nfis);
-inline static int grn_opened(fileinfo *fi);
-inline static grn_rc grn_close(grn_ctx *ctx, fileinfo *fi);
-#if defined(WIN32) && defined(WIN32_FMO_EACH)
-inline static void * grn_mmap(grn_ctx *ctx, HANDLE *fmo, fileinfo *fi,
+inline static int grn_fileinfo_opened(fileinfo *fi);
+inline static grn_rc grn_fileinfo_close(grn_ctx *ctx, fileinfo *fi);
+#ifdef WIN32
+inline static void * grn_mmap(grn_ctx *ctx, grn_io *io,
+ HANDLE *fmo, fileinfo *fi,
off_t offset, size_t length);
-inline static int grn_munmap(grn_ctx *ctx, HANDLE *fmo, void *start, size_t length);
-#define GRN_MMAP(ctx,fmo,fi,offset,length)\
- (grn_mmap((ctx), (fmo), (fi), (offset), (length)))
-#define GRN_MUNMAP(ctx,fmo,start,length) (grn_munmap((ctx), (fmo), (start), (length)))
-#else /* defined(WIN32) && defined(WIN32_FMO_EACH) */
-inline static void * grn_mmap(grn_ctx *ctx, fileinfo *fi, off_t offset, size_t length);
-inline static int grn_munmap(grn_ctx *ctx, void *start, size_t length);
-#define GRN_MUNMAP(ctx,fmo,start,length) (grn_munmap((ctx), (start), (length)))
-#ifdef USE_FAIL_MALLOC
-inline static void * grn_fail_mmap(grn_ctx *ctx, fileinfo *fi,
+inline static int grn_munmap(grn_ctx *ctx, grn_io *io,
+ HANDLE *fmo, fileinfo *fi,
+ void *start, size_t length);
+# define GRN_MMAP(ctx,io,fmo,fi,offset,length)\
+ (grn_mmap((ctx), (io), (fmo), (fi), (offset), (length)))
+# define GRN_MUNMAP(ctx,io,fmo,fi,start,length)\
+ (grn_munmap((ctx), (io), (fmo), (fi), (start), (length)))
+#else /* WIN32 */
+inline static void * grn_mmap(grn_ctx *ctx, grn_io *io, fileinfo *fi,
+ off_t offset, size_t length);
+inline static int grn_munmap(grn_ctx *ctx, grn_io *io, fileinfo *fi,
+ void *start, size_t length);
+# define GRN_MUNMAP(ctx,io,fmo,fi,start,length) \
+ (grn_munmap((ctx), (io), (fi), (start), (length)))
+# ifdef USE_FAIL_MALLOC
+inline static void * grn_fail_mmap(grn_ctx *ctx, grn_io *io, fileinfo *fi,
off_t offset, size_t length,
const char* file, int line, const char *func);
-#define GRN_MMAP(ctx,fmo,fi,offset,length) \
- (grn_fail_mmap((ctx), (fi), (offset), (length), __FILE__, __LINE__, __FUNCTION__))
-#else /* USE_FAIL_MALLOC */
-#define GRN_MMAP(ctx,fmo,fi,offset,length) (grn_mmap((ctx), (fi), (offset), (length)))
-#endif /* USE_FAIL_MALLOC */
-#endif /* defined(WIN32) && defined(WIN32_FMO_EACH) */
+# define GRN_MMAP(ctx,io,fmo,fi,offset,length)\
+ (grn_fail_mmap((ctx), (io), (fi), (offset), (length),\
+ __FILE__, __LINE__, __FUNCTION__))
+# else /* USE_FAIL_MALLOC */
+# define GRN_MMAP(ctx,io,fmo,fi,offset,length)\
+ (grn_mmap((ctx), (io), (fi), (offset), (length)))
+# endif /* USE_FAIL_MALLOC */
+#endif /* WIN32 */
inline static int grn_msync(grn_ctx *ctx, void *start, size_t length);
inline static grn_rc grn_pread(grn_ctx *ctx, fileinfo *fi, void *buf, size_t count, off_t offset);
inline static grn_rc grn_pwrite(grn_ctx *ctx, fileinfo *fi, void *buf, size_t count, off_t offset);
@@ -88,6 +102,15 @@ inline static grn_rc grn_pwrite(grn_ctx *ctx, fileinfo *fi, void *buf, size_t co
grn_rc
grn_io_init(void)
{
+ char version_env[GRN_ENV_BUFFER_SIZE];
+
+ grn_getenv("GRN_IO_VERSION",
+ version_env,
+ GRN_ENV_BUFFER_SIZE);
+ if (version_env[0]) {
+ grn_io_version_default = atoi(version_env);
+ }
+
return GRN_SUCCESS;
}
@@ -97,28 +120,82 @@ grn_io_fin(void)
return GRN_SUCCESS;
}
+static inline uint32_t
+grn_io_compute_base(uint32_t header_size)
+{
+ uint32_t total_header_size;
+ total_header_size = IO_HEADER_SIZE + header_size;
+ return (total_header_size + grn_pagesize - 1) & ~(grn_pagesize - 1);
+}
+
+static inline uint32_t
+grn_io_compute_base_segment(uint32_t base, uint32_t segment_size)
+{
+ return (base + segment_size - 1) / segment_size;
+}
+
+static uint32_t
+grn_io_compute_max_n_files(uint32_t segment_size, uint32_t max_segment,
+ unsigned int base_segument, unsigned long file_size)
+{
+ uint64_t last_segment_end;
+ last_segment_end = ((uint64_t)segment_size) * (max_segment + base_segument);
+ return (uint32_t)((last_segment_end + file_size - 1) / file_size);
+}
+
+static inline unsigned long
+grn_io_compute_file_size(uint32_t version)
+{
+ if (version == 0) {
+ return GRN_IO_FILE_SIZE_V0;
+ } else {
+ return GRN_IO_FILE_SIZE_V1;
+ }
+}
+
+static inline uint32_t
+grn_io_max_segment(grn_io *io)
+{
+ if (io->header->segment_tail) {
+ return io->header->segment_tail;
+ } else {
+ return io->header->max_segment;
+ }
+}
+
+static uint32_t
+grn_io_max_n_files(grn_io *io)
+{
+ unsigned long file_size;
+
+ file_size = grn_io_compute_file_size(io->header->version);
+ return grn_io_compute_max_n_files(io->header->segment_size,
+ grn_io_max_segment(io),
+ io->base_seg,
+ file_size);
+}
+
grn_io *
grn_io_create_tmp(uint32_t header_size, uint32_t segment_size,
uint32_t max_segment, grn_io_mode mode, uint32_t flags)
{
grn_io *io;
- unsigned int b;
- uint32_t total_header_size;
+ uint32_t b;
struct _grn_io_header *header;
- total_header_size = IO_HEADER_SIZE + header_size;
- b = (total_header_size + grn_pagesize - 1) & ~(grn_pagesize - 1);
- if ((header = (struct _grn_io_header *)GRN_MMAP(&grn_gctx, NULL, NULL, 0, b))) {
+ b = grn_io_compute_base(header_size);
+ header = (struct _grn_io_header *)GRN_MMAP(&grn_gctx, NULL, NULL, NULL, 0, b);
+ if (header) {
+ header->version = grn_io_version_default;
header->header_size = header_size;
header->segment_size = segment_size;
header->max_segment = max_segment;
header->n_arrays = 0;
header->flags = flags;
header->lock = 0;
- memcpy(header->idstr, GRN_IO_IDSTR, 16);
+ grn_memcpy(header->idstr, GRN_IO_IDSTR, 16);
if ((io = GRN_GMALLOCN(grn_io, 1))) {
grn_io_mapinfo *maps = NULL;
- if (((maps = GRN_GMALLOCN(grn_io_mapinfo, max_segment)) &&
- memset(maps, 0, sizeof(grn_io_mapinfo) * max_segment))) {
+ if ((maps = GRN_GCALLOC(sizeof(grn_io_mapinfo) * max_segment))) {
io->header = header;
io->user_header = (((byte *) header) + IO_HEADER_SIZE);
io->maps = maps;
@@ -138,7 +215,7 @@ grn_io_create_tmp(uint32_t header_size, uint32_t segment_size,
}
GRN_GFREE(io);
}
- GRN_MUNMAP(&grn_gctx, NULL, header, b);
+ GRN_MUNMAP(&grn_gctx, NULL, NULL, NULL, header, b);
}
return NULL;
}
@@ -187,36 +264,40 @@ grn_io_create(grn_ctx *ctx, const char *path, uint32_t header_size, uint32_t seg
{
grn_io *io;
fileinfo *fis;
- unsigned int b, max_nfiles;
- uint32_t bs, total_header_size;
+ uint32_t b, max_nfiles;
+ uint32_t bs;
struct _grn_io_header *header;
+ uint32_t version = grn_io_version_default;
+ unsigned long file_size;
+
if (!path) {
return grn_io_create_tmp(header_size, segment_size, max_segment, mode, flags);
}
if (!*path || (strlen(path) > PATH_MAX - 4)) { return NULL; }
- total_header_size = IO_HEADER_SIZE + header_size;
- b = (total_header_size + grn_pagesize - 1) & ~(grn_pagesize - 1);
- bs = (b + segment_size - 1) / segment_size;
- max_nfiles = (unsigned int)(
- ((uint64_t)segment_size * (max_segment + bs) + GRN_IO_FILE_SIZE - 1)
- / GRN_IO_FILE_SIZE);
+ b = grn_io_compute_base(header_size);
+ bs = grn_io_compute_base_segment(b, segment_size);
+ file_size = grn_io_compute_file_size(version);
+ max_nfiles = grn_io_compute_max_n_files(segment_size, max_segment,
+ bs, file_size);
if ((fis = GRN_GMALLOCN(fileinfo, max_nfiles))) {
grn_fileinfo_init(fis, max_nfiles);
- if (!grn_open(ctx, fis, path, O_RDWR|O_CREAT|O_EXCL, GRN_IO_FILE_SIZE)) {
- if ((header = (struct _grn_io_header *)GRN_MMAP(&grn_gctx, &fis->fmo, fis, 0, b))) {
+ if (!grn_fileinfo_open(ctx, fis, path, O_RDWR|O_CREAT|O_EXCL)) {
+ header = (struct _grn_io_header *)GRN_MMAP(&grn_gctx, NULL,
+ &fis->fmo, fis, 0, b);
+ if (header) {
+ header->version = version;
header->header_size = header_size;
header->segment_size = segment_size;
header->max_segment = max_segment;
header->n_arrays = 0;
header->flags = flags;
header->lock = 0;
- memcpy(header->idstr, GRN_IO_IDSTR, 16);
+ grn_memcpy(header->idstr, GRN_IO_IDSTR, 16);
grn_msync(ctx, header, b);
if ((io = GRN_GMALLOCN(grn_io, 1))) {
grn_io_mapinfo *maps = NULL;
- if (((maps = GRN_GMALLOCN(grn_io_mapinfo, max_segment)) &&
- memset(maps, 0, sizeof(grn_io_mapinfo) * max_segment))) {
- strncpy(io->path, path, PATH_MAX);
+ if ((maps = GRN_GCALLOC(sizeof(grn_io_mapinfo) * max_segment))) {
+ grn_strncpy(io->path, PATH_MAX, path, PATH_MAX);
io->header = header;
io->user_header = (((byte *) header) + IO_HEADER_SIZE);
io->maps = maps;
@@ -236,9 +317,10 @@ grn_io_create(grn_ctx *ctx, const char *path, uint32_t header_size, uint32_t seg
}
GRN_GFREE(io);
}
- GRN_MUNMAP(&grn_gctx, &fis->fmo, header, b);
+ GRN_MUNMAP(&grn_gctx, NULL, &fis->fmo, fis, header, b);
}
- grn_close(ctx, fis);
+ grn_fileinfo_close(ctx, fis);
+ grn_unlink(path);
}
GRN_GFREE(fis);
}
@@ -312,7 +394,7 @@ grn_io_create_with_array(grn_ctx *ctx, const char *path,
if ((io = grn_io_create(ctx, path, header_size + hsize,
segment_size, nsegs, mode, GRN_IO_EXPIRE_GTICK))) {
hp = io->user_header;
- memcpy(hp, array_specs, sizeof(grn_io_array_spec) * n_arrays);
+ grn_memcpy(hp, array_specs, sizeof(grn_io_array_spec) * n_arrays);
io->header->n_arrays = n_arrays;
io->header->segment_tail = 1;
if (!array_init_(io, n_arrays, hsize, msize)) {
@@ -391,11 +473,12 @@ grn_io_detect_type(grn_ctx *ctx, const char *path)
{
struct _grn_io_header h;
uint32_t res = 0;
- int fd = GRN_OPEN(path, O_RDWR | O_BINARY);
+ int fd;
+ grn_open(fd, path, O_RDWR | GRN_OPEN_FLAG_BINARY);
if (fd != -1) {
struct stat s;
if (fstat(fd, &s) != -1 && s.st_size >= sizeof(struct _grn_io_header)) {
- if (read(fd, &h, sizeof(struct _grn_io_header)) == sizeof(struct _grn_io_header)) {
+ if (grn_read(fd, &h, sizeof(struct _grn_io_header)) == sizeof(struct _grn_io_header)) {
if (!memcmp(h.idstr, GRN_IO_IDSTR, 16)) {
res = h.type;
} else {
@@ -407,9 +490,9 @@ grn_io_detect_type(grn_ctx *ctx, const char *path)
} else {
ERR(GRN_INVALID_FORMAT, "grn_io_detect_type failed");
}
- GRN_CLOSE(fd);
+ grn_close(fd);
} else {
- SERR(path);
+ ERRNO_ERR(path);
}
return res;
}
@@ -419,18 +502,21 @@ grn_io_open(grn_ctx *ctx, const char *path, grn_io_mode mode)
{
grn_io *io;
struct stat s;
- fileinfo *fis;
+ fileinfo fi;
uint32_t flags = 0;
- unsigned int b, max_nfiles;
- uint32_t total_header_size;
+ uint32_t b;
uint32_t header_size = 0, segment_size = 0, max_segment = 0, bs;
if (!path || !*path || (strlen(path) > PATH_MAX - 4)) { return NULL; }
{
struct _grn_io_header h;
- int fd = GRN_OPEN(path, O_RDWR | O_BINARY);
- if (fd == -1) { SERR(path); return NULL; }
+ int fd;
+ grn_open(fd, path, O_RDWR | GRN_OPEN_FLAG_BINARY);
+ if (fd == -1) {
+ ERRNO_ERR(path);
+ return NULL;
+ }
if (fstat(fd, &s) != -1 && s.st_size >= sizeof(struct _grn_io_header)) {
- if (read(fd, &h, sizeof(struct _grn_io_header)) == sizeof(struct _grn_io_header)) {
+ if (grn_read(fd, &h, sizeof(struct _grn_io_header)) == sizeof(struct _grn_io_header)) {
if (!memcmp(h.idstr, GRN_IO_IDSTR, 16)) {
header_size = h.header_size;
segment_size = h.segment_size;
@@ -441,24 +527,35 @@ grn_io_open(grn_ctx *ctx, const char *path, grn_io_mode mode)
}
}
}
- GRN_CLOSE(fd);
+ grn_close(fd);
if (!segment_size) { return NULL; }
}
- total_header_size = IO_HEADER_SIZE + header_size;
- b = (total_header_size + grn_pagesize - 1) & ~(grn_pagesize - 1);
- bs = (b + segment_size - 1) / segment_size;
- max_nfiles = (unsigned int)(
- ((uint64_t)segment_size * (max_segment + bs) + GRN_IO_FILE_SIZE - 1)
- / GRN_IO_FILE_SIZE);
- if (!(fis = GRN_GMALLOCN(fileinfo, max_nfiles))) { return NULL; }
- grn_fileinfo_init(fis, max_nfiles);
- if (!grn_open(ctx, fis, path, O_RDWR, GRN_IO_FILE_SIZE)) {
+ b = grn_io_compute_base(header_size);
+ bs = grn_io_compute_base_segment(b, segment_size);
+ grn_fileinfo_init(&fi, 1);
+ if (!grn_fileinfo_open(ctx, &fi, path, O_RDWR)) {
struct _grn_io_header *header;
- if ((header = GRN_MMAP(&grn_gctx, &fis->fmo, fis, 0, b))) {
+ header = GRN_MMAP(&grn_gctx, NULL, &(fi.fmo), &fi, 0, b);
+ if (header) {
+ unsigned long file_size;
+ unsigned int max_nfiles;
+ fileinfo *fis;
+
+ file_size = grn_io_compute_file_size(header->version);
+ max_nfiles = grn_io_compute_max_n_files(segment_size, max_segment,
+ bs, file_size);
+ fis = GRN_GMALLOCN(fileinfo, max_nfiles);
+ if (!fis) {
+ GRN_MUNMAP(&grn_gctx, NULL, &(fi.fmo), &fi, header, b);
+ grn_fileinfo_close(ctx, &fi);
+ return NULL;
+ }
+ grn_fileinfo_init(fis, max_nfiles);
+ grn_memcpy(fis, &fi, sizeof(fileinfo));
if ((io = GRN_GMALLOC(sizeof(grn_io)))) {
grn_io_mapinfo *maps = NULL;
if ((maps = GRN_GCALLOC(sizeof(grn_io_mapinfo) * max_segment))) {
- strncpy(io->path, path, PATH_MAX);
+ grn_strncpy(io->path, PATH_MAX, path, PATH_MAX);
io->header = header;
io->user_header = (((byte *) header) + IO_HEADER_SIZE);
{
@@ -482,51 +579,57 @@ grn_io_open(grn_ctx *ctx, const char *path, grn_io_mode mode)
}
GRN_GFREE(io);
}
- GRN_MUNMAP(&grn_gctx, &fis->fmo, header, b);
+ GRN_GFREE(fis);
+ GRN_MUNMAP(&grn_gctx, NULL, &(fi.fmo), &fi, header, b);
}
- grn_close(ctx, fis);
+ grn_fileinfo_close(ctx, &fi);
}
- GRN_GFREE(fis);
return NULL;
}
grn_rc
grn_io_close(grn_ctx *ctx, grn_io *io)
{
- int i;
- grn_io_mapinfo *mi;
- fileinfo *fi;
- uint32_t bs = io->base_seg;
- uint32_t max_segment = io->header->segment_tail
- ? io->header->segment_tail : io->header->max_segment;
- uint32_t segment_size = io->header->segment_size;
- unsigned int max_nfiles = (unsigned int)(
- ((uint64_t)segment_size * (max_segment + bs) + GRN_IO_FILE_SIZE - 1)
- / GRN_IO_FILE_SIZE);
+ uint32_t max_nfiles;
+
+ max_nfiles = grn_io_max_n_files(io);
grn_io_unregister(io);
if (io->ainfo) { GRN_GFREE(io->ainfo); }
if (io->maps) {
- for (mi = io->maps, i = max_segment; i; mi++, i--) {
+ int i;
+ uint32_t max_segment;
+ uint32_t segment_size;
+ unsigned long file_size;
+ uint32_t segments_per_file;
+
+ max_segment = grn_io_max_segment(io);
+ segment_size = io->header->segment_size;
+ file_size = grn_io_compute_file_size(io->header->version);
+ segments_per_file = file_size / segment_size;
+ for (i = 0; i < max_segment; i++) {
+ grn_io_mapinfo *mi;
+ mi = &(io->maps[i]);
if (mi->map) {
+ fileinfo *fi = NULL;
/* if (atomic_read(mi->nref)) { return STILL_IN_USE ; } */
-#ifdef WIN32
- if ((io->flags & GRN_IO_TEMPORARY)) {
- GRN_GFREE(mi->map);
- } else
-#endif /* WIN32 */
- GRN_MUNMAP(&grn_gctx, &mi->fmo, mi->map, segment_size);
+ if (io->fis) {
+ uint32_t bseg = i + io->base_seg;
+ uint32_t fno = bseg / segments_per_file;
+ fi = &io->fis[fno];
+ }
+ GRN_MUNMAP(&grn_gctx, io, &mi->fmo, fi, mi->map, segment_size);
}
}
GRN_GFREE(io->maps);
}
-#ifdef WIN32
- if ((io->flags & GRN_IO_TEMPORARY)) {
- GRN_GFREE(io->header);
- } else
-#endif /* WIN32 */
- GRN_MUNMAP(&grn_gctx, &io->fis->fmo, io->header, io->base);
+ GRN_MUNMAP(&grn_gctx, io, (io->fis ? &io->fis->fmo : NULL),
+ io->fis, io->header, io->base);
if (io->fis) {
- for (fi = io->fis, i = max_nfiles; i; fi++, i--) { grn_close(ctx, fi); }
+ int i;
+ for (i = 0; i < max_nfiles; i++) {
+ fileinfo *fi = &(io->fis[i]);
+ grn_fileinfo_close(ctx, fi);
+ }
GRN_GFREE(io->fis);
}
GRN_GFREE(io);
@@ -572,7 +675,7 @@ inline static void
gen_pathname(const char *path, char *buffer, int fno)
{
size_t len = strlen(path);
- memcpy(buffer, path, len);
+ grn_memcpy(buffer, path, len);
if (fno) {
buffer[len] = '.';
grn_itoh(fno, buffer + len + 1, 3);
@@ -590,14 +693,13 @@ grn_io_size(grn_ctx *ctx, grn_io *io, uint64_t *size)
uint64_t tsize = 0;
char buffer[PATH_MAX];
uint32_t nfiles;
+
if (io->header->curr_size) {
- nfiles = (uint32_t) ((io->header->curr_size + GRN_IO_FILE_SIZE - 1) / GRN_IO_FILE_SIZE);
+ unsigned long file_size;
+ file_size = grn_io_compute_file_size(io->header->version);
+ nfiles = (uint32_t) ((io->header->curr_size + file_size - 1) / file_size);
} else {
- uint32_t bs = io->base_seg;
- uint32_t max_segment = io->header->max_segment;
- uint32_t segment_size = io->header->segment_size;
- nfiles = (uint32_t) (((uint64_t)segment_size * (max_segment + bs) + GRN_IO_FILE_SIZE - 1)
- / GRN_IO_FILE_SIZE);
+ nfiles = grn_io_max_n_files(io);
}
for (fno = 0; fno < nfiles; fno++) {
gen_pathname(io->path, buffer, fno);
@@ -618,8 +720,8 @@ grn_io_remove(grn_ctx *ctx, const char *path)
if (stat(path, &s)) {
SERR("stat");
return ctx->rc;
- } else if (unlink(path)) {
- SERR(path);
+ } else if (grn_unlink(path)) {
+ ERRNO_ERR(path);
return ctx->rc;
} else {
int fno;
@@ -627,7 +729,9 @@ grn_io_remove(grn_ctx *ctx, const char *path)
for (fno = 1; ; fno++) {
gen_pathname(path, buffer, fno);
if (!stat(buffer, &s)) {
- if (unlink(buffer)) { SERR(buffer); }
+ if (grn_unlink(buffer)) {
+ ERRNO_ERR(buffer);
+ }
} else {
break;
}
@@ -675,7 +779,8 @@ grn_io_read_ja(grn_io *io, grn_ctx *ctx, grn_io_ja_einfo *einfo, uint32_t epos,
{
uint32_t rest = 0, size = *value_len + sizeof(grn_io_ja_ehead);
uint32_t segment_size = io->header->segment_size;
- uint32_t segments_per_file = GRN_IO_FILE_SIZE / segment_size;
+ unsigned long file_size = grn_io_compute_file_size(io->header->version);
+ uint32_t segments_per_file = file_size / segment_size;
uint32_t bseg = segment + io->base_seg;
int fno = bseg / segments_per_file;
fileinfo *fi = &io->fis[fno];
@@ -687,14 +792,14 @@ grn_io_read_ja(grn_io *io, grn_ctx *ctx, grn_io_ja_einfo *einfo, uint32_t epos,
*value_len = 0;
return GRN_NO_MEMORY_AVAILABLE;
}
- if (pos + size > GRN_IO_FILE_SIZE) {
- rest = pos + size - GRN_IO_FILE_SIZE;
- size = GRN_IO_FILE_SIZE - pos;
+ if (pos + size > file_size) {
+ rest = pos + size - file_size;
+ size = file_size - pos;
}
- if (!grn_opened(fi)) {
+ if (!grn_fileinfo_opened(fi)) {
char path[PATH_MAX];
gen_pathname(io->path, path, fno);
- if (grn_open(ctx, fi, path, O_RDWR|O_CREAT, GRN_IO_FILE_SIZE)) {
+ if (grn_fileinfo_open(ctx, fi, path, O_RDWR|O_CREAT)) {
*value = NULL;
*value_len = 0;
GRN_FREE(v);
@@ -739,17 +844,17 @@ grn_io_read_ja(grn_io *io, grn_ctx *ctx, grn_io_ja_einfo *einfo, uint32_t epos,
byte *vr = (byte *)v + size;
do {
fi = &io->fis[++fno];
- if (!grn_opened(fi)) {
+ if (!grn_fileinfo_opened(fi)) {
char path[PATH_MAX];
gen_pathname(io->path, path, fno);
- if (grn_open(ctx, fi, path, O_RDWR|O_CREAT, GRN_IO_FILE_SIZE)) {
+ if (grn_fileinfo_open(ctx, fi, path, O_RDWR|O_CREAT)) {
*value = NULL;
*value_len = 0;
GRN_FREE(v);
return ctx->rc;
}
}
- size = rest > GRN_IO_FILE_SIZE ? GRN_IO_FILE_SIZE : rest;
+ size = rest > file_size ? file_size : rest;
if (grn_pread(ctx, fi, vr, size, 0)) {
*value = NULL;
*value_len = 0;
@@ -771,26 +876,27 @@ grn_io_write_ja(grn_io *io, grn_ctx *ctx, uint32_t key,
grn_rc rc;
uint32_t rest = 0, size = value_len + sizeof(grn_io_ja_ehead);
uint32_t segment_size = io->header->segment_size;
- uint32_t segments_per_file = GRN_IO_FILE_SIZE / segment_size;
+ unsigned long file_size = grn_io_compute_file_size(io->header->version);
+ uint32_t segments_per_file = file_size / segment_size;
uint32_t bseg = segment + io->base_seg;
int fno = bseg / segments_per_file;
fileinfo *fi = &io->fis[fno];
off_t base = fno ? 0 : io->base - (uint64_t)segment_size * io->base_seg;
off_t pos = (uint64_t)segment_size * (bseg % segments_per_file) + offset + base;
- if (pos + size > GRN_IO_FILE_SIZE) {
- rest = pos + size - GRN_IO_FILE_SIZE;
- size = GRN_IO_FILE_SIZE - pos;
+ if (pos + size > file_size) {
+ rest = pos + size - file_size;
+ size = file_size - pos;
}
- if (!grn_opened(fi)) {
+ if (!grn_fileinfo_opened(fi)) {
char path[PATH_MAX];
gen_pathname(io->path, path, fno);
- if ((rc = grn_open(ctx, fi, path, O_RDWR|O_CREAT, GRN_IO_FILE_SIZE))) { return rc; }
+ if ((rc = grn_fileinfo_open(ctx, fi, path, O_RDWR|O_CREAT))) { return rc; }
}
if (value_len <= 256) {
ja_element je;
je.head.size = value_len;
je.head.key = key;
- memcpy(je.body, value, value_len);
+ grn_memcpy(je.body, value, value_len);
rc = grn_pwrite(ctx, fi, &je, size, pos);
} else {
grn_io_ja_ehead eh;
@@ -805,12 +911,12 @@ grn_io_write_ja(grn_io *io, grn_ctx *ctx, uint32_t key,
byte *vr = (byte *)value + size - sizeof(grn_io_ja_ehead);
do {
fi = &io->fis[++fno];
- if (!grn_opened(fi)) {
+ if (!grn_fileinfo_opened(fi)) {
char path[PATH_MAX];
gen_pathname(io->path, path, fno);
- if ((rc = grn_open(ctx, fi, path, O_RDWR|O_CREAT, GRN_IO_FILE_SIZE))) { return rc; }
+ if ((rc = grn_fileinfo_open(ctx, fi, path, O_RDWR|O_CREAT))) { return rc; }
}
- size = rest > GRN_IO_FILE_SIZE ? GRN_IO_FILE_SIZE : rest;
+ size = rest > file_size ? file_size : rest;
if ((rc = grn_pwrite(ctx, fi, vr, size, 0))) { return rc; }
vr += size;
rest -= size;
@@ -825,16 +931,17 @@ grn_io_write_ja_ehead(grn_io *io, grn_ctx *ctx, uint32_t key,
{
grn_rc rc;
uint32_t segment_size = io->header->segment_size;
- uint32_t segments_per_file = GRN_IO_FILE_SIZE / segment_size;
+ unsigned long file_size = grn_io_compute_file_size(io->header->version);
+ uint32_t segments_per_file = file_size / segment_size;
uint32_t bseg = segment + io->base_seg;
int fno = bseg / segments_per_file;
fileinfo *fi = &io->fis[fno];
off_t base = fno ? 0 : io->base - (uint64_t)segment_size + io->base_seg;
off_t pos = (uint64_t)segment_size * (bseg % segments_per_file) + offset + base;
- if (!grn_opened(fi)) {
+ if (!grn_fileinfo_opened(fi)) {
char path[PATH_MAX];
gen_pathname(io->path, path, fno);
- if ((rc = grn_open(ctx, fi, path, O_RDWR|O_CREAT, GRN_IO_FILE_SIZE))) { return rc; }
+ if ((rc = grn_fileinfo_open(ctx, fi, path, O_RDWR|O_CREAT))) { return rc; }
}
{
grn_io_ja_ehead eh;
@@ -848,148 +955,6 @@ void *
grn_io_win_map(grn_io *io, grn_ctx *ctx, grn_io_win *iw, uint32_t segment,
uint32_t offset, uint32_t size, grn_io_rw_mode mode)
{
- byte *p;
- off_t pos, base;
- int fno;
- uint32_t nseg, bseg;
- uint32_t segment_size = io->header->segment_size;
- uint32_t segments_per_file = GRN_IO_FILE_SIZE / segment_size;
- iw->ctx = ctx;
- iw->diff = 0;
- if (offset >= segment_size) {
- segment += offset / segment_size;
- offset = offset % segment_size;
- }
- nseg = (offset + size + segment_size - 1) / segment_size;
- bseg = segment + io->base_seg;
- fno = bseg / segments_per_file;
- base = fno ? 0 : io->base - (uint64_t)segment_size * io->base_seg;
- pos = (uint64_t)segment_size * (bseg % segments_per_file) + offset + base;
- if (!size || !io || segment + nseg > io->header->max_segment ||
- fno != (bseg + nseg - 1) / segments_per_file) {
- return NULL;
- }
- switch (mode) {
- case grn_io_rdonly:
- {
- fileinfo *fi = &io->fis[fno];
- if (!grn_opened(fi)) {
- char path[PATH_MAX];
- gen_pathname(io->path, path, fno);
- if (grn_open(ctx, fi, path, O_RDWR|O_CREAT, GRN_IO_FILE_SIZE)) {
- return NULL;
- }
- }
- if (!(p = GRN_MALLOC(size))) { return NULL; }
- if (grn_pread(ctx, fi, p, size, pos)) {
- GRN_FREE(p);
- return NULL;
- }
- iw->addr = p;
- }
- break;
- case grn_io_rdwr:
- // if (nseg > 1) { /* auto unmap is not implemented yet */
- if (nseg > 0) {
- fileinfo *fi = &io->fis[fno];
- if (!grn_opened(fi)) {
- char path[PATH_MAX];
- gen_pathname(io->path, path, fno);
- if (grn_open(ctx, fi, path, O_RDWR|O_CREAT, GRN_IO_FILE_SIZE)) {
- return NULL;
- }
- }
- if (!(p = GRN_MMAP(&grn_gctx, &iw->fmo, fi, pos, (uint64_t)segment_size * nseg))) {
- return NULL;
- }
- {
- uint64_t tail = io->base + (uint64_t)segment_size * segment + offset + size;
- if (tail > io->header->curr_size) { io->header->curr_size = tail; }
- }
- } else {
- GRN_LOG(ctx, GRN_LOG_ALERT, "nseg == 0! in grn_io_win_map(%p, %u, %u, %u)", io, segment, offset, size);
- // GRN_IO_SEG_REF(io, segment, p); if (!p) { return NULL; }
- return NULL;
- }
- iw->addr = p + offset;
- break;
- case grn_io_wronly:
- if (!(p = GRN_MALLOC(size))) { return NULL; }
- memset(p, 0, size);
- iw->cached = 0;
- iw->addr = p;
- break;
- default :
- return NULL;
- }
- iw->io = io;
- iw->mode = mode;
- iw->segment = segment;
- iw->offset = offset;
- iw->nseg = nseg;
- iw->size = size;
- iw->pos = pos;
- return iw->addr;
-}
-
-grn_rc
-grn_io_win_unmap(grn_io_win *iw)
-{
- grn_rc rc = GRN_SUCCESS;
- grn_io *io = iw->io;
- grn_ctx *ctx = iw->ctx;
- uint32_t segment_size = io->header->segment_size;
- uint32_t segments_per_file = GRN_IO_FILE_SIZE / segment_size;
- int nseg = iw->nseg;
- switch (iw->mode) {
- case grn_io_rdonly:
- if (iw->addr) { GRN_FREE(iw->addr); }
- iw->addr = NULL;
- break;
- case grn_io_rdwr:
- // if (nseg > 1) { /* auto unmap is not implemented yet */
- if (nseg > 0) {
- GRN_MUNMAP(&grn_gctx, &iw->fmo, ((byte *)iw->addr) - iw->offset, (uint64_t)segment_size * nseg);
- } else {
- if (iw->segment >= io->header->max_segment) {
- rc = GRN_INVALID_ARGUMENT;
- } else {
- //GRN_IO_SEG_UNREF(io, iw->segment);
- }
- }
- iw->addr = NULL;
- break;
- case grn_io_wronly:
- {
- int fno = (iw->segment + io->base_seg) / segments_per_file;
- fileinfo *fi = &io->fis[fno];
- if (!grn_opened(fi)) {
- char path[PATH_MAX];
- gen_pathname(io->path, path, fno);
- rc = grn_open(ctx, fi, path, O_RDWR|O_CREAT, GRN_IO_FILE_SIZE);
- }
- if (!rc) {
- if (!(rc = grn_pwrite(ctx, fi, iw->addr, iw->size, iw->pos))) {
- {
- uint64_t tail = io->base + (uint64_t)segment_size * iw->segment + iw->offset + iw->size;
- if (tail > io->header->curr_size) { io->header->curr_size = tail; }
- }
- if (!iw->cached) { GRN_FREE(iw->addr); }
- iw->addr = NULL;
- }
- }
- }
- break;
- default :
- rc = GRN_INVALID_ARGUMENT;
- }
- return rc;
-}
-
-void *
-grn_io_win_map2(grn_io *io, grn_ctx *ctx, grn_io_win *iw, uint32_t segment,
- uint32_t offset, uint32_t size, grn_io_rw_mode mode)
-{
uint32_t nseg, segment_size = io->header->segment_size;
if (offset >= segment_size) {
segment += offset / segment_size;
@@ -1028,7 +993,7 @@ grn_io_win_map2(grn_io *io, grn_ctx *ctx, grn_io_win *iw, uint32_t segment,
return NULL;
}
s = (offset + r > segment_size) ? segment_size - offset : r;
- memcpy(p, q + offset, s);
+ grn_memcpy(p, q + offset, s);
GRN_IO_SEG_UNREF(io, segment);
}
}
@@ -1043,7 +1008,7 @@ grn_io_win_map2(grn_io *io, grn_ctx *ctx, grn_io_win *iw, uint32_t segment,
}
grn_rc
-grn_io_win_unmap2(grn_io_win *iw)
+grn_io_win_unmap(grn_io_win *iw)
{
if (!iw || !iw->io ||!iw->ctx) { return GRN_INVALID_ARGUMENT; }
if (iw->cached) {
@@ -1068,7 +1033,7 @@ grn_io_win_unmap2(grn_io_win *iw)
GRN_IO_SEG_REF(io, segment, q);
if (!q) { return GRN_NO_MEMORY_AVAILABLE; }
s = (offset + r > segment_size) ? segment_size - offset : r;
- memcpy(q + offset, p, s);
+ grn_memcpy(q + offset, p, s);
GRN_IO_SEG_UNREF(io, segment);
}
}
@@ -1081,7 +1046,7 @@ grn_io_win_unmap2(grn_io_win *iw)
}
#define DO_MAP(io,fmo,fi,pos,size,segno,res) do {\
- if (((res) = GRN_MMAP(&grn_gctx, (fmo), (fi), (pos), (size)))) {\
+ if (((res) = GRN_MMAP(&grn_gctx, (io), (fmo), (fi), (pos), (size)))) {\
uint32_t nmaps;\
if (io->max_map_seg < segno) { io->max_map_seg = segno; }\
GRN_ATOMIC_ADD_EX(&io->nmaps, 1, nmaps);\
@@ -1097,16 +1062,17 @@ grn_io_win_unmap2(grn_io_win *iw)
if ((io->flags & GRN_IO_TEMPORARY)) {\
DO_MAP(io, &info->fmo, NULL, 0, segment_size, segno, info->map);\
} else {\
- uint32_t segments_per_file = GRN_IO_FILE_SIZE / segment_size;\
+ unsigned long file_size = grn_io_compute_file_size(io->header->version);\
+ uint32_t segments_per_file = file_size / segment_size;\
uint32_t bseg = segno + io->base_seg;\
uint32_t fno = bseg / segments_per_file;\
off_t base = fno ? 0 : io->base - (uint64_t)segment_size * io->base_seg;\
off_t pos = (uint64_t)segment_size * (bseg % segments_per_file) + base;\
fileinfo *fi = &io->fis[fno];\
- if (!grn_opened(fi)) {\
+ if (!grn_fileinfo_opened(fi)) {\
char path[PATH_MAX];\
gen_pathname(io->path, path, fno);\
- if (!grn_open(ctx, fi, path, O_RDWR|O_CREAT, GRN_IO_FILE_SIZE)) { \
+ if (!grn_fileinfo_open(ctx, fi, path, O_RDWR|O_CREAT)) { \
DO_MAP(io, &info->fmo, fi, pos, segment_size, segno, info->map);\
}\
} else {\
@@ -1151,7 +1117,9 @@ grn_io_seg_expire(grn_ctx *ctx, grn_io *io, uint32_t segno, uint32_t nretry)
}
} else {
uint32_t nmaps;
- GRN_MUNMAP(&grn_gctx, &info->fmo, info->map, io->header->segment_size);
+ fileinfo *fi = &(io->fis[segno]);
+ GRN_MUNMAP(&grn_gctx, io, &info->fmo, fi,
+ info->map, io->header->segment_size);
info->map = NULL;
GRN_ATOMIC_ADD_EX(pnref, -(GRN_IO_MAX_REF + 1), nref);
GRN_ATOMIC_ADD_EX(&io->nmaps, -1, nmaps);
@@ -1174,20 +1142,27 @@ grn_io_expire(grn_ctx *ctx, grn_io *io, int count_thresh, uint32_t limit)
uint32_t nref, nmaps, *pnref = &io->nref;
GRN_ATOMIC_ADD_EX(pnref, 1, nref);
if (!nref && grn_gtick - io->count > count_thresh) {
- uint32_t i = io->header->n_arrays;
- grn_io_mapinfo *info = io->maps;
- grn_io_array_spec *array_specs = (grn_io_array_spec *)io->user_header;
- while (i--) {
- memset(io->ainfo[i].addrs, 0, sizeof(void *) * array_specs[i].max_n_segments);
+ {
+ uint32_t i = io->header->n_arrays;
+ grn_io_array_spec *array_specs = (grn_io_array_spec *)io->user_header;
+ while (i--) {
+ memset(io->ainfo[i].addrs, 0, sizeof(void *) * array_specs[i].max_n_segments);
+ }
}
- for (m = io->max_map_seg; m; info++, m--) {
- if (info->map) {
- GRN_MUNMAP(&grn_gctx, &info->fmo, info->map, io->header->segment_size);
- info->map = NULL;
- info->nref = 0;
- info->count = grn_gtick;
- GRN_ATOMIC_ADD_EX(&io->nmaps, -1, nmaps);
- n++;
+ {
+ uint32_t fno;
+ for (fno = 0; fno < io->max_map_seg; fno++) {
+ grn_io_mapinfo *info = &(io->maps[fno]);
+ if (info->map) {
+ fileinfo *fi = &(io->fis[fno]);
+ GRN_MUNMAP(&grn_gctx, io, &info->fmo, fi,
+ info->map, io->header->segment_size);
+ info->map = NULL;
+ info->nref = 0;
+ info->count = grn_gtick;
+ GRN_ATOMIC_ADD_EX(&io->nmaps, -1, nmaps);
+ n++;
+ }
}
}
}
@@ -1207,7 +1182,8 @@ grn_io_expire(grn_ctx *ctx, grn_io *io, int count_thresh, uint32_t limit)
uint32_t nmaps, nref, *pnref = &info->nref;
GRN_ATOMIC_ADD_EX(pnref, 1, nref);
if (!nref && info->map && (grn_gtick - info->count) > count_thresh) {
- GRN_MUNMAP(&grn_gctx, &info->fmo, info->map, io->header->segment_size);
+ GRN_MUNMAP(&grn_gctx, io, &info->fmo, NULL,
+ info->map, io->header->segment_size);
GRN_ATOMIC_ADD_EX(&io->nmaps, -1, nmaps);
info->map = NULL;
info->count = grn_gtick;
@@ -1265,17 +1241,13 @@ grn_expire(grn_ctx *ctx, int count_thresh, uint32_t limit)
void *
grn_io_anon_map(grn_ctx *ctx, grn_io_mapinfo *mi, size_t length)
{
- return (mi->map = GRN_MMAP(ctx, &mi->fmo, NULL, 0, length));
+ return (mi->map = GRN_MMAP(ctx, NULL, &mi->fmo, NULL, 0, length));
}
void
grn_io_anon_unmap(grn_ctx *ctx, grn_io_mapinfo *mi, size_t length)
{
- /* support WIN32 */
-#ifdef WIN32
- return GRN_FREE(mi->map);
-#endif
- GRN_MUNMAP(ctx, &mi->fmo, mi->map, length);
+ GRN_MUNMAP(ctx, NULL, &mi->fmo, NULL, mi->map, length);
}
grn_rc
@@ -1345,59 +1317,25 @@ static size_t mmap_size = 0;
#ifdef WIN32
-#ifdef WIN32_FMO_EACH
-
inline static grn_rc
-grn_open(grn_ctx *ctx, fileinfo *fi, const char *path, int flags, size_t maxsize)
+grn_fileinfo_open_v1(grn_ctx *ctx, fileinfo *fi, const char *path, int flags)
{
- if ((flags & O_CREAT)) {
- DWORD dwCreationDisposition;
- if (flags & O_EXCL) {
- dwCreationDisposition = CREATE_NEW;
- } else {
- dwCreationDisposition = OPEN_ALWAYS;
- }
- fi->fh = CreateFile(path, GENERIC_READ | GENERIC_WRITE,
- FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
- dwCreationDisposition, FILE_ATTRIBUTE_NORMAL, 0);
- if (fi->fh == INVALID_HANDLE_VALUE) {
- SERR("CreateFile");
- return ctx->rc;
- }
- goto exit;
- }
- if ((flags & O_TRUNC)) {
- CloseHandle(fi->fh);
- fi->fh = CreateFile(path, GENERIC_READ | GENERIC_WRITE,
- FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
- TRUNCATE_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
- if (fi->fh == INVALID_HANDLE_VALUE) {
- SERR("CreateFile");
- return ctx->rc;
- }
- goto exit;
- }
- /* O_RDWR only */
- fi->fh = CreateFile(path, GENERIC_READ | GENERIC_WRITE,
- FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
- OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
- if (fi->fh == INVALID_HANDLE_VALUE) {
- SERR("CreateFile");
- return ctx->rc;
- }
-exit:
CRITICAL_SECTION_INIT(fi->cs);
return GRN_SUCCESS;
}
inline static void *
-grn_mmap(grn_ctx *ctx, HANDLE *fmo, fileinfo *fi, off_t offset, size_t length)
+grn_mmap_v1(grn_ctx *ctx, HANDLE *fmo, fileinfo *fi, off_t offset, size_t length)
{
void *res;
if (!fi) {
- if(fmo) {
- *fmo = (HANDLE)0;
+ if (fmo) {
+ *fmo = NULL;
}
+ /* TODO: Try to support VirtualAlloc() as anonymous mmap in POSIX.
+ * If VirtualAlloc() provides better performance rather than malloc(),
+ * we'll use it.
+ */
return GRN_GCALLOC(length);
}
/* CRITICAL_SECTION_ENTER(fi->cs); */
@@ -1406,7 +1344,10 @@ grn_mmap(grn_ctx *ctx, HANDLE *fmo, fileinfo *fi, off_t offset, size_t length)
if (!*fmo) { return NULL; }
res = MapViewOfFile(*fmo, FILE_MAP_WRITE, 0, (DWORD)offset, (SIZE_T)length);
if (!res) {
- MERR("MapViewOfFile failed #%d <%zu>", GetLastError(), mmap_size);
+ SERR("MapViewOfFile");
+ GRN_LOG(ctx, GRN_LOG_ERROR,
+ "MapViewOfFile(%lu,%" GRN_FMT_SIZE ") failed <%" GRN_FMT_SIZE ">",
+ (DWORD)offset, length, mmap_size);
return NULL;
}
/* CRITICAL_SECTION_LEAVE(fi->cs); */
@@ -1415,87 +1356,48 @@ grn_mmap(grn_ctx *ctx, HANDLE *fmo, fileinfo *fi, off_t offset, size_t length)
}
inline static int
-grn_munmap(grn_ctx *ctx, HANDLE *fmo, void *start, size_t length)
+grn_munmap_v1(grn_ctx *ctx, HANDLE *fmo, fileinfo *fi,
+ void *start, size_t length)
{
int r = 0;
+
+ if (!fi) {
+ GRN_GFREE(start);
+ return r;
+ }
+
if (!fmo) {
- GRN_FREE(start);
+ GRN_GFREE(start);
+ return r;
}
+
if (*fmo) {
if (UnmapViewOfFile(start)) {
mmap_size -= length;
} else {
SERR("UnmapViewOfFile");
- GRN_LOG(ctx, GRN_LOG_ERROR, "UnmapViewOfFile(%p,%d) failed <%zu>", start, length, mmap_size);
+ GRN_LOG(ctx, GRN_LOG_ERROR,
+ "UnmapViewOfFile(%p,%" GRN_FMT_SIZE ") failed <%" GRN_FMT_SIZE ">",
+ start, length, mmap_size);
r = -1;
}
if (!CloseHandle(*fmo)) {
SERR("CloseHandle");
- GRN_LOG(ctx, GRN_LOG_ERROR, "CloseHandle(%p,%d) failed <%zu>", start, length, mmap_size);
+ GRN_LOG(ctx, GRN_LOG_ERROR,
+ "CloseHandle(%p,%" GRN_FMT_SIZE ") failed <%" GRN_FMT_SIZE ">",
+ start, length, mmap_size);
}
*fmo = NULL;
} else {
- GRN_FREE(start);
+ GRN_GFREE(start);
}
- return r;
-}
-inline static grn_rc
-grn_close(grn_ctx *ctx, fileinfo *fi)
-{
- if (fi->fmo != NULL) {
- GRN_LOG(ctx, GRN_LOG_ALERT, "file mapping object exists");
- }
- if (fi->fh != INVALID_HANDLE_VALUE) {
- CloseHandle(fi->fh);
- CRITICAL_SECTION_FIN(fi->cs);
- fi->fh = INVALID_HANDLE_VALUE;
- }
- return GRN_SUCCESS;
+ return r;
}
-#else /* WIN32_FMO_EACH */
inline static grn_rc
-grn_open(grn_ctx *ctx, fileinfo *fi, const char *path, int flags, size_t maxsize)
+grn_fileinfo_open_v0(grn_ctx *ctx, fileinfo *fi, const char *path, int flags)
{
- /* may be wrong if flags is just only O_RDWR */
- if ((flags & O_CREAT)) {
- DWORD dwCreationDisposition;
- if (flags & O_EXCL) {
- dwCreationDisposition = CREATE_NEW;
- } else {
- dwCreationDisposition = OPEN_ALWAYS;
- }
- fi->fh = CreateFile(path, GENERIC_READ | GENERIC_WRITE,
- FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
- dwCreationDisposition, FILE_ATTRIBUTE_NORMAL, 0);
- if (fi->fh == INVALID_HANDLE_VALUE) {
- SERR("CreateFile");
- return ctx->rc;
- }
- goto exit;
- }
- if ((flags & O_TRUNC)) {
- CloseHandle(fi->fh);
- /* unable to assign OPEN_ALWAYS and TRUNCATE_EXISTING at once */
- fi->fh = CreateFile(path, GENERIC_READ | GENERIC_WRITE,
- FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
- TRUNCATE_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
- if (fi->fh == INVALID_HANDLE_VALUE) {
- SERR("CreateFile");
- return ctx->rc;
- }
- goto exit;
- }
- /* O_RDWR only */
- fi->fh = CreateFile(path, GENERIC_READ | GENERIC_WRITE,
- FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
- OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
- if (fi->fh == INVALID_HANDLE_VALUE) {
- SERR("CreateFile");
- return ctx->rc;
- }
-exit:
/* signature may be wrong.. */
fi->fmo = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, NULL);
/* open failed */
@@ -1506,20 +1408,21 @@ exit:
/* failed again */
if (fi->fmo == NULL) {
/* try to create fmo */
- fi->fmo = CreateFileMapping(fi->fh, NULL, PAGE_READWRITE, 0, GRN_IO_FILE_SIZE, NULL);
+ fi->fmo = CreateFileMapping(fi->fh, NULL, PAGE_READWRITE, 0, GRN_IO_FILE_SIZE_V0, NULL);
}
// funlock
}
if (fi->fmo != NULL) {
- if (GetLastError() != ERROR_ALREADY_EXISTS ) {
+ if (GetLastError() != ERROR_ALREADY_EXISTS) {
CRITICAL_SECTION_INIT(fi->cs);
return GRN_SUCCESS;
} else {
- GRN_LOG(ctx, GRN_LOG_ERROR, "fmo object already exists! handle=%d", fi->fh);
+ GRN_LOG(ctx, GRN_LOG_ERROR, "fmo object already exists! handle=%p", fi->fh);
CloseHandle(fi->fmo);
}
} else {
- GRN_LOG(ctx, GRN_LOG_ALERT, "failed to get FileMappingObject #%d", GetLastError());
+ GRN_LOG(ctx, GRN_LOG_ALERT,
+ "failed to get FileMappingObject #%lu", GetLastError());
}
CloseHandle(fi->fh);
SERR("OpenFileMapping");
@@ -1527,11 +1430,11 @@ exit:
}
inline static void *
-grn_mmap(grn_ctx *ctx, fileinfo *fi, off_t offset, size_t length)
+grn_mmap_v0(grn_ctx *ctx, fileinfo *fi, off_t offset, size_t length)
{
void *res;
if (!fi) { return GRN_GCALLOC(length); }
- /* file must be exceeded to GRN_IO_FILE_SIZE when FileMappingObject created.
+ /* file must be exceeded to GRN_IO_FILE_SIZE_V0 when FileMappingObject created.
and, after fmo created, it's not allowed to expand the size of file.
DWORD tail = (DWORD)(offset + length);
DWORD filesize = GetFileSize(fi->fh, NULL);
@@ -1549,7 +1452,8 @@ grn_mmap(grn_ctx *ctx, fileinfo *fi, off_t offset, size_t length)
*/
res = MapViewOfFile(fi->fmo, FILE_MAP_WRITE, 0, (DWORD)offset, (SIZE_T)length);
if (!res) {
- MERR("MapViewOfFile failed #%d <%zu>", GetLastError(), mmap_size);
+ MERR("MapViewOfFile failed: <%" GRN_FMT_SIZE ">: %s",
+ mmap_size, grn_current_error_message());
return NULL;
}
mmap_size += length;
@@ -1557,20 +1461,150 @@ grn_mmap(grn_ctx *ctx, fileinfo *fi, off_t offset, size_t length)
}
inline static int
-grn_munmap(grn_ctx *ctx, void *start, size_t length)
+grn_munmap_v0(grn_ctx *ctx, fileinfo *fi, void *start, size_t length)
{
+ if (!fi) {
+ GRN_GFREE(start);
+ return 0;
+ }
+
if (UnmapViewOfFile(start)) {
mmap_size -= length;
return 0;
} else {
SERR("UnmapViewOfFile");
- GRN_LOG(ctx, GRN_LOG_ERROR, "UnmapViewOfFile(%p,%d) failed <%zu>", start, length, mmap_size);
+ GRN_LOG(ctx, GRN_LOG_ERROR,
+ "UnmapViewOfFile(%p,%" GRN_FMT_SIZE ") failed <%" GRN_FMT_SIZE ">",
+ start, length, mmap_size);
return -1;
}
}
inline static grn_rc
-grn_close(grn_ctx *ctx, fileinfo *fi)
+grn_fileinfo_open_common(grn_ctx *ctx, fileinfo *fi, const char *path, int flags)
+{
+ /* may be wrong if flags is just only O_RDWR */
+ if ((flags & O_CREAT)) {
+ DWORD dwCreationDisposition;
+ if (flags & O_EXCL) {
+ dwCreationDisposition = CREATE_NEW;
+ } else {
+ dwCreationDisposition = OPEN_ALWAYS;
+ }
+ fi->fh = CreateFile(path, GRN_IO_FILE_CREATE_MODE,
+ FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
+ dwCreationDisposition, FILE_ATTRIBUTE_NORMAL, 0);
+ if (fi->fh == INVALID_HANDLE_VALUE) {
+ SERR("CreateFile");
+ goto exit;
+ }
+ goto exit;
+ }
+ if ((flags & O_TRUNC)) {
+ CloseHandle(fi->fh);
+ /* unable to assign OPEN_ALWAYS and TRUNCATE_EXISTING at once */
+ fi->fh = CreateFile(path, GRN_IO_FILE_CREATE_MODE,
+ FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
+ TRUNCATE_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
+ if (fi->fh == INVALID_HANDLE_VALUE) {
+ SERR("CreateFile");
+ goto exit;
+ }
+ goto exit;
+ }
+ /* O_RDWR only */
+ fi->fh = CreateFile(path, GRN_IO_FILE_CREATE_MODE,
+ FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
+ OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
+ if (fi->fh == INVALID_HANDLE_VALUE) {
+ SERR("CreateFile");
+ goto exit;
+ }
+
+exit :
+ return ctx->rc;
+}
+
+inline static grn_rc
+grn_fileinfo_open(grn_ctx *ctx, fileinfo *fi, const char *path, int flags)
+{
+ grn_rc rc;
+ struct _grn_io_header io_header;
+ DWORD header_size;
+ DWORD read_bytes;
+ int version = grn_io_version_default;
+
+ rc = grn_fileinfo_open_common(ctx, fi, path, flags);
+ if (rc != GRN_SUCCESS) {
+ return rc;
+ }
+
+ if (!(flags & O_CREAT)) {
+ header_size = sizeof(struct _grn_io_header);
+ ReadFile(fi->fh, &io_header, header_size, &read_bytes, NULL);
+ if (read_bytes == header_size) {
+ version = io_header.version;
+ }
+ SetFilePointer(fi->fh, 0, NULL, FILE_BEGIN);
+ }
+
+ if (version == 0) {
+ return grn_fileinfo_open_v0(ctx, fi, path, flags);
+ } else {
+ return grn_fileinfo_open_v1(ctx, fi, path, flags);
+ }
+}
+
+inline static int
+grn_guess_io_version(grn_ctx *ctx, grn_io *io, fileinfo *fi)
+{
+ if (io) {
+ return io->header->version;
+ }
+
+ if (fi) {
+ if (fi->fmo) {
+ return 0;
+ } else {
+ return 1;
+ }
+ }
+
+ return grn_io_version_default;
+}
+
+inline static void *
+grn_mmap(grn_ctx *ctx, grn_io *io, HANDLE *fmo,
+ fileinfo *fi, off_t offset, size_t length)
+{
+ int version;
+
+ version = grn_guess_io_version(ctx, io, fi);
+
+ if (version == 0) {
+ return grn_mmap_v0(ctx, fi, offset, length);
+ } else {
+ return grn_mmap_v1(ctx, fmo, fi, offset, length);
+ }
+}
+
+inline static int
+grn_munmap(grn_ctx *ctx, grn_io *io,
+ HANDLE *fmo, fileinfo *fi, void *start, size_t length)
+{
+ int version;
+
+ version = grn_guess_io_version(ctx, io, fi);
+
+ if (version == 0) {
+ return grn_munmap_v0(ctx, fi, start, length);
+ } else {
+ return grn_munmap_v1(ctx, fmo, fi, start, length);
+ }
+}
+
+inline static grn_rc
+grn_fileinfo_close(grn_ctx *ctx, fileinfo *fi)
{
if (fi->fmo != NULL) {
CloseHandle(fi->fmo);
@@ -1583,7 +1617,6 @@ grn_close(grn_ctx *ctx, fileinfo *fi)
}
return GRN_SUCCESS;
}
-#endif /* WIN32_FMO_EACH */
inline static void
grn_fileinfo_init(fileinfo *fis, int nfis)
@@ -1595,7 +1628,7 @@ grn_fileinfo_init(fileinfo *fis, int nfis)
}
inline static int
-grn_opened(fileinfo *fi)
+grn_fileinfo_opened(fileinfo *fi)
{
return fi->fh != INVALID_HANDLE_VALUE;
}
@@ -1620,7 +1653,9 @@ grn_pread(grn_ctx *ctx, fileinfo *fi, void *buf, size_t count, off_t offset)
SERR("ReadFile");
} else if (len != count) {
/* todo : should retry ? */
- ERR(GRN_INPUT_OUTPUT_ERROR, "ReadFile %d != %d", count, len);
+ ERR(GRN_INPUT_OUTPUT_ERROR,
+ "ReadFile %" GRN_FMT_SIZE " != %lu",
+ count, len);
}
}
CRITICAL_SECTION_LEAVE(fi->cs);
@@ -1640,7 +1675,9 @@ grn_pwrite(grn_ctx *ctx, fileinfo *fi, void *buf, size_t count, off_t offset)
SERR("WriteFile");
} else if (len != count) {
/* todo : should retry ? */
- ERR(GRN_INPUT_OUTPUT_ERROR, "WriteFile %d != %d", count, len);
+ ERR(GRN_INPUT_OUTPUT_ERROR,
+ "WriteFile %" GRN_FMT_SIZE " != %lu",
+ count, len);
}
}
CRITICAL_SECTION_LEAVE(fi->cs);
@@ -1650,15 +1687,16 @@ grn_pwrite(grn_ctx *ctx, fileinfo *fi, void *buf, size_t count, off_t offset)
#else /* WIN32 */
inline static grn_rc
-grn_open(grn_ctx *ctx, fileinfo *fi, const char *path, int flags, size_t maxsize)
+grn_fileinfo_open(grn_ctx *ctx, fileinfo *fi, const char *path, int flags)
{
struct stat st;
- if ((fi->fd = GRN_OPEN(path, flags, 0666)) == -1) {
- SERR(path);
+ grn_open(fi->fd, path, flags);
+ if (fi->fd == -1) {
+ ERRNO_ERR(path);
return ctx->rc;
}
if (fstat(fi->fd, &st) == -1) {
- SERR(path);
+ ERRNO_ERR(path);
return ctx->rc;
}
fi->dev = st.st_dev;
@@ -1673,16 +1711,16 @@ grn_fileinfo_init(fileinfo *fis, int nfis)
}
inline static int
-grn_opened(fileinfo *fi)
+grn_fileinfo_opened(fileinfo *fi)
{
return fi->fd != -1;
}
inline static grn_rc
-grn_close(grn_ctx *ctx, fileinfo *fi)
+grn_fileinfo_close(grn_ctx *ctx, fileinfo *fi)
{
if (fi->fd != -1) {
- if (GRN_CLOSE(fi->fd) == -1) {
+ if (grn_close(fi->fd) == -1) {
SERR("close");
return ctx->rc;
}
@@ -1698,7 +1736,7 @@ grn_close(grn_ctx *ctx, fileinfo *fi)
#include <sys/mman.h>
inline static void *
-grn_mmap(grn_ctx *ctx, fileinfo *fi, off_t offset, size_t length)
+grn_mmap(grn_ctx *ctx, grn_io *io, fileinfo *fi, off_t offset, size_t length)
{
void *res;
int fd, flags;
@@ -1728,14 +1766,22 @@ grn_mmap(grn_ctx *ctx, fileinfo *fi, off_t offset, size_t length)
#ifdef USE_FAIL_MALLOC
inline static void *
-grn_fail_mmap(grn_ctx *ctx, fileinfo *fi, off_t offset, size_t length,
+grn_fail_mmap(grn_ctx *ctx, grn_io *io, fileinfo *fi,
+ off_t offset, size_t length,
const char* file, int line, const char *func)
{
if (grn_fail_malloc_check(length, file, line, func)) {
- return grn_mmap(ctx, fi, offset, length);
+ return grn_mmap(ctx, io, fi, offset, length);
} else {
- MERR("fail_mmap(%zu,%d,%" GRN_FMT_LLU ") (%s:%d@%s) <%zu>",
- length, fi ? fi->fd : 0, offset, file, line, func, mmap_size);
+ MERR("fail_mmap(%" GRN_FMT_SIZE ",%d,%" GRN_FMT_LLU ") "
+ "(%s:%d@%s) <%" GRN_FMT_SIZE ">",
+ length,
+ fi ? fi->fd : 0,
+ (long long unsigned int)offset,
+ file,
+ line,
+ func,
+ mmap_size);
return NULL;
}
}
@@ -1750,7 +1796,7 @@ grn_msync(grn_ctx *ctx, void *start, size_t length)
}
inline static int
-grn_munmap(grn_ctx *ctx, void *start, size_t length)
+grn_munmap(grn_ctx *ctx, grn_io *io, fileinfo *fi, void *start, size_t length)
{
int res;
res = munmap(start, length);
diff --git a/storage/mroonga/vendor/groonga/lib/logger.c b/storage/mroonga/vendor/groonga/lib/logger.c
new file mode 100644
index 00000000000..fc9fe71767e
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/logger.c
@@ -0,0 +1,584 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2009-2015 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
+*/
+
+#include "grn_logger.h"
+#include "grn_ctx.h"
+#include "grn_ctx_impl.h"
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/stat.h>
+
+#ifdef WIN32
+# include <share.h>
+#endif /* WIN32 */
+
+#ifdef WIN32
+# define fileno(file) _fileno(file)
+#endif
+
+static void
+rotate_log_file(grn_ctx *ctx, const char *current_path)
+{
+ char rotated_path[PATH_MAX];
+ grn_timeval now;
+ struct tm tm_buffer;
+ struct tm *tm;
+
+ grn_timeval_now(ctx, &now);
+ tm = grn_timeval2tm(ctx, &now, &tm_buffer);
+ grn_snprintf(rotated_path, PATH_MAX, PATH_MAX,
+ "%s.%04d-%02d-%02d-%02d-%02d-%02d-%06d",
+ current_path,
+ tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
+ tm->tm_hour, tm->tm_min, tm->tm_sec,
+ (int)(GRN_TIME_NSEC_TO_USEC(now.tv_nsec)));
+ rename(current_path, rotated_path);
+}
+
+static char *default_logger_path = NULL;
+static FILE *default_logger_file = NULL;
+static grn_critical_section default_logger_lock;
+static off_t default_logger_size = 0;
+static off_t default_logger_rotate_threshold_size = 0;
+
+#define LOGGER_NEED_ROTATE(size, threshold) \
+ ((threshold) > 0 && (size) >= (threshold))
+
+static void
+default_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 slev[] = " EACewnid-";
+ if (default_logger_path) {
+ CRITICAL_SECTION_ENTER(default_logger_lock);
+ if (!default_logger_file) {
+ default_logger_file = grn_fopen(default_logger_path, "a");
+ default_logger_size = 0;
+ if (default_logger_file) {
+ struct stat stat;
+ if (fstat(fileno(default_logger_file), &stat) != -1) {
+ default_logger_size = stat.st_size;
+ }
+ }
+ }
+ if (default_logger_file) {
+ int written;
+ if (location && *location) {
+ written = fprintf(default_logger_file, "%s|%c|%s %s %s\n",
+ timestamp, *(slev + level), title, message, location);
+ } else {
+ written = fprintf(default_logger_file, "%s|%c|%s %s\n", timestamp,
+ *(slev + level), title, message);
+ }
+ if (written > 0) {
+ default_logger_size += written;
+ if (LOGGER_NEED_ROTATE(default_logger_size,
+ default_logger_rotate_threshold_size)) {
+ fclose(default_logger_file);
+ default_logger_file = NULL;
+ rotate_log_file(ctx, default_logger_path);
+ } else {
+ fflush(default_logger_file);
+ }
+ }
+ }
+ CRITICAL_SECTION_LEAVE(default_logger_lock);
+ }
+}
+
+static void
+default_logger_reopen(grn_ctx *ctx, void *user_data)
+{
+ GRN_LOG(ctx, GRN_LOG_NOTICE, "log will be closed.");
+ CRITICAL_SECTION_ENTER(default_logger_lock);
+ if (default_logger_file) {
+ fclose(default_logger_file);
+ default_logger_file = NULL;
+ }
+ CRITICAL_SECTION_LEAVE(default_logger_lock);
+ GRN_LOG(ctx, GRN_LOG_NOTICE, "log opened.");
+}
+
+static void
+default_logger_fin(grn_ctx *ctx, void *user_data)
+{
+ CRITICAL_SECTION_ENTER(default_logger_lock);
+ if (default_logger_file) {
+ fclose(default_logger_file);
+ default_logger_file = NULL;
+ }
+ CRITICAL_SECTION_LEAVE(default_logger_lock);
+}
+
+static grn_logger default_logger = {
+ GRN_LOG_DEFAULT_LEVEL,
+ GRN_LOG_TIME|GRN_LOG_MESSAGE,
+ NULL,
+ default_logger_log,
+ default_logger_reopen,
+ default_logger_fin
+};
+
+static grn_logger current_logger = {
+ GRN_LOG_DEFAULT_LEVEL,
+ GRN_LOG_TIME|GRN_LOG_MESSAGE,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+};
+
+void
+grn_default_logger_set_max_level(grn_log_level max_level)
+{
+ default_logger.max_level = max_level;
+ if (current_logger.log == default_logger_log) {
+ current_logger.max_level = max_level;
+ }
+}
+
+grn_log_level
+grn_default_logger_get_max_level(void)
+{
+ return default_logger.max_level;
+}
+
+void
+grn_default_logger_set_path(const char *path)
+{
+ if (default_logger_path) {
+ free(default_logger_path);
+ }
+
+ if (path) {
+ default_logger_path = grn_strdup_raw(path);
+ } else {
+ default_logger_path = NULL;
+ }
+}
+
+const char *
+grn_default_logger_get_path(void)
+{
+ return default_logger_path;
+}
+
+void
+grn_default_logger_set_rotate_threshold_size(off_t threshold)
+{
+ default_logger_rotate_threshold_size = threshold;
+}
+
+off_t
+grn_default_logger_get_rotate_threshold_size(void)
+{
+ return default_logger_rotate_threshold_size;
+}
+
+void
+grn_logger_reopen(grn_ctx *ctx)
+{
+ if (current_logger.reopen) {
+ current_logger.reopen(ctx, current_logger.user_data);
+ }
+}
+
+static void
+current_logger_fin(grn_ctx *ctx)
+{
+ if (current_logger.fin) {
+ current_logger.fin(ctx, current_logger.user_data);
+ }
+}
+
+static void
+logger_info_func_wrapper(grn_ctx *ctx, grn_log_level level,
+ const char *timestamp, const char *title,
+ const char *message, const char *location,
+ void *user_data)
+{
+ grn_logger_info *info = user_data;
+ info->func(level, timestamp, title, message, location, info->func_arg);
+}
+
+/* Deprecated since 2.1.2. */
+grn_rc
+grn_logger_info_set(grn_ctx *ctx, const grn_logger_info *info)
+{
+ if (info) {
+ grn_logger logger;
+
+ memset(&logger, 0, sizeof(grn_logger));
+ logger.max_level = info->max_level;
+ logger.flags = info->flags;
+ if (info->func) {
+ logger.log = logger_info_func_wrapper;
+ logger.user_data = (grn_logger_info *)info;
+ } else {
+ logger.log = default_logger_log;
+ logger.reopen = default_logger_reopen;
+ logger.fin = default_logger_fin;
+ }
+ return grn_logger_set(ctx, &logger);
+ } else {
+ return grn_logger_set(ctx, NULL);
+ }
+}
+
+grn_rc
+grn_logger_set(grn_ctx *ctx, const grn_logger *logger)
+{
+ current_logger_fin(ctx);
+ if (logger) {
+ current_logger = *logger;
+ } else {
+ current_logger = default_logger;
+ }
+ return GRN_SUCCESS;
+}
+
+void
+grn_logger_set_max_level(grn_ctx *ctx, grn_log_level max_level)
+{
+ current_logger.max_level = max_level;
+}
+
+grn_log_level
+grn_logger_get_max_level(grn_ctx *ctx)
+{
+ return current_logger.max_level;
+}
+
+grn_bool
+grn_logger_pass(grn_ctx *ctx, grn_log_level level)
+{
+ return level <= current_logger.max_level;
+}
+
+#define TBUFSIZE GRN_TIMEVAL_STR_SIZE
+#define MBUFSIZE 0x1000
+#define LBUFSIZE 0x400
+
+void
+grn_logger_put(grn_ctx *ctx, grn_log_level level,
+ const char *file, int line, const char *func, const char *fmt, ...)
+{
+ if (level <= current_logger.max_level && current_logger.log) {
+ char tbuf[TBUFSIZE];
+ char mbuf[MBUFSIZE];
+ char lbuf[LBUFSIZE];
+ tbuf[0] = '\0';
+ if (current_logger.flags & GRN_LOG_TIME) {
+ grn_timeval tv;
+ grn_timeval_now(ctx, &tv);
+ grn_timeval2str(ctx, &tv, tbuf, TBUFSIZE);
+ }
+ if (current_logger.flags & GRN_LOG_MESSAGE) {
+ va_list argp;
+ va_start(argp, fmt);
+ vsnprintf(mbuf, MBUFSIZE - 1, fmt, argp);
+ va_end(argp);
+ mbuf[MBUFSIZE - 1] = '\0';
+ } else {
+ mbuf[0] = '\0';
+ }
+ if (current_logger.flags & GRN_LOG_LOCATION) {
+ grn_snprintf(lbuf, LBUFSIZE, LBUFSIZE,
+ "%d %s:%d %s()", getpid(), file, line, func);
+ lbuf[LBUFSIZE - 1] = '\0';
+ } else {
+ lbuf[0] = '\0';
+ }
+ current_logger.log(ctx, level, tbuf, "", mbuf, lbuf,
+ current_logger.user_data);
+ }
+}
+
+void
+grn_logger_init(void)
+{
+ if (!default_logger_path) {
+ default_logger_path = grn_strdup_raw(GRN_LOG_PATH);
+ }
+ grn_memcpy(&current_logger, &default_logger, sizeof(grn_logger));
+ CRITICAL_SECTION_INIT(default_logger_lock);
+}
+
+void
+grn_logger_fin(grn_ctx *ctx)
+{
+ current_logger_fin(ctx);
+ if (default_logger_path) {
+ free(default_logger_path);
+ default_logger_path = NULL;
+ }
+ CRITICAL_SECTION_FIN(default_logger_lock);
+}
+
+
+static char *default_query_logger_path = NULL;
+static FILE *default_query_logger_file = NULL;
+static grn_critical_section default_query_logger_lock;
+static off_t default_query_logger_size = 0;
+static off_t default_query_logger_rotate_threshold_size = 0;
+
+static void
+default_query_logger_log(grn_ctx *ctx, unsigned int flag,
+ const char *timestamp, const char *info,
+ const char *message, void *user_data)
+{
+ if (default_query_logger_path) {
+ CRITICAL_SECTION_ENTER(default_query_logger_lock);
+ if (!default_query_logger_file) {
+ default_query_logger_file = grn_fopen(default_query_logger_path, "a");
+ default_query_logger_size = 0;
+ if (default_query_logger_file) {
+ struct stat stat;
+ if (fstat(fileno(default_query_logger_file), &stat) != -1) {
+ default_query_logger_size = stat.st_size;
+ }
+ }
+ }
+ if (default_query_logger_file) {
+ int written;
+ written = fprintf(default_query_logger_file, "%s|%s%s\n",
+ timestamp, info, message);
+ if (written > 0) {
+ default_query_logger_size += written;
+ if (LOGGER_NEED_ROTATE(default_query_logger_size,
+ default_query_logger_rotate_threshold_size)) {
+ fclose(default_query_logger_file);
+ default_query_logger_file = NULL;
+ rotate_log_file(ctx, default_query_logger_path);
+ } else {
+ fflush(default_query_logger_file);
+ }
+ }
+ }
+ CRITICAL_SECTION_LEAVE(default_query_logger_lock);
+ }
+}
+
+static void
+default_query_logger_close(grn_ctx *ctx, void *user_data)
+{
+ GRN_QUERY_LOG(ctx, GRN_QUERY_LOG_DESTINATION, " ",
+ "query log will be closed: <%s>", default_query_logger_path);
+ CRITICAL_SECTION_ENTER(default_query_logger_lock);
+ if (default_query_logger_file) {
+ fclose(default_query_logger_file);
+ default_query_logger_file = NULL;
+ }
+ CRITICAL_SECTION_LEAVE(default_query_logger_lock);
+}
+
+static void
+default_query_logger_reopen(grn_ctx *ctx, void *user_data)
+{
+ default_query_logger_close(ctx, user_data);
+ if (default_query_logger_path) {
+ GRN_QUERY_LOG(ctx, GRN_QUERY_LOG_DESTINATION, " ",
+ "query log is opened: <%s>", default_query_logger_path);
+ }
+}
+
+static void
+default_query_logger_fin(grn_ctx *ctx, void *user_data)
+{
+ if (default_query_logger_file) {
+ default_query_logger_close(ctx, user_data);
+ }
+}
+
+static grn_query_logger default_query_logger = {
+ GRN_QUERY_LOG_DEFAULT,
+ NULL,
+ default_query_logger_log,
+ default_query_logger_reopen,
+ default_query_logger_fin
+};
+
+static grn_query_logger current_query_logger = {
+ GRN_QUERY_LOG_DEFAULT,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+};
+
+void
+grn_default_query_logger_set_flags(unsigned int flags)
+{
+ default_query_logger.flags = flags;
+ if (current_query_logger.log == default_query_logger_log) {
+ current_query_logger.flags = flags;
+ }
+}
+
+unsigned int
+grn_default_query_logger_get_flags(void)
+{
+ return default_query_logger.flags;
+}
+
+void
+grn_default_query_logger_set_path(const char *path)
+{
+ if (default_query_logger_path) {
+ free(default_query_logger_path);
+ }
+
+ if (path) {
+ default_query_logger_path = grn_strdup_raw(path);
+ } else {
+ default_query_logger_path = NULL;
+ }
+}
+
+const char *
+grn_default_query_logger_get_path(void)
+{
+ return default_query_logger_path;
+}
+
+void
+grn_default_query_logger_set_rotate_threshold_size(off_t threshold)
+{
+ default_query_logger_rotate_threshold_size = threshold;
+}
+
+off_t
+grn_default_query_logger_get_rotate_threshold_size(void)
+{
+ return default_query_logger_rotate_threshold_size;
+}
+
+void
+grn_query_logger_reopen(grn_ctx *ctx)
+{
+ if (current_query_logger.reopen) {
+ current_query_logger.reopen(ctx, current_query_logger.user_data);
+ }
+}
+
+static void
+current_query_logger_fin(grn_ctx *ctx)
+{
+ if (current_query_logger.fin) {
+ current_query_logger.fin(ctx, current_query_logger.user_data);
+ }
+}
+
+grn_rc
+grn_query_logger_set(grn_ctx *ctx, const grn_query_logger *logger)
+{
+ current_query_logger_fin(ctx);
+ if (logger) {
+ current_query_logger = *logger;
+ } else {
+ current_query_logger = default_query_logger;
+ }
+ return GRN_SUCCESS;
+}
+
+grn_bool
+grn_query_logger_pass(grn_ctx *ctx, unsigned int flag)
+{
+ return current_query_logger.flags & flag;
+}
+
+#define TIMESTAMP_BUFFER_SIZE TBUFSIZE
+/* 8+a(%p) + 1(|) + 1(mark) + 15(elapsed time) = 25+a */
+#define INFO_BUFFER_SIZE 40
+
+void
+grn_query_logger_put(grn_ctx *ctx, unsigned int flag, const char *mark,
+ const char *format, ...)
+{
+ char timestamp[TIMESTAMP_BUFFER_SIZE];
+ char info[INFO_BUFFER_SIZE];
+ grn_obj *message = &ctx->impl->query_log_buf;
+
+ if (!current_query_logger.log) {
+ return;
+ }
+
+ {
+ grn_timeval tv;
+ timestamp[0] = '\0';
+ grn_timeval_now(ctx, &tv);
+ grn_timeval2str(ctx, &tv, timestamp, TIMESTAMP_BUFFER_SIZE);
+ }
+
+ if (flag & (GRN_QUERY_LOG_COMMAND | GRN_QUERY_LOG_DESTINATION)) {
+ grn_snprintf(info, INFO_BUFFER_SIZE, INFO_BUFFER_SIZE,
+ "%p|%s", ctx, mark);
+ info[INFO_BUFFER_SIZE - 1] = '\0';
+ } else {
+ grn_timeval tv;
+ uint64_t elapsed_time;
+ grn_timeval_now(ctx, &tv);
+ elapsed_time =
+ (uint64_t)(tv.tv_sec - ctx->impl->tv.tv_sec) * GRN_TIME_NSEC_PER_SEC +
+ (tv.tv_nsec - ctx->impl->tv.tv_nsec);
+
+ grn_snprintf(info, INFO_BUFFER_SIZE, INFO_BUFFER_SIZE,
+ "%p|%s%015" GRN_FMT_INT64U " ", ctx, mark, elapsed_time);
+ info[INFO_BUFFER_SIZE - 1] = '\0';
+ }
+
+ {
+ va_list args;
+
+ va_start(args, format);
+ GRN_BULK_REWIND(message);
+ grn_text_vprintf(ctx, message, format, args);
+ va_end(args);
+ GRN_TEXT_PUTC(ctx, message, '\0');
+ }
+
+ current_query_logger.log(ctx, flag, timestamp, info, GRN_TEXT_VALUE(message),
+ current_query_logger.user_data);
+}
+
+void
+grn_query_logger_init(void)
+{
+ grn_memcpy(&current_query_logger,
+ &default_query_logger, sizeof(grn_query_logger));
+ CRITICAL_SECTION_INIT(default_query_logger_lock);
+}
+
+void
+grn_query_logger_fin(grn_ctx *ctx)
+{
+ current_query_logger_fin(ctx);
+ if (default_query_logger_path) {
+ free(default_query_logger_path);
+ }
+ CRITICAL_SECTION_FIN(default_query_logger_lock);
+}
+
+void
+grn_log_reopen(grn_ctx *ctx)
+{
+ grn_logger_reopen(ctx);
+ grn_query_logger_reopen(ctx);
+}
diff --git a/storage/mroonga/vendor/groonga/lib/mrb.c b/storage/mroonga/vendor/groonga/lib/mrb.c
index f05949cef98..60d2172d520 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb.c
+++ b/storage/mroonga/vendor/groonga/lib/mrb.c
@@ -1,6 +1,6 @@
/* -*- c-basic-offset: 2 -*- */
/*
- Copyright(C) 2013 Brazil
+ Copyright(C) 2013-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,8 +16,9 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "mrb.h"
-#include "ctx_impl.h"
+#include "grn_mrb.h"
+#include "grn_ctx_impl.h"
+#include "grn_util.h"
#ifdef GRN_WITH_MRUBY
# include <mruby/proc.h>
@@ -25,58 +26,94 @@
# include <mruby/string.h>
#endif
+#include <ctype.h>
+
+#ifdef WIN32
+# include <share.h>
+#endif /* WIN32 */
+
#define BUFFER_SIZE 2048
+#define E_LOAD_ERROR (mrb_class_get(mrb, "LoadError"))
#ifdef GRN_WITH_MRUBY
-#ifdef WIN32
+# ifdef WIN32
static char *win32_ruby_scripts_dir = NULL;
static char win32_ruby_scripts_dir_buffer[PATH_MAX];
static const char *
-grn_mrb_get_system_ruby_scripts_dir(void)
+grn_mrb_get_default_system_ruby_scripts_dir(void)
{
if (!win32_ruby_scripts_dir) {
const char *base_dir;
const char *relative_path = GRN_RELATIVE_RUBY_SCRIPTS_DIR;
- char *path;
size_t base_dir_length;
base_dir = grn_win32_base_dir();
base_dir_length = strlen(base_dir);
- strcpy(win32_ruby_scripts_dir_buffer, base_dir);
- strcat(win32_ruby_scripts_dir_buffer, "/");
- strcat(win32_ruby_scripts_dir_buffer, relative_path);
+ grn_strcpy(win32_ruby_scripts_dir_buffer, PATH_MAX, base_dir);
+ grn_strcat(win32_ruby_scripts_dir_buffer, PATH_MAX, "/");
+ grn_strcat(win32_ruby_scripts_dir_buffer, PATH_MAX, relative_path);
win32_ruby_scripts_dir = win32_ruby_scripts_dir_buffer;
}
return win32_ruby_scripts_dir;
}
-#else /* WIN32 */
+# else /* WIN32 */
static const char *
-grn_mrb_get_system_ruby_scripts_dir(void)
+grn_mrb_get_default_system_ruby_scripts_dir(void)
{
return GRN_RUBY_SCRIPTS_DIR;
}
-#endif /* WIN32 */
+# endif /* WIN32 */
+
+const char *
+grn_mrb_get_system_ruby_scripts_dir(grn_ctx *ctx)
+{
+ static char ruby_scripts_dir[GRN_ENV_BUFFER_SIZE];
+
+ grn_getenv("GRN_RUBY_SCRIPTS_DIR",
+ ruby_scripts_dir,
+ GRN_ENV_BUFFER_SIZE);
+ if (ruby_scripts_dir[0]) {
+ return ruby_scripts_dir;
+ } else {
+ return grn_mrb_get_default_system_ruby_scripts_dir();
+ }
+}
+
+static grn_bool
+grn_mrb_is_absolute_path(const char *path)
+{
+ if (path[0] == '/') {
+ return GRN_TRUE;
+ }
+
+ if (isalpha(path[0]) && path[1] == ':' && path[2] == '/') {
+ return GRN_TRUE;
+ }
+
+ return GRN_FALSE;
+}
static grn_bool
-grn_mrb_expand_script_path(grn_ctx *ctx, const char *path, char *expanded_path)
+grn_mrb_expand_script_path(grn_ctx *ctx, const char *path,
+ char *expanded_path, size_t expanded_path_size)
{
const char *ruby_scripts_dir;
char dir_last_char;
int path_length, max_path_length;
- if (path[0] == '/') {
+ if (grn_mrb_is_absolute_path(path)) {
expanded_path[0] = '\0';
+ } else if (path[0] == '.' && path[1] == '/') {
+ grn_strcpy(expanded_path, expanded_path_size, ctx->impl->mrb.base_directory);
+ grn_strcat(expanded_path, expanded_path_size, "/");
} else {
- ruby_scripts_dir = getenv("GRN_RUBY_SCRIPTS_DIR");
- if (!ruby_scripts_dir) {
- ruby_scripts_dir = grn_mrb_get_system_ruby_scripts_dir();
- }
- strcpy(expanded_path, ruby_scripts_dir);
+ ruby_scripts_dir = grn_mrb_get_system_ruby_scripts_dir(ctx);
+ grn_strcpy(expanded_path, expanded_path_size, ruby_scripts_dir);
dir_last_char = ruby_scripts_dir[strlen(expanded_path) - 1];
if (dir_last_char != '/') {
- strcat(expanded_path, "/");
+ grn_strcat(expanded_path, expanded_path_size, "/");
}
}
@@ -90,7 +127,7 @@ grn_mrb_expand_script_path(grn_ctx *ctx, const char *path, char *expanded_path)
return GRN_FALSE;
}
- strcat(expanded_path, path);
+ grn_strcat(expanded_path, expanded_path_size, path);
return GRN_TRUE;
}
@@ -109,36 +146,51 @@ grn_mrb_load(grn_ctx *ctx, const char *path)
return mrb_nil_value();
}
- if (!grn_mrb_expand_script_path(ctx, path, expanded_path)) {
+ if (!grn_mrb_expand_script_path(ctx, path, expanded_path, PATH_MAX)) {
return mrb_nil_value();
}
- file = fopen(expanded_path, "r");
+ file = grn_fopen(expanded_path, "r");
if (!file) {
char message[BUFFER_SIZE];
mrb_value exception;
- snprintf(message, BUFFER_SIZE - 1,
- "fopen: failed to open mruby script file: <%s>", expanded_path);
+ grn_snprintf(message, BUFFER_SIZE, BUFFER_SIZE,
+ "fopen: failed to open mruby script file: <%s>",
+ expanded_path);
SERR(message);
- exception = mrb_exc_new(mrb, E_ARGUMENT_ERROR,
+ exception = mrb_exc_new(mrb, E_LOAD_ERROR,
ctx->errbuf, strlen(ctx->errbuf));
mrb->exc = mrb_obj_ptr(exception);
return mrb_nil_value();
}
- parser = mrb_parser_new(mrb);
- mrb_parser_set_filename(parser, expanded_path);
- parser->s = parser->send = NULL;
- parser->f = file;
- mrb_parser_parse(parser, NULL);
- fclose(file);
-
{
- struct RProc *proc;
- proc = mrb_generate_code(mrb, parser);
- result = mrb_toplevel_run(mrb, proc);
+ char current_base_directory[PATH_MAX];
+ char *last_directory;
+
+ grn_strcpy(current_base_directory, PATH_MAX, data->base_directory);
+ grn_strcpy(data->base_directory, PATH_MAX, expanded_path);
+ last_directory = strrchr(data->base_directory, '/');
+ if (last_directory) {
+ last_directory[0] = '\0';
+ }
+
+ parser = mrb_parser_new(mrb);
+ mrb_parser_set_filename(parser, expanded_path);
+ parser->s = parser->send = NULL;
+ parser->f = file;
+ mrb_parser_parse(parser, NULL);
+ fclose(file);
+
+ {
+ struct RProc *proc;
+ proc = mrb_generate_code(mrb, parser);
+ result = mrb_toplevel_run(mrb, proc);
+ }
+ mrb_parser_free(parser);
+
+ grn_strcpy(data->base_directory, PATH_MAX, current_base_directory);
}
- mrb_parser_free(parser);
return result;
}
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_accessor.c b/storage/mroonga/vendor/groonga/lib/mrb/mrb_accessor.c
index a350c6b04f3..daa0caada06 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/mrb_accessor.c
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_accessor.c
@@ -1,6 +1,6 @@
/* -*- c-basic-offset: 2 -*- */
/*
- Copyright(C) 2013-2014 Brazil
+ Copyright(C) 2013-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,7 +16,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "../ctx_impl.h"
+#include "../grn_ctx_impl.h"
#ifdef GRN_WITH_MRUBY
#include <mruby.h>
@@ -24,8 +24,9 @@
#include <mruby/variable.h>
#include <mruby/data.h>
-#include "../db.h"
+#include "../grn_db.h"
#include "mrb_accessor.h"
+#include "mrb_converter.h"
static struct mrb_data_type mrb_grn_accessor_type = {
"Groonga::Accessor",
@@ -49,8 +50,25 @@ mrb_grn_accessor_next(mrb_state *mrb, mrb_value self)
grn_accessor *accessor;
accessor = DATA_PTR(self);
- if (!accessor->next) { return mrb_nil_value(); }
- return mrb_cptr_value(mrb, accessor->next);
+ return grn_mrb_value_from_grn_obj(mrb, (grn_obj *)(accessor->next));
+}
+
+static mrb_value
+mrb_grn_accessor_have_next_p(mrb_state *mrb, mrb_value self)
+{
+ grn_accessor *accessor;
+
+ accessor = DATA_PTR(self);
+ return mrb_bool_value(accessor->next != NULL);
+}
+
+static mrb_value
+mrb_grn_accessor_object(mrb_state *mrb, mrb_value self)
+{
+ grn_accessor *accessor;
+
+ accessor = DATA_PTR(self);
+ return grn_mrb_value_from_grn_obj(mrb, accessor->obj);
}
void
@@ -67,5 +85,9 @@ grn_mrb_accessor_init(grn_ctx *ctx)
mrb_grn_accessor_initialize, MRB_ARGS_REQ(1));
mrb_define_method(mrb, klass, "next",
mrb_grn_accessor_next, MRB_ARGS_NONE());
+ mrb_define_method(mrb, klass, "have_next?",
+ mrb_grn_accessor_have_next_p, MRB_ARGS_NONE());
+ mrb_define_method(mrb, klass, "object",
+ mrb_grn_accessor_object, MRB_ARGS_NONE());
}
#endif
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_accessor.h b/storage/mroonga/vendor/groonga/lib/mrb/mrb_accessor.h
index 2aaf32f48f9..7b27e6375ec 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/mrb_accessor.h
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_accessor.h
@@ -19,8 +19,8 @@
#ifndef GRN_MRB_ACCESSOR_H
#define GRN_MRB_ACCESSOR_H
-#include "../ctx.h"
-#include "../db.h"
+#include "../grn_ctx.h"
+#include "../grn_db.h"
#ifdef __cplusplus
extern "C" {
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_array.c b/storage/mroonga/vendor/groonga/lib/mrb/mrb_array.c
new file mode 100644
index 00000000000..f19bcfa9563
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_array.c
@@ -0,0 +1,60 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2014 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
+*/
+
+#include "../grn_ctx_impl.h"
+
+#ifdef GRN_WITH_MRUBY
+#include <mruby.h>
+#include <mruby/class.h>
+#include <mruby/data.h>
+
+#include "mrb_array.h"
+
+static struct mrb_data_type mrb_grn_array_type = {
+ "Groonga::Array",
+ NULL
+};
+
+static mrb_value
+mrb_grn_array_initialize(mrb_state *mrb, mrb_value self)
+{
+ mrb_value mrb_array_ptr;
+
+ mrb_get_args(mrb, "o", &mrb_array_ptr);
+ DATA_TYPE(self) = &mrb_grn_array_type;
+ DATA_PTR(self) = mrb_cptr(mrb_array_ptr);
+ return self;
+}
+
+void
+grn_mrb_array_init(grn_ctx *ctx)
+{
+ grn_mrb_data *data = &(ctx->impl->mrb);
+ mrb_state *mrb = data->state;
+ struct RClass *module = data->module;
+ struct RClass *table_class;
+ struct RClass *klass;
+
+ table_class = mrb_class_get_under(mrb, module, "Table");
+ klass = mrb_define_class_under(mrb, module, "Array", table_class);
+ MRB_SET_INSTANCE_TT(klass, MRB_TT_DATA);
+
+ mrb_define_method(mrb, klass, "initialize",
+ mrb_grn_array_initialize, MRB_ARGS_REQ(1));
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_array.h b/storage/mroonga/vendor/groonga/lib/mrb/mrb_array.h
new file mode 100644
index 00000000000..062281684ee
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_array.h
@@ -0,0 +1,34 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2014 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
+*/
+
+#ifndef GRN_MRB_ARRAY_H
+#define GRN_MRB_ARRAY_H
+
+#include "../grn_ctx.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void grn_mrb_array_init(grn_ctx *ctx);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRN_MRB_ARRAY_H */
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_bulk.c b/storage/mroonga/vendor/groonga/lib/mrb/mrb_bulk.c
index ad428ea5bde..eb57a016148 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/mrb_bulk.c
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_bulk.c
@@ -1,6 +1,6 @@
/* -*- c-basic-offset: 2 -*- */
/*
- Copyright(C) 2014 Brazil
+ Copyright(C) 2014-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,7 +16,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "../ctx_impl.h"
+#include "../grn_ctx_impl.h"
#ifdef GRN_WITH_MRUBY
#include <mruby.h>
@@ -24,8 +24,9 @@
#include <mruby/variable.h>
#include <mruby/data.h>
#include <mruby/numeric.h>
+#include <mruby/string.h>
-#include "../db.h"
+#include "../grn_db.h"
#include "mrb_bulk.h"
static struct mrb_data_type mrb_grn_bulk_type = {
@@ -33,33 +34,62 @@ static struct mrb_data_type mrb_grn_bulk_type = {
NULL
};
-static mrb_value
-mrb_grn_bulk_initialize(mrb_state *mrb, mrb_value self)
+grn_obj *
+grn_mrb_value_to_bulk(mrb_state *mrb, mrb_value mrb_value_, grn_obj *bulk)
{
- mrb_value mrb_bulk_ptr;
-
- mrb_get_args(mrb, "o", &mrb_bulk_ptr);
- DATA_TYPE(self) = &mrb_grn_bulk_type;
- DATA_PTR(self) = mrb_cptr(mrb_bulk_ptr);
- return self;
-}
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+
+ switch (mrb_type(mrb_value_)) {
+ case MRB_TT_FALSE :
+ if (mrb_nil_p(mrb_value_)) {
+ grn_obj_reinit(ctx, bulk, GRN_DB_VOID, 0);
+ } else {
+ grn_obj_reinit(ctx, bulk, GRN_DB_BOOL, 0);
+ GRN_BOOL_SET(ctx, bulk, GRN_FALSE);
+ }
+ break;
+ case MRB_TT_TRUE :
+ grn_obj_reinit(ctx, bulk, GRN_DB_BOOL, 0);
+ GRN_BOOL_SET(ctx, bulk, GRN_TRUE);
+ break;
+ case MRB_TT_FIXNUM :
+ grn_obj_reinit(ctx, bulk, GRN_DB_INT64, 0);
+ GRN_INT64_SET(ctx, bulk, mrb_fixnum(mrb_value_));
+ break;
+ case MRB_TT_SYMBOL :
+ {
+ const char *name;
+ mrb_int name_length;
-static mrb_value
-mrb_grn_bulk_get_domain(mrb_state *mrb, mrb_value self)
-{
- grn_obj *bulk;
+ grn_obj_reinit(ctx, bulk, GRN_DB_TEXT, 0);
+ name = mrb_sym2name_len(mrb, mrb_symbol(mrb_value_), &name_length);
+ GRN_TEXT_SET(ctx, bulk, name, name_length);
+ }
+ break;
+ case MRB_TT_FLOAT :
+ grn_obj_reinit(ctx, bulk, GRN_DB_FLOAT, 0);
+ GRN_FLOAT_SET(ctx, bulk, mrb_float(mrb_value_));
+ break;
+ case MRB_TT_STRING :
+ grn_obj_reinit(ctx, bulk, GRN_DB_TEXT, 0);
+ GRN_TEXT_SET(ctx, bulk, RSTRING_PTR(mrb_value_), RSTRING_LEN(mrb_value_));
+ break;
+ default :
+ mrb_raisef(mrb, E_ARGUMENT_ERROR,
+ "unsupported object to convert to bulk: %S",
+ mrb_value_);
+ break;
+ }
- bulk = DATA_PTR(self);
- return mrb_fixnum_value(bulk->header.domain);
+ return bulk;
}
-static mrb_value
-mrb_grn_bulk_get_value(mrb_state *mrb, mrb_value self)
+mrb_value
+grn_mrb_value_from_bulk(mrb_state *mrb, grn_obj *bulk)
{
- grn_obj *bulk;
mrb_value mrb_value_;
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
- bulk = DATA_PTR(self);
switch (bulk->header.domain) {
case GRN_DB_INT32 :
{
@@ -81,11 +111,33 @@ mrb_grn_bulk_get_value(mrb_state *mrb, mrb_value self)
mrb_value_ = mrb_fixnum_value(value);
}
break;
+ case GRN_DB_TIME :
+ {
+ int64_t value;
+ int32_t sec;
+ int32_t usec;
+
+ value = GRN_TIME_VALUE(bulk);
+ GRN_TIME_UNPACK(value, sec, usec);
+ mrb_value_ = mrb_funcall(mrb,
+ mrb_obj_value(ctx->impl->mrb.builtin.time_class),
+ "at",
+ 2,
+ mrb_fixnum_value(sec),
+ mrb_fixnum_value(usec));
+ }
+ break;
+ case GRN_DB_SHORT_TEXT :
+ case GRN_DB_TEXT :
+ case GRN_DB_LONG_TEXT :
+ mrb_value_ = mrb_str_new_static(mrb,
+ GRN_TEXT_VALUE(bulk),
+ GRN_TEXT_LEN(bulk));
+ break;
default :
{
#define MESSAGE_SIZE 4096
char message[MESSAGE_SIZE];
- grn_ctx *ctx = (grn_ctx *)mrb->ud;
grn_obj *domain;
char domain_name[GRN_TABLE_MAX_KEY_SIZE];
int domain_name_size;
@@ -96,14 +148,14 @@ mrb_grn_bulk_get_value(mrb_state *mrb, mrb_value self)
domain_name, GRN_TABLE_MAX_KEY_SIZE);
grn_obj_unlink(ctx, domain);
} else {
- strcpy(domain_name, "unknown");
+ grn_strcpy(domain_name, GRN_TABLE_MAX_KEY_SIZE, "unknown");
domain_name_size = strlen(domain_name);
}
- snprintf(message, MESSAGE_SIZE,
- "unsupported bulk value type: <%d>(%.*s)",
- bulk->header.domain,
- domain_name_size,
- domain_name);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "unsupported bulk value type: <%d>(%.*s)",
+ bulk->header.domain,
+ domain_name_size,
+ domain_name);
mrb_raise(mrb, E_RANGE_ERROR, message);
#undef MESSAGE_SIZE
}
@@ -113,6 +165,43 @@ mrb_grn_bulk_get_value(mrb_state *mrb, mrb_value self)
return mrb_value_;
}
+grn_bool
+grn_mrb_bulk_cast(mrb_state *mrb, grn_obj *from, grn_obj *to, grn_id domain_id)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ grn_rc rc;
+
+ grn_obj_reinit(ctx, to, domain_id, 0);
+ rc = grn_obj_cast(ctx, from, to, GRN_FALSE);
+ return rc == GRN_SUCCESS;
+}
+
+static mrb_value
+mrb_grn_bulk_initialize(mrb_state *mrb, mrb_value self)
+{
+ mrb_value mrb_bulk_ptr;
+
+ mrb_get_args(mrb, "o", &mrb_bulk_ptr);
+ DATA_TYPE(self) = &mrb_grn_bulk_type;
+ DATA_PTR(self) = mrb_cptr(mrb_bulk_ptr);
+ return self;
+}
+
+static mrb_value
+mrb_grn_bulk_get_domain(mrb_state *mrb, mrb_value self)
+{
+ grn_obj *bulk;
+
+ bulk = DATA_PTR(self);
+ return mrb_fixnum_value(bulk->header.domain);
+}
+
+static mrb_value
+mrb_grn_bulk_get_value(mrb_state *mrb, mrb_value self)
+{
+ return grn_mrb_value_from_bulk(mrb, DATA_PTR(self));
+}
+
static mrb_value
mrb_grn_bulk_equal(mrb_state *mrb, mrb_value self)
{
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_bulk.h b/storage/mroonga/vendor/groonga/lib/mrb/mrb_bulk.h
index 3be86584dc6..dd1f46fb84e 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/mrb_bulk.h
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_bulk.h
@@ -1,6 +1,6 @@
/* -*- c-basic-offset: 2 -*- */
/*
- Copyright(C) 2014 Brazil
+ Copyright(C) 2014-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -19,8 +19,8 @@
#ifndef GRN_MRB_BULK_H
#define GRN_MRB_BULK_H
-#include "../ctx.h"
-#include "../db.h"
+#include "../grn_ctx.h"
+#include "../grn_db.h"
#ifdef __cplusplus
extern "C" {
@@ -28,6 +28,15 @@ extern "C" {
void grn_mrb_bulk_init(grn_ctx *ctx);
+mrb_value grn_mrb_value_from_bulk(mrb_state *mrb, grn_obj *bulk);
+grn_obj *grn_mrb_value_to_bulk(mrb_state *mrb,
+ mrb_value mrb_value_,
+ grn_obj *bulk);
+grn_bool grn_mrb_bulk_cast(mrb_state *mrb,
+ grn_obj *from,
+ grn_obj *to,
+ grn_id domain_id);
+
#ifdef __cplusplus
}
#endif
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_column.c b/storage/mroonga/vendor/groonga/lib/mrb/mrb_column.c
index 545f070d91c..1d3bbb69422 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/mrb_column.c
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_column.c
@@ -1,6 +1,6 @@
/* -*- c-basic-offset: 2 -*- */
/*
- Copyright(C) 2013 Brazil
+ Copyright(C) 2013-2014 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,13 +16,42 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "../ctx_impl.h"
+#include "../grn_ctx_impl.h"
#ifdef GRN_WITH_MRUBY
#include <mruby.h>
#include <mruby/class.h>
+#include <mruby/data.h>
+#include "mrb_ctx.h"
#include "mrb_column.h"
+#include "mrb_converter.h"
+
+static mrb_value
+mrb_grn_column_is_locked(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ unsigned int is_locked;
+
+ is_locked = grn_obj_is_locked(ctx, DATA_PTR(self));
+ grn_mrb_ctx_check(mrb);
+
+ return mrb_bool_value(is_locked != 0);
+}
+
+static mrb_value
+mrb_grn_column_get_table(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ grn_obj *table;
+
+ table = grn_column_table(ctx, DATA_PTR(self));
+ if (!table) {
+ return mrb_nil_value();
+ }
+
+ return grn_mrb_value_from_grn_obj(mrb, table);
+}
void
grn_mrb_column_init(grn_ctx *ctx)
@@ -35,5 +64,11 @@ grn_mrb_column_init(grn_ctx *ctx)
klass = mrb_define_class_under(mrb, module, "Column", object_class);
MRB_SET_INSTANCE_TT(klass, MRB_TT_DATA);
+
+ mrb_define_method(mrb, klass, "locked?",
+ mrb_grn_column_is_locked, MRB_ARGS_NONE());
+
+ mrb_define_method(mrb, klass, "table",
+ mrb_grn_column_get_table, MRB_ARGS_NONE());
}
#endif
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_column.h b/storage/mroonga/vendor/groonga/lib/mrb/mrb_column.h
index 77e0dab82fd..abb99915fa5 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/mrb_column.h
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_column.h
@@ -19,7 +19,7 @@
#ifndef GRN_MRB_COLUMN_H
#define GRN_MRB_COLUMN_H
-#include "../ctx.h"
+#include "../grn_ctx.h"
#ifdef __cplusplus
extern "C" {
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_command.c b/storage/mroonga/vendor/groonga/lib/mrb/mrb_command.c
new file mode 100644
index 00000000000..0ff3a0d5b69
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_command.c
@@ -0,0 +1,180 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2015 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
+*/
+
+#include "../grn_ctx_impl.h"
+#include <groonga/command.h>
+
+#ifdef GRN_WITH_MRUBY
+#include <mruby.h>
+#include <mruby/class.h>
+#include <mruby/data.h>
+#include <mruby/value.h>
+#include <mruby/string.h>
+
+#include "mrb_ctx.h"
+#include "mrb_command.h"
+
+static struct mrb_data_type mrb_grn_command_type = {
+ "Groonga::Command",
+ NULL
+};
+
+mrb_value
+mrb_grn_command_instantiate(grn_ctx *ctx, grn_obj *command)
+{
+ grn_mrb_data *data = &(ctx->impl->mrb);
+ mrb_state *mrb = data->state;
+ struct RClass *module = data->module;
+ char name[GRN_TABLE_MAX_KEY_SIZE];
+ int name_size;
+ mrb_value mrb_name;
+ struct RClass *command_class;
+ struct RClass *target_command_class;
+ mrb_value mrb_target_command_class;
+ mrb_value mrb_arguments[1];
+
+ name_size = grn_obj_name(ctx, command, name, GRN_TABLE_MAX_KEY_SIZE);
+ mrb_name = mrb_str_new(mrb, name, name_size);
+
+ command_class = mrb_class_get_under(mrb, module, "Command");
+ mrb_target_command_class = mrb_funcall(mrb,
+ mrb_obj_value(command_class),
+ "find_class", 1, mrb_name);
+ if (mrb_nil_p(mrb_target_command_class)) {
+ target_command_class = command_class;
+ } else {
+ target_command_class = mrb_class_ptr(mrb_target_command_class);
+ }
+ mrb_arguments[0] = mrb_cptr_value(mrb, command);
+ return mrb_obj_new(mrb, target_command_class, 1, mrb_arguments);
+}
+
+static void
+mrb_grn_command_run_wrapper(grn_ctx *ctx,
+ grn_obj *command,
+ grn_command_input *input,
+ void *user_data)
+{
+ grn_mrb_data *data = &(ctx->impl->mrb);
+ mrb_state *mrb = data->state;
+ struct RClass *module = data->module;
+ int arena_index;
+ mrb_value mrb_command;
+ mrb_value mrb_input;
+
+ arena_index = mrb_gc_arena_save(mrb);
+ mrb_command = mrb_grn_command_instantiate(ctx, command);
+ {
+ struct RClass *command_input_class;
+ mrb_value mrb_arguments[1];
+ command_input_class = mrb_class_get_under(mrb, module, "CommandInput");
+ mrb_arguments[0] = mrb_cptr_value(mrb, input);
+ mrb_input = mrb_obj_new(mrb, command_input_class, 1, mrb_arguments);
+ }
+ mrb_funcall(mrb, mrb_command, "run_internal", 1, mrb_input);
+ mrb_gc_arena_restore(mrb, arena_index);
+}
+
+static mrb_value
+mrb_grn_command_singleton_register(mrb_state *mrb, mrb_value klass)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ mrb_value mrb_name;
+ mrb_value *mrb_arguments;
+ mrb_int n_arguments;
+
+ mrb_get_args(mrb, "Sa", &mrb_name, &mrb_arguments, &n_arguments);
+
+ {
+ grn_expr_var *vars;
+ mrb_int i;
+
+ for (i = 0; i < n_arguments; i++) {
+ mrb_arguments[i] = mrb_convert_type(mrb, mrb_arguments[i],
+ MRB_TT_STRING, "String", "to_str");
+ }
+ vars = GRN_MALLOCN(grn_expr_var, n_arguments);
+ for (i = 0; i < n_arguments; i++) {
+ mrb_value mrb_argument = mrb_arguments[i];
+ grn_expr_var *var = &vars[i];
+ var->name = RSTRING_PTR(mrb_argument);
+ var->name_size = RSTRING_LEN(mrb_argument);
+ GRN_TEXT_INIT(&(var->value), 0);
+ }
+
+ grn_command_register(ctx,
+ RSTRING_PTR(mrb_name),
+ RSTRING_LEN(mrb_name),
+ mrb_grn_command_run_wrapper,
+ vars,
+ n_arguments,
+ NULL);
+
+ for (i = 0; i < n_arguments; i++) {
+ grn_expr_var *var = &vars[i];
+ GRN_OBJ_FIN(ctx, &(var->value));
+ }
+ GRN_FREE(vars);
+ }
+
+ grn_mrb_ctx_check(mrb);
+
+ {
+ grn_mrb_data *data = &(ctx->impl->mrb);
+ struct RClass *command_class;
+ command_class = mrb_class_get_under(mrb, data->module, "Command");
+ mrb_funcall(mrb,
+ mrb_obj_value(command_class),
+ "register_class", 2, mrb_name, klass);
+ }
+
+ return mrb_nil_value();
+}
+
+static mrb_value
+mrb_grn_command_initialize(mrb_state *mrb, mrb_value self)
+{
+ mrb_value mrb_command_ptr;
+
+ mrb_get_args(mrb, "o", &mrb_command_ptr);
+ DATA_TYPE(self) = &mrb_grn_command_type;
+ DATA_PTR(self) = mrb_cptr(mrb_command_ptr);
+ return self;
+}
+
+void
+grn_mrb_command_init(grn_ctx *ctx)
+{
+ grn_mrb_data *data = &(ctx->impl->mrb);
+ mrb_state *mrb = data->state;
+ struct RClass *module = data->module;
+ struct RClass *procedure_class;
+ struct RClass *klass;
+
+ procedure_class = mrb_class_get_under(mrb, module, "Procedure");
+ klass = mrb_define_class_under(mrb, module, "Command", procedure_class);
+ MRB_SET_INSTANCE_TT(klass, MRB_TT_DATA);
+
+ mrb_define_singleton_method(mrb, (struct RObject *)klass, "register",
+ mrb_grn_command_singleton_register,
+ MRB_ARGS_REQ(2));
+
+ mrb_define_method(mrb, klass, "initialize",
+ mrb_grn_command_initialize, MRB_ARGS_REQ(1));
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_command.h b/storage/mroonga/vendor/groonga/lib/mrb/mrb_command.h
new file mode 100644
index 00000000000..2b899df3a6d
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_command.h
@@ -0,0 +1,36 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2015 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
+*/
+
+#ifndef GRN_MRB_COMMAND_H
+#define GRN_MRB_COMMAND_H
+
+#include "../grn_ctx.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void grn_mrb_command_init(grn_ctx *ctx);
+
+mrb_value grn_mrb_command_instantiate(grn_ctx *ctx, grn_obj *command);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRN_MRB_COMMAND_H */
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_command_input.c b/storage/mroonga/vendor/groonga/lib/mrb/mrb_command_input.c
new file mode 100644
index 00000000000..f39202398d1
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_command_input.c
@@ -0,0 +1,122 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2015 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
+*/
+
+#include "../grn_ctx_impl.h"
+#include <groonga/command.h>
+
+#ifdef GRN_WITH_MRUBY
+#include <mruby.h>
+#include <mruby/class.h>
+#include <mruby/data.h>
+#include <mruby/value.h>
+#include <mruby/string.h>
+
+#include "mrb_ctx.h"
+#include "mrb_command_input.h"
+
+static struct mrb_data_type mrb_grn_command_input_type = {
+ "Groonga::CommandInput",
+ NULL
+};
+
+static mrb_value
+mrb_grn_command_input_initialize(mrb_state *mrb, mrb_value self)
+{
+ mrb_value mrb_command_input_ptr;
+
+ mrb_get_args(mrb, "o", &mrb_command_input_ptr);
+ DATA_TYPE(self) = &mrb_grn_command_input_type;
+ DATA_PTR(self) = mrb_cptr(mrb_command_input_ptr);
+ return self;
+}
+
+static mrb_value
+mrb_grn_command_input_array_reference(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ grn_command_input *input;
+ mrb_value mrb_key_or_offset;
+ grn_obj *argument;
+
+ input = DATA_PTR(self);
+ mrb_get_args(mrb, "o", &mrb_key_or_offset);
+
+ switch (mrb_type(mrb_key_or_offset)) {
+ case MRB_TT_FIXNUM :
+ {
+ mrb_int offset = mrb_fixnum(mrb_key_or_offset);
+ argument = grn_command_input_at(ctx, input, offset);
+ }
+ break;
+ case MRB_TT_SYMBOL :
+ {
+ mrb_sym mrb_key_symbol;
+ const char *key;
+ mrb_int key_length;
+
+ mrb_key_symbol = mrb_symbol(mrb_key_or_offset);
+ key = mrb_sym2name_len(mrb, mrb_key_symbol, &key_length);
+ argument = grn_command_input_get(ctx, input, key, key_length);
+ }
+ break;
+ case MRB_TT_STRING :
+ {
+ mrb_value mrb_key = mrb_key_or_offset;
+ argument = grn_command_input_get(ctx, input,
+ RSTRING_PTR(mrb_key),
+ RSTRING_LEN(mrb_key));
+ }
+ break;
+ default :
+ mrb_raisef(mrb, E_ARGUMENT_ERROR,
+ "must be offset (as integer) or key (as symbol or string): %S",
+ mrb_key_or_offset);
+ break;
+ }
+
+ if (!argument) {
+ return mrb_nil_value();
+ }
+
+ if (GRN_TEXT_LEN(argument) == 0) {
+ return mrb_nil_value();
+ }
+
+ return mrb_str_new_static(mrb,
+ GRN_TEXT_VALUE(argument),
+ GRN_TEXT_LEN(argument));
+}
+
+void
+grn_mrb_command_input_init(grn_ctx *ctx)
+{
+ grn_mrb_data *data = &(ctx->impl->mrb);
+ mrb_state *mrb = data->state;
+ struct RClass *module = data->module;
+ struct RClass *klass;
+
+ klass = mrb_define_class_under(mrb, module, "CommandInput", mrb->object_class);
+ MRB_SET_INSTANCE_TT(klass, MRB_TT_DATA);
+
+ mrb_define_method(mrb, klass, "initialize",
+ mrb_grn_command_input_initialize, MRB_ARGS_REQ(1));
+
+ mrb_define_method(mrb, klass, "[]",
+ mrb_grn_command_input_array_reference, MRB_ARGS_REQ(1));
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_command_input.h b/storage/mroonga/vendor/groonga/lib/mrb/mrb_command_input.h
new file mode 100644
index 00000000000..a4eb09779d1
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_command_input.h
@@ -0,0 +1,34 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2015 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
+*/
+
+#ifndef GRN_MRB_COMMAND_INPUT_H
+#define GRN_MRB_COMMAND_INPUT_H
+
+#include "../grn_ctx.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void grn_mrb_command_input_init(grn_ctx *ctx);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRN_MRB_COMMAND_INPUT_H */
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_content_type.c b/storage/mroonga/vendor/groonga/lib/mrb/mrb_content_type.c
new file mode 100644
index 00000000000..7f4ff139de1
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_content_type.c
@@ -0,0 +1,49 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2015 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
+*/
+
+#include "../grn_ctx_impl.h"
+
+#ifdef GRN_WITH_MRUBY
+#include <mruby.h>
+
+#include "mrb_ctx.h"
+#include "mrb_content_type.h"
+
+void
+grn_mrb_content_type_init(grn_ctx *ctx)
+{
+ grn_mrb_data *data = &(ctx->impl->mrb);
+ mrb_state *mrb = data->state;
+ struct RClass *module;
+
+ module = mrb_define_module_under(mrb, data->module, "ContentType");
+
+ mrb_define_const(mrb, module, "NONE",
+ mrb_fixnum_value(GRN_CONTENT_NONE));
+ mrb_define_const(mrb, module, "TSV",
+ mrb_fixnum_value(GRN_CONTENT_TSV));
+ mrb_define_const(mrb, module, "JSON",
+ mrb_fixnum_value(GRN_CONTENT_JSON));
+ mrb_define_const(mrb, module, "XML",
+ mrb_fixnum_value(GRN_CONTENT_XML));
+ mrb_define_const(mrb, module, "MSGPACK",
+ mrb_fixnum_value(GRN_CONTENT_MSGPACK));
+ mrb_define_const(mrb, module, "GROONGA_COMMAND_LIST",
+ mrb_fixnum_value(GRN_CONTENT_GROONGA_COMMAND_LIST));
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_content_type.h b/storage/mroonga/vendor/groonga/lib/mrb/mrb_content_type.h
new file mode 100644
index 00000000000..46103ff1a62
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_content_type.h
@@ -0,0 +1,34 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2015 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
+*/
+
+#ifndef GRN_MRB_CONTENT_TYPE_H
+#define GRN_MRB_CONTENT_TYPE_H
+
+#include "../grn_ctx.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void grn_mrb_content_type_init(grn_ctx *ctx);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRN_MRB_CONTENT_TYPE_H */
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_converter.c b/storage/mroonga/vendor/groonga/lib/mrb/mrb_converter.c
index 2e7c41edbdf..e4c3aceb435 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/mrb_converter.c
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_converter.c
@@ -1,6 +1,6 @@
/* -*- c-basic-offset: 2 -*- */
/*
- Copyright(C) 2013-2014 Brazil
+ Copyright(C) 2013-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,14 +16,125 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "../ctx_impl.h"
+#include "../grn_ctx_impl.h"
+#include "../grn_db.h"
#ifdef GRN_WITH_MRUBY
#include <mruby.h>
#include <mruby/class.h>
#include <mruby/data.h>
+#include <mruby/string.h>
#include "mrb_converter.h"
+#include "mrb_bulk.h"
+
+void
+grn_mrb_value_to_raw_data_buffer_init(mrb_state *mrb,
+ grn_mrb_value_to_raw_data_buffer *buffer)
+{
+ GRN_VOID_INIT(&(buffer->from));
+ GRN_VOID_INIT(&(buffer->to));
+}
+
+void
+grn_mrb_value_to_raw_data_buffer_fin(mrb_state *mrb,
+ grn_mrb_value_to_raw_data_buffer *buffer)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+
+ GRN_OBJ_FIN(ctx, &(buffer->from));
+ GRN_OBJ_FIN(ctx, &(buffer->to));
+}
+
+void
+grn_mrb_value_to_raw_data(mrb_state *mrb,
+ const char *context,
+ mrb_value mrb_value_,
+ grn_id domain_id,
+ grn_mrb_value_to_raw_data_buffer *buffer,
+ void **raw_value,
+ unsigned int *raw_value_size)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ enum mrb_vtype mrb_value_type;
+ grn_bool try_cast = GRN_FALSE;
+ grn_obj *from_bulk = NULL;
+
+ if (mrb_nil_p(mrb_value_)) {
+ *raw_value = NULL;
+ *raw_value_size = 0;
+ return;
+ }
+
+ mrb_value_type = mrb_type(mrb_value_);
+
+ switch (mrb_value_type) {
+ case MRB_TT_STRING :
+ switch (domain_id) {
+ case GRN_DB_SHORT_TEXT :
+ case GRN_DB_TEXT :
+ case GRN_DB_LONG_TEXT :
+ *raw_value = RSTRING_PTR(mrb_value_);
+ *raw_value_size = RSTRING_LEN(mrb_value_);
+ break;
+ default :
+ try_cast = GRN_TRUE;
+ break;
+ }
+ break;
+ default :
+ {
+ struct RClass *klass;
+ grn_mrb_data *data = &(ctx->impl->mrb);
+
+ klass = mrb_class(mrb, mrb_value_);
+ if (domain_id == GRN_DB_TIME &&
+ klass == data->builtin.time_class) {
+ mrb_value mrb_sec;
+ mrb_value mrb_usec;
+
+ mrb_sec = mrb_funcall(mrb, mrb_value_, "to_i", 0);
+ mrb_usec = mrb_funcall(mrb, mrb_value_, "usec", 0);
+ buffer->value.time_value = GRN_TIME_PACK(mrb_fixnum(mrb_sec),
+ mrb_fixnum(mrb_usec));
+ *raw_value = &(buffer->value.time_value);
+ *raw_value_size = sizeof(buffer->value.time_value);
+ } else {
+ try_cast = GRN_TRUE;
+ if (mrb_value_type == MRB_TT_DATA &&
+ klass == mrb_class_get_under(mrb, data->module, "Bulk")) {
+ from_bulk = DATA_PTR(mrb_value_);
+ }
+ }
+ }
+ break;
+ }
+
+ if (!try_cast) {
+ return;
+ }
+
+ if (!from_bulk) {
+ from_bulk = &(buffer->from);
+ grn_mrb_value_to_bulk(mrb, mrb_value_, from_bulk);
+ }
+ if (!grn_mrb_bulk_cast(mrb, from_bulk, &(buffer->to), domain_id)) {
+ grn_obj *domain;
+ char domain_name[GRN_TABLE_MAX_KEY_SIZE];
+ int domain_name_size;
+
+ domain = grn_ctx_at(ctx, domain_id);
+ domain_name_size = grn_obj_name(ctx, domain, domain_name,
+ GRN_TABLE_MAX_KEY_SIZE);
+ mrb_raisef(mrb, E_ARGUMENT_ERROR,
+ "%S: failed to convert to %S: %S",
+ mrb_str_new_static(mrb, context, strlen(context)),
+ mrb_str_new_static(mrb, domain_name, domain_name_size),
+ mrb_value_);
+ }
+ *raw_value = GRN_BULK_HEAD(&(buffer->to));
+ *raw_value_size = GRN_BULK_VSIZE(&(buffer->to));
+}
struct RClass *
grn_mrb_class_from_grn_obj(mrb_state *mrb, grn_obj *object)
@@ -34,12 +145,12 @@ grn_mrb_class_from_grn_obj(mrb_state *mrb, grn_obj *object)
data = &(ctx->impl->mrb);
switch (object->header.type) {
- case GRN_ACCESSOR :
- klass = mrb_class_get_under(mrb, data->module, "Accessor");
- break;
case GRN_BULK :
klass = mrb_class_get_under(mrb, data->module, "Bulk");
break;
+ case GRN_ACCESSOR :
+ klass = mrb_class_get_under(mrb, data->module, "Accessor");
+ break;
case GRN_COLUMN_FIX_SIZE :
klass = mrb_class_get_under(mrb, data->module, "FixedSizeColumn");
break;
@@ -49,12 +160,30 @@ grn_mrb_class_from_grn_obj(mrb_state *mrb, grn_obj *object)
case GRN_COLUMN_INDEX :
klass = mrb_class_get_under(mrb, data->module, "IndexColumn");
break;
- case GRN_EXPR :
- klass = mrb_class_get_under(mrb, data->module, "Expression");
+ case GRN_TYPE :
+ klass = mrb_class_get_under(mrb, data->module, "Type");
break;
case GRN_PROC :
klass = mrb_class_get_under(mrb, data->module, "Procedure");
break;
+ case GRN_EXPR :
+ klass = mrb_class_get_under(mrb, data->module, "Expression");
+ break;
+ case GRN_TABLE_NO_KEY :
+ klass = mrb_class_get_under(mrb, data->module, "Array");
+ break;
+ case GRN_TABLE_HASH_KEY :
+ klass = mrb_class_get_under(mrb, data->module, "HashTable");
+ break;
+ case GRN_TABLE_PAT_KEY :
+ klass = mrb_class_get_under(mrb, data->module, "PatriciaTrie");
+ break;
+ case GRN_TABLE_DAT_KEY :
+ klass = mrb_class_get_under(mrb, data->module, "DoubleArrayTrie");
+ break;
+ case GRN_DB :
+ klass = mrb_class_get_under(mrb, data->module, "Database");
+ break;
case GRN_VOID :
klass = mrb_class_get_under(mrb, data->module, "Void");
break;
@@ -65,8 +194,8 @@ grn_mrb_class_from_grn_obj(mrb_state *mrb, grn_obj *object)
if (!klass) {
#define BUFFER_SIZE 1024
char buffer[BUFFER_SIZE];
- snprintf(buffer, BUFFER_SIZE - 1,
- "can't find class for object type: %#x", object->header.type);
+ grn_snprintf(buffer, BUFFER_SIZE, BUFFER_SIZE,
+ "can't find class for object type: %#x", object->header.type);
mrb_raise(mrb, E_ARGUMENT_ERROR, buffer);
#undef BUFFER_SIZE
}
@@ -90,4 +219,71 @@ grn_mrb_value_from_grn_obj(mrb_state *mrb, grn_obj *object)
mrb_object = mrb_obj_new(mrb, mrb_class, 1, mrb_new_arguments);
return mrb_object;
}
+
+grn_id
+grn_mrb_class_to_type(mrb_state *mrb, struct RClass *klass)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ grn_id type = GRN_DB_VOID;
+
+ if (klass == mrb->nil_class) {
+ type = GRN_DB_VOID;
+ } else if (klass == mrb->true_class ||
+ klass == mrb->false_class) {
+ type = GRN_DB_BOOL;
+ } else if (klass == mrb->symbol_class) {
+ type = GRN_DB_TEXT;
+ } else if (klass == mrb->fixnum_class) {
+ type = GRN_DB_INT64;
+ } else if (klass == mrb->float_class) {
+ type = GRN_DB_FLOAT;
+ } else if (klass == mrb->string_class) {
+ type = GRN_DB_TEXT;
+ } else if (klass == ctx->impl->mrb.builtin.time_class) {
+ type = GRN_DB_TIME;
+ } else {
+ mrb_raisef(mrb, E_ARGUMENT_ERROR,
+ "unsupported class: %S", mrb_obj_value(klass));
+ }
+
+ return type;
+}
+
+static mrb_value
+mrb_grn_converter_singleton_convert(mrb_state *mrb, mrb_value klass)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ grn_obj *from = &(ctx->impl->mrb.buffer.from);
+ grn_obj *to = &(ctx->impl->mrb.buffer.to);
+ mrb_value mrb_from;
+ mrb_value mrb_to_class;
+ grn_id to_type;
+
+ mrb_get_args(mrb, "oC", &mrb_from, &mrb_to_class);
+
+ grn_mrb_value_to_bulk(mrb, mrb_from, from);
+ to_type = grn_mrb_class_to_type(mrb, mrb_class_ptr(mrb_to_class));
+ if (!grn_mrb_bulk_cast(mrb, from, to, to_type)) {
+ mrb_raisef(mrb, E_ARGUMENT_ERROR,
+ "failed to convert to %S: %S",
+ mrb_to_class,
+ mrb_from);
+ }
+
+ return grn_mrb_value_from_bulk(mrb, to);
+}
+
+void
+grn_mrb_converter_init(grn_ctx *ctx)
+{
+ grn_mrb_data *data = &(ctx->impl->mrb);
+ mrb_state *mrb = data->state;
+ struct RClass *module;
+
+ module = mrb_define_module_under(mrb, data->module, "Converter");
+
+ mrb_define_singleton_method(mrb, (struct RObject *)module, "convert",
+ mrb_grn_converter_singleton_convert,
+ MRB_ARGS_REQ(2));
+}
#endif
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_converter.h b/storage/mroonga/vendor/groonga/lib/mrb/mrb_converter.h
index 27223a8c0bf..c2cb58c0e6d 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/mrb_converter.h
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_converter.h
@@ -19,16 +19,39 @@
#ifndef GRN_MRB_CONVERTER_H
#define GRN_MRB_CONVERTER_H
-#include "../ctx.h"
+#include "../grn_ctx.h"
#ifdef __cplusplus
extern "C" {
#endif
-#ifdef GRN_WITH_MRUBY
+void grn_mrb_converter_init(grn_ctx *ctx);
+
+typedef struct {
+ grn_obj from;
+ grn_obj to;
+ union {
+ int64_t time_value;
+ } value;
+} grn_mrb_value_to_raw_data_buffer;
+
+void grn_mrb_value_to_raw_data_buffer_init(mrb_state *mrb,
+ grn_mrb_value_to_raw_data_buffer *buffer);
+void grn_mrb_value_to_raw_data_buffer_fin(mrb_state *mrb,
+ grn_mrb_value_to_raw_data_buffer *buffer);
+void grn_mrb_value_to_raw_data(mrb_state *mrb,
+ const char *context,
+ mrb_value mrb_value_,
+ grn_id domain_id,
+ grn_mrb_value_to_raw_data_buffer *buffer,
+ void **raw_value,
+ unsigned int *raw_value_size);
+
struct RClass *grn_mrb_class_from_grn_obj(mrb_state *mrb, grn_obj *object);
mrb_value grn_mrb_value_from_grn_obj(mrb_state *mrb, grn_obj *object);
-#endif
+
+grn_id grn_mrb_class_to_grn_type(mrb_state *mrb, struct RClass *klass);
+grn_id grn_mrb_value_to_grn_type(mrb_state *mrb, mrb_value value);
#ifdef __cplusplus
}
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_ctx.c b/storage/mroonga/vendor/groonga/lib/mrb/mrb_ctx.c
index 3f7bc36202d..3814313f3d0 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/mrb_ctx.c
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_ctx.c
@@ -1,6 +1,6 @@
/* -*- c-basic-offset: 2 -*- */
/*
- Copyright(C) 2013-2014 Brazil
+ Copyright(C) 2013-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,7 +16,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "../ctx_impl.h"
+#include "../grn_ctx_impl.h"
#ifdef GRN_WITH_MRUBY
#include <mruby.h>
@@ -25,7 +25,7 @@
#include <mruby/variable.h>
#include <mruby/string.h>
-#include "../mrb.h"
+#include "../grn_mrb.h"
#include "mrb_ctx.h"
#include "mrb_converter.h"
@@ -53,12 +53,26 @@ static mrb_value
ctx_array_reference(mrb_state *mrb, mrb_value self)
{
grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ mrb_value mrb_id_or_name;
grn_obj *object;
- char *name;
- int name_length;
- mrb_get_args(mrb, "s", &name, &name_length);
- object = grn_ctx_get(ctx, name, name_length);
+ mrb_get_args(mrb, "o", &mrb_id_or_name);
+
+ if (mrb_nil_p(mrb_id_or_name)) {
+ return mrb_nil_value();
+ }
+
+ if (mrb_fixnum_p(mrb_id_or_name)) {
+ grn_id id = mrb_fixnum(mrb_id_or_name);
+ object = grn_ctx_at(ctx, id);
+ } else {
+ mrb_value mrb_name;
+ mrb_name = mrb_convert_type(mrb, mrb_id_or_name,
+ MRB_TT_STRING, "String", "to_str");
+ object = grn_ctx_get(ctx,
+ RSTRING_PTR(mrb_name),
+ RSTRING_LEN(mrb_name));
+ }
return grn_mrb_value_from_grn_obj(mrb, object);
}
@@ -187,6 +201,14 @@ ctx_set_error_message(mrb_state *mrb, mrb_value self)
return error_message;
}
+static mrb_value
+ctx_get_database(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+
+ return grn_mrb_value_from_grn_obj(mrb, grn_ctx_db(ctx));
+}
+
void
grn_mrb_ctx_check(mrb_state *mrb)
{
@@ -202,449 +224,449 @@ grn_mrb_ctx_check(mrb_state *mrb)
return;
case GRN_END_OF_DATA:
error_class = mrb_class_get_under(mrb, module, "EndOfData");
- snprintf(message, MESSAGE_SIZE,
- "end of data: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "end of data: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_UNKNOWN_ERROR:
error_class = mrb_class_get_under(mrb, module, "UnknownError");
- snprintf(message, MESSAGE_SIZE,
- "unknown error: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "unknown error: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_OPERATION_NOT_PERMITTED:
error_class = mrb_class_get_under(mrb, module, "OperationNotPermitted");
- snprintf(message, MESSAGE_SIZE,
- "operation not permitted: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "operation not permitted: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_NO_SUCH_FILE_OR_DIRECTORY:
error_class = mrb_class_get_under(mrb, module, "NoSuchFileOrDirectory");
- snprintf(message, MESSAGE_SIZE,
- "no such file or directory: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "no such file or directory: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_NO_SUCH_PROCESS:
error_class = mrb_class_get_under(mrb, module, "NoSuchProcess");
- snprintf(message, MESSAGE_SIZE,
- "no such process: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "no such process: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_INTERRUPTED_FUNCTION_CALL:
error_class = mrb_class_get_under(mrb, module, "InterruptedFunctionCall");
- snprintf(message, MESSAGE_SIZE,
- "interrupted function call: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "interrupted function call: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_INPUT_OUTPUT_ERROR:
error_class = mrb_class_get_under(mrb, module, "InputOutputError");
- snprintf(message, MESSAGE_SIZE,
- "input output error: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "input output error: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_NO_SUCH_DEVICE_OR_ADDRESS:
error_class = mrb_class_get_under(mrb, module, "NoSuchDeviceOrAddress");
- snprintf(message, MESSAGE_SIZE,
- "no such device or address: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "no such device or address: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_ARG_LIST_TOO_LONG:
error_class = mrb_class_get_under(mrb, module, "ArgListTooLong");
- snprintf(message, MESSAGE_SIZE,
- "arg list too long: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "arg list too long: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_EXEC_FORMAT_ERROR:
error_class = mrb_class_get_under(mrb, module, "ExecFormatError");
- snprintf(message, MESSAGE_SIZE,
- "exec format error: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "exec format error: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_BAD_FILE_DESCRIPTOR:
error_class = mrb_class_get_under(mrb, module, "BadFileDescriptor");
- snprintf(message, MESSAGE_SIZE,
- "bad file descriptor: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "bad file descriptor: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_NO_CHILD_PROCESSES:
error_class = mrb_class_get_under(mrb, module, "NoChildProcesses");
- snprintf(message, MESSAGE_SIZE,
- "no child processes: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "no child processes: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_RESOURCE_TEMPORARILY_UNAVAILABLE:
error_class = mrb_class_get_under(mrb, module,
"ResourceTemporarilyUnavailable");
- snprintf(message, MESSAGE_SIZE,
- "resource temporarily unavailable: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "resource temporarily unavailable: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_NOT_ENOUGH_SPACE:
error_class = mrb_class_get_under(mrb, module, "NotEnoughSpace");
- snprintf(message, MESSAGE_SIZE,
- "not enough space: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "not enough space: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_PERMISSION_DENIED:
error_class = mrb_class_get_under(mrb, module, "PermissionDenied");
- snprintf(message, MESSAGE_SIZE,
- "permission denied: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "permission denied: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_BAD_ADDRESS:
error_class = mrb_class_get_under(mrb, module, "BadAddress");
- snprintf(message, MESSAGE_SIZE,
- "bad address: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "bad address: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_RESOURCE_BUSY:
error_class = mrb_class_get_under(mrb, module, "ResourceBusy");
- snprintf(message, MESSAGE_SIZE,
- "resource busy: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "resource busy: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_FILE_EXISTS:
error_class = mrb_class_get_under(mrb, module, "FileExists");
- snprintf(message, MESSAGE_SIZE,
- "file exists: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "file exists: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_IMPROPER_LINK:
error_class = mrb_class_get_under(mrb, module, "ImproperLink");
- snprintf(message, MESSAGE_SIZE,
- "improper link: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "improper link: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_NO_SUCH_DEVICE:
error_class = mrb_class_get_under(mrb, module, "NoSuchDevice");
- snprintf(message, MESSAGE_SIZE,
- "no such device: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "no such device: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_NOT_A_DIRECTORY:
error_class = mrb_class_get_under(mrb, module, "NotDirectory");
- snprintf(message, MESSAGE_SIZE,
- "not directory: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "not directory: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_IS_A_DIRECTORY:
error_class = mrb_class_get_under(mrb, module, "IsDirectory");
- snprintf(message, MESSAGE_SIZE,
- "is directory: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "is directory: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_INVALID_ARGUMENT:
error_class = mrb_class_get_under(mrb, module, "InvalidArgument");
- snprintf(message, MESSAGE_SIZE,
- "invalid argument: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "invalid argument: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_TOO_MANY_OPEN_FILES_IN_SYSTEM:
error_class = mrb_class_get_under(mrb, module, "TooManyOpenFilesInSystem");
- snprintf(message, MESSAGE_SIZE,
- "too many open files in system: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "too many open files in system: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_TOO_MANY_OPEN_FILES:
error_class = mrb_class_get_under(mrb, module, "TooManyOpenFiles");
- snprintf(message, MESSAGE_SIZE,
- "too many open files: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "too many open files: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_INAPPROPRIATE_I_O_CONTROL_OPERATION:
error_class = mrb_class_get_under(mrb, module,
"InappropriateIOControlOperation");
- snprintf(message, MESSAGE_SIZE,
- "inappropriate IO control operation: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "inappropriate IO control operation: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_FILE_TOO_LARGE:
error_class = mrb_class_get_under(mrb, module, "FileTooLarge");
- snprintf(message, MESSAGE_SIZE,
- "file too large: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "file too large: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_NO_SPACE_LEFT_ON_DEVICE:
error_class = mrb_class_get_under(mrb, module, "NoSpaceLeftOnDevice");
- snprintf(message, MESSAGE_SIZE,
- "no space left on device: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "no space left on device: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_INVALID_SEEK:
error_class = mrb_class_get_under(mrb, module, "InvalidSeek");
- snprintf(message, MESSAGE_SIZE,
- "invalid seek: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "invalid seek: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_READ_ONLY_FILE_SYSTEM:
error_class = mrb_class_get_under(mrb, module, "ReadOnlyFileSystem");
- snprintf(message, MESSAGE_SIZE,
- "read only file system: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "read only file system: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_TOO_MANY_LINKS:
error_class = mrb_class_get_under(mrb, module, "TooManyLinks");
- snprintf(message, MESSAGE_SIZE,
- "too many links: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "too many links: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_BROKEN_PIPE:
error_class = mrb_class_get_under(mrb, module, "BrokenPipe");
- snprintf(message, MESSAGE_SIZE,
- "broken pipe: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "broken pipe: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_DOMAIN_ERROR:
error_class = mrb_class_get_under(mrb, module, "DomainError");
- snprintf(message, MESSAGE_SIZE,
- "domain error: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "domain error: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_RESULT_TOO_LARGE:
error_class = mrb_class_get_under(mrb, module, "ResultTooLarge");
- snprintf(message, MESSAGE_SIZE,
- "result too large: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "result too large: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_RESOURCE_DEADLOCK_AVOIDED:
error_class = mrb_class_get_under(mrb, module, "ResourceDeadlockAvoided");
- snprintf(message, MESSAGE_SIZE,
- "resource deadlock avoided: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "resource deadlock avoided: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_NO_MEMORY_AVAILABLE:
error_class = mrb_class_get_under(mrb, module, "NoMemoryAvailable");
- snprintf(message, MESSAGE_SIZE,
- "no memory available: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "no memory available: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_FILENAME_TOO_LONG:
error_class = mrb_class_get_under(mrb, module, "FilenameTooLong");
- snprintf(message, MESSAGE_SIZE,
- "filename too long: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "filename too long: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_NO_LOCKS_AVAILABLE:
error_class = mrb_class_get_under(mrb, module, "NoLocksAvailable");
- snprintf(message, MESSAGE_SIZE,
- "no locks available: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "no locks available: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_FUNCTION_NOT_IMPLEMENTED:
error_class = mrb_class_get_under(mrb, module, "FunctionNotImplemented");
- snprintf(message, MESSAGE_SIZE,
- "function not implemented: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "function not implemented: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_DIRECTORY_NOT_EMPTY:
error_class = mrb_class_get_under(mrb, module, "DirectoryNotEmpty");
- snprintf(message, MESSAGE_SIZE,
- "directory not empty: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "directory not empty: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_ILLEGAL_BYTE_SEQUENCE:
error_class = mrb_class_get_under(mrb, module, "IllegalByteSequence");
- snprintf(message, MESSAGE_SIZE,
- "illegal byte sequence: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "illegal byte sequence: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_SOCKET_NOT_INITIALIZED:
error_class = mrb_class_get_under(mrb, module, "SocketNotInitialized");
- snprintf(message, MESSAGE_SIZE,
- "socket not initialized: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "socket not initialized: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_OPERATION_WOULD_BLOCK:
error_class = mrb_class_get_under(mrb, module, "OperationWouldBlock");
- snprintf(message, MESSAGE_SIZE,
- "operation would block: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "operation would block: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_ADDRESS_IS_NOT_AVAILABLE:
error_class = mrb_class_get_under(mrb, module, "AddressIsNotAvailable");
- snprintf(message, MESSAGE_SIZE,
- "address is not available: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "address is not available: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_NETWORK_IS_DOWN:
error_class = mrb_class_get_under(mrb, module, "NetworkIsDown");
- snprintf(message, MESSAGE_SIZE,
- "network is down: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "network is down: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_NO_BUFFER:
error_class = mrb_class_get_under(mrb, module, "NoBuffer");
- snprintf(message, MESSAGE_SIZE,
- "no buffer: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "no buffer: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_SOCKET_IS_ALREADY_CONNECTED:
error_class = mrb_class_get_under(mrb, module, "SocketIsAlreadyConnected");
- snprintf(message, MESSAGE_SIZE,
- "socket is already connected: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "socket is already connected: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_SOCKET_IS_NOT_CONNECTED:
error_class = mrb_class_get_under(mrb, module, "SocketIsNotConnected");
- snprintf(message, MESSAGE_SIZE,
- "socket is not connected: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "socket is not connected: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_SOCKET_IS_ALREADY_SHUTDOWNED:
error_class = mrb_class_get_under(mrb, module, "SocketIsAlreadyShutdowned");
- snprintf(message, MESSAGE_SIZE,
- "socket is already shutdowned: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "socket is already shutdowned: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_OPERATION_TIMEOUT:
error_class = mrb_class_get_under(mrb, module, "OperationTimeout");
- snprintf(message, MESSAGE_SIZE,
- "operation timeout: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "operation timeout: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_CONNECTION_REFUSED:
error_class = mrb_class_get_under(mrb, module, "ConnectionRefused");
- snprintf(message, MESSAGE_SIZE,
- "connection refused: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "connection refused: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_RANGE_ERROR:
error_class = mrb_class_get_under(mrb, module, "RangeError");
- snprintf(message, MESSAGE_SIZE,
- "range error: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "range error: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_TOKENIZER_ERROR:
error_class = mrb_class_get_under(mrb, module, "TokenizerError");
- snprintf(message, MESSAGE_SIZE,
- "tokenizer error: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "tokenizer error: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_FILE_CORRUPT:
error_class = mrb_class_get_under(mrb, module, "FileCorrupt");
- snprintf(message, MESSAGE_SIZE,
- "file corrupt: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "file corrupt: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_INVALID_FORMAT:
error_class = mrb_class_get_under(mrb, module, "InvalidFormat");
- snprintf(message, MESSAGE_SIZE,
- "invalid format: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "invalid format: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_OBJECT_CORRUPT:
error_class = mrb_class_get_under(mrb, module, "ObjectCorrupt");
- snprintf(message, MESSAGE_SIZE,
- "object corrupt: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "object corrupt: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_TOO_MANY_SYMBOLIC_LINKS:
error_class = mrb_class_get_under(mrb, module, "TooManySymbolicLinks");
- snprintf(message, MESSAGE_SIZE,
- "too many symbolic links: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "too many symbolic links: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_NOT_SOCKET:
error_class = mrb_class_get_under(mrb, module, "NotSocket");
- snprintf(message, MESSAGE_SIZE,
- "not socket: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "not socket: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_OPERATION_NOT_SUPPORTED:
error_class = mrb_class_get_under(mrb, module, "OperationNotSupported");
- snprintf(message, MESSAGE_SIZE,
- "operation not supported: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "operation not supported: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_ADDRESS_IS_IN_USE:
error_class = mrb_class_get_under(mrb, module, "AddressIsInUse");
- snprintf(message, MESSAGE_SIZE,
- "address is in use: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "address is in use: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_ZLIB_ERROR:
error_class = mrb_class_get_under(mrb, module, "ZlibError");
- snprintf(message, MESSAGE_SIZE,
- "zlib error: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "zlib error: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
- case GRN_LZO_ERROR:
- error_class = mrb_class_get_under(mrb, module, "LzoError");
- snprintf(message, MESSAGE_SIZE,
- "LZO error: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ case GRN_LZ4_ERROR:
+ error_class = mrb_class_get_under(mrb, module, "LZ4Error");
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "LZ4 error: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_STACK_OVER_FLOW:
error_class = mrb_class_get_under(mrb, module, "StackOverFlow");
- snprintf(message, MESSAGE_SIZE,
- "stack over flow: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "stack over flow: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_SYNTAX_ERROR:
error_class = mrb_class_get_under(mrb, module, "SyntaxError");
- snprintf(message, MESSAGE_SIZE,
- "syntax error: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "syntax error: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_RETRY_MAX:
error_class = mrb_class_get_under(mrb, module, "RetryMax");
- snprintf(message, MESSAGE_SIZE,
- "retry max: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "retry max: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_INCOMPATIBLE_FILE_FORMAT:
error_class = mrb_class_get_under(mrb, module, "IncompatibleFileFormat");
- snprintf(message, MESSAGE_SIZE,
- "incompatible file format: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "incompatible file format: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_UPDATE_NOT_ALLOWED:
error_class = mrb_class_get_under(mrb, module, "UpdateNotAllowed");
- snprintf(message, MESSAGE_SIZE,
- "update not allowed: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "update not allowed: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_TOO_SMALL_OFFSET:
error_class = mrb_class_get_under(mrb, module, "TooSmallOffset");
- snprintf(message, MESSAGE_SIZE,
- "too small offset: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "too small offset: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_TOO_LARGE_OFFSET:
error_class = mrb_class_get_under(mrb, module, "TooLargeOffset");
- snprintf(message, MESSAGE_SIZE,
- "too large offset: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "too large offset: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_TOO_SMALL_LIMIT:
error_class = mrb_class_get_under(mrb, module, "TooSmallLimit");
- snprintf(message, MESSAGE_SIZE,
- "too small limit: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "too small limit: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_CAS_ERROR:
error_class = mrb_class_get_under(mrb, module, "CASError");
- snprintf(message, MESSAGE_SIZE,
- "CAS error: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "CAS error: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_UNSUPPORTED_COMMAND_VERSION:
error_class = mrb_class_get_under(mrb, module, "UnsupportedCommandVersion");
- snprintf(message, MESSAGE_SIZE,
- "unsupported command version: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "unsupported command version: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
case GRN_NORMALIZER_ERROR:
error_class = mrb_class_get_under(mrb, module, "NormalizerError");
- snprintf(message, MESSAGE_SIZE,
- "normalizer error: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "normalizer error: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
default:
error_class = mrb_class_get_under(mrb, module, "Error");
- snprintf(message, MESSAGE_SIZE,
- "unsupported error: <%s>(%d)",
- ctx->errbuf, ctx->rc);
+ grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+ "unsupported error: <%s>(%d)",
+ ctx->errbuf, ctx->rc);
break;
}
#undef MESSAGE_SIZE
@@ -690,8 +712,7 @@ grn_mrb_ctx_init(grn_ctx *ctx)
mrb_define_method(mrb, klass, "error_message=", ctx_set_error_message,
MRB_ARGS_REQ(1));
- grn_mrb_load(ctx, "context/error_level.rb");
- grn_mrb_load(ctx, "context/rc.rb");
- grn_mrb_load(ctx, "context.rb");
+ mrb_define_method(mrb, klass, "database", ctx_get_database,
+ MRB_ARGS_NONE());
}
#endif
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_ctx.h b/storage/mroonga/vendor/groonga/lib/mrb/mrb_ctx.h
index 5068d0d75e2..aa527bfec51 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/mrb_ctx.h
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_ctx.h
@@ -19,16 +19,14 @@
#ifndef GRN_MRB_CTX_H
#define GRN_MRB_CTX_H
-#include "../ctx.h"
+#include "../grn_ctx.h"
#ifdef __cplusplus
extern "C" {
#endif
void grn_mrb_ctx_init(grn_ctx *ctx);
-#ifdef GRN_WITH_MRUBY
void grn_mrb_ctx_check(mrb_state *mrb);
-#endif
#ifdef __cplusplus
}
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_database.c b/storage/mroonga/vendor/groonga/lib/mrb/mrb_database.c
new file mode 100644
index 00000000000..22994104add
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_database.c
@@ -0,0 +1,124 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2014 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
+*/
+
+#include "../grn_ctx_impl.h"
+
+#ifdef GRN_WITH_MRUBY
+#include <mruby.h>
+#include <mruby/class.h>
+#include <mruby/data.h>
+
+#include "mrb_ctx.h"
+#include "mrb_database.h"
+
+static struct mrb_data_type mrb_grn_database_type = {
+ "Groonga::Database",
+ NULL
+};
+
+static mrb_value
+mrb_grn_database_initialize(mrb_state *mrb, mrb_value self)
+{
+ mrb_value mrb_database_ptr;
+
+ mrb_get_args(mrb, "o", &mrb_database_ptr);
+ DATA_TYPE(self) = &mrb_grn_database_type;
+ DATA_PTR(self) = mrb_cptr(mrb_database_ptr);
+ return self;
+}
+
+static mrb_value
+mrb_grn_database_singleton_open(mrb_state *mrb, mrb_value klass)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ grn_obj *database;
+ char *path;
+
+ mrb_get_args(mrb, "z", &path);
+
+ database = grn_db_open(ctx, path);
+ grn_mrb_ctx_check(mrb);
+
+ return mrb_funcall(mrb, klass, "new", 1, mrb_cptr_value(mrb, database));
+}
+
+static mrb_value
+mrb_grn_database_singleton_create(mrb_state *mrb, mrb_value klass)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ grn_obj *database;
+ char *path;
+
+ mrb_get_args(mrb, "z", &path);
+
+ database = grn_db_create(ctx, path, NULL);
+ grn_mrb_ctx_check(mrb);
+
+ return mrb_funcall(mrb, klass, "new", 1, mrb_cptr_value(mrb, database));
+}
+
+static mrb_value
+mrb_grn_database_recover(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+
+ grn_db_recover(ctx, DATA_PTR(self));
+ grn_mrb_ctx_check(mrb);
+
+ return mrb_nil_value();
+}
+
+static mrb_value
+mrb_grn_database_is_locked(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ unsigned int is_locked;
+
+ is_locked = grn_obj_is_locked(ctx, DATA_PTR(self));
+ grn_mrb_ctx_check(mrb);
+
+ return mrb_bool_value(is_locked != 0);
+}
+
+void
+grn_mrb_database_init(grn_ctx *ctx)
+{
+ grn_mrb_data *data = &(ctx->impl->mrb);
+ mrb_state *mrb = data->state;
+ struct RClass *module = data->module;
+ struct RClass *object_class = data->object_class;
+ struct RClass *klass;
+
+ klass = mrb_define_class_under(mrb, module, "Database", object_class);
+ MRB_SET_INSTANCE_TT(klass, MRB_TT_DATA);
+
+ mrb_define_singleton_method(mrb, (struct RObject *)klass, "open",
+ mrb_grn_database_singleton_open,
+ MRB_ARGS_REQ(1));
+ mrb_define_singleton_method(mrb, (struct RObject *)klass, "create",
+ mrb_grn_database_singleton_create,
+ MRB_ARGS_REQ(1));
+
+ mrb_define_method(mrb, klass, "initialize",
+ mrb_grn_database_initialize, MRB_ARGS_REQ(1));
+ mrb_define_method(mrb, klass, "recover",
+ mrb_grn_database_recover, MRB_ARGS_NONE());
+ mrb_define_method(mrb, klass, "locked?",
+ mrb_grn_database_is_locked, MRB_ARGS_NONE());
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_database.h b/storage/mroonga/vendor/groonga/lib/mrb/mrb_database.h
new file mode 100644
index 00000000000..fd319c55fd1
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_database.h
@@ -0,0 +1,34 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2014 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
+*/
+
+#ifndef GRN_MRB_DATABASE_H
+#define GRN_MRB_DATABASE_H
+
+#include "../grn_ctx.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void grn_mrb_database_init(grn_ctx *ctx);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRN_MRB_DATABASE_H */
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_double_array_trie.c b/storage/mroonga/vendor/groonga/lib/mrb/mrb_double_array_trie.c
new file mode 100644
index 00000000000..5c034090b29
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_double_array_trie.c
@@ -0,0 +1,60 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2014 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
+*/
+
+#include "../grn_ctx_impl.h"
+
+#ifdef GRN_WITH_MRUBY
+#include <mruby.h>
+#include <mruby/class.h>
+#include <mruby/data.h>
+
+#include "mrb_double_array_trie.h"
+
+static struct mrb_data_type mrb_grn_double_array_trie_type = {
+ "Groonga::DoubleArrayTrie",
+ NULL
+};
+
+static mrb_value
+mrb_grn_double_array_trie_initialize(mrb_state *mrb, mrb_value self)
+{
+ mrb_value mrb_double_array_trie_ptr;
+
+ mrb_get_args(mrb, "o", &mrb_double_array_trie_ptr);
+ DATA_TYPE(self) = &mrb_grn_double_array_trie_type;
+ DATA_PTR(self) = mrb_cptr(mrb_double_array_trie_ptr);
+ return self;
+}
+
+void
+grn_mrb_double_array_trie_init(grn_ctx *ctx)
+{
+ grn_mrb_data *data = &(ctx->impl->mrb);
+ mrb_state *mrb = data->state;
+ struct RClass *module = data->module;
+ struct RClass *table_class;
+ struct RClass *klass;
+
+ table_class = mrb_class_get_under(mrb, module, "Table");
+ klass = mrb_define_class_under(mrb, module, "DoubleArrayTrie", table_class);
+ MRB_SET_INSTANCE_TT(klass, MRB_TT_DATA);
+
+ mrb_define_method(mrb, klass, "initialize",
+ mrb_grn_double_array_trie_initialize, MRB_ARGS_REQ(1));
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_double_array_trie.h b/storage/mroonga/vendor/groonga/lib/mrb/mrb_double_array_trie.h
new file mode 100644
index 00000000000..a69a94e556e
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_double_array_trie.h
@@ -0,0 +1,34 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2014 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
+*/
+
+#ifndef GRN_MRB_DOUBLE_ARRAY_TRIE_H
+#define GRN_MRB_DOUBLE_ARRAY_TRIE_H
+
+#include "../grn_ctx.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void grn_mrb_double_array_trie_init(grn_ctx *ctx);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRN_MRB_DOUBLE_ARRAY_TRIE_H */
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_error.c b/storage/mroonga/vendor/groonga/lib/mrb/mrb_error.c
index 2f45cfc736e..a3513be1118 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/mrb_error.c
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_error.c
@@ -16,12 +16,12 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "../ctx_impl.h"
+#include "../grn_ctx_impl.h"
#ifdef GRN_WITH_MRUBY
#include <mruby.h>
-#include "../mrb.h"
+#include "../grn_mrb.h"
#include "mrb_error.h"
void
@@ -31,155 +31,164 @@ grn_mrb_error_init(grn_ctx *ctx)
mrb_state *mrb = data->state;
struct RClass *module = data->module;
struct RClass *error_class;
+ struct RClass *groonga_error_class;
error_class = mrb_define_class_under(mrb, module, "Error",
mrb->eStandardError_class);
+ groonga_error_class = mrb_define_class_under(mrb, module, "GroongaError",
+ error_class);
mrb_define_class_under(mrb, module, "EndOfData",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "UnknownError",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "OperationNotPermitted",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "NoSuchFileOrDirectory",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "NoSuchProcess",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "InterruptedFunctionCall",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "InputOutputError",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "NoSuchDeviceOrAddress",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "ArgListTooLong",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "ExecFormatError",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "BadFileDescriptor",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "NoChildProcesses",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "ResourceTemporarilyUnavailable",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "NotEnoughSpace",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "PermissionDenied",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "BadAddress",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "ResourceBusy",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "FileExists",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "ImproperLink",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "NoSuchDevice",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "NotDirectory",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "IsDirectory",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "InvalidArgument",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "TooManyOpenFilesInSystem",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "TooManyOpenFiles",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "InappropriateIOControlOperation",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "FileTooLarge",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "NoSpaceLeftOnDevice",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "InvalidSeek",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "ReadOnlyFileSystem",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "TooManyLinks",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "BrokenPipe",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "DomainError",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "ResultTooLarge",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "ResourceDeadlockAvoided",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "NoMemoryAvailable",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "FilenameTooLong",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "NoLocksAvailable",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "FunctionNotImplemented",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "DirectoryNotEmpty",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "IllegalByteSequence",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "SocketNotInitialized",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "OperationWouldBlock",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "AddressIsNotAvailable",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "NetworkIsDown",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "NoBuffer",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "SocketIsAlreadyConnected",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "SocketIsNotConnected",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "SocketIsAlreadyShutdowned",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "OperationTimeout",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "ConnectionRefused",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "RangeError",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "TokenizerError",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "FileCorrupt",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "InvalidFormat",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "ObjectCorrupt",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "TooManySymbolicLinks",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "NotSocket",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "OperationNotSupported",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "AddressIsInUse",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "ZlibError",
- error_class);
- mrb_define_class_under(mrb, module, "LzoError",
- error_class);
+ groonga_error_class);
+ mrb_define_class_under(mrb, module, "LZ4Error",
+ groonga_error_class);
mrb_define_class_under(mrb, module, "StackOverFlow",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "SyntaxError",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "RetryMax",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "IncompatibleFileFormat",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "UpdateNotAllowed",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "TooSmallOffset",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "TooLargeOffset",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "TooSmallLimit",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "CASError",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "UnsupportedCommandVersion",
- error_class);
+ groonga_error_class);
mrb_define_class_under(mrb, module, "NormalizerError",
- error_class);
+ groonga_error_class);
+ mrb_define_class_under(mrb, module, "TokenFilterError",
+ groonga_error_class);
+ mrb_define_class_under(mrb, module, "CommandError",
+ groonga_error_class);
+ mrb_define_class_under(mrb, module, "PluginError",
+ groonga_error_class);
}
#endif
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_error.h b/storage/mroonga/vendor/groonga/lib/mrb/mrb_error.h
index c59fabc12af..c68c58fa273 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/mrb_error.h
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_error.h
@@ -19,7 +19,7 @@
#ifndef GRN_MRB_ERROR_H
#define GRN_MRB_ERROR_H
-#include "../ctx.h"
+#include "../grn_ctx.h"
#ifdef __cplusplus
extern "C" {
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_expr.c b/storage/mroonga/vendor/groonga/lib/mrb/mrb_expr.c
index 3d0499c6b5c..dcae12a131a 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/mrb_expr.c
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_expr.c
@@ -1,6 +1,6 @@
/* -*- c-basic-offset: 2 -*- */
/*
- Copyright(C) 2013-2014 Brazil
+ Copyright(C) 2013-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,7 +16,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "../ctx_impl.h"
+#include "../grn_ctx_impl.h"
#ifdef GRN_WITH_MRUBY
#include <mruby.h>
@@ -25,14 +25,17 @@
#include <mruby/data.h>
#include <mruby/string.h>
#include <mruby/array.h>
+#include <mruby/hash.h>
-#include "../expr.h"
-#include "../util.h"
-#include "../mrb.h"
+#include "../grn_expr.h"
+#include "../grn_util.h"
+#include "../grn_mrb.h"
#include "mrb_accessor.h"
#include "mrb_ctx.h"
#include "mrb_expr.h"
+#include "mrb_operator.h"
#include "mrb_converter.h"
+#include "mrb_options.h"
static struct mrb_data_type mrb_grn_scan_info_type = {
"Groonga::ScanInfo",
@@ -98,17 +101,35 @@ mrb_grn_expr_code_initialize(mrb_state *mrb, mrb_value self)
static mrb_value
mrb_grn_scan_info_put_index(mrb_state *mrb, mrb_value self)
{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ scan_info *si;
+ mrb_value mrb_index;
int sid;
int32_t weight;
- scan_info *si;
- grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ mrb_value mrb_scorer;
+ mrb_value mrb_scorer_args_expr;
+ int32_t scorer_args_expr_offset;
grn_obj *index;
- mrb_value mrb_index;
-
- mrb_get_args(mrb, "oii", &mrb_index, &sid, &weight);
+ grn_obj *scorer = NULL;
+ grn_obj *scorer_args_expr = NULL;
+
+ mrb_get_args(mrb, "oiiooi",
+ &mrb_index, &sid, &weight,
+ &mrb_scorer,
+ &mrb_scorer_args_expr,
+ &scorer_args_expr_offset);
si = DATA_PTR(self);
index = DATA_PTR(mrb_index);
- grn_scan_info_put_index(ctx, si, index, sid, weight);
+ if (!mrb_nil_p(mrb_scorer)) {
+ scorer = DATA_PTR(mrb_scorer);
+ }
+ if (!mrb_nil_p(mrb_scorer_args_expr)) {
+ scorer_args_expr = DATA_PTR(mrb_scorer_args_expr);
+ }
+ grn_scan_info_put_index(ctx, si, index, sid, weight,
+ scorer,
+ scorer_args_expr,
+ scorer_args_expr_offset);
return self;
}
@@ -120,17 +141,19 @@ mrb_grn_scan_info_get_op(mrb_state *mrb, mrb_value self)
si = DATA_PTR(self);
op = grn_scan_info_get_op(si);
- return mrb_fixnum_value(op);
+ return grn_mrb_value_from_operator(mrb, op);
}
static mrb_value
mrb_grn_scan_info_set_op(mrb_state *mrb, mrb_value self)
{
scan_info *si;
+ mrb_value mrb_op;
grn_operator op;
- mrb_get_args(mrb, "i", &op);
+ mrb_get_args(mrb, "o", &mrb_op, &op);
si = DATA_PTR(self);
+ op = grn_mrb_value_to_operator(mrb, mrb_op);
grn_scan_info_set_op(si, op);
return self;
}
@@ -190,10 +213,12 @@ static mrb_value
mrb_grn_scan_info_set_logical_op(mrb_state *mrb, mrb_value self)
{
scan_info *si;
+ mrb_value mrb_logical_op;
grn_operator logical_op;
- mrb_get_args(mrb, "i", &logical_op);
+ mrb_get_args(mrb, "o", &mrb_logical_op);
si = DATA_PTR(self);
+ logical_op = grn_mrb_value_to_operator(mrb, mrb_logical_op);
grn_scan_info_set_logical_op(si, logical_op);
return self;
}
@@ -206,7 +231,7 @@ mrb_grn_scan_info_get_logical_op(mrb_state *mrb, mrb_value self)
si = DATA_PTR(self);
logical_op = grn_scan_info_get_logical_op(si);
- return mrb_fixnum_value(logical_op);
+ return grn_mrb_value_from_operator(mrb, logical_op);
}
static mrb_value
@@ -287,11 +312,86 @@ mrb_grn_scan_info_push_arg(mrb_state *mrb, mrb_value self)
}
static mrb_value
+mrb_grn_expr_code_inspect(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ grn_expr_code *code;
+ mrb_value inspected;
+
+ code = DATA_PTR(self);
+
+ inspected = mrb_str_buf_new(mrb, 48);
+
+ mrb_str_cat_lit(mrb, inspected, "#<");
+ mrb_str_cat_cstr(mrb, inspected, mrb_obj_classname(mrb, self));
+ mrb_str_cat_lit(mrb, inspected, ":");
+ mrb_str_concat(mrb, inspected, mrb_ptr_to_str(mrb, mrb_cptr(self)));
+
+ {
+ int32_t weight;
+ uint32_t offset;
+
+ weight = grn_expr_code_get_weight(ctx, DATA_PTR(self), &offset);
+
+ mrb_str_cat_lit(mrb, inspected, " weight=");
+ mrb_str_concat(mrb, inspected,
+ mrb_funcall(mrb,
+ mrb_fixnum_value(weight),
+ "inspect",
+ 0));
+ mrb_str_cat_lit(mrb, inspected, ", offset=");
+ mrb_str_concat(mrb, inspected,
+ mrb_funcall(mrb,
+ mrb_fixnum_value(offset),
+ "inspect",
+ 0));
+ }
+
+ mrb_str_cat_lit(mrb, inspected, ", modify=");
+ mrb_str_concat(mrb, inspected,
+ mrb_funcall(mrb,
+ mrb_fixnum_value(code->modify),
+ "inspect",
+ 0));
+
+ mrb_str_cat_lit(mrb, inspected, ", op=");
+ mrb_str_concat(mrb, inspected,
+ mrb_funcall(mrb,
+ grn_mrb_value_from_operator(mrb, code->op),
+ "inspect",
+ 0));
+
+ mrb_str_cat_lit(mrb, inspected, ", flags=");
+ mrb_str_concat(mrb, inspected,
+ mrb_funcall(mrb,
+ mrb_fixnum_value(code->flags),
+ "inspect",
+ 0));
+
+ mrb_str_cat_lit(mrb, inspected, ", value=");
+ mrb_str_concat(mrb, inspected,
+ mrb_funcall(mrb,
+ grn_mrb_value_from_grn_obj(mrb, code->value),
+ "inspect",
+ 0));
+
+ mrb_str_cat_lit(mrb, inspected, ">");
+
+ return inspected;
+}
+
+static mrb_value
mrb_grn_expr_code_get_weight(mrb_state *mrb, mrb_value self)
{
grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ int32_t weight;
+ uint32_t offset;
+ mrb_value mrb_values[2];
- return mrb_fixnum_value(grn_expr_code_get_weight(ctx, DATA_PTR(self)));
+ weight = grn_expr_code_get_weight(ctx, DATA_PTR(self), &offset);
+ mrb_values[0] = mrb_fixnum_value(weight);
+ mrb_values[1] = mrb_fixnum_value(offset);
+ return mrb_ary_new_from_values(mrb, 2, mrb_values);
}
static mrb_value
@@ -309,7 +409,7 @@ mrb_grn_expr_code_get_op(mrb_state *mrb, mrb_value self)
grn_expr_code *expr_code;
expr_code = DATA_PTR(self);
- return mrb_fixnum_value(expr_code->op);
+ return grn_mrb_value_from_operator(mrb, expr_code->op);
}
static mrb_value
@@ -322,6 +422,41 @@ mrb_grn_expr_code_get_flags(mrb_state *mrb, mrb_value self)
}
static mrb_value
+mrb_grn_expression_singleton_create(mrb_state *mrb, mrb_value klass)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ mrb_value mrb_expr;
+ mrb_value mrb_table;
+ mrb_value mrb_new_arguments[1];
+ grn_obj *expr, *variable = NULL;
+
+ mrb_get_args(mrb, "o", &mrb_table);
+ if (mrb_nil_p(mrb_table)) {
+ expr = grn_expr_create(ctx, NULL, 0);
+ } else {
+ grn_obj *table = DATA_PTR(mrb_table);
+ GRN_EXPR_CREATE_FOR_QUERY(ctx, table, expr, variable);
+ }
+
+ if (!expr) {
+ grn_mrb_ctx_check(mrb);
+ return mrb_nil_value();
+ }
+
+ mrb_new_arguments[0] = mrb_cptr_value(mrb, expr);
+ mrb_expr = mrb_obj_new(mrb, mrb_class_ptr(klass), 1, mrb_new_arguments);
+ {
+ mrb_value mrb_variable = mrb_nil_value();
+ if (variable) {
+ mrb_variable = grn_mrb_value_from_grn_obj(mrb, variable);
+ }
+ mrb_iv_set(mrb, mrb_expr, mrb_intern_lit(mrb, "@variable"), mrb_variable);
+ }
+
+ return mrb_expr;
+}
+
+static mrb_value
mrb_grn_expression_initialize(mrb_state *mrb, mrb_value self)
{
mrb_value mrb_expression_ptr;
@@ -409,6 +544,175 @@ mrb_grn_expression_allocate_constant(mrb_state *mrb, mrb_value self)
return grn_mrb_value_from_grn_obj(mrb, grn_object);
}
+static mrb_value
+mrb_grn_expression_parse(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ grn_obj *expr;
+ char *query;
+ mrb_int query_size;
+ grn_obj *default_column = NULL;
+ grn_operator default_mode = GRN_OP_MATCH;
+ grn_operator default_operator = GRN_OP_AND;
+ grn_expr_flags flags = GRN_EXPR_SYNTAX_SCRIPT;
+ mrb_value mrb_options = mrb_nil_value();
+
+ expr = DATA_PTR(self);
+ mrb_get_args(mrb, "s|H", &query, &query_size, &mrb_options);
+
+ if (!mrb_nil_p(mrb_options)) {
+ mrb_value mrb_flags;
+
+ mrb_flags = grn_mrb_options_get_lit(mrb, mrb_options, "flags");
+ if (!mrb_nil_p(mrb_flags)) {
+ flags = mrb_fixnum(mrb_flags);
+ }
+ }
+
+ grn_expr_parse(ctx, expr, query, query_size, default_column,
+ default_mode, default_operator, flags);
+ grn_mrb_ctx_check(mrb);
+
+ return mrb_nil_value();
+}
+
+static mrb_value
+mrb_grn_expression_append_object(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ grn_obj *expr;
+ mrb_value mrb_object;
+ grn_obj *object;
+ mrb_value mrb_op;
+ grn_operator op;
+ int n_args;
+
+ expr = DATA_PTR(self);
+ mrb_get_args(mrb, "ooi", &mrb_object, &mrb_op, &n_args);
+
+ object = DATA_PTR(mrb_object);
+ op = grn_mrb_value_to_operator(mrb, mrb_op);
+ grn_expr_append_obj(ctx, expr, object, op, n_args);
+ grn_mrb_ctx_check(mrb);
+
+ return mrb_nil_value();
+}
+
+static mrb_value
+mrb_grn_expression_append_constant(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ grn_obj *expr;
+ mrb_value mrb_constant;
+ mrb_value mrb_op;
+ grn_operator op;
+ int n_args;
+
+ expr = DATA_PTR(self);
+ mrb_get_args(mrb, "ooi", &mrb_constant, &mrb_op, &n_args);
+
+ op = grn_mrb_value_to_operator(mrb, mrb_op);
+ switch (mrb_type(mrb_constant)) {
+ case MRB_TT_FALSE :
+ if (mrb_nil_p(mrb_constant)) {
+ grn_obj constant;
+ GRN_VOID_INIT(&constant);
+ grn_expr_append_const(ctx, expr, &constant, op, n_args);
+ GRN_OBJ_FIN(ctx, &constant);
+ } else {
+ grn_obj constant;
+ GRN_BOOL_INIT(&constant, 0);
+ GRN_BOOL_SET(ctx, &constant, GRN_FALSE);
+ grn_expr_append_const(ctx, expr, &constant, op, n_args);
+ GRN_OBJ_FIN(ctx, &constant);
+ }
+ break;
+ case MRB_TT_TRUE :
+ {
+ grn_obj constant;
+ GRN_BOOL_INIT(&constant, 0);
+ GRN_BOOL_SET(ctx, &constant, GRN_TRUE);
+ grn_expr_append_const(ctx, expr, &constant, op, n_args);
+ GRN_OBJ_FIN(ctx, &constant);
+ }
+ break;
+ case MRB_TT_FIXNUM :
+ grn_expr_append_const_int(ctx, expr, mrb_fixnum(mrb_constant), op, n_args);
+ break;
+ case MRB_TT_SYMBOL :
+ {
+ const char *value;
+ mrb_int value_length;
+
+ value = mrb_sym2name_len(mrb, mrb_symbol(mrb_constant), &value_length);
+ grn_expr_append_const_str(ctx, expr, value, value_length, op, n_args);
+ }
+ break;
+ case MRB_TT_FLOAT :
+ {
+ grn_obj constant;
+ GRN_FLOAT_INIT(&constant, 0);
+ GRN_FLOAT_SET(ctx, &constant, mrb_float(mrb_constant));
+ grn_expr_append_const(ctx, expr, &constant, op, n_args);
+ GRN_OBJ_FIN(ctx, &constant);
+ }
+ break;
+ case MRB_TT_STRING :
+ grn_expr_append_const_str(ctx, expr,
+ RSTRING_PTR(mrb_constant),
+ RSTRING_LEN(mrb_constant),
+ op, n_args);
+ break;
+ default :
+ {
+ struct RClass *klass;
+
+ klass = mrb_class(mrb, mrb_constant);
+ if (klass == ctx->impl->mrb.builtin.time_class) {
+ grn_obj constant;
+ mrb_value mrb_sec;
+ mrb_value mrb_usec;
+
+ mrb_sec = mrb_funcall(mrb, mrb_constant, "to_i", 0);
+ mrb_usec = mrb_funcall(mrb, mrb_constant, "usec", 0);
+ GRN_TIME_INIT(&constant, 0);
+ GRN_TIME_SET(ctx, &constant,
+ GRN_TIME_PACK(mrb_fixnum(mrb_sec), mrb_fixnum(mrb_usec)));
+ grn_expr_append_const(ctx, expr, &constant, op, n_args);
+ GRN_OBJ_FIN(ctx, &constant);
+ } else {
+ mrb_raisef(mrb, E_ARGUMENT_ERROR,
+ "unsupported constant to append to expression: %S",
+ mrb_constant);
+ }
+ }
+ break;
+ }
+
+ grn_mrb_ctx_check(mrb);
+
+ return mrb_nil_value();
+}
+
+static mrb_value
+mrb_grn_expression_append_operator(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ grn_obj *expr;
+ mrb_value mrb_op;
+ int n_args;
+ grn_operator op;
+
+ expr = DATA_PTR(self);
+ mrb_get_args(mrb, "oi", &mrb_op, &n_args);
+
+ op = grn_mrb_value_to_operator(mrb, mrb_op);
+ grn_expr_append_op(ctx, expr, op, n_args);
+ grn_mrb_ctx_check(mrb);
+
+ return mrb_nil_value();
+}
+
void
grn_mrb_expr_init(grn_ctx *ctx)
{
@@ -422,7 +726,7 @@ grn_mrb_expr_init(grn_ctx *ctx)
mrb_define_method(mrb, klass, "initialize",
mrb_grn_scan_info_initialize, MRB_ARGS_REQ(1));
mrb_define_method(mrb, klass, "put_index",
- mrb_grn_scan_info_put_index, MRB_ARGS_REQ(3));
+ mrb_grn_scan_info_put_index, MRB_ARGS_REQ(6));
mrb_define_method(mrb, klass, "op",
mrb_grn_scan_info_get_op, MRB_ARGS_NONE());
mrb_define_method(mrb, klass, "op=",
@@ -457,6 +761,8 @@ grn_mrb_expr_init(grn_ctx *ctx)
MRB_SET_INSTANCE_TT(klass, MRB_TT_DATA);
mrb_define_method(mrb, klass, "initialize",
mrb_grn_expr_code_initialize, MRB_ARGS_REQ(1));
+ mrb_define_method(mrb, klass, "inspect",
+ mrb_grn_expr_code_inspect, MRB_ARGS_NONE());
mrb_define_method(mrb, klass, "weight",
mrb_grn_expr_code_get_weight, MRB_ARGS_NONE());
mrb_define_method(mrb, klass, "value",
@@ -466,8 +772,21 @@ grn_mrb_expr_init(grn_ctx *ctx)
mrb_define_method(mrb, klass, "flags",
mrb_grn_expr_code_get_flags, MRB_ARGS_NONE());
+ {
+ struct RClass *expression_code_class = klass;
+ struct RClass *flags_module;
+ flags_module = mrb_define_module_under(mrb, expression_code_class, "Flags");
+ mrb_define_const(mrb, flags_module, "RELATIONAL_EXPRESSION",
+ mrb_fixnum_value(GRN_EXPR_CODE_RELATIONAL_EXPRESSION));
+ }
+
klass = mrb_define_class_under(mrb, module, "Expression", object_class);
MRB_SET_INSTANCE_TT(klass, MRB_TT_DATA);
+
+ mrb_define_singleton_method(mrb, (struct RObject *)klass, "create",
+ mrb_grn_expression_singleton_create,
+ MRB_ARGS_REQ(1));
+
mrb_define_method(mrb, klass, "initialize",
mrb_grn_expression_initialize, MRB_ARGS_REQ(1));
mrb_define_method(mrb, klass, "codes",
@@ -479,10 +798,15 @@ grn_mrb_expr_init(grn_ctx *ctx)
mrb_define_method(mrb, klass, "allocate_constant",
mrb_grn_expression_allocate_constant, MRB_ARGS_REQ(1));
- grn_mrb_load(ctx, "expression.rb");
- grn_mrb_load(ctx, "scan_info.rb");
- grn_mrb_load(ctx, "scan_info_data.rb");
- grn_mrb_load(ctx, "scan_info_builder.rb");
+ mrb_define_method(mrb, klass, "parse",
+ mrb_grn_expression_parse, MRB_ARGS_ARG(1, 1));
+
+ mrb_define_method(mrb, klass, "append_object",
+ mrb_grn_expression_append_object, MRB_ARGS_REQ(2));
+ mrb_define_method(mrb, klass, "append_constant",
+ mrb_grn_expression_append_constant, MRB_ARGS_REQ(3));
+ mrb_define_method(mrb, klass, "append_operator",
+ mrb_grn_expression_append_operator, MRB_ARGS_REQ(2));
}
scan_info **
@@ -501,7 +825,7 @@ grn_mrb_scan_info_build(grn_ctx *ctx, grn_obj *expr, int *n,
mrb_expression = grn_mrb_value_from_grn_obj(mrb, expr);
mrb_sis = mrb_funcall(mrb, mrb_expression, "build_scan_info", 2,
- mrb_fixnum_value(op),
+ grn_mrb_value_from_operator(mrb, op),
mrb_fixnum_value(size));
if (mrb_nil_p(mrb_sis)) {
@@ -535,4 +859,31 @@ exit:
return sis;
}
+
+unsigned int
+grn_mrb_expr_estimate_size(grn_ctx *ctx, grn_obj *expr, grn_obj *table)
+{
+ grn_mrb_data *data = &(ctx->impl->mrb);
+ mrb_state *mrb = data->state;
+ mrb_value mrb_expression;
+ mrb_value mrb_table;
+ mrb_value mrb_size;
+ unsigned int size;
+ int arena_index;
+
+ arena_index = mrb_gc_arena_save(mrb);
+
+ mrb_expression = grn_mrb_value_from_grn_obj(mrb, expr);
+ mrb_table = grn_mrb_value_from_grn_obj(mrb, table);
+ mrb_size = mrb_funcall(mrb, mrb_expression, "estimate_size", 1, mrb_table);
+ if (mrb->exc) {
+ size = grn_table_size(ctx, table);
+ } else {
+ size = mrb_fixnum(mrb_size);
+ }
+
+ mrb_gc_arena_restore(mrb, arena_index);
+
+ return size;
+}
#endif
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_expr.h b/storage/mroonga/vendor/groonga/lib/mrb/mrb_expr.h
index 7fd5c66e9c5..0564401dac9 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/mrb_expr.h
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_expr.h
@@ -1,6 +1,6 @@
/* -*- c-basic-offset: 2 -*- */
/*
- Copyright(C) 2013 Brazil
+ Copyright(C) 2013-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -19,8 +19,8 @@
#ifndef GRN_MRB_EXPR_H
#define GRN_MRB_EXPR_H
-#include "../ctx.h"
-#include "../expr.h"
+#include "../grn_ctx.h"
+#include "../grn_expr.h"
#ifdef __cplusplus
extern "C" {
@@ -28,6 +28,9 @@ extern "C" {
void grn_mrb_expr_init(grn_ctx *ctx);
scan_info **grn_mrb_scan_info_build(grn_ctx *ctx, grn_obj *expr, int *n, grn_operator op, uint32_t size);
+unsigned int grn_mrb_expr_estimate_size(grn_ctx *ctx,
+ grn_obj *expr,
+ grn_obj *table);
#ifdef __cplusplus
}
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_fixed_size_column.c b/storage/mroonga/vendor/groonga/lib/mrb/mrb_fixed_size_column.c
index d8df913f77d..130225029a2 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/mrb_fixed_size_column.c
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_fixed_size_column.c
@@ -16,7 +16,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "../ctx_impl.h"
+#include "../grn_ctx_impl.h"
#ifdef GRN_WITH_MRUBY
#include <mruby.h>
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_fixed_size_column.h b/storage/mroonga/vendor/groonga/lib/mrb/mrb_fixed_size_column.h
index 938dcd76c7a..1037716c9f7 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/mrb_fixed_size_column.h
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_fixed_size_column.h
@@ -19,7 +19,7 @@
#ifndef GRN_MRB_FIXED_SIZE_COLUMN_H
#define GRN_MRB_FIXED_SIZE_COLUMN_H
-#include "../ctx.h"
+#include "../grn_ctx.h"
#ifdef __cplusplus
extern "C" {
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_hash_table.c b/storage/mroonga/vendor/groonga/lib/mrb/mrb_hash_table.c
new file mode 100644
index 00000000000..31d00956137
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_hash_table.c
@@ -0,0 +1,117 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2014-2015 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
+*/
+
+#include "../grn_ctx_impl.h"
+
+#ifdef GRN_WITH_MRUBY
+#include <mruby.h>
+#include <mruby/class.h>
+#include <mruby/data.h>
+#include <mruby/string.h>
+
+#include "mrb_ctx.h"
+#include "mrb_hash_table.h"
+#include "mrb_options.h"
+
+static struct mrb_data_type mrb_grn_hash_table_type = {
+ "Groonga::HashTable",
+ NULL
+};
+
+static mrb_value
+mrb_grn_hash_table_singleton_create(mrb_state *mrb, mrb_value klass)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ mrb_value mrb_options = mrb_nil_value();
+ const char *name = NULL;
+ unsigned int name_size = 0;
+ const char *path = NULL;
+ grn_obj_flags flags = GRN_OBJ_TABLE_HASH_KEY;
+ grn_obj *key_type = NULL;
+ grn_obj *value_type = NULL;
+ grn_obj *table;
+
+ mrb_get_args(mrb, "|H", &mrb_options);
+
+ if (!mrb_nil_p(mrb_options)) {
+ mrb_value mrb_name;
+ mrb_value mrb_flags;
+ mrb_value mrb_key_type;
+ mrb_value mrb_value_type;
+
+ mrb_name = grn_mrb_options_get_lit(mrb, mrb_options, "name");
+ if (!mrb_nil_p(mrb_name)) {
+ name = RSTRING_PTR(mrb_name);
+ name_size = RSTRING_LEN(mrb_name);
+ }
+
+ mrb_flags = grn_mrb_options_get_lit(mrb, mrb_options, "flags");
+ if (!mrb_nil_p(mrb_flags)) {
+ flags |= mrb_fixnum(mrb_flags);
+ }
+
+ mrb_key_type = grn_mrb_options_get_lit(mrb, mrb_options, "key_type");
+ if (!mrb_nil_p(mrb_key_type)) {
+ key_type = DATA_PTR(mrb_key_type);
+ }
+
+ mrb_value_type = grn_mrb_options_get_lit(mrb, mrb_options, "value_type");
+ if (!mrb_nil_p(mrb_value_type)) {
+ key_type = DATA_PTR(mrb_value_type);
+ }
+ }
+
+ table = grn_table_create(ctx, name, name_size, path, flags,
+ key_type, value_type);
+ grn_mrb_ctx_check(mrb);
+
+ return mrb_funcall(mrb, klass, "new", 1, mrb_cptr_value(mrb, table));
+}
+
+static mrb_value
+mrb_grn_hash_table_initialize(mrb_state *mrb, mrb_value self)
+{
+ mrb_value mrb_hash_table_ptr;
+
+ mrb_get_args(mrb, "o", &mrb_hash_table_ptr);
+ DATA_TYPE(self) = &mrb_grn_hash_table_type;
+ DATA_PTR(self) = mrb_cptr(mrb_hash_table_ptr);
+ return self;
+}
+
+void
+grn_mrb_hash_table_init(grn_ctx *ctx)
+{
+ grn_mrb_data *data = &(ctx->impl->mrb);
+ mrb_state *mrb = data->state;
+ struct RClass *module = data->module;
+ struct RClass *table_class;
+ struct RClass *klass;
+
+ table_class = mrb_class_get_under(mrb, module, "Table");
+ klass = mrb_define_class_under(mrb, module, "HashTable", table_class);
+ MRB_SET_INSTANCE_TT(klass, MRB_TT_DATA);
+
+ mrb_define_singleton_method(mrb, (struct RObject *)klass, "create",
+ mrb_grn_hash_table_singleton_create,
+ MRB_ARGS_OPT(1));
+
+ mrb_define_method(mrb, klass, "initialize",
+ mrb_grn_hash_table_initialize, MRB_ARGS_REQ(1));
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_hash_table.h b/storage/mroonga/vendor/groonga/lib/mrb/mrb_hash_table.h
new file mode 100644
index 00000000000..223267b47d9
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_hash_table.h
@@ -0,0 +1,34 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2014 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
+*/
+
+#ifndef GRN_MRB_HASH_TABLE_H
+#define GRN_MRB_HASH_TABLE_H
+
+#include "../grn_ctx.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void grn_mrb_hash_table_init(grn_ctx *ctx);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRN_MRB_HASH_TABLE_H */
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_id.c b/storage/mroonga/vendor/groonga/lib/mrb/mrb_id.c
index aa907b84a43..f55960716e9 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/mrb_id.c
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_id.c
@@ -16,7 +16,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "../ctx_impl.h"
+#include "../grn_ctx_impl.h"
#ifdef GRN_WITH_MRUBY
#include <mruby.h>
@@ -32,6 +32,11 @@ grn_mrb_id_init(grn_ctx *ctx)
id_module = mrb_define_module_under(mrb, module, "ID");
+ mrb_define_const(mrb, id_module, "NIL",
+ mrb_fixnum_value(GRN_ID_NIL));
+ mrb_define_const(mrb, id_module, "MAX",
+ mrb_fixnum_value(GRN_ID_MAX));
+
mrb_define_const(mrb, id_module, "VOID",
mrb_fixnum_value(GRN_DB_VOID));
mrb_define_const(mrb, id_module, "DB",
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_id.h b/storage/mroonga/vendor/groonga/lib/mrb/mrb_id.h
index f5b44358143..fcfd80384b5 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/mrb_id.h
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_id.h
@@ -19,7 +19,7 @@
#ifndef GRN_MRB_ID_H
#define GRN_MRB_ID_H
-#include "../ctx.h"
+#include "../grn_ctx.h"
#ifdef __cplusplus
extern "C" {
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_index_column.c b/storage/mroonga/vendor/groonga/lib/mrb/mrb_index_column.c
index 7bdf7528fc7..eb85ff955fa 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/mrb_index_column.c
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_index_column.c
@@ -1,6 +1,6 @@
/* -*- c-basic-offset: 2 -*- */
/*
- Copyright(C) 2014 Brazil
+ Copyright(C) 2014-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,14 +16,18 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "../ctx_impl.h"
+#include "../grn_ctx_impl.h"
+#include "../grn_ii.h"
#ifdef GRN_WITH_MRUBY
#include <mruby.h>
#include <mruby/class.h>
#include <mruby/data.h>
+#include "mrb_converter.h"
#include "mrb_index_column.h"
+#include "mrb_operator.h"
+#include "mrb_options.h"
static struct mrb_data_type mrb_grn_index_column_type = {
"Groonga::IndexColumn",
@@ -41,6 +45,84 @@ mrb_grn_index_column_initialize(mrb_state *mrb, mrb_value self)
return self;
}
+static mrb_value
+mrb_grn_index_column_get_lexicon(mrb_state *mrb, mrb_value self)
+{
+ grn_obj *index_column;
+ grn_obj *lexicon;
+
+ index_column = DATA_PTR(self);
+ lexicon = ((grn_ii *)index_column)->lexicon;
+
+ return grn_mrb_value_from_grn_obj(mrb, lexicon);
+}
+
+static mrb_value
+mrb_grn_index_column_estimate_size_for_term_id(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ grn_obj *index_column;
+ mrb_int term_id;
+ unsigned int size;
+
+ index_column = DATA_PTR(self);
+ mrb_get_args(mrb, "i", &term_id);
+
+ size = grn_ii_estimate_size(ctx, (grn_ii *)index_column, term_id);
+ return mrb_fixnum_value(size);
+}
+
+static mrb_value
+mrb_grn_index_column_estimate_size_for_query(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ grn_obj *index_column;
+ char *query;
+ mrb_int query_len;
+ mrb_value mrb_options = mrb_nil_value();
+ grn_search_optarg optarg;
+ unsigned int size;
+
+ index_column = DATA_PTR(self);
+ mrb_get_args(mrb, "s|H", &query, &query_len, &mrb_options);
+
+ memset(&optarg, 0, sizeof(grn_search_optarg));
+ optarg.mode = GRN_OP_EXACT;
+
+ if (!mrb_nil_p(mrb_options)) {
+ mrb_value mrb_mode;
+
+ mrb_mode = grn_mrb_options_get_lit(mrb, mrb_options, "mode");
+ if (!mrb_nil_p(mrb_mode)) {
+ optarg.mode = grn_mrb_value_to_operator(mrb, mrb_mode);
+ }
+ }
+
+ size = grn_ii_estimate_size_for_query(ctx, (grn_ii *)index_column,
+ query, query_len, &optarg);
+ return mrb_fixnum_value(size);
+}
+
+static mrb_value
+mrb_grn_index_column_estimate_size_for_lexicon_cursor(mrb_state *mrb,
+ mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ grn_obj *index_column;
+ mrb_value mrb_lexicon_cursor;
+ grn_table_cursor *lexicon_cursor;
+ unsigned int size;
+
+ index_column = DATA_PTR(self);
+ mrb_get_args(mrb, "o", &mrb_lexicon_cursor);
+
+ lexicon_cursor = DATA_PTR(mrb_lexicon_cursor);
+ size = grn_ii_estimate_size_for_lexicon_cursor(ctx,
+ (grn_ii *)index_column,
+ lexicon_cursor);
+ return mrb_fixnum_value(size);
+}
+
void
grn_mrb_index_column_init(grn_ctx *ctx)
{
@@ -55,5 +137,19 @@ grn_mrb_index_column_init(grn_ctx *ctx)
MRB_SET_INSTANCE_TT(klass, MRB_TT_DATA);
mrb_define_method(mrb, klass, "initialize",
mrb_grn_index_column_initialize, MRB_ARGS_REQ(1));
+
+ mrb_define_method(mrb, klass, "lexicon",
+ mrb_grn_index_column_get_lexicon,
+ MRB_ARGS_NONE());
+
+ mrb_define_method(mrb, klass, "estimate_size_for_term_id",
+ mrb_grn_index_column_estimate_size_for_term_id,
+ MRB_ARGS_REQ(1));
+ mrb_define_method(mrb, klass, "estimate_size_for_query",
+ mrb_grn_index_column_estimate_size_for_query,
+ MRB_ARGS_ARG(1, 1));
+ mrb_define_method(mrb, klass, "estimate_size_for_lexicon_cursor",
+ mrb_grn_index_column_estimate_size_for_lexicon_cursor,
+ MRB_ARGS_REQ(1));
}
#endif
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_index_column.h b/storage/mroonga/vendor/groonga/lib/mrb/mrb_index_column.h
index 10e0589bf93..307448fd4c3 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/mrb_index_column.h
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_index_column.h
@@ -19,7 +19,7 @@
#ifndef GRN_MRB_INDEX_COLUMN_H
#define GRN_MRB_INDEX_COLUMN_H
-#include "../ctx.h"
+#include "../grn_ctx.h"
#ifdef __cplusplus
extern "C" {
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_index_cursor.c b/storage/mroonga/vendor/groonga/lib/mrb/mrb_index_cursor.c
new file mode 100644
index 00000000000..34133ff7ae0
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_index_cursor.c
@@ -0,0 +1,224 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2015 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
+*/
+
+#include "../grn_ctx_impl.h"
+#include "../grn_ii.h"
+#include "../grn_db.h"
+
+#ifdef GRN_WITH_MRUBY
+#include <mruby.h>
+#include <mruby/class.h>
+#include <mruby/data.h>
+#include <mruby/string.h>
+#include <mruby/hash.h>
+#include <mruby/variable.h>
+
+#include "mrb_ctx.h"
+#include "mrb_index_cursor.h"
+#include "mrb_converter.h"
+#include "mrb_options.h"
+
+static struct mrb_data_type mrb_grn_index_cursor_type = {
+ "Groonga::IndexCursor",
+ NULL
+};
+
+static mrb_value
+mrb_grn_index_cursor_singleton_open_raw(mrb_state *mrb, mrb_value klass)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ mrb_value mrb_table_cursor;
+ mrb_value mrb_index;
+ mrb_value mrb_options = mrb_nil_value();
+ grn_obj *index_cursor;
+ grn_table_cursor *table_cursor;
+ grn_obj *index;
+ grn_id rid_min = GRN_ID_NIL;
+ grn_id rid_max = GRN_ID_MAX;
+ int flags = 0;
+ mrb_value mrb_index_cursor;
+
+ mrb_get_args(mrb, "oo|H", &mrb_table_cursor, &mrb_index, &mrb_options);
+
+ table_cursor = DATA_PTR(mrb_table_cursor);
+ index = DATA_PTR(mrb_index);
+ if (!mrb_nil_p(mrb_options)) {
+ /* TODO */
+ }
+ index_cursor = grn_index_cursor_open(ctx, table_cursor, index,
+ rid_min, rid_max, flags);
+ grn_mrb_ctx_check(mrb);
+
+ mrb_index_cursor = mrb_funcall(mrb, klass, "new", 1,
+ mrb_cptr_value(mrb, index_cursor));
+ mrb_iv_set(mrb, mrb_index_cursor, mrb_intern_lit(mrb, "@index"), mrb_index);
+ return mrb_index_cursor;
+}
+
+static mrb_value
+mrb_grn_index_cursor_initialize(mrb_state *mrb, mrb_value self)
+{
+ mrb_value mrb_index_cursor_ptr;
+
+ mrb_get_args(mrb, "o", &mrb_index_cursor_ptr);
+ DATA_TYPE(self) = &mrb_grn_index_cursor_type;
+ DATA_PTR(self) = mrb_cptr(mrb_index_cursor_ptr);
+
+ return self;
+}
+
+static mrb_value
+mrb_grn_index_cursor_close(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ grn_obj *index_cursor;
+
+ index_cursor = DATA_PTR(self);
+ if (index_cursor) {
+ DATA_PTR(self) = NULL;
+ grn_obj_close(ctx, index_cursor);
+ grn_mrb_ctx_check(mrb);
+ }
+
+ return mrb_nil_value();
+}
+
+static mrb_value
+mrb_grn_index_cursor_count(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ grn_id term_id;
+ int n_records = 0;
+
+ while (grn_index_cursor_next(ctx, DATA_PTR(self), &term_id)) {
+ n_records++;
+ }
+
+ return mrb_fixnum_value(n_records);
+}
+
+static mrb_value
+mrb_grn_index_cursor_select(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ mrb_value mrb_result_set;
+ mrb_value mrb_options;
+ grn_obj *index_cursor;
+ grn_obj *expr = NULL;
+ grn_obj *expr_variable = NULL;
+ int offset = 0;
+ int limit = 10;
+ int n_matched_records = 0;
+ mrb_value mrb_index;
+ grn_obj *index;
+ grn_obj *lexicon;
+ grn_obj *data_table;
+ grn_hash *result_set;
+ grn_posting *posting;
+ grn_id term_id;
+ grn_operator op = GRN_OP_OR;
+
+ mrb_get_args(mrb, "o|H", &mrb_result_set, &mrb_options);
+
+ index_cursor = DATA_PTR(self);
+ result_set = DATA_PTR(mrb_result_set);
+
+ if (!mrb_nil_p(mrb_options)) {
+ mrb_value mrb_expr;
+ mrb_value mrb_offset;
+ mrb_value mrb_limit;
+
+ mrb_expr = grn_mrb_options_get_lit(mrb, mrb_options, "expression");
+ if (!mrb_nil_p(mrb_expr)) {
+ expr = DATA_PTR(mrb_expr);
+ expr_variable = grn_expr_get_var_by_offset(ctx, expr, 0);
+ }
+
+ mrb_offset = grn_mrb_options_get_lit(mrb, mrb_options, "offset");
+ if (!mrb_nil_p(mrb_offset)) {
+ offset = mrb_fixnum(mrb_offset);
+ }
+
+ mrb_limit = grn_mrb_options_get_lit(mrb, mrb_options, "limit");
+ if (!mrb_nil_p(mrb_limit)) {
+ limit = mrb_fixnum(mrb_limit);
+ }
+ }
+
+ if (limit <= 0) {
+ return mrb_fixnum_value(n_matched_records);
+ }
+
+ mrb_index = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "@index"));
+ index = DATA_PTR(mrb_index);
+ lexicon = ((grn_ii *)index)->lexicon;
+ data_table = grn_ctx_at(ctx, grn_obj_get_range(ctx, index));
+
+ while ((posting = grn_index_cursor_next(ctx, index_cursor, &term_id))) {
+ if (expr) {
+ grn_bool matched_raw;
+ grn_obj *matched;
+
+ GRN_RECORD_SET(ctx, expr_variable, posting->rid);
+ matched = grn_expr_exec(ctx, expr, 0);
+ GRN_TRUEP(ctx, matched, matched_raw);
+ if (!matched_raw) {
+ continue;
+ }
+ }
+ n_matched_records++;
+ if (offset > 0) {
+ offset--;
+ continue;
+ }
+ grn_ii_posting_add(ctx, (grn_ii_posting *)posting, result_set, op);
+ limit--;
+ if (limit == 0) {
+ break;
+ }
+ }
+ grn_ii_resolve_sel_and(ctx, result_set, op);
+
+ return mrb_fixnum_value(n_matched_records);
+}
+
+void
+grn_mrb_index_cursor_init(grn_ctx *ctx)
+{
+ grn_mrb_data *data = &(ctx->impl->mrb);
+ mrb_state *mrb = data->state;
+ struct RClass *module = data->module;
+ struct RClass *klass;
+
+ klass = mrb_define_class_under(mrb, module, "IndexCursor", mrb->object_class);
+ MRB_SET_INSTANCE_TT(klass, MRB_TT_DATA);
+
+ mrb_define_singleton_method(mrb, (struct RObject *)klass, "open_raw",
+ mrb_grn_index_cursor_singleton_open_raw,
+ MRB_ARGS_ARG(2, 1));
+
+ mrb_define_method(mrb, klass, "initialize",
+ mrb_grn_index_cursor_initialize, MRB_ARGS_REQ(1));
+ mrb_define_method(mrb, klass, "close",
+ mrb_grn_index_cursor_close, MRB_ARGS_NONE());
+ mrb_define_method(mrb, klass, "count",
+ mrb_grn_index_cursor_count, MRB_ARGS_NONE());
+ mrb_define_method(mrb, klass, "select",
+ mrb_grn_index_cursor_select, MRB_ARGS_ARG(1, 1));
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_index_cursor.h b/storage/mroonga/vendor/groonga/lib/mrb/mrb_index_cursor.h
new file mode 100644
index 00000000000..afbad53db9f
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_index_cursor.h
@@ -0,0 +1,34 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2015 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
+*/
+
+#ifndef GRN_MRB_INDEX_CURSOR_H
+#define GRN_MRB_INDEX_CURSOR_H
+
+#include "../grn_ctx.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void grn_mrb_index_cursor_init(grn_ctx *ctx);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRN_MRB_INDEX_CURSOR_H */
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_logger.c b/storage/mroonga/vendor/groonga/lib/mrb/mrb_logger.c
index 4917694fa8a..884ca761e83 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/mrb_logger.c
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_logger.c
@@ -16,7 +16,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "../ctx_impl.h"
+#include "../grn_ctx_impl.h"
#ifdef GRN_WITH_MRUBY
#include <mruby.h>
@@ -25,7 +25,7 @@
#include <mruby/variable.h>
#include <mruby/string.h>
-#include "../mrb.h"
+#include "../grn_mrb.h"
#include "mrb_logger.h"
static mrb_value
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_logger.h b/storage/mroonga/vendor/groonga/lib/mrb/mrb_logger.h
index 5bfb62e98a2..358313b7ff9 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/mrb_logger.h
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_logger.h
@@ -19,7 +19,7 @@
#ifndef GRN_MRB_LOGGER_H
#define GRN_MRB_LOGGER_H
-#include "../ctx.h"
+#include "../grn_ctx.h"
#ifdef __cplusplus
extern "C" {
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_obj.c b/storage/mroonga/vendor/groonga/lib/mrb/mrb_obj.c
deleted file mode 100644
index 142a242b980..00000000000
--- a/storage/mroonga/vendor/groonga/lib/mrb/mrb_obj.c
+++ /dev/null
@@ -1,135 +0,0 @@
-/* -*- c-basic-offset: 2 -*- */
-/*
- Copyright(C) 2013-2014 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
-*/
-
-#include "../ctx_impl.h"
-#include "../util.h"
-
-#ifdef GRN_WITH_MRUBY
-#include <mruby.h>
-#include <mruby/string.h>
-#include <mruby/class.h>
-#include <mruby/data.h>
-
-#include "../mrb.h"
-#include "mrb_obj.h"
-#include "mrb_converter.h"
-
-static mrb_value
-object_get_name(mrb_state *mrb, mrb_value self)
-{
- grn_ctx *ctx = (grn_ctx *)mrb->ud;
- grn_obj *object;
- char name[GRN_TABLE_MAX_KEY_SIZE];
- int name_length;
-
- object = DATA_PTR(self);
- name_length = grn_obj_name(ctx, object, name, GRN_TABLE_MAX_KEY_SIZE);
-
- return mrb_str_new(mrb, name, name_length);
-}
-
-static mrb_value
-object_find_index(mrb_state *mrb, mrb_value self)
-{
- grn_ctx *ctx = (grn_ctx *)mrb->ud;
- grn_obj *object;
- mrb_value mrb_operator;
- grn_obj *index;
- int n_indexes;
- int section_id;
-
- mrb_get_args(mrb, "o", &mrb_operator);
- object = DATA_PTR(self);
- n_indexes = grn_column_index(ctx,
- object,
- mrb_fixnum(mrb_operator),
- &index,
- 1,
- &section_id);
- if (n_indexes == 0) {
- return mrb_nil_value();
- } else {
- grn_mrb_data *data;
- struct RClass *klass;
- mrb_value args[2];
-
- data = &(ctx->impl->mrb);
- klass = mrb_class_get_under(mrb, data->module, "IndexInfo");
- args[0] = grn_mrb_value_from_grn_obj(mrb, index);
- args[1] = mrb_fixnum_value(section_id);
- return mrb_obj_new(mrb, klass, 2, args);
- }
-}
-
-static mrb_value
-object_grn_inspect(mrb_state *mrb, mrb_value self)
-{
- grn_ctx *ctx = (grn_ctx *)mrb->ud;
- grn_obj buffer;
- mrb_value inspected;
-
- GRN_TEXT_INIT(&buffer, 0);
- grn_inspect(ctx, &buffer, DATA_PTR(self));
- inspected = mrb_str_new(mrb, GRN_TEXT_VALUE(&buffer), GRN_TEXT_LEN(&buffer));
- GRN_OBJ_FIN(ctx, &buffer);
-
- return inspected;
-}
-
-static mrb_value
-object_equal(mrb_state *mrb, mrb_value self)
-{
- grn_obj *object, *other_object;
- mrb_value mrb_other;
-
- mrb_get_args(mrb, "o", &mrb_other);
- if (!mrb_obj_is_kind_of(mrb, mrb_other, mrb_obj_class(mrb, self))) {
- return mrb_false_value();
- }
-
- object = DATA_PTR(self);
- other_object = DATA_PTR(mrb_other);
- if (object == other_object) {
- return mrb_true_value();
- } else {
- return mrb_false_value();
- }
-}
-
-void
-grn_mrb_obj_init(grn_ctx *ctx)
-{
- grn_mrb_data *data = &(ctx->impl->mrb);
- mrb_state *mrb = data->state;
- struct RClass *module = data->module;
- struct RClass *klass;
-
- klass = mrb_define_class_under(mrb, module, "Object", mrb->object_class);
- MRB_SET_INSTANCE_TT(klass, MRB_TT_DATA);
- data->object_class = klass;
-
- mrb_define_method(mrb, klass, "name", object_get_name, MRB_ARGS_NONE());
- mrb_define_method(mrb, klass, "find_index",
- object_find_index, MRB_ARGS_REQ(1));
- mrb_define_method(mrb, klass, "grn_inspect",
- object_grn_inspect, MRB_ARGS_NONE());
- mrb_define_method(mrb, klass, "==", object_equal, MRB_ARGS_REQ(1));
-
- grn_mrb_load(ctx, "index_info.rb");
-}
-#endif
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_object.c b/storage/mroonga/vendor/groonga/lib/mrb/mrb_object.c
new file mode 100644
index 00000000000..8efaa41e50d
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_object.c
@@ -0,0 +1,263 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2013-2015 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
+*/
+
+#include "../grn_ctx_impl.h"
+#include "../grn_util.h"
+
+#ifdef GRN_WITH_MRUBY
+#include <mruby.h>
+#include <mruby/string.h>
+#include <mruby/class.h>
+#include <mruby/data.h>
+
+#include "../grn_mrb.h"
+#include "mrb_object.h"
+#include "mrb_operator.h"
+#include "mrb_converter.h"
+
+static mrb_value
+object_inspect(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ grn_obj *object;
+ mrb_value inspected;
+
+ object = DATA_PTR(self);
+ inspected = mrb_str_buf_new(mrb, 48);
+
+ mrb_str_cat_lit(mrb, inspected, "#<");
+ mrb_str_cat_cstr(mrb, inspected, mrb_obj_classname(mrb, self));
+ mrb_str_cat_lit(mrb, inspected, ":");
+ mrb_str_concat(mrb, inspected, mrb_ptr_to_str(mrb, mrb_cptr(self)));
+ if (object) {
+ grn_obj buffer;
+ GRN_TEXT_INIT(&buffer, 0);
+ grn_inspect(ctx, &buffer, object);
+ mrb_str_cat_lit(mrb, inspected, " ");
+ mrb_str_cat(mrb, inspected, GRN_TEXT_VALUE(&buffer), GRN_TEXT_LEN(&buffer));
+ GRN_OBJ_FIN(ctx, &buffer);
+ } else {
+ mrb_str_cat_lit(mrb, inspected, " (closed)");
+ }
+ mrb_str_cat_lit(mrb, inspected, ">");
+
+ return inspected;
+}
+
+static mrb_value
+object_get_id(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ grn_id id;
+
+ id = grn_obj_id(ctx, DATA_PTR(self));
+
+ return mrb_fixnum_value(id);
+}
+
+static mrb_value
+object_get_name(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ grn_obj *object;
+ char name[GRN_TABLE_MAX_KEY_SIZE];
+ int name_length;
+
+ object = DATA_PTR(self);
+ name_length = grn_obj_name(ctx, object, name, GRN_TABLE_MAX_KEY_SIZE);
+
+ return mrb_str_new(mrb, name, name_length);
+}
+
+static mrb_value
+object_find_index(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ grn_obj *object;
+ mrb_value mrb_operator;
+ grn_operator operator;
+ grn_index_datum index_datum;
+ int n_index_data;
+
+ mrb_get_args(mrb, "o", &mrb_operator);
+ object = DATA_PTR(self);
+ operator = grn_mrb_value_to_operator(mrb, mrb_operator);
+ n_index_data = grn_column_find_index_data(ctx,
+ object,
+ operator,
+ &index_datum,
+ 1);
+ if (n_index_data == 0) {
+ return mrb_nil_value();
+ } else {
+ grn_mrb_data *data;
+ struct RClass *klass;
+ mrb_value args[2];
+
+ data = &(ctx->impl->mrb);
+ klass = mrb_class_get_under(mrb, data->module, "IndexInfo");
+ args[0] = grn_mrb_value_from_grn_obj(mrb, index_datum.index);
+ args[1] = mrb_fixnum_value(index_datum.section);
+ return mrb_obj_new(mrb, klass, 2, args);
+ }
+}
+
+static mrb_value
+object_grn_inspect(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ grn_obj buffer;
+ mrb_value inspected;
+
+ GRN_TEXT_INIT(&buffer, 0);
+ grn_inspect(ctx, &buffer, DATA_PTR(self));
+ inspected = mrb_str_new(mrb, GRN_TEXT_VALUE(&buffer), GRN_TEXT_LEN(&buffer));
+ GRN_OBJ_FIN(ctx, &buffer);
+
+ return inspected;
+}
+
+static mrb_value
+object_equal(mrb_state *mrb, mrb_value self)
+{
+ grn_obj *object, *other_object;
+ mrb_value mrb_other;
+
+ mrb_get_args(mrb, "o", &mrb_other);
+ if (!mrb_obj_is_kind_of(mrb, mrb_other, mrb_obj_class(mrb, self))) {
+ return mrb_false_value();
+ }
+
+ object = DATA_PTR(self);
+ other_object = DATA_PTR(mrb_other);
+ if (object == other_object) {
+ return mrb_true_value();
+ } else {
+ return mrb_false_value();
+ }
+}
+
+static mrb_value
+object_close(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ grn_obj *object;
+
+ object = DATA_PTR(self);
+ if (!object) {
+ mrb_raise(mrb, E_ARGUMENT_ERROR, "already closed object");
+ }
+
+ grn_obj_close(ctx, object);
+ DATA_PTR(self) = NULL;
+
+ return mrb_nil_value();
+}
+
+static mrb_value
+object_get_domain_id(mrb_state *mrb, mrb_value self)
+{
+ grn_obj *object;
+ grn_id domain_id;
+
+ object = DATA_PTR(self);
+ domain_id = object->header.domain;
+
+ if (domain_id == GRN_ID_NIL) {
+ return mrb_nil_value();
+ } else {
+ return mrb_fixnum_value(domain_id);
+ }
+}
+
+static mrb_value
+object_get_range_id(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ grn_obj *object;
+ grn_id range_id;
+
+ object = DATA_PTR(self);
+ range_id = grn_obj_get_range(ctx, object);
+
+ if (range_id == GRN_ID_NIL) {
+ return mrb_nil_value();
+ } else {
+ return mrb_fixnum_value(range_id);
+ }
+}
+
+static mrb_value
+object_is_temporary(mrb_state *mrb, mrb_value self)
+{
+ grn_obj *object;
+ grn_obj_flags flags;
+
+ object = DATA_PTR(self);
+ flags = object->header.flags;
+ return mrb_bool_value((flags & GRN_OBJ_PERSISTENT) != GRN_OBJ_PERSISTENT);
+}
+
+static mrb_value
+object_is_persistent(mrb_state *mrb, mrb_value self)
+{
+ grn_obj *object;
+ grn_obj_flags flags;
+
+ object = DATA_PTR(self);
+ flags = object->header.flags;
+ return mrb_bool_value((flags & GRN_OBJ_PERSISTENT) == GRN_OBJ_PERSISTENT);
+}
+
+void
+grn_mrb_object_init(grn_ctx *ctx)
+{
+ grn_mrb_data *data = &(ctx->impl->mrb);
+ mrb_state *mrb = data->state;
+ struct RClass *module = data->module;
+ struct RClass *klass;
+
+ klass = mrb_define_class_under(mrb, module, "Object", mrb->object_class);
+ MRB_SET_INSTANCE_TT(klass, MRB_TT_DATA);
+ data->object_class = klass;
+
+ mrb_define_method(mrb, klass, "inspect",
+ object_inspect, MRB_ARGS_NONE());
+
+ mrb_define_method(mrb, klass, "id", object_get_id, MRB_ARGS_NONE());
+ mrb_define_method(mrb, klass, "name", object_get_name, MRB_ARGS_NONE());
+ mrb_define_method(mrb, klass, "find_index",
+ object_find_index, MRB_ARGS_REQ(1));
+ mrb_define_method(mrb, klass, "grn_inspect",
+ object_grn_inspect, MRB_ARGS_NONE());
+ mrb_define_method(mrb, klass, "==", object_equal, MRB_ARGS_REQ(1));
+ mrb_define_method(mrb, klass, "close", object_close, MRB_ARGS_NONE());
+
+ mrb_define_method(mrb, klass, "domain_id", object_get_domain_id,
+ MRB_ARGS_NONE());
+ mrb_define_method(mrb, klass, "range_id", object_get_range_id,
+ MRB_ARGS_NONE());
+
+ mrb_define_method(mrb, klass, "temporary?", object_is_temporary,
+ MRB_ARGS_NONE());
+ mrb_define_method(mrb, klass, "persistent?", object_is_persistent,
+ MRB_ARGS_NONE());
+
+ grn_mrb_load(ctx, "index_info.rb");
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_object.h b/storage/mroonga/vendor/groonga/lib/mrb/mrb_object.h
new file mode 100644
index 00000000000..97a586c0f11
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_object.h
@@ -0,0 +1,34 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2013-2014 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
+*/
+
+#ifndef GRN_MRB_OBJECT_H
+#define GRN_MRB_OBJECT_H
+
+#include "../grn_ctx.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void grn_mrb_object_init(grn_ctx *ctx);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRN_MRB_OBJECT_H */
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_object_flags.c b/storage/mroonga/vendor/groonga/lib/mrb/mrb_object_flags.c
new file mode 100644
index 00000000000..c8accada692
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_object_flags.c
@@ -0,0 +1,95 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2015 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
+*/
+
+#include "../grn_ctx_impl.h"
+
+#ifdef GRN_WITH_MRUBY
+# include <mruby.h>
+# include <mruby/string.h>
+# include <mruby/class.h>
+# include <mruby/data.h>
+
+# include "../grn_mrb.h"
+# include "mrb_object.h"
+# include "mrb_operator.h"
+# include "mrb_converter.h"
+
+void
+grn_mrb_object_flags_init(grn_ctx *ctx)
+{
+ grn_mrb_data *data = &(ctx->impl->mrb);
+ mrb_state *mrb = data->state;
+ struct RClass *module = data->module;
+ struct RClass *flags_module;
+
+ flags_module = mrb_define_module_under(mrb, module, "ObjectFlags");
+
+#define MRB_DEFINE_FLAG(name) \
+ mrb_define_const(mrb, flags_module, #name, \
+ mrb_fixnum_value(GRN_OBJ_ ## name))
+
+ MRB_DEFINE_FLAG(TABLE_TYPE_MASK);
+ MRB_DEFINE_FLAG(TABLE_HASH_KEY);
+ MRB_DEFINE_FLAG(TABLE_PAT_KEY);
+ MRB_DEFINE_FLAG(TABLE_DAT_KEY);
+ MRB_DEFINE_FLAG(TABLE_NO_KEY);
+
+ MRB_DEFINE_FLAG(KEY_MASK);
+ MRB_DEFINE_FLAG(KEY_UINT);
+ MRB_DEFINE_FLAG(KEY_INT);
+ MRB_DEFINE_FLAG(KEY_FLOAT);
+ MRB_DEFINE_FLAG(KEY_GEO_POINT);
+
+ MRB_DEFINE_FLAG(KEY_WITH_SIS);
+ MRB_DEFINE_FLAG(KEY_NORMALIZE);
+
+ MRB_DEFINE_FLAG(COLUMN_TYPE_MASK);
+ MRB_DEFINE_FLAG(COLUMN_SCALAR);
+ MRB_DEFINE_FLAG(COLUMN_VECTOR);
+ MRB_DEFINE_FLAG(COLUMN_INDEX);
+
+ MRB_DEFINE_FLAG(COMPRESS_MASK);
+ MRB_DEFINE_FLAG(COMPRESS_NONE);
+ MRB_DEFINE_FLAG(COMPRESS_ZLIB);
+ MRB_DEFINE_FLAG(COMPRESS_LZ4);
+
+ MRB_DEFINE_FLAG(WITH_SECTION);
+ MRB_DEFINE_FLAG(WITH_WEIGHT);
+ MRB_DEFINE_FLAG(WITH_POSITION);
+ MRB_DEFINE_FLAG(RING_BUFFER);
+
+ MRB_DEFINE_FLAG(UNIT_MASK);
+ MRB_DEFINE_FLAG(UNIT_DOCUMENT_NONE);
+ MRB_DEFINE_FLAG(UNIT_DOCUMENT_SECTION);
+ MRB_DEFINE_FLAG(UNIT_DOCUMENT_POSITION);
+ MRB_DEFINE_FLAG(UNIT_SECTION_NONE);
+ MRB_DEFINE_FLAG(UNIT_SECTION_POSITION);
+ MRB_DEFINE_FLAG(UNIT_POSITION_NONE);
+ MRB_DEFINE_FLAG(UNIT_USERDEF_DOCUMENT);
+ MRB_DEFINE_FLAG(UNIT_USERDEF_SECTION);
+ MRB_DEFINE_FLAG(UNIT_USERDEF_POSITION);
+
+ MRB_DEFINE_FLAG(NO_SUBREC);
+ MRB_DEFINE_FLAG(WITH_SUBREC);
+
+ MRB_DEFINE_FLAG(KEY_VAR_SIZE);
+
+ MRB_DEFINE_FLAG(TEMPORARY);
+ MRB_DEFINE_FLAG(PERSISTENT);
+}
+#endif /* GRN_WITH_MRUBY */
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_object_flags.h b/storage/mroonga/vendor/groonga/lib/mrb/mrb_object_flags.h
new file mode 100644
index 00000000000..60c82227078
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_object_flags.h
@@ -0,0 +1,34 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2015 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
+*/
+
+#ifndef GRN_MRB_OBJECT_FLAGS_H
+#define GRN_MRB_OBJECT_FLAGS_H
+
+#include "../grn_ctx.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void grn_mrb_object_flags_init(grn_ctx *ctx);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRN_MRB_OBJECT_FLAGS_H */
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_operator.c b/storage/mroonga/vendor/groonga/lib/mrb/mrb_operator.c
index 5a18d2e7023..2e0cb481722 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/mrb_operator.c
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_operator.c
@@ -1,6 +1,6 @@
/* -*- c-basic-offset: 2 -*- */
/*
- Copyright(C) 2014 Brazil
+ Copyright(C) 2014-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,175 +16,139 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "../ctx_impl.h"
+#include "../grn_ctx_impl.h"
#ifdef GRN_WITH_MRUBY
#include <mruby.h>
#include "mrb_operator.h"
+mrb_value
+grn_mrb_value_from_operator(mrb_state *mrb, grn_operator op)
+{
+ grn_ctx *ctx = (grn_ctx *)(mrb->ud);
+ grn_mrb_data *data = &(ctx->impl->mrb);
+ mrb_value mrb_op_raw;
+ mrb_value mrb_op;
+
+ mrb_op_raw = mrb_fixnum_value(op);
+ mrb_op = mrb_funcall(mrb, mrb_obj_value(data->groonga.operator_class),
+ "find", 1, mrb_op_raw);
+ if (mrb_nil_p(mrb_op)) {
+ return mrb_op_raw;
+ } else {
+ return mrb_op;
+ }
+}
+
+grn_operator
+grn_mrb_value_to_operator(mrb_state *mrb, mrb_value mrb_op)
+{
+ if (!mrb_fixnum_p(mrb_op)) {
+ mrb_op = mrb_funcall(mrb, mrb_op, "value", 0);
+ }
+
+ return mrb_fixnum(mrb_op);
+}
+
void
grn_mrb_operator_init(grn_ctx *ctx)
{
- mrb_state *mrb = ctx->impl->mrb.state;
+ grn_mrb_data *data = &(ctx->impl->mrb);
+ mrb_state *mrb = data->state;
struct RClass *module = ctx->impl->mrb.module;
- struct RClass *operator_module;
+ struct RClass *klass;
+ mrb_value klass_obj;
+
+ klass = mrb_class_get_under(mrb, module, "Operator");
+ data->groonga.operator_class = klass;
+
+ klass_obj = mrb_obj_value(klass);
+#define DEFINE_OPERATOR(name) \
+ mrb_funcall(mrb, klass_obj, "register", 1, \
+ mrb_funcall(mrb, klass_obj, "new", 2, \
+ mrb_str_new_lit(mrb, #name), \
+ mrb_fixnum_value(GRN_OP_ ## name)))
- operator_module = mrb_define_module_under(mrb, module, "Operator");
+ DEFINE_OPERATOR(PUSH);
+ DEFINE_OPERATOR(POP);
+ DEFINE_OPERATOR(NOP);
+ DEFINE_OPERATOR(CALL);
+ DEFINE_OPERATOR(INTERN);
+ DEFINE_OPERATOR(GET_REF);
+ DEFINE_OPERATOR(GET_VALUE);
+ DEFINE_OPERATOR(AND);
+ DEFINE_OPERATOR(AND_NOT);
+ DEFINE_OPERATOR(OR);
+ DEFINE_OPERATOR(ASSIGN);
+ DEFINE_OPERATOR(STAR_ASSIGN);
+ DEFINE_OPERATOR(SLASH_ASSIGN);
+ DEFINE_OPERATOR(MOD_ASSIGN);
+ DEFINE_OPERATOR(PLUS_ASSIGN);
+ DEFINE_OPERATOR(MINUS_ASSIGN);
+ DEFINE_OPERATOR(SHIFTL_ASSIGN);
+ DEFINE_OPERATOR(SHIFTR_ASSIGN);
+ DEFINE_OPERATOR(SHIFTRR_ASSIGN);
+ DEFINE_OPERATOR(AND_ASSIGN);
+ DEFINE_OPERATOR(XOR_ASSIGN);
+ DEFINE_OPERATOR(OR_ASSIGN);
+ DEFINE_OPERATOR(JUMP);
+ DEFINE_OPERATOR(CJUMP);
+ DEFINE_OPERATOR(COMMA);
+ DEFINE_OPERATOR(BITWISE_OR);
+ DEFINE_OPERATOR(BITWISE_XOR);
+ DEFINE_OPERATOR(BITWISE_AND);
+ DEFINE_OPERATOR(BITWISE_NOT);
+ DEFINE_OPERATOR(EQUAL);
+ DEFINE_OPERATOR(NOT_EQUAL);
+ DEFINE_OPERATOR(LESS);
+ DEFINE_OPERATOR(GREATER);
+ DEFINE_OPERATOR(LESS_EQUAL);
+ DEFINE_OPERATOR(GREATER_EQUAL);
+ DEFINE_OPERATOR(IN);
+ DEFINE_OPERATOR(MATCH);
+ DEFINE_OPERATOR(NEAR);
+ DEFINE_OPERATOR(NEAR2);
+ DEFINE_OPERATOR(SIMILAR);
+ DEFINE_OPERATOR(TERM_EXTRACT);
+ DEFINE_OPERATOR(SHIFTL);
+ DEFINE_OPERATOR(SHIFTR);
+ DEFINE_OPERATOR(SHIFTRR);
+ DEFINE_OPERATOR(PLUS);
+ DEFINE_OPERATOR(MINUS);
+ DEFINE_OPERATOR(STAR);
+ DEFINE_OPERATOR(SLASH);
+ DEFINE_OPERATOR(MOD);
+ DEFINE_OPERATOR(DELETE);
+ DEFINE_OPERATOR(INCR);
+ DEFINE_OPERATOR(DECR);
+ DEFINE_OPERATOR(INCR_POST);
+ DEFINE_OPERATOR(DECR_POST);
+ DEFINE_OPERATOR(NOT);
+ DEFINE_OPERATOR(ADJUST);
+ DEFINE_OPERATOR(EXACT);
+ DEFINE_OPERATOR(LCP);
+ DEFINE_OPERATOR(PARTIAL);
+ DEFINE_OPERATOR(UNSPLIT);
+ DEFINE_OPERATOR(PREFIX);
+ DEFINE_OPERATOR(SUFFIX);
+ DEFINE_OPERATOR(GEO_DISTANCE1);
+ DEFINE_OPERATOR(GEO_DISTANCE2);
+ DEFINE_OPERATOR(GEO_DISTANCE3);
+ DEFINE_OPERATOR(GEO_DISTANCE4);
+ DEFINE_OPERATOR(GEO_WITHINP5);
+ DEFINE_OPERATOR(GEO_WITHINP6);
+ DEFINE_OPERATOR(GEO_WITHINP8);
+ DEFINE_OPERATOR(OBJ_SEARCH);
+ DEFINE_OPERATOR(EXPR_GET_VAR);
+ DEFINE_OPERATOR(TABLE_CREATE);
+ DEFINE_OPERATOR(TABLE_SELECT);
+ DEFINE_OPERATOR(TABLE_SORT);
+ DEFINE_OPERATOR(TABLE_GROUP);
+ DEFINE_OPERATOR(JSON_PUT);
+ DEFINE_OPERATOR(GET_MEMBER);
+ DEFINE_OPERATOR(REGEXP);
- mrb_define_const(mrb, operator_module, "PUSH",
- mrb_fixnum_value(GRN_OP_PUSH));
- mrb_define_const(mrb, operator_module, "POP",
- mrb_fixnum_value(GRN_OP_POP));
- mrb_define_const(mrb, operator_module, "NOP",
- mrb_fixnum_value(GRN_OP_NOP));
- mrb_define_const(mrb, operator_module, "CALL",
- mrb_fixnum_value(GRN_OP_CALL));
- mrb_define_const(mrb, operator_module, "INTERN",
- mrb_fixnum_value(GRN_OP_INTERN));
- mrb_define_const(mrb, operator_module, "GET_REF",
- mrb_fixnum_value(GRN_OP_GET_REF));
- mrb_define_const(mrb, operator_module, "GET_VALUE",
- mrb_fixnum_value(GRN_OP_GET_VALUE));
- mrb_define_const(mrb, operator_module, "AND",
- mrb_fixnum_value(GRN_OP_AND));
- mrb_define_const(mrb, operator_module, "AND_NOT",
- mrb_fixnum_value(GRN_OP_AND_NOT));
- mrb_define_const(mrb, operator_module, "OR",
- mrb_fixnum_value(GRN_OP_OR));
- mrb_define_const(mrb, operator_module, "ASSIGN",
- mrb_fixnum_value(GRN_OP_ASSIGN));
- mrb_define_const(mrb, operator_module, "STAR_ASSIGN",
- mrb_fixnum_value(GRN_OP_STAR_ASSIGN));
- mrb_define_const(mrb, operator_module, "SLASH_ASSIGN",
- mrb_fixnum_value(GRN_OP_SLASH_ASSIGN));
- mrb_define_const(mrb, operator_module, "MOD_ASSIGN",
- mrb_fixnum_value(GRN_OP_MOD_ASSIGN));
- mrb_define_const(mrb, operator_module, "PLUS_ASSIGN",
- mrb_fixnum_value(GRN_OP_PLUS_ASSIGN));
- mrb_define_const(mrb, operator_module, "MINUS_ASSIGN",
- mrb_fixnum_value(GRN_OP_MINUS_ASSIGN));
- mrb_define_const(mrb, operator_module, "SHIFTL_ASSIGN",
- mrb_fixnum_value(GRN_OP_SHIFTL_ASSIGN));
- mrb_define_const(mrb, operator_module, "SHIFTR_ASSIGN",
- mrb_fixnum_value(GRN_OP_SHIFTR_ASSIGN));
- mrb_define_const(mrb, operator_module, "SHIFTRR_ASSIGN",
- mrb_fixnum_value(GRN_OP_SHIFTRR_ASSIGN));
- mrb_define_const(mrb, operator_module, "AND_ASSIGN",
- mrb_fixnum_value(GRN_OP_AND_ASSIGN));
- mrb_define_const(mrb, operator_module, "XOR_ASSIGN",
- mrb_fixnum_value(GRN_OP_XOR_ASSIGN));
- mrb_define_const(mrb, operator_module, "OR_ASSIGN",
- mrb_fixnum_value(GRN_OP_OR_ASSIGN));
- mrb_define_const(mrb, operator_module, "JUMP",
- mrb_fixnum_value(GRN_OP_JUMP));
- mrb_define_const(mrb, operator_module, "CJUMP",
- mrb_fixnum_value(GRN_OP_CJUMP));
- mrb_define_const(mrb, operator_module, "COMMA",
- mrb_fixnum_value(GRN_OP_COMMA));
- mrb_define_const(mrb, operator_module, "BITWISE_OR",
- mrb_fixnum_value(GRN_OP_BITWISE_OR));
- mrb_define_const(mrb, operator_module, "BITWISE_XOR",
- mrb_fixnum_value(GRN_OP_BITWISE_XOR));
- mrb_define_const(mrb, operator_module, "BITWISE_AND",
- mrb_fixnum_value(GRN_OP_BITWISE_AND));
- mrb_define_const(mrb, operator_module, "BITWISE_NOT",
- mrb_fixnum_value(GRN_OP_BITWISE_NOT));
- mrb_define_const(mrb, operator_module, "EQUAL",
- mrb_fixnum_value(GRN_OP_EQUAL));
- mrb_define_const(mrb, operator_module, "NOT_EQUAL",
- mrb_fixnum_value(GRN_OP_NOT_EQUAL));
- mrb_define_const(mrb, operator_module, "LESS",
- mrb_fixnum_value(GRN_OP_LESS));
- mrb_define_const(mrb, operator_module, "GREATER",
- mrb_fixnum_value(GRN_OP_GREATER));
- mrb_define_const(mrb, operator_module, "LESS_EQUAL",
- mrb_fixnum_value(GRN_OP_LESS_EQUAL));
- mrb_define_const(mrb, operator_module, "GREATER_EQUAL",
- mrb_fixnum_value(GRN_OP_GREATER_EQUAL));
- mrb_define_const(mrb, operator_module, "IN",
- mrb_fixnum_value(GRN_OP_IN));
- mrb_define_const(mrb, operator_module, "MATCH",
- mrb_fixnum_value(GRN_OP_MATCH));
- mrb_define_const(mrb, operator_module, "NEAR",
- mrb_fixnum_value(GRN_OP_NEAR));
- mrb_define_const(mrb, operator_module, "NEAR2",
- mrb_fixnum_value(GRN_OP_NEAR2));
- mrb_define_const(mrb, operator_module, "SIMILAR",
- mrb_fixnum_value(GRN_OP_SIMILAR));
- mrb_define_const(mrb, operator_module, "TERM_EXTRACT",
- mrb_fixnum_value(GRN_OP_TERM_EXTRACT));
- mrb_define_const(mrb, operator_module, "SHIFTL",
- mrb_fixnum_value(GRN_OP_SHIFTL));
- mrb_define_const(mrb, operator_module, "SHIFTR",
- mrb_fixnum_value(GRN_OP_SHIFTR));
- mrb_define_const(mrb, operator_module, "SHIFTRR",
- mrb_fixnum_value(GRN_OP_SHIFTRR));
- mrb_define_const(mrb, operator_module, "PLUS",
- mrb_fixnum_value(GRN_OP_PLUS));
- mrb_define_const(mrb, operator_module, "MINUS",
- mrb_fixnum_value(GRN_OP_MINUS));
- mrb_define_const(mrb, operator_module, "STAR",
- mrb_fixnum_value(GRN_OP_STAR));
- mrb_define_const(mrb, operator_module, "SLASH",
- mrb_fixnum_value(GRN_OP_SLASH));
- mrb_define_const(mrb, operator_module, "MOD",
- mrb_fixnum_value(GRN_OP_MOD));
- mrb_define_const(mrb, operator_module, "DELETE",
- mrb_fixnum_value(GRN_OP_DELETE));
- mrb_define_const(mrb, operator_module, "INCR",
- mrb_fixnum_value(GRN_OP_INCR));
- mrb_define_const(mrb, operator_module, "DECR",
- mrb_fixnum_value(GRN_OP_DECR));
- mrb_define_const(mrb, operator_module, "INCR_POST",
- mrb_fixnum_value(GRN_OP_INCR_POST));
- mrb_define_const(mrb, operator_module, "DECR_POST",
- mrb_fixnum_value(GRN_OP_DECR_POST));
- mrb_define_const(mrb, operator_module, "NOT",
- mrb_fixnum_value(GRN_OP_NOT));
- mrb_define_const(mrb, operator_module, "ADJUST",
- mrb_fixnum_value(GRN_OP_ADJUST));
- mrb_define_const(mrb, operator_module, "EXACT",
- mrb_fixnum_value(GRN_OP_EXACT));
- mrb_define_const(mrb, operator_module, "LCP",
- mrb_fixnum_value(GRN_OP_LCP));
- mrb_define_const(mrb, operator_module, "PARTIAL",
- mrb_fixnum_value(GRN_OP_PARTIAL));
- mrb_define_const(mrb, operator_module, "UNSPLIT",
- mrb_fixnum_value(GRN_OP_UNSPLIT));
- mrb_define_const(mrb, operator_module, "PREFIX",
- mrb_fixnum_value(GRN_OP_PREFIX));
- mrb_define_const(mrb, operator_module, "SUFFIX",
- mrb_fixnum_value(GRN_OP_SUFFIX));
- mrb_define_const(mrb, operator_module, "GEO_DISTANCE1",
- mrb_fixnum_value(GRN_OP_GEO_DISTANCE1));
- mrb_define_const(mrb, operator_module, "GEO_DISTANCE2",
- mrb_fixnum_value(GRN_OP_GEO_DISTANCE2));
- mrb_define_const(mrb, operator_module, "GEO_DISTANCE3",
- mrb_fixnum_value(GRN_OP_GEO_DISTANCE3));
- mrb_define_const(mrb, operator_module, "GEO_DISTANCE4",
- mrb_fixnum_value(GRN_OP_GEO_DISTANCE4));
- mrb_define_const(mrb, operator_module, "GEO_WITHINP5",
- mrb_fixnum_value(GRN_OP_GEO_WITHINP5));
- mrb_define_const(mrb, operator_module, "GEO_WITHINP6",
- mrb_fixnum_value(GRN_OP_GEO_WITHINP6));
- mrb_define_const(mrb, operator_module, "GEO_WITHINP8",
- mrb_fixnum_value(GRN_OP_GEO_WITHINP8));
- mrb_define_const(mrb, operator_module, "OBJ_SEARCH",
- mrb_fixnum_value(GRN_OP_OBJ_SEARCH));
- mrb_define_const(mrb, operator_module, "EXPR_GET_VAR",
- mrb_fixnum_value(GRN_OP_EXPR_GET_VAR));
- mrb_define_const(mrb, operator_module, "TABLE_CREATE",
- mrb_fixnum_value(GRN_OP_TABLE_CREATE));
- mrb_define_const(mrb, operator_module, "TABLE_SELECT",
- mrb_fixnum_value(GRN_OP_TABLE_SELECT));
- mrb_define_const(mrb, operator_module, "TABLE_SORT",
- mrb_fixnum_value(GRN_OP_TABLE_SORT));
- mrb_define_const(mrb, operator_module, "TABLE_GROUP",
- mrb_fixnum_value(GRN_OP_TABLE_GROUP));
- mrb_define_const(mrb, operator_module, "JSON_PUT",
- mrb_fixnum_value(GRN_OP_JSON_PUT));
- mrb_define_const(mrb, operator_module, "GET_MEMBER",
- mrb_fixnum_value(GRN_OP_GET_MEMBER));
+#undef DEFINE_OPERATOR
}
#endif
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_operator.h b/storage/mroonga/vendor/groonga/lib/mrb/mrb_operator.h
index 2650cc9421d..b76c4983446 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/mrb_operator.h
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_operator.h
@@ -1,6 +1,6 @@
/* -*- c-basic-offset: 2 -*- */
/*
- Copyright(C) 2014 Brazil
+ Copyright(C) 2014-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -19,13 +19,15 @@
#ifndef GRN_MRB_OPERATOR_H
#define GRN_MRB_OPERATOR_H
-#include "../ctx.h"
+#include "../grn_ctx.h"
#ifdef __cplusplus
extern "C" {
#endif
void grn_mrb_operator_init(grn_ctx *ctx);
+mrb_value grn_mrb_value_from_operator(mrb_state *mrb, grn_operator op);
+grn_operator grn_mrb_value_to_operator(mrb_state *mrb, mrb_value mrb_op);
#ifdef __cplusplus
}
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_options.c b/storage/mroonga/vendor/groonga/lib/mrb/mrb_options.c
new file mode 100644
index 00000000000..ff3a1c0e731
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_options.c
@@ -0,0 +1,39 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2015 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
+*/
+
+#include "../grn_ctx_impl.h"
+#include "../grn_db.h"
+
+#ifdef GRN_WITH_MRUBY
+#include <mruby.h>
+#include <mruby/hash.h>
+
+#include "mrb_options.h"
+
+mrb_value
+grn_mrb_options_get_static(mrb_state *mrb,
+ mrb_value mrb_options,
+ const char *key,
+ size_t key_size)
+{
+ mrb_sym mrb_key;
+
+ mrb_key = mrb_intern_static(mrb, key, key_size);
+ return mrb_hash_get(mrb, mrb_options, mrb_symbol_value(mrb_key));
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_options.h b/storage/mroonga/vendor/groonga/lib/mrb/mrb_options.h
new file mode 100644
index 00000000000..1aa547d3be9
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_options.h
@@ -0,0 +1,40 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2015 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
+*/
+
+#ifndef GRN_MRB_OPTIONS_H
+#define GRN_MRB_OPTIONS_H
+
+#include "../grn_ctx.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+mrb_value grn_mrb_options_get_static(mrb_state *mrb,
+ mrb_value mrb_options,
+ const char *key,
+ size_t key_size);
+#define grn_mrb_options_get_lit(mrb, mrb_options, literal) \
+ grn_mrb_options_get_static(mrb, mrb_options, \
+ (literal), mrb_strlen_lit(literal))
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRN_MRB_OPTIONS_H */
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_patricia_trie.c b/storage/mroonga/vendor/groonga/lib/mrb/mrb_patricia_trie.c
new file mode 100644
index 00000000000..d2486f21c37
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_patricia_trie.c
@@ -0,0 +1,59 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2014 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
+*/
+
+#include "../grn_ctx_impl.h"
+
+#ifdef GRN_WITH_MRUBY
+#include <mruby.h>
+#include <mruby/class.h>
+#include <mruby/data.h>
+
+#include "mrb_patricia_trie.h"
+
+static struct mrb_data_type mrb_grn_patricia_trie_type = {
+ "Groonga::PatriciaTrie",
+ NULL
+};
+
+static mrb_value
+mrb_grn_patricia_trie_initialize(mrb_state *mrb, mrb_value self)
+{
+ mrb_value mrb_patricia_trie_ptr;
+
+ mrb_get_args(mrb, "o", &mrb_patricia_trie_ptr);
+ DATA_TYPE(self) = &mrb_grn_patricia_trie_type;
+ DATA_PTR(self) = mrb_cptr(mrb_patricia_trie_ptr);
+ return self;
+}
+
+void
+grn_mrb_patricia_trie_init(grn_ctx *ctx)
+{
+ grn_mrb_data *data = &(ctx->impl->mrb);
+ mrb_state *mrb = data->state;
+ struct RClass *module = data->module;
+ struct RClass *table_class;
+ struct RClass *klass;
+
+ table_class = mrb_class_get_under(mrb, module, "Table");
+ klass = mrb_define_class_under(mrb, module, "PatriciaTrie", table_class);
+ MRB_SET_INSTANCE_TT(klass, MRB_TT_DATA);
+ mrb_define_method(mrb, klass, "initialize",
+ mrb_grn_patricia_trie_initialize, MRB_ARGS_REQ(1));
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_patricia_trie.h b/storage/mroonga/vendor/groonga/lib/mrb/mrb_patricia_trie.h
new file mode 100644
index 00000000000..f281b25969b
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_patricia_trie.h
@@ -0,0 +1,34 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2014 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
+*/
+
+#ifndef GRN_MRB_PATRICIA_TRIE_H
+#define GRN_MRB_PATRICIA_TRIE_H
+
+#include "../grn_ctx.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void grn_mrb_patricia_trie_init(grn_ctx *ctx);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRN_MRB_PATRICIA_TRIE_H */
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_procedure.c b/storage/mroonga/vendor/groonga/lib/mrb/mrb_procedure.c
index fa9c677f2e6..3dfe78488df 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/mrb_procedure.c
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_procedure.c
@@ -16,7 +16,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "../ctx_impl.h"
+#include "../grn_ctx_impl.h"
#ifdef GRN_WITH_MRUBY
#include <mruby.h>
@@ -41,6 +41,15 @@ mrb_grn_procedure_initialize(mrb_state *mrb, mrb_value self)
return self;
}
+static mrb_value
+mrb_grn_procedure_scorer_p(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ grn_obj *proc = DATA_PTR(self);
+
+ return mrb_bool_value(grn_obj_is_scorer_proc(ctx, proc));
+}
+
void
grn_mrb_procedure_init(grn_ctx *ctx)
{
@@ -54,5 +63,8 @@ grn_mrb_procedure_init(grn_ctx *ctx)
MRB_SET_INSTANCE_TT(klass, MRB_TT_DATA);
mrb_define_method(mrb, klass, "initialize",
mrb_grn_procedure_initialize, MRB_ARGS_REQ(1));
+
+ mrb_define_method(mrb, klass, "scorer?",
+ mrb_grn_procedure_scorer_p, MRB_ARGS_NONE());
}
#endif
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_procedure.h b/storage/mroonga/vendor/groonga/lib/mrb/mrb_procedure.h
index 16a4b32895c..36bd10fdab9 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/mrb_procedure.h
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_procedure.h
@@ -19,7 +19,7 @@
#ifndef GRN_MRB_PROCEDURE_H
#define GRN_MRB_PROCEDURE_H
-#include "../ctx.h"
+#include "../grn_ctx.h"
#ifdef __cplusplus
extern "C" {
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_table.c b/storage/mroonga/vendor/groonga/lib/mrb/mrb_table.c
new file mode 100644
index 00000000000..651a77e4549
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_table.c
@@ -0,0 +1,257 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2014-2015 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
+*/
+
+#include "../grn_ctx_impl.h"
+
+#ifdef GRN_WITH_MRUBY
+#include <mruby.h>
+#include <mruby/class.h>
+#include <mruby/data.h>
+#include <mruby/hash.h>
+#include <mruby/array.h>
+#include <mruby/string.h>
+
+#include "mrb_ctx.h"
+#include "mrb_table.h"
+#include "mrb_converter.h"
+#include "mrb_options.h"
+
+static mrb_value
+mrb_grn_table_array_reference(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ grn_obj *table;
+ grn_id key_domain_id;
+ mrb_value mrb_key;
+ grn_id record_id;
+ grn_mrb_value_to_raw_data_buffer buffer;
+ void *key;
+ unsigned int key_size;
+
+ mrb_get_args(mrb, "o", &mrb_key);
+
+ table = DATA_PTR(self);
+ if (table->header.type == GRN_DB) {
+ key_domain_id = GRN_DB_SHORT_TEXT;
+ } else {
+ key_domain_id = table->header.domain;
+ }
+
+ grn_mrb_value_to_raw_data_buffer_init(mrb, &buffer);
+ grn_mrb_value_to_raw_data(mrb, "key", mrb_key, key_domain_id,
+ &buffer, &key, &key_size);
+ record_id = grn_table_get(ctx, table, key, key_size);
+ grn_mrb_value_to_raw_data_buffer_fin(mrb, &buffer);
+
+ if (record_id == GRN_ID_NIL) {
+ return mrb_nil_value();
+ } else {
+ return mrb_fixnum_value(record_id);
+ }
+}
+
+static mrb_value
+mrb_grn_table_is_locked(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ unsigned int is_locked;
+
+ is_locked = grn_obj_is_locked(ctx, DATA_PTR(self));
+ grn_mrb_ctx_check(mrb);
+
+ return mrb_bool_value(is_locked != 0);
+}
+
+static mrb_value
+mrb_grn_table_get_size(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ unsigned int size;
+
+ size = grn_table_size(ctx, DATA_PTR(self));
+ grn_mrb_ctx_check(mrb);
+
+ return mrb_fixnum_value(size);
+}
+
+static mrb_value
+mrb_grn_table_is_empty(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ unsigned int size;
+
+ size = grn_table_size(ctx, DATA_PTR(self));
+ grn_mrb_ctx_check(mrb);
+
+ return mrb_bool_value(size == 0);
+}
+
+static mrb_value
+mrb_grn_table_select(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ grn_obj *table;
+ grn_obj *expr;
+ grn_obj *result = NULL;
+ grn_operator operator = GRN_OP_OR;
+ mrb_value mrb_expr;
+ mrb_value mrb_options = mrb_nil_value();
+
+ table = DATA_PTR(self);
+ mrb_get_args(mrb, "o|H", &mrb_expr, &mrb_options);
+
+ expr = DATA_PTR(mrb_expr);
+
+ if (!mrb_nil_p(mrb_options)) {
+ mrb_value mrb_result;
+ mrb_value mrb_operator;
+
+ mrb_result = grn_mrb_options_get_lit(mrb, mrb_options, "result");
+ if (!mrb_nil_p(mrb_result)) {
+ result = DATA_PTR(mrb_result);
+ }
+
+ mrb_operator = grn_mrb_options_get_lit(mrb, mrb_options, "operator");
+ if (!mrb_nil_p(mrb_operator)) {
+ operator = mrb_fixnum(mrb_operator);
+ }
+ }
+
+ result = grn_table_select(ctx, table, expr, result, operator);
+ grn_mrb_ctx_check(mrb);
+
+ return grn_mrb_value_from_grn_obj(mrb, result);
+}
+
+/* TODO: Fix memory leak on error */
+static mrb_value
+mrb_grn_table_sort(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ grn_obj *table;
+ grn_obj *result = NULL;
+ grn_table_sort_key *keys;
+ int i, n_keys;
+ int offset = 0;
+ int limit = -1;
+ mrb_value mrb_keys;
+ mrb_value mrb_options = mrb_nil_value();
+
+ table = DATA_PTR(self);
+ mrb_get_args(mrb, "o|H", &mrb_keys, &mrb_options);
+
+ mrb_keys = mrb_convert_type(mrb, mrb_keys,
+ MRB_TT_ARRAY, "Array", "to_ary");
+
+ n_keys = RARRAY_LEN(mrb_keys);
+ keys = GRN_MALLOCN(grn_table_sort_key, n_keys);
+ for (i = 0; i < n_keys; i++) {
+ mrb_value mrb_sort_options;
+ mrb_value mrb_sort_key;
+ mrb_value mrb_sort_order;
+
+ mrb_sort_options = RARRAY_PTR(mrb_keys)[i];
+ mrb_sort_key = grn_mrb_options_get_lit(mrb, mrb_sort_options, "key");
+ switch (mrb_type(mrb_sort_key)) {
+ case MRB_TT_STRING :
+ keys[i].key = grn_obj_column(ctx, table,
+ RSTRING_PTR(mrb_sort_key),
+ RSTRING_LEN(mrb_sort_key));
+ break;
+ case MRB_TT_SYMBOL :
+ {
+ const char *name;
+ mrb_int name_length;
+ name = mrb_sym2name_len(mrb, mrb_symbol(mrb_sort_key), &name_length);
+ keys[i].key = grn_obj_column(ctx, table, name, name_length);
+ }
+ break;
+ default :
+ /* TODO: free */
+ mrb_raisef(mrb, E_ARGUMENT_ERROR,
+ "sort key must be string or symbol: %S",
+ mrb_sort_key);
+ break;
+ }
+
+ keys[i].flags = 0;
+ mrb_sort_order = grn_mrb_options_get_lit(mrb, mrb_sort_options, "order");
+ if (mrb_nil_p(mrb_sort_order) ||
+ (mrb_symbol(mrb_sort_order) == mrb_intern_lit(mrb, "ascending"))) {
+ keys[i].flags |= GRN_TABLE_SORT_ASC;
+ } else {
+ keys[i].flags |= GRN_TABLE_SORT_DESC;
+ }
+ }
+
+ if (!mrb_nil_p(mrb_options)) {
+ mrb_value mrb_offset;
+ mrb_value mrb_limit;
+
+ mrb_offset = grn_mrb_options_get_lit(mrb, mrb_options, "offset");
+ if (!mrb_nil_p(mrb_offset)) {
+ offset = mrb_fixnum(mrb_offset);
+ }
+
+ mrb_limit = grn_mrb_options_get_lit(mrb, mrb_options, "limit");
+ if (!mrb_nil_p(mrb_limit)) {
+ limit = mrb_fixnum(mrb_limit);
+ }
+ }
+
+ result = grn_table_create(ctx, NULL, 0, NULL, GRN_TABLE_NO_KEY,
+ NULL, table);
+ grn_table_sort(ctx, table, offset, limit, result, keys, n_keys);
+ for (i = 0; i < n_keys; i++) {
+ grn_obj_unlink(ctx, keys[i].key);
+ }
+ GRN_FREE(keys);
+ grn_mrb_ctx_check(mrb);
+
+ return grn_mrb_value_from_grn_obj(mrb, result);
+}
+
+void
+grn_mrb_table_init(grn_ctx *ctx)
+{
+ grn_mrb_data *data = &(ctx->impl->mrb);
+ mrb_state *mrb = data->state;
+ struct RClass *module = data->module;
+ struct RClass *object_class = data->object_class;
+ struct RClass *klass;
+
+ klass = mrb_define_class_under(mrb, module, "Table", object_class);
+ MRB_SET_INSTANCE_TT(klass, MRB_TT_DATA);
+
+ mrb_define_method(mrb, klass, "[]",
+ mrb_grn_table_array_reference, MRB_ARGS_REQ(1));
+
+ mrb_define_method(mrb, klass, "locked?",
+ mrb_grn_table_is_locked, MRB_ARGS_NONE());
+
+ mrb_define_method(mrb, klass, "size",
+ mrb_grn_table_get_size, MRB_ARGS_NONE());
+ mrb_define_method(mrb, klass, "empty?",
+ mrb_grn_table_is_empty, MRB_ARGS_NONE());
+
+ mrb_define_method(mrb, klass, "select",
+ mrb_grn_table_select, MRB_ARGS_ARG(1, 1));
+ mrb_define_method(mrb, klass, "sort",
+ mrb_grn_table_sort, MRB_ARGS_ARG(1, 1));
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_table.h b/storage/mroonga/vendor/groonga/lib/mrb/mrb_table.h
new file mode 100644
index 00000000000..000088fcf40
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_table.h
@@ -0,0 +1,34 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2014 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
+*/
+
+#ifndef GRN_MRB_TABLE_H
+#define GRN_MRB_TABLE_H
+
+#include "../grn_ctx.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void grn_mrb_table_init(grn_ctx *ctx);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRN_MRB_TABLE_H */
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_table_cursor.c b/storage/mroonga/vendor/groonga/lib/mrb/mrb_table_cursor.c
new file mode 100644
index 00000000000..76d4429d24f
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_table_cursor.c
@@ -0,0 +1,176 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2014-2015 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
+*/
+
+#include "../grn_ctx_impl.h"
+
+#ifdef GRN_WITH_MRUBY
+#include <mruby.h>
+#include <mruby/class.h>
+#include <mruby/data.h>
+#include <mruby/string.h>
+#include <mruby/hash.h>
+
+#include "mrb_ctx.h"
+#include "mrb_bulk.h"
+#include "mrb_table_cursor.h"
+
+#include "mrb_converter.h"
+#include "mrb_options.h"
+
+static struct mrb_data_type mrb_grn_table_cursor_type = {
+ "Groonga::TableCursor",
+ NULL
+};
+
+static mrb_value
+mrb_grn_table_cursor_singleton_open_raw(mrb_state *mrb, mrb_value klass)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ mrb_value mrb_table;
+ mrb_value mrb_options = mrb_nil_value();
+ grn_table_cursor *table_cursor;
+ grn_obj *table;
+ void *min = NULL;
+ unsigned int min_size = 0;
+ grn_mrb_value_to_raw_data_buffer min_buffer;
+ void *max = NULL;
+ unsigned int max_size = 0;
+ grn_mrb_value_to_raw_data_buffer max_buffer;
+ int offset = 0;
+ int limit = -1;
+ int flags = 0;
+
+ mrb_get_args(mrb, "o|H", &mrb_table, &mrb_options);
+
+ table = DATA_PTR(mrb_table);
+ grn_mrb_value_to_raw_data_buffer_init(mrb, &min_buffer);
+ grn_mrb_value_to_raw_data_buffer_init(mrb, &max_buffer);
+ if (!mrb_nil_p(mrb_options)) {
+ grn_id key_domain_id;
+ mrb_value mrb_min;
+ mrb_value mrb_max;
+ mrb_value mrb_flags;
+
+ if (table->header.type == GRN_DB) {
+ key_domain_id = GRN_DB_SHORT_TEXT;
+ } else {
+ key_domain_id = table->header.domain;
+ }
+
+ mrb_min = grn_mrb_options_get_lit(mrb, mrb_options, "min");
+ grn_mrb_value_to_raw_data(mrb, "min", mrb_min,
+ key_domain_id, &min_buffer, &min, &min_size);
+
+ mrb_max = grn_mrb_options_get_lit(mrb, mrb_options, "max");
+ grn_mrb_value_to_raw_data(mrb, "max", mrb_max,
+ key_domain_id, &max_buffer, &max, &max_size);
+
+ mrb_flags = grn_mrb_options_get_lit(mrb, mrb_options, "flags");
+ if (!mrb_nil_p(mrb_flags)) {
+ flags = mrb_fixnum(mrb_flags);
+ }
+ }
+ table_cursor = grn_table_cursor_open(ctx, table,
+ min, min_size,
+ max, max_size,
+ offset, limit, flags);
+ grn_mrb_value_to_raw_data_buffer_fin(mrb, &min_buffer);
+ grn_mrb_value_to_raw_data_buffer_fin(mrb, &max_buffer);
+ grn_mrb_ctx_check(mrb);
+
+ return mrb_funcall(mrb, klass, "new", 1, mrb_cptr_value(mrb, table_cursor));
+}
+
+static mrb_value
+mrb_grn_table_cursor_initialize(mrb_state *mrb, mrb_value self)
+{
+ mrb_value mrb_table_cursor_ptr;
+
+ mrb_get_args(mrb, "o", &mrb_table_cursor_ptr);
+ DATA_TYPE(self) = &mrb_grn_table_cursor_type;
+ DATA_PTR(self) = mrb_cptr(mrb_table_cursor_ptr);
+
+ return self;
+}
+
+static mrb_value
+mrb_grn_table_cursor_close(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ grn_table_cursor *table_cursor;
+
+ table_cursor = DATA_PTR(self);
+ if (table_cursor) {
+ DATA_PTR(self) = NULL;
+ grn_table_cursor_close(ctx, table_cursor);
+ grn_mrb_ctx_check(mrb);
+ }
+
+ return mrb_nil_value();
+}
+
+static mrb_value
+mrb_grn_table_cursor_next(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ grn_id id;
+
+ id = grn_table_cursor_next(ctx, DATA_PTR(self));
+ grn_mrb_ctx_check(mrb);
+
+ return mrb_fixnum_value(id);
+}
+
+static mrb_value
+mrb_grn_table_cursor_count(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ int n_records = 0;
+
+ while (grn_table_cursor_next(ctx, DATA_PTR(self)) != GRN_ID_NIL) {
+ n_records++;
+ }
+
+ return mrb_fixnum_value(n_records);
+}
+
+void
+grn_mrb_table_cursor_init(grn_ctx *ctx)
+{
+ grn_mrb_data *data = &(ctx->impl->mrb);
+ mrb_state *mrb = data->state;
+ struct RClass *module = data->module;
+ struct RClass *klass;
+
+ klass = mrb_define_class_under(mrb, module, "TableCursor", mrb->object_class);
+ MRB_SET_INSTANCE_TT(klass, MRB_TT_DATA);
+
+ mrb_define_singleton_method(mrb, (struct RObject *)klass, "open_raw",
+ mrb_grn_table_cursor_singleton_open_raw,
+ MRB_ARGS_ARG(1, 1));
+
+ mrb_define_method(mrb, klass, "initialize",
+ mrb_grn_table_cursor_initialize, MRB_ARGS_REQ(1));
+ mrb_define_method(mrb, klass, "close",
+ mrb_grn_table_cursor_close, MRB_ARGS_NONE());
+ mrb_define_method(mrb, klass, "next",
+ mrb_grn_table_cursor_next, MRB_ARGS_NONE());
+ mrb_define_method(mrb, klass, "count",
+ mrb_grn_table_cursor_count, MRB_ARGS_NONE());
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_table_cursor.h b/storage/mroonga/vendor/groonga/lib/mrb/mrb_table_cursor.h
new file mode 100644
index 00000000000..f05ab0977a1
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_table_cursor.h
@@ -0,0 +1,34 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2014 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
+*/
+
+#ifndef GRN_MRB_TABLE_CURSOR_H
+#define GRN_MRB_TABLE_CURSOR_H
+
+#include "../grn_ctx.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void grn_mrb_table_cursor_init(grn_ctx *ctx);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRN_MRB_TABLE_CURSOR_H */
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_table_cursor_flags.c b/storage/mroonga/vendor/groonga/lib/mrb/mrb_table_cursor_flags.c
new file mode 100644
index 00000000000..8b889fc5b47
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_table_cursor_flags.c
@@ -0,0 +1,60 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2014 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
+*/
+
+#include "../grn_ctx_impl.h"
+
+#ifdef GRN_WITH_MRUBY
+#include <mruby.h>
+#include <mruby/class.h>
+
+#include "mrb_table_cursor_flags.h"
+
+void
+grn_mrb_table_cursor_flags_init(grn_ctx *ctx)
+{
+ grn_mrb_data *data = &(ctx->impl->mrb);
+ mrb_state *mrb = data->state;
+ struct RClass *module = data->module;
+ struct RClass *flags_module;
+
+ flags_module = mrb_define_module_under(mrb, module, "TableCursorFlags");
+
+ mrb_define_const(mrb, flags_module, "ASCENDING",
+ mrb_fixnum_value(GRN_CURSOR_ASCENDING));
+ mrb_define_const(mrb, flags_module, "DESCENDING",
+ mrb_fixnum_value(GRN_CURSOR_DESCENDING));
+ mrb_define_const(mrb, flags_module, "GE",
+ mrb_fixnum_value(GRN_CURSOR_GE));
+ mrb_define_const(mrb, flags_module, "GT",
+ mrb_fixnum_value(GRN_CURSOR_GT));
+ mrb_define_const(mrb, flags_module, "LE",
+ mrb_fixnum_value(GRN_CURSOR_LE));
+ mrb_define_const(mrb, flags_module, "LT",
+ mrb_fixnum_value(GRN_CURSOR_LT));
+ mrb_define_const(mrb, flags_module, "BY_KEY",
+ mrb_fixnum_value(GRN_CURSOR_BY_KEY));
+ mrb_define_const(mrb, flags_module, "BY_ID",
+ mrb_fixnum_value(GRN_CURSOR_BY_ID));
+ mrb_define_const(mrb, flags_module, "PREFIX",
+ mrb_fixnum_value(GRN_CURSOR_PREFIX));
+ mrb_define_const(mrb, flags_module, "SIZE_BY_BIT",
+ mrb_fixnum_value(GRN_CURSOR_SIZE_BY_BIT));
+ mrb_define_const(mrb, flags_module, "RK",
+ mrb_fixnum_value(GRN_CURSOR_RK));
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_table_cursor_flags.h b/storage/mroonga/vendor/groonga/lib/mrb/mrb_table_cursor_flags.h
new file mode 100644
index 00000000000..f336cde9325
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_table_cursor_flags.h
@@ -0,0 +1,34 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2014 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
+*/
+
+#ifndef GRN_MRB_TABLE_CURSOR_FLAGS_H
+#define GRN_MRB_TABLE_CURSOR_FLAGS_H
+
+#include "../grn_ctx.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void grn_mrb_table_cursor_flags_init(grn_ctx *ctx);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRN_MRB_TABLE_CURSOR_FLAGS_H */
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_type.c b/storage/mroonga/vendor/groonga/lib/mrb/mrb_type.c
new file mode 100644
index 00000000000..9fe602e6c40
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_type.c
@@ -0,0 +1,60 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2014 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
+*/
+
+#include "../grn_ctx_impl.h"
+
+#ifdef GRN_WITH_MRUBY
+#include <mruby.h>
+#include <mruby/class.h>
+#include <mruby/data.h>
+
+#include "mrb_ctx.h"
+#include "mrb_type.h"
+
+static struct mrb_data_type mrb_grn_type_type = {
+ "Groonga::Type",
+ NULL
+};
+
+static mrb_value
+mrb_grn_type_initialize(mrb_state *mrb, mrb_value self)
+{
+ mrb_value mrb_type_ptr;
+
+ mrb_get_args(mrb, "o", &mrb_type_ptr);
+ DATA_TYPE(self) = &mrb_grn_type_type;
+ DATA_PTR(self) = mrb_cptr(mrb_type_ptr);
+ return self;
+}
+
+void
+grn_mrb_type_init(grn_ctx *ctx)
+{
+ grn_mrb_data *data = &(ctx->impl->mrb);
+ mrb_state *mrb = data->state;
+ struct RClass *module = data->module;
+ struct RClass *object_class = data->object_class;
+ struct RClass *klass;
+
+ klass = mrb_define_class_under(mrb, module, "Type", object_class);
+ MRB_SET_INSTANCE_TT(klass, MRB_TT_DATA);
+
+ mrb_define_method(mrb, klass, "initialize",
+ mrb_grn_type_initialize, MRB_ARGS_REQ(1));
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_obj.h b/storage/mroonga/vendor/groonga/lib/mrb/mrb_type.h
index 31d53240f9e..f86167443a6 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/mrb_obj.h
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_type.h
@@ -1,6 +1,6 @@
/* -*- c-basic-offset: 2 -*- */
/*
- Copyright(C) 2013 Brazil
+ Copyright(C) 2014 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,19 +16,19 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef GRN_MRB_OBJ_H
-#define GRN_MRB_OBJ_H
+#ifndef GRN_MRB_TYPE_H
+#define GRN_MRB_TYPE_H
-#include "../ctx.h"
+#include "../grn_ctx.h"
#ifdef __cplusplus
extern "C" {
#endif
-void grn_mrb_obj_init(grn_ctx *ctx);
+void grn_mrb_type_init(grn_ctx *ctx);
#ifdef __cplusplus
}
#endif
-#endif /* GRN_MRB_OBJ_H */
+#endif /* GRN_MRB_TYPE_H */
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_variable_size_column.c b/storage/mroonga/vendor/groonga/lib/mrb/mrb_variable_size_column.c
index 9073b326f85..153b28066d8 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/mrb_variable_size_column.c
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_variable_size_column.c
@@ -16,7 +16,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "../ctx_impl.h"
+#include "../grn_ctx_impl.h"
#ifdef GRN_WITH_MRUBY
#include <mruby.h>
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_variable_size_column.h b/storage/mroonga/vendor/groonga/lib/mrb/mrb_variable_size_column.h
index d120f737671..c904e7023b1 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/mrb_variable_size_column.h
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_variable_size_column.h
@@ -19,7 +19,7 @@
#ifndef GRN_MRB_VARIABLE_SIZE_COLUMN_H
#define GRN_MRB_VARIABLE_SIZE_COLUMN_H
-#include "../ctx.h"
+#include "../grn_ctx.h"
#ifdef __cplusplus
extern "C" {
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_void.c b/storage/mroonga/vendor/groonga/lib/mrb/mrb_void.c
index 976c472be92..bdc451930f6 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/mrb_void.c
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_void.c
@@ -16,7 +16,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "../ctx_impl.h"
+#include "../grn_ctx_impl.h"
#ifdef GRN_WITH_MRUBY
#include <mruby.h>
@@ -24,7 +24,7 @@
#include <mruby/variable.h>
#include <mruby/data.h>
-#include "../db.h"
+#include "../grn_db.h"
#include "mrb_void.h"
static struct mrb_data_type mrb_grn_void_type = {
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_void.h b/storage/mroonga/vendor/groonga/lib/mrb/mrb_void.h
index a766cecb0b7..474d7804c73 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/mrb_void.h
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_void.h
@@ -19,7 +19,7 @@
#ifndef GRN_MRB_VOID_H
#define GRN_MRB_VOID_H
-#include "../ctx.h"
+#include "../grn_ctx.h"
#ifdef __cplusplus
extern "C" {
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_writer.c b/storage/mroonga/vendor/groonga/lib/mrb/mrb_writer.c
new file mode 100644
index 00000000000..e35a066e560
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_writer.c
@@ -0,0 +1,238 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2015 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
+*/
+
+#include "../grn_ctx_impl.h"
+
+#ifdef GRN_WITH_MRUBY
+#include <mruby.h>
+#include <mruby/data.h>
+#include <mruby/hash.h>
+#include <mruby/string.h>
+
+#include "../grn_mrb.h"
+#include "../grn_output.h"
+#include "mrb_ctx.h"
+#include "mrb_writer.h"
+#include "mrb_options.h"
+
+static mrb_value
+writer_write(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ mrb_value target;
+
+ mrb_get_args(mrb, "o", &target);
+
+ switch (mrb_type(target)) {
+ case MRB_TT_FALSE :
+ GRN_OUTPUT_BOOL(GRN_FALSE);
+ break;
+ case MRB_TT_TRUE :
+ GRN_OUTPUT_BOOL(GRN_TRUE);
+ break;
+ case MRB_TT_FIXNUM :
+ GRN_OUTPUT_INT32(mrb_fixnum(target));
+ break;
+ case MRB_TT_FLOAT :
+ GRN_OUTPUT_FLOAT(mrb_float(target));
+ break;
+ case MRB_TT_STRING :
+ GRN_OUTPUT_STR(RSTRING_PTR(target), RSTRING_LEN(target));
+ break;
+ default :
+ mrb_raisef(mrb, E_ARGUMENT_ERROR,
+ "must be true, false, number, float or string: %S", target);
+ break;
+ }
+
+ return mrb_nil_value();
+}
+
+static mrb_value
+writer_open_array(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ char *name;
+ mrb_int n_elements;
+
+ mrb_get_args(mrb, "zi", &name, &n_elements);
+ GRN_OUTPUT_ARRAY_OPEN(name, n_elements);
+
+ return mrb_nil_value();
+}
+
+static mrb_value
+writer_close_array(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+
+ GRN_OUTPUT_ARRAY_CLOSE();
+
+ return mrb_nil_value();
+}
+
+static mrb_value
+writer_open_map(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ char *name;
+ mrb_int n_elements;
+
+ mrb_get_args(mrb, "zi", &name, &n_elements);
+ GRN_OUTPUT_MAP_OPEN(name, n_elements);
+
+ return mrb_nil_value();
+}
+
+static mrb_value
+writer_close_map(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+
+ GRN_OUTPUT_MAP_CLOSE();
+
+ return mrb_nil_value();
+}
+
+static mrb_value
+writer_write_table_columns(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ mrb_value mrb_table;
+ char *columns;
+ mrb_int columns_size;
+ grn_obj *table;
+ grn_obj_format format;
+ int n_hits = 0;
+ int offset = 0;
+ int limit = 0;
+ int hits_offset = 0;
+
+ mrb_get_args(mrb, "os", &mrb_table, &columns, &columns_size);
+
+ table = DATA_PTR(mrb_table);
+ GRN_OBJ_FORMAT_INIT(&format, n_hits, offset, limit, hits_offset);
+ format.flags |= GRN_OBJ_FORMAT_WITH_COLUMN_NAMES;
+ {
+ grn_rc rc;
+ rc = grn_output_format_set_columns(ctx, &format,
+ table, columns, columns_size);
+ if (rc != GRN_SUCCESS) {
+ GRN_OBJ_FORMAT_FIN(ctx, &format);
+ grn_mrb_ctx_check(mrb);
+ }
+ }
+ GRN_OUTPUT_TABLE_COLUMNS(table, &format);
+ GRN_OBJ_FORMAT_FIN(ctx, &format);
+
+ return mrb_nil_value();
+}
+
+static mrb_value
+writer_write_table_records(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ mrb_value mrb_table;
+ mrb_value mrb_options = mrb_nil_value();
+ char *columns;
+ mrb_int columns_size;
+ grn_obj *table;
+ grn_obj_format format;
+ int n_hits = 0;
+ int offset = 0;
+ int limit = -1;
+ int hits_offset = 0;
+
+ mrb_get_args(mrb, "os|H", &mrb_table, &columns, &columns_size, &mrb_options);
+
+ table = DATA_PTR(mrb_table);
+ if (!mrb_nil_p(mrb_options)) {
+ mrb_value mrb_offset;
+ mrb_value mrb_limit;
+
+ mrb_offset = grn_mrb_options_get_lit(mrb, mrb_options, "offset");
+ if (!mrb_nil_p(mrb_offset)) {
+ offset = mrb_fixnum(mrb_offset);
+ }
+
+ mrb_limit = grn_mrb_options_get_lit(mrb, mrb_options, "limit");
+ if (!mrb_nil_p(mrb_limit)) {
+ limit = mrb_fixnum(mrb_limit);
+ }
+ }
+ if (limit < 0) {
+ limit = grn_table_size(ctx, table) + limit + 1;
+ }
+ GRN_OBJ_FORMAT_INIT(&format, n_hits, offset, limit, hits_offset);
+ {
+ grn_rc rc;
+ rc = grn_output_format_set_columns(ctx, &format,
+ table, columns, columns_size);
+ if (rc != GRN_SUCCESS) {
+ GRN_OBJ_FORMAT_FIN(ctx, &format);
+ grn_mrb_ctx_check(mrb);
+ }
+ }
+ GRN_OUTPUT_TABLE_RECORDS(table, &format);
+ GRN_OBJ_FORMAT_FIN(ctx, &format);
+
+ return mrb_nil_value();
+}
+
+static mrb_value
+writer_set_content_type(mrb_state *mrb, mrb_value self)
+{
+ grn_ctx *ctx = (grn_ctx *)mrb->ud;
+ grn_content_type content_type;
+
+ mrb_get_args(mrb, "i", &content_type);
+
+ grn_ctx_set_output_type(ctx, content_type);
+
+ return mrb_nil_value();
+}
+
+void
+grn_mrb_writer_init(grn_ctx *ctx)
+{
+ grn_mrb_data *data = &(ctx->impl->mrb);
+ mrb_state *mrb = data->state;
+ struct RClass *module = data->module;
+ struct RClass *klass;
+
+ klass = mrb_define_class_under(mrb, module, "Writer", mrb->object_class);
+
+ mrb_define_method(mrb, klass, "write", writer_write, MRB_ARGS_REQ(1));
+ mrb_define_method(mrb, klass, "open_array",
+ writer_open_array, MRB_ARGS_REQ(2));
+ mrb_define_method(mrb, klass, "close_array",
+ writer_close_array, MRB_ARGS_NONE());
+ mrb_define_method(mrb, klass, "open_map",
+ writer_open_map, MRB_ARGS_REQ(2));
+ mrb_define_method(mrb, klass, "close_map",
+ writer_close_map, MRB_ARGS_NONE());
+
+ mrb_define_method(mrb, klass, "write_table_columns",
+ writer_write_table_columns, MRB_ARGS_REQ(2));
+ mrb_define_method(mrb, klass, "write_table_records",
+ writer_write_table_records, MRB_ARGS_ARG(2, 1));
+
+ mrb_define_method(mrb, klass, "content_type=",
+ writer_set_content_type, MRB_ARGS_REQ(1));
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_writer.h b/storage/mroonga/vendor/groonga/lib/mrb/mrb_writer.h
new file mode 100644
index 00000000000..a6b4a6b3a75
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_writer.h
@@ -0,0 +1,34 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2015 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
+*/
+
+#ifndef GRN_MRB_WRITER_H
+#define GRN_MRB_WRITER_H
+
+#include "../grn_ctx.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void grn_mrb_writer_init(grn_ctx *ctx);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRN_MRB_WRITER_H */
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/scripts/Makefile.am b/storage/mroonga/vendor/groonga/lib/mrb/scripts/Makefile.am
index 631923e2e06..9b6acf8bbda 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/scripts/Makefile.am
+++ b/storage/mroonga/vendor/groonga/lib/mrb/scripts/Makefile.am
@@ -1,3 +1,9 @@
+SUBDIRS = \
+ command_line \
+ context \
+ initialize \
+ logger
+
include sources.am
EXTRA_DIST = \
@@ -5,5 +11,5 @@ EXTRA_DIST = \
$(RUBY_SCRIPT_FILES)
if WITH_MRUBY
-nobase_ruby_scripts_DATA = $(RUBY_SCRIPT_FILES)
+ruby_scripts_DATA = $(RUBY_SCRIPT_FILES)
endif
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/scripts/backtrace_entry.rb b/storage/mroonga/vendor/groonga/lib/mrb/scripts/backtrace_entry.rb
index 68ea9e4b6f2..34f95e968f5 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/scripts/backtrace_entry.rb
+++ b/storage/mroonga/vendor/groonga/lib/mrb/scripts/backtrace_entry.rb
@@ -5,16 +5,24 @@ module Groonga
match_data = /:(\d+):?/.match(entry)
file = match_data.pre_match
line = match_data[1].to_i
- method = match_data.post_match.gsub(/\Ain /, "")
- new(file, line, method)
+ detail_match_data = /\A(in )?(\S+)\s*/.match(match_data.post_match)
+ if detail_match_data[1]
+ method = detail_match_data[2]
+ message = detail_match_data.post_match
+ else
+ method = ""
+ message = match_data.post_match
+ end
+ new(file, line, method, message)
end
end
- attr_reader :file, :line, :method
- def initialize(file, line, method)
+ attr_reader :file, :line, :method, :message
+ def initialize(file, line, method, message)
@file = file
@line = line
@method = method
+ @message = message
end
end
end
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/scripts/command.rb b/storage/mroonga/vendor/groonga/lib/mrb/scripts/command.rb
new file mode 100644
index 00000000000..c4e3e94bc4e
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/scripts/command.rb
@@ -0,0 +1,35 @@
+module Groonga
+ class Command
+ @@classes = {}
+ class << self
+ def register_class(name, klass)
+ @@classes[name] = klass
+ end
+
+ def find_class(name)
+ @@classes[name]
+ end
+ end
+
+ private
+ def context
+ @context ||= Context.instance
+ end
+
+ def writer
+ @writer ||= context.writer
+ end
+
+ def run_internal(input)
+ begin
+ run_body(input)
+ rescue GroongaError => groonga_error
+ context.set_groonga_error(groonga_error)
+ nil
+ rescue => error
+ context.record_error(:command_error, error)
+ nil
+ end
+ end
+ end
+end
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/scripts/command_line/Makefile.am b/storage/mroonga/vendor/groonga/lib/mrb/scripts/command_line/Makefile.am
new file mode 100644
index 00000000000..8d580810674
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/scripts/command_line/Makefile.am
@@ -0,0 +1,9 @@
+include sources.am
+
+EXTRA_DIST = \
+ $(RUBY_SCRIPT_FILES)
+
+if WITH_MRUBY
+ruby_scripts_command_linedir = $(ruby_scriptsdir)/command_line
+ruby_scripts_command_line_DATA = $(RUBY_SCRIPT_FILES)
+endif
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/scripts/command_line/grndb.rb b/storage/mroonga/vendor/groonga/lib/mrb/scripts/command_line/grndb.rb
new file mode 100644
index 00000000000..96a99c80223
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/scripts/command_line/grndb.rb
@@ -0,0 +1,169 @@
+module Groonga
+ module CommandLine
+ class Grndb
+ def initialize(argv)
+ @command, *@arguments = argv
+ @succeeded = true
+ @executed = false
+ @database_path = nil
+ end
+
+ def run
+ slop = create_slop
+ rest = nil
+ begin
+ rest = slop.parse(@arguments)
+ rescue Slop::Error
+ $stderr.puts($!.message)
+ return false
+ end
+
+ if slop.help?
+ $stdout.puts(slop.help)
+ return true
+ end
+
+ unless @executed
+ if rest.empty?
+ $stderr.puts("No command is specified.")
+ else
+ $stderr.puts("Unknown command: <#{rest.first}>")
+ end
+ return false
+ end
+
+ @succeeded
+ end
+
+ private
+ def create_slop
+ slop = Slop.new
+ command_name = File.basename(@command)
+ slop.banner = "Usage: #{command_name} COMMAND [OPTIONS] DB_PATH"
+ slop_enable_help(slop)
+
+ slop.command "check" do |command|
+ command.description "Check database"
+ slop_enable_help(command)
+
+ command.run do |options, arguments|
+ run_command(options, arguments) do |database, new_arguments|
+ check(database, options, new_arguments)
+ end
+ end
+ end
+
+ slop.command "recover" do |command|
+ command.description "Recover database"
+ slop_enable_help(command)
+
+ command.run do |options, arguments|
+ run_command(options, arguments) do |database, new_arguments|
+ recover(database, options, new_arguments)
+ end
+ end
+ end
+
+ slop
+ end
+
+ def slop_enable_help(slop)
+ slop.on("-h", "--help", "Display this help message.", :tail => true)
+ end
+
+ def open_database(arguments)
+ if arguments.empty?
+ $stderr.puts("Database path is missing")
+ @succeesed = false
+ return
+ end
+
+ database = nil
+ @database_path, *rest_arguments = arguments
+ begin
+ database = Database.open(@database_path)
+ rescue Error => error
+ $stderr.puts("Failed to open database: <#{@database_path}>")
+ $stderr.puts(error.message)
+ @succeeded = false
+ return
+ end
+
+ begin
+ yield(database, rest_arguments)
+ ensure
+ database.close
+ end
+ end
+
+ def run_command(options, arguments)
+ @executed = true
+
+ if options.help?
+ $stdout.puts(options.help)
+ return
+ end
+
+ open_database(arguments) do |database|
+ yield(database)
+ end
+ end
+
+ def recover(database, options, arguments)
+ begin
+ database.recover
+ rescue Error => error
+ $stderr.puts("Failed to recover database: <#{@database_path}>")
+ $stderr.puts(error.message)
+ @succeeded = false
+ end
+ end
+
+ def check(database, options, arguments)
+ if database.locked?
+ message =
+ "Database is locked. " +
+ "It may be broken. " +
+ "Re-create the database."
+ $stdout.puts(message)
+ @succeeded = false
+ end
+
+ database.each do |object|
+ case object
+ when IndexColumn
+ next unless object.locked?
+ message =
+ "[#{object.name}] Index column is locked. " +
+ "It may be broken. " +
+ "Re-create index by '#{@command} recover #{@database_path}'."
+ $stdout.puts(message)
+ @succeeded = false
+ when Column
+ next unless object.locked?
+ name = object.name
+ message =
+ "[#{name}] Data column is locked. " +
+ "It may be broken. " +
+ "(1) Truncate the column (truncate #{name}) or " +
+ "clear lock of the column (lock_clear #{name}) " +
+ "and (2) load data again."
+ $stdout.puts(message)
+ @succeeded = false
+ when Table
+ next unless object.locked?
+ name = object.name
+ message =
+ "[#{name}] Table is locked. " +
+ "It may be broken. " +
+ "(1) Truncate the table (truncate #{name}) or " +
+ "clear lock of the table (lock_clear #{name}) " +
+ "and (2) load data again."
+ $stdout.puts(message)
+ @succeeded = false
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/scripts/command_line/sources.am b/storage/mroonga/vendor/groonga/lib/mrb/scripts/command_line/sources.am
new file mode 100644
index 00000000000..759948eecd6
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/scripts/command_line/sources.am
@@ -0,0 +1,2 @@
+RUBY_SCRIPT_FILES = \
+ grndb.rb
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/scripts/context.rb b/storage/mroonga/vendor/groonga/lib/mrb/scripts/context.rb
index 8ebe2c913b4..e65d6653110 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/scripts/context.rb
+++ b/storage/mroonga/vendor/groonga/lib/mrb/scripts/context.rb
@@ -1,3 +1,6 @@
+require "context/error_level"
+require "context/rc"
+
module Groonga
class Context
def guard(fallback=nil)
@@ -13,19 +16,37 @@ module Groonga
@logger ||= Logger.new
end
+ def writer
+ @writer ||= Writer.new
+ end
+
+ def set_groonga_error(groonga_error)
+ set_error_raw(groonga_error.class.rc,
+ ErrorLevel::ERROR,
+ groonga_error.message,
+ groonga_error.backtrace)
+ end
+
def record_error(rc, error)
rc = RC.find(rc) if rc.is_a?(Symbol)
+ set_error_raw(rc, ErrorLevel::ERROR, error.message, error.backtrace)
+
+ logger.log_error(error)
+ end
+
+ private
+ def set_error_raw(rc, error_level, message, backtrace)
self.rc = rc.to_i
- self.error_level = ErrorLevel.find(:error).to_i
+ self.error_level = error_level.to_i
- backtrace = error.backtrace
- entry = BacktraceEntry.parse(backtrace.first)
- self.error_file = entry.file
- self.error_line = entry.line
- self.error_method = entry.method
- self.error_message = error.message
+ self.error_message = message
- logger.log_error(error)
+ if backtrace
+ entry = BacktraceEntry.parse(backtrace.first)
+ self.error_file = entry.file
+ self.error_line = entry.line
+ self.error_method = entry.method
+ end
end
end
end
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/scripts/context/Makefile.am b/storage/mroonga/vendor/groonga/lib/mrb/scripts/context/Makefile.am
new file mode 100644
index 00000000000..8d862082cce
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/scripts/context/Makefile.am
@@ -0,0 +1,9 @@
+include sources.am
+
+EXTRA_DIST = \
+ $(RUBY_SCRIPT_FILES)
+
+if WITH_MRUBY
+ruby_scripts_contextdir = $(ruby_scriptsdir)/context
+ruby_scripts_context_DATA = $(RUBY_SCRIPT_FILES)
+endif
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/scripts/context/rc.rb b/storage/mroonga/vendor/groonga/lib/mrb/scripts/context/rc.rb
index 2863c7f6195..f06b32d78b6 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/scripts/context/rc.rb
+++ b/storage/mroonga/vendor/groonga/lib/mrb/scripts/context/rc.rb
@@ -5,13 +5,19 @@ module Groonga
class << self
def find(name)
- @@names[name]
+ @@names[name] || UNKNOWN_ERROR
+ end
+
+ def register(name, code, error_class)
+ rc = new(name, code)
+ @@names[name] = rc
+ error_class.rc = rc if error_class
+ rc
end
end
attr_reader :name
def initialize(name, code)
- @@names[name] = self
@name = name
@code = code
end
@@ -20,80 +26,164 @@ module Groonga
@code
end
- SUCCESS = new(:success, 0)
- END_OF_DATA = new(:end_of_data, 1)
- UNKNOWN_ERROR = new(:unknown_error, -1)
- OPERATION_NOT_PERMITTED = new(:operation_not_permitted, -2)
- NO_SUCH_FILE_OR_DIRECTORY = new(:no_such_file_or_directory, -3)
- NO_SUCH_PROCESS = new(:no_such_process, -4)
- INTERRUPTED_FUNCTION_CALL = new(:interrupted_function_call, -5)
- INPUT_OUTPUT_ERROR = new(:input_output_error, -6)
- NO_SUCH_DEVICE_OR_ADDRESS = new(:no_such_device_or_address, -7)
- ARG_LIST_TOO_LONG = new(:arg_list_too_long, -8)
- EXEC_FORMAT_ERROR = new(:exec_format_error, -9)
- BAD_FILE_DESCRIPTOR = new(:bad_file_descriptor, -10)
- NO_CHILD_PROCESSES = new(:no_child_processes, -11)
- RESOURCE_TEMPORARILY_UNAVAILABLE = new(:resource_temporarily_unavailable, -12)
- NOT_ENOUGH_SPACE = new(:not_enough_space, -13)
- PERMISSION_DENIED = new(:permission_denied, -14)
- BAD_ADDRESS = new(:bad_address, -15)
- RESOURCE_BUSY = new(:resource_busy, -16)
- FILE_EXISTS = new(:file_exists, -17)
- IMPROPER_LINK = new(:improper_link, -18)
- NO_SUCH_DEVICE = new(:no_such_device, -19)
- NOT_A_DIRECTORY = new(:not_a_directory, -20)
- IS_A_DIRECTORY = new(:is_a_directory, -21)
- INVALID_ARGUMENT = new(:invalid_argument, -22)
- TOO_MANY_OPEN_FILES_IN_SYSTEM = new(:too_many_open_files_in_system, -23)
- TOO_MANY_OPEN_FILES = new(:too_many_open_files, -24)
- INAPPROPRIATE_IO_CONTROL_OPERATION = new(:inappropriate_io_control_operation, -25)
- FILE_TOO_LARGE = new(:file_too_large, -26)
- NO_SPACE_LEFT_ON_DEVICE = new(:no_space_left_on_device, -27)
- INVALID_SEEK = new(:invalid_seek, -28)
- READ_ONLY_FILE_SYSTEM = new(:read_only_file_system, -29)
- TOO_MANY_LINKS = new(:too_many_links, -30)
- BROKEN_PIPE = new(:broken_pipe, -31)
- DOMAIN_ERROR = new(:domain_error, -32)
- RESULT_TOO_LARGE = new(:result_too_large, -33)
- RESOURCE_DEADLOCK_AVOIDED = new(:resource_deadlock_avoided, -34)
- NO_MEMORY_AVAILABLE = new(:no_memory_available, -35)
- FILENAME_TOO_LONG = new(:filename_too_long, -36)
- NO_LOCKS_AVAILABLE = new(:no_locks_available, -37)
- FUNCTION_NOT_IMPLEMENTED = new(:function_not_implemented, -38)
- DIRECTORY_NOT_EMPTY = new(:directory_not_empty, -39)
- ILLEGAL_BYTE_SEQUENCE = new(:illegal_byte_sequence, -40)
- SOCKET_NOT_INITIALIZED = new(:socket_not_initialized, -41)
- OPERATION_WOULD_BLOCK = new(:operation_would_block, -42)
- ADDRESS_IS_NOT_AVAILABLE = new(:address_is_not_available, -43)
- NETWORK_IS_DOWN = new(:network_is_down, -44)
- NO_BUFFER = new(:no_buffer, -45)
- SOCKET_IS_ALREADY_CONNECTED = new(:socket_is_already_connected, -46)
- SOCKET_IS_NOT_CONNECTED = new(:socket_is_not_connected, -47)
- SOCKET_IS_ALREADY_SHUTDOWNED = new(:socket_is_already_shutdowned, -48)
- OPERATION_TIMEOUT = new(:operation_timeout, -49)
- CONNECTION_REFUSED = new(:connection_refused, -50)
- RANGE_ERROR = new(:range_error, -51)
- TOKENIZER_ERROR = new(:tokenizer_error, -52)
- FILE_CORRUPT = new(:file_corrupt, -53)
- INVALID_FORMAT = new(:invalid_format, -54)
- OBJECT_CORRUPT = new(:object_corrupt, -55)
- TOO_MANY_SYMBOLIC_LINKS = new(:too_many_symbolic_links, -56)
- NOT_SOCKET = new(:not_socket, -57)
- OPERATION_NOT_SUPPORTED = new(:operation_not_supported, -58)
- ADDRESS_IS_IN_USE = new(:address_is_in_use, -59)
- ZLIB_ERROR = new(:zlib_error, -60)
- LZO_ERROR = new(:lzo_error, -61)
- STACK_OVER_FLOW = new(:stack_over_flow, -62)
- SYNTAX_ERROR = new(:syntax_error, -63)
- RETRY_MAX = new(:retry_max, -64)
- INCOMPATIBLE_FILE_FORMAT = new(:incompatible_file_format, -65)
- UPDATE_NOT_ALLOWED = new(:update_not_allowed, -66)
- TOO_SMALL_OFFSET = new(:too_small_offset, -67)
- TOO_LARGE_OFFSET = new(:too_large_offset, -68)
- TOO_SMALL_LIMIT = new(:too_small_limit, -69)
- CAS_ERROR = new(:cas_error, -70)
- UNSUPPORTED_COMMAND_VERSION = new(:unsupported_command_version, -71)
- NORMALIZER_ERROR = new(:normalizer_error, -72)
+ SUCCESS =
+ register(:success, 0, nil)
+ END_OF_DATA =
+ register(:end_of_data, 1, EndOfData)
+ UNKNOWN_ERROR =
+ register(:unknown_error, -1, UnknownError)
+ OPERATION_NOT_PERMITTED =
+ register(:operation_not_permitted, -2, OperationNotPermitted)
+ NO_SUCH_FILE_OR_DIRECTORY =
+ register(:no_such_file_or_directory, -3, NoSuchFileOrDirectory)
+ NO_SUCH_PROCESS =
+ register(:no_such_process, -4, NoSuchProcess)
+ INTERRUPTED_FUNCTION_CALL =
+ register(:interrupted_function_call, -5, InterruptedFunctionCall)
+ INPUT_OUTPUT_ERROR =
+ register(:input_output_error, -6, InputOutputError)
+ NO_SUCH_DEVICE_OR_ADDRESS =
+ register(:no_such_device_or_address, -7, NoSuchDeviceOrAddress)
+ ARG_LIST_TOO_LONG =
+ register(:arg_list_too_long, -8, ArgListTooLong)
+ EXEC_FORMAT_ERROR =
+ register(:exec_format_error, -9, ExecFormatError)
+ BAD_FILE_DESCRIPTOR =
+ register(:bad_file_descriptor, -10, BadFileDescriptor)
+ NO_CHILD_PROCESSES =
+ register(:no_child_processes, -11, NoChildProcesses)
+ RESOURCE_TEMPORARILY_UNAVAILABLE =
+ register(:resource_temporarily_unavailable, -12,
+ ResourceTemporarilyUnavailable)
+ NOT_ENOUGH_SPACE =
+ register(:not_enough_space, -13, NotEnoughSpace)
+ PERMISSION_DENIED =
+ register(:permission_denied, -14, PermissionDenied)
+ BAD_ADDRESS =
+ register(:bad_address, -15, BadAddress)
+ RESOURCE_BUSY =
+ register(:resource_busy, -16, ResourceBusy)
+ FILE_EXISTS =
+ register(:file_exists, -17, FileExists)
+ IMPROPER_LINK =
+ register(:improper_link, -18, ImproperLink)
+ NO_SUCH_DEVICE =
+ register(:no_such_device, -19, NoSuchDevice)
+ NOT_DIRECTORY =
+ register(:not_directory, -20, NotDirectory)
+ IS_DIRECTORY =
+ register(:is_directory, -21, IsDirectory)
+ INVALID_ARGUMENT =
+ register(:invalid_argument, -22, InvalidArgument)
+ TOO_MANY_OPEN_FILES_IN_SYSTEM =
+ register(:too_many_open_files_in_system, -23, TooManyOpenFilesInSystem)
+ TOO_MANY_OPEN_FILES =
+ register(:too_many_open_files, -24, TooManyOpenFiles)
+ INAPPROPRIATE_IO_CONTROL_OPERATION =
+ register(:inappropriate_io_control_operation, -25,
+ InappropriateIOControlOperation)
+ FILE_TOO_LARGE =
+ register(:file_too_large, -26, FileTooLarge)
+ NO_SPACE_LEFT_ON_DEVICE =
+ register(:no_space_left_on_device, -27, NoSpaceLeftOnDevice)
+ INVALID_SEEK =
+ register(:invalid_seek, -28, InvalidSeek)
+ READ_ONLY_FILE_SYSTEM =
+ register(:read_only_file_system, -29, ReadOnlyFileSystem)
+ TOO_MANY_LINKS =
+ register(:too_many_links, -30, TooManyLinks)
+ BROKEN_PIPE =
+ register(:broken_pipe, -31, BrokenPipe)
+ DOMAIN_ERROR =
+ register(:domain_error, -32, DomainError)
+ RESULT_TOO_LARGE =
+ register(:result_too_large, -33, ResultTooLarge)
+ RESOURCE_DEADLOCK_AVOIDED =
+ register(:resource_deadlock_avoided, -34, ResourceDeadlockAvoided)
+ NO_MEMORY_AVAILABLE =
+ register(:no_memory_available, -35, NoMemoryAvailable)
+ FILENAME_TOO_LONG =
+ register(:filename_too_long, -36, FilenameTooLong)
+ NO_LOCKS_AVAILABLE =
+ register(:no_locks_available, -37, NoLocksAvailable)
+ FUNCTION_NOT_IMPLEMENTED =
+ register(:function_not_implemented, -38, FunctionNotImplemented)
+ DIRECTORY_NOT_EMPTY =
+ register(:directory_not_empty, -39, DirectoryNotEmpty)
+ ILLEGAL_BYTE_SEQUENCE =
+ register(:illegal_byte_sequence, -40, IllegalByteSequence)
+ SOCKET_NOT_INITIALIZED =
+ register(:socket_not_initialized, -41, SocketNotInitialized)
+ OPERATION_WOULD_BLOCK =
+ register(:operation_would_block, -42, OperationWouldBlock)
+ ADDRESS_IS_NOT_AVAILABLE =
+ register(:address_is_not_available, -43, AddressIsNotAvailable)
+ NETWORK_IS_DOWN =
+ register(:network_is_down, -44, NetworkIsDown)
+ NO_BUFFER =
+ register(:no_buffer, -45, NoBuffer)
+ SOCKET_IS_ALREADY_CONNECTED =
+ register(:socket_is_already_connected, -46, SocketIsAlreadyConnected)
+ SOCKET_IS_NOT_CONNECTED =
+ register(:socket_is_not_connected, -47, SocketIsNotConnected)
+ SOCKET_IS_ALREADY_SHUTDOWNED =
+ register(:socket_is_already_shutdowned, -48, SocketIsAlreadyShutdowned)
+ OPERATION_TIMEOUT =
+ register(:operation_timeout, -49, OperationTimeout)
+ CONNECTION_REFUSED =
+ register(:connection_refused, -50, ConnectionRefused)
+ RANGE_ERROR =
+ register(:range_error, -51, RangeError)
+ TOKENIZER_ERROR =
+ register(:tokenizer_error, -52, TokenizerError)
+ FILE_CORRUPT =
+ register(:file_corrupt, -53, FileCorrupt)
+ INVALID_FORMAT =
+ register(:invalid_format, -54, InvalidFormat)
+ OBJECT_CORRUPT =
+ register(:object_corrupt, -55, ObjectCorrupt)
+ TOO_MANY_SYMBOLIC_LINKS =
+ register(:too_many_symbolic_links, -56, TooManySymbolicLinks)
+ NOT_SOCKET =
+ register(:not_socket, -57, NotSocket)
+ OPERATION_NOT_SUPPORTED =
+ register(:operation_not_supported, -58, OperationNotSupported)
+ ADDRESS_IS_IN_USE =
+ register(:address_is_in_use, -59, AddressIsInUse)
+ ZLIB_ERROR =
+ register(:zlib_error, -60, ZlibError)
+ LZ4_ERROR =
+ register(:lz4_error, -61, LZ4Error)
+ STACK_OVER_FLOW =
+ register(:stack_over_flow, -62, StackOverFlow)
+ SYNTAX_ERROR =
+ register(:syntax_error, -63, SyntaxError)
+ RETRY_MAX =
+ register(:retry_max, -64, RetryMax)
+ INCOMPATIBLE_FILE_FORMAT =
+ register(:incompatible_file_format, -65, IncompatibleFileFormat)
+ UPDATE_NOT_ALLOWED =
+ register(:update_not_allowed, -66, UpdateNotAllowed)
+ TOO_SMALL_OFFSET =
+ register(:too_small_offset, -67, TooSmallOffset)
+ TOO_LARGE_OFFSET =
+ register(:too_large_offset, -68, TooLargeOffset)
+ TOO_SMALL_LIMIT =
+ register(:too_small_limit, -69, TooSmallLimit)
+ CAS_ERROR =
+ register(:cas_error, -70, CASError)
+ UNSUPPORTED_COMMAND_VERSION =
+ register(:unsupported_command_version, -71, UnsupportedCommandVersion)
+ NORMALIZER_ERROR =
+ register(:normalizer_error, -72, NormalizerError)
+ TOKEN_FILTER_ERROR =
+ register(:token_filter_error, -73, TokenFilterError)
+ COMMAND_ERROR =
+ register(:command_error, -74, CommandError)
+ PLUGIN_ERROR =
+ register(:plugin_error, -75, PluginError)
+
+ GroongaError.rc = UNKNOWN_ERROR
end
end
end
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/scripts/context/sources.am b/storage/mroonga/vendor/groonga/lib/mrb/scripts/context/sources.am
new file mode 100644
index 00000000000..1f0d1624ce5
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/scripts/context/sources.am
@@ -0,0 +1,3 @@
+RUBY_SCRIPT_FILES = \
+ error_level.rb \
+ rc.rb
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/scripts/database.rb b/storage/mroonga/vendor/groonga/lib/mrb/scripts/database.rb
new file mode 100644
index 00000000000..54d9dc1a631
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/scripts/database.rb
@@ -0,0 +1,39 @@
+module Groonga
+ class Database
+ def each
+ context = Context.instance
+ flags =
+ TableCursorFlags::ASCENDING |
+ TableCursorFlags::BY_ID
+ TableCursor.open(self, :flags => flags) do |cursor|
+ cursor.each do |id|
+ object = context[id]
+ yield(object) if object
+ end
+ end
+ end
+
+ def each_table(options={})
+ context = Context.instance
+ min = options[:prefix]
+ flags = 0
+ if options[:order] == :descending
+ flags |= TableCursorFlags::DESCENDING
+ else
+ flags |= TableCursorFlags::ASCENDING
+ end
+ if options[:order_by] == :id
+ flags |= TableCursorFlags::BY_ID
+ else
+ flags |= TableCursorFlags::BY_KEY
+ end
+ flags |= TableCursorFlags::PREFIX if min
+ TableCursor.open(self, :min => min, :flags => flags) do |cursor|
+ cursor.each do |id|
+ object = context[id]
+ yield(object) if object.is_a?(Table)
+ end
+ end
+ end
+ end
+end
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/scripts/error.rb b/storage/mroonga/vendor/groonga/lib/mrb/scripts/error.rb
new file mode 100644
index 00000000000..e39c904534a
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/scripts/error.rb
@@ -0,0 +1,16 @@
+module Groonga
+ class GroongaError
+ class << self
+ def rc
+ @rc
+ end
+
+ def rc=(rc)
+ @rc = rc
+ end
+ end
+ end
+
+ class ErrorMessage < Error
+ end
+end
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/scripts/expression.rb b/storage/mroonga/vendor/groonga/lib/mrb/scripts/expression.rb
index 29290e207f2..7b1199b7795 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/scripts/expression.rb
+++ b/storage/mroonga/vendor/groonga/lib/mrb/scripts/expression.rb
@@ -1,3 +1,8 @@
+require "scan_info"
+require "scan_info_builder"
+
+require "expression_size_estimator"
+
module Groonga
class Expression
def build_scan_info(op, size)
@@ -9,5 +14,23 @@ module Groonga
nil
end
end
+
+ def estimate_size(table)
+ begin
+ estimator = ExpressionSizeEstimator.new(self, table)
+ estimator.estimate
+ rescue GroongaError => groonga_error
+ context.set_groonga_error(groonga_error)
+ table.size
+ rescue => error
+ context.record_error(:unknown_error, error)
+ table.size
+ end
+ end
+
+ private
+ def context
+ @context ||= Context.instance
+ end
end
end
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/scripts/expression_size_estimator.rb b/storage/mroonga/vendor/groonga/lib/mrb/scripts/expression_size_estimator.rb
new file mode 100644
index 00000000000..73b44cae3dd
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/scripts/expression_size_estimator.rb
@@ -0,0 +1,155 @@
+module Groonga
+ class ExpressionSizeEstimator
+ def initialize(expression, table)
+ @expression = expression
+ @table = table
+ @table_size = @table.size
+ end
+
+ def estimate
+ builder = ScanInfoBuilder.new(@expression, Operator::OR, 0)
+ data_list = builder.build
+ return @table_size if data_list.nil?
+
+ or_data_list = group_data_list(data_list)
+ or_sizes = or_data_list.collect do |and_data_list|
+ and_sizes = and_data_list.collect do |data|
+ size = estimate_data(data)
+ if data.logical_op == Operator::AND_NOT
+ size = @table_size - size
+ size = 0 if size < 0
+ end
+ size
+ end
+ and_sizes.min
+ end
+ or_sizes.max
+ end
+
+ private
+ def group_data_list(data_list)
+ or_data_list = [[]]
+ data_list.each do |data|
+ next if data.op == Operator::NOP
+
+ and_data_list = or_data_list.last
+ if and_data_list.empty?
+ and_data_list << data
+ else
+ case data.logical_op
+ when Operator::AND, Operator::AND_NOT
+ and_data_list << data
+ else
+ and_data_list = [data]
+ or_data_list << and_data_list
+ end
+ end
+ end
+ or_data_list
+ end
+
+ def estimate_data(data)
+ search_index = data.search_indexes.first
+ return @table_size if search_index.nil?
+
+ index_column = resolve_index_column(search_index.index_column,
+ data.op)
+ return @table_size if index_column.nil?
+
+ size = nil
+ case data.op
+ when Operator::MATCH
+ size = estimate_match(data, index_column)
+ when Operator::REGEXP
+ size = estimate_regexp(data, index_column)
+ when Operator::EQUAL
+ size = estimate_equal(data, index_column)
+ when Operator::LESS,
+ Operator::LESS_EQUAL,
+ Operator::GREATER,
+ Operator::GREATER_EQUAL
+ size = estimate_range(data, index_column)
+ when Operator::CALL
+ procedure = data.args.first
+ if procedure.is_a?(Procedure) and procedure.name == "between"
+ size = estimate_between(data, index_column)
+ end
+ end
+ size || @table_size
+ end
+
+ def resolve_index_column(index_column, operator)
+ while index_column.is_a?(Accessor)
+ index_info = index_column.find_index(operator)
+ return nil if index_info.nil?
+ index_column = index_info.index
+ end
+
+ index_column
+ end
+
+ def estimate_match(data, index_column)
+ index_column.estimate_size(:query => data.query.value)
+ end
+
+ def estimate_regexp(data, index_column)
+ index_column.estimate_size(:query => data.query.value,
+ :mode => data.op)
+ end
+
+ def estimate_equal(data, index_column)
+ lexicon = index_column.lexicon
+ term_id = lexicon[data.query]
+ return 0 if term_id.nil?
+
+ index_column.estimate_size(:term_id => term_id)
+ end
+
+ def estimate_range(data, index_column)
+ lexicon = index_column.lexicon
+ value = data.query.value
+ options = {}
+ case data.op
+ when Operator::LESS
+ options[:max] = value
+ options[:flags] = TableCursorFlags::LT
+ when Operator::LESS_EQUAL
+ options[:max] = value
+ options[:flags] = TableCursorFlags::LE
+ when Operator::GREATER
+ options[:min] = value
+ options[:flags] = TableCursorFlags::GT
+ when Operator::GREATER_EQUAL
+ options[:min] = value
+ options[:flags] = TableCursorFlags::GE
+ end
+ TableCursor.open(lexicon, options) do |cursor|
+ index_column.estimate_size(:lexicon_cursor => cursor)
+ end
+ end
+
+ def estimate_between(data, index_column)
+ lexicon = index_column.lexicon
+ _, _, min, min_border, max, max_border = data.args
+ options = {
+ :min => min,
+ :max => max,
+ :flags => 0,
+ }
+ if min_border == "include"
+ options[:flags] |= TableCursorFlags::LT
+ else
+ options[:flags] |= TableCursorFlags::LE
+ end
+ if max_border == "include"
+ options[:flags] |= TableCursorFlags::GT
+ else
+ options[:flags] |= TableCursorFlags::GE
+ end
+
+ TableCursor.open(lexicon, options) do |cursor|
+ index_column.estimate_size(:lexicon_cursor => cursor)
+ end
+ end
+ end
+end
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/scripts/index_column.rb b/storage/mroonga/vendor/groonga/lib/mrb/scripts/index_column.rb
new file mode 100644
index 00000000000..25ebc149367
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/scripts/index_column.rb
@@ -0,0 +1,39 @@
+module Groonga
+ class IndexColumn
+ private :estimate_size_for_term_id
+ private :estimate_size_for_query
+ private :estimate_size_for_lexicon_cursor
+
+ # Estimate the number of matched records for term ID or query.
+ #
+ # @overload estimate_size(:term_id => term_id)
+ # @return [Integer] the number of matched records for the term ID.
+ #
+ # @overload estimate_size(:query => query)
+ # @return [Integer] the number of matched records for the query.
+ #
+ # @overload estimate_size(:lexicon_cursor => lexicon_cursor)
+ # @return [Integer] the number of matched records for the lexicon cursor.
+ #
+ def estimate_size(parameters)
+ term_id = parameters[:term_id]
+ if term_id
+ return estimate_size_for_term_id(term_id)
+ end
+
+ query = parameters[:query]
+ if query
+ return estimate_size_for_query(query, parameters)
+ end
+
+ lexicon_cursor = parameters[:lexicon_cursor]
+ if lexicon_cursor
+ return estimate_size_for_lexicon_cursor(lexicon_cursor)
+ end
+
+ message =
+ "must specify :term_id, :query, :lexicon_cursor: #{parameters.inspect}"
+ raise InvalidArgument, message
+ end
+ end
+end
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/scripts/index_cursor.rb b/storage/mroonga/vendor/groonga/lib/mrb/scripts/index_cursor.rb
new file mode 100644
index 00000000000..8044066930a
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/scripts/index_cursor.rb
@@ -0,0 +1,18 @@
+module Groonga
+ class IndexCursor
+ class << self
+ def open(*arguments)
+ cursor = open_raw(*arguments)
+ if block_given?
+ begin
+ yield(cursor)
+ ensure
+ cursor.close
+ end
+ else
+ cursor
+ end
+ end
+ end
+ end
+end
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/scripts/initialize/Makefile.am b/storage/mroonga/vendor/groonga/lib/mrb/scripts/initialize/Makefile.am
new file mode 100644
index 00000000000..e7531fdc029
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/scripts/initialize/Makefile.am
@@ -0,0 +1,9 @@
+include sources.am
+
+EXTRA_DIST = \
+ $(RUBY_SCRIPT_FILES)
+
+if WITH_MRUBY
+ruby_scripts_initializedir = $(ruby_scriptsdir)/initialize
+ruby_scripts_initialize_DATA = $(RUBY_SCRIPT_FILES)
+endif
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/scripts/initialize/post.rb b/storage/mroonga/vendor/groonga/lib/mrb/scripts/initialize/post.rb
new file mode 100644
index 00000000000..ea26a031e0a
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/scripts/initialize/post.rb
@@ -0,0 +1,18 @@
+require "error"
+
+require "context"
+
+require "writer"
+
+require "object"
+require "database"
+require "index_column"
+require "command"
+require "table_cursor"
+require "index_cursor"
+
+require "expression"
+
+require "plugin_loader"
+
+require "eval_context"
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/scripts/initialize/pre.rb b/storage/mroonga/vendor/groonga/lib/mrb/scripts/initialize/pre.rb
new file mode 100644
index 00000000000..99300d11a92
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/scripts/initialize/pre.rb
@@ -0,0 +1,3 @@
+require "backtrace_entry"
+
+require "operator"
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/scripts/initialize/sources.am b/storage/mroonga/vendor/groonga/lib/mrb/scripts/initialize/sources.am
new file mode 100644
index 00000000000..3c26e19b2ae
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/scripts/initialize/sources.am
@@ -0,0 +1,3 @@
+RUBY_SCRIPT_FILES = \
+ pre.rb \
+ post.rb
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/scripts/logger.rb b/storage/mroonga/vendor/groonga/lib/mrb/scripts/logger.rb
index 06f99c14fc3..cb747a418d6 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/scripts/logger.rb
+++ b/storage/mroonga/vendor/groonga/lib/mrb/scripts/logger.rb
@@ -3,14 +3,19 @@ module Groonga
def log_error(error)
log_level = Level::ERROR.to_i
- message = "#{error.class}: #{error.message}"
+ if error.is_a?(Error)
+ message = error.message
+ else
+ message = "#{error.class}: #{error.message}"
+ end
backtrace = error.backtrace
- first_raw_entry = backtrace.first
- if first_raw_entry
- first_entry = BacktraceEntry.parse(first_raw_entry)
- file = first_entry.file
- line = first_entry.line
- method = first_entry.method
+ last_raw_entry = backtrace.last
+ if last_raw_entry
+ last_entry = BacktraceEntry.parse(last_raw_entry)
+ file = last_entry.file
+ line = last_entry.line
+ method = last_entry.method
+ # message = "#{file}:#{line}:#{method}: #{message}"
else
file = ""
line = 0
@@ -18,8 +23,11 @@ module Groonga
end
log(log_level, file, line, method, message)
- backtrace.each do |raw_entry|
+ backtrace.reverse_each.with_index do |raw_entry, i|
+ next if i == 0
entry = BacktraceEntry.parse(raw_entry)
+ message = entry.message
+ message = raw_entry if message.empty?
log(log_level, entry.file, entry.line, entry.method, raw_entry)
end
end
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/scripts/logger/Makefile.am b/storage/mroonga/vendor/groonga/lib/mrb/scripts/logger/Makefile.am
new file mode 100644
index 00000000000..448e72ca5bc
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/scripts/logger/Makefile.am
@@ -0,0 +1,9 @@
+include sources.am
+
+EXTRA_DIST = \
+ $(RUBY_SCRIPT_FILES)
+
+if WITH_MRUBY
+ruby_scripts_loggerdir = $(ruby_scriptsdir)/logger
+ruby_scripts_logger_DATA = $(RUBY_SCRIPT_FILES)
+endif
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/scripts/logger/sources.am b/storage/mroonga/vendor/groonga/lib/mrb/scripts/logger/sources.am
new file mode 100644
index 00000000000..7231ee4eecb
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/scripts/logger/sources.am
@@ -0,0 +1,2 @@
+RUBY_SCRIPT_FILES = \
+ level.rb
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/scripts/object.rb b/storage/mroonga/vendor/groonga/lib/mrb/scripts/object.rb
index f1cc1a6aa79..d98b5069e7f 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/scripts/object.rb
+++ b/storage/mroonga/vendor/groonga/lib/mrb/scripts/object.rb
@@ -1,7 +1,11 @@
module Groonga
class Object
- def inspect
- super[0..-2] + ": #{grn_inspect}>"
+ def domain
+ Context.instance[domain_id]
+ end
+
+ def range
+ Context.instance[range_id]
end
end
end
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/scripts/operator.rb b/storage/mroonga/vendor/groonga/lib/mrb/scripts/operator.rb
new file mode 100644
index 00000000000..349695e1a53
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/scripts/operator.rb
@@ -0,0 +1,22 @@
+module Groonga
+ class Operator
+ @values = {}
+ class << self
+ def register(operator)
+ const_set(operator.name, operator)
+ @values[operator.value] = operator
+ end
+
+ def find(value)
+ @values[value]
+ end
+ end
+
+ attr_reader :name
+ attr_reader :value
+ def initialize(name, value)
+ @name = name
+ @value = value
+ end
+ end
+end
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/scripts/plugin_loader.rb b/storage/mroonga/vendor/groonga/lib/mrb/scripts/plugin_loader.rb
new file mode 100644
index 00000000000..09b972f120d
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/scripts/plugin_loader.rb
@@ -0,0 +1,14 @@
+module Groonga
+ class PluginLoader
+ class << self
+ def load_file(path)
+ begin
+ load(path)
+ rescue => error
+ Context.instance.record_error(:plugin_error, error)
+ nil
+ end
+ end
+ end
+ end
+end
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/scripts/require.rb b/storage/mroonga/vendor/groonga/lib/mrb/scripts/require.rb
new file mode 100644
index 00000000000..a824e92fa51
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/scripts/require.rb
@@ -0,0 +1,68 @@
+$" = [__FILE__]
+
+class ScriptLoader
+ @@loading_paths = {}
+
+ def initialize(path)
+ @base_path = path
+ end
+
+ def load_once
+ if absolete_path?(@base_path)
+ loaded = load_once_path(@base_path)
+ if loaded.nil?
+ raise LoadError, error_message
+ else
+ loaded
+ end
+ else
+ $LOAD_PATH.each do |load_path|
+ unless absolete_path?(load_path)
+ load_path = File.expand_path(load_path)
+ end
+ loaded = load_once_path(File.join(load_path, @base_path))
+ return loaded unless loaded.nil?
+ end
+ raise LoadError, error_message
+ end
+ end
+
+ private
+ def error_message
+ "cannot load such file -- #{@base_path}"
+ end
+
+ def absolete_path?(path)
+ path.start_with?("/")
+ end
+
+ def load_once_path(path)
+ loaded = load_once_absolete_path(path)
+ return loaded unless loaded.nil?
+
+ return nil unless File.extname(path).empty?
+
+ load_once_absolete_path("#{path}.rb")
+ end
+
+ def load_once_absolete_path(path)
+ return false if $".include?(path)
+ return false if @@loading_paths.key?(path)
+
+ return nil unless File.file?(path)
+
+ @@loading_paths[path] = true
+ load(path)
+ $" << path
+ @@loading_paths.delete(path)
+
+ true
+ end
+end
+
+module Kernel
+ def require(path)
+ loader = ScriptLoader.new(path)
+ loader.load_once
+ end
+end
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/scripts/scan_info.rb b/storage/mroonga/vendor/groonga/lib/mrb/scripts/scan_info.rb
index cf0056d7fd3..a98cf792a9c 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/scripts/scan_info.rb
+++ b/storage/mroonga/vendor/groonga/lib/mrb/scripts/scan_info.rb
@@ -22,8 +22,13 @@ module Groonga
data.args.each do |arg|
push_arg(arg)
end
- data.indexes.each do |index, section_id, weight|
- put_index(index, section_id, weight)
+ data.search_indexes.each do |search_index|
+ put_index(search_index.index_column,
+ search_index.section_id,
+ search_index.weight,
+ search_index.scorer,
+ search_index.scorer_args_expr,
+ search_index.scorer_args_expr_offset || 0)
end
end
end
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/scripts/scan_info_builder.rb b/storage/mroonga/vendor/groonga/lib/mrb/scripts/scan_info_builder.rb
index 5e258e90e5a..dc003f88948 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/scripts/scan_info_builder.rb
+++ b/storage/mroonga/vendor/groonga/lib/mrb/scripts/scan_info_builder.rb
@@ -1,11 +1,6 @@
-module Groonga
- # TODO: Move me
- class ExpressionCode
- module Flags
- RELATIONAL_EXPRESSION = 0x01
- end
- end
+require "scan_info_data"
+module Groonga
class ScanInfoBuilder
module Status
START = 0
@@ -39,6 +34,21 @@ module Groonga
Operator::GEO_WITHINP6,
Operator::GEO_WITHINP8,
Operator::TERM_EXTRACT,
+ Operator::REGEXP,
+ ]
+
+ ARITHMETIC_OPERATORS = [
+ Operator::BITWISE_OR,
+ Operator::BITWISE_XOR,
+ Operator::BITWISE_AND,
+ Operator::BITWISE_NOT,
+ Operator::SHIFTL,
+ Operator::SHIFTR,
+ Operator::SHIFTRR,
+ Operator::PLUS,
+ Operator::MINUS,
+ Operator::STAR,
+ Operator::MOD,
]
LOGICAL_OPERATORS = [
@@ -89,7 +99,7 @@ module Groonga
status = Status::COL1
data.args << code.value
when Status::COL1
- raise "invalid expression: can't use column as a value: <#{code.value.name}>: <#{@expression.grn_inspect}>"
+ raise ErrorMessage, "invalid expression: can't use column as a value: <#{code.value.name}>: <#{@expression.grn_inspect}>"
status = Status::COL2
when Status::COL2
# Do nothing
@@ -114,7 +124,7 @@ module Groonga
first_data = @data_list.first
if (first_data.flags & ScanInfo::Flags::PUSH) == 0 or
first_data.logical_op != @operator
- raise "invalid expr"
+ raise ErrorMessage, "invalid expr"
else
first_data.flags &= ~ScanInfo::Flags::PUSH
first_data.logical_op = @operator
@@ -140,6 +150,11 @@ module Groonga
return false if status > Status::CONST
status = Status::START
n_relation_expressions += 1
+ when *ARITHMETIC_OPERATORS
+ return false if status < Status::COL1
+ return false if status > Status::CONST
+ status = Status::START
+ return false if n_relation_expressions != (n_logical_expressions + 1)
when *LOGICAL_OPERATORS
return false if status != Status::START
n_logical_expressions += 1
@@ -206,10 +221,12 @@ module Groonga
new_data.flags = ScanInfo::Flags::POP
new_data.logical_op = operator
@data_list << new_data
+ break
end
else
data.flags &= ~ScanInfo::Flags::PUSH
data.logical_op = operator
+ break
end
else
if n_dif_ops > 0
@@ -225,6 +242,7 @@ module Groonga
@data_list[r..-1] +
@data_list[j...r]
end
+ break
end
end
else
@@ -235,7 +253,7 @@ module Groonga
end
if j < 0
- raise GRN_INVALID_ARGUMENT.new("unmatched nesting level")
+ raise ErrorMessage, "unmatched nesting level"
end
end
end
@@ -272,10 +290,10 @@ module Groonga
return false if data.args[0] != next_data.args[0]
- data_indexes = data.indexes
- return false if data_indexes.empty?
+ data_search_indexes = data.search_indexes
+ return false if data_search_indexes.empty?
- data_indexes == next_data.indexes
+ data_search_indexes == next_data.search_indexes
end
def lower_condition?(operator)
@@ -303,7 +321,7 @@ module Groonga
between_data.op = Operator::CALL
between_data.logical_op = data.logical_op
between_data.args = create_between_data_args(data, next_data)
- between_data.indexes = data.indexes
+ between_data.search_indexes = data.search_indexes
between_data
end
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/scripts/scan_info_data.rb b/storage/mroonga/vendor/groonga/lib/mrb/scripts/scan_info_data.rb
index 67d0bc3aef7..4a6e58a951a 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/scripts/scan_info_data.rb
+++ b/storage/mroonga/vendor/groonga/lib/mrb/scripts/scan_info_data.rb
@@ -1,3 +1,5 @@
+require "scan_info_search_index"
+
module Groonga
class ScanInfoData
attr_accessor :start
@@ -6,18 +8,18 @@ module Groonga
attr_accessor :logical_op
attr_accessor :query
attr_accessor :args
- attr_accessor :indexes
+ attr_accessor :search_indexes
attr_accessor :flags
attr_accessor :max_interval
attr_accessor :similarity_threshold
def initialize(start)
@start = start
@end = 0
- @op = 0
+ @op = Operator::NOP
@logical_op = Operator::OR
@query = nil
@args = []
- @indexes = []
+ @search_indexes = []
@flags = ScanInfo::Flags::PUSH
@max_interval = nil
@similarity_threshold = nil
@@ -57,7 +59,7 @@ module Groonga
else
message =
"The first argument of NEAR/NEAR2 must be Expression, Accessor or Object: #{arg.class}"
- raise message
+ raise ErrorMessage, message
end
self.query = @args[1]
@@ -80,7 +82,7 @@ module Groonga
else
message =
"The first argument of SIMILAR must be Expression, Accessor or Object: #{arg.class}"
- raise message
+ raise ErrorMesesage, message
end
self.query = @args[1]
@@ -100,6 +102,41 @@ module Groonga
self.query = arg
end
end
+ if @op == Operator::REGEXP and not index_searchable_regexp?(@query)
+ @search_indexes.clear
+ end
+ end
+
+ def index_searchable_regexp?(pattern)
+ return false if pattern.nil?
+
+ previous_char = nil
+ pattern.value.each_char do |char|
+ if previous_char == "\\"
+ case char
+ when "Z"
+ return false
+ when "b", "B"
+ return false
+ when "d", "D", "h", "H", "p", "s", "S", "w", "W"
+ return false
+ when "X"
+ return false
+ when "k", "g", "1", "2", "3", "4", "5", "6", "7", "8", "9"
+ return false
+ when "\\"
+ previous_char = nil
+ next
+ end
+ else
+ case char
+ when ".", "[", "]", "|", "?", "+", "*", "{", "}", "^", "$", "(", ")"
+ return false
+ end
+ end
+ previous_char = char
+ end
+ true
end
def match_resolve_index_expression(expression)
@@ -107,28 +144,96 @@ module Groonga
n_codes = codes.size
i = 0
while i < n_codes
- code = codes[i]
- value = code.value
- case value
- when Accessor
- match_resolve_index_expression_accessor(code)
- when FixedSizeColumn, VariableSizeColumn
- match_resolve_index_expression_data_column(code)
- when IndexColumn
- section_id = 0
- rest_n_codes = n_codes - i
- if rest_n_codes >= 2 and
- codes[i + 1].value.is_a?(Bulk) and
- codes[i + 1].value.domain == ID::UINT32 and
- codes[i + 2].op == Operator::GET_MEMBER
- section_id = codes[i + 1].value.value + 1
- code = codes[i + 2]
- i += 2
+ i = match_resolve_index_expression_codes(expression, codes, i, n_codes)
+ end
+ end
+
+ def match_resolve_index_expression_codes(expression, codes, i, n_codes)
+ code = codes[i]
+ value = code.value
+ return i + 1 if value.nil?
+
+ case value
+ when Accessor, Column
+ index_info, offset =
+ match_resolve_index_expression_find_index(expression,
+ codes, i, n_codes)
+ i += offset - 1
+ if index_info
+ if value.is_a?(Accessor)
+ self.flags |= ScanInfo::Flags::ACCESSOR
end
- put_index(value, section_id, code.weight)
+ weight, offset = codes[i].weight
+ i += offset
+ put_search_index(index_info.index, index_info.section_id, weight)
+ end
+ when Procedure
+ unless value.scorer?
+ message = "procedure must be scorer: #{scorer.name}>"
+ raise ErrorMessage, message
end
+ scorer = value
i += 1
+ index_info, offset =
+ match_resolve_index_expression_find_index(expression,
+ codes, i, n_codes)
+ i += offset
+ if index_info
+ scorer_args_expr_offset = 0
+ if codes[i].op != Operator::CALL
+ scorer_args_expr_offset = i
+ end
+ while i < n_codes and codes[i].op != Operator::CALL
+ i += 1
+ end
+ weight, offset = codes[i].weight
+ i += offset
+ search_index = ScanInfoSearchIndex.new(index_info.index,
+ index_info.section_id,
+ weight,
+ scorer,
+ expression,
+ scorer_args_expr_offset)
+ @search_indexes << search_index
+ end
+ when Table
+ raise ErrorMessage, "invalid match target: <#{value.name}>"
end
+ i + 1
+ end
+
+ def match_resolve_index_expression_find_index(expression, codes, i, n_codes)
+ code = codes[i]
+ value = code.value
+ index_info = nil
+ offset = 1
+ case value
+ when Accessor
+ accessor = value
+ index_info = accessor.find_index(@op)
+ if index_info
+ if accessor.have_next? and index_info.index != accessor.object
+ index_info = IndexInfo.new(accessor, index_info.section_id)
+ end
+ end
+ when FixedSizeColumn, VariableSizeColumn
+ index_info = value.find_index(@op)
+ when IndexColumn
+ index = value
+ section_id = 0
+ rest_n_codes = n_codes - i
+ if rest_n_codes >= 2 and
+ codes[i + 1].value.is_a?(Bulk) and
+ (codes[i + 1].value.domain == ID::UINT32 or
+ codes[i + 1].value.domain == ID::INT32) and
+ codes[i + 2].op == Operator::GET_MEMBER
+ section_id = codes[i + 1].value.value + 1
+ offset += 2
+ end
+ index_info = IndexInfo.new(index, section_id)
+ end
+
+ [index_info, offset]
end
def match_resolve_index_expression_accessor(expr_code)
@@ -136,10 +241,13 @@ module Groonga
self.flags |= ScanInfo::Flags::ACCESSOR
index_info = accessor.find_index(op)
return if index_info.nil?
+
+ section_id = index_info.section_id
+ weight = expr_code.weight
if accessor.next
- put_index(accessor, index_info.section_id, expr_code.weight)
+ put_search_index(accessor, section_id, weight)
else
- put_index(index_info.index, index_info.section_id, expr_code.weight)
+ put_search_index(index_info.index, section_id, weight)
end
end
@@ -147,13 +255,13 @@ module Groonga
column = expr_code.value
index_info = column.find_index(op)
return if index_info.nil?
- put_index(index_info.index, index_info.section_id, expr_code.weight)
+ put_search_index(index_info.index, index_info.section_id, expr_code.weight)
end
def match_resolve_index_db_obj(db_obj)
index_info = db_obj.find_index(op)
return if index_info.nil?
- put_index(index_info.index, index_info.section_id, 1)
+ put_search_index(index_info.index, index_info.section_id, 1)
end
def match_resolve_index_accessor(accessor)
@@ -161,9 +269,9 @@ module Groonga
index_info = accessor.find_index(op)
return if index_info.nil?
if accessor.next
- put_index(accessor, index_info.section_id, 1)
+ put_search_index(accessor, index_info.section_id, 1)
else
- put_index(index_info.index, index_info.section_id, 1)
+ put_search_index(index_info.index, index_info.section_id, 1)
end
end
@@ -181,18 +289,19 @@ module Groonga
def call_relational_resolve_index_db_obj(db_obj)
index_info = db_obj.find_index(op)
return if index_info.nil?
- put_index(index_info.index, index_info.section_id, 1)
+ put_search_index(index_info.index, index_info.section_id, 1)
end
def call_relational_resolve_index_accessor(accessor)
self.flags |= ScanInfo::Flags::ACCESSOR
index_info = accessor.find_index(op)
return if index_info.nil?
- put_index(index_info.index, index_info.section_id, 1)
+ put_search_index(index_info.index, index_info.section_id, 1)
end
- def put_index(index, section_id, weight)
- @indexes << [index, section_id, weight]
+ def put_search_index(index, section_id, weight)
+ search_index = ScanInfoSearchIndex.new(index, section_id, weight)
+ @search_indexes << search_index
end
end
end
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/scripts/scan_info_search_index.rb b/storage/mroonga/vendor/groonga/lib/mrb/scripts/scan_info_search_index.rb
new file mode 100644
index 00000000000..a2818160310
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/scripts/scan_info_search_index.rb
@@ -0,0 +1,9 @@
+module Groonga
+ class ScanInfoSearchIndex < Struct.new(:index_column,
+ :section_id,
+ :weight,
+ :scorer,
+ :scorer_args_expr,
+ :scorer_args_expr_offset)
+ end
+end
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/scripts/sources.am b/storage/mroonga/vendor/groonga/lib/mrb/scripts/sources.am
index 93ade1627e6..5ddcba18d4c 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/scripts/sources.am
+++ b/storage/mroonga/vendor/groonga/lib/mrb/scripts/sources.am
@@ -1,13 +1,23 @@
RUBY_SCRIPT_FILES = \
backtrace_entry.rb \
+ command.rb \
context.rb \
- context/error_level.rb \
- context/rc.rb \
+ database.rb \
+ error.rb \
eval_context.rb \
expression.rb \
+ expression_size_estimator.rb \
+ index_column.rb \
+ index_cursor.rb \
index_info.rb \
logger.rb \
- logger/level.rb \
+ object.rb \
+ operator.rb \
+ plugin_loader.rb \
+ require.rb \
scan_info.rb \
scan_info_builder.rb \
- scan_info_data.rb
+ scan_info_data.rb \
+ scan_info_search_index.rb \
+ table_cursor.rb \
+ writer.rb
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/scripts/table_cursor.rb b/storage/mroonga/vendor/groonga/lib/mrb/scripts/table_cursor.rb
new file mode 100644
index 00000000000..a36d88d556d
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/scripts/table_cursor.rb
@@ -0,0 +1,26 @@
+module Groonga
+ class TableCursor
+ class << self
+ def open(*arguments)
+ cursor = open_raw(*arguments)
+ if block_given?
+ begin
+ yield(cursor)
+ ensure
+ cursor.close
+ end
+ else
+ cursor
+ end
+ end
+ end
+
+ def each
+ loop do
+ id = self.next
+ return if id == Groonga::ID::NIL
+ yield(id)
+ end
+ end
+ end
+end
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/scripts/writer.rb b/storage/mroonga/vendor/groonga/lib/mrb/scripts/writer.rb
new file mode 100644
index 00000000000..de2bc2611e9
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/mrb/scripts/writer.rb
@@ -0,0 +1,21 @@
+module Groonga
+ class Writer
+ def array(name, n_elements)
+ open_array(name, n_elements)
+ begin
+ yield
+ ensure
+ close_array
+ end
+ end
+
+ def map(name, n_elements)
+ open_map(name, n_elements)
+ begin
+ yield
+ ensure
+ close_map
+ end
+ end
+ end
+end
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/sources.am b/storage/mroonga/vendor/groonga/lib/mrb/sources.am
index 947607c7ecd..5cda570bc37 100644
--- a/storage/mroonga/vendor/groonga/lib/mrb/sources.am
+++ b/storage/mroonga/vendor/groonga/lib/mrb/sources.am
@@ -1,33 +1,65 @@
libgrnmrb_la_SOURCES = \
mrb_accessor.c \
mrb_accessor.h \
+ mrb_array.c \
+ mrb_array.h \
mrb_bulk.c \
mrb_bulk.h \
mrb_column.c \
mrb_column.h \
+ mrb_command.c \
+ mrb_command.h \
+ mrb_command_input.c \
+ mrb_command_input.h \
+ mrb_content_type.c \
+ mrb_content_type.h \
mrb_converter.c \
mrb_converter.h \
mrb_ctx.c \
mrb_ctx.h \
+ mrb_database.c \
+ mrb_database.h \
+ mrb_double_array_trie.c \
+ mrb_double_array_trie.h \
mrb_error.c \
mrb_error.h \
mrb_expr.c \
mrb_expr.h \
mrb_fixed_size_column.c \
mrb_fixed_size_column.h \
+ mrb_hash_table.c \
+ mrb_hash_table.h \
mrb_id.c \
mrb_id.h \
mrb_index_column.c \
mrb_index_column.h \
+ mrb_index_cursor.c \
+ mrb_index_cursor.h \
mrb_logger.c \
mrb_logger.h \
- mrb_obj.c \
- mrb_obj.h \
+ mrb_object.c \
+ mrb_object.h \
+ mrb_object_flags.c \
+ mrb_object_flags.h \
mrb_operator.c \
mrb_operator.h \
+ mrb_options.c \
+ mrb_options.h \
+ mrb_patricia_trie.c \
+ mrb_patricia_trie.h \
mrb_procedure.c \
mrb_procedure.h \
+ mrb_table.c \
+ mrb_table.h \
+ mrb_table_cursor.c \
+ mrb_table_cursor.h \
+ mrb_table_cursor_flags.c \
+ mrb_table_cursor_flags.h \
+ mrb_type.c \
+ mrb_type.h \
mrb_variable_size_column.c \
mrb_variable_size_column.h \
mrb_void.c \
- mrb_void.h
+ mrb_void.h \
+ mrb_writer.c \
+ mrb_writer.h
diff --git a/storage/mroonga/vendor/groonga/lib/nfkc.c b/storage/mroonga/vendor/groonga/lib/nfkc.c
index 252fb210e6e..30e06f94a34 100644
--- a/storage/mroonga/vendor/groonga/lib/nfkc.c
+++ b/storage/mroonga/vendor/groonga/lib/nfkc.c
@@ -17,10 +17,7 @@
don't edit this file by hand. it generated automatically by nfkc.rb
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif /* HAVE_CONFIG_H */
-
+#include "grn.h"
#include <groonga/nfkc.h>
#ifdef GRN_WITH_NFKC
diff --git a/storage/mroonga/vendor/groonga/lib/normalizer.c b/storage/mroonga/vendor/groonga/lib/normalizer.c
index 04719bdd463..5999bf64317 100644
--- a/storage/mroonga/vendor/groonga/lib/normalizer.c
+++ b/storage/mroonga/vendor/groonga/lib/normalizer.c
@@ -18,8 +18,8 @@
#include <string.h>
-#include "normalizer_in.h"
-#include "string_in.h"
+#include "grn_normalizer.h"
+#include "grn_string.h"
#include <groonga/normalizer.h>
#include <groonga/tokenizer.h>
@@ -728,7 +728,7 @@ utf8_normalize(grn_ctx *ctx, grn_string *nstr)
nstr->ctypes = ctypes;
}
}
- memcpy(d, p, lp);
+ grn_memcpy(d, p, lp);
d_ = d;
d += lp;
length++;
diff --git a/storage/mroonga/vendor/groonga/lib/obj.c b/storage/mroonga/vendor/groonga/lib/obj.c
new file mode 100644
index 00000000000..87850b6357b
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/obj.c
@@ -0,0 +1,106 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2015 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
+*/
+#include "grn.h"
+#include "grn_db.h"
+#include <groonga/obj.h>
+
+grn_bool
+grn_obj_is_builtin(grn_ctx *ctx, grn_obj *obj)
+{
+ grn_id id;
+
+ if (!obj) { return GRN_FALSE; }
+
+ id = grn_obj_id(ctx, obj);
+ if (id == GRN_ID_NIL) {
+ return GRN_FALSE;
+ } else {
+ return id < GRN_N_RESERVED_TYPES;
+ }
+}
+
+grn_bool
+grn_obj_is_table(grn_ctx *ctx, grn_obj *obj)
+{
+ grn_bool is_table = GRN_FALSE;
+
+ if (!obj) {
+ return GRN_FALSE;
+ }
+
+ switch (obj->header.type) {
+ case GRN_TABLE_NO_KEY :
+ case GRN_TABLE_HASH_KEY :
+ case GRN_TABLE_PAT_KEY :
+ case GRN_TABLE_DAT_KEY :
+ is_table = GRN_TRUE;
+ default :
+ break;
+ }
+
+ return is_table;
+}
+
+grn_bool
+grn_obj_is_proc(grn_ctx *ctx, grn_obj *obj)
+{
+ if (!obj) {
+ return GRN_FALSE;
+ }
+
+ return obj->header.type == GRN_PROC;
+}
+
+grn_bool
+grn_obj_is_function_proc(grn_ctx *ctx, grn_obj *obj)
+{
+ grn_proc *proc;
+
+ if (!grn_obj_is_proc(ctx, obj)) {
+ return GRN_FALSE;
+ }
+
+ proc = (grn_proc *)obj;
+ return proc->type == GRN_PROC_FUNCTION;
+}
+
+grn_bool
+grn_obj_is_selector_proc(grn_ctx *ctx, grn_obj *obj)
+{
+ grn_proc *proc;
+
+ if (!grn_obj_is_function_proc(ctx, obj)) {
+ return GRN_FALSE;
+ }
+
+ proc = (grn_proc *)obj;
+ return proc->selector != NULL;
+}
+
+grn_bool
+grn_obj_is_scorer_proc(grn_ctx *ctx, grn_obj *obj)
+{
+ grn_proc *proc;
+
+ if (!grn_obj_is_proc(ctx, obj)) {
+ return GRN_FALSE;
+ }
+
+ proc = (grn_proc *)obj;
+ return proc->type == GRN_PROC_SCORER;
+}
diff --git a/storage/mroonga/vendor/groonga/lib/operator.c b/storage/mroonga/vendor/groonga/lib/operator.c
new file mode 100644
index 00000000000..14a870cd885
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/operator.c
@@ -0,0 +1,928 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2014-2015 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
+*/
+
+#include "grn.h"
+#include "grn_db.h"
+#include "grn_str.h"
+#include "grn_normalizer.h"
+
+#include <string.h>
+
+#ifdef GRN_WITH_ONIGMO
+# define GRN_SUPPORT_REGEXP
+#endif
+
+#ifdef GRN_SUPPORT_REGEXP
+# include <oniguruma.h>
+#endif
+
+static const char *operator_names[] = {
+ "push",
+ "pop",
+ "nop",
+ "call",
+ "intern",
+ "get_ref",
+ "get_value",
+ "and",
+ "and_not",
+ "or",
+ "assign",
+ "star_assign",
+ "slash_assign",
+ "mod_assign",
+ "plus_assign",
+ "minus_assign",
+ "shiftl_assign",
+ "shiftr_assign",
+ "shiftrr_assign",
+ "and_assign",
+ "xor_assign",
+ "or_assign",
+ "jump",
+ "cjump",
+ "comma",
+ "bitwise_or",
+ "bitwise_xor",
+ "bitwise_and",
+ "bitwise_not",
+ "equal",
+ "not_equal",
+ "less",
+ "greater",
+ "less_equal",
+ "greater_equal",
+ "in",
+ "match",
+ "near",
+ "near2",
+ "similar",
+ "term_extract",
+ "shiftl",
+ "shiftr",
+ "shiftrr",
+ "plus",
+ "minus",
+ "star",
+ "slash",
+ "mod",
+ "delete",
+ "incr",
+ "decr",
+ "incr_post",
+ "decr_post",
+ "not",
+ "adjust",
+ "exact",
+ "lcp",
+ "partial",
+ "unsplit",
+ "prefix",
+ "suffix",
+ "geo_distance1",
+ "geo_distance2",
+ "geo_distance3",
+ "geo_distance4",
+ "geo_withinp5",
+ "geo_withinp6",
+ "geo_withinp8",
+ "obj_search",
+ "expr_get_var",
+ "table_create",
+ "table_select",
+ "table_sort",
+ "table_group",
+ "json_put",
+ "get_member",
+ "regexp"
+};
+
+#define GRN_OP_LAST GRN_OP_REGEXP
+
+const char *
+grn_operator_to_string(grn_operator op)
+{
+ if (op <= GRN_OP_LAST) {
+ return operator_names[op];
+ } else {
+ return "unknown";
+ }
+}
+
+#define DO_EQ_SUB do {\
+ switch (y->header.domain) {\
+ case GRN_DB_INT8 :\
+ r = (x_ == GRN_INT8_VALUE(y));\
+ break;\
+ case GRN_DB_UINT8 :\
+ r = (x_ == GRN_UINT8_VALUE(y));\
+ break;\
+ case GRN_DB_INT16 :\
+ r = (x_ == GRN_INT16_VALUE(y));\
+ break;\
+ case GRN_DB_UINT16 :\
+ r = (x_ == GRN_UINT16_VALUE(y));\
+ break;\
+ case GRN_DB_INT32 :\
+ r = (x_ == GRN_INT32_VALUE(y));\
+ break;\
+ case GRN_DB_UINT32 :\
+ r = (x_ == GRN_UINT32_VALUE(y));\
+ break;\
+ case GRN_DB_INT64 :\
+ r = (x_ == GRN_INT64_VALUE(y));\
+ break;\
+ case GRN_DB_TIME :\
+ r = (GRN_TIME_PACK(x_,0) == GRN_INT64_VALUE(y));\
+ break;\
+ case GRN_DB_UINT64 :\
+ r = (x_ == GRN_UINT64_VALUE(y));\
+ break;\
+ case GRN_DB_FLOAT :\
+ r = ((x_ <= GRN_FLOAT_VALUE(y)) && (x_ >= GRN_FLOAT_VALUE(y)));\
+ break;\
+ case GRN_DB_SHORT_TEXT :\
+ case GRN_DB_TEXT :\
+ case GRN_DB_LONG_TEXT :\
+ {\
+ const char *p_ = GRN_TEXT_VALUE(y);\
+ int i_ = grn_atoi(p_, p_ + GRN_TEXT_LEN(y), NULL);\
+ r = (x_ == i_);\
+ }\
+ break;\
+ default :\
+ r = GRN_FALSE;\
+ break;\
+ }\
+} while (0)
+
+#define DO_EQ(x,y,r) do {\
+ switch (x->header.domain) {\
+ case GRN_DB_VOID :\
+ r = GRN_FALSE;\
+ break;\
+ case GRN_DB_INT8 :\
+ {\
+ int8_t x_ = GRN_INT8_VALUE(x);\
+ DO_EQ_SUB;\
+ }\
+ break;\
+ case GRN_DB_UINT8 :\
+ {\
+ uint8_t x_ = GRN_UINT8_VALUE(x);\
+ DO_EQ_SUB;\
+ }\
+ break;\
+ case GRN_DB_INT16 :\
+ {\
+ int16_t x_ = GRN_INT16_VALUE(x);\
+ DO_EQ_SUB;\
+ }\
+ break;\
+ case GRN_DB_UINT16 :\
+ {\
+ uint16_t x_ = GRN_UINT16_VALUE(x);\
+ DO_EQ_SUB;\
+ }\
+ break;\
+ case GRN_DB_INT32 :\
+ {\
+ int32_t x_ = GRN_INT32_VALUE(x);\
+ DO_EQ_SUB;\
+ }\
+ break;\
+ case GRN_DB_UINT32 :\
+ {\
+ uint32_t x_ = GRN_UINT32_VALUE(x);\
+ DO_EQ_SUB;\
+ }\
+ break;\
+ case GRN_DB_INT64 :\
+ {\
+ int64_t x_ = GRN_INT64_VALUE(x);\
+ DO_EQ_SUB;\
+ }\
+ break;\
+ case GRN_DB_TIME :\
+ {\
+ int64_t x_ = GRN_INT64_VALUE(x);\
+ switch (y->header.domain) {\
+ case GRN_DB_INT32 :\
+ r = (x_ == GRN_TIME_PACK(GRN_INT32_VALUE(y), 0));\
+ break;\
+ case GRN_DB_UINT32 :\
+ r = (x_ == GRN_TIME_PACK(GRN_UINT32_VALUE(y), 0));\
+ break;\
+ case GRN_DB_INT64 :\
+ case GRN_DB_TIME :\
+ r = (x_ == GRN_INT64_VALUE(y));\
+ break;\
+ case GRN_DB_UINT64 :\
+ r = (x_ == GRN_UINT64_VALUE(y));\
+ break;\
+ case GRN_DB_FLOAT :\
+ r = (x_ == GRN_TIME_PACK(GRN_FLOAT_VALUE(y), 0));\
+ break;\
+ case GRN_DB_SHORT_TEXT :\
+ case GRN_DB_TEXT :\
+ case GRN_DB_LONG_TEXT :\
+ {\
+ grn_obj time_value_;\
+ GRN_TIME_INIT(&time_value_, 0);\
+ if (grn_obj_cast(ctx, y, &time_value_, GRN_FALSE) == GRN_SUCCESS) {\
+ r = (x_ == GRN_TIME_VALUE(&time_value_));\
+ } else {\
+ r = GRN_FALSE;\
+ }\
+ GRN_OBJ_FIN(ctx, &time_value_);\
+ }\
+ break;\
+ default :\
+ r = GRN_FALSE;\
+ break;\
+ }\
+ }\
+ break;\
+ case GRN_DB_UINT64 :\
+ {\
+ uint64_t x_ = GRN_UINT64_VALUE(x);\
+ DO_EQ_SUB;\
+ }\
+ break;\
+ case GRN_DB_FLOAT :\
+ {\
+ double x_ = GRN_FLOAT_VALUE(x);\
+ switch (y->header.domain) {\
+ case GRN_DB_INT32 :\
+ r = ((x_ <= GRN_INT32_VALUE(y)) && (x_ >= GRN_INT32_VALUE(y)));\
+ break;\
+ case GRN_DB_UINT32 :\
+ r = ((x_ <= GRN_UINT32_VALUE(y)) && (x_ >= GRN_UINT32_VALUE(y)));\
+ break;\
+ case GRN_DB_INT64 :\
+ case GRN_DB_TIME :\
+ r = ((x_ <= GRN_INT64_VALUE(y)) && (x_ >= GRN_INT64_VALUE(y)));\
+ break;\
+ case GRN_DB_UINT64 :\
+ r = ((x_ <= GRN_UINT64_VALUE(y)) && (x_ >= GRN_UINT64_VALUE(y)));\
+ break;\
+ case GRN_DB_FLOAT :\
+ r = ((x_ <= GRN_FLOAT_VALUE(y)) && (x_ >= GRN_FLOAT_VALUE(y)));\
+ break;\
+ case GRN_DB_SHORT_TEXT :\
+ case GRN_DB_TEXT :\
+ case GRN_DB_LONG_TEXT :\
+ {\
+ const char *p_ = GRN_TEXT_VALUE(y);\
+ int i_ = grn_atoi(p_, p_ + GRN_TEXT_LEN(y), NULL);\
+ r = (x_ <= i_ && x_ >= i_);\
+ }\
+ break;\
+ default :\
+ r = GRN_FALSE;\
+ break;\
+ }\
+ }\
+ break;\
+ case GRN_DB_SHORT_TEXT :\
+ case GRN_DB_TEXT :\
+ case GRN_DB_LONG_TEXT :\
+ if (GRN_DB_SHORT_TEXT <= y->header.domain && y->header.domain <= GRN_DB_LONG_TEXT) {\
+ uint32_t la = GRN_TEXT_LEN(x), lb = GRN_TEXT_LEN(y);\
+ r = (la == lb && !memcmp(GRN_TEXT_VALUE(x), GRN_TEXT_VALUE(y), lb));\
+ } else {\
+ const char *q_ = GRN_TEXT_VALUE(x);\
+ int x_ = grn_atoi(q_, q_ + GRN_TEXT_LEN(x), NULL);\
+ DO_EQ_SUB;\
+ }\
+ break;\
+ default :\
+ if ((x->header.domain == y->header.domain)) {\
+ r = (GRN_BULK_VSIZE(x) == GRN_BULK_VSIZE(y) &&\
+ !(memcmp(GRN_BULK_HEAD(x), GRN_BULK_HEAD(y), GRN_BULK_VSIZE(x))));\
+ } else {\
+ grn_obj dest;\
+ if (x->header.domain < y->header.domain) {\
+ GRN_OBJ_INIT(&dest, GRN_BULK, 0, y->header.domain);\
+ if (!grn_obj_cast(ctx, x, &dest, GRN_FALSE)) {\
+ r = (GRN_BULK_VSIZE(&dest) == GRN_BULK_VSIZE(y) &&\
+ !memcmp(GRN_BULK_HEAD(&dest), GRN_BULK_HEAD(y), GRN_BULK_VSIZE(y))); \
+ } else {\
+ r = GRN_FALSE;\
+ }\
+ } else {\
+ GRN_OBJ_INIT(&dest, GRN_BULK, 0, x->header.domain);\
+ if (!grn_obj_cast(ctx, y, &dest, GRN_FALSE)) {\
+ r = (GRN_BULK_VSIZE(&dest) == GRN_BULK_VSIZE(x) &&\
+ !memcmp(GRN_BULK_HEAD(&dest), GRN_BULK_HEAD(x), GRN_BULK_VSIZE(x))); \
+ } else {\
+ r = GRN_FALSE;\
+ }\
+ }\
+ GRN_OBJ_FIN(ctx, &dest);\
+ }\
+ break;\
+ }\
+} while (0)
+
+grn_bool
+grn_operator_exec_equal(grn_ctx *ctx, grn_obj *x, grn_obj *y)
+{
+ grn_bool r;
+ GRN_API_ENTER;
+ DO_EQ(x, y, r);
+ GRN_API_RETURN(r);
+}
+
+grn_bool
+grn_operator_exec_not_equal(grn_ctx *ctx, grn_obj *x, grn_obj *y)
+{
+ grn_bool r;
+ GRN_API_ENTER;
+ DO_EQ(x, y, r);
+ GRN_API_RETURN(!r);
+}
+
+#define DO_COMPARE_SUB_NUMERIC(y,op) do {\
+ switch ((y)->header.domain) {\
+ case GRN_DB_INT8 :\
+ r = (x_ op GRN_INT8_VALUE(y));\
+ break;\
+ case GRN_DB_UINT8 :\
+ r = (x_ op GRN_UINT8_VALUE(y));\
+ break;\
+ case GRN_DB_INT16 :\
+ r = (x_ op GRN_INT16_VALUE(y));\
+ break;\
+ case GRN_DB_UINT16 :\
+ r = (x_ op GRN_UINT16_VALUE(y));\
+ break;\
+ case GRN_DB_INT32 :\
+ r = (x_ op GRN_INT32_VALUE(y));\
+ break;\
+ case GRN_DB_UINT32 :\
+ r = (x_ op GRN_UINT32_VALUE(y));\
+ break;\
+ case GRN_DB_INT64 :\
+ r = (x_ op GRN_INT64_VALUE(y));\
+ break;\
+ case GRN_DB_TIME :\
+ r = (GRN_TIME_PACK(x_,0) op GRN_INT64_VALUE(y));\
+ break;\
+ case GRN_DB_UINT64 :\
+ r = (x_ op GRN_UINT64_VALUE(y));\
+ break;\
+ case GRN_DB_FLOAT :\
+ r = (x_ op GRN_FLOAT_VALUE(y));\
+ break;\
+ default :\
+ r = GRN_FALSE;\
+ break;\
+ }\
+} while (0)
+
+#define DO_COMPARE_SUB(op) do {\
+ switch (y->header.domain) {\
+ case GRN_DB_SHORT_TEXT :\
+ case GRN_DB_TEXT :\
+ case GRN_DB_LONG_TEXT :\
+ {\
+ grn_obj y_;\
+ GRN_OBJ_INIT(&y_, GRN_BULK, 0, x->header.domain);\
+ if (grn_obj_cast(ctx, y, &y_, GRN_FALSE)) {\
+ r = GRN_FALSE;\
+ } else {\
+ DO_COMPARE_SUB_NUMERIC(&y_, op);\
+ }\
+ GRN_OBJ_FIN(ctx, &y_);\
+ }\
+ break;\
+ default :\
+ DO_COMPARE_SUB_NUMERIC(y,op);\
+ break;\
+ }\
+} while (0)
+
+#define DO_COMPARE_BUILTIN(x,y,r,op) do {\
+ switch (x->header.domain) {\
+ case GRN_DB_INT8 :\
+ {\
+ int8_t x_ = GRN_INT8_VALUE(x);\
+ DO_COMPARE_SUB(op);\
+ }\
+ break;\
+ case GRN_DB_UINT8 :\
+ {\
+ uint8_t x_ = GRN_UINT8_VALUE(x);\
+ DO_COMPARE_SUB(op);\
+ }\
+ break;\
+ case GRN_DB_INT16 :\
+ {\
+ int16_t x_ = GRN_INT16_VALUE(x);\
+ DO_COMPARE_SUB(op);\
+ }\
+ break;\
+ case GRN_DB_UINT16 :\
+ {\
+ uint16_t x_ = GRN_UINT16_VALUE(x);\
+ DO_COMPARE_SUB(op);\
+ }\
+ break;\
+ case GRN_DB_INT32 :\
+ {\
+ int32_t x_ = GRN_INT32_VALUE(x);\
+ DO_COMPARE_SUB(op);\
+ }\
+ break;\
+ case GRN_DB_UINT32 :\
+ {\
+ uint32_t x_ = GRN_UINT32_VALUE(x);\
+ DO_COMPARE_SUB(op);\
+ }\
+ break;\
+ case GRN_DB_TIME :\
+ {\
+ int64_t x_ = GRN_INT64_VALUE(x);\
+ switch (y->header.domain) {\
+ case GRN_DB_INT32 :\
+ r = (x_ op GRN_TIME_PACK(GRN_INT32_VALUE(y), 0));\
+ break;\
+ case GRN_DB_UINT32 :\
+ r = (x_ op GRN_TIME_PACK(GRN_UINT32_VALUE(y), 0));\
+ break;\
+ case GRN_DB_INT64 :\
+ case GRN_DB_TIME :\
+ r = (x_ op GRN_INT64_VALUE(y));\
+ break;\
+ case GRN_DB_UINT64 :\
+ r = (x_ op GRN_UINT64_VALUE(y));\
+ break;\
+ case GRN_DB_FLOAT :\
+ r = (x_ op GRN_TIME_PACK(GRN_FLOAT_VALUE(y), 0));\
+ break;\
+ case GRN_DB_SHORT_TEXT :\
+ case GRN_DB_TEXT :\
+ case GRN_DB_LONG_TEXT :\
+ {\
+ grn_obj time_value_;\
+ GRN_TIME_INIT(&time_value_, 0);\
+ if (grn_obj_cast(ctx, y, &time_value_, GRN_FALSE) == GRN_SUCCESS) {\
+ r = (x_ op GRN_TIME_VALUE(&time_value_));\
+ } else {\
+ r = GRN_FALSE;\
+ }\
+ GRN_OBJ_FIN(ctx, &time_value_);\
+ }\
+ break;\
+ default :\
+ r = GRN_FALSE;\
+ break;\
+ }\
+ }\
+ break;\
+ case GRN_DB_INT64 :\
+ {\
+ int64_t x_ = GRN_INT64_VALUE(x);\
+ DO_COMPARE_SUB(op);\
+ }\
+ break;\
+ case GRN_DB_UINT64 :\
+ {\
+ uint64_t x_ = GRN_UINT64_VALUE(x);\
+ DO_COMPARE_SUB(op);\
+ }\
+ break;\
+ case GRN_DB_FLOAT :\
+ {\
+ double x_ = GRN_FLOAT_VALUE(x);\
+ DO_COMPARE_SUB(op);\
+ }\
+ break;\
+ case GRN_DB_SHORT_TEXT :\
+ case GRN_DB_TEXT :\
+ case GRN_DB_LONG_TEXT :\
+ if (GRN_DB_SHORT_TEXT <= y->header.domain && y->header.domain <= GRN_DB_LONG_TEXT) {\
+ int r_;\
+ uint32_t la = GRN_TEXT_LEN(x), lb = GRN_TEXT_LEN(y);\
+ if (la > lb) {\
+ if (!(r_ = memcmp(GRN_TEXT_VALUE(x), GRN_TEXT_VALUE(y), lb))) {\
+ r_ = 1;\
+ }\
+ } else {\
+ if (!(r_ = memcmp(GRN_TEXT_VALUE(x), GRN_TEXT_VALUE(y), la))) {\
+ r_ = la == lb ? 0 : -1;\
+ }\
+ }\
+ r = (r_ op 0);\
+ } else {\
+ const char *q_ = GRN_TEXT_VALUE(x);\
+ int x_ = grn_atoi(q_, q_ + GRN_TEXT_LEN(x), NULL);\
+ DO_COMPARE_SUB(op);\
+ }\
+ break;\
+ default :\
+ r = GRN_FALSE;\
+ break;\
+ }\
+} while (0)
+
+#define DO_COMPARE(x, y, r, op) do {\
+ if (x->header.domain >= GRN_N_RESERVED_TYPES) {\
+ grn_obj *table;\
+ table = grn_ctx_at(ctx, x->header.domain);\
+ switch (table->header.type) {\
+ case GRN_TABLE_HASH_KEY :\
+ case GRN_TABLE_PAT_KEY :\
+ {\
+ grn_obj key;\
+ int length;\
+ GRN_OBJ_INIT(&key, GRN_BULK, 0, table->header.domain);\
+ length = grn_table_get_key2(ctx, table, GRN_RECORD_VALUE(x), &key);\
+ if (length > 0) {\
+ grn_obj *x_original = x;\
+ x = &key;\
+ DO_COMPARE_BUILTIN((&key), y, r, op);\
+ x = x_original;\
+ } else {\
+ r = GRN_FALSE;\
+ }\
+ GRN_OBJ_FIN(ctx, &key);\
+ }\
+ break;\
+ default :\
+ r = GRN_FALSE;\
+ break;\
+ }\
+ grn_obj_unlink(ctx, table);\
+ } else {\
+ DO_COMPARE_BUILTIN(x, y, r, op);\
+ }\
+} while (0)
+
+grn_bool
+grn_operator_exec_less(grn_ctx *ctx, grn_obj *x, grn_obj *y)
+{
+ grn_bool r;
+ GRN_API_ENTER;
+ DO_COMPARE(x, y, r, <);
+ GRN_API_RETURN(r);
+}
+
+grn_bool
+grn_operator_exec_greater(grn_ctx *ctx, grn_obj *x, grn_obj *y)
+{
+ grn_bool r;
+ GRN_API_ENTER;
+ DO_COMPARE(x, y, r, >);
+ GRN_API_RETURN(r);
+}
+
+grn_bool
+grn_operator_exec_less_equal(grn_ctx *ctx, grn_obj *x, grn_obj *y)
+{
+ grn_bool r;
+ GRN_API_ENTER;
+ DO_COMPARE(x, y, r, <=);
+ GRN_API_RETURN(r);
+}
+
+grn_bool
+grn_operator_exec_greater_equal(grn_ctx *ctx, grn_obj *x, grn_obj *y)
+{
+ grn_bool r;
+ GRN_API_ENTER;
+ DO_COMPARE(x, y, r, >=);
+ GRN_API_RETURN(r);
+}
+
+static grn_bool
+string_have_sub_text(grn_ctx *ctx,
+ const char *text, unsigned int text_len,
+ const char *sub_text, unsigned int sub_text_len)
+{
+ /* TODO: Use more fast algorithm such as Boyer-Moore algorithm that
+ * is used in snip.c. */
+ const char *text_end = text + text_len;
+ unsigned int sub_text_current = 0;
+
+ for (; text < text_end; text++) {
+ if (text[0] == sub_text[sub_text_current]) {
+ sub_text_current++;
+ if (sub_text_current == sub_text_len) {
+ return GRN_TRUE;
+ }
+ } else {
+ sub_text_current = 0;
+ }
+ }
+
+ return GRN_FALSE;
+}
+
+static grn_bool
+string_have_prefix(grn_ctx *ctx,
+ const char *target, unsigned int target_len,
+ const char *prefix, unsigned int prefix_len)
+{
+ return (target_len >= prefix_len &&
+ strncmp(target, prefix, prefix_len) == 0);
+}
+
+static grn_bool
+string_match_regexp(grn_ctx *ctx,
+ const char *target, unsigned int target_len,
+ const char *pattern, unsigned int pattern_len)
+{
+#ifdef GRN_SUPPORT_REGEXP
+ OnigRegex regex;
+ OnigEncoding onig_encoding;
+ int onig_result;
+ OnigErrorInfo onig_error_info;
+
+ if (ctx->encoding == GRN_ENC_NONE) {
+ return GRN_FALSE;
+ }
+
+ switch (ctx->encoding) {
+ case GRN_ENC_EUC_JP :
+ onig_encoding = ONIG_ENCODING_EUC_JP;
+ break;
+ case GRN_ENC_UTF8 :
+ onig_encoding = ONIG_ENCODING_UTF8;
+ break;
+ case GRN_ENC_SJIS :
+ onig_encoding = ONIG_ENCODING_CP932;
+ break;
+ case GRN_ENC_LATIN1 :
+ onig_encoding = ONIG_ENCODING_ISO_8859_1;
+ break;
+ case GRN_ENC_KOI8R :
+ onig_encoding = ONIG_ENCODING_KOI8_R;
+ break;
+ default :
+ return GRN_FALSE;
+ }
+
+ onig_result = onig_new(&regex,
+ pattern,
+ pattern + pattern_len,
+ ONIG_OPTION_ASCII_RANGE,
+ onig_encoding,
+ ONIG_SYNTAX_RUBY,
+ &onig_error_info);
+ if (onig_result != ONIG_NORMAL) {
+ char message[ONIG_MAX_ERROR_MESSAGE_LEN];
+ onig_error_code_to_str(message, onig_result, onig_error_info);
+ ERR(GRN_INVALID_ARGUMENT,
+ "[operator][regexp] "
+ "failed to create regular expression object: <%.*s>: %s",
+ pattern_len, pattern,
+ message);
+ return GRN_FALSE;
+ }
+
+ {
+ OnigPosition position;
+ position = onig_search(regex,
+ target,
+ target + target_len,
+ target,
+ target + target_len,
+ NULL,
+ ONIG_OPTION_NONE);
+ onig_free(regex);
+ return position != ONIG_MISMATCH;
+ }
+#else
+ return GRN_FALSE;
+#endif
+}
+
+static grn_bool
+exec_text_operator(grn_ctx *ctx,
+ grn_operator op,
+ const char *target,
+ unsigned int target_len,
+ const char *query,
+ unsigned int query_len)
+{
+ grn_bool matched = GRN_FALSE;
+
+ switch (op) {
+ case GRN_OP_MATCH :
+ matched = string_have_sub_text(ctx, target, target_len, query, query_len);
+ break;
+ case GRN_OP_PREFIX :
+ matched = string_have_prefix(ctx, target, target_len, query, query_len);
+ break;
+ case GRN_OP_REGEXP :
+ matched = string_match_regexp(ctx, target, target_len, query, query_len);
+ break;
+ default :
+ matched = GRN_FALSE;
+ break;
+ }
+
+ return matched;
+}
+
+static grn_bool
+exec_text_operator_raw_text_raw_text(grn_ctx *ctx,
+ grn_operator op,
+ const char *target,
+ unsigned int target_len,
+ const char *query,
+ unsigned int query_len)
+{
+ grn_obj *normalizer;
+ grn_obj *norm_target;
+ grn_obj *norm_query;
+ const char *norm_target_raw;
+ const char *norm_query_raw;
+ unsigned int norm_target_raw_length_in_bytes;
+ unsigned int norm_query_raw_length_in_bytes;
+ grn_bool matched = GRN_FALSE;
+
+ if (target_len == 0 || query_len == 0) {
+ return GRN_FALSE;
+ }
+
+ if (op == GRN_OP_REGEXP) {
+ return exec_text_operator(ctx, op,
+ target, target_len,
+ query, query_len);
+ }
+
+ normalizer = grn_ctx_get(ctx, GRN_NORMALIZER_AUTO_NAME, -1);
+ norm_target = grn_string_open(ctx, target, target_len, normalizer, 0);
+ norm_query = grn_string_open(ctx, query, query_len, normalizer, 0);
+ grn_string_get_normalized(ctx, norm_target,
+ &norm_target_raw,
+ &norm_target_raw_length_in_bytes,
+ NULL);
+ grn_string_get_normalized(ctx, norm_query,
+ &norm_query_raw,
+ &norm_query_raw_length_in_bytes,
+ NULL);
+
+ matched = exec_text_operator(ctx, op,
+ norm_target_raw,
+ norm_target_raw_length_in_bytes,
+ norm_query_raw,
+ norm_query_raw_length_in_bytes);
+
+ grn_obj_close(ctx, norm_target);
+ grn_obj_close(ctx, norm_query);
+ grn_obj_unlink(ctx, normalizer);
+
+ return matched;
+}
+
+static grn_bool
+exec_text_operator_record_text(grn_ctx *ctx,
+ grn_operator op,
+ grn_obj *record, grn_obj *table,
+ grn_obj *query)
+{
+ grn_obj *normalizer;
+ char record_key[GRN_TABLE_MAX_KEY_SIZE];
+ int record_key_len;
+ grn_bool matched = GRN_FALSE;
+
+ if (table->header.domain != GRN_DB_SHORT_TEXT) {
+ return GRN_FALSE;
+ }
+
+ if (GRN_TEXT_LEN(query) == 0) {
+ return GRN_FALSE;
+ }
+
+ record_key_len = grn_table_get_key(ctx, table, GRN_RECORD_VALUE(record),
+ record_key, GRN_TABLE_MAX_KEY_SIZE);
+ grn_table_get_info(ctx, table, NULL, NULL, NULL, &normalizer, NULL);
+ if (normalizer && (op != GRN_OP_REGEXP)) {
+ grn_obj *norm_query;
+ const char *norm_query_raw;
+ unsigned int norm_query_raw_length_in_bytes;
+ norm_query = grn_string_open(ctx,
+ GRN_TEXT_VALUE(query),
+ GRN_TEXT_LEN(query),
+ normalizer,
+ 0);
+ grn_string_get_normalized(ctx, norm_query,
+ &norm_query_raw,
+ &norm_query_raw_length_in_bytes,
+ NULL);
+ matched = exec_text_operator(ctx,
+ op,
+ record_key,
+ record_key_len,
+ norm_query_raw,
+ norm_query_raw_length_in_bytes);
+ grn_obj_close(ctx, norm_query);
+ } else {
+ matched = exec_text_operator_raw_text_raw_text(ctx,
+ op,
+ record_key,
+ record_key_len,
+ GRN_TEXT_VALUE(query),
+ GRN_TEXT_LEN(query));
+ }
+
+ return matched;
+}
+
+static grn_bool
+exec_text_operator_text_text(grn_ctx *ctx,
+ grn_operator op,
+ grn_obj *target,
+ grn_obj *query)
+{
+ return exec_text_operator_raw_text_raw_text(ctx,
+ op,
+ GRN_TEXT_VALUE(target),
+ GRN_TEXT_LEN(target),
+ GRN_TEXT_VALUE(query),
+ GRN_TEXT_LEN(query));
+}
+
+static grn_bool
+exec_text_operator_bulk_bulk(grn_ctx *ctx,
+ grn_operator op,
+ grn_obj *target,
+ grn_obj *query)
+{
+ switch (target->header.domain) {
+ case GRN_DB_SHORT_TEXT :
+ case GRN_DB_TEXT :
+ case GRN_DB_LONG_TEXT :
+ switch (query->header.domain) {
+ case GRN_DB_SHORT_TEXT :
+ case GRN_DB_TEXT :
+ case GRN_DB_LONG_TEXT :
+ return exec_text_operator_text_text(ctx, op, target, query);
+ default :
+ break;
+ }
+ return GRN_FALSE;
+ default:
+ {
+ grn_obj *domain;
+ domain = grn_ctx_at(ctx, target->header.domain);
+ if (GRN_OBJ_TABLEP(domain)) {
+ switch (query->header.domain) {
+ case GRN_DB_SHORT_TEXT :
+ case GRN_DB_TEXT :
+ case GRN_DB_LONG_TEXT :
+ return exec_text_operator_record_text(ctx, op, target, domain, query);
+ default :
+ break;
+ }
+ }
+ }
+ return GRN_FALSE;
+ }
+}
+
+grn_bool
+grn_operator_exec_match(grn_ctx *ctx, grn_obj *target, grn_obj *sub_text)
+{
+ grn_bool matched;
+ GRN_API_ENTER;
+ matched = exec_text_operator_bulk_bulk(ctx, GRN_OP_MATCH, target, sub_text);
+ GRN_API_RETURN(matched);
+}
+
+grn_bool
+grn_operator_exec_prefix(grn_ctx *ctx, grn_obj *target, grn_obj *prefix)
+{
+ grn_bool matched;
+ GRN_API_ENTER;
+ matched = exec_text_operator_bulk_bulk(ctx, GRN_OP_PREFIX, target, prefix);
+ GRN_API_RETURN(matched);
+}
+
+grn_bool
+grn_operator_exec_regexp(grn_ctx *ctx, grn_obj *target, grn_obj *pattern)
+{
+ grn_bool matched;
+ GRN_API_ENTER;
+ matched = exec_text_operator_bulk_bulk(ctx, GRN_OP_REGEXP, target, pattern);
+ GRN_API_RETURN(matched);
+}
diff --git a/storage/mroonga/vendor/groonga/lib/output.c b/storage/mroonga/vendor/groonga/lib/output.c
index 9b745c89a01..0036e9a8619 100644
--- a/storage/mroonga/vendor/groonga/lib/output.c
+++ b/storage/mroonga/vendor/groonga/lib/output.c
@@ -15,15 +15,13 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef GROONGA_IN_H
-#include "groonga_in.h"
-#endif /* GROONGA_IN_H */
+#include "grn.h"
#include <string.h>
-#include "str.h"
-#include "db.h"
-#include "util.h"
-#include "output.h"
+#include "grn_str.h"
+#include "grn_db.h"
+#include "grn_util.h"
+#include "grn_output.h"
#define LEVELS (&ctx->impl->levels)
#define DEPTH (GRN_BULK_VSIZE(LEVELS)>>2)
@@ -56,6 +54,8 @@ put_delimiter(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type)
case GRN_CONTENT_MSGPACK :
// do nothing
break;
+ case GRN_CONTENT_GROONGA_COMMAND_LIST :
+ break;
case GRN_CONTENT_NONE:
break;
}
@@ -90,6 +90,8 @@ grn_output_array_open(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_typ
msgpack_pack_array(&ctx->impl->msgpacker, nelements);
#endif
break;
+ case GRN_CONTENT_GROONGA_COMMAND_LIST :
+ break;
case GRN_CONTENT_NONE:
break;
}
@@ -121,6 +123,8 @@ grn_output_array_close(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_ty
case GRN_CONTENT_MSGPACK :
// do nothing
break;
+ case GRN_CONTENT_GROONGA_COMMAND_LIST :
+ break;
case GRN_CONTENT_NONE:
break;
}
@@ -157,6 +161,8 @@ grn_output_map_open(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type,
msgpack_pack_map(&ctx->impl->msgpacker, nelements);
#endif
break;
+ case GRN_CONTENT_GROONGA_COMMAND_LIST :
+ break;
case GRN_CONTENT_NONE:
break;
}
@@ -188,6 +194,8 @@ grn_output_map_close(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type
case GRN_CONTENT_MSGPACK :
// do nothing
break;
+ case GRN_CONTENT_GROONGA_COMMAND_LIST :
+ break;
case GRN_CONTENT_NONE:
break;
}
@@ -216,6 +224,9 @@ grn_output_int32(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type, in
msgpack_pack_int32(&ctx->impl->msgpacker, value);
#endif
break;
+ case GRN_CONTENT_GROONGA_COMMAND_LIST :
+ grn_text_itoa(ctx, outbuf, value);
+ break;
case GRN_CONTENT_NONE:
break;
}
@@ -243,6 +254,9 @@ grn_output_int64(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type, in
msgpack_pack_int64(&ctx->impl->msgpacker, value);
#endif
break;
+ case GRN_CONTENT_GROONGA_COMMAND_LIST :
+ grn_text_lltoa(ctx, outbuf, value);
+ break;
case GRN_CONTENT_NONE:
break;
}
@@ -270,6 +284,9 @@ grn_output_uint64(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type, i
msgpack_pack_uint64(&ctx->impl->msgpacker, value);
#endif
break;
+ case GRN_CONTENT_GROONGA_COMMAND_LIST :
+ grn_text_ulltoa(ctx, outbuf, value);
+ break;
case GRN_CONTENT_NONE:
break;
}
@@ -297,6 +314,9 @@ grn_output_float(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type, do
msgpack_pack_double(&ctx->impl->msgpacker, value);
#endif
break;
+ case GRN_CONTENT_GROONGA_COMMAND_LIST :
+ grn_text_ftoa(ctx, outbuf, value);
+ break;
case GRN_CONTENT_NONE:
break;
}
@@ -322,10 +342,13 @@ grn_output_str(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type,
break;
case GRN_CONTENT_MSGPACK :
#ifdef GRN_WITH_MESSAGE_PACK
- msgpack_pack_raw(&ctx->impl->msgpacker, value_len);
- msgpack_pack_raw_body(&ctx->impl->msgpacker, value, value_len);
+ msgpack_pack_str(&ctx->impl->msgpacker, value_len);
+ msgpack_pack_str_body(&ctx->impl->msgpacker, value, value_len);
#endif
break;
+ case GRN_CONTENT_GROONGA_COMMAND_LIST :
+ GRN_TEXT_PUT(ctx, outbuf, value, value_len);
+ break;
case GRN_CONTENT_NONE:
break;
}
@@ -364,6 +387,9 @@ grn_output_bool(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type, grn
}
#endif
break;
+ case GRN_CONTENT_GROONGA_COMMAND_LIST :
+ GRN_TEXT_PUTS(ctx, outbuf, value ? "true" : "false");
+ break;
case GRN_CONTENT_NONE:
break;
}
@@ -388,6 +414,8 @@ grn_output_null(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type)
msgpack_pack_nil(&ctx->impl->msgpacker);
#endif
break;
+ case GRN_CONTENT_GROONGA_COMMAND_LIST :
+ break;
case GRN_CONTENT_NONE:
break;
}
@@ -428,6 +456,9 @@ grn_output_time(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type, int
msgpack_pack_double(&ctx->impl->msgpacker, dv);
#endif
break;
+ case GRN_CONTENT_GROONGA_COMMAND_LIST :
+ grn_text_ftoa(ctx, outbuf, dv);
+ break;
case GRN_CONTENT_NONE:
break;
}
@@ -479,8 +510,8 @@ grn_output_geo_point(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type
grn_text_itoa(ctx, &buf, value->latitude);
GRN_TEXT_PUTC(ctx, &buf, 'x');
grn_text_itoa(ctx, &buf, value->longitude);
- msgpack_pack_raw(&ctx->impl->msgpacker, GRN_TEXT_LEN(&buf));
- msgpack_pack_raw_body(&ctx->impl->msgpacker,
+ msgpack_pack_str(&ctx->impl->msgpacker, GRN_TEXT_LEN(&buf));
+ msgpack_pack_str_body(&ctx->impl->msgpacker,
GRN_TEXT_VALUE(&buf),
GRN_TEXT_LEN(&buf));
grn_obj_close(ctx, &buf);
@@ -489,6 +520,17 @@ grn_output_geo_point(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type
}
#endif
break;
+ case GRN_CONTENT_GROONGA_COMMAND_LIST :
+ if (value) {
+ GRN_TEXT_PUTC(ctx, outbuf, '"');
+ grn_text_itoa(ctx, outbuf, value->latitude);
+ GRN_TEXT_PUTC(ctx, outbuf, 'x');
+ grn_text_itoa(ctx, outbuf, value->longitude);
+ GRN_TEXT_PUTC(ctx, outbuf, '"');
+ } else {
+ GRN_TEXT_PUTS(ctx, outbuf, "\"\"");
+ }
+ break;
case GRN_CONTENT_NONE:
break;
}
@@ -521,10 +563,10 @@ grn_text_atoj(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type,
buf.header.domain = DB_OBJ(a->obj)->range;
break;
case GRN_ACCESSOR_GET_SCORE :
- grn_obj_get_value(ctx, a->obj, id, &buf);
{
grn_rset_recinfo *ri = (grn_rset_recinfo *)grn_obj_get_value_(ctx, a->obj, id, &vs);
- GRN_INT32_PUT(ctx, &buf, ri->score);
+ int32_t int32_score = ri->score;
+ GRN_INT32_PUT(ctx, &buf, int32_score);
}
buf.header.domain = GRN_DB_INT32;
break;
@@ -535,6 +577,42 @@ grn_text_atoj(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type,
}
buf.header.domain = GRN_DB_INT32;
break;
+ case GRN_ACCESSOR_GET_MAX :
+ {
+ grn_rset_recinfo *ri = (grn_rset_recinfo *)grn_obj_get_value_(ctx, a->obj, id, &vs);
+ int64_t max;
+ max = grn_rset_recinfo_get_max(ctx, ri, a->obj);
+ GRN_INT64_PUT(ctx, &buf, max);
+ }
+ buf.header.domain = GRN_DB_INT64;
+ break;
+ case GRN_ACCESSOR_GET_MIN :
+ {
+ grn_rset_recinfo *ri = (grn_rset_recinfo *)grn_obj_get_value_(ctx, a->obj, id, &vs);
+ int64_t min;
+ min = grn_rset_recinfo_get_min(ctx, ri, a->obj);
+ GRN_INT64_PUT(ctx, &buf, min);
+ }
+ buf.header.domain = GRN_DB_INT64;
+ break;
+ case GRN_ACCESSOR_GET_SUM :
+ {
+ grn_rset_recinfo *ri = (grn_rset_recinfo *)grn_obj_get_value_(ctx, a->obj, id, &vs);
+ int64_t sum;
+ sum = grn_rset_recinfo_get_sum(ctx, ri, a->obj);
+ GRN_INT64_PUT(ctx, &buf, sum);
+ }
+ buf.header.domain = GRN_DB_INT64;
+ break;
+ case GRN_ACCESSOR_GET_AVG :
+ {
+ grn_rset_recinfo *ri = (grn_rset_recinfo *)grn_obj_get_value_(ctx, a->obj, id, &vs);
+ double avg;
+ avg = grn_rset_recinfo_get_avg(ctx, ri, a->obj);
+ GRN_FLOAT_PUT(ctx, &buf, avg);
+ }
+ buf.header.domain = GRN_DB_FLOAT;
+ break;
case GRN_ACCESSOR_GET_COLUMN_VALUE :
if ((a->obj->header.flags & GRN_OBJ_COLUMN_TYPE_MASK) == GRN_OBJ_COLUMN_VECTOR) {
if (a->next) {
@@ -1023,6 +1101,7 @@ grn_output_table_header(grn_ctx *ctx, grn_obj *outbuf,
grn_content_type output_type,
grn_obj *table, grn_obj_format *format)
{
+ if (format->nhits != -1) {
grn_output_array_open(ctx, outbuf, output_type, "NHITS", 1);
if (output_type == GRN_CONTENT_XML) {
grn_text_itoa(ctx, outbuf, format->nhits);
@@ -1030,6 +1109,7 @@ grn_output_table_header(grn_ctx *ctx, grn_obj *outbuf,
grn_output_int32(ctx, outbuf, output_type, format->nhits);
}
grn_output_array_close(ctx, outbuf, output_type);
+ }
}
static inline int
@@ -1105,6 +1185,20 @@ count_used_n_codes(grn_ctx *ctx, grn_expr_code *start, grn_expr_code *target)
return n_codes;
}
+static grn_bool
+is_score_accessor(grn_ctx *ctx, grn_obj *obj)
+{
+ grn_accessor *a;
+
+ if (obj->header.type != GRN_ACCESSOR) {
+ return GRN_FALSE;
+ }
+
+ for (a = (grn_accessor *)obj; a->next; a = a->next) {
+ }
+ return a->action == GRN_ACCESSOR_GET_SCORE;
+}
+
static inline void
grn_output_table_column(grn_ctx *ctx, grn_obj *outbuf,
grn_content_type output_type,
@@ -1112,11 +1206,18 @@ grn_output_table_column(grn_ctx *ctx, grn_obj *outbuf,
{
grn_output_array_open(ctx, outbuf, output_type, "COLUMN", 2);
if (column) {
- grn_id range_id;
+ grn_id range_id = GRN_ID_NIL;
GRN_BULK_REWIND(buf);
grn_column_name_(ctx, column, buf);
grn_output_obj(ctx, outbuf, output_type, buf, NULL);
- range_id = grn_obj_get_range(ctx, column);
+ if (column->header.type == GRN_COLUMN_INDEX) {
+ range_id = GRN_DB_UINT32;
+ } else if (is_score_accessor(ctx, column)) {
+ range_id = GRN_DB_INT32;
+ }
+ if (range_id == GRN_ID_NIL) {
+ range_id = grn_obj_get_range(ctx, column);
+ }
if (range_id == GRN_ID_NIL) {
grn_output_cstr(ctx, outbuf, output_type, "null");
} else {
@@ -1139,6 +1240,46 @@ grn_output_table_column(grn_ctx *ctx, grn_obj *outbuf,
}
static inline void
+grn_output_table_column_by_expression(grn_ctx *ctx, grn_obj *outbuf,
+ grn_content_type output_type,
+ grn_expr_code *code,
+ grn_expr_code *code_end,
+ grn_obj *buf)
+{
+ if (code_end <= code) {
+ grn_output_array_open(ctx, outbuf, output_type, "COLUMN", 2);
+ grn_output_null(ctx, outbuf, output_type);
+ grn_output_null(ctx, outbuf, output_type);
+ grn_output_array_close(ctx, outbuf, output_type);
+ return;
+ }
+
+ switch (code_end[-1].op) {
+ case GRN_OP_GET_MEMBER :
+ if ((code_end - code) == 3) {
+ grn_output_array_open(ctx, outbuf, output_type, "COLUMN", 2);
+
+ GRN_BULK_REWIND(buf);
+ grn_column_name_(ctx, code[0].value, buf);
+ GRN_TEXT_PUTC(ctx, buf, '[');
+ grn_inspect(ctx, buf, code[1].value);
+ GRN_TEXT_PUTC(ctx, buf, ']');
+
+ grn_output_obj(ctx, outbuf, output_type, buf, NULL);
+ grn_output_null(ctx, outbuf, output_type);
+
+ grn_output_array_close(ctx, outbuf, output_type);
+ } else {
+ grn_output_table_column(ctx, outbuf, output_type, code->value, buf);
+ }
+ break;
+ default :
+ grn_output_table_column(ctx, outbuf, output_type, code->value, buf);
+ break;
+ }
+}
+
+static inline void
grn_output_table_columns_by_expression(grn_ctx *ctx, grn_obj *outbuf,
grn_content_type output_type,
grn_obj *table, grn_obj_format *format,
@@ -1163,30 +1304,35 @@ grn_output_table_columns_by_expression(grn_ctx *ctx, grn_obj *outbuf,
}
have_comma = GRN_TRUE;
- code_start_offset = previous_comma_offset + 1;
if (is_first_comma) {
+ int n_used_codes;
int code_end_offset;
- int n_used_code;
- grn_output_table_column(ctx, outbuf, output_type,
- expr->codes[0].value, buf);
+ n_used_codes = count_used_n_codes(ctx, expr->codes, code - 1);
+ code_end_offset = code - expr->codes - n_used_codes;
- code_end_offset = code - expr->codes - code_start_offset - 1;
- n_used_code = count_used_n_codes(ctx,
- expr->codes,
- expr->codes + code_end_offset);
- code_start_offset = code_end_offset - n_used_code + 1;
+ grn_output_table_column_by_expression(ctx, outbuf, output_type,
+ expr->codes,
+ expr->codes + code_end_offset,
+ buf);
+ code_start_offset = code_end_offset;
is_first_comma = GRN_FALSE;
+ } else {
+ code_start_offset = previous_comma_offset + 1;
}
- grn_output_table_column(ctx, outbuf, output_type,
- expr->codes[code_start_offset].value, buf);
+ grn_output_table_column_by_expression(ctx, outbuf, output_type,
+ expr->codes + code_start_offset,
+ code,
+ buf);
previous_comma_offset = code - expr->codes;
}
if (!have_comma && expr->codes_curr > 0) {
- grn_output_table_column(ctx, outbuf, output_type,
- expr->codes[0].value, buf);
+ grn_output_table_column_by_expression(ctx, outbuf, output_type,
+ expr->codes,
+ code_end,
+ buf);
}
grn_output_array_close(ctx, outbuf, output_type);
@@ -1209,7 +1355,7 @@ grn_output_table_columns_by_columns(grn_ctx *ctx, grn_obj *outbuf,
grn_output_array_close(ctx, outbuf, output_type);
}
-static inline void
+void
grn_output_table_columns(grn_ctx *ctx, grn_obj *outbuf,
grn_content_type output_type,
grn_obj *table, grn_obj_format *format)
@@ -1322,7 +1468,7 @@ grn_output_table_records_by_columns(grn_ctx *ctx, grn_obj *outbuf,
}
}
-static inline void
+void
grn_output_table_records(grn_ctx *ctx, grn_obj *outbuf,
grn_content_type output_type,
grn_obj *table, grn_obj_format *format)
@@ -1700,7 +1846,7 @@ typedef struct {
} msgpack_writer_ctx;
static inline int
-msgpack_buffer_writer(void* data, const char* buf, unsigned int len)
+msgpack_buffer_writer(void* data, const char* buf, msgpack_size_t len)
{
msgpack_writer_ctx *writer_ctx = (msgpack_writer_ctx *)data;
return grn_bulk_write(writer_ctx->ctx, writer_ctx->buffer, buf, len);
@@ -1878,8 +2024,8 @@ grn_output_envelope(grn_ctx *ctx,
msgpack_pack_double(&header_packer, elapsed);
if (rc != GRN_SUCCESS) {
- msgpack_pack_raw(&header_packer, strlen(ctx->errbuf));
- msgpack_pack_raw_body(&header_packer, ctx->errbuf, strlen(ctx->errbuf));
+ msgpack_pack_str(&header_packer, strlen(ctx->errbuf));
+ msgpack_pack_str_body(&header_packer, ctx->errbuf, strlen(ctx->errbuf));
if (ctx->errfunc && ctx->errfile) {
grn_obj *command = GRN_CTX_USER_DATA(ctx)->ptr;
int error_detail_size;
@@ -1894,34 +2040,84 @@ grn_output_envelope(grn_ctx *ctx,
}
msgpack_pack_array(&header_packer, error_detail_size);
- msgpack_pack_raw(&header_packer, strlen(ctx->errfunc));
- msgpack_pack_raw_body(&header_packer, ctx->errfunc, strlen(ctx->errfunc));
+ msgpack_pack_str(&header_packer, strlen(ctx->errfunc));
+ msgpack_pack_str_body(&header_packer, ctx->errfunc, strlen(ctx->errfunc));
- msgpack_pack_raw(&header_packer, strlen(ctx->errfile));
- msgpack_pack_raw_body(&header_packer, ctx->errfile, strlen(ctx->errfile));
+ msgpack_pack_str(&header_packer, strlen(ctx->errfile));
+ msgpack_pack_str_body(&header_packer, ctx->errfile, strlen(ctx->errfile));
msgpack_pack_int(&header_packer, ctx->errline);
if (command) {
if (file) {
- msgpack_pack_raw(&header_packer, strlen(file));
- msgpack_pack_raw_body(&header_packer, file, strlen(file));
+ msgpack_pack_str(&header_packer, strlen(file));
+ msgpack_pack_str_body(&header_packer, file, strlen(file));
} else {
- msgpack_pack_raw(&header_packer, 7);
- msgpack_pack_raw_body(&header_packer, "(stdin)", 7);
+ msgpack_pack_str(&header_packer, 7);
+ msgpack_pack_str_body(&header_packer, "(stdin)", 7);
}
msgpack_pack_int(&header_packer, line);
- msgpack_pack_raw(&header_packer, GRN_TEXT_LEN(command));
- msgpack_pack_raw_body(&header_packer, GRN_TEXT_VALUE(command), GRN_TEXT_LEN(command));
+ msgpack_pack_str(&header_packer, GRN_TEXT_LEN(command));
+ msgpack_pack_str_body(&header_packer, GRN_TEXT_VALUE(command), GRN_TEXT_LEN(command));
}
}
}
}
#endif
break;
+ case GRN_CONTENT_GROONGA_COMMAND_LIST :
+ break;
case GRN_CONTENT_NONE:
break;
}
}
+
+static inline grn_bool
+is_output_columns_format_v1(grn_ctx *ctx,
+ const char *output_columns,
+ unsigned int output_columns_len)
+{
+ unsigned int i;
+
+ /* TODO: REMOVE ME. If new output_columns handler is marked as stable,
+ this check is removed. We need more error checks. */
+ if (grn_ctx_get_command_version(ctx) == GRN_COMMAND_VERSION_1) {
+ return GRN_TRUE;
+ }
+
+ for (i = 0; i < output_columns_len; i++) {
+ switch (output_columns[i]) {
+ case ',' :
+ case '(' :
+ case '[' :
+ return GRN_FALSE;
+ default :
+ break;
+ }
+ }
+
+ return GRN_TRUE;
+}
+
+grn_rc
+grn_output_format_set_columns(grn_ctx *ctx, grn_obj_format *format,
+ grn_obj *table,
+ const char *columns, int columns_len)
+{
+ grn_rc rc;
+
+ if (is_output_columns_format_v1(ctx, columns, columns_len)) {
+ rc = grn_obj_columns(ctx, table, columns, columns_len, &(format->columns));
+ } else {
+ grn_obj *variable;
+ GRN_EXPR_CREATE_FOR_QUERY(ctx, table, format->expression, variable);
+ rc = grn_expr_parse(ctx, format->expression,
+ columns, columns_len, NULL,
+ GRN_OP_MATCH, GRN_OP_AND,
+ GRN_EXPR_SYNTAX_OUTPUT_COLUMNS);
+ }
+
+ return rc;
+}
diff --git a/storage/mroonga/vendor/groonga/lib/pat.c b/storage/mroonga/vendor/groonga/lib/pat.c
index 5b03e6132e9..e24dbe7bbf0 100644
--- a/storage/mroonga/vendor/groonga/lib/pat.c
+++ b/storage/mroonga/vendor/groonga/lib/pat.c
@@ -14,13 +14,13 @@
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 "groonga_in.h"
+#include "grn.h"
#include <string.h>
#include <limits.h>
-#include "pat.h"
-#include "output.h"
-#include "util.h"
-#include "normalizer_in.h"
+#include "grn_pat.h"
+#include "grn_output.h"
+#include "grn_util.h"
+#include "grn_normalizer.h"
#define GRN_PAT_DELETED (GRN_ID_MAX + 1)
@@ -202,7 +202,7 @@ key_put(grn_ctx *ctx, grn_pat *pat, const uint8_t *key, int len)
uint8_t *dest;
KEY_AT(pat, res, dest, GRN_TABLE_ADD);
if (!dest) { return 0; }
- memcpy(dest, key, len);
+ grn_memcpy(dest, key, len);
}
pat->header->curr_key += len;
return res;
@@ -227,7 +227,7 @@ pat_node_set_key(grn_ctx *ctx, grn_pat *pat, pat_node *n, const uint8_t *key, un
PAT_LEN_SET(n, len);
if (len <= sizeof(uint32_t)) {
PAT_IMD_ON(n);
- memcpy(&n->key, key, len);
+ grn_memcpy(&n->key, key, len);
} else {
PAT_IMD_OFF(n);
n->key = key_put(ctx, pat, key, len);
@@ -725,7 +725,7 @@ _grn_pat_add(grn_ctx *ctx, grn_pat *pat, const uint8_t *key, uint32_t size, uint
pat->header->garbages[size2] = rn->lr[0];
if (!(keybuf = pat_node_get_key(ctx, pat, rn))) { return 0; }
PAT_LEN_SET(rn, size);
- memcpy(keybuf, key, size);
+ grn_memcpy(keybuf, key, size);
} else {
if (!(rn = pat_node_new(ctx, pat, &r))) { return 0; }
pat_node_set_key(ctx, pat, rn, key, size);
@@ -749,16 +749,16 @@ _grn_pat_add(grn_ctx *ctx, grn_pat *pat, const uint8_t *key, uint32_t size, uint
return r;
}
-inline static int
+inline static grn_bool
chop(grn_ctx *ctx, grn_pat *pat, const char **key, const char *end, uint32_t *lkey)
{
size_t len = grn_charlen(ctx, *key, end);
if (len) {
*lkey += len;
*key += len;
- return **key;
+ return (end - *key) > 0;
} else {
- return 0;
+ return GRN_FALSE;
}
}
@@ -1137,14 +1137,18 @@ _grn_pat_del(grn_ctx *ctx, grn_pat *pat, const char *key, uint32_t key_size, int
di->stat = DL_PHASE2;
di->d = r;
if (otherside) {
- PAT_AT(pat, otherside, rno);
- if (rno && c0 < PAT_CHK(rno) && PAT_CHK(rno) <= c) {
- if (!delinfo_search(pat, otherside)) {
- GRN_LOG(ctx, GRN_LOG_ERROR, "no delinfo found %d", otherside);
+ if (otherside == r) {
+ otherside = 0;
+ } else {
+ PAT_AT(pat, otherside, rno);
+ if (rno && c0 < PAT_CHK(rno) && PAT_CHK(rno) <= c) {
+ if (!delinfo_search(pat, otherside)) {
+ GRN_LOG(ctx, GRN_LOG_DEBUG, "no delinfo found %d", otherside);
+ }
+ PAT_CHK_SET(rno, 0);
}
- PAT_CHK_SET(rno, 0);
+ if (proot == p0 && !rno->check) { rno->lr[0] = rno->lr[1] = otherside; }
}
- if (proot == p0 && !rno->check) { rno->lr[0] = rno->lr[1] = otherside; }
}
*p0 = otherside;
} else {
@@ -1201,14 +1205,18 @@ _grn_pat_del(grn_ctx *ctx, grn_pat *pat, const char *key, uint32_t key_size, int
if (proot == p0 && !rn0->check) { rn0->lr[0] = rn0->lr[1] = otherside; }
} else {
if (otherside) {
- PAT_AT(pat, otherside, rno);
- if (rno && c0 < PAT_CHK(rno) && PAT_CHK(rno) <= c) {
- if (!delinfo_search(pat, otherside)) {
- GRN_LOG(ctx, GRN_LOG_ERROR, "no delinfo found %d", otherside);
+ if (otherside == r) {
+ otherside = 0;
+ } else {
+ PAT_AT(pat, otherside, rno);
+ if (rno && c0 < PAT_CHK(rno) && PAT_CHK(rno) <= c) {
+ if (!delinfo_search(pat, otherside)) {
+ GRN_LOG(ctx, GRN_LOG_ERROR, "no delinfo found %d", otherside);
+ }
+ PAT_CHK_SET(rno, 0);
}
- PAT_CHK_SET(rno, 0);
+ if (proot == p0 && !rno->check) { rno->lr[0] = rno->lr[1] = otherside; }
}
- if (proot == p0 && !rno->check) { rno->lr[0] = rno->lr[1] = otherside; }
}
*p0 = otherside;
}
@@ -1295,7 +1303,7 @@ grn_pat_get_key(grn_ctx *ctx, grn_pat *pat, grn_id id, void *keybuf, int bufsize
if (KEY_NEEDS_CONVERT(pat, len)) {
KEY_DEC(pat, keybuf, key, len);
} else {
- memcpy(keybuf, key, len);
+ grn_memcpy(keybuf, key, len);
}
}
return len;
@@ -1341,9 +1349,9 @@ grn_pat_get_value(grn_ctx *ctx, grn_pat *pat, grn_id id, void *valuebuf)
if (v) {
if (valuebuf) {
if (pat->obj.header.flags & GRN_OBJ_KEY_WITH_SIS) {
- memcpy(valuebuf, v + sizeof(sis_node), value_size);
+ grn_memcpy(valuebuf, v + sizeof(sis_node), value_size);
} else {
- memcpy(valuebuf, v, value_size);
+ grn_memcpy(valuebuf, v, value_size);
}
}
return value_size;
@@ -1377,7 +1385,7 @@ grn_pat_set_value(grn_ctx *ctx, grn_pat *pat, grn_id id,
if (pat->obj.header.flags & GRN_OBJ_KEY_WITH_SIS) { v += sizeof(sis_node); }
switch ((flags & GRN_OBJ_SET_MASK)) {
case GRN_OBJ_SET :
- memcpy(v, value, value_size);
+ grn_memcpy(v, value, value_size);
return GRN_SUCCESS;
case GRN_OBJ_INCR :
switch (value_size) {
@@ -2773,7 +2781,7 @@ rk_emit(rk_tree_node *rn, char **str)
#define RK_OUTPUT(e,l) do {\
if (oc < oe) {\
uint32_t l_ = (oc + (l) < oe) ? (l) : (oe - oc);\
- memcpy(oc, (e), l_);\
+ grn_memcpy(oc, (e), l_);\
oc += l_;\
ic_ = ic;\
}\
@@ -2863,7 +2871,7 @@ search_push(grn_ctx *ctx, grn_pat *pat, grn_pat_cursor *c,
if (l + key_len <= GRN_TABLE_MAX_KEY_SIZE) {
int ch = c0;
grn_id i;
- memcpy(key + key_len, e, l);
+ grn_memcpy(key + key_len, e, l);
if ((i = sub_search(ctx, pat, id, &ch, key, key_len + l))) {
search_push(ctx, pat, c, key, key_len + l, rn->next, i, ch, flags);
}
diff --git a/storage/mroonga/vendor/groonga/lib/plugin.c b/storage/mroonga/vendor/groonga/lib/plugin.c
index 3483cc9a5b0..48ccded0b92 100644
--- a/storage/mroonga/vendor/groonga/lib/plugin.c
+++ b/storage/mroonga/vendor/groonga/lib/plugin.c
@@ -1,6 +1,6 @@
/* -*- c-basic-offset: 2 -*- */
/*
- Copyright(C) 2012-2013 Brazil
+ Copyright(C) 2012-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -15,23 +15,36 @@
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 "groonga_in.h"
-#include "groonga/plugin.h"
+#include "grn.h"
+#include <groonga/plugin.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
-#include "db.h"
-#include "plugin_in.h"
-#include "ctx_impl.h"
-#include "util.h"
+#include <sys/stat.h>
+#ifdef HAVE_DIRENT_H
+# include <dirent.h>
+#endif /* HAVE_DIRENT_H */
+
+#ifndef S_ISREG
+# ifdef _S_IFREG
+# define S_ISREG(mode) (mode & _S_IFREG)
+# endif /* _S_IFREG */
+#endif /* !S_ISREG */
+
+#include "grn_db.h"
+#include "grn_plugin.h"
+#include "grn_ctx_impl.h"
+#include "grn_util.h"
+
+#ifdef GRN_WITH_MRUBY
+# include <mruby.h>
+#endif /* GRN_WITH_MRUBY */
static grn_hash *grn_plugins = NULL;
static grn_critical_section grn_plugins_lock;
-#define PATHLEN(filename) (strlen(filename) + 1)
-
#ifdef HAVE_DLFCN_H
# include <dlfcn.h>
# define grn_dl_open(filename) dlopen(filename, RTLD_LAZY | RTLD_LOCAL)
@@ -51,6 +64,8 @@ static grn_critical_section grn_plugins_lock;
# define grn_dl_clear_error()
#endif
+#define GRN_PLUGIN_KEY_SIZE(filename) (strlen((filename)) + 1)
+
static int
compute_name_size(const char *name, int name_size)
{
@@ -71,7 +86,8 @@ grn_plugin_reference(grn_ctx *ctx, const char *filename)
grn_plugin **plugin = NULL;
CRITICAL_SECTION_ENTER(grn_plugins_lock);
- id = grn_hash_get(&grn_gctx, grn_plugins, filename, PATHLEN(filename),
+ id = grn_hash_get(&grn_gctx, grn_plugins,
+ filename, GRN_PLUGIN_KEY_SIZE(filename),
(void **)&plugin);
if (plugin) {
(*plugin)->refcount++;
@@ -85,18 +101,24 @@ const char *
grn_plugin_path(grn_ctx *ctx, grn_id id)
{
const char *path;
- uint32_t key_size;
+ grn_plugin *plugin;
+ int value_size;
const char *system_plugins_dir;
size_t system_plugins_dir_size;
+ if (id == GRN_ID_NIL) {
+ return NULL;
+ }
+
CRITICAL_SECTION_ENTER(grn_plugins_lock);
- path = _grn_hash_key(&grn_gctx, grn_plugins, id, &key_size);
+ value_size = grn_hash_get_value(&grn_gctx, grn_plugins, id, &plugin);
CRITICAL_SECTION_LEAVE(grn_plugins_lock);
- if (!path) {
+ if (!plugin) {
return NULL;
}
+ path = plugin->path;
system_plugins_dir = grn_plugin_get_system_plugins_dir();
system_plugins_dir_size = strlen(system_plugins_dir);
if (strncmp(system_plugins_dir, path, system_plugins_dir_size) == 0) {
@@ -114,7 +136,7 @@ grn_plugin_path(grn_ctx *ctx, grn_id id)
#define GRN_PLUGIN_FUNC_PREFIX "grn_plugin_impl_"
static grn_rc
-grn_plugin_call_init (grn_ctx *ctx, grn_id id)
+grn_plugin_call_init(grn_ctx *ctx, grn_id id)
{
grn_plugin *plugin;
if (!grn_hash_get_value(&grn_gctx, grn_plugins, id, &plugin)) {
@@ -126,6 +148,34 @@ grn_plugin_call_init (grn_ctx *ctx, grn_id id)
return GRN_SUCCESS;
}
+#ifdef GRN_WITH_MRUBY
+static grn_rc
+grn_plugin_call_register_mrb(grn_ctx *ctx, grn_id id, grn_plugin *plugin)
+{
+ grn_mrb_data *data = &(ctx->impl->mrb);
+ mrb_state *mrb = data->state;
+ struct RClass *module = data->module;
+ struct RClass *plugin_loader_class;
+ int arena_index;
+
+ {
+ int added;
+ grn_hash_add(ctx, ctx->impl->mrb.registered_plugins,
+ &id, sizeof(grn_id), NULL, &added);
+ if (!added) {
+ return ctx->rc;
+ }
+ }
+
+ arena_index = mrb_gc_arena_save(mrb);
+ plugin_loader_class = mrb_class_get_under(mrb, module, "PluginLoader");
+ mrb_funcall(mrb, mrb_obj_value(plugin_loader_class),
+ "load_file", 1, mrb_str_new_cstr(mrb, ctx->impl->plugin_path));
+ mrb_gc_arena_restore(mrb, arena_index);
+ return ctx->rc;
+}
+#endif /*GRN_WITH_MRUBY */
+
static grn_rc
grn_plugin_call_register(grn_ctx *ctx, grn_id id)
{
@@ -133,6 +183,11 @@ grn_plugin_call_register(grn_ctx *ctx, grn_id id)
if (!grn_hash_get_value(&grn_gctx, grn_plugins, id, &plugin)) {
return GRN_INVALID_ARGUMENT;
}
+#ifdef GRN_WITH_MRUBY
+ if (!plugin->dl) {
+ return grn_plugin_call_register_mrb(ctx, id, plugin);
+ }
+#endif /* GRN_WITH_MRUBY */
if (plugin->register_func) {
return plugin->register_func(ctx);
}
@@ -193,25 +248,77 @@ grn_plugin_initialize(grn_ctx *ctx, grn_plugin *plugin,
return ctx->rc;
}
+#ifdef GRN_WITH_MRUBY
+static grn_id
+grn_plugin_open_mrb(grn_ctx *ctx, const char *filename, size_t filename_size)
+{
+ grn_id id = GRN_ID_NIL;
+ grn_plugin **plugin = NULL;
+
+ if (!ctx->impl->mrb.state) {
+ ERR(GRN_FUNCTION_NOT_IMPLEMENTED, "mruby support isn't enabled");
+ return GRN_ID_NIL;
+ }
+
+ id = grn_hash_add(&grn_gctx, grn_plugins, filename, filename_size,
+ (void **)&plugin, NULL);
+ if (!id) {
+ return id;
+ }
+
+ *plugin = GRN_GMALLOCN(grn_plugin, 1);
+ if (!*plugin) {
+ grn_hash_delete_by_id(&grn_gctx, grn_plugins, id, NULL);
+ return GRN_ID_NIL;
+ }
+
+ grn_memcpy((*plugin)->path, filename, filename_size);
+ (*plugin)->dl = NULL;
+ (*plugin)->init_func = NULL;
+ (*plugin)->register_func = NULL;
+ (*plugin)->fin_func = NULL;
+ (*plugin)->refcount = 1;
+
+ return id;
+}
+#endif /* GRN_WITH_MRUBY */
+
grn_id
grn_plugin_open(grn_ctx *ctx, const char *filename)
{
- grn_id id;
+ grn_id id = GRN_ID_NIL;
grn_dl dl;
grn_plugin **plugin = NULL;
+ size_t filename_size;
+
+ filename_size = GRN_PLUGIN_KEY_SIZE(filename);
CRITICAL_SECTION_ENTER(grn_plugins_lock);
- if ((id = grn_hash_get(&grn_gctx, grn_plugins, filename, PATHLEN(filename),
+ if ((id = grn_hash_get(&grn_gctx, grn_plugins, filename, filename_size,
(void **)&plugin))) {
(*plugin)->refcount++;
goto exit;
}
+#ifdef GRN_WITH_MRUBY
+ {
+ const char *mrb_suffix;
+ mrb_suffix = grn_plugin_get_ruby_suffix();
+ if (filename_size > strlen(mrb_suffix) &&
+ strcmp(filename + (strlen(filename) - strlen(mrb_suffix)),
+ mrb_suffix) == 0) {
+ id = grn_plugin_open_mrb(ctx, filename, filename_size);
+ goto exit;
+ }
+ }
+#endif /* GRN_WITH_MRUBY */
+
if ((dl = grn_dl_open(filename))) {
- if ((id = grn_hash_add(&grn_gctx, grn_plugins, filename, PATHLEN(filename),
+ if ((id = grn_hash_add(&grn_gctx, grn_plugins, filename, filename_size,
(void **)&plugin, NULL))) {
*plugin = GRN_GMALLOCN(grn_plugin, 1);
if (*plugin) {
+ grn_memcpy((*plugin)->path, filename, filename_size);
if (grn_plugin_initialize(ctx, *plugin, dl, id, filename)) {
GRN_GFREE(*plugin);
*plugin = NULL;
@@ -270,11 +377,13 @@ grn_plugin_close(grn_ctx *ctx, grn_id id)
rc = GRN_SUCCESS;
goto exit;
}
- grn_plugin_call_fin(ctx, id);
- if (!grn_dl_close(plugin->dl)) {
- const char *label;
- label = grn_dl_close_error_label();
- SERR(label);
+ if (plugin->dl) {
+ grn_plugin_call_fin(ctx, id);
+ if (!grn_dl_close(plugin->dl)) {
+ const char *label;
+ label = grn_dl_close_error_label();
+ SERR(label);
+ }
}
GRN_GFREE(plugin);
rc = grn_hash_delete_by_id(&grn_gctx, grn_plugins, id, NULL);
@@ -342,6 +451,12 @@ grn_plugin_get_suffix(void)
return GRN_PLUGIN_SUFFIX;
}
+const char *
+grn_plugin_get_ruby_suffix(void)
+{
+ return ".rb";
+}
+
grn_rc
grn_plugin_register_by_path(grn_ctx *ctx, const char *path)
{
@@ -369,8 +484,8 @@ grn_plugin_register_by_path(grn_ctx *ctx, const char *path)
#ifdef WIN32
static char *win32_plugins_dir = NULL;
static char win32_plugins_dir_buffer[PATH_MAX];
-const char *
-grn_plugin_get_system_plugins_dir(void)
+static const char *
+grn_plugin_get_default_system_plugins_dir(void)
{
if (!win32_plugins_dir) {
const char *base_dir;
@@ -379,22 +494,142 @@ grn_plugin_get_system_plugins_dir(void)
base_dir = grn_win32_base_dir();
base_dir_length = strlen(base_dir);
- strcpy(win32_plugins_dir_buffer, base_dir);
- strcat(win32_plugins_dir_buffer, "/");
- strcat(win32_plugins_dir_buffer, relative_path);
+ grn_strcpy(win32_plugins_dir_buffer, PATH_MAX, base_dir);
+ grn_strcat(win32_plugins_dir_buffer, PATH_MAX, "/");
+ grn_strcat(win32_plugins_dir_buffer, PATH_MAX, relative_path);
win32_plugins_dir = win32_plugins_dir_buffer;
}
return win32_plugins_dir;
}
#else /* WIN32 */
-const char *
-grn_plugin_get_system_plugins_dir(void)
+static const char *
+grn_plugin_get_default_system_plugins_dir(void)
{
return GRN_PLUGINS_DIR;
}
#endif /* WIN32 */
+const char *
+grn_plugin_get_system_plugins_dir(void)
+{
+ static char plugins_dir[GRN_ENV_BUFFER_SIZE];
+
+ grn_getenv("GRN_PLUGINS_DIR",
+ plugins_dir,
+ GRN_ENV_BUFFER_SIZE);
+ if (plugins_dir[0]) {
+ return plugins_dir;
+ } else {
+ return grn_plugin_get_default_system_plugins_dir();
+ }
+}
+
+static char *
+grn_plugin_find_path_raw(grn_ctx *ctx, const char *path)
+{
+ struct stat path_stat;
+
+ if (stat(path, &path_stat) != 0) {
+ return NULL;
+ }
+
+ if (!S_ISREG(path_stat.st_mode)) {
+ return NULL;
+ }
+
+ return GRN_STRDUP(path);
+}
+
+#ifdef GRN_WITH_MRUBY
+static char *
+grn_plugin_find_path_mrb(grn_ctx *ctx, const char *path, size_t path_len)
+{
+ char mrb_path[PATH_MAX];
+ const char *mrb_suffix;
+ size_t mrb_path_len;
+
+ mrb_suffix = grn_plugin_get_ruby_suffix();
+ if (!ctx->impl->mrb.state) {
+ return NULL;
+ }
+
+ mrb_path_len = path_len + strlen(mrb_suffix);
+ if (mrb_path_len >= PATH_MAX) {
+ ERR(GRN_FILENAME_TOO_LONG,
+ "too long plugin path: <%s%s>",
+ path, mrb_suffix);
+ return NULL;
+ }
+
+ grn_strcpy(mrb_path, PATH_MAX, path);
+ grn_strcat(mrb_path, PATH_MAX, mrb_suffix);
+ return grn_plugin_find_path_raw(ctx, mrb_path);
+}
+#else /* GRN_WITH_MRUBY */
+static char *
+grn_plugin_find_path_mrb(grn_ctx *ctx, const char *path, size_t path_len)
+{
+ return NULL;
+}
+#endif /* GRN_WITH_MRUBY */
+
+static char *
+grn_plugin_find_path_so(grn_ctx *ctx, const char *path, size_t path_len)
+{
+ char so_path[PATH_MAX];
+ const char *so_suffix;
+ size_t so_path_len;
+
+ so_suffix = grn_plugin_get_suffix();
+ so_path_len = path_len + strlen(so_suffix);
+ if (so_path_len >= PATH_MAX) {
+ ERR(GRN_FILENAME_TOO_LONG,
+ "too long plugin path: <%s%s>",
+ path, so_suffix);
+ return NULL;
+ }
+
+ grn_strcpy(so_path, PATH_MAX, path);
+ grn_strcat(so_path, PATH_MAX, so_suffix);
+ return grn_plugin_find_path_raw(ctx, so_path);
+}
+
+static char *
+grn_plugin_find_path_libs_so(grn_ctx *ctx, const char *path, size_t path_len)
+{
+ char libs_so_path[PATH_MAX];
+ const char *base_name;
+ const char *so_suffix;
+ const char *libs_path = "/.libs";
+ size_t libs_so_path_len;
+
+ base_name = strrchr(path, '/');
+ if (!base_name) {
+ return NULL;
+ }
+
+ so_suffix = grn_plugin_get_suffix();
+ libs_so_path_len =
+ base_name - path +
+ strlen(libs_path) +
+ strlen(base_name) +
+ strlen(so_suffix);
+ if (libs_so_path_len >= PATH_MAX) {
+ ERR(GRN_FILENAME_TOO_LONG,
+ "too long plugin path: <%.*s/.libs%s%s>",
+ (int)(base_name - path), path, base_name, so_suffix);
+ return NULL;
+ }
+
+ libs_so_path[0] = '\0';
+ grn_strncat(libs_so_path, PATH_MAX, path, base_name - path);
+ grn_strcat(libs_so_path, PATH_MAX, libs_path);
+ grn_strcat(libs_so_path, PATH_MAX, base_name);
+ grn_strcat(libs_so_path, PATH_MAX, so_suffix);
+ return grn_plugin_find_path_raw(ctx, libs_so_path);
+}
+
char *
grn_plugin_find_path(grn_ctx *ctx, const char *name)
{
@@ -402,8 +637,6 @@ grn_plugin_find_path(grn_ctx *ctx, const char *name)
char dir_last_char;
char path[PATH_MAX];
int name_length, max_name_length;
- FILE *plugin_file;
- char complemented_path[PATH_MAX], complemented_libs_path[PATH_MAX];
char *found_path = NULL;
size_t path_len;
@@ -411,15 +644,12 @@ grn_plugin_find_path(grn_ctx *ctx, const char *name)
if (name[0] == '/') {
path[0] = '\0';
} else {
- plugins_dir = getenv("GRN_PLUGINS_DIR");
- if (!plugins_dir) {
- plugins_dir = grn_plugin_get_system_plugins_dir();
- }
- strcpy(path, plugins_dir);
+ plugins_dir = grn_plugin_get_system_plugins_dir();
+ grn_strcpy(path, PATH_MAX, plugins_dir);
dir_last_char = plugins_dir[strlen(path) - 1];
if (dir_last_char != '/') {
- strcat(path, "/");
+ grn_strcat(path, PATH_MAX, "/");
}
}
@@ -432,58 +662,66 @@ grn_plugin_find_path(grn_ctx *ctx, const char *name)
path, name);
goto exit;
}
- strcat(path, name);
+ grn_strcat(path, PATH_MAX, name);
- plugin_file = fopen(path, "r");
- if (plugin_file) {
- fclose(plugin_file);
- found_path = GRN_STRDUP(path);
- } else {
- path_len = strlen(path);
- path_len += strlen(grn_plugin_get_suffix());
- if (path_len >= PATH_MAX) {
- ERR(GRN_FILENAME_TOO_LONG,
- "too long plugin path: <%s%s>",
- path, grn_plugin_get_suffix());
- goto exit;
- }
- strcpy(complemented_path, path);
- strcat(complemented_path, grn_plugin_get_suffix());
- plugin_file = fopen(complemented_path, "r");
- if (plugin_file) {
- fclose(plugin_file);
- found_path = GRN_STRDUP(complemented_path);
- } else {
- const char *base_name;
-
- base_name = strrchr(path, '/');
- if (base_name) {
- path_len = base_name - path + strlen("/.libs") + strlen(base_name);
- path_len += strlen(grn_plugin_get_suffix());
- if (path_len >= PATH_MAX) {
- ERR(GRN_FILENAME_TOO_LONG,
- "too long plugin path: <%.*s/.libs%s%s>",
- (int)(base_name - path), path, base_name, grn_plugin_get_suffix());
- goto exit;
- }
- complemented_libs_path[0] = '\0';
- strncat(complemented_libs_path, path, base_name - path);
- strcat(complemented_libs_path, "/.libs");
- strcat(complemented_libs_path, base_name);
- strcat(complemented_libs_path, grn_plugin_get_suffix());
- plugin_file = fopen(complemented_libs_path, "r");
- if (plugin_file) {
- fclose(plugin_file);
- found_path = GRN_STRDUP(complemented_libs_path);
- }
- }
- }
+ found_path = grn_plugin_find_path_raw(ctx, path);
+ if (found_path) {
+ goto exit;
+ }
+
+ path_len = strlen(path);
+ found_path = grn_plugin_find_path_mrb(ctx, path, path_len);
+ if (found_path) {
+ goto exit;
+ }
+ if (ctx->rc) {
+ goto exit;
+ }
+
+ found_path = grn_plugin_find_path_so(ctx, path, path_len);
+ if (found_path) {
+ goto exit;
+ }
+ if (ctx->rc) {
+ goto exit;
+ }
+
+ found_path = grn_plugin_find_path_libs_so(ctx, path, path_len);
+ if (found_path) {
+ goto exit;
+ }
+ if (ctx->rc) {
+ goto exit;
}
exit :
GRN_API_RETURN(found_path);
}
+static void
+grn_plugin_set_name_resolve_error(grn_ctx *ctx, const char *name,
+ const char *tag)
+{
+ const char *prefix, *prefix_separator, *suffix;
+
+ if (name[0] == '/') {
+ prefix = "";
+ prefix_separator = "";
+ suffix = "";
+ } else {
+ prefix = grn_plugin_get_system_plugins_dir();
+ if (prefix[strlen(prefix) - 1] != '/') {
+ prefix_separator = "/";
+ } else {
+ prefix_separator = "";
+ }
+ suffix = grn_plugin_get_suffix();
+ }
+ ERR(GRN_NO_SUCH_FILE_OR_DIRECTORY,
+ "%s cannot find plugin file: <%s%s%s%s>",
+ tag, prefix, prefix_separator, name, suffix);
+}
+
grn_rc
grn_plugin_register(grn_ctx *ctx, const char *name)
{
@@ -497,32 +735,143 @@ grn_plugin_register(grn_ctx *ctx, const char *name)
GRN_FREE(path);
} else {
if (ctx->rc == GRN_SUCCESS) {
- const char *prefix, *prefix_separator, *suffix;
- if (name[0] == '/') {
- prefix = "";
- prefix_separator = "";
- suffix = "";
+ grn_plugin_set_name_resolve_error(ctx, name, "[plugin][register]");
+ }
+ rc = ctx->rc;
+ }
+ GRN_API_RETURN(rc);
+}
+
+grn_rc
+grn_plugin_unregister_by_path(grn_ctx *ctx, const char *path)
+{
+ grn_obj *db;
+ grn_id plugin_id;
+
+ if (!ctx || !ctx->impl) {
+ ERR(GRN_INVALID_ARGUMENT, "[plugin][unregister] ctx isn't initialized");
+ return ctx->rc;
+ }
+
+ db = ctx->impl->db;
+ if (!db) {
+ ERR(GRN_INVALID_ARGUMENT, "[plugin][unregister] DB isn't initialized");
+ return ctx->rc;
+ }
+
+ GRN_API_ENTER;
+
+ CRITICAL_SECTION_ENTER(grn_plugins_lock);
+ plugin_id = grn_hash_get(&grn_gctx, grn_plugins,
+ path, GRN_PLUGIN_KEY_SIZE(path),
+ NULL);
+ CRITICAL_SECTION_LEAVE(grn_plugins_lock);
+
+ if (plugin_id == GRN_ID_NIL) {
+ GRN_API_RETURN(ctx->rc);
+ }
+
+ {
+ grn_table_cursor *cursor;
+ grn_id id;
+
+ cursor = grn_table_cursor_open(ctx, db,
+ NULL, 0,
+ NULL, 0,
+ 0, -1, GRN_CURSOR_BY_ID);
+ if (!cursor) {
+ GRN_API_RETURN(ctx->rc);
+ }
+
+ while ((id = grn_table_cursor_next(ctx, cursor))) {
+ grn_obj *obj;
+ obj = grn_ctx_at(ctx, id);
+ if (!obj) {
+ continue;
+ }
+ if (obj->header.type == GRN_PROC && DB_OBJ(obj)->range == plugin_id) {
+ grn_obj_remove(ctx, obj);
} else {
- prefix = getenv("GRN_PLUGINS_DIR");
- if (!prefix) {
- prefix = grn_plugin_get_system_plugins_dir();
- }
- if (prefix[strlen(prefix) - 1] != '/') {
- prefix_separator = "/";
- } else {
- prefix_separator = "";
- }
- suffix = grn_plugin_get_suffix();
+ grn_obj_unlink(ctx, obj);
}
- ERR(GRN_NO_SUCH_FILE_OR_DIRECTORY,
- "cannot find plugin file: <%s%s%s%s>",
- prefix, prefix_separator, name, suffix);
+ }
+ grn_table_cursor_close(ctx, cursor);
+ }
+
+ GRN_API_RETURN(ctx->rc);
+}
+
+grn_rc
+grn_plugin_unregister(grn_ctx *ctx, const char *name)
+{
+ grn_rc rc;
+ char *path;
+
+ GRN_API_ENTER;
+ path = grn_plugin_find_path(ctx, name);
+ if (path) {
+ rc = grn_plugin_unregister_by_path(ctx, path);
+ GRN_FREE(path);
+ } else {
+ if (ctx->rc == GRN_SUCCESS) {
+ grn_plugin_set_name_resolve_error(ctx, name, "[plugin][unregister]");
}
rc = ctx->rc;
}
GRN_API_RETURN(rc);
}
+void
+grn_plugin_ensure_registered(grn_ctx *ctx, grn_obj *proc)
+{
+#ifdef GRN_WITH_MRUBY
+ grn_id plugin_id;
+ const char *plugin_path;
+ uint32_t key_size;
+ grn_plugin *plugin;
+ int value_size;
+
+ if (!ctx->impl->mrb.state) {
+ return;
+ }
+
+ if (!(proc->header.flags & GRN_OBJ_CUSTOM_NAME)) {
+ return;
+ }
+
+ {
+ grn_id id;
+ int added;
+ id = DB_OBJ(proc)->id;
+ grn_hash_add(ctx, ctx->impl->mrb.checked_procs,
+ &id, sizeof(grn_id), NULL, &added);
+ if (!added) {
+ return;
+ }
+ }
+
+ plugin_id = DB_OBJ(proc)->range;
+ CRITICAL_SECTION_ENTER(grn_plugins_lock);
+ plugin_path = _grn_hash_key(&grn_gctx, grn_plugins, plugin_id, &key_size);
+ if (plugin_path) {
+ value_size = grn_hash_get_value(&grn_gctx, grn_plugins, plugin_id, &plugin);
+ }
+ CRITICAL_SECTION_LEAVE(grn_plugins_lock);
+
+ if (!plugin_path) {
+ return;
+ }
+
+ if (plugin->dl) {
+ return;
+ }
+
+ ctx->impl->plugin_path = plugin_path;
+ grn_plugin_call_register_mrb(ctx, plugin_id, plugin);
+ ctx->impl->plugin_path = NULL;
+#endif /* GRN_WITH_MRUBY */
+}
+
void *
grn_plugin_malloc(grn_ctx *ctx, size_t size, const char *file, int line,
const char *func)
@@ -647,6 +996,12 @@ grn_plugin_proc_alloc(grn_ctx *ctx, grn_user_data *user_data,
}
grn_obj *
+grn_plugin_proc_get_vars(grn_ctx *ctx, grn_user_data *user_data)
+{
+ return grn_proc_get_vars(ctx, user_data);
+}
+
+grn_obj *
grn_plugin_proc_get_var(grn_ctx *ctx, grn_user_data *user_data,
const char *name, int name_size)
{
diff --git a/storage/mroonga/vendor/groonga/lib/proc.c b/storage/mroonga/vendor/groonga/lib/proc.c
index 37b7ae67d35..fc6aa690e74 100644
--- a/storage/mroonga/vendor/groonga/lib/proc.c
+++ b/storage/mroonga/vendor/groonga/lib/proc.c
@@ -1,6 +1,6 @@
/* -*- c-basic-offset: 2 -*- */
/*
- Copyright(C) 2009-2014 Brazil
+ Copyright(C) 2009-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,29 +16,29 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "proc.h"
-#include "ii.h"
-#include "db.h"
-#include "util.h"
-#include "output.h"
-#include "pat.h"
-#include "geo.h"
-#include "token.h"
-#include "expr.h"
+#include "grn_proc.h"
+#include "grn_ii.h"
+#include "grn_db.h"
+#include "grn_util.h"
+#include "grn_output.h"
+#include "grn_pat.h"
+#include "grn_geo.h"
+#include "grn_token_cursor.h"
+#include "grn_expr.h"
#include <string.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/stat.h>
+#ifdef WIN32
+# include <share.h>
+#endif /* WIN32 */
+
#ifndef O_NOFOLLOW
#define O_NOFOLLOW 0
#endif
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
-
typedef grn_rc (*grn_substitute_term_func) (grn_ctx *ctx,
const char *term,
unsigned int term_len,
@@ -64,7 +64,8 @@ grn_bulk_put_from_file(grn_ctx *ctx, grn_obj *bulk, const char *path)
/* FIXME: implement more smartly with grn_bulk */
int fd, ret = 0;
struct stat stat;
- if ((fd = GRN_OPEN(path, O_RDONLY|O_NOFOLLOW|O_BINARY)) == -1) {
+ grn_open(fd, path, O_RDONLY|O_NOFOLLOW|GRN_OPEN_FLAG_BINARY);
+ if (fd == -1) {
switch (errno) {
case EACCES :
ERR(GRN_OPERATION_NOT_PERMITTED, "request is not allowed: <%s>", path);
@@ -90,7 +91,7 @@ grn_bulk_put_from_file(grn_ctx *ctx, grn_obj *bulk, const char *path)
if ((buf = GRN_MALLOC(rest))) {
ssize_t ss;
for (bp = buf; rest; rest -= ss, bp += ss) {
- if ((ss = GRN_READ(fd, bp, rest)) == -1) { goto exit; }
+ if ((ss = grn_read(fd, bp, rest)) == -1) { goto exit; }
}
GRN_TEXT_PUT(ctx, bulk, buf, stat.st_size);
ret = 1;
@@ -100,7 +101,7 @@ grn_bulk_put_from_file(grn_ctx *ctx, grn_obj *bulk, const char *path)
ERR(GRN_INVALID_ARGUMENT, "cannot stat file: <%s>", path);
}
exit :
- GRN_CLOSE(fd);
+ grn_close(fd);
return ret;
}
@@ -395,7 +396,7 @@ grn_parse_query_flags(grn_ctx *ctx, const char *query_flags,
if (((query_flags_end - query_flags) >= (sizeof(#name) - 1)) &&\
(!memcmp(query_flags, #name, sizeof(#name) - 1))) {\
flags |= GRN_EXPR_ ## name;\
- query_flags += sizeof(#name);\
+ query_flags += sizeof(#name) - 1;\
continue;\
}
@@ -417,32 +418,6 @@ grn_parse_query_flags(grn_ctx *ctx, const char *query_flags,
return flags;
}
-static inline grn_bool
-is_output_columns_format_v1(grn_ctx *ctx,
- const char *output_columns,
- unsigned int output_columns_len)
-{
- unsigned int i;
-
- /* TODO: REMOVE ME. If new output_columns handler is marked as stable,
- this check is removed. We need more error checks. */
- if (grn_ctx_get_command_version(ctx) == GRN_COMMAND_VERSION_1) {
- return GRN_TRUE;
- }
-
- for (i = 0; i < output_columns_len; i++) {
- switch (output_columns[i]) {
- case ',' :
- case '(' :
- return GRN_FALSE;
- default :
- break;
- }
- }
-
- return GRN_TRUE;
-}
-
static int
grn_select_apply_adjuster_ensure_factor(grn_ctx *ctx, grn_obj *factor_object)
{
@@ -492,6 +467,7 @@ grn_select_apply_adjuster_adjust(grn_ctx *ctx, grn_obj *table, grn_obj *res,
{
grn_search_optarg options;
+ memset(&options, 0, sizeof(grn_search_optarg));
options.mode = GRN_OP_EXACT;
options.similarity_threshold = 0;
@@ -500,6 +476,7 @@ grn_select_apply_adjuster_adjust(grn_ctx *ctx, grn_obj *table, grn_obj *res,
options.vector_size = factor_value;
options.proc = NULL;
options.max_size = 0;
+ options.scorer = NULL;
grn_obj_search(ctx, index, value, res, GRN_OP_ADJUST, &options);
}
@@ -538,7 +515,335 @@ grn_select_apply_adjuster(grn_ctx *ctx, grn_obj *table, grn_obj *res,
}
}
-grn_rc
+static void
+grn_select_output_columns(grn_ctx *ctx, grn_obj *res,
+ int n_hits, int offset, int limit,
+ const char *columns, int columns_len,
+ grn_obj *condition)
+{
+ grn_rc rc;
+ grn_obj_format format;
+
+ GRN_OBJ_FORMAT_INIT(&format, n_hits, offset, limit, offset);
+ format.flags =
+ GRN_OBJ_FORMAT_WITH_COLUMN_NAMES|
+ GRN_OBJ_FORMAT_XML_ELEMENT_RESULTSET;
+ rc = grn_output_format_set_columns(ctx, &format, res, columns, columns_len);
+ /* TODO: check rc */
+ if (format.expression) {
+ grn_obj *condition_ptr;
+ condition_ptr =
+ grn_expr_get_or_add_var(ctx, format.expression,
+ GRN_SELECT_INTERNAL_VAR_CONDITION,
+ strlen(GRN_SELECT_INTERNAL_VAR_CONDITION));
+ GRN_PTR_INIT(condition_ptr, 0, GRN_DB_OBJECT);
+ GRN_PTR_SET(ctx, condition_ptr, condition);
+ }
+ GRN_OUTPUT_OBJ(res, &format);
+ GRN_OBJ_FORMAT_FIN(ctx, &format);
+}
+
+typedef struct {
+ const char *label;
+ unsigned int label_len;
+ const char *keys;
+ unsigned int keys_len;
+ const char *sortby;
+ unsigned int sortby_len;
+ const char *output_columns;
+ unsigned int output_columns_len;
+ int offset;
+ int limit;
+ grn_table_group_flags calc_types;
+ const char *calc_target_name;
+ unsigned int calc_target_name_len;
+} drilldown_info;
+
+static grn_table_group_flags
+grn_parse_table_group_calc_types(grn_ctx *ctx,
+ const char *calc_types,
+ unsigned int calc_types_len)
+{
+ grn_table_group_flags flags = 0;
+ const char *calc_types_end = calc_types + calc_types_len;
+
+ while (calc_types < calc_types_end) {
+ if (*calc_types == ',' || *calc_types == ' ') {
+ calc_types += 1;
+ continue;
+ }
+
+#define CHECK_TABLE_GROUP_CALC_TYPE(name)\
+ if (((calc_types_end - calc_types) >= (sizeof(#name) - 1)) &&\
+ (!memcmp(calc_types, #name, sizeof(#name) - 1))) {\
+ flags |= GRN_TABLE_GROUP_CALC_ ## name;\
+ calc_types += sizeof(#name) - 1;\
+ continue;\
+ }
+
+ CHECK_TABLE_GROUP_CALC_TYPE(COUNT);
+ CHECK_TABLE_GROUP_CALC_TYPE(MAX);
+ CHECK_TABLE_GROUP_CALC_TYPE(MIN);
+ CHECK_TABLE_GROUP_CALC_TYPE(SUM);
+ CHECK_TABLE_GROUP_CALC_TYPE(AVG);
+
+#define GRN_TABLE_GROUP_CALC_NONE 0
+ CHECK_TABLE_GROUP_CALC_TYPE(NONE);
+#undef GRN_TABLE_GROUP_CALC_NONE
+
+ ERR(GRN_INVALID_ARGUMENT, "invalid table group calc type: <%.*s>",
+ (int)(calc_types_end - calc_types), calc_types);
+ return 0;
+#undef CHECK_TABLE_GROUP_CALC_TYPE
+ }
+
+ return flags;
+}
+
+static void
+drilldown_info_fill(grn_ctx *ctx,
+ drilldown_info *drilldown,
+ grn_obj *keys,
+ grn_obj *sortby,
+ grn_obj *output_columns,
+ grn_obj *offset,
+ grn_obj *limit,
+ grn_obj *calc_types,
+ grn_obj *calc_target)
+{
+ if (keys) {
+ drilldown->keys = GRN_TEXT_VALUE(keys);
+ drilldown->keys_len = GRN_TEXT_LEN(keys);
+ } else {
+ drilldown->keys = NULL;
+ drilldown->keys_len = 0;
+ }
+
+ if (sortby) {
+ drilldown->sortby = GRN_TEXT_VALUE(sortby);
+ drilldown->sortby_len = GRN_TEXT_LEN(sortby);
+ } else {
+ drilldown->sortby = NULL;
+ drilldown->sortby_len = 0;
+ }
+
+ if (output_columns) {
+ drilldown->output_columns = GRN_TEXT_VALUE(output_columns);
+ drilldown->output_columns_len = GRN_TEXT_LEN(output_columns);
+ } else {
+ drilldown->output_columns = NULL;
+ drilldown->output_columns_len = 0;
+ }
+ if (!drilldown->output_columns_len) {
+ drilldown->output_columns = DEFAULT_DRILLDOWN_OUTPUT_COLUMNS;
+ drilldown->output_columns_len = strlen(DEFAULT_DRILLDOWN_OUTPUT_COLUMNS);
+ }
+
+ if (offset && GRN_TEXT_LEN(offset)) {
+ drilldown->offset =
+ grn_atoi(GRN_TEXT_VALUE(offset), GRN_BULK_CURR(offset), NULL);
+ } else {
+ drilldown->offset = 0;
+ }
+
+ if (limit && GRN_TEXT_LEN(limit)) {
+ drilldown->limit =
+ grn_atoi(GRN_TEXT_VALUE(limit), GRN_BULK_CURR(limit), NULL);
+ } else {
+ drilldown->limit = DEFAULT_DRILLDOWN_LIMIT;
+ }
+
+ if (calc_types && GRN_TEXT_LEN(calc_types)) {
+ drilldown->calc_types =
+ grn_parse_table_group_calc_types(ctx,
+ GRN_TEXT_VALUE(calc_types),
+ GRN_TEXT_LEN(calc_types));
+ } else {
+ drilldown->calc_types = 0;
+ }
+
+ if (calc_target && GRN_TEXT_LEN(calc_target)) {
+ drilldown->calc_target_name = GRN_TEXT_VALUE(calc_target);
+ drilldown->calc_target_name_len = GRN_TEXT_LEN(calc_target);
+ } else {
+ drilldown->calc_target_name = NULL;
+ drilldown->calc_target_name_len = 0;
+ }
+}
+
+static void
+grn_select_drilldown(grn_ctx *ctx, grn_obj *table,
+ grn_table_sort_key *keys, uint32_t n_keys,
+ drilldown_info *drilldown)
+{
+ uint32_t i;
+ for (i = 0; i < n_keys; i++) {
+ grn_table_group_result g = {NULL, 0, 0, 1, GRN_TABLE_GROUP_CALC_COUNT, 0};
+ uint32_t n_hits;
+ int offset;
+ int limit;
+
+ if (drilldown->calc_target_name) {
+ g.calc_target = grn_obj_column(ctx, table,
+ drilldown->calc_target_name,
+ drilldown->calc_target_name_len);
+ }
+ if (g.calc_target) {
+ g.flags |= drilldown->calc_types;
+ }
+
+ grn_table_group(ctx, table, &keys[i], 1, &g, 1);
+ if (ctx->rc != GRN_SUCCESS) {
+ break;
+ }
+ n_hits = grn_table_size(ctx, g.table);
+
+ offset = drilldown->offset;
+ limit = drilldown->limit;
+ grn_normalize_offset_and_limit(ctx, n_hits, &offset, &limit);
+
+ if (drilldown->sortby_len) {
+ grn_table_sort_key *sort_keys;
+ uint32_t n_sort_keys;
+ sort_keys = grn_table_sort_key_from_str(ctx,
+ drilldown->sortby,
+ drilldown->sortby_len,
+ g.table, &n_sort_keys);
+ if (sort_keys) {
+ grn_obj *sorted;
+ sorted = grn_table_create(ctx, NULL, 0, NULL, GRN_OBJ_TABLE_NO_KEY,
+ NULL, g.table);
+ if (sorted) {
+ grn_obj_format format;
+ grn_table_sort(ctx, g.table, offset, limit,
+ sorted, sort_keys, n_sort_keys);
+ GRN_OBJ_FORMAT_INIT(&format, n_hits, 0, limit, offset);
+ format.flags =
+ GRN_OBJ_FORMAT_WITH_COLUMN_NAMES|
+ GRN_OBJ_FORMAT_XML_ELEMENT_NAVIGATIONENTRY;
+ grn_obj_columns(ctx, sorted,
+ drilldown->output_columns,
+ drilldown->output_columns_len,
+ &format.columns);
+ GRN_OUTPUT_OBJ(sorted, &format);
+ GRN_OBJ_FORMAT_FIN(ctx, &format);
+ grn_obj_unlink(ctx, sorted);
+ }
+ grn_table_sort_key_close(ctx, sort_keys, n_sort_keys);
+ }
+ } else {
+ grn_obj_format format;
+ GRN_OBJ_FORMAT_INIT(&format, n_hits, offset, limit, offset);
+ format.flags =
+ GRN_OBJ_FORMAT_WITH_COLUMN_NAMES|
+ GRN_OBJ_FORMAT_XML_ELEMENT_NAVIGATIONENTRY;
+ grn_obj_columns(ctx, g.table,
+ drilldown->output_columns,
+ drilldown->output_columns_len,
+ &format.columns);
+ GRN_OUTPUT_OBJ(g.table, &format);
+ GRN_OBJ_FORMAT_FIN(ctx, &format);
+ }
+ grn_obj_unlink(ctx, g.table);
+ GRN_QUERY_LOG(ctx, GRN_QUERY_LOG_SIZE,
+ ":", "drilldown(%d)", n_hits);
+ }
+}
+
+static void
+grn_select_drilldowns(grn_ctx *ctx, grn_obj *table,
+ drilldown_info *drilldowns, unsigned int n_drilldowns,
+ grn_obj *condition)
+{
+ unsigned int i;
+
+ /* TODO: Remove invalid key drilldowns from the count. */
+ GRN_OUTPUT_MAP_OPEN("DRILLDOWNS", n_drilldowns);
+ for (i = 0; i < n_drilldowns; i++) {
+ drilldown_info *drilldown = &(drilldowns[i]);
+ grn_table_sort_key *keys = NULL;
+ unsigned int n_keys;
+ uint32_t n_hits;
+ int offset;
+ int limit;
+ grn_table_group_result result = {
+ NULL, 0, 0, 1, GRN_TABLE_GROUP_CALC_COUNT, 0, 0, NULL
+ };
+
+ keys = grn_table_sort_key_from_str(ctx,
+ drilldown->keys,
+ drilldown->keys_len,
+ table, &n_keys);
+ if (!keys) {
+ continue;
+ }
+
+ GRN_OUTPUT_STR(drilldown->label, drilldown->label_len);
+
+ result.key_begin = 0;
+ result.key_end = n_keys - 1;
+ if (n_keys > 1) {
+ result.max_n_subrecs = 1;
+ }
+ if (drilldown->calc_target_name) {
+ result.calc_target = grn_obj_column(ctx, table,
+ drilldown->calc_target_name,
+ drilldown->calc_target_name_len);
+ }
+ if (result.calc_target) {
+ result.flags |= drilldown->calc_types;
+ }
+
+ grn_table_group(ctx, table, keys, n_keys, &result, 1);
+ n_hits = grn_table_size(ctx, result.table);
+
+ offset = drilldown->offset;
+ limit = drilldown->limit;
+ grn_normalize_offset_and_limit(ctx, n_hits, &offset, &limit);
+
+ if (drilldown->sortby_len) {
+ grn_table_sort_key *sort_keys;
+ uint32_t n_sort_keys;
+ sort_keys = grn_table_sort_key_from_str(ctx,
+ drilldown->sortby,
+ drilldown->sortby_len,
+ result.table, &n_sort_keys);
+ if (sort_keys) {
+ grn_obj *sorted;
+ sorted = grn_table_create(ctx, NULL, 0, NULL, GRN_OBJ_TABLE_NO_KEY,
+ NULL, result.table);
+ if (sorted) {
+ grn_table_sort(ctx, result.table, offset, limit,
+ sorted, sort_keys, n_sort_keys);
+ grn_select_output_columns(ctx, sorted, n_hits, 0, limit,
+ drilldown->output_columns,
+ drilldown->output_columns_len,
+ condition);
+ grn_obj_unlink(ctx, sorted);
+ }
+ grn_table_sort_key_close(ctx, sort_keys, n_sort_keys);
+ }
+ } else {
+ grn_select_output_columns(ctx, result.table, n_hits, offset, limit,
+ drilldown->output_columns,
+ drilldown->output_columns_len,
+ condition);
+ }
+
+ grn_table_sort_key_close(ctx, keys, n_keys);
+ if (result.calc_target) {
+ grn_obj_unlink(ctx, result.calc_target);
+ }
+ grn_obj_unlink(ctx, result.table);
+
+ GRN_QUERY_LOG(ctx, GRN_QUERY_LOG_SIZE,
+ ":", "drilldown(%d)[%.*s]", n_hits,
+ (int)(drilldown->label_len), drilldown->label);
+ }
+ GRN_OUTPUT_MAP_CLOSE();
+}
+
+static grn_rc
grn_select(grn_ctx *ctx, const char *table, unsigned int table_len,
const char *match_columns, unsigned int match_columns_len,
const char *query, unsigned int query_len,
@@ -547,10 +852,8 @@ grn_select(grn_ctx *ctx, const char *table, unsigned int table_len,
const char *sortby, unsigned int sortby_len,
const char *output_columns, unsigned int output_columns_len,
int offset, int limit,
- const char *drilldown, unsigned int drilldown_len,
- const char *drilldown_sortby, unsigned int drilldown_sortby_len,
- const char *drilldown_output_columns, unsigned int drilldown_output_columns_len,
- int drilldown_offset, int drilldown_limit,
+ drilldown_info *drilldowns,
+ unsigned int n_drilldowns,
const char *cache, unsigned int cache_len,
const char *match_escalation_threshold, unsigned int match_escalation_threshold_len,
const char *query_expander, unsigned int query_expander_len,
@@ -559,56 +862,84 @@ grn_select(grn_ctx *ctx, const char *table, unsigned int table_len,
{
uint32_t nkeys, nhits;
uint16_t cacheable = 1, taintable = 0;
- grn_obj_format format;
grn_table_sort_key *keys;
grn_obj *outbuf = ctx->impl->outbuf;
grn_content_type output_type = ctx->impl->output_type;
grn_obj *table_, *match_columns_ = NULL, *cond = NULL, *scorer_, *res = NULL, *sorted;
- char cache_key[GRN_TABLE_MAX_KEY_SIZE];
- uint32_t cache_key_size = table_len + 1 + match_columns_len + 1 + query_len + 1 +
- filter_len + 1 + scorer_len + 1 + sortby_len + 1 + output_columns_len + 1 +
- drilldown_len + 1 + drilldown_sortby_len + 1 +
- drilldown_output_columns_len + 1 + match_escalation_threshold_len + 1 +
- query_expander_len + 1 + query_flags_len + 1 + adjuster_len + 1 +
- sizeof(grn_content_type) + sizeof(int) * 4;
+ char cache_key[GRN_CACHE_MAX_KEY_SIZE];
+ uint32_t cache_key_size;
long long int threshold, original_threshold = 0;
grn_cache *cache_obj = grn_cache_current_get(ctx);
- if (cache_key_size <= GRN_TABLE_MAX_KEY_SIZE) {
+
+ cache_key_size = table_len + 1 + match_columns_len + 1 + query_len + 1 +
+ filter_len + 1 + scorer_len + 1 + sortby_len + 1 + output_columns_len + 1 +
+ match_escalation_threshold_len + 1 +
+ query_expander_len + 1 + query_flags_len + 1 + adjuster_len + 1 +
+ sizeof(grn_content_type) + sizeof(int) * 2;
+ {
+ unsigned int i;
+ for (i = 0; i < n_drilldowns; i++) {
+ drilldown_info *drilldown = &(drilldowns[i]);
+ cache_key_size +=
+ drilldown->keys_len + 1 +
+ drilldown->sortby_len + 1 +
+ drilldown->output_columns_len + 1 +
+ sizeof(int) * 2;
+ }
+ }
+ if (cache_key_size <= GRN_CACHE_MAX_KEY_SIZE) {
grn_obj *cache_value;
char *cp = cache_key;
- memcpy(cp, table, table_len);
+ grn_memcpy(cp, table, table_len);
cp += table_len; *cp++ = '\0';
- memcpy(cp, match_columns, match_columns_len);
+ grn_memcpy(cp, match_columns, match_columns_len);
cp += match_columns_len; *cp++ = '\0';
- memcpy(cp, query, query_len);
+ grn_memcpy(cp, query, query_len);
cp += query_len; *cp++ = '\0';
- memcpy(cp, filter, filter_len);
+ grn_memcpy(cp, filter, filter_len);
cp += filter_len; *cp++ = '\0';
- memcpy(cp, scorer, scorer_len);
+ grn_memcpy(cp, scorer, scorer_len);
cp += scorer_len; *cp++ = '\0';
- memcpy(cp, sortby, sortby_len);
+ grn_memcpy(cp, sortby, sortby_len);
cp += sortby_len; *cp++ = '\0';
- memcpy(cp, output_columns, output_columns_len);
+ grn_memcpy(cp, output_columns, output_columns_len);
cp += output_columns_len; *cp++ = '\0';
- memcpy(cp, drilldown, drilldown_len);
- cp += drilldown_len; *cp++ = '\0';
- memcpy(cp, drilldown_sortby, drilldown_sortby_len);
- cp += drilldown_sortby_len; *cp++ = '\0';
- memcpy(cp, drilldown_output_columns, drilldown_output_columns_len);
- cp += drilldown_output_columns_len; *cp++ = '\0';
- memcpy(cp, match_escalation_threshold, match_escalation_threshold_len);
+ {
+ unsigned int i;
+ for (i = 0; i < n_drilldowns; i++) {
+ drilldown_info *drilldown = &(drilldowns[i]);
+ grn_memcpy(cp, drilldown->keys, drilldown->keys_len);
+ cp += drilldown->keys_len; *cp++ = '\0';
+ grn_memcpy(cp, drilldown->sortby, drilldown->sortby_len);
+ cp += drilldown->sortby_len; *cp++ = '\0';
+ grn_memcpy(cp, drilldown->output_columns, drilldown->output_columns_len);
+ cp += drilldown->output_columns_len; *cp++ = '\0';
+ }
+ }
+ grn_memcpy(cp, match_escalation_threshold, match_escalation_threshold_len);
cp += match_escalation_threshold_len; *cp++ = '\0';
- memcpy(cp, query_expander, query_expander_len);
+ grn_memcpy(cp, query_expander, query_expander_len);
cp += query_expander_len; *cp++ = '\0';
- memcpy(cp, query_flags, query_flags_len);
+ grn_memcpy(cp, query_flags, query_flags_len);
cp += query_flags_len; *cp++ = '\0';
- memcpy(cp, adjuster, adjuster_len);
+ grn_memcpy(cp, adjuster, adjuster_len);
cp += adjuster_len; *cp++ = '\0';
- memcpy(cp, &output_type, sizeof(grn_content_type)); cp += sizeof(grn_content_type);
- memcpy(cp, &offset, sizeof(int)); cp += sizeof(int);
- memcpy(cp, &limit, sizeof(int)); cp += sizeof(int);
- memcpy(cp, &drilldown_offset, sizeof(int)); cp += sizeof(int);
- memcpy(cp, &drilldown_limit, sizeof(int)); cp += sizeof(int);
+ grn_memcpy(cp, &output_type, sizeof(grn_content_type));
+ cp += sizeof(grn_content_type);
+ grn_memcpy(cp, &offset, sizeof(int));
+ cp += sizeof(int);
+ grn_memcpy(cp, &limit, sizeof(int));
+ cp += sizeof(int);
+ {
+ unsigned int i;
+ for (i = 0; i < n_drilldowns; i++) {
+ drilldown_info *drilldown = &(drilldowns[i]);
+ grn_memcpy(cp, &(drilldown->offset), sizeof(int));
+ cp += sizeof(int);
+ grn_memcpy(cp, &(drilldown->limit), sizeof(int));
+ cp += sizeof(int);
+ }
+ }
cache_value = grn_cache_fetch(ctx, cache_obj, cache_key, cache_key_size);
if (cache_value) {
GRN_TEXT_PUT(ctx, outbuf,
@@ -710,12 +1041,17 @@ grn_select(grn_ctx *ctx, const char *table, unsigned int table_len,
uint32_t ngkeys;
grn_table_sort_key *gkeys = NULL;
int result_size = 1;
- if (!ctx->rc && drilldown_len) {
- gkeys = grn_table_sort_key_from_str(ctx,
- drilldown, drilldown_len,
- res, &ngkeys);
- if (gkeys) {
- result_size += ngkeys;
+ if (!ctx->rc && n_drilldowns > 0) {
+ if (n_drilldowns == 1 && !drilldowns[0].label) {
+ gkeys = grn_table_sort_key_from_str(ctx,
+ drilldowns[0].keys,
+ drilldowns[0].keys_len,
+ res, &ngkeys);
+ if (gkeys) {
+ result_size += ngkeys;
+ }
+ } else {
+ result_size += 1;
}
}
@@ -755,6 +1091,9 @@ grn_select(grn_ctx *ctx, const char *table, unsigned int table_len,
while ((id = grn_table_cursor_next(ctx, tc)) != GRN_ID_NIL) {
GRN_RECORD_SET(ctx, v, id);
grn_expr_exec(ctx, scorer_, 0);
+ if (ctx->rc) {
+ break;
+ }
}
grn_table_cursor_close(ctx, tc);
}
@@ -775,126 +1114,36 @@ grn_select(grn_ctx *ctx, const char *table, unsigned int table_len,
grn_table_sort(ctx, res, offset, limit, sorted, keys, nkeys);
GRN_QUERY_LOG(ctx, GRN_QUERY_LOG_SIZE,
":", "sort(%d)", limit);
- GRN_OBJ_FORMAT_INIT(&format, nhits, 0, limit, offset);
- format.flags =
- GRN_OBJ_FORMAT_WITH_COLUMN_NAMES|
- GRN_OBJ_FORMAT_XML_ELEMENT_RESULTSET;
- if (is_output_columns_format_v1(ctx, output_columns, output_columns_len)) {
- grn_obj_columns(ctx, sorted, output_columns, output_columns_len,
- &format.columns);
- } else {
- grn_obj *v;
- grn_obj *condition_ptr;
- GRN_EXPR_CREATE_FOR_QUERY(ctx, sorted, format.expression, v);
- grn_expr_parse(ctx, format.expression,
- output_columns, output_columns_len, NULL,
- GRN_OP_MATCH, GRN_OP_AND,
- GRN_EXPR_SYNTAX_OUTPUT_COLUMNS);
- condition_ptr =
- grn_expr_get_or_add_var(ctx, format.expression,
- GRN_SELECT_INTERNAL_VAR_CONDITION,
- strlen(GRN_SELECT_INTERNAL_VAR_CONDITION));
- GRN_PTR_INIT(condition_ptr, 0, GRN_DB_OBJECT);
- GRN_PTR_SET(ctx, condition_ptr, cond);
- }
- GRN_OUTPUT_OBJ(sorted, &format);
- GRN_OBJ_FORMAT_FIN(ctx, &format);
+ grn_select_output_columns(ctx, sorted, nhits, 0, limit,
+ output_columns, output_columns_len, cond);
grn_obj_unlink(ctx, sorted);
}
grn_table_sort_key_close(ctx, keys, nkeys);
} else {
if (!ctx->rc) {
- GRN_OBJ_FORMAT_INIT(&format, nhits, offset, limit, offset);
- format.flags =
- GRN_OBJ_FORMAT_WITH_COLUMN_NAMES|
- GRN_OBJ_FORMAT_XML_ELEMENT_RESULTSET;
- if (is_output_columns_format_v1(ctx, output_columns, output_columns_len)) {
- grn_obj_columns(ctx, res, output_columns, output_columns_len,
- &format.columns);
- } else {
- grn_obj *v;
- grn_obj *condition_ptr;
- GRN_EXPR_CREATE_FOR_QUERY(ctx, res, format.expression, v);
- grn_expr_parse(ctx, format.expression,
- output_columns, output_columns_len, NULL,
- GRN_OP_MATCH, GRN_OP_AND,
- GRN_EXPR_SYNTAX_OUTPUT_COLUMNS);
- condition_ptr =
- grn_expr_get_or_add_var(ctx, format.expression,
- GRN_SELECT_INTERNAL_VAR_CONDITION,
- strlen(GRN_SELECT_INTERNAL_VAR_CONDITION));
- GRN_PTR_INIT(condition_ptr, 0, GRN_DB_OBJECT);
- GRN_PTR_SET(ctx, condition_ptr, cond);
- }
- GRN_OUTPUT_OBJ(res, &format);
- GRN_OBJ_FORMAT_FIN(ctx, &format);
+ grn_select_output_columns(ctx, res, nhits, offset, limit,
+ output_columns, output_columns_len, cond);
}
}
GRN_QUERY_LOG(ctx, GRN_QUERY_LOG_SIZE,
":", "output(%d)", limit);
- if (!ctx->rc && drilldown_len) {
- uint32_t i;
- grn_table_group_result g = {NULL, 0, 0, 1, GRN_TABLE_GROUP_CALC_COUNT, 0};
+ if (!ctx->rc) {
if (gkeys) {
- for (i = 0; i < ngkeys; i++) {
- if ((g.table = grn_table_create_for_group(ctx, NULL, 0, NULL,
- gkeys[i].key, res, 0))) {
- int n_drilldown_offset = drilldown_offset,
- n_drilldown_limit = drilldown_limit;
-
- grn_table_group(ctx, res, &gkeys[i], 1, &g, 1);
- nhits = grn_table_size(ctx, g.table);
-
- grn_normalize_offset_and_limit(ctx, nhits,
- &n_drilldown_offset, &n_drilldown_limit);
-
- if (drilldown_sortby_len) {
- if ((keys = grn_table_sort_key_from_str(ctx,
- drilldown_sortby, drilldown_sortby_len,
- g.table, &nkeys))) {
- if ((sorted = grn_table_create(ctx, NULL, 0, NULL, GRN_OBJ_TABLE_NO_KEY,
- NULL, g.table))) {
- grn_table_sort(ctx, g.table, n_drilldown_offset, n_drilldown_limit,
- sorted, keys, nkeys);
- GRN_OBJ_FORMAT_INIT(&format, nhits, 0,
- n_drilldown_limit, n_drilldown_offset);
- format.flags =
- GRN_OBJ_FORMAT_WITH_COLUMN_NAMES|
- GRN_OBJ_FORMAT_XML_ELEMENT_NAVIGATIONENTRY;
- grn_obj_columns(ctx, sorted,
- drilldown_output_columns, drilldown_output_columns_len,
- &format.columns);
- GRN_OUTPUT_OBJ(sorted, &format);
- GRN_OBJ_FORMAT_FIN(ctx, &format);
- grn_obj_unlink(ctx, sorted);
- }
- grn_table_sort_key_close(ctx, keys, nkeys);
- }
- } else {
- GRN_OBJ_FORMAT_INIT(&format, nhits, n_drilldown_offset,
- n_drilldown_limit, n_drilldown_offset);
- format.flags =
- GRN_OBJ_FORMAT_WITH_COLUMN_NAMES|
- GRN_OBJ_FORMAT_XML_ELEMENT_NAVIGATIONENTRY;
- grn_obj_columns(ctx, g.table, drilldown_output_columns,
- drilldown_output_columns_len, &format.columns);
- GRN_OUTPUT_OBJ(g.table, &format);
- GRN_OBJ_FORMAT_FIN(ctx, &format);
- }
- grn_obj_unlink(ctx, g.table);
- }
- GRN_QUERY_LOG(ctx, GRN_QUERY_LOG_SIZE,
- ":", "drilldown(%d)", nhits);
- }
- grn_table_sort_key_close(ctx, gkeys, ngkeys);
+ drilldown_info *drilldown = &(drilldowns[0]);
+ grn_select_drilldown(ctx, res, gkeys, ngkeys, drilldown);
+ } else if (n_drilldowns > 0) {
+ grn_select_drilldowns(ctx, res, drilldowns, n_drilldowns, cond);
}
}
+ if (gkeys) {
+ grn_table_sort_key_close(ctx, gkeys, ngkeys);
+ }
if (res != table_) { grn_obj_unlink(ctx, res); }
} else {
GRN_OUTPUT_ARRAY_OPEN("RESULT", 0);
}
GRN_OUTPUT_ARRAY_CLOSE();
- if (!ctx->rc && cacheable && cache_key_size <= GRN_TABLE_MAX_KEY_SIZE
+ if (!ctx->rc && cacheable && cache_key_size <= GRN_CACHE_MAX_KEY_SIZE
&& (!cache || cache_len != 2 || *cache != 'n' || *(cache + 1) != 'o')) {
grn_cache_update(ctx, cache_obj, cache_key, cache_key_size, outbuf);
}
@@ -903,7 +1152,7 @@ grn_select(grn_ctx *ctx, const char *table, unsigned int table_len,
} else {
ERR(GRN_INVALID_ARGUMENT, "invalid table name: <%.*s>", table_len, table);
}
-exit:
+exit :
if (match_escalation_threshold_len) {
grn_ctx_set_match_escalation_threshold(ctx, original_threshold);
}
@@ -917,9 +1166,46 @@ exit:
return ctx->rc;
}
+static void
+proc_select_find_all_drilldown_labels(grn_ctx *ctx, grn_user_data *user_data,
+ grn_obj *labels)
+{
+ grn_obj *vars = GRN_PROC_GET_VARS();
+ grn_table_cursor *cursor;
+ cursor = grn_table_cursor_open(ctx, vars, NULL, 0, NULL, 0, 0, -1, 0);
+ if (cursor) {
+ const char *prefix = "drilldown[";
+ int prefix_len = strlen(prefix);
+ const char *suffix = "].keys";
+ int suffix_len = strlen(suffix);
+ while (grn_table_cursor_next(ctx, cursor)) {
+ void *key;
+ char *name;
+ int name_len;
+ name_len = grn_table_cursor_get_key(ctx, cursor, &key);
+ name = key;
+ if (name_len < (prefix_len + 1 + suffix_len)) {
+ continue;
+ }
+ if (strncmp(prefix, name, prefix_len) != 0) {
+ continue;
+ }
+ if (strncmp(suffix, name + name_len - suffix_len, suffix_len) != 0) {
+ continue;
+ }
+ grn_vector_add_element(ctx, labels,
+ name + prefix_len,
+ name_len - prefix_len - suffix_len,
+ 0, GRN_ID_NIL);
+ }
+ grn_table_cursor_close(ctx, cursor);
+ }
+}
+
static grn_obj *
proc_select(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
{
+#define MAX_N_DRILLDOWNS 10
int offset = GRN_TEXT_LEN(VAR(7))
? grn_atoi(GRN_TEXT_VALUE(VAR(7)), GRN_BULK_CURR(VAR(7)), NULL)
: 0;
@@ -928,27 +1214,74 @@ proc_select(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
: DEFAULT_LIMIT;
const char *output_columns = GRN_TEXT_VALUE(VAR(6));
uint32_t output_columns_len = GRN_TEXT_LEN(VAR(6));
- const char *drilldown_output_columns = GRN_TEXT_VALUE(VAR(11));
- uint32_t drilldown_output_columns_len = GRN_TEXT_LEN(VAR(11));
- int drilldown_offset = GRN_TEXT_LEN(VAR(12))
- ? grn_atoi(GRN_TEXT_VALUE(VAR(12)), GRN_BULK_CURR(VAR(12)), NULL)
- : 0;
- int drilldown_limit = GRN_TEXT_LEN(VAR(13))
- ? grn_atoi(GRN_TEXT_VALUE(VAR(13)), GRN_BULK_CURR(VAR(13)), NULL)
- : DEFAULT_DRILLDOWN_LIMIT;
+ drilldown_info drilldowns[MAX_N_DRILLDOWNS];
+ unsigned int n_drilldowns = 0;
+ grn_obj drilldown_labels;
grn_obj *query_expansion = VAR(16);
grn_obj *query_expander = VAR(18);
grn_obj *adjuster = VAR(19);
+
if (GRN_TEXT_LEN(query_expander) == 0 && GRN_TEXT_LEN(query_expansion) > 0) {
query_expander = query_expansion;
}
+
if (!output_columns_len) {
output_columns = DEFAULT_OUTPUT_COLUMNS;
output_columns_len = strlen(DEFAULT_OUTPUT_COLUMNS);
}
- if (!drilldown_output_columns_len) {
- drilldown_output_columns = DEFAULT_DRILLDOWN_OUTPUT_COLUMNS;
- drilldown_output_columns_len = strlen(DEFAULT_DRILLDOWN_OUTPUT_COLUMNS);
+
+ GRN_TEXT_INIT(&drilldown_labels, GRN_OBJ_VECTOR);
+ if (GRN_TEXT_LEN(VAR(9))) {
+ drilldown_info *drilldown = &(drilldowns[0]);
+ drilldown->label = NULL;
+ drilldown->label_len = 0;
+ drilldown_info_fill(ctx, drilldown,
+ VAR(9), VAR(10), VAR(11), VAR(12), VAR(13),
+ VAR(20), VAR(21));
+ n_drilldowns++;
+ } else {
+ unsigned int i;
+ proc_select_find_all_drilldown_labels(ctx, user_data, &drilldown_labels);
+ n_drilldowns = grn_vector_size(ctx, &drilldown_labels);
+ for (i = 0; i < n_drilldowns; i++) {
+ drilldown_info *drilldown = &(drilldowns[i]);
+ const char *label;
+ int label_len;
+ char key_name[GRN_TABLE_MAX_KEY_SIZE];
+ grn_obj *keys;
+ grn_obj *sortby;
+ grn_obj *output_columns;
+ grn_obj *offset;
+ grn_obj *limit;
+ grn_obj *calc_types;
+ grn_obj *calc_target;
+
+ label_len = grn_vector_get_element(ctx, &drilldown_labels, i,
+ &label, NULL, NULL);
+ drilldown->label = label;
+ drilldown->label_len = label_len;
+
+#define GET_VAR(name)\
+ grn_snprintf(key_name, \
+ GRN_TABLE_MAX_KEY_SIZE, \
+ GRN_TABLE_MAX_KEY_SIZE, \
+ "drilldown[%.*s]." # name, label_len, label); \
+ name = GRN_PROC_GET_VAR(key_name);
+
+ GET_VAR(keys);
+ GET_VAR(sortby);
+ GET_VAR(output_columns);
+ GET_VAR(offset);
+ GET_VAR(limit);
+ GET_VAR(calc_types);
+ GET_VAR(calc_target);
+
+#undef GET_VAR
+
+ drilldown_info_fill(ctx, drilldown,
+ keys, sortby, output_columns, offset, limit,
+ calc_types, calc_target);
+ }
}
if (grn_select(ctx, GRN_TEXT_VALUE(VAR(0)), GRN_TEXT_LEN(VAR(0)),
GRN_TEXT_VALUE(VAR(1)), GRN_TEXT_LEN(VAR(1)),
@@ -958,16 +1291,16 @@ proc_select(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
GRN_TEXT_VALUE(VAR(5)), GRN_TEXT_LEN(VAR(5)),
output_columns, output_columns_len,
offset, limit,
- GRN_TEXT_VALUE(VAR(9)), GRN_TEXT_LEN(VAR(9)),
- GRN_TEXT_VALUE(VAR(10)), GRN_TEXT_LEN(VAR(10)),
- drilldown_output_columns, drilldown_output_columns_len,
- drilldown_offset, drilldown_limit,
+ drilldowns, n_drilldowns,
GRN_TEXT_VALUE(VAR(14)), GRN_TEXT_LEN(VAR(14)),
GRN_TEXT_VALUE(VAR(15)), GRN_TEXT_LEN(VAR(15)),
GRN_TEXT_VALUE(query_expander), GRN_TEXT_LEN(query_expander),
GRN_TEXT_VALUE(VAR(17)), GRN_TEXT_LEN(VAR(17)),
GRN_TEXT_VALUE(adjuster), GRN_TEXT_LEN(adjuster))) {
}
+ GRN_OBJ_FIN(ctx, &drilldown_labels);
+#undef MAX_N_DRILLDOWNS
+
return NULL;
}
@@ -1105,8 +1438,8 @@ grn_parse_column_create_flags(grn_ctx *ctx, const char *nptr, const char *end)
} else if (!memcmp(nptr, "COMPRESS_ZLIB", 13)) {
flags |= GRN_OBJ_COMPRESS_ZLIB;
nptr += 13;
- } else if (!memcmp(nptr, "COMPRESS_LZO", 12)) {
- flags |= GRN_OBJ_COMPRESS_LZO;
+ } else if (!memcmp(nptr, "COMPRESS_LZ4", 12)) {
+ flags |= GRN_OBJ_COMPRESS_LZ4;
nptr += 12;
} else if (!memcmp(nptr, "WITH_SECTION", 12)) {
flags |= GRN_OBJ_WITH_SECTION;
@@ -1191,8 +1524,8 @@ grn_column_create_flags_to_text(grn_ctx *ctx, grn_obj *buf, grn_obj_flags flags)
case GRN_OBJ_COMPRESS_ZLIB:
GRN_TEXT_PUTS(ctx, buf, "|COMPRESS_ZLIB");
break;
- case GRN_OBJ_COMPRESS_LZO:
- GRN_TEXT_PUTS(ctx, buf, "|COMPRESS_LZO");
+ case GRN_OBJ_COMPRESS_LZ4:
+ GRN_TEXT_PUTS(ctx, buf, "|COMPRESS_LZ4");
break;
}
if (flags & GRN_OBJ_PERSISTENT) {
@@ -1374,7 +1707,7 @@ proc_table_create(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_d
ERR(GRN_INVALID_ARGUMENT,
"[table][create] should not create anonymous table");
}
-exit:
+exit :
GRN_OUTPUT_BOOL(!ctx->rc);
return NULL;
}
@@ -1427,7 +1760,7 @@ proc_table_rename(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_d
(int)GRN_TEXT_LEN(VAR(0)), GRN_TEXT_VALUE(VAR(0)),
(int)GRN_TEXT_LEN(VAR(1)), GRN_TEXT_VALUE(VAR(1)));
}
-exit:
+exit :
GRN_OUTPUT_BOOL(!rc);
if (table) { grn_obj_unlink(ctx, table); }
return NULL;
@@ -1595,7 +1928,7 @@ proc_column_create(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_
} else {
succeeded = GRN_FALSE;
}
-exit:
+exit :
GRN_OUTPUT_BOOL(succeeded);
if (table) { grn_obj_unlink(ctx, table); }
if (type) { grn_obj_unlink(ctx, type); }
@@ -1617,7 +1950,7 @@ proc_column_remove(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_
if ((fullname_len = grn_obj_name(ctx, table, fullname, GRN_TABLE_MAX_KEY_SIZE))) {
fullname[fullname_len] = GRN_DB_DELIMITER;
- memcpy((fullname + fullname_len + 1), colname, colname_len);
+ grn_memcpy((fullname + fullname_len + 1), colname, colname_len);
fullname_len += colname_len + 1;
//TODO:check fullname_len < GRN_TABLE_MAX_KEY_SIZE
col = grn_ctx_get(ctx, fullname, fullname_len);
@@ -1687,7 +2020,7 @@ proc_column_rename(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_
(int)GRN_TEXT_LEN(VAR(0)), GRN_TEXT_VALUE(VAR(0)),
(int)GRN_TEXT_LEN(VAR(2)), GRN_TEXT_VALUE(VAR(2)));
}
-exit:
+exit :
GRN_OUTPUT_BOOL(!rc);
if (column) { grn_obj_unlink(ctx, column); }
if (table) { grn_obj_unlink(ctx, table); }
@@ -1900,20 +2233,6 @@ proc_column_list(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_da
return NULL;
}
-static grn_bool
-is_table(grn_obj *obj)
-{
- switch (obj->header.type) {
- case GRN_TABLE_HASH_KEY:
- case GRN_TABLE_PAT_KEY:
- case GRN_TABLE_DAT_KEY:
- case GRN_TABLE_NO_KEY:
- return GRN_TRUE;
- default:
- return GRN_FALSE;
- }
-}
-
static int
output_table_info(grn_ctx *ctx, grn_obj *table)
{
@@ -1948,7 +2267,6 @@ output_table_info(grn_ctx *ctx, grn_obj *table)
static grn_obj *
proc_table_list(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
{
- grn_table_cursor *cur;
grn_obj tables;
int n_top_level_elements;
int n_elements_for_header = 1;
@@ -1956,26 +2274,7 @@ proc_table_list(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_dat
int i;
GRN_PTR_INIT(&tables, GRN_OBJ_VECTOR, GRN_ID_NIL);
-
- if ((cur = grn_table_cursor_open(ctx, ctx->impl->db, NULL, 0, NULL, 0, 0, -1, 0))) {
- grn_id id;
- while ((id = grn_table_cursor_next(ctx, cur)) != GRN_ID_NIL) {
- grn_obj *object;
- if ((object = grn_ctx_at(ctx, id))) {
- if (is_table(object)) {
- GRN_PTR_PUT(ctx, &tables, object);
- } else {
- grn_obj_unlink(ctx, object);
- }
- } else {
- if (ctx->rc != GRN_SUCCESS) {
- ERRCLR(ctx);
- }
- }
- }
- grn_table_cursor_close(ctx, cur);
- }
-
+ grn_ctx_get_all_tables(ctx, &tables);
n_tables = GRN_BULK_VSIZE(&tables) / sizeof(grn_obj *);
n_top_level_elements = n_elements_for_header + n_tables;
GRN_OUTPUT_ARRAY_OPEN("TABLE_LIST", n_top_level_elements);
@@ -2016,7 +2315,7 @@ proc_table_list(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_dat
GRN_OUTPUT_ARRAY_CLOSE();
for (i = 0; i < n_tables; i++) {
- grn_obj *table = ((grn_obj **)GRN_BULK_HEAD(&tables))[i];
+ grn_obj *table = GRN_PTR_VALUE_AT(&tables, i);
output_table_info(ctx, table);
grn_obj_unlink(ctx, table);
}
@@ -2044,7 +2343,7 @@ proc_missing(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
}
if ((plen = GRN_TEXT_LEN(VAR(0))) + grn_document_root_len < PATH_MAX) {
char path[PATH_MAX];
- memcpy(path, grn_document_root, grn_document_root_len);
+ grn_memcpy(path, grn_document_root, grn_document_root_len);
path[grn_document_root_len] = '/';
grn_str_url_path_normalize(ctx,
GRN_TEXT_VALUE(VAR(0)),
@@ -2081,7 +2380,8 @@ proc_shutdown(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
}
static grn_obj *
-proc_clearlock(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
+proc_lock_clear(grn_ctx *ctx, int nargs, grn_obj **args,
+ grn_user_data *user_data)
{
int target_name_len;
grn_obj *target_name;
@@ -2099,7 +2399,7 @@ proc_clearlock(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data
if (obj) {
grn_obj_clear_lock(ctx, obj);
} else {
- ERR(GRN_INVALID_ARGUMENT, "[clearlock] target object not found: <%.*s>",
+ ERR(GRN_INVALID_ARGUMENT, "[lock_clear] target object not found: <%.*s>",
target_name_len, GRN_TEXT_VALUE(target_name));
}
GRN_OUTPUT_BOOL(!ctx->rc);
@@ -2312,7 +2612,7 @@ proc_delete(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
GRN_EXPR_SYNTAX_SCRIPT);
if (ctx->rc) {
char original_error_message[GRN_CTX_MSGSIZE];
- strcpy(original_error_message, ctx->errbuf);
+ grn_strcpy(original_error_message, GRN_CTX_MSGSIZE, ctx->errbuf);
rc = ctx->rc;
ERR(rc,
"[table][record][delete] failed to parse filter: "
@@ -2348,6 +2648,112 @@ exit :
return NULL;
}
+static const size_t DUMP_FLUSH_THRESHOLD_SIZE = 256 * 1024;
+
+static void
+dump_plugins(grn_ctx *ctx, grn_obj *outbuf)
+{
+ grn_obj *db = ctx->impl->db;
+ grn_table_cursor *cursor;
+ grn_id id;
+ grn_hash *processed_paths;
+ const char *system_plugins_dir;
+ const char *native_plugin_suffix;
+ const char *ruby_plugin_suffix;
+
+ cursor = grn_table_cursor_open(ctx, db, NULL, 0, NULL, 0, 0, -1,
+ GRN_CURSOR_BY_ID);
+ if (!cursor) {
+ return;
+ }
+
+ processed_paths = grn_hash_create(ctx, NULL, GRN_TABLE_MAX_KEY_SIZE, 0,
+ GRN_OBJ_TABLE_HASH_KEY |
+ GRN_OBJ_KEY_VAR_SIZE);
+ if (!processed_paths) {
+ grn_table_cursor_close(ctx, cursor);
+ return;
+ }
+
+ system_plugins_dir = grn_plugin_get_system_plugins_dir();
+ native_plugin_suffix = grn_plugin_get_suffix();
+ ruby_plugin_suffix = grn_plugin_get_ruby_suffix();
+ while ((id = grn_table_cursor_next(ctx, cursor)) != GRN_ID_NIL) {
+ grn_obj *object;
+ const char *path;
+ grn_id processed_path_id;
+
+ object = grn_ctx_at(ctx, id);
+ if (!object) {
+ ERRCLR(ctx);
+ continue;
+ }
+
+ if (!grn_obj_is_proc(ctx, object)) {
+ grn_obj_unlink(ctx, object);
+ continue;
+ }
+
+ if (grn_obj_is_builtin(ctx, object)) {
+ grn_obj_unlink(ctx, object);
+ continue;
+ }
+
+ path = grn_obj_path(ctx, object);
+ if (!path) {
+ grn_obj_unlink(ctx, object);
+ continue;
+ }
+
+ processed_path_id = grn_hash_get(ctx, processed_paths,
+ path, strlen(path),
+ NULL);
+ if (processed_path_id != GRN_ID_NIL) {
+ grn_obj_unlink(ctx, object);
+ continue;
+ }
+
+ grn_hash_add(ctx, processed_paths,
+ path, strlen(path),
+ NULL, NULL);
+
+ {
+ const char *relative_path;
+ const char *libs_path = "/.libs/";
+ const char *start_libs;
+ char name[PATH_MAX];
+
+ name[0] = '\0';
+ if (strncmp(path, system_plugins_dir, strlen(system_plugins_dir)) == 0) {
+ relative_path = path + strlen(system_plugins_dir);
+ } else {
+ relative_path = path;
+ }
+ start_libs = strstr(relative_path, libs_path);
+ if (start_libs) {
+ grn_strncat(name, PATH_MAX, relative_path, start_libs - relative_path);
+ grn_strcat(name, PATH_MAX, "/");
+ grn_strcat(name, PATH_MAX, start_libs + strlen(libs_path));
+ } else {
+ grn_strcat(name, PATH_MAX, relative_path);
+ }
+ if (strlen(name) > strlen(native_plugin_suffix) &&
+ strcmp(name + strlen(name) - strlen(native_plugin_suffix),
+ native_plugin_suffix) == 0) {
+ name[strlen(name) - strlen(native_plugin_suffix)] = '\0';
+ } else if (strlen(name) > strlen(ruby_plugin_suffix) &&
+ strcmp(name + strlen(name) - strlen(ruby_plugin_suffix),
+ ruby_plugin_suffix) == 0) {
+ name[strlen(name) - strlen(ruby_plugin_suffix)] = '\0';
+ }
+ grn_text_printf(ctx, outbuf, "plugin_register %s\n", name);
+ }
+ }
+ grn_table_cursor_close(ctx, cursor);
+
+ grn_hash_close(ctx, processed_paths);
+}
+
static void
dump_name(grn_ctx *ctx, grn_obj *outbuf, const char *name, int name_len)
{
@@ -2476,7 +2882,7 @@ reference_column_p(grn_ctx *ctx, grn_obj *column)
static void
dump_columns(grn_ctx *ctx, grn_obj *outbuf, grn_obj *table,
- grn_obj *pending_columns)
+ grn_obj *pending_reference_columns)
{
grn_hash *columns;
columns = grn_hash_create(ctx, NULL, sizeof(grn_id), 0,
@@ -2492,8 +2898,10 @@ dump_columns(grn_ctx *ctx, grn_obj *outbuf, grn_obj *table,
GRN_HASH_EACH(ctx, columns, id, &key, NULL, NULL, {
grn_obj *column;
if ((column = grn_ctx_at(ctx, *key))) {
- if (reference_column_p(ctx, column)) {
- GRN_PTR_PUT(ctx, pending_columns, column);
+ if (GRN_OBJ_INDEX_COLUMNP(column)) {
+ /* do nothing */
+ } else if (reference_column_p(ctx, column)) {
+ GRN_PTR_PUT(ctx, pending_reference_columns, column);
} else {
dump_column(ctx, outbuf, table, column);
grn_obj_unlink(ctx, column);
@@ -2539,6 +2947,8 @@ dump_records(grn_ctx *ctx, grn_obj *outbuf, grn_obj *table)
grn_table_cursor *cursor;
int i, ncolumns, n_use_columns;
grn_obj columnbuf, delete_commands, use_columns, column_name;
+ grn_bool have_index_column = GRN_FALSE;
+ grn_bool have_data_column = GRN_FALSE;
switch (table->header.type) {
case GRN_TABLE_HASH_KEY:
@@ -2554,12 +2964,6 @@ dump_records(grn_ctx *ctx, grn_obj *outbuf, grn_obj *table)
return;
}
- GRN_TEXT_INIT(&delete_commands, 0);
-
- GRN_TEXT_PUTS(ctx, outbuf, "load --table ");
- dump_obj_name(ctx, outbuf, table);
- GRN_TEXT_PUTS(ctx, outbuf, "\n[\n");
-
GRN_PTR_INIT(&columnbuf, GRN_OBJ_VECTOR, GRN_ID_NIL);
grn_obj_columns(ctx, table, DUMP_COLUMNS, strlen(DUMP_COLUMNS), &columnbuf);
columns = (grn_obj **)GRN_BULK_HEAD(&columnbuf);
@@ -2569,27 +2973,47 @@ dump_records(grn_ctx *ctx, grn_obj *outbuf, grn_obj *table)
GRN_TEXT_INIT(&column_name, 0);
for (i = 0; i < ncolumns; i++) {
if (GRN_OBJ_INDEX_COLUMNP(columns[i])) {
+ have_index_column = GRN_TRUE;
continue;
}
+
+ if (columns[i]->header.type != GRN_ACCESSOR) {
+ have_data_column = GRN_TRUE;
+ }
+
GRN_BULK_REWIND(&column_name);
grn_column_name_(ctx, columns[i], &column_name);
- if (((table->header.type == GRN_TABLE_HASH_KEY ||
- table->header.type == GRN_TABLE_PAT_KEY ||
- table->header.type == GRN_TABLE_DAT_KEY) &&
- GRN_TEXT_LEN(&column_name) == GRN_COLUMN_NAME_ID_LEN &&
- !memcmp(GRN_TEXT_VALUE(&column_name),
- GRN_COLUMN_NAME_ID,
- GRN_COLUMN_NAME_ID_LEN)) ||
- (table->header.type == GRN_TABLE_NO_KEY &&
- GRN_TEXT_LEN(&column_name) == GRN_COLUMN_NAME_KEY_LEN &&
- !memcmp(GRN_TEXT_VALUE(&column_name),
- GRN_COLUMN_NAME_KEY,
- GRN_COLUMN_NAME_KEY_LEN))) {
+ if (table->header.type != GRN_TABLE_NO_KEY &&
+ GRN_TEXT_LEN(&column_name) == GRN_COLUMN_NAME_ID_LEN &&
+ memcmp(GRN_TEXT_VALUE(&column_name),
+ GRN_COLUMN_NAME_ID,
+ GRN_COLUMN_NAME_ID_LEN) == 0) {
continue;
}
+
+ if (table->header.type == GRN_TABLE_NO_KEY &&
+ GRN_TEXT_LEN(&column_name) == GRN_COLUMN_NAME_KEY_LEN &&
+ memcmp(GRN_TEXT_VALUE(&column_name),
+ GRN_COLUMN_NAME_KEY,
+ GRN_COLUMN_NAME_KEY_LEN) == 0) {
+ continue;
+ }
+
GRN_PTR_PUT(ctx, &use_columns, columns[i]);
}
+ if (have_index_column && !have_data_column) {
+ goto exit;
+ }
+
+ if (GRN_TEXT_LEN(outbuf) > 0) {
+ GRN_TEXT_PUTC(ctx, outbuf, '\n');
+ }
+
+ GRN_TEXT_PUTS(ctx, outbuf, "load --table ");
+ dump_obj_name(ctx, outbuf, table);
+ GRN_TEXT_PUTS(ctx, outbuf, "\n[\n");
+
n_use_columns = GRN_BULK_VSIZE(&use_columns) / sizeof(grn_obj *);
GRN_TEXT_PUTC(ctx, outbuf, '[');
for (i = 0; i < n_use_columns; i++) {
@@ -2602,6 +3026,7 @@ dump_records(grn_ctx *ctx, grn_obj *outbuf, grn_obj *table)
}
GRN_TEXT_PUTS(ctx, outbuf, "],\n");
+ GRN_TEXT_INIT(&delete_commands, 0);
cursor = grn_table_cursor_open(ctx, table, NULL, 0, NULL, 0, 0, -1,
GRN_CURSOR_BY_KEY);
for (i = 0; (id = grn_table_cursor_next(ctx, cursor)) != GRN_ID_NIL;
@@ -2685,15 +3110,20 @@ dump_records(grn_ctx *ctx, grn_obj *outbuf, grn_obj *table)
}
}
GRN_TEXT_PUTC(ctx, outbuf, ']');
+ if (GRN_TEXT_LEN(outbuf) >= DUMP_FLUSH_THRESHOLD_SIZE) {
+ grn_ctx_output_flush(ctx, 0);
+ }
}
+ grn_table_cursor_close(ctx, cursor);
GRN_TEXT_PUTS(ctx, outbuf, "\n]\n");
GRN_TEXT_PUT(ctx, outbuf, GRN_TEXT_VALUE(&delete_commands),
GRN_TEXT_LEN(&delete_commands));
grn_obj_unlink(ctx, &delete_commands);
+
+exit :
grn_obj_unlink(ctx, &column_name);
grn_obj_unlink(ctx, &use_columns);
- grn_table_cursor_close(ctx, cursor);
for (i = 0; i < ncolumns; i++) {
grn_obj_unlink(ctx, columns[i]);
}
@@ -2702,7 +3132,7 @@ dump_records(grn_ctx *ctx, grn_obj *outbuf, grn_obj *table)
static void
dump_table(grn_ctx *ctx, grn_obj *outbuf, grn_obj *table,
- grn_obj *pending_columns)
+ grn_obj *pending_reference_columns)
{
grn_obj *domain = NULL, *range = NULL;
grn_obj_flags default_flags = GRN_OBJ_PERSISTENT;
@@ -2720,6 +3150,11 @@ dump_table(grn_ctx *ctx, grn_obj *outbuf, grn_obj *table,
break;
}
+ if (GRN_TEXT_LEN(outbuf) > 0) {
+ GRN_TEXT_PUTC(ctx, outbuf, '\n');
+ grn_ctx_output_flush(ctx, 0);
+ }
+
GRN_TEXT_PUTS(ctx, outbuf, "table_create ");
dump_obj_name(ctx, outbuf, table);
GRN_TEXT_PUTC(ctx, outbuf, ' ');
@@ -2783,68 +3218,77 @@ dump_table(grn_ctx *ctx, grn_obj *outbuf, grn_obj *table,
grn_obj_unlink(ctx, domain);
}
- dump_columns(ctx, outbuf, table, pending_columns);
+ dump_columns(ctx, outbuf, table, pending_reference_columns);
}
-/* can we move this to groonga.h? */
-#define GRN_PTR_POP(obj,value) do {\
- if (GRN_BULK_VSIZE(obj) >= sizeof(grn_obj *)) {\
- GRN_BULK_INCR_LEN((obj), -(sizeof(grn_obj *)));\
- value = *(grn_obj **)(GRN_BULK_CURR(obj));\
- } else {\
- value = NULL;\
- }\
-} while (0)
+static void
+dump_pending_columns(grn_ctx *ctx, grn_obj *outbuf, grn_obj *pending_columns)
+{
+ size_t i, n_columns;
+
+ n_columns = GRN_BULK_VSIZE(pending_columns) / sizeof(grn_obj *);
+ if (n_columns == 0) {
+ return;
+ }
+
+ if (GRN_TEXT_LEN(outbuf) > 0) {
+ GRN_TEXT_PUTC(ctx, outbuf, '\n');
+ grn_ctx_output_flush(ctx, 0);
+ }
+
+ for (i = 0; i < n_columns; i++) {
+ grn_obj *table, *column;
+
+ column = GRN_PTR_VALUE_AT(pending_columns, i);
+ table = grn_ctx_at(ctx, column->header.domain);
+ dump_column(ctx, outbuf, table, column);
+ grn_obj_unlink(ctx, column);
+ grn_obj_unlink(ctx, table);
+ }
+}
static void
dump_schema(grn_ctx *ctx, grn_obj *outbuf)
{
grn_obj *db = ctx->impl->db;
grn_table_cursor *cur;
- if ((cur = grn_table_cursor_open(ctx, db, NULL, 0, NULL, 0, 0, -1,
- GRN_CURSOR_BY_ID))) {
- grn_id id;
- grn_obj pending_columns;
+ grn_id id;
+ grn_obj pending_reference_columns;
- GRN_PTR_INIT(&pending_columns, GRN_OBJ_VECTOR, GRN_ID_NIL);
- while ((id = grn_table_cursor_next(ctx, cur)) != GRN_ID_NIL) {
- grn_obj *object;
-
- if ((object = grn_ctx_at(ctx, id))) {
- switch (object->header.type) {
- case GRN_TABLE_HASH_KEY:
- case GRN_TABLE_PAT_KEY:
- case GRN_TABLE_DAT_KEY:
- case GRN_TABLE_NO_KEY:
- dump_table(ctx, outbuf, object, &pending_columns);
- break;
- default:
- break;
- }
- grn_obj_unlink(ctx, object);
- } else {
- /* XXX: this clause is executed when MeCab tokenizer is enabled in
- database but the groonga isn't supported MeCab.
- We should return error mesage about it and error exit status
- but it's too difficult for this architecture. :< */
- ERRCLR(ctx);
- }
- }
- grn_table_cursor_close(ctx, cur);
+ cur = grn_table_cursor_open(ctx, db, NULL, 0, NULL, 0, 0, -1,
+ GRN_CURSOR_BY_ID);
+ if (!cur) {
+ return;
+ }
- while (GRN_TRUE) {
- grn_obj *table, *column;
- GRN_PTR_POP(&pending_columns, column);
- if (!column) {
+ GRN_PTR_INIT(&pending_reference_columns, GRN_OBJ_VECTOR, GRN_ID_NIL);
+ while ((id = grn_table_cursor_next(ctx, cur)) != GRN_ID_NIL) {
+ grn_obj *object;
+
+ if ((object = grn_ctx_at(ctx, id))) {
+ switch (object->header.type) {
+ case GRN_TABLE_HASH_KEY:
+ case GRN_TABLE_PAT_KEY:
+ case GRN_TABLE_DAT_KEY:
+ case GRN_TABLE_NO_KEY:
+ dump_table(ctx, outbuf, object, &pending_reference_columns);
+ break;
+ default:
break;
}
- table = grn_ctx_at(ctx, column->header.domain);
- dump_column(ctx, outbuf, table, column);
- grn_obj_unlink(ctx, column);
- grn_obj_unlink(ctx, table);
+ grn_obj_unlink(ctx, object);
+ } else {
+ /* XXX: this clause is executed when MeCab tokenizer is enabled in
+ database but the groonga isn't supported MeCab.
+ We should return error mesage about it and error exit status
+ but it's too difficult for this architecture. :< */
+ ERRCLR(ctx);
}
- grn_obj_close(ctx, &pending_columns);
}
+ grn_table_cursor_close(ctx, cur);
+
+ dump_pending_columns(ctx, outbuf, &pending_reference_columns);
+ grn_obj_close(ctx, &pending_reference_columns);
}
static void
@@ -2929,23 +3373,117 @@ dump_all_records(grn_ctx *ctx, grn_obj *outbuf)
}
}
+static void
+dump_indexes(grn_ctx *ctx, grn_obj *outbuf)
+{
+ grn_obj *db = ctx->impl->db;
+ grn_table_cursor *cursor;
+ grn_id id;
+ grn_bool is_first_index_column = GRN_TRUE;
+
+ cursor = grn_table_cursor_open(ctx, db, NULL, 0, NULL, 0, 0, -1,
+ GRN_CURSOR_BY_ID);
+ if (!cursor) {
+ return;
+ }
+
+ while ((id = grn_table_cursor_next(ctx, cursor)) != GRN_ID_NIL) {
+ grn_obj *object;
+
+ object = grn_ctx_at(ctx, id);
+ if (!object) {
+ /* XXX: this clause is executed when MeCab tokenizer is enabled in
+ database but the groonga isn't supported MeCab.
+ We should return error mesage about it and error exit status
+ but it's too difficult for this architecture. :< */
+ ERRCLR(ctx);
+ continue;
+ }
+
+ if (object->header.type == GRN_COLUMN_INDEX) {
+ grn_obj *table;
+ grn_obj *column = object;
+
+ if (is_first_index_column && GRN_TEXT_LEN(outbuf) > 0) {
+ GRN_TEXT_PUTC(ctx, outbuf, '\n');
+ }
+ is_first_index_column = GRN_FALSE;
+
+ table = grn_ctx_at(ctx, column->header.domain);
+ dump_column(ctx, outbuf, table, column);
+ grn_obj_unlink(ctx, table);
+ }
+ grn_obj_unlink(ctx, object);
+ }
+ grn_table_cursor_close(ctx, cursor);
+}
+
+static grn_bool
+bool_option_value(grn_obj *option, grn_bool default_value)
+{
+ const char *value;
+ size_t value_length;
+
+ value = GRN_TEXT_VALUE(option);
+ value_length = GRN_TEXT_LEN(option);
+
+ if (value_length == 0) {
+ return default_value;
+ }
+
+ if (value_length == strlen("yes") &&
+ strncmp(value, "yes", value_length) == 0) {
+ return GRN_TRUE;
+ } else if (value_length == strlen("no") &&
+ strncmp(value, "no", value_length) == 0) {
+ return GRN_FALSE;
+ } else {
+ return default_value;
+ }
+}
+
static grn_obj *
proc_dump(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
{
grn_obj *outbuf = ctx->impl->outbuf;
- ctx->impl->output_type = GRN_CONTENT_NONE;
- ctx->impl->mime_type = "text/x-groonga-command-list";
- dump_schema(ctx, outbuf);
- /* To update index columns correctly, we first create the whole schema, then
- load non-derivative records, while skipping records of index columns. That
- way, groonga will silently do the job of updating index columns for us. */
- if (GRN_TEXT_LEN(VAR(0)) > 0) {
- dump_selected_tables_records(ctx, outbuf, VAR(0));
- } else {
- dump_all_records(ctx, outbuf);
+ grn_obj *tables = VAR(0);
+ grn_obj *dump_plugins_raw = VAR(1);
+ grn_obj *dump_schema_raw = VAR(2);
+ grn_obj *dump_records_raw = VAR(3);
+ grn_obj *dump_indexes_raw = VAR(4);
+ grn_bool is_dump_plugins;
+ grn_bool is_dump_schema;
+ grn_bool is_dump_records;
+ grn_bool is_dump_indexes;
+
+ grn_ctx_set_output_type(ctx, GRN_CONTENT_GROONGA_COMMAND_LIST);
+
+ is_dump_plugins = bool_option_value(dump_plugins_raw, GRN_TRUE);
+ is_dump_schema = bool_option_value(dump_schema_raw, GRN_TRUE);
+ is_dump_records = bool_option_value(dump_records_raw, GRN_TRUE);
+ is_dump_indexes = bool_option_value(dump_indexes_raw, GRN_TRUE);
+
+ if (is_dump_plugins) {
+ dump_plugins(ctx, outbuf);
+ }
+ if (is_dump_schema) {
+ dump_schema(ctx, outbuf);
+ }
+ if (is_dump_records) {
+ /* To update index columns correctly, we first create the whole schema, then
+ load non-derivative records, while skipping records of index columns. That
+ way, groonga will silently do the job of updating index columns for us. */
+ if (GRN_TEXT_LEN(tables) > 0) {
+ dump_selected_tables_records(ctx, outbuf, tables);
+ } else {
+ dump_all_records(ctx, outbuf);
+ }
+ }
+ if (is_dump_indexes) {
+ dump_indexes(ctx, outbuf);
}
- /* remove the last newline because another one will be added by the calller.
+ /* remove the last newline because another one will be added by the caller.
maybe, the caller of proc functions currently doesn't consider the
possibility of multiple-line output from proc functions. */
if (GRN_BULK_VSIZE(outbuf) > 0) {
@@ -3106,37 +3644,56 @@ proc_check(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
static grn_obj *
proc_truncate(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
{
- int table_name_len = GRN_TEXT_LEN(VAR(0));
- if (table_name_len == 0) {
- ERR(GRN_INVALID_ARGUMENT, "table name is missing");
+ const char *target_name;
+ int target_name_len;
+
+ target_name_len = GRN_TEXT_LEN(VAR(0));
+ if (target_name_len > 0) {
+ target_name = GRN_TEXT_VALUE(VAR(0));
} else {
- const char *table_name = GRN_TEXT_VALUE(VAR(0));
- grn_obj *table = grn_ctx_get(ctx, table_name, table_name_len);
- if (!table) {
+ target_name_len = GRN_TEXT_LEN(VAR(1));
+ if (target_name_len == 0) {
+ ERR(GRN_INVALID_ARGUMENT, "[truncate] table name is missing");
+ goto exit;
+ }
+ target_name = GRN_TEXT_VALUE(VAR(1));
+ }
+
+ {
+ grn_obj *target = grn_ctx_get(ctx, target_name, target_name_len);
+ if (!target) {
ERR(GRN_INVALID_ARGUMENT,
- "no such table: <%.*s>", table_name_len, table_name);
- } else {
- switch (table->header.type) {
- case GRN_TABLE_HASH_KEY :
- case GRN_TABLE_PAT_KEY :
- case GRN_TABLE_DAT_KEY :
- case GRN_TABLE_NO_KEY :
- grn_table_truncate(ctx, table);
- break;
- default:
- {
- grn_obj buffer;
- GRN_TEXT_INIT(&buffer, 0);
- grn_inspect(ctx, &buffer, table);
- ERR(GRN_INVALID_ARGUMENT,
- "not a table object: %.*s",
- (int)GRN_TEXT_LEN(&buffer), GRN_TEXT_VALUE(&buffer));
- GRN_OBJ_FIN(ctx, &buffer);
- }
- break;
+ "[truncate] no such target: <%.*s>", target_name_len, target_name);
+ goto exit;
+ }
+
+ switch (target->header.type) {
+ case GRN_TABLE_HASH_KEY :
+ case GRN_TABLE_PAT_KEY :
+ case GRN_TABLE_DAT_KEY :
+ case GRN_TABLE_NO_KEY :
+ grn_table_truncate(ctx, target);
+ break;
+ case GRN_COLUMN_FIX_SIZE :
+ case GRN_COLUMN_VAR_SIZE :
+ case GRN_COLUMN_INDEX :
+ grn_column_truncate(ctx, target);
+ break;
+ default:
+ {
+ grn_obj buffer;
+ GRN_TEXT_INIT(&buffer, 0);
+ grn_inspect(ctx, &buffer, target);
+ ERR(GRN_INVALID_ARGUMENT,
+ "[truncate] not a table nor column object: <%.*s>",
+ (int)GRN_TEXT_LEN(&buffer), GRN_TEXT_VALUE(&buffer));
+ GRN_OBJ_FIN(ctx, &buffer);
}
+ break;
}
}
+
+exit :
GRN_OUTPUT_BOOL(!ctx->rc);
return NULL;
}
@@ -3161,7 +3718,7 @@ parse_normalize_flags(grn_ctx *ctx, grn_obj *flag_names)
if (((names_end - names) >= (sizeof(#name) - 1)) &&\
(!memcmp(names, #name, sizeof(#name) - 1))) {\
flags |= GRN_STRING_ ## name;\
- names += sizeof(#name);\
+ names += sizeof(#name) - 1;\
continue;\
}
@@ -3373,16 +3930,16 @@ parse_tokenize_flags(grn_ctx *ctx, grn_obj *flag_names)
#define CHECK_FLAG(name)\
if (((names_end - names) >= (sizeof(#name) - 1)) &&\
(!memcmp(names, #name, sizeof(#name) - 1))) {\
- flags |= GRN_TOKEN_ ## name;\
- names += sizeof(#name);\
+ flags |= GRN_TOKEN_CURSOR_ ## name;\
+ names += sizeof(#name) - 1;\
continue;\
}
CHECK_FLAG(ENABLE_TOKENIZED_DELIMITER);
-#define GRN_TOKEN_NONE 0
+#define GRN_TOKEN_CURSOR_NONE 0
CHECK_FLAG(NONE);
-#undef GRN_TOKEN_NONE
+#undef GRN_TOKEN_CURSOR_NONE
ERR(GRN_INVALID_ARGUMENT, "[tokenize] invalid flag: <%.*s>",
(int)(names_end - names), names);
@@ -3399,7 +3956,7 @@ typedef struct {
} tokenize_token;
static void
-output_tokens(grn_ctx *ctx, grn_obj *tokens, grn_hash *lexicon)
+output_tokens(grn_ctx *ctx, grn_obj *tokens, grn_obj *lexicon)
{
int i, n_tokens;
@@ -3415,8 +3972,8 @@ output_tokens(grn_ctx *ctx, grn_obj *tokens, grn_hash *lexicon)
GRN_OUTPUT_MAP_OPEN("TOKEN", 2);
GRN_OUTPUT_CSTR("value");
- value_size = grn_hash_get_key(ctx, lexicon, token->id,
- value, GRN_TABLE_MAX_KEY_SIZE);
+ value_size = grn_table_get_key(ctx, lexicon, token->id,
+ value, GRN_TABLE_MAX_KEY_SIZE);
GRN_OUTPUT_STR(value, value_size);
GRN_OUTPUT_CSTR("position");
@@ -3427,12 +3984,13 @@ output_tokens(grn_ctx *ctx, grn_obj *tokens, grn_hash *lexicon)
GRN_OUTPUT_ARRAY_CLOSE();
}
-static grn_hash *
+static grn_obj *
create_lexicon_for_tokenize(grn_ctx *ctx,
grn_obj *tokenizer_name,
- grn_obj *normalizer_name)
+ grn_obj *normalizer_name,
+ grn_obj *token_filter_names)
{
- grn_hash *lexicon;
+ grn_obj *lexicon;
grn_obj *tokenizer;
grn_obj *normalizer = NULL;
@@ -3488,35 +4046,39 @@ create_lexicon_for_tokenize(grn_ctx *ctx,
}
}
- lexicon = grn_hash_create(ctx, NULL, GRN_TABLE_MAX_KEY_SIZE, 0,
- GRN_OBJ_TABLE_HASH_KEY | GRN_OBJ_KEY_VAR_SIZE);
- grn_obj_set_info(ctx, (grn_obj *)lexicon,
+ lexicon = grn_table_create(ctx, NULL, 0,
+ NULL,
+ GRN_OBJ_TABLE_HASH_KEY,
+ grn_ctx_at(ctx, GRN_DB_SHORT_TEXT),
+ NULL);
+ grn_obj_set_info(ctx, lexicon,
GRN_INFO_DEFAULT_TOKENIZER, tokenizer);
grn_obj_unlink(ctx, tokenizer);
if (normalizer) {
- grn_obj_set_info(ctx, (grn_obj *)lexicon,
+ grn_obj_set_info(ctx, lexicon,
GRN_INFO_NORMALIZER, normalizer);
grn_obj_unlink(ctx, normalizer);
}
+ proc_table_create_set_token_filters(ctx, lexicon, token_filter_names);
return lexicon;
}
static void
-tokenize(grn_ctx *ctx, grn_hash *lexicon, grn_obj *string, grn_token_mode mode,
+tokenize(grn_ctx *ctx, grn_obj *lexicon, grn_obj *string, grn_tokenize_mode mode,
unsigned int flags, grn_obj *tokens)
{
grn_token_cursor *token_cursor;
token_cursor =
- grn_token_cursor_open(ctx, (grn_obj *)lexicon,
+ grn_token_cursor_open(ctx, lexicon,
GRN_TEXT_VALUE(string), GRN_TEXT_LEN(string),
mode, flags);
if (!token_cursor) {
return;
}
- while (token_cursor->status == GRN_TOKEN_DOING) {
+ while (token_cursor->status == GRN_TOKEN_CURSOR_DOING) {
grn_id token_id = grn_token_cursor_next(ctx, token_cursor);
tokenize_token *current_token;
if (token_id == GRN_ID_NIL) {
@@ -3538,12 +4100,14 @@ proc_tokenize(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
grn_obj *normalizer_name;
grn_obj *flag_names;
grn_obj *mode_name;
+ grn_obj *token_filter_names;
tokenizer_name = VAR(0);
string = VAR(1);
normalizer_name = VAR(2);
flag_names = VAR(3);
mode_name = VAR(4);
+ token_filter_names = VAR(5);
if (GRN_TEXT_LEN(tokenizer_name) == 0) {
ERR(GRN_INVALID_ARGUMENT, "[tokenize] tokenizer name is missing");
@@ -3557,14 +4121,17 @@ proc_tokenize(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
{
unsigned int flags;
- grn_hash *lexicon;
+ grn_obj *lexicon;
flags = parse_tokenize_flags(ctx, flag_names);
if (ctx->rc != GRN_SUCCESS) {
return NULL;
}
- lexicon = create_lexicon_for_tokenize(ctx, tokenizer_name, normalizer_name);
+ lexicon = create_lexicon_for_tokenize(ctx,
+ tokenizer_name,
+ normalizer_name,
+ token_filter_names);
if (!lexicon) {
return NULL;
}
@@ -3573,41 +4140,91 @@ proc_tokenize(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
(GRN_TEXT_LEN(mode_name) == strlen(name) &&\
memcmp(GRN_TEXT_VALUE(mode_name), name, strlen(name)) == 0)
- if (GRN_TEXT_LEN(mode_name) == 0 || MODE_NAME_EQUAL("ADD")) {
+ {
grn_obj tokens;
GRN_VALUE_FIX_SIZE_INIT(&tokens, GRN_OBJ_VECTOR, GRN_ID_NIL);
- tokenize(ctx, lexicon, string, GRN_TOKEN_ADD, flags, &tokens);
- output_tokens(ctx, &tokens, lexicon);
- GRN_OBJ_FIN(ctx, &tokens);
- } else if (MODE_NAME_EQUAL("GET")) {
- {
- grn_token_cursor *token_cursor;
- token_cursor =
- grn_token_cursor_open(ctx, (grn_obj *)lexicon,
- GRN_TEXT_VALUE(string), GRN_TEXT_LEN(string),
- GRN_TOKEN_ADD, flags);
- if (token_cursor) {
- while (token_cursor->status == GRN_TOKEN_DOING) {
- grn_token_cursor_next(ctx, token_cursor);
- }
- grn_token_cursor_close(ctx, token_cursor);
- }
- }
-
- {
- grn_obj tokens;
- GRN_VALUE_FIX_SIZE_INIT(&tokens, GRN_OBJ_VECTOR, GRN_ID_NIL);
+ if (GRN_TEXT_LEN(mode_name) == 0 || MODE_NAME_EQUAL("ADD")) {
+ tokenize(ctx, lexicon, string, GRN_TOKEN_ADD, flags, &tokens);
+ output_tokens(ctx, &tokens, lexicon);
+ } else if (MODE_NAME_EQUAL("GET")) {
+ tokenize(ctx, lexicon, string, GRN_TOKEN_ADD, flags, &tokens);
+ GRN_BULK_REWIND(&tokens);
tokenize(ctx, lexicon, string, GRN_TOKEN_GET, flags, &tokens);
output_tokens(ctx, &tokens, lexicon);
- GRN_OBJ_FIN(ctx, &tokens);
+ } else {
+ ERR(GRN_INVALID_ARGUMENT, "[tokenize] invalid mode: <%.*s>",
+ (int)GRN_TEXT_LEN(mode_name), GRN_TEXT_VALUE(mode_name));
}
+ GRN_OBJ_FIN(ctx, &tokens);
+ }
+#undef MODE_NAME_EQUAL
+
+ grn_obj_unlink(ctx, lexicon);
+ }
+
+ return NULL;
+}
+
+static grn_obj *
+proc_table_tokenize(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
+{
+ grn_obj *table_name;
+ grn_obj *string;
+ grn_obj *flag_names;
+ grn_obj *mode_name;
+
+ table_name = VAR(0);
+ string = VAR(1);
+ flag_names = VAR(2);
+ mode_name = VAR(3);
+
+ if (GRN_TEXT_LEN(table_name) == 0) {
+ ERR(GRN_INVALID_ARGUMENT, "[table_tokenize] table name is missing");
+ return NULL;
+ }
+
+ if (GRN_TEXT_LEN(string) == 0) {
+ ERR(GRN_INVALID_ARGUMENT, "[table_tokenize] string is missing");
+ return NULL;
+ }
+
+ {
+ unsigned int flags;
+ grn_obj *lexicon;
+
+ flags = parse_tokenize_flags(ctx, flag_names);
+ if (ctx->rc != GRN_SUCCESS) {
+ return NULL;
+ }
+
+ lexicon = grn_ctx_get(ctx, GRN_TEXT_VALUE(table_name), GRN_TEXT_LEN(table_name));
+
+ if (!lexicon) {
+ return NULL;
+ }
+
+#define MODE_NAME_EQUAL(name)\
+ (GRN_TEXT_LEN(mode_name) == strlen(name) &&\
+ memcmp(GRN_TEXT_VALUE(mode_name), name, strlen(name)) == 0)
+
+ {
+ grn_obj tokens;
+ GRN_VALUE_FIX_SIZE_INIT(&tokens, GRN_OBJ_VECTOR, GRN_ID_NIL);
+ if (GRN_TEXT_LEN(mode_name) == 0 || MODE_NAME_EQUAL("GET")) {
+ tokenize(ctx, lexicon, string, GRN_TOKEN_GET, flags, &tokens);
+ output_tokens(ctx, &tokens, lexicon);
+ } else if (MODE_NAME_EQUAL("ADD")) {
+ tokenize(ctx, lexicon, string, GRN_TOKEN_ADD, flags, &tokens);
+ output_tokens(ctx, &tokens, lexicon);
} else {
- ERR(GRN_INVALID_ARGUMENT, "[tokenize] invalid mode: <%.*s>",
+ ERR(GRN_INVALID_ARGUMENT, "[table_tokenize] invalid mode: <%.*s>",
(int)GRN_TEXT_LEN(mode_name), GRN_TEXT_VALUE(mode_name));
}
+ GRN_OBJ_FIN(ctx, &tokens);
+ }
#undef MODE_NAME_EQUAL
- grn_hash_close(ctx, lexicon);
+ grn_obj_unlink(ctx, lexicon);
}
return NULL;
@@ -4173,19 +4790,14 @@ selector_all_records(grn_ctx *ctx, grn_obj *table, grn_obj *index,
int nargs, grn_obj **args,
grn_obj *res, grn_operator op)
{
- grn_obj score;
-
- GRN_UINT32_INIT(&score, 0);
- GRN_UINT32_SET(ctx, &score, 1);
+ grn_ii_posting posting;
+ memset(&posting, 0, sizeof(grn_ii_posting));
GRN_TABLE_EACH(ctx, table, 0, 0, id, NULL, NULL, NULL, {
- grn_id result_id;
- result_id = grn_table_add(ctx, res, &id, sizeof(grn_id), NULL);
- grn_obj_set_value(ctx, res, result_id, &score, GRN_OBJ_SET);
+ posting.rid = id;
+ grn_ii_posting_add(ctx, &posting, (grn_hash *)res, GRN_OP_OR);
});
- GRN_OBJ_FIN(ctx, &score);
-
return ctx->rc;
}
@@ -4460,7 +5072,7 @@ run_query(grn_ctx *ctx, grn_obj *table,
rc = ctx->rc;
}
-exit:
+exit :
if (match_columns) {
grn_obj_unlink(ctx, match_columns);
}
@@ -4590,7 +5202,7 @@ run_sub_filter(grn_ctx *ctx, grn_obj *table,
grn_obj_unlink(ctx, base_res);
}
-exit:
+exit :
if (scope_domain) {
grn_obj_unlink(ctx, scope_domain);
}
@@ -4719,11 +5331,27 @@ typedef enum {
typedef struct {
grn_obj *value;
grn_obj *min;
+ grn_obj casted_min;
between_border_type min_border_type;
grn_obj *max;
+ grn_obj casted_max;
between_border_type max_border_type;
} between_data;
+static void
+between_data_init(grn_ctx *ctx, between_data *data)
+{
+ GRN_VOID_INIT(&(data->casted_min));
+ GRN_VOID_INIT(&(data->casted_max));
+}
+
+static void
+between_data_fin(grn_ctx *ctx, between_data *data)
+{
+ GRN_OBJ_FIN(ctx, &(data->casted_min));
+ GRN_OBJ_FIN(ctx, &(data->casted_max));
+}
+
static between_border_type
between_parse_border(grn_ctx *ctx, grn_obj *border,
const char *argument_description)
@@ -4752,6 +5380,41 @@ between_parse_border(grn_ctx *ctx, grn_obj *border,
}
static grn_rc
+between_cast(grn_ctx *ctx, grn_obj *source, grn_obj *destination, grn_id domain,
+ const char *target_argument_name)
+{
+ grn_rc rc;
+
+ GRN_OBJ_INIT(destination, GRN_BULK, 0, domain);
+ rc = grn_obj_cast(ctx, source, destination, GRN_FALSE);
+ if (rc != GRN_SUCCESS) {
+ grn_obj inspected_source;
+ grn_obj *domain_object;
+ char domain_name[GRN_TABLE_MAX_KEY_SIZE];
+ int domain_name_length;
+
+ GRN_TEXT_INIT(&inspected_source, 0);
+ grn_inspect(ctx, &inspected_source, source);
+
+ domain_object = grn_ctx_at(ctx, domain);
+ domain_name_length =
+ grn_obj_name(ctx, domain_object, domain_name, GRN_TABLE_MAX_KEY_SIZE);
+
+ ERR(rc, "between(): failed to cast %s: <%.*s> -> <%.*s>",
+ target_argument_name,
+ (int)GRN_TEXT_LEN(&inspected_source),
+ GRN_TEXT_VALUE(&inspected_source),
+ domain_name_length,
+ domain_name);
+
+ grn_obj_unlink(ctx, &inspected_source);
+ grn_obj_unlink(ctx, domain_object);
+ }
+
+ return rc;
+}
+
+static grn_rc
between_parse_args(grn_ctx *ctx, int nargs, grn_obj **args, between_data *data)
{
grn_rc rc = GRN_SUCCESS;
@@ -4785,43 +5448,70 @@ between_parse_args(grn_ctx *ctx, int nargs, grn_obj **args, between_data *data)
goto exit;
}
+ {
+ grn_id value_type;
+ if (data->value->header.type == GRN_BULK) {
+ value_type = data->value->header.domain;
+ } else {
+ value_type = grn_obj_get_range(ctx, data->value);
+ }
+ if (value_type != data->min->header.domain) {
+ rc = between_cast(ctx, data->min, &data->casted_min, value_type, "min");
+ if (rc != GRN_SUCCESS) {
+ goto exit;
+ }
+ data->min = &(data->casted_min);
+ }
+
+ if (value_type != data->max->header.domain) {
+ rc = between_cast(ctx, data->max, &data->casted_max, value_type, "max");
+ if (rc != GRN_SUCCESS) {
+ goto exit;
+ }
+ data->max = &(data->casted_max);
+ }
+ }
+
exit :
return rc;
}
-static grn_rc
-between_cast(grn_ctx *ctx, grn_obj *source, grn_obj *destination, grn_id domain,
- const char *target_argument_name)
+static grn_bool
+between_create_expr(grn_ctx *ctx, grn_obj *table, between_data *data,
+ grn_obj **expr, grn_obj **variable)
{
- grn_rc rc;
-
- GRN_OBJ_INIT(destination, GRN_BULK, 0, domain);
- rc = grn_obj_cast(ctx, source, destination, GRN_FALSE);
- if (rc != GRN_SUCCESS) {
- grn_obj inspected_source;
- grn_obj *domain_object;
- char domain_name[GRN_TABLE_MAX_KEY_SIZE];
- int domain_name_length;
-
- GRN_TEXT_INIT(&inspected_source, 0);
- grn_inspect(ctx, &inspected_source, source);
-
- domain_object = grn_ctx_at(ctx, domain);
- domain_name_length =
- grn_obj_name(ctx, domain_object, domain_name, GRN_TABLE_MAX_KEY_SIZE);
+ GRN_EXPR_CREATE_FOR_QUERY(ctx, table, *expr, *variable);
+ if (!*expr) {
+ return GRN_FALSE;
+ }
- ERR(rc, "between(): failed to cast %s: <%.*s> -> <%.*s>",
- target_argument_name,
- (int)GRN_TEXT_LEN(&inspected_source),
- GRN_TEXT_VALUE(&inspected_source),
- domain_name_length,
- domain_name);
+ if (data->value->header.type == GRN_BULK) {
+ grn_expr_append_obj(ctx, *expr, data->value, GRN_OP_PUSH, 1);
+ } else {
+ grn_expr_append_obj(ctx, *expr, data->value, GRN_OP_GET_VALUE, 1);
+ }
+ grn_expr_append_obj(ctx, *expr, data->min, GRN_OP_PUSH, 1);
+ if (data->min_border_type == BETWEEN_BORDER_INCLUDE) {
+ grn_expr_append_op(ctx, *expr, GRN_OP_GREATER_EQUAL, 2);
+ } else {
+ grn_expr_append_op(ctx, *expr, GRN_OP_GREATER, 2);
+ }
- grn_obj_unlink(ctx, &inspected_source);
- grn_obj_unlink(ctx, domain_object);
+ if (data->value->header.type == GRN_BULK) {
+ grn_expr_append_obj(ctx, *expr, data->value, GRN_OP_PUSH, 1);
+ } else {
+ grn_expr_append_obj(ctx, *expr, data->value, GRN_OP_GET_VALUE, 1);
+ }
+ grn_expr_append_obj(ctx, *expr, data->max, GRN_OP_PUSH, 1);
+ if (data->max_border_type == BETWEEN_BORDER_INCLUDE) {
+ grn_expr_append_op(ctx, *expr, GRN_OP_LESS_EQUAL, 2);
+ } else {
+ grn_expr_append_op(ctx, *expr, GRN_OP_LESS, 2);
}
- return rc;
+ grn_expr_append_op(ctx, *expr, GRN_OP_AND, 2);
+
+ return GRN_TRUE;
}
static grn_obj *
@@ -4832,7 +5522,7 @@ func_between(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
between_data data;
grn_obj *condition = NULL;
grn_obj *variable;
- grn_obj *table;
+ grn_obj *table = NULL;
grn_obj *between_expr;
grn_obj *between_variable;
grn_obj *result;
@@ -4853,49 +5543,248 @@ func_between(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
return found;
}
+ between_data_init(ctx, &data);
rc = between_parse_args(ctx, nargs, args, &data);
if (rc != GRN_SUCCESS) {
- return found;
+ goto exit;
}
table = grn_ctx_at(ctx, variable->header.domain);
if (!table) {
- return found;
+ goto exit;
+ }
+ if (!between_create_expr(ctx, table, &data, &between_expr, &between_variable)) {
+ goto exit;
+ }
+
+ GRN_RECORD_SET(ctx, between_variable, GRN_RECORD_VALUE(variable));
+ result = grn_expr_exec(ctx, between_expr, 0);
+ if (result) {
+ grn_bool result_boolean;
+ GRN_TRUEP(ctx, result, result_boolean);
+ if (result_boolean) {
+ GRN_BOOL_SET(ctx, found, GRN_TRUE);
+ }
}
- GRN_EXPR_CREATE_FOR_QUERY(ctx, table, between_expr, between_variable);
- if (!between_expr) {
+
+ grn_obj_unlink(ctx, between_expr);
+ grn_obj_unlink(ctx, table);
+
+exit :
+ between_data_fin(ctx, &data);
+ if (table) {
grn_obj_unlink(ctx, table);
- return found;
}
- grn_expr_append_obj(ctx, between_expr, data.value, GRN_OP_PUSH, 1);
- grn_expr_append_obj(ctx, between_expr, data.min, GRN_OP_PUSH, 1);
- if (data.min_border_type == BETWEEN_BORDER_INCLUDE) {
- grn_expr_append_op(ctx, between_expr, GRN_OP_GREATER_EQUAL, 2);
- } else {
- grn_expr_append_op(ctx, between_expr, GRN_OP_GREATER, 2);
+ return found;
+}
+
+static grn_bool
+selector_between_sequential_search_should_use(grn_ctx *ctx,
+ grn_obj *table,
+ grn_obj *index,
+ grn_obj *index_table,
+ between_data *data,
+ grn_obj *res,
+ grn_operator op,
+ double too_many_index_match_ratio)
+{
+ int n_index_keys;
+
+ if (too_many_index_match_ratio < 0.0) {
+ return GRN_FALSE;
}
- grn_expr_append_obj(ctx, between_expr, data.value, GRN_OP_PUSH, 1);
- grn_expr_append_obj(ctx, between_expr, data.max, GRN_OP_PUSH, 1);
- if (data.max_border_type == BETWEEN_BORDER_INCLUDE) {
- grn_expr_append_op(ctx, between_expr, GRN_OP_LESS_EQUAL, 2);
- } else {
- grn_expr_append_op(ctx, between_expr, GRN_OP_LESS, 2);
+ if (op != GRN_OP_AND) {
+ return GRN_FALSE;
}
- grn_expr_append_op(ctx, between_expr, GRN_OP_AND, 2);
+ if (index->header.flags & GRN_OBJ_WITH_WEIGHT) {
+ return GRN_FALSE;
+ }
- GRN_RECORD_SET(ctx, between_variable, GRN_RECORD_VALUE(variable));
- result = grn_expr_exec(ctx, between_expr, 0);
- if (result && GRN_UINT32_VALUE(result) > 0) {
- GRN_BOOL_SET(ctx, found, GRN_TRUE);
+ n_index_keys = grn_table_size(ctx, index_table);
+ if (n_index_keys == 0) {
+ return GRN_FALSE;
}
- grn_obj_unlink(ctx, between_expr);
- grn_obj_unlink(ctx, table);
+ switch (index_table->header.domain) {
+ /* TODO: */
+ /* case GRN_DB_INT8 : */
+ /* case GRN_DB_UINT8 : */
+ /* case GRN_DB_INT16 : */
+ /* case GRN_DB_UINT16 : */
+ /* case GRN_DB_INT32 : */
+ /* case GRN_DB_UINT32 : */
+ /* case GRN_DB_INT64 : */
+ /* case GRN_DB_UINT64 : */
+ /* case GRN_DB_FLOAT : */
+ case GRN_DB_TIME :
+ break;
+ default :
+ return GRN_FALSE;
+ }
- return found;
+ {
+ grn_table_cursor *cursor;
+ long long int all_min;
+ long long int all_max;
+ cursor = grn_table_cursor_open(ctx, index_table,
+ NULL, -1,
+ NULL, -1,
+ 0, 1,
+ GRN_CURSOR_BY_KEY | GRN_CURSOR_ASCENDING);
+ if (!cursor) {
+ return GRN_FALSE;
+ }
+ if (grn_table_cursor_next(ctx, cursor) == GRN_ID_NIL) {
+ grn_table_cursor_close(ctx, cursor);
+ return GRN_FALSE;
+ }
+ {
+ long long int *key;
+ grn_table_cursor_get_key(ctx, cursor, (void **)&key);
+ all_min = *key;
+ }
+ grn_table_cursor_close(ctx, cursor);
+
+ cursor = grn_table_cursor_open(ctx, index_table,
+ NULL, 0, NULL, 0,
+ 0, 1,
+ GRN_CURSOR_BY_KEY | GRN_CURSOR_DESCENDING);
+ if (!cursor) {
+ return GRN_FALSE;
+ }
+ if (grn_table_cursor_next(ctx, cursor) == GRN_ID_NIL) {
+ grn_table_cursor_close(ctx, cursor);
+ return GRN_FALSE;
+ }
+ {
+ long long int *key;
+ grn_table_cursor_get_key(ctx, cursor, (void **)&key);
+ all_max = *key;
+ }
+ grn_table_cursor_close(ctx, cursor);
+
+ /*
+ * We assume the following:
+ * * homogeneous index key distribution.
+ * * each index key matches only 1 record.
+ * TODO: Improve me.
+ */
+ {
+ int n_existing_records;
+ int n_indexed_records;
+ long long int all_difference;
+ long long int argument_difference;
+
+ n_existing_records = grn_table_size(ctx, res);
+
+ all_difference = all_max - all_min;
+ if (all_difference <= 0) {
+ return GRN_FALSE;
+ }
+ argument_difference =
+ GRN_TIME_VALUE(data->max) - GRN_TIME_VALUE(data->min);
+ if (argument_difference <= 0) {
+ return GRN_FALSE;
+ }
+ n_indexed_records =
+ n_index_keys * ((double)argument_difference / (double)all_difference);
+
+ /*
+ * Same as:
+ * ((n_existing_record / n_indexed_records) > too_many_index_match_ratio)
+ */
+ if (n_existing_records > (n_indexed_records * too_many_index_match_ratio)) {
+ return GRN_FALSE;
+ }
+ }
+ }
+
+ return GRN_TRUE;
+}
+
+static grn_bool
+selector_between_sequential_search(grn_ctx *ctx,
+ grn_obj *table,
+ grn_obj *index, grn_obj *index_table,
+ between_data *data,
+ grn_obj *res, grn_operator op)
+{
+ double too_many_index_match_ratio = 0.01;
+
+ {
+ char too_many_index_match_ratio_env[GRN_ENV_BUFFER_SIZE];
+ grn_getenv("GRN_BETWEEN_TOO_MANY_INDEX_MATCH_RATIO",
+ too_many_index_match_ratio_env,
+ GRN_ENV_BUFFER_SIZE);
+ if (too_many_index_match_ratio_env[0]) {
+ too_many_index_match_ratio = atof(too_many_index_match_ratio_env);
+ }
+ }
+
+ if (!selector_between_sequential_search_should_use(
+ ctx, table, index, index_table, data, res, op,
+ too_many_index_match_ratio)) {
+ return GRN_FALSE;
+ }
+
+ {
+ int offset = 0;
+ int limit = -1;
+ int flags = 0;
+ grn_table_cursor *cursor;
+ grn_obj *expr;
+ grn_obj *variable;
+ grn_id id;
+
+ if (!between_create_expr(ctx, table, data, &expr, &variable)) {
+ return GRN_FALSE;
+ }
+
+ cursor = grn_table_cursor_open(ctx, res,
+ NULL, 0,
+ NULL, 0,
+ offset, limit, flags);
+ if (!cursor) {
+ grn_obj_unlink(ctx, expr);
+ return GRN_FALSE;
+ }
+
+ while ((id = grn_table_cursor_next(ctx, cursor)) != GRN_ID_NIL) {
+ grn_id record_id;
+ grn_obj *result;
+ {
+ grn_id *key;
+ grn_table_cursor_get_key(ctx, cursor, (void **)&key);
+ record_id = *key;
+ }
+ GRN_RECORD_SET(ctx, variable, record_id);
+ result = grn_expr_exec(ctx, expr, 0);
+ if (ctx->rc) {
+ break;
+ }
+ if (result) {
+ grn_bool result_boolean;
+ GRN_TRUEP(ctx, result, result_boolean);
+ if (result_boolean) {
+ grn_ii_posting posting;
+ posting.rid = record_id;
+ posting.sid = 1;
+ posting.pos = 0;
+ posting.weight = 0;
+ grn_ii_posting_add(ctx, &posting, (grn_hash *)res, op);
+ }
+ }
+ }
+ grn_obj_unlink(ctx, expr);
+ grn_table_cursor_close(ctx, cursor);
+
+ grn_ii_resolve_sel_and(ctx, (grn_hash *)res, op);
+ }
+
+ return GRN_TRUE;
}
static grn_rc
@@ -4908,9 +5797,6 @@ selector_between(grn_ctx *ctx, grn_obj *table, grn_obj *index,
int limit = -1;
int flags = GRN_CURSOR_ASCENDING | GRN_CURSOR_BY_KEY;
between_data data;
- grn_obj casted_min, casted_max;
- grn_obj *used_min = NULL;
- grn_obj *used_max = NULL;
grn_obj *index_table = NULL;
grn_table_cursor *cursor;
grn_id id;
@@ -4919,9 +5805,10 @@ selector_between(grn_ctx *ctx, grn_obj *table, grn_obj *index,
return GRN_INVALID_ARGUMENT;
}
+ between_data_init(ctx, &data);
rc = between_parse_args(ctx, nargs - 1, args + 1, &data);
if (rc != GRN_SUCCESS) {
- return rc;
+ goto exit;
}
if (data.min_border_type == BETWEEN_BORDER_EXCLUDE) {
@@ -4932,31 +5819,16 @@ selector_between(grn_ctx *ctx, grn_obj *table, grn_obj *index,
}
index_table = grn_ctx_at(ctx, index->header.domain);
- if (data.min->header.domain == index_table->header.domain) {
- used_min = data.min;
- } else {
- used_min = &casted_min;
- rc = between_cast(ctx, data.min, &casted_min, index_table->header.domain,
- "min");
- if (rc != GRN_SUCCESS) {
- goto exit;
- }
- }
- if (data.max->header.domain == index_table->header.domain) {
- used_max = data.max;
- } else {
- used_max = &casted_max;
- rc = between_cast(ctx, data.max, &casted_max, index_table->header.domain,
- "max");
- if (rc != GRN_SUCCESS) {
- goto exit;
- }
+ if (selector_between_sequential_search(ctx, table, index, index_table,
+ &data, res, op)) {
+ goto exit;
}
+
cursor = grn_table_cursor_open(ctx, index_table,
- GRN_BULK_HEAD(used_min),
- GRN_BULK_VSIZE(used_min),
- GRN_BULK_HEAD(used_max),
- GRN_BULK_VSIZE(used_max),
+ GRN_BULK_HEAD(data.min),
+ GRN_BULK_VSIZE(data.min),
+ GRN_BULK_HEAD(data.max),
+ GRN_BULK_VSIZE(data.max),
offset, limit, flags);
if (!cursor) {
rc = ctx->rc;
@@ -4970,12 +5842,7 @@ selector_between(grn_ctx *ctx, grn_obj *table, grn_obj *index,
grn_table_cursor_close(ctx, cursor);
exit :
- if (used_min == &casted_min) {
- grn_obj_unlink(ctx, &casted_min);
- }
- if (used_max == &casted_max) {
- grn_obj_unlink(ctx, &casted_max);
- }
+ between_data_fin(ctx, &data);
if (index_table) {
grn_obj_unlink(ctx, index_table);
}
@@ -5095,14 +5962,15 @@ func_highlight_html(grn_ctx *ctx, int nargs, grn_obj **args,
}
if (condition) {
+ size_t i, n_keywords;
grn_obj current_keywords;
GRN_PTR_INIT(&current_keywords, GRN_OBJ_VECTOR, GRN_ID_NIL);
grn_expr_get_keywords(ctx, condition, &current_keywords);
- for (;;) {
+ n_keywords = GRN_BULK_VSIZE(&current_keywords) / sizeof(grn_obj *);
+ for (i = 0; i < n_keywords; i++) {
grn_obj *keyword;
- GRN_PTR_POP(&current_keywords, keyword);
- if (!keyword) { break; }
+ keyword = GRN_PTR_VALUE_AT(&current_keywords, i);
grn_table_add(ctx, keywords,
GRN_TEXT_VALUE(keyword),
GRN_TEXT_LEN(keyword),
@@ -5249,6 +6117,598 @@ func_highlight_full(grn_ctx *ctx, int nargs, grn_obj **args,
return highlighted;
}
+static grn_obj *
+func_in_values(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
+{
+ grn_obj *found;
+ grn_obj *target_value;
+ int i;
+
+ found = GRN_PROC_ALLOC(GRN_DB_BOOL, 0);
+ if (!found) {
+ return NULL;
+ }
+ GRN_BOOL_SET(ctx, found, GRN_FALSE);
+
+ if (nargs < 1) {
+ ERR(GRN_INVALID_ARGUMENT,
+ "in_values(): wrong number of arguments (%d for 1..)", nargs);
+ return found;
+ }
+
+ target_value = args[0];
+ for (i = 1; i < nargs; i++) {
+ grn_obj *value = args[i];
+ grn_bool result;
+
+ result = grn_operator_exec_equal(ctx, target_value, value);
+ if (ctx->rc) {
+ break;
+ }
+
+ if (result) {
+ GRN_BOOL_SET(ctx, found, GRN_TRUE);
+ break;
+ }
+ }
+
+ return found;
+}
+
+static grn_bool
+is_reference_type_column(grn_ctx *ctx, grn_obj *column)
+{
+ grn_bool is_reference_type;
+ grn_obj *range;
+
+ range = grn_ctx_at(ctx, grn_obj_get_range(ctx, column));
+ switch (range->header.type) {
+ case GRN_TABLE_HASH_KEY :
+ case GRN_TABLE_PAT_KEY :
+ case GRN_TABLE_DAT_KEY :
+ is_reference_type = GRN_TRUE;
+ break;
+ default :
+ is_reference_type = GRN_FALSE;
+ break;
+ }
+ grn_obj_unlink(ctx, range);
+
+ return is_reference_type;
+}
+
+static grn_obj *
+selector_in_values_find_source(grn_ctx *ctx, grn_obj *index, grn_obj *res)
+{
+ grn_id source_id = GRN_ID_NIL;
+ grn_obj source_ids;
+ unsigned int n_source_ids;
+
+ GRN_UINT32_INIT(&source_ids, GRN_OBJ_VECTOR);
+ grn_obj_get_info(ctx, index, GRN_INFO_SOURCE, &source_ids);
+ n_source_ids = GRN_BULK_VSIZE(&source_ids) / sizeof(grn_id);
+ if (n_source_ids == 1) {
+ source_id = GRN_UINT32_VALUE_AT(&source_ids, 0);
+ }
+ GRN_OBJ_FIN(ctx, &source_ids);
+
+ if (source_id == GRN_ID_NIL) {
+ return NULL;
+ } else {
+ return grn_ctx_at(ctx, source_id);
+ }
+}
+
+static grn_bool
+selector_in_values_sequential_search(grn_ctx *ctx,
+ grn_obj *table,
+ grn_obj *index,
+ int n_values,
+ grn_obj **values,
+ grn_obj *res,
+ grn_operator op)
+{
+ grn_obj *source;
+ int n_existing_records;
+ double too_many_index_match_ratio = 0.01;
+
+ {
+ char too_many_index_match_ratio_env[GRN_ENV_BUFFER_SIZE];
+ grn_getenv("GRN_IN_VALUES_TOO_MANY_INDEX_MATCH_RATIO",
+ too_many_index_match_ratio_env,
+ GRN_ENV_BUFFER_SIZE);
+ if (too_many_index_match_ratio_env[0]) {
+ too_many_index_match_ratio = atof(too_many_index_match_ratio_env);
+ }
+ }
+
+ if (too_many_index_match_ratio < 0.0) {
+ return GRN_FALSE;
+ }
+
+ if (op != GRN_OP_AND) {
+ return GRN_FALSE;
+ }
+
+ if (index->header.flags & GRN_OBJ_WITH_WEIGHT) {
+ return GRN_FALSE;
+ }
+
+ n_existing_records = grn_table_size(ctx, res);
+ if (n_existing_records == 0) {
+ return GRN_TRUE;
+ }
+
+ source = selector_in_values_find_source(ctx, index, res);
+ if (!source) {
+ return GRN_FALSE;
+ }
+
+ if (!is_reference_type_column(ctx, source)) {
+ grn_obj_unlink(ctx, source);
+ return GRN_FALSE;
+ }
+
+ {
+ grn_obj value_ids;
+ int i, n_value_ids;
+ int n_indexed_records = 0;
+
+ {
+ grn_id range_id;
+ grn_obj *range;
+
+ range_id = grn_obj_get_range(ctx, source);
+ range = grn_ctx_at(ctx, range_id);
+ if (!range) {
+ grn_obj_unlink(ctx, source);
+ return GRN_FALSE;
+ }
+
+ GRN_RECORD_INIT(&value_ids, GRN_OBJ_VECTOR, range_id);
+ for (i = 0; i < n_values; i++) {
+ grn_obj *value = values[i];
+ grn_id value_id;
+
+ value_id = grn_table_get(ctx, range,
+ GRN_TEXT_VALUE(value), GRN_TEXT_LEN(value));
+ if (value_id == GRN_ID_NIL) {
+ continue;
+ }
+ GRN_RECORD_PUT(ctx, &value_ids, value_id);
+ }
+ grn_obj_unlink(ctx, range);
+ }
+
+ n_value_ids = GRN_BULK_VSIZE(&value_ids) / sizeof(grn_id);
+ for (i = 0; i < n_value_ids; i++) {
+ grn_id value_id = GRN_RECORD_VALUE_AT(&value_ids, i);
+ n_indexed_records += grn_ii_estimate_size(ctx, (grn_ii *)index, value_id);
+ }
+
+ /*
+ * Same as:
+ * ((n_existing_record / n_indexed_records) > too_many_index_match_ratio)
+ */
+ if (n_existing_records > (n_indexed_records * too_many_index_match_ratio)) {
+ grn_obj_unlink(ctx, &value_ids);
+ grn_obj_unlink(ctx, source);
+ return GRN_FALSE;
+ }
+
+ {
+ grn_obj *accessor;
+ char local_source_name[GRN_TABLE_MAX_KEY_SIZE];
+ int local_source_name_length;
+
+ local_source_name_length = grn_column_name(ctx, source,
+ local_source_name,
+ GRN_TABLE_MAX_KEY_SIZE);
+ grn_obj_unlink(ctx, source);
+ accessor = grn_obj_column(ctx, res,
+ local_source_name,
+ local_source_name_length);
+ {
+ grn_table_cursor *cursor;
+ grn_id record_id;
+ grn_obj record_value;
+ GRN_RECORD_INIT(&record_value, 0, grn_obj_id(ctx, res));
+ cursor = grn_table_cursor_open(ctx, res,
+ NULL, 0, NULL, 0,
+ 0, -1, GRN_CURSOR_ASCENDING);
+ while ((record_id = grn_table_cursor_next(ctx, cursor)) != GRN_ID_NIL) {
+ GRN_BULK_REWIND(&record_value);
+ grn_obj_get_value(ctx, accessor, record_id, &record_value);
+ for (i = 0; i < n_value_ids; i++) {
+ grn_id value_id = GRN_RECORD_VALUE_AT(&value_ids, i);
+ if (value_id == GRN_RECORD_VALUE(&record_value)) {
+ grn_ii_posting posting;
+ posting.rid = record_id;
+ posting.sid = 1;
+ posting.pos = 0;
+ posting.weight = 0;
+ grn_ii_posting_add(ctx, &posting, (grn_hash *)res, op);
+ }
+ }
+ }
+ grn_table_cursor_close(ctx, cursor);
+ grn_ii_resolve_sel_and(ctx, (grn_hash *)res, op);
+ GRN_OBJ_FIN(ctx, &record_value);
+ }
+ grn_obj_unlink(ctx, accessor);
+ }
+ grn_obj_unlink(ctx, &value_ids);
+ }
+ grn_obj_unlink(ctx, source);
+
+ return GRN_TRUE;
+}
+
+static grn_rc
+selector_in_values(grn_ctx *ctx, grn_obj *table, grn_obj *index,
+ int nargs, grn_obj **args,
+ grn_obj *res, grn_operator op)
+{
+ grn_rc rc = GRN_SUCCESS;
+ int i, n_values;
+ grn_obj **values;
+
+ if (!index) {
+ return GRN_INVALID_ARGUMENT;
+ }
+
+ if (nargs < 2) {
+ ERR(GRN_INVALID_ARGUMENT,
+ "in_values(): wrong number of arguments (%d for 1..)", nargs);
+ return ctx->rc;
+ }
+
+ n_values = nargs - 2;
+ values = args + 2;
+
+ if (n_values == 0) {
+ return rc;
+ }
+
+ if (selector_in_values_sequential_search(ctx, table, index,
+ n_values, values,
+ res, op)) {
+ return ctx->rc;
+ }
+
+ ctx->flags |= GRN_CTX_TEMPORARY_DISABLE_II_RESOLVE_SEL_AND;
+ for (i = 0; i < n_values; i++) {
+ grn_obj *value = values[i];
+ grn_search_optarg search_options;
+ memset(&search_options, 0, sizeof(grn_search_optarg));
+ search_options.mode = GRN_OP_EXACT;
+ search_options.similarity_threshold = 0;
+ search_options.max_interval = 0;
+ search_options.weight_vector = NULL;
+ search_options.vector_size = 0;
+ search_options.proc = NULL;
+ search_options.max_size = 0;
+ search_options.scorer = NULL;
+ if (i == n_values - 1) {
+ ctx->flags &= ~GRN_CTX_TEMPORARY_DISABLE_II_RESOLVE_SEL_AND;
+ }
+ rc = grn_obj_search(ctx, index, value, res, op, &search_options);
+ if (rc != GRN_SUCCESS) {
+ break;
+ }
+ }
+
+ return rc;
+}
+
+static grn_obj *
+proc_range_filter(grn_ctx *ctx, int nargs, grn_obj **args,
+ grn_user_data *user_data)
+{
+ grn_obj *table_name = VAR(0);
+ grn_obj *column_name = VAR(1);
+ grn_obj *min = VAR(2);
+ grn_obj *min_border = VAR(3);
+ grn_obj *max = VAR(4);
+ grn_obj *max_border = VAR(5);
+ grn_obj *offset = VAR(6);
+ grn_obj *limit = VAR(7);
+ grn_obj *filter = VAR(8);
+ grn_obj *output_columns = VAR(9);
+ grn_obj *table;
+ grn_obj *res = NULL;
+ grn_obj *filter_expr = NULL;
+ grn_obj *filter_variable = NULL;
+ int real_offset;
+ int real_limit;
+
+ table = grn_ctx_get(ctx, GRN_TEXT_VALUE(table_name), GRN_TEXT_LEN(table_name));
+ if (!table) {
+ ERR(GRN_INVALID_ARGUMENT,
+ "[range_filter] nonexistent table <%.*s>",
+ (int)GRN_TEXT_LEN(table_name), GRN_TEXT_VALUE(table_name));
+ return NULL;
+ }
+
+ if (GRN_TEXT_LEN(filter) > 0) {
+ GRN_EXPR_CREATE_FOR_QUERY(ctx, table, filter_expr, filter_variable);
+ if (!filter_expr) {
+ ERR(GRN_INVALID_ARGUMENT,
+ "[range_filter] failed to create expression");
+ goto exit;
+ }
+
+ grn_expr_parse(ctx, filter_expr,
+ GRN_TEXT_VALUE(filter), GRN_TEXT_LEN(filter),
+ NULL, GRN_OP_MATCH, GRN_OP_AND, GRN_EXPR_SYNTAX_SCRIPT);
+ if (ctx->rc != GRN_SUCCESS) {
+ goto exit;
+ }
+ }
+
+ res = grn_table_create(ctx, NULL, 0, NULL,
+ GRN_TABLE_HASH_KEY|GRN_OBJ_WITH_SUBREC,
+ table, NULL);
+ if (!res) {
+ ERR(GRN_INVALID_ARGUMENT,
+ "[range_filter] failed to result table");
+ goto exit;
+ }
+
+ {
+ grn_obj int32_value;
+
+ GRN_INT32_INIT(&int32_value, 0);
+
+ if (GRN_TEXT_LEN(offset) > 0) {
+ if (grn_obj_cast(ctx, offset, &int32_value, GRN_FALSE) != GRN_SUCCESS) {
+ ERR(GRN_INVALID_ARGUMENT,
+ "[range_filter] invalid offset format: <%.*s>",
+ (int)GRN_TEXT_LEN(offset), GRN_TEXT_VALUE(offset));
+ GRN_OBJ_FIN(ctx, &int32_value);
+ goto exit;
+ }
+ real_offset = GRN_INT32_VALUE(&int32_value);
+ } else {
+ real_offset = 0;
+ }
+
+ GRN_BULK_REWIND(&int32_value);
+
+ if (GRN_TEXT_LEN(limit) > 0) {
+ if (grn_obj_cast(ctx, limit, &int32_value, GRN_FALSE) != GRN_SUCCESS) {
+ ERR(GRN_INVALID_ARGUMENT,
+ "[range_filter] invalid limit format: <%.*s>",
+ (int)GRN_TEXT_LEN(limit), GRN_TEXT_VALUE(limit));
+ GRN_OBJ_FIN(ctx, &int32_value);
+ goto exit;
+ }
+ real_limit = GRN_INT32_VALUE(&int32_value);
+ } else {
+ real_limit = DEFAULT_LIMIT;
+ }
+
+ GRN_OBJ_FIN(ctx, &int32_value);
+ }
+ {
+ grn_rc rc;
+ int original_offset = real_offset;
+ int original_limit = real_limit;
+ rc = grn_normalize_offset_and_limit(ctx, grn_table_size(ctx, table),
+ &real_offset, &real_limit);
+ switch (rc) {
+ case GRN_TOO_SMALL_OFFSET :
+ ERR(GRN_INVALID_ARGUMENT,
+ "[range_filter] too small offset: <%d>", original_offset);
+ goto exit;
+ case GRN_TOO_LARGE_OFFSET :
+ ERR(GRN_INVALID_ARGUMENT,
+ "[range_filter] too large offset: <%d>", original_offset);
+ goto exit;
+ case GRN_TOO_SMALL_LIMIT :
+ ERR(GRN_INVALID_ARGUMENT,
+ "[range_filter] too small limit: <%d>", original_limit);
+ goto exit;
+ default :
+ break;
+ }
+ }
+
+ if (real_limit != 0) {
+ grn_table_sort_key *sort_keys;
+ unsigned int n_sort_keys;
+ sort_keys = grn_table_sort_key_from_str(ctx,
+ GRN_TEXT_VALUE(column_name),
+ GRN_TEXT_LEN(column_name),
+ table,
+ &n_sort_keys);
+ if (n_sort_keys == 1) {
+ grn_table_sort_key *sort_key;
+ grn_obj *index;
+ int n_indexes;
+ grn_operator op = GRN_OP_OR;
+
+ sort_key = &(sort_keys[0]);
+ n_indexes = grn_column_index(ctx, sort_key->key, GRN_OP_LESS,
+ &index, 1, NULL);
+ if (n_indexes > 0) {
+ grn_obj *lexicon;
+ grn_table_cursor *table_cursor;
+ int table_cursor_flags = 0;
+ between_border_type min_border_type;
+ between_border_type max_border_type;
+ grn_obj real_min;
+ grn_obj real_max;
+ int n_records = 0;
+ grn_obj *index_cursor;
+ int index_cursor_flags = 0;
+ grn_posting *posting;
+
+ lexicon = grn_ctx_at(ctx, index->header.domain);
+ if (sort_key->flags & GRN_TABLE_SORT_DESC) {
+ table_cursor_flags |= GRN_CURSOR_DESCENDING;
+ } else {
+ table_cursor_flags |= GRN_CURSOR_ASCENDING;
+ }
+ if (GRN_TEXT_LEN(min_border) > 0) {
+ min_border_type = between_parse_border(ctx, min_border, "min_border");
+ } else {
+ min_border_type = BETWEEN_BORDER_INCLUDE;
+ }
+ if (GRN_TEXT_LEN(max_border) > 0) {
+ max_border_type = between_parse_border(ctx, max_border, "max_border");
+ } else {
+ max_border_type = BETWEEN_BORDER_INCLUDE;
+ }
+ if (min_border_type == BETWEEN_BORDER_EXCLUDE) {
+ table_cursor_flags |= GRN_CURSOR_GT;
+ }
+ if (max_border_type == BETWEEN_BORDER_EXCLUDE) {
+ table_cursor_flags |= GRN_CURSOR_LT;
+ }
+ GRN_OBJ_INIT(&real_min, GRN_BULK, 0, lexicon->header.domain);
+ GRN_OBJ_INIT(&real_max, GRN_BULK, 0, lexicon->header.domain);
+ if (GRN_TEXT_LEN(min) > 0) {
+ grn_obj_cast(ctx, min, &real_min, GRN_FALSE);
+ }
+ if (GRN_TEXT_LEN(max) > 0) {
+ grn_obj_cast(ctx, max, &real_max, GRN_FALSE);
+ }
+ table_cursor = grn_table_cursor_open(ctx, lexicon,
+ GRN_BULK_HEAD(&real_min),
+ GRN_BULK_VSIZE(&real_min),
+ GRN_BULK_HEAD(&real_max),
+ GRN_BULK_VSIZE(&real_max),
+ 0, -1, table_cursor_flags);
+ index_cursor = grn_index_cursor_open(ctx, table_cursor,
+ index, GRN_ID_NIL, GRN_ID_NIL,
+ index_cursor_flags);
+ while ((posting = grn_index_cursor_next(ctx, index_cursor, NULL))) {
+ grn_bool result_boolean = GRN_FALSE;
+
+ if (filter_expr) {
+ grn_obj *result;
+ GRN_RECORD_SET(ctx, filter_variable, posting->rid);
+ result = grn_expr_exec(ctx, filter_expr, 0);
+ if (ctx->rc) {
+ break;
+ }
+ if (result) {
+ GRN_TRUEP(ctx, result, result_boolean);
+ }
+ } else {
+ result_boolean = GRN_TRUE;
+ }
+
+ if (result_boolean) {
+ if (n_records >= real_offset) {
+ grn_ii_posting ii_posting;
+ ii_posting.rid = posting->rid;
+ ii_posting.sid = posting->sid;
+ ii_posting.pos = posting->pos;
+ ii_posting.weight = posting->weight;
+ grn_ii_posting_add(ctx, &ii_posting, (grn_hash *)res, op);
+ }
+ n_records++;
+ if (n_records == real_limit) {
+ break;
+ }
+ }
+ }
+ grn_obj_unlink(ctx, index_cursor);
+ grn_table_cursor_close(ctx, table_cursor);
+
+ GRN_OBJ_FIN(ctx, &real_min);
+ GRN_OBJ_FIN(ctx, &real_max);
+ }
+ grn_ii_resolve_sel_and(ctx, (grn_hash *)res, op);
+ }
+ grn_table_sort_key_close(ctx, sort_keys, n_sort_keys);
+ }
+
+ if (ctx->rc == GRN_SUCCESS) {
+ const char *raw_output_columns;
+ int raw_output_columns_len;
+
+ raw_output_columns = GRN_TEXT_VALUE(output_columns);
+ raw_output_columns_len = GRN_TEXT_LEN(output_columns);
+ if (raw_output_columns_len == 0) {
+ raw_output_columns = DEFAULT_OUTPUT_COLUMNS;
+ raw_output_columns_len = strlen(raw_output_columns);
+ }
+ grn_select_output_columns(ctx, res, -1, real_offset, real_limit,
+ raw_output_columns,
+ raw_output_columns_len,
+ filter_expr);
+ }
+
+exit :
+ if (filter_expr) {
+ grn_obj_unlink(ctx, filter_expr);
+ }
+ if (res) {
+ grn_obj_unlink(ctx, res);
+ }
+
+ return NULL;
+}
+
+static grn_obj *
+proc_request_cancel(grn_ctx *ctx, int nargs, grn_obj **args,
+ grn_user_data *user_data)
+{
+ grn_obj *id = VAR(0);
+ grn_bool canceled;
+
+ if (GRN_TEXT_LEN(id) == 0) {
+ ERR(GRN_INVALID_ARGUMENT, "[request_cancel] ID is missing");
+ return NULL;
+ }
+
+ canceled = grn_request_canceler_cancel(GRN_TEXT_VALUE(id), GRN_TEXT_LEN(id));
+
+ GRN_OUTPUT_MAP_OPEN("result", 2);
+ GRN_OUTPUT_CSTR("id");
+ GRN_OUTPUT_STR(GRN_TEXT_VALUE(id), GRN_TEXT_LEN(id));
+ GRN_OUTPUT_CSTR("canceled");
+ GRN_OUTPUT_BOOL(canceled);
+ GRN_OUTPUT_MAP_CLOSE();
+
+ return NULL;
+}
+
+static grn_obj *
+proc_plugin_register(grn_ctx *ctx, int nargs, grn_obj **args,
+ grn_user_data *user_data)
+{
+ if (GRN_TEXT_LEN(VAR(0))) {
+ const char *name;
+ GRN_TEXT_PUTC(ctx, VAR(0), '\0');
+ name = GRN_TEXT_VALUE(VAR(0));
+ grn_plugin_register(ctx, name);
+ } else {
+ ERR(GRN_INVALID_ARGUMENT, "[plugin_register] name is missing");
+ }
+ GRN_OUTPUT_BOOL(!ctx->rc);
+ return NULL;
+}
+
+static grn_obj *
+proc_plugin_unregister(grn_ctx *ctx, int nargs, grn_obj **args,
+ grn_user_data *user_data)
+{
+ if (GRN_TEXT_LEN(VAR(0))) {
+ const char *name;
+ GRN_TEXT_PUTC(ctx, VAR(0), '\0');
+ name = GRN_TEXT_VALUE(VAR(0));
+ grn_plugin_unregister(ctx, name);
+ } else {
+ ERR(GRN_INVALID_ARGUMENT, "[plugin_unregister] name is missing");
+ }
+ GRN_OUTPUT_BOOL(!ctx->rc);
+ return NULL;
+}
+
#define DEF_VAR(v,name_str) do {\
(v).name = (name_str);\
(v).name_size = GRN_STRLEN(name_str);\
@@ -5262,7 +6722,7 @@ func_highlight_full(grn_ctx *ctx, int nargs, grn_obj **args,
void
grn_db_init_builtin_query(grn_ctx *ctx)
{
- grn_expr_var vars[21];
+ grn_expr_var vars[23];
DEF_VAR(vars[0], "name");
DEF_VAR(vars[1], "table");
@@ -5286,8 +6746,10 @@ grn_db_init_builtin_query(grn_ctx *ctx)
DEF_VAR(vars[18], "query_flags");
DEF_VAR(vars[19], "query_expander");
DEF_VAR(vars[20], "adjuster");
- DEF_COMMAND("define_selector", proc_define_selector, 21, vars);
- DEF_COMMAND("select", proc_select, 20, vars + 1);
+ DEF_VAR(vars[21], "drilldown_calc_types");
+ DEF_VAR(vars[22], "drilldown_calc_target");
+ DEF_COMMAND("define_selector", proc_define_selector, 23, vars);
+ DEF_COMMAND("select", proc_select, 22, vars + 1);
DEF_VAR(vars[0], "values");
DEF_VAR(vars[1], "table");
@@ -5343,8 +6805,12 @@ grn_db_init_builtin_query(grn_ctx *ctx)
DEF_COMMAND("shutdown", proc_shutdown, 0, vars);
+ /* Deprecated. Use "lock_clear" instead. */
+ DEF_VAR(vars[0], "target_name");
+ DEF_COMMAND("clearlock", proc_lock_clear, 1, vars);
+
DEF_VAR(vars[0], "target_name");
- DEF_COMMAND("clearlock", proc_clearlock, 1, vars);
+ DEF_COMMAND("lock_clear", proc_lock_clear, 1, vars);
DEF_VAR(vars[0], "target_name");
DEF_VAR(vars[1], "threshold");
@@ -5369,16 +6835,22 @@ grn_db_init_builtin_query(grn_ctx *ctx)
DEF_COMMAND("cache_limit", proc_cache_limit, 1, vars);
DEF_VAR(vars[0], "tables");
- DEF_COMMAND("dump", proc_dump, 1, vars);
+ DEF_VAR(vars[1], "dump_plugins");
+ DEF_VAR(vars[2], "dump_schema");
+ DEF_VAR(vars[3], "dump_records");
+ DEF_VAR(vars[4], "dump_indexes");
+ DEF_COMMAND("dump", proc_dump, 5, vars);
+ /* Deprecated. Use "plugin_register" instead. */
DEF_VAR(vars[0], "path");
DEF_COMMAND("register", proc_register, 1, vars);
DEF_VAR(vars[0], "obj");
DEF_COMMAND("check", proc_check, 1, vars);
- DEF_VAR(vars[0], "table");
- DEF_COMMAND("truncate", proc_truncate, 1, vars);
+ DEF_VAR(vars[0], "target_name");
+ DEF_VAR(vars[1], "table");
+ DEF_COMMAND("truncate", proc_truncate, 2, vars);
DEF_VAR(vars[0], "normalizer");
DEF_VAR(vars[1], "string");
@@ -5390,7 +6862,14 @@ grn_db_init_builtin_query(grn_ctx *ctx)
DEF_VAR(vars[2], "normalizer");
DEF_VAR(vars[3], "flags");
DEF_VAR(vars[4], "mode");
- DEF_COMMAND("tokenize", proc_tokenize, 5, vars);
+ DEF_VAR(vars[5], "token_filters");
+ DEF_COMMAND("tokenize", proc_tokenize, 6, vars);
+
+ DEF_VAR(vars[0], "table");
+ DEF_VAR(vars[1], "string");
+ DEF_VAR(vars[2], "flags");
+ DEF_VAR(vars[3], "mode");
+ DEF_COMMAND("table_tokenize", proc_table_tokenize, 4, vars);
DEF_COMMAND("tokenizer_list", proc_tokenizer_list, 0, vars);
@@ -5479,4 +6958,33 @@ grn_db_init_builtin_query(grn_ctx *ctx)
grn_proc_create(ctx, "highlight_full", -1, GRN_PROC_FUNCTION,
func_highlight_full, NULL, NULL, 0, NULL);
+
+ {
+ grn_obj *selector_proc;
+
+ selector_proc = grn_proc_create(ctx, "in_values", -1, GRN_PROC_FUNCTION,
+ func_in_values, NULL, NULL, 0, NULL);
+ grn_proc_set_selector(ctx, selector_proc, selector_in_values);
+ }
+
+ DEF_VAR(vars[0], "table");
+ DEF_VAR(vars[1], "column");
+ DEF_VAR(vars[2], "min");
+ DEF_VAR(vars[3], "min_border");
+ DEF_VAR(vars[4], "max");
+ DEF_VAR(vars[5], "max_border");
+ DEF_VAR(vars[6], "offset");
+ DEF_VAR(vars[7], "limit");
+ DEF_VAR(vars[8], "filter");
+ DEF_VAR(vars[9], "output_columns");
+ DEF_COMMAND("range_filter", proc_range_filter, 10, vars);
+
+ DEF_VAR(vars[0], "id");
+ DEF_COMMAND("request_cancel", proc_request_cancel, 1, vars);
+
+ DEF_VAR(vars[0], "name");
+ DEF_COMMAND("plugin_register", proc_plugin_register, 1, vars);
+
+ DEF_VAR(vars[0], "name");
+ DEF_COMMAND("plugin_unregister", proc_plugin_unregister, 1, vars);
}
diff --git a/storage/mroonga/vendor/groonga/lib/request_canceler.c b/storage/mroonga/vendor/groonga/lib/request_canceler.c
new file mode 100644
index 00000000000..866292f73de
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/request_canceler.c
@@ -0,0 +1,123 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2014 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
+*/
+
+#include "grn_ctx.h"
+#include "grn_request_canceler.h"
+
+typedef struct _grn_request_canceler grn_request_canceler;
+struct _grn_request_canceler {
+ grn_hash *entries;
+ grn_mutex mutex;
+};
+
+typedef struct _grn_request_canceler_entry grn_request_canceler_entry;
+struct _grn_request_canceler_entry {
+ grn_ctx *ctx;
+};
+
+static grn_request_canceler *grn_the_request_canceler = NULL;
+
+grn_bool
+grn_request_canceler_init(void)
+{
+ grn_ctx *ctx = &grn_gctx;
+
+ grn_the_request_canceler = GRN_MALLOC(sizeof(grn_request_canceler));
+ if (!grn_the_request_canceler) {
+ ERR(GRN_NO_MEMORY_AVAILABLE,
+ "[request-canceler] failed to allocate the global request canceler");
+ return GRN_FALSE;
+ }
+
+ grn_the_request_canceler->entries =
+ grn_hash_create(ctx, NULL, GRN_TABLE_MAX_KEY_SIZE,
+ sizeof(grn_request_canceler_entry), GRN_OBJ_KEY_VAR_SIZE);
+ if (!grn_the_request_canceler->entries) {
+ return GRN_FALSE;
+ }
+ MUTEX_INIT(grn_the_request_canceler->mutex);
+
+ return GRN_TRUE;
+}
+
+void
+grn_request_canceler_register(grn_ctx *ctx,
+ const char *request_id, unsigned int size)
+{
+ MUTEX_LOCK(grn_the_request_canceler->mutex);
+ {
+ grn_hash *entries = grn_the_request_canceler->entries;
+ grn_id id;
+ void *value;
+ id = grn_hash_add(&grn_gctx, entries, request_id, size, &value, NULL);
+ if (id) {
+ grn_request_canceler_entry *entry = value;
+ entry->ctx = ctx;
+ }
+ }
+ MUTEX_UNLOCK(grn_the_request_canceler->mutex);
+}
+
+void
+grn_request_canceler_unregister(grn_ctx *ctx,
+ const char *request_id, unsigned int size)
+{
+ MUTEX_LOCK(grn_the_request_canceler->mutex);
+ {
+ grn_hash *entries = grn_the_request_canceler->entries;
+ grn_hash_delete(&grn_gctx, entries, request_id, size, NULL);
+ }
+ MUTEX_UNLOCK(grn_the_request_canceler->mutex);
+
+ if (ctx->rc == GRN_INTERRUPTED_FUNCTION_CALL) {
+ ERRSET(ctx, GRN_LOG_NOTICE, ctx->rc,
+ "[request-canceler] a request is canceled: <%.*s>",
+ size, request_id);
+ }
+}
+
+grn_bool
+grn_request_canceler_cancel(const char *request_id, unsigned int size)
+{
+ grn_bool canceled = GRN_FALSE;
+ MUTEX_LOCK(grn_the_request_canceler->mutex);
+ {
+ grn_hash *entries = grn_the_request_canceler->entries;
+ void *value;
+ if (grn_hash_get(&grn_gctx, entries, request_id, size, &value)) {
+ grn_request_canceler_entry *entry = value;
+ if (entry->ctx->rc == GRN_SUCCESS) {
+ entry->ctx->rc = GRN_INTERRUPTED_FUNCTION_CALL;
+ canceled = GRN_TRUE;
+ }
+ }
+ }
+ MUTEX_UNLOCK(grn_the_request_canceler->mutex);
+ return canceled;
+}
+
+void
+grn_request_canceler_fin(void)
+{
+ grn_ctx *ctx = &grn_gctx;
+
+ grn_hash_close(ctx, grn_the_request_canceler->entries);
+ MUTEX_FIN(grn_the_request_canceler->mutex);
+ GRN_FREE(grn_the_request_canceler);
+ grn_the_request_canceler = NULL;
+}
diff --git a/storage/mroonga/vendor/groonga/lib/rset.c b/storage/mroonga/vendor/groonga/lib/rset.c
new file mode 100644
index 00000000000..85a9e1c529e
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/rset.c
@@ -0,0 +1,324 @@
+/* -*- c-basic-offset: 2 -*- */
+/* Copyright(C) 2009-2015 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
+*/
+#include "grn_db.h"
+
+uint32_t
+grn_rset_recinfo_calc_values_size(grn_ctx *ctx, grn_table_group_flags flags)
+{
+ uint32_t size = 0;
+
+ if (flags & GRN_TABLE_GROUP_CALC_MAX) {
+ size += GRN_RSET_MAX_SIZE;
+ }
+ if (flags & GRN_TABLE_GROUP_CALC_MIN) {
+ size += GRN_RSET_MIN_SIZE;
+ }
+ if (flags & GRN_TABLE_GROUP_CALC_SUM) {
+ size += GRN_RSET_SUM_SIZE;
+ }
+ if (flags & GRN_TABLE_GROUP_CALC_AVG) {
+ size += GRN_RSET_AVG_SIZE;
+ }
+
+ return size;
+}
+
+void
+grn_rset_recinfo_update_calc_values(grn_ctx *ctx,
+ grn_rset_recinfo *ri,
+ grn_obj *table,
+ grn_obj *value)
+{
+ grn_table_group_flags flags;
+ byte *values;
+ grn_obj value_int64;
+ grn_obj value_float;
+
+ flags = DB_OBJ(table)->flags.group;
+
+ values = (((byte *)ri->subrecs) +
+ GRN_RSET_SUBRECS_SIZE(DB_OBJ(table)->subrec_size,
+ DB_OBJ(table)->max_n_subrecs));
+
+ GRN_INT64_INIT(&value_int64, 0);
+ GRN_FLOAT_INIT(&value_float, 0);
+
+ if (flags & (GRN_TABLE_GROUP_CALC_MAX |
+ GRN_TABLE_GROUP_CALC_MIN |
+ GRN_TABLE_GROUP_CALC_SUM)) {
+ grn_obj_cast(ctx, value, &value_int64, GRN_FALSE);
+ }
+ if (flags & GRN_TABLE_GROUP_CALC_AVG) {
+ grn_obj_cast(ctx, value, &value_float, GRN_FALSE);
+ }
+
+ if (flags & GRN_TABLE_GROUP_CALC_MAX) {
+ int64_t current_max = *((int64_t *)values);
+ int64_t value_raw = GRN_INT64_VALUE(&value_int64);
+ if (ri->n_subrecs == 1 || value_raw > current_max) {
+ *((int64_t *)values) = value_raw;
+ }
+ values += GRN_RSET_MAX_SIZE;
+ }
+ if (flags & GRN_TABLE_GROUP_CALC_MIN) {
+ int64_t current_min = *((int64_t *)values);
+ int64_t value_raw = GRN_INT64_VALUE(&value_int64);
+ if (ri->n_subrecs == 1 || value_raw < current_min) {
+ *((int64_t *)values) = value_raw;
+ }
+ values += GRN_RSET_MIN_SIZE;
+ }
+ if (flags & GRN_TABLE_GROUP_CALC_SUM) {
+ int64_t value_raw = GRN_INT64_VALUE(&value_int64);
+ *((int64_t *)values) += value_raw;
+ values += GRN_RSET_SUM_SIZE;
+ }
+ if (flags & GRN_TABLE_GROUP_CALC_AVG) {
+ double current_average = *((double *)values);
+ double value_raw = GRN_FLOAT_VALUE(&value_float);
+ *((double *)values) += (value_raw - current_average) / ri->n_subrecs;
+ values += GRN_RSET_AVG_SIZE;
+ }
+
+ GRN_OBJ_FIN(ctx, &value_float);
+ GRN_OBJ_FIN(ctx, &value_int64);
+}
+
+int64_t *
+grn_rset_recinfo_get_max_(grn_ctx *ctx,
+ grn_rset_recinfo *ri,
+ grn_obj *table)
+{
+ grn_table_group_flags flags;
+ byte *values;
+
+ flags = DB_OBJ(table)->flags.group;
+ if (!(flags & GRN_TABLE_GROUP_CALC_MAX)) {
+ return NULL;
+ }
+
+ values = (((byte *)ri->subrecs) +
+ GRN_RSET_SUBRECS_SIZE(DB_OBJ(table)->subrec_size,
+ DB_OBJ(table)->max_n_subrecs));
+
+ return (int64_t *)values;
+}
+
+int64_t
+grn_rset_recinfo_get_max(grn_ctx *ctx,
+ grn_rset_recinfo *ri,
+ grn_obj *table)
+{
+ int64_t *max_address;
+
+ max_address = grn_rset_recinfo_get_max_(ctx, ri, table);
+ if (max_address) {
+ return *max_address;
+ } else {
+ return 0;
+ }
+}
+
+void
+grn_rset_recinfo_set_max(grn_ctx *ctx,
+ grn_rset_recinfo *ri,
+ grn_obj *table,
+ int64_t max)
+{
+ int64_t *max_address;
+
+ max_address = grn_rset_recinfo_get_max_(ctx, ri, table);
+ if (!max_address) {
+ return;
+ }
+
+ *max_address = max;
+}
+
+int64_t *
+grn_rset_recinfo_get_min_(grn_ctx *ctx,
+ grn_rset_recinfo *ri,
+ grn_obj *table)
+{
+ grn_table_group_flags flags;
+ byte *values;
+
+ flags = DB_OBJ(table)->flags.group;
+ if (!(flags & GRN_TABLE_GROUP_CALC_MIN)) {
+ return NULL;
+ }
+
+ values = (((byte *)ri->subrecs) +
+ GRN_RSET_SUBRECS_SIZE(DB_OBJ(table)->subrec_size,
+ DB_OBJ(table)->max_n_subrecs));
+
+ if (flags & GRN_TABLE_GROUP_CALC_MAX) {
+ values += GRN_RSET_MAX_SIZE;
+ }
+
+ return (int64_t *)values;
+}
+
+int64_t
+grn_rset_recinfo_get_min(grn_ctx *ctx,
+ grn_rset_recinfo *ri,
+ grn_obj *table)
+{
+ int64_t *min_address;
+
+ min_address = grn_rset_recinfo_get_min_(ctx, ri, table);
+ if (min_address) {
+ return *min_address;
+ } else {
+ return 0;
+ }
+}
+
+void
+grn_rset_recinfo_set_min(grn_ctx *ctx,
+ grn_rset_recinfo *ri,
+ grn_obj *table,
+ int64_t min)
+{
+ int64_t *min_address;
+
+ min_address = grn_rset_recinfo_get_min_(ctx, ri, table);
+ if (!min_address) {
+ return;
+ }
+
+ *min_address = min;
+}
+
+int64_t *
+grn_rset_recinfo_get_sum_(grn_ctx *ctx,
+ grn_rset_recinfo *ri,
+ grn_obj *table)
+{
+ grn_table_group_flags flags;
+ byte *values;
+
+ flags = DB_OBJ(table)->flags.group;
+ if (!(flags & GRN_TABLE_GROUP_CALC_SUM)) {
+ return NULL;
+ }
+
+ values = (((byte *)ri->subrecs) +
+ GRN_RSET_SUBRECS_SIZE(DB_OBJ(table)->subrec_size,
+ DB_OBJ(table)->max_n_subrecs));
+
+ if (flags & GRN_TABLE_GROUP_CALC_MAX) {
+ values += GRN_RSET_MAX_SIZE;
+ }
+ if (flags & GRN_TABLE_GROUP_CALC_MIN) {
+ values += GRN_RSET_MIN_SIZE;
+ }
+
+ return (int64_t *)values;
+}
+
+int64_t
+grn_rset_recinfo_get_sum(grn_ctx *ctx,
+ grn_rset_recinfo *ri,
+ grn_obj *table)
+{
+ int64_t *sum_address;
+
+ sum_address = grn_rset_recinfo_get_sum_(ctx, ri, table);
+ if (sum_address) {
+ return *sum_address;
+ } else {
+ return 0;
+ }
+}
+
+void
+grn_rset_recinfo_set_sum(grn_ctx *ctx,
+ grn_rset_recinfo *ri,
+ grn_obj *table,
+ int64_t sum)
+{
+ int64_t *sum_address;
+
+ sum_address = grn_rset_recinfo_get_sum_(ctx, ri, table);
+ if (!sum_address) {
+ return;
+ }
+
+ *sum_address = sum;
+}
+
+double *
+grn_rset_recinfo_get_avg_(grn_ctx *ctx,
+ grn_rset_recinfo *ri,
+ grn_obj *table)
+{
+ grn_table_group_flags flags;
+ byte *values;
+
+ flags = DB_OBJ(table)->flags.group;
+ if (!(flags & GRN_TABLE_GROUP_CALC_AVG)) {
+ return NULL;
+ }
+
+ values = (((byte *)ri->subrecs) +
+ GRN_RSET_SUBRECS_SIZE(DB_OBJ(table)->subrec_size,
+ DB_OBJ(table)->max_n_subrecs));
+
+ if (flags & GRN_TABLE_GROUP_CALC_MAX) {
+ values += GRN_RSET_MAX_SIZE;
+ }
+ if (flags & GRN_TABLE_GROUP_CALC_MIN) {
+ values += GRN_RSET_MIN_SIZE;
+ }
+ if (flags & GRN_TABLE_GROUP_CALC_SUM) {
+ values += GRN_RSET_SUM_SIZE;
+ }
+
+ return (double *)values;
+}
+
+double
+grn_rset_recinfo_get_avg(grn_ctx *ctx,
+ grn_rset_recinfo *ri,
+ grn_obj *table)
+{
+ double *avg_address;
+
+ avg_address = grn_rset_recinfo_get_avg_(ctx, ri, table);
+ if (avg_address) {
+ return *avg_address;
+ } else {
+ return 0;
+ }
+}
+
+void
+grn_rset_recinfo_set_avg(grn_ctx *ctx,
+ grn_rset_recinfo *ri,
+ grn_obj *table,
+ double avg)
+{
+ double *avg_address;
+
+ avg_address = grn_rset_recinfo_get_avg_(ctx, ri, table);
+ if (!avg_address) {
+ return;
+ }
+
+ *avg_address = avg;
+}
diff --git a/storage/mroonga/vendor/groonga/lib/scorer.c b/storage/mroonga/vendor/groonga/lib/scorer.c
new file mode 100644
index 00000000000..2670bb3d4c6
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/scorer.c
@@ -0,0 +1,189 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2015 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
+*/
+
+#include <string.h>
+
+#include "grn.h"
+#include "grn_db.h"
+#include "grn_scorer.h"
+#include <groonga/scorer.h>
+
+grn_obj *
+grn_scorer_matched_record_get_table(grn_ctx *ctx,
+ grn_scorer_matched_record *record)
+{
+ return record->table;
+}
+
+grn_obj *
+grn_scorer_matched_record_get_lexicon(grn_ctx *ctx,
+ grn_scorer_matched_record *record)
+{
+ return record->lexicon;
+}
+
+grn_id
+grn_scorer_matched_record_get_id(grn_ctx *ctx,
+ grn_scorer_matched_record *record)
+{
+ return record->id;
+}
+
+grn_obj *
+grn_scorer_matched_record_get_terms(grn_ctx *ctx,
+ grn_scorer_matched_record *record)
+{
+ return &(record->terms);
+}
+
+grn_obj *
+grn_scorer_matched_record_get_term_weights(grn_ctx *ctx,
+ grn_scorer_matched_record *record)
+{
+ return &(record->term_weights);
+}
+
+unsigned int
+grn_scorer_matched_record_get_total_term_weights(grn_ctx *ctx,
+ grn_scorer_matched_record *record)
+{
+ return record->total_term_weights;
+}
+
+long long unsigned int
+grn_scorer_matched_record_get_n_documents(grn_ctx *ctx,
+ grn_scorer_matched_record *record)
+{
+ return record->n_documents;
+}
+
+unsigned int
+grn_scorer_matched_record_get_n_occurrences(grn_ctx *ctx,
+ grn_scorer_matched_record *record)
+{
+ return record->n_occurrences;
+}
+
+long long unsigned int
+grn_scorer_matched_record_get_n_candidates(grn_ctx *ctx,
+ grn_scorer_matched_record *record)
+{
+ return record->n_candidates;
+}
+
+unsigned int
+grn_scorer_matched_record_get_n_tokens(grn_ctx *ctx,
+ grn_scorer_matched_record *record)
+{
+ return record->n_tokens;
+}
+
+int
+grn_scorer_matched_record_get_weight(grn_ctx *ctx,
+ grn_scorer_matched_record *record)
+{
+ return record->weight;
+}
+
+grn_obj *
+grn_scorer_matched_record_get_arg(grn_ctx *ctx,
+ grn_scorer_matched_record *record,
+ unsigned int i)
+{
+ grn_expr *expr;
+ grn_expr_code *codes_original;
+ uint32_t codes_curr_original;
+ grn_obj *arg;
+
+ if (!record->args_expr) {
+ return NULL;
+ }
+
+ expr = (grn_expr *)(record->args_expr);
+ /* TODO: support getting column value */
+ codes_original = expr->codes;
+ codes_curr_original = expr->codes_curr;
+ expr->codes += record->args_expr_offset;
+ expr->codes_curr = 1; /* TODO: support 1 or more codes */
+ arg = grn_expr_exec(ctx, (grn_obj *)expr, 0);
+ expr->codes_curr = codes_curr_original;
+ expr->codes = codes_original;
+
+ return arg;
+}
+
+unsigned int
+grn_scorer_matched_record_get_n_args(grn_ctx *ctx,
+ grn_scorer_matched_record *record)
+{
+ grn_expr *expr;
+ grn_expr_code *codes;
+ unsigned int n_args = 0;
+
+ if (!record->args_expr) {
+ return 0;
+ }
+
+ expr = (grn_expr *)(record->args_expr);
+ codes = expr->codes + record->args_expr_offset;
+ if (codes[0].op == GRN_OP_CALL) {
+ return 0;
+ }
+
+ n_args++;
+ for (; codes[0].op != GRN_OP_CALL; codes++) {
+ if (codes[0].op == GRN_OP_COMMA) {
+ n_args++;
+ }
+ }
+
+ return n_args;
+}
+
+grn_rc
+grn_scorer_register(grn_ctx *ctx,
+ const char *plugin_name_ptr,
+ int plugin_name_length,
+ grn_scorer_score_func *score)
+{
+ if (plugin_name_length == -1) {
+ plugin_name_length = strlen(plugin_name_ptr);
+ }
+
+ {
+ grn_obj *scorer_object = grn_proc_create(ctx,
+ plugin_name_ptr,
+ plugin_name_length,
+ GRN_PROC_SCORER,
+ NULL, NULL, NULL, 0, NULL);
+ if (scorer_object == NULL) {
+ GRN_PLUGIN_ERROR(ctx, GRN_SCORER_ERROR,
+ "[scorer][%.*s] failed to grn_proc_create()",
+ plugin_name_length, plugin_name_ptr);
+ return ctx->rc;
+ }
+
+ {
+ grn_proc *scorer = (grn_proc *)scorer_object;
+ scorer->callbacks.scorer.score = score;
+ }
+ }
+
+ return GRN_SUCCESS;
+}
+
diff --git a/storage/mroonga/vendor/groonga/lib/scorers.c b/storage/mroonga/vendor/groonga/lib/scorers.c
new file mode 100644
index 00000000000..dcec87c8ecc
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/scorers.c
@@ -0,0 +1,96 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2015 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
+*/
+
+#include "grn_db.h"
+
+#include <groonga/scorer.h>
+
+#include <math.h>
+
+static double
+scorer_tf_idf(grn_ctx *ctx, grn_scorer_matched_record *record)
+{
+ double min_score = 1.0;
+ double tf;
+ double n_all_documents;
+ double n_candidates;
+ double n_tokens;
+ double n_estimated_match_documents;
+
+ tf = grn_scorer_matched_record_get_n_occurrences(ctx, record) +
+ grn_scorer_matched_record_get_total_term_weights(ctx, record);
+ n_all_documents = grn_scorer_matched_record_get_n_documents(ctx, record);
+ n_candidates = grn_scorer_matched_record_get_n_candidates(ctx, record);
+ n_tokens = grn_scorer_matched_record_get_n_tokens(ctx, record);
+ n_estimated_match_documents = n_candidates / n_tokens;
+
+ if (n_estimated_match_documents >= n_all_documents) {
+ return min_score;
+ } else {
+ double idf;
+ double tf_idf;
+
+ idf = log(n_all_documents / n_estimated_match_documents);
+ tf_idf = tf * idf;
+ return fmax(tf_idf, min_score);
+ }
+}
+
+static double
+scorer_tf_at_most(grn_ctx *ctx, grn_scorer_matched_record *record)
+{
+ double tf;
+ double max;
+ grn_obj *max_raw;
+
+ tf = grn_scorer_matched_record_get_n_occurrences(ctx, record) +
+ grn_scorer_matched_record_get_total_term_weights(ctx, record);
+ max_raw = grn_scorer_matched_record_get_arg(ctx, record, 0);
+
+ if (!max_raw) {
+ return tf;
+ }
+
+ if (max_raw->header.type != GRN_BULK) {
+ return tf;
+ }
+
+ if (max_raw->header.domain == GRN_DB_FLOAT) {
+ max = GRN_FLOAT_VALUE(max_raw);
+ } else {
+ grn_obj casted_max_raw;
+ GRN_FLOAT_INIT(&casted_max_raw, 0);
+ if (grn_obj_cast(ctx, max_raw, &casted_max_raw, GRN_FALSE) != GRN_SUCCESS) {
+ GRN_OBJ_FIN(ctx, &casted_max_raw);
+ return tf;
+ } else {
+ max = GRN_FLOAT_VALUE(&casted_max_raw);
+ }
+ GRN_OBJ_FIN(ctx, &casted_max_raw);
+ }
+
+ return fmin(tf, max);
+}
+
+grn_rc
+grn_db_init_builtin_scorers(grn_ctx *ctx)
+{
+ grn_scorer_register(ctx, "scorer_tf_idf", -1, scorer_tf_idf);
+ grn_scorer_register(ctx, "scorer_tf_at_most", -1, scorer_tf_at_most);
+ return GRN_SUCCESS;
+}
diff --git a/storage/mroonga/vendor/groonga/lib/snip.c b/storage/mroonga/vendor/groonga/lib/snip.c
index 78c6ef54387..da5ba704c85 100644
--- a/storage/mroonga/vendor/groonga/lib/snip.c
+++ b/storage/mroonga/vendor/groonga/lib/snip.c
@@ -14,11 +14,11 @@
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 "groonga_in.h"
+#include "grn.h"
#include <string.h>
#include <stddef.h>
-#include "snip.h"
-#include "ctx.h"
+#include "grn_snip.h"
+#include "grn_ctx.h"
#if !defined MAX
#define MAX(a, b) ((a) > (b) ? (a) : (b))
@@ -306,7 +306,7 @@ grn_snip_strndup(grn_ctx *ctx, const char *string, unsigned int string_len)
if (!copied_string) {
return NULL;
}
- memcpy(copied_string, string, string_len);
+ grn_memcpy(copied_string, string, string_len);
copied_string[string_len]= '\0'; /* not required, but for ql use */
return copied_string;
}
@@ -775,7 +775,9 @@ grn_snip_get_result(grn_ctx *ctx, grn_obj *snip, const unsigned int index, char
if (snip_->tag_result[j].end_offset > sres->end_offset) {
continue;
}
- memcpy(p, snip_->tag_result[j].cond->opentag, snip_->tag_result[j].cond->opentag_len);
+ grn_memcpy(p,
+ snip_->tag_result[j].cond->opentag,
+ snip_->tag_result[j].cond->opentag_len);
p += snip_->tag_result[j].cond->opentag_len;
}
@@ -820,8 +822,9 @@ grn_snip_get_result(grn_ctx *ctx, grn_obj *snip, const unsigned int index, char
snip_->tag_result[k].end_offset <= sres->end_offset; k--) {
/* TODO: avoid all loop */
if (snip_->tag_result[k].end_offset == i + 1) {
- memcpy(p, snip_->tag_result[k].cond->closetag,
- snip_->tag_result[k].cond->closetag_len);
+ grn_memcpy(p,
+ snip_->tag_result[k].cond->closetag,
+ snip_->tag_result[k].cond->closetag_len);
p += snip_->tag_result[k].cond->closetag_len;
}
if (k <= sres->first_tag_result_idx) {
diff --git a/storage/mroonga/vendor/groonga/lib/sources.am b/storage/mroonga/vendor/groonga/lib/sources.am
index 8b371081fe6..459b73792ab 100644
--- a/storage/mroonga/vendor/groonga/lib/sources.am
+++ b/storage/mroonga/vendor/groonga/lib/sources.am
@@ -1,52 +1,68 @@
libgroonga_la_SOURCES = \
com.c \
- com.h \
+ grn_com.h \
+ command.c \
ctx.c \
- ctx.h \
- ctx_impl.h \
+ grn_ctx.h \
+ grn_ctx_impl.h \
ctx_impl_mrb.c \
- ctx_impl_mrb.h \
+ grn_ctx_impl_mrb.h \
dat.cpp \
- dat.h \
+ grn_dat.h \
db.c \
- db.h \
+ grn_db.h \
error.c \
- error.h \
+ grn_error.h \
expr.c \
- expr.h \
+ grn_expr.h \
geo.c \
- geo.h \
- groonga_in.h \
+ grn_geo.h \
+ grn.h \
hash.c \
- hash.h \
+ grn_hash.h \
ii.c \
- ii.h \
+ grn_ii.h \
io.c \
- io.h \
+ grn_io.h \
+ logger.c \
+ grn_logger.h \
mrb.c \
- mrb.h \
+ grn_mrb.h \
+ grn_msgpack.h \
nfkc.c \
normalizer.c \
- normalizer_in.h \
+ grn_normalizer.h \
+ obj.c \
+ operator.c \
output.c \
- output.h \
+ grn_output.h \
pat.c \
- pat.h \
+ grn_pat.h \
plugin.c \
- plugin_in.h \
+ grn_plugin.h \
proc.c \
- proc.h \
+ grn_proc.h \
+ request_canceler.c \
+ grn_request_canceler.h \
+ rset.c \
+ grn_rset.h \
+ scorer.c \
+ grn_scorer.h \
+ scorers.c \
+ grn_scorers.h \
snip.c \
- snip.h \
+ grn_snip.h \
store.c \
- store.h \
+ grn_store.h \
str.c \
- str.h \
+ grn_str.h \
string.c \
- string_in.h \
- token.c \
- token.h \
+ grn_string.h \
+ token_cursor.c \
+ grn_token_cursor.h \
tokenizer.c \
+ tokenizers.c \
+ grn_tokenizers.h \
token_filter.c \
util.c \
- util.h
+ grn_util.h
diff --git a/storage/mroonga/vendor/groonga/lib/store.c b/storage/mroonga/vendor/groonga/lib/store.c
index 3649611a560..027f86baac8 100644
--- a/storage/mroonga/vendor/groonga/lib/store.c
+++ b/storage/mroonga/vendor/groonga/lib/store.c
@@ -1,5 +1,5 @@
/* -*- c-basic-offset: 2 -*- */
-/* Copyright(C) 2009-2014 Brazil
+/* Copyright(C) 2009-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -14,11 +14,11 @@
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 "groonga_in.h"
-#include "str.h"
-#include "store.h"
-#include "ctx_impl.h"
-#include "output.h"
+#include "grn.h"
+#include "grn_str.h"
+#include "grn_store.h"
+#include "grn_ctx_impl.h"
+#include "grn_output.h"
#include <string.h>
/* rectangular arrays */
@@ -338,8 +338,6 @@ struct grn_ja_header {
#define SEGMENTS_GINFO_ON(ja,seg,width) (SEGMENTS_AT(ja,seg) = SEG_GINFO|(width))
#define SEGMENTS_OFF(ja,seg) (SEGMENTS_AT(ja,seg) = 0)
-grn_bool grn_ja_skip_same_value_put = GRN_TRUE;
-
static grn_ja *
_grn_ja_create(grn_ctx *ctx, grn_ja *ja, const char *path,
unsigned int max_element_size, uint32_t flags)
@@ -524,7 +522,7 @@ grn_ja_ref_raw(grn_ctx *ctx, grn_ja *ja, grn_id id, grn_io_win *iw, uint32_t *va
iw->size = 0;
iw->addr = NULL;
iw->pseg = pseg;
- iw->value = NULL;
+ iw->uncompressed_value = NULL;
if (pseg != JA_ESEG_VOID) {
grn_ja_einfo *einfo = NULL;
GRN_IO_SEG_REF(ja->io, pseg, einfo);
@@ -545,7 +543,7 @@ grn_ja_ref_raw(grn_ctx *ctx, grn_ja *ja, grn_id id, grn_io_win *iw, uint32_t *va
} else {
EINFO_DEC(ei, jag, vpos, vsize);
}
- grn_io_win_map2(ja->io, ctx, iw, jag, vpos, vsize, grn_io_rdonly);
+ grn_io_win_map(ja->io, ctx, iw, jag, vpos, vsize, grn_io_rdonly);
}
if (!iw->addr) { GRN_IO_SEG_UNREF(ja->io, pseg); }
}
@@ -557,13 +555,13 @@ grn_ja_ref_raw(grn_ctx *ctx, grn_ja *ja, grn_id id, grn_io_win *iw, uint32_t *va
grn_rc
grn_ja_unref(grn_ctx *ctx, grn_io_win *iw)
{
- if (iw->value) {
- GRN_FREE(iw->value);
- iw->value = NULL;
+ if (iw->uncompressed_value) {
+ GRN_FREE(iw->uncompressed_value);
+ iw->uncompressed_value = NULL;
} else {
if (!iw->addr) { return GRN_INVALID_ARGUMENT; }
GRN_IO_SEG_UNREF(iw->io, iw->pseg);
- if (!iw->tiny_p) { grn_io_win_unmap2(iw); }
+ if (!iw->tiny_p) { grn_io_win_unmap(iw); }
}
return GRN_SUCCESS;
}
@@ -711,7 +709,7 @@ exit :
#define JA_N_GARBAGES_TH 10
-// todo : grn_io_win_map2 cause verbose copy when nseg > 1, it should be copied directly.
+// todo : grn_io_win_map cause verbose copy when nseg > 1, it should be copied directly.
static grn_rc
grn_ja_alloc(grn_ctx *ctx, grn_ja *ja, grn_id id,
uint32_t element_size, grn_ja_einfo *einfo, grn_io_win *iw)
@@ -736,7 +734,7 @@ grn_ja_alloc(grn_ctx *ctx, grn_ja *ja, grn_id id,
} else {
if (i == j + n) {
j++;
- addr = grn_io_win_map2(ja->io, ctx, iw, j, 0, element_size, grn_io_wronly);
+ addr = grn_io_win_map(ja->io, ctx, iw, j, 0, element_size, grn_io_wronly);
if (!addr) {
grn_io_unlock(ja->io);
return GRN_NO_MEMORY_AVAILABLE;
@@ -864,7 +862,7 @@ grn_ja_alloc(grn_ctx *ctx, grn_ja *ja, grn_id id,
vp->seg = 0;
vp->pos = 0;
}
- iw->value = NULL;
+ iw->uncompressed_value = NULL;
grn_io_unlock(ja->io);
return GRN_SUCCESS;
}
@@ -881,13 +879,13 @@ set_value(grn_ctx *ctx, grn_ja *ja, grn_id id, void *value, uint32_t value_len,
if ((rc = grn_ja_alloc(ctx, ja, id, value_len + sizeof(uint32_t), einfo, &iw))) {
return rc;
}
- memcpy(iw.addr, value, value_len);
+ grn_memcpy(iw.addr, value, value_len);
memset((byte *)iw.addr + value_len, 0, sizeof(uint32_t));
- grn_io_win_unmap2(&iw);
+ grn_io_win_unmap(&iw);
} else {
if ((rc = grn_ja_alloc(ctx, ja, id, value_len, einfo, &iw))) { return rc; }
- memcpy(iw.addr, value, value_len);
- grn_io_win_unmap2(&iw);
+ grn_memcpy(iw.addr, value, value_len);
+ grn_io_win_unmap(&iw);
}
return rc;
}
@@ -901,8 +899,7 @@ grn_ja_put_raw(grn_ctx *ctx, grn_ja *ja, grn_id id,
grn_io_win iw;
grn_ja_einfo einfo;
- if (grn_ja_skip_same_value_put &&
- (flags & GRN_OBJ_SET_MASK) == GRN_OBJ_SET &&
+ if ((flags & GRN_OBJ_SET_MASK) == GRN_OBJ_SET &&
value_len > 0) {
grn_io_win jw;
uint32_t old_len;
@@ -935,11 +932,11 @@ grn_ja_put_raw(grn_ctx *ctx, grn_ja *ja, grn_id id,
GRN_ASSERT(pos < el);
if (el <= pos + value_len) {
uint32_t rest = el - pos;
- memcpy(b + pos, value, rest);
- memcpy(b, (byte *)value + rest, value_len - rest);
+ grn_memcpy(b + pos, value, rest);
+ grn_memcpy(b, (byte *)value + rest, value_len - rest);
*((uint32_t *)(b + el)) = value_len - rest;
} else {
- memcpy(b + pos, value, value_len);
+ grn_memcpy(b + pos, value, value_len);
*((uint32_t *)(b + el)) = pos + value_len;
}
return GRN_SUCCESS;
@@ -950,19 +947,19 @@ grn_ja_put_raw(grn_ctx *ctx, grn_ja *ja, grn_id id,
grn_ja_unref(ctx, &jw);
return rc;
}
- memcpy(iw.addr, oldvalue, old_len);
- memcpy((byte *)iw.addr + old_len, value, value_len);
+ grn_memcpy(iw.addr, oldvalue, old_len);
+ grn_memcpy((byte *)iw.addr + old_len, value, value_len);
memset((byte *)iw.addr + old_len + value_len, 0, sizeof(uint32_t));
- grn_io_win_unmap2(&iw);
+ grn_io_win_unmap(&iw);
}
} else {
if ((rc = grn_ja_alloc(ctx, ja, id, value_len + old_len, &einfo, &iw))) {
grn_ja_unref(ctx, &jw);
return rc;
}
- memcpy(iw.addr, oldvalue, old_len);
- memcpy((byte *)iw.addr + old_len, value, value_len);
- grn_io_win_unmap2(&iw);
+ grn_memcpy(iw.addr, oldvalue, old_len);
+ grn_memcpy((byte *)iw.addr + old_len, value, value_len);
+ grn_io_win_unmap(&iw);
}
grn_ja_unref(ctx, &jw);
} else {
@@ -985,11 +982,11 @@ grn_ja_put_raw(grn_ctx *ctx, grn_ja *ja, grn_id id,
GRN_ASSERT(pos < el);
if (pos < value_len) {
uint32_t rest = value_len - pos;
- memcpy(b, (byte *)value + rest, pos);
- memcpy(b + el - rest, value, rest);
+ grn_memcpy(b, (byte *)value + rest, pos);
+ grn_memcpy(b + el - rest, value, rest);
*((uint32_t *)(b + el)) = el - rest;
} else {
- memcpy(b + pos - value_len, value, value_len);
+ grn_memcpy(b + pos - value_len, value, value_len);
*((uint32_t *)(b + el)) = pos - value_len;
}
return GRN_SUCCESS;
@@ -1000,19 +997,19 @@ grn_ja_put_raw(grn_ctx *ctx, grn_ja *ja, grn_id id,
grn_ja_unref(ctx, &jw);
return rc;
}
- memcpy(iw.addr, value, value_len);
- memcpy((byte *)iw.addr + value_len, oldvalue, old_len);
+ grn_memcpy(iw.addr, value, value_len);
+ grn_memcpy((byte *)iw.addr + value_len, oldvalue, old_len);
memset((byte *)iw.addr + value_len + old_len, 0, sizeof(uint32_t));
- grn_io_win_unmap2(&iw);
+ grn_io_win_unmap(&iw);
}
} else {
if ((rc = grn_ja_alloc(ctx, ja, id, value_len + old_len, &einfo, &iw))) {
grn_ja_unref(ctx, &jw);
return rc;
}
- memcpy(iw.addr, value, value_len);
- memcpy((byte *)iw.addr + value_len, oldvalue, old_len);
- grn_io_win_unmap2(&iw);
+ grn_memcpy(iw.addr, value, value_len);
+ grn_memcpy((byte *)iw.addr + value_len, oldvalue, old_len);
+ grn_io_win_unmap(&iw);
}
grn_ja_unref(ctx, &jw);
} else {
@@ -1100,10 +1097,14 @@ grn_ja_putv(grn_ctx *ctx, grn_ja *ja, grn_id id, grn_obj *vector, int flags)
size_t sizev = body ? GRN_BULK_VSIZE(body) : 0;
size_t sizef = GRN_BULK_VSIZE(&footer);
if ((rc = grn_ja_alloc(ctx, ja, id, sizeh + sizev + sizef, &einfo, &iw))) { goto exit; }
- memcpy(iw.addr, GRN_BULK_HEAD(&header), sizeh);
- if (body) { memcpy((char *)iw.addr + sizeh, GRN_BULK_HEAD(body), sizev); }
- if (f) { memcpy((char *)iw.addr + sizeh + sizev, GRN_BULK_HEAD(&footer), sizef); }
- grn_io_win_unmap2(&iw);
+ grn_memcpy(iw.addr, GRN_BULK_HEAD(&header), sizeh);
+ if (body) {
+ grn_memcpy((char *)iw.addr + sizeh, GRN_BULK_HEAD(body), sizev);
+ }
+ if (f) {
+ grn_memcpy((char *)iw.addr + sizeh + sizev, GRN_BULK_HEAD(&footer), sizef);
+ }
+ grn_io_win_unmap(&iw);
rc = grn_ja_replace(ctx, ja, id, &einfo, NULL);
}
exit :
@@ -1187,7 +1188,7 @@ grn_ja_ref_zlib(grn_ctx *ctx, grn_ja *ja, grn_id id, grn_io_win *iw, uint32_t *v
void *zvalue;
uint32_t zvalue_len;
if (!(zvalue = grn_ja_ref_raw(ctx, ja, id, iw, &zvalue_len))) {
- iw->value = NULL;
+ iw->uncompressed_value = NULL;
*value_len = 0;
return NULL;
}
@@ -1196,74 +1197,74 @@ grn_ja_ref_zlib(grn_ctx *ctx, grn_ja *ja, grn_id id, grn_io_win *iw, uint32_t *v
zstream.zalloc = Z_NULL;
zstream.zfree = Z_NULL;
if (inflateInit2(&zstream, 15 /* windowBits */) != Z_OK) {
- iw->value = NULL;
+ iw->uncompressed_value = NULL;
*value_len = 0;
return NULL;
}
- if (!(iw->value = GRN_MALLOC(*((uint64_t *)zvalue)))) {
+ if (!(iw->uncompressed_value = GRN_MALLOC(*((uint64_t *)zvalue)))) {
inflateEnd(&zstream);
- iw->value = NULL;
+ iw->uncompressed_value = NULL;
*value_len = 0;
return NULL;
}
- zstream.next_out = (Bytef *)iw->value;
+ zstream.next_out = (Bytef *)iw->uncompressed_value;
zstream.avail_out = *(uint64_t *)zvalue;
if (inflate(&zstream, Z_FINISH) != Z_STREAM_END) {
inflateEnd(&zstream);
- GRN_FREE(iw->value);
- iw->value = NULL;
+ GRN_FREE(iw->uncompressed_value);
+ iw->uncompressed_value = NULL;
*value_len = 0;
return NULL;
}
*value_len = zstream.total_out;
if (inflateEnd(&zstream) != Z_OK) {
- GRN_FREE(iw->value);
- iw->value = NULL;
+ GRN_FREE(iw->uncompressed_value);
+ iw->uncompressed_value = NULL;
*value_len = 0;
return NULL;
}
- return iw->value;
+ return iw->uncompressed_value;
}
#endif /* GRN_WITH_ZLIB */
-#ifdef GRN_WITH_LZO
-#include <lzo/lzo1x.h>
+#ifdef GRN_WITH_LZ4
+#include <lz4.h>
static void *
-grn_ja_ref_lzo(grn_ctx *ctx, grn_ja *ja, grn_id id, grn_io_win *iw, uint32_t *value_len)
+grn_ja_ref_lz4(grn_ctx *ctx, grn_ja *ja, grn_id id, grn_io_win *iw, uint32_t *value_len)
{
- void *lvalue;
- uint32_t lvalue_len;
- lzo_uint lout_len;
- if (!(lvalue = grn_ja_ref_raw(ctx, ja, id, iw, &lvalue_len))) {
- iw->value = NULL;
+ void *packed_value;
+ int packed_value_len;
+ void *lz4_value;
+ int lz4_value_len;
+ int original_value_len;
+
+ if (!(packed_value = grn_ja_ref_raw(ctx, ja, id, iw, &packed_value_len))) {
+ iw->uncompressed_value = NULL;
*value_len = 0;
return NULL;
}
- if (!(iw->value = GRN_MALLOC(*((uint64_t *)lvalue)))) {
- iw->value = NULL;
+ original_value_len = *((uint64_t *)packed_value);
+ if (!(iw->uncompressed_value = GRN_MALLOC(original_value_len))) {
+ iw->uncompressed_value = NULL;
*value_len = 0;
return NULL;
}
- lout_len = *((uint64_t *)lvalue);
- switch (lzo1x_decompress((lzo_bytep)(((uint64_t *)lvalue) + 1),
- lvalue_len,
- (lzo_bytep)(iw->value),
- &lout_len,
- NULL)) {
- case LZO_E_OK :
- case LZO_E_INPUT_NOT_CONSUMED :
- break;
- default :
- GRN_FREE(iw->value);
- iw->value = NULL;
+ lz4_value = (void *)((uint64_t *)packed_value + 1);
+ lz4_value_len = packed_value_len - sizeof(uint64_t);
+ if (LZ4_decompress_safe((const char *)(lz4_value),
+ (char *)(iw->uncompressed_value),
+ lz4_value_len,
+ original_value_len) < 0) {
+ GRN_FREE(iw->uncompressed_value);
+ iw->uncompressed_value = NULL;
*value_len = 0;
return NULL;
}
- *value_len = lout_len;
- return iw->value;
+ *value_len = original_value_len;
+ return iw->uncompressed_value;
}
-#endif /* GRN_WITH_LZO */
+#endif /* GRN_WITH_LZ4 */
void *
grn_ja_ref(grn_ctx *ctx, grn_ja *ja, grn_id id, grn_io_win *iw, uint32_t *value_len)
@@ -1273,11 +1274,11 @@ grn_ja_ref(grn_ctx *ctx, grn_ja *ja, grn_id id, grn_io_win *iw, uint32_t *value_
return grn_ja_ref_zlib(ctx, ja, id, iw, value_len);
}
#endif /* GRN_WITH_ZLIB */
-#ifdef GRN_WITH_LZO
- if (ja->header->flags & GRN_OBJ_COMPRESS_LZO) {
- return grn_ja_ref_lzo(ctx, ja, id, iw, value_len);
+#ifdef GRN_WITH_LZ4
+ if (ja->header->flags & GRN_OBJ_COMPRESS_LZ4) {
+ return grn_ja_ref_lz4(ctx, ja, id, iw, value_len);
}
-#endif /* GRN_WITH_LZO */
+#endif /* GRN_WITH_LZ4 */
return grn_ja_ref_raw(ctx, ja, id, iw, value_len);
}
@@ -1359,34 +1360,48 @@ grn_ja_put_zlib(grn_ctx *ctx, grn_ja *ja, grn_id id,
}
#endif /* GRN_WITH_ZLIB */
-#ifdef GRN_WITH_LZO
+#ifdef GRN_WITH_LZ4
inline static grn_rc
-grn_ja_put_lzo(grn_ctx *ctx, grn_ja *ja, grn_id id,
+grn_ja_put_lz4(grn_ctx *ctx, grn_ja *ja, grn_id id,
void *value, uint32_t value_len, int flags, uint64_t *cas)
{
grn_rc rc;
- void *lvalue, *lwork;
- lzo_uint lvalue_len = value_len + value_len / 16 + 64 + 3;
+ void *packed_value;
+ int packed_value_len;
+ char *lz4_value;
+ int lz4_value_len;
if (value_len == 0) {
return grn_ja_put_raw(ctx, ja, id, value, value_len, flags, cas);
}
- if (!(lvalue = GRN_MALLOC(lvalue_len + sizeof(uint64_t)))) { return GRN_NO_MEMORY_AVAILABLE; }
- if (!(lwork = GRN_MALLOC(LZO1X_1_MEM_COMPRESS))) { GRN_FREE(lvalue); return GRN_NO_MEMORY_AVAILABLE; }
- if (lzo1x_1_compress(value, value_len, (lzo_bytep)((uint64_t *)lvalue + 1), &lvalue_len, lwork) != LZO_E_OK) {
- GRN_FREE(lwork);
- GRN_FREE(lvalue);
- ERR(GRN_LZO_ERROR, "lzo1x_1_compress");
+ if (value_len > (uint32_t)LZ4_MAX_INPUT_SIZE) {
+ ERR(GRN_INVALID_ARGUMENT,
+ "[ja][lz4] too large value size: <%u>: max: <%d>",
+ value_len, LZ4_MAX_INPUT_SIZE);
+ return ctx->rc;
+ }
+
+ lz4_value_len = LZ4_compressBound(value_len);
+
+ if (!(packed_value = GRN_MALLOC(lz4_value_len + sizeof(uint64_t)))) {
+ return GRN_NO_MEMORY_AVAILABLE;
+ }
+ lz4_value = (char *)((uint64_t *)packed_value + 1);
+ lz4_value_len = LZ4_compress((const char*)value, lz4_value, value_len);
+
+ if (lz4_value_len <= 0) {
+ GRN_FREE(packed_value);
+ ERR(GRN_LZ4_ERROR, "LZ4_compress");
return ctx->rc;
}
- GRN_FREE(lwork);
- *(uint64_t *)lvalue = value_len;
- rc = grn_ja_put_raw(ctx, ja, id, lvalue, lvalue_len + sizeof(uint64_t), flags, cas);
- GRN_FREE(lvalue);
+ *(uint64_t *)packed_value = value_len;
+ packed_value_len = lz4_value_len + sizeof(uint64_t);
+ rc = grn_ja_put_raw(ctx, ja, id, packed_value, packed_value_len, flags, cas);
+ GRN_FREE(packed_value);
return rc;
}
-#endif /* GRN_WITH_LZO */
+#endif /* GRN_WITH_LZ4 */
grn_rc
grn_ja_put(grn_ctx *ctx, grn_ja *ja, grn_id id, void *value, uint32_t value_len,
@@ -1397,11 +1412,11 @@ grn_ja_put(grn_ctx *ctx, grn_ja *ja, grn_id id, void *value, uint32_t value_len,
return grn_ja_put_zlib(ctx, ja, id, value, value_len, flags, cas);
}
#endif /* GRN_WITH_ZLIB */
-#ifdef GRN_WITH_LZO
- if (ja->header->flags & GRN_OBJ_COMPRESS_LZO) {
- return grn_ja_put_lzo(ctx, ja, id, value, value_len, flags, cas);
+#ifdef GRN_WITH_LZ4
+ if (ja->header->flags & GRN_OBJ_COMPRESS_LZ4) {
+ return grn_ja_put_lz4(ctx, ja, id, value, value_len, flags, cas);
}
-#endif /* GRN_WITH_LZO */
+#endif /* GRN_WITH_LZ4 */
return grn_ja_put_raw(ctx, ja, id, value, value_len, flags, cas);
}
diff --git a/storage/mroonga/vendor/groonga/lib/str.c b/storage/mroonga/vendor/groonga/lib/str.c
index 29e532a8021..1bbe43a591c 100644
--- a/storage/mroonga/vendor/groonga/lib/str.c
+++ b/storage/mroonga/vendor/groonga/lib/str.c
@@ -1,5 +1,5 @@
/* -*- c-basic-offset: 2 -*- */
-/* Copyright(C) 2009-2013 Brazil
+/* Copyright(C) 2009-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -14,19 +14,27 @@
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 "groonga_in.h"
+#include "grn.h"
#include <limits.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
-#include "db.h"
-#include "str.h"
+#include "grn_db.h"
+#include "grn_str.h"
#ifndef _ISOC99_SOURCE
#define _ISOC99_SOURCE
#endif /* _ISOC99_SOURCE */
#include <math.h>
+#if defined(HAVE__GMTIME64_S) && defined(__GNUC__)
+# ifdef _WIN64
+# define gmtime_s(tm, time) _gmtime64_s(tm, time)
+# else /* _WIN64 */
+# define gmtime_s(tm, time) _gmtime32_s(tm, time)
+# endif /* _WIN64 */
+#endif /* defined(HAVE__GMTIME64_S) && defined(__GNUC__) */
+
/* For Visual C++ 2010. Drop the code when we drop Visual C++ 2010 support. */
#if defined(_MSC_VER) && _MSC_VER < 1800
# define va_copy(destination, source) destination = source
@@ -530,7 +538,7 @@ normalize_utf8(grn_ctx *ctx, grn_str *nstr)
nstr->ctypes = ctypes;
}
}
- memcpy(d, p, lp);
+ grn_memcpy(d, p, lp);
d_ = d;
d += lp;
length++;
@@ -1146,7 +1154,7 @@ grn_fakenstr_open(grn_ctx *ctx, const char *str, size_t str_len, grn_encoding en
}
nstr->orig = str;
nstr->orig_blen = str_len;
- memcpy(nstr->norm, str, str_len);
+ grn_memcpy(nstr->norm, str, str_len);
nstr->norm[str_len] = '\0';
nstr->norm_blen = str_len;
nstr->ctypes = NULL;
@@ -1492,6 +1500,20 @@ grn_atoll(const char *nptr, const char *end, const char **rest)
return n ? -v : v;
}
+uint64_t
+grn_atoull(const char *nptr, const char *end, const char **rest)
+{
+ uint64_t v = 0, t;
+ while (nptr < end && *nptr >= '0' && *nptr <= '9') {
+ t = v * 10 + (*nptr - '0');
+ if (t < v) { v = 0; break; }
+ v = t;
+ nptr++;
+ }
+ if (rest) { *rest = nptr; }
+ return v;
+}
+
unsigned int
grn_htoui(const char *nptr, const char *end, const char **rest)
{
@@ -1916,7 +1938,7 @@ grn_bulk_resize(grn_ctx *ctx, grn_obj *buf, unsigned int newsize)
if (rounded_newsize < newsize) { return GRN_NOT_ENOUGH_SPACE; }
newsize = rounded_newsize;
if (!(head = GRN_MALLOC(newsize))) { return GRN_NO_MEMORY_AVAILABLE; }
- memcpy(head, GRN_BULK_HEAD(buf), GRN_BULK_VSIZE(buf));
+ grn_memcpy(head, GRN_BULK_HEAD(buf), GRN_BULK_VSIZE(buf));
buf->u.b.curr = head + grn_bulk_margin_size + GRN_BULK_VSIZE(buf);
buf->u.b.head = head + grn_bulk_margin_size;
buf->u.b.tail = head + newsize;
@@ -1942,7 +1964,7 @@ grn_bulk_write(grn_ctx *ctx, grn_obj *buf, const char *str, unsigned int len)
if ((rc = grn_bulk_resize(ctx, buf, GRN_BULK_VSIZE(buf) + len))) { return rc; }
}
curr = GRN_BULK_CURR(buf);
- memcpy(curr, str, len);
+ grn_memcpy(curr, str, len);
GRN_BULK_INCR_LEN(buf, len);
return rc;
}
@@ -2074,26 +2096,30 @@ grn_text_ulltoa(grn_ctx *ctx, grn_obj *buf, unsigned long long int i)
inline static void
ftoa_(grn_ctx *ctx, grn_obj *buf, double d)
{
- char *curr;
+ char *start;
+ size_t before_size;
size_t len;
#define DIGIT_NUMBER 15
- grn_bulk_reserve(ctx, buf, DIGIT_NUMBER + 1);
- curr = GRN_BULK_CURR(buf);
- len = sprintf(curr, "%#.*g", DIGIT_NUMBER, d);
+#define FIRST_BUFFER_SIZE (DIGIT_NUMBER + 4)
+ before_size = GRN_BULK_VSIZE(buf);
+ grn_bulk_reserve(ctx, buf, FIRST_BUFFER_SIZE);
+ grn_text_printf(ctx, buf, "%#.*g", DIGIT_NUMBER, d);
+ len = GRN_BULK_VSIZE(buf) - before_size;
+ start = GRN_BULK_CURR(buf) - len;
+#undef FIRST_BUFFER_SIZE
#undef DIGIT_NUMBER
- if (curr[len - 1] == '.') {
- GRN_BULK_INCR_LEN(buf, len);
+ if (start[len - 1] == '.') {
GRN_TEXT_PUTC(ctx, buf, '0');
} else {
char *p, *q;
- curr[len] = '\0';
- if ((p = strchr(curr, 'e'))) {
+ start[len] = '\0';
+ if ((p = strchr(start, 'e'))) {
for (q = p; *(q - 2) != '.' && *(q - 1) == '0'; q--) { len--; }
- memmove(q, p, curr + len - q);
+ grn_memmove(q, p, start + len - q);
} else {
- for (q = curr + len; *(q - 2) != '.' && *(q - 1) == '0'; q--) { len--; }
+ for (q = start + len; *(q - 2) != '.' && *(q - 1) == '0'; q--) { len--; }
}
- GRN_BULK_INCR_LEN(buf, len);
+ grn_bulk_truncate(ctx, buf, before_size + len);
}
}
@@ -2441,14 +2467,20 @@ grn_text_time2rfc1123(grn_ctx *ctx, grn_obj *bulk, int sec)
{
time_t tsec;
struct tm *t;
-#ifdef HAVE_GMTIME_R
+#ifdef HAVE__GMTIME64_S
+ struct tm tm;
+ tsec = (time_t)sec;
+ t = (gmtime_s(&tm, &tsec) == 0) ? &tm : NULL;
+#else /* HAVE__GMTIME64_S */
+# ifdef HAVE_GMTIME_R
struct tm tm;
tsec = (time_t)sec;
t = gmtime_r(&tsec, &tm);
-#else /* HAVE_GMTIME_R */
+# else /* HAVE_GMTIME_R */
tsec = (time_t)sec;
t = gmtime(&tsec);
-#endif /* HAVE_GMTIME_R */
+# endif /* HAVE_GMTIME_R */
+#endif /* HAVE__GMTIME64_S */
if (t) {
GRN_TEXT_SET(ctx, bulk, weekdays[t->tm_wday], 3);
GRN_TEXT_PUTS(ctx, bulk, ", ");
@@ -2485,9 +2517,11 @@ grn_text_printf(grn_ctx *ctx, grn_obj *bulk, const char *format, ...)
grn_rc
grn_text_vprintf(grn_ctx *ctx, grn_obj *bulk, const char *format, va_list args)
{
- int rest_size, written_size;
+ grn_bool is_written = GRN_FALSE;
+ int written_size;
{
+ int rest_size;
va_list copied_args;
rest_size = GRN_BULK_REST(bulk);
@@ -2495,9 +2529,43 @@ grn_text_vprintf(grn_ctx *ctx, grn_obj *bulk, const char *format, va_list args)
written_size = vsnprintf(GRN_BULK_CURR(bulk), rest_size,
format, copied_args);
va_end(copied_args);
+
+ if (written_size < rest_size) {
+ is_written = GRN_TRUE;
+ }
}
- if (written_size >= rest_size) {
+#ifdef WIN32
+ if (written_size == -1 && errno == ERANGE) {
+# define N_NEW_SIZES 3
+ int i;
+ int new_sizes[N_NEW_SIZES];
+
+ new_sizes[0] = GRN_BULK_REST(bulk) + strlen(format) * 2;
+ new_sizes[1] = new_sizes[0] + 4096;
+ new_sizes[2] = new_sizes[0] + 65536;
+
+ for (i = 0; i < N_NEW_SIZES; i++) {
+ grn_rc rc;
+ int new_size = new_sizes[i];
+ va_list copied_args;
+
+ rc = grn_bulk_reserve(ctx, bulk, GRN_BULK_VSIZE(bulk) + new_size);
+ if (rc) {
+ return rc;
+ }
+ va_copy(copied_args, args);
+ written_size = vsnprintf(GRN_BULK_CURR(bulk), new_size,
+ format, copied_args);
+ va_end(copied_args);
+ if (written_size != -1) {
+ break;
+ }
+ }
+# undef N_NEW_SIZES
+ }
+#else /* WIN32 */
+ if (!is_written) {
grn_rc rc;
int required_size = written_size + 1; /* "+ 1" for terminate '\0'. */
@@ -2508,6 +2576,7 @@ grn_text_vprintf(grn_ctx *ctx, grn_obj *bulk, const char *format, va_list args)
written_size = vsnprintf(GRN_BULK_CURR(bulk), required_size,
format, args);
}
+#endif /* WIN32 */
if (written_size < 0) {
return GRN_INVALID_ARGUMENT;
@@ -2576,10 +2645,10 @@ grn_text_atoj(grn_ctx *ctx, grn_obj *bulk, grn_obj *obj, grn_id id)
buf.header.domain = GRN_DB_INT32; /* fix me */
break;
case GRN_ACCESSOR_GET_SCORE :
- grn_obj_get_value(ctx, a->obj, id, &buf);
{
grn_rset_recinfo *ri = (grn_rset_recinfo *)grn_obj_get_value_(ctx, a->obj, id, &vs);
- GRN_INT32_PUT(ctx, &buf, ri->score);
+ int32_t int32_score = ri->score;
+ GRN_INT32_PUT(ctx, &buf, int32_score);
}
buf.header.domain = GRN_DB_INT32;
break;
@@ -2941,6 +3010,8 @@ grn_text_otoj(grn_ctx *ctx, grn_obj *bulk, grn_obj *obj, grn_obj_format *format)
}
}
GRN_TEXT_PUTC(ctx, bulk, ']');
+ GRN_OBJ_FIN(ctx, &value);
+ GRN_OBJ_FIN(ctx, &weight);
}
break;
case GRN_PVECTOR :
@@ -3140,7 +3211,7 @@ grn_str_url_path_normalize(grn_ctx *ctx, const char *path, size_t path_len,
}
}
if (be - b >= pc - p) {
- memcpy(b, p, (pc - p));
+ grn_memcpy(b, p, (pc - p));
b += pc - p;
p = pc;
if (p < pe && *pc == '/' && be > b) {
diff --git a/storage/mroonga/vendor/groonga/lib/string.c b/storage/mroonga/vendor/groonga/lib/string.c
index f0fcf561b5e..3249865b900 100644
--- a/storage/mroonga/vendor/groonga/lib/string.c
+++ b/storage/mroonga/vendor/groonga/lib/string.c
@@ -16,12 +16,12 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "groonga_in.h"
+#include "grn.h"
#include <string.h>
-#include "string_in.h"
-#include "normalizer_in.h"
-#include "str.h"
-#include "util.h"
+#include "grn_string.h"
+#include "grn_normalizer.h"
+#include "grn_str.h"
+#include "grn_util.h"
#include <groonga/tokenizer.h>
@@ -54,7 +54,7 @@ grn_fake_string_open(grn_ctx *ctx, grn_string *string)
if (!grn_tokenizer_is_tokenized_delimiter(ctx,
source_current, char_length,
ctx->encoding)) {
- memcpy(destination, source_current, char_length);
+ grn_memcpy(destination, source_current, char_length);
destination += char_length;
destination_length += char_length;
}
@@ -63,7 +63,7 @@ grn_fake_string_open(grn_ctx *ctx, grn_string *string)
nstr->normalized[destination_length] = '\0';
nstr->normalized_length_in_bytes = destination_length;
} else {
- memcpy(nstr->normalized, str, str_len);
+ grn_memcpy(nstr->normalized, str, str_len);
nstr->normalized[str_len] = '\0';
nstr->normalized_length_in_bytes = str_len;
}
@@ -140,8 +140,21 @@ grn_string_open_(grn_ctx *ctx, const char *str, unsigned int str_len,
return NULL;
}
+ is_normalizer_auto = (normalizer == GRN_NORMALIZER_AUTO);
+ if (is_normalizer_auto) {
+ normalizer = grn_ctx_get(ctx, GRN_NORMALIZER_AUTO_NAME, -1);
+ if (!normalizer) {
+ ERR(GRN_INVALID_ARGUMENT,
+ "[string][open] NormalizerAuto normalizer isn't available");
+ return NULL;
+ }
+ }
+
string = GRN_MALLOCN(grn_string, 1);
if (!string) {
+ if (is_normalizer_auto) {
+ grn_obj_unlink(ctx, normalizer);
+ }
GRN_LOG(ctx, GRN_LOG_ALERT,
"[string][open] failed to allocate memory");
return NULL;
@@ -163,12 +176,6 @@ grn_string_open_(grn_ctx *ctx, const char *str, unsigned int str_len,
return (grn_obj *)grn_fake_string_open(ctx, string);
}
- is_normalizer_auto = (normalizer == GRN_NORMALIZER_AUTO);
- if (is_normalizer_auto) {
- normalizer = grn_ctx_get(ctx, GRN_NORMALIZER_AUTO_NAME, -1);
- }
-
- /* TODO: check rc */
grn_normalizer_normalize(ctx, normalizer, (grn_obj *)string);
if (ctx->rc) {
grn_obj_close(ctx, obj);
diff --git a/storage/mroonga/vendor/groonga/lib/token_cursor.c b/storage/mroonga/vendor/groonga/lib/token_cursor.c
new file mode 100644
index 00000000000..d98d1d46342
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/lib/token_cursor.c
@@ -0,0 +1,359 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2009-2014 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
+*/
+#include "grn_token_cursor.h"
+#include "grn_string.h"
+#include "grn_pat.h"
+#include "grn_dat.h"
+
+static void
+grn_token_cursor_open_initialize_token_filters(grn_ctx *ctx,
+ grn_token_cursor *token_cursor)
+{
+ grn_obj *token_filters = token_cursor->token_filters;
+ unsigned int i, n_token_filters;
+
+ if (token_filters) {
+ n_token_filters = GRN_BULK_VSIZE(token_filters) / sizeof(grn_obj *);
+ } else {
+ n_token_filters = 0;
+ }
+
+ for (i = 0; i < n_token_filters; i++) {
+ grn_obj *token_filter_object = GRN_PTR_VALUE_AT(token_filters, i);
+ grn_proc *token_filter = (grn_proc *)token_filter_object;
+
+ token_filter->user_data =
+ token_filter->callbacks.token_filter.init(ctx,
+ token_cursor->table,
+ token_cursor->mode);
+ }
+}
+
+grn_token_cursor *
+grn_token_cursor_open(grn_ctx *ctx, grn_obj *table,
+ const char *str, size_t str_len,
+ grn_tokenize_mode mode, unsigned int flags)
+{
+ grn_token_cursor *token_cursor;
+ grn_encoding encoding;
+ grn_obj *tokenizer;
+ grn_obj *normalizer;
+ grn_obj *token_filters;
+ grn_obj_flags table_flags;
+ if (grn_table_get_info(ctx, table, &table_flags, &encoding, &tokenizer,
+ &normalizer, &token_filters)) {
+ return NULL;
+ }
+ if (!(token_cursor = GRN_MALLOC(sizeof(grn_token_cursor)))) { return NULL; }
+ token_cursor->table = table;
+ token_cursor->mode = mode;
+ token_cursor->encoding = encoding;
+ token_cursor->tokenizer = tokenizer;
+ token_cursor->token_filters = token_filters;
+ token_cursor->orig = (const unsigned char *)str;
+ token_cursor->orig_blen = str_len;
+ token_cursor->curr = NULL;
+ token_cursor->nstr = NULL;
+ token_cursor->curr_size = 0;
+ token_cursor->pos = -1;
+ token_cursor->status = GRN_TOKEN_CURSOR_DOING;
+ token_cursor->force_prefix = GRN_FALSE;
+ if (tokenizer) {
+ grn_obj str_, flags_, mode_;
+ GRN_TEXT_INIT(&str_, GRN_OBJ_DO_SHALLOW_COPY);
+ GRN_TEXT_SET_REF(&str_, str, str_len);
+ GRN_UINT32_INIT(&flags_, 0);
+ GRN_UINT32_SET(ctx, &flags_, flags);
+ GRN_UINT32_INIT(&mode_, 0);
+ GRN_UINT32_SET(ctx, &mode_, mode);
+ token_cursor->pctx.caller = NULL;
+ token_cursor->pctx.user_data.ptr = NULL;
+ token_cursor->pctx.proc = (grn_proc *)tokenizer;
+ token_cursor->pctx.hooks = NULL;
+ token_cursor->pctx.currh = NULL;
+ token_cursor->pctx.phase = PROC_INIT;
+ grn_ctx_push(ctx, &mode_);
+ grn_ctx_push(ctx, &str_);
+ grn_ctx_push(ctx, &flags_);
+ ((grn_proc *)tokenizer)->funcs[PROC_INIT](ctx, 1, &table, &token_cursor->pctx.user_data);
+ grn_obj_close(ctx, &flags_);
+ grn_obj_close(ctx, &str_);
+ grn_obj_close(ctx, &mode_);
+ } else {
+ int nflags = 0;
+ token_cursor->nstr = grn_string_open_(ctx, str, str_len,
+ normalizer,
+ nflags,
+ token_cursor->encoding);
+ if (token_cursor->nstr) {
+ const char *normalized;
+ grn_string_get_normalized(ctx, token_cursor->nstr,
+ &normalized, &(token_cursor->curr_size), NULL);
+ token_cursor->curr = (const unsigned char *)normalized;
+ } else {
+ ERR(GRN_TOKENIZER_ERROR,
+ "[token-cursor][open] failed to grn_string_open()");
+ }
+ }
+
+ grn_token_cursor_open_initialize_token_filters(ctx, token_cursor);
+
+ if (ctx->rc) {
+ grn_token_cursor_close(ctx, token_cursor);
+ token_cursor = NULL;
+ }
+ return token_cursor;
+}
+
+static int
+grn_token_cursor_next_apply_token_filters(grn_ctx *ctx,
+ grn_token_cursor *token_cursor,
+ grn_obj *current_token_data,
+ grn_obj *status)
+{
+ grn_obj *token_filters = token_cursor->token_filters;
+ unsigned int i, n_token_filters;
+ grn_token current_token;
+ grn_token next_token;
+
+ if (token_filters) {
+ n_token_filters = GRN_BULK_VSIZE(token_filters) / sizeof(grn_obj *);
+ } else {
+ n_token_filters = 0;
+ }
+
+ GRN_TEXT_INIT(&(current_token.data), GRN_OBJ_DO_SHALLOW_COPY);
+ GRN_TEXT_SET(ctx, &(current_token.data),
+ GRN_TEXT_VALUE(current_token_data),
+ GRN_TEXT_LEN(current_token_data));
+ current_token.status = GRN_INT32_VALUE(status);
+ GRN_TEXT_INIT(&(next_token.data), GRN_OBJ_DO_SHALLOW_COPY);
+ GRN_TEXT_SET(ctx, &(next_token.data),
+ GRN_TEXT_VALUE(&(current_token.data)),
+ GRN_TEXT_LEN(&(current_token.data)));
+ next_token.status = current_token.status;
+
+ for (i = 0; i < n_token_filters; i++) {
+ grn_obj *token_filter_object = GRN_PTR_VALUE_AT(token_filters, i);
+ grn_proc *token_filter = (grn_proc *)token_filter_object;
+
+#define SKIP_FLAGS\
+ (GRN_TOKEN_SKIP |\
+ GRN_TOKEN_SKIP_WITH_POSITION)
+ if (current_token.status & SKIP_FLAGS) {
+ break;
+ }
+#undef SKIP_FLAGS
+
+ token_filter->callbacks.token_filter.filter(ctx,
+ &current_token,
+ &next_token,
+ token_filter->user_data);
+ GRN_TEXT_SET(ctx, &(current_token.data),
+ GRN_TEXT_VALUE(&(next_token.data)),
+ GRN_TEXT_LEN(&(next_token.data)));
+ current_token.status = next_token.status;
+ }
+
+ token_cursor->curr =
+ (const unsigned char *)GRN_TEXT_VALUE(&(current_token.data));
+ token_cursor->curr_size = GRN_TEXT_LEN(&(current_token.data));
+
+ return current_token.status;
+}
+
+grn_id
+grn_token_cursor_next(grn_ctx *ctx, grn_token_cursor *token_cursor)
+{
+ int status;
+ grn_id tid = GRN_ID_NIL;
+ grn_obj *table = token_cursor->table;
+ grn_obj *tokenizer = token_cursor->tokenizer;
+ while (token_cursor->status != GRN_TOKEN_CURSOR_DONE) {
+ if (tokenizer) {
+ grn_obj *curr_, *stat_;
+ ((grn_proc *)tokenizer)->funcs[PROC_NEXT](ctx, 1, &table, &token_cursor->pctx.user_data);
+ stat_ = grn_ctx_pop(ctx);
+ curr_ = grn_ctx_pop(ctx);
+ status = grn_token_cursor_next_apply_token_filters(ctx, token_cursor,
+ curr_, stat_);
+ token_cursor->status =
+ ((status & GRN_TOKEN_LAST) ||
+ (token_cursor->mode == GRN_TOKENIZE_GET &&
+ (status & GRN_TOKEN_REACH_END)))
+ ? GRN_TOKEN_CURSOR_DONE : GRN_TOKEN_CURSOR_DOING;
+ token_cursor->force_prefix = GRN_FALSE;
+#define SKIP_FLAGS \
+ (GRN_TOKEN_SKIP | GRN_TOKEN_SKIP_WITH_POSITION)
+ if (status & SKIP_FLAGS) {
+ if (status & GRN_TOKEN_SKIP) {
+ token_cursor->pos++;
+ }
+ if (token_cursor->status == GRN_TOKEN_CURSOR_DONE && tid == GRN_ID_NIL) {
+ token_cursor->status = GRN_TOKEN_CURSOR_DONE_SKIP;
+ break;
+ } else {
+ continue;
+ }
+ }
+#undef SKIP_FLAGS
+ if (status & GRN_TOKEN_FORCE_PREFIX) {
+ token_cursor->force_prefix = GRN_TRUE;
+ }
+ if (token_cursor->curr_size == 0) {
+ if (token_cursor->status != GRN_TOKEN_CURSOR_DONE) {
+ char tokenizer_name[GRN_TABLE_MAX_KEY_SIZE];
+ int tokenizer_name_length;
+ tokenizer_name_length =
+ grn_obj_name(ctx, token_cursor->tokenizer,
+ tokenizer_name, GRN_TABLE_MAX_KEY_SIZE);
+ GRN_LOG(ctx, GRN_WARN,
+ "[token_next] ignore an empty token: <%.*s>: <%.*s>",
+ tokenizer_name_length, tokenizer_name,
+ token_cursor->orig_blen, token_cursor->orig);
+ }
+ continue;
+ }
+ if (token_cursor->curr_size > GRN_TABLE_MAX_KEY_SIZE) {
+ GRN_LOG(ctx, GRN_WARN,
+ "[token_next] ignore too long token. "
+ "Token must be less than or equal to %d: <%d>(<%.*s>)",
+ GRN_TABLE_MAX_KEY_SIZE,
+ token_cursor->curr_size,
+ token_cursor->curr_size, token_cursor->curr);
+ continue;
+ }
+ if (status & GRN_TOKEN_UNMATURED) {
+ if (status & GRN_TOKEN_OVERLAP) {
+ if (token_cursor->mode == GRN_TOKENIZE_GET) {
+ token_cursor->pos++;
+ continue;
+ }
+ } else {
+ if (status & GRN_TOKEN_LAST) {
+ token_cursor->force_prefix = GRN_TRUE;
+ }
+ }
+ }
+ } else {
+ token_cursor->status = GRN_TOKEN_CURSOR_DONE;
+ }
+ if (token_cursor->mode == GRN_TOKENIZE_ADD) {
+ switch (table->header.type) {
+ case GRN_TABLE_PAT_KEY :
+ if (grn_io_lock(ctx, ((grn_pat *)table)->io, grn_lock_timeout)) {
+ tid = GRN_ID_NIL;
+ } else {
+ tid = grn_pat_add(ctx, (grn_pat *)table, token_cursor->curr, token_cursor->curr_size,
+ NULL, NULL);
+ grn_io_unlock(((grn_pat *)table)->io);
+ }
+ break;
+ case GRN_TABLE_DAT_KEY :
+ if (grn_io_lock(ctx, ((grn_dat *)table)->io, grn_lock_timeout)) {
+ tid = GRN_ID_NIL;
+ } else {
+ tid = grn_dat_add(ctx, (grn_dat *)table, token_cursor->curr, token_cursor->curr_size,
+ NULL, NULL);
+ grn_io_unlock(((grn_dat *)table)->io);
+ }
+ break;
+ case GRN_TABLE_HASH_KEY :
+ if (grn_io_lock(ctx, ((grn_hash *)table)->io, grn_lock_timeout)) {
+ tid = GRN_ID_NIL;
+ } else {
+ tid = grn_hash_add(ctx, (grn_hash *)table, token_cursor->curr, token_cursor->curr_size,
+ NULL, NULL);
+ grn_io_unlock(((grn_hash *)table)->io);
+ }
+ break;
+ case GRN_TABLE_NO_KEY :
+ if (token_cursor->curr_size == sizeof(grn_id)) {
+ tid = *((grn_id *)token_cursor->curr);
+ } else {
+ tid = GRN_ID_NIL;
+ }
+ break;
+ }
+ } else {
+ switch (table->header.type) {
+ case GRN_TABLE_PAT_KEY :
+ tid = grn_pat_get(ctx, (grn_pat *)table, token_cursor->curr, token_cursor->curr_size, NULL);
+ break;
+ case GRN_TABLE_DAT_KEY :
+ tid = grn_dat_get(ctx, (grn_dat *)table, token_cursor->curr, token_cursor->curr_size, NULL);
+ break;
+ case GRN_TABLE_HASH_KEY :
+ tid = grn_hash_get(ctx, (grn_hash *)table, token_cursor->curr, token_cursor->curr_size, NULL);
+ break;
+ case GRN_TABLE_NO_KEY :
+ if (token_cursor->curr_size == sizeof(grn_id)) {
+ tid = *((grn_id *)token_cursor->curr);
+ } else {
+ tid = GRN_ID_NIL;
+ }
+ break;
+ }
+ }
+ if (tid == GRN_ID_NIL && token_cursor->status != GRN_TOKEN_CURSOR_DONE) {
+ token_cursor->status = GRN_TOKEN_CURSOR_NOT_FOUND;
+ }
+ token_cursor->pos++;
+ break;
+ }
+ return tid;
+}
+
+static void
+grn_token_cursor_close_token_filters(grn_ctx *ctx,
+ grn_token_cursor *token_cursor)
+{
+ grn_obj *token_filters = token_cursor->token_filters;
+ unsigned int i, n_token_filters;
+
+ if (token_filters) {
+ n_token_filters = GRN_BULK_VSIZE(token_filters) / sizeof(grn_obj *);
+ } else {
+ n_token_filters = 0;
+ }
+ for (i = 0; i < n_token_filters; i++) {
+ grn_obj *token_filter_object = GRN_PTR_VALUE_AT(token_filters, i);
+ grn_proc *token_filter = (grn_proc *)token_filter_object;
+
+ token_filter->callbacks.token_filter.fin(ctx, token_filter->user_data);
+ }
+}
+
+grn_rc
+grn_token_cursor_close(grn_ctx *ctx, grn_token_cursor *token_cursor)
+{
+ if (token_cursor) {
+ if (token_cursor->tokenizer) {
+ ((grn_proc *)token_cursor->tokenizer)->funcs[PROC_FIN](ctx, 1, &token_cursor->table,
+ &token_cursor->pctx.user_data);
+ }
+ grn_token_cursor_close_token_filters(ctx, token_cursor);
+ if (token_cursor->nstr) {
+ grn_obj_close(ctx, token_cursor->nstr);
+ }
+ GRN_FREE(token_cursor);
+ return GRN_SUCCESS;
+ } else {
+ return GRN_INVALID_ARGUMENT;
+ }
+}
diff --git a/storage/mroonga/vendor/groonga/lib/token_filter.c b/storage/mroonga/vendor/groonga/lib/token_filter.c
index 910bb9a5715..c57650c2b55 100644
--- a/storage/mroonga/vendor/groonga/lib/token_filter.c
+++ b/storage/mroonga/vendor/groonga/lib/token_filter.c
@@ -18,8 +18,8 @@
#include <string.h>
-#include "groonga_in.h"
-#include "db.h"
+#include "grn.h"
+#include "grn_db.h"
#include <groonga/token_filter.h>
grn_rc
diff --git a/storage/mroonga/vendor/groonga/lib/tokenizer.c b/storage/mroonga/vendor/groonga/lib/tokenizer.c
index ac4628ba5de..e72d3b43d2b 100644
--- a/storage/mroonga/vendor/groonga/lib/tokenizer.c
+++ b/storage/mroonga/vendor/groonga/lib/tokenizer.c
@@ -15,18 +15,16 @@
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 "groonga_in.h"
-#include "groonga/tokenizer.h"
+#include "grn.h"
+#include <groonga/tokenizer.h>
-#include <stdarg.h>
-#include <stdio.h>
#include <string.h>
-#include "ctx.h"
-#include "db.h"
-#include "str.h"
-#include "string_in.h"
-#include "token.h"
+#include "grn_ctx.h"
+#include "grn_db.h"
+#include "grn_str.h"
+#include "grn_string.h"
+#include "grn_token_cursor.h"
/*
Just for backward compatibility. See grn_plugin_charlen() instead.
@@ -102,7 +100,7 @@ grn_tokenizer_query_open(grn_ctx *ctx, int num_args, grn_obj **args,
{
grn_obj *flags = grn_ctx_pop(ctx);
grn_obj *query_str = grn_ctx_pop(ctx);
- grn_obj *token_mode = grn_ctx_pop(ctx);
+ grn_obj *tokenize_mode = grn_ctx_pop(ctx);
if (query_str == NULL) {
GRN_PLUGIN_ERROR(ctx, GRN_INVALID_ARGUMENT, "missing argument");
@@ -127,11 +125,12 @@ grn_tokenizer_query_open(grn_ctx *ctx, int num_args, grn_obj **args,
} else {
query->flags = 0;
}
- if (token_mode) {
- query->token_mode = GRN_UINT32_VALUE(token_mode);
+ if (tokenize_mode) {
+ query->tokenize_mode = GRN_UINT32_VALUE(tokenize_mode);
} else {
- query->token_mode = GRN_TOKEN_ADD;
+ query->tokenize_mode = GRN_TOKENIZE_ADD;
}
+ query->token_mode = query->tokenize_mode;
{
grn_obj * const table = args[0];
@@ -168,7 +167,7 @@ grn_tokenizer_query_open(grn_ctx *ctx, int num_args, grn_obj **args,
return NULL;
}
query->normalized_query = normalized_query;
- memcpy(query_buf, GRN_TEXT_VALUE(query_str), query_length);
+ grn_memcpy(query_buf, GRN_TEXT_VALUE(query_str), query_length);
query_buf[query_length] = '\0';
query->query_buf = query_buf;
query->ptr = query_buf;
@@ -176,7 +175,7 @@ grn_tokenizer_query_open(grn_ctx *ctx, int num_args, grn_obj **args,
}
query->encoding = table_encoding;
- if (query->flags & GRN_TOKEN_ENABLE_TOKENIZED_DELIMITER) {
+ if (query->flags & GRN_TOKEN_CURSOR_ENABLE_TOKENIZED_DELIMITER) {
const char *normalized_string;
unsigned int normalized_string_length;
@@ -241,7 +240,7 @@ grn_tokenizer_token_fin(grn_ctx *ctx, grn_tokenizer_token *token)
void
grn_tokenizer_token_push(grn_ctx *ctx, grn_tokenizer_token *token,
const char *str_ptr, unsigned int str_length,
- grn_tokenizer_status status)
+ grn_token_status status)
{
GRN_TEXT_SET_REF(&token->str, str_ptr, str_length);
GRN_UINT32_SET(ctx, &token->status, status);
@@ -262,7 +261,7 @@ grn_tokenizer_tokenized_delimiter_next(grn_ctx *ctx,
const char *end = str_ptr + str_length;
const char *next_start = NULL;
unsigned int token_length;
- grn_tokenizer_status status;
+ grn_token_status status;
for (current = start; current < end; current += char_length) {
char_length = grn_charlen_(ctx, current, end, encoding);
@@ -349,13 +348,13 @@ exit:
GRN_API_RETURN(ctx->rc);
}
-grn_tokenizer_status
+grn_token_status
grn_token_get_status(grn_ctx *ctx, grn_token *token)
{
GRN_API_ENTER;
if (!token) {
ERR(GRN_INVALID_ARGUMENT, "token must not be NULL");
- GRN_API_RETURN(GRN_TOKENIZER_TOKEN_CONTINUE);
+ GRN_API_RETURN(GRN_TOKEN_CONTINUE);
}
GRN_API_RETURN(token->status);
}
@@ -363,7 +362,7 @@ grn_token_get_status(grn_ctx *ctx, grn_token *token)
grn_rc
grn_token_set_status(grn_ctx *ctx,
grn_token *token,
- grn_tokenizer_status status)
+ grn_token_status status)
{
GRN_API_ENTER;
if (!token) {
diff --git a/storage/mroonga/vendor/groonga/lib/token.c b/storage/mroonga/vendor/groonga/lib/tokenizers.c
index 00b3de2ebdd..8ed0b8c37fa 100644
--- a/storage/mroonga/vendor/groonga/lib/token.c
+++ b/storage/mroonga/vendor/groonga/lib/tokenizers.c
@@ -1,6 +1,6 @@
/* -*- c-basic-offset: 2 -*- */
/*
- Copyright(C) 2009-2014 Brazil
+ Copyright(C) 2009-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -15,19 +15,13 @@
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 "groonga_in.h"
#include <string.h>
-#include <ctype.h>
-#include "ctx_impl.h"
-#include "token.h"
-#include "pat.h"
-#include "dat.h"
-#include "hash.h"
-#include "string_in.h"
-#include "plugin_in.h"
+#include "grn_token_cursor.h"
+#include "grn_string.h"
+#include "grn_plugin.h"
#include <groonga/tokenizer.h>
-grn_obj *grn_token_uvector = NULL;
+grn_obj *grn_tokenizer_uvector = NULL;
typedef struct {
grn_tokenizer_token token;
@@ -76,13 +70,13 @@ uvector_next(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
if (tokenizer->tail < p) {
grn_tokenizer_token_push(ctx, &(tokenizer->token),
(const char *)tokenizer->curr, 0,
- GRN_TOKENIZER_TOKEN_LAST);
+ GRN_TOKEN_LAST);
} else {
- grn_tokenizer_status status;
+ grn_token_status status;
if (tokenizer->tail == p) {
- status = GRN_TOKENIZER_TOKEN_LAST;
+ status = GRN_TOKEN_LAST;
} else {
- status = GRN_TOKENIZER_TOKEN_CONTINUE;
+ status = GRN_TOKEN_CONTINUE;
}
grn_tokenizer_token_push(ctx, &(tokenizer->token),
(const char *)tokenizer->curr, tokenizer->unit,
@@ -177,7 +171,7 @@ delimited_next(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data
size_t cl;
const unsigned char *p = tokenizer->next, *r;
const unsigned char *e = tokenizer->end;
- grn_tokenizer_status status;
+ grn_token_status status;
for (r = p; r < e; r += cl) {
if (!(cl = grn_charlen_(ctx, (char *)r, (char *)e,
tokenizer->query->encoding))) {
@@ -200,9 +194,9 @@ delimited_next(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data
}
}
if (r == e) {
- status = GRN_TOKENIZER_LAST;
+ status = GRN_TOKEN_LAST;
} else {
- status = GRN_TOKENIZER_CONTINUE;
+ status = GRN_TOKEN_CONTINUE;
}
grn_tokenizer_token_push(ctx,
&(tokenizer->token),
@@ -356,7 +350,8 @@ ngram_next(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
size_t cl;
grn_ngram_tokenizer *tokenizer = user_data->ptr;
const unsigned char *p = tokenizer->next, *r = p, *e = tokenizer->end;
- int32_t len = 0, pos = tokenizer->pos + tokenizer->skip, status = 0;
+ int32_t len = 0, pos = tokenizer->pos + tokenizer->skip;
+ grn_token_status status = 0;
const uint_least8_t *cp = tokenizer->ctypes ? tokenizer->ctypes + pos : NULL;
if (cp && tokenizer->uni_alpha && GRN_STR_CTYPE(*cp) == GRN_CHAR_ALPHA) {
while ((cl = grn_charlen_(ctx, (char *)r, (char *)e,
@@ -398,7 +393,7 @@ ngram_next(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
// todo : grn_pat_lcp_search
if ((tid = grn_sym_common_prefix_search(sym, p))) {
if (!(key = _grn_sym_key(sym, tid))) {
- tokenizer->status = GRN_TOKEN_NOT_FOUND;
+ tokenizer->status = GRN_TOKEN_CURSOR_NOT_FOUND;
return NULL;
}
len = grn_str_len(key, tokenizer->query->encoding, NULL);
@@ -408,7 +403,7 @@ ngram_next(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
if (r != p && pos + len - 1 <= tokenizer->tail) { continue; }
p += strlen(key);
if (!*p && tokenizer->mode == GRN_TOKEN_GET) {
- tokenizer->status = GRN_TOKEN_DONE;
+ tokenizer->status = GRN_TOKEN_CURSOR_DONE;
}
}
#endif /* PRE_DEFINED_UNSPLIT_WORDS */
@@ -433,10 +428,10 @@ ngram_next(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
r += cl;
}
if (tokenizer->overlap) {
- status |= GRN_TOKENIZER_TOKEN_OVERLAP;
+ status |= GRN_TOKEN_OVERLAP;
}
if (len < tokenizer->ngram_unit) {
- status |= GRN_TOKENIZER_TOKEN_UNMATURED;
+ status |= GRN_TOKEN_UNMATURED;
}
tokenizer->overlap = (len > 1) ? 1 : 0;
}
@@ -446,11 +441,11 @@ ngram_next(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
tokenizer->tail = pos + len - 1;
if (p == r || tokenizer->next == e) {
tokenizer->skip = 0;
- status |= GRN_TOKENIZER_TOKEN_LAST;
+ status |= GRN_TOKEN_LAST;
} else {
tokenizer->skip = tokenizer->overlap ? 1 : len;
}
- if (r == e) { status |= GRN_TOKENIZER_TOKEN_REACH_END; }
+ if (r == e) { status |= GRN_TOKEN_REACH_END; }
grn_tokenizer_token_push(ctx,
&(tokenizer->token),
(const char *)p,
@@ -472,355 +467,281 @@ ngram_fin(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
return NULL;
}
-/* external */
+/* regexp tokenizer */
-grn_rc
-grn_token_init(void)
-{
- static grn_proc _grn_token_uvector;
- _grn_token_uvector.obj.db = NULL;
- _grn_token_uvector.obj.id = GRN_ID_NIL;
- _grn_token_uvector.obj.header.domain = GRN_ID_NIL;
- _grn_token_uvector.obj.range = GRN_ID_NIL;
- _grn_token_uvector.funcs[PROC_INIT] = uvector_init;
- _grn_token_uvector.funcs[PROC_NEXT] = uvector_next;
- _grn_token_uvector.funcs[PROC_FIN] = uvector_fin;
- grn_token_uvector = (grn_obj *)&_grn_token_uvector;
- return GRN_SUCCESS;
-}
+typedef struct {
+ grn_tokenizer_token token;
+ grn_tokenizer_query *query;
+ struct {
+ grn_bool have_begin;
+ grn_bool have_end;
+ int32_t n_skip_tokens;
+ } get;
+ grn_bool is_begin;
+ grn_bool is_end;
+ grn_bool is_first_token;
+ grn_bool is_overlapping;
+ const char *next;
+ const char *end;
+ grn_obj buffer;
+} grn_regexp_tokenizer;
-grn_rc
-grn_token_fin(void)
+static grn_obj *
+regexp_init(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
{
- return GRN_SUCCESS;
-}
+ unsigned int normalize_flags = 0;
+ grn_tokenizer_query *query;
+ const char *normalized;
+ unsigned int normalized_length_in_bytes;
+ grn_regexp_tokenizer *tokenizer;
-static void
-grn_token_cursor_open_initialize_token_filters(grn_ctx *ctx,
- grn_token_cursor *token_cursor)
-{
- grn_obj *token_filters = token_cursor->token_filters;
- unsigned int i, n_token_filters;
+ query = grn_tokenizer_query_open(ctx, nargs, args, normalize_flags);
+ if (!query) {
+ return NULL;
+ }
- if (token_filters) {
- n_token_filters = GRN_BULK_VSIZE(token_filters) / sizeof(grn_obj *);
- } else {
- n_token_filters = 0;
+ tokenizer = GRN_MALLOC(sizeof(grn_regexp_tokenizer));
+ if (!tokenizer) {
+ grn_tokenizer_query_close(ctx, query);
+ ERR(GRN_NO_MEMORY_AVAILABLE,
+ "[tokenizer][regexp] failed to allocate memory");
+ return NULL;
}
+ user_data->ptr = tokenizer;
+
+ grn_tokenizer_token_init(ctx, &(tokenizer->token));
+ tokenizer->query = query;
- for (i = 0; i < n_token_filters; i++) {
- grn_obj *token_filter_object = GRN_PTR_VALUE_AT(token_filters, i);
- grn_proc *token_filter = (grn_proc *)token_filter_object;
+ tokenizer->get.have_begin = GRN_FALSE;
+ tokenizer->get.have_end = GRN_FALSE;
+ tokenizer->get.n_skip_tokens = 0;
- token_filter->user_data =
- token_filter->callbacks.token_filter.init(ctx,
- token_cursor->table,
- token_cursor->mode);
- }
-}
+ tokenizer->is_begin = GRN_TRUE;
+ tokenizer->is_end = GRN_FALSE;
+ tokenizer->is_first_token = GRN_TRUE;
+ tokenizer->is_overlapping = GRN_FALSE;
-grn_token_cursor *
-grn_token_cursor_open(grn_ctx *ctx, grn_obj *table,
- const char *str, size_t str_len,
- grn_token_mode mode, unsigned int flags)
-{
- grn_token_cursor *token_cursor;
- grn_encoding encoding;
- grn_obj *tokenizer;
- grn_obj *normalizer;
- grn_obj *token_filters;
- grn_obj_flags table_flags;
- if (grn_table_get_info(ctx, table, &table_flags, &encoding, &tokenizer,
- &normalizer, &token_filters)) {
- return NULL;
- }
- if (!(token_cursor = GRN_MALLOC(sizeof(grn_token_cursor)))) { return NULL; }
- token_cursor->table = table;
- token_cursor->mode = mode;
- token_cursor->encoding = encoding;
- token_cursor->tokenizer = tokenizer;
- token_cursor->token_filters = token_filters;
- token_cursor->orig = (const unsigned char *)str;
- token_cursor->orig_blen = str_len;
- token_cursor->curr = NULL;
- token_cursor->nstr = NULL;
- token_cursor->curr_size = 0;
- token_cursor->pos = -1;
- token_cursor->status = GRN_TOKEN_DOING;
- token_cursor->force_prefix = 0;
- if (tokenizer) {
- grn_obj str_, flags_, mode_;
- GRN_TEXT_INIT(&str_, GRN_OBJ_DO_SHALLOW_COPY);
- GRN_TEXT_SET_REF(&str_, str, str_len);
- GRN_UINT32_INIT(&flags_, 0);
- GRN_UINT32_SET(ctx, &flags_, flags);
- GRN_UINT32_INIT(&mode_, 0);
- GRN_UINT32_SET(ctx, &mode_, mode);
- token_cursor->pctx.caller = NULL;
- token_cursor->pctx.user_data.ptr = NULL;
- token_cursor->pctx.proc = (grn_proc *)tokenizer;
- token_cursor->pctx.hooks = NULL;
- token_cursor->pctx.currh = NULL;
- token_cursor->pctx.phase = PROC_INIT;
- grn_ctx_push(ctx, &mode_);
- grn_ctx_push(ctx, &str_);
- grn_ctx_push(ctx, &flags_);
- ((grn_proc *)tokenizer)->funcs[PROC_INIT](ctx, 1, &table, &token_cursor->pctx.user_data);
- grn_obj_close(ctx, &flags_);
- grn_obj_close(ctx, &str_);
- grn_obj_close(ctx, &mode_);
- } else {
- int nflags = 0;
- token_cursor->nstr = grn_string_open_(ctx, str, str_len,
- normalizer,
- nflags,
- token_cursor->encoding);
- if (token_cursor->nstr) {
- const char *normalized;
- grn_string_get_normalized(ctx, token_cursor->nstr,
- &normalized, &(token_cursor->curr_size), NULL);
- token_cursor->curr = (const unsigned char *)normalized;
- } else {
- ERR(GRN_TOKENIZER_ERROR,
- "[token-cursor][open] failed to grn_string_open()");
+ grn_string_get_normalized(ctx, tokenizer->query->normalized_query,
+ &normalized, &normalized_length_in_bytes,
+ NULL);
+ tokenizer->next = normalized;
+ tokenizer->end = tokenizer->next + normalized_length_in_bytes;
+
+ if (tokenizer->query->tokenize_mode == GRN_TOKEN_GET) {
+ unsigned int query_length = tokenizer->query->length;
+ if (query_length >= 2) {
+ const char *query_string = tokenizer->query->ptr;
+ grn_encoding encoding = tokenizer->query->encoding;
+ if (query_string[0] == '\\' && query_string[1] == 'A') {
+ tokenizer->get.have_begin = GRN_TRUE;
+ /* TODO: It assumes that both "\\" and "A" are normalized to 1
+ characters. Normalizer may omit character or expand to
+ multiple characters. */
+ tokenizer->next += grn_charlen_(ctx, tokenizer->next, tokenizer->end,
+ encoding);
+ tokenizer->next += grn_charlen_(ctx, tokenizer->next, tokenizer->end,
+ encoding);
+ }
+ if (query_string[query_length - 2] == '\\' &&
+ query_string[query_length - 1] == 'z') {
+ tokenizer->get.have_end = GRN_TRUE;
+ /* TODO: It assumes that both "\\" and "z" are normalized to 1
+ byte characters. Normalizer may omit character or expand to
+ multiple characters. */
+ tokenizer->end -= grn_charlen_(ctx,
+ tokenizer->end - 1,
+ tokenizer->end,
+ encoding);
+ tokenizer->end -= grn_charlen_(ctx,
+ tokenizer->end - 1,
+ tokenizer->end,
+ encoding);
+ }
}
}
- grn_token_cursor_open_initialize_token_filters(ctx, token_cursor);
+ GRN_TEXT_INIT(&(tokenizer->buffer), 0);
- if (ctx->rc) {
- grn_token_cursor_close(ctx, token_cursor);
- token_cursor = NULL;
- }
- return token_cursor;
+ return NULL;
}
-static int
-grn_token_cursor_next_apply_token_filters(grn_ctx *ctx,
- grn_token_cursor *token_cursor,
- grn_obj *current_token_data,
- grn_obj *status)
+static grn_obj *
+regexp_next(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
{
- grn_obj *token_filters = token_cursor->token_filters;
- unsigned int i, n_token_filters;
- grn_token current_token;
- grn_token next_token;
+ int char_len;
+ grn_token_status status = 0;
+ grn_regexp_tokenizer *tokenizer = user_data->ptr;
+ unsigned int n_characters = 0;
+ int ngram_unit = 2;
+ grn_obj *buffer = &(tokenizer->buffer);
+ const char *current = tokenizer->next;
+ const char *end = tokenizer->end;
+ grn_tokenize_mode mode = tokenizer->query->tokenize_mode;
+ grn_bool escaping = GRN_FALSE;
+
+ GRN_BULK_REWIND(buffer);
+
+ if (mode == GRN_TOKEN_GET) {
+ if (tokenizer->get.have_begin) {
+ grn_tokenizer_token_push(ctx,
+ &(tokenizer->token),
+ GRN_TOKENIZER_BEGIN_MARK_UTF8,
+ GRN_TOKENIZER_BEGIN_MARK_UTF8_LEN,
+ status);
+ tokenizer->get.have_begin = GRN_FALSE;
+ return NULL;
+ }
- if (token_filters) {
- n_token_filters = GRN_BULK_VSIZE(token_filters) / sizeof(grn_obj *);
+ if (tokenizer->is_end && tokenizer->get.have_end) {
+ status |= GRN_TOKEN_LAST | GRN_TOKEN_REACH_END;
+ grn_tokenizer_token_push(ctx,
+ &(tokenizer->token),
+ GRN_TOKENIZER_END_MARK_UTF8,
+ GRN_TOKENIZER_END_MARK_UTF8_LEN,
+ status);
+ return NULL;
+ }
} else {
- n_token_filters = 0;
- }
+ if (tokenizer->is_begin) {
+ grn_tokenizer_token_push(ctx,
+ &(tokenizer->token),
+ GRN_TOKENIZER_BEGIN_MARK_UTF8,
+ GRN_TOKENIZER_BEGIN_MARK_UTF8_LEN,
+ status);
+ tokenizer->is_begin = GRN_FALSE;
+ return NULL;
+ }
- GRN_TEXT_INIT(&(current_token.data), GRN_OBJ_DO_SHALLOW_COPY);
- GRN_TEXT_SET(ctx, &(current_token.data),
- GRN_TEXT_VALUE(current_token_data),
- GRN_TEXT_LEN(current_token_data));
- current_token.status = GRN_INT32_VALUE(status);
- GRN_TEXT_INIT(&(next_token.data), GRN_OBJ_DO_SHALLOW_COPY);
- GRN_TEXT_SET(ctx, &(next_token.data),
- GRN_TEXT_VALUE(&(current_token.data)),
- GRN_TEXT_LEN(&(current_token.data)));
- next_token.status = current_token.status;
-
- for (i = 0; i < n_token_filters; i++) {
- grn_obj *token_filter_object = GRN_PTR_VALUE_AT(token_filters, i);
- grn_proc *token_filter = (grn_proc *)token_filter_object;
-
-#define SKIP_FLAGS\
- (GRN_TOKENIZER_TOKEN_SKIP |\
- GRN_TOKENIZER_TOKEN_SKIP_WITH_POSITION)
- if (current_token.status & SKIP_FLAGS) {
- break;
+ if (tokenizer->is_end) {
+ status |= GRN_TOKEN_LAST | GRN_TOKEN_REACH_END;
+ grn_tokenizer_token_push(ctx,
+ &(tokenizer->token),
+ GRN_TOKENIZER_END_MARK_UTF8,
+ GRN_TOKENIZER_END_MARK_UTF8_LEN,
+ status);
+ return NULL;
}
-#undef SKIP_FLAGS
-
- token_filter->callbacks.token_filter.filter(ctx,
- &current_token,
- &next_token,
- token_filter->user_data);
- GRN_TEXT_SET(ctx, &(current_token.data),
- GRN_TEXT_VALUE(&(next_token.data)),
- GRN_TEXT_LEN(&(next_token.data)));
- current_token.status = next_token.status;
}
- token_cursor->curr =
- (const unsigned char *)GRN_TEXT_VALUE(&(current_token.data));
- token_cursor->curr_size = GRN_TEXT_LEN(&(current_token.data));
-
- return current_token.status;
-}
+ char_len = grn_charlen_(ctx, current, end, tokenizer->query->encoding);
+ if (char_len == 0) {
+ status |= GRN_TOKEN_LAST | GRN_TOKEN_REACH_END;
+ grn_tokenizer_token_push(ctx, &(tokenizer->token), "", 0, status);
+ return NULL;
+ }
-grn_id
-grn_token_cursor_next(grn_ctx *ctx, grn_token_cursor *token_cursor)
-{
- int status;
- grn_id tid = GRN_ID_NIL;
- grn_obj *table = token_cursor->table;
- grn_obj *tokenizer = token_cursor->tokenizer;
- while (token_cursor->status != GRN_TOKEN_DONE) {
- if (tokenizer) {
- grn_obj *curr_, *stat_;
- ((grn_proc *)tokenizer)->funcs[PROC_NEXT](ctx, 1, &table, &token_cursor->pctx.user_data);
- stat_ = grn_ctx_pop(ctx);
- curr_ = grn_ctx_pop(ctx);
- status = grn_token_cursor_next_apply_token_filters(ctx, token_cursor,
- curr_, stat_);
- token_cursor->status =
- ((status & GRN_TOKENIZER_TOKEN_LAST) ||
- (token_cursor->mode == GRN_TOKEN_GET &&
- (status & GRN_TOKENIZER_TOKEN_REACH_END)))
- ? GRN_TOKEN_DONE : GRN_TOKEN_DOING;
- token_cursor->force_prefix = 0;
-#define SKIP_FLAGS \
- (GRN_TOKENIZER_TOKEN_SKIP | GRN_TOKENIZER_TOKEN_SKIP_WITH_POSITION)
- if (status & SKIP_FLAGS) {
- if (status & GRN_TOKENIZER_TOKEN_SKIP) {
- token_cursor->pos++;
- }
- if (token_cursor->status == GRN_TOKEN_DONE && tid == GRN_ID_NIL) {
- token_cursor->status = GRN_TOKEN_DONE_SKIP;
- break;
- } else {
- continue;
- }
- }
-#undef SKIP_FLAGS
- if (token_cursor->curr_size == 0) {
- char tokenizer_name[GRN_TABLE_MAX_KEY_SIZE];
- int tokenizer_name_length;
- tokenizer_name_length =
- grn_obj_name(ctx, token_cursor->tokenizer,
- tokenizer_name, GRN_TABLE_MAX_KEY_SIZE);
- GRN_LOG(ctx, GRN_WARN,
- "[token_next] ignore an empty token: <%.*s>: <%.*s>",
- tokenizer_name_length, tokenizer_name,
- token_cursor->orig_blen, token_cursor->orig);
- continue;
- }
- if (token_cursor->curr_size > GRN_TABLE_MAX_KEY_SIZE) {
- GRN_LOG(ctx, GRN_WARN,
- "[token_next] ignore too long token. "
- "Token must be less than or equal to %d: <%d>(<%.*s>)",
- GRN_TABLE_MAX_KEY_SIZE,
- token_cursor->curr_size,
- token_cursor->curr_size, token_cursor->curr);
- continue;
+ while (GRN_TRUE) {
+ if (!escaping && mode == GRN_TOKEN_GET &&
+ char_len == 1 && current[0] == '\\') {
+ current += char_len;
+ escaping = GRN_TRUE;
+ } else {
+ n_characters++;
+ GRN_TEXT_PUT(ctx, buffer, current, char_len);
+ current += char_len;
+ escaping = GRN_FALSE;
+ if (n_characters == 1) {
+ tokenizer->next = current;
}
- if (status & GRN_TOKENIZER_TOKEN_UNMATURED) {
- if (status & GRN_TOKENIZER_TOKEN_OVERLAP) {
- if (token_cursor->mode == GRN_TOKEN_GET) { token_cursor->pos++; continue; }
- } else {
- if (status & GRN_TOKENIZER_TOKEN_LAST) { token_cursor->force_prefix = 1; }
- }
+ if (n_characters == ngram_unit) {
+ break;
}
- } else {
- token_cursor->status = GRN_TOKEN_DONE;
}
- if (token_cursor->mode == GRN_TOKEN_ADD) {
- switch (table->header.type) {
- case GRN_TABLE_PAT_KEY :
- if (grn_io_lock(ctx, ((grn_pat *)table)->io, grn_lock_timeout)) {
- tid = GRN_ID_NIL;
- } else {
- tid = grn_pat_add(ctx, (grn_pat *)table, token_cursor->curr, token_cursor->curr_size,
- NULL, NULL);
- grn_io_unlock(((grn_pat *)table)->io);
- }
- break;
- case GRN_TABLE_DAT_KEY :
- if (grn_io_lock(ctx, ((grn_dat *)table)->io, grn_lock_timeout)) {
- tid = GRN_ID_NIL;
- } else {
- tid = grn_dat_add(ctx, (grn_dat *)table, token_cursor->curr, token_cursor->curr_size,
- NULL, NULL);
- grn_io_unlock(((grn_dat *)table)->io);
+
+ char_len = grn_charlen_(ctx, (const char *)current, (const char *)end,
+ tokenizer->query->encoding);
+ if (char_len == 0) {
+ break;
+ }
+ }
+
+ if (tokenizer->is_overlapping) {
+ status |= GRN_TOKEN_OVERLAP;
+ }
+ if (n_characters < ngram_unit) {
+ status |= GRN_TOKEN_UNMATURED;
+ }
+ tokenizer->is_overlapping = (n_characters > 1);
+
+ if (mode == GRN_TOKEN_GET) {
+ if ((end - tokenizer->next) < ngram_unit) {
+ if (tokenizer->get.have_end) {
+ if (tokenizer->next == end) {
+ tokenizer->is_end = GRN_TRUE;
}
- break;
- case GRN_TABLE_HASH_KEY :
- if (grn_io_lock(ctx, ((grn_hash *)table)->io, grn_lock_timeout)) {
- tid = GRN_ID_NIL;
- } else {
- tid = grn_hash_add(ctx, (grn_hash *)table, token_cursor->curr, token_cursor->curr_size,
- NULL, NULL);
- grn_io_unlock(((grn_hash *)table)->io);
+ if (status & GRN_TOKEN_UNMATURED) {
+ if (tokenizer->is_first_token) {
+ status |= GRN_TOKEN_FORCE_PREFIX;
+ } else {
+ status |= GRN_TOKEN_SKIP;
+ }
}
- break;
- case GRN_TABLE_NO_KEY :
- if (token_cursor->curr_size == sizeof(grn_id)) {
- tid = *((grn_id *)token_cursor->curr);
- } else {
- tid = GRN_ID_NIL;
+ } else {
+ tokenizer->is_end = GRN_TRUE;
+ status |= GRN_TOKEN_LAST | GRN_TOKEN_REACH_END;
+ if (status & GRN_TOKEN_UNMATURED) {
+ status |= GRN_TOKEN_FORCE_PREFIX;
}
- break;
}
} else {
- switch (table->header.type) {
- case GRN_TABLE_PAT_KEY :
- tid = grn_pat_get(ctx, (grn_pat *)table, token_cursor->curr, token_cursor->curr_size, NULL);
- break;
- case GRN_TABLE_DAT_KEY :
- tid = grn_dat_get(ctx, (grn_dat *)table, token_cursor->curr, token_cursor->curr_size, NULL);
- break;
- case GRN_TABLE_HASH_KEY :
- tid = grn_hash_get(ctx, (grn_hash *)table, token_cursor->curr, token_cursor->curr_size, NULL);
- break;
- case GRN_TABLE_NO_KEY :
- if (token_cursor->curr_size == sizeof(grn_id)) {
- tid = *((grn_id *)token_cursor->curr);
- } else {
- tid = GRN_ID_NIL;
- }
- break;
+ if (tokenizer->get.n_skip_tokens > 0) {
+ tokenizer->get.n_skip_tokens--;
+ status |= GRN_TOKEN_SKIP;
+ } else {
+ tokenizer->get.n_skip_tokens = ngram_unit - 1;
}
}
- if (tid == GRN_ID_NIL && token_cursor->status != GRN_TOKEN_DONE) {
- token_cursor->status = GRN_TOKEN_NOT_FOUND;
+ } else {
+ if (tokenizer->next == end) {
+ tokenizer->is_end = GRN_TRUE;
}
- token_cursor->pos++;
- break;
}
- return tid;
+
+ grn_tokenizer_token_push(ctx,
+ &(tokenizer->token),
+ GRN_TEXT_VALUE(buffer),
+ GRN_TEXT_LEN(buffer),
+ status);
+ tokenizer->is_first_token = GRN_FALSE;
+
+ return NULL;
}
-static void
-grn_token_cursor_close_token_filters(grn_ctx *ctx,
- grn_token_cursor *token_cursor)
+static grn_obj *
+regexp_fin(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
{
- grn_obj *token_filters = token_cursor->token_filters;
- unsigned int i, n_token_filters;
-
- if (token_filters) {
- n_token_filters = GRN_BULK_VSIZE(token_filters) / sizeof(grn_obj *);
- } else {
- n_token_filters = 0;
+ grn_regexp_tokenizer *tokenizer = user_data->ptr;
+ if (!tokenizer) {
+ return NULL;
}
- for (i = 0; i < n_token_filters; i++) {
- grn_obj *token_filter_object = GRN_PTR_VALUE_AT(token_filters, i);
- grn_proc *token_filter = (grn_proc *)token_filter_object;
+ grn_tokenizer_token_fin(ctx, &(tokenizer->token));
+ grn_tokenizer_query_close(ctx, tokenizer->query);
+ GRN_OBJ_FIN(ctx, &(tokenizer->buffer));
+ GRN_FREE(tokenizer);
+ return NULL;
+}
- token_filter->callbacks.token_filter.fin(ctx, token_filter->user_data);
- }
+/* external */
+
+grn_rc
+grn_tokenizers_init(void)
+{
+ static grn_proc _grn_tokenizer_uvector;
+ _grn_tokenizer_uvector.obj.db = NULL;
+ _grn_tokenizer_uvector.obj.id = GRN_ID_NIL;
+ _grn_tokenizer_uvector.obj.header.domain = GRN_ID_NIL;
+ _grn_tokenizer_uvector.obj.range = GRN_ID_NIL;
+ _grn_tokenizer_uvector.funcs[PROC_INIT] = uvector_init;
+ _grn_tokenizer_uvector.funcs[PROC_NEXT] = uvector_next;
+ _grn_tokenizer_uvector.funcs[PROC_FIN] = uvector_fin;
+ grn_tokenizer_uvector = (grn_obj *)&_grn_tokenizer_uvector;
+ return GRN_SUCCESS;
}
grn_rc
-grn_token_cursor_close(grn_ctx *ctx, grn_token_cursor *token_cursor)
+grn_tokenizers_fin(void)
{
- if (token_cursor) {
- if (token_cursor->tokenizer) {
- ((grn_proc *)token_cursor->tokenizer)->funcs[PROC_FIN](ctx, 1, &token_cursor->table,
- &token_cursor->pctx.user_data);
- }
- grn_token_cursor_close_token_filters(ctx, token_cursor);
- if (token_cursor->nstr) {
- grn_obj_close(ctx, token_cursor->nstr);
- }
- GRN_FREE(token_cursor);
- return GRN_SUCCESS;
- } else {
- return GRN_INVALID_ARGUMENT;
- }
+ return GRN_SUCCESS;
}
grn_rc
@@ -893,5 +814,7 @@ grn_db_init_builtin_tokenizers(grn_ctx *ctx)
bigramisad_init, ngram_next, ngram_fin, vars);
DEF_TOKENIZER("TokenDelimitNull",
delimit_null_init, delimited_next, delimited_fin, vars);
+ DEF_TOKENIZER("TokenRegexp",
+ regexp_init, regexp_next, regexp_fin, vars);
return GRN_SUCCESS;
}
diff --git a/storage/mroonga/vendor/groonga/lib/util.c b/storage/mroonga/vendor/groonga/lib/util.c
index 67f0ff32125..17172d6cfeb 100644
--- a/storage/mroonga/vendor/groonga/lib/util.c
+++ b/storage/mroonga/vendor/groonga/lib/util.c
@@ -1,5 +1,5 @@
/* -*- c-basic-offset: 2 -*- */
-/* Copyright(C) 2010-2014 Brazil
+/* Copyright(C) 2010-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -15,14 +15,23 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "db.h"
-#include "pat.h"
-#include "ii.h"
-#include "util.h"
-#include "string_in.h"
+#include "grn_db.h"
+#include "grn_pat.h"
+#include "grn_ii.h"
+#include "grn_util.h"
+#include "grn_string.h"
+#include "grn_expr.h"
#include <string.h>
#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+
+#ifdef WIN32
+# include <io.h>
+# include <share.h>
+#endif /* WIN32 */
grn_rc
grn_normalize_offset_and_limit(grn_ctx *ctx, int size, int *p_offset, int *p_limit)
@@ -211,8 +220,13 @@ grn_inspect_type(grn_ctx *ctx, grn_obj *buf, unsigned char type)
break;
default:
{
- char type_in_hex[5]; /* "0xXX" */
- sprintf(type_in_hex, "%#02x", type);
+#define TYPE_IN_HEX_SIZE 5 /* "0xXX" */
+ char type_in_hex[TYPE_IN_HEX_SIZE];
+ grn_snprintf(type_in_hex,
+ TYPE_IN_HEX_SIZE,
+ TYPE_IN_HEX_SIZE,
+ "%#02x", type);
+#undef TYPE_IN_HEX_SIZE
GRN_TEXT_PUTS(ctx, buf, "(unknown: ");
GRN_TEXT_PUTS(ctx, buf, type_in_hex);
GRN_TEXT_PUTS(ctx, buf, ")");
@@ -254,6 +268,9 @@ grn_proc_inspect(grn_ctx *ctx, grn_obj *buf, grn_obj *obj)
case GRN_PROC_TOKEN_FILTER :
GRN_TEXT_PUTS(ctx, buf, "token-filter");
break;
+ case GRN_PROC_SCORER :
+ GRN_TEXT_PUTS(ctx, buf, "scorer");
+ break;
}
GRN_TEXT_PUTS(ctx, buf, " ");
@@ -275,6 +292,102 @@ grn_proc_inspect(grn_ctx *ctx, grn_obj *buf, grn_obj *obj)
return GRN_SUCCESS;
}
+grn_rc
+grn_expr_code_inspect_indented(grn_ctx *ctx,
+ grn_obj *buffer,
+ grn_expr_code *code,
+ const char *indent)
+{
+ if (!code) {
+ GRN_TEXT_PUTS(ctx, buffer, "(NULL)");
+ return GRN_SUCCESS;
+ }
+
+ GRN_TEXT_PUTS(ctx, buffer, "<");
+ GRN_TEXT_PUTS(ctx, buffer, grn_operator_to_string(code->op));
+ GRN_TEXT_PUTS(ctx, buffer, " ");
+ GRN_TEXT_PUTS(ctx, buffer, "n_args:");
+ grn_text_itoa(ctx, buffer, code->nargs);
+ GRN_TEXT_PUTS(ctx, buffer, ", ");
+ GRN_TEXT_PUTS(ctx, buffer, "flags:");
+ grn_text_itoh(ctx, buffer, code->flags, 1);
+ GRN_TEXT_PUTS(ctx, buffer, ", ");
+ GRN_TEXT_PUTS(ctx, buffer, "modify:");
+ grn_text_itoa(ctx, buffer, code->modify);
+ GRN_TEXT_PUTS(ctx, buffer, ", ");
+ GRN_TEXT_PUTS(ctx, buffer, "value:");
+ grn_inspect_indented(ctx, buffer, code->value, " ");
+ GRN_TEXT_PUTS(ctx, buffer, ">");
+
+ return GRN_SUCCESS;
+}
+
+grn_rc
+grn_expr_inspect(grn_ctx *ctx, grn_obj *buffer, grn_obj *expr)
+{
+ grn_expr *e = (grn_expr *)expr;
+
+ GRN_TEXT_PUTS(ctx, buffer, "#<expr\n");
+ {
+ int i = 0;
+ grn_obj *value;
+ const char *name;
+ uint32_t name_len;
+ unsigned int n_vars;
+ grn_hash *vars = grn_expr_get_vars(ctx, expr, &n_vars);
+ GRN_TEXT_PUTS(ctx, buffer, " vars:{");
+ GRN_HASH_EACH(ctx, vars, id, &name, &name_len, &value, {
+ if (i++) {
+ GRN_TEXT_PUTC(ctx, buffer, ',');
+ }
+ GRN_TEXT_PUTS(ctx, buffer, "\n ");
+ GRN_TEXT_PUT(ctx, buffer, name, name_len);
+ GRN_TEXT_PUTC(ctx, buffer, ':');
+ grn_inspect_indented(ctx, buffer, value, " ");
+ });
+ GRN_TEXT_PUTS(ctx, buffer, "\n },");
+ }
+
+ {
+ uint32_t i;
+ grn_expr_code *code;
+ GRN_TEXT_PUTS(ctx, buffer, "\n codes:{");
+ for (i = 0, code = e->codes; i < e->codes_curr; i++, code++) {
+ if (i) { GRN_TEXT_PUTC(ctx, buffer, ','); }
+ GRN_TEXT_PUTS(ctx, buffer, "\n ");
+ grn_text_itoa(ctx, buffer, i);
+ GRN_TEXT_PUTS(ctx, buffer, ":");
+ grn_expr_code_inspect_indented(ctx, buffer, code, " ");
+ }
+ GRN_TEXT_PUTS(ctx, buffer, "\n }");
+ }
+
+ GRN_TEXT_PUTS(ctx, buffer, "\n>");
+
+ return GRN_SUCCESS;
+}
+
+static grn_rc
+grn_pvector_inspect(grn_ctx *ctx, grn_obj *buffer, grn_obj *pvector)
+{
+ int i, n;
+
+ GRN_TEXT_PUTS(ctx, buffer, "[");
+ n = GRN_BULK_VSIZE(pvector) / sizeof(grn_obj *);
+ for (i = 0; i < n; i++) {
+ grn_obj *element = GRN_PTR_VALUE_AT(pvector, i);
+
+ if (i > 0) {
+ GRN_TEXT_PUTS(ctx, buffer, ", ");
+ }
+
+ grn_inspect(ctx, buffer, element);
+ }
+ GRN_TEXT_PUTS(ctx, buffer, "]");
+
+ return GRN_SUCCESS;
+}
+
static grn_rc
grn_vector_inspect(grn_ctx *ctx, grn_obj *buffer, grn_obj *vector)
{
@@ -400,8 +513,8 @@ grn_store_inspect_body(grn_ctx *ctx, grn_obj *buf, grn_obj *obj)
case GRN_OBJ_COMPRESS_ZLIB :
GRN_TEXT_PUTS(ctx, buf, "zlib");
break;
- case GRN_OBJ_COMPRESS_LZO :
- GRN_TEXT_PUTS(ctx, buf, "lzo");
+ case GRN_OBJ_COMPRESS_LZ4 :
+ GRN_TEXT_PUTS(ctx, buf, "lz4");
break;
default:
break;
@@ -481,9 +594,6 @@ grn_ii_inspect(grn_ctx *ctx, grn_obj *buf, grn_obj *obj)
GRN_TEXT_PUTS(ctx, buf, "NONE");
}
- GRN_TEXT_PUTS(ctx, buf, " elements:");
- grn_ii_inspect_elements(ctx, (grn_ii *)obj, buf);
-
GRN_TEXT_PUTS(ctx, buf, ">");
return GRN_SUCCESS;
@@ -499,6 +609,9 @@ grn_table_type_inspect(grn_ctx *ctx, grn_obj *buf, grn_obj *obj)
case GRN_TABLE_PAT_KEY:
GRN_TEXT_PUTS(ctx, buf, "pat");
break;
+ case GRN_TABLE_DAT_KEY:
+ GRN_TEXT_PUTS(ctx, buf, "dat");
+ break;
case GRN_TABLE_NO_KEY:
GRN_TEXT_PUTS(ctx, buf, "no_key");
break;
@@ -742,6 +855,24 @@ grn_table_inspect(grn_ctx *ctx, grn_obj *buf, grn_obj *obj)
}
static grn_rc
+grn_db_inspect(grn_ctx *ctx, grn_obj *buf, grn_obj *obj)
+{
+ grn_db *db = (grn_db *)obj;
+
+ GRN_TEXT_PUTS(ctx, buf, "#<db");
+
+ GRN_TEXT_PUTS(ctx, buf, " key_type:");
+ grn_table_type_inspect(ctx, buf, db->keys);
+
+ GRN_TEXT_PUTS(ctx, buf, " size:");
+ grn_text_lltoa(ctx, buf, grn_table_size(ctx, obj));
+
+ GRN_TEXT_PUTS(ctx, buf, ">");
+
+ return GRN_SUCCESS;
+}
+
+static grn_rc
grn_geo_point_inspect_point(grn_ctx *ctx, grn_obj *buf, int point)
{
GRN_TEXT_PUTS(ctx, buf, "(");
@@ -850,7 +981,6 @@ grn_json_load_open_brace_inspect(grn_ctx *ctx, grn_obj *buf, grn_obj *obj)
static grn_rc
grn_record_inspect(grn_ctx *ctx, grn_obj *buf, grn_obj *obj)
{
- grn_id id;
grn_obj *table;
grn_hash *cols;
@@ -867,6 +997,11 @@ grn_record_inspect(grn_ctx *ctx, grn_obj *buf, grn_obj *obj)
}
GRN_TEXT_PUTS(ctx, buf, " id:");
+ if (GRN_BULK_VSIZE(obj) == 0) {
+ GRN_TEXT_PUTS(ctx, buf, "(no value)");
+ } else {
+ grn_id id;
+
id = GRN_RECORD_VALUE(obj);
grn_text_lltoa(ctx, buf, id);
@@ -903,6 +1038,8 @@ grn_record_inspect(grn_ctx *ctx, grn_obj *buf, grn_obj *obj)
} else {
GRN_TEXT_PUTS(ctx, buf, "(nonexistent)");
}
+ }
+
GRN_TEXT_PUTS(ctx, buf, ">");
if (table) {
@@ -1008,8 +1145,8 @@ grn_inspect(grn_ctx *ctx, grn_obj *buffer, grn_obj *obj)
}
break;
case GRN_PVECTOR :
- /* TODO */
- break;
+ grn_pvector_inspect(ctx, buffer, obj);
+ return buffer;
case GRN_VECTOR :
grn_vector_inspect(ctx, buffer, obj);
return buffer;
@@ -1054,7 +1191,7 @@ grn_inspect(grn_ctx *ctx, grn_obj *buffer, grn_obj *obj)
grn_table_inspect(ctx, buffer, obj);
return buffer;
case GRN_DB :
- /* TODO */
+ grn_db_inspect(ctx, buffer, obj);
break;
case GRN_COLUMN_FIX_SIZE :
grn_ra_inspect(ctx, buffer, obj);
@@ -1073,6 +1210,45 @@ grn_inspect(grn_ctx *ctx, grn_obj *buffer, grn_obj *obj)
return buffer;
}
+grn_obj *
+grn_inspect_indented(grn_ctx *ctx, grn_obj *buffer, grn_obj *obj,
+ const char *indent)
+{
+ grn_obj sub_buffer;
+
+ GRN_TEXT_INIT(&sub_buffer, 0);
+ grn_inspect(ctx, &sub_buffer, obj);
+ {
+ const char *inspected = GRN_TEXT_VALUE(&sub_buffer);
+ size_t inspected_size = GRN_TEXT_LEN(&sub_buffer);
+ size_t i, line_start;
+
+ if (!buffer) {
+ buffer = grn_obj_open(ctx, GRN_BULK, 0, GRN_DB_TEXT);
+ }
+
+ line_start = 0;
+ for (i = 0; i < inspected_size; i++) {
+ if (inspected[i] == '\n') {
+ if (line_start != 0) {
+ GRN_TEXT_PUTS(ctx, buffer, indent);
+ }
+ GRN_TEXT_PUT(ctx, buffer, inspected + line_start, i + 1 - line_start);
+ line_start = i + 1;
+ }
+ }
+ if (line_start != 0) {
+ GRN_TEXT_PUTS(ctx, buffer, indent);
+ }
+ GRN_TEXT_PUT(ctx, buffer,
+ inspected + line_start,
+ inspected_size - line_start);
+ }
+ GRN_OBJ_FIN(ctx, &sub_buffer);
+
+ return buffer;
+}
+
void
grn_p(grn_ctx *ctx, grn_obj *obj)
{
@@ -1095,6 +1271,28 @@ grn_p_geo_point(grn_ctx *ctx, grn_geo_point *point)
grn_obj_unlink(ctx, &obj);
}
+void
+grn_p_ii_values(grn_ctx *ctx, grn_obj *ii)
+{
+ grn_obj buffer;
+
+ GRN_TEXT_INIT(&buffer, 0);
+ grn_ii_inspect_values(ctx, (grn_ii *)ii, &buffer);
+ printf("%.*s\n", (int)GRN_TEXT_LEN(&buffer), GRN_TEXT_VALUE(&buffer));
+ grn_obj_unlink(ctx, &buffer);
+}
+
+void
+grn_p_expr_code(grn_ctx *ctx, grn_expr_code *code)
+{
+ grn_obj buffer;
+
+ GRN_TEXT_INIT(&buffer, 0);
+ grn_expr_code_inspect_indented(ctx, &buffer, code, "");
+ printf("%.*s\n", (int)GRN_TEXT_LEN(&buffer), GRN_TEXT_VALUE(&buffer));
+ grn_obj_unlink(ctx, &buffer);
+}
+
#ifdef WIN32
static char *win32_base_dir = NULL;
const char *
@@ -1110,7 +1308,7 @@ grn_win32_base_dir(void)
absolute_dll_filename,
MAX_PATH);
if (absolute_dll_filename_size == 0) {
- win32_base_dir = strdup(".");
+ win32_base_dir = grn_strdup_raw(".");
} else {
DWORD ansi_dll_filename_size;
ansi_dll_filename_size =
@@ -1118,7 +1316,7 @@ grn_win32_base_dir(void)
absolute_dll_filename, absolute_dll_filename_size,
NULL, 0, NULL, NULL);
if (ansi_dll_filename_size == 0) {
- win32_base_dir = strdup(".");
+ win32_base_dir = grn_strdup_raw(".");
} else {
char *path;
win32_base_dir = malloc(ansi_dll_filename_size + 1);
@@ -1149,3 +1347,41 @@ grn_win32_base_dir(void)
return win32_base_dir;
}
#endif
+
+#ifdef WIN32
+int
+grn_mkstemp(char *path_template)
+{
+ errno_t error;
+ size_t path_template_size;
+ int fd;
+
+ path_template_size = strlen(path_template) + 1;
+ error = _mktemp_s(path_template, path_template_size);
+ if (error != 0) {
+ return -1;
+ }
+
+ error = _sopen_s(&fd,
+ path_template,
+ _O_RDWR | _O_CREAT | _O_EXCL | _O_BINARY,
+ _SH_DENYNO,
+ _S_IREAD | _S_IWRITE);
+ if (error != 0) {
+ return -1;
+ }
+
+ return fd;
+}
+#else /* WIN32 */
+int
+grn_mkstemp(char *path_template)
+{
+# ifdef HAVE_MKSTEMP
+ return mkstemp(path_template);
+# else /* HAVE_MKSTEMP */
+ mktemp(path_template);
+ return open(path_template, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
+# endif /* HAVE_MKSTEMP */
+}
+#endif /* WIN32 */
diff --git a/storage/mroonga/vendor/groonga/nginx_version b/storage/mroonga/vendor/groonga/nginx_version
index de28578affc..27f9cd322bb 100644
--- a/storage/mroonga/vendor/groonga/nginx_version
+++ b/storage/mroonga/vendor/groonga/nginx_version
@@ -1 +1 @@
-1.7.6
+1.8.0
diff --git a/storage/mroonga/vendor/groonga/plugins/CMakeLists.txt b/storage/mroonga/vendor/groonga/plugins/CMakeLists.txt
index 42a3045a415..37f6127b0d2 100644
--- a/storage/mroonga/vendor/groonga/plugins/CMakeLists.txt
+++ b/storage/mroonga/vendor/groonga/plugins/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright(C) 2012-2014 Brazil
+# Copyright(C) 2012-2015 Brazil
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -19,3 +19,11 @@ add_subdirectory(table)
add_subdirectory(query_expanders)
add_subdirectory(ruby)
add_subdirectory(token_filters)
+add_subdirectory(sharding)
+add_subdirectory(functions)
+
+if(GRN_WITH_MRUBY)
+ read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/ruby_scripts.am RUBY_SCRIPTS)
+ install(FILES ${RUBY_SCRIPTS}
+ DESTINATION "${GRN_RELATIVE_PLUGINS_DIR}")
+endif()
diff --git a/storage/mroonga/vendor/groonga/plugins/Makefile.am b/storage/mroonga/vendor/groonga/plugins/Makefile.am
index 1d1abf1dee9..dc3967899c2 100644
--- a/storage/mroonga/vendor/groonga/plugins/Makefile.am
+++ b/storage/mroonga/vendor/groonga/plugins/Makefile.am
@@ -4,7 +4,16 @@ SUBDIRS = \
table \
query_expanders \
ruby \
- token_filters
+ token_filters \
+ sharding \
+ functions
EXTRA_DIST = \
CMakeLists.txt
+
+if WITH_MRUBY
+dist_plugins_DATA = \
+ $(ruby_scripts)
+endif
+
+include ruby_scripts.am
diff --git a/storage/mroonga/vendor/groonga/plugins/functions/CMakeLists.txt b/storage/mroonga/vendor/groonga/plugins/functions/CMakeLists.txt
new file mode 100644
index 00000000000..28db8b42ef3
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/plugins/functions/CMakeLists.txt
@@ -0,0 +1,32 @@
+# Copyright(C) 2015 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
+
+include_directories(
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../lib
+ )
+
+set(GRN_FUNCTIONS_PLUGIN_DIR "${GRN_RELATIVE_PLUGINS_DIR}/functions")
+
+read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/vector_sources.am
+ VECTOR_SOURCES)
+add_library(vector_functions MODULE ${VECTOR_SOURCES})
+set_source_files_properties(${VECTOR_SOURCES}
+ PROPERTIES
+ COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS}")
+set_target_properties(vector_functions PROPERTIES
+ PREFIX ""
+ OUTPUT_NAME "vector")
+target_link_libraries(vector_functions libgroonga)
+install(TARGETS vector_functions DESTINATION "${GRN_FUNCTIONS_PLUGIN_DIR}")
diff --git a/storage/mroonga/vendor/groonga/plugins/functions/Makefile.am b/storage/mroonga/vendor/groonga/plugins/functions/Makefile.am
new file mode 100644
index 00000000000..5d8d1d9cc84
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/plugins/functions/Makefile.am
@@ -0,0 +1,20 @@
+EXTRA_DIST = \
+ CMakeLists.txt
+
+AM_CPPFLAGS = \
+ -I$(top_builddir) \
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/lib
+
+AM_LDFLAGS = \
+ -avoid-version \
+ -module \
+ -no-undefined
+
+LIBS = \
+ $(top_builddir)/lib/libgroonga.la
+
+function_plugins_LTLIBRARIES =
+function_plugins_LTLIBRARIES += vector.la
+
+include vector_sources.am
diff --git a/storage/mroonga/vendor/groonga/plugins/functions/vector.c b/storage/mroonga/vendor/groonga/plugins/functions/vector.c
new file mode 100644
index 00000000000..34f7a98fd27
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/plugins/functions/vector.c
@@ -0,0 +1,90 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2015 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
+*/
+
+#include <groonga/plugin.h>
+
+static grn_obj *
+func_vector_size(grn_ctx *ctx, int n_args, grn_obj **args,
+ grn_user_data *user_data)
+{
+ grn_obj *target;
+ unsigned int size;
+ grn_obj *grn_size;
+
+ if (n_args != 1) {
+ GRN_PLUGIN_ERROR(ctx, GRN_INVALID_ARGUMENT,
+ "vector_size(): wrong number of arguments (%d for 1)",
+ n_args);
+ return NULL;
+ }
+
+ target = args[0];
+ switch (target->header.type) {
+ case GRN_VECTOR :
+ case GRN_PVECTOR :
+ case GRN_UVECTOR :
+ size = grn_vector_size(ctx, target);
+ break;
+ default :
+ {
+ grn_obj inspected;
+
+ GRN_TEXT_INIT(&inspected, 0);
+ grn_inspect(ctx, target, &inspected);
+ GRN_PLUGIN_ERROR(ctx, GRN_INVALID_ARGUMENT,
+ "vector_size(): target object must be vector: <%.*s>",
+ (int)GRN_TEXT_LEN(&inspected),
+ GRN_TEXT_VALUE(&inspected));
+ GRN_OBJ_FIN(ctx, &inspected);
+ return NULL;
+ }
+ break;
+ }
+
+ grn_size = grn_plugin_proc_alloc(ctx, user_data, GRN_DB_UINT32, 0);
+ if (!grn_size) {
+ return NULL;
+ }
+
+ GRN_UINT32_SET(ctx, grn_size, size);
+
+ return grn_size;
+}
+
+grn_rc
+GRN_PLUGIN_INIT(grn_ctx *ctx)
+{
+ return ctx->rc;
+}
+
+grn_rc
+GRN_PLUGIN_REGISTER(grn_ctx *ctx)
+{
+ grn_rc rc = GRN_SUCCESS;
+
+ grn_proc_create(ctx, "vector_size", -1, GRN_PROC_FUNCTION, func_vector_size,
+ NULL, NULL, 0, NULL);
+
+ return rc;
+}
+
+grn_rc
+GRN_PLUGIN_FIN(grn_ctx *ctx)
+{
+ return GRN_SUCCESS;
+}
diff --git a/storage/mroonga/vendor/groonga/plugins/functions/vector_sources.am b/storage/mroonga/vendor/groonga/plugins/functions/vector_sources.am
new file mode 100644
index 00000000000..1d98e651845
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/plugins/functions/vector_sources.am
@@ -0,0 +1,2 @@
+vector_la_SOURCES = \
+ vector.c
diff --git a/storage/mroonga/vendor/groonga/plugins/query_expanders/CMakeLists.txt b/storage/mroonga/vendor/groonga/plugins/query_expanders/CMakeLists.txt
index 1e2a2c23b09..57d11abfbcb 100644
--- a/storage/mroonga/vendor/groonga/plugins/query_expanders/CMakeLists.txt
+++ b/storage/mroonga/vendor/groonga/plugins/query_expanders/CMakeLists.txt
@@ -27,6 +27,4 @@ set_target_properties(tsv_query_expander PROPERTIES
PREFIX ""
OUTPUT_NAME "tsv")
target_link_libraries(tsv_query_expander libgroonga)
-if(NOT MRN_GROONGA_BUNDLED)
- install(TARGETS tsv_query_expander DESTINATION "${QUERY_EXPANDERS_DIR}")
-endif()
+install(TARGETS tsv_query_expander DESTINATION "${QUERY_EXPANDERS_DIR}")
diff --git a/storage/mroonga/vendor/groonga/plugins/query_expanders/tsv.c b/storage/mroonga/vendor/groonga/plugins/query_expanders/tsv.c
index 6b1fc51d6dc..06bb322acb2 100644
--- a/storage/mroonga/vendor/groonga/plugins/query_expanders/tsv.c
+++ b/storage/mroonga/vendor/groonga/plugins/query_expanders/tsv.c
@@ -1,5 +1,5 @@
/* -*- c-basic-offset: 2 -*- */
-/* Copyright(C) 2012 Brazil
+/* Copyright(C) 2012-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -15,17 +15,24 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <groonga/plugin.h>
-
/* groonga's internal headers */
/* for grn_text_fgets(): We don't want to require stdio.h for groonga.h.
What should we do? Should we split header file such as groonga/stdio.h? */
-#include <str.h>
+#include <grn_str.h>
+
+#include <groonga/plugin.h>
#include <stdio.h>
#include <string.h>
+#ifdef WIN32
+# include <share.h>
+#endif /* WIN32 */
+
#ifdef HAVE__STRNICMP
+# ifdef strncasecmp
+# undef strncasecmp
+# endif /* strncasecmp */
# define strncasecmp(s1,s2,n) _strnicmp(s1,s2,n)
#endif /* HAVE__STRNICMP */
@@ -34,25 +41,20 @@
static grn_hash *synonyms = NULL;
#ifdef WIN32
-static char *win32_synonyms_file = NULL;
+static char win32_synonyms_file[MAX_PATH] = "";
const char *
get_system_synonyms_file(void)
{
- if (!win32_synonyms_file) {
+ if (win32_synonyms_file[0] == '\0') {
const char *base_dir;
const char *relative_path = GRN_QUERY_EXPANDER_TSV_RELATIVE_SYNONYMS_FILE;
- char *synonyms_file;
- char *path;
size_t base_dir_length;
base_dir = grn_plugin_win32_base_dir();
base_dir_length = strlen(base_dir);
- synonyms_file =
- malloc(base_dir_length + strlen("/") + strlen(relative_path) + 1);
- strcpy(synonyms_file, base_dir);
- strcat(synonyms_file, "/");
- strcat(synonyms_file, relative_path);
- win32_synonyms_file = synonyms_file;
+ grn_strcpy(win32_synonyms_file, MAX_PATH, base_dir);
+ grn_strcat(win32_synonyms_file, MAX_PATH, "/");
+ grn_strcat(win32_synonyms_file, MAX_PATH, relative_path);
}
return win32_synonyms_file;
}
@@ -180,26 +182,35 @@ parse_synonyms_file_line(grn_ctx *ctx, const char *line, int line_length,
return;
}
- grn_bulk_truncate(ctx, value, MAX_SYNONYM_BYTES - 1);
- GRN_TEXT_PUTC(ctx, value, '\0');
- memcpy(value_location, GRN_TEXT_VALUE(value), MAX_SYNONYM_BYTES);
+ if (GRN_TEXT_LEN(value) <= MAX_SYNONYM_BYTES - 1) {
+ GRN_TEXT_PUTC(ctx, value, '\0');
+ } else {
+ grn_bulk_truncate(ctx, value, MAX_SYNONYM_BYTES - 1);
+ GRN_TEXT_PUTC(ctx, value, '\0');
+ }
+ grn_memcpy(value_location, GRN_TEXT_VALUE(value), GRN_TEXT_LEN(value));
}
}
static void
load_synonyms(grn_ctx *ctx)
{
+ static char path_env[GRN_ENV_BUFFER_SIZE];
const char *path;
FILE *file;
int number_of_lines;
grn_encoding encoding;
grn_obj line, key, value;
- path = getenv("GRN_QUERY_EXPANDER_TSV_SYNONYMS_FILE");
- if (!path) {
+ grn_getenv("GRN_QUERY_EXPANDER_TSV_SYNONYMS_FILE",
+ path_env,
+ GRN_ENV_BUFFER_SIZE);
+ if (path_env[0]) {
+ path = path_env;
+ } else {
path = get_system_synonyms_file();
}
- file = fopen(path, "r");
+ file = grn_fopen(path, "r");
if (!file) {
GRN_LOG(ctx, GRN_LOG_WARNING,
"[plugin][query-expander][tsv] "
@@ -217,6 +228,13 @@ load_synonyms(grn_ctx *ctx)
const char *line_value = GRN_TEXT_VALUE(&line);
size_t line_length = GRN_TEXT_LEN(&line);
+ if (line_length > 0 && line_value[line_length - 1] == '\n') {
+ if (line_length > 1 && line_value[line_length - 2] == '\r') {
+ line_length -= 2;
+ } else {
+ line_length -= 1;
+ }
+ }
number_of_lines++;
if (number_of_lines == 1) {
encoding = guess_encoding(ctx, &line_value, &line_length);
diff --git a/storage/mroonga/vendor/groonga/plugins/ruby/CMakeLists.txt b/storage/mroonga/vendor/groonga/plugins/ruby/CMakeLists.txt
index d82b154098c..ba7deafe0d3 100644
--- a/storage/mroonga/vendor/groonga/plugins/ruby/CMakeLists.txt
+++ b/storage/mroonga/vendor/groonga/plugins/ruby/CMakeLists.txt
@@ -27,9 +27,7 @@ if(GRN_WITH_MRUBY)
COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS}")
set_target_properties(eval PROPERTIES PREFIX "")
target_link_libraries(eval libgroonga)
- if(NOT MRN_GROONGA_BUNDLED)
- install(TARGETS eval DESTINATION "${GRN_RELATIVE_RUBY_PLUGINS_DIR}")
- endif()
+ install(TARGETS eval DESTINATION "${GRN_RELATIVE_RUBY_PLUGINS_DIR}")
read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/load_sources.am RUBY_LOAD_SOURCES)
add_library(load MODULE ${RUBY_LOAD_SOURCES})
@@ -38,7 +36,5 @@ if(GRN_WITH_MRUBY)
COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS}")
set_target_properties(load PROPERTIES PREFIX "")
target_link_libraries(load libgroonga)
- if(NOT MRN_GROONGA_BUNDLED)
- install(TARGETS load DESTINATION "${GRN_RELATIVE_RUBY_PLUGINS_DIR}")
- endif()
+ install(TARGETS load DESTINATION "${GRN_RELATIVE_RUBY_PLUGINS_DIR}")
endif()
diff --git a/storage/mroonga/vendor/groonga/plugins/ruby/ruby_plugin.h b/storage/mroonga/vendor/groonga/plugins/ruby/ruby_plugin.h
index 5314ea68fe5..57cab2885b1 100644
--- a/storage/mroonga/vendor/groonga/plugins/ruby/ruby_plugin.h
+++ b/storage/mroonga/vendor/groonga/plugins/ruby/ruby_plugin.h
@@ -16,11 +16,11 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <mrb.h>
-#include <output.h>
-#include <db.h>
-#include <ctx_impl.h>
-#include <util.h>
+#include <grn_mrb.h>
+#include <grn_output.h>
+#include <grn_db.h>
+#include <grn_ctx_impl.h>
+#include <grn_util.h>
#include <groonga/plugin.h>
diff --git a/storage/mroonga/vendor/groonga/plugins/ruby_scripts.am b/storage/mroonga/vendor/groonga/plugins/ruby_scripts.am
new file mode 100644
index 00000000000..0262dbb94ef
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/plugins/ruby_scripts.am
@@ -0,0 +1,2 @@
+ruby_scripts = \
+ sharding.rb
diff --git a/storage/mroonga/vendor/groonga/plugins/sharding.rb b/storage/mroonga/vendor/groonga/plugins/sharding.rb
new file mode 100644
index 00000000000..e369c3798da
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/plugins/sharding.rb
@@ -0,0 +1,4 @@
+require "sharding/range_expression_builder"
+require "sharding/logical_enumerator"
+require "sharding/logical_count"
+require "sharding/logical_range_filter"
diff --git a/storage/mroonga/vendor/groonga/plugins/sharding/CMakeLists.txt b/storage/mroonga/vendor/groonga/plugins/sharding/CMakeLists.txt
new file mode 100644
index 00000000000..8d0cdd976dc
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/plugins/sharding/CMakeLists.txt
@@ -0,0 +1,22 @@
+# Copyright(C) 2015 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
+
+if(GRN_WITH_MRUBY)
+ set(GRN_RELATIVE_SHARDING_PLUGINS_DIR "${GRN_RELATIVE_PLUGINS_DIR}/sharding")
+
+ read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/sources.am SHARDING_SCRIPTS)
+ install(FILES ${SHARDING_SCRIPTS}
+ DESTINATION "${GRN_RELATIVE_SHARDING_PLUGINS_DIR}")
+endif()
diff --git a/storage/mroonga/vendor/groonga/plugins/sharding/Makefile.am b/storage/mroonga/vendor/groonga/plugins/sharding/Makefile.am
new file mode 100644
index 00000000000..8104ab6d729
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/plugins/sharding/Makefile.am
@@ -0,0 +1,9 @@
+EXTRA_DIST = \
+ CMakeLists.txt
+
+if WITH_MRUBY
+dist_sharding_plugins_DATA = \
+ $(sharding_scripts)
+endif
+
+include sources.am
diff --git a/storage/mroonga/vendor/groonga/plugins/sharding/logical_count.rb b/storage/mroonga/vendor/groonga/plugins/sharding/logical_count.rb
new file mode 100644
index 00000000000..610dae834d3
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/plugins/sharding/logical_count.rb
@@ -0,0 +1,132 @@
+module Groonga
+ module Sharding
+ class LogicalCountCommand < Command
+ register("logical_count",
+ [
+ "logical_table",
+ "shard_key",
+ "min",
+ "min_border",
+ "max",
+ "max_border",
+ "filter",
+ ])
+
+ def run_body(input)
+ enumerator = LogicalEnumerator.new("logical_count", input)
+ filter = input[:filter]
+
+ total = 0
+ enumerator.each do |table, shard_key, shard_range|
+ total += count_n_records(table, filter,
+ shard_key, shard_range,
+ enumerator.target_range)
+ end
+ writer.write(total)
+ end
+
+ private
+ def count_n_records(table, filter,
+ shard_key, shard_range,
+ target_range)
+ cover_type = target_range.cover_type(shard_range)
+ return 0 if cover_type == :none
+
+ expression_builder = RangeExpressionBuilder.new(shard_key,
+ target_range,
+ filter)
+ if cover_type == :all
+ if filter.nil?
+ return table.size
+ else
+ return filtered_count_n_records(table) do |expression|
+ expression_builder.build_all(expression)
+ end
+ end
+ end
+
+ range_index = nil
+ if filter.nil?
+ index_info = shard_key.find_index(Operator::LESS)
+ if index_info
+ range_index = index_info.index
+ end
+ end
+
+ case cover_type
+ when :partial_min
+ if range_index
+ count_n_records_in_range(range_index,
+ target_range.min, target_range.min_border,
+ nil, nil)
+ else
+ filtered_count_n_records(table) do |expression|
+ expression_builder.build_partial_min(expression)
+ end
+ end
+ when :partial_max
+ if range_index
+ count_n_records_in_range(range_index,
+ nil, nil,
+ target_range.max, target_range.max_border)
+ else
+ filtered_count_n_records(table) do |expression|
+ expression_builder.build_partial_max(expression)
+ end
+ end
+ when :partial_min_and_max
+ if range_index
+ count_n_records_in_range(range_index,
+ target_range.min, target_range.min_border,
+ target_range.max, target_range.max_border)
+ else
+ filtered_count_n_records(table) do |expression|
+ expression_builder.build_partial_min_and_max(expression)
+ end
+ end
+ end
+ end
+
+ def filtered_count_n_records(table)
+ expression = nil
+ filtered_table = nil
+
+ begin
+ expression = Expression.create(table)
+ yield(expression)
+ filtered_table = table.select(expression)
+ filtered_table.size
+ ensure
+ filtered_table.close if filtered_table
+ expression.close if expression
+ end
+ end
+
+ def count_n_records_in_range(range_index,
+ min, min_border, max, max_border)
+ flags = TableCursorFlags::BY_KEY
+ case min_border
+ when :include
+ flags |= TableCursorFlags::GE
+ when :exclude
+ flags |= TableCursorFlags::GT
+ end
+ case max_border
+ when :include
+ flags |= TableCursorFlags::LE
+ when :exclude
+ flags |= TableCursorFlags::LT
+ end
+
+ TableCursor.open(range_index.table,
+ :min => min,
+ :max => max,
+ :flags => flags) do |table_cursor|
+ IndexCursor.open(table_cursor, range_index) do |index_cursor|
+ index_cursor.count
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/storage/mroonga/vendor/groonga/plugins/sharding/logical_enumerator.rb b/storage/mroonga/vendor/groonga/plugins/sharding/logical_enumerator.rb
new file mode 100644
index 00000000000..1aeafef5438
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/plugins/sharding/logical_enumerator.rb
@@ -0,0 +1,180 @@
+module Groonga
+ module Sharding
+ class LogicalEnumerator
+ attr_reader :target_range
+ attr_reader :logical_table
+ attr_reader :shard_key_name
+ def initialize(command_name, input)
+ @command_name = command_name
+ @input = input
+ initialize_parameters
+ end
+
+ def each(&block)
+ each_internal(:ascending, &block)
+ end
+
+ def reverse_each(&block)
+ each_internal(:descending, &block)
+ end
+
+ private
+ def each_internal(order)
+ prefix = "#{@logical_table}_"
+ context = Context.instance
+ context.database.each_table(:prefix => prefix,
+ :order_by => :key,
+ :order => order) do |table|
+ shard_range_raw = table.name[prefix.size..-1]
+
+ next unless /\A(\d{4})(\d{2})(\d{2})\z/ =~ shard_range_raw
+ shard_range = ShardRange.new($1.to_i, $2.to_i, $3.to_i)
+
+ physical_shard_key_name = "#{table.name}.#{@shard_key_name}"
+ shard_key = context[physical_shard_key_name]
+ if shard_key.nil?
+ message =
+ "[#{@command_name}] shard_key doesn't exist: " +
+ "<#{physical_shard_key_name}>"
+ raise InvalidArgument, message
+ end
+
+ yield(table, shard_key, shard_range)
+ end
+ end
+
+ private
+ def initialize_parameters
+ @logical_table = @input[:logical_table]
+ if @logical_table.nil?
+ raise InvalidArgument, "[#{@command_name}] logical_table is missing"
+ end
+
+ @shard_key_name = @input[:shard_key]
+ if @shard_key_name.nil?
+ raise InvalidArgument, "[#{@command_name}] shard_key is missing"
+ end
+
+ @target_range = TargetRange.new(@command_name, @input)
+ end
+
+ class ShardRange
+ attr_reader :year, :month, :day
+ def initialize(year, month, day)
+ @year = year
+ @month = month
+ @day = day
+ end
+ end
+
+ class TargetRange
+ attr_reader :min, :min_border
+ attr_reader :max, :max_border
+ def initialize(command_name, input)
+ @command_name = command_name
+ @input = input
+ @min = parse_value(:min)
+ @min_border = parse_border(:min_border)
+ @max = parse_value(:max)
+ @max_border = parse_border(:max_border)
+ end
+
+ def cover_type(shard_range)
+ return :all if @min.nil? and @max.nil?
+
+ if @min and @max
+ return :none unless in_min?(shard_range)
+ return :none unless in_max?(shard_range)
+ min_partial_p = in_min_partial?(shard_range)
+ max_partial_p = in_max_partial?(shard_range)
+ if min_partial_p and max_partial_p
+ :partial_min_and_max
+ elsif min_partial_p
+ :partial_min
+ elsif max_partial_p
+ :partial_max
+ else
+ :all
+ end
+ elsif @min
+ return :none unless in_min?(shard_range)
+ if in_min_partial?(shard_range)
+ :partial_min
+ else
+ :all
+ end
+ else
+ return :none unless in_max?(shard_range)
+ if in_max_partial?(shard_range)
+ :partial_max
+ else
+ :all
+ end
+ end
+ end
+
+ private
+ def parse_value(name)
+ value = @input[name]
+ return nil if value.nil?
+
+ Converter.convert(value, Time)
+ end
+
+ def parse_border(name)
+ border = @input[name]
+ return :include if border.nil?
+
+ case border
+ when "include"
+ :include
+ when "exclude"
+ :exclude
+ else
+ message =
+ "[#{@command_name}] #{name} must be \"include\" or \"exclude\": " +
+ "<#{border}>"
+ raise InvalidArgument, message
+ end
+ end
+
+ def in_min?(shard_range)
+ base_time = Time.local(shard_range.year,
+ shard_range.month,
+ shard_range.day + 1)
+ @min < base_time
+ end
+
+ def in_min_partial?(shard_range)
+ return false unless @min.year == shard_range.year
+ return false unless @min.month == shard_range.month
+ return false unless @min.day == shard_range.day
+
+ return true if @min_border == :exclude
+
+ not (@min.hour == 0 and
+ @min.min == 0 and
+ @min.sec == 0 and
+ @min.usec == 0)
+ end
+
+ def in_max?(shard_range)
+ max_base_time = Time.local(shard_range.year,
+ shard_range.month,
+ shard_range.day)
+ if @max_border == :include
+ @max >= max_base_time
+ else
+ @max > max_base_time
+ end
+ end
+
+ def in_max_partial?(shard_range)
+ @max.year == shard_range.year and
+ @max.month == shard_range.month and
+ @max.day == shard_range.day
+ end
+ end
+ end
+ end
+end
diff --git a/storage/mroonga/vendor/groonga/plugins/sharding/logical_range_filter.rb b/storage/mroonga/vendor/groonga/plugins/sharding/logical_range_filter.rb
new file mode 100644
index 00000000000..94ae8600d2b
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/plugins/sharding/logical_range_filter.rb
@@ -0,0 +1,442 @@
+module Groonga
+ module Sharding
+ class LogicalRangeFilterCommand < Command
+ register("logical_range_filter",
+ [
+ "logical_table",
+ "shard_key",
+ "min",
+ "min_border",
+ "max",
+ "max_border",
+ "order",
+ "filter",
+ "offset",
+ "limit",
+ "output_columns",
+ ])
+
+ def run_body(input)
+ output_columns = input[:output_columns] || "_key, *"
+
+ context = ExecuteContext.new(input)
+ begin
+ executor = Executor.new(context)
+ executor.execute
+
+ result_sets = context.result_sets
+ n_elements = 1 # for columns
+ result_sets.each do |result_set|
+ n_elements += result_set.size
+ end
+
+ writer.array("RESULTSET", n_elements) do
+ first_result_set = result_sets.first
+ if first_result_set
+ writer.write_table_columns(first_result_set, output_columns)
+ end
+ limit = context.limit
+ if limit < 0
+ n_records = result_sets.inject(0) do |n, result_set|
+ n + result_set.size
+ end
+ limit = n_records + limit + 1
+ end
+ options = {}
+ result_sets.each do |result_set|
+ options[:limit] = limit
+ writer.write_table_records(result_set, output_columns, options)
+ limit -= result_set.size
+ break if limit <= 0
+ end
+ end
+ ensure
+ context.close
+ end
+ end
+
+ class ExecuteContext
+ attr_reader :enumerator
+ attr_reader :order
+ attr_reader :filter
+ attr_reader :offset
+ attr_reader :limit
+ attr_accessor :current_offset
+ attr_accessor :current_limit
+ attr_reader :result_sets
+ attr_reader :unsorted_result_sets
+ attr_reader :threshold
+ def initialize(input)
+ @input = input
+ @enumerator = LogicalEnumerator.new("logical_range_filter", @input)
+ @order = parse_order(@input, :order)
+ @filter = @input[:filter]
+ @offset = (@input[:offset] || 0).to_i
+ @limit = (@input[:limit] || 10).to_i
+
+ @current_offset = @offset
+ @current_limit = @limit
+
+ @result_sets = []
+ @unsorted_result_sets = []
+
+ @threshold = compute_threshold
+ end
+
+ def close
+ @unsorted_result_sets.each do |result_set|
+ result_set.close if result_set.temporary?
+ end
+ @result_sets.each do |result_set|
+ result_set.close if result_set.temporary?
+ end
+ end
+
+ private
+ def parse_order(input, name)
+ order = input[name]
+ return :ascending if order.nil?
+
+ case order
+ when "ascending"
+ :ascending
+ when "descending"
+ :descending
+ else
+ message =
+ "[logical_range_filter] #{name} must be " +
+ "\"ascending\" or \"descending\": <#{order}>"
+ raise InvalidArgument, message
+ end
+ end
+
+ def compute_threshold
+ threshold_env = ENV["GRN_LOGICAL_RANGE_FILTER_THRESHOLD"]
+ default_threshold = 0.2
+ (threshold_env || default_threshold).to_f
+ end
+ end
+
+ class Executor
+ def initialize(context)
+ @context = context
+ end
+
+ def execute
+ first_table = nil
+ enumerator = @context.enumerator
+ if @context.order == :descending
+ each_method = :reverse_each
+ else
+ each_method = :each
+ end
+ enumerator.send(each_method) do |table, shard_key, shard_range|
+ first_table ||= table
+ next if table.empty?
+
+ shard_executor = ShardExecutor.new(@context,
+ table, shard_key, shard_range)
+ shard_executor.execute
+ break if @context.current_limit == 0
+ end
+ if first_table.nil?
+ message =
+ "[logical_range_filter] no shard exists: " +
+ "logical_table: <#{enumerator.logical_table}>: " +
+ "shard_key: <#{enumerator.shard_key_name}>"
+ raise InvalidArgument, message
+ end
+ if @context.result_sets.empty?
+ result_set = HashTable.create(:flags => ObjectFlags::WITH_SUBREC,
+ :key_type => first_table)
+ @context.result_sets << result_set
+ end
+ end
+ end
+
+ class ShardExecutor
+ def initialize(context, table, shard_key, shard_range)
+ @context = context
+ @table = table
+ @shard_key = shard_key
+ @shard_range = shard_range
+
+ @filter = @context.filter
+ @result_sets = @context.result_sets
+ @unsorted_result_sets = @context.unsorted_result_sets
+
+ @target_range = @context.enumerator.target_range
+
+ @cover_type = @target_range.cover_type(@shard_range)
+
+ @expression_builder = RangeExpressionBuilder.new(@shard_key,
+ @target_range,
+ @filter)
+ end
+
+ def execute
+ return if @cover_type == :none
+
+ index_info = @shard_key.find_index(Operator::LESS)
+ if index_info
+ range_index = index_info.index
+ range_index = nil unless use_range_index?(range_index)
+ else
+ range_index = nil
+ end
+
+ case @cover_type
+ when :all
+ filter_shard_all(range_index)
+ when :partial_min
+ if range_index
+ filter_by_range(range_index,
+ @target_range.min, @target_range.min_border,
+ nil, nil)
+ else
+ filter_table do |expression|
+ @expression_builder.build_partial_min(expression)
+ end
+ end
+ when :partial_max
+ if range_index
+ filter_by_range(range_index,
+ nil, nil,
+ @target_range.max, @target_range.max_border)
+ else
+ filter_table do |expression|
+ @expression_builder.build_partial_max(expression)
+ end
+ end
+ when :partial_min_and_max
+ if range_index
+ filter_by_range(range_index,
+ @target_range.min, @target_range.min_border,
+ @target_range.max, @target_range.max_border)
+ else
+ filter_table do |expression|
+ @expression_builder.build_partial_min_and_max(expression)
+ end
+ end
+ end
+ end
+
+ private
+ def use_range_index?(range_index)
+ current_limit = @context.current_limit
+ if current_limit < 0
+ return false
+ end
+
+ required_n_records = @context.current_offset + current_limit
+ max_n_records = @table.size
+ if max_n_records <= required_n_records
+ return false
+ end
+
+ threshold = @context.threshold
+ if threshold <= 0.0
+ return true
+ end
+ if threshold >= 1.0
+ return false
+ end
+
+ estimated_n_records = 0
+ case @cover_type
+ when :all
+ if @filter
+ create_expression(@table) do |expression|
+ @expression_builder.build_all(expression)
+ estimated_n_records = expression.estimate_size(@table)
+ end
+ else
+ estimated_n_records = max_n_records
+ end
+ when :partial_min
+ create_expression(@table) do |expression|
+ @expression_builder.build_partial_min(expression)
+ estimated_n_records = expression.estimate_size(@table)
+ end
+ when :partial_max
+ create_expression(@table) do |expression|
+ @expression_builder.build_partial_max(expression)
+ estimated_n_records = expression.estimate_size(@table)
+ end
+ when :partial_min_and_max
+ create_expression(@table) do |expression|
+ @expression_builder.build_partial_min_and_max(expression)
+ estimated_n_records = expression.estimate_size(@table)
+ end
+ end
+
+ if estimated_n_records <= required_n_records
+ return false
+ end
+
+ hit_ratio = estimated_n_records / max_n_records.to_f
+ hit_ratio >= threshold
+ end
+
+ def filter_shard_all(range_index)
+ if @filter.nil?
+ if @table.size <= @context.current_offset
+ @context.current_offset -= @table.size
+ return
+ end
+ if range_index
+ filter_by_range(range_index,
+ nil, nil,
+ nil, nil)
+ else
+ sort_result_set(@table)
+ end
+ else
+ if range_index
+ filter_by_range(range_index,
+ nil, nil,
+ nil, nil)
+ else
+ filter_table do |expression|
+ @expression_builder.build_all(expression)
+ end
+ end
+ end
+ end
+
+ def create_expression(table)
+ expression = Expression.create(table)
+ begin
+ yield(expression)
+ ensure
+ expression.close
+ end
+ end
+
+ def filter_by_range(range_index,
+ min, min_border, max, max_border)
+ lexicon = range_index.domain
+ data_table = range_index.range
+ flags = build_range_search_flags(min_border, max_border)
+
+ result_set = HashTable.create(:flags => ObjectFlags::WITH_SUBREC,
+ :key_type => data_table)
+ n_matched_records = 0
+ begin
+ TableCursor.open(lexicon,
+ :min => min,
+ :max => max,
+ :flags => flags) do |table_cursor|
+ options = {
+ :offset => @context.current_offset,
+ }
+ current_limit = @context.current_limit
+ if current_limit < 0
+ options[:limit] = data_table.size
+ else
+ options[:limit] = current_limit
+ end
+ if @filter
+ create_expression(data_table) do |expression|
+ expression.parse(@filter)
+ options[:expression] = expression
+ IndexCursor.open(table_cursor, range_index) do |index_cursor|
+ n_matched_records = index_cursor.select(result_set, options)
+ end
+ end
+ else
+ IndexCursor.open(table_cursor, range_index) do |index_cursor|
+ n_matched_records = index_cursor.select(result_set, options)
+ end
+ end
+ end
+ rescue
+ result_set.close
+ raise
+ end
+
+ if n_matched_records <= @context.current_offset
+ @context.current_offset -= n_matched_records
+ result_set.close
+ return
+ end
+
+ if @context.current_offset > 0
+ @context.current_offset = 0
+ end
+ if @context.current_limit > 0
+ @context.current_limit -= result_set.size
+ end
+ @result_sets << result_set
+ end
+
+ def build_range_search_flags(min_border, max_border)
+ flags = TableCursorFlags::BY_KEY
+ case @context.order
+ when :ascending
+ flags |= TableCursorFlags::ASCENDING
+ when :descending
+ flags |= TableCursorFlags::DESCENDING
+ end
+ case min_border
+ when :include
+ flags |= TableCursorFlags::GE
+ when :exclude
+ flags |= TableCursorFlags::GT
+ end
+ case max_border
+ when :include
+ flags |= TableCursorFlags::LE
+ when :exclude
+ flags |= TableCursorFlags::LT
+ end
+ flags
+ end
+
+ def filter_table
+ create_expression(@table) do |expression|
+ yield(expression)
+ result_set = @table.select(expression)
+ sort_result_set(result_set)
+ end
+ end
+
+ def sort_result_set(result_set)
+ if result_set.empty?
+ result_set.close if result_set.temporary?
+ return
+ end
+
+ if result_set.size <= @context.current_offset
+ @context.current_offset -= result_set.size
+ result_set.close if result_set.temporary?
+ return
+ end
+
+ @unsorted_result_sets << result_set if result_set.temporary?
+ sort_keys = [
+ {
+ :key => @context.enumerator.shard_key_name,
+ :order => @context.order,
+ },
+ ]
+ if @context.current_limit > 0
+ limit = @context.current_limit
+ else
+ limit = result_set.size
+ end
+ sorted_result_set = result_set.sort(sort_keys,
+ :offset => @context.current_offset,
+ :limit => limit)
+ @result_sets << sorted_result_set
+ if @context.current_offset > 0
+ @context.current_offset = 0
+ end
+ if @context.current_limit > 0
+ @context.current_limit -= sorted_result_set.size
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/storage/mroonga/vendor/groonga/plugins/sharding/range_expression_builder.rb b/storage/mroonga/vendor/groonga/plugins/sharding/range_expression_builder.rb
new file mode 100644
index 00000000000..2e2dd29c51c
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/plugins/sharding/range_expression_builder.rb
@@ -0,0 +1,65 @@
+module Groonga
+ module Sharding
+ class RangeExpressionBuilder
+ def initialize(key, target_range, filter)
+ @key = key
+ @target_range = target_range
+ @filter = filter
+ end
+
+ def build_all(expression)
+ return if @filter.nil?
+
+ expression.parse(@filter)
+ end
+
+ def build_partial_min(expression)
+ expression.append_object(@key, Operator::PUSH, 1)
+ expression.append_operator(Operator::GET_VALUE, 1)
+ expression.append_constant(@target_range.min, Operator::PUSH, 1)
+ if @target_range.min_border == :include
+ expression.append_operator(Operator::GREATER_EQUAL, 2)
+ else
+ expression.append_operator(Operator::GREATER, 2)
+ end
+ if @filter
+ expression.parse(@filter)
+ expression.append_operator(Operator::AND, 2)
+ end
+ end
+
+ def build_partial_max(expression)
+ expression.append_object(@key, Operator::PUSH, 1)
+ expression.append_operator(Operator::GET_VALUE, 1)
+ expression.append_constant(@target_range.max, Operator::PUSH, 1)
+ if @target_range.max_border == :include
+ expression.append_operator(Operator::LESS_EQUAL, 2)
+ else
+ expression.append_operator(Operator::LESS, 2)
+ end
+ if @filter
+ expression.parse(@filter)
+ expression.append_operator(Operator::AND, 2)
+ end
+ end
+
+ def build_partial_min_and_max(expression)
+ between = Groonga::Context.instance["between"]
+ expression.append_object(between, Operator::PUSH, 1)
+ expression.append_object(@key, Operator::PUSH, 1)
+ expression.append_operator(Operator::GET_VALUE, 1)
+ expression.append_constant(@target_range.min, Operator::PUSH, 1)
+ expression.append_constant(@target_range.min_border,
+ Operator::PUSH, 1)
+ expression.append_constant(@target_range.max, Operator::PUSH, 1)
+ expression.append_constant(@target_range.max_border,
+ Operator::PUSH, 1)
+ expression.append_operator(Operator::CALL, 5)
+ if @filter
+ expression.parse(@filter)
+ expression.append_operator(Operator::AND, 2)
+ end
+ end
+ end
+ end
+end
diff --git a/storage/mroonga/vendor/groonga/plugins/sharding/sources.am b/storage/mroonga/vendor/groonga/plugins/sharding/sources.am
new file mode 100644
index 00000000000..5defd4880f1
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/plugins/sharding/sources.am
@@ -0,0 +1,5 @@
+sharding_scripts = \
+ logical_count.rb \
+ logical_enumerator.rb \
+ logical_range_filter.rb \
+ range_expression_builder.rb
diff --git a/storage/mroonga/vendor/groonga/plugins/suggest/CMakeLists.txt b/storage/mroonga/vendor/groonga/plugins/suggest/CMakeLists.txt
index 72b86362c55..519193918b4 100644
--- a/storage/mroonga/vendor/groonga/plugins/suggest/CMakeLists.txt
+++ b/storage/mroonga/vendor/groonga/plugins/suggest/CMakeLists.txt
@@ -24,6 +24,4 @@ set_source_files_properties(${SUGGEST_SOURCES}
COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS}")
set_target_properties(suggest PROPERTIES PREFIX "")
target_link_libraries(suggest libgroonga)
-if(NOT MRN_GROONGA_BUNDLED)
- install(TARGETS suggest DESTINATION "${GRN_RELATIVE_PLUGINS_DIR}/suggest")
-endif()
+install(TARGETS suggest DESTINATION "${GRN_RELATIVE_PLUGINS_DIR}/suggest")
diff --git a/storage/mroonga/vendor/groonga/plugins/suggest/suggest.c b/storage/mroonga/vendor/groonga/plugins/suggest/suggest.c
index 3e291b96d90..863ffcf13e3 100644
--- a/storage/mroonga/vendor/groonga/plugins/suggest/suggest.c
+++ b/storage/mroonga/vendor/groonga/plugins/suggest/suggest.c
@@ -15,15 +15,19 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "ctx.h"
-#include "db.h"
-#include "ii.h"
-#include "token.h"
-#include "output.h"
-#include <groonga/plugin.h>
#include <string.h>
+#include "grn_ctx.h"
+#include "grn_db.h"
+#include "grn_ii.h"
+#include "grn_token_cursor.h"
+#include "grn_output.h"
+#include <groonga/plugin.h>
+
#ifdef HAVE__STRNICMP
+# ifdef strncasecmp
+# undef strncasecmp
+# endif /* strcasecmp */
# define strncasecmp(s1,s2,n) _strnicmp(s1,s2,n)
#endif /* HAVE__STRNICMP */
@@ -130,12 +134,12 @@ grn_parse_suggest_types(grn_obj *text)
return types;
}
-static int32_t
+static double
cooccurrence_search(grn_ctx *ctx, grn_obj *items, grn_obj *items_boost, grn_id id,
grn_obj *res, int query_type, int frequency_threshold,
double conditional_probability_threshold)
{
- int32_t max_score = 0;
+ double max_score = 0.0;
if (id) {
grn_ii_cursor *c;
grn_obj *co = grn_obj_column(ctx, items, CONST_STR_LEN("co"));
@@ -194,7 +198,7 @@ cooccurrence_search(grn_ctx *ctx, grn_obj *items, grn_obj *items_boost, grn_id i
boost >= 0) {
grn_rset_recinfo *ri;
void *value;
- int32_t score = pfreq;
+ double score = pfreq;
int added;
if (max_score < score + boost) { max_score = score + boost; }
/* put any formula if desired */
@@ -275,7 +279,7 @@ complete_add_item(grn_ctx *ctx, grn_id id, grn_obj *res, int frequency_threshold
grn_obj_get_value(ctx, items_freq, id, item_freq);
grn_obj_get_value(ctx, items_boost, id, item_boost);
if (GRN_INT32_VALUE(item_boost) >= 0) {
- int32_t score;
+ double score;
score = 1 +
GRN_INT32_VALUE(item_freq) +
GRN_INT32_VALUE(item_boost);
@@ -380,12 +384,12 @@ correct(grn_ctx *ctx, grn_obj *items, grn_obj *items_boost,
if ((res = grn_table_create(ctx, NULL, 0, NULL,
GRN_TABLE_HASH_KEY|GRN_OBJ_WITH_SUBREC, items, NULL))) {
grn_id tid = grn_table_get(ctx, items, TEXT_VALUE_LEN(query));
- int32_t max_score;
+ double max_score;
max_score = cooccurrence_search(ctx, items, items_boost, tid, res, CORRECT,
frequency_threshold,
conditional_probability_threshold);
GRN_QUERY_LOG(ctx, GRN_QUERY_LOG_SCORE,
- ":", "cooccur(%d)", max_score);
+ ":", "cooccur(%f)", max_score);
if (GRN_TEXT_LEN(query) &&
((similar_search_mode == GRN_SUGGEST_SEARCH_YES) ||
(similar_search_mode == GRN_SUGGEST_SEARCH_AUTO &&
@@ -419,7 +423,7 @@ correct(grn_ctx *ctx, grn_obj *items, grn_obj *items_boost,
grn_obj_get_value(ctx, items_freq2, *rp, &item_freq2);
grn_obj_get_value(ctx, items_boost, *rp, &item_boost);
if (GRN_INT32_VALUE(&item_boost) >= 0) {
- int32_t score;
+ double score;
grn_rset_recinfo *ri;
score = 1 +
(GRN_INT32_VALUE(&item_freq2) >> 4) +
@@ -467,13 +471,13 @@ correct(grn_ctx *ctx, grn_obj *items, grn_obj *items_boost,
if ((tc = grn_table_cursor_open(ctx, res, NULL, 0, NULL, 0, 0, -1, 0))) {
grn_id id;
grn_obj score_value;
- GRN_INT32_INIT(&score_value, 0);
+ GRN_FLOAT_INIT(&score_value, 0);
while ((id = grn_table_cursor_next(ctx, tc)) != GRN_ID_NIL) {
GRN_RECORD_SET(ctx, var, id);
grn_expr_exec(ctx, expr, 0);
GRN_BULK_REWIND(&score_value);
grn_obj_get_value(ctx, score, id, &score_value);
- if (GRN_INT32_VALUE(&score_value) < frequency_threshold) {
+ if (GRN_FLOAT_VALUE(&score_value) < frequency_threshold) {
grn_table_cursor_delete(ctx, tc);
}
}
@@ -573,7 +577,18 @@ command_suggest(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_dat
if ((items = grn_ctx_get(ctx, TEXT_VALUE_LEN(VAR(1))))) {
if ((items_boost = grn_obj_column(ctx, items, CONST_STR_LEN("boost")))) {
- GRN_OUTPUT_MAP_OPEN("RESULT_SET", -1);
+ int n_outputs = 0;
+ if (types & COMPLETE) {
+ n_outputs++;
+ }
+ if (types & CORRECT) {
+ n_outputs++;
+ }
+ if (types & SUGGEST) {
+ n_outputs++;
+ }
+ GRN_OUTPUT_MAP_OPEN("RESULT_SET", n_outputs);
+
if (types & COMPLETE) {
if ((col = grn_obj_column(ctx, items, TEXT_VALUE_LEN(VAR(2))))) {
GRN_OUTPUT_CSTR("complete");
diff --git a/storage/mroonga/vendor/groonga/plugins/table/CMakeLists.txt b/storage/mroonga/vendor/groonga/plugins/table/CMakeLists.txt
index cba4697f042..eada0395080 100644
--- a/storage/mroonga/vendor/groonga/plugins/table/CMakeLists.txt
+++ b/storage/mroonga/vendor/groonga/plugins/table/CMakeLists.txt
@@ -24,6 +24,4 @@ set_source_files_properties(${TABLE_SOURCES}
COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS}")
set_target_properties(table PROPERTIES PREFIX "")
target_link_libraries(table libgroonga)
-if(NOT MRN_GROONGA_BUNDLED)
- install(TARGETS table DESTINATION "${GRN_RELATIVE_PLUGINS_DIR}/table")
-endif()
+install(TARGETS table DESTINATION "${GRN_RELATIVE_PLUGINS_DIR}/table")
diff --git a/storage/mroonga/vendor/groonga/plugins/table/table.c b/storage/mroonga/vendor/groonga/plugins/table/table.c
index a4fcd17bf90..3b0c09d9a91 100644
--- a/storage/mroonga/vendor/groonga/plugins/table/table.c
+++ b/storage/mroonga/vendor/groonga/plugins/table/table.c
@@ -17,10 +17,10 @@
#include <string.h>
-#include "ctx.h"
-#include "db.h"
-#include "output.h"
-#include "util.h"
+#include "grn_ctx.h"
+#include "grn_db.h"
+#include "grn_output.h"
+#include "grn_util.h"
#include <groonga/plugin.h>
#define VAR GRN_PROC_GET_VAR_BY_OFFSET
diff --git a/storage/mroonga/vendor/groonga/plugins/token_filters/CMakeLists.txt b/storage/mroonga/vendor/groonga/plugins/token_filters/CMakeLists.txt
index 9ffe53d2e8d..a0b964fb659 100644
--- a/storage/mroonga/vendor/groonga/plugins/token_filters/CMakeLists.txt
+++ b/storage/mroonga/vendor/groonga/plugins/token_filters/CMakeLists.txt
@@ -29,6 +29,19 @@ set_target_properties(stop_word_token_filter PROPERTIES
PREFIX ""
OUTPUT_NAME "stop_word")
target_link_libraries(stop_word_token_filter libgroonga)
-if(NOT MRN_GROONGA_BUNDLED)
- install(TARGETS stop_word_token_filter DESTINATION "${TOKEN_FILTERS_DIR}")
+install(TARGETS stop_word_token_filter DESTINATION "${TOKEN_FILTERS_DIR}")
+
+if(GRN_WITH_LIBSTEMMER)
+ read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/stem_sources.am STEM_SOURCES)
+ include_directories(${LIBSTEMMER_INCLUDE_DIRS})
+ link_directories(${LIBSTEMMER_LIBRARY_DIRS})
+ add_library(stem_token_filter MODULE ${STEM_SOURCES})
+ set_source_files_properties(${STEM_SOURCES}
+ PROPERTIES
+ COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS}")
+ set_target_properties(stem_token_filter PROPERTIES
+ PREFIX ""
+ OUTPUT_NAME "stem")
+ target_link_libraries(stem_token_filter libgroonga ${LIBSTEMMER_LIBRARIES})
+ install(TARGETS stem_token_filter DESTINATION "${TOKEN_FILTERS_DIR}")
endif()
diff --git a/storage/mroonga/vendor/groonga/plugins/token_filters/Makefile.am b/storage/mroonga/vendor/groonga/plugins/token_filters/Makefile.am
index 8d77466f053..c63bef7ac56 100644
--- a/storage/mroonga/vendor/groonga/plugins/token_filters/Makefile.am
+++ b/storage/mroonga/vendor/groonga/plugins/token_filters/Makefile.am
@@ -16,5 +16,13 @@ LIBS = \
token_filter_plugins_LTLIBRARIES =
token_filter_plugins_LTLIBRARIES += stop_word.la
+if WITH_LIBSTEMMER
+token_filter_plugins_LTLIBRARIES += stem.la
+endif
include stop_word_sources.am
+
+include stem_sources.am
+stem_la_CPPFLAGS = $(AM_CPPFLAGS) $(LIBSTEMMER_CFLAGS)
+stem_la_LIBADD = $(LIBS) $(LIBSTEMMER_LIBS)
+stem_la_LDFLAGS = $(AM_LDFLAGS) $(LIBSTEMMER_LDFLAGS)
diff --git a/storage/mroonga/vendor/groonga/plugins/token_filters/stem.c b/storage/mroonga/vendor/groonga/plugins/token_filters/stem.c
new file mode 100644
index 00000000000..010b8c91867
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/plugins/token_filters/stem.c
@@ -0,0 +1,275 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2014 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
+*/
+
+#include <grn_str.h>
+
+#include <groonga.h>
+#include <groonga/token_filter.h>
+
+#include <ctype.h>
+#include <string.h>
+
+#include <libstemmer.h>
+
+typedef struct {
+ struct sb_stemmer *stemmer;
+ grn_tokenizer_token token;
+ grn_obj buffer;
+} grn_stem_token_filter;
+
+static void *
+stem_init(grn_ctx *ctx, grn_obj *table, grn_token_mode mode)
+{
+ grn_stem_token_filter *token_filter;
+
+ token_filter = GRN_PLUGIN_MALLOC(ctx, sizeof(grn_stem_token_filter));
+ if (!token_filter) {
+ GRN_PLUGIN_ERROR(ctx, GRN_NO_MEMORY_AVAILABLE,
+ "[token-filter][stem] "
+ "failed to allocate grn_stem_token_filter");
+ return NULL;
+ }
+
+ {
+ /* TODO: Support other languages. */
+ const char *algorithm = "english";
+ const char *encoding = "UTF_8";
+ token_filter->stemmer = sb_stemmer_new(algorithm, encoding);
+ if (!token_filter->stemmer) {
+ GRN_PLUGIN_FREE(ctx, token_filter);
+ GRN_PLUGIN_ERROR(ctx, GRN_INVALID_ARGUMENT,
+ "[token-filter][stem] "
+ "failed to create stemmer: "
+ "algorithm=<%s>, encoding=<%s>",
+ algorithm, encoding);
+ return NULL;
+ }
+ }
+ grn_tokenizer_token_init(ctx, &(token_filter->token));
+ GRN_TEXT_INIT(&(token_filter->buffer), 0);
+
+ return token_filter;
+}
+
+static grn_bool
+is_stemmable(grn_obj *data, grn_bool *is_all_upper)
+{
+ const char *current, *end;
+ grn_bool have_lower = GRN_FALSE;
+ grn_bool have_upper = GRN_FALSE;
+
+ *is_all_upper = GRN_FALSE;
+
+ switch (data->header.domain) {
+ case GRN_DB_SHORT_TEXT :
+ case GRN_DB_TEXT :
+ case GRN_DB_LONG_TEXT :
+ break;
+ default :
+ return GRN_FALSE;
+ }
+
+ current = GRN_TEXT_VALUE(data);
+ end = current + GRN_TEXT_LEN(data);
+
+ for (; current < end; current++) {
+ if (islower(*current)) {
+ have_lower = GRN_TRUE;
+ continue;
+ }
+ if (isupper(*current)) {
+ have_upper = GRN_TRUE;
+ continue;
+ }
+ if (isdigit(*current)) {
+ continue;
+ }
+ switch (*current) {
+ case '-' :
+ case '\'' :
+ break;
+ default :
+ return GRN_FALSE;
+ }
+ }
+
+ if (!have_lower && have_upper) {
+ *is_all_upper = GRN_TRUE;
+ }
+
+ return GRN_TRUE;
+}
+
+static void
+normalize(grn_ctx *ctx,
+ const char *string, unsigned int length,
+ grn_obj *normalized)
+{
+ const char *current, *end;
+ const char *unwritten;
+
+ current = unwritten = string;
+ end = current + length;
+
+ for (; current < end; current++) {
+ if (isupper(*current)) {
+ if (current > unwritten) {
+ GRN_TEXT_PUT(ctx, normalized, unwritten, current - unwritten);
+ }
+ GRN_TEXT_PUTC(ctx, normalized, tolower(*current));
+ unwritten = current + 1;
+ }
+ }
+
+ if (current != unwritten) {
+ GRN_TEXT_PUT(ctx, normalized, unwritten, current - unwritten);
+ }
+}
+
+static void
+unnormalize(grn_ctx *ctx,
+ const char *string, unsigned int length,
+ grn_obj *normalized)
+{
+ const char *current, *end;
+ const char *unwritten;
+
+ current = unwritten = string;
+ end = current + length;
+
+ for (; current < end; current++) {
+ if (islower(*current)) {
+ if (current > unwritten) {
+ GRN_TEXT_PUT(ctx, normalized, unwritten, current - unwritten);
+ }
+ GRN_TEXT_PUTC(ctx, normalized, toupper(*current));
+ unwritten = current + 1;
+ }
+ }
+
+ if (current != unwritten) {
+ GRN_TEXT_PUT(ctx, normalized, unwritten, current - unwritten);
+ }
+}
+
+static void
+stem_filter(grn_ctx *ctx,
+ grn_token *current_token,
+ grn_token *next_token,
+ void *user_data)
+{
+ grn_stem_token_filter *token_filter = user_data;
+ grn_obj *data;
+ grn_bool is_all_upper = GRN_FALSE;
+
+ if (GRN_CTX_GET_ENCODING(ctx) != GRN_ENC_UTF8) {
+ return;
+ }
+
+ data = grn_token_get_data(ctx, current_token);
+ if (!is_stemmable(data, &is_all_upper)) {
+ return;
+ }
+
+ {
+ const sb_symbol *stemmed;
+
+ if (is_all_upper) {
+ grn_obj *buffer;
+ buffer = &(token_filter->buffer);
+ GRN_BULK_REWIND(buffer);
+ normalize(ctx,
+ GRN_TEXT_VALUE(data),
+ GRN_TEXT_LEN(data),
+ buffer);
+ stemmed = sb_stemmer_stem(token_filter->stemmer,
+ GRN_TEXT_VALUE(buffer), GRN_TEXT_LEN(buffer));
+ if (stemmed) {
+ GRN_BULK_REWIND(buffer);
+ unnormalize(ctx,
+ stemmed,
+ sb_stemmer_length(token_filter->stemmer),
+ buffer);
+ grn_token_set_data(ctx, next_token,
+ GRN_TEXT_VALUE(buffer), GRN_TEXT_LEN(buffer));
+ } else {
+ GRN_PLUGIN_ERROR(ctx, GRN_NO_MEMORY_AVAILABLE,
+ "[token-filter][stem] "
+ "failed to allocate memory for stemmed word: <%.*s> "
+ "(normalized: <%.*s>)",
+ (int)GRN_TEXT_LEN(data), GRN_TEXT_VALUE(data),
+ (int)GRN_TEXT_LEN(buffer), GRN_TEXT_VALUE(buffer));
+ }
+ } else {
+ stemmed = sb_stemmer_stem(token_filter->stemmer,
+ GRN_TEXT_VALUE(data), GRN_TEXT_LEN(data));
+ if (stemmed) {
+ grn_token_set_data(ctx, next_token,
+ stemmed,
+ sb_stemmer_length(token_filter->stemmer));
+ } else {
+ GRN_PLUGIN_ERROR(ctx, GRN_NO_MEMORY_AVAILABLE,
+ "[token-filter][stem] "
+ "failed to allocate memory for stemmed word: <%.*s>",
+ (int)GRN_TEXT_LEN(data), GRN_TEXT_VALUE(data));
+ }
+ }
+ }
+}
+
+static void
+stem_fin(grn_ctx *ctx, void *user_data)
+{
+ grn_stem_token_filter *token_filter = user_data;
+ if (!token_filter) {
+ return;
+ }
+
+ grn_tokenizer_token_fin(ctx, &(token_filter->token));
+ if (token_filter->stemmer) {
+ sb_stemmer_delete(token_filter->stemmer);
+ }
+ GRN_OBJ_FIN(ctx, &(token_filter->buffer));
+ GRN_PLUGIN_FREE(ctx, token_filter);
+}
+
+grn_rc
+GRN_PLUGIN_INIT(grn_ctx *ctx)
+{
+ return ctx->rc;
+}
+
+grn_rc
+GRN_PLUGIN_REGISTER(grn_ctx *ctx)
+{
+ grn_rc rc;
+
+ rc = grn_token_filter_register(ctx,
+ "TokenFilterStem", -1,
+ stem_init,
+ stem_filter,
+ stem_fin);
+
+ return rc;
+}
+
+grn_rc
+GRN_PLUGIN_FIN(grn_ctx *ctx)
+{
+ return GRN_SUCCESS;
+}
diff --git a/storage/mroonga/vendor/groonga/plugins/token_filters/stem_sources.am b/storage/mroonga/vendor/groonga/plugins/token_filters/stem_sources.am
new file mode 100644
index 00000000000..d02a39526e2
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/plugins/token_filters/stem_sources.am
@@ -0,0 +1,2 @@
+stem_la_SOURCES = \
+ stem.c
diff --git a/storage/mroonga/vendor/groonga/plugins/token_filters/stop_word.c b/storage/mroonga/vendor/groonga/plugins/token_filters/stop_word.c
index 21451f00b25..054cd65aa37 100644
--- a/storage/mroonga/vendor/groonga/plugins/token_filters/stop_word.c
+++ b/storage/mroonga/vendor/groonga/plugins/token_filters/stop_word.c
@@ -16,7 +16,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <str.h>
+#include <grn_str.h>
#include <groonga.h>
#include <groonga/token_filter.h>
@@ -38,6 +38,10 @@ stop_word_init(grn_ctx *ctx, grn_obj *table, grn_token_mode mode)
{
grn_stop_word_token_filter *token_filter;
+ if (mode != GRN_TOKEN_GET) {
+ return NULL;
+ }
+
token_filter = GRN_PLUGIN_MALLOC(ctx, sizeof(grn_stop_word_token_filter));
if (!token_filter) {
GRN_PLUGIN_ERROR(ctx, GRN_NO_MEMORY_AVAILABLE,
@@ -83,28 +87,29 @@ stop_word_filter(grn_ctx *ctx,
void *user_data)
{
grn_stop_word_token_filter *token_filter = user_data;
+ grn_id id;
+ grn_obj *data;
+
+ if (!token_filter) {
+ return;
+ }
- if (token_filter->mode == GRN_TOKEN_GET) {
- grn_id id;
- grn_obj *data;
-
- data = grn_token_get_data(ctx, current_token);
- id = grn_table_get(ctx,
- token_filter->table,
- GRN_TEXT_VALUE(data),
- GRN_TEXT_LEN(data));
- if (id != GRN_ID_NIL) {
- GRN_BULK_REWIND(&(token_filter->value));
- grn_obj_get_value(ctx,
- token_filter->column,
- id,
- &(token_filter->value));
- if (GRN_BOOL_VALUE(&(token_filter->value))) {
- grn_tokenizer_status status;
- status = grn_token_get_status(ctx, current_token);
- status |= GRN_TOKENIZER_TOKEN_SKIP;
- grn_token_set_status(ctx, next_token, status);
- }
+ data = grn_token_get_data(ctx, current_token);
+ id = grn_table_get(ctx,
+ token_filter->table,
+ GRN_TEXT_VALUE(data),
+ GRN_TEXT_LEN(data));
+ if (id != GRN_ID_NIL) {
+ GRN_BULK_REWIND(&(token_filter->value));
+ grn_obj_get_value(ctx,
+ token_filter->column,
+ id,
+ &(token_filter->value));
+ if (GRN_BOOL_VALUE(&(token_filter->value))) {
+ grn_tokenizer_status status;
+ status = grn_token_get_status(ctx, current_token);
+ status |= GRN_TOKEN_SKIP;
+ grn_token_set_status(ctx, next_token, status);
}
}
}
diff --git a/storage/mroonga/vendor/groonga/plugins/tokenizers/CMakeLists.txt b/storage/mroonga/vendor/groonga/plugins/tokenizers/CMakeLists.txt
index e044c1fbb93..5871e982211 100644
--- a/storage/mroonga/vendor/groonga/plugins/tokenizers/CMakeLists.txt
+++ b/storage/mroonga/vendor/groonga/plugins/tokenizers/CMakeLists.txt
@@ -30,9 +30,7 @@ if(GRN_WITH_MECAB)
PREFIX ""
OUTPUT_NAME "mecab")
target_link_libraries(mecab_tokenizer libgroonga ${MECAB_LIBRARIES})
- if(NOT MRN_GROONGA_BUNDLED)
- install(TARGETS mecab_tokenizer DESTINATION "${TOKENIZERS_DIR}")
- endif()
+ install(TARGETS mecab_tokenizer DESTINATION "${TOKENIZERS_DIR}")
endif()
if(GRN_WITH_KYTEA)
@@ -47,7 +45,5 @@ if(GRN_WITH_KYTEA)
PREFIX ""
OUTPUT_NAME "kytea")
target_link_libraries(kytea_tokenizer libgroonga ${KYTEA_LIBRARIES})
- if(NOT MRN_GROONGA_BUNDLED)
- install(TARGETS kytea_tokenizer DESTINATION "${TOKENIZERS_DIR}")
- endif()
+ install(TARGETS kytea_tokenizer DESTINATION "${TOKENIZERS_DIR}")
endif()
diff --git a/storage/mroonga/vendor/groonga/plugins/tokenizers/mecab.c b/storage/mroonga/vendor/groonga/plugins/tokenizers/mecab.c
index 4ac99f9a9e8..9207f94229e 100644
--- a/storage/mroonga/vendor/groonga/plugins/tokenizers/mecab.c
+++ b/storage/mroonga/vendor/groonga/plugins/tokenizers/mecab.c
@@ -1,5 +1,5 @@
/* -*- c-basic-offset: 2 -*- */
-/* Copyright(C) 2009-2012 Brazil
+/* Copyright(C) 2009-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -15,13 +15,14 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <str.h>
+#include <grn_str.h>
#include <groonga.h>
#include <groonga/tokenizer.h>
#include <mecab.h>
+#include <stdlib.h>
#include <string.h>
#include <ctype.h>
@@ -29,6 +30,9 @@ static mecab_t *sole_mecab = NULL;
static grn_plugin_mutex *sole_mecab_mutex = NULL;
static grn_encoding sole_mecab_encoding = GRN_ENC_NONE;
+static grn_bool grn_mecab_chunked_tokenize_enabled = GRN_FALSE;
+static int grn_mecab_chunk_size_threshold = 8192;
+
typedef struct {
mecab_t *mecab;
grn_obj buf;
@@ -38,6 +42,21 @@ typedef struct {
grn_tokenizer_token token;
} grn_mecab_tokenizer;
+static const char *
+mecab_global_error_message(void)
+{
+ double version;
+
+ version = atof(mecab_version());
+ /* MeCab <= 0.993 doesn't support mecab_strerror(NULL). */
+ if (version <= 0.993) {
+ return "Unknown";
+ }
+
+ return mecab_strerror(NULL);
+}
+
+
static grn_encoding
translate_mecab_charset_to_grn_encoding(const char *charset)
{
@@ -67,6 +86,187 @@ get_mecab_encoding(mecab_t *mecab)
return encoding;
}
+static inline grn_bool
+is_delimiter_character(grn_ctx *ctx, const char *character, int character_bytes)
+{
+ switch (character_bytes) {
+ case 1 :
+ switch (character[0]) {
+ case ',' :
+ case '.' :
+ case '!' :
+ case '?' :
+ return GRN_TRUE;
+ default :
+ return GRN_FALSE;
+ }
+ case 3 :
+ switch ((unsigned char)(character[0])) {
+ case 0xE3 :
+ switch ((unsigned char)(character[1])) {
+ case 0x80 :
+ switch ((unsigned char)(character[2])) {
+ case 0x81 : /* U+3001 (0xE3 0x80 0x81 in UTF-8) IDEOGRAPHIC COMMA */
+ case 0x82 : /* U+3002 (0xE3 0x80 0x82 in UTF-8) IDEOGRAPHIC FULL STOP */
+ return GRN_TRUE;
+ default :
+ return GRN_FALSE;
+ }
+ default :
+ return GRN_FALSE;
+ }
+ return GRN_FALSE;
+ case 0xEF :
+ switch ((unsigned char)(character[1])) {
+ case 0xBC :
+ switch ((unsigned char)(character[2])) {
+ case 0x81 :
+ /* U+FF01 (0xEF 0xBC 0x81 in UTF-8) FULLWIDTH EXCLAMATION MARK */
+ case 0x9F :
+ /* U+FF1F (0xEF 0xBC 0x9F in UTF-8) FULLWIDTH QUESTION MARK */
+ return GRN_TRUE;
+ default :
+ return GRN_FALSE;
+ }
+ default :
+ return GRN_FALSE;
+ }
+ return GRN_FALSE;
+ default :
+ return GRN_FALSE;
+ }
+ default :
+ return GRN_FALSE;
+ }
+}
+
+static grn_bool
+chunked_tokenize_utf8_chunk(grn_ctx *ctx,
+ grn_mecab_tokenizer *tokenizer,
+ const char *chunk,
+ unsigned int chunk_bytes)
+{
+ const char *tokenized_chunk;
+ size_t tokenized_chunk_length;
+
+ tokenized_chunk = mecab_sparse_tostr2(tokenizer->mecab, chunk, chunk_bytes);
+ if (!tokenized_chunk) {
+ GRN_PLUGIN_ERROR(ctx, GRN_TOKENIZER_ERROR,
+ "[tokenizer][mecab][chunk] "
+ "mecab_sparse_tostr2() failed len=%d err=%s",
+ chunk_bytes,
+ mecab_strerror(tokenizer->mecab));
+ return GRN_FALSE;
+ }
+
+ if (GRN_TEXT_LEN(&(tokenizer->buf)) > 0) {
+ GRN_TEXT_PUTS(ctx, &(tokenizer->buf), " ");
+ }
+
+ tokenized_chunk_length = strlen(tokenized_chunk);
+ if (tokenized_chunk_length >= 1 &&
+ isspace(tokenized_chunk[tokenized_chunk_length - 1])) {
+ GRN_TEXT_PUT(ctx, &(tokenizer->buf),
+ tokenized_chunk, tokenized_chunk_length - 1);
+ } else {
+ GRN_TEXT_PUT(ctx, &(tokenizer->buf),
+ tokenized_chunk, tokenized_chunk_length);
+ }
+
+ return GRN_TRUE;
+}
+
+static grn_bool
+chunked_tokenize_utf8(grn_ctx *ctx,
+ grn_mecab_tokenizer *tokenizer,
+ const char *string,
+ unsigned int string_bytes)
+{
+ const char *chunk_start;
+ const char *current;
+ const char *last_delimiter;
+ const char *string_end = string + string_bytes;
+ grn_encoding encoding = tokenizer->query->encoding;
+
+ if (string_bytes < grn_mecab_chunk_size_threshold) {
+ return chunked_tokenize_utf8_chunk(ctx,
+ tokenizer,
+ string,
+ string_bytes);
+ }
+
+ chunk_start = current = string;
+ last_delimiter = NULL;
+ while (current < string_end) {
+ int space_bytes;
+ int character_bytes;
+ const char *current_character;
+
+ space_bytes = grn_isspace(current, encoding);
+ if (space_bytes > 0) {
+ if (chunk_start != current) {
+ grn_bool succeeded;
+ succeeded = chunked_tokenize_utf8_chunk(ctx,
+ tokenizer,
+ chunk_start,
+ current - chunk_start);
+ if (!succeeded) {
+ return succeeded;
+ }
+ }
+ current += space_bytes;
+ chunk_start = current;
+ last_delimiter = NULL;
+ continue;
+ }
+
+ character_bytes = grn_charlen_(ctx, current, string_end, encoding);
+ if (character_bytes == 0) {
+ GRN_PLUGIN_ERROR(ctx, GRN_TOKENIZER_ERROR,
+ "[tokenizer][mecab][chunk] "
+ "invalid byte sequence: position=%d",
+ (int)(current - string));
+ return GRN_FALSE;
+ }
+
+ current_character = current;
+ current += character_bytes;
+ if (is_delimiter_character(ctx, current_character, character_bytes)) {
+ last_delimiter = current;
+ }
+
+ if ((current - chunk_start) >= grn_mecab_chunk_size_threshold) {
+ grn_bool succeeded;
+ if (last_delimiter) {
+ succeeded = chunked_tokenize_utf8_chunk(ctx,
+ tokenizer,
+ chunk_start,
+ last_delimiter - chunk_start);
+ chunk_start = last_delimiter;
+ } else {
+ succeeded = chunked_tokenize_utf8_chunk(ctx,
+ tokenizer,
+ chunk_start,
+ current - chunk_start);
+ chunk_start = current;
+ }
+ if (!succeeded) {
+ return succeeded;
+ }
+ last_delimiter = NULL;
+ }
+ }
+
+ if (current == chunk_start) {
+ return GRN_TRUE;
+ } else {
+ return chunked_tokenize_utf8_chunk(ctx,
+ tokenizer,
+ chunk_start,
+ current - chunk_start);
+ }
+}
+
/*
This function is called for a full text search query or a document to be
indexed. This means that both short/long strings are given.
@@ -76,7 +276,6 @@ get_mecab_encoding(mecab_t *mecab)
static grn_obj *
mecab_init(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
{
- const char *s;
grn_mecab_tokenizer *tokenizer;
unsigned int normalizer_flags = 0;
grn_tokenizer_query *query;
@@ -96,7 +295,7 @@ mecab_init(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
GRN_PLUGIN_ERROR(ctx, GRN_TOKENIZER_ERROR,
"[tokenizer][mecab] "
"mecab_new2() failed on mecab_init(): %s",
- mecab_strerror(NULL));
+ mecab_global_error_message());
} else {
sole_mecab_encoding = get_mecab_encoding(sole_mecab);
}
@@ -143,21 +342,33 @@ mecab_init(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
tokenizer->next = "";
tokenizer->end = tokenizer->next;
} else {
+ grn_bool succeeded;
grn_plugin_mutex_lock(ctx, sole_mecab_mutex);
- s = mecab_sparse_tostr2(tokenizer->mecab,
- normalized_string,
- normalized_string_length);
- if (!s) {
- GRN_PLUGIN_ERROR(ctx, GRN_TOKENIZER_ERROR,
- "[tokenizer][mecab] "
- "mecab_sparse_tostr() failed len=%d err=%s",
- normalized_string_length,
- mecab_strerror(tokenizer->mecab));
+ if (grn_mecab_chunked_tokenize_enabled &&
+ ctx->encoding == GRN_ENC_UTF8) {
+ succeeded = chunked_tokenize_utf8(ctx,
+ tokenizer,
+ normalized_string,
+ normalized_string_length);
} else {
- GRN_TEXT_PUTS(ctx, &(tokenizer->buf), s);
+ const char *s;
+ s = mecab_sparse_tostr2(tokenizer->mecab,
+ normalized_string,
+ normalized_string_length);
+ if (!s) {
+ succeeded = GRN_FALSE;
+ GRN_PLUGIN_ERROR(ctx, GRN_TOKENIZER_ERROR,
+ "[tokenizer][mecab] "
+ "mecab_sparse_tostr() failed len=%d err=%s",
+ normalized_string_length,
+ mecab_strerror(tokenizer->mecab));
+ } else {
+ succeeded = GRN_TRUE;
+ GRN_TEXT_PUTS(ctx, &(tokenizer->buf), s);
+ }
}
grn_plugin_mutex_unlock(ctx, sole_mecab_mutex);
- if (!s) {
+ if (!succeeded) {
grn_tokenizer_query_close(ctx, tokenizer->query);
GRN_PLUGIN_FREE(ctx, tokenizer);
return NULL;
@@ -207,19 +418,31 @@ mecab_next(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
grn_tokenizer_status status;
for (r = p; r < e; r += cl) {
+ int space_len;
+
+ space_len = grn_isspace(r, encoding);
+ if (space_len > 0 && r == p) {
+ cl = space_len;
+ p = r + cl;
+ continue;
+ }
+
if (!(cl = grn_charlen_(ctx, r, e, encoding))) {
tokenizer->next = e;
break;
}
- if (grn_isspace(r, encoding)) {
- const char *q = r;
- while ((cl = grn_isspace(q, encoding))) { q += cl; }
+
+ if (space_len > 0) {
+ const char *q = r + space_len;
+ while (q < e && (space_len = grn_isspace(q, encoding))) {
+ q += space_len;
+ }
tokenizer->next = q;
break;
}
}
- if (r == e) {
+ if (r == e || tokenizer->next == e) {
status = GRN_TOKENIZER_LAST;
} else {
status = GRN_TOKENIZER_CONTINUE;
@@ -256,10 +479,10 @@ check_mecab_dictionary_encoding(grn_ctx *ctx)
mecab = mecab_new2("-Owakati");
if (mecab) {
grn_encoding encoding;
- int have_same_encoding_dictionary = 0;
+ grn_bool have_same_encoding_dictionary;
encoding = GRN_CTX_GET_ENCODING(ctx);
- have_same_encoding_dictionary = encoding == get_mecab_encoding(mecab);
+ have_same_encoding_dictionary = (encoding == get_mecab_encoding(mecab));
mecab_destroy(mecab);
if (!have_same_encoding_dictionary) {
@@ -273,7 +496,7 @@ check_mecab_dictionary_encoding(grn_ctx *ctx)
GRN_PLUGIN_ERROR(ctx, GRN_TOKENIZER_ERROR,
"[tokenizer][mecab] "
"mecab_new2 failed in check_mecab_dictionary_encoding: %s",
- mecab_strerror(NULL));
+ mecab_global_error_message());
}
#endif
}
@@ -285,6 +508,30 @@ check_mecab_dictionary_encoding(grn_ctx *ctx)
grn_rc
GRN_PLUGIN_INIT(grn_ctx *ctx)
{
+ {
+ const char *env;
+
+ env = getenv("GRN_MECAB_CHUNKED_TOKENIZE_ENABLED");
+ grn_mecab_chunked_tokenize_enabled = (env && strcmp(env, "yes") == 0);
+ }
+
+ {
+ const char *env;
+
+ env = getenv("GRN_MECAB_CHUNK_SIZE_THRESHOLD");
+ if (env) {
+ int threshold = -1;
+ const char *end;
+ const char *rest;
+
+ end = env + strlen(env);
+ threshold = grn_atoi(env, end, &rest);
+ if (end > env && end == rest) {
+ grn_mecab_chunk_size_threshold = threshold;
+ }
+ }
+ }
+
sole_mecab = NULL;
sole_mecab_mutex = grn_plugin_mutex_open(ctx);
if (!sole_mecab_mutex) {
diff --git a/storage/mroonga/vendor/groonga/src/CMakeLists.txt b/storage/mroonga/vendor/groonga/src/CMakeLists.txt
index 4d02109dae5..258d1866c2b 100644
--- a/storage/mroonga/vendor/groonga/src/CMakeLists.txt
+++ b/storage/mroonga/vendor/groonga/src/CMakeLists.txt
@@ -25,9 +25,7 @@ set_source_files_properties(${GROONGA_SOURCES}
PROPERTIES
COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS}")
target_link_libraries(groonga libgroonga)
-if(NOT MRN_GROONGA_BUNDLED)
- install(TARGETS groonga DESTINATION ${BIN_DIR})
-endif()
+install(TARGETS groonga DESTINATION ${BIN_DIR})
if(NOT WIN32)
read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/grnslap_sources.am GRNSLAP_SOURCES)
@@ -36,9 +34,7 @@ if(NOT WIN32)
PROPERTIES
COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS}")
target_link_libraries(grnslap libgroonga)
- if(NOT MRN_GROONGA_BUNDLED)
- install(TARGETS grnslap DESTINATION ${BIN_DIR})
- endif()
+ install(TARGETS grnslap DESTINATION ${BIN_DIR})
endif()
read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/groonga_benchmark_sources.am
@@ -48,7 +44,5 @@ set_source_files_properties(${GROONGA_BENCHMARK_SOURCES}
PROPERTIES
COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS}")
target_link_libraries(groonga-benchmark libgroonga)
-if(NOT MRN_GROONGA_BUNDLED)
- install(TARGETS groonga-benchmark DESTINATION ${BIN_DIR})
-endif()
+install(TARGETS groonga-benchmark DESTINATION ${BIN_DIR})
diff --git a/storage/mroonga/vendor/groonga/src/Makefile.am b/storage/mroonga/vendor/groonga/src/Makefile.am
index b125db54c3d..a4d57e85c44 100644
--- a/storage/mroonga/vendor/groonga/src/Makefile.am
+++ b/storage/mroonga/vendor/groonga/src/Makefile.am
@@ -6,6 +6,10 @@ NONEXISTENT_CXX_SOURCE = nonexistent.cpp
bin_PROGRAMS = groonga groonga-benchmark
noinst_PROGRAMS = grnslap
+if WITH_MRUBY
+bin_PROGRAMS += grndb
+noinst_PROGRAMS += groonga-mruby
+endif
EXTRA_DIST = \
CMakeLists.txt
@@ -22,9 +26,8 @@ AM_LDFLAGS = -no-undefined
DEFAULT_INCLUDES = \
-I$(top_builddir) \
- -I$(srcdir) \
- -I$(top_srcdir) \
-I$(top_srcdir)/include \
+ -I$(top_srcdir)/lib \
$(GROONGA_INCLUDEDIR)
include groonga_sources.am
@@ -46,3 +49,15 @@ nodist_EXTRA_groonga_benchmark_SOURCES = $(NONEXISTENT_CXX_SOURCE)
groonga_benchmark_LDADD = \
$(top_builddir)/lib/libgroonga.la \
$(MESSAGE_PACK_LIBS)
+
+include grndb_sources.am
+nodist_EXTRA_grndb_SOURCES = $(NONEXISTENT_CXX_SOURCE)
+grndb_LDADD = \
+ $(top_builddir)/lib/libgroonga.la \
+ $(MESSAGE_PACK_LIBS)
+
+include groonga_mruby_sources.am
+nodist_EXTRA_groonga_mruby_SOURCES = $(NONEXISTENT_CXX_SOURCE)
+groonga_mruby_LDADD = \
+ $(top_builddir)/lib/libgroonga.la \
+ $(MESSAGE_PACK_LIBS)
diff --git a/storage/mroonga/vendor/groonga/src/grndb.c b/storage/mroonga/vendor/groonga/src/grndb.c
new file mode 100644
index 00000000000..d493338f57e
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/src/grndb.c
@@ -0,0 +1,137 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2014 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
+*/
+
+#ifdef WIN32
+# define GROONGA_MAIN
+#endif /* WIN32 */
+
+#include <grn_mrb.h>
+#include <grn_ctx_impl.h>
+
+#include <mruby/variable.h>
+#include <mruby/array.h>
+
+static int
+run_command(grn_ctx *ctx, int argc, char **argv)
+{
+ int exit_code = EXIT_SUCCESS;
+ grn_mrb_data *data = &(ctx->impl->mrb);
+ mrb_state *mrb = data->state;
+ mrb_value mrb_command_line_module;
+ mrb_value mrb_grndb_class;
+
+ mrb_command_line_module = mrb_const_get(mrb,
+ mrb_obj_value(data->module),
+ mrb_intern_cstr(mrb, "CommandLine"));
+ if (mrb->exc) {
+ goto exit;
+ }
+
+ mrb_grndb_class = mrb_const_get(mrb,
+ mrb_command_line_module,
+ mrb_intern_cstr(mrb, "Grndb"));
+ if (mrb->exc) {
+ goto exit;
+ }
+
+ {
+ int i;
+ mrb_value mrb_argv;
+ mrb_value mrb_grndb;
+ mrb_value mrb_result;
+
+ mrb_argv = mrb_ary_new_capa(mrb, argc);
+ for (i = 0; i < argc; i++) {
+ mrb_ary_push(mrb, mrb_argv, mrb_str_new_cstr(mrb, argv[i]));
+ }
+ mrb_grndb = mrb_funcall(mrb, mrb_grndb_class, "new", 1, mrb_argv);
+ if (mrb->exc) {
+ goto exit;
+ }
+
+ mrb_result = mrb_funcall(mrb, mrb_grndb, "run", 0);
+ if (mrb->exc) {
+ goto exit;
+ }
+
+ if (!mrb_bool(mrb_result)) {
+ exit_code = EXIT_FAILURE;
+ }
+ }
+
+exit :
+ if (mrb->exc) {
+ mrb_print_error(mrb);
+ exit_code = EXIT_FAILURE;
+ }
+
+ return exit_code;
+}
+
+static int
+run(grn_ctx *ctx, int argc, char **argv)
+{
+ int exit_code = EXIT_SUCCESS;
+ const char *grndb_rb = "command_line/grndb.rb";
+ grn_mrb_data *data = &(ctx->impl->mrb);
+ mrb_state *mrb = data->state;
+
+ mrb_gv_set(mrb, mrb_intern_lit(mrb, "$0"), mrb_str_new_cstr(mrb, argv[0]));
+
+ grn_mrb_load(ctx, grndb_rb);
+ if (ctx->rc != GRN_SUCCESS) {
+ fprintf(stderr, "Failed to load Ruby script: <%s>: %s",
+ grndb_rb, ctx->errbuf);
+ goto exit;
+ }
+
+ {
+ int arena_index;
+
+ arena_index = mrb_gc_arena_save(mrb);
+ exit_code = run_command(ctx, argc, argv);
+ mrb_gc_arena_restore(mrb, arena_index);
+ }
+
+exit :
+ if (ctx->rc != GRN_SUCCESS) {
+ exit_code = EXIT_FAILURE;
+ }
+ return exit_code;
+}
+
+int
+main(int argc, char **argv)
+{
+ int exit_code = EXIT_SUCCESS;
+
+ if (grn_init() != GRN_SUCCESS) {
+ return EXIT_FAILURE;
+ }
+
+ {
+ grn_ctx ctx;
+ grn_ctx_init(&ctx, 0);
+ exit_code = run(&ctx, argc, argv);
+ grn_ctx_fin(&ctx);
+ }
+
+ grn_fin();
+
+ return exit_code;
+}
diff --git a/storage/mroonga/vendor/groonga/src/grndb_sources.am b/storage/mroonga/vendor/groonga/src/grndb_sources.am
new file mode 100644
index 00000000000..ce2e2bb3466
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/src/grndb_sources.am
@@ -0,0 +1,2 @@
+grndb_SOURCES = \
+ grndb.c
diff --git a/storage/mroonga/vendor/groonga/src/grnslap.c b/storage/mroonga/vendor/groonga/src/grnslap.c
index 5400fbb23e0..2f5562fe6a9 100644
--- a/storage/mroonga/vendor/groonga/src/grnslap.c
+++ b/storage/mroonga/vendor/groonga/src/grnslap.c
@@ -16,8 +16,8 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "lib/com.h"
-#include "lib/ctx_impl.h"
+#include <grn_com.h>
+#include <grn_ctx_impl.h>
#include <string.h>
#include <stdio.h>
#ifdef HAVE_SYS_WAIT_H
@@ -54,7 +54,7 @@ lprint(grn_ctx *ctx, const char *fmt, ...)
int len;
va_list argp;
grn_timeval_now(ctx, &tv);
- grn_timeval2str(ctx, &tv, buf);
+ grn_timeval2str(ctx, &tv, buf, 1024);
len = strlen(buf);
buf[len++] = '|';
va_start(argp, fmt);
@@ -196,7 +196,7 @@ msg_handler(grn_ctx *ctx, grn_obj *msg)
grn_msg_close(ctx, msg);
}
-static void * CALLBACK
+static grn_thread_func_result CALLBACK
receiver(void *arg)
{
grn_ctx ctx_, *ctx = &ctx_;
@@ -213,7 +213,7 @@ receiver(void *arg)
*/
}
grn_ctx_fin(ctx);
- return NULL;
+ return GRN_THREAD_FUNC_RETURN_VALUE;
}
static int
diff --git a/storage/mroonga/vendor/groonga/src/groonga.c b/storage/mroonga/vendor/groonga/src/groonga.c
index 9d1009d72da..262c4de2e86 100644
--- a/storage/mroonga/vendor/groonga/src/groonga.c
+++ b/storage/mroonga/vendor/groonga/src/groonga.c
@@ -1,6 +1,6 @@
/* -*- c-basic-offset: 2 -*- */
/*
- Copyright(C) 2009-2014 Brazil
+ Copyright(C) 2009-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,20 +16,23 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifdef WIN32
-# define GROONGA_MAIN
-#endif /* WIN32 */
-#include "lib/groonga_in.h"
-
-#include "lib/com.h"
-#include "lib/ctx_impl.h"
-#include "lib/proc.h"
-#include "lib/db.h"
-#include "lib/util.h"
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <fcntl.h>
+#include <sys/stat.h>
+
+#ifdef WIN32
+# define GROONGA_MAIN
+#endif /* WIN32 */
+#include <grn.h>
+
+#include <grn_com.h>
+#include <grn_ctx_impl.h>
+#include <grn_proc.h>
+#include <grn_db.h>
+#include <grn_util.h>
+
#ifdef HAVE_SYS_WAIT_H
# include <sys/wait.h>
#endif /* HAVE_SYS_WAIT_H */
@@ -48,7 +51,14 @@
# include <sys/sysctl.h>
#endif /* HAVE_SYS_SYSCTL_H */
+#ifdef HAVE_IO_H
+# include <io.h>
+#endif /* HAVE_IO_H */
+
#ifdef HAVE__STRNICMP
+# ifdef strncasecmp
+# undef strncasecmp
+# endif /* strcasecmp */
# define strncasecmp(s1,s2,n) _strnicmp(s1,s2,n)
#endif /* HAVE__STRNICMP */
@@ -133,8 +143,8 @@ line_editor_init(int argc __attribute__((unused)), char *argv[])
setlocale(LC_ALL, "");
if (strlen(HOME_PATH) + strlen(HISTORY_PATH) < PATH_MAX) {
- strcpy(line_editor_history_path, HOME_PATH);
- strcat(line_editor_history_path, HISTORY_PATH);
+ grn_strcpy(line_editor_history_path, PATH_MAX, HOME_PATH);
+ grn_strcat(line_editor_history_path, PATH_MAX, HISTORY_PATH);
} else {
line_editor_history_path[0] = '\0';
}
@@ -210,6 +220,7 @@ read_next_line(grn_ctx *ctx, grn_obj *buf)
rc = line_editor_fgets(ctx, buf);
#else
fprintf(stderr, "> ");
+ fflush(stderr);
rc = grn_text_fgets(ctx, buf, stdin);
#endif
} else {
@@ -271,31 +282,77 @@ output_envelope(grn_ctx *ctx, grn_rc rc, grn_obj *head, grn_obj *body, grn_obj *
}
static void
-s_output(grn_ctx *ctx, int flags, void *arg)
+s_output_raw(grn_ctx *ctx, int flags, FILE *stream)
+{
+ char *chunk = NULL;
+ unsigned int chunk_size = 0;
+ int recv_flags;
+
+ grn_ctx_recv(ctx, &chunk, &chunk_size, &recv_flags);
+ if (chunk_size > 0) {
+ fwrite(chunk, 1, chunk_size, stream);
+ }
+
+ if (flags & GRN_CTX_TAIL) {
+ grn_obj *command;
+
+ fflush(stream);
+
+ command = GRN_CTX_USER_DATA(ctx)->ptr;
+ GRN_BULK_REWIND(command);
+ }
+}
+
+static void
+s_output_typed(grn_ctx *ctx, int flags, FILE *stream)
{
if (ctx && ctx->impl && (flags & GRN_CTX_TAIL)) {
- grn_obj *buf = ctx->impl->outbuf;
+ char *chunk = NULL;
+ unsigned int chunk_size = 0;
+ int recv_flags;
+ grn_obj body;
grn_obj *command;
- if (GRN_TEXT_LEN(buf) || ctx->rc) {
- FILE * stream = (FILE *) arg;
+
+ GRN_TEXT_INIT(&body, 0);
+ grn_ctx_recv(ctx, &chunk, &chunk_size, &recv_flags);
+ GRN_TEXT_SET(ctx, &body, chunk, chunk_size);
+
+ if (GRN_TEXT_LEN(&body) || ctx->rc) {
grn_obj head, foot;
GRN_TEXT_INIT(&head, 0);
GRN_TEXT_INIT(&foot, 0);
- output_envelope(ctx, ctx->rc, &head, buf, &foot);
+ output_envelope(ctx, ctx->rc, &head, &body, &foot);
fwrite(GRN_TEXT_VALUE(&head), 1, GRN_TEXT_LEN(&head), stream);
- fwrite(GRN_TEXT_VALUE(buf), 1, GRN_TEXT_LEN(buf), stream);
+ fwrite(GRN_TEXT_VALUE(&body), 1, GRN_TEXT_LEN(&body), stream);
fwrite(GRN_TEXT_VALUE(&foot), 1, GRN_TEXT_LEN(&foot), stream);
fputc('\n', stream);
fflush(stream);
- GRN_BULK_REWIND(buf);
GRN_OBJ_FIN(ctx, &head);
GRN_OBJ_FIN(ctx, &foot);
}
+ GRN_OBJ_FIN(ctx, &body);
+
command = GRN_CTX_USER_DATA(ctx)->ptr;
GRN_BULK_REWIND(command);
}
}
+static void
+s_output(grn_ctx *ctx, int flags, void *arg)
+{
+ FILE *stream = (FILE *)arg;
+
+ switch (grn_ctx_get_output_type(ctx)) {
+ case GRN_CONTENT_GROONGA_COMMAND_LIST :
+ case GRN_CONTENT_NONE :
+ s_output_raw(ctx, flags, stream);
+ break;
+ default :
+ s_output_typed(ctx, flags, stream);
+ break;
+ }
+}
+
static int
do_alone(int argc, char **argv)
{
@@ -449,12 +506,39 @@ send_ready_notify(void)
close_ready_notify_pipe();
}
+static void
+create_pid_file(void)
+{
+#ifndef WIN32
+ FILE *pid_file = NULL;
+ pid_t pid;
+
+ if (!pid_file_path) {
+ return;
+ }
+
+ pid_file = fopen(pid_file_path, "w");
+ pid = getpid();
+ fprintf(pid_file, "%d\n", pid);
+ fclose(pid_file);
+#endif
+}
+
+static void
+clean_pid_file(void)
+{
+#ifndef WIN32
+ if (pid_file_path) {
+ unlink(pid_file_path);
+ }
+#endif
+}
+
static int
daemonize(void)
{
int exit_code = EXIT_SUCCESS;
#ifndef WIN32
- pid_t pid;
if (pipe(ready_notify_pipe) == -1) {
reset_ready_notify_pipe();
@@ -481,19 +565,12 @@ daemonize(void)
}
switch (fork()) {
case 0:
- {
- FILE *pid_file = NULL;
- if (pid_file_path) {
- pid_file = fopen(pid_file_path, "w");
- }
+ if (pid_file_path) {
+ create_pid_file();
+ } else {
+ pid_t pid;
pid = getpid();
- if (!pid_file) {
- fprintf(stderr, "%d\n", pid);
- } else {
- fprintf(pid_file, "%d\n", pid);
- fclose(pid_file);
- pid_file = NULL;
- }
+ fprintf(stderr, "%d\n", pid);
}
break;
case -1:
@@ -504,12 +581,13 @@ daemonize(void)
_exit(EXIT_SUCCESS);
}
{
- int null_fd = GRN_OPEN("/dev/null", O_RDWR, 0);
+ int null_fd;
+ grn_open(null_fd, "/dev/null", O_RDWR);
if (null_fd != -1) {
dup2(null_fd, STDIN_FILENO);
dup2(null_fd, STDOUT_FILENO);
dup2(null_fd, STDERR_FILENO);
- if (null_fd > STDERR_FILENO) { GRN_CLOSE(null_fd); }
+ if (null_fd > STDERR_FILENO) { grn_close(null_fd); }
}
}
#endif /* WIN32 */
@@ -517,16 +595,6 @@ daemonize(void)
}
static void
-clean_pid_file(void)
-{
-#ifndef WIN32
- if (pid_file_path) {
- unlink(pid_file_path);
- }
-#endif
-}
-
-static void
run_server_loop(grn_ctx *ctx, grn_com_event *ev)
{
while (!grn_com_event_poll(ctx, ev, 1000) && grn_gctx.stat != GRN_CTX_QUIT) {
@@ -584,7 +652,7 @@ run_server(grn_ctx *ctx, grn_obj *db, grn_com_event *ev,
struct hostent *he;
if (!(he = gethostbyname(hostname))) {
send_ready_notify();
- SERR("gethostbyname");
+ SOERR("gethostbyname");
} else {
ev->opaque = db;
grn_edges_init(ctx, dispatcher);
@@ -614,6 +682,8 @@ start_service(grn_ctx *ctx, const char *db_path,
if (exit_code != EXIT_SUCCESS) {
return exit_code;
}
+ } else {
+ create_pid_file();
}
if (!grn_com_event_init(ctx, &ev, MAX_CON, sizeof(grn_com))) {
@@ -634,103 +704,266 @@ start_service(grn_ctx *ctx, const char *db_path,
send_ready_notify();
}
- if (is_daemon_mode) {
- clean_pid_file();
- }
+ clean_pid_file();
return exit_code;
}
typedef struct {
grn_msg *msg;
+ grn_bool in_body;
+ grn_bool is_chunked;
} ht_context;
static void
-h_output(grn_ctx *ctx, int flags, void *arg)
+h_output_set_header(grn_ctx *ctx, grn_obj *header,
+ grn_rc rc, long long int content_length)
{
- grn_rc expr_rc = ctx->rc;
- ht_context *hc = (ht_context *)arg;
- grn_sock fd = hc->msg->u.fd;
- grn_obj header, head, foot, *outbuf = ctx->impl->outbuf;
- if (!(flags & GRN_CTX_TAIL)) { return; }
- GRN_TEXT_INIT(&header, 0);
- GRN_TEXT_INIT(&head, 0);
- GRN_TEXT_INIT(&foot, 0);
- output_envelope(ctx, expr_rc, &head, outbuf, &foot);
- switch (expr_rc) {
+ switch (rc) {
case GRN_SUCCESS :
- GRN_TEXT_SETS(ctx, &header, "HTTP/1.1 200 OK\r\n");
+ GRN_TEXT_SETS(ctx, header, "HTTP/1.1 200 OK\r\n");
break;
case GRN_INVALID_ARGUMENT :
case GRN_SYNTAX_ERROR :
- GRN_TEXT_SETS(ctx, &header, "HTTP/1.1 400 Bad Request\r\n");
+ GRN_TEXT_SETS(ctx, header, "HTTP/1.1 400 Bad Request\r\n");
break;
case GRN_NO_SUCH_FILE_OR_DIRECTORY :
- GRN_TEXT_SETS(ctx, &header, "HTTP/1.1 404 Not Found\r\n");
+ GRN_TEXT_SETS(ctx, header, "HTTP/1.1 404 Not Found\r\n");
break;
default :
- GRN_TEXT_SETS(ctx, &header, "HTTP/1.1 500 Internal Server Error\r\n");
+ GRN_TEXT_SETS(ctx, header, "HTTP/1.1 500 Internal Server Error\r\n");
break;
}
- GRN_TEXT_PUTS(ctx, &header, "Connection: close\r\n");
- GRN_TEXT_PUTS(ctx, &header, "Content-Type: ");
- GRN_TEXT_PUTS(ctx, &header, grn_ctx_get_mime_type(ctx));
- GRN_TEXT_PUTS(ctx, &header, "\r\nContent-Length: ");
- grn_text_lltoa(ctx, &header,
- GRN_TEXT_LEN(&head) + GRN_TEXT_LEN(outbuf) + GRN_TEXT_LEN(&foot));
- GRN_TEXT_PUTS(ctx, &header, "\r\n\r\n");
- {
- ssize_t ret, len;
+ GRN_TEXT_PUTS(ctx, header, "Content-Type: ");
+ GRN_TEXT_PUTS(ctx, header, grn_ctx_get_mime_type(ctx));
+ GRN_TEXT_PUTS(ctx, header, "\r\n");
+ if (content_length >= 0) {
+ GRN_TEXT_PUTS(ctx, header, "Connection: close\r\n");
+ GRN_TEXT_PUTS(ctx, header, "Content-Length: ");
+ grn_text_lltoa(ctx, header, content_length);
+ GRN_TEXT_PUTS(ctx, header, "\r\n");
+ } else {
+ GRN_TEXT_PUTS(ctx, header, "Transfer-Encoding: chunked\r\n");
+ }
+ GRN_TEXT_PUTS(ctx, header, "\r\n");
+}
+
+static void
+h_output_send(grn_ctx *ctx, grn_sock fd,
+ grn_obj *header, grn_obj *head, grn_obj *body, grn_obj *foot)
+{
+ ssize_t ret;
+ ssize_t len = 0;
#ifdef WIN32
- WSABUF wsabufs[4];
- wsabufs[0].buf = GRN_TEXT_VALUE(&header);
- wsabufs[0].len = GRN_TEXT_LEN(&header);
- wsabufs[1].buf = GRN_TEXT_VALUE(&head);
- wsabufs[1].len = GRN_TEXT_LEN(&head);
- wsabufs[2].buf = GRN_TEXT_VALUE(outbuf);
- wsabufs[2].len = GRN_TEXT_LEN(outbuf);
- wsabufs[3].buf = GRN_TEXT_VALUE(&foot);
- wsabufs[3].len = GRN_TEXT_LEN(&foot);
- if (WSASend(fd, wsabufs, 4, &ret, 0, NULL, NULL) == SOCKET_ERROR) {
- SERR("WSASend");
+ int n_buffers = 0;
+ WSABUF wsabufs[4];
+ if (header) {
+ wsabufs[n_buffers].buf = GRN_TEXT_VALUE(header);
+ wsabufs[n_buffers].len = GRN_TEXT_LEN(header);
+ len += GRN_TEXT_LEN(header);
+ n_buffers++;
+ }
+ if (head) {
+ wsabufs[n_buffers].buf = GRN_TEXT_VALUE(head);
+ wsabufs[n_buffers].len = GRN_TEXT_LEN(head);
+ len += GRN_TEXT_LEN(head);
+ n_buffers++;
+ }
+ if (body) {
+ wsabufs[n_buffers].buf = GRN_TEXT_VALUE(body);
+ wsabufs[n_buffers].len = GRN_TEXT_LEN(body);
+ len += GRN_TEXT_LEN(body);
+ n_buffers++;
+ }
+ if (foot) {
+ wsabufs[n_buffers].buf = GRN_TEXT_VALUE(foot);
+ wsabufs[n_buffers].len = GRN_TEXT_LEN(foot);
+ len += GRN_TEXT_LEN(foot);
+ n_buffers++;
+ }
+ {
+ DWORD sent;
+ if (WSASend(fd, wsabufs, n_buffers, &sent, 0, NULL, NULL) == SOCKET_ERROR) {
+ SOERR("WSASend");
}
+ ret = sent;
+ }
#else /* WIN32 */
- struct iovec msg_iov[4];
- struct msghdr msg;
- msg.msg_name = NULL;
- msg.msg_namelen = 0;
- msg.msg_iov = msg_iov;
- msg.msg_iovlen = 4;
- msg.msg_control = NULL;
- msg.msg_controllen = 0;
- msg.msg_flags = 0;
- msg_iov[0].iov_base = GRN_TEXT_VALUE(&header);
- msg_iov[0].iov_len = GRN_TEXT_LEN(&header);
- msg_iov[1].iov_base = GRN_TEXT_VALUE(&head);
- msg_iov[1].iov_len = GRN_TEXT_LEN(&head);
- msg_iov[2].iov_base = GRN_TEXT_VALUE(outbuf);
- msg_iov[2].iov_len = GRN_TEXT_LEN(outbuf);
- msg_iov[3].iov_base = GRN_TEXT_VALUE(&foot);
- msg_iov[3].iov_len = GRN_TEXT_LEN(&foot);
- if ((ret = sendmsg(fd, &msg, MSG_NOSIGNAL)) == -1) {
- SERR("sendmsg");
- }
+ struct iovec msg_iov[4];
+ struct msghdr msg;
+ msg.msg_name = NULL;
+ msg.msg_namelen = 0;
+ msg.msg_iov = msg_iov;
+ msg.msg_iovlen = 0;
+ msg.msg_control = NULL;
+ msg.msg_controllen = 0;
+ msg.msg_flags = 0;
+
+ if (header) {
+ msg_iov[msg.msg_iovlen].iov_base = GRN_TEXT_VALUE(header);
+ msg_iov[msg.msg_iovlen].iov_len = GRN_TEXT_LEN(header);
+ len += GRN_TEXT_LEN(header);
+ msg.msg_iovlen++;
+ }
+ if (head) {
+ msg_iov[msg.msg_iovlen].iov_base = GRN_TEXT_VALUE(head);
+ msg_iov[msg.msg_iovlen].iov_len = GRN_TEXT_LEN(head);
+ len += GRN_TEXT_LEN(head);
+ msg.msg_iovlen++;
+ }
+ if (body) {
+ msg_iov[msg.msg_iovlen].iov_base = GRN_TEXT_VALUE(body);
+ msg_iov[msg.msg_iovlen].iov_len = GRN_TEXT_LEN(body);
+ len += GRN_TEXT_LEN(body);
+ msg.msg_iovlen++;
+ }
+ if (foot) {
+ msg_iov[msg.msg_iovlen].iov_base = GRN_TEXT_VALUE(foot);
+ msg_iov[msg.msg_iovlen].iov_len = GRN_TEXT_LEN(foot);
+ len += GRN_TEXT_LEN(foot);
+ msg.msg_iovlen++;
+ }
+ if ((ret = sendmsg(fd, &msg, MSG_NOSIGNAL)) == -1) {
+ SOERR("sendmsg");
+ }
#endif /* WIN32 */
- len = GRN_TEXT_LEN(&header) + GRN_TEXT_LEN(&head) +
- GRN_TEXT_LEN(outbuf) + GRN_TEXT_LEN(&foot);
- if (ret != len) {
- GRN_LOG(&grn_gctx, GRN_LOG_NOTICE,
- "couldn't send all data (%" GRN_FMT_LLD "/%" GRN_FMT_LLD ")",
- (long long int)ret, (long long int)len);
+ if (ret != len) {
+ GRN_LOG(&grn_gctx, GRN_LOG_NOTICE,
+ "couldn't send all data (%" GRN_FMT_LLD "/%" GRN_FMT_LLD ")",
+ (long long int)ret, (long long int)len);
+ }
+}
+
+static void
+h_output_raw(grn_ctx *ctx, int flags, ht_context *hc)
+{
+ grn_rc expr_rc = ctx->rc;
+ grn_sock fd = hc->msg->u.fd;
+ grn_obj header_;
+ grn_obj head_;
+ grn_obj body_;
+ grn_obj foot_;
+ grn_obj *header = NULL;
+ grn_obj *head = NULL;
+ grn_obj *body = NULL;
+ grn_obj *foot = NULL;
+ char *chunk = NULL;
+ unsigned int chunk_size = 0;
+ int recv_flags;
+ grn_bool is_last_message = (flags & GRN_CTX_TAIL);
+
+ GRN_TEXT_INIT(&header_, 0);
+ GRN_TEXT_INIT(&head_, 0);
+ GRN_TEXT_INIT(&body_, GRN_OBJ_DO_SHALLOW_COPY);
+ GRN_TEXT_INIT(&foot_, 0);
+
+ grn_ctx_recv(ctx, &chunk, &chunk_size, &recv_flags);
+ GRN_TEXT_SET(ctx, &body_, chunk, chunk_size);
+
+ if (!hc->in_body) {
+ if (is_last_message) {
+ h_output_set_header(ctx, &header_, expr_rc, GRN_TEXT_LEN(&body_));
+ hc->is_chunked = GRN_FALSE;
+ } else {
+ h_output_set_header(ctx, &header_, expr_rc, -1);
+ hc->is_chunked = GRN_TRUE;
}
+ header = &header_;
+ hc->in_body = GRN_TRUE;
+ }
+
+ if (GRN_TEXT_LEN(&body_) > 0) {
+ if (hc->is_chunked) {
+ grn_text_printf(ctx, &head_,
+ "%x\r\n", (unsigned int)GRN_TEXT_LEN(&body_));
+ head = &head_;
+ GRN_TEXT_PUTS(ctx, &foot_, "\r\n");
+ foot = &foot_;
+ }
+ body = &body_;
+ }
+
+ if (is_last_message) {
+ if (hc->is_chunked) {
+ GRN_TEXT_PUTS(ctx, &foot_, "0\r\n");
+ GRN_TEXT_PUTS(ctx, &foot_, "Connection: close\r\n");
+ GRN_TEXT_PUTS(ctx, &foot_, "\r\n");
+ foot = &foot_;
+ }
+ }
+
+ h_output_send(ctx, fd, header, head, body, foot);
+
+ GRN_OBJ_FIN(ctx, &foot_);
+ GRN_OBJ_FIN(ctx, &body_);
+ GRN_OBJ_FIN(ctx, &head_);
+ GRN_OBJ_FIN(ctx, &header_);
+}
+
+static void
+h_output_typed(grn_ctx *ctx, int flags, ht_context *hc)
+{
+ grn_rc expr_rc = ctx->rc;
+ grn_sock fd = hc->msg->u.fd;
+ grn_obj header, head, body, foot;
+ char *chunk = NULL;
+ unsigned int chunk_size = 0;
+ int recv_flags;
+ grn_bool should_return_body;
+
+ if (!(flags & GRN_CTX_TAIL)) { return; }
+
+ switch (hc->msg->header.qtype) {
+ case 'G' :
+ case 'P' :
+ should_return_body = GRN_TRUE;
+ break;
+ default :
+ should_return_body = GRN_FALSE;
+ break;
+ }
+
+ GRN_TEXT_INIT(&header, 0);
+ GRN_TEXT_INIT(&head, 0);
+ GRN_TEXT_INIT(&body, 0);
+ GRN_TEXT_INIT(&foot, 0);
+
+ grn_ctx_recv(ctx, &chunk, &chunk_size, &recv_flags);
+ GRN_TEXT_SET(ctx, &body, chunk, chunk_size);
+
+ output_envelope(ctx, expr_rc, &head, &body, &foot);
+ h_output_set_header(ctx, &header, expr_rc,
+ GRN_TEXT_LEN(&head) +
+ GRN_TEXT_LEN(&body) +
+ GRN_TEXT_LEN(&foot));
+ if (should_return_body) {
+ h_output_send(ctx, fd, &header, &head, &body, &foot);
+ } else {
+ h_output_send(ctx, fd, &header, NULL, NULL, NULL);
}
- GRN_BULK_REWIND(outbuf);
GRN_OBJ_FIN(ctx, &foot);
+ GRN_OBJ_FIN(ctx, &body);
GRN_OBJ_FIN(ctx, &head);
GRN_OBJ_FIN(ctx, &header);
}
static void
+h_output(grn_ctx *ctx, int flags, void *arg)
+{
+ ht_context *hc = (ht_context *)arg;
+
+ switch (grn_ctx_get_output_type(ctx)) {
+ case GRN_CONTENT_GROONGA_COMMAND_LIST :
+ case GRN_CONTENT_NONE :
+ h_output_raw(ctx, flags, hc);
+ break;
+ default :
+ h_output_typed(ctx, flags, hc);
+ break;
+ }
+}
+
+static void
do_htreq_get(grn_ctx *ctx, grn_msg *msg)
{
char *path = NULL;
@@ -757,7 +990,7 @@ do_htreq_get(grn_ctx *ctx, grn_msg *msg)
typedef struct {
const char *path_start;
int path_length;
- int content_length;
+ long long int content_length;
grn_bool have_100_continue;
const char *body_start;
} h_post_header;
@@ -876,7 +1109,7 @@ do_htreq_post_parse_header_values(grn_ctx *ctx,
}
if (STRING_EQUAL_CI(name, name_length, "Content-Length")) {
const char *rest;
- header->content_length = grn_atoi(value, value + value_length, &rest);
+ header->content_length = grn_atoll(value, value + value_length, &rest);
if (rest != value + value_length) {
/* Invalid Content-Length value. TODO: report error. */
header->content_length = -1;
@@ -923,10 +1156,6 @@ do_htreq_post_parse_header(grn_ctx *ctx,
return GRN_FALSE;
}
- if (!header->have_100_continue && current == end) {
- return GRN_FALSE;
- }
-
if (current == end) {
header->body_start = NULL;
} else {
@@ -961,6 +1190,8 @@ do_htreq_post(grn_ctx *ctx, grn_msg *msg)
if (ctx->rc != GRN_SUCCESS) {
ht_context context;
context.msg = msg;
+ context.in_body = GRN_FALSE;
+ context.is_chunked = GRN_FALSE;
h_output(ctx, GRN_CTX_TAIL, &context);
return;
}
@@ -971,19 +1202,18 @@ do_htreq_post(grn_ctx *ctx, grn_msg *msg)
int send_flags = MSG_NOSIGNAL;
send_size = send(fd, continue_message, strlen(continue_message), send_flags);
if (send_size == -1) {
- SERR("send");
+ SOERR("send");
return;
}
}
{
- grn_obj line_buffer;
- int read_content_length = 0;
+ grn_obj chunk_buffer;
+ long long int read_content_length = 0;
- GRN_TEXT_INIT(&line_buffer, 0);
+ GRN_TEXT_INIT(&chunk_buffer, 0);
while (read_content_length < header.content_length) {
#define POST_BUFFER_SIZE 8192
- grn_rc rc;
char buffer[POST_BUFFER_SIZE];
const char *buffer_start, *buffer_current, *buffer_end;
@@ -999,7 +1229,7 @@ do_htreq_post(grn_ctx *ctx, grn_msg *msg)
break;
}
if (recv_length == -1) {
- SERR("recv");
+ SOERR("recv");
break;
}
buffer_start = buffer;
@@ -1007,42 +1237,56 @@ do_htreq_post(grn_ctx *ctx, grn_msg *msg)
}
read_content_length += buffer_end - buffer_start;
- rc = GRN_SUCCESS;
- buffer_current = buffer_start;
- for (; rc == GRN_SUCCESS && buffer_current < buffer_end; buffer_current++) {
- if (buffer_current[0] != '\n') {
+ buffer_current = buffer_end - 1;
+ for (; buffer_current > buffer_start; buffer_current--) {
+ grn_bool is_separator;
+ switch (buffer_current[0]) {
+ case '\n' :
+ case ',' :
+ is_separator = GRN_TRUE;
+ break;
+ default :
+ is_separator = GRN_FALSE;
+ break;
+ }
+ if (!is_separator) {
continue;
}
+
GRN_TEXT_PUT(ctx,
- &line_buffer,
+ &chunk_buffer,
buffer_start,
- buffer_current - buffer_start);
+ buffer_current + 1 - buffer_start);
{
int flags = 0;
if (!(read_content_length == header.content_length &&
buffer_current + 1 == buffer_end)) {
flags |= GRN_CTX_QUIET;
}
- rc = grn_ctx_send(ctx,
- GRN_TEXT_VALUE(&line_buffer),
- GRN_TEXT_LEN(&line_buffer),
- flags);
+ grn_ctx_send(ctx,
+ GRN_TEXT_VALUE(&chunk_buffer),
+ GRN_TEXT_LEN(&chunk_buffer),
+ flags);
}
buffer_start = buffer_current + 1;
- GRN_BULK_REWIND(&line_buffer);
+ GRN_BULK_REWIND(&chunk_buffer);
+ break;
+ }
+ if (buffer_end > buffer_start) {
+ GRN_TEXT_PUT(ctx, &chunk_buffer,
+ buffer_start, buffer_end - buffer_start);
}
- GRN_TEXT_PUT(ctx, &line_buffer, buffer_start, buffer_end - buffer_start);
#undef POST_BUFFER_SIZE
}
- if (GRN_TEXT_LEN(&line_buffer) > 0) {
+ if (GRN_TEXT_LEN(&chunk_buffer) > 0) {
grn_ctx_send(ctx,
- GRN_TEXT_VALUE(&line_buffer),
- GRN_TEXT_LEN(&line_buffer),
+ GRN_TEXT_VALUE(&chunk_buffer),
+ GRN_TEXT_LEN(&chunk_buffer),
0);
}
- GRN_OBJ_FIN(ctx, &line_buffer);
+ GRN_OBJ_FIN(ctx, &chunk_buffer);
}
}
@@ -1052,15 +1296,13 @@ do_htreq(grn_ctx *ctx, grn_msg *msg)
grn_com_header *header = &msg->header;
switch (header->qtype) {
case 'G' : /* GET */
+ case 'H' : /* HEAD */
do_htreq_get(ctx, msg);
break;
case 'P' : /* POST */
do_htreq_post(ctx, msg);
break;
}
- /* TODO: support "Connection: keep-alive" */
- ctx->stat = GRN_CTX_QUIT;
- /* TODO: support a command in multi requests. e.g.: load command */
grn_ctx_set_next_expr(ctx, NULL);
/* if (ctx->rc != GRN_OPERATION_WOULD_BLOCK) {...} */
grn_msg_close(ctx, (grn_obj *)msg);
@@ -1653,7 +1895,7 @@ check_rlimit_nofile(grn_ctx *ctx)
#endif /* WIN32 */
}
-static void * CALLBACK
+static grn_thread_func_result CALLBACK
h_worker(void *arg)
{
ht_context hc;
@@ -1676,6 +1918,8 @@ h_worker(void *arg)
nfthreads--;
MUTEX_UNLOCK(q_mutex);
hc.msg = (grn_msg *)msg;
+ hc.in_body = GRN_FALSE;
+ hc.is_chunked = GRN_FALSE;
do_htreq(ctx, (grn_msg *)msg);
MUTEX_LOCK(q_mutex);
} while (nfthreads < max_nfthreads && grn_gctx.stat != GRN_CTX_QUIT);
@@ -1684,7 +1928,7 @@ exit :
MUTEX_UNLOCK(q_mutex);
GRN_LOG(&grn_gctx, GRN_LOG_NOTICE, "thread end (%d/%d)", nfthreads, nthreads);
grn_ctx_fin(ctx);
- return NULL;
+ return GRN_THREAD_FUNC_RETURN_VALUE;
}
static void
@@ -1729,7 +1973,7 @@ h_server(char *path)
return exit_code;
}
-static void * CALLBACK
+static grn_thread_func_result CALLBACK
g_worker(void *arg)
{
GRN_LOG(&grn_gctx, GRN_LOG_NOTICE, "thread start (%d/%d)", nfthreads, nthreads + 1);
@@ -1790,7 +2034,7 @@ exit :
nthreads--;
MUTEX_UNLOCK(q_mutex);
GRN_LOG(&grn_gctx, GRN_LOG_NOTICE, "thread end (%d/%d)", nfthreads, nthreads);
- return NULL;
+ return GRN_THREAD_FUNC_RETURN_VALUE;
}
static void
@@ -1891,18 +2135,19 @@ g_server(char *path)
}
enum {
- mode_alone = 0,
- mode_client,
- mode_daemon,
- mode_server,
- mode_usage,
- mode_version,
- mode_config,
- mode_error
+ ACTION_USAGE = 1,
+ ACTION_VERSION,
+ ACTION_SHOW_CONFIG,
+ ACTION_ERROR
};
-#define MODE_MASK 0x007f
-#define MODE_NEW_DB 0x0100
+#define ACTION_MASK (0x0f)
+#define MODE_MASK (0xf0)
+#define FLAG_MODE_ALONE (1 << 4)
+#define FLAG_MODE_CLIENT (1 << 5)
+#define FLAG_MODE_DAEMON (1 << 6)
+#define FLAG_MODE_SERVER (1 << 7)
+#define FLAG_NEW_DB (1 << 8)
static uint32_t
get_core_number(void)
@@ -1984,7 +2229,7 @@ config_file_register(const char *path, const grn_str_getopt_opt *opts,
char *args[4];
name_buf[0] = name_buf[1] = '-';
- strcpy(name_buf + 2, name);
+ grn_strcpy(name_buf + 2, CONFIG_FILE_MAX_NAME_LENGTH + 1, name);
if (value) {
const size_t entry_size = sizeof(config_file_entry) + value_length + 1;
@@ -1994,7 +2239,7 @@ config_file_register(const char *path, const grn_str_getopt_opt *opts,
(unsigned int)entry_size);
return CONFIG_FILE_MALLOC_ERROR;
}
- strcpy((char *)(entry + 1), value);
+ grn_strcpy((char *)(entry + 1), value_length + 1, value);
entry->next = config_file_entry_head;
if (!config_file_entry_head) {
if (atexit(config_file_clear)) {
@@ -2123,7 +2368,6 @@ static const int default_http_port = DEFAULT_HTTP_PORT;
static const int default_gqtp_port = DEFAULT_GQTP_PORT;
static grn_encoding default_encoding = GRN_ENC_DEFAULT;
static uint32_t default_max_num_threads = DEFAULT_MAX_NFTHREADS;
-static const int default_mode = mode_alone;
static const int default_log_level = GRN_LOG_DEFAULT_LEVEL;
static const char * const default_protocol = "gqtp";
static const char *default_hostname = "localhost";
@@ -2195,9 +2439,10 @@ init_default_settings(void)
if (document_root_length >= PATH_MAX) {
fprintf(stderr, "can't use default root: too long path\n");
} else {
- strcpy(win32_default_document_root, grn_win32_base_dir());
- strcat(win32_default_document_root, "/");
- strcat(win32_default_document_root, GRN_DEFAULT_RELATIVE_DOCUMENT_ROOT);
+ grn_strcpy(win32_default_document_root, PATH_MAX, grn_win32_base_dir());
+ grn_strcat(win32_default_document_root, PATH_MAX, "/");
+ grn_strcat(win32_default_document_root, PATH_MAX,
+ GRN_DEFAULT_RELATIVE_DOCUMENT_ROOT);
default_document_root = win32_default_document_root;
}
}
@@ -2274,11 +2519,17 @@ show_version(void)
#ifdef GRN_WITH_MESSAGE_PACK
printf(",msgpack");
#endif
+#ifdef GRN_WITH_MRUBY
+ printf(",mruby");
+#endif
+#ifdef GRN_WITH_ONIGMO
+ printf(",onigmo");
+#endif
#ifdef GRN_WITH_ZLIB
printf(",zlib");
#endif
-#ifdef GRN_WITH_LZO
- printf(",lzo");
+#ifdef GRN_WITH_LZ4
+ printf(",lz4");
#endif
#ifdef USE_KQUEUE
printf(",kqueue");
@@ -2348,9 +2599,21 @@ show_usage(FILE *output)
" specify log level (default: %d)\n"
" --log-path <path>: specify log path\n"
" (default: %s)\n"
+ " --log-rotate-threshold-size <threshold>:\n"
+ " specify threshold for log rotate\n"
+ " Log file is rotated when\n"
+ " log file size is larger than or\n"
+ " equals to the threshold\n"
+ " (default: 0; disabled)\n"
" --query-log-path <path>:\n"
" specify query log path\n"
" (default: %s)\n"
+ " --query-log-rotate-threshold-size <threshold>:\n"
+ " specify threshold for query log rotate\n"
+ " Query log file is rotated when\n"
+ " query log file size is larger than or\n"
+ " equals to the threshold\n"
+ " (default: 0; disabled)\n"
"\n"
"Common options:\n"
" --working-directory <path>:\n"
@@ -2386,37 +2649,50 @@ show_usage(FILE *output)
int
main(int argc, char **argv)
{
- const char *port_arg = NULL, *encoding_arg = NULL,
- *max_num_threads_arg = NULL, *log_level_arg = NULL,
- *bind_address_arg = NULL, *hostname_arg = NULL, *protocol_arg = NULL,
- *log_path_arg = NULL, *query_log_path_arg = NULL,
- *cache_limit_arg = NULL, *document_root_arg = NULL,
- *default_command_version_arg = NULL,
- *default_match_escalation_threshold_arg = NULL,
- *input_fd_arg = NULL, *output_fd_arg = NULL,
- *working_directory_arg = NULL;
+ const char *port_arg = NULL;
+ const char *encoding_arg = NULL;
+ const char *max_num_threads_arg = NULL;
+ const char *log_level_arg = NULL;
+ const char *bind_address_arg = NULL;
+ const char *hostname_arg = NULL;
+ const char *protocol_arg = NULL;
+ const char *log_path_arg = NULL;
+ const char *log_rotate_threshold_size_arg = NULL;
+ const char *query_log_path_arg = NULL;
+ const char *query_log_rotate_threshold_size_arg = NULL;
+ const char *cache_limit_arg = NULL;
+ const char *document_root_arg = NULL;
+ const char *default_command_version_arg = NULL;
+ const char *default_match_escalation_threshold_arg = NULL;
+ const char *input_fd_arg = NULL;
+ const char *output_fd_arg = NULL;
+ const char *working_directory_arg = NULL;
const char *config_path = NULL;
int exit_code = EXIT_SUCCESS;
- int i, mode = mode_alone;
+ int i;
+ int flags = 0;
uint32_t cache_limit = 0;
+ grn_bool need_line_editor = GRN_FALSE;
static grn_str_getopt_opt opts[] = {
{'p', "port", NULL, 0, GETOPT_OP_NONE},
{'e', "encoding", NULL, 0, GETOPT_OP_NONE},
{'t', "max-threads", NULL, 0, GETOPT_OP_NONE},
- {'h', "help", NULL, mode_usage, GETOPT_OP_UPDATE},
- {'c', NULL, NULL, mode_client, GETOPT_OP_UPDATE},
- {'d', NULL, NULL, mode_daemon, GETOPT_OP_UPDATE},
- {'s', NULL, NULL, mode_server, GETOPT_OP_UPDATE},
+ {'h', "help", NULL, ACTION_USAGE, GETOPT_OP_UPDATE},
+ {'c', NULL, NULL, FLAG_MODE_CLIENT, GETOPT_OP_ON},
+ {'d', NULL, NULL, FLAG_MODE_DAEMON, GETOPT_OP_ON},
+ {'s', NULL, NULL, FLAG_MODE_SERVER, GETOPT_OP_ON},
{'l', "log-level", NULL, 0, GETOPT_OP_NONE},
{'i', "server-id", NULL, 0, GETOPT_OP_NONE},
- {'n', NULL, NULL, MODE_NEW_DB, GETOPT_OP_ON},
+ {'n', NULL, NULL, FLAG_NEW_DB, GETOPT_OP_ON},
{'\0', "protocol", NULL, 0, GETOPT_OP_NONE},
- {'\0', "version", NULL, mode_version, GETOPT_OP_UPDATE},
+ {'\0', "version", NULL, ACTION_VERSION, GETOPT_OP_UPDATE},
{'\0', "log-path", NULL, 0, GETOPT_OP_NONE},
+ {'\0', "log-rotate-threshold-size", NULL, 0, GETOPT_OP_NONE},
{'\0', "query-log-path", NULL, 0, GETOPT_OP_NONE},
+ {'\0', "query-log-rotate-threshold-size", NULL, 0, GETOPT_OP_NONE},
{'\0', "pid-path", NULL, 0, GETOPT_OP_NONE},
{'\0', "config-path", NULL, 0, GETOPT_OP_NONE},
- {'\0', "show-config", NULL, mode_config, GETOPT_OP_UPDATE},
+ {'\0', "show-config", NULL, ACTION_SHOW_CONFIG, GETOPT_OP_UPDATE},
{'\0', "cache-limit", NULL, 0, GETOPT_OP_NONE},
{'\0', "file", NULL, 0, GETOPT_OP_NONE},
{'\0', "document-root", NULL, 0, GETOPT_OP_NONE},
@@ -2435,32 +2711,34 @@ main(int argc, char **argv)
opts[8].arg = &hostname_arg;
opts[10].arg = &protocol_arg;
opts[12].arg = &log_path_arg;
- opts[13].arg = &query_log_path_arg;
- opts[14].arg = &pid_file_path;
- opts[15].arg = &config_path;
- opts[17].arg = &cache_limit_arg;
- opts[18].arg = &input_path;
- opts[19].arg = &document_root_arg;
- opts[20].arg = &default_command_version_arg;
- opts[21].arg = &default_match_escalation_threshold_arg;
- opts[22].arg = &bind_address_arg;
- opts[23].arg = &input_fd_arg;
- opts[24].arg = &output_fd_arg;
- opts[25].arg = &working_directory_arg;
+ opts[13].arg = &log_rotate_threshold_size_arg;
+ opts[14].arg = &query_log_path_arg;
+ opts[15].arg = &query_log_rotate_threshold_size_arg;
+ opts[16].arg = &pid_file_path;
+ opts[17].arg = &config_path;
+ opts[19].arg = &cache_limit_arg;
+ opts[20].arg = &input_path;
+ opts[21].arg = &document_root_arg;
+ opts[22].arg = &default_command_version_arg;
+ opts[23].arg = &default_match_escalation_threshold_arg;
+ opts[24].arg = &bind_address_arg;
+ opts[25].arg = &input_fd_arg;
+ opts[26].arg = &output_fd_arg;
+ opts[27].arg = &working_directory_arg;
reset_ready_notify_pipe();
init_default_settings();
/* only for parsing --config-path. */
- i = grn_str_getopt(argc, argv, opts, &mode);
+ i = grn_str_getopt(argc, argv, opts, &flags);
if (i < 0) {
show_usage(stderr);
return EXIT_FAILURE;
}
if (config_path) {
- const config_file_status status = config_file_load(config_path, opts, &mode);
+ const config_file_status status = config_file_load(config_path, opts, &flags);
if (status == CONFIG_FILE_FOPEN_ERROR) {
fprintf(stderr, "%s: can't open config file: %s (%s)\n",
argv[0], config_path, strerror(errno));
@@ -2473,7 +2751,7 @@ main(int argc, char **argv)
}
} else if (*default_config_path) {
const config_file_status status =
- config_file_load(default_config_path, opts, &mode);
+ config_file_load(default_config_path, opts, &flags);
if (status != CONFIG_FILE_SUCCESS && status != CONFIG_FILE_FOPEN_ERROR) {
fprintf(stderr, "%s: failed to parse config file: %s (%s)\n",
argv[0], default_config_path,
@@ -2491,26 +2769,29 @@ main(int argc, char **argv)
}
/* ignore mode option in config file */
- mode = (mode == mode_error) ? default_mode :
- ((mode & ~MODE_MASK) | default_mode);
+ flags = (flags == ACTION_ERROR) ? 0 : (flags & ~ACTION_MASK);
- i = grn_str_getopt(argc, argv, opts, &mode);
- if (i < 0) { mode = mode_error; }
- switch (mode & MODE_MASK) {
- case mode_version :
+ i = grn_str_getopt(argc, argv, opts, &flags);
+ if (i < 0) { flags = ACTION_ERROR; }
+ switch (flags & ACTION_MASK) {
+ case ACTION_VERSION :
show_version();
return EXIT_SUCCESS;
- case mode_usage :
+ case ACTION_USAGE :
show_usage(output);
return EXIT_SUCCESS;
- case mode_config :
- show_config(output, opts, mode & ~MODE_MASK);
+ case ACTION_SHOW_CONFIG :
+ show_config(output, opts, flags & ~ACTION_MASK);
return EXIT_SUCCESS;
- case mode_error :
+ case ACTION_ERROR :
show_usage(stderr);
return EXIT_FAILURE;
}
+ if ((flags & MODE_MASK) == 0) {
+ flags |= FLAG_MODE_ALONE;
+ }
+
if (port_arg) {
const char * const end = port_arg + strlen(port_arg);
const char *rest = NULL;
@@ -2597,10 +2878,39 @@ main(int argc, char **argv)
grn_default_logger_set_path(log_path_arg);
}
+ if (log_rotate_threshold_size_arg) {
+ const char * const end =
+ log_rotate_threshold_size_arg +
+ strlen(log_rotate_threshold_size_arg);
+ const char *rest = NULL;
+ const uint64_t value = grn_atoull(log_rotate_threshold_size_arg, end, &rest);
+ if (end != rest) {
+ fprintf(stderr, "invalid log rotate threshold size: <%s>\n",
+ log_rotate_threshold_size_arg);
+ return EXIT_FAILURE;
+ }
+ grn_default_logger_set_rotate_threshold_size(value);
+ }
+
if (query_log_path_arg) {
grn_default_query_logger_set_path(query_log_path_arg);
}
+ if (query_log_rotate_threshold_size_arg) {
+ const char * const end =
+ query_log_rotate_threshold_size_arg +
+ strlen(query_log_rotate_threshold_size_arg);
+ const char *rest = NULL;
+ const uint64_t value =
+ grn_atoull(query_log_rotate_threshold_size_arg, end, &rest);
+ if (end != rest) {
+ fprintf(stderr, "invalid query log rotate threshold size: <%s>\n",
+ query_log_rotate_threshold_size_arg);
+ return EXIT_FAILURE;
+ }
+ grn_default_query_logger_set_rotate_threshold_size(value);
+ }
+
if (log_level_arg) {
const char * const end = log_level_arg + strlen(log_level_arg);
const char *rest = NULL;
@@ -2660,6 +2970,11 @@ main(int argc, char **argv)
}
}
+ if ((flags & (FLAG_MODE_ALONE | FLAG_MODE_CLIENT)) &&
+ !batchmode) {
+ need_line_editor = GRN_TRUE;
+ }
+
if (output_fd_arg) {
const char * const end = output_fd_arg + strlen(output_fd_arg);
const char *rest = NULL;
@@ -2685,9 +3000,9 @@ main(int argc, char **argv)
bind_address_arg, (unsigned int)bind_address_length, HOST_NAME_MAX);
return EXIT_FAILURE;
}
- strcpy(bind_address, bind_address_arg);
+ grn_strcpy(bind_address, HOST_NAME_MAX + 1, bind_address_arg);
} else {
- strcpy(bind_address, default_bind_address);
+ grn_strcpy(bind_address, HOST_NAME_MAX + 1, default_bind_address);
}
if (hostname_arg) {
@@ -2698,9 +3013,9 @@ main(int argc, char **argv)
hostname_arg, (unsigned int)hostname_length, HOST_NAME_MAX);
return EXIT_FAILURE;
}
- strcpy(hostname, hostname_arg);
+ grn_strcpy(hostname, HOST_NAME_MAX + 1, hostname_arg);
} else {
- strcpy(hostname, default_hostname);
+ grn_strcpy(hostname, HOST_NAME_MAX + 1, default_hostname);
}
if (document_root_arg) {
@@ -2761,7 +3076,7 @@ main(int argc, char **argv)
}
#ifdef GRN_WITH_LIBEDIT
- if (!batchmode) {
+ if (need_line_editor) {
line_editor_init(argc, argv);
}
#endif
@@ -2787,27 +3102,18 @@ main(int argc, char **argv)
grn_cache_set_max_n_entries(&grn_gctx, cache, cache_limit);
}
- newdb = (mode & MODE_NEW_DB);
- switch (mode & MODE_MASK) {
- case mode_alone :
- exit_code = do_alone(argc - i, argv + i);
- break;
- case mode_client :
+ newdb = (flags & FLAG_NEW_DB);
+ is_daemon_mode = (flags & FLAG_MODE_DAEMON);
+ if (flags & FLAG_MODE_CLIENT) {
exit_code = do_client(argc - i, argv + i);
- break;
- case mode_daemon :
- is_daemon_mode = GRN_TRUE;
- /* fallthru */
- case mode_server :
+ } else if (is_daemon_mode || (flags & FLAG_MODE_SERVER)) {
exit_code = do_server(argc > i ? argv[i] : NULL);
- break;
- default:
- exit_code = EXIT_FAILURE;
- break;
+ } else {
+ exit_code = do_alone(argc - i, argv + i);
}
#ifdef GRN_WITH_LIBEDIT
- if (!batchmode) {
+ if (need_line_editor) {
line_editor_fin();
}
#endif
diff --git a/storage/mroonga/vendor/groonga/src/groonga_benchmark.c b/storage/mroonga/vendor/groonga/src/groonga_benchmark.c
index 61575174950..656984a7695 100644
--- a/storage/mroonga/vendor/groonga/src/groonga_benchmark.c
+++ b/storage/mroonga/vendor/groonga/src/groonga_benchmark.c
@@ -1,6 +1,6 @@
/* -*- c-basic-offset: 2 -*- */
/*
- Copyright(C) 2010-2012 Brazil
+ Copyright(C) 2010-2014 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -17,7 +17,7 @@
*/
#ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
#endif /* HAVE_CONFIG_H */
#include <stdio.h>
@@ -37,9 +37,9 @@
#include <netinet/in.h>
#endif /* HAVE_NETINET_IN_H */
-#include "lib/str.h"
-#include "lib/com.h"
-#include "lib/db.h"
+#include <grn_str.h>
+#include <grn_com.h>
+#include <grn_db.h>
#ifdef WIN32
#include <windows.h>
@@ -598,7 +598,7 @@ command_send_http(grn_ctx *ctx, const char *command, int type, int task_id)
fprintf(stderr, "failed to connect to groonga at %s:%d via HTTP: ",
grntest_serverhost, grntest_serverport);
#ifdef WIN32
- fprintf(stderr, "%d\n", GetLastError());
+ fprintf(stderr, "%lu\n", GetLastError());
#else
fprintf(stderr, "%s\n", strerror(errno));
#endif
@@ -1115,7 +1115,7 @@ exit:
job->max,
job->qnum);
if (grntest_jobdone < grntest_jobnum) {
- strcat(tmpbuf, ",");
+ grn_strcat(tmpbuf, BUF_LEN, ",");
}
}
GRN_TEXT_PUTS(ctx, log, tmpbuf);
@@ -1149,7 +1149,7 @@ typedef struct _grntest_worker {
} grntest_worker;
#ifdef WIN32
-static int
+static unsigned int
__stdcall
worker(void *val)
{
@@ -1252,7 +1252,6 @@ get_sysinfo(const char *path, char *result, int olen)
char tmpbuf[256];
#ifdef WIN32
- int cinfo[4];
ULARGE_INTEGER dinfo;
char cpustring[64];
SYSTEM_INFO sinfo;
@@ -1262,29 +1261,32 @@ get_sysinfo(const char *path, char *result, int olen)
if (grntest_outtype == OUT_TSV) {
result[0] = '\0';
sprintf(tmpbuf, "script\t%s\n", grntest_scriptname);
- strcat(result, tmpbuf);
+ grn_strcat(result, olen, tmpbuf);
sprintf(tmpbuf, "user\t%s\n", grntest_username);
- strcat(result, tmpbuf);
+ grn_strcat(result, olen, tmpbuf);
sprintf(tmpbuf, "date\t%s\n", grntest_date);
- strcat(result, tmpbuf);
+ grn_strcat(result, olen, tmpbuf);
} else {
- strcpy(result, "{");
+ grn_strcpy(result, olen, "{");
sprintf(tmpbuf, "\"script\": \"%s.scr\",\n", grntest_scriptname);
- strcat(result, tmpbuf);
+ grn_strcat(result, olen, tmpbuf);
sprintf(tmpbuf, " \"user\": \"%s\",\n", grntest_username);
- strcat(result, tmpbuf);
+ grn_strcat(result, olen, tmpbuf);
sprintf(tmpbuf, " \"date\": \"%s\",\n", grntest_date);
- strcat(result, tmpbuf);
+ grn_strcat(result, olen, tmpbuf);
}
memset(cpustring, 0, 64);
#ifndef __GNUC__
- __cpuid(cinfo, 0x80000002);
- memcpy(cpustring, cinfo, 16);
- __cpuid(cinfo, 0x80000003);
- memcpy(cpustring+16, cinfo, 16);
- __cpuid(cinfo, 0x80000004);
- memcpy(cpustring+32, cinfo, 16);
+ {
+ int cinfo[4];
+ __cpuid(cinfo, 0x80000002);
+ memcpy(cpustring, cinfo, 16);
+ __cpuid(cinfo, 0x80000003);
+ memcpy(cpustring+16, cinfo, 16);
+ __cpuid(cinfo, 0x80000004);
+ memcpy(cpustring+32, cinfo, 16);
+ }
#endif
if (grntest_outtype == OUT_TSV) {
@@ -1292,7 +1294,7 @@ get_sysinfo(const char *path, char *result, int olen)
} else {
sprintf(tmpbuf, " \"CPU\": \"%s\",\n", cpustring);
}
- strcat(result, tmpbuf);
+ grn_strcat(result, olen, tmpbuf);
if (sizeof(int *) == 8) {
grntest_osinfo = OS_WINDOWS64;
@@ -1309,15 +1311,15 @@ get_sysinfo(const char *path, char *result, int olen)
sprintf(tmpbuf, " \"BIT\": 32,\n");
}
}
- strcat(result, tmpbuf);
+ grn_strcat(result, olen, tmpbuf);
GetSystemInfo(&sinfo);
if (grntest_outtype == OUT_TSV) {
- sprintf(tmpbuf, "CORE\t%d\n", sinfo.dwNumberOfProcessors);
+ sprintf(tmpbuf, "CORE\t%lu\n", sinfo.dwNumberOfProcessors);
} else {
- sprintf(tmpbuf, " \"CORE\": %d,\n", sinfo.dwNumberOfProcessors);
+ sprintf(tmpbuf, " \"CORE\": %lu,\n", sinfo.dwNumberOfProcessors);
}
- strcat(result, tmpbuf);
+ grn_strcat(result, olen, tmpbuf);
minfo.dwLength = sizeof(MEMORYSTATUSEX);
GlobalMemoryStatusEx(&minfo);
@@ -1326,7 +1328,7 @@ get_sysinfo(const char *path, char *result, int olen)
} else {
sprintf(tmpbuf, " \"RAM\": \"%I64dMByte\",\n", minfo.ullTotalPhys/(1024*1024));
}
- strcat(result, tmpbuf);
+ grn_strcat(result, olen, tmpbuf);
GetDiskFreeSpaceEx(NULL, NULL, &dinfo, NULL);
if (grntest_outtype == OUT_TSV) {
@@ -1334,30 +1336,31 @@ get_sysinfo(const char *path, char *result, int olen)
} else {
sprintf(tmpbuf, " \"HDD\": \"%I64dKBytes\",\n", dinfo.QuadPart/1024 );
}
- strcat(result, tmpbuf);
+ grn_strcat(result, olen, tmpbuf);
osinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&osinfo);
if (grntest_outtype == OUT_TSV) {
- sprintf(tmpbuf, "Windows %d.%d\n", osinfo.dwMajorVersion, osinfo.dwMinorVersion);
+ sprintf(tmpbuf, "Windows %ld.%ld\n",
+ osinfo.dwMajorVersion, osinfo.dwMinorVersion);
} else {
- sprintf(tmpbuf, " \"OS\": \"Windows %d.%d\",\n", osinfo.dwMajorVersion,
+ sprintf(tmpbuf, " \"OS\": \"Windows %lu.%lu\",\n", osinfo.dwMajorVersion,
osinfo.dwMinorVersion);
}
- strcat(result, tmpbuf);
+ grn_strcat(result, olen, tmpbuf);
if (grntest_outtype == OUT_TSV) {
sprintf(tmpbuf, "%s\n", grntest_serverhost);
} else {
sprintf(tmpbuf, " \"HOST\": \"%s\",\n", grntest_serverhost);
}
- strcat(result, tmpbuf);
+ grn_strcat(result, olen, tmpbuf);
if (grntest_outtype == OUT_TSV) {
sprintf(tmpbuf, "%d\n", grntest_serverport);
} else {
sprintf(tmpbuf, " \"PORT\": \"%d\",\n", grntest_serverport);
}
- strcat(result, tmpbuf);
+ grn_strcat(result, olen, tmpbuf);
if (grntest_outtype == OUT_TSV) {
sprintf(tmpbuf, "%s\"\n", grn_get_version());
@@ -1365,9 +1368,9 @@ get_sysinfo(const char *path, char *result, int olen)
sprintf(tmpbuf, " \"VERSION\": \"%s\"\n", grn_get_version());
}
- strcat(result, tmpbuf);
+ grn_strcat(result, olen, tmpbuf);
if (grntest_outtype != OUT_TSV) {
- strcat(result, "}");
+ grn_strcat(result, olen, "}");
}
#else /* linux only */
@@ -1377,26 +1380,27 @@ get_sysinfo(const char *path, char *result, int olen)
int minfo = 0;
int unevictable = 0;
int mlocked = 0;
- char cpustring[256];
+#define CPU_STRING_SIZE 256
+ char cpu_string[CPU_STRING_SIZE];
struct utsname ubuf;
struct statvfs vfsbuf;
if (grntest_outtype == OUT_TSV) {
result[0] = '\0';
sprintf(tmpbuf, "sctipt\t%s\n", grntest_scriptname);
- strcat(result, tmpbuf);
+ grn_strcat(result, olen, tmpbuf);
sprintf(tmpbuf, "user\t%s\n", grntest_username);
- strcat(result, tmpbuf);
+ grn_strcat(result, olen, tmpbuf);
sprintf(tmpbuf, "date\t%s\n", grntest_date);
- strcat(result, tmpbuf);
+ grn_strcat(result, olen, tmpbuf);
} else {
- strcpy(result, "{");
+ grn_strcpy(result, olen, "{");
sprintf(tmpbuf, "\"script\": \"%s.scr\",\n", grntest_scriptname);
- strcat(result, tmpbuf);
+ grn_strcat(result, olen, tmpbuf);
sprintf(tmpbuf, " \"user\": \"%s\",\n", grntest_username);
- strcat(result, tmpbuf);
+ grn_strcat(result, olen, tmpbuf);
sprintf(tmpbuf, " \"date\": \"%s\",\n", grntest_date);
- strcat(result, tmpbuf);
+ grn_strcat(result, olen, tmpbuf);
}
fp = fopen("/proc/cpuinfo", "r");
@@ -1407,18 +1411,20 @@ get_sysinfo(const char *path, char *result, int olen)
while (fgets(tmpbuf, 256, fp) != NULL) {
tmpbuf[strlen(tmpbuf)-1] = '\0';
if (!strncmp(tmpbuf, "model name\t: ", 13)) {
- strcpy(cpustring, &tmpbuf[13]);
+ grn_strcpy(cpu_string, CPU_STRING_SIZE, &tmpbuf[13]);
}
}
fclose(fp);
+#undef CPU_STRING_SIZE
+
cpunum = sysconf(_SC_NPROCESSORS_CONF);
if (grntest_outtype == OUT_TSV) {
- sprintf(tmpbuf, "%s\n", cpustring);
+ sprintf(tmpbuf, "%s\n", cpu_string);
} else {
- sprintf(tmpbuf, " \"CPU\": \"%s\",\n", cpustring);
+ sprintf(tmpbuf, " \"CPU\": \"%s\",\n", cpu_string);
}
- strcat(result, tmpbuf);
+ grn_strcat(result, olen, tmpbuf);
if (sizeof(int *) == 8) {
grntest_osinfo = OS_LINUX64;
@@ -1435,14 +1441,14 @@ get_sysinfo(const char *path, char *result, int olen)
sprintf(tmpbuf, " \"BIT\": 32,\n");
}
}
- strcat(result, tmpbuf);
+ grn_strcat(result, olen, tmpbuf);
if (grntest_outtype == OUT_TSV) {
sprintf(tmpbuf, "CORE\t%d\n", cpunum);
} else {
sprintf(tmpbuf, " \"CORE\": %d,\n", cpunum);
}
- strcat(result, tmpbuf);
+ grn_strcat(result, olen, tmpbuf);
fp = fopen("/proc/meminfo", "r");
if (!fp) {
@@ -1464,18 +1470,18 @@ get_sysinfo(const char *path, char *result, int olen)
fclose(fp);
if (grntest_outtype == OUT_TSV) {
sprintf(tmpbuf, "%dMBytes\n", minfo/1024);
- strcat(result, tmpbuf);
+ grn_strcat(result, olen, tmpbuf);
sprintf(tmpbuf, "%dMBytes_Unevictable\n", unevictable/1024);
- strcat(result, tmpbuf);
+ grn_strcat(result, olen, tmpbuf);
sprintf(tmpbuf, "%dMBytes_Mlocked\n", mlocked/1024);
- strcat(result, tmpbuf);
+ grn_strcat(result, olen, tmpbuf);
} else {
sprintf(tmpbuf, " \"RAM\": \"%dMBytes\",\n", minfo/1024);
- strcat(result, tmpbuf);
+ grn_strcat(result, olen, tmpbuf);
sprintf(tmpbuf, " \"Unevictable\": \"%dMBytes\",\n", unevictable/1024);
- strcat(result, tmpbuf);
+ grn_strcat(result, olen, tmpbuf);
sprintf(tmpbuf, " \"Mlocked\": \"%dMBytes\",\n", mlocked/1024);
- strcat(result, tmpbuf);
+ grn_strcat(result, olen, tmpbuf);
}
ret = statvfs(path, &vfsbuf);
@@ -1491,7 +1497,7 @@ get_sysinfo(const char *path, char *result, int olen)
" \"HDD\": \"%" GRN_FMT_INT64U "KBytes\",\n",
vfsbuf.f_blocks * 4);
}
- strcat(result, tmpbuf);
+ grn_strcat(result, olen, tmpbuf);
uname(&ubuf);
if (grntest_outtype == OUT_TSV) {
@@ -1499,31 +1505,31 @@ get_sysinfo(const char *path, char *result, int olen)
} else {
sprintf(tmpbuf, " \"OS\": \"%s %s\",\n", ubuf.sysname, ubuf.release);
}
- strcat(result, tmpbuf);
+ grn_strcat(result, olen, tmpbuf);
if (grntest_outtype == OUT_TSV) {
sprintf(tmpbuf, "%s\n", grntest_serverhost);
} else {
sprintf(tmpbuf, " \"HOST\": \"%s\",\n", grntest_serverhost);
}
- strcat(result, tmpbuf);
+ grn_strcat(result, olen, tmpbuf);
if (grntest_outtype == OUT_TSV) {
sprintf(tmpbuf, "%d\n", grntest_serverport);
} else {
sprintf(tmpbuf, " \"PORT\": \"%d\",\n", grntest_serverport);
}
- strcat(result, tmpbuf);
+ grn_strcat(result, olen, tmpbuf);
if (grntest_outtype == OUT_TSV) {
sprintf(tmpbuf, "%s\n", grn_get_version());
} else {
sprintf(tmpbuf, " \"VERSION\": \"%s\"\n", grn_get_version());
}
- strcat(result, tmpbuf);
+ grn_strcat(result, olen, tmpbuf);
if (grntest_outtype != OUT_TSV) {
- strcat(result, "},");
+ grn_strcat(result, olen, "},");
}
#endif /* WIN32 */
if (strlen(result) >= olen) {
@@ -1548,20 +1554,20 @@ start_server(const char *dbpath, int r)
exit(1);
}
- strcpy(tmpbuf, groonga_path);
- strcat(tmpbuf, " -s --protocol ");
- strcat(tmpbuf, groonga_protocol);
- strcat(tmpbuf, " -p ");
+ grn_strcpy(tmpbuf, BUF_LEN, groonga_path);
+ grn_strcat(tmpbuf, BUF_LEN, " -s --protocol ");
+ grn_strcat(tmpbuf, BUF_LEN, groonga_protocol);
+ grn_strcat(tmpbuf, BUF_LEN, " -p ");
sprintf(optbuf, "%d ", grntest_serverport);
- strcat(tmpbuf, optbuf);
- strcat(tmpbuf, dbpath);
+ grn_strcat(tmpbuf, BUF_LEN, optbuf);
+ grn_strcat(tmpbuf, BUF_LEN, dbpath);
memset(&si, 0, sizeof(STARTUPINFO));
si.cb=sizeof(STARTUPINFO);
ret = CreateProcess(NULL, tmpbuf, NULL, NULL, FALSE,
0, NULL, NULL, &si, &grntest_pi);
if (ret == 0) {
- fprintf(stderr, "Cannot start groonga server: <%s>: error=%d\n",
+ fprintf(stderr, "Cannot start groonga server: <%s>: error=%lu\n",
groonga_path, GetLastError());
exit(1);
}
@@ -1764,7 +1770,7 @@ parse_line(char *buf, int start, int end, int num)
return 15;
}
}
- strcpy(grntest_job[num].logfile, tmpbuf);
+ grn_strcpy(grntest_job[num].logfile, BUF_LEN, tmpbuf);
return 0;
} else {
grntest_job[num].concurrency = grntest_atoi(tmpbuf, tmpbuf + j, NULL);
@@ -2424,10 +2430,10 @@ ftp_sub(const char *user, const char *passwd, const char *host,
#ifdef WIN32
_splitpath(filename, NULL, NULL, fname, ext);
- strcpy(base, fname);
+ grn_strcpy(base, BUF_LEN, fname);
strcat(base, ext);
#else
- strcpy(buf, filename);
+ grn_strcpy(buf, BUF_LEN, filename);
base = basename(buf);
#endif /* WIN32 */
@@ -2468,7 +2474,7 @@ ftp_sub(const char *user, const char *passwd, const char *host,
}
if (!strncmp(buf, "213", 3)) {
retval[BUF_LEN-2] = '\0';
- strcpy(retval, get_ftp_date(buf));
+ grn_strcpy(retval, BUF_LEN - 2, get_ftp_date(buf));
if (retval[BUF_LEN-2] != '\0' ) {
fprintf(stderr, "buffer over run in ftp\n");
exit(1);
@@ -2531,7 +2537,7 @@ static int
get_username(char *name, int maxlen)
{
char *env=NULL;
- strcpy(name, "nobody");
+ grn_strcpy(name, maxlen, "nobody");
#ifdef WIN32
env = getenv("USERNAME");
#else
@@ -2542,7 +2548,7 @@ get_username(char *name, int maxlen)
exit(1);
}
if (env) {
- strcpy(name, env);
+ grn_strcpy(name, maxlen, env);
}
return 0;
}
@@ -2574,7 +2580,7 @@ get_date(char *date, time_t *sec)
}
static int
-get_scriptname(const char *path, char *name, const char *suffix)
+get_scriptname(const char *path, char *name, size_t name_len, const char *suffix)
{
int slen = strlen(suffix);
int len = strlen(path);
@@ -2588,7 +2594,7 @@ get_scriptname(const char *path, char *name, const char *suffix)
exit(1);
}
- strcpy(name, path);
+ grn_strcpy(name, name_len, path);
if (strncmp(&name[len-slen], suffix, slen)) {
name[0] = '\0';
return 0;
@@ -2871,7 +2877,7 @@ check_script(grn_ctx *ctx, const char *script_file_path)
while (grn_text_fgets(ctx, &line, script_file) == GRN_SUCCESS) {
GRN_TEXT_VALUE(&line)[GRN_TEXT_LEN(&line) - 1] = '\0';
get_token(GRN_TEXT_VALUE(&line), token, BUF_LEN, &next);
- strcpy(prev, token);
+ grn_strcpy(prev, BUF_LEN, token);
while (next) {
get_token(next, token, BUF_LEN, &next);
@@ -2879,10 +2885,10 @@ check_script(grn_ctx *ctx, const char *script_file_path)
grntest_serverport = grn_atoi(token, token + strlen(token), NULL);
}
if (!strncmp(prev, "SET_HOST", 8)) {
- strcpy(grntest_serverhost, token);
+ grn_strcpy(grntest_serverhost, BUF_LEN, token);
grntest_remote_mode = 1;
}
- strcpy(prev, token);
+ grn_strcpy(prev, BUF_LEN, token);
}
}
grn_obj_unlink(ctx, &line);
@@ -3042,10 +3048,10 @@ main(int argc, char **argv)
usage();
}
- strcpy(grntest_serverhost, DEFAULT_DEST);
+ grn_strcpy(grntest_serverhost, BUF_LEN, DEFAULT_DEST);
if (hoststr) {
grntest_remote_mode = 1;
- strcpy(grntest_serverhost, hoststr);
+ grn_strcpy(grntest_serverhost, BUF_LEN, hoststr);
}
grntest_serverport = DEFAULT_PORT;
if (portstr) {
@@ -3083,7 +3089,7 @@ main(int argc, char **argv)
}
}
- get_scriptname(scrname, grntest_scriptname, ".scr");
+ get_scriptname(scrname, grntest_scriptname, BUF_LEN, ".scr");
get_username(grntest_username, 256);
GRN_TIME_INIT(&grntest_starttime, 0);
diff --git a/storage/mroonga/vendor/groonga/src/groonga_mruby.c b/storage/mroonga/vendor/groonga/src/groonga_mruby.c
new file mode 100644
index 00000000000..9978a002f18
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/src/groonga_mruby.c
@@ -0,0 +1,84 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2014 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
+*/
+
+#include <grn_mrb.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+
+static int
+run(grn_ctx *ctx, const char *db_path, const char *ruby_script_path)
+{
+ grn_obj *db;
+
+ db = grn_db_open(ctx, db_path);
+ if (!db) {
+ if (ctx->rc == GRN_NO_SUCH_FILE_OR_DIRECTORY) {
+ db = grn_db_create(ctx, db_path, NULL);
+ if (!db) {
+ fprintf(stderr, "Failed to create database: <%s>: %s",
+ db_path, ctx->errbuf);
+ return EXIT_FAILURE;
+ }
+ } else {
+ fprintf(stderr, "Failed to open database: <%s>: %s",
+ db_path, ctx->errbuf);
+ return EXIT_FAILURE;
+ }
+ }
+
+ grn_mrb_load(ctx, ruby_script_path);
+ if (ctx->rc != GRN_SUCCESS) {
+ fprintf(stderr, "Failed to load Ruby script: <%s>: %s",
+ ruby_script_path, ctx->errbuf);
+ }
+
+ grn_obj_close(ctx, db);
+
+ if (ctx->rc == GRN_SUCCESS) {
+ return EXIT_SUCCESS;
+ } else {
+ return EXIT_FAILURE;
+ }
+}
+
+int
+main(int argc, char **argv)
+{
+ int exit_code = EXIT_SUCCESS;
+
+ if (argc != 3) {
+ fprintf(stderr, "Usage: %s DB_PATH RUBY_SCRIPT_PATH\n", argv[0]);
+ return EXIT_FAILURE;
+ }
+
+ if (grn_init() != GRN_SUCCESS) {
+ return EXIT_FAILURE;
+ }
+
+ {
+ grn_ctx ctx;
+ grn_ctx_init(&ctx, 0);
+ exit_code = run(&ctx, argv[1], argv[2]);
+ grn_ctx_fin(&ctx);
+ }
+
+ grn_fin();
+
+ return exit_code;
+}
diff --git a/storage/mroonga/vendor/groonga/src/groonga_mruby_sources.am b/storage/mroonga/vendor/groonga/src/groonga_mruby_sources.am
new file mode 100644
index 00000000000..c9006755c97
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/src/groonga_mruby_sources.am
@@ -0,0 +1,2 @@
+groonga_mruby_SOURCES = \
+ groonga_mruby.c
diff --git a/storage/mroonga/vendor/groonga/src/httpd/nginx-module/ngx_http_groonga_module.c b/storage/mroonga/vendor/groonga/src/httpd/nginx-module/ngx_http_groonga_module.c
index 26be6be7d0a..6ba1df4a9e8 100644
--- a/storage/mroonga/vendor/groonga/src/httpd/nginx-module/ngx_http_groonga_module.c
+++ b/storage/mroonga/vendor/groonga/src/httpd/nginx-module/ngx_http_groonga_module.c
@@ -1,6 +1,6 @@
/* -*- c-basic-offset: 2 -*- */
/*
- Copyright(C) 2012-2014 Brazil
+ Copyright(C) 2012-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,9 +16,9 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
+#ifndef WIN32
+# define NGX_GRN_SUPPORT_STOP_BY_COMMAND
+#endif
#include <ngx_config.h>
#include <ngx_core.h>
@@ -26,6 +26,13 @@
#include <groonga.h>
+#include <sys/stat.h>
+
+#ifdef NGX_GRN_SUPPORT_STOP_BY_COMMAND
+# include <sys/types.h>
+# include <unistd.h>
+#endif
+
#define GRN_NO_FLAGS 0
typedef struct {
@@ -56,9 +63,19 @@ typedef struct {
typedef struct {
grn_bool initialized;
grn_ctx context;
- grn_obj head;
- grn_obj body;
- grn_obj foot;
+ struct {
+ grn_bool processed;
+ grn_bool header_sent;
+ ngx_http_request_t *r;
+ ngx_int_t rc;
+ ngx_chain_t *free_chain;
+ ngx_chain_t *busy_chain;
+ } raw;
+ struct {
+ grn_obj head;
+ grn_obj body;
+ grn_obj foot;
+ } typed;
} ngx_http_groonga_handler_data_t;
typedef struct {
@@ -126,18 +143,54 @@ ngx_http_groonga_logger_log(grn_ctx *ctx, grn_log_level level,
const char level_marks[] = " EACewnid-";
u_char buffer[NGX_MAX_ERROR_STR];
u_char *last;
-
+ size_t prefix_size;
+ size_t message_size;
+ size_t location_size;
+ size_t postfix_size;
+ size_t log_message_size;
+
+#define LOG_PREFIX_FORMAT "%s|%c|%s "
+ prefix_size =
+ strlen(timestamp) +
+ 1 /* | */ +
+ 1 /* %c */ +
+ 1 /* | */ +
+ strlen(title) +
+ 1 /* a space */;
+ message_size = strlen(message);
if (location && *location) {
- last = ngx_slprintf(buffer, buffer + NGX_MAX_ERROR_STR,
- "%s|%c|%s %s %s\n",
- timestamp, *(level_marks + level), title, message,
- location);
+ location_size = 1 /* a space */ + strlen(location);
} else {
+ location_size = 0;
+ }
+ postfix_size = 1 /* \n */;
+ log_message_size = prefix_size + message_size + location_size + postfix_size;
+
+ if (log_message_size > NGX_MAX_ERROR_STR) {
last = ngx_slprintf(buffer, buffer + NGX_MAX_ERROR_STR,
- "%s|%c|%s %s\n",
- timestamp, *(level_marks + level), title, message);
+ LOG_PREFIX_FORMAT,
+ timestamp, *(level_marks + level), title);
+ ngx_write_fd(logger_data->file->fd, buffer, last - buffer);
+ ngx_write_fd(logger_data->file->fd, (void *)message, message_size);
+ if (location_size > 0) {
+ ngx_write_fd(logger_data->file->fd, " ", 1);
+ ngx_write_fd(logger_data->file->fd, (void *)location, location_size);
+ }
+ ngx_write_fd(logger_data->file->fd, "\n", 1);
+ } else {
+ if (location && *location) {
+ last = ngx_slprintf(buffer, buffer + NGX_MAX_ERROR_STR,
+ LOG_PREFIX_FORMAT " %s %s\n",
+ timestamp, *(level_marks + level), title, message,
+ location);
+ } else {
+ last = ngx_slprintf(buffer, buffer + NGX_MAX_ERROR_STR,
+ LOG_PREFIX_FORMAT " %s\n",
+ timestamp, *(level_marks + level), title, message);
+ }
+ ngx_write_fd(logger_data->file->fd, buffer, last - buffer);
}
- ngx_write_fd(logger_data->file->fd, buffer, last - buffer);
+#undef LOG_PREFIX_FORMAT
}
static void
@@ -336,6 +389,7 @@ ngx_http_groonga_grn_obj_to_ngx_buf(ngx_pool_t *pool, grn_obj *object)
buffer->pos = (u_char *)GRN_TEXT_VALUE(object);
buffer->last = (u_char *)GRN_TEXT_VALUE(object) + GRN_TEXT_LEN(object);
buffer->memory = 1; /* this buffer is in memory */
+ buffer->in_file = 0;
return buffer;
}
@@ -351,20 +405,109 @@ ngx_http_groonga_handler_cleanup(void *user_data)
}
context = &(data->context);
- GRN_OBJ_FIN(context, &(data->head));
- GRN_OBJ_FIN(context, &(data->body));
- GRN_OBJ_FIN(context, &(data->foot));
+ GRN_OBJ_FIN(context, &(data->typed.head));
+ GRN_OBJ_FIN(context, &(data->typed.body));
+ GRN_OBJ_FIN(context, &(data->typed.foot));
grn_logger_set(context, NULL);
grn_query_logger_set(context, NULL);
grn_ctx_fin(context);
}
static void
-ngx_http_groonga_context_receive_handler(grn_ctx *context,
- int flags,
- void *callback_data)
+ngx_http_groonga_handler_set_content_type(ngx_http_request_t *r,
+ const char *content_type)
+{
+ r->headers_out.content_type.len = strlen(content_type);
+ r->headers_out.content_type.data = (u_char *)content_type;
+ r->headers_out.content_type_len = r->headers_out.content_type.len;
+}
+
+static void
+ngx_http_groonga_context_receive_handler_raw(grn_ctx *context,
+ int flags,
+ ngx_http_groonga_handler_data_t *data)
+{
+ char *chunk = NULL;
+ unsigned int chunk_size = 0;
+ int recv_flags;
+ ngx_http_request_t *r;
+ ngx_log_t *log;
+ grn_bool is_last_chunk;
+
+ grn_ctx_recv(context, &chunk, &chunk_size, &recv_flags);
+ data->raw.processed = GRN_TRUE;
+
+ if (data->raw.rc != NGX_OK) {
+ return;
+ }
+
+ r = data->raw.r;
+ log = r->connection->log;
+ is_last_chunk = (flags & GRN_CTX_TAIL);
+
+ if (!data->raw.header_sent) {
+ ngx_http_groonga_handler_set_content_type(r, grn_ctx_get_mime_type(context));
+ r->headers_out.status = NGX_HTTP_OK;
+ if (is_last_chunk) {
+ r->headers_out.content_length_n = chunk_size;
+ if (chunk_size == 0) {
+ r->header_only = 1;
+ }
+ } else {
+ r->headers_out.content_length_n = -1;
+ }
+ data->raw.rc = ngx_http_send_header(r);
+ data->raw.header_sent = GRN_TRUE;
+
+ if (data->raw.rc != NGX_OK) {
+ return;
+ }
+ }
+
+ if (chunk_size > 0 || is_last_chunk) {
+ ngx_chain_t *chain;
+
+ chain = ngx_chain_get_free_buf(r->pool, &(data->raw.free_chain));
+ if (!chain) {
+ ngx_log_error(NGX_LOG_ERR, log, 0,
+ "http_groonga: failed to allocate memory for chunked body");
+ data->raw.rc = NGX_ERROR;
+ return;
+ }
+ if (chunk_size == 0) {
+ chain->buf->pos = NULL;
+ chain->buf->last = NULL;
+ chain->buf->memory = 0;
+ } else {
+ chain->buf->pos = (u_char *)chunk;
+ chain->buf->last = (u_char *)chunk + chunk_size;
+ chain->buf->memory = 1;
+ }
+ chain->buf->tag = (ngx_buf_tag_t)&ngx_http_groonga_module;
+ chain->buf->flush = 1;
+ chain->buf->temporary = 0;
+ chain->buf->in_file = 0;
+ if (is_last_chunk) {
+ chain->buf->last_buf = 1;
+ } else {
+ chain->buf->last_buf = 0;
+ }
+ chain->next = NULL;
+
+ data->raw.rc = ngx_http_output_filter(r, chain);
+ ngx_chain_update_chains(r->pool,
+ &(data->raw.free_chain),
+ &(data->raw.busy_chain),
+ &chain,
+ (ngx_buf_tag_t)&ngx_http_groonga_module);
+ }
+}
+
+static void
+ngx_http_groonga_context_receive_handler_typed(grn_ctx *context,
+ int flags,
+ ngx_http_groonga_handler_data_t *data)
{
- ngx_http_groonga_handler_data_t *data = callback_data;
char *result = NULL;
unsigned int result_size = 0;
int recv_flags;
@@ -375,6 +518,7 @@ ngx_http_groonga_context_receive_handler(grn_ctx *context,
grn_ctx_recv(context, &result, &result_size, &recv_flags);
+#ifdef NGX_GRN_SUPPORT_STOP_BY_COMMAND
if (recv_flags == GRN_CTX_QUIT) {
ngx_int_t ngx_rc;
ngx_int_t ngx_pid;
@@ -385,8 +529,8 @@ ngx_http_groonga_context_receive_handler(grn_ctx *context,
ngx_pid = getppid();
}
- ngx_rc = ngx_os_signal_process((ngx_cycle_t*)ngx_cycle,
- "stop",
+ ngx_rc = ngx_os_signal_process((ngx_cycle_t *)ngx_cycle,
+ "quit",
ngx_pid);
if (ngx_rc == NGX_OK) {
context->stat &= ~GRN_CTX_QUIT;
@@ -394,28 +538,47 @@ ngx_http_groonga_context_receive_handler(grn_ctx *context,
context->stat |= GRN_CTX_QUIT;
} else {
context->rc = GRN_OPERATION_NOT_PERMITTED;
- GRN_TEXT_PUTS(context, &(data->body), "false");
+ GRN_TEXT_PUTS(context, &(data->typed.body), "false");
context->stat &= ~GRN_CTX_QUIT;
}
}
+#endif
if (result_size > 0 ||
- GRN_TEXT_LEN(&(data->body)) > 0 ||
+ GRN_TEXT_LEN(&(data->typed.body)) > 0 ||
context->rc != GRN_SUCCESS) {
if (result_size > 0) {
- GRN_TEXT_PUT(context, &(data->body), result, result_size);
+ GRN_TEXT_PUT(context, &(data->typed.body), result, result_size);
}
grn_output_envelope(context,
context->rc,
- &(data->head),
- &(data->body),
- &(data->foot),
+ &(data->typed.head),
+ &(data->typed.body),
+ &(data->typed.foot),
NULL,
0);
}
}
+static void
+ngx_http_groonga_context_receive_handler(grn_ctx *context,
+ int flags,
+ void *callback_data)
+{
+ ngx_http_groonga_handler_data_t *data = callback_data;
+
+ switch (grn_ctx_get_output_type(context)) {
+ case GRN_CONTENT_GROONGA_COMMAND_LIST :
+ case GRN_CONTENT_NONE :
+ ngx_http_groonga_context_receive_handler_raw(context, flags, data);
+ break;
+ default :
+ ngx_http_groonga_context_receive_handler_typed(context, flags, data);
+ break;
+ }
+}
+
static ngx_int_t
ngx_http_groonga_extract_command_path(ngx_http_request_t *r,
ngx_str_t *command_path)
@@ -461,15 +624,6 @@ ngx_http_groonga_extract_command_path(ngx_http_request_t *r,
return NGX_OK;
}
-static void
-ngx_http_groonga_handler_set_content_type(ngx_http_request_t *r,
- const char *content_type)
-{
- r->headers_out.content_type.len = strlen(content_type);
- r->headers_out.content_type.data = (u_char *)content_type;
- r->headers_out.content_type_len = r->headers_out.content_type.len;
-}
-
static ngx_int_t
ngx_http_groonga_handler_create_data(ngx_http_request_t *r,
ngx_http_groonga_handler_data_t **data_return)
@@ -496,10 +650,20 @@ ngx_http_groonga_handler_create_data(ngx_http_request_t *r,
if (rc != NGX_OK) {
return rc;
}
+
data->initialized = GRN_TRUE;
- GRN_TEXT_INIT(&(data->head), GRN_NO_FLAGS);
- GRN_TEXT_INIT(&(data->body), GRN_NO_FLAGS);
- GRN_TEXT_INIT(&(data->foot), GRN_NO_FLAGS);
+
+ data->raw.processed = GRN_FALSE;
+ data->raw.header_sent = GRN_FALSE;
+ data->raw.r = r;
+ data->raw.rc = NGX_OK;
+ data->raw.free_chain = NULL;
+ data->raw.busy_chain = NULL;
+
+ GRN_TEXT_INIT(&(data->typed.head), GRN_NO_FLAGS);
+ GRN_TEXT_INIT(&(data->typed.body), GRN_NO_FLAGS);
+ GRN_TEXT_INIT(&(data->typed.foot), GRN_NO_FLAGS);
+
grn_ctx_use(context, grn_ctx_db(&(location_conf->context)));
rc = ngx_http_groonga_context_check_error(r->connection->log, context);
if (rc != NGX_OK) {
@@ -553,9 +717,10 @@ ngx_http_groonga_handler_validate_post_command(ngx_http_request_t *r,
context = &(data->context);
ngx_http_groonga_handler_set_content_type(r, "text/plain");
- GRN_TEXT_PUTS(context, &(data->body), "command for POST must be <load>: <");
- GRN_TEXT_PUT(context, &(data->body), command.data, command.len);
- GRN_TEXT_PUTS(context, &(data->body), ">");
+ GRN_TEXT_PUTS(context, &(data->typed.body),
+ "command for POST must be <load>: <");
+ GRN_TEXT_PUT(context, &(data->typed.body), command.data, command.len);
+ GRN_TEXT_PUTS(context, &(data->typed.body), ">");
return NGX_HTTP_BAD_REQUEST;
}
@@ -665,7 +830,7 @@ ngx_http_groonga_handler_process_body(ngx_http_request_t *r,
body = r->request_body->bufs->buf;
if (!body) {
ngx_http_groonga_handler_set_content_type(r, "text/plain");
- GRN_TEXT_PUTS(context, &(data->body), "must send load data as body");
+ GRN_TEXT_PUTS(context, &(data->typed.body), "must send load data as body");
return NGX_HTTP_BAD_REQUEST;
}
@@ -744,6 +909,10 @@ ngx_http_groonga_handler_send_response(ngx_http_request_t *r,
ngx_chain_t head_chain, body_chain, foot_chain;
ngx_chain_t *output_chain = NULL;
+ if (data->raw.processed) {
+ return data->raw.rc;
+ }
+
context = &(data->context);
/* set the 'Content-type' header */
@@ -753,17 +922,17 @@ ngx_http_groonga_handler_send_response(ngx_http_request_t *r,
}
/* allocate buffers for a response body */
- head_buf = ngx_http_groonga_grn_obj_to_ngx_buf(r->pool, &(data->head));
+ head_buf = ngx_http_groonga_grn_obj_to_ngx_buf(r->pool, &(data->typed.head));
if (!head_buf) {
return NGX_HTTP_INTERNAL_SERVER_ERROR;
}
- body_buf = ngx_http_groonga_grn_obj_to_ngx_buf(r->pool, &(data->body));
+ body_buf = ngx_http_groonga_grn_obj_to_ngx_buf(r->pool, &(data->typed.body));
if (!body_buf) {
return NGX_HTTP_INTERNAL_SERVER_ERROR;
}
- foot_buf = ngx_http_groonga_grn_obj_to_ngx_buf(r->pool, &(data->foot));
+ foot_buf = ngx_http_groonga_grn_obj_to_ngx_buf(r->pool, &(data->typed.foot));
if (!foot_buf) {
return NGX_HTTP_INTERNAL_SERVER_ERROR;
}
@@ -778,9 +947,9 @@ ngx_http_groonga_handler_send_response(ngx_http_request_t *r,
/* set the status line */
r->headers_out.status = NGX_HTTP_OK;
- r->headers_out.content_length_n = GRN_TEXT_LEN(&(data->head)) +
- GRN_TEXT_LEN(&(data->body)) +
- GRN_TEXT_LEN(&(data->foot));
+ r->headers_out.content_length_n = GRN_TEXT_LEN(&(data->typed.head)) +
+ GRN_TEXT_LEN(&(data->typed.body)) +
+ GRN_TEXT_LEN(&(data->typed.foot));
if (r->headers_out.content_length_n == 0) {
r->header_only = 1;
}
@@ -1072,7 +1241,7 @@ ngx_http_groonga_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
GRN_CACHE_DEFAULT_MAX_N_ENTRIES);
#ifdef NGX_HTTP_GROONGA_LOG_PATH
- {
+ if (!conf->log_file) {
ngx_str_t default_log_path;
default_log_path.data = (u_char *)NGX_HTTP_GROONGA_LOG_PATH;
default_log_path.len = strlen(NGX_HTTP_GROONGA_LOG_PATH);
@@ -1085,8 +1254,6 @@ ngx_http_groonga_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
return NGX_CONF_ERROR;
}
}
-#else
- conf->log_file = NULL;
#endif
ngx_conf_merge_str_value(conf->query_log_path, prev->query_log_path,
diff --git a/storage/mroonga/vendor/groonga/src/suggest/CMakeLists.txt b/storage/mroonga/vendor/groonga/src/suggest/CMakeLists.txt
index 0773026a618..c0c7a9c9964 100644
--- a/storage/mroonga/vendor/groonga/src/suggest/CMakeLists.txt
+++ b/storage/mroonga/vendor/groonga/src/suggest/CMakeLists.txt
@@ -25,11 +25,9 @@ set_source_files_properties(${GROONGA_SUGGEST_CREATE_DATASET_SOURCES}
PROPERTIES
COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS}")
target_link_libraries(groonga-suggest-create-dataset libgroonga)
-if(NOT MRN_GROONGA_BUNDLED)
- install(
- TARGETS groonga-suggest-create-dataset
- DESTINATION ${BIN_DIR})
-endif()
+install(
+ TARGETS groonga-suggest-create-dataset
+ DESTINATION ${BIN_DIR})
if(GRN_WITH_LIBEVENT AND GRN_WITH_ZEROMQ AND GRN_WITH_MESSAGE_PACK)
set(GRN_WITH_SUGGEST_LEARNER TRUE)
@@ -82,9 +80,7 @@ if(GRN_WITH_SUGGEST_LEARNER)
${ZEROMQ_LIBRARIES}
${MESSAGE_PACK_LIBRARIES})
- if(NOT MRN_GROONGA_BUNDLED)
- install(
- TARGETS groonga-suggest-learner groonga-suggest-httpd
- DESTINATION ${BIN_DIR})
- endif()
+ install(
+ TARGETS groonga-suggest-learner groonga-suggest-httpd
+ DESTINATION ${BIN_DIR})
endif()
diff --git a/storage/mroonga/vendor/groonga/src/suggest/groonga_suggest_create_dataset.c b/storage/mroonga/vendor/groonga/src/suggest/groonga_suggest_create_dataset.c
index 35f2cd09fc0..d566d24b96a 100644
--- a/storage/mroonga/vendor/groonga/src/suggest/groonga_suggest_create_dataset.c
+++ b/storage/mroonga/vendor/groonga/src/suggest/groonga_suggest_create_dataset.c
@@ -21,7 +21,7 @@
#include <groonga.h>
/* For grn_str_getopt() */
-#include <str.h>
+#include <grn_str.h>
typedef enum {
MODE_NONE,
diff --git a/storage/mroonga/vendor/groonga/src/suggest/groonga_suggest_httpd.c b/storage/mroonga/vendor/groonga/src/suggest/groonga_suggest_httpd.c
index 6d94be87a8a..f3127288c73 100644
--- a/storage/mroonga/vendor/groonga/src/suggest/groonga_suggest_httpd.c
+++ b/storage/mroonga/vendor/groonga/src/suggest/groonga_suggest_httpd.c
@@ -1,5 +1,5 @@
/* -*- c-basic-offset: 2 -*- */
-/* Copyright(C) 2010-2013 Brazil
+/* Copyright(C) 2010-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,7 +16,8 @@
*/
/* groonga origin headers */
-#include <str.h>
+#include <grn_str.h>
+#include <grn_msgpack.h>
#include <stdio.h>
#include <signal.h>
@@ -38,7 +39,6 @@
#include "zmq_compatible.h"
#include <event.h>
#include <evhttp.h>
-#include <msgpack.h>
#include <groonga.h>
#include <pthread.h>
@@ -177,35 +177,35 @@ log_send(struct evkeyvalq *output_headers, struct evbuffer *res_buf,
msgpack_pack_map(&pk, cnt);
c = 'i';
- msgpack_pack_raw(&pk, 1);
- msgpack_pack_raw_body(&pk, &c, 1);
+ msgpack_pack_str(&pk, 1);
+ msgpack_pack_str_body(&pk, &c, 1);
l = strlen(client_id);
- msgpack_pack_raw(&pk, l);
- msgpack_pack_raw_body(&pk, client_id, l);
+ msgpack_pack_str(&pk, l);
+ msgpack_pack_str_body(&pk, client_id, l);
c = 'q';
- msgpack_pack_raw(&pk, 1);
- msgpack_pack_raw_body(&pk, &c, 1);
+ msgpack_pack_str(&pk, 1);
+ msgpack_pack_str_body(&pk, &c, 1);
l = strlen(query);
- msgpack_pack_raw(&pk, l);
- msgpack_pack_raw_body(&pk, query, l);
+ msgpack_pack_str(&pk, l);
+ msgpack_pack_str_body(&pk, query, l);
c = 's';
- msgpack_pack_raw(&pk, 1);
- msgpack_pack_raw_body(&pk, &c, 1);
+ msgpack_pack_str(&pk, 1);
+ msgpack_pack_str_body(&pk, &c, 1);
msgpack_pack_uint64(&pk, millisec);
c = 'l';
- msgpack_pack_raw(&pk, 1);
- msgpack_pack_raw_body(&pk, &c, 1);
+ msgpack_pack_str(&pk, 1);
+ msgpack_pack_str_body(&pk, &c, 1);
l = strlen(learn_target_name);
- msgpack_pack_raw(&pk, l);
- msgpack_pack_raw_body(&pk, learn_target_name, l);
+ msgpack_pack_str(&pk, l);
+ msgpack_pack_str_body(&pk, learn_target_name, l);
if (submit_flag) {
c = 't';
- msgpack_pack_raw(&pk, 1);
- msgpack_pack_raw_body(&pk, &c, 1);
+ msgpack_pack_str(&pk, 1);
+ msgpack_pack_str_body(&pk, &c, 1);
msgpack_pack_true(&pk);
}
{
@@ -249,9 +249,11 @@ log_send(struct evkeyvalq *output_headers, struct evbuffer *res_buf,
&(thd->pass_through_parameters));
}
if (content_length >= 0) {
- char num_buf[16];
- snprintf(num_buf, 16, "%d", content_length);
+#define NUM_BUF_SIZE 16
+ char num_buf[NUM_BUF_SIZE];
+ grn_snprintf(num_buf, NUM_BUF_SIZE, NUM_BUF_SIZE, "%d", content_length);
evhttp_add_header(output_headers, "Content-Length", num_buf);
+#undef NUM_BUF_SIZE
}
}
}
@@ -321,10 +323,18 @@ generic_handler(struct evhttp_request *req, void *arg)
time(&n);
t_st = localtime(&n);
- snprintf(p, PATH_MAX, "%s%04d%02d%02d%02d%02d%02d-%02d",
- thd->log_base_path,
- t_st->tm_year + 1900, t_st->tm_mon + 1, t_st->tm_mday,
- t_st->tm_hour, t_st->tm_min, t_st->tm_sec, thd->thread_id);
+ grn_snprintf(p,
+ PATH_MAX,
+ PATH_MAX,
+ "%s%04d%02d%02d%02d%02d%02d-%02d",
+ thd->log_base_path,
+ t_st->tm_year + 1900,
+ t_st->tm_mon + 1,
+ t_st->tm_mday,
+ t_st->tm_hour,
+ t_st->tm_min,
+ t_st->tm_sec,
+ thd->thread_id);
if (!(thd->log_file = fopen(p, "a"))) {
print_error("cannot open log_file %s.", p);
@@ -420,8 +430,10 @@ msgpack2json(msgpack_object *o, grn_ctx *ctx, grn_obj *buf)
case MSGPACK_OBJECT_POSITIVE_INTEGER:
grn_text_ulltoa(ctx, buf, o->via.u64);
break;
- case MSGPACK_OBJECT_RAW:
- grn_text_esc(ctx, buf, o->via.raw.ptr, o->via.raw.size);
+ case MSGPACK_OBJECT_STR:
+ grn_text_esc(ctx, buf,
+ MSGPACK_OBJECT_STR_PTR(o),
+ MSGPACK_OBJECT_STR_SIZE(o));
break;
case MSGPACK_OBJECT_ARRAY:
GRN_TEXT_PUTC(ctx, buf, '[');
@@ -433,8 +445,8 @@ msgpack2json(msgpack_object *o, grn_ctx *ctx, grn_obj *buf)
}
GRN_TEXT_PUTC(ctx, buf, ']');
break;
- case MSGPACK_OBJECT_DOUBLE:
- grn_text_ftoa(ctx, buf, o->via.dec);
+ case MSGPACK_OBJECT_FLOAT:
+ grn_text_ftoa(ctx, buf, MSGPACK_OBJECT_FLOAT_VALUE(o));
break;
default:
print_error("cannot handle this msgpack type.");
@@ -446,19 +458,25 @@ load_from_learner(msgpack_object *o, grn_ctx *ctx, grn_obj *cmd_buf)
{
if (o->type == MSGPACK_OBJECT_MAP && o->via.map.size) {
msgpack_object_kv *kv;
+ msgpack_object *key;
+ msgpack_object *value;
kv = &(o->via.map.ptr[0]);
- if (kv->key.type == MSGPACK_OBJECT_RAW && kv->key.via.raw.size == 6 &&
- !memcmp(kv->key.via.raw.ptr, CONST_STR_LEN("target"))) {
- if (kv->val.type == MSGPACK_OBJECT_RAW) {
+ key = &(kv->key);
+ value = &(kv->val);
+ if (key->type == MSGPACK_OBJECT_STR && MSGPACK_OBJECT_STR_SIZE(key) == 6 &&
+ !memcmp(MSGPACK_OBJECT_STR_PTR(key), CONST_STR_LEN("target"))) {
+ if (value->type == MSGPACK_OBJECT_STR) {
int i;
GRN_BULK_REWIND(cmd_buf);
GRN_TEXT_PUTS(ctx, cmd_buf, "load --table ");
- GRN_TEXT_PUT(ctx, cmd_buf, kv->val.via.raw.ptr, kv->val.via.raw.size);
+ GRN_TEXT_PUT(ctx, cmd_buf,
+ MSGPACK_OBJECT_STR_PTR(value),
+ MSGPACK_OBJECT_STR_SIZE(value));
grn_ctx_send(ctx, GRN_TEXT_VALUE(cmd_buf), GRN_TEXT_LEN(cmd_buf), GRN_CTX_MORE);
grn_ctx_send(ctx, CONST_STR_LEN("["), GRN_CTX_MORE);
- if (kv->val.via.raw.size > 5) {
- if (!memcmp(kv->val.via.raw.ptr, CONST_STR_LEN("item_")) ||
- !memcmp(kv->val.via.raw.ptr, CONST_STR_LEN("pair_"))) {
+ if (MSGPACK_OBJECT_STR_SIZE(value) > 5) {
+ if (!memcmp(MSGPACK_OBJECT_STR_PTR(value), CONST_STR_LEN("item_")) ||
+ !memcmp(MSGPACK_OBJECT_STR_PTR(value), CONST_STR_LEN("pair_"))) {
char delim = '{';
GRN_BULK_REWIND(cmd_buf);
for (i = 1; i < o->via.map.size; i++) {
diff --git a/storage/mroonga/vendor/groonga/src/suggest/groonga_suggest_learner.c b/storage/mroonga/vendor/groonga/src/suggest/groonga_suggest_learner.c
index 060d238565a..03d889f5b01 100644
--- a/storage/mroonga/vendor/groonga/src/suggest/groonga_suggest_learner.c
+++ b/storage/mroonga/vendor/groonga/src/suggest/groonga_suggest_learner.c
@@ -1,5 +1,5 @@
/* -*- c-basic-offset: 2 -*- */
-/* Copyright(C) 2010-2014 Brazil
+/* Copyright(C) 2010-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,13 +16,13 @@
*/
/* for grn_str_getopt() */
-#include <str.h>
+#include <grn_str.h>
+#include <grn_msgpack.h>
#include "zmq_compatible.h"
#include <stdio.h>
#include <signal.h>
#include <unistd.h>
-#include <msgpack.h>
#include <pthread.h>
#include <groonga.h>
#include <inttypes.h>
@@ -142,14 +142,14 @@ load_to_multi_targets(grn_ctx *ctx,
int _k_len; \
char _k_buf[GRN_TABLE_MAX_KEY_SIZE]; \
_k_len = grn_table_get_key(ctx, ref_table, (id), _k_buf, GRN_TABLE_MAX_KEY_SIZE); \
- msgpack_pack_raw(&pk, _k_len); \
- msgpack_pack_raw_body(&pk, _k_buf, _k_len); \
+ msgpack_pack_str(&pk, _k_len); \
+ msgpack_pack_str_body(&pk, _k_buf, _k_len); \
} while (0)
#define PACK_MAP_ITEM(col_name) do { \
grn_obj _v; \
- msgpack_pack_raw(&pk, sizeof(#col_name) - 1); \
- msgpack_pack_raw_body(&pk, CONST_STR_LEN(#col_name)); \
+ msgpack_pack_str(&pk, sizeof(#col_name) - 1); \
+ msgpack_pack_str_body(&pk, #col_name, sizeof(#col_name) - 1); \
switch (col_##col_name->header.type) { \
case GRN_COLUMN_FIX_SIZE: \
GRN_VALUE_FIX_SIZE_INIT(&_v, 0, grn_obj_get_range(ctx, col_##col_name)); \
@@ -168,8 +168,8 @@ load_to_multi_targets(grn_ctx *ctx,
case GRN_BULK: \
switch (_v.header.domain) { \
case GRN_DB_SHORT_TEXT: \
- msgpack_pack_raw(&pk, GRN_TEXT_LEN(&_v)); \
- msgpack_pack_raw_body(&pk, GRN_TEXT_VALUE(&_v), GRN_TEXT_LEN(&_v)); \
+ msgpack_pack_str(&pk, GRN_TEXT_LEN(&_v)); \
+ msgpack_pack_str_body(&pk, GRN_TEXT_VALUE(&_v), GRN_TEXT_LEN(&_v)); \
break; \
case GRN_DB_INT32: \
msgpack_pack_int32(&pk, GRN_INT32_VALUE(&_v)); \
@@ -268,18 +268,18 @@ send_handler(void *zmq_send_sock, grn_ctx *ctx)
msgpack_pack_map(&pk, 8);
/* ["_key","ShortText"],["last","Time"],["kana","kana"],["freq2","Int32"],["freq","Int32"],["co","pair_all"],["buzz","Int32"],["boost","Int32"] */
- msgpack_pack_raw(&pk, 6);
- msgpack_pack_raw_body(&pk, CONST_STR_LEN("target"));
- msgpack_pack_raw(&pk, name_len);
- msgpack_pack_raw_body(&pk, name_buf, name_len);
+ msgpack_pack_str(&pk, 6);
+ msgpack_pack_str_body(&pk, "target", strlen("target"));
+ msgpack_pack_str(&pk, name_len);
+ msgpack_pack_str_body(&pk, name_buf, name_len);
- msgpack_pack_raw(&pk, 4);
- msgpack_pack_raw_body(&pk,
+ msgpack_pack_str(&pk, 4);
+ msgpack_pack_str_body(&pk,
GRN_COLUMN_NAME_KEY,
GRN_COLUMN_NAME_KEY_LEN);
key_len = grn_table_cursor_get_key(ctx, tc, (void **)&key);
- msgpack_pack_raw(&pk, key_len);
- msgpack_pack_raw_body(&pk, key, key_len);
+ msgpack_pack_str(&pk, key_len);
+ msgpack_pack_str_body(&pk, key, key_len);
PACK_MAP_ITEM(last);
PACK_MAP_ITEM(kana);
@@ -339,13 +339,13 @@ send_handler(void *zmq_send_sock, grn_ctx *ctx)
msgpack_pack_map(&pk, 7);
/* ["_key","UInt64"],["pre","item_all"],["post","item_all"],["freq2","Int32"],["freq1","Int32"],["freq0","Int32"] */
- msgpack_pack_raw(&pk, 6);
- msgpack_pack_raw_body(&pk, CONST_STR_LEN("target"));
- msgpack_pack_raw(&pk, name_len);
- msgpack_pack_raw_body(&pk, name_buf, name_len);
+ msgpack_pack_str(&pk, 6);
+ msgpack_pack_str_body(&pk, "target", strlen("target"));
+ msgpack_pack_str(&pk, name_len);
+ msgpack_pack_str_body(&pk, name_buf, name_len);
- msgpack_pack_raw(&pk, 4);
- msgpack_pack_raw_body(&pk,
+ msgpack_pack_str(&pk, 4);
+ msgpack_pack_str_body(&pk,
GRN_COLUMN_NAME_KEY,
GRN_COLUMN_NAME_KEY_LEN);
grn_table_cursor_get_key(ctx, tc, (void **)&key);
@@ -419,25 +419,29 @@ handle_msg(msgpack_object *obj, grn_ctx *ctx, grn_obj *buf)
int i;
for (i = 0; i < obj->via.map.size; i++) {
msgpack_object_kv *kv;
+ msgpack_object *key;
+ msgpack_object *value;
kv = &(obj->via.map.ptr[i]);
- if (kv->key.type == MSGPACK_OBJECT_RAW && kv->key.via.raw.size) {
- switch (kv->key.via.raw.ptr[0]) {
+ key = &(kv->key);
+ value = &(kv->val);
+ if (key->type == MSGPACK_OBJECT_STR && MSGPACK_OBJECT_STR_SIZE(key) > 0) {
+ switch (MSGPACK_OBJECT_STR_PTR(key)[0]) {
case 'i':
- if (kv->val.type == MSGPACK_OBJECT_RAW) {
- client_id_len = kv->val.via.raw.size;
- client_id = kv->val.via.raw.ptr;
+ if (value->type == MSGPACK_OBJECT_STR) {
+ client_id_len = MSGPACK_OBJECT_STR_SIZE(value);
+ client_id = MSGPACK_OBJECT_STR_PTR(value);
}
break;
case 'q':
- if (kv->val.type == MSGPACK_OBJECT_RAW) {
- query_len = kv->val.via.raw.size;
- query = kv->val.via.raw.ptr;
+ if (value->type == MSGPACK_OBJECT_STR) {
+ query_len = MSGPACK_OBJECT_STR_SIZE(value);
+ query = MSGPACK_OBJECT_STR_PTR(value);
}
break;
case 'l':
- if (kv->val.type == MSGPACK_OBJECT_RAW) {
- learn_target_names_len = kv->val.via.raw.size;
- learn_target_names = kv->val.via.raw.ptr;
+ if (value->type == MSGPACK_OBJECT_STR) {
+ learn_target_names_len = MSGPACK_OBJECT_STR_SIZE(value);
+ learn_target_names = MSGPACK_OBJECT_STR_PTR(value);
}
break;
case 's':
diff --git a/storage/mroonga/vendor/groonga/tools/travis-before-script.sh b/storage/mroonga/vendor/groonga/tools/travis-before-script.sh
index 943f41b0013..ac56e5bd5f0 100755
--- a/storage/mroonga/vendor/groonga/tools/travis-before-script.sh
+++ b/storage/mroonga/vendor/groonga/tools/travis-before-script.sh
@@ -4,30 +4,43 @@ set -e
git submodule update --init --depth 1
+prefix=/tmp/local
+
case "${BUILD_TOOL}" in
- autotools)
- ./autogen.sh
-
- configure_args=""
- #if [ "$CC" = "clang" ]; then
- configure_args="${configure_args} --enable-debug"
- #fi
- if [ "$ENABLE_MRUBY" = "yes" ]; then
- configure_args="${configure_args} --with-ruby --enable-mruby"
- fi
-
- ./configure --with-ruby ${configure_args}
- ;;
- cmake)
- cmake_args=""
- cmake_args="${cmake_args} -DGRN_WITH_DEBUG=yes"
- if [ "$ENABLE_MRUBY" = "yes" ]; then
- cmake_args="${cmake_args} -DGRN_WITH_MRUBY=yes"
- fi
-
- cmake . ${cmake_args}
- ;;
+ autotools)
+ ./autogen.sh
+
+ configure_args=""
+ #if [ "$CC" = "clang" ]; then
+ configure_args="${configure_args} --enable-debug"
+ #fi
+ if [ "$ENABLE_MRUBY" = "yes" ]; then
+ configure_args="${configure_args} --with-ruby --enable-mruby"
+ fi
+
+ ./configure --prefix=${prefix} --with-ruby ${configure_args}
+ ;;
+ cmake)
+ cmake_args=""
+ cmake_args="${cmake_args} -DGRN_WITH_DEBUG=yes"
+ if [ "$ENABLE_MRUBY" = "yes" ]; then
+ cmake_args="${cmake_args} -DGRN_WITH_MRUBY=yes"
+ fi
+
+ cmake . ${cmake_args}
+ ;;
+esac
+
+case "$(uname)" in
+ Linux)
+ n_processors="$(grep '^processor' /proc/cpuinfo | wc -l)"
+ ;;
+ Darwin)
+ n_processors="$(/usr/sbin/sysctl -n hw.ncpu)"
+ ;;
+ *)
+ n_processors="1"
+ ;;
esac
-n_processors="$(grep '^processor' /proc/cpuinfo | wc -l)"
make -j${n_processors} > /dev/null
diff --git a/storage/mroonga/vendor/groonga/tools/travis-install.sh b/storage/mroonga/vendor/groonga/tools/travis-install.sh
new file mode 100755
index 00000000000..943c6220ca6
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/tools/travis-install.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+set -e
+
+case "${TRAVIS_OS_NAME}" in
+ linux)
+ curl --silent --location https://raw.github.com/clear-code/cutter/master/data/travis/setup.sh | sh
+ sudo apt-get install -qq -y \
+ autotools-dev \
+ zlib1g-dev \
+ libmsgpack-dev \
+ libevent-dev \
+ libmecab-dev \
+ mecab-naist-jdic \
+ cmake
+ ;;
+ osx)
+ brew install \
+ msgpack \
+ libevent \
+ mecab \
+ mecab-ipadic
+ ;;
+esac
+
+if [ "${ENABLE_MRUBY}" = "yes" ]; then
+ gem install pkg-config groonga-client
+fi
diff --git a/storage/mroonga/vendor/groonga/tools/travis-script.sh b/storage/mroonga/vendor/groonga/tools/travis-script.sh
index 7931903d419..1c4a1a7e1a9 100755
--- a/storage/mroonga/vendor/groonga/tools/travis-script.sh
+++ b/storage/mroonga/vendor/groonga/tools/travis-script.sh
@@ -2,14 +2,24 @@
set -e
+prefix=/tmp/local
+
+command_test_options="--n-workers=4"
+
+set -x
+
case "${BUILD_TOOL}" in
- autotools)
- test/unit/run-test.sh
- test/command/run-test.sh
- # test/command/run-test.sh --interface http
- # test/command/run-test.sh --interface http --testee groonga-httpd
- ;;
- cmake)
- test/command/run-test.sh
- ;;
+ autotools)
+ test/unit/run-test.sh
+ test/command/run-test.sh ${command_test_options}
+ if [ "${ENABLE_MRUBY}" = "yes" ]; then
+ test/query_optimizer/run-test.rb
+ fi
+ test/command/run-test.sh ${command_test_options} --interface http
+ mkdir -p ${prefix}/var/log/groonga/httpd
+ test/command/run-test.sh ${command_test_options} --testee groonga-httpd
+ ;;
+ cmake)
+ test/command/run-test.sh ${command_test_options}
+ ;;
esac
diff --git a/storage/mroonga/vendor/groonga/vendor/CMakeLists.txt b/storage/mroonga/vendor/groonga/vendor/CMakeLists.txt
index 30c9befebb6..91a806e0429 100644
--- a/storage/mroonga/vendor/groonga/vendor/CMakeLists.txt
+++ b/storage/mroonga/vendor/groonga/vendor/CMakeLists.txt
@@ -13,4 +13,5 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+add_subdirectory(onigmo)
add_subdirectory(mruby)
diff --git a/storage/mroonga/vendor/groonga/vendor/Makefile.am b/storage/mroonga/vendor/groonga/vendor/Makefile.am
index 334b6fd8917..0b766191a08 100644
--- a/storage/mroonga/vendor/groonga/vendor/Makefile.am
+++ b/storage/mroonga/vendor/groonga/vendor/Makefile.am
@@ -11,6 +11,7 @@ EXTRA_DIST = \
mruby/CMakeLists.txt
dist-hook:
+ rm -rf $(distdir)/$(NGINX_DIR)/objs/
GIT_DIR=$(srcdir)/mruby-source/.git git archive --format=tar HEAD | \
tar xf - -C $(distdir)/mruby-source
$(MKDIR_P) $(distdir)/onigmo-source
diff --git a/storage/mroonga/vendor/groonga/vendor/mruby/CMakeLists.txt b/storage/mroonga/vendor/groonga/vendor/mruby/CMakeLists.txt
index 9f4aad4c32b..c78fde5d258 100644
--- a/storage/mroonga/vendor/groonga/vendor/mruby/CMakeLists.txt
+++ b/storage/mroonga/vendor/groonga/vendor/mruby/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright(C) 2013 Brazil
+# Copyright(C) 2013-2015 Brazil
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -13,19 +13,60 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-add_definitions(
- -DDISABLE_GEMS
- )
-
-include_directories(
- "${CMAKE_CURRENT_SOURCE_DIR}/../mruby-${MRUBY_VERSION}/include"
- "${CMAKE_CURRENT_SOURCE_DIR}/../mruby-${MRUBY_VERSION}/src"
+if(GRN_WITH_MRUBY)
+ include_directories(
+ "${CMAKE_CURRENT_SOURCE_DIR}/../mruby-source/include"
+ "${CMAKE_CURRENT_SOURCE_DIR}/../mruby-source/src"
+ "${CMAKE_CURRENT_SOURCE_DIR}/../onigmo-source"
)
-if(GRN_WITH_MRUBY)
read_file_list("${CMAKE_CURRENT_SOURCE_DIR}/sources.am" MRUBY_SOURCES)
- add_library(mruby OBJECT ${MRUBY_SOURCES})
- set_source_files_properties(${MRUBY_SOURCES}
+ string(REGEX REPLACE "\\.\\./" "${CMAKE_CURRENT_SOURCE_DIR}/../"
+ MRUBY_SOURCES "${MRUBY_SOURCES}")
+
+ read_file_list("${CMAKE_CURRENT_SOURCE_DIR}/built_sources.am"
+ MRUBY_BUILT_SOURCES)
+ set(mruby_pre_build_timestamp
+ "${CMAKE_CURRENT_SOURCE_DIR}/mruby_build.timestamp")
+ if(EXISTS "${mruby_pre_build_timestamp}")
+ string(REGEX REPLACE "([^;]+)" "${CMAKE_CURRENT_SOURCE_DIR}/\\1"
+ MRUBY_BUILT_SOURCES "${MRUBY_BUILT_SOURCES}")
+ include_directories(
+ "${CMAKE_CURRENT_SOURCE_DIR}/mruby-io/include"
+ )
+ else()
+ set(mruby_build_timestamp
+ "${CMAKE_CURRENT_BINARY_DIR}/mruby_build.timestamp")
+ if(NOT EXISTS "${mruby_build_timestamp}")
+ execute_process(
+ COMMAND
+ "${RUBY}"
+ "${CMAKE_CURRENT_SOURCE_DIR}/mruby_build.rb"
+ "${CMAKE_CURRENT_SOURCE_DIR}/build_config.rb"
+ "${CMAKE_CURRENT_SOURCE_DIR}/../mruby-source"
+ "${CMAKE_CURRENT_BINARY_DIR}/../mruby-build"
+ "${CMAKE_CURRENT_SOURCE_DIR}/../onigmo-source"
+ "${mruby_build_timestamp}"
+ WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
+ RESULT_VARIABLE MRUBY_BUILD_RESULT
+ )
+ if(NOT MRUBY_BUILD_RESULT EQUAL "0")
+ message(FATAL_ERROR "Failed to build mruby files")
+ endif()
+ endif()
+ string(REGEX REPLACE "([^;]+)" "${CMAKE_CURRENT_BINARY_DIR}/\\1"
+ MRUBY_BUILT_SOURCES "${MRUBY_BUILT_SOURCES}")
+ include_directories(
+ "${CMAKE_CURRENT_BINARY_DIR}/mruby-io/include"
+ )
+ endif()
+
+ set(MRUBY_ALL_SOURCES
+ ${MRUBY_SOURCES}
+ ${MRUBY_BUILT_SOURCES}
+ )
+ add_library(mruby STATIC ${MRUBY_ALL_SOURCES})
+ set_source_files_properties(${MRUBY_ALL_SOURCES}
PROPERTIES
COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS}")
set_target_properties(
diff --git a/storage/mroonga/vendor/groonga/vendor/mruby/Makefile.am b/storage/mroonga/vendor/groonga/vendor/mruby/Makefile.am
index 41385bcd589..d995ccfcce1 100644
--- a/storage/mroonga/vendor/groonga/vendor/mruby/Makefile.am
+++ b/storage/mroonga/vendor/groonga/vendor/mruby/Makefile.am
@@ -1,9 +1,15 @@
EXTRA_DIST = \
- build_config.rb
+ build_config.rb \
+ mruby_build.rb \
+ mruby_build.timestamp
DEFAULT_INCLUDES = \
-I$(srcdir)/../mruby-source/include \
- -I$(srcdir)/../mruby-source/src
+ -I$(srcdir)/../mruby-source/src \
+ -Imruby-io/include \
+ -I$(srcdir)/mruby-io/include
+
+CFLAGS += $(NO_FLOAT_EQUAL_CFLAGS)
if WITH_MRUBY
noinst_LTLIBRARIES = libmruby.la
@@ -18,42 +24,32 @@ AM_CPPFLAGS += \
endif
include sources.am
-
-BUILT_SOURCES = \
- parse.c \
- mrblib.c \
- mrbgems_init.c \
- mruby_onig_regexp.c
+include built_sources.am
libmruby_la_SOURCES += $(BUILT_SOURCES)
-parse.c: mruby-build.timestamp
-mrblib.c: mruby-build.timestamp
-mrbgems_init.c: mruby-build.timestamp
-mruby_onig_regexp.c: mruby-build.timestamp
+parse.c: mruby_build.timestamp
+mrblib.c: mruby_build.timestamp
+mrbgems_init.c: mruby_build.timestamp
+mruby-onig-regexp/src/mruby_onig_regexp.c: mruby_build.timestamp
+mruby-env/src/env.c: mruby_build.timestamp
+mruby-io/include/mruby/ext/io.h: mruby_build.timestamp
+mruby-io/src/file.c: mruby_build.timestamp
+mruby-io/src/file_test.c: mruby_build.timestamp
+mruby-io/src/io.c: mruby_build.timestamp
+mruby-io/src/mruby_io_gem.c: mruby_build.timestamp
MRUBY_CONFIG = $(abs_srcdir)/build_config.rb
MRUBY_BUILD_DIR = $(abs_top_builddir)/vendor/mruby-build
-MRUBY_ONIG_REGEXP_DIR = $(MRUBY_BUILD_DIR)/mrbgems/mruby-onig-regexp
-mruby-build.timestamp: build_config.rb
- rm -rf $(MRUBY_BUILD_DIR)
- cd $(srcdir)/../mruby-source && \
- $(RUBY) minirake \
- MRUBY_BUILD_DIR=$(MRUBY_BUILD_DIR) \
- MRUBY_CONFIG=$(MRUBY_CONFIG)
- touch $@
- cp $(MRUBY_BUILD_DIR)/host/src/y.tab.c parse.c
- cp $(MRUBY_BUILD_DIR)/host/mrblib/mrblib.c ./
- ( \
- cat $(MRUBY_BUILD_DIR)/host/mrbgems/gem_init.c; \
- cat $(MRUBY_BUILD_DIR)/host/mrbgems/*/gem_init.c; \
- ) > mrbgems_init.c
- cp $(MRUBY_ONIG_REGEXP_DIR)/src/mruby_onig_regexp.c ./
-
-EXTRA_DIST += \
- mruby-build.timestamp
+mruby_build.timestamp: build_config.rb
+ $(RUBY) "$(srcdir)/mruby_build.rb" \
+ "$(srcdir)/build_config.rb" \
+ "$(srcdir)/../mruby-source" \
+ "$(builddir)/../mruby-build" \
+ "$(srcdir)/../onigmo-source" \
+ "mruby_build.timestamp"
CLEANFILES = *.gcno *gcda
-MAINTAINERCLEANFILES = mruby-build.timestamp
+MAINTAINERCLEANFILES = mruby_build.timestamp
endif
update:
diff --git a/storage/mroonga/vendor/groonga/vendor/mruby/build_config.rb b/storage/mroonga/vendor/groonga/vendor/mruby/build_config.rb
index 2380c04789d..5a963f9c7e7 100644
--- a/storage/mroonga/vendor/groonga/vendor/mruby/build_config.rb
+++ b/storage/mroonga/vendor/groonga/vendor/mruby/build_config.rb
@@ -5,6 +5,11 @@ MRuby::Build.new do |conf|
toolchain :gcc
end
+ oniguruma_include_path = ENV["MRUBY_ONIGURUMA_INCLUDE_PATH"]
+ if oniguruma_include_path
+ conf.cc.include_paths << oniguruma_include_path
+ end
+
enable_debug
conf.gem :core => "mruby-sprintf"
@@ -30,4 +35,8 @@ MRuby::Build.new do |conf|
conf.gem :core => "mruby-kernel-ext"
conf.gem :github => "mattn/mruby-onig-regexp"
+ conf.gem :github => "iij/mruby-env"
+ conf.gem :github => "iij/mruby-io"
+ conf.gem :github => "kou/mruby-pp"
+ conf.gem :github => "kou/mruby-slop"
end
diff --git a/storage/mroonga/vendor/groonga/vendor/mruby/built_sources.am b/storage/mroonga/vendor/groonga/vendor/mruby/built_sources.am
new file mode 100644
index 00000000000..08c5e3a9453
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/vendor/mruby/built_sources.am
@@ -0,0 +1,11 @@
+BUILT_SOURCES = \
+ parse.c \
+ mrblib.c \
+ mrbgems_init.c \
+ mruby-onig-regexp/src/mruby_onig_regexp.c \
+ mruby-env/src/env.c \
+ mruby-io/include/mruby/ext/io.h \
+ mruby-io/src/file.c \
+ mruby-io/src/file_test.c \
+ mruby-io/src/io.c \
+ mruby-io/src/mruby_io_gem.c
diff --git a/storage/mroonga/vendor/groonga/vendor/mruby/mruby_build.rb b/storage/mroonga/vendor/groonga/vendor/mruby/mruby_build.rb
new file mode 100755
index 00000000000..f0db931ed38
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/vendor/mruby/mruby_build.rb
@@ -0,0 +1,51 @@
+#!/usr/bin/env ruby
+
+if ARGV.size != 5
+ puts("Usage: #{$0} BUILD_COFNIG.RB MRUBY_SOURCE_DIR MRUBY_BUILD_DIR ONIGURUMA_INCLUDE_PATH TIMESTAMP_FILE")
+ exit(false)
+end
+
+require "rbconfig"
+require "fileutils"
+
+build_config_rb = File.expand_path(ARGV.shift)
+mruby_source_dir = ARGV.shift
+mruby_build_dir = File.expand_path(ARGV.shift)
+oniguruma_include_path = File.expand_path(ARGV.shift)
+timestamp_file = File.expand_path(ARGV.shift)
+
+FileUtils.rm_rf(mruby_build_dir)
+
+Dir.chdir(mruby_source_dir) do
+ unless system(RbConfig.ruby,
+ "minirake",
+ "MRUBY_CONFIG=#{build_config_rb}",
+ "MRUBY_BUILD_DIR=#{mruby_build_dir}",
+ "MRUBY_ONIGURUMA_INCLUDE_PATH=#{oniguruma_include_path}")
+ exit(false)
+ end
+end
+
+FileUtils.touch(timestamp_file)
+
+FileUtils.cp("#{mruby_build_dir}/host/src/y.tab.c", "parse.c")
+FileUtils.cp("#{mruby_build_dir}/host/mrblib/mrblib.c", "./")
+
+File.open("mrbgems_init.c", "w") do |mrbgems_init|
+ Dir.glob("#{mruby_build_dir}/host/mrbgems/**/gem_init.c") do |gem_init|
+ mrbgems_init.puts(File.read(gem_init))
+ end
+end
+
+mruby_onig_regexp_dir = "#{mruby_build_dir}/mrbgems/mruby-onig-regexp"
+FileUtils.mkdir_p("mruby-onig-regexp/")
+FileUtils.cp_r("#{mruby_onig_regexp_dir}/src/", "mruby-onig-regexp/")
+
+mruby_env_dir = "#{mruby_build_dir}/mrbgems/mruby-env"
+FileUtils.mkdir_p("mruby-env/")
+FileUtils.cp_r("#{mruby_env_dir}/src/", "mruby-env/")
+
+mruby_io_dir = "#{mruby_build_dir}/mrbgems/mruby-io"
+FileUtils.mkdir_p("mruby-io/")
+FileUtils.cp_r("#{mruby_io_dir}/include/", "mruby-io/")
+FileUtils.cp_r("#{mruby_io_dir}/src/", "mruby-io/")
diff --git a/storage/mroonga/vendor/groonga/vendor/mruby/sources.am b/storage/mroonga/vendor/groonga/vendor/mruby/sources.am
index b470d58b803..68f15c64571 100644
--- a/storage/mroonga/vendor/groonga/vendor/mruby/sources.am
+++ b/storage/mroonga/vendor/groonga/vendor/mruby/sources.am
@@ -11,6 +11,7 @@ libmruby_la_SOURCES = \
../mruby-source/src/error.c \
../mruby-source/src/error.h \
../mruby-source/src/etc.c \
+ ../mruby-source/src/fmt_fp.c \
../mruby-source/src/gc.c \
../mruby-source/src/hash.c \
../mruby-source/src/init.c \
diff --git a/storage/mroonga/vendor/groonga/vendor/onigmo/CMakeLists.txt b/storage/mroonga/vendor/groonga/vendor/onigmo/CMakeLists.txt
new file mode 100644
index 00000000000..0f79347aa73
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/vendor/onigmo/CMakeLists.txt
@@ -0,0 +1,110 @@
+# Copyright(C) 2015 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
+
+if(GRN_WITH_ONIGMO)
+ set(ONIGMO_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../onigmo-source")
+ set(ONIGMO_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/../onigmo-source")
+
+ include(CheckTypeSize)
+
+ macro(ac_check_sizeof type)
+ string(TOUPPER "${type}" output_variable_base_name)
+ set(output_variable_name "ONIG_SIZEOF_${output_variable_base_name}")
+ check_type_size(${type} ${output_variable_name})
+ if(HAVE_${output_variable_name})
+ add_definitions(
+ -DSIZEOF_${output_variable_base_name}=${${output_variable_name}}
+ )
+ endif()
+ endmacro()
+
+ ac_check_sizeof(short)
+ ac_check_sizeof(int)
+ ac_check_sizeof(long)
+
+ if(MSVC)
+ add_definitions(-Dinline=__inline)
+ add_definitions(-D_CRT_SECURE_NO_WARNINGS)
+ endif()
+
+ include_directories(
+ ${ONIGMO_BINARY_DIR}
+ ${ONIGMO_SOURCE_DIR}
+ )
+
+ set(ONIGMO_SOURCES
+ "${ONIGMO_SOURCE_DIR}/regint.h"
+ "${ONIGMO_SOURCE_DIR}/regparse.h"
+ "${ONIGMO_SOURCE_DIR}/regenc.h"
+ "${ONIGMO_SOURCE_DIR}/st.h"
+ "${ONIGMO_SOURCE_DIR}/regerror.c"
+ "${ONIGMO_SOURCE_DIR}/regparse.c"
+ "${ONIGMO_SOURCE_DIR}/regext.c"
+ "${ONIGMO_SOURCE_DIR}/regcomp.c"
+ "${ONIGMO_SOURCE_DIR}/regexec.c"
+ "${ONIGMO_SOURCE_DIR}/reggnu.c"
+ "${ONIGMO_SOURCE_DIR}/regenc.c"
+ "${ONIGMO_SOURCE_DIR}/regsyntax.c"
+ "${ONIGMO_SOURCE_DIR}/regtrav.c"
+ "${ONIGMO_SOURCE_DIR}/regversion.c"
+ "${ONIGMO_SOURCE_DIR}/st.c"
+ "${ONIGMO_SOURCE_DIR}/regposix.c"
+ "${ONIGMO_SOURCE_DIR}/regposerr.c"
+ "${ONIGMO_SOURCE_DIR}/enc/unicode.c"
+ "${ONIGMO_SOURCE_DIR}/enc/ascii.c"
+ "${ONIGMO_SOURCE_DIR}/enc/utf8.c"
+ "${ONIGMO_SOURCE_DIR}/enc/utf16_be.c"
+ "${ONIGMO_SOURCE_DIR}/enc/utf16_le.c"
+ "${ONIGMO_SOURCE_DIR}/enc/utf32_be.c"
+ "${ONIGMO_SOURCE_DIR}/enc/utf32_le.c"
+ "${ONIGMO_SOURCE_DIR}/enc/unicode/casefold.h"
+ "${ONIGMO_SOURCE_DIR}/enc/unicode/name2ctype.h"
+ "${ONIGMO_SOURCE_DIR}/enc/euc_jp.c"
+ "${ONIGMO_SOURCE_DIR}/enc/sjis.c"
+ "${ONIGMO_SOURCE_DIR}/enc/cp932.c"
+ "${ONIGMO_SOURCE_DIR}/enc/jis/props.h"
+# "${ONIGMO_SOURCE_DIR}/enc/jis/props.kwd"
+ "${ONIGMO_SOURCE_DIR}/enc/iso8859_1.c"
+ "${ONIGMO_SOURCE_DIR}/enc/iso8859_2.c"
+ "${ONIGMO_SOURCE_DIR}/enc/iso8859_3.c"
+ "${ONIGMO_SOURCE_DIR}/enc/iso8859_4.c"
+ "${ONIGMO_SOURCE_DIR}/enc/iso8859_5.c"
+ "${ONIGMO_SOURCE_DIR}/enc/iso8859_6.c"
+ "${ONIGMO_SOURCE_DIR}/enc/iso8859_7.c"
+ "${ONIGMO_SOURCE_DIR}/enc/iso8859_8.c"
+ "${ONIGMO_SOURCE_DIR}/enc/iso8859_9.c"
+ "${ONIGMO_SOURCE_DIR}/enc/iso8859_10.c"
+ "${ONIGMO_SOURCE_DIR}/enc/iso8859_11.c"
+ "${ONIGMO_SOURCE_DIR}/enc/iso8859_13.c"
+ "${ONIGMO_SOURCE_DIR}/enc/iso8859_14.c"
+ "${ONIGMO_SOURCE_DIR}/enc/iso8859_15.c"
+ "${ONIGMO_SOURCE_DIR}/enc/iso8859_16.c"
+ "${ONIGMO_SOURCE_DIR}/enc/euc_tw.c"
+ "${ONIGMO_SOURCE_DIR}/enc/euc_kr.c"
+ "${ONIGMO_SOURCE_DIR}/enc/big5.c"
+ "${ONIGMO_SOURCE_DIR}/enc/gb18030.c"
+ "${ONIGMO_SOURCE_DIR}/enc/koi8_r.c"
+ "${ONIGMO_SOURCE_DIR}/enc/cp1251.c"
+ )
+
+ add_library(onigmo STATIC ${ONIGMO_SOURCES})
+ set_source_files_properties(${ONIGMO_SOURCES}
+ PROPERTIES
+ COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS}")
+ set_target_properties(
+ onigmo
+ PROPERTIES
+ POSITION_INDEPENDENT_CODE ON)
+endif()
diff --git a/storage/mroonga/vendor/groonga/vendor/onigmo/Makefile.am b/storage/mroonga/vendor/groonga/vendor/onigmo/Makefile.am
index 772bfb420c6..73632ebd3bd 100644
--- a/storage/mroonga/vendor/groonga/vendor/onigmo/Makefile.am
+++ b/storage/mroonga/vendor/groonga/vendor/onigmo/Makefile.am
@@ -1,19 +1,17 @@
EXTRA_DIST = \
- configure
+ configure \
+ CMakeLists.txt
CONFIGURE_DEPENDENCIES = \
configure
-ALL_DEPEND_TARGETS =
-INSTALL_DEPEND_TARGETS =
-CLEAN_DEPEND_TARGETS =
-if WITH_MRUBY
-ALL_DEPEND_TARGETS += onigmo-all
+ALL_DEPEND_TARGETS = onigmo-all
+CLEAN_DEPEND_TARGETS = onigmo-clean
+
+INSTALL_DEPEND_TARGETS = onigmo-all
if WITH_SHARED_ONIGMO
INSTALL_DEPEND_TARGETS += onigmo-install
endif
-CLEAN_DEPEND_TARGETS += onigmo-clean
-endif
onigmo-all:
cd ../onigmo-source && $(MAKE) all
diff --git a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/AUTHORS b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/AUTHORS
deleted file mode 100644
index 95053dbcb47..00000000000
--- a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/AUTHORS
+++ /dev/null
@@ -1 +0,0 @@
-See README.md.
diff --git a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/CMakeLists.txt b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/CMakeLists.txt
index 484a7d63bfd..3577572a9f1 100644
--- a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/CMakeLists.txt
+++ b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright(C) 2013 Kouhei Sutou <kou@clear-code.com>
+# Copyright(C) 2013-2015 Kouhei Sutou <kou@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
@@ -18,6 +18,16 @@
cmake_minimum_required(VERSION 2.6)
project(groonga-normalizer-mysql)
+if(DEFINED GROONGA_NORMALIZER_MYSQL_EMBED)
+ set(GROONGA_NORMALIZER_MYSQL_EMBED_DEFAULT
+ ${GROONGA_NORMALIZER_MYSQL_EMBED})
+else()
+ set(GROONGA_NORMALIZER_MYSQL_EMBED_DEFAULT OFF)
+endif()
+option(GROONGA_NORMALIZER_MYSQL_EMBED
+ "Build as a static library to embed into an application"
+ ${GROONGA_NORMALIZER_MYSQL_EMBED_DEFAULT})
+
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/version" VERSION)
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
@@ -53,12 +63,11 @@ link_directories(
add_subdirectory(normalizers)
-configure_file(
- groonga-normalizer-mysql.pc.in
- "${CMAKE_CURRENT_BINARY_DIR}/groonga-normalizer-mysql.pc"
- @ONLY)
-
-if(NOT GROONGA_NORMALIZER_MYSQL_FOUND)
+if(NOT GROONGA_NORMALIZER_MYSQL_EMBED)
+ configure_file(
+ groonga-normalizer-mysql.pc.in
+ "${CMAKE_CURRENT_BINARY_DIR}/groonga-normalizer-mysql.pc"
+ @ONLY)
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/groonga-normalizer-mysql.pc"
DESTINATION "lib/pkgconfig/")
diff --git a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/INSTALL b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/INSTALL
deleted file mode 100644
index 95053dbcb47..00000000000
--- a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/INSTALL
+++ /dev/null
@@ -1 +0,0 @@
-See README.md.
diff --git a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/NEWS b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/NEWS
deleted file mode 100644
index a4685347e88..00000000000
--- a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/NEWS
+++ /dev/null
@@ -1 +0,0 @@
-See doc/text/news.md.
diff --git a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/README b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/README
deleted file mode 100644
index 95053dbcb47..00000000000
--- a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/README
+++ /dev/null
@@ -1 +0,0 @@
-See README.md.
diff --git a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/README.md b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/README.md
index 866aba84d40..fae74b6ce13 100644
--- a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/README.md
+++ b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/README.md
@@ -6,21 +6,31 @@ groonga-normalizer-mysql
## Description
-Groonga-normalizer-mysql is a groonga plugin. It provides MySQL
-compatible normalizers and a custom normalizer to groonga.
+Groonga-normalizer-mysql is a Groonga plugin. It provides MySQL
+compatible normalizers and a custom normalizers to Groonga.
-MySQL compatible normalizers are `NormalizerMySQLGeneralCI` and
-`NormalizerMySQLUnicodeCI`. `NormalizerMySQLGeneralCI` corresponds to
-`utf8mb4_general_ci`. `NormalizerMySQLUnicodeCI` corresponds to
-`utf8mb4_unicode_ci`.
+Here are MySQL compatible normalizers:
-A custom normalizer is
-`NormalizerMySQLUnicodeCIExceptKanaCIKanaWithVoicedSoundMark`. It is
-self-descriptive name but long. It is a variant normalizer of
-`NormalizerMySQLUnicode`. It has different behaviors. The followings
-are the different behaviors.
+* `NormalizerMySQLGeneralCI` for `utf8mb4_general_ci`
+* `NormalizerMySQLUnicodeCI` for `utf8mb4_unicode_ci`
+* `NormalizerMySQLUnicode520CI` for `utf8mb4_unicode_520_ci`
-* `NormalizerMySQLUnicode` normalizes all small Hiragana such as `ã`,
+Here are custom normalizers:
+
+* `NormalizerMySQLUnicodeCIExceptKanaCIKanaWithVoicedSoundMark`
+ * It's based on `NormalizerMySQLUnicodeCI`
+* `NormalizerMySQLUnicode520CIExceptKanaCIKanaWithVoicedSoundMark`
+ * It's based on `NormalizerMySQLUnicode520CI`
+
+They are self-descriptive name but long. They are variant normalizers
+of `NormalizerMySQLUnicodeCI` and `NormalizerMySQLUnicode520CI`. They
+have different behaviors. The followings are the different
+behaviors. They describes with
+`NormalizerMySQLUnicodeCIExceptKanaCIKanaWithVoicedSoundMark` but they
+are true for
+`NormalizerMySQLUnicode520CIExceptKanaCIKanaWithVoicedSoundMark`.
+
+* `NormalizerMySQLUnicodeCI` normalizes all small Hiragana such as `ã`,
`ã£` to Hiragana such as `ã‚`, `ã¤`.
`NormalizerMySQLUnicodeCIExceptKanaCIKanaWithVoicedSoundMark`
doesn't normalize `ã` to `ã‚` nor `ã£` to `ã¤`. `ã` and `ã‚` are
@@ -51,29 +61,29 @@ are the different behaviors.
normalizes all halfwidth Katakana with voided sound mark such as `ガ`
to fullwidth Katakana with voiced sound mark such as `ガ`.
-`NormalizerMySQLUnicodeCIExceptKanaCIKanaWithVoicedSoundMark` is MySQL
-incompatible normalizer but it is useful for Japanese text. For
-example, `ãµã‚‰ã¤ã` and `ブラック` has different
-means. `NormalizerMySQLUnicodeCI` identifies `ãµã‚‰ã¤ã` with `ブラック
-` but `NormalizerMySQLUnicodeCIExceptKanaCIKanaWithVoicedSoundMark
+`NormalizerMySQLUnicodeCIExceptKanaCIKanaWithVoicedSoundMark` and
+`NormalizerMySQLUnicode520CIExceptKanaCIKanaWithVoicedSoundMark` and
+are MySQL incompatible normalizers but they are useful for Japanese
+text. For example, `ãµã‚‰ã¤ã` and `ブラック` has different
+means. `NormalizerMySQLUnicodeCI` identifies `ãµã‚‰ã¤ã` with `ブラック`
+but `NormalizerMySQLUnicodeCIExceptKanaCIKanaWithVoicedSoundMark`
doesn't identify them.
## Install
### Debian GNU/Linux
-[Add apt-line for the groonga deb package repository](http://groonga.org/docs/install/debian.html)
+[Add apt-line for the Groonga deb package repository](http://groonga.org/docs/install/debian.html)
and install `groonga-normalizer-mysql` package:
- % sudo aptitude -V -D -y install groonga-normalizer-mysql
+ % sudo apt-get -y install groonga-normalizer-mysql
### Ubuntu
-[Add apt-line for the groonga deb package repository](http://groonga.org/docs/install/ubuntu.html)
+[Add apt-line for the Groonga deb package repository](http://groonga.org/docs/install/ubuntu.html)
and install `groonga-normalizer-mysql` package:
- % sudo aptitude -V -D -y install groonga-normalizer-mysql
-
+ % sudo apt-get -y install groonga-normalizer-mysql
### CentOS
@@ -114,18 +124,18 @@ Install the following build tools:
* [Microsoft Visual Studio 2010 Express](http://www.microsoft.com/japan/msdn/vstudio/express/): 2012 isn't tested yet.
* [CMake](http://www.cmake.org/)
-#### Build groonga
+#### Build Groonga
-Download the latest groonga source from [packages.groonga.org](http://packages.groonga.org/source/groonga/). Source file name is formatted as `groonga-X.Y.Z.zip`.
+Download the latest Groonga source from [packages.groonga.org](http://packages.groonga.org/source/groonga/). Source file name is formatted as `groonga-X.Y.Z.zip`.
Extract the source and move to the source folder:
> cd ...\groonga-X.Y.Z
groonga-X.Y.Z>
-Run CMake. Here is a command line to install groonga to `C:\groonga` folder:
+Run CMake. Here is a command line to install Groonga to `C:\groonga` folder:
- groonga-X.Y.Z> cmake . -G "Visual Studio 10 Win64" -DCMAKE_INSTALL_PREFIX=C:\groonga
+ groonga-X.Y.Z> cmake . -G "Visual Studio 12 Win64" -DCMAKE_INSTALL_PREFIX=C:\groonga
Build:
@@ -148,9 +158,9 @@ IMPORTANT!!!: Set `PKG_CONFIG_PATH` environment variable:
groonga-normalizer-mysql-X.Y.Z> set PKG_CONFIG_PATH=C:\groongalocal\lib\pkgconfig
-Run CMake. Here is a command line to install groonga to `C:\groonga` folder:
+Run CMake. Here is a command line to install Groonga to `C:\groonga` folder:
- groonga-normalizer-mysql-X.Y.Z> cmake . -G "Visual Studio 10 Win64" -DCMAKE_INSTALL_PREFIX=C:\groonga
+ groonga-normalizer-mysql-X.Y.Z> cmake . -G "Visual Studio 12 Win64" -DCMAKE_INSTALL_PREFIX=C:\groonga
Build:
@@ -173,7 +183,7 @@ Then, you can use `NormalizerMySQLGeneralCI` and
## Dependencies
-* groonga >= 3.0.3
+* Groonga >= 3.0.3
## Mailing list
diff --git a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/configure.ac b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/configure.ac
index effb5884f93..fd52203837e 100644
--- a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/configure.ac
+++ b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/configure.ac
@@ -1,4 +1,4 @@
-# Copyright (C) 2013 Kouhei Sutou <kou@clear-code.com>
+# Copyright (C) 2013-2015 Kouhei Sutou <kou@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
@@ -24,7 +24,7 @@ AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([normalizers/mysql.c])
AM_CONFIG_HEADER([config.h])
-AM_INIT_AUTOMAKE([1.9 tar-pax])
+AM_INIT_AUTOMAKE([1.9 foreign tar-pax])
AC_PROG_LIBTOOL
@@ -49,11 +49,23 @@ AC_SUBST(GROONGA)
normalizers_pluginsdir="\${GROONGA_PLUGINS_DIR}/normalizers"
AC_SUBST(normalizers_pluginsdir)
+AC_ARG_ENABLE([embed],
+ AS_HELP_STRING([--enable-embed],
+ [Build as a static library to embed into an application (default: no)]),
+ [GROONGA_NORMALIZER_MYSQL_EMBED="$enableval"],
+ [GROONGA_NORMALIZER_MYSQL_EMBED="no"])
+
+if test "x$GROONGA_NORMALIZER_MYSQL_EMBED" = "xyes"; then
+ AC_DEFINE_UNQUOTED(GROONGA_NORMALIZER_MYSQL_EMBED,
+ [1],
+ [Define to 1 if groonga-normalizer-mysql is built for embedding.])
+fi
+
# check Ruby for test
ac_cv_ruby_available="no"
-AC_ARG_WITH([ruby19],
- AS_HELP_STRING([--with-ruby19=PATH],
- [Ruby 1.9 interpreter path (default: auto)]),
+AC_ARG_WITH([ruby],
+ AS_HELP_STRING([--with-ruby=PATH],
+ [Ruby interpreter path (default: auto)]),
[RUBY="$withval"],
[RUBY="auto"])
@@ -61,17 +73,19 @@ if test "x$RUBY" = "xno"; then
RUBY=
else
if test "x$RUBY" = "xauto"; then
- AC_PATH_PROGS(RUBY, [ruby1.9 ruby19 ruby1.9.1 ruby], ruby19-not-found)
- if test "$RUBY" != "ruby19-not-found"; then
+ AC_PATH_PROGS(RUBY,
+ [ruby2.1 ruby21 ruby2.0 ruby20 ruby1.9 ruby19 ruby1.9.1 ruby],
+ ruby-not-found)
+ if test "$RUBY" != "ruby-not-found"; then
ruby_version="`$RUBY --version`"
- if echo "$ruby_version" | grep -q -- 'ruby 1\.9'; then
+ if echo "$ruby_version" | grep -q -- 'ruby \(1\.9\|2\.\)'; then
ac_cv_ruby_available="yes"
else
- AC_MSG_WARN([$RUBY isn't Ruby 1.9 ($ruby_version)])
+ AC_MSG_WARN([$RUBY isn't Ruby 1.9 or later ($ruby_version)])
fi
fi
else
- ruby_not_found_warning_message="$RUBY is not found. Disable HTTP test."
+ ruby_not_found_warning_message="$RUBY is not found. Disable test."
case "$RUBY" in
/*)
AC_CHECK_FILE([$RUBY],
@@ -97,7 +111,7 @@ AM_CONDITIONAL([WITH_TEST], [test "$ac_cv_ruby_available" = "yes"])
# For package
AC_ARG_WITH(rsync-path,
[AS_HELP_STRING([--with-rsync-path=PATH],
- [specify rsync path to upload groonga packages.])],
+ [specify rsync path to upload Groonga packages.])],
[RSYNC_PATH="$withval"],
[RSYNC_PATH="packages@packages.groonga.org:public"])
AC_SUBST(RSYNC_PATH)
@@ -174,7 +188,7 @@ echo " CFLAGS: ${CFLAGS}"
echo " CXXFLAGS: ${CXXFLAGS}"
echo " Libraries: ${LIBS}"
echo
-echo "groonga"
+echo "Groonga"
echo " CFLAGS: ${GROONGA_CFLAGS}"
echo " Libraries: ${GROONGA_LIBS}"
echo " install directory: ${normalizers_pluginsdir}"
diff --git a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/doc/text/Makefile.am b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/doc/text/Makefile.am
index 52dbe4a8f0d..6adf4f103e9 100644
--- a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/doc/text/Makefile.am
+++ b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/doc/text/Makefile.am
@@ -1,4 +1,4 @@
-# Copyright (C) 2013 Kouhei Sutou <kou@clear-code.com>
+# Copyright (C) 2013-2015 Kouhei Sutou <kou@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
@@ -16,4 +16,5 @@
docdir = $(datadir)/doc/$(PACKAGE)
dist_doc_DATA = \
- lgpl-2.0.txt
+ lgpl-2.0.txt \
+ news.md
diff --git a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/doc/text/news.md b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/doc/text/news.md
new file mode 100644
index 00000000000..22a7fdb17cf
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/doc/text/news.md
@@ -0,0 +1,19 @@
+# News
+
+## 1.0.9: 2015-03-29
+
+### Improves
+
+ * Added `NormalizerMySQLUnicode520CI`
+ * Added `NormalizerMySQLUnicode520CIExceptKanaCIKanaWithVoicedSoundMark`
+
+## 1.0.8: 2015-02-10
+
+### Fixes
+
+ * Fix registering error when you build with configure.
+ [GitHub#3][Reported by Kazuhiko]
+
+### Thanks
+
+ * Kazuhiko
diff --git a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/CMakeLists.txt b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/CMakeLists.txt
index ae290b66347..db8ffedb082 100644
--- a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/CMakeLists.txt
+++ b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright(C) 2013 Kouhei Sutou <kou@clear-code.com>
+# Copyright(C) 2013-2015 Kouhei Sutou <kou@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
@@ -17,11 +17,15 @@
set(NORMALIZERS_DIR "${GROONGA_PLUGINS_DIR}/normalizers")
read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/mysql_sources.am MYSQL_SOURCES)
-add_library(mysql_normalizer MODULE ${MYSQL_SOURCES})
-set_target_properties(mysql_normalizer PROPERTIES
- PREFIX ""
- OUTPUT_NAME "mysql")
-target_link_libraries(mysql_normalizer ${GROONGA_LIBRARIES})
-if(NOT MRN_GROONGA_BUNDLED)
+if(GROONGA_NORMALIZER_MYSQL_EMBED)
+ add_convenience_library(mysql_normalizer ${MYSQL_SOURCES})
+ set_property(TARGET mysql_normalizer APPEND PROPERTY
+ COMPILE_DEFINITIONS "GROONGA_NORMALIZER_MYSQL_EMBED")
+else()
+ add_library(mysql_normalizer MODULE ${MYSQL_SOURCES})
+ set_target_properties(mysql_normalizer PROPERTIES
+ PREFIX ""
+ OUTPUT_NAME "mysql")
install(TARGETS mysql_normalizer DESTINATION "${NORMALIZERS_DIR}")
endif()
+target_link_libraries(mysql_normalizer ${GROONGA_LIBRARIES})
diff --git a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/Makefile.am b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/Makefile.am
index c5c131ce2af..64cfe6552fa 100644
--- a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/Makefile.am
+++ b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/Makefile.am
@@ -39,10 +39,12 @@ ensure-mysql-source-dir:
exit 1; \
fi
-UPDATE_TABLES_TARGETS = \
- update-general-ci-table \
- update-unicode-ci-table \
- update-unicode-ci-except-kana-ci-kana-with-voiced-sound-mark-table
+UPDATE_TABLES_TARGETS = \
+ update-general-ci-table \
+ update-unicode-ci-table \
+ update-unicode-ci-except-kana-ci-kana-with-voiced-sound-mark-table \
+ update-unicode-520-ci-table \
+ update-unicode-520-ci-except-kana-ci-kana-with-voiced-sound-mark-table
update-tables: $(UPDATE_TABLES_TARGETS)
@@ -67,3 +69,22 @@ update-unicode-ci-except-kana-ci-kana-with-voiced-sound-mark-table: ensure-mysql
--suffix _except_kana_ci_kana_with_voiced_sound_mark \
$(MYSQL_SOURCE_DIR)/strings/ctype-uca.c > \
$(srcdir)/mysql_unicode_ci_except_kana_ci_kana_with_voiced_sound_mark_table.h
+
+update-unicode-520-ci-table: ensure-mysql-source-dir
+ $(RUBY) \
+ $(top_srcdir)/tool/generate_uca_table.rb \
+ --version=520 \
+ $(MYSQL_SOURCE_DIR)/strings/ctype-uca.c > \
+ $(srcdir)/mysql_unicode_520_ci_table.h
+
+update-unicode-520-ci-except-kana-ci-kana-with-voiced-sound-mark-table: ensure-mysql-source-dir
+ $(RUBY) \
+ $(top_srcdir)/tool/generate_uca_table.rb \
+ --version=520 \
+ --split-small-kana \
+ --split-kana-with-voiced-sound-mark \
+ --split-kana-with-semi-voiced-sound-mark \
+ --suffix _except_kana_ci_kana_with_voiced_sound_mark \
+ $(MYSQL_SOURCE_DIR)/strings/ctype-uca.c > \
+ $(srcdir)/mysql_unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_table.h
+
diff --git a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql.c b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql.c
index 94acfb16389..c7eb102d0e1 100644
--- a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql.c
+++ b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql.c
@@ -1,6 +1,6 @@
/* -*- c-basic-offset: 2 -*- */
/*
- Copyright(C) 2013-2014 Kouhei Sutou <kou@clear-code.com>
+ Copyright(C) 2013-2015 Kouhei Sutou <kou@clear-code.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -18,6 +18,14 @@
MA 02110-1301, USA
*/
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#ifdef GROONGA_NORMALIZER_MYSQL_EMBED
+# define GRN_PLUGIN_FUNCTION_TAG normalizers_mysql
+#endif
+
#include <groonga/normalizer.h>
#include <groonga/nfkc.h>
@@ -27,6 +35,8 @@
#include "mysql_general_ci_table.h"
#include "mysql_unicode_ci_table.h"
#include "mysql_unicode_ci_except_kana_ci_kana_with_voiced_sound_mark_table.h"
+#include "mysql_unicode_520_ci_table.h"
+#include "mysql_unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_table.h"
#ifdef __GNUC__
# define GNUC_UNUSED __attribute__((__unused__))
@@ -147,7 +157,7 @@ utf8_to_unichar(const char *utf8, int byte_size)
static inline void
decompose_character(const char *rest, int character_length,
- int *page, uint32_t *low_code)
+ size_t *page, uint32_t *low_code)
{
switch (character_length) {
case 1 :
@@ -167,10 +177,27 @@ decompose_character(const char *rest, int character_length,
((rest[0] & 0x07) << 10) +
((rest[1] & 0x3f) << 4) +
((rest[2] & 0x3c) >> 2);
- *low_code = ((rest[1] & 0x03) << 6) + (rest[2] & 0x3f);
+ *low_code = ((rest[2] & 0x03) << 6) + (rest[3] & 0x3f);
+ break;
+ case 5 :
+ *page =
+ ((rest[0] & 0x03) << 16) +
+ ((rest[1] & 0x3f) << 10) +
+ ((rest[2] & 0x3f) << 4) +
+ ((rest[3] & 0x3c) >> 2);
+ *low_code = ((rest[3] & 0x03) << 6) + (rest[4] & 0x3f);
+ break;
+ case 6 :
+ *page =
+ ((rest[0] & 0x01) << 22) +
+ ((rest[1] & 0x3f) << 16) +
+ ((rest[2] & 0x3f) << 10) +
+ ((rest[3] & 0x3f) << 4) +
+ ((rest[4] & 0x3c) >> 2);
+ *low_code = ((rest[4] & 0x03) << 6) + (rest[5] & 0x3f);
break;
default :
- *page = -1;
+ *page = (size_t)-1;
*low_code = 0x00;
break;
}
@@ -179,15 +206,16 @@ decompose_character(const char *rest, int character_length,
static inline void
normalize_character(const char *utf8, int character_length,
uint32_t **normalize_table,
+ size_t normalize_table_size,
char *normalized,
unsigned int *normalized_character_length,
unsigned int *normalized_length_in_bytes,
unsigned int *normalized_n_characters)
{
- int page;
+ size_t page;
uint32_t low_code;
decompose_character(utf8, character_length, &page, &low_code);
- if ((0x00 <= page && page <= 0xff) && normalize_table[page]) {
+ if (page < normalize_table_size && normalize_table[page]) {
uint32_t normalized_code;
unsigned int n_bytes;
normalized_code = normalize_table[page][low_code];
@@ -296,6 +324,7 @@ static void
normalize(grn_ctx *ctx, grn_obj *string,
const char *normalizer_type_label,
uint32_t **normalize_table,
+ size_t normalize_table_size,
normalizer_func custom_normalizer)
{
const char *original, *rest;
@@ -363,7 +392,8 @@ normalize(grn_ctx *ctx, grn_obj *string,
&normalized_n_characters);
}
if (!custom_normalized) {
- normalize_character(rest, character_length, normalize_table,
+ normalize_character(rest, character_length,
+ normalize_table, normalize_table_size,
normalized,
&normalized_character_length,
&normalized_length_in_bytes,
@@ -440,7 +470,9 @@ mysql_general_ci_next(GNUC_UNUSED grn_ctx *ctx,
grn_encoding_to_string(encoding));
return NULL;
}
- normalize(ctx, string, normalizer_type_label, general_ci_table, NULL);
+ normalize(ctx, string, normalizer_type_label,
+ general_ci_table, sizeof(general_ci_table) / sizeof(uint32_t *),
+ NULL);
return NULL;
}
@@ -464,7 +496,9 @@ mysql_unicode_ci_next(GNUC_UNUSED grn_ctx *ctx,
grn_encoding_to_string(encoding));
return NULL;
}
- normalize(ctx, string, normalizer_type_label, unicode_ci_table, NULL);
+ normalize(ctx, string, normalizer_type_label,
+ unicode_ci_table, sizeof(unicode_ci_table) / sizeof(uint32_t *),
+ NULL);
return NULL;
}
@@ -630,6 +664,64 @@ mysql_unicode_ci_except_kana_ci_kana_with_voiced_sound_mark_next(
normalize(ctx, string,
normalizer_type_label,
unicode_ci_except_kana_ci_kana_with_voiced_sound_mark_table,
+ sizeof(unicode_ci_except_kana_ci_kana_with_voiced_sound_mark_table) / sizeof(uint32_t *),
+ normalize_halfwidth_katakana_with_voiced_sound_mark);
+ return NULL;
+}
+
+static grn_obj *
+mysql_unicode_520_ci_next(GNUC_UNUSED grn_ctx *ctx,
+ GNUC_UNUSED int nargs,
+ grn_obj **args,
+ GNUC_UNUSED grn_user_data *user_data)
+{
+ grn_obj *string = args[0];
+ grn_encoding encoding;
+ const char *normalizer_type_label = "mysql-unicode-520-ci";
+
+ encoding = grn_string_get_encoding(ctx, string);
+ if (encoding != GRN_ENC_UTF8) {
+ GRN_PLUGIN_ERROR(ctx,
+ GRN_FUNCTION_NOT_IMPLEMENTED,
+ "[normalizer][%s] "
+ "UTF-8 encoding is only supported: %s",
+ normalizer_type_label,
+ grn_encoding_to_string(encoding));
+ return NULL;
+ }
+ normalize(ctx, string, normalizer_type_label,
+ unicode_520_ci_table,
+ sizeof(unicode_520_ci_table) / sizeof(uint32_t *),
+ NULL);
+ return NULL;
+}
+
+static grn_obj *
+mysql_unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_next(
+ GNUC_UNUSED grn_ctx *ctx,
+ GNUC_UNUSED int nargs,
+ grn_obj **args,
+ GNUC_UNUSED grn_user_data *user_data)
+{
+ grn_obj *string = args[0];
+ grn_encoding encoding;
+ const char *normalizer_type_label =
+ "mysql-unicode-520-ci-except-kana-ci-kana-with-voiced-sound-mark";
+
+ encoding = grn_string_get_encoding(ctx, string);
+ if (encoding != GRN_ENC_UTF8) {
+ GRN_PLUGIN_ERROR(ctx,
+ GRN_FUNCTION_NOT_IMPLEMENTED,
+ "[normalizer][%s] "
+ "UTF-8 encoding is only supported: %s",
+ normalizer_type_label,
+ grn_encoding_to_string(encoding));
+ return NULL;
+ }
+ normalize(ctx, string,
+ normalizer_type_label,
+ unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_table,
+ sizeof(unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_table) / sizeof(uint32_t *),
normalize_halfwidth_katakana_with_voiced_sound_mark);
return NULL;
}
@@ -656,6 +748,17 @@ GRN_PLUGIN_REGISTER(grn_ctx *ctx)
NULL,
mysql_unicode_ci_except_kana_ci_kana_with_voiced_sound_mark_next,
NULL);
+ grn_normalizer_register(ctx, "NormalizerMySQLUnicode520CI", -1,
+ NULL, mysql_unicode_520_ci_next, NULL);
+ grn_normalizer_register(ctx,
+ "NormalizerMySQLUnicode520CI"
+ "Except"
+ "KanaCI"
+ "KanaWithVoicedSoundMark",
+ -1,
+ NULL,
+ mysql_unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_next,
+ NULL);
return GRN_SUCCESS;
}
diff --git a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql_general_ci_table.h b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql_general_ci_table.h
index 15ed558e2dc..a84e449910d 100644
--- a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql_general_ci_table.h
+++ b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql_general_ci_table.h
@@ -17,7 +17,7 @@
MA 02110-1301, USA
This file uses normalization table defined in
- mysql-5.5.29/strings/ctype-utf8.c.
+ mysql-5.6.23/strings/ctype-utf8.c.
The following is the header of the file:
Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
diff --git a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql_sources.am b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql_sources.am
index 6f1d9b02018..07f30b30f5b 100644
--- a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql_sources.am
+++ b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql_sources.am
@@ -1,5 +1,7 @@
-mysql_la_SOURCES = \
- mysql.c \
- mysql_general_ci_table.h \
- mysql_unicode_ci_table.h \
- mysql_unicode_ci_except_kana_ci_kana_with_voiced_sound_mark_table.h
+mysql_la_SOURCES = \
+ mysql.c \
+ mysql_general_ci_table.h \
+ mysql_unicode_ci_table.h \
+ mysql_unicode_ci_except_kana_ci_kana_with_voiced_sound_mark_table.h \
+ mysql_unicode_520_ci_table.h \
+ mysql_unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_table.h
diff --git a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql_unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_table.h b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql_unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_table.h
new file mode 100644
index 00000000000..6832d3a3b66
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql_unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_table.h
@@ -0,0 +1,5028 @@
+/*
+ Copyright(C) 2013-2015 Kouhei Sutou <kou@clear-code.com>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; version 2
+ of the License.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ MA 02110-1301, USA
+
+ This file uses normalization table defined in
+ mysql-5.6.23/strings/ctype-uca.c.
+ The following is the header of the file:
+
+ Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; version 2
+ of the License.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ MA 02110-1301, USA
+
+ UCA (Unicode Collation Algorithm) support.
+ Written by Alexander Barkov <bar@mysql.com>
+*/
+
+#ifndef MYSQL_UCA_520_EXCEPT_KANA_CI_KANA_WITH_VOICED_SOUND_MARK_H
+#define MYSQL_UCA_520_EXCEPT_KANA_CI_KANA_WITH_VOICED_SOUND_MARK_H
+
+#include <stdint.h>
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_00[] = {
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00009, 0x0000a, 0x0000b, 0x0000c, 0x0000d, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00020, 0x00021, 0x00022, 0x00023, 0x00024, 0x00025, 0x00026, 0x00027,
+ 0x00028, 0x00029, 0x0002a, 0x0002b, 0x0002c, 0x0002d, 0x0002e, 0x0002f,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x0003a, 0x0003b, 0x0003c, 0x0003d, 0x0003e, 0x0003f,
+ 0x00040, 0x00041, 0x00042, 0x00043, 0x00044, 0x00045, 0x00046, 0x00047,
+ 0x00048, 0x00049, 0x0004a, 0x0004b, 0x0004c, 0x0004d, 0x0004e, 0x0004f,
+ 0x00050, 0x00051, 0x00052, 0x00053, 0x00054, 0x00055, 0x00056, 0x00057,
+ 0x00058, 0x00059, 0x0005a, 0x0005b, 0x0005c, 0x0005d, 0x0005e, 0x0005f,
+ 0x00060, 0x00041, 0x00042, 0x00043, 0x00044, 0x00045, 0x00046, 0x00047,
+ 0x00048, 0x00049, 0x0004a, 0x0004b, 0x0004c, 0x0004d, 0x0004e, 0x0004f,
+ 0x00050, 0x00051, 0x00052, 0x00053, 0x00054, 0x00055, 0x00056, 0x00057,
+ 0x00058, 0x00059, 0x0005a, 0x0007b, 0x0007c, 0x0007d, 0x0007e, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00085, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00020, 0x000a1, 0x000a2, 0x000a3, 0x000a4, 0x000a5, 0x000a6, 0x000a7,
+ 0x000a8, 0x000a9, 0x00041, 0x000ab, 0x000ac, 0x000ad, 0x000ae, 0x000af,
+ 0x000b0, 0x000b1, 0x00032, 0x00033, 0x000b4, 0x0039c, 0x000b6, 0x000b7,
+ 0x000b8, 0x00031, 0x0004f, 0x000bb, 0x000bc, 0x000bd, 0x000be, 0x000bf,
+ 0x00041, 0x00041, 0x00041, 0x00041, 0x00041, 0x00041, 0x000c6, 0x00043,
+ 0x00045, 0x00045, 0x00045, 0x00045, 0x00049, 0x00049, 0x00049, 0x00049,
+ 0x00044, 0x0004e, 0x0004f, 0x0004f, 0x0004f, 0x0004f, 0x0004f, 0x000d7,
+ 0x0004f, 0x00055, 0x00055, 0x00055, 0x00055, 0x00059, 0x000de, 0x000df,
+ 0x00041, 0x00041, 0x00041, 0x00041, 0x00041, 0x00041, 0x000c6, 0x00043,
+ 0x00045, 0x00045, 0x00045, 0x00045, 0x00049, 0x00049, 0x00049, 0x00049,
+ 0x00044, 0x0004e, 0x0004f, 0x0004f, 0x0004f, 0x0004f, 0x0004f, 0x000f7,
+ 0x0004f, 0x00055, 0x00055, 0x00055, 0x00055, 0x00059, 0x000fe, 0x000ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_01[] = {
+ 0x00041, 0x00041, 0x00041, 0x00041, 0x00041, 0x00041, 0x00043, 0x00043,
+ 0x00043, 0x00043, 0x00043, 0x00043, 0x00043, 0x00043, 0x00044, 0x00044,
+ 0x00044, 0x00044, 0x00045, 0x00045, 0x00045, 0x00045, 0x00045, 0x00045,
+ 0x00045, 0x00045, 0x00045, 0x00045, 0x00047, 0x00047, 0x00047, 0x00047,
+ 0x00047, 0x00047, 0x00047, 0x00047, 0x00048, 0x00048, 0x00048, 0x00048,
+ 0x00049, 0x00049, 0x00049, 0x00049, 0x00049, 0x00049, 0x00049, 0x00049,
+ 0x00049, 0x00131, 0x00132, 0x00132, 0x0004a, 0x0004a, 0x0004b, 0x0004b,
+ 0x00138, 0x0004c, 0x0004c, 0x0004c, 0x0004c, 0x0004c, 0x0004c, 0x0004c,
+ 0x0004c, 0x0004c, 0x0004c, 0x0004e, 0x0004e, 0x0004e, 0x0004e, 0x0004e,
+ 0x0004e, 0x00149, 0x0014a, 0x0014a, 0x0004f, 0x0004f, 0x0004f, 0x0004f,
+ 0x0004f, 0x0004f, 0x00152, 0x00152, 0x00052, 0x00052, 0x00052, 0x00052,
+ 0x00052, 0x00052, 0x00053, 0x00053, 0x00053, 0x00053, 0x00053, 0x00053,
+ 0x00053, 0x00053, 0x00054, 0x00054, 0x00054, 0x00054, 0x00166, 0x00166,
+ 0x00055, 0x00055, 0x00055, 0x00055, 0x00055, 0x00055, 0x00055, 0x00055,
+ 0x00055, 0x00055, 0x00055, 0x00055, 0x00057, 0x00057, 0x00059, 0x00059,
+ 0x00059, 0x0005a, 0x0005a, 0x0005a, 0x0005a, 0x0005a, 0x0005a, 0x00053,
+ 0x00180, 0x00181, 0x00182, 0x00182, 0x00184, 0x00184, 0x00186, 0x00187,
+ 0x00187, 0x00189, 0x0018a, 0x0018b, 0x0018b, 0x0018d, 0x0018e, 0x0018f,
+ 0x00190, 0x00191, 0x00191, 0x00193, 0x00194, 0x00195, 0x00196, 0x00197,
+ 0x00198, 0x00198, 0x0019a, 0x0019b, 0x0019c, 0x0019d, 0x0019e, 0x0019f,
+ 0x0004f, 0x0004f, 0x001a2, 0x001a2, 0x001a4, 0x001a4, 0x001a6, 0x001a7,
+ 0x001a7, 0x001a9, 0x001aa, 0x001ab, 0x001ac, 0x001ac, 0x001ae, 0x00055,
+ 0x00055, 0x001b1, 0x001b2, 0x001b3, 0x001b3, 0x001b5, 0x001b5, 0x001b7,
+ 0x001b8, 0x001b8, 0x001ba, 0x001bb, 0x001bc, 0x001bc, 0x001be, 0x001bf,
+ 0x001c0, 0x001c1, 0x001c2, 0x001c3, 0x001c4, 0x001c4, 0x001c4, 0x001c7,
+ 0x001c7, 0x001c7, 0x001ca, 0x001ca, 0x001ca, 0x00041, 0x00041, 0x00049,
+ 0x00049, 0x0004f, 0x0004f, 0x00055, 0x00055, 0x00055, 0x00055, 0x00055,
+ 0x00055, 0x00055, 0x00055, 0x00055, 0x00055, 0x0018e, 0x00041, 0x00041,
+ 0x00041, 0x00041, 0x000c6, 0x000c6, 0x001e4, 0x001e4, 0x00047, 0x00047,
+ 0x0004b, 0x0004b, 0x0004f, 0x0004f, 0x0004f, 0x0004f, 0x001b7, 0x001b7,
+ 0x0004a, 0x001c4, 0x001c4, 0x001c4, 0x00047, 0x00047, 0x00195, 0x001bf,
+ 0x0004e, 0x0004e, 0x00041, 0x00041, 0x000c6, 0x000c6, 0x0004f, 0x001ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_02[] = {
+ 0x00041, 0x00041, 0x00041, 0x00041, 0x00045, 0x00045, 0x00045, 0x00045,
+ 0x00049, 0x00049, 0x00049, 0x00049, 0x0004f, 0x0004f, 0x0004f, 0x0004f,
+ 0x00052, 0x00052, 0x00052, 0x00052, 0x00055, 0x00055, 0x00055, 0x00055,
+ 0x00053, 0x00053, 0x00054, 0x00054, 0x0021c, 0x0021c, 0x00048, 0x00048,
+ 0x0019e, 0x00221, 0x00222, 0x00222, 0x00224, 0x00224, 0x00041, 0x00041,
+ 0x00045, 0x00045, 0x0004f, 0x0004f, 0x0004f, 0x0004f, 0x0004f, 0x0004f,
+ 0x0004f, 0x0004f, 0x00059, 0x00059, 0x00234, 0x00235, 0x00236, 0x00237,
+ 0x00238, 0x00239, 0x0023a, 0x0023b, 0x0023b, 0x0019a, 0x0023e, 0x0023f,
+ 0x00240, 0x00241, 0x00241, 0x00180, 0x00244, 0x00245, 0x00246, 0x00246,
+ 0x00248, 0x00248, 0x0024a, 0x0024a, 0x0024c, 0x0024c, 0x0024e, 0x0024e,
+ 0x00250, 0x00251, 0x00252, 0x00181, 0x00186, 0x00255, 0x00189, 0x0018a,
+ 0x00258, 0x0018f, 0x0025a, 0x00190, 0x0025c, 0x0025d, 0x0025e, 0x0025f,
+ 0x00193, 0x00261, 0x00262, 0x00194, 0x00264, 0x00265, 0x00266, 0x00267,
+ 0x00197, 0x00196, 0x0026a, 0x0026b, 0x0026c, 0x0026d, 0x0026e, 0x0019c,
+ 0x00270, 0x00271, 0x0019d, 0x00273, 0x00274, 0x0019f, 0x00276, 0x00277,
+ 0x00278, 0x00279, 0x0027a, 0x0027b, 0x0027c, 0x0027d, 0x0027e, 0x0027f,
+ 0x001a6, 0x00281, 0x00282, 0x001a9, 0x00284, 0x00285, 0x00286, 0x00287,
+ 0x001ae, 0x00244, 0x001b1, 0x001b2, 0x00245, 0x0028d, 0x0028e, 0x0028f,
+ 0x00290, 0x00291, 0x001b7, 0x00293, 0x00294, 0x00295, 0x00296, 0x00297,
+ 0x00298, 0x00299, 0x0029a, 0x0029b, 0x0029c, 0x0029d, 0x0029e, 0x0029f,
+ 0x002a0, 0x002a1, 0x002a2, 0x001c4, 0x002a4, 0x002a5, 0x001be, 0x002a7,
+ 0x002a8, 0x002a9, 0x002aa, 0x002ab, 0x002ac, 0x002ad, 0x002ae, 0x002af,
+ 0x00048, 0x00266, 0x0004a, 0x00052, 0x00279, 0x0027b, 0x00281, 0x00057,
+ 0x00059, 0x002b9, 0x002ba, 0x002bb, 0x002bc, 0x002bd, 0x002be, 0x002bf,
+ 0x002c0, 0x002c1, 0x002c2, 0x002c3, 0x002c4, 0x002c5, 0x002c6, 0x002c7,
+ 0x002c8, 0x002c9, 0x002ca, 0x002cb, 0x002cc, 0x002cd, 0x002ce, 0x002cf,
+ 0x002d0, 0x002d1, 0x002d2, 0x002d3, 0x002d4, 0x002d5, 0x002d6, 0x002d7,
+ 0x002d8, 0x002d9, 0x002da, 0x002db, 0x002dc, 0x002dd, 0x002de, 0x002df,
+ 0x00194, 0x0004c, 0x00053, 0x00058, 0x00295, 0x002e5, 0x002e6, 0x002e7,
+ 0x002e8, 0x002e9, 0x002ea, 0x002eb, 0x002ec, 0x002ed, 0x002ee, 0x002ef,
+ 0x002f0, 0x002f1, 0x002f2, 0x002f3, 0x002f4, 0x002f5, 0x002f6, 0x002f7,
+ 0x002f8, 0x002f9, 0x002fa, 0x002fb, 0x002fc, 0x002fd, 0x002fe, 0x002ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_03[] = {
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00041, 0x00045, 0x00049, 0x0004f, 0x00055,
+ 0x00043, 0x00044, 0x00048, 0x0004d, 0x00052, 0x00054, 0x00056, 0x00058,
+ 0x00370, 0x00370, 0x00372, 0x00372, 0x002b9, 0x00375, 0x00376, 0x00376,
+ 0x00378, 0x00379, 0x00399, 0x0037b, 0x0037c, 0x0037d, 0x0003b, 0x0037f,
+ 0x00380, 0x00381, 0x00382, 0x00383, 0x000b4, 0x000a8, 0x00391, 0x000b7,
+ 0x00395, 0x00397, 0x00399, 0x0038b, 0x0039f, 0x0038d, 0x003a5, 0x003a9,
+ 0x00399, 0x00391, 0x00392, 0x00393, 0x00394, 0x00395, 0x00396, 0x00397,
+ 0x00398, 0x00399, 0x0039a, 0x0039b, 0x0039c, 0x0039d, 0x0039e, 0x0039f,
+ 0x003a0, 0x003a1, 0x003a2, 0x003a3, 0x003a4, 0x003a5, 0x003a6, 0x003a7,
+ 0x003a8, 0x003a9, 0x00399, 0x003a5, 0x00391, 0x00395, 0x00397, 0x00399,
+ 0x003a5, 0x00391, 0x00392, 0x00393, 0x00394, 0x00395, 0x00396, 0x00397,
+ 0x00398, 0x00399, 0x0039a, 0x0039b, 0x0039c, 0x0039d, 0x0039e, 0x0039f,
+ 0x003a0, 0x003a1, 0x003a3, 0x003a3, 0x003a4, 0x003a5, 0x003a6, 0x003a7,
+ 0x003a8, 0x003a9, 0x00399, 0x003a5, 0x0039f, 0x003a5, 0x003a9, 0x003cf,
+ 0x00392, 0x00398, 0x003a5, 0x003a5, 0x003a5, 0x003a6, 0x003a0, 0x003cf,
+ 0x003d8, 0x003d8, 0x003da, 0x003da, 0x003dc, 0x003dc, 0x003de, 0x003de,
+ 0x003e0, 0x003e0, 0x003e2, 0x003e2, 0x003e4, 0x003e4, 0x003e6, 0x003e6,
+ 0x003e8, 0x003e8, 0x003ea, 0x003ea, 0x003ec, 0x003ec, 0x003ee, 0x003ee,
+ 0x0039a, 0x003a1, 0x003a3, 0x003f3, 0x00398, 0x00395, 0x003f6, 0x003f7,
+ 0x003f7, 0x003a3, 0x003fa, 0x003fa, 0x003fc, 0x0037b, 0x003fe, 0x003ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_04[] = {
+ 0x00400, 0x00400, 0x00402, 0x00403, 0x00404, 0x00405, 0x00406, 0x00407,
+ 0x00408, 0x00409, 0x0040a, 0x0040b, 0x0040c, 0x0040d, 0x0040e, 0x0040f,
+ 0x00410, 0x00411, 0x00412, 0x00413, 0x00414, 0x00400, 0x00416, 0x00417,
+ 0x0040d, 0x00419, 0x0041a, 0x0041b, 0x0041c, 0x0041d, 0x0041e, 0x0041f,
+ 0x00420, 0x00421, 0x00422, 0x00423, 0x00424, 0x00425, 0x00426, 0x00427,
+ 0x00428, 0x00429, 0x0042a, 0x0042b, 0x0042c, 0x0042d, 0x0042e, 0x0042f,
+ 0x00410, 0x00411, 0x00412, 0x00413, 0x00414, 0x00400, 0x00416, 0x00417,
+ 0x0040d, 0x00419, 0x0041a, 0x0041b, 0x0041c, 0x0041d, 0x0041e, 0x0041f,
+ 0x00420, 0x00421, 0x00422, 0x00423, 0x00424, 0x00425, 0x00426, 0x00427,
+ 0x00428, 0x00429, 0x0042a, 0x0042b, 0x0042c, 0x0042d, 0x0042e, 0x0042f,
+ 0x00400, 0x00400, 0x00402, 0x00403, 0x00404, 0x00405, 0x00406, 0x00407,
+ 0x00408, 0x00409, 0x0040a, 0x0040b, 0x0040c, 0x0040d, 0x0040e, 0x0040f,
+ 0x00460, 0x00460, 0x00462, 0x00462, 0x00464, 0x00464, 0x00466, 0x00466,
+ 0x00468, 0x00468, 0x0046a, 0x0046a, 0x0046c, 0x0046c, 0x0046e, 0x0046e,
+ 0x00470, 0x00470, 0x00472, 0x00472, 0x00474, 0x00474, 0x00476, 0x00476,
+ 0x00478, 0x00478, 0x0047a, 0x0047a, 0x0047c, 0x0047c, 0x0047e, 0x0047e,
+ 0x00480, 0x00480, 0x00482, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x0048a, 0x0048a, 0x0048c, 0x0048c, 0x0048e, 0x0048e,
+ 0x00413, 0x00413, 0x00492, 0x00492, 0x00494, 0x00494, 0x00496, 0x00496,
+ 0x00498, 0x00498, 0x0049a, 0x0049a, 0x0049c, 0x0049c, 0x0049e, 0x0049e,
+ 0x004a0, 0x004a0, 0x004a2, 0x004a2, 0x004a4, 0x004a4, 0x004a6, 0x004a6,
+ 0x004a8, 0x004a8, 0x004aa, 0x004aa, 0x004ac, 0x004ac, 0x004ae, 0x004ae,
+ 0x004b0, 0x004b0, 0x004b2, 0x004b2, 0x004b4, 0x004b4, 0x004b6, 0x004b6,
+ 0x004b8, 0x004b8, 0x004ba, 0x004ba, 0x004bc, 0x004bc, 0x004be, 0x004be,
+ 0x004c0, 0x00416, 0x00416, 0x004c3, 0x004c3, 0x004c5, 0x004c5, 0x004c7,
+ 0x004c7, 0x004c9, 0x004c9, 0x004cb, 0x004cb, 0x004cd, 0x004cd, 0x004c0,
+ 0x004d0, 0x004d0, 0x004d2, 0x004d2, 0x004d4, 0x004d4, 0x004d6, 0x004d6,
+ 0x004d8, 0x004d8, 0x004da, 0x004da, 0x004dc, 0x004dc, 0x004de, 0x004de,
+ 0x004e0, 0x004e0, 0x0040d, 0x0040d, 0x004e4, 0x004e4, 0x004e6, 0x004e6,
+ 0x004e8, 0x004e8, 0x004ea, 0x004ea, 0x004ec, 0x004ec, 0x00423, 0x00423,
+ 0x004f0, 0x004f0, 0x004f2, 0x004f2, 0x004f4, 0x004f4, 0x004f6, 0x004f6,
+ 0x004f8, 0x004f8, 0x004fa, 0x004fa, 0x004fc, 0x004fd, 0x004fe, 0x004ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_05[] = {
+ 0x00500, 0x00500, 0x00502, 0x00502, 0x00504, 0x00504, 0x00506, 0x00506,
+ 0x00508, 0x00508, 0x0050a, 0x0050a, 0x0050c, 0x0050c, 0x0050e, 0x0050e,
+ 0x00510, 0x00510, 0x00512, 0x00512, 0x00514, 0x00514, 0x00516, 0x00516,
+ 0x00518, 0x00518, 0x0051a, 0x0051a, 0x0051c, 0x0051c, 0x0051e, 0x0051e,
+ 0x00520, 0x00520, 0x00522, 0x00522, 0x00524, 0x00524, 0x00526, 0x00527,
+ 0x00528, 0x00529, 0x0052a, 0x0052b, 0x0052c, 0x0052d, 0x0052e, 0x0052f,
+ 0x00530, 0x00531, 0x00532, 0x00533, 0x00534, 0x00535, 0x00536, 0x00537,
+ 0x00538, 0x00539, 0x0053a, 0x0053b, 0x0053c, 0x0053d, 0x0053e, 0x0053f,
+ 0x00540, 0x00541, 0x00542, 0x00543, 0x00544, 0x00545, 0x00546, 0x00547,
+ 0x00548, 0x00549, 0x0054a, 0x0054b, 0x0054c, 0x0054d, 0x0054e, 0x0054f,
+ 0x00550, 0x00551, 0x00552, 0x00553, 0x00554, 0x00555, 0x00556, 0x00557,
+ 0x00558, 0x00559, 0x0055a, 0x0055b, 0x0055c, 0x0055d, 0x0055e, 0x0055f,
+ 0x00560, 0x00531, 0x00532, 0x00533, 0x00534, 0x00535, 0x00536, 0x00537,
+ 0x00538, 0x00539, 0x0053a, 0x0053b, 0x0053c, 0x0053d, 0x0053e, 0x0053f,
+ 0x00540, 0x00541, 0x00542, 0x00543, 0x00544, 0x00545, 0x00546, 0x00547,
+ 0x00548, 0x00549, 0x0054a, 0x0054b, 0x0054c, 0x0054d, 0x0054e, 0x0054f,
+ 0x00550, 0x00551, 0x00552, 0x00553, 0x00554, 0x00555, 0x00556, 0x00587,
+ 0x00588, 0x00589, 0x0058a, 0x0058b, 0x0058c, 0x0058d, 0x0058e, 0x0058f,
+ 0x00590, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x005be, 0x00000,
+ 0x005c0, 0x00000, 0x00000, 0x005c3, 0x00000, 0x00000, 0x005c6, 0x00000,
+ 0x005c8, 0x005c9, 0x005ca, 0x005cb, 0x005cc, 0x005cd, 0x005ce, 0x005cf,
+ 0x005d0, 0x005d1, 0x005d2, 0x005d3, 0x005d4, 0x005d5, 0x005d6, 0x005d7,
+ 0x005d8, 0x005d9, 0x005da, 0x005da, 0x005dc, 0x005dd, 0x005dd, 0x005df,
+ 0x005df, 0x005e1, 0x005e2, 0x005e3, 0x005e3, 0x005e5, 0x005e5, 0x005e7,
+ 0x005e8, 0x005e9, 0x005ea, 0x005eb, 0x005ec, 0x005ed, 0x005ee, 0x005ef,
+ 0x005f0, 0x005f1, 0x005f2, 0x005f3, 0x005f4, 0x005f5, 0x005f6, 0x005f7,
+ 0x005f8, 0x005f9, 0x005fa, 0x005fb, 0x005fc, 0x005fd, 0x005fe, 0x005ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_06[] = {
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00604, 0x00605, 0x00606, 0x00607,
+ 0x00608, 0x00609, 0x0060a, 0x0060b, 0x0060c, 0x0060d, 0x0060e, 0x0060f,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x0061b, 0x0061c, 0x0061d, 0x0061e, 0x0061f,
+ 0x00620, 0x00621, 0x00622, 0x00623, 0x00624, 0x00625, 0x00626, 0x00627,
+ 0x00628, 0x00629, 0x0062a, 0x0062b, 0x0062c, 0x0062d, 0x0062e, 0x0062f,
+ 0x00630, 0x00631, 0x00632, 0x00633, 0x00634, 0x00635, 0x00636, 0x00637,
+ 0x00638, 0x00639, 0x0063a, 0x0063b, 0x0063c, 0x0063d, 0x0063e, 0x0063f,
+ 0x00640, 0x00641, 0x00642, 0x00643, 0x00644, 0x00645, 0x00646, 0x00647,
+ 0x00648, 0x00649, 0x0064a, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x0065f,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x0066a, 0x0066b, 0x0066c, 0x0066d, 0x0066e, 0x0066f,
+ 0x00000, 0x00671, 0x00672, 0x00673, 0x00621, 0x00675, 0x00676, 0x00677,
+ 0x00678, 0x00679, 0x0067a, 0x0067b, 0x0067c, 0x0067d, 0x0067e, 0x0067f,
+ 0x00680, 0x00681, 0x00682, 0x00683, 0x00684, 0x00685, 0x00686, 0x00687,
+ 0x00688, 0x00689, 0x0068a, 0x0068b, 0x0068c, 0x0068d, 0x0068e, 0x0068f,
+ 0x00690, 0x00691, 0x00692, 0x00693, 0x00694, 0x00695, 0x00696, 0x00697,
+ 0x00698, 0x00699, 0x0069a, 0x0069b, 0x0069c, 0x0069d, 0x0069e, 0x0069f,
+ 0x006a0, 0x006a1, 0x006a2, 0x006a3, 0x006a4, 0x006a5, 0x006a6, 0x006a7,
+ 0x006a8, 0x006a9, 0x006aa, 0x006ab, 0x006ac, 0x006ad, 0x006ae, 0x006af,
+ 0x006b0, 0x006b1, 0x006b2, 0x006b3, 0x006b4, 0x006b5, 0x006b6, 0x006b7,
+ 0x006b8, 0x006b9, 0x006ba, 0x006bb, 0x006bc, 0x006bd, 0x006be, 0x006bf,
+ 0x006c0, 0x006c1, 0x006c1, 0x006c3, 0x006c4, 0x006c5, 0x006c6, 0x006c7,
+ 0x006c8, 0x006c9, 0x006ca, 0x006cb, 0x006cc, 0x006cd, 0x006ce, 0x006cf,
+ 0x006d0, 0x006d1, 0x006d2, 0x006d2, 0x006d4, 0x006c0, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00648, 0x0064a, 0x00000,
+ 0x00000, 0x006e9, 0x00000, 0x00000, 0x00000, 0x00000, 0x006ee, 0x006ef,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x006fa, 0x006fb, 0x006fc, 0x00621, 0x00645, 0x006ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_07[] = {
+ 0x00700, 0x00701, 0x00702, 0x00703, 0x00704, 0x00705, 0x00706, 0x00707,
+ 0x00708, 0x00709, 0x0070a, 0x0070b, 0x0070c, 0x0070d, 0x0070e, 0x00000,
+ 0x00710, 0x00000, 0x00712, 0x00713, 0x00713, 0x00715, 0x00716, 0x00717,
+ 0x00718, 0x00719, 0x0071a, 0x0071b, 0x0071b, 0x0071d, 0x0071e, 0x0071f,
+ 0x00720, 0x00721, 0x00722, 0x00723, 0x00723, 0x00725, 0x00726, 0x00726,
+ 0x00728, 0x00729, 0x0072a, 0x0072b, 0x0072c, 0x00712, 0x00713, 0x00715,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x0074b, 0x0074c, 0x0074d, 0x0074e, 0x0074f,
+ 0x00750, 0x00751, 0x00752, 0x00753, 0x00754, 0x00755, 0x00756, 0x00757,
+ 0x00758, 0x00759, 0x0075a, 0x0075b, 0x0075c, 0x0075d, 0x0075e, 0x0075f,
+ 0x00760, 0x00761, 0x00762, 0x00763, 0x00764, 0x00765, 0x00766, 0x00767,
+ 0x00768, 0x00769, 0x0076a, 0x0076b, 0x0076c, 0x0076d, 0x0076e, 0x0076f,
+ 0x00770, 0x00771, 0x00772, 0x00773, 0x00774, 0x00775, 0x00776, 0x00777,
+ 0x00778, 0x00779, 0x0077a, 0x0077b, 0x0077c, 0x0077d, 0x0077e, 0x0077f,
+ 0x00780, 0x00781, 0x00782, 0x00783, 0x00784, 0x00785, 0x00786, 0x00787,
+ 0x00788, 0x00789, 0x0078a, 0x0078b, 0x0078c, 0x0078d, 0x0078e, 0x0078f,
+ 0x00790, 0x00791, 0x00792, 0x00793, 0x00794, 0x00795, 0x00796, 0x00797,
+ 0x00798, 0x00799, 0x0079a, 0x0079b, 0x0079c, 0x0079d, 0x0079e, 0x0079f,
+ 0x007a0, 0x007a1, 0x007a2, 0x007a3, 0x007a4, 0x007a5, 0x007a6, 0x007a7,
+ 0x007a8, 0x007a9, 0x007aa, 0x007ab, 0x007ac, 0x007ad, 0x007ae, 0x007af,
+ 0x007b0, 0x007b1, 0x007b2, 0x007b3, 0x007b4, 0x007b5, 0x007b6, 0x007b7,
+ 0x007b8, 0x007b9, 0x007ba, 0x007bb, 0x007bc, 0x007bd, 0x007be, 0x007bf,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x007ca, 0x007cb, 0x007cc, 0x007cd, 0x007ce, 0x007cf,
+ 0x007d0, 0x007d1, 0x007d2, 0x007d3, 0x007d4, 0x007d5, 0x007d6, 0x007d7,
+ 0x007d8, 0x007d9, 0x007da, 0x007db, 0x007dc, 0x007dd, 0x007de, 0x007df,
+ 0x007e0, 0x007e1, 0x007e2, 0x007e3, 0x007e4, 0x007e5, 0x007e6, 0x007e7,
+ 0x007d6, 0x007d7, 0x007d9, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x007f4, 0x007f5, 0x007f6, 0x007f7,
+ 0x007f8, 0x007f9, 0x007fa, 0x007fb, 0x007fc, 0x007fd, 0x007fe, 0x007ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_08[] = {
+ 0x00800, 0x00801, 0x00802, 0x00803, 0x00804, 0x00805, 0x00806, 0x00807,
+ 0x00808, 0x00809, 0x0080a, 0x0080b, 0x0080c, 0x0080d, 0x0080e, 0x0080f,
+ 0x00810, 0x00811, 0x00812, 0x00813, 0x00814, 0x00815, 0x00816, 0x00817,
+ 0x00000, 0x00000, 0x0081a, 0x0081b, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x0082e, 0x0082f,
+ 0x00830, 0x00831, 0x00832, 0x00833, 0x00834, 0x00835, 0x00836, 0x00837,
+ 0x00838, 0x00839, 0x0083a, 0x0083b, 0x0083c, 0x0083d, 0x0083e, 0x0083f,
+ 0x00840, 0x00841, 0x00842, 0x00843, 0x00844, 0x00845, 0x00846, 0x00847,
+ 0x00848, 0x00849, 0x0084a, 0x0084b, 0x0084c, 0x0084d, 0x0084e, 0x0084f,
+ 0x00850, 0x00851, 0x00852, 0x00853, 0x00854, 0x00855, 0x00856, 0x00857,
+ 0x00858, 0x00859, 0x0085a, 0x0085b, 0x0085c, 0x0085d, 0x0085e, 0x0085f,
+ 0x00860, 0x00861, 0x00862, 0x00863, 0x00864, 0x00865, 0x00866, 0x00867,
+ 0x00868, 0x00869, 0x0086a, 0x0086b, 0x0086c, 0x0086d, 0x0086e, 0x0086f,
+ 0x00870, 0x00871, 0x00872, 0x00873, 0x00874, 0x00875, 0x00876, 0x00877,
+ 0x00878, 0x00879, 0x0087a, 0x0087b, 0x0087c, 0x0087d, 0x0087e, 0x0087f,
+ 0x00880, 0x00881, 0x00882, 0x00883, 0x00884, 0x00885, 0x00886, 0x00887,
+ 0x00888, 0x00889, 0x0088a, 0x0088b, 0x0088c, 0x0088d, 0x0088e, 0x0088f,
+ 0x00890, 0x00891, 0x00892, 0x00893, 0x00894, 0x00895, 0x00896, 0x00897,
+ 0x00898, 0x00899, 0x0089a, 0x0089b, 0x0089c, 0x0089d, 0x0089e, 0x0089f,
+ 0x008a0, 0x008a1, 0x008a2, 0x008a3, 0x008a4, 0x008a5, 0x008a6, 0x008a7,
+ 0x008a8, 0x008a9, 0x008aa, 0x008ab, 0x008ac, 0x008ad, 0x008ae, 0x008af,
+ 0x008b0, 0x008b1, 0x008b2, 0x008b3, 0x008b4, 0x008b5, 0x008b6, 0x008b7,
+ 0x008b8, 0x008b9, 0x008ba, 0x008bb, 0x008bc, 0x008bd, 0x008be, 0x008bf,
+ 0x008c0, 0x008c1, 0x008c2, 0x008c3, 0x008c4, 0x008c5, 0x008c6, 0x008c7,
+ 0x008c8, 0x008c9, 0x008ca, 0x008cb, 0x008cc, 0x008cd, 0x008ce, 0x008cf,
+ 0x008d0, 0x008d1, 0x008d2, 0x008d3, 0x008d4, 0x008d5, 0x008d6, 0x008d7,
+ 0x008d8, 0x008d9, 0x008da, 0x008db, 0x008dc, 0x008dd, 0x008de, 0x008df,
+ 0x008e0, 0x008e1, 0x008e2, 0x008e3, 0x008e4, 0x008e5, 0x008e6, 0x008e7,
+ 0x008e8, 0x008e9, 0x008ea, 0x008eb, 0x008ec, 0x008ed, 0x008ee, 0x008ef,
+ 0x008f0, 0x008f1, 0x008f2, 0x008f3, 0x008f4, 0x008f5, 0x008f6, 0x008f7,
+ 0x008f8, 0x008f9, 0x008fa, 0x008fb, 0x008fc, 0x008fd, 0x008fe, 0x008ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_09[] = {
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00904, 0x00905, 0x00906, 0x00907,
+ 0x00908, 0x00909, 0x0090a, 0x0090b, 0x0090c, 0x0090d, 0x0090e, 0x0090f,
+ 0x00910, 0x00911, 0x00912, 0x00913, 0x00914, 0x00915, 0x00916, 0x00917,
+ 0x00918, 0x00919, 0x0091a, 0x0091b, 0x0091c, 0x0091d, 0x0091e, 0x0091f,
+ 0x00920, 0x00921, 0x00922, 0x00923, 0x00924, 0x00925, 0x00926, 0x00927,
+ 0x00928, 0x00928, 0x0092a, 0x0092b, 0x0092c, 0x0092d, 0x0092e, 0x0092f,
+ 0x00930, 0x00930, 0x00932, 0x00933, 0x00933, 0x00935, 0x00936, 0x00937,
+ 0x00938, 0x00939, 0x0093a, 0x0093b, 0x00000, 0x0093d, 0x0093e, 0x0093f,
+ 0x00940, 0x00941, 0x00942, 0x00943, 0x00944, 0x00945, 0x00946, 0x00947,
+ 0x00948, 0x00949, 0x0094a, 0x0094b, 0x0094c, 0x0094d, 0x0094e, 0x0094f,
+ 0x00950, 0x00000, 0x00000, 0x00000, 0x00000, 0x00955, 0x00956, 0x00957,
+ 0x00915, 0x00916, 0x00917, 0x0091c, 0x00921, 0x00922, 0x0092b, 0x0092f,
+ 0x00960, 0x00961, 0x00962, 0x00963, 0x00964, 0x00965, 0x00030, 0x00031,
+ 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037, 0x00038, 0x00039,
+ 0x00970, 0x00971, 0x00972, 0x00973, 0x00974, 0x00975, 0x00976, 0x00977,
+ 0x00978, 0x00979, 0x0097a, 0x0097b, 0x0097c, 0x0097d, 0x0097e, 0x0097f,
+ 0x00980, 0x00000, 0x00000, 0x00000, 0x00984, 0x00985, 0x00986, 0x00987,
+ 0x00988, 0x00989, 0x0098a, 0x0098b, 0x0098c, 0x0098d, 0x0098e, 0x0098f,
+ 0x00990, 0x00991, 0x00992, 0x00993, 0x00994, 0x00995, 0x00996, 0x00997,
+ 0x00998, 0x00999, 0x0099a, 0x0099b, 0x0099c, 0x0099d, 0x0099e, 0x0099f,
+ 0x009a0, 0x009a1, 0x009a2, 0x009a3, 0x009a4, 0x009a5, 0x009a6, 0x009a7,
+ 0x009a8, 0x009a9, 0x009aa, 0x009ab, 0x009ac, 0x009ad, 0x009ae, 0x009af,
+ 0x009b0, 0x009b1, 0x009b2, 0x009b3, 0x009b4, 0x009b5, 0x009b6, 0x009b7,
+ 0x009b8, 0x009b9, 0x009ba, 0x009bb, 0x00000, 0x009bd, 0x009be, 0x009bf,
+ 0x009c0, 0x009c1, 0x009c2, 0x009c3, 0x009c4, 0x009c5, 0x009c6, 0x009c7,
+ 0x009c8, 0x009c9, 0x009ca, 0x009cb, 0x009cc, 0x009cd, 0x009ce, 0x009cf,
+ 0x009d0, 0x009d1, 0x009d2, 0x009d3, 0x009d4, 0x009d5, 0x009d6, 0x009d7,
+ 0x009d8, 0x009d9, 0x009da, 0x009db, 0x009a1, 0x009a2, 0x009de, 0x009af,
+ 0x009e0, 0x009e1, 0x009e2, 0x009e3, 0x009e4, 0x009e5, 0x00030, 0x00031,
+ 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037, 0x00038, 0x00039,
+ 0x009f0, 0x009f1, 0x009f2, 0x009f3, 0x009f4, 0x009f5, 0x009f6, 0x009f7,
+ 0x009f8, 0x009f9, 0x009fa, 0x009fb, 0x009fc, 0x009fd, 0x009fe, 0x009ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_0a[] = {
+ 0x00a00, 0x00000, 0x00000, 0x00000, 0x00a04, 0x00a05, 0x00a06, 0x00a07,
+ 0x00a08, 0x00a09, 0x00a0a, 0x00a0b, 0x00a0c, 0x00a0d, 0x00a0e, 0x00a0f,
+ 0x00a10, 0x00a11, 0x00a12, 0x00a13, 0x00a14, 0x00a15, 0x00a16, 0x00a17,
+ 0x00a18, 0x00a19, 0x00a1a, 0x00a1b, 0x00a1c, 0x00a1d, 0x00a1e, 0x00a1f,
+ 0x00a20, 0x00a21, 0x00a22, 0x00a23, 0x00a24, 0x00a25, 0x00a26, 0x00a27,
+ 0x00a28, 0x00a29, 0x00a2a, 0x00a2b, 0x00a2c, 0x00a2d, 0x00a2e, 0x00a2f,
+ 0x00a30, 0x00a31, 0x00a32, 0x00a32, 0x00a34, 0x00a35, 0x00a36, 0x00a37,
+ 0x00a36, 0x00a39, 0x00a3a, 0x00a3b, 0x00000, 0x00a3d, 0x00a3e, 0x00a3f,
+ 0x00a40, 0x00a41, 0x00a42, 0x00a43, 0x00a44, 0x00a45, 0x00a46, 0x00a47,
+ 0x00a48, 0x00a49, 0x00a4a, 0x00a4b, 0x00a4c, 0x00a4d, 0x00a4e, 0x00a4f,
+ 0x00a50, 0x00a51, 0x00a52, 0x00a53, 0x00a54, 0x00a55, 0x00a56, 0x00a57,
+ 0x00a58, 0x00a16, 0x00a17, 0x00a1c, 0x00a5c, 0x00a5d, 0x00a2b, 0x00a5f,
+ 0x00a60, 0x00a61, 0x00a62, 0x00a63, 0x00a64, 0x00a65, 0x00030, 0x00031,
+ 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037, 0x00038, 0x00039,
+ 0x00000, 0x00000, 0x00a72, 0x00a73, 0x00a74, 0x00a75, 0x00a76, 0x00a77,
+ 0x00a78, 0x00a79, 0x00a7a, 0x00a7b, 0x00a7c, 0x00a7d, 0x00a7e, 0x00a7f,
+ 0x00a80, 0x00000, 0x00000, 0x00000, 0x00a84, 0x00a85, 0x00a86, 0x00a87,
+ 0x00a88, 0x00a89, 0x00a8a, 0x00a8b, 0x00a8c, 0x00a8d, 0x00a8e, 0x00a8f,
+ 0x00a90, 0x00a91, 0x00a92, 0x00a93, 0x00a94, 0x00a95, 0x00a96, 0x00a97,
+ 0x00a98, 0x00a99, 0x00a9a, 0x00a9b, 0x00a9c, 0x00a9d, 0x00a9e, 0x00a9f,
+ 0x00aa0, 0x00aa1, 0x00aa2, 0x00aa3, 0x00aa4, 0x00aa5, 0x00aa6, 0x00aa7,
+ 0x00aa8, 0x00aa9, 0x00aaa, 0x00aab, 0x00aac, 0x00aad, 0x00aae, 0x00aaf,
+ 0x00ab0, 0x00ab1, 0x00ab2, 0x00ab3, 0x00ab4, 0x00ab5, 0x00ab6, 0x00ab7,
+ 0x00ab8, 0x00ab9, 0x00aba, 0x00abb, 0x00000, 0x00abd, 0x00abe, 0x00abf,
+ 0x00ac0, 0x00ac1, 0x00ac2, 0x00ac3, 0x00ac4, 0x00ac5, 0x00ac6, 0x00ac7,
+ 0x00ac8, 0x00ac9, 0x00aca, 0x00acb, 0x00acc, 0x00acd, 0x00ace, 0x00acf,
+ 0x00ad0, 0x00ad1, 0x00ad2, 0x00ad3, 0x00ad4, 0x00ad5, 0x00ad6, 0x00ad7,
+ 0x00ad8, 0x00ad9, 0x00ada, 0x00adb, 0x00adc, 0x00add, 0x00ade, 0x00adf,
+ 0x00ae0, 0x00ae1, 0x00ae2, 0x00ae3, 0x00ae4, 0x00ae5, 0x00030, 0x00031,
+ 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037, 0x00038, 0x00039,
+ 0x00af0, 0x00af1, 0x00af2, 0x00af3, 0x00af4, 0x00af5, 0x00af6, 0x00af7,
+ 0x00af8, 0x00af9, 0x00afa, 0x00afb, 0x00afc, 0x00afd, 0x00afe, 0x00aff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_0b[] = {
+ 0x00b00, 0x00000, 0x00000, 0x00000, 0x00b04, 0x00b05, 0x00b06, 0x00b07,
+ 0x00b08, 0x00b09, 0x00b0a, 0x00b0b, 0x00b0c, 0x00b0d, 0x00b0e, 0x00b0f,
+ 0x00b10, 0x00b11, 0x00b12, 0x00b13, 0x00b14, 0x00b15, 0x00b16, 0x00b17,
+ 0x00b18, 0x00b19, 0x00b1a, 0x00b1b, 0x00b1c, 0x00b1d, 0x00b1e, 0x00b1f,
+ 0x00b20, 0x00b21, 0x00b22, 0x00b23, 0x00b24, 0x00b25, 0x00b26, 0x00b27,
+ 0x00b28, 0x00b29, 0x00b2a, 0x00b2b, 0x00b2c, 0x00b2d, 0x00b2e, 0x00b2f,
+ 0x00b30, 0x00b31, 0x00b32, 0x00b33, 0x00b34, 0x00b35, 0x00b36, 0x00b37,
+ 0x00b38, 0x00b39, 0x00b3a, 0x00b3b, 0x00000, 0x00b3d, 0x00b3e, 0x00b3f,
+ 0x00b40, 0x00b41, 0x00b42, 0x00b43, 0x00b44, 0x00b45, 0x00b46, 0x00b47,
+ 0x00b48, 0x00b49, 0x00b4a, 0x00b4b, 0x00b4c, 0x00b4d, 0x00b4e, 0x00b4f,
+ 0x00b50, 0x00b51, 0x00b52, 0x00b53, 0x00b54, 0x00b55, 0x00b56, 0x00b57,
+ 0x00b58, 0x00b59, 0x00b5a, 0x00b5b, 0x00b21, 0x00b22, 0x00b5e, 0x00b5f,
+ 0x00b60, 0x00b61, 0x00b62, 0x00b63, 0x00b64, 0x00b65, 0x00030, 0x00031,
+ 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037, 0x00038, 0x00039,
+ 0x00b70, 0x00b71, 0x00b72, 0x00b73, 0x00b74, 0x00b75, 0x00b76, 0x00b77,
+ 0x00b78, 0x00b79, 0x00b7a, 0x00b7b, 0x00b7c, 0x00b7d, 0x00b7e, 0x00b7f,
+ 0x00b80, 0x00b81, 0x00000, 0x00b83, 0x00b84, 0x00b85, 0x00b86, 0x00b87,
+ 0x00b88, 0x00b89, 0x00b8a, 0x00b8b, 0x00b8c, 0x00b8d, 0x00b8e, 0x00b8f,
+ 0x00b90, 0x00b91, 0x00b92, 0x00b93, 0x00b94, 0x00b95, 0x00b96, 0x00b97,
+ 0x00b98, 0x00b99, 0x00b9a, 0x00b9b, 0x00b9c, 0x00b9d, 0x00b9e, 0x00b9f,
+ 0x00ba0, 0x00ba1, 0x00ba2, 0x00ba3, 0x00ba4, 0x00ba5, 0x00ba6, 0x00ba7,
+ 0x00ba8, 0x00ba9, 0x00baa, 0x00bab, 0x00bac, 0x00bad, 0x00bae, 0x00baf,
+ 0x00bb0, 0x00bb1, 0x00bb2, 0x00bb3, 0x00bb4, 0x00bb5, 0x00bb6, 0x00bb7,
+ 0x00bb8, 0x00bb9, 0x00bba, 0x00bbb, 0x00bbc, 0x00bbd, 0x00bbe, 0x00bbf,
+ 0x00bc0, 0x00bc1, 0x00bc2, 0x00bc3, 0x00bc4, 0x00bc5, 0x00bc6, 0x00bc7,
+ 0x00bc8, 0x00bc9, 0x00bca, 0x00bcb, 0x00bcc, 0x00bcd, 0x00bce, 0x00bcf,
+ 0x00bd0, 0x00bd1, 0x00bd2, 0x00bd3, 0x00bd4, 0x00bd5, 0x00bd6, 0x00bd7,
+ 0x00bd8, 0x00bd9, 0x00bda, 0x00bdb, 0x00bdc, 0x00bdd, 0x00bde, 0x00bdf,
+ 0x00be0, 0x00be1, 0x00be2, 0x00be3, 0x00be4, 0x00be5, 0x00030, 0x00031,
+ 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037, 0x00038, 0x00039,
+ 0x00bf0, 0x00bf1, 0x00bf2, 0x00bf3, 0x00bf4, 0x00bf5, 0x00bf6, 0x00bf7,
+ 0x00bf8, 0x00bf9, 0x00bfa, 0x00bfb, 0x00bfc, 0x00bfd, 0x00bfe, 0x00bff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_0c[] = {
+ 0x00c00, 0x00000, 0x00000, 0x00000, 0x00c04, 0x00c05, 0x00c06, 0x00c07,
+ 0x00c08, 0x00c09, 0x00c0a, 0x00c0b, 0x00c0c, 0x00c0d, 0x00c0e, 0x00c0f,
+ 0x00c10, 0x00c11, 0x00c12, 0x00c13, 0x00c14, 0x00c15, 0x00c16, 0x00c17,
+ 0x00c18, 0x00c19, 0x00c1a, 0x00c1b, 0x00c1c, 0x00c1d, 0x00c1e, 0x00c1f,
+ 0x00c20, 0x00c21, 0x00c22, 0x00c23, 0x00c24, 0x00c25, 0x00c26, 0x00c27,
+ 0x00c28, 0x00c29, 0x00c2a, 0x00c2b, 0x00c2c, 0x00c2d, 0x00c2e, 0x00c2f,
+ 0x00c30, 0x00c31, 0x00c32, 0x00c33, 0x00c34, 0x00c35, 0x00c36, 0x00c37,
+ 0x00c38, 0x00c39, 0x00c3a, 0x00c3b, 0x00c3c, 0x00c3d, 0x00c3e, 0x00c3f,
+ 0x00c40, 0x00c41, 0x00c42, 0x00c43, 0x00c44, 0x00c45, 0x00c46, 0x00c47,
+ 0x00c48, 0x00c49, 0x00c4a, 0x00c4b, 0x00c4c, 0x00c4d, 0x00c4e, 0x00c4f,
+ 0x00c50, 0x00c51, 0x00c52, 0x00c53, 0x00c54, 0x00c55, 0x00c56, 0x00c57,
+ 0x00c58, 0x00c59, 0x00c5a, 0x00c5b, 0x00c5c, 0x00c5d, 0x00c5e, 0x00c5f,
+ 0x00c60, 0x00c61, 0x00c62, 0x00c63, 0x00c64, 0x00c65, 0x00030, 0x00031,
+ 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037, 0x00038, 0x00039,
+ 0x00c70, 0x00c71, 0x00c72, 0x00c73, 0x00c74, 0x00c75, 0x00c76, 0x00c77,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00031, 0x00032, 0x00033, 0x00c7f,
+ 0x00c80, 0x00c81, 0x00000, 0x00000, 0x00c84, 0x00c85, 0x00c86, 0x00c87,
+ 0x00c88, 0x00c89, 0x00c8a, 0x00c8b, 0x00c8c, 0x00c8d, 0x00c8e, 0x00c8f,
+ 0x00c90, 0x00c91, 0x00c92, 0x00c93, 0x00c94, 0x00c95, 0x00c96, 0x00c97,
+ 0x00c98, 0x00c99, 0x00c9a, 0x00c9b, 0x00c9c, 0x00c9d, 0x00c9e, 0x00c9f,
+ 0x00ca0, 0x00ca1, 0x00ca2, 0x00ca3, 0x00ca4, 0x00ca5, 0x00ca6, 0x00ca7,
+ 0x00ca8, 0x00ca9, 0x00caa, 0x00cab, 0x00cac, 0x00cad, 0x00cae, 0x00caf,
+ 0x00cb0, 0x00cb1, 0x00cb2, 0x00cb3, 0x00cb4, 0x00cb5, 0x00cb6, 0x00cb7,
+ 0x00cb8, 0x00cb9, 0x00cba, 0x00cbb, 0x00000, 0x00cbd, 0x00cbe, 0x00cbf,
+ 0x00cc0, 0x00cc1, 0x00cc2, 0x00cc3, 0x00cc4, 0x00cc5, 0x00cc6, 0x00cc7,
+ 0x00cc8, 0x00cc9, 0x00cca, 0x00ccb, 0x00ccc, 0x00ccd, 0x00cce, 0x00ccf,
+ 0x00cd0, 0x00cd1, 0x00cd2, 0x00cd3, 0x00cd4, 0x00cd5, 0x00cd6, 0x00cd7,
+ 0x00cd8, 0x00cd9, 0x00cda, 0x00cdb, 0x00cdc, 0x00cdd, 0x00cde, 0x00cdf,
+ 0x00ce0, 0x00ce1, 0x00ce2, 0x00ce3, 0x00ce4, 0x00ce5, 0x00030, 0x00031,
+ 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037, 0x00038, 0x00039,
+ 0x00cf0, 0x00cf1, 0x00cf2, 0x00cf3, 0x00cf4, 0x00cf5, 0x00cf6, 0x00cf7,
+ 0x00cf8, 0x00cf9, 0x00cfa, 0x00cfb, 0x00cfc, 0x00cfd, 0x00cfe, 0x00cff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_0d[] = {
+ 0x00d00, 0x00d01, 0x00000, 0x00000, 0x00d04, 0x00d05, 0x00d06, 0x00d07,
+ 0x00d08, 0x00d09, 0x00d0a, 0x00d0b, 0x00d0c, 0x00d0d, 0x00d0e, 0x00d0f,
+ 0x00d10, 0x00d11, 0x00d12, 0x00d13, 0x00d14, 0x00d15, 0x00d16, 0x00d17,
+ 0x00d18, 0x00d19, 0x00d1a, 0x00d1b, 0x00d1c, 0x00d1d, 0x00d1e, 0x00d1f,
+ 0x00d20, 0x00d21, 0x00d22, 0x00d23, 0x00d24, 0x00d25, 0x00d26, 0x00d27,
+ 0x00d28, 0x00d29, 0x00d2a, 0x00d2b, 0x00d2c, 0x00d2d, 0x00d2e, 0x00d2f,
+ 0x00d30, 0x00d31, 0x00d32, 0x00d33, 0x00d34, 0x00d35, 0x00d36, 0x00d37,
+ 0x00d38, 0x00d39, 0x00d3a, 0x00d3b, 0x00d3c, 0x00d3d, 0x00d3e, 0x00d3f,
+ 0x00d40, 0x00d41, 0x00d42, 0x00d43, 0x00d44, 0x00d45, 0x00d46, 0x00d47,
+ 0x00d48, 0x00d49, 0x00d4a, 0x00d4b, 0x00d4c, 0x00d4d, 0x00d4e, 0x00d4f,
+ 0x00d50, 0x00d51, 0x00d52, 0x00d53, 0x00d54, 0x00d55, 0x00d56, 0x00d57,
+ 0x00d58, 0x00d59, 0x00d5a, 0x00d5b, 0x00d5c, 0x00d5d, 0x00d5e, 0x00d5f,
+ 0x00d60, 0x00d61, 0x00d62, 0x00d63, 0x00d64, 0x00d65, 0x00030, 0x00031,
+ 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037, 0x00038, 0x00039,
+ 0x00d70, 0x00d71, 0x00d72, 0x00d73, 0x00d74, 0x00d75, 0x00d76, 0x00d77,
+ 0x00d78, 0x00d79, 0x00d7a, 0x00d7b, 0x00d7c, 0x00d7d, 0x00d7e, 0x00d7f,
+ 0x00d80, 0x00d81, 0x00000, 0x00000, 0x00d84, 0x00d85, 0x00d86, 0x00d87,
+ 0x00d88, 0x00d89, 0x00d8a, 0x00d8b, 0x00d8c, 0x00d8d, 0x00d8e, 0x00d8f,
+ 0x00d90, 0x00d91, 0x00d92, 0x00d93, 0x00d94, 0x00d95, 0x00d96, 0x00d97,
+ 0x00d98, 0x00d99, 0x00d9a, 0x00d9b, 0x00d9c, 0x00d9d, 0x00d9e, 0x00d9f,
+ 0x00da0, 0x00da1, 0x00da2, 0x00da3, 0x00da4, 0x00da5, 0x00da6, 0x00da7,
+ 0x00da8, 0x00da9, 0x00daa, 0x00dab, 0x00dac, 0x00dad, 0x00dae, 0x00daf,
+ 0x00db0, 0x00db1, 0x00db2, 0x00db3, 0x00db4, 0x00db5, 0x00db6, 0x00db7,
+ 0x00db8, 0x00db9, 0x00dba, 0x00dbb, 0x00dbc, 0x00dbd, 0x00dbe, 0x00dbf,
+ 0x00dc0, 0x00dc1, 0x00dc2, 0x00dc3, 0x00dc4, 0x00dc5, 0x00dc6, 0x00dc7,
+ 0x00dc8, 0x00dc9, 0x00dca, 0x00dcb, 0x00dcc, 0x00dcd, 0x00dce, 0x00dcf,
+ 0x00dd0, 0x00dd1, 0x00dd2, 0x00dd3, 0x00dd4, 0x00dd5, 0x00dd6, 0x00dd7,
+ 0x00dd8, 0x00dd9, 0x00dda, 0x00ddb, 0x00ddc, 0x00ddd, 0x00dde, 0x00ddf,
+ 0x00de0, 0x00de1, 0x00de2, 0x00de3, 0x00de4, 0x00de5, 0x00de6, 0x00de7,
+ 0x00de8, 0x00de9, 0x00dea, 0x00deb, 0x00dec, 0x00ded, 0x00dee, 0x00def,
+ 0x00df0, 0x00df1, 0x00df2, 0x00df3, 0x00df4, 0x00df5, 0x00df6, 0x00df7,
+ 0x00df8, 0x00df9, 0x00dfa, 0x00dfb, 0x00dfc, 0x00dfd, 0x00dfe, 0x00dff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_0e[] = {
+ 0x00e00, 0x00e01, 0x00e02, 0x00e03, 0x00e04, 0x00e05, 0x00e06, 0x00e07,
+ 0x00e08, 0x00e09, 0x00e0a, 0x00e0b, 0x00e0c, 0x00e0d, 0x00e0e, 0x00e0f,
+ 0x00e10, 0x00e11, 0x00e12, 0x00e13, 0x00e14, 0x00e15, 0x00e16, 0x00e17,
+ 0x00e18, 0x00e19, 0x00e1a, 0x00e1b, 0x00e1c, 0x00e1d, 0x00e1e, 0x00e1f,
+ 0x00e20, 0x00e21, 0x00e22, 0x00e23, 0x00e24, 0x00e25, 0x00e26, 0x00e27,
+ 0x00e28, 0x00e29, 0x00e2a, 0x00e2b, 0x00e2c, 0x00e2d, 0x00e2e, 0x00e2f,
+ 0x00e30, 0x00e31, 0x00e32, 0x00e33, 0x00e34, 0x00e35, 0x00e36, 0x00e37,
+ 0x00e38, 0x00e39, 0x00e3a, 0x00e3b, 0x00e3c, 0x00e3d, 0x00e3e, 0x00e3f,
+ 0x00e40, 0x00e41, 0x00e42, 0x00e43, 0x00e44, 0x00e45, 0x00e46, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00e4f,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x00e5a, 0x00e5b, 0x00e5c, 0x00e5d, 0x00e5e, 0x00e5f,
+ 0x00e60, 0x00e61, 0x00e62, 0x00e63, 0x00e64, 0x00e65, 0x00e66, 0x00e67,
+ 0x00e68, 0x00e69, 0x00e6a, 0x00e6b, 0x00e6c, 0x00e6d, 0x00e6e, 0x00e6f,
+ 0x00e70, 0x00e71, 0x00e72, 0x00e73, 0x00e74, 0x00e75, 0x00e76, 0x00e77,
+ 0x00e78, 0x00e79, 0x00e7a, 0x00e7b, 0x00e7c, 0x00e7d, 0x00e7e, 0x00e7f,
+ 0x00e80, 0x00e81, 0x00e82, 0x00e83, 0x00e84, 0x00e85, 0x00e86, 0x00e87,
+ 0x00e88, 0x00e89, 0x00e8a, 0x00e8b, 0x00e8c, 0x00e8d, 0x00e8e, 0x00e8f,
+ 0x00e90, 0x00e91, 0x00e92, 0x00e93, 0x00e94, 0x00e95, 0x00e96, 0x00e97,
+ 0x00e98, 0x00e99, 0x00e9a, 0x00e9b, 0x00e9c, 0x00e9d, 0x00e9e, 0x00e9f,
+ 0x00ea0, 0x00ea1, 0x00ea2, 0x00ea3, 0x00ea4, 0x00ea5, 0x00ea6, 0x00ea7,
+ 0x00ea8, 0x00ea9, 0x00eaa, 0x00eab, 0x00eac, 0x00ead, 0x00eae, 0x00eaf,
+ 0x00eb0, 0x00eb1, 0x00eb2, 0x00eb3, 0x00eb4, 0x00eb5, 0x00eb6, 0x00eb7,
+ 0x00eb8, 0x00eb9, 0x00eba, 0x00ebb, 0x00ebc, 0x00ebd, 0x00ebe, 0x00ebf,
+ 0x00ec0, 0x00ec1, 0x00ec2, 0x00ec3, 0x00ec4, 0x00ec5, 0x00ec6, 0x00ec7,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00ece, 0x00ecf,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x00eda, 0x00edb, 0x00edc, 0x00edd, 0x00ede, 0x00edf,
+ 0x00ee0, 0x00ee1, 0x00ee2, 0x00ee3, 0x00ee4, 0x00ee5, 0x00ee6, 0x00ee7,
+ 0x00ee8, 0x00ee9, 0x00eea, 0x00eeb, 0x00eec, 0x00eed, 0x00eee, 0x00eef,
+ 0x00ef0, 0x00ef1, 0x00ef2, 0x00ef3, 0x00ef4, 0x00ef5, 0x00ef6, 0x00ef7,
+ 0x00ef8, 0x00ef9, 0x00efa, 0x00efb, 0x00efc, 0x00efd, 0x00efe, 0x00eff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_0f[] = {
+ 0x00f00, 0x00f01, 0x00f02, 0x00f03, 0x00f04, 0x00f05, 0x00f06, 0x00f07,
+ 0x00f08, 0x00f09, 0x00f0a, 0x00f0b, 0x00f0b, 0x00f0d, 0x00f0e, 0x00f0f,
+ 0x00f10, 0x00f11, 0x00f12, 0x00f13, 0x00f14, 0x00f15, 0x00f16, 0x00f17,
+ 0x00000, 0x00000, 0x00f1a, 0x00f1b, 0x00f1c, 0x00f1d, 0x00f1e, 0x00f1f,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036,
+ 0x00037, 0x00038, 0x00039, 0x00030, 0x00f34, 0x00000, 0x00f36, 0x00000,
+ 0x00f38, 0x00000, 0x00f3a, 0x00f3b, 0x00f3c, 0x00f3d, 0x00f3e, 0x00f3f,
+ 0x00f40, 0x00f41, 0x00f42, 0x00f43, 0x00f44, 0x00f45, 0x00f46, 0x00f47,
+ 0x00f48, 0x00f49, 0x00f4a, 0x00f4b, 0x00f4c, 0x00f4d, 0x00f4e, 0x00f4f,
+ 0x00f50, 0x00f51, 0x00f52, 0x00f53, 0x00f54, 0x00f55, 0x00f56, 0x00f57,
+ 0x00f58, 0x00f59, 0x00f5a, 0x00f5b, 0x00f5c, 0x00f5d, 0x00f5e, 0x00f5f,
+ 0x00f60, 0x00f61, 0x00f62, 0x00f63, 0x00f64, 0x00f65, 0x00f66, 0x00f67,
+ 0x00f68, 0x00f69, 0x00f62, 0x00f6b, 0x00f6c, 0x00f6d, 0x00f6e, 0x00f6f,
+ 0x00f70, 0x00f71, 0x00f72, 0x00f73, 0x00f74, 0x00f75, 0x00f76, 0x00f77,
+ 0x00f78, 0x00f79, 0x00f7a, 0x00f7b, 0x00f7c, 0x00f7d, 0x00000, 0x00000,
+ 0x00f80, 0x00f81, 0x00000, 0x00000, 0x00f84, 0x00f85, 0x00000, 0x00000,
+ 0x00f88, 0x00f89, 0x00f8a, 0x00f8b, 0x00f8c, 0x00f8d, 0x00f8e, 0x00f8f,
+ 0x00f90, 0x00f91, 0x00f92, 0x00f93, 0x00f94, 0x00f95, 0x00f96, 0x00f97,
+ 0x00f98, 0x00f99, 0x00f9a, 0x00f9b, 0x00f9c, 0x00f9d, 0x00f9e, 0x00f9f,
+ 0x00fa0, 0x00fa1, 0x00fa2, 0x00fa3, 0x00fa4, 0x00fa5, 0x00fa6, 0x00fa7,
+ 0x00fa8, 0x00fa9, 0x00faa, 0x00fab, 0x00fac, 0x00fad, 0x00fae, 0x00faf,
+ 0x00fb0, 0x00fb1, 0x00fb2, 0x00fb3, 0x00fb4, 0x00fb5, 0x00fb6, 0x00fb7,
+ 0x00fb8, 0x00fb9, 0x00fad, 0x00fb1, 0x00fb2, 0x00fbd, 0x00fbe, 0x00fbf,
+ 0x00fc0, 0x00fc1, 0x00fc2, 0x00fc3, 0x00fc4, 0x00fc5, 0x00000, 0x00fc7,
+ 0x00fc8, 0x00fc9, 0x00fca, 0x00fcb, 0x00fcc, 0x00fcd, 0x00fce, 0x00fcf,
+ 0x00fd0, 0x00fd1, 0x00fd2, 0x00fd3, 0x00fd4, 0x00fd5, 0x00fd6, 0x00fd7,
+ 0x00fd8, 0x00fd9, 0x00fda, 0x00fdb, 0x00fdc, 0x00fdd, 0x00fde, 0x00fdf,
+ 0x00fe0, 0x00fe1, 0x00fe2, 0x00fe3, 0x00fe4, 0x00fe5, 0x00fe6, 0x00fe7,
+ 0x00fe8, 0x00fe9, 0x00fea, 0x00feb, 0x00fec, 0x00fed, 0x00fee, 0x00fef,
+ 0x00ff0, 0x00ff1, 0x00ff2, 0x00ff3, 0x00ff4, 0x00ff5, 0x00ff6, 0x00ff7,
+ 0x00ff8, 0x00ff9, 0x00ffa, 0x00ffb, 0x00ffc, 0x00ffd, 0x00ffe, 0x00fff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_10[] = {
+ 0x01000, 0x01001, 0x01002, 0x01003, 0x01004, 0x01005, 0x01006, 0x01007,
+ 0x01008, 0x01009, 0x0100a, 0x0100b, 0x0100c, 0x0100d, 0x0100e, 0x0100f,
+ 0x01010, 0x01011, 0x01012, 0x01013, 0x01014, 0x01015, 0x01016, 0x01017,
+ 0x01018, 0x01019, 0x0101a, 0x0101b, 0x0101c, 0x0101d, 0x0101e, 0x0101f,
+ 0x01020, 0x01021, 0x01022, 0x01023, 0x01024, 0x01025, 0x01026, 0x01027,
+ 0x01028, 0x01029, 0x0102a, 0x0102b, 0x0102b, 0x0102d, 0x0102e, 0x0102f,
+ 0x01030, 0x01031, 0x01032, 0x01033, 0x01034, 0x01035, 0x00000, 0x00000,
+ 0x00000, 0x01039, 0x0103a, 0x0103b, 0x0103c, 0x0103d, 0x0103e, 0x0103f,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x0104a, 0x0104b, 0x0104c, 0x0104d, 0x0104e, 0x0104f,
+ 0x01050, 0x01051, 0x01052, 0x01053, 0x01054, 0x01055, 0x01056, 0x01057,
+ 0x01058, 0x01059, 0x0105a, 0x0105b, 0x0105c, 0x0105d, 0x0105e, 0x0105f,
+ 0x01060, 0x01061, 0x01062, 0x01063, 0x01064, 0x01065, 0x01066, 0x01067,
+ 0x01068, 0x01069, 0x0106a, 0x0106b, 0x0106c, 0x0106d, 0x0106e, 0x0106f,
+ 0x01070, 0x01071, 0x01072, 0x01073, 0x01074, 0x01075, 0x01076, 0x01077,
+ 0x01078, 0x01079, 0x0107a, 0x0107b, 0x0107c, 0x0107d, 0x0107e, 0x0107f,
+ 0x01080, 0x01081, 0x01082, 0x01083, 0x01084, 0x01085, 0x01086, 0x01087,
+ 0x01088, 0x01089, 0x0108a, 0x0108b, 0x0108c, 0x00000, 0x0108e, 0x0108f,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x0109a, 0x0109b, 0x0109c, 0x0109d, 0x0109e, 0x0109f,
+ 0x010a0, 0x010a1, 0x010a2, 0x010a3, 0x010a4, 0x010a5, 0x010a6, 0x010a7,
+ 0x010a8, 0x010a9, 0x010aa, 0x010ab, 0x010ac, 0x010ad, 0x010ae, 0x010af,
+ 0x010b0, 0x010b1, 0x010b2, 0x010b3, 0x010b4, 0x010b5, 0x010b6, 0x010b7,
+ 0x010b8, 0x010b9, 0x010ba, 0x010bb, 0x010bc, 0x010bd, 0x010be, 0x010bf,
+ 0x010c0, 0x010c1, 0x010c2, 0x010c3, 0x010c4, 0x010c5, 0x010c6, 0x010c7,
+ 0x010c8, 0x010c9, 0x010ca, 0x010cb, 0x010cc, 0x010cd, 0x010ce, 0x010cf,
+ 0x010d0, 0x010d1, 0x010d2, 0x010d3, 0x010d4, 0x010d5, 0x010d6, 0x010d7,
+ 0x010d8, 0x010d9, 0x010da, 0x010db, 0x010dc, 0x010dd, 0x010de, 0x010df,
+ 0x010e0, 0x010e1, 0x010e2, 0x010e3, 0x010e4, 0x010e5, 0x010e6, 0x010e7,
+ 0x010e8, 0x010e9, 0x010ea, 0x010eb, 0x010ec, 0x010ed, 0x010ee, 0x010ef,
+ 0x010f0, 0x010f1, 0x010f2, 0x010f3, 0x010f4, 0x010f5, 0x010f6, 0x010f7,
+ 0x010f8, 0x010f9, 0x010fa, 0x010fb, 0x010dc, 0x010fd, 0x010fe, 0x010ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_13[] = {
+ 0x01300, 0x01301, 0x01302, 0x01303, 0x01304, 0x01305, 0x01306, 0x01307,
+ 0x01308, 0x01309, 0x0130a, 0x0130b, 0x0130c, 0x0130d, 0x0130e, 0x0130f,
+ 0x01310, 0x01311, 0x01312, 0x01313, 0x01314, 0x01315, 0x01316, 0x01317,
+ 0x01318, 0x01319, 0x0131a, 0x0131b, 0x0131c, 0x0131d, 0x0131e, 0x0131f,
+ 0x01320, 0x01321, 0x01322, 0x01323, 0x01324, 0x01325, 0x01326, 0x01327,
+ 0x01328, 0x01329, 0x0132a, 0x0132b, 0x0132c, 0x0132d, 0x0132e, 0x0132f,
+ 0x01330, 0x01331, 0x01332, 0x01333, 0x01334, 0x01335, 0x01336, 0x01337,
+ 0x01338, 0x01339, 0x0133a, 0x0133b, 0x0133c, 0x0133d, 0x0133e, 0x0133f,
+ 0x01340, 0x01341, 0x01342, 0x01343, 0x01344, 0x01345, 0x01346, 0x01347,
+ 0x01348, 0x01349, 0x0134a, 0x0134b, 0x0134c, 0x0134d, 0x0134e, 0x0134f,
+ 0x01350, 0x01351, 0x01352, 0x01353, 0x01354, 0x01355, 0x01356, 0x01357,
+ 0x01358, 0x01359, 0x0135a, 0x0135b, 0x0135c, 0x0135d, 0x0135e, 0x00000,
+ 0x01360, 0x01361, 0x01362, 0x01363, 0x01364, 0x01365, 0x01366, 0x01367,
+ 0x01368, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x01372, 0x01373, 0x01374, 0x01375, 0x01376, 0x01377,
+ 0x01378, 0x01379, 0x0137a, 0x0137b, 0x0137c, 0x0137d, 0x0137e, 0x0137f,
+ 0x01380, 0x01381, 0x01382, 0x01383, 0x01384, 0x01385, 0x01386, 0x01387,
+ 0x01388, 0x01389, 0x0138a, 0x0138b, 0x0138c, 0x0138d, 0x0138e, 0x0138f,
+ 0x01390, 0x01391, 0x01392, 0x01393, 0x01394, 0x01395, 0x01396, 0x01397,
+ 0x01398, 0x01399, 0x0139a, 0x0139b, 0x0139c, 0x0139d, 0x0139e, 0x0139f,
+ 0x013a0, 0x013a1, 0x013a2, 0x013a3, 0x013a4, 0x013a5, 0x013a6, 0x013a7,
+ 0x013a8, 0x013a9, 0x013aa, 0x013ab, 0x013ac, 0x013ad, 0x013ae, 0x013af,
+ 0x013b0, 0x013b1, 0x013b2, 0x013b3, 0x013b4, 0x013b5, 0x013b6, 0x013b7,
+ 0x013b8, 0x013b9, 0x013ba, 0x013bb, 0x013bc, 0x013bd, 0x013be, 0x013bf,
+ 0x013c0, 0x013c1, 0x013c2, 0x013c3, 0x013c4, 0x013c5, 0x013c6, 0x013c7,
+ 0x013c8, 0x013c9, 0x013ca, 0x013cb, 0x013cc, 0x013cd, 0x013ce, 0x013cf,
+ 0x013d0, 0x013d1, 0x013d2, 0x013d3, 0x013d4, 0x013d5, 0x013d6, 0x013d7,
+ 0x013d8, 0x013d9, 0x013da, 0x013db, 0x013dc, 0x013dd, 0x013de, 0x013df,
+ 0x013e0, 0x013e1, 0x013e2, 0x013e3, 0x013e4, 0x013e5, 0x013e6, 0x013e7,
+ 0x013e8, 0x013e9, 0x013ea, 0x013eb, 0x013ec, 0x013ed, 0x013ee, 0x013ef,
+ 0x013f0, 0x013f1, 0x013f2, 0x013f3, 0x013f4, 0x013f5, 0x013f6, 0x013f7,
+ 0x013f8, 0x013f9, 0x013fa, 0x013fb, 0x013fc, 0x013fd, 0x013fe, 0x013ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_16[] = {
+ 0x01600, 0x01601, 0x01602, 0x01603, 0x01604, 0x01605, 0x01606, 0x01607,
+ 0x01608, 0x01609, 0x0160a, 0x0160b, 0x0160c, 0x0160d, 0x0160e, 0x0160f,
+ 0x01610, 0x01611, 0x01612, 0x01613, 0x01614, 0x01615, 0x01616, 0x01617,
+ 0x01618, 0x01619, 0x0161a, 0x0161b, 0x0161c, 0x0161d, 0x0161e, 0x0161f,
+ 0x01620, 0x01621, 0x01622, 0x01623, 0x01624, 0x01625, 0x01626, 0x01627,
+ 0x01628, 0x01629, 0x0162a, 0x0162b, 0x0162c, 0x0162d, 0x0162e, 0x0162f,
+ 0x01630, 0x01631, 0x01632, 0x01633, 0x01634, 0x01635, 0x01636, 0x01637,
+ 0x01638, 0x01639, 0x0163a, 0x0163b, 0x0163c, 0x0163d, 0x0163e, 0x0163f,
+ 0x01640, 0x01641, 0x01642, 0x01643, 0x01644, 0x01645, 0x01646, 0x01647,
+ 0x01648, 0x01649, 0x0164a, 0x0164b, 0x0164c, 0x0164d, 0x0164e, 0x0164f,
+ 0x01650, 0x01651, 0x01652, 0x01653, 0x01654, 0x01655, 0x01656, 0x01657,
+ 0x01658, 0x01659, 0x0165a, 0x0165b, 0x0165c, 0x0165d, 0x0165e, 0x0165f,
+ 0x01660, 0x01661, 0x01662, 0x01663, 0x01664, 0x01665, 0x01666, 0x01667,
+ 0x01668, 0x01669, 0x0166a, 0x0166b, 0x0166c, 0x0166d, 0x0166e, 0x0166f,
+ 0x01670, 0x01671, 0x01672, 0x01673, 0x01674, 0x01675, 0x01676, 0x01677,
+ 0x01678, 0x01679, 0x0167a, 0x0167b, 0x0167c, 0x0167d, 0x0167e, 0x0167f,
+ 0x01680, 0x01681, 0x01682, 0x01683, 0x01684, 0x01685, 0x01686, 0x01687,
+ 0x01688, 0x01689, 0x0168a, 0x0168b, 0x0168c, 0x0168d, 0x0168e, 0x0168f,
+ 0x01690, 0x01691, 0x01692, 0x01693, 0x01694, 0x01695, 0x01696, 0x01697,
+ 0x01698, 0x01699, 0x0169a, 0x0169b, 0x0169c, 0x0169d, 0x0169e, 0x0169f,
+ 0x016a0, 0x016a0, 0x016a2, 0x016a3, 0x016a2, 0x016a2, 0x016a6, 0x016a6,
+ 0x016a8, 0x016a8, 0x016aa, 0x016ab, 0x016a8, 0x016a8, 0x016a8, 0x016af,
+ 0x016b0, 0x016b1, 0x016b2, 0x016b2, 0x016b2, 0x016b2, 0x016b2, 0x016b7,
+ 0x016b8, 0x016b9, 0x016ba, 0x016ba, 0x016ba, 0x016ba, 0x016be, 0x016be,
+ 0x016be, 0x016c1, 0x016c1, 0x016c3, 0x016c3, 0x016c5, 0x016c5, 0x016c7,
+ 0x016c8, 0x016c9, 0x016ca, 0x016ca, 0x016ca, 0x016ca, 0x016ca, 0x016cf,
+ 0x016cf, 0x016cf, 0x016d2, 0x016d2, 0x016d2, 0x016c8, 0x016d6, 0x016d7,
+ 0x016d7, 0x016d7, 0x016da, 0x016da, 0x016dc, 0x016dc, 0x016de, 0x016df,
+ 0x016e0, 0x016e1, 0x016e2, 0x016e3, 0x016e4, 0x016e5, 0x016e6, 0x016e6,
+ 0x016e6, 0x016b9, 0x016ca, 0x016eb, 0x016ec, 0x016ed, 0x016ee, 0x016ef,
+ 0x016f0, 0x016f1, 0x016f2, 0x016f3, 0x016f4, 0x016f5, 0x016f6, 0x016f7,
+ 0x016f8, 0x016f9, 0x016fa, 0x016fb, 0x016fc, 0x016fd, 0x016fe, 0x016ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_17[] = {
+ 0x01700, 0x01701, 0x01702, 0x01703, 0x01704, 0x01705, 0x01706, 0x01707,
+ 0x01708, 0x01709, 0x0170a, 0x0170b, 0x0170c, 0x0170d, 0x0170e, 0x0170f,
+ 0x01710, 0x01711, 0x01712, 0x01713, 0x01714, 0x01715, 0x01716, 0x01717,
+ 0x01718, 0x01719, 0x0171a, 0x0171b, 0x0171c, 0x0171d, 0x0171e, 0x0171f,
+ 0x01720, 0x01721, 0x01722, 0x01723, 0x01724, 0x01725, 0x01726, 0x01727,
+ 0x01728, 0x01729, 0x0172a, 0x0172b, 0x0172c, 0x0172d, 0x0172e, 0x0172f,
+ 0x01730, 0x01731, 0x01732, 0x01733, 0x01734, 0x01735, 0x01736, 0x01737,
+ 0x01738, 0x01739, 0x0173a, 0x0173b, 0x0173c, 0x0173d, 0x0173e, 0x0173f,
+ 0x01740, 0x01741, 0x01742, 0x01743, 0x01744, 0x01745, 0x01746, 0x01747,
+ 0x01748, 0x01749, 0x0174a, 0x0174b, 0x0174c, 0x0174d, 0x0174e, 0x0174f,
+ 0x01750, 0x01751, 0x01752, 0x01753, 0x01754, 0x01755, 0x01756, 0x01757,
+ 0x01758, 0x01759, 0x0175a, 0x0175b, 0x0175c, 0x0175d, 0x0175e, 0x0175f,
+ 0x01760, 0x01761, 0x01762, 0x01763, 0x01764, 0x01765, 0x01766, 0x01767,
+ 0x01768, 0x01769, 0x0176a, 0x0176b, 0x0176c, 0x0176d, 0x0176e, 0x0176f,
+ 0x01770, 0x01771, 0x01772, 0x01773, 0x01774, 0x01775, 0x01776, 0x01777,
+ 0x01778, 0x01779, 0x0177a, 0x0177b, 0x0177c, 0x0177d, 0x0177e, 0x0177f,
+ 0x01780, 0x01781, 0x01782, 0x01783, 0x01784, 0x01785, 0x01786, 0x01787,
+ 0x01788, 0x01789, 0x0178a, 0x0178b, 0x0178c, 0x0178d, 0x0178e, 0x0178f,
+ 0x01790, 0x01791, 0x01792, 0x01793, 0x01794, 0x01795, 0x01796, 0x01797,
+ 0x01798, 0x01799, 0x0179a, 0x0179b, 0x0179c, 0x0179d, 0x0179e, 0x0179f,
+ 0x017a0, 0x017a1, 0x017a2, 0x017a3, 0x017a4, 0x017a5, 0x017a6, 0x017a7,
+ 0x017a8, 0x017a9, 0x017aa, 0x017ab, 0x017ac, 0x017ad, 0x017ae, 0x017af,
+ 0x017b0, 0x017b1, 0x017b2, 0x017b3, 0x017b4, 0x017b5, 0x017b6, 0x017b7,
+ 0x017b8, 0x017b9, 0x017ba, 0x017bb, 0x017bc, 0x017bd, 0x017be, 0x017bf,
+ 0x017c0, 0x017c1, 0x017c2, 0x017c3, 0x017c4, 0x017c5, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x017d2, 0x00000, 0x017d4, 0x017d5, 0x017d6, 0x017d7,
+ 0x017d8, 0x017d9, 0x017da, 0x017db, 0x017dc, 0x00000, 0x017de, 0x017df,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x017ea, 0x017eb, 0x017ec, 0x017ed, 0x017ee, 0x017ef,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x017fa, 0x017fb, 0x017fc, 0x017fd, 0x017fe, 0x017ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_18[] = {
+ 0x01800, 0x01801, 0x01802, 0x01803, 0x01804, 0x01805, 0x01806, 0x01807,
+ 0x01808, 0x01809, 0x0180a, 0x00000, 0x00000, 0x00000, 0x0180e, 0x0180f,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x0181a, 0x0181b, 0x0181c, 0x0181d, 0x0181e, 0x0181f,
+ 0x01820, 0x01821, 0x01822, 0x01823, 0x01824, 0x01825, 0x01826, 0x01827,
+ 0x01828, 0x01829, 0x0182a, 0x0182b, 0x0182c, 0x0182d, 0x0182e, 0x0182f,
+ 0x01830, 0x01831, 0x01832, 0x01833, 0x01834, 0x01835, 0x01836, 0x01837,
+ 0x01838, 0x01839, 0x0183a, 0x0183b, 0x0183c, 0x0183d, 0x0183e, 0x0183f,
+ 0x01840, 0x01841, 0x01842, 0x01843, 0x01844, 0x01845, 0x01846, 0x01847,
+ 0x01848, 0x01849, 0x0184a, 0x0184b, 0x0184c, 0x0184d, 0x0184e, 0x0184f,
+ 0x01850, 0x01851, 0x01852, 0x01853, 0x01854, 0x01855, 0x01856, 0x01857,
+ 0x01858, 0x01859, 0x0185a, 0x0185b, 0x0185c, 0x0185d, 0x0185e, 0x0185f,
+ 0x01860, 0x01861, 0x01862, 0x01863, 0x01864, 0x01865, 0x01866, 0x01867,
+ 0x01868, 0x01869, 0x0186a, 0x0186b, 0x0186c, 0x0186d, 0x0186e, 0x0186f,
+ 0x01870, 0x01871, 0x01872, 0x01873, 0x01874, 0x01875, 0x01876, 0x01877,
+ 0x01878, 0x01879, 0x0187a, 0x0187b, 0x0187c, 0x0187d, 0x0187e, 0x0187f,
+ 0x01880, 0x01881, 0x01882, 0x01883, 0x01884, 0x01885, 0x01886, 0x01887,
+ 0x01888, 0x01889, 0x0188a, 0x0188b, 0x0188c, 0x0188d, 0x0188e, 0x0188f,
+ 0x01890, 0x01891, 0x01892, 0x01893, 0x01894, 0x01895, 0x01896, 0x01897,
+ 0x01898, 0x01899, 0x0189a, 0x0189b, 0x0189c, 0x0189d, 0x0189e, 0x0189f,
+ 0x018a0, 0x018a1, 0x018a2, 0x018a3, 0x018a4, 0x018a5, 0x018a6, 0x018a7,
+ 0x018a8, 0x018a9, 0x018aa, 0x018ab, 0x018ac, 0x018ad, 0x018ae, 0x018af,
+ 0x018b0, 0x018b1, 0x018b2, 0x018b3, 0x018b4, 0x018b5, 0x018b6, 0x018b7,
+ 0x018b8, 0x018b9, 0x018ba, 0x018bb, 0x018bc, 0x018bd, 0x018be, 0x018bf,
+ 0x018c0, 0x018c1, 0x018c2, 0x018c3, 0x018c4, 0x018c5, 0x018c6, 0x018c7,
+ 0x018c8, 0x018c9, 0x018ca, 0x018cb, 0x018cc, 0x018cd, 0x018ce, 0x018cf,
+ 0x018d0, 0x018d1, 0x018d2, 0x018d3, 0x018d4, 0x018d5, 0x018d6, 0x018d7,
+ 0x018d8, 0x018d9, 0x018da, 0x018db, 0x018dc, 0x018dd, 0x018de, 0x018df,
+ 0x018e0, 0x018e1, 0x018e2, 0x018e3, 0x018e4, 0x018e5, 0x018e6, 0x018e7,
+ 0x018e8, 0x018e9, 0x018ea, 0x018eb, 0x018ec, 0x018ed, 0x018ee, 0x018ef,
+ 0x018f0, 0x018f1, 0x018f2, 0x018f3, 0x018f4, 0x018f5, 0x018f6, 0x018f7,
+ 0x018f8, 0x018f9, 0x018fa, 0x018fb, 0x018fc, 0x018fd, 0x018fe, 0x018ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_19[] = {
+ 0x01900, 0x01901, 0x01902, 0x01903, 0x01904, 0x01905, 0x01906, 0x01907,
+ 0x01908, 0x01909, 0x0190a, 0x0190b, 0x0190c, 0x0190d, 0x0190e, 0x0190f,
+ 0x01910, 0x01911, 0x01912, 0x01913, 0x01914, 0x01915, 0x01916, 0x01917,
+ 0x01918, 0x01919, 0x0191a, 0x0191b, 0x0191c, 0x0191d, 0x0191e, 0x0191f,
+ 0x01920, 0x01921, 0x01922, 0x01923, 0x01924, 0x01925, 0x01926, 0x01927,
+ 0x01928, 0x01929, 0x0192a, 0x0192b, 0x0192c, 0x0192d, 0x0192e, 0x0192f,
+ 0x01930, 0x01931, 0x01932, 0x01933, 0x01934, 0x01935, 0x01936, 0x01937,
+ 0x01938, 0x00000, 0x00000, 0x00000, 0x0193c, 0x0193d, 0x0193e, 0x0193f,
+ 0x01940, 0x01941, 0x01942, 0x01943, 0x01944, 0x01945, 0x00030, 0x00031,
+ 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037, 0x00038, 0x00039,
+ 0x01950, 0x01951, 0x01952, 0x01953, 0x01954, 0x01955, 0x01956, 0x01957,
+ 0x01958, 0x01959, 0x0195a, 0x0195b, 0x0195c, 0x0195d, 0x0195e, 0x0195f,
+ 0x01960, 0x01961, 0x01962, 0x01963, 0x01964, 0x01965, 0x01966, 0x01967,
+ 0x01968, 0x01969, 0x0196a, 0x0196b, 0x0196c, 0x0196d, 0x0196e, 0x0196f,
+ 0x01970, 0x01971, 0x01972, 0x01973, 0x01974, 0x01975, 0x01976, 0x01977,
+ 0x01978, 0x01979, 0x0197a, 0x0197b, 0x0197c, 0x0197d, 0x0197e, 0x0197f,
+ 0x01980, 0x01981, 0x01982, 0x01983, 0x01984, 0x01985, 0x01986, 0x01987,
+ 0x01988, 0x01989, 0x0198a, 0x0198b, 0x0198c, 0x0198d, 0x0198e, 0x0198f,
+ 0x01990, 0x01991, 0x01992, 0x01993, 0x01994, 0x01995, 0x01996, 0x01997,
+ 0x01998, 0x01999, 0x0199a, 0x0199b, 0x0199c, 0x0199d, 0x0199e, 0x0199f,
+ 0x019a0, 0x019a1, 0x019a2, 0x019a3, 0x019a4, 0x019a5, 0x019a6, 0x019a7,
+ 0x019a8, 0x019a9, 0x019aa, 0x019ab, 0x019ac, 0x019ad, 0x019ae, 0x019af,
+ 0x019b0, 0x019b1, 0x019b2, 0x019b3, 0x019b4, 0x019b5, 0x019b6, 0x019b7,
+ 0x019b8, 0x019b9, 0x019ba, 0x019bb, 0x019bc, 0x019bd, 0x019be, 0x019bf,
+ 0x019c0, 0x019c1, 0x019c2, 0x019c3, 0x019c4, 0x019c5, 0x019c6, 0x019c7,
+ 0x019c8, 0x019c9, 0x019ca, 0x019cb, 0x019cc, 0x019cd, 0x019ce, 0x019cf,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x00031, 0x019db, 0x019dc, 0x019dd, 0x019de, 0x019df,
+ 0x019e0, 0x019e1, 0x019e2, 0x019e3, 0x019e4, 0x019e5, 0x019e6, 0x019e7,
+ 0x019e8, 0x019e9, 0x019ea, 0x019eb, 0x019ec, 0x019ed, 0x019ee, 0x019ef,
+ 0x019f0, 0x019f1, 0x019f2, 0x019f3, 0x019f4, 0x019f5, 0x019f6, 0x019f7,
+ 0x019f8, 0x019f9, 0x019fa, 0x019fb, 0x019fc, 0x019fd, 0x019fe, 0x019ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_1a[] = {
+ 0x01a00, 0x01a01, 0x01a02, 0x01a03, 0x01a04, 0x01a05, 0x01a06, 0x01a07,
+ 0x01a08, 0x01a09, 0x01a0a, 0x01a0b, 0x01a0c, 0x01a0d, 0x01a0e, 0x01a0f,
+ 0x01a10, 0x01a11, 0x01a12, 0x01a13, 0x01a14, 0x01a15, 0x01a16, 0x01a17,
+ 0x01a18, 0x01a19, 0x01a1a, 0x01a1b, 0x01a1c, 0x01a1d, 0x01a1e, 0x01a1f,
+ 0x01a20, 0x01a21, 0x01a22, 0x01a23, 0x01a24, 0x01a25, 0x01a26, 0x01a27,
+ 0x01a28, 0x01a29, 0x01a2a, 0x01a2b, 0x01a2c, 0x01a2d, 0x01a2e, 0x01a2f,
+ 0x01a30, 0x01a31, 0x01a32, 0x01a33, 0x01a34, 0x01a35, 0x01a36, 0x01a37,
+ 0x01a38, 0x01a39, 0x01a3a, 0x01a3b, 0x01a3c, 0x01a3d, 0x01a3e, 0x01a3f,
+ 0x01a40, 0x01a41, 0x01a42, 0x01a43, 0x01a44, 0x01a45, 0x01a46, 0x01a47,
+ 0x01a48, 0x01a49, 0x01a4a, 0x01a4b, 0x01a4c, 0x01a4d, 0x01a4e, 0x01a4f,
+ 0x01a50, 0x01a51, 0x01a52, 0x01a53, 0x01a54, 0x01a55, 0x01a56, 0x01a57,
+ 0x01a26, 0x01a26, 0x01a3b, 0x01a3b, 0x01a5c, 0x01a5d, 0x01a5e, 0x01a5f,
+ 0x01a60, 0x01a61, 0x01a62, 0x01a63, 0x01a63, 0x01a65, 0x01a66, 0x01a67,
+ 0x01a68, 0x01a69, 0x01a6a, 0x01a6b, 0x01a6c, 0x01a6d, 0x01a6e, 0x01a6f,
+ 0x01a70, 0x01a71, 0x01a72, 0x01a73, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x01a7d, 0x01a7e, 0x00000,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x01a8a, 0x01a8b, 0x01a8c, 0x01a8d, 0x01a8e, 0x01a8f,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x01a9a, 0x01a9b, 0x01a9c, 0x01a9d, 0x01a9e, 0x01a9f,
+ 0x01aa0, 0x01aa1, 0x01aa2, 0x01aa3, 0x01aa4, 0x01aa5, 0x01aa6, 0x01aa7,
+ 0x01aa8, 0x01aa9, 0x01aaa, 0x01aab, 0x01aac, 0x01aad, 0x01aae, 0x01aaf,
+ 0x01ab0, 0x01ab1, 0x01ab2, 0x01ab3, 0x01ab4, 0x01ab5, 0x01ab6, 0x01ab7,
+ 0x01ab8, 0x01ab9, 0x01aba, 0x01abb, 0x01abc, 0x01abd, 0x01abe, 0x01abf,
+ 0x01ac0, 0x01ac1, 0x01ac2, 0x01ac3, 0x01ac4, 0x01ac5, 0x01ac6, 0x01ac7,
+ 0x01ac8, 0x01ac9, 0x01aca, 0x01acb, 0x01acc, 0x01acd, 0x01ace, 0x01acf,
+ 0x01ad0, 0x01ad1, 0x01ad2, 0x01ad3, 0x01ad4, 0x01ad5, 0x01ad6, 0x01ad7,
+ 0x01ad8, 0x01ad9, 0x01ada, 0x01adb, 0x01adc, 0x01add, 0x01ade, 0x01adf,
+ 0x01ae0, 0x01ae1, 0x01ae2, 0x01ae3, 0x01ae4, 0x01ae5, 0x01ae6, 0x01ae7,
+ 0x01ae8, 0x01ae9, 0x01aea, 0x01aeb, 0x01aec, 0x01aed, 0x01aee, 0x01aef,
+ 0x01af0, 0x01af1, 0x01af2, 0x01af3, 0x01af4, 0x01af5, 0x01af6, 0x01af7,
+ 0x01af8, 0x01af9, 0x01afa, 0x01afb, 0x01afc, 0x01afd, 0x01afe, 0x01aff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_1b[] = {
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x01b05, 0x01b06, 0x01b07,
+ 0x01b08, 0x01b09, 0x01b0a, 0x01b0b, 0x01b0c, 0x01b0d, 0x01b0e, 0x01b0f,
+ 0x01b10, 0x01b11, 0x01b12, 0x01b13, 0x01b14, 0x01b15, 0x01b16, 0x01b17,
+ 0x01b18, 0x01b19, 0x01b1a, 0x01b1b, 0x01b1c, 0x01b1d, 0x01b1e, 0x01b1f,
+ 0x01b20, 0x01b21, 0x01b22, 0x01b23, 0x01b24, 0x01b25, 0x01b26, 0x01b27,
+ 0x01b28, 0x01b29, 0x01b2a, 0x01b2b, 0x01b2c, 0x01b2d, 0x01b2e, 0x01b2f,
+ 0x01b30, 0x01b31, 0x01b32, 0x01b33, 0x00000, 0x01b35, 0x01b36, 0x01b37,
+ 0x01b38, 0x01b39, 0x01b3a, 0x01b3b, 0x01b3c, 0x01b3d, 0x01b3e, 0x01b3f,
+ 0x01b40, 0x01b41, 0x01b42, 0x01b43, 0x01b44, 0x01b45, 0x01b46, 0x01b47,
+ 0x01b48, 0x01b49, 0x01b4a, 0x01b4b, 0x01b4c, 0x01b4d, 0x01b4e, 0x01b4f,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x01b5a, 0x01b5b, 0x01b5c, 0x01b5d, 0x01b5e, 0x01b5f,
+ 0x01b60, 0x01b61, 0x01b62, 0x01b63, 0x01b64, 0x01b65, 0x01b66, 0x01b67,
+ 0x01b68, 0x01b69, 0x01b6a, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x01b74, 0x01b75, 0x01b76, 0x01b77,
+ 0x01b78, 0x01b79, 0x01b7a, 0x01b7b, 0x01b7c, 0x01b7d, 0x01b7e, 0x01b7f,
+ 0x00000, 0x00000, 0x00000, 0x01b83, 0x01b84, 0x01b85, 0x01b86, 0x01b87,
+ 0x01b88, 0x01b89, 0x01b8a, 0x01b8b, 0x01b8c, 0x01b8d, 0x01b8e, 0x01b8f,
+ 0x01b90, 0x01b91, 0x01b92, 0x01b93, 0x01b94, 0x01b95, 0x01b96, 0x01b97,
+ 0x01b98, 0x01b99, 0x01b9a, 0x01b9b, 0x01b9c, 0x01b9d, 0x01b9e, 0x01b9f,
+ 0x01ba0, 0x01ba1, 0x01ba2, 0x01ba3, 0x01ba4, 0x01ba5, 0x01ba6, 0x01ba7,
+ 0x01ba8, 0x01ba9, 0x01baa, 0x01bab, 0x01bac, 0x01bad, 0x01bae, 0x01baf,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x01bba, 0x01bbb, 0x01bbc, 0x01bbd, 0x01bbe, 0x01bbf,
+ 0x01bc0, 0x01bc1, 0x01bc2, 0x01bc3, 0x01bc4, 0x01bc5, 0x01bc6, 0x01bc7,
+ 0x01bc8, 0x01bc9, 0x01bca, 0x01bcb, 0x01bcc, 0x01bcd, 0x01bce, 0x01bcf,
+ 0x01bd0, 0x01bd1, 0x01bd2, 0x01bd3, 0x01bd4, 0x01bd5, 0x01bd6, 0x01bd7,
+ 0x01bd8, 0x01bd9, 0x01bda, 0x01bdb, 0x01bdc, 0x01bdd, 0x01bde, 0x01bdf,
+ 0x01be0, 0x01be1, 0x01be2, 0x01be3, 0x01be4, 0x01be5, 0x01be6, 0x01be7,
+ 0x01be8, 0x01be9, 0x01bea, 0x01beb, 0x01bec, 0x01bed, 0x01bee, 0x01bef,
+ 0x01bf0, 0x01bf1, 0x01bf2, 0x01bf3, 0x01bf4, 0x01bf5, 0x01bf6, 0x01bf7,
+ 0x01bf8, 0x01bf9, 0x01bfa, 0x01bfb, 0x01bfc, 0x01bfd, 0x01bfe, 0x01bff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_1c[] = {
+ 0x01c00, 0x01c01, 0x01c02, 0x01c03, 0x01c04, 0x01c05, 0x01c06, 0x01c07,
+ 0x01c08, 0x01c09, 0x01c0a, 0x01c0b, 0x01c0c, 0x01c0d, 0x01c0e, 0x01c0f,
+ 0x01c10, 0x01c11, 0x01c12, 0x01c13, 0x01c14, 0x01c15, 0x01c16, 0x01c17,
+ 0x01c18, 0x01c19, 0x01c1a, 0x01c1b, 0x01c1c, 0x01c1d, 0x01c1e, 0x01c1f,
+ 0x01c20, 0x01c21, 0x01c22, 0x01c23, 0x01c24, 0x01c25, 0x01c26, 0x01c27,
+ 0x01c28, 0x01c29, 0x01c2a, 0x01c2b, 0x01c2c, 0x01c2d, 0x01c2e, 0x01c2f,
+ 0x01c30, 0x01c31, 0x01c32, 0x01c33, 0x01c34, 0x01c35, 0x01c36, 0x00000,
+ 0x01c38, 0x01c39, 0x01c3a, 0x01c3b, 0x01c3c, 0x01c3d, 0x01c3e, 0x01c3f,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x01c4a, 0x01c4b, 0x01c4c, 0x01c4d, 0x01c4e, 0x01c4f,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x01c5a, 0x01c5b, 0x01c5c, 0x01c5d, 0x01c5e, 0x01c5f,
+ 0x01c60, 0x01c61, 0x01c62, 0x01c63, 0x01c64, 0x01c65, 0x01c66, 0x01c67,
+ 0x01c68, 0x01c69, 0x01c6a, 0x01c6b, 0x01c6c, 0x01c6d, 0x01c6e, 0x01c6f,
+ 0x01c70, 0x01c71, 0x01c72, 0x01c73, 0x01c74, 0x01c75, 0x01c76, 0x01c77,
+ 0x01c78, 0x01c79, 0x01c7a, 0x01c7b, 0x01c7c, 0x01c7d, 0x01c7e, 0x01c7f,
+ 0x01c80, 0x01c81, 0x01c82, 0x01c83, 0x01c84, 0x01c85, 0x01c86, 0x01c87,
+ 0x01c88, 0x01c89, 0x01c8a, 0x01c8b, 0x01c8c, 0x01c8d, 0x01c8e, 0x01c8f,
+ 0x01c90, 0x01c91, 0x01c92, 0x01c93, 0x01c94, 0x01c95, 0x01c96, 0x01c97,
+ 0x01c98, 0x01c99, 0x01c9a, 0x01c9b, 0x01c9c, 0x01c9d, 0x01c9e, 0x01c9f,
+ 0x01ca0, 0x01ca1, 0x01ca2, 0x01ca3, 0x01ca4, 0x01ca5, 0x01ca6, 0x01ca7,
+ 0x01ca8, 0x01ca9, 0x01caa, 0x01cab, 0x01cac, 0x01cad, 0x01cae, 0x01caf,
+ 0x01cb0, 0x01cb1, 0x01cb2, 0x01cb3, 0x01cb4, 0x01cb5, 0x01cb6, 0x01cb7,
+ 0x01cb8, 0x01cb9, 0x01cba, 0x01cbb, 0x01cbc, 0x01cbd, 0x01cbe, 0x01cbf,
+ 0x01cc0, 0x01cc1, 0x01cc2, 0x01cc3, 0x01cc4, 0x01cc5, 0x01cc6, 0x01cc7,
+ 0x01cc8, 0x01cc9, 0x01cca, 0x01ccb, 0x01ccc, 0x01ccd, 0x01cce, 0x01ccf,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x01ce9, 0x01ce9, 0x01ce9, 0x01ce9, 0x00000, 0x01ce9, 0x01ce9,
+ 0x01ce9, 0x01ce9, 0x00000, 0x01cf3, 0x01cf4, 0x01cf5, 0x01cf6, 0x01cf7,
+ 0x01cf8, 0x01cf9, 0x01cfa, 0x01cfb, 0x01cfc, 0x01cfd, 0x01cfe, 0x01cff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_1d[] = {
+ 0x01d00, 0x01d01, 0x01d02, 0x01d03, 0x01d04, 0x01d05, 0x01d06, 0x01d07,
+ 0x01d08, 0x01d09, 0x01d0a, 0x01d0b, 0x01d0c, 0x01d0d, 0x01d0e, 0x01d0f,
+ 0x01d10, 0x01d11, 0x01d12, 0x01d13, 0x01d14, 0x01d15, 0x01d16, 0x01d17,
+ 0x01d18, 0x01d19, 0x01d1a, 0x01d1b, 0x01d1c, 0x01d1d, 0x01d1e, 0x01d1f,
+ 0x01d20, 0x01d21, 0x01d22, 0x01d23, 0x01d24, 0x01d25, 0x01d26, 0x01d27,
+ 0x01d28, 0x01d29, 0x01d2a, 0x01d2b, 0x00041, 0x000c6, 0x00042, 0x01d2f,
+ 0x00044, 0x00045, 0x0018e, 0x00047, 0x00048, 0x00049, 0x0004a, 0x0004b,
+ 0x0004c, 0x0004d, 0x0004e, 0x01d3b, 0x0004f, 0x00222, 0x00050, 0x00052,
+ 0x00054, 0x00055, 0x00057, 0x00041, 0x00250, 0x00251, 0x01d02, 0x00042,
+ 0x00044, 0x00045, 0x0018f, 0x00190, 0x01d08, 0x00047, 0x01d09, 0x0004b,
+ 0x0004d, 0x0014a, 0x0004f, 0x00186, 0x01d16, 0x01d17, 0x00050, 0x00054,
+ 0x00055, 0x01d1d, 0x0019c, 0x00056, 0x01d25, 0x00392, 0x00393, 0x00394,
+ 0x003a6, 0x003a7, 0x00049, 0x00052, 0x00055, 0x00056, 0x00392, 0x00393,
+ 0x003a1, 0x003a6, 0x003a7, 0x01d6b, 0x01d6c, 0x01d6d, 0x01d6e, 0x01d6f,
+ 0x01d70, 0x01d71, 0x01d72, 0x01d73, 0x01d74, 0x01d75, 0x01d76, 0x01d77,
+ 0x0041d, 0x00047, 0x01d7a, 0x01d7b, 0x01d7c, 0x01d7d, 0x01d7e, 0x01d7f,
+ 0x01d80, 0x01d81, 0x01d82, 0x01d83, 0x01d84, 0x01d85, 0x01d86, 0x01d87,
+ 0x01d88, 0x01d89, 0x01d8a, 0x01d8b, 0x01d8c, 0x01d8d, 0x01d8e, 0x01d8f,
+ 0x01d90, 0x01d91, 0x01d92, 0x01d93, 0x01d94, 0x01d95, 0x01d96, 0x01d97,
+ 0x01d98, 0x01d99, 0x01d9a, 0x00252, 0x00043, 0x00255, 0x00044, 0x0025c,
+ 0x00046, 0x0025f, 0x00261, 0x00265, 0x00197, 0x00196, 0x0026a, 0x01d7b,
+ 0x0029d, 0x0026d, 0x01d85, 0x0029f, 0x00271, 0x00270, 0x0019d, 0x00273,
+ 0x00274, 0x0019f, 0x00278, 0x00282, 0x001a9, 0x001ab, 0x00244, 0x001b1,
+ 0x01d1c, 0x001b2, 0x00245, 0x0005a, 0x00290, 0x00291, 0x001b7, 0x00398,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00052, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x01dd2, 0x00041, 0x000c6, 0x01dd5, 0x01dd6, 0x00043,
+ 0x00044, 0x00044, 0x00047, 0x00262, 0x0004b, 0x0004c, 0x0029f, 0x01d0d,
+ 0x0004e, 0x00274, 0x001a6, 0x01de3, 0x00053, 0x00053, 0x0005a, 0x01de7,
+ 0x01de8, 0x01de9, 0x01dea, 0x01deb, 0x01dec, 0x01ded, 0x01dee, 0x01def,
+ 0x01df0, 0x01df1, 0x01df2, 0x01df3, 0x01df4, 0x01df5, 0x01df6, 0x01df7,
+ 0x01df8, 0x01df9, 0x01dfa, 0x01dfb, 0x01dfc, 0x00000, 0x00000, 0x01dff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_1e[] = {
+ 0x00041, 0x00041, 0x00042, 0x00042, 0x00042, 0x00042, 0x00042, 0x00042,
+ 0x00043, 0x00043, 0x00044, 0x00044, 0x00044, 0x00044, 0x00044, 0x00044,
+ 0x00044, 0x00044, 0x00044, 0x00044, 0x00045, 0x00045, 0x00045, 0x00045,
+ 0x00045, 0x00045, 0x00045, 0x00045, 0x00045, 0x00045, 0x00046, 0x00046,
+ 0x00047, 0x00047, 0x00048, 0x00048, 0x00048, 0x00048, 0x00048, 0x00048,
+ 0x00048, 0x00048, 0x00048, 0x00048, 0x00049, 0x00049, 0x00049, 0x00049,
+ 0x0004b, 0x0004b, 0x0004b, 0x0004b, 0x0004b, 0x0004b, 0x0004c, 0x0004c,
+ 0x0004c, 0x0004c, 0x0004c, 0x0004c, 0x0004c, 0x0004c, 0x0004d, 0x0004d,
+ 0x0004d, 0x0004d, 0x0004d, 0x0004d, 0x0004e, 0x0004e, 0x0004e, 0x0004e,
+ 0x0004e, 0x0004e, 0x0004e, 0x0004e, 0x0004f, 0x0004f, 0x0004f, 0x0004f,
+ 0x0004f, 0x0004f, 0x0004f, 0x0004f, 0x00050, 0x00050, 0x00050, 0x00050,
+ 0x00052, 0x00052, 0x00052, 0x00052, 0x00052, 0x00052, 0x00052, 0x00052,
+ 0x00053, 0x00053, 0x00053, 0x00053, 0x00053, 0x00053, 0x00053, 0x00053,
+ 0x00053, 0x00053, 0x00054, 0x00054, 0x00054, 0x00054, 0x00054, 0x00054,
+ 0x00054, 0x00054, 0x00055, 0x00055, 0x00055, 0x00055, 0x00055, 0x00055,
+ 0x00055, 0x00055, 0x00055, 0x00055, 0x00056, 0x00056, 0x00056, 0x00056,
+ 0x00057, 0x00057, 0x00057, 0x00057, 0x00057, 0x00057, 0x00057, 0x00057,
+ 0x00057, 0x00057, 0x00058, 0x00058, 0x00058, 0x00058, 0x00059, 0x00059,
+ 0x0005a, 0x0005a, 0x0005a, 0x0005a, 0x0005a, 0x0005a, 0x00048, 0x00054,
+ 0x00057, 0x00059, 0x01e9a, 0x00053, 0x01e9c, 0x01e9d, 0x000df, 0x01e9f,
+ 0x00041, 0x00041, 0x00041, 0x00041, 0x00041, 0x00041, 0x00041, 0x00041,
+ 0x00041, 0x00041, 0x00041, 0x00041, 0x00041, 0x00041, 0x00041, 0x00041,
+ 0x00041, 0x00041, 0x00041, 0x00041, 0x00041, 0x00041, 0x00041, 0x00041,
+ 0x00045, 0x00045, 0x00045, 0x00045, 0x00045, 0x00045, 0x00045, 0x00045,
+ 0x00045, 0x00045, 0x00045, 0x00045, 0x00045, 0x00045, 0x00045, 0x00045,
+ 0x00049, 0x00049, 0x00049, 0x00049, 0x0004f, 0x0004f, 0x0004f, 0x0004f,
+ 0x0004f, 0x0004f, 0x0004f, 0x0004f, 0x0004f, 0x0004f, 0x0004f, 0x0004f,
+ 0x0004f, 0x0004f, 0x0004f, 0x0004f, 0x0004f, 0x0004f, 0x0004f, 0x0004f,
+ 0x0004f, 0x0004f, 0x0004f, 0x0004f, 0x00055, 0x00055, 0x00055, 0x00055,
+ 0x00055, 0x00055, 0x00055, 0x00055, 0x00055, 0x00055, 0x00055, 0x00055,
+ 0x00055, 0x00055, 0x00059, 0x00059, 0x00059, 0x00059, 0x00059, 0x00059,
+ 0x00059, 0x00059, 0x01efa, 0x01efa, 0x01efc, 0x01efc, 0x01efe, 0x01eff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_1f[] = {
+ 0x00391, 0x00391, 0x00391, 0x00391, 0x00391, 0x00391, 0x00391, 0x00391,
+ 0x00391, 0x00391, 0x00391, 0x00391, 0x00391, 0x00391, 0x00391, 0x00391,
+ 0x00395, 0x00395, 0x00395, 0x00395, 0x00395, 0x00395, 0x01f16, 0x01f17,
+ 0x00395, 0x00395, 0x00395, 0x00395, 0x00395, 0x00395, 0x01f1e, 0x01f1f,
+ 0x00397, 0x00397, 0x00397, 0x00397, 0x00397, 0x00397, 0x00397, 0x00397,
+ 0x00397, 0x00397, 0x00397, 0x00397, 0x00397, 0x00397, 0x00397, 0x00397,
+ 0x00399, 0x00399, 0x00399, 0x00399, 0x00399, 0x00399, 0x00399, 0x00399,
+ 0x00399, 0x00399, 0x00399, 0x00399, 0x00399, 0x00399, 0x00399, 0x00399,
+ 0x0039f, 0x0039f, 0x0039f, 0x0039f, 0x0039f, 0x0039f, 0x01f46, 0x01f47,
+ 0x0039f, 0x0039f, 0x0039f, 0x0039f, 0x0039f, 0x0039f, 0x01f4e, 0x01f4f,
+ 0x003a5, 0x003a5, 0x003a5, 0x003a5, 0x003a5, 0x003a5, 0x003a5, 0x003a5,
+ 0x01f58, 0x003a5, 0x01f5a, 0x003a5, 0x01f5c, 0x003a5, 0x01f5e, 0x003a5,
+ 0x003a9, 0x003a9, 0x003a9, 0x003a9, 0x003a9, 0x003a9, 0x003a9, 0x003a9,
+ 0x003a9, 0x003a9, 0x003a9, 0x003a9, 0x003a9, 0x003a9, 0x003a9, 0x003a9,
+ 0x00391, 0x00391, 0x00395, 0x00395, 0x00397, 0x00397, 0x00399, 0x00399,
+ 0x0039f, 0x0039f, 0x003a5, 0x003a5, 0x003a9, 0x003a9, 0x01f7e, 0x01f7f,
+ 0x00391, 0x00391, 0x00391, 0x00391, 0x00391, 0x00391, 0x00391, 0x00391,
+ 0x00391, 0x00391, 0x00391, 0x00391, 0x00391, 0x00391, 0x00391, 0x00391,
+ 0x00397, 0x00397, 0x00397, 0x00397, 0x00397, 0x00397, 0x00397, 0x00397,
+ 0x00397, 0x00397, 0x00397, 0x00397, 0x00397, 0x00397, 0x00397, 0x00397,
+ 0x003a9, 0x003a9, 0x003a9, 0x003a9, 0x003a9, 0x003a9, 0x003a9, 0x003a9,
+ 0x003a9, 0x003a9, 0x003a9, 0x003a9, 0x003a9, 0x003a9, 0x003a9, 0x003a9,
+ 0x00391, 0x00391, 0x00391, 0x00391, 0x00391, 0x01fb5, 0x00391, 0x00391,
+ 0x00391, 0x00391, 0x00391, 0x00391, 0x00391, 0x01fbd, 0x00399, 0x01fbd,
+ 0x01fc0, 0x000a8, 0x00397, 0x00397, 0x00397, 0x01fc5, 0x00397, 0x00397,
+ 0x00395, 0x00395, 0x00397, 0x00397, 0x00397, 0x01fbd, 0x01fbd, 0x01fbd,
+ 0x00399, 0x00399, 0x00399, 0x00399, 0x01fd4, 0x01fd5, 0x00399, 0x00399,
+ 0x00399, 0x00399, 0x00399, 0x00399, 0x01fdc, 0x01fdd, 0x01fdd, 0x01fdd,
+ 0x003a5, 0x003a5, 0x003a5, 0x003a5, 0x003a1, 0x003a1, 0x003a5, 0x003a5,
+ 0x003a5, 0x003a5, 0x003a5, 0x003a5, 0x003a1, 0x000a8, 0x000a8, 0x00060,
+ 0x01ff0, 0x01ff1, 0x003a9, 0x003a9, 0x003a9, 0x01ff5, 0x003a9, 0x003a9,
+ 0x0039f, 0x0039f, 0x003a9, 0x003a9, 0x003a9, 0x000b4, 0x01fdd, 0x01fff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_20[] = {
+ 0x00020, 0x00020, 0x00020, 0x00020, 0x00020, 0x00020, 0x00020, 0x00020,
+ 0x00020, 0x00020, 0x00020, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x02010, 0x02010, 0x02012, 0x02013, 0x02014, 0x02015, 0x02016, 0x02017,
+ 0x02018, 0x02019, 0x0201a, 0x0201b, 0x0201c, 0x0201d, 0x0201e, 0x0201f,
+ 0x02020, 0x02021, 0x02022, 0x02023, 0x0002e, 0x02025, 0x02026, 0x02027,
+ 0x02028, 0x02029, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00020,
+ 0x02030, 0x02031, 0x02032, 0x02033, 0x02034, 0x02035, 0x02036, 0x02037,
+ 0x02038, 0x02039, 0x0203a, 0x0203b, 0x0203c, 0x0203d, 0x0203e, 0x0203f,
+ 0x02040, 0x02041, 0x02042, 0x02043, 0x02044, 0x02045, 0x02046, 0x02047,
+ 0x02048, 0x02049, 0x0204a, 0x0204b, 0x0204c, 0x0204d, 0x0204e, 0x0204f,
+ 0x02050, 0x02051, 0x02052, 0x02053, 0x02054, 0x02055, 0x02056, 0x02057,
+ 0x02058, 0x02059, 0x0205a, 0x0205b, 0x0205c, 0x0205d, 0x0205e, 0x00020,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x02065, 0x02066, 0x02067,
+ 0x02068, 0x02069, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00030, 0x00049, 0x02072, 0x02073, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x0002b, 0x0207b, 0x0003d, 0x00028, 0x00029, 0x0004e,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x0002b, 0x0207b, 0x0003d, 0x00028, 0x00029, 0x0208f,
+ 0x00041, 0x00045, 0x0004f, 0x00058, 0x0018f, 0x02095, 0x02096, 0x02097,
+ 0x02098, 0x02099, 0x0209a, 0x0209b, 0x0209c, 0x0209d, 0x0209e, 0x0209f,
+ 0x020a0, 0x020a1, 0x020a2, 0x020a3, 0x020a4, 0x020a5, 0x020a6, 0x020a7,
+ 0x020a8, 0x020a9, 0x020aa, 0x020ab, 0x020ac, 0x020ad, 0x020ae, 0x020af,
+ 0x020b0, 0x020b1, 0x020b2, 0x020b3, 0x020b4, 0x020b5, 0x020b6, 0x020b7,
+ 0x020b8, 0x020b9, 0x020ba, 0x020bb, 0x020bc, 0x020bd, 0x020be, 0x020bf,
+ 0x020c0, 0x020c1, 0x020c2, 0x020c3, 0x020c4, 0x020c5, 0x020c6, 0x020c7,
+ 0x020c8, 0x020c9, 0x020ca, 0x020cb, 0x020cc, 0x020cd, 0x020ce, 0x020cf,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x020f1, 0x020f2, 0x020f3, 0x020f4, 0x020f5, 0x020f6, 0x020f7,
+ 0x020f8, 0x020f9, 0x020fa, 0x020fb, 0x020fc, 0x020fd, 0x020fe, 0x020ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_21[] = {
+ 0x02100, 0x02101, 0x00043, 0x02103, 0x02104, 0x02105, 0x02106, 0x00190,
+ 0x02108, 0x02109, 0x00047, 0x00048, 0x00048, 0x00048, 0x00048, 0x00048,
+ 0x00049, 0x00049, 0x0004c, 0x0004c, 0x02114, 0x0004e, 0x02116, 0x02117,
+ 0x02118, 0x00050, 0x00051, 0x00052, 0x00052, 0x00052, 0x0211e, 0x0211f,
+ 0x02120, 0x02121, 0x02122, 0x02123, 0x0005a, 0x02125, 0x003a9, 0x02127,
+ 0x0005a, 0x02129, 0x0004b, 0x00041, 0x00042, 0x00043, 0x0212e, 0x00045,
+ 0x00045, 0x00046, 0x02132, 0x0004d, 0x0004f, 0x005d0, 0x005d1, 0x005d2,
+ 0x005d3, 0x00049, 0x0213a, 0x0213b, 0x003a0, 0x00393, 0x00393, 0x003a0,
+ 0x02140, 0x02141, 0x02142, 0x02143, 0x02144, 0x00044, 0x00044, 0x00045,
+ 0x00049, 0x0004a, 0x0214a, 0x0214b, 0x0214c, 0x0214d, 0x02132, 0x0214f,
+ 0x02150, 0x02151, 0x02152, 0x02153, 0x02154, 0x02155, 0x02156, 0x02157,
+ 0x02158, 0x02159, 0x0215a, 0x0215b, 0x0215c, 0x0215d, 0x0215e, 0x0215f,
+ 0x00049, 0x02161, 0x02162, 0x02163, 0x00056, 0x02165, 0x02166, 0x02167,
+ 0x02168, 0x00058, 0x0216a, 0x0216b, 0x0004c, 0x00043, 0x00044, 0x0004d,
+ 0x00049, 0x02161, 0x02162, 0x02163, 0x00056, 0x02165, 0x02166, 0x02167,
+ 0x02168, 0x00058, 0x0216a, 0x0216b, 0x0004c, 0x00043, 0x00044, 0x0004d,
+ 0x02180, 0x02181, 0x02182, 0x02183, 0x02183, 0x00036, 0x02186, 0x02187,
+ 0x02188, 0x02189, 0x0218a, 0x0218b, 0x0218c, 0x0218d, 0x0218e, 0x0218f,
+ 0x02190, 0x02191, 0x02192, 0x02193, 0x02194, 0x02195, 0x02196, 0x02197,
+ 0x02198, 0x02199, 0x02190, 0x02192, 0x0219c, 0x0219d, 0x0219e, 0x0219f,
+ 0x021a0, 0x021a1, 0x021a2, 0x021a3, 0x021a4, 0x021a5, 0x021a6, 0x021a7,
+ 0x021a8, 0x021a9, 0x021aa, 0x021ab, 0x021ac, 0x021ad, 0x02194, 0x021af,
+ 0x021b0, 0x021b1, 0x021b2, 0x021b3, 0x021b4, 0x021b5, 0x021b6, 0x021b7,
+ 0x021b8, 0x021b9, 0x021ba, 0x021bb, 0x021bc, 0x021bd, 0x021be, 0x021bf,
+ 0x021c0, 0x021c1, 0x021c2, 0x021c3, 0x021c4, 0x021c5, 0x021c6, 0x021c7,
+ 0x021c8, 0x021c9, 0x021ca, 0x021cb, 0x021cc, 0x021cd, 0x021ce, 0x021cf,
+ 0x021cd, 0x021d1, 0x021cf, 0x021d3, 0x021ce, 0x021d5, 0x021d6, 0x021d7,
+ 0x021d8, 0x021d9, 0x021da, 0x021db, 0x021dc, 0x021dd, 0x021de, 0x021df,
+ 0x021e0, 0x021e1, 0x021e2, 0x021e3, 0x021e4, 0x021e5, 0x021e6, 0x021e7,
+ 0x021e8, 0x021e9, 0x021ea, 0x021eb, 0x021ec, 0x021ed, 0x021ee, 0x021ef,
+ 0x021f0, 0x021f1, 0x021f2, 0x021f3, 0x021f4, 0x021f5, 0x021f6, 0x021f7,
+ 0x021f8, 0x021f9, 0x021fa, 0x021fb, 0x021fc, 0x021fd, 0x021fe, 0x021ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_22[] = {
+ 0x02200, 0x02201, 0x02202, 0x02203, 0x02203, 0x02205, 0x02206, 0x02207,
+ 0x02208, 0x02208, 0x0220a, 0x0220b, 0x0220b, 0x0220d, 0x0220e, 0x0220f,
+ 0x02210, 0x02140, 0x0207b, 0x02213, 0x02214, 0x02215, 0x02216, 0x02217,
+ 0x02218, 0x02219, 0x0221a, 0x0221b, 0x0221c, 0x0221d, 0x0221e, 0x0221f,
+ 0x02220, 0x02221, 0x02222, 0x02223, 0x02223, 0x02225, 0x02225, 0x02227,
+ 0x02228, 0x02229, 0x0222a, 0x0222b, 0x0222c, 0x0222d, 0x0222e, 0x0222f,
+ 0x02230, 0x02231, 0x02232, 0x02233, 0x02234, 0x02235, 0x02236, 0x02237,
+ 0x02238, 0x02239, 0x0223a, 0x0223b, 0x0223c, 0x0223d, 0x0223e, 0x0223f,
+ 0x02240, 0x0223c, 0x02242, 0x02243, 0x02243, 0x02245, 0x02246, 0x02245,
+ 0x02248, 0x02248, 0x0224a, 0x0224b, 0x0224c, 0x0224d, 0x0224e, 0x0224f,
+ 0x02250, 0x02251, 0x02252, 0x02253, 0x02254, 0x02255, 0x02256, 0x02257,
+ 0x02258, 0x02259, 0x0225a, 0x0225b, 0x0225c, 0x0225d, 0x0225e, 0x0225f,
+ 0x0003d, 0x02261, 0x02261, 0x02263, 0x02264, 0x02265, 0x02266, 0x02267,
+ 0x02268, 0x02269, 0x0226a, 0x0226b, 0x0226c, 0x0224d, 0x0003c, 0x0003e,
+ 0x02264, 0x02265, 0x02272, 0x02273, 0x02272, 0x02273, 0x02276, 0x02277,
+ 0x02276, 0x02277, 0x0227a, 0x0227b, 0x0227c, 0x0227d, 0x0227e, 0x0227f,
+ 0x0227a, 0x0227b, 0x02282, 0x02283, 0x02282, 0x02283, 0x02286, 0x02287,
+ 0x02286, 0x02287, 0x0228a, 0x0228b, 0x0228c, 0x0228d, 0x0228e, 0x0228f,
+ 0x02290, 0x02291, 0x02292, 0x02293, 0x02294, 0x02295, 0x02296, 0x02297,
+ 0x02298, 0x02299, 0x0229a, 0x0229b, 0x0229c, 0x0229d, 0x0229e, 0x0229f,
+ 0x022a0, 0x022a1, 0x022a2, 0x022a3, 0x022a4, 0x022a5, 0x022a6, 0x022a7,
+ 0x022a8, 0x022a9, 0x022aa, 0x022ab, 0x022a2, 0x022a8, 0x022a9, 0x022ab,
+ 0x022b0, 0x022b1, 0x022b2, 0x022b3, 0x022b4, 0x022b5, 0x022b6, 0x022b7,
+ 0x022b8, 0x022b9, 0x022ba, 0x022bb, 0x022bc, 0x022bd, 0x022be, 0x022bf,
+ 0x022c0, 0x022c1, 0x022c2, 0x022c3, 0x022c4, 0x022c5, 0x022c6, 0x022c7,
+ 0x022c8, 0x022c9, 0x022ca, 0x022cb, 0x022cc, 0x022cd, 0x022ce, 0x022cf,
+ 0x022d0, 0x022d1, 0x022d2, 0x022d3, 0x022d4, 0x022d5, 0x022d6, 0x022d7,
+ 0x022d8, 0x022d9, 0x022da, 0x022db, 0x022dc, 0x022dd, 0x022de, 0x022df,
+ 0x0227c, 0x0227d, 0x02291, 0x02292, 0x022e4, 0x022e5, 0x022e6, 0x022e7,
+ 0x022e8, 0x022e9, 0x022b2, 0x022b3, 0x022b4, 0x022b5, 0x022ee, 0x022ef,
+ 0x022f0, 0x022f1, 0x022f2, 0x022f3, 0x022f4, 0x022f5, 0x022f6, 0x022f7,
+ 0x022f8, 0x022f9, 0x022fa, 0x022fb, 0x022fc, 0x022fd, 0x022fe, 0x022ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_24[] = {
+ 0x02400, 0x02401, 0x02402, 0x02403, 0x02404, 0x02405, 0x02406, 0x02407,
+ 0x02408, 0x02409, 0x0240a, 0x0240b, 0x0240c, 0x0240d, 0x0240e, 0x0240f,
+ 0x02410, 0x02411, 0x02412, 0x02413, 0x02414, 0x02415, 0x02416, 0x02417,
+ 0x02418, 0x02419, 0x0241a, 0x0241b, 0x0241c, 0x0241d, 0x0241e, 0x0241f,
+ 0x02420, 0x02421, 0x02422, 0x02423, 0x02424, 0x02425, 0x02426, 0x02427,
+ 0x02428, 0x02429, 0x0242a, 0x0242b, 0x0242c, 0x0242d, 0x0242e, 0x0242f,
+ 0x02430, 0x02431, 0x02432, 0x02433, 0x02434, 0x02435, 0x02436, 0x02437,
+ 0x02438, 0x02439, 0x0243a, 0x0243b, 0x0243c, 0x0243d, 0x0243e, 0x0243f,
+ 0x02440, 0x02441, 0x02442, 0x02443, 0x02444, 0x02445, 0x02446, 0x02447,
+ 0x02448, 0x02449, 0x0244a, 0x0244b, 0x0244c, 0x0244d, 0x0244e, 0x0244f,
+ 0x02450, 0x02451, 0x02452, 0x02453, 0x02454, 0x02455, 0x02456, 0x02457,
+ 0x02458, 0x02459, 0x0245a, 0x0245b, 0x0245c, 0x0245d, 0x0245e, 0x0245f,
+ 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037, 0x00038,
+ 0x00039, 0x02469, 0x0246a, 0x0246b, 0x0246c, 0x0246d, 0x0246e, 0x0246f,
+ 0x02470, 0x02471, 0x02472, 0x02473, 0x02474, 0x02475, 0x02476, 0x02477,
+ 0x02478, 0x02479, 0x0247a, 0x0247b, 0x0247c, 0x0247d, 0x0247e, 0x0247f,
+ 0x02480, 0x02481, 0x02482, 0x02483, 0x02484, 0x02485, 0x02486, 0x02487,
+ 0x02488, 0x02489, 0x0248a, 0x0248b, 0x0248c, 0x0248d, 0x0248e, 0x0248f,
+ 0x02490, 0x02491, 0x02492, 0x02493, 0x02494, 0x02495, 0x02496, 0x02497,
+ 0x02498, 0x02499, 0x0249a, 0x0249b, 0x0249c, 0x0249d, 0x0249e, 0x0249f,
+ 0x024a0, 0x024a1, 0x024a2, 0x024a3, 0x024a4, 0x024a5, 0x024a6, 0x024a7,
+ 0x024a8, 0x024a9, 0x024aa, 0x024ab, 0x024ac, 0x024ad, 0x024ae, 0x024af,
+ 0x024b0, 0x024b1, 0x024b2, 0x024b3, 0x024b4, 0x024b5, 0x00041, 0x00042,
+ 0x00043, 0x00044, 0x00045, 0x00046, 0x00047, 0x00048, 0x00049, 0x0004a,
+ 0x0004b, 0x0004c, 0x0004d, 0x0004e, 0x0004f, 0x00050, 0x00051, 0x00052,
+ 0x00053, 0x00054, 0x00055, 0x00056, 0x00057, 0x00058, 0x00059, 0x0005a,
+ 0x00041, 0x00042, 0x00043, 0x00044, 0x00045, 0x00046, 0x00047, 0x00048,
+ 0x00049, 0x0004a, 0x0004b, 0x0004c, 0x0004d, 0x0004e, 0x0004f, 0x00050,
+ 0x00051, 0x00052, 0x00053, 0x00054, 0x00055, 0x00056, 0x00057, 0x00058,
+ 0x00059, 0x0005a, 0x00030, 0x0246a, 0x0246b, 0x0246c, 0x0246d, 0x0246e,
+ 0x0246f, 0x02470, 0x02471, 0x02472, 0x02473, 0x00031, 0x00032, 0x00033,
+ 0x00034, 0x00035, 0x00036, 0x00037, 0x00038, 0x00039, 0x02469, 0x024ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_27[] = {
+ 0x02700, 0x02701, 0x02702, 0x02703, 0x02704, 0x02705, 0x02706, 0x02707,
+ 0x02708, 0x02709, 0x0270a, 0x0270b, 0x0270c, 0x0270d, 0x0270e, 0x0270f,
+ 0x02710, 0x02711, 0x02712, 0x02713, 0x02714, 0x02715, 0x02716, 0x02717,
+ 0x02718, 0x02719, 0x0271a, 0x0271b, 0x0271c, 0x0271d, 0x0271e, 0x0271f,
+ 0x02720, 0x02721, 0x02722, 0x02723, 0x02724, 0x02725, 0x02726, 0x02727,
+ 0x02728, 0x02729, 0x0272a, 0x0272b, 0x0272c, 0x0272d, 0x0272e, 0x0272f,
+ 0x02730, 0x02731, 0x02732, 0x02733, 0x02734, 0x02735, 0x02736, 0x02737,
+ 0x02738, 0x02739, 0x0273a, 0x0273b, 0x0273c, 0x0273d, 0x0273e, 0x0273f,
+ 0x02740, 0x02741, 0x02742, 0x02743, 0x02744, 0x02745, 0x02746, 0x02747,
+ 0x02748, 0x02749, 0x0274a, 0x0274b, 0x0274c, 0x0274d, 0x0274e, 0x0274f,
+ 0x02750, 0x02751, 0x02752, 0x02753, 0x02754, 0x02755, 0x02756, 0x02757,
+ 0x02758, 0x02759, 0x0275a, 0x0275b, 0x0275c, 0x0275d, 0x0275e, 0x0275f,
+ 0x02760, 0x02761, 0x02762, 0x02763, 0x02764, 0x02765, 0x02766, 0x02767,
+ 0x02768, 0x02769, 0x0276a, 0x0276b, 0x0276c, 0x0276d, 0x0276e, 0x0276f,
+ 0x02770, 0x02771, 0x02772, 0x02773, 0x02774, 0x02775, 0x00031, 0x00032,
+ 0x00033, 0x00034, 0x00035, 0x00036, 0x00037, 0x00038, 0x00039, 0x02469,
+ 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037, 0x00038,
+ 0x00039, 0x02469, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036,
+ 0x00037, 0x00038, 0x00039, 0x02469, 0x02794, 0x02795, 0x02796, 0x02797,
+ 0x02798, 0x02799, 0x0279a, 0x0279b, 0x0279c, 0x0279d, 0x0279e, 0x0279f,
+ 0x027a0, 0x027a1, 0x027a2, 0x027a3, 0x027a4, 0x027a5, 0x027a6, 0x027a7,
+ 0x027a8, 0x027a9, 0x027aa, 0x027ab, 0x027ac, 0x027ad, 0x027ae, 0x027af,
+ 0x027b0, 0x027b1, 0x027b2, 0x027b3, 0x027b4, 0x027b5, 0x027b6, 0x027b7,
+ 0x027b8, 0x027b9, 0x027ba, 0x027bb, 0x027bc, 0x027bd, 0x027be, 0x027bf,
+ 0x027c0, 0x027c1, 0x027c2, 0x027c3, 0x027c4, 0x027c5, 0x027c6, 0x027c7,
+ 0x027c8, 0x027c9, 0x027ca, 0x027cb, 0x027cc, 0x027cd, 0x027ce, 0x027cf,
+ 0x027d0, 0x027d1, 0x027d2, 0x027d3, 0x027d4, 0x027d5, 0x027d6, 0x027d7,
+ 0x027d8, 0x027d9, 0x027da, 0x027db, 0x027dc, 0x027dd, 0x027de, 0x027df,
+ 0x027e0, 0x027e1, 0x027e2, 0x027e3, 0x027e4, 0x027e5, 0x027e6, 0x027e7,
+ 0x027e8, 0x027e9, 0x027ea, 0x027eb, 0x027ec, 0x027ed, 0x027ee, 0x027ef,
+ 0x027f0, 0x027f1, 0x027f2, 0x027f3, 0x027f4, 0x027f5, 0x027f6, 0x027f7,
+ 0x027f8, 0x027f9, 0x027fa, 0x027fb, 0x027fc, 0x027fd, 0x027fe, 0x027ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_2a[] = {
+ 0x02a00, 0x02a01, 0x02a02, 0x02a03, 0x02a04, 0x02a05, 0x02a06, 0x02a07,
+ 0x02a08, 0x02a09, 0x02a0a, 0x02a0b, 0x02a0c, 0x02a0d, 0x02a0e, 0x02a0f,
+ 0x02a10, 0x02a11, 0x02a12, 0x02a13, 0x02a14, 0x02a15, 0x02a16, 0x02a17,
+ 0x02a18, 0x02a19, 0x02a1a, 0x02a1b, 0x02a1c, 0x02a1d, 0x02a1e, 0x02a1f,
+ 0x02a20, 0x02a21, 0x02a22, 0x02a23, 0x02a24, 0x02a25, 0x02a26, 0x02a27,
+ 0x02a28, 0x02a29, 0x02a2a, 0x02a2b, 0x02a2c, 0x02a2d, 0x02a2e, 0x02a2f,
+ 0x02a30, 0x02a31, 0x02a32, 0x02a33, 0x02a34, 0x02a35, 0x02a36, 0x02a37,
+ 0x02a38, 0x02a39, 0x02a3a, 0x02a3b, 0x02a3c, 0x02a3d, 0x02a3e, 0x02a3f,
+ 0x02a40, 0x02a41, 0x02a42, 0x02a43, 0x02a44, 0x02a45, 0x02a46, 0x02a47,
+ 0x02a48, 0x02a49, 0x02a4a, 0x02a4b, 0x02a4c, 0x02a4d, 0x02a4e, 0x02a4f,
+ 0x02a50, 0x02a51, 0x02a52, 0x02a53, 0x02a54, 0x02a55, 0x02a56, 0x02a57,
+ 0x02a58, 0x02a59, 0x02a5a, 0x02a5b, 0x02a5c, 0x02a5d, 0x02a5e, 0x02a5f,
+ 0x02a60, 0x02a61, 0x02a62, 0x02a63, 0x02a64, 0x02a65, 0x02a66, 0x02a67,
+ 0x02a68, 0x02a69, 0x02a6a, 0x02a6b, 0x02a6c, 0x02a6d, 0x02a6e, 0x02a6f,
+ 0x02a70, 0x02a71, 0x02a72, 0x02a73, 0x02a74, 0x02a75, 0x02a76, 0x02a77,
+ 0x02a78, 0x02a79, 0x02a7a, 0x02a7b, 0x02a7c, 0x02a7d, 0x02a7e, 0x02a7f,
+ 0x02a80, 0x02a81, 0x02a82, 0x02a83, 0x02a84, 0x02a85, 0x02a86, 0x02a87,
+ 0x02a88, 0x02a89, 0x02a8a, 0x02a8b, 0x02a8c, 0x02a8d, 0x02a8e, 0x02a8f,
+ 0x02a90, 0x02a91, 0x02a92, 0x02a93, 0x02a94, 0x02a95, 0x02a96, 0x02a97,
+ 0x02a98, 0x02a99, 0x02a9a, 0x02a9b, 0x02a9c, 0x02a9d, 0x02a9e, 0x02a9f,
+ 0x02aa0, 0x02aa1, 0x02aa2, 0x02aa3, 0x02aa4, 0x02aa5, 0x02aa6, 0x02aa7,
+ 0x02aa8, 0x02aa9, 0x02aaa, 0x02aab, 0x02aac, 0x02aad, 0x02aae, 0x02aaf,
+ 0x02ab0, 0x02ab1, 0x02ab2, 0x02ab3, 0x02ab4, 0x02ab5, 0x02ab6, 0x02ab7,
+ 0x02ab8, 0x02ab9, 0x02aba, 0x02abb, 0x02abc, 0x02abd, 0x02abe, 0x02abf,
+ 0x02ac0, 0x02ac1, 0x02ac2, 0x02ac3, 0x02ac4, 0x02ac5, 0x02ac6, 0x02ac7,
+ 0x02ac8, 0x02ac9, 0x02aca, 0x02acb, 0x02acc, 0x02acd, 0x02ace, 0x02acf,
+ 0x02ad0, 0x02ad1, 0x02ad2, 0x02ad3, 0x02ad4, 0x02ad5, 0x02ad6, 0x02ad7,
+ 0x02ad8, 0x02ad9, 0x02ada, 0x02adb, 0x02adc, 0x02adc, 0x02ade, 0x02adf,
+ 0x02ae0, 0x02ae1, 0x02ae2, 0x02ae3, 0x02ae4, 0x02ae5, 0x02ae6, 0x02ae7,
+ 0x02ae8, 0x02ae9, 0x02aea, 0x02aeb, 0x02aec, 0x02aed, 0x02aee, 0x02aef,
+ 0x02af0, 0x02af1, 0x02af2, 0x02af3, 0x02af4, 0x02af5, 0x02af6, 0x02af7,
+ 0x02af8, 0x02af9, 0x02afa, 0x02afb, 0x02afc, 0x02afd, 0x02afe, 0x02aff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_2c[] = {
+ 0x02c00, 0x02c01, 0x02c02, 0x02c03, 0x02c04, 0x02c05, 0x02c06, 0x02c07,
+ 0x02c08, 0x02c09, 0x02c0a, 0x02c0b, 0x02c0c, 0x02c0d, 0x02c0e, 0x02c0f,
+ 0x02c10, 0x02c11, 0x02c12, 0x02c13, 0x02c14, 0x02c15, 0x02c16, 0x02c17,
+ 0x02c18, 0x02c19, 0x02c1a, 0x02c1b, 0x02c1c, 0x02c1d, 0x02c1e, 0x02c1f,
+ 0x02c20, 0x02c21, 0x02c22, 0x02c23, 0x02c24, 0x02c25, 0x02c26, 0x02c27,
+ 0x02c28, 0x02c29, 0x02c2a, 0x02c2b, 0x02c2c, 0x02c2d, 0x02c2e, 0x02c2f,
+ 0x02c00, 0x02c01, 0x02c02, 0x02c03, 0x02c04, 0x02c05, 0x02c06, 0x02c07,
+ 0x02c08, 0x02c09, 0x02c0a, 0x02c0b, 0x02c0c, 0x02c0d, 0x02c0e, 0x02c0f,
+ 0x02c10, 0x02c11, 0x02c12, 0x02c13, 0x02c14, 0x02c15, 0x02c16, 0x02c17,
+ 0x02c18, 0x02c19, 0x02c1a, 0x02c1b, 0x02c1c, 0x02c1d, 0x02c1e, 0x02c1f,
+ 0x02c20, 0x02c21, 0x02c22, 0x02c23, 0x02c24, 0x02c25, 0x02c26, 0x02c27,
+ 0x02c28, 0x02c29, 0x02c2a, 0x02c2b, 0x02c2c, 0x02c2d, 0x02c2e, 0x02c5f,
+ 0x02c60, 0x02c60, 0x0026b, 0x01d7d, 0x0027d, 0x0023a, 0x0023e, 0x02c67,
+ 0x02c67, 0x02c69, 0x02c69, 0x02c6b, 0x02c6b, 0x00251, 0x00271, 0x00250,
+ 0x00252, 0x02c71, 0x02c72, 0x02c72, 0x02c74, 0x02c75, 0x02c75, 0x02c77,
+ 0x02c78, 0x02c79, 0x02c7a, 0x02c7b, 0x0004a, 0x00056, 0x0023f, 0x00240,
+ 0x02c80, 0x02c80, 0x02c82, 0x02c82, 0x02c84, 0x02c84, 0x02c86, 0x02c86,
+ 0x02c88, 0x02c88, 0x02c8a, 0x02c8a, 0x02c8c, 0x02c8c, 0x02c8e, 0x02c8e,
+ 0x02c90, 0x02c90, 0x02c92, 0x02c92, 0x02c94, 0x02c94, 0x02c96, 0x02c96,
+ 0x02c98, 0x02c98, 0x02c9a, 0x02c9a, 0x02c9c, 0x02c9c, 0x02c9e, 0x02c9e,
+ 0x02ca0, 0x02ca0, 0x02ca2, 0x02ca2, 0x02ca4, 0x02ca4, 0x02ca6, 0x02ca6,
+ 0x02ca8, 0x02ca8, 0x02caa, 0x02caa, 0x02cac, 0x02cac, 0x02cae, 0x02cae,
+ 0x02cb0, 0x02cb0, 0x02cb2, 0x02cb2, 0x02cb4, 0x02cb4, 0x02cb6, 0x02cb6,
+ 0x02cb8, 0x02cb8, 0x02cba, 0x02cba, 0x02cbc, 0x02cbc, 0x02cbe, 0x02cbe,
+ 0x02cc0, 0x02cc0, 0x02cc2, 0x02cc2, 0x02cc4, 0x02cc4, 0x02cc6, 0x02cc6,
+ 0x02cc8, 0x02cc8, 0x02cca, 0x02cca, 0x02ccc, 0x02ccc, 0x02cce, 0x02cce,
+ 0x02cd0, 0x02cd0, 0x02cd2, 0x02cd2, 0x02cd4, 0x02cd4, 0x02cd6, 0x02cd6,
+ 0x02cd8, 0x02cd8, 0x02cda, 0x02cda, 0x02cdc, 0x02cdc, 0x02cde, 0x02cde,
+ 0x02ce0, 0x02ce0, 0x02ce2, 0x02ce2, 0x02ce4, 0x02ce5, 0x02ce6, 0x02ce7,
+ 0x02ce8, 0x02ce9, 0x02cea, 0x02ceb, 0x02ceb, 0x02ced, 0x02ced, 0x00000,
+ 0x00000, 0x00000, 0x02cf2, 0x02cf3, 0x02cf4, 0x02cf5, 0x02cf6, 0x02cf7,
+ 0x02cf8, 0x02cf9, 0x02cfa, 0x02cfb, 0x02cfc, 0x02cfd, 0x02cfe, 0x02cff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_2d[] = {
+ 0x010a0, 0x010a1, 0x010a2, 0x010a3, 0x010a4, 0x010a5, 0x010a6, 0x010a7,
+ 0x010a8, 0x010a9, 0x010aa, 0x010ab, 0x010ac, 0x010ad, 0x010ae, 0x010af,
+ 0x010b0, 0x010b1, 0x010b2, 0x010b3, 0x010b4, 0x010b5, 0x010b6, 0x010b7,
+ 0x010b8, 0x010b9, 0x010ba, 0x010bb, 0x010bc, 0x010bd, 0x010be, 0x010bf,
+ 0x010c0, 0x010c1, 0x010c2, 0x010c3, 0x010c4, 0x010c5, 0x02d26, 0x02d27,
+ 0x02d28, 0x02d29, 0x02d2a, 0x02d2b, 0x02d2c, 0x02d2d, 0x02d2e, 0x02d2f,
+ 0x02d30, 0x02d31, 0x02d32, 0x02d33, 0x02d34, 0x02d35, 0x02d36, 0x02d37,
+ 0x02d38, 0x02d39, 0x02d3a, 0x02d3b, 0x02d3c, 0x02d3d, 0x02d3e, 0x02d3f,
+ 0x02d40, 0x02d41, 0x02d42, 0x02d43, 0x02d44, 0x02d45, 0x02d46, 0x02d47,
+ 0x02d48, 0x02d49, 0x02d4a, 0x02d4b, 0x02d4c, 0x02d4d, 0x02d4e, 0x02d4f,
+ 0x02d50, 0x02d51, 0x02d52, 0x02d53, 0x02d54, 0x02d55, 0x02d56, 0x02d57,
+ 0x02d58, 0x02d59, 0x02d5a, 0x02d5b, 0x02d5c, 0x02d5d, 0x02d5e, 0x02d5f,
+ 0x02d60, 0x02d61, 0x02d62, 0x02d63, 0x02d64, 0x02d65, 0x02d66, 0x02d67,
+ 0x02d68, 0x02d69, 0x02d6a, 0x02d6b, 0x02d6c, 0x02d6d, 0x02d6e, 0x02d6f,
+ 0x02d70, 0x02d71, 0x02d72, 0x02d73, 0x02d74, 0x02d75, 0x02d76, 0x02d77,
+ 0x02d78, 0x02d79, 0x02d7a, 0x02d7b, 0x02d7c, 0x02d7d, 0x02d7e, 0x02d7f,
+ 0x02d80, 0x02d81, 0x02d82, 0x02d83, 0x02d84, 0x02d85, 0x02d86, 0x02d87,
+ 0x02d88, 0x02d89, 0x02d8a, 0x02d8b, 0x02d8c, 0x02d8d, 0x02d8e, 0x02d8f,
+ 0x02d90, 0x02d91, 0x02d92, 0x02d93, 0x02d94, 0x02d95, 0x02d96, 0x02d97,
+ 0x02d98, 0x02d99, 0x02d9a, 0x02d9b, 0x02d9c, 0x02d9d, 0x02d9e, 0x02d9f,
+ 0x02da0, 0x02da1, 0x02da2, 0x02da3, 0x02da4, 0x02da5, 0x02da6, 0x02da7,
+ 0x02da8, 0x02da9, 0x02daa, 0x02dab, 0x02dac, 0x02dad, 0x02dae, 0x02daf,
+ 0x02db0, 0x02db1, 0x02db2, 0x02db3, 0x02db4, 0x02db5, 0x02db6, 0x02db7,
+ 0x02db8, 0x02db9, 0x02dba, 0x02dbb, 0x02dbc, 0x02dbd, 0x02dbe, 0x02dbf,
+ 0x02dc0, 0x02dc1, 0x02dc2, 0x02dc3, 0x02dc4, 0x02dc5, 0x02dc6, 0x02dc7,
+ 0x02dc8, 0x02dc9, 0x02dca, 0x02dcb, 0x02dcc, 0x02dcd, 0x02dce, 0x02dcf,
+ 0x02dd0, 0x02dd1, 0x02dd2, 0x02dd3, 0x02dd4, 0x02dd5, 0x02dd6, 0x02dd7,
+ 0x02dd8, 0x02dd9, 0x02dda, 0x02ddb, 0x02ddc, 0x02ddd, 0x02dde, 0x02ddf,
+ 0x00411, 0x00412, 0x00413, 0x00414, 0x00416, 0x00417, 0x0041a, 0x0041b,
+ 0x0041c, 0x0041d, 0x0041e, 0x0041f, 0x00420, 0x00421, 0x00422, 0x00425,
+ 0x00426, 0x00427, 0x00428, 0x00429, 0x00472, 0x02df5, 0x00410, 0x00400,
+ 0x02df8, 0x02df9, 0x00462, 0x0042e, 0x02dfc, 0x00466, 0x0046a, 0x02dff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_2e[] = {
+ 0x02e00, 0x02e01, 0x02e02, 0x02e03, 0x02e04, 0x02e05, 0x02e06, 0x02e07,
+ 0x02e08, 0x02e09, 0x02e0a, 0x02e0b, 0x02e0c, 0x02e0d, 0x02e0e, 0x02e0f,
+ 0x02e10, 0x02e11, 0x02e12, 0x02e13, 0x02e14, 0x02e15, 0x02e16, 0x02e17,
+ 0x02e18, 0x02e19, 0x02e1a, 0x02e1b, 0x02e1c, 0x02e1d, 0x02e1e, 0x02e1f,
+ 0x02e20, 0x02e21, 0x02e22, 0x02e23, 0x02e24, 0x02e25, 0x02e26, 0x02e27,
+ 0x02e28, 0x02e29, 0x02e2a, 0x02e2b, 0x02e2c, 0x02e2d, 0x02e2e, 0x02e2f,
+ 0x02e30, 0x02e31, 0x02e32, 0x02e33, 0x02e34, 0x02e35, 0x02e36, 0x02e37,
+ 0x02e38, 0x02e39, 0x02e3a, 0x02e3b, 0x02e3c, 0x02e3d, 0x02e3e, 0x02e3f,
+ 0x02e40, 0x02e41, 0x02e42, 0x02e43, 0x02e44, 0x02e45, 0x02e46, 0x02e47,
+ 0x02e48, 0x02e49, 0x02e4a, 0x02e4b, 0x02e4c, 0x02e4d, 0x02e4e, 0x02e4f,
+ 0x02e50, 0x02e51, 0x02e52, 0x02e53, 0x02e54, 0x02e55, 0x02e56, 0x02e57,
+ 0x02e58, 0x02e59, 0x02e5a, 0x02e5b, 0x02e5c, 0x02e5d, 0x02e5e, 0x02e5f,
+ 0x02e60, 0x02e61, 0x02e62, 0x02e63, 0x02e64, 0x02e65, 0x02e66, 0x02e67,
+ 0x02e68, 0x02e69, 0x02e6a, 0x02e6b, 0x02e6c, 0x02e6d, 0x02e6e, 0x02e6f,
+ 0x02e70, 0x02e71, 0x02e72, 0x02e73, 0x02e74, 0x02e75, 0x02e76, 0x02e77,
+ 0x02e78, 0x02e79, 0x02e7a, 0x02e7b, 0x02e7c, 0x02e7d, 0x02e7e, 0x02e7f,
+ 0x02e80, 0x02e81, 0x02e82, 0x02e83, 0x0319a, 0x02e85, 0x02e86, 0x02f0f,
+ 0x02f11, 0x02e89, 0x02f18, 0x02e8b, 0x02f29, 0x02f29, 0x02e8e, 0x02e8f,
+ 0x02e8e, 0x02e8f, 0x02e92, 0x02e93, 0x02e94, 0x02e95, 0x02e96, 0x02f3c,
+ 0x02e98, 0x02e99, 0x02e9a, 0x02e9b, 0x02f47, 0x02f49, 0x02e9e, 0x02e9f,
+ 0x02ea0, 0x02ea1, 0x02ea2, 0x02ea3, 0x02ea4, 0x02ea4, 0x02ea6, 0x02f5c,
+ 0x02ea8, 0x02ea9, 0x02eaa, 0x02f6c, 0x02f70, 0x02ead, 0x02f75, 0x02eaf,
+ 0x02eb0, 0x02eb1, 0x02eb2, 0x02eb1, 0x02eb1, 0x02eb2, 0x02eb7, 0x02eb7,
+ 0x02eb8, 0x02eb9, 0x02eba, 0x02f80, 0x02f81, 0x02f85, 0x02ebe, 0x02ebe,
+ 0x02ebe, 0x02ec1, 0x02ec2, 0x02ec3, 0x02ec4, 0x02ec5, 0x02f93, 0x02f93,
+ 0x02ec8, 0x02ec9, 0x02f9c, 0x02ecb, 0x02ecc, 0x02ecc, 0x02ecc, 0x02fa2,
+ 0x02ed0, 0x02fa7, 0x02ed2, 0x02ed3, 0x02ed4, 0x02fa9, 0x02ed6, 0x02fac,
+ 0x02ed8, 0x02ed9, 0x02eda, 0x02edb, 0x02edc, 0x02fb7, 0x02ede, 0x02ede,
+ 0x02ee0, 0x02fb8, 0x02ee2, 0x02fbb, 0x02fc1, 0x02ee5, 0x02ee6, 0x02ee7,
+ 0x02ee8, 0x02ee9, 0x02eea, 0x02eeb, 0x02eec, 0x02eed, 0x02eee, 0x02eef,
+ 0x02ef0, 0x02ef2, 0x02ef2, 0x02ef3, 0x02ef4, 0x02ef5, 0x02ef6, 0x02ef7,
+ 0x02ef8, 0x02ef9, 0x02efa, 0x02efb, 0x02efc, 0x02efd, 0x02efe, 0x02eff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_2f[] = {
+ 0x03192, 0x02f01, 0x02e80, 0x02f03, 0x0319a, 0x02f05, 0x03193, 0x02f07,
+ 0x0319f, 0x02f09, 0x02f0a, 0x02f0b, 0x02e86, 0x02f0d, 0x02f0e, 0x02f0f,
+ 0x02f10, 0x02f11, 0x02f12, 0x02f13, 0x02f14, 0x02f15, 0x02f16, 0x02f17,
+ 0x02f18, 0x02e8b, 0x02e81, 0x02f1b, 0x02f1c, 0x02f1d, 0x02f1e, 0x02f1f,
+ 0x02f20, 0x02f21, 0x02f22, 0x02f23, 0x02f24, 0x02f25, 0x02f26, 0x02f27,
+ 0x02f28, 0x02f29, 0x02e8e, 0x02f2b, 0x02f2c, 0x02f2d, 0x02f2e, 0x02f2f,
+ 0x02f30, 0x02f31, 0x02f32, 0x02e93, 0x02f34, 0x02f35, 0x02f36, 0x02f37,
+ 0x02f38, 0x02e95, 0x02f3a, 0x02f3b, 0x02f3c, 0x02f3d, 0x02f3e, 0x02f3f,
+ 0x02f40, 0x02f41, 0x02f42, 0x02f43, 0x02f44, 0x02f45, 0x02f46, 0x02f47,
+ 0x02f48, 0x02f49, 0x02f4a, 0x02f4b, 0x02f4c, 0x02f4d, 0x02f4e, 0x02f4f,
+ 0x02f50, 0x02f51, 0x02f52, 0x02f53, 0x02f54, 0x02f55, 0x02f56, 0x02f57,
+ 0x02f58, 0x02f59, 0x02f5a, 0x02f5b, 0x02f5c, 0x02f5d, 0x02f5e, 0x02f5f,
+ 0x02f60, 0x02f61, 0x02f62, 0x02f63, 0x02f64, 0x02f65, 0x02eaa, 0x02f67,
+ 0x02f68, 0x02f69, 0x02f6a, 0x02f6b, 0x02f6c, 0x02f6d, 0x02f6e, 0x02f6f,
+ 0x02f70, 0x02f71, 0x02f72, 0x02f73, 0x02f74, 0x02f75, 0x02f76, 0x02f77,
+ 0x02f78, 0x02f79, 0x02eb7, 0x02f7b, 0x02f7c, 0x02f7d, 0x02f7e, 0x02f7f,
+ 0x02f80, 0x02f81, 0x02f82, 0x02f83, 0x02f84, 0x02f85, 0x02f86, 0x02f87,
+ 0x02f88, 0x02f89, 0x02f8a, 0x02f8b, 0x02f8c, 0x02f8d, 0x02f8e, 0x02f8f,
+ 0x02f90, 0x02f91, 0x02f92, 0x02f93, 0x02f94, 0x02f95, 0x02f96, 0x02f97,
+ 0x02f98, 0x02f99, 0x02f9a, 0x02f9b, 0x02f9c, 0x02f9d, 0x02f9e, 0x02f9f,
+ 0x02fa0, 0x02fa1, 0x02fa2, 0x02fa3, 0x02fa4, 0x02fa5, 0x02fa6, 0x02fa7,
+ 0x02fa8, 0x02fa9, 0x02faa, 0x02fab, 0x02fac, 0x02fad, 0x02fae, 0x02faf,
+ 0x02fb0, 0x02fb1, 0x02fb2, 0x02fb3, 0x02fb4, 0x02fb5, 0x02fb6, 0x02fb7,
+ 0x02fb8, 0x02fb9, 0x02fba, 0x02fbb, 0x02fbc, 0x02fbd, 0x02fbe, 0x02fbf,
+ 0x02fc0, 0x02fc1, 0x02fc2, 0x02fc3, 0x02ee7, 0x02fc5, 0x02fc6, 0x02fc7,
+ 0x02fc8, 0x02fc9, 0x02fca, 0x02fcb, 0x02fcc, 0x02fcd, 0x02fce, 0x02fcf,
+ 0x02fd0, 0x02eeb, 0x02eed, 0x02eef, 0x02ef2, 0x02fd5, 0x02fd6, 0x02fd7,
+ 0x02fd8, 0x02fd9, 0x02fda, 0x02fdb, 0x02fdc, 0x02fdd, 0x02fde, 0x02fdf,
+ 0x02fe0, 0x02fe1, 0x02fe2, 0x02fe3, 0x02fe4, 0x02fe5, 0x02fe6, 0x02fe7,
+ 0x02fe8, 0x02fe9, 0x02fea, 0x02feb, 0x02fec, 0x02fed, 0x02fee, 0x02fef,
+ 0x02ff0, 0x02ff1, 0x02ff2, 0x02ff3, 0x02ff4, 0x02ff5, 0x02ff6, 0x02ff7,
+ 0x02ff8, 0x02ff9, 0x02ffa, 0x02ffb, 0x02ffc, 0x02ffd, 0x02ffe, 0x02fff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_30[] = {
+ 0x00020, 0x03001, 0x03002, 0x03003, 0x03004, 0x03005, 0x03006, 0x00030,
+ 0x02329, 0x0232a, 0x0300a, 0x0300b, 0x0300c, 0x0300d, 0x0300e, 0x0300f,
+ 0x03010, 0x03011, 0x03012, 0x03013, 0x03014, 0x03015, 0x03016, 0x03017,
+ 0x03018, 0x03019, 0x0301a, 0x0301b, 0x0301c, 0x0301d, 0x0301e, 0x0301f,
+ 0x03020, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x03030, 0x03031, 0x03031, 0x03033, 0x03033, 0x03035, 0x03012, 0x03037,
+ 0x02f17, 0x03039, 0x0303a, 0x0303b, 0x0303c, 0x0303d, 0x0303e, 0x0303f,
+ 0x03040, 0x03041, 0x03042, 0x03043, 0x03044, 0x03045, 0x03046, 0x03047,
+ 0x03048, 0x03049, 0x0304a, 0x0304b, 0x0304c, 0x0304d, 0x0304e, 0x0304f,
+ 0x03050, 0x03051, 0x03052, 0x03053, 0x03054, 0x03055, 0x03056, 0x03057,
+ 0x03058, 0x03059, 0x0305a, 0x0305b, 0x0305c, 0x0305d, 0x0305e, 0x0305f,
+ 0x03060, 0x03061, 0x03062, 0x03063, 0x03064, 0x03065, 0x03066, 0x03067,
+ 0x03068, 0x03069, 0x0306a, 0x0306b, 0x0306c, 0x0306d, 0x0306e, 0x0306f,
+ 0x03070, 0x03071, 0x03072, 0x03073, 0x03074, 0x03075, 0x03076, 0x03077,
+ 0x03078, 0x03079, 0x0307a, 0x0307b, 0x0307c, 0x0307d, 0x0307e, 0x0307f,
+ 0x03080, 0x03081, 0x03082, 0x03083, 0x03084, 0x03085, 0x03086, 0x03087,
+ 0x03088, 0x03089, 0x0308a, 0x0308b, 0x0308c, 0x0308d, 0x0308e, 0x0308f,
+ 0x03090, 0x03091, 0x03092, 0x03093, 0x03046, 0x0304b, 0x03051, 0x03097,
+ 0x03098, 0x00000, 0x00000, 0x0309b, 0x0309c, 0x0309d, 0x0309d, 0x0309f,
+ 0x030a0, 0x03041, 0x03042, 0x03043, 0x03044, 0x03045, 0x03046, 0x03047,
+ 0x03048, 0x03049, 0x0304a, 0x0304b, 0x0304c, 0x0304d, 0x0304e, 0x0304f,
+ 0x03050, 0x03051, 0x03052, 0x03053, 0x03054, 0x03055, 0x03056, 0x03057,
+ 0x03058, 0x03059, 0x0305a, 0x0305b, 0x0305c, 0x0305d, 0x0305e, 0x0305f,
+ 0x03060, 0x03061, 0x03062, 0x03063, 0x03064, 0x03065, 0x03066, 0x03067,
+ 0x03068, 0x03069, 0x0306a, 0x0306b, 0x0306c, 0x0306d, 0x0306e, 0x0306f,
+ 0x03070, 0x03071, 0x03072, 0x03073, 0x03074, 0x03075, 0x03076, 0x03077,
+ 0x03078, 0x03079, 0x0307a, 0x0307b, 0x0307c, 0x0307d, 0x0307e, 0x0307f,
+ 0x03080, 0x03081, 0x03082, 0x03083, 0x03084, 0x03085, 0x03086, 0x03087,
+ 0x03088, 0x03089, 0x0308a, 0x0308b, 0x0308c, 0x0308d, 0x0308e, 0x0308f,
+ 0x03090, 0x03091, 0x03092, 0x03093, 0x03046, 0x0304b, 0x03051, 0x0308f,
+ 0x03090, 0x03091, 0x03092, 0x030fb, 0x030fc, 0x030fd, 0x030fd, 0x030ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_31[] = {
+ 0x03100, 0x03101, 0x03102, 0x03103, 0x03104, 0x03105, 0x03106, 0x03107,
+ 0x03108, 0x03109, 0x0310a, 0x0310b, 0x0310c, 0x0310d, 0x0310e, 0x0310f,
+ 0x03110, 0x03111, 0x03112, 0x03113, 0x03114, 0x03115, 0x03116, 0x03117,
+ 0x03118, 0x03119, 0x0311a, 0x0311b, 0x0311c, 0x0311d, 0x0311e, 0x0311f,
+ 0x03120, 0x03121, 0x03122, 0x03123, 0x03124, 0x03125, 0x03126, 0x03127,
+ 0x03128, 0x03129, 0x0312a, 0x0312b, 0x0312c, 0x0312d, 0x0312e, 0x0312f,
+ 0x03130, 0x01100, 0x01101, 0x011aa, 0x01102, 0x011ac, 0x011ad, 0x01103,
+ 0x01104, 0x01105, 0x011b0, 0x011b1, 0x011b2, 0x011b3, 0x011b4, 0x011b5,
+ 0x0111a, 0x01106, 0x01107, 0x01108, 0x01121, 0x01109, 0x0110a, 0x0110b,
+ 0x0110c, 0x0110d, 0x0110e, 0x0110f, 0x01110, 0x01111, 0x01112, 0x01161,
+ 0x01162, 0x01163, 0x01164, 0x01165, 0x01166, 0x01167, 0x01168, 0x01169,
+ 0x0116a, 0x0116b, 0x0116c, 0x0116d, 0x0116e, 0x0116f, 0x01170, 0x01171,
+ 0x01172, 0x01173, 0x01174, 0x01175, 0x01160, 0x01114, 0x01115, 0x011c7,
+ 0x011c8, 0x011cc, 0x011ce, 0x011d3, 0x011d7, 0x011d9, 0x0111c, 0x011dd,
+ 0x011df, 0x0111d, 0x0111e, 0x01120, 0x01122, 0x01123, 0x01127, 0x01129,
+ 0x0112b, 0x0112c, 0x0112d, 0x0112e, 0x0112f, 0x01132, 0x01136, 0x01140,
+ 0x01147, 0x0114c, 0x011f1, 0x011f2, 0x01157, 0x01158, 0x01159, 0x01184,
+ 0x01185, 0x01188, 0x01191, 0x01192, 0x01194, 0x0119e, 0x011a1, 0x0318f,
+ 0x03190, 0x03191, 0x03192, 0x03193, 0x03194, 0x03195, 0x03196, 0x03197,
+ 0x03198, 0x03199, 0x0319a, 0x0319b, 0x0319c, 0x0319d, 0x0319e, 0x0319f,
+ 0x03105, 0x03117, 0x03110, 0x0310d, 0x031a4, 0x031a4, 0x031a6, 0x0311b,
+ 0x03128, 0x0311a, 0x03127, 0x03128, 0x031ac, 0x031ad, 0x0311e, 0x03120,
+ 0x031b0, 0x031b1, 0x031b2, 0x03127, 0x03106, 0x0310a, 0x0310e, 0x0310f,
+ 0x031b8, 0x031b9, 0x031ba, 0x031bb, 0x031bc, 0x031bd, 0x031be, 0x031bf,
+ 0x031c0, 0x031c1, 0x031c2, 0x031c3, 0x031c4, 0x031c5, 0x031c6, 0x031c7,
+ 0x031c8, 0x031c9, 0x031ca, 0x031cb, 0x031cc, 0x031cd, 0x031ce, 0x031cf,
+ 0x031d0, 0x031d1, 0x031d2, 0x031d3, 0x031d4, 0x031d5, 0x031d6, 0x031d7,
+ 0x031d8, 0x031d9, 0x031da, 0x031db, 0x031dc, 0x031dd, 0x031de, 0x031df,
+ 0x031e0, 0x031e1, 0x031e2, 0x031e3, 0x031e4, 0x031e5, 0x031e6, 0x031e7,
+ 0x031e8, 0x031e9, 0x031ea, 0x031eb, 0x031ec, 0x031ed, 0x031ee, 0x031ef,
+ 0x0304f, 0x03057, 0x03059, 0x03068, 0x0306c, 0x0306f, 0x03072, 0x03075,
+ 0x03078, 0x0307b, 0x03080, 0x03089, 0x0308a, 0x0308b, 0x0308c, 0x031ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_32[] = {
+ 0x03200, 0x03201, 0x03202, 0x03203, 0x03204, 0x03205, 0x03206, 0x03207,
+ 0x03208, 0x03209, 0x0320a, 0x0320b, 0x0320c, 0x0320d, 0x0320e, 0x0320f,
+ 0x03210, 0x03211, 0x03212, 0x03213, 0x03214, 0x03215, 0x03216, 0x03217,
+ 0x03218, 0x03219, 0x0321a, 0x0321b, 0x0321c, 0x0321d, 0x0321e, 0x0321f,
+ 0x03220, 0x03221, 0x03222, 0x03223, 0x03224, 0x03225, 0x03226, 0x03227,
+ 0x03228, 0x03229, 0x0322a, 0x0322b, 0x0322c, 0x0322d, 0x0322e, 0x0322f,
+ 0x03230, 0x03231, 0x03232, 0x03233, 0x03234, 0x03235, 0x03236, 0x03237,
+ 0x03238, 0x03239, 0x0323a, 0x0323b, 0x0323c, 0x0323d, 0x0323e, 0x0323f,
+ 0x03240, 0x03241, 0x03242, 0x03243, 0x03244, 0x03245, 0x02f42, 0x03247,
+ 0x02469, 0x02473, 0x0324a, 0x0324b, 0x0324c, 0x0324d, 0x0324e, 0x0324f,
+ 0x03250, 0x03251, 0x03252, 0x03253, 0x03254, 0x03255, 0x03256, 0x03257,
+ 0x03258, 0x03259, 0x0324a, 0x0325b, 0x0325c, 0x0325d, 0x0325e, 0x0325f,
+ 0x01100, 0x01102, 0x01103, 0x01105, 0x01106, 0x01107, 0x01109, 0x0110b,
+ 0x0110c, 0x0110e, 0x0110f, 0x01110, 0x01111, 0x01112, 0x0326e, 0x0326f,
+ 0x03270, 0x03271, 0x03272, 0x03273, 0x03274, 0x03275, 0x03276, 0x03277,
+ 0x03278, 0x03279, 0x0327a, 0x0327b, 0x0327c, 0x0327d, 0x0327e, 0x0327f,
+ 0x03192, 0x03193, 0x03194, 0x03195, 0x03284, 0x03285, 0x03286, 0x02f0b,
+ 0x03288, 0x02f17, 0x02f49, 0x02f55, 0x02f54, 0x02f4a, 0x02fa6, 0x02f1f,
+ 0x02f47, 0x03291, 0x03292, 0x03293, 0x03294, 0x03295, 0x03296, 0x03297,
+ 0x03298, 0x03299, 0x0329a, 0x02f25, 0x0329c, 0x0329d, 0x0329e, 0x0329f,
+ 0x032a0, 0x032a1, 0x032a2, 0x032a3, 0x03196, 0x03197, 0x03198, 0x032a7,
+ 0x032a8, 0x032a9, 0x032aa, 0x032ab, 0x032ac, 0x032ad, 0x032ae, 0x032af,
+ 0x032b0, 0x032b1, 0x032b2, 0x032b3, 0x032b4, 0x0324b, 0x032b6, 0x032b7,
+ 0x032b8, 0x032b9, 0x032ba, 0x032bb, 0x032bc, 0x032bd, 0x032be, 0x0324c,
+ 0x032c0, 0x032c1, 0x032c2, 0x032c3, 0x032c4, 0x032c5, 0x032c6, 0x032c7,
+ 0x032c8, 0x032c9, 0x032ca, 0x032cb, 0x032cc, 0x032cd, 0x032ce, 0x032cf,
+ 0x03042, 0x03044, 0x03046, 0x03048, 0x0304a, 0x0304b, 0x0304d, 0x0304f,
+ 0x03051, 0x03053, 0x03055, 0x03057, 0x03059, 0x0305b, 0x0305d, 0x0305f,
+ 0x03061, 0x03064, 0x03066, 0x03068, 0x0306a, 0x0306b, 0x0306c, 0x0306d,
+ 0x0306e, 0x0306f, 0x03072, 0x03075, 0x03078, 0x0307b, 0x0307e, 0x0307f,
+ 0x03080, 0x03081, 0x03082, 0x03084, 0x03086, 0x03088, 0x03089, 0x0308a,
+ 0x0308b, 0x0308c, 0x0308d, 0x0308f, 0x03090, 0x03091, 0x03092, 0x032ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_33[] = {
+ 0x03300, 0x03301, 0x03302, 0x03303, 0x03304, 0x03305, 0x03306, 0x03307,
+ 0x03308, 0x03309, 0x0330a, 0x0330b, 0x0330c, 0x0330d, 0x0330e, 0x0330f,
+ 0x03310, 0x03311, 0x03312, 0x03313, 0x03314, 0x03315, 0x03316, 0x03317,
+ 0x03318, 0x03319, 0x0331a, 0x0331b, 0x0331c, 0x0331d, 0x0331e, 0x0331f,
+ 0x03320, 0x03321, 0x03322, 0x03323, 0x03324, 0x03325, 0x03326, 0x03327,
+ 0x03328, 0x03329, 0x0332a, 0x0332b, 0x0332c, 0x0332d, 0x0332e, 0x0332f,
+ 0x03330, 0x03331, 0x03332, 0x03333, 0x03334, 0x03335, 0x03336, 0x03337,
+ 0x03338, 0x03339, 0x0333a, 0x0333b, 0x0333c, 0x0333d, 0x0333e, 0x0333f,
+ 0x03340, 0x03341, 0x03342, 0x03343, 0x03344, 0x03345, 0x03346, 0x03347,
+ 0x03348, 0x03349, 0x0334a, 0x0334b, 0x0334c, 0x0334d, 0x0334e, 0x0334f,
+ 0x03350, 0x03351, 0x03352, 0x03353, 0x03354, 0x03355, 0x03356, 0x03357,
+ 0x03358, 0x03359, 0x0335a, 0x0335b, 0x0335c, 0x0335d, 0x0335e, 0x0335f,
+ 0x03360, 0x03361, 0x03362, 0x03363, 0x03364, 0x03365, 0x03366, 0x03367,
+ 0x03368, 0x03369, 0x0336a, 0x0336b, 0x0336c, 0x0336d, 0x0336e, 0x0336f,
+ 0x03370, 0x03371, 0x03372, 0x03373, 0x03374, 0x03375, 0x03376, 0x03377,
+ 0x03378, 0x03379, 0x0337a, 0x0337b, 0x0337c, 0x0337d, 0x0337e, 0x0337f,
+ 0x03380, 0x03381, 0x03382, 0x03383, 0x03384, 0x03385, 0x03386, 0x03387,
+ 0x03388, 0x03389, 0x0338a, 0x0338b, 0x0338c, 0x0338d, 0x0338e, 0x0338f,
+ 0x03390, 0x03391, 0x03392, 0x03393, 0x03394, 0x03395, 0x03396, 0x03397,
+ 0x03398, 0x03399, 0x0339a, 0x0339b, 0x0339c, 0x0339d, 0x0339e, 0x0339f,
+ 0x033a0, 0x033a1, 0x033a2, 0x033a3, 0x033a4, 0x033a5, 0x033a6, 0x033a7,
+ 0x033a8, 0x03380, 0x033aa, 0x033ab, 0x033ac, 0x033ad, 0x033ae, 0x033af,
+ 0x033b0, 0x033b1, 0x033b2, 0x033b3, 0x033b4, 0x033b5, 0x033b6, 0x033b7,
+ 0x033b8, 0x033b7, 0x033ba, 0x033bb, 0x033bc, 0x033bd, 0x033be, 0x033bd,
+ 0x033c0, 0x033c1, 0x033c2, 0x033c3, 0x033c4, 0x033c5, 0x033c6, 0x033c7,
+ 0x00238, 0x033c9, 0x033ca, 0x033cb, 0x033cc, 0x033cd, 0x0339e, 0x033cf,
+ 0x033d0, 0x033d1, 0x033d2, 0x033d3, 0x03386, 0x033d5, 0x033d6, 0x033d7,
+ 0x033d8, 0x033d9, 0x033da, 0x033db, 0x033dc, 0x033dd, 0x033de, 0x033df,
+ 0x033e0, 0x033e1, 0x033e2, 0x033e3, 0x033e4, 0x033e5, 0x033e6, 0x033e7,
+ 0x033e8, 0x033e9, 0x033ea, 0x033eb, 0x033ec, 0x033ed, 0x033ee, 0x033ef,
+ 0x033f0, 0x033f1, 0x033f2, 0x033f3, 0x033f4, 0x033f5, 0x033f6, 0x033f7,
+ 0x033f8, 0x033f9, 0x033fa, 0x033fb, 0x033fc, 0x033fd, 0x033fe, 0x033ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_a6[] = {
+ 0x0a600, 0x0a601, 0x0a602, 0x0a603, 0x0a604, 0x0a605, 0x0a606, 0x0a607,
+ 0x0a608, 0x0a609, 0x0a60a, 0x0a60b, 0x0a60c, 0x0a60d, 0x0a60e, 0x0a60f,
+ 0x0a558, 0x0a56a, 0x0a587, 0x0a613, 0x0a614, 0x0a615, 0x0a616, 0x0a617,
+ 0x0a618, 0x0a619, 0x0a61a, 0x0a61b, 0x0a61c, 0x0a61d, 0x0a61e, 0x0a61f,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x0a56e, 0x0a5d1, 0x0a62c, 0x0a62d, 0x0a62e, 0x0a62f,
+ 0x0a630, 0x0a631, 0x0a632, 0x0a633, 0x0a634, 0x0a635, 0x0a636, 0x0a637,
+ 0x0a638, 0x0a639, 0x0a63a, 0x0a63b, 0x0a63c, 0x0a63d, 0x0a63e, 0x0a63f,
+ 0x0a640, 0x0a640, 0x0a642, 0x0a642, 0x0a644, 0x0a644, 0x0a646, 0x0a646,
+ 0x02df8, 0x02df8, 0x02df9, 0x02df9, 0x0a64c, 0x0a64c, 0x0a64e, 0x0a64e,
+ 0x0a650, 0x0a650, 0x0a652, 0x0a652, 0x0a654, 0x0a654, 0x02dfc, 0x02dfc,
+ 0x0a658, 0x0a658, 0x0a65a, 0x0a65a, 0x0a65c, 0x0a65c, 0x0a65e, 0x0a65e,
+ 0x0a660, 0x0a661, 0x0a662, 0x0a662, 0x0a664, 0x0a664, 0x0a666, 0x0a666,
+ 0x0041e, 0x0041e, 0x0041e, 0x0041e, 0x0041e, 0x0041e, 0x0041e, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x0a673, 0x0a674, 0x0a675, 0x0a676, 0x0a677,
+ 0x0a678, 0x0a679, 0x0a67a, 0x0a67b, 0x00000, 0x00000, 0x0a67e, 0x0a67f,
+ 0x0a680, 0x0a680, 0x0a682, 0x0a682, 0x0a684, 0x0a684, 0x0a686, 0x0a686,
+ 0x0a688, 0x0a688, 0x0a68a, 0x0a68a, 0x0a68c, 0x0a68c, 0x0a68e, 0x0a68e,
+ 0x0a690, 0x0a690, 0x0a692, 0x0a692, 0x0a694, 0x0a694, 0x0a696, 0x0a696,
+ 0x0a698, 0x0a699, 0x0a69a, 0x0a69b, 0x0a69c, 0x0a69d, 0x0a69e, 0x0a69f,
+ 0x0a6a0, 0x0a6a1, 0x0a6a2, 0x0a6a3, 0x0a6a4, 0x0a6a5, 0x0a6a6, 0x0a6a7,
+ 0x0a6a8, 0x0a6a9, 0x0a6aa, 0x0a6ab, 0x0a6ac, 0x0a6ad, 0x0a6ae, 0x0a6af,
+ 0x0a6b0, 0x0a6b1, 0x0a6b2, 0x0a6b3, 0x0a6b4, 0x0a6b5, 0x0a6b6, 0x0a6b7,
+ 0x0a6b8, 0x0a6b9, 0x0a6ba, 0x0a6bb, 0x0a6bc, 0x0a6bd, 0x0a6be, 0x0a6bf,
+ 0x0a6c0, 0x0a6c1, 0x0a6c2, 0x0a6c3, 0x0a6c4, 0x0a6c5, 0x0a6c6, 0x0a6c7,
+ 0x0a6c8, 0x0a6c9, 0x0a6ca, 0x0a6cb, 0x0a6cc, 0x0a6cd, 0x0a6ce, 0x0a6cf,
+ 0x0a6d0, 0x0a6d1, 0x0a6d2, 0x0a6d3, 0x0a6d4, 0x0a6d5, 0x0a6d6, 0x0a6d7,
+ 0x0a6d8, 0x0a6d9, 0x0a6da, 0x0a6db, 0x0a6dc, 0x0a6dd, 0x0a6de, 0x0a6df,
+ 0x0a6e0, 0x0a6e1, 0x0a6e2, 0x0a6e3, 0x0a6e4, 0x0a6e5, 0x0a6e6, 0x0a6e7,
+ 0x0a6e8, 0x0a6e9, 0x0a6ea, 0x0a6eb, 0x0a6ec, 0x0a6ed, 0x0a6ee, 0x0a6ef,
+ 0x00000, 0x00000, 0x0a6f2, 0x0a6f3, 0x0a6f4, 0x0a6f5, 0x0a6f6, 0x0a6f7,
+ 0x0a6f8, 0x0a6f9, 0x0a6fa, 0x0a6fb, 0x0a6fc, 0x0a6fd, 0x0a6fe, 0x0a6ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_a7[] = {
+ 0x0a700, 0x0a701, 0x0a702, 0x0a703, 0x0a704, 0x0a705, 0x0a706, 0x0a707,
+ 0x0a708, 0x0a709, 0x0a70a, 0x0a70b, 0x0a70c, 0x0a70d, 0x0a70e, 0x0a70f,
+ 0x0a710, 0x0a711, 0x0a712, 0x0a713, 0x0a714, 0x0a715, 0x0a716, 0x0a717,
+ 0x0a718, 0x0a719, 0x0a71a, 0x0a71b, 0x0a71c, 0x0a71d, 0x0a71e, 0x0a71f,
+ 0x0a720, 0x0a721, 0x0a722, 0x0a722, 0x0a724, 0x0a724, 0x0a726, 0x0a726,
+ 0x0a728, 0x0a728, 0x0a72a, 0x0a72a, 0x0a72c, 0x0a72c, 0x0a72e, 0x0a72e,
+ 0x0a730, 0x0a731, 0x0a732, 0x0a732, 0x01dd5, 0x01dd5, 0x03373, 0x03373,
+ 0x01dd6, 0x01dd6, 0x01dd6, 0x01dd6, 0x0a73c, 0x0a73c, 0x0a73e, 0x0a73e,
+ 0x0a740, 0x0a740, 0x0a742, 0x0a742, 0x0a744, 0x0a744, 0x0a746, 0x0a746,
+ 0x0a748, 0x0a748, 0x0a74a, 0x0a74a, 0x0a74c, 0x0a74c, 0x0a74e, 0x0a74e,
+ 0x0a750, 0x0a750, 0x0a752, 0x0a752, 0x0a754, 0x0a754, 0x0a756, 0x0a756,
+ 0x0a758, 0x0a758, 0x01de3, 0x01de3, 0x0a75c, 0x0a75c, 0x0a75e, 0x0a75e,
+ 0x0a760, 0x0a760, 0x0a762, 0x0a762, 0x0a764, 0x0a764, 0x0a766, 0x0a766,
+ 0x0a768, 0x0a768, 0x0a76a, 0x0a76a, 0x0a76c, 0x0a76c, 0x01dd2, 0x01dd2,
+ 0x01dd2, 0x0a771, 0x0a772, 0x0a773, 0x0a774, 0x0a775, 0x0a776, 0x0a777,
+ 0x0a778, 0x00044, 0x00044, 0x00046, 0x00046, 0x00047, 0x0a77e, 0x0a77e,
+ 0x0a780, 0x0a780, 0x00052, 0x00052, 0x00053, 0x00053, 0x00054, 0x00054,
+ 0x0a788, 0x0a789, 0x0a78a, 0x0a78b, 0x0a78b, 0x0a78d, 0x0a78e, 0x0a78f,
+ 0x0a790, 0x0a791, 0x0a792, 0x0a793, 0x0a794, 0x0a795, 0x0a796, 0x0a797,
+ 0x0a798, 0x0a799, 0x0a79a, 0x0a79b, 0x0a79c, 0x0a79d, 0x0a79e, 0x0a79f,
+ 0x0a7a0, 0x0a7a1, 0x0a7a2, 0x0a7a3, 0x0a7a4, 0x0a7a5, 0x0a7a6, 0x0a7a7,
+ 0x0a7a8, 0x0a7a9, 0x0a7aa, 0x0a7ab, 0x0a7ac, 0x0a7ad, 0x0a7ae, 0x0a7af,
+ 0x0a7b0, 0x0a7b1, 0x0a7b2, 0x0a7b3, 0x0a7b4, 0x0a7b5, 0x0a7b6, 0x0a7b7,
+ 0x0a7b8, 0x0a7b9, 0x0a7ba, 0x0a7bb, 0x0a7bc, 0x0a7bd, 0x0a7be, 0x0a7bf,
+ 0x0a7c0, 0x0a7c1, 0x0a7c2, 0x0a7c3, 0x0a7c4, 0x0a7c5, 0x0a7c6, 0x0a7c7,
+ 0x0a7c8, 0x0a7c9, 0x0a7ca, 0x0a7cb, 0x0a7cc, 0x0a7cd, 0x0a7ce, 0x0a7cf,
+ 0x0a7d0, 0x0a7d1, 0x0a7d2, 0x0a7d3, 0x0a7d4, 0x0a7d5, 0x0a7d6, 0x0a7d7,
+ 0x0a7d8, 0x0a7d9, 0x0a7da, 0x0a7db, 0x0a7dc, 0x0a7dd, 0x0a7de, 0x0a7df,
+ 0x0a7e0, 0x0a7e1, 0x0a7e2, 0x0a7e3, 0x0a7e4, 0x0a7e5, 0x0a7e6, 0x0a7e7,
+ 0x0a7e8, 0x0a7e9, 0x0a7ea, 0x0a7eb, 0x0a7ec, 0x0a7ed, 0x0a7ee, 0x0a7ef,
+ 0x0a7f0, 0x0a7f1, 0x0a7f2, 0x0a7f3, 0x0a7f4, 0x0a7f5, 0x0a7f6, 0x0a7f7,
+ 0x0a7f8, 0x0a7f9, 0x0a7fa, 0x0a7fb, 0x0a7fc, 0x0a7fd, 0x0a7fe, 0x0a7ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_a8[] = {
+ 0x0a800, 0x0a801, 0x0a802, 0x0a803, 0x0a804, 0x0a805, 0x0a806, 0x0a807,
+ 0x0a808, 0x0a809, 0x0a80a, 0x00000, 0x0a80c, 0x0a80d, 0x0a80e, 0x0a80f,
+ 0x0a810, 0x0a811, 0x0a812, 0x0a813, 0x0a814, 0x0a815, 0x0a816, 0x0a817,
+ 0x0a818, 0x0a819, 0x0a81a, 0x0a81b, 0x0a81c, 0x0a81d, 0x0a81e, 0x0a81f,
+ 0x0a820, 0x0a821, 0x0a822, 0x0a823, 0x0a824, 0x0a825, 0x0a826, 0x0a827,
+ 0x0a828, 0x0a829, 0x0a82a, 0x0a82b, 0x0a82c, 0x0a82d, 0x0a82e, 0x0a82f,
+ 0x0a830, 0x0a831, 0x0a832, 0x0a833, 0x0a834, 0x0a835, 0x0a836, 0x0a837,
+ 0x0a838, 0x0a839, 0x0a83a, 0x0a83b, 0x0a83c, 0x0a83d, 0x0a83e, 0x0a83f,
+ 0x0a840, 0x0a841, 0x0a842, 0x0a843, 0x0a844, 0x0a845, 0x0a846, 0x0a847,
+ 0x0a848, 0x0a849, 0x0a84a, 0x0a84b, 0x0a84c, 0x0a84d, 0x0a84e, 0x0a84f,
+ 0x0a850, 0x0a851, 0x0a852, 0x0a853, 0x0a854, 0x0a855, 0x0a856, 0x0a857,
+ 0x0a858, 0x0a859, 0x0a85a, 0x0a85b, 0x0a85c, 0x0a85d, 0x0a85e, 0x0a85f,
+ 0x0a860, 0x0a861, 0x0a862, 0x0a863, 0x0a864, 0x0a865, 0x0a866, 0x0a867,
+ 0x0a868, 0x0a869, 0x0a86a, 0x0a86b, 0x0a86c, 0x0a86d, 0x0a86e, 0x0a86f,
+ 0x0a870, 0x0a871, 0x0a872, 0x0a873, 0x0a874, 0x0a875, 0x0a876, 0x0a877,
+ 0x0a878, 0x0a879, 0x0a87a, 0x0a87b, 0x0a87c, 0x0a87d, 0x0a87e, 0x0a87f,
+ 0x00000, 0x00000, 0x0a882, 0x0a883, 0x0a884, 0x0a885, 0x0a886, 0x0a887,
+ 0x0a888, 0x0a889, 0x0a88a, 0x0a88b, 0x0a88c, 0x0a88d, 0x0a88e, 0x0a88f,
+ 0x0a890, 0x0a891, 0x0a892, 0x0a893, 0x0a894, 0x0a895, 0x0a896, 0x0a897,
+ 0x0a898, 0x0a899, 0x0a89a, 0x0a89b, 0x0a89c, 0x0a89d, 0x0a89e, 0x0a89f,
+ 0x0a8a0, 0x0a8a1, 0x0a8a2, 0x0a8a3, 0x0a8a4, 0x0a8a5, 0x0a8a6, 0x0a8a7,
+ 0x0a8a8, 0x0a8a9, 0x0a8aa, 0x0a8ab, 0x0a8ac, 0x0a8ad, 0x0a8ae, 0x0a8af,
+ 0x0a8b0, 0x0a8b1, 0x0a8b2, 0x0a8b3, 0x0a8b4, 0x0a8b5, 0x0a8b6, 0x0a8b7,
+ 0x0a8b8, 0x0a8b9, 0x0a8ba, 0x0a8bb, 0x0a8bc, 0x0a8bd, 0x0a8be, 0x0a8bf,
+ 0x0a8c0, 0x0a8c1, 0x0a8c2, 0x0a8c3, 0x0a8c4, 0x0a8c5, 0x0a8c6, 0x0a8c7,
+ 0x0a8c8, 0x0a8c9, 0x0a8ca, 0x0a8cb, 0x0a8cc, 0x0a8cd, 0x0a8ce, 0x0a8cf,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x0a8da, 0x0a8db, 0x0a8dc, 0x0a8dd, 0x0a8de, 0x0a8df,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x0a8f2, 0x0a8f2, 0x0a8f2, 0x0a8f2, 0x0a8f2, 0x0a8f2,
+ 0x0a8f8, 0x0a8f9, 0x0a8fa, 0x0a8fb, 0x0a8fc, 0x0a8fd, 0x0a8fe, 0x0a8ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_a9[] = {
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x0a90a, 0x0a90b, 0x0a90c, 0x0a90d, 0x0a90e, 0x0a90f,
+ 0x0a910, 0x0a911, 0x0a912, 0x0a913, 0x0a914, 0x0a915, 0x0a916, 0x0a917,
+ 0x0a918, 0x0a919, 0x0a91a, 0x0a91b, 0x0a91c, 0x0a91d, 0x0a91e, 0x0a91f,
+ 0x0a920, 0x0a921, 0x0a922, 0x0a923, 0x0a924, 0x0a925, 0x0a926, 0x0a927,
+ 0x0a928, 0x0a929, 0x0a92a, 0x00000, 0x00000, 0x00000, 0x0a92e, 0x0a92f,
+ 0x0a930, 0x0a931, 0x0a932, 0x0a933, 0x0a934, 0x0a935, 0x0a936, 0x0a937,
+ 0x0a938, 0x0a939, 0x0a93a, 0x0a93b, 0x0a93c, 0x0a93d, 0x0a93e, 0x0a93f,
+ 0x0a940, 0x0a941, 0x0a942, 0x0a943, 0x0a944, 0x0a945, 0x0a946, 0x0a947,
+ 0x0a948, 0x0a949, 0x0a94a, 0x0a94b, 0x0a94c, 0x0a94d, 0x0a94e, 0x0a94f,
+ 0x0a950, 0x0a951, 0x0a952, 0x0a953, 0x0a954, 0x0a955, 0x0a956, 0x0a957,
+ 0x0a958, 0x0a959, 0x0a95a, 0x0a95b, 0x0a95c, 0x0a95d, 0x0a95e, 0x0a95f,
+ 0x0a960, 0x0a961, 0x0a962, 0x0a963, 0x0a964, 0x0a965, 0x0a966, 0x0a967,
+ 0x0a968, 0x0a969, 0x0a96a, 0x0a96b, 0x0a96c, 0x0a96d, 0x0a96e, 0x0a96f,
+ 0x0a970, 0x0a971, 0x0a972, 0x0a973, 0x0a974, 0x0a975, 0x0a976, 0x0a977,
+ 0x0a978, 0x0a979, 0x0a97a, 0x0a97b, 0x0a97c, 0x0a97d, 0x0a97e, 0x0a97f,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x0a984, 0x0a985, 0x0a986, 0x0a987,
+ 0x0a988, 0x0a989, 0x0a98a, 0x0a98b, 0x0a98c, 0x0a98d, 0x0a98e, 0x0a98f,
+ 0x0a990, 0x0a991, 0x0a992, 0x0a993, 0x0a994, 0x0a995, 0x0a996, 0x0a997,
+ 0x0a998, 0x0a999, 0x0a99a, 0x0a99b, 0x0a99c, 0x0a99d, 0x0a99e, 0x0a99f,
+ 0x0a9a0, 0x0a9a1, 0x0a9a2, 0x0a9a3, 0x0a9a4, 0x0a9a5, 0x0a9a6, 0x0a9a7,
+ 0x0a9a8, 0x0a9a9, 0x0a9aa, 0x0a9ab, 0x0a9ab, 0x0a9ad, 0x0a9ae, 0x0a9af,
+ 0x0a9b0, 0x0a9b1, 0x0a9b2, 0x00000, 0x0a9b4, 0x0a9b5, 0x0a9b6, 0x0a9b7,
+ 0x0a9b8, 0x0a9b9, 0x0a9ba, 0x0a9bb, 0x0a9bc, 0x0a9bd, 0x0a9be, 0x0a9bf,
+ 0x0a9c0, 0x0a9c1, 0x0a9c2, 0x0a9c3, 0x0a9c4, 0x0a9c5, 0x0a9c6, 0x0a9c7,
+ 0x0a9c8, 0x0a9c9, 0x0a9ca, 0x0a9cb, 0x0a9cc, 0x0a9cd, 0x0a9ce, 0x0a9cf,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x0a9da, 0x0a9db, 0x0a9dc, 0x0a9dd, 0x0a9de, 0x0a9df,
+ 0x0a9e0, 0x0a9e1, 0x0a9e2, 0x0a9e3, 0x0a9e4, 0x0a9e5, 0x0a9e6, 0x0a9e7,
+ 0x0a9e8, 0x0a9e9, 0x0a9ea, 0x0a9eb, 0x0a9ec, 0x0a9ed, 0x0a9ee, 0x0a9ef,
+ 0x0a9f0, 0x0a9f1, 0x0a9f2, 0x0a9f3, 0x0a9f4, 0x0a9f5, 0x0a9f6, 0x0a9f7,
+ 0x0a9f8, 0x0a9f9, 0x0a9fa, 0x0a9fb, 0x0a9fc, 0x0a9fd, 0x0a9fe, 0x0a9ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_aa[] = {
+ 0x0aa00, 0x0aa01, 0x0aa02, 0x0aa03, 0x0aa04, 0x0aa05, 0x0aa06, 0x0aa07,
+ 0x0aa08, 0x0aa09, 0x0aa0a, 0x0aa0b, 0x0aa0c, 0x0aa0d, 0x0aa0e, 0x0aa0f,
+ 0x0aa10, 0x0aa11, 0x0aa12, 0x0aa13, 0x0aa14, 0x0aa15, 0x0aa16, 0x0aa17,
+ 0x0aa18, 0x0aa19, 0x0aa1a, 0x0aa1b, 0x0aa1c, 0x0aa1d, 0x0aa1e, 0x0aa1f,
+ 0x0aa20, 0x0aa21, 0x0aa22, 0x0aa23, 0x0aa24, 0x0aa25, 0x0aa26, 0x0aa27,
+ 0x0aa28, 0x0aa29, 0x0aa2a, 0x0aa2b, 0x0aa2c, 0x0aa2d, 0x0aa2e, 0x0aa2f,
+ 0x0aa30, 0x0aa31, 0x0aa32, 0x0aa33, 0x0aa34, 0x0aa35, 0x0aa36, 0x0aa37,
+ 0x0aa38, 0x0aa39, 0x0aa3a, 0x0aa3b, 0x0aa3c, 0x0aa3d, 0x0aa3e, 0x0aa3f,
+ 0x0aa40, 0x0aa41, 0x0aa42, 0x0aa43, 0x0aa44, 0x0aa45, 0x0aa46, 0x0aa47,
+ 0x0aa48, 0x0aa49, 0x0aa4a, 0x0aa4b, 0x0aa4c, 0x0aa4d, 0x0aa4e, 0x0aa4f,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x0aa5a, 0x0aa5b, 0x0aa5c, 0x0aa5d, 0x0aa5e, 0x0aa5f,
+ 0x0aa60, 0x0aa61, 0x0aa62, 0x0aa63, 0x0aa64, 0x0aa65, 0x0aa66, 0x0aa67,
+ 0x0aa68, 0x0aa69, 0x0aa6a, 0x0aa6b, 0x0aa6c, 0x0aa6d, 0x0aa6e, 0x0aa6f,
+ 0x0aa70, 0x0aa71, 0x0aa72, 0x0aa73, 0x0aa74, 0x0aa75, 0x0aa76, 0x0aa77,
+ 0x0aa78, 0x0aa79, 0x0aa7a, 0x0aa7b, 0x0aa7c, 0x0aa7d, 0x0aa7e, 0x0aa7f,
+ 0x0aa80, 0x0aa81, 0x0aa82, 0x0aa83, 0x0aa84, 0x0aa85, 0x0aa86, 0x0aa87,
+ 0x0aa88, 0x0aa89, 0x0aa8a, 0x0aa8b, 0x0aa8c, 0x0aa8d, 0x0aa8e, 0x0aa8f,
+ 0x0aa90, 0x0aa91, 0x0aa92, 0x0aa93, 0x0aa94, 0x0aa95, 0x0aa96, 0x0aa97,
+ 0x0aa98, 0x0aa99, 0x0aa9a, 0x0aa9b, 0x0aa9c, 0x0aa9d, 0x0aa9e, 0x0aa9f,
+ 0x0aaa0, 0x0aaa1, 0x0aaa2, 0x0aaa3, 0x0aaa4, 0x0aaa5, 0x0aaa6, 0x0aaa7,
+ 0x0aaa8, 0x0aaa9, 0x0aaaa, 0x0aaab, 0x0aaac, 0x0aaad, 0x0aaae, 0x0aaaf,
+ 0x0aab0, 0x0aab1, 0x0aab2, 0x0aab3, 0x0aab4, 0x0aab5, 0x0aab6, 0x0aab7,
+ 0x0aab8, 0x0aab9, 0x0aaba, 0x0aabb, 0x0aabc, 0x0aabd, 0x0aabe, 0x00000,
+ 0x0aac0, 0x00000, 0x0aac2, 0x0aac3, 0x0aac4, 0x0aac5, 0x0aac6, 0x0aac7,
+ 0x0aac8, 0x0aac9, 0x0aaca, 0x0aacb, 0x0aacc, 0x0aacd, 0x0aace, 0x0aacf,
+ 0x0aad0, 0x0aad1, 0x0aad2, 0x0aad3, 0x0aad4, 0x0aad5, 0x0aad6, 0x0aad7,
+ 0x0aad8, 0x0aad9, 0x0aada, 0x0aadb, 0x0aadc, 0x0aadd, 0x0aade, 0x0aadf,
+ 0x0aae0, 0x0aae1, 0x0aae2, 0x0aae3, 0x0aae4, 0x0aae5, 0x0aae6, 0x0aae7,
+ 0x0aae8, 0x0aae9, 0x0aaea, 0x0aaeb, 0x0aaec, 0x0aaed, 0x0aaee, 0x0aaef,
+ 0x0aaf0, 0x0aaf1, 0x0aaf2, 0x0aaf3, 0x0aaf4, 0x0aaf5, 0x0aaf6, 0x0aaf7,
+ 0x0aaf8, 0x0aaf9, 0x0aafa, 0x0aafb, 0x0aafc, 0x0aafd, 0x0aafe, 0x0aaff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_ab[] = {
+ 0x0ab00, 0x0ab01, 0x0ab02, 0x0ab03, 0x0ab04, 0x0ab05, 0x0ab06, 0x0ab07,
+ 0x0ab08, 0x0ab09, 0x0ab0a, 0x0ab0b, 0x0ab0c, 0x0ab0d, 0x0ab0e, 0x0ab0f,
+ 0x0ab10, 0x0ab11, 0x0ab12, 0x0ab13, 0x0ab14, 0x0ab15, 0x0ab16, 0x0ab17,
+ 0x0ab18, 0x0ab19, 0x0ab1a, 0x0ab1b, 0x0ab1c, 0x0ab1d, 0x0ab1e, 0x0ab1f,
+ 0x0ab20, 0x0ab21, 0x0ab22, 0x0ab23, 0x0ab24, 0x0ab25, 0x0ab26, 0x0ab27,
+ 0x0ab28, 0x0ab29, 0x0ab2a, 0x0ab2b, 0x0ab2c, 0x0ab2d, 0x0ab2e, 0x0ab2f,
+ 0x0ab30, 0x0ab31, 0x0ab32, 0x0ab33, 0x0ab34, 0x0ab35, 0x0ab36, 0x0ab37,
+ 0x0ab38, 0x0ab39, 0x0ab3a, 0x0ab3b, 0x0ab3c, 0x0ab3d, 0x0ab3e, 0x0ab3f,
+ 0x0ab40, 0x0ab41, 0x0ab42, 0x0ab43, 0x0ab44, 0x0ab45, 0x0ab46, 0x0ab47,
+ 0x0ab48, 0x0ab49, 0x0ab4a, 0x0ab4b, 0x0ab4c, 0x0ab4d, 0x0ab4e, 0x0ab4f,
+ 0x0ab50, 0x0ab51, 0x0ab52, 0x0ab53, 0x0ab54, 0x0ab55, 0x0ab56, 0x0ab57,
+ 0x0ab58, 0x0ab59, 0x0ab5a, 0x0ab5b, 0x0ab5c, 0x0ab5d, 0x0ab5e, 0x0ab5f,
+ 0x0ab60, 0x0ab61, 0x0ab62, 0x0ab63, 0x0ab64, 0x0ab65, 0x0ab66, 0x0ab67,
+ 0x0ab68, 0x0ab69, 0x0ab6a, 0x0ab6b, 0x0ab6c, 0x0ab6d, 0x0ab6e, 0x0ab6f,
+ 0x0ab70, 0x0ab71, 0x0ab72, 0x0ab73, 0x0ab74, 0x0ab75, 0x0ab76, 0x0ab77,
+ 0x0ab78, 0x0ab79, 0x0ab7a, 0x0ab7b, 0x0ab7c, 0x0ab7d, 0x0ab7e, 0x0ab7f,
+ 0x0ab80, 0x0ab81, 0x0ab82, 0x0ab83, 0x0ab84, 0x0ab85, 0x0ab86, 0x0ab87,
+ 0x0ab88, 0x0ab89, 0x0ab8a, 0x0ab8b, 0x0ab8c, 0x0ab8d, 0x0ab8e, 0x0ab8f,
+ 0x0ab90, 0x0ab91, 0x0ab92, 0x0ab93, 0x0ab94, 0x0ab95, 0x0ab96, 0x0ab97,
+ 0x0ab98, 0x0ab99, 0x0ab9a, 0x0ab9b, 0x0ab9c, 0x0ab9d, 0x0ab9e, 0x0ab9f,
+ 0x0aba0, 0x0aba1, 0x0aba2, 0x0aba3, 0x0aba4, 0x0aba5, 0x0aba6, 0x0aba7,
+ 0x0aba8, 0x0aba9, 0x0abaa, 0x0abab, 0x0abac, 0x0abad, 0x0abae, 0x0abaf,
+ 0x0abb0, 0x0abb1, 0x0abb2, 0x0abb3, 0x0abb4, 0x0abb5, 0x0abb6, 0x0abb7,
+ 0x0abb8, 0x0abb9, 0x0abba, 0x0abbb, 0x0abbc, 0x0abbd, 0x0abbe, 0x0abbf,
+ 0x0abc0, 0x0abc1, 0x0abc2, 0x0abc3, 0x0abc4, 0x0abc5, 0x0abc6, 0x0abc7,
+ 0x0abc8, 0x0abc9, 0x0abca, 0x0abcb, 0x0abcc, 0x0abcd, 0x0abce, 0x0abcf,
+ 0x0abd0, 0x0abd1, 0x0abd2, 0x0abd3, 0x0abd4, 0x0abd5, 0x0abd6, 0x0abd7,
+ 0x0abd8, 0x0abd9, 0x0abda, 0x0abdb, 0x0abdc, 0x0abdd, 0x0abde, 0x0abdf,
+ 0x0abe0, 0x0abe1, 0x0abe2, 0x0abe3, 0x0abe4, 0x0abe5, 0x0abe6, 0x0abe7,
+ 0x0abe8, 0x0abe9, 0x0abea, 0x0abeb, 0x00000, 0x0abed, 0x0abee, 0x0abef,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x0abfa, 0x0abfb, 0x0abfc, 0x0abfd, 0x0abfe, 0x0abff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_f9[] = {
+ 0x0f900, 0x0f901, 0x02f9e, 0x0f903, 0x0f904, 0x0f905, 0x0f906, 0x02ef2,
+ 0x02ef2, 0x0f909, 0x02fa6, 0x0f90b, 0x0f90c, 0x0f90d, 0x0f90e, 0x0f90f,
+ 0x0f910, 0x0f911, 0x0f912, 0x0f913, 0x0f914, 0x0f915, 0x0f916, 0x0f917,
+ 0x0f918, 0x0f919, 0x0f91a, 0x0f91b, 0x0f91c, 0x0f91d, 0x0f91e, 0x0f91f,
+ 0x0f920, 0x0f921, 0x0f922, 0x0f923, 0x0f924, 0x0f925, 0x0f926, 0x0f927,
+ 0x0f928, 0x0f929, 0x0f92a, 0x0f92b, 0x0f92c, 0x0f92d, 0x0f92e, 0x0f92f,
+ 0x0f930, 0x0f931, 0x0f932, 0x0f933, 0x02f7c, 0x0f935, 0x0f936, 0x0f937,
+ 0x0f938, 0x0f939, 0x0f93a, 0x0f93b, 0x0f93c, 0x0f93d, 0x0f93e, 0x0f93f,
+ 0x02fc5, 0x0f941, 0x0f942, 0x0f943, 0x0f944, 0x0f945, 0x0f946, 0x0f947,
+ 0x0f948, 0x0f949, 0x0f94a, 0x0f94b, 0x0f94c, 0x0f94d, 0x0f94e, 0x0f94f,
+ 0x0f950, 0x0f951, 0x0f952, 0x0f953, 0x0f954, 0x0f955, 0x0f956, 0x0f957,
+ 0x0f958, 0x0f959, 0x0f95a, 0x0f95b, 0x0f914, 0x0f95d, 0x0f95e, 0x0f95f,
+ 0x0f960, 0x0f961, 0x0f962, 0x0f963, 0x0f964, 0x0f965, 0x0f966, 0x0f967,
+ 0x0f968, 0x0f969, 0x0f96a, 0x0f96b, 0x0f96c, 0x0f96d, 0x0f96e, 0x0f96f,
+ 0x0f970, 0x02fa0, 0x0f972, 0x0f973, 0x0f974, 0x0f975, 0x0f976, 0x0f977,
+ 0x0f978, 0x0f979, 0x0f97a, 0x0f97b, 0x0f97c, 0x0f97d, 0x0f97e, 0x0f97f,
+ 0x0f980, 0x02f25, 0x0f982, 0x0f983, 0x0f984, 0x0f985, 0x0f986, 0x0f987,
+ 0x0f988, 0x0f989, 0x02f12, 0x0f98b, 0x0f98c, 0x0f98d, 0x0f98e, 0x0f98f,
+ 0x0f990, 0x0f991, 0x0f992, 0x0f993, 0x0f994, 0x0f995, 0x0f996, 0x0f997,
+ 0x0f998, 0x0f999, 0x0f99a, 0x0f99b, 0x0f99c, 0x0f99d, 0x0f99e, 0x0f99f,
+ 0x0f9a0, 0x0f96f, 0x0f9a2, 0x0f9a3, 0x0f9a4, 0x0f9a5, 0x0f9a6, 0x0f9a7,
+ 0x0f9a8, 0x0f9a9, 0x0f95f, 0x0f9ab, 0x0f9ac, 0x0f9ad, 0x0f9ae, 0x0f9af,
+ 0x0f9b0, 0x0f9b1, 0x0f9b2, 0x0f9b3, 0x0f9b4, 0x0f9b5, 0x0f9b6, 0x0f9b7,
+ 0x0f9b8, 0x0f9b9, 0x0f9ba, 0x0f9bb, 0x0f9bc, 0x0f9bd, 0x0f9be, 0x0f914,
+ 0x0f9c0, 0x0f9c1, 0x0f9c2, 0x0f9c3, 0x02eef, 0x0f9c5, 0x0f9c6, 0x0f9c7,
+ 0x0f9c8, 0x0f9c9, 0x0f9ca, 0x0f9cb, 0x0f9cc, 0x0f9cd, 0x0f9ce, 0x0f9cf,
+ 0x0f9d0, 0x03285, 0x0f9d2, 0x0f9d3, 0x0f9d4, 0x0f9d5, 0x0f9d6, 0x0f9d7,
+ 0x0f9d8, 0x0f9d9, 0x0f9da, 0x0f961, 0x0f9dc, 0x0f9dd, 0x0f9de, 0x0f9df,
+ 0x0f9e0, 0x0f9e1, 0x0f9e2, 0x0f9e3, 0x0f9e4, 0x0f9e5, 0x0f9e6, 0x0f9e7,
+ 0x0f9e8, 0x02fa5, 0x0f9ea, 0x0f9eb, 0x0f9ec, 0x0f9ed, 0x0f9ee, 0x0f9ef,
+ 0x0f9f0, 0x0f9f1, 0x0f9f2, 0x0f9f3, 0x0f9f4, 0x0f9f5, 0x0f9f6, 0x02f74,
+ 0x0f9f8, 0x0f9f9, 0x0f9fa, 0x0f9fb, 0x0f9fc, 0x0f9fd, 0x0f9fe, 0x0f9ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_fa[] = {
+ 0x0fa00, 0x0fa01, 0x0fa02, 0x0fa03, 0x0fa04, 0x0fa05, 0x0fa06, 0x0fa07,
+ 0x02f8f, 0x0fa09, 0x02f92, 0x0fa0b, 0x0fa0c, 0x0fa0d, 0x0fa0e, 0x0fa0f,
+ 0x0fa10, 0x0fa11, 0x0fa12, 0x0fa13, 0x0fa14, 0x0fa15, 0x0fa16, 0x0fa17,
+ 0x0fa18, 0x0fa19, 0x0fa1a, 0x0fa1b, 0x0fa1c, 0x0fa1d, 0x02f7b, 0x0fa1f,
+ 0x0fa20, 0x0fa21, 0x0fa22, 0x0fa23, 0x0fa24, 0x0fa25, 0x0fa26, 0x0fa27,
+ 0x0fa28, 0x0fa29, 0x0fa2a, 0x0fa2b, 0x0fa2c, 0x0fa2d, 0x0fa2e, 0x0fa2f,
+ 0x0fa30, 0x0fa31, 0x0fa32, 0x0fa33, 0x0fa34, 0x0fa35, 0x0fa36, 0x0fa37,
+ 0x0fa38, 0x0fa39, 0x0fa3a, 0x0fa3b, 0x02f2c, 0x0fa3d, 0x0fa3e, 0x0fa3f,
+ 0x0fa40, 0x0fa41, 0x0fa42, 0x0fa43, 0x0fa44, 0x0fa45, 0x0fa46, 0x0fa47,
+ 0x0fa48, 0x02ea4, 0x0fa4a, 0x0fa4b, 0x03293, 0x0fa4d, 0x0fa4e, 0x0fa4f,
+ 0x0fa50, 0x03297, 0x0fa52, 0x0fa53, 0x0fa54, 0x0fa55, 0x0fa56, 0x0f996,
+ 0x0fa58, 0x0fa59, 0x0fa5a, 0x0fa5b, 0x0fa5c, 0x02ebe, 0x02ebe, 0x0fa5f,
+ 0x0fa60, 0x0fa61, 0x0fa62, 0x0fa63, 0x0fa64, 0x0fa65, 0x02ecc, 0x0fa25,
+ 0x0fa68, 0x0fa69, 0x0fa6a, 0x0fa6b, 0x0fa6c, 0x0fa6d, 0x0fa6e, 0x0fa6f,
+ 0x0fa70, 0x0fa71, 0x0fa72, 0x0fa73, 0x0fa74, 0x0fa75, 0x0fa76, 0x0fa77,
+ 0x0fa36, 0x0fa79, 0x0fa7a, 0x0fa7b, 0x0fa10, 0x0fa7d, 0x0fa7e, 0x0fa7f,
+ 0x0fa80, 0x0fa81, 0x0fa82, 0x0fa83, 0x0fa84, 0x0fa85, 0x0fa86, 0x0fa87,
+ 0x0fa88, 0x0fa3f, 0x0fa8a, 0x0fa40, 0x0fa8c, 0x0fa8d, 0x0fa8e, 0x0fa8f,
+ 0x0fa90, 0x0fa12, 0x0f929, 0x0fa93, 0x0fa94, 0x02f4d, 0x0f970, 0x0f9ca,
+ 0x0fa98, 0x0fa99, 0x0fa47, 0x0fa9b, 0x0fa48, 0x0fa9d, 0x0fa9e, 0x0fa9f,
+ 0x0fa16, 0x0faa1, 0x0faa2, 0x0faa3, 0x0faa4, 0x0faa5, 0x0fa17, 0x0faa7,
+ 0x0faa8, 0x0faa9, 0x0faaa, 0x0faab, 0x0faac, 0x0fa56, 0x0faae, 0x0faaf,
+ 0x0f996, 0x0fab1, 0x0fa5b, 0x0fab3, 0x0fab4, 0x0fab5, 0x0fab6, 0x0fab7,
+ 0x0fa61, 0x0fab9, 0x0fa22, 0x0fabb, 0x0fa62, 0x0f95d, 0x0fabe, 0x0fa63,
+ 0x0fac0, 0x0fa65, 0x0fac2, 0x0fac3, 0x0fac4, 0x0fac5, 0x0fac6, 0x0fa68,
+ 0x0fa1c, 0x0fac9, 0x0fa69, 0x0facb, 0x0fa6a, 0x0facd, 0x02ef2, 0x0facf,
+ 0x0fad0, 0x0fad1, 0x0fad2, 0x0fad3, 0x0fad4, 0x0fad5, 0x0fad6, 0x0fad7,
+ 0x0fad8, 0x0fad9, 0x0fada, 0x0fadb, 0x0fadc, 0x0fadd, 0x0fade, 0x0fadf,
+ 0x0fae0, 0x0fae1, 0x0fae2, 0x0fae3, 0x0fae4, 0x0fae5, 0x0fae6, 0x0fae7,
+ 0x0fae8, 0x0fae9, 0x0faea, 0x0faeb, 0x0faec, 0x0faed, 0x0faee, 0x0faef,
+ 0x0faf0, 0x0faf1, 0x0faf2, 0x0faf3, 0x0faf4, 0x0faf5, 0x0faf6, 0x0faf7,
+ 0x0faf8, 0x0faf9, 0x0fafa, 0x0fafb, 0x0fafc, 0x0fafd, 0x0fafe, 0x0faff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_fb[] = {
+ 0x0fb00, 0x0fb01, 0x0fb02, 0x0fb03, 0x0fb04, 0x0fb05, 0x0fb05, 0x0fb07,
+ 0x0fb08, 0x0fb09, 0x0fb0a, 0x0fb0b, 0x0fb0c, 0x0fb0d, 0x0fb0e, 0x0fb0f,
+ 0x0fb10, 0x0fb11, 0x0fb12, 0x0fb13, 0x0fb14, 0x0fb15, 0x0fb16, 0x0fb17,
+ 0x0fb18, 0x0fb19, 0x0fb1a, 0x0fb1b, 0x0fb1c, 0x005d9, 0x00000, 0x005f2,
+ 0x005e2, 0x005d0, 0x005d3, 0x005d4, 0x005da, 0x005dc, 0x005dd, 0x005e8,
+ 0x005ea, 0x0002b, 0x005e9, 0x005e9, 0x005e9, 0x005e9, 0x005d0, 0x005d0,
+ 0x005d0, 0x005d1, 0x005d2, 0x005d3, 0x005d4, 0x005d5, 0x005d6, 0x0fb37,
+ 0x005d8, 0x005d9, 0x005da, 0x005da, 0x005dc, 0x0fb3d, 0x005dd, 0x0fb3f,
+ 0x005df, 0x005e1, 0x0fb42, 0x005e3, 0x005e3, 0x0fb45, 0x005e5, 0x005e7,
+ 0x005e8, 0x005e9, 0x005ea, 0x005d5, 0x005d1, 0x005da, 0x005e3, 0x0fb4f,
+ 0x00671, 0x00671, 0x0067b, 0x0067b, 0x0067b, 0x0067b, 0x0067e, 0x0067e,
+ 0x0067e, 0x0067e, 0x00680, 0x00680, 0x00680, 0x00680, 0x0067a, 0x0067a,
+ 0x0067a, 0x0067a, 0x0067f, 0x0067f, 0x0067f, 0x0067f, 0x00679, 0x00679,
+ 0x00679, 0x00679, 0x006a4, 0x006a4, 0x006a4, 0x006a4, 0x006a6, 0x006a6,
+ 0x006a6, 0x006a6, 0x00684, 0x00684, 0x00684, 0x00684, 0x00683, 0x00683,
+ 0x00683, 0x00683, 0x00686, 0x00686, 0x00686, 0x00686, 0x00687, 0x00687,
+ 0x00687, 0x00687, 0x0068d, 0x0068d, 0x0068c, 0x0068c, 0x0068e, 0x0068e,
+ 0x00688, 0x00688, 0x00698, 0x00698, 0x00691, 0x00691, 0x006a9, 0x006a9,
+ 0x006a9, 0x006a9, 0x006af, 0x006af, 0x006af, 0x006af, 0x006b3, 0x006b3,
+ 0x006b3, 0x006b3, 0x006b1, 0x006b1, 0x006b1, 0x006b1, 0x006ba, 0x006ba,
+ 0x006bb, 0x006bb, 0x006bb, 0x006bb, 0x006c0, 0x006c0, 0x006c1, 0x006c1,
+ 0x006c1, 0x006c1, 0x006be, 0x006be, 0x006be, 0x006be, 0x006d2, 0x006d2,
+ 0x006d2, 0x006d2, 0x0fbb2, 0x0fbb3, 0x0fbb4, 0x0fbb5, 0x0fbb6, 0x0fbb7,
+ 0x0fbb8, 0x0fbb9, 0x0fbba, 0x0fbbb, 0x0fbbc, 0x0fbbd, 0x0fbbe, 0x0fbbf,
+ 0x0fbc0, 0x0fbc1, 0x0fbc2, 0x0fbc3, 0x0fbc4, 0x0fbc5, 0x0fbc6, 0x0fbc7,
+ 0x0fbc8, 0x0fbc9, 0x0fbca, 0x0fbcb, 0x0fbcc, 0x0fbcd, 0x0fbce, 0x0fbcf,
+ 0x0fbd0, 0x0fbd1, 0x0fbd2, 0x006ad, 0x006ad, 0x006ad, 0x006ad, 0x006c7,
+ 0x006c7, 0x006c6, 0x006c6, 0x006c8, 0x006c8, 0x00677, 0x006cb, 0x006cb,
+ 0x006c5, 0x006c5, 0x006c9, 0x006c9, 0x006d0, 0x006d0, 0x006d0, 0x006d0,
+ 0x00649, 0x00649, 0x0fbea, 0x0fbea, 0x0fbec, 0x0fbec, 0x0fbee, 0x0fbee,
+ 0x0fbf0, 0x0fbf0, 0x0fbf2, 0x0fbf2, 0x0fbf4, 0x0fbf4, 0x0fbf6, 0x0fbf6,
+ 0x0fbf6, 0x0fbf9, 0x0fbf9, 0x0fbf9, 0x006cc, 0x006cc, 0x0fbfe, 0x0fbff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_fc[] = {
+ 0x0fc00, 0x0fc01, 0x0fc02, 0x0fbf9, 0x0fc04, 0x0fc05, 0x0fc06, 0x0fc07,
+ 0x0fc08, 0x0fc09, 0x0fc0a, 0x0fc0b, 0x0fc0c, 0x0fc0d, 0x0fc0e, 0x0fc0f,
+ 0x0fc10, 0x0fc11, 0x0fc12, 0x0fc13, 0x0fc14, 0x0fc15, 0x0fc16, 0x0fc17,
+ 0x0fc18, 0x0fc19, 0x0fc1a, 0x0fc1b, 0x0fc1c, 0x0fc1d, 0x0fc1e, 0x0fc1f,
+ 0x0fc20, 0x0fc21, 0x0fc22, 0x0fc23, 0x0fc24, 0x0fc25, 0x0fc26, 0x0fc27,
+ 0x0fc28, 0x0fc29, 0x0fc2a, 0x0fc2b, 0x0fc2c, 0x0fc2d, 0x0fc2e, 0x0fc2f,
+ 0x0fc30, 0x0fc31, 0x0fc32, 0x0fc33, 0x0fc34, 0x0fc35, 0x0fc36, 0x0fc37,
+ 0x0fc38, 0x0fc39, 0x0fc3a, 0x0fc3b, 0x0fc3c, 0x0fc3d, 0x0fc3e, 0x0fc3f,
+ 0x0fc40, 0x0fc41, 0x0fc42, 0x0fc43, 0x0fc44, 0x0fc45, 0x0fc46, 0x0fc47,
+ 0x0fc48, 0x0fc49, 0x0fc4a, 0x0fc4b, 0x0fc4c, 0x0fc4d, 0x0fc4e, 0x0fc4f,
+ 0x0fc50, 0x0fc51, 0x0fc52, 0x0fc53, 0x0fc54, 0x0fc55, 0x0fc56, 0x0fc57,
+ 0x0fc58, 0x0fc59, 0x0fc5a, 0x00630, 0x00631, 0x00649, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x0fc64, 0x0fc65, 0x0fc02, 0x0fc67,
+ 0x0fbf9, 0x0fc04, 0x0fc6a, 0x0fc6b, 0x0fc08, 0x0fc6d, 0x0fc09, 0x0fc0a,
+ 0x0fc70, 0x0fc71, 0x0fc0e, 0x0fc73, 0x0fc0f, 0x0fc10, 0x0fc76, 0x0fc77,
+ 0x0fc12, 0x0fc79, 0x0fc13, 0x0fc14, 0x0fc31, 0x0fc32, 0x0fc35, 0x0fc36,
+ 0x0fc37, 0x0fc3b, 0x0fc3c, 0x0fc3d, 0x0fc3e, 0x0fc42, 0x0fc43, 0x0fc44,
+ 0x0fc88, 0x0fc48, 0x0fc8a, 0x0fc8b, 0x0fc4e, 0x0fc8d, 0x0fc4f, 0x0fc50,
+ 0x00649, 0x0fc91, 0x0fc92, 0x0fc58, 0x0fc94, 0x0fc59, 0x0fc5a, 0x0fc00,
+ 0x0fc01, 0x0fc99, 0x0fc02, 0x0fc9b, 0x0fc05, 0x0fc06, 0x0fc07, 0x0fc08,
+ 0x0fca0, 0x0fc0b, 0x0fc0c, 0x0fc0d, 0x0fc0e, 0x0fca5, 0x0fc12, 0x0fc15,
+ 0x0fc16, 0x0fc17, 0x0fc18, 0x0fc19, 0x0fc1b, 0x0fc1c, 0x0fc1d, 0x0fc1e,
+ 0x0fc1f, 0x0fc20, 0x0fcb2, 0x0fc21, 0x0fc22, 0x0fc23, 0x0fc24, 0x0fc25,
+ 0x0fc26, 0x0fc28, 0x0fc29, 0x0fc2a, 0x0fc2b, 0x0fc2c, 0x0fc2d, 0x0fc2e,
+ 0x0fc2f, 0x0fc30, 0x0fc33, 0x0fc34, 0x0fc38, 0x0fc39, 0x0fc3a, 0x0fc3b,
+ 0x0fc3c, 0x0fc3f, 0x0fc40, 0x0fc41, 0x0fc42, 0x0fccd, 0x0fc45, 0x0fc46,
+ 0x0fc47, 0x0fc48, 0x0fc4b, 0x0fc4c, 0x0fc4d, 0x0fc4e, 0x0fcd6, 0x0fc51,
+ 0x0fc52, 0x00647, 0x0fc55, 0x0fc56, 0x0fc57, 0x0fc58, 0x0fcde, 0x0fc02,
+ 0x0fc9b, 0x0fc08, 0x0fca0, 0x0fc0e, 0x0fca5, 0x0fc12, 0x0fce6, 0x0fc1f,
+ 0x0fce8, 0x0fce9, 0x0fcea, 0x0fc3b, 0x0fc3c, 0x0fc42, 0x0fc4e, 0x0fcd6,
+ 0x0fc58, 0x0fcde, 0x00000, 0x00000, 0x00000, 0x0fcf5, 0x0fcf6, 0x0fcf7,
+ 0x0fcf8, 0x0fcf9, 0x0fcfa, 0x0fcfb, 0x0fcfc, 0x0fcfd, 0x0fcfe, 0x0fcff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_fd[] = {
+ 0x0fd00, 0x0fd01, 0x0fd02, 0x0fd03, 0x0fd04, 0x0fd05, 0x0fd06, 0x0fd07,
+ 0x0fd08, 0x0fd09, 0x0fd0a, 0x0fd0b, 0x0fce9, 0x0fd0d, 0x0fd0e, 0x0fd0f,
+ 0x0fd10, 0x0fcf5, 0x0fcf6, 0x0fcf7, 0x0fcf8, 0x0fcf9, 0x0fcfa, 0x0fcfb,
+ 0x0fcfc, 0x0fcfd, 0x0fcfe, 0x0fd1b, 0x0fd00, 0x0fd01, 0x0fd02, 0x0fd03,
+ 0x0fd04, 0x0fd05, 0x0fd06, 0x0fd07, 0x0fd08, 0x0fd09, 0x0fd0a, 0x0fd0b,
+ 0x0fce9, 0x0fd0d, 0x0fd0e, 0x0fd0f, 0x0fd10, 0x0fd09, 0x0fd0a, 0x0fd0b,
+ 0x0fce9, 0x0fce8, 0x0fcea, 0x0fc27, 0x0fc1c, 0x0fc1d, 0x0fc1e, 0x0fd09,
+ 0x0fd0a, 0x0fd0b, 0x0fc27, 0x0fc28, 0x00627, 0x00627, 0x0fd3e, 0x0fd3f,
+ 0x0fd40, 0x0fd41, 0x0fd42, 0x0fd43, 0x0fd44, 0x0fd45, 0x0fd46, 0x0fd47,
+ 0x0fd48, 0x0fd49, 0x0fd4a, 0x0fd4b, 0x0fd4c, 0x0fd4d, 0x0fd4e, 0x0fd4f,
+ 0x0fd50, 0x0fd51, 0x0fd51, 0x0fd53, 0x0fd54, 0x0fd55, 0x0fd56, 0x0fd57,
+ 0x0fd58, 0x0fd58, 0x0fd5a, 0x0fd5b, 0x0fd5c, 0x0fd5d, 0x0fd5e, 0x0fd5f,
+ 0x0fd5f, 0x0fd61, 0x0fd62, 0x0fd62, 0x0fd64, 0x0fd64, 0x0fd66, 0x0fd67,
+ 0x0fd67, 0x0fd69, 0x0fd6a, 0x0fd6a, 0x0fd6c, 0x0fd6c, 0x0fd6e, 0x0fd6f,
+ 0x0fd6f, 0x0fd71, 0x0fd71, 0x0fd73, 0x0fd74, 0x0fd75, 0x0fd76, 0x0fd76,
+ 0x0fd78, 0x0fd79, 0x0fd7a, 0x0fd7b, 0x0fd7c, 0x0fd7c, 0x0fd7e, 0x0fd7f,
+ 0x0fd80, 0x0fd81, 0x0fd82, 0x0fd83, 0x0fd83, 0x0fd85, 0x0fd85, 0x0fd87,
+ 0x0fd87, 0x0fd89, 0x0fd8a, 0x0fd8b, 0x0fd8c, 0x0fd8d, 0x0fd8e, 0x0fd8f,
+ 0x0fd90, 0x0fd91, 0x0fd92, 0x0fd93, 0x0fd94, 0x0fd95, 0x0fd96, 0x0fd97,
+ 0x0fd97, 0x0fd99, 0x0fd9a, 0x0fd9b, 0x0fd9c, 0x0fd9c, 0x0fd9e, 0x0fd9f,
+ 0x0fda0, 0x0fda1, 0x0fda2, 0x0fda3, 0x0fda4, 0x0fda5, 0x0fda6, 0x0fda7,
+ 0x0fda8, 0x0fda9, 0x0fdaa, 0x0fdab, 0x0fdac, 0x0fdad, 0x0fdae, 0x0fdaf,
+ 0x0fdb0, 0x0fdb1, 0x0fdb2, 0x0fdb3, 0x0fd7e, 0x0fd80, 0x0fdb6, 0x0fdb7,
+ 0x0fdb8, 0x0fdb9, 0x0fdba, 0x0fdbb, 0x0fdba, 0x0fdb8, 0x0fdbe, 0x0fdbf,
+ 0x0fdc0, 0x0fdc1, 0x0fdc2, 0x0fdbb, 0x0fd75, 0x0fd66, 0x0fdc6, 0x0fdc7,
+ 0x0fdc8, 0x0fdc9, 0x0fdca, 0x0fdcb, 0x0fdcc, 0x0fdcd, 0x0fdce, 0x0fdcf,
+ 0x0fdd0, 0x0fdd1, 0x0fdd2, 0x0fdd3, 0x0fdd4, 0x0fdd5, 0x0fdd6, 0x0fdd7,
+ 0x0fdd8, 0x0fdd9, 0x0fdda, 0x0fddb, 0x0fddc, 0x0fddd, 0x0fdde, 0x0fddf,
+ 0x0fde0, 0x0fde1, 0x0fde2, 0x0fde3, 0x0fde4, 0x0fde5, 0x0fde6, 0x0fde7,
+ 0x0fde8, 0x0fde9, 0x0fdea, 0x0fdeb, 0x0fdec, 0x0fded, 0x0fdee, 0x0fdef,
+ 0x0fdf0, 0x0fdf1, 0x0fdf2, 0x0fdf3, 0x0fdf4, 0x0fdf5, 0x0fdf6, 0x0fdf7,
+ 0x0fdf8, 0x0fdf9, 0x0fdfa, 0x0fdfb, 0x0fdfc, 0x0fdfd, 0x0fdfe, 0x0fdff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_fe[] = {
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x0002c, 0x03001, 0x03002, 0x0003a, 0x0003b, 0x00021, 0x0003f, 0x03016,
+ 0x03017, 0x02026, 0x0fe1a, 0x0fe1b, 0x0fe1c, 0x0fe1d, 0x0fe1e, 0x0fe1f,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x0fe27,
+ 0x0fe28, 0x0fe29, 0x0fe2a, 0x0fe2b, 0x0fe2c, 0x0fe2d, 0x0fe2e, 0x0fe2f,
+ 0x02025, 0x02014, 0x02013, 0x0005f, 0x0005f, 0x00028, 0x00029, 0x0007b,
+ 0x0007d, 0x03014, 0x03015, 0x03010, 0x03011, 0x0300a, 0x0300b, 0x02329,
+ 0x0232a, 0x0300c, 0x0300d, 0x0300e, 0x0300f, 0x0fe45, 0x0fe46, 0x0005b,
+ 0x0005d, 0x0203e, 0x0203e, 0x0203e, 0x0203e, 0x0005f, 0x0005f, 0x0005f,
+ 0x0002c, 0x03001, 0x0002e, 0x0fe53, 0x0003b, 0x0003a, 0x0003f, 0x00021,
+ 0x02014, 0x00028, 0x00029, 0x0007b, 0x0007d, 0x03014, 0x03015, 0x00023,
+ 0x00026, 0x0002a, 0x0002b, 0x0002d, 0x0003c, 0x0003e, 0x0003d, 0x0fe67,
+ 0x0005c, 0x00024, 0x00025, 0x00040, 0x0fe6c, 0x0fe6d, 0x0fe6e, 0x0fe6f,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x0fe75, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00621, 0x00622, 0x00622, 0x00623, 0x00623, 0x00624, 0x00624, 0x00625,
+ 0x00625, 0x00626, 0x00626, 0x00626, 0x00626, 0x00627, 0x00627, 0x00628,
+ 0x00628, 0x00628, 0x00628, 0x00629, 0x00629, 0x0062a, 0x0062a, 0x0062a,
+ 0x0062a, 0x0062b, 0x0062b, 0x0062b, 0x0062b, 0x0062c, 0x0062c, 0x0062c,
+ 0x0062c, 0x0062d, 0x0062d, 0x0062d, 0x0062d, 0x0062e, 0x0062e, 0x0062e,
+ 0x0062e, 0x0062f, 0x0062f, 0x00630, 0x00630, 0x00631, 0x00631, 0x00632,
+ 0x00632, 0x00633, 0x00633, 0x00633, 0x00633, 0x00634, 0x00634, 0x00634,
+ 0x00634, 0x00635, 0x00635, 0x00635, 0x00635, 0x00636, 0x00636, 0x00636,
+ 0x00636, 0x00637, 0x00637, 0x00637, 0x00637, 0x00638, 0x00638, 0x00638,
+ 0x00638, 0x00639, 0x00639, 0x00639, 0x00639, 0x0063a, 0x0063a, 0x0063a,
+ 0x0063a, 0x00641, 0x00641, 0x00641, 0x00641, 0x00642, 0x00642, 0x00642,
+ 0x00642, 0x00643, 0x00643, 0x00643, 0x00643, 0x00644, 0x00644, 0x00644,
+ 0x00644, 0x00645, 0x00645, 0x00645, 0x00645, 0x00646, 0x00646, 0x00646,
+ 0x00646, 0x00647, 0x00647, 0x00647, 0x00647, 0x00648, 0x00648, 0x00649,
+ 0x00649, 0x0064a, 0x0064a, 0x0064a, 0x0064a, 0x0fef5, 0x0fef5, 0x0fef7,
+ 0x0fef7, 0x0fef9, 0x0fef9, 0x0fefb, 0x0fefb, 0x0fefd, 0x0fefe, 0x0feff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_ff[] = {
+ 0x0ff00, 0x00021, 0x00022, 0x00023, 0x00024, 0x00025, 0x00026, 0x00027,
+ 0x00028, 0x00029, 0x0002a, 0x0002b, 0x0002c, 0x0002d, 0x0002e, 0x0002f,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x0003a, 0x0003b, 0x0003c, 0x0003d, 0x0003e, 0x0003f,
+ 0x00040, 0x00041, 0x00042, 0x00043, 0x00044, 0x00045, 0x00046, 0x00047,
+ 0x00048, 0x00049, 0x0004a, 0x0004b, 0x0004c, 0x0004d, 0x0004e, 0x0004f,
+ 0x00050, 0x00051, 0x00052, 0x00053, 0x00054, 0x00055, 0x00056, 0x00057,
+ 0x00058, 0x00059, 0x0005a, 0x0005b, 0x0005c, 0x0005d, 0x0005e, 0x0005f,
+ 0x00060, 0x00041, 0x00042, 0x00043, 0x00044, 0x00045, 0x00046, 0x00047,
+ 0x00048, 0x00049, 0x0004a, 0x0004b, 0x0004c, 0x0004d, 0x0004e, 0x0004f,
+ 0x00050, 0x00051, 0x00052, 0x00053, 0x00054, 0x00055, 0x00056, 0x00057,
+ 0x00058, 0x00059, 0x0005a, 0x0007b, 0x0007c, 0x0007d, 0x0007e, 0x02985,
+ 0x02986, 0x03002, 0x0300c, 0x0300d, 0x03001, 0x030fb, 0x03092, 0x03041,
+ 0x03043, 0x03045, 0x03047, 0x03049, 0x03083, 0x03085, 0x03087, 0x03063,
+ 0x030fc, 0x03042, 0x03044, 0x03046, 0x03048, 0x0304a, 0x0304b, 0x0304d,
+ 0x0304f, 0x03051, 0x03053, 0x03055, 0x03057, 0x03059, 0x0305b, 0x0305d,
+ 0x0305f, 0x03061, 0x03064, 0x03066, 0x03068, 0x0306a, 0x0306b, 0x0306c,
+ 0x0306d, 0x0306e, 0x0306f, 0x03072, 0x03075, 0x03078, 0x0307b, 0x0307e,
+ 0x0307f, 0x03080, 0x03081, 0x03082, 0x03084, 0x03086, 0x03088, 0x03089,
+ 0x0308a, 0x0308b, 0x0308c, 0x0308d, 0x0308f, 0x03093, 0x00000, 0x00000,
+ 0x01160, 0x01100, 0x01101, 0x011aa, 0x01102, 0x011ac, 0x011ad, 0x01103,
+ 0x01104, 0x01105, 0x011b0, 0x011b1, 0x011b2, 0x011b3, 0x011b4, 0x011b5,
+ 0x0111a, 0x01106, 0x01107, 0x01108, 0x01121, 0x01109, 0x0110a, 0x0110b,
+ 0x0110c, 0x0110d, 0x0110e, 0x0110f, 0x01110, 0x01111, 0x01112, 0x0ffbf,
+ 0x0ffc0, 0x0ffc1, 0x01161, 0x01162, 0x01163, 0x01164, 0x01165, 0x01166,
+ 0x0ffc8, 0x0ffc9, 0x01167, 0x01168, 0x01169, 0x0116a, 0x0116b, 0x0116c,
+ 0x0ffd0, 0x0ffd1, 0x0116d, 0x0116e, 0x0116f, 0x01170, 0x01171, 0x01172,
+ 0x0ffd8, 0x0ffd9, 0x01173, 0x01174, 0x01175, 0x0ffdd, 0x0ffde, 0x0ffdf,
+ 0x000a2, 0x000a3, 0x000ac, 0x000af, 0x000a6, 0x000a5, 0x020a9, 0x0ffe7,
+ 0x02502, 0x02190, 0x02191, 0x02192, 0x02193, 0x025a0, 0x025cb, 0x0ffef,
+ 0x0fff0, 0x0fff1, 0x0fff2, 0x0fff3, 0x0fff4, 0x0fff5, 0x0fff6, 0x0fff7,
+ 0x0fff8, 0x00000, 0x00000, 0x00000, 0x0fffc, 0x0fffd, 0x0fffe, 0x0ffff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_101[] = {
+ 0x10100, 0x10101, 0x10102, 0x10103, 0x10104, 0x10105, 0x10106, 0x00031,
+ 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037, 0x00038, 0x00039,
+ 0x10110, 0x10111, 0x10112, 0x10113, 0x10114, 0x10115, 0x10116, 0x10117,
+ 0x10118, 0x10119, 0x1011a, 0x1011b, 0x1011c, 0x1011d, 0x1011e, 0x1011f,
+ 0x10120, 0x10121, 0x10122, 0x10123, 0x10124, 0x10125, 0x10126, 0x10127,
+ 0x10128, 0x10129, 0x1012a, 0x1012b, 0x1012c, 0x1012d, 0x1012e, 0x1012f,
+ 0x10130, 0x10131, 0x10132, 0x10133, 0x10134, 0x10135, 0x10136, 0x10137,
+ 0x10138, 0x10139, 0x1013a, 0x1013b, 0x1013c, 0x1013d, 0x1013e, 0x1013f,
+ 0x10140, 0x10141, 0x00031, 0x00035, 0x10144, 0x10145, 0x10146, 0x10147,
+ 0x00035, 0x10149, 0x1014a, 0x1014b, 0x1014c, 0x1014d, 0x1014e, 0x00035,
+ 0x10150, 0x10151, 0x10152, 0x10153, 0x10154, 0x10155, 0x10156, 0x10157,
+ 0x00031, 0x00031, 0x00031, 0x00032, 0x00032, 0x00032, 0x00032, 0x00035,
+ 0x10160, 0x10161, 0x10162, 0x10163, 0x10164, 0x10165, 0x10166, 0x10167,
+ 0x10168, 0x10169, 0x1016a, 0x1016b, 0x1016c, 0x1016d, 0x1016e, 0x1016f,
+ 0x10170, 0x10171, 0x10172, 0x00035, 0x10174, 0x10175, 0x10176, 0x10177,
+ 0x10178, 0x10179, 0x1017a, 0x1017b, 0x1017c, 0x1017d, 0x1017e, 0x1017f,
+ 0x10180, 0x10181, 0x10182, 0x10183, 0x10184, 0x10185, 0x10186, 0x10187,
+ 0x10188, 0x10189, 0x00030, 0x1018b, 0x1018c, 0x1018d, 0x1018e, 0x1018f,
+ 0x10190, 0x10191, 0x10192, 0x10193, 0x10194, 0x10195, 0x10196, 0x10197,
+ 0x10198, 0x10199, 0x1019a, 0x1019b, 0x1019c, 0x1019d, 0x1019e, 0x1019f,
+ 0x101a0, 0x101a1, 0x101a2, 0x101a3, 0x101a4, 0x101a5, 0x101a6, 0x101a7,
+ 0x101a8, 0x101a9, 0x101aa, 0x101ab, 0x101ac, 0x101ad, 0x101ae, 0x101af,
+ 0x101b0, 0x101b1, 0x101b2, 0x101b3, 0x101b4, 0x101b5, 0x101b6, 0x101b7,
+ 0x101b8, 0x101b9, 0x101ba, 0x101bb, 0x101bc, 0x101bd, 0x101be, 0x101bf,
+ 0x101c0, 0x101c1, 0x101c2, 0x101c3, 0x101c4, 0x101c5, 0x101c6, 0x101c7,
+ 0x101c8, 0x101c9, 0x101ca, 0x101cb, 0x101cc, 0x101cd, 0x101ce, 0x101cf,
+ 0x101d0, 0x101d1, 0x101d2, 0x101d3, 0x101d4, 0x101d5, 0x101d6, 0x101d7,
+ 0x101d8, 0x101d9, 0x101da, 0x101db, 0x101dc, 0x101dd, 0x101de, 0x101df,
+ 0x101e0, 0x101e1, 0x101e2, 0x101e3, 0x101e4, 0x101e5, 0x101e6, 0x101e7,
+ 0x101e8, 0x101e9, 0x101ea, 0x101eb, 0x101ec, 0x101ed, 0x101ee, 0x101ef,
+ 0x101f0, 0x101f1, 0x101f2, 0x101f3, 0x101f4, 0x101f5, 0x101f6, 0x101f7,
+ 0x101f8, 0x101f9, 0x101fa, 0x101fb, 0x101fc, 0x00000, 0x101fe, 0x101ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_103[] = {
+ 0x10300, 0x10301, 0x10302, 0x10303, 0x10304, 0x10305, 0x10306, 0x10307,
+ 0x10308, 0x10309, 0x1030a, 0x1030b, 0x1030c, 0x1030d, 0x1030e, 0x1030f,
+ 0x10310, 0x10311, 0x10312, 0x10313, 0x10314, 0x10315, 0x10316, 0x10317,
+ 0x10318, 0x10319, 0x1031a, 0x1031b, 0x1031c, 0x1031d, 0x1031e, 0x1031f,
+ 0x00031, 0x00035, 0x10322, 0x10323, 0x10324, 0x10325, 0x10326, 0x10327,
+ 0x10328, 0x10329, 0x1032a, 0x1032b, 0x1032c, 0x1032d, 0x1032e, 0x1032f,
+ 0x10330, 0x10331, 0x10332, 0x10333, 0x10334, 0x10335, 0x10336, 0x10337,
+ 0x10338, 0x10339, 0x1033a, 0x1033b, 0x1033c, 0x1033d, 0x1033e, 0x1033f,
+ 0x10340, 0x10341, 0x10342, 0x10343, 0x10344, 0x10345, 0x10346, 0x10347,
+ 0x10348, 0x10349, 0x1034a, 0x1034b, 0x1034c, 0x1034d, 0x1034e, 0x1034f,
+ 0x10350, 0x10351, 0x10352, 0x10353, 0x10354, 0x10355, 0x10356, 0x10357,
+ 0x10358, 0x10359, 0x1035a, 0x1035b, 0x1035c, 0x1035d, 0x1035e, 0x1035f,
+ 0x10360, 0x10361, 0x10362, 0x10363, 0x10364, 0x10365, 0x10366, 0x10367,
+ 0x10368, 0x10369, 0x1036a, 0x1036b, 0x1036c, 0x1036d, 0x1036e, 0x1036f,
+ 0x10370, 0x10371, 0x10372, 0x10373, 0x10374, 0x10375, 0x10376, 0x10377,
+ 0x10378, 0x10379, 0x1037a, 0x1037b, 0x1037c, 0x1037d, 0x1037e, 0x1037f,
+ 0x10380, 0x10381, 0x10382, 0x10383, 0x10384, 0x10385, 0x10386, 0x10387,
+ 0x10388, 0x10389, 0x1038a, 0x1038b, 0x1038c, 0x1038d, 0x1038e, 0x1038f,
+ 0x10390, 0x10391, 0x10392, 0x10393, 0x10394, 0x10395, 0x10396, 0x10397,
+ 0x10398, 0x10399, 0x1039a, 0x1039b, 0x1039c, 0x1039d, 0x1039e, 0x1039f,
+ 0x103a0, 0x103a1, 0x103a2, 0x103a3, 0x103a4, 0x103a5, 0x103a6, 0x103a7,
+ 0x103a8, 0x103a9, 0x103aa, 0x103ab, 0x103ac, 0x103ad, 0x103ae, 0x103af,
+ 0x103b0, 0x103b1, 0x103b2, 0x103b3, 0x103b4, 0x103b5, 0x103b6, 0x103b7,
+ 0x103b8, 0x103b9, 0x103ba, 0x103bb, 0x103bc, 0x103bd, 0x103be, 0x103bf,
+ 0x103c0, 0x103c1, 0x103c2, 0x103c3, 0x103c4, 0x103c5, 0x103c6, 0x103c7,
+ 0x103c8, 0x103c9, 0x103ca, 0x103cb, 0x103cc, 0x103cd, 0x103ce, 0x103cf,
+ 0x103d0, 0x00031, 0x00032, 0x103d3, 0x103d4, 0x103d5, 0x103d6, 0x103d7,
+ 0x103d8, 0x103d9, 0x103da, 0x103db, 0x103dc, 0x103dd, 0x103de, 0x103df,
+ 0x103e0, 0x103e1, 0x103e2, 0x103e3, 0x103e4, 0x103e5, 0x103e6, 0x103e7,
+ 0x103e8, 0x103e9, 0x103ea, 0x103eb, 0x103ec, 0x103ed, 0x103ee, 0x103ef,
+ 0x103f0, 0x103f1, 0x103f2, 0x103f3, 0x103f4, 0x103f5, 0x103f6, 0x103f7,
+ 0x103f8, 0x103f9, 0x103fa, 0x103fb, 0x103fc, 0x103fd, 0x103fe, 0x103ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_104[] = {
+ 0x10400, 0x10401, 0x10402, 0x10403, 0x10404, 0x10405, 0x10406, 0x10407,
+ 0x10408, 0x10409, 0x1040a, 0x1040b, 0x1040c, 0x1040d, 0x1040e, 0x1040f,
+ 0x10410, 0x10411, 0x10412, 0x10413, 0x10414, 0x10415, 0x10416, 0x10417,
+ 0x10418, 0x10419, 0x1041a, 0x1041b, 0x1041c, 0x1041d, 0x1041e, 0x1041f,
+ 0x10420, 0x10421, 0x10422, 0x10423, 0x10424, 0x10425, 0x10426, 0x10427,
+ 0x10400, 0x10401, 0x10402, 0x10403, 0x10404, 0x10405, 0x10406, 0x10407,
+ 0x10408, 0x10409, 0x1040a, 0x1040b, 0x1040c, 0x1040d, 0x1040e, 0x1040f,
+ 0x10410, 0x10411, 0x10412, 0x10413, 0x10414, 0x10415, 0x10416, 0x10417,
+ 0x10418, 0x10419, 0x1041a, 0x1041b, 0x1041c, 0x1041d, 0x1041e, 0x1041f,
+ 0x10420, 0x10421, 0x10422, 0x10423, 0x10424, 0x10425, 0x10426, 0x10427,
+ 0x10450, 0x10451, 0x10452, 0x10453, 0x10454, 0x10455, 0x10456, 0x10457,
+ 0x10458, 0x10459, 0x1045a, 0x1045b, 0x1045c, 0x1045d, 0x1045e, 0x1045f,
+ 0x10460, 0x10461, 0x10462, 0x10463, 0x10464, 0x10465, 0x10466, 0x10467,
+ 0x10468, 0x10469, 0x1046a, 0x1046b, 0x1046c, 0x1046d, 0x1046e, 0x1046f,
+ 0x10470, 0x10471, 0x10472, 0x10473, 0x10474, 0x10475, 0x10476, 0x10477,
+ 0x10478, 0x10479, 0x1047a, 0x1047b, 0x1047c, 0x1047d, 0x1047e, 0x1047f,
+ 0x10480, 0x10481, 0x10482, 0x10483, 0x10484, 0x10485, 0x10486, 0x10487,
+ 0x10488, 0x10489, 0x1048a, 0x1048b, 0x1048c, 0x1048d, 0x1048e, 0x1048f,
+ 0x10490, 0x10491, 0x10492, 0x10493, 0x10494, 0x10495, 0x10496, 0x10497,
+ 0x10498, 0x10499, 0x1049a, 0x1049b, 0x1049c, 0x1049d, 0x1049e, 0x1049f,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x104aa, 0x104ab, 0x104ac, 0x104ad, 0x104ae, 0x104af,
+ 0x104b0, 0x104b1, 0x104b2, 0x104b3, 0x104b4, 0x104b5, 0x104b6, 0x104b7,
+ 0x104b8, 0x104b9, 0x104ba, 0x104bb, 0x104bc, 0x104bd, 0x104be, 0x104bf,
+ 0x104c0, 0x104c1, 0x104c2, 0x104c3, 0x104c4, 0x104c5, 0x104c6, 0x104c7,
+ 0x104c8, 0x104c9, 0x104ca, 0x104cb, 0x104cc, 0x104cd, 0x104ce, 0x104cf,
+ 0x104d0, 0x104d1, 0x104d2, 0x104d3, 0x104d4, 0x104d5, 0x104d6, 0x104d7,
+ 0x104d8, 0x104d9, 0x104da, 0x104db, 0x104dc, 0x104dd, 0x104de, 0x104df,
+ 0x104e0, 0x104e1, 0x104e2, 0x104e3, 0x104e4, 0x104e5, 0x104e6, 0x104e7,
+ 0x104e8, 0x104e9, 0x104ea, 0x104eb, 0x104ec, 0x104ed, 0x104ee, 0x104ef,
+ 0x104f0, 0x104f1, 0x104f2, 0x104f3, 0x104f4, 0x104f5, 0x104f6, 0x104f7,
+ 0x104f8, 0x104f9, 0x104fa, 0x104fb, 0x104fc, 0x104fd, 0x104fe, 0x104ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_108[] = {
+ 0x10800, 0x10801, 0x10802, 0x10803, 0x10804, 0x10805, 0x10806, 0x10807,
+ 0x10808, 0x10809, 0x1080a, 0x1080b, 0x1080c, 0x1080d, 0x1080e, 0x1080f,
+ 0x10810, 0x10811, 0x10812, 0x10813, 0x10814, 0x10815, 0x10816, 0x10817,
+ 0x10818, 0x10819, 0x1081a, 0x1081b, 0x1081c, 0x1081d, 0x1081e, 0x1081f,
+ 0x10820, 0x10821, 0x10822, 0x10823, 0x10824, 0x10825, 0x10826, 0x10827,
+ 0x10828, 0x10829, 0x1082a, 0x1082b, 0x1082c, 0x1082d, 0x1082e, 0x1082f,
+ 0x10830, 0x10831, 0x10832, 0x10833, 0x10834, 0x10835, 0x10836, 0x10837,
+ 0x10838, 0x10839, 0x1083a, 0x1083b, 0x1083c, 0x1083d, 0x1083e, 0x1083f,
+ 0x10840, 0x10841, 0x10842, 0x10843, 0x10844, 0x10845, 0x10846, 0x10847,
+ 0x10848, 0x10849, 0x1084a, 0x1084b, 0x1084c, 0x1084d, 0x1084e, 0x1084f,
+ 0x10850, 0x10851, 0x10852, 0x10853, 0x10854, 0x10855, 0x10856, 0x10857,
+ 0x00031, 0x00032, 0x00033, 0x1085b, 0x1085c, 0x1085d, 0x1085e, 0x1085f,
+ 0x10860, 0x10861, 0x10862, 0x10863, 0x10864, 0x10865, 0x10866, 0x10867,
+ 0x10868, 0x10869, 0x1086a, 0x1086b, 0x1086c, 0x1086d, 0x1086e, 0x1086f,
+ 0x10870, 0x10871, 0x10872, 0x10873, 0x10874, 0x10875, 0x10876, 0x10877,
+ 0x10878, 0x10879, 0x1087a, 0x1087b, 0x1087c, 0x1087d, 0x1087e, 0x1087f,
+ 0x10880, 0x10881, 0x10882, 0x10883, 0x10884, 0x10885, 0x10886, 0x10887,
+ 0x10888, 0x10889, 0x1088a, 0x1088b, 0x1088c, 0x1088d, 0x1088e, 0x1088f,
+ 0x10890, 0x10891, 0x10892, 0x10893, 0x10894, 0x10895, 0x10896, 0x10897,
+ 0x10898, 0x10899, 0x1089a, 0x1089b, 0x1089c, 0x1089d, 0x1089e, 0x1089f,
+ 0x108a0, 0x108a1, 0x108a2, 0x108a3, 0x108a4, 0x108a5, 0x108a6, 0x108a7,
+ 0x108a8, 0x108a9, 0x108aa, 0x108ab, 0x108ac, 0x108ad, 0x108ae, 0x108af,
+ 0x108b0, 0x108b1, 0x108b2, 0x108b3, 0x108b4, 0x108b5, 0x108b6, 0x108b7,
+ 0x108b8, 0x108b9, 0x108ba, 0x108bb, 0x108bc, 0x108bd, 0x108be, 0x108bf,
+ 0x108c0, 0x108c1, 0x108c2, 0x108c3, 0x108c4, 0x108c5, 0x108c6, 0x108c7,
+ 0x108c8, 0x108c9, 0x108ca, 0x108cb, 0x108cc, 0x108cd, 0x108ce, 0x108cf,
+ 0x108d0, 0x108d1, 0x108d2, 0x108d3, 0x108d4, 0x108d5, 0x108d6, 0x108d7,
+ 0x108d8, 0x108d9, 0x108da, 0x108db, 0x108dc, 0x108dd, 0x108de, 0x108df,
+ 0x108e0, 0x108e1, 0x108e2, 0x108e3, 0x108e4, 0x108e5, 0x108e6, 0x108e7,
+ 0x108e8, 0x108e9, 0x108ea, 0x108eb, 0x108ec, 0x108ed, 0x108ee, 0x108ef,
+ 0x108f0, 0x108f1, 0x108f2, 0x108f3, 0x108f4, 0x108f5, 0x108f6, 0x108f7,
+ 0x108f8, 0x108f9, 0x108fa, 0x108fb, 0x108fc, 0x108fd, 0x108fe, 0x108ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_109[] = {
+ 0x10900, 0x10901, 0x10902, 0x10903, 0x10904, 0x10905, 0x10906, 0x10907,
+ 0x10908, 0x10909, 0x1090a, 0x1090b, 0x1090c, 0x1090d, 0x1090e, 0x1090f,
+ 0x10910, 0x10911, 0x10912, 0x10913, 0x10914, 0x10915, 0x00031, 0x10917,
+ 0x10918, 0x10919, 0x00032, 0x00033, 0x1091c, 0x1091d, 0x1091e, 0x1091f,
+ 0x10920, 0x10921, 0x10922, 0x10923, 0x10924, 0x10925, 0x10926, 0x10927,
+ 0x10928, 0x10929, 0x1092a, 0x1092b, 0x1092c, 0x1092d, 0x1092e, 0x1092f,
+ 0x10930, 0x10931, 0x10932, 0x10933, 0x10934, 0x10935, 0x10936, 0x10937,
+ 0x10938, 0x10939, 0x1093a, 0x1093b, 0x1093c, 0x1093d, 0x1093e, 0x1093f,
+ 0x10940, 0x10941, 0x10942, 0x10943, 0x10944, 0x10945, 0x10946, 0x10947,
+ 0x10948, 0x10949, 0x1094a, 0x1094b, 0x1094c, 0x1094d, 0x1094e, 0x1094f,
+ 0x10950, 0x10951, 0x10952, 0x10953, 0x10954, 0x10955, 0x10956, 0x10957,
+ 0x10958, 0x10959, 0x1095a, 0x1095b, 0x1095c, 0x1095d, 0x1095e, 0x1095f,
+ 0x10960, 0x10961, 0x10962, 0x10963, 0x10964, 0x10965, 0x10966, 0x10967,
+ 0x10968, 0x10969, 0x1096a, 0x1096b, 0x1096c, 0x1096d, 0x1096e, 0x1096f,
+ 0x10970, 0x10971, 0x10972, 0x10973, 0x10974, 0x10975, 0x10976, 0x10977,
+ 0x10978, 0x10979, 0x1097a, 0x1097b, 0x1097c, 0x1097d, 0x1097e, 0x1097f,
+ 0x10980, 0x10981, 0x10982, 0x10983, 0x10984, 0x10985, 0x10986, 0x10987,
+ 0x10988, 0x10989, 0x1098a, 0x1098b, 0x1098c, 0x1098d, 0x1098e, 0x1098f,
+ 0x10990, 0x10991, 0x10992, 0x10993, 0x10994, 0x10995, 0x10996, 0x10997,
+ 0x10998, 0x10999, 0x1099a, 0x1099b, 0x1099c, 0x1099d, 0x1099e, 0x1099f,
+ 0x109a0, 0x109a1, 0x109a2, 0x109a3, 0x109a4, 0x109a5, 0x109a6, 0x109a7,
+ 0x109a8, 0x109a9, 0x109aa, 0x109ab, 0x109ac, 0x109ad, 0x109ae, 0x109af,
+ 0x109b0, 0x109b1, 0x109b2, 0x109b3, 0x109b4, 0x109b5, 0x109b6, 0x109b7,
+ 0x109b8, 0x109b9, 0x109ba, 0x109bb, 0x109bc, 0x109bd, 0x109be, 0x109bf,
+ 0x109c0, 0x109c1, 0x109c2, 0x109c3, 0x109c4, 0x109c5, 0x109c6, 0x109c7,
+ 0x109c8, 0x109c9, 0x109ca, 0x109cb, 0x109cc, 0x109cd, 0x109ce, 0x109cf,
+ 0x109d0, 0x109d1, 0x109d2, 0x109d3, 0x109d4, 0x109d5, 0x109d6, 0x109d7,
+ 0x109d8, 0x109d9, 0x109da, 0x109db, 0x109dc, 0x109dd, 0x109de, 0x109df,
+ 0x109e0, 0x109e1, 0x109e2, 0x109e3, 0x109e4, 0x109e5, 0x109e6, 0x109e7,
+ 0x109e8, 0x109e9, 0x109ea, 0x109eb, 0x109ec, 0x109ed, 0x109ee, 0x109ef,
+ 0x109f0, 0x109f1, 0x109f2, 0x109f3, 0x109f4, 0x109f5, 0x109f6, 0x109f7,
+ 0x109f8, 0x109f9, 0x109fa, 0x109fb, 0x109fc, 0x109fd, 0x109fe, 0x109ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_10a[] = {
+ 0x10a00, 0x10a01, 0x10a02, 0x10a03, 0x10a04, 0x10a05, 0x10a06, 0x10a07,
+ 0x10a08, 0x10a09, 0x10a0a, 0x10a0b, 0x10a0c, 0x00000, 0x00000, 0x00000,
+ 0x10a10, 0x10a11, 0x10a12, 0x10a13, 0x10a14, 0x10a15, 0x10a16, 0x10a17,
+ 0x10a18, 0x10a19, 0x10a1a, 0x10a1b, 0x10a1c, 0x10a1d, 0x10a1e, 0x10a1f,
+ 0x10a20, 0x10a21, 0x10a22, 0x10a23, 0x10a24, 0x10a25, 0x10a26, 0x10a27,
+ 0x10a28, 0x10a29, 0x10a2a, 0x10a2b, 0x10a2c, 0x10a2d, 0x10a2e, 0x10a2f,
+ 0x10a30, 0x10a31, 0x10a32, 0x10a33, 0x10a34, 0x10a35, 0x10a36, 0x10a37,
+ 0x00000, 0x00000, 0x00000, 0x10a3b, 0x10a3c, 0x10a3d, 0x10a3e, 0x10a3f,
+ 0x00031, 0x00032, 0x00033, 0x00034, 0x10a44, 0x10a45, 0x10a46, 0x10a47,
+ 0x10a48, 0x10a49, 0x10a4a, 0x10a4b, 0x10a4c, 0x10a4d, 0x10a4e, 0x10a4f,
+ 0x10a50, 0x10a51, 0x10a52, 0x10a53, 0x10a54, 0x10a55, 0x10a56, 0x10a57,
+ 0x10a58, 0x10a59, 0x10a5a, 0x10a5b, 0x10a5c, 0x10a5d, 0x10a5e, 0x10a5f,
+ 0x10a60, 0x10a61, 0x10a62, 0x10a63, 0x10a64, 0x10a65, 0x10a66, 0x10a67,
+ 0x10a68, 0x10a69, 0x10a6a, 0x10a6b, 0x10a6c, 0x10a6d, 0x10a6e, 0x10a6f,
+ 0x10a70, 0x10a71, 0x10a72, 0x10a73, 0x10a74, 0x10a75, 0x10a76, 0x10a77,
+ 0x10a78, 0x10a79, 0x10a7a, 0x10a7b, 0x10a7c, 0x00031, 0x10a7e, 0x10a7f,
+ 0x10a80, 0x10a81, 0x10a82, 0x10a83, 0x10a84, 0x10a85, 0x10a86, 0x10a87,
+ 0x10a88, 0x10a89, 0x10a8a, 0x10a8b, 0x10a8c, 0x10a8d, 0x10a8e, 0x10a8f,
+ 0x10a90, 0x10a91, 0x10a92, 0x10a93, 0x10a94, 0x10a95, 0x10a96, 0x10a97,
+ 0x10a98, 0x10a99, 0x10a9a, 0x10a9b, 0x10a9c, 0x10a9d, 0x10a9e, 0x10a9f,
+ 0x10aa0, 0x10aa1, 0x10aa2, 0x10aa3, 0x10aa4, 0x10aa5, 0x10aa6, 0x10aa7,
+ 0x10aa8, 0x10aa9, 0x10aaa, 0x10aab, 0x10aac, 0x10aad, 0x10aae, 0x10aaf,
+ 0x10ab0, 0x10ab1, 0x10ab2, 0x10ab3, 0x10ab4, 0x10ab5, 0x10ab6, 0x10ab7,
+ 0x10ab8, 0x10ab9, 0x10aba, 0x10abb, 0x10abc, 0x10abd, 0x10abe, 0x10abf,
+ 0x10ac0, 0x10ac1, 0x10ac2, 0x10ac3, 0x10ac4, 0x10ac5, 0x10ac6, 0x10ac7,
+ 0x10ac8, 0x10ac9, 0x10aca, 0x10acb, 0x10acc, 0x10acd, 0x10ace, 0x10acf,
+ 0x10ad0, 0x10ad1, 0x10ad2, 0x10ad3, 0x10ad4, 0x10ad5, 0x10ad6, 0x10ad7,
+ 0x10ad8, 0x10ad9, 0x10ada, 0x10adb, 0x10adc, 0x10add, 0x10ade, 0x10adf,
+ 0x10ae0, 0x10ae1, 0x10ae2, 0x10ae3, 0x10ae4, 0x10ae5, 0x10ae6, 0x10ae7,
+ 0x10ae8, 0x10ae9, 0x10aea, 0x10aeb, 0x10aec, 0x10aed, 0x10aee, 0x10aef,
+ 0x10af0, 0x10af1, 0x10af2, 0x10af3, 0x10af4, 0x10af5, 0x10af6, 0x10af7,
+ 0x10af8, 0x10af9, 0x10afa, 0x10afb, 0x10afc, 0x10afd, 0x10afe, 0x10aff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_10b[] = {
+ 0x10b00, 0x10b01, 0x10b02, 0x10b03, 0x10b04, 0x10b05, 0x10b06, 0x10b07,
+ 0x10b08, 0x10b09, 0x10b0a, 0x10b0b, 0x10b0c, 0x10b0d, 0x10b0e, 0x10b0f,
+ 0x10b10, 0x10b11, 0x10b12, 0x10b13, 0x10b14, 0x10b15, 0x10b16, 0x10b17,
+ 0x10b18, 0x10b19, 0x10b1a, 0x10b1b, 0x10b1c, 0x10b1d, 0x10b1e, 0x10b1f,
+ 0x10b20, 0x10b21, 0x10b22, 0x10b23, 0x10b24, 0x10b25, 0x10b26, 0x10b27,
+ 0x10b28, 0x10b29, 0x10b2a, 0x10b2b, 0x10b2c, 0x10b2d, 0x10b2d, 0x10b2f,
+ 0x10b30, 0x10b31, 0x10b32, 0x10b33, 0x10b34, 0x10b35, 0x10b36, 0x10b37,
+ 0x10b38, 0x10b39, 0x10b3a, 0x10b3b, 0x10b3c, 0x10b3d, 0x10b3e, 0x10b3f,
+ 0x10b40, 0x10b41, 0x10b42, 0x10b43, 0x10b44, 0x10b45, 0x10b46, 0x10b47,
+ 0x10b48, 0x10b49, 0x10b4a, 0x10b4b, 0x10b4c, 0x10b4d, 0x10b4e, 0x10b4f,
+ 0x10b50, 0x10b51, 0x10b52, 0x10b53, 0x10b54, 0x10b55, 0x10b56, 0x10b57,
+ 0x00031, 0x00032, 0x00033, 0x00034, 0x10b5c, 0x10b5d, 0x10b5e, 0x10b5f,
+ 0x10b60, 0x10b61, 0x10b62, 0x10b63, 0x10b64, 0x10b65, 0x10b66, 0x10b67,
+ 0x10b68, 0x10b69, 0x10b6a, 0x10b6b, 0x10b6c, 0x10b6d, 0x10b6e, 0x10b6f,
+ 0x10b70, 0x10b71, 0x10b72, 0x10b73, 0x10b74, 0x10b75, 0x10b76, 0x10b77,
+ 0x00031, 0x00032, 0x00033, 0x00034, 0x10b7c, 0x10b7d, 0x10b7e, 0x10b7f,
+ 0x10b80, 0x10b81, 0x10b82, 0x10b83, 0x10b84, 0x10b85, 0x10b86, 0x10b87,
+ 0x10b88, 0x10b89, 0x10b8a, 0x10b8b, 0x10b8c, 0x10b8d, 0x10b8e, 0x10b8f,
+ 0x10b90, 0x10b91, 0x10b92, 0x10b93, 0x10b94, 0x10b95, 0x10b96, 0x10b97,
+ 0x10b98, 0x10b99, 0x10b9a, 0x10b9b, 0x10b9c, 0x10b9d, 0x10b9e, 0x10b9f,
+ 0x10ba0, 0x10ba1, 0x10ba2, 0x10ba3, 0x10ba4, 0x10ba5, 0x10ba6, 0x10ba7,
+ 0x10ba8, 0x10ba9, 0x10baa, 0x10bab, 0x10bac, 0x10bad, 0x10bae, 0x10baf,
+ 0x10bb0, 0x10bb1, 0x10bb2, 0x10bb3, 0x10bb4, 0x10bb5, 0x10bb6, 0x10bb7,
+ 0x10bb8, 0x10bb9, 0x10bba, 0x10bbb, 0x10bbc, 0x10bbd, 0x10bbe, 0x10bbf,
+ 0x10bc0, 0x10bc1, 0x10bc2, 0x10bc3, 0x10bc4, 0x10bc5, 0x10bc6, 0x10bc7,
+ 0x10bc8, 0x10bc9, 0x10bca, 0x10bcb, 0x10bcc, 0x10bcd, 0x10bce, 0x10bcf,
+ 0x10bd0, 0x10bd1, 0x10bd2, 0x10bd3, 0x10bd4, 0x10bd5, 0x10bd6, 0x10bd7,
+ 0x10bd8, 0x10bd9, 0x10bda, 0x10bdb, 0x10bdc, 0x10bdd, 0x10bde, 0x10bdf,
+ 0x10be0, 0x10be1, 0x10be2, 0x10be3, 0x10be4, 0x10be5, 0x10be6, 0x10be7,
+ 0x10be8, 0x10be9, 0x10bea, 0x10beb, 0x10bec, 0x10bed, 0x10bee, 0x10bef,
+ 0x10bf0, 0x10bf1, 0x10bf2, 0x10bf3, 0x10bf4, 0x10bf5, 0x10bf6, 0x10bf7,
+ 0x10bf8, 0x10bf9, 0x10bfa, 0x10bfb, 0x10bfc, 0x10bfd, 0x10bfe, 0x10bff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_10c[] = {
+ 0x10c00, 0x10c00, 0x10c02, 0x10c03, 0x10c03, 0x10c05, 0x10c06, 0x10c07,
+ 0x10c07, 0x10c09, 0x10c09, 0x10c0b, 0x10c0b, 0x10c0d, 0x10c0d, 0x10c0f,
+ 0x10c0f, 0x10c11, 0x10c11, 0x10c13, 0x10c14, 0x10c14, 0x10c16, 0x10c16,
+ 0x10c18, 0x10c18, 0x10c1a, 0x10c1a, 0x10c1c, 0x10c1c, 0x10c1e, 0x10c1e,
+ 0x10c20, 0x10c21, 0x10c22, 0x10c23, 0x10c24, 0x10c24, 0x10c26, 0x10c26,
+ 0x10c28, 0x10c28, 0x10c2a, 0x10c2a, 0x10c2c, 0x10c2d, 0x10c2d, 0x10c2f,
+ 0x10c30, 0x10c31, 0x10c32, 0x10c32, 0x10c34, 0x10c34, 0x10c36, 0x10c36,
+ 0x10c38, 0x10c38, 0x10c3a, 0x10c3a, 0x10c3c, 0x10c3d, 0x10c3e, 0x10c3f,
+ 0x10c3f, 0x10c41, 0x10c41, 0x10c43, 0x10c43, 0x10c45, 0x10c45, 0x10c47,
+ 0x10c48, 0x10c49, 0x10c4a, 0x10c4b, 0x10c4c, 0x10c4d, 0x10c4e, 0x10c4f,
+ 0x10c50, 0x10c51, 0x10c52, 0x10c53, 0x10c54, 0x10c55, 0x10c56, 0x10c57,
+ 0x10c58, 0x10c59, 0x10c5a, 0x10c5b, 0x10c5c, 0x10c5d, 0x10c5e, 0x10c5f,
+ 0x10c60, 0x10c61, 0x10c62, 0x10c63, 0x10c64, 0x10c65, 0x10c66, 0x10c67,
+ 0x10c68, 0x10c69, 0x10c6a, 0x10c6b, 0x10c6c, 0x10c6d, 0x10c6e, 0x10c6f,
+ 0x10c70, 0x10c71, 0x10c72, 0x10c73, 0x10c74, 0x10c75, 0x10c76, 0x10c77,
+ 0x10c78, 0x10c79, 0x10c7a, 0x10c7b, 0x10c7c, 0x10c7d, 0x10c7e, 0x10c7f,
+ 0x10c80, 0x10c81, 0x10c82, 0x10c83, 0x10c84, 0x10c85, 0x10c86, 0x10c87,
+ 0x10c88, 0x10c89, 0x10c8a, 0x10c8b, 0x10c8c, 0x10c8d, 0x10c8e, 0x10c8f,
+ 0x10c90, 0x10c91, 0x10c92, 0x10c93, 0x10c94, 0x10c95, 0x10c96, 0x10c97,
+ 0x10c98, 0x10c99, 0x10c9a, 0x10c9b, 0x10c9c, 0x10c9d, 0x10c9e, 0x10c9f,
+ 0x10ca0, 0x10ca1, 0x10ca2, 0x10ca3, 0x10ca4, 0x10ca5, 0x10ca6, 0x10ca7,
+ 0x10ca8, 0x10ca9, 0x10caa, 0x10cab, 0x10cac, 0x10cad, 0x10cae, 0x10caf,
+ 0x10cb0, 0x10cb1, 0x10cb2, 0x10cb3, 0x10cb4, 0x10cb5, 0x10cb6, 0x10cb7,
+ 0x10cb8, 0x10cb9, 0x10cba, 0x10cbb, 0x10cbc, 0x10cbd, 0x10cbe, 0x10cbf,
+ 0x10cc0, 0x10cc1, 0x10cc2, 0x10cc3, 0x10cc4, 0x10cc5, 0x10cc6, 0x10cc7,
+ 0x10cc8, 0x10cc9, 0x10cca, 0x10ccb, 0x10ccc, 0x10ccd, 0x10cce, 0x10ccf,
+ 0x10cd0, 0x10cd1, 0x10cd2, 0x10cd3, 0x10cd4, 0x10cd5, 0x10cd6, 0x10cd7,
+ 0x10cd8, 0x10cd9, 0x10cda, 0x10cdb, 0x10cdc, 0x10cdd, 0x10cde, 0x10cdf,
+ 0x10ce0, 0x10ce1, 0x10ce2, 0x10ce3, 0x10ce4, 0x10ce5, 0x10ce6, 0x10ce7,
+ 0x10ce8, 0x10ce9, 0x10cea, 0x10ceb, 0x10cec, 0x10ced, 0x10cee, 0x10cef,
+ 0x10cf0, 0x10cf1, 0x10cf2, 0x10cf3, 0x10cf4, 0x10cf5, 0x10cf6, 0x10cf7,
+ 0x10cf8, 0x10cf9, 0x10cfa, 0x10cfb, 0x10cfc, 0x10cfd, 0x10cfe, 0x10cff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_10e[] = {
+ 0x10e00, 0x10e01, 0x10e02, 0x10e03, 0x10e04, 0x10e05, 0x10e06, 0x10e07,
+ 0x10e08, 0x10e09, 0x10e0a, 0x10e0b, 0x10e0c, 0x10e0d, 0x10e0e, 0x10e0f,
+ 0x10e10, 0x10e11, 0x10e12, 0x10e13, 0x10e14, 0x10e15, 0x10e16, 0x10e17,
+ 0x10e18, 0x10e19, 0x10e1a, 0x10e1b, 0x10e1c, 0x10e1d, 0x10e1e, 0x10e1f,
+ 0x10e20, 0x10e21, 0x10e22, 0x10e23, 0x10e24, 0x10e25, 0x10e26, 0x10e27,
+ 0x10e28, 0x10e29, 0x10e2a, 0x10e2b, 0x10e2c, 0x10e2d, 0x10e2e, 0x10e2f,
+ 0x10e30, 0x10e31, 0x10e32, 0x10e33, 0x10e34, 0x10e35, 0x10e36, 0x10e37,
+ 0x10e38, 0x10e39, 0x10e3a, 0x10e3b, 0x10e3c, 0x10e3d, 0x10e3e, 0x10e3f,
+ 0x10e40, 0x10e41, 0x10e42, 0x10e43, 0x10e44, 0x10e45, 0x10e46, 0x10e47,
+ 0x10e48, 0x10e49, 0x10e4a, 0x10e4b, 0x10e4c, 0x10e4d, 0x10e4e, 0x10e4f,
+ 0x10e50, 0x10e51, 0x10e52, 0x10e53, 0x10e54, 0x10e55, 0x10e56, 0x10e57,
+ 0x10e58, 0x10e59, 0x10e5a, 0x10e5b, 0x10e5c, 0x10e5d, 0x10e5e, 0x10e5f,
+ 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037, 0x00038,
+ 0x00039, 0x10e69, 0x10e6a, 0x10e6b, 0x10e6c, 0x10e6d, 0x10e6e, 0x10e6f,
+ 0x10e70, 0x10e71, 0x10e72, 0x10e73, 0x10e74, 0x10e75, 0x10e76, 0x10e77,
+ 0x10e78, 0x10e79, 0x10e7a, 0x10e7b, 0x10e7c, 0x10e7d, 0x10e7e, 0x10e7f,
+ 0x10e80, 0x10e81, 0x10e82, 0x10e83, 0x10e84, 0x10e85, 0x10e86, 0x10e87,
+ 0x10e88, 0x10e89, 0x10e8a, 0x10e8b, 0x10e8c, 0x10e8d, 0x10e8e, 0x10e8f,
+ 0x10e90, 0x10e91, 0x10e92, 0x10e93, 0x10e94, 0x10e95, 0x10e96, 0x10e97,
+ 0x10e98, 0x10e99, 0x10e9a, 0x10e9b, 0x10e9c, 0x10e9d, 0x10e9e, 0x10e9f,
+ 0x10ea0, 0x10ea1, 0x10ea2, 0x10ea3, 0x10ea4, 0x10ea5, 0x10ea6, 0x10ea7,
+ 0x10ea8, 0x10ea9, 0x10eaa, 0x10eab, 0x10eac, 0x10ead, 0x10eae, 0x10eaf,
+ 0x10eb0, 0x10eb1, 0x10eb2, 0x10eb3, 0x10eb4, 0x10eb5, 0x10eb6, 0x10eb7,
+ 0x10eb8, 0x10eb9, 0x10eba, 0x10ebb, 0x10ebc, 0x10ebd, 0x10ebe, 0x10ebf,
+ 0x10ec0, 0x10ec1, 0x10ec2, 0x10ec3, 0x10ec4, 0x10ec5, 0x10ec6, 0x10ec7,
+ 0x10ec8, 0x10ec9, 0x10eca, 0x10ecb, 0x10ecc, 0x10ecd, 0x10ece, 0x10ecf,
+ 0x10ed0, 0x10ed1, 0x10ed2, 0x10ed3, 0x10ed4, 0x10ed5, 0x10ed6, 0x10ed7,
+ 0x10ed8, 0x10ed9, 0x10eda, 0x10edb, 0x10edc, 0x10edd, 0x10ede, 0x10edf,
+ 0x10ee0, 0x10ee1, 0x10ee2, 0x10ee3, 0x10ee4, 0x10ee5, 0x10ee6, 0x10ee7,
+ 0x10ee8, 0x10ee9, 0x10eea, 0x10eeb, 0x10eec, 0x10eed, 0x10eee, 0x10eef,
+ 0x10ef0, 0x10ef1, 0x10ef2, 0x10ef3, 0x10ef4, 0x10ef5, 0x10ef6, 0x10ef7,
+ 0x10ef8, 0x10ef9, 0x10efa, 0x10efb, 0x10efc, 0x10efd, 0x10efe, 0x10eff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_110[] = {
+ 0x11000, 0x11001, 0x11002, 0x11003, 0x11004, 0x11005, 0x11006, 0x11007,
+ 0x11008, 0x11009, 0x1100a, 0x1100b, 0x1100c, 0x1100d, 0x1100e, 0x1100f,
+ 0x11010, 0x11011, 0x11012, 0x11013, 0x11014, 0x11015, 0x11016, 0x11017,
+ 0x11018, 0x11019, 0x1101a, 0x1101b, 0x1101c, 0x1101d, 0x1101e, 0x1101f,
+ 0x11020, 0x11021, 0x11022, 0x11023, 0x11024, 0x11025, 0x11026, 0x11027,
+ 0x11028, 0x11029, 0x1102a, 0x1102b, 0x1102c, 0x1102d, 0x1102e, 0x1102f,
+ 0x11030, 0x11031, 0x11032, 0x11033, 0x11034, 0x11035, 0x11036, 0x11037,
+ 0x11038, 0x11039, 0x1103a, 0x1103b, 0x1103c, 0x1103d, 0x1103e, 0x1103f,
+ 0x11040, 0x11041, 0x11042, 0x11043, 0x11044, 0x11045, 0x11046, 0x11047,
+ 0x11048, 0x11049, 0x1104a, 0x1104b, 0x1104c, 0x1104d, 0x1104e, 0x1104f,
+ 0x11050, 0x11051, 0x11052, 0x11053, 0x11054, 0x11055, 0x11056, 0x11057,
+ 0x11058, 0x11059, 0x1105a, 0x1105b, 0x1105c, 0x1105d, 0x1105e, 0x1105f,
+ 0x11060, 0x11061, 0x11062, 0x11063, 0x11064, 0x11065, 0x11066, 0x11067,
+ 0x11068, 0x11069, 0x1106a, 0x1106b, 0x1106c, 0x1106d, 0x1106e, 0x1106f,
+ 0x11070, 0x11071, 0x11072, 0x11073, 0x11074, 0x11075, 0x11076, 0x11077,
+ 0x11078, 0x11079, 0x1107a, 0x1107b, 0x1107c, 0x1107d, 0x1107e, 0x1107f,
+ 0x00000, 0x00000, 0x00000, 0x11083, 0x11084, 0x11085, 0x11086, 0x11087,
+ 0x11088, 0x11089, 0x1108a, 0x1108b, 0x1108c, 0x1108d, 0x1108e, 0x1108f,
+ 0x11090, 0x11091, 0x11092, 0x11093, 0x11094, 0x11095, 0x11096, 0x11097,
+ 0x11098, 0x11099, 0x11099, 0x1109b, 0x1109b, 0x1109d, 0x1109e, 0x1109f,
+ 0x110a0, 0x110a1, 0x110a2, 0x110a3, 0x110a4, 0x110a5, 0x110a6, 0x110a7,
+ 0x110a8, 0x110a9, 0x110aa, 0x110a5, 0x110ac, 0x110ad, 0x110ae, 0x110af,
+ 0x110b0, 0x110b1, 0x110b2, 0x110b3, 0x110b4, 0x110b5, 0x110b6, 0x110b7,
+ 0x110b8, 0x110b9, 0x00000, 0x110bb, 0x110bc, 0x00000, 0x110be, 0x110bf,
+ 0x110c0, 0x110c1, 0x110c2, 0x110c3, 0x110c4, 0x110c5, 0x110c6, 0x110c7,
+ 0x110c8, 0x110c9, 0x110ca, 0x110cb, 0x110cc, 0x110cd, 0x110ce, 0x110cf,
+ 0x110d0, 0x110d1, 0x110d2, 0x110d3, 0x110d4, 0x110d5, 0x110d6, 0x110d7,
+ 0x110d8, 0x110d9, 0x110da, 0x110db, 0x110dc, 0x110dd, 0x110de, 0x110df,
+ 0x110e0, 0x110e1, 0x110e2, 0x110e3, 0x110e4, 0x110e5, 0x110e6, 0x110e7,
+ 0x110e8, 0x110e9, 0x110ea, 0x110eb, 0x110ec, 0x110ed, 0x110ee, 0x110ef,
+ 0x110f0, 0x110f1, 0x110f2, 0x110f3, 0x110f4, 0x110f5, 0x110f6, 0x110f7,
+ 0x110f8, 0x110f9, 0x110fa, 0x110fb, 0x110fc, 0x110fd, 0x110fe, 0x110ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_124[] = {
+ 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037, 0x00038, 0x00039,
+ 0x00033, 0x00034, 0x00035, 0x00036, 0x00037, 0x00038, 0x00039, 0x00034,
+ 0x00035, 0x00036, 0x00037, 0x00038, 0x00039, 0x00031, 0x00032, 0x00033,
+ 0x00034, 0x00035, 0x00036, 0x00037, 0x00038, 0x00039, 0x00031, 0x00032,
+ 0x00033, 0x00034, 0x00035, 0x00032, 0x00033, 0x00033, 0x00034, 0x00035,
+ 0x00036, 0x00037, 0x00038, 0x00039, 0x00031, 0x00032, 0x00033, 0x00033,
+ 0x00034, 0x00035, 0x12432, 0x12433, 0x00031, 0x00032, 0x00033, 0x00033,
+ 0x00034, 0x00035, 0x00033, 0x00033, 0x00034, 0x00034, 0x00034, 0x00034,
+ 0x00036, 0x00037, 0x00037, 0x00037, 0x00038, 0x00038, 0x00039, 0x00039,
+ 0x00039, 0x00039, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00031,
+ 0x00032, 0x00033, 0x00034, 0x00034, 0x00035, 0x00035, 0x12456, 0x12457,
+ 0x00031, 0x00032, 0x1245a, 0x1245b, 0x1245c, 0x1245d, 0x1245e, 0x1245f,
+ 0x12460, 0x12461, 0x12462, 0x12463, 0x12464, 0x12465, 0x12466, 0x12467,
+ 0x12468, 0x12469, 0x1246a, 0x1246b, 0x1246c, 0x1246d, 0x1246e, 0x1246f,
+ 0x12470, 0x12471, 0x12472, 0x12473, 0x12474, 0x12475, 0x12476, 0x12477,
+ 0x12478, 0x12479, 0x1247a, 0x1247b, 0x1247c, 0x1247d, 0x1247e, 0x1247f,
+ 0x12480, 0x12481, 0x12482, 0x12483, 0x12484, 0x12485, 0x12486, 0x12487,
+ 0x12488, 0x12489, 0x1248a, 0x1248b, 0x1248c, 0x1248d, 0x1248e, 0x1248f,
+ 0x12490, 0x12491, 0x12492, 0x12493, 0x12494, 0x12495, 0x12496, 0x12497,
+ 0x12498, 0x12499, 0x1249a, 0x1249b, 0x1249c, 0x1249d, 0x1249e, 0x1249f,
+ 0x124a0, 0x124a1, 0x124a2, 0x124a3, 0x124a4, 0x124a5, 0x124a6, 0x124a7,
+ 0x124a8, 0x124a9, 0x124aa, 0x124ab, 0x124ac, 0x124ad, 0x124ae, 0x124af,
+ 0x124b0, 0x124b1, 0x124b2, 0x124b3, 0x124b4, 0x124b5, 0x124b6, 0x124b7,
+ 0x124b8, 0x124b9, 0x124ba, 0x124bb, 0x124bc, 0x124bd, 0x124be, 0x124bf,
+ 0x124c0, 0x124c1, 0x124c2, 0x124c3, 0x124c4, 0x124c5, 0x124c6, 0x124c7,
+ 0x124c8, 0x124c9, 0x124ca, 0x124cb, 0x124cc, 0x124cd, 0x124ce, 0x124cf,
+ 0x124d0, 0x124d1, 0x124d2, 0x124d3, 0x124d4, 0x124d5, 0x124d6, 0x124d7,
+ 0x124d8, 0x124d9, 0x124da, 0x124db, 0x124dc, 0x124dd, 0x124de, 0x124df,
+ 0x124e0, 0x124e1, 0x124e2, 0x124e3, 0x124e4, 0x124e5, 0x124e6, 0x124e7,
+ 0x124e8, 0x124e9, 0x124ea, 0x124eb, 0x124ec, 0x124ed, 0x124ee, 0x124ef,
+ 0x124f0, 0x124f1, 0x124f2, 0x124f3, 0x124f4, 0x124f5, 0x124f6, 0x124f7,
+ 0x124f8, 0x124f9, 0x124fa, 0x124fb, 0x124fc, 0x124fd, 0x124fe, 0x124ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_1d1[] = {
+ 0x1d100, 0x1d101, 0x1d102, 0x1d103, 0x1d104, 0x1d105, 0x1d106, 0x1d107,
+ 0x1d108, 0x1d109, 0x1d10a, 0x1d10b, 0x1d10c, 0x1d10d, 0x1d10e, 0x1d10f,
+ 0x1d110, 0x1d111, 0x1d112, 0x1d113, 0x1d114, 0x1d115, 0x1d116, 0x1d117,
+ 0x1d118, 0x1d119, 0x1d11a, 0x1d11b, 0x1d11c, 0x1d11d, 0x1d11e, 0x1d11f,
+ 0x1d120, 0x1d121, 0x1d122, 0x1d123, 0x1d124, 0x1d125, 0x1d126, 0x1d127,
+ 0x1d128, 0x1d129, 0x1d12a, 0x1d12b, 0x1d12c, 0x1d12d, 0x1d12e, 0x1d12f,
+ 0x1d130, 0x1d131, 0x1d132, 0x1d133, 0x1d134, 0x1d135, 0x1d136, 0x1d137,
+ 0x1d138, 0x1d139, 0x1d13a, 0x1d13b, 0x1d13c, 0x1d13d, 0x1d13e, 0x1d13f,
+ 0x1d140, 0x1d141, 0x1d142, 0x1d143, 0x1d144, 0x1d145, 0x1d146, 0x1d147,
+ 0x1d148, 0x1d149, 0x1d14a, 0x1d14b, 0x1d14c, 0x1d14d, 0x1d14e, 0x1d14f,
+ 0x1d150, 0x1d151, 0x1d152, 0x1d153, 0x1d154, 0x1d155, 0x1d156, 0x1d157,
+ 0x1d158, 0x1d159, 0x1d15a, 0x1d15b, 0x1d15c, 0x1d15d, 0x1d157, 0x1d158,
+ 0x1d158, 0x1d158, 0x1d158, 0x1d158, 0x1d158, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x1d16a, 0x1d16b, 0x1d16c, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x1d183, 0x1d184, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x1d18c, 0x1d18d, 0x1d18e, 0x1d18f,
+ 0x1d190, 0x1d191, 0x1d192, 0x1d193, 0x1d194, 0x1d195, 0x1d196, 0x1d197,
+ 0x1d198, 0x1d199, 0x1d19a, 0x1d19b, 0x1d19c, 0x1d19d, 0x1d19e, 0x1d19f,
+ 0x1d1a0, 0x1d1a1, 0x1d1a2, 0x1d1a3, 0x1d1a4, 0x1d1a5, 0x1d1a6, 0x1d1a7,
+ 0x1d1a8, 0x1d1a9, 0x00000, 0x00000, 0x00000, 0x00000, 0x1d1ae, 0x1d1af,
+ 0x1d1b0, 0x1d1b1, 0x1d1b2, 0x1d1b3, 0x1d1b4, 0x1d1b5, 0x1d1b6, 0x1d1b7,
+ 0x1d1b8, 0x1d1b9, 0x1d1ba, 0x1d1b9, 0x1d1ba, 0x1d1b9, 0x1d1ba, 0x1d1b9,
+ 0x1d1ba, 0x1d1c1, 0x1d1c2, 0x1d1c3, 0x1d1c4, 0x1d1c5, 0x1d1c6, 0x1d1c7,
+ 0x1d1c8, 0x1d1c9, 0x1d1ca, 0x1d1cb, 0x1d1cc, 0x1d1cd, 0x1d1ce, 0x1d1cf,
+ 0x1d1d0, 0x1d1d1, 0x1d1d2, 0x1d1d3, 0x1d1d4, 0x1d1d5, 0x1d1d6, 0x1d1d7,
+ 0x1d1d8, 0x1d1d9, 0x1d1da, 0x1d1db, 0x1d1dc, 0x1d1dd, 0x1d1de, 0x1d1df,
+ 0x1d1e0, 0x1d1e1, 0x1d1e2, 0x1d1e3, 0x1d1e4, 0x1d1e5, 0x1d1e6, 0x1d1e7,
+ 0x1d1e8, 0x1d1e9, 0x1d1ea, 0x1d1eb, 0x1d1ec, 0x1d1ed, 0x1d1ee, 0x1d1ef,
+ 0x1d1f0, 0x1d1f1, 0x1d1f2, 0x1d1f3, 0x1d1f4, 0x1d1f5, 0x1d1f6, 0x1d1f7,
+ 0x1d1f8, 0x1d1f9, 0x1d1fa, 0x1d1fb, 0x1d1fc, 0x1d1fd, 0x1d1fe, 0x1d1ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_1d2[] = {
+ 0x1d200, 0x1d201, 0x1d202, 0x1d203, 0x1d204, 0x1d205, 0x1d206, 0x1d207,
+ 0x1d208, 0x1d209, 0x1d20a, 0x1d20b, 0x1d20c, 0x1d20d, 0x1d20e, 0x1d20f,
+ 0x1d210, 0x1d211, 0x1d212, 0x1d213, 0x1d214, 0x1d215, 0x1d216, 0x1d217,
+ 0x1d218, 0x1d219, 0x1d21a, 0x1d21b, 0x1d21c, 0x1d21d, 0x1d21e, 0x1d21f,
+ 0x1d220, 0x1d221, 0x1d222, 0x1d223, 0x1d224, 0x1d225, 0x1d226, 0x1d227,
+ 0x1d228, 0x1d229, 0x1d22a, 0x1d22b, 0x1d22c, 0x1d22d, 0x1d22e, 0x1d22f,
+ 0x1d230, 0x1d231, 0x1d232, 0x1d233, 0x1d234, 0x1d235, 0x1d236, 0x1d237,
+ 0x1d238, 0x1d239, 0x1d23a, 0x1d23b, 0x1d23c, 0x1d23d, 0x1d23e, 0x1d23f,
+ 0x1d240, 0x1d241, 0x00000, 0x00000, 0x00000, 0x1d245, 0x1d246, 0x1d247,
+ 0x1d248, 0x1d249, 0x1d24a, 0x1d24b, 0x1d24c, 0x1d24d, 0x1d24e, 0x1d24f,
+ 0x1d250, 0x1d251, 0x1d252, 0x1d253, 0x1d254, 0x1d255, 0x1d256, 0x1d257,
+ 0x1d258, 0x1d259, 0x1d25a, 0x1d25b, 0x1d25c, 0x1d25d, 0x1d25e, 0x1d25f,
+ 0x1d260, 0x1d261, 0x1d262, 0x1d263, 0x1d264, 0x1d265, 0x1d266, 0x1d267,
+ 0x1d268, 0x1d269, 0x1d26a, 0x1d26b, 0x1d26c, 0x1d26d, 0x1d26e, 0x1d26f,
+ 0x1d270, 0x1d271, 0x1d272, 0x1d273, 0x1d274, 0x1d275, 0x1d276, 0x1d277,
+ 0x1d278, 0x1d279, 0x1d27a, 0x1d27b, 0x1d27c, 0x1d27d, 0x1d27e, 0x1d27f,
+ 0x1d280, 0x1d281, 0x1d282, 0x1d283, 0x1d284, 0x1d285, 0x1d286, 0x1d287,
+ 0x1d288, 0x1d289, 0x1d28a, 0x1d28b, 0x1d28c, 0x1d28d, 0x1d28e, 0x1d28f,
+ 0x1d290, 0x1d291, 0x1d292, 0x1d293, 0x1d294, 0x1d295, 0x1d296, 0x1d297,
+ 0x1d298, 0x1d299, 0x1d29a, 0x1d29b, 0x1d29c, 0x1d29d, 0x1d29e, 0x1d29f,
+ 0x1d2a0, 0x1d2a1, 0x1d2a2, 0x1d2a3, 0x1d2a4, 0x1d2a5, 0x1d2a6, 0x1d2a7,
+ 0x1d2a8, 0x1d2a9, 0x1d2aa, 0x1d2ab, 0x1d2ac, 0x1d2ad, 0x1d2ae, 0x1d2af,
+ 0x1d2b0, 0x1d2b1, 0x1d2b2, 0x1d2b3, 0x1d2b4, 0x1d2b5, 0x1d2b6, 0x1d2b7,
+ 0x1d2b8, 0x1d2b9, 0x1d2ba, 0x1d2bb, 0x1d2bc, 0x1d2bd, 0x1d2be, 0x1d2bf,
+ 0x1d2c0, 0x1d2c1, 0x1d2c2, 0x1d2c3, 0x1d2c4, 0x1d2c5, 0x1d2c6, 0x1d2c7,
+ 0x1d2c8, 0x1d2c9, 0x1d2ca, 0x1d2cb, 0x1d2cc, 0x1d2cd, 0x1d2ce, 0x1d2cf,
+ 0x1d2d0, 0x1d2d1, 0x1d2d2, 0x1d2d3, 0x1d2d4, 0x1d2d5, 0x1d2d6, 0x1d2d7,
+ 0x1d2d8, 0x1d2d9, 0x1d2da, 0x1d2db, 0x1d2dc, 0x1d2dd, 0x1d2de, 0x1d2df,
+ 0x1d2e0, 0x1d2e1, 0x1d2e2, 0x1d2e3, 0x1d2e4, 0x1d2e5, 0x1d2e6, 0x1d2e7,
+ 0x1d2e8, 0x1d2e9, 0x1d2ea, 0x1d2eb, 0x1d2ec, 0x1d2ed, 0x1d2ee, 0x1d2ef,
+ 0x1d2f0, 0x1d2f1, 0x1d2f2, 0x1d2f3, 0x1d2f4, 0x1d2f5, 0x1d2f6, 0x1d2f7,
+ 0x1d2f8, 0x1d2f9, 0x1d2fa, 0x1d2fb, 0x1d2fc, 0x1d2fd, 0x1d2fe, 0x1d2ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_1d3[] = {
+ 0x1d300, 0x1d301, 0x1d302, 0x1d303, 0x1d304, 0x1d305, 0x1d306, 0x1d307,
+ 0x1d308, 0x1d309, 0x1d30a, 0x1d30b, 0x1d30c, 0x1d30d, 0x1d30e, 0x1d30f,
+ 0x1d310, 0x1d311, 0x1d312, 0x1d313, 0x1d314, 0x1d315, 0x1d316, 0x1d317,
+ 0x1d318, 0x1d319, 0x1d31a, 0x1d31b, 0x1d31c, 0x1d31d, 0x1d31e, 0x1d31f,
+ 0x1d320, 0x1d321, 0x1d322, 0x1d323, 0x1d324, 0x1d325, 0x1d326, 0x1d327,
+ 0x1d328, 0x1d329, 0x1d32a, 0x1d32b, 0x1d32c, 0x1d32d, 0x1d32e, 0x1d32f,
+ 0x1d330, 0x1d331, 0x1d332, 0x1d333, 0x1d334, 0x1d335, 0x1d336, 0x1d337,
+ 0x1d338, 0x1d339, 0x1d33a, 0x1d33b, 0x1d33c, 0x1d33d, 0x1d33e, 0x1d33f,
+ 0x1d340, 0x1d341, 0x1d342, 0x1d343, 0x1d344, 0x1d345, 0x1d346, 0x1d347,
+ 0x1d348, 0x1d349, 0x1d34a, 0x1d34b, 0x1d34c, 0x1d34d, 0x1d34e, 0x1d34f,
+ 0x1d350, 0x1d351, 0x1d352, 0x1d353, 0x1d354, 0x1d355, 0x1d356, 0x1d357,
+ 0x1d358, 0x1d359, 0x1d35a, 0x1d35b, 0x1d35c, 0x1d35d, 0x1d35e, 0x1d35f,
+ 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037, 0x00038,
+ 0x00039, 0x1d369, 0x1d36a, 0x1d36b, 0x1d36c, 0x1d36d, 0x1d36e, 0x1d36f,
+ 0x1d370, 0x1d371, 0x1d372, 0x1d373, 0x1d374, 0x1d375, 0x1d376, 0x1d377,
+ 0x1d378, 0x1d379, 0x1d37a, 0x1d37b, 0x1d37c, 0x1d37d, 0x1d37e, 0x1d37f,
+ 0x1d380, 0x1d381, 0x1d382, 0x1d383, 0x1d384, 0x1d385, 0x1d386, 0x1d387,
+ 0x1d388, 0x1d389, 0x1d38a, 0x1d38b, 0x1d38c, 0x1d38d, 0x1d38e, 0x1d38f,
+ 0x1d390, 0x1d391, 0x1d392, 0x1d393, 0x1d394, 0x1d395, 0x1d396, 0x1d397,
+ 0x1d398, 0x1d399, 0x1d39a, 0x1d39b, 0x1d39c, 0x1d39d, 0x1d39e, 0x1d39f,
+ 0x1d3a0, 0x1d3a1, 0x1d3a2, 0x1d3a3, 0x1d3a4, 0x1d3a5, 0x1d3a6, 0x1d3a7,
+ 0x1d3a8, 0x1d3a9, 0x1d3aa, 0x1d3ab, 0x1d3ac, 0x1d3ad, 0x1d3ae, 0x1d3af,
+ 0x1d3b0, 0x1d3b1, 0x1d3b2, 0x1d3b3, 0x1d3b4, 0x1d3b5, 0x1d3b6, 0x1d3b7,
+ 0x1d3b8, 0x1d3b9, 0x1d3ba, 0x1d3bb, 0x1d3bc, 0x1d3bd, 0x1d3be, 0x1d3bf,
+ 0x1d3c0, 0x1d3c1, 0x1d3c2, 0x1d3c3, 0x1d3c4, 0x1d3c5, 0x1d3c6, 0x1d3c7,
+ 0x1d3c8, 0x1d3c9, 0x1d3ca, 0x1d3cb, 0x1d3cc, 0x1d3cd, 0x1d3ce, 0x1d3cf,
+ 0x1d3d0, 0x1d3d1, 0x1d3d2, 0x1d3d3, 0x1d3d4, 0x1d3d5, 0x1d3d6, 0x1d3d7,
+ 0x1d3d8, 0x1d3d9, 0x1d3da, 0x1d3db, 0x1d3dc, 0x1d3dd, 0x1d3de, 0x1d3df,
+ 0x1d3e0, 0x1d3e1, 0x1d3e2, 0x1d3e3, 0x1d3e4, 0x1d3e5, 0x1d3e6, 0x1d3e7,
+ 0x1d3e8, 0x1d3e9, 0x1d3ea, 0x1d3eb, 0x1d3ec, 0x1d3ed, 0x1d3ee, 0x1d3ef,
+ 0x1d3f0, 0x1d3f1, 0x1d3f2, 0x1d3f3, 0x1d3f4, 0x1d3f5, 0x1d3f6, 0x1d3f7,
+ 0x1d3f8, 0x1d3f9, 0x1d3fa, 0x1d3fb, 0x1d3fc, 0x1d3fd, 0x1d3fe, 0x1d3ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_1d4[] = {
+ 0x00041, 0x00042, 0x00043, 0x00044, 0x00045, 0x00046, 0x00047, 0x00048,
+ 0x00049, 0x0004a, 0x0004b, 0x0004c, 0x0004d, 0x0004e, 0x0004f, 0x00050,
+ 0x00051, 0x00052, 0x00053, 0x00054, 0x00055, 0x00056, 0x00057, 0x00058,
+ 0x00059, 0x0005a, 0x00041, 0x00042, 0x00043, 0x00044, 0x00045, 0x00046,
+ 0x00047, 0x00048, 0x00049, 0x0004a, 0x0004b, 0x0004c, 0x0004d, 0x0004e,
+ 0x0004f, 0x00050, 0x00051, 0x00052, 0x00053, 0x00054, 0x00055, 0x00056,
+ 0x00057, 0x00058, 0x00059, 0x0005a, 0x00041, 0x00042, 0x00043, 0x00044,
+ 0x00045, 0x00046, 0x00047, 0x00048, 0x00049, 0x0004a, 0x0004b, 0x0004c,
+ 0x0004d, 0x0004e, 0x0004f, 0x00050, 0x00051, 0x00052, 0x00053, 0x00054,
+ 0x00055, 0x00056, 0x00057, 0x00058, 0x00059, 0x0005a, 0x00041, 0x00042,
+ 0x00043, 0x00044, 0x00045, 0x00046, 0x00047, 0x1d455, 0x00049, 0x0004a,
+ 0x0004b, 0x0004c, 0x0004d, 0x0004e, 0x0004f, 0x00050, 0x00051, 0x00052,
+ 0x00053, 0x00054, 0x00055, 0x00056, 0x00057, 0x00058, 0x00059, 0x0005a,
+ 0x00041, 0x00042, 0x00043, 0x00044, 0x00045, 0x00046, 0x00047, 0x00048,
+ 0x00049, 0x0004a, 0x0004b, 0x0004c, 0x0004d, 0x0004e, 0x0004f, 0x00050,
+ 0x00051, 0x00052, 0x00053, 0x00054, 0x00055, 0x00056, 0x00057, 0x00058,
+ 0x00059, 0x0005a, 0x00041, 0x00042, 0x00043, 0x00044, 0x00045, 0x00046,
+ 0x00047, 0x00048, 0x00049, 0x0004a, 0x0004b, 0x0004c, 0x0004d, 0x0004e,
+ 0x0004f, 0x00050, 0x00051, 0x00052, 0x00053, 0x00054, 0x00055, 0x00056,
+ 0x00057, 0x00058, 0x00059, 0x0005a, 0x00041, 0x1d49d, 0x00043, 0x00044,
+ 0x1d4a0, 0x1d4a1, 0x00047, 0x1d4a3, 0x1d4a4, 0x0004a, 0x0004b, 0x1d4a7,
+ 0x1d4a8, 0x0004e, 0x0004f, 0x00050, 0x00051, 0x1d4ad, 0x00053, 0x00054,
+ 0x00055, 0x00056, 0x00057, 0x00058, 0x00059, 0x0005a, 0x00041, 0x00042,
+ 0x00043, 0x00044, 0x1d4ba, 0x00046, 0x1d4bc, 0x00048, 0x00049, 0x0004a,
+ 0x0004b, 0x0004c, 0x0004d, 0x0004e, 0x1d4c4, 0x00050, 0x00051, 0x00052,
+ 0x00053, 0x00054, 0x00055, 0x00056, 0x00057, 0x00058, 0x00059, 0x0005a,
+ 0x00041, 0x00042, 0x00043, 0x00044, 0x00045, 0x00046, 0x00047, 0x00048,
+ 0x00049, 0x0004a, 0x0004b, 0x0004c, 0x0004d, 0x0004e, 0x0004f, 0x00050,
+ 0x00051, 0x00052, 0x00053, 0x00054, 0x00055, 0x00056, 0x00057, 0x00058,
+ 0x00059, 0x0005a, 0x00041, 0x00042, 0x00043, 0x00044, 0x00045, 0x00046,
+ 0x00047, 0x00048, 0x00049, 0x0004a, 0x0004b, 0x0004c, 0x0004d, 0x0004e,
+ 0x0004f, 0x00050, 0x00051, 0x00052, 0x00053, 0x00054, 0x00055, 0x1d4ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_1d5[] = {
+ 0x00057, 0x00058, 0x00059, 0x0005a, 0x00041, 0x00042, 0x1d506, 0x00044,
+ 0x00045, 0x00046, 0x00047, 0x1d50b, 0x1d50c, 0x0004a, 0x0004b, 0x0004c,
+ 0x0004d, 0x0004e, 0x0004f, 0x00050, 0x00051, 0x1d515, 0x00053, 0x00054,
+ 0x00055, 0x00056, 0x00057, 0x00058, 0x00059, 0x1d51d, 0x00041, 0x00042,
+ 0x00043, 0x00044, 0x00045, 0x00046, 0x00047, 0x00048, 0x00049, 0x0004a,
+ 0x0004b, 0x0004c, 0x0004d, 0x0004e, 0x0004f, 0x00050, 0x00051, 0x00052,
+ 0x00053, 0x00054, 0x00055, 0x00056, 0x00057, 0x00058, 0x00059, 0x0005a,
+ 0x00041, 0x00042, 0x1d53a, 0x00044, 0x00045, 0x00046, 0x00047, 0x1d53f,
+ 0x00049, 0x0004a, 0x0004b, 0x0004c, 0x0004d, 0x1d545, 0x0004f, 0x1d547,
+ 0x1d548, 0x1d549, 0x00053, 0x00054, 0x00055, 0x00056, 0x00057, 0x00058,
+ 0x00059, 0x1d551, 0x00041, 0x00042, 0x00043, 0x00044, 0x00045, 0x00046,
+ 0x00047, 0x00048, 0x00049, 0x0004a, 0x0004b, 0x0004c, 0x0004d, 0x0004e,
+ 0x0004f, 0x00050, 0x00051, 0x00052, 0x00053, 0x00054, 0x00055, 0x00056,
+ 0x00057, 0x00058, 0x00059, 0x0005a, 0x00041, 0x00042, 0x00043, 0x00044,
+ 0x00045, 0x00046, 0x00047, 0x00048, 0x00049, 0x0004a, 0x0004b, 0x0004c,
+ 0x0004d, 0x0004e, 0x0004f, 0x00050, 0x00051, 0x00052, 0x00053, 0x00054,
+ 0x00055, 0x00056, 0x00057, 0x00058, 0x00059, 0x0005a, 0x00041, 0x00042,
+ 0x00043, 0x00044, 0x00045, 0x00046, 0x00047, 0x00048, 0x00049, 0x0004a,
+ 0x0004b, 0x0004c, 0x0004d, 0x0004e, 0x0004f, 0x00050, 0x00051, 0x00052,
+ 0x00053, 0x00054, 0x00055, 0x00056, 0x00057, 0x00058, 0x00059, 0x0005a,
+ 0x00041, 0x00042, 0x00043, 0x00044, 0x00045, 0x00046, 0x00047, 0x00048,
+ 0x00049, 0x0004a, 0x0004b, 0x0004c, 0x0004d, 0x0004e, 0x0004f, 0x00050,
+ 0x00051, 0x00052, 0x00053, 0x00054, 0x00055, 0x00056, 0x00057, 0x00058,
+ 0x00059, 0x0005a, 0x00041, 0x00042, 0x00043, 0x00044, 0x00045, 0x00046,
+ 0x00047, 0x00048, 0x00049, 0x0004a, 0x0004b, 0x0004c, 0x0004d, 0x0004e,
+ 0x0004f, 0x00050, 0x00051, 0x00052, 0x00053, 0x00054, 0x00055, 0x00056,
+ 0x00057, 0x00058, 0x00059, 0x0005a, 0x00041, 0x00042, 0x00043, 0x00044,
+ 0x00045, 0x00046, 0x00047, 0x00048, 0x00049, 0x0004a, 0x0004b, 0x0004c,
+ 0x0004d, 0x0004e, 0x0004f, 0x00050, 0x00051, 0x00052, 0x00053, 0x00054,
+ 0x00055, 0x00056, 0x00057, 0x00058, 0x00059, 0x0005a, 0x00041, 0x00042,
+ 0x00043, 0x00044, 0x00045, 0x00046, 0x00047, 0x00048, 0x00049, 0x0004a,
+ 0x0004b, 0x0004c, 0x0004d, 0x0004e, 0x0004f, 0x00050, 0x00051, 0x1d5ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_1d6[] = {
+ 0x00053, 0x00054, 0x00055, 0x00056, 0x00057, 0x00058, 0x00059, 0x0005a,
+ 0x00041, 0x00042, 0x00043, 0x00044, 0x00045, 0x00046, 0x00047, 0x00048,
+ 0x00049, 0x0004a, 0x0004b, 0x0004c, 0x0004d, 0x0004e, 0x0004f, 0x00050,
+ 0x00051, 0x00052, 0x00053, 0x00054, 0x00055, 0x00056, 0x00057, 0x00058,
+ 0x00059, 0x0005a, 0x00041, 0x00042, 0x00043, 0x00044, 0x00045, 0x00046,
+ 0x00047, 0x00048, 0x00049, 0x0004a, 0x0004b, 0x0004c, 0x0004d, 0x0004e,
+ 0x0004f, 0x00050, 0x00051, 0x00052, 0x00053, 0x00054, 0x00055, 0x00056,
+ 0x00057, 0x00058, 0x00059, 0x0005a, 0x00041, 0x00042, 0x00043, 0x00044,
+ 0x00045, 0x00046, 0x00047, 0x00048, 0x00049, 0x0004a, 0x0004b, 0x0004c,
+ 0x0004d, 0x0004e, 0x0004f, 0x00050, 0x00051, 0x00052, 0x00053, 0x00054,
+ 0x00055, 0x00056, 0x00057, 0x00058, 0x00059, 0x0005a, 0x00041, 0x00042,
+ 0x00043, 0x00044, 0x00045, 0x00046, 0x00047, 0x00048, 0x00049, 0x0004a,
+ 0x0004b, 0x0004c, 0x0004d, 0x0004e, 0x0004f, 0x00050, 0x00051, 0x00052,
+ 0x00053, 0x00054, 0x00055, 0x00056, 0x00057, 0x00058, 0x00059, 0x0005a,
+ 0x00041, 0x00042, 0x00043, 0x00044, 0x00045, 0x00046, 0x00047, 0x00048,
+ 0x00049, 0x0004a, 0x0004b, 0x0004c, 0x0004d, 0x0004e, 0x0004f, 0x00050,
+ 0x00051, 0x00052, 0x00053, 0x00054, 0x00055, 0x00056, 0x00057, 0x00058,
+ 0x00059, 0x0005a, 0x00041, 0x00042, 0x00043, 0x00044, 0x00045, 0x00046,
+ 0x00047, 0x00048, 0x00049, 0x0004a, 0x0004b, 0x0004c, 0x0004d, 0x0004e,
+ 0x0004f, 0x00050, 0x00051, 0x00052, 0x00053, 0x00054, 0x00055, 0x00056,
+ 0x00057, 0x00058, 0x00059, 0x0005a, 0x00131, 0x00237, 0x1d6a6, 0x1d6a7,
+ 0x00391, 0x00392, 0x00393, 0x00394, 0x00395, 0x00396, 0x00397, 0x00398,
+ 0x00399, 0x0039a, 0x0039b, 0x0039c, 0x0039d, 0x0039e, 0x0039f, 0x003a0,
+ 0x003a1, 0x00398, 0x003a3, 0x003a4, 0x003a5, 0x003a6, 0x003a7, 0x003a8,
+ 0x003a9, 0x02207, 0x00391, 0x00392, 0x00393, 0x00394, 0x00395, 0x00396,
+ 0x00397, 0x00398, 0x00399, 0x0039a, 0x0039b, 0x0039c, 0x0039d, 0x0039e,
+ 0x0039f, 0x003a0, 0x003a1, 0x003a3, 0x003a3, 0x003a4, 0x003a5, 0x003a6,
+ 0x003a7, 0x003a8, 0x003a9, 0x02202, 0x00395, 0x00398, 0x0039a, 0x003a6,
+ 0x003a1, 0x003a0, 0x00391, 0x00392, 0x00393, 0x00394, 0x00395, 0x00396,
+ 0x00397, 0x00398, 0x00399, 0x0039a, 0x0039b, 0x0039c, 0x0039d, 0x0039e,
+ 0x0039f, 0x003a0, 0x003a1, 0x00398, 0x003a3, 0x003a4, 0x003a5, 0x003a6,
+ 0x003a7, 0x003a8, 0x003a9, 0x02207, 0x00391, 0x00392, 0x00393, 0x1d6ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_1d7[] = {
+ 0x00395, 0x00396, 0x00397, 0x00398, 0x00399, 0x0039a, 0x0039b, 0x0039c,
+ 0x0039d, 0x0039e, 0x0039f, 0x003a0, 0x003a1, 0x003a3, 0x003a3, 0x003a4,
+ 0x003a5, 0x003a6, 0x003a7, 0x003a8, 0x003a9, 0x02202, 0x00395, 0x00398,
+ 0x0039a, 0x003a6, 0x003a1, 0x003a0, 0x00391, 0x00392, 0x00393, 0x00394,
+ 0x00395, 0x00396, 0x00397, 0x00398, 0x00399, 0x0039a, 0x0039b, 0x0039c,
+ 0x0039d, 0x0039e, 0x0039f, 0x003a0, 0x003a1, 0x00398, 0x003a3, 0x003a4,
+ 0x003a5, 0x003a6, 0x003a7, 0x003a8, 0x003a9, 0x02207, 0x00391, 0x00392,
+ 0x00393, 0x00394, 0x00395, 0x00396, 0x00397, 0x00398, 0x00399, 0x0039a,
+ 0x0039b, 0x0039c, 0x0039d, 0x0039e, 0x0039f, 0x003a0, 0x003a1, 0x003a3,
+ 0x003a3, 0x003a4, 0x003a5, 0x003a6, 0x003a7, 0x003a8, 0x003a9, 0x02202,
+ 0x00395, 0x00398, 0x0039a, 0x003a6, 0x003a1, 0x003a0, 0x00391, 0x00392,
+ 0x00393, 0x00394, 0x00395, 0x00396, 0x00397, 0x00398, 0x00399, 0x0039a,
+ 0x0039b, 0x0039c, 0x0039d, 0x0039e, 0x0039f, 0x003a0, 0x003a1, 0x00398,
+ 0x003a3, 0x003a4, 0x003a5, 0x003a6, 0x003a7, 0x003a8, 0x003a9, 0x02207,
+ 0x00391, 0x00392, 0x00393, 0x00394, 0x00395, 0x00396, 0x00397, 0x00398,
+ 0x00399, 0x0039a, 0x0039b, 0x0039c, 0x0039d, 0x0039e, 0x0039f, 0x003a0,
+ 0x003a1, 0x003a3, 0x003a3, 0x003a4, 0x003a5, 0x003a6, 0x003a7, 0x003a8,
+ 0x003a9, 0x02202, 0x00395, 0x00398, 0x0039a, 0x003a6, 0x003a1, 0x003a0,
+ 0x00391, 0x00392, 0x00393, 0x00394, 0x00395, 0x00396, 0x00397, 0x00398,
+ 0x00399, 0x0039a, 0x0039b, 0x0039c, 0x0039d, 0x0039e, 0x0039f, 0x003a0,
+ 0x003a1, 0x00398, 0x003a3, 0x003a4, 0x003a5, 0x003a6, 0x003a7, 0x003a8,
+ 0x003a9, 0x02207, 0x00391, 0x00392, 0x00393, 0x00394, 0x00395, 0x00396,
+ 0x00397, 0x00398, 0x00399, 0x0039a, 0x0039b, 0x0039c, 0x0039d, 0x0039e,
+ 0x0039f, 0x003a0, 0x003a1, 0x003a3, 0x003a3, 0x003a4, 0x003a5, 0x003a6,
+ 0x003a7, 0x003a8, 0x003a9, 0x02202, 0x00395, 0x00398, 0x0039a, 0x003a6,
+ 0x003a1, 0x003a0, 0x003dc, 0x003dc, 0x1d7cc, 0x1d7cd, 0x00030, 0x00031,
+ 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037, 0x00038, 0x00039,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035,
+ 0x00036, 0x00037, 0x00038, 0x00039, 0x00030, 0x00031, 0x00032, 0x00033,
+ 0x00034, 0x00035, 0x00036, 0x00037, 0x00038, 0x00039, 0x00030, 0x00031,
+ 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037, 0x00038, 0x1d7ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_1f1[] = {
+ 0x1f100, 0x1f101, 0x1f102, 0x1f103, 0x1f104, 0x1f105, 0x1f106, 0x1f107,
+ 0x1f108, 0x1f109, 0x1f10a, 0x1f10b, 0x1f10c, 0x1f10d, 0x1f10e, 0x1f10f,
+ 0x0249c, 0x0249d, 0x0249e, 0x0249f, 0x024a0, 0x024a1, 0x024a2, 0x024a3,
+ 0x024a4, 0x024a5, 0x024a6, 0x024a7, 0x024a8, 0x024a9, 0x024aa, 0x024ab,
+ 0x024ac, 0x024ad, 0x024ae, 0x024af, 0x024b0, 0x024b1, 0x024b2, 0x024b3,
+ 0x024b4, 0x024b5, 0x1f12a, 0x00043, 0x00052, 0x033c5, 0x1f12e, 0x1f12f,
+ 0x1f130, 0x00042, 0x1f132, 0x1f133, 0x1f134, 0x1f135, 0x1f136, 0x1f137,
+ 0x1f138, 0x1f139, 0x1f13a, 0x1f13b, 0x1f13c, 0x0004e, 0x1f13e, 0x00050,
+ 0x1f140, 0x1f141, 0x00053, 0x1f143, 0x1f144, 0x1f145, 0x00057, 0x1f147,
+ 0x1f148, 0x1f149, 0x1f14a, 0x033b7, 0x1f14c, 0x000df, 0x1f14e, 0x1f14f,
+ 0x1f150, 0x1f151, 0x1f152, 0x1f153, 0x1f154, 0x1f155, 0x1f156, 0x00048,
+ 0x1f158, 0x1f159, 0x1f15a, 0x1f15b, 0x1f15c, 0x1f15d, 0x1f15e, 0x00050,
+ 0x1f160, 0x1f161, 0x1f162, 0x1f163, 0x1f164, 0x1f165, 0x1f166, 0x1f167,
+ 0x1f168, 0x1f169, 0x1f16a, 0x1f16b, 0x1f16c, 0x1f16d, 0x1f16e, 0x1f16f,
+ 0x1f170, 0x1f171, 0x1f172, 0x1f173, 0x1f174, 0x1f175, 0x1f176, 0x1f177,
+ 0x1f178, 0x0004a, 0x1f17a, 0x0004c, 0x0004d, 0x1f17d, 0x1f17e, 0x00050,
+ 0x1f180, 0x1f181, 0x1f182, 0x1f183, 0x1f184, 0x1f185, 0x1f186, 0x1f187,
+ 0x1f188, 0x1f189, 0x00050, 0x1f18b, 0x03380, 0x1f18d, 0x1f18e, 0x1f18f,
+ 0x1f190, 0x1f191, 0x1f192, 0x1f193, 0x1f194, 0x1f195, 0x1f196, 0x1f197,
+ 0x1f198, 0x1f199, 0x1f19a, 0x1f19b, 0x1f19c, 0x1f19d, 0x1f19e, 0x1f19f,
+ 0x1f1a0, 0x1f1a1, 0x1f1a2, 0x1f1a3, 0x1f1a4, 0x1f1a5, 0x1f1a6, 0x1f1a7,
+ 0x1f1a8, 0x1f1a9, 0x1f1aa, 0x1f1ab, 0x1f1ac, 0x1f1ad, 0x1f1ae, 0x1f1af,
+ 0x1f1b0, 0x1f1b1, 0x1f1b2, 0x1f1b3, 0x1f1b4, 0x1f1b5, 0x1f1b6, 0x1f1b7,
+ 0x1f1b8, 0x1f1b9, 0x1f1ba, 0x1f1bb, 0x1f1bc, 0x1f1bd, 0x1f1be, 0x1f1bf,
+ 0x1f1c0, 0x1f1c1, 0x1f1c2, 0x1f1c3, 0x1f1c4, 0x1f1c5, 0x1f1c6, 0x1f1c7,
+ 0x1f1c8, 0x1f1c9, 0x1f1ca, 0x1f1cb, 0x1f1cc, 0x1f1cd, 0x1f1ce, 0x1f1cf,
+ 0x1f1d0, 0x1f1d1, 0x1f1d2, 0x1f1d3, 0x1f1d4, 0x1f1d5, 0x1f1d6, 0x1f1d7,
+ 0x1f1d8, 0x1f1d9, 0x1f1da, 0x1f1db, 0x1f1dc, 0x1f1dd, 0x1f1de, 0x1f1df,
+ 0x1f1e0, 0x1f1e1, 0x1f1e2, 0x1f1e3, 0x1f1e4, 0x1f1e5, 0x1f1e6, 0x1f1e7,
+ 0x1f1e8, 0x1f1e9, 0x1f1ea, 0x1f1eb, 0x1f1ec, 0x1f1ed, 0x1f1ee, 0x1f1ef,
+ 0x1f1f0, 0x1f1f1, 0x1f1f2, 0x1f1f3, 0x1f1f4, 0x1f1f5, 0x1f1f6, 0x1f1f7,
+ 0x1f1f8, 0x1f1f9, 0x1f1fa, 0x1f1fb, 0x1f1fc, 0x1f1fd, 0x1f1fe, 0x1f1ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_1f2[] = {
+ 0x1f200, 0x1f201, 0x1f202, 0x1f203, 0x1f204, 0x1f205, 0x1f206, 0x1f207,
+ 0x1f208, 0x1f209, 0x1f20a, 0x1f20b, 0x1f20c, 0x1f20d, 0x1f20e, 0x1f20f,
+ 0x02f3f, 0x1f211, 0x1f212, 0x03066, 0x03193, 0x1f215, 0x1f216, 0x0319d,
+ 0x1f218, 0x1f219, 0x1f21a, 0x0f9be, 0x1f21c, 0x1f21d, 0x1f21e, 0x1f21f,
+ 0x1f220, 0x1f221, 0x02f63, 0x1f223, 0x1f224, 0x1f225, 0x1f226, 0x1f227,
+ 0x1f228, 0x03192, 0x03194, 0x1f22b, 0x032a7, 0x03197, 0x032a8, 0x1f22f,
+ 0x02f9b, 0x1f231, 0x1f232, 0x1f233, 0x1f234, 0x1f235, 0x1f236, 0x1f237,
+ 0x1f238, 0x1f239, 0x1f23a, 0x1f23b, 0x1f23c, 0x1f23d, 0x1f23e, 0x1f23f,
+ 0x1f240, 0x1f241, 0x1f242, 0x1f243, 0x1f244, 0x1f245, 0x1f246, 0x1f247,
+ 0x1f248, 0x1f249, 0x1f24a, 0x1f24b, 0x1f24c, 0x1f24d, 0x1f24e, 0x1f24f,
+ 0x1f250, 0x1f251, 0x1f252, 0x1f253, 0x1f254, 0x1f255, 0x1f256, 0x1f257,
+ 0x1f258, 0x1f259, 0x1f25a, 0x1f25b, 0x1f25c, 0x1f25d, 0x1f25e, 0x1f25f,
+ 0x1f260, 0x1f261, 0x1f262, 0x1f263, 0x1f264, 0x1f265, 0x1f266, 0x1f267,
+ 0x1f268, 0x1f269, 0x1f26a, 0x1f26b, 0x1f26c, 0x1f26d, 0x1f26e, 0x1f26f,
+ 0x1f270, 0x1f271, 0x1f272, 0x1f273, 0x1f274, 0x1f275, 0x1f276, 0x1f277,
+ 0x1f278, 0x1f279, 0x1f27a, 0x1f27b, 0x1f27c, 0x1f27d, 0x1f27e, 0x1f27f,
+ 0x1f280, 0x1f281, 0x1f282, 0x1f283, 0x1f284, 0x1f285, 0x1f286, 0x1f287,
+ 0x1f288, 0x1f289, 0x1f28a, 0x1f28b, 0x1f28c, 0x1f28d, 0x1f28e, 0x1f28f,
+ 0x1f290, 0x1f291, 0x1f292, 0x1f293, 0x1f294, 0x1f295, 0x1f296, 0x1f297,
+ 0x1f298, 0x1f299, 0x1f29a, 0x1f29b, 0x1f29c, 0x1f29d, 0x1f29e, 0x1f29f,
+ 0x1f2a0, 0x1f2a1, 0x1f2a2, 0x1f2a3, 0x1f2a4, 0x1f2a5, 0x1f2a6, 0x1f2a7,
+ 0x1f2a8, 0x1f2a9, 0x1f2aa, 0x1f2ab, 0x1f2ac, 0x1f2ad, 0x1f2ae, 0x1f2af,
+ 0x1f2b0, 0x1f2b1, 0x1f2b2, 0x1f2b3, 0x1f2b4, 0x1f2b5, 0x1f2b6, 0x1f2b7,
+ 0x1f2b8, 0x1f2b9, 0x1f2ba, 0x1f2bb, 0x1f2bc, 0x1f2bd, 0x1f2be, 0x1f2bf,
+ 0x1f2c0, 0x1f2c1, 0x1f2c2, 0x1f2c3, 0x1f2c4, 0x1f2c5, 0x1f2c6, 0x1f2c7,
+ 0x1f2c8, 0x1f2c9, 0x1f2ca, 0x1f2cb, 0x1f2cc, 0x1f2cd, 0x1f2ce, 0x1f2cf,
+ 0x1f2d0, 0x1f2d1, 0x1f2d2, 0x1f2d3, 0x1f2d4, 0x1f2d5, 0x1f2d6, 0x1f2d7,
+ 0x1f2d8, 0x1f2d9, 0x1f2da, 0x1f2db, 0x1f2dc, 0x1f2dd, 0x1f2de, 0x1f2df,
+ 0x1f2e0, 0x1f2e1, 0x1f2e2, 0x1f2e3, 0x1f2e4, 0x1f2e5, 0x1f2e6, 0x1f2e7,
+ 0x1f2e8, 0x1f2e9, 0x1f2ea, 0x1f2eb, 0x1f2ec, 0x1f2ed, 0x1f2ee, 0x1f2ef,
+ 0x1f2f0, 0x1f2f1, 0x1f2f2, 0x1f2f3, 0x1f2f4, 0x1f2f5, 0x1f2f6, 0x1f2f7,
+ 0x1f2f8, 0x1f2f9, 0x1f2fa, 0x1f2fb, 0x1f2fc, 0x1f2fd, 0x1f2fe, 0x1f2ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_2f8[] = {
+ 0x2f800, 0x2f801, 0x2f802, 0x2f803, 0x2f804, 0x0fa30, 0x2f806, 0x2f807,
+ 0x2f808, 0x2f809, 0x0fa31, 0x2f80b, 0x2f80c, 0x2f80d, 0x0fa32, 0x2f80f,
+ 0x2f810, 0x2f811, 0x2f812, 0x2f813, 0x2f814, 0x1f21e, 0x2f816, 0x2f817,
+ 0x2f818, 0x2f819, 0x2f81a, 0x0fa71, 0x2f81c, 0x02f10, 0x2f81e, 0x2f81f,
+ 0x2f820, 0x2f821, 0x2f822, 0x2f823, 0x2f824, 0x0fa76, 0x0fa33, 0x0fa34,
+ 0x0fa77, 0x2f829, 0x2f82a, 0x0f963, 0x2f82c, 0x0fa35, 0x2f82e, 0x2f82f,
+ 0x2f830, 0x2f831, 0x2f831, 0x2f831, 0x2f834, 0x2f835, 0x2f836, 0x2f837,
+ 0x2f838, 0x2f839, 0x2f83a, 0x2f83b, 0x2f83c, 0x2f83d, 0x2f83e, 0x2f83f,
+ 0x2f840, 0x2f841, 0x2f842, 0x2f843, 0x2f844, 0x2f845, 0x2f845, 0x0fa7a,
+ 0x2f848, 0x2f849, 0x2f84a, 0x2f84b, 0x0fa37, 0x2f84d, 0x2f84e, 0x2f84f,
+ 0x0fa00, 0x2f851, 0x2f852, 0x2f853, 0x2f854, 0x2f855, 0x2f856, 0x2f857,
+ 0x2f858, 0x2f859, 0x2f85a, 0x2f85b, 0x2f85c, 0x1f215, 0x2f85e, 0x2f85f,
+ 0x2f860, 0x2f861, 0x2f862, 0x2f863, 0x2f864, 0x2f865, 0x2f866, 0x2f867,
+ 0x2f868, 0x2f869, 0x2f86a, 0x2f86a, 0x2f86c, 0x2f86d, 0x2f86e, 0x0f95f,
+ 0x2f870, 0x2f871, 0x2f872, 0x2f873, 0x2f874, 0x02e8e, 0x2f876, 0x2f877,
+ 0x02f2c, 0x2f879, 0x2f87a, 0x2f87b, 0x2f87c, 0x2f87d, 0x2f87e, 0x2f87f,
+ 0x2f880, 0x2f881, 0x2f882, 0x2f883, 0x2f884, 0x2f885, 0x2f886, 0x2f887,
+ 0x2f888, 0x2f889, 0x2f88a, 0x2f88b, 0x2f88c, 0x2f88d, 0x0f928, 0x2f88f,
+ 0x02f36, 0x2f891, 0x2f891, 0x2f893, 0x2f894, 0x2f894, 0x2f896, 0x2f897,
+ 0x2f898, 0x2f899, 0x2f89a, 0x2f89b, 0x2f89c, 0x2f89d, 0x2f89e, 0x2f89f,
+ 0x2f8a0, 0x2f8a1, 0x2f8a2, 0x0fa3d, 0x2f8a4, 0x2f8a5, 0x2f8a6, 0x2f8a7,
+ 0x0fa87, 0x2f8a7, 0x2f8aa, 0x0fa3f, 0x2f8ac, 0x2f8ad, 0x2f8ae, 0x2f8af,
+ 0x0fa40, 0x0f90d, 0x2f8b2, 0x2f8b3, 0x2f8b4, 0x2f8b5, 0x2f8b6, 0x2f8b7,
+ 0x2f8b8, 0x2f8b9, 0x2f8ba, 0x2f8bb, 0x2f8bc, 0x2f8bd, 0x2f8be, 0x2f8bf,
+ 0x2f8c0, 0x2f8c1, 0x2f8c2, 0x2f8c3, 0x2f8c4, 0x2f8c5, 0x2f8c6, 0x2f8c7,
+ 0x0fa41, 0x2f8c9, 0x2f8ca, 0x2f8cb, 0x2f8cc, 0x2f8cd, 0x2f8ce, 0x0fa43,
+ 0x2f8d0, 0x2f8d1, 0x2f8d2, 0x2f8d3, 0x2f8d4, 0x2f8d5, 0x2f8d6, 0x2f8d7,
+ 0x0f929, 0x0fa93, 0x2f8da, 0x2f8db, 0x2f8dc, 0x2f8dd, 0x2f8de, 0x2f8df,
+ 0x2f8e0, 0x2f8e1, 0x0fa44, 0x2f8e3, 0x2f8e4, 0x2f8e5, 0x2f8e6, 0x0fad2,
+ 0x2f8e8, 0x2f8e9, 0x2f8ea, 0x2f8eb, 0x2f8ec, 0x2f8ed, 0x2f8ee, 0x2f8ef,
+ 0x2f8f0, 0x2f8f1, 0x2f8f2, 0x2f8f3, 0x2f8f4, 0x0f970, 0x2f8f6, 0x2f8f7,
+ 0x2f8f8, 0x2f8f9, 0x2f8fa, 0x2f8fb, 0x2f8fc, 0x2f8fd, 0x2f8fe, 0x2f8ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_2f9[] = {
+ 0x2f900, 0x0fa45, 0x0f9ca, 0x2f903, 0x2f904, 0x2f905, 0x2f906, 0x2f907,
+ 0x2f908, 0x2f909, 0x2f90a, 0x0fa99, 0x2f90c, 0x2f90d, 0x2f90e, 0x2f90f,
+ 0x2f910, 0x2f911, 0x2f912, 0x2f913, 0x0fa9b, 0x2f915, 0x2f916, 0x2f917,
+ 0x2f918, 0x2f919, 0x2f91a, 0x2f91b, 0x2f91c, 0x2f91d, 0x2f91e, 0x2f91f,
+ 0x2f920, 0x0fa9e, 0x2f922, 0x2f923, 0x2f924, 0x2f925, 0x2f926, 0x2f927,
+ 0x2f928, 0x02ea9, 0x2f92a, 0x2f92b, 0x2f92c, 0x2f92c, 0x2f92e, 0x2f92f,
+ 0x0faa1, 0x2f931, 0x2f932, 0x2f933, 0x2f934, 0x2f935, 0x2f936, 0x2f937,
+ 0x0f962, 0x2f939, 0x2f93a, 0x2f93b, 0x2f93c, 0x2f93d, 0x2f93e, 0x2f93f,
+ 0x0faa8, 0x2f941, 0x2f942, 0x2f943, 0x2f944, 0x2f945, 0x2f946, 0x2f946,
+ 0x0faa9, 0x0fad4, 0x2f94a, 0x2f94b, 0x2f94c, 0x2f94d, 0x2f94e, 0x0f93b,
+ 0x0faab, 0x2f951, 0x2f952, 0x0fa50, 0x2f954, 0x2f955, 0x0fa1b, 0x2f957,
+ 0x2f958, 0x0fa54, 0x2f95a, 0x2f95b, 0x2f95c, 0x2f95d, 0x2f95d, 0x2f95f,
+ 0x2f960, 0x2f961, 0x2f962, 0x2f963, 0x2f964, 0x2f965, 0x2f966, 0x2f967,
+ 0x2f968, 0x2f969, 0x2f96a, 0x2f96b, 0x2f96c, 0x2f96d, 0x2f96e, 0x2f96f,
+ 0x2f970, 0x2f971, 0x2f972, 0x2f973, 0x2f974, 0x2f975, 0x2f976, 0x2f977,
+ 0x2f978, 0x2f979, 0x0fa5b, 0x2f97b, 0x2f97c, 0x2f97d, 0x2f97e, 0x2f97f,
+ 0x2f980, 0x2f981, 0x2f982, 0x2f983, 0x2f984, 0x2f985, 0x2f986, 0x2f987,
+ 0x2f988, 0x2f989, 0x2f98a, 0x2f893, 0x2f98c, 0x2f98d, 0x2f98e, 0x2f98f,
+ 0x2f990, 0x2f991, 0x2f992, 0x2f993, 0x2f994, 0x2f995, 0x2f996, 0x2f997,
+ 0x0f974, 0x2f999, 0x2f99a, 0x2f99b, 0x2f99c, 0x2f99d, 0x2f99e, 0x0fa5f,
+ 0x2f9a0, 0x2f9a1, 0x2f9a2, 0x2f9a3, 0x2f9a4, 0x2f9a5, 0x2f9a6, 0x2f9a7,
+ 0x2f9a8, 0x2f9a9, 0x2f9aa, 0x2f9ab, 0x2f9ac, 0x2f9ad, 0x2f9ae, 0x2f9af,
+ 0x2f9b0, 0x2f9b1, 0x2f9b2, 0x2f9b3, 0x0f936, 0x2f9b5, 0x2f9b6, 0x2f9b7,
+ 0x2f9b8, 0x2f9b9, 0x2f9ba, 0x0fab5, 0x2f9bc, 0x2f9bd, 0x2f9be, 0x2f9bf,
+ 0x2f9c0, 0x2f9c1, 0x2f9c2, 0x2f9c3, 0x02f90, 0x2f9c5, 0x2f9c6, 0x2f9c7,
+ 0x2f9c8, 0x2f9c9, 0x2f9ca, 0x2f9cb, 0x2f9cc, 0x2f9cd, 0x2f9ce, 0x2f9cf,
+ 0x0fabe, 0x0fac0, 0x02f97, 0x2f9d3, 0x2f9d4, 0x2f9d5, 0x2f9d6, 0x2f9d7,
+ 0x2f9d8, 0x2f9d9, 0x2f9da, 0x2f9db, 0x2f9dc, 0x2f9dd, 0x2f9de, 0x0fac2,
+ 0x2f9e0, 0x2f9e1, 0x2f9e2, 0x2f9e3, 0x2f9e4, 0x2f9e5, 0x2f9e6, 0x2f9e7,
+ 0x2f9e8, 0x2f9e9, 0x2f9ea, 0x2f9eb, 0x2f9ec, 0x2f9ed, 0x2f9ee, 0x2f9ef,
+ 0x2f9f0, 0x2f9f1, 0x2f9f2, 0x2f9f3, 0x2f9f4, 0x2f9f5, 0x2f9f6, 0x2f9f7,
+ 0x2f9f8, 0x2f9f9, 0x2f9fa, 0x2f9fb, 0x2f9fc, 0x2f9fd, 0x0facb, 0x2f9ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_2fa[] = {
+ 0x2fa00, 0x2fa01, 0x2fa02, 0x2fa03, 0x2fa04, 0x2fa05, 0x2fa06, 0x2fa07,
+ 0x2fa08, 0x2fa09, 0x0facd, 0x2fa0b, 0x2fa0c, 0x2fa0d, 0x2fa0e, 0x2fa0f,
+ 0x2fa10, 0x2fa11, 0x2fa12, 0x2fa13, 0x2fa14, 0x02fc7, 0x04d56, 0x02fcb,
+ 0x02eea, 0x2fa19, 0x2fa1a, 0x2fa1b, 0x02fd0, 0x2fa1d, 0x2fa1e, 0x2fa1f,
+ 0x2fa20, 0x2fa21, 0x2fa22, 0x2fa23, 0x2fa24, 0x2fa25, 0x2fa26, 0x2fa27,
+ 0x2fa28, 0x2fa29, 0x2fa2a, 0x2fa2b, 0x2fa2c, 0x2fa2d, 0x2fa2e, 0x2fa2f,
+ 0x2fa30, 0x2fa31, 0x2fa32, 0x2fa33, 0x2fa34, 0x2fa35, 0x2fa36, 0x2fa37,
+ 0x2fa38, 0x2fa39, 0x2fa3a, 0x2fa3b, 0x2fa3c, 0x2fa3d, 0x2fa3e, 0x2fa3f,
+ 0x2fa40, 0x2fa41, 0x2fa42, 0x2fa43, 0x2fa44, 0x2fa45, 0x2fa46, 0x2fa47,
+ 0x2fa48, 0x2fa49, 0x2fa4a, 0x2fa4b, 0x2fa4c, 0x2fa4d, 0x2fa4e, 0x2fa4f,
+ 0x2fa50, 0x2fa51, 0x2fa52, 0x2fa53, 0x2fa54, 0x2fa55, 0x2fa56, 0x2fa57,
+ 0x2fa58, 0x2fa59, 0x2fa5a, 0x2fa5b, 0x2fa5c, 0x2fa5d, 0x2fa5e, 0x2fa5f,
+ 0x2fa60, 0x2fa61, 0x2fa62, 0x2fa63, 0x2fa64, 0x2fa65, 0x2fa66, 0x2fa67,
+ 0x2fa68, 0x2fa69, 0x2fa6a, 0x2fa6b, 0x2fa6c, 0x2fa6d, 0x2fa6e, 0x2fa6f,
+ 0x2fa70, 0x2fa71, 0x2fa72, 0x2fa73, 0x2fa74, 0x2fa75, 0x2fa76, 0x2fa77,
+ 0x2fa78, 0x2fa79, 0x2fa7a, 0x2fa7b, 0x2fa7c, 0x2fa7d, 0x2fa7e, 0x2fa7f,
+ 0x2fa80, 0x2fa81, 0x2fa82, 0x2fa83, 0x2fa84, 0x2fa85, 0x2fa86, 0x2fa87,
+ 0x2fa88, 0x2fa89, 0x2fa8a, 0x2fa8b, 0x2fa8c, 0x2fa8d, 0x2fa8e, 0x2fa8f,
+ 0x2fa90, 0x2fa91, 0x2fa92, 0x2fa93, 0x2fa94, 0x2fa95, 0x2fa96, 0x2fa97,
+ 0x2fa98, 0x2fa99, 0x2fa9a, 0x2fa9b, 0x2fa9c, 0x2fa9d, 0x2fa9e, 0x2fa9f,
+ 0x2faa0, 0x2faa1, 0x2faa2, 0x2faa3, 0x2faa4, 0x2faa5, 0x2faa6, 0x2faa7,
+ 0x2faa8, 0x2faa9, 0x2faaa, 0x2faab, 0x2faac, 0x2faad, 0x2faae, 0x2faaf,
+ 0x2fab0, 0x2fab1, 0x2fab2, 0x2fab3, 0x2fab4, 0x2fab5, 0x2fab6, 0x2fab7,
+ 0x2fab8, 0x2fab9, 0x2faba, 0x2fabb, 0x2fabc, 0x2fabd, 0x2fabe, 0x2fabf,
+ 0x2fac0, 0x2fac1, 0x2fac2, 0x2fac3, 0x2fac4, 0x2fac5, 0x2fac6, 0x2fac7,
+ 0x2fac8, 0x2fac9, 0x2faca, 0x2facb, 0x2facc, 0x2facd, 0x2face, 0x2facf,
+ 0x2fad0, 0x2fad1, 0x2fad2, 0x2fad3, 0x2fad4, 0x2fad5, 0x2fad6, 0x2fad7,
+ 0x2fad8, 0x2fad9, 0x2fada, 0x2fadb, 0x2fadc, 0x2fadd, 0x2fade, 0x2fadf,
+ 0x2fae0, 0x2fae1, 0x2fae2, 0x2fae3, 0x2fae4, 0x2fae5, 0x2fae6, 0x2fae7,
+ 0x2fae8, 0x2fae9, 0x2faea, 0x2faeb, 0x2faec, 0x2faed, 0x2faee, 0x2faef,
+ 0x2faf0, 0x2faf1, 0x2faf2, 0x2faf3, 0x2faf4, 0x2faf5, 0x2faf6, 0x2faf7,
+ 0x2faf8, 0x2faf9, 0x2fafa, 0x2fafb, 0x2fafc, 0x2fafd, 0x2fafe, 0x2faff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_e00[] = {
+ 0xe0000, 0x00000, 0xe0002, 0xe0003, 0xe0004, 0xe0005, 0xe0006, 0xe0007,
+ 0xe0008, 0xe0009, 0xe000a, 0xe000b, 0xe000c, 0xe000d, 0xe000e, 0xe000f,
+ 0xe0010, 0xe0011, 0xe0012, 0xe0013, 0xe0014, 0xe0015, 0xe0016, 0xe0017,
+ 0xe0018, 0xe0019, 0xe001a, 0xe001b, 0xe001c, 0xe001d, 0xe001e, 0xe001f,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0xe0080, 0xe0081, 0xe0082, 0xe0083, 0xe0084, 0xe0085, 0xe0086, 0xe0087,
+ 0xe0088, 0xe0089, 0xe008a, 0xe008b, 0xe008c, 0xe008d, 0xe008e, 0xe008f,
+ 0xe0090, 0xe0091, 0xe0092, 0xe0093, 0xe0094, 0xe0095, 0xe0096, 0xe0097,
+ 0xe0098, 0xe0099, 0xe009a, 0xe009b, 0xe009c, 0xe009d, 0xe009e, 0xe009f,
+ 0xe00a0, 0xe00a1, 0xe00a2, 0xe00a3, 0xe00a4, 0xe00a5, 0xe00a6, 0xe00a7,
+ 0xe00a8, 0xe00a9, 0xe00aa, 0xe00ab, 0xe00ac, 0xe00ad, 0xe00ae, 0xe00af,
+ 0xe00b0, 0xe00b1, 0xe00b2, 0xe00b3, 0xe00b4, 0xe00b5, 0xe00b6, 0xe00b7,
+ 0xe00b8, 0xe00b9, 0xe00ba, 0xe00bb, 0xe00bc, 0xe00bd, 0xe00be, 0xe00bf,
+ 0xe00c0, 0xe00c1, 0xe00c2, 0xe00c3, 0xe00c4, 0xe00c5, 0xe00c6, 0xe00c7,
+ 0xe00c8, 0xe00c9, 0xe00ca, 0xe00cb, 0xe00cc, 0xe00cd, 0xe00ce, 0xe00cf,
+ 0xe00d0, 0xe00d1, 0xe00d2, 0xe00d3, 0xe00d4, 0xe00d5, 0xe00d6, 0xe00d7,
+ 0xe00d8, 0xe00d9, 0xe00da, 0xe00db, 0xe00dc, 0xe00dd, 0xe00de, 0xe00df,
+ 0xe00e0, 0xe00e1, 0xe00e2, 0xe00e3, 0xe00e4, 0xe00e5, 0xe00e6, 0xe00e7,
+ 0xe00e8, 0xe00e9, 0xe00ea, 0xe00eb, 0xe00ec, 0xe00ed, 0xe00ee, 0xe00ef,
+ 0xe00f0, 0xe00f1, 0xe00f2, 0xe00f3, 0xe00f4, 0xe00f5, 0xe00f6, 0xe00f7,
+ 0xe00f8, 0xe00f9, 0xe00fa, 0xe00fb, 0xe00fc, 0xe00fd, 0xe00fe, 0xe00ff
+};
+
+static uint32_t unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_e01[] = {
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0xe01f0, 0xe01f1, 0xe01f2, 0xe01f3, 0xe01f4, 0xe01f5, 0xe01f6, 0xe01f7,
+ 0xe01f8, 0xe01f9, 0xe01fa, 0xe01fb, 0xe01fc, 0xe01fd, 0xe01fe, 0xe01ff
+};
+
+static uint32_t *unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_table[4352] = {
+ unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_00, unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_01,
+ unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_02, unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_03,
+ unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_04, unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_05,
+ unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_06, unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_07,
+ unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_08, unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_09,
+ unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_0a, unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_0b,
+ unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_0c, unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_0d,
+ unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_0e, unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_0f,
+ unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_10, NULL,
+ NULL, unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_13,
+ NULL, NULL,
+ unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_16, unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_17,
+ unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_18, unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_19,
+ unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_1a, unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_1b,
+ unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_1c, unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_1d,
+ unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_1e, unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_1f,
+ unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_20, unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_21,
+ unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_22, NULL,
+ unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_24, NULL,
+ NULL, unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_27,
+ NULL, NULL,
+ unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_2a, NULL,
+ unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_2c, unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_2d,
+ unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_2e, unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_2f,
+ unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_30, unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_31,
+ unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_32, unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_33,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_a6, unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_a7,
+ unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_a8, unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_a9,
+ unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_aa, unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_ab,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_f9,
+ unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_fa, unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_fb,
+ unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_fc, unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_fd,
+ unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_fe, unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_ff,
+ NULL, unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_101,
+ NULL, unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_103,
+ unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_104, NULL,
+ NULL, NULL,
+ unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_108, unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_109,
+ unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_10a, unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_10b,
+ unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_10c, NULL,
+ unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_10e, NULL,
+ unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_110, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_124, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_1d1,
+ unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_1d2, unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_1d3,
+ unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_1d4, unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_1d5,
+ unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_1d6, unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_1d7,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_1f1,
+ unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_1f2, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_2f8, unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_2f9,
+ unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_2fa, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_e00, unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_page_e01,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL
+};
+
+#endif
diff --git a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql_unicode_520_ci_table.h b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql_unicode_520_ci_table.h
new file mode 100644
index 00000000000..22a56d7f300
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql_unicode_520_ci_table.h
@@ -0,0 +1,5028 @@
+/*
+ Copyright(C) 2013-2015 Kouhei Sutou <kou@clear-code.com>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; version 2
+ of the License.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ MA 02110-1301, USA
+
+ This file uses normalization table defined in
+ mysql-5.6.23/strings/ctype-uca.c.
+ The following is the header of the file:
+
+ Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; version 2
+ of the License.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ MA 02110-1301, USA
+
+ UCA (Unicode Collation Algorithm) support.
+ Written by Alexander Barkov <bar@mysql.com>
+*/
+
+#ifndef MYSQL_UCA_520_H
+#define MYSQL_UCA_520_H
+
+#include <stdint.h>
+
+static uint32_t unicode_520_ci_page_00[] = {
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00009, 0x0000a, 0x0000b, 0x0000c, 0x0000d, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00020, 0x00021, 0x00022, 0x00023, 0x00024, 0x00025, 0x00026, 0x00027,
+ 0x00028, 0x00029, 0x0002a, 0x0002b, 0x0002c, 0x0002d, 0x0002e, 0x0002f,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x0003a, 0x0003b, 0x0003c, 0x0003d, 0x0003e, 0x0003f,
+ 0x00040, 0x00041, 0x00042, 0x00043, 0x00044, 0x00045, 0x00046, 0x00047,
+ 0x00048, 0x00049, 0x0004a, 0x0004b, 0x0004c, 0x0004d, 0x0004e, 0x0004f,
+ 0x00050, 0x00051, 0x00052, 0x00053, 0x00054, 0x00055, 0x00056, 0x00057,
+ 0x00058, 0x00059, 0x0005a, 0x0005b, 0x0005c, 0x0005d, 0x0005e, 0x0005f,
+ 0x00060, 0x00041, 0x00042, 0x00043, 0x00044, 0x00045, 0x00046, 0x00047,
+ 0x00048, 0x00049, 0x0004a, 0x0004b, 0x0004c, 0x0004d, 0x0004e, 0x0004f,
+ 0x00050, 0x00051, 0x00052, 0x00053, 0x00054, 0x00055, 0x00056, 0x00057,
+ 0x00058, 0x00059, 0x0005a, 0x0007b, 0x0007c, 0x0007d, 0x0007e, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00085, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00020, 0x000a1, 0x000a2, 0x000a3, 0x000a4, 0x000a5, 0x000a6, 0x000a7,
+ 0x000a8, 0x000a9, 0x00041, 0x000ab, 0x000ac, 0x000ad, 0x000ae, 0x000af,
+ 0x000b0, 0x000b1, 0x00032, 0x00033, 0x000b4, 0x0039c, 0x000b6, 0x000b7,
+ 0x000b8, 0x00031, 0x0004f, 0x000bb, 0x000bc, 0x000bd, 0x000be, 0x000bf,
+ 0x00041, 0x00041, 0x00041, 0x00041, 0x00041, 0x00041, 0x000c6, 0x00043,
+ 0x00045, 0x00045, 0x00045, 0x00045, 0x00049, 0x00049, 0x00049, 0x00049,
+ 0x00044, 0x0004e, 0x0004f, 0x0004f, 0x0004f, 0x0004f, 0x0004f, 0x000d7,
+ 0x0004f, 0x00055, 0x00055, 0x00055, 0x00055, 0x00059, 0x000de, 0x000df,
+ 0x00041, 0x00041, 0x00041, 0x00041, 0x00041, 0x00041, 0x000c6, 0x00043,
+ 0x00045, 0x00045, 0x00045, 0x00045, 0x00049, 0x00049, 0x00049, 0x00049,
+ 0x00044, 0x0004e, 0x0004f, 0x0004f, 0x0004f, 0x0004f, 0x0004f, 0x000f7,
+ 0x0004f, 0x00055, 0x00055, 0x00055, 0x00055, 0x00059, 0x000fe, 0x000ff
+};
+
+static uint32_t unicode_520_ci_page_01[] = {
+ 0x00041, 0x00041, 0x00041, 0x00041, 0x00041, 0x00041, 0x00043, 0x00043,
+ 0x00043, 0x00043, 0x00043, 0x00043, 0x00043, 0x00043, 0x00044, 0x00044,
+ 0x00044, 0x00044, 0x00045, 0x00045, 0x00045, 0x00045, 0x00045, 0x00045,
+ 0x00045, 0x00045, 0x00045, 0x00045, 0x00047, 0x00047, 0x00047, 0x00047,
+ 0x00047, 0x00047, 0x00047, 0x00047, 0x00048, 0x00048, 0x00048, 0x00048,
+ 0x00049, 0x00049, 0x00049, 0x00049, 0x00049, 0x00049, 0x00049, 0x00049,
+ 0x00049, 0x00131, 0x00132, 0x00132, 0x0004a, 0x0004a, 0x0004b, 0x0004b,
+ 0x00138, 0x0004c, 0x0004c, 0x0004c, 0x0004c, 0x0004c, 0x0004c, 0x0004c,
+ 0x0004c, 0x0004c, 0x0004c, 0x0004e, 0x0004e, 0x0004e, 0x0004e, 0x0004e,
+ 0x0004e, 0x00149, 0x0014a, 0x0014a, 0x0004f, 0x0004f, 0x0004f, 0x0004f,
+ 0x0004f, 0x0004f, 0x00152, 0x00152, 0x00052, 0x00052, 0x00052, 0x00052,
+ 0x00052, 0x00052, 0x00053, 0x00053, 0x00053, 0x00053, 0x00053, 0x00053,
+ 0x00053, 0x00053, 0x00054, 0x00054, 0x00054, 0x00054, 0x00166, 0x00166,
+ 0x00055, 0x00055, 0x00055, 0x00055, 0x00055, 0x00055, 0x00055, 0x00055,
+ 0x00055, 0x00055, 0x00055, 0x00055, 0x00057, 0x00057, 0x00059, 0x00059,
+ 0x00059, 0x0005a, 0x0005a, 0x0005a, 0x0005a, 0x0005a, 0x0005a, 0x00053,
+ 0x00180, 0x00181, 0x00182, 0x00182, 0x00184, 0x00184, 0x00186, 0x00187,
+ 0x00187, 0x00189, 0x0018a, 0x0018b, 0x0018b, 0x0018d, 0x0018e, 0x0018f,
+ 0x00190, 0x00191, 0x00191, 0x00193, 0x00194, 0x00195, 0x00196, 0x00197,
+ 0x00198, 0x00198, 0x0019a, 0x0019b, 0x0019c, 0x0019d, 0x0019e, 0x0019f,
+ 0x0004f, 0x0004f, 0x001a2, 0x001a2, 0x001a4, 0x001a4, 0x001a6, 0x001a7,
+ 0x001a7, 0x001a9, 0x001aa, 0x001ab, 0x001ac, 0x001ac, 0x001ae, 0x00055,
+ 0x00055, 0x001b1, 0x001b2, 0x001b3, 0x001b3, 0x001b5, 0x001b5, 0x001b7,
+ 0x001b8, 0x001b8, 0x001ba, 0x001bb, 0x001bc, 0x001bc, 0x001be, 0x001bf,
+ 0x001c0, 0x001c1, 0x001c2, 0x001c3, 0x001c4, 0x001c4, 0x001c4, 0x001c7,
+ 0x001c7, 0x001c7, 0x001ca, 0x001ca, 0x001ca, 0x00041, 0x00041, 0x00049,
+ 0x00049, 0x0004f, 0x0004f, 0x00055, 0x00055, 0x00055, 0x00055, 0x00055,
+ 0x00055, 0x00055, 0x00055, 0x00055, 0x00055, 0x0018e, 0x00041, 0x00041,
+ 0x00041, 0x00041, 0x000c6, 0x000c6, 0x001e4, 0x001e4, 0x00047, 0x00047,
+ 0x0004b, 0x0004b, 0x0004f, 0x0004f, 0x0004f, 0x0004f, 0x001b7, 0x001b7,
+ 0x0004a, 0x001c4, 0x001c4, 0x001c4, 0x00047, 0x00047, 0x00195, 0x001bf,
+ 0x0004e, 0x0004e, 0x00041, 0x00041, 0x000c6, 0x000c6, 0x0004f, 0x001ff
+};
+
+static uint32_t unicode_520_ci_page_02[] = {
+ 0x00041, 0x00041, 0x00041, 0x00041, 0x00045, 0x00045, 0x00045, 0x00045,
+ 0x00049, 0x00049, 0x00049, 0x00049, 0x0004f, 0x0004f, 0x0004f, 0x0004f,
+ 0x00052, 0x00052, 0x00052, 0x00052, 0x00055, 0x00055, 0x00055, 0x00055,
+ 0x00053, 0x00053, 0x00054, 0x00054, 0x0021c, 0x0021c, 0x00048, 0x00048,
+ 0x0019e, 0x00221, 0x00222, 0x00222, 0x00224, 0x00224, 0x00041, 0x00041,
+ 0x00045, 0x00045, 0x0004f, 0x0004f, 0x0004f, 0x0004f, 0x0004f, 0x0004f,
+ 0x0004f, 0x0004f, 0x00059, 0x00059, 0x00234, 0x00235, 0x00236, 0x00237,
+ 0x00238, 0x00239, 0x0023a, 0x0023b, 0x0023b, 0x0019a, 0x0023e, 0x0023f,
+ 0x00240, 0x00241, 0x00241, 0x00180, 0x00244, 0x00245, 0x00246, 0x00246,
+ 0x00248, 0x00248, 0x0024a, 0x0024a, 0x0024c, 0x0024c, 0x0024e, 0x0024e,
+ 0x00250, 0x00251, 0x00252, 0x00181, 0x00186, 0x00255, 0x00189, 0x0018a,
+ 0x00258, 0x0018f, 0x0025a, 0x00190, 0x0025c, 0x0025d, 0x0025e, 0x0025f,
+ 0x00193, 0x00261, 0x00262, 0x00194, 0x00264, 0x00265, 0x00266, 0x00267,
+ 0x00197, 0x00196, 0x0026a, 0x0026b, 0x0026c, 0x0026d, 0x0026e, 0x0019c,
+ 0x00270, 0x00271, 0x0019d, 0x00273, 0x00274, 0x0019f, 0x00276, 0x00277,
+ 0x00278, 0x00279, 0x0027a, 0x0027b, 0x0027c, 0x0027d, 0x0027e, 0x0027f,
+ 0x001a6, 0x00281, 0x00282, 0x001a9, 0x00284, 0x00285, 0x00286, 0x00287,
+ 0x001ae, 0x00244, 0x001b1, 0x001b2, 0x00245, 0x0028d, 0x0028e, 0x0028f,
+ 0x00290, 0x00291, 0x001b7, 0x00293, 0x00294, 0x00295, 0x00296, 0x00297,
+ 0x00298, 0x00299, 0x0029a, 0x0029b, 0x0029c, 0x0029d, 0x0029e, 0x0029f,
+ 0x002a0, 0x002a1, 0x002a2, 0x001c4, 0x002a4, 0x002a5, 0x001be, 0x002a7,
+ 0x002a8, 0x002a9, 0x002aa, 0x002ab, 0x002ac, 0x002ad, 0x002ae, 0x002af,
+ 0x00048, 0x00266, 0x0004a, 0x00052, 0x00279, 0x0027b, 0x00281, 0x00057,
+ 0x00059, 0x002b9, 0x002ba, 0x002bb, 0x002bc, 0x002bd, 0x002be, 0x002bf,
+ 0x002c0, 0x002c1, 0x002c2, 0x002c3, 0x002c4, 0x002c5, 0x002c6, 0x002c7,
+ 0x002c8, 0x002c9, 0x002ca, 0x002cb, 0x002cc, 0x002cd, 0x002ce, 0x002cf,
+ 0x002d0, 0x002d1, 0x002d2, 0x002d3, 0x002d4, 0x002d5, 0x002d6, 0x002d7,
+ 0x002d8, 0x002d9, 0x002da, 0x002db, 0x002dc, 0x002dd, 0x002de, 0x002df,
+ 0x00194, 0x0004c, 0x00053, 0x00058, 0x00295, 0x002e5, 0x002e6, 0x002e7,
+ 0x002e8, 0x002e9, 0x002ea, 0x002eb, 0x002ec, 0x002ed, 0x002ee, 0x002ef,
+ 0x002f0, 0x002f1, 0x002f2, 0x002f3, 0x002f4, 0x002f5, 0x002f6, 0x002f7,
+ 0x002f8, 0x002f9, 0x002fa, 0x002fb, 0x002fc, 0x002fd, 0x002fe, 0x002ff
+};
+
+static uint32_t unicode_520_ci_page_03[] = {
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00041, 0x00045, 0x00049, 0x0004f, 0x00055,
+ 0x00043, 0x00044, 0x00048, 0x0004d, 0x00052, 0x00054, 0x00056, 0x00058,
+ 0x00370, 0x00370, 0x00372, 0x00372, 0x002b9, 0x00375, 0x00376, 0x00376,
+ 0x00378, 0x00379, 0x00399, 0x0037b, 0x0037c, 0x0037d, 0x0003b, 0x0037f,
+ 0x00380, 0x00381, 0x00382, 0x00383, 0x000b4, 0x000a8, 0x00391, 0x000b7,
+ 0x00395, 0x00397, 0x00399, 0x0038b, 0x0039f, 0x0038d, 0x003a5, 0x003a9,
+ 0x00399, 0x00391, 0x00392, 0x00393, 0x00394, 0x00395, 0x00396, 0x00397,
+ 0x00398, 0x00399, 0x0039a, 0x0039b, 0x0039c, 0x0039d, 0x0039e, 0x0039f,
+ 0x003a0, 0x003a1, 0x003a2, 0x003a3, 0x003a4, 0x003a5, 0x003a6, 0x003a7,
+ 0x003a8, 0x003a9, 0x00399, 0x003a5, 0x00391, 0x00395, 0x00397, 0x00399,
+ 0x003a5, 0x00391, 0x00392, 0x00393, 0x00394, 0x00395, 0x00396, 0x00397,
+ 0x00398, 0x00399, 0x0039a, 0x0039b, 0x0039c, 0x0039d, 0x0039e, 0x0039f,
+ 0x003a0, 0x003a1, 0x003a3, 0x003a3, 0x003a4, 0x003a5, 0x003a6, 0x003a7,
+ 0x003a8, 0x003a9, 0x00399, 0x003a5, 0x0039f, 0x003a5, 0x003a9, 0x003cf,
+ 0x00392, 0x00398, 0x003a5, 0x003a5, 0x003a5, 0x003a6, 0x003a0, 0x003cf,
+ 0x003d8, 0x003d8, 0x003da, 0x003da, 0x003dc, 0x003dc, 0x003de, 0x003de,
+ 0x003e0, 0x003e0, 0x003e2, 0x003e2, 0x003e4, 0x003e4, 0x003e6, 0x003e6,
+ 0x003e8, 0x003e8, 0x003ea, 0x003ea, 0x003ec, 0x003ec, 0x003ee, 0x003ee,
+ 0x0039a, 0x003a1, 0x003a3, 0x003f3, 0x00398, 0x00395, 0x003f6, 0x003f7,
+ 0x003f7, 0x003a3, 0x003fa, 0x003fa, 0x003fc, 0x0037b, 0x003fe, 0x003ff
+};
+
+static uint32_t unicode_520_ci_page_04[] = {
+ 0x00400, 0x00400, 0x00402, 0x00403, 0x00404, 0x00405, 0x00406, 0x00407,
+ 0x00408, 0x00409, 0x0040a, 0x0040b, 0x0040c, 0x0040d, 0x0040e, 0x0040f,
+ 0x00410, 0x00411, 0x00412, 0x00413, 0x00414, 0x00400, 0x00416, 0x00417,
+ 0x0040d, 0x00419, 0x0041a, 0x0041b, 0x0041c, 0x0041d, 0x0041e, 0x0041f,
+ 0x00420, 0x00421, 0x00422, 0x00423, 0x00424, 0x00425, 0x00426, 0x00427,
+ 0x00428, 0x00429, 0x0042a, 0x0042b, 0x0042c, 0x0042d, 0x0042e, 0x0042f,
+ 0x00410, 0x00411, 0x00412, 0x00413, 0x00414, 0x00400, 0x00416, 0x00417,
+ 0x0040d, 0x00419, 0x0041a, 0x0041b, 0x0041c, 0x0041d, 0x0041e, 0x0041f,
+ 0x00420, 0x00421, 0x00422, 0x00423, 0x00424, 0x00425, 0x00426, 0x00427,
+ 0x00428, 0x00429, 0x0042a, 0x0042b, 0x0042c, 0x0042d, 0x0042e, 0x0042f,
+ 0x00400, 0x00400, 0x00402, 0x00403, 0x00404, 0x00405, 0x00406, 0x00407,
+ 0x00408, 0x00409, 0x0040a, 0x0040b, 0x0040c, 0x0040d, 0x0040e, 0x0040f,
+ 0x00460, 0x00460, 0x00462, 0x00462, 0x00464, 0x00464, 0x00466, 0x00466,
+ 0x00468, 0x00468, 0x0046a, 0x0046a, 0x0046c, 0x0046c, 0x0046e, 0x0046e,
+ 0x00470, 0x00470, 0x00472, 0x00472, 0x00474, 0x00474, 0x00476, 0x00476,
+ 0x00478, 0x00478, 0x0047a, 0x0047a, 0x0047c, 0x0047c, 0x0047e, 0x0047e,
+ 0x00480, 0x00480, 0x00482, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x0048a, 0x0048a, 0x0048c, 0x0048c, 0x0048e, 0x0048e,
+ 0x00413, 0x00413, 0x00492, 0x00492, 0x00494, 0x00494, 0x00496, 0x00496,
+ 0x00498, 0x00498, 0x0049a, 0x0049a, 0x0049c, 0x0049c, 0x0049e, 0x0049e,
+ 0x004a0, 0x004a0, 0x004a2, 0x004a2, 0x004a4, 0x004a4, 0x004a6, 0x004a6,
+ 0x004a8, 0x004a8, 0x004aa, 0x004aa, 0x004ac, 0x004ac, 0x004ae, 0x004ae,
+ 0x004b0, 0x004b0, 0x004b2, 0x004b2, 0x004b4, 0x004b4, 0x004b6, 0x004b6,
+ 0x004b8, 0x004b8, 0x004ba, 0x004ba, 0x004bc, 0x004bc, 0x004be, 0x004be,
+ 0x004c0, 0x00416, 0x00416, 0x004c3, 0x004c3, 0x004c5, 0x004c5, 0x004c7,
+ 0x004c7, 0x004c9, 0x004c9, 0x004cb, 0x004cb, 0x004cd, 0x004cd, 0x004c0,
+ 0x004d0, 0x004d0, 0x004d2, 0x004d2, 0x004d4, 0x004d4, 0x004d6, 0x004d6,
+ 0x004d8, 0x004d8, 0x004da, 0x004da, 0x004dc, 0x004dc, 0x004de, 0x004de,
+ 0x004e0, 0x004e0, 0x0040d, 0x0040d, 0x004e4, 0x004e4, 0x004e6, 0x004e6,
+ 0x004e8, 0x004e8, 0x004ea, 0x004ea, 0x004ec, 0x004ec, 0x00423, 0x00423,
+ 0x004f0, 0x004f0, 0x004f2, 0x004f2, 0x004f4, 0x004f4, 0x004f6, 0x004f6,
+ 0x004f8, 0x004f8, 0x004fa, 0x004fa, 0x004fc, 0x004fd, 0x004fe, 0x004ff
+};
+
+static uint32_t unicode_520_ci_page_05[] = {
+ 0x00500, 0x00500, 0x00502, 0x00502, 0x00504, 0x00504, 0x00506, 0x00506,
+ 0x00508, 0x00508, 0x0050a, 0x0050a, 0x0050c, 0x0050c, 0x0050e, 0x0050e,
+ 0x00510, 0x00510, 0x00512, 0x00512, 0x00514, 0x00514, 0x00516, 0x00516,
+ 0x00518, 0x00518, 0x0051a, 0x0051a, 0x0051c, 0x0051c, 0x0051e, 0x0051e,
+ 0x00520, 0x00520, 0x00522, 0x00522, 0x00524, 0x00524, 0x00526, 0x00527,
+ 0x00528, 0x00529, 0x0052a, 0x0052b, 0x0052c, 0x0052d, 0x0052e, 0x0052f,
+ 0x00530, 0x00531, 0x00532, 0x00533, 0x00534, 0x00535, 0x00536, 0x00537,
+ 0x00538, 0x00539, 0x0053a, 0x0053b, 0x0053c, 0x0053d, 0x0053e, 0x0053f,
+ 0x00540, 0x00541, 0x00542, 0x00543, 0x00544, 0x00545, 0x00546, 0x00547,
+ 0x00548, 0x00549, 0x0054a, 0x0054b, 0x0054c, 0x0054d, 0x0054e, 0x0054f,
+ 0x00550, 0x00551, 0x00552, 0x00553, 0x00554, 0x00555, 0x00556, 0x00557,
+ 0x00558, 0x00559, 0x0055a, 0x0055b, 0x0055c, 0x0055d, 0x0055e, 0x0055f,
+ 0x00560, 0x00531, 0x00532, 0x00533, 0x00534, 0x00535, 0x00536, 0x00537,
+ 0x00538, 0x00539, 0x0053a, 0x0053b, 0x0053c, 0x0053d, 0x0053e, 0x0053f,
+ 0x00540, 0x00541, 0x00542, 0x00543, 0x00544, 0x00545, 0x00546, 0x00547,
+ 0x00548, 0x00549, 0x0054a, 0x0054b, 0x0054c, 0x0054d, 0x0054e, 0x0054f,
+ 0x00550, 0x00551, 0x00552, 0x00553, 0x00554, 0x00555, 0x00556, 0x00587,
+ 0x00588, 0x00589, 0x0058a, 0x0058b, 0x0058c, 0x0058d, 0x0058e, 0x0058f,
+ 0x00590, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x005be, 0x00000,
+ 0x005c0, 0x00000, 0x00000, 0x005c3, 0x00000, 0x00000, 0x005c6, 0x00000,
+ 0x005c8, 0x005c9, 0x005ca, 0x005cb, 0x005cc, 0x005cd, 0x005ce, 0x005cf,
+ 0x005d0, 0x005d1, 0x005d2, 0x005d3, 0x005d4, 0x005d5, 0x005d6, 0x005d7,
+ 0x005d8, 0x005d9, 0x005da, 0x005da, 0x005dc, 0x005dd, 0x005dd, 0x005df,
+ 0x005df, 0x005e1, 0x005e2, 0x005e3, 0x005e3, 0x005e5, 0x005e5, 0x005e7,
+ 0x005e8, 0x005e9, 0x005ea, 0x005eb, 0x005ec, 0x005ed, 0x005ee, 0x005ef,
+ 0x005f0, 0x005f1, 0x005f2, 0x005f3, 0x005f4, 0x005f5, 0x005f6, 0x005f7,
+ 0x005f8, 0x005f9, 0x005fa, 0x005fb, 0x005fc, 0x005fd, 0x005fe, 0x005ff
+};
+
+static uint32_t unicode_520_ci_page_06[] = {
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00604, 0x00605, 0x00606, 0x00607,
+ 0x00608, 0x00609, 0x0060a, 0x0060b, 0x0060c, 0x0060d, 0x0060e, 0x0060f,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x0061b, 0x0061c, 0x0061d, 0x0061e, 0x0061f,
+ 0x00620, 0x00621, 0x00622, 0x00623, 0x00624, 0x00625, 0x00626, 0x00627,
+ 0x00628, 0x00629, 0x0062a, 0x0062b, 0x0062c, 0x0062d, 0x0062e, 0x0062f,
+ 0x00630, 0x00631, 0x00632, 0x00633, 0x00634, 0x00635, 0x00636, 0x00637,
+ 0x00638, 0x00639, 0x0063a, 0x0063b, 0x0063c, 0x0063d, 0x0063e, 0x0063f,
+ 0x00640, 0x00641, 0x00642, 0x00643, 0x00644, 0x00645, 0x00646, 0x00647,
+ 0x00648, 0x00649, 0x0064a, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x0065f,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x0066a, 0x0066b, 0x0066c, 0x0066d, 0x0066e, 0x0066f,
+ 0x00000, 0x00671, 0x00672, 0x00673, 0x00621, 0x00675, 0x00676, 0x00677,
+ 0x00678, 0x00679, 0x0067a, 0x0067b, 0x0067c, 0x0067d, 0x0067e, 0x0067f,
+ 0x00680, 0x00681, 0x00682, 0x00683, 0x00684, 0x00685, 0x00686, 0x00687,
+ 0x00688, 0x00689, 0x0068a, 0x0068b, 0x0068c, 0x0068d, 0x0068e, 0x0068f,
+ 0x00690, 0x00691, 0x00692, 0x00693, 0x00694, 0x00695, 0x00696, 0x00697,
+ 0x00698, 0x00699, 0x0069a, 0x0069b, 0x0069c, 0x0069d, 0x0069e, 0x0069f,
+ 0x006a0, 0x006a1, 0x006a2, 0x006a3, 0x006a4, 0x006a5, 0x006a6, 0x006a7,
+ 0x006a8, 0x006a9, 0x006aa, 0x006ab, 0x006ac, 0x006ad, 0x006ae, 0x006af,
+ 0x006b0, 0x006b1, 0x006b2, 0x006b3, 0x006b4, 0x006b5, 0x006b6, 0x006b7,
+ 0x006b8, 0x006b9, 0x006ba, 0x006bb, 0x006bc, 0x006bd, 0x006be, 0x006bf,
+ 0x006c0, 0x006c1, 0x006c1, 0x006c3, 0x006c4, 0x006c5, 0x006c6, 0x006c7,
+ 0x006c8, 0x006c9, 0x006ca, 0x006cb, 0x006cc, 0x006cd, 0x006ce, 0x006cf,
+ 0x006d0, 0x006d1, 0x006d2, 0x006d2, 0x006d4, 0x006c0, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00648, 0x0064a, 0x00000,
+ 0x00000, 0x006e9, 0x00000, 0x00000, 0x00000, 0x00000, 0x006ee, 0x006ef,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x006fa, 0x006fb, 0x006fc, 0x00621, 0x00645, 0x006ff
+};
+
+static uint32_t unicode_520_ci_page_07[] = {
+ 0x00700, 0x00701, 0x00702, 0x00703, 0x00704, 0x00705, 0x00706, 0x00707,
+ 0x00708, 0x00709, 0x0070a, 0x0070b, 0x0070c, 0x0070d, 0x0070e, 0x00000,
+ 0x00710, 0x00000, 0x00712, 0x00713, 0x00713, 0x00715, 0x00716, 0x00717,
+ 0x00718, 0x00719, 0x0071a, 0x0071b, 0x0071b, 0x0071d, 0x0071e, 0x0071f,
+ 0x00720, 0x00721, 0x00722, 0x00723, 0x00723, 0x00725, 0x00726, 0x00726,
+ 0x00728, 0x00729, 0x0072a, 0x0072b, 0x0072c, 0x00712, 0x00713, 0x00715,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x0074b, 0x0074c, 0x0074d, 0x0074e, 0x0074f,
+ 0x00750, 0x00751, 0x00752, 0x00753, 0x00754, 0x00755, 0x00756, 0x00757,
+ 0x00758, 0x00759, 0x0075a, 0x0075b, 0x0075c, 0x0075d, 0x0075e, 0x0075f,
+ 0x00760, 0x00761, 0x00762, 0x00763, 0x00764, 0x00765, 0x00766, 0x00767,
+ 0x00768, 0x00769, 0x0076a, 0x0076b, 0x0076c, 0x0076d, 0x0076e, 0x0076f,
+ 0x00770, 0x00771, 0x00772, 0x00773, 0x00774, 0x00775, 0x00776, 0x00777,
+ 0x00778, 0x00779, 0x0077a, 0x0077b, 0x0077c, 0x0077d, 0x0077e, 0x0077f,
+ 0x00780, 0x00781, 0x00782, 0x00783, 0x00784, 0x00785, 0x00786, 0x00787,
+ 0x00788, 0x00789, 0x0078a, 0x0078b, 0x0078c, 0x0078d, 0x0078e, 0x0078f,
+ 0x00790, 0x00791, 0x00792, 0x00793, 0x00794, 0x00795, 0x00796, 0x00797,
+ 0x00798, 0x00799, 0x0079a, 0x0079b, 0x0079c, 0x0079d, 0x0079e, 0x0079f,
+ 0x007a0, 0x007a1, 0x007a2, 0x007a3, 0x007a4, 0x007a5, 0x007a6, 0x007a7,
+ 0x007a8, 0x007a9, 0x007aa, 0x007ab, 0x007ac, 0x007ad, 0x007ae, 0x007af,
+ 0x007b0, 0x007b1, 0x007b2, 0x007b3, 0x007b4, 0x007b5, 0x007b6, 0x007b7,
+ 0x007b8, 0x007b9, 0x007ba, 0x007bb, 0x007bc, 0x007bd, 0x007be, 0x007bf,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x007ca, 0x007cb, 0x007cc, 0x007cd, 0x007ce, 0x007cf,
+ 0x007d0, 0x007d1, 0x007d2, 0x007d3, 0x007d4, 0x007d5, 0x007d6, 0x007d7,
+ 0x007d8, 0x007d9, 0x007da, 0x007db, 0x007dc, 0x007dd, 0x007de, 0x007df,
+ 0x007e0, 0x007e1, 0x007e2, 0x007e3, 0x007e4, 0x007e5, 0x007e6, 0x007e7,
+ 0x007d6, 0x007d7, 0x007d9, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x007f4, 0x007f5, 0x007f6, 0x007f7,
+ 0x007f8, 0x007f9, 0x007fa, 0x007fb, 0x007fc, 0x007fd, 0x007fe, 0x007ff
+};
+
+static uint32_t unicode_520_ci_page_08[] = {
+ 0x00800, 0x00801, 0x00802, 0x00803, 0x00804, 0x00805, 0x00806, 0x00807,
+ 0x00808, 0x00809, 0x0080a, 0x0080b, 0x0080c, 0x0080d, 0x0080e, 0x0080f,
+ 0x00810, 0x00811, 0x00812, 0x00813, 0x00814, 0x00815, 0x00816, 0x00817,
+ 0x00000, 0x00000, 0x0081a, 0x0081b, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x0082e, 0x0082f,
+ 0x00830, 0x00831, 0x00832, 0x00833, 0x00834, 0x00835, 0x00836, 0x00837,
+ 0x00838, 0x00839, 0x0083a, 0x0083b, 0x0083c, 0x0083d, 0x0083e, 0x0083f,
+ 0x00840, 0x00841, 0x00842, 0x00843, 0x00844, 0x00845, 0x00846, 0x00847,
+ 0x00848, 0x00849, 0x0084a, 0x0084b, 0x0084c, 0x0084d, 0x0084e, 0x0084f,
+ 0x00850, 0x00851, 0x00852, 0x00853, 0x00854, 0x00855, 0x00856, 0x00857,
+ 0x00858, 0x00859, 0x0085a, 0x0085b, 0x0085c, 0x0085d, 0x0085e, 0x0085f,
+ 0x00860, 0x00861, 0x00862, 0x00863, 0x00864, 0x00865, 0x00866, 0x00867,
+ 0x00868, 0x00869, 0x0086a, 0x0086b, 0x0086c, 0x0086d, 0x0086e, 0x0086f,
+ 0x00870, 0x00871, 0x00872, 0x00873, 0x00874, 0x00875, 0x00876, 0x00877,
+ 0x00878, 0x00879, 0x0087a, 0x0087b, 0x0087c, 0x0087d, 0x0087e, 0x0087f,
+ 0x00880, 0x00881, 0x00882, 0x00883, 0x00884, 0x00885, 0x00886, 0x00887,
+ 0x00888, 0x00889, 0x0088a, 0x0088b, 0x0088c, 0x0088d, 0x0088e, 0x0088f,
+ 0x00890, 0x00891, 0x00892, 0x00893, 0x00894, 0x00895, 0x00896, 0x00897,
+ 0x00898, 0x00899, 0x0089a, 0x0089b, 0x0089c, 0x0089d, 0x0089e, 0x0089f,
+ 0x008a0, 0x008a1, 0x008a2, 0x008a3, 0x008a4, 0x008a5, 0x008a6, 0x008a7,
+ 0x008a8, 0x008a9, 0x008aa, 0x008ab, 0x008ac, 0x008ad, 0x008ae, 0x008af,
+ 0x008b0, 0x008b1, 0x008b2, 0x008b3, 0x008b4, 0x008b5, 0x008b6, 0x008b7,
+ 0x008b8, 0x008b9, 0x008ba, 0x008bb, 0x008bc, 0x008bd, 0x008be, 0x008bf,
+ 0x008c0, 0x008c1, 0x008c2, 0x008c3, 0x008c4, 0x008c5, 0x008c6, 0x008c7,
+ 0x008c8, 0x008c9, 0x008ca, 0x008cb, 0x008cc, 0x008cd, 0x008ce, 0x008cf,
+ 0x008d0, 0x008d1, 0x008d2, 0x008d3, 0x008d4, 0x008d5, 0x008d6, 0x008d7,
+ 0x008d8, 0x008d9, 0x008da, 0x008db, 0x008dc, 0x008dd, 0x008de, 0x008df,
+ 0x008e0, 0x008e1, 0x008e2, 0x008e3, 0x008e4, 0x008e5, 0x008e6, 0x008e7,
+ 0x008e8, 0x008e9, 0x008ea, 0x008eb, 0x008ec, 0x008ed, 0x008ee, 0x008ef,
+ 0x008f0, 0x008f1, 0x008f2, 0x008f3, 0x008f4, 0x008f5, 0x008f6, 0x008f7,
+ 0x008f8, 0x008f9, 0x008fa, 0x008fb, 0x008fc, 0x008fd, 0x008fe, 0x008ff
+};
+
+static uint32_t unicode_520_ci_page_09[] = {
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00904, 0x00905, 0x00906, 0x00907,
+ 0x00908, 0x00909, 0x0090a, 0x0090b, 0x0090c, 0x0090d, 0x0090e, 0x0090f,
+ 0x00910, 0x00911, 0x00912, 0x00913, 0x00914, 0x00915, 0x00916, 0x00917,
+ 0x00918, 0x00919, 0x0091a, 0x0091b, 0x0091c, 0x0091d, 0x0091e, 0x0091f,
+ 0x00920, 0x00921, 0x00922, 0x00923, 0x00924, 0x00925, 0x00926, 0x00927,
+ 0x00928, 0x00928, 0x0092a, 0x0092b, 0x0092c, 0x0092d, 0x0092e, 0x0092f,
+ 0x00930, 0x00930, 0x00932, 0x00933, 0x00933, 0x00935, 0x00936, 0x00937,
+ 0x00938, 0x00939, 0x0093a, 0x0093b, 0x00000, 0x0093d, 0x0093e, 0x0093f,
+ 0x00940, 0x00941, 0x00942, 0x00943, 0x00944, 0x00945, 0x00946, 0x00947,
+ 0x00948, 0x00949, 0x0094a, 0x0094b, 0x0094c, 0x0094d, 0x0094e, 0x0094f,
+ 0x00950, 0x00000, 0x00000, 0x00000, 0x00000, 0x00955, 0x00956, 0x00957,
+ 0x00915, 0x00916, 0x00917, 0x0091c, 0x00921, 0x00922, 0x0092b, 0x0092f,
+ 0x00960, 0x00961, 0x00962, 0x00963, 0x00964, 0x00965, 0x00030, 0x00031,
+ 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037, 0x00038, 0x00039,
+ 0x00970, 0x00971, 0x00972, 0x00973, 0x00974, 0x00975, 0x00976, 0x00977,
+ 0x00978, 0x00979, 0x0097a, 0x0097b, 0x0097c, 0x0097d, 0x0097e, 0x0097f,
+ 0x00980, 0x00000, 0x00000, 0x00000, 0x00984, 0x00985, 0x00986, 0x00987,
+ 0x00988, 0x00989, 0x0098a, 0x0098b, 0x0098c, 0x0098d, 0x0098e, 0x0098f,
+ 0x00990, 0x00991, 0x00992, 0x00993, 0x00994, 0x00995, 0x00996, 0x00997,
+ 0x00998, 0x00999, 0x0099a, 0x0099b, 0x0099c, 0x0099d, 0x0099e, 0x0099f,
+ 0x009a0, 0x009a1, 0x009a2, 0x009a3, 0x009a4, 0x009a5, 0x009a6, 0x009a7,
+ 0x009a8, 0x009a9, 0x009aa, 0x009ab, 0x009ac, 0x009ad, 0x009ae, 0x009af,
+ 0x009b0, 0x009b1, 0x009b2, 0x009b3, 0x009b4, 0x009b5, 0x009b6, 0x009b7,
+ 0x009b8, 0x009b9, 0x009ba, 0x009bb, 0x00000, 0x009bd, 0x009be, 0x009bf,
+ 0x009c0, 0x009c1, 0x009c2, 0x009c3, 0x009c4, 0x009c5, 0x009c6, 0x009c7,
+ 0x009c8, 0x009c9, 0x009ca, 0x009cb, 0x009cc, 0x009cd, 0x009ce, 0x009cf,
+ 0x009d0, 0x009d1, 0x009d2, 0x009d3, 0x009d4, 0x009d5, 0x009d6, 0x009d7,
+ 0x009d8, 0x009d9, 0x009da, 0x009db, 0x009a1, 0x009a2, 0x009de, 0x009af,
+ 0x009e0, 0x009e1, 0x009e2, 0x009e3, 0x009e4, 0x009e5, 0x00030, 0x00031,
+ 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037, 0x00038, 0x00039,
+ 0x009f0, 0x009f1, 0x009f2, 0x009f3, 0x009f4, 0x009f5, 0x009f6, 0x009f7,
+ 0x009f8, 0x009f9, 0x009fa, 0x009fb, 0x009fc, 0x009fd, 0x009fe, 0x009ff
+};
+
+static uint32_t unicode_520_ci_page_0a[] = {
+ 0x00a00, 0x00000, 0x00000, 0x00000, 0x00a04, 0x00a05, 0x00a06, 0x00a07,
+ 0x00a08, 0x00a09, 0x00a0a, 0x00a0b, 0x00a0c, 0x00a0d, 0x00a0e, 0x00a0f,
+ 0x00a10, 0x00a11, 0x00a12, 0x00a13, 0x00a14, 0x00a15, 0x00a16, 0x00a17,
+ 0x00a18, 0x00a19, 0x00a1a, 0x00a1b, 0x00a1c, 0x00a1d, 0x00a1e, 0x00a1f,
+ 0x00a20, 0x00a21, 0x00a22, 0x00a23, 0x00a24, 0x00a25, 0x00a26, 0x00a27,
+ 0x00a28, 0x00a29, 0x00a2a, 0x00a2b, 0x00a2c, 0x00a2d, 0x00a2e, 0x00a2f,
+ 0x00a30, 0x00a31, 0x00a32, 0x00a32, 0x00a34, 0x00a35, 0x00a36, 0x00a37,
+ 0x00a36, 0x00a39, 0x00a3a, 0x00a3b, 0x00000, 0x00a3d, 0x00a3e, 0x00a3f,
+ 0x00a40, 0x00a41, 0x00a42, 0x00a43, 0x00a44, 0x00a45, 0x00a46, 0x00a47,
+ 0x00a48, 0x00a49, 0x00a4a, 0x00a4b, 0x00a4c, 0x00a4d, 0x00a4e, 0x00a4f,
+ 0x00a50, 0x00a51, 0x00a52, 0x00a53, 0x00a54, 0x00a55, 0x00a56, 0x00a57,
+ 0x00a58, 0x00a16, 0x00a17, 0x00a1c, 0x00a5c, 0x00a5d, 0x00a2b, 0x00a5f,
+ 0x00a60, 0x00a61, 0x00a62, 0x00a63, 0x00a64, 0x00a65, 0x00030, 0x00031,
+ 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037, 0x00038, 0x00039,
+ 0x00000, 0x00000, 0x00a72, 0x00a73, 0x00a74, 0x00a75, 0x00a76, 0x00a77,
+ 0x00a78, 0x00a79, 0x00a7a, 0x00a7b, 0x00a7c, 0x00a7d, 0x00a7e, 0x00a7f,
+ 0x00a80, 0x00000, 0x00000, 0x00000, 0x00a84, 0x00a85, 0x00a86, 0x00a87,
+ 0x00a88, 0x00a89, 0x00a8a, 0x00a8b, 0x00a8c, 0x00a8d, 0x00a8e, 0x00a8f,
+ 0x00a90, 0x00a91, 0x00a92, 0x00a93, 0x00a94, 0x00a95, 0x00a96, 0x00a97,
+ 0x00a98, 0x00a99, 0x00a9a, 0x00a9b, 0x00a9c, 0x00a9d, 0x00a9e, 0x00a9f,
+ 0x00aa0, 0x00aa1, 0x00aa2, 0x00aa3, 0x00aa4, 0x00aa5, 0x00aa6, 0x00aa7,
+ 0x00aa8, 0x00aa9, 0x00aaa, 0x00aab, 0x00aac, 0x00aad, 0x00aae, 0x00aaf,
+ 0x00ab0, 0x00ab1, 0x00ab2, 0x00ab3, 0x00ab4, 0x00ab5, 0x00ab6, 0x00ab7,
+ 0x00ab8, 0x00ab9, 0x00aba, 0x00abb, 0x00000, 0x00abd, 0x00abe, 0x00abf,
+ 0x00ac0, 0x00ac1, 0x00ac2, 0x00ac3, 0x00ac4, 0x00ac5, 0x00ac6, 0x00ac7,
+ 0x00ac8, 0x00ac9, 0x00aca, 0x00acb, 0x00acc, 0x00acd, 0x00ace, 0x00acf,
+ 0x00ad0, 0x00ad1, 0x00ad2, 0x00ad3, 0x00ad4, 0x00ad5, 0x00ad6, 0x00ad7,
+ 0x00ad8, 0x00ad9, 0x00ada, 0x00adb, 0x00adc, 0x00add, 0x00ade, 0x00adf,
+ 0x00ae0, 0x00ae1, 0x00ae2, 0x00ae3, 0x00ae4, 0x00ae5, 0x00030, 0x00031,
+ 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037, 0x00038, 0x00039,
+ 0x00af0, 0x00af1, 0x00af2, 0x00af3, 0x00af4, 0x00af5, 0x00af6, 0x00af7,
+ 0x00af8, 0x00af9, 0x00afa, 0x00afb, 0x00afc, 0x00afd, 0x00afe, 0x00aff
+};
+
+static uint32_t unicode_520_ci_page_0b[] = {
+ 0x00b00, 0x00000, 0x00000, 0x00000, 0x00b04, 0x00b05, 0x00b06, 0x00b07,
+ 0x00b08, 0x00b09, 0x00b0a, 0x00b0b, 0x00b0c, 0x00b0d, 0x00b0e, 0x00b0f,
+ 0x00b10, 0x00b11, 0x00b12, 0x00b13, 0x00b14, 0x00b15, 0x00b16, 0x00b17,
+ 0x00b18, 0x00b19, 0x00b1a, 0x00b1b, 0x00b1c, 0x00b1d, 0x00b1e, 0x00b1f,
+ 0x00b20, 0x00b21, 0x00b22, 0x00b23, 0x00b24, 0x00b25, 0x00b26, 0x00b27,
+ 0x00b28, 0x00b29, 0x00b2a, 0x00b2b, 0x00b2c, 0x00b2d, 0x00b2e, 0x00b2f,
+ 0x00b30, 0x00b31, 0x00b32, 0x00b33, 0x00b34, 0x00b35, 0x00b36, 0x00b37,
+ 0x00b38, 0x00b39, 0x00b3a, 0x00b3b, 0x00000, 0x00b3d, 0x00b3e, 0x00b3f,
+ 0x00b40, 0x00b41, 0x00b42, 0x00b43, 0x00b44, 0x00b45, 0x00b46, 0x00b47,
+ 0x00b48, 0x00b49, 0x00b4a, 0x00b4b, 0x00b4c, 0x00b4d, 0x00b4e, 0x00b4f,
+ 0x00b50, 0x00b51, 0x00b52, 0x00b53, 0x00b54, 0x00b55, 0x00b56, 0x00b57,
+ 0x00b58, 0x00b59, 0x00b5a, 0x00b5b, 0x00b21, 0x00b22, 0x00b5e, 0x00b5f,
+ 0x00b60, 0x00b61, 0x00b62, 0x00b63, 0x00b64, 0x00b65, 0x00030, 0x00031,
+ 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037, 0x00038, 0x00039,
+ 0x00b70, 0x00b71, 0x00b72, 0x00b73, 0x00b74, 0x00b75, 0x00b76, 0x00b77,
+ 0x00b78, 0x00b79, 0x00b7a, 0x00b7b, 0x00b7c, 0x00b7d, 0x00b7e, 0x00b7f,
+ 0x00b80, 0x00b81, 0x00000, 0x00b83, 0x00b84, 0x00b85, 0x00b86, 0x00b87,
+ 0x00b88, 0x00b89, 0x00b8a, 0x00b8b, 0x00b8c, 0x00b8d, 0x00b8e, 0x00b8f,
+ 0x00b90, 0x00b91, 0x00b92, 0x00b93, 0x00b94, 0x00b95, 0x00b96, 0x00b97,
+ 0x00b98, 0x00b99, 0x00b9a, 0x00b9b, 0x00b9c, 0x00b9d, 0x00b9e, 0x00b9f,
+ 0x00ba0, 0x00ba1, 0x00ba2, 0x00ba3, 0x00ba4, 0x00ba5, 0x00ba6, 0x00ba7,
+ 0x00ba8, 0x00ba9, 0x00baa, 0x00bab, 0x00bac, 0x00bad, 0x00bae, 0x00baf,
+ 0x00bb0, 0x00bb1, 0x00bb2, 0x00bb3, 0x00bb4, 0x00bb5, 0x00bb6, 0x00bb7,
+ 0x00bb8, 0x00bb9, 0x00bba, 0x00bbb, 0x00bbc, 0x00bbd, 0x00bbe, 0x00bbf,
+ 0x00bc0, 0x00bc1, 0x00bc2, 0x00bc3, 0x00bc4, 0x00bc5, 0x00bc6, 0x00bc7,
+ 0x00bc8, 0x00bc9, 0x00bca, 0x00bcb, 0x00bcc, 0x00bcd, 0x00bce, 0x00bcf,
+ 0x00bd0, 0x00bd1, 0x00bd2, 0x00bd3, 0x00bd4, 0x00bd5, 0x00bd6, 0x00bd7,
+ 0x00bd8, 0x00bd9, 0x00bda, 0x00bdb, 0x00bdc, 0x00bdd, 0x00bde, 0x00bdf,
+ 0x00be0, 0x00be1, 0x00be2, 0x00be3, 0x00be4, 0x00be5, 0x00030, 0x00031,
+ 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037, 0x00038, 0x00039,
+ 0x00bf0, 0x00bf1, 0x00bf2, 0x00bf3, 0x00bf4, 0x00bf5, 0x00bf6, 0x00bf7,
+ 0x00bf8, 0x00bf9, 0x00bfa, 0x00bfb, 0x00bfc, 0x00bfd, 0x00bfe, 0x00bff
+};
+
+static uint32_t unicode_520_ci_page_0c[] = {
+ 0x00c00, 0x00000, 0x00000, 0x00000, 0x00c04, 0x00c05, 0x00c06, 0x00c07,
+ 0x00c08, 0x00c09, 0x00c0a, 0x00c0b, 0x00c0c, 0x00c0d, 0x00c0e, 0x00c0f,
+ 0x00c10, 0x00c11, 0x00c12, 0x00c13, 0x00c14, 0x00c15, 0x00c16, 0x00c17,
+ 0x00c18, 0x00c19, 0x00c1a, 0x00c1b, 0x00c1c, 0x00c1d, 0x00c1e, 0x00c1f,
+ 0x00c20, 0x00c21, 0x00c22, 0x00c23, 0x00c24, 0x00c25, 0x00c26, 0x00c27,
+ 0x00c28, 0x00c29, 0x00c2a, 0x00c2b, 0x00c2c, 0x00c2d, 0x00c2e, 0x00c2f,
+ 0x00c30, 0x00c31, 0x00c32, 0x00c33, 0x00c34, 0x00c35, 0x00c36, 0x00c37,
+ 0x00c38, 0x00c39, 0x00c3a, 0x00c3b, 0x00c3c, 0x00c3d, 0x00c3e, 0x00c3f,
+ 0x00c40, 0x00c41, 0x00c42, 0x00c43, 0x00c44, 0x00c45, 0x00c46, 0x00c47,
+ 0x00c48, 0x00c49, 0x00c4a, 0x00c4b, 0x00c4c, 0x00c4d, 0x00c4e, 0x00c4f,
+ 0x00c50, 0x00c51, 0x00c52, 0x00c53, 0x00c54, 0x00c55, 0x00c56, 0x00c57,
+ 0x00c58, 0x00c59, 0x00c5a, 0x00c5b, 0x00c5c, 0x00c5d, 0x00c5e, 0x00c5f,
+ 0x00c60, 0x00c61, 0x00c62, 0x00c63, 0x00c64, 0x00c65, 0x00030, 0x00031,
+ 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037, 0x00038, 0x00039,
+ 0x00c70, 0x00c71, 0x00c72, 0x00c73, 0x00c74, 0x00c75, 0x00c76, 0x00c77,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00031, 0x00032, 0x00033, 0x00c7f,
+ 0x00c80, 0x00c81, 0x00000, 0x00000, 0x00c84, 0x00c85, 0x00c86, 0x00c87,
+ 0x00c88, 0x00c89, 0x00c8a, 0x00c8b, 0x00c8c, 0x00c8d, 0x00c8e, 0x00c8f,
+ 0x00c90, 0x00c91, 0x00c92, 0x00c93, 0x00c94, 0x00c95, 0x00c96, 0x00c97,
+ 0x00c98, 0x00c99, 0x00c9a, 0x00c9b, 0x00c9c, 0x00c9d, 0x00c9e, 0x00c9f,
+ 0x00ca0, 0x00ca1, 0x00ca2, 0x00ca3, 0x00ca4, 0x00ca5, 0x00ca6, 0x00ca7,
+ 0x00ca8, 0x00ca9, 0x00caa, 0x00cab, 0x00cac, 0x00cad, 0x00cae, 0x00caf,
+ 0x00cb0, 0x00cb1, 0x00cb2, 0x00cb3, 0x00cb4, 0x00cb5, 0x00cb6, 0x00cb7,
+ 0x00cb8, 0x00cb9, 0x00cba, 0x00cbb, 0x00000, 0x00cbd, 0x00cbe, 0x00cbf,
+ 0x00cc0, 0x00cc1, 0x00cc2, 0x00cc3, 0x00cc4, 0x00cc5, 0x00cc6, 0x00cc7,
+ 0x00cc8, 0x00cc9, 0x00cca, 0x00ccb, 0x00ccc, 0x00ccd, 0x00cce, 0x00ccf,
+ 0x00cd0, 0x00cd1, 0x00cd2, 0x00cd3, 0x00cd4, 0x00cd5, 0x00cd6, 0x00cd7,
+ 0x00cd8, 0x00cd9, 0x00cda, 0x00cdb, 0x00cdc, 0x00cdd, 0x00cde, 0x00cdf,
+ 0x00ce0, 0x00ce1, 0x00ce2, 0x00ce3, 0x00ce4, 0x00ce5, 0x00030, 0x00031,
+ 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037, 0x00038, 0x00039,
+ 0x00cf0, 0x00cf1, 0x00cf2, 0x00cf3, 0x00cf4, 0x00cf5, 0x00cf6, 0x00cf7,
+ 0x00cf8, 0x00cf9, 0x00cfa, 0x00cfb, 0x00cfc, 0x00cfd, 0x00cfe, 0x00cff
+};
+
+static uint32_t unicode_520_ci_page_0d[] = {
+ 0x00d00, 0x00d01, 0x00000, 0x00000, 0x00d04, 0x00d05, 0x00d06, 0x00d07,
+ 0x00d08, 0x00d09, 0x00d0a, 0x00d0b, 0x00d0c, 0x00d0d, 0x00d0e, 0x00d0f,
+ 0x00d10, 0x00d11, 0x00d12, 0x00d13, 0x00d14, 0x00d15, 0x00d16, 0x00d17,
+ 0x00d18, 0x00d19, 0x00d1a, 0x00d1b, 0x00d1c, 0x00d1d, 0x00d1e, 0x00d1f,
+ 0x00d20, 0x00d21, 0x00d22, 0x00d23, 0x00d24, 0x00d25, 0x00d26, 0x00d27,
+ 0x00d28, 0x00d29, 0x00d2a, 0x00d2b, 0x00d2c, 0x00d2d, 0x00d2e, 0x00d2f,
+ 0x00d30, 0x00d31, 0x00d32, 0x00d33, 0x00d34, 0x00d35, 0x00d36, 0x00d37,
+ 0x00d38, 0x00d39, 0x00d3a, 0x00d3b, 0x00d3c, 0x00d3d, 0x00d3e, 0x00d3f,
+ 0x00d40, 0x00d41, 0x00d42, 0x00d43, 0x00d44, 0x00d45, 0x00d46, 0x00d47,
+ 0x00d48, 0x00d49, 0x00d4a, 0x00d4b, 0x00d4c, 0x00d4d, 0x00d4e, 0x00d4f,
+ 0x00d50, 0x00d51, 0x00d52, 0x00d53, 0x00d54, 0x00d55, 0x00d56, 0x00d57,
+ 0x00d58, 0x00d59, 0x00d5a, 0x00d5b, 0x00d5c, 0x00d5d, 0x00d5e, 0x00d5f,
+ 0x00d60, 0x00d61, 0x00d62, 0x00d63, 0x00d64, 0x00d65, 0x00030, 0x00031,
+ 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037, 0x00038, 0x00039,
+ 0x00d70, 0x00d71, 0x00d72, 0x00d73, 0x00d74, 0x00d75, 0x00d76, 0x00d77,
+ 0x00d78, 0x00d79, 0x00d7a, 0x00d7b, 0x00d7c, 0x00d7d, 0x00d7e, 0x00d7f,
+ 0x00d80, 0x00d81, 0x00000, 0x00000, 0x00d84, 0x00d85, 0x00d86, 0x00d87,
+ 0x00d88, 0x00d89, 0x00d8a, 0x00d8b, 0x00d8c, 0x00d8d, 0x00d8e, 0x00d8f,
+ 0x00d90, 0x00d91, 0x00d92, 0x00d93, 0x00d94, 0x00d95, 0x00d96, 0x00d97,
+ 0x00d98, 0x00d99, 0x00d9a, 0x00d9b, 0x00d9c, 0x00d9d, 0x00d9e, 0x00d9f,
+ 0x00da0, 0x00da1, 0x00da2, 0x00da3, 0x00da4, 0x00da5, 0x00da6, 0x00da7,
+ 0x00da8, 0x00da9, 0x00daa, 0x00dab, 0x00dac, 0x00dad, 0x00dae, 0x00daf,
+ 0x00db0, 0x00db1, 0x00db2, 0x00db3, 0x00db4, 0x00db5, 0x00db6, 0x00db7,
+ 0x00db8, 0x00db9, 0x00dba, 0x00dbb, 0x00dbc, 0x00dbd, 0x00dbe, 0x00dbf,
+ 0x00dc0, 0x00dc1, 0x00dc2, 0x00dc3, 0x00dc4, 0x00dc5, 0x00dc6, 0x00dc7,
+ 0x00dc8, 0x00dc9, 0x00dca, 0x00dcb, 0x00dcc, 0x00dcd, 0x00dce, 0x00dcf,
+ 0x00dd0, 0x00dd1, 0x00dd2, 0x00dd3, 0x00dd4, 0x00dd5, 0x00dd6, 0x00dd7,
+ 0x00dd8, 0x00dd9, 0x00dda, 0x00ddb, 0x00ddc, 0x00ddd, 0x00dde, 0x00ddf,
+ 0x00de0, 0x00de1, 0x00de2, 0x00de3, 0x00de4, 0x00de5, 0x00de6, 0x00de7,
+ 0x00de8, 0x00de9, 0x00dea, 0x00deb, 0x00dec, 0x00ded, 0x00dee, 0x00def,
+ 0x00df0, 0x00df1, 0x00df2, 0x00df3, 0x00df4, 0x00df5, 0x00df6, 0x00df7,
+ 0x00df8, 0x00df9, 0x00dfa, 0x00dfb, 0x00dfc, 0x00dfd, 0x00dfe, 0x00dff
+};
+
+static uint32_t unicode_520_ci_page_0e[] = {
+ 0x00e00, 0x00e01, 0x00e02, 0x00e03, 0x00e04, 0x00e05, 0x00e06, 0x00e07,
+ 0x00e08, 0x00e09, 0x00e0a, 0x00e0b, 0x00e0c, 0x00e0d, 0x00e0e, 0x00e0f,
+ 0x00e10, 0x00e11, 0x00e12, 0x00e13, 0x00e14, 0x00e15, 0x00e16, 0x00e17,
+ 0x00e18, 0x00e19, 0x00e1a, 0x00e1b, 0x00e1c, 0x00e1d, 0x00e1e, 0x00e1f,
+ 0x00e20, 0x00e21, 0x00e22, 0x00e23, 0x00e24, 0x00e25, 0x00e26, 0x00e27,
+ 0x00e28, 0x00e29, 0x00e2a, 0x00e2b, 0x00e2c, 0x00e2d, 0x00e2e, 0x00e2f,
+ 0x00e30, 0x00e31, 0x00e32, 0x00e33, 0x00e34, 0x00e35, 0x00e36, 0x00e37,
+ 0x00e38, 0x00e39, 0x00e3a, 0x00e3b, 0x00e3c, 0x00e3d, 0x00e3e, 0x00e3f,
+ 0x00e40, 0x00e41, 0x00e42, 0x00e43, 0x00e44, 0x00e45, 0x00e46, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00e4f,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x00e5a, 0x00e5b, 0x00e5c, 0x00e5d, 0x00e5e, 0x00e5f,
+ 0x00e60, 0x00e61, 0x00e62, 0x00e63, 0x00e64, 0x00e65, 0x00e66, 0x00e67,
+ 0x00e68, 0x00e69, 0x00e6a, 0x00e6b, 0x00e6c, 0x00e6d, 0x00e6e, 0x00e6f,
+ 0x00e70, 0x00e71, 0x00e72, 0x00e73, 0x00e74, 0x00e75, 0x00e76, 0x00e77,
+ 0x00e78, 0x00e79, 0x00e7a, 0x00e7b, 0x00e7c, 0x00e7d, 0x00e7e, 0x00e7f,
+ 0x00e80, 0x00e81, 0x00e82, 0x00e83, 0x00e84, 0x00e85, 0x00e86, 0x00e87,
+ 0x00e88, 0x00e89, 0x00e8a, 0x00e8b, 0x00e8c, 0x00e8d, 0x00e8e, 0x00e8f,
+ 0x00e90, 0x00e91, 0x00e92, 0x00e93, 0x00e94, 0x00e95, 0x00e96, 0x00e97,
+ 0x00e98, 0x00e99, 0x00e9a, 0x00e9b, 0x00e9c, 0x00e9d, 0x00e9e, 0x00e9f,
+ 0x00ea0, 0x00ea1, 0x00ea2, 0x00ea3, 0x00ea4, 0x00ea5, 0x00ea6, 0x00ea7,
+ 0x00ea8, 0x00ea9, 0x00eaa, 0x00eab, 0x00eac, 0x00ead, 0x00eae, 0x00eaf,
+ 0x00eb0, 0x00eb1, 0x00eb2, 0x00eb3, 0x00eb4, 0x00eb5, 0x00eb6, 0x00eb7,
+ 0x00eb8, 0x00eb9, 0x00eba, 0x00ebb, 0x00ebc, 0x00ebd, 0x00ebe, 0x00ebf,
+ 0x00ec0, 0x00ec1, 0x00ec2, 0x00ec3, 0x00ec4, 0x00ec5, 0x00ec6, 0x00ec7,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00ece, 0x00ecf,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x00eda, 0x00edb, 0x00edc, 0x00edd, 0x00ede, 0x00edf,
+ 0x00ee0, 0x00ee1, 0x00ee2, 0x00ee3, 0x00ee4, 0x00ee5, 0x00ee6, 0x00ee7,
+ 0x00ee8, 0x00ee9, 0x00eea, 0x00eeb, 0x00eec, 0x00eed, 0x00eee, 0x00eef,
+ 0x00ef0, 0x00ef1, 0x00ef2, 0x00ef3, 0x00ef4, 0x00ef5, 0x00ef6, 0x00ef7,
+ 0x00ef8, 0x00ef9, 0x00efa, 0x00efb, 0x00efc, 0x00efd, 0x00efe, 0x00eff
+};
+
+static uint32_t unicode_520_ci_page_0f[] = {
+ 0x00f00, 0x00f01, 0x00f02, 0x00f03, 0x00f04, 0x00f05, 0x00f06, 0x00f07,
+ 0x00f08, 0x00f09, 0x00f0a, 0x00f0b, 0x00f0b, 0x00f0d, 0x00f0e, 0x00f0f,
+ 0x00f10, 0x00f11, 0x00f12, 0x00f13, 0x00f14, 0x00f15, 0x00f16, 0x00f17,
+ 0x00000, 0x00000, 0x00f1a, 0x00f1b, 0x00f1c, 0x00f1d, 0x00f1e, 0x00f1f,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036,
+ 0x00037, 0x00038, 0x00039, 0x00030, 0x00f34, 0x00000, 0x00f36, 0x00000,
+ 0x00f38, 0x00000, 0x00f3a, 0x00f3b, 0x00f3c, 0x00f3d, 0x00f3e, 0x00f3f,
+ 0x00f40, 0x00f41, 0x00f42, 0x00f43, 0x00f44, 0x00f45, 0x00f46, 0x00f47,
+ 0x00f48, 0x00f49, 0x00f4a, 0x00f4b, 0x00f4c, 0x00f4d, 0x00f4e, 0x00f4f,
+ 0x00f50, 0x00f51, 0x00f52, 0x00f53, 0x00f54, 0x00f55, 0x00f56, 0x00f57,
+ 0x00f58, 0x00f59, 0x00f5a, 0x00f5b, 0x00f5c, 0x00f5d, 0x00f5e, 0x00f5f,
+ 0x00f60, 0x00f61, 0x00f62, 0x00f63, 0x00f64, 0x00f65, 0x00f66, 0x00f67,
+ 0x00f68, 0x00f69, 0x00f62, 0x00f6b, 0x00f6c, 0x00f6d, 0x00f6e, 0x00f6f,
+ 0x00f70, 0x00f71, 0x00f72, 0x00f73, 0x00f74, 0x00f75, 0x00f76, 0x00f77,
+ 0x00f78, 0x00f79, 0x00f7a, 0x00f7b, 0x00f7c, 0x00f7d, 0x00000, 0x00000,
+ 0x00f80, 0x00f81, 0x00000, 0x00000, 0x00f84, 0x00f85, 0x00000, 0x00000,
+ 0x00f88, 0x00f89, 0x00f8a, 0x00f8b, 0x00f8c, 0x00f8d, 0x00f8e, 0x00f8f,
+ 0x00f90, 0x00f91, 0x00f92, 0x00f93, 0x00f94, 0x00f95, 0x00f96, 0x00f97,
+ 0x00f98, 0x00f99, 0x00f9a, 0x00f9b, 0x00f9c, 0x00f9d, 0x00f9e, 0x00f9f,
+ 0x00fa0, 0x00fa1, 0x00fa2, 0x00fa3, 0x00fa4, 0x00fa5, 0x00fa6, 0x00fa7,
+ 0x00fa8, 0x00fa9, 0x00faa, 0x00fab, 0x00fac, 0x00fad, 0x00fae, 0x00faf,
+ 0x00fb0, 0x00fb1, 0x00fb2, 0x00fb3, 0x00fb4, 0x00fb5, 0x00fb6, 0x00fb7,
+ 0x00fb8, 0x00fb9, 0x00fad, 0x00fb1, 0x00fb2, 0x00fbd, 0x00fbe, 0x00fbf,
+ 0x00fc0, 0x00fc1, 0x00fc2, 0x00fc3, 0x00fc4, 0x00fc5, 0x00000, 0x00fc7,
+ 0x00fc8, 0x00fc9, 0x00fca, 0x00fcb, 0x00fcc, 0x00fcd, 0x00fce, 0x00fcf,
+ 0x00fd0, 0x00fd1, 0x00fd2, 0x00fd3, 0x00fd4, 0x00fd5, 0x00fd6, 0x00fd7,
+ 0x00fd8, 0x00fd9, 0x00fda, 0x00fdb, 0x00fdc, 0x00fdd, 0x00fde, 0x00fdf,
+ 0x00fe0, 0x00fe1, 0x00fe2, 0x00fe3, 0x00fe4, 0x00fe5, 0x00fe6, 0x00fe7,
+ 0x00fe8, 0x00fe9, 0x00fea, 0x00feb, 0x00fec, 0x00fed, 0x00fee, 0x00fef,
+ 0x00ff0, 0x00ff1, 0x00ff2, 0x00ff3, 0x00ff4, 0x00ff5, 0x00ff6, 0x00ff7,
+ 0x00ff8, 0x00ff9, 0x00ffa, 0x00ffb, 0x00ffc, 0x00ffd, 0x00ffe, 0x00fff
+};
+
+static uint32_t unicode_520_ci_page_10[] = {
+ 0x01000, 0x01001, 0x01002, 0x01003, 0x01004, 0x01005, 0x01006, 0x01007,
+ 0x01008, 0x01009, 0x0100a, 0x0100b, 0x0100c, 0x0100d, 0x0100e, 0x0100f,
+ 0x01010, 0x01011, 0x01012, 0x01013, 0x01014, 0x01015, 0x01016, 0x01017,
+ 0x01018, 0x01019, 0x0101a, 0x0101b, 0x0101c, 0x0101d, 0x0101e, 0x0101f,
+ 0x01020, 0x01021, 0x01022, 0x01023, 0x01024, 0x01025, 0x01026, 0x01027,
+ 0x01028, 0x01029, 0x0102a, 0x0102b, 0x0102b, 0x0102d, 0x0102e, 0x0102f,
+ 0x01030, 0x01031, 0x01032, 0x01033, 0x01034, 0x01035, 0x00000, 0x00000,
+ 0x00000, 0x01039, 0x0103a, 0x0103b, 0x0103c, 0x0103d, 0x0103e, 0x0103f,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x0104a, 0x0104b, 0x0104c, 0x0104d, 0x0104e, 0x0104f,
+ 0x01050, 0x01051, 0x01052, 0x01053, 0x01054, 0x01055, 0x01056, 0x01057,
+ 0x01058, 0x01059, 0x0105a, 0x0105b, 0x0105c, 0x0105d, 0x0105e, 0x0105f,
+ 0x01060, 0x01061, 0x01062, 0x01063, 0x01064, 0x01065, 0x01066, 0x01067,
+ 0x01068, 0x01069, 0x0106a, 0x0106b, 0x0106c, 0x0106d, 0x0106e, 0x0106f,
+ 0x01070, 0x01071, 0x01072, 0x01073, 0x01074, 0x01075, 0x01076, 0x01077,
+ 0x01078, 0x01079, 0x0107a, 0x0107b, 0x0107c, 0x0107d, 0x0107e, 0x0107f,
+ 0x01080, 0x01081, 0x01082, 0x01083, 0x01084, 0x01085, 0x01086, 0x01087,
+ 0x01088, 0x01089, 0x0108a, 0x0108b, 0x0108c, 0x00000, 0x0108e, 0x0108f,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x0109a, 0x0109b, 0x0109c, 0x0109d, 0x0109e, 0x0109f,
+ 0x010a0, 0x010a1, 0x010a2, 0x010a3, 0x010a4, 0x010a5, 0x010a6, 0x010a7,
+ 0x010a8, 0x010a9, 0x010aa, 0x010ab, 0x010ac, 0x010ad, 0x010ae, 0x010af,
+ 0x010b0, 0x010b1, 0x010b2, 0x010b3, 0x010b4, 0x010b5, 0x010b6, 0x010b7,
+ 0x010b8, 0x010b9, 0x010ba, 0x010bb, 0x010bc, 0x010bd, 0x010be, 0x010bf,
+ 0x010c0, 0x010c1, 0x010c2, 0x010c3, 0x010c4, 0x010c5, 0x010c6, 0x010c7,
+ 0x010c8, 0x010c9, 0x010ca, 0x010cb, 0x010cc, 0x010cd, 0x010ce, 0x010cf,
+ 0x010d0, 0x010d1, 0x010d2, 0x010d3, 0x010d4, 0x010d5, 0x010d6, 0x010d7,
+ 0x010d8, 0x010d9, 0x010da, 0x010db, 0x010dc, 0x010dd, 0x010de, 0x010df,
+ 0x010e0, 0x010e1, 0x010e2, 0x010e3, 0x010e4, 0x010e5, 0x010e6, 0x010e7,
+ 0x010e8, 0x010e9, 0x010ea, 0x010eb, 0x010ec, 0x010ed, 0x010ee, 0x010ef,
+ 0x010f0, 0x010f1, 0x010f2, 0x010f3, 0x010f4, 0x010f5, 0x010f6, 0x010f7,
+ 0x010f8, 0x010f9, 0x010fa, 0x010fb, 0x010dc, 0x010fd, 0x010fe, 0x010ff
+};
+
+static uint32_t unicode_520_ci_page_13[] = {
+ 0x01300, 0x01301, 0x01302, 0x01303, 0x01304, 0x01305, 0x01306, 0x01307,
+ 0x01308, 0x01309, 0x0130a, 0x0130b, 0x0130c, 0x0130d, 0x0130e, 0x0130f,
+ 0x01310, 0x01311, 0x01312, 0x01313, 0x01314, 0x01315, 0x01316, 0x01317,
+ 0x01318, 0x01319, 0x0131a, 0x0131b, 0x0131c, 0x0131d, 0x0131e, 0x0131f,
+ 0x01320, 0x01321, 0x01322, 0x01323, 0x01324, 0x01325, 0x01326, 0x01327,
+ 0x01328, 0x01329, 0x0132a, 0x0132b, 0x0132c, 0x0132d, 0x0132e, 0x0132f,
+ 0x01330, 0x01331, 0x01332, 0x01333, 0x01334, 0x01335, 0x01336, 0x01337,
+ 0x01338, 0x01339, 0x0133a, 0x0133b, 0x0133c, 0x0133d, 0x0133e, 0x0133f,
+ 0x01340, 0x01341, 0x01342, 0x01343, 0x01344, 0x01345, 0x01346, 0x01347,
+ 0x01348, 0x01349, 0x0134a, 0x0134b, 0x0134c, 0x0134d, 0x0134e, 0x0134f,
+ 0x01350, 0x01351, 0x01352, 0x01353, 0x01354, 0x01355, 0x01356, 0x01357,
+ 0x01358, 0x01359, 0x0135a, 0x0135b, 0x0135c, 0x0135d, 0x0135e, 0x00000,
+ 0x01360, 0x01361, 0x01362, 0x01363, 0x01364, 0x01365, 0x01366, 0x01367,
+ 0x01368, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x01372, 0x01373, 0x01374, 0x01375, 0x01376, 0x01377,
+ 0x01378, 0x01379, 0x0137a, 0x0137b, 0x0137c, 0x0137d, 0x0137e, 0x0137f,
+ 0x01380, 0x01381, 0x01382, 0x01383, 0x01384, 0x01385, 0x01386, 0x01387,
+ 0x01388, 0x01389, 0x0138a, 0x0138b, 0x0138c, 0x0138d, 0x0138e, 0x0138f,
+ 0x01390, 0x01391, 0x01392, 0x01393, 0x01394, 0x01395, 0x01396, 0x01397,
+ 0x01398, 0x01399, 0x0139a, 0x0139b, 0x0139c, 0x0139d, 0x0139e, 0x0139f,
+ 0x013a0, 0x013a1, 0x013a2, 0x013a3, 0x013a4, 0x013a5, 0x013a6, 0x013a7,
+ 0x013a8, 0x013a9, 0x013aa, 0x013ab, 0x013ac, 0x013ad, 0x013ae, 0x013af,
+ 0x013b0, 0x013b1, 0x013b2, 0x013b3, 0x013b4, 0x013b5, 0x013b6, 0x013b7,
+ 0x013b8, 0x013b9, 0x013ba, 0x013bb, 0x013bc, 0x013bd, 0x013be, 0x013bf,
+ 0x013c0, 0x013c1, 0x013c2, 0x013c3, 0x013c4, 0x013c5, 0x013c6, 0x013c7,
+ 0x013c8, 0x013c9, 0x013ca, 0x013cb, 0x013cc, 0x013cd, 0x013ce, 0x013cf,
+ 0x013d0, 0x013d1, 0x013d2, 0x013d3, 0x013d4, 0x013d5, 0x013d6, 0x013d7,
+ 0x013d8, 0x013d9, 0x013da, 0x013db, 0x013dc, 0x013dd, 0x013de, 0x013df,
+ 0x013e0, 0x013e1, 0x013e2, 0x013e3, 0x013e4, 0x013e5, 0x013e6, 0x013e7,
+ 0x013e8, 0x013e9, 0x013ea, 0x013eb, 0x013ec, 0x013ed, 0x013ee, 0x013ef,
+ 0x013f0, 0x013f1, 0x013f2, 0x013f3, 0x013f4, 0x013f5, 0x013f6, 0x013f7,
+ 0x013f8, 0x013f9, 0x013fa, 0x013fb, 0x013fc, 0x013fd, 0x013fe, 0x013ff
+};
+
+static uint32_t unicode_520_ci_page_16[] = {
+ 0x01600, 0x01601, 0x01602, 0x01603, 0x01604, 0x01605, 0x01606, 0x01607,
+ 0x01608, 0x01609, 0x0160a, 0x0160b, 0x0160c, 0x0160d, 0x0160e, 0x0160f,
+ 0x01610, 0x01611, 0x01612, 0x01613, 0x01614, 0x01615, 0x01616, 0x01617,
+ 0x01618, 0x01619, 0x0161a, 0x0161b, 0x0161c, 0x0161d, 0x0161e, 0x0161f,
+ 0x01620, 0x01621, 0x01622, 0x01623, 0x01624, 0x01625, 0x01626, 0x01627,
+ 0x01628, 0x01629, 0x0162a, 0x0162b, 0x0162c, 0x0162d, 0x0162e, 0x0162f,
+ 0x01630, 0x01631, 0x01632, 0x01633, 0x01634, 0x01635, 0x01636, 0x01637,
+ 0x01638, 0x01639, 0x0163a, 0x0163b, 0x0163c, 0x0163d, 0x0163e, 0x0163f,
+ 0x01640, 0x01641, 0x01642, 0x01643, 0x01644, 0x01645, 0x01646, 0x01647,
+ 0x01648, 0x01649, 0x0164a, 0x0164b, 0x0164c, 0x0164d, 0x0164e, 0x0164f,
+ 0x01650, 0x01651, 0x01652, 0x01653, 0x01654, 0x01655, 0x01656, 0x01657,
+ 0x01658, 0x01659, 0x0165a, 0x0165b, 0x0165c, 0x0165d, 0x0165e, 0x0165f,
+ 0x01660, 0x01661, 0x01662, 0x01663, 0x01664, 0x01665, 0x01666, 0x01667,
+ 0x01668, 0x01669, 0x0166a, 0x0166b, 0x0166c, 0x0166d, 0x0166e, 0x0166f,
+ 0x01670, 0x01671, 0x01672, 0x01673, 0x01674, 0x01675, 0x01676, 0x01677,
+ 0x01678, 0x01679, 0x0167a, 0x0167b, 0x0167c, 0x0167d, 0x0167e, 0x0167f,
+ 0x01680, 0x01681, 0x01682, 0x01683, 0x01684, 0x01685, 0x01686, 0x01687,
+ 0x01688, 0x01689, 0x0168a, 0x0168b, 0x0168c, 0x0168d, 0x0168e, 0x0168f,
+ 0x01690, 0x01691, 0x01692, 0x01693, 0x01694, 0x01695, 0x01696, 0x01697,
+ 0x01698, 0x01699, 0x0169a, 0x0169b, 0x0169c, 0x0169d, 0x0169e, 0x0169f,
+ 0x016a0, 0x016a0, 0x016a2, 0x016a3, 0x016a2, 0x016a2, 0x016a6, 0x016a6,
+ 0x016a8, 0x016a8, 0x016aa, 0x016ab, 0x016a8, 0x016a8, 0x016a8, 0x016af,
+ 0x016b0, 0x016b1, 0x016b2, 0x016b2, 0x016b2, 0x016b2, 0x016b2, 0x016b7,
+ 0x016b8, 0x016b9, 0x016ba, 0x016ba, 0x016ba, 0x016ba, 0x016be, 0x016be,
+ 0x016be, 0x016c1, 0x016c1, 0x016c3, 0x016c3, 0x016c5, 0x016c5, 0x016c7,
+ 0x016c8, 0x016c9, 0x016ca, 0x016ca, 0x016ca, 0x016ca, 0x016ca, 0x016cf,
+ 0x016cf, 0x016cf, 0x016d2, 0x016d2, 0x016d2, 0x016c8, 0x016d6, 0x016d7,
+ 0x016d7, 0x016d7, 0x016da, 0x016da, 0x016dc, 0x016dc, 0x016de, 0x016df,
+ 0x016e0, 0x016e1, 0x016e2, 0x016e3, 0x016e4, 0x016e5, 0x016e6, 0x016e6,
+ 0x016e6, 0x016b9, 0x016ca, 0x016eb, 0x016ec, 0x016ed, 0x016ee, 0x016ef,
+ 0x016f0, 0x016f1, 0x016f2, 0x016f3, 0x016f4, 0x016f5, 0x016f6, 0x016f7,
+ 0x016f8, 0x016f9, 0x016fa, 0x016fb, 0x016fc, 0x016fd, 0x016fe, 0x016ff
+};
+
+static uint32_t unicode_520_ci_page_17[] = {
+ 0x01700, 0x01701, 0x01702, 0x01703, 0x01704, 0x01705, 0x01706, 0x01707,
+ 0x01708, 0x01709, 0x0170a, 0x0170b, 0x0170c, 0x0170d, 0x0170e, 0x0170f,
+ 0x01710, 0x01711, 0x01712, 0x01713, 0x01714, 0x01715, 0x01716, 0x01717,
+ 0x01718, 0x01719, 0x0171a, 0x0171b, 0x0171c, 0x0171d, 0x0171e, 0x0171f,
+ 0x01720, 0x01721, 0x01722, 0x01723, 0x01724, 0x01725, 0x01726, 0x01727,
+ 0x01728, 0x01729, 0x0172a, 0x0172b, 0x0172c, 0x0172d, 0x0172e, 0x0172f,
+ 0x01730, 0x01731, 0x01732, 0x01733, 0x01734, 0x01735, 0x01736, 0x01737,
+ 0x01738, 0x01739, 0x0173a, 0x0173b, 0x0173c, 0x0173d, 0x0173e, 0x0173f,
+ 0x01740, 0x01741, 0x01742, 0x01743, 0x01744, 0x01745, 0x01746, 0x01747,
+ 0x01748, 0x01749, 0x0174a, 0x0174b, 0x0174c, 0x0174d, 0x0174e, 0x0174f,
+ 0x01750, 0x01751, 0x01752, 0x01753, 0x01754, 0x01755, 0x01756, 0x01757,
+ 0x01758, 0x01759, 0x0175a, 0x0175b, 0x0175c, 0x0175d, 0x0175e, 0x0175f,
+ 0x01760, 0x01761, 0x01762, 0x01763, 0x01764, 0x01765, 0x01766, 0x01767,
+ 0x01768, 0x01769, 0x0176a, 0x0176b, 0x0176c, 0x0176d, 0x0176e, 0x0176f,
+ 0x01770, 0x01771, 0x01772, 0x01773, 0x01774, 0x01775, 0x01776, 0x01777,
+ 0x01778, 0x01779, 0x0177a, 0x0177b, 0x0177c, 0x0177d, 0x0177e, 0x0177f,
+ 0x01780, 0x01781, 0x01782, 0x01783, 0x01784, 0x01785, 0x01786, 0x01787,
+ 0x01788, 0x01789, 0x0178a, 0x0178b, 0x0178c, 0x0178d, 0x0178e, 0x0178f,
+ 0x01790, 0x01791, 0x01792, 0x01793, 0x01794, 0x01795, 0x01796, 0x01797,
+ 0x01798, 0x01799, 0x0179a, 0x0179b, 0x0179c, 0x0179d, 0x0179e, 0x0179f,
+ 0x017a0, 0x017a1, 0x017a2, 0x017a3, 0x017a4, 0x017a5, 0x017a6, 0x017a7,
+ 0x017a8, 0x017a9, 0x017aa, 0x017ab, 0x017ac, 0x017ad, 0x017ae, 0x017af,
+ 0x017b0, 0x017b1, 0x017b2, 0x017b3, 0x017b4, 0x017b5, 0x017b6, 0x017b7,
+ 0x017b8, 0x017b9, 0x017ba, 0x017bb, 0x017bc, 0x017bd, 0x017be, 0x017bf,
+ 0x017c0, 0x017c1, 0x017c2, 0x017c3, 0x017c4, 0x017c5, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x017d2, 0x00000, 0x017d4, 0x017d5, 0x017d6, 0x017d7,
+ 0x017d8, 0x017d9, 0x017da, 0x017db, 0x017dc, 0x00000, 0x017de, 0x017df,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x017ea, 0x017eb, 0x017ec, 0x017ed, 0x017ee, 0x017ef,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x017fa, 0x017fb, 0x017fc, 0x017fd, 0x017fe, 0x017ff
+};
+
+static uint32_t unicode_520_ci_page_18[] = {
+ 0x01800, 0x01801, 0x01802, 0x01803, 0x01804, 0x01805, 0x01806, 0x01807,
+ 0x01808, 0x01809, 0x0180a, 0x00000, 0x00000, 0x00000, 0x0180e, 0x0180f,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x0181a, 0x0181b, 0x0181c, 0x0181d, 0x0181e, 0x0181f,
+ 0x01820, 0x01821, 0x01822, 0x01823, 0x01824, 0x01825, 0x01826, 0x01827,
+ 0x01828, 0x01829, 0x0182a, 0x0182b, 0x0182c, 0x0182d, 0x0182e, 0x0182f,
+ 0x01830, 0x01831, 0x01832, 0x01833, 0x01834, 0x01835, 0x01836, 0x01837,
+ 0x01838, 0x01839, 0x0183a, 0x0183b, 0x0183c, 0x0183d, 0x0183e, 0x0183f,
+ 0x01840, 0x01841, 0x01842, 0x01843, 0x01844, 0x01845, 0x01846, 0x01847,
+ 0x01848, 0x01849, 0x0184a, 0x0184b, 0x0184c, 0x0184d, 0x0184e, 0x0184f,
+ 0x01850, 0x01851, 0x01852, 0x01853, 0x01854, 0x01855, 0x01856, 0x01857,
+ 0x01858, 0x01859, 0x0185a, 0x0185b, 0x0185c, 0x0185d, 0x0185e, 0x0185f,
+ 0x01860, 0x01861, 0x01862, 0x01863, 0x01864, 0x01865, 0x01866, 0x01867,
+ 0x01868, 0x01869, 0x0186a, 0x0186b, 0x0186c, 0x0186d, 0x0186e, 0x0186f,
+ 0x01870, 0x01871, 0x01872, 0x01873, 0x01874, 0x01875, 0x01876, 0x01877,
+ 0x01878, 0x01879, 0x0187a, 0x0187b, 0x0187c, 0x0187d, 0x0187e, 0x0187f,
+ 0x01880, 0x01881, 0x01882, 0x01883, 0x01884, 0x01885, 0x01886, 0x01887,
+ 0x01888, 0x01889, 0x0188a, 0x0188b, 0x0188c, 0x0188d, 0x0188e, 0x0188f,
+ 0x01890, 0x01891, 0x01892, 0x01893, 0x01894, 0x01895, 0x01896, 0x01897,
+ 0x01898, 0x01899, 0x0189a, 0x0189b, 0x0189c, 0x0189d, 0x0189e, 0x0189f,
+ 0x018a0, 0x018a1, 0x018a2, 0x018a3, 0x018a4, 0x018a5, 0x018a6, 0x018a7,
+ 0x018a8, 0x018a9, 0x018aa, 0x018ab, 0x018ac, 0x018ad, 0x018ae, 0x018af,
+ 0x018b0, 0x018b1, 0x018b2, 0x018b3, 0x018b4, 0x018b5, 0x018b6, 0x018b7,
+ 0x018b8, 0x018b9, 0x018ba, 0x018bb, 0x018bc, 0x018bd, 0x018be, 0x018bf,
+ 0x018c0, 0x018c1, 0x018c2, 0x018c3, 0x018c4, 0x018c5, 0x018c6, 0x018c7,
+ 0x018c8, 0x018c9, 0x018ca, 0x018cb, 0x018cc, 0x018cd, 0x018ce, 0x018cf,
+ 0x018d0, 0x018d1, 0x018d2, 0x018d3, 0x018d4, 0x018d5, 0x018d6, 0x018d7,
+ 0x018d8, 0x018d9, 0x018da, 0x018db, 0x018dc, 0x018dd, 0x018de, 0x018df,
+ 0x018e0, 0x018e1, 0x018e2, 0x018e3, 0x018e4, 0x018e5, 0x018e6, 0x018e7,
+ 0x018e8, 0x018e9, 0x018ea, 0x018eb, 0x018ec, 0x018ed, 0x018ee, 0x018ef,
+ 0x018f0, 0x018f1, 0x018f2, 0x018f3, 0x018f4, 0x018f5, 0x018f6, 0x018f7,
+ 0x018f8, 0x018f9, 0x018fa, 0x018fb, 0x018fc, 0x018fd, 0x018fe, 0x018ff
+};
+
+static uint32_t unicode_520_ci_page_19[] = {
+ 0x01900, 0x01901, 0x01902, 0x01903, 0x01904, 0x01905, 0x01906, 0x01907,
+ 0x01908, 0x01909, 0x0190a, 0x0190b, 0x0190c, 0x0190d, 0x0190e, 0x0190f,
+ 0x01910, 0x01911, 0x01912, 0x01913, 0x01914, 0x01915, 0x01916, 0x01917,
+ 0x01918, 0x01919, 0x0191a, 0x0191b, 0x0191c, 0x0191d, 0x0191e, 0x0191f,
+ 0x01920, 0x01921, 0x01922, 0x01923, 0x01924, 0x01925, 0x01926, 0x01927,
+ 0x01928, 0x01929, 0x0192a, 0x0192b, 0x0192c, 0x0192d, 0x0192e, 0x0192f,
+ 0x01930, 0x01931, 0x01932, 0x01933, 0x01934, 0x01935, 0x01936, 0x01937,
+ 0x01938, 0x00000, 0x00000, 0x00000, 0x0193c, 0x0193d, 0x0193e, 0x0193f,
+ 0x01940, 0x01941, 0x01942, 0x01943, 0x01944, 0x01945, 0x00030, 0x00031,
+ 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037, 0x00038, 0x00039,
+ 0x01950, 0x01951, 0x01952, 0x01953, 0x01954, 0x01955, 0x01956, 0x01957,
+ 0x01958, 0x01959, 0x0195a, 0x0195b, 0x0195c, 0x0195d, 0x0195e, 0x0195f,
+ 0x01960, 0x01961, 0x01962, 0x01963, 0x01964, 0x01965, 0x01966, 0x01967,
+ 0x01968, 0x01969, 0x0196a, 0x0196b, 0x0196c, 0x0196d, 0x0196e, 0x0196f,
+ 0x01970, 0x01971, 0x01972, 0x01973, 0x01974, 0x01975, 0x01976, 0x01977,
+ 0x01978, 0x01979, 0x0197a, 0x0197b, 0x0197c, 0x0197d, 0x0197e, 0x0197f,
+ 0x01980, 0x01981, 0x01982, 0x01983, 0x01984, 0x01985, 0x01986, 0x01987,
+ 0x01988, 0x01989, 0x0198a, 0x0198b, 0x0198c, 0x0198d, 0x0198e, 0x0198f,
+ 0x01990, 0x01991, 0x01992, 0x01993, 0x01994, 0x01995, 0x01996, 0x01997,
+ 0x01998, 0x01999, 0x0199a, 0x0199b, 0x0199c, 0x0199d, 0x0199e, 0x0199f,
+ 0x019a0, 0x019a1, 0x019a2, 0x019a3, 0x019a4, 0x019a5, 0x019a6, 0x019a7,
+ 0x019a8, 0x019a9, 0x019aa, 0x019ab, 0x019ac, 0x019ad, 0x019ae, 0x019af,
+ 0x019b0, 0x019b1, 0x019b2, 0x019b3, 0x019b4, 0x019b5, 0x019b6, 0x019b7,
+ 0x019b8, 0x019b9, 0x019ba, 0x019bb, 0x019bc, 0x019bd, 0x019be, 0x019bf,
+ 0x019c0, 0x019c1, 0x019c2, 0x019c3, 0x019c4, 0x019c5, 0x019c6, 0x019c7,
+ 0x019c8, 0x019c9, 0x019ca, 0x019cb, 0x019cc, 0x019cd, 0x019ce, 0x019cf,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x00031, 0x019db, 0x019dc, 0x019dd, 0x019de, 0x019df,
+ 0x019e0, 0x019e1, 0x019e2, 0x019e3, 0x019e4, 0x019e5, 0x019e6, 0x019e7,
+ 0x019e8, 0x019e9, 0x019ea, 0x019eb, 0x019ec, 0x019ed, 0x019ee, 0x019ef,
+ 0x019f0, 0x019f1, 0x019f2, 0x019f3, 0x019f4, 0x019f5, 0x019f6, 0x019f7,
+ 0x019f8, 0x019f9, 0x019fa, 0x019fb, 0x019fc, 0x019fd, 0x019fe, 0x019ff
+};
+
+static uint32_t unicode_520_ci_page_1a[] = {
+ 0x01a00, 0x01a01, 0x01a02, 0x01a03, 0x01a04, 0x01a05, 0x01a06, 0x01a07,
+ 0x01a08, 0x01a09, 0x01a0a, 0x01a0b, 0x01a0c, 0x01a0d, 0x01a0e, 0x01a0f,
+ 0x01a10, 0x01a11, 0x01a12, 0x01a13, 0x01a14, 0x01a15, 0x01a16, 0x01a17,
+ 0x01a18, 0x01a19, 0x01a1a, 0x01a1b, 0x01a1c, 0x01a1d, 0x01a1e, 0x01a1f,
+ 0x01a20, 0x01a21, 0x01a22, 0x01a23, 0x01a24, 0x01a25, 0x01a26, 0x01a27,
+ 0x01a28, 0x01a29, 0x01a2a, 0x01a2b, 0x01a2c, 0x01a2d, 0x01a2e, 0x01a2f,
+ 0x01a30, 0x01a31, 0x01a32, 0x01a33, 0x01a34, 0x01a35, 0x01a36, 0x01a37,
+ 0x01a38, 0x01a39, 0x01a3a, 0x01a3b, 0x01a3c, 0x01a3d, 0x01a3e, 0x01a3f,
+ 0x01a40, 0x01a41, 0x01a42, 0x01a43, 0x01a44, 0x01a45, 0x01a46, 0x01a47,
+ 0x01a48, 0x01a49, 0x01a4a, 0x01a4b, 0x01a4c, 0x01a4d, 0x01a4e, 0x01a4f,
+ 0x01a50, 0x01a51, 0x01a52, 0x01a53, 0x01a54, 0x01a55, 0x01a56, 0x01a57,
+ 0x01a26, 0x01a26, 0x01a3b, 0x01a3b, 0x01a5c, 0x01a5d, 0x01a5e, 0x01a5f,
+ 0x01a60, 0x01a61, 0x01a62, 0x01a63, 0x01a63, 0x01a65, 0x01a66, 0x01a67,
+ 0x01a68, 0x01a69, 0x01a6a, 0x01a6b, 0x01a6c, 0x01a6d, 0x01a6e, 0x01a6f,
+ 0x01a70, 0x01a71, 0x01a72, 0x01a73, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x01a7d, 0x01a7e, 0x00000,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x01a8a, 0x01a8b, 0x01a8c, 0x01a8d, 0x01a8e, 0x01a8f,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x01a9a, 0x01a9b, 0x01a9c, 0x01a9d, 0x01a9e, 0x01a9f,
+ 0x01aa0, 0x01aa1, 0x01aa2, 0x01aa3, 0x01aa4, 0x01aa5, 0x01aa6, 0x01aa7,
+ 0x01aa8, 0x01aa9, 0x01aaa, 0x01aab, 0x01aac, 0x01aad, 0x01aae, 0x01aaf,
+ 0x01ab0, 0x01ab1, 0x01ab2, 0x01ab3, 0x01ab4, 0x01ab5, 0x01ab6, 0x01ab7,
+ 0x01ab8, 0x01ab9, 0x01aba, 0x01abb, 0x01abc, 0x01abd, 0x01abe, 0x01abf,
+ 0x01ac0, 0x01ac1, 0x01ac2, 0x01ac3, 0x01ac4, 0x01ac5, 0x01ac6, 0x01ac7,
+ 0x01ac8, 0x01ac9, 0x01aca, 0x01acb, 0x01acc, 0x01acd, 0x01ace, 0x01acf,
+ 0x01ad0, 0x01ad1, 0x01ad2, 0x01ad3, 0x01ad4, 0x01ad5, 0x01ad6, 0x01ad7,
+ 0x01ad8, 0x01ad9, 0x01ada, 0x01adb, 0x01adc, 0x01add, 0x01ade, 0x01adf,
+ 0x01ae0, 0x01ae1, 0x01ae2, 0x01ae3, 0x01ae4, 0x01ae5, 0x01ae6, 0x01ae7,
+ 0x01ae8, 0x01ae9, 0x01aea, 0x01aeb, 0x01aec, 0x01aed, 0x01aee, 0x01aef,
+ 0x01af0, 0x01af1, 0x01af2, 0x01af3, 0x01af4, 0x01af5, 0x01af6, 0x01af7,
+ 0x01af8, 0x01af9, 0x01afa, 0x01afb, 0x01afc, 0x01afd, 0x01afe, 0x01aff
+};
+
+static uint32_t unicode_520_ci_page_1b[] = {
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x01b05, 0x01b06, 0x01b07,
+ 0x01b08, 0x01b09, 0x01b0a, 0x01b0b, 0x01b0c, 0x01b0d, 0x01b0e, 0x01b0f,
+ 0x01b10, 0x01b11, 0x01b12, 0x01b13, 0x01b14, 0x01b15, 0x01b16, 0x01b17,
+ 0x01b18, 0x01b19, 0x01b1a, 0x01b1b, 0x01b1c, 0x01b1d, 0x01b1e, 0x01b1f,
+ 0x01b20, 0x01b21, 0x01b22, 0x01b23, 0x01b24, 0x01b25, 0x01b26, 0x01b27,
+ 0x01b28, 0x01b29, 0x01b2a, 0x01b2b, 0x01b2c, 0x01b2d, 0x01b2e, 0x01b2f,
+ 0x01b30, 0x01b31, 0x01b32, 0x01b33, 0x00000, 0x01b35, 0x01b36, 0x01b37,
+ 0x01b38, 0x01b39, 0x01b3a, 0x01b3b, 0x01b3c, 0x01b3d, 0x01b3e, 0x01b3f,
+ 0x01b40, 0x01b41, 0x01b42, 0x01b43, 0x01b44, 0x01b45, 0x01b46, 0x01b47,
+ 0x01b48, 0x01b49, 0x01b4a, 0x01b4b, 0x01b4c, 0x01b4d, 0x01b4e, 0x01b4f,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x01b5a, 0x01b5b, 0x01b5c, 0x01b5d, 0x01b5e, 0x01b5f,
+ 0x01b60, 0x01b61, 0x01b62, 0x01b63, 0x01b64, 0x01b65, 0x01b66, 0x01b67,
+ 0x01b68, 0x01b69, 0x01b6a, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x01b74, 0x01b75, 0x01b76, 0x01b77,
+ 0x01b78, 0x01b79, 0x01b7a, 0x01b7b, 0x01b7c, 0x01b7d, 0x01b7e, 0x01b7f,
+ 0x00000, 0x00000, 0x00000, 0x01b83, 0x01b84, 0x01b85, 0x01b86, 0x01b87,
+ 0x01b88, 0x01b89, 0x01b8a, 0x01b8b, 0x01b8c, 0x01b8d, 0x01b8e, 0x01b8f,
+ 0x01b90, 0x01b91, 0x01b92, 0x01b93, 0x01b94, 0x01b95, 0x01b96, 0x01b97,
+ 0x01b98, 0x01b99, 0x01b9a, 0x01b9b, 0x01b9c, 0x01b9d, 0x01b9e, 0x01b9f,
+ 0x01ba0, 0x01ba1, 0x01ba2, 0x01ba3, 0x01ba4, 0x01ba5, 0x01ba6, 0x01ba7,
+ 0x01ba8, 0x01ba9, 0x01baa, 0x01bab, 0x01bac, 0x01bad, 0x01bae, 0x01baf,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x01bba, 0x01bbb, 0x01bbc, 0x01bbd, 0x01bbe, 0x01bbf,
+ 0x01bc0, 0x01bc1, 0x01bc2, 0x01bc3, 0x01bc4, 0x01bc5, 0x01bc6, 0x01bc7,
+ 0x01bc8, 0x01bc9, 0x01bca, 0x01bcb, 0x01bcc, 0x01bcd, 0x01bce, 0x01bcf,
+ 0x01bd0, 0x01bd1, 0x01bd2, 0x01bd3, 0x01bd4, 0x01bd5, 0x01bd6, 0x01bd7,
+ 0x01bd8, 0x01bd9, 0x01bda, 0x01bdb, 0x01bdc, 0x01bdd, 0x01bde, 0x01bdf,
+ 0x01be0, 0x01be1, 0x01be2, 0x01be3, 0x01be4, 0x01be5, 0x01be6, 0x01be7,
+ 0x01be8, 0x01be9, 0x01bea, 0x01beb, 0x01bec, 0x01bed, 0x01bee, 0x01bef,
+ 0x01bf0, 0x01bf1, 0x01bf2, 0x01bf3, 0x01bf4, 0x01bf5, 0x01bf6, 0x01bf7,
+ 0x01bf8, 0x01bf9, 0x01bfa, 0x01bfb, 0x01bfc, 0x01bfd, 0x01bfe, 0x01bff
+};
+
+static uint32_t unicode_520_ci_page_1c[] = {
+ 0x01c00, 0x01c01, 0x01c02, 0x01c03, 0x01c04, 0x01c05, 0x01c06, 0x01c07,
+ 0x01c08, 0x01c09, 0x01c0a, 0x01c0b, 0x01c0c, 0x01c0d, 0x01c0e, 0x01c0f,
+ 0x01c10, 0x01c11, 0x01c12, 0x01c13, 0x01c14, 0x01c15, 0x01c16, 0x01c17,
+ 0x01c18, 0x01c19, 0x01c1a, 0x01c1b, 0x01c1c, 0x01c1d, 0x01c1e, 0x01c1f,
+ 0x01c20, 0x01c21, 0x01c22, 0x01c23, 0x01c24, 0x01c25, 0x01c26, 0x01c27,
+ 0x01c28, 0x01c29, 0x01c2a, 0x01c2b, 0x01c2c, 0x01c2d, 0x01c2e, 0x01c2f,
+ 0x01c30, 0x01c31, 0x01c32, 0x01c33, 0x01c34, 0x01c35, 0x01c36, 0x00000,
+ 0x01c38, 0x01c39, 0x01c3a, 0x01c3b, 0x01c3c, 0x01c3d, 0x01c3e, 0x01c3f,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x01c4a, 0x01c4b, 0x01c4c, 0x01c4d, 0x01c4e, 0x01c4f,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x01c5a, 0x01c5b, 0x01c5c, 0x01c5d, 0x01c5e, 0x01c5f,
+ 0x01c60, 0x01c61, 0x01c62, 0x01c63, 0x01c64, 0x01c65, 0x01c66, 0x01c67,
+ 0x01c68, 0x01c69, 0x01c6a, 0x01c6b, 0x01c6c, 0x01c6d, 0x01c6e, 0x01c6f,
+ 0x01c70, 0x01c71, 0x01c72, 0x01c73, 0x01c74, 0x01c75, 0x01c76, 0x01c77,
+ 0x01c78, 0x01c79, 0x01c7a, 0x01c7b, 0x01c7c, 0x01c7d, 0x01c7e, 0x01c7f,
+ 0x01c80, 0x01c81, 0x01c82, 0x01c83, 0x01c84, 0x01c85, 0x01c86, 0x01c87,
+ 0x01c88, 0x01c89, 0x01c8a, 0x01c8b, 0x01c8c, 0x01c8d, 0x01c8e, 0x01c8f,
+ 0x01c90, 0x01c91, 0x01c92, 0x01c93, 0x01c94, 0x01c95, 0x01c96, 0x01c97,
+ 0x01c98, 0x01c99, 0x01c9a, 0x01c9b, 0x01c9c, 0x01c9d, 0x01c9e, 0x01c9f,
+ 0x01ca0, 0x01ca1, 0x01ca2, 0x01ca3, 0x01ca4, 0x01ca5, 0x01ca6, 0x01ca7,
+ 0x01ca8, 0x01ca9, 0x01caa, 0x01cab, 0x01cac, 0x01cad, 0x01cae, 0x01caf,
+ 0x01cb0, 0x01cb1, 0x01cb2, 0x01cb3, 0x01cb4, 0x01cb5, 0x01cb6, 0x01cb7,
+ 0x01cb8, 0x01cb9, 0x01cba, 0x01cbb, 0x01cbc, 0x01cbd, 0x01cbe, 0x01cbf,
+ 0x01cc0, 0x01cc1, 0x01cc2, 0x01cc3, 0x01cc4, 0x01cc5, 0x01cc6, 0x01cc7,
+ 0x01cc8, 0x01cc9, 0x01cca, 0x01ccb, 0x01ccc, 0x01ccd, 0x01cce, 0x01ccf,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x01ce9, 0x01ce9, 0x01ce9, 0x01ce9, 0x00000, 0x01ce9, 0x01ce9,
+ 0x01ce9, 0x01ce9, 0x00000, 0x01cf3, 0x01cf4, 0x01cf5, 0x01cf6, 0x01cf7,
+ 0x01cf8, 0x01cf9, 0x01cfa, 0x01cfb, 0x01cfc, 0x01cfd, 0x01cfe, 0x01cff
+};
+
+static uint32_t unicode_520_ci_page_1d[] = {
+ 0x01d00, 0x01d01, 0x01d02, 0x01d03, 0x01d04, 0x01d05, 0x01d06, 0x01d07,
+ 0x01d08, 0x01d09, 0x01d0a, 0x01d0b, 0x01d0c, 0x01d0d, 0x01d0e, 0x01d0f,
+ 0x01d10, 0x01d11, 0x01d12, 0x01d13, 0x01d14, 0x01d15, 0x01d16, 0x01d17,
+ 0x01d18, 0x01d19, 0x01d1a, 0x01d1b, 0x01d1c, 0x01d1d, 0x01d1e, 0x01d1f,
+ 0x01d20, 0x01d21, 0x01d22, 0x01d23, 0x01d24, 0x01d25, 0x01d26, 0x01d27,
+ 0x01d28, 0x01d29, 0x01d2a, 0x01d2b, 0x00041, 0x000c6, 0x00042, 0x01d2f,
+ 0x00044, 0x00045, 0x0018e, 0x00047, 0x00048, 0x00049, 0x0004a, 0x0004b,
+ 0x0004c, 0x0004d, 0x0004e, 0x01d3b, 0x0004f, 0x00222, 0x00050, 0x00052,
+ 0x00054, 0x00055, 0x00057, 0x00041, 0x00250, 0x00251, 0x01d02, 0x00042,
+ 0x00044, 0x00045, 0x0018f, 0x00190, 0x01d08, 0x00047, 0x01d09, 0x0004b,
+ 0x0004d, 0x0014a, 0x0004f, 0x00186, 0x01d16, 0x01d17, 0x00050, 0x00054,
+ 0x00055, 0x01d1d, 0x0019c, 0x00056, 0x01d25, 0x00392, 0x00393, 0x00394,
+ 0x003a6, 0x003a7, 0x00049, 0x00052, 0x00055, 0x00056, 0x00392, 0x00393,
+ 0x003a1, 0x003a6, 0x003a7, 0x01d6b, 0x01d6c, 0x01d6d, 0x01d6e, 0x01d6f,
+ 0x01d70, 0x01d71, 0x01d72, 0x01d73, 0x01d74, 0x01d75, 0x01d76, 0x01d77,
+ 0x0041d, 0x00047, 0x01d7a, 0x01d7b, 0x01d7c, 0x01d7d, 0x01d7e, 0x01d7f,
+ 0x01d80, 0x01d81, 0x01d82, 0x01d83, 0x01d84, 0x01d85, 0x01d86, 0x01d87,
+ 0x01d88, 0x01d89, 0x01d8a, 0x01d8b, 0x01d8c, 0x01d8d, 0x01d8e, 0x01d8f,
+ 0x01d90, 0x01d91, 0x01d92, 0x01d93, 0x01d94, 0x01d95, 0x01d96, 0x01d97,
+ 0x01d98, 0x01d99, 0x01d9a, 0x00252, 0x00043, 0x00255, 0x00044, 0x0025c,
+ 0x00046, 0x0025f, 0x00261, 0x00265, 0x00197, 0x00196, 0x0026a, 0x01d7b,
+ 0x0029d, 0x0026d, 0x01d85, 0x0029f, 0x00271, 0x00270, 0x0019d, 0x00273,
+ 0x00274, 0x0019f, 0x00278, 0x00282, 0x001a9, 0x001ab, 0x00244, 0x001b1,
+ 0x01d1c, 0x001b2, 0x00245, 0x0005a, 0x00290, 0x00291, 0x001b7, 0x00398,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00052, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x01dd2, 0x00041, 0x000c6, 0x01dd5, 0x01dd6, 0x00043,
+ 0x00044, 0x00044, 0x00047, 0x00262, 0x0004b, 0x0004c, 0x0029f, 0x01d0d,
+ 0x0004e, 0x00274, 0x001a6, 0x01de3, 0x00053, 0x00053, 0x0005a, 0x01de7,
+ 0x01de8, 0x01de9, 0x01dea, 0x01deb, 0x01dec, 0x01ded, 0x01dee, 0x01def,
+ 0x01df0, 0x01df1, 0x01df2, 0x01df3, 0x01df4, 0x01df5, 0x01df6, 0x01df7,
+ 0x01df8, 0x01df9, 0x01dfa, 0x01dfb, 0x01dfc, 0x00000, 0x00000, 0x01dff
+};
+
+static uint32_t unicode_520_ci_page_1e[] = {
+ 0x00041, 0x00041, 0x00042, 0x00042, 0x00042, 0x00042, 0x00042, 0x00042,
+ 0x00043, 0x00043, 0x00044, 0x00044, 0x00044, 0x00044, 0x00044, 0x00044,
+ 0x00044, 0x00044, 0x00044, 0x00044, 0x00045, 0x00045, 0x00045, 0x00045,
+ 0x00045, 0x00045, 0x00045, 0x00045, 0x00045, 0x00045, 0x00046, 0x00046,
+ 0x00047, 0x00047, 0x00048, 0x00048, 0x00048, 0x00048, 0x00048, 0x00048,
+ 0x00048, 0x00048, 0x00048, 0x00048, 0x00049, 0x00049, 0x00049, 0x00049,
+ 0x0004b, 0x0004b, 0x0004b, 0x0004b, 0x0004b, 0x0004b, 0x0004c, 0x0004c,
+ 0x0004c, 0x0004c, 0x0004c, 0x0004c, 0x0004c, 0x0004c, 0x0004d, 0x0004d,
+ 0x0004d, 0x0004d, 0x0004d, 0x0004d, 0x0004e, 0x0004e, 0x0004e, 0x0004e,
+ 0x0004e, 0x0004e, 0x0004e, 0x0004e, 0x0004f, 0x0004f, 0x0004f, 0x0004f,
+ 0x0004f, 0x0004f, 0x0004f, 0x0004f, 0x00050, 0x00050, 0x00050, 0x00050,
+ 0x00052, 0x00052, 0x00052, 0x00052, 0x00052, 0x00052, 0x00052, 0x00052,
+ 0x00053, 0x00053, 0x00053, 0x00053, 0x00053, 0x00053, 0x00053, 0x00053,
+ 0x00053, 0x00053, 0x00054, 0x00054, 0x00054, 0x00054, 0x00054, 0x00054,
+ 0x00054, 0x00054, 0x00055, 0x00055, 0x00055, 0x00055, 0x00055, 0x00055,
+ 0x00055, 0x00055, 0x00055, 0x00055, 0x00056, 0x00056, 0x00056, 0x00056,
+ 0x00057, 0x00057, 0x00057, 0x00057, 0x00057, 0x00057, 0x00057, 0x00057,
+ 0x00057, 0x00057, 0x00058, 0x00058, 0x00058, 0x00058, 0x00059, 0x00059,
+ 0x0005a, 0x0005a, 0x0005a, 0x0005a, 0x0005a, 0x0005a, 0x00048, 0x00054,
+ 0x00057, 0x00059, 0x01e9a, 0x00053, 0x01e9c, 0x01e9d, 0x000df, 0x01e9f,
+ 0x00041, 0x00041, 0x00041, 0x00041, 0x00041, 0x00041, 0x00041, 0x00041,
+ 0x00041, 0x00041, 0x00041, 0x00041, 0x00041, 0x00041, 0x00041, 0x00041,
+ 0x00041, 0x00041, 0x00041, 0x00041, 0x00041, 0x00041, 0x00041, 0x00041,
+ 0x00045, 0x00045, 0x00045, 0x00045, 0x00045, 0x00045, 0x00045, 0x00045,
+ 0x00045, 0x00045, 0x00045, 0x00045, 0x00045, 0x00045, 0x00045, 0x00045,
+ 0x00049, 0x00049, 0x00049, 0x00049, 0x0004f, 0x0004f, 0x0004f, 0x0004f,
+ 0x0004f, 0x0004f, 0x0004f, 0x0004f, 0x0004f, 0x0004f, 0x0004f, 0x0004f,
+ 0x0004f, 0x0004f, 0x0004f, 0x0004f, 0x0004f, 0x0004f, 0x0004f, 0x0004f,
+ 0x0004f, 0x0004f, 0x0004f, 0x0004f, 0x00055, 0x00055, 0x00055, 0x00055,
+ 0x00055, 0x00055, 0x00055, 0x00055, 0x00055, 0x00055, 0x00055, 0x00055,
+ 0x00055, 0x00055, 0x00059, 0x00059, 0x00059, 0x00059, 0x00059, 0x00059,
+ 0x00059, 0x00059, 0x01efa, 0x01efa, 0x01efc, 0x01efc, 0x01efe, 0x01eff
+};
+
+static uint32_t unicode_520_ci_page_1f[] = {
+ 0x00391, 0x00391, 0x00391, 0x00391, 0x00391, 0x00391, 0x00391, 0x00391,
+ 0x00391, 0x00391, 0x00391, 0x00391, 0x00391, 0x00391, 0x00391, 0x00391,
+ 0x00395, 0x00395, 0x00395, 0x00395, 0x00395, 0x00395, 0x01f16, 0x01f17,
+ 0x00395, 0x00395, 0x00395, 0x00395, 0x00395, 0x00395, 0x01f1e, 0x01f1f,
+ 0x00397, 0x00397, 0x00397, 0x00397, 0x00397, 0x00397, 0x00397, 0x00397,
+ 0x00397, 0x00397, 0x00397, 0x00397, 0x00397, 0x00397, 0x00397, 0x00397,
+ 0x00399, 0x00399, 0x00399, 0x00399, 0x00399, 0x00399, 0x00399, 0x00399,
+ 0x00399, 0x00399, 0x00399, 0x00399, 0x00399, 0x00399, 0x00399, 0x00399,
+ 0x0039f, 0x0039f, 0x0039f, 0x0039f, 0x0039f, 0x0039f, 0x01f46, 0x01f47,
+ 0x0039f, 0x0039f, 0x0039f, 0x0039f, 0x0039f, 0x0039f, 0x01f4e, 0x01f4f,
+ 0x003a5, 0x003a5, 0x003a5, 0x003a5, 0x003a5, 0x003a5, 0x003a5, 0x003a5,
+ 0x01f58, 0x003a5, 0x01f5a, 0x003a5, 0x01f5c, 0x003a5, 0x01f5e, 0x003a5,
+ 0x003a9, 0x003a9, 0x003a9, 0x003a9, 0x003a9, 0x003a9, 0x003a9, 0x003a9,
+ 0x003a9, 0x003a9, 0x003a9, 0x003a9, 0x003a9, 0x003a9, 0x003a9, 0x003a9,
+ 0x00391, 0x00391, 0x00395, 0x00395, 0x00397, 0x00397, 0x00399, 0x00399,
+ 0x0039f, 0x0039f, 0x003a5, 0x003a5, 0x003a9, 0x003a9, 0x01f7e, 0x01f7f,
+ 0x00391, 0x00391, 0x00391, 0x00391, 0x00391, 0x00391, 0x00391, 0x00391,
+ 0x00391, 0x00391, 0x00391, 0x00391, 0x00391, 0x00391, 0x00391, 0x00391,
+ 0x00397, 0x00397, 0x00397, 0x00397, 0x00397, 0x00397, 0x00397, 0x00397,
+ 0x00397, 0x00397, 0x00397, 0x00397, 0x00397, 0x00397, 0x00397, 0x00397,
+ 0x003a9, 0x003a9, 0x003a9, 0x003a9, 0x003a9, 0x003a9, 0x003a9, 0x003a9,
+ 0x003a9, 0x003a9, 0x003a9, 0x003a9, 0x003a9, 0x003a9, 0x003a9, 0x003a9,
+ 0x00391, 0x00391, 0x00391, 0x00391, 0x00391, 0x01fb5, 0x00391, 0x00391,
+ 0x00391, 0x00391, 0x00391, 0x00391, 0x00391, 0x01fbd, 0x00399, 0x01fbd,
+ 0x01fc0, 0x000a8, 0x00397, 0x00397, 0x00397, 0x01fc5, 0x00397, 0x00397,
+ 0x00395, 0x00395, 0x00397, 0x00397, 0x00397, 0x01fbd, 0x01fbd, 0x01fbd,
+ 0x00399, 0x00399, 0x00399, 0x00399, 0x01fd4, 0x01fd5, 0x00399, 0x00399,
+ 0x00399, 0x00399, 0x00399, 0x00399, 0x01fdc, 0x01fdd, 0x01fdd, 0x01fdd,
+ 0x003a5, 0x003a5, 0x003a5, 0x003a5, 0x003a1, 0x003a1, 0x003a5, 0x003a5,
+ 0x003a5, 0x003a5, 0x003a5, 0x003a5, 0x003a1, 0x000a8, 0x000a8, 0x00060,
+ 0x01ff0, 0x01ff1, 0x003a9, 0x003a9, 0x003a9, 0x01ff5, 0x003a9, 0x003a9,
+ 0x0039f, 0x0039f, 0x003a9, 0x003a9, 0x003a9, 0x000b4, 0x01fdd, 0x01fff
+};
+
+static uint32_t unicode_520_ci_page_20[] = {
+ 0x00020, 0x00020, 0x00020, 0x00020, 0x00020, 0x00020, 0x00020, 0x00020,
+ 0x00020, 0x00020, 0x00020, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x02010, 0x02010, 0x02012, 0x02013, 0x02014, 0x02015, 0x02016, 0x02017,
+ 0x02018, 0x02019, 0x0201a, 0x0201b, 0x0201c, 0x0201d, 0x0201e, 0x0201f,
+ 0x02020, 0x02021, 0x02022, 0x02023, 0x0002e, 0x02025, 0x02026, 0x02027,
+ 0x02028, 0x02029, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00020,
+ 0x02030, 0x02031, 0x02032, 0x02033, 0x02034, 0x02035, 0x02036, 0x02037,
+ 0x02038, 0x02039, 0x0203a, 0x0203b, 0x0203c, 0x0203d, 0x0203e, 0x0203f,
+ 0x02040, 0x02041, 0x02042, 0x02043, 0x02044, 0x02045, 0x02046, 0x02047,
+ 0x02048, 0x02049, 0x0204a, 0x0204b, 0x0204c, 0x0204d, 0x0204e, 0x0204f,
+ 0x02050, 0x02051, 0x02052, 0x02053, 0x02054, 0x02055, 0x02056, 0x02057,
+ 0x02058, 0x02059, 0x0205a, 0x0205b, 0x0205c, 0x0205d, 0x0205e, 0x00020,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x02065, 0x02066, 0x02067,
+ 0x02068, 0x02069, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00030, 0x00049, 0x02072, 0x02073, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x0002b, 0x0207b, 0x0003d, 0x00028, 0x00029, 0x0004e,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x0002b, 0x0207b, 0x0003d, 0x00028, 0x00029, 0x0208f,
+ 0x00041, 0x00045, 0x0004f, 0x00058, 0x0018f, 0x02095, 0x02096, 0x02097,
+ 0x02098, 0x02099, 0x0209a, 0x0209b, 0x0209c, 0x0209d, 0x0209e, 0x0209f,
+ 0x020a0, 0x020a1, 0x020a2, 0x020a3, 0x020a4, 0x020a5, 0x020a6, 0x020a7,
+ 0x020a8, 0x020a9, 0x020aa, 0x020ab, 0x020ac, 0x020ad, 0x020ae, 0x020af,
+ 0x020b0, 0x020b1, 0x020b2, 0x020b3, 0x020b4, 0x020b5, 0x020b6, 0x020b7,
+ 0x020b8, 0x020b9, 0x020ba, 0x020bb, 0x020bc, 0x020bd, 0x020be, 0x020bf,
+ 0x020c0, 0x020c1, 0x020c2, 0x020c3, 0x020c4, 0x020c5, 0x020c6, 0x020c7,
+ 0x020c8, 0x020c9, 0x020ca, 0x020cb, 0x020cc, 0x020cd, 0x020ce, 0x020cf,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x020f1, 0x020f2, 0x020f3, 0x020f4, 0x020f5, 0x020f6, 0x020f7,
+ 0x020f8, 0x020f9, 0x020fa, 0x020fb, 0x020fc, 0x020fd, 0x020fe, 0x020ff
+};
+
+static uint32_t unicode_520_ci_page_21[] = {
+ 0x02100, 0x02101, 0x00043, 0x02103, 0x02104, 0x02105, 0x02106, 0x00190,
+ 0x02108, 0x02109, 0x00047, 0x00048, 0x00048, 0x00048, 0x00048, 0x00048,
+ 0x00049, 0x00049, 0x0004c, 0x0004c, 0x02114, 0x0004e, 0x02116, 0x02117,
+ 0x02118, 0x00050, 0x00051, 0x00052, 0x00052, 0x00052, 0x0211e, 0x0211f,
+ 0x02120, 0x02121, 0x02122, 0x02123, 0x0005a, 0x02125, 0x003a9, 0x02127,
+ 0x0005a, 0x02129, 0x0004b, 0x00041, 0x00042, 0x00043, 0x0212e, 0x00045,
+ 0x00045, 0x00046, 0x02132, 0x0004d, 0x0004f, 0x005d0, 0x005d1, 0x005d2,
+ 0x005d3, 0x00049, 0x0213a, 0x0213b, 0x003a0, 0x00393, 0x00393, 0x003a0,
+ 0x02140, 0x02141, 0x02142, 0x02143, 0x02144, 0x00044, 0x00044, 0x00045,
+ 0x00049, 0x0004a, 0x0214a, 0x0214b, 0x0214c, 0x0214d, 0x02132, 0x0214f,
+ 0x02150, 0x02151, 0x02152, 0x02153, 0x02154, 0x02155, 0x02156, 0x02157,
+ 0x02158, 0x02159, 0x0215a, 0x0215b, 0x0215c, 0x0215d, 0x0215e, 0x0215f,
+ 0x00049, 0x02161, 0x02162, 0x02163, 0x00056, 0x02165, 0x02166, 0x02167,
+ 0x02168, 0x00058, 0x0216a, 0x0216b, 0x0004c, 0x00043, 0x00044, 0x0004d,
+ 0x00049, 0x02161, 0x02162, 0x02163, 0x00056, 0x02165, 0x02166, 0x02167,
+ 0x02168, 0x00058, 0x0216a, 0x0216b, 0x0004c, 0x00043, 0x00044, 0x0004d,
+ 0x02180, 0x02181, 0x02182, 0x02183, 0x02183, 0x00036, 0x02186, 0x02187,
+ 0x02188, 0x02189, 0x0218a, 0x0218b, 0x0218c, 0x0218d, 0x0218e, 0x0218f,
+ 0x02190, 0x02191, 0x02192, 0x02193, 0x02194, 0x02195, 0x02196, 0x02197,
+ 0x02198, 0x02199, 0x02190, 0x02192, 0x0219c, 0x0219d, 0x0219e, 0x0219f,
+ 0x021a0, 0x021a1, 0x021a2, 0x021a3, 0x021a4, 0x021a5, 0x021a6, 0x021a7,
+ 0x021a8, 0x021a9, 0x021aa, 0x021ab, 0x021ac, 0x021ad, 0x02194, 0x021af,
+ 0x021b0, 0x021b1, 0x021b2, 0x021b3, 0x021b4, 0x021b5, 0x021b6, 0x021b7,
+ 0x021b8, 0x021b9, 0x021ba, 0x021bb, 0x021bc, 0x021bd, 0x021be, 0x021bf,
+ 0x021c0, 0x021c1, 0x021c2, 0x021c3, 0x021c4, 0x021c5, 0x021c6, 0x021c7,
+ 0x021c8, 0x021c9, 0x021ca, 0x021cb, 0x021cc, 0x021cd, 0x021ce, 0x021cf,
+ 0x021cd, 0x021d1, 0x021cf, 0x021d3, 0x021ce, 0x021d5, 0x021d6, 0x021d7,
+ 0x021d8, 0x021d9, 0x021da, 0x021db, 0x021dc, 0x021dd, 0x021de, 0x021df,
+ 0x021e0, 0x021e1, 0x021e2, 0x021e3, 0x021e4, 0x021e5, 0x021e6, 0x021e7,
+ 0x021e8, 0x021e9, 0x021ea, 0x021eb, 0x021ec, 0x021ed, 0x021ee, 0x021ef,
+ 0x021f0, 0x021f1, 0x021f2, 0x021f3, 0x021f4, 0x021f5, 0x021f6, 0x021f7,
+ 0x021f8, 0x021f9, 0x021fa, 0x021fb, 0x021fc, 0x021fd, 0x021fe, 0x021ff
+};
+
+static uint32_t unicode_520_ci_page_22[] = {
+ 0x02200, 0x02201, 0x02202, 0x02203, 0x02203, 0x02205, 0x02206, 0x02207,
+ 0x02208, 0x02208, 0x0220a, 0x0220b, 0x0220b, 0x0220d, 0x0220e, 0x0220f,
+ 0x02210, 0x02140, 0x0207b, 0x02213, 0x02214, 0x02215, 0x02216, 0x02217,
+ 0x02218, 0x02219, 0x0221a, 0x0221b, 0x0221c, 0x0221d, 0x0221e, 0x0221f,
+ 0x02220, 0x02221, 0x02222, 0x02223, 0x02223, 0x02225, 0x02225, 0x02227,
+ 0x02228, 0x02229, 0x0222a, 0x0222b, 0x0222c, 0x0222d, 0x0222e, 0x0222f,
+ 0x02230, 0x02231, 0x02232, 0x02233, 0x02234, 0x02235, 0x02236, 0x02237,
+ 0x02238, 0x02239, 0x0223a, 0x0223b, 0x0223c, 0x0223d, 0x0223e, 0x0223f,
+ 0x02240, 0x0223c, 0x02242, 0x02243, 0x02243, 0x02245, 0x02246, 0x02245,
+ 0x02248, 0x02248, 0x0224a, 0x0224b, 0x0224c, 0x0224d, 0x0224e, 0x0224f,
+ 0x02250, 0x02251, 0x02252, 0x02253, 0x02254, 0x02255, 0x02256, 0x02257,
+ 0x02258, 0x02259, 0x0225a, 0x0225b, 0x0225c, 0x0225d, 0x0225e, 0x0225f,
+ 0x0003d, 0x02261, 0x02261, 0x02263, 0x02264, 0x02265, 0x02266, 0x02267,
+ 0x02268, 0x02269, 0x0226a, 0x0226b, 0x0226c, 0x0224d, 0x0003c, 0x0003e,
+ 0x02264, 0x02265, 0x02272, 0x02273, 0x02272, 0x02273, 0x02276, 0x02277,
+ 0x02276, 0x02277, 0x0227a, 0x0227b, 0x0227c, 0x0227d, 0x0227e, 0x0227f,
+ 0x0227a, 0x0227b, 0x02282, 0x02283, 0x02282, 0x02283, 0x02286, 0x02287,
+ 0x02286, 0x02287, 0x0228a, 0x0228b, 0x0228c, 0x0228d, 0x0228e, 0x0228f,
+ 0x02290, 0x02291, 0x02292, 0x02293, 0x02294, 0x02295, 0x02296, 0x02297,
+ 0x02298, 0x02299, 0x0229a, 0x0229b, 0x0229c, 0x0229d, 0x0229e, 0x0229f,
+ 0x022a0, 0x022a1, 0x022a2, 0x022a3, 0x022a4, 0x022a5, 0x022a6, 0x022a7,
+ 0x022a8, 0x022a9, 0x022aa, 0x022ab, 0x022a2, 0x022a8, 0x022a9, 0x022ab,
+ 0x022b0, 0x022b1, 0x022b2, 0x022b3, 0x022b4, 0x022b5, 0x022b6, 0x022b7,
+ 0x022b8, 0x022b9, 0x022ba, 0x022bb, 0x022bc, 0x022bd, 0x022be, 0x022bf,
+ 0x022c0, 0x022c1, 0x022c2, 0x022c3, 0x022c4, 0x022c5, 0x022c6, 0x022c7,
+ 0x022c8, 0x022c9, 0x022ca, 0x022cb, 0x022cc, 0x022cd, 0x022ce, 0x022cf,
+ 0x022d0, 0x022d1, 0x022d2, 0x022d3, 0x022d4, 0x022d5, 0x022d6, 0x022d7,
+ 0x022d8, 0x022d9, 0x022da, 0x022db, 0x022dc, 0x022dd, 0x022de, 0x022df,
+ 0x0227c, 0x0227d, 0x02291, 0x02292, 0x022e4, 0x022e5, 0x022e6, 0x022e7,
+ 0x022e8, 0x022e9, 0x022b2, 0x022b3, 0x022b4, 0x022b5, 0x022ee, 0x022ef,
+ 0x022f0, 0x022f1, 0x022f2, 0x022f3, 0x022f4, 0x022f5, 0x022f6, 0x022f7,
+ 0x022f8, 0x022f9, 0x022fa, 0x022fb, 0x022fc, 0x022fd, 0x022fe, 0x022ff
+};
+
+static uint32_t unicode_520_ci_page_24[] = {
+ 0x02400, 0x02401, 0x02402, 0x02403, 0x02404, 0x02405, 0x02406, 0x02407,
+ 0x02408, 0x02409, 0x0240a, 0x0240b, 0x0240c, 0x0240d, 0x0240e, 0x0240f,
+ 0x02410, 0x02411, 0x02412, 0x02413, 0x02414, 0x02415, 0x02416, 0x02417,
+ 0x02418, 0x02419, 0x0241a, 0x0241b, 0x0241c, 0x0241d, 0x0241e, 0x0241f,
+ 0x02420, 0x02421, 0x02422, 0x02423, 0x02424, 0x02425, 0x02426, 0x02427,
+ 0x02428, 0x02429, 0x0242a, 0x0242b, 0x0242c, 0x0242d, 0x0242e, 0x0242f,
+ 0x02430, 0x02431, 0x02432, 0x02433, 0x02434, 0x02435, 0x02436, 0x02437,
+ 0x02438, 0x02439, 0x0243a, 0x0243b, 0x0243c, 0x0243d, 0x0243e, 0x0243f,
+ 0x02440, 0x02441, 0x02442, 0x02443, 0x02444, 0x02445, 0x02446, 0x02447,
+ 0x02448, 0x02449, 0x0244a, 0x0244b, 0x0244c, 0x0244d, 0x0244e, 0x0244f,
+ 0x02450, 0x02451, 0x02452, 0x02453, 0x02454, 0x02455, 0x02456, 0x02457,
+ 0x02458, 0x02459, 0x0245a, 0x0245b, 0x0245c, 0x0245d, 0x0245e, 0x0245f,
+ 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037, 0x00038,
+ 0x00039, 0x02469, 0x0246a, 0x0246b, 0x0246c, 0x0246d, 0x0246e, 0x0246f,
+ 0x02470, 0x02471, 0x02472, 0x02473, 0x02474, 0x02475, 0x02476, 0x02477,
+ 0x02478, 0x02479, 0x0247a, 0x0247b, 0x0247c, 0x0247d, 0x0247e, 0x0247f,
+ 0x02480, 0x02481, 0x02482, 0x02483, 0x02484, 0x02485, 0x02486, 0x02487,
+ 0x02488, 0x02489, 0x0248a, 0x0248b, 0x0248c, 0x0248d, 0x0248e, 0x0248f,
+ 0x02490, 0x02491, 0x02492, 0x02493, 0x02494, 0x02495, 0x02496, 0x02497,
+ 0x02498, 0x02499, 0x0249a, 0x0249b, 0x0249c, 0x0249d, 0x0249e, 0x0249f,
+ 0x024a0, 0x024a1, 0x024a2, 0x024a3, 0x024a4, 0x024a5, 0x024a6, 0x024a7,
+ 0x024a8, 0x024a9, 0x024aa, 0x024ab, 0x024ac, 0x024ad, 0x024ae, 0x024af,
+ 0x024b0, 0x024b1, 0x024b2, 0x024b3, 0x024b4, 0x024b5, 0x00041, 0x00042,
+ 0x00043, 0x00044, 0x00045, 0x00046, 0x00047, 0x00048, 0x00049, 0x0004a,
+ 0x0004b, 0x0004c, 0x0004d, 0x0004e, 0x0004f, 0x00050, 0x00051, 0x00052,
+ 0x00053, 0x00054, 0x00055, 0x00056, 0x00057, 0x00058, 0x00059, 0x0005a,
+ 0x00041, 0x00042, 0x00043, 0x00044, 0x00045, 0x00046, 0x00047, 0x00048,
+ 0x00049, 0x0004a, 0x0004b, 0x0004c, 0x0004d, 0x0004e, 0x0004f, 0x00050,
+ 0x00051, 0x00052, 0x00053, 0x00054, 0x00055, 0x00056, 0x00057, 0x00058,
+ 0x00059, 0x0005a, 0x00030, 0x0246a, 0x0246b, 0x0246c, 0x0246d, 0x0246e,
+ 0x0246f, 0x02470, 0x02471, 0x02472, 0x02473, 0x00031, 0x00032, 0x00033,
+ 0x00034, 0x00035, 0x00036, 0x00037, 0x00038, 0x00039, 0x02469, 0x024ff
+};
+
+static uint32_t unicode_520_ci_page_27[] = {
+ 0x02700, 0x02701, 0x02702, 0x02703, 0x02704, 0x02705, 0x02706, 0x02707,
+ 0x02708, 0x02709, 0x0270a, 0x0270b, 0x0270c, 0x0270d, 0x0270e, 0x0270f,
+ 0x02710, 0x02711, 0x02712, 0x02713, 0x02714, 0x02715, 0x02716, 0x02717,
+ 0x02718, 0x02719, 0x0271a, 0x0271b, 0x0271c, 0x0271d, 0x0271e, 0x0271f,
+ 0x02720, 0x02721, 0x02722, 0x02723, 0x02724, 0x02725, 0x02726, 0x02727,
+ 0x02728, 0x02729, 0x0272a, 0x0272b, 0x0272c, 0x0272d, 0x0272e, 0x0272f,
+ 0x02730, 0x02731, 0x02732, 0x02733, 0x02734, 0x02735, 0x02736, 0x02737,
+ 0x02738, 0x02739, 0x0273a, 0x0273b, 0x0273c, 0x0273d, 0x0273e, 0x0273f,
+ 0x02740, 0x02741, 0x02742, 0x02743, 0x02744, 0x02745, 0x02746, 0x02747,
+ 0x02748, 0x02749, 0x0274a, 0x0274b, 0x0274c, 0x0274d, 0x0274e, 0x0274f,
+ 0x02750, 0x02751, 0x02752, 0x02753, 0x02754, 0x02755, 0x02756, 0x02757,
+ 0x02758, 0x02759, 0x0275a, 0x0275b, 0x0275c, 0x0275d, 0x0275e, 0x0275f,
+ 0x02760, 0x02761, 0x02762, 0x02763, 0x02764, 0x02765, 0x02766, 0x02767,
+ 0x02768, 0x02769, 0x0276a, 0x0276b, 0x0276c, 0x0276d, 0x0276e, 0x0276f,
+ 0x02770, 0x02771, 0x02772, 0x02773, 0x02774, 0x02775, 0x00031, 0x00032,
+ 0x00033, 0x00034, 0x00035, 0x00036, 0x00037, 0x00038, 0x00039, 0x02469,
+ 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037, 0x00038,
+ 0x00039, 0x02469, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036,
+ 0x00037, 0x00038, 0x00039, 0x02469, 0x02794, 0x02795, 0x02796, 0x02797,
+ 0x02798, 0x02799, 0x0279a, 0x0279b, 0x0279c, 0x0279d, 0x0279e, 0x0279f,
+ 0x027a0, 0x027a1, 0x027a2, 0x027a3, 0x027a4, 0x027a5, 0x027a6, 0x027a7,
+ 0x027a8, 0x027a9, 0x027aa, 0x027ab, 0x027ac, 0x027ad, 0x027ae, 0x027af,
+ 0x027b0, 0x027b1, 0x027b2, 0x027b3, 0x027b4, 0x027b5, 0x027b6, 0x027b7,
+ 0x027b8, 0x027b9, 0x027ba, 0x027bb, 0x027bc, 0x027bd, 0x027be, 0x027bf,
+ 0x027c0, 0x027c1, 0x027c2, 0x027c3, 0x027c4, 0x027c5, 0x027c6, 0x027c7,
+ 0x027c8, 0x027c9, 0x027ca, 0x027cb, 0x027cc, 0x027cd, 0x027ce, 0x027cf,
+ 0x027d0, 0x027d1, 0x027d2, 0x027d3, 0x027d4, 0x027d5, 0x027d6, 0x027d7,
+ 0x027d8, 0x027d9, 0x027da, 0x027db, 0x027dc, 0x027dd, 0x027de, 0x027df,
+ 0x027e0, 0x027e1, 0x027e2, 0x027e3, 0x027e4, 0x027e5, 0x027e6, 0x027e7,
+ 0x027e8, 0x027e9, 0x027ea, 0x027eb, 0x027ec, 0x027ed, 0x027ee, 0x027ef,
+ 0x027f0, 0x027f1, 0x027f2, 0x027f3, 0x027f4, 0x027f5, 0x027f6, 0x027f7,
+ 0x027f8, 0x027f9, 0x027fa, 0x027fb, 0x027fc, 0x027fd, 0x027fe, 0x027ff
+};
+
+static uint32_t unicode_520_ci_page_2a[] = {
+ 0x02a00, 0x02a01, 0x02a02, 0x02a03, 0x02a04, 0x02a05, 0x02a06, 0x02a07,
+ 0x02a08, 0x02a09, 0x02a0a, 0x02a0b, 0x02a0c, 0x02a0d, 0x02a0e, 0x02a0f,
+ 0x02a10, 0x02a11, 0x02a12, 0x02a13, 0x02a14, 0x02a15, 0x02a16, 0x02a17,
+ 0x02a18, 0x02a19, 0x02a1a, 0x02a1b, 0x02a1c, 0x02a1d, 0x02a1e, 0x02a1f,
+ 0x02a20, 0x02a21, 0x02a22, 0x02a23, 0x02a24, 0x02a25, 0x02a26, 0x02a27,
+ 0x02a28, 0x02a29, 0x02a2a, 0x02a2b, 0x02a2c, 0x02a2d, 0x02a2e, 0x02a2f,
+ 0x02a30, 0x02a31, 0x02a32, 0x02a33, 0x02a34, 0x02a35, 0x02a36, 0x02a37,
+ 0x02a38, 0x02a39, 0x02a3a, 0x02a3b, 0x02a3c, 0x02a3d, 0x02a3e, 0x02a3f,
+ 0x02a40, 0x02a41, 0x02a42, 0x02a43, 0x02a44, 0x02a45, 0x02a46, 0x02a47,
+ 0x02a48, 0x02a49, 0x02a4a, 0x02a4b, 0x02a4c, 0x02a4d, 0x02a4e, 0x02a4f,
+ 0x02a50, 0x02a51, 0x02a52, 0x02a53, 0x02a54, 0x02a55, 0x02a56, 0x02a57,
+ 0x02a58, 0x02a59, 0x02a5a, 0x02a5b, 0x02a5c, 0x02a5d, 0x02a5e, 0x02a5f,
+ 0x02a60, 0x02a61, 0x02a62, 0x02a63, 0x02a64, 0x02a65, 0x02a66, 0x02a67,
+ 0x02a68, 0x02a69, 0x02a6a, 0x02a6b, 0x02a6c, 0x02a6d, 0x02a6e, 0x02a6f,
+ 0x02a70, 0x02a71, 0x02a72, 0x02a73, 0x02a74, 0x02a75, 0x02a76, 0x02a77,
+ 0x02a78, 0x02a79, 0x02a7a, 0x02a7b, 0x02a7c, 0x02a7d, 0x02a7e, 0x02a7f,
+ 0x02a80, 0x02a81, 0x02a82, 0x02a83, 0x02a84, 0x02a85, 0x02a86, 0x02a87,
+ 0x02a88, 0x02a89, 0x02a8a, 0x02a8b, 0x02a8c, 0x02a8d, 0x02a8e, 0x02a8f,
+ 0x02a90, 0x02a91, 0x02a92, 0x02a93, 0x02a94, 0x02a95, 0x02a96, 0x02a97,
+ 0x02a98, 0x02a99, 0x02a9a, 0x02a9b, 0x02a9c, 0x02a9d, 0x02a9e, 0x02a9f,
+ 0x02aa0, 0x02aa1, 0x02aa2, 0x02aa3, 0x02aa4, 0x02aa5, 0x02aa6, 0x02aa7,
+ 0x02aa8, 0x02aa9, 0x02aaa, 0x02aab, 0x02aac, 0x02aad, 0x02aae, 0x02aaf,
+ 0x02ab0, 0x02ab1, 0x02ab2, 0x02ab3, 0x02ab4, 0x02ab5, 0x02ab6, 0x02ab7,
+ 0x02ab8, 0x02ab9, 0x02aba, 0x02abb, 0x02abc, 0x02abd, 0x02abe, 0x02abf,
+ 0x02ac0, 0x02ac1, 0x02ac2, 0x02ac3, 0x02ac4, 0x02ac5, 0x02ac6, 0x02ac7,
+ 0x02ac8, 0x02ac9, 0x02aca, 0x02acb, 0x02acc, 0x02acd, 0x02ace, 0x02acf,
+ 0x02ad0, 0x02ad1, 0x02ad2, 0x02ad3, 0x02ad4, 0x02ad5, 0x02ad6, 0x02ad7,
+ 0x02ad8, 0x02ad9, 0x02ada, 0x02adb, 0x02adc, 0x02adc, 0x02ade, 0x02adf,
+ 0x02ae0, 0x02ae1, 0x02ae2, 0x02ae3, 0x02ae4, 0x02ae5, 0x02ae6, 0x02ae7,
+ 0x02ae8, 0x02ae9, 0x02aea, 0x02aeb, 0x02aec, 0x02aed, 0x02aee, 0x02aef,
+ 0x02af0, 0x02af1, 0x02af2, 0x02af3, 0x02af4, 0x02af5, 0x02af6, 0x02af7,
+ 0x02af8, 0x02af9, 0x02afa, 0x02afb, 0x02afc, 0x02afd, 0x02afe, 0x02aff
+};
+
+static uint32_t unicode_520_ci_page_2c[] = {
+ 0x02c00, 0x02c01, 0x02c02, 0x02c03, 0x02c04, 0x02c05, 0x02c06, 0x02c07,
+ 0x02c08, 0x02c09, 0x02c0a, 0x02c0b, 0x02c0c, 0x02c0d, 0x02c0e, 0x02c0f,
+ 0x02c10, 0x02c11, 0x02c12, 0x02c13, 0x02c14, 0x02c15, 0x02c16, 0x02c17,
+ 0x02c18, 0x02c19, 0x02c1a, 0x02c1b, 0x02c1c, 0x02c1d, 0x02c1e, 0x02c1f,
+ 0x02c20, 0x02c21, 0x02c22, 0x02c23, 0x02c24, 0x02c25, 0x02c26, 0x02c27,
+ 0x02c28, 0x02c29, 0x02c2a, 0x02c2b, 0x02c2c, 0x02c2d, 0x02c2e, 0x02c2f,
+ 0x02c00, 0x02c01, 0x02c02, 0x02c03, 0x02c04, 0x02c05, 0x02c06, 0x02c07,
+ 0x02c08, 0x02c09, 0x02c0a, 0x02c0b, 0x02c0c, 0x02c0d, 0x02c0e, 0x02c0f,
+ 0x02c10, 0x02c11, 0x02c12, 0x02c13, 0x02c14, 0x02c15, 0x02c16, 0x02c17,
+ 0x02c18, 0x02c19, 0x02c1a, 0x02c1b, 0x02c1c, 0x02c1d, 0x02c1e, 0x02c1f,
+ 0x02c20, 0x02c21, 0x02c22, 0x02c23, 0x02c24, 0x02c25, 0x02c26, 0x02c27,
+ 0x02c28, 0x02c29, 0x02c2a, 0x02c2b, 0x02c2c, 0x02c2d, 0x02c2e, 0x02c5f,
+ 0x02c60, 0x02c60, 0x0026b, 0x01d7d, 0x0027d, 0x0023a, 0x0023e, 0x02c67,
+ 0x02c67, 0x02c69, 0x02c69, 0x02c6b, 0x02c6b, 0x00251, 0x00271, 0x00250,
+ 0x00252, 0x02c71, 0x02c72, 0x02c72, 0x02c74, 0x02c75, 0x02c75, 0x02c77,
+ 0x02c78, 0x02c79, 0x02c7a, 0x02c7b, 0x0004a, 0x00056, 0x0023f, 0x00240,
+ 0x02c80, 0x02c80, 0x02c82, 0x02c82, 0x02c84, 0x02c84, 0x02c86, 0x02c86,
+ 0x02c88, 0x02c88, 0x02c8a, 0x02c8a, 0x02c8c, 0x02c8c, 0x02c8e, 0x02c8e,
+ 0x02c90, 0x02c90, 0x02c92, 0x02c92, 0x02c94, 0x02c94, 0x02c96, 0x02c96,
+ 0x02c98, 0x02c98, 0x02c9a, 0x02c9a, 0x02c9c, 0x02c9c, 0x02c9e, 0x02c9e,
+ 0x02ca0, 0x02ca0, 0x02ca2, 0x02ca2, 0x02ca4, 0x02ca4, 0x02ca6, 0x02ca6,
+ 0x02ca8, 0x02ca8, 0x02caa, 0x02caa, 0x02cac, 0x02cac, 0x02cae, 0x02cae,
+ 0x02cb0, 0x02cb0, 0x02cb2, 0x02cb2, 0x02cb4, 0x02cb4, 0x02cb6, 0x02cb6,
+ 0x02cb8, 0x02cb8, 0x02cba, 0x02cba, 0x02cbc, 0x02cbc, 0x02cbe, 0x02cbe,
+ 0x02cc0, 0x02cc0, 0x02cc2, 0x02cc2, 0x02cc4, 0x02cc4, 0x02cc6, 0x02cc6,
+ 0x02cc8, 0x02cc8, 0x02cca, 0x02cca, 0x02ccc, 0x02ccc, 0x02cce, 0x02cce,
+ 0x02cd0, 0x02cd0, 0x02cd2, 0x02cd2, 0x02cd4, 0x02cd4, 0x02cd6, 0x02cd6,
+ 0x02cd8, 0x02cd8, 0x02cda, 0x02cda, 0x02cdc, 0x02cdc, 0x02cde, 0x02cde,
+ 0x02ce0, 0x02ce0, 0x02ce2, 0x02ce2, 0x02ce4, 0x02ce5, 0x02ce6, 0x02ce7,
+ 0x02ce8, 0x02ce9, 0x02cea, 0x02ceb, 0x02ceb, 0x02ced, 0x02ced, 0x00000,
+ 0x00000, 0x00000, 0x02cf2, 0x02cf3, 0x02cf4, 0x02cf5, 0x02cf6, 0x02cf7,
+ 0x02cf8, 0x02cf9, 0x02cfa, 0x02cfb, 0x02cfc, 0x02cfd, 0x02cfe, 0x02cff
+};
+
+static uint32_t unicode_520_ci_page_2d[] = {
+ 0x010a0, 0x010a1, 0x010a2, 0x010a3, 0x010a4, 0x010a5, 0x010a6, 0x010a7,
+ 0x010a8, 0x010a9, 0x010aa, 0x010ab, 0x010ac, 0x010ad, 0x010ae, 0x010af,
+ 0x010b0, 0x010b1, 0x010b2, 0x010b3, 0x010b4, 0x010b5, 0x010b6, 0x010b7,
+ 0x010b8, 0x010b9, 0x010ba, 0x010bb, 0x010bc, 0x010bd, 0x010be, 0x010bf,
+ 0x010c0, 0x010c1, 0x010c2, 0x010c3, 0x010c4, 0x010c5, 0x02d26, 0x02d27,
+ 0x02d28, 0x02d29, 0x02d2a, 0x02d2b, 0x02d2c, 0x02d2d, 0x02d2e, 0x02d2f,
+ 0x02d30, 0x02d31, 0x02d32, 0x02d33, 0x02d34, 0x02d35, 0x02d36, 0x02d37,
+ 0x02d38, 0x02d39, 0x02d3a, 0x02d3b, 0x02d3c, 0x02d3d, 0x02d3e, 0x02d3f,
+ 0x02d40, 0x02d41, 0x02d42, 0x02d43, 0x02d44, 0x02d45, 0x02d46, 0x02d47,
+ 0x02d48, 0x02d49, 0x02d4a, 0x02d4b, 0x02d4c, 0x02d4d, 0x02d4e, 0x02d4f,
+ 0x02d50, 0x02d51, 0x02d52, 0x02d53, 0x02d54, 0x02d55, 0x02d56, 0x02d57,
+ 0x02d58, 0x02d59, 0x02d5a, 0x02d5b, 0x02d5c, 0x02d5d, 0x02d5e, 0x02d5f,
+ 0x02d60, 0x02d61, 0x02d62, 0x02d63, 0x02d64, 0x02d65, 0x02d66, 0x02d67,
+ 0x02d68, 0x02d69, 0x02d6a, 0x02d6b, 0x02d6c, 0x02d6d, 0x02d6e, 0x02d6f,
+ 0x02d70, 0x02d71, 0x02d72, 0x02d73, 0x02d74, 0x02d75, 0x02d76, 0x02d77,
+ 0x02d78, 0x02d79, 0x02d7a, 0x02d7b, 0x02d7c, 0x02d7d, 0x02d7e, 0x02d7f,
+ 0x02d80, 0x02d81, 0x02d82, 0x02d83, 0x02d84, 0x02d85, 0x02d86, 0x02d87,
+ 0x02d88, 0x02d89, 0x02d8a, 0x02d8b, 0x02d8c, 0x02d8d, 0x02d8e, 0x02d8f,
+ 0x02d90, 0x02d91, 0x02d92, 0x02d93, 0x02d94, 0x02d95, 0x02d96, 0x02d97,
+ 0x02d98, 0x02d99, 0x02d9a, 0x02d9b, 0x02d9c, 0x02d9d, 0x02d9e, 0x02d9f,
+ 0x02da0, 0x02da1, 0x02da2, 0x02da3, 0x02da4, 0x02da5, 0x02da6, 0x02da7,
+ 0x02da8, 0x02da9, 0x02daa, 0x02dab, 0x02dac, 0x02dad, 0x02dae, 0x02daf,
+ 0x02db0, 0x02db1, 0x02db2, 0x02db3, 0x02db4, 0x02db5, 0x02db6, 0x02db7,
+ 0x02db8, 0x02db9, 0x02dba, 0x02dbb, 0x02dbc, 0x02dbd, 0x02dbe, 0x02dbf,
+ 0x02dc0, 0x02dc1, 0x02dc2, 0x02dc3, 0x02dc4, 0x02dc5, 0x02dc6, 0x02dc7,
+ 0x02dc8, 0x02dc9, 0x02dca, 0x02dcb, 0x02dcc, 0x02dcd, 0x02dce, 0x02dcf,
+ 0x02dd0, 0x02dd1, 0x02dd2, 0x02dd3, 0x02dd4, 0x02dd5, 0x02dd6, 0x02dd7,
+ 0x02dd8, 0x02dd9, 0x02dda, 0x02ddb, 0x02ddc, 0x02ddd, 0x02dde, 0x02ddf,
+ 0x00411, 0x00412, 0x00413, 0x00414, 0x00416, 0x00417, 0x0041a, 0x0041b,
+ 0x0041c, 0x0041d, 0x0041e, 0x0041f, 0x00420, 0x00421, 0x00422, 0x00425,
+ 0x00426, 0x00427, 0x00428, 0x00429, 0x00472, 0x02df5, 0x00410, 0x00400,
+ 0x02df8, 0x02df9, 0x00462, 0x0042e, 0x02dfc, 0x00466, 0x0046a, 0x02dff
+};
+
+static uint32_t unicode_520_ci_page_2e[] = {
+ 0x02e00, 0x02e01, 0x02e02, 0x02e03, 0x02e04, 0x02e05, 0x02e06, 0x02e07,
+ 0x02e08, 0x02e09, 0x02e0a, 0x02e0b, 0x02e0c, 0x02e0d, 0x02e0e, 0x02e0f,
+ 0x02e10, 0x02e11, 0x02e12, 0x02e13, 0x02e14, 0x02e15, 0x02e16, 0x02e17,
+ 0x02e18, 0x02e19, 0x02e1a, 0x02e1b, 0x02e1c, 0x02e1d, 0x02e1e, 0x02e1f,
+ 0x02e20, 0x02e21, 0x02e22, 0x02e23, 0x02e24, 0x02e25, 0x02e26, 0x02e27,
+ 0x02e28, 0x02e29, 0x02e2a, 0x02e2b, 0x02e2c, 0x02e2d, 0x02e2e, 0x02e2f,
+ 0x02e30, 0x02e31, 0x02e32, 0x02e33, 0x02e34, 0x02e35, 0x02e36, 0x02e37,
+ 0x02e38, 0x02e39, 0x02e3a, 0x02e3b, 0x02e3c, 0x02e3d, 0x02e3e, 0x02e3f,
+ 0x02e40, 0x02e41, 0x02e42, 0x02e43, 0x02e44, 0x02e45, 0x02e46, 0x02e47,
+ 0x02e48, 0x02e49, 0x02e4a, 0x02e4b, 0x02e4c, 0x02e4d, 0x02e4e, 0x02e4f,
+ 0x02e50, 0x02e51, 0x02e52, 0x02e53, 0x02e54, 0x02e55, 0x02e56, 0x02e57,
+ 0x02e58, 0x02e59, 0x02e5a, 0x02e5b, 0x02e5c, 0x02e5d, 0x02e5e, 0x02e5f,
+ 0x02e60, 0x02e61, 0x02e62, 0x02e63, 0x02e64, 0x02e65, 0x02e66, 0x02e67,
+ 0x02e68, 0x02e69, 0x02e6a, 0x02e6b, 0x02e6c, 0x02e6d, 0x02e6e, 0x02e6f,
+ 0x02e70, 0x02e71, 0x02e72, 0x02e73, 0x02e74, 0x02e75, 0x02e76, 0x02e77,
+ 0x02e78, 0x02e79, 0x02e7a, 0x02e7b, 0x02e7c, 0x02e7d, 0x02e7e, 0x02e7f,
+ 0x02e80, 0x02e81, 0x02e82, 0x02e83, 0x0319a, 0x02e85, 0x02e86, 0x02f0f,
+ 0x02f11, 0x02e89, 0x02f18, 0x02e8b, 0x02f29, 0x02f29, 0x02e8e, 0x02e8f,
+ 0x02e8e, 0x02e8f, 0x02e92, 0x02e93, 0x02e94, 0x02e95, 0x02e96, 0x02f3c,
+ 0x02e98, 0x02e99, 0x02e9a, 0x02e9b, 0x02f47, 0x02f49, 0x02e9e, 0x02e9f,
+ 0x02ea0, 0x02ea1, 0x02ea2, 0x02ea3, 0x02ea4, 0x02ea4, 0x02ea6, 0x02f5c,
+ 0x02ea8, 0x02ea9, 0x02eaa, 0x02f6c, 0x02f70, 0x02ead, 0x02f75, 0x02eaf,
+ 0x02eb0, 0x02eb1, 0x02eb2, 0x02eb1, 0x02eb1, 0x02eb2, 0x02eb7, 0x02eb7,
+ 0x02eb8, 0x02eb9, 0x02eba, 0x02f80, 0x02f81, 0x02f85, 0x02ebe, 0x02ebe,
+ 0x02ebe, 0x02ec1, 0x02ec2, 0x02ec3, 0x02ec4, 0x02ec5, 0x02f93, 0x02f93,
+ 0x02ec8, 0x02ec9, 0x02f9c, 0x02ecb, 0x02ecc, 0x02ecc, 0x02ecc, 0x02fa2,
+ 0x02ed0, 0x02fa7, 0x02ed2, 0x02ed3, 0x02ed4, 0x02fa9, 0x02ed6, 0x02fac,
+ 0x02ed8, 0x02ed9, 0x02eda, 0x02edb, 0x02edc, 0x02fb7, 0x02ede, 0x02ede,
+ 0x02ee0, 0x02fb8, 0x02ee2, 0x02fbb, 0x02fc1, 0x02ee5, 0x02ee6, 0x02ee7,
+ 0x02ee8, 0x02ee9, 0x02eea, 0x02eeb, 0x02eec, 0x02eed, 0x02eee, 0x02eef,
+ 0x02ef0, 0x02ef2, 0x02ef2, 0x02ef3, 0x02ef4, 0x02ef5, 0x02ef6, 0x02ef7,
+ 0x02ef8, 0x02ef9, 0x02efa, 0x02efb, 0x02efc, 0x02efd, 0x02efe, 0x02eff
+};
+
+static uint32_t unicode_520_ci_page_2f[] = {
+ 0x03192, 0x02f01, 0x02e80, 0x02f03, 0x0319a, 0x02f05, 0x03193, 0x02f07,
+ 0x0319f, 0x02f09, 0x02f0a, 0x02f0b, 0x02e86, 0x02f0d, 0x02f0e, 0x02f0f,
+ 0x02f10, 0x02f11, 0x02f12, 0x02f13, 0x02f14, 0x02f15, 0x02f16, 0x02f17,
+ 0x02f18, 0x02e8b, 0x02e81, 0x02f1b, 0x02f1c, 0x02f1d, 0x02f1e, 0x02f1f,
+ 0x02f20, 0x02f21, 0x02f22, 0x02f23, 0x02f24, 0x02f25, 0x02f26, 0x02f27,
+ 0x02f28, 0x02f29, 0x02e8e, 0x02f2b, 0x02f2c, 0x02f2d, 0x02f2e, 0x02f2f,
+ 0x02f30, 0x02f31, 0x02f32, 0x02e93, 0x02f34, 0x02f35, 0x02f36, 0x02f37,
+ 0x02f38, 0x02e95, 0x02f3a, 0x02f3b, 0x02f3c, 0x02f3d, 0x02f3e, 0x02f3f,
+ 0x02f40, 0x02f41, 0x02f42, 0x02f43, 0x02f44, 0x02f45, 0x02f46, 0x02f47,
+ 0x02f48, 0x02f49, 0x02f4a, 0x02f4b, 0x02f4c, 0x02f4d, 0x02f4e, 0x02f4f,
+ 0x02f50, 0x02f51, 0x02f52, 0x02f53, 0x02f54, 0x02f55, 0x02f56, 0x02f57,
+ 0x02f58, 0x02f59, 0x02f5a, 0x02f5b, 0x02f5c, 0x02f5d, 0x02f5e, 0x02f5f,
+ 0x02f60, 0x02f61, 0x02f62, 0x02f63, 0x02f64, 0x02f65, 0x02eaa, 0x02f67,
+ 0x02f68, 0x02f69, 0x02f6a, 0x02f6b, 0x02f6c, 0x02f6d, 0x02f6e, 0x02f6f,
+ 0x02f70, 0x02f71, 0x02f72, 0x02f73, 0x02f74, 0x02f75, 0x02f76, 0x02f77,
+ 0x02f78, 0x02f79, 0x02eb7, 0x02f7b, 0x02f7c, 0x02f7d, 0x02f7e, 0x02f7f,
+ 0x02f80, 0x02f81, 0x02f82, 0x02f83, 0x02f84, 0x02f85, 0x02f86, 0x02f87,
+ 0x02f88, 0x02f89, 0x02f8a, 0x02f8b, 0x02f8c, 0x02f8d, 0x02f8e, 0x02f8f,
+ 0x02f90, 0x02f91, 0x02f92, 0x02f93, 0x02f94, 0x02f95, 0x02f96, 0x02f97,
+ 0x02f98, 0x02f99, 0x02f9a, 0x02f9b, 0x02f9c, 0x02f9d, 0x02f9e, 0x02f9f,
+ 0x02fa0, 0x02fa1, 0x02fa2, 0x02fa3, 0x02fa4, 0x02fa5, 0x02fa6, 0x02fa7,
+ 0x02fa8, 0x02fa9, 0x02faa, 0x02fab, 0x02fac, 0x02fad, 0x02fae, 0x02faf,
+ 0x02fb0, 0x02fb1, 0x02fb2, 0x02fb3, 0x02fb4, 0x02fb5, 0x02fb6, 0x02fb7,
+ 0x02fb8, 0x02fb9, 0x02fba, 0x02fbb, 0x02fbc, 0x02fbd, 0x02fbe, 0x02fbf,
+ 0x02fc0, 0x02fc1, 0x02fc2, 0x02fc3, 0x02ee7, 0x02fc5, 0x02fc6, 0x02fc7,
+ 0x02fc8, 0x02fc9, 0x02fca, 0x02fcb, 0x02fcc, 0x02fcd, 0x02fce, 0x02fcf,
+ 0x02fd0, 0x02eeb, 0x02eed, 0x02eef, 0x02ef2, 0x02fd5, 0x02fd6, 0x02fd7,
+ 0x02fd8, 0x02fd9, 0x02fda, 0x02fdb, 0x02fdc, 0x02fdd, 0x02fde, 0x02fdf,
+ 0x02fe0, 0x02fe1, 0x02fe2, 0x02fe3, 0x02fe4, 0x02fe5, 0x02fe6, 0x02fe7,
+ 0x02fe8, 0x02fe9, 0x02fea, 0x02feb, 0x02fec, 0x02fed, 0x02fee, 0x02fef,
+ 0x02ff0, 0x02ff1, 0x02ff2, 0x02ff3, 0x02ff4, 0x02ff5, 0x02ff6, 0x02ff7,
+ 0x02ff8, 0x02ff9, 0x02ffa, 0x02ffb, 0x02ffc, 0x02ffd, 0x02ffe, 0x02fff
+};
+
+static uint32_t unicode_520_ci_page_30[] = {
+ 0x00020, 0x03001, 0x03002, 0x03003, 0x03004, 0x03005, 0x03006, 0x00030,
+ 0x02329, 0x0232a, 0x0300a, 0x0300b, 0x0300c, 0x0300d, 0x0300e, 0x0300f,
+ 0x03010, 0x03011, 0x03012, 0x03013, 0x03014, 0x03015, 0x03016, 0x03017,
+ 0x03018, 0x03019, 0x0301a, 0x0301b, 0x0301c, 0x0301d, 0x0301e, 0x0301f,
+ 0x03020, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x03030, 0x03031, 0x03031, 0x03033, 0x03033, 0x03035, 0x03012, 0x03037,
+ 0x02f17, 0x03039, 0x0303a, 0x0303b, 0x0303c, 0x0303d, 0x0303e, 0x0303f,
+ 0x03040, 0x03042, 0x03042, 0x03044, 0x03044, 0x03046, 0x03046, 0x03048,
+ 0x03048, 0x0304a, 0x0304a, 0x0304b, 0x0304b, 0x0304d, 0x0304d, 0x0304f,
+ 0x0304f, 0x03051, 0x03051, 0x03053, 0x03053, 0x03055, 0x03055, 0x03057,
+ 0x03057, 0x03059, 0x03059, 0x0305b, 0x0305b, 0x0305d, 0x0305d, 0x0305f,
+ 0x0305f, 0x03061, 0x03061, 0x03064, 0x03064, 0x03064, 0x03066, 0x03066,
+ 0x03068, 0x03068, 0x0306a, 0x0306b, 0x0306c, 0x0306d, 0x0306e, 0x0306f,
+ 0x0306f, 0x0306f, 0x03072, 0x03072, 0x03072, 0x03075, 0x03075, 0x03075,
+ 0x03078, 0x03078, 0x03078, 0x0307b, 0x0307b, 0x0307b, 0x0307e, 0x0307f,
+ 0x03080, 0x03081, 0x03082, 0x03084, 0x03084, 0x03086, 0x03086, 0x03088,
+ 0x03088, 0x03089, 0x0308a, 0x0308b, 0x0308c, 0x0308d, 0x0308f, 0x0308f,
+ 0x03090, 0x03091, 0x03092, 0x03093, 0x03046, 0x0304b, 0x03051, 0x03097,
+ 0x03098, 0x00000, 0x00000, 0x0309b, 0x0309c, 0x0309d, 0x0309d, 0x0309f,
+ 0x030a0, 0x03042, 0x03042, 0x03044, 0x03044, 0x03046, 0x03046, 0x03048,
+ 0x03048, 0x0304a, 0x0304a, 0x0304b, 0x0304b, 0x0304d, 0x0304d, 0x0304f,
+ 0x0304f, 0x03051, 0x03051, 0x03053, 0x03053, 0x03055, 0x03055, 0x03057,
+ 0x03057, 0x03059, 0x03059, 0x0305b, 0x0305b, 0x0305d, 0x0305d, 0x0305f,
+ 0x0305f, 0x03061, 0x03061, 0x03064, 0x03064, 0x03064, 0x03066, 0x03066,
+ 0x03068, 0x03068, 0x0306a, 0x0306b, 0x0306c, 0x0306d, 0x0306e, 0x0306f,
+ 0x0306f, 0x0306f, 0x03072, 0x03072, 0x03072, 0x03075, 0x03075, 0x03075,
+ 0x03078, 0x03078, 0x03078, 0x0307b, 0x0307b, 0x0307b, 0x0307e, 0x0307f,
+ 0x03080, 0x03081, 0x03082, 0x03084, 0x03084, 0x03086, 0x03086, 0x03088,
+ 0x03088, 0x03089, 0x0308a, 0x0308b, 0x0308c, 0x0308d, 0x0308f, 0x0308f,
+ 0x03090, 0x03091, 0x03092, 0x03093, 0x03046, 0x0304b, 0x03051, 0x0308f,
+ 0x03090, 0x03091, 0x03092, 0x030fb, 0x030fc, 0x030fd, 0x030fd, 0x030ff
+};
+
+static uint32_t unicode_520_ci_page_31[] = {
+ 0x03100, 0x03101, 0x03102, 0x03103, 0x03104, 0x03105, 0x03106, 0x03107,
+ 0x03108, 0x03109, 0x0310a, 0x0310b, 0x0310c, 0x0310d, 0x0310e, 0x0310f,
+ 0x03110, 0x03111, 0x03112, 0x03113, 0x03114, 0x03115, 0x03116, 0x03117,
+ 0x03118, 0x03119, 0x0311a, 0x0311b, 0x0311c, 0x0311d, 0x0311e, 0x0311f,
+ 0x03120, 0x03121, 0x03122, 0x03123, 0x03124, 0x03125, 0x03126, 0x03127,
+ 0x03128, 0x03129, 0x0312a, 0x0312b, 0x0312c, 0x0312d, 0x0312e, 0x0312f,
+ 0x03130, 0x01100, 0x01101, 0x011aa, 0x01102, 0x011ac, 0x011ad, 0x01103,
+ 0x01104, 0x01105, 0x011b0, 0x011b1, 0x011b2, 0x011b3, 0x011b4, 0x011b5,
+ 0x0111a, 0x01106, 0x01107, 0x01108, 0x01121, 0x01109, 0x0110a, 0x0110b,
+ 0x0110c, 0x0110d, 0x0110e, 0x0110f, 0x01110, 0x01111, 0x01112, 0x01161,
+ 0x01162, 0x01163, 0x01164, 0x01165, 0x01166, 0x01167, 0x01168, 0x01169,
+ 0x0116a, 0x0116b, 0x0116c, 0x0116d, 0x0116e, 0x0116f, 0x01170, 0x01171,
+ 0x01172, 0x01173, 0x01174, 0x01175, 0x01160, 0x01114, 0x01115, 0x011c7,
+ 0x011c8, 0x011cc, 0x011ce, 0x011d3, 0x011d7, 0x011d9, 0x0111c, 0x011dd,
+ 0x011df, 0x0111d, 0x0111e, 0x01120, 0x01122, 0x01123, 0x01127, 0x01129,
+ 0x0112b, 0x0112c, 0x0112d, 0x0112e, 0x0112f, 0x01132, 0x01136, 0x01140,
+ 0x01147, 0x0114c, 0x011f1, 0x011f2, 0x01157, 0x01158, 0x01159, 0x01184,
+ 0x01185, 0x01188, 0x01191, 0x01192, 0x01194, 0x0119e, 0x011a1, 0x0318f,
+ 0x03190, 0x03191, 0x03192, 0x03193, 0x03194, 0x03195, 0x03196, 0x03197,
+ 0x03198, 0x03199, 0x0319a, 0x0319b, 0x0319c, 0x0319d, 0x0319e, 0x0319f,
+ 0x03105, 0x03117, 0x03110, 0x0310d, 0x031a4, 0x031a4, 0x031a6, 0x0311b,
+ 0x03128, 0x0311a, 0x03127, 0x03128, 0x031ac, 0x031ad, 0x0311e, 0x03120,
+ 0x031b0, 0x031b1, 0x031b2, 0x03127, 0x03106, 0x0310a, 0x0310e, 0x0310f,
+ 0x031b8, 0x031b9, 0x031ba, 0x031bb, 0x031bc, 0x031bd, 0x031be, 0x031bf,
+ 0x031c0, 0x031c1, 0x031c2, 0x031c3, 0x031c4, 0x031c5, 0x031c6, 0x031c7,
+ 0x031c8, 0x031c9, 0x031ca, 0x031cb, 0x031cc, 0x031cd, 0x031ce, 0x031cf,
+ 0x031d0, 0x031d1, 0x031d2, 0x031d3, 0x031d4, 0x031d5, 0x031d6, 0x031d7,
+ 0x031d8, 0x031d9, 0x031da, 0x031db, 0x031dc, 0x031dd, 0x031de, 0x031df,
+ 0x031e0, 0x031e1, 0x031e2, 0x031e3, 0x031e4, 0x031e5, 0x031e6, 0x031e7,
+ 0x031e8, 0x031e9, 0x031ea, 0x031eb, 0x031ec, 0x031ed, 0x031ee, 0x031ef,
+ 0x0304f, 0x03057, 0x03059, 0x03068, 0x0306c, 0x0306f, 0x03072, 0x03075,
+ 0x03078, 0x0307b, 0x03080, 0x03089, 0x0308a, 0x0308b, 0x0308c, 0x031ff
+};
+
+static uint32_t unicode_520_ci_page_32[] = {
+ 0x03200, 0x03201, 0x03202, 0x03203, 0x03204, 0x03205, 0x03206, 0x03207,
+ 0x03208, 0x03209, 0x0320a, 0x0320b, 0x0320c, 0x0320d, 0x0320e, 0x0320f,
+ 0x03210, 0x03211, 0x03212, 0x03213, 0x03214, 0x03215, 0x03216, 0x03217,
+ 0x03218, 0x03219, 0x0321a, 0x0321b, 0x0321c, 0x0321d, 0x0321e, 0x0321f,
+ 0x03220, 0x03221, 0x03222, 0x03223, 0x03224, 0x03225, 0x03226, 0x03227,
+ 0x03228, 0x03229, 0x0322a, 0x0322b, 0x0322c, 0x0322d, 0x0322e, 0x0322f,
+ 0x03230, 0x03231, 0x03232, 0x03233, 0x03234, 0x03235, 0x03236, 0x03237,
+ 0x03238, 0x03239, 0x0323a, 0x0323b, 0x0323c, 0x0323d, 0x0323e, 0x0323f,
+ 0x03240, 0x03241, 0x03242, 0x03243, 0x03244, 0x03245, 0x02f42, 0x03247,
+ 0x02469, 0x02473, 0x0324a, 0x0324b, 0x0324c, 0x0324d, 0x0324e, 0x0324f,
+ 0x03250, 0x03251, 0x03252, 0x03253, 0x03254, 0x03255, 0x03256, 0x03257,
+ 0x03258, 0x03259, 0x0324a, 0x0325b, 0x0325c, 0x0325d, 0x0325e, 0x0325f,
+ 0x01100, 0x01102, 0x01103, 0x01105, 0x01106, 0x01107, 0x01109, 0x0110b,
+ 0x0110c, 0x0110e, 0x0110f, 0x01110, 0x01111, 0x01112, 0x0326e, 0x0326f,
+ 0x03270, 0x03271, 0x03272, 0x03273, 0x03274, 0x03275, 0x03276, 0x03277,
+ 0x03278, 0x03279, 0x0327a, 0x0327b, 0x0327c, 0x0327d, 0x0327e, 0x0327f,
+ 0x03192, 0x03193, 0x03194, 0x03195, 0x03284, 0x03285, 0x03286, 0x02f0b,
+ 0x03288, 0x02f17, 0x02f49, 0x02f55, 0x02f54, 0x02f4a, 0x02fa6, 0x02f1f,
+ 0x02f47, 0x03291, 0x03292, 0x03293, 0x03294, 0x03295, 0x03296, 0x03297,
+ 0x03298, 0x03299, 0x0329a, 0x02f25, 0x0329c, 0x0329d, 0x0329e, 0x0329f,
+ 0x032a0, 0x032a1, 0x032a2, 0x032a3, 0x03196, 0x03197, 0x03198, 0x032a7,
+ 0x032a8, 0x032a9, 0x032aa, 0x032ab, 0x032ac, 0x032ad, 0x032ae, 0x032af,
+ 0x032b0, 0x032b1, 0x032b2, 0x032b3, 0x032b4, 0x0324b, 0x032b6, 0x032b7,
+ 0x032b8, 0x032b9, 0x032ba, 0x032bb, 0x032bc, 0x032bd, 0x032be, 0x0324c,
+ 0x032c0, 0x032c1, 0x032c2, 0x032c3, 0x032c4, 0x032c5, 0x032c6, 0x032c7,
+ 0x032c8, 0x032c9, 0x032ca, 0x032cb, 0x032cc, 0x032cd, 0x032ce, 0x032cf,
+ 0x03042, 0x03044, 0x03046, 0x03048, 0x0304a, 0x0304b, 0x0304d, 0x0304f,
+ 0x03051, 0x03053, 0x03055, 0x03057, 0x03059, 0x0305b, 0x0305d, 0x0305f,
+ 0x03061, 0x03064, 0x03066, 0x03068, 0x0306a, 0x0306b, 0x0306c, 0x0306d,
+ 0x0306e, 0x0306f, 0x03072, 0x03075, 0x03078, 0x0307b, 0x0307e, 0x0307f,
+ 0x03080, 0x03081, 0x03082, 0x03084, 0x03086, 0x03088, 0x03089, 0x0308a,
+ 0x0308b, 0x0308c, 0x0308d, 0x0308f, 0x03090, 0x03091, 0x03092, 0x032ff
+};
+
+static uint32_t unicode_520_ci_page_33[] = {
+ 0x03300, 0x03301, 0x03302, 0x03303, 0x03304, 0x03305, 0x03306, 0x03307,
+ 0x03308, 0x03309, 0x0330a, 0x0330b, 0x0330c, 0x0330d, 0x0330e, 0x0330f,
+ 0x03310, 0x03311, 0x03312, 0x03313, 0x03314, 0x03315, 0x03316, 0x03317,
+ 0x03318, 0x03319, 0x0331a, 0x0331b, 0x0331c, 0x0331d, 0x0331e, 0x0331f,
+ 0x03320, 0x03321, 0x03322, 0x03323, 0x03324, 0x03325, 0x03326, 0x03327,
+ 0x03328, 0x03329, 0x0332a, 0x0332b, 0x0332c, 0x0332d, 0x0332e, 0x0332f,
+ 0x03330, 0x03331, 0x03332, 0x03333, 0x03334, 0x03335, 0x03336, 0x03337,
+ 0x03338, 0x03339, 0x0333a, 0x0333b, 0x0333c, 0x0333d, 0x0333e, 0x0333f,
+ 0x03340, 0x03341, 0x03342, 0x03343, 0x03344, 0x03345, 0x03346, 0x03347,
+ 0x03348, 0x03349, 0x0334a, 0x0334b, 0x0334c, 0x0334d, 0x0334e, 0x0334f,
+ 0x03350, 0x03351, 0x03352, 0x03353, 0x03354, 0x03355, 0x03356, 0x03357,
+ 0x03358, 0x03359, 0x0335a, 0x0335b, 0x0335c, 0x0335d, 0x0335e, 0x0335f,
+ 0x03360, 0x03361, 0x03362, 0x03363, 0x03364, 0x03365, 0x03366, 0x03367,
+ 0x03368, 0x03369, 0x0336a, 0x0336b, 0x0336c, 0x0336d, 0x0336e, 0x0336f,
+ 0x03370, 0x03371, 0x03372, 0x03373, 0x03374, 0x03375, 0x03376, 0x03377,
+ 0x03378, 0x03379, 0x0337a, 0x0337b, 0x0337c, 0x0337d, 0x0337e, 0x0337f,
+ 0x03380, 0x03381, 0x03382, 0x03383, 0x03384, 0x03385, 0x03386, 0x03387,
+ 0x03388, 0x03389, 0x0338a, 0x0338b, 0x0338c, 0x0338d, 0x0338e, 0x0338f,
+ 0x03390, 0x03391, 0x03392, 0x03393, 0x03394, 0x03395, 0x03396, 0x03397,
+ 0x03398, 0x03399, 0x0339a, 0x0339b, 0x0339c, 0x0339d, 0x0339e, 0x0339f,
+ 0x033a0, 0x033a1, 0x033a2, 0x033a3, 0x033a4, 0x033a5, 0x033a6, 0x033a7,
+ 0x033a8, 0x03380, 0x033aa, 0x033ab, 0x033ac, 0x033ad, 0x033ae, 0x033af,
+ 0x033b0, 0x033b1, 0x033b2, 0x033b3, 0x033b4, 0x033b5, 0x033b6, 0x033b7,
+ 0x033b8, 0x033b7, 0x033ba, 0x033bb, 0x033bc, 0x033bd, 0x033be, 0x033bd,
+ 0x033c0, 0x033c1, 0x033c2, 0x033c3, 0x033c4, 0x033c5, 0x033c6, 0x033c7,
+ 0x00238, 0x033c9, 0x033ca, 0x033cb, 0x033cc, 0x033cd, 0x0339e, 0x033cf,
+ 0x033d0, 0x033d1, 0x033d2, 0x033d3, 0x03386, 0x033d5, 0x033d6, 0x033d7,
+ 0x033d8, 0x033d9, 0x033da, 0x033db, 0x033dc, 0x033dd, 0x033de, 0x033df,
+ 0x033e0, 0x033e1, 0x033e2, 0x033e3, 0x033e4, 0x033e5, 0x033e6, 0x033e7,
+ 0x033e8, 0x033e9, 0x033ea, 0x033eb, 0x033ec, 0x033ed, 0x033ee, 0x033ef,
+ 0x033f0, 0x033f1, 0x033f2, 0x033f3, 0x033f4, 0x033f5, 0x033f6, 0x033f7,
+ 0x033f8, 0x033f9, 0x033fa, 0x033fb, 0x033fc, 0x033fd, 0x033fe, 0x033ff
+};
+
+static uint32_t unicode_520_ci_page_a6[] = {
+ 0x0a600, 0x0a601, 0x0a602, 0x0a603, 0x0a604, 0x0a605, 0x0a606, 0x0a607,
+ 0x0a608, 0x0a609, 0x0a60a, 0x0a60b, 0x0a60c, 0x0a60d, 0x0a60e, 0x0a60f,
+ 0x0a558, 0x0a56a, 0x0a587, 0x0a613, 0x0a614, 0x0a615, 0x0a616, 0x0a617,
+ 0x0a618, 0x0a619, 0x0a61a, 0x0a61b, 0x0a61c, 0x0a61d, 0x0a61e, 0x0a61f,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x0a56e, 0x0a5d1, 0x0a62c, 0x0a62d, 0x0a62e, 0x0a62f,
+ 0x0a630, 0x0a631, 0x0a632, 0x0a633, 0x0a634, 0x0a635, 0x0a636, 0x0a637,
+ 0x0a638, 0x0a639, 0x0a63a, 0x0a63b, 0x0a63c, 0x0a63d, 0x0a63e, 0x0a63f,
+ 0x0a640, 0x0a640, 0x0a642, 0x0a642, 0x0a644, 0x0a644, 0x0a646, 0x0a646,
+ 0x02df8, 0x02df8, 0x02df9, 0x02df9, 0x0a64c, 0x0a64c, 0x0a64e, 0x0a64e,
+ 0x0a650, 0x0a650, 0x0a652, 0x0a652, 0x0a654, 0x0a654, 0x02dfc, 0x02dfc,
+ 0x0a658, 0x0a658, 0x0a65a, 0x0a65a, 0x0a65c, 0x0a65c, 0x0a65e, 0x0a65e,
+ 0x0a660, 0x0a661, 0x0a662, 0x0a662, 0x0a664, 0x0a664, 0x0a666, 0x0a666,
+ 0x0041e, 0x0041e, 0x0041e, 0x0041e, 0x0041e, 0x0041e, 0x0041e, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x0a673, 0x0a674, 0x0a675, 0x0a676, 0x0a677,
+ 0x0a678, 0x0a679, 0x0a67a, 0x0a67b, 0x00000, 0x00000, 0x0a67e, 0x0a67f,
+ 0x0a680, 0x0a680, 0x0a682, 0x0a682, 0x0a684, 0x0a684, 0x0a686, 0x0a686,
+ 0x0a688, 0x0a688, 0x0a68a, 0x0a68a, 0x0a68c, 0x0a68c, 0x0a68e, 0x0a68e,
+ 0x0a690, 0x0a690, 0x0a692, 0x0a692, 0x0a694, 0x0a694, 0x0a696, 0x0a696,
+ 0x0a698, 0x0a699, 0x0a69a, 0x0a69b, 0x0a69c, 0x0a69d, 0x0a69e, 0x0a69f,
+ 0x0a6a0, 0x0a6a1, 0x0a6a2, 0x0a6a3, 0x0a6a4, 0x0a6a5, 0x0a6a6, 0x0a6a7,
+ 0x0a6a8, 0x0a6a9, 0x0a6aa, 0x0a6ab, 0x0a6ac, 0x0a6ad, 0x0a6ae, 0x0a6af,
+ 0x0a6b0, 0x0a6b1, 0x0a6b2, 0x0a6b3, 0x0a6b4, 0x0a6b5, 0x0a6b6, 0x0a6b7,
+ 0x0a6b8, 0x0a6b9, 0x0a6ba, 0x0a6bb, 0x0a6bc, 0x0a6bd, 0x0a6be, 0x0a6bf,
+ 0x0a6c0, 0x0a6c1, 0x0a6c2, 0x0a6c3, 0x0a6c4, 0x0a6c5, 0x0a6c6, 0x0a6c7,
+ 0x0a6c8, 0x0a6c9, 0x0a6ca, 0x0a6cb, 0x0a6cc, 0x0a6cd, 0x0a6ce, 0x0a6cf,
+ 0x0a6d0, 0x0a6d1, 0x0a6d2, 0x0a6d3, 0x0a6d4, 0x0a6d5, 0x0a6d6, 0x0a6d7,
+ 0x0a6d8, 0x0a6d9, 0x0a6da, 0x0a6db, 0x0a6dc, 0x0a6dd, 0x0a6de, 0x0a6df,
+ 0x0a6e0, 0x0a6e1, 0x0a6e2, 0x0a6e3, 0x0a6e4, 0x0a6e5, 0x0a6e6, 0x0a6e7,
+ 0x0a6e8, 0x0a6e9, 0x0a6ea, 0x0a6eb, 0x0a6ec, 0x0a6ed, 0x0a6ee, 0x0a6ef,
+ 0x00000, 0x00000, 0x0a6f2, 0x0a6f3, 0x0a6f4, 0x0a6f5, 0x0a6f6, 0x0a6f7,
+ 0x0a6f8, 0x0a6f9, 0x0a6fa, 0x0a6fb, 0x0a6fc, 0x0a6fd, 0x0a6fe, 0x0a6ff
+};
+
+static uint32_t unicode_520_ci_page_a7[] = {
+ 0x0a700, 0x0a701, 0x0a702, 0x0a703, 0x0a704, 0x0a705, 0x0a706, 0x0a707,
+ 0x0a708, 0x0a709, 0x0a70a, 0x0a70b, 0x0a70c, 0x0a70d, 0x0a70e, 0x0a70f,
+ 0x0a710, 0x0a711, 0x0a712, 0x0a713, 0x0a714, 0x0a715, 0x0a716, 0x0a717,
+ 0x0a718, 0x0a719, 0x0a71a, 0x0a71b, 0x0a71c, 0x0a71d, 0x0a71e, 0x0a71f,
+ 0x0a720, 0x0a721, 0x0a722, 0x0a722, 0x0a724, 0x0a724, 0x0a726, 0x0a726,
+ 0x0a728, 0x0a728, 0x0a72a, 0x0a72a, 0x0a72c, 0x0a72c, 0x0a72e, 0x0a72e,
+ 0x0a730, 0x0a731, 0x0a732, 0x0a732, 0x01dd5, 0x01dd5, 0x03373, 0x03373,
+ 0x01dd6, 0x01dd6, 0x01dd6, 0x01dd6, 0x0a73c, 0x0a73c, 0x0a73e, 0x0a73e,
+ 0x0a740, 0x0a740, 0x0a742, 0x0a742, 0x0a744, 0x0a744, 0x0a746, 0x0a746,
+ 0x0a748, 0x0a748, 0x0a74a, 0x0a74a, 0x0a74c, 0x0a74c, 0x0a74e, 0x0a74e,
+ 0x0a750, 0x0a750, 0x0a752, 0x0a752, 0x0a754, 0x0a754, 0x0a756, 0x0a756,
+ 0x0a758, 0x0a758, 0x01de3, 0x01de3, 0x0a75c, 0x0a75c, 0x0a75e, 0x0a75e,
+ 0x0a760, 0x0a760, 0x0a762, 0x0a762, 0x0a764, 0x0a764, 0x0a766, 0x0a766,
+ 0x0a768, 0x0a768, 0x0a76a, 0x0a76a, 0x0a76c, 0x0a76c, 0x01dd2, 0x01dd2,
+ 0x01dd2, 0x0a771, 0x0a772, 0x0a773, 0x0a774, 0x0a775, 0x0a776, 0x0a777,
+ 0x0a778, 0x00044, 0x00044, 0x00046, 0x00046, 0x00047, 0x0a77e, 0x0a77e,
+ 0x0a780, 0x0a780, 0x00052, 0x00052, 0x00053, 0x00053, 0x00054, 0x00054,
+ 0x0a788, 0x0a789, 0x0a78a, 0x0a78b, 0x0a78b, 0x0a78d, 0x0a78e, 0x0a78f,
+ 0x0a790, 0x0a791, 0x0a792, 0x0a793, 0x0a794, 0x0a795, 0x0a796, 0x0a797,
+ 0x0a798, 0x0a799, 0x0a79a, 0x0a79b, 0x0a79c, 0x0a79d, 0x0a79e, 0x0a79f,
+ 0x0a7a0, 0x0a7a1, 0x0a7a2, 0x0a7a3, 0x0a7a4, 0x0a7a5, 0x0a7a6, 0x0a7a7,
+ 0x0a7a8, 0x0a7a9, 0x0a7aa, 0x0a7ab, 0x0a7ac, 0x0a7ad, 0x0a7ae, 0x0a7af,
+ 0x0a7b0, 0x0a7b1, 0x0a7b2, 0x0a7b3, 0x0a7b4, 0x0a7b5, 0x0a7b6, 0x0a7b7,
+ 0x0a7b8, 0x0a7b9, 0x0a7ba, 0x0a7bb, 0x0a7bc, 0x0a7bd, 0x0a7be, 0x0a7bf,
+ 0x0a7c0, 0x0a7c1, 0x0a7c2, 0x0a7c3, 0x0a7c4, 0x0a7c5, 0x0a7c6, 0x0a7c7,
+ 0x0a7c8, 0x0a7c9, 0x0a7ca, 0x0a7cb, 0x0a7cc, 0x0a7cd, 0x0a7ce, 0x0a7cf,
+ 0x0a7d0, 0x0a7d1, 0x0a7d2, 0x0a7d3, 0x0a7d4, 0x0a7d5, 0x0a7d6, 0x0a7d7,
+ 0x0a7d8, 0x0a7d9, 0x0a7da, 0x0a7db, 0x0a7dc, 0x0a7dd, 0x0a7de, 0x0a7df,
+ 0x0a7e0, 0x0a7e1, 0x0a7e2, 0x0a7e3, 0x0a7e4, 0x0a7e5, 0x0a7e6, 0x0a7e7,
+ 0x0a7e8, 0x0a7e9, 0x0a7ea, 0x0a7eb, 0x0a7ec, 0x0a7ed, 0x0a7ee, 0x0a7ef,
+ 0x0a7f0, 0x0a7f1, 0x0a7f2, 0x0a7f3, 0x0a7f4, 0x0a7f5, 0x0a7f6, 0x0a7f7,
+ 0x0a7f8, 0x0a7f9, 0x0a7fa, 0x0a7fb, 0x0a7fc, 0x0a7fd, 0x0a7fe, 0x0a7ff
+};
+
+static uint32_t unicode_520_ci_page_a8[] = {
+ 0x0a800, 0x0a801, 0x0a802, 0x0a803, 0x0a804, 0x0a805, 0x0a806, 0x0a807,
+ 0x0a808, 0x0a809, 0x0a80a, 0x00000, 0x0a80c, 0x0a80d, 0x0a80e, 0x0a80f,
+ 0x0a810, 0x0a811, 0x0a812, 0x0a813, 0x0a814, 0x0a815, 0x0a816, 0x0a817,
+ 0x0a818, 0x0a819, 0x0a81a, 0x0a81b, 0x0a81c, 0x0a81d, 0x0a81e, 0x0a81f,
+ 0x0a820, 0x0a821, 0x0a822, 0x0a823, 0x0a824, 0x0a825, 0x0a826, 0x0a827,
+ 0x0a828, 0x0a829, 0x0a82a, 0x0a82b, 0x0a82c, 0x0a82d, 0x0a82e, 0x0a82f,
+ 0x0a830, 0x0a831, 0x0a832, 0x0a833, 0x0a834, 0x0a835, 0x0a836, 0x0a837,
+ 0x0a838, 0x0a839, 0x0a83a, 0x0a83b, 0x0a83c, 0x0a83d, 0x0a83e, 0x0a83f,
+ 0x0a840, 0x0a841, 0x0a842, 0x0a843, 0x0a844, 0x0a845, 0x0a846, 0x0a847,
+ 0x0a848, 0x0a849, 0x0a84a, 0x0a84b, 0x0a84c, 0x0a84d, 0x0a84e, 0x0a84f,
+ 0x0a850, 0x0a851, 0x0a852, 0x0a853, 0x0a854, 0x0a855, 0x0a856, 0x0a857,
+ 0x0a858, 0x0a859, 0x0a85a, 0x0a85b, 0x0a85c, 0x0a85d, 0x0a85e, 0x0a85f,
+ 0x0a860, 0x0a861, 0x0a862, 0x0a863, 0x0a864, 0x0a865, 0x0a866, 0x0a867,
+ 0x0a868, 0x0a869, 0x0a86a, 0x0a86b, 0x0a86c, 0x0a86d, 0x0a86e, 0x0a86f,
+ 0x0a870, 0x0a871, 0x0a872, 0x0a873, 0x0a874, 0x0a875, 0x0a876, 0x0a877,
+ 0x0a878, 0x0a879, 0x0a87a, 0x0a87b, 0x0a87c, 0x0a87d, 0x0a87e, 0x0a87f,
+ 0x00000, 0x00000, 0x0a882, 0x0a883, 0x0a884, 0x0a885, 0x0a886, 0x0a887,
+ 0x0a888, 0x0a889, 0x0a88a, 0x0a88b, 0x0a88c, 0x0a88d, 0x0a88e, 0x0a88f,
+ 0x0a890, 0x0a891, 0x0a892, 0x0a893, 0x0a894, 0x0a895, 0x0a896, 0x0a897,
+ 0x0a898, 0x0a899, 0x0a89a, 0x0a89b, 0x0a89c, 0x0a89d, 0x0a89e, 0x0a89f,
+ 0x0a8a0, 0x0a8a1, 0x0a8a2, 0x0a8a3, 0x0a8a4, 0x0a8a5, 0x0a8a6, 0x0a8a7,
+ 0x0a8a8, 0x0a8a9, 0x0a8aa, 0x0a8ab, 0x0a8ac, 0x0a8ad, 0x0a8ae, 0x0a8af,
+ 0x0a8b0, 0x0a8b1, 0x0a8b2, 0x0a8b3, 0x0a8b4, 0x0a8b5, 0x0a8b6, 0x0a8b7,
+ 0x0a8b8, 0x0a8b9, 0x0a8ba, 0x0a8bb, 0x0a8bc, 0x0a8bd, 0x0a8be, 0x0a8bf,
+ 0x0a8c0, 0x0a8c1, 0x0a8c2, 0x0a8c3, 0x0a8c4, 0x0a8c5, 0x0a8c6, 0x0a8c7,
+ 0x0a8c8, 0x0a8c9, 0x0a8ca, 0x0a8cb, 0x0a8cc, 0x0a8cd, 0x0a8ce, 0x0a8cf,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x0a8da, 0x0a8db, 0x0a8dc, 0x0a8dd, 0x0a8de, 0x0a8df,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x0a8f2, 0x0a8f2, 0x0a8f2, 0x0a8f2, 0x0a8f2, 0x0a8f2,
+ 0x0a8f8, 0x0a8f9, 0x0a8fa, 0x0a8fb, 0x0a8fc, 0x0a8fd, 0x0a8fe, 0x0a8ff
+};
+
+static uint32_t unicode_520_ci_page_a9[] = {
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x0a90a, 0x0a90b, 0x0a90c, 0x0a90d, 0x0a90e, 0x0a90f,
+ 0x0a910, 0x0a911, 0x0a912, 0x0a913, 0x0a914, 0x0a915, 0x0a916, 0x0a917,
+ 0x0a918, 0x0a919, 0x0a91a, 0x0a91b, 0x0a91c, 0x0a91d, 0x0a91e, 0x0a91f,
+ 0x0a920, 0x0a921, 0x0a922, 0x0a923, 0x0a924, 0x0a925, 0x0a926, 0x0a927,
+ 0x0a928, 0x0a929, 0x0a92a, 0x00000, 0x00000, 0x00000, 0x0a92e, 0x0a92f,
+ 0x0a930, 0x0a931, 0x0a932, 0x0a933, 0x0a934, 0x0a935, 0x0a936, 0x0a937,
+ 0x0a938, 0x0a939, 0x0a93a, 0x0a93b, 0x0a93c, 0x0a93d, 0x0a93e, 0x0a93f,
+ 0x0a940, 0x0a941, 0x0a942, 0x0a943, 0x0a944, 0x0a945, 0x0a946, 0x0a947,
+ 0x0a948, 0x0a949, 0x0a94a, 0x0a94b, 0x0a94c, 0x0a94d, 0x0a94e, 0x0a94f,
+ 0x0a950, 0x0a951, 0x0a952, 0x0a953, 0x0a954, 0x0a955, 0x0a956, 0x0a957,
+ 0x0a958, 0x0a959, 0x0a95a, 0x0a95b, 0x0a95c, 0x0a95d, 0x0a95e, 0x0a95f,
+ 0x0a960, 0x0a961, 0x0a962, 0x0a963, 0x0a964, 0x0a965, 0x0a966, 0x0a967,
+ 0x0a968, 0x0a969, 0x0a96a, 0x0a96b, 0x0a96c, 0x0a96d, 0x0a96e, 0x0a96f,
+ 0x0a970, 0x0a971, 0x0a972, 0x0a973, 0x0a974, 0x0a975, 0x0a976, 0x0a977,
+ 0x0a978, 0x0a979, 0x0a97a, 0x0a97b, 0x0a97c, 0x0a97d, 0x0a97e, 0x0a97f,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x0a984, 0x0a985, 0x0a986, 0x0a987,
+ 0x0a988, 0x0a989, 0x0a98a, 0x0a98b, 0x0a98c, 0x0a98d, 0x0a98e, 0x0a98f,
+ 0x0a990, 0x0a991, 0x0a992, 0x0a993, 0x0a994, 0x0a995, 0x0a996, 0x0a997,
+ 0x0a998, 0x0a999, 0x0a99a, 0x0a99b, 0x0a99c, 0x0a99d, 0x0a99e, 0x0a99f,
+ 0x0a9a0, 0x0a9a1, 0x0a9a2, 0x0a9a3, 0x0a9a4, 0x0a9a5, 0x0a9a6, 0x0a9a7,
+ 0x0a9a8, 0x0a9a9, 0x0a9aa, 0x0a9ab, 0x0a9ab, 0x0a9ad, 0x0a9ae, 0x0a9af,
+ 0x0a9b0, 0x0a9b1, 0x0a9b2, 0x00000, 0x0a9b4, 0x0a9b5, 0x0a9b6, 0x0a9b7,
+ 0x0a9b8, 0x0a9b9, 0x0a9ba, 0x0a9bb, 0x0a9bc, 0x0a9bd, 0x0a9be, 0x0a9bf,
+ 0x0a9c0, 0x0a9c1, 0x0a9c2, 0x0a9c3, 0x0a9c4, 0x0a9c5, 0x0a9c6, 0x0a9c7,
+ 0x0a9c8, 0x0a9c9, 0x0a9ca, 0x0a9cb, 0x0a9cc, 0x0a9cd, 0x0a9ce, 0x0a9cf,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x0a9da, 0x0a9db, 0x0a9dc, 0x0a9dd, 0x0a9de, 0x0a9df,
+ 0x0a9e0, 0x0a9e1, 0x0a9e2, 0x0a9e3, 0x0a9e4, 0x0a9e5, 0x0a9e6, 0x0a9e7,
+ 0x0a9e8, 0x0a9e9, 0x0a9ea, 0x0a9eb, 0x0a9ec, 0x0a9ed, 0x0a9ee, 0x0a9ef,
+ 0x0a9f0, 0x0a9f1, 0x0a9f2, 0x0a9f3, 0x0a9f4, 0x0a9f5, 0x0a9f6, 0x0a9f7,
+ 0x0a9f8, 0x0a9f9, 0x0a9fa, 0x0a9fb, 0x0a9fc, 0x0a9fd, 0x0a9fe, 0x0a9ff
+};
+
+static uint32_t unicode_520_ci_page_aa[] = {
+ 0x0aa00, 0x0aa01, 0x0aa02, 0x0aa03, 0x0aa04, 0x0aa05, 0x0aa06, 0x0aa07,
+ 0x0aa08, 0x0aa09, 0x0aa0a, 0x0aa0b, 0x0aa0c, 0x0aa0d, 0x0aa0e, 0x0aa0f,
+ 0x0aa10, 0x0aa11, 0x0aa12, 0x0aa13, 0x0aa14, 0x0aa15, 0x0aa16, 0x0aa17,
+ 0x0aa18, 0x0aa19, 0x0aa1a, 0x0aa1b, 0x0aa1c, 0x0aa1d, 0x0aa1e, 0x0aa1f,
+ 0x0aa20, 0x0aa21, 0x0aa22, 0x0aa23, 0x0aa24, 0x0aa25, 0x0aa26, 0x0aa27,
+ 0x0aa28, 0x0aa29, 0x0aa2a, 0x0aa2b, 0x0aa2c, 0x0aa2d, 0x0aa2e, 0x0aa2f,
+ 0x0aa30, 0x0aa31, 0x0aa32, 0x0aa33, 0x0aa34, 0x0aa35, 0x0aa36, 0x0aa37,
+ 0x0aa38, 0x0aa39, 0x0aa3a, 0x0aa3b, 0x0aa3c, 0x0aa3d, 0x0aa3e, 0x0aa3f,
+ 0x0aa40, 0x0aa41, 0x0aa42, 0x0aa43, 0x0aa44, 0x0aa45, 0x0aa46, 0x0aa47,
+ 0x0aa48, 0x0aa49, 0x0aa4a, 0x0aa4b, 0x0aa4c, 0x0aa4d, 0x0aa4e, 0x0aa4f,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x0aa5a, 0x0aa5b, 0x0aa5c, 0x0aa5d, 0x0aa5e, 0x0aa5f,
+ 0x0aa60, 0x0aa61, 0x0aa62, 0x0aa63, 0x0aa64, 0x0aa65, 0x0aa66, 0x0aa67,
+ 0x0aa68, 0x0aa69, 0x0aa6a, 0x0aa6b, 0x0aa6c, 0x0aa6d, 0x0aa6e, 0x0aa6f,
+ 0x0aa70, 0x0aa71, 0x0aa72, 0x0aa73, 0x0aa74, 0x0aa75, 0x0aa76, 0x0aa77,
+ 0x0aa78, 0x0aa79, 0x0aa7a, 0x0aa7b, 0x0aa7c, 0x0aa7d, 0x0aa7e, 0x0aa7f,
+ 0x0aa80, 0x0aa81, 0x0aa82, 0x0aa83, 0x0aa84, 0x0aa85, 0x0aa86, 0x0aa87,
+ 0x0aa88, 0x0aa89, 0x0aa8a, 0x0aa8b, 0x0aa8c, 0x0aa8d, 0x0aa8e, 0x0aa8f,
+ 0x0aa90, 0x0aa91, 0x0aa92, 0x0aa93, 0x0aa94, 0x0aa95, 0x0aa96, 0x0aa97,
+ 0x0aa98, 0x0aa99, 0x0aa9a, 0x0aa9b, 0x0aa9c, 0x0aa9d, 0x0aa9e, 0x0aa9f,
+ 0x0aaa0, 0x0aaa1, 0x0aaa2, 0x0aaa3, 0x0aaa4, 0x0aaa5, 0x0aaa6, 0x0aaa7,
+ 0x0aaa8, 0x0aaa9, 0x0aaaa, 0x0aaab, 0x0aaac, 0x0aaad, 0x0aaae, 0x0aaaf,
+ 0x0aab0, 0x0aab1, 0x0aab2, 0x0aab3, 0x0aab4, 0x0aab5, 0x0aab6, 0x0aab7,
+ 0x0aab8, 0x0aab9, 0x0aaba, 0x0aabb, 0x0aabc, 0x0aabd, 0x0aabe, 0x00000,
+ 0x0aac0, 0x00000, 0x0aac2, 0x0aac3, 0x0aac4, 0x0aac5, 0x0aac6, 0x0aac7,
+ 0x0aac8, 0x0aac9, 0x0aaca, 0x0aacb, 0x0aacc, 0x0aacd, 0x0aace, 0x0aacf,
+ 0x0aad0, 0x0aad1, 0x0aad2, 0x0aad3, 0x0aad4, 0x0aad5, 0x0aad6, 0x0aad7,
+ 0x0aad8, 0x0aad9, 0x0aada, 0x0aadb, 0x0aadc, 0x0aadd, 0x0aade, 0x0aadf,
+ 0x0aae0, 0x0aae1, 0x0aae2, 0x0aae3, 0x0aae4, 0x0aae5, 0x0aae6, 0x0aae7,
+ 0x0aae8, 0x0aae9, 0x0aaea, 0x0aaeb, 0x0aaec, 0x0aaed, 0x0aaee, 0x0aaef,
+ 0x0aaf0, 0x0aaf1, 0x0aaf2, 0x0aaf3, 0x0aaf4, 0x0aaf5, 0x0aaf6, 0x0aaf7,
+ 0x0aaf8, 0x0aaf9, 0x0aafa, 0x0aafb, 0x0aafc, 0x0aafd, 0x0aafe, 0x0aaff
+};
+
+static uint32_t unicode_520_ci_page_ab[] = {
+ 0x0ab00, 0x0ab01, 0x0ab02, 0x0ab03, 0x0ab04, 0x0ab05, 0x0ab06, 0x0ab07,
+ 0x0ab08, 0x0ab09, 0x0ab0a, 0x0ab0b, 0x0ab0c, 0x0ab0d, 0x0ab0e, 0x0ab0f,
+ 0x0ab10, 0x0ab11, 0x0ab12, 0x0ab13, 0x0ab14, 0x0ab15, 0x0ab16, 0x0ab17,
+ 0x0ab18, 0x0ab19, 0x0ab1a, 0x0ab1b, 0x0ab1c, 0x0ab1d, 0x0ab1e, 0x0ab1f,
+ 0x0ab20, 0x0ab21, 0x0ab22, 0x0ab23, 0x0ab24, 0x0ab25, 0x0ab26, 0x0ab27,
+ 0x0ab28, 0x0ab29, 0x0ab2a, 0x0ab2b, 0x0ab2c, 0x0ab2d, 0x0ab2e, 0x0ab2f,
+ 0x0ab30, 0x0ab31, 0x0ab32, 0x0ab33, 0x0ab34, 0x0ab35, 0x0ab36, 0x0ab37,
+ 0x0ab38, 0x0ab39, 0x0ab3a, 0x0ab3b, 0x0ab3c, 0x0ab3d, 0x0ab3e, 0x0ab3f,
+ 0x0ab40, 0x0ab41, 0x0ab42, 0x0ab43, 0x0ab44, 0x0ab45, 0x0ab46, 0x0ab47,
+ 0x0ab48, 0x0ab49, 0x0ab4a, 0x0ab4b, 0x0ab4c, 0x0ab4d, 0x0ab4e, 0x0ab4f,
+ 0x0ab50, 0x0ab51, 0x0ab52, 0x0ab53, 0x0ab54, 0x0ab55, 0x0ab56, 0x0ab57,
+ 0x0ab58, 0x0ab59, 0x0ab5a, 0x0ab5b, 0x0ab5c, 0x0ab5d, 0x0ab5e, 0x0ab5f,
+ 0x0ab60, 0x0ab61, 0x0ab62, 0x0ab63, 0x0ab64, 0x0ab65, 0x0ab66, 0x0ab67,
+ 0x0ab68, 0x0ab69, 0x0ab6a, 0x0ab6b, 0x0ab6c, 0x0ab6d, 0x0ab6e, 0x0ab6f,
+ 0x0ab70, 0x0ab71, 0x0ab72, 0x0ab73, 0x0ab74, 0x0ab75, 0x0ab76, 0x0ab77,
+ 0x0ab78, 0x0ab79, 0x0ab7a, 0x0ab7b, 0x0ab7c, 0x0ab7d, 0x0ab7e, 0x0ab7f,
+ 0x0ab80, 0x0ab81, 0x0ab82, 0x0ab83, 0x0ab84, 0x0ab85, 0x0ab86, 0x0ab87,
+ 0x0ab88, 0x0ab89, 0x0ab8a, 0x0ab8b, 0x0ab8c, 0x0ab8d, 0x0ab8e, 0x0ab8f,
+ 0x0ab90, 0x0ab91, 0x0ab92, 0x0ab93, 0x0ab94, 0x0ab95, 0x0ab96, 0x0ab97,
+ 0x0ab98, 0x0ab99, 0x0ab9a, 0x0ab9b, 0x0ab9c, 0x0ab9d, 0x0ab9e, 0x0ab9f,
+ 0x0aba0, 0x0aba1, 0x0aba2, 0x0aba3, 0x0aba4, 0x0aba5, 0x0aba6, 0x0aba7,
+ 0x0aba8, 0x0aba9, 0x0abaa, 0x0abab, 0x0abac, 0x0abad, 0x0abae, 0x0abaf,
+ 0x0abb0, 0x0abb1, 0x0abb2, 0x0abb3, 0x0abb4, 0x0abb5, 0x0abb6, 0x0abb7,
+ 0x0abb8, 0x0abb9, 0x0abba, 0x0abbb, 0x0abbc, 0x0abbd, 0x0abbe, 0x0abbf,
+ 0x0abc0, 0x0abc1, 0x0abc2, 0x0abc3, 0x0abc4, 0x0abc5, 0x0abc6, 0x0abc7,
+ 0x0abc8, 0x0abc9, 0x0abca, 0x0abcb, 0x0abcc, 0x0abcd, 0x0abce, 0x0abcf,
+ 0x0abd0, 0x0abd1, 0x0abd2, 0x0abd3, 0x0abd4, 0x0abd5, 0x0abd6, 0x0abd7,
+ 0x0abd8, 0x0abd9, 0x0abda, 0x0abdb, 0x0abdc, 0x0abdd, 0x0abde, 0x0abdf,
+ 0x0abe0, 0x0abe1, 0x0abe2, 0x0abe3, 0x0abe4, 0x0abe5, 0x0abe6, 0x0abe7,
+ 0x0abe8, 0x0abe9, 0x0abea, 0x0abeb, 0x00000, 0x0abed, 0x0abee, 0x0abef,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x0abfa, 0x0abfb, 0x0abfc, 0x0abfd, 0x0abfe, 0x0abff
+};
+
+static uint32_t unicode_520_ci_page_f9[] = {
+ 0x0f900, 0x0f901, 0x02f9e, 0x0f903, 0x0f904, 0x0f905, 0x0f906, 0x02ef2,
+ 0x02ef2, 0x0f909, 0x02fa6, 0x0f90b, 0x0f90c, 0x0f90d, 0x0f90e, 0x0f90f,
+ 0x0f910, 0x0f911, 0x0f912, 0x0f913, 0x0f914, 0x0f915, 0x0f916, 0x0f917,
+ 0x0f918, 0x0f919, 0x0f91a, 0x0f91b, 0x0f91c, 0x0f91d, 0x0f91e, 0x0f91f,
+ 0x0f920, 0x0f921, 0x0f922, 0x0f923, 0x0f924, 0x0f925, 0x0f926, 0x0f927,
+ 0x0f928, 0x0f929, 0x0f92a, 0x0f92b, 0x0f92c, 0x0f92d, 0x0f92e, 0x0f92f,
+ 0x0f930, 0x0f931, 0x0f932, 0x0f933, 0x02f7c, 0x0f935, 0x0f936, 0x0f937,
+ 0x0f938, 0x0f939, 0x0f93a, 0x0f93b, 0x0f93c, 0x0f93d, 0x0f93e, 0x0f93f,
+ 0x02fc5, 0x0f941, 0x0f942, 0x0f943, 0x0f944, 0x0f945, 0x0f946, 0x0f947,
+ 0x0f948, 0x0f949, 0x0f94a, 0x0f94b, 0x0f94c, 0x0f94d, 0x0f94e, 0x0f94f,
+ 0x0f950, 0x0f951, 0x0f952, 0x0f953, 0x0f954, 0x0f955, 0x0f956, 0x0f957,
+ 0x0f958, 0x0f959, 0x0f95a, 0x0f95b, 0x0f914, 0x0f95d, 0x0f95e, 0x0f95f,
+ 0x0f960, 0x0f961, 0x0f962, 0x0f963, 0x0f964, 0x0f965, 0x0f966, 0x0f967,
+ 0x0f968, 0x0f969, 0x0f96a, 0x0f96b, 0x0f96c, 0x0f96d, 0x0f96e, 0x0f96f,
+ 0x0f970, 0x02fa0, 0x0f972, 0x0f973, 0x0f974, 0x0f975, 0x0f976, 0x0f977,
+ 0x0f978, 0x0f979, 0x0f97a, 0x0f97b, 0x0f97c, 0x0f97d, 0x0f97e, 0x0f97f,
+ 0x0f980, 0x02f25, 0x0f982, 0x0f983, 0x0f984, 0x0f985, 0x0f986, 0x0f987,
+ 0x0f988, 0x0f989, 0x02f12, 0x0f98b, 0x0f98c, 0x0f98d, 0x0f98e, 0x0f98f,
+ 0x0f990, 0x0f991, 0x0f992, 0x0f993, 0x0f994, 0x0f995, 0x0f996, 0x0f997,
+ 0x0f998, 0x0f999, 0x0f99a, 0x0f99b, 0x0f99c, 0x0f99d, 0x0f99e, 0x0f99f,
+ 0x0f9a0, 0x0f96f, 0x0f9a2, 0x0f9a3, 0x0f9a4, 0x0f9a5, 0x0f9a6, 0x0f9a7,
+ 0x0f9a8, 0x0f9a9, 0x0f95f, 0x0f9ab, 0x0f9ac, 0x0f9ad, 0x0f9ae, 0x0f9af,
+ 0x0f9b0, 0x0f9b1, 0x0f9b2, 0x0f9b3, 0x0f9b4, 0x0f9b5, 0x0f9b6, 0x0f9b7,
+ 0x0f9b8, 0x0f9b9, 0x0f9ba, 0x0f9bb, 0x0f9bc, 0x0f9bd, 0x0f9be, 0x0f914,
+ 0x0f9c0, 0x0f9c1, 0x0f9c2, 0x0f9c3, 0x02eef, 0x0f9c5, 0x0f9c6, 0x0f9c7,
+ 0x0f9c8, 0x0f9c9, 0x0f9ca, 0x0f9cb, 0x0f9cc, 0x0f9cd, 0x0f9ce, 0x0f9cf,
+ 0x0f9d0, 0x03285, 0x0f9d2, 0x0f9d3, 0x0f9d4, 0x0f9d5, 0x0f9d6, 0x0f9d7,
+ 0x0f9d8, 0x0f9d9, 0x0f9da, 0x0f961, 0x0f9dc, 0x0f9dd, 0x0f9de, 0x0f9df,
+ 0x0f9e0, 0x0f9e1, 0x0f9e2, 0x0f9e3, 0x0f9e4, 0x0f9e5, 0x0f9e6, 0x0f9e7,
+ 0x0f9e8, 0x02fa5, 0x0f9ea, 0x0f9eb, 0x0f9ec, 0x0f9ed, 0x0f9ee, 0x0f9ef,
+ 0x0f9f0, 0x0f9f1, 0x0f9f2, 0x0f9f3, 0x0f9f4, 0x0f9f5, 0x0f9f6, 0x02f74,
+ 0x0f9f8, 0x0f9f9, 0x0f9fa, 0x0f9fb, 0x0f9fc, 0x0f9fd, 0x0f9fe, 0x0f9ff
+};
+
+static uint32_t unicode_520_ci_page_fa[] = {
+ 0x0fa00, 0x0fa01, 0x0fa02, 0x0fa03, 0x0fa04, 0x0fa05, 0x0fa06, 0x0fa07,
+ 0x02f8f, 0x0fa09, 0x02f92, 0x0fa0b, 0x0fa0c, 0x0fa0d, 0x0fa0e, 0x0fa0f,
+ 0x0fa10, 0x0fa11, 0x0fa12, 0x0fa13, 0x0fa14, 0x0fa15, 0x0fa16, 0x0fa17,
+ 0x0fa18, 0x0fa19, 0x0fa1a, 0x0fa1b, 0x0fa1c, 0x0fa1d, 0x02f7b, 0x0fa1f,
+ 0x0fa20, 0x0fa21, 0x0fa22, 0x0fa23, 0x0fa24, 0x0fa25, 0x0fa26, 0x0fa27,
+ 0x0fa28, 0x0fa29, 0x0fa2a, 0x0fa2b, 0x0fa2c, 0x0fa2d, 0x0fa2e, 0x0fa2f,
+ 0x0fa30, 0x0fa31, 0x0fa32, 0x0fa33, 0x0fa34, 0x0fa35, 0x0fa36, 0x0fa37,
+ 0x0fa38, 0x0fa39, 0x0fa3a, 0x0fa3b, 0x02f2c, 0x0fa3d, 0x0fa3e, 0x0fa3f,
+ 0x0fa40, 0x0fa41, 0x0fa42, 0x0fa43, 0x0fa44, 0x0fa45, 0x0fa46, 0x0fa47,
+ 0x0fa48, 0x02ea4, 0x0fa4a, 0x0fa4b, 0x03293, 0x0fa4d, 0x0fa4e, 0x0fa4f,
+ 0x0fa50, 0x03297, 0x0fa52, 0x0fa53, 0x0fa54, 0x0fa55, 0x0fa56, 0x0f996,
+ 0x0fa58, 0x0fa59, 0x0fa5a, 0x0fa5b, 0x0fa5c, 0x02ebe, 0x02ebe, 0x0fa5f,
+ 0x0fa60, 0x0fa61, 0x0fa62, 0x0fa63, 0x0fa64, 0x0fa65, 0x02ecc, 0x0fa25,
+ 0x0fa68, 0x0fa69, 0x0fa6a, 0x0fa6b, 0x0fa6c, 0x0fa6d, 0x0fa6e, 0x0fa6f,
+ 0x0fa70, 0x0fa71, 0x0fa72, 0x0fa73, 0x0fa74, 0x0fa75, 0x0fa76, 0x0fa77,
+ 0x0fa36, 0x0fa79, 0x0fa7a, 0x0fa7b, 0x0fa10, 0x0fa7d, 0x0fa7e, 0x0fa7f,
+ 0x0fa80, 0x0fa81, 0x0fa82, 0x0fa83, 0x0fa84, 0x0fa85, 0x0fa86, 0x0fa87,
+ 0x0fa88, 0x0fa3f, 0x0fa8a, 0x0fa40, 0x0fa8c, 0x0fa8d, 0x0fa8e, 0x0fa8f,
+ 0x0fa90, 0x0fa12, 0x0f929, 0x0fa93, 0x0fa94, 0x02f4d, 0x0f970, 0x0f9ca,
+ 0x0fa98, 0x0fa99, 0x0fa47, 0x0fa9b, 0x0fa48, 0x0fa9d, 0x0fa9e, 0x0fa9f,
+ 0x0fa16, 0x0faa1, 0x0faa2, 0x0faa3, 0x0faa4, 0x0faa5, 0x0fa17, 0x0faa7,
+ 0x0faa8, 0x0faa9, 0x0faaa, 0x0faab, 0x0faac, 0x0fa56, 0x0faae, 0x0faaf,
+ 0x0f996, 0x0fab1, 0x0fa5b, 0x0fab3, 0x0fab4, 0x0fab5, 0x0fab6, 0x0fab7,
+ 0x0fa61, 0x0fab9, 0x0fa22, 0x0fabb, 0x0fa62, 0x0f95d, 0x0fabe, 0x0fa63,
+ 0x0fac0, 0x0fa65, 0x0fac2, 0x0fac3, 0x0fac4, 0x0fac5, 0x0fac6, 0x0fa68,
+ 0x0fa1c, 0x0fac9, 0x0fa69, 0x0facb, 0x0fa6a, 0x0facd, 0x02ef2, 0x0facf,
+ 0x0fad0, 0x0fad1, 0x0fad2, 0x0fad3, 0x0fad4, 0x0fad5, 0x0fad6, 0x0fad7,
+ 0x0fad8, 0x0fad9, 0x0fada, 0x0fadb, 0x0fadc, 0x0fadd, 0x0fade, 0x0fadf,
+ 0x0fae0, 0x0fae1, 0x0fae2, 0x0fae3, 0x0fae4, 0x0fae5, 0x0fae6, 0x0fae7,
+ 0x0fae8, 0x0fae9, 0x0faea, 0x0faeb, 0x0faec, 0x0faed, 0x0faee, 0x0faef,
+ 0x0faf0, 0x0faf1, 0x0faf2, 0x0faf3, 0x0faf4, 0x0faf5, 0x0faf6, 0x0faf7,
+ 0x0faf8, 0x0faf9, 0x0fafa, 0x0fafb, 0x0fafc, 0x0fafd, 0x0fafe, 0x0faff
+};
+
+static uint32_t unicode_520_ci_page_fb[] = {
+ 0x0fb00, 0x0fb01, 0x0fb02, 0x0fb03, 0x0fb04, 0x0fb05, 0x0fb05, 0x0fb07,
+ 0x0fb08, 0x0fb09, 0x0fb0a, 0x0fb0b, 0x0fb0c, 0x0fb0d, 0x0fb0e, 0x0fb0f,
+ 0x0fb10, 0x0fb11, 0x0fb12, 0x0fb13, 0x0fb14, 0x0fb15, 0x0fb16, 0x0fb17,
+ 0x0fb18, 0x0fb19, 0x0fb1a, 0x0fb1b, 0x0fb1c, 0x005d9, 0x00000, 0x005f2,
+ 0x005e2, 0x005d0, 0x005d3, 0x005d4, 0x005da, 0x005dc, 0x005dd, 0x005e8,
+ 0x005ea, 0x0002b, 0x005e9, 0x005e9, 0x005e9, 0x005e9, 0x005d0, 0x005d0,
+ 0x005d0, 0x005d1, 0x005d2, 0x005d3, 0x005d4, 0x005d5, 0x005d6, 0x0fb37,
+ 0x005d8, 0x005d9, 0x005da, 0x005da, 0x005dc, 0x0fb3d, 0x005dd, 0x0fb3f,
+ 0x005df, 0x005e1, 0x0fb42, 0x005e3, 0x005e3, 0x0fb45, 0x005e5, 0x005e7,
+ 0x005e8, 0x005e9, 0x005ea, 0x005d5, 0x005d1, 0x005da, 0x005e3, 0x0fb4f,
+ 0x00671, 0x00671, 0x0067b, 0x0067b, 0x0067b, 0x0067b, 0x0067e, 0x0067e,
+ 0x0067e, 0x0067e, 0x00680, 0x00680, 0x00680, 0x00680, 0x0067a, 0x0067a,
+ 0x0067a, 0x0067a, 0x0067f, 0x0067f, 0x0067f, 0x0067f, 0x00679, 0x00679,
+ 0x00679, 0x00679, 0x006a4, 0x006a4, 0x006a4, 0x006a4, 0x006a6, 0x006a6,
+ 0x006a6, 0x006a6, 0x00684, 0x00684, 0x00684, 0x00684, 0x00683, 0x00683,
+ 0x00683, 0x00683, 0x00686, 0x00686, 0x00686, 0x00686, 0x00687, 0x00687,
+ 0x00687, 0x00687, 0x0068d, 0x0068d, 0x0068c, 0x0068c, 0x0068e, 0x0068e,
+ 0x00688, 0x00688, 0x00698, 0x00698, 0x00691, 0x00691, 0x006a9, 0x006a9,
+ 0x006a9, 0x006a9, 0x006af, 0x006af, 0x006af, 0x006af, 0x006b3, 0x006b3,
+ 0x006b3, 0x006b3, 0x006b1, 0x006b1, 0x006b1, 0x006b1, 0x006ba, 0x006ba,
+ 0x006bb, 0x006bb, 0x006bb, 0x006bb, 0x006c0, 0x006c0, 0x006c1, 0x006c1,
+ 0x006c1, 0x006c1, 0x006be, 0x006be, 0x006be, 0x006be, 0x006d2, 0x006d2,
+ 0x006d2, 0x006d2, 0x0fbb2, 0x0fbb3, 0x0fbb4, 0x0fbb5, 0x0fbb6, 0x0fbb7,
+ 0x0fbb8, 0x0fbb9, 0x0fbba, 0x0fbbb, 0x0fbbc, 0x0fbbd, 0x0fbbe, 0x0fbbf,
+ 0x0fbc0, 0x0fbc1, 0x0fbc2, 0x0fbc3, 0x0fbc4, 0x0fbc5, 0x0fbc6, 0x0fbc7,
+ 0x0fbc8, 0x0fbc9, 0x0fbca, 0x0fbcb, 0x0fbcc, 0x0fbcd, 0x0fbce, 0x0fbcf,
+ 0x0fbd0, 0x0fbd1, 0x0fbd2, 0x006ad, 0x006ad, 0x006ad, 0x006ad, 0x006c7,
+ 0x006c7, 0x006c6, 0x006c6, 0x006c8, 0x006c8, 0x00677, 0x006cb, 0x006cb,
+ 0x006c5, 0x006c5, 0x006c9, 0x006c9, 0x006d0, 0x006d0, 0x006d0, 0x006d0,
+ 0x00649, 0x00649, 0x0fbea, 0x0fbea, 0x0fbec, 0x0fbec, 0x0fbee, 0x0fbee,
+ 0x0fbf0, 0x0fbf0, 0x0fbf2, 0x0fbf2, 0x0fbf4, 0x0fbf4, 0x0fbf6, 0x0fbf6,
+ 0x0fbf6, 0x0fbf9, 0x0fbf9, 0x0fbf9, 0x006cc, 0x006cc, 0x0fbfe, 0x0fbff
+};
+
+static uint32_t unicode_520_ci_page_fc[] = {
+ 0x0fc00, 0x0fc01, 0x0fc02, 0x0fbf9, 0x0fc04, 0x0fc05, 0x0fc06, 0x0fc07,
+ 0x0fc08, 0x0fc09, 0x0fc0a, 0x0fc0b, 0x0fc0c, 0x0fc0d, 0x0fc0e, 0x0fc0f,
+ 0x0fc10, 0x0fc11, 0x0fc12, 0x0fc13, 0x0fc14, 0x0fc15, 0x0fc16, 0x0fc17,
+ 0x0fc18, 0x0fc19, 0x0fc1a, 0x0fc1b, 0x0fc1c, 0x0fc1d, 0x0fc1e, 0x0fc1f,
+ 0x0fc20, 0x0fc21, 0x0fc22, 0x0fc23, 0x0fc24, 0x0fc25, 0x0fc26, 0x0fc27,
+ 0x0fc28, 0x0fc29, 0x0fc2a, 0x0fc2b, 0x0fc2c, 0x0fc2d, 0x0fc2e, 0x0fc2f,
+ 0x0fc30, 0x0fc31, 0x0fc32, 0x0fc33, 0x0fc34, 0x0fc35, 0x0fc36, 0x0fc37,
+ 0x0fc38, 0x0fc39, 0x0fc3a, 0x0fc3b, 0x0fc3c, 0x0fc3d, 0x0fc3e, 0x0fc3f,
+ 0x0fc40, 0x0fc41, 0x0fc42, 0x0fc43, 0x0fc44, 0x0fc45, 0x0fc46, 0x0fc47,
+ 0x0fc48, 0x0fc49, 0x0fc4a, 0x0fc4b, 0x0fc4c, 0x0fc4d, 0x0fc4e, 0x0fc4f,
+ 0x0fc50, 0x0fc51, 0x0fc52, 0x0fc53, 0x0fc54, 0x0fc55, 0x0fc56, 0x0fc57,
+ 0x0fc58, 0x0fc59, 0x0fc5a, 0x00630, 0x00631, 0x00649, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x0fc64, 0x0fc65, 0x0fc02, 0x0fc67,
+ 0x0fbf9, 0x0fc04, 0x0fc6a, 0x0fc6b, 0x0fc08, 0x0fc6d, 0x0fc09, 0x0fc0a,
+ 0x0fc70, 0x0fc71, 0x0fc0e, 0x0fc73, 0x0fc0f, 0x0fc10, 0x0fc76, 0x0fc77,
+ 0x0fc12, 0x0fc79, 0x0fc13, 0x0fc14, 0x0fc31, 0x0fc32, 0x0fc35, 0x0fc36,
+ 0x0fc37, 0x0fc3b, 0x0fc3c, 0x0fc3d, 0x0fc3e, 0x0fc42, 0x0fc43, 0x0fc44,
+ 0x0fc88, 0x0fc48, 0x0fc8a, 0x0fc8b, 0x0fc4e, 0x0fc8d, 0x0fc4f, 0x0fc50,
+ 0x00649, 0x0fc91, 0x0fc92, 0x0fc58, 0x0fc94, 0x0fc59, 0x0fc5a, 0x0fc00,
+ 0x0fc01, 0x0fc99, 0x0fc02, 0x0fc9b, 0x0fc05, 0x0fc06, 0x0fc07, 0x0fc08,
+ 0x0fca0, 0x0fc0b, 0x0fc0c, 0x0fc0d, 0x0fc0e, 0x0fca5, 0x0fc12, 0x0fc15,
+ 0x0fc16, 0x0fc17, 0x0fc18, 0x0fc19, 0x0fc1b, 0x0fc1c, 0x0fc1d, 0x0fc1e,
+ 0x0fc1f, 0x0fc20, 0x0fcb2, 0x0fc21, 0x0fc22, 0x0fc23, 0x0fc24, 0x0fc25,
+ 0x0fc26, 0x0fc28, 0x0fc29, 0x0fc2a, 0x0fc2b, 0x0fc2c, 0x0fc2d, 0x0fc2e,
+ 0x0fc2f, 0x0fc30, 0x0fc33, 0x0fc34, 0x0fc38, 0x0fc39, 0x0fc3a, 0x0fc3b,
+ 0x0fc3c, 0x0fc3f, 0x0fc40, 0x0fc41, 0x0fc42, 0x0fccd, 0x0fc45, 0x0fc46,
+ 0x0fc47, 0x0fc48, 0x0fc4b, 0x0fc4c, 0x0fc4d, 0x0fc4e, 0x0fcd6, 0x0fc51,
+ 0x0fc52, 0x00647, 0x0fc55, 0x0fc56, 0x0fc57, 0x0fc58, 0x0fcde, 0x0fc02,
+ 0x0fc9b, 0x0fc08, 0x0fca0, 0x0fc0e, 0x0fca5, 0x0fc12, 0x0fce6, 0x0fc1f,
+ 0x0fce8, 0x0fce9, 0x0fcea, 0x0fc3b, 0x0fc3c, 0x0fc42, 0x0fc4e, 0x0fcd6,
+ 0x0fc58, 0x0fcde, 0x00000, 0x00000, 0x00000, 0x0fcf5, 0x0fcf6, 0x0fcf7,
+ 0x0fcf8, 0x0fcf9, 0x0fcfa, 0x0fcfb, 0x0fcfc, 0x0fcfd, 0x0fcfe, 0x0fcff
+};
+
+static uint32_t unicode_520_ci_page_fd[] = {
+ 0x0fd00, 0x0fd01, 0x0fd02, 0x0fd03, 0x0fd04, 0x0fd05, 0x0fd06, 0x0fd07,
+ 0x0fd08, 0x0fd09, 0x0fd0a, 0x0fd0b, 0x0fce9, 0x0fd0d, 0x0fd0e, 0x0fd0f,
+ 0x0fd10, 0x0fcf5, 0x0fcf6, 0x0fcf7, 0x0fcf8, 0x0fcf9, 0x0fcfa, 0x0fcfb,
+ 0x0fcfc, 0x0fcfd, 0x0fcfe, 0x0fd1b, 0x0fd00, 0x0fd01, 0x0fd02, 0x0fd03,
+ 0x0fd04, 0x0fd05, 0x0fd06, 0x0fd07, 0x0fd08, 0x0fd09, 0x0fd0a, 0x0fd0b,
+ 0x0fce9, 0x0fd0d, 0x0fd0e, 0x0fd0f, 0x0fd10, 0x0fd09, 0x0fd0a, 0x0fd0b,
+ 0x0fce9, 0x0fce8, 0x0fcea, 0x0fc27, 0x0fc1c, 0x0fc1d, 0x0fc1e, 0x0fd09,
+ 0x0fd0a, 0x0fd0b, 0x0fc27, 0x0fc28, 0x00627, 0x00627, 0x0fd3e, 0x0fd3f,
+ 0x0fd40, 0x0fd41, 0x0fd42, 0x0fd43, 0x0fd44, 0x0fd45, 0x0fd46, 0x0fd47,
+ 0x0fd48, 0x0fd49, 0x0fd4a, 0x0fd4b, 0x0fd4c, 0x0fd4d, 0x0fd4e, 0x0fd4f,
+ 0x0fd50, 0x0fd51, 0x0fd51, 0x0fd53, 0x0fd54, 0x0fd55, 0x0fd56, 0x0fd57,
+ 0x0fd58, 0x0fd58, 0x0fd5a, 0x0fd5b, 0x0fd5c, 0x0fd5d, 0x0fd5e, 0x0fd5f,
+ 0x0fd5f, 0x0fd61, 0x0fd62, 0x0fd62, 0x0fd64, 0x0fd64, 0x0fd66, 0x0fd67,
+ 0x0fd67, 0x0fd69, 0x0fd6a, 0x0fd6a, 0x0fd6c, 0x0fd6c, 0x0fd6e, 0x0fd6f,
+ 0x0fd6f, 0x0fd71, 0x0fd71, 0x0fd73, 0x0fd74, 0x0fd75, 0x0fd76, 0x0fd76,
+ 0x0fd78, 0x0fd79, 0x0fd7a, 0x0fd7b, 0x0fd7c, 0x0fd7c, 0x0fd7e, 0x0fd7f,
+ 0x0fd80, 0x0fd81, 0x0fd82, 0x0fd83, 0x0fd83, 0x0fd85, 0x0fd85, 0x0fd87,
+ 0x0fd87, 0x0fd89, 0x0fd8a, 0x0fd8b, 0x0fd8c, 0x0fd8d, 0x0fd8e, 0x0fd8f,
+ 0x0fd90, 0x0fd91, 0x0fd92, 0x0fd93, 0x0fd94, 0x0fd95, 0x0fd96, 0x0fd97,
+ 0x0fd97, 0x0fd99, 0x0fd9a, 0x0fd9b, 0x0fd9c, 0x0fd9c, 0x0fd9e, 0x0fd9f,
+ 0x0fda0, 0x0fda1, 0x0fda2, 0x0fda3, 0x0fda4, 0x0fda5, 0x0fda6, 0x0fda7,
+ 0x0fda8, 0x0fda9, 0x0fdaa, 0x0fdab, 0x0fdac, 0x0fdad, 0x0fdae, 0x0fdaf,
+ 0x0fdb0, 0x0fdb1, 0x0fdb2, 0x0fdb3, 0x0fd7e, 0x0fd80, 0x0fdb6, 0x0fdb7,
+ 0x0fdb8, 0x0fdb9, 0x0fdba, 0x0fdbb, 0x0fdba, 0x0fdb8, 0x0fdbe, 0x0fdbf,
+ 0x0fdc0, 0x0fdc1, 0x0fdc2, 0x0fdbb, 0x0fd75, 0x0fd66, 0x0fdc6, 0x0fdc7,
+ 0x0fdc8, 0x0fdc9, 0x0fdca, 0x0fdcb, 0x0fdcc, 0x0fdcd, 0x0fdce, 0x0fdcf,
+ 0x0fdd0, 0x0fdd1, 0x0fdd2, 0x0fdd3, 0x0fdd4, 0x0fdd5, 0x0fdd6, 0x0fdd7,
+ 0x0fdd8, 0x0fdd9, 0x0fdda, 0x0fddb, 0x0fddc, 0x0fddd, 0x0fdde, 0x0fddf,
+ 0x0fde0, 0x0fde1, 0x0fde2, 0x0fde3, 0x0fde4, 0x0fde5, 0x0fde6, 0x0fde7,
+ 0x0fde8, 0x0fde9, 0x0fdea, 0x0fdeb, 0x0fdec, 0x0fded, 0x0fdee, 0x0fdef,
+ 0x0fdf0, 0x0fdf1, 0x0fdf2, 0x0fdf3, 0x0fdf4, 0x0fdf5, 0x0fdf6, 0x0fdf7,
+ 0x0fdf8, 0x0fdf9, 0x0fdfa, 0x0fdfb, 0x0fdfc, 0x0fdfd, 0x0fdfe, 0x0fdff
+};
+
+static uint32_t unicode_520_ci_page_fe[] = {
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x0002c, 0x03001, 0x03002, 0x0003a, 0x0003b, 0x00021, 0x0003f, 0x03016,
+ 0x03017, 0x02026, 0x0fe1a, 0x0fe1b, 0x0fe1c, 0x0fe1d, 0x0fe1e, 0x0fe1f,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x0fe27,
+ 0x0fe28, 0x0fe29, 0x0fe2a, 0x0fe2b, 0x0fe2c, 0x0fe2d, 0x0fe2e, 0x0fe2f,
+ 0x02025, 0x02014, 0x02013, 0x0005f, 0x0005f, 0x00028, 0x00029, 0x0007b,
+ 0x0007d, 0x03014, 0x03015, 0x03010, 0x03011, 0x0300a, 0x0300b, 0x02329,
+ 0x0232a, 0x0300c, 0x0300d, 0x0300e, 0x0300f, 0x0fe45, 0x0fe46, 0x0005b,
+ 0x0005d, 0x0203e, 0x0203e, 0x0203e, 0x0203e, 0x0005f, 0x0005f, 0x0005f,
+ 0x0002c, 0x03001, 0x0002e, 0x0fe53, 0x0003b, 0x0003a, 0x0003f, 0x00021,
+ 0x02014, 0x00028, 0x00029, 0x0007b, 0x0007d, 0x03014, 0x03015, 0x00023,
+ 0x00026, 0x0002a, 0x0002b, 0x0002d, 0x0003c, 0x0003e, 0x0003d, 0x0fe67,
+ 0x0005c, 0x00024, 0x00025, 0x00040, 0x0fe6c, 0x0fe6d, 0x0fe6e, 0x0fe6f,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x0fe75, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00621, 0x00622, 0x00622, 0x00623, 0x00623, 0x00624, 0x00624, 0x00625,
+ 0x00625, 0x00626, 0x00626, 0x00626, 0x00626, 0x00627, 0x00627, 0x00628,
+ 0x00628, 0x00628, 0x00628, 0x00629, 0x00629, 0x0062a, 0x0062a, 0x0062a,
+ 0x0062a, 0x0062b, 0x0062b, 0x0062b, 0x0062b, 0x0062c, 0x0062c, 0x0062c,
+ 0x0062c, 0x0062d, 0x0062d, 0x0062d, 0x0062d, 0x0062e, 0x0062e, 0x0062e,
+ 0x0062e, 0x0062f, 0x0062f, 0x00630, 0x00630, 0x00631, 0x00631, 0x00632,
+ 0x00632, 0x00633, 0x00633, 0x00633, 0x00633, 0x00634, 0x00634, 0x00634,
+ 0x00634, 0x00635, 0x00635, 0x00635, 0x00635, 0x00636, 0x00636, 0x00636,
+ 0x00636, 0x00637, 0x00637, 0x00637, 0x00637, 0x00638, 0x00638, 0x00638,
+ 0x00638, 0x00639, 0x00639, 0x00639, 0x00639, 0x0063a, 0x0063a, 0x0063a,
+ 0x0063a, 0x00641, 0x00641, 0x00641, 0x00641, 0x00642, 0x00642, 0x00642,
+ 0x00642, 0x00643, 0x00643, 0x00643, 0x00643, 0x00644, 0x00644, 0x00644,
+ 0x00644, 0x00645, 0x00645, 0x00645, 0x00645, 0x00646, 0x00646, 0x00646,
+ 0x00646, 0x00647, 0x00647, 0x00647, 0x00647, 0x00648, 0x00648, 0x00649,
+ 0x00649, 0x0064a, 0x0064a, 0x0064a, 0x0064a, 0x0fef5, 0x0fef5, 0x0fef7,
+ 0x0fef7, 0x0fef9, 0x0fef9, 0x0fefb, 0x0fefb, 0x0fefd, 0x0fefe, 0x0feff
+};
+
+static uint32_t unicode_520_ci_page_ff[] = {
+ 0x0ff00, 0x00021, 0x00022, 0x00023, 0x00024, 0x00025, 0x00026, 0x00027,
+ 0x00028, 0x00029, 0x0002a, 0x0002b, 0x0002c, 0x0002d, 0x0002e, 0x0002f,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x0003a, 0x0003b, 0x0003c, 0x0003d, 0x0003e, 0x0003f,
+ 0x00040, 0x00041, 0x00042, 0x00043, 0x00044, 0x00045, 0x00046, 0x00047,
+ 0x00048, 0x00049, 0x0004a, 0x0004b, 0x0004c, 0x0004d, 0x0004e, 0x0004f,
+ 0x00050, 0x00051, 0x00052, 0x00053, 0x00054, 0x00055, 0x00056, 0x00057,
+ 0x00058, 0x00059, 0x0005a, 0x0005b, 0x0005c, 0x0005d, 0x0005e, 0x0005f,
+ 0x00060, 0x00041, 0x00042, 0x00043, 0x00044, 0x00045, 0x00046, 0x00047,
+ 0x00048, 0x00049, 0x0004a, 0x0004b, 0x0004c, 0x0004d, 0x0004e, 0x0004f,
+ 0x00050, 0x00051, 0x00052, 0x00053, 0x00054, 0x00055, 0x00056, 0x00057,
+ 0x00058, 0x00059, 0x0005a, 0x0007b, 0x0007c, 0x0007d, 0x0007e, 0x02985,
+ 0x02986, 0x03002, 0x0300c, 0x0300d, 0x03001, 0x030fb, 0x03092, 0x03042,
+ 0x03044, 0x03046, 0x03048, 0x0304a, 0x03084, 0x03086, 0x03088, 0x03064,
+ 0x030fc, 0x03042, 0x03044, 0x03046, 0x03048, 0x0304a, 0x0304b, 0x0304d,
+ 0x0304f, 0x03051, 0x03053, 0x03055, 0x03057, 0x03059, 0x0305b, 0x0305d,
+ 0x0305f, 0x03061, 0x03064, 0x03066, 0x03068, 0x0306a, 0x0306b, 0x0306c,
+ 0x0306d, 0x0306e, 0x0306f, 0x03072, 0x03075, 0x03078, 0x0307b, 0x0307e,
+ 0x0307f, 0x03080, 0x03081, 0x03082, 0x03084, 0x03086, 0x03088, 0x03089,
+ 0x0308a, 0x0308b, 0x0308c, 0x0308d, 0x0308f, 0x03093, 0x00000, 0x00000,
+ 0x01160, 0x01100, 0x01101, 0x011aa, 0x01102, 0x011ac, 0x011ad, 0x01103,
+ 0x01104, 0x01105, 0x011b0, 0x011b1, 0x011b2, 0x011b3, 0x011b4, 0x011b5,
+ 0x0111a, 0x01106, 0x01107, 0x01108, 0x01121, 0x01109, 0x0110a, 0x0110b,
+ 0x0110c, 0x0110d, 0x0110e, 0x0110f, 0x01110, 0x01111, 0x01112, 0x0ffbf,
+ 0x0ffc0, 0x0ffc1, 0x01161, 0x01162, 0x01163, 0x01164, 0x01165, 0x01166,
+ 0x0ffc8, 0x0ffc9, 0x01167, 0x01168, 0x01169, 0x0116a, 0x0116b, 0x0116c,
+ 0x0ffd0, 0x0ffd1, 0x0116d, 0x0116e, 0x0116f, 0x01170, 0x01171, 0x01172,
+ 0x0ffd8, 0x0ffd9, 0x01173, 0x01174, 0x01175, 0x0ffdd, 0x0ffde, 0x0ffdf,
+ 0x000a2, 0x000a3, 0x000ac, 0x000af, 0x000a6, 0x000a5, 0x020a9, 0x0ffe7,
+ 0x02502, 0x02190, 0x02191, 0x02192, 0x02193, 0x025a0, 0x025cb, 0x0ffef,
+ 0x0fff0, 0x0fff1, 0x0fff2, 0x0fff3, 0x0fff4, 0x0fff5, 0x0fff6, 0x0fff7,
+ 0x0fff8, 0x00000, 0x00000, 0x00000, 0x0fffc, 0x0fffd, 0x0fffe, 0x0ffff
+};
+
+static uint32_t unicode_520_ci_page_101[] = {
+ 0x10100, 0x10101, 0x10102, 0x10103, 0x10104, 0x10105, 0x10106, 0x00031,
+ 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037, 0x00038, 0x00039,
+ 0x10110, 0x10111, 0x10112, 0x10113, 0x10114, 0x10115, 0x10116, 0x10117,
+ 0x10118, 0x10119, 0x1011a, 0x1011b, 0x1011c, 0x1011d, 0x1011e, 0x1011f,
+ 0x10120, 0x10121, 0x10122, 0x10123, 0x10124, 0x10125, 0x10126, 0x10127,
+ 0x10128, 0x10129, 0x1012a, 0x1012b, 0x1012c, 0x1012d, 0x1012e, 0x1012f,
+ 0x10130, 0x10131, 0x10132, 0x10133, 0x10134, 0x10135, 0x10136, 0x10137,
+ 0x10138, 0x10139, 0x1013a, 0x1013b, 0x1013c, 0x1013d, 0x1013e, 0x1013f,
+ 0x10140, 0x10141, 0x00031, 0x00035, 0x10144, 0x10145, 0x10146, 0x10147,
+ 0x00035, 0x10149, 0x1014a, 0x1014b, 0x1014c, 0x1014d, 0x1014e, 0x00035,
+ 0x10150, 0x10151, 0x10152, 0x10153, 0x10154, 0x10155, 0x10156, 0x10157,
+ 0x00031, 0x00031, 0x00031, 0x00032, 0x00032, 0x00032, 0x00032, 0x00035,
+ 0x10160, 0x10161, 0x10162, 0x10163, 0x10164, 0x10165, 0x10166, 0x10167,
+ 0x10168, 0x10169, 0x1016a, 0x1016b, 0x1016c, 0x1016d, 0x1016e, 0x1016f,
+ 0x10170, 0x10171, 0x10172, 0x00035, 0x10174, 0x10175, 0x10176, 0x10177,
+ 0x10178, 0x10179, 0x1017a, 0x1017b, 0x1017c, 0x1017d, 0x1017e, 0x1017f,
+ 0x10180, 0x10181, 0x10182, 0x10183, 0x10184, 0x10185, 0x10186, 0x10187,
+ 0x10188, 0x10189, 0x00030, 0x1018b, 0x1018c, 0x1018d, 0x1018e, 0x1018f,
+ 0x10190, 0x10191, 0x10192, 0x10193, 0x10194, 0x10195, 0x10196, 0x10197,
+ 0x10198, 0x10199, 0x1019a, 0x1019b, 0x1019c, 0x1019d, 0x1019e, 0x1019f,
+ 0x101a0, 0x101a1, 0x101a2, 0x101a3, 0x101a4, 0x101a5, 0x101a6, 0x101a7,
+ 0x101a8, 0x101a9, 0x101aa, 0x101ab, 0x101ac, 0x101ad, 0x101ae, 0x101af,
+ 0x101b0, 0x101b1, 0x101b2, 0x101b3, 0x101b4, 0x101b5, 0x101b6, 0x101b7,
+ 0x101b8, 0x101b9, 0x101ba, 0x101bb, 0x101bc, 0x101bd, 0x101be, 0x101bf,
+ 0x101c0, 0x101c1, 0x101c2, 0x101c3, 0x101c4, 0x101c5, 0x101c6, 0x101c7,
+ 0x101c8, 0x101c9, 0x101ca, 0x101cb, 0x101cc, 0x101cd, 0x101ce, 0x101cf,
+ 0x101d0, 0x101d1, 0x101d2, 0x101d3, 0x101d4, 0x101d5, 0x101d6, 0x101d7,
+ 0x101d8, 0x101d9, 0x101da, 0x101db, 0x101dc, 0x101dd, 0x101de, 0x101df,
+ 0x101e0, 0x101e1, 0x101e2, 0x101e3, 0x101e4, 0x101e5, 0x101e6, 0x101e7,
+ 0x101e8, 0x101e9, 0x101ea, 0x101eb, 0x101ec, 0x101ed, 0x101ee, 0x101ef,
+ 0x101f0, 0x101f1, 0x101f2, 0x101f3, 0x101f4, 0x101f5, 0x101f6, 0x101f7,
+ 0x101f8, 0x101f9, 0x101fa, 0x101fb, 0x101fc, 0x00000, 0x101fe, 0x101ff
+};
+
+static uint32_t unicode_520_ci_page_103[] = {
+ 0x10300, 0x10301, 0x10302, 0x10303, 0x10304, 0x10305, 0x10306, 0x10307,
+ 0x10308, 0x10309, 0x1030a, 0x1030b, 0x1030c, 0x1030d, 0x1030e, 0x1030f,
+ 0x10310, 0x10311, 0x10312, 0x10313, 0x10314, 0x10315, 0x10316, 0x10317,
+ 0x10318, 0x10319, 0x1031a, 0x1031b, 0x1031c, 0x1031d, 0x1031e, 0x1031f,
+ 0x00031, 0x00035, 0x10322, 0x10323, 0x10324, 0x10325, 0x10326, 0x10327,
+ 0x10328, 0x10329, 0x1032a, 0x1032b, 0x1032c, 0x1032d, 0x1032e, 0x1032f,
+ 0x10330, 0x10331, 0x10332, 0x10333, 0x10334, 0x10335, 0x10336, 0x10337,
+ 0x10338, 0x10339, 0x1033a, 0x1033b, 0x1033c, 0x1033d, 0x1033e, 0x1033f,
+ 0x10340, 0x10341, 0x10342, 0x10343, 0x10344, 0x10345, 0x10346, 0x10347,
+ 0x10348, 0x10349, 0x1034a, 0x1034b, 0x1034c, 0x1034d, 0x1034e, 0x1034f,
+ 0x10350, 0x10351, 0x10352, 0x10353, 0x10354, 0x10355, 0x10356, 0x10357,
+ 0x10358, 0x10359, 0x1035a, 0x1035b, 0x1035c, 0x1035d, 0x1035e, 0x1035f,
+ 0x10360, 0x10361, 0x10362, 0x10363, 0x10364, 0x10365, 0x10366, 0x10367,
+ 0x10368, 0x10369, 0x1036a, 0x1036b, 0x1036c, 0x1036d, 0x1036e, 0x1036f,
+ 0x10370, 0x10371, 0x10372, 0x10373, 0x10374, 0x10375, 0x10376, 0x10377,
+ 0x10378, 0x10379, 0x1037a, 0x1037b, 0x1037c, 0x1037d, 0x1037e, 0x1037f,
+ 0x10380, 0x10381, 0x10382, 0x10383, 0x10384, 0x10385, 0x10386, 0x10387,
+ 0x10388, 0x10389, 0x1038a, 0x1038b, 0x1038c, 0x1038d, 0x1038e, 0x1038f,
+ 0x10390, 0x10391, 0x10392, 0x10393, 0x10394, 0x10395, 0x10396, 0x10397,
+ 0x10398, 0x10399, 0x1039a, 0x1039b, 0x1039c, 0x1039d, 0x1039e, 0x1039f,
+ 0x103a0, 0x103a1, 0x103a2, 0x103a3, 0x103a4, 0x103a5, 0x103a6, 0x103a7,
+ 0x103a8, 0x103a9, 0x103aa, 0x103ab, 0x103ac, 0x103ad, 0x103ae, 0x103af,
+ 0x103b0, 0x103b1, 0x103b2, 0x103b3, 0x103b4, 0x103b5, 0x103b6, 0x103b7,
+ 0x103b8, 0x103b9, 0x103ba, 0x103bb, 0x103bc, 0x103bd, 0x103be, 0x103bf,
+ 0x103c0, 0x103c1, 0x103c2, 0x103c3, 0x103c4, 0x103c5, 0x103c6, 0x103c7,
+ 0x103c8, 0x103c9, 0x103ca, 0x103cb, 0x103cc, 0x103cd, 0x103ce, 0x103cf,
+ 0x103d0, 0x00031, 0x00032, 0x103d3, 0x103d4, 0x103d5, 0x103d6, 0x103d7,
+ 0x103d8, 0x103d9, 0x103da, 0x103db, 0x103dc, 0x103dd, 0x103de, 0x103df,
+ 0x103e0, 0x103e1, 0x103e2, 0x103e3, 0x103e4, 0x103e5, 0x103e6, 0x103e7,
+ 0x103e8, 0x103e9, 0x103ea, 0x103eb, 0x103ec, 0x103ed, 0x103ee, 0x103ef,
+ 0x103f0, 0x103f1, 0x103f2, 0x103f3, 0x103f4, 0x103f5, 0x103f6, 0x103f7,
+ 0x103f8, 0x103f9, 0x103fa, 0x103fb, 0x103fc, 0x103fd, 0x103fe, 0x103ff
+};
+
+static uint32_t unicode_520_ci_page_104[] = {
+ 0x10400, 0x10401, 0x10402, 0x10403, 0x10404, 0x10405, 0x10406, 0x10407,
+ 0x10408, 0x10409, 0x1040a, 0x1040b, 0x1040c, 0x1040d, 0x1040e, 0x1040f,
+ 0x10410, 0x10411, 0x10412, 0x10413, 0x10414, 0x10415, 0x10416, 0x10417,
+ 0x10418, 0x10419, 0x1041a, 0x1041b, 0x1041c, 0x1041d, 0x1041e, 0x1041f,
+ 0x10420, 0x10421, 0x10422, 0x10423, 0x10424, 0x10425, 0x10426, 0x10427,
+ 0x10400, 0x10401, 0x10402, 0x10403, 0x10404, 0x10405, 0x10406, 0x10407,
+ 0x10408, 0x10409, 0x1040a, 0x1040b, 0x1040c, 0x1040d, 0x1040e, 0x1040f,
+ 0x10410, 0x10411, 0x10412, 0x10413, 0x10414, 0x10415, 0x10416, 0x10417,
+ 0x10418, 0x10419, 0x1041a, 0x1041b, 0x1041c, 0x1041d, 0x1041e, 0x1041f,
+ 0x10420, 0x10421, 0x10422, 0x10423, 0x10424, 0x10425, 0x10426, 0x10427,
+ 0x10450, 0x10451, 0x10452, 0x10453, 0x10454, 0x10455, 0x10456, 0x10457,
+ 0x10458, 0x10459, 0x1045a, 0x1045b, 0x1045c, 0x1045d, 0x1045e, 0x1045f,
+ 0x10460, 0x10461, 0x10462, 0x10463, 0x10464, 0x10465, 0x10466, 0x10467,
+ 0x10468, 0x10469, 0x1046a, 0x1046b, 0x1046c, 0x1046d, 0x1046e, 0x1046f,
+ 0x10470, 0x10471, 0x10472, 0x10473, 0x10474, 0x10475, 0x10476, 0x10477,
+ 0x10478, 0x10479, 0x1047a, 0x1047b, 0x1047c, 0x1047d, 0x1047e, 0x1047f,
+ 0x10480, 0x10481, 0x10482, 0x10483, 0x10484, 0x10485, 0x10486, 0x10487,
+ 0x10488, 0x10489, 0x1048a, 0x1048b, 0x1048c, 0x1048d, 0x1048e, 0x1048f,
+ 0x10490, 0x10491, 0x10492, 0x10493, 0x10494, 0x10495, 0x10496, 0x10497,
+ 0x10498, 0x10499, 0x1049a, 0x1049b, 0x1049c, 0x1049d, 0x1049e, 0x1049f,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x104aa, 0x104ab, 0x104ac, 0x104ad, 0x104ae, 0x104af,
+ 0x104b0, 0x104b1, 0x104b2, 0x104b3, 0x104b4, 0x104b5, 0x104b6, 0x104b7,
+ 0x104b8, 0x104b9, 0x104ba, 0x104bb, 0x104bc, 0x104bd, 0x104be, 0x104bf,
+ 0x104c0, 0x104c1, 0x104c2, 0x104c3, 0x104c4, 0x104c5, 0x104c6, 0x104c7,
+ 0x104c8, 0x104c9, 0x104ca, 0x104cb, 0x104cc, 0x104cd, 0x104ce, 0x104cf,
+ 0x104d0, 0x104d1, 0x104d2, 0x104d3, 0x104d4, 0x104d5, 0x104d6, 0x104d7,
+ 0x104d8, 0x104d9, 0x104da, 0x104db, 0x104dc, 0x104dd, 0x104de, 0x104df,
+ 0x104e0, 0x104e1, 0x104e2, 0x104e3, 0x104e4, 0x104e5, 0x104e6, 0x104e7,
+ 0x104e8, 0x104e9, 0x104ea, 0x104eb, 0x104ec, 0x104ed, 0x104ee, 0x104ef,
+ 0x104f0, 0x104f1, 0x104f2, 0x104f3, 0x104f4, 0x104f5, 0x104f6, 0x104f7,
+ 0x104f8, 0x104f9, 0x104fa, 0x104fb, 0x104fc, 0x104fd, 0x104fe, 0x104ff
+};
+
+static uint32_t unicode_520_ci_page_108[] = {
+ 0x10800, 0x10801, 0x10802, 0x10803, 0x10804, 0x10805, 0x10806, 0x10807,
+ 0x10808, 0x10809, 0x1080a, 0x1080b, 0x1080c, 0x1080d, 0x1080e, 0x1080f,
+ 0x10810, 0x10811, 0x10812, 0x10813, 0x10814, 0x10815, 0x10816, 0x10817,
+ 0x10818, 0x10819, 0x1081a, 0x1081b, 0x1081c, 0x1081d, 0x1081e, 0x1081f,
+ 0x10820, 0x10821, 0x10822, 0x10823, 0x10824, 0x10825, 0x10826, 0x10827,
+ 0x10828, 0x10829, 0x1082a, 0x1082b, 0x1082c, 0x1082d, 0x1082e, 0x1082f,
+ 0x10830, 0x10831, 0x10832, 0x10833, 0x10834, 0x10835, 0x10836, 0x10837,
+ 0x10838, 0x10839, 0x1083a, 0x1083b, 0x1083c, 0x1083d, 0x1083e, 0x1083f,
+ 0x10840, 0x10841, 0x10842, 0x10843, 0x10844, 0x10845, 0x10846, 0x10847,
+ 0x10848, 0x10849, 0x1084a, 0x1084b, 0x1084c, 0x1084d, 0x1084e, 0x1084f,
+ 0x10850, 0x10851, 0x10852, 0x10853, 0x10854, 0x10855, 0x10856, 0x10857,
+ 0x00031, 0x00032, 0x00033, 0x1085b, 0x1085c, 0x1085d, 0x1085e, 0x1085f,
+ 0x10860, 0x10861, 0x10862, 0x10863, 0x10864, 0x10865, 0x10866, 0x10867,
+ 0x10868, 0x10869, 0x1086a, 0x1086b, 0x1086c, 0x1086d, 0x1086e, 0x1086f,
+ 0x10870, 0x10871, 0x10872, 0x10873, 0x10874, 0x10875, 0x10876, 0x10877,
+ 0x10878, 0x10879, 0x1087a, 0x1087b, 0x1087c, 0x1087d, 0x1087e, 0x1087f,
+ 0x10880, 0x10881, 0x10882, 0x10883, 0x10884, 0x10885, 0x10886, 0x10887,
+ 0x10888, 0x10889, 0x1088a, 0x1088b, 0x1088c, 0x1088d, 0x1088e, 0x1088f,
+ 0x10890, 0x10891, 0x10892, 0x10893, 0x10894, 0x10895, 0x10896, 0x10897,
+ 0x10898, 0x10899, 0x1089a, 0x1089b, 0x1089c, 0x1089d, 0x1089e, 0x1089f,
+ 0x108a0, 0x108a1, 0x108a2, 0x108a3, 0x108a4, 0x108a5, 0x108a6, 0x108a7,
+ 0x108a8, 0x108a9, 0x108aa, 0x108ab, 0x108ac, 0x108ad, 0x108ae, 0x108af,
+ 0x108b0, 0x108b1, 0x108b2, 0x108b3, 0x108b4, 0x108b5, 0x108b6, 0x108b7,
+ 0x108b8, 0x108b9, 0x108ba, 0x108bb, 0x108bc, 0x108bd, 0x108be, 0x108bf,
+ 0x108c0, 0x108c1, 0x108c2, 0x108c3, 0x108c4, 0x108c5, 0x108c6, 0x108c7,
+ 0x108c8, 0x108c9, 0x108ca, 0x108cb, 0x108cc, 0x108cd, 0x108ce, 0x108cf,
+ 0x108d0, 0x108d1, 0x108d2, 0x108d3, 0x108d4, 0x108d5, 0x108d6, 0x108d7,
+ 0x108d8, 0x108d9, 0x108da, 0x108db, 0x108dc, 0x108dd, 0x108de, 0x108df,
+ 0x108e0, 0x108e1, 0x108e2, 0x108e3, 0x108e4, 0x108e5, 0x108e6, 0x108e7,
+ 0x108e8, 0x108e9, 0x108ea, 0x108eb, 0x108ec, 0x108ed, 0x108ee, 0x108ef,
+ 0x108f0, 0x108f1, 0x108f2, 0x108f3, 0x108f4, 0x108f5, 0x108f6, 0x108f7,
+ 0x108f8, 0x108f9, 0x108fa, 0x108fb, 0x108fc, 0x108fd, 0x108fe, 0x108ff
+};
+
+static uint32_t unicode_520_ci_page_109[] = {
+ 0x10900, 0x10901, 0x10902, 0x10903, 0x10904, 0x10905, 0x10906, 0x10907,
+ 0x10908, 0x10909, 0x1090a, 0x1090b, 0x1090c, 0x1090d, 0x1090e, 0x1090f,
+ 0x10910, 0x10911, 0x10912, 0x10913, 0x10914, 0x10915, 0x00031, 0x10917,
+ 0x10918, 0x10919, 0x00032, 0x00033, 0x1091c, 0x1091d, 0x1091e, 0x1091f,
+ 0x10920, 0x10921, 0x10922, 0x10923, 0x10924, 0x10925, 0x10926, 0x10927,
+ 0x10928, 0x10929, 0x1092a, 0x1092b, 0x1092c, 0x1092d, 0x1092e, 0x1092f,
+ 0x10930, 0x10931, 0x10932, 0x10933, 0x10934, 0x10935, 0x10936, 0x10937,
+ 0x10938, 0x10939, 0x1093a, 0x1093b, 0x1093c, 0x1093d, 0x1093e, 0x1093f,
+ 0x10940, 0x10941, 0x10942, 0x10943, 0x10944, 0x10945, 0x10946, 0x10947,
+ 0x10948, 0x10949, 0x1094a, 0x1094b, 0x1094c, 0x1094d, 0x1094e, 0x1094f,
+ 0x10950, 0x10951, 0x10952, 0x10953, 0x10954, 0x10955, 0x10956, 0x10957,
+ 0x10958, 0x10959, 0x1095a, 0x1095b, 0x1095c, 0x1095d, 0x1095e, 0x1095f,
+ 0x10960, 0x10961, 0x10962, 0x10963, 0x10964, 0x10965, 0x10966, 0x10967,
+ 0x10968, 0x10969, 0x1096a, 0x1096b, 0x1096c, 0x1096d, 0x1096e, 0x1096f,
+ 0x10970, 0x10971, 0x10972, 0x10973, 0x10974, 0x10975, 0x10976, 0x10977,
+ 0x10978, 0x10979, 0x1097a, 0x1097b, 0x1097c, 0x1097d, 0x1097e, 0x1097f,
+ 0x10980, 0x10981, 0x10982, 0x10983, 0x10984, 0x10985, 0x10986, 0x10987,
+ 0x10988, 0x10989, 0x1098a, 0x1098b, 0x1098c, 0x1098d, 0x1098e, 0x1098f,
+ 0x10990, 0x10991, 0x10992, 0x10993, 0x10994, 0x10995, 0x10996, 0x10997,
+ 0x10998, 0x10999, 0x1099a, 0x1099b, 0x1099c, 0x1099d, 0x1099e, 0x1099f,
+ 0x109a0, 0x109a1, 0x109a2, 0x109a3, 0x109a4, 0x109a5, 0x109a6, 0x109a7,
+ 0x109a8, 0x109a9, 0x109aa, 0x109ab, 0x109ac, 0x109ad, 0x109ae, 0x109af,
+ 0x109b0, 0x109b1, 0x109b2, 0x109b3, 0x109b4, 0x109b5, 0x109b6, 0x109b7,
+ 0x109b8, 0x109b9, 0x109ba, 0x109bb, 0x109bc, 0x109bd, 0x109be, 0x109bf,
+ 0x109c0, 0x109c1, 0x109c2, 0x109c3, 0x109c4, 0x109c5, 0x109c6, 0x109c7,
+ 0x109c8, 0x109c9, 0x109ca, 0x109cb, 0x109cc, 0x109cd, 0x109ce, 0x109cf,
+ 0x109d0, 0x109d1, 0x109d2, 0x109d3, 0x109d4, 0x109d5, 0x109d6, 0x109d7,
+ 0x109d8, 0x109d9, 0x109da, 0x109db, 0x109dc, 0x109dd, 0x109de, 0x109df,
+ 0x109e0, 0x109e1, 0x109e2, 0x109e3, 0x109e4, 0x109e5, 0x109e6, 0x109e7,
+ 0x109e8, 0x109e9, 0x109ea, 0x109eb, 0x109ec, 0x109ed, 0x109ee, 0x109ef,
+ 0x109f0, 0x109f1, 0x109f2, 0x109f3, 0x109f4, 0x109f5, 0x109f6, 0x109f7,
+ 0x109f8, 0x109f9, 0x109fa, 0x109fb, 0x109fc, 0x109fd, 0x109fe, 0x109ff
+};
+
+static uint32_t unicode_520_ci_page_10a[] = {
+ 0x10a00, 0x10a01, 0x10a02, 0x10a03, 0x10a04, 0x10a05, 0x10a06, 0x10a07,
+ 0x10a08, 0x10a09, 0x10a0a, 0x10a0b, 0x10a0c, 0x00000, 0x00000, 0x00000,
+ 0x10a10, 0x10a11, 0x10a12, 0x10a13, 0x10a14, 0x10a15, 0x10a16, 0x10a17,
+ 0x10a18, 0x10a19, 0x10a1a, 0x10a1b, 0x10a1c, 0x10a1d, 0x10a1e, 0x10a1f,
+ 0x10a20, 0x10a21, 0x10a22, 0x10a23, 0x10a24, 0x10a25, 0x10a26, 0x10a27,
+ 0x10a28, 0x10a29, 0x10a2a, 0x10a2b, 0x10a2c, 0x10a2d, 0x10a2e, 0x10a2f,
+ 0x10a30, 0x10a31, 0x10a32, 0x10a33, 0x10a34, 0x10a35, 0x10a36, 0x10a37,
+ 0x00000, 0x00000, 0x00000, 0x10a3b, 0x10a3c, 0x10a3d, 0x10a3e, 0x10a3f,
+ 0x00031, 0x00032, 0x00033, 0x00034, 0x10a44, 0x10a45, 0x10a46, 0x10a47,
+ 0x10a48, 0x10a49, 0x10a4a, 0x10a4b, 0x10a4c, 0x10a4d, 0x10a4e, 0x10a4f,
+ 0x10a50, 0x10a51, 0x10a52, 0x10a53, 0x10a54, 0x10a55, 0x10a56, 0x10a57,
+ 0x10a58, 0x10a59, 0x10a5a, 0x10a5b, 0x10a5c, 0x10a5d, 0x10a5e, 0x10a5f,
+ 0x10a60, 0x10a61, 0x10a62, 0x10a63, 0x10a64, 0x10a65, 0x10a66, 0x10a67,
+ 0x10a68, 0x10a69, 0x10a6a, 0x10a6b, 0x10a6c, 0x10a6d, 0x10a6e, 0x10a6f,
+ 0x10a70, 0x10a71, 0x10a72, 0x10a73, 0x10a74, 0x10a75, 0x10a76, 0x10a77,
+ 0x10a78, 0x10a79, 0x10a7a, 0x10a7b, 0x10a7c, 0x00031, 0x10a7e, 0x10a7f,
+ 0x10a80, 0x10a81, 0x10a82, 0x10a83, 0x10a84, 0x10a85, 0x10a86, 0x10a87,
+ 0x10a88, 0x10a89, 0x10a8a, 0x10a8b, 0x10a8c, 0x10a8d, 0x10a8e, 0x10a8f,
+ 0x10a90, 0x10a91, 0x10a92, 0x10a93, 0x10a94, 0x10a95, 0x10a96, 0x10a97,
+ 0x10a98, 0x10a99, 0x10a9a, 0x10a9b, 0x10a9c, 0x10a9d, 0x10a9e, 0x10a9f,
+ 0x10aa0, 0x10aa1, 0x10aa2, 0x10aa3, 0x10aa4, 0x10aa5, 0x10aa6, 0x10aa7,
+ 0x10aa8, 0x10aa9, 0x10aaa, 0x10aab, 0x10aac, 0x10aad, 0x10aae, 0x10aaf,
+ 0x10ab0, 0x10ab1, 0x10ab2, 0x10ab3, 0x10ab4, 0x10ab5, 0x10ab6, 0x10ab7,
+ 0x10ab8, 0x10ab9, 0x10aba, 0x10abb, 0x10abc, 0x10abd, 0x10abe, 0x10abf,
+ 0x10ac0, 0x10ac1, 0x10ac2, 0x10ac3, 0x10ac4, 0x10ac5, 0x10ac6, 0x10ac7,
+ 0x10ac8, 0x10ac9, 0x10aca, 0x10acb, 0x10acc, 0x10acd, 0x10ace, 0x10acf,
+ 0x10ad0, 0x10ad1, 0x10ad2, 0x10ad3, 0x10ad4, 0x10ad5, 0x10ad6, 0x10ad7,
+ 0x10ad8, 0x10ad9, 0x10ada, 0x10adb, 0x10adc, 0x10add, 0x10ade, 0x10adf,
+ 0x10ae0, 0x10ae1, 0x10ae2, 0x10ae3, 0x10ae4, 0x10ae5, 0x10ae6, 0x10ae7,
+ 0x10ae8, 0x10ae9, 0x10aea, 0x10aeb, 0x10aec, 0x10aed, 0x10aee, 0x10aef,
+ 0x10af0, 0x10af1, 0x10af2, 0x10af3, 0x10af4, 0x10af5, 0x10af6, 0x10af7,
+ 0x10af8, 0x10af9, 0x10afa, 0x10afb, 0x10afc, 0x10afd, 0x10afe, 0x10aff
+};
+
+static uint32_t unicode_520_ci_page_10b[] = {
+ 0x10b00, 0x10b01, 0x10b02, 0x10b03, 0x10b04, 0x10b05, 0x10b06, 0x10b07,
+ 0x10b08, 0x10b09, 0x10b0a, 0x10b0b, 0x10b0c, 0x10b0d, 0x10b0e, 0x10b0f,
+ 0x10b10, 0x10b11, 0x10b12, 0x10b13, 0x10b14, 0x10b15, 0x10b16, 0x10b17,
+ 0x10b18, 0x10b19, 0x10b1a, 0x10b1b, 0x10b1c, 0x10b1d, 0x10b1e, 0x10b1f,
+ 0x10b20, 0x10b21, 0x10b22, 0x10b23, 0x10b24, 0x10b25, 0x10b26, 0x10b27,
+ 0x10b28, 0x10b29, 0x10b2a, 0x10b2b, 0x10b2c, 0x10b2d, 0x10b2d, 0x10b2f,
+ 0x10b30, 0x10b31, 0x10b32, 0x10b33, 0x10b34, 0x10b35, 0x10b36, 0x10b37,
+ 0x10b38, 0x10b39, 0x10b3a, 0x10b3b, 0x10b3c, 0x10b3d, 0x10b3e, 0x10b3f,
+ 0x10b40, 0x10b41, 0x10b42, 0x10b43, 0x10b44, 0x10b45, 0x10b46, 0x10b47,
+ 0x10b48, 0x10b49, 0x10b4a, 0x10b4b, 0x10b4c, 0x10b4d, 0x10b4e, 0x10b4f,
+ 0x10b50, 0x10b51, 0x10b52, 0x10b53, 0x10b54, 0x10b55, 0x10b56, 0x10b57,
+ 0x00031, 0x00032, 0x00033, 0x00034, 0x10b5c, 0x10b5d, 0x10b5e, 0x10b5f,
+ 0x10b60, 0x10b61, 0x10b62, 0x10b63, 0x10b64, 0x10b65, 0x10b66, 0x10b67,
+ 0x10b68, 0x10b69, 0x10b6a, 0x10b6b, 0x10b6c, 0x10b6d, 0x10b6e, 0x10b6f,
+ 0x10b70, 0x10b71, 0x10b72, 0x10b73, 0x10b74, 0x10b75, 0x10b76, 0x10b77,
+ 0x00031, 0x00032, 0x00033, 0x00034, 0x10b7c, 0x10b7d, 0x10b7e, 0x10b7f,
+ 0x10b80, 0x10b81, 0x10b82, 0x10b83, 0x10b84, 0x10b85, 0x10b86, 0x10b87,
+ 0x10b88, 0x10b89, 0x10b8a, 0x10b8b, 0x10b8c, 0x10b8d, 0x10b8e, 0x10b8f,
+ 0x10b90, 0x10b91, 0x10b92, 0x10b93, 0x10b94, 0x10b95, 0x10b96, 0x10b97,
+ 0x10b98, 0x10b99, 0x10b9a, 0x10b9b, 0x10b9c, 0x10b9d, 0x10b9e, 0x10b9f,
+ 0x10ba0, 0x10ba1, 0x10ba2, 0x10ba3, 0x10ba4, 0x10ba5, 0x10ba6, 0x10ba7,
+ 0x10ba8, 0x10ba9, 0x10baa, 0x10bab, 0x10bac, 0x10bad, 0x10bae, 0x10baf,
+ 0x10bb0, 0x10bb1, 0x10bb2, 0x10bb3, 0x10bb4, 0x10bb5, 0x10bb6, 0x10bb7,
+ 0x10bb8, 0x10bb9, 0x10bba, 0x10bbb, 0x10bbc, 0x10bbd, 0x10bbe, 0x10bbf,
+ 0x10bc0, 0x10bc1, 0x10bc2, 0x10bc3, 0x10bc4, 0x10bc5, 0x10bc6, 0x10bc7,
+ 0x10bc8, 0x10bc9, 0x10bca, 0x10bcb, 0x10bcc, 0x10bcd, 0x10bce, 0x10bcf,
+ 0x10bd0, 0x10bd1, 0x10bd2, 0x10bd3, 0x10bd4, 0x10bd5, 0x10bd6, 0x10bd7,
+ 0x10bd8, 0x10bd9, 0x10bda, 0x10bdb, 0x10bdc, 0x10bdd, 0x10bde, 0x10bdf,
+ 0x10be0, 0x10be1, 0x10be2, 0x10be3, 0x10be4, 0x10be5, 0x10be6, 0x10be7,
+ 0x10be8, 0x10be9, 0x10bea, 0x10beb, 0x10bec, 0x10bed, 0x10bee, 0x10bef,
+ 0x10bf0, 0x10bf1, 0x10bf2, 0x10bf3, 0x10bf4, 0x10bf5, 0x10bf6, 0x10bf7,
+ 0x10bf8, 0x10bf9, 0x10bfa, 0x10bfb, 0x10bfc, 0x10bfd, 0x10bfe, 0x10bff
+};
+
+static uint32_t unicode_520_ci_page_10c[] = {
+ 0x10c00, 0x10c00, 0x10c02, 0x10c03, 0x10c03, 0x10c05, 0x10c06, 0x10c07,
+ 0x10c07, 0x10c09, 0x10c09, 0x10c0b, 0x10c0b, 0x10c0d, 0x10c0d, 0x10c0f,
+ 0x10c0f, 0x10c11, 0x10c11, 0x10c13, 0x10c14, 0x10c14, 0x10c16, 0x10c16,
+ 0x10c18, 0x10c18, 0x10c1a, 0x10c1a, 0x10c1c, 0x10c1c, 0x10c1e, 0x10c1e,
+ 0x10c20, 0x10c21, 0x10c22, 0x10c23, 0x10c24, 0x10c24, 0x10c26, 0x10c26,
+ 0x10c28, 0x10c28, 0x10c2a, 0x10c2a, 0x10c2c, 0x10c2d, 0x10c2d, 0x10c2f,
+ 0x10c30, 0x10c31, 0x10c32, 0x10c32, 0x10c34, 0x10c34, 0x10c36, 0x10c36,
+ 0x10c38, 0x10c38, 0x10c3a, 0x10c3a, 0x10c3c, 0x10c3d, 0x10c3e, 0x10c3f,
+ 0x10c3f, 0x10c41, 0x10c41, 0x10c43, 0x10c43, 0x10c45, 0x10c45, 0x10c47,
+ 0x10c48, 0x10c49, 0x10c4a, 0x10c4b, 0x10c4c, 0x10c4d, 0x10c4e, 0x10c4f,
+ 0x10c50, 0x10c51, 0x10c52, 0x10c53, 0x10c54, 0x10c55, 0x10c56, 0x10c57,
+ 0x10c58, 0x10c59, 0x10c5a, 0x10c5b, 0x10c5c, 0x10c5d, 0x10c5e, 0x10c5f,
+ 0x10c60, 0x10c61, 0x10c62, 0x10c63, 0x10c64, 0x10c65, 0x10c66, 0x10c67,
+ 0x10c68, 0x10c69, 0x10c6a, 0x10c6b, 0x10c6c, 0x10c6d, 0x10c6e, 0x10c6f,
+ 0x10c70, 0x10c71, 0x10c72, 0x10c73, 0x10c74, 0x10c75, 0x10c76, 0x10c77,
+ 0x10c78, 0x10c79, 0x10c7a, 0x10c7b, 0x10c7c, 0x10c7d, 0x10c7e, 0x10c7f,
+ 0x10c80, 0x10c81, 0x10c82, 0x10c83, 0x10c84, 0x10c85, 0x10c86, 0x10c87,
+ 0x10c88, 0x10c89, 0x10c8a, 0x10c8b, 0x10c8c, 0x10c8d, 0x10c8e, 0x10c8f,
+ 0x10c90, 0x10c91, 0x10c92, 0x10c93, 0x10c94, 0x10c95, 0x10c96, 0x10c97,
+ 0x10c98, 0x10c99, 0x10c9a, 0x10c9b, 0x10c9c, 0x10c9d, 0x10c9e, 0x10c9f,
+ 0x10ca0, 0x10ca1, 0x10ca2, 0x10ca3, 0x10ca4, 0x10ca5, 0x10ca6, 0x10ca7,
+ 0x10ca8, 0x10ca9, 0x10caa, 0x10cab, 0x10cac, 0x10cad, 0x10cae, 0x10caf,
+ 0x10cb0, 0x10cb1, 0x10cb2, 0x10cb3, 0x10cb4, 0x10cb5, 0x10cb6, 0x10cb7,
+ 0x10cb8, 0x10cb9, 0x10cba, 0x10cbb, 0x10cbc, 0x10cbd, 0x10cbe, 0x10cbf,
+ 0x10cc0, 0x10cc1, 0x10cc2, 0x10cc3, 0x10cc4, 0x10cc5, 0x10cc6, 0x10cc7,
+ 0x10cc8, 0x10cc9, 0x10cca, 0x10ccb, 0x10ccc, 0x10ccd, 0x10cce, 0x10ccf,
+ 0x10cd0, 0x10cd1, 0x10cd2, 0x10cd3, 0x10cd4, 0x10cd5, 0x10cd6, 0x10cd7,
+ 0x10cd8, 0x10cd9, 0x10cda, 0x10cdb, 0x10cdc, 0x10cdd, 0x10cde, 0x10cdf,
+ 0x10ce0, 0x10ce1, 0x10ce2, 0x10ce3, 0x10ce4, 0x10ce5, 0x10ce6, 0x10ce7,
+ 0x10ce8, 0x10ce9, 0x10cea, 0x10ceb, 0x10cec, 0x10ced, 0x10cee, 0x10cef,
+ 0x10cf0, 0x10cf1, 0x10cf2, 0x10cf3, 0x10cf4, 0x10cf5, 0x10cf6, 0x10cf7,
+ 0x10cf8, 0x10cf9, 0x10cfa, 0x10cfb, 0x10cfc, 0x10cfd, 0x10cfe, 0x10cff
+};
+
+static uint32_t unicode_520_ci_page_10e[] = {
+ 0x10e00, 0x10e01, 0x10e02, 0x10e03, 0x10e04, 0x10e05, 0x10e06, 0x10e07,
+ 0x10e08, 0x10e09, 0x10e0a, 0x10e0b, 0x10e0c, 0x10e0d, 0x10e0e, 0x10e0f,
+ 0x10e10, 0x10e11, 0x10e12, 0x10e13, 0x10e14, 0x10e15, 0x10e16, 0x10e17,
+ 0x10e18, 0x10e19, 0x10e1a, 0x10e1b, 0x10e1c, 0x10e1d, 0x10e1e, 0x10e1f,
+ 0x10e20, 0x10e21, 0x10e22, 0x10e23, 0x10e24, 0x10e25, 0x10e26, 0x10e27,
+ 0x10e28, 0x10e29, 0x10e2a, 0x10e2b, 0x10e2c, 0x10e2d, 0x10e2e, 0x10e2f,
+ 0x10e30, 0x10e31, 0x10e32, 0x10e33, 0x10e34, 0x10e35, 0x10e36, 0x10e37,
+ 0x10e38, 0x10e39, 0x10e3a, 0x10e3b, 0x10e3c, 0x10e3d, 0x10e3e, 0x10e3f,
+ 0x10e40, 0x10e41, 0x10e42, 0x10e43, 0x10e44, 0x10e45, 0x10e46, 0x10e47,
+ 0x10e48, 0x10e49, 0x10e4a, 0x10e4b, 0x10e4c, 0x10e4d, 0x10e4e, 0x10e4f,
+ 0x10e50, 0x10e51, 0x10e52, 0x10e53, 0x10e54, 0x10e55, 0x10e56, 0x10e57,
+ 0x10e58, 0x10e59, 0x10e5a, 0x10e5b, 0x10e5c, 0x10e5d, 0x10e5e, 0x10e5f,
+ 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037, 0x00038,
+ 0x00039, 0x10e69, 0x10e6a, 0x10e6b, 0x10e6c, 0x10e6d, 0x10e6e, 0x10e6f,
+ 0x10e70, 0x10e71, 0x10e72, 0x10e73, 0x10e74, 0x10e75, 0x10e76, 0x10e77,
+ 0x10e78, 0x10e79, 0x10e7a, 0x10e7b, 0x10e7c, 0x10e7d, 0x10e7e, 0x10e7f,
+ 0x10e80, 0x10e81, 0x10e82, 0x10e83, 0x10e84, 0x10e85, 0x10e86, 0x10e87,
+ 0x10e88, 0x10e89, 0x10e8a, 0x10e8b, 0x10e8c, 0x10e8d, 0x10e8e, 0x10e8f,
+ 0x10e90, 0x10e91, 0x10e92, 0x10e93, 0x10e94, 0x10e95, 0x10e96, 0x10e97,
+ 0x10e98, 0x10e99, 0x10e9a, 0x10e9b, 0x10e9c, 0x10e9d, 0x10e9e, 0x10e9f,
+ 0x10ea0, 0x10ea1, 0x10ea2, 0x10ea3, 0x10ea4, 0x10ea5, 0x10ea6, 0x10ea7,
+ 0x10ea8, 0x10ea9, 0x10eaa, 0x10eab, 0x10eac, 0x10ead, 0x10eae, 0x10eaf,
+ 0x10eb0, 0x10eb1, 0x10eb2, 0x10eb3, 0x10eb4, 0x10eb5, 0x10eb6, 0x10eb7,
+ 0x10eb8, 0x10eb9, 0x10eba, 0x10ebb, 0x10ebc, 0x10ebd, 0x10ebe, 0x10ebf,
+ 0x10ec0, 0x10ec1, 0x10ec2, 0x10ec3, 0x10ec4, 0x10ec5, 0x10ec6, 0x10ec7,
+ 0x10ec8, 0x10ec9, 0x10eca, 0x10ecb, 0x10ecc, 0x10ecd, 0x10ece, 0x10ecf,
+ 0x10ed0, 0x10ed1, 0x10ed2, 0x10ed3, 0x10ed4, 0x10ed5, 0x10ed6, 0x10ed7,
+ 0x10ed8, 0x10ed9, 0x10eda, 0x10edb, 0x10edc, 0x10edd, 0x10ede, 0x10edf,
+ 0x10ee0, 0x10ee1, 0x10ee2, 0x10ee3, 0x10ee4, 0x10ee5, 0x10ee6, 0x10ee7,
+ 0x10ee8, 0x10ee9, 0x10eea, 0x10eeb, 0x10eec, 0x10eed, 0x10eee, 0x10eef,
+ 0x10ef0, 0x10ef1, 0x10ef2, 0x10ef3, 0x10ef4, 0x10ef5, 0x10ef6, 0x10ef7,
+ 0x10ef8, 0x10ef9, 0x10efa, 0x10efb, 0x10efc, 0x10efd, 0x10efe, 0x10eff
+};
+
+static uint32_t unicode_520_ci_page_110[] = {
+ 0x11000, 0x11001, 0x11002, 0x11003, 0x11004, 0x11005, 0x11006, 0x11007,
+ 0x11008, 0x11009, 0x1100a, 0x1100b, 0x1100c, 0x1100d, 0x1100e, 0x1100f,
+ 0x11010, 0x11011, 0x11012, 0x11013, 0x11014, 0x11015, 0x11016, 0x11017,
+ 0x11018, 0x11019, 0x1101a, 0x1101b, 0x1101c, 0x1101d, 0x1101e, 0x1101f,
+ 0x11020, 0x11021, 0x11022, 0x11023, 0x11024, 0x11025, 0x11026, 0x11027,
+ 0x11028, 0x11029, 0x1102a, 0x1102b, 0x1102c, 0x1102d, 0x1102e, 0x1102f,
+ 0x11030, 0x11031, 0x11032, 0x11033, 0x11034, 0x11035, 0x11036, 0x11037,
+ 0x11038, 0x11039, 0x1103a, 0x1103b, 0x1103c, 0x1103d, 0x1103e, 0x1103f,
+ 0x11040, 0x11041, 0x11042, 0x11043, 0x11044, 0x11045, 0x11046, 0x11047,
+ 0x11048, 0x11049, 0x1104a, 0x1104b, 0x1104c, 0x1104d, 0x1104e, 0x1104f,
+ 0x11050, 0x11051, 0x11052, 0x11053, 0x11054, 0x11055, 0x11056, 0x11057,
+ 0x11058, 0x11059, 0x1105a, 0x1105b, 0x1105c, 0x1105d, 0x1105e, 0x1105f,
+ 0x11060, 0x11061, 0x11062, 0x11063, 0x11064, 0x11065, 0x11066, 0x11067,
+ 0x11068, 0x11069, 0x1106a, 0x1106b, 0x1106c, 0x1106d, 0x1106e, 0x1106f,
+ 0x11070, 0x11071, 0x11072, 0x11073, 0x11074, 0x11075, 0x11076, 0x11077,
+ 0x11078, 0x11079, 0x1107a, 0x1107b, 0x1107c, 0x1107d, 0x1107e, 0x1107f,
+ 0x00000, 0x00000, 0x00000, 0x11083, 0x11084, 0x11085, 0x11086, 0x11087,
+ 0x11088, 0x11089, 0x1108a, 0x1108b, 0x1108c, 0x1108d, 0x1108e, 0x1108f,
+ 0x11090, 0x11091, 0x11092, 0x11093, 0x11094, 0x11095, 0x11096, 0x11097,
+ 0x11098, 0x11099, 0x11099, 0x1109b, 0x1109b, 0x1109d, 0x1109e, 0x1109f,
+ 0x110a0, 0x110a1, 0x110a2, 0x110a3, 0x110a4, 0x110a5, 0x110a6, 0x110a7,
+ 0x110a8, 0x110a9, 0x110aa, 0x110a5, 0x110ac, 0x110ad, 0x110ae, 0x110af,
+ 0x110b0, 0x110b1, 0x110b2, 0x110b3, 0x110b4, 0x110b5, 0x110b6, 0x110b7,
+ 0x110b8, 0x110b9, 0x00000, 0x110bb, 0x110bc, 0x00000, 0x110be, 0x110bf,
+ 0x110c0, 0x110c1, 0x110c2, 0x110c3, 0x110c4, 0x110c5, 0x110c6, 0x110c7,
+ 0x110c8, 0x110c9, 0x110ca, 0x110cb, 0x110cc, 0x110cd, 0x110ce, 0x110cf,
+ 0x110d0, 0x110d1, 0x110d2, 0x110d3, 0x110d4, 0x110d5, 0x110d6, 0x110d7,
+ 0x110d8, 0x110d9, 0x110da, 0x110db, 0x110dc, 0x110dd, 0x110de, 0x110df,
+ 0x110e0, 0x110e1, 0x110e2, 0x110e3, 0x110e4, 0x110e5, 0x110e6, 0x110e7,
+ 0x110e8, 0x110e9, 0x110ea, 0x110eb, 0x110ec, 0x110ed, 0x110ee, 0x110ef,
+ 0x110f0, 0x110f1, 0x110f2, 0x110f3, 0x110f4, 0x110f5, 0x110f6, 0x110f7,
+ 0x110f8, 0x110f9, 0x110fa, 0x110fb, 0x110fc, 0x110fd, 0x110fe, 0x110ff
+};
+
+static uint32_t unicode_520_ci_page_124[] = {
+ 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037, 0x00038, 0x00039,
+ 0x00033, 0x00034, 0x00035, 0x00036, 0x00037, 0x00038, 0x00039, 0x00034,
+ 0x00035, 0x00036, 0x00037, 0x00038, 0x00039, 0x00031, 0x00032, 0x00033,
+ 0x00034, 0x00035, 0x00036, 0x00037, 0x00038, 0x00039, 0x00031, 0x00032,
+ 0x00033, 0x00034, 0x00035, 0x00032, 0x00033, 0x00033, 0x00034, 0x00035,
+ 0x00036, 0x00037, 0x00038, 0x00039, 0x00031, 0x00032, 0x00033, 0x00033,
+ 0x00034, 0x00035, 0x12432, 0x12433, 0x00031, 0x00032, 0x00033, 0x00033,
+ 0x00034, 0x00035, 0x00033, 0x00033, 0x00034, 0x00034, 0x00034, 0x00034,
+ 0x00036, 0x00037, 0x00037, 0x00037, 0x00038, 0x00038, 0x00039, 0x00039,
+ 0x00039, 0x00039, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00031,
+ 0x00032, 0x00033, 0x00034, 0x00034, 0x00035, 0x00035, 0x12456, 0x12457,
+ 0x00031, 0x00032, 0x1245a, 0x1245b, 0x1245c, 0x1245d, 0x1245e, 0x1245f,
+ 0x12460, 0x12461, 0x12462, 0x12463, 0x12464, 0x12465, 0x12466, 0x12467,
+ 0x12468, 0x12469, 0x1246a, 0x1246b, 0x1246c, 0x1246d, 0x1246e, 0x1246f,
+ 0x12470, 0x12471, 0x12472, 0x12473, 0x12474, 0x12475, 0x12476, 0x12477,
+ 0x12478, 0x12479, 0x1247a, 0x1247b, 0x1247c, 0x1247d, 0x1247e, 0x1247f,
+ 0x12480, 0x12481, 0x12482, 0x12483, 0x12484, 0x12485, 0x12486, 0x12487,
+ 0x12488, 0x12489, 0x1248a, 0x1248b, 0x1248c, 0x1248d, 0x1248e, 0x1248f,
+ 0x12490, 0x12491, 0x12492, 0x12493, 0x12494, 0x12495, 0x12496, 0x12497,
+ 0x12498, 0x12499, 0x1249a, 0x1249b, 0x1249c, 0x1249d, 0x1249e, 0x1249f,
+ 0x124a0, 0x124a1, 0x124a2, 0x124a3, 0x124a4, 0x124a5, 0x124a6, 0x124a7,
+ 0x124a8, 0x124a9, 0x124aa, 0x124ab, 0x124ac, 0x124ad, 0x124ae, 0x124af,
+ 0x124b0, 0x124b1, 0x124b2, 0x124b3, 0x124b4, 0x124b5, 0x124b6, 0x124b7,
+ 0x124b8, 0x124b9, 0x124ba, 0x124bb, 0x124bc, 0x124bd, 0x124be, 0x124bf,
+ 0x124c0, 0x124c1, 0x124c2, 0x124c3, 0x124c4, 0x124c5, 0x124c6, 0x124c7,
+ 0x124c8, 0x124c9, 0x124ca, 0x124cb, 0x124cc, 0x124cd, 0x124ce, 0x124cf,
+ 0x124d0, 0x124d1, 0x124d2, 0x124d3, 0x124d4, 0x124d5, 0x124d6, 0x124d7,
+ 0x124d8, 0x124d9, 0x124da, 0x124db, 0x124dc, 0x124dd, 0x124de, 0x124df,
+ 0x124e0, 0x124e1, 0x124e2, 0x124e3, 0x124e4, 0x124e5, 0x124e6, 0x124e7,
+ 0x124e8, 0x124e9, 0x124ea, 0x124eb, 0x124ec, 0x124ed, 0x124ee, 0x124ef,
+ 0x124f0, 0x124f1, 0x124f2, 0x124f3, 0x124f4, 0x124f5, 0x124f6, 0x124f7,
+ 0x124f8, 0x124f9, 0x124fa, 0x124fb, 0x124fc, 0x124fd, 0x124fe, 0x124ff
+};
+
+static uint32_t unicode_520_ci_page_1d1[] = {
+ 0x1d100, 0x1d101, 0x1d102, 0x1d103, 0x1d104, 0x1d105, 0x1d106, 0x1d107,
+ 0x1d108, 0x1d109, 0x1d10a, 0x1d10b, 0x1d10c, 0x1d10d, 0x1d10e, 0x1d10f,
+ 0x1d110, 0x1d111, 0x1d112, 0x1d113, 0x1d114, 0x1d115, 0x1d116, 0x1d117,
+ 0x1d118, 0x1d119, 0x1d11a, 0x1d11b, 0x1d11c, 0x1d11d, 0x1d11e, 0x1d11f,
+ 0x1d120, 0x1d121, 0x1d122, 0x1d123, 0x1d124, 0x1d125, 0x1d126, 0x1d127,
+ 0x1d128, 0x1d129, 0x1d12a, 0x1d12b, 0x1d12c, 0x1d12d, 0x1d12e, 0x1d12f,
+ 0x1d130, 0x1d131, 0x1d132, 0x1d133, 0x1d134, 0x1d135, 0x1d136, 0x1d137,
+ 0x1d138, 0x1d139, 0x1d13a, 0x1d13b, 0x1d13c, 0x1d13d, 0x1d13e, 0x1d13f,
+ 0x1d140, 0x1d141, 0x1d142, 0x1d143, 0x1d144, 0x1d145, 0x1d146, 0x1d147,
+ 0x1d148, 0x1d149, 0x1d14a, 0x1d14b, 0x1d14c, 0x1d14d, 0x1d14e, 0x1d14f,
+ 0x1d150, 0x1d151, 0x1d152, 0x1d153, 0x1d154, 0x1d155, 0x1d156, 0x1d157,
+ 0x1d158, 0x1d159, 0x1d15a, 0x1d15b, 0x1d15c, 0x1d15d, 0x1d157, 0x1d158,
+ 0x1d158, 0x1d158, 0x1d158, 0x1d158, 0x1d158, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x1d16a, 0x1d16b, 0x1d16c, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x1d183, 0x1d184, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x1d18c, 0x1d18d, 0x1d18e, 0x1d18f,
+ 0x1d190, 0x1d191, 0x1d192, 0x1d193, 0x1d194, 0x1d195, 0x1d196, 0x1d197,
+ 0x1d198, 0x1d199, 0x1d19a, 0x1d19b, 0x1d19c, 0x1d19d, 0x1d19e, 0x1d19f,
+ 0x1d1a0, 0x1d1a1, 0x1d1a2, 0x1d1a3, 0x1d1a4, 0x1d1a5, 0x1d1a6, 0x1d1a7,
+ 0x1d1a8, 0x1d1a9, 0x00000, 0x00000, 0x00000, 0x00000, 0x1d1ae, 0x1d1af,
+ 0x1d1b0, 0x1d1b1, 0x1d1b2, 0x1d1b3, 0x1d1b4, 0x1d1b5, 0x1d1b6, 0x1d1b7,
+ 0x1d1b8, 0x1d1b9, 0x1d1ba, 0x1d1b9, 0x1d1ba, 0x1d1b9, 0x1d1ba, 0x1d1b9,
+ 0x1d1ba, 0x1d1c1, 0x1d1c2, 0x1d1c3, 0x1d1c4, 0x1d1c5, 0x1d1c6, 0x1d1c7,
+ 0x1d1c8, 0x1d1c9, 0x1d1ca, 0x1d1cb, 0x1d1cc, 0x1d1cd, 0x1d1ce, 0x1d1cf,
+ 0x1d1d0, 0x1d1d1, 0x1d1d2, 0x1d1d3, 0x1d1d4, 0x1d1d5, 0x1d1d6, 0x1d1d7,
+ 0x1d1d8, 0x1d1d9, 0x1d1da, 0x1d1db, 0x1d1dc, 0x1d1dd, 0x1d1de, 0x1d1df,
+ 0x1d1e0, 0x1d1e1, 0x1d1e2, 0x1d1e3, 0x1d1e4, 0x1d1e5, 0x1d1e6, 0x1d1e7,
+ 0x1d1e8, 0x1d1e9, 0x1d1ea, 0x1d1eb, 0x1d1ec, 0x1d1ed, 0x1d1ee, 0x1d1ef,
+ 0x1d1f0, 0x1d1f1, 0x1d1f2, 0x1d1f3, 0x1d1f4, 0x1d1f5, 0x1d1f6, 0x1d1f7,
+ 0x1d1f8, 0x1d1f9, 0x1d1fa, 0x1d1fb, 0x1d1fc, 0x1d1fd, 0x1d1fe, 0x1d1ff
+};
+
+static uint32_t unicode_520_ci_page_1d2[] = {
+ 0x1d200, 0x1d201, 0x1d202, 0x1d203, 0x1d204, 0x1d205, 0x1d206, 0x1d207,
+ 0x1d208, 0x1d209, 0x1d20a, 0x1d20b, 0x1d20c, 0x1d20d, 0x1d20e, 0x1d20f,
+ 0x1d210, 0x1d211, 0x1d212, 0x1d213, 0x1d214, 0x1d215, 0x1d216, 0x1d217,
+ 0x1d218, 0x1d219, 0x1d21a, 0x1d21b, 0x1d21c, 0x1d21d, 0x1d21e, 0x1d21f,
+ 0x1d220, 0x1d221, 0x1d222, 0x1d223, 0x1d224, 0x1d225, 0x1d226, 0x1d227,
+ 0x1d228, 0x1d229, 0x1d22a, 0x1d22b, 0x1d22c, 0x1d22d, 0x1d22e, 0x1d22f,
+ 0x1d230, 0x1d231, 0x1d232, 0x1d233, 0x1d234, 0x1d235, 0x1d236, 0x1d237,
+ 0x1d238, 0x1d239, 0x1d23a, 0x1d23b, 0x1d23c, 0x1d23d, 0x1d23e, 0x1d23f,
+ 0x1d240, 0x1d241, 0x00000, 0x00000, 0x00000, 0x1d245, 0x1d246, 0x1d247,
+ 0x1d248, 0x1d249, 0x1d24a, 0x1d24b, 0x1d24c, 0x1d24d, 0x1d24e, 0x1d24f,
+ 0x1d250, 0x1d251, 0x1d252, 0x1d253, 0x1d254, 0x1d255, 0x1d256, 0x1d257,
+ 0x1d258, 0x1d259, 0x1d25a, 0x1d25b, 0x1d25c, 0x1d25d, 0x1d25e, 0x1d25f,
+ 0x1d260, 0x1d261, 0x1d262, 0x1d263, 0x1d264, 0x1d265, 0x1d266, 0x1d267,
+ 0x1d268, 0x1d269, 0x1d26a, 0x1d26b, 0x1d26c, 0x1d26d, 0x1d26e, 0x1d26f,
+ 0x1d270, 0x1d271, 0x1d272, 0x1d273, 0x1d274, 0x1d275, 0x1d276, 0x1d277,
+ 0x1d278, 0x1d279, 0x1d27a, 0x1d27b, 0x1d27c, 0x1d27d, 0x1d27e, 0x1d27f,
+ 0x1d280, 0x1d281, 0x1d282, 0x1d283, 0x1d284, 0x1d285, 0x1d286, 0x1d287,
+ 0x1d288, 0x1d289, 0x1d28a, 0x1d28b, 0x1d28c, 0x1d28d, 0x1d28e, 0x1d28f,
+ 0x1d290, 0x1d291, 0x1d292, 0x1d293, 0x1d294, 0x1d295, 0x1d296, 0x1d297,
+ 0x1d298, 0x1d299, 0x1d29a, 0x1d29b, 0x1d29c, 0x1d29d, 0x1d29e, 0x1d29f,
+ 0x1d2a0, 0x1d2a1, 0x1d2a2, 0x1d2a3, 0x1d2a4, 0x1d2a5, 0x1d2a6, 0x1d2a7,
+ 0x1d2a8, 0x1d2a9, 0x1d2aa, 0x1d2ab, 0x1d2ac, 0x1d2ad, 0x1d2ae, 0x1d2af,
+ 0x1d2b0, 0x1d2b1, 0x1d2b2, 0x1d2b3, 0x1d2b4, 0x1d2b5, 0x1d2b6, 0x1d2b7,
+ 0x1d2b8, 0x1d2b9, 0x1d2ba, 0x1d2bb, 0x1d2bc, 0x1d2bd, 0x1d2be, 0x1d2bf,
+ 0x1d2c0, 0x1d2c1, 0x1d2c2, 0x1d2c3, 0x1d2c4, 0x1d2c5, 0x1d2c6, 0x1d2c7,
+ 0x1d2c8, 0x1d2c9, 0x1d2ca, 0x1d2cb, 0x1d2cc, 0x1d2cd, 0x1d2ce, 0x1d2cf,
+ 0x1d2d0, 0x1d2d1, 0x1d2d2, 0x1d2d3, 0x1d2d4, 0x1d2d5, 0x1d2d6, 0x1d2d7,
+ 0x1d2d8, 0x1d2d9, 0x1d2da, 0x1d2db, 0x1d2dc, 0x1d2dd, 0x1d2de, 0x1d2df,
+ 0x1d2e0, 0x1d2e1, 0x1d2e2, 0x1d2e3, 0x1d2e4, 0x1d2e5, 0x1d2e6, 0x1d2e7,
+ 0x1d2e8, 0x1d2e9, 0x1d2ea, 0x1d2eb, 0x1d2ec, 0x1d2ed, 0x1d2ee, 0x1d2ef,
+ 0x1d2f0, 0x1d2f1, 0x1d2f2, 0x1d2f3, 0x1d2f4, 0x1d2f5, 0x1d2f6, 0x1d2f7,
+ 0x1d2f8, 0x1d2f9, 0x1d2fa, 0x1d2fb, 0x1d2fc, 0x1d2fd, 0x1d2fe, 0x1d2ff
+};
+
+static uint32_t unicode_520_ci_page_1d3[] = {
+ 0x1d300, 0x1d301, 0x1d302, 0x1d303, 0x1d304, 0x1d305, 0x1d306, 0x1d307,
+ 0x1d308, 0x1d309, 0x1d30a, 0x1d30b, 0x1d30c, 0x1d30d, 0x1d30e, 0x1d30f,
+ 0x1d310, 0x1d311, 0x1d312, 0x1d313, 0x1d314, 0x1d315, 0x1d316, 0x1d317,
+ 0x1d318, 0x1d319, 0x1d31a, 0x1d31b, 0x1d31c, 0x1d31d, 0x1d31e, 0x1d31f,
+ 0x1d320, 0x1d321, 0x1d322, 0x1d323, 0x1d324, 0x1d325, 0x1d326, 0x1d327,
+ 0x1d328, 0x1d329, 0x1d32a, 0x1d32b, 0x1d32c, 0x1d32d, 0x1d32e, 0x1d32f,
+ 0x1d330, 0x1d331, 0x1d332, 0x1d333, 0x1d334, 0x1d335, 0x1d336, 0x1d337,
+ 0x1d338, 0x1d339, 0x1d33a, 0x1d33b, 0x1d33c, 0x1d33d, 0x1d33e, 0x1d33f,
+ 0x1d340, 0x1d341, 0x1d342, 0x1d343, 0x1d344, 0x1d345, 0x1d346, 0x1d347,
+ 0x1d348, 0x1d349, 0x1d34a, 0x1d34b, 0x1d34c, 0x1d34d, 0x1d34e, 0x1d34f,
+ 0x1d350, 0x1d351, 0x1d352, 0x1d353, 0x1d354, 0x1d355, 0x1d356, 0x1d357,
+ 0x1d358, 0x1d359, 0x1d35a, 0x1d35b, 0x1d35c, 0x1d35d, 0x1d35e, 0x1d35f,
+ 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037, 0x00038,
+ 0x00039, 0x1d369, 0x1d36a, 0x1d36b, 0x1d36c, 0x1d36d, 0x1d36e, 0x1d36f,
+ 0x1d370, 0x1d371, 0x1d372, 0x1d373, 0x1d374, 0x1d375, 0x1d376, 0x1d377,
+ 0x1d378, 0x1d379, 0x1d37a, 0x1d37b, 0x1d37c, 0x1d37d, 0x1d37e, 0x1d37f,
+ 0x1d380, 0x1d381, 0x1d382, 0x1d383, 0x1d384, 0x1d385, 0x1d386, 0x1d387,
+ 0x1d388, 0x1d389, 0x1d38a, 0x1d38b, 0x1d38c, 0x1d38d, 0x1d38e, 0x1d38f,
+ 0x1d390, 0x1d391, 0x1d392, 0x1d393, 0x1d394, 0x1d395, 0x1d396, 0x1d397,
+ 0x1d398, 0x1d399, 0x1d39a, 0x1d39b, 0x1d39c, 0x1d39d, 0x1d39e, 0x1d39f,
+ 0x1d3a0, 0x1d3a1, 0x1d3a2, 0x1d3a3, 0x1d3a4, 0x1d3a5, 0x1d3a6, 0x1d3a7,
+ 0x1d3a8, 0x1d3a9, 0x1d3aa, 0x1d3ab, 0x1d3ac, 0x1d3ad, 0x1d3ae, 0x1d3af,
+ 0x1d3b0, 0x1d3b1, 0x1d3b2, 0x1d3b3, 0x1d3b4, 0x1d3b5, 0x1d3b6, 0x1d3b7,
+ 0x1d3b8, 0x1d3b9, 0x1d3ba, 0x1d3bb, 0x1d3bc, 0x1d3bd, 0x1d3be, 0x1d3bf,
+ 0x1d3c0, 0x1d3c1, 0x1d3c2, 0x1d3c3, 0x1d3c4, 0x1d3c5, 0x1d3c6, 0x1d3c7,
+ 0x1d3c8, 0x1d3c9, 0x1d3ca, 0x1d3cb, 0x1d3cc, 0x1d3cd, 0x1d3ce, 0x1d3cf,
+ 0x1d3d0, 0x1d3d1, 0x1d3d2, 0x1d3d3, 0x1d3d4, 0x1d3d5, 0x1d3d6, 0x1d3d7,
+ 0x1d3d8, 0x1d3d9, 0x1d3da, 0x1d3db, 0x1d3dc, 0x1d3dd, 0x1d3de, 0x1d3df,
+ 0x1d3e0, 0x1d3e1, 0x1d3e2, 0x1d3e3, 0x1d3e4, 0x1d3e5, 0x1d3e6, 0x1d3e7,
+ 0x1d3e8, 0x1d3e9, 0x1d3ea, 0x1d3eb, 0x1d3ec, 0x1d3ed, 0x1d3ee, 0x1d3ef,
+ 0x1d3f0, 0x1d3f1, 0x1d3f2, 0x1d3f3, 0x1d3f4, 0x1d3f5, 0x1d3f6, 0x1d3f7,
+ 0x1d3f8, 0x1d3f9, 0x1d3fa, 0x1d3fb, 0x1d3fc, 0x1d3fd, 0x1d3fe, 0x1d3ff
+};
+
+static uint32_t unicode_520_ci_page_1d4[] = {
+ 0x00041, 0x00042, 0x00043, 0x00044, 0x00045, 0x00046, 0x00047, 0x00048,
+ 0x00049, 0x0004a, 0x0004b, 0x0004c, 0x0004d, 0x0004e, 0x0004f, 0x00050,
+ 0x00051, 0x00052, 0x00053, 0x00054, 0x00055, 0x00056, 0x00057, 0x00058,
+ 0x00059, 0x0005a, 0x00041, 0x00042, 0x00043, 0x00044, 0x00045, 0x00046,
+ 0x00047, 0x00048, 0x00049, 0x0004a, 0x0004b, 0x0004c, 0x0004d, 0x0004e,
+ 0x0004f, 0x00050, 0x00051, 0x00052, 0x00053, 0x00054, 0x00055, 0x00056,
+ 0x00057, 0x00058, 0x00059, 0x0005a, 0x00041, 0x00042, 0x00043, 0x00044,
+ 0x00045, 0x00046, 0x00047, 0x00048, 0x00049, 0x0004a, 0x0004b, 0x0004c,
+ 0x0004d, 0x0004e, 0x0004f, 0x00050, 0x00051, 0x00052, 0x00053, 0x00054,
+ 0x00055, 0x00056, 0x00057, 0x00058, 0x00059, 0x0005a, 0x00041, 0x00042,
+ 0x00043, 0x00044, 0x00045, 0x00046, 0x00047, 0x1d455, 0x00049, 0x0004a,
+ 0x0004b, 0x0004c, 0x0004d, 0x0004e, 0x0004f, 0x00050, 0x00051, 0x00052,
+ 0x00053, 0x00054, 0x00055, 0x00056, 0x00057, 0x00058, 0x00059, 0x0005a,
+ 0x00041, 0x00042, 0x00043, 0x00044, 0x00045, 0x00046, 0x00047, 0x00048,
+ 0x00049, 0x0004a, 0x0004b, 0x0004c, 0x0004d, 0x0004e, 0x0004f, 0x00050,
+ 0x00051, 0x00052, 0x00053, 0x00054, 0x00055, 0x00056, 0x00057, 0x00058,
+ 0x00059, 0x0005a, 0x00041, 0x00042, 0x00043, 0x00044, 0x00045, 0x00046,
+ 0x00047, 0x00048, 0x00049, 0x0004a, 0x0004b, 0x0004c, 0x0004d, 0x0004e,
+ 0x0004f, 0x00050, 0x00051, 0x00052, 0x00053, 0x00054, 0x00055, 0x00056,
+ 0x00057, 0x00058, 0x00059, 0x0005a, 0x00041, 0x1d49d, 0x00043, 0x00044,
+ 0x1d4a0, 0x1d4a1, 0x00047, 0x1d4a3, 0x1d4a4, 0x0004a, 0x0004b, 0x1d4a7,
+ 0x1d4a8, 0x0004e, 0x0004f, 0x00050, 0x00051, 0x1d4ad, 0x00053, 0x00054,
+ 0x00055, 0x00056, 0x00057, 0x00058, 0x00059, 0x0005a, 0x00041, 0x00042,
+ 0x00043, 0x00044, 0x1d4ba, 0x00046, 0x1d4bc, 0x00048, 0x00049, 0x0004a,
+ 0x0004b, 0x0004c, 0x0004d, 0x0004e, 0x1d4c4, 0x00050, 0x00051, 0x00052,
+ 0x00053, 0x00054, 0x00055, 0x00056, 0x00057, 0x00058, 0x00059, 0x0005a,
+ 0x00041, 0x00042, 0x00043, 0x00044, 0x00045, 0x00046, 0x00047, 0x00048,
+ 0x00049, 0x0004a, 0x0004b, 0x0004c, 0x0004d, 0x0004e, 0x0004f, 0x00050,
+ 0x00051, 0x00052, 0x00053, 0x00054, 0x00055, 0x00056, 0x00057, 0x00058,
+ 0x00059, 0x0005a, 0x00041, 0x00042, 0x00043, 0x00044, 0x00045, 0x00046,
+ 0x00047, 0x00048, 0x00049, 0x0004a, 0x0004b, 0x0004c, 0x0004d, 0x0004e,
+ 0x0004f, 0x00050, 0x00051, 0x00052, 0x00053, 0x00054, 0x00055, 0x1d4ff
+};
+
+static uint32_t unicode_520_ci_page_1d5[] = {
+ 0x00057, 0x00058, 0x00059, 0x0005a, 0x00041, 0x00042, 0x1d506, 0x00044,
+ 0x00045, 0x00046, 0x00047, 0x1d50b, 0x1d50c, 0x0004a, 0x0004b, 0x0004c,
+ 0x0004d, 0x0004e, 0x0004f, 0x00050, 0x00051, 0x1d515, 0x00053, 0x00054,
+ 0x00055, 0x00056, 0x00057, 0x00058, 0x00059, 0x1d51d, 0x00041, 0x00042,
+ 0x00043, 0x00044, 0x00045, 0x00046, 0x00047, 0x00048, 0x00049, 0x0004a,
+ 0x0004b, 0x0004c, 0x0004d, 0x0004e, 0x0004f, 0x00050, 0x00051, 0x00052,
+ 0x00053, 0x00054, 0x00055, 0x00056, 0x00057, 0x00058, 0x00059, 0x0005a,
+ 0x00041, 0x00042, 0x1d53a, 0x00044, 0x00045, 0x00046, 0x00047, 0x1d53f,
+ 0x00049, 0x0004a, 0x0004b, 0x0004c, 0x0004d, 0x1d545, 0x0004f, 0x1d547,
+ 0x1d548, 0x1d549, 0x00053, 0x00054, 0x00055, 0x00056, 0x00057, 0x00058,
+ 0x00059, 0x1d551, 0x00041, 0x00042, 0x00043, 0x00044, 0x00045, 0x00046,
+ 0x00047, 0x00048, 0x00049, 0x0004a, 0x0004b, 0x0004c, 0x0004d, 0x0004e,
+ 0x0004f, 0x00050, 0x00051, 0x00052, 0x00053, 0x00054, 0x00055, 0x00056,
+ 0x00057, 0x00058, 0x00059, 0x0005a, 0x00041, 0x00042, 0x00043, 0x00044,
+ 0x00045, 0x00046, 0x00047, 0x00048, 0x00049, 0x0004a, 0x0004b, 0x0004c,
+ 0x0004d, 0x0004e, 0x0004f, 0x00050, 0x00051, 0x00052, 0x00053, 0x00054,
+ 0x00055, 0x00056, 0x00057, 0x00058, 0x00059, 0x0005a, 0x00041, 0x00042,
+ 0x00043, 0x00044, 0x00045, 0x00046, 0x00047, 0x00048, 0x00049, 0x0004a,
+ 0x0004b, 0x0004c, 0x0004d, 0x0004e, 0x0004f, 0x00050, 0x00051, 0x00052,
+ 0x00053, 0x00054, 0x00055, 0x00056, 0x00057, 0x00058, 0x00059, 0x0005a,
+ 0x00041, 0x00042, 0x00043, 0x00044, 0x00045, 0x00046, 0x00047, 0x00048,
+ 0x00049, 0x0004a, 0x0004b, 0x0004c, 0x0004d, 0x0004e, 0x0004f, 0x00050,
+ 0x00051, 0x00052, 0x00053, 0x00054, 0x00055, 0x00056, 0x00057, 0x00058,
+ 0x00059, 0x0005a, 0x00041, 0x00042, 0x00043, 0x00044, 0x00045, 0x00046,
+ 0x00047, 0x00048, 0x00049, 0x0004a, 0x0004b, 0x0004c, 0x0004d, 0x0004e,
+ 0x0004f, 0x00050, 0x00051, 0x00052, 0x00053, 0x00054, 0x00055, 0x00056,
+ 0x00057, 0x00058, 0x00059, 0x0005a, 0x00041, 0x00042, 0x00043, 0x00044,
+ 0x00045, 0x00046, 0x00047, 0x00048, 0x00049, 0x0004a, 0x0004b, 0x0004c,
+ 0x0004d, 0x0004e, 0x0004f, 0x00050, 0x00051, 0x00052, 0x00053, 0x00054,
+ 0x00055, 0x00056, 0x00057, 0x00058, 0x00059, 0x0005a, 0x00041, 0x00042,
+ 0x00043, 0x00044, 0x00045, 0x00046, 0x00047, 0x00048, 0x00049, 0x0004a,
+ 0x0004b, 0x0004c, 0x0004d, 0x0004e, 0x0004f, 0x00050, 0x00051, 0x1d5ff
+};
+
+static uint32_t unicode_520_ci_page_1d6[] = {
+ 0x00053, 0x00054, 0x00055, 0x00056, 0x00057, 0x00058, 0x00059, 0x0005a,
+ 0x00041, 0x00042, 0x00043, 0x00044, 0x00045, 0x00046, 0x00047, 0x00048,
+ 0x00049, 0x0004a, 0x0004b, 0x0004c, 0x0004d, 0x0004e, 0x0004f, 0x00050,
+ 0x00051, 0x00052, 0x00053, 0x00054, 0x00055, 0x00056, 0x00057, 0x00058,
+ 0x00059, 0x0005a, 0x00041, 0x00042, 0x00043, 0x00044, 0x00045, 0x00046,
+ 0x00047, 0x00048, 0x00049, 0x0004a, 0x0004b, 0x0004c, 0x0004d, 0x0004e,
+ 0x0004f, 0x00050, 0x00051, 0x00052, 0x00053, 0x00054, 0x00055, 0x00056,
+ 0x00057, 0x00058, 0x00059, 0x0005a, 0x00041, 0x00042, 0x00043, 0x00044,
+ 0x00045, 0x00046, 0x00047, 0x00048, 0x00049, 0x0004a, 0x0004b, 0x0004c,
+ 0x0004d, 0x0004e, 0x0004f, 0x00050, 0x00051, 0x00052, 0x00053, 0x00054,
+ 0x00055, 0x00056, 0x00057, 0x00058, 0x00059, 0x0005a, 0x00041, 0x00042,
+ 0x00043, 0x00044, 0x00045, 0x00046, 0x00047, 0x00048, 0x00049, 0x0004a,
+ 0x0004b, 0x0004c, 0x0004d, 0x0004e, 0x0004f, 0x00050, 0x00051, 0x00052,
+ 0x00053, 0x00054, 0x00055, 0x00056, 0x00057, 0x00058, 0x00059, 0x0005a,
+ 0x00041, 0x00042, 0x00043, 0x00044, 0x00045, 0x00046, 0x00047, 0x00048,
+ 0x00049, 0x0004a, 0x0004b, 0x0004c, 0x0004d, 0x0004e, 0x0004f, 0x00050,
+ 0x00051, 0x00052, 0x00053, 0x00054, 0x00055, 0x00056, 0x00057, 0x00058,
+ 0x00059, 0x0005a, 0x00041, 0x00042, 0x00043, 0x00044, 0x00045, 0x00046,
+ 0x00047, 0x00048, 0x00049, 0x0004a, 0x0004b, 0x0004c, 0x0004d, 0x0004e,
+ 0x0004f, 0x00050, 0x00051, 0x00052, 0x00053, 0x00054, 0x00055, 0x00056,
+ 0x00057, 0x00058, 0x00059, 0x0005a, 0x00131, 0x00237, 0x1d6a6, 0x1d6a7,
+ 0x00391, 0x00392, 0x00393, 0x00394, 0x00395, 0x00396, 0x00397, 0x00398,
+ 0x00399, 0x0039a, 0x0039b, 0x0039c, 0x0039d, 0x0039e, 0x0039f, 0x003a0,
+ 0x003a1, 0x00398, 0x003a3, 0x003a4, 0x003a5, 0x003a6, 0x003a7, 0x003a8,
+ 0x003a9, 0x02207, 0x00391, 0x00392, 0x00393, 0x00394, 0x00395, 0x00396,
+ 0x00397, 0x00398, 0x00399, 0x0039a, 0x0039b, 0x0039c, 0x0039d, 0x0039e,
+ 0x0039f, 0x003a0, 0x003a1, 0x003a3, 0x003a3, 0x003a4, 0x003a5, 0x003a6,
+ 0x003a7, 0x003a8, 0x003a9, 0x02202, 0x00395, 0x00398, 0x0039a, 0x003a6,
+ 0x003a1, 0x003a0, 0x00391, 0x00392, 0x00393, 0x00394, 0x00395, 0x00396,
+ 0x00397, 0x00398, 0x00399, 0x0039a, 0x0039b, 0x0039c, 0x0039d, 0x0039e,
+ 0x0039f, 0x003a0, 0x003a1, 0x00398, 0x003a3, 0x003a4, 0x003a5, 0x003a6,
+ 0x003a7, 0x003a8, 0x003a9, 0x02207, 0x00391, 0x00392, 0x00393, 0x1d6ff
+};
+
+static uint32_t unicode_520_ci_page_1d7[] = {
+ 0x00395, 0x00396, 0x00397, 0x00398, 0x00399, 0x0039a, 0x0039b, 0x0039c,
+ 0x0039d, 0x0039e, 0x0039f, 0x003a0, 0x003a1, 0x003a3, 0x003a3, 0x003a4,
+ 0x003a5, 0x003a6, 0x003a7, 0x003a8, 0x003a9, 0x02202, 0x00395, 0x00398,
+ 0x0039a, 0x003a6, 0x003a1, 0x003a0, 0x00391, 0x00392, 0x00393, 0x00394,
+ 0x00395, 0x00396, 0x00397, 0x00398, 0x00399, 0x0039a, 0x0039b, 0x0039c,
+ 0x0039d, 0x0039e, 0x0039f, 0x003a0, 0x003a1, 0x00398, 0x003a3, 0x003a4,
+ 0x003a5, 0x003a6, 0x003a7, 0x003a8, 0x003a9, 0x02207, 0x00391, 0x00392,
+ 0x00393, 0x00394, 0x00395, 0x00396, 0x00397, 0x00398, 0x00399, 0x0039a,
+ 0x0039b, 0x0039c, 0x0039d, 0x0039e, 0x0039f, 0x003a0, 0x003a1, 0x003a3,
+ 0x003a3, 0x003a4, 0x003a5, 0x003a6, 0x003a7, 0x003a8, 0x003a9, 0x02202,
+ 0x00395, 0x00398, 0x0039a, 0x003a6, 0x003a1, 0x003a0, 0x00391, 0x00392,
+ 0x00393, 0x00394, 0x00395, 0x00396, 0x00397, 0x00398, 0x00399, 0x0039a,
+ 0x0039b, 0x0039c, 0x0039d, 0x0039e, 0x0039f, 0x003a0, 0x003a1, 0x00398,
+ 0x003a3, 0x003a4, 0x003a5, 0x003a6, 0x003a7, 0x003a8, 0x003a9, 0x02207,
+ 0x00391, 0x00392, 0x00393, 0x00394, 0x00395, 0x00396, 0x00397, 0x00398,
+ 0x00399, 0x0039a, 0x0039b, 0x0039c, 0x0039d, 0x0039e, 0x0039f, 0x003a0,
+ 0x003a1, 0x003a3, 0x003a3, 0x003a4, 0x003a5, 0x003a6, 0x003a7, 0x003a8,
+ 0x003a9, 0x02202, 0x00395, 0x00398, 0x0039a, 0x003a6, 0x003a1, 0x003a0,
+ 0x00391, 0x00392, 0x00393, 0x00394, 0x00395, 0x00396, 0x00397, 0x00398,
+ 0x00399, 0x0039a, 0x0039b, 0x0039c, 0x0039d, 0x0039e, 0x0039f, 0x003a0,
+ 0x003a1, 0x00398, 0x003a3, 0x003a4, 0x003a5, 0x003a6, 0x003a7, 0x003a8,
+ 0x003a9, 0x02207, 0x00391, 0x00392, 0x00393, 0x00394, 0x00395, 0x00396,
+ 0x00397, 0x00398, 0x00399, 0x0039a, 0x0039b, 0x0039c, 0x0039d, 0x0039e,
+ 0x0039f, 0x003a0, 0x003a1, 0x003a3, 0x003a3, 0x003a4, 0x003a5, 0x003a6,
+ 0x003a7, 0x003a8, 0x003a9, 0x02202, 0x00395, 0x00398, 0x0039a, 0x003a6,
+ 0x003a1, 0x003a0, 0x003dc, 0x003dc, 0x1d7cc, 0x1d7cd, 0x00030, 0x00031,
+ 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037, 0x00038, 0x00039,
+ 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037,
+ 0x00038, 0x00039, 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, 0x00035,
+ 0x00036, 0x00037, 0x00038, 0x00039, 0x00030, 0x00031, 0x00032, 0x00033,
+ 0x00034, 0x00035, 0x00036, 0x00037, 0x00038, 0x00039, 0x00030, 0x00031,
+ 0x00032, 0x00033, 0x00034, 0x00035, 0x00036, 0x00037, 0x00038, 0x1d7ff
+};
+
+static uint32_t unicode_520_ci_page_1f1[] = {
+ 0x1f100, 0x1f101, 0x1f102, 0x1f103, 0x1f104, 0x1f105, 0x1f106, 0x1f107,
+ 0x1f108, 0x1f109, 0x1f10a, 0x1f10b, 0x1f10c, 0x1f10d, 0x1f10e, 0x1f10f,
+ 0x0249c, 0x0249d, 0x0249e, 0x0249f, 0x024a0, 0x024a1, 0x024a2, 0x024a3,
+ 0x024a4, 0x024a5, 0x024a6, 0x024a7, 0x024a8, 0x024a9, 0x024aa, 0x024ab,
+ 0x024ac, 0x024ad, 0x024ae, 0x024af, 0x024b0, 0x024b1, 0x024b2, 0x024b3,
+ 0x024b4, 0x024b5, 0x1f12a, 0x00043, 0x00052, 0x033c5, 0x1f12e, 0x1f12f,
+ 0x1f130, 0x00042, 0x1f132, 0x1f133, 0x1f134, 0x1f135, 0x1f136, 0x1f137,
+ 0x1f138, 0x1f139, 0x1f13a, 0x1f13b, 0x1f13c, 0x0004e, 0x1f13e, 0x00050,
+ 0x1f140, 0x1f141, 0x00053, 0x1f143, 0x1f144, 0x1f145, 0x00057, 0x1f147,
+ 0x1f148, 0x1f149, 0x1f14a, 0x033b7, 0x1f14c, 0x000df, 0x1f14e, 0x1f14f,
+ 0x1f150, 0x1f151, 0x1f152, 0x1f153, 0x1f154, 0x1f155, 0x1f156, 0x00048,
+ 0x1f158, 0x1f159, 0x1f15a, 0x1f15b, 0x1f15c, 0x1f15d, 0x1f15e, 0x00050,
+ 0x1f160, 0x1f161, 0x1f162, 0x1f163, 0x1f164, 0x1f165, 0x1f166, 0x1f167,
+ 0x1f168, 0x1f169, 0x1f16a, 0x1f16b, 0x1f16c, 0x1f16d, 0x1f16e, 0x1f16f,
+ 0x1f170, 0x1f171, 0x1f172, 0x1f173, 0x1f174, 0x1f175, 0x1f176, 0x1f177,
+ 0x1f178, 0x0004a, 0x1f17a, 0x0004c, 0x0004d, 0x1f17d, 0x1f17e, 0x00050,
+ 0x1f180, 0x1f181, 0x1f182, 0x1f183, 0x1f184, 0x1f185, 0x1f186, 0x1f187,
+ 0x1f188, 0x1f189, 0x00050, 0x1f18b, 0x03380, 0x1f18d, 0x1f18e, 0x1f18f,
+ 0x1f190, 0x1f191, 0x1f192, 0x1f193, 0x1f194, 0x1f195, 0x1f196, 0x1f197,
+ 0x1f198, 0x1f199, 0x1f19a, 0x1f19b, 0x1f19c, 0x1f19d, 0x1f19e, 0x1f19f,
+ 0x1f1a0, 0x1f1a1, 0x1f1a2, 0x1f1a3, 0x1f1a4, 0x1f1a5, 0x1f1a6, 0x1f1a7,
+ 0x1f1a8, 0x1f1a9, 0x1f1aa, 0x1f1ab, 0x1f1ac, 0x1f1ad, 0x1f1ae, 0x1f1af,
+ 0x1f1b0, 0x1f1b1, 0x1f1b2, 0x1f1b3, 0x1f1b4, 0x1f1b5, 0x1f1b6, 0x1f1b7,
+ 0x1f1b8, 0x1f1b9, 0x1f1ba, 0x1f1bb, 0x1f1bc, 0x1f1bd, 0x1f1be, 0x1f1bf,
+ 0x1f1c0, 0x1f1c1, 0x1f1c2, 0x1f1c3, 0x1f1c4, 0x1f1c5, 0x1f1c6, 0x1f1c7,
+ 0x1f1c8, 0x1f1c9, 0x1f1ca, 0x1f1cb, 0x1f1cc, 0x1f1cd, 0x1f1ce, 0x1f1cf,
+ 0x1f1d0, 0x1f1d1, 0x1f1d2, 0x1f1d3, 0x1f1d4, 0x1f1d5, 0x1f1d6, 0x1f1d7,
+ 0x1f1d8, 0x1f1d9, 0x1f1da, 0x1f1db, 0x1f1dc, 0x1f1dd, 0x1f1de, 0x1f1df,
+ 0x1f1e0, 0x1f1e1, 0x1f1e2, 0x1f1e3, 0x1f1e4, 0x1f1e5, 0x1f1e6, 0x1f1e7,
+ 0x1f1e8, 0x1f1e9, 0x1f1ea, 0x1f1eb, 0x1f1ec, 0x1f1ed, 0x1f1ee, 0x1f1ef,
+ 0x1f1f0, 0x1f1f1, 0x1f1f2, 0x1f1f3, 0x1f1f4, 0x1f1f5, 0x1f1f6, 0x1f1f7,
+ 0x1f1f8, 0x1f1f9, 0x1f1fa, 0x1f1fb, 0x1f1fc, 0x1f1fd, 0x1f1fe, 0x1f1ff
+};
+
+static uint32_t unicode_520_ci_page_1f2[] = {
+ 0x1f200, 0x1f201, 0x1f202, 0x1f203, 0x1f204, 0x1f205, 0x1f206, 0x1f207,
+ 0x1f208, 0x1f209, 0x1f20a, 0x1f20b, 0x1f20c, 0x1f20d, 0x1f20e, 0x1f20f,
+ 0x02f3f, 0x1f211, 0x1f212, 0x03066, 0x03193, 0x1f215, 0x1f216, 0x0319d,
+ 0x1f218, 0x1f219, 0x1f21a, 0x0f9be, 0x1f21c, 0x1f21d, 0x1f21e, 0x1f21f,
+ 0x1f220, 0x1f221, 0x02f63, 0x1f223, 0x1f224, 0x1f225, 0x1f226, 0x1f227,
+ 0x1f228, 0x03192, 0x03194, 0x1f22b, 0x032a7, 0x03197, 0x032a8, 0x1f22f,
+ 0x02f9b, 0x1f231, 0x1f232, 0x1f233, 0x1f234, 0x1f235, 0x1f236, 0x1f237,
+ 0x1f238, 0x1f239, 0x1f23a, 0x1f23b, 0x1f23c, 0x1f23d, 0x1f23e, 0x1f23f,
+ 0x1f240, 0x1f241, 0x1f242, 0x1f243, 0x1f244, 0x1f245, 0x1f246, 0x1f247,
+ 0x1f248, 0x1f249, 0x1f24a, 0x1f24b, 0x1f24c, 0x1f24d, 0x1f24e, 0x1f24f,
+ 0x1f250, 0x1f251, 0x1f252, 0x1f253, 0x1f254, 0x1f255, 0x1f256, 0x1f257,
+ 0x1f258, 0x1f259, 0x1f25a, 0x1f25b, 0x1f25c, 0x1f25d, 0x1f25e, 0x1f25f,
+ 0x1f260, 0x1f261, 0x1f262, 0x1f263, 0x1f264, 0x1f265, 0x1f266, 0x1f267,
+ 0x1f268, 0x1f269, 0x1f26a, 0x1f26b, 0x1f26c, 0x1f26d, 0x1f26e, 0x1f26f,
+ 0x1f270, 0x1f271, 0x1f272, 0x1f273, 0x1f274, 0x1f275, 0x1f276, 0x1f277,
+ 0x1f278, 0x1f279, 0x1f27a, 0x1f27b, 0x1f27c, 0x1f27d, 0x1f27e, 0x1f27f,
+ 0x1f280, 0x1f281, 0x1f282, 0x1f283, 0x1f284, 0x1f285, 0x1f286, 0x1f287,
+ 0x1f288, 0x1f289, 0x1f28a, 0x1f28b, 0x1f28c, 0x1f28d, 0x1f28e, 0x1f28f,
+ 0x1f290, 0x1f291, 0x1f292, 0x1f293, 0x1f294, 0x1f295, 0x1f296, 0x1f297,
+ 0x1f298, 0x1f299, 0x1f29a, 0x1f29b, 0x1f29c, 0x1f29d, 0x1f29e, 0x1f29f,
+ 0x1f2a0, 0x1f2a1, 0x1f2a2, 0x1f2a3, 0x1f2a4, 0x1f2a5, 0x1f2a6, 0x1f2a7,
+ 0x1f2a8, 0x1f2a9, 0x1f2aa, 0x1f2ab, 0x1f2ac, 0x1f2ad, 0x1f2ae, 0x1f2af,
+ 0x1f2b0, 0x1f2b1, 0x1f2b2, 0x1f2b3, 0x1f2b4, 0x1f2b5, 0x1f2b6, 0x1f2b7,
+ 0x1f2b8, 0x1f2b9, 0x1f2ba, 0x1f2bb, 0x1f2bc, 0x1f2bd, 0x1f2be, 0x1f2bf,
+ 0x1f2c0, 0x1f2c1, 0x1f2c2, 0x1f2c3, 0x1f2c4, 0x1f2c5, 0x1f2c6, 0x1f2c7,
+ 0x1f2c8, 0x1f2c9, 0x1f2ca, 0x1f2cb, 0x1f2cc, 0x1f2cd, 0x1f2ce, 0x1f2cf,
+ 0x1f2d0, 0x1f2d1, 0x1f2d2, 0x1f2d3, 0x1f2d4, 0x1f2d5, 0x1f2d6, 0x1f2d7,
+ 0x1f2d8, 0x1f2d9, 0x1f2da, 0x1f2db, 0x1f2dc, 0x1f2dd, 0x1f2de, 0x1f2df,
+ 0x1f2e0, 0x1f2e1, 0x1f2e2, 0x1f2e3, 0x1f2e4, 0x1f2e5, 0x1f2e6, 0x1f2e7,
+ 0x1f2e8, 0x1f2e9, 0x1f2ea, 0x1f2eb, 0x1f2ec, 0x1f2ed, 0x1f2ee, 0x1f2ef,
+ 0x1f2f0, 0x1f2f1, 0x1f2f2, 0x1f2f3, 0x1f2f4, 0x1f2f5, 0x1f2f6, 0x1f2f7,
+ 0x1f2f8, 0x1f2f9, 0x1f2fa, 0x1f2fb, 0x1f2fc, 0x1f2fd, 0x1f2fe, 0x1f2ff
+};
+
+static uint32_t unicode_520_ci_page_2f8[] = {
+ 0x2f800, 0x2f801, 0x2f802, 0x2f803, 0x2f804, 0x0fa30, 0x2f806, 0x2f807,
+ 0x2f808, 0x2f809, 0x0fa31, 0x2f80b, 0x2f80c, 0x2f80d, 0x0fa32, 0x2f80f,
+ 0x2f810, 0x2f811, 0x2f812, 0x2f813, 0x2f814, 0x1f21e, 0x2f816, 0x2f817,
+ 0x2f818, 0x2f819, 0x2f81a, 0x0fa71, 0x2f81c, 0x02f10, 0x2f81e, 0x2f81f,
+ 0x2f820, 0x2f821, 0x2f822, 0x2f823, 0x2f824, 0x0fa76, 0x0fa33, 0x0fa34,
+ 0x0fa77, 0x2f829, 0x2f82a, 0x0f963, 0x2f82c, 0x0fa35, 0x2f82e, 0x2f82f,
+ 0x2f830, 0x2f831, 0x2f831, 0x2f831, 0x2f834, 0x2f835, 0x2f836, 0x2f837,
+ 0x2f838, 0x2f839, 0x2f83a, 0x2f83b, 0x2f83c, 0x2f83d, 0x2f83e, 0x2f83f,
+ 0x2f840, 0x2f841, 0x2f842, 0x2f843, 0x2f844, 0x2f845, 0x2f845, 0x0fa7a,
+ 0x2f848, 0x2f849, 0x2f84a, 0x2f84b, 0x0fa37, 0x2f84d, 0x2f84e, 0x2f84f,
+ 0x0fa00, 0x2f851, 0x2f852, 0x2f853, 0x2f854, 0x2f855, 0x2f856, 0x2f857,
+ 0x2f858, 0x2f859, 0x2f85a, 0x2f85b, 0x2f85c, 0x1f215, 0x2f85e, 0x2f85f,
+ 0x2f860, 0x2f861, 0x2f862, 0x2f863, 0x2f864, 0x2f865, 0x2f866, 0x2f867,
+ 0x2f868, 0x2f869, 0x2f86a, 0x2f86a, 0x2f86c, 0x2f86d, 0x2f86e, 0x0f95f,
+ 0x2f870, 0x2f871, 0x2f872, 0x2f873, 0x2f874, 0x02e8e, 0x2f876, 0x2f877,
+ 0x02f2c, 0x2f879, 0x2f87a, 0x2f87b, 0x2f87c, 0x2f87d, 0x2f87e, 0x2f87f,
+ 0x2f880, 0x2f881, 0x2f882, 0x2f883, 0x2f884, 0x2f885, 0x2f886, 0x2f887,
+ 0x2f888, 0x2f889, 0x2f88a, 0x2f88b, 0x2f88c, 0x2f88d, 0x0f928, 0x2f88f,
+ 0x02f36, 0x2f891, 0x2f891, 0x2f893, 0x2f894, 0x2f894, 0x2f896, 0x2f897,
+ 0x2f898, 0x2f899, 0x2f89a, 0x2f89b, 0x2f89c, 0x2f89d, 0x2f89e, 0x2f89f,
+ 0x2f8a0, 0x2f8a1, 0x2f8a2, 0x0fa3d, 0x2f8a4, 0x2f8a5, 0x2f8a6, 0x2f8a7,
+ 0x0fa87, 0x2f8a7, 0x2f8aa, 0x0fa3f, 0x2f8ac, 0x2f8ad, 0x2f8ae, 0x2f8af,
+ 0x0fa40, 0x0f90d, 0x2f8b2, 0x2f8b3, 0x2f8b4, 0x2f8b5, 0x2f8b6, 0x2f8b7,
+ 0x2f8b8, 0x2f8b9, 0x2f8ba, 0x2f8bb, 0x2f8bc, 0x2f8bd, 0x2f8be, 0x2f8bf,
+ 0x2f8c0, 0x2f8c1, 0x2f8c2, 0x2f8c3, 0x2f8c4, 0x2f8c5, 0x2f8c6, 0x2f8c7,
+ 0x0fa41, 0x2f8c9, 0x2f8ca, 0x2f8cb, 0x2f8cc, 0x2f8cd, 0x2f8ce, 0x0fa43,
+ 0x2f8d0, 0x2f8d1, 0x2f8d2, 0x2f8d3, 0x2f8d4, 0x2f8d5, 0x2f8d6, 0x2f8d7,
+ 0x0f929, 0x0fa93, 0x2f8da, 0x2f8db, 0x2f8dc, 0x2f8dd, 0x2f8de, 0x2f8df,
+ 0x2f8e0, 0x2f8e1, 0x0fa44, 0x2f8e3, 0x2f8e4, 0x2f8e5, 0x2f8e6, 0x0fad2,
+ 0x2f8e8, 0x2f8e9, 0x2f8ea, 0x2f8eb, 0x2f8ec, 0x2f8ed, 0x2f8ee, 0x2f8ef,
+ 0x2f8f0, 0x2f8f1, 0x2f8f2, 0x2f8f3, 0x2f8f4, 0x0f970, 0x2f8f6, 0x2f8f7,
+ 0x2f8f8, 0x2f8f9, 0x2f8fa, 0x2f8fb, 0x2f8fc, 0x2f8fd, 0x2f8fe, 0x2f8ff
+};
+
+static uint32_t unicode_520_ci_page_2f9[] = {
+ 0x2f900, 0x0fa45, 0x0f9ca, 0x2f903, 0x2f904, 0x2f905, 0x2f906, 0x2f907,
+ 0x2f908, 0x2f909, 0x2f90a, 0x0fa99, 0x2f90c, 0x2f90d, 0x2f90e, 0x2f90f,
+ 0x2f910, 0x2f911, 0x2f912, 0x2f913, 0x0fa9b, 0x2f915, 0x2f916, 0x2f917,
+ 0x2f918, 0x2f919, 0x2f91a, 0x2f91b, 0x2f91c, 0x2f91d, 0x2f91e, 0x2f91f,
+ 0x2f920, 0x0fa9e, 0x2f922, 0x2f923, 0x2f924, 0x2f925, 0x2f926, 0x2f927,
+ 0x2f928, 0x02ea9, 0x2f92a, 0x2f92b, 0x2f92c, 0x2f92c, 0x2f92e, 0x2f92f,
+ 0x0faa1, 0x2f931, 0x2f932, 0x2f933, 0x2f934, 0x2f935, 0x2f936, 0x2f937,
+ 0x0f962, 0x2f939, 0x2f93a, 0x2f93b, 0x2f93c, 0x2f93d, 0x2f93e, 0x2f93f,
+ 0x0faa8, 0x2f941, 0x2f942, 0x2f943, 0x2f944, 0x2f945, 0x2f946, 0x2f946,
+ 0x0faa9, 0x0fad4, 0x2f94a, 0x2f94b, 0x2f94c, 0x2f94d, 0x2f94e, 0x0f93b,
+ 0x0faab, 0x2f951, 0x2f952, 0x0fa50, 0x2f954, 0x2f955, 0x0fa1b, 0x2f957,
+ 0x2f958, 0x0fa54, 0x2f95a, 0x2f95b, 0x2f95c, 0x2f95d, 0x2f95d, 0x2f95f,
+ 0x2f960, 0x2f961, 0x2f962, 0x2f963, 0x2f964, 0x2f965, 0x2f966, 0x2f967,
+ 0x2f968, 0x2f969, 0x2f96a, 0x2f96b, 0x2f96c, 0x2f96d, 0x2f96e, 0x2f96f,
+ 0x2f970, 0x2f971, 0x2f972, 0x2f973, 0x2f974, 0x2f975, 0x2f976, 0x2f977,
+ 0x2f978, 0x2f979, 0x0fa5b, 0x2f97b, 0x2f97c, 0x2f97d, 0x2f97e, 0x2f97f,
+ 0x2f980, 0x2f981, 0x2f982, 0x2f983, 0x2f984, 0x2f985, 0x2f986, 0x2f987,
+ 0x2f988, 0x2f989, 0x2f98a, 0x2f893, 0x2f98c, 0x2f98d, 0x2f98e, 0x2f98f,
+ 0x2f990, 0x2f991, 0x2f992, 0x2f993, 0x2f994, 0x2f995, 0x2f996, 0x2f997,
+ 0x0f974, 0x2f999, 0x2f99a, 0x2f99b, 0x2f99c, 0x2f99d, 0x2f99e, 0x0fa5f,
+ 0x2f9a0, 0x2f9a1, 0x2f9a2, 0x2f9a3, 0x2f9a4, 0x2f9a5, 0x2f9a6, 0x2f9a7,
+ 0x2f9a8, 0x2f9a9, 0x2f9aa, 0x2f9ab, 0x2f9ac, 0x2f9ad, 0x2f9ae, 0x2f9af,
+ 0x2f9b0, 0x2f9b1, 0x2f9b2, 0x2f9b3, 0x0f936, 0x2f9b5, 0x2f9b6, 0x2f9b7,
+ 0x2f9b8, 0x2f9b9, 0x2f9ba, 0x0fab5, 0x2f9bc, 0x2f9bd, 0x2f9be, 0x2f9bf,
+ 0x2f9c0, 0x2f9c1, 0x2f9c2, 0x2f9c3, 0x02f90, 0x2f9c5, 0x2f9c6, 0x2f9c7,
+ 0x2f9c8, 0x2f9c9, 0x2f9ca, 0x2f9cb, 0x2f9cc, 0x2f9cd, 0x2f9ce, 0x2f9cf,
+ 0x0fabe, 0x0fac0, 0x02f97, 0x2f9d3, 0x2f9d4, 0x2f9d5, 0x2f9d6, 0x2f9d7,
+ 0x2f9d8, 0x2f9d9, 0x2f9da, 0x2f9db, 0x2f9dc, 0x2f9dd, 0x2f9de, 0x0fac2,
+ 0x2f9e0, 0x2f9e1, 0x2f9e2, 0x2f9e3, 0x2f9e4, 0x2f9e5, 0x2f9e6, 0x2f9e7,
+ 0x2f9e8, 0x2f9e9, 0x2f9ea, 0x2f9eb, 0x2f9ec, 0x2f9ed, 0x2f9ee, 0x2f9ef,
+ 0x2f9f0, 0x2f9f1, 0x2f9f2, 0x2f9f3, 0x2f9f4, 0x2f9f5, 0x2f9f6, 0x2f9f7,
+ 0x2f9f8, 0x2f9f9, 0x2f9fa, 0x2f9fb, 0x2f9fc, 0x2f9fd, 0x0facb, 0x2f9ff
+};
+
+static uint32_t unicode_520_ci_page_2fa[] = {
+ 0x2fa00, 0x2fa01, 0x2fa02, 0x2fa03, 0x2fa04, 0x2fa05, 0x2fa06, 0x2fa07,
+ 0x2fa08, 0x2fa09, 0x0facd, 0x2fa0b, 0x2fa0c, 0x2fa0d, 0x2fa0e, 0x2fa0f,
+ 0x2fa10, 0x2fa11, 0x2fa12, 0x2fa13, 0x2fa14, 0x02fc7, 0x04d56, 0x02fcb,
+ 0x02eea, 0x2fa19, 0x2fa1a, 0x2fa1b, 0x02fd0, 0x2fa1d, 0x2fa1e, 0x2fa1f,
+ 0x2fa20, 0x2fa21, 0x2fa22, 0x2fa23, 0x2fa24, 0x2fa25, 0x2fa26, 0x2fa27,
+ 0x2fa28, 0x2fa29, 0x2fa2a, 0x2fa2b, 0x2fa2c, 0x2fa2d, 0x2fa2e, 0x2fa2f,
+ 0x2fa30, 0x2fa31, 0x2fa32, 0x2fa33, 0x2fa34, 0x2fa35, 0x2fa36, 0x2fa37,
+ 0x2fa38, 0x2fa39, 0x2fa3a, 0x2fa3b, 0x2fa3c, 0x2fa3d, 0x2fa3e, 0x2fa3f,
+ 0x2fa40, 0x2fa41, 0x2fa42, 0x2fa43, 0x2fa44, 0x2fa45, 0x2fa46, 0x2fa47,
+ 0x2fa48, 0x2fa49, 0x2fa4a, 0x2fa4b, 0x2fa4c, 0x2fa4d, 0x2fa4e, 0x2fa4f,
+ 0x2fa50, 0x2fa51, 0x2fa52, 0x2fa53, 0x2fa54, 0x2fa55, 0x2fa56, 0x2fa57,
+ 0x2fa58, 0x2fa59, 0x2fa5a, 0x2fa5b, 0x2fa5c, 0x2fa5d, 0x2fa5e, 0x2fa5f,
+ 0x2fa60, 0x2fa61, 0x2fa62, 0x2fa63, 0x2fa64, 0x2fa65, 0x2fa66, 0x2fa67,
+ 0x2fa68, 0x2fa69, 0x2fa6a, 0x2fa6b, 0x2fa6c, 0x2fa6d, 0x2fa6e, 0x2fa6f,
+ 0x2fa70, 0x2fa71, 0x2fa72, 0x2fa73, 0x2fa74, 0x2fa75, 0x2fa76, 0x2fa77,
+ 0x2fa78, 0x2fa79, 0x2fa7a, 0x2fa7b, 0x2fa7c, 0x2fa7d, 0x2fa7e, 0x2fa7f,
+ 0x2fa80, 0x2fa81, 0x2fa82, 0x2fa83, 0x2fa84, 0x2fa85, 0x2fa86, 0x2fa87,
+ 0x2fa88, 0x2fa89, 0x2fa8a, 0x2fa8b, 0x2fa8c, 0x2fa8d, 0x2fa8e, 0x2fa8f,
+ 0x2fa90, 0x2fa91, 0x2fa92, 0x2fa93, 0x2fa94, 0x2fa95, 0x2fa96, 0x2fa97,
+ 0x2fa98, 0x2fa99, 0x2fa9a, 0x2fa9b, 0x2fa9c, 0x2fa9d, 0x2fa9e, 0x2fa9f,
+ 0x2faa0, 0x2faa1, 0x2faa2, 0x2faa3, 0x2faa4, 0x2faa5, 0x2faa6, 0x2faa7,
+ 0x2faa8, 0x2faa9, 0x2faaa, 0x2faab, 0x2faac, 0x2faad, 0x2faae, 0x2faaf,
+ 0x2fab0, 0x2fab1, 0x2fab2, 0x2fab3, 0x2fab4, 0x2fab5, 0x2fab6, 0x2fab7,
+ 0x2fab8, 0x2fab9, 0x2faba, 0x2fabb, 0x2fabc, 0x2fabd, 0x2fabe, 0x2fabf,
+ 0x2fac0, 0x2fac1, 0x2fac2, 0x2fac3, 0x2fac4, 0x2fac5, 0x2fac6, 0x2fac7,
+ 0x2fac8, 0x2fac9, 0x2faca, 0x2facb, 0x2facc, 0x2facd, 0x2face, 0x2facf,
+ 0x2fad0, 0x2fad1, 0x2fad2, 0x2fad3, 0x2fad4, 0x2fad5, 0x2fad6, 0x2fad7,
+ 0x2fad8, 0x2fad9, 0x2fada, 0x2fadb, 0x2fadc, 0x2fadd, 0x2fade, 0x2fadf,
+ 0x2fae0, 0x2fae1, 0x2fae2, 0x2fae3, 0x2fae4, 0x2fae5, 0x2fae6, 0x2fae7,
+ 0x2fae8, 0x2fae9, 0x2faea, 0x2faeb, 0x2faec, 0x2faed, 0x2faee, 0x2faef,
+ 0x2faf0, 0x2faf1, 0x2faf2, 0x2faf3, 0x2faf4, 0x2faf5, 0x2faf6, 0x2faf7,
+ 0x2faf8, 0x2faf9, 0x2fafa, 0x2fafb, 0x2fafc, 0x2fafd, 0x2fafe, 0x2faff
+};
+
+static uint32_t unicode_520_ci_page_e00[] = {
+ 0xe0000, 0x00000, 0xe0002, 0xe0003, 0xe0004, 0xe0005, 0xe0006, 0xe0007,
+ 0xe0008, 0xe0009, 0xe000a, 0xe000b, 0xe000c, 0xe000d, 0xe000e, 0xe000f,
+ 0xe0010, 0xe0011, 0xe0012, 0xe0013, 0xe0014, 0xe0015, 0xe0016, 0xe0017,
+ 0xe0018, 0xe0019, 0xe001a, 0xe001b, 0xe001c, 0xe001d, 0xe001e, 0xe001f,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0xe0080, 0xe0081, 0xe0082, 0xe0083, 0xe0084, 0xe0085, 0xe0086, 0xe0087,
+ 0xe0088, 0xe0089, 0xe008a, 0xe008b, 0xe008c, 0xe008d, 0xe008e, 0xe008f,
+ 0xe0090, 0xe0091, 0xe0092, 0xe0093, 0xe0094, 0xe0095, 0xe0096, 0xe0097,
+ 0xe0098, 0xe0099, 0xe009a, 0xe009b, 0xe009c, 0xe009d, 0xe009e, 0xe009f,
+ 0xe00a0, 0xe00a1, 0xe00a2, 0xe00a3, 0xe00a4, 0xe00a5, 0xe00a6, 0xe00a7,
+ 0xe00a8, 0xe00a9, 0xe00aa, 0xe00ab, 0xe00ac, 0xe00ad, 0xe00ae, 0xe00af,
+ 0xe00b0, 0xe00b1, 0xe00b2, 0xe00b3, 0xe00b4, 0xe00b5, 0xe00b6, 0xe00b7,
+ 0xe00b8, 0xe00b9, 0xe00ba, 0xe00bb, 0xe00bc, 0xe00bd, 0xe00be, 0xe00bf,
+ 0xe00c0, 0xe00c1, 0xe00c2, 0xe00c3, 0xe00c4, 0xe00c5, 0xe00c6, 0xe00c7,
+ 0xe00c8, 0xe00c9, 0xe00ca, 0xe00cb, 0xe00cc, 0xe00cd, 0xe00ce, 0xe00cf,
+ 0xe00d0, 0xe00d1, 0xe00d2, 0xe00d3, 0xe00d4, 0xe00d5, 0xe00d6, 0xe00d7,
+ 0xe00d8, 0xe00d9, 0xe00da, 0xe00db, 0xe00dc, 0xe00dd, 0xe00de, 0xe00df,
+ 0xe00e0, 0xe00e1, 0xe00e2, 0xe00e3, 0xe00e4, 0xe00e5, 0xe00e6, 0xe00e7,
+ 0xe00e8, 0xe00e9, 0xe00ea, 0xe00eb, 0xe00ec, 0xe00ed, 0xe00ee, 0xe00ef,
+ 0xe00f0, 0xe00f1, 0xe00f2, 0xe00f3, 0xe00f4, 0xe00f5, 0xe00f6, 0xe00f7,
+ 0xe00f8, 0xe00f9, 0xe00fa, 0xe00fb, 0xe00fc, 0xe00fd, 0xe00fe, 0xe00ff
+};
+
+static uint32_t unicode_520_ci_page_e01[] = {
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0xe01f0, 0xe01f1, 0xe01f2, 0xe01f3, 0xe01f4, 0xe01f5, 0xe01f6, 0xe01f7,
+ 0xe01f8, 0xe01f9, 0xe01fa, 0xe01fb, 0xe01fc, 0xe01fd, 0xe01fe, 0xe01ff
+};
+
+static uint32_t *unicode_520_ci_table[4352] = {
+ unicode_520_ci_page_00, unicode_520_ci_page_01,
+ unicode_520_ci_page_02, unicode_520_ci_page_03,
+ unicode_520_ci_page_04, unicode_520_ci_page_05,
+ unicode_520_ci_page_06, unicode_520_ci_page_07,
+ unicode_520_ci_page_08, unicode_520_ci_page_09,
+ unicode_520_ci_page_0a, unicode_520_ci_page_0b,
+ unicode_520_ci_page_0c, unicode_520_ci_page_0d,
+ unicode_520_ci_page_0e, unicode_520_ci_page_0f,
+ unicode_520_ci_page_10, NULL,
+ NULL, unicode_520_ci_page_13,
+ NULL, NULL,
+ unicode_520_ci_page_16, unicode_520_ci_page_17,
+ unicode_520_ci_page_18, unicode_520_ci_page_19,
+ unicode_520_ci_page_1a, unicode_520_ci_page_1b,
+ unicode_520_ci_page_1c, unicode_520_ci_page_1d,
+ unicode_520_ci_page_1e, unicode_520_ci_page_1f,
+ unicode_520_ci_page_20, unicode_520_ci_page_21,
+ unicode_520_ci_page_22, NULL,
+ unicode_520_ci_page_24, NULL,
+ NULL, unicode_520_ci_page_27,
+ NULL, NULL,
+ unicode_520_ci_page_2a, NULL,
+ unicode_520_ci_page_2c, unicode_520_ci_page_2d,
+ unicode_520_ci_page_2e, unicode_520_ci_page_2f,
+ unicode_520_ci_page_30, unicode_520_ci_page_31,
+ unicode_520_ci_page_32, unicode_520_ci_page_33,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ unicode_520_ci_page_a6, unicode_520_ci_page_a7,
+ unicode_520_ci_page_a8, unicode_520_ci_page_a9,
+ unicode_520_ci_page_aa, unicode_520_ci_page_ab,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, unicode_520_ci_page_f9,
+ unicode_520_ci_page_fa, unicode_520_ci_page_fb,
+ unicode_520_ci_page_fc, unicode_520_ci_page_fd,
+ unicode_520_ci_page_fe, unicode_520_ci_page_ff,
+ NULL, unicode_520_ci_page_101,
+ NULL, unicode_520_ci_page_103,
+ unicode_520_ci_page_104, NULL,
+ NULL, NULL,
+ unicode_520_ci_page_108, unicode_520_ci_page_109,
+ unicode_520_ci_page_10a, unicode_520_ci_page_10b,
+ unicode_520_ci_page_10c, NULL,
+ unicode_520_ci_page_10e, NULL,
+ unicode_520_ci_page_110, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ unicode_520_ci_page_124, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, unicode_520_ci_page_1d1,
+ unicode_520_ci_page_1d2, unicode_520_ci_page_1d3,
+ unicode_520_ci_page_1d4, unicode_520_ci_page_1d5,
+ unicode_520_ci_page_1d6, unicode_520_ci_page_1d7,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, unicode_520_ci_page_1f1,
+ unicode_520_ci_page_1f2, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ unicode_520_ci_page_2f8, unicode_520_ci_page_2f9,
+ unicode_520_ci_page_2fa, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ unicode_520_ci_page_e00, unicode_520_ci_page_e01,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL
+};
+
+#endif
diff --git a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql_unicode_ci_except_kana_ci_kana_with_voiced_sound_mark_table.h b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql_unicode_ci_except_kana_ci_kana_with_voiced_sound_mark_table.h
index 4e6b6c539f4..7153cb1872e 100644
--- a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql_unicode_ci_except_kana_ci_kana_with_voiced_sound_mark_table.h
+++ b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql_unicode_ci_except_kana_ci_kana_with_voiced_sound_mark_table.h
@@ -1,5 +1,5 @@
/*
- Copyright(C) 2013 Kouhei Sutou <kou@clear-code.com>
+ Copyright(C) 2013-2015 Kouhei Sutou <kou@clear-code.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -17,10 +17,10 @@
MA 02110-1301, USA
This file uses normalization table defined in
- mysql-5.5.29/strings/ctype-uca.c.
+ mysql-5.6.23/strings/ctype-uca.c.
The following is the header of the file:
- Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
diff --git a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql_unicode_ci_table.h b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql_unicode_ci_table.h
index 861c2029e68..e3a6b4bcc4d 100644
--- a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql_unicode_ci_table.h
+++ b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql_unicode_ci_table.h
@@ -1,5 +1,5 @@
/*
- Copyright(C) 2013 Kouhei Sutou <kou@clear-code.com>
+ Copyright(C) 2013-2015 Kouhei Sutou <kou@clear-code.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -17,10 +17,10 @@
MA 02110-1301, USA
This file uses normalization table defined in
- mysql-5.5.29/strings/ctype-uca.c.
+ mysql-5.6.23/strings/ctype-uca.c.
The following is the header of the file:
- Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
diff --git a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/apt/Makefile.am b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/apt/Makefile.am
index cb257b9293b..9808a7f9e35 100644
--- a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/apt/Makefile.am
+++ b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/apt/Makefile.am
@@ -1,7 +1,7 @@
REPOSITORIES_PATH = repositories
DISTRIBUTIONS = debian
ARCHITECTURES = i386 amd64
-CODE_NAMES = wheezy
+CODE_NAMES = wheezy jessie
all:
diff --git a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/apt/Vagrantfile b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/apt/Vagrantfile
index 97ba2496071..7115ac3f6c0 100644
--- a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/apt/Vagrantfile
+++ b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/apt/Vagrantfile
@@ -8,12 +8,19 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
vms = [
{
:id => "debian-wheezy-i386",
- :box_url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_debian-7.6-i386_chef-provisionerless.box
-",
+ :box_url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_debian-7.8-i386_chef-provisionerless.box",
},
{
:id => "debian-wheezy-amd64",
- :box_url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_debian-7.6_chef-provisionerless.box",
+ :box_url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_debian-7.8_chef-provisionerless.box",
+ },
+ {
+ :id => "debian-jessie-i386",
+ :box_url => "http://packages.groonga.org/tmp/opscode_debian-8.0-i386_chef-provisionerless.box",
+ },
+ {
+ :id => "debian-jessie-amd64",
+ :box_url => "http://packages.groonga.org/tmp/opscode_debian-8.0_chef-provisionerless.box",
},
]
diff --git a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/debian/changelog b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/debian/changelog
index 245c138a35a..7fa8d1e17f0 100644
--- a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/debian/changelog
+++ b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/debian/changelog
@@ -1,3 +1,21 @@
+groonga-normalizer-mysql (1.0.9-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- HAYASHI Kentaro <hayashi@clear-code.com> Sun, 29 Mar 2015 00:00:00 +0900
+
+groonga-normalizer-mysql (1.0.8-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- Kouhei Sutou <kou@clear-code.com> Tue, 10 Feb 2015 00:00:00 +0900
+
+groonga-normalizer-mysql (1.0.7-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- <hayashi@clear-code.com> Mon, 09 Feb 2015 00:00:00 +0900
+
groonga-normalizer-mysql (1.0.6-1) unstable; urgency=low
* New upstream release.
diff --git a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/debian/control b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/debian/control
index 20c456b0a76..37a3805d966 100644
--- a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/debian/control
+++ b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/debian/control
@@ -1,25 +1,31 @@
Source: groonga-normalizer-mysql
Section: libs
Priority: optional
-Maintainer: Kouhei Sutou <kou@clear-code.com>
+Maintainer: Groonga Project <packages@groonga.org>
Build-Depends:
debhelper (>= 9),
autotools-dev,
pkg-config,
libgroonga-dev (>= 3.0.0)
Standards-Version: 3.9.3
-Homepage: http://groonga.org/
+Homepage: https://github.com/groonga/groonga-normalizer-mysql
Package: groonga-normalizer-mysql
-Section: libs
Architecture: any
Depends:
${misc:Depends},
${shlibs:Depends},
libgroonga0
-Description: MySQL derived normalizer for groonga.
+Description: MySQL derived normalizer for Groonga
Groonga is an open-source fulltext search engine and column store.
- It lets you write high-performance applications that requires fulltext search.
+ It lets you write high-performance applications that requires fulltext
+ search.
.
- This package provides a normalizer which normalizes text as same as MySQL does.
-
+ This package provides a normalizer which normalizes text as same as
+ MySQL does.
+ .
+ Groonga has its own normalizers by default, but that behavior is a bit
+ defferent from MySQL does, so as a result, it affects search results.
+ These normalizers are useful if you regards it important for keeping
+ normalizer compatibility with MySQL in Mroonga which uses Groonga as
+ storage engine.
diff --git a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/debian/copyright b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/debian/copyright
index cd3295a134c..79b0d9c4e1f 100644
--- a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/debian/copyright
+++ b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/debian/copyright
@@ -1,29 +1,85 @@
-This package was debianized by Kouhei Sutou <kou@clear-code.com> on
-Tue, 29 Jan 2013 14:52:04 +0000.
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Contact: Kouhei Sutou <kou at clear-code.com>
+Source: http://packages.groonga.org/source/groonga-normalizer-mysql/
-It was downloaded from <http://groonga.org/>
+Files: *
+Copyright: 2013 Kouhei Sutou <kou@clear-code.com>
+License: LGPL-2
-Upstream Author(s):
+Files: debian/*
+Copyright: 2013 Kouhei Sutou <kou@clear-code.com>
+ 2013 HAYASHI Kentaro <hayashi@clear-code.com>
+License: LGPL-2
- Kouhei Sutou <kou at clear-code.com>
+Files: test/run-test.sh
+Copyright: 2013 Kouhei Sutou <kou@clear-code.com>
+License: LGPL-2+
-Copyright:
+Files: normalizers/mysql_general_ci_table.h
+Copyright: 2013 Kouhei Sutou <kou@clear-code.com>
+ 2000, 2012, Oracle and/or its affiliates
+License: LGPL-2
- Copyright(C) 2013 Brazil
+Files: normalizers/mysql_unicode_ci_*.h
+Copyright: 2013 Kouhei Sutou <kou@clear-code.com>
+ 2004, 2011, Oracle and/or its affiliates
+License: LGPL-2
-License:
+Files: ltmain.sh
+Copyright: 1996, Gordon Matzigkeit <gord@gnu.ai.mit.edu>
+ 1996-2011, Free Software Foundation, Inc.
+License: GPL-2+ with Libtool exception
+ GNU Libtool is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+ .
+ As a special exception to the GNU General Public License,
+ if you distribute this file as part of a program or library that
+ is built using GNU Libtool, you may include this file under the
+ same distribution terms that you use for the rest of that program.
+ .
+ GNU Libtool is distributed in the hope that 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 GNU Libtool; see the file COPYING. If not, a copy
+ can be downloaded from http://www.gnu.org/licenses/gpl.html,
+ or obtained by writing to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- This library is free software: you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation, either version 2 of the License.
+License: LGPL-2
+ This library is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation, version 2 of the License.
+ .
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+ .
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ .
+ The Debian packaging is (C) 2013, Kouhei Sutou <kou@clear-code.com> and
+ is licensed under the LGPL-2, see `/usr/share/common-licenses/LGPL-2'.
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-The Debian packaging is (C) 2013, Kouhei Sutou <kou@clear-code.com> and
-is licensed under the LGPL-2, see `/usr/share/common-licenses/LGPL-2'.
+License: LGPL-2+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+ .
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+ .
+ You should have received a copy of the GNU Library 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
+ .
+ On Debian systems, the full text of the GNU Library General Public
+ License version 2 can be found in the file `/usr/share/common-licenses/LGPL-2'.
diff --git a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/debian/rules b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/debian/rules
index 811e09274c0..753d4484cf8 100755
--- a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/debian/rules
+++ b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/debian/rules
@@ -13,3 +13,5 @@ export DH_OPTIONS
override_dh_auto_test:
override_dh_install:
+ find $(CURDIR) -name '*.la' -delete
+ find $(CURDIR) -name 'lgpl-2.0.txt' -delete
diff --git a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/debian/watch b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/debian/watch
new file mode 100644
index 00000000000..ab451e4c004
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/debian/watch
@@ -0,0 +1,2 @@
+version=3
+http://packages.groonga.org/source/groonga-normalizer-mysql/groonga-normalizer-mysql-(.+).tar.gz
diff --git a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/rpm/centos/groonga-normalizer-mysql.spec.in b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/rpm/centos/groonga-normalizer-mysql.spec.in
index e51bae6990d..4084576a704 100644
--- a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/rpm/centos/groonga-normalizer-mysql.spec.in
+++ b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/rpm/centos/groonga-normalizer-mysql.spec.in
@@ -42,7 +42,6 @@ make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p"
rm $RPM_BUILD_ROOT%{_libdir}/groonga/plugins/*/*.la
%files
-%doc README AUTHORS COPYING
%dir %{_libdir}/groonga
%dir %{_libdir}/groonga/plugins
%dir %{_libdir}/groonga/plugins/normalizers
@@ -53,6 +52,15 @@ rm $RPM_BUILD_ROOT%{_libdir}/groonga/plugins/*/*.la
%{_libdir}/pkgconfig/groonga-normalizer-mysql.pc
%changelog
+* Sun Mar 29 2015 HAYASHI Kentaro <hayashi@clear-code.com> - 1.0.9-1
+- new upstream release.
+
+* Tue Feb 10 2015 Kouhei Sutou <kou@clear-code.com> - 1.0.8-1
+- new upstream release.
+
+* Mon Feb 09 2015 HAYASHI Kentaro <hayashi@clear-code.com> - 1.0.7-1
+- new upstream release.
+
* Sun Feb 09 2014 HAYASHI Kentaro <hayashi@clear-code.com> - 1.0.6-1
- new upstream release.
diff --git a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/rpm/fedora/groonga-normalizer-mysql.spec.in b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/rpm/fedora/groonga-normalizer-mysql.spec.in
index 3be5e0797db..974b7c31649 100644
--- a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/rpm/fedora/groonga-normalizer-mysql.spec.in
+++ b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/rpm/fedora/groonga-normalizer-mysql.spec.in
@@ -41,7 +41,6 @@ make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p"
rm $RPM_BUILD_ROOT%{_libdir}/groonga/plugins/*/*.la
%files
-%doc README AUTHORS COPYING
%dir %{_libdir}/groonga
%dir %{_libdir}/groonga/plugins
%dir %{_libdir}/groonga/plugins/normalizers
@@ -52,6 +51,15 @@ rm $RPM_BUILD_ROOT%{_libdir}/groonga/plugins/*/*.la
%{_libdir}/pkgconfig/groonga-normalizer-mysql.pc
%changelog
+* Sun Mar 29 2015 HAYASHI Kentaro <hayashi@clear-code.com> - 1.0.9-1
+- new upstream release.
+
+* Tue Feb 10 2015 Kouhei Sutou <kou@clear-code.com> - 1.0.8-1
+- new upstream release.
+
+* Mon Feb 09 2015 <hayashi@clear-code.com> - 1.0.7-1
+- new upstream release.
+
* Sun Feb 09 2014 HAYASHI Kentaro <hayashi@clear-code.com> - 1.0.6-1
- new upstream release.
diff --git a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/ubuntu/Makefile.am b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/ubuntu/Makefile.am
index 3b616910900..73dbef7791b 100644
--- a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/ubuntu/Makefile.am
+++ b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/ubuntu/Makefile.am
@@ -1,4 +1,4 @@
-CODE_NAMES = precise,trusty
+CODE_NAMES = precise,trusty,utopic,vivid
SOURCE = ../$(PACKAGE)-$(VERSION).tar.gz
all:
diff --git a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/yum/Makefile.am b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/yum/Makefile.am
index ea62f6e427e..edd546fbae1 100644
--- a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/yum/Makefile.am
+++ b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/yum/Makefile.am
@@ -1,7 +1,6 @@
REPOSITORIES_PATH = repositories
DISTRIBUTIONS = centos
ARCHITECTURES = i386 x86_64
-HAVE_DEVELOPMENT_BRANCH = no
release: download build sign-packages update-repository upload
diff --git a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/yum/Vagrantfile b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/yum/Vagrantfile
index 4238d678721..87866a3a0ac 100644
--- a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/yum/Vagrantfile
+++ b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/yum/Vagrantfile
@@ -8,19 +8,19 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
vms = [
{
:id => "centos-5-i386",
- :box_url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-5.10-i386_chef-provisionerless.box",
+ :box_url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-5.11-i386_chef-provisionerless.box",
},
{
:id => "centos-5-x86_64",
- :box_url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-5.10_chef-provisionerless.box",
+ :box_url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-5.11_chef-provisionerless.box",
},
{
:id => "centos-6-i386",
- :box_url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-6.5-i386_chef-provisionerless.box",
+ :box_url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-6.6-i386_chef-provisionerless.box",
},
{
:id => "centos-6-x86_64",
- :box_url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-6.5_chef-provisionerless.box",
+ :box_url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-6.6_chef-provisionerless.box",
},
{
:id => "centos-7-x86_64",
diff --git a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/tool/generate_uca_table.rb b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/tool/generate_uca_table.rb
index 57dba4e0477..4dcb14c324e 100755
--- a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/tool/generate_uca_table.rb
+++ b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/tool/generate_uca_table.rb
@@ -1,7 +1,7 @@
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
#
-# Copyright (C) 2013 Kouhei Sutou <kou@clear-code.com>
+# Copyright (C) 2013-2015 Kouhei Sutou <kou@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
@@ -22,6 +22,7 @@ require "optparse"
$LOAD_PATH.unshift(File.dirname(__FILE__))
require "parser"
+@version = nil
@suffix = ""
@split_small_kana_p = false
@split_kana_with_voiced_sound_mark_p = false
@@ -30,6 +31,10 @@ require "parser"
option_parser = OptionParser.new
option_parser.banner += " MYSQL_SOURCE/strings/ctype-uca.c"
+option_parser.on("--version=VERSION", "Use VERSION as UCA version") do |version|
+ @version = version
+end
+
option_parser.on("--suffix=SUFFIX", "Add SUFFIX to names") do |suffix|
@suffix = suffix
end
@@ -67,7 +72,7 @@ end
ctype_uca_c_path = ARGV[0]
-parser = CTypeUCAParser.new
+parser = CTypeUCAParser.new(@version)
File.open(ctype_uca_c_path) do |ctype_uca_c|
parser.parse(ctype_uca_c)
end
@@ -185,11 +190,15 @@ end
normalized_ctype_uca_c_path =
ctype_uca_c_path.sub(/\A.*\/([^\/]+\/strings\/ctype-uca\.c)\z/, "\\1")
-@suffix_upper_case = @suffix.upcase
+header_guard_id = "MYSQL_UCA"
+if @version
+ header_guard_id << "_#{@version}"
+end
+header_guard_id << "#{@suffix.upcase}_H"
puts(<<-HEADER)
/*
- Copyright(C) 2013 Kouhei Sutou <kou@clear-code.com>
+ Copyright(C) 2013-2015 Kouhei Sutou <kou@clear-code.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -210,7 +219,7 @@ puts(<<-HEADER)
#{normalized_ctype_uca_c_path}.
The following is the header of the file:
- Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -231,14 +240,23 @@ puts(<<-HEADER)
Written by Alexander Barkov <bar@mysql.com>
*/
-#ifndef MYSQL_UCA#{@suffix_upper_case}_H
-#define MYSQL_UCA#{@suffix_upper_case}_H
+#ifndef #{header_guard_id}
+#define #{header_guard_id}
#include <stdint.h>
HEADER
+def variable_name_prefix
+ prefix = "unicode"
+ if @version
+ prefix << "_#{@version}"
+ end
+ prefix << "_ci#{@suffix}"
+ prefix
+end
+
def page_name(page)
- "unicode_ci#{@suffix}_page_%02x" % page
+ "#{variable_name_prefix}_page_%02x" % page
end
sorted_target_pages.each do |page, characters|
@@ -261,10 +279,10 @@ end
puts(<<-PAGES_HEADER)
-static uint32_t *unicode_ci#{@suffix}_table[256] = {
+static uint32_t *#{variable_name_prefix}_table[#{parser.n_pages}] = {
PAGES_HEADER
-pages = ["NULL"] * 256
+pages = ["NULL"] * parser.n_pages
sorted_target_pages.each do |page, characters|
pages[page] = page_name(page)
end
diff --git a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/tool/parser.rb b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/tool/parser.rb
index b8652825f80..cc0b2f01606 100644
--- a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/tool/parser.rb
+++ b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/tool/parser.rb
@@ -80,7 +80,8 @@ end
class CTypeUCAParser
attr_reader :pages
- def initialize
+ def initialize(version=nil)
+ @version = version
@pages = {}
@lengths = []
end
@@ -108,22 +109,43 @@ class CTypeUCAParser
end
end
+ def n_pages
+ @lengths.size
+ end
+
private
+ def page_data_pattern
+ if @version == "520"
+ / uca520_p([\da-fA-F]{3})\[\]=/
+ else
+ / page([\da-fA-F]{3})data\[\]=/
+ end
+ end
+
+ def length_pattern
+ if @version == "520"
+ / uca520_length\[4352\]=/
+ else
+ / uca_length\[256\]=/
+ end
+ end
+
def parse_ctype_uca(input)
current_page = nil
in_length = false
input.each_line do |line|
case line
- when / page([\da-fA-F]{3})data\[\]=/
+ when page_data_pattern
current_page = $1.to_i(16)
@pages[current_page] = []
- when /^\s*0x(?:[\da-z]+)(?:,\s*0x(?:[\da-z]+))*,?$/i
+ when /^\s*(0x(?:[\da-z]+)(?:,\s*0x(?:[\da-z]+))*),?(?: \/\*.+\*\/)?$/i
+ weight_values = $1
next if current_page.nil?
- weights = line.chomp.split(/,\s*/).collect do |component|
+ weights = weight_values.split(/,\s*/).collect do |component|
Integer(component)
end
@pages[current_page].concat(weights)
- when / uca_length\[256\]=/
+ when length_pattern
in_length = true
when /^\d+(?:,\d+)*,?$/
next unless in_length
diff --git a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/version b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/version
index ece61c60124..e5a4a5e7d84 100644
--- a/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/version
+++ b/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/version
@@ -1 +1 @@
-1.0.6 \ No newline at end of file
+1.0.9 \ No newline at end of file
diff --git a/storage/mroonga/version b/storage/mroonga/version
index b0372476047..760b908bf87 100644
--- a/storage/mroonga/version
+++ b/storage/mroonga/version
@@ -1 +1 @@
-4.06 \ No newline at end of file
+5.02 \ No newline at end of file
diff --git a/storage/mroonga/version_in_hex b/storage/mroonga/version_in_hex
index 6f503be55dd..7716095f96c 100644
--- a/storage/mroonga/version_in_hex
+++ b/storage/mroonga/version_in_hex
@@ -1 +1 @@
-0x0406 \ No newline at end of file
+0x0502 \ No newline at end of file
diff --git a/storage/mroonga/version_major b/storage/mroonga/version_major
index bf0d87ab1b2..7813681f5b4 100644
--- a/storage/mroonga/version_major
+++ b/storage/mroonga/version_major
@@ -1 +1 @@
-4 \ No newline at end of file
+5 \ No newline at end of file
diff --git a/storage/mroonga/version_micro b/storage/mroonga/version_micro
index 62f9457511f..d8263ee9860 100644
--- a/storage/mroonga/version_micro
+++ b/storage/mroonga/version_micro
@@ -1 +1 @@
-6 \ No newline at end of file
+2 \ No newline at end of file
diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c
index b79d6c891f1..178fff6a204 100644
--- a/storage/myisam/mi_check.c
+++ b/storage/myisam/mi_check.c
@@ -1944,16 +1944,8 @@ int mi_sort_index(HA_CHECK *param, register MI_INFO *info, char * name)
for (key= 0,keyinfo= &share->keyinfo[0]; key < share->base.keys ;
key++,keyinfo++)
{
- if (! mi_is_key_active(info->s->state.key_map, key))
- {
- /* Since the key is not active, this should not be read, but we
- initialize it anyway to silence a Valgrind warn when passing that
- chunk of memory to pwrite(). */
- index_pos[key]= HA_OFFSET_ERROR;
- continue;
- }
-
- if (share->state.key_root[key] != HA_OFFSET_ERROR)
+ if (mi_is_key_active(info->s->state.key_map, key) &&
+ share->state.key_root[key] != HA_OFFSET_ERROR)
{
index_pos[key]=param->new_file_pos; /* Write first block here */
if (sort_one_index(param,info,keyinfo,share->state.key_root[key],
diff --git a/storage/myisam/rt_split.c b/storage/myisam/rt_split.c
index 9ab0bd99201..be61734e01c 100644
--- a/storage/myisam/rt_split.c
+++ b/storage/myisam/rt_split.c
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2002, 2010, Oracle and/or its affiliates
+ Copyright (c) 2002, 2015, 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
@@ -69,6 +69,10 @@ static double mbr_join_square(const double *a, const double *b, int n_dim)
b += 2;
}while (a != end);
+ /* Check for infinity or NaN */
+ if (my_isinf(square) || isnan(square))
+ square = DBL_MAX;
+
return square;
}
@@ -103,6 +107,9 @@ static void pick_seeds(SplitStruct *node, int n_entries,
double max_d = -DBL_MAX;
double d;
+ *seed_a = node;
+ *seed_b = node + 1;
+
for (cur1 = node; cur1 < lim1; ++cur1)
{
for (cur2=cur1 + 1; cur2 < lim2; ++cur2)
diff --git a/storage/oqgraph/CMakeLists.txt b/storage/oqgraph/CMakeLists.txt
index 1a59ae0f0dc..512fa0eb76c 100644
--- a/storage/oqgraph/CMakeLists.txt
+++ b/storage/oqgraph/CMakeLists.txt
@@ -24,6 +24,7 @@ IF(MSVC)
# ENDIF()
ELSE()
# See if that works. On old gcc it'll fail because of -fno-rtti
+SET(CMAKE_REQUIRED_INCLUDES "${Boost_INCLUDE_DIRS}")
CHECK_CXX_SOURCE_COMPILES(
"
#define BOOST_NO_RTTI 1
diff --git a/storage/oqgraph/graphcore-types.h b/storage/oqgraph/graphcore-types.h
index 3ff32d0e233..2f182341b39 100644
--- a/storage/oqgraph/graphcore-types.h
+++ b/storage/oqgraph/graphcore-types.h
@@ -34,7 +34,9 @@ namespace open_query
}
+// Forward defs from mariadb itself!
class Field;
typedef struct TABLE TABLE;
+class THD;
#endif
diff --git a/storage/oqgraph/graphcore.cc b/storage/oqgraph/graphcore.cc
index de575c9da65..73433fc8219 100644
--- a/storage/oqgraph/graphcore.cc
+++ b/storage/oqgraph/graphcore.cc
@@ -443,6 +443,9 @@ namespace open_query
return num_vertices(share->g);
}
+ THD* oqgraph::get_thd() { return share->g.get_table_thd(); }
+ void oqgraph::set_thd(THD* thd) { share->g.set_table_thd(thd); }
+
oqgraph* oqgraph::create(oqgraph_share *share) throw()
{
assert(share != NULL);
diff --git a/storage/oqgraph/graphcore.h b/storage/oqgraph/graphcore.h
index f7eff77d8b1..b1560552fcf 100644
--- a/storage/oqgraph/graphcore.h
+++ b/storage/oqgraph/graphcore.h
@@ -126,6 +126,9 @@ namespace open_query
static oqgraph* create(oqgraph_share*) throw();
static oqgraph_share *create(TABLE*,Field*,Field*,Field*) throw();
+ THD* get_thd();
+ void set_thd(THD*);
+
static void free(oqgraph*) throw();
static void free(oqgraph_share*) throw();
diff --git a/storage/oqgraph/ha_oqgraph.cc b/storage/oqgraph/ha_oqgraph.cc
index 4411421c669..89bc9128c29 100644
--- a/storage/oqgraph/ha_oqgraph.cc
+++ b/storage/oqgraph/ha_oqgraph.cc
@@ -1,4 +1,5 @@
-/* Copyright (C) 2007-2013 Arjen G Lentz & Antony T Curtis for Open Query
+/* Copyright (C) 2007-2015 Arjen G Lentz & Antony T Curtis for Open Query
+ Copyright (C) 2013-2015 Andrew McDonnell
Portions of this file copyright (C) 2000-2006 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -22,88 +23,70 @@
======================================================================
*/
+/*
+ Changelog since 10.0.13
+ -----------------------
+ * Removed compatibility hacks for 5.5.32 and 10.0.4.
+ I expect no issues building oqgraph into Mariadb 5.5.40 but I think the better approach is maintain a separate fork / patches.
+ * Added status variable to report if verbose debug is on
+ * Fixed handling of connection thread changed, the apparent root cause of
+ MDEV-6282, MDEV-6345 and MDEV-6784
+
+*/
+
#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation // gcc: Class implementation
+#pragma implementation // gcc: Class implementation
#endif
#include <my_config.h>
+#define MYSQL_SERVER 1 // to have THD
+/* For the moment, include code to deal with integer latches.
+ * I have wrapped it with this #ifdef to make it easier to find and remove in the future.
+ */
+#define RETAIN_INT_LATCH_COMPATIBILITY // for the time being, recognise integer latches to simplify upgrade.
-#define MYSQL_SERVER // to have THD
#include <mysql/plugin.h>
-#include "sql_class.h"
-
-#include <stdarg.h>
-#include <stdio.h>
-
#include <mysql_version.h>
#include "ha_oqgraph.h"
#include "graphcore.h"
-
#include <sql_error.h>
-#if MYSQL_VERSION_ID >= 100004
-// Interim workaround for rename in sql_error.h from this point
-#define MYSQL_ERROR Sql_condition
-#endif
-
-#if MYSQL_VERSION_ID < 100000
-// Allow compatibility with build for 5.5.32
-#define user_defined_key_parts key_parts
-#define open_table_error(a,b,c) open_table_error(a,b,c,0)
-#define enum_open_frm_error int
-#else
-#define enum_open_frm_error enum open_frm_error
-#endif
-
-#include "table.h"
-#include "field.h"
-#include "key.h"
-#include "unireg.h"
-#include "sql_class.h"
-
-#include "my_dbug.h"
+#include <sql_class.h>
+#include <table.h>
+#include <field.h>
+#include <key.h>
+#include <unireg.h>
+#include <my_dbug.h>
// Uncomment this for extra debug, but expect a performance hit in large queries
-#define VERBOSE_DEBUG
+//#define VERBOSE_DEBUG
#ifdef VERBOSE_DEBUG
#else
#undef DBUG_PRINT
#define DBUG_PRINT(x ...)
#endif
-#define OQGRAPH_STATS_UPDATE_THRESHOLD 10
-
-using namespace open_query;
-
-/* For the moment, include code to deal with integer latches.
- * I have wrapped it with this #ifdef to make it easier to find and remove
- * in the future.
- */
-#define RETAIN_INT_LATCH_COMPATIBILITY
-
#ifdef RETAIN_INT_LATCH_COMPATIBILITY
/* In normal operation, no new tables using an integer latch can be created,
* but they can still be used if they already exist, to allow for upgrades.
- *
- * However to ensure the legacy function is properly tested, we add a
+ *
+ * However to ensure the legacy function is properly tested, we add a
* server variable "oggraph_allow_create_integer_latch" which if set to TRUE
* allows new engine tables to be created with integer latches.
*/
static my_bool g_allow_create_integer_latch = FALSE;
-
-static MYSQL_SYSVAR_BOOL(allow_create_integer_latch, g_allow_create_integer_latch,
- PLUGIN_VAR_RQCMDARG, "Allow creation of integer latches "
- "so the upgrade logic can be tested", NULL, NULL, FALSE);
#endif
+using namespace open_query;
+
// Table of varchar latch operations.
// In the future this needs to be refactactored to live somewhere else
struct oqgraph_latch_op_table { const char *key; int latch; };
static const oqgraph_latch_op_table latch_ops_table[] = {
{ "", oqgraph::NO_SEARCH } , // suggested by Arjen, use empty string instead of no_search
{ "dijkstras", oqgraph::DIJKSTRAS } ,
- { "breadth_first", oqgraph::BREADTH_FIRST } ,
- { NULL, -1 }
+ { "breadth_first", oqgraph::BREADTH_FIRST } ,
+ { NULL, -1 }
};
static uint32 findLongestLatch() {
@@ -126,16 +109,14 @@ const char *oqlatchToCode(int latch) {
return "unknown";
}
-struct oqgraph_table_option_struct
+struct ha_table_option_struct
{
const char *table_name;
-
const char *origid; // name of the origin id column
const char *destid; // name of the target id column
const char *weight; // name of the weight column (optional)
};
-#define ha_table_option_struct oqgraph_table_option_struct
static const ha_create_table_option oqgraph_table_option_list[]=
{
HA_TOPTION_STRING("data_table", table_name),
@@ -145,47 +126,6 @@ static const ha_create_table_option oqgraph_table_option_list[]=
HA_TOPTION_END
};
-static const char oqgraph_description[]=
- "Open Query Graph Computation Engine "
- "(http://openquery.com/graph)";
-
-#if MYSQL_VERSION_ID < 50100
-static bool oqgraph_init();
-
-handlerton oqgraph_hton= {
- "OQGRAPH",
- SHOW_OPTION_YES,
- oqgraph_description,
- DB_TYPE_OQGRAPH,
- oqgraph_init,
- 0, /* slot */
- 0, /* savepoint size. */
- NULL, /* close_connection */
- NULL, /* savepoint */
- NULL, /* rollback to savepoint */
- NULL, /* release savepoint */
- NULL, /* commit */
- NULL, /* rollback */
- NULL, /* prepare */
- NULL, /* recover */
- NULL, /* commit_by_xid */
- NULL, /* rollback_by_xid */
- NULL, /* create_cursor_read_view */
- NULL, /* set_cursor_read_view */
- NULL, /* close_cursor_read_view */
- HTON_NO_FLAGS
-};
-
-#define STATISTIC_INCREMENT(X) \
-statistic_increment(table->in_use->status_var.X, &LOCK_status)
-#define MOVE(X) move_field(X)
-#define RECORDS records
-#else
-#define STATISTIC_INCREMENT(X) /* nothing */
-#define MOVE(X) move_field_offset(X)
-#define RECORDS stats.records
-#endif
-
static bool oqgraph_init_done= 0;
static handler* oqgraph_create_handler(handlerton *hton, TABLE_SHARE *table,
@@ -195,30 +135,26 @@ static handler* oqgraph_create_handler(handlerton *hton, TABLE_SHARE *table,
return new (mem_root) ha_oqgraph(hton, table);
}
-#if MYSQL_VERSION_ID >= 50100
-static int oqgraph_init(handlerton *hton)
-{
-#else
-static bool oqgraph_init()
-{
- if (have_oqgraph == SHOW_OPTION_DISABLED)
- return 1;
-#endif
+int oqgraph_close_connection(handlerton *hton, THD *thd);
+static int oqgraph_init(void *p)
+{
+ handlerton *hton= (handlerton *)p;
DBUG_PRINT( "oq-debug", ("oqgraph_init"));
-
-#if MYSQL_VERSION_ID >= 50100
hton->state= SHOW_OPTION_YES;
hton->db_type= DB_TYPE_AUTOASSIGN;
hton->create= oqgraph_create_handler;
hton->flags= HTON_ALTER_NOT_SUPPORTED;
// Prevent ALTER, because the core crashes when the user provides a
// non-existing backing store field for ORIGID, etc
- // 'Fixes' bug 1134355
+ // 'Fixes' bug 1134355
// HTON_NO_FLAGS;
-
+
hton->table_options= (ha_create_table_option*)oqgraph_table_option_list;
+
+ hton->close_connection = oqgraph_close_connection;
+
oqgraph_init_done= TRUE;
return 0;
}
@@ -227,7 +163,6 @@ static int oqgraph_fini(void *)
{
DBUG_PRINT( "oq-debug", ("oqgraph_fini"));
oqgraph_init_done= FALSE;
-#endif
return 0;
}
@@ -267,10 +202,10 @@ static int error_code(int res)
* linkid BIGINT UNSIGNED NULL
* =================================
*
-
+
The latch may be a varchar of any length, however if it is too short to
hold the longest latch value, table creation is aborted.
-
+
CREATE TABLE foo (
latch VARCHAR(32) NULL,
origid BIGINT UNSIGNED NULL,
@@ -292,12 +227,12 @@ static int error_code(int res)
integer and change behaviour accordingly.
Note that if a table was constructed with varchar and an attempt is made to
select with latch=(some integer number) then MYSQL will autocast
- and no data will be returned... so retaining compatibility does not and cannot
+ and no data will be returned... so retaining compatibility does not and cannot
extend to making old queries work with new style tables.
This method is only called on table creation, so here we ensure new tables
can only be created with varchar.
-
+
This does present a small problem with regression testing;
so we work around that by using an system variable to allow
integer latch tables to be created.
@@ -335,28 +270,28 @@ int ha_oqgraph::oqgraph_check_table_structure (TABLE *table_arg)
DBUG_PRINT( "oq-debug", ("Allowing integer latch anyway!"));
isStringLatch = false;
/* Make a warning */
- push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
ER_WARN_DEPRECATED_SYNTAX, ER(ER_WARN_DEPRECATED_SYNTAX),
"latch SMALLINT UNSIGNED NULL", "'latch VARCHAR(32) NULL'");
} else
-#endif
+#endif
if (isLatchColumn && ((*field)->type() == MYSQL_TYPE_SHORT))
{
DBUG_PRINT( "oq-debug", ("Allowing integer no more!"));
badColumn = true;
- push_warning_printf( current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, HA_WRONG_CREATE_OPTION, "Integer latch is not supported for new tables.", i);
+ push_warning_printf( current_thd, Sql_condition::WARN_LEVEL_WARN, HA_WRONG_CREATE_OPTION, "Integer latch is not supported for new tables.", i);
} else
/* Check Column Type */
if ((*field)->type() != skel[i].coltype) {
badColumn = true;
- push_warning_printf( current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, HA_WRONG_CREATE_OPTION, "Column %d is wrong type.", i);
+ push_warning_printf( current_thd, Sql_condition::WARN_LEVEL_WARN, HA_WRONG_CREATE_OPTION, "Column %d is wrong type.", i);
}
-
+
// Make sure latch column is large enough for all possible latch values
if (isLatchColumn && isStringLatch) {
if ((*field)->char_length() < findLongestLatch()) {
badColumn = true;
- push_warning_printf( current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, HA_WRONG_CREATE_OPTION, "Column %d is too short.", i);
+ push_warning_printf( current_thd, Sql_condition::WARN_LEVEL_WARN, HA_WRONG_CREATE_OPTION, "Column %d is too short.", i);
}
}
@@ -364,18 +299,18 @@ int ha_oqgraph::oqgraph_check_table_structure (TABLE *table_arg)
/* Check Is UNSIGNED */
if ( (!((*field)->flags & UNSIGNED_FLAG ))) {
badColumn = true;
- push_warning_printf( current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, HA_WRONG_CREATE_OPTION, "Column %d must be UNSIGNED.", i);
+ push_warning_printf( current_thd, Sql_condition::WARN_LEVEL_WARN, HA_WRONG_CREATE_OPTION, "Column %d must be UNSIGNED.", i);
}
}
/* Check THAT NOT NULL isn't set */
if (!badColumn) if ((*field)->flags & NOT_NULL_FLAG) {
badColumn = true;
- push_warning_printf( current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, HA_WRONG_CREATE_OPTION, "Column %d must be NULL.", i);
+ push_warning_printf( current_thd, Sql_condition::WARN_LEVEL_WARN, HA_WRONG_CREATE_OPTION, "Column %d must be NULL.", i);
}
/* Check the column name */
if (!badColumn) if (strcmp(skel[i].colname,(*field)->field_name)) {
badColumn = true;
- push_warning_printf( current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, HA_WRONG_CREATE_OPTION, "Column %d must be named '%s'.", i, skel[i].colname);
+ push_warning_printf( current_thd, Sql_condition::WARN_LEVEL_WARN, HA_WRONG_CREATE_OPTION, "Column %d must be named '%s'.", i, skel[i].colname);
}
if (badColumn) {
DBUG_RETURN(-1);
@@ -383,16 +318,16 @@ int ha_oqgraph::oqgraph_check_table_structure (TABLE *table_arg)
}
if (skel[i].colname) {
- push_warning_printf( current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, HA_WRONG_CREATE_OPTION, "Not enough columns.");
+ push_warning_printf( current_thd, Sql_condition::WARN_LEVEL_WARN, HA_WRONG_CREATE_OPTION, "Not enough columns.");
DBUG_RETURN(-1);
}
if (*field) {
- push_warning_printf( current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, HA_WRONG_CREATE_OPTION, "Too many columns.");
+ push_warning_printf( current_thd, Sql_condition::WARN_LEVEL_WARN, HA_WRONG_CREATE_OPTION, "Too many columns.");
DBUG_RETURN(-1);
}
if (!table_arg->key_info || !table_arg->s->keys) {
- push_warning_printf( current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, HA_WRONG_CREATE_OPTION, "No vaild key specification.");
+ push_warning_printf( current_thd, Sql_condition::WARN_LEVEL_WARN, HA_WRONG_CREATE_OPTION, "No valid key specification.");
DBUG_RETURN(-1);
}
@@ -405,7 +340,7 @@ int ha_oqgraph::oqgraph_check_table_structure (TABLE *table_arg)
/* check that the first key part is the latch and it is a hash key */
if (!(field[0] == key->key_part[0].field &&
HA_KEY_ALG_HASH == key->algorithm)) {
- push_warning_printf( current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, HA_WRONG_CREATE_OPTION, "Incorrect keys algorithm on key %d.", i);
+ push_warning_printf( current_thd, Sql_condition::WARN_LEVEL_WARN, HA_WRONG_CREATE_OPTION, "Incorrect keys algorithm on key %d.", i);
DBUG_RETURN(-1);
}
if (key->user_defined_key_parts == 3)
@@ -417,12 +352,12 @@ int ha_oqgraph::oqgraph_check_table_structure (TABLE *table_arg)
!(field[1] == key->key_part[2].field &&
field[2] == key->key_part[1].field))
{
- push_warning_printf( current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, HA_WRONG_CREATE_OPTION, "Keys parts mismatch on key %d.", i);
+ push_warning_printf( current_thd, Sql_condition::WARN_LEVEL_WARN, HA_WRONG_CREATE_OPTION, "Keys parts mismatch on key %d.", i);
DBUG_RETURN(-1);
}
}
else {
- push_warning_printf( current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, HA_WRONG_CREATE_OPTION, "Too many key parts on key %d.", i);
+ push_warning_printf( current_thd, Sql_condition::WARN_LEVEL_WARN, HA_WRONG_CREATE_OPTION, "Too many key parts on key %d.", i);
DBUG_RETURN(-1);
}
}
@@ -434,6 +369,14 @@ int ha_oqgraph::oqgraph_check_table_structure (TABLE *table_arg)
** OQGRAPH tables
*****************************************************************************/
+int oqgraph_close_connection(handlerton *hton, THD *thd)
+{
+ DBUG_PRINT( "oq-debug", ("thd: 0x%lx; oqgraph_close_connection.", (long) thd));
+ // close_thread_tables(thd); // maybe this?
+ return 0;
+}
+
+
ha_oqgraph::ha_oqgraph(handlerton *hton, TABLE_SHARE *table_arg)
: handler(hton, table_arg)
, have_table_share(false)
@@ -443,7 +386,8 @@ ha_oqgraph::ha_oqgraph(handlerton *hton, TABLE_SHARE *table_arg)
, graph_share(0)
, graph(0)
, error_message("", 0, &my_charset_latin1)
-{ }
+{
+}
ha_oqgraph::~ha_oqgraph()
{ }
@@ -493,54 +437,90 @@ void ha_oqgraph::fprint_error(const char* fmt, ...)
}
/**
+ * Check that the currently referenced OQGRAPH table definition, on entry to open(), has sane OQGRAPH options.
+ * (This does not check the backing store, but the OQGRAPH virtual table options)
+ *
+ * @return true if OK, or false if an option is invalid.
+ */
+bool ha_oqgraph::validate_oqgraph_table_options()
+{
+ // Note when called from open(), we should not expect this method to fail except in the case of bugs; the fact that it does is
+ // could be construed as a bug. I think in practice however, this is because CREATE TABLE calls both create() and open(),
+ // and it is possible to do something like ALTER TABLE x DESTID='y' to _change_ the options.
+ // Thus we need to sanity check from open() until and unless we get around to extending ha_oqgraph to properly handle ALTER TABLE,
+ // after which we could change things to call this method from create() and the ALTER TABLE handling code instead.
+ // It may still be sensible to call this from open() anyway, in case someone somewhere upgrades from a broken table definition...
+
+ ha_table_option_struct *options = table->s->option_struct;
+ // Catch cases where table was not constructed properly
+ // Note - need to return -1 so our error text gets reported
+ if (!options) {
+ // This should only happen if there is a bug elsewhere in the storage engine, because ENGINE itself is an attribute
+ fprint_error("Invalid OQGRAPH backing store (null attributes)");
+ }
+ else if (!options->table_name || !*options->table_name) {
+ // The first condition indicates no DATA_TABLE option, the second if the user specified DATA_TABLE=''
+ fprint_error("Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)");
+ // if table_name option is present but doesn't actually exist, we will fail later
+ }
+ else if (!options->origid || !*options->origid) {
+ // The first condition indicates no ORIGID option, the second if the user specified ORIGID=''
+ fprint_error("Invalid OQGRAPH backing store description (unspecified or empty origid attribute)");
+ // if ORIGID option is present but doesn't actually exist, we will fail later
+ }
+ else if (!options->destid || !*options->destid) {
+ // The first condition indicates no DESTID option, the second if the user specified DESTID=''
+ fprint_error("Invalid OQGRAPH backing store description (unspecified or empty destid attribute)");
+ // if DESTID option is present but doesn't actually exist, we will fail later
+ } else {
+ // weight is optional...
+ return true;
+ }
+ // Fault
+ return false;
+}
+
+/**
* Open the OQGRAPH engine 'table'.
*
- * An OQGRAPH table is effectively similar to a view over the underlying backing table,
- * attribute 'data_table', but where the result returned by a query depends on the
- * value of the 'latch' column specified to the query. Therefore,
- * when mysqld opens us, we need to open the corresponding backing table 'data_table'
+ * An OQGRAPH table is effectively similar to a view over the underlying backing table, attribute 'data_table', but where the
+ * result returned by a query depends on the value of the 'latch' column specified to the query.
+ * Therefore, when mysqld opens us, we need to open the corresponding backing table 'data_table'.
+ *
+ * Conceptually, the backing store could be any kind of object having queryable semantics, including a SQL VIEW.
+ * However, for that to work in practice would require us to hook into the right level of the MYSQL API.
+ * Presently, only objects that can be opened using the internal mechanisms can be used: INNODB, MYISAM, etc.
+ * The intention is to borrow from ha_connect and use the mysql client library to access the backing store.
*
*/
int ha_oqgraph::open(const char *name, int mode, uint test_if_locked)
{
DBUG_ENTER("ha_oqgraph::open");
+ DBUG_PRINT( "oq-debug", ("thd: 0x%lx; open(name=%s,mode=%d,test_if_locked=%u)", (long) current_thd, name, mode, test_if_locked));
- DBUG_PRINT( "oq-debug", ("open(name=%s,mode=%d,test_if_locked=%u)", name, mode, test_if_locked));
+ // So, we took a peek inside handler::ha_open() and learned a few things:
+ // * this->table is set by handler::ha_open() before calling open().
+ // Note that from this we can only assume that MariaDB knows what it is doing and wont call open() other anything else
+ // relying on this-0>table, re-entrantly...
+ // * this->table_share should never be set back to NULL, an assertion checks for this in ha_open() after open()
+ // * this->table_share is initialised in the constructor of handler
+ // * this->table_share is only otherwise changed by this->change_table_ptr())
+ // We also discovered that an assertion is raised if table->s is not table_share before calling open())
DBUG_ASSERT(!have_table_share);
DBUG_ASSERT(graph == NULL);
- THD* thd = current_thd;
- oqgraph_table_option_struct *options=
- reinterpret_cast<oqgraph_table_option_struct*>(table->s->option_struct);
+ // Before doing anything, make sure we have DATA_TABLE, ORIGID and DESTID not empty
+ if (!validate_oqgraph_table_options()) { DBUG_RETURN(-1); }
- // Catch cases where table was not constructed properly
- // Note - need to return -1 so our error text gets reported
- if (!options) {
- fprint_error("Invalid OQGRAPH backing store (null attributes)");
- DBUG_RETURN(-1);
- }
- if (!options->table_name || !*options->table_name) {
- fprint_error("Invalid OQGRAPH backing store (unspecified or empty data_table attribute)");
- // if table_name if present but doesnt actually exist, we will fail out below
- // when we call open_table_def(). same probably applies for the id fields
- DBUG_RETURN(-1);
- }
- if (!options->origid || !*options->origid) {
- fprint_error("Invalid OQGRAPH backing store (unspecified or empty origid attribute)");
- DBUG_RETURN(-1);
- }
- if (!options->destid || !*options->destid) {
- fprint_error("Invalid OQGRAPH backing store (unspecified or empty destid attribute)");
- DBUG_RETURN(-1);
- }
- // weight is optional
+ ha_table_option_struct *options= table->s->option_struct;
- error_message.length(0);
+ error_message.length(0);
origid= destid= weight= 0;
// Here we're abusing init_tmp_table_share() which is normally only works for thread-local shares.
+ THD* thd = current_thd;
init_tmp_table_share( thd, share, table->s->db.str, table->s->db.length, options->table_name, "");
// because of that, we need to reinitialize the memroot (to reset MY_THREAD_SPECIFIC flag)
DBUG_ASSERT(share->mem_root.used == NULL); // it's still empty
@@ -552,7 +532,7 @@ int ha_oqgraph::open(const char *name, int mode, uint test_if_locked)
// * plen seems to be then set to length of `database_blah/options_data_table_name`
// * then we set share->normalized_path.str and share->path.str to `database_blah/options_data_table_name`
// * I assume that this verbiage is needed so the memory used by share->path.str is set in the share mem root
- // * because otherwise one could simply build the string more simply using malloc and pass it instead of "" above
+ // * because otherwise one could simply build the string more simply using malloc and pass it instead of "" above
const char* p= strend(name)-1;
while (p > name && *p != '\\' && *p != '/')
--p;
@@ -567,13 +547,12 @@ int ha_oqgraph::open(const char *name, int mode, uint test_if_locked)
share->normalized_path.str= share->path.str;
share->path.length= share->normalized_path.length= plen;
- DBUG_PRINT( "oq-debug", ("share:(normalized_path=%s,path.length=%zu)",
+ DBUG_PRINT( "oq-debug", ("share:(normalized_path=%s,path.length=%zu)",
share->normalized_path.str, share->path.length));
int open_def_flags = 0;
-#if MYSQL_VERSION_ID >= 100002
open_def_flags = GTS_TABLE;
-#endif
+
// We want to open the definition for the given backing table
// Once can assume this loop exists because sometimes open_table_def() fails for a reason other than not exist
// and not 'exist' is valid, because we use ha_create_table_from_engine() to force it to 'exist'
@@ -583,28 +562,11 @@ int ha_oqgraph::open(const char *name, int mode, uint test_if_locked)
// Lets try without this, and see if all the tests pass...
while (open_table_def(thd, share, open_def_flags))
{
-#if MYSQL_VERSION_ID < 100002
- if (thd->is_error() && thd->stmt_da->sql_errno() != ER_NO_SUCH_TABLE)
- {
- free_table_share(share);
- DBUG_RETURN(thd->stmt_da->sql_errno());
- }
-
- if (ha_create_table_from_engine(thd, table->s->db.str, options->table_name))
- {
- free_table_share(share);
- DBUG_RETURN(thd->stmt_da->sql_errno());
- }
- /*mysql_reset_errors(thd, 1);*/
- thd->clear_error();
- continue;
-#else
open_table_error(share, OPEN_FRM_OPEN_ERROR, ENOENT);
free_table_share(share);
- if (thd->is_error())
+ if (thd->is_error())
DBUG_RETURN(thd->get_stmt_da()->sql_errno());
DBUG_RETURN(HA_ERR_NO_SUCH_TABLE);
-#endif
}
@@ -622,7 +584,7 @@ int ha_oqgraph::open(const char *name, int mode, uint test_if_locked)
DBUG_RETURN(-1);
}
- if (enum_open_frm_error err= open_table_from_share(thd, share, "",
+ if (enum open_frm_error err= open_table_from_share(thd, share, "",
(uint) (HA_OPEN_KEYFILE | HA_OPEN_RNDFILE |
HA_GET_INDEX | HA_TRY_READ_ONLY),
READ_KEYINFO | COMPUTE_TYPES | EXTRA_RECORD,
@@ -702,7 +664,7 @@ int ha_oqgraph::open(const char *name, int mode, uint test_if_locked)
free_table_share(share);
DBUG_RETURN(-1);
}
-
+
// Make sure origid column != destid column
if (strcmp( origid->field_name, destid->field_name)==0) {
fprint_error("Invalid OQGRAPH backing store ('%s.destid' attribute set to same column as origid attribute)", p+1, options->table_name);
@@ -752,6 +714,7 @@ int ha_oqgraph::open(const char *name, int mode, uint test_if_locked)
int ha_oqgraph::close(void)
{
+ DBUG_PRINT( "oq-debug", ("close()"));
oqgraph::free(graph); graph= 0;
oqgraph::free(graph_share); graph_share= 0;
@@ -767,6 +730,7 @@ int ha_oqgraph::close(void)
void ha_oqgraph::update_key_stats()
{
+ DBUG_PRINT( "oq-debug", ("update_key_stats()"));
for (uint i= 0; i < table->s->keys; i++)
{
KEY *key=table->key_info+i;
@@ -808,8 +772,7 @@ int ha_oqgraph::delete_row(const byte * buf)
return HA_ERR_TABLE_READONLY;
}
-int ha_oqgraph::index_read(byte * buf, const byte * key, uint key_len,
- enum ha_rkey_function find_flag)
+int ha_oqgraph::index_read(byte * buf, const byte * key, uint key_len, enum ha_rkey_function find_flag)
{
DBUG_ASSERT(inited==INDEX);
// reset before we have a cursor, so the memory is not junk, avoiding the sefgault in position() when select with order by (bug #1133093)
@@ -819,6 +782,10 @@ int ha_oqgraph::index_read(byte * buf, const byte * key, uint key_len,
int ha_oqgraph::index_next_same(byte *buf, const byte *key, uint key_len)
{
+ if (graph->get_thd() != current_thd) {
+ DBUG_PRINT( "oq-debug", ("index_next_same g->table->in_use: 0x%lx <-- current_thd 0x%lx", (long) graph->get_thd(), (long) current_thd));
+ graph->set_thd(current_thd);
+ }
int res;
open_query::row row;
DBUG_ASSERT(inited==INDEX);
@@ -832,7 +799,7 @@ int ha_oqgraph::index_next_same(byte *buf, const byte *key, uint key_len)
#define LATCH_WAS_NUMBER 1
/**
- * This function parse the VARCHAR(n) latch specification into an integer operation specification compatible with
+ * This function parse the VARCHAR(n) latch specification into an integer operation specification compatible with
* v1-v3 oqgraph::search().
*
* If the string contains a number, this is directly converted from a decimal integer.
@@ -843,19 +810,19 @@ int ha_oqgraph::index_next_same(byte *buf, const byte *key, uint key_len)
*
* FIXME: For the time being, only handles latin1 character set.
* @return false if parsing fails.
- */
+ */
static int parse_latch_string_to_legacy_int(const String& value, int &latch)
{
// Attempt to parse as exactly an integer first.
-
+
// Note: we are strict about not having whitespace, or garbage characters,
- // so that the query result gets returned properly:
+ // so that the query result gets returned properly:
// Because of the way the result is built and used in fill_result,
// we have to exactly return in the latch column what was in the latch= clause
// otherwise the rows get filtered out by the query optimiser.
-
+
// For the same reason, we cant simply treat latch='' as NO_SEARCH either.
-
+
String latchValue = value;
char *eptr;
unsigned long int v = strtoul( latchValue.c_ptr_safe(), &eptr, 10);
@@ -865,7 +832,7 @@ static int parse_latch_string_to_legacy_int(const String& value, int &latch)
latch = v;
return true;
}
- // fall through and test as a string (although it is unlikely we might have an operator starting with a number)
+ // fall through and test as a string (although it is unlikely we might have an operator starting with a number)
}
const oqgraph_latch_op_table* entry = latch_ops_table;
@@ -879,8 +846,13 @@ static int parse_latch_string_to_legacy_int(const String& value, int &latch)
}
int ha_oqgraph::index_read_idx(byte * buf, uint index, const byte * key,
- uint key_len, enum ha_rkey_function find_flag)
+ uint key_len, enum ha_rkey_function find_flag)
{
+ if (graph->get_thd() != current_thd) {
+ DBUG_PRINT( "oq-debug", ("index_read_idx g->table->in_use: 0x%lx <-- current_thd 0x%lx", (long) graph->get_thd(), (long) current_thd));
+ graph->set_thd(current_thd);
+ }
+
Field **field= table->field;
KEY *key_info= table->key_info + index;
int res;
@@ -890,6 +862,8 @@ int ha_oqgraph::index_read_idx(byte * buf, uint index, const byte * key,
int* latchp=0;
open_query::row row;
+ DBUG_PRINT("oq-debug", ("thd: 0x%lx; index_read_idx()", (long) current_thd));
+
bmove_align(buf, table->s->default_values, table->s->reclength);
key_restore(buf, (byte*) key, key_info, key_len);
@@ -909,21 +883,21 @@ int ha_oqgraph::index_read_idx(byte * buf, uint index, const byte * key,
#ifdef RETAIN_INT_LATCH_COMPATIBILITY
if (field[0]->type() == MYSQL_TYPE_SHORT) {
latch= (int) field[0]->val_int();
- } else
+ } else
#endif
{
field[0]->val_str(&latchFieldValue, &latchFieldValue);
if (!parse_latch_string_to_legacy_int(latchFieldValue, latch)) {
// Invalid, so warn & fail
- push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_WRONG_ARGUMENTS, ER(ER_WRONG_ARGUMENTS), "OQGRAPH latch");
+ push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN, ER_WRONG_ARGUMENTS, ER(ER_WRONG_ARGUMENTS), "OQGRAPH latch");
table->status = STATUS_NOT_FOUND;
- if (ptrdiff) /* fixes debug build assert - should be a tidier way to do this */
- {
- field[0]->move_field_offset(-ptrdiff);
- field[1]->move_field_offset(-ptrdiff);
- field[2]->move_field_offset(-ptrdiff);
- }
- dbug_tmp_restore_column_map(table->read_set, old_map);
+ if (ptrdiff) /* fixes debug build assert - should be a tidier way to do this */
+ {
+ field[0]->move_field_offset(-ptrdiff);
+ field[1]->move_field_offset(-ptrdiff);
+ field[2]->move_field_offset(-ptrdiff);
+ }
+ dbug_tmp_restore_column_map(table->read_set, old_map);
return error_code(oqgraph::NO_MORE_DATA);
}
}
@@ -960,11 +934,11 @@ int ha_oqgraph::index_read_idx(byte * buf, uint index, const byte * key,
graph->retainLatchFieldValue(latchFieldValue.c_ptr_safe());
else
graph->retainLatchFieldValue(NULL);
-
-
- DBUG_PRINT( "oq-debug", ("index_read_idx ::>> search(latch:%s,%ld,%ld)",
+
+
+ DBUG_PRINT( "oq-debug", ("index_read_idx ::>> search(latch:%s,%ld,%ld)",
oqlatchToCode(latch), orig_idp?(long)*orig_idp:-1, dest_idp?(long)*dest_idp:-1));
-
+
res= graph->search(latchp, orig_idp, dest_idp);
DBUG_PRINT( "oq-debug", ("search() = %d", res));
@@ -995,7 +969,7 @@ int ha_oqgraph::fill_record(byte *record, const open_query::row &row)
field[5]->move_field_offset(ptrdiff);
}
- DBUG_PRINT( "oq-debug", ("fill_record() ::>> %s,%ld,%ld,%lf,%ld,%ld",
+ DBUG_PRINT( "oq-debug", ("fill_record() ::>> %s,%ld,%ld,%lf,%ld,%ld",
row.latch_indicator ? oqlatchToCode((int)row.latch) : "-",
row.orig_indicator ? (long)row.orig : -1,
row.dest_indicator ? (long)row.dest : -1,
@@ -1013,10 +987,10 @@ int ha_oqgraph::fill_record(byte *record, const open_query::row &row)
}
#ifdef RETAIN_INT_LATCH_COMPATIBILITY
else if (field[0]->type() == MYSQL_TYPE_SHORT) {
- field[0]->store((longlong) row.latch, 0);
+ field[0]->store((longlong) row.latch, 0);
}
#endif
-
+
}
if (row.orig_indicator)
@@ -1072,6 +1046,10 @@ int ha_oqgraph::rnd_init(bool scan)
int ha_oqgraph::rnd_next(byte *buf)
{
+ if (graph->get_thd() != current_thd) {
+ DBUG_PRINT( "oq-debug", ("rnd_next g->table->in_use: 0x%lx <-- current_thd 0x%lx", (long) graph->get_thd(), (long) current_thd));
+ graph->set_thd(current_thd);
+ }
int res;
open_query::row row = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
@@ -1083,6 +1061,10 @@ int ha_oqgraph::rnd_next(byte *buf)
int ha_oqgraph::rnd_pos(byte * buf, byte *pos)
{
+ if (graph->get_thd() != current_thd) {
+ DBUG_PRINT( "oq-debug", ("rnd_pos g->table->in_use: 0x%lx <-- current_thd 0x%lx", (long) graph->get_thd(), (long) current_thd));
+ graph->set_thd(current_thd);
+ }
int res;
open_query::row row;
if (!(res= graph->fetch_row(row, pos)))
@@ -1093,7 +1075,7 @@ int ha_oqgraph::rnd_pos(byte * buf, byte *pos)
void ha_oqgraph::position(const byte *record)
{
- graph->row_ref((void*) ref); // Ref is aligned
+ graph->row_ref((void*) ref); // Ref is aligned
}
int ha_oqgraph::cmp_ref(const byte *ref1, const byte *ref2)
@@ -1103,7 +1085,7 @@ int ha_oqgraph::cmp_ref(const byte *ref1, const byte *ref2)
int ha_oqgraph::info(uint flag)
{
- RECORDS= graph->edges_count();
+ stats.records = graph->edges_count();
/*
If info() is called for the first time after open(), we will still
@@ -1140,9 +1122,7 @@ int ha_oqgraph::external_lock(THD *thd, int lock_type)
}
-THR_LOCK_DATA **ha_oqgraph::store_lock(THD *thd,
- THR_LOCK_DATA **to,
- enum thr_lock_type lock_type)
+THR_LOCK_DATA **ha_oqgraph::store_lock(THD *thd, THR_LOCK_DATA **to, enum thr_lock_type lock_type)
{
return edges->file->store_lock(thd, to, lock_type);
}
@@ -1154,11 +1134,13 @@ THR_LOCK_DATA **ha_oqgraph::store_lock(THD *thd,
int ha_oqgraph::delete_table(const char *)
{
+ DBUG_PRINT( "oq-debug", ("delete_table()"));
return 0;
}
int ha_oqgraph::rename_table(const char *, const char *)
{
+ DBUG_PRINT( "oq-debug", ("rename_table()"));
return 0;
}
@@ -1166,13 +1148,18 @@ int ha_oqgraph::rename_table(const char *, const char *)
ha_rows ha_oqgraph::records_in_range(uint inx, key_range *min_key,
key_range *max_key)
{
+ if (graph->get_thd() != current_thd) {
+ DBUG_PRINT( "oq-debug", ("g->table->in_use: 0x%lx <-- current_thd 0x%lx", (long) graph->get_thd(), (long) current_thd));
+ graph->set_thd(current_thd);
+ }
+
KEY *key=table->key_info+inx;
-#ifdef VERBOSE_DEBUG
+#ifdef VERBOSE_DEBUG
{
String temp;
- key->key_part[0].field->val_str(&temp);
+ key->key_part[0].field->val_str(&temp);
temp.c_ptr_safe();
- DBUG_PRINT( "oq-debug", ("records_in_range ::>> inx=%u", inx));
+ DBUG_PRINT( "oq-debug", ("thd: 0x%lx; records_in_range ::>> inx=%u", (long) current_thd, inx));
DBUG_PRINT( "oq-debug", ("records_in_range ::>> key0=%s.", temp.c_ptr())); // for some reason when I had ...inx=%u key=%s", inx, temp.c_ptr_safe()) it printed nothing ...
}
#endif
@@ -1185,28 +1172,28 @@ ha_rows ha_oqgraph::records_in_range(uint inx, key_range *min_key,
{
if (min_key->length == key->key_part[0].store_length && !key->key_part[0].field->is_null()) /* ensure select * from x where latch is null is consistent with no latch */
{
- // If latch is not null and equals 0, return # nodes
-
+ // If latch is not null and equals 0, return # nodes
+
// How to decode the key, For VARCHAR(32), from empirical observation using the debugger
// and information gleaned from:
// http://grokbase.com/t/mysql/internals/095h6ch1q7/parsing-key-information
// http://dev.mysql.com/doc/internals/en/support-for-indexing.html#parsing-key-information
// comments in opt_range.cc
// POSSIBLY ONLY VALID FOR INNODB!
-
+
// For a the following query:
// SELECT * FROM graph2 WHERE latch = 'breadth_first' AND origid = 123 AND weight = 1;
// key->key_part[0].field->ptr is the value of latch, which is a 1-byte string length followed by the value ('breadth_first')
// key->key_part[2].field->ptr is the value of origid (123)
// key->key_part[1].field->ptr is the value of destid which is not specified in the query so we ignore it in this case
// so given this ordering we seem to be using the second key specified in create table (aka KEY (latch, destid, origid) USING HASH ))
-
+
// min_key->key[0] is the 'null' bit and contains 0 in this instance
// min_key->key[1..2] seems to be 16-bit string length
// min_key->key[3..34] hold the varchar(32) value which is that specified in the query
// min_key->key[35] is the null bit of origid
// min_key->key[36..43] is the value in the query (123)
-
+
// max_key->key[0] is the ;null' bit and contains 0 in this instance
// max_key->key[1..2] seems to be 16-bit string length
// max_key->key[3..34] hold the varchar(32) value which is that specified in the query
@@ -1214,9 +1201,9 @@ ha_rows ha_oqgraph::records_in_range(uint inx, key_range *min_key,
// max_key->key[36..43] is the value in the query (123)
// But after knowing all that, all we care about is the latch value
-
+
// First draft - ignore most of the stuff, but will likely break if query altered
-
+
// It turns out there is a better way though, to access the string,
// as demonstrated in key_unpack() of sql/key.cc
String latchCode;
@@ -1224,12 +1211,12 @@ ha_rows ha_oqgraph::records_in_range(uint inx, key_range *min_key,
if (key->key_part[0].field->type() == MYSQL_TYPE_VARCHAR) {
key->key_part[0].field->val_str(&latchCode);
-
+
parse_latch_string_to_legacy_int( latchCode, latch);
}
-
+
// what if someone did something dumb, like mismatching the latches?
-
+
#ifdef RETAIN_INT_LATCH_COMPATIBILITY
else if (key->key_part[0].field->type() == MYSQL_TYPE_SHORT) {
// If not null, and zero ...
@@ -1242,17 +1229,17 @@ ha_rows ha_oqgraph::records_in_range(uint inx, key_range *min_key,
latch = oqgraph::NO_SEARCH;
}
}
-#endif
+#endif
if (latch != oqgraph::NO_SEARCH) {
- // Invalid key type...
+ // Invalid key type...
// Don't assert, in case the user used alter table on us
- return HA_POS_ERROR; // Can only use exact keys
+ return HA_POS_ERROR; // Can only use exact keys
}
unsigned N = graph->vertices_count();
DBUG_PRINT( "oq-debug", ("records_in_range ::>> N=%u (vertices)", N));
return N;
}
- return HA_POS_ERROR; // Can only use exact keys
+ return HA_POS_ERROR; // Can only use exact keys
}
if (stats.records <= 1) {
@@ -1270,20 +1257,15 @@ ha_rows ha_oqgraph::records_in_range(uint inx, key_range *min_key,
}
-int ha_oqgraph::create(const char *name, TABLE *table_arg,
- HA_CREATE_INFO *create_info)
+int ha_oqgraph::create(const char *name, TABLE *table_arg, HA_CREATE_INFO *create_info)
{
- oqgraph_table_option_struct *options=
- reinterpret_cast<oqgraph_table_option_struct*>(table_arg->s->option_struct);
-
- DBUG_ENTER("ha_oqgraph::create");
+ DBUG_ENTER("ha_oqgraph::create");
DBUG_PRINT( "oq-debug", ("create(name=%s)", name));
if (oqgraph_check_table_structure(table_arg)) {
DBUG_RETURN(HA_WRONG_CREATE_OPTION);
}
- (void)(options);
DBUG_RETURN(0);
}
@@ -1293,25 +1275,55 @@ void ha_oqgraph::update_create_info(HA_CREATE_INFO *create_info)
table->file->info(HA_STATUS_AUTO);
}
+// --------------------
+// Handler description.
+// --------------------
+
+
+static const char oqgraph_description[]=
+ "Open Query Graph Computation Engine "
+ "(http://openquery.com/graph)";
+
struct st_mysql_storage_engine oqgraph_storage_engine=
{ MYSQL_HANDLERTON_INTERFACE_VERSION };
extern "C" const char* const oqgraph_boost_version;
-extern "C" const char* const oqgraph_judy_version;
+
+static const char *oqgraph_status_verbose_debug =
+#ifdef VERBOSE_DEBUG
+ "Verbose Debug is enabled. Performance may be adversely impacted.";
+#else
+ "Verbose Debug is not enabled.";
+#endif
+
+static const char *oqgraph_status_latch_compat_mode =
+#ifdef RETAIN_INT_LATCH_COMPATIBILITY
+ "Legacy tables with integer latches are supported.";
+#else
+ "Legacy tables with integer latches are not supported.";
+#endif
static struct st_mysql_show_var oqgraph_status[]=
{
{ "OQGraph_Boost_Version", (char*) &oqgraph_boost_version, SHOW_CHAR_PTR },
- /*{ "OQGraph_Judy_Version", (char*) &oqgraph_judy_version, SHOW_CHAR_PTR },*/
+ /* We thought about reporting the Judy version, but there seems to be no way to get that from code in the first place. */
+ { "OQGraph_Verbose_Debug", (char*) &oqgraph_status_verbose_debug, SHOW_CHAR_PTR },
+ { "OQGraph_Compat_mode", (char*) &oqgraph_status_latch_compat_mode, SHOW_CHAR_PTR },
{ 0, 0, SHOW_UNDEF }
};
#ifdef RETAIN_INT_LATCH_COMPATIBILITY
+static MYSQL_SYSVAR_BOOL( allow_create_integer_latch, g_allow_create_integer_latch, PLUGIN_VAR_RQCMDARG,
+ "Allow creation of integer latches so the upgrade logic can be tested. Not for normal use.",
+ NULL, NULL, FALSE);
+#endif
+
static struct st_mysql_sys_var* oqgraph_sysvars[]= {
+#ifdef RETAIN_INT_LATCH_COMPATIBILITY
MYSQL_SYSVAR(allow_create_integer_latch),
+#endif
0
};
-#endif
maria_declare_plugin(oqgraph)
{
@@ -1321,15 +1333,11 @@ maria_declare_plugin(oqgraph)
"Arjen Lentz & Antony T Curtis, Open Query, and Andrew McDonnell",
oqgraph_description,
PLUGIN_LICENSE_GPL,
- (int (*)(void*)) oqgraph_init, /* Plugin Init */
- oqgraph_fini, /* Plugin Deinit */
- 0x0300, /* Version: 3s.0 */
- oqgraph_status, /* status variables */
-#ifdef RETAIN_INT_LATCH_COMPATIBILITY
- oqgraph_sysvars, /* system variables */
-#else
- NULL,
-#endif
+ oqgraph_init, /* Plugin Init */
+ oqgraph_fini, /* Plugin Deinit */
+ 0x0300, /* Version: 3s.0 */
+ oqgraph_status, /* status variables */
+ oqgraph_sysvars, /* system variables */
"3.0",
MariaDB_PLUGIN_MATURITY_BETA
}
diff --git a/storage/oqgraph/ha_oqgraph.h b/storage/oqgraph/ha_oqgraph.h
index 14490270031..6013df43e6b 100644
--- a/storage/oqgraph/ha_oqgraph.h
+++ b/storage/oqgraph/ha_oqgraph.h
@@ -78,6 +78,9 @@ public:
double read_time(uint index, uint ranges, ha_rows rows)
{ return 1; }
+ // Doesn't make sense to change the engine on a virtual table.
+ virtual bool can_switch_engines() { return false; }
+
int open(const char *name, int mode, uint test_if_locked);
int close(void);
int write_row(byte * buf);
@@ -130,8 +133,10 @@ public:
}
private:
- int oqgraph_check_table_structure (TABLE *table_arg);
+ // Various helper functions
+ int oqgraph_check_table_structure (TABLE *table_arg);
+ bool validate_oqgraph_table_options();
void update_key_stats();
String error_message;
};
diff --git a/storage/oqgraph/mysql-test/oqgraph/create_attr.result b/storage/oqgraph/mysql-test/oqgraph/create_attr.result
index e9499cb7d21..c7c4b068dbe 100644
--- a/storage/oqgraph/mysql-test/oqgraph/create_attr.result
+++ b/storage/oqgraph/mysql-test/oqgraph/create_attr.result
@@ -19,29 +19,29 @@ PRIMARY KEY (id),
KEY name (info)
) DEFAULT CHARSET=latin1;
CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH;
-# Expect: 'Invalid OQGRAPH backing store (unspecified or empty data_table attribute)'
+# Expect: 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)'
DESCRIBE oqtable;
-ERROR HY000: Got error -1 'Invalid OQGRAPH backing store (unspecified or empty data_table attribute)' from OQGRAPH
+ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)' from OQGRAPH
DROP TABLE IF EXISTS oqtable;
CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, ORIGID='id', DESTID='id2';
-# Expect: 'Invalid OQGRAPH backing store (unspecified or empty data_table attribute)'
+# Expect: 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)'
DESCRIBE oqtable;
-ERROR HY000: Got error -1 'Invalid OQGRAPH backing store (unspecified or empty data_table attribute)' from OQGRAPH
+ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)' from OQGRAPH
DROP TABLE IF EXISTS oqtable;
CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='', ORIGID='id', DESTID='id2';
-# Expect: 'Invalid OQGRAPH backing store (unspecified or empty data_table attribute)'
+# Expect: 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)'
DESCRIBE oqtable;
-ERROR HY000: Got error -1 'Invalid OQGRAPH backing store (unspecified or empty data_table attribute)' from OQGRAPH
+ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)' from OQGRAPH
DROP TABLE IF EXISTS oqtable;
CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='', ORIGID='id';
-# Expect: 'Invalid OQGRAPH backing store (unspecified or empty data_table attribute)'
+# Expect: 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)'
DESCRIBE oqtable;
-ERROR HY000: Got error -1 'Invalid OQGRAPH backing store (unspecified or empty data_table attribute)' from OQGRAPH
+ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)' from OQGRAPH
DROP TABLE IF EXISTS oqtable;
CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='', DESTID='id2';
-# Expect: 'Invalid OQGRAPH backing store (unspecified or empty data_table attribute)'
+# Expect: 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)'
DESCRIBE oqtable;
-ERROR HY000: Got error -1 'Invalid OQGRAPH backing store (unspecified or empty data_table attribute)' from OQGRAPH
+ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)' from OQGRAPH
DROP TABLE IF EXISTS oqtable;
CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='bogus', ORIGID='id', DESTID='id2';
# Expect: 'Table 'test.bogus' doesn't exist''
@@ -49,19 +49,19 @@ DESCRIBE oqtable;
ERROR 42S02: Table 'test.bogus' doesn't exist
DROP TABLE IF EXISTS oqtable;
CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='not_backing';
-# Expect 'Invalid OQGRAPH backing store (unspecified or empty origid attribute)'
+# Expect 'Invalid OQGRAPH backing store description (unspecified or empty origid attribute)'
DESCRIBE oqtable;
-ERROR HY000: Got error -1 'Invalid OQGRAPH backing store (unspecified or empty origid attribute)' from OQGRAPH
+ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty origid attribute)' from OQGRAPH
DROP TABLE IF EXISTS oqtable;
CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing', DESTID='id2';
-# Expect 'Invalid OQGRAPH backing store (unspecified or empty origid attribute)'
+# Expect 'Invalid OQGRAPH backing store description (unspecified or empty origid attribute)'
DESCRIBE oqtable;
-ERROR HY000: Got error -1 'Invalid OQGRAPH backing store (unspecified or empty origid attribute)' from OQGRAPH
+ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty origid attribute)' from OQGRAPH
DROP TABLE IF EXISTS oqtable;
CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='', DESTID='id2';
-# Expect 'Invalid OQGRAPH backing store (unspecified or empty origid attribute)'
+# Expect 'Invalid OQGRAPH backing store description (unspecified or empty origid attribute)'
DESCRIBE oqtable;
-ERROR HY000: Got error -1 'Invalid OQGRAPH backing store (unspecified or empty origid attribute)' from OQGRAPH
+ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty origid attribute)' from OQGRAPH
DROP TABLE IF EXISTS oqtable;
CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='bogus', DESTID='id2';
# Expect Invalid OQGRAPH backing store ('/oqtable'.origid attribute not set to a valid column of 'backing')'
@@ -74,14 +74,14 @@ DESCRIBE oqtable;
ERROR HY000: Got error -1 'Column 'backing.not_id_type' (origid) is not a not-null integer type' from OQGRAPH
DROP TABLE IF EXISTS oqtable;
CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id';
-# Expect 'Invalid OQGRAPH backing store (unspecified or empty destid attribute)'
+# Expect 'Invalid OQGRAPH backing store description (unspecified or empty destid attribute)'
DESCRIBE oqtable;
-ERROR HY000: Got error -1 'Invalid OQGRAPH backing store (unspecified or empty destid attribute)' from OQGRAPH
+ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty destid attribute)' from OQGRAPH
DROP TABLE IF EXISTS oqtable;
CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id',DESTID='';
-# Expect 'Invalid OQGRAPH backing store (unspecified or empty destid attribute)'
+# Expect 'Invalid OQGRAPH backing store description (unspecified or empty destid attribute)'
DESCRIBE oqtable;
-ERROR HY000: Got error -1 'Invalid OQGRAPH backing store (unspecified or empty destid attribute)' from OQGRAPH
+ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty destid attribute)' from OQGRAPH
DROP TABLE IF EXISTS oqtable;
CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id',DESTID='bogus';
# Expect Invalid OQGRAPH backing store ('/oqtable'.destid attribute not set to a valid column of 'backing')'
diff --git a/storage/oqgraph/mysql-test/oqgraph/create_attr.test b/storage/oqgraph/mysql-test/oqgraph/create_attr.test
index d681d601fae..c2ca4816d09 100644
--- a/storage/oqgraph/mysql-test/oqgraph/create_attr.test
+++ b/storage/oqgraph/mysql-test/oqgraph/create_attr.test
@@ -27,7 +27,7 @@ CREATE TABLE backing (
# oqgraph v2 create table should fail (missing attributes)
CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH;
---echo # Expect: 'Invalid OQGRAPH backing store (unspecified or empty data_table attribute)'
+--echo # Expect: 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)'
--error 1296
DESCRIBE oqtable;
@@ -37,7 +37,7 @@ DESCRIBE oqtable;
DROP TABLE IF EXISTS oqtable;
--enable_warnings
CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, ORIGID='id', DESTID='id2';
---echo # Expect: 'Invalid OQGRAPH backing store (unspecified or empty data_table attribute)'
+--echo # Expect: 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)'
--error 1296
DESCRIBE oqtable;
@@ -46,7 +46,7 @@ DESCRIBE oqtable;
DROP TABLE IF EXISTS oqtable;
--enable_warnings
CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='', ORIGID='id', DESTID='id2';
---echo # Expect: 'Invalid OQGRAPH backing store (unspecified or empty data_table attribute)'
+--echo # Expect: 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)'
--error 1296
DESCRIBE oqtable;
@@ -55,7 +55,7 @@ DESCRIBE oqtable;
DROP TABLE IF EXISTS oqtable;
--enable_warnings
CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='', ORIGID='id';
---echo # Expect: 'Invalid OQGRAPH backing store (unspecified or empty data_table attribute)'
+--echo # Expect: 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)'
--error 1296
DESCRIBE oqtable;
@@ -65,7 +65,7 @@ DESCRIBE oqtable;
DROP TABLE IF EXISTS oqtable;
--enable_warnings
CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='', DESTID='id2';
---echo # Expect: 'Invalid OQGRAPH backing store (unspecified or empty data_table attribute)'
+--echo # Expect: 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)'
--error 1296
DESCRIBE oqtable;
@@ -85,7 +85,7 @@ DESCRIBE oqtable;
DROP TABLE IF EXISTS oqtable;
--enable_warnings
CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='not_backing';
---echo # Expect 'Invalid OQGRAPH backing store (unspecified or empty origid attribute)'
+--echo # Expect 'Invalid OQGRAPH backing store description (unspecified or empty origid attribute)'
--error 1296
DESCRIBE oqtable;
@@ -94,7 +94,7 @@ DESCRIBE oqtable;
DROP TABLE IF EXISTS oqtable;
--enable_warnings
CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing', DESTID='id2';
---echo # Expect 'Invalid OQGRAPH backing store (unspecified or empty origid attribute)'
+--echo # Expect 'Invalid OQGRAPH backing store description (unspecified or empty origid attribute)'
--error 1296
DESCRIBE oqtable;
@@ -103,7 +103,7 @@ DESCRIBE oqtable;
DROP TABLE IF EXISTS oqtable;
--enable_warnings
CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='', DESTID='id2';
---echo # Expect 'Invalid OQGRAPH backing store (unspecified or empty origid attribute)'
+--echo # Expect 'Invalid OQGRAPH backing store description (unspecified or empty origid attribute)'
--error 1296
DESCRIBE oqtable;
@@ -130,7 +130,7 @@ DESCRIBE oqtable;
DROP TABLE IF EXISTS oqtable;
--enable_warnings
CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id';
---echo # Expect 'Invalid OQGRAPH backing store (unspecified or empty destid attribute)'
+--echo # Expect 'Invalid OQGRAPH backing store description (unspecified or empty destid attribute)'
--error 1296
DESCRIBE oqtable;
@@ -139,7 +139,7 @@ DESCRIBE oqtable;
DROP TABLE IF EXISTS oqtable;
--enable_warnings
CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id',DESTID='';
---echo # Expect 'Invalid OQGRAPH backing store (unspecified or empty destid attribute)'
+--echo # Expect 'Invalid OQGRAPH backing store description (unspecified or empty destid attribute)'
--error 1296
DESCRIBE oqtable;
diff --git a/storage/oqgraph/mysql-test/oqgraph/create_attr_legacy.result b/storage/oqgraph/mysql-test/oqgraph/create_attr_legacy.result
index 47777b0f0a7..d3e22b4f668 100644
--- a/storage/oqgraph/mysql-test/oqgraph/create_attr_legacy.result
+++ b/storage/oqgraph/mysql-test/oqgraph/create_attr_legacy.result
@@ -23,61 +23,61 @@ CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL
Warnings:
Warning 1287 'latch SMALLINT UNSIGNED NULL' is deprecated and will be removed in a future release. Please use 'latch VARCHAR(32) NULL' instead
DESCRIBE oqtable;
-ERROR HY000: Got error -1 'Invalid OQGRAPH backing store (unspecified or empty data_table attribute)' from OQGRAPH
+ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)' from OQGRAPH
DROP TABLE IF EXISTS oqtable;
CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='';
Warnings:
Warning 1287 'latch SMALLINT UNSIGNED NULL' is deprecated and will be removed in a future release. Please use 'latch VARCHAR(32) NULL' instead
DESCRIBE oqtable;
-ERROR HY000: Got error -1 'Invalid OQGRAPH backing store (unspecified or empty data_table attribute)' from OQGRAPH
+ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)' from OQGRAPH
DROP TABLE IF EXISTS oqtable;
CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='bogus';
Warnings:
Warning 1287 'latch SMALLINT UNSIGNED NULL' is deprecated and will be removed in a future release. Please use 'latch VARCHAR(32) NULL' instead
DESCRIBE oqtable;
-ERROR HY000: Got error -1 'Invalid OQGRAPH backing store (unspecified or empty origid attribute)' from OQGRAPH
+ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty origid attribute)' from OQGRAPH
DROP TABLE IF EXISTS oqtable;
CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='Ω Ohms Tennis Ball 〄';
Warnings:
Warning 1287 'latch SMALLINT UNSIGNED NULL' is deprecated and will be removed in a future release. Please use 'latch VARCHAR(32) NULL' instead
DESCRIBE oqtable;
-ERROR HY000: Got error -1 'Invalid OQGRAPH backing store (unspecified or empty origid attribute)' from OQGRAPH
+ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty origid attribute)' from OQGRAPH
DROP TABLE IF EXISTS oqtable;
CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='not_backing', ORIGID='id';
Warnings:
Warning 1287 'latch SMALLINT UNSIGNED NULL' is deprecated and will be removed in a future release. Please use 'latch VARCHAR(32) NULL' instead
DESCRIBE oqtable;
-ERROR HY000: Got error -1 'Invalid OQGRAPH backing store (unspecified or empty destid attribute)' from OQGRAPH
+ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty destid attribute)' from OQGRAPH
DROP TABLE IF EXISTS oqtable;
CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='';
Warnings:
Warning 1287 'latch SMALLINT UNSIGNED NULL' is deprecated and will be removed in a future release. Please use 'latch VARCHAR(32) NULL' instead
DESCRIBE oqtable;
-ERROR HY000: Got error -1 'Invalid OQGRAPH backing store (unspecified or empty origid attribute)' from OQGRAPH
+ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty origid attribute)' from OQGRAPH
DROP TABLE IF EXISTS oqtable;
CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='bogus';
Warnings:
Warning 1287 'latch SMALLINT UNSIGNED NULL' is deprecated and will be removed in a future release. Please use 'latch VARCHAR(32) NULL' instead
DESCRIBE oqtable;
-ERROR HY000: Got error -1 'Invalid OQGRAPH backing store (unspecified or empty destid attribute)' from OQGRAPH
+ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty destid attribute)' from OQGRAPH
DROP TABLE IF EXISTS oqtable;
CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='not_id_type';
Warnings:
Warning 1287 'latch SMALLINT UNSIGNED NULL' is deprecated and will be removed in a future release. Please use 'latch VARCHAR(32) NULL' instead
DESCRIBE oqtable;
-ERROR HY000: Got error -1 'Invalid OQGRAPH backing store (unspecified or empty destid attribute)' from OQGRAPH
+ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty destid attribute)' from OQGRAPH
DROP TABLE IF EXISTS oqtable;
CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id';
Warnings:
Warning 1287 'latch SMALLINT UNSIGNED NULL' is deprecated and will be removed in a future release. Please use 'latch VARCHAR(32) NULL' instead
DESCRIBE oqtable;
-ERROR HY000: Got error -1 'Invalid OQGRAPH backing store (unspecified or empty destid attribute)' from OQGRAPH
+ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty destid attribute)' from OQGRAPH
DROP TABLE IF EXISTS oqtable;
CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id',DESTID='';
Warnings:
Warning 1287 'latch SMALLINT UNSIGNED NULL' is deprecated and will be removed in a future release. Please use 'latch VARCHAR(32) NULL' instead
DESCRIBE oqtable;
-ERROR HY000: Got error -1 'Invalid OQGRAPH backing store (unspecified or empty destid attribute)' from OQGRAPH
+ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty destid attribute)' from OQGRAPH
DROP TABLE IF EXISTS oqtable;
CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id',DESTID='bogus';
Warnings:
diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_mdev6282.result b/storage/oqgraph/mysql-test/oqgraph/regression_mdev6282.result
new file mode 100644
index 00000000000..42c86405503
--- /dev/null
+++ b/storage/oqgraph/mysql-test/oqgraph/regression_mdev6282.result
@@ -0,0 +1,37 @@
+CREATE TABLE `db_history` (
+`version` VARCHAR(10) NOT NULL,
+`updateJSON` MEDIUMTEXT,
+`prevVersion` VARCHAR(10) NOT NULL,
+`nodeID` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
+`prevNodeID` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
+PRIMARY KEY (`prevNodeID`,`nodeID`),
+KEY `version` (`version`) USING BTREE,
+KEY `prevVersion` (`prevVersion`) USING BTREE,
+KEY `nodeID` (`nodeID`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+INSERT INTO `db_history` VALUES
+('0.0.1','{}','0.0.0',1,0),
+('0.0.2','{\"data\":{\"add\":{},\"update\":{},\"delete\":{}}}','0.0.1',2,1),
+('0.0.3','{\"data\":{\"add\":{},\"update\":{},\"delete\":{}}}','0.0.2',3,2);
+CREATE TABLE IF NOT EXISTS version_history (
+latch VARCHAR(32) NULL,
+origid BIGINT UNSIGNED NULL,
+destid BIGINT UNSIGNED NULL,
+weight DOUBLE NULL,
+seq BIGINT UNSIGNED NULL,
+linkid BIGINT UNSIGNED NULL,
+KEY (latch, origid, destid) USING HASH,
+KEY (latch, destid, origid) USING HASH
+) ENGINE=OQGRAPH DATA_TABLE='db_history' ORIGID='prevNodeID' DESTID='nodeID';
+SELECT `db`.`version`, `db`.`nodeID`
+FROM `version_history` AS `v` INNER JOIN `db_history` AS `db` ON `db`.`nodeID` = `v`.`linkid`
+WHERE `latch` = 'breadth_first' AND `origid` = '1' ORDER BY `weight` DESC LIMIT 1;
+version nodeID
+0.0.3 3
+SELECT `db`.`version`, `db`.`nodeID`
+FROM `version_history` AS `v` INNER JOIN `db_history` AS `db` ON `db`.`nodeID` = `v`.`linkid`
+WHERE `latch` = 'breadth_first' AND `origid` = '1' ORDER BY `weight` DESC LIMIT 1;
+version nodeID
+0.0.3 3
+DROP TABLE db_history;
+DROP TABLE version_history;
diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_mdev6282.test b/storage/oqgraph/mysql-test/oqgraph/regression_mdev6282.test
new file mode 100644
index 00000000000..3a7a0e5af08
--- /dev/null
+++ b/storage/oqgraph/mysql-test/oqgraph/regression_mdev6282.test
@@ -0,0 +1,47 @@
+--connect (con1,localhost,root,,test)
+
+ CREATE TABLE `db_history` (
+ `version` VARCHAR(10) NOT NULL,
+ `updateJSON` MEDIUMTEXT,
+ `prevVersion` VARCHAR(10) NOT NULL,
+ `nodeID` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
+ `prevNodeID` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
+ PRIMARY KEY (`prevNodeID`,`nodeID`),
+ KEY `version` (`version`) USING BTREE,
+ KEY `prevVersion` (`prevVersion`) USING BTREE,
+ KEY `nodeID` (`nodeID`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+ INSERT INTO `db_history` VALUES
+ ('0.0.1','{}','0.0.0',1,0),
+ ('0.0.2','{\"data\":{\"add\":{},\"update\":{},\"delete\":{}}}','0.0.1',2,1),
+ ('0.0.3','{\"data\":{\"add\":{},\"update\":{},\"delete\":{}}}','0.0.2',3,2);
+
+ CREATE TABLE IF NOT EXISTS version_history (
+ latch VARCHAR(32) NULL,
+ origid BIGINT UNSIGNED NULL,
+ destid BIGINT UNSIGNED NULL,
+ weight DOUBLE NULL,
+ seq BIGINT UNSIGNED NULL,
+ linkid BIGINT UNSIGNED NULL,
+ KEY (latch, origid, destid) USING HASH,
+ KEY (latch, destid, origid) USING HASH
+ ) ENGINE=OQGRAPH DATA_TABLE='db_history' ORIGID='prevNodeID' DESTID='nodeID';
+
+ SELECT `db`.`version`, `db`.`nodeID`
+ FROM `version_history` AS `v` INNER JOIN `db_history` AS `db` ON `db`.`nodeID` = `v`.`linkid`
+ WHERE `latch` = 'breadth_first' AND `origid` = '1' ORDER BY `weight` DESC LIMIT 1;
+--disconnect con1
+
+--connect (con2,localhost,root,,test)
+ SELECT `db`.`version`, `db`.`nodeID`
+ FROM `version_history` AS `v` INNER JOIN `db_history` AS `db` ON `db`.`nodeID` = `v`.`linkid`
+ WHERE `latch` = 'breadth_first' AND `origid` = '1' ORDER BY `weight` DESC LIMIT 1;
+--disconnect con2
+
+--connect (con3,localhost,root,,test)
+DROP TABLE db_history;
+DROP TABLE version_history;
+--disconnect con3
+
+
diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_mdev6345.result b/storage/oqgraph/mysql-test/oqgraph/regression_mdev6345.result
new file mode 100644
index 00000000000..8e680e15206
--- /dev/null
+++ b/storage/oqgraph/mysql-test/oqgraph/regression_mdev6345.result
@@ -0,0 +1,12 @@
+DROP TABLE IF EXISTS oq_backing;
+DROP TABLE IF EXISTS oq_graph;
+CREATE TABLE oq_backing (origid INT UNSIGNED NOT NULL, destid INT UNSIGNED NOT NULL, PRIMARY KEY (origid, destid), KEY (destid));
+INSERT INTO oq_backing(origid, destid) VALUES (1,2), (2,3), (3,4), (4,5), (2,6), (5,6);
+CREATE TABLE oq_graph (latch VARCHAR(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH) ENGINE=OQGRAPH data_table='oq_backing' origid='origid' destid='destid';
+SELECT * FROM oq_graph WHERE latch='breadth_first' AND origid=1 AND destid=6;
+latch origid destid weight seq linkid
+breadth_first 1 6 NULL 0 1
+breadth_first 1 6 1 1 2
+breadth_first 1 6 1 2 6
+DROP TABLE IF EXISTS oq_backing;
+DROP TABLE IF EXISTS oq_graph;
diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_mdev6345.test b/storage/oqgraph/mysql-test/oqgraph/regression_mdev6345.test
new file mode 100644
index 00000000000..72de926da2e
--- /dev/null
+++ b/storage/oqgraph/mysql-test/oqgraph/regression_mdev6345.test
@@ -0,0 +1,19 @@
+#-- This test is probably not right, because the real bug manifested over a network connection on a busy server.
+
+--disable_warnings
+DROP TABLE IF EXISTS oq_backing;
+DROP TABLE IF EXISTS oq_graph;
+--enable_warnings
+
+
+CREATE TABLE oq_backing (origid INT UNSIGNED NOT NULL, destid INT UNSIGNED NOT NULL, PRIMARY KEY (origid, destid), KEY (destid));
+
+INSERT INTO oq_backing(origid, destid) VALUES (1,2), (2,3), (3,4), (4,5), (2,6), (5,6);
+
+CREATE TABLE oq_graph (latch VARCHAR(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH) ENGINE=OQGRAPH data_table='oq_backing' origid='origid' destid='destid';
+
+SELECT * FROM oq_graph WHERE latch='breadth_first' AND origid=1 AND destid=6;
+
+DROP TABLE IF EXISTS oq_backing;
+DROP TABLE IF EXISTS oq_graph;
+
diff --git a/storage/oqgraph/oqgraph_judy.cc b/storage/oqgraph/oqgraph_judy.cc
index acd7c2ae4c1..020cab57ed2 100644
--- a/storage/oqgraph/oqgraph_judy.cc
+++ b/storage/oqgraph/oqgraph_judy.cc
@@ -25,12 +25,6 @@
#include "oqgraph_judy.h"
#include <Judy.h>
-#ifndef JUDY_LIB_VERSION
-#define JUDY_LIB_VERSION "(unknown)"
-#endif
-
-extern "C" const char* const oqgraph_judy_version= JUDY_LIB_VERSION;
-
void open_query::judy_bitset::clear()
{
int rc;
diff --git a/storage/oqgraph/oqgraph_thunk.cc b/storage/oqgraph/oqgraph_thunk.cc
index 0e7b1f2b8ed..0ffd5cca414 100644
--- a/storage/oqgraph/oqgraph_thunk.cc
+++ b/storage/oqgraph/oqgraph_thunk.cc
@@ -547,6 +547,9 @@ bool oqgraph3::cursor::operator!=(const cursor& x) const
return record_position() != x._position;
}
+::THD* oqgraph3::graph::get_table_thd() { return _table->in_use; }
+void oqgraph3::graph::set_table_thd(::THD* thd) { _table->in_use = thd; }
+
oqgraph3::graph::graph(
::TABLE* table,
::Field* source,
diff --git a/storage/oqgraph/oqgraph_thunk.h b/storage/oqgraph/oqgraph_thunk.h
index 11e2723af14..7930e2d6c69 100644
--- a/storage/oqgraph/oqgraph_thunk.h
+++ b/storage/oqgraph/oqgraph_thunk.h
@@ -146,6 +146,9 @@ namespace oqgraph3
::Field* _target;
::Field* _weight;
+ ::THD* get_table_thd();
+ void set_table_thd(::THD* thd);
+
graph(
::TABLE* table,
::Field* source,
diff --git a/storage/perfschema/CMakeLists.txt b/storage/perfschema/CMakeLists.txt
index dcd0bbac15f..3b3ffae6357 100644
--- a/storage/perfschema/CMakeLists.txt
+++ b/storage/perfschema/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2015, 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
@@ -21,31 +21,11 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}
ADD_DEFINITIONS(-DMYSQL_SERVER)
-# Gen_pfs_lex_token
-IF(NOT CMAKE_CROSSCOMPILING)
- ADD_EXECUTABLE(gen_pfs_lex_token gen_pfs_lex_token.cc)
- # gen_pfs_lex_token itself depends on ${CMAKE_CURRENT_BINARY_DIR}/sql/sql_yacc.h
- ADD_DEPENDENCIES(gen_pfs_lex_token GenServerSource)
-ENDIF()
-
-ADD_CUSTOM_COMMAND(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/pfs_lex_token.h
- COMMAND gen_pfs_lex_token > pfs_lex_token.h
- DEPENDS gen_pfs_lex_token
-)
-
-SET(PFS_GEN_SOURCES
- ${CMAKE_CURRENT_BINARY_DIR}/pfs_lex_token.h
-)
-
-SET_SOURCE_FILES_PROPERTIES(${PFS_GEN_SOURCES} PROPERTIES GENERATED 1)
-
#
# Maintainer: keep this list sorted, to avoid merge collisions.
# Tip: ls -1 *.h, ls -1 *.cc
#
SET(PERFSCHEMA_SOURCES
-${PFS_GEN_SOURCES}
ha_perfschema.h
cursor_by_account.h
cursor_by_host.h
diff --git a/storage/perfschema/ha_perfschema.cc b/storage/perfschema/ha_perfschema.cc
index 95ac1c85f00..7fe4de84684 100644
--- a/storage/perfschema/ha_perfschema.cc
+++ b/storage/perfschema/ha_perfschema.cc
@@ -205,7 +205,7 @@ maria_declare_plugin(perfschema)
0x0001,
pfs_status_vars,
NULL,
- "5.6.20",
+ "5.6.25",
MariaDB_PLUGIN_MATURITY_STABLE
}
maria_declare_plugin_end;
diff --git a/storage/perfschema/pfs.cc b/storage/perfschema/pfs.cc
index fa87269a054..ea8a04a78ae 100644
--- a/storage/perfschema/pfs.cc
+++ b/storage/perfschema/pfs.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2015, 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
@@ -4455,7 +4455,7 @@ get_thread_statement_locker_v1(PSI_statement_locker_state *state,
pfs->m_sort_scan= 0;
pfs->m_no_index_used= 0;
pfs->m_no_good_index_used= 0;
- digest_reset(& pfs->m_digest_storage);
+ pfs->m_digest_storage.reset();
/* New stages will have this statement as parent */
PFS_events_stages *child_stage= & pfs_thread->m_stage_current;
@@ -4484,11 +4484,7 @@ get_thread_statement_locker_v1(PSI_statement_locker_state *state,
if (flag_statements_digest)
{
- const CHARSET_INFO *cs= static_cast <const CHARSET_INFO*> (charset);
flags|= STATE_FLAG_DIGEST;
- state->m_digest_state.m_last_id_index= 0;
- digest_reset(& state->m_digest_state.m_digest_storage);
- state->m_digest_state.m_digest_storage.m_charset_number= cs->number;
}
state->m_discarded= false;
@@ -4512,6 +4508,8 @@ get_thread_statement_locker_v1(PSI_statement_locker_state *state,
state->m_no_index_used= 0;
state->m_no_good_index_used= 0;
+ state->m_digest= NULL;
+
state->m_schema_name_length= 0;
return reinterpret_cast<PSI_statement_locker*> (state);
@@ -4781,11 +4779,11 @@ static void end_statement_v1(PSI_statement_locker *locker, void *stmt_da)
PFS_statement_stat *event_name_array;
uint index= klass->m_event_name_index;
PFS_statement_stat *stat;
-
+
/*
Capture statement stats by digest.
*/
- PSI_digest_storage *digest_storage= NULL;
+ const sql_digest_storage *digest_storage= NULL;
PFS_statement_stat *digest_stat= NULL;
if (flags & STATE_FLAG_THREAD)
@@ -4798,11 +4796,15 @@ static void end_statement_v1(PSI_statement_locker *locker, void *stmt_da)
if (flags & STATE_FLAG_DIGEST)
{
- digest_storage= &state->m_digest_state.m_digest_storage;
- /* Populate PFS_statements_digest_stat with computed digest information.*/
- digest_stat= find_or_create_digest(thread, digest_storage,
- state->m_schema_name,
- state->m_schema_name_length);
+ digest_storage= state->m_digest;
+
+ if (digest_storage != NULL)
+ {
+ /* Populate PFS_statements_digest_stat with computed digest information.*/
+ digest_stat= find_or_create_digest(thread, digest_storage,
+ state->m_schema_name,
+ state->m_schema_name_length);
+ }
}
if (flags & STATE_FLAG_EVENT)
@@ -4839,7 +4841,7 @@ static void end_statement_v1(PSI_statement_locker *locker, void *stmt_da)
pfs->m_timer_end= timer_end;
pfs->m_end_event_id= thread->m_event_id;
- if (flags & STATE_FLAG_DIGEST)
+ if (digest_storage != NULL)
{
/*
The following columns in events_statement_current:
@@ -4847,7 +4849,7 @@ static void end_statement_v1(PSI_statement_locker *locker, void *stmt_da)
- DIGEST_TEXT
are computed from the digest storage.
*/
- digest_copy(& pfs->m_digest_storage, digest_storage);
+ pfs->m_digest_storage.copy(digest_storage);
}
if (flag_events_statements_history)
@@ -4870,11 +4872,15 @@ static void end_statement_v1(PSI_statement_locker *locker, void *stmt_da)
if (thread != NULL)
{
/* Set digest stat. */
- digest_storage= &state->m_digest_state.m_digest_storage;
- /* Populate statements_digest_stat with computed digest information. */
- digest_stat= find_or_create_digest(thread, digest_storage,
- state->m_schema_name,
- state->m_schema_name_length);
+ digest_storage= state->m_digest;
+
+ if (digest_storage != NULL)
+ {
+ /* Populate statements_digest_stat with computed digest information. */
+ digest_stat= find_or_create_digest(thread, digest_storage,
+ state->m_schema_name,
+ state->m_schema_name_length);
+ }
}
}
@@ -4921,7 +4927,7 @@ static void end_statement_v1(PSI_statement_locker *locker, void *stmt_da)
{
digest_stat->aggregate_counted();
}
-
+
digest_stat->m_lock_time+= state->m_lock_time;
digest_stat->m_rows_sent+= state->m_rows_sent;
digest_stat->m_rows_examined+= state->m_rows_examined;
@@ -5106,6 +5112,39 @@ static void set_socket_thread_owner_v1(PSI_socket *socket)
pfs_socket->m_thread_owner= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS);
}
+struct PSI_digest_locker*
+pfs_digest_start_v1(PSI_statement_locker *locker)
+{
+ PSI_statement_locker_state *statement_state;
+ statement_state= reinterpret_cast<PSI_statement_locker_state*> (locker);
+ DBUG_ASSERT(statement_state != NULL);
+
+ if (statement_state->m_discarded)
+ return NULL;
+
+ if (statement_state->m_flags & STATE_FLAG_DIGEST)
+ {
+ return reinterpret_cast<PSI_digest_locker*> (locker);
+ }
+
+ return NULL;
+}
+
+void pfs_digest_end_v1(PSI_digest_locker *locker, const sql_digest_storage *digest)
+{
+ PSI_statement_locker_state *statement_state;
+ statement_state= reinterpret_cast<PSI_statement_locker_state*> (locker);
+ DBUG_ASSERT(statement_state != NULL);
+ DBUG_ASSERT(digest != NULL);
+
+ if (statement_state->m_discarded)
+ return;
+
+ if (statement_state->m_flags & STATE_FLAG_DIGEST)
+ {
+ statement_state->m_digest= digest;
+ }
+}
/**
Implementation of the thread attribute connection interface
@@ -5243,7 +5282,7 @@ PSI_v1 PFS_v1=
set_socket_info_v1,
set_socket_thread_owner_v1,
pfs_digest_start_v1,
- pfs_digest_add_token_v1,
+ pfs_digest_end_v1,
set_thread_connect_attrs_v1,
};
diff --git a/storage/perfschema/pfs_account.cc b/storage/perfschema/pfs_account.cc
index 0e4c6cb1d04..3eff670f44d 100644
--- a/storage/perfschema/pfs_account.cc
+++ b/storage/perfschema/pfs_account.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2010, 2015, 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
diff --git a/storage/perfschema/pfs_column_types.h b/storage/perfschema/pfs_column_types.h
index 23ef946ee82..c70ca220d84 100644
--- a/storage/perfschema/pfs_column_types.h
+++ b/storage/perfschema/pfs_column_types.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2015, 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
diff --git a/storage/perfschema/pfs_digest.cc b/storage/perfschema/pfs_digest.cc
index c3c52bbd56d..5b61d6a14fe 100644
--- a/storage/perfschema/pfs_digest.cc
+++ b/storage/perfschema/pfs_digest.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2015, 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
@@ -28,54 +28,32 @@
#include "pfs_digest.h"
#include "pfs_global.h"
#include "table_helper.h"
-#include "my_md5.h"
#include "sql_lex.h"
#include "sql_get_diagnostics.h"
#include "sql_string.h"
#include <string.h>
-/* Generated code */
-#include "../sql/sql_yacc.h"
-#include "../storage/perfschema/pfs_lex_token.h"
-
-/* Name pollution from sql/sql_lex.h */
-#ifdef LEX_YYSTYPE
-#undef LEX_YYSTYPE
-#endif
-
-#define LEX_YYSTYPE YYSTYPE
-
-/**
- Token array :
- Token array is an array of bytes to store tokens received during parsing.
- Following is the way token array is formed.
-
- ...<non-id-token><non-id-token><id-token><id_len><id_text>...
-
- For Ex:
- SELECT * FROM T1;
- <SELECT_TOKEN><*><FROM_TOKEN><ID_TOKEN><2><T1>
-*/
-
ulong digest_max= 0;
ulong digest_lost= 0;
/** EVENTS_STATEMENTS_HISTORY_LONG circular buffer. */
PFS_statements_digest_stat *statements_digest_stat_array= NULL;
+static unsigned char *statements_digest_token_array= NULL;
/** Consumer flag for table EVENTS_STATEMENTS_SUMMARY_BY_DIGEST. */
bool flag_statements_digest= true;
/**
Current index in Stat array where new record is to be inserted.
index 0 is reserved for "all else" case when entire array is full.
*/
-volatile uint32 digest_index= 1;
+volatile uint32 digest_index;
+bool digest_full= false;
LF_HASH digest_hash;
static bool digest_hash_inited= false;
/**
Initialize table EVENTS_STATEMENTS_SUMMARY_BY_DIGEST.
- @param digest_sizing
+ @param param performance schema sizing
*/
int init_digest(const PFS_global_param *param)
{
@@ -87,19 +65,41 @@ int init_digest(const PFS_global_param *param)
*/
digest_max= param->m_digest_sizing;
digest_lost= 0;
+ digest_index= 1;
+ digest_full= false;
if (digest_max == 0)
return 0;
statements_digest_stat_array=
- PFS_MALLOC_ARRAY(digest_max, PFS_statements_digest_stat,
+ PFS_MALLOC_ARRAY(digest_max,
+ PFS_statements_digest_stat,
MYF(MY_ZEROFILL));
+
if (unlikely(statements_digest_stat_array == NULL))
+ {
+ cleanup_digest();
return 1;
+ }
+
+ if (pfs_max_digest_length > 0)
+ {
+ statements_digest_token_array=
+ PFS_MALLOC_ARRAY(digest_max * pfs_max_digest_length,
+ unsigned char,
+ MYF(MY_ZEROFILL));
+
+ if (unlikely(statements_digest_token_array == NULL))
+ {
+ cleanup_digest();
+ return 1;
+ }
+ }
for (index= 0; index < digest_max; index++)
{
- statements_digest_stat_array[index].reset_data();
+ statements_digest_stat_array[index].reset_data(statements_digest_token_array
+ + index * pfs_max_digest_length, pfs_max_digest_length);
}
return 0;
@@ -110,7 +110,9 @@ void cleanup_digest(void)
{
/* Free memory allocated to statements_digest_stat_array. */
pfs_free(statements_digest_stat_array);
+ pfs_free(statements_digest_token_array);
statements_digest_stat_array= NULL;
+ statements_digest_token_array= NULL;
}
C_MODE_START
@@ -170,10 +172,12 @@ static LF_PINS* get_digest_hash_pins(PFS_thread *thread)
PFS_statement_stat*
find_or_create_digest(PFS_thread *thread,
- PSI_digest_storage *digest_storage,
+ const sql_digest_storage *digest_storage,
const char *schema_name,
uint schema_name_length)
{
+ DBUG_ASSERT(digest_storage != NULL);
+
if (statements_digest_stat_array == NULL)
return NULL;
@@ -192,9 +196,8 @@ find_or_create_digest(PFS_thread *thread,
PFS_digest_key hash_key;
memset(& hash_key, 0, sizeof(hash_key));
/* Compute MD5 Hash of the tokens received. */
- compute_md5_hash((char *) hash_key.m_md5,
- (char *) digest_storage->m_token_array,
- digest_storage->m_byte_count);
+ compute_digest_md5(digest_storage, hash_key.m_md5);
+ memcpy((void*)& digest_storage->m_md5, &hash_key.m_md5, MD5_HASH_SIZE);
/* Add the current schema to the key */
hash_key.m_schema_name_length= schema_name_length;
if (schema_name_length > 0)
@@ -227,8 +230,7 @@ search:
lf_hash_search_unpin(pins);
- /* Dirty read of digest_index */
- if (digest_index == 0)
+ if (digest_full)
{
/* digest_stat array is full. Add stat at index 0 and return. */
pfs= &statements_digest_stat_array[0];
@@ -244,7 +246,7 @@ search:
if (safe_index >= digest_max)
{
/* The digest array is now full. */
- digest_index= 0;
+ digest_full= true;
pfs= &statements_digest_stat_array[0];
if (pfs->m_first_seen == 0)
@@ -263,7 +265,7 @@ search:
Copy digest storage to statement_digest_stat_array so that it could be
used later to generate digest text.
*/
- digest_copy(& pfs->m_digest_storage, digest_storage);
+ pfs->m_digest_storage.copy(digest_storage);
pfs->m_first_seen= now;
pfs->m_last_seen= now;
@@ -313,9 +315,9 @@ void purge_digest(PFS_thread* thread, PFS_digest_key *hash_key)
return;
}
-void PFS_statements_digest_stat::reset_data()
+void PFS_statements_digest_stat::reset_data(unsigned char *token_array, uint length)
{
- digest_reset(& m_digest_storage);
+ m_digest_storage.reset(token_array, length);
m_stat.reset();
m_first_seen= 0;
m_last_seen= 0;
@@ -345,7 +347,7 @@ void reset_esms_by_digest()
for (index= 0; index < digest_max; index++)
{
statements_digest_stat_array[index].reset_index(thread);
- statements_digest_stat_array[index].reset_data();
+ statements_digest_stat_array[index].reset_data(statements_digest_token_array + index * pfs_max_digest_length, pfs_max_digest_length);
}
/*
@@ -353,448 +355,6 @@ void reset_esms_by_digest()
to be inserted in statements_digest_stat_array.
*/
digest_index= 1;
+ digest_full= false;
}
-/*
- Iterate token array and updates digest_text.
-*/
-void get_digest_text(char* digest_text, PSI_digest_storage* digest_storage)
-{
- DBUG_ASSERT(digest_storage != NULL);
- bool truncated= false;
- int byte_count= digest_storage->m_byte_count;
- char *digest_output= digest_text;
- int bytes_needed= 0;
- uint tok= 0;
- int current_byte= 0;
- lex_token_string *tok_data;
- /* -4 is to make sure extra space for '...' and a '\0' at the end. */
- int bytes_available= COL_DIGEST_TEXT_SIZE - 4;
-
- if (byte_count <= 0 || byte_count > PSI_MAX_DIGEST_STORAGE_SIZE)
- {
- *digest_text= '\0';
- return;
- }
-
- /* Convert text to utf8 */
- const CHARSET_INFO *from_cs= get_charset(digest_storage->m_charset_number, MYF(0));
- const CHARSET_INFO *to_cs= &my_charset_utf8_bin;
-
- if (from_cs == NULL)
- {
- /*
- Can happen, as we do dirty reads on digest_storage,
- which can be written to in another thread.
- */
- *digest_text= '\0';
- return;
- }
-
- /*
- Max converted size is number of characters * max multibyte length of the
- target charset, which is 4 for UTF8.
- */
- const uint max_converted_size= PSI_MAX_DIGEST_STORAGE_SIZE * 4;
- char id_buffer[max_converted_size];
- char *id_string;
- int id_length;
- bool convert_text= !my_charset_same(from_cs, to_cs);
-
- DBUG_ASSERT(byte_count <= PSI_MAX_DIGEST_STORAGE_SIZE);
-
- while ((current_byte < byte_count) &&
- (bytes_available > 0) &&
- !truncated)
- {
- current_byte= read_token(digest_storage, current_byte, &tok);
-
- if (tok <= 0 || tok >= array_elements(lex_token_array))
- {
- *digest_text='\0';
- return;
- }
-
- tok_data= &lex_token_array[tok];
-
- switch (tok)
- {
- /* All identifiers are printed with their name. */
- case IDENT:
- case IDENT_QUOTED:
- {
- char *id_ptr;
- int id_len;
- uint err_cs= 0;
-
- /* Get the next identifier from the storage buffer. */
- current_byte= read_identifier(digest_storage, current_byte,
- &id_ptr, &id_len);
- if (convert_text)
- {
- /* Verify that the converted text will fit. */
- if (to_cs->mbmaxlen*id_len > max_converted_size)
- {
- truncated= true;
- break;
- }
- /* Convert identifier string into the storage character set. */
- id_length= my_convert(id_buffer, max_converted_size, to_cs,
- id_ptr, id_len, from_cs, &err_cs);
- id_string= id_buffer;
- }
- else
- {
- id_string= id_ptr;
- id_length= id_len;
- }
-
- if (id_length == 0 || err_cs != 0)
- {
- truncated= true;
- break;
- }
- /* Copy the converted identifier into the digest string. */
- bytes_needed= id_length + (tok == IDENT ? 1 : 3);
- if (bytes_needed <= bytes_available)
- {
- if (tok == IDENT_QUOTED)
- *digest_output++= '`';
- if (id_length > 0)
- {
- memcpy(digest_output, id_string, id_length);
- digest_output+= id_length;
- }
- if (tok == IDENT_QUOTED)
- *digest_output++= '`';
- *digest_output++= ' ';
- bytes_available-= bytes_needed;
- }
- else
- {
- truncated= true;
- }
- }
- break;
-
- /* Everything else is printed as is. */
- default:
- /*
- Make sure not to overflow digest_text buffer.
- +1 is to make sure extra space for ' '.
- */
- int tok_length= tok_data->m_token_length;
- bytes_needed= tok_length + 1;
-
- if (bytes_needed <= bytes_available)
- {
- strncpy(digest_output, tok_data->m_token_string, tok_length);
- digest_output+= tok_length;
- *digest_output++= ' ';
- bytes_available-= bytes_needed;
- }
- else
- {
- truncated= true;
- }
- break;
- }
- }
-
- /* Truncate digest text in case of long queries. */
- if (digest_storage->m_full || truncated)
- {
- strcpy(digest_output, "...");
- digest_output+= 3;
- }
-
- *digest_output= '\0';
-}
-
-static inline uint peek_token(const PSI_digest_storage *digest, int index)
-{
- uint token;
- DBUG_ASSERT(index >= 0);
- DBUG_ASSERT(index + PFS_SIZE_OF_A_TOKEN <= digest->m_byte_count);
- DBUG_ASSERT(digest->m_byte_count <= PSI_MAX_DIGEST_STORAGE_SIZE);
-
- token= ((digest->m_token_array[index + 1])<<8) | digest->m_token_array[index];
- return token;
-}
-
-/**
- Function to read last two tokens from token array. If an identifier
- is found, do not look for token before that.
-*/
-static inline void peek_last_two_tokens(const PSI_digest_storage* digest_storage,
- int last_id_index, uint *t1, uint *t2)
-{
- int byte_count= digest_storage->m_byte_count;
- int peek_index= byte_count - PFS_SIZE_OF_A_TOKEN;
-
- if (last_id_index <= peek_index)
- {
- /* Take last token. */
- *t1= peek_token(digest_storage, peek_index);
-
- peek_index-= PFS_SIZE_OF_A_TOKEN;
- if (last_id_index <= peek_index)
- {
- /* Take 2nd token from last. */
- *t2= peek_token(digest_storage, peek_index);
- }
- else
- {
- *t2= TOK_PFS_UNUSED;
- }
- }
- else
- {
- *t1= TOK_PFS_UNUSED;
- *t2= TOK_PFS_UNUSED;
- }
-}
-
-struct PSI_digest_locker* pfs_digest_start_v1(PSI_statement_locker *locker)
-{
- PSI_statement_locker_state *statement_state;
- statement_state= reinterpret_cast<PSI_statement_locker_state*> (locker);
- DBUG_ASSERT(statement_state != NULL);
-
- if (statement_state->m_discarded)
- return NULL;
-
- if (statement_state->m_flags & STATE_FLAG_DIGEST)
- {
- PSI_digest_locker_state *digest_state;
- digest_state= &statement_state->m_digest_state;
- return reinterpret_cast<PSI_digest_locker*> (digest_state);
- }
-
- return NULL;
-}
-
-PSI_digest_locker* pfs_digest_add_token_v1(PSI_digest_locker *locker,
- uint token,
- OPAQUE_LEX_YYSTYPE *yylval)
-{
- PSI_digest_locker_state *state= NULL;
- PSI_digest_storage *digest_storage= NULL;
-
- state= reinterpret_cast<PSI_digest_locker_state*> (locker);
- DBUG_ASSERT(state != NULL);
-
- digest_storage= &state->m_digest_storage;
-
- /*
- Stop collecting further tokens if digest storage is full or
- if END token is received.
- */
- if (digest_storage->m_full || token == END_OF_INPUT)
- return NULL;
-
- /*
- Take last_token 2 tokens collected till now. These tokens will be used
- in reduce for normalisation. Make sure not to consider ID tokens in reduce.
- */
- uint last_token;
- uint last_token2;
-
- switch (token)
- {
- case NUM:
- case LONG_NUM:
- case ULONGLONG_NUM:
- case DECIMAL_NUM:
- case FLOAT_NUM:
- case BIN_NUM:
- case HEX_NUM:
- {
- bool found_unary;
- do
- {
- found_unary= false;
- peek_last_two_tokens(digest_storage, state->m_last_id_index,
- &last_token, &last_token2);
-
- if ((last_token == '-') || (last_token == '+'))
- {
- /*
- We need to differentiate:
- - a <unary minus> operator
- - a <unary plus> operator
- from
- - a <binary minus> operator
- - a <binary plus> operator
- to only reduce "a = -1" to "a = ?", and not change "b - 1" to "b ?"
-
- Binary operators are found inside an expression,
- while unary operators are found at the beginning of an expression, or after operators.
-
- To achieve this, every token that is followed by an <expr> expression
- in the SQL grammar is flagged.
- See sql/sql_yacc.yy
- See sql/gen_lex_token.cc
-
- For example,
- "(-1)" is parsed as "(", "-", NUM, ")", and lex_token_array["("].m_start_expr is true,
- so reduction of the "-" NUM is done, the result is "(?)".
- "(a-1)" is parsed as "(", ID, "-", NUM, ")", and lex_token_array[ID].m_start_expr is false,
- so the operator is binary, no reduction is done, and the result is "(a-?)".
- */
- if (lex_token_array[last_token2].m_start_expr)
- {
- /*
- REDUCE:
- TOK_PFS_GENERIC_VALUE := (UNARY_PLUS | UNARY_MINUS) (NUM | LOG_NUM | ... | FLOAT_NUM)
-
- REDUCE:
- TOK_PFS_GENERIC_VALUE := (UNARY_PLUS | UNARY_MINUS) TOK_PFS_GENERIC_VALUE
- */
- token= TOK_PFS_GENERIC_VALUE;
- digest_storage->m_byte_count-= PFS_SIZE_OF_A_TOKEN;
- found_unary= true;
- }
- }
- } while (found_unary);
- }
- /* fall through, for case NULL_SYM below */
- case LEX_HOSTNAME:
- case TEXT_STRING:
- case NCHAR_STRING:
- case PARAM_MARKER:
- {
- /*
- REDUCE:
- TOK_PFS_GENERIC_VALUE := BIN_NUM | DECIMAL_NUM | ... | ULONGLONG_NUM
- */
- token= TOK_PFS_GENERIC_VALUE;
- }
- /* fall through */
- case NULL_SYM:
- {
- peek_last_two_tokens(digest_storage, state->m_last_id_index,
- &last_token, &last_token2);
-
- if ((last_token2 == TOK_PFS_GENERIC_VALUE ||
- last_token2 == TOK_PFS_GENERIC_VALUE_LIST ||
- last_token2 == NULL_SYM) &&
- (last_token == ','))
- {
- /*
- REDUCE:
- TOK_PFS_GENERIC_VALUE_LIST :=
- (TOK_PFS_GENERIC_VALUE|NULL_SYM) ',' (TOK_PFS_GENERIC_VALUE|NULL_SYM)
-
- REDUCE:
- TOK_PFS_GENERIC_VALUE_LIST :=
- TOK_PFS_GENERIC_VALUE_LIST ',' (TOK_PFS_GENERIC_VALUE|NULL_SYM)
- */
- digest_storage->m_byte_count-= 2*PFS_SIZE_OF_A_TOKEN;
- token= TOK_PFS_GENERIC_VALUE_LIST;
- }
- /*
- Add this token or the resulting reduce to digest storage.
- */
- store_token(digest_storage, token);
- break;
- }
- case ')':
- {
- peek_last_two_tokens(digest_storage, state->m_last_id_index,
- &last_token, &last_token2);
-
- if (last_token == TOK_PFS_GENERIC_VALUE &&
- last_token2 == '(')
- {
- /*
- REDUCE:
- TOK_PFS_ROW_SINGLE_VALUE :=
- '(' TOK_PFS_GENERIC_VALUE ')'
- */
- digest_storage->m_byte_count-= 2*PFS_SIZE_OF_A_TOKEN;
- token= TOK_PFS_ROW_SINGLE_VALUE;
-
- /* Read last two tokens again */
- peek_last_two_tokens(digest_storage, state->m_last_id_index,
- &last_token, &last_token2);
-
- if ((last_token2 == TOK_PFS_ROW_SINGLE_VALUE ||
- last_token2 == TOK_PFS_ROW_SINGLE_VALUE_LIST) &&
- (last_token == ','))
- {
- /*
- REDUCE:
- TOK_PFS_ROW_SINGLE_VALUE_LIST :=
- TOK_PFS_ROW_SINGLE_VALUE ',' TOK_PFS_ROW_SINGLE_VALUE
-
- REDUCE:
- TOK_PFS_ROW_SINGLE_VALUE_LIST :=
- TOK_PFS_ROW_SINGLE_VALUE_LIST ',' TOK_PFS_ROW_SINGLE_VALUE
- */
- digest_storage->m_byte_count-= 2*PFS_SIZE_OF_A_TOKEN;
- token= TOK_PFS_ROW_SINGLE_VALUE_LIST;
- }
- }
- else if (last_token == TOK_PFS_GENERIC_VALUE_LIST &&
- last_token2 == '(')
- {
- /*
- REDUCE:
- TOK_PFS_ROW_MULTIPLE_VALUE :=
- '(' TOK_PFS_GENERIC_VALUE_LIST ')'
- */
- digest_storage->m_byte_count-= 2*PFS_SIZE_OF_A_TOKEN;
- token= TOK_PFS_ROW_MULTIPLE_VALUE;
-
- /* Read last two tokens again */
- peek_last_two_tokens(digest_storage, state->m_last_id_index,
- &last_token, &last_token2);
-
- if ((last_token2 == TOK_PFS_ROW_MULTIPLE_VALUE ||
- last_token2 == TOK_PFS_ROW_MULTIPLE_VALUE_LIST) &&
- (last_token == ','))
- {
- /*
- REDUCE:
- TOK_PFS_ROW_MULTIPLE_VALUE_LIST :=
- TOK_PFS_ROW_MULTIPLE_VALUE ',' TOK_PFS_ROW_MULTIPLE_VALUE
-
- REDUCE:
- TOK_PFS_ROW_MULTIPLE_VALUE_LIST :=
- TOK_PFS_ROW_MULTIPLE_VALUE_LIST ',' TOK_PFS_ROW_MULTIPLE_VALUE
- */
- digest_storage->m_byte_count-= 2*PFS_SIZE_OF_A_TOKEN;
- token= TOK_PFS_ROW_MULTIPLE_VALUE_LIST;
- }
- }
- /*
- Add this token or the resulting reduce to digest storage.
- */
- store_token(digest_storage, token);
- break;
- }
- case IDENT:
- case IDENT_QUOTED:
- {
- LEX_YYSTYPE *lex_token= (LEX_YYSTYPE*) yylval;
- char *yytext= lex_token->lex_str.str;
- int yylen= lex_token->lex_str.length;
-
- /* Add this token and identifier string to digest storage. */
- store_token_identifier(digest_storage, token, yylen, yytext);
-
- /* Update the index of last identifier found. */
- state->m_last_id_index= digest_storage->m_byte_count;
- break;
- }
- default:
- {
- /* Add this token to digest storage. */
- store_token(digest_storage, token);
- break;
- }
- }
-
- return locker;
-}
diff --git a/storage/perfschema/pfs_digest.h b/storage/perfschema/pfs_digest.h
index 03f534b3d7e..9d021737c44 100644
--- a/storage/perfschema/pfs_digest.h
+++ b/storage/perfschema/pfs_digest.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2011, 2015, 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
@@ -24,23 +24,19 @@
#include "pfs_column_types.h"
#include "lf.h"
#include "pfs_stat.h"
-
-#define PFS_SIZE_OF_A_TOKEN 2
+#include "sql_digest.h"
extern bool flag_statements_digest;
extern ulong digest_max;
extern ulong digest_lost;
struct PFS_thread;
-/* Fixed, per MD5 hash. */
-#define PFS_MD5_SIZE 16
-
/**
Structure to store a MD5 hash value (digest) for a statement.
*/
struct PFS_digest_key
{
- unsigned char m_md5[PFS_MD5_SIZE];
+ unsigned char m_md5[MD5_HASH_SIZE];
char m_schema_name[NAME_LEN];
uint m_schema_name_length;
};
@@ -52,7 +48,7 @@ struct PFS_ALIGNED PFS_statements_digest_stat
PFS_digest_key m_digest_key;
/** Digest Storage. */
- PSI_digest_storage m_digest_storage;
+ sql_digest_storage m_digest_storage;
/** Statement stat. */
PFS_statement_stat m_stat;
@@ -62,7 +58,7 @@ struct PFS_ALIGNED PFS_statements_digest_stat
ulonglong m_last_seen;
/** Reset data for this record. */
- void reset_data();
+ void reset_data(unsigned char* token_array, uint length);
/** Reset data and remove index for this record. */
void reset_index(PFS_thread *thread);
};
@@ -73,147 +69,15 @@ void cleanup_digest();
int init_digest_hash(void);
void cleanup_digest_hash(void);
PFS_statement_stat* find_or_create_digest(PFS_thread *thread,
- PSI_digest_storage *digest_storage,
+ const sql_digest_storage *digest_storage,
const char *schema_name,
uint schema_name_length);
-void get_digest_text(char *digest_text, PSI_digest_storage *digest_storage);
-
void reset_esms_by_digest();
/* Exposing the data directly, for iterators. */
extern PFS_statements_digest_stat *statements_digest_stat_array;
-/* Instrumentation callbacks for pfs.cc */
-
-struct PSI_digest_locker *pfs_digest_start_v1(PSI_statement_locker *locker);
-PSI_digest_locker *pfs_digest_add_token_v1(PSI_digest_locker *locker,
- uint token,
- OPAQUE_LEX_YYSTYPE *yylval);
-
-static inline void digest_reset(PSI_digest_storage *digest)
-{
- digest->m_full= false;
- digest->m_byte_count= 0;
- digest->m_charset_number= 0;
-}
-
-static inline void digest_copy(PSI_digest_storage *to, const PSI_digest_storage *from)
-{
- if (from->m_byte_count > 0)
- {
- to->m_full= from->m_full;
- to->m_byte_count= from->m_byte_count;
- to->m_charset_number= from->m_charset_number;
- DBUG_ASSERT(to->m_byte_count <= PSI_MAX_DIGEST_STORAGE_SIZE);
- memcpy(to->m_token_array, from->m_token_array, to->m_byte_count);
- }
- else
- {
- DBUG_ASSERT(from->m_byte_count == 0);
- to->m_full= false;
- to->m_byte_count= 0;
- to->m_charset_number= 0;
- }
-}
-
-/**
- Read a single token from token array.
-*/
-inline int read_token(PSI_digest_storage *digest_storage,
- int index, uint *tok)
-{
- int safe_byte_count= digest_storage->m_byte_count;
-
- if (index + PFS_SIZE_OF_A_TOKEN <= safe_byte_count &&
- safe_byte_count <= PSI_MAX_DIGEST_STORAGE_SIZE)
- {
- unsigned char *src= & digest_storage->m_token_array[index];
- *tok= src[0] | (src[1] << 8);
- return index + PFS_SIZE_OF_A_TOKEN;
- }
-
- /* The input byte stream is exhausted. */
- *tok= 0;
- return PSI_MAX_DIGEST_STORAGE_SIZE + 1;
-}
-
-/**
- Store a single token in token array.
-*/
-inline void store_token(PSI_digest_storage* digest_storage, uint token)
-{
- DBUG_ASSERT(digest_storage->m_byte_count >= 0);
- DBUG_ASSERT(digest_storage->m_byte_count <= PSI_MAX_DIGEST_STORAGE_SIZE);
-
- if (digest_storage->m_byte_count + PFS_SIZE_OF_A_TOKEN <= PSI_MAX_DIGEST_STORAGE_SIZE)
- {
- unsigned char* dest= & digest_storage->m_token_array[digest_storage->m_byte_count];
- dest[0]= token & 0xff;
- dest[1]= (token >> 8) & 0xff;
- digest_storage->m_byte_count+= PFS_SIZE_OF_A_TOKEN;
- }
- else
- {
- digest_storage->m_full= true;
- }
-}
-
-/**
- Read an identifier from token array.
-*/
-inline int read_identifier(PSI_digest_storage* digest_storage,
- int index, char ** id_string, int *id_length)
-{
- int new_index;
- DBUG_ASSERT(index <= digest_storage->m_byte_count);
- DBUG_ASSERT(digest_storage->m_byte_count <= PSI_MAX_DIGEST_STORAGE_SIZE);
-
- /*
- token + length + string are written in an atomic way,
- so we do always expect a length + string here
- */
- unsigned char *src= & digest_storage->m_token_array[index];
- uint length= src[0] | (src[1] << 8);
- *id_string= (char *) (src + 2);
- *id_length= length;
-
- new_index= index + PFS_SIZE_OF_A_TOKEN + length;
- DBUG_ASSERT(new_index <= digest_storage->m_byte_count);
- return new_index;
-}
-
-/**
- Store an identifier in token array.
-*/
-inline void store_token_identifier(PSI_digest_storage* digest_storage,
- uint token,
- uint id_length, const char *id_name)
-{
- DBUG_ASSERT(digest_storage->m_byte_count >= 0);
- DBUG_ASSERT(digest_storage->m_byte_count <= PSI_MAX_DIGEST_STORAGE_SIZE);
-
- uint bytes_needed= 2 * PFS_SIZE_OF_A_TOKEN + id_length;
- if (digest_storage->m_byte_count + bytes_needed <= PSI_MAX_DIGEST_STORAGE_SIZE)
- {
- unsigned char* dest= & digest_storage->m_token_array[digest_storage->m_byte_count];
- /* Write the token */
- dest[0]= token & 0xff;
- dest[1]= (token >> 8) & 0xff;
- /* Write the string length */
- dest[2]= id_length & 0xff;
- dest[3]= (id_length >> 8) & 0xff;
- /* Write the string data */
- if (id_length > 0)
- memcpy((char *)(dest + 4), id_name, id_length);
- digest_storage->m_byte_count+= bytes_needed;
- }
- else
- {
- digest_storage->m_full= true;
- }
-}
-
extern LF_HASH digest_hash;
#endif
diff --git a/storage/perfschema/pfs_engine_table.cc b/storage/perfschema/pfs_engine_table.cc
index 958a2bdd7bd..5484f0b4e4c 100644
--- a/storage/perfschema/pfs_engine_table.cc
+++ b/storage/perfschema/pfs_engine_table.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2015, 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
@@ -1412,12 +1412,64 @@ bool pfs_show_status(handlerton *hton, THD *thd,
name= "host_cache.size";
size= sizeof(Host_entry);
break;
+ case 154:
+ name= "(history_long_statements_digest_token_array).row_count";
+ size= events_statements_history_long_size;
+ break;
+ case 155:
+ name= "(history_long_statements_digest_token_array).row_size";
+ size= pfs_max_digest_length;
+ break;
+ case 156:
+ name= "(history_long_statements_digest_token_array).memory";
+ size= events_statements_history_long_size * pfs_max_digest_length;
+ total_memory+= size;
+ break;
+ case 157:
+ name= "(history_statements_digest_token_array).row_count";
+ size= thread_max * events_statements_history_per_thread;
+ break;
+ case 158:
+ name= "(history_statements_digest_token_array).row_size";
+ size= pfs_max_digest_length;
+ break;
+ case 159:
+ name= "(history_statements_digest_token_array).memory";
+ size= thread_max * events_statements_history_per_thread * pfs_max_digest_length;
+ total_memory+= size;
+ break;
+ case 160:
+ name= "(current_statements_digest_token_array).row_count";
+ size= thread_max * statement_stack_max;
+ break;
+ case 161:
+ name= "(current_statements_digest_token_array).row_size";
+ size= pfs_max_digest_length;
+ break;
+ case 162:
+ name= "(current_statements_digest_token_array).memory";
+ size= thread_max * statement_stack_max * pfs_max_digest_length;
+ total_memory+= size;
+ break;
+ case 163:
+ name= "(statements_digest_token_array).row_count";
+ size= digest_max;
+ break;
+ case 164:
+ name= "(statements_digest_token_array).row_size";
+ size= pfs_max_digest_length;
+ break;
+ case 165:
+ name= "(statements_digest_token_array).memory";
+ size= digest_max * pfs_max_digest_length;
+ total_memory+= size;
+ break;
/*
This case must be last,
for aggregation in total_memory.
*/
- case 154:
+ case 166:
name= "performance_schema.memory";
size= total_memory;
/* This will fail if something is not advertised here */
diff --git a/storage/perfschema/pfs_events_statements.cc b/storage/perfschema/pfs_events_statements.cc
index 07810d26dc4..dc34755d747 100644
--- a/storage/perfschema/pfs_events_statements.cc
+++ b/storage/perfschema/pfs_events_statements.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2010, 2015, 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
@@ -44,6 +44,7 @@ bool events_statements_history_long_full= false;
volatile uint32 events_statements_history_long_index= 0;
/** EVENTS_STATEMENTS_HISTORY_LONG circular buffer. */
PFS_events_statements *events_statements_history_long_array= NULL;
+static unsigned char *h_long_stmts_digest_token_array= NULL;
/**
Initialize table EVENTS_STATEMENTS_HISTORY_LONG.
@@ -51,6 +52,7 @@ PFS_events_statements *events_statements_history_long_array= NULL;
*/
int init_events_statements_history_long(uint events_statements_history_long_sizing)
{
+ uint index;
events_statements_history_long_size= events_statements_history_long_sizing;
events_statements_history_long_full= false;
PFS_atomic::store_u32(&events_statements_history_long_index, 0);
@@ -62,20 +64,50 @@ int init_events_statements_history_long(uint events_statements_history_long_sizi
PFS_MALLOC_ARRAY(events_statements_history_long_size, PFS_events_statements,
MYF(MY_ZEROFILL));
- return (events_statements_history_long_array ? 0 : 1);
+ if (events_statements_history_long_array == NULL)
+ {
+ cleanup_events_statements_history_long();
+ return 1;
+ }
+
+ if (pfs_max_digest_length > 0)
+ {
+ h_long_stmts_digest_token_array=
+ PFS_MALLOC_ARRAY(events_statements_history_long_size * pfs_max_digest_length,
+ unsigned char, MYF(MY_ZEROFILL));
+ if (h_long_stmts_digest_token_array == NULL)
+ {
+ cleanup_events_statements_history_long();
+ return 1;
+ }
+ }
+
+ for (index= 0; index < events_statements_history_long_size; index++)
+ {
+ events_statements_history_long_array[index].m_digest_storage.reset(h_long_stmts_digest_token_array
+ + index * pfs_max_digest_length, pfs_max_digest_length);
+ }
+
+ return 0;
}
/** Cleanup table EVENTS_STATEMENTS_HISTORY_LONG. */
void cleanup_events_statements_history_long(void)
{
pfs_free(events_statements_history_long_array);
+ pfs_free(h_long_stmts_digest_token_array);
events_statements_history_long_array= NULL;
+ h_long_stmts_digest_token_array= NULL;
}
static inline void copy_events_statements(PFS_events_statements *dest,
const PFS_events_statements *source)
{
- memcpy(dest, source, sizeof(PFS_events_statements));
+ /* Copy all attributes except DIGEST */
+ memcpy(dest, source, my_offsetof(PFS_events_statements, m_digest_storage));
+
+ /* Copy DIGEST */
+ dest->m_digest_storage.copy(& source->m_digest_storage);
}
/**
diff --git a/storage/perfschema/pfs_events_statements.h b/storage/perfschema/pfs_events_statements.h
index 5d90250c618..3637e4ca764 100644
--- a/storage/perfschema/pfs_events_statements.h
+++ b/storage/perfschema/pfs_events_statements.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2010, 2015, 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
@@ -88,8 +88,12 @@ struct PFS_events_statements : public PFS_events
ulonglong m_no_index_used;
/** Optimizer metric, number of 'no good index used'. */
ulonglong m_no_good_index_used;
- /** Statement digest. */
- PSI_digest_storage m_digest_storage;
+ /**
+ Statement digest.
+ This underlying token array storage pointer is immutable,
+ and always point to pre allocated memory.
+ */
+ sql_digest_storage m_digest_storage;
};
void insert_events_statements_history(PFS_thread *thread, PFS_events_statements *statement);
diff --git a/storage/perfschema/pfs_host.cc b/storage/perfschema/pfs_host.cc
index 08f49f091a8..80f3900275d 100644
--- a/storage/perfschema/pfs_host.cc
+++ b/storage/perfschema/pfs_host.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2010, 2015, 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
diff --git a/storage/perfschema/pfs_instr.cc b/storage/perfschema/pfs_instr.cc
index cfae076536c..5e75df4a16f 100644
--- a/storage/perfschema/pfs_instr.cc
+++ b/storage/perfschema/pfs_instr.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2015, 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
@@ -94,6 +94,7 @@ ulong events_stages_history_per_thread;
/** Number of EVENTS_STATEMENTS_HISTORY records per thread. */
ulong events_statements_history_per_thread;
uint statement_stack_max;
+uint pfs_max_digest_length= 0;
/** Number of locker lost. @sa LOCKER_STACK_SIZE. */
ulong locker_lost= 0;
/** Number of statement lost. @sa STATEMENT_STACK_SIZE. */
@@ -176,6 +177,8 @@ static PFS_events_waits *thread_waits_history_array= NULL;
static PFS_events_stages *thread_stages_history_array= NULL;
static PFS_events_statements *thread_statements_history_array= NULL;
static PFS_events_statements *thread_statements_stack_array= NULL;
+static unsigned char *current_stmts_digest_token_array= NULL;
+static unsigned char *history_stmts_digest_token_array= NULL;
static char *thread_session_connect_attrs_array= NULL;
/** Hash table for instrumented files. */
@@ -190,6 +193,9 @@ static bool filename_hash_inited= false;
*/
int init_instruments(const PFS_global_param *param)
{
+ PFS_events_statements *pfs_stmt;
+ unsigned char *pfs_tokens;
+
uint thread_waits_history_sizing;
uint thread_stages_history_sizing;
uint thread_statements_history_sizing;
@@ -215,6 +221,9 @@ int init_instruments(const PFS_global_param *param)
file_handle_max= param->m_file_handle_sizing;
file_handle_full= false;
file_handle_lost= 0;
+
+ pfs_max_digest_length= param->m_max_digest_length;
+
table_max= param->m_table_sizing;
table_full= false;
table_lost= 0;
@@ -254,6 +263,9 @@ int init_instruments(const PFS_global_param *param)
* session_connect_attrs_size_per_thread;
session_connect_attrs_lost= 0;
+ size_t current_digest_tokens_sizing= param->m_thread_sizing * pfs_max_digest_length * statement_stack_max;
+ size_t history_digest_tokens_sizing= param->m_thread_sizing * pfs_max_digest_length * events_statements_history_per_thread;
+
mutex_array= NULL;
rwlock_array= NULL;
cond_array= NULL;
@@ -266,6 +278,8 @@ int init_instruments(const PFS_global_param *param)
thread_stages_history_array= NULL;
thread_statements_history_array= NULL;
thread_statements_stack_array= NULL;
+ current_stmts_digest_token_array= NULL;
+ history_stmts_digest_token_array= NULL;
thread_instr_class_waits_array= NULL;
thread_instr_class_stages_array= NULL;
thread_instr_class_statements_array= NULL;
@@ -407,6 +421,22 @@ int init_instruments(const PFS_global_param *param)
return 1;
}
+ if (current_digest_tokens_sizing > 0)
+ {
+ current_stmts_digest_token_array=
+ (unsigned char *)pfs_malloc(current_digest_tokens_sizing, MYF(MY_ZEROFILL));
+ if (unlikely(current_stmts_digest_token_array == NULL))
+ return 1;
+ }
+
+ if (history_digest_tokens_sizing > 0)
+ {
+ history_stmts_digest_token_array=
+ (unsigned char *)pfs_malloc(history_digest_tokens_sizing, MYF(MY_ZEROFILL));
+ if (unlikely(history_stmts_digest_token_array == NULL))
+ return 1;
+ }
+
for (index= 0; index < thread_max; index++)
{
thread_array[index].m_waits_history=
@@ -427,6 +457,22 @@ int init_instruments(const PFS_global_param *param)
&thread_session_connect_attrs_array[index * session_connect_attrs_size_per_thread];
}
+ for (index= 0; index < thread_statements_stack_sizing; index++)
+ {
+ pfs_stmt= & thread_statements_stack_array[index];
+
+ pfs_tokens= & current_stmts_digest_token_array[index * pfs_max_digest_length];
+ pfs_stmt->m_digest_storage.reset(pfs_tokens, pfs_max_digest_length);
+ }
+
+ for (index= 0; index < thread_statements_history_sizing; index++)
+ {
+ pfs_stmt= & thread_statements_history_array[index];
+
+ pfs_tokens= & history_stmts_digest_token_array[index * pfs_max_digest_length];
+ pfs_stmt->m_digest_storage.reset(pfs_tokens, pfs_max_digest_length);
+ }
+
if (stage_class_max > 0)
{
global_instr_class_stages_array=
@@ -501,6 +547,10 @@ void cleanup_instruments(void)
thread_instr_class_stages_array= NULL;
pfs_free(thread_session_connect_attrs_array);
thread_session_connect_attrs_array=NULL;
+ pfs_free(current_stmts_digest_token_array);
+ current_stmts_digest_token_array= NULL;
+ pfs_free(history_stmts_digest_token_array);
+ history_stmts_digest_token_array= NULL;
}
C_MODE_START
diff --git a/storage/perfschema/pfs_instr.h b/storage/perfschema/pfs_instr.h
index bd2fe0e4afd..a639f94fada 100644
--- a/storage/perfschema/pfs_instr.h
+++ b/storage/perfschema/pfs_instr.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2015, 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
@@ -298,6 +298,8 @@ struct PFS_ALIGNED PFS_socket : public PFS_instr
/** Max size of the statements stack. */
extern uint statement_stack_max;
+/** Max size of the digests token array. */
+extern uint pfs_max_digest_length;
/**
@def PFS_MAX_ALLOC_RETRY
diff --git a/storage/perfschema/pfs_server.cc b/storage/perfschema/pfs_server.cc
index 383a46785fb..1cf60766cf7 100644
--- a/storage/perfschema/pfs_server.cc
+++ b/storage/perfschema/pfs_server.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2015, 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
diff --git a/storage/perfschema/pfs_server.h b/storage/perfschema/pfs_server.h
index 606a814c168..6f07e5b3feb 100644
--- a/storage/perfschema/pfs_server.h
+++ b/storage/perfschema/pfs_server.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2015, 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
@@ -200,6 +200,8 @@ struct PFS_global_param
/** Maximum number of session attribute strings per thread */
long m_session_connect_attrs_sizing;
+ uint m_max_digest_length;
+
/** Sizing hints, for auto tuning. */
PFS_sizing_hints m_hints;
};
diff --git a/storage/perfschema/pfs_user.cc b/storage/perfschema/pfs_user.cc
index 905c0b2ee4e..a009e5d65ef 100644
--- a/storage/perfschema/pfs_user.cc
+++ b/storage/perfschema/pfs_user.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2010, 2015, 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
diff --git a/storage/perfschema/table_events_statements.cc b/storage/perfschema/table_events_statements.cc
index a3f2680c3e7..7d7539b7790 100644
--- a/storage/perfschema/table_events_statements.cc
+++ b/storage/perfschema/table_events_statements.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2010, 2015, 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
@@ -302,7 +302,7 @@ table_events_statements_common::table_events_statements_common
@param statement the statement the cursor is reading
*/
void table_events_statements_common::make_row_part_1(PFS_events_statements *statement,
- PSI_digest_storage *digest)
+ sql_digest_storage *digest)
{
const char *base;
const char *safe_source_file;
@@ -367,46 +367,40 @@ void table_events_statements_common::make_row_part_1(PFS_events_statements *stat
m_row.m_sort_scan= statement->m_sort_scan;
m_row.m_no_index_used= statement->m_no_index_used;
m_row.m_no_good_index_used= statement->m_no_good_index_used;
- /*
+ /*
Making a copy of digest storage.
*/
- digest_copy(digest, & statement->m_digest_storage);
+ digest->copy(& statement->m_digest_storage);
m_row_exists= true;
return;
}
-void table_events_statements_common::make_row_part_2(PSI_digest_storage *digest)
+void table_events_statements_common::make_row_part_2(const sql_digest_storage *digest)
{
/*
Filling up statement digest information.
*/
- int safe_byte_count= digest->m_byte_count;
+ uint safe_byte_count= digest->m_byte_count;
if (safe_byte_count > 0 &&
- safe_byte_count <= PSI_MAX_DIGEST_STORAGE_SIZE)
+ safe_byte_count <= pfs_max_digest_length)
{
- PFS_digest_key md5;
- compute_md5_hash((char *) md5.m_md5,
- (char *) digest->m_token_array,
- safe_byte_count);
-
/* Generate the DIGEST string from the MD5 digest */
- MD5_HASH_TO_STRING(md5.m_md5,
+ MD5_HASH_TO_STRING(digest->m_md5,
m_row.m_digest.m_digest);
m_row.m_digest.m_digest_length= MD5_HASH_TO_STRING_LENGTH;
/* Generate the DIGEST_TEXT string from the token array */
- get_digest_text(m_row.m_digest.m_digest_text, digest);
- m_row.m_digest.m_digest_text_length= strlen(m_row.m_digest.m_digest_text);
+ compute_digest_text(digest, &m_row.m_digest.m_digest_text);
- if (m_row.m_digest.m_digest_text_length == 0)
+ if (m_row.m_digest.m_digest_text.length() == 0)
m_row.m_digest.m_digest_length= 0;
}
else
{
m_row.m_digest.m_digest_length= 0;
- m_row.m_digest.m_digest_text_length= 0;
+ m_row.m_digest.m_digest_text.length(0);
}
return;
@@ -491,9 +485,9 @@ int table_events_statements_common::read_row_values(TABLE *table,
f->set_null();
break;
case 11: /* DIGEST_TEXT */
- if (m_row.m_digest.m_digest_text_length > 0)
- set_field_longtext_utf8(f, m_row.m_digest.m_digest_text,
- m_row.m_digest.m_digest_text_length);
+ if (m_row.m_digest.m_digest_text.length() > 0)
+ set_field_longtext_utf8(f, m_row.m_digest.m_digest_text.ptr(),
+ m_row.m_digest.m_digest_text.length());
else
f->set_null();
break;
@@ -710,11 +704,11 @@ int table_events_statements_current::rnd_pos(const void *pos)
void table_events_statements_current::make_row(PFS_thread *pfs_thread,
PFS_events_statements *statement)
{
- PSI_digest_storage digest;
+ sql_digest_storage digest;
pfs_lock lock;
pfs_lock stmt_lock;
- digest_reset(&digest);
+ digest.reset(m_token_array, MAX_DIGEST_STORAGE_SIZE);
/* Protect this reader against thread termination. */
pfs_thread->m_lock.begin_optimistic_lock(&lock);
/* Protect this reader against writing on statement information. */
@@ -838,10 +832,10 @@ int table_events_statements_history::rnd_pos(const void *pos)
void table_events_statements_history::make_row(PFS_thread *pfs_thread,
PFS_events_statements *statement)
{
- PSI_digest_storage digest;
+ sql_digest_storage digest;
pfs_lock lock;
- digest_reset(&digest);
+ digest.reset(m_token_array, MAX_DIGEST_STORAGE_SIZE);
/* Protect this reader against thread termination. */
pfs_thread->m_lock.begin_optimistic_lock(&lock);
@@ -942,9 +936,9 @@ int table_events_statements_history_long::rnd_pos(const void *pos)
void table_events_statements_history_long::make_row(PFS_events_statements *statement)
{
- PSI_digest_storage digest;
+ sql_digest_storage digest;
- digest_reset(&digest);
+ digest.reset(m_token_array, MAX_DIGEST_STORAGE_SIZE);
table_events_statements_common::make_row_part_1(statement, &digest);
table_events_statements_common::make_row_part_2(&digest);
diff --git a/storage/perfschema/table_events_statements.h b/storage/perfschema/table_events_statements.h
index e33c6b505bd..a42bbcb2e5a 100644
--- a/storage/perfschema/table_events_statements.h
+++ b/storage/perfschema/table_events_statements.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2010, 2015, 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
@@ -175,14 +175,15 @@ protected:
{}
void make_row_part_1(PFS_events_statements *statement,
- PSI_digest_storage *digest);
+ sql_digest_storage *digest);
- void make_row_part_2(PSI_digest_storage *digest);
+ void make_row_part_2(const sql_digest_storage *digest);
/** Current row. */
row_events_statements m_row;
/** True if the current row exists. */
bool m_row_exists;
+ unsigned char m_token_array[MAX_DIGEST_STORAGE_SIZE];
};
/** Table PERFORMANCE_SCHEMA.EVENTS_STATEMENTS_CURRENT. */
diff --git a/storage/perfschema/table_helper.cc b/storage/perfschema/table_helper.cc
index 9c10a3ecc88..c9def1bfc74 100644
--- a/storage/perfschema/table_helper.cc
+++ b/storage/perfschema/table_helper.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2010, 2015, 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
@@ -25,6 +25,7 @@
#include "pfs_host.h"
#include "pfs_user.h"
#include "pfs_account.h"
+#include "pfs_instr.h"
int PFS_host_row::make_row(PFS_host *pfs)
{
@@ -109,8 +110,8 @@ int PFS_digest_row::make_row(PFS_statements_digest_stat* pfs)
if (m_schema_name_length > 0)
memcpy(m_schema_name, pfs->m_digest_key.m_schema_name, m_schema_name_length);
- int safe_byte_count= pfs->m_digest_storage.m_byte_count;
- if (safe_byte_count > PSI_MAX_DIGEST_STORAGE_SIZE)
+ uint safe_byte_count= pfs->m_digest_storage.m_byte_count;
+ if (safe_byte_count > pfs_max_digest_length)
safe_byte_count= 0;
/*
@@ -124,23 +125,22 @@ int PFS_digest_row::make_row(PFS_statements_digest_stat* pfs)
Calculate digest from MD5 HASH collected to be shown as
DIGEST in this row.
*/
- MD5_HASH_TO_STRING(pfs->m_digest_key.m_md5, m_digest);
+ MD5_HASH_TO_STRING(pfs->m_digest_storage.m_md5, m_digest);
m_digest_length= MD5_HASH_TO_STRING_LENGTH;
/*
Calculate digest_text information from the token array collected
to be shown as DIGEST_TEXT column.
*/
- get_digest_text(m_digest_text, &pfs->m_digest_storage);
- m_digest_text_length= strlen(m_digest_text);
+ compute_digest_text(&pfs->m_digest_storage, &m_digest_text);
- if (m_digest_text_length == 0)
+ if (m_digest_text.length() == 0)
m_digest_length= 0;
}
else
{
m_digest_length= 0;
- m_digest_text_length= 0;
+ m_digest_text.length(0);
}
return 0;
@@ -165,9 +165,9 @@ void PFS_digest_row::set_field(uint index, Field *f)
f->set_null();
break;
case 2: /* DIGEST_TEXT */
- if (m_digest_text_length > 0)
- PFS_engine_table::set_field_longtext_utf8(f, m_digest_text,
- m_digest_text_length);
+ if (m_digest_text.length() > 0)
+ PFS_engine_table::set_field_longtext_utf8(f, m_digest_text.ptr(),
+ m_digest_text.length());
else
f->set_null();
break;
diff --git a/storage/perfschema/table_helper.h b/storage/perfschema/table_helper.h
index 76bb289c73b..b1377eb9748 100644
--- a/storage/perfschema/table_helper.h
+++ b/storage/perfschema/table_helper.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2015, 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
@@ -136,9 +136,7 @@ struct PFS_digest_row
/** Length in bytes of @c m_digest. */
uint m_digest_length;
/** Column DIGEST_TEXT. */
- char m_digest_text[COL_DIGEST_TEXT_SIZE];
- /** Length in bytes of @c m_digest_text. */
- uint m_digest_text_length;
+ String m_digest_text;
/** Build a row from a memory buffer. */
int make_row(PFS_statements_digest_stat*);
diff --git a/storage/perfschema/unittest/CMakeLists.txt b/storage/perfschema/unittest/CMakeLists.txt
index 6add43de7f9..e8b11e807bf 100644
--- a/storage/perfschema/unittest/CMakeLists.txt
+++ b/storage/perfschema/unittest/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2015, 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
@@ -23,5 +23,10 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
ADD_DEFINITIONS(-DMYSQL_SERVER ${SSL_DEFINES})
-MY_ADD_TESTS(pfs_instr_class pfs_instr_class-oom pfs_instr pfs_instr-oom pfs_account-oom pfs_host-oom pfs_timer pfs_user-oom pfs
- EXT "cc" LINK_LIBRARIES perfschema mysys)
+ADD_CONVENIENCE_LIBRARY(pfs_server_stubs pfs_server_stubs.cc)
+
+ADD_DEPENDENCIES(pfs_server_stubs GenError)
+
+MY_ADD_TESTS(pfs_instr_class pfs_instr_class-oom pfs_instr pfs_instr-oom
+ pfs_account-oom pfs_host-oom pfs_timer pfs_user-oom pfs
+ EXT "cc" LINK_LIBRARIES perfschema mysys pfs_server_stubs)
diff --git a/storage/perfschema/unittest/pfs-t.cc b/storage/perfschema/unittest/pfs-t.cc
index 9211443bcca..6121fac098f 100644
--- a/storage/perfschema/unittest/pfs-t.cc
+++ b/storage/perfschema/unittest/pfs-t.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2015, 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
@@ -26,7 +26,6 @@
#include "stub_print_error.h"
#include "stub_pfs_defaults.h"
-#include "stub_server_misc.h"
/* test helpers, to simulate the setup */
@@ -112,6 +111,7 @@ void test_bootstrap()
param.m_events_statements_history_long_sizing= 0;
param.m_digest_sizing= 0;
param.m_session_connect_attrs_sizing= 0;
+ param.m_max_digest_length= 0;
boot= initialize_performance_schema(& param);
ok(boot != NULL, "boot");
@@ -170,6 +170,7 @@ PSI * load_perfschema()
param.m_events_statements_history_long_sizing= 0;
param.m_digest_sizing= 0;
param.m_session_connect_attrs_sizing= 0;
+ param.m_max_digest_length= 0;
/* test_bootstrap() covered this, assuming it just works */
boot= initialize_performance_schema(& param);
@@ -1514,6 +1515,7 @@ void test_event_name_index()
param.m_events_statements_history_long_sizing= 0;
param.m_digest_sizing= 0;
param.m_session_connect_attrs_sizing= 0;
+ param.m_max_digest_length= 0;
param.m_mutex_sizing= 0;
param.m_rwlock_sizing= 0;
diff --git a/storage/perfschema/unittest/pfs_account-oom-t.cc b/storage/perfschema/unittest/pfs_account-oom-t.cc
index 2343e8378ad..f715325401d 100644
--- a/storage/perfschema/unittest/pfs_account-oom-t.cc
+++ b/storage/perfschema/unittest/pfs_account-oom-t.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2011, 2015, 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
@@ -22,7 +22,6 @@
#include <tap.h>
#include "stub_pfs_global.h"
-#include "stub_server_misc.h"
#include <string.h> /* memset */
diff --git a/storage/perfschema/unittest/pfs_host-oom-t.cc b/storage/perfschema/unittest/pfs_host-oom-t.cc
index 5b823ce4eac..56597bdda74 100644
--- a/storage/perfschema/unittest/pfs_host-oom-t.cc
+++ b/storage/perfschema/unittest/pfs_host-oom-t.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2011, 2015, 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
@@ -22,7 +22,6 @@
#include <tap.h>
#include "stub_pfs_global.h"
-#include "stub_server_misc.h"
#include <string.h> /* memset */
diff --git a/storage/perfschema/unittest/pfs_instr-oom-t.cc b/storage/perfschema/unittest/pfs_instr-oom-t.cc
index 18c0029776d..25caaa6241f 100644
--- a/storage/perfschema/unittest/pfs_instr-oom-t.cc
+++ b/storage/perfschema/unittest/pfs_instr-oom-t.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2015, 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
@@ -22,7 +22,6 @@
#include <tap.h>
#include "stub_pfs_global.h"
-#include "stub_server_misc.h"
#include <string.h> /* memset */
diff --git a/storage/perfschema/unittest/pfs_instr-t.cc b/storage/perfschema/unittest/pfs_instr-t.cc
index fab22b203d3..81df38340df 100644
--- a/storage/perfschema/unittest/pfs_instr-t.cc
+++ b/storage/perfschema/unittest/pfs_instr-t.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2015, 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
@@ -23,8 +23,6 @@
#include <memory.h>
-#include "stub_server_misc.h"
-
void test_no_instruments()
{
int rc;
@@ -62,6 +60,7 @@ void test_no_instruments()
param.m_events_statements_history_long_sizing= 0;
param.m_digest_sizing= 0;
param.m_session_connect_attrs_sizing= 0;
+ param.m_max_digest_length= 0;
init_event_name_sizing(& param);
rc= init_instruments(& param);
@@ -121,6 +120,7 @@ void test_no_instances()
param.m_events_statements_history_long_sizing= 0;
param.m_digest_sizing= 0;
param.m_session_connect_attrs_sizing= 0;
+ param.m_max_digest_length= 0;
init_event_name_sizing(& param);
rc= init_instruments(& param);
@@ -261,6 +261,7 @@ void test_with_instances()
param.m_events_statements_history_long_sizing= 0;
param.m_digest_sizing= 0;
param.m_session_connect_attrs_sizing= 0;
+ param.m_max_digest_length= 0;
init_event_name_sizing(& param);
rc= init_instruments(& param);
diff --git a/storage/perfschema/unittest/pfs_instr_class-oom-t.cc b/storage/perfschema/unittest/pfs_instr_class-oom-t.cc
index 264d6126336..1b098ee356e 100644
--- a/storage/perfschema/unittest/pfs_instr_class-oom-t.cc
+++ b/storage/perfschema/unittest/pfs_instr_class-oom-t.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2015, 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
@@ -20,7 +20,6 @@
#include <tap.h>
#include "stub_pfs_global.h"
-#include "stub_server_misc.h"
void test_oom()
{
diff --git a/storage/perfschema/unittest/pfs_instr_class-t.cc b/storage/perfschema/unittest/pfs_instr_class-t.cc
index 706c5724a80..06e3200a8d2 100644
--- a/storage/perfschema/unittest/pfs_instr_class-t.cc
+++ b/storage/perfschema/unittest/pfs_instr_class-t.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2015, 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
@@ -21,8 +21,6 @@
#include <pfs_global.h>
#include <tap.h>
-#include "stub_server_misc.h"
-
void test_no_registration()
{
int rc;
diff --git a/storage/perfschema/unittest/stub_server_misc.h b/storage/perfschema/unittest/pfs_server_stubs.cc
index 946da533727..a8f417e390b 100644
--- a/storage/perfschema/unittest/stub_server_misc.h
+++ b/storage/perfschema/unittest/pfs_server_stubs.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2010, 2015, 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
@@ -17,12 +17,19 @@
Minimal code to be able to link a unit test.
*/
+#include "my_global.h"
+#include "m_ctype.h"
+#include "sql_class.h"
+#include "sql_show.h"
+
+struct sql_digest_storage;
+
volatile bool ready_to_exit= false;
uint lower_case_table_names= 0;
CHARSET_INFO *files_charset_info= NULL;
-extern "C" void compute_md5_hash(char *, const char *, int)
+void compute_digest_md5(const sql_digest_storage *, unsigned char *)
{
}
diff --git a/storage/perfschema/unittest/pfs_user-oom-t.cc b/storage/perfschema/unittest/pfs_user-oom-t.cc
index 3cb80e1b7f9..6c936ba8ffb 100644
--- a/storage/perfschema/unittest/pfs_user-oom-t.cc
+++ b/storage/perfschema/unittest/pfs_user-oom-t.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2011, 2015, 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
@@ -22,7 +22,6 @@
#include <tap.h>
#include "stub_pfs_global.h"
-#include "stub_server_misc.h"
#include <string.h> /* memset */
diff --git a/storage/sphinx/mysql-test/sphinx/my.cnf b/storage/sphinx/mysql-test/sphinx/my.cnf
index a3789a065bf..f60380b7171 100644
--- a/storage/sphinx/mysql-test/sphinx/my.cnf
+++ b/storage/sphinx/mysql-test/sphinx/my.cnf
@@ -16,7 +16,6 @@ mem_limit = 32M
[searchd]
read_timeout = 5
max_children = 30
-max_matches = 1000
seamless_rotate = 1
preopen_indexes = 0
unlink_old = 1
@@ -24,7 +23,7 @@ log = @ENV.MYSQLTEST_VARDIR/searchd/sphinx-searchd.log
query_log = @ENV.MYSQLTEST_VARDIR/searchd/sphinx-query.log
#log-error = @ENV.MYSQLTEST_VARDIR/searchd/sphinx.log
pid_file = @ENV.MYSQLTEST_VARDIR/run/searchd.pid
-port = @ENV.SPHINXSEARCH_PORT
+listen = @ENV.SPHINXSEARCH_PORT
[ENV]
SPHINXSEARCH_PORT = @OPT.port
diff --git a/storage/spider/CMakeLists.txt b/storage/spider/CMakeLists.txt
index cdb2de45ee6..33786e2b85a 100644
--- a/storage/spider/CMakeLists.txt
+++ b/storage/spider/CMakeLists.txt
@@ -1,6 +1,11 @@
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHAVE_HANDLERSOCKET")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DHAVE_HANDLERSOCKET")
+IF(HAVE_WVLA)
+ SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wno-vla")
+ SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wno-vla")
+ENDIF()
+
SET(SPIDER_SOURCES
spd_param.cc spd_sys_table.cc spd_trx.cc spd_db_conn.cc spd_conn.cc
spd_table.cc spd_direct_sql.cc spd_udf.cc spd_ping_table.cc
diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc
index 2944e750b88..b4602e5aa4f 100644
--- a/storage/spider/ha_spider.cc
+++ b/storage/spider/ha_spider.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2014 Kentoku Shiba
+/* Copyright (C) 2008-2015 Kentoku Shiba
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
@@ -18,7 +18,6 @@
#endif
#define MYSQL_SERVER 1
-#include <my_global.h>
#include "mysql_version.h"
#if MYSQL_VERSION_ID < 50500
#include "mysql_priv.h"
@@ -28,6 +27,9 @@
#include "probes_mysql.h"
#include "sql_class.h"
#include "key.h"
+#ifdef HANDLER_HAS_DIRECT_AGGREGATE
+#include "sql_select.h"
+#endif
#endif
#include "ha_partition.h"
#include "spd_param.h"
@@ -92,7 +94,7 @@ ha_spider::ha_spider(
mrr_key_buff = NULL;
#endif
append_tblnm_alias = NULL;
- has_clone_for_merge = FALSE;
+ use_index_merge = FALSE;
is_clone = FALSE;
clone_bitmap_init = FALSE;
pt_clone_source_handler = NULL;
@@ -162,6 +164,7 @@ ha_spider::ha_spider(
result_list.direct_distinct = FALSE;
result_list.casual_read = NULL;
result_list.use_both_key = FALSE;
+ result_list.in_cmp_ref = FALSE;
DBUG_VOID_RETURN;
}
@@ -199,7 +202,7 @@ ha_spider::ha_spider(
mrr_key_buff = NULL;
#endif
append_tblnm_alias = NULL;
- has_clone_for_merge = FALSE;
+ use_index_merge = FALSE;
is_clone = FALSE;
clone_bitmap_init = FALSE;
pt_clone_source_handler = NULL;
@@ -269,6 +272,7 @@ ha_spider::ha_spider(
result_list.direct_distinct = FALSE;
result_list.casual_read = NULL;
result_list.use_both_key = FALSE;
+ result_list.in_cmp_ref = FALSE;
ref_length = sizeof(SPIDER_POSITION);
DBUG_VOID_RETURN;
}
@@ -300,7 +304,7 @@ handler *ha_spider::clone(
HA_OPEN_IGNORE_IF_LOCKED))
DBUG_RETURN(NULL);
spider->sync_from_clone_source_base(this);
- has_clone_for_merge = TRUE;
+ use_index_merge = TRUE;
DBUG_RETURN((handler *) spider);
}
@@ -1735,7 +1739,8 @@ int ha_spider::reset()
result_list.use_both_key = FALSE;
pt_clone_last_searcher = NULL;
conn_kinds = SPIDER_CONN_KIND_MYSQL;
- has_clone_for_merge = FALSE;
+ use_index_merge = FALSE;
+ init_rnd_handler = FALSE;
while (condition)
{
tmp_cond = condition->next;
@@ -1854,6 +1859,35 @@ int ha_spider::extra(
DBUG_RETURN(error_num);
break;
#endif
+#ifdef HA_EXTRA_HAS_HA_EXTRA_USE_CMP_REF
+ case HA_EXTRA_USE_CMP_REF:
+ DBUG_PRINT("info",("spider HA_EXTRA_USE_CMP_REF"));
+ if (table_share->primary_key != MAX_KEY)
+ {
+ DBUG_PRINT("info",("spider need primary key columns"));
+ KEY *key_info = &table->key_info[table->s->primary_key];
+ KEY_PART_INFO *key_part;
+ uint part_num;
+ for (
+ key_part = key_info->key_part, part_num = 0;
+ part_num < spider_user_defined_key_parts(key_info);
+ key_part++, part_num++
+ ) {
+ spider_set_bit(searched_bitmap, key_part->field->field_index);
+ }
+ } else {
+ DBUG_PRINT("info",("spider need all columns"));
+ Field **field;
+ for (
+ field = table->field;
+ *field;
+ field++
+ ) {
+ spider_set_bit(searched_bitmap, (*field)->field_index);
+ }
+ }
+ break;
+#endif
default:
break;
}
@@ -4437,6 +4471,7 @@ int ha_spider::read_multi_range_first_internal(
result_list.keyread = TRUE;
else
result_list.keyread = FALSE;
+ mrr_with_cnt = FALSE;
if (
(error_num = spider_db_append_select(this)) ||
(error_num = spider_db_append_select_columns(this))
@@ -7649,6 +7684,7 @@ int ha_spider::cmp_ref(
DBUG_PRINT("info",("spider this=%p", this));
DBUG_PRINT("info",("spider ref1=%p", ref1));
DBUG_PRINT("info",("spider ref2=%p", ref2));
+ result_list.in_cmp_ref = TRUE;
if (table_share->primary_key < MAX_KEY)
{
uchar table_key[MAX_KEY_LENGTH];
@@ -7680,6 +7716,7 @@ int ha_spider::cmp_ref(
}
}
}
+ result_list.in_cmp_ref = FALSE;
DBUG_PRINT("info",("spider ret=%d", ret));
DBUG_RETURN(ret);
}
@@ -8492,12 +8529,16 @@ int ha_spider::info(
} else if (tmp_auto_increment_mode == 1 &&
!share->lgtm_tblhnd_share->auto_increment_init)
{
+ DBUG_PRINT("info",("spider auto_increment_value=%llu",
+ share->lgtm_tblhnd_share->auto_increment_value));
share->lgtm_tblhnd_share->auto_increment_lclval =
share->lgtm_tblhnd_share->auto_increment_value;
share->lgtm_tblhnd_share->auto_increment_init = TRUE;
stats.auto_increment_value =
share->lgtm_tblhnd_share->auto_increment_value;
} else {
+ DBUG_PRINT("info",("spider auto_increment_value=%llu",
+ share->lgtm_tblhnd_share->auto_increment_value));
stats.auto_increment_value =
share->lgtm_tblhnd_share->auto_increment_value;
}
@@ -8685,7 +8726,7 @@ ha_rows ha_spider::records_in_range(
key_part_map end_key_part_map;
key_part_map tgt_key_part_map;
KEY_PART_INFO *key_part;
- Field *field;
+ Field *field = NULL;
double rows = (double) share->records;
double weight, rate;
DBUG_PRINT("info",("spider rows1=%f", rows));
@@ -9161,12 +9202,18 @@ bool ha_spider::need_info_for_auto_inc()
DBUG_ENTER("ha_spider::need_info_for_auto_inc");
DBUG_PRINT("info",("spider this=%p", this));
DBUG_PRINT("info",("spider return=%s", (
- !spider_param_auto_increment_mode(thd, share->auto_increment_mode) &&
- !info_auto_called
+ !share->lgtm_tblhnd_share->auto_increment_init ||
+ (
+ !spider_param_auto_increment_mode(thd, share->auto_increment_mode) &&
+ !info_auto_called
+ )
) ? "TRUE" : "FALSE"));
DBUG_RETURN((
- !spider_param_auto_increment_mode(thd, share->auto_increment_mode) &&
- !info_auto_called
+ !share->lgtm_tblhnd_share->auto_increment_init ||
+ (
+ !spider_param_auto_increment_mode(thd, share->auto_increment_mode) &&
+ !info_auto_called
+ )
));
}
#endif
@@ -9208,6 +9255,10 @@ int ha_spider::update_auto_increment()
DBUG_PRINT("info",("spider force_auto_increment=FALSE"));
}
*/
+ DBUG_PRINT("info",("spider auto_increment_mode=%d",
+ auto_increment_mode));
+ DBUG_PRINT("info",("spider next_number_field=%lld",
+ table->next_number_field->val_int()));
if (
auto_increment_mode == 1 &&
!(
@@ -9219,6 +9270,8 @@ int ha_spider::update_auto_increment()
lock_here = TRUE;
pthread_mutex_lock(&share->lgtm_tblhnd_share->auto_increment_mutex);
next_insert_id = share->lgtm_tblhnd_share->auto_increment_value;
+ DBUG_PRINT("info",("spider auto_increment_value=%llu",
+ share->lgtm_tblhnd_share->auto_increment_value));
}
if ((error_num = handler::update_auto_increment()))
{
@@ -10806,6 +10859,9 @@ int ha_spider::rename_table(
pthread_mutex_unlock(&spider_lgtm_tblhnd_share_mutex);
goto error;
}
+ DBUG_PRINT("info",
+ ("spider auto_increment_init=%s",
+ from_lgtm_tblhnd_share->auto_increment_init ? "TRUE" : "FALSE"));
to_lgtm_tblhnd_share->auto_increment_init =
from_lgtm_tblhnd_share->auto_increment_init;
to_lgtm_tblhnd_share->auto_increment_lclval =
@@ -10967,7 +11023,11 @@ bool ha_spider::is_crashed() const
DBUG_RETURN(FALSE);
}
+#ifdef SPIDER_HANDLER_AUTO_REPAIR_HAS_ERROR
+bool ha_spider::auto_repair(int error) const
+#else
bool ha_spider::auto_repair() const
+#endif
{
DBUG_ENTER("ha_spider::auto_repair");
DBUG_PRINT("info",("spider this=%p", this));
@@ -11452,6 +11512,16 @@ TABLE *ha_spider::get_table()
DBUG_RETURN(table);
}
+TABLE *ha_spider::get_top_table()
+{
+ DBUG_ENTER("ha_spider::get_top_table");
+#ifdef HANDLER_HAS_TOP_TABLE_FIELDS
+ if (set_top_table_fields)
+ DBUG_RETURN(top_table);
+#endif
+ DBUG_RETURN(table);
+}
+
void ha_spider::set_ft_discard_bitmap()
{
DBUG_ENTER("ha_spider::set_ft_discard_bitmap");
@@ -13819,6 +13889,18 @@ int ha_spider::append_key_order_for_merge_with_alias_sql_part(
uint roop_count, dbton_id;
spider_db_handler *dbton_hdl;
DBUG_ENTER("ha_spider::append_key_order_for_merge_with_alias_sql_part");
+#ifdef HANDLER_HAS_DIRECT_AGGREGATE
+ if (result_list.direct_aggregate)
+ {
+ st_select_lex *select_lex = spider_get_select_lex(this);
+ ORDER *group = (ORDER *) select_lex->group_list.first;
+ if (!group && *(select_lex->join->sum_funcs))
+ {
+ DBUG_PRINT("info",("spider skip order by"));
+ DBUG_RETURN(0);
+ }
+ }
+#endif
for (roop_count = 0; roop_count < share->use_sql_dbton_count; roop_count++)
{
dbton_id = share->use_sql_dbton_ids[roop_count];
@@ -13868,6 +13950,18 @@ int ha_spider::append_key_order_with_alias_sql_part(
uint roop_count, dbton_id;
spider_db_handler *dbton_hdl;
DBUG_ENTER("ha_spider::append_key_order_with_alias_sql_part");
+#ifdef HANDLER_HAS_DIRECT_AGGREGATE
+ if (result_list.direct_aggregate)
+ {
+ st_select_lex *select_lex = spider_get_select_lex(this);
+ ORDER *group = (ORDER *) select_lex->group_list.first;
+ if (!group && *(select_lex->join->sum_funcs))
+ {
+ DBUG_PRINT("info",("spider skip order by"));
+ DBUG_RETURN(0);
+ }
+ }
+#endif
for (roop_count = 0; roop_count < share->use_sql_dbton_count; roop_count++)
{
dbton_id = share->use_sql_dbton_ids[roop_count];
diff --git a/storage/spider/ha_spider.h b/storage/spider/ha_spider.h
index fc880831912..0c81bef1773 100644
--- a/storage/spider/ha_spider.h
+++ b/storage/spider/ha_spider.h
@@ -125,7 +125,7 @@ public:
bool clone_bitmap_init;
ha_spider *pt_clone_source_handler;
ha_spider *pt_clone_last_searcher;
- bool has_clone_for_merge;
+ bool use_index_merge;
bool init_index_handler;
bool init_rnd_handler;
@@ -682,7 +682,11 @@ public:
const char *name
);
bool is_crashed() const;
+#ifdef SPIDER_HANDLER_AUTO_REPAIR_HAS_ERROR
+ bool auto_repair(int error) const;
+#else
bool auto_repair() const;
+#endif
int disable_indexes(
uint mode
);
@@ -730,6 +734,7 @@ public:
void return_record_by_parent();
#endif
TABLE *get_table();
+ TABLE *get_top_table();
void set_ft_discard_bitmap();
void set_searched_bitmap();
void set_clone_searched_bitmap();
diff --git a/storage/spider/mysql-test/spider/bg/include/ha_deinit_child3_1.inc b/storage/spider/mysql-test/spider/bg/include/ha_deinit_child3_1.inc
index 8fd2ff8a777..c19e376d10a 100644
--- a/storage/spider/mysql-test/spider/bg/include/ha_deinit_child3_1.inc
+++ b/storage/spider/mysql-test/spider/bg/include/ha_deinit_child3_1.inc
@@ -1 +1 @@
---source ../../include/deinit_spider.inc
+--source ../../include/deinit_spider.inc
diff --git a/storage/spider/mysql-test/spider/bg/include/ha_deinit_child3_2.inc b/storage/spider/mysql-test/spider/bg/include/ha_deinit_child3_2.inc
index 8fd2ff8a777..c19e376d10a 100644
--- a/storage/spider/mysql-test/spider/bg/include/ha_deinit_child3_2.inc
+++ b/storage/spider/mysql-test/spider/bg/include/ha_deinit_child3_2.inc
@@ -1 +1 @@
---source ../../include/deinit_spider.inc
+--source ../../include/deinit_spider.inc
diff --git a/storage/spider/mysql-test/spider/bg/include/ha_deinit_child3_3.inc b/storage/spider/mysql-test/spider/bg/include/ha_deinit_child3_3.inc
index 8fd2ff8a777..c19e376d10a 100644
--- a/storage/spider/mysql-test/spider/bg/include/ha_deinit_child3_3.inc
+++ b/storage/spider/mysql-test/spider/bg/include/ha_deinit_child3_3.inc
@@ -1 +1 @@
---source ../../include/deinit_spider.inc
+--source ../../include/deinit_spider.inc
diff --git a/storage/spider/mysql-test/spider/bg/include/ha_init_child2_1.inc b/storage/spider/mysql-test/spider/bg/include/ha_init_child2_1.inc
index 59c0175d349..2684829408d 100644
--- a/storage/spider/mysql-test/spider/bg/include/ha_init_child2_1.inc
+++ b/storage/spider/mysql-test/spider/bg/include/ha_init_child2_1.inc
@@ -1,8 +1,8 @@
-let $CHILD2_1_HA_AS_DROP_TABLES=
- $CHILD2_1_DROP_TABLES;
-let $CHILD2_1_HA_AS_CREATE_TABLES=
- $CHILD2_1_CREATE_TABLES;
-let $CHILD2_1_HA_AS_DROP_TABLES2=
- $CHILD2_1_DROP_TABLES2;
-let $CHILD2_1_HA_AS_CREATE_TABLES2=
- $CHILD2_1_CREATE_TABLES2;
+let $CHILD2_1_HA_AS_DROP_TABLES=
+ $CHILD2_1_DROP_TABLES;
+let $CHILD2_1_HA_AS_CREATE_TABLES=
+ $CHILD2_1_CREATE_TABLES;
+let $CHILD2_1_HA_AS_DROP_TABLES2=
+ $CHILD2_1_DROP_TABLES2;
+let $CHILD2_1_HA_AS_CREATE_TABLES2=
+ $CHILD2_1_CREATE_TABLES2;
diff --git a/storage/spider/mysql-test/spider/bg/include/ha_init_child2_2.inc b/storage/spider/mysql-test/spider/bg/include/ha_init_child2_2.inc
index 90d27ed704d..205eaa6fe35 100644
--- a/storage/spider/mysql-test/spider/bg/include/ha_init_child2_2.inc
+++ b/storage/spider/mysql-test/spider/bg/include/ha_init_child2_2.inc
@@ -1,4 +1,4 @@
-let $CHILD2_2_HA_DROP_TABLES=
- $CHILD2_2_DROP_TABLES;
-let $CHILD2_2_HA_CREATE_TABLES=
- $CHILD2_2_CREATE_TABLES;
+let $CHILD2_2_HA_DROP_TABLES=
+ $CHILD2_2_DROP_TABLES;
+let $CHILD2_2_HA_CREATE_TABLES=
+ $CHILD2_2_CREATE_TABLES;
diff --git a/storage/spider/mysql-test/spider/bg/include/ha_init_child2_3.inc b/storage/spider/mysql-test/spider/bg/include/ha_init_child2_3.inc
index 11abf112b1f..55cb858372c 100644
--- a/storage/spider/mysql-test/spider/bg/include/ha_init_child2_3.inc
+++ b/storage/spider/mysql-test/spider/bg/include/ha_init_child2_3.inc
@@ -1,4 +1,4 @@
-let $CHILD2_3_HA_DROP_TABLES=
- $CHILD2_3_DROP_TABLES;
-let $CHILD2_3_HA_CREATE_TABLES=
- $CHILD2_3_CREATE_TABLES;
+let $CHILD2_3_HA_DROP_TABLES=
+ $CHILD2_3_DROP_TABLES;
+let $CHILD2_3_HA_CREATE_TABLES=
+ $CHILD2_3_CREATE_TABLES;
diff --git a/storage/spider/mysql-test/spider/bg/include/ha_init_child3_1.inc b/storage/spider/mysql-test/spider/bg/include/ha_init_child3_1.inc
index 56de7df4e52..3ac4f97b1e0 100644
--- a/storage/spider/mysql-test/spider/bg/include/ha_init_child3_1.inc
+++ b/storage/spider/mysql-test/spider/bg/include/ha_init_child3_1.inc
@@ -1,140 +1,140 @@
---let $CHILD3_1_ENGINE_TYPE=Spider
---let $CHILD3_1_ENGINE=ENGINE=Spider
---source ../../include/init_spider.inc
-eval INSERT INTO mysql.spider_link_mon_servers
-(db_name, table_name, link_id, sid, server, scheme, host, port, socket,
- username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key,
- ssl_verify_server_cert, default_file, default_group) VALUES
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
-let $CHILD3_1_CHECK_LINK_STATUS=
- SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
- ORDER BY db_name, table_name, link_id;
-let $CHILD3_1_CHECK_LINK_FAILED_LOG=
- SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
-let $CHILD3_1_SET_RECOVERY_STATUS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2", lst "0 2"';
-let $CHILD3_1_SET_OK_STATUS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2", lst "0 1"';
-let $CHILD3_1_SET_OK_STATUS_AS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2", lst "1 0"';
-
-let $CHILD3_1_DROP_TABLES_HA_2_1=
- DROP TABLE IF EXISTS ta_l;
-if ($VERSION_COMPILE_OS_WIN)
-{
- let $CHILD3_1_CREATE_TABLES_HA_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
- COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2"';
- let $CHILD3_1_CREATE_TABLES_HA_AS_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
- COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2"';
-}
-if (!$VERSION_COMPILE_OS_WIN)
-{
- let $CHILD3_1_CREATE_TABLES_HA_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
- COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2"';
- let $CHILD3_1_CREATE_TABLES_HA_AS_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
- COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2"';
-}
-let $CHILD3_1_DROP_TABLES_HA_P_2_1=
- DROP TABLE IF EXISTS ta_l2;
-let $CHILD3_1_CREATE_TABLES_HA_P_2_1=
- CREATE TABLE ta_l2 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
- COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"'
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001"'
- );
-let $CHILD3_1_CREATE_TABLES_HA_AS_P_2_1=
- CREATE TABLE ta_l2 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
- COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"'
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001"'
- );
-let $CHILD3_1_SET_RECOVERY_STATUS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 2"'
- );
-let $CHILD3_1_SET_OK_STATUS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 1"'
- );
-let $CHILD3_1_SET_OK_STATUS_AS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "1 0"'
- );
+--let $CHILD3_1_ENGINE_TYPE=Spider
+--let $CHILD3_1_ENGINE=ENGINE=Spider
+--source ../../include/init_spider.inc
+eval INSERT INTO mysql.spider_link_mon_servers
+(db_name, table_name, link_id, sid, server, scheme, host, port, socket,
+ username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key,
+ ssl_verify_server_cert, default_file, default_group) VALUES
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
+let $CHILD3_1_CHECK_LINK_STATUS=
+ SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
+ ORDER BY db_name, table_name, link_id;
+let $CHILD3_1_CHECK_LINK_FAILED_LOG=
+ SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
+let $CHILD3_1_SET_RECOVERY_STATUS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 2"';
+let $CHILD3_1_SET_OK_STATUS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 1"';
+let $CHILD3_1_SET_OK_STATUS_AS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2", lst "1 0"';
+
+let $CHILD3_1_DROP_TABLES_HA_2_1=
+ DROP TABLE IF EXISTS ta_l;
+if ($VERSION_COMPILE_OS_WIN)
+{
+ let $CHILD3_1_CREATE_TABLES_HA_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
+ COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2"';
+ let $CHILD3_1_CREATE_TABLES_HA_AS_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
+ COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2"';
+}
+if (!$VERSION_COMPILE_OS_WIN)
+{
+ let $CHILD3_1_CREATE_TABLES_HA_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
+ COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2"';
+ let $CHILD3_1_CREATE_TABLES_HA_AS_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
+ COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2"';
+}
+let $CHILD3_1_DROP_TABLES_HA_P_2_1=
+ DROP TABLE IF EXISTS ta_l2;
+let $CHILD3_1_CREATE_TABLES_HA_P_2_1=
+ CREATE TABLE ta_l2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
+ COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"'
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001"'
+ );
+let $CHILD3_1_CREATE_TABLES_HA_AS_P_2_1=
+ CREATE TABLE ta_l2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
+ COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"'
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001"'
+ );
+let $CHILD3_1_SET_RECOVERY_STATUS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 2"'
+ );
+let $CHILD3_1_SET_OK_STATUS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 1"'
+ );
+let $CHILD3_1_SET_OK_STATUS_AS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "1 0"'
+ );
diff --git a/storage/spider/mysql-test/spider/bg/include/ha_init_child3_2.inc b/storage/spider/mysql-test/spider/bg/include/ha_init_child3_2.inc
index fdb3a84cca7..cf47099f439 100644
--- a/storage/spider/mysql-test/spider/bg/include/ha_init_child3_2.inc
+++ b/storage/spider/mysql-test/spider/bg/include/ha_init_child3_2.inc
@@ -1,140 +1,140 @@
---let $CHILD3_2_ENGINE_TYPE=Spider
---let $CHILD3_2_ENGINE=ENGINE=Spider
---source ../../include/init_spider.inc
-eval INSERT INTO mysql.spider_link_mon_servers
-(db_name, table_name, link_id, sid, server, scheme, host, port, socket,
- username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key,
- ssl_verify_server_cert, default_file, default_group) VALUES
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
-let $CHILD3_2_CHECK_LINK_STATUS=
- SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
- ORDER BY db_name, table_name, link_id;
-let $CHILD3_2_CHECK_LINK_FAILED_LOG=
- SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
-let $CHILD3_2_SET_RECOVERY_STATUS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2", lst "0 2"';
-let $CHILD3_2_SET_OK_STATUS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2", lst "0 1"';
-let $CHILD3_2_SET_OK_STATUS_AS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2", lst "1 0"';
-
-let $CHILD3_2_DROP_TABLES_HA_2_1=
- DROP TABLE IF EXISTS ta_l;
-if ($VERSION_COMPILE_OS_WIN)
-{
- let $CHILD3_2_CREATE_TABLES_HA_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
- COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2"';
- let $CHILD3_2_CREATE_TABLES_HA_AS_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
- COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2"';
-}
-if (!$VERSION_COMPILE_OS_WIN)
-{
- let $CHILD3_2_CREATE_TABLES_HA_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
- COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2"';
- let $CHILD3_2_CREATE_TABLES_HA_AS_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
- COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2"';
-}
-let $CHILD3_2_DROP_TABLES_HA_P_2_1=
- DROP TABLE IF EXISTS ta_l2;
-let $CHILD3_2_CREATE_TABLES_HA_P_2_1=
- CREATE TABLE ta_l2 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
- COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"'
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001"'
- );
-let $CHILD3_2_CREATE_TABLES_HA_AS_P_2_1=
- CREATE TABLE ta_l2 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
- COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"'
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001"'
- );
-let $CHILD3_2_SET_RECOVERY_STATUS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 2"'
- );
-let $CHILD3_2_SET_OK_STATUS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 1"'
- );
-let $CHILD3_2_SET_OK_STATUS_AS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "1 0"'
- );
+--let $CHILD3_2_ENGINE_TYPE=Spider
+--let $CHILD3_2_ENGINE=ENGINE=Spider
+--source ../../include/init_spider.inc
+eval INSERT INTO mysql.spider_link_mon_servers
+(db_name, table_name, link_id, sid, server, scheme, host, port, socket,
+ username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key,
+ ssl_verify_server_cert, default_file, default_group) VALUES
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
+let $CHILD3_2_CHECK_LINK_STATUS=
+ SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
+ ORDER BY db_name, table_name, link_id;
+let $CHILD3_2_CHECK_LINK_FAILED_LOG=
+ SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
+let $CHILD3_2_SET_RECOVERY_STATUS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 2"';
+let $CHILD3_2_SET_OK_STATUS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 1"';
+let $CHILD3_2_SET_OK_STATUS_AS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2", lst "1 0"';
+
+let $CHILD3_2_DROP_TABLES_HA_2_1=
+ DROP TABLE IF EXISTS ta_l;
+if ($VERSION_COMPILE_OS_WIN)
+{
+ let $CHILD3_2_CREATE_TABLES_HA_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
+ COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2"';
+ let $CHILD3_2_CREATE_TABLES_HA_AS_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
+ COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2"';
+}
+if (!$VERSION_COMPILE_OS_WIN)
+{
+ let $CHILD3_2_CREATE_TABLES_HA_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
+ COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2"';
+ let $CHILD3_2_CREATE_TABLES_HA_AS_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
+ COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2"';
+}
+let $CHILD3_2_DROP_TABLES_HA_P_2_1=
+ DROP TABLE IF EXISTS ta_l2;
+let $CHILD3_2_CREATE_TABLES_HA_P_2_1=
+ CREATE TABLE ta_l2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
+ COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"'
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001"'
+ );
+let $CHILD3_2_CREATE_TABLES_HA_AS_P_2_1=
+ CREATE TABLE ta_l2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
+ COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"'
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001"'
+ );
+let $CHILD3_2_SET_RECOVERY_STATUS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 2"'
+ );
+let $CHILD3_2_SET_OK_STATUS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 1"'
+ );
+let $CHILD3_2_SET_OK_STATUS_AS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "1 0"'
+ );
diff --git a/storage/spider/mysql-test/spider/bg/include/ha_init_child3_3.inc b/storage/spider/mysql-test/spider/bg/include/ha_init_child3_3.inc
index d08ff4d0d34..094d26b62c6 100644
--- a/storage/spider/mysql-test/spider/bg/include/ha_init_child3_3.inc
+++ b/storage/spider/mysql-test/spider/bg/include/ha_init_child3_3.inc
@@ -1,140 +1,140 @@
---let $CHILD3_3_ENGINE_TYPE=Spider
---let $CHILD3_3_ENGINE=ENGINE=Spider
---source ../../include/init_spider.inc
-eval INSERT INTO mysql.spider_link_mon_servers
-(db_name, table_name, link_id, sid, server, scheme, host, port, socket,
- username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key,
- ssl_verify_server_cert, default_file, default_group) VALUES
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
-let $CHILD3_3_CHECK_LINK_STATUS=
- SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
- ORDER BY db_name, table_name, link_id;
-let $CHILD3_3_CHECK_LINK_FAILED_LOG=
- SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
-let $CHILD3_3_SET_RECOVERY_STATUS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2", lst "0 2"';
-let $CHILD3_3_SET_OK_STATUS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2", lst "0 1"';
-let $CHILD3_3_SET_OK_STATUS_AS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2", lst "1 0"';
-
-let $CHILD3_3_DROP_TABLES_HA_2_1=
- DROP TABLE IF EXISTS ta_l;
-if ($VERSION_COMPILE_OS_WIN)
-{
- let $CHILD3_3_CREATE_TABLES_HA_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
- COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2"';
- let $CHILD3_3_CREATE_TABLES_HA_AS_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
- COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2"';
-}
-if (!$VERSION_COMPILE_OS_WIN)
-{
- let $CHILD3_3_CREATE_TABLES_HA_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
- COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2"';
- let $CHILD3_3_CREATE_TABLES_HA_AS_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
- COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2"';
-}
-let $CHILD3_3_DROP_TABLES_HA_P_2_1=
- DROP TABLE IF EXISTS ta_l2;
-let $CHILD3_3_CREATE_TABLES_HA_P_2_1=
- CREATE TABLE ta_l2 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
- COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"'
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001"'
- );
-let $CHILD3_3_CREATE_TABLES_HA_AS_P_2_1=
- CREATE TABLE ta_l2 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
- COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"'
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001"'
- );
-let $CHILD3_3_SET_RECOVERY_STATUS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 2"'
- );
-let $CHILD3_3_SET_OK_STATUS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 1"'
- );
-let $CHILD3_3_SET_OK_STATUS_AS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "1 0"'
- );
+--let $CHILD3_3_ENGINE_TYPE=Spider
+--let $CHILD3_3_ENGINE=ENGINE=Spider
+--source ../../include/init_spider.inc
+eval INSERT INTO mysql.spider_link_mon_servers
+(db_name, table_name, link_id, sid, server, scheme, host, port, socket,
+ username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key,
+ ssl_verify_server_cert, default_file, default_group) VALUES
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
+let $CHILD3_3_CHECK_LINK_STATUS=
+ SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
+ ORDER BY db_name, table_name, link_id;
+let $CHILD3_3_CHECK_LINK_FAILED_LOG=
+ SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
+let $CHILD3_3_SET_RECOVERY_STATUS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 2"';
+let $CHILD3_3_SET_OK_STATUS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 1"';
+let $CHILD3_3_SET_OK_STATUS_AS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2", lst "1 0"';
+
+let $CHILD3_3_DROP_TABLES_HA_2_1=
+ DROP TABLE IF EXISTS ta_l;
+if ($VERSION_COMPILE_OS_WIN)
+{
+ let $CHILD3_3_CREATE_TABLES_HA_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
+ COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2"';
+ let $CHILD3_3_CREATE_TABLES_HA_AS_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
+ COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2"';
+}
+if (!$VERSION_COMPILE_OS_WIN)
+{
+ let $CHILD3_3_CREATE_TABLES_HA_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
+ COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2"';
+ let $CHILD3_3_CREATE_TABLES_HA_AS_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
+ COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2"';
+}
+let $CHILD3_3_DROP_TABLES_HA_P_2_1=
+ DROP TABLE IF EXISTS ta_l2;
+let $CHILD3_3_CREATE_TABLES_HA_P_2_1=
+ CREATE TABLE ta_l2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
+ COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"'
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001"'
+ );
+let $CHILD3_3_CREATE_TABLES_HA_AS_P_2_1=
+ CREATE TABLE ta_l2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
+ COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"'
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001"'
+ );
+let $CHILD3_3_SET_RECOVERY_STATUS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 2"'
+ );
+let $CHILD3_3_SET_OK_STATUS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 1"'
+ );
+let $CHILD3_3_SET_OK_STATUS_AS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "1 0"'
+ );
diff --git a/storage/spider/mysql-test/spider/bg/include/hs_init_child2_1.inc b/storage/spider/mysql-test/spider/bg/include/hs_init_child2_1.inc
index 2ea1c0c9cd6..ee006858b06 100644
--- a/storage/spider/mysql-test/spider/bg/include/hs_init_child2_1.inc
+++ b/storage/spider/mysql-test/spider/bg/include/hs_init_child2_1.inc
@@ -1,24 +1,24 @@
-let $CHILD2_1_HS_DROP_TABLES=
- DROP TABLE IF EXISTS hs_r;
-let $CHILD2_1_HS_CREATE_TABLES=
- CREATE TABLE hs_r (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- d INT DEFAULT 11,
- PRIMARY KEY(a)
- ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
-let $CHILD2_1_HS_SELECT_TABLES=
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s'), d FROM hs_r ORDER BY a;
-let $CHILD2_1_HS_DROP_TABLES2=
- DROP TABLE IF EXISTS hs_r2;
-let $CHILD2_1_HS_CREATE_TABLES2=
- CREATE TABLE hs_r2 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- d INT DEFAULT 11,
- PRIMARY KEY(a)
- ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
-let $CHILD2_1_HS_SELECT_TABLES2=
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s'), d FROM hs_r2 ORDER BY a;
+let $CHILD2_1_HS_DROP_TABLES=
+ DROP TABLE IF EXISTS hs_r;
+let $CHILD2_1_HS_CREATE_TABLES=
+ CREATE TABLE hs_r (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ d INT DEFAULT 11,
+ PRIMARY KEY(a)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_HS_SELECT_TABLES=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s'), d FROM hs_r ORDER BY a;
+let $CHILD2_1_HS_DROP_TABLES2=
+ DROP TABLE IF EXISTS hs_r2;
+let $CHILD2_1_HS_CREATE_TABLES2=
+ CREATE TABLE hs_r2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ d INT DEFAULT 11,
+ PRIMARY KEY(a)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_HS_SELECT_TABLES2=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s'), d FROM hs_r2 ORDER BY a;
diff --git a/storage/spider/mysql-test/spider/bg/include/hs_init_child2_2.inc b/storage/spider/mysql-test/spider/bg/include/hs_init_child2_2.inc
index 7c69d73ced6..1c5a02d50c8 100644
--- a/storage/spider/mysql-test/spider/bg/include/hs_init_child2_2.inc
+++ b/storage/spider/mysql-test/spider/bg/include/hs_init_child2_2.inc
@@ -1,12 +1,12 @@
-let $CHILD2_2_HS_DROP_TABLES=
- DROP TABLE IF EXISTS hs_r3;
-let $CHILD2_2_HS_CREATE_TABLES=
- CREATE TABLE hs_r3 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- d INT DEFAULT 11,
- PRIMARY KEY(a)
- ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
-let $CHILD2_2_HS_SELECT_TABLES=
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s'), d FROM hs_r3 ORDER BY a;
+let $CHILD2_2_HS_DROP_TABLES=
+ DROP TABLE IF EXISTS hs_r3;
+let $CHILD2_2_HS_CREATE_TABLES=
+ CREATE TABLE hs_r3 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ d INT DEFAULT 11,
+ PRIMARY KEY(a)
+ ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
+let $CHILD2_2_HS_SELECT_TABLES=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s'), d FROM hs_r3 ORDER BY a;
diff --git a/storage/spider/mysql-test/spider/bg/include/init_child2_1.inc b/storage/spider/mysql-test/spider/bg/include/init_child2_1.inc
index 6e25765f25e..611ce6012a8 100644
--- a/storage/spider/mysql-test/spider/bg/include/init_child2_1.inc
+++ b/storage/spider/mysql-test/spider/bg/include/init_child2_1.inc
@@ -1,175 +1,175 @@
-let $CHILD2_1_DROP_TABLES=
- DROP TABLE IF EXISTS ta_r;
-let $CHILD2_1_CREATE_TABLES=
- CREATE TABLE ta_r (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a),
- KEY idx1(b)
- ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
-let $CHILD2_1_SELECT_TABLES=
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
-let $CHILD2_1_DROP_TABLES2=
- DROP TABLE IF EXISTS ta_r2;
-let $CHILD2_1_CREATE_TABLES2=
- CREATE TABLE ta_r2 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
-let $CHILD2_1_SELECT_TABLES2=
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r2 ORDER BY a;
-let $CHILD2_1_DROP_TABLES3=
- DROP TABLE IF EXISTS ta_r_no_idx;
-let $CHILD2_1_CREATE_TABLES3=
- CREATE TABLE ta_r_no_idx (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10'
- ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
-let $CHILD2_1_SELECT_TABLES3=
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r_no_idx ORDER BY a;
-let $CHILD2_1_DROP_TABLES4=
- DROP TABLE IF EXISTS ta_r_auto_inc;
-let $CHILD2_1_CREATE_TABLES4=
- CREATE TABLE ta_r_auto_inc (
- a INT AUTO_INCREMENT,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
-let $CHILD2_1_SELECT_TABLES4=
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r_auto_inc
- ORDER BY a;
-let $CHILD2_1_DROP_TABLES5=
- DROP TABLE IF EXISTS ta_r_int;
-let $CHILD2_1_CREATE_TABLES5=
- CREATE TABLE ta_r_int (
- a INT AUTO_INCREMENT,
- b INT DEFAULT 10,
- c INT DEFAULT 11,
- PRIMARY KEY(a),
- KEY idx1(b),
- KEY idx2(c)
- ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
-let $CHILD2_1_SELECT_TABLES5=
- SELECT a, b, c FROM ta_r_int ORDER BY a;
-let $CHILD2_1_DROP_TABLES6=
- DROP TABLE IF EXISTS ta_r_3;
-let $CHILD2_1_CREATE_TABLES6=
- CREATE TABLE ta_r_3 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10'
- ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
-let $CHILD2_1_SELECT_TABLES6=
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r_3 ORDER BY a;
-let $CHILD2_1_DROP_FT_TABLES=
- DROP TABLE IF EXISTS ft_r;
-let $CHILD2_1_CREATE_FT_TABLES=
- CREATE TABLE ft_r (
- a INT DEFAULT 0,
- b TEXT,
- c TEXT,
- d TEXT,
- PRIMARY KEY(a),
- FULLTEXT INDEX ft_idx1(b),
- FULLTEXT INDEX ft_idx2(c)
- ) $CHILD2_1_FT_ENGINE $CHILD2_1_FT_CHARSET;
-let $CHILD2_1_SELECT_FT_TABLES=
- SELECT a, b, c, d FROM ft_r ORDER BY a;
-let $CHILD2_1_DROP_FT_TABLES2=
- DROP TABLE IF EXISTS ft_r2;
-let $CHILD2_1_CREATE_FT_TABLES2=
- CREATE TABLE ft_r2 (
- a INT DEFAULT 0,
- b TEXT,
- c TEXT,
- d TEXT,
- PRIMARY KEY(a),
- FULLTEXT INDEX ft_idx1(b),
- FULLTEXT INDEX ft_idx2(c)
- ) $CHILD2_1_FT_ENGINE $CHILD2_1_FT_CHARSET;
-let $CHILD2_1_SELECT_FT_TABLES2=
- SELECT a, b, c, d FROM ft_r2 ORDER BY a;
-let $CHILD2_1_DROP_GM_TABLES=
- DROP TABLE IF EXISTS gm_r;
-let $CHILD2_1_CREATE_GM_TABLES=
- CREATE TABLE gm_r (
- a INT DEFAULT 0,
- b GEOMETRY NOT NULL,
- c GEOMETRY NOT NULL,
- PRIMARY KEY(a),
- SPATIAL INDEX sp_idx1(b),
- SPATIAL INDEX sp_idx2(c)
- ) $CHILD2_1_GM_ENGINE $CHILD2_1_GM_CHARSET;
-let $CHILD2_1_SELECT_GM_TABLES=
- SELECT a, b, c FROM gm_r ORDER BY a;
-let $CHILD2_1_DROP_GM_TABLES2=
- DROP TABLE IF EXISTS gm_r2;
-let $CHILD2_1_CREATE_GM_TABLES2=
- CREATE TABLE gm_r2 (
- a INT DEFAULT 0,
- b GEOMETRY NOT NULL,
- c GEOMETRY NOT NULL,
- PRIMARY KEY(a),
- SPATIAL INDEX sp_idx1(b),
- SPATIAL INDEX sp_idx2(c)
- ) $CHILD2_1_GM_ENGINE $CHILD2_1_GM_CHARSET;
-let $CHILD2_1_SELECT_GM_TABLES2=
- SELECT a, b, c FROM gm_r2 ORDER BY a;
-let $CHILD2_1_DROP_LOCK_TABLES1=
- DROP TABLE IF EXISTS t1_1;
-let $CHILD2_1_CREATE_LOCK_TABLES1=
- CREATE TABLE t1_1 (
- id int(11) NOT NULL,
- PRIMARY KEY (id)
- ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
-let $CHILD2_1_DROP_LOCK_TABLES2=
- DROP TABLE IF EXISTS t2_2;
-let $CHILD2_1_CREATE_LOCK_TABLES2=
- CREATE TABLE t2_2 (
- id int(11) NOT NULL,
- PRIMARY KEY (id)
- ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
-let $CHILD2_1_DROP_INCREMENT_TABLES1=
- DROP TABLE IF EXISTS t1_1;
-let $CHILD2_1_CREATE_INCREMENT_TABLES1=
- CREATE TABLE t1_1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
-let $CHILD2_1_SELECT_INCREMENT_TABLES1=
- SELECT id FROM t1_1 ORDER BY id;
-let $CHILD2_1_DROP_TEXT_PK_TABLES1=
- DROP TABLE IF EXISTS t1;
-let $CHILD2_1_CREATE_TEXT_PK_TABLES1=
- CREATE TABLE t1 (
- a VARCHAR(255),
- PRIMARY KEY (a)
- ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET2;
-let $CHILD2_1_SELECT_TEXT_PK_TABLES1=
- SELECT a FROM t1 ORDER BY a;
-let $CHILD2_1_DROP_TEXT_KEY_TABLES1=
- DROP TABLE IF EXISTS t1;
-let $CHILD2_1_CREATE_TEXT_KEY_TABLES1=
- CREATE TABLE t1 (
- a VARCHAR(255),
- b VARCHAR(255),
- c VARCHAR(255),
- KEY idx1(a,b),
- KEY idx2(b),
- PRIMARY KEY(c)
- ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
-let $CHILD2_1_SELECT_TEXT_KEY_TABLES1=
- SELECT a, b FROM t1 ORDER BY a, b;
-let $CHILD2_1_AUTO_INCREMENT_INCREMENT1=
- SET GLOBAL AUTO_INCREMENT_INCREMENT = 1;
-let $CHILD2_1_AUTO_INCREMENT_INCREMENT2=
- SET GLOBAL AUTO_INCREMENT_INCREMENT = 4;
-let $CHILD2_1_AUTO_INCREMENT_OFFSET1=
- SET GLOBAL AUTO_INCREMENT_OFFSET = 1;
-let $CHILD2_1_AUTO_INCREMENT_OFFSET2=
- SET GLOBAL AUTO_INCREMENT_OFFSET = 2;
+let $CHILD2_1_DROP_TABLES=
+ DROP TABLE IF EXISTS ta_r;
+let $CHILD2_1_CREATE_TABLES=
+ CREATE TABLE ta_r (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a),
+ KEY idx1(b)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_SELECT_TABLES=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
+let $CHILD2_1_DROP_TABLES2=
+ DROP TABLE IF EXISTS ta_r2;
+let $CHILD2_1_CREATE_TABLES2=
+ CREATE TABLE ta_r2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_SELECT_TABLES2=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r2 ORDER BY a;
+let $CHILD2_1_DROP_TABLES3=
+ DROP TABLE IF EXISTS ta_r_no_idx;
+let $CHILD2_1_CREATE_TABLES3=
+ CREATE TABLE ta_r_no_idx (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_SELECT_TABLES3=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r_no_idx ORDER BY a;
+let $CHILD2_1_DROP_TABLES4=
+ DROP TABLE IF EXISTS ta_r_auto_inc;
+let $CHILD2_1_CREATE_TABLES4=
+ CREATE TABLE ta_r_auto_inc (
+ a INT AUTO_INCREMENT,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_SELECT_TABLES4=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r_auto_inc
+ ORDER BY a;
+let $CHILD2_1_DROP_TABLES5=
+ DROP TABLE IF EXISTS ta_r_int;
+let $CHILD2_1_CREATE_TABLES5=
+ CREATE TABLE ta_r_int (
+ a INT AUTO_INCREMENT,
+ b INT DEFAULT 10,
+ c INT DEFAULT 11,
+ PRIMARY KEY(a),
+ KEY idx1(b),
+ KEY idx2(c)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_SELECT_TABLES5=
+ SELECT a, b, c FROM ta_r_int ORDER BY a;
+let $CHILD2_1_DROP_TABLES6=
+ DROP TABLE IF EXISTS ta_r_3;
+let $CHILD2_1_CREATE_TABLES6=
+ CREATE TABLE ta_r_3 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_SELECT_TABLES6=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r_3 ORDER BY a;
+let $CHILD2_1_DROP_FT_TABLES=
+ DROP TABLE IF EXISTS ft_r;
+let $CHILD2_1_CREATE_FT_TABLES=
+ CREATE TABLE ft_r (
+ a INT DEFAULT 0,
+ b TEXT,
+ c TEXT,
+ d TEXT,
+ PRIMARY KEY(a),
+ FULLTEXT INDEX ft_idx1(b),
+ FULLTEXT INDEX ft_idx2(c)
+ ) $CHILD2_1_FT_ENGINE $CHILD2_1_FT_CHARSET;
+let $CHILD2_1_SELECT_FT_TABLES=
+ SELECT a, b, c, d FROM ft_r ORDER BY a;
+let $CHILD2_1_DROP_FT_TABLES2=
+ DROP TABLE IF EXISTS ft_r2;
+let $CHILD2_1_CREATE_FT_TABLES2=
+ CREATE TABLE ft_r2 (
+ a INT DEFAULT 0,
+ b TEXT,
+ c TEXT,
+ d TEXT,
+ PRIMARY KEY(a),
+ FULLTEXT INDEX ft_idx1(b),
+ FULLTEXT INDEX ft_idx2(c)
+ ) $CHILD2_1_FT_ENGINE $CHILD2_1_FT_CHARSET;
+let $CHILD2_1_SELECT_FT_TABLES2=
+ SELECT a, b, c, d FROM ft_r2 ORDER BY a;
+let $CHILD2_1_DROP_GM_TABLES=
+ DROP TABLE IF EXISTS gm_r;
+let $CHILD2_1_CREATE_GM_TABLES=
+ CREATE TABLE gm_r (
+ a INT DEFAULT 0,
+ b GEOMETRY NOT NULL,
+ c GEOMETRY NOT NULL,
+ PRIMARY KEY(a),
+ SPATIAL INDEX sp_idx1(b),
+ SPATIAL INDEX sp_idx2(c)
+ ) $CHILD2_1_GM_ENGINE $CHILD2_1_GM_CHARSET;
+let $CHILD2_1_SELECT_GM_TABLES=
+ SELECT a, b, c FROM gm_r ORDER BY a;
+let $CHILD2_1_DROP_GM_TABLES2=
+ DROP TABLE IF EXISTS gm_r2;
+let $CHILD2_1_CREATE_GM_TABLES2=
+ CREATE TABLE gm_r2 (
+ a INT DEFAULT 0,
+ b GEOMETRY NOT NULL,
+ c GEOMETRY NOT NULL,
+ PRIMARY KEY(a),
+ SPATIAL INDEX sp_idx1(b),
+ SPATIAL INDEX sp_idx2(c)
+ ) $CHILD2_1_GM_ENGINE $CHILD2_1_GM_CHARSET;
+let $CHILD2_1_SELECT_GM_TABLES2=
+ SELECT a, b, c FROM gm_r2 ORDER BY a;
+let $CHILD2_1_DROP_LOCK_TABLES1=
+ DROP TABLE IF EXISTS t1_1;
+let $CHILD2_1_CREATE_LOCK_TABLES1=
+ CREATE TABLE t1_1 (
+ id int(11) NOT NULL,
+ PRIMARY KEY (id)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_DROP_LOCK_TABLES2=
+ DROP TABLE IF EXISTS t2_2;
+let $CHILD2_1_CREATE_LOCK_TABLES2=
+ CREATE TABLE t2_2 (
+ id int(11) NOT NULL,
+ PRIMARY KEY (id)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_DROP_INCREMENT_TABLES1=
+ DROP TABLE IF EXISTS t1_1;
+let $CHILD2_1_CREATE_INCREMENT_TABLES1=
+ CREATE TABLE t1_1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_SELECT_INCREMENT_TABLES1=
+ SELECT id FROM t1_1 ORDER BY id;
+let $CHILD2_1_DROP_TEXT_PK_TABLES1=
+ DROP TABLE IF EXISTS t1;
+let $CHILD2_1_CREATE_TEXT_PK_TABLES1=
+ CREATE TABLE t1 (
+ a VARCHAR(255),
+ PRIMARY KEY (a)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET2;
+let $CHILD2_1_SELECT_TEXT_PK_TABLES1=
+ SELECT a FROM t1 ORDER BY a;
+let $CHILD2_1_DROP_TEXT_KEY_TABLES1=
+ DROP TABLE IF EXISTS t1;
+let $CHILD2_1_CREATE_TEXT_KEY_TABLES1=
+ CREATE TABLE t1 (
+ a VARCHAR(255),
+ b VARCHAR(255),
+ c VARCHAR(255),
+ KEY idx1(a,b),
+ KEY idx2(b),
+ PRIMARY KEY(c)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_SELECT_TEXT_KEY_TABLES1=
+ SELECT a, b FROM t1 ORDER BY a, b;
+let $CHILD2_1_AUTO_INCREMENT_INCREMENT1=
+ SET GLOBAL AUTO_INCREMENT_INCREMENT = 1;
+let $CHILD2_1_AUTO_INCREMENT_INCREMENT2=
+ SET GLOBAL AUTO_INCREMENT_INCREMENT = 4;
+let $CHILD2_1_AUTO_INCREMENT_OFFSET1=
+ SET GLOBAL AUTO_INCREMENT_OFFSET = 1;
+let $CHILD2_1_AUTO_INCREMENT_OFFSET2=
+ SET GLOBAL AUTO_INCREMENT_OFFSET = 2;
diff --git a/storage/spider/mysql-test/spider/bg/include/init_child2_2.inc b/storage/spider/mysql-test/spider/bg/include/init_child2_2.inc
index 3524fc4a2b7..9f0b5e2fe5a 100644
--- a/storage/spider/mysql-test/spider/bg/include/init_child2_2.inc
+++ b/storage/spider/mysql-test/spider/bg/include/init_child2_2.inc
@@ -1,80 +1,80 @@
-let $CHILD2_2_DROP_TABLES=
- DROP TABLE IF EXISTS ta_r3;
-let $CHILD2_2_CREATE_TABLES=
- CREATE TABLE ta_r3 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
-let $CHILD2_2_DROP_TABLES5=
- DROP TABLE IF EXISTS ta_r_int;
-let $CHILD2_2_CREATE_TABLES5=
- CREATE TABLE ta_r_int (
- a INT AUTO_INCREMENT,
- b INT DEFAULT 10,
- c INT DEFAULT 11,
- PRIMARY KEY(a),
- KEY idx1(b),
- KEY idx2(c)
- ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
-let $CHILD2_2_SELECT_TABLES=
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a;
-let $CHILD2_2_DROP_FT_TABLES=
- DROP TABLE IF EXISTS ft_r3;
-let $CHILD2_2_CREATE_FT_TABLES=
- CREATE TABLE ft_r3 (
- a INT DEFAULT 0,
- b TEXT,
- c TEXT,
- d TEXT,
- PRIMARY KEY(a),
- FULLTEXT INDEX ft_idx1(b),
- FULLTEXT INDEX ft_idx2(c)
- ) $CHILD2_2_FT_ENGINE $CHILD2_2_FT_CHARSET;
-let $CHILD2_2_SELECT_FT_TABLES=
- SELECT a, b, c, d FROM ft_r3 ORDER BY a;
-let $CHILD2_2_DROP_GM_TABLES=
- DROP TABLE IF EXISTS gm_r3;
-let $CHILD2_2_CREATE_GM_TABLES=
- CREATE TABLE gm_r3 (
- a INT DEFAULT 0,
- b GEOMETRY NOT NULL,
- c GEOMETRY NOT NULL,
- PRIMARY KEY(a),
- SPATIAL INDEX sp_idx1(b),
- SPATIAL INDEX sp_idx2(c)
- ) $CHILD2_2_GM_ENGINE $CHILD2_2_GM_CHARSET;
-let $CHILD2_2_SELECT_GM_TABLES=
- SELECT a, b, c FROM gm_r3 ORDER BY a;
-let $CHILD2_2_DROP_LOCK_TABLES1=
- DROP TABLE IF EXISTS t1_2;
-let $CHILD2_2_CREATE_LOCK_TABLES1=
- CREATE TABLE t1_2 (
- id int(11) NOT NULL,
- PRIMARY KEY (id)
- ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
-let $CHILD2_2_DROP_LOCK_TABLES2=
- DROP TABLE IF EXISTS t2_1;
-let $CHILD2_2_CREATE_LOCK_TABLES2=
- CREATE TABLE t2_1 (
- id int(11) NOT NULL,
- PRIMARY KEY (id)
- ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
-let $CHILD2_2_DROP_INCREMENT_TABLES1=
- DROP TABLE IF EXISTS t1_2;
-let $CHILD2_2_CREATE_INCREMENT_TABLES1=
- CREATE TABLE t1_2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
-let $CHILD2_2_SELECT_INCREMENT_TABLES1=
- SELECT id FROM t1_2 ORDER BY id;
-let $CHILD2_2_AUTO_INCREMENT_INCREMENT1=
- SET GLOBAL AUTO_INCREMENT_INCREMENT = 1;
-let $CHILD2_2_AUTO_INCREMENT_INCREMENT2=
- SET GLOBAL AUTO_INCREMENT_INCREMENT = 4;
-let $CHILD2_2_AUTO_INCREMENT_OFFSET1=
- SET GLOBAL AUTO_INCREMENT_OFFSET = 1;
-let $CHILD2_2_AUTO_INCREMENT_OFFSET2=
- SET GLOBAL AUTO_INCREMENT_OFFSET = 3;
+let $CHILD2_2_DROP_TABLES=
+ DROP TABLE IF EXISTS ta_r3;
+let $CHILD2_2_CREATE_TABLES=
+ CREATE TABLE ta_r3 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
+let $CHILD2_2_DROP_TABLES5=
+ DROP TABLE IF EXISTS ta_r_int;
+let $CHILD2_2_CREATE_TABLES5=
+ CREATE TABLE ta_r_int (
+ a INT AUTO_INCREMENT,
+ b INT DEFAULT 10,
+ c INT DEFAULT 11,
+ PRIMARY KEY(a),
+ KEY idx1(b),
+ KEY idx2(c)
+ ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
+let $CHILD2_2_SELECT_TABLES=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a;
+let $CHILD2_2_DROP_FT_TABLES=
+ DROP TABLE IF EXISTS ft_r3;
+let $CHILD2_2_CREATE_FT_TABLES=
+ CREATE TABLE ft_r3 (
+ a INT DEFAULT 0,
+ b TEXT,
+ c TEXT,
+ d TEXT,
+ PRIMARY KEY(a),
+ FULLTEXT INDEX ft_idx1(b),
+ FULLTEXT INDEX ft_idx2(c)
+ ) $CHILD2_2_FT_ENGINE $CHILD2_2_FT_CHARSET;
+let $CHILD2_2_SELECT_FT_TABLES=
+ SELECT a, b, c, d FROM ft_r3 ORDER BY a;
+let $CHILD2_2_DROP_GM_TABLES=
+ DROP TABLE IF EXISTS gm_r3;
+let $CHILD2_2_CREATE_GM_TABLES=
+ CREATE TABLE gm_r3 (
+ a INT DEFAULT 0,
+ b GEOMETRY NOT NULL,
+ c GEOMETRY NOT NULL,
+ PRIMARY KEY(a),
+ SPATIAL INDEX sp_idx1(b),
+ SPATIAL INDEX sp_idx2(c)
+ ) $CHILD2_2_GM_ENGINE $CHILD2_2_GM_CHARSET;
+let $CHILD2_2_SELECT_GM_TABLES=
+ SELECT a, b, c FROM gm_r3 ORDER BY a;
+let $CHILD2_2_DROP_LOCK_TABLES1=
+ DROP TABLE IF EXISTS t1_2;
+let $CHILD2_2_CREATE_LOCK_TABLES1=
+ CREATE TABLE t1_2 (
+ id int(11) NOT NULL,
+ PRIMARY KEY (id)
+ ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
+let $CHILD2_2_DROP_LOCK_TABLES2=
+ DROP TABLE IF EXISTS t2_1;
+let $CHILD2_2_CREATE_LOCK_TABLES2=
+ CREATE TABLE t2_1 (
+ id int(11) NOT NULL,
+ PRIMARY KEY (id)
+ ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
+let $CHILD2_2_DROP_INCREMENT_TABLES1=
+ DROP TABLE IF EXISTS t1_2;
+let $CHILD2_2_CREATE_INCREMENT_TABLES1=
+ CREATE TABLE t1_2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
+let $CHILD2_2_SELECT_INCREMENT_TABLES1=
+ SELECT id FROM t1_2 ORDER BY id;
+let $CHILD2_2_AUTO_INCREMENT_INCREMENT1=
+ SET GLOBAL AUTO_INCREMENT_INCREMENT = 1;
+let $CHILD2_2_AUTO_INCREMENT_INCREMENT2=
+ SET GLOBAL AUTO_INCREMENT_INCREMENT = 4;
+let $CHILD2_2_AUTO_INCREMENT_OFFSET1=
+ SET GLOBAL AUTO_INCREMENT_OFFSET = 1;
+let $CHILD2_2_AUTO_INCREMENT_OFFSET2=
+ SET GLOBAL AUTO_INCREMENT_OFFSET = 3;
diff --git a/storage/spider/mysql-test/spider/bg/include/init_child2_3.inc b/storage/spider/mysql-test/spider/bg/include/init_child2_3.inc
index d857a787ac0..05dbb1c3dd1 100644
--- a/storage/spider/mysql-test/spider/bg/include/init_child2_3.inc
+++ b/storage/spider/mysql-test/spider/bg/include/init_child2_3.inc
@@ -1,11 +1,11 @@
-let $CHILD2_3_DROP_TABLES=
- DROP TABLE IF EXISTS ta_r4;
-let $CHILD2_3_CREATE_TABLES=
- CREATE TABLE ta_r4 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD2_3_ENGINE $CHILD2_3_CHARSET;
-let $CHILD2_3_SELECT_TABLES=
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r4 ORDER BY a;
+let $CHILD2_3_DROP_TABLES=
+ DROP TABLE IF EXISTS ta_r4;
+let $CHILD2_3_CREATE_TABLES=
+ CREATE TABLE ta_r4 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD2_3_ENGINE $CHILD2_3_CHARSET;
+let $CHILD2_3_SELECT_TABLES=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r4 ORDER BY a;
diff --git a/storage/spider/mysql-test/spider/bg/include/init_slave1_1.inc b/storage/spider/mysql-test/spider/bg/include/init_slave1_1.inc
index 87c05f1f690..73c3c6b9ef2 100644
--- a/storage/spider/mysql-test/spider/bg/include/init_slave1_1.inc
+++ b/storage/spider/mysql-test/spider/bg/include/init_slave1_1.inc
@@ -1,10 +1,10 @@
-let $SLAVE1_1_COMMENT_INCREMENT1_1=
- COMMENT '';
-let $SLAVE1_1_COMMENT_INCREMENT1_P_1=
- COMMENT ''
- PARTITION BY LIST(MOD(id, 2)) (
- PARTITION pt1 VALUES IN (0)
- COMMENT='',
- PARTITION pt2 VALUES IN (1)
- COMMENT=''
- );
+let $SLAVE1_1_COMMENT_INCREMENT1_1=
+ COMMENT '';
+let $SLAVE1_1_COMMENT_INCREMENT1_P_1=
+ COMMENT ''
+ PARTITION BY LIST(MOD(id, 2)) (
+ PARTITION pt1 VALUES IN (0)
+ COMMENT='',
+ PARTITION pt2 VALUES IN (1)
+ COMMENT=''
+ );
diff --git a/storage/spider/mysql-test/spider/bg/t/direct_aggregate.test b/storage/spider/mysql-test/spider/bg/t/direct_aggregate.test
index 5f17ac402e2..d65f4c5a624 100644
--- a/storage/spider/mysql-test/spider/bg/t/direct_aggregate.test
+++ b/storage/spider/mysql-test/spider/bg/t/direct_aggregate.test
@@ -1,179 +1,179 @@
---disable_warnings
---disable_query_log
---disable_result_log
---source test_init.inc
---enable_result_log
---enable_query_log
-
---echo
---echo drop and create databases
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- CREATE DATABASE auto_test_remote;
- USE auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- CREATE DATABASE auto_test_remote2;
- USE auto_test_remote2;
-}
---enable_warnings
-
---echo
---echo test select 1
---connection master_1
-SELECT 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- SELECT 1;
- --connection child2_2
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo create table select test
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_TABLES;
- echo CHILD2_1_CREATE_TABLES;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
---disable_warnings
-DROP TABLE IF EXISTS ta_l;
---enable_warnings
---disable_query_log
-echo CREATE TABLE ta_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
-eval CREATE TABLE ta_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
---enable_query_log
-INSERT INTO ta_l (a, b, c) VALUES
- (1, 'a', '2008-08-01 10:21:39'),
- (2, 'b', '2000-01-01 00:00:00'),
- (3, 'e', '2007-06-04 20:03:11'),
- (4, 'd', '2003-11-30 05:01:03'),
- (5, 'c', '2001-12-31 23:59:59');
-
---echo
---echo direct_aggregating test
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
-SELECT COUNT(*) FROM ta_l;
-eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
-SELECT MAX(a) FROM ta_l;
-eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
-SELECT MIN(a) FROM ta_l;
-eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
-SELECT MAX(a) FROM ta_l WHERE a < 5;
-eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
-SELECT MIN(a) FROM ta_l WHERE a > 1;
-eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo deinit
---disable_warnings
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
-}
---disable_query_log
---disable_result_log
---source test_deinit.inc
---enable_result_log
---enable_query_log
---enable_warnings
---echo
---echo end of test
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--enable_result_log
+--enable_query_log
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ --connection child2_2
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo create table select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS ta_l;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE ta_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE ta_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+--enable_query_log
+INSERT INTO ta_l (a, b, c) VALUES
+ (1, 'a', '2008-08-01 10:21:39'),
+ (2, 'b', '2000-01-01 00:00:00'),
+ (3, 'e', '2007-06-04 20:03:11'),
+ (4, 'd', '2003-11-30 05:01:03'),
+ (5, 'c', '2001-12-31 23:59:59');
+
+--echo
+--echo direct_aggregating test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+SELECT COUNT(*) FROM ta_l;
+eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+SELECT MAX(a) FROM ta_l;
+eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+SELECT MIN(a) FROM ta_l;
+eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+SELECT MAX(a) FROM ta_l WHERE a < 5;
+eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+SELECT MIN(a) FROM ta_l WHERE a > 1;
+eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+}
+--disable_query_log
+--disable_result_log
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bg/t/direct_aggregate_part.test b/storage/spider/mysql-test/spider/bg/t/direct_aggregate_part.test
index 2d67e9af32c..aebf210c745 100644
--- a/storage/spider/mysql-test/spider/bg/t/direct_aggregate_part.test
+++ b/storage/spider/mysql-test/spider/bg/t/direct_aggregate_part.test
@@ -1,192 +1,192 @@
---disable_warnings
---disable_query_log
---disable_result_log
---source test_init.inc
---enable_result_log
---enable_query_log
-if (!$HAVE_PARTITION)
-{
- --disable_query_log
- --disable_result_log
- --source test_deinit.inc
- --enable_result_log
- --enable_query_log
- --enable_warnings
- skip Test requires partitioning;
-}
-
---echo
---echo drop and create databases
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- CREATE DATABASE auto_test_remote;
- USE auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- CREATE DATABASE auto_test_remote2;
- USE auto_test_remote2;
-}
---enable_warnings
-
---echo
---echo test select 1
---connection master_1
-SELECT 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- SELECT 1;
- --connection child2_2
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo with partition test
-if ($HAVE_PARTITION)
-{
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_2_DROP_TABLES;
- echo CHILD2_2_CREATE_TABLES;
- }
- --disable_warnings
- eval $CHILD2_2_DROP_TABLES;
- --enable_warnings
- eval $CHILD2_2_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_TABLES2;
- echo CHILD2_1_CREATE_TABLES2;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES2;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- --disable_query_log
- echo CREATE TABLE ta_l2 (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
- ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1;
- eval CREATE TABLE ta_l2 (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
- ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1;
- INSERT INTO ta_l2 (a, b, c) VALUES
- (1, 'a', '2008-08-01 10:21:39'),
- (2, 'b', '2000-01-01 00:00:00'),
- (3, 'e', '2007-06-04 20:03:11'),
- (4, 'd', '2003-11-30 05:01:03'),
- (5, 'c', '2001-12-31 23:59:59');
- --enable_query_log
- eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
- SELECT COUNT(*) FROM ta_l2;
- eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
- SELECT MAX(a) FROM ta_l2;
- eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
- SELECT MIN(a) FROM ta_l2;
- eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
- SELECT MAX(a) FROM ta_l2 WHERE a < 5;
- eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
- SELECT MIN(a) FROM ta_l2 WHERE a > 1;
- eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %';
- }
- eval $CHILD2_2_SELECT_TABLES;
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %';
- }
- eval $CHILD2_1_SELECT_TABLES2;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
-}
-
---echo
---echo deinit
---disable_warnings
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
-}
---disable_query_log
---disable_result_log
---source test_deinit.inc
---enable_result_log
---enable_query_log
---enable_warnings
---echo
---echo end of test
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--enable_result_log
+--enable_query_log
+if (!$HAVE_PARTITION)
+{
+ --disable_query_log
+ --disable_result_log
+ --source test_deinit.inc
+ --enable_result_log
+ --enable_query_log
+ --enable_warnings
+ skip Test requires partitioning;
+}
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ --connection child2_2
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo with partition test
+if ($HAVE_PARTITION)
+{
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_DROP_TABLES;
+ echo CHILD2_2_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_2_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_2_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES2;
+ echo CHILD2_1_CREATE_TABLES2;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES2;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ --disable_query_log
+ echo CREATE TABLE ta_l2 (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1;
+ eval CREATE TABLE ta_l2 (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1;
+ INSERT INTO ta_l2 (a, b, c) VALUES
+ (1, 'a', '2008-08-01 10:21:39'),
+ (2, 'b', '2000-01-01 00:00:00'),
+ (3, 'e', '2007-06-04 20:03:11'),
+ (4, 'd', '2003-11-30 05:01:03'),
+ (5, 'c', '2001-12-31 23:59:59');
+ --enable_query_log
+ eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+ SELECT COUNT(*) FROM ta_l2;
+ eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+ SELECT MAX(a) FROM ta_l2;
+ eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+ SELECT MIN(a) FROM ta_l2;
+ eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+ SELECT MAX(a) FROM ta_l2 WHERE a < 5;
+ eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+ SELECT MIN(a) FROM ta_l2 WHERE a > 1;
+ eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %';
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %';
+ }
+ eval $CHILD2_1_SELECT_TABLES2;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+}
+--disable_query_log
+--disable_result_log
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bg/t/have_partition.inc b/storage/spider/mysql-test/spider/bg/t/have_partition.inc
index 573c76ab43b..b6e699475db 100644
--- a/storage/spider/mysql-test/spider/bg/t/have_partition.inc
+++ b/storage/spider/mysql-test/spider/bg/t/have_partition.inc
@@ -1,7 +1,7 @@
-let $HAVE_PARTITION= 0;
-if (`SELECT count(*) FROM information_schema.plugins WHERE
- plugin_status = 'ACTIVE' AND
- plugin_name = 'partition'`)
-{
- let $HAVE_PARTITION= 1;
-}
+let $HAVE_PARTITION= 0;
+if (`SELECT count(*) FROM information_schema.plugins WHERE
+ plugin_status = 'ACTIVE' AND
+ plugin_name = 'partition'`)
+{
+ let $HAVE_PARTITION= 1;
+}
diff --git a/storage/spider/mysql-test/spider/bg/t/have_trigger.inc b/storage/spider/mysql-test/spider/bg/t/have_trigger.inc
index 10c0871dd5f..32de484b388 100644
--- a/storage/spider/mysql-test/spider/bg/t/have_trigger.inc
+++ b/storage/spider/mysql-test/spider/bg/t/have_trigger.inc
@@ -1,2 +1,2 @@
-let $HAVE_TRIGGER= `SELECT COUNT(*) FROM information_schema.tables
- WHERE TABLE_SCHEMA = 'information_schema' AND TABLE_NAME = 'TRIGGERS'`;
+let $HAVE_TRIGGER= `SELECT COUNT(*) FROM information_schema.tables
+ WHERE TABLE_SCHEMA = 'information_schema' AND TABLE_NAME = 'TRIGGERS'`;
diff --git a/storage/spider/mysql-test/spider/bg/t/spider3_fixes.test b/storage/spider/mysql-test/spider/bg/t/spider3_fixes.test
index 7530ce97837..13fa6f5fa39 100644
--- a/storage/spider/mysql-test/spider/bg/t/spider3_fixes.test
+++ b/storage/spider/mysql-test/spider/bg/t/spider3_fixes.test
@@ -1,292 +1,292 @@
-# This test tests for Spider 3.0's bug fixes
-source include/have_log_bin.inc;
---disable_warnings
---disable_query_log
---disable_result_log
---source test_init.inc
---source slave_test_init.inc
---enable_result_log
---enable_query_log
-
---echo
---echo drop and create databases
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-if ($USE_REPLICATION)
-{
- --connection slave1_1
- DROP DATABASE IF EXISTS auto_test_local;
- CREATE DATABASE auto_test_local;
- USE auto_test_local;
-}
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- CREATE DATABASE auto_test_remote;
- USE auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- CREATE DATABASE auto_test_remote2;
- USE auto_test_remote2;
-}
---enable_warnings
-
---echo
---echo test select 1
---connection master_1
-SELECT 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- SELECT 1;
- --connection child2_2
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
-
---echo
---echo 3.1
---echo auto_increment
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_INCREMENT_TABLES1;
- echo CHILD2_1_CREATE_INCREMENT_TABLES1;
- echo CHILD2_1_AUTO_INCREMENT_INCREMENT2;
- echo CHILD2_1_AUTO_INCREMENT_OFFSET2;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_INCREMENT_TABLES1;
- --enable_warnings
- eval $CHILD2_1_CREATE_INCREMENT_TABLES1;
- eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2;
- eval $CHILD2_1_AUTO_INCREMENT_OFFSET2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-if ($USE_REPLICATION)
-{
- save_master_pos;
- --connection slave1_1
- sync_with_master;
- --connection master_1
- --disable_query_log
- SET SESSION sql_log_bin= 0;
- --enable_query_log
-}
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
---enable_warnings
---disable_query_log
-echo CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1;
-echo CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1;
-echo MASTER_1_AUTO_INCREMENT_INCREMENT2;
-echo MASTER_1_AUTO_INCREMENT_OFFSET2;
-eval CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_1;
-eval CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_1;
-eval $MASTER_1_AUTO_INCREMENT_INCREMENT2;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET2;
-if ($USE_REPLICATION)
-{
- SET SESSION sql_log_bin= 1;
- --connection slave1_1
- --disable_warnings
- DROP TABLE IF EXISTS t1, t2;
- --enable_warnings
- echo CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1;
- echo CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1;
- eval CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_1;
- eval CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_1;
- --connection master_1
-}
---enable_query_log
-INSERT INTO t1 () VALUES ();
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t1;
-INSERT INTO t2 () VALUES ();
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t2;
---disable_query_log
-echo MASTER_1_AUTO_INCREMENT_OFFSET3;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
---enable_query_log
-INSERT INTO t1 (id) VALUES (null);
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t1;
---disable_query_log
-echo MASTER_1_AUTO_INCREMENT_OFFSET4;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
---enable_query_log
-INSERT INTO t2 (id) VALUES (null);
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t2;
---disable_query_log
-echo MASTER_1_AUTO_INCREMENT_OFFSET3;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
---enable_query_log
-INSERT INTO t1 () VALUES (),(),(),();
-SELECT LAST_INSERT_ID();
-SELECT id FROM t1 ORDER BY id;
---disable_query_log
-echo MASTER_1_AUTO_INCREMENT_OFFSET4;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
---enable_query_log
-INSERT INTO t2 () VALUES (),(),(),();
-SELECT LAST_INSERT_ID();
-SELECT id FROM t2 ORDER BY id;
-TRUNCATE TABLE t1;
-TRUNCATE TABLE t2;
-INSERT INTO t1 () VALUES (),(),(),();
-SELECT LAST_INSERT_ID();
-SELECT id FROM t1 ORDER BY id;
-INSERT INTO t2 () VALUES (),(),(),();
-SELECT LAST_INSERT_ID();
-SELECT id FROM t2 ORDER BY id;
-SET INSERT_ID=5000;
---disable_query_log
-echo MASTER_1_AUTO_INCREMENT_OFFSET3;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
---enable_query_log
-INSERT INTO t1 () VALUES ();
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t1;
---disable_query_log
-echo MASTER_1_AUTO_INCREMENT_OFFSET4;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
---enable_query_log
-INSERT INTO t2 () VALUES ();
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t2;
-INSERT INTO t1 (id) VALUES (10000);
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t1;
-INSERT INTO t2 (id) VALUES (1000);
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t2;
-if ($USE_REPLICATION)
-{
- save_master_pos;
- --connection slave1_1
- sync_with_master;
- SELECT id FROM t1 ORDER BY id;
- --connection master_1
- --disable_query_log
- SET SESSION sql_log_bin= 0;
- --enable_query_log
-}
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %';
- }
- eval $CHILD2_1_SELECT_INCREMENT_TABLES1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_AUTO_INCREMENT_INCREMENT1;
- echo CHILD2_1_AUTO_INCREMENT_OFFSET1;
- }
- eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1;
- eval $CHILD2_1_AUTO_INCREMENT_OFFSET1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
-
---echo
---echo deinit
---disable_warnings
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-if ($USE_REPLICATION)
-{
- --connection slave1_1
- DROP DATABASE IF EXISTS auto_test_local;
-}
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
-}
---disable_query_log
---disable_result_log
---source slave_test_deinit.inc
---source test_deinit.inc
---enable_result_log
---enable_query_log
---enable_warnings
---echo
---echo end of test
+# This test tests for Spider 3.0's bug fixes
+source include/have_log_bin.inc;
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--source slave_test_init.inc
+--enable_result_log
+--enable_query_log
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_REPLICATION)
+{
+ --connection slave1_1
+ DROP DATABASE IF EXISTS auto_test_local;
+ CREATE DATABASE auto_test_local;
+ USE auto_test_local;
+}
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ --connection child2_2
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+
+--echo
+--echo 3.1
+--echo auto_increment
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_INCREMENT_TABLES1;
+ echo CHILD2_1_CREATE_INCREMENT_TABLES1;
+ echo CHILD2_1_AUTO_INCREMENT_INCREMENT2;
+ echo CHILD2_1_AUTO_INCREMENT_OFFSET2;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_INCREMENT_TABLES1;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_INCREMENT_TABLES1;
+ eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2;
+ eval $CHILD2_1_AUTO_INCREMENT_OFFSET2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+if ($USE_REPLICATION)
+{
+ save_master_pos;
+ --connection slave1_1
+ sync_with_master;
+ --connection master_1
+ --disable_query_log
+ SET SESSION sql_log_bin= 0;
+ --enable_query_log
+}
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1;
+echo CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1;
+echo MASTER_1_AUTO_INCREMENT_INCREMENT2;
+echo MASTER_1_AUTO_INCREMENT_OFFSET2;
+eval CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_1;
+eval CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_1;
+eval $MASTER_1_AUTO_INCREMENT_INCREMENT2;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET2;
+if ($USE_REPLICATION)
+{
+ SET SESSION sql_log_bin= 1;
+ --connection slave1_1
+ --disable_warnings
+ DROP TABLE IF EXISTS t1, t2;
+ --enable_warnings
+ echo CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1;
+ echo CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1;
+ eval CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_1;
+ eval CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_1;
+ --connection master_1
+}
+--enable_query_log
+INSERT INTO t1 () VALUES ();
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t1;
+INSERT INTO t2 () VALUES ();
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t2;
+--disable_query_log
+echo MASTER_1_AUTO_INCREMENT_OFFSET3;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
+--enable_query_log
+INSERT INTO t1 (id) VALUES (null);
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t1;
+--disable_query_log
+echo MASTER_1_AUTO_INCREMENT_OFFSET4;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
+--enable_query_log
+INSERT INTO t2 (id) VALUES (null);
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t2;
+--disable_query_log
+echo MASTER_1_AUTO_INCREMENT_OFFSET3;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
+--enable_query_log
+INSERT INTO t1 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+SELECT id FROM t1 ORDER BY id;
+--disable_query_log
+echo MASTER_1_AUTO_INCREMENT_OFFSET4;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
+--enable_query_log
+INSERT INTO t2 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+SELECT id FROM t2 ORDER BY id;
+TRUNCATE TABLE t1;
+TRUNCATE TABLE t2;
+INSERT INTO t1 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+SELECT id FROM t1 ORDER BY id;
+INSERT INTO t2 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+SELECT id FROM t2 ORDER BY id;
+SET INSERT_ID=5000;
+--disable_query_log
+echo MASTER_1_AUTO_INCREMENT_OFFSET3;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
+--enable_query_log
+INSERT INTO t1 () VALUES ();
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t1;
+--disable_query_log
+echo MASTER_1_AUTO_INCREMENT_OFFSET4;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
+--enable_query_log
+INSERT INTO t2 () VALUES ();
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t2;
+INSERT INTO t1 (id) VALUES (10000);
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t1;
+INSERT INTO t2 (id) VALUES (1000);
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t2;
+if ($USE_REPLICATION)
+{
+ save_master_pos;
+ --connection slave1_1
+ sync_with_master;
+ SELECT id FROM t1 ORDER BY id;
+ --connection master_1
+ --disable_query_log
+ SET SESSION sql_log_bin= 0;
+ --enable_query_log
+}
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %';
+ }
+ eval $CHILD2_1_SELECT_INCREMENT_TABLES1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_AUTO_INCREMENT_INCREMENT1;
+ echo CHILD2_1_AUTO_INCREMENT_OFFSET1;
+ }
+ eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1;
+ eval $CHILD2_1_AUTO_INCREMENT_OFFSET1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_REPLICATION)
+{
+ --connection slave1_1
+ DROP DATABASE IF EXISTS auto_test_local;
+}
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+}
+--disable_query_log
+--disable_result_log
+--source slave_test_deinit.inc
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bg/t/spider3_fixes_part.test b/storage/spider/mysql-test/spider/bg/t/spider3_fixes_part.test
index f25f000d80c..3288c490a46 100644
--- a/storage/spider/mysql-test/spider/bg/t/spider3_fixes_part.test
+++ b/storage/spider/mysql-test/spider/bg/t/spider3_fixes_part.test
@@ -1,345 +1,345 @@
-# This test tests for Spider 3.0's bug fixes
-source include/have_log_bin.inc;
---disable_warnings
---disable_query_log
---disable_result_log
---source test_init.inc
---source slave_test_init.inc
---enable_result_log
---enable_query_log
-if (!$HAVE_PARTITION)
-{
- --disable_query_log
- --disable_result_log
- --source slave_test_deinit.inc
- --source test_deinit.inc
- --enable_result_log
- --enable_query_log
- --enable_warnings
- skip Test requires partitioning;
-}
-
---echo
---echo drop and create databases
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-if ($USE_REPLICATION)
-{
- --connection slave1_1
- DROP DATABASE IF EXISTS auto_test_local;
- CREATE DATABASE auto_test_local;
- USE auto_test_local;
-}
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- CREATE DATABASE auto_test_remote;
- USE auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- CREATE DATABASE auto_test_remote2;
- USE auto_test_remote2;
-}
---enable_warnings
-
---echo
---echo test select 1
---connection master_1
-SELECT 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- SELECT 1;
- --connection child2_2
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
-
---echo auto_increment with partition
-if ($HAVE_PARTITION)
-{
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_INCREMENT_TABLES1;
- echo CHILD2_1_CREATE_INCREMENT_TABLES1;
- echo CHILD2_1_AUTO_INCREMENT_INCREMENT2;
- echo CHILD2_1_AUTO_INCREMENT_OFFSET2;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_INCREMENT_TABLES1;
- --enable_warnings
- eval $CHILD2_1_CREATE_INCREMENT_TABLES1;
- eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2;
- eval $CHILD2_1_AUTO_INCREMENT_OFFSET2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_2
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_2_DROP_INCREMENT_TABLES1;
- echo CHILD2_2_CREATE_INCREMENT_TABLES1;
- echo CHILD2_2_AUTO_INCREMENT_INCREMENT2;
- echo CHILD2_2_AUTO_INCREMENT_OFFSET2;
- }
- --disable_warnings
- eval $CHILD2_2_DROP_INCREMENT_TABLES1;
- --enable_warnings
- eval $CHILD2_2_CREATE_INCREMENT_TABLES1;
- eval $CHILD2_2_AUTO_INCREMENT_INCREMENT2;
- eval $CHILD2_2_AUTO_INCREMENT_OFFSET2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- if ($USE_REPLICATION)
- {
- save_master_pos;
- --connection slave1_1
- sync_with_master;
- --connection master_1
- --disable_query_log
- SET SESSION sql_log_bin= 0;
- --enable_query_log
- }
- --disable_warnings
- DROP TABLE IF EXISTS t1, t2;
- --enable_warnings
- --disable_query_log
- echo CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1;
- echo CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1;
- echo MASTER_1_AUTO_INCREMENT_INCREMENT2;
- echo MASTER_1_AUTO_INCREMENT_OFFSET2;
- eval CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_P_1;
- eval CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_P_1;
- eval $MASTER_1_AUTO_INCREMENT_INCREMENT2;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET2;
- if ($USE_REPLICATION)
- {
- SET SESSION sql_log_bin= 1;
- --connection slave1_1
- --disable_warnings
- DROP TABLE IF EXISTS t1, t2;
- --enable_warnings
- echo CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1;
- echo CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1;
- eval CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1;
- eval CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1;
- --connection master_1
- }
- --enable_query_log
- INSERT INTO t1 () VALUES ();
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t1;
- INSERT INTO t2 () VALUES ();
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t2;
- --disable_query_log
- echo MASTER_1_AUTO_INCREMENT_OFFSET3;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
- --enable_query_log
- INSERT INTO t1 (id) VALUES (null);
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t1;
- --disable_query_log
- echo MASTER_1_AUTO_INCREMENT_OFFSET4;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
- --enable_query_log
- INSERT INTO t2 (id) VALUES (null);
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t2;
- --disable_query_log
- echo MASTER_1_AUTO_INCREMENT_OFFSET3;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
- --enable_query_log
- INSERT INTO t1 () VALUES (),(),(),();
- SELECT LAST_INSERT_ID();
- SELECT id FROM t1 ORDER BY id;
- --disable_query_log
- echo MASTER_1_AUTO_INCREMENT_OFFSET4;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
- --enable_query_log
- INSERT INTO t2 () VALUES (),(),(),();
- SELECT LAST_INSERT_ID();
- SELECT id FROM t2 ORDER BY id;
- TRUNCATE TABLE t1;
- TRUNCATE TABLE t2;
- INSERT INTO t1 () VALUES (),(),(),();
- SELECT LAST_INSERT_ID();
- SELECT id FROM t1 ORDER BY id;
- INSERT INTO t2 () VALUES (),(),(),();
- SELECT LAST_INSERT_ID();
- SELECT id FROM t2 ORDER BY id;
- SET INSERT_ID=5000;
- --disable_query_log
- echo MASTER_1_AUTO_INCREMENT_OFFSET3;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
- --enable_query_log
- INSERT INTO t1 () VALUES ();
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t1;
- --disable_query_log
- echo MASTER_1_AUTO_INCREMENT_OFFSET4;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
- --enable_query_log
- INSERT INTO t2 () VALUES ();
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t2;
- INSERT INTO t1 (id) VALUES (10000);
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t1;
- INSERT INTO t2 (id) VALUES (1000);
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t2;
- if ($USE_REPLICATION)
- {
- save_master_pos;
- --connection slave1_1
- sync_with_master;
- SELECT id FROM t1 ORDER BY id;
- --connection master_1
- --disable_query_log
- SET SESSION sql_log_bin= 0;
- --enable_query_log
- }
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %';
- }
- eval $CHILD2_1_SELECT_INCREMENT_TABLES1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_AUTO_INCREMENT_INCREMENT1;
- echo CHILD2_1_AUTO_INCREMENT_OFFSET1;
- }
- eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1;
- eval $CHILD2_1_AUTO_INCREMENT_OFFSET1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %';
- }
- eval $CHILD2_2_SELECT_INCREMENT_TABLES1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_2_AUTO_INCREMENT_INCREMENT1;
- echo CHILD2_2_AUTO_INCREMENT_OFFSET1;
- }
- eval $CHILD2_2_AUTO_INCREMENT_INCREMENT1;
- eval $CHILD2_2_AUTO_INCREMENT_OFFSET1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
-}
-
-
---echo
---echo deinit
---disable_warnings
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-if ($USE_REPLICATION)
-{
- --connection slave1_1
- DROP DATABASE IF EXISTS auto_test_local;
-}
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
-}
---disable_query_log
---disable_result_log
---source slave_test_deinit.inc
---source test_deinit.inc
---enable_result_log
---enable_query_log
---enable_warnings
---echo
---echo end of test
+# This test tests for Spider 3.0's bug fixes
+source include/have_log_bin.inc;
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--source slave_test_init.inc
+--enable_result_log
+--enable_query_log
+if (!$HAVE_PARTITION)
+{
+ --disable_query_log
+ --disable_result_log
+ --source slave_test_deinit.inc
+ --source test_deinit.inc
+ --enable_result_log
+ --enable_query_log
+ --enable_warnings
+ skip Test requires partitioning;
+}
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_REPLICATION)
+{
+ --connection slave1_1
+ DROP DATABASE IF EXISTS auto_test_local;
+ CREATE DATABASE auto_test_local;
+ USE auto_test_local;
+}
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ --connection child2_2
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+
+--echo auto_increment with partition
+if ($HAVE_PARTITION)
+{
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_INCREMENT_TABLES1;
+ echo CHILD2_1_CREATE_INCREMENT_TABLES1;
+ echo CHILD2_1_AUTO_INCREMENT_INCREMENT2;
+ echo CHILD2_1_AUTO_INCREMENT_OFFSET2;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_INCREMENT_TABLES1;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_INCREMENT_TABLES1;
+ eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2;
+ eval $CHILD2_1_AUTO_INCREMENT_OFFSET2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_DROP_INCREMENT_TABLES1;
+ echo CHILD2_2_CREATE_INCREMENT_TABLES1;
+ echo CHILD2_2_AUTO_INCREMENT_INCREMENT2;
+ echo CHILD2_2_AUTO_INCREMENT_OFFSET2;
+ }
+ --disable_warnings
+ eval $CHILD2_2_DROP_INCREMENT_TABLES1;
+ --enable_warnings
+ eval $CHILD2_2_CREATE_INCREMENT_TABLES1;
+ eval $CHILD2_2_AUTO_INCREMENT_INCREMENT2;
+ eval $CHILD2_2_AUTO_INCREMENT_OFFSET2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ if ($USE_REPLICATION)
+ {
+ save_master_pos;
+ --connection slave1_1
+ sync_with_master;
+ --connection master_1
+ --disable_query_log
+ SET SESSION sql_log_bin= 0;
+ --enable_query_log
+ }
+ --disable_warnings
+ DROP TABLE IF EXISTS t1, t2;
+ --enable_warnings
+ --disable_query_log
+ echo CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1;
+ echo CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1;
+ echo MASTER_1_AUTO_INCREMENT_INCREMENT2;
+ echo MASTER_1_AUTO_INCREMENT_OFFSET2;
+ eval CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_P_1;
+ eval CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_P_1;
+ eval $MASTER_1_AUTO_INCREMENT_INCREMENT2;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET2;
+ if ($USE_REPLICATION)
+ {
+ SET SESSION sql_log_bin= 1;
+ --connection slave1_1
+ --disable_warnings
+ DROP TABLE IF EXISTS t1, t2;
+ --enable_warnings
+ echo CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1;
+ echo CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1;
+ eval CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1;
+ eval CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1;
+ --connection master_1
+ }
+ --enable_query_log
+ INSERT INTO t1 () VALUES ();
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t1;
+ INSERT INTO t2 () VALUES ();
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t2;
+ --disable_query_log
+ echo MASTER_1_AUTO_INCREMENT_OFFSET3;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
+ --enable_query_log
+ INSERT INTO t1 (id) VALUES (null);
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t1;
+ --disable_query_log
+ echo MASTER_1_AUTO_INCREMENT_OFFSET4;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
+ --enable_query_log
+ INSERT INTO t2 (id) VALUES (null);
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t2;
+ --disable_query_log
+ echo MASTER_1_AUTO_INCREMENT_OFFSET3;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
+ --enable_query_log
+ INSERT INTO t1 () VALUES (),(),(),();
+ SELECT LAST_INSERT_ID();
+ SELECT id FROM t1 ORDER BY id;
+ --disable_query_log
+ echo MASTER_1_AUTO_INCREMENT_OFFSET4;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
+ --enable_query_log
+ INSERT INTO t2 () VALUES (),(),(),();
+ SELECT LAST_INSERT_ID();
+ SELECT id FROM t2 ORDER BY id;
+ TRUNCATE TABLE t1;
+ TRUNCATE TABLE t2;
+ INSERT INTO t1 () VALUES (),(),(),();
+ SELECT LAST_INSERT_ID();
+ SELECT id FROM t1 ORDER BY id;
+ INSERT INTO t2 () VALUES (),(),(),();
+ SELECT LAST_INSERT_ID();
+ SELECT id FROM t2 ORDER BY id;
+ SET INSERT_ID=5000;
+ --disable_query_log
+ echo MASTER_1_AUTO_INCREMENT_OFFSET3;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
+ --enable_query_log
+ INSERT INTO t1 () VALUES ();
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t1;
+ --disable_query_log
+ echo MASTER_1_AUTO_INCREMENT_OFFSET4;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
+ --enable_query_log
+ INSERT INTO t2 () VALUES ();
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t2;
+ INSERT INTO t1 (id) VALUES (10000);
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t1;
+ INSERT INTO t2 (id) VALUES (1000);
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t2;
+ if ($USE_REPLICATION)
+ {
+ save_master_pos;
+ --connection slave1_1
+ sync_with_master;
+ SELECT id FROM t1 ORDER BY id;
+ --connection master_1
+ --disable_query_log
+ SET SESSION sql_log_bin= 0;
+ --enable_query_log
+ }
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %';
+ }
+ eval $CHILD2_1_SELECT_INCREMENT_TABLES1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_AUTO_INCREMENT_INCREMENT1;
+ echo CHILD2_1_AUTO_INCREMENT_OFFSET1;
+ }
+ eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1;
+ eval $CHILD2_1_AUTO_INCREMENT_OFFSET1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %';
+ }
+ eval $CHILD2_2_SELECT_INCREMENT_TABLES1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_AUTO_INCREMENT_INCREMENT1;
+ echo CHILD2_2_AUTO_INCREMENT_OFFSET1;
+ }
+ eval $CHILD2_2_AUTO_INCREMENT_INCREMENT1;
+ eval $CHILD2_2_AUTO_INCREMENT_OFFSET1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+}
+
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_REPLICATION)
+{
+ --connection slave1_1
+ DROP DATABASE IF EXISTS auto_test_local;
+}
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+}
+--disable_query_log
+--disable_result_log
+--source slave_test_deinit.inc
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/handler/include/ha_deinit_child3_1.inc b/storage/spider/mysql-test/spider/handler/include/ha_deinit_child3_1.inc
index 8fd2ff8a777..c19e376d10a 100644
--- a/storage/spider/mysql-test/spider/handler/include/ha_deinit_child3_1.inc
+++ b/storage/spider/mysql-test/spider/handler/include/ha_deinit_child3_1.inc
@@ -1 +1 @@
---source ../../include/deinit_spider.inc
+--source ../../include/deinit_spider.inc
diff --git a/storage/spider/mysql-test/spider/handler/include/ha_deinit_child3_2.inc b/storage/spider/mysql-test/spider/handler/include/ha_deinit_child3_2.inc
index 8fd2ff8a777..c19e376d10a 100644
--- a/storage/spider/mysql-test/spider/handler/include/ha_deinit_child3_2.inc
+++ b/storage/spider/mysql-test/spider/handler/include/ha_deinit_child3_2.inc
@@ -1 +1 @@
---source ../../include/deinit_spider.inc
+--source ../../include/deinit_spider.inc
diff --git a/storage/spider/mysql-test/spider/handler/include/ha_deinit_child3_3.inc b/storage/spider/mysql-test/spider/handler/include/ha_deinit_child3_3.inc
index 8fd2ff8a777..c19e376d10a 100644
--- a/storage/spider/mysql-test/spider/handler/include/ha_deinit_child3_3.inc
+++ b/storage/spider/mysql-test/spider/handler/include/ha_deinit_child3_3.inc
@@ -1 +1 @@
---source ../../include/deinit_spider.inc
+--source ../../include/deinit_spider.inc
diff --git a/storage/spider/mysql-test/spider/handler/include/ha_init_child2_1.inc b/storage/spider/mysql-test/spider/handler/include/ha_init_child2_1.inc
index 59c0175d349..2684829408d 100644
--- a/storage/spider/mysql-test/spider/handler/include/ha_init_child2_1.inc
+++ b/storage/spider/mysql-test/spider/handler/include/ha_init_child2_1.inc
@@ -1,8 +1,8 @@
-let $CHILD2_1_HA_AS_DROP_TABLES=
- $CHILD2_1_DROP_TABLES;
-let $CHILD2_1_HA_AS_CREATE_TABLES=
- $CHILD2_1_CREATE_TABLES;
-let $CHILD2_1_HA_AS_DROP_TABLES2=
- $CHILD2_1_DROP_TABLES2;
-let $CHILD2_1_HA_AS_CREATE_TABLES2=
- $CHILD2_1_CREATE_TABLES2;
+let $CHILD2_1_HA_AS_DROP_TABLES=
+ $CHILD2_1_DROP_TABLES;
+let $CHILD2_1_HA_AS_CREATE_TABLES=
+ $CHILD2_1_CREATE_TABLES;
+let $CHILD2_1_HA_AS_DROP_TABLES2=
+ $CHILD2_1_DROP_TABLES2;
+let $CHILD2_1_HA_AS_CREATE_TABLES2=
+ $CHILD2_1_CREATE_TABLES2;
diff --git a/storage/spider/mysql-test/spider/handler/include/ha_init_child2_2.inc b/storage/spider/mysql-test/spider/handler/include/ha_init_child2_2.inc
index 90d27ed704d..205eaa6fe35 100644
--- a/storage/spider/mysql-test/spider/handler/include/ha_init_child2_2.inc
+++ b/storage/spider/mysql-test/spider/handler/include/ha_init_child2_2.inc
@@ -1,4 +1,4 @@
-let $CHILD2_2_HA_DROP_TABLES=
- $CHILD2_2_DROP_TABLES;
-let $CHILD2_2_HA_CREATE_TABLES=
- $CHILD2_2_CREATE_TABLES;
+let $CHILD2_2_HA_DROP_TABLES=
+ $CHILD2_2_DROP_TABLES;
+let $CHILD2_2_HA_CREATE_TABLES=
+ $CHILD2_2_CREATE_TABLES;
diff --git a/storage/spider/mysql-test/spider/handler/include/ha_init_child2_3.inc b/storage/spider/mysql-test/spider/handler/include/ha_init_child2_3.inc
index 11abf112b1f..55cb858372c 100644
--- a/storage/spider/mysql-test/spider/handler/include/ha_init_child2_3.inc
+++ b/storage/spider/mysql-test/spider/handler/include/ha_init_child2_3.inc
@@ -1,4 +1,4 @@
-let $CHILD2_3_HA_DROP_TABLES=
- $CHILD2_3_DROP_TABLES;
-let $CHILD2_3_HA_CREATE_TABLES=
- $CHILD2_3_CREATE_TABLES;
+let $CHILD2_3_HA_DROP_TABLES=
+ $CHILD2_3_DROP_TABLES;
+let $CHILD2_3_HA_CREATE_TABLES=
+ $CHILD2_3_CREATE_TABLES;
diff --git a/storage/spider/mysql-test/spider/handler/include/ha_init_child3_1.inc b/storage/spider/mysql-test/spider/handler/include/ha_init_child3_1.inc
index 56de7df4e52..3ac4f97b1e0 100644
--- a/storage/spider/mysql-test/spider/handler/include/ha_init_child3_1.inc
+++ b/storage/spider/mysql-test/spider/handler/include/ha_init_child3_1.inc
@@ -1,140 +1,140 @@
---let $CHILD3_1_ENGINE_TYPE=Spider
---let $CHILD3_1_ENGINE=ENGINE=Spider
---source ../../include/init_spider.inc
-eval INSERT INTO mysql.spider_link_mon_servers
-(db_name, table_name, link_id, sid, server, scheme, host, port, socket,
- username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key,
- ssl_verify_server_cert, default_file, default_group) VALUES
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
-let $CHILD3_1_CHECK_LINK_STATUS=
- SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
- ORDER BY db_name, table_name, link_id;
-let $CHILD3_1_CHECK_LINK_FAILED_LOG=
- SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
-let $CHILD3_1_SET_RECOVERY_STATUS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2", lst "0 2"';
-let $CHILD3_1_SET_OK_STATUS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2", lst "0 1"';
-let $CHILD3_1_SET_OK_STATUS_AS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2", lst "1 0"';
-
-let $CHILD3_1_DROP_TABLES_HA_2_1=
- DROP TABLE IF EXISTS ta_l;
-if ($VERSION_COMPILE_OS_WIN)
-{
- let $CHILD3_1_CREATE_TABLES_HA_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
- COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2"';
- let $CHILD3_1_CREATE_TABLES_HA_AS_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
- COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2"';
-}
-if (!$VERSION_COMPILE_OS_WIN)
-{
- let $CHILD3_1_CREATE_TABLES_HA_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
- COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2"';
- let $CHILD3_1_CREATE_TABLES_HA_AS_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
- COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2"';
-}
-let $CHILD3_1_DROP_TABLES_HA_P_2_1=
- DROP TABLE IF EXISTS ta_l2;
-let $CHILD3_1_CREATE_TABLES_HA_P_2_1=
- CREATE TABLE ta_l2 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
- COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"'
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001"'
- );
-let $CHILD3_1_CREATE_TABLES_HA_AS_P_2_1=
- CREATE TABLE ta_l2 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
- COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"'
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001"'
- );
-let $CHILD3_1_SET_RECOVERY_STATUS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 2"'
- );
-let $CHILD3_1_SET_OK_STATUS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 1"'
- );
-let $CHILD3_1_SET_OK_STATUS_AS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "1 0"'
- );
+--let $CHILD3_1_ENGINE_TYPE=Spider
+--let $CHILD3_1_ENGINE=ENGINE=Spider
+--source ../../include/init_spider.inc
+eval INSERT INTO mysql.spider_link_mon_servers
+(db_name, table_name, link_id, sid, server, scheme, host, port, socket,
+ username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key,
+ ssl_verify_server_cert, default_file, default_group) VALUES
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
+let $CHILD3_1_CHECK_LINK_STATUS=
+ SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
+ ORDER BY db_name, table_name, link_id;
+let $CHILD3_1_CHECK_LINK_FAILED_LOG=
+ SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
+let $CHILD3_1_SET_RECOVERY_STATUS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 2"';
+let $CHILD3_1_SET_OK_STATUS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 1"';
+let $CHILD3_1_SET_OK_STATUS_AS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2", lst "1 0"';
+
+let $CHILD3_1_DROP_TABLES_HA_2_1=
+ DROP TABLE IF EXISTS ta_l;
+if ($VERSION_COMPILE_OS_WIN)
+{
+ let $CHILD3_1_CREATE_TABLES_HA_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
+ COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2"';
+ let $CHILD3_1_CREATE_TABLES_HA_AS_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
+ COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2"';
+}
+if (!$VERSION_COMPILE_OS_WIN)
+{
+ let $CHILD3_1_CREATE_TABLES_HA_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
+ COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2"';
+ let $CHILD3_1_CREATE_TABLES_HA_AS_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
+ COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2"';
+}
+let $CHILD3_1_DROP_TABLES_HA_P_2_1=
+ DROP TABLE IF EXISTS ta_l2;
+let $CHILD3_1_CREATE_TABLES_HA_P_2_1=
+ CREATE TABLE ta_l2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
+ COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"'
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001"'
+ );
+let $CHILD3_1_CREATE_TABLES_HA_AS_P_2_1=
+ CREATE TABLE ta_l2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
+ COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"'
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001"'
+ );
+let $CHILD3_1_SET_RECOVERY_STATUS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 2"'
+ );
+let $CHILD3_1_SET_OK_STATUS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 1"'
+ );
+let $CHILD3_1_SET_OK_STATUS_AS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "1 0"'
+ );
diff --git a/storage/spider/mysql-test/spider/handler/include/ha_init_child3_2.inc b/storage/spider/mysql-test/spider/handler/include/ha_init_child3_2.inc
index fdb3a84cca7..cf47099f439 100644
--- a/storage/spider/mysql-test/spider/handler/include/ha_init_child3_2.inc
+++ b/storage/spider/mysql-test/spider/handler/include/ha_init_child3_2.inc
@@ -1,140 +1,140 @@
---let $CHILD3_2_ENGINE_TYPE=Spider
---let $CHILD3_2_ENGINE=ENGINE=Spider
---source ../../include/init_spider.inc
-eval INSERT INTO mysql.spider_link_mon_servers
-(db_name, table_name, link_id, sid, server, scheme, host, port, socket,
- username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key,
- ssl_verify_server_cert, default_file, default_group) VALUES
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
-let $CHILD3_2_CHECK_LINK_STATUS=
- SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
- ORDER BY db_name, table_name, link_id;
-let $CHILD3_2_CHECK_LINK_FAILED_LOG=
- SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
-let $CHILD3_2_SET_RECOVERY_STATUS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2", lst "0 2"';
-let $CHILD3_2_SET_OK_STATUS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2", lst "0 1"';
-let $CHILD3_2_SET_OK_STATUS_AS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2", lst "1 0"';
-
-let $CHILD3_2_DROP_TABLES_HA_2_1=
- DROP TABLE IF EXISTS ta_l;
-if ($VERSION_COMPILE_OS_WIN)
-{
- let $CHILD3_2_CREATE_TABLES_HA_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
- COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2"';
- let $CHILD3_2_CREATE_TABLES_HA_AS_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
- COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2"';
-}
-if (!$VERSION_COMPILE_OS_WIN)
-{
- let $CHILD3_2_CREATE_TABLES_HA_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
- COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2"';
- let $CHILD3_2_CREATE_TABLES_HA_AS_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
- COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2"';
-}
-let $CHILD3_2_DROP_TABLES_HA_P_2_1=
- DROP TABLE IF EXISTS ta_l2;
-let $CHILD3_2_CREATE_TABLES_HA_P_2_1=
- CREATE TABLE ta_l2 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
- COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"'
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001"'
- );
-let $CHILD3_2_CREATE_TABLES_HA_AS_P_2_1=
- CREATE TABLE ta_l2 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
- COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"'
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001"'
- );
-let $CHILD3_2_SET_RECOVERY_STATUS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 2"'
- );
-let $CHILD3_2_SET_OK_STATUS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 1"'
- );
-let $CHILD3_2_SET_OK_STATUS_AS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "1 0"'
- );
+--let $CHILD3_2_ENGINE_TYPE=Spider
+--let $CHILD3_2_ENGINE=ENGINE=Spider
+--source ../../include/init_spider.inc
+eval INSERT INTO mysql.spider_link_mon_servers
+(db_name, table_name, link_id, sid, server, scheme, host, port, socket,
+ username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key,
+ ssl_verify_server_cert, default_file, default_group) VALUES
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
+let $CHILD3_2_CHECK_LINK_STATUS=
+ SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
+ ORDER BY db_name, table_name, link_id;
+let $CHILD3_2_CHECK_LINK_FAILED_LOG=
+ SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
+let $CHILD3_2_SET_RECOVERY_STATUS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 2"';
+let $CHILD3_2_SET_OK_STATUS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 1"';
+let $CHILD3_2_SET_OK_STATUS_AS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2", lst "1 0"';
+
+let $CHILD3_2_DROP_TABLES_HA_2_1=
+ DROP TABLE IF EXISTS ta_l;
+if ($VERSION_COMPILE_OS_WIN)
+{
+ let $CHILD3_2_CREATE_TABLES_HA_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
+ COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2"';
+ let $CHILD3_2_CREATE_TABLES_HA_AS_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
+ COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2"';
+}
+if (!$VERSION_COMPILE_OS_WIN)
+{
+ let $CHILD3_2_CREATE_TABLES_HA_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
+ COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2"';
+ let $CHILD3_2_CREATE_TABLES_HA_AS_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
+ COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2"';
+}
+let $CHILD3_2_DROP_TABLES_HA_P_2_1=
+ DROP TABLE IF EXISTS ta_l2;
+let $CHILD3_2_CREATE_TABLES_HA_P_2_1=
+ CREATE TABLE ta_l2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
+ COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"'
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001"'
+ );
+let $CHILD3_2_CREATE_TABLES_HA_AS_P_2_1=
+ CREATE TABLE ta_l2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
+ COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"'
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001"'
+ );
+let $CHILD3_2_SET_RECOVERY_STATUS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 2"'
+ );
+let $CHILD3_2_SET_OK_STATUS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 1"'
+ );
+let $CHILD3_2_SET_OK_STATUS_AS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "1 0"'
+ );
diff --git a/storage/spider/mysql-test/spider/handler/include/ha_init_child3_3.inc b/storage/spider/mysql-test/spider/handler/include/ha_init_child3_3.inc
index d08ff4d0d34..094d26b62c6 100644
--- a/storage/spider/mysql-test/spider/handler/include/ha_init_child3_3.inc
+++ b/storage/spider/mysql-test/spider/handler/include/ha_init_child3_3.inc
@@ -1,140 +1,140 @@
---let $CHILD3_3_ENGINE_TYPE=Spider
---let $CHILD3_3_ENGINE=ENGINE=Spider
---source ../../include/init_spider.inc
-eval INSERT INTO mysql.spider_link_mon_servers
-(db_name, table_name, link_id, sid, server, scheme, host, port, socket,
- username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key,
- ssl_verify_server_cert, default_file, default_group) VALUES
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
-let $CHILD3_3_CHECK_LINK_STATUS=
- SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
- ORDER BY db_name, table_name, link_id;
-let $CHILD3_3_CHECK_LINK_FAILED_LOG=
- SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
-let $CHILD3_3_SET_RECOVERY_STATUS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2", lst "0 2"';
-let $CHILD3_3_SET_OK_STATUS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2", lst "0 1"';
-let $CHILD3_3_SET_OK_STATUS_AS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2", lst "1 0"';
-
-let $CHILD3_3_DROP_TABLES_HA_2_1=
- DROP TABLE IF EXISTS ta_l;
-if ($VERSION_COMPILE_OS_WIN)
-{
- let $CHILD3_3_CREATE_TABLES_HA_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
- COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2"';
- let $CHILD3_3_CREATE_TABLES_HA_AS_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
- COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2"';
-}
-if (!$VERSION_COMPILE_OS_WIN)
-{
- let $CHILD3_3_CREATE_TABLES_HA_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
- COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2"';
- let $CHILD3_3_CREATE_TABLES_HA_AS_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
- COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2"';
-}
-let $CHILD3_3_DROP_TABLES_HA_P_2_1=
- DROP TABLE IF EXISTS ta_l2;
-let $CHILD3_3_CREATE_TABLES_HA_P_2_1=
- CREATE TABLE ta_l2 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
- COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"'
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001"'
- );
-let $CHILD3_3_CREATE_TABLES_HA_AS_P_2_1=
- CREATE TABLE ta_l2 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
- COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"'
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001"'
- );
-let $CHILD3_3_SET_RECOVERY_STATUS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 2"'
- );
-let $CHILD3_3_SET_OK_STATUS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 1"'
- );
-let $CHILD3_3_SET_OK_STATUS_AS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "1 0"'
- );
+--let $CHILD3_3_ENGINE_TYPE=Spider
+--let $CHILD3_3_ENGINE=ENGINE=Spider
+--source ../../include/init_spider.inc
+eval INSERT INTO mysql.spider_link_mon_servers
+(db_name, table_name, link_id, sid, server, scheme, host, port, socket,
+ username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key,
+ ssl_verify_server_cert, default_file, default_group) VALUES
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
+let $CHILD3_3_CHECK_LINK_STATUS=
+ SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
+ ORDER BY db_name, table_name, link_id;
+let $CHILD3_3_CHECK_LINK_FAILED_LOG=
+ SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
+let $CHILD3_3_SET_RECOVERY_STATUS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 2"';
+let $CHILD3_3_SET_OK_STATUS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 1"';
+let $CHILD3_3_SET_OK_STATUS_AS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2", lst "1 0"';
+
+let $CHILD3_3_DROP_TABLES_HA_2_1=
+ DROP TABLE IF EXISTS ta_l;
+if ($VERSION_COMPILE_OS_WIN)
+{
+ let $CHILD3_3_CREATE_TABLES_HA_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
+ COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2"';
+ let $CHILD3_3_CREATE_TABLES_HA_AS_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
+ COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2"';
+}
+if (!$VERSION_COMPILE_OS_WIN)
+{
+ let $CHILD3_3_CREATE_TABLES_HA_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
+ COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2"';
+ let $CHILD3_3_CREATE_TABLES_HA_AS_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
+ COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2"';
+}
+let $CHILD3_3_DROP_TABLES_HA_P_2_1=
+ DROP TABLE IF EXISTS ta_l2;
+let $CHILD3_3_CREATE_TABLES_HA_P_2_1=
+ CREATE TABLE ta_l2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
+ COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"'
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001"'
+ );
+let $CHILD3_3_CREATE_TABLES_HA_AS_P_2_1=
+ CREATE TABLE ta_l2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
+ COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"'
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001"'
+ );
+let $CHILD3_3_SET_RECOVERY_STATUS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 2"'
+ );
+let $CHILD3_3_SET_OK_STATUS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 1"'
+ );
+let $CHILD3_3_SET_OK_STATUS_AS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "1 0"'
+ );
diff --git a/storage/spider/mysql-test/spider/handler/include/hs_init_child2_1.inc b/storage/spider/mysql-test/spider/handler/include/hs_init_child2_1.inc
index 2ea1c0c9cd6..ee006858b06 100644
--- a/storage/spider/mysql-test/spider/handler/include/hs_init_child2_1.inc
+++ b/storage/spider/mysql-test/spider/handler/include/hs_init_child2_1.inc
@@ -1,24 +1,24 @@
-let $CHILD2_1_HS_DROP_TABLES=
- DROP TABLE IF EXISTS hs_r;
-let $CHILD2_1_HS_CREATE_TABLES=
- CREATE TABLE hs_r (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- d INT DEFAULT 11,
- PRIMARY KEY(a)
- ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
-let $CHILD2_1_HS_SELECT_TABLES=
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s'), d FROM hs_r ORDER BY a;
-let $CHILD2_1_HS_DROP_TABLES2=
- DROP TABLE IF EXISTS hs_r2;
-let $CHILD2_1_HS_CREATE_TABLES2=
- CREATE TABLE hs_r2 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- d INT DEFAULT 11,
- PRIMARY KEY(a)
- ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
-let $CHILD2_1_HS_SELECT_TABLES2=
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s'), d FROM hs_r2 ORDER BY a;
+let $CHILD2_1_HS_DROP_TABLES=
+ DROP TABLE IF EXISTS hs_r;
+let $CHILD2_1_HS_CREATE_TABLES=
+ CREATE TABLE hs_r (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ d INT DEFAULT 11,
+ PRIMARY KEY(a)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_HS_SELECT_TABLES=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s'), d FROM hs_r ORDER BY a;
+let $CHILD2_1_HS_DROP_TABLES2=
+ DROP TABLE IF EXISTS hs_r2;
+let $CHILD2_1_HS_CREATE_TABLES2=
+ CREATE TABLE hs_r2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ d INT DEFAULT 11,
+ PRIMARY KEY(a)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_HS_SELECT_TABLES2=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s'), d FROM hs_r2 ORDER BY a;
diff --git a/storage/spider/mysql-test/spider/handler/include/hs_init_child2_2.inc b/storage/spider/mysql-test/spider/handler/include/hs_init_child2_2.inc
index 7c69d73ced6..1c5a02d50c8 100644
--- a/storage/spider/mysql-test/spider/handler/include/hs_init_child2_2.inc
+++ b/storage/spider/mysql-test/spider/handler/include/hs_init_child2_2.inc
@@ -1,12 +1,12 @@
-let $CHILD2_2_HS_DROP_TABLES=
- DROP TABLE IF EXISTS hs_r3;
-let $CHILD2_2_HS_CREATE_TABLES=
- CREATE TABLE hs_r3 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- d INT DEFAULT 11,
- PRIMARY KEY(a)
- ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
-let $CHILD2_2_HS_SELECT_TABLES=
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s'), d FROM hs_r3 ORDER BY a;
+let $CHILD2_2_HS_DROP_TABLES=
+ DROP TABLE IF EXISTS hs_r3;
+let $CHILD2_2_HS_CREATE_TABLES=
+ CREATE TABLE hs_r3 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ d INT DEFAULT 11,
+ PRIMARY KEY(a)
+ ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
+let $CHILD2_2_HS_SELECT_TABLES=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s'), d FROM hs_r3 ORDER BY a;
diff --git a/storage/spider/mysql-test/spider/handler/include/init_child2_1.inc b/storage/spider/mysql-test/spider/handler/include/init_child2_1.inc
index 7773f0e2dde..b8b8ceb9875 100644
--- a/storage/spider/mysql-test/spider/handler/include/init_child2_1.inc
+++ b/storage/spider/mysql-test/spider/handler/include/init_child2_1.inc
@@ -1,176 +1,176 @@
-let $CHILD2_1_DROP_TABLES=
- DROP TABLE IF EXISTS ta_r;
-let $CHILD2_1_CREATE_TABLES=
- CREATE TABLE ta_r (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a),
- KEY idx1(b)
- ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
-let $CHILD2_1_SELECT_TABLES=
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
-let $CHILD2_1_DROP_TABLES2=
- DROP TABLE IF EXISTS ta_r2;
-let $CHILD2_1_CREATE_TABLES2=
- CREATE TABLE ta_r2 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
-let $CHILD2_1_SELECT_TABLES2=
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r2 ORDER BY a;
-let $CHILD2_1_DROP_TABLES3=
- DROP TABLE IF EXISTS ta_r_no_idx;
-let $CHILD2_1_CREATE_TABLES3=
- CREATE TABLE ta_r_no_idx (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10'
- ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
-let $CHILD2_1_SELECT_TABLES3=
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r_no_idx ORDER BY a;
-let $CHILD2_1_DROP_TABLES4=
- DROP TABLE IF EXISTS ta_r_auto_inc;
-let $CHILD2_1_CREATE_TABLES4=
- CREATE TABLE ta_r_auto_inc (
- a INT AUTO_INCREMENT,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
-let $CHILD2_1_SELECT_TABLES4=
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r_auto_inc
- ORDER BY a;
-let $CHILD2_1_DROP_TABLES5=
- DROP TABLE IF EXISTS ta_r_int;
-let $CHILD2_1_CREATE_TABLES5=
- CREATE TABLE ta_r_int (
- a INT AUTO_INCREMENT,
- b INT DEFAULT 10,
- c INT DEFAULT 11,
- PRIMARY KEY(a),
- KEY idx1(b),
- KEY idx2(c)
- ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
-let $CHILD2_1_SELECT_TABLES5=
- SELECT a, b, c FROM ta_r_int ORDER BY a;
-let $CHILD2_1_DROP_TABLES6=
- DROP TABLE IF EXISTS ta_r_3;
-let $CHILD2_1_CREATE_TABLES6=
- CREATE TABLE ta_r_3 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
-let $CHILD2_1_SELECT_TABLES6=
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r_3 ORDER BY a;
-let $CHILD2_1_DROP_FT_TABLES=
- DROP TABLE IF EXISTS ft_r;
-let $CHILD2_1_CREATE_FT_TABLES=
- CREATE TABLE ft_r (
- a INT DEFAULT 0,
- b TEXT,
- c TEXT,
- d TEXT,
- PRIMARY KEY(a),
- FULLTEXT INDEX ft_idx1(b),
- FULLTEXT INDEX ft_idx2(c)
- ) $CHILD2_1_FT_ENGINE $CHILD2_1_FT_CHARSET;
-let $CHILD2_1_SELECT_FT_TABLES=
- SELECT a, b, c, d FROM ft_r ORDER BY a;
-let $CHILD2_1_DROP_FT_TABLES2=
- DROP TABLE IF EXISTS ft_r2;
-let $CHILD2_1_CREATE_FT_TABLES2=
- CREATE TABLE ft_r2 (
- a INT DEFAULT 0,
- b TEXT,
- c TEXT,
- d TEXT,
- PRIMARY KEY(a),
- FULLTEXT INDEX ft_idx1(b),
- FULLTEXT INDEX ft_idx2(c)
- ) $CHILD2_1_FT_ENGINE $CHILD2_1_FT_CHARSET;
-let $CHILD2_1_SELECT_FT_TABLES2=
- SELECT a, b, c, d FROM ft_r2 ORDER BY a;
-let $CHILD2_1_DROP_GM_TABLES=
- DROP TABLE IF EXISTS gm_r;
-let $CHILD2_1_CREATE_GM_TABLES=
- CREATE TABLE gm_r (
- a INT DEFAULT 0,
- b GEOMETRY NOT NULL,
- c GEOMETRY NOT NULL,
- PRIMARY KEY(a),
- SPATIAL INDEX sp_idx1(b),
- SPATIAL INDEX sp_idx2(c)
- ) $CHILD2_1_GM_ENGINE $CHILD2_1_GM_CHARSET;
-let $CHILD2_1_SELECT_GM_TABLES=
- SELECT a, b, c FROM gm_r ORDER BY a;
-let $CHILD2_1_DROP_GM_TABLES2=
- DROP TABLE IF EXISTS gm_r2;
-let $CHILD2_1_CREATE_GM_TABLES2=
- CREATE TABLE gm_r2 (
- a INT DEFAULT 0,
- b GEOMETRY NOT NULL,
- c GEOMETRY NOT NULL,
- PRIMARY KEY(a),
- SPATIAL INDEX sp_idx1(b),
- SPATIAL INDEX sp_idx2(c)
- ) $CHILD2_1_GM_ENGINE $CHILD2_1_GM_CHARSET;
-let $CHILD2_1_SELECT_GM_TABLES2=
- SELECT a, b, c FROM gm_r2 ORDER BY a;
-let $CHILD2_1_DROP_LOCK_TABLES1=
- DROP TABLE IF EXISTS t1_1;
-let $CHILD2_1_CREATE_LOCK_TABLES1=
- CREATE TABLE t1_1 (
- id int(11) NOT NULL,
- PRIMARY KEY (id)
- ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
-let $CHILD2_1_DROP_LOCK_TABLES2=
- DROP TABLE IF EXISTS t2_2;
-let $CHILD2_1_CREATE_LOCK_TABLES2=
- CREATE TABLE t2_2 (
- id int(11) NOT NULL,
- PRIMARY KEY (id)
- ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
-let $CHILD2_1_DROP_INCREMENT_TABLES1=
- DROP TABLE IF EXISTS t1_1;
-let $CHILD2_1_CREATE_INCREMENT_TABLES1=
- CREATE TABLE t1_1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
-let $CHILD2_1_SELECT_INCREMENT_TABLES1=
- SELECT id FROM t1_1 ORDER BY id;
-let $CHILD2_1_DROP_TEXT_PK_TABLES1=
- DROP TABLE IF EXISTS t1;
-let $CHILD2_1_CREATE_TEXT_PK_TABLES1=
- CREATE TABLE t1 (
- a VARCHAR(255),
- PRIMARY KEY (a)
- ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET2;
-let $CHILD2_1_SELECT_TEXT_PK_TABLES1=
- SELECT a FROM t1 ORDER BY a;
-let $CHILD2_1_DROP_TEXT_KEY_TABLES1=
- DROP TABLE IF EXISTS t1;
-let $CHILD2_1_CREATE_TEXT_KEY_TABLES1=
- CREATE TABLE t1 (
- a VARCHAR(255),
- b VARCHAR(255),
- c VARCHAR(255),
- KEY idx1(a,b),
- KEY idx2(b),
- PRIMARY KEY(c)
- ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
-let $CHILD2_1_SELECT_TEXT_KEY_TABLES1=
- SELECT a, b FROM t1 ORDER BY a, b;
-let $CHILD2_1_AUTO_INCREMENT_INCREMENT1=
- SET GLOBAL AUTO_INCREMENT_INCREMENT = 1;
-let $CHILD2_1_AUTO_INCREMENT_INCREMENT2=
- SET GLOBAL AUTO_INCREMENT_INCREMENT = 4;
-let $CHILD2_1_AUTO_INCREMENT_OFFSET1=
- SET GLOBAL AUTO_INCREMENT_OFFSET = 1;
-let $CHILD2_1_AUTO_INCREMENT_OFFSET2=
- SET GLOBAL AUTO_INCREMENT_OFFSET = 2;
+let $CHILD2_1_DROP_TABLES=
+ DROP TABLE IF EXISTS ta_r;
+let $CHILD2_1_CREATE_TABLES=
+ CREATE TABLE ta_r (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a),
+ KEY idx1(b)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_SELECT_TABLES=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
+let $CHILD2_1_DROP_TABLES2=
+ DROP TABLE IF EXISTS ta_r2;
+let $CHILD2_1_CREATE_TABLES2=
+ CREATE TABLE ta_r2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_SELECT_TABLES2=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r2 ORDER BY a;
+let $CHILD2_1_DROP_TABLES3=
+ DROP TABLE IF EXISTS ta_r_no_idx;
+let $CHILD2_1_CREATE_TABLES3=
+ CREATE TABLE ta_r_no_idx (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_SELECT_TABLES3=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r_no_idx ORDER BY a;
+let $CHILD2_1_DROP_TABLES4=
+ DROP TABLE IF EXISTS ta_r_auto_inc;
+let $CHILD2_1_CREATE_TABLES4=
+ CREATE TABLE ta_r_auto_inc (
+ a INT AUTO_INCREMENT,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_SELECT_TABLES4=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r_auto_inc
+ ORDER BY a;
+let $CHILD2_1_DROP_TABLES5=
+ DROP TABLE IF EXISTS ta_r_int;
+let $CHILD2_1_CREATE_TABLES5=
+ CREATE TABLE ta_r_int (
+ a INT AUTO_INCREMENT,
+ b INT DEFAULT 10,
+ c INT DEFAULT 11,
+ PRIMARY KEY(a),
+ KEY idx1(b),
+ KEY idx2(c)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_SELECT_TABLES5=
+ SELECT a, b, c FROM ta_r_int ORDER BY a;
+let $CHILD2_1_DROP_TABLES6=
+ DROP TABLE IF EXISTS ta_r_3;
+let $CHILD2_1_CREATE_TABLES6=
+ CREATE TABLE ta_r_3 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_SELECT_TABLES6=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r_3 ORDER BY a;
+let $CHILD2_1_DROP_FT_TABLES=
+ DROP TABLE IF EXISTS ft_r;
+let $CHILD2_1_CREATE_FT_TABLES=
+ CREATE TABLE ft_r (
+ a INT DEFAULT 0,
+ b TEXT,
+ c TEXT,
+ d TEXT,
+ PRIMARY KEY(a),
+ FULLTEXT INDEX ft_idx1(b),
+ FULLTEXT INDEX ft_idx2(c)
+ ) $CHILD2_1_FT_ENGINE $CHILD2_1_FT_CHARSET;
+let $CHILD2_1_SELECT_FT_TABLES=
+ SELECT a, b, c, d FROM ft_r ORDER BY a;
+let $CHILD2_1_DROP_FT_TABLES2=
+ DROP TABLE IF EXISTS ft_r2;
+let $CHILD2_1_CREATE_FT_TABLES2=
+ CREATE TABLE ft_r2 (
+ a INT DEFAULT 0,
+ b TEXT,
+ c TEXT,
+ d TEXT,
+ PRIMARY KEY(a),
+ FULLTEXT INDEX ft_idx1(b),
+ FULLTEXT INDEX ft_idx2(c)
+ ) $CHILD2_1_FT_ENGINE $CHILD2_1_FT_CHARSET;
+let $CHILD2_1_SELECT_FT_TABLES2=
+ SELECT a, b, c, d FROM ft_r2 ORDER BY a;
+let $CHILD2_1_DROP_GM_TABLES=
+ DROP TABLE IF EXISTS gm_r;
+let $CHILD2_1_CREATE_GM_TABLES=
+ CREATE TABLE gm_r (
+ a INT DEFAULT 0,
+ b GEOMETRY NOT NULL,
+ c GEOMETRY NOT NULL,
+ PRIMARY KEY(a),
+ SPATIAL INDEX sp_idx1(b),
+ SPATIAL INDEX sp_idx2(c)
+ ) $CHILD2_1_GM_ENGINE $CHILD2_1_GM_CHARSET;
+let $CHILD2_1_SELECT_GM_TABLES=
+ SELECT a, b, c FROM gm_r ORDER BY a;
+let $CHILD2_1_DROP_GM_TABLES2=
+ DROP TABLE IF EXISTS gm_r2;
+let $CHILD2_1_CREATE_GM_TABLES2=
+ CREATE TABLE gm_r2 (
+ a INT DEFAULT 0,
+ b GEOMETRY NOT NULL,
+ c GEOMETRY NOT NULL,
+ PRIMARY KEY(a),
+ SPATIAL INDEX sp_idx1(b),
+ SPATIAL INDEX sp_idx2(c)
+ ) $CHILD2_1_GM_ENGINE $CHILD2_1_GM_CHARSET;
+let $CHILD2_1_SELECT_GM_TABLES2=
+ SELECT a, b, c FROM gm_r2 ORDER BY a;
+let $CHILD2_1_DROP_LOCK_TABLES1=
+ DROP TABLE IF EXISTS t1_1;
+let $CHILD2_1_CREATE_LOCK_TABLES1=
+ CREATE TABLE t1_1 (
+ id int(11) NOT NULL,
+ PRIMARY KEY (id)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_DROP_LOCK_TABLES2=
+ DROP TABLE IF EXISTS t2_2;
+let $CHILD2_1_CREATE_LOCK_TABLES2=
+ CREATE TABLE t2_2 (
+ id int(11) NOT NULL,
+ PRIMARY KEY (id)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_DROP_INCREMENT_TABLES1=
+ DROP TABLE IF EXISTS t1_1;
+let $CHILD2_1_CREATE_INCREMENT_TABLES1=
+ CREATE TABLE t1_1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_SELECT_INCREMENT_TABLES1=
+ SELECT id FROM t1_1 ORDER BY id;
+let $CHILD2_1_DROP_TEXT_PK_TABLES1=
+ DROP TABLE IF EXISTS t1;
+let $CHILD2_1_CREATE_TEXT_PK_TABLES1=
+ CREATE TABLE t1 (
+ a VARCHAR(255),
+ PRIMARY KEY (a)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET2;
+let $CHILD2_1_SELECT_TEXT_PK_TABLES1=
+ SELECT a FROM t1 ORDER BY a;
+let $CHILD2_1_DROP_TEXT_KEY_TABLES1=
+ DROP TABLE IF EXISTS t1;
+let $CHILD2_1_CREATE_TEXT_KEY_TABLES1=
+ CREATE TABLE t1 (
+ a VARCHAR(255),
+ b VARCHAR(255),
+ c VARCHAR(255),
+ KEY idx1(a,b),
+ KEY idx2(b),
+ PRIMARY KEY(c)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_SELECT_TEXT_KEY_TABLES1=
+ SELECT a, b FROM t1 ORDER BY a, b;
+let $CHILD2_1_AUTO_INCREMENT_INCREMENT1=
+ SET GLOBAL AUTO_INCREMENT_INCREMENT = 1;
+let $CHILD2_1_AUTO_INCREMENT_INCREMENT2=
+ SET GLOBAL AUTO_INCREMENT_INCREMENT = 4;
+let $CHILD2_1_AUTO_INCREMENT_OFFSET1=
+ SET GLOBAL AUTO_INCREMENT_OFFSET = 1;
+let $CHILD2_1_AUTO_INCREMENT_OFFSET2=
+ SET GLOBAL AUTO_INCREMENT_OFFSET = 2;
diff --git a/storage/spider/mysql-test/spider/handler/include/init_child2_2.inc b/storage/spider/mysql-test/spider/handler/include/init_child2_2.inc
index 3524fc4a2b7..9f0b5e2fe5a 100644
--- a/storage/spider/mysql-test/spider/handler/include/init_child2_2.inc
+++ b/storage/spider/mysql-test/spider/handler/include/init_child2_2.inc
@@ -1,80 +1,80 @@
-let $CHILD2_2_DROP_TABLES=
- DROP TABLE IF EXISTS ta_r3;
-let $CHILD2_2_CREATE_TABLES=
- CREATE TABLE ta_r3 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
-let $CHILD2_2_DROP_TABLES5=
- DROP TABLE IF EXISTS ta_r_int;
-let $CHILD2_2_CREATE_TABLES5=
- CREATE TABLE ta_r_int (
- a INT AUTO_INCREMENT,
- b INT DEFAULT 10,
- c INT DEFAULT 11,
- PRIMARY KEY(a),
- KEY idx1(b),
- KEY idx2(c)
- ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
-let $CHILD2_2_SELECT_TABLES=
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a;
-let $CHILD2_2_DROP_FT_TABLES=
- DROP TABLE IF EXISTS ft_r3;
-let $CHILD2_2_CREATE_FT_TABLES=
- CREATE TABLE ft_r3 (
- a INT DEFAULT 0,
- b TEXT,
- c TEXT,
- d TEXT,
- PRIMARY KEY(a),
- FULLTEXT INDEX ft_idx1(b),
- FULLTEXT INDEX ft_idx2(c)
- ) $CHILD2_2_FT_ENGINE $CHILD2_2_FT_CHARSET;
-let $CHILD2_2_SELECT_FT_TABLES=
- SELECT a, b, c, d FROM ft_r3 ORDER BY a;
-let $CHILD2_2_DROP_GM_TABLES=
- DROP TABLE IF EXISTS gm_r3;
-let $CHILD2_2_CREATE_GM_TABLES=
- CREATE TABLE gm_r3 (
- a INT DEFAULT 0,
- b GEOMETRY NOT NULL,
- c GEOMETRY NOT NULL,
- PRIMARY KEY(a),
- SPATIAL INDEX sp_idx1(b),
- SPATIAL INDEX sp_idx2(c)
- ) $CHILD2_2_GM_ENGINE $CHILD2_2_GM_CHARSET;
-let $CHILD2_2_SELECT_GM_TABLES=
- SELECT a, b, c FROM gm_r3 ORDER BY a;
-let $CHILD2_2_DROP_LOCK_TABLES1=
- DROP TABLE IF EXISTS t1_2;
-let $CHILD2_2_CREATE_LOCK_TABLES1=
- CREATE TABLE t1_2 (
- id int(11) NOT NULL,
- PRIMARY KEY (id)
- ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
-let $CHILD2_2_DROP_LOCK_TABLES2=
- DROP TABLE IF EXISTS t2_1;
-let $CHILD2_2_CREATE_LOCK_TABLES2=
- CREATE TABLE t2_1 (
- id int(11) NOT NULL,
- PRIMARY KEY (id)
- ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
-let $CHILD2_2_DROP_INCREMENT_TABLES1=
- DROP TABLE IF EXISTS t1_2;
-let $CHILD2_2_CREATE_INCREMENT_TABLES1=
- CREATE TABLE t1_2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
-let $CHILD2_2_SELECT_INCREMENT_TABLES1=
- SELECT id FROM t1_2 ORDER BY id;
-let $CHILD2_2_AUTO_INCREMENT_INCREMENT1=
- SET GLOBAL AUTO_INCREMENT_INCREMENT = 1;
-let $CHILD2_2_AUTO_INCREMENT_INCREMENT2=
- SET GLOBAL AUTO_INCREMENT_INCREMENT = 4;
-let $CHILD2_2_AUTO_INCREMENT_OFFSET1=
- SET GLOBAL AUTO_INCREMENT_OFFSET = 1;
-let $CHILD2_2_AUTO_INCREMENT_OFFSET2=
- SET GLOBAL AUTO_INCREMENT_OFFSET = 3;
+let $CHILD2_2_DROP_TABLES=
+ DROP TABLE IF EXISTS ta_r3;
+let $CHILD2_2_CREATE_TABLES=
+ CREATE TABLE ta_r3 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
+let $CHILD2_2_DROP_TABLES5=
+ DROP TABLE IF EXISTS ta_r_int;
+let $CHILD2_2_CREATE_TABLES5=
+ CREATE TABLE ta_r_int (
+ a INT AUTO_INCREMENT,
+ b INT DEFAULT 10,
+ c INT DEFAULT 11,
+ PRIMARY KEY(a),
+ KEY idx1(b),
+ KEY idx2(c)
+ ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
+let $CHILD2_2_SELECT_TABLES=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a;
+let $CHILD2_2_DROP_FT_TABLES=
+ DROP TABLE IF EXISTS ft_r3;
+let $CHILD2_2_CREATE_FT_TABLES=
+ CREATE TABLE ft_r3 (
+ a INT DEFAULT 0,
+ b TEXT,
+ c TEXT,
+ d TEXT,
+ PRIMARY KEY(a),
+ FULLTEXT INDEX ft_idx1(b),
+ FULLTEXT INDEX ft_idx2(c)
+ ) $CHILD2_2_FT_ENGINE $CHILD2_2_FT_CHARSET;
+let $CHILD2_2_SELECT_FT_TABLES=
+ SELECT a, b, c, d FROM ft_r3 ORDER BY a;
+let $CHILD2_2_DROP_GM_TABLES=
+ DROP TABLE IF EXISTS gm_r3;
+let $CHILD2_2_CREATE_GM_TABLES=
+ CREATE TABLE gm_r3 (
+ a INT DEFAULT 0,
+ b GEOMETRY NOT NULL,
+ c GEOMETRY NOT NULL,
+ PRIMARY KEY(a),
+ SPATIAL INDEX sp_idx1(b),
+ SPATIAL INDEX sp_idx2(c)
+ ) $CHILD2_2_GM_ENGINE $CHILD2_2_GM_CHARSET;
+let $CHILD2_2_SELECT_GM_TABLES=
+ SELECT a, b, c FROM gm_r3 ORDER BY a;
+let $CHILD2_2_DROP_LOCK_TABLES1=
+ DROP TABLE IF EXISTS t1_2;
+let $CHILD2_2_CREATE_LOCK_TABLES1=
+ CREATE TABLE t1_2 (
+ id int(11) NOT NULL,
+ PRIMARY KEY (id)
+ ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
+let $CHILD2_2_DROP_LOCK_TABLES2=
+ DROP TABLE IF EXISTS t2_1;
+let $CHILD2_2_CREATE_LOCK_TABLES2=
+ CREATE TABLE t2_1 (
+ id int(11) NOT NULL,
+ PRIMARY KEY (id)
+ ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
+let $CHILD2_2_DROP_INCREMENT_TABLES1=
+ DROP TABLE IF EXISTS t1_2;
+let $CHILD2_2_CREATE_INCREMENT_TABLES1=
+ CREATE TABLE t1_2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
+let $CHILD2_2_SELECT_INCREMENT_TABLES1=
+ SELECT id FROM t1_2 ORDER BY id;
+let $CHILD2_2_AUTO_INCREMENT_INCREMENT1=
+ SET GLOBAL AUTO_INCREMENT_INCREMENT = 1;
+let $CHILD2_2_AUTO_INCREMENT_INCREMENT2=
+ SET GLOBAL AUTO_INCREMENT_INCREMENT = 4;
+let $CHILD2_2_AUTO_INCREMENT_OFFSET1=
+ SET GLOBAL AUTO_INCREMENT_OFFSET = 1;
+let $CHILD2_2_AUTO_INCREMENT_OFFSET2=
+ SET GLOBAL AUTO_INCREMENT_OFFSET = 3;
diff --git a/storage/spider/mysql-test/spider/handler/include/init_child2_3.inc b/storage/spider/mysql-test/spider/handler/include/init_child2_3.inc
index d857a787ac0..05dbb1c3dd1 100644
--- a/storage/spider/mysql-test/spider/handler/include/init_child2_3.inc
+++ b/storage/spider/mysql-test/spider/handler/include/init_child2_3.inc
@@ -1,11 +1,11 @@
-let $CHILD2_3_DROP_TABLES=
- DROP TABLE IF EXISTS ta_r4;
-let $CHILD2_3_CREATE_TABLES=
- CREATE TABLE ta_r4 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD2_3_ENGINE $CHILD2_3_CHARSET;
-let $CHILD2_3_SELECT_TABLES=
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r4 ORDER BY a;
+let $CHILD2_3_DROP_TABLES=
+ DROP TABLE IF EXISTS ta_r4;
+let $CHILD2_3_CREATE_TABLES=
+ CREATE TABLE ta_r4 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD2_3_ENGINE $CHILD2_3_CHARSET;
+let $CHILD2_3_SELECT_TABLES=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r4 ORDER BY a;
diff --git a/storage/spider/mysql-test/spider/handler/include/init_slave1_1.inc b/storage/spider/mysql-test/spider/handler/include/init_slave1_1.inc
index 87c05f1f690..73c3c6b9ef2 100644
--- a/storage/spider/mysql-test/spider/handler/include/init_slave1_1.inc
+++ b/storage/spider/mysql-test/spider/handler/include/init_slave1_1.inc
@@ -1,10 +1,10 @@
-let $SLAVE1_1_COMMENT_INCREMENT1_1=
- COMMENT '';
-let $SLAVE1_1_COMMENT_INCREMENT1_P_1=
- COMMENT ''
- PARTITION BY LIST(MOD(id, 2)) (
- PARTITION pt1 VALUES IN (0)
- COMMENT='',
- PARTITION pt2 VALUES IN (1)
- COMMENT=''
- );
+let $SLAVE1_1_COMMENT_INCREMENT1_1=
+ COMMENT '';
+let $SLAVE1_1_COMMENT_INCREMENT1_P_1=
+ COMMENT ''
+ PARTITION BY LIST(MOD(id, 2)) (
+ PARTITION pt1 VALUES IN (0)
+ COMMENT='',
+ PARTITION pt2 VALUES IN (1)
+ COMMENT=''
+ );
diff --git a/storage/spider/mysql-test/spider/handler/t/direct_aggregate.test b/storage/spider/mysql-test/spider/handler/t/direct_aggregate.test
index 5f17ac402e2..d65f4c5a624 100644
--- a/storage/spider/mysql-test/spider/handler/t/direct_aggregate.test
+++ b/storage/spider/mysql-test/spider/handler/t/direct_aggregate.test
@@ -1,179 +1,179 @@
---disable_warnings
---disable_query_log
---disable_result_log
---source test_init.inc
---enable_result_log
---enable_query_log
-
---echo
---echo drop and create databases
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- CREATE DATABASE auto_test_remote;
- USE auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- CREATE DATABASE auto_test_remote2;
- USE auto_test_remote2;
-}
---enable_warnings
-
---echo
---echo test select 1
---connection master_1
-SELECT 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- SELECT 1;
- --connection child2_2
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo create table select test
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_TABLES;
- echo CHILD2_1_CREATE_TABLES;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
---disable_warnings
-DROP TABLE IF EXISTS ta_l;
---enable_warnings
---disable_query_log
-echo CREATE TABLE ta_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
-eval CREATE TABLE ta_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
---enable_query_log
-INSERT INTO ta_l (a, b, c) VALUES
- (1, 'a', '2008-08-01 10:21:39'),
- (2, 'b', '2000-01-01 00:00:00'),
- (3, 'e', '2007-06-04 20:03:11'),
- (4, 'd', '2003-11-30 05:01:03'),
- (5, 'c', '2001-12-31 23:59:59');
-
---echo
---echo direct_aggregating test
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
-SELECT COUNT(*) FROM ta_l;
-eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
-SELECT MAX(a) FROM ta_l;
-eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
-SELECT MIN(a) FROM ta_l;
-eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
-SELECT MAX(a) FROM ta_l WHERE a < 5;
-eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
-SELECT MIN(a) FROM ta_l WHERE a > 1;
-eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo deinit
---disable_warnings
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
-}
---disable_query_log
---disable_result_log
---source test_deinit.inc
---enable_result_log
---enable_query_log
---enable_warnings
---echo
---echo end of test
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--enable_result_log
+--enable_query_log
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ --connection child2_2
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo create table select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS ta_l;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE ta_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE ta_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+--enable_query_log
+INSERT INTO ta_l (a, b, c) VALUES
+ (1, 'a', '2008-08-01 10:21:39'),
+ (2, 'b', '2000-01-01 00:00:00'),
+ (3, 'e', '2007-06-04 20:03:11'),
+ (4, 'd', '2003-11-30 05:01:03'),
+ (5, 'c', '2001-12-31 23:59:59');
+
+--echo
+--echo direct_aggregating test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+SELECT COUNT(*) FROM ta_l;
+eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+SELECT MAX(a) FROM ta_l;
+eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+SELECT MIN(a) FROM ta_l;
+eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+SELECT MAX(a) FROM ta_l WHERE a < 5;
+eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+SELECT MIN(a) FROM ta_l WHERE a > 1;
+eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+}
+--disable_query_log
+--disable_result_log
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/handler/t/direct_aggregate_part.test b/storage/spider/mysql-test/spider/handler/t/direct_aggregate_part.test
index 2d67e9af32c..aebf210c745 100644
--- a/storage/spider/mysql-test/spider/handler/t/direct_aggregate_part.test
+++ b/storage/spider/mysql-test/spider/handler/t/direct_aggregate_part.test
@@ -1,192 +1,192 @@
---disable_warnings
---disable_query_log
---disable_result_log
---source test_init.inc
---enable_result_log
---enable_query_log
-if (!$HAVE_PARTITION)
-{
- --disable_query_log
- --disable_result_log
- --source test_deinit.inc
- --enable_result_log
- --enable_query_log
- --enable_warnings
- skip Test requires partitioning;
-}
-
---echo
---echo drop and create databases
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- CREATE DATABASE auto_test_remote;
- USE auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- CREATE DATABASE auto_test_remote2;
- USE auto_test_remote2;
-}
---enable_warnings
-
---echo
---echo test select 1
---connection master_1
-SELECT 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- SELECT 1;
- --connection child2_2
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo with partition test
-if ($HAVE_PARTITION)
-{
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_2_DROP_TABLES;
- echo CHILD2_2_CREATE_TABLES;
- }
- --disable_warnings
- eval $CHILD2_2_DROP_TABLES;
- --enable_warnings
- eval $CHILD2_2_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_TABLES2;
- echo CHILD2_1_CREATE_TABLES2;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES2;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- --disable_query_log
- echo CREATE TABLE ta_l2 (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
- ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1;
- eval CREATE TABLE ta_l2 (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
- ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1;
- INSERT INTO ta_l2 (a, b, c) VALUES
- (1, 'a', '2008-08-01 10:21:39'),
- (2, 'b', '2000-01-01 00:00:00'),
- (3, 'e', '2007-06-04 20:03:11'),
- (4, 'd', '2003-11-30 05:01:03'),
- (5, 'c', '2001-12-31 23:59:59');
- --enable_query_log
- eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
- SELECT COUNT(*) FROM ta_l2;
- eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
- SELECT MAX(a) FROM ta_l2;
- eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
- SELECT MIN(a) FROM ta_l2;
- eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
- SELECT MAX(a) FROM ta_l2 WHERE a < 5;
- eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
- SELECT MIN(a) FROM ta_l2 WHERE a > 1;
- eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %';
- }
- eval $CHILD2_2_SELECT_TABLES;
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %';
- }
- eval $CHILD2_1_SELECT_TABLES2;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
-}
-
---echo
---echo deinit
---disable_warnings
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
-}
---disable_query_log
---disable_result_log
---source test_deinit.inc
---enable_result_log
---enable_query_log
---enable_warnings
---echo
---echo end of test
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--enable_result_log
+--enable_query_log
+if (!$HAVE_PARTITION)
+{
+ --disable_query_log
+ --disable_result_log
+ --source test_deinit.inc
+ --enable_result_log
+ --enable_query_log
+ --enable_warnings
+ skip Test requires partitioning;
+}
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ --connection child2_2
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo with partition test
+if ($HAVE_PARTITION)
+{
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_DROP_TABLES;
+ echo CHILD2_2_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_2_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_2_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES2;
+ echo CHILD2_1_CREATE_TABLES2;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES2;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ --disable_query_log
+ echo CREATE TABLE ta_l2 (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1;
+ eval CREATE TABLE ta_l2 (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1;
+ INSERT INTO ta_l2 (a, b, c) VALUES
+ (1, 'a', '2008-08-01 10:21:39'),
+ (2, 'b', '2000-01-01 00:00:00'),
+ (3, 'e', '2007-06-04 20:03:11'),
+ (4, 'd', '2003-11-30 05:01:03'),
+ (5, 'c', '2001-12-31 23:59:59');
+ --enable_query_log
+ eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+ SELECT COUNT(*) FROM ta_l2;
+ eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+ SELECT MAX(a) FROM ta_l2;
+ eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+ SELECT MIN(a) FROM ta_l2;
+ eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+ SELECT MAX(a) FROM ta_l2 WHERE a < 5;
+ eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+ SELECT MIN(a) FROM ta_l2 WHERE a > 1;
+ eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %';
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %';
+ }
+ eval $CHILD2_1_SELECT_TABLES2;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+}
+--disable_query_log
+--disable_result_log
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/handler/t/have_partition.inc b/storage/spider/mysql-test/spider/handler/t/have_partition.inc
index 573c76ab43b..b6e699475db 100644
--- a/storage/spider/mysql-test/spider/handler/t/have_partition.inc
+++ b/storage/spider/mysql-test/spider/handler/t/have_partition.inc
@@ -1,7 +1,7 @@
-let $HAVE_PARTITION= 0;
-if (`SELECT count(*) FROM information_schema.plugins WHERE
- plugin_status = 'ACTIVE' AND
- plugin_name = 'partition'`)
-{
- let $HAVE_PARTITION= 1;
-}
+let $HAVE_PARTITION= 0;
+if (`SELECT count(*) FROM information_schema.plugins WHERE
+ plugin_status = 'ACTIVE' AND
+ plugin_name = 'partition'`)
+{
+ let $HAVE_PARTITION= 1;
+}
diff --git a/storage/spider/mysql-test/spider/handler/t/have_trigger.inc b/storage/spider/mysql-test/spider/handler/t/have_trigger.inc
index 10c0871dd5f..32de484b388 100644
--- a/storage/spider/mysql-test/spider/handler/t/have_trigger.inc
+++ b/storage/spider/mysql-test/spider/handler/t/have_trigger.inc
@@ -1,2 +1,2 @@
-let $HAVE_TRIGGER= `SELECT COUNT(*) FROM information_schema.tables
- WHERE TABLE_SCHEMA = 'information_schema' AND TABLE_NAME = 'TRIGGERS'`;
+let $HAVE_TRIGGER= `SELECT COUNT(*) FROM information_schema.tables
+ WHERE TABLE_SCHEMA = 'information_schema' AND TABLE_NAME = 'TRIGGERS'`;
diff --git a/storage/spider/mysql-test/spider/handler/t/spider3_fixes.test b/storage/spider/mysql-test/spider/handler/t/spider3_fixes.test
index 7530ce97837..13fa6f5fa39 100644
--- a/storage/spider/mysql-test/spider/handler/t/spider3_fixes.test
+++ b/storage/spider/mysql-test/spider/handler/t/spider3_fixes.test
@@ -1,292 +1,292 @@
-# This test tests for Spider 3.0's bug fixes
-source include/have_log_bin.inc;
---disable_warnings
---disable_query_log
---disable_result_log
---source test_init.inc
---source slave_test_init.inc
---enable_result_log
---enable_query_log
-
---echo
---echo drop and create databases
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-if ($USE_REPLICATION)
-{
- --connection slave1_1
- DROP DATABASE IF EXISTS auto_test_local;
- CREATE DATABASE auto_test_local;
- USE auto_test_local;
-}
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- CREATE DATABASE auto_test_remote;
- USE auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- CREATE DATABASE auto_test_remote2;
- USE auto_test_remote2;
-}
---enable_warnings
-
---echo
---echo test select 1
---connection master_1
-SELECT 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- SELECT 1;
- --connection child2_2
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
-
---echo
---echo 3.1
---echo auto_increment
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_INCREMENT_TABLES1;
- echo CHILD2_1_CREATE_INCREMENT_TABLES1;
- echo CHILD2_1_AUTO_INCREMENT_INCREMENT2;
- echo CHILD2_1_AUTO_INCREMENT_OFFSET2;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_INCREMENT_TABLES1;
- --enable_warnings
- eval $CHILD2_1_CREATE_INCREMENT_TABLES1;
- eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2;
- eval $CHILD2_1_AUTO_INCREMENT_OFFSET2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-if ($USE_REPLICATION)
-{
- save_master_pos;
- --connection slave1_1
- sync_with_master;
- --connection master_1
- --disable_query_log
- SET SESSION sql_log_bin= 0;
- --enable_query_log
-}
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
---enable_warnings
---disable_query_log
-echo CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1;
-echo CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1;
-echo MASTER_1_AUTO_INCREMENT_INCREMENT2;
-echo MASTER_1_AUTO_INCREMENT_OFFSET2;
-eval CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_1;
-eval CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_1;
-eval $MASTER_1_AUTO_INCREMENT_INCREMENT2;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET2;
-if ($USE_REPLICATION)
-{
- SET SESSION sql_log_bin= 1;
- --connection slave1_1
- --disable_warnings
- DROP TABLE IF EXISTS t1, t2;
- --enable_warnings
- echo CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1;
- echo CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1;
- eval CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_1;
- eval CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_1;
- --connection master_1
-}
---enable_query_log
-INSERT INTO t1 () VALUES ();
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t1;
-INSERT INTO t2 () VALUES ();
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t2;
---disable_query_log
-echo MASTER_1_AUTO_INCREMENT_OFFSET3;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
---enable_query_log
-INSERT INTO t1 (id) VALUES (null);
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t1;
---disable_query_log
-echo MASTER_1_AUTO_INCREMENT_OFFSET4;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
---enable_query_log
-INSERT INTO t2 (id) VALUES (null);
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t2;
---disable_query_log
-echo MASTER_1_AUTO_INCREMENT_OFFSET3;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
---enable_query_log
-INSERT INTO t1 () VALUES (),(),(),();
-SELECT LAST_INSERT_ID();
-SELECT id FROM t1 ORDER BY id;
---disable_query_log
-echo MASTER_1_AUTO_INCREMENT_OFFSET4;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
---enable_query_log
-INSERT INTO t2 () VALUES (),(),(),();
-SELECT LAST_INSERT_ID();
-SELECT id FROM t2 ORDER BY id;
-TRUNCATE TABLE t1;
-TRUNCATE TABLE t2;
-INSERT INTO t1 () VALUES (),(),(),();
-SELECT LAST_INSERT_ID();
-SELECT id FROM t1 ORDER BY id;
-INSERT INTO t2 () VALUES (),(),(),();
-SELECT LAST_INSERT_ID();
-SELECT id FROM t2 ORDER BY id;
-SET INSERT_ID=5000;
---disable_query_log
-echo MASTER_1_AUTO_INCREMENT_OFFSET3;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
---enable_query_log
-INSERT INTO t1 () VALUES ();
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t1;
---disable_query_log
-echo MASTER_1_AUTO_INCREMENT_OFFSET4;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
---enable_query_log
-INSERT INTO t2 () VALUES ();
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t2;
-INSERT INTO t1 (id) VALUES (10000);
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t1;
-INSERT INTO t2 (id) VALUES (1000);
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t2;
-if ($USE_REPLICATION)
-{
- save_master_pos;
- --connection slave1_1
- sync_with_master;
- SELECT id FROM t1 ORDER BY id;
- --connection master_1
- --disable_query_log
- SET SESSION sql_log_bin= 0;
- --enable_query_log
-}
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %';
- }
- eval $CHILD2_1_SELECT_INCREMENT_TABLES1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_AUTO_INCREMENT_INCREMENT1;
- echo CHILD2_1_AUTO_INCREMENT_OFFSET1;
- }
- eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1;
- eval $CHILD2_1_AUTO_INCREMENT_OFFSET1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
-
---echo
---echo deinit
---disable_warnings
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-if ($USE_REPLICATION)
-{
- --connection slave1_1
- DROP DATABASE IF EXISTS auto_test_local;
-}
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
-}
---disable_query_log
---disable_result_log
---source slave_test_deinit.inc
---source test_deinit.inc
---enable_result_log
---enable_query_log
---enable_warnings
---echo
---echo end of test
+# This test tests for Spider 3.0's bug fixes
+source include/have_log_bin.inc;
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--source slave_test_init.inc
+--enable_result_log
+--enable_query_log
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_REPLICATION)
+{
+ --connection slave1_1
+ DROP DATABASE IF EXISTS auto_test_local;
+ CREATE DATABASE auto_test_local;
+ USE auto_test_local;
+}
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ --connection child2_2
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+
+--echo
+--echo 3.1
+--echo auto_increment
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_INCREMENT_TABLES1;
+ echo CHILD2_1_CREATE_INCREMENT_TABLES1;
+ echo CHILD2_1_AUTO_INCREMENT_INCREMENT2;
+ echo CHILD2_1_AUTO_INCREMENT_OFFSET2;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_INCREMENT_TABLES1;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_INCREMENT_TABLES1;
+ eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2;
+ eval $CHILD2_1_AUTO_INCREMENT_OFFSET2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+if ($USE_REPLICATION)
+{
+ save_master_pos;
+ --connection slave1_1
+ sync_with_master;
+ --connection master_1
+ --disable_query_log
+ SET SESSION sql_log_bin= 0;
+ --enable_query_log
+}
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1;
+echo CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1;
+echo MASTER_1_AUTO_INCREMENT_INCREMENT2;
+echo MASTER_1_AUTO_INCREMENT_OFFSET2;
+eval CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_1;
+eval CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_1;
+eval $MASTER_1_AUTO_INCREMENT_INCREMENT2;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET2;
+if ($USE_REPLICATION)
+{
+ SET SESSION sql_log_bin= 1;
+ --connection slave1_1
+ --disable_warnings
+ DROP TABLE IF EXISTS t1, t2;
+ --enable_warnings
+ echo CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1;
+ echo CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1;
+ eval CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_1;
+ eval CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_1;
+ --connection master_1
+}
+--enable_query_log
+INSERT INTO t1 () VALUES ();
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t1;
+INSERT INTO t2 () VALUES ();
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t2;
+--disable_query_log
+echo MASTER_1_AUTO_INCREMENT_OFFSET3;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
+--enable_query_log
+INSERT INTO t1 (id) VALUES (null);
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t1;
+--disable_query_log
+echo MASTER_1_AUTO_INCREMENT_OFFSET4;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
+--enable_query_log
+INSERT INTO t2 (id) VALUES (null);
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t2;
+--disable_query_log
+echo MASTER_1_AUTO_INCREMENT_OFFSET3;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
+--enable_query_log
+INSERT INTO t1 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+SELECT id FROM t1 ORDER BY id;
+--disable_query_log
+echo MASTER_1_AUTO_INCREMENT_OFFSET4;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
+--enable_query_log
+INSERT INTO t2 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+SELECT id FROM t2 ORDER BY id;
+TRUNCATE TABLE t1;
+TRUNCATE TABLE t2;
+INSERT INTO t1 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+SELECT id FROM t1 ORDER BY id;
+INSERT INTO t2 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+SELECT id FROM t2 ORDER BY id;
+SET INSERT_ID=5000;
+--disable_query_log
+echo MASTER_1_AUTO_INCREMENT_OFFSET3;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
+--enable_query_log
+INSERT INTO t1 () VALUES ();
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t1;
+--disable_query_log
+echo MASTER_1_AUTO_INCREMENT_OFFSET4;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
+--enable_query_log
+INSERT INTO t2 () VALUES ();
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t2;
+INSERT INTO t1 (id) VALUES (10000);
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t1;
+INSERT INTO t2 (id) VALUES (1000);
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t2;
+if ($USE_REPLICATION)
+{
+ save_master_pos;
+ --connection slave1_1
+ sync_with_master;
+ SELECT id FROM t1 ORDER BY id;
+ --connection master_1
+ --disable_query_log
+ SET SESSION sql_log_bin= 0;
+ --enable_query_log
+}
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %';
+ }
+ eval $CHILD2_1_SELECT_INCREMENT_TABLES1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_AUTO_INCREMENT_INCREMENT1;
+ echo CHILD2_1_AUTO_INCREMENT_OFFSET1;
+ }
+ eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1;
+ eval $CHILD2_1_AUTO_INCREMENT_OFFSET1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_REPLICATION)
+{
+ --connection slave1_1
+ DROP DATABASE IF EXISTS auto_test_local;
+}
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+}
+--disable_query_log
+--disable_result_log
+--source slave_test_deinit.inc
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/handler/t/spider3_fixes_part.test b/storage/spider/mysql-test/spider/handler/t/spider3_fixes_part.test
index f25f000d80c..3288c490a46 100644
--- a/storage/spider/mysql-test/spider/handler/t/spider3_fixes_part.test
+++ b/storage/spider/mysql-test/spider/handler/t/spider3_fixes_part.test
@@ -1,345 +1,345 @@
-# This test tests for Spider 3.0's bug fixes
-source include/have_log_bin.inc;
---disable_warnings
---disable_query_log
---disable_result_log
---source test_init.inc
---source slave_test_init.inc
---enable_result_log
---enable_query_log
-if (!$HAVE_PARTITION)
-{
- --disable_query_log
- --disable_result_log
- --source slave_test_deinit.inc
- --source test_deinit.inc
- --enable_result_log
- --enable_query_log
- --enable_warnings
- skip Test requires partitioning;
-}
-
---echo
---echo drop and create databases
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-if ($USE_REPLICATION)
-{
- --connection slave1_1
- DROP DATABASE IF EXISTS auto_test_local;
- CREATE DATABASE auto_test_local;
- USE auto_test_local;
-}
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- CREATE DATABASE auto_test_remote;
- USE auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- CREATE DATABASE auto_test_remote2;
- USE auto_test_remote2;
-}
---enable_warnings
-
---echo
---echo test select 1
---connection master_1
-SELECT 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- SELECT 1;
- --connection child2_2
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
-
---echo auto_increment with partition
-if ($HAVE_PARTITION)
-{
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_INCREMENT_TABLES1;
- echo CHILD2_1_CREATE_INCREMENT_TABLES1;
- echo CHILD2_1_AUTO_INCREMENT_INCREMENT2;
- echo CHILD2_1_AUTO_INCREMENT_OFFSET2;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_INCREMENT_TABLES1;
- --enable_warnings
- eval $CHILD2_1_CREATE_INCREMENT_TABLES1;
- eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2;
- eval $CHILD2_1_AUTO_INCREMENT_OFFSET2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_2
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_2_DROP_INCREMENT_TABLES1;
- echo CHILD2_2_CREATE_INCREMENT_TABLES1;
- echo CHILD2_2_AUTO_INCREMENT_INCREMENT2;
- echo CHILD2_2_AUTO_INCREMENT_OFFSET2;
- }
- --disable_warnings
- eval $CHILD2_2_DROP_INCREMENT_TABLES1;
- --enable_warnings
- eval $CHILD2_2_CREATE_INCREMENT_TABLES1;
- eval $CHILD2_2_AUTO_INCREMENT_INCREMENT2;
- eval $CHILD2_2_AUTO_INCREMENT_OFFSET2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- if ($USE_REPLICATION)
- {
- save_master_pos;
- --connection slave1_1
- sync_with_master;
- --connection master_1
- --disable_query_log
- SET SESSION sql_log_bin= 0;
- --enable_query_log
- }
- --disable_warnings
- DROP TABLE IF EXISTS t1, t2;
- --enable_warnings
- --disable_query_log
- echo CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1;
- echo CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1;
- echo MASTER_1_AUTO_INCREMENT_INCREMENT2;
- echo MASTER_1_AUTO_INCREMENT_OFFSET2;
- eval CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_P_1;
- eval CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_P_1;
- eval $MASTER_1_AUTO_INCREMENT_INCREMENT2;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET2;
- if ($USE_REPLICATION)
- {
- SET SESSION sql_log_bin= 1;
- --connection slave1_1
- --disable_warnings
- DROP TABLE IF EXISTS t1, t2;
- --enable_warnings
- echo CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1;
- echo CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1;
- eval CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1;
- eval CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1;
- --connection master_1
- }
- --enable_query_log
- INSERT INTO t1 () VALUES ();
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t1;
- INSERT INTO t2 () VALUES ();
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t2;
- --disable_query_log
- echo MASTER_1_AUTO_INCREMENT_OFFSET3;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
- --enable_query_log
- INSERT INTO t1 (id) VALUES (null);
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t1;
- --disable_query_log
- echo MASTER_1_AUTO_INCREMENT_OFFSET4;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
- --enable_query_log
- INSERT INTO t2 (id) VALUES (null);
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t2;
- --disable_query_log
- echo MASTER_1_AUTO_INCREMENT_OFFSET3;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
- --enable_query_log
- INSERT INTO t1 () VALUES (),(),(),();
- SELECT LAST_INSERT_ID();
- SELECT id FROM t1 ORDER BY id;
- --disable_query_log
- echo MASTER_1_AUTO_INCREMENT_OFFSET4;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
- --enable_query_log
- INSERT INTO t2 () VALUES (),(),(),();
- SELECT LAST_INSERT_ID();
- SELECT id FROM t2 ORDER BY id;
- TRUNCATE TABLE t1;
- TRUNCATE TABLE t2;
- INSERT INTO t1 () VALUES (),(),(),();
- SELECT LAST_INSERT_ID();
- SELECT id FROM t1 ORDER BY id;
- INSERT INTO t2 () VALUES (),(),(),();
- SELECT LAST_INSERT_ID();
- SELECT id FROM t2 ORDER BY id;
- SET INSERT_ID=5000;
- --disable_query_log
- echo MASTER_1_AUTO_INCREMENT_OFFSET3;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
- --enable_query_log
- INSERT INTO t1 () VALUES ();
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t1;
- --disable_query_log
- echo MASTER_1_AUTO_INCREMENT_OFFSET4;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
- --enable_query_log
- INSERT INTO t2 () VALUES ();
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t2;
- INSERT INTO t1 (id) VALUES (10000);
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t1;
- INSERT INTO t2 (id) VALUES (1000);
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t2;
- if ($USE_REPLICATION)
- {
- save_master_pos;
- --connection slave1_1
- sync_with_master;
- SELECT id FROM t1 ORDER BY id;
- --connection master_1
- --disable_query_log
- SET SESSION sql_log_bin= 0;
- --enable_query_log
- }
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %';
- }
- eval $CHILD2_1_SELECT_INCREMENT_TABLES1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_AUTO_INCREMENT_INCREMENT1;
- echo CHILD2_1_AUTO_INCREMENT_OFFSET1;
- }
- eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1;
- eval $CHILD2_1_AUTO_INCREMENT_OFFSET1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %';
- }
- eval $CHILD2_2_SELECT_INCREMENT_TABLES1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_2_AUTO_INCREMENT_INCREMENT1;
- echo CHILD2_2_AUTO_INCREMENT_OFFSET1;
- }
- eval $CHILD2_2_AUTO_INCREMENT_INCREMENT1;
- eval $CHILD2_2_AUTO_INCREMENT_OFFSET1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
-}
-
-
---echo
---echo deinit
---disable_warnings
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-if ($USE_REPLICATION)
-{
- --connection slave1_1
- DROP DATABASE IF EXISTS auto_test_local;
-}
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
-}
---disable_query_log
---disable_result_log
---source slave_test_deinit.inc
---source test_deinit.inc
---enable_result_log
---enable_query_log
---enable_warnings
---echo
---echo end of test
+# This test tests for Spider 3.0's bug fixes
+source include/have_log_bin.inc;
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--source slave_test_init.inc
+--enable_result_log
+--enable_query_log
+if (!$HAVE_PARTITION)
+{
+ --disable_query_log
+ --disable_result_log
+ --source slave_test_deinit.inc
+ --source test_deinit.inc
+ --enable_result_log
+ --enable_query_log
+ --enable_warnings
+ skip Test requires partitioning;
+}
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_REPLICATION)
+{
+ --connection slave1_1
+ DROP DATABASE IF EXISTS auto_test_local;
+ CREATE DATABASE auto_test_local;
+ USE auto_test_local;
+}
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ --connection child2_2
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+
+--echo auto_increment with partition
+if ($HAVE_PARTITION)
+{
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_INCREMENT_TABLES1;
+ echo CHILD2_1_CREATE_INCREMENT_TABLES1;
+ echo CHILD2_1_AUTO_INCREMENT_INCREMENT2;
+ echo CHILD2_1_AUTO_INCREMENT_OFFSET2;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_INCREMENT_TABLES1;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_INCREMENT_TABLES1;
+ eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2;
+ eval $CHILD2_1_AUTO_INCREMENT_OFFSET2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_DROP_INCREMENT_TABLES1;
+ echo CHILD2_2_CREATE_INCREMENT_TABLES1;
+ echo CHILD2_2_AUTO_INCREMENT_INCREMENT2;
+ echo CHILD2_2_AUTO_INCREMENT_OFFSET2;
+ }
+ --disable_warnings
+ eval $CHILD2_2_DROP_INCREMENT_TABLES1;
+ --enable_warnings
+ eval $CHILD2_2_CREATE_INCREMENT_TABLES1;
+ eval $CHILD2_2_AUTO_INCREMENT_INCREMENT2;
+ eval $CHILD2_2_AUTO_INCREMENT_OFFSET2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ if ($USE_REPLICATION)
+ {
+ save_master_pos;
+ --connection slave1_1
+ sync_with_master;
+ --connection master_1
+ --disable_query_log
+ SET SESSION sql_log_bin= 0;
+ --enable_query_log
+ }
+ --disable_warnings
+ DROP TABLE IF EXISTS t1, t2;
+ --enable_warnings
+ --disable_query_log
+ echo CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1;
+ echo CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1;
+ echo MASTER_1_AUTO_INCREMENT_INCREMENT2;
+ echo MASTER_1_AUTO_INCREMENT_OFFSET2;
+ eval CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_P_1;
+ eval CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_P_1;
+ eval $MASTER_1_AUTO_INCREMENT_INCREMENT2;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET2;
+ if ($USE_REPLICATION)
+ {
+ SET SESSION sql_log_bin= 1;
+ --connection slave1_1
+ --disable_warnings
+ DROP TABLE IF EXISTS t1, t2;
+ --enable_warnings
+ echo CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1;
+ echo CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1;
+ eval CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1;
+ eval CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1;
+ --connection master_1
+ }
+ --enable_query_log
+ INSERT INTO t1 () VALUES ();
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t1;
+ INSERT INTO t2 () VALUES ();
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t2;
+ --disable_query_log
+ echo MASTER_1_AUTO_INCREMENT_OFFSET3;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
+ --enable_query_log
+ INSERT INTO t1 (id) VALUES (null);
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t1;
+ --disable_query_log
+ echo MASTER_1_AUTO_INCREMENT_OFFSET4;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
+ --enable_query_log
+ INSERT INTO t2 (id) VALUES (null);
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t2;
+ --disable_query_log
+ echo MASTER_1_AUTO_INCREMENT_OFFSET3;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
+ --enable_query_log
+ INSERT INTO t1 () VALUES (),(),(),();
+ SELECT LAST_INSERT_ID();
+ SELECT id FROM t1 ORDER BY id;
+ --disable_query_log
+ echo MASTER_1_AUTO_INCREMENT_OFFSET4;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
+ --enable_query_log
+ INSERT INTO t2 () VALUES (),(),(),();
+ SELECT LAST_INSERT_ID();
+ SELECT id FROM t2 ORDER BY id;
+ TRUNCATE TABLE t1;
+ TRUNCATE TABLE t2;
+ INSERT INTO t1 () VALUES (),(),(),();
+ SELECT LAST_INSERT_ID();
+ SELECT id FROM t1 ORDER BY id;
+ INSERT INTO t2 () VALUES (),(),(),();
+ SELECT LAST_INSERT_ID();
+ SELECT id FROM t2 ORDER BY id;
+ SET INSERT_ID=5000;
+ --disable_query_log
+ echo MASTER_1_AUTO_INCREMENT_OFFSET3;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
+ --enable_query_log
+ INSERT INTO t1 () VALUES ();
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t1;
+ --disable_query_log
+ echo MASTER_1_AUTO_INCREMENT_OFFSET4;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
+ --enable_query_log
+ INSERT INTO t2 () VALUES ();
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t2;
+ INSERT INTO t1 (id) VALUES (10000);
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t1;
+ INSERT INTO t2 (id) VALUES (1000);
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t2;
+ if ($USE_REPLICATION)
+ {
+ save_master_pos;
+ --connection slave1_1
+ sync_with_master;
+ SELECT id FROM t1 ORDER BY id;
+ --connection master_1
+ --disable_query_log
+ SET SESSION sql_log_bin= 0;
+ --enable_query_log
+ }
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %';
+ }
+ eval $CHILD2_1_SELECT_INCREMENT_TABLES1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_AUTO_INCREMENT_INCREMENT1;
+ echo CHILD2_1_AUTO_INCREMENT_OFFSET1;
+ }
+ eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1;
+ eval $CHILD2_1_AUTO_INCREMENT_OFFSET1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %';
+ }
+ eval $CHILD2_2_SELECT_INCREMENT_TABLES1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_AUTO_INCREMENT_INCREMENT1;
+ echo CHILD2_2_AUTO_INCREMENT_OFFSET1;
+ }
+ eval $CHILD2_2_AUTO_INCREMENT_INCREMENT1;
+ eval $CHILD2_2_AUTO_INCREMENT_OFFSET1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+}
+
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_REPLICATION)
+{
+ --connection slave1_1
+ DROP DATABASE IF EXISTS auto_test_local;
+}
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+}
+--disable_query_log
+--disable_result_log
+--source slave_test_deinit.inc
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/include/deinit_child2_1.inc b/storage/spider/mysql-test/spider/include/deinit_child2_1.inc
index cee137a6aeb..6e7fefe5f6f 100644
--- a/storage/spider/mysql-test/spider/include/deinit_child2_1.inc
+++ b/storage/spider/mysql-test/spider/include/deinit_child2_1.inc
@@ -1,3 +1,3 @@
---let $TEST_ENGINE_TYPE= $CHILD2_1_ENGINE_TYPE
---let $INIT_TEST_ENGINE= $INIT_CHILD2_1_ENGINE
---source ../include/deinit_engine.inc
+--let $TEST_ENGINE_TYPE= $CHILD2_1_ENGINE_TYPE
+--let $INIT_TEST_ENGINE= $INIT_CHILD2_1_ENGINE
+--source ../include/deinit_engine.inc
diff --git a/storage/spider/mysql-test/spider/include/deinit_child2_2.inc b/storage/spider/mysql-test/spider/include/deinit_child2_2.inc
index a1f9fe3fb19..0f770f9b800 100644
--- a/storage/spider/mysql-test/spider/include/deinit_child2_2.inc
+++ b/storage/spider/mysql-test/spider/include/deinit_child2_2.inc
@@ -1,3 +1,3 @@
---let $TEST_ENGINE_TYPE= $CHILD2_2_ENGINE_TYPE
---let $INIT_TEST_ENGINE= $INIT_CHILD2_2_ENGINE
---source ../include/deinit_engine.inc
+--let $TEST_ENGINE_TYPE= $CHILD2_2_ENGINE_TYPE
+--let $INIT_TEST_ENGINE= $INIT_CHILD2_2_ENGINE
+--source ../include/deinit_engine.inc
diff --git a/storage/spider/mysql-test/spider/include/deinit_child2_3.inc b/storage/spider/mysql-test/spider/include/deinit_child2_3.inc
index f996a40e786..4ed97224f3f 100644
--- a/storage/spider/mysql-test/spider/include/deinit_child2_3.inc
+++ b/storage/spider/mysql-test/spider/include/deinit_child2_3.inc
@@ -1,3 +1,3 @@
---let $TEST_ENGINE_TYPE= $CHILD2_3_ENGINE_TYPE
---let $INIT_TEST_ENGINE= $INIT_CHILD2_3_ENGINE
---source ../include/deinit_engine.inc
+--let $TEST_ENGINE_TYPE= $CHILD2_3_ENGINE_TYPE
+--let $INIT_TEST_ENGINE= $INIT_CHILD2_3_ENGINE
+--source ../include/deinit_engine.inc
diff --git a/storage/spider/mysql-test/spider/include/deinit_child3_1.inc b/storage/spider/mysql-test/spider/include/deinit_child3_1.inc
index e0e3a4c41f4..079b4b3e157 100644
--- a/storage/spider/mysql-test/spider/include/deinit_child3_1.inc
+++ b/storage/spider/mysql-test/spider/include/deinit_child3_1.inc
@@ -1,3 +1,3 @@
---let $TEST_ENGINE_TYPE= $CHILD3_1_ENGINE_TYPE
---let $INIT_TEST_ENGINE= $INIT_CHILD3_1_ENGINE
---source ../include/deinit_engine.inc
+--let $TEST_ENGINE_TYPE= $CHILD3_1_ENGINE_TYPE
+--let $INIT_TEST_ENGINE= $INIT_CHILD3_1_ENGINE
+--source ../include/deinit_engine.inc
diff --git a/storage/spider/mysql-test/spider/include/deinit_child3_2.inc b/storage/spider/mysql-test/spider/include/deinit_child3_2.inc
index 82eb70d331f..e495bf513db 100644
--- a/storage/spider/mysql-test/spider/include/deinit_child3_2.inc
+++ b/storage/spider/mysql-test/spider/include/deinit_child3_2.inc
@@ -1,3 +1,3 @@
---let $TEST_ENGINE_TYPE= $CHILD3_2_ENGINE_TYPE
---let $INIT_TEST_ENGINE= $INIT_CHILD3_2_ENGINE
---source ../include/deinit_engine.inc
+--let $TEST_ENGINE_TYPE= $CHILD3_2_ENGINE_TYPE
+--let $INIT_TEST_ENGINE= $INIT_CHILD3_2_ENGINE
+--source ../include/deinit_engine.inc
diff --git a/storage/spider/mysql-test/spider/include/deinit_child3_3.inc b/storage/spider/mysql-test/spider/include/deinit_child3_3.inc
index 3741ef76c3c..b197faa0e0f 100644
--- a/storage/spider/mysql-test/spider/include/deinit_child3_3.inc
+++ b/storage/spider/mysql-test/spider/include/deinit_child3_3.inc
@@ -1,3 +1,3 @@
---let $TEST_ENGINE_TYPE= $CHILD3_3_ENGINE_TYPE
---let $INIT_TEST_ENGINE= $INIT_CHILD3_3_ENGINE
---source ../include/deinit_engine.inc
+--let $TEST_ENGINE_TYPE= $CHILD3_3_ENGINE_TYPE
+--let $INIT_TEST_ENGINE= $INIT_CHILD3_3_ENGINE
+--source ../include/deinit_engine.inc
diff --git a/storage/spider/mysql-test/spider/include/deinit_engine.inc b/storage/spider/mysql-test/spider/include/deinit_engine.inc
index f3b6b3189f5..e7bdab411c4 100644
--- a/storage/spider/mysql-test/spider/include/deinit_engine.inc
+++ b/storage/spider/mysql-test/spider/include/deinit_engine.inc
@@ -1,4 +1,4 @@
-if ($INIT_TEST_ENGINE)
-{
- --echo Deinit $TEST_ENGINE_TYPE engine
-}
+if ($INIT_TEST_ENGINE)
+{
+ --echo Deinit $TEST_ENGINE_TYPE engine
+}
diff --git a/storage/spider/mysql-test/spider/include/ha_deinit_child3_1.inc b/storage/spider/mysql-test/spider/include/ha_deinit_child3_1.inc
index f5f7db7e3fa..482c8013734 100644
--- a/storage/spider/mysql-test/spider/include/ha_deinit_child3_1.inc
+++ b/storage/spider/mysql-test/spider/include/ha_deinit_child3_1.inc
@@ -1 +1 @@
---source ../include/deinit_spider.inc
+--source ../include/deinit_spider.inc
diff --git a/storage/spider/mysql-test/spider/include/ha_deinit_child3_2.inc b/storage/spider/mysql-test/spider/include/ha_deinit_child3_2.inc
index f5f7db7e3fa..482c8013734 100644
--- a/storage/spider/mysql-test/spider/include/ha_deinit_child3_2.inc
+++ b/storage/spider/mysql-test/spider/include/ha_deinit_child3_2.inc
@@ -1 +1 @@
---source ../include/deinit_spider.inc
+--source ../include/deinit_spider.inc
diff --git a/storage/spider/mysql-test/spider/include/ha_deinit_child3_3.inc b/storage/spider/mysql-test/spider/include/ha_deinit_child3_3.inc
index f5f7db7e3fa..482c8013734 100644
--- a/storage/spider/mysql-test/spider/include/ha_deinit_child3_3.inc
+++ b/storage/spider/mysql-test/spider/include/ha_deinit_child3_3.inc
@@ -1 +1 @@
---source ../include/deinit_spider.inc
+--source ../include/deinit_spider.inc
diff --git a/storage/spider/mysql-test/spider/include/ha_init_child2_1.inc b/storage/spider/mysql-test/spider/include/ha_init_child2_1.inc
index 59c0175d349..2684829408d 100644
--- a/storage/spider/mysql-test/spider/include/ha_init_child2_1.inc
+++ b/storage/spider/mysql-test/spider/include/ha_init_child2_1.inc
@@ -1,8 +1,8 @@
-let $CHILD2_1_HA_AS_DROP_TABLES=
- $CHILD2_1_DROP_TABLES;
-let $CHILD2_1_HA_AS_CREATE_TABLES=
- $CHILD2_1_CREATE_TABLES;
-let $CHILD2_1_HA_AS_DROP_TABLES2=
- $CHILD2_1_DROP_TABLES2;
-let $CHILD2_1_HA_AS_CREATE_TABLES2=
- $CHILD2_1_CREATE_TABLES2;
+let $CHILD2_1_HA_AS_DROP_TABLES=
+ $CHILD2_1_DROP_TABLES;
+let $CHILD2_1_HA_AS_CREATE_TABLES=
+ $CHILD2_1_CREATE_TABLES;
+let $CHILD2_1_HA_AS_DROP_TABLES2=
+ $CHILD2_1_DROP_TABLES2;
+let $CHILD2_1_HA_AS_CREATE_TABLES2=
+ $CHILD2_1_CREATE_TABLES2;
diff --git a/storage/spider/mysql-test/spider/include/ha_init_child2_2.inc b/storage/spider/mysql-test/spider/include/ha_init_child2_2.inc
index 90d27ed704d..205eaa6fe35 100644
--- a/storage/spider/mysql-test/spider/include/ha_init_child2_2.inc
+++ b/storage/spider/mysql-test/spider/include/ha_init_child2_2.inc
@@ -1,4 +1,4 @@
-let $CHILD2_2_HA_DROP_TABLES=
- $CHILD2_2_DROP_TABLES;
-let $CHILD2_2_HA_CREATE_TABLES=
- $CHILD2_2_CREATE_TABLES;
+let $CHILD2_2_HA_DROP_TABLES=
+ $CHILD2_2_DROP_TABLES;
+let $CHILD2_2_HA_CREATE_TABLES=
+ $CHILD2_2_CREATE_TABLES;
diff --git a/storage/spider/mysql-test/spider/include/ha_init_child2_3.inc b/storage/spider/mysql-test/spider/include/ha_init_child2_3.inc
index 11abf112b1f..55cb858372c 100644
--- a/storage/spider/mysql-test/spider/include/ha_init_child2_3.inc
+++ b/storage/spider/mysql-test/spider/include/ha_init_child2_3.inc
@@ -1,4 +1,4 @@
-let $CHILD2_3_HA_DROP_TABLES=
- $CHILD2_3_DROP_TABLES;
-let $CHILD2_3_HA_CREATE_TABLES=
- $CHILD2_3_CREATE_TABLES;
+let $CHILD2_3_HA_DROP_TABLES=
+ $CHILD2_3_DROP_TABLES;
+let $CHILD2_3_HA_CREATE_TABLES=
+ $CHILD2_3_CREATE_TABLES;
diff --git a/storage/spider/mysql-test/spider/include/ha_init_child3_1.inc b/storage/spider/mysql-test/spider/include/ha_init_child3_1.inc
index 67f6676a07a..8357f0bdbc2 100644
--- a/storage/spider/mysql-test/spider/include/ha_init_child3_1.inc
+++ b/storage/spider/mysql-test/spider/include/ha_init_child3_1.inc
@@ -1,140 +1,140 @@
---let $CHILD3_1_ENGINE_TYPE=Spider
---let $CHILD3_1_ENGINE=ENGINE=Spider
---source ../include/init_spider.inc
-eval INSERT INTO mysql.spider_link_mon_servers
-(db_name, table_name, link_id, sid, server, scheme, host, port, socket,
- username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key,
- ssl_verify_server_cert, default_file, default_group) VALUES
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
-let $CHILD3_1_CHECK_LINK_STATUS=
- SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
- ORDER BY db_name, table_name, link_id;
-let $CHILD3_1_CHECK_LINK_FAILED_LOG=
- SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
-let $CHILD3_1_SET_RECOVERY_STATUS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2", lst "0 2"';
-let $CHILD3_1_SET_OK_STATUS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2", lst "0 1"';
-let $CHILD3_1_SET_OK_STATUS_AS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2", lst "1 0"';
-
-let $CHILD3_1_DROP_TABLES_HA_2_1=
- DROP TABLE IF EXISTS ta_l;
-if ($VERSION_COMPILE_OS_WIN)
-{
- let $CHILD3_1_CREATE_TABLES_HA_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
- COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2"';
- let $CHILD3_1_CREATE_TABLES_HA_AS_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
- COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2"';
-}
-if (!$VERSION_COMPILE_OS_WIN)
-{
- let $CHILD3_1_CREATE_TABLES_HA_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
- COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2"';
- let $CHILD3_1_CREATE_TABLES_HA_AS_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
- COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2"';
-}
-let $CHILD3_1_DROP_TABLES_HA_P_2_1=
- DROP TABLE IF EXISTS ta_l2;
-let $CHILD3_1_CREATE_TABLES_HA_P_2_1=
- CREATE TABLE ta_l2 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
- COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"'
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001"'
- );
-let $CHILD3_1_CREATE_TABLES_HA_AS_P_2_1=
- CREATE TABLE ta_l2 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
- COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"'
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001"'
- );
-let $CHILD3_1_SET_RECOVERY_STATUS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 2"'
- );
-let $CHILD3_1_SET_OK_STATUS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 1"'
- );
-let $CHILD3_1_SET_OK_STATUS_AS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "1 0"'
- );
+--let $CHILD3_1_ENGINE_TYPE=Spider
+--let $CHILD3_1_ENGINE=ENGINE=Spider
+--source ../include/init_spider.inc
+eval INSERT INTO mysql.spider_link_mon_servers
+(db_name, table_name, link_id, sid, server, scheme, host, port, socket,
+ username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key,
+ ssl_verify_server_cert, default_file, default_group) VALUES
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
+let $CHILD3_1_CHECK_LINK_STATUS=
+ SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
+ ORDER BY db_name, table_name, link_id;
+let $CHILD3_1_CHECK_LINK_FAILED_LOG=
+ SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
+let $CHILD3_1_SET_RECOVERY_STATUS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 2"';
+let $CHILD3_1_SET_OK_STATUS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 1"';
+let $CHILD3_1_SET_OK_STATUS_AS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2", lst "1 0"';
+
+let $CHILD3_1_DROP_TABLES_HA_2_1=
+ DROP TABLE IF EXISTS ta_l;
+if ($VERSION_COMPILE_OS_WIN)
+{
+ let $CHILD3_1_CREATE_TABLES_HA_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
+ COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2"';
+ let $CHILD3_1_CREATE_TABLES_HA_AS_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
+ COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2"';
+}
+if (!$VERSION_COMPILE_OS_WIN)
+{
+ let $CHILD3_1_CREATE_TABLES_HA_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
+ COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2"';
+ let $CHILD3_1_CREATE_TABLES_HA_AS_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
+ COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2"';
+}
+let $CHILD3_1_DROP_TABLES_HA_P_2_1=
+ DROP TABLE IF EXISTS ta_l2;
+let $CHILD3_1_CREATE_TABLES_HA_P_2_1=
+ CREATE TABLE ta_l2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
+ COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"'
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001"'
+ );
+let $CHILD3_1_CREATE_TABLES_HA_AS_P_2_1=
+ CREATE TABLE ta_l2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
+ COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"'
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001"'
+ );
+let $CHILD3_1_SET_RECOVERY_STATUS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 2"'
+ );
+let $CHILD3_1_SET_OK_STATUS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 1"'
+ );
+let $CHILD3_1_SET_OK_STATUS_AS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "1 0"'
+ );
diff --git a/storage/spider/mysql-test/spider/include/ha_init_child3_2.inc b/storage/spider/mysql-test/spider/include/ha_init_child3_2.inc
index 9b61a2e2b73..3ffcec24f51 100644
--- a/storage/spider/mysql-test/spider/include/ha_init_child3_2.inc
+++ b/storage/spider/mysql-test/spider/include/ha_init_child3_2.inc
@@ -1,140 +1,140 @@
---let $CHILD3_2_ENGINE_TYPE=Spider
---let $CHILD3_2_ENGINE=ENGINE=Spider
---source ../include/init_spider.inc
-eval INSERT INTO mysql.spider_link_mon_servers
-(db_name, table_name, link_id, sid, server, scheme, host, port, socket,
- username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key,
- ssl_verify_server_cert, default_file, default_group) VALUES
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
-let $CHILD3_2_CHECK_LINK_STATUS=
- SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
- ORDER BY db_name, table_name, link_id;
-let $CHILD3_2_CHECK_LINK_FAILED_LOG=
- SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
-let $CHILD3_2_SET_RECOVERY_STATUS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2", lst "0 2"';
-let $CHILD3_2_SET_OK_STATUS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2", lst "0 1"';
-let $CHILD3_2_SET_OK_STATUS_AS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2", lst "1 0"';
-
-let $CHILD3_2_DROP_TABLES_HA_2_1=
- DROP TABLE IF EXISTS ta_l;
-if ($VERSION_COMPILE_OS_WIN)
-{
- let $CHILD3_2_CREATE_TABLES_HA_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
- COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2"';
- let $CHILD3_2_CREATE_TABLES_HA_AS_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
- COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2"';
-}
-if (!$VERSION_COMPILE_OS_WIN)
-{
- let $CHILD3_2_CREATE_TABLES_HA_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
- COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2"';
- let $CHILD3_2_CREATE_TABLES_HA_AS_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
- COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2"';
-}
-let $CHILD3_2_DROP_TABLES_HA_P_2_1=
- DROP TABLE IF EXISTS ta_l2;
-let $CHILD3_2_CREATE_TABLES_HA_P_2_1=
- CREATE TABLE ta_l2 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
- COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"'
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001"'
- );
-let $CHILD3_2_CREATE_TABLES_HA_AS_P_2_1=
- CREATE TABLE ta_l2 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
- COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"'
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001"'
- );
-let $CHILD3_2_SET_RECOVERY_STATUS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 2"'
- );
-let $CHILD3_2_SET_OK_STATUS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 1"'
- );
-let $CHILD3_2_SET_OK_STATUS_AS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "1 0"'
- );
+--let $CHILD3_2_ENGINE_TYPE=Spider
+--let $CHILD3_2_ENGINE=ENGINE=Spider
+--source ../include/init_spider.inc
+eval INSERT INTO mysql.spider_link_mon_servers
+(db_name, table_name, link_id, sid, server, scheme, host, port, socket,
+ username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key,
+ ssl_verify_server_cert, default_file, default_group) VALUES
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
+let $CHILD3_2_CHECK_LINK_STATUS=
+ SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
+ ORDER BY db_name, table_name, link_id;
+let $CHILD3_2_CHECK_LINK_FAILED_LOG=
+ SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
+let $CHILD3_2_SET_RECOVERY_STATUS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 2"';
+let $CHILD3_2_SET_OK_STATUS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 1"';
+let $CHILD3_2_SET_OK_STATUS_AS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2", lst "1 0"';
+
+let $CHILD3_2_DROP_TABLES_HA_2_1=
+ DROP TABLE IF EXISTS ta_l;
+if ($VERSION_COMPILE_OS_WIN)
+{
+ let $CHILD3_2_CREATE_TABLES_HA_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
+ COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2"';
+ let $CHILD3_2_CREATE_TABLES_HA_AS_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
+ COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2"';
+}
+if (!$VERSION_COMPILE_OS_WIN)
+{
+ let $CHILD3_2_CREATE_TABLES_HA_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
+ COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2"';
+ let $CHILD3_2_CREATE_TABLES_HA_AS_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
+ COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2"';
+}
+let $CHILD3_2_DROP_TABLES_HA_P_2_1=
+ DROP TABLE IF EXISTS ta_l2;
+let $CHILD3_2_CREATE_TABLES_HA_P_2_1=
+ CREATE TABLE ta_l2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
+ COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"'
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001"'
+ );
+let $CHILD3_2_CREATE_TABLES_HA_AS_P_2_1=
+ CREATE TABLE ta_l2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
+ COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"'
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001"'
+ );
+let $CHILD3_2_SET_RECOVERY_STATUS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 2"'
+ );
+let $CHILD3_2_SET_OK_STATUS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 1"'
+ );
+let $CHILD3_2_SET_OK_STATUS_AS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "1 0"'
+ );
diff --git a/storage/spider/mysql-test/spider/include/ha_init_child3_3.inc b/storage/spider/mysql-test/spider/include/ha_init_child3_3.inc
index 5724a50b3d9..67bd00109f5 100644
--- a/storage/spider/mysql-test/spider/include/ha_init_child3_3.inc
+++ b/storage/spider/mysql-test/spider/include/ha_init_child3_3.inc
@@ -1,140 +1,140 @@
---let $CHILD3_3_ENGINE_TYPE=Spider
---let $CHILD3_3_ENGINE=ENGINE=Spider
---source ../include/init_spider.inc
-eval INSERT INTO mysql.spider_link_mon_servers
-(db_name, table_name, link_id, sid, server, scheme, host, port, socket,
- username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key,
- ssl_verify_server_cert, default_file, default_group) VALUES
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
-let $CHILD3_3_CHECK_LINK_STATUS=
- SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
- ORDER BY db_name, table_name, link_id;
-let $CHILD3_3_CHECK_LINK_FAILED_LOG=
- SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
-let $CHILD3_3_SET_RECOVERY_STATUS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2", lst "0 2"';
-let $CHILD3_3_SET_OK_STATUS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2", lst "0 1"';
-let $CHILD3_3_SET_OK_STATUS_AS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2", lst "1 0"';
-
-let $CHILD3_3_DROP_TABLES_HA_2_1=
- DROP TABLE IF EXISTS ta_l;
-if ($VERSION_COMPILE_OS_WIN)
-{
- let $CHILD3_3_CREATE_TABLES_HA_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
- COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2"';
- let $CHILD3_3_CREATE_TABLES_HA_AS_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
- COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2"';
-}
-if (!$VERSION_COMPILE_OS_WIN)
-{
- let $CHILD3_3_CREATE_TABLES_HA_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
- COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2"';
- let $CHILD3_3_CREATE_TABLES_HA_AS_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
- COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2"';
-}
-let $CHILD3_3_DROP_TABLES_HA_P_2_1=
- DROP TABLE IF EXISTS ta_l2;
-let $CHILD3_3_CREATE_TABLES_HA_P_2_1=
- CREATE TABLE ta_l2 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
- COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"'
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001"'
- );
-let $CHILD3_3_CREATE_TABLES_HA_AS_P_2_1=
- CREATE TABLE ta_l2 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
- COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"'
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001"'
- );
-let $CHILD3_3_SET_RECOVERY_STATUS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 2"'
- );
-let $CHILD3_3_SET_OK_STATUS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 1"'
- );
-let $CHILD3_3_SET_OK_STATUS_AS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "1 0"'
- );
+--let $CHILD3_3_ENGINE_TYPE=Spider
+--let $CHILD3_3_ENGINE=ENGINE=Spider
+--source ../include/init_spider.inc
+eval INSERT INTO mysql.spider_link_mon_servers
+(db_name, table_name, link_id, sid, server, scheme, host, port, socket,
+ username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key,
+ ssl_verify_server_cert, default_file, default_group) VALUES
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
+let $CHILD3_3_CHECK_LINK_STATUS=
+ SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
+ ORDER BY db_name, table_name, link_id;
+let $CHILD3_3_CHECK_LINK_FAILED_LOG=
+ SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
+let $CHILD3_3_SET_RECOVERY_STATUS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 2"';
+let $CHILD3_3_SET_OK_STATUS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 1"';
+let $CHILD3_3_SET_OK_STATUS_AS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2", lst "1 0"';
+
+let $CHILD3_3_DROP_TABLES_HA_2_1=
+ DROP TABLE IF EXISTS ta_l;
+if ($VERSION_COMPILE_OS_WIN)
+{
+ let $CHILD3_3_CREATE_TABLES_HA_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
+ COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2"';
+ let $CHILD3_3_CREATE_TABLES_HA_AS_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
+ COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2"';
+}
+if (!$VERSION_COMPILE_OS_WIN)
+{
+ let $CHILD3_3_CREATE_TABLES_HA_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
+ COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2"';
+ let $CHILD3_3_CREATE_TABLES_HA_AS_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
+ COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2"';
+}
+let $CHILD3_3_DROP_TABLES_HA_P_2_1=
+ DROP TABLE IF EXISTS ta_l2;
+let $CHILD3_3_CREATE_TABLES_HA_P_2_1=
+ CREATE TABLE ta_l2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
+ COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"'
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001"'
+ );
+let $CHILD3_3_CREATE_TABLES_HA_AS_P_2_1=
+ CREATE TABLE ta_l2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
+ COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"'
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001"'
+ );
+let $CHILD3_3_SET_RECOVERY_STATUS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 2"'
+ );
+let $CHILD3_3_SET_OK_STATUS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 1"'
+ );
+let $CHILD3_3_SET_OK_STATUS_AS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "1 0"'
+ );
diff --git a/storage/spider/mysql-test/spider/include/hs_init_child2_1.inc b/storage/spider/mysql-test/spider/include/hs_init_child2_1.inc
index 2ea1c0c9cd6..ee006858b06 100644
--- a/storage/spider/mysql-test/spider/include/hs_init_child2_1.inc
+++ b/storage/spider/mysql-test/spider/include/hs_init_child2_1.inc
@@ -1,24 +1,24 @@
-let $CHILD2_1_HS_DROP_TABLES=
- DROP TABLE IF EXISTS hs_r;
-let $CHILD2_1_HS_CREATE_TABLES=
- CREATE TABLE hs_r (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- d INT DEFAULT 11,
- PRIMARY KEY(a)
- ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
-let $CHILD2_1_HS_SELECT_TABLES=
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s'), d FROM hs_r ORDER BY a;
-let $CHILD2_1_HS_DROP_TABLES2=
- DROP TABLE IF EXISTS hs_r2;
-let $CHILD2_1_HS_CREATE_TABLES2=
- CREATE TABLE hs_r2 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- d INT DEFAULT 11,
- PRIMARY KEY(a)
- ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
-let $CHILD2_1_HS_SELECT_TABLES2=
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s'), d FROM hs_r2 ORDER BY a;
+let $CHILD2_1_HS_DROP_TABLES=
+ DROP TABLE IF EXISTS hs_r;
+let $CHILD2_1_HS_CREATE_TABLES=
+ CREATE TABLE hs_r (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ d INT DEFAULT 11,
+ PRIMARY KEY(a)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_HS_SELECT_TABLES=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s'), d FROM hs_r ORDER BY a;
+let $CHILD2_1_HS_DROP_TABLES2=
+ DROP TABLE IF EXISTS hs_r2;
+let $CHILD2_1_HS_CREATE_TABLES2=
+ CREATE TABLE hs_r2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ d INT DEFAULT 11,
+ PRIMARY KEY(a)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_HS_SELECT_TABLES2=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s'), d FROM hs_r2 ORDER BY a;
diff --git a/storage/spider/mysql-test/spider/include/hs_init_child2_2.inc b/storage/spider/mysql-test/spider/include/hs_init_child2_2.inc
index 7c69d73ced6..1c5a02d50c8 100644
--- a/storage/spider/mysql-test/spider/include/hs_init_child2_2.inc
+++ b/storage/spider/mysql-test/spider/include/hs_init_child2_2.inc
@@ -1,12 +1,12 @@
-let $CHILD2_2_HS_DROP_TABLES=
- DROP TABLE IF EXISTS hs_r3;
-let $CHILD2_2_HS_CREATE_TABLES=
- CREATE TABLE hs_r3 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- d INT DEFAULT 11,
- PRIMARY KEY(a)
- ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
-let $CHILD2_2_HS_SELECT_TABLES=
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s'), d FROM hs_r3 ORDER BY a;
+let $CHILD2_2_HS_DROP_TABLES=
+ DROP TABLE IF EXISTS hs_r3;
+let $CHILD2_2_HS_CREATE_TABLES=
+ CREATE TABLE hs_r3 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ d INT DEFAULT 11,
+ PRIMARY KEY(a)
+ ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
+let $CHILD2_2_HS_SELECT_TABLES=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s'), d FROM hs_r3 ORDER BY a;
diff --git a/storage/spider/mysql-test/spider/include/init_child2_1.inc b/storage/spider/mysql-test/spider/include/init_child2_1.inc
index ff4e1666ee1..10793649f94 100644
--- a/storage/spider/mysql-test/spider/include/init_child2_1.inc
+++ b/storage/spider/mysql-test/spider/include/init_child2_1.inc
@@ -1,178 +1,178 @@
---let $TEST_ENGINE_TYPE= $CHILD2_1_ENGINE_TYPE
---source ../include/init_engine.inc
---let $INIT_CHILD2_1_ENGINE= $INIT_TEST_ENGINE
-let $CHILD2_1_DROP_TABLES=
- DROP TABLE IF EXISTS ta_r;
-let $CHILD2_1_CREATE_TABLES=
- CREATE TABLE ta_r (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a),
- KEY idx1(b)
- ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
-let $CHILD2_1_SELECT_TABLES=
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
-let $CHILD2_1_DROP_TABLES2=
- DROP TABLE IF EXISTS ta_r2;
-let $CHILD2_1_CREATE_TABLES2=
- CREATE TABLE ta_r2 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
-let $CHILD2_1_SELECT_TABLES2=
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r2 ORDER BY a;
-let $CHILD2_1_DROP_TABLES3=
- DROP TABLE IF EXISTS ta_r_no_idx;
-let $CHILD2_1_CREATE_TABLES3=
- CREATE TABLE ta_r_no_idx (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10'
- ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
-let $CHILD2_1_SELECT_TABLES3=
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r_no_idx ORDER BY a;
-let $CHILD2_1_DROP_TABLES4=
- DROP TABLE IF EXISTS ta_r_auto_inc;
-let $CHILD2_1_CREATE_TABLES4=
- CREATE TABLE ta_r_auto_inc (
- a INT AUTO_INCREMENT,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
-let $CHILD2_1_SELECT_TABLES4=
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r_auto_inc
- ORDER BY a;
-let $CHILD2_1_DROP_TABLES5=
- DROP TABLE IF EXISTS ta_r_int;
-let $CHILD2_1_CREATE_TABLES5=
- CREATE TABLE ta_r_int (
- a INT AUTO_INCREMENT,
- b INT DEFAULT 10,
- c INT DEFAULT 11,
- PRIMARY KEY(a),
- KEY idx1(b),
- KEY idx2(c)
- ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
-let $CHILD2_1_SELECT_TABLES5=
- SELECT a, b, c FROM ta_r_int ORDER BY a;
-let $CHILD2_1_DROP_TABLES6=
- DROP TABLE IF EXISTS ta_r_3;
-let $CHILD2_1_CREATE_TABLES6=
- CREATE TABLE ta_r_3 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10'
- ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
-let $CHILD2_1_SELECT_TABLES6=
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r_3 ORDER BY a;
-let $CHILD2_1_DROP_FT_TABLES=
- DROP TABLE IF EXISTS ft_r;
-let $CHILD2_1_CREATE_FT_TABLES=
- CREATE TABLE ft_r (
- a INT DEFAULT 0,
- b TEXT,
- c TEXT,
- d TEXT,
- PRIMARY KEY(a),
- FULLTEXT INDEX ft_idx1(b),
- FULLTEXT INDEX ft_idx2(c)
- ) $CHILD2_1_FT_ENGINE $CHILD2_1_FT_CHARSET;
-let $CHILD2_1_SELECT_FT_TABLES=
- SELECT a, b, c, d FROM ft_r ORDER BY a;
-let $CHILD2_1_DROP_FT_TABLES2=
- DROP TABLE IF EXISTS ft_r2;
-let $CHILD2_1_CREATE_FT_TABLES2=
- CREATE TABLE ft_r2 (
- a INT DEFAULT 0,
- b TEXT,
- c TEXT,
- d TEXT,
- PRIMARY KEY(a),
- FULLTEXT INDEX ft_idx1(b),
- FULLTEXT INDEX ft_idx2(c)
- ) $CHILD2_1_FT_ENGINE $CHILD2_1_FT_CHARSET;
-let $CHILD2_1_SELECT_FT_TABLES2=
- SELECT a, b, c, d FROM ft_r2 ORDER BY a;
-let $CHILD2_1_DROP_GM_TABLES=
- DROP TABLE IF EXISTS gm_r;
-let $CHILD2_1_CREATE_GM_TABLES=
- CREATE TABLE gm_r (
- a INT DEFAULT 0,
- b GEOMETRY NOT NULL,
- c GEOMETRY NOT NULL,
- PRIMARY KEY(a),
- SPATIAL INDEX sp_idx1(b),
- SPATIAL INDEX sp_idx2(c)
- ) $CHILD2_1_GM_ENGINE $CHILD2_1_GM_CHARSET;
-let $CHILD2_1_SELECT_GM_TABLES=
- SELECT a, b, c FROM gm_r ORDER BY a;
-let $CHILD2_1_DROP_GM_TABLES2=
- DROP TABLE IF EXISTS gm_r2;
-let $CHILD2_1_CREATE_GM_TABLES2=
- CREATE TABLE gm_r2 (
- a INT DEFAULT 0,
- b GEOMETRY NOT NULL,
- c GEOMETRY NOT NULL,
- PRIMARY KEY(a),
- SPATIAL INDEX sp_idx1(b),
- SPATIAL INDEX sp_idx2(c)
- ) $CHILD2_1_GM_ENGINE $CHILD2_1_GM_CHARSET;
-let $CHILD2_1_SELECT_GM_TABLES2=
- SELECT a, b, c FROM gm_r2 ORDER BY a;
-let $CHILD2_1_DROP_LOCK_TABLES1=
- DROP TABLE IF EXISTS t1_1;
-let $CHILD2_1_CREATE_LOCK_TABLES1=
- CREATE TABLE t1_1 (
- id int(11) NOT NULL,
- PRIMARY KEY (id)
- ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
-let $CHILD2_1_DROP_LOCK_TABLES2=
- DROP TABLE IF EXISTS t2_2;
-let $CHILD2_1_CREATE_LOCK_TABLES2=
- CREATE TABLE t2_2 (
- id int(11) NOT NULL,
- PRIMARY KEY (id)
- ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
-let $CHILD2_1_DROP_INCREMENT_TABLES1=
- DROP TABLE IF EXISTS t1_1;
-let $CHILD2_1_CREATE_INCREMENT_TABLES1=
- CREATE TABLE t1_1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
-let $CHILD2_1_SELECT_INCREMENT_TABLES1=
- SELECT id FROM t1_1 ORDER BY id;
-let $CHILD2_1_DROP_TEXT_PK_TABLES1=
- DROP TABLE IF EXISTS t1;
-let $CHILD2_1_CREATE_TEXT_PK_TABLES1=
- CREATE TABLE t1 (
- a VARCHAR(255),
- PRIMARY KEY (a)
- ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET2;
-let $CHILD2_1_SELECT_TEXT_PK_TABLES1=
- SELECT a FROM t1 ORDER BY a;
-let $CHILD2_1_DROP_TEXT_KEY_TABLES1=
- DROP TABLE IF EXISTS t1;
-let $CHILD2_1_CREATE_TEXT_KEY_TABLES1=
- CREATE TABLE t1 (
- a VARCHAR(255),
- b VARCHAR(255),
- c VARCHAR(255),
- KEY idx1(a,b),
- KEY idx2(b),
- PRIMARY KEY(c)
- ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
-let $CHILD2_1_SELECT_TEXT_KEY_TABLES1=
- SELECT a, b FROM t1 ORDER BY a, b;
-let $CHILD2_1_AUTO_INCREMENT_INCREMENT1=
- SET GLOBAL AUTO_INCREMENT_INCREMENT = 1;
-let $CHILD2_1_AUTO_INCREMENT_INCREMENT2=
- SET GLOBAL AUTO_INCREMENT_INCREMENT = 4;
-let $CHILD2_1_AUTO_INCREMENT_OFFSET1=
- SET GLOBAL AUTO_INCREMENT_OFFSET = 1;
-let $CHILD2_1_AUTO_INCREMENT_OFFSET2=
- SET GLOBAL AUTO_INCREMENT_OFFSET = 2;
+--let $TEST_ENGINE_TYPE= $CHILD2_1_ENGINE_TYPE
+--source ../include/init_engine.inc
+--let $INIT_CHILD2_1_ENGINE= $INIT_TEST_ENGINE
+let $CHILD2_1_DROP_TABLES=
+ DROP TABLE IF EXISTS ta_r;
+let $CHILD2_1_CREATE_TABLES=
+ CREATE TABLE ta_r (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a),
+ KEY idx1(b)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_SELECT_TABLES=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
+let $CHILD2_1_DROP_TABLES2=
+ DROP TABLE IF EXISTS ta_r2;
+let $CHILD2_1_CREATE_TABLES2=
+ CREATE TABLE ta_r2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_SELECT_TABLES2=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r2 ORDER BY a;
+let $CHILD2_1_DROP_TABLES3=
+ DROP TABLE IF EXISTS ta_r_no_idx;
+let $CHILD2_1_CREATE_TABLES3=
+ CREATE TABLE ta_r_no_idx (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_SELECT_TABLES3=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r_no_idx ORDER BY a;
+let $CHILD2_1_DROP_TABLES4=
+ DROP TABLE IF EXISTS ta_r_auto_inc;
+let $CHILD2_1_CREATE_TABLES4=
+ CREATE TABLE ta_r_auto_inc (
+ a INT AUTO_INCREMENT,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_SELECT_TABLES4=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r_auto_inc
+ ORDER BY a;
+let $CHILD2_1_DROP_TABLES5=
+ DROP TABLE IF EXISTS ta_r_int;
+let $CHILD2_1_CREATE_TABLES5=
+ CREATE TABLE ta_r_int (
+ a INT AUTO_INCREMENT,
+ b INT DEFAULT 10,
+ c INT DEFAULT 11,
+ PRIMARY KEY(a),
+ KEY idx1(b),
+ KEY idx2(c)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_SELECT_TABLES5=
+ SELECT a, b, c FROM ta_r_int ORDER BY a;
+let $CHILD2_1_DROP_TABLES6=
+ DROP TABLE IF EXISTS ta_r_3;
+let $CHILD2_1_CREATE_TABLES6=
+ CREATE TABLE ta_r_3 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_SELECT_TABLES6=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r_3 ORDER BY a;
+let $CHILD2_1_DROP_FT_TABLES=
+ DROP TABLE IF EXISTS ft_r;
+let $CHILD2_1_CREATE_FT_TABLES=
+ CREATE TABLE ft_r (
+ a INT DEFAULT 0,
+ b TEXT,
+ c TEXT,
+ d TEXT,
+ PRIMARY KEY(a),
+ FULLTEXT INDEX ft_idx1(b),
+ FULLTEXT INDEX ft_idx2(c)
+ ) $CHILD2_1_FT_ENGINE $CHILD2_1_FT_CHARSET;
+let $CHILD2_1_SELECT_FT_TABLES=
+ SELECT a, b, c, d FROM ft_r ORDER BY a;
+let $CHILD2_1_DROP_FT_TABLES2=
+ DROP TABLE IF EXISTS ft_r2;
+let $CHILD2_1_CREATE_FT_TABLES2=
+ CREATE TABLE ft_r2 (
+ a INT DEFAULT 0,
+ b TEXT,
+ c TEXT,
+ d TEXT,
+ PRIMARY KEY(a),
+ FULLTEXT INDEX ft_idx1(b),
+ FULLTEXT INDEX ft_idx2(c)
+ ) $CHILD2_1_FT_ENGINE $CHILD2_1_FT_CHARSET;
+let $CHILD2_1_SELECT_FT_TABLES2=
+ SELECT a, b, c, d FROM ft_r2 ORDER BY a;
+let $CHILD2_1_DROP_GM_TABLES=
+ DROP TABLE IF EXISTS gm_r;
+let $CHILD2_1_CREATE_GM_TABLES=
+ CREATE TABLE gm_r (
+ a INT DEFAULT 0,
+ b GEOMETRY NOT NULL,
+ c GEOMETRY NOT NULL,
+ PRIMARY KEY(a),
+ SPATIAL INDEX sp_idx1(b),
+ SPATIAL INDEX sp_idx2(c)
+ ) $CHILD2_1_GM_ENGINE $CHILD2_1_GM_CHARSET;
+let $CHILD2_1_SELECT_GM_TABLES=
+ SELECT a, b, c FROM gm_r ORDER BY a;
+let $CHILD2_1_DROP_GM_TABLES2=
+ DROP TABLE IF EXISTS gm_r2;
+let $CHILD2_1_CREATE_GM_TABLES2=
+ CREATE TABLE gm_r2 (
+ a INT DEFAULT 0,
+ b GEOMETRY NOT NULL,
+ c GEOMETRY NOT NULL,
+ PRIMARY KEY(a),
+ SPATIAL INDEX sp_idx1(b),
+ SPATIAL INDEX sp_idx2(c)
+ ) $CHILD2_1_GM_ENGINE $CHILD2_1_GM_CHARSET;
+let $CHILD2_1_SELECT_GM_TABLES2=
+ SELECT a, b, c FROM gm_r2 ORDER BY a;
+let $CHILD2_1_DROP_LOCK_TABLES1=
+ DROP TABLE IF EXISTS t1_1;
+let $CHILD2_1_CREATE_LOCK_TABLES1=
+ CREATE TABLE t1_1 (
+ id int(11) NOT NULL,
+ PRIMARY KEY (id)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_DROP_LOCK_TABLES2=
+ DROP TABLE IF EXISTS t2_2;
+let $CHILD2_1_CREATE_LOCK_TABLES2=
+ CREATE TABLE t2_2 (
+ id int(11) NOT NULL,
+ PRIMARY KEY (id)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_DROP_INCREMENT_TABLES1=
+ DROP TABLE IF EXISTS t1_1;
+let $CHILD2_1_CREATE_INCREMENT_TABLES1=
+ CREATE TABLE t1_1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_SELECT_INCREMENT_TABLES1=
+ SELECT id FROM t1_1 ORDER BY id;
+let $CHILD2_1_DROP_TEXT_PK_TABLES1=
+ DROP TABLE IF EXISTS t1;
+let $CHILD2_1_CREATE_TEXT_PK_TABLES1=
+ CREATE TABLE t1 (
+ a VARCHAR(255),
+ PRIMARY KEY (a)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET2;
+let $CHILD2_1_SELECT_TEXT_PK_TABLES1=
+ SELECT a FROM t1 ORDER BY a;
+let $CHILD2_1_DROP_TEXT_KEY_TABLES1=
+ DROP TABLE IF EXISTS t1;
+let $CHILD2_1_CREATE_TEXT_KEY_TABLES1=
+ CREATE TABLE t1 (
+ a VARCHAR(255),
+ b VARCHAR(255),
+ c VARCHAR(255),
+ KEY idx1(a,b),
+ KEY idx2(b),
+ PRIMARY KEY(c)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_SELECT_TEXT_KEY_TABLES1=
+ SELECT a, b FROM t1 ORDER BY a, b;
+let $CHILD2_1_AUTO_INCREMENT_INCREMENT1=
+ SET GLOBAL AUTO_INCREMENT_INCREMENT = 1;
+let $CHILD2_1_AUTO_INCREMENT_INCREMENT2=
+ SET GLOBAL AUTO_INCREMENT_INCREMENT = 4;
+let $CHILD2_1_AUTO_INCREMENT_OFFSET1=
+ SET GLOBAL AUTO_INCREMENT_OFFSET = 1;
+let $CHILD2_1_AUTO_INCREMENT_OFFSET2=
+ SET GLOBAL AUTO_INCREMENT_OFFSET = 2;
diff --git a/storage/spider/mysql-test/spider/include/init_child2_2.inc b/storage/spider/mysql-test/spider/include/init_child2_2.inc
index b20783cc42b..5d7227e43ad 100644
--- a/storage/spider/mysql-test/spider/include/init_child2_2.inc
+++ b/storage/spider/mysql-test/spider/include/init_child2_2.inc
@@ -1,83 +1,83 @@
---let $TEST_ENGINE_TYPE= $CHILD2_2_ENGINE_TYPE
---source ../include/init_engine.inc
---let $INIT_CHILD2_2_ENGINE= $INIT_TEST_ENGINE
-let $CHILD2_2_DROP_TABLES=
- DROP TABLE IF EXISTS ta_r3;
-let $CHILD2_2_CREATE_TABLES=
- CREATE TABLE ta_r3 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
-let $CHILD2_2_DROP_TABLES5=
- DROP TABLE IF EXISTS ta_r_int;
-let $CHILD2_2_CREATE_TABLES5=
- CREATE TABLE ta_r_int (
- a INT AUTO_INCREMENT,
- b INT DEFAULT 10,
- c INT DEFAULT 11,
- PRIMARY KEY(a),
- KEY idx1(b),
- KEY idx2(c)
- ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
-let $CHILD2_2_SELECT_TABLES=
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a;
-let $CHILD2_2_DROP_FT_TABLES=
- DROP TABLE IF EXISTS ft_r3;
-let $CHILD2_2_CREATE_FT_TABLES=
- CREATE TABLE ft_r3 (
- a INT DEFAULT 0,
- b TEXT,
- c TEXT,
- d TEXT,
- PRIMARY KEY(a),
- FULLTEXT INDEX ft_idx1(b),
- FULLTEXT INDEX ft_idx2(c)
- ) $CHILD2_2_FT_ENGINE $CHILD2_2_FT_CHARSET;
-let $CHILD2_2_SELECT_FT_TABLES=
- SELECT a, b, c, d FROM ft_r3 ORDER BY a;
-let $CHILD2_2_DROP_GM_TABLES=
- DROP TABLE IF EXISTS gm_r3;
-let $CHILD2_2_CREATE_GM_TABLES=
- CREATE TABLE gm_r3 (
- a INT DEFAULT 0,
- b GEOMETRY NOT NULL,
- c GEOMETRY NOT NULL,
- PRIMARY KEY(a),
- SPATIAL INDEX sp_idx1(b),
- SPATIAL INDEX sp_idx2(c)
- ) $CHILD2_2_GM_ENGINE $CHILD2_2_GM_CHARSET;
-let $CHILD2_2_SELECT_GM_TABLES=
- SELECT a, b, c FROM gm_r3 ORDER BY a;
-let $CHILD2_2_DROP_LOCK_TABLES1=
- DROP TABLE IF EXISTS t1_2;
-let $CHILD2_2_CREATE_LOCK_TABLES1=
- CREATE TABLE t1_2 (
- id int(11) NOT NULL,
- PRIMARY KEY (id)
- ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
-let $CHILD2_2_DROP_LOCK_TABLES2=
- DROP TABLE IF EXISTS t2_1;
-let $CHILD2_2_CREATE_LOCK_TABLES2=
- CREATE TABLE t2_1 (
- id int(11) NOT NULL,
- PRIMARY KEY (id)
- ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
-let $CHILD2_2_DROP_INCREMENT_TABLES1=
- DROP TABLE IF EXISTS t1_2;
-let $CHILD2_2_CREATE_INCREMENT_TABLES1=
- CREATE TABLE t1_2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
-let $CHILD2_2_SELECT_INCREMENT_TABLES1=
- SELECT id FROM t1_2 ORDER BY id;
-let $CHILD2_2_AUTO_INCREMENT_INCREMENT1=
- SET GLOBAL AUTO_INCREMENT_INCREMENT = 1;
-let $CHILD2_2_AUTO_INCREMENT_INCREMENT2=
- SET GLOBAL AUTO_INCREMENT_INCREMENT = 4;
-let $CHILD2_2_AUTO_INCREMENT_OFFSET1=
- SET GLOBAL AUTO_INCREMENT_OFFSET = 1;
-let $CHILD2_2_AUTO_INCREMENT_OFFSET2=
- SET GLOBAL AUTO_INCREMENT_OFFSET = 3;
+--let $TEST_ENGINE_TYPE= $CHILD2_2_ENGINE_TYPE
+--source ../include/init_engine.inc
+--let $INIT_CHILD2_2_ENGINE= $INIT_TEST_ENGINE
+let $CHILD2_2_DROP_TABLES=
+ DROP TABLE IF EXISTS ta_r3;
+let $CHILD2_2_CREATE_TABLES=
+ CREATE TABLE ta_r3 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
+let $CHILD2_2_DROP_TABLES5=
+ DROP TABLE IF EXISTS ta_r_int;
+let $CHILD2_2_CREATE_TABLES5=
+ CREATE TABLE ta_r_int (
+ a INT AUTO_INCREMENT,
+ b INT DEFAULT 10,
+ c INT DEFAULT 11,
+ PRIMARY KEY(a),
+ KEY idx1(b),
+ KEY idx2(c)
+ ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
+let $CHILD2_2_SELECT_TABLES=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a;
+let $CHILD2_2_DROP_FT_TABLES=
+ DROP TABLE IF EXISTS ft_r3;
+let $CHILD2_2_CREATE_FT_TABLES=
+ CREATE TABLE ft_r3 (
+ a INT DEFAULT 0,
+ b TEXT,
+ c TEXT,
+ d TEXT,
+ PRIMARY KEY(a),
+ FULLTEXT INDEX ft_idx1(b),
+ FULLTEXT INDEX ft_idx2(c)
+ ) $CHILD2_2_FT_ENGINE $CHILD2_2_FT_CHARSET;
+let $CHILD2_2_SELECT_FT_TABLES=
+ SELECT a, b, c, d FROM ft_r3 ORDER BY a;
+let $CHILD2_2_DROP_GM_TABLES=
+ DROP TABLE IF EXISTS gm_r3;
+let $CHILD2_2_CREATE_GM_TABLES=
+ CREATE TABLE gm_r3 (
+ a INT DEFAULT 0,
+ b GEOMETRY NOT NULL,
+ c GEOMETRY NOT NULL,
+ PRIMARY KEY(a),
+ SPATIAL INDEX sp_idx1(b),
+ SPATIAL INDEX sp_idx2(c)
+ ) $CHILD2_2_GM_ENGINE $CHILD2_2_GM_CHARSET;
+let $CHILD2_2_SELECT_GM_TABLES=
+ SELECT a, b, c FROM gm_r3 ORDER BY a;
+let $CHILD2_2_DROP_LOCK_TABLES1=
+ DROP TABLE IF EXISTS t1_2;
+let $CHILD2_2_CREATE_LOCK_TABLES1=
+ CREATE TABLE t1_2 (
+ id int(11) NOT NULL,
+ PRIMARY KEY (id)
+ ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
+let $CHILD2_2_DROP_LOCK_TABLES2=
+ DROP TABLE IF EXISTS t2_1;
+let $CHILD2_2_CREATE_LOCK_TABLES2=
+ CREATE TABLE t2_1 (
+ id int(11) NOT NULL,
+ PRIMARY KEY (id)
+ ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
+let $CHILD2_2_DROP_INCREMENT_TABLES1=
+ DROP TABLE IF EXISTS t1_2;
+let $CHILD2_2_CREATE_INCREMENT_TABLES1=
+ CREATE TABLE t1_2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
+let $CHILD2_2_SELECT_INCREMENT_TABLES1=
+ SELECT id FROM t1_2 ORDER BY id;
+let $CHILD2_2_AUTO_INCREMENT_INCREMENT1=
+ SET GLOBAL AUTO_INCREMENT_INCREMENT = 1;
+let $CHILD2_2_AUTO_INCREMENT_INCREMENT2=
+ SET GLOBAL AUTO_INCREMENT_INCREMENT = 4;
+let $CHILD2_2_AUTO_INCREMENT_OFFSET1=
+ SET GLOBAL AUTO_INCREMENT_OFFSET = 1;
+let $CHILD2_2_AUTO_INCREMENT_OFFSET2=
+ SET GLOBAL AUTO_INCREMENT_OFFSET = 3;
diff --git a/storage/spider/mysql-test/spider/include/init_child2_3.inc b/storage/spider/mysql-test/spider/include/init_child2_3.inc
index 4e8d289bdc9..0ae240626fe 100644
--- a/storage/spider/mysql-test/spider/include/init_child2_3.inc
+++ b/storage/spider/mysql-test/spider/include/init_child2_3.inc
@@ -1,14 +1,14 @@
---let $TEST_ENGINE_TYPE= $CHILD2_3_ENGINE_TYPE
---source ../include/init_engine.inc
---let $INIT_CHILD2_3_ENGINE= $INIT_TEST_ENGINE
-let $CHILD2_3_DROP_TABLES=
- DROP TABLE IF EXISTS ta_r4;
-let $CHILD2_3_CREATE_TABLES=
- CREATE TABLE ta_r4 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD2_3_ENGINE $CHILD2_3_CHARSET;
-let $CHILD2_3_SELECT_TABLES=
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r4 ORDER BY a;
+--let $TEST_ENGINE_TYPE= $CHILD2_3_ENGINE_TYPE
+--source ../include/init_engine.inc
+--let $INIT_CHILD2_3_ENGINE= $INIT_TEST_ENGINE
+let $CHILD2_3_DROP_TABLES=
+ DROP TABLE IF EXISTS ta_r4;
+let $CHILD2_3_CREATE_TABLES=
+ CREATE TABLE ta_r4 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD2_3_ENGINE $CHILD2_3_CHARSET;
+let $CHILD2_3_SELECT_TABLES=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r4 ORDER BY a;
diff --git a/storage/spider/mysql-test/spider/include/init_child3_1.inc b/storage/spider/mysql-test/spider/include/init_child3_1.inc
index 7e4c05d9500..0c83d926cfe 100644
--- a/storage/spider/mysql-test/spider/include/init_child3_1.inc
+++ b/storage/spider/mysql-test/spider/include/init_child3_1.inc
@@ -1,3 +1,3 @@
---let $TEST_ENGINE_TYPE= $CHILD3_1_ENGINE_TYPE
---source ../include/init_engine.inc
---let $INIT_CHILD3_1_ENGINE= $INIT_TEST_ENGINE
+--let $TEST_ENGINE_TYPE= $CHILD3_1_ENGINE_TYPE
+--source ../include/init_engine.inc
+--let $INIT_CHILD3_1_ENGINE= $INIT_TEST_ENGINE
diff --git a/storage/spider/mysql-test/spider/include/init_child3_2.inc b/storage/spider/mysql-test/spider/include/init_child3_2.inc
index 246a7985984..29abb5c8493 100644
--- a/storage/spider/mysql-test/spider/include/init_child3_2.inc
+++ b/storage/spider/mysql-test/spider/include/init_child3_2.inc
@@ -1,3 +1,3 @@
---let $TEST_ENGINE_TYPE= $CHILD3_2_ENGINE_TYPE
---source ../include/init_engine.inc
---let $INIT_CHILD3_2_ENGINE= $INIT_TEST_ENGINE
+--let $TEST_ENGINE_TYPE= $CHILD3_2_ENGINE_TYPE
+--source ../include/init_engine.inc
+--let $INIT_CHILD3_2_ENGINE= $INIT_TEST_ENGINE
diff --git a/storage/spider/mysql-test/spider/include/init_child3_3.inc b/storage/spider/mysql-test/spider/include/init_child3_3.inc
index a0e5fdf6981..9fee4d34f98 100644
--- a/storage/spider/mysql-test/spider/include/init_child3_3.inc
+++ b/storage/spider/mysql-test/spider/include/init_child3_3.inc
@@ -1,3 +1,3 @@
---let $TEST_ENGINE_TYPE= $CHILD3_3_ENGINE_TYPE
---source ../include/init_engine.inc
---let $INIT_CHILD3_3_ENGINE= $INIT_TEST_ENGINE
+--let $TEST_ENGINE_TYPE= $CHILD3_3_ENGINE_TYPE
+--source ../include/init_engine.inc
+--let $INIT_CHILD3_3_ENGINE= $INIT_TEST_ENGINE
diff --git a/storage/spider/mysql-test/spider/include/init_slave1_1.inc b/storage/spider/mysql-test/spider/include/init_slave1_1.inc
index 87c05f1f690..73c3c6b9ef2 100644
--- a/storage/spider/mysql-test/spider/include/init_slave1_1.inc
+++ b/storage/spider/mysql-test/spider/include/init_slave1_1.inc
@@ -1,10 +1,10 @@
-let $SLAVE1_1_COMMENT_INCREMENT1_1=
- COMMENT '';
-let $SLAVE1_1_COMMENT_INCREMENT1_P_1=
- COMMENT ''
- PARTITION BY LIST(MOD(id, 2)) (
- PARTITION pt1 VALUES IN (0)
- COMMENT='',
- PARTITION pt2 VALUES IN (1)
- COMMENT=''
- );
+let $SLAVE1_1_COMMENT_INCREMENT1_1=
+ COMMENT '';
+let $SLAVE1_1_COMMENT_INCREMENT1_P_1=
+ COMMENT ''
+ PARTITION BY LIST(MOD(id, 2)) (
+ PARTITION pt1 VALUES IN (0)
+ COMMENT='',
+ PARTITION pt2 VALUES IN (1)
+ COMMENT=''
+ );
diff --git a/storage/spider/mysql-test/spider/oracle/include/deinit_child3_1.inc b/storage/spider/mysql-test/spider/oracle/include/deinit_child3_1.inc
index 9b6a9851ccb..74c8efa90aa 100644
--- a/storage/spider/mysql-test/spider/oracle/include/deinit_child3_1.inc
+++ b/storage/spider/mysql-test/spider/oracle/include/deinit_child3_1.inc
@@ -1,3 +1,3 @@
---let $TEST_ENGINE_TYPE= $CHILD3_1_ENGINE_TYPE
---let $INIT_TEST_ENGINE= $INIT_CHILD3_1_ENGINE
---source ../../include/deinit_engine.inc
+--let $TEST_ENGINE_TYPE= $CHILD3_1_ENGINE_TYPE
+--let $INIT_TEST_ENGINE= $INIT_CHILD3_1_ENGINE
+--source ../../include/deinit_engine.inc
diff --git a/storage/spider/mysql-test/spider/oracle/include/deinit_child3_2.inc b/storage/spider/mysql-test/spider/oracle/include/deinit_child3_2.inc
index ac0bcdaa938..f42a980ad23 100644
--- a/storage/spider/mysql-test/spider/oracle/include/deinit_child3_2.inc
+++ b/storage/spider/mysql-test/spider/oracle/include/deinit_child3_2.inc
@@ -1,3 +1,3 @@
---let $TEST_ENGINE_TYPE= $CHILD3_2_ENGINE_TYPE
---let $INIT_TEST_ENGINE= $INIT_CHILD3_2_ENGINE
---source ../../include/deinit_engine.inc
+--let $TEST_ENGINE_TYPE= $CHILD3_2_ENGINE_TYPE
+--let $INIT_TEST_ENGINE= $INIT_CHILD3_2_ENGINE
+--source ../../include/deinit_engine.inc
diff --git a/storage/spider/mysql-test/spider/oracle/include/deinit_child3_3.inc b/storage/spider/mysql-test/spider/oracle/include/deinit_child3_3.inc
index c93a9822d90..0696fb991cf 100644
--- a/storage/spider/mysql-test/spider/oracle/include/deinit_child3_3.inc
+++ b/storage/spider/mysql-test/spider/oracle/include/deinit_child3_3.inc
@@ -1,3 +1,3 @@
---let $TEST_ENGINE_TYPE= $CHILD3_3_ENGINE_TYPE
---let $INIT_TEST_ENGINE= $INIT_CHILD3_3_ENGINE
---source ../../include/deinit_engine.inc
+--let $TEST_ENGINE_TYPE= $CHILD3_3_ENGINE_TYPE
+--let $INIT_TEST_ENGINE= $INIT_CHILD3_3_ENGINE
+--source ../../include/deinit_engine.inc
diff --git a/storage/spider/mysql-test/spider/oracle/include/ha_deinit_child3_1.inc b/storage/spider/mysql-test/spider/oracle/include/ha_deinit_child3_1.inc
index 8fd2ff8a777..c19e376d10a 100644
--- a/storage/spider/mysql-test/spider/oracle/include/ha_deinit_child3_1.inc
+++ b/storage/spider/mysql-test/spider/oracle/include/ha_deinit_child3_1.inc
@@ -1 +1 @@
---source ../../include/deinit_spider.inc
+--source ../../include/deinit_spider.inc
diff --git a/storage/spider/mysql-test/spider/oracle/include/ha_deinit_child3_2.inc b/storage/spider/mysql-test/spider/oracle/include/ha_deinit_child3_2.inc
index 8fd2ff8a777..c19e376d10a 100644
--- a/storage/spider/mysql-test/spider/oracle/include/ha_deinit_child3_2.inc
+++ b/storage/spider/mysql-test/spider/oracle/include/ha_deinit_child3_2.inc
@@ -1 +1 @@
---source ../../include/deinit_spider.inc
+--source ../../include/deinit_spider.inc
diff --git a/storage/spider/mysql-test/spider/oracle/include/ha_deinit_child3_3.inc b/storage/spider/mysql-test/spider/oracle/include/ha_deinit_child3_3.inc
index 8fd2ff8a777..c19e376d10a 100644
--- a/storage/spider/mysql-test/spider/oracle/include/ha_deinit_child3_3.inc
+++ b/storage/spider/mysql-test/spider/oracle/include/ha_deinit_child3_3.inc
@@ -1 +1 @@
---source ../../include/deinit_spider.inc
+--source ../../include/deinit_spider.inc
diff --git a/storage/spider/mysql-test/spider/oracle/include/ha_init_child2_1.inc b/storage/spider/mysql-test/spider/oracle/include/ha_init_child2_1.inc
index 59c0175d349..2684829408d 100644
--- a/storage/spider/mysql-test/spider/oracle/include/ha_init_child2_1.inc
+++ b/storage/spider/mysql-test/spider/oracle/include/ha_init_child2_1.inc
@@ -1,8 +1,8 @@
-let $CHILD2_1_HA_AS_DROP_TABLES=
- $CHILD2_1_DROP_TABLES;
-let $CHILD2_1_HA_AS_CREATE_TABLES=
- $CHILD2_1_CREATE_TABLES;
-let $CHILD2_1_HA_AS_DROP_TABLES2=
- $CHILD2_1_DROP_TABLES2;
-let $CHILD2_1_HA_AS_CREATE_TABLES2=
- $CHILD2_1_CREATE_TABLES2;
+let $CHILD2_1_HA_AS_DROP_TABLES=
+ $CHILD2_1_DROP_TABLES;
+let $CHILD2_1_HA_AS_CREATE_TABLES=
+ $CHILD2_1_CREATE_TABLES;
+let $CHILD2_1_HA_AS_DROP_TABLES2=
+ $CHILD2_1_DROP_TABLES2;
+let $CHILD2_1_HA_AS_CREATE_TABLES2=
+ $CHILD2_1_CREATE_TABLES2;
diff --git a/storage/spider/mysql-test/spider/oracle/include/ha_init_child2_2.inc b/storage/spider/mysql-test/spider/oracle/include/ha_init_child2_2.inc
index 90d27ed704d..205eaa6fe35 100644
--- a/storage/spider/mysql-test/spider/oracle/include/ha_init_child2_2.inc
+++ b/storage/spider/mysql-test/spider/oracle/include/ha_init_child2_2.inc
@@ -1,4 +1,4 @@
-let $CHILD2_2_HA_DROP_TABLES=
- $CHILD2_2_DROP_TABLES;
-let $CHILD2_2_HA_CREATE_TABLES=
- $CHILD2_2_CREATE_TABLES;
+let $CHILD2_2_HA_DROP_TABLES=
+ $CHILD2_2_DROP_TABLES;
+let $CHILD2_2_HA_CREATE_TABLES=
+ $CHILD2_2_CREATE_TABLES;
diff --git a/storage/spider/mysql-test/spider/oracle/include/ha_init_child2_3.inc b/storage/spider/mysql-test/spider/oracle/include/ha_init_child2_3.inc
index 11abf112b1f..55cb858372c 100644
--- a/storage/spider/mysql-test/spider/oracle/include/ha_init_child2_3.inc
+++ b/storage/spider/mysql-test/spider/oracle/include/ha_init_child2_3.inc
@@ -1,4 +1,4 @@
-let $CHILD2_3_HA_DROP_TABLES=
- $CHILD2_3_DROP_TABLES;
-let $CHILD2_3_HA_CREATE_TABLES=
- $CHILD2_3_CREATE_TABLES;
+let $CHILD2_3_HA_DROP_TABLES=
+ $CHILD2_3_DROP_TABLES;
+let $CHILD2_3_HA_CREATE_TABLES=
+ $CHILD2_3_CREATE_TABLES;
diff --git a/storage/spider/mysql-test/spider/oracle/include/ha_init_child3_1.inc b/storage/spider/mysql-test/spider/oracle/include/ha_init_child3_1.inc
index 67f6676a07a..8357f0bdbc2 100644
--- a/storage/spider/mysql-test/spider/oracle/include/ha_init_child3_1.inc
+++ b/storage/spider/mysql-test/spider/oracle/include/ha_init_child3_1.inc
@@ -1,140 +1,140 @@
---let $CHILD3_1_ENGINE_TYPE=Spider
---let $CHILD3_1_ENGINE=ENGINE=Spider
---source ../include/init_spider.inc
-eval INSERT INTO mysql.spider_link_mon_servers
-(db_name, table_name, link_id, sid, server, scheme, host, port, socket,
- username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key,
- ssl_verify_server_cert, default_file, default_group) VALUES
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
-let $CHILD3_1_CHECK_LINK_STATUS=
- SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
- ORDER BY db_name, table_name, link_id;
-let $CHILD3_1_CHECK_LINK_FAILED_LOG=
- SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
-let $CHILD3_1_SET_RECOVERY_STATUS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2", lst "0 2"';
-let $CHILD3_1_SET_OK_STATUS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2", lst "0 1"';
-let $CHILD3_1_SET_OK_STATUS_AS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2", lst "1 0"';
-
-let $CHILD3_1_DROP_TABLES_HA_2_1=
- DROP TABLE IF EXISTS ta_l;
-if ($VERSION_COMPILE_OS_WIN)
-{
- let $CHILD3_1_CREATE_TABLES_HA_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
- COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2"';
- let $CHILD3_1_CREATE_TABLES_HA_AS_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
- COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2"';
-}
-if (!$VERSION_COMPILE_OS_WIN)
-{
- let $CHILD3_1_CREATE_TABLES_HA_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
- COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2"';
- let $CHILD3_1_CREATE_TABLES_HA_AS_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
- COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2"';
-}
-let $CHILD3_1_DROP_TABLES_HA_P_2_1=
- DROP TABLE IF EXISTS ta_l2;
-let $CHILD3_1_CREATE_TABLES_HA_P_2_1=
- CREATE TABLE ta_l2 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
- COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"'
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001"'
- );
-let $CHILD3_1_CREATE_TABLES_HA_AS_P_2_1=
- CREATE TABLE ta_l2 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
- COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"'
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001"'
- );
-let $CHILD3_1_SET_RECOVERY_STATUS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 2"'
- );
-let $CHILD3_1_SET_OK_STATUS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 1"'
- );
-let $CHILD3_1_SET_OK_STATUS_AS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "1 0"'
- );
+--let $CHILD3_1_ENGINE_TYPE=Spider
+--let $CHILD3_1_ENGINE=ENGINE=Spider
+--source ../include/init_spider.inc
+eval INSERT INTO mysql.spider_link_mon_servers
+(db_name, table_name, link_id, sid, server, scheme, host, port, socket,
+ username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key,
+ ssl_verify_server_cert, default_file, default_group) VALUES
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
+let $CHILD3_1_CHECK_LINK_STATUS=
+ SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
+ ORDER BY db_name, table_name, link_id;
+let $CHILD3_1_CHECK_LINK_FAILED_LOG=
+ SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
+let $CHILD3_1_SET_RECOVERY_STATUS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 2"';
+let $CHILD3_1_SET_OK_STATUS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 1"';
+let $CHILD3_1_SET_OK_STATUS_AS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2", lst "1 0"';
+
+let $CHILD3_1_DROP_TABLES_HA_2_1=
+ DROP TABLE IF EXISTS ta_l;
+if ($VERSION_COMPILE_OS_WIN)
+{
+ let $CHILD3_1_CREATE_TABLES_HA_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
+ COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2"';
+ let $CHILD3_1_CREATE_TABLES_HA_AS_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
+ COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2"';
+}
+if (!$VERSION_COMPILE_OS_WIN)
+{
+ let $CHILD3_1_CREATE_TABLES_HA_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
+ COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2"';
+ let $CHILD3_1_CREATE_TABLES_HA_AS_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
+ COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2"';
+}
+let $CHILD3_1_DROP_TABLES_HA_P_2_1=
+ DROP TABLE IF EXISTS ta_l2;
+let $CHILD3_1_CREATE_TABLES_HA_P_2_1=
+ CREATE TABLE ta_l2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
+ COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"'
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001"'
+ );
+let $CHILD3_1_CREATE_TABLES_HA_AS_P_2_1=
+ CREATE TABLE ta_l2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
+ COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"'
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001"'
+ );
+let $CHILD3_1_SET_RECOVERY_STATUS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 2"'
+ );
+let $CHILD3_1_SET_OK_STATUS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 1"'
+ );
+let $CHILD3_1_SET_OK_STATUS_AS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "1 0"'
+ );
diff --git a/storage/spider/mysql-test/spider/oracle/include/ha_init_child3_2.inc b/storage/spider/mysql-test/spider/oracle/include/ha_init_child3_2.inc
index 9b61a2e2b73..3ffcec24f51 100644
--- a/storage/spider/mysql-test/spider/oracle/include/ha_init_child3_2.inc
+++ b/storage/spider/mysql-test/spider/oracle/include/ha_init_child3_2.inc
@@ -1,140 +1,140 @@
---let $CHILD3_2_ENGINE_TYPE=Spider
---let $CHILD3_2_ENGINE=ENGINE=Spider
---source ../include/init_spider.inc
-eval INSERT INTO mysql.spider_link_mon_servers
-(db_name, table_name, link_id, sid, server, scheme, host, port, socket,
- username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key,
- ssl_verify_server_cert, default_file, default_group) VALUES
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
-let $CHILD3_2_CHECK_LINK_STATUS=
- SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
- ORDER BY db_name, table_name, link_id;
-let $CHILD3_2_CHECK_LINK_FAILED_LOG=
- SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
-let $CHILD3_2_SET_RECOVERY_STATUS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2", lst "0 2"';
-let $CHILD3_2_SET_OK_STATUS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2", lst "0 1"';
-let $CHILD3_2_SET_OK_STATUS_AS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2", lst "1 0"';
-
-let $CHILD3_2_DROP_TABLES_HA_2_1=
- DROP TABLE IF EXISTS ta_l;
-if ($VERSION_COMPILE_OS_WIN)
-{
- let $CHILD3_2_CREATE_TABLES_HA_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
- COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2"';
- let $CHILD3_2_CREATE_TABLES_HA_AS_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
- COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2"';
-}
-if (!$VERSION_COMPILE_OS_WIN)
-{
- let $CHILD3_2_CREATE_TABLES_HA_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
- COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2"';
- let $CHILD3_2_CREATE_TABLES_HA_AS_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
- COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2"';
-}
-let $CHILD3_2_DROP_TABLES_HA_P_2_1=
- DROP TABLE IF EXISTS ta_l2;
-let $CHILD3_2_CREATE_TABLES_HA_P_2_1=
- CREATE TABLE ta_l2 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
- COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"'
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001"'
- );
-let $CHILD3_2_CREATE_TABLES_HA_AS_P_2_1=
- CREATE TABLE ta_l2 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
- COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"'
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001"'
- );
-let $CHILD3_2_SET_RECOVERY_STATUS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 2"'
- );
-let $CHILD3_2_SET_OK_STATUS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 1"'
- );
-let $CHILD3_2_SET_OK_STATUS_AS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "1 0"'
- );
+--let $CHILD3_2_ENGINE_TYPE=Spider
+--let $CHILD3_2_ENGINE=ENGINE=Spider
+--source ../include/init_spider.inc
+eval INSERT INTO mysql.spider_link_mon_servers
+(db_name, table_name, link_id, sid, server, scheme, host, port, socket,
+ username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key,
+ ssl_verify_server_cert, default_file, default_group) VALUES
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
+let $CHILD3_2_CHECK_LINK_STATUS=
+ SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
+ ORDER BY db_name, table_name, link_id;
+let $CHILD3_2_CHECK_LINK_FAILED_LOG=
+ SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
+let $CHILD3_2_SET_RECOVERY_STATUS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 2"';
+let $CHILD3_2_SET_OK_STATUS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 1"';
+let $CHILD3_2_SET_OK_STATUS_AS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2", lst "1 0"';
+
+let $CHILD3_2_DROP_TABLES_HA_2_1=
+ DROP TABLE IF EXISTS ta_l;
+if ($VERSION_COMPILE_OS_WIN)
+{
+ let $CHILD3_2_CREATE_TABLES_HA_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
+ COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2"';
+ let $CHILD3_2_CREATE_TABLES_HA_AS_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
+ COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2"';
+}
+if (!$VERSION_COMPILE_OS_WIN)
+{
+ let $CHILD3_2_CREATE_TABLES_HA_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
+ COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2"';
+ let $CHILD3_2_CREATE_TABLES_HA_AS_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
+ COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2"';
+}
+let $CHILD3_2_DROP_TABLES_HA_P_2_1=
+ DROP TABLE IF EXISTS ta_l2;
+let $CHILD3_2_CREATE_TABLES_HA_P_2_1=
+ CREATE TABLE ta_l2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
+ COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"'
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001"'
+ );
+let $CHILD3_2_CREATE_TABLES_HA_AS_P_2_1=
+ CREATE TABLE ta_l2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
+ COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"'
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001"'
+ );
+let $CHILD3_2_SET_RECOVERY_STATUS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 2"'
+ );
+let $CHILD3_2_SET_OK_STATUS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 1"'
+ );
+let $CHILD3_2_SET_OK_STATUS_AS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "1 0"'
+ );
diff --git a/storage/spider/mysql-test/spider/oracle/include/ha_init_child3_3.inc b/storage/spider/mysql-test/spider/oracle/include/ha_init_child3_3.inc
index 5724a50b3d9..67bd00109f5 100644
--- a/storage/spider/mysql-test/spider/oracle/include/ha_init_child3_3.inc
+++ b/storage/spider/mysql-test/spider/oracle/include/ha_init_child3_3.inc
@@ -1,140 +1,140 @@
---let $CHILD3_3_ENGINE_TYPE=Spider
---let $CHILD3_3_ENGINE=ENGINE=Spider
---source ../include/init_spider.inc
-eval INSERT INTO mysql.spider_link_mon_servers
-(db_name, table_name, link_id, sid, server, scheme, host, port, socket,
- username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key,
- ssl_verify_server_cert, default_file, default_group) VALUES
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
-let $CHILD3_3_CHECK_LINK_STATUS=
- SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
- ORDER BY db_name, table_name, link_id;
-let $CHILD3_3_CHECK_LINK_FAILED_LOG=
- SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
-let $CHILD3_3_SET_RECOVERY_STATUS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2", lst "0 2"';
-let $CHILD3_3_SET_OK_STATUS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2", lst "0 1"';
-let $CHILD3_3_SET_OK_STATUS_AS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2", lst "1 0"';
-
-let $CHILD3_3_DROP_TABLES_HA_2_1=
- DROP TABLE IF EXISTS ta_l;
-if ($VERSION_COMPILE_OS_WIN)
-{
- let $CHILD3_3_CREATE_TABLES_HA_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
- COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2"';
- let $CHILD3_3_CREATE_TABLES_HA_AS_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
- COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2"';
-}
-if (!$VERSION_COMPILE_OS_WIN)
-{
- let $CHILD3_3_CREATE_TABLES_HA_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
- COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2"';
- let $CHILD3_3_CREATE_TABLES_HA_AS_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
- COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2"';
-}
-let $CHILD3_3_DROP_TABLES_HA_P_2_1=
- DROP TABLE IF EXISTS ta_l2;
-let $CHILD3_3_CREATE_TABLES_HA_P_2_1=
- CREATE TABLE ta_l2 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
- COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"'
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001"'
- );
-let $CHILD3_3_CREATE_TABLES_HA_AS_P_2_1=
- CREATE TABLE ta_l2 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
- COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"'
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001"'
- );
-let $CHILD3_3_SET_RECOVERY_STATUS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 2"'
- );
-let $CHILD3_3_SET_OK_STATUS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 1"'
- );
-let $CHILD3_3_SET_OK_STATUS_AS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "1 0"'
- );
+--let $CHILD3_3_ENGINE_TYPE=Spider
+--let $CHILD3_3_ENGINE=ENGINE=Spider
+--source ../include/init_spider.inc
+eval INSERT INTO mysql.spider_link_mon_servers
+(db_name, table_name, link_id, sid, server, scheme, host, port, socket,
+ username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key,
+ ssl_verify_server_cert, default_file, default_group) VALUES
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
+let $CHILD3_3_CHECK_LINK_STATUS=
+ SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
+ ORDER BY db_name, table_name, link_id;
+let $CHILD3_3_CHECK_LINK_FAILED_LOG=
+ SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
+let $CHILD3_3_SET_RECOVERY_STATUS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 2"';
+let $CHILD3_3_SET_OK_STATUS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 1"';
+let $CHILD3_3_SET_OK_STATUS_AS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2", lst "1 0"';
+
+let $CHILD3_3_DROP_TABLES_HA_2_1=
+ DROP TABLE IF EXISTS ta_l;
+if ($VERSION_COMPILE_OS_WIN)
+{
+ let $CHILD3_3_CREATE_TABLES_HA_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
+ COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2"';
+ let $CHILD3_3_CREATE_TABLES_HA_AS_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
+ COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2"';
+}
+if (!$VERSION_COMPILE_OS_WIN)
+{
+ let $CHILD3_3_CREATE_TABLES_HA_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
+ COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2"';
+ let $CHILD3_3_CREATE_TABLES_HA_AS_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
+ COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2"';
+}
+let $CHILD3_3_DROP_TABLES_HA_P_2_1=
+ DROP TABLE IF EXISTS ta_l2;
+let $CHILD3_3_CREATE_TABLES_HA_P_2_1=
+ CREATE TABLE ta_l2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
+ COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"'
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001"'
+ );
+let $CHILD3_3_CREATE_TABLES_HA_AS_P_2_1=
+ CREATE TABLE ta_l2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
+ COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"'
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001"'
+ );
+let $CHILD3_3_SET_RECOVERY_STATUS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 2"'
+ );
+let $CHILD3_3_SET_OK_STATUS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 1"'
+ );
+let $CHILD3_3_SET_OK_STATUS_AS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "1 0"'
+ );
diff --git a/storage/spider/mysql-test/spider/oracle/include/hs_init_child2_1.inc b/storage/spider/mysql-test/spider/oracle/include/hs_init_child2_1.inc
index e0467b92307..f3f92a61e6f 100644
--- a/storage/spider/mysql-test/spider/oracle/include/hs_init_child2_1.inc
+++ b/storage/spider/mysql-test/spider/oracle/include/hs_init_child2_1.inc
@@ -1,24 +1,24 @@
-let $CHILD2_1_HS_DROP_TABLES=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "hs_r"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_HS_CREATE_TABLES=
- SELECT spider_direct_sql('CREATE TABLE "hs_r" (
- "a" INT DEFAULT 10,
- "b" CHAR(1) DEFAULT \'c\',
- "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'),
- "d" INT DEFAULT 11,
- CONSTRAINT "pk_s_2_1_hs_r" PRIMARY KEY("a")
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_HS_SELECT_TABLES=
- SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\'), "d" FROM "hs_r" ORDER BY "a"', '', 'srv "s_2_1"');
-let $CHILD2_1_HS_DROP_TABLES2=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "hs_r2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_HS_CREATE_TABLES2=
- SELECT spider_direct_sql('CREATE TABLE "hs_r2" (
- "a" INT DEFAULT 10,
- "b" CHAR(1) DEFAULT \'c\',
- "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'),
- "d" INT DEFAULT 11,
- CONSTRAINT "pk_s_2_1_hs_r2" PRIMARY KEY("a")
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_HS_SELECT_TABLES2=
- SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\'), "d" FROM "hs_r2" ORDER BY "a"', '', 'srv "s_2_1"');
+let $CHILD2_1_HS_DROP_TABLES=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "hs_r"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
+let $CHILD2_1_HS_CREATE_TABLES=
+ SELECT spider_direct_sql('CREATE TABLE "hs_r" (
+ "a" INT DEFAULT 10,
+ "b" CHAR(1) DEFAULT \'c\',
+ "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'),
+ "d" INT DEFAULT 11,
+ CONSTRAINT "pk_s_2_1_hs_r" PRIMARY KEY("a")
+ )', '', 'srv "s_2_1"');
+let $CHILD2_1_HS_SELECT_TABLES=
+ SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\'), "d" FROM "hs_r" ORDER BY "a"', '', 'srv "s_2_1"');
+let $CHILD2_1_HS_DROP_TABLES2=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "hs_r2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
+let $CHILD2_1_HS_CREATE_TABLES2=
+ SELECT spider_direct_sql('CREATE TABLE "hs_r2" (
+ "a" INT DEFAULT 10,
+ "b" CHAR(1) DEFAULT \'c\',
+ "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'),
+ "d" INT DEFAULT 11,
+ CONSTRAINT "pk_s_2_1_hs_r2" PRIMARY KEY("a")
+ )', '', 'srv "s_2_1"');
+let $CHILD2_1_HS_SELECT_TABLES2=
+ SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\'), "d" FROM "hs_r2" ORDER BY "a"', '', 'srv "s_2_1"');
diff --git a/storage/spider/mysql-test/spider/oracle/include/hs_init_child2_2.inc b/storage/spider/mysql-test/spider/oracle/include/hs_init_child2_2.inc
index 0466acbc66b..4bd8d49c17c 100644
--- a/storage/spider/mysql-test/spider/oracle/include/hs_init_child2_2.inc
+++ b/storage/spider/mysql-test/spider/oracle/include/hs_init_child2_2.inc
@@ -1,12 +1,12 @@
-let $CHILD2_2_HS_DROP_TABLES=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "hs_r3"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"');
-let $CHILD2_2_HS_CREATE_TABLES=
- SELECT spider_direct_sql('CREATE TABLE "hs_r3" (
- "a" INT DEFAULT 10,
- "b" CHAR(1) DEFAULT \'c\',
- "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'),
- "d" INT DEFAULT 11,
- CONSTRAINT "pk_s_2_2_hs_r3" PRIMARY KEY("a")
- )', '', 'srv "s_2_2"');
-let $CHILD2_2_HS_SELECT_TABLES=
- SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\'), "d" FROM "hs_r3" ORDER BY "a"', '', 'srv "s_2_2"');
+let $CHILD2_2_HS_DROP_TABLES=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "hs_r3"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"');
+let $CHILD2_2_HS_CREATE_TABLES=
+ SELECT spider_direct_sql('CREATE TABLE "hs_r3" (
+ "a" INT DEFAULT 10,
+ "b" CHAR(1) DEFAULT \'c\',
+ "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'),
+ "d" INT DEFAULT 11,
+ CONSTRAINT "pk_s_2_2_hs_r3" PRIMARY KEY("a")
+ )', '', 'srv "s_2_2"');
+let $CHILD2_2_HS_SELECT_TABLES=
+ SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\'), "d" FROM "hs_r3" ORDER BY "a"', '', 'srv "s_2_2"');
diff --git a/storage/spider/mysql-test/spider/oracle/include/init_child2_1.inc b/storage/spider/mysql-test/spider/oracle/include/init_child2_1.inc
index 18dcc7159cc..c24736eefca 100644
--- a/storage/spider/mysql-test/spider/oracle/include/init_child2_1.inc
+++ b/storage/spider/mysql-test/spider/oracle/include/init_child2_1.inc
@@ -1,192 +1,192 @@
---connection master_1
-SELECT spider_direct_sql('ALTER SESSION SET NLS_DATE_FORMAT=\'YYYY-MM-DD HH24:MI:SS\'', '', 'srv "s_2_1"');
-SELECT spider_direct_sql('ALTER SESSION SET NLS_TIME_FORMAT=\'HH24:MI:SSXFF\'', '', 'srv "s_2_1"');
-SELECT spider_direct_sql('ALTER SESSION SET NLS_TIMESTAMP_FORMAT=\'YYYY-MM-DD HH24:MI:SSXFF\'', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_TABLES=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_TABLES=
- SELECT spider_direct_sql('CREATE TABLE "ta_r" (
- "a" INT DEFAULT 10,
- "b" CHAR(1) DEFAULT \'c\',
- "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'),
- CONSTRAINT "pk_s_2_1_ta_r" PRIMARY KEY("a")
- )', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE INDEX "idx1" ON "ta_r"("b")', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_TABLES=
- SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r" ORDER BY "a"', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_TABLES2=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_TABLES2=
- SELECT spider_direct_sql('CREATE TABLE "ta_r2" (
- "a" INT DEFAULT 10,
- "b" CHAR(1) DEFAULT \'c\',
- "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'),
- CONSTRAINT "pk_s_2_1_ta_r2" PRIMARY KEY("a")
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_TABLES2=
- SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r2" ORDER BY "a"', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_TABLES3=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r_no_idx"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_TABLES3=
- SELECT spider_direct_sql('CREATE TABLE "ta_r_no_idx" (
- "a" INT DEFAULT 10,
- "b" CHAR(1) DEFAULT \'c\',
- "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\')
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_TABLES3=
- SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r_no_idx" ORDER BY "a"', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_TABLES4=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r_auto_inc"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_TABLES4=
- SELECT spider_direct_sql('CREATE TABLE "ta_r_auto_inc" (
- "a" INT DEFAULT 10,
- "b" CHAR(1) DEFAULT \'c\',
- "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'),
- CONSTRAINT "pk_s_2_1_ta_r_auto_inc" PRIMARY KEY("a")
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_TABLES4=
- SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r_auto_inc"
- ORDER BY "a"', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_TABLES5=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "s_2_1_ta_r_int"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_TABLES5=
- SELECT spider_direct_sql('CREATE TABLE "s_2_1_ta_r_int" (
- "a" INT DEFAULT 3,
- "b" INT DEFAULT 10,
- "c" INT DEFAULT 11,
- CONSTRAINT "pk_s_2_1_ta_r_int" PRIMARY KEY("a")
- )', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE INDEX "idx1_s_2_1_ta_r_int" ON "s_2_1_ta_r_int"("b")', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE INDEX "idx2_s_2_1_ta_r_int" ON "s_2_1_ta_r_int"("c")', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_TABLES5=
- SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "s_2_1_ta_r_int" ORDER BY "a"', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_TABLES6=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r_3"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_TABLES6=
- SELECT spider_direct_sql('CREATE TABLE "ta_r_3" (
- "a" INT DEFAULT 10,
- "b" CHAR(1) DEFAULT \'c\',
- "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\')
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_TABLES6=
- SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r_3" ORDER BY "a"', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_FT_TABLES=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ft_r"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_FT_TABLES=
- SELECT spider_direct_sql('CREATE TABLE "ft_r" (
- "a" INT DEFAULT 0,
- "b" TEXT,
- "c" TEXT,
- "d" TEXT,
- CONSTRAINT "pk_s_2_1_ft_r" PRIMARY KEY("a"),
- FULLTEXT INDEX "ft_idx1"("b"),
- FULLTEXT INDEX "ft_idx2"("c")
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_FT_TABLES=
- SELECT spider_direct_sql('SELECT "a", "b", "c", "d" FROM "ft_r" ORDER BY "a"', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_FT_TABLES2=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ft_r2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_FT_TABLES2=
- SELECT spider_direct_sql('CREATE TABLE "ft_r2" (
- "a" INT DEFAULT 0,
- "b" TEXT,
- "c" TEXT,
- "d" TEXT,
- CONSTRAINT "pk_s_2_1_ft_r2" PRIMARY KEY("a"),
- FULLTEXT INDEX "ft_idx1"("b"),
- FULLTEXT INDEX "ft_idx2"("c")
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_FT_TABLES2=
- SELECT spider_direct_sql('SELECT "a", "b", "c", "d" FROM "ft_r2" ORDER BY "a"', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_GM_TABLES=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "gm_r"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_GM_TABLES=
- SELECT spider_direct_sql('CREATE TABLE "gm_r" (
- "a" INT DEFAULT 0,
- "b" GEOMETRY NOT NULL,
- "c" GEOMETRY NOT NULL,
- CONSTRAINT "pk_s_2_1_gm_r" PRIMARY KEY("a"),
- SPATIAL INDEX "sp_idx1"("b"),
- SPATIAL INDEX "sp_idx2"("c")
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_GM_TABLES=
- SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "gm_r" ORDER BY "a"', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_GM_TABLES2=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "gm_r2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_GM_TABLES2=
- SELECT spider_direct_sql('CREATE TABLE "gm_r2" (
- "a" INT DEFAULT 0,
- "b" GEOMETRY NOT NULL,
- "c" GEOMETRY NOT NULL,
- CONSTRAINT "pk_s_2_1_gm_r2" PRIMARY KEY("a"),
- SPATIAL INDEX "sp_idx1"("b"),
- SPATIAL INDEX "sp_idx2"("c")
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_GM_TABLES2=
- SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "gm_r2" ORDER BY "a"', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_LOCK_TABLES1=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_LOCK_TABLES1=
- SELECT spider_direct_sql('CREATE TABLE "t1_1" (
- "id" INT NOT NULL,
- CONSTRAINT "pk_s_2_1_t1_1" PRIMARY KEY ("id")
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_LOCK_TABLES2=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t2_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_LOCK_TABLES2=
- SELECT spider_direct_sql('CREATE TABLE "t2_2" (
- "id" INT NOT NULL,
- CONSTRAINT "pk_s_2_1_t2_2" PRIMARY KEY ("id")
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_INCREMENT_TABLES1=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_INCREMENT_TABLES1=
- SELECT spider_direct_sql('CREATE TABLE "t1_1" (
- "id" INT NOT NULL,
- CONSTRAINT "pk_s_2_1_t1_1" PRIMARY KEY ("id")
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_INCREMENT_TABLES1=
- SELECT spider_direct_sql('SELECT "id" FROM "t1_1" ORDER BY "id"', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_TEXT_PK_TABLES1=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_TEXT_PK_TABLES1=
- SELECT spider_direct_sql('CREATE TABLE "t1" (
- "a" VARCHAR(255),
- CONSTRAINT "pk_s_2_1_t1" PRIMARY KEY ("a")
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_TEXT_PK_TABLES1=
- SELECT spider_direct_sql('SELECT "a" FROM "t1" ORDER BY "a"', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_TEXT_KEY_TABLES1=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_TEXT_KEY_TABLES1=
- SELECT spider_direct_sql('CREATE TABLE "t1" (
- "a" VARCHAR(255),
- "b" VARCHAR(255),
- "c" VARCHAR(255),
- CONSTRAINT "pk_s_2_1_t1" PRIMARY KEY ("c")
- )', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE INDEX "idx1_t1" ON "t1"("a","b")', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE INDEX "idx2_t1" ON "t1"("b")', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_TEXT_KEY_TABLES1=
- SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "t1" ORDER BY "c"', '', 'srv "s_2_1"');
-let $CHILD2_1_AUTO_INCREMENT_INCREMENT1=
- SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_1"');
-let $CHILD2_1_AUTO_INCREMENT_INCREMENT2=
- SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"');
-let $CHILD2_1_AUTO_INCREMENT_OFFSET1=
- SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_1"');
-let $CHILD2_1_AUTO_INCREMENT_OFFSET2=
- SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"');
+--connection master_1
+SELECT spider_direct_sql('ALTER SESSION SET NLS_DATE_FORMAT=\'YYYY-MM-DD HH24:MI:SS\'', '', 'srv "s_2_1"');
+SELECT spider_direct_sql('ALTER SESSION SET NLS_TIME_FORMAT=\'HH24:MI:SSXFF\'', '', 'srv "s_2_1"');
+SELECT spider_direct_sql('ALTER SESSION SET NLS_TIMESTAMP_FORMAT=\'YYYY-MM-DD HH24:MI:SSXFF\'', '', 'srv "s_2_1"');
+let $CHILD2_1_DROP_TABLES=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
+let $CHILD2_1_CREATE_TABLES=
+ SELECT spider_direct_sql('CREATE TABLE "ta_r" (
+ "a" INT DEFAULT 10,
+ "b" CHAR(1) DEFAULT \'c\',
+ "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'),
+ CONSTRAINT "pk_s_2_1_ta_r" PRIMARY KEY("a")
+ )', '', 'srv "s_2_1"')
+ $STR_SEMICOLON
+ SELECT spider_direct_sql('CREATE INDEX "idx1" ON "ta_r"("b")', '', 'srv "s_2_1"');
+let $CHILD2_1_SELECT_TABLES=
+ SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r" ORDER BY "a"', '', 'srv "s_2_1"');
+let $CHILD2_1_DROP_TABLES2=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
+let $CHILD2_1_CREATE_TABLES2=
+ SELECT spider_direct_sql('CREATE TABLE "ta_r2" (
+ "a" INT DEFAULT 10,
+ "b" CHAR(1) DEFAULT \'c\',
+ "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'),
+ CONSTRAINT "pk_s_2_1_ta_r2" PRIMARY KEY("a")
+ )', '', 'srv "s_2_1"');
+let $CHILD2_1_SELECT_TABLES2=
+ SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r2" ORDER BY "a"', '', 'srv "s_2_1"');
+let $CHILD2_1_DROP_TABLES3=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r_no_idx"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
+let $CHILD2_1_CREATE_TABLES3=
+ SELECT spider_direct_sql('CREATE TABLE "ta_r_no_idx" (
+ "a" INT DEFAULT 10,
+ "b" CHAR(1) DEFAULT \'c\',
+ "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\')
+ )', '', 'srv "s_2_1"');
+let $CHILD2_1_SELECT_TABLES3=
+ SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r_no_idx" ORDER BY "a"', '', 'srv "s_2_1"');
+let $CHILD2_1_DROP_TABLES4=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r_auto_inc"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
+let $CHILD2_1_CREATE_TABLES4=
+ SELECT spider_direct_sql('CREATE TABLE "ta_r_auto_inc" (
+ "a" INT DEFAULT 10,
+ "b" CHAR(1) DEFAULT \'c\',
+ "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'),
+ CONSTRAINT "pk_s_2_1_ta_r_auto_inc" PRIMARY KEY("a")
+ )', '', 'srv "s_2_1"');
+let $CHILD2_1_SELECT_TABLES4=
+ SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r_auto_inc"
+ ORDER BY "a"', '', 'srv "s_2_1"');
+let $CHILD2_1_DROP_TABLES5=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "s_2_1_ta_r_int"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
+let $CHILD2_1_CREATE_TABLES5=
+ SELECT spider_direct_sql('CREATE TABLE "s_2_1_ta_r_int" (
+ "a" INT DEFAULT 3,
+ "b" INT DEFAULT 10,
+ "c" INT DEFAULT 11,
+ CONSTRAINT "pk_s_2_1_ta_r_int" PRIMARY KEY("a")
+ )', '', 'srv "s_2_1"')
+ $STR_SEMICOLON
+ SELECT spider_direct_sql('CREATE INDEX "idx1_s_2_1_ta_r_int" ON "s_2_1_ta_r_int"("b")', '', 'srv "s_2_1"')
+ $STR_SEMICOLON
+ SELECT spider_direct_sql('CREATE INDEX "idx2_s_2_1_ta_r_int" ON "s_2_1_ta_r_int"("c")', '', 'srv "s_2_1"');
+let $CHILD2_1_SELECT_TABLES5=
+ SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "s_2_1_ta_r_int" ORDER BY "a"', '', 'srv "s_2_1"');
+let $CHILD2_1_DROP_TABLES6=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r_3"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
+let $CHILD2_1_CREATE_TABLES6=
+ SELECT spider_direct_sql('CREATE TABLE "ta_r_3" (
+ "a" INT DEFAULT 10,
+ "b" CHAR(1) DEFAULT \'c\',
+ "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\')
+ )', '', 'srv "s_2_1"');
+let $CHILD2_1_SELECT_TABLES6=
+ SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r_3" ORDER BY "a"', '', 'srv "s_2_1"');
+let $CHILD2_1_DROP_FT_TABLES=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ft_r"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
+let $CHILD2_1_CREATE_FT_TABLES=
+ SELECT spider_direct_sql('CREATE TABLE "ft_r" (
+ "a" INT DEFAULT 0,
+ "b" TEXT,
+ "c" TEXT,
+ "d" TEXT,
+ CONSTRAINT "pk_s_2_1_ft_r" PRIMARY KEY("a"),
+ FULLTEXT INDEX "ft_idx1"("b"),
+ FULLTEXT INDEX "ft_idx2"("c")
+ )', '', 'srv "s_2_1"');
+let $CHILD2_1_SELECT_FT_TABLES=
+ SELECT spider_direct_sql('SELECT "a", "b", "c", "d" FROM "ft_r" ORDER BY "a"', '', 'srv "s_2_1"');
+let $CHILD2_1_DROP_FT_TABLES2=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ft_r2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
+let $CHILD2_1_CREATE_FT_TABLES2=
+ SELECT spider_direct_sql('CREATE TABLE "ft_r2" (
+ "a" INT DEFAULT 0,
+ "b" TEXT,
+ "c" TEXT,
+ "d" TEXT,
+ CONSTRAINT "pk_s_2_1_ft_r2" PRIMARY KEY("a"),
+ FULLTEXT INDEX "ft_idx1"("b"),
+ FULLTEXT INDEX "ft_idx2"("c")
+ )', '', 'srv "s_2_1"');
+let $CHILD2_1_SELECT_FT_TABLES2=
+ SELECT spider_direct_sql('SELECT "a", "b", "c", "d" FROM "ft_r2" ORDER BY "a"', '', 'srv "s_2_1"');
+let $CHILD2_1_DROP_GM_TABLES=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "gm_r"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
+let $CHILD2_1_CREATE_GM_TABLES=
+ SELECT spider_direct_sql('CREATE TABLE "gm_r" (
+ "a" INT DEFAULT 0,
+ "b" GEOMETRY NOT NULL,
+ "c" GEOMETRY NOT NULL,
+ CONSTRAINT "pk_s_2_1_gm_r" PRIMARY KEY("a"),
+ SPATIAL INDEX "sp_idx1"("b"),
+ SPATIAL INDEX "sp_idx2"("c")
+ )', '', 'srv "s_2_1"');
+let $CHILD2_1_SELECT_GM_TABLES=
+ SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "gm_r" ORDER BY "a"', '', 'srv "s_2_1"');
+let $CHILD2_1_DROP_GM_TABLES2=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "gm_r2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
+let $CHILD2_1_CREATE_GM_TABLES2=
+ SELECT spider_direct_sql('CREATE TABLE "gm_r2" (
+ "a" INT DEFAULT 0,
+ "b" GEOMETRY NOT NULL,
+ "c" GEOMETRY NOT NULL,
+ CONSTRAINT "pk_s_2_1_gm_r2" PRIMARY KEY("a"),
+ SPATIAL INDEX "sp_idx1"("b"),
+ SPATIAL INDEX "sp_idx2"("c")
+ )', '', 'srv "s_2_1"');
+let $CHILD2_1_SELECT_GM_TABLES2=
+ SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "gm_r2" ORDER BY "a"', '', 'srv "s_2_1"');
+let $CHILD2_1_DROP_LOCK_TABLES1=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
+let $CHILD2_1_CREATE_LOCK_TABLES1=
+ SELECT spider_direct_sql('CREATE TABLE "t1_1" (
+ "id" INT NOT NULL,
+ CONSTRAINT "pk_s_2_1_t1_1" PRIMARY KEY ("id")
+ )', '', 'srv "s_2_1"');
+let $CHILD2_1_DROP_LOCK_TABLES2=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t2_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
+let $CHILD2_1_CREATE_LOCK_TABLES2=
+ SELECT spider_direct_sql('CREATE TABLE "t2_2" (
+ "id" INT NOT NULL,
+ CONSTRAINT "pk_s_2_1_t2_2" PRIMARY KEY ("id")
+ )', '', 'srv "s_2_1"');
+let $CHILD2_1_DROP_INCREMENT_TABLES1=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
+let $CHILD2_1_CREATE_INCREMENT_TABLES1=
+ SELECT spider_direct_sql('CREATE TABLE "t1_1" (
+ "id" INT NOT NULL,
+ CONSTRAINT "pk_s_2_1_t1_1" PRIMARY KEY ("id")
+ )', '', 'srv "s_2_1"');
+let $CHILD2_1_SELECT_INCREMENT_TABLES1=
+ SELECT spider_direct_sql('SELECT "id" FROM "t1_1" ORDER BY "id"', '', 'srv "s_2_1"');
+let $CHILD2_1_DROP_TEXT_PK_TABLES1=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
+let $CHILD2_1_CREATE_TEXT_PK_TABLES1=
+ SELECT spider_direct_sql('CREATE TABLE "t1" (
+ "a" VARCHAR(255),
+ CONSTRAINT "pk_s_2_1_t1" PRIMARY KEY ("a")
+ )', '', 'srv "s_2_1"');
+let $CHILD2_1_SELECT_TEXT_PK_TABLES1=
+ SELECT spider_direct_sql('SELECT "a" FROM "t1" ORDER BY "a"', '', 'srv "s_2_1"');
+let $CHILD2_1_DROP_TEXT_KEY_TABLES1=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
+let $CHILD2_1_CREATE_TEXT_KEY_TABLES1=
+ SELECT spider_direct_sql('CREATE TABLE "t1" (
+ "a" VARCHAR(255),
+ "b" VARCHAR(255),
+ "c" VARCHAR(255),
+ CONSTRAINT "pk_s_2_1_t1" PRIMARY KEY ("c")
+ )', '', 'srv "s_2_1"')
+ $STR_SEMICOLON
+ SELECT spider_direct_sql('CREATE INDEX "idx1_t1" ON "t1"("a","b")', '', 'srv "s_2_1"')
+ $STR_SEMICOLON
+ SELECT spider_direct_sql('CREATE INDEX "idx2_t1" ON "t1"("b")', '', 'srv "s_2_1"');
+let $CHILD2_1_SELECT_TEXT_KEY_TABLES1=
+ SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "t1" ORDER BY "c"', '', 'srv "s_2_1"');
+let $CHILD2_1_AUTO_INCREMENT_INCREMENT1=
+ SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"')
+ $STR_SEMICOLON
+ SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_1"');
+let $CHILD2_1_AUTO_INCREMENT_INCREMENT2=
+ SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"')
+ $STR_SEMICOLON
+ SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"');
+let $CHILD2_1_AUTO_INCREMENT_OFFSET1=
+ SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"')
+ $STR_SEMICOLON
+ SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_1"');
+let $CHILD2_1_AUTO_INCREMENT_OFFSET2=
+ SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"')
+ $STR_SEMICOLON
+ SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"');
diff --git a/storage/spider/mysql-test/spider/oracle/include/init_child2_2.inc b/storage/spider/mysql-test/spider/oracle/include/init_child2_2.inc
index 117040dcca6..fd4497c0b59 100644
--- a/storage/spider/mysql-test/spider/oracle/include/init_child2_2.inc
+++ b/storage/spider/mysql-test/spider/oracle/include/init_child2_2.inc
@@ -1,94 +1,94 @@
---connection master_1
-SELECT spider_direct_sql('ALTER SESSION SET NLS_DATE_FORMAT=\'YYYY-MM-DD HH24:MI:SS\'', '', 'srv "s_2_2"');
-SELECT spider_direct_sql('ALTER SESSION SET NLS_TIME_FORMAT=\'HH24:MI:SSXFF\'', '', 'srv "s_2_2"');
-SELECT spider_direct_sql('ALTER SESSION SET NLS_TIMESTAMP_FORMAT=\'YYYY-MM-DD HH24:MI:SSXFF\'', '', 'srv "s_2_2"');
-let $CHILD2_2_DROP_TABLES=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r3"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"');
-let $CHILD2_2_CREATE_TABLES=
- SELECT spider_direct_sql('CREATE TABLE "ta_r3" (
- "a" INT DEFAULT 10,
- "b" CHAR(1) DEFAULT \'c\',
- "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'),
- CONSTRAINT "pk_s_2_2_ta_r3" PRIMARY KEY("a")
- )', '', 'srv "s_2_2"');
-let $CHILD2_2_DROP_TABLES5=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "s_2_2_ta_r_int"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"');
-let $CHILD2_2_CREATE_TABLES5=
- SELECT spider_direct_sql('CREATE TABLE "s_2_2_ta_r_int" (
- "a" INT DEFAULT 3,
- "b" INT DEFAULT 10,
- "c" INT DEFAULT 11,
- CONSTRAINT "pk_s_2_2_ta_r_int" PRIMARY KEY("a")
- )', '', 'srv "s_2_2"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE INDEX "idx1_s_2_2_ta_r_int" ON "s_2_2_ta_r_int"("b")', '', 'srv "s_2_2"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE INDEX "idx2_s_2_2_ta_r_int" ON "s_2_2_ta_r_int"("c")', '', 'srv "s_2_2"');
-let $CHILD2_2_SELECT_TABLES=
- SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r3" ORDER BY "a"', '', 'srv "s_2_2"');
-let $CHILD2_2_DROP_FT_TABLES=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ft_r3"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"');
-let $CHILD2_2_CREATE_FT_TABLES=
- SELECT spider_direct_sql('CREATE TABLE "ft_r3" (
- "a" INT DEFAULT 0,
- "b" TEXT,
- "c" TEXT,
- "d" TEXT,
- CONSTRAINT "pk_s_2_2_ft_r3" PRIMARY KEY("a"),
- FULLTEXT INDEX "ft_idx1"("b"),
- FULLTEXT INDEX "ft_idx2"("c")
- )', '', 'srv "s_2_2"');
-let $CHILD2_2_SELECT_FT_TABLES=
- SELECT spider_direct_sql('SELECT "a", "b", "c", "d" FROM "ft_r3" ORDER BY "a"', '', 'srv "s_2_2"');
-let $CHILD2_2_DROP_GM_TABLES=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "gm_r3"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"');
-let $CHILD2_2_CREATE_GM_TABLES=
- SELECT spider_direct_sql('CREATE TABLE "gm_r3" (
- "a" INT DEFAULT 0,
- "b" GEOMETRY NOT NULL,
- "c" GEOMETRY NOT NULL,
- CONSTRAINT "pk_s_2_2_gm_r3" PRIMARY KEY("a"),
- SPATIAL INDEX "sp_idx1"("b"),
- SPATIAL INDEX "sp_idx2"("c")
- )', '', 'srv "s_2_2"');
-let $CHILD2_2_SELECT_GM_TABLES=
- SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "gm_r3" ORDER BY "a"', '', 'srv "s_2_2"');
-let $CHILD2_2_DROP_LOCK_TABLES1=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"');
-let $CHILD2_2_CREATE_LOCK_TABLES1=
- SELECT spider_direct_sql('CREATE TABLE "t1_2" (
- "id" INT NOT NULL,
- CONSTRAINT "pk_s_2_2_t1_2" PRIMARY KEY ("id")
- )', '', 'srv "s_2_2"');
-let $CHILD2_2_DROP_LOCK_TABLES2=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t2_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"');
-let $CHILD2_2_CREATE_LOCK_TABLES2=
- SELECT spider_direct_sql('CREATE TABLE "t2_1" (
- "id" INT NOT NULL,
- CONSTRAINT "pk_s_2_2_t2_1" PRIMARY KEY ("id")
- )', '', 'srv "s_2_2"');
-let $CHILD2_2_DROP_INCREMENT_TABLES1=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"');
-let $CHILD2_2_CREATE_INCREMENT_TABLES1=
- SELECT spider_direct_sql('CREATE TABLE "t1_2" (
- "id" INT NOT NULL,
- CONSTRAINT "pk_s_2_2_t1_2" PRIMARY KEY ("id")
- )', '', 'srv "s_2_2"');
-let $CHILD2_2_SELECT_INCREMENT_TABLES1=
- SELECT spider_direct_sql('SELECT "id" FROM "t1_2" ORDER BY "id"', '', 'srv "s_2_2"');
-let $CHILD2_2_AUTO_INCREMENT_INCREMENT1=
- SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_2"');
-let $CHILD2_2_AUTO_INCREMENT_INCREMENT2=
- SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"');
-let $CHILD2_2_AUTO_INCREMENT_OFFSET1=
- SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_2"');
-let $CHILD2_2_AUTO_INCREMENT_OFFSET2=
- SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"');
+--connection master_1
+SELECT spider_direct_sql('ALTER SESSION SET NLS_DATE_FORMAT=\'YYYY-MM-DD HH24:MI:SS\'', '', 'srv "s_2_2"');
+SELECT spider_direct_sql('ALTER SESSION SET NLS_TIME_FORMAT=\'HH24:MI:SSXFF\'', '', 'srv "s_2_2"');
+SELECT spider_direct_sql('ALTER SESSION SET NLS_TIMESTAMP_FORMAT=\'YYYY-MM-DD HH24:MI:SSXFF\'', '', 'srv "s_2_2"');
+let $CHILD2_2_DROP_TABLES=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r3"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"');
+let $CHILD2_2_CREATE_TABLES=
+ SELECT spider_direct_sql('CREATE TABLE "ta_r3" (
+ "a" INT DEFAULT 10,
+ "b" CHAR(1) DEFAULT \'c\',
+ "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'),
+ CONSTRAINT "pk_s_2_2_ta_r3" PRIMARY KEY("a")
+ )', '', 'srv "s_2_2"');
+let $CHILD2_2_DROP_TABLES5=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "s_2_2_ta_r_int"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"');
+let $CHILD2_2_CREATE_TABLES5=
+ SELECT spider_direct_sql('CREATE TABLE "s_2_2_ta_r_int" (
+ "a" INT DEFAULT 3,
+ "b" INT DEFAULT 10,
+ "c" INT DEFAULT 11,
+ CONSTRAINT "pk_s_2_2_ta_r_int" PRIMARY KEY("a")
+ )', '', 'srv "s_2_2"')
+ $STR_SEMICOLON
+ SELECT spider_direct_sql('CREATE INDEX "idx1_s_2_2_ta_r_int" ON "s_2_2_ta_r_int"("b")', '', 'srv "s_2_2"')
+ $STR_SEMICOLON
+ SELECT spider_direct_sql('CREATE INDEX "idx2_s_2_2_ta_r_int" ON "s_2_2_ta_r_int"("c")', '', 'srv "s_2_2"');
+let $CHILD2_2_SELECT_TABLES=
+ SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r3" ORDER BY "a"', '', 'srv "s_2_2"');
+let $CHILD2_2_DROP_FT_TABLES=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ft_r3"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"');
+let $CHILD2_2_CREATE_FT_TABLES=
+ SELECT spider_direct_sql('CREATE TABLE "ft_r3" (
+ "a" INT DEFAULT 0,
+ "b" TEXT,
+ "c" TEXT,
+ "d" TEXT,
+ CONSTRAINT "pk_s_2_2_ft_r3" PRIMARY KEY("a"),
+ FULLTEXT INDEX "ft_idx1"("b"),
+ FULLTEXT INDEX "ft_idx2"("c")
+ )', '', 'srv "s_2_2"');
+let $CHILD2_2_SELECT_FT_TABLES=
+ SELECT spider_direct_sql('SELECT "a", "b", "c", "d" FROM "ft_r3" ORDER BY "a"', '', 'srv "s_2_2"');
+let $CHILD2_2_DROP_GM_TABLES=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "gm_r3"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"');
+let $CHILD2_2_CREATE_GM_TABLES=
+ SELECT spider_direct_sql('CREATE TABLE "gm_r3" (
+ "a" INT DEFAULT 0,
+ "b" GEOMETRY NOT NULL,
+ "c" GEOMETRY NOT NULL,
+ CONSTRAINT "pk_s_2_2_gm_r3" PRIMARY KEY("a"),
+ SPATIAL INDEX "sp_idx1"("b"),
+ SPATIAL INDEX "sp_idx2"("c")
+ )', '', 'srv "s_2_2"');
+let $CHILD2_2_SELECT_GM_TABLES=
+ SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "gm_r3" ORDER BY "a"', '', 'srv "s_2_2"');
+let $CHILD2_2_DROP_LOCK_TABLES1=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"');
+let $CHILD2_2_CREATE_LOCK_TABLES1=
+ SELECT spider_direct_sql('CREATE TABLE "t1_2" (
+ "id" INT NOT NULL,
+ CONSTRAINT "pk_s_2_2_t1_2" PRIMARY KEY ("id")
+ )', '', 'srv "s_2_2"');
+let $CHILD2_2_DROP_LOCK_TABLES2=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t2_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"');
+let $CHILD2_2_CREATE_LOCK_TABLES2=
+ SELECT spider_direct_sql('CREATE TABLE "t2_1" (
+ "id" INT NOT NULL,
+ CONSTRAINT "pk_s_2_2_t2_1" PRIMARY KEY ("id")
+ )', '', 'srv "s_2_2"');
+let $CHILD2_2_DROP_INCREMENT_TABLES1=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"');
+let $CHILD2_2_CREATE_INCREMENT_TABLES1=
+ SELECT spider_direct_sql('CREATE TABLE "t1_2" (
+ "id" INT NOT NULL,
+ CONSTRAINT "pk_s_2_2_t1_2" PRIMARY KEY ("id")
+ )', '', 'srv "s_2_2"');
+let $CHILD2_2_SELECT_INCREMENT_TABLES1=
+ SELECT spider_direct_sql('SELECT "id" FROM "t1_2" ORDER BY "id"', '', 'srv "s_2_2"');
+let $CHILD2_2_AUTO_INCREMENT_INCREMENT1=
+ SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"')
+ $STR_SEMICOLON
+ SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_2"');
+let $CHILD2_2_AUTO_INCREMENT_INCREMENT2=
+ SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"')
+ $STR_SEMICOLON
+ SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"');
+let $CHILD2_2_AUTO_INCREMENT_OFFSET1=
+ SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"')
+ $STR_SEMICOLON
+ SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_2"');
+let $CHILD2_2_AUTO_INCREMENT_OFFSET2=
+ SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"')
+ $STR_SEMICOLON
+ SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"');
diff --git a/storage/spider/mysql-test/spider/oracle/include/init_child2_3.inc b/storage/spider/mysql-test/spider/oracle/include/init_child2_3.inc
index 5c06a9f6a73..e16dfeffd81 100644
--- a/storage/spider/mysql-test/spider/oracle/include/init_child2_3.inc
+++ b/storage/spider/mysql-test/spider/oracle/include/init_child2_3.inc
@@ -1,15 +1,15 @@
---connection master_1
-SELECT spider_direct_sql('ALTER SESSION SET NLS_DATE_FORMAT=\'YYYY-MM-DD HH24:MI:SS\'', '', 'srv "s_2_3"');
-SELECT spider_direct_sql('ALTER SESSION SET NLS_TIME_FORMAT=\'HH24:MI:SSXFF\'', '', 'srv "s_2_3"');
-SELECT spider_direct_sql('ALTER SESSION SET NLS_TIMESTAMP_FORMAT=\'YYYY-MM-DD HH24:MI:SSXFF\'', '', 'srv "s_2_3"');
-let $CHILD2_3_DROP_TABLES=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r4"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_3"');
-let $CHILD2_3_CREATE_TABLES=
- SELECT spider_direct_sql('CREATE TABLE "ta_r4" (
- "a" INT DEFAULT 10,
- "b" CHAR(1) DEFAULT \'c\',
- "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'),
- CONSTRAINT "pk_s_2_3_ta_r4" PRIMARY KEY("a")
- )', '', 'srv "s_2_3"');
-let $CHILD2_3_SELECT_TABLES=
- SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r4" ORDER BY "a"', '', 'srv "s_2_3"');
+--connection master_1
+SELECT spider_direct_sql('ALTER SESSION SET NLS_DATE_FORMAT=\'YYYY-MM-DD HH24:MI:SS\'', '', 'srv "s_2_3"');
+SELECT spider_direct_sql('ALTER SESSION SET NLS_TIME_FORMAT=\'HH24:MI:SSXFF\'', '', 'srv "s_2_3"');
+SELECT spider_direct_sql('ALTER SESSION SET NLS_TIMESTAMP_FORMAT=\'YYYY-MM-DD HH24:MI:SSXFF\'', '', 'srv "s_2_3"');
+let $CHILD2_3_DROP_TABLES=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r4"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_3"');
+let $CHILD2_3_CREATE_TABLES=
+ SELECT spider_direct_sql('CREATE TABLE "ta_r4" (
+ "a" INT DEFAULT 10,
+ "b" CHAR(1) DEFAULT \'c\',
+ "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'),
+ CONSTRAINT "pk_s_2_3_ta_r4" PRIMARY KEY("a")
+ )', '', 'srv "s_2_3"');
+let $CHILD2_3_SELECT_TABLES=
+ SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r4" ORDER BY "a"', '', 'srv "s_2_3"');
diff --git a/storage/spider/mysql-test/spider/oracle/include/init_child3_1.inc b/storage/spider/mysql-test/spider/oracle/include/init_child3_1.inc
index f70afeb58de..d2d308cbefe 100644
--- a/storage/spider/mysql-test/spider/oracle/include/init_child3_1.inc
+++ b/storage/spider/mysql-test/spider/oracle/include/init_child3_1.inc
@@ -1,3 +1,3 @@
---let $TEST_ENGINE_TYPE= $CHILD3_1_ENGINE_TYPE
---source ../../include/init_engine.inc
---let $INIT_CHILD3_1_ENGINE= $INIT_TEST_ENGINE
+--let $TEST_ENGINE_TYPE= $CHILD3_1_ENGINE_TYPE
+--source ../../include/init_engine.inc
+--let $INIT_CHILD3_1_ENGINE= $INIT_TEST_ENGINE
diff --git a/storage/spider/mysql-test/spider/oracle/include/init_child3_2.inc b/storage/spider/mysql-test/spider/oracle/include/init_child3_2.inc
index e84567f2243..3fbe1bd55bb 100644
--- a/storage/spider/mysql-test/spider/oracle/include/init_child3_2.inc
+++ b/storage/spider/mysql-test/spider/oracle/include/init_child3_2.inc
@@ -1,3 +1,3 @@
---let $TEST_ENGINE_TYPE= $CHILD3_2_ENGINE_TYPE
---source ../../include/init_engine.inc
---let $INIT_CHILD3_2_ENGINE= $INIT_TEST_ENGINE
+--let $TEST_ENGINE_TYPE= $CHILD3_2_ENGINE_TYPE
+--source ../../include/init_engine.inc
+--let $INIT_CHILD3_2_ENGINE= $INIT_TEST_ENGINE
diff --git a/storage/spider/mysql-test/spider/oracle/include/init_child3_3.inc b/storage/spider/mysql-test/spider/oracle/include/init_child3_3.inc
index d3f31049ff6..3c7aaa8af84 100644
--- a/storage/spider/mysql-test/spider/oracle/include/init_child3_3.inc
+++ b/storage/spider/mysql-test/spider/oracle/include/init_child3_3.inc
@@ -1,3 +1,3 @@
---let $TEST_ENGINE_TYPE= $CHILD3_3_ENGINE_TYPE
---source ../../include/init_engine.inc
---let $INIT_CHILD3_3_ENGINE= $INIT_TEST_ENGINE
+--let $TEST_ENGINE_TYPE= $CHILD3_3_ENGINE_TYPE
+--source ../../include/init_engine.inc
+--let $INIT_CHILD3_3_ENGINE= $INIT_TEST_ENGINE
diff --git a/storage/spider/mysql-test/spider/oracle/include/init_slave1_1.inc b/storage/spider/mysql-test/spider/oracle/include/init_slave1_1.inc
index 87c05f1f690..73c3c6b9ef2 100644
--- a/storage/spider/mysql-test/spider/oracle/include/init_slave1_1.inc
+++ b/storage/spider/mysql-test/spider/oracle/include/init_slave1_1.inc
@@ -1,10 +1,10 @@
-let $SLAVE1_1_COMMENT_INCREMENT1_1=
- COMMENT '';
-let $SLAVE1_1_COMMENT_INCREMENT1_P_1=
- COMMENT ''
- PARTITION BY LIST(MOD(id, 2)) (
- PARTITION pt1 VALUES IN (0)
- COMMENT='',
- PARTITION pt2 VALUES IN (1)
- COMMENT=''
- );
+let $SLAVE1_1_COMMENT_INCREMENT1_1=
+ COMMENT '';
+let $SLAVE1_1_COMMENT_INCREMENT1_P_1=
+ COMMENT ''
+ PARTITION BY LIST(MOD(id, 2)) (
+ PARTITION pt1 VALUES IN (0)
+ COMMENT='',
+ PARTITION pt2 VALUES IN (1)
+ COMMENT=''
+ );
diff --git a/storage/spider/mysql-test/spider/oracle/t/direct_aggregate.test b/storage/spider/mysql-test/spider/oracle/t/direct_aggregate.test
index 5f17ac402e2..d65f4c5a624 100644
--- a/storage/spider/mysql-test/spider/oracle/t/direct_aggregate.test
+++ b/storage/spider/mysql-test/spider/oracle/t/direct_aggregate.test
@@ -1,179 +1,179 @@
---disable_warnings
---disable_query_log
---disable_result_log
---source test_init.inc
---enable_result_log
---enable_query_log
-
---echo
---echo drop and create databases
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- CREATE DATABASE auto_test_remote;
- USE auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- CREATE DATABASE auto_test_remote2;
- USE auto_test_remote2;
-}
---enable_warnings
-
---echo
---echo test select 1
---connection master_1
-SELECT 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- SELECT 1;
- --connection child2_2
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo create table select test
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_TABLES;
- echo CHILD2_1_CREATE_TABLES;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
---disable_warnings
-DROP TABLE IF EXISTS ta_l;
---enable_warnings
---disable_query_log
-echo CREATE TABLE ta_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
-eval CREATE TABLE ta_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
---enable_query_log
-INSERT INTO ta_l (a, b, c) VALUES
- (1, 'a', '2008-08-01 10:21:39'),
- (2, 'b', '2000-01-01 00:00:00'),
- (3, 'e', '2007-06-04 20:03:11'),
- (4, 'd', '2003-11-30 05:01:03'),
- (5, 'c', '2001-12-31 23:59:59');
-
---echo
---echo direct_aggregating test
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
-SELECT COUNT(*) FROM ta_l;
-eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
-SELECT MAX(a) FROM ta_l;
-eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
-SELECT MIN(a) FROM ta_l;
-eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
-SELECT MAX(a) FROM ta_l WHERE a < 5;
-eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
-SELECT MIN(a) FROM ta_l WHERE a > 1;
-eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo deinit
---disable_warnings
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
-}
---disable_query_log
---disable_result_log
---source test_deinit.inc
---enable_result_log
---enable_query_log
---enable_warnings
---echo
---echo end of test
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--enable_result_log
+--enable_query_log
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ --connection child2_2
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo create table select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS ta_l;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE ta_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE ta_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+--enable_query_log
+INSERT INTO ta_l (a, b, c) VALUES
+ (1, 'a', '2008-08-01 10:21:39'),
+ (2, 'b', '2000-01-01 00:00:00'),
+ (3, 'e', '2007-06-04 20:03:11'),
+ (4, 'd', '2003-11-30 05:01:03'),
+ (5, 'c', '2001-12-31 23:59:59');
+
+--echo
+--echo direct_aggregating test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+SELECT COUNT(*) FROM ta_l;
+eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+SELECT MAX(a) FROM ta_l;
+eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+SELECT MIN(a) FROM ta_l;
+eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+SELECT MAX(a) FROM ta_l WHERE a < 5;
+eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+SELECT MIN(a) FROM ta_l WHERE a > 1;
+eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+}
+--disable_query_log
+--disable_result_log
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/oracle/t/direct_aggregate_part.test b/storage/spider/mysql-test/spider/oracle/t/direct_aggregate_part.test
index 2d67e9af32c..aebf210c745 100644
--- a/storage/spider/mysql-test/spider/oracle/t/direct_aggregate_part.test
+++ b/storage/spider/mysql-test/spider/oracle/t/direct_aggregate_part.test
@@ -1,192 +1,192 @@
---disable_warnings
---disable_query_log
---disable_result_log
---source test_init.inc
---enable_result_log
---enable_query_log
-if (!$HAVE_PARTITION)
-{
- --disable_query_log
- --disable_result_log
- --source test_deinit.inc
- --enable_result_log
- --enable_query_log
- --enable_warnings
- skip Test requires partitioning;
-}
-
---echo
---echo drop and create databases
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- CREATE DATABASE auto_test_remote;
- USE auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- CREATE DATABASE auto_test_remote2;
- USE auto_test_remote2;
-}
---enable_warnings
-
---echo
---echo test select 1
---connection master_1
-SELECT 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- SELECT 1;
- --connection child2_2
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo with partition test
-if ($HAVE_PARTITION)
-{
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_2_DROP_TABLES;
- echo CHILD2_2_CREATE_TABLES;
- }
- --disable_warnings
- eval $CHILD2_2_DROP_TABLES;
- --enable_warnings
- eval $CHILD2_2_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_TABLES2;
- echo CHILD2_1_CREATE_TABLES2;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES2;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- --disable_query_log
- echo CREATE TABLE ta_l2 (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
- ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1;
- eval CREATE TABLE ta_l2 (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
- ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1;
- INSERT INTO ta_l2 (a, b, c) VALUES
- (1, 'a', '2008-08-01 10:21:39'),
- (2, 'b', '2000-01-01 00:00:00'),
- (3, 'e', '2007-06-04 20:03:11'),
- (4, 'd', '2003-11-30 05:01:03'),
- (5, 'c', '2001-12-31 23:59:59');
- --enable_query_log
- eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
- SELECT COUNT(*) FROM ta_l2;
- eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
- SELECT MAX(a) FROM ta_l2;
- eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
- SELECT MIN(a) FROM ta_l2;
- eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
- SELECT MAX(a) FROM ta_l2 WHERE a < 5;
- eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
- SELECT MIN(a) FROM ta_l2 WHERE a > 1;
- eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %';
- }
- eval $CHILD2_2_SELECT_TABLES;
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %';
- }
- eval $CHILD2_1_SELECT_TABLES2;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
-}
-
---echo
---echo deinit
---disable_warnings
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
-}
---disable_query_log
---disable_result_log
---source test_deinit.inc
---enable_result_log
---enable_query_log
---enable_warnings
---echo
---echo end of test
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--enable_result_log
+--enable_query_log
+if (!$HAVE_PARTITION)
+{
+ --disable_query_log
+ --disable_result_log
+ --source test_deinit.inc
+ --enable_result_log
+ --enable_query_log
+ --enable_warnings
+ skip Test requires partitioning;
+}
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ --connection child2_2
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo with partition test
+if ($HAVE_PARTITION)
+{
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_DROP_TABLES;
+ echo CHILD2_2_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_2_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_2_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES2;
+ echo CHILD2_1_CREATE_TABLES2;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES2;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ --disable_query_log
+ echo CREATE TABLE ta_l2 (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1;
+ eval CREATE TABLE ta_l2 (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1;
+ INSERT INTO ta_l2 (a, b, c) VALUES
+ (1, 'a', '2008-08-01 10:21:39'),
+ (2, 'b', '2000-01-01 00:00:00'),
+ (3, 'e', '2007-06-04 20:03:11'),
+ (4, 'd', '2003-11-30 05:01:03'),
+ (5, 'c', '2001-12-31 23:59:59');
+ --enable_query_log
+ eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+ SELECT COUNT(*) FROM ta_l2;
+ eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+ SELECT MAX(a) FROM ta_l2;
+ eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+ SELECT MIN(a) FROM ta_l2;
+ eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+ SELECT MAX(a) FROM ta_l2 WHERE a < 5;
+ eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+ SELECT MIN(a) FROM ta_l2 WHERE a > 1;
+ eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %';
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %';
+ }
+ eval $CHILD2_1_SELECT_TABLES2;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+}
+--disable_query_log
+--disable_result_log
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/oracle/t/have_partition.inc b/storage/spider/mysql-test/spider/oracle/t/have_partition.inc
index 573c76ab43b..b6e699475db 100644
--- a/storage/spider/mysql-test/spider/oracle/t/have_partition.inc
+++ b/storage/spider/mysql-test/spider/oracle/t/have_partition.inc
@@ -1,7 +1,7 @@
-let $HAVE_PARTITION= 0;
-if (`SELECT count(*) FROM information_schema.plugins WHERE
- plugin_status = 'ACTIVE' AND
- plugin_name = 'partition'`)
-{
- let $HAVE_PARTITION= 1;
-}
+let $HAVE_PARTITION= 0;
+if (`SELECT count(*) FROM information_schema.plugins WHERE
+ plugin_status = 'ACTIVE' AND
+ plugin_name = 'partition'`)
+{
+ let $HAVE_PARTITION= 1;
+}
diff --git a/storage/spider/mysql-test/spider/oracle/t/have_trigger.inc b/storage/spider/mysql-test/spider/oracle/t/have_trigger.inc
index 10c0871dd5f..32de484b388 100644
--- a/storage/spider/mysql-test/spider/oracle/t/have_trigger.inc
+++ b/storage/spider/mysql-test/spider/oracle/t/have_trigger.inc
@@ -1,2 +1,2 @@
-let $HAVE_TRIGGER= `SELECT COUNT(*) FROM information_schema.tables
- WHERE TABLE_SCHEMA = 'information_schema' AND TABLE_NAME = 'TRIGGERS'`;
+let $HAVE_TRIGGER= `SELECT COUNT(*) FROM information_schema.tables
+ WHERE TABLE_SCHEMA = 'information_schema' AND TABLE_NAME = 'TRIGGERS'`;
diff --git a/storage/spider/mysql-test/spider/oracle/t/spider3_fixes.test b/storage/spider/mysql-test/spider/oracle/t/spider3_fixes.test
index 7530ce97837..13fa6f5fa39 100644
--- a/storage/spider/mysql-test/spider/oracle/t/spider3_fixes.test
+++ b/storage/spider/mysql-test/spider/oracle/t/spider3_fixes.test
@@ -1,292 +1,292 @@
-# This test tests for Spider 3.0's bug fixes
-source include/have_log_bin.inc;
---disable_warnings
---disable_query_log
---disable_result_log
---source test_init.inc
---source slave_test_init.inc
---enable_result_log
---enable_query_log
-
---echo
---echo drop and create databases
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-if ($USE_REPLICATION)
-{
- --connection slave1_1
- DROP DATABASE IF EXISTS auto_test_local;
- CREATE DATABASE auto_test_local;
- USE auto_test_local;
-}
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- CREATE DATABASE auto_test_remote;
- USE auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- CREATE DATABASE auto_test_remote2;
- USE auto_test_remote2;
-}
---enable_warnings
-
---echo
---echo test select 1
---connection master_1
-SELECT 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- SELECT 1;
- --connection child2_2
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
-
---echo
---echo 3.1
---echo auto_increment
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_INCREMENT_TABLES1;
- echo CHILD2_1_CREATE_INCREMENT_TABLES1;
- echo CHILD2_1_AUTO_INCREMENT_INCREMENT2;
- echo CHILD2_1_AUTO_INCREMENT_OFFSET2;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_INCREMENT_TABLES1;
- --enable_warnings
- eval $CHILD2_1_CREATE_INCREMENT_TABLES1;
- eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2;
- eval $CHILD2_1_AUTO_INCREMENT_OFFSET2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-if ($USE_REPLICATION)
-{
- save_master_pos;
- --connection slave1_1
- sync_with_master;
- --connection master_1
- --disable_query_log
- SET SESSION sql_log_bin= 0;
- --enable_query_log
-}
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
---enable_warnings
---disable_query_log
-echo CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1;
-echo CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1;
-echo MASTER_1_AUTO_INCREMENT_INCREMENT2;
-echo MASTER_1_AUTO_INCREMENT_OFFSET2;
-eval CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_1;
-eval CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_1;
-eval $MASTER_1_AUTO_INCREMENT_INCREMENT2;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET2;
-if ($USE_REPLICATION)
-{
- SET SESSION sql_log_bin= 1;
- --connection slave1_1
- --disable_warnings
- DROP TABLE IF EXISTS t1, t2;
- --enable_warnings
- echo CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1;
- echo CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1;
- eval CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_1;
- eval CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_1;
- --connection master_1
-}
---enable_query_log
-INSERT INTO t1 () VALUES ();
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t1;
-INSERT INTO t2 () VALUES ();
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t2;
---disable_query_log
-echo MASTER_1_AUTO_INCREMENT_OFFSET3;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
---enable_query_log
-INSERT INTO t1 (id) VALUES (null);
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t1;
---disable_query_log
-echo MASTER_1_AUTO_INCREMENT_OFFSET4;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
---enable_query_log
-INSERT INTO t2 (id) VALUES (null);
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t2;
---disable_query_log
-echo MASTER_1_AUTO_INCREMENT_OFFSET3;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
---enable_query_log
-INSERT INTO t1 () VALUES (),(),(),();
-SELECT LAST_INSERT_ID();
-SELECT id FROM t1 ORDER BY id;
---disable_query_log
-echo MASTER_1_AUTO_INCREMENT_OFFSET4;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
---enable_query_log
-INSERT INTO t2 () VALUES (),(),(),();
-SELECT LAST_INSERT_ID();
-SELECT id FROM t2 ORDER BY id;
-TRUNCATE TABLE t1;
-TRUNCATE TABLE t2;
-INSERT INTO t1 () VALUES (),(),(),();
-SELECT LAST_INSERT_ID();
-SELECT id FROM t1 ORDER BY id;
-INSERT INTO t2 () VALUES (),(),(),();
-SELECT LAST_INSERT_ID();
-SELECT id FROM t2 ORDER BY id;
-SET INSERT_ID=5000;
---disable_query_log
-echo MASTER_1_AUTO_INCREMENT_OFFSET3;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
---enable_query_log
-INSERT INTO t1 () VALUES ();
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t1;
---disable_query_log
-echo MASTER_1_AUTO_INCREMENT_OFFSET4;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
---enable_query_log
-INSERT INTO t2 () VALUES ();
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t2;
-INSERT INTO t1 (id) VALUES (10000);
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t1;
-INSERT INTO t2 (id) VALUES (1000);
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t2;
-if ($USE_REPLICATION)
-{
- save_master_pos;
- --connection slave1_1
- sync_with_master;
- SELECT id FROM t1 ORDER BY id;
- --connection master_1
- --disable_query_log
- SET SESSION sql_log_bin= 0;
- --enable_query_log
-}
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %';
- }
- eval $CHILD2_1_SELECT_INCREMENT_TABLES1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_AUTO_INCREMENT_INCREMENT1;
- echo CHILD2_1_AUTO_INCREMENT_OFFSET1;
- }
- eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1;
- eval $CHILD2_1_AUTO_INCREMENT_OFFSET1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
-
---echo
---echo deinit
---disable_warnings
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-if ($USE_REPLICATION)
-{
- --connection slave1_1
- DROP DATABASE IF EXISTS auto_test_local;
-}
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
-}
---disable_query_log
---disable_result_log
---source slave_test_deinit.inc
---source test_deinit.inc
---enable_result_log
---enable_query_log
---enable_warnings
---echo
---echo end of test
+# This test tests for Spider 3.0's bug fixes
+source include/have_log_bin.inc;
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--source slave_test_init.inc
+--enable_result_log
+--enable_query_log
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_REPLICATION)
+{
+ --connection slave1_1
+ DROP DATABASE IF EXISTS auto_test_local;
+ CREATE DATABASE auto_test_local;
+ USE auto_test_local;
+}
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ --connection child2_2
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+
+--echo
+--echo 3.1
+--echo auto_increment
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_INCREMENT_TABLES1;
+ echo CHILD2_1_CREATE_INCREMENT_TABLES1;
+ echo CHILD2_1_AUTO_INCREMENT_INCREMENT2;
+ echo CHILD2_1_AUTO_INCREMENT_OFFSET2;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_INCREMENT_TABLES1;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_INCREMENT_TABLES1;
+ eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2;
+ eval $CHILD2_1_AUTO_INCREMENT_OFFSET2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+if ($USE_REPLICATION)
+{
+ save_master_pos;
+ --connection slave1_1
+ sync_with_master;
+ --connection master_1
+ --disable_query_log
+ SET SESSION sql_log_bin= 0;
+ --enable_query_log
+}
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1;
+echo CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1;
+echo MASTER_1_AUTO_INCREMENT_INCREMENT2;
+echo MASTER_1_AUTO_INCREMENT_OFFSET2;
+eval CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_1;
+eval CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_1;
+eval $MASTER_1_AUTO_INCREMENT_INCREMENT2;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET2;
+if ($USE_REPLICATION)
+{
+ SET SESSION sql_log_bin= 1;
+ --connection slave1_1
+ --disable_warnings
+ DROP TABLE IF EXISTS t1, t2;
+ --enable_warnings
+ echo CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1;
+ echo CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1;
+ eval CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_1;
+ eval CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_1;
+ --connection master_1
+}
+--enable_query_log
+INSERT INTO t1 () VALUES ();
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t1;
+INSERT INTO t2 () VALUES ();
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t2;
+--disable_query_log
+echo MASTER_1_AUTO_INCREMENT_OFFSET3;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
+--enable_query_log
+INSERT INTO t1 (id) VALUES (null);
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t1;
+--disable_query_log
+echo MASTER_1_AUTO_INCREMENT_OFFSET4;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
+--enable_query_log
+INSERT INTO t2 (id) VALUES (null);
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t2;
+--disable_query_log
+echo MASTER_1_AUTO_INCREMENT_OFFSET3;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
+--enable_query_log
+INSERT INTO t1 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+SELECT id FROM t1 ORDER BY id;
+--disable_query_log
+echo MASTER_1_AUTO_INCREMENT_OFFSET4;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
+--enable_query_log
+INSERT INTO t2 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+SELECT id FROM t2 ORDER BY id;
+TRUNCATE TABLE t1;
+TRUNCATE TABLE t2;
+INSERT INTO t1 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+SELECT id FROM t1 ORDER BY id;
+INSERT INTO t2 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+SELECT id FROM t2 ORDER BY id;
+SET INSERT_ID=5000;
+--disable_query_log
+echo MASTER_1_AUTO_INCREMENT_OFFSET3;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
+--enable_query_log
+INSERT INTO t1 () VALUES ();
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t1;
+--disable_query_log
+echo MASTER_1_AUTO_INCREMENT_OFFSET4;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
+--enable_query_log
+INSERT INTO t2 () VALUES ();
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t2;
+INSERT INTO t1 (id) VALUES (10000);
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t1;
+INSERT INTO t2 (id) VALUES (1000);
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t2;
+if ($USE_REPLICATION)
+{
+ save_master_pos;
+ --connection slave1_1
+ sync_with_master;
+ SELECT id FROM t1 ORDER BY id;
+ --connection master_1
+ --disable_query_log
+ SET SESSION sql_log_bin= 0;
+ --enable_query_log
+}
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %';
+ }
+ eval $CHILD2_1_SELECT_INCREMENT_TABLES1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_AUTO_INCREMENT_INCREMENT1;
+ echo CHILD2_1_AUTO_INCREMENT_OFFSET1;
+ }
+ eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1;
+ eval $CHILD2_1_AUTO_INCREMENT_OFFSET1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_REPLICATION)
+{
+ --connection slave1_1
+ DROP DATABASE IF EXISTS auto_test_local;
+}
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+}
+--disable_query_log
+--disable_result_log
+--source slave_test_deinit.inc
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/oracle/t/spider3_fixes_part.test b/storage/spider/mysql-test/spider/oracle/t/spider3_fixes_part.test
index f25f000d80c..3288c490a46 100644
--- a/storage/spider/mysql-test/spider/oracle/t/spider3_fixes_part.test
+++ b/storage/spider/mysql-test/spider/oracle/t/spider3_fixes_part.test
@@ -1,345 +1,345 @@
-# This test tests for Spider 3.0's bug fixes
-source include/have_log_bin.inc;
---disable_warnings
---disable_query_log
---disable_result_log
---source test_init.inc
---source slave_test_init.inc
---enable_result_log
---enable_query_log
-if (!$HAVE_PARTITION)
-{
- --disable_query_log
- --disable_result_log
- --source slave_test_deinit.inc
- --source test_deinit.inc
- --enable_result_log
- --enable_query_log
- --enable_warnings
- skip Test requires partitioning;
-}
-
---echo
---echo drop and create databases
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-if ($USE_REPLICATION)
-{
- --connection slave1_1
- DROP DATABASE IF EXISTS auto_test_local;
- CREATE DATABASE auto_test_local;
- USE auto_test_local;
-}
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- CREATE DATABASE auto_test_remote;
- USE auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- CREATE DATABASE auto_test_remote2;
- USE auto_test_remote2;
-}
---enable_warnings
-
---echo
---echo test select 1
---connection master_1
-SELECT 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- SELECT 1;
- --connection child2_2
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
-
---echo auto_increment with partition
-if ($HAVE_PARTITION)
-{
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_INCREMENT_TABLES1;
- echo CHILD2_1_CREATE_INCREMENT_TABLES1;
- echo CHILD2_1_AUTO_INCREMENT_INCREMENT2;
- echo CHILD2_1_AUTO_INCREMENT_OFFSET2;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_INCREMENT_TABLES1;
- --enable_warnings
- eval $CHILD2_1_CREATE_INCREMENT_TABLES1;
- eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2;
- eval $CHILD2_1_AUTO_INCREMENT_OFFSET2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_2
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_2_DROP_INCREMENT_TABLES1;
- echo CHILD2_2_CREATE_INCREMENT_TABLES1;
- echo CHILD2_2_AUTO_INCREMENT_INCREMENT2;
- echo CHILD2_2_AUTO_INCREMENT_OFFSET2;
- }
- --disable_warnings
- eval $CHILD2_2_DROP_INCREMENT_TABLES1;
- --enable_warnings
- eval $CHILD2_2_CREATE_INCREMENT_TABLES1;
- eval $CHILD2_2_AUTO_INCREMENT_INCREMENT2;
- eval $CHILD2_2_AUTO_INCREMENT_OFFSET2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- if ($USE_REPLICATION)
- {
- save_master_pos;
- --connection slave1_1
- sync_with_master;
- --connection master_1
- --disable_query_log
- SET SESSION sql_log_bin= 0;
- --enable_query_log
- }
- --disable_warnings
- DROP TABLE IF EXISTS t1, t2;
- --enable_warnings
- --disable_query_log
- echo CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1;
- echo CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1;
- echo MASTER_1_AUTO_INCREMENT_INCREMENT2;
- echo MASTER_1_AUTO_INCREMENT_OFFSET2;
- eval CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_P_1;
- eval CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_P_1;
- eval $MASTER_1_AUTO_INCREMENT_INCREMENT2;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET2;
- if ($USE_REPLICATION)
- {
- SET SESSION sql_log_bin= 1;
- --connection slave1_1
- --disable_warnings
- DROP TABLE IF EXISTS t1, t2;
- --enable_warnings
- echo CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1;
- echo CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1;
- eval CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1;
- eval CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1;
- --connection master_1
- }
- --enable_query_log
- INSERT INTO t1 () VALUES ();
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t1;
- INSERT INTO t2 () VALUES ();
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t2;
- --disable_query_log
- echo MASTER_1_AUTO_INCREMENT_OFFSET3;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
- --enable_query_log
- INSERT INTO t1 (id) VALUES (null);
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t1;
- --disable_query_log
- echo MASTER_1_AUTO_INCREMENT_OFFSET4;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
- --enable_query_log
- INSERT INTO t2 (id) VALUES (null);
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t2;
- --disable_query_log
- echo MASTER_1_AUTO_INCREMENT_OFFSET3;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
- --enable_query_log
- INSERT INTO t1 () VALUES (),(),(),();
- SELECT LAST_INSERT_ID();
- SELECT id FROM t1 ORDER BY id;
- --disable_query_log
- echo MASTER_1_AUTO_INCREMENT_OFFSET4;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
- --enable_query_log
- INSERT INTO t2 () VALUES (),(),(),();
- SELECT LAST_INSERT_ID();
- SELECT id FROM t2 ORDER BY id;
- TRUNCATE TABLE t1;
- TRUNCATE TABLE t2;
- INSERT INTO t1 () VALUES (),(),(),();
- SELECT LAST_INSERT_ID();
- SELECT id FROM t1 ORDER BY id;
- INSERT INTO t2 () VALUES (),(),(),();
- SELECT LAST_INSERT_ID();
- SELECT id FROM t2 ORDER BY id;
- SET INSERT_ID=5000;
- --disable_query_log
- echo MASTER_1_AUTO_INCREMENT_OFFSET3;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
- --enable_query_log
- INSERT INTO t1 () VALUES ();
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t1;
- --disable_query_log
- echo MASTER_1_AUTO_INCREMENT_OFFSET4;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
- --enable_query_log
- INSERT INTO t2 () VALUES ();
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t2;
- INSERT INTO t1 (id) VALUES (10000);
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t1;
- INSERT INTO t2 (id) VALUES (1000);
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t2;
- if ($USE_REPLICATION)
- {
- save_master_pos;
- --connection slave1_1
- sync_with_master;
- SELECT id FROM t1 ORDER BY id;
- --connection master_1
- --disable_query_log
- SET SESSION sql_log_bin= 0;
- --enable_query_log
- }
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %';
- }
- eval $CHILD2_1_SELECT_INCREMENT_TABLES1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_AUTO_INCREMENT_INCREMENT1;
- echo CHILD2_1_AUTO_INCREMENT_OFFSET1;
- }
- eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1;
- eval $CHILD2_1_AUTO_INCREMENT_OFFSET1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %';
- }
- eval $CHILD2_2_SELECT_INCREMENT_TABLES1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_2_AUTO_INCREMENT_INCREMENT1;
- echo CHILD2_2_AUTO_INCREMENT_OFFSET1;
- }
- eval $CHILD2_2_AUTO_INCREMENT_INCREMENT1;
- eval $CHILD2_2_AUTO_INCREMENT_OFFSET1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
-}
-
-
---echo
---echo deinit
---disable_warnings
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-if ($USE_REPLICATION)
-{
- --connection slave1_1
- DROP DATABASE IF EXISTS auto_test_local;
-}
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
-}
---disable_query_log
---disable_result_log
---source slave_test_deinit.inc
---source test_deinit.inc
---enable_result_log
---enable_query_log
---enable_warnings
---echo
---echo end of test
+# This test tests for Spider 3.0's bug fixes
+source include/have_log_bin.inc;
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--source slave_test_init.inc
+--enable_result_log
+--enable_query_log
+if (!$HAVE_PARTITION)
+{
+ --disable_query_log
+ --disable_result_log
+ --source slave_test_deinit.inc
+ --source test_deinit.inc
+ --enable_result_log
+ --enable_query_log
+ --enable_warnings
+ skip Test requires partitioning;
+}
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_REPLICATION)
+{
+ --connection slave1_1
+ DROP DATABASE IF EXISTS auto_test_local;
+ CREATE DATABASE auto_test_local;
+ USE auto_test_local;
+}
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ --connection child2_2
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+
+--echo auto_increment with partition
+if ($HAVE_PARTITION)
+{
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_INCREMENT_TABLES1;
+ echo CHILD2_1_CREATE_INCREMENT_TABLES1;
+ echo CHILD2_1_AUTO_INCREMENT_INCREMENT2;
+ echo CHILD2_1_AUTO_INCREMENT_OFFSET2;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_INCREMENT_TABLES1;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_INCREMENT_TABLES1;
+ eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2;
+ eval $CHILD2_1_AUTO_INCREMENT_OFFSET2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_DROP_INCREMENT_TABLES1;
+ echo CHILD2_2_CREATE_INCREMENT_TABLES1;
+ echo CHILD2_2_AUTO_INCREMENT_INCREMENT2;
+ echo CHILD2_2_AUTO_INCREMENT_OFFSET2;
+ }
+ --disable_warnings
+ eval $CHILD2_2_DROP_INCREMENT_TABLES1;
+ --enable_warnings
+ eval $CHILD2_2_CREATE_INCREMENT_TABLES1;
+ eval $CHILD2_2_AUTO_INCREMENT_INCREMENT2;
+ eval $CHILD2_2_AUTO_INCREMENT_OFFSET2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ if ($USE_REPLICATION)
+ {
+ save_master_pos;
+ --connection slave1_1
+ sync_with_master;
+ --connection master_1
+ --disable_query_log
+ SET SESSION sql_log_bin= 0;
+ --enable_query_log
+ }
+ --disable_warnings
+ DROP TABLE IF EXISTS t1, t2;
+ --enable_warnings
+ --disable_query_log
+ echo CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1;
+ echo CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1;
+ echo MASTER_1_AUTO_INCREMENT_INCREMENT2;
+ echo MASTER_1_AUTO_INCREMENT_OFFSET2;
+ eval CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_P_1;
+ eval CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_P_1;
+ eval $MASTER_1_AUTO_INCREMENT_INCREMENT2;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET2;
+ if ($USE_REPLICATION)
+ {
+ SET SESSION sql_log_bin= 1;
+ --connection slave1_1
+ --disable_warnings
+ DROP TABLE IF EXISTS t1, t2;
+ --enable_warnings
+ echo CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1;
+ echo CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1;
+ eval CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1;
+ eval CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1;
+ --connection master_1
+ }
+ --enable_query_log
+ INSERT INTO t1 () VALUES ();
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t1;
+ INSERT INTO t2 () VALUES ();
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t2;
+ --disable_query_log
+ echo MASTER_1_AUTO_INCREMENT_OFFSET3;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
+ --enable_query_log
+ INSERT INTO t1 (id) VALUES (null);
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t1;
+ --disable_query_log
+ echo MASTER_1_AUTO_INCREMENT_OFFSET4;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
+ --enable_query_log
+ INSERT INTO t2 (id) VALUES (null);
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t2;
+ --disable_query_log
+ echo MASTER_1_AUTO_INCREMENT_OFFSET3;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
+ --enable_query_log
+ INSERT INTO t1 () VALUES (),(),(),();
+ SELECT LAST_INSERT_ID();
+ SELECT id FROM t1 ORDER BY id;
+ --disable_query_log
+ echo MASTER_1_AUTO_INCREMENT_OFFSET4;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
+ --enable_query_log
+ INSERT INTO t2 () VALUES (),(),(),();
+ SELECT LAST_INSERT_ID();
+ SELECT id FROM t2 ORDER BY id;
+ TRUNCATE TABLE t1;
+ TRUNCATE TABLE t2;
+ INSERT INTO t1 () VALUES (),(),(),();
+ SELECT LAST_INSERT_ID();
+ SELECT id FROM t1 ORDER BY id;
+ INSERT INTO t2 () VALUES (),(),(),();
+ SELECT LAST_INSERT_ID();
+ SELECT id FROM t2 ORDER BY id;
+ SET INSERT_ID=5000;
+ --disable_query_log
+ echo MASTER_1_AUTO_INCREMENT_OFFSET3;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
+ --enable_query_log
+ INSERT INTO t1 () VALUES ();
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t1;
+ --disable_query_log
+ echo MASTER_1_AUTO_INCREMENT_OFFSET4;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
+ --enable_query_log
+ INSERT INTO t2 () VALUES ();
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t2;
+ INSERT INTO t1 (id) VALUES (10000);
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t1;
+ INSERT INTO t2 (id) VALUES (1000);
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t2;
+ if ($USE_REPLICATION)
+ {
+ save_master_pos;
+ --connection slave1_1
+ sync_with_master;
+ SELECT id FROM t1 ORDER BY id;
+ --connection master_1
+ --disable_query_log
+ SET SESSION sql_log_bin= 0;
+ --enable_query_log
+ }
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %';
+ }
+ eval $CHILD2_1_SELECT_INCREMENT_TABLES1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_AUTO_INCREMENT_INCREMENT1;
+ echo CHILD2_1_AUTO_INCREMENT_OFFSET1;
+ }
+ eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1;
+ eval $CHILD2_1_AUTO_INCREMENT_OFFSET1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %';
+ }
+ eval $CHILD2_2_SELECT_INCREMENT_TABLES1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_AUTO_INCREMENT_INCREMENT1;
+ echo CHILD2_2_AUTO_INCREMENT_OFFSET1;
+ }
+ eval $CHILD2_2_AUTO_INCREMENT_INCREMENT1;
+ eval $CHILD2_2_AUTO_INCREMENT_OFFSET1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+}
+
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_REPLICATION)
+{
+ --connection slave1_1
+ DROP DATABASE IF EXISTS auto_test_local;
+}
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+}
+--disable_query_log
+--disable_result_log
+--source slave_test_deinit.inc
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/oracle2/include/deinit_child3_1.inc b/storage/spider/mysql-test/spider/oracle2/include/deinit_child3_1.inc
index 9b6a9851ccb..74c8efa90aa 100644
--- a/storage/spider/mysql-test/spider/oracle2/include/deinit_child3_1.inc
+++ b/storage/spider/mysql-test/spider/oracle2/include/deinit_child3_1.inc
@@ -1,3 +1,3 @@
---let $TEST_ENGINE_TYPE= $CHILD3_1_ENGINE_TYPE
---let $INIT_TEST_ENGINE= $INIT_CHILD3_1_ENGINE
---source ../../include/deinit_engine.inc
+--let $TEST_ENGINE_TYPE= $CHILD3_1_ENGINE_TYPE
+--let $INIT_TEST_ENGINE= $INIT_CHILD3_1_ENGINE
+--source ../../include/deinit_engine.inc
diff --git a/storage/spider/mysql-test/spider/oracle2/include/deinit_child3_2.inc b/storage/spider/mysql-test/spider/oracle2/include/deinit_child3_2.inc
index ac0bcdaa938..f42a980ad23 100644
--- a/storage/spider/mysql-test/spider/oracle2/include/deinit_child3_2.inc
+++ b/storage/spider/mysql-test/spider/oracle2/include/deinit_child3_2.inc
@@ -1,3 +1,3 @@
---let $TEST_ENGINE_TYPE= $CHILD3_2_ENGINE_TYPE
---let $INIT_TEST_ENGINE= $INIT_CHILD3_2_ENGINE
---source ../../include/deinit_engine.inc
+--let $TEST_ENGINE_TYPE= $CHILD3_2_ENGINE_TYPE
+--let $INIT_TEST_ENGINE= $INIT_CHILD3_2_ENGINE
+--source ../../include/deinit_engine.inc
diff --git a/storage/spider/mysql-test/spider/oracle2/include/deinit_child3_3.inc b/storage/spider/mysql-test/spider/oracle2/include/deinit_child3_3.inc
index c93a9822d90..0696fb991cf 100644
--- a/storage/spider/mysql-test/spider/oracle2/include/deinit_child3_3.inc
+++ b/storage/spider/mysql-test/spider/oracle2/include/deinit_child3_3.inc
@@ -1,3 +1,3 @@
---let $TEST_ENGINE_TYPE= $CHILD3_3_ENGINE_TYPE
---let $INIT_TEST_ENGINE= $INIT_CHILD3_3_ENGINE
---source ../../include/deinit_engine.inc
+--let $TEST_ENGINE_TYPE= $CHILD3_3_ENGINE_TYPE
+--let $INIT_TEST_ENGINE= $INIT_CHILD3_3_ENGINE
+--source ../../include/deinit_engine.inc
diff --git a/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child3_1.inc b/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child3_1.inc
index 8fd2ff8a777..c19e376d10a 100644
--- a/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child3_1.inc
+++ b/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child3_1.inc
@@ -1 +1 @@
---source ../../include/deinit_spider.inc
+--source ../../include/deinit_spider.inc
diff --git a/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child3_2.inc b/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child3_2.inc
index 8fd2ff8a777..c19e376d10a 100644
--- a/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child3_2.inc
+++ b/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child3_2.inc
@@ -1 +1 @@
---source ../../include/deinit_spider.inc
+--source ../../include/deinit_spider.inc
diff --git a/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child3_3.inc b/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child3_3.inc
index 8fd2ff8a777..c19e376d10a 100644
--- a/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child3_3.inc
+++ b/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child3_3.inc
@@ -1 +1 @@
---source ../../include/deinit_spider.inc
+--source ../../include/deinit_spider.inc
diff --git a/storage/spider/mysql-test/spider/oracle2/include/ha_init_child2_1.inc b/storage/spider/mysql-test/spider/oracle2/include/ha_init_child2_1.inc
index 59c0175d349..2684829408d 100644
--- a/storage/spider/mysql-test/spider/oracle2/include/ha_init_child2_1.inc
+++ b/storage/spider/mysql-test/spider/oracle2/include/ha_init_child2_1.inc
@@ -1,8 +1,8 @@
-let $CHILD2_1_HA_AS_DROP_TABLES=
- $CHILD2_1_DROP_TABLES;
-let $CHILD2_1_HA_AS_CREATE_TABLES=
- $CHILD2_1_CREATE_TABLES;
-let $CHILD2_1_HA_AS_DROP_TABLES2=
- $CHILD2_1_DROP_TABLES2;
-let $CHILD2_1_HA_AS_CREATE_TABLES2=
- $CHILD2_1_CREATE_TABLES2;
+let $CHILD2_1_HA_AS_DROP_TABLES=
+ $CHILD2_1_DROP_TABLES;
+let $CHILD2_1_HA_AS_CREATE_TABLES=
+ $CHILD2_1_CREATE_TABLES;
+let $CHILD2_1_HA_AS_DROP_TABLES2=
+ $CHILD2_1_DROP_TABLES2;
+let $CHILD2_1_HA_AS_CREATE_TABLES2=
+ $CHILD2_1_CREATE_TABLES2;
diff --git a/storage/spider/mysql-test/spider/oracle2/include/ha_init_child2_2.inc b/storage/spider/mysql-test/spider/oracle2/include/ha_init_child2_2.inc
index 90d27ed704d..205eaa6fe35 100644
--- a/storage/spider/mysql-test/spider/oracle2/include/ha_init_child2_2.inc
+++ b/storage/spider/mysql-test/spider/oracle2/include/ha_init_child2_2.inc
@@ -1,4 +1,4 @@
-let $CHILD2_2_HA_DROP_TABLES=
- $CHILD2_2_DROP_TABLES;
-let $CHILD2_2_HA_CREATE_TABLES=
- $CHILD2_2_CREATE_TABLES;
+let $CHILD2_2_HA_DROP_TABLES=
+ $CHILD2_2_DROP_TABLES;
+let $CHILD2_2_HA_CREATE_TABLES=
+ $CHILD2_2_CREATE_TABLES;
diff --git a/storage/spider/mysql-test/spider/oracle2/include/ha_init_child2_3.inc b/storage/spider/mysql-test/spider/oracle2/include/ha_init_child2_3.inc
index 11abf112b1f..55cb858372c 100644
--- a/storage/spider/mysql-test/spider/oracle2/include/ha_init_child2_3.inc
+++ b/storage/spider/mysql-test/spider/oracle2/include/ha_init_child2_3.inc
@@ -1,4 +1,4 @@
-let $CHILD2_3_HA_DROP_TABLES=
- $CHILD2_3_DROP_TABLES;
-let $CHILD2_3_HA_CREATE_TABLES=
- $CHILD2_3_CREATE_TABLES;
+let $CHILD2_3_HA_DROP_TABLES=
+ $CHILD2_3_DROP_TABLES;
+let $CHILD2_3_HA_CREATE_TABLES=
+ $CHILD2_3_CREATE_TABLES;
diff --git a/storage/spider/mysql-test/spider/oracle2/include/ha_init_child3_1.inc b/storage/spider/mysql-test/spider/oracle2/include/ha_init_child3_1.inc
index 67f6676a07a..8357f0bdbc2 100644
--- a/storage/spider/mysql-test/spider/oracle2/include/ha_init_child3_1.inc
+++ b/storage/spider/mysql-test/spider/oracle2/include/ha_init_child3_1.inc
@@ -1,140 +1,140 @@
---let $CHILD3_1_ENGINE_TYPE=Spider
---let $CHILD3_1_ENGINE=ENGINE=Spider
---source ../include/init_spider.inc
-eval INSERT INTO mysql.spider_link_mon_servers
-(db_name, table_name, link_id, sid, server, scheme, host, port, socket,
- username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key,
- ssl_verify_server_cert, default_file, default_group) VALUES
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
-let $CHILD3_1_CHECK_LINK_STATUS=
- SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
- ORDER BY db_name, table_name, link_id;
-let $CHILD3_1_CHECK_LINK_FAILED_LOG=
- SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
-let $CHILD3_1_SET_RECOVERY_STATUS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2", lst "0 2"';
-let $CHILD3_1_SET_OK_STATUS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2", lst "0 1"';
-let $CHILD3_1_SET_OK_STATUS_AS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2", lst "1 0"';
-
-let $CHILD3_1_DROP_TABLES_HA_2_1=
- DROP TABLE IF EXISTS ta_l;
-if ($VERSION_COMPILE_OS_WIN)
-{
- let $CHILD3_1_CREATE_TABLES_HA_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
- COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2"';
- let $CHILD3_1_CREATE_TABLES_HA_AS_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
- COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2"';
-}
-if (!$VERSION_COMPILE_OS_WIN)
-{
- let $CHILD3_1_CREATE_TABLES_HA_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
- COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2"';
- let $CHILD3_1_CREATE_TABLES_HA_AS_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
- COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2"';
-}
-let $CHILD3_1_DROP_TABLES_HA_P_2_1=
- DROP TABLE IF EXISTS ta_l2;
-let $CHILD3_1_CREATE_TABLES_HA_P_2_1=
- CREATE TABLE ta_l2 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
- COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"'
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001"'
- );
-let $CHILD3_1_CREATE_TABLES_HA_AS_P_2_1=
- CREATE TABLE ta_l2 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
- COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"'
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001"'
- );
-let $CHILD3_1_SET_RECOVERY_STATUS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 2"'
- );
-let $CHILD3_1_SET_OK_STATUS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 1"'
- );
-let $CHILD3_1_SET_OK_STATUS_AS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "1 0"'
- );
+--let $CHILD3_1_ENGINE_TYPE=Spider
+--let $CHILD3_1_ENGINE=ENGINE=Spider
+--source ../include/init_spider.inc
+eval INSERT INTO mysql.spider_link_mon_servers
+(db_name, table_name, link_id, sid, server, scheme, host, port, socket,
+ username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key,
+ ssl_verify_server_cert, default_file, default_group) VALUES
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
+let $CHILD3_1_CHECK_LINK_STATUS=
+ SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
+ ORDER BY db_name, table_name, link_id;
+let $CHILD3_1_CHECK_LINK_FAILED_LOG=
+ SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
+let $CHILD3_1_SET_RECOVERY_STATUS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 2"';
+let $CHILD3_1_SET_OK_STATUS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 1"';
+let $CHILD3_1_SET_OK_STATUS_AS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2", lst "1 0"';
+
+let $CHILD3_1_DROP_TABLES_HA_2_1=
+ DROP TABLE IF EXISTS ta_l;
+if ($VERSION_COMPILE_OS_WIN)
+{
+ let $CHILD3_1_CREATE_TABLES_HA_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
+ COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2"';
+ let $CHILD3_1_CREATE_TABLES_HA_AS_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
+ COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2"';
+}
+if (!$VERSION_COMPILE_OS_WIN)
+{
+ let $CHILD3_1_CREATE_TABLES_HA_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
+ COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2"';
+ let $CHILD3_1_CREATE_TABLES_HA_AS_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
+ COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2"';
+}
+let $CHILD3_1_DROP_TABLES_HA_P_2_1=
+ DROP TABLE IF EXISTS ta_l2;
+let $CHILD3_1_CREATE_TABLES_HA_P_2_1=
+ CREATE TABLE ta_l2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
+ COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"'
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001"'
+ );
+let $CHILD3_1_CREATE_TABLES_HA_AS_P_2_1=
+ CREATE TABLE ta_l2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
+ COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"'
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001"'
+ );
+let $CHILD3_1_SET_RECOVERY_STATUS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 2"'
+ );
+let $CHILD3_1_SET_OK_STATUS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 1"'
+ );
+let $CHILD3_1_SET_OK_STATUS_AS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "1 0"'
+ );
diff --git a/storage/spider/mysql-test/spider/oracle2/include/ha_init_child3_2.inc b/storage/spider/mysql-test/spider/oracle2/include/ha_init_child3_2.inc
index 9b61a2e2b73..3ffcec24f51 100644
--- a/storage/spider/mysql-test/spider/oracle2/include/ha_init_child3_2.inc
+++ b/storage/spider/mysql-test/spider/oracle2/include/ha_init_child3_2.inc
@@ -1,140 +1,140 @@
---let $CHILD3_2_ENGINE_TYPE=Spider
---let $CHILD3_2_ENGINE=ENGINE=Spider
---source ../include/init_spider.inc
-eval INSERT INTO mysql.spider_link_mon_servers
-(db_name, table_name, link_id, sid, server, scheme, host, port, socket,
- username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key,
- ssl_verify_server_cert, default_file, default_group) VALUES
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
-let $CHILD3_2_CHECK_LINK_STATUS=
- SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
- ORDER BY db_name, table_name, link_id;
-let $CHILD3_2_CHECK_LINK_FAILED_LOG=
- SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
-let $CHILD3_2_SET_RECOVERY_STATUS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2", lst "0 2"';
-let $CHILD3_2_SET_OK_STATUS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2", lst "0 1"';
-let $CHILD3_2_SET_OK_STATUS_AS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2", lst "1 0"';
-
-let $CHILD3_2_DROP_TABLES_HA_2_1=
- DROP TABLE IF EXISTS ta_l;
-if ($VERSION_COMPILE_OS_WIN)
-{
- let $CHILD3_2_CREATE_TABLES_HA_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
- COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2"';
- let $CHILD3_2_CREATE_TABLES_HA_AS_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
- COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2"';
-}
-if (!$VERSION_COMPILE_OS_WIN)
-{
- let $CHILD3_2_CREATE_TABLES_HA_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
- COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2"';
- let $CHILD3_2_CREATE_TABLES_HA_AS_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
- COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2"';
-}
-let $CHILD3_2_DROP_TABLES_HA_P_2_1=
- DROP TABLE IF EXISTS ta_l2;
-let $CHILD3_2_CREATE_TABLES_HA_P_2_1=
- CREATE TABLE ta_l2 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
- COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"'
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001"'
- );
-let $CHILD3_2_CREATE_TABLES_HA_AS_P_2_1=
- CREATE TABLE ta_l2 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
- COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"'
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001"'
- );
-let $CHILD3_2_SET_RECOVERY_STATUS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 2"'
- );
-let $CHILD3_2_SET_OK_STATUS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 1"'
- );
-let $CHILD3_2_SET_OK_STATUS_AS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "1 0"'
- );
+--let $CHILD3_2_ENGINE_TYPE=Spider
+--let $CHILD3_2_ENGINE=ENGINE=Spider
+--source ../include/init_spider.inc
+eval INSERT INTO mysql.spider_link_mon_servers
+(db_name, table_name, link_id, sid, server, scheme, host, port, socket,
+ username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key,
+ ssl_verify_server_cert, default_file, default_group) VALUES
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
+let $CHILD3_2_CHECK_LINK_STATUS=
+ SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
+ ORDER BY db_name, table_name, link_id;
+let $CHILD3_2_CHECK_LINK_FAILED_LOG=
+ SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
+let $CHILD3_2_SET_RECOVERY_STATUS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 2"';
+let $CHILD3_2_SET_OK_STATUS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 1"';
+let $CHILD3_2_SET_OK_STATUS_AS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2", lst "1 0"';
+
+let $CHILD3_2_DROP_TABLES_HA_2_1=
+ DROP TABLE IF EXISTS ta_l;
+if ($VERSION_COMPILE_OS_WIN)
+{
+ let $CHILD3_2_CREATE_TABLES_HA_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
+ COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2"';
+ let $CHILD3_2_CREATE_TABLES_HA_AS_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
+ COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2"';
+}
+if (!$VERSION_COMPILE_OS_WIN)
+{
+ let $CHILD3_2_CREATE_TABLES_HA_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
+ COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2"';
+ let $CHILD3_2_CREATE_TABLES_HA_AS_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
+ COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2"';
+}
+let $CHILD3_2_DROP_TABLES_HA_P_2_1=
+ DROP TABLE IF EXISTS ta_l2;
+let $CHILD3_2_CREATE_TABLES_HA_P_2_1=
+ CREATE TABLE ta_l2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
+ COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"'
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001"'
+ );
+let $CHILD3_2_CREATE_TABLES_HA_AS_P_2_1=
+ CREATE TABLE ta_l2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
+ COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"'
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001"'
+ );
+let $CHILD3_2_SET_RECOVERY_STATUS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 2"'
+ );
+let $CHILD3_2_SET_OK_STATUS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 1"'
+ );
+let $CHILD3_2_SET_OK_STATUS_AS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "1 0"'
+ );
diff --git a/storage/spider/mysql-test/spider/oracle2/include/ha_init_child3_3.inc b/storage/spider/mysql-test/spider/oracle2/include/ha_init_child3_3.inc
index 5724a50b3d9..67bd00109f5 100644
--- a/storage/spider/mysql-test/spider/oracle2/include/ha_init_child3_3.inc
+++ b/storage/spider/mysql-test/spider/oracle2/include/ha_init_child3_3.inc
@@ -1,140 +1,140 @@
---let $CHILD3_3_ENGINE_TYPE=Spider
---let $CHILD3_3_ENGINE=ENGINE=Spider
---source ../include/init_spider.inc
-eval INSERT INTO mysql.spider_link_mon_servers
-(db_name, table_name, link_id, sid, server, scheme, host, port, socket,
- username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key,
- ssl_verify_server_cert, default_file, default_group) VALUES
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
-let $CHILD3_3_CHECK_LINK_STATUS=
- SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
- ORDER BY db_name, table_name, link_id;
-let $CHILD3_3_CHECK_LINK_FAILED_LOG=
- SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
-let $CHILD3_3_SET_RECOVERY_STATUS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2", lst "0 2"';
-let $CHILD3_3_SET_OK_STATUS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2", lst "0 1"';
-let $CHILD3_3_SET_OK_STATUS_AS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2", lst "1 0"';
-
-let $CHILD3_3_DROP_TABLES_HA_2_1=
- DROP TABLE IF EXISTS ta_l;
-if ($VERSION_COMPILE_OS_WIN)
-{
- let $CHILD3_3_CREATE_TABLES_HA_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
- COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2"';
- let $CHILD3_3_CREATE_TABLES_HA_AS_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
- COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2"';
-}
-if (!$VERSION_COMPILE_OS_WIN)
-{
- let $CHILD3_3_CREATE_TABLES_HA_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
- COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2"';
- let $CHILD3_3_CREATE_TABLES_HA_AS_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
- COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2"';
-}
-let $CHILD3_3_DROP_TABLES_HA_P_2_1=
- DROP TABLE IF EXISTS ta_l2;
-let $CHILD3_3_CREATE_TABLES_HA_P_2_1=
- CREATE TABLE ta_l2 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
- COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"'
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001"'
- );
-let $CHILD3_3_CREATE_TABLES_HA_AS_P_2_1=
- CREATE TABLE ta_l2 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
- COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"'
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001"'
- );
-let $CHILD3_3_SET_RECOVERY_STATUS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 2"'
- );
-let $CHILD3_3_SET_OK_STATUS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 1"'
- );
-let $CHILD3_3_SET_OK_STATUS_AS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "1 0"'
- );
+--let $CHILD3_3_ENGINE_TYPE=Spider
+--let $CHILD3_3_ENGINE=ENGINE=Spider
+--source ../include/init_spider.inc
+eval INSERT INTO mysql.spider_link_mon_servers
+(db_name, table_name, link_id, sid, server, scheme, host, port, socket,
+ username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key,
+ ssl_verify_server_cert, default_file, default_group) VALUES
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
+let $CHILD3_3_CHECK_LINK_STATUS=
+ SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
+ ORDER BY db_name, table_name, link_id;
+let $CHILD3_3_CHECK_LINK_FAILED_LOG=
+ SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
+let $CHILD3_3_SET_RECOVERY_STATUS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 2"';
+let $CHILD3_3_SET_OK_STATUS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 1"';
+let $CHILD3_3_SET_OK_STATUS_AS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2", lst "1 0"';
+
+let $CHILD3_3_DROP_TABLES_HA_2_1=
+ DROP TABLE IF EXISTS ta_l;
+if ($VERSION_COMPILE_OS_WIN)
+{
+ let $CHILD3_3_CREATE_TABLES_HA_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
+ COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2"';
+ let $CHILD3_3_CREATE_TABLES_HA_AS_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
+ COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2"';
+}
+if (!$VERSION_COMPILE_OS_WIN)
+{
+ let $CHILD3_3_CREATE_TABLES_HA_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
+ COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2"';
+ let $CHILD3_3_CREATE_TABLES_HA_AS_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
+ COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2"';
+}
+let $CHILD3_3_DROP_TABLES_HA_P_2_1=
+ DROP TABLE IF EXISTS ta_l2;
+let $CHILD3_3_CREATE_TABLES_HA_P_2_1=
+ CREATE TABLE ta_l2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
+ COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"'
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001"'
+ );
+let $CHILD3_3_CREATE_TABLES_HA_AS_P_2_1=
+ CREATE TABLE ta_l2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
+ COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"'
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001"'
+ );
+let $CHILD3_3_SET_RECOVERY_STATUS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 2"'
+ );
+let $CHILD3_3_SET_OK_STATUS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 1"'
+ );
+let $CHILD3_3_SET_OK_STATUS_AS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "1 0"'
+ );
diff --git a/storage/spider/mysql-test/spider/oracle2/include/hs_init_child2_1.inc b/storage/spider/mysql-test/spider/oracle2/include/hs_init_child2_1.inc
index e0467b92307..f3f92a61e6f 100644
--- a/storage/spider/mysql-test/spider/oracle2/include/hs_init_child2_1.inc
+++ b/storage/spider/mysql-test/spider/oracle2/include/hs_init_child2_1.inc
@@ -1,24 +1,24 @@
-let $CHILD2_1_HS_DROP_TABLES=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "hs_r"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_HS_CREATE_TABLES=
- SELECT spider_direct_sql('CREATE TABLE "hs_r" (
- "a" INT DEFAULT 10,
- "b" CHAR(1) DEFAULT \'c\',
- "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'),
- "d" INT DEFAULT 11,
- CONSTRAINT "pk_s_2_1_hs_r" PRIMARY KEY("a")
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_HS_SELECT_TABLES=
- SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\'), "d" FROM "hs_r" ORDER BY "a"', '', 'srv "s_2_1"');
-let $CHILD2_1_HS_DROP_TABLES2=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "hs_r2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_HS_CREATE_TABLES2=
- SELECT spider_direct_sql('CREATE TABLE "hs_r2" (
- "a" INT DEFAULT 10,
- "b" CHAR(1) DEFAULT \'c\',
- "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'),
- "d" INT DEFAULT 11,
- CONSTRAINT "pk_s_2_1_hs_r2" PRIMARY KEY("a")
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_HS_SELECT_TABLES2=
- SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\'), "d" FROM "hs_r2" ORDER BY "a"', '', 'srv "s_2_1"');
+let $CHILD2_1_HS_DROP_TABLES=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "hs_r"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
+let $CHILD2_1_HS_CREATE_TABLES=
+ SELECT spider_direct_sql('CREATE TABLE "hs_r" (
+ "a" INT DEFAULT 10,
+ "b" CHAR(1) DEFAULT \'c\',
+ "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'),
+ "d" INT DEFAULT 11,
+ CONSTRAINT "pk_s_2_1_hs_r" PRIMARY KEY("a")
+ )', '', 'srv "s_2_1"');
+let $CHILD2_1_HS_SELECT_TABLES=
+ SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\'), "d" FROM "hs_r" ORDER BY "a"', '', 'srv "s_2_1"');
+let $CHILD2_1_HS_DROP_TABLES2=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "hs_r2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
+let $CHILD2_1_HS_CREATE_TABLES2=
+ SELECT spider_direct_sql('CREATE TABLE "hs_r2" (
+ "a" INT DEFAULT 10,
+ "b" CHAR(1) DEFAULT \'c\',
+ "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'),
+ "d" INT DEFAULT 11,
+ CONSTRAINT "pk_s_2_1_hs_r2" PRIMARY KEY("a")
+ )', '', 'srv "s_2_1"');
+let $CHILD2_1_HS_SELECT_TABLES2=
+ SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\'), "d" FROM "hs_r2" ORDER BY "a"', '', 'srv "s_2_1"');
diff --git a/storage/spider/mysql-test/spider/oracle2/include/hs_init_child2_2.inc b/storage/spider/mysql-test/spider/oracle2/include/hs_init_child2_2.inc
index 0466acbc66b..4bd8d49c17c 100644
--- a/storage/spider/mysql-test/spider/oracle2/include/hs_init_child2_2.inc
+++ b/storage/spider/mysql-test/spider/oracle2/include/hs_init_child2_2.inc
@@ -1,12 +1,12 @@
-let $CHILD2_2_HS_DROP_TABLES=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "hs_r3"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"');
-let $CHILD2_2_HS_CREATE_TABLES=
- SELECT spider_direct_sql('CREATE TABLE "hs_r3" (
- "a" INT DEFAULT 10,
- "b" CHAR(1) DEFAULT \'c\',
- "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'),
- "d" INT DEFAULT 11,
- CONSTRAINT "pk_s_2_2_hs_r3" PRIMARY KEY("a")
- )', '', 'srv "s_2_2"');
-let $CHILD2_2_HS_SELECT_TABLES=
- SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\'), "d" FROM "hs_r3" ORDER BY "a"', '', 'srv "s_2_2"');
+let $CHILD2_2_HS_DROP_TABLES=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "hs_r3"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"');
+let $CHILD2_2_HS_CREATE_TABLES=
+ SELECT spider_direct_sql('CREATE TABLE "hs_r3" (
+ "a" INT DEFAULT 10,
+ "b" CHAR(1) DEFAULT \'c\',
+ "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'),
+ "d" INT DEFAULT 11,
+ CONSTRAINT "pk_s_2_2_hs_r3" PRIMARY KEY("a")
+ )', '', 'srv "s_2_2"');
+let $CHILD2_2_HS_SELECT_TABLES=
+ SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\'), "d" FROM "hs_r3" ORDER BY "a"', '', 'srv "s_2_2"');
diff --git a/storage/spider/mysql-test/spider/oracle2/include/init_child2_1.inc b/storage/spider/mysql-test/spider/oracle2/include/init_child2_1.inc
index 18dcc7159cc..c24736eefca 100644
--- a/storage/spider/mysql-test/spider/oracle2/include/init_child2_1.inc
+++ b/storage/spider/mysql-test/spider/oracle2/include/init_child2_1.inc
@@ -1,192 +1,192 @@
---connection master_1
-SELECT spider_direct_sql('ALTER SESSION SET NLS_DATE_FORMAT=\'YYYY-MM-DD HH24:MI:SS\'', '', 'srv "s_2_1"');
-SELECT spider_direct_sql('ALTER SESSION SET NLS_TIME_FORMAT=\'HH24:MI:SSXFF\'', '', 'srv "s_2_1"');
-SELECT spider_direct_sql('ALTER SESSION SET NLS_TIMESTAMP_FORMAT=\'YYYY-MM-DD HH24:MI:SSXFF\'', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_TABLES=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_TABLES=
- SELECT spider_direct_sql('CREATE TABLE "ta_r" (
- "a" INT DEFAULT 10,
- "b" CHAR(1) DEFAULT \'c\',
- "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'),
- CONSTRAINT "pk_s_2_1_ta_r" PRIMARY KEY("a")
- )', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE INDEX "idx1" ON "ta_r"("b")', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_TABLES=
- SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r" ORDER BY "a"', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_TABLES2=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_TABLES2=
- SELECT spider_direct_sql('CREATE TABLE "ta_r2" (
- "a" INT DEFAULT 10,
- "b" CHAR(1) DEFAULT \'c\',
- "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'),
- CONSTRAINT "pk_s_2_1_ta_r2" PRIMARY KEY("a")
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_TABLES2=
- SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r2" ORDER BY "a"', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_TABLES3=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r_no_idx"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_TABLES3=
- SELECT spider_direct_sql('CREATE TABLE "ta_r_no_idx" (
- "a" INT DEFAULT 10,
- "b" CHAR(1) DEFAULT \'c\',
- "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\')
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_TABLES3=
- SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r_no_idx" ORDER BY "a"', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_TABLES4=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r_auto_inc"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_TABLES4=
- SELECT spider_direct_sql('CREATE TABLE "ta_r_auto_inc" (
- "a" INT DEFAULT 10,
- "b" CHAR(1) DEFAULT \'c\',
- "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'),
- CONSTRAINT "pk_s_2_1_ta_r_auto_inc" PRIMARY KEY("a")
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_TABLES4=
- SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r_auto_inc"
- ORDER BY "a"', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_TABLES5=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "s_2_1_ta_r_int"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_TABLES5=
- SELECT spider_direct_sql('CREATE TABLE "s_2_1_ta_r_int" (
- "a" INT DEFAULT 3,
- "b" INT DEFAULT 10,
- "c" INT DEFAULT 11,
- CONSTRAINT "pk_s_2_1_ta_r_int" PRIMARY KEY("a")
- )', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE INDEX "idx1_s_2_1_ta_r_int" ON "s_2_1_ta_r_int"("b")', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE INDEX "idx2_s_2_1_ta_r_int" ON "s_2_1_ta_r_int"("c")', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_TABLES5=
- SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "s_2_1_ta_r_int" ORDER BY "a"', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_TABLES6=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r_3"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_TABLES6=
- SELECT spider_direct_sql('CREATE TABLE "ta_r_3" (
- "a" INT DEFAULT 10,
- "b" CHAR(1) DEFAULT \'c\',
- "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\')
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_TABLES6=
- SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r_3" ORDER BY "a"', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_FT_TABLES=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ft_r"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_FT_TABLES=
- SELECT spider_direct_sql('CREATE TABLE "ft_r" (
- "a" INT DEFAULT 0,
- "b" TEXT,
- "c" TEXT,
- "d" TEXT,
- CONSTRAINT "pk_s_2_1_ft_r" PRIMARY KEY("a"),
- FULLTEXT INDEX "ft_idx1"("b"),
- FULLTEXT INDEX "ft_idx2"("c")
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_FT_TABLES=
- SELECT spider_direct_sql('SELECT "a", "b", "c", "d" FROM "ft_r" ORDER BY "a"', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_FT_TABLES2=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ft_r2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_FT_TABLES2=
- SELECT spider_direct_sql('CREATE TABLE "ft_r2" (
- "a" INT DEFAULT 0,
- "b" TEXT,
- "c" TEXT,
- "d" TEXT,
- CONSTRAINT "pk_s_2_1_ft_r2" PRIMARY KEY("a"),
- FULLTEXT INDEX "ft_idx1"("b"),
- FULLTEXT INDEX "ft_idx2"("c")
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_FT_TABLES2=
- SELECT spider_direct_sql('SELECT "a", "b", "c", "d" FROM "ft_r2" ORDER BY "a"', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_GM_TABLES=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "gm_r"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_GM_TABLES=
- SELECT spider_direct_sql('CREATE TABLE "gm_r" (
- "a" INT DEFAULT 0,
- "b" GEOMETRY NOT NULL,
- "c" GEOMETRY NOT NULL,
- CONSTRAINT "pk_s_2_1_gm_r" PRIMARY KEY("a"),
- SPATIAL INDEX "sp_idx1"("b"),
- SPATIAL INDEX "sp_idx2"("c")
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_GM_TABLES=
- SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "gm_r" ORDER BY "a"', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_GM_TABLES2=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "gm_r2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_GM_TABLES2=
- SELECT spider_direct_sql('CREATE TABLE "gm_r2" (
- "a" INT DEFAULT 0,
- "b" GEOMETRY NOT NULL,
- "c" GEOMETRY NOT NULL,
- CONSTRAINT "pk_s_2_1_gm_r2" PRIMARY KEY("a"),
- SPATIAL INDEX "sp_idx1"("b"),
- SPATIAL INDEX "sp_idx2"("c")
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_GM_TABLES2=
- SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "gm_r2" ORDER BY "a"', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_LOCK_TABLES1=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_LOCK_TABLES1=
- SELECT spider_direct_sql('CREATE TABLE "t1_1" (
- "id" INT NOT NULL,
- CONSTRAINT "pk_s_2_1_t1_1" PRIMARY KEY ("id")
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_LOCK_TABLES2=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t2_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_LOCK_TABLES2=
- SELECT spider_direct_sql('CREATE TABLE "t2_2" (
- "id" INT NOT NULL,
- CONSTRAINT "pk_s_2_1_t2_2" PRIMARY KEY ("id")
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_INCREMENT_TABLES1=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_INCREMENT_TABLES1=
- SELECT spider_direct_sql('CREATE TABLE "t1_1" (
- "id" INT NOT NULL,
- CONSTRAINT "pk_s_2_1_t1_1" PRIMARY KEY ("id")
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_INCREMENT_TABLES1=
- SELECT spider_direct_sql('SELECT "id" FROM "t1_1" ORDER BY "id"', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_TEXT_PK_TABLES1=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_TEXT_PK_TABLES1=
- SELECT spider_direct_sql('CREATE TABLE "t1" (
- "a" VARCHAR(255),
- CONSTRAINT "pk_s_2_1_t1" PRIMARY KEY ("a")
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_TEXT_PK_TABLES1=
- SELECT spider_direct_sql('SELECT "a" FROM "t1" ORDER BY "a"', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_TEXT_KEY_TABLES1=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_TEXT_KEY_TABLES1=
- SELECT spider_direct_sql('CREATE TABLE "t1" (
- "a" VARCHAR(255),
- "b" VARCHAR(255),
- "c" VARCHAR(255),
- CONSTRAINT "pk_s_2_1_t1" PRIMARY KEY ("c")
- )', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE INDEX "idx1_t1" ON "t1"("a","b")', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE INDEX "idx2_t1" ON "t1"("b")', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_TEXT_KEY_TABLES1=
- SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "t1" ORDER BY "c"', '', 'srv "s_2_1"');
-let $CHILD2_1_AUTO_INCREMENT_INCREMENT1=
- SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_1"');
-let $CHILD2_1_AUTO_INCREMENT_INCREMENT2=
- SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"');
-let $CHILD2_1_AUTO_INCREMENT_OFFSET1=
- SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_1"');
-let $CHILD2_1_AUTO_INCREMENT_OFFSET2=
- SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"');
+--connection master_1
+SELECT spider_direct_sql('ALTER SESSION SET NLS_DATE_FORMAT=\'YYYY-MM-DD HH24:MI:SS\'', '', 'srv "s_2_1"');
+SELECT spider_direct_sql('ALTER SESSION SET NLS_TIME_FORMAT=\'HH24:MI:SSXFF\'', '', 'srv "s_2_1"');
+SELECT spider_direct_sql('ALTER SESSION SET NLS_TIMESTAMP_FORMAT=\'YYYY-MM-DD HH24:MI:SSXFF\'', '', 'srv "s_2_1"');
+let $CHILD2_1_DROP_TABLES=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
+let $CHILD2_1_CREATE_TABLES=
+ SELECT spider_direct_sql('CREATE TABLE "ta_r" (
+ "a" INT DEFAULT 10,
+ "b" CHAR(1) DEFAULT \'c\',
+ "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'),
+ CONSTRAINT "pk_s_2_1_ta_r" PRIMARY KEY("a")
+ )', '', 'srv "s_2_1"')
+ $STR_SEMICOLON
+ SELECT spider_direct_sql('CREATE INDEX "idx1" ON "ta_r"("b")', '', 'srv "s_2_1"');
+let $CHILD2_1_SELECT_TABLES=
+ SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r" ORDER BY "a"', '', 'srv "s_2_1"');
+let $CHILD2_1_DROP_TABLES2=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
+let $CHILD2_1_CREATE_TABLES2=
+ SELECT spider_direct_sql('CREATE TABLE "ta_r2" (
+ "a" INT DEFAULT 10,
+ "b" CHAR(1) DEFAULT \'c\',
+ "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'),
+ CONSTRAINT "pk_s_2_1_ta_r2" PRIMARY KEY("a")
+ )', '', 'srv "s_2_1"');
+let $CHILD2_1_SELECT_TABLES2=
+ SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r2" ORDER BY "a"', '', 'srv "s_2_1"');
+let $CHILD2_1_DROP_TABLES3=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r_no_idx"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
+let $CHILD2_1_CREATE_TABLES3=
+ SELECT spider_direct_sql('CREATE TABLE "ta_r_no_idx" (
+ "a" INT DEFAULT 10,
+ "b" CHAR(1) DEFAULT \'c\',
+ "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\')
+ )', '', 'srv "s_2_1"');
+let $CHILD2_1_SELECT_TABLES3=
+ SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r_no_idx" ORDER BY "a"', '', 'srv "s_2_1"');
+let $CHILD2_1_DROP_TABLES4=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r_auto_inc"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
+let $CHILD2_1_CREATE_TABLES4=
+ SELECT spider_direct_sql('CREATE TABLE "ta_r_auto_inc" (
+ "a" INT DEFAULT 10,
+ "b" CHAR(1) DEFAULT \'c\',
+ "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'),
+ CONSTRAINT "pk_s_2_1_ta_r_auto_inc" PRIMARY KEY("a")
+ )', '', 'srv "s_2_1"');
+let $CHILD2_1_SELECT_TABLES4=
+ SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r_auto_inc"
+ ORDER BY "a"', '', 'srv "s_2_1"');
+let $CHILD2_1_DROP_TABLES5=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "s_2_1_ta_r_int"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
+let $CHILD2_1_CREATE_TABLES5=
+ SELECT spider_direct_sql('CREATE TABLE "s_2_1_ta_r_int" (
+ "a" INT DEFAULT 3,
+ "b" INT DEFAULT 10,
+ "c" INT DEFAULT 11,
+ CONSTRAINT "pk_s_2_1_ta_r_int" PRIMARY KEY("a")
+ )', '', 'srv "s_2_1"')
+ $STR_SEMICOLON
+ SELECT spider_direct_sql('CREATE INDEX "idx1_s_2_1_ta_r_int" ON "s_2_1_ta_r_int"("b")', '', 'srv "s_2_1"')
+ $STR_SEMICOLON
+ SELECT spider_direct_sql('CREATE INDEX "idx2_s_2_1_ta_r_int" ON "s_2_1_ta_r_int"("c")', '', 'srv "s_2_1"');
+let $CHILD2_1_SELECT_TABLES5=
+ SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "s_2_1_ta_r_int" ORDER BY "a"', '', 'srv "s_2_1"');
+let $CHILD2_1_DROP_TABLES6=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r_3"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
+let $CHILD2_1_CREATE_TABLES6=
+ SELECT spider_direct_sql('CREATE TABLE "ta_r_3" (
+ "a" INT DEFAULT 10,
+ "b" CHAR(1) DEFAULT \'c\',
+ "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\')
+ )', '', 'srv "s_2_1"');
+let $CHILD2_1_SELECT_TABLES6=
+ SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r_3" ORDER BY "a"', '', 'srv "s_2_1"');
+let $CHILD2_1_DROP_FT_TABLES=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ft_r"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
+let $CHILD2_1_CREATE_FT_TABLES=
+ SELECT spider_direct_sql('CREATE TABLE "ft_r" (
+ "a" INT DEFAULT 0,
+ "b" TEXT,
+ "c" TEXT,
+ "d" TEXT,
+ CONSTRAINT "pk_s_2_1_ft_r" PRIMARY KEY("a"),
+ FULLTEXT INDEX "ft_idx1"("b"),
+ FULLTEXT INDEX "ft_idx2"("c")
+ )', '', 'srv "s_2_1"');
+let $CHILD2_1_SELECT_FT_TABLES=
+ SELECT spider_direct_sql('SELECT "a", "b", "c", "d" FROM "ft_r" ORDER BY "a"', '', 'srv "s_2_1"');
+let $CHILD2_1_DROP_FT_TABLES2=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ft_r2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
+let $CHILD2_1_CREATE_FT_TABLES2=
+ SELECT spider_direct_sql('CREATE TABLE "ft_r2" (
+ "a" INT DEFAULT 0,
+ "b" TEXT,
+ "c" TEXT,
+ "d" TEXT,
+ CONSTRAINT "pk_s_2_1_ft_r2" PRIMARY KEY("a"),
+ FULLTEXT INDEX "ft_idx1"("b"),
+ FULLTEXT INDEX "ft_idx2"("c")
+ )', '', 'srv "s_2_1"');
+let $CHILD2_1_SELECT_FT_TABLES2=
+ SELECT spider_direct_sql('SELECT "a", "b", "c", "d" FROM "ft_r2" ORDER BY "a"', '', 'srv "s_2_1"');
+let $CHILD2_1_DROP_GM_TABLES=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "gm_r"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
+let $CHILD2_1_CREATE_GM_TABLES=
+ SELECT spider_direct_sql('CREATE TABLE "gm_r" (
+ "a" INT DEFAULT 0,
+ "b" GEOMETRY NOT NULL,
+ "c" GEOMETRY NOT NULL,
+ CONSTRAINT "pk_s_2_1_gm_r" PRIMARY KEY("a"),
+ SPATIAL INDEX "sp_idx1"("b"),
+ SPATIAL INDEX "sp_idx2"("c")
+ )', '', 'srv "s_2_1"');
+let $CHILD2_1_SELECT_GM_TABLES=
+ SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "gm_r" ORDER BY "a"', '', 'srv "s_2_1"');
+let $CHILD2_1_DROP_GM_TABLES2=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "gm_r2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
+let $CHILD2_1_CREATE_GM_TABLES2=
+ SELECT spider_direct_sql('CREATE TABLE "gm_r2" (
+ "a" INT DEFAULT 0,
+ "b" GEOMETRY NOT NULL,
+ "c" GEOMETRY NOT NULL,
+ CONSTRAINT "pk_s_2_1_gm_r2" PRIMARY KEY("a"),
+ SPATIAL INDEX "sp_idx1"("b"),
+ SPATIAL INDEX "sp_idx2"("c")
+ )', '', 'srv "s_2_1"');
+let $CHILD2_1_SELECT_GM_TABLES2=
+ SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "gm_r2" ORDER BY "a"', '', 'srv "s_2_1"');
+let $CHILD2_1_DROP_LOCK_TABLES1=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
+let $CHILD2_1_CREATE_LOCK_TABLES1=
+ SELECT spider_direct_sql('CREATE TABLE "t1_1" (
+ "id" INT NOT NULL,
+ CONSTRAINT "pk_s_2_1_t1_1" PRIMARY KEY ("id")
+ )', '', 'srv "s_2_1"');
+let $CHILD2_1_DROP_LOCK_TABLES2=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t2_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
+let $CHILD2_1_CREATE_LOCK_TABLES2=
+ SELECT spider_direct_sql('CREATE TABLE "t2_2" (
+ "id" INT NOT NULL,
+ CONSTRAINT "pk_s_2_1_t2_2" PRIMARY KEY ("id")
+ )', '', 'srv "s_2_1"');
+let $CHILD2_1_DROP_INCREMENT_TABLES1=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
+let $CHILD2_1_CREATE_INCREMENT_TABLES1=
+ SELECT spider_direct_sql('CREATE TABLE "t1_1" (
+ "id" INT NOT NULL,
+ CONSTRAINT "pk_s_2_1_t1_1" PRIMARY KEY ("id")
+ )', '', 'srv "s_2_1"');
+let $CHILD2_1_SELECT_INCREMENT_TABLES1=
+ SELECT spider_direct_sql('SELECT "id" FROM "t1_1" ORDER BY "id"', '', 'srv "s_2_1"');
+let $CHILD2_1_DROP_TEXT_PK_TABLES1=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
+let $CHILD2_1_CREATE_TEXT_PK_TABLES1=
+ SELECT spider_direct_sql('CREATE TABLE "t1" (
+ "a" VARCHAR(255),
+ CONSTRAINT "pk_s_2_1_t1" PRIMARY KEY ("a")
+ )', '', 'srv "s_2_1"');
+let $CHILD2_1_SELECT_TEXT_PK_TABLES1=
+ SELECT spider_direct_sql('SELECT "a" FROM "t1" ORDER BY "a"', '', 'srv "s_2_1"');
+let $CHILD2_1_DROP_TEXT_KEY_TABLES1=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
+let $CHILD2_1_CREATE_TEXT_KEY_TABLES1=
+ SELECT spider_direct_sql('CREATE TABLE "t1" (
+ "a" VARCHAR(255),
+ "b" VARCHAR(255),
+ "c" VARCHAR(255),
+ CONSTRAINT "pk_s_2_1_t1" PRIMARY KEY ("c")
+ )', '', 'srv "s_2_1"')
+ $STR_SEMICOLON
+ SELECT spider_direct_sql('CREATE INDEX "idx1_t1" ON "t1"("a","b")', '', 'srv "s_2_1"')
+ $STR_SEMICOLON
+ SELECT spider_direct_sql('CREATE INDEX "idx2_t1" ON "t1"("b")', '', 'srv "s_2_1"');
+let $CHILD2_1_SELECT_TEXT_KEY_TABLES1=
+ SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "t1" ORDER BY "c"', '', 'srv "s_2_1"');
+let $CHILD2_1_AUTO_INCREMENT_INCREMENT1=
+ SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"')
+ $STR_SEMICOLON
+ SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_1"');
+let $CHILD2_1_AUTO_INCREMENT_INCREMENT2=
+ SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"')
+ $STR_SEMICOLON
+ SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"');
+let $CHILD2_1_AUTO_INCREMENT_OFFSET1=
+ SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"')
+ $STR_SEMICOLON
+ SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_1"');
+let $CHILD2_1_AUTO_INCREMENT_OFFSET2=
+ SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"')
+ $STR_SEMICOLON
+ SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"');
diff --git a/storage/spider/mysql-test/spider/oracle2/include/init_child2_2.inc b/storage/spider/mysql-test/spider/oracle2/include/init_child2_2.inc
index 117040dcca6..fd4497c0b59 100644
--- a/storage/spider/mysql-test/spider/oracle2/include/init_child2_2.inc
+++ b/storage/spider/mysql-test/spider/oracle2/include/init_child2_2.inc
@@ -1,94 +1,94 @@
---connection master_1
-SELECT spider_direct_sql('ALTER SESSION SET NLS_DATE_FORMAT=\'YYYY-MM-DD HH24:MI:SS\'', '', 'srv "s_2_2"');
-SELECT spider_direct_sql('ALTER SESSION SET NLS_TIME_FORMAT=\'HH24:MI:SSXFF\'', '', 'srv "s_2_2"');
-SELECT spider_direct_sql('ALTER SESSION SET NLS_TIMESTAMP_FORMAT=\'YYYY-MM-DD HH24:MI:SSXFF\'', '', 'srv "s_2_2"');
-let $CHILD2_2_DROP_TABLES=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r3"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"');
-let $CHILD2_2_CREATE_TABLES=
- SELECT spider_direct_sql('CREATE TABLE "ta_r3" (
- "a" INT DEFAULT 10,
- "b" CHAR(1) DEFAULT \'c\',
- "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'),
- CONSTRAINT "pk_s_2_2_ta_r3" PRIMARY KEY("a")
- )', '', 'srv "s_2_2"');
-let $CHILD2_2_DROP_TABLES5=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "s_2_2_ta_r_int"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"');
-let $CHILD2_2_CREATE_TABLES5=
- SELECT spider_direct_sql('CREATE TABLE "s_2_2_ta_r_int" (
- "a" INT DEFAULT 3,
- "b" INT DEFAULT 10,
- "c" INT DEFAULT 11,
- CONSTRAINT "pk_s_2_2_ta_r_int" PRIMARY KEY("a")
- )', '', 'srv "s_2_2"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE INDEX "idx1_s_2_2_ta_r_int" ON "s_2_2_ta_r_int"("b")', '', 'srv "s_2_2"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE INDEX "idx2_s_2_2_ta_r_int" ON "s_2_2_ta_r_int"("c")', '', 'srv "s_2_2"');
-let $CHILD2_2_SELECT_TABLES=
- SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r3" ORDER BY "a"', '', 'srv "s_2_2"');
-let $CHILD2_2_DROP_FT_TABLES=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ft_r3"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"');
-let $CHILD2_2_CREATE_FT_TABLES=
- SELECT spider_direct_sql('CREATE TABLE "ft_r3" (
- "a" INT DEFAULT 0,
- "b" TEXT,
- "c" TEXT,
- "d" TEXT,
- CONSTRAINT "pk_s_2_2_ft_r3" PRIMARY KEY("a"),
- FULLTEXT INDEX "ft_idx1"("b"),
- FULLTEXT INDEX "ft_idx2"("c")
- )', '', 'srv "s_2_2"');
-let $CHILD2_2_SELECT_FT_TABLES=
- SELECT spider_direct_sql('SELECT "a", "b", "c", "d" FROM "ft_r3" ORDER BY "a"', '', 'srv "s_2_2"');
-let $CHILD2_2_DROP_GM_TABLES=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "gm_r3"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"');
-let $CHILD2_2_CREATE_GM_TABLES=
- SELECT spider_direct_sql('CREATE TABLE "gm_r3" (
- "a" INT DEFAULT 0,
- "b" GEOMETRY NOT NULL,
- "c" GEOMETRY NOT NULL,
- CONSTRAINT "pk_s_2_2_gm_r3" PRIMARY KEY("a"),
- SPATIAL INDEX "sp_idx1"("b"),
- SPATIAL INDEX "sp_idx2"("c")
- )', '', 'srv "s_2_2"');
-let $CHILD2_2_SELECT_GM_TABLES=
- SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "gm_r3" ORDER BY "a"', '', 'srv "s_2_2"');
-let $CHILD2_2_DROP_LOCK_TABLES1=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"');
-let $CHILD2_2_CREATE_LOCK_TABLES1=
- SELECT spider_direct_sql('CREATE TABLE "t1_2" (
- "id" INT NOT NULL,
- CONSTRAINT "pk_s_2_2_t1_2" PRIMARY KEY ("id")
- )', '', 'srv "s_2_2"');
-let $CHILD2_2_DROP_LOCK_TABLES2=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t2_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"');
-let $CHILD2_2_CREATE_LOCK_TABLES2=
- SELECT spider_direct_sql('CREATE TABLE "t2_1" (
- "id" INT NOT NULL,
- CONSTRAINT "pk_s_2_2_t2_1" PRIMARY KEY ("id")
- )', '', 'srv "s_2_2"');
-let $CHILD2_2_DROP_INCREMENT_TABLES1=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"');
-let $CHILD2_2_CREATE_INCREMENT_TABLES1=
- SELECT spider_direct_sql('CREATE TABLE "t1_2" (
- "id" INT NOT NULL,
- CONSTRAINT "pk_s_2_2_t1_2" PRIMARY KEY ("id")
- )', '', 'srv "s_2_2"');
-let $CHILD2_2_SELECT_INCREMENT_TABLES1=
- SELECT spider_direct_sql('SELECT "id" FROM "t1_2" ORDER BY "id"', '', 'srv "s_2_2"');
-let $CHILD2_2_AUTO_INCREMENT_INCREMENT1=
- SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_2"');
-let $CHILD2_2_AUTO_INCREMENT_INCREMENT2=
- SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"');
-let $CHILD2_2_AUTO_INCREMENT_OFFSET1=
- SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_2"');
-let $CHILD2_2_AUTO_INCREMENT_OFFSET2=
- SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"');
+--connection master_1
+SELECT spider_direct_sql('ALTER SESSION SET NLS_DATE_FORMAT=\'YYYY-MM-DD HH24:MI:SS\'', '', 'srv "s_2_2"');
+SELECT spider_direct_sql('ALTER SESSION SET NLS_TIME_FORMAT=\'HH24:MI:SSXFF\'', '', 'srv "s_2_2"');
+SELECT spider_direct_sql('ALTER SESSION SET NLS_TIMESTAMP_FORMAT=\'YYYY-MM-DD HH24:MI:SSXFF\'', '', 'srv "s_2_2"');
+let $CHILD2_2_DROP_TABLES=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r3"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"');
+let $CHILD2_2_CREATE_TABLES=
+ SELECT spider_direct_sql('CREATE TABLE "ta_r3" (
+ "a" INT DEFAULT 10,
+ "b" CHAR(1) DEFAULT \'c\',
+ "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'),
+ CONSTRAINT "pk_s_2_2_ta_r3" PRIMARY KEY("a")
+ )', '', 'srv "s_2_2"');
+let $CHILD2_2_DROP_TABLES5=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "s_2_2_ta_r_int"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"');
+let $CHILD2_2_CREATE_TABLES5=
+ SELECT spider_direct_sql('CREATE TABLE "s_2_2_ta_r_int" (
+ "a" INT DEFAULT 3,
+ "b" INT DEFAULT 10,
+ "c" INT DEFAULT 11,
+ CONSTRAINT "pk_s_2_2_ta_r_int" PRIMARY KEY("a")
+ )', '', 'srv "s_2_2"')
+ $STR_SEMICOLON
+ SELECT spider_direct_sql('CREATE INDEX "idx1_s_2_2_ta_r_int" ON "s_2_2_ta_r_int"("b")', '', 'srv "s_2_2"')
+ $STR_SEMICOLON
+ SELECT spider_direct_sql('CREATE INDEX "idx2_s_2_2_ta_r_int" ON "s_2_2_ta_r_int"("c")', '', 'srv "s_2_2"');
+let $CHILD2_2_SELECT_TABLES=
+ SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r3" ORDER BY "a"', '', 'srv "s_2_2"');
+let $CHILD2_2_DROP_FT_TABLES=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ft_r3"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"');
+let $CHILD2_2_CREATE_FT_TABLES=
+ SELECT spider_direct_sql('CREATE TABLE "ft_r3" (
+ "a" INT DEFAULT 0,
+ "b" TEXT,
+ "c" TEXT,
+ "d" TEXT,
+ CONSTRAINT "pk_s_2_2_ft_r3" PRIMARY KEY("a"),
+ FULLTEXT INDEX "ft_idx1"("b"),
+ FULLTEXT INDEX "ft_idx2"("c")
+ )', '', 'srv "s_2_2"');
+let $CHILD2_2_SELECT_FT_TABLES=
+ SELECT spider_direct_sql('SELECT "a", "b", "c", "d" FROM "ft_r3" ORDER BY "a"', '', 'srv "s_2_2"');
+let $CHILD2_2_DROP_GM_TABLES=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "gm_r3"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"');
+let $CHILD2_2_CREATE_GM_TABLES=
+ SELECT spider_direct_sql('CREATE TABLE "gm_r3" (
+ "a" INT DEFAULT 0,
+ "b" GEOMETRY NOT NULL,
+ "c" GEOMETRY NOT NULL,
+ CONSTRAINT "pk_s_2_2_gm_r3" PRIMARY KEY("a"),
+ SPATIAL INDEX "sp_idx1"("b"),
+ SPATIAL INDEX "sp_idx2"("c")
+ )', '', 'srv "s_2_2"');
+let $CHILD2_2_SELECT_GM_TABLES=
+ SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "gm_r3" ORDER BY "a"', '', 'srv "s_2_2"');
+let $CHILD2_2_DROP_LOCK_TABLES1=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"');
+let $CHILD2_2_CREATE_LOCK_TABLES1=
+ SELECT spider_direct_sql('CREATE TABLE "t1_2" (
+ "id" INT NOT NULL,
+ CONSTRAINT "pk_s_2_2_t1_2" PRIMARY KEY ("id")
+ )', '', 'srv "s_2_2"');
+let $CHILD2_2_DROP_LOCK_TABLES2=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t2_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"');
+let $CHILD2_2_CREATE_LOCK_TABLES2=
+ SELECT spider_direct_sql('CREATE TABLE "t2_1" (
+ "id" INT NOT NULL,
+ CONSTRAINT "pk_s_2_2_t2_1" PRIMARY KEY ("id")
+ )', '', 'srv "s_2_2"');
+let $CHILD2_2_DROP_INCREMENT_TABLES1=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"');
+let $CHILD2_2_CREATE_INCREMENT_TABLES1=
+ SELECT spider_direct_sql('CREATE TABLE "t1_2" (
+ "id" INT NOT NULL,
+ CONSTRAINT "pk_s_2_2_t1_2" PRIMARY KEY ("id")
+ )', '', 'srv "s_2_2"');
+let $CHILD2_2_SELECT_INCREMENT_TABLES1=
+ SELECT spider_direct_sql('SELECT "id" FROM "t1_2" ORDER BY "id"', '', 'srv "s_2_2"');
+let $CHILD2_2_AUTO_INCREMENT_INCREMENT1=
+ SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"')
+ $STR_SEMICOLON
+ SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_2"');
+let $CHILD2_2_AUTO_INCREMENT_INCREMENT2=
+ SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"')
+ $STR_SEMICOLON
+ SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"');
+let $CHILD2_2_AUTO_INCREMENT_OFFSET1=
+ SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"')
+ $STR_SEMICOLON
+ SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_2"');
+let $CHILD2_2_AUTO_INCREMENT_OFFSET2=
+ SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"')
+ $STR_SEMICOLON
+ SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"');
diff --git a/storage/spider/mysql-test/spider/oracle2/include/init_child2_3.inc b/storage/spider/mysql-test/spider/oracle2/include/init_child2_3.inc
index 5c06a9f6a73..e16dfeffd81 100644
--- a/storage/spider/mysql-test/spider/oracle2/include/init_child2_3.inc
+++ b/storage/spider/mysql-test/spider/oracle2/include/init_child2_3.inc
@@ -1,15 +1,15 @@
---connection master_1
-SELECT spider_direct_sql('ALTER SESSION SET NLS_DATE_FORMAT=\'YYYY-MM-DD HH24:MI:SS\'', '', 'srv "s_2_3"');
-SELECT spider_direct_sql('ALTER SESSION SET NLS_TIME_FORMAT=\'HH24:MI:SSXFF\'', '', 'srv "s_2_3"');
-SELECT spider_direct_sql('ALTER SESSION SET NLS_TIMESTAMP_FORMAT=\'YYYY-MM-DD HH24:MI:SSXFF\'', '', 'srv "s_2_3"');
-let $CHILD2_3_DROP_TABLES=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r4"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_3"');
-let $CHILD2_3_CREATE_TABLES=
- SELECT spider_direct_sql('CREATE TABLE "ta_r4" (
- "a" INT DEFAULT 10,
- "b" CHAR(1) DEFAULT \'c\',
- "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'),
- CONSTRAINT "pk_s_2_3_ta_r4" PRIMARY KEY("a")
- )', '', 'srv "s_2_3"');
-let $CHILD2_3_SELECT_TABLES=
- SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r4" ORDER BY "a"', '', 'srv "s_2_3"');
+--connection master_1
+SELECT spider_direct_sql('ALTER SESSION SET NLS_DATE_FORMAT=\'YYYY-MM-DD HH24:MI:SS\'', '', 'srv "s_2_3"');
+SELECT spider_direct_sql('ALTER SESSION SET NLS_TIME_FORMAT=\'HH24:MI:SSXFF\'', '', 'srv "s_2_3"');
+SELECT spider_direct_sql('ALTER SESSION SET NLS_TIMESTAMP_FORMAT=\'YYYY-MM-DD HH24:MI:SSXFF\'', '', 'srv "s_2_3"');
+let $CHILD2_3_DROP_TABLES=
+ SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r4"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_3"');
+let $CHILD2_3_CREATE_TABLES=
+ SELECT spider_direct_sql('CREATE TABLE "ta_r4" (
+ "a" INT DEFAULT 10,
+ "b" CHAR(1) DEFAULT \'c\',
+ "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'),
+ CONSTRAINT "pk_s_2_3_ta_r4" PRIMARY KEY("a")
+ )', '', 'srv "s_2_3"');
+let $CHILD2_3_SELECT_TABLES=
+ SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r4" ORDER BY "a"', '', 'srv "s_2_3"');
diff --git a/storage/spider/mysql-test/spider/oracle2/include/init_child3_1.inc b/storage/spider/mysql-test/spider/oracle2/include/init_child3_1.inc
index f70afeb58de..d2d308cbefe 100644
--- a/storage/spider/mysql-test/spider/oracle2/include/init_child3_1.inc
+++ b/storage/spider/mysql-test/spider/oracle2/include/init_child3_1.inc
@@ -1,3 +1,3 @@
---let $TEST_ENGINE_TYPE= $CHILD3_1_ENGINE_TYPE
---source ../../include/init_engine.inc
---let $INIT_CHILD3_1_ENGINE= $INIT_TEST_ENGINE
+--let $TEST_ENGINE_TYPE= $CHILD3_1_ENGINE_TYPE
+--source ../../include/init_engine.inc
+--let $INIT_CHILD3_1_ENGINE= $INIT_TEST_ENGINE
diff --git a/storage/spider/mysql-test/spider/oracle2/include/init_child3_2.inc b/storage/spider/mysql-test/spider/oracle2/include/init_child3_2.inc
index e84567f2243..3fbe1bd55bb 100644
--- a/storage/spider/mysql-test/spider/oracle2/include/init_child3_2.inc
+++ b/storage/spider/mysql-test/spider/oracle2/include/init_child3_2.inc
@@ -1,3 +1,3 @@
---let $TEST_ENGINE_TYPE= $CHILD3_2_ENGINE_TYPE
---source ../../include/init_engine.inc
---let $INIT_CHILD3_2_ENGINE= $INIT_TEST_ENGINE
+--let $TEST_ENGINE_TYPE= $CHILD3_2_ENGINE_TYPE
+--source ../../include/init_engine.inc
+--let $INIT_CHILD3_2_ENGINE= $INIT_TEST_ENGINE
diff --git a/storage/spider/mysql-test/spider/oracle2/include/init_child3_3.inc b/storage/spider/mysql-test/spider/oracle2/include/init_child3_3.inc
index d3f31049ff6..3c7aaa8af84 100644
--- a/storage/spider/mysql-test/spider/oracle2/include/init_child3_3.inc
+++ b/storage/spider/mysql-test/spider/oracle2/include/init_child3_3.inc
@@ -1,3 +1,3 @@
---let $TEST_ENGINE_TYPE= $CHILD3_3_ENGINE_TYPE
---source ../../include/init_engine.inc
---let $INIT_CHILD3_3_ENGINE= $INIT_TEST_ENGINE
+--let $TEST_ENGINE_TYPE= $CHILD3_3_ENGINE_TYPE
+--source ../../include/init_engine.inc
+--let $INIT_CHILD3_3_ENGINE= $INIT_TEST_ENGINE
diff --git a/storage/spider/mysql-test/spider/oracle2/include/init_slave1_1.inc b/storage/spider/mysql-test/spider/oracle2/include/init_slave1_1.inc
index 87c05f1f690..73c3c6b9ef2 100644
--- a/storage/spider/mysql-test/spider/oracle2/include/init_slave1_1.inc
+++ b/storage/spider/mysql-test/spider/oracle2/include/init_slave1_1.inc
@@ -1,10 +1,10 @@
-let $SLAVE1_1_COMMENT_INCREMENT1_1=
- COMMENT '';
-let $SLAVE1_1_COMMENT_INCREMENT1_P_1=
- COMMENT ''
- PARTITION BY LIST(MOD(id, 2)) (
- PARTITION pt1 VALUES IN (0)
- COMMENT='',
- PARTITION pt2 VALUES IN (1)
- COMMENT=''
- );
+let $SLAVE1_1_COMMENT_INCREMENT1_1=
+ COMMENT '';
+let $SLAVE1_1_COMMENT_INCREMENT1_P_1=
+ COMMENT ''
+ PARTITION BY LIST(MOD(id, 2)) (
+ PARTITION pt1 VALUES IN (0)
+ COMMENT='',
+ PARTITION pt2 VALUES IN (1)
+ COMMENT=''
+ );
diff --git a/storage/spider/mysql-test/spider/oracle2/t/direct_aggregate.test b/storage/spider/mysql-test/spider/oracle2/t/direct_aggregate.test
index 5f17ac402e2..d65f4c5a624 100644
--- a/storage/spider/mysql-test/spider/oracle2/t/direct_aggregate.test
+++ b/storage/spider/mysql-test/spider/oracle2/t/direct_aggregate.test
@@ -1,179 +1,179 @@
---disable_warnings
---disable_query_log
---disable_result_log
---source test_init.inc
---enable_result_log
---enable_query_log
-
---echo
---echo drop and create databases
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- CREATE DATABASE auto_test_remote;
- USE auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- CREATE DATABASE auto_test_remote2;
- USE auto_test_remote2;
-}
---enable_warnings
-
---echo
---echo test select 1
---connection master_1
-SELECT 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- SELECT 1;
- --connection child2_2
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo create table select test
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_TABLES;
- echo CHILD2_1_CREATE_TABLES;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
---disable_warnings
-DROP TABLE IF EXISTS ta_l;
---enable_warnings
---disable_query_log
-echo CREATE TABLE ta_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
-eval CREATE TABLE ta_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
---enable_query_log
-INSERT INTO ta_l (a, b, c) VALUES
- (1, 'a', '2008-08-01 10:21:39'),
- (2, 'b', '2000-01-01 00:00:00'),
- (3, 'e', '2007-06-04 20:03:11'),
- (4, 'd', '2003-11-30 05:01:03'),
- (5, 'c', '2001-12-31 23:59:59');
-
---echo
---echo direct_aggregating test
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
-SELECT COUNT(*) FROM ta_l;
-eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
-SELECT MAX(a) FROM ta_l;
-eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
-SELECT MIN(a) FROM ta_l;
-eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
-SELECT MAX(a) FROM ta_l WHERE a < 5;
-eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
-SELECT MIN(a) FROM ta_l WHERE a > 1;
-eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo deinit
---disable_warnings
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
-}
---disable_query_log
---disable_result_log
---source test_deinit.inc
---enable_result_log
---enable_query_log
---enable_warnings
---echo
---echo end of test
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--enable_result_log
+--enable_query_log
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ --connection child2_2
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo create table select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS ta_l;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE ta_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE ta_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+--enable_query_log
+INSERT INTO ta_l (a, b, c) VALUES
+ (1, 'a', '2008-08-01 10:21:39'),
+ (2, 'b', '2000-01-01 00:00:00'),
+ (3, 'e', '2007-06-04 20:03:11'),
+ (4, 'd', '2003-11-30 05:01:03'),
+ (5, 'c', '2001-12-31 23:59:59');
+
+--echo
+--echo direct_aggregating test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+SELECT COUNT(*) FROM ta_l;
+eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+SELECT MAX(a) FROM ta_l;
+eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+SELECT MIN(a) FROM ta_l;
+eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+SELECT MAX(a) FROM ta_l WHERE a < 5;
+eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+SELECT MIN(a) FROM ta_l WHERE a > 1;
+eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+}
+--disable_query_log
+--disable_result_log
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/oracle2/t/direct_aggregate_part.test b/storage/spider/mysql-test/spider/oracle2/t/direct_aggregate_part.test
index 2d67e9af32c..aebf210c745 100644
--- a/storage/spider/mysql-test/spider/oracle2/t/direct_aggregate_part.test
+++ b/storage/spider/mysql-test/spider/oracle2/t/direct_aggregate_part.test
@@ -1,192 +1,192 @@
---disable_warnings
---disable_query_log
---disable_result_log
---source test_init.inc
---enable_result_log
---enable_query_log
-if (!$HAVE_PARTITION)
-{
- --disable_query_log
- --disable_result_log
- --source test_deinit.inc
- --enable_result_log
- --enable_query_log
- --enable_warnings
- skip Test requires partitioning;
-}
-
---echo
---echo drop and create databases
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- CREATE DATABASE auto_test_remote;
- USE auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- CREATE DATABASE auto_test_remote2;
- USE auto_test_remote2;
-}
---enable_warnings
-
---echo
---echo test select 1
---connection master_1
-SELECT 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- SELECT 1;
- --connection child2_2
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo with partition test
-if ($HAVE_PARTITION)
-{
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_2_DROP_TABLES;
- echo CHILD2_2_CREATE_TABLES;
- }
- --disable_warnings
- eval $CHILD2_2_DROP_TABLES;
- --enable_warnings
- eval $CHILD2_2_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_TABLES2;
- echo CHILD2_1_CREATE_TABLES2;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES2;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- --disable_query_log
- echo CREATE TABLE ta_l2 (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
- ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1;
- eval CREATE TABLE ta_l2 (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
- ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1;
- INSERT INTO ta_l2 (a, b, c) VALUES
- (1, 'a', '2008-08-01 10:21:39'),
- (2, 'b', '2000-01-01 00:00:00'),
- (3, 'e', '2007-06-04 20:03:11'),
- (4, 'd', '2003-11-30 05:01:03'),
- (5, 'c', '2001-12-31 23:59:59');
- --enable_query_log
- eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
- SELECT COUNT(*) FROM ta_l2;
- eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
- SELECT MAX(a) FROM ta_l2;
- eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
- SELECT MIN(a) FROM ta_l2;
- eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
- SELECT MAX(a) FROM ta_l2 WHERE a < 5;
- eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
- SELECT MIN(a) FROM ta_l2 WHERE a > 1;
- eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %';
- }
- eval $CHILD2_2_SELECT_TABLES;
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %';
- }
- eval $CHILD2_1_SELECT_TABLES2;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
-}
-
---echo
---echo deinit
---disable_warnings
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
-}
---disable_query_log
---disable_result_log
---source test_deinit.inc
---enable_result_log
---enable_query_log
---enable_warnings
---echo
---echo end of test
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--enable_result_log
+--enable_query_log
+if (!$HAVE_PARTITION)
+{
+ --disable_query_log
+ --disable_result_log
+ --source test_deinit.inc
+ --enable_result_log
+ --enable_query_log
+ --enable_warnings
+ skip Test requires partitioning;
+}
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ --connection child2_2
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo with partition test
+if ($HAVE_PARTITION)
+{
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_DROP_TABLES;
+ echo CHILD2_2_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_2_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_2_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES2;
+ echo CHILD2_1_CREATE_TABLES2;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES2;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ --disable_query_log
+ echo CREATE TABLE ta_l2 (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1;
+ eval CREATE TABLE ta_l2 (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1;
+ INSERT INTO ta_l2 (a, b, c) VALUES
+ (1, 'a', '2008-08-01 10:21:39'),
+ (2, 'b', '2000-01-01 00:00:00'),
+ (3, 'e', '2007-06-04 20:03:11'),
+ (4, 'd', '2003-11-30 05:01:03'),
+ (5, 'c', '2001-12-31 23:59:59');
+ --enable_query_log
+ eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+ SELECT COUNT(*) FROM ta_l2;
+ eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+ SELECT MAX(a) FROM ta_l2;
+ eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+ SELECT MIN(a) FROM ta_l2;
+ eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+ SELECT MAX(a) FROM ta_l2 WHERE a < 5;
+ eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+ SELECT MIN(a) FROM ta_l2 WHERE a > 1;
+ eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %';
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %';
+ }
+ eval $CHILD2_1_SELECT_TABLES2;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+}
+--disable_query_log
+--disable_result_log
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/oracle2/t/have_partition.inc b/storage/spider/mysql-test/spider/oracle2/t/have_partition.inc
index 573c76ab43b..b6e699475db 100644
--- a/storage/spider/mysql-test/spider/oracle2/t/have_partition.inc
+++ b/storage/spider/mysql-test/spider/oracle2/t/have_partition.inc
@@ -1,7 +1,7 @@
-let $HAVE_PARTITION= 0;
-if (`SELECT count(*) FROM information_schema.plugins WHERE
- plugin_status = 'ACTIVE' AND
- plugin_name = 'partition'`)
-{
- let $HAVE_PARTITION= 1;
-}
+let $HAVE_PARTITION= 0;
+if (`SELECT count(*) FROM information_schema.plugins WHERE
+ plugin_status = 'ACTIVE' AND
+ plugin_name = 'partition'`)
+{
+ let $HAVE_PARTITION= 1;
+}
diff --git a/storage/spider/mysql-test/spider/oracle2/t/have_trigger.inc b/storage/spider/mysql-test/spider/oracle2/t/have_trigger.inc
index 10c0871dd5f..32de484b388 100644
--- a/storage/spider/mysql-test/spider/oracle2/t/have_trigger.inc
+++ b/storage/spider/mysql-test/spider/oracle2/t/have_trigger.inc
@@ -1,2 +1,2 @@
-let $HAVE_TRIGGER= `SELECT COUNT(*) FROM information_schema.tables
- WHERE TABLE_SCHEMA = 'information_schema' AND TABLE_NAME = 'TRIGGERS'`;
+let $HAVE_TRIGGER= `SELECT COUNT(*) FROM information_schema.tables
+ WHERE TABLE_SCHEMA = 'information_schema' AND TABLE_NAME = 'TRIGGERS'`;
diff --git a/storage/spider/mysql-test/spider/oracle2/t/spider3_fixes.test b/storage/spider/mysql-test/spider/oracle2/t/spider3_fixes.test
index 7530ce97837..13fa6f5fa39 100644
--- a/storage/spider/mysql-test/spider/oracle2/t/spider3_fixes.test
+++ b/storage/spider/mysql-test/spider/oracle2/t/spider3_fixes.test
@@ -1,292 +1,292 @@
-# This test tests for Spider 3.0's bug fixes
-source include/have_log_bin.inc;
---disable_warnings
---disable_query_log
---disable_result_log
---source test_init.inc
---source slave_test_init.inc
---enable_result_log
---enable_query_log
-
---echo
---echo drop and create databases
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-if ($USE_REPLICATION)
-{
- --connection slave1_1
- DROP DATABASE IF EXISTS auto_test_local;
- CREATE DATABASE auto_test_local;
- USE auto_test_local;
-}
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- CREATE DATABASE auto_test_remote;
- USE auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- CREATE DATABASE auto_test_remote2;
- USE auto_test_remote2;
-}
---enable_warnings
-
---echo
---echo test select 1
---connection master_1
-SELECT 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- SELECT 1;
- --connection child2_2
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
-
---echo
---echo 3.1
---echo auto_increment
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_INCREMENT_TABLES1;
- echo CHILD2_1_CREATE_INCREMENT_TABLES1;
- echo CHILD2_1_AUTO_INCREMENT_INCREMENT2;
- echo CHILD2_1_AUTO_INCREMENT_OFFSET2;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_INCREMENT_TABLES1;
- --enable_warnings
- eval $CHILD2_1_CREATE_INCREMENT_TABLES1;
- eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2;
- eval $CHILD2_1_AUTO_INCREMENT_OFFSET2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-if ($USE_REPLICATION)
-{
- save_master_pos;
- --connection slave1_1
- sync_with_master;
- --connection master_1
- --disable_query_log
- SET SESSION sql_log_bin= 0;
- --enable_query_log
-}
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
---enable_warnings
---disable_query_log
-echo CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1;
-echo CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1;
-echo MASTER_1_AUTO_INCREMENT_INCREMENT2;
-echo MASTER_1_AUTO_INCREMENT_OFFSET2;
-eval CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_1;
-eval CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_1;
-eval $MASTER_1_AUTO_INCREMENT_INCREMENT2;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET2;
-if ($USE_REPLICATION)
-{
- SET SESSION sql_log_bin= 1;
- --connection slave1_1
- --disable_warnings
- DROP TABLE IF EXISTS t1, t2;
- --enable_warnings
- echo CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1;
- echo CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1;
- eval CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_1;
- eval CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_1;
- --connection master_1
-}
---enable_query_log
-INSERT INTO t1 () VALUES ();
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t1;
-INSERT INTO t2 () VALUES ();
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t2;
---disable_query_log
-echo MASTER_1_AUTO_INCREMENT_OFFSET3;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
---enable_query_log
-INSERT INTO t1 (id) VALUES (null);
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t1;
---disable_query_log
-echo MASTER_1_AUTO_INCREMENT_OFFSET4;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
---enable_query_log
-INSERT INTO t2 (id) VALUES (null);
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t2;
---disable_query_log
-echo MASTER_1_AUTO_INCREMENT_OFFSET3;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
---enable_query_log
-INSERT INTO t1 () VALUES (),(),(),();
-SELECT LAST_INSERT_ID();
-SELECT id FROM t1 ORDER BY id;
---disable_query_log
-echo MASTER_1_AUTO_INCREMENT_OFFSET4;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
---enable_query_log
-INSERT INTO t2 () VALUES (),(),(),();
-SELECT LAST_INSERT_ID();
-SELECT id FROM t2 ORDER BY id;
-TRUNCATE TABLE t1;
-TRUNCATE TABLE t2;
-INSERT INTO t1 () VALUES (),(),(),();
-SELECT LAST_INSERT_ID();
-SELECT id FROM t1 ORDER BY id;
-INSERT INTO t2 () VALUES (),(),(),();
-SELECT LAST_INSERT_ID();
-SELECT id FROM t2 ORDER BY id;
-SET INSERT_ID=5000;
---disable_query_log
-echo MASTER_1_AUTO_INCREMENT_OFFSET3;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
---enable_query_log
-INSERT INTO t1 () VALUES ();
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t1;
---disable_query_log
-echo MASTER_1_AUTO_INCREMENT_OFFSET4;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
---enable_query_log
-INSERT INTO t2 () VALUES ();
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t2;
-INSERT INTO t1 (id) VALUES (10000);
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t1;
-INSERT INTO t2 (id) VALUES (1000);
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t2;
-if ($USE_REPLICATION)
-{
- save_master_pos;
- --connection slave1_1
- sync_with_master;
- SELECT id FROM t1 ORDER BY id;
- --connection master_1
- --disable_query_log
- SET SESSION sql_log_bin= 0;
- --enable_query_log
-}
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %';
- }
- eval $CHILD2_1_SELECT_INCREMENT_TABLES1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_AUTO_INCREMENT_INCREMENT1;
- echo CHILD2_1_AUTO_INCREMENT_OFFSET1;
- }
- eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1;
- eval $CHILD2_1_AUTO_INCREMENT_OFFSET1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
-
---echo
---echo deinit
---disable_warnings
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-if ($USE_REPLICATION)
-{
- --connection slave1_1
- DROP DATABASE IF EXISTS auto_test_local;
-}
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
-}
---disable_query_log
---disable_result_log
---source slave_test_deinit.inc
---source test_deinit.inc
---enable_result_log
---enable_query_log
---enable_warnings
---echo
---echo end of test
+# This test tests for Spider 3.0's bug fixes
+source include/have_log_bin.inc;
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--source slave_test_init.inc
+--enable_result_log
+--enable_query_log
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_REPLICATION)
+{
+ --connection slave1_1
+ DROP DATABASE IF EXISTS auto_test_local;
+ CREATE DATABASE auto_test_local;
+ USE auto_test_local;
+}
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ --connection child2_2
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+
+--echo
+--echo 3.1
+--echo auto_increment
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_INCREMENT_TABLES1;
+ echo CHILD2_1_CREATE_INCREMENT_TABLES1;
+ echo CHILD2_1_AUTO_INCREMENT_INCREMENT2;
+ echo CHILD2_1_AUTO_INCREMENT_OFFSET2;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_INCREMENT_TABLES1;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_INCREMENT_TABLES1;
+ eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2;
+ eval $CHILD2_1_AUTO_INCREMENT_OFFSET2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+if ($USE_REPLICATION)
+{
+ save_master_pos;
+ --connection slave1_1
+ sync_with_master;
+ --connection master_1
+ --disable_query_log
+ SET SESSION sql_log_bin= 0;
+ --enable_query_log
+}
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1;
+echo CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1;
+echo MASTER_1_AUTO_INCREMENT_INCREMENT2;
+echo MASTER_1_AUTO_INCREMENT_OFFSET2;
+eval CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_1;
+eval CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_1;
+eval $MASTER_1_AUTO_INCREMENT_INCREMENT2;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET2;
+if ($USE_REPLICATION)
+{
+ SET SESSION sql_log_bin= 1;
+ --connection slave1_1
+ --disable_warnings
+ DROP TABLE IF EXISTS t1, t2;
+ --enable_warnings
+ echo CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1;
+ echo CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1;
+ eval CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_1;
+ eval CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_1;
+ --connection master_1
+}
+--enable_query_log
+INSERT INTO t1 () VALUES ();
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t1;
+INSERT INTO t2 () VALUES ();
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t2;
+--disable_query_log
+echo MASTER_1_AUTO_INCREMENT_OFFSET3;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
+--enable_query_log
+INSERT INTO t1 (id) VALUES (null);
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t1;
+--disable_query_log
+echo MASTER_1_AUTO_INCREMENT_OFFSET4;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
+--enable_query_log
+INSERT INTO t2 (id) VALUES (null);
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t2;
+--disable_query_log
+echo MASTER_1_AUTO_INCREMENT_OFFSET3;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
+--enable_query_log
+INSERT INTO t1 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+SELECT id FROM t1 ORDER BY id;
+--disable_query_log
+echo MASTER_1_AUTO_INCREMENT_OFFSET4;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
+--enable_query_log
+INSERT INTO t2 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+SELECT id FROM t2 ORDER BY id;
+TRUNCATE TABLE t1;
+TRUNCATE TABLE t2;
+INSERT INTO t1 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+SELECT id FROM t1 ORDER BY id;
+INSERT INTO t2 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+SELECT id FROM t2 ORDER BY id;
+SET INSERT_ID=5000;
+--disable_query_log
+echo MASTER_1_AUTO_INCREMENT_OFFSET3;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
+--enable_query_log
+INSERT INTO t1 () VALUES ();
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t1;
+--disable_query_log
+echo MASTER_1_AUTO_INCREMENT_OFFSET4;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
+--enable_query_log
+INSERT INTO t2 () VALUES ();
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t2;
+INSERT INTO t1 (id) VALUES (10000);
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t1;
+INSERT INTO t2 (id) VALUES (1000);
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t2;
+if ($USE_REPLICATION)
+{
+ save_master_pos;
+ --connection slave1_1
+ sync_with_master;
+ SELECT id FROM t1 ORDER BY id;
+ --connection master_1
+ --disable_query_log
+ SET SESSION sql_log_bin= 0;
+ --enable_query_log
+}
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %';
+ }
+ eval $CHILD2_1_SELECT_INCREMENT_TABLES1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_AUTO_INCREMENT_INCREMENT1;
+ echo CHILD2_1_AUTO_INCREMENT_OFFSET1;
+ }
+ eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1;
+ eval $CHILD2_1_AUTO_INCREMENT_OFFSET1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_REPLICATION)
+{
+ --connection slave1_1
+ DROP DATABASE IF EXISTS auto_test_local;
+}
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+}
+--disable_query_log
+--disable_result_log
+--source slave_test_deinit.inc
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/oracle2/t/spider3_fixes_part.test b/storage/spider/mysql-test/spider/oracle2/t/spider3_fixes_part.test
index f25f000d80c..3288c490a46 100644
--- a/storage/spider/mysql-test/spider/oracle2/t/spider3_fixes_part.test
+++ b/storage/spider/mysql-test/spider/oracle2/t/spider3_fixes_part.test
@@ -1,345 +1,345 @@
-# This test tests for Spider 3.0's bug fixes
-source include/have_log_bin.inc;
---disable_warnings
---disable_query_log
---disable_result_log
---source test_init.inc
---source slave_test_init.inc
---enable_result_log
---enable_query_log
-if (!$HAVE_PARTITION)
-{
- --disable_query_log
- --disable_result_log
- --source slave_test_deinit.inc
- --source test_deinit.inc
- --enable_result_log
- --enable_query_log
- --enable_warnings
- skip Test requires partitioning;
-}
-
---echo
---echo drop and create databases
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-if ($USE_REPLICATION)
-{
- --connection slave1_1
- DROP DATABASE IF EXISTS auto_test_local;
- CREATE DATABASE auto_test_local;
- USE auto_test_local;
-}
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- CREATE DATABASE auto_test_remote;
- USE auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- CREATE DATABASE auto_test_remote2;
- USE auto_test_remote2;
-}
---enable_warnings
-
---echo
---echo test select 1
---connection master_1
-SELECT 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- SELECT 1;
- --connection child2_2
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
-
---echo auto_increment with partition
-if ($HAVE_PARTITION)
-{
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_INCREMENT_TABLES1;
- echo CHILD2_1_CREATE_INCREMENT_TABLES1;
- echo CHILD2_1_AUTO_INCREMENT_INCREMENT2;
- echo CHILD2_1_AUTO_INCREMENT_OFFSET2;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_INCREMENT_TABLES1;
- --enable_warnings
- eval $CHILD2_1_CREATE_INCREMENT_TABLES1;
- eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2;
- eval $CHILD2_1_AUTO_INCREMENT_OFFSET2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_2
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_2_DROP_INCREMENT_TABLES1;
- echo CHILD2_2_CREATE_INCREMENT_TABLES1;
- echo CHILD2_2_AUTO_INCREMENT_INCREMENT2;
- echo CHILD2_2_AUTO_INCREMENT_OFFSET2;
- }
- --disable_warnings
- eval $CHILD2_2_DROP_INCREMENT_TABLES1;
- --enable_warnings
- eval $CHILD2_2_CREATE_INCREMENT_TABLES1;
- eval $CHILD2_2_AUTO_INCREMENT_INCREMENT2;
- eval $CHILD2_2_AUTO_INCREMENT_OFFSET2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- if ($USE_REPLICATION)
- {
- save_master_pos;
- --connection slave1_1
- sync_with_master;
- --connection master_1
- --disable_query_log
- SET SESSION sql_log_bin= 0;
- --enable_query_log
- }
- --disable_warnings
- DROP TABLE IF EXISTS t1, t2;
- --enable_warnings
- --disable_query_log
- echo CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1;
- echo CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1;
- echo MASTER_1_AUTO_INCREMENT_INCREMENT2;
- echo MASTER_1_AUTO_INCREMENT_OFFSET2;
- eval CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_P_1;
- eval CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_P_1;
- eval $MASTER_1_AUTO_INCREMENT_INCREMENT2;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET2;
- if ($USE_REPLICATION)
- {
- SET SESSION sql_log_bin= 1;
- --connection slave1_1
- --disable_warnings
- DROP TABLE IF EXISTS t1, t2;
- --enable_warnings
- echo CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1;
- echo CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1;
- eval CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1;
- eval CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1;
- --connection master_1
- }
- --enable_query_log
- INSERT INTO t1 () VALUES ();
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t1;
- INSERT INTO t2 () VALUES ();
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t2;
- --disable_query_log
- echo MASTER_1_AUTO_INCREMENT_OFFSET3;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
- --enable_query_log
- INSERT INTO t1 (id) VALUES (null);
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t1;
- --disable_query_log
- echo MASTER_1_AUTO_INCREMENT_OFFSET4;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
- --enable_query_log
- INSERT INTO t2 (id) VALUES (null);
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t2;
- --disable_query_log
- echo MASTER_1_AUTO_INCREMENT_OFFSET3;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
- --enable_query_log
- INSERT INTO t1 () VALUES (),(),(),();
- SELECT LAST_INSERT_ID();
- SELECT id FROM t1 ORDER BY id;
- --disable_query_log
- echo MASTER_1_AUTO_INCREMENT_OFFSET4;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
- --enable_query_log
- INSERT INTO t2 () VALUES (),(),(),();
- SELECT LAST_INSERT_ID();
- SELECT id FROM t2 ORDER BY id;
- TRUNCATE TABLE t1;
- TRUNCATE TABLE t2;
- INSERT INTO t1 () VALUES (),(),(),();
- SELECT LAST_INSERT_ID();
- SELECT id FROM t1 ORDER BY id;
- INSERT INTO t2 () VALUES (),(),(),();
- SELECT LAST_INSERT_ID();
- SELECT id FROM t2 ORDER BY id;
- SET INSERT_ID=5000;
- --disable_query_log
- echo MASTER_1_AUTO_INCREMENT_OFFSET3;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
- --enable_query_log
- INSERT INTO t1 () VALUES ();
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t1;
- --disable_query_log
- echo MASTER_1_AUTO_INCREMENT_OFFSET4;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
- --enable_query_log
- INSERT INTO t2 () VALUES ();
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t2;
- INSERT INTO t1 (id) VALUES (10000);
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t1;
- INSERT INTO t2 (id) VALUES (1000);
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t2;
- if ($USE_REPLICATION)
- {
- save_master_pos;
- --connection slave1_1
- sync_with_master;
- SELECT id FROM t1 ORDER BY id;
- --connection master_1
- --disable_query_log
- SET SESSION sql_log_bin= 0;
- --enable_query_log
- }
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %';
- }
- eval $CHILD2_1_SELECT_INCREMENT_TABLES1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_AUTO_INCREMENT_INCREMENT1;
- echo CHILD2_1_AUTO_INCREMENT_OFFSET1;
- }
- eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1;
- eval $CHILD2_1_AUTO_INCREMENT_OFFSET1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %';
- }
- eval $CHILD2_2_SELECT_INCREMENT_TABLES1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_2_AUTO_INCREMENT_INCREMENT1;
- echo CHILD2_2_AUTO_INCREMENT_OFFSET1;
- }
- eval $CHILD2_2_AUTO_INCREMENT_INCREMENT1;
- eval $CHILD2_2_AUTO_INCREMENT_OFFSET1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
-}
-
-
---echo
---echo deinit
---disable_warnings
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-if ($USE_REPLICATION)
-{
- --connection slave1_1
- DROP DATABASE IF EXISTS auto_test_local;
-}
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
-}
---disable_query_log
---disable_result_log
---source slave_test_deinit.inc
---source test_deinit.inc
---enable_result_log
---enable_query_log
---enable_warnings
---echo
---echo end of test
+# This test tests for Spider 3.0's bug fixes
+source include/have_log_bin.inc;
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--source slave_test_init.inc
+--enable_result_log
+--enable_query_log
+if (!$HAVE_PARTITION)
+{
+ --disable_query_log
+ --disable_result_log
+ --source slave_test_deinit.inc
+ --source test_deinit.inc
+ --enable_result_log
+ --enable_query_log
+ --enable_warnings
+ skip Test requires partitioning;
+}
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_REPLICATION)
+{
+ --connection slave1_1
+ DROP DATABASE IF EXISTS auto_test_local;
+ CREATE DATABASE auto_test_local;
+ USE auto_test_local;
+}
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ --connection child2_2
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+
+--echo auto_increment with partition
+if ($HAVE_PARTITION)
+{
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_INCREMENT_TABLES1;
+ echo CHILD2_1_CREATE_INCREMENT_TABLES1;
+ echo CHILD2_1_AUTO_INCREMENT_INCREMENT2;
+ echo CHILD2_1_AUTO_INCREMENT_OFFSET2;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_INCREMENT_TABLES1;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_INCREMENT_TABLES1;
+ eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2;
+ eval $CHILD2_1_AUTO_INCREMENT_OFFSET2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_DROP_INCREMENT_TABLES1;
+ echo CHILD2_2_CREATE_INCREMENT_TABLES1;
+ echo CHILD2_2_AUTO_INCREMENT_INCREMENT2;
+ echo CHILD2_2_AUTO_INCREMENT_OFFSET2;
+ }
+ --disable_warnings
+ eval $CHILD2_2_DROP_INCREMENT_TABLES1;
+ --enable_warnings
+ eval $CHILD2_2_CREATE_INCREMENT_TABLES1;
+ eval $CHILD2_2_AUTO_INCREMENT_INCREMENT2;
+ eval $CHILD2_2_AUTO_INCREMENT_OFFSET2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ if ($USE_REPLICATION)
+ {
+ save_master_pos;
+ --connection slave1_1
+ sync_with_master;
+ --connection master_1
+ --disable_query_log
+ SET SESSION sql_log_bin= 0;
+ --enable_query_log
+ }
+ --disable_warnings
+ DROP TABLE IF EXISTS t1, t2;
+ --enable_warnings
+ --disable_query_log
+ echo CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1;
+ echo CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1;
+ echo MASTER_1_AUTO_INCREMENT_INCREMENT2;
+ echo MASTER_1_AUTO_INCREMENT_OFFSET2;
+ eval CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_P_1;
+ eval CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_P_1;
+ eval $MASTER_1_AUTO_INCREMENT_INCREMENT2;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET2;
+ if ($USE_REPLICATION)
+ {
+ SET SESSION sql_log_bin= 1;
+ --connection slave1_1
+ --disable_warnings
+ DROP TABLE IF EXISTS t1, t2;
+ --enable_warnings
+ echo CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1;
+ echo CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1;
+ eval CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1;
+ eval CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1;
+ --connection master_1
+ }
+ --enable_query_log
+ INSERT INTO t1 () VALUES ();
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t1;
+ INSERT INTO t2 () VALUES ();
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t2;
+ --disable_query_log
+ echo MASTER_1_AUTO_INCREMENT_OFFSET3;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
+ --enable_query_log
+ INSERT INTO t1 (id) VALUES (null);
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t1;
+ --disable_query_log
+ echo MASTER_1_AUTO_INCREMENT_OFFSET4;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
+ --enable_query_log
+ INSERT INTO t2 (id) VALUES (null);
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t2;
+ --disable_query_log
+ echo MASTER_1_AUTO_INCREMENT_OFFSET3;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
+ --enable_query_log
+ INSERT INTO t1 () VALUES (),(),(),();
+ SELECT LAST_INSERT_ID();
+ SELECT id FROM t1 ORDER BY id;
+ --disable_query_log
+ echo MASTER_1_AUTO_INCREMENT_OFFSET4;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
+ --enable_query_log
+ INSERT INTO t2 () VALUES (),(),(),();
+ SELECT LAST_INSERT_ID();
+ SELECT id FROM t2 ORDER BY id;
+ TRUNCATE TABLE t1;
+ TRUNCATE TABLE t2;
+ INSERT INTO t1 () VALUES (),(),(),();
+ SELECT LAST_INSERT_ID();
+ SELECT id FROM t1 ORDER BY id;
+ INSERT INTO t2 () VALUES (),(),(),();
+ SELECT LAST_INSERT_ID();
+ SELECT id FROM t2 ORDER BY id;
+ SET INSERT_ID=5000;
+ --disable_query_log
+ echo MASTER_1_AUTO_INCREMENT_OFFSET3;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
+ --enable_query_log
+ INSERT INTO t1 () VALUES ();
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t1;
+ --disable_query_log
+ echo MASTER_1_AUTO_INCREMENT_OFFSET4;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
+ --enable_query_log
+ INSERT INTO t2 () VALUES ();
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t2;
+ INSERT INTO t1 (id) VALUES (10000);
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t1;
+ INSERT INTO t2 (id) VALUES (1000);
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t2;
+ if ($USE_REPLICATION)
+ {
+ save_master_pos;
+ --connection slave1_1
+ sync_with_master;
+ SELECT id FROM t1 ORDER BY id;
+ --connection master_1
+ --disable_query_log
+ SET SESSION sql_log_bin= 0;
+ --enable_query_log
+ }
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %';
+ }
+ eval $CHILD2_1_SELECT_INCREMENT_TABLES1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_AUTO_INCREMENT_INCREMENT1;
+ echo CHILD2_1_AUTO_INCREMENT_OFFSET1;
+ }
+ eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1;
+ eval $CHILD2_1_AUTO_INCREMENT_OFFSET1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %';
+ }
+ eval $CHILD2_2_SELECT_INCREMENT_TABLES1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_AUTO_INCREMENT_INCREMENT1;
+ echo CHILD2_2_AUTO_INCREMENT_OFFSET1;
+ }
+ eval $CHILD2_2_AUTO_INCREMENT_INCREMENT1;
+ eval $CHILD2_2_AUTO_INCREMENT_OFFSET1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+}
+
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_REPLICATION)
+{
+ --connection slave1_1
+ DROP DATABASE IF EXISTS auto_test_local;
+}
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+}
+--disable_query_log
+--disable_result_log
+--source slave_test_deinit.inc
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/direct_aggregate.test b/storage/spider/mysql-test/spider/t/direct_aggregate.test
index 5f17ac402e2..d65f4c5a624 100644
--- a/storage/spider/mysql-test/spider/t/direct_aggregate.test
+++ b/storage/spider/mysql-test/spider/t/direct_aggregate.test
@@ -1,179 +1,179 @@
---disable_warnings
---disable_query_log
---disable_result_log
---source test_init.inc
---enable_result_log
---enable_query_log
-
---echo
---echo drop and create databases
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- CREATE DATABASE auto_test_remote;
- USE auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- CREATE DATABASE auto_test_remote2;
- USE auto_test_remote2;
-}
---enable_warnings
-
---echo
---echo test select 1
---connection master_1
-SELECT 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- SELECT 1;
- --connection child2_2
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo create table select test
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_TABLES;
- echo CHILD2_1_CREATE_TABLES;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
---disable_warnings
-DROP TABLE IF EXISTS ta_l;
---enable_warnings
---disable_query_log
-echo CREATE TABLE ta_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
-eval CREATE TABLE ta_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
---enable_query_log
-INSERT INTO ta_l (a, b, c) VALUES
- (1, 'a', '2008-08-01 10:21:39'),
- (2, 'b', '2000-01-01 00:00:00'),
- (3, 'e', '2007-06-04 20:03:11'),
- (4, 'd', '2003-11-30 05:01:03'),
- (5, 'c', '2001-12-31 23:59:59');
-
---echo
---echo direct_aggregating test
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
-SELECT COUNT(*) FROM ta_l;
-eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
-SELECT MAX(a) FROM ta_l;
-eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
-SELECT MIN(a) FROM ta_l;
-eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
-SELECT MAX(a) FROM ta_l WHERE a < 5;
-eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
-SELECT MIN(a) FROM ta_l WHERE a > 1;
-eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo deinit
---disable_warnings
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
-}
---disable_query_log
---disable_result_log
---source test_deinit.inc
---enable_result_log
---enable_query_log
---enable_warnings
---echo
---echo end of test
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--enable_result_log
+--enable_query_log
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ --connection child2_2
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo create table select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS ta_l;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE ta_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE ta_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+--enable_query_log
+INSERT INTO ta_l (a, b, c) VALUES
+ (1, 'a', '2008-08-01 10:21:39'),
+ (2, 'b', '2000-01-01 00:00:00'),
+ (3, 'e', '2007-06-04 20:03:11'),
+ (4, 'd', '2003-11-30 05:01:03'),
+ (5, 'c', '2001-12-31 23:59:59');
+
+--echo
+--echo direct_aggregating test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+SELECT COUNT(*) FROM ta_l;
+eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+SELECT MAX(a) FROM ta_l;
+eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+SELECT MIN(a) FROM ta_l;
+eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+SELECT MAX(a) FROM ta_l WHERE a < 5;
+eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+SELECT MIN(a) FROM ta_l WHERE a > 1;
+eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+}
+--disable_query_log
+--disable_result_log
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/direct_aggregate_part.test b/storage/spider/mysql-test/spider/t/direct_aggregate_part.test
index 2d67e9af32c..aebf210c745 100644
--- a/storage/spider/mysql-test/spider/t/direct_aggregate_part.test
+++ b/storage/spider/mysql-test/spider/t/direct_aggregate_part.test
@@ -1,192 +1,192 @@
---disable_warnings
---disable_query_log
---disable_result_log
---source test_init.inc
---enable_result_log
---enable_query_log
-if (!$HAVE_PARTITION)
-{
- --disable_query_log
- --disable_result_log
- --source test_deinit.inc
- --enable_result_log
- --enable_query_log
- --enable_warnings
- skip Test requires partitioning;
-}
-
---echo
---echo drop and create databases
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- CREATE DATABASE auto_test_remote;
- USE auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- CREATE DATABASE auto_test_remote2;
- USE auto_test_remote2;
-}
---enable_warnings
-
---echo
---echo test select 1
---connection master_1
-SELECT 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- SELECT 1;
- --connection child2_2
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo with partition test
-if ($HAVE_PARTITION)
-{
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_2_DROP_TABLES;
- echo CHILD2_2_CREATE_TABLES;
- }
- --disable_warnings
- eval $CHILD2_2_DROP_TABLES;
- --enable_warnings
- eval $CHILD2_2_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_TABLES2;
- echo CHILD2_1_CREATE_TABLES2;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES2;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- --disable_query_log
- echo CREATE TABLE ta_l2 (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
- ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1;
- eval CREATE TABLE ta_l2 (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
- ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1;
- INSERT INTO ta_l2 (a, b, c) VALUES
- (1, 'a', '2008-08-01 10:21:39'),
- (2, 'b', '2000-01-01 00:00:00'),
- (3, 'e', '2007-06-04 20:03:11'),
- (4, 'd', '2003-11-30 05:01:03'),
- (5, 'c', '2001-12-31 23:59:59');
- --enable_query_log
- eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
- SELECT COUNT(*) FROM ta_l2;
- eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
- SELECT MAX(a) FROM ta_l2;
- eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
- SELECT MIN(a) FROM ta_l2;
- eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
- SELECT MAX(a) FROM ta_l2 WHERE a < 5;
- eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
- SELECT MIN(a) FROM ta_l2 WHERE a > 1;
- eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %';
- }
- eval $CHILD2_2_SELECT_TABLES;
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %';
- }
- eval $CHILD2_1_SELECT_TABLES2;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
-}
-
---echo
---echo deinit
---disable_warnings
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
-}
---disable_query_log
---disable_result_log
---source test_deinit.inc
---enable_result_log
---enable_query_log
---enable_warnings
---echo
---echo end of test
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--enable_result_log
+--enable_query_log
+if (!$HAVE_PARTITION)
+{
+ --disable_query_log
+ --disable_result_log
+ --source test_deinit.inc
+ --enable_result_log
+ --enable_query_log
+ --enable_warnings
+ skip Test requires partitioning;
+}
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ --connection child2_2
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo with partition test
+if ($HAVE_PARTITION)
+{
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_DROP_TABLES;
+ echo CHILD2_2_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_2_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_2_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES2;
+ echo CHILD2_1_CREATE_TABLES2;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES2;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ --disable_query_log
+ echo CREATE TABLE ta_l2 (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1;
+ eval CREATE TABLE ta_l2 (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1;
+ INSERT INTO ta_l2 (a, b, c) VALUES
+ (1, 'a', '2008-08-01 10:21:39'),
+ (2, 'b', '2000-01-01 00:00:00'),
+ (3, 'e', '2007-06-04 20:03:11'),
+ (4, 'd', '2003-11-30 05:01:03'),
+ (5, 'c', '2001-12-31 23:59:59');
+ --enable_query_log
+ eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+ SELECT COUNT(*) FROM ta_l2;
+ eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+ SELECT MAX(a) FROM ta_l2;
+ eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+ SELECT MIN(a) FROM ta_l2;
+ eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+ SELECT MAX(a) FROM ta_l2 WHERE a < 5;
+ eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+ SELECT MIN(a) FROM ta_l2 WHERE a > 1;
+ eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %';
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %';
+ }
+ eval $CHILD2_1_SELECT_TABLES2;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+}
+--disable_query_log
+--disable_result_log
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/have_partition.inc b/storage/spider/mysql-test/spider/t/have_partition.inc
index 573c76ab43b..b6e699475db 100644
--- a/storage/spider/mysql-test/spider/t/have_partition.inc
+++ b/storage/spider/mysql-test/spider/t/have_partition.inc
@@ -1,7 +1,7 @@
-let $HAVE_PARTITION= 0;
-if (`SELECT count(*) FROM information_schema.plugins WHERE
- plugin_status = 'ACTIVE' AND
- plugin_name = 'partition'`)
-{
- let $HAVE_PARTITION= 1;
-}
+let $HAVE_PARTITION= 0;
+if (`SELECT count(*) FROM information_schema.plugins WHERE
+ plugin_status = 'ACTIVE' AND
+ plugin_name = 'partition'`)
+{
+ let $HAVE_PARTITION= 1;
+}
diff --git a/storage/spider/mysql-test/spider/t/have_trigger.inc b/storage/spider/mysql-test/spider/t/have_trigger.inc
index 10c0871dd5f..32de484b388 100644
--- a/storage/spider/mysql-test/spider/t/have_trigger.inc
+++ b/storage/spider/mysql-test/spider/t/have_trigger.inc
@@ -1,2 +1,2 @@
-let $HAVE_TRIGGER= `SELECT COUNT(*) FROM information_schema.tables
- WHERE TABLE_SCHEMA = 'information_schema' AND TABLE_NAME = 'TRIGGERS'`;
+let $HAVE_TRIGGER= `SELECT COUNT(*) FROM information_schema.tables
+ WHERE TABLE_SCHEMA = 'information_schema' AND TABLE_NAME = 'TRIGGERS'`;
diff --git a/storage/spider/mysql-test/spider/t/spider3_fixes.test b/storage/spider/mysql-test/spider/t/spider3_fixes.test
index 7530ce97837..13fa6f5fa39 100644
--- a/storage/spider/mysql-test/spider/t/spider3_fixes.test
+++ b/storage/spider/mysql-test/spider/t/spider3_fixes.test
@@ -1,292 +1,292 @@
-# This test tests for Spider 3.0's bug fixes
-source include/have_log_bin.inc;
---disable_warnings
---disable_query_log
---disable_result_log
---source test_init.inc
---source slave_test_init.inc
---enable_result_log
---enable_query_log
-
---echo
---echo drop and create databases
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-if ($USE_REPLICATION)
-{
- --connection slave1_1
- DROP DATABASE IF EXISTS auto_test_local;
- CREATE DATABASE auto_test_local;
- USE auto_test_local;
-}
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- CREATE DATABASE auto_test_remote;
- USE auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- CREATE DATABASE auto_test_remote2;
- USE auto_test_remote2;
-}
---enable_warnings
-
---echo
---echo test select 1
---connection master_1
-SELECT 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- SELECT 1;
- --connection child2_2
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
-
---echo
---echo 3.1
---echo auto_increment
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_INCREMENT_TABLES1;
- echo CHILD2_1_CREATE_INCREMENT_TABLES1;
- echo CHILD2_1_AUTO_INCREMENT_INCREMENT2;
- echo CHILD2_1_AUTO_INCREMENT_OFFSET2;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_INCREMENT_TABLES1;
- --enable_warnings
- eval $CHILD2_1_CREATE_INCREMENT_TABLES1;
- eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2;
- eval $CHILD2_1_AUTO_INCREMENT_OFFSET2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-if ($USE_REPLICATION)
-{
- save_master_pos;
- --connection slave1_1
- sync_with_master;
- --connection master_1
- --disable_query_log
- SET SESSION sql_log_bin= 0;
- --enable_query_log
-}
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
---enable_warnings
---disable_query_log
-echo CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1;
-echo CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1;
-echo MASTER_1_AUTO_INCREMENT_INCREMENT2;
-echo MASTER_1_AUTO_INCREMENT_OFFSET2;
-eval CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_1;
-eval CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_1;
-eval $MASTER_1_AUTO_INCREMENT_INCREMENT2;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET2;
-if ($USE_REPLICATION)
-{
- SET SESSION sql_log_bin= 1;
- --connection slave1_1
- --disable_warnings
- DROP TABLE IF EXISTS t1, t2;
- --enable_warnings
- echo CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1;
- echo CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1;
- eval CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_1;
- eval CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_1;
- --connection master_1
-}
---enable_query_log
-INSERT INTO t1 () VALUES ();
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t1;
-INSERT INTO t2 () VALUES ();
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t2;
---disable_query_log
-echo MASTER_1_AUTO_INCREMENT_OFFSET3;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
---enable_query_log
-INSERT INTO t1 (id) VALUES (null);
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t1;
---disable_query_log
-echo MASTER_1_AUTO_INCREMENT_OFFSET4;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
---enable_query_log
-INSERT INTO t2 (id) VALUES (null);
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t2;
---disable_query_log
-echo MASTER_1_AUTO_INCREMENT_OFFSET3;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
---enable_query_log
-INSERT INTO t1 () VALUES (),(),(),();
-SELECT LAST_INSERT_ID();
-SELECT id FROM t1 ORDER BY id;
---disable_query_log
-echo MASTER_1_AUTO_INCREMENT_OFFSET4;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
---enable_query_log
-INSERT INTO t2 () VALUES (),(),(),();
-SELECT LAST_INSERT_ID();
-SELECT id FROM t2 ORDER BY id;
-TRUNCATE TABLE t1;
-TRUNCATE TABLE t2;
-INSERT INTO t1 () VALUES (),(),(),();
-SELECT LAST_INSERT_ID();
-SELECT id FROM t1 ORDER BY id;
-INSERT INTO t2 () VALUES (),(),(),();
-SELECT LAST_INSERT_ID();
-SELECT id FROM t2 ORDER BY id;
-SET INSERT_ID=5000;
---disable_query_log
-echo MASTER_1_AUTO_INCREMENT_OFFSET3;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
---enable_query_log
-INSERT INTO t1 () VALUES ();
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t1;
---disable_query_log
-echo MASTER_1_AUTO_INCREMENT_OFFSET4;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
---enable_query_log
-INSERT INTO t2 () VALUES ();
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t2;
-INSERT INTO t1 (id) VALUES (10000);
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t1;
-INSERT INTO t2 (id) VALUES (1000);
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t2;
-if ($USE_REPLICATION)
-{
- save_master_pos;
- --connection slave1_1
- sync_with_master;
- SELECT id FROM t1 ORDER BY id;
- --connection master_1
- --disable_query_log
- SET SESSION sql_log_bin= 0;
- --enable_query_log
-}
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %';
- }
- eval $CHILD2_1_SELECT_INCREMENT_TABLES1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_AUTO_INCREMENT_INCREMENT1;
- echo CHILD2_1_AUTO_INCREMENT_OFFSET1;
- }
- eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1;
- eval $CHILD2_1_AUTO_INCREMENT_OFFSET1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
-
---echo
---echo deinit
---disable_warnings
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-if ($USE_REPLICATION)
-{
- --connection slave1_1
- DROP DATABASE IF EXISTS auto_test_local;
-}
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
-}
---disable_query_log
---disable_result_log
---source slave_test_deinit.inc
---source test_deinit.inc
---enable_result_log
---enable_query_log
---enable_warnings
---echo
---echo end of test
+# This test tests for Spider 3.0's bug fixes
+source include/have_log_bin.inc;
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--source slave_test_init.inc
+--enable_result_log
+--enable_query_log
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_REPLICATION)
+{
+ --connection slave1_1
+ DROP DATABASE IF EXISTS auto_test_local;
+ CREATE DATABASE auto_test_local;
+ USE auto_test_local;
+}
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ --connection child2_2
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+
+--echo
+--echo 3.1
+--echo auto_increment
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_INCREMENT_TABLES1;
+ echo CHILD2_1_CREATE_INCREMENT_TABLES1;
+ echo CHILD2_1_AUTO_INCREMENT_INCREMENT2;
+ echo CHILD2_1_AUTO_INCREMENT_OFFSET2;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_INCREMENT_TABLES1;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_INCREMENT_TABLES1;
+ eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2;
+ eval $CHILD2_1_AUTO_INCREMENT_OFFSET2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+if ($USE_REPLICATION)
+{
+ save_master_pos;
+ --connection slave1_1
+ sync_with_master;
+ --connection master_1
+ --disable_query_log
+ SET SESSION sql_log_bin= 0;
+ --enable_query_log
+}
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1;
+echo CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1;
+echo MASTER_1_AUTO_INCREMENT_INCREMENT2;
+echo MASTER_1_AUTO_INCREMENT_OFFSET2;
+eval CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_1;
+eval CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_1;
+eval $MASTER_1_AUTO_INCREMENT_INCREMENT2;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET2;
+if ($USE_REPLICATION)
+{
+ SET SESSION sql_log_bin= 1;
+ --connection slave1_1
+ --disable_warnings
+ DROP TABLE IF EXISTS t1, t2;
+ --enable_warnings
+ echo CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1;
+ echo CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1;
+ eval CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_1;
+ eval CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_1;
+ --connection master_1
+}
+--enable_query_log
+INSERT INTO t1 () VALUES ();
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t1;
+INSERT INTO t2 () VALUES ();
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t2;
+--disable_query_log
+echo MASTER_1_AUTO_INCREMENT_OFFSET3;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
+--enable_query_log
+INSERT INTO t1 (id) VALUES (null);
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t1;
+--disable_query_log
+echo MASTER_1_AUTO_INCREMENT_OFFSET4;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
+--enable_query_log
+INSERT INTO t2 (id) VALUES (null);
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t2;
+--disable_query_log
+echo MASTER_1_AUTO_INCREMENT_OFFSET3;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
+--enable_query_log
+INSERT INTO t1 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+SELECT id FROM t1 ORDER BY id;
+--disable_query_log
+echo MASTER_1_AUTO_INCREMENT_OFFSET4;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
+--enable_query_log
+INSERT INTO t2 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+SELECT id FROM t2 ORDER BY id;
+TRUNCATE TABLE t1;
+TRUNCATE TABLE t2;
+INSERT INTO t1 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+SELECT id FROM t1 ORDER BY id;
+INSERT INTO t2 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+SELECT id FROM t2 ORDER BY id;
+SET INSERT_ID=5000;
+--disable_query_log
+echo MASTER_1_AUTO_INCREMENT_OFFSET3;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
+--enable_query_log
+INSERT INTO t1 () VALUES ();
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t1;
+--disable_query_log
+echo MASTER_1_AUTO_INCREMENT_OFFSET4;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
+--enable_query_log
+INSERT INTO t2 () VALUES ();
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t2;
+INSERT INTO t1 (id) VALUES (10000);
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t1;
+INSERT INTO t2 (id) VALUES (1000);
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t2;
+if ($USE_REPLICATION)
+{
+ save_master_pos;
+ --connection slave1_1
+ sync_with_master;
+ SELECT id FROM t1 ORDER BY id;
+ --connection master_1
+ --disable_query_log
+ SET SESSION sql_log_bin= 0;
+ --enable_query_log
+}
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %';
+ }
+ eval $CHILD2_1_SELECT_INCREMENT_TABLES1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_AUTO_INCREMENT_INCREMENT1;
+ echo CHILD2_1_AUTO_INCREMENT_OFFSET1;
+ }
+ eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1;
+ eval $CHILD2_1_AUTO_INCREMENT_OFFSET1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_REPLICATION)
+{
+ --connection slave1_1
+ DROP DATABASE IF EXISTS auto_test_local;
+}
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+}
+--disable_query_log
+--disable_result_log
+--source slave_test_deinit.inc
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/spider3_fixes_part.test b/storage/spider/mysql-test/spider/t/spider3_fixes_part.test
index f25f000d80c..3288c490a46 100644
--- a/storage/spider/mysql-test/spider/t/spider3_fixes_part.test
+++ b/storage/spider/mysql-test/spider/t/spider3_fixes_part.test
@@ -1,345 +1,345 @@
-# This test tests for Spider 3.0's bug fixes
-source include/have_log_bin.inc;
---disable_warnings
---disable_query_log
---disable_result_log
---source test_init.inc
---source slave_test_init.inc
---enable_result_log
---enable_query_log
-if (!$HAVE_PARTITION)
-{
- --disable_query_log
- --disable_result_log
- --source slave_test_deinit.inc
- --source test_deinit.inc
- --enable_result_log
- --enable_query_log
- --enable_warnings
- skip Test requires partitioning;
-}
-
---echo
---echo drop and create databases
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-if ($USE_REPLICATION)
-{
- --connection slave1_1
- DROP DATABASE IF EXISTS auto_test_local;
- CREATE DATABASE auto_test_local;
- USE auto_test_local;
-}
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- CREATE DATABASE auto_test_remote;
- USE auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- CREATE DATABASE auto_test_remote2;
- USE auto_test_remote2;
-}
---enable_warnings
-
---echo
---echo test select 1
---connection master_1
-SELECT 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- SELECT 1;
- --connection child2_2
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
-
---echo auto_increment with partition
-if ($HAVE_PARTITION)
-{
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_INCREMENT_TABLES1;
- echo CHILD2_1_CREATE_INCREMENT_TABLES1;
- echo CHILD2_1_AUTO_INCREMENT_INCREMENT2;
- echo CHILD2_1_AUTO_INCREMENT_OFFSET2;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_INCREMENT_TABLES1;
- --enable_warnings
- eval $CHILD2_1_CREATE_INCREMENT_TABLES1;
- eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2;
- eval $CHILD2_1_AUTO_INCREMENT_OFFSET2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_2
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_2_DROP_INCREMENT_TABLES1;
- echo CHILD2_2_CREATE_INCREMENT_TABLES1;
- echo CHILD2_2_AUTO_INCREMENT_INCREMENT2;
- echo CHILD2_2_AUTO_INCREMENT_OFFSET2;
- }
- --disable_warnings
- eval $CHILD2_2_DROP_INCREMENT_TABLES1;
- --enable_warnings
- eval $CHILD2_2_CREATE_INCREMENT_TABLES1;
- eval $CHILD2_2_AUTO_INCREMENT_INCREMENT2;
- eval $CHILD2_2_AUTO_INCREMENT_OFFSET2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- if ($USE_REPLICATION)
- {
- save_master_pos;
- --connection slave1_1
- sync_with_master;
- --connection master_1
- --disable_query_log
- SET SESSION sql_log_bin= 0;
- --enable_query_log
- }
- --disable_warnings
- DROP TABLE IF EXISTS t1, t2;
- --enable_warnings
- --disable_query_log
- echo CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1;
- echo CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1;
- echo MASTER_1_AUTO_INCREMENT_INCREMENT2;
- echo MASTER_1_AUTO_INCREMENT_OFFSET2;
- eval CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_P_1;
- eval CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_P_1;
- eval $MASTER_1_AUTO_INCREMENT_INCREMENT2;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET2;
- if ($USE_REPLICATION)
- {
- SET SESSION sql_log_bin= 1;
- --connection slave1_1
- --disable_warnings
- DROP TABLE IF EXISTS t1, t2;
- --enable_warnings
- echo CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1;
- echo CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1;
- eval CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1;
- eval CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1;
- --connection master_1
- }
- --enable_query_log
- INSERT INTO t1 () VALUES ();
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t1;
- INSERT INTO t2 () VALUES ();
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t2;
- --disable_query_log
- echo MASTER_1_AUTO_INCREMENT_OFFSET3;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
- --enable_query_log
- INSERT INTO t1 (id) VALUES (null);
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t1;
- --disable_query_log
- echo MASTER_1_AUTO_INCREMENT_OFFSET4;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
- --enable_query_log
- INSERT INTO t2 (id) VALUES (null);
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t2;
- --disable_query_log
- echo MASTER_1_AUTO_INCREMENT_OFFSET3;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
- --enable_query_log
- INSERT INTO t1 () VALUES (),(),(),();
- SELECT LAST_INSERT_ID();
- SELECT id FROM t1 ORDER BY id;
- --disable_query_log
- echo MASTER_1_AUTO_INCREMENT_OFFSET4;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
- --enable_query_log
- INSERT INTO t2 () VALUES (),(),(),();
- SELECT LAST_INSERT_ID();
- SELECT id FROM t2 ORDER BY id;
- TRUNCATE TABLE t1;
- TRUNCATE TABLE t2;
- INSERT INTO t1 () VALUES (),(),(),();
- SELECT LAST_INSERT_ID();
- SELECT id FROM t1 ORDER BY id;
- INSERT INTO t2 () VALUES (),(),(),();
- SELECT LAST_INSERT_ID();
- SELECT id FROM t2 ORDER BY id;
- SET INSERT_ID=5000;
- --disable_query_log
- echo MASTER_1_AUTO_INCREMENT_OFFSET3;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
- --enable_query_log
- INSERT INTO t1 () VALUES ();
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t1;
- --disable_query_log
- echo MASTER_1_AUTO_INCREMENT_OFFSET4;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
- --enable_query_log
- INSERT INTO t2 () VALUES ();
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t2;
- INSERT INTO t1 (id) VALUES (10000);
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t1;
- INSERT INTO t2 (id) VALUES (1000);
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t2;
- if ($USE_REPLICATION)
- {
- save_master_pos;
- --connection slave1_1
- sync_with_master;
- SELECT id FROM t1 ORDER BY id;
- --connection master_1
- --disable_query_log
- SET SESSION sql_log_bin= 0;
- --enable_query_log
- }
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %';
- }
- eval $CHILD2_1_SELECT_INCREMENT_TABLES1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_AUTO_INCREMENT_INCREMENT1;
- echo CHILD2_1_AUTO_INCREMENT_OFFSET1;
- }
- eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1;
- eval $CHILD2_1_AUTO_INCREMENT_OFFSET1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %';
- }
- eval $CHILD2_2_SELECT_INCREMENT_TABLES1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_2_AUTO_INCREMENT_INCREMENT1;
- echo CHILD2_2_AUTO_INCREMENT_OFFSET1;
- }
- eval $CHILD2_2_AUTO_INCREMENT_INCREMENT1;
- eval $CHILD2_2_AUTO_INCREMENT_OFFSET1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
-}
-
-
---echo
---echo deinit
---disable_warnings
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-if ($USE_REPLICATION)
-{
- --connection slave1_1
- DROP DATABASE IF EXISTS auto_test_local;
-}
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
-}
---disable_query_log
---disable_result_log
---source slave_test_deinit.inc
---source test_deinit.inc
---enable_result_log
---enable_query_log
---enable_warnings
---echo
---echo end of test
+# This test tests for Spider 3.0's bug fixes
+source include/have_log_bin.inc;
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--source slave_test_init.inc
+--enable_result_log
+--enable_query_log
+if (!$HAVE_PARTITION)
+{
+ --disable_query_log
+ --disable_result_log
+ --source slave_test_deinit.inc
+ --source test_deinit.inc
+ --enable_result_log
+ --enable_query_log
+ --enable_warnings
+ skip Test requires partitioning;
+}
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_REPLICATION)
+{
+ --connection slave1_1
+ DROP DATABASE IF EXISTS auto_test_local;
+ CREATE DATABASE auto_test_local;
+ USE auto_test_local;
+}
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ --connection child2_2
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+
+--echo auto_increment with partition
+if ($HAVE_PARTITION)
+{
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_INCREMENT_TABLES1;
+ echo CHILD2_1_CREATE_INCREMENT_TABLES1;
+ echo CHILD2_1_AUTO_INCREMENT_INCREMENT2;
+ echo CHILD2_1_AUTO_INCREMENT_OFFSET2;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_INCREMENT_TABLES1;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_INCREMENT_TABLES1;
+ eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2;
+ eval $CHILD2_1_AUTO_INCREMENT_OFFSET2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_DROP_INCREMENT_TABLES1;
+ echo CHILD2_2_CREATE_INCREMENT_TABLES1;
+ echo CHILD2_2_AUTO_INCREMENT_INCREMENT2;
+ echo CHILD2_2_AUTO_INCREMENT_OFFSET2;
+ }
+ --disable_warnings
+ eval $CHILD2_2_DROP_INCREMENT_TABLES1;
+ --enable_warnings
+ eval $CHILD2_2_CREATE_INCREMENT_TABLES1;
+ eval $CHILD2_2_AUTO_INCREMENT_INCREMENT2;
+ eval $CHILD2_2_AUTO_INCREMENT_OFFSET2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ if ($USE_REPLICATION)
+ {
+ save_master_pos;
+ --connection slave1_1
+ sync_with_master;
+ --connection master_1
+ --disable_query_log
+ SET SESSION sql_log_bin= 0;
+ --enable_query_log
+ }
+ --disable_warnings
+ DROP TABLE IF EXISTS t1, t2;
+ --enable_warnings
+ --disable_query_log
+ echo CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1;
+ echo CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1;
+ echo MASTER_1_AUTO_INCREMENT_INCREMENT2;
+ echo MASTER_1_AUTO_INCREMENT_OFFSET2;
+ eval CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_P_1;
+ eval CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_P_1;
+ eval $MASTER_1_AUTO_INCREMENT_INCREMENT2;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET2;
+ if ($USE_REPLICATION)
+ {
+ SET SESSION sql_log_bin= 1;
+ --connection slave1_1
+ --disable_warnings
+ DROP TABLE IF EXISTS t1, t2;
+ --enable_warnings
+ echo CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1;
+ echo CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1;
+ eval CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1;
+ eval CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1;
+ --connection master_1
+ }
+ --enable_query_log
+ INSERT INTO t1 () VALUES ();
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t1;
+ INSERT INTO t2 () VALUES ();
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t2;
+ --disable_query_log
+ echo MASTER_1_AUTO_INCREMENT_OFFSET3;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
+ --enable_query_log
+ INSERT INTO t1 (id) VALUES (null);
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t1;
+ --disable_query_log
+ echo MASTER_1_AUTO_INCREMENT_OFFSET4;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
+ --enable_query_log
+ INSERT INTO t2 (id) VALUES (null);
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t2;
+ --disable_query_log
+ echo MASTER_1_AUTO_INCREMENT_OFFSET3;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
+ --enable_query_log
+ INSERT INTO t1 () VALUES (),(),(),();
+ SELECT LAST_INSERT_ID();
+ SELECT id FROM t1 ORDER BY id;
+ --disable_query_log
+ echo MASTER_1_AUTO_INCREMENT_OFFSET4;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
+ --enable_query_log
+ INSERT INTO t2 () VALUES (),(),(),();
+ SELECT LAST_INSERT_ID();
+ SELECT id FROM t2 ORDER BY id;
+ TRUNCATE TABLE t1;
+ TRUNCATE TABLE t2;
+ INSERT INTO t1 () VALUES (),(),(),();
+ SELECT LAST_INSERT_ID();
+ SELECT id FROM t1 ORDER BY id;
+ INSERT INTO t2 () VALUES (),(),(),();
+ SELECT LAST_INSERT_ID();
+ SELECT id FROM t2 ORDER BY id;
+ SET INSERT_ID=5000;
+ --disable_query_log
+ echo MASTER_1_AUTO_INCREMENT_OFFSET3;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
+ --enable_query_log
+ INSERT INTO t1 () VALUES ();
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t1;
+ --disable_query_log
+ echo MASTER_1_AUTO_INCREMENT_OFFSET4;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
+ --enable_query_log
+ INSERT INTO t2 () VALUES ();
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t2;
+ INSERT INTO t1 (id) VALUES (10000);
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t1;
+ INSERT INTO t2 (id) VALUES (1000);
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t2;
+ if ($USE_REPLICATION)
+ {
+ save_master_pos;
+ --connection slave1_1
+ sync_with_master;
+ SELECT id FROM t1 ORDER BY id;
+ --connection master_1
+ --disable_query_log
+ SET SESSION sql_log_bin= 0;
+ --enable_query_log
+ }
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %';
+ }
+ eval $CHILD2_1_SELECT_INCREMENT_TABLES1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_AUTO_INCREMENT_INCREMENT1;
+ echo CHILD2_1_AUTO_INCREMENT_OFFSET1;
+ }
+ eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1;
+ eval $CHILD2_1_AUTO_INCREMENT_OFFSET1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %';
+ }
+ eval $CHILD2_2_SELECT_INCREMENT_TABLES1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_AUTO_INCREMENT_INCREMENT1;
+ echo CHILD2_2_AUTO_INCREMENT_OFFSET1;
+ }
+ eval $CHILD2_2_AUTO_INCREMENT_INCREMENT1;
+ eval $CHILD2_2_AUTO_INCREMENT_OFFSET1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+}
+
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_REPLICATION)
+{
+ --connection slave1_1
+ DROP DATABASE IF EXISTS auto_test_local;
+}
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+}
+--disable_query_log
+--disable_result_log
+--source slave_test_deinit.inc
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
diff --git a/storage/spider/spd_conn.cc b/storage/spider/spd_conn.cc
index ce786a7b697..e19222c99f6 100644
--- a/storage/spider/spd_conn.cc
+++ b/storage/spider/spd_conn.cc
@@ -14,7 +14,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#define MYSQL_SERVER 1
-#include <my_global.h>
#include "mysql_version.h"
#if MYSQL_VERSION_ID < 50500
#include "mysql_priv.h"
diff --git a/storage/spider/spd_copy_tables.cc b/storage/spider/spd_copy_tables.cc
index dae0d94d7aa..10fed696134 100644
--- a/storage/spider/spd_copy_tables.cc
+++ b/storage/spider/spd_copy_tables.cc
@@ -14,7 +14,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#define MYSQL_SERVER 1
-#include <my_global.h>
#include "mysql_version.h"
#if MYSQL_VERSION_ID < 50500
#include "mysql_priv.h"
diff --git a/storage/spider/spd_db_conn.cc b/storage/spider/spd_db_conn.cc
index 81b6fae841f..30ad38eceb0 100644
--- a/storage/spider/spd_db_conn.cc
+++ b/storage/spider/spd_db_conn.cc
@@ -14,7 +14,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#define MYSQL_SERVER 1
-#include <my_global.h>
#include "mysql_version.h"
#if MYSQL_VERSION_ID < 50500
#include "mysql_priv.h"
@@ -515,6 +514,7 @@ int spider_db_before_query(
int *need_mon
) {
int error_num;
+ bool tmp_mta_conn_mutex_lock_already;
DBUG_ENTER("spider_db_before_query");
DBUG_ASSERT(need_mon);
#ifndef WITHOUT_SPIDER_BG_SEARCH
@@ -529,11 +529,15 @@ int spider_db_before_query(
conn->need_mon = need_mon;
}
DBUG_ASSERT(conn->mta_conn_mutex_file_pos.file_name);
+ tmp_mta_conn_mutex_lock_already = conn->mta_conn_mutex_lock_already;
+ conn->mta_conn_mutex_lock_already = TRUE;
if ((error_num = spider_db_conn_queue_action(conn)))
{
conn->in_before_query = FALSE;
+ conn->mta_conn_mutex_lock_already = tmp_mta_conn_mutex_lock_already;
DBUG_RETURN(error_num);
}
+ conn->mta_conn_mutex_lock_already = tmp_mta_conn_mutex_lock_already;
if (conn->server_lost)
{
conn->in_before_query = FALSE;
@@ -2564,7 +2568,11 @@ int spider_db_fetch_for_item_sum_func(
{
Item *free_list = thd->free_list;
spider->direct_aggregate_item_current->item =
+#ifdef SPIDER_ITEM_STRING_WITHOUT_SET_STR_WITH_COPY
+ new Item_string("", 0, share->access_charset);
+#else
new Item_string(share->access_charset);
+#endif
if (!spider->direct_aggregate_item_current->item)
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
thd->free_list = free_list;
@@ -2575,7 +2583,12 @@ int spider_db_fetch_for_item_sum_func(
(Item_string *) spider->direct_aggregate_item_current->item;
if (row->is_null())
{
+#ifdef SPIDER_ITEM_STRING_WITHOUT_SET_STR_WITH_COPY
+ item->val_str(NULL)->length(0);
+ item->append(NULL, 0);
+#else
item->set_str_with_copy(NULL, 0);
+#endif
item->null_value = TRUE;
} else {
char buf[MAX_FIELD_WIDTH];
@@ -2584,7 +2597,12 @@ int spider_db_fetch_for_item_sum_func(
tmp_str.length(0);
if ((error_num = row->append_to_str(&tmp_str)))
DBUG_RETURN(error_num);
+#ifdef SPIDER_ITEM_STRING_WITHOUT_SET_STR_WITH_COPY
+ item->val_str(NULL)->length(0);
+ item->append((char *) tmp_str.ptr(), tmp_str.length());
+#else
item->set_str_with_copy(tmp_str.ptr(), tmp_str.length());
+#endif
item->null_value = FALSE;
}
item_hybrid->direct_add(item);
@@ -3279,8 +3297,11 @@ void spider_db_free_one_result(
if (result->result)
{
result->result->free_result();
- delete result->result;
- result->result = NULL;
+ if (!result->tmp_tbl_use_position)
+ {
+ delete result->result;
+ result->result = NULL;
+ }
}
if (!result->tmp_tbl_use_position)
{
@@ -4964,11 +4985,14 @@ int spider_db_seek_tmp_table(
DBUG_PRINT("info", ("spider row=%p", row));
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
- DBUG_PRINT("info", ("spider direct_aggregate=%s",
- pos->direct_aggregate ? "TRUE" : "FALSE"));
- spider->result_list.snap_mrr_with_cnt = pos->mrr_with_cnt;
- spider->result_list.snap_direct_aggregate = pos->direct_aggregate;
- spider->result_list.snap_row = row;
+ if (!spider->result_list.in_cmp_ref)
+ {
+ DBUG_PRINT("info", ("spider direct_aggregate=%s",
+ pos->direct_aggregate ? "TRUE" : "FALSE"));
+ spider->result_list.snap_mrr_with_cnt = pos->mrr_with_cnt;
+ spider->result_list.snap_direct_aggregate = pos->direct_aggregate;
+ spider->result_list.snap_row = row;
+ }
#endif
/* for mrr */
@@ -5052,11 +5076,14 @@ int spider_db_seek_tmp_key(
DBUG_PRINT("info", ("spider row=%p", row));
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
- DBUG_PRINT("info", ("spider direct_aggregate=%s",
- pos->direct_aggregate ? "TRUE" : "FALSE"));
- spider->result_list.snap_mrr_with_cnt = pos->mrr_with_cnt;
- spider->result_list.snap_direct_aggregate = pos->direct_aggregate;
- spider->result_list.snap_row = row;
+ if (!spider->result_list.in_cmp_ref)
+ {
+ DBUG_PRINT("info", ("spider direct_aggregate=%s",
+ pos->direct_aggregate ? "TRUE" : "FALSE"));
+ spider->result_list.snap_mrr_with_cnt = pos->mrr_with_cnt;
+ spider->result_list.snap_direct_aggregate = pos->direct_aggregate;
+ spider->result_list.snap_row = row;
+ }
#endif
/* for mrr */
@@ -5133,11 +5160,14 @@ int spider_db_seek_tmp_minimum_columns(
DBUG_PRINT("info", ("spider row=%p", row));
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
- DBUG_PRINT("info", ("spider direct_aggregate=%s",
- pos->direct_aggregate ? "TRUE" : "FALSE"));
- spider->result_list.snap_mrr_with_cnt = pos->mrr_with_cnt;
- spider->result_list.snap_direct_aggregate = pos->direct_aggregate;
- spider->result_list.snap_row = row;
+ if (!spider->result_list.in_cmp_ref)
+ {
+ DBUG_PRINT("info", ("spider direct_aggregate=%s",
+ pos->direct_aggregate ? "TRUE" : "FALSE"));
+ spider->result_list.snap_mrr_with_cnt = pos->mrr_with_cnt;
+ spider->result_list.snap_direct_aggregate = pos->direct_aggregate;
+ spider->result_list.snap_row = row;
+ }
#endif
/* for mrr */
@@ -8088,19 +8118,24 @@ int spider_db_open_item_string(
spider_string tmp_str(tmp_buf, MAX_FIELD_WIDTH, str->charset());
String *tmp_str2;
tmp_str.init_calc_mem(126);
- if (
- !(tmp_str2 = item->val_str(tmp_str.get_str())) ||
- str->reserve(SPIDER_SQL_VALUE_QUOTE_LEN * 2 + tmp_str2->length() * 2)
- )
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- tmp_str.mem_calc();
- str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN);
- if (
- str->append_for_single_quote(tmp_str2) ||
- str->reserve(SPIDER_SQL_VALUE_QUOTE_LEN)
- )
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN);
+ if (!(tmp_str2 = item->val_str(tmp_str.get_str())))
+ {
+ if (str->reserve(SPIDER_SQL_NULL_LEN))
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+ str->q_append(SPIDER_SQL_NULL_STR, SPIDER_SQL_NULL_LEN);
+ } else {
+ if (str->reserve(SPIDER_SQL_VALUE_QUOTE_LEN * 2 +
+ tmp_str2->length() * 2))
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+ tmp_str.mem_calc();
+ str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN);
+ if (
+ str->append_for_single_quote(tmp_str2) ||
+ str->reserve(SPIDER_SQL_VALUE_QUOTE_LEN)
+ )
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+ str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN);
+ }
}
DBUG_RETURN(0);
}
diff --git a/storage/spider/spd_db_handlersocket.cc b/storage/spider/spd_db_handlersocket.cc
index d1eb68679b2..9d0b05855d5 100644
--- a/storage/spider/spd_db_handlersocket.cc
+++ b/storage/spider/spd_db_handlersocket.cc
@@ -14,7 +14,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#define MYSQL_SERVER 1
-#include <my_global.h>
#include "mysql_version.h"
#if MYSQL_VERSION_ID < 50500
#include "mysql_priv.h"
@@ -5543,7 +5542,7 @@ void spider_handlersocket_handler::minimum_select_bitmap_create()
DBUG_ENTER("spider_handlersocket_handler::minimum_select_bitmap_create");
memset(minimum_select_bitmap, 0, no_bytes_in_map(table->read_set));
if (
- spider->has_clone_for_merge ||
+ spider->use_index_merge ||
#ifdef HA_CAN_BULK_ACCESS
(spider->is_clone && !spider->is_bulk_access_clone)
#else
diff --git a/storage/spider/spd_db_include.h b/storage/spider/spd_db_include.h
index 371257a955b..c70995ec007 100644
--- a/storage/spider/spd_db_include.h
+++ b/storage/spider/spd_db_include.h
@@ -24,6 +24,9 @@
#define SPIDER_HAS_DISCOVER_TABLE_STRUCTURE
#define SPIDER_HAS_APPEND_FOR_SINGLE_QUOTE
#define SPIDER_HAS_SHOW_SIMPLE_FUNC
+#define SPIDER_HAS_JT_HASH_INDEX_MERGE
+#else
+#define SPIDER_NEED_CHECK_CONDITION_AT_CHECKING_DIRECT_ORDER_LIMIT
#endif
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100007
@@ -36,8 +39,13 @@
#define SPIDER_HAS_DECIMAL_OPERATION_RESULTS_VALUE_TYPE
#endif
+#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100014
+#define SPIDER_ITEM_STRING_WITHOUT_SET_STR_WITH_COPY
+#endif
+
#if defined(MARIADB_BASE_VERSION)
#define SPIDER_ITEM_GEOFUNC_NAME_HAS_MBR
+#define SPIDER_HANDLER_AUTO_REPAIR_HAS_ERROR
#endif
class spider_db_conn;
@@ -1649,6 +1657,7 @@ typedef struct st_spider_result_list
bool snap_direct_aggregate;
SPIDER_DB_ROW *snap_row;
#endif
+ bool in_cmp_ref;
bool set_split_read;
bool insert_dup_update_pushdown;
longlong split_read_base;
diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc
index f60220ee38b..1b40265e9b6 100644
--- a/storage/spider/spd_db_mysql.cc
+++ b/storage/spider/spd_db_mysql.cc
@@ -14,7 +14,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#define MYSQL_SERVER 1
-#include <my_global.h>
#include "mysql_version.h"
#if MYSQL_VERSION_ID < 50500
#include "mysql_priv.h"
@@ -5385,28 +5384,46 @@ void spider_mysql_handler::create_tmp_bka_table_name(
int *tmp_table_name_length,
int link_idx
) {
- uint adjust_length =
- mysql_share->db_nm_max_length -
- mysql_share->db_names_str[spider->conn_link_idx[link_idx]].length() +
- mysql_share->table_nm_max_length -
- mysql_share->table_names_str[spider->conn_link_idx[link_idx]].length(),
- length;
+ uint adjust_length, length;
DBUG_ENTER("spider_mysql_handler::create_tmp_bka_table_name");
- *tmp_table_name_length = mysql_share->db_nm_max_length +
- mysql_share->table_nm_max_length;
- memset(tmp_table_name, ' ', adjust_length);
- tmp_table_name += adjust_length;
- memcpy(tmp_table_name, mysql_share->db_names_str[link_idx].c_ptr(),
- mysql_share->db_names_str[link_idx].length());
- tmp_table_name += mysql_share->db_names_str[link_idx].length();
- length = my_sprintf(tmp_table_name, (tmp_table_name,
- "%s%s%p%s", SPIDER_SQL_DOT_STR, SPIDER_SQL_TMP_BKA_STR, spider,
- SPIDER_SQL_UNDERSCORE_STR));
- *tmp_table_name_length += length;
- tmp_table_name += length;
- memcpy(tmp_table_name,
- mysql_share->table_names_str[spider->conn_link_idx[link_idx]].c_ptr(),
- mysql_share->table_names_str[spider->conn_link_idx[link_idx]].length());
+ if (spider_param_bka_table_name_type(current_thd,
+ mysql_share->spider_share->
+ bka_table_name_types[spider->conn_link_idx[link_idx]]) == 1)
+ {
+ adjust_length =
+ mysql_share->db_nm_max_length -
+ mysql_share->db_names_str[spider->conn_link_idx[link_idx]].length() +
+ mysql_share->table_nm_max_length -
+ mysql_share->table_names_str[spider->conn_link_idx[link_idx]].length();
+ *tmp_table_name_length = mysql_share->db_nm_max_length +
+ mysql_share->table_nm_max_length;
+ memset(tmp_table_name, ' ', adjust_length);
+ tmp_table_name += adjust_length;
+ memcpy(tmp_table_name, mysql_share->db_names_str[link_idx].c_ptr(),
+ mysql_share->db_names_str[link_idx].length());
+ tmp_table_name += mysql_share->db_names_str[link_idx].length();
+ length = my_sprintf(tmp_table_name, (tmp_table_name,
+ "%s%s%p%s", SPIDER_SQL_DOT_STR, SPIDER_SQL_TMP_BKA_STR, spider,
+ SPIDER_SQL_UNDERSCORE_STR));
+ *tmp_table_name_length += length;
+ tmp_table_name += length;
+ memcpy(tmp_table_name,
+ mysql_share->table_names_str[spider->conn_link_idx[link_idx]].c_ptr(),
+ mysql_share->table_names_str[spider->conn_link_idx[link_idx]].length());
+ } else {
+ adjust_length =
+ mysql_share->db_nm_max_length -
+ mysql_share->db_names_str[spider->conn_link_idx[link_idx]].length();
+ *tmp_table_name_length = mysql_share->db_nm_max_length;
+ memset(tmp_table_name, ' ', adjust_length);
+ tmp_table_name += adjust_length;
+ memcpy(tmp_table_name, mysql_share->db_names_str[link_idx].c_ptr(),
+ mysql_share->db_names_str[link_idx].length());
+ tmp_table_name += mysql_share->db_names_str[link_idx].length();
+ length = my_sprintf(tmp_table_name, (tmp_table_name,
+ "%s%s%p", SPIDER_SQL_DOT_STR, SPIDER_SQL_TMP_BKA_STR, spider));
+ *tmp_table_name_length += length;
+ }
DBUG_VOID_RETURN;
}
@@ -7269,11 +7286,16 @@ int spider_mysql_handler::append_update_where(
Field **field;
SPIDER_SHARE *share = spider->share;
DBUG_ENTER("spider_mysql_handler::append_update_where");
+ DBUG_PRINT("info", ("spider table->s->primary_key=%s",
+ table->s->primary_key != MAX_KEY ? "TRUE" : "FALSE"));
if (str->reserve(SPIDER_SQL_WHERE_LEN))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
str->q_append(SPIDER_SQL_WHERE_STR, SPIDER_SQL_WHERE_LEN);
for (field = table->field; *field; field++)
{
+ DBUG_PRINT("info", ("spider bitmap=%s",
+ bitmap_is_set(table->read_set, (*field)->field_index) ?
+ "TRUE" : "FALSE"));
if (
table->s->primary_key == MAX_KEY ||
bitmap_is_set(table->read_set, (*field)->field_index)
@@ -11444,7 +11466,7 @@ void spider_mysql_handler::minimum_select_bitmap_create()
DBUG_PRINT("info",("spider this=%p", this));
memset(minimum_select_bitmap, 0, no_bytes_in_map(table->read_set));
if (
- spider->has_clone_for_merge ||
+ spider->use_index_merge ||
#ifdef HA_CAN_BULK_ACCESS
(spider->is_clone && !spider->is_bulk_access_clone)
#else
diff --git a/storage/spider/spd_db_oracle.cc b/storage/spider/spd_db_oracle.cc
index 0464d2b576d..d86da799bee 100644
--- a/storage/spider/spd_db_oracle.cc
+++ b/storage/spider/spd_db_oracle.cc
@@ -14,7 +14,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#define MYSQL_SERVER 1
-#include <my_global.h>
#include "mysql_version.h"
#if MYSQL_VERSION_ID < 50500
#include "mysql_priv.h"
@@ -5104,28 +5103,46 @@ void spider_oracle_handler::create_tmp_bka_table_name(
int *tmp_table_name_length,
int link_idx
) {
- uint adjust_length =
- oracle_share->db_nm_max_length -
- oracle_share->db_names_str[spider->conn_link_idx[link_idx]].length() +
- oracle_share->table_nm_max_length -
- oracle_share->table_names_str[spider->conn_link_idx[link_idx]].length(),
- length;
+ uint adjust_length, length;
DBUG_ENTER("spider_oracle_handler::create_tmp_bka_table_name");
- *tmp_table_name_length = oracle_share->db_nm_max_length +
- oracle_share->table_nm_max_length;
- memset(tmp_table_name, ' ', adjust_length);
- tmp_table_name += adjust_length;
- memcpy(tmp_table_name, oracle_share->db_names_str[link_idx].c_ptr(),
- oracle_share->db_names_str[link_idx].length());
- tmp_table_name += oracle_share->db_names_str[link_idx].length();
- length = my_sprintf(tmp_table_name, (tmp_table_name,
- "%s%s%p%s", SPIDER_SQL_DOT_STR, SPIDER_SQL_TMP_BKA_STR, spider,
- SPIDER_SQL_UNDERSCORE_STR));
- *tmp_table_name_length += length;
- tmp_table_name += length;
- memcpy(tmp_table_name,
- oracle_share->table_names_str[spider->conn_link_idx[link_idx]].c_ptr(),
- oracle_share->table_names_str[spider->conn_link_idx[link_idx]].length());
+ if (spider_param_bka_table_name_type(current_thd,
+ mysql_share->spider_share->
+ bka_table_name_types[spider->conn_link_idx[link_idx]]) == 1)
+ {
+ adjust_length =
+ oracle_share->db_nm_max_length -
+ oracle_share->db_names_str[spider->conn_link_idx[link_idx]].length() +
+ oracle_share->table_nm_max_length -
+ oracle_share->table_names_str[spider->conn_link_idx[link_idx]].length();
+ *tmp_table_name_length = oracle_share->db_nm_max_length +
+ oracle_share->table_nm_max_length;
+ memset(tmp_table_name, ' ', adjust_length);
+ tmp_table_name += adjust_length;
+ memcpy(tmp_table_name, oracle_share->db_names_str[link_idx].c_ptr(),
+ oracle_share->db_names_str[link_idx].length());
+ tmp_table_name += oracle_share->db_names_str[link_idx].length();
+ length = my_sprintf(tmp_table_name, (tmp_table_name,
+ "%s%s%p%s", SPIDER_SQL_DOT_STR, SPIDER_SQL_TMP_BKA_STR, spider,
+ SPIDER_SQL_UNDERSCORE_STR));
+ *tmp_table_name_length += length;
+ tmp_table_name += length;
+ memcpy(tmp_table_name,
+ oracle_share->table_names_str[spider->conn_link_idx[link_idx]].c_ptr(),
+ oracle_share->table_names_str[spider->conn_link_idx[link_idx]].length());
+ } else {
+ adjust_length =
+ oracle_share->db_nm_max_length -
+ oracle_share->db_names_str[spider->conn_link_idx[link_idx]].length();
+ *tmp_table_name_length = oracle_share->db_nm_max_length;
+ memset(tmp_table_name, ' ', adjust_length);
+ tmp_table_name += adjust_length;
+ memcpy(tmp_table_name, oracle_share->db_names_str[link_idx].c_ptr(),
+ oracle_share->db_names_str[link_idx].length());
+ tmp_table_name += oracle_share->db_names_str[link_idx].length();
+ length = my_sprintf(tmp_table_name, (tmp_table_name,
+ "%s%s%p", SPIDER_SQL_DOT_STR, SPIDER_SQL_TMP_BKA_STR, spider));
+ *tmp_table_name_length += length;
+ }
DBUG_VOID_RETURN;
}
@@ -11647,7 +11664,7 @@ void spider_oracle_handler::minimum_select_bitmap_create()
DBUG_ENTER("spider_oracle_handler::minimum_select_bitmap_create");
memset(minimum_select_bitmap, 0, no_bytes_in_map(table->read_set));
if (
- spider->has_clone_for_merge ||
+ spider->use_index_merge ||
#ifdef HA_CAN_BULK_ACCESS
(spider->is_clone && !spider->is_bulk_access_clone)
#else
diff --git a/storage/spider/spd_direct_sql.cc b/storage/spider/spd_direct_sql.cc
index 7149502d8f6..27041790d63 100644
--- a/storage/spider/spd_direct_sql.cc
+++ b/storage/spider/spd_direct_sql.cc
@@ -14,7 +14,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#define MYSQL_SERVER 1
-#include <my_global.h>
#include "mysql_version.h"
#if MYSQL_VERSION_ID < 50500
#include "mysql_priv.h"
diff --git a/storage/spider/spd_i_s.cc b/storage/spider/spd_i_s.cc
index 025878b6253..49824693984 100644
--- a/storage/spider/spd_i_s.cc
+++ b/storage/spider/spd_i_s.cc
@@ -14,7 +14,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#define MYSQL_SERVER 1
-#include <my_global.h>
#include "mysql_version.h"
#if MYSQL_VERSION_ID < 50500
#include "mysql_priv.h"
diff --git a/storage/spider/spd_include.h b/storage/spider/spd_include.h
index f6952e5398e..9f27bd6acf8 100644
--- a/storage/spider/spd_include.h
+++ b/storage/spider/spd_include.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2014 Kentoku Shiba
+/* Copyright (C) 2008-2015 Kentoku Shiba
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
@@ -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 */
-#define SPIDER_DETAIL_VERSION "3.2.11"
+#define SPIDER_DETAIL_VERSION "3.2.21"
#define SPIDER_HEX_VERSION 0x0302
#if MYSQL_VERSION_ID < 50500
@@ -70,6 +70,7 @@
#define spider_stmt_da_message(A) thd_get_error_message(A)
#define spider_stmt_da_sql_errno(A) thd_get_error_number(A)
#define spider_user_defined_key_parts(A) (A)->user_defined_key_parts
+#define spider_join_table_count(A) (A)->table_count
#define SPIDER_CAN_BG_UPDATE (1LL << 39)
#define SPIDER_ALTER_ADD_PARTITION Alter_info::ALTER_ADD_PARTITION
#define SPIDER_ALTER_DROP_PARTITION Alter_info::ALTER_DROP_PARTITION
@@ -94,6 +95,7 @@
#endif
#endif
#define spider_user_defined_key_parts(A) (A)->key_parts
+#define spider_join_table_count(A) (A)->tables
#define SPIDER_ALTER_ADD_PARTITION ALTER_ADD_PARTITION
#define SPIDER_ALTER_DROP_PARTITION ALTER_DROP_PARTITION
#define SPIDER_ALTER_COALESCE_PARTITION ALTER_COALESCE_PARTITION
@@ -105,6 +107,10 @@
#define SPIDER_THD_KILL_CONNECTION THD::KILL_CONNECTION
#endif
+#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100005
+#define SPIDER_HAS_EXPLAIN_QUERY
+#endif
+
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100009
#define SPIDER_TEST(A) MY_TEST(A)
#else
@@ -135,7 +141,7 @@
#define SPIDER_TMP_SHARE_CHAR_PTR_COUNT 19
#define SPIDER_TMP_SHARE_UINT_COUNT 17
-#define SPIDER_TMP_SHARE_LONG_COUNT 15
+#define SPIDER_TMP_SHARE_LONG_COUNT 16
#define SPIDER_TMP_SHARE_LONGLONG_COUNT 3
#define SPIDER_MEM_CALC_LIST_NUM 247
@@ -858,6 +864,7 @@ typedef struct st_spider_share
long *net_read_timeouts;
long *net_write_timeouts;
long *access_balances;
+ long *bka_table_name_types;
uint *server_names_lengths;
uint *tgt_table_names_lengths;
@@ -961,6 +968,7 @@ typedef struct st_spider_share
uint net_read_timeouts_length;
uint net_write_timeouts_length;
uint access_balances_length;
+ uint bka_table_name_types_length;
/* for dbton */
uchar dbton_bitmap[spider_bitmap_size(SPIDER_DBTON_SIZE)];
diff --git a/storage/spider/spd_malloc.cc b/storage/spider/spd_malloc.cc
index 56fb3c9ccd2..4a033c1e7cf 100644
--- a/storage/spider/spd_malloc.cc
+++ b/storage/spider/spd_malloc.cc
@@ -14,7 +14,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#define MYSQL_SERVER 1
-#include <my_global.h>
#include "mysql_version.h"
#if MYSQL_VERSION_ID < 50500
#include "mysql_priv.h"
diff --git a/storage/spider/spd_param.cc b/storage/spider/spd_param.cc
index 387d17134e5..7376bfc0499 100644
--- a/storage/spider/spd_param.cc
+++ b/storage/spider/spd_param.cc
@@ -14,7 +14,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#define MYSQL_SERVER 1
-#include <my_global.h>
#include "mysql_version.h"
#if MYSQL_VERSION_ID < 50500
#include "mysql_priv.h"
@@ -2961,6 +2960,32 @@ int spider_param_delete_all_rows_type(
delete_all_rows_type : THDVAR(thd, delete_all_rows_type));
}
+/*
+ -1 :use table parameter
+ 0 :compact
+ 1 :add original table name
+ */
+static MYSQL_THDVAR_INT(
+ bka_table_name_type, /* name */
+ PLUGIN_VAR_RQCMDARG, /* opt */
+ "The type of temporary table name for bka", /* comment */
+ NULL, /* check */
+ NULL, /* update */
+ -1, /* def */
+ -1, /* min */
+ 1, /* max */
+ 0 /* blk */
+);
+
+int spider_param_bka_table_name_type(
+ THD *thd,
+ int bka_table_name_type
+) {
+ DBUG_ENTER("spider_param_bka_table_name_type");
+ DBUG_RETURN(THDVAR(thd, bka_table_name_type) == -1 ?
+ bka_table_name_type : THDVAR(thd, bka_table_name_type));
+}
+
static struct st_mysql_storage_engine spider_storage_engine =
{ MYSQL_HANDLERTON_INTERFACE_VERSION };
@@ -3094,6 +3119,7 @@ static struct st_mysql_sys_var* spider_system_variables[] = {
MYSQL_SYSVAR(casual_read),
MYSQL_SYSVAR(dry_access),
MYSQL_SYSVAR(delete_all_rows_type),
+ MYSQL_SYSVAR(bka_table_name_type),
NULL
};
diff --git a/storage/spider/spd_param.h b/storage/spider/spd_param.h
index e68143aa774..32db0403159 100644
--- a/storage/spider/spd_param.h
+++ b/storage/spider/spd_param.h
@@ -383,3 +383,7 @@ int spider_param_delete_all_rows_type(
THD *thd,
int delete_all_rows_type
);
+int spider_param_bka_table_name_type(
+ THD *thd,
+ int bka_table_name_type
+);
diff --git a/storage/spider/spd_ping_table.cc b/storage/spider/spd_ping_table.cc
index 8c55b0fc683..d32dbec2421 100644
--- a/storage/spider/spd_ping_table.cc
+++ b/storage/spider/spd_ping_table.cc
@@ -14,7 +14,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#define MYSQL_SERVER 1
-#include <my_global.h>
#include "mysql_version.h"
#if MYSQL_VERSION_ID < 50500
#include "mysql_priv.h"
diff --git a/storage/spider/spd_sys_table.cc b/storage/spider/spd_sys_table.cc
index 7b46889a135..1ff3496d83e 100644
--- a/storage/spider/spd_sys_table.cc
+++ b/storage/spider/spd_sys_table.cc
@@ -14,7 +14,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#define MYSQL_SERVER 1
-#include <my_global.h>
#include "mysql_version.h"
#if MYSQL_VERSION_ID < 50500
#include "mysql_priv.h"
diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc
index b00eb4710a8..bece31d4603 100644
--- a/storage/spider/spd_table.cc
+++ b/storage/spider/spd_table.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2014 Kentoku Shiba
+/* Copyright (C) 2008-2015 Kentoku Shiba
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
@@ -14,7 +14,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#define MYSQL_SERVER 1
-#include <my_global.h>
#include "mysql_version.h"
#if MYSQL_VERSION_ID < 50500
#include "mysql_priv.h"
@@ -772,6 +771,8 @@ int spider_free_share_alloc(
spider_free(spider_current_trx, share->net_write_timeouts, MYF(0));
if (share->access_balances)
spider_free(spider_current_trx, share->access_balances, MYF(0));
+ if (share->bka_table_name_types)
+ spider_free(spider_current_trx, share->bka_table_name_types, MYF(0));
#ifndef WITHOUT_SPIDER_BG_SEARCH
if (share->monitoring_bg_interval)
spider_free(spider_current_trx, share->monitoring_bg_interval, MYF(0));
@@ -1988,6 +1989,8 @@ int spider_parse_connect_info(
SPIDER_PARAM_STR("bke", bka_engine);
SPIDER_PARAM_INT_WITH_MAX("bkm", bka_mode, 0, 2);
SPIDER_PARAM_INT("bsz", bulk_size, 0);
+ SPIDER_PARAM_LONG_LIST_WITH_MAX("btt", bka_table_name_types,
+ 0, 1);
SPIDER_PARAM_INT_WITH_MAX("bum", bulk_update_mode, 0, 2);
SPIDER_PARAM_INT("bus", bulk_update_size, 0);
#ifndef WITHOUT_SPIDER_BG_SEARCH
@@ -2336,6 +2339,8 @@ int spider_parse_connect_info(
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
SPIDER_PARAM_LONGLONG("hs_result_free_size", hs_result_free_size, 0);
#endif
+ SPIDER_PARAM_LONG_LIST_WITH_MAX("bka_table_name_type",
+ bka_table_name_types, 0, 1);
error_num = ER_SPIDER_INVALID_CONNECT_INFO_NUM;
my_printf_error(error_num, ER_SPIDER_INVALID_CONNECT_INFO_STR,
MYF(0), tmp_ptr);
@@ -2483,6 +2488,8 @@ int spider_parse_connect_info(
share->all_link_count = share->net_write_timeouts_length;
if (share->all_link_count < share->access_balances_length)
share->all_link_count = share->access_balances_length;
+ if (share->all_link_count < share->bka_table_name_types_length)
+ share->all_link_count = share->bka_table_name_types_length;
if ((error_num = spider_increase_string_list(
&share->server_names,
&share->server_names_lengths,
@@ -2712,6 +2719,11 @@ int spider_parse_connect_info(
&share->access_balances_length,
share->all_link_count)))
goto error;
+ if ((error_num = spider_increase_long_list(
+ &share->bka_table_name_types,
+ &share->bka_table_name_types_length,
+ share->all_link_count)))
+ goto error;
/* copy for tables start */
share_alter = &share->alter_table;
@@ -3401,6 +3413,8 @@ int spider_set_connect_info_default(
share->net_write_timeouts[roop_count] = 600;
if (share->access_balances[roop_count] == -1)
share->access_balances[roop_count] = 100;
+ if (share->bka_table_name_types[roop_count] == -1)
+ share->bka_table_name_types[roop_count] = 0;
}
#ifndef WITHOUT_SPIDER_BG_SEARCH
@@ -7495,6 +7509,7 @@ void spider_set_tmp_share_pointer(
tmp_share->net_write_timeouts = &tmp_long[13];
tmp_long[13] = -1;
tmp_share->access_balances = &tmp_long[14];
+ tmp_share->bka_table_name_types = &tmp_long[15];
tmp_share->monitoring_limit = &tmp_longlong[0];
tmp_share->monitoring_sid = &tmp_longlong[1];
#ifndef WITHOUT_SPIDER_BG_SEARCH
@@ -7564,6 +7579,7 @@ void spider_set_tmp_share_pointer(
tmp_share->net_read_timeouts_length = 1;
tmp_share->net_write_timeouts_length = 1;
tmp_share->access_balances_length = 1;
+ tmp_share->bka_table_name_types_length = 1;
#ifndef WITHOUT_SPIDER_BG_SEARCH
tmp_share->monitoring_bg_kind[0] = -1;
@@ -7730,6 +7746,7 @@ longlong spider_split_read_param(
DBUG_RETURN(result_list->semi_split_read_base);
}
spider_get_select_limit(spider, &select_lex, &select_limit, &offset_limit);
+ DBUG_PRINT("info",("spider result_list->set_split_read=%s", result_list->set_split_read ? "TRUE" : "FALSE"));
if (!result_list->set_split_read)
{
int bulk_update_mode = spider_param_bulk_update_mode(thd,
@@ -7803,6 +7820,7 @@ longlong spider_split_read_param(
result_list->set_split_read = TRUE;
DBUG_RETURN(9223372036854775807LL);
}
+#ifdef SPIDER_HAS_EXPLAIN_QUERY
Explain_query *explain = thd->lex->explain;
bool filesort = FALSE;
if (explain)
@@ -7827,18 +7845,23 @@ longlong spider_split_read_param(
}
}
}
+#endif
result_list->split_read_base =
spider_param_split_read(thd, share->split_read);
+#ifdef SPIDER_HAS_EXPLAIN_QUERY
if (filesort)
{
result_list->semi_split_read = 0;
result_list->semi_split_read_limit = 9223372036854775807LL;
} else {
+#endif
result_list->semi_split_read =
spider_param_semi_split_read(thd, share->semi_split_read);
result_list->semi_split_read_limit =
spider_param_semi_split_read_limit(thd, share->semi_split_read_limit);
+#ifdef SPIDER_HAS_EXPLAIN_QUERY
}
+#endif
result_list->first_read =
spider_param_first_read(thd, share->first_read);
result_list->second_read =
@@ -7846,6 +7869,11 @@ longlong spider_split_read_param(
result_list->semi_split_read_base = 0;
result_list->set_split_read = TRUE;
}
+ DBUG_PRINT("info",("spider result_list->semi_split_read=%f", result_list->semi_split_read));
+ DBUG_PRINT("info",("spider select_lex->explicit_limit=%d", select_lex ? select_lex->explicit_limit : 0));
+ DBUG_PRINT("info",("spider OPTION_FOUND_ROWS=%s", select_lex && (select_lex->options & OPTION_FOUND_ROWS) ? "TRUE" : "FALSE"));
+ DBUG_PRINT("info",("spider select_lex->group_list.elements=%u", select_lex ? select_lex->group_list.elements : 0));
+ DBUG_PRINT("info",("spider select_lex->with_sum_func=%s", select_lex && select_lex->with_sum_func ? "TRUE" : "FALSE"));
if (
result_list->semi_split_read > 0 &&
select_lex && select_lex->explicit_limit &&
@@ -7932,12 +7960,18 @@ bool spider_check_direct_order_limit(
longlong select_limit;
longlong offset_limit;
DBUG_ENTER("spider_check_direct_order_limit");
+ if (spider_check_index_merge(spider->get_top_table(),
+ spider_get_select_lex(spider)))
+ {
+ DBUG_PRINT("info",("spider set use_index_merge"));
+ spider->use_index_merge = TRUE;
+ }
DBUG_PRINT("info",("spider SQLCOM_HA_READ=%s",
(spider->sql_command == SQLCOM_HA_READ) ? "TRUE" : "FALSE"));
DBUG_PRINT("info",("spider sql_kinds with SPIDER_SQL_KIND_HANDLER=%s",
(spider->sql_kinds & SPIDER_SQL_KIND_HANDLER) ? "TRUE" : "FALSE"));
- DBUG_PRINT("info",("spider has_clone_for_merge=%s",
- spider->has_clone_for_merge ? "TRUE" : "FALSE"));
+ DBUG_PRINT("info",("spider use_index_merge=%s",
+ spider->use_index_merge ? "TRUE" : "FALSE"));
DBUG_PRINT("info",("spider is_clone=%s",
spider->is_clone ? "TRUE" : "FALSE"));
#ifdef HA_CAN_BULK_ACCESS
@@ -7946,7 +7980,7 @@ bool spider_check_direct_order_limit(
#endif
if (
spider->sql_command != SQLCOM_HA_READ &&
- !spider->has_clone_for_merge &&
+ !spider->use_index_merge &&
#ifdef HA_CAN_BULK_ACCESS
(!spider->is_clone || spider->is_bulk_access_clone)
#else
@@ -7958,10 +7992,10 @@ bool spider_check_direct_order_limit(
DBUG_PRINT("info",("spider select_lex=%p", select_lex));
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
DBUG_PRINT("info",("spider leaf_tables.elements=%u",
- select_lex->leaf_tables.elements));
+ select_lex ? select_lex->leaf_tables.elements : 0));
#endif
- if (select_lex->options & SELECT_DISTINCT)
+ if (select_lex && (select_lex->options & SELECT_DISTINCT))
{
DBUG_PRINT("info",("spider with distinct"));
spider->result_list.direct_distinct = TRUE;
@@ -7978,6 +8012,9 @@ bool spider_check_direct_order_limit(
!(thd->variables.optimizer_switch &
OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN) ||
#endif
+#ifdef SPIDER_NEED_CHECK_CONDITION_AT_CHECKING_DIRECT_ORDER_LIMIT
+ !spider->condition ||
+#endif
!select_lex ||
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
select_lex->leaf_tables.elements != 1 ||
@@ -8044,19 +8081,19 @@ bool spider_check_direct_order_limit(
DBUG_PRINT("info",("spider first_check=%s",
first_check ? "TRUE" : "FALSE"));
DBUG_PRINT("info",("spider (select_lex->options & OPTION_FOUND_ROWS)=%s",
- (select_lex->options & OPTION_FOUND_ROWS) ? "TRUE" : "FALSE"));
+ select_lex && (select_lex->options & OPTION_FOUND_ROWS) ? "TRUE" : "FALSE"));
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
DBUG_PRINT("info",("spider direct_aggregate=%s",
spider->result_list.direct_aggregate ? "TRUE" : "FALSE"));
#endif
DBUG_PRINT("info",("spider select_lex->group_list.elements=%u",
- select_lex->group_list.elements));
+ select_lex ? select_lex->group_list.elements : 0));
DBUG_PRINT("info",("spider select_lex->with_sum_func=%s",
- select_lex->with_sum_func ? "TRUE" : "FALSE"));
+ select_lex && select_lex->with_sum_func ? "TRUE" : "FALSE"));
DBUG_PRINT("info",("spider select_lex->having=%s",
- select_lex->having ? "TRUE" : "FALSE"));
+ select_lex && select_lex->having ? "TRUE" : "FALSE"));
DBUG_PRINT("info",("spider select_lex->order_list.elements=%u",
- select_lex->order_list.elements));
+ select_lex ? select_lex->order_list.elements : 0));
if (
!first_check ||
!select_lex->explicit_limit ||
@@ -8098,6 +8135,68 @@ bool spider_check_direct_order_limit(
DBUG_RETURN(FALSE);
}
+bool spider_check_index_merge(
+ TABLE *table,
+ st_select_lex *select_lex
+) {
+ uint roop_count;
+ JOIN *join;
+ DBUG_ENTER("spider_check_index_merge");
+ if (!select_lex)
+ {
+ DBUG_PRINT("info",("spider select_lex is null"));
+ DBUG_RETURN(FALSE);
+ }
+ join = select_lex->join;
+ if (!join)
+ {
+ DBUG_PRINT("info",("spider join is null"));
+ DBUG_RETURN(FALSE);
+ }
+ if (!join->join_tab)
+ {
+ DBUG_PRINT("info",("spider join->join_tab is null"));
+ DBUG_RETURN(FALSE);
+ }
+ for (roop_count = 0; roop_count < spider_join_table_count(join); ++roop_count)
+ {
+ JOIN_TAB *join_tab = &join->join_tab[roop_count];
+ if (join_tab->table == table)
+ {
+ DBUG_PRINT("info",("spider join_tab->type=%u", join_tab->type));
+ if (
+#ifdef SPIDER_HAS_JT_HASH_INDEX_MERGE
+ join_tab->type == JT_HASH_INDEX_MERGE ||
+#endif
+ join_tab->type == JT_INDEX_MERGE
+ ) {
+ DBUG_RETURN(TRUE);
+ }
+/*
+ DBUG_PRINT("info",("spider join_tab->quick->get_type()=%u",
+ join_tab->quick ? join_tab->quick->get_type() : 0));
+ if (
+ join_tab->quick &&
+ join_tab->quick->get_type() == QUICK_SELECT_I::QS_TYPE_INDEX_MERGE
+ ) {
+ DBUG_RETURN(TRUE);
+ }
+*/
+ DBUG_PRINT("info",("spider join_tab->select->quick->get_type()=%u",
+ join_tab->select && join_tab->select->quick ? join_tab->select->quick->get_type() : 0));
+ if (
+ join_tab->select &&
+ join_tab->select->quick &&
+ join_tab->select->quick->get_type() == QUICK_SELECT_I::QS_TYPE_INDEX_MERGE
+ ) {
+ DBUG_RETURN(TRUE);
+ }
+ break;
+ }
+ }
+ DBUG_RETURN(FALSE);
+}
+
int spider_compare_for_sort(
SPIDER_SORT *a,
SPIDER_SORT *b
diff --git a/storage/spider/spd_table.h b/storage/spider/spd_table.h
index 858421444b1..e9d1d5c61c2 100644
--- a/storage/spider/spd_table.h
+++ b/storage/spider/spd_table.h
@@ -414,6 +414,11 @@ bool spider_check_direct_order_limit(
ha_spider *spider
);
+bool spider_check_index_merge(
+ TABLE *table,
+ st_select_lex *select_lex
+);
+
int spider_compare_for_sort(
SPIDER_SORT *a,
SPIDER_SORT *b
diff --git a/storage/spider/spd_trx.cc b/storage/spider/spd_trx.cc
index dd0cc1d3101..a66fa5a7f5d 100644
--- a/storage/spider/spd_trx.cc
+++ b/storage/spider/spd_trx.cc
@@ -14,7 +14,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#define MYSQL_SERVER 1
-#include <my_global.h>
#include "mysql_version.h"
#if MYSQL_VERSION_ID < 50500
#include "mysql_priv.h"
diff --git a/storage/tokudb/CMakeLists.txt b/storage/tokudb/CMakeLists.txt
index 9a257b8da98..57a43930eb7 100644
--- a/storage/tokudb/CMakeLists.txt
+++ b/storage/tokudb/CMakeLists.txt
@@ -25,7 +25,7 @@ IF (HAVE_WVLA)
ENDIF()
############################################
-SET(TOKUDB_VERSION "tokudb-7.5.4")
+SET(TOKUDB_VERSION "tokudb-7.5.7")
SET(TOKUDB_DEB_FILES "usr/lib/mysql/plugin/ha_tokudb.so\netc/mysql/conf.d/tokudb.cnf\nusr/bin/tokuftdump\nusr/share/doc/mariadb-server-10.0/README-TOKUDB\nusr/share/doc/mariadb-server-10.0/README.md" PARENT_SCOPE)
SET(USE_BDB OFF CACHE BOOL "")
MARK_AS_ADVANCED(BUILDNAME)
diff --git a/storage/tokudb/README.md b/storage/tokudb/README.md
index 2ab2e21a5a1..0d4f09d4c86 100644
--- a/storage/tokudb/README.md
+++ b/storage/tokudb/README.md
@@ -30,14 +30,14 @@ working MySQL or MariaDB with Tokutek patches, and with the TokuDB storage
engine, called `make.mysql.bash`. This script will download copies of the
needed source code from github and build everything.
-To build MySQL 5.5.40 with TokuDB 7.5.3:
+To build MySQL 5.5.41 with TokuDB 7.5.5:
```sh
-scripts/make.mysql.bash --mysqlbuild=mysql-5.5.40-tokudb-7.5.3-linux-x86_64
+scripts/make.mysql.bash --mysqlbuild=mysql-5.5.41-tokudb-7.5.5-linux-x86_64
```
-To build MariaDB 5.5.40 with TokuDB 7.5.3:
+To build MariaDB 5.5.41 with TokuDB 7.5.5:
```sh
-scripts/make.mysql.bash --mysqlbuild=mariadb-5.5.40-tokudb-7.5.3-linux-x86_64
+scripts/make.mysql.bash --mysqlbuild=mariadb-5.5.41-tokudb-7.5.5-linux-x86_64
```
Before you start, make sure you have a C++11-compatible compiler (GCC >=
@@ -59,6 +59,7 @@ repositories, run this:
scripts/make.mysql.debug.env.bash
```
+We use gcc from devtoolset-1.1 on CentOS 5.9 for builds.
Contribute
----------
diff --git a/storage/tokudb/doc2/sysbench.update.ma10.tokudb754.loglog.png b/storage/tokudb/doc2/sysbench.update.ma10.tokudb754.loglog.png
index 99b15ff642f..7b2c1c5c66d 100644
--- a/storage/tokudb/doc2/sysbench.update.ma10.tokudb754.loglog.png
+++ b/storage/tokudb/doc2/sysbench.update.ma10.tokudb754.loglog.png
Binary files differ
diff --git a/storage/tokudb/doc2/sysbench.update.ma10.tokudb754.png b/storage/tokudb/doc2/sysbench.update.ma10.tokudb754.png
index 7297013b51f..d46c053c0af 100644
--- a/storage/tokudb/doc2/sysbench.update.ma10.tokudb754.png
+++ b/storage/tokudb/doc2/sysbench.update.ma10.tokudb754.png
Binary files differ
diff --git a/storage/tokudb/ft-index/buildheader/make_tdb.cc b/storage/tokudb/ft-index/buildheader/make_tdb.cc
index 88f8882df78..53706649231 100644
--- a/storage/tokudb/ft-index/buildheader/make_tdb.cc
+++ b/storage/tokudb/ft-index/buildheader/make_tdb.cc
@@ -572,7 +572,7 @@ static void print_db_txn_struct (void) {
STRUCT_SETUP(DB_TXN, abort, "int (*%s) (DB_TXN *)");
STRUCT_SETUP(DB_TXN, api_internal,"void *%s");
STRUCT_SETUP(DB_TXN, commit, "int (*%s) (DB_TXN*, uint32_t)");
- STRUCT_SETUP(DB_TXN, prepare, "int (*%s) (DB_TXN*, uint8_t gid[DB_GID_SIZE])");
+ STRUCT_SETUP(DB_TXN, prepare, "int (*%s) (DB_TXN*, uint8_t gid[DB_GID_SIZE], uint32_t flags)");
STRUCT_SETUP(DB_TXN, discard, "int (*%s) (DB_TXN*, uint32_t)");
STRUCT_SETUP(DB_TXN, id, "uint32_t (*%s) (DB_TXN *)");
STRUCT_SETUP(DB_TXN, mgrp, "DB_ENV *%s /* In TokuFT, mgrp is a DB_ENV, not a DB_TXNMGR */");
@@ -581,11 +581,13 @@ static void print_db_txn_struct (void) {
"int (*txn_stat)(DB_TXN *, struct txn_stat **)",
"int (*commit_with_progress)(DB_TXN*, uint32_t, TXN_PROGRESS_POLL_FUNCTION, void*)",
"int (*abort_with_progress)(DB_TXN*, TXN_PROGRESS_POLL_FUNCTION, void*)",
- "int (*xa_prepare) (DB_TXN*, TOKU_XA_XID *)",
+ "int (*xa_prepare) (DB_TXN*, TOKU_XA_XID *, uint32_t flags)",
"uint64_t (*id64) (DB_TXN*)",
"void (*set_client_id)(DB_TXN *, uint64_t client_id)",
"uint64_t (*get_client_id)(DB_TXN *)",
"bool (*is_prepared)(DB_TXN *)",
+ "DB_TXN *(*get_child)(DB_TXN *)",
+ "uint64_t (*get_start_time)(DB_TXN *)",
NULL};
sort_and_dump_fields("db_txn", false, extra);
}
@@ -614,7 +616,7 @@ static void print_dbc_struct (void) {
"int (*c_getf_set_range_reverse)(DBC *, uint32_t, DBT *, YDB_CALLBACK_FUNCTION, void *)",
"int (*c_getf_set_range_with_bound)(DBC *, uint32_t, DBT *k, DBT *k_bound, YDB_CALLBACK_FUNCTION, void *)",
"int (*c_set_bounds)(DBC*, const DBT*, const DBT*, bool pre_acquire, int out_of_range_error)",
- "void (*c_set_check_interrupt_callback)(DBC*, bool (*)(void*), void *)",
+ "void (*c_set_check_interrupt_callback)(DBC*, bool (*)(void*, uint64_t deleted_rows), void *)",
"void (*c_remove_restriction)(DBC*)",
"char _internal[512]",
NULL};
@@ -785,7 +787,7 @@ int main (int argc, char *const argv[] __attribute__((__unused__))) {
printf("typedef void (*lock_timeout_callback)(DB *db, uint64_t requesting_txnid, const DBT *left_key, const DBT *right_key, uint64_t blocking_txnid);\n");
printf("typedef int (*iterate_row_locks_callback)(DB **db, DBT *left_key, DBT *right_key, void *extra);\n");
- printf("typedef int (*iterate_transactions_callback)(uint64_t txnid, uint64_t client_id, iterate_row_locks_callback cb, void *locks_extra, void *extra);\n");
+ printf("typedef int (*iterate_transactions_callback)(DB_TXN *dbtxn, iterate_row_locks_callback cb, void *locks_extra, void *extra);\n");
printf("typedef int (*iterate_requests_callback)(DB *db, uint64_t requesting_txnid, const DBT *left_key, const DBT *right_key, uint64_t blocking_txnid, uint64_t start_time, void *extra);\n");
print_db_env_struct();
print_db_key_range_struct();
diff --git a/storage/tokudb/ft-index/ft/ft-internal.h b/storage/tokudb/ft-index/ft/ft-internal.h
index 88fc5dca686..4a820d5682b 100644
--- a/storage/tokudb/ft-index/ft/ft-internal.h
+++ b/storage/tokudb/ft-index/ft/ft-internal.h
@@ -655,7 +655,7 @@ int toku_upgrade_msn_from_root_to_header(int fd, FT ft) __attribute__((nonnull))
// When lock_only is true, the callback only does optional lock tree locking.
typedef int (*FT_GET_CALLBACK_FUNCTION)(uint32_t keylen, const void *key, uint32_t vallen, const void *val, void *extra, bool lock_only);
-typedef bool (*FT_CHECK_INTERRUPT_CALLBACK)(void *extra);
+typedef bool (*FT_CHECK_INTERRUPT_CALLBACK)(void *extra, uint64_t deleted_rows);
struct ft_cursor;
int toku_ft_search(FT_HANDLE ft_handle, ft_search *search, FT_GET_CALLBACK_FUNCTION getf, void *getf_v, struct ft_cursor *ftcursor, bool can_bulk_fetch);
diff --git a/storage/tokudb/ft-index/ft/ft-ops.cc b/storage/tokudb/ft-index/ft/ft-ops.cc
index 34c9c46f1c6..b3c224afb7a 100644
--- a/storage/tokudb/ft-index/ft/ft-ops.cc
+++ b/storage/tokudb/ft-index/ft/ft-ops.cc
@@ -3387,7 +3387,7 @@ ok: ;
idx++;
if (idx >= bn->data_buffer.num_klpairs() || ((n_deleted % 64) == 0 && !search_continue(search, key, keylen))) {
STATUS_INC(FT_CURSOR_SKIP_DELETED_LEAF_ENTRY, n_deleted);
- if (ftcursor->interrupt_cb && ftcursor->interrupt_cb(ftcursor->interrupt_cb_extra)) {
+ if (ftcursor->interrupt_cb && ftcursor->interrupt_cb(ftcursor->interrupt_cb_extra, n_deleted)) {
return TOKUDB_INTERRUPTED;
}
return DB_NOTFOUND;
@@ -3396,7 +3396,7 @@ ok: ;
case FT_SEARCH_RIGHT:
if (idx == 0) {
STATUS_INC(FT_CURSOR_SKIP_DELETED_LEAF_ENTRY, n_deleted);
- if (ftcursor->interrupt_cb && ftcursor->interrupt_cb(ftcursor->interrupt_cb_extra)) {
+ if (ftcursor->interrupt_cb && ftcursor->interrupt_cb(ftcursor->interrupt_cb_extra, n_deleted)) {
return TOKUDB_INTERRUPTED;
}
return DB_NOTFOUND;
@@ -3410,6 +3410,8 @@ ok: ;
assert_zero(r); // we just validated the index
if (!le_val_is_del(le, ftcursor->is_snapshot_read, ftcursor->ttxn)) {
STATUS_INC(FT_CURSOR_SKIP_DELETED_LEAF_ENTRY, n_deleted);
+ if (ftcursor->interrupt_cb)
+ ftcursor->interrupt_cb(ftcursor->interrupt_cb_extra, n_deleted);
goto got_a_good_value;
}
}
diff --git a/storage/tokudb/ft-index/ft/ft-verify.cc b/storage/tokudb/ft-index/ft/ft-verify.cc
index d9606f37604..0a85136816f 100644
--- a/storage/tokudb/ft-index/ft/ft-verify.cc
+++ b/storage/tokudb/ft-index/ft/ft-verify.cc
@@ -160,10 +160,14 @@ get_ith_key_dbt (BASEMENTNODE bn, int i) {
#define VERIFY_ASSERTION(predicate, i, string) ({ \
if(!(predicate)) { \
- (void) verbose; \
- if (true) { \
- fprintf(stderr, "%s:%d: Looking at child %d of block %" PRId64 ": %s\n", __FILE__, __LINE__, i, blocknum.b, string); \
- } \
+ fprintf(stderr, "%s:%d: Looking at child %d of block %" PRId64 ": %s\n", __FILE__, __LINE__, i, blocknum.b, string); \
+ result = TOKUDB_NEEDS_REPAIR; \
+ if (!keep_going_on_failure) goto done; \
+ }})
+
+#define VERIFY_ASSERTION_BASEMENT(predicate, bn, entry, string) ({ \
+ if(!(predicate)) { \
+ fprintf(stderr, "%s:%d: Looking at block %" PRId64 " bn %d entry %d: %s\n", __FILE__, __LINE__, blocknum.b, bn, entry, string); \
result = TOKUDB_NEEDS_REPAIR; \
if (!keep_going_on_failure) goto done; \
}})
@@ -201,7 +205,6 @@ struct verify_message_tree_extra {
int verify_message_tree(const int32_t &offset, const uint32_t UU(idx), struct verify_message_tree_extra *const e) __attribute__((nonnull(3)));
int verify_message_tree(const int32_t &offset, const uint32_t UU(idx), struct verify_message_tree_extra *const e)
{
- int verbose = e->verbose;
BLOCKNUM blocknum = e->blocknum;
int keep_going_on_failure = e->keep_going_on_failure;
int result = 0;
@@ -236,7 +239,6 @@ int error_on_iter(const int32_t &UU(offset), const uint32_t UU(idx), void *UU(e)
int verify_marked_messages(const int32_t &offset, const uint32_t UU(idx), struct verify_message_tree_extra *const e) __attribute__((nonnull(3)));
int verify_marked_messages(const int32_t &offset, const uint32_t UU(idx), struct verify_message_tree_extra *const e)
{
- int verbose = e->verbose;
BLOCKNUM blocknum = e->blocknum;
int keep_going_on_failure = e->keep_going_on_failure;
int result = 0;
@@ -462,16 +464,16 @@ toku_verify_ftnode_internal(FT_HANDLE ft_handle,
DBT kdbt = get_ith_key_dbt(bn, j);
if (curr_less_pivot) {
int compare = compare_pairs(ft_handle, curr_less_pivot, &kdbt);
- VERIFY_ASSERTION(compare < 0, j, "The leafentry is >= the lower-bound pivot");
+ VERIFY_ASSERTION_BASEMENT(compare < 0, i, j, "The leafentry is >= the lower-bound pivot");
}
if (curr_geq_pivot) {
int compare = compare_pairs(ft_handle, curr_geq_pivot, &kdbt);
- VERIFY_ASSERTION(compare >= 0, j, "The leafentry is < the upper-bound pivot");
+ VERIFY_ASSERTION_BASEMENT(compare >= 0, i, j, "The leafentry is < the upper-bound pivot");
}
if (0 < j) {
DBT prev_key_dbt = get_ith_key_dbt(bn, j-1);
int compare = compare_pairs(ft_handle, &prev_key_dbt, &kdbt);
- VERIFY_ASSERTION(compare < 0, j, "Adjacent leafentries are out of order");
+ VERIFY_ASSERTION_BASEMENT(compare < 0, i, j, "Adjacent leafentries are out of order");
}
}
}
diff --git a/storage/tokudb/ft-index/ft/ft.cc b/storage/tokudb/ft-index/ft/ft.cc
index bf99646351a..77948dfe358 100644
--- a/storage/tokudb/ft-index/ft/ft.cc
+++ b/storage/tokudb/ft-index/ft/ft.cc
@@ -1064,6 +1064,11 @@ garbage_helper(BLOCKNUM blocknum, int64_t UU(size), int64_t UU(address), void *e
goto exit;
}
}
+ {
+ float a = info->used_space, b=info->total_space;
+ float percentage = (1 - (a / b)) * 100;
+ printf("LeafNode# %d has %d BasementNodes and %2.1f%% of the allocated space is garbage\n", (int)blocknum.b, node->n_children, percentage);
+ }
exit:
toku_ftnode_free(&node);
toku_free(ndd);
diff --git a/storage/tokudb/ft-index/ft/logger/recover.cc b/storage/tokudb/ft-index/ft/logger/recover.cc
index 8dd7bf87624..680485201da 100644
--- a/storage/tokudb/ft-index/ft/logger/recover.cc
+++ b/storage/tokudb/ft-index/ft/logger/recover.cc
@@ -111,7 +111,8 @@ int tokuft_recovery_trace = 0; // turn on recovery tracing, d
#endif
// time in seconds between recovery progress reports
-#define TOKUDB_RECOVERY_PROGRESS_TIME 15
+#define TOKUFT_RECOVERY_PROGRESS_TIME 15
+time_t tokuft_recovery_progress_time = TOKUFT_RECOVERY_PROGRESS_TIME;
enum ss {
BACKWARD_NEWER_CHECKPOINT_END = 1,
@@ -325,14 +326,12 @@ static int recover_env_init (RECOVER_ENV renv,
}
static void recover_env_cleanup (RECOVER_ENV renv) {
- int r;
-
invariant_zero(renv->fmap.filenums->size());
file_map_destroy(&renv->fmap);
if (renv->destroy_logger_at_end) {
toku_logger_close_rollback(renv->logger);
- r = toku_logger_close(&renv->logger);
+ int r = toku_logger_close(&renv->logger);
assert(r == 0);
} else {
toku_logger_write_log_files(renv->logger, true);
@@ -714,7 +713,7 @@ static int toku_recover_xstillopenprepared (struct logtype_xstillopenprepared *l
}
switch (renv->ss.ss) {
case FORWARD_BETWEEN_CHECKPOINT_BEGIN_END: {
- toku_txn_prepare_txn(txn, l->xa_xid);
+ toku_txn_prepare_txn(txn, l->xa_xid, 0);
break;
}
case FORWARD_NEWER_CHECKPOINT_END: {
@@ -749,6 +748,36 @@ static int toku_recover_backward_xbegin (struct logtype_xbegin *UU(l), RECOVER_E
return 0;
}
+struct toku_txn_progress_extra {
+ time_t tlast;
+ LSN lsn;
+ const char *type;
+ TXNID_PAIR xid;
+ uint64_t last_total;
+};
+
+static void toku_recover_txn_progress(TOKU_TXN_PROGRESS txn_progress, void *extra) {
+ toku_txn_progress_extra *txn_progress_extra = static_cast<toku_txn_progress_extra *>(extra);
+ if (txn_progress_extra->last_total == 0)
+ txn_progress_extra->last_total = txn_progress->entries_total;
+ else
+ assert(txn_progress_extra->last_total == txn_progress->entries_total);
+ time_t tnow = time(NULL);
+ if (tnow - txn_progress_extra->tlast >= tokuft_recovery_progress_time) {
+ txn_progress_extra->tlast = tnow;
+ fprintf(stderr, "%.24s TokuFT ", ctime(&tnow));
+ if (txn_progress_extra->lsn.lsn != 0)
+ fprintf(stderr, "lsn %" PRIu64 " ", txn_progress_extra->lsn.lsn);
+ fprintf(stderr, "%s xid %" PRIu64 ":%" PRIu64 " ",
+ txn_progress_extra->type, txn_progress_extra->xid.parent_id64, txn_progress_extra->xid.child_id64);
+ fprintf(stderr, "%" PRIu64 "/%" PRIu64 " ",
+ txn_progress->entries_processed, txn_progress->entries_total);
+ if (txn_progress->entries_total > 0)
+ fprintf(stderr, "%.0f%% ", ((double) txn_progress->entries_processed / (double) txn_progress->entries_total) * 100.0);
+ fprintf(stderr, "\n");
+ }
+}
+
static int toku_recover_xcommit (struct logtype_xcommit *l, RECOVER_ENV renv) {
// find the transaction by transaction id
TOKUTXN txn = NULL;
@@ -756,8 +785,8 @@ static int toku_recover_xcommit (struct logtype_xcommit *l, RECOVER_ENV renv) {
assert(txn!=NULL);
// commit the transaction
- int r = toku_txn_commit_with_lsn(txn, true, l->lsn,
- NULL, NULL);
+ toku_txn_progress_extra extra = { time(NULL), l->lsn, "commit", l->xid };
+ int r = toku_txn_commit_with_lsn(txn, true, l->lsn, toku_recover_txn_progress, &extra);
assert(r == 0);
// close the transaction
@@ -778,7 +807,7 @@ static int toku_recover_xprepare (struct logtype_xprepare *l, RECOVER_ENV renv)
assert(txn!=NULL);
// Save the transaction
- toku_txn_prepare_txn(txn, l->xa_xid);
+ toku_txn_prepare_txn(txn, l->xa_xid, 0);
return 0;
}
@@ -799,7 +828,8 @@ static int toku_recover_xabort (struct logtype_xabort *l, RECOVER_ENV renv) {
assert(txn!=NULL);
// abort the transaction
- r = toku_txn_abort_with_lsn(txn, l->lsn, NULL, NULL);
+ toku_txn_progress_extra extra = { time(NULL), l->lsn, "abort", l->xid };
+ r = toku_txn_abort_with_lsn(txn, l->lsn, toku_recover_txn_progress, &extra);
assert(r == 0);
// close the transaction
@@ -1301,7 +1331,6 @@ static int is_txn_unprepared(TOKUTXN txn, void* extra) {
return 0;
}
-
static int find_an_unprepared_txn (RECOVER_ENV renv, TOKUTXN *txnp) {
TOKUTXN txn = nullptr;
int r = toku_txn_manager_iter_over_live_root_txns(
@@ -1326,6 +1355,7 @@ static int call_prepare_txn_callback_iter(TOKUTXN txn, void* extra) {
}
static void recover_abort_live_txn(TOKUTXN txn) {
+ fprintf(stderr, "%s %" PRIu64 "\n", __FUNCTION__, txn->txnid.parent_id64);
// recursively abort all children first
if (txn->child != NULL) {
recover_abort_live_txn(txn->child);
@@ -1333,7 +1363,8 @@ static void recover_abort_live_txn(TOKUTXN txn) {
// sanity check that the recursive call successfully NULLs out txn->child
invariant(txn->child == NULL);
// abort the transaction
- int r = toku_txn_abort_txn(txn, NULL, NULL);
+ toku_txn_progress_extra extra = { time(NULL), ZERO_LSN, "abort live", txn->txnid };
+ int r = toku_txn_abort_txn(txn, toku_recover_txn_progress, &extra);
assert(r == 0);
// close the transaction
@@ -1451,9 +1482,10 @@ static int do_recovery(RECOVER_ENV renv, const char *env_dir, const char *log_di
// trace progress
if ((i % 1000) == 0) {
tnow = time(NULL);
- if (tnow - tlast >= TOKUDB_RECOVERY_PROGRESS_TIME) {
+ if (tnow - tlast >= tokuft_recovery_progress_time) {
thislsn = toku_log_entry_get_lsn(le);
- fprintf(stderr, "%.24s TokuFT recovery scanning backward from %" PRIu64 " at %" PRIu64 " (%s)\n", ctime(&tnow), lastlsn.lsn, thislsn.lsn, recover_state(renv));
+ fprintf(stderr, "%.24s TokuFT recovery scanning backward from %" PRIu64 " at %" PRIu64 " (%s)\n",
+ ctime(&tnow), lastlsn.lsn, thislsn.lsn, recover_state(renv));
tlast = tnow;
}
}
@@ -1482,16 +1514,18 @@ static int do_recovery(RECOVER_ENV renv, const char *env_dir, const char *log_di
assert(le);
thislsn = toku_log_entry_get_lsn(le);
tnow = time(NULL);
- fprintf(stderr, "%.24s TokuFT recovery starts scanning forward to %" PRIu64 " from %" PRIu64 " left %" PRIu64 " (%s)\n", ctime(&tnow), lastlsn.lsn, thislsn.lsn, lastlsn.lsn - thislsn.lsn, recover_state(renv));
+ fprintf(stderr, "%.24s TokuFT recovery starts scanning forward to %" PRIu64 " from %" PRIu64 " left %" PRIu64 " (%s)\n",
+ ctime(&tnow), lastlsn.lsn, thislsn.lsn, lastlsn.lsn - thislsn.lsn, recover_state(renv));
for (unsigned i=0; 1; i++) {
// trace progress
if ((i % 1000) == 0) {
tnow = time(NULL);
- if (tnow - tlast >= TOKUDB_RECOVERY_PROGRESS_TIME) {
+ if (tnow - tlast >= tokuft_recovery_progress_time) {
thislsn = toku_log_entry_get_lsn(le);
- fprintf(stderr, "%.24s TokuFT recovery scanning forward to %" PRIu64 " at %" PRIu64 " left %" PRIu64 " (%s)\n", ctime(&tnow), lastlsn.lsn, thislsn.lsn, lastlsn.lsn - thislsn.lsn, recover_state(renv));
+ fprintf(stderr, "%.24s TokuFT recovery scanning forward to %" PRIu64 " at %" PRIu64 " left %" PRIu64 " (%s)\n",
+ ctime(&tnow), lastlsn.lsn, thislsn.lsn, lastlsn.lsn - thislsn.lsn, recover_state(renv));
tlast = tnow;
}
}
diff --git a/storage/tokudb/ft-index/ft/txn/txn.cc b/storage/tokudb/ft-index/ft/txn/txn.cc
index 216cb0d8dfd..922c955a6b5 100644
--- a/storage/tokudb/ft-index/ft/txn/txn.cc
+++ b/storage/tokudb/ft-index/ft/txn/txn.cc
@@ -344,6 +344,7 @@ static txn_child_manager tcm;
.state = TOKUTXN_LIVE,
.num_pin = 0,
.client_id = 0,
+ .start_time = time(NULL),
};
TOKUTXN result = NULL;
@@ -558,7 +559,7 @@ static void copy_xid (TOKU_XA_XID *dest, TOKU_XA_XID *source) {
memcpy(dest->data, source->data, source->gtrid_length+source->bqual_length);
}
-void toku_txn_prepare_txn (TOKUTXN txn, TOKU_XA_XID *xa_xid) {
+void toku_txn_prepare_txn (TOKUTXN txn, TOKU_XA_XID *xa_xid, int nosync) {
if (txn->parent || toku_txn_is_read_only(txn)) {
// We do not prepare children.
//
@@ -573,7 +574,7 @@ void toku_txn_prepare_txn (TOKUTXN txn, TOKU_XA_XID *xa_xid) {
txn->state = TOKUTXN_PREPARING;
toku_txn_unlock_state(txn);
// Do we need to do an fsync?
- txn->do_fsync = (txn->force_fsync_on_commit || txn->roll_info.num_rollentries>0);
+ txn->do_fsync = txn->force_fsync_on_commit || (!nosync && txn->roll_info.num_rollentries>0);
copy_xid(&txn->xa_xid, xa_xid);
// This list will go away with #4683, so we wn't need the ydb lock for this anymore.
toku_log_xprepare(txn->logger, &txn->do_fsync_lsn, 0, txn, txn->txnid, xa_xid);
@@ -787,6 +788,10 @@ void toku_txn_set_client_id(TOKUTXN txn, uint64_t client_id) {
txn->client_id = client_id;
}
+time_t toku_txn_get_start_time(struct tokutxn *txn) {
+ return txn->start_time;
+}
+
int toku_txn_reads_txnid(TXNID txnid, TOKUTXN txn) {
int r = 0;
TXNID oldest_live_in_snapshot = toku_get_oldest_in_live_root_txn_list(txn);
diff --git a/storage/tokudb/ft-index/ft/txn/txn.h b/storage/tokudb/ft-index/ft/txn/txn.h
index c458df3b5b2..4f2778bf858 100644
--- a/storage/tokudb/ft-index/ft/txn/txn.h
+++ b/storage/tokudb/ft-index/ft/txn/txn.h
@@ -253,6 +253,7 @@ struct tokutxn {
uint32_t num_pin; // number of threads (all hot indexes) that want this
// txn to not transition to commit or abort
uint64_t client_id;
+ time_t start_time;
};
typedef struct tokutxn *TOKUTXN;
@@ -302,7 +303,7 @@ int toku_txn_abort_with_lsn(struct tokutxn *txn, LSN oplsn,
int toku_txn_discard_txn(struct tokutxn *txn);
-void toku_txn_prepare_txn (struct tokutxn *txn, TOKU_XA_XID *xid);
+void toku_txn_prepare_txn (struct tokutxn *txn, TOKU_XA_XID *xid, int nosync);
// Effect: Do the internal work of preparing a transaction (does not log the prepare record).
void toku_txn_get_prepared_xa_xid(struct tokutxn *txn, TOKU_XA_XID *xa_xid);
@@ -368,6 +369,8 @@ bool toku_txn_has_spilled_rollback(struct tokutxn *txn);
uint64_t toku_txn_get_client_id(struct tokutxn *txn);
void toku_txn_set_client_id(struct tokutxn *txn, uint64_t client_id);
+time_t toku_txn_get_start_time(struct tokutxn *txn);
+
//
// This function is used by the leafentry iterators.
// returns TOKUDB_ACCEPT if live transaction context is allowed to read a value
diff --git a/storage/tokudb/ft-index/src/tests/recover-5146.cc b/storage/tokudb/ft-index/src/tests/recover-5146.cc
index c05f9effa7d..5e793830f1d 100644
--- a/storage/tokudb/ft-index/src/tests/recover-5146.cc
+++ b/storage/tokudb/ft-index/src/tests/recover-5146.cc
@@ -147,7 +147,7 @@ run_test(void) {
uint8_t gid[DB_GID_SIZE];
memset(gid, 0, DB_GID_SIZE);
gid[0]=42;
- r = txn->prepare(txn, gid); CKERR(r);
+ r = txn->prepare(txn, gid, 0); CKERR(r);
}
r = env->txn_checkpoint(env, 0, 0, 0); CKERR(r);
diff --git a/storage/tokudb/ft-index/src/tests/test-prepare.cc b/storage/tokudb/ft-index/src/tests/test-prepare.cc
index 9033c633ea7..73d2105fa86 100644
--- a/storage/tokudb/ft-index/src/tests/test-prepare.cc
+++ b/storage/tokudb/ft-index/src/tests/test-prepare.cc
@@ -122,7 +122,7 @@ static void setup_env_and_prepare (DB_ENV **envp, const char *envdir, bool commi
uint8_t gid[DB_GID_SIZE];
memset(gid, 0, DB_GID_SIZE);
gid[0]=42;
- CKERR(txn->prepare(txn, gid));
+ CKERR(txn->prepare(txn, gid, 0));
if (commit)
CKERR(txn->commit(txn, 0));
}
diff --git a/storage/tokudb/ft-index/src/tests/test-prepare2.cc b/storage/tokudb/ft-index/src/tests/test-prepare2.cc
index 8952f14cf31..12d78e4da7c 100644
--- a/storage/tokudb/ft-index/src/tests/test-prepare2.cc
+++ b/storage/tokudb/ft-index/src/tests/test-prepare2.cc
@@ -124,7 +124,7 @@ static void setup_env_and_prepare (DB_ENV **envp, const char *envdir, bool commi
uint8_t gid[DB_GID_SIZE];
memset(gid, 0, DB_GID_SIZE);
gid[0]=42;
- CKERR(txn->prepare(txn, gid));
+ CKERR(txn->prepare(txn, gid, 0));
if (commit)
CKERR(txn->commit(txn, 0));
}
diff --git a/storage/tokudb/ft-index/src/tests/test-prepare3.cc b/storage/tokudb/ft-index/src/tests/test-prepare3.cc
index 3643d73f41a..30c5c728e94 100644
--- a/storage/tokudb/ft-index/src/tests/test-prepare3.cc
+++ b/storage/tokudb/ft-index/src/tests/test-prepare3.cc
@@ -147,7 +147,7 @@ static void setup_env_and_prepare (DB_ENV **envp, const char *envdir) {
uint8_t gid[DB_GID_SIZE];
memset(gid, 0, DB_GID_SIZE);
gid[0]='a'+tnum;
- CKERR(txn->prepare(txn, gid));
+ CKERR(txn->prepare(txn, gid, 0));
// Drop txn on the ground, since we will commit or abort it after recovery
if (tnum==0) {
//printf("commit %d\n", tnum);
diff --git a/storage/tokudb/ft-index/src/tests/test-xa-prepare.cc b/storage/tokudb/ft-index/src/tests/test-xa-prepare.cc
index e08e7361555..d3b1352f55d 100644
--- a/storage/tokudb/ft-index/src/tests/test-xa-prepare.cc
+++ b/storage/tokudb/ft-index/src/tests/test-xa-prepare.cc
@@ -125,7 +125,7 @@ static void setup_env_and_prepare (DB_ENV **envp, const char *envdir, bool commi
.gtrid_length = 8,
.bqual_length = 9};
for (int i=0; i<8+9; i++) x.data[i] = 42+i;
- CKERR(txn->xa_prepare(txn, &x));
+ CKERR(txn->xa_prepare(txn, &x, 0));
if (commit)
CKERR(txn->commit(txn, 0));
}
diff --git a/storage/tokudb/ft-index/src/tests/test5092.cc b/storage/tokudb/ft-index/src/tests/test5092.cc
index 16652472b55..8ef31ae0340 100644
--- a/storage/tokudb/ft-index/src/tests/test5092.cc
+++ b/storage/tokudb/ft-index/src/tests/test5092.cc
@@ -118,7 +118,7 @@ static void setup_env_and_prepare (DB_ENV **envp, const char *envdir, bool commi
uint8_t gid[DB_GID_SIZE];
memset(gid, 0, DB_GID_SIZE);
gid[0]=42;
- CKERR(txn->prepare(txn, gid));
+ CKERR(txn->prepare(txn, gid, 0));
{ int chk_r = db->close(db, 0); CKERR(chk_r); }
if (commit)
CKERR(txn->commit(txn, 0));
diff --git a/storage/tokudb/ft-index/src/tests/test_5015.cc b/storage/tokudb/ft-index/src/tests/test_5015.cc
index 071b7f3660e..50900d342d0 100644
--- a/storage/tokudb/ft-index/src/tests/test_5015.cc
+++ b/storage/tokudb/ft-index/src/tests/test_5015.cc
@@ -133,7 +133,7 @@ test_main(int argc, char *const argv[]) {
uint8_t gid[DB_GID_SIZE];
memset(gid, 0, DB_GID_SIZE);
gid[0]='a';
- r = child_txn->prepare(child_txn, gid);
+ r = child_txn->prepare(child_txn, gid, 0);
CKERR(r);
r = env->txn_checkpoint(env, 0, 0, 0);
diff --git a/storage/tokudb/ft-index/src/tests/test_cursor_interrupt.cc b/storage/tokudb/ft-index/src/tests/test_cursor_interrupt.cc
index e992f86455b..5583b0283a6 100644
--- a/storage/tokudb/ft-index/src/tests/test_cursor_interrupt.cc
+++ b/storage/tokudb/ft-index/src/tests/test_cursor_interrupt.cc
@@ -95,12 +95,12 @@ PATENT RIGHTS GRANT:
int num_interrupts_called;
-static bool interrupt(void* extra UU()) {
+static bool interrupt(void* extra UU(), uint64_t rows UU()) {
num_interrupts_called++;
return false;
}
-static bool interrupt_true(void* extra UU()) {
+static bool interrupt_true(void* extra UU(), uint64_t rows UU()) {
num_interrupts_called++;
return true;
}
diff --git a/storage/tokudb/ft-index/src/tests/test_iterate_live_transactions.cc b/storage/tokudb/ft-index/src/tests/test_iterate_live_transactions.cc
index dd00ddeeb9a..c104c5c8541 100644
--- a/storage/tokudb/ft-index/src/tests/test_iterate_live_transactions.cc
+++ b/storage/tokudb/ft-index/src/tests/test_iterate_live_transactions.cc
@@ -104,9 +104,11 @@ struct iterate_extra {
bool visited_txn[3];
};
-static int iterate_callback(uint64_t txnid, uint64_t client_id,
+static int iterate_callback(DB_TXN *txn,
iterate_row_locks_callback iterate_locks,
void *locks_extra, void *extra) {
+ uint64_t txnid = txn->id64(txn);
+ uint64_t client_id = txn->get_client_id(txn);
iterate_extra *info = reinterpret_cast<iterate_extra *>(extra);
DB *db;
DBT left_key, right_key;
diff --git a/storage/tokudb/ft-index/src/tests/test_stress0.cc b/storage/tokudb/ft-index/src/tests/test_stress0.cc
index 5dbca08db48..26192d851aa 100644
--- a/storage/tokudb/ft-index/src/tests/test_stress0.cc
+++ b/storage/tokudb/ft-index/src/tests/test_stress0.cc
@@ -140,9 +140,11 @@ static int UU() iterate_pending_lock_requests_op(DB_TXN *UU(txn), ARG arg, void
return r;
}
-static int iterate_txns(uint64_t txnid, uint64_t client_id,
+static int iterate_txns(DB_TXN *txn,
iterate_row_locks_callback iterate_locks,
void *locks_extra, void *extra) {
+ uint64_t txnid = txn->id64(txn);
+ uint64_t client_id = txn->get_client_id(txn);
invariant_null(extra);
invariant(txnid > 0);
invariant(client_id == 0);
diff --git a/storage/tokudb/ft-index/src/tests/test_stress_hot_indexing.cc b/storage/tokudb/ft-index/src/tests/test_stress_hot_indexing.cc
index fe237f063ab..d70f0411e01 100644
--- a/storage/tokudb/ft-index/src/tests/test_stress_hot_indexing.cc
+++ b/storage/tokudb/ft-index/src/tests/test_stress_hot_indexing.cc
@@ -211,7 +211,7 @@ cleanup:
gid_count++;
uint32_t *hi_gid_count_p = cast_to_typeof(hi_gid_count_p) hi_gid; // make gcc --happy about -Wstrict-aliasing
*hi_gid_count_p = gid_count;
- int rr = hi_txn->prepare(hi_txn, hi_gid);
+ int rr = hi_txn->prepare(hi_txn, hi_gid, 0);
CKERR(rr);
if (r || (random() % 2)) {
rr = hi_txn->abort(hi_txn);
diff --git a/storage/tokudb/ft-index/src/tests/test_txn_close_before_prepare_commit.cc b/storage/tokudb/ft-index/src/tests/test_txn_close_before_prepare_commit.cc
index e3b715c4ce7..31267b17686 100644
--- a/storage/tokudb/ft-index/src/tests/test_txn_close_before_prepare_commit.cc
+++ b/storage/tokudb/ft-index/src/tests/test_txn_close_before_prepare_commit.cc
@@ -130,7 +130,7 @@ test_txn_close_before_prepare_commit (void) {
uint8_t gid[DB_GID_SIZE];
memset(gid, 1, DB_GID_SIZE);
- r = txn->prepare(txn, gid); assert(r == 0);
+ r = txn->prepare(txn, gid, 0); assert(r == 0);
r = txn->commit(txn, 0); assert(r == 0);
r = env->close(env, 0); assert(r == 0);
diff --git a/storage/tokudb/ft-index/src/tests/threaded_stress_test_helpers.h b/storage/tokudb/ft-index/src/tests/threaded_stress_test_helpers.h
index 2c2525a3165..f9da1693847 100644
--- a/storage/tokudb/ft-index/src/tests/threaded_stress_test_helpers.h
+++ b/storage/tokudb/ft-index/src/tests/threaded_stress_test_helpers.h
@@ -593,7 +593,7 @@ static void *worker(void *arg_v) {
uint64_t gid_val = txn->id64(txn);
uint64_t *gid_count_p = cast_to_typeof(gid_count_p) gid; // make gcc --happy about -Wstrict-aliasing
*gid_count_p = gid_val;
- int rr = txn->prepare(txn, gid);
+ int rr = txn->prepare(txn, gid, 0);
assert_zero(rr);
}
if (r == 0) {
diff --git a/storage/tokudb/ft-index/src/tests/xa-dirty-commit.cc b/storage/tokudb/ft-index/src/tests/xa-dirty-commit.cc
index 126a7c1453e..008a41274ae 100644
--- a/storage/tokudb/ft-index/src/tests/xa-dirty-commit.cc
+++ b/storage/tokudb/ft-index/src/tests/xa-dirty-commit.cc
@@ -136,7 +136,7 @@ static void create_prepared_txn(void) {
for (int i = 0; i < 8+9; i++) {
xid.data[i] = i;
}
- r = txn->xa_prepare(txn, &xid);
+ r = txn->xa_prepare(txn, &xid, 0);
CKERR(r);
// discard the txn so that we can close the env and run xa recovery later
diff --git a/storage/tokudb/ft-index/src/tests/xa-dirty-rollback.cc b/storage/tokudb/ft-index/src/tests/xa-dirty-rollback.cc
index 2d13e559050..3f0debe4116 100644
--- a/storage/tokudb/ft-index/src/tests/xa-dirty-rollback.cc
+++ b/storage/tokudb/ft-index/src/tests/xa-dirty-rollback.cc
@@ -136,7 +136,7 @@ static void create_prepared_txn(void) {
for (int i = 0; i < 8+9; i++) {
xid.data[i] = i;
}
- r = txn->xa_prepare(txn, &xid);
+ r = txn->xa_prepare(txn, &xid, 0);
CKERR(r);
// discard the txn so that we can close the env and run xa recovery later
diff --git a/storage/tokudb/ft-index/src/tests/xa-txn-discard-abort.cc b/storage/tokudb/ft-index/src/tests/xa-txn-discard-abort.cc
index 3365a1bb139..95852c68192 100644
--- a/storage/tokudb/ft-index/src/tests/xa-txn-discard-abort.cc
+++ b/storage/tokudb/ft-index/src/tests/xa-txn-discard-abort.cc
@@ -138,7 +138,7 @@ static void create_prepared_txn(void) {
for (int i = 0; i < 8+9; i++) {
xid.data[i] = i;
}
- r = txn->xa_prepare(txn, &xid);
+ r = txn->xa_prepare(txn, &xid, 0);
CKERR(r);
// discard the txn so that we can close the env and run xa recovery later
diff --git a/storage/tokudb/ft-index/src/tests/xa-txn-discard-commit.cc b/storage/tokudb/ft-index/src/tests/xa-txn-discard-commit.cc
index c4d164017ae..a21f8813f90 100644
--- a/storage/tokudb/ft-index/src/tests/xa-txn-discard-commit.cc
+++ b/storage/tokudb/ft-index/src/tests/xa-txn-discard-commit.cc
@@ -139,7 +139,7 @@ static void create_prepared_txn(void) {
for (int i = 0; i < 8+9; i++) {
xid.data[i] = i;
}
- r = txn->xa_prepare(txn, &xid);
+ r = txn->xa_prepare(txn, &xid, 0);
CKERR(r);
// discard the txn so that we can close the env and run xa recovery later
diff --git a/storage/tokudb/ft-index/src/ydb.cc b/storage/tokudb/ft-index/src/ydb.cc
index 85445a67eef..ab15a44489e 100644
--- a/storage/tokudb/ft-index/src/ydb.cc
+++ b/storage/tokudb/ft-index/src/ydb.cc
@@ -2492,24 +2492,21 @@ struct iter_txns_callback_extra {
};
static int iter_txns_callback(TOKUTXN txn, void *extra) {
+ int r = 0;
iter_txns_callback_extra *info =
reinterpret_cast<iter_txns_callback_extra *>(extra);
-
DB_TXN *dbtxn = toku_txn_get_container_db_txn(txn);
invariant_notnull(dbtxn);
+ if (db_txn_struct_i(dbtxn)->tokutxn == txn) { // make sure that the dbtxn is fully initialized
+ toku_mutex_lock(&db_txn_struct_i(dbtxn)->txn_mutex);
+ toku_pthread_rwlock_rdlock(&info->env->i->open_dbs_rwlock);
- toku_mutex_lock(&db_txn_struct_i(dbtxn)->txn_mutex);
- toku_pthread_rwlock_rdlock(&info->env->i->open_dbs_rwlock);
-
- iter_txn_row_locks_callback_extra e(info->env, &db_txn_struct_i(dbtxn)->lt_map);
- const int r = info->callback(toku_txn_get_txnid(txn).parent_id64,
- toku_txn_get_client_id(txn),
- iter_txn_row_locks_callback,
- &e,
- info->extra);
+ iter_txn_row_locks_callback_extra e(info->env, &db_txn_struct_i(dbtxn)->lt_map);
+ r = info->callback(dbtxn, iter_txn_row_locks_callback, &e, info->extra);
- toku_pthread_rwlock_rdunlock(&info->env->i->open_dbs_rwlock);
- toku_mutex_unlock(&db_txn_struct_i(dbtxn)->txn_mutex);
+ toku_pthread_rwlock_rdunlock(&info->env->i->open_dbs_rwlock);
+ toku_mutex_unlock(&db_txn_struct_i(dbtxn)->txn_mutex);
+ }
return r;
}
diff --git a/storage/tokudb/ft-index/src/ydb_cursor.cc b/storage/tokudb/ft-index/src/ydb_cursor.cc
index 57f3b5808b6..eed519455fc 100644
--- a/storage/tokudb/ft-index/src/ydb_cursor.cc
+++ b/storage/tokudb/ft-index/src/ydb_cursor.cc
@@ -769,7 +769,7 @@ c_remove_restriction(DBC *dbc) {
}
static void
-c_set_check_interrupt_callback(DBC* dbc, bool (*interrupt_callback)(void*), void *extra) {
+c_set_check_interrupt_callback(DBC* dbc, bool (*interrupt_callback)(void*, uint64_t), void *extra) {
toku_ft_cursor_set_check_interrupt_cb(dbc_ftcursor(dbc), interrupt_callback, extra);
}
diff --git a/storage/tokudb/ft-index/src/ydb_txn.cc b/storage/tokudb/ft-index/src/ydb_txn.cc
index ce06e78b23f..885c6b713b2 100644
--- a/storage/tokudb/ft-index/src/ydb_txn.cc
+++ b/storage/tokudb/ft-index/src/ydb_txn.cc
@@ -240,7 +240,7 @@ static int toku_txn_abort(DB_TXN * txn,
return r;
}
-static int toku_txn_xa_prepare (DB_TXN *txn, TOKU_XA_XID *xid) {
+static int toku_txn_xa_prepare (DB_TXN *txn, TOKU_XA_XID *xid, uint32_t flags) {
int r = 0;
if (!txn) {
r = EINVAL;
@@ -273,9 +273,11 @@ static int toku_txn_xa_prepare (DB_TXN *txn, TOKU_XA_XID *xid) {
HANDLE_PANICKED_ENV(txn->mgrp);
}
assert(!db_txn_struct_i(txn)->child);
+ int nosync;
+ nosync = (flags & DB_TXN_NOSYNC)!=0 || (db_txn_struct_i(txn)->flags&DB_TXN_NOSYNC);
TOKUTXN ttxn;
ttxn = db_txn_struct_i(txn)->tokutxn;
- toku_txn_prepare_txn(ttxn, xid);
+ toku_txn_prepare_txn(ttxn, xid, nosync);
TOKULOGGER logger;
logger = txn->mgrp->i->logger;
LSN do_fsync_lsn;
@@ -292,14 +294,14 @@ exit:
// requires: must hold the multi operation lock. it is
// released in toku_txn_xa_prepare before the fsync.
-static int toku_txn_prepare (DB_TXN *txn, uint8_t gid[DB_GID_SIZE]) {
+static int toku_txn_prepare (DB_TXN *txn, uint8_t gid[DB_GID_SIZE], uint32_t flags) {
TOKU_XA_XID xid;
TOKU_ANNOTATE_NEW_MEMORY(&xid, sizeof(xid));
xid.formatID=0x756b6f54; // "Toku"
xid.gtrid_length=DB_GID_SIZE/2; // The maximum allowed gtrid length is 64. See the XA spec in source:/import/opengroup.org/C193.pdf page 20.
xid.bqual_length=DB_GID_SIZE/2; // The maximum allowed bqual length is 64.
memcpy(xid.data, gid, DB_GID_SIZE);
- return toku_txn_xa_prepare(txn, &xid);
+ return toku_txn_xa_prepare(txn, &xid, flags);
}
static int toku_txn_txn_stat (DB_TXN *txn, struct txn_stat **txn_stat) {
@@ -427,6 +429,15 @@ static bool toku_txn_is_prepared(DB_TXN *txn) {
return toku_txn_get_state(ttxn) == TOKUTXN_PREPARING;
}
+static DB_TXN *toku_txn_get_child(DB_TXN *txn) {
+ return db_txn_struct_i(txn)->child;
+}
+
+static uint64_t toku_txn_get_start_time(DB_TXN *txn) {
+ TOKUTXN ttxn = db_txn_struct_i(txn)->tokutxn;
+ return toku_txn_get_start_time(ttxn);
+}
+
static inline void txn_func_init(DB_TXN *txn) {
#define STXN(name) txn->name = locked_txn_ ## name
STXN(abort);
@@ -444,6 +455,8 @@ static inline void txn_func_init(DB_TXN *txn) {
#undef SUTXN
txn->id64 = toku_txn_id64;
txn->is_prepared = toku_txn_is_prepared;
+ txn->get_child = toku_txn_get_child;
+ txn->get_start_time = toku_txn_get_start_time;
}
//
diff --git a/storage/tokudb/ft-index/tools/CMakeLists.txt b/storage/tokudb/ft-index/tools/CMakeLists.txt
index 4ed0cb4cbdc..f745517d84e 100644
--- a/storage/tokudb/ft-index/tools/CMakeLists.txt
+++ b/storage/tokudb/ft-index/tools/CMakeLists.txt
@@ -1,6 +1,6 @@
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS _GNU_SOURCE DONT_DEPRECATE_ERRNO)
-set(tools tokudb_dump tokuftdump tdb_logprint tdb-recover ftverify ba_replay)
+set(tools tokudb_dump tokuftdump tokuft_logprint tdb-recover ftverify ba_replay)
foreach(tool ${tools})
add_executable(${tool} ${tool}.cc)
add_dependencies(${tool} install_tdb_h)
@@ -12,9 +12,6 @@ endforeach(tool)
# link in math.h library just for this tool.
target_link_libraries(ftverify m)
-install(
- TARGETS tokuftdump
- DESTINATION bin
- COMPONENT Server
- )
+install(TARGETS tokuftdump DESTINATION ${INSTALL_BINDIR} COMPONENT Server)
+install(TARGETS tokuft_logprint DESTINATION ${INSTALL_BINDIR} COMPONENT Server)
diff --git a/storage/tokudb/ft-index/tools/tdb_logprint.cc b/storage/tokudb/ft-index/tools/tokuft_logprint.cc
index 15a28632cfb..1dd7581b9f5 100644
--- a/storage/tokudb/ft-index/tools/tdb_logprint.cc
+++ b/storage/tokudb/ft-index/tools/tokuft_logprint.cc
@@ -91,8 +91,6 @@ PATENT RIGHTS GRANT:
/* Dump the log from stdin to stdout. */
-#include <config.h>
-
#include "ft/log_header.h"
#include "ft/logger/logger.h"
diff --git a/storage/tokudb/ft-index/tools/tokuftdump.cc b/storage/tokudb/ft-index/tools/tokuftdump.cc
index 3f73136fb5c..14c3c31a061 100644
--- a/storage/tokudb/ft-index/tools/tokuftdump.cc
+++ b/storage/tokudb/ft-index/tools/tokuftdump.cc
@@ -99,7 +99,10 @@ PATENT RIGHTS GRANT:
#include <stdlib.h>
#include <inttypes.h>
#include <limits.h>
-
+#include <string>
+#include <iostream>
+#include <fstream>
+#include <string.h>
#include "ft/serialize/block_table.h"
#include "ft/cachetable/cachetable.h"
#include "ft/ft.h"
@@ -108,8 +111,11 @@ PATENT RIGHTS GRANT:
#include "ft/serialize/ft_node-serialize.h"
#include "ft/node.h"
+using namespace std;
+
static int do_dump_data = 1;
static int do_interactive = 0;
+static int do_json = 0;
static int do_header = 0;
static int do_fragmentation = 0;
static int do_garbage = 0;
@@ -118,10 +124,24 @@ static int do_rootnode = 0;
static int do_node = 0;
static BLOCKNUM do_node_num;
static int do_tsv = 0;
-
static const char *arg0;
static const char *fname;
+//it holdes the messges count for each FT's node
+typedef struct nodeMessage{
+ int id;
+ int clean;//0=clean >=1 dirty
+ int *count;//holds the messages
+ nodeMessage *nextNode;
+}NMC;
+enum { maxline = 128};
+
+static int printNodeMessagesToSTDout(NMC* ptr);
+
+static int printLevelSTDout(int *);
+
+static void treeToSTDout(NMC *msgs[], int height);
+
static void format_time(const uint64_t time_int, char *buf) {
time_t timer = (time_t) time_int;
ctime_r(&timer, buf);
@@ -225,12 +245,204 @@ static void dump_header(FT ft) {
printf(" estimated numbytes=%" PRId64 "\n", ft->in_memory_stats.numbytes);
}
+static int64_t getRootNode(FT ft) {
+ return ft->h->root_blocknum.b;
+}
+
static int print_le(const void* key, const uint32_t keylen, const LEAFENTRY &le, const uint32_t idx UU(), void *const ai UU()) {
+ unsigned int *le_index = (unsigned int *) ai;
+ printf("%u: ", *le_index); *le_index += 1;
print_klpair(stdout, key, keylen, le);
printf("\n");
return 0;
}
+static int getHeight(int fd, BLOCKNUM blocknum, FT ft){
+ FTNODE n;
+ FTNODE_DISK_DATA ndd = nullptr;
+ ftnode_fetch_extra bfe;
+ bfe.create_for_full_read(ft);
+ int r = toku_deserialize_ftnode_from (fd, blocknum, 0 /*pass zero for hash, it doesn't matter*/, &n, &ndd, &bfe);
+ assert_zero(r);
+ assert(n!=0);
+ return n->height;
+}
+
+static FTNODE getNode(int fd, BLOCKNUM blocknum, FT ft) {
+ FTNODE n;
+ FTNODE_DISK_DATA ndd = nullptr;
+ ftnode_fetch_extra bfe;
+ bfe.create_for_full_read(ft);
+ int r = toku_deserialize_ftnode_from (fd, blocknum, 0 /*pass zero for hash, it doesn't matter*/, &n, &ndd, &bfe);
+ assert_zero(r);;
+ return n;
+}
+
+static int countNodes(NMC *level){
+ int count=0;
+ NMC *ptr=level;
+ while(ptr!=NULL){
+ count++;
+ ptr=ptr->nextNode;
+ }
+ return count;
+}
+
+static int * countMessages(NMC *level){
+ int *counts=new int[16];
+ for(int i=0;i<16;i++){
+ counts[i]=0;
+ }
+ NMC *ptr=level;
+ while(ptr!=NULL){
+ for(int i=0;i<16;i++){
+ counts[i]+=ptr->count[i];
+ }
+ ptr=ptr->nextNode;
+ }
+ return counts;
+}
+
+static NMC * getLast(NMC *level){
+ if (level==NULL) return NULL;
+ NMC *ptr=level;
+ while(ptr->nextNode!=NULL){
+ ptr=ptr->nextNode;
+ }
+ return ptr;
+}
+
+/*
+ * Prints the total messages at each to STDout
+ */
+static int printLevelSTDout(int *count){
+ int isEmpty=0;
+ for(int j=0;j<16;j++){
+ if(count[j]>0){
+ cout <<count[j]<<" ";
+ isEmpty++;
+ switch (j) {
+ case FT_INSERT: printf("INSERT(s) "); break;
+ case FT_INSERT_NO_OVERWRITE: printf("INSERT_NO_OVERWRITE(s) "); break;
+ case FT_DELETE_ANY: printf("DELETE_ANY(s) "); break;
+ case FT_ABORT_ANY: printf("ABORT_ANY(s) "); break;
+ case FT_COMMIT_ANY: printf("COMMIT_ANY(s) "); break;
+ case FT_COMMIT_BROADCAST_ALL: printf("COMMIT_BROADCAST_ALL(s) "); break;
+ case FT_COMMIT_BROADCAST_TXN: printf("COMMIT_BROADCAST_TXN(s) "); break;
+ case FT_ABORT_BROADCAST_TXN: printf("ABORT_BROADCAST_TXN(s) "); break;
+ case FT_OPTIMIZE: printf("OPTIMIZE(s) "); break;
+ case FT_OPTIMIZE_FOR_UPGRADE: printf("OPTIMIZE_FOR_UPGRADE(s) "); break;
+ case FT_UPDATE: printf("UPDATE(s) "); break;
+ case FT_UPDATE_BROADCAST_ALL: printf("UPDATE_BROADCAST_ALL(s) "); break;
+ }
+
+ }
+ }
+ return isEmpty;
+}
+
+/*
+ * Prints the total # of messages in a node to STD output
+ */
+static int printNodeMessagesToSTDout(NMC *ptr){
+ cout <<"\nNode :"<<ptr->id<<" has :";
+ for(int j=0;j<16;j++){
+ if(ptr->count[j]>0){
+ cout <<ptr->count[j]<<" ";
+ switch (j) {
+ case FT_INSERT: printf("INSERT(s) "); break;
+ case FT_INSERT_NO_OVERWRITE: printf("INSERT_NO_OVERWRITE(s) "); break;
+ case FT_DELETE_ANY: printf("DELETE_ANY(s) "); break;
+ case FT_ABORT_ANY: printf("ABORT_ANY(s) "); break;
+ case FT_COMMIT_ANY: printf("COMMIT_ANY(s) "); break;
+ case FT_COMMIT_BROADCAST_ALL: printf("COMMIT_BROADCAST_ALL(s) "); break;
+ case FT_COMMIT_BROADCAST_TXN: printf("COMMIT_BROADCAST_TXN(s) "); break;
+ case FT_ABORT_BROADCAST_TXN: printf("ABORT_BROADCAST_TXN(s) "); break;
+ case FT_OPTIMIZE: printf("OPTIMIZE(s) "); break;
+ case FT_OPTIMIZE_FOR_UPGRADE: printf("OPTIMIZE_FOR_UPGRADE(s) "); break;
+ case FT_UPDATE: printf("UPDATE(s) "); break;
+ case FT_UPDATE_BROADCAST_ALL: printf("UPDATE_BROADCAST_ALL(s) "); break;
+ }
+ }
+ }
+ return 1;
+}
+
+static void levelToSTDout(NMC *list, int level){
+ NMC *ptr=list;
+ cout <<endl<<"Height : "<<level<<endl;
+ while(ptr!=NULL){
+ if(ptr->clean!=0){
+ printNodeMessagesToSTDout(ptr);
+ }
+ else{
+ cout << "\nNode : "<<ptr->id<<" has no messages";
+ }
+ ptr=ptr->nextNode;
+ }
+ cout <<endl;
+}
+
+/*
+ * prints the tree total # of nodes and total # of messages at each height in :
+ * STDout in human readable format
+ */
+static void treeToSTDout(NMC *msgs[], int height){
+ for(int i=height; i>=0 ; i--){
+ cout <<"At height "<<i;
+ int *counts=countMessages(msgs[i]);
+ cout <<"\n Node Count: "<< countNodes(msgs[i])<<endl;
+ cout <<" Messages: ";
+ if(printLevelSTDout(counts)==0) cout <<"0\n";
+ else cout <<endl;
+ }
+}
+
+//traverse through the FT and report back the count of messages in every node
+static void countMessagesInFT(int fd, BLOCKNUM blocknum, FT ft,NMC *msgs[]){
+ FTNODE n=getNode(fd,blocknum,ft);
+
+ NMC *last=NULL;
+ if(msgs[n->height]==NULL){
+ last = msgs[n->height]=new NMC;
+ }else {
+ last=getLast(msgs[n->height]);
+ last->nextNode=new NMC;
+ last=last->nextNode;
+ }
+ last->id=blocknum.b;
+ last->count=new int[16];
+ for(int i=0;i<16;i++){
+ last->count[i]=0;
+ }
+ last->clean=0;
+ last->nextNode=NULL;
+
+ if (n->height==0){
+ toku_ftnode_free(&n);
+ return;
+ }
+ for(int i=0;i<n->n_children;i++){
+ NONLEAF_CHILDINFO bnc = BNC(n, i);
+ if (n->height==1 && n->bp[i].ptr.tag==BCT_NULL){
+ cout <<n->bp[i].ptr.tag;
+ }
+ auto dump_fn=[&](const ft_msg &msg, bool UU(is_fresh)) {
+ enum ft_msg_type type = (enum ft_msg_type) msg.type();
+ last->count[type]++;
+ last->clean=1;
+ return 0;
+ };
+
+ bnc->msg_buffer.iterate(dump_fn);
+
+ blocknum=make_blocknum(BP_BLOCKNUM(n, i).b);
+ countMessagesInFT(fd,blocknum,ft, msgs);
+ }
+
+ toku_ftnode_free(&n);
+}
+
static void dump_node(int fd, BLOCKNUM blocknum, FT ft) {
FTNODE n;
FTNODE_DISK_DATA ndd = nullptr;
@@ -254,9 +466,9 @@ static void dump_node(int fd, BLOCKNUM blocknum, FT ft) {
printf(" layout_version_read_from_disk=%d\n", n->layout_version_read_from_disk);
printf(" build_id=%d\n", n->build_id);
printf(" max_msn_applied_to_node_on_disk=%" PRId64 " (0x%" PRIx64 ")\n", n->max_msn_applied_to_node_on_disk.msn, n->max_msn_applied_to_node_on_disk.msn);
- printf(" io time %lf decompress time %lf deserialize time %lf\n",
- tokutime_to_seconds(bfe.io_time),
- tokutime_to_seconds(bfe.decompress_time),
+ printf(" io time %lf decompress time %lf deserialize time %lf\n",
+ tokutime_to_seconds(bfe.io_time),
+ tokutime_to_seconds(bfe.decompress_time),
tokutime_to_seconds(bfe.deserialize_time));
printf(" n_children=%d\n", n->n_children);
@@ -277,7 +489,7 @@ static void dump_node(int fd, BLOCKNUM blocknum, FT ft) {
if (n->height > 0) {
printf("%" PRId64 "\n", BP_BLOCKNUM(n, i).b);
NONLEAF_CHILDINFO bnc = BNC(n, i);
- unsigned int n_bytes = toku_bnc_nbytesinbuf(bnc);
+ unsigned int n_bytes = toku_bnc_nbytesinbuf(bnc);
int n_entries = toku_bnc_n_entries(bnc);
if (n_bytes > 0 || n_entries > 0) {
printf(" buffer contains %u bytes (%d items)\n", n_bytes, n_entries);
@@ -329,7 +541,8 @@ ok:
printf(" n_bytes_in_buffer= %" PRIu64 "", BLB_DATA(n, i)->get_disk_size());
printf(" items_in_buffer=%u\n", BLB_DATA(n, i)->num_klpairs());
if (do_dump_data) {
- BLB_DATA(n, i)->iterate<void, print_le>(NULL);
+ unsigned int le_index = 0;
+ BLB_DATA(n, i)->iterate<void, print_le>(&le_index);
}
}
}
@@ -402,8 +615,12 @@ static void dump_garbage_stats(int fd, FT ft) {
uint64_t total_space = 0;
uint64_t used_space = 0;
toku_ft_get_garbage(ft, &total_space, &used_space);
- printf("garbage total size\t%" PRIu64 "\n", total_space);
- printf("garbage used size\t%" PRIu64 "\n", used_space);
+ printf("garbage total size :%20" PRIu64 "\n", total_space);
+ printf("garbage used size :%20" PRIu64 "\n", used_space);
+ float a=used_space,b=total_space;
+
+ float percentage=((1-a/b)*100);
+ printf("Total garbage : %2.3f%%\n", percentage);
}
typedef struct __dump_node_extra {
@@ -438,7 +655,7 @@ static void sub_block_deserialize(struct dump_sub_block *sb, unsigned char *sub_
static void verify_block(unsigned char *cp, uint64_t file_offset, uint64_t size) {
// verify the header checksum
const size_t node_header = 8 + sizeof (uint32_t) + sizeof (uint32_t) + sizeof (uint32_t);
-
+
printf("%.8s layout_version=%u %u build=%d\n", cp, get_unaligned_uint32(cp+8), get_unaligned_uint32(cp+12), get_unaligned_uint32(cp+16));
unsigned char *sub_block_header = &cp[node_header];
@@ -544,7 +761,9 @@ static uint64_t getuint64(const char *f) {
static void interactive_help(void) {
fprintf(stderr, "help\n");
fprintf(stderr, "header\n");
- fprintf(stderr, "node NUMBER\n");
+ cout <<"mr/MessagesReport [NUMBER] \n Reports messages for the level of the tree you want get more details about\n";
+ cout <<"rf/readFile ft-file-name \n Switch to a different FT\n";
+ fprintf(stderr, "node NUMBER \n");
fprintf(stderr, "bx OFFSET | block_translation OFFSET\n");
fprintf(stderr, "dumpdata 0|1\n");
fprintf(stderr, "fragmentation\n");
@@ -554,10 +773,160 @@ static void interactive_help(void) {
fprintf(stderr, "quit\n");
}
+static void freeNMC(NMC *msgs[], int height){
+ for(int i=0;i<height;i++){
+ if(msgs[i]!=NULL){
+ delete(msgs[i]->count);
+
+ while(msgs[i]->nextNode!=NULL){
+ NMC* ptr=msgs[i]->nextNode;
+ msgs[i]=msgs[i]->nextNode;
+ delete ptr;
+
+ }
+ msgs[i]=NULL;
+ }
+ }
+}
+
+static void writeTree(NMC *msgs[],int height,char *name UU()){
+ ofstream mytree ("/tmp/tree.txt",fstream::out);
+ if (mytree.is_open()){
+ for(int i=height;i>=0;i--){
+ NMC * ptr=msgs[i];
+ mytree <<i<<endl;
+ while(ptr!=NULL){
+ mytree << ptr->id<<"\t";
+ if(ptr->clean!=0)mytree << "1"<<"\t";
+ else mytree << "0"<<"\t";
+ for(int j=0;j<15;j++)mytree << ptr->count[j]<<" ";
+ mytree << ptr->count[i]<<endl;
+ ptr=ptr->nextNode;
+ }
+ mytree <<endl;
+ }
+ }
+ else cout << "Unable to open file";
+ mytree.close();
+}
+
+static void writeJson(NMC *msgs[],int height,const char *name){
+ ofstream mytree (name,fstream::out);
+ if (mytree.is_open()){
+ mytree <<"{\n \"FT\":[";
+ for(int i=height;i>=0;i--){
+ NMC * ptr=msgs[i];
+ mytree <<"{\n\"Level\": {\"Height\":\""<<i<<"\",\n \"Nodes\":[";
+ while(ptr!=NULL){
+ mytree <<"{\"ID\":\""<< ptr->id<<"\",";
+ if(ptr->clean!=0){
+ mytree <<"\"Messages\":[";
+ for(int j=0;j<16;j++)
+ {
+ mytree <<"{";
+ switch (j) {
+ case FT_INSERT: mytree <<"\"INSERT\":\""<<ptr->count[j]<<"\""; break;
+ case FT_INSERT_NO_OVERWRITE: mytree <<"\"INSERT_NOVERWTE\":\""<<ptr->count[j]<<"\""; break;
+ case FT_DELETE_ANY: mytree <<"\"DELETE\":\""<<ptr->count[j]<<"\""; break;
+ case FT_ABORT_ANY: mytree <<"\"ABORT\":\""<<ptr->count[j]<<"\""; break;
+ case FT_COMMIT_ANY: mytree <<"\"COMMITY\":\""<<ptr->count[j]<<"\""; break;
+ case FT_COMMIT_BROADCAST_ALL: mytree <<"\"COMMIT_BROADCAST_ALL\":\""<<ptr->count[j]<<"\"" ; break;
+ case FT_COMMIT_BROADCAST_TXN: mytree <<"\"COMMIT_BROADCAST_TXN\":\""<<ptr->count[j]<<"\""; break;
+ case FT_ABORT_BROADCAST_TXN: mytree <<"\"ABORT_BROADCAST_TXN\":\""<<ptr->count[j]<<"\"";break;
+ case FT_OPTIMIZE: mytree <<"\"OPTIMIZE\":\""<<ptr->count[j]<<"\""; break;
+ case FT_OPTIMIZE_FOR_UPGRADE: mytree <<"\"OPTIMIZE_FOR_UPGRADE\":\""<<ptr->count[j]<<"\"";break;
+ case FT_UPDATE: mytree <<"\"UPDATE\":\""<<ptr->count[j]<<"\""; break;
+ case FT_UPDATE_BROADCAST_ALL: mytree <<"\"UPDATE_BROADCAST_ALL\":\""<<ptr->count[j]<<"\""; break;
+ }
+ mytree <<"}";
+ if(j<15)mytree<<",";
+ }
+
+ mytree <<"]}";
+
+ }
+ else {
+ mytree <<"\"Messages\":\""<< "0"<<"\"}";
+ }
+ if(ptr->nextNode!=NULL)mytree <<",\n";
+ else mytree <<"]}\n";
+ ptr=ptr->nextNode;
+ }
+ mytree <<"\n}\n";
+ if(i!=0)mytree <<",\n";
+ }
+ mytree <<"\n]}\n";
+
+ }
+ else cout << "Unable to open file";
+ mytree.close();
+}
+
+static void writeTree(NMC *msgs[],int height){
+ ofstream mytree ("/tmp/tree1.txt",fstream::out);
+ if (mytree.is_open()){
+ for(int i=height;i>=0;i--){
+ NMC * ptr=msgs[i];
+ mytree <<i<<endl;
+ while(ptr!=NULL){
+ mytree << ptr->id<<",";
+ if(ptr->clean!=0)mytree << "1"<<",";
+ else mytree << "0"<<",";
+ for(int j=0;j<15;j++)mytree << ptr->count[j]<<",";
+ mytree << ptr->count[i]<<endl;
+ ptr=ptr->nextNode;
+ }
+ mytree <<".\"";
+ }
+ }
+ else cout << "Unable to open file";
+ mytree.close();
+}
+
+static void FT_to_JSON(int fd, FT ft, CACHEFILE cf, const char * JsonFile){
+ toku_ft_free(ft);
+ open_header(fd, &ft, cf);
+ int root=getRootNode(ft);
+ BLOCKNUM off = make_blocknum(root);
+ int height=getHeight(fd,off, ft);
+ NMC *msgs[height];
+ for(int i=0;i<=height;i++){
+ msgs[i]=NULL;
+ }
+ open_header(fd, &ft, cf);
+ root=getRootNode(ft);
+ off = make_blocknum(root);
+ countMessagesInFT(fd,off, ft,msgs);
+ cout <<"to STD output: \n";
+ treeToSTDout(msgs,height);
+ writeTree(msgs,height);
+ cout<<"FT's json file was generated here:";
+ if(JsonFile!=NULL) {
+ cout <<JsonFile;
+ writeJson(msgs,height,JsonFile);
+ }
+ else {
+ cout <<"./FT.json";
+ writeJson(msgs,height,"./FT.json");
+ }
+ cout<<endl;
+ freeNMC(msgs,height);
+ exit(0);
+}
+
static void run_iteractive_loop(int fd, FT ft, CACHEFILE cf) {
+ toku_ft_free(ft);
+ open_header(fd, &ft, cf);
+ int root=getRootNode(ft);
+ BLOCKNUM off = make_blocknum(root);
+ int height=getHeight(fd,off, ft);
+ NMC *msgs[height];
+ for(int i=0;i<=height;i++){
+ msgs[i]=NULL;
+ }
while (1) {
- printf("ftdump>"); fflush(stdout);
- enum { maxline = 64};
+ printf("ftdump>");
+ fflush(stdout);
char line[maxline+1];
int r = readline(line, maxline);
if (r == EOF)
@@ -565,7 +934,7 @@ static void run_iteractive_loop(int fd, FT ft, CACHEFILE cf) {
const int maxfields = 4;
char *fields[maxfields];
int nfields = split_fields(line, fields, maxfields);
- if (nfields == 0)
+ if (nfields == 0)
continue;
if (strcmp(fields[0], "help") == 0) {
interactive_help();
@@ -573,15 +942,50 @@ static void run_iteractive_loop(int fd, FT ft, CACHEFILE cf) {
toku_ft_free(ft);
open_header(fd, &ft, cf);
dump_header(ft);
+ } else if (strcmp(fields[0], "rn") == 0||strcmp(fields[0], "rootNode")==0||strcmp(fields[0], "rootnode") == 0) {
+ printf("Root node :%d\n",root);
} else if (strcmp(fields[0], "block") == 0 && nfields == 2) {
BLOCKNUM blocknum = make_blocknum(getuint64(fields[1]));
dump_block(fd, blocknum, ft);
+ }else if ((strcmp(fields[0], "readFile") == 0 ||strcmp(fields[0], "readfile") == 0 ||strcmp(fields[0], "rf") == 0 )&& nfields == 2) {
+ fname=fields[1];
+ fd = open(fname, O_RDWR + O_BINARY);
+ toku_ft_free(ft);
+ open_header(fd, &ft, cf);
+ root=getRootNode(ft);
+ off = make_blocknum(root);
+ height=getHeight(fd,off, ft);
+ if (fd < 0) {
+ fprintf(stderr, "%s: can not open the FT dump %s errno %d\n", arg0, fname, errno);
+ continue;
+ }
} else if (strcmp(fields[0], "node") == 0 && nfields == 2) {
- BLOCKNUM off = make_blocknum(getuint64(fields[1]));
+ off = make_blocknum(getuint64(fields[1]));
dump_node(fd, off, ft);
- } else if (strcmp(fields[0], "dumpdata") == 0 && nfields == 2) {
+ }else if ((strcmp(fields[0], "mr") == 0||(strcmp(fields[0], "nc")) == 0 ||strcmp(fields[0], "messagesReport") == 0 )) {
+ freeNMC(msgs,height);
+ toku_ft_free(ft);
+ open_header(fd, &ft, cf);
+ root=getRootNode(ft);
+ off = make_blocknum(root);
+ countMessagesInFT(fd,off, ft,msgs);
+ int level=-1;
+ if(nfields == 2)level=getuint64(fields[1]);
+ if(level>=0){
+ levelToSTDout(msgs[level], level);
+ }
+ else{
+ cout <<"to STD output: \n";
+ treeToSTDout(msgs,height);
+ }
+ writeTree(msgs,height);
+ writeTree(msgs,height, NULL);
+
+ }else if (strcmp(fields[0], "dumpdata") == 0 && nfields == 2) {
+
do_dump_data = strtol(fields[1], NULL, 10);
- } else if (strcmp(fields[0], "block_translation") == 0 || strcmp(fields[0], "bx") == 0) {
+ }
+ else if (strcmp(fields[0], "block_translation") == 0 || strcmp(fields[0], "bx") == 0) {
uint64_t offset = 0;
if (nfields == 2)
offset = getuint64(fields[1]);
@@ -590,7 +994,7 @@ static void run_iteractive_loop(int fd, FT ft, CACHEFILE cf) {
dump_fragmentation(fd, ft, do_tsv);
} else if (strcmp(fields[0], "nodesizes") == 0) {
dump_nodesizes(fd, ft);
- } else if (strcmp(fields[0], "garbage") == 0) {
+ } else if (strcmp(fields[0], "garbage") == 0||strcmp(fields[0], "g") == 0) {
dump_garbage_stats(fd, ft);
} else if (strcmp(fields[0], "file") == 0 && nfields >= 3) {
uint64_t offset = getuint64(fields[1]);
@@ -604,14 +1008,18 @@ static void run_iteractive_loop(int fd, FT ft, CACHEFILE cf) {
unsigned char newc = getuint64(fields[2]);
set_file(fd, offset, newc);
} else if (strcmp(fields[0], "quit") == 0 || strcmp(fields[0], "q") == 0) {
- break;
+ toku_ft_free(ft);
+ exit(0);
}
}
+ freeNMC(msgs,height);
}
static int usage(void) {
fprintf(stderr, "Usage: %s ", arg0);
fprintf(stderr, "--interactive ");
+ fprintf(stderr, "--support /path/to/fractal-tree/file \n\t an interactive way to see what messages and/or switch between FTs");
+ fprintf(stderr, "--json /path/to/fractal-tree/file [output json file]\n\t if left empty an FT.json will be created automatically");
fprintf(stderr, "--nodata ");
fprintf(stderr, "--dumpdata 0|1 ");
fprintf(stderr, "--header ");
@@ -632,10 +1040,15 @@ int main (int argc, const char *const argv[]) {
while (argc>0) {
if (strcmp(argv[0], "--interactive") == 0 || strcmp(argv[0], "--i") == 0) {
do_interactive = 1;
+ }
+ else if ((strcmp(argv[0], "--json") == 0 || strcmp(argv[0], "--s")== 0)&& argc >= 2) {
+ do_json = 1;
+ fname=argv[1];
+ argc--; argv++;
+ break;
} else if (strcmp(argv[0], "--nodata") == 0) {
do_dump_data = 0;
} else if (strcmp(argv[0], "--dumpdata") == 0 && argc > 1) {
- argc--; argv++;
do_dump_data = atoi(argv[0]);
} else if (strcmp(argv[0], "--header") == 0) {
do_header = 1;
@@ -660,39 +1073,39 @@ int main (int argc, const char *const argv[]) {
}
argc--; argv++;
}
- if (argc != 1)
- return usage();
+ if (argc != 1 && do_json==0)
+ return usage();
int r = toku_ft_layer_init();
assert_zero(r);
-
- fname = argv[0];
+ if(fname==NULL)fname = argv[0];
int fd = open(fname, O_RDWR + O_BINARY);
if (fd < 0) {
fprintf(stderr, "%s: can not open %s errno %d\n", arg0, fname, errno);
return 1;
}
-
// create a cachefile for the header
CACHETABLE ct = NULL;
toku_cachetable_create(&ct, 1<<25, (LSN){0}, 0);
-
CACHEFILE cf = NULL;
r = toku_cachetable_openfd (&cf, ct, fd, fname);
assert_zero(r);
-
FT ft = NULL;
open_header(fd, &ft, cf);
-
+ if (do_json ) {
+ const char *arg=argv[1];
+ FT_to_JSON(fd, ft, cf,arg);
+ }
if (do_interactive) {
run_iteractive_loop(fd, ft, cf);
- } else {
+ }
+ else {
if (do_header) {
dump_header(ft);
}
if (do_rootnode) {
dump_node(fd, ft->h->root_blocknum, ft);
- }
+ }
if (do_node) {
dump_node(fd, do_node_num, ft);
}
@@ -708,14 +1121,12 @@ int main (int argc, const char *const argv[]) {
if (!do_header && !do_rootnode && !do_fragmentation && !do_translation_table && !do_garbage) {
printf("Block translation:");
ft->blocktable.dump_translation_table(stdout);
-
dump_header(ft);
-
struct __dump_node_extra info;
info.fd = fd;
info.ft = ft;
ft->blocktable.iterate(block_table::TRANSLATION_CHECKPOINTED,
- dump_node_wrapper, &info, true, true);
+ dump_node_wrapper, &info, true, true);
}
}
toku_cachefile_close(&cf, false, ZERO_LSN);
diff --git a/storage/tokudb/ft-index/util/scoped_malloc.cc b/storage/tokudb/ft-index/util/scoped_malloc.cc
index 551bd944beb..15d4fb3e52e 100644
--- a/storage/tokudb/ft-index/util/scoped_malloc.cc
+++ b/storage/tokudb/ft-index/util/scoped_malloc.cc
@@ -145,6 +145,9 @@ namespace toku {
}
void destroy() {
+#if TOKU_SCOPED_MALLOC_DEBUG
+ printf("%s %p %p\n", __FUNCTION__, this, m_stack);
+#endif
if (m_stack != NULL) {
toku_free(m_stack);
m_stack = NULL;
@@ -167,13 +170,17 @@ namespace toku {
static void destroy_and_deregister(void *key) {
invariant_notnull(key);
tl_stack *st = reinterpret_cast<tl_stack *>(key);
- st->destroy();
+ size_t n = 0;
toku_mutex_lock(&global_stack_set_mutex);
- invariant_notnull(global_stack_set);
- size_t n = global_stack_set->erase(st);
- invariant(n == 1);
+ if (global_stack_set) {
+ n = global_stack_set->erase(st);
+ }
toku_mutex_unlock(&global_stack_set_mutex);
+
+ if (n == 1) {
+ st->destroy(); // destroy the stack if this function erased it from the set. otherwise, somebody else destroyed it.
+ }
}
// Allocate 'size' bytes and return a pointer to the first byte
@@ -244,6 +251,11 @@ void toku_scoped_malloc_init(void) {
}
void toku_scoped_malloc_destroy(void) {
+ toku_scoped_malloc_destroy_key();
+ toku_scoped_malloc_destroy_set();
+}
+
+void toku_scoped_malloc_destroy_set(void) {
toku_mutex_lock(&toku::global_stack_set_mutex);
invariant_notnull(toku::global_stack_set);
// Destroy any tl_stacks that were registered as thread locals but did not
@@ -254,10 +266,11 @@ void toku_scoped_malloc_destroy(void) {
(*i)->destroy();
}
delete toku::global_stack_set;
+ toku::global_stack_set = nullptr;
toku_mutex_unlock(&toku::global_stack_set_mutex);
+}
- // We're deregistering the destructor key here. When this thread exits,
- // the tl_stack destructor won't get called, so we need to do that first.
+void toku_scoped_malloc_destroy_key(void) {
int r = pthread_key_delete(toku::tl_stack_destroy_pthread_key);
invariant_zero(r);
}
diff --git a/storage/tokudb/ft-index/util/scoped_malloc.h b/storage/tokudb/ft-index/util/scoped_malloc.h
index dbd919d155e..0233b0f1aa5 100644
--- a/storage/tokudb/ft-index/util/scoped_malloc.h
+++ b/storage/tokudb/ft-index/util/scoped_malloc.h
@@ -151,3 +151,7 @@ void toku_scoped_malloc_init(void);
void toku_scoped_malloc_destroy(void);
+void toku_scoped_malloc_destroy_set(void);
+
+void toku_scoped_malloc_destroy_key(void);
+
diff --git a/storage/tokudb/ft-index/util/tests/sm-basic.cc b/storage/tokudb/ft-index/util/tests/sm-basic.cc
new file mode 100644
index 00000000000..5df64294721
--- /dev/null
+++ b/storage/tokudb/ft-index/util/tests/sm-basic.cc
@@ -0,0 +1,127 @@
+/* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
+// vim: ft=cpp:expandtab:ts=8:sw=4:softtabstop=4:
+#ident "$Id$"
+/*
+COPYING CONDITIONS NOTICE:
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of version 2 of the GNU General Public License as
+ published by the Free Software Foundation, and provided that the
+ following conditions are met:
+
+ * Redistributions of source code must retain this COPYING
+ CONDITIONS NOTICE, the COPYRIGHT NOTICE (below), the
+ DISCLAIMER (below), the UNIVERSITY PATENT NOTICE (below), the
+ PATENT MARKING NOTICE (below), and the PATENT RIGHTS
+ GRANT (below).
+
+ * Redistributions in binary form must reproduce this COPYING
+ CONDITIONS NOTICE, the COPYRIGHT NOTICE (below), the
+ DISCLAIMER (below), the UNIVERSITY PATENT NOTICE (below), the
+ PATENT MARKING NOTICE (below), and the PATENT RIGHTS
+ GRANT (below) in the documentation and/or other materials
+ provided with the distribution.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+
+COPYRIGHT NOTICE:
+
+ TokuFT, Tokutek Fractal Tree Indexing Library.
+ Copyright (C) 2007-2013 Tokutek, Inc.
+
+DISCLAIMER:
+
+ 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.
+
+UNIVERSITY PATENT NOTICE:
+
+ The technology is licensed by the Massachusetts Institute of
+ Technology, Rutgers State University of New Jersey, and the Research
+ Foundation of State University of New York at Stony Brook under
+ United States of America Serial No. 11/760379 and to the patents
+ and/or patent applications resulting from it.
+
+PATENT MARKING NOTICE:
+
+ This software is covered by US Patent No. 8,185,551.
+ This software is covered by US Patent No. 8,489,638.
+
+PATENT RIGHTS GRANT:
+
+ "THIS IMPLEMENTATION" means the copyrightable works distributed by
+ Tokutek as part of the Fractal Tree project.
+
+ "PATENT CLAIMS" means the claims of patents that are owned or
+ licensable by Tokutek, both currently or in the future; and that in
+ the absence of this license would be infringed by THIS
+ IMPLEMENTATION or by using or running THIS IMPLEMENTATION.
+
+ "PATENT CHALLENGE" shall mean a challenge to the validity,
+ patentability, enforceability and/or non-infringement of any of the
+ PATENT CLAIMS or otherwise opposing any of the PATENT CLAIMS.
+
+ Tokutek hereby grants to you, for the term and geographical scope of
+ the PATENT CLAIMS, a non-exclusive, no-charge, royalty-free,
+ irrevocable (except as stated in this section) patent license to
+ make, have made, use, offer to sell, sell, import, transfer, and
+ otherwise run, modify, and propagate the contents of THIS
+ IMPLEMENTATION, where such license applies only to the PATENT
+ CLAIMS. This grant does not include claims that would be infringed
+ only as a consequence of further modifications of THIS
+ IMPLEMENTATION. If you or your agent or licensee institute or order
+ or agree to the institution of patent litigation against any entity
+ (including a cross-claim or counterclaim in a lawsuit) alleging that
+ THIS IMPLEMENTATION constitutes direct or contributory patent
+ infringement, or inducement of patent infringement, then any rights
+ granted to you under this License shall terminate as of the date
+ such litigation is filed. If you or your agent or exclusive
+ licensee institute or order or agree to the institution of a PATENT
+ CHALLENGE, then Tokutek may terminate any rights granted to you
+ under this License.
+*/
+
+// test that basic scoped malloc works with a thread
+
+#ident "Copyright (c) 2015 Tokutek Inc. All rights reserved."
+#include <toku_portability.h>
+#include <toku_assert.h>
+#include <toku_pthread.h>
+#include <util/scoped_malloc.h>
+
+static void sm_test(void) {
+ toku::scoped_malloc a(1);
+ {
+ toku::scoped_malloc b(2);
+ {
+ toku::scoped_malloc c(3);
+ }
+ }
+}
+
+static void *sm_test_f(void *arg) {
+ sm_test();
+ return arg;
+}
+
+int main(void) {
+ toku_scoped_malloc_init();
+
+ // run the test
+ toku_pthread_t tid;
+ int r;
+ r = toku_pthread_create(&tid, NULL, sm_test_f, NULL);
+ assert_zero(r);
+ void *ret;
+ r = toku_pthread_join(tid, &ret);
+ assert_zero(r);
+
+ toku_scoped_malloc_destroy();
+
+ return 0;
+}
diff --git a/storage/tokudb/ft-index/util/tests/sm-crash-double-free.cc b/storage/tokudb/ft-index/util/tests/sm-crash-double-free.cc
new file mode 100644
index 00000000000..653d4148fd0
--- /dev/null
+++ b/storage/tokudb/ft-index/util/tests/sm-crash-double-free.cc
@@ -0,0 +1,128 @@
+/* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
+// vim: ft=cpp:expandtab:ts=8:sw=4:softtabstop=4:
+#ident "$Id$"
+/*
+COPYING CONDITIONS NOTICE:
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of version 2 of the GNU General Public License as
+ published by the Free Software Foundation, and provided that the
+ following conditions are met:
+
+ * Redistributions of source code must retain this COPYING
+ CONDITIONS NOTICE, the COPYRIGHT NOTICE (below), the
+ DISCLAIMER (below), the UNIVERSITY PATENT NOTICE (below), the
+ PATENT MARKING NOTICE (below), and the PATENT RIGHTS
+ GRANT (below).
+
+ * Redistributions in binary form must reproduce this COPYING
+ CONDITIONS NOTICE, the COPYRIGHT NOTICE (below), the
+ DISCLAIMER (below), the UNIVERSITY PATENT NOTICE (below), the
+ PATENT MARKING NOTICE (below), and the PATENT RIGHTS
+ GRANT (below) in the documentation and/or other materials
+ provided with the distribution.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+
+COPYRIGHT NOTICE:
+
+ TokuFT, Tokutek Fractal Tree Indexing Library.
+ Copyright (C) 2007-2013 Tokutek, Inc.
+
+DISCLAIMER:
+
+ 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.
+
+UNIVERSITY PATENT NOTICE:
+
+ The technology is licensed by the Massachusetts Institute of
+ Technology, Rutgers State University of New Jersey, and the Research
+ Foundation of State University of New York at Stony Brook under
+ United States of America Serial No. 11/760379 and to the patents
+ and/or patent applications resulting from it.
+
+PATENT MARKING NOTICE:
+
+ This software is covered by US Patent No. 8,185,551.
+ This software is covered by US Patent No. 8,489,638.
+
+PATENT RIGHTS GRANT:
+
+ "THIS IMPLEMENTATION" means the copyrightable works distributed by
+ Tokutek as part of the Fractal Tree project.
+
+ "PATENT CLAIMS" means the claims of patents that are owned or
+ licensable by Tokutek, both currently or in the future; and that in
+ the absence of this license would be infringed by THIS
+ IMPLEMENTATION or by using or running THIS IMPLEMENTATION.
+
+ "PATENT CHALLENGE" shall mean a challenge to the validity,
+ patentability, enforceability and/or non-infringement of any of the
+ PATENT CLAIMS or otherwise opposing any of the PATENT CLAIMS.
+
+ Tokutek hereby grants to you, for the term and geographical scope of
+ the PATENT CLAIMS, a non-exclusive, no-charge, royalty-free,
+ irrevocable (except as stated in this section) patent license to
+ make, have made, use, offer to sell, sell, import, transfer, and
+ otherwise run, modify, and propagate the contents of THIS
+ IMPLEMENTATION, where such license applies only to the PATENT
+ CLAIMS. This grant does not include claims that would be infringed
+ only as a consequence of further modifications of THIS
+ IMPLEMENTATION. If you or your agent or licensee institute or order
+ or agree to the institution of patent litigation against any entity
+ (including a cross-claim or counterclaim in a lawsuit) alleging that
+ THIS IMPLEMENTATION constitutes direct or contributory patent
+ infringement, or inducement of patent infringement, then any rights
+ granted to you under this License shall terminate as of the date
+ such litigation is filed. If you or your agent or exclusive
+ licensee institute or order or agree to the institution of a PATENT
+ CHALLENGE, then Tokutek may terminate any rights granted to you
+ under this License.
+*/
+
+// force a race between the scoped malloc global destructor and a thread variable destructor
+
+#ident "Copyright (c) 2015 Tokutek Inc. All rights reserved."
+#define TOKU_SCOPED_MALLOC_DEBUG 1
+#include <toku_portability.h>
+#include <toku_assert.h>
+#include <toku_pthread.h>
+#include <toku_race_tools.h>
+#include <util/scoped_malloc.h>
+
+volatile int state = 0;
+
+static void sm_test(void) {
+ toku::scoped_malloc a(1);
+}
+
+static void *sm_test_f(void *arg) {
+ sm_test();
+ state = 1;
+ while (state != 2) sleep(1);
+ return arg;
+}
+
+int main(void) {
+ TOKU_VALGRIND_HG_DISABLE_CHECKING(&state, sizeof state);
+ state = 0;
+ toku_scoped_malloc_init();
+ toku_pthread_t tid;
+ int r;
+ r = toku_pthread_create(&tid, NULL, sm_test_f, NULL);
+ assert_zero(r);
+ void *ret;
+ while (state != 1) sleep(1);
+ toku_scoped_malloc_destroy_set();
+ state = 2;
+ r = toku_pthread_join(tid, &ret);
+ assert_zero(r);
+ toku_scoped_malloc_destroy_key();
+ return 0;
+}
diff --git a/storage/tokudb/ha_tokudb.cc b/storage/tokudb/ha_tokudb.cc
index f68b50b9fdc..1b022cd3468 100644
--- a/storage/tokudb/ha_tokudb.cc
+++ b/storage/tokudb/ha_tokudb.cc
@@ -172,6 +172,31 @@ static inline uint32_t get_len_of_offsets(KEY_AND_COL_INFO* kc_info, TABLE_SHARE
}
+static int get_thread_query_string(my_thread_id id, String &qs) {
+ mysql_mutex_lock(&LOCK_thread_count);
+ I_List_iterator<THD> it(threads);
+ THD* tmp;
+ while ((tmp= it++))
+ {
+ /* ID */
+ if (tmp->thread_id == id)
+ {
+ /* Lock THD mutex that protects its data when looking at it. */
+ mysql_mutex_lock(&tmp->LOCK_thd_data);
+
+ /* INFO */
+ if (tmp->query())
+ {
+ qs = String(tmp->query(), tmp->query_length(), system_charset_info);
+ }
+ mysql_mutex_unlock(&tmp->LOCK_thd_data);
+ break;
+ }
+ }
+ mysql_mutex_unlock(&LOCK_thread_count);
+ return 0;
+}
+
static int allocate_key_and_col_info ( TABLE_SHARE* table_share, KEY_AND_COL_INFO* kc_info) {
int error;
//
@@ -3247,7 +3272,7 @@ void ha_tokudb::start_bulk_insert(ha_rows rows) {
lock_count = 0;
if ((rows == 0 || rows > 1) && share->try_table_lock) {
- if (get_prelock_empty(thd) && may_table_be_empty(transaction)) {
+ if (get_prelock_empty(thd) && may_table_be_empty(transaction) && transaction != NULL) {
if (using_ignore || is_insert_ignore(thd) || thd->lex->duplicates != DUP_ERROR
|| table->s->next_number_key_offset) {
acquire_table_lock(transaction, lock_write);
@@ -3557,8 +3582,12 @@ static void maybe_do_unique_checks_delay(THD *thd) {
}
}
+static bool need_read_only(THD *thd) {
+ return opt_readonly || !THDVAR(thd, rpl_check_readonly);
+}
+
static bool do_unique_checks(THD *thd, bool do_rpl_event) {
- if (do_rpl_event && thd->slave_thread && opt_readonly && !THDVAR(thd, rpl_unique_checks))
+ if (do_rpl_event && thd->slave_thread && need_read_only(thd) && !THDVAR(thd, rpl_unique_checks))
return false;
else
return !thd_test_options(thd, OPTION_RELAXED_UNIQUE_CHECKS);
@@ -3934,13 +3963,13 @@ int ha_tokudb::write_row(uchar * record) {
goto cleanup;
}
}
-
txn = create_sub_trans ? sub_trans : transaction;
-
+ if (tokudb_debug & TOKUDB_DEBUG_TXN) {
+ TOKUDB_HANDLER_TRACE("txn %p", txn);
+ }
if (tokudb_debug & TOKUDB_DEBUG_CHECK_KEY) {
test_row_packing(record,&prim_key,&row);
}
-
if (loader) {
error = loader->put(loader, &prim_key, &row);
if (error) {
@@ -4214,7 +4243,7 @@ int ha_tokudb::delete_row(const uchar * record) {
bool has_null;
THD* thd = ha_thd();
uint curr_num_DBs;
- tokudb_trx_data* trx = (tokudb_trx_data *) thd_get_ha_data(thd, tokudb_hton);;
+ tokudb_trx_data* trx = (tokudb_trx_data *) thd_get_ha_data(thd, tokudb_hton);
ha_statistic_increment(&SSV::ha_delete_count);
@@ -4239,10 +4268,14 @@ int ha_tokudb::delete_row(const uchar * record) {
goto cleanup;
}
+ if (tokudb_debug & TOKUDB_DEBUG_TXN) {
+ TOKUDB_HANDLER_TRACE("all %p stmt %p sub_sp_level %p transaction %p", trx->all, trx->stmt, trx->sub_sp_level, transaction);
+ }
+
error = db_env->del_multiple(
db_env,
share->key_file[primary_key],
- transaction,
+ transaction,
&prim_key,
&row,
curr_num_DBs,
@@ -5375,9 +5408,12 @@ int ha_tokudb::get_next(uchar* buf, int direction, DBT* key_to_compare, bool do_
}
if (!error) {
- tokudb_trx_data* trx = (tokudb_trx_data *) thd_get_ha_data(ha_thd(), tokudb_hton);
+ THD *thd = ha_thd();
+ tokudb_trx_data* trx = (tokudb_trx_data *) thd_get_ha_data(thd, tokudb_hton);
trx->stmt_progress.queried++;
- track_progress(ha_thd());
+ track_progress(thd);
+ if (thd_killed(thd))
+ error = ER_ABORTING_CONNECTION;
}
cleanup:
return error;
@@ -6168,6 +6204,12 @@ int ha_tokudb::external_lock(THD * thd, int lock_type) {
if (error) { goto cleanup; }
thd_set_ha_data(thd, tokudb_hton, trx);
}
+
+ if (tokudb_debug & TOKUDB_DEBUG_TXN) {
+ TOKUDB_HANDLER_TRACE("trx %p %p %p %p %u %u", trx->all, trx->stmt, trx->sp_level, trx->sub_sp_level,
+ trx->tokudb_lock_count, trx->create_lock_count);
+ }
+
if (trx->all == NULL) {
trx->sp_level = NULL;
}
@@ -6176,22 +6218,16 @@ int ha_tokudb::external_lock(THD * thd, int lock_type) {
if (lock_type == F_WRLCK) {
use_write_locks = true;
}
- if (!trx->tokudb_lock_count++) {
- if (trx->stmt) {
- if (tokudb_debug & TOKUDB_DEBUG_TXN) {
- TOKUDB_HANDLER_TRACE("stmt already set %p %p %p %p", trx->all, trx->stmt, trx->sp_level, trx->sub_sp_level);
- }
- } else {
- assert(trx->stmt == 0);
- transaction = NULL; // Safety
- error = create_txn(thd, trx);
- if (error) {
- trx->tokudb_lock_count--; // We didn't get the lock
- goto cleanup;
- }
+ if (!trx->stmt) {
+ transaction = NULL; // Safety
+ error = create_txn(thd, trx);
+ if (error) {
+ goto cleanup;
}
+ trx->create_lock_count = trx->tokudb_lock_count;
}
transaction = trx->sub_sp_level;
+ trx->tokudb_lock_count++;
}
else {
tokudb_pthread_mutex_lock(&share->mutex);
@@ -6206,21 +6242,24 @@ int ha_tokudb::external_lock(THD * thd, int lock_type) {
added_rows = 0;
deleted_rows = 0;
share->rows_from_locked_table = 0;
- if (trx->tokudb_lock_count > 0 && !--trx->tokudb_lock_count) {
- if (trx->stmt) {
- /*
- F_UNLCK is done without a transaction commit / rollback.
- This happens if the thread didn't update any rows
- We must in this case commit the work to keep the row locks
- */
- DBUG_PRINT("trans", ("commiting non-updating transaction"));
- reset_stmt_progress(&trx->stmt_progress);
- commit_txn(trx->stmt, 0);
- trx->stmt = NULL;
- trx->sub_sp_level = NULL;
+ if (trx->tokudb_lock_count > 0) {
+ if (--trx->tokudb_lock_count <= trx->create_lock_count) {
+ trx->create_lock_count = 0;
+ if (trx->stmt) {
+ /*
+ F_UNLCK is done without a transaction commit / rollback.
+ This happens if the thread didn't update any rows
+ We must in this case commit the work to keep the row locks
+ */
+ DBUG_PRINT("trans", ("commiting non-updating transaction"));
+ reset_stmt_progress(&trx->stmt_progress);
+ commit_txn(trx->stmt, 0);
+ trx->stmt = NULL;
+ trx->sub_sp_level = NULL;
+ }
}
+ transaction = NULL;
}
- transaction = NULL;
}
cleanup:
if (tokudb_debug & TOKUDB_DEBUG_LOCK)
@@ -6235,8 +6274,9 @@ cleanup:
*/
int ha_tokudb::start_stmt(THD * thd, thr_lock_type lock_type) {
TOKUDB_HANDLER_DBUG_ENTER("cmd %d lock %d %s", thd_sql_command(thd), lock_type, share->table_name);
- if (0)
+ if (tokudb_debug & TOKUDB_DEBUG_LOCK) {
TOKUDB_HANDLER_TRACE("q %s", thd->query());
+ }
int error = 0;
tokudb_trx_data *trx = (tokudb_trx_data *) thd_get_ha_data(thd, tokudb_hton);
@@ -6246,6 +6286,11 @@ int ha_tokudb::start_stmt(THD * thd, thr_lock_type lock_type) {
thd_set_ha_data(thd, tokudb_hton, trx);
}
+ if (tokudb_debug & TOKUDB_DEBUG_TXN) {
+ TOKUDB_HANDLER_TRACE("trx %p %p %p %p %u %u", trx->all, trx->stmt, trx->sp_level, trx->sub_sp_level,
+ trx->tokudb_lock_count, trx->create_lock_count);
+ }
+
/*
note that trx->stmt may have been already initialized as start_stmt()
is called for *each table* not for each storage engine,
@@ -6256,9 +6301,7 @@ int ha_tokudb::start_stmt(THD * thd, thr_lock_type lock_type) {
if (error) {
goto cleanup;
}
- if (tokudb_debug & TOKUDB_DEBUG_TXN) {
- TOKUDB_HANDLER_TRACE("%p %p %p %p %u", trx->all, trx->stmt, trx->sp_level, trx->sub_sp_level, trx->tokudb_lock_count);
- }
+ trx->create_lock_count = trx->tokudb_lock_count;
}
else {
if (tokudb_debug & TOKUDB_DEBUG_TXN) {
@@ -7149,12 +7192,15 @@ To rename the table, make sure no transactions touch the table.", from, to);
double ha_tokudb::scan_time() {
TOKUDB_HANDLER_DBUG_ENTER("");
double ret_val = (double)stats.records / 3;
+ if (tokudb_debug & TOKUDB_DEBUG_RETURN) {
+ TOKUDB_HANDLER_TRACE("return %" PRIu64 " %f", (uint64_t) stats.records, ret_val);
+ }
DBUG_RETURN(ret_val);
}
double ha_tokudb::keyread_time(uint index, uint ranges, ha_rows rows)
{
- TOKUDB_HANDLER_DBUG_ENTER("");
+ TOKUDB_HANDLER_DBUG_ENTER("%u %u %" PRIu64, index, ranges, (uint64_t) rows);
double ret_val;
if (index == primary_key || key_is_clustering(&table->key_info[index])) {
ret_val = read_time(index, ranges, rows);
@@ -7172,6 +7218,9 @@ double ha_tokudb::keyread_time(uint index, uint ranges, ha_rows rows)
(table->key_info[index].key_length +
ref_length) + 1);
ret_val = (rows + keys_per_block - 1)/ keys_per_block;
+ if (tokudb_debug & TOKUDB_DEBUG_RETURN) {
+ TOKUDB_HANDLER_TRACE("return %f", ret_val);
+ }
DBUG_RETURN(ret_val);
}
@@ -7192,7 +7241,7 @@ double ha_tokudb::read_time(
ha_rows rows
)
{
- TOKUDB_HANDLER_DBUG_ENTER("");
+ TOKUDB_HANDLER_DBUG_ENTER("%u %u %" PRIu64, index, ranges, (uint64_t) rows);
double total_scan;
double ret_val;
bool is_primary = (index == primary_key);
@@ -7234,12 +7283,18 @@ double ha_tokudb::read_time(
ret_val = is_clustering ? ret_val + 0.00001 : ret_val;
cleanup:
+ if (tokudb_debug & TOKUDB_DEBUG_RETURN) {
+ TOKUDB_HANDLER_TRACE("return %f", ret_val);
+ }
DBUG_RETURN(ret_val);
}
double ha_tokudb::index_only_read_time(uint keynr, double records) {
- TOKUDB_HANDLER_DBUG_ENTER("");
+ TOKUDB_HANDLER_DBUG_ENTER("%u %f", keynr, records);
double ret_val = keyread_time(keynr, 1, (ha_rows)records);
+ if (tokudb_debug & TOKUDB_DEBUG_RETURN) {
+ TOKUDB_HANDLER_TRACE("return %f", ret_val);
+ }
DBUG_RETURN(ret_val);
}
@@ -7257,7 +7312,7 @@ double ha_tokudb::index_only_read_time(uint keynr, double records) {
// HA_POS_ERROR - Something is wrong with the index tree
//
ha_rows ha_tokudb::records_in_range(uint keynr, key_range* start_key, key_range* end_key) {
- TOKUDB_HANDLER_DBUG_ENTER("");
+ TOKUDB_HANDLER_DBUG_ENTER("%d %p %p", keynr, start_key, end_key);
DBT *pleft_key, *pright_key;
DBT left_key, right_key;
ha_rows ret_val = HA_TOKUDB_RANGE_COUNT;
@@ -7313,6 +7368,9 @@ ha_rows ha_tokudb::records_in_range(uint keynr, key_range* start_key, key_range*
ret_val = (ha_rows) (rows <= 1 ? 1 : rows);
cleanup:
+ if (tokudb_debug & TOKUDB_DEBUG_RETURN) {
+ TOKUDB_HANDLER_TRACE("return %" PRIu64 " %" PRIu64, (uint64_t) ret_val, rows);
+ }
DBUG_RETURN(ret_val);
}
diff --git a/storage/tokudb/ha_tokudb_admin.cc b/storage/tokudb/ha_tokudb_admin.cc
index c3b895bf4f4..42205c6d6be 100644
--- a/storage/tokudb/ha_tokudb_admin.cc
+++ b/storage/tokudb/ha_tokudb_admin.cc
@@ -89,6 +89,8 @@ PATENT RIGHTS GRANT:
#ident "Copyright (c) 2007-2013 Tokutek Inc. All rights reserved."
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."
+#include "toku_time.h"
+
struct analyze_progress_extra {
THD *thd;
TOKUDB_SHARE *share;
@@ -119,9 +121,10 @@ static int analyze_progress(void *v_extra, uint64_t rows) {
progress_time = (float) (t_now - t_start) / (float) t_limit;
char *write_status_msg = extra->write_status_msg;
TABLE_SHARE *table_share = extra->table_share;
- sprintf(write_status_msg, "%s.%s.%s %u of %u %.lf%% rows %.lf%% time",
- table_share->db.str, table_share->table_name.str, extra->key_name,
- extra->key_i, table_share->keys, progress_rows * 100.0, progress_time * 100.0);
+ sprintf(write_status_msg, "%.*s.%.*s.%s %u of %u %.lf%% rows %.lf%% time",
+ (int) table_share->db.length, table_share->db.str,
+ (int) table_share->table_name.length, table_share->table_name.str,
+ extra->key_name, extra->key_i, table_share->keys, progress_rows * 100.0, progress_time * 100.0);
thd_proc_info(thd, write_status_msg);
return 0;
}
@@ -154,18 +157,47 @@ int ha_tokudb::analyze(THD *thd, HA_CHECK_OPT *check_opt) {
bool is_unique = false;
if (i == primary_key || (key_info->flags & HA_NOSAME))
is_unique = true;
+ uint64_t rows = 0;
+ uint64_t deleted_rows = 0;
int error = tokudb::analyze_card(share->key_file[i], txn, is_unique, num_key_parts, &rec_per_key[total_key_parts],
- tokudb_cmp_dbt_key_parts, analyze_progress, &analyze_progress_extra);
+ tokudb_cmp_dbt_key_parts, analyze_progress, &analyze_progress_extra,
+ &rows, &deleted_rows);
+ sql_print_information("tokudb analyze %d %" PRIu64 " %" PRIu64, error, rows, deleted_rows);
if (error != 0 && error != ETIME) {
result = HA_ADMIN_FAILED;
- } else {
- // debug
- if (tokudb_debug & TOKUDB_DEBUG_ANALYZE) {
- TOKUDB_HANDLER_TRACE("%s.%s.%s",
- table_share->db.str, table_share->table_name.str, i == primary_key ? "primary" : table_share->key_info[i].name);
- for (uint j = 0; j < num_key_parts; j++)
- TOKUDB_HANDLER_TRACE("%lu", rec_per_key[total_key_parts+j]);
- }
+ }
+ if (error != 0 && rows == 0 && deleted_rows > 0) {
+ result = HA_ADMIN_FAILED;
+ }
+ double f = THDVAR(thd, analyze_delete_fraction);
+ if (result == HA_ADMIN_FAILED || (double) deleted_rows > f * (rows + deleted_rows)) {
+ char name[256]; int namelen;
+ namelen = snprintf(name, sizeof name, "%.*s.%.*s.%s",
+ (int) table_share->db.length, table_share->db.str,
+ (int) table_share->table_name.length, table_share->table_name.str,
+ key_name);
+ thd->protocol->prepare_for_resend();
+ thd->protocol->store(name, namelen, system_charset_info);
+ thd->protocol->store("analyze", 7, system_charset_info);
+ thd->protocol->store("info", 4, system_charset_info);
+ char rowmsg[256]; int rowmsglen;
+ rowmsglen = snprintf(rowmsg, sizeof rowmsg, "rows processed %" PRIu64 " rows deleted %" PRIu64, rows, deleted_rows);
+ thd->protocol->store(rowmsg, rowmsglen, system_charset_info);
+ thd->protocol->write();
+
+ sql_print_information("tokudb analyze on %.*s %.*s",
+ namelen, name, rowmsglen, rowmsg);
+ }
+ if (tokudb_debug & TOKUDB_DEBUG_ANALYZE) {
+ char name[256]; int namelen;
+ namelen = snprintf(name, sizeof name, "%.*s.%.*s.%s",
+ (int) table_share->db.length, table_share->db.str,
+ (int) table_share->table_name.length, table_share->table_name.str,
+ key_name);
+ TOKUDB_HANDLER_TRACE("%.*s rows %" PRIu64 " deleted %" PRIu64,
+ namelen, name, rows, deleted_rows);
+ for (uint j = 0; j < num_key_parts; j++)
+ TOKUDB_HANDLER_TRACE("%lu", rec_per_key[total_key_parts+j]);
}
total_key_parts += num_key_parts;
}
@@ -186,9 +218,12 @@ typedef struct hot_optimize_context {
uint progress_stage;
uint current_table;
uint num_tables;
+ float progress_limit;
+ uint64_t progress_last_time;
+ uint64_t throttle;
} *HOT_OPTIMIZE_CONTEXT;
-static int hot_poll_fun(void *extra, float progress) {
+static int hot_optimize_progress_fun(void *extra, float progress) {
HOT_OPTIMIZE_CONTEXT context = (HOT_OPTIMIZE_CONTEXT)extra;
if (thd_killed(context->thd)) {
sprintf(context->write_status_msg, "The process has been killed, aborting hot optimize.");
@@ -207,14 +242,27 @@ static int hot_poll_fun(void *extra, float progress) {
// the percentage we report here is for the current stage/db
thd_progress_report(context->thd, (unsigned long long) percentage, 100);
#endif
- return 0;
+
+ // throttle the optimize table
+ if (context->throttle) {
+ uint64_t time_now = toku_current_time_microsec();
+ uint64_t dt = time_now - context->progress_last_time;
+ uint64_t throttle_time = 1000000ULL / context->throttle;
+ if (throttle_time > dt) {
+ usleep(throttle_time - dt);
+ }
+ context->progress_last_time = toku_current_time_microsec();
+ }
+
+ // return 1 if progress has reach the progress limit
+ return progress >= context->progress_limit;
}
// flatten all DB's in this table, to do so, peform hot optimize on each db
int ha_tokudb::do_optimize(THD *thd) {
TOKUDB_HANDLER_DBUG_ENTER("%s", share->table_name);
+ int error = 0;
const char *orig_proc_info = tokudb_thd_get_proc_info(thd);
- int error;
uint curr_num_DBs = table->s->keys + tokudb_test(hidden_primary_key);
#ifdef HA_TOKUDB_HAS_THD_PROGRESS
@@ -225,11 +273,21 @@ int ha_tokudb::do_optimize(THD *thd) {
// for each DB, run optimize and hot_optimize
for (uint i = 0; i < curr_num_DBs; i++) {
+ // only optimize the index if it matches the optimize_index_name session variable
+ const char *optimize_index_name = THDVAR(thd, optimize_index_name);
+ if (optimize_index_name) {
+ const char *this_index_name = i >= table_share->keys ? "primary" : table_share->key_info[i].name;
+ if (strcasecmp(optimize_index_name, this_index_name) != 0) {
+ continue;
+ }
+ }
+
DB* db = share->key_file[i];
error = db->optimize(db);
if (error) {
goto cleanup;
}
+
struct hot_optimize_context hc;
memset(&hc, 0, sizeof hc);
hc.thd = thd;
@@ -237,8 +295,11 @@ int ha_tokudb::do_optimize(THD *thd) {
hc.ha = this;
hc.current_table = i;
hc.num_tables = curr_num_DBs;
+ hc.progress_limit = THDVAR(thd, optimize_index_fraction);
+ hc.progress_last_time = toku_current_time_microsec();
+ hc.throttle = THDVAR(thd, optimize_throttle);
uint64_t loops_run;
- error = db->hot_optimize(db, NULL, NULL, hot_poll_fun, &hc, &loops_run);
+ error = db->hot_optimize(db, NULL, NULL, hot_optimize_progress_fun, &hc, &loops_run);
if (error) {
goto cleanup;
}
@@ -278,8 +339,10 @@ static int ha_tokudb_check_progress(void *extra, float progress) {
static void ha_tokudb_check_info(THD *thd, TABLE *table, const char *msg) {
if (thd->vio_ok()) {
- char tablename[256];
- snprintf(tablename, sizeof tablename, "%s.%s", table->s->db.str, table->s->table_name.str);
+ char tablename[table->s->db.length + 1 + table->s->table_name.length + 1];
+ snprintf(tablename, sizeof tablename, "%.*s.%.*s",
+ (int) table->s->db.length, table->s->db.str,
+ (int) table->s->table_name.length, table->s->table_name.str);
thd->protocol->prepare_for_resend();
thd->protocol->store(tablename, strlen(tablename), system_charset_info);
thd->protocol->store("check", 5, system_charset_info);
@@ -328,6 +391,11 @@ int ha_tokudb::check(THD *thd, HA_CHECK_OPT *check_opt) {
}
struct check_context check_context = { thd };
r = db->verify_with_progress(db, ha_tokudb_check_progress, &check_context, (tokudb_debug & TOKUDB_DEBUG_CHECK) != 0, keep_going);
+ if (r != 0) {
+ char msg[32 + strlen(kname)];
+ sprintf(msg, "Corrupt %s", kname);
+ ha_tokudb_check_info(thd, table, msg);
+ }
snprintf(write_status_msg, sizeof write_status_msg, "%s key=%s %u result=%d", share->table_name, kname, i, r);
thd_proc_info(thd, write_status_msg);
if (tokudb_debug & TOKUDB_DEBUG_CHECK) {
diff --git a/storage/tokudb/ha_tokudb_alter_56.cc b/storage/tokudb/ha_tokudb_alter_56.cc
index cae50446fa0..213b58459bc 100644
--- a/storage/tokudb/ha_tokudb_alter_56.cc
+++ b/storage/tokudb/ha_tokudb_alter_56.cc
@@ -784,13 +784,16 @@ bool ha_tokudb::commit_inplace_alter_table(TABLE *altered_table, Alter_inplace_i
assert(trx->tokudb_lock_count > 0);
// for partitioned tables, we use a single transaction to do all of the partition changes. the tokudb_lock_count
// is a reference count for each of the handlers to the same transaction. obviously, we want to only abort once.
- if (!--trx->tokudb_lock_count) {
- abort_txn(ctx->alter_txn);
- ctx->alter_txn = NULL;
- trx->stmt = NULL;
- trx->sub_sp_level = NULL;
+ if (trx->tokudb_lock_count > 0) {
+ if (--trx->tokudb_lock_count <= trx->create_lock_count) {
+ trx->create_lock_count = 0;
+ abort_txn(ctx->alter_txn);
+ ctx->alter_txn = NULL;
+ trx->stmt = NULL;
+ trx->sub_sp_level = NULL;
+ }
+ transaction = NULL;
}
- transaction = NULL;
if (ctx->add_index_changed) {
restore_add_index(table, ha_alter_info->index_add_count, ctx->incremented_num_DBs, ctx->modified_DBs);
diff --git a/storage/tokudb/hatoku_defines.h b/storage/tokudb/hatoku_defines.h
index 57214038500..bc3d890fffe 100644
--- a/storage/tokudb/hatoku_defines.h
+++ b/storage/tokudb/hatoku_defines.h
@@ -162,6 +162,9 @@ PATENT RIGHTS GRANT:
#define TOKU_INCLUDE_EXTENDED_KEYS 1
#define TOKU_INCLUDE_OPTION_STRUCTS 1
#define TOKU_CLUSTERING_IS_COVERING 1
+#define TOKU_INCLUDE_LOCK_TIMEOUT_QUERY_STRING 1
+#else
+#define TOKU_INCLUDE_LOCK_TIMEOUT_QUERY_STRING 1
#endif
#define TOKU_INCLUDE_HANDLERTON_HANDLE_FATAL_SIGNAL 0 /* MariaDB 5.5 */
@@ -352,6 +355,7 @@ typedef struct st_tokudb_trx_data {
DB_TXN *sp_level;
DB_TXN *sub_sp_level;
uint tokudb_lock_count;
+ uint create_lock_count;
tokudb_stmt_progress stmt_progress;
bool checkpoint_lock_taken;
LIST *handlers;
diff --git a/storage/tokudb/hatoku_hton.cc b/storage/tokudb/hatoku_hton.cc
index 99f9cc56037..a804fc80489 100644
--- a/storage/tokudb/hatoku_hton.cc
+++ b/storage/tokudb/hatoku_hton.cc
@@ -780,7 +780,7 @@ extern "C" enum durability_properties thd_get_durability_property(const MYSQL_TH
#endif
// Determine if an fsync is used when a transaction is committed.
-static bool tokudb_fsync_on_commit(THD *thd, tokudb_trx_data *trx, DB_TXN *txn) {
+static bool tokudb_sync_on_commit(THD *thd, tokudb_trx_data *trx, DB_TXN *txn) {
#if MYSQL_VERSION_ID >= 50600
// Check the client durability property which is set during 2PC
if (thd_get_durability_property(thd) == HA_IGNORE_DURABILITY)
@@ -791,17 +791,19 @@ static bool tokudb_fsync_on_commit(THD *thd, tokudb_trx_data *trx, DB_TXN *txn)
if (txn->is_prepared(txn) && mysql_bin_log.is_open())
return false;
#endif
+ if (tokudb_fsync_log_period > 0)
+ return false;
return THDVAR(thd, commit_sync) != 0;
}
static int tokudb_commit(handlerton * hton, THD * thd, bool all) {
- TOKUDB_DBUG_ENTER("");
+ TOKUDB_DBUG_ENTER("%u", all);
DBUG_PRINT("trans", ("ending transaction %s", all ? "all" : "stmt"));
tokudb_trx_data *trx = (tokudb_trx_data *) thd_get_ha_data(thd, hton);
DB_TXN **txn = all ? &trx->all : &trx->stmt;
DB_TXN *this_txn = *txn;
if (this_txn) {
- uint32_t syncflag = tokudb_fsync_on_commit(thd, trx, this_txn) ? 0 : DB_TXN_NOSYNC;
+ uint32_t syncflag = tokudb_sync_on_commit(thd, trx, this_txn) ? 0 : DB_TXN_NOSYNC;
if (tokudb_debug & TOKUDB_DEBUG_TXN) {
TOKUDB_TRACE("commit trx %u txn %p syncflag %u", all, this_txn, syncflag);
}
@@ -811,11 +813,11 @@ static int tokudb_commit(handlerton * hton, THD * thd, bool all) {
commit_txn_with_progress(this_txn, syncflag, thd);
// test hook to induce a crash on a debug build
DBUG_EXECUTE_IF("tokudb_crash_commit_after", DBUG_SUICIDE(););
- if (this_txn == trx->sp_level) {
- trx->sp_level = 0;
- }
- *txn = 0;
+ *txn = NULL;
trx->sub_sp_level = NULL;
+ if (this_txn == trx->sp_level || trx->all == NULL) {
+ trx->sp_level = NULL;
+ }
}
else if (tokudb_debug & TOKUDB_DEBUG_TXN) {
TOKUDB_TRACE("nothing to commit %d", all);
@@ -825,7 +827,7 @@ static int tokudb_commit(handlerton * hton, THD * thd, bool all) {
}
static int tokudb_rollback(handlerton * hton, THD * thd, bool all) {
- TOKUDB_DBUG_ENTER("");
+ TOKUDB_DBUG_ENTER("%u", all);
DBUG_PRINT("trans", ("aborting transaction %s", all ? "all" : "stmt"));
tokudb_trx_data *trx = (tokudb_trx_data *) thd_get_ha_data(thd, hton);
DB_TXN **txn = all ? &trx->all : &trx->stmt;
@@ -836,11 +838,11 @@ static int tokudb_rollback(handlerton * hton, THD * thd, bool all) {
}
tokudb_cleanup_handlers(trx, this_txn);
abort_txn_with_progress(this_txn, thd);
- if (this_txn == trx->sp_level) {
- trx->sp_level = 0;
- }
- *txn = 0;
+ *txn = NULL;
trx->sub_sp_level = NULL;
+ if (this_txn == trx->sp_level || trx->all == NULL) {
+ trx->sp_level = NULL;
+ }
}
else {
if (tokudb_debug & TOKUDB_DEBUG_TXN) {
@@ -852,6 +854,13 @@ static int tokudb_rollback(handlerton * hton, THD * thd, bool all) {
}
#if TOKU_INCLUDE_XA
+static bool tokudb_sync_on_prepare(void) {
+ // skip sync of log if fsync log period > 0
+ if (tokudb_fsync_log_period > 0)
+ return false;
+ else
+ return true;
+}
static int tokudb_xa_prepare(handlerton* hton, THD* thd, bool all) {
TOKUDB_DBUG_ENTER("");
@@ -866,6 +875,7 @@ static int tokudb_xa_prepare(handlerton* hton, THD* thd, bool all) {
tokudb_trx_data *trx = (tokudb_trx_data *) thd_get_ha_data(thd, hton);
DB_TXN* txn = all ? trx->all : trx->stmt;
if (txn) {
+ uint32_t syncflag = tokudb_sync_on_prepare() ? 0 : DB_TXN_NOSYNC;
if (tokudb_debug & TOKUDB_DEBUG_TXN) {
TOKUDB_TRACE("doing txn prepare:%d:%p", all, txn);
}
@@ -874,7 +884,7 @@ static int tokudb_xa_prepare(handlerton* hton, THD* thd, bool all) {
thd_get_xid(thd, (MYSQL_XID*) &thd_xid);
// test hook to induce a crash on a debug build
DBUG_EXECUTE_IF("tokudb_crash_prepare_before", DBUG_SUICIDE(););
- r = txn->xa_prepare(txn, &thd_xid);
+ r = txn->xa_prepare(txn, &thd_xid, syncflag);
// test hook to induce a crash on a debug build
DBUG_EXECUTE_IF("tokudb_crash_prepare_after", DBUG_SUICIDE(););
}
@@ -939,7 +949,7 @@ cleanup:
#endif
static int tokudb_savepoint(handlerton * hton, THD * thd, void *savepoint) {
- TOKUDB_DBUG_ENTER("");
+ TOKUDB_DBUG_ENTER("%p", savepoint);
int error;
SP_INFO save_info = (SP_INFO)savepoint;
tokudb_trx_data *trx = (tokudb_trx_data *) thd_get_ha_data(thd, hton);
@@ -960,6 +970,9 @@ static int tokudb_savepoint(handlerton * hton, THD * thd, void *savepoint) {
trx->sp_level = save_info->txn;
save_info->in_sub_stmt = false;
}
+ if (tokudb_debug & TOKUDB_DEBUG_TXN) {
+ TOKUDB_TRACE("begin txn %p", save_info->txn);
+ }
save_info->trx = trx;
error = 0;
cleanup:
@@ -967,7 +980,7 @@ cleanup:
}
static int tokudb_rollback_to_savepoint(handlerton * hton, THD * thd, void *savepoint) {
- TOKUDB_DBUG_ENTER("");
+ TOKUDB_DBUG_ENTER("%p", savepoint);
int error;
SP_INFO save_info = (SP_INFO)savepoint;
DB_TXN* parent = NULL;
@@ -975,6 +988,9 @@ static int tokudb_rollback_to_savepoint(handlerton * hton, THD * thd, void *save
tokudb_trx_data *trx = (tokudb_trx_data *) thd_get_ha_data(thd, hton);
parent = txn_to_rollback->parent;
+ if (tokudb_debug & TOKUDB_DEBUG_TXN) {
+ TOKUDB_TRACE("rollback txn %p", txn_to_rollback);
+ }
if (!(error = txn_to_rollback->abort(txn_to_rollback))) {
if (save_info->in_sub_stmt) {
trx->sub_sp_level = parent;
@@ -988,24 +1004,27 @@ static int tokudb_rollback_to_savepoint(handlerton * hton, THD * thd, void *save
}
static int tokudb_release_savepoint(handlerton * hton, THD * thd, void *savepoint) {
- TOKUDB_DBUG_ENTER("");
- int error;
-
+ TOKUDB_DBUG_ENTER("%p", savepoint);
+ int error = 0;
SP_INFO save_info = (SP_INFO)savepoint;
DB_TXN* parent = NULL;
DB_TXN* txn_to_commit = save_info->txn;
tokudb_trx_data *trx = (tokudb_trx_data *) thd_get_ha_data(thd, hton);
parent = txn_to_commit->parent;
- if (!(error = txn_to_commit->commit(txn_to_commit, 0))) {
+ if (tokudb_debug & TOKUDB_DEBUG_TXN) {
+ TOKUDB_TRACE("commit txn %p", txn_to_commit);
+ }
+ DB_TXN *child = txn_to_commit->get_child(txn_to_commit);
+ if (child == NULL && !(error = txn_to_commit->commit(txn_to_commit, 0))) {
if (save_info->in_sub_stmt) {
trx->sub_sp_level = parent;
}
else {
trx->sp_level = parent;
}
- save_info->txn = NULL;
}
+ save_info->txn = NULL;
TOKUDB_DBUG_RETURN(error);
}
@@ -1393,8 +1412,6 @@ static MYSQL_SYSVAR_STR(data_dir, tokudb_data_dir, PLUGIN_VAR_READONLY, "TokuDB
static MYSQL_SYSVAR_STR(version, tokudb_version, PLUGIN_VAR_READONLY, "TokuDB Version", NULL, NULL, NULL);
-static MYSQL_SYSVAR_UINT(init_flags, tokudb_init_flags, PLUGIN_VAR_READONLY, "Sets TokuDB DB_ENV->open flags", NULL, NULL, tokudb_init_flags, 0, ~0U, 0);
-
static MYSQL_SYSVAR_UINT(write_status_frequency, tokudb_write_status_frequency, 0, "TokuDB frequency that show processlist updates status of writes", NULL, NULL, 1000, 0, ~0U, 0);
static MYSQL_SYSVAR_UINT(read_status_frequency, tokudb_read_status_frequency, 0, "TokuDB frequency that show processlist updates status of reads", NULL, NULL, 10000, 0, ~0U, 0);
static MYSQL_SYSVAR_INT(fs_reserve_percent, tokudb_fs_reserve_percent, PLUGIN_VAR_READONLY, "TokuDB file system space reserve (percent free required)", NULL, NULL, 5, 0, 100, 0);
@@ -1431,7 +1448,6 @@ static struct st_mysql_sys_var *tokudb_system_variables[] = {
MYSQL_SYSVAR(create_index_online),
MYSQL_SYSVAR(disable_prefetching),
MYSQL_SYSVAR(version),
- MYSQL_SYSVAR(init_flags),
MYSQL_SYSVAR(checkpointing_period),
MYSQL_SYSVAR(prelock_empty),
MYSQL_SYSVAR(checkpoint_lock),
@@ -1450,6 +1466,7 @@ static struct st_mysql_sys_var *tokudb_system_variables[] = {
MYSQL_SYSVAR(disable_slow_upsert),
#endif
MYSQL_SYSVAR(analyze_time),
+ MYSQL_SYSVAR(analyze_delete_fraction),
MYSQL_SYSVAR(fsync_log_period),
#if TOKU_INCLUDE_HANDLERTON_HANDLE_FATAL_SIGNAL
MYSQL_SYSVAR(gdb_path),
@@ -1472,6 +1489,10 @@ static struct st_mysql_sys_var *tokudb_system_variables[] = {
MYSQL_SYSVAR(rpl_unique_checks_delay),
MYSQL_SYSVAR(rpl_lookup_rows),
MYSQL_SYSVAR(rpl_lookup_rows_delay),
+ MYSQL_SYSVAR(rpl_check_readonly),
+ MYSQL_SYSVAR(optimize_index_name),
+ MYSQL_SYSVAR(optimize_index_fraction),
+ MYSQL_SYSVAR(optimize_throttle),
NULL
};
@@ -1693,6 +1714,8 @@ static int tokudb_fractal_tree_info(TABLE *table, THD *thd) {
error = tmp_cursor->c_get(tmp_cursor, &curr_key, &curr_val, DB_NEXT);
if (!error) {
error = tokudb_report_fractal_tree_info_for_db(&curr_key, &curr_val, table, thd);
+ if (error)
+ error = 0; // ignore read uncommitted errors
}
if (!error && thd_killed(thd))
error = ER_QUERY_INTERRUPTED;
@@ -1964,6 +1987,35 @@ static int tokudb_fractal_tree_block_map_done(void *p) {
return 0;
}
+#if TOKU_INCLUDE_LOCK_TIMEOUT_QUERY_STRING
+struct tokudb_search_txn_extra {
+ bool match_found;
+ uint64_t match_txn_id;
+ uint64_t match_client_id;
+};
+
+static int tokudb_search_txn_callback(DB_TXN *txn, iterate_row_locks_callback iterate_locks, void *locks_extra, void *extra) {
+ uint64_t txn_id = txn->id64(txn);
+ uint64_t client_id = txn->get_client_id(txn);
+ struct tokudb_search_txn_extra *e = reinterpret_cast<struct tokudb_search_txn_extra *>(extra);
+ if (e->match_txn_id == txn_id) {
+ e->match_found = true;
+ e->match_client_id = client_id;
+ return 1;
+ }
+ return 0;
+}
+
+static bool tokudb_txn_id_to_client_id(THD *thd, uint64_t blocking_txnid, uint64_t *blocking_client_id) {
+ struct tokudb_search_txn_extra e = { false, blocking_txnid, 0};
+ (void) db_env->iterate_live_transactions(db_env, tokudb_search_txn_callback, &e);
+ if (e.match_found) {
+ *blocking_client_id = e.match_client_id;
+ }
+ return e.match_found;
+}
+#endif
+
static void tokudb_pretty_key(const DB *db, const DBT *key, const char *default_key, String *out) {
if (key->data == NULL) {
out->append(default_key);
@@ -2013,8 +2065,9 @@ static void tokudb_lock_timeout_callback(DB *db, uint64_t requesting_txnid, cons
// generate a JSON document with the lock timeout info
String log_str;
log_str.append("{");
+ uint64_t mysql_thread_id = thd->thread_id;
log_str.append("\"mysql_thread_id\":");
- log_str.append_ulonglong(thd->thread_id);
+ log_str.append_ulonglong(mysql_thread_id);
log_str.append(", \"dbname\":");
log_str.append("\""); log_str.append(tokudb_get_index_name(db)); log_str.append("\"");
log_str.append(", \"requesting_txnid\":");
@@ -2054,7 +2107,18 @@ static void tokudb_lock_timeout_callback(DB *db, uint64_t requesting_txnid, cons
}
// dump to stderr
if (lock_timeout_debug & 2) {
- sql_print_error("%s: %s", tokudb_hton_name, log_str.c_ptr());
+ sql_print_error("%s: lock timeout %s", tokudb_hton_name, log_str.c_ptr());
+ LEX_STRING *qs = thd_query_string(thd);
+ sql_print_error("%s: requesting_thread_id:%" PRIu64 " q:%.*s", tokudb_hton_name, mysql_thread_id, (int) qs->length, qs->str);
+#if TOKU_INCLUDE_LOCK_TIMEOUT_QUERY_STRING
+ uint64_t blocking_thread_id = 0;
+ if (tokudb_txn_id_to_client_id(thd, blocking_txnid, &blocking_thread_id)) {
+ String blocking_qs;
+ if (get_thread_query_string(blocking_thread_id, blocking_qs) == 0) {
+ sql_print_error("%s: blocking_thread_id:%" PRIu64 " q:%.*s", tokudb_hton_name, blocking_thread_id, blocking_qs.length(), blocking_qs.c_ptr());
+ }
+ }
+#endif
}
}
}
@@ -2064,6 +2128,7 @@ static struct st_mysql_information_schema tokudb_trx_information_schema = { MYSQ
static ST_FIELD_INFO tokudb_trx_field_info[] = {
{"trx_id", 0, MYSQL_TYPE_LONGLONG, 0, 0, NULL, SKIP_OPEN_TABLE },
{"trx_mysql_thread_id", 0, MYSQL_TYPE_LONGLONG, 0, 0, NULL, SKIP_OPEN_TABLE },
+ {"trx_time", 0, MYSQL_TYPE_LONGLONG, 0, 0, NULL, SKIP_OPEN_TABLE },
{NULL, 0, MYSQL_TYPE_NULL, 0, 0, NULL, SKIP_OPEN_TABLE}
};
@@ -2072,12 +2137,17 @@ struct tokudb_trx_extra {
TABLE *table;
};
-static int tokudb_trx_callback(uint64_t txn_id, uint64_t client_id, iterate_row_locks_callback iterate_locks, void *locks_extra, void *extra) {
+static int tokudb_trx_callback(DB_TXN *txn, iterate_row_locks_callback iterate_locks, void *locks_extra, void *extra) {
+ uint64_t txn_id = txn->id64(txn);
+ uint64_t client_id = txn->get_client_id(txn);
+ uint64_t start_time = txn->get_start_time(txn);
struct tokudb_trx_extra *e = reinterpret_cast<struct tokudb_trx_extra *>(extra);
THD *thd = e->thd;
TABLE *table = e->table;
table->field[0]->store(txn_id, false);
table->field[1]->store(client_id, false);
+ uint64_t tnow = (uint64_t) time(NULL);
+ table->field[2]->store(tnow >= start_time ? tnow - start_time : 0, false);
int error = schema_table_store_record(thd, table);
if (!error && thd_killed(thd))
error = ER_QUERY_INTERRUPTED;
@@ -2225,7 +2295,9 @@ struct tokudb_locks_extra {
TABLE *table;
};
-static int tokudb_locks_callback(uint64_t txn_id, uint64_t client_id, iterate_row_locks_callback iterate_locks, void *locks_extra, void *extra) {
+static int tokudb_locks_callback(DB_TXN *txn, iterate_row_locks_callback iterate_locks, void *locks_extra, void *extra) {
+ uint64_t txn_id = txn->id64(txn);
+ uint64_t client_id = txn->get_client_id(txn);
struct tokudb_locks_extra *e = reinterpret_cast<struct tokudb_locks_extra *>(extra);
THD *thd = e->thd;
TABLE *table = e->table;
diff --git a/storage/tokudb/hatoku_hton.h b/storage/tokudb/hatoku_hton.h
index 797e8ff48bc..71d78e57d63 100644
--- a/storage/tokudb/hatoku_hton.h
+++ b/storage/tokudb/hatoku_hton.h
@@ -316,16 +316,9 @@ static MYSQL_THDVAR_BOOL(disable_slow_upsert,
);
#endif
-static MYSQL_THDVAR_UINT(analyze_time,
- 0,
- "analyze time",
- NULL,
- NULL,
- 5, // default
- 0, // min
- ~0U, // max
- 1 // blocksize
-);
+static MYSQL_THDVAR_UINT(analyze_time, 0, "analyze time (seconds)", NULL /*check*/, NULL /*update*/, 5 /*default*/, 0 /*min*/, ~0U /*max*/, 1 /*blocksize*/);
+
+static MYSQL_THDVAR_DOUBLE(analyze_delete_fraction, 0, "fraction of rows allowed to be deleted", NULL /*check*/, NULL /*update*/, 1.0 /*def*/, 0 /*min*/, 1.0 /*max*/, 1);
static void tokudb_checkpoint_lock(THD * thd);
static void tokudb_checkpoint_unlock(THD * thd);
@@ -430,7 +423,7 @@ static int tokudb_killed_callback(void) {
return thd_killed(thd);
}
-static bool tokudb_killed_thd_callback(void *extra) {
+static bool tokudb_killed_thd_callback(void *extra, uint64_t deleted_rows) {
THD *thd = static_cast<THD *>(extra);
return thd_killed(thd) != 0;
}
@@ -491,6 +484,15 @@ static MYSQL_THDVAR_BOOL(rpl_lookup_rows, PLUGIN_VAR_THDLOCAL, "lookup a row on
static MYSQL_THDVAR_ULONGLONG(rpl_lookup_rows_delay, PLUGIN_VAR_THDLOCAL, "time in milliseconds to add to lookups on replication slave",
NULL, NULL, 0 /*default*/, 0 /*min*/, ~0ULL /*max*/, 1 /*blocksize*/);
+static MYSQL_THDVAR_BOOL(rpl_check_readonly, PLUGIN_VAR_THDLOCAL, "check if the slave is read only",
+ NULL /*check*/, NULL /*update*/, true /*default*/);
+
+static MYSQL_THDVAR_STR(optimize_index_name, PLUGIN_VAR_THDLOCAL + PLUGIN_VAR_MEMALLOC, "optimize index name (default all indexes)", NULL /*check*/, NULL /*update*/, NULL /*default*/);
+
+static MYSQL_THDVAR_DOUBLE(optimize_index_fraction, 0, "optimize index fraction (default 1.0 all)", NULL /*check*/, NULL /*update*/, 1.0 /*def*/, 0 /*min*/, 1.0 /*max*/, 1);
+
+static MYSQL_THDVAR_ULONGLONG(optimize_throttle, 0, "optimize throttle (default no throttle)", NULL /*check*/, NULL /*update*/, 0 /*def*/, 0 /*min*/, ~0ULL /*max*/, 1);
+
extern HASH tokudb_open_tables;
extern pthread_mutex_t tokudb_mutex;
extern uint32_t tokudb_write_status_frequency;
diff --git a/storage/tokudb/mysql-test/rpl/disabled.def b/storage/tokudb/mysql-test/rpl/disabled.def
index efa4be9e16c..4c1a9a3e785 100644
--- a/storage/tokudb/mysql-test/rpl/disabled.def
+++ b/storage/tokudb/mysql-test/rpl/disabled.def
@@ -10,3 +10,6 @@ rpl_tokudb_write_pk: unreliable, uses timestamp differences
rpl_tokudb_write_pk_uc1: unreliable, uses timestamp differences
rpl_tokudb_write_unique: unreliable, uses timestamp differences
rpl_tokudb_write_unique_uc1: unreliable, uses timestamp differences
+rpl_tokudb_read_only_ff: unreliable, uses timestamp differences
+rpl_tokudb_read_only_tf: unreliable, uses timestamp differences
+rpl_tokudb_read_only_tt: unreliable, uses timestamp differences
diff --git a/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_read_only_ff.result b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_read_only_ff.result
new file mode 100644
index 00000000000..6db2036d933
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_read_only_ff.result
@@ -0,0 +1,14 @@
+include/master-slave.inc
+[connection master]
+drop table if exists t;
+create table t (a bigint not null, primary key(a)) engine=tokudb;
+select unix_timestamp() into @tstart;
+insert into t values (1);
+insert into t values (2),(3);
+insert into t values (4);
+select unix_timestamp()-@tstart <= 10;
+unix_timestamp()-@tstart <= 10
+1
+include/diff_tables.inc [master:test.t, slave:test.t]
+drop table if exists t;
+include/rpl_end.inc
diff --git a/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_read_only_ft.result b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_read_only_ft.result
new file mode 100644
index 00000000000..3bcd3e8ccdd
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_read_only_ft.result
@@ -0,0 +1,14 @@
+include/master-slave.inc
+[connection master]
+drop table if exists t;
+create table t (a bigint not null, primary key(a)) engine=tokudb;
+select unix_timestamp() into @tstart;
+insert into t values (1);
+insert into t values (2),(3);
+insert into t values (4);
+select unix_timestamp()-@tstart <= 10;
+unix_timestamp()-@tstart <= 10
+0
+include/diff_tables.inc [master:test.t, slave:test.t]
+drop table if exists t;
+include/rpl_end.inc
diff --git a/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_read_only_tf.result b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_read_only_tf.result
new file mode 100644
index 00000000000..6db2036d933
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_read_only_tf.result
@@ -0,0 +1,14 @@
+include/master-slave.inc
+[connection master]
+drop table if exists t;
+create table t (a bigint not null, primary key(a)) engine=tokudb;
+select unix_timestamp() into @tstart;
+insert into t values (1);
+insert into t values (2),(3);
+insert into t values (4);
+select unix_timestamp()-@tstart <= 10;
+unix_timestamp()-@tstart <= 10
+1
+include/diff_tables.inc [master:test.t, slave:test.t]
+drop table if exists t;
+include/rpl_end.inc
diff --git a/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_read_only_tt.result b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_read_only_tt.result
new file mode 100644
index 00000000000..6db2036d933
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_read_only_tt.result
@@ -0,0 +1,14 @@
+include/master-slave.inc
+[connection master]
+drop table if exists t;
+create table t (a bigint not null, primary key(a)) engine=tokudb;
+select unix_timestamp() into @tstart;
+insert into t values (1);
+insert into t values (2),(3);
+insert into t values (4);
+select unix_timestamp()-@tstart <= 10;
+unix_timestamp()-@tstart <= 10
+1
+include/diff_tables.inc [master:test.t, slave:test.t]
+drop table if exists t;
+include/rpl_end.inc
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_read_only_ff-slave.opt b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_read_only_ff-slave.opt
new file mode 100644
index 00000000000..b9eb687d8d5
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_read_only_ff-slave.opt
@@ -0,0 +1 @@
+--read-only=OFF --tokudb-rpl-check-readonly=OFF --tokudb-rpl-unique-checks-delay=5000 --tokudb-rpl-unique-checks=OFF
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_read_only_ff.test b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_read_only_ff.test
new file mode 100644
index 00000000000..c77e4b49605
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_read_only_ff.test
@@ -0,0 +1,53 @@
+# test replicated write rows log events on a table with a primary key.
+# the slave is read only with tokudb unique checks disabled.
+
+source include/have_tokudb.inc;
+let $engine=tokudb;
+source include/have_binlog_format_row.inc;
+source include/master-slave.inc;
+
+# initialize
+connection master;
+disable_warnings;
+drop table if exists t;
+enable_warnings;
+
+connection slave;
+# show variables like 'read_only';
+# show variables like 'tokudb_rpl_unique_checks%';
+
+# insert some rows
+connection master;
+# select @@binlog_format;
+# select @@autocommit;
+eval create table t (a bigint not null, primary key(a)) engine=$engine;
+# show create table t;
+select unix_timestamp() into @tstart;
+insert into t values (1);
+insert into t values (2),(3);
+insert into t values (4);
+
+sync_slave_with_master;
+# source include/sync_slave_sql_with_master.inc;
+
+connection master;
+select unix_timestamp()-@tstart <= 10;
+
+connection slave;
+# insert into t values (5); # test read-only
+# show create table t;
+
+# diff tables
+connection master;
+--let $diff_tables= master:test.t, slave:test.t
+source include/diff_tables.inc;
+
+# cleanup
+connection master;
+drop table if exists t;
+
+sync_slave_with_master;
+# source include/sync_slave_sql_with_master.inc;
+
+source include/rpl_end.inc;
+
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_read_only_ft-slave.opt b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_read_only_ft-slave.opt
new file mode 100644
index 00000000000..8283875e8a7
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_read_only_ft-slave.opt
@@ -0,0 +1 @@
+--read-only=OFF --tokudb-rpl-check-readonly=ON --tokudb-rpl-unique-checks-delay=5000 --tokudb-rpl-unique-checks=OFF
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_read_only_ft.test b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_read_only_ft.test
new file mode 100644
index 00000000000..c77e4b49605
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_read_only_ft.test
@@ -0,0 +1,53 @@
+# test replicated write rows log events on a table with a primary key.
+# the slave is read only with tokudb unique checks disabled.
+
+source include/have_tokudb.inc;
+let $engine=tokudb;
+source include/have_binlog_format_row.inc;
+source include/master-slave.inc;
+
+# initialize
+connection master;
+disable_warnings;
+drop table if exists t;
+enable_warnings;
+
+connection slave;
+# show variables like 'read_only';
+# show variables like 'tokudb_rpl_unique_checks%';
+
+# insert some rows
+connection master;
+# select @@binlog_format;
+# select @@autocommit;
+eval create table t (a bigint not null, primary key(a)) engine=$engine;
+# show create table t;
+select unix_timestamp() into @tstart;
+insert into t values (1);
+insert into t values (2),(3);
+insert into t values (4);
+
+sync_slave_with_master;
+# source include/sync_slave_sql_with_master.inc;
+
+connection master;
+select unix_timestamp()-@tstart <= 10;
+
+connection slave;
+# insert into t values (5); # test read-only
+# show create table t;
+
+# diff tables
+connection master;
+--let $diff_tables= master:test.t, slave:test.t
+source include/diff_tables.inc;
+
+# cleanup
+connection master;
+drop table if exists t;
+
+sync_slave_with_master;
+# source include/sync_slave_sql_with_master.inc;
+
+source include/rpl_end.inc;
+
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_read_only_tf-slave.opt b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_read_only_tf-slave.opt
new file mode 100644
index 00000000000..21e57d27c17
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_read_only_tf-slave.opt
@@ -0,0 +1 @@
+--read-only=ON --tokudb-rpl-check-readonly=OFF --tokudb-rpl-unique-checks-delay=5000 --tokudb-rpl-unique-checks=OFF
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_read_only_tf.test b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_read_only_tf.test
new file mode 100644
index 00000000000..c77e4b49605
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_read_only_tf.test
@@ -0,0 +1,53 @@
+# test replicated write rows log events on a table with a primary key.
+# the slave is read only with tokudb unique checks disabled.
+
+source include/have_tokudb.inc;
+let $engine=tokudb;
+source include/have_binlog_format_row.inc;
+source include/master-slave.inc;
+
+# initialize
+connection master;
+disable_warnings;
+drop table if exists t;
+enable_warnings;
+
+connection slave;
+# show variables like 'read_only';
+# show variables like 'tokudb_rpl_unique_checks%';
+
+# insert some rows
+connection master;
+# select @@binlog_format;
+# select @@autocommit;
+eval create table t (a bigint not null, primary key(a)) engine=$engine;
+# show create table t;
+select unix_timestamp() into @tstart;
+insert into t values (1);
+insert into t values (2),(3);
+insert into t values (4);
+
+sync_slave_with_master;
+# source include/sync_slave_sql_with_master.inc;
+
+connection master;
+select unix_timestamp()-@tstart <= 10;
+
+connection slave;
+# insert into t values (5); # test read-only
+# show create table t;
+
+# diff tables
+connection master;
+--let $diff_tables= master:test.t, slave:test.t
+source include/diff_tables.inc;
+
+# cleanup
+connection master;
+drop table if exists t;
+
+sync_slave_with_master;
+# source include/sync_slave_sql_with_master.inc;
+
+source include/rpl_end.inc;
+
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_read_only_tt-slave.opt b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_read_only_tt-slave.opt
new file mode 100644
index 00000000000..fd77ee0da9c
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_read_only_tt-slave.opt
@@ -0,0 +1 @@
+--read-only=ON --tokudb-rpl-check-readonly=ON --tokudb-rpl-unique-checks-delay=5000 --tokudb-rpl-unique-checks=OFF
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_read_only_tt.test b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_read_only_tt.test
new file mode 100644
index 00000000000..c77e4b49605
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_read_only_tt.test
@@ -0,0 +1,53 @@
+# test replicated write rows log events on a table with a primary key.
+# the slave is read only with tokudb unique checks disabled.
+
+source include/have_tokudb.inc;
+let $engine=tokudb;
+source include/have_binlog_format_row.inc;
+source include/master-slave.inc;
+
+# initialize
+connection master;
+disable_warnings;
+drop table if exists t;
+enable_warnings;
+
+connection slave;
+# show variables like 'read_only';
+# show variables like 'tokudb_rpl_unique_checks%';
+
+# insert some rows
+connection master;
+# select @@binlog_format;
+# select @@autocommit;
+eval create table t (a bigint not null, primary key(a)) engine=$engine;
+# show create table t;
+select unix_timestamp() into @tstart;
+insert into t values (1);
+insert into t values (2),(3);
+insert into t values (4);
+
+sync_slave_with_master;
+# source include/sync_slave_sql_with_master.inc;
+
+connection master;
+select unix_timestamp()-@tstart <= 10;
+
+connection slave;
+# insert into t values (5); # test read-only
+# show create table t;
+
+# diff tables
+connection master;
+--let $diff_tables= master:test.t, slave:test.t
+source include/diff_tables.inc;
+
+# cleanup
+connection master;
+drop table if exists t;
+
+sync_slave_with_master;
+# source include/sync_slave_sql_with_master.inc;
+
+source include/rpl_end.inc;
+
diff --git a/storage/tokudb/mysql-test/tokudb/r/i_s_tokudb_lock_waits_released.result b/storage/tokudb/mysql-test/tokudb/r/i_s_tokudb_lock_waits_released.result
index 018900c7b98..190581eddae 100644
--- a/storage/tokudb/mysql-test/tokudb/r/i_s_tokudb_lock_waits_released.result
+++ b/storage/tokudb/mysql-test/tokudb/r/i_s_tokudb_lock_waits_released.result
@@ -2,7 +2,7 @@ set default_storage_engine='tokudb';
set tokudb_prelock_empty=false;
drop table if exists t;
create table t (id int primary key);
-select * from information_schema.tokudb_trx;
+select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
trx_id trx_mysql_thread_id
select * from information_schema.tokudb_locks;
locks_trx_id locks_mysql_thread_id locks_dname locks_key_left locks_key_right locks_table_schema locks_table_name locks_table_dictionary_name
@@ -19,7 +19,7 @@ TRX_ID MYSQL_ID ./test/t-main 0001000000 0001000000 test t main
select * from information_schema.tokudb_lock_waits;
requesting_trx_id blocking_trx_id lock_waits_dname lock_waits_key_left lock_waits_key_right lock_waits_start_time lock_waits_table_schema lock_waits_table_name lock_waits_table_dictionary_name
REQUEST_TRX_ID BLOCK_TRX_ID ./test/t-main 0001000000 0001000000 LOCK_WAITS_START_TIME test t main
-select * from information_schema.tokudb_trx;
+select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
trx_id trx_mysql_thread_id
TRX_ID MYSQL_ID
TRX_ID MYSQL_ID
@@ -31,7 +31,7 @@ select * from information_schema.tokudb_lock_waits;
requesting_trx_id blocking_trx_id lock_waits_dname lock_waits_key_left lock_waits_key_right lock_waits_start_time lock_waits_table_schema lock_waits_table_name lock_waits_table_dictionary_name
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
commit;
-select * from information_schema.tokudb_trx;
+select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
trx_id trx_mysql_thread_id
select * from information_schema.tokudb_locks;
locks_trx_id locks_mysql_thread_id locks_dname locks_key_left locks_key_right locks_table_schema locks_table_name locks_table_dictionary_name
@@ -48,7 +48,7 @@ TRX_ID MYSQL_ID ./test/t-main 0001000000 0001000000 test t main
select * from information_schema.tokudb_lock_waits;
requesting_trx_id blocking_trx_id lock_waits_dname lock_waits_key_left lock_waits_key_right lock_waits_start_time lock_waits_table_schema lock_waits_table_name lock_waits_table_dictionary_name
REQUEST_TRX_ID BLOCK_TRX_ID ./test/t-main 0001000000 0001000000 LOCK_WAITS_START_TIME test t main
-select * from information_schema.tokudb_trx;
+select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
trx_id trx_mysql_thread_id
TRX_ID MYSQL_ID
TRX_ID MYSQL_ID
@@ -59,7 +59,7 @@ TRX_ID MYSQL_ID ./test/t-main 0001000000 0001000000 test t main
select * from information_schema.tokudb_lock_waits;
requesting_trx_id blocking_trx_id lock_waits_dname lock_waits_key_left lock_waits_key_right lock_waits_start_time lock_waits_table_schema lock_waits_table_name lock_waits_table_dictionary_name
commit;
-select * from information_schema.tokudb_trx;
+select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
trx_id trx_mysql_thread_id
select * from information_schema.tokudb_locks;
locks_trx_id locks_mysql_thread_id locks_dname locks_key_left locks_key_right locks_table_schema locks_table_name locks_table_dictionary_name
diff --git a/storage/tokudb/mysql-test/tokudb/r/i_s_tokudb_lock_waits_timeout.result b/storage/tokudb/mysql-test/tokudb/r/i_s_tokudb_lock_waits_timeout.result
index b9fca50b507..13cdad7a438 100644
--- a/storage/tokudb/mysql-test/tokudb/r/i_s_tokudb_lock_waits_timeout.result
+++ b/storage/tokudb/mysql-test/tokudb/r/i_s_tokudb_lock_waits_timeout.result
@@ -2,7 +2,7 @@ set default_storage_engine='tokudb';
set tokudb_prelock_empty=false;
drop table if exists t;
create table t (id int primary key);
-select * from information_schema.tokudb_trx;
+select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
trx_id trx_mysql_thread_id
select * from information_schema.tokudb_locks;
locks_trx_id locks_mysql_thread_id locks_dname locks_key_left locks_key_right locks_table_schema locks_table_name locks_table_dictionary_name
@@ -19,7 +19,7 @@ TRX_ID MYSQL_ID ./test/t-main 0001000000 0001000000 test t main
select * from information_schema.tokudb_lock_waits;
requesting_trx_id blocking_trx_id lock_waits_dname lock_waits_key_left lock_waits_key_right lock_waits_start_time lock_waits_table_schema lock_waits_table_name lock_waits_table_dictionary_name
REQUEST_TRX_ID BLOCK_TRX_ID ./test/t-main 0001000000 0001000000 LOCK_WAITS_START_TIME test t main
-select * from information_schema.tokudb_trx;
+select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
trx_id trx_mysql_thread_id
TRX_ID MYSQL_ID
TRX_ID MYSQL_ID
@@ -30,7 +30,7 @@ select * from information_schema.tokudb_lock_waits;
requesting_trx_id blocking_trx_id lock_waits_dname lock_waits_key_left lock_waits_key_right lock_waits_start_time lock_waits_table_schema lock_waits_table_name lock_waits_table_dictionary_name
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
commit;
-select * from information_schema.tokudb_trx;
+select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
trx_id trx_mysql_thread_id
select * from information_schema.tokudb_locks;
locks_trx_id locks_mysql_thread_id locks_dname locks_key_left locks_key_right locks_table_schema locks_table_name locks_table_dictionary_name
diff --git a/storage/tokudb/mysql-test/tokudb/r/i_s_tokudb_trx.result b/storage/tokudb/mysql-test/tokudb/r/i_s_tokudb_trx.result
index e4c1adcca19..63e4816e16e 100644
--- a/storage/tokudb/mysql-test/tokudb/r/i_s_tokudb_trx.result
+++ b/storage/tokudb/mysql-test/tokudb/r/i_s_tokudb_trx.result
@@ -1,23 +1,23 @@
set default_storage_engine='tokudb';
set tokudb_prelock_empty=false;
drop table if exists t;
-select * from information_schema.tokudb_trx;
+select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
trx_id trx_mysql_thread_id
set autocommit=0;
create table t (id int primary key);
insert into t values (1);
-select * from information_schema.tokudb_trx;
+select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
trx_id trx_mysql_thread_id
TXN_ID_DEFAULT CLIENT_ID_DEFAULT
commit;
-select * from information_schema.tokudb_trx;
+select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
trx_id trx_mysql_thread_id
set autocommit=0;
insert into t values (2);
-select * from information_schema.tokudb_trx;
+select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
trx_id trx_mysql_thread_id
TXN_ID_A CLIENT_ID_A
commit;
-select * from information_schema.tokudb_trx;
+select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
trx_id trx_mysql_thread_id
drop table t;
diff --git a/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_lock_waits_released.test b/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_lock_waits_released.test
index c4f9ccefe5c..0f712000527 100644
--- a/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_lock_waits_released.test
+++ b/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_lock_waits_released.test
@@ -13,7 +13,7 @@ create table t (id int primary key);
# verify that txn_a insert (1) blocks txn_b insert (1) and txn_b gets a duplicate key error
# should be empty
-select * from information_schema.tokudb_trx;
+select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
select * from information_schema.tokudb_locks;
select * from information_schema.tokudb_lock_waits;
@@ -43,7 +43,7 @@ select * from information_schema.tokudb_lock_waits;
# should find the presence of two transactions
replace_column 1 TRX_ID 2 MYSQL_ID;
-select * from information_schema.tokudb_trx;
+select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
connection conn_a;
commit;
@@ -66,7 +66,7 @@ disconnect conn_b;
# verify that the lock on the 2nd transaction has been released
# should be be empty
-select * from information_schema.tokudb_trx;
+select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
select * from information_schema.tokudb_locks;
select * from information_schema.tokudb_lock_waits;
@@ -96,7 +96,7 @@ select * from information_schema.tokudb_lock_waits;
# should find the presence of two transactions
replace_column 1 TRX_ID 2 MYSQL_ID;
-select * from information_schema.tokudb_trx;
+select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
connection conn_a;
commit;
@@ -116,7 +116,7 @@ disconnect conn_b;
# verify that the lock on the 2nd transaction has been released
# should be be empty
-select * from information_schema.tokudb_trx;
+select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
select * from information_schema.tokudb_locks;
select * from information_schema.tokudb_lock_waits;
diff --git a/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_lock_waits_timeout.test b/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_lock_waits_timeout.test
index 75929fa3b3d..3011443fa04 100644
--- a/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_lock_waits_timeout.test
+++ b/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_lock_waits_timeout.test
@@ -10,7 +10,7 @@ enable_warnings;
create table t (id int primary key);
# should be empty
-select * from information_schema.tokudb_trx;
+select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
select * from information_schema.tokudb_locks;
select * from information_schema.tokudb_lock_waits;
@@ -40,7 +40,7 @@ select * from information_schema.tokudb_lock_waits;
# should find the presence of two transactions
replace_column 1 TRX_ID 2 MYSQL_ID;
-select * from information_schema.tokudb_trx;
+select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
connection conn_a;
sleep 5; # sleep longer than the lock timer to force a lock timeout on txn_b
@@ -61,7 +61,7 @@ disconnect conn_a;
disconnect conn_b;
# should be be empty
-select * from information_schema.tokudb_trx;
+select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
select * from information_schema.tokudb_locks;
select * from information_schema.tokudb_lock_waits;
diff --git a/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_trx.test b/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_trx.test
index b1d5c7e5009..d3c2636ba54 100644
--- a/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_trx.test
+++ b/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_trx.test
@@ -8,7 +8,7 @@ drop table if exists t;
enable_warnings;
# should be empty
-select * from information_schema.tokudb_trx;
+select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
# should have my txn
let $default_id=`select connection_id()`;
@@ -16,11 +16,11 @@ set autocommit=0;
create table t (id int primary key);
insert into t values (1);
replace_column 1 TXN_ID_DEFAULT 2 CLIENT_ID_DEFAULT;
-eval select * from information_schema.tokudb_trx;
+eval select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
# should be empty
commit;
-select * from information_schema.tokudb_trx;
+select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
connect(conn_a,localhost,root,,);
let a_id=`select connection_id()`;
@@ -29,13 +29,13 @@ insert into t values (2);
connection default;
replace_column 1 TXN_ID_A 2 CLIENT_ID_A;
-eval select * from information_schema.tokudb_trx;
+eval select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
connection conn_a;
commit;
connection default;
# should be empty
-select * from information_schema.tokudb_trx;
+select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
disconnect conn_a;
diff --git a/storage/tokudb/mysql-test/tokudb_bugs/r/5733_tokudb.result b/storage/tokudb/mysql-test/tokudb_bugs/r/5733_tokudb.result
index 07e8b37c263..a05587cb0a6 100644
--- a/storage/tokudb/mysql-test/tokudb_bugs/r/5733_tokudb.result
+++ b/storage/tokudb/mysql-test/tokudb_bugs/r/5733_tokudb.result
@@ -10005,7 +10005,7 @@ insert into t values (9999,0);
commit;
explain select id from t where id>0 limit 10;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t index_or_range PRIMARY PRIMARY 8 NULL # Using where; Using index_or_range
+1 SIMPLE t range_or_index PRIMARY PRIMARY 8 NULL # Using where; Using index
explain select * from t where id>0 limit 10;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t range PRIMARY PRIMARY 8 NULL # Using where
diff --git a/storage/tokudb/mysql-test/tokudb_bugs/r/db788-optimize-index-name.result b/storage/tokudb/mysql-test/tokudb_bugs/r/db788-optimize-index-name.result
new file mode 100644
index 00000000000..019a8299f3c
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb_bugs/r/db788-optimize-index-name.result
@@ -0,0 +1,19 @@
+set default_storage_engine='tokudb';
+drop table if exists t;
+create table t (a int, b int, c int, primary key(a), key(b), key(c));
+set tokudb_optimize_index_name='primary';
+optimize table t;
+Table Op Msg_type Msg_text
+test.t optimize note Table does not support optimize, doing recreate + analyze instead
+test.t optimize status OK
+set tokudb_optimize_index_name='b';
+optimize table t;
+Table Op Msg_type Msg_text
+test.t optimize note Table does not support optimize, doing recreate + analyze instead
+test.t optimize status OK
+set tokudb_optimize_index_name='c';
+optimize table t;
+Table Op Msg_type Msg_text
+test.t optimize note Table does not support optimize, doing recreate + analyze instead
+test.t optimize status OK
+drop table t;
diff --git a/storage/tokudb/mysql-test/tokudb_bugs/r/db801.result b/storage/tokudb/mysql-test/tokudb_bugs/r/db801.result
new file mode 100644
index 00000000000..800db69ba39
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb_bugs/r/db801.result
@@ -0,0 +1,18 @@
+set default_storage_engine=tokudb;
+drop table if exists t;
+create table t (id int not null primary key, c int not null) engine=tokudb;
+insert into t values (1,0);
+begin;
+update t set c=10 where id=1;
+update t set c=100;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+rollback;
+drop table t;
+create table t (id int not null primary key, c int not null) engine=tokudb partition by hash(id) partitions 1;
+insert into t values (1,0);
+begin;
+update t set c=10 where id=1;
+update t set c=100;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+rollback;
+drop table t;
diff --git a/storage/tokudb/mysql-test/tokudb_bugs/r/db805.result b/storage/tokudb/mysql-test/tokudb_bugs/r/db805.result
new file mode 100644
index 00000000000..1bc0372f1b8
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb_bugs/r/db805.result
@@ -0,0 +1,18 @@
+drop table if exists t1,t3;
+create table t3(a3 int,b3 decimal(0,0),c3 int,d3 int,primary key(a3,b3)) engine=TOKUDB;
+LOCK TABLES t3 WRITE;
+create temporary table t1(f1 int,index(f1)) engine=innodb;
+INSERT INTO t1 VALUES(1),(1),(1);
+select * from t1;
+f1
+1
+1
+1
+ALTER TABLE t1 engine=TOKUDB;
+select * from t1;
+f1
+1
+1
+1
+unlock tables;
+drop table t1,t3;
diff --git a/storage/tokudb/mysql-test/tokudb_bugs/r/db806.result b/storage/tokudb/mysql-test/tokudb_bugs/r/db806.result
new file mode 100644
index 00000000000..ae87dbab281
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb_bugs/r/db806.result
@@ -0,0 +1,9 @@
+drop table if exists t1,t3;
+CREATE TABLE t3(a int,c int,d int)engine=TOKUDB;
+lock table t3 read;
+create temporary table t1 engine=tokudb as SELECT 1;
+select * from t1;
+1
+1
+unlock tables;
+drop table t1,t3;
diff --git a/storage/tokudb/mysql-test/tokudb_bugs/r/db811.result b/storage/tokudb/mysql-test/tokudb_bugs/r/db811.result
new file mode 100644
index 00000000000..1d26f43c9dd
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb_bugs/r/db811.result
@@ -0,0 +1,14 @@
+drop table if exists t2,t3,t4;
+CREATE TABLE t3(a INT,b INT,UNIQUE KEY (a,b)) engine=TOKUDB;
+CREATE TABLE t4(c1 FLOAT ZEROFILL) engine=innodb;
+CREATE TABLE t2(a int KEY,b CHAR (1)) engine=TOKUDB PARTITION BY HASH (a) PARTITIONS 13;
+LOCK TABLES t4 WRITE,t3 WRITE,t2 WRITE;
+INSERT INTO t2(a)VALUES (REPEAT(0,1));
+ALTER TABLE t2 ADD COLUMN(c INT);
+alter table t4 add column c int;
+UPDATE t2 SET a=1;
+select * from t2;
+a b c
+1 NULL NULL
+unlock tables;
+drop table t2,t3,t4;
diff --git a/storage/tokudb/mysql-test/tokudb_bugs/r/db811s.result b/storage/tokudb/mysql-test/tokudb_bugs/r/db811s.result
new file mode 100644
index 00000000000..0a50e63e037
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb_bugs/r/db811s.result
@@ -0,0 +1,14 @@
+drop table if exists t2,t3,t4;
+CREATE TABLE t3(a INT,b INT,UNIQUE KEY (a,b)) engine=TOKUDB;
+CREATE TABLE t4(c1 FLOAT ZEROFILL) engine=innodb;
+CREATE TABLE t2(a int KEY,b CHAR (1)) engine=TOKUDB PARTITION BY HASH (a) PARTITIONS 1;
+LOCK TABLES t4 WRITE,t3 WRITE,t2 WRITE;
+INSERT INTO t2(a)VALUES (REPEAT(0,1));
+ALTER TABLE t2 ADD COLUMN(c INT);
+alter table t4 add column c int;
+UPDATE t2 SET a=1;
+select * from t2;
+a b c
+1 NULL NULL
+unlock tables;
+drop table t2,t3,t4;
diff --git a/storage/tokudb/mysql-test/tokudb_bugs/r/db817.result b/storage/tokudb/mysql-test/tokudb_bugs/r/db817.result
new file mode 100644
index 00000000000..d69f0dabcb3
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb_bugs/r/db817.result
@@ -0,0 +1,33 @@
+drop table if exists ti;
+create table ti (id int primary key) engine=innodb;
+begin;
+insert into ti values (0);
+savepoint b;
+insert into ti values (1);
+savepoint a2;
+insert into ti values (2);
+savepoint b;
+insert into ti values (3);
+rollback to a2;
+commit;
+select * from ti;
+id
+0
+1
+drop table if exists tt;
+create table tt (id int primary key) engine=tokudb;
+begin;
+insert into tt values (0);
+savepoint b;
+insert into tt values (1);
+savepoint a2;
+insert into tt values (2);
+savepoint b;
+insert into tt values (3);
+rollback to a2;
+commit;
+select * from tt;
+id
+0
+1
+drop table ti,tt;
diff --git a/storage/tokudb/mysql-test/tokudb_bugs/r/db823.result b/storage/tokudb/mysql-test/tokudb_bugs/r/db823.result
new file mode 100644
index 00000000000..d94da5c0673
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb_bugs/r/db823.result
@@ -0,0 +1,11 @@
+drop table if exists s,t;
+create table s (id int) engine=tokudb;
+lock tables s write;
+create temporary table t (id int, key(id)) engine=innodb;
+insert into t values (1);
+alter table t engine=tokudb;
+select * from t;
+id
+1
+unlock tables;
+drop table s, t;
diff --git a/storage/tokudb/mysql-test/tokudb_bugs/r/memcache_dirty.result b/storage/tokudb/mysql-test/tokudb_bugs/r/memcache_dirty.result
deleted file mode 100644
index 2ca26cd5c56..00000000000
--- a/storage/tokudb/mysql-test/tokudb_bugs/r/memcache_dirty.result
+++ /dev/null
@@ -1,14 +0,0 @@
-SET DEFAULT_STORAGE_ENGINE = 'tokudb';
-DROP TABLE IF EXISTS t1;
-create table t1 (i int, j int, primary key (i))engine=TokuDB;
-insert into t1 values (0,0) MEMCACHE_DIRTY 'a';
-insert into t1 values (1,0) MEMCACHE_DIRTY 'b', 'c';
-update t1 set j=j+1 where i=0 MEMCACHE_DIRTY 'a';
-update t1 set j=j+1 where i=1 MEMCACHE_DIRTY 'b', 'c';
-insert into t1 values (0,0) on duplicate key update j=j+1 MEMCACHE_DIRTY 'a';
-insert into t1 values (2,0) on duplicate key update j=j+1 MEMCACHE_DIRTY 'a', 'b';
-replace into t1 values (0,3) MEMCACHE_DIRTY 'a';
-replace into t1 values (3,3) MEMCACHE_DIRTY 'a', 'b';
-delete from t1 where i=0 MEMCACHE_DIRTY 'a';
-delete from t1 where i=1 MEMCACHE_DIRTY 'b', 'c';
-DROP TABLE t1;
diff --git a/storage/tokudb/mysql-test/tokudb_bugs/r/tokudb718.result b/storage/tokudb/mysql-test/tokudb_bugs/r/tokudb718.result
index e63f73caf20..0cf75d40847 100644
--- a/storage/tokudb/mysql-test/tokudb_bugs/r/tokudb718.result
+++ b/storage/tokudb/mysql-test/tokudb_bugs/r/tokudb718.result
@@ -3,7 +3,8 @@ drop table if exists t;
create table t (id int primary key);
begin;
insert into t values (1),(2);
-select * from information_schema.tokudb_fractal_tree_info;
-ERROR HY000: Got error -30994 "Internal error < 0 (Not system error)" from storage engine TokuDB
+select dictionary_name from information_schema.tokudb_fractal_tree_info;
+dictionary_name
+./test/t-status
commit;
drop table t;
diff --git a/storage/tokudb/mysql-test/tokudb_bugs/t/5733_tokudb.test b/storage/tokudb/mysql-test/tokudb_bugs/t/5733_tokudb.test
index 2e30c839905..192004cb113 100644
--- a/storage/tokudb/mysql-test/tokudb_bugs/t/5733_tokudb.test
+++ b/storage/tokudb/mysql-test/tokudb_bugs/t/5733_tokudb.test
@@ -20,9 +20,18 @@ while ($i < $n) {
}
commit;
-# TokuDB may do index or range scan on this. Both are ok
-replace_column 9 #;
---replace_result index index_or_range range index_or_range
+# the plan for the following query should be a range scan. about 1 of 10 times,
+# the plan is an index scan. the different scan type occurs because the query optimizer
+# is handed different row counts by tokudb::records_in_range. the cost estimates made
+# by the query optimizer are very close to begin with. sometimes, the cost of an index
+# scan is less than the cost of a range scan.
+#
+# if a tokudb checkpoint occurs before this query is run, then the records_in_range
+# function returns a larger than expected row estimate.
+#
+# column 4 is the join type (should be range or index)
+# column 9 is the estimated key count
+replace_column 4 range_or_index 9 #;
explain select id from t where id>0 limit 10;
replace_column 9 #;
diff --git a/storage/tokudb/mysql-test/tokudb_bugs/t/db788-optimize-index-name.test b/storage/tokudb/mysql-test/tokudb_bugs/t/db788-optimize-index-name.test
new file mode 100644
index 00000000000..644f00a5862
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb_bugs/t/db788-optimize-index-name.test
@@ -0,0 +1,21 @@
+# test tokudb_optimize_index_name session variable
+set default_storage_engine='tokudb';
+source include/have_tokudb.inc;
+disable_warnings;
+drop table if exists t;
+enable_warnings;
+
+create table t (a int, b int, c int, primary key(a), key(b), key(c));
+# optimize primary key
+set tokudb_optimize_index_name='primary';
+optimize table t;
+
+# optimize key b
+set tokudb_optimize_index_name='b';
+optimize table t;
+
+# optimize key c
+set tokudb_optimize_index_name='c';
+optimize table t;
+
+drop table t;
diff --git a/storage/tokudb/mysql-test/tokudb_bugs/t/db801.test b/storage/tokudb/mysql-test/tokudb_bugs/t/db801.test
new file mode 100644
index 00000000000..8a8fcea1496
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb_bugs/t/db801.test
@@ -0,0 +1,50 @@
+# test for the DB-801 bug on mysql-5.5.41
+source include/have_tokudb.inc;
+source include/have_partition.inc;
+set default_storage_engine=tokudb;
+
+disable_warnings;
+drop table if exists t;
+enable_warnings;
+
+# run the test on a tokudb table
+create table t (id int not null primary key, c int not null) engine=tokudb;
+
+insert into t values (1,0);
+
+connect(conn1,localhost,root,,);
+connection default;
+begin;
+update t set c=10 where id=1;
+
+connection conn1;
+--error ER_LOCK_WAIT_TIMEOUT
+update t set c=100;
+
+connection default;
+rollback;
+disconnect conn1;
+
+drop table t;
+
+# run the test on a partitioned tokudb table
+create table t (id int not null primary key, c int not null) engine=tokudb partition by hash(id) partitions 1;
+
+insert into t values (1,0);
+
+connect(conn1,localhost,root,,);
+connection default;
+begin;
+update t set c=10 where id=1;
+
+connection conn1;
+--error ER_LOCK_WAIT_TIMEOUT
+update t set c=100;
+
+connection default;
+rollback;
+disconnect conn1;
+
+drop table t;
+
+
diff --git a/storage/tokudb/mysql-test/tokudb_bugs/t/db805.test b/storage/tokudb/mysql-test/tokudb_bugs/t/db805.test
new file mode 100644
index 00000000000..1114de6b325
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb_bugs/t/db805.test
@@ -0,0 +1,17 @@
+# DB-805 test that conversion of t1 from innodb to tokudb can write rows
+source include/have_tokudb.inc;
+source include/have_innodb.inc;
+disable_warnings;
+drop table if exists t1,t3;
+enable_warnings;
+
+create table t3(a3 int,b3 decimal(0,0),c3 int,d3 int,primary key(a3,b3)) engine=TOKUDB;
+LOCK TABLES t3 WRITE;
+create temporary table t1(f1 int,index(f1)) engine=innodb;
+INSERT INTO t1 VALUES(1),(1),(1);
+select * from t1;
+ALTER TABLE t1 engine=TOKUDB;
+select * from t1;
+unlock tables;
+
+drop table t1,t3;
diff --git a/storage/tokudb/mysql-test/tokudb_bugs/t/db806.test b/storage/tokudb/mysql-test/tokudb_bugs/t/db806.test
new file mode 100644
index 00000000000..3815e59f78c
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb_bugs/t/db806.test
@@ -0,0 +1,13 @@
+# DB-806 test that lock tables and create select can write rows to the new table
+source include/have_tokudb.inc;
+disable_warnings;
+drop table if exists t1,t3;
+enable_warnings;
+
+CREATE TABLE t3(a int,c int,d int)engine=TOKUDB;
+lock table t3 read;
+create temporary table t1 engine=tokudb as SELECT 1;
+select * from t1;
+unlock tables;
+
+drop table t1,t3; \ No newline at end of file
diff --git a/storage/tokudb/mysql-test/tokudb_bugs/t/db811.test b/storage/tokudb/mysql-test/tokudb_bugs/t/db811.test
new file mode 100644
index 00000000000..509f482765e
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb_bugs/t/db811.test
@@ -0,0 +1,22 @@
+# DB-811 test that alter table t2 updates both the schema (FRM) and the data (tokudb files)
+
+source include/have_tokudb.inc;
+source include/have_innodb.inc;
+source include/have_partition.inc;
+disable_warnings;
+drop table if exists t2,t3,t4;
+enable_warnings;
+
+CREATE TABLE t3(a INT,b INT,UNIQUE KEY (a,b)) engine=TOKUDB;
+CREATE TABLE t4(c1 FLOAT ZEROFILL) engine=innodb;
+CREATE TABLE t2(a int KEY,b CHAR (1)) engine=TOKUDB PARTITION BY HASH (a) PARTITIONS 13;
+LOCK TABLES t4 WRITE,t3 WRITE,t2 WRITE;
+INSERT INTO t2(a)VALUES (REPEAT(0,1));
+ALTER TABLE t2 ADD COLUMN(c INT);
+alter table t4 add column c int;
+UPDATE t2 SET a=1;
+select * from t2;
+unlock tables;
+
+drop table t2,t3,t4;
+
diff --git a/storage/tokudb/mysql-test/tokudb_bugs/t/db811s.test b/storage/tokudb/mysql-test/tokudb_bugs/t/db811s.test
new file mode 100644
index 00000000000..5b8c6ed79d3
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb_bugs/t/db811s.test
@@ -0,0 +1,22 @@
+# DB-811 test that alter table t2 updates both the schema (FRM) and the data (tokudb files)
+
+source include/have_tokudb.inc;
+source include/have_innodb.inc;
+source include/have_partition.inc;
+disable_warnings;
+drop table if exists t2,t3,t4;
+enable_warnings;
+
+CREATE TABLE t3(a INT,b INT,UNIQUE KEY (a,b)) engine=TOKUDB;
+CREATE TABLE t4(c1 FLOAT ZEROFILL) engine=innodb;
+CREATE TABLE t2(a int KEY,b CHAR (1)) engine=TOKUDB PARTITION BY HASH (a) PARTITIONS 1;
+LOCK TABLES t4 WRITE,t3 WRITE,t2 WRITE;
+INSERT INTO t2(a)VALUES (REPEAT(0,1));
+ALTER TABLE t2 ADD COLUMN(c INT);
+alter table t4 add column c int;
+UPDATE t2 SET a=1;
+select * from t2;
+unlock tables;
+
+drop table t2,t3,t4;
+
diff --git a/storage/tokudb/mysql-test/tokudb_bugs/t/db817.test b/storage/tokudb/mysql-test/tokudb_bugs/t/db817.test
new file mode 100644
index 00000000000..53c9edc3893
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb_bugs/t/db817.test
@@ -0,0 +1,38 @@
+# verify that duplicate savepoint names in innodb and tokudb work the same
+source include/have_innodb.inc;
+source include/have_tokudb.inc;
+disable_warnings;
+drop table if exists ti;
+enable_warnings;
+create table ti (id int primary key) engine=innodb;
+begin;
+insert into ti values (0);
+savepoint b;
+insert into ti values (1);
+savepoint a2;
+insert into ti values (2);
+savepoint b;
+insert into ti values (3);
+rollback to a2;
+commit;
+select * from ti;
+
+disable_warnings;
+drop table if exists tt;
+enable_warnings;
+create table tt (id int primary key) engine=tokudb;
+begin;
+insert into tt values (0);
+savepoint b;
+insert into tt values (1);
+savepoint a2;
+insert into tt values (2);
+savepoint b;
+insert into tt values (3);
+rollback to a2;
+commit;
+select * from tt;
+
+drop table ti,tt;
+
+
diff --git a/storage/tokudb/mysql-test/tokudb_bugs/t/db823.test b/storage/tokudb/mysql-test/tokudb_bugs/t/db823.test
new file mode 100644
index 00000000000..2e01c0e5797
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb_bugs/t/db823.test
@@ -0,0 +1,16 @@
+# test DB-823
+# test that the conversion of table t from innodb to tokudb succeeds.
+source include/have_tokudb.inc;
+source include/have_innodb.inc;
+disable_warnings;
+drop table if exists s,t;
+enable_warnings;
+create table s (id int) engine=tokudb;
+lock tables s write;
+create temporary table t (id int, key(id)) engine=innodb;
+insert into t values (1);
+alter table t engine=tokudb;
+select * from t;
+unlock tables;
+drop table s, t;
+
diff --git a/storage/tokudb/mysql-test/tokudb_bugs/t/memcache_dirty.test b/storage/tokudb/mysql-test/tokudb_bugs/t/memcache_dirty.test
deleted file mode 100644
index e66c4cf0b6f..00000000000
--- a/storage/tokudb/mysql-test/tokudb_bugs/t/memcache_dirty.test
+++ /dev/null
@@ -1,25 +0,0 @@
---source include/have_tokudb.inc
-#
-# Record inconsistency.
-#
-#
-SET DEFAULT_STORAGE_ENGINE = 'tokudb';
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-create table t1 (i int, j int, primary key (i))engine=TokuDB;
-insert into t1 values (0,0) MEMCACHE_DIRTY 'a'; insert into t1 values (1,0) MEMCACHE_DIRTY 'b', 'c';
-
-update t1 set j=j+1 where i=0 MEMCACHE_DIRTY 'a'; update t1 set j=j+1 where i=1 MEMCACHE_DIRTY 'b', 'c';
-
-insert into t1 values (0,0) on duplicate key update j=j+1 MEMCACHE_DIRTY 'a'; insert into t1 values (2,0) on duplicate key update j=j+1 MEMCACHE_DIRTY 'a', 'b';
-
-replace into t1 values (0,3) MEMCACHE_DIRTY 'a'; replace into t1 values (3,3) MEMCACHE_DIRTY 'a', 'b';
-
-delete from t1 where i=0 MEMCACHE_DIRTY 'a'; delete from t1 where i=1 MEMCACHE_DIRTY 'b', 'c';
-
-
-# Final cleanup.
-DROP TABLE t1;
-
diff --git a/storage/tokudb/mysql-test/tokudb_bugs/t/tokudb718.test b/storage/tokudb/mysql-test/tokudb_bugs/t/tokudb718.test
index 415bb7a2332..735a88afed8 100644
--- a/storage/tokudb/mysql-test/tokudb_bugs/t/tokudb718.test
+++ b/storage/tokudb/mysql-test/tokudb_bugs/t/tokudb718.test
@@ -7,7 +7,6 @@ enable_warnings;
create table t (id int primary key);
begin;
insert into t values (1),(2);
---error 1030
-select * from information_schema.tokudb_fractal_tree_info;
+select dictionary_name from information_schema.tokudb_fractal_tree_info;
commit;
drop table t;
diff --git a/storage/tokudb/scripts/common.sh b/storage/tokudb/scripts/common.sh
index fc676ceeceb..fe39b9feca7 100644
--- a/storage/tokudb/scripts/common.sh
+++ b/storage/tokudb/scripts/common.sh
@@ -131,11 +131,20 @@ function parse_mysqlbuild() {
tokudb_version=${BASH_REMATCH[6]}
target_system=${BASH_REMATCH[7]}
target_arch=${BASH_REMATCH[8]}
+
# verify targets
if [ $target_system != $system ] ; then exitcode=1; fi
if [ $target_arch != $arch ] ; then exitcode=1; fi
+ # split the version string into major.minor.patch
+ if [[ $mysql_version =~ ^([0-9]+)\.([0-9]+)\.([0-9]+.*) ]] ; then
+ mysql_version_major=${BASH_REMATCH[1]}
+ mysql_version_minor=${BASH_REMATCH[2]}
+ mysql_version_patch=${BASH_REMATCH[3]}
+ fi
+
local temp_tokudb_version=$tokudb_version
+
# decode enterprise
if [[ $temp_tokudb_version =~ (.*)-e$ ]] ; then
build_type=enterprise
@@ -143,6 +152,7 @@ function parse_mysqlbuild() {
else
build_type=community
fi
+
# decode debug
if [[ $temp_tokudb_version =~ (.*)-debug$ ]] ; then
build_debug=1
@@ -151,8 +161,9 @@ function parse_mysqlbuild() {
else
build_debug=0
fi
+
# set tag or HEAD
- if [[ $temp_tokudb_version =~ ^([0-9]+)\\.([0-9]+)\\.([0-9]+) ]] ; then
+ if [[ $temp_tokudb_version =~ ^([0-9]+)\.([0-9]+)\.([0-9]+) ]] ; then
git_tag=tokudb-$temp_tokudb_version
else
git_tag=HEAD
@@ -160,6 +171,8 @@ function parse_mysqlbuild() {
if [ -z $mysql_tree ] ; then mysql_tree=$mysql_distro-$mysql_version; fi
if [ -z $jemalloc_tree ] ; then jemalloc_tree=$jemalloc_version; fi
fi
+
+ # set repository
mysql_repo=$mysql_distro
if [[ $mysql_version =~ ^([0-9]+\.[0-9]+) ]] ; then mysql_repo=$mysql_distro-${BASH_REMATCH[1]}; else exitcode=1; fi
else
@@ -174,6 +187,15 @@ function parse_mysql() {
if [[ $mysql =~ ^(mysql|mariadb)-(.*)$ ]] ; then
mysql_distro=${BASH_REMATCH[1]}
mysql_version=${BASH_REMATCH[2]}
+
+ # split the version string into major.minor.patch
+ if [[ $mysql_version =~ ^([0-9]+)\.([0-9]+)\.([0-9]+.*) ]] ; then
+ mysql_version_major=${BASH_REMATCH[1]}
+ mysql_version_minor=${BASH_REMATCH[2]}
+ mysql_version_patch=${BASH_REMATCH[3]}
+ fi
+
+ # set repository
mysql_repo=$mysql_distro
if [[ $mysql_version =~ ^([0-9]+\.[0-9]+) ]] ; then mysql_repo=$mysql_distro-${BASH_REMATCH[1]}; else exitcode=1; fi
exitcode=0
diff --git a/storage/tokudb/scripts/make.mysql.bash b/storage/tokudb/scripts/make.mysql.bash
index 5654c1c7926..c1259797590 100755
--- a/storage/tokudb/scripts/make.mysql.bash
+++ b/storage/tokudb/scripts/make.mysql.bash
@@ -103,10 +103,23 @@ fi
cd $mysql_distro-$mysql_version
if [ $? != 0 ] ; then exit 1; fi
+# extract mysql version patch number only
+if [[ $mysql_version_patch =~ ^([0-9]+) ]] ; then p=${BASH_REMATCH[1]}; else p=$mysql_version_patch; fi
+
# install the backup source
-if [ ! -d toku_backup ] ; then
+tokudb_backup=
+if [ $mysql_version_major -eq 5 -a $mysql_version_minor -eq 5 -a $p -le 40 ] ; then
+ tokudb_backup=patch
github_download Tokutek/backup-$build_type $(git_tree $git_tag $backup_tree) backup-$build_type
cp -r backup-$build_type/backup toku_backup
+elif [ $build_type = enterprise ] ; then
+ tokudb_backup=plugin
+ github_download Tokutek/tokudb-backup-plugin $(git_tree $git_tag $backup_tree) tokudb-backup-plugin
+ mv tokudb-backup-plugin plugin
+ github_download Tokutek/backup-enterprise $(git_tree $git_tag $backup_tree) backup-enterprise
+ rm -rf plugin/tokudb-backup-plugin/backup
+ mv backup-enterprise/backup plugin/tokudb-backup-plugin
+ rm -rf backup-enterprise
fi
if [ ! -d tokudb-engine ] ; then
@@ -153,6 +166,7 @@ function generate_cmake_cmd () {
echo -n CC=$cc CXX=$cxx cmake \
-D BUILD_CONFIG=mysql_release \
+ -D MYSQL_MAINTAINER_MODE=OFF \
-D CMAKE_BUILD_TYPE=$cmake_build_type \
-D CMAKE_TOKUDB_REVISION=$ft_revision \
-D TOKUDB_VERSION=tokudb-${tokudb_version} \
diff --git a/storage/tokudb/scripts/make.mysql.debug.env.bash b/storage/tokudb/scripts/make.mysql.debug.env.bash
index b7c270cfbd7..3f8b4e6c219 100755
--- a/storage/tokudb/scripts/make.mysql.debug.env.bash
+++ b/storage/tokudb/scripts/make.mysql.debug.env.bash
@@ -55,14 +55,14 @@ function github_clone() {
git_tag=
mysql=mysql-5.5
-mysql_tree=mysql-5.5.35
+mysql_tree=mysql-5.5.41
jemalloc=jemalloc
jemalloc_tree=3.6.0
tokudbengine=tokudb-engine
tokudbengine_tree=master
ftindex=ft-index
ftindex_tree=master
-backup=backup-community
+backup=tokudb-backup-plugin
backup_tree=master
cc=gcc
cxx=g++
@@ -119,9 +119,9 @@ if [ $? != 0 ] ; then exit 1; fi
ln -s ../../$tokudbengine/storage/tokudb tokudb
if [ $? != 0 ] ; then exit 1; fi
popd
-pushd $mysql_tree
+pushd $mysql_tree/plugin
if [ $? != 0 ] ; then exit 1; fi
-ln -s ../$backup/backup toku_backup
+ln -s ../../$backup $backup
if [ $? != 0 ] ; then exit 1; fi
popd
pushd $mysql_tree/scripts
@@ -148,13 +148,15 @@ fi
pushd $build_dir
if [ $? != 0 ] ; then exit 1; fi
extra_cmake_options="-DCMAKE_LINK_DEPENDS_NO_SHARED=ON"
+extra_cmake_options+=" -DBUILD_TESTING=OFF"
+extra_cmake_options+=" -DMYSQL_MAINTAINER_MODE=OFF"
if (( $cmake_valgrind )) ; then
extra_cmake_options+=" -DUSE_VALGRIND=ON"
fi
if (( $cmake_debug_paranoid )) ; then
extra_cmake_options+=" -DTOKU_DEBUG_PARANOID=ON"
fi
-CC=$cc CXX=$cxx cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$install_dir -DBUILD_TESTING=OFF $extra_cmake_options ../$mysql_tree
+CC=$cc CXX=$cxx cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$install_dir $extra_cmake_options ../$mysql_tree
if [ $? != 0 ] ; then exit 1; fi
make -j4 install
if [ $? != 0 ] ; then exit 1; fi
diff --git a/storage/tokudb/tokudb_card.h b/storage/tokudb/tokudb_card.h
index 797c705bbaf..22e6fb9b3da 100644
--- a/storage/tokudb/tokudb_card.h
+++ b/storage/tokudb/tokudb_card.h
@@ -218,15 +218,32 @@ namespace tokudb {
return error;
}
+ struct analyze_card_cursor_callback_extra {
+ int (*analyze_progress)(void *extra, uint64_t rows);
+ void *analyze_extra;
+ uint64_t *rows;
+ uint64_t *deleted_rows;
+ };
+
+ bool analyze_card_cursor_callback(void *extra, uint64_t deleted_rows) {
+ analyze_card_cursor_callback_extra *a_extra = static_cast<analyze_card_cursor_callback_extra *>(extra);
+ *a_extra->deleted_rows += deleted_rows;
+ int r = a_extra->analyze_progress(a_extra->analyze_extra, *a_extra->rows);
+ sql_print_information("tokudb analyze_card_cursor_callback %u %" PRIu64 " %" PRIu64, r, *a_extra->deleted_rows, deleted_rows);
+ return r != 0;
+ }
+
// Compute records per key for all key parts of the ith key of the table.
// For each key part, put records per key part in *rec_per_key_part[key_part_index].
// Returns 0 if success, otherwise an error number.
// TODO statistical dives into the FT
int analyze_card(DB *db, DB_TXN *txn, bool is_unique, uint64_t num_key_parts, uint64_t *rec_per_key_part,
int (*key_compare)(DB *, const DBT *, const DBT *, uint),
- int (*analyze_progress)(void *extra, uint64_t rows), void *progress_extra) {
+ int (*analyze_progress)(void *extra, uint64_t rows), void *progress_extra,
+ uint64_t *return_rows, uint64_t *return_deleted_rows) {
int error = 0;
uint64_t rows = 0;
+ uint64_t deleted_rows = 0;
uint64_t unique_rows[num_key_parts];
if (is_unique && num_key_parts == 1) {
// dont compute for unique keys with a single part. we already know the answer.
@@ -235,6 +252,8 @@ namespace tokudb {
DBC *cursor = NULL;
error = db->cursor(db, txn, &cursor, 0);
if (error == 0) {
+ analyze_card_cursor_callback_extra e = { analyze_progress, progress_extra, &rows, &deleted_rows };
+ cursor->c_set_check_interrupt_callback(cursor, analyze_card_cursor_callback, &e);
for (uint64_t i = 0; i < num_key_parts; i++)
unique_rows[i] = 1;
// stop looking when the entire dictionary was analyzed, or a cap on execution time was reached, or the analyze was killed.
@@ -243,8 +262,8 @@ namespace tokudb {
while (1) {
error = cursor->c_get(cursor, &key, 0, DB_NEXT);
if (error != 0) {
- if (error == DB_NOTFOUND)
- error = 0; // eof is not an error
+ if (error == DB_NOTFOUND || error == TOKUDB_INTERRUPTED)
+ error = 0; // not an error
break;
}
rows++;
@@ -287,10 +306,12 @@ namespace tokudb {
}
}
// return cardinality
- if (error == 0 || error == ETIME) {
- for (uint64_t i = 0; i < num_key_parts; i++)
- rec_per_key_part[i] = rows / unique_rows[i];
- }
+ if (return_rows)
+ *return_rows = rows;
+ if (return_deleted_rows)
+ *return_deleted_rows = deleted_rows;
+ for (uint64_t i = 0; i < num_key_parts; i++)
+ rec_per_key_part[i] = rows / unique_rows[i];
return error;
}
}
diff --git a/storage/xtradb/CMakeLists.txt b/storage/xtradb/CMakeLists.txt
index 08e12643dec..75e994aa34b 100644
--- a/storage/xtradb/CMakeLists.txt
+++ b/storage/xtradb/CMakeLists.txt
@@ -217,6 +217,8 @@ IF(HAVE_IB_ATOMIC_PTHREAD_T_GCC)
ADD_DEFINITIONS(-DHAVE_IB_ATOMIC_PTHREAD_T_GCC=1)
ENDIF()
+CHECK_C_SOURCE_COMPILES("struct t1{ int a; char *b; }; struct t1 c= { .a=1, .b=0 }; main() { }" HAVE_C99_INITIALIZERS)
+
ENDIF(NOT MSVC)
CHECK_FUNCTION_EXISTS(asprintf HAVE_ASPRINTF)
@@ -453,6 +455,14 @@ SET(INNOBASE_SOURCES
ut/ut0vec.cc
ut/ut0wqueue.cc)
+# These files have unused result errors, so we skip Werror
+CHECK_C_COMPILER_FLAG("-Werror" HAVE_WERROR)
+IF(HAVE_WERROR)
+ INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/compile_flags.cmake)
+ ADD_COMPILE_FLAGS(page/page0zip.c COMPILE_FLAGS "-Wno-error")
+ ADD_COMPILE_FLAGS(ut/ut0ut.c COMPILE_FLAGS "-Wno-error")
+ENDIF()
+
IF(WITH_INNODB)
# Legacy option
SET(WITH_INNOBASE_STORAGE_ENGINE TRUE)
diff --git a/storage/xtradb/api/api0api.cc b/storage/xtradb/api/api0api.cc
index 3859fb84b81..8769fc47166 100644
--- a/storage/xtradb/api/api0api.cc
+++ b/storage/xtradb/api/api0api.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2008, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2008, 2015, 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
@@ -318,35 +318,6 @@ ib_wake_master_thread(void)
}
}
-/*********************************************************************//**
-Calculate the max row size of the columns in a cluster index.
-@return max row length */
-UNIV_INLINE
-ulint
-ib_get_max_row_len(
-/*===============*/
- dict_index_t* cluster) /*!< in: cluster index */
-{
- ulint i;
- ulint max_len = 0;
- ulint n_fields = cluster->n_fields;
-
- /* Add the size of the ordering columns in the
- clustered index. */
- for (i = 0; i < n_fields; ++i) {
- const dict_col_t* col;
-
- col = dict_index_get_nth_col(cluster, i);
-
- /* Use the maximum output size of
- mach_write_compressed(), although the encoded
- length should always fit in 2 bytes. */
- max_len += dict_col_get_max_size(col);
- }
-
- return(max_len);
-}
-
/*****************************************************************//**
Read the columns from a rec into a tuple. */
static
@@ -710,120 +681,6 @@ ib_trx_rollback(
return(err);
}
-/*****************************************************************//**
-Find an index definition from the index vector using index name.
-@return index def. if found else NULL */
-UNIV_INLINE
-const ib_index_def_t*
-ib_table_find_index(
-/*================*/
- ib_vector_t* indexes, /*!< in: vector of indexes */
- const char* name) /*!< in: index name */
-{
- ulint i;
-
- for (i = 0; i < ib_vector_size(indexes); ++i) {
- const ib_index_def_t* index_def;
-
- index_def = (ib_index_def_t*) ib_vector_get(indexes, i);
-
- if (innobase_strcasecmp(name, index_def->name) == 0) {
- return(index_def);
- }
- }
-
- return(NULL);
-}
-
-/*****************************************************************//**
-Get the InnoDB internal precise type from the schema column definition.
-@return precise type in api format */
-UNIV_INLINE
-ulint
-ib_col_get_prtype(
-/*==============*/
- const ib_col_t* ib_col) /*!< in: column definition */
-{
- ulint prtype = 0;
-
- if (ib_col->ib_col_attr & IB_COL_UNSIGNED) {
- prtype |= DATA_UNSIGNED;
-
- ut_a(ib_col->ib_col_type == IB_INT);
- }
-
- if (ib_col->ib_col_attr & IB_COL_NOT_NULL) {
- prtype |= DATA_NOT_NULL;
- }
-
- return(prtype);
-}
-
-/*****************************************************************//**
-Get the InnoDB internal main type from the schema column definition.
-@return column main type */
-UNIV_INLINE
-ulint
-ib_col_get_mtype(
-/*==============*/
- const ib_col_t* ib_col) /*!< in: column definition */
-{
- /* Note: The api0api.h types should map directly to
- the internal numeric codes. */
- return(ib_col->ib_col_type);
-}
-
-/*****************************************************************//**
-Find a column in the the column vector with the same name.
-@return col. def. if found else NULL */
-UNIV_INLINE
-const ib_col_t*
-ib_table_find_col(
-/*==============*/
- const ib_vector_t* cols, /*!< in: column list head */
- const char* name) /*!< in: column name to find */
-{
- ulint i;
-
- for (i = 0; i < ib_vector_size(cols); ++i) {
- const ib_col_t* ib_col;
-
- ib_col = static_cast<const ib_col_t*>(
- ib_vector_get((ib_vector_t*) cols, i));
-
- if (innobase_strcasecmp(ib_col->name, name) == 0) {
- return(ib_col);
- }
- }
-
- return(NULL);
-}
-
-/*****************************************************************//**
-Find a column in the the column list with the same name.
-@return col. def. if found else NULL */
-UNIV_INLINE
-const ib_key_col_t*
-ib_index_find_col(
-/*==============*/
- ib_vector_t* cols, /*!< in: column list head */
- const char* name) /*!< in: column name to find */
-{
- ulint i;
-
- for (i = 0; i < ib_vector_size(cols); ++i) {
- const ib_key_col_t* ib_col;
-
- ib_col = static_cast<ib_key_col_t*>(ib_vector_get(cols, i));
-
- if (innobase_strcasecmp(ib_col->name, name) == 0) {
- return(ib_col);
- }
- }
-
- return(NULL);
-}
-
#ifdef __WIN__
/*****************************************************************//**
Convert a string to lower case. */
@@ -947,34 +804,6 @@ ib_table_name_check(
/*****************************************************************//**
-Get an index definition that is tagged as a clustered index.
-@return cluster index schema */
-UNIV_INLINE
-ib_index_def_t*
-ib_find_clustered_index(
-/*====================*/
- ib_vector_t* indexes) /*!< in: index defs. to search */
-{
- ulint i;
- ulint n_indexes;
-
- n_indexes = ib_vector_size(indexes);
-
- for (i = 0; i < n_indexes; ++i) {
- ib_index_def_t* ib_index_def;
-
- ib_index_def = static_cast<ib_index_def_t*>(
- ib_vector_get(indexes, i));
-
- if (ib_index_def->clustered) {
- return(ib_index_def);
- }
- }
-
- return(NULL);
-}
-
-/*****************************************************************//**
Get a table id. The caller must have acquired the dictionary mutex.
@return DB_SUCCESS if found */
static
@@ -3564,41 +3393,6 @@ ib_cursor_set_cluster_access(
prebuilt->need_to_access_clustered = TRUE;
}
-/*************************************************************//**
-Convert and write an INT column value to an InnoDB tuple.
-@return DB_SUCCESS or error */
-UNIV_INLINE
-ib_err_t
-ib_tuple_write_int(
-/*===============*/
- ib_tpl_t ib_tpl, /*!< in/out: tuple to write to */
- ulint col_no, /*!< in: column number */
- const void* value, /*!< in: integer value */
- ulint value_len) /*!< in: sizeof value type */
-{
- const dfield_t* dfield;
- ulint data_len;
- ulint type_len;
- ib_tuple_t* tuple = (ib_tuple_t*) ib_tpl;
-
- ut_a(col_no < ib_tuple_get_n_cols(ib_tpl));
-
- dfield = ib_col_get_dfield(tuple, col_no);
-
- data_len = dfield_get_len(dfield);
- type_len = dtype_get_len(dfield_get_type(dfield));
-
- if (dtype_get_mtype(dfield_get_type(dfield)) != DATA_INT
- || value_len != data_len) {
-
- return(DB_DATA_MISMATCH);
- }
-
- return(ib_col_set_value(
- ib_tpl, static_cast<ib_ulint_t>(col_no),
- value, static_cast<ib_ulint_t>(type_len), true));
-}
-
/*****************************************************************//**
Write an integer value to a column. Integers are stored in big-endian
format and will need to be converted from the host format.
diff --git a/storage/xtradb/btr/btr0cur.cc b/storage/xtradb/btr/btr0cur.cc
index 323bb468527..4186c9ab33f 100644
--- a/storage/xtradb/btr/btr0cur.cc
+++ b/storage/xtradb/btr/btr0cur.cc
@@ -2522,15 +2522,15 @@ btr_cur_pess_upd_restore_supremum(
Check if the total length of the modified blob for the row is within 10%
of the total redo log size. This constraint on the blob length is to
avoid overwriting the redo logs beyond the last checkpoint lsn.
-@return DB_SUCCESS or DB_TOO_BIG_RECORD. */
+@return DB_SUCCESS or DB_TOO_BIG_FOR_REDO. */
static
dberr_t
btr_check_blob_limit(const big_rec_t* big_rec_vec)
{
const ib_uint64_t redo_size = srv_n_log_files * srv_log_file_size
* UNIV_PAGE_SIZE;
- const ulint redo_10p = redo_size / 10;
- ulint total_blob_len = 0;
+ const ib_uint64_t redo_10p = redo_size / 10;
+ ib_uint64_t total_blob_len = 0;
dberr_t err = DB_SUCCESS;
/* Calculate the total number of bytes for blob data */
@@ -2540,11 +2540,11 @@ btr_check_blob_limit(const big_rec_t* big_rec_vec)
if (total_blob_len > redo_10p) {
ib_logf(IB_LOG_LEVEL_ERROR, "The total blob data"
- " length (" ULINTPF ") is greater than"
+ " length (" UINT64PF ") is greater than"
" 10%% of the total redo log size (" UINT64PF
"). Please increase total redo log size.",
total_blob_len, redo_size);
- err = DB_TOO_BIG_RECORD;
+ err = DB_TOO_BIG_FOR_REDO;
}
return(err);
@@ -4659,7 +4659,7 @@ Stores the fields in big_rec_vec to the tablespace and puts pointers to
them in rec. The extern flags in rec will have to be set beforehand.
The fields are stored on pages allocated from leaf node
file segment of the index tree.
-@return DB_SUCCESS or DB_OUT_OF_FILE_SPACE */
+@return DB_SUCCESS or DB_OUT_OF_FILE_SPACE or DB_TOO_BIG_FOR_REDO */
UNIV_INTERN
dberr_t
btr_store_big_rec_extern_fields(
diff --git a/storage/xtradb/buf/buf0buf.cc b/storage/xtradb/buf/buf0buf.cc
index 6c6b67ad774..97781a12d20 100644
--- a/storage/xtradb/buf/buf0buf.cc
+++ b/storage/xtradb/buf/buf0buf.cc
@@ -295,7 +295,6 @@ UNIV_INTERN mysql_pfs_key_t buf_block_debug_latch_key;
#ifdef UNIV_PFS_MUTEX
UNIV_INTERN mysql_pfs_key_t buffer_block_mutex_key;
-UNIV_INTERN mysql_pfs_key_t buf_pool_mutex_key;
UNIV_INTERN mysql_pfs_key_t buf_pool_zip_mutex_key;
UNIV_INTERN mysql_pfs_key_t buf_pool_flush_state_mutex_key;
UNIV_INTERN mysql_pfs_key_t buf_pool_LRU_list_mutex_key;
@@ -1783,16 +1782,12 @@ page_found:
ut_ad(!bpage->in_page_hash);
ut_ad(bpage->buf_fix_count == 0);
- mutex_enter(&buf_pool->zip_mutex);
-
bpage->state = BUF_BLOCK_ZIP_PAGE;
bpage->space = static_cast<ib_uint32_t>(space);
bpage->offset = static_cast<ib_uint32_t>(offset);
bpage->buf_fix_count = 1;
bpage->buf_pool_index = buf_pool_index(buf_pool);
- mutex_exit(&buf_pool->zip_mutex);
-
ut_d(bpage->in_page_hash = TRUE);
HASH_INSERT(buf_page_t, hash, buf_pool->page_hash,
fold, bpage);
@@ -1844,7 +1839,6 @@ buf_pool_watch_remove(
#endif /* UNIV_SYNC_DEBUG */
ut_ad(buf_page_get_state(watch) == BUF_BLOCK_ZIP_PAGE);
- ut_ad(buf_own_zip_mutex_for_page(watch));
HASH_DELETE(buf_page_t, hash, buf_pool->page_hash, fold, watch);
ut_d(watch->in_page_hash = FALSE);
@@ -1887,9 +1881,7 @@ buf_pool_watch_unset(
#endif /* PAGE_ATOMIC_REF_COUNT */
if (bpage->buf_fix_count == 0) {
- mutex_enter(&buf_pool->zip_mutex);
buf_pool_watch_remove(buf_pool, fold, bpage);
- mutex_exit(&buf_pool->zip_mutex);
}
}
@@ -4474,7 +4466,7 @@ corrupt:
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
buf_page_get_flush_type(bpage) == BUF_FLUSH_LRU)) {
- have_LRU_mutex = TRUE; /* optimistic */
+ have_LRU_mutex = true; /* optimistic */
}
retry_mutex:
if (have_LRU_mutex) {
@@ -4494,6 +4486,7 @@ retry_mutex:
&& !have_LRU_mutex) {
mutex_exit(block_mutex);
+ have_LRU_mutex = true;
goto retry_mutex;
}
diff --git a/storage/xtradb/buf/buf0flu.cc b/storage/xtradb/buf/buf0flu.cc
index 5dabf3b77e7..7c9e5e091c5 100644
--- a/storage/xtradb/buf/buf0flu.cc
+++ b/storage/xtradb/buf/buf0flu.cc
@@ -1107,8 +1107,8 @@ buf_flush_page(
# if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
/********************************************************************//**
Writes a flushable page asynchronously from the buffer pool to a file.
-NOTE: block->mutex must be held upon entering this function, and it will be
-released by this function after flushing. This is loosely based on
+NOTE: block and LRU list mutexes must be held upon entering this function, and
+they will be released by this function after flushing. This is loosely based on
buf_flush_batch() and buf_flush_page().
@return TRUE if the page was flushed and the mutexes released */
UNIV_INTERN
@@ -1659,6 +1659,8 @@ buf_do_LRU_batch(
flush_counters_t* n) /*!< out: flushed/evicted page
counts */
{
+ ut_ad(mutex_own(&buf_pool->LRU_list_mutex));
+
if (buf_LRU_evict_from_unzip_LRU(buf_pool)) {
n->unzip_LRU_evicted
= buf_free_from_unzip_LRU_list_batch(buf_pool, max);
diff --git a/storage/xtradb/buf/buf0lru.cc b/storage/xtradb/buf/buf0lru.cc
index e9b6d8f3fb5..f2ce261c9df 100644
--- a/storage/xtradb/buf/buf0lru.cc
+++ b/storage/xtradb/buf/buf0lru.cc
@@ -526,7 +526,7 @@ buf_flush_or_remove_page(
mutex_exit(block_mutex);
- *must_restart = TRUE;
+ *must_restart = true;
processed = false;
} else if (!flush) {
diff --git a/storage/xtradb/buf/buf0rea.cc b/storage/xtradb/buf/buf0rea.cc
index 7a79958c136..63d2fdf7726 100644
--- a/storage/xtradb/buf/buf0rea.cc
+++ b/storage/xtradb/buf/buf0rea.cc
@@ -641,9 +641,9 @@ buf_read_ahead_linear(
fail_count = 0;
- for (i = low; i < high; i++) {
+ prio_rw_lock_t* hash_lock;
- prio_rw_lock_t* hash_lock;
+ for (i = low; i < high; i++) {
bpage = buf_page_hash_get_s_locked(buf_pool, space, i,
&hash_lock);
@@ -692,7 +692,7 @@ buf_read_ahead_linear(
/* If we got this far, we know that enough pages in the area have
been accessed in the right order: linear read-ahead can be sensible */
- bpage = buf_page_hash_get(buf_pool, space, offset);
+ bpage = buf_page_hash_get_s_locked(buf_pool, space, offset, &hash_lock);
if (bpage == NULL) {
@@ -720,6 +720,8 @@ buf_read_ahead_linear(
pred_offset = fil_page_get_prev(frame);
succ_offset = fil_page_get_next(frame);
+ rw_lock_s_unlock(hash_lock);
+
if ((offset == low) && (succ_offset == offset + 1)) {
/* This is ok, we can continue */
diff --git a/storage/xtradb/dict/dict0boot.cc b/storage/xtradb/dict/dict0boot.cc
index b57a8873bd5..94a3af2852b 100644
--- a/storage/xtradb/dict/dict0boot.cc
+++ b/storage/xtradb/dict/dict0boot.cc
@@ -302,8 +302,7 @@ dict_boot(void)
/* Insert into the dictionary cache the descriptions of the basic
system tables */
/*-------------------------*/
- table = dict_mem_table_create("SYS_TABLES", DICT_HDR_SPACE, 8, 0, 0,
- false);
+ table = dict_mem_table_create("SYS_TABLES", DICT_HDR_SPACE, 8, 0, 0);
dict_mem_table_add_col(table, heap, "NAME", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, heap, "ID", DATA_BINARY, 0, 0);
@@ -357,8 +356,7 @@ dict_boot(void)
ut_a(error == DB_SUCCESS);
/*-------------------------*/
- table = dict_mem_table_create("SYS_COLUMNS", DICT_HDR_SPACE, 7, 0, 0,
- false);
+ table = dict_mem_table_create("SYS_COLUMNS", DICT_HDR_SPACE, 7, 0, 0);
dict_mem_table_add_col(table, heap, "TABLE_ID", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, heap, "POS", DATA_INT, 0, 4);
@@ -391,8 +389,7 @@ dict_boot(void)
ut_a(error == DB_SUCCESS);
/*-------------------------*/
- table = dict_mem_table_create("SYS_INDEXES", DICT_HDR_SPACE, 7, 0, 0,
- false);
+ table = dict_mem_table_create("SYS_INDEXES", DICT_HDR_SPACE, 7, 0, 0);
dict_mem_table_add_col(table, heap, "TABLE_ID", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, heap, "ID", DATA_BINARY, 0, 0);
@@ -425,8 +422,7 @@ dict_boot(void)
ut_a(error == DB_SUCCESS);
/*-------------------------*/
- table = dict_mem_table_create("SYS_FIELDS", DICT_HDR_SPACE, 3, 0, 0,
- false);
+ table = dict_mem_table_create("SYS_FIELDS", DICT_HDR_SPACE, 3, 0, 0);
dict_mem_table_add_col(table, heap, "INDEX_ID", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, heap, "POS", DATA_INT, 0, 4);
diff --git a/storage/xtradb/dict/dict0dict.cc b/storage/xtradb/dict/dict0dict.cc
index cc4d93ebc99..a76121544b0 100644
--- a/storage/xtradb/dict/dict0dict.cc
+++ b/storage/xtradb/dict/dict0dict.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
Copyright (c) 2013, SkySQL Ab. All Rights Reserved.
@@ -649,7 +649,68 @@ dict_table_get_col_name(
return(s);
}
+/**********************************************************************//**
+Returns a column's name.
+@return column name. NOTE: not guaranteed to stay valid if table is
+modified in any way (columns added, etc.). */
+UNIV_INTERN
+const char*
+dict_table_get_col_name_for_mysql(
+/*==============================*/
+ const dict_table_t* table, /*!< in: table */
+ const char* col_name)/*! in: MySQL table column name */
+{
+ ulint i;
+ const char* s;
+
+ ut_ad(table);
+ ut_ad(col_name);
+ ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
+
+ s = table->col_names;
+ if (s) {
+ /* If we have many virtual columns MySQL key_part->fieldnr
+ could be larger than number of columns in InnoDB table
+ when creating new indexes. */
+ for (i = 0; i < table->n_def; i++) {
+
+ if (!innobase_strcasecmp(s, col_name)) {
+ break; /* Found */
+ }
+ s += strlen(s) + 1;
+ }
+ }
+
+ return(s);
+}
#ifndef UNIV_HOTBACKUP
+/** Allocate and init the autoinc latch of a given table.
+This function must not be called concurrently on the same table object.
+@param[in,out] table_void table whose autoinc latch to create */
+void
+dict_table_autoinc_alloc(
+ void* table_void)
+{
+ dict_table_t* table = static_cast<dict_table_t*>(table_void);
+ table->autoinc_mutex = new (std::nothrow) ib_mutex_t();
+ ut_a(table->autoinc_mutex != NULL);
+ mutex_create(autoinc_mutex_key,
+ table->autoinc_mutex, SYNC_DICT_AUTOINC_MUTEX);
+}
+
+/** Allocate and init the zip_pad_mutex of a given index.
+This function must not be called concurrently on the same index object.
+@param[in,out] index_void index whose zip_pad_mutex to create */
+void
+dict_index_zip_pad_alloc(
+ void* index_void)
+{
+ dict_index_t* index = static_cast<dict_index_t*>(index_void);
+ index->zip_pad.mutex = new (std::nothrow) os_fast_mutex_t;
+ ut_a(index->zip_pad.mutex != NULL);
+ os_fast_mutex_init(zip_pad_mutex_key, index->zip_pad.mutex);
+}
+
/********************************************************************//**
Acquire the autoinc lock. */
UNIV_INTERN
@@ -658,7 +719,32 @@ dict_table_autoinc_lock(
/*====================*/
dict_table_t* table) /*!< in/out: table */
{
- mutex_enter(&table->autoinc_mutex);
+#ifdef HAVE_ATOMIC_BUILTINS
+ os_once::do_or_wait_for_done(
+ &table->autoinc_mutex_created,
+ dict_table_autoinc_alloc, table);
+#else /* HAVE_ATOMIC_BUILTINS */
+ ut_ad(table->autoinc_mutex_created == os_once::DONE);
+#endif /* HAVE_ATOMIC_BUILTINS */
+
+ mutex_enter(table->autoinc_mutex);
+}
+
+/** Acquire the zip_pad_mutex latch.
+@param[in,out] index the index whose zip_pad_mutex to acquire.*/
+void
+dict_index_zip_pad_lock(
+ dict_index_t* index)
+{
+#ifdef HAVE_ATOMIC_BUILTINS
+ os_once::do_or_wait_for_done(
+ &index->zip_pad.mutex_created,
+ dict_index_zip_pad_alloc, index);
+#else /* HAVE_ATOMIC_BUILTINS */
+ ut_ad(index->zip_pad.mutex_created == os_once::DONE);
+#endif /* HAVE_ATOMIC_BUILTINS */
+
+ os_fast_mutex_lock(index->zip_pad.mutex);
}
/********************************************************************//**
@@ -670,7 +756,7 @@ dict_table_autoinc_initialize(
dict_table_t* table, /*!< in/out: table */
ib_uint64_t value) /*!< in: next value to assign to a row */
{
- ut_ad(mutex_own(&table->autoinc_mutex));
+ ut_ad(dict_table_autoinc_own(table));
table->autoinc = value;
}
@@ -712,7 +798,7 @@ dict_table_autoinc_read(
/*====================*/
const dict_table_t* table) /*!< in: table */
{
- ut_ad(mutex_own(&table->autoinc_mutex));
+ ut_ad(dict_table_autoinc_own(table));
return(table->autoinc);
}
@@ -728,7 +814,7 @@ dict_table_autoinc_update_if_greater(
dict_table_t* table, /*!< in/out: table */
ib_uint64_t value) /*!< in: value which was assigned to a row */
{
- ut_ad(mutex_own(&table->autoinc_mutex));
+ ut_ad(dict_table_autoinc_own(table));
if (value > table->autoinc) {
@@ -744,7 +830,7 @@ dict_table_autoinc_unlock(
/*======================*/
dict_table_t* table) /*!< in/out: table */
{
- mutex_exit(&table->autoinc_mutex);
+ mutex_exit(table->autoinc_mutex);
}
#endif /* !UNIV_HOTBACKUP */
@@ -1583,15 +1669,18 @@ dict_table_rename_in_cache(
} else if (table->space != TRX_SYS_SPACE) {
char* new_path = NULL;
- if (table->dir_path_of_temp_table != NULL) {
+ if (DICT_TF2_FLAG_IS_SET(table, DICT_TF2_TEMPORARY)) {
ut_print_timestamp(stderr);
fputs(" InnoDB: Error: trying to rename a"
" TEMPORARY TABLE ", stderr);
ut_print_name(stderr, NULL, TRUE, old_name);
- fputs(" (", stderr);
- ut_print_filename(stderr,
- table->dir_path_of_temp_table);
- fputs(" )\n", stderr);
+ if (table->dir_path_of_temp_table != NULL) {
+ fputs(" (", stderr);
+ ut_print_filename(
+ stderr, table->dir_path_of_temp_table);
+ fputs(" )\n", stderr);
+ }
+
return(DB_ERROR);
} else if (DICT_TF_HAS_DATA_DIR(table->flags)) {
@@ -2428,10 +2517,10 @@ too_big:
dict_mem_index_free(new_index);
dict_mem_index_free(index);
return(DB_TOO_BIG_RECORD);
- } else {
-
+ } else if (current_thd != NULL) {
+ /* Avoid the warning to be printed
+ during recovery. */
ib_warn_row_too_big(table);
-
}
}
@@ -4115,16 +4204,25 @@ dict_table_get_highest_foreign_id(
for (dict_foreign_set::iterator it = table->foreign_set.begin();
it != table->foreign_set.end();
++it) {
+ char fkid[MAX_TABLE_NAME_LEN+20];
foreign = *it;
- if (ut_strlen(foreign->id) > ((sizeof dict_ibfk) - 1) + len
- && 0 == ut_memcmp(foreign->id, table->name, len)
- && 0 == ut_memcmp(foreign->id + len,
+ strcpy(fkid, foreign->id);
+ /* Convert foreign key identifier on dictionary memory
+ cache to filename charset. */
+ innobase_convert_to_filename_charset(
+ strchr(fkid, '/') + 1,
+ strchr(foreign->id, '/') + 1,
+ MAX_TABLE_NAME_LEN);
+
+ if (ut_strlen(fkid) > ((sizeof dict_ibfk) - 1) + len
+ && 0 == ut_memcmp(fkid, table->name, len)
+ && 0 == ut_memcmp(fkid + len,
dict_ibfk, (sizeof dict_ibfk) - 1)
- && foreign->id[len + ((sizeof dict_ibfk) - 1)] != '0') {
+ && fkid[len + ((sizeof dict_ibfk) - 1)] != '0') {
/* It is of the >= 4.0.18 format */
- id = strtoul(foreign->id + len
+ id = strtoul(fkid + len
+ ((sizeof dict_ibfk) - 1),
&endp, 10);
if (*endp == '\0') {
@@ -5864,8 +5962,7 @@ dict_ind_init(void)
dict_table_t* table;
/* create dummy table and index for REDUNDANT infimum and supremum */
- table = dict_mem_table_create("SYS_DUMMY1", DICT_HDR_SPACE, 1, 0, 0,
- true);
+ table = dict_mem_table_create("SYS_DUMMY1", DICT_HDR_SPACE, 1, 0, 0);
dict_mem_table_add_col(table, NULL, NULL, DATA_CHAR,
DATA_ENGLISH | DATA_NOT_NULL, 8);
@@ -5878,7 +5975,7 @@ dict_ind_init(void)
/* create dummy table and index for COMPACT infimum and supremum */
table = dict_mem_table_create("SYS_DUMMY2",
DICT_HDR_SPACE, 1,
- DICT_TF_COMPACT, 0, true);
+ DICT_TF_COMPACT, 0);
dict_mem_table_add_col(table, NULL, NULL, DATA_CHAR,
DATA_ENGLISH | DATA_NOT_NULL, 8);
dict_ind_compact = dict_mem_index_create("SYS_DUMMY2", "SYS_DUMMY2",
@@ -6714,10 +6811,10 @@ dict_index_zip_success(
return;
}
- os_fast_mutex_lock(&index->zip_pad.mutex);
+ dict_index_zip_pad_lock(index);
++index->zip_pad.success;
dict_index_zip_pad_update(&index->zip_pad, zip_threshold);
- os_fast_mutex_unlock(&index->zip_pad.mutex);
+ dict_index_zip_pad_unlock(index);
}
/*********************************************************************//**
@@ -6737,10 +6834,10 @@ dict_index_zip_failure(
return;
}
- os_fast_mutex_lock(&index->zip_pad.mutex);
+ dict_index_zip_pad_lock(index);
++index->zip_pad.failure;
dict_index_zip_pad_update(&index->zip_pad, zip_threshold);
- os_fast_mutex_unlock(&index->zip_pad.mutex);
+ dict_index_zip_pad_unlock(index);
}
@@ -6772,9 +6869,9 @@ dict_index_zip_pad_optimal_page_size(
#ifdef HAVE_ATOMIC_BUILTINS
pad = os_atomic_increment_ulint(&index->zip_pad.pad, 0);
#else /* HAVE_ATOMIC_BUILTINS */
- os_fast_mutex_lock(&index->zip_pad.mutex);
+ dict_index_zip_pad_lock(index);
pad = index->zip_pad.pad;
- os_fast_mutex_unlock(&index->zip_pad.mutex);
+ dict_index_zip_pad_unlock(index);
#endif /* HAVE_ATOMIC_BUILTINS */
ut_ad(pad < UNIV_PAGE_SIZE);
diff --git a/storage/xtradb/dict/dict0load.cc b/storage/xtradb/dict/dict0load.cc
index 874614bfb5c..ef8a2896b28 100644
--- a/storage/xtradb/dict/dict0load.cc
+++ b/storage/xtradb/dict/dict0load.cc
@@ -2176,8 +2176,7 @@ err_len:
/* See if the tablespace is available. */
*table = dict_mem_table_create(
- name, space, n_cols & ~DICT_N_COLS_COMPACT, flags, flags2,
- false);
+ name, space, n_cols & ~DICT_N_COLS_COMPACT, flags, flags2);
field = rec_get_nth_field_old(rec, DICT_FLD__SYS_TABLES__ID, &len);
ut_ad(len == 8); /* this was checked earlier */
diff --git a/storage/xtradb/dict/dict0mem.cc b/storage/xtradb/dict/dict0mem.cc
index 997e630dd15..c23a3637632 100644
--- a/storage/xtradb/dict/dict0mem.cc
+++ b/storage/xtradb/dict/dict0mem.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
This program is free software; you can redistribute it and/or modify it under
@@ -79,10 +79,7 @@ dict_mem_table_create(
the table is placed */
ulint n_cols, /*!< in: number of columns */
ulint flags, /*!< in: table flags */
- ulint flags2, /*!< in: table flags2 */
- bool nonshared)/*!< in: whether the table object is a dummy
- one that does not need the initialization of
- locking-related fields. */
+ ulint flags2) /*!< in: table flags2 */
{
dict_table_t* table;
mem_heap_t* heap;
@@ -118,18 +115,10 @@ dict_mem_table_create(
dict_table_stats_latch_create(table, true);
#ifndef UNIV_HOTBACKUP
+ table->autoinc_lock = static_cast<ib_lock_t*>(
+ mem_heap_alloc(heap, lock_get_size()));
- if (!nonshared) {
-
- table->autoinc_lock = static_cast<ib_lock_t*>(
- mem_heap_alloc(heap, lock_get_size()));
-
- mutex_create(autoinc_mutex_key,
- &table->autoinc_mutex, SYNC_DICT_AUTOINC_MUTEX);
- } else {
-
- table->autoinc_lock = NULL;
- }
+ dict_table_autoinc_create_lazy(table);
table->autoinc = 0;
@@ -212,10 +201,7 @@ dict_mem_table_free(
}
}
#ifndef UNIV_HOTBACKUP
- if (table->autoinc_lock) {
-
- mutex_free(&(table->autoinc_mutex));
- }
+ dict_table_autoinc_destroy(table);
#endif /* UNIV_HOTBACKUP */
dict_table_stats_latch_destroy(table);
@@ -335,6 +321,9 @@ dict_mem_table_col_rename_low(
ut_ad(from_len <= NAME_LEN);
ut_ad(to_len <= NAME_LEN);
+ char from[NAME_LEN];
+ strncpy(from, s, NAME_LEN);
+
if (from_len == to_len) {
/* The easy case: simply replace the column name in
table->col_names. */
@@ -402,14 +391,53 @@ dict_mem_table_col_rename_low(
foreign = *it;
- for (unsigned f = 0; f < foreign->n_fields; f++) {
- /* These can point straight to
- table->col_names, because the foreign key
- constraints will be freed at the same time
- when the table object is freed. */
- foreign->foreign_col_names[f]
- = dict_index_get_nth_field(
- foreign->foreign_index, f)->name;
+ if (foreign->foreign_index == NULL) {
+ /* We may go here when we set foreign_key_checks to 0,
+ and then try to rename a column and modify the
+ corresponding foreign key constraint. The index
+ would have been dropped, we have to find an equivalent
+ one */
+ for (unsigned f = 0; f < foreign->n_fields; f++) {
+ if (strcmp(foreign->foreign_col_names[f], from)
+ == 0) {
+
+ char** rc = const_cast<char**>(
+ foreign->foreign_col_names
+ + f);
+
+ if (to_len <= strlen(*rc)) {
+ memcpy(*rc, to, to_len + 1);
+ } else {
+ *rc = static_cast<char*>(
+ mem_heap_dup(
+ foreign->heap,
+ to,
+ to_len + 1));
+ }
+ }
+ }
+
+ dict_index_t* new_index = dict_foreign_find_index(
+ foreign->foreign_table, NULL,
+ foreign->foreign_col_names,
+ foreign->n_fields, NULL, true, false);
+ /* There must be an equivalent index in this case. */
+ ut_ad(new_index != NULL);
+
+ foreign->foreign_index = new_index;
+
+ } else {
+
+ for (unsigned f = 0; f < foreign->n_fields; f++) {
+ /* These can point straight to
+ table->col_names, because the foreign key
+ constraints will be freed at the same time
+ when the table object is freed. */
+ foreign->foreign_col_names[f]
+ = dict_index_get_nth_field(
+ foreign->foreign_index,
+ f)->name;
+ }
}
}
@@ -419,6 +447,8 @@ dict_mem_table_col_rename_low(
foreign = *it;
+ ut_ad(foreign->referenced_index != NULL);
+
for (unsigned f = 0; f < foreign->n_fields; f++) {
/* foreign->referenced_col_names[] need to be
copies, because the constraint may become
@@ -536,8 +566,7 @@ dict_mem_index_create(
dict_mem_fill_index_struct(index, heap, table_name, index_name,
space, type, n_fields);
- os_fast_mutex_init(zip_pad_mutex_key, &index->zip_pad.mutex);
-
+ dict_index_zip_pad_mutex_create_lazy(index);
return(index);
}
@@ -670,7 +699,7 @@ dict_mem_index_free(
}
#endif /* UNIV_BLOB_DEBUG */
- os_fast_mutex_free(&index->zip_pad.mutex);
+ dict_index_zip_pad_mutex_destroy(index);
mem_heap_free(index->heap);
}
@@ -744,7 +773,7 @@ dict_foreign_set_validate(
{
dict_foreign_not_exists not_exists(fk_set);
- dict_foreign_set::iterator it = std::find_if(
+ dict_foreign_set::const_iterator it = std::find_if(
fk_set.begin(), fk_set.end(), not_exists);
if (it == fk_set.end()) {
diff --git a/storage/xtradb/fil/fil0fil.cc b/storage/xtradb/fil/fil0fil.cc
index 3343ae5555a..d1f35480ecf 100644
--- a/storage/xtradb/fil/fil0fil.cc
+++ b/storage/xtradb/fil/fil0fil.cc
@@ -5075,6 +5075,9 @@ retry:
success = TRUE;
}
+ DBUG_EXECUTE_IF("ib_os_aio_func_io_failure_28",
+ success = FALSE; errno = 28;os_has_said_disk_full = TRUE;);
+
mutex_enter(&fil_system->mutex);
if (success) {
@@ -5117,6 +5120,10 @@ retry:
offset, page_size * n_pages,
node, NULL, space_id, NULL, 0, 0, 0);
#endif /* UNIV_HOTBACKUP */
+
+ DBUG_EXECUTE_IF("ib_os_aio_func_io_failure_28",
+ success = FALSE; errno = 28; os_has_said_disk_full = TRUE;);
+
if (success) {
os_has_said_disk_full = FALSE;
} else {
diff --git a/storage/xtradb/fsp/fsp0fsp.cc b/storage/xtradb/fsp/fsp0fsp.cc
index c06d4213d73..1f894d43031 100644
--- a/storage/xtradb/fsp/fsp0fsp.cc
+++ b/storage/xtradb/fsp/fsp0fsp.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2015, 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
@@ -304,44 +304,6 @@ xdes_find_bit(
}
/**********************************************************************//**
-Looks for a descriptor bit having the desired value. Scans the extent in
-a direction opposite to xdes_find_bit.
-@return bit index of the bit, ULINT_UNDEFINED if not found */
-UNIV_INLINE
-ulint
-xdes_find_bit_downward(
-/*===================*/
- xdes_t* descr, /*!< in: descriptor */
- ulint bit, /*!< in: XDES_FREE_BIT or XDES_CLEAN_BIT */
- ibool val, /*!< in: desired bit value */
- ulint hint, /*!< in: hint of which bit position would
- be desirable */
- mtr_t* mtr) /*!< in/out: mini-transaction */
-{
- ulint i;
-
- ut_ad(descr && mtr);
- ut_ad(val <= TRUE);
- ut_ad(hint < FSP_EXTENT_SIZE);
- ut_ad(mtr_memo_contains_page(mtr, descr, MTR_MEMO_PAGE_X_FIX));
- for (i = hint + 1; i > 0; i--) {
- if (val == xdes_mtr_get_bit(descr, bit, i - 1, mtr)) {
-
- return(i - 1);
- }
- }
-
- for (i = FSP_EXTENT_SIZE - 1; i > hint; i--) {
- if (val == xdes_mtr_get_bit(descr, bit, i, mtr)) {
-
- return(i);
- }
- }
-
- return(ULINT_UNDEFINED);
-}
-
-/**********************************************************************//**
Returns the number of used pages in a descriptor.
@return number of pages used */
UNIV_INLINE
diff --git a/storage/xtradb/fts/fts0ast.cc b/storage/xtradb/fts/fts0ast.cc
index dd48ffee14d..030b972440f 100644
--- a/storage/xtradb/fts/fts0ast.cc
+++ b/storage/xtradb/fts/fts0ast.cc
@@ -694,3 +694,51 @@ fts_ast_string_print(
printf("\n");
}
+
+#ifdef UNIV_DEBUG
+const char*
+fts_ast_oper_name_get(fts_ast_oper_t oper)
+{
+ switch(oper) {
+ case FTS_NONE:
+ return("FTS_NONE");
+ case FTS_IGNORE:
+ return("FTS_IGNORE");
+ case FTS_EXIST:
+ return("FTS_EXIST");
+ case FTS_NEGATE:
+ return("FTS_NEGATE");
+ case FTS_INCR_RATING:
+ return("FTS_INCR_RATING");
+ case FTS_DECR_RATING:
+ return("FTS_DECR_RATING");
+ case FTS_DISTANCE:
+ return("FTS_DISTANCE");
+ case FTS_IGNORE_SKIP:
+ return("FTS_IGNORE_SKIP");
+ case FTS_EXIST_SKIP:
+ return("FTS_EXIST_SKIP");
+ }
+ ut_ad(0);
+}
+
+const char*
+fts_ast_node_type_get(fts_ast_type_t type)
+{
+ switch (type) {
+ case FTS_AST_OPER:
+ return("FTS_AST_OPER");
+ case FTS_AST_NUMB:
+ return("FTS_AST_NUMB");
+ case FTS_AST_TERM:
+ return("FTS_AST_TERM");
+ case FTS_AST_TEXT:
+ return("FTS_AST_TEXT");
+ case FTS_AST_LIST:
+ return("FTS_AST_LIST");
+ case FTS_AST_SUBEXP_LIST:
+ return("FTS_AST_SUBEXP_LIST");
+ }
+ ut_ad(0);
+}
+#endif /* UNIV_DEBUG */
diff --git a/storage/xtradb/fts/fts0fts.cc b/storage/xtradb/fts/fts0fts.cc
index 37e742bf938..5adda1fad6c 100644
--- a/storage/xtradb/fts/fts0fts.cc
+++ b/storage/xtradb/fts/fts0fts.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2011, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2011, 2015, 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
@@ -81,11 +81,13 @@ ulint n_nodes = 0;
/** Error condition reported by fts_utf8_decode() */
const ulint UTF8_ERROR = 0xFFFFFFFF;
+#ifdef FTS_CACHE_SIZE_DEBUG
/** The cache size permissible lower limit (1K) */
static const ulint FTS_CACHE_SIZE_LOWER_LIMIT_IN_MB = 1;
/** The cache size permissible upper limit (1G) */
static const ulint FTS_CACHE_SIZE_UPPER_LIMIT_IN_MB = 1024;
+#endif /* FTS_CACHE_SIZE_DEBUG */
/** Time to sleep after DEADLOCK error before retrying operation. */
static const ulint FTS_DEADLOCK_RETRY_WAIT = 100000;
@@ -191,7 +193,7 @@ static const char* fts_create_common_tables_sql = {
""
"CREATE TABLE \"%s_CONFIG\" (\n"
" key CHAR(50),\n"
- " value CHAR(50) NOT NULL\n"
+ " value CHAR(200) NOT NULL\n"
") COMPACT;\n"
"CREATE UNIQUE CLUSTERED INDEX IND ON \"%s_CONFIG\"(key);\n"
};
@@ -329,27 +331,6 @@ fts_update_sync_doc_id(
doc_id_t doc_id, /*!< in: last document id */
trx_t* trx) /*!< in: update trx, or NULL */
__attribute__((nonnull(1)));
-/********************************************************************
-Check if we should stop. */
-UNIV_INLINE
-ibool
-fts_is_stop_signalled(
-/*==================*/
- fts_t* fts) /*!< in: fts instance */
-{
- ibool stop_signalled = FALSE;
-
- mutex_enter(&fts->bg_threads_mutex);
-
- if (fts->fts_status & BG_THREAD_STOP) {
-
- stop_signalled = TRUE;
- }
-
- mutex_exit(&fts->bg_threads_mutex);
-
- return(stop_signalled);
-}
/****************************************************************//**
This function loads the default InnoDB stopword list */
@@ -1971,7 +1952,7 @@ fts_create_one_index_table(
flags2 = DICT_TF2_USE_TABLESPACE;
}
- new_table = dict_mem_table_create(table_name, 0, 5, 1, flags2, false);
+ new_table = dict_mem_table_create(table_name, 0, 5, 1, flags2);
field = dict_index_get_nth_field(index, 0);
charset = innobase_get_fts_charset(
@@ -3409,7 +3390,7 @@ fts_fetch_doc_from_rec(
doc->charset = get_doc->index_cache->charset;
/* Null Field */
- if (doc->text.f_len == UNIV_SQL_NULL) {
+ if (doc->text.f_len == UNIV_SQL_NULL || doc->text.f_len == 0) {
continue;
}
@@ -5545,7 +5526,7 @@ fts_savepoint_lookup(
/*********************************************************************//**
Release the savepoint data identified by name. All savepoints created
-after the named savepoint are also released.
+after the named savepoint are kept.
@return DB_SUCCESS or error code */
UNIV_INTERN
void
@@ -5554,81 +5535,37 @@ fts_savepoint_release(
trx_t* trx, /*!< in: transaction */
const char* name) /*!< in: savepoint name */
{
- ulint i;
- ib_vector_t* savepoints;
- ulint top_of_stack = 0;
-
ut_a(name != NULL);
- savepoints = trx->fts_trx->savepoints;
+ ib_vector_t* savepoints = trx->fts_trx->savepoints;
ut_a(ib_vector_size(savepoints) > 0);
- /* Skip the implied savepoint (first element). */
- for (i = 1; i < ib_vector_size(savepoints); ++i) {
- fts_savepoint_t* savepoint;
+ ulint i = fts_savepoint_lookup(savepoints, name);
+ if (i != ULINT_UNDEFINED) {
+ ut_a(i >= 1);
+ fts_savepoint_t* savepoint;
savepoint = static_cast<fts_savepoint_t*>(
ib_vector_get(savepoints, i));
- /* Even though we release the resources that are part
- of the savepoint, we don't (always) actually delete the
- entry. We simply set the savepoint name to NULL. Therefore
- we have to skip deleted/released entries. */
- if (savepoint->name != NULL
- && strcmp(name, savepoint->name) == 0) {
- break;
+ if (i == ib_vector_size(savepoints) - 1) {
+ /* If the savepoint is the last, we save its
+ tables to the previous savepoint. */
+ fts_savepoint_t* prev_savepoint;
+ prev_savepoint = static_cast<fts_savepoint_t*>(
+ ib_vector_get(savepoints, i - 1));
- /* Track the previous savepoint instance that will
- be at the top of the stack after the release. */
- } else if (savepoint->name != NULL) {
- /* We need to delete all entries
- greater than this element. */
- top_of_stack = i;
+ ib_rbt_t* tables = savepoint->tables;
+ savepoint->tables = prev_savepoint->tables;
+ prev_savepoint->tables = tables;
}
- }
-
- /* Only if we found and element to release. */
- if (i < ib_vector_size(savepoints)) {
- fts_savepoint_t* last_savepoint;
- fts_savepoint_t* top_savepoint;
- ib_rbt_t* tables;
-
- ut_a(top_of_stack < ib_vector_size(savepoints));
- /* Exchange tables between last savepoint and top savepoint */
- last_savepoint = static_cast<fts_savepoint_t*>(
- ib_vector_last(trx->fts_trx->savepoints));
- top_savepoint = static_cast<fts_savepoint_t*>(
- ib_vector_get(savepoints, top_of_stack));
- tables = top_savepoint->tables;
- top_savepoint->tables = last_savepoint->tables;
- last_savepoint->tables = tables;
-
- /* Skip the implied savepoint. */
- for (i = ib_vector_size(savepoints) - 1;
- i > top_of_stack;
- --i) {
-
- fts_savepoint_t* savepoint;
-
- savepoint = static_cast<fts_savepoint_t*>(
- ib_vector_get(savepoints, i));
-
- /* Skip savepoints that were released earlier. */
- if (savepoint->name != NULL) {
- savepoint->name = NULL;
- fts_savepoint_free(savepoint);
- }
-
- ib_vector_pop(savepoints);
- }
+ fts_savepoint_free(savepoint);
+ ib_vector_remove(savepoints, *(void**)savepoint);
/* Make sure we don't delete the implied savepoint. */
ut_a(ib_vector_size(savepoints) > 0);
-
- /* This must hold. */
- ut_a(ib_vector_size(savepoints) == (top_of_stack + 1));
}
}
@@ -6330,7 +6267,7 @@ fts_fake_hex_to_dec(
{
ib_id_t dec_id = 0;
char tmp_id[FTS_AUX_MIN_TABLE_ID_LENGTH];
- int ret;
+ int ret __attribute__((unused));
ret = sprintf(tmp_id, UINT64PFx, id);
ut_ad(ret == 16);
diff --git a/storage/xtradb/fts/fts0opt.cc b/storage/xtradb/fts/fts0opt.cc
index 2e2bd061d07..e096b8bf6d6 100644
--- a/storage/xtradb/fts/fts0opt.cc
+++ b/storage/xtradb/fts/fts0opt.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2007, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2007, 2015, 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
@@ -42,9 +42,6 @@ Completed 2011/7/10 Sunny and Jimmy Yang
/** The FTS optimize thread's work queue. */
static ib_wqueue_t* fts_optimize_wq;
-/** The number of document ids to delete in one statement. */
-static const ulint FTS_MAX_DELETE_DOC_IDS = 1000;
-
/** Time to wait for a message. */
static const ulint FTS_QUEUE_WAIT_IN_USECS = 5000000;
@@ -1154,6 +1151,7 @@ fts_optimize_encode_node(
}
/* Calculate the space required to store the ilist. */
+ ut_ad(doc_id > node->last_doc_id);
doc_id_delta = doc_id - node->last_doc_id;
enc_len = fts_get_encoded_len(static_cast<ulint>(doc_id_delta));
@@ -1396,7 +1394,8 @@ fts_optimize_word(
src_node = (fts_node_t*) ib_vector_get(word->nodes, i);
- if (!dst_node) {
+ if (dst_node == NULL
+ || dst_node->last_doc_id > src_node->first_doc_id) {
dst_node = static_cast<fts_node_t*>(
ib_vector_push(nodes, NULL));
@@ -2577,8 +2576,6 @@ fts_optimize_add_table(
return;
}
- ut_ad(table->cached && table->fts != NULL);
-
/* Make sure table with FTS index cannot be evicted */
if (table->can_be_evicted) {
dict_table_move_from_lru_to_non_lru(table);
diff --git a/storage/xtradb/fts/fts0que.cc b/storage/xtradb/fts/fts0que.cc
index 1ca5f80b182..66060439215 100644
--- a/storage/xtradb/fts/fts0que.cc
+++ b/storage/xtradb/fts/fts0que.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2007, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2007, 2015, 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
@@ -57,9 +57,6 @@ Completed 2011/7/10 Sunny and Jimmy Yang
/*Initial byte length for 'words' in fts_ranking_t */
#define RANKING_WORDS_INIT_LEN 4
-/* Coeffecient to use for normalize relevance ranking. */
-static const double FTS_NORMALIZE_COEFF = 0.0115F;
-
// FIXME: Need to have a generic iterator that traverses the ilist.
typedef std::vector<fts_string_t> word_vector_t;
@@ -1534,7 +1531,8 @@ fts_merge_doc_ids(
{
const ib_rbt_node_t* node;
- ut_a(!rbt_empty(doc_ids));
+ DBUG_ENTER("fts_merge_doc_ids");
+
ut_a(!query->intersection);
/* To process FTS_EXIST operation (intersection), we need
@@ -1559,7 +1557,7 @@ fts_merge_doc_ids(
query, ranking->doc_id, ranking->rank);
if (query->error != DB_SUCCESS) {
- return(query->error);
+ DBUG_RETURN(query->error);
}
/* Merge words. Don't need to take operator into account. */
@@ -1578,7 +1576,7 @@ fts_merge_doc_ids(
query->intersection = NULL;
}
- return(DB_SUCCESS);
+ DBUG_RETURN(DB_SUCCESS);
}
/*****************************************************************//**
@@ -2839,11 +2837,11 @@ fts_query_visitor(
fts_query_t* query = static_cast<fts_query_t*>(arg);
ut_a(node);
+ DBUG_ENTER("fts_query_visitor");
+ DBUG_PRINT("fts", ("nodetype: %s", fts_ast_node_type_get(node->type)));
token.f_n_char = 0;
-
query->oper = oper;
-
query->cur_node = node;
switch (node->type) {
@@ -2905,7 +2903,7 @@ fts_query_visitor(
query->multi_exist = true;
}
- return(query->error);
+ DBUG_RETURN(query->error);
}
/*****************************************************************//**
@@ -2929,6 +2927,8 @@ fts_ast_visit_sub_exp(
bool will_be_ignored = false;
bool multi_exist;
+ DBUG_ENTER("fts_ast_visit_sub_exp");
+
ut_a(node->type == FTS_AST_SUBEXP_LIST);
cur_oper = query->oper;
@@ -2957,14 +2957,14 @@ fts_ast_visit_sub_exp(
/* Merge the sub-expression result with the parent result set. */
subexpr_doc_ids = query->doc_ids;
query->doc_ids = parent_doc_ids;
- if (error == DB_SUCCESS && !rbt_empty(subexpr_doc_ids)) {
+ if (error == DB_SUCCESS) {
error = fts_merge_doc_ids(query, subexpr_doc_ids);
}
/* Free current result set. Result already merged into parent. */
fts_query_free_doc_ids(query, subexpr_doc_ids);
- return(error);
+ DBUG_RETURN(error);
}
#if 0
@@ -3440,8 +3440,10 @@ fts_retrieve_ranking(
ib_rbt_bound_t parent;
fts_ranking_t new_ranking;
+ DBUG_ENTER("fts_retrieve_ranking");
+
if (!result || !result->rankings_by_id) {
- return(0);
+ DBUG_RETURN(0);
}
new_ranking.doc_id = doc_id;
@@ -3452,10 +3454,10 @@ fts_retrieve_ranking(
ranking = rbt_value(fts_ranking_t, parent.last);
- return(ranking->rank);
+ DBUG_RETURN(ranking->rank);
}
- return(0);
+ DBUG_RETURN(0);
}
/*****************************************************************//**
@@ -3472,6 +3474,8 @@ fts_query_prepare_result(
const ib_rbt_node_t* node;
bool result_is_null = false;
+ DBUG_ENTER("fts_query_prepare_result");
+
if (result == NULL) {
result = static_cast<fts_result_t*>(ut_malloc(sizeof(*result)));
@@ -3520,7 +3524,7 @@ fts_query_prepare_result(
if (query->total_size > fts_result_cache_limit) {
query->error = DB_FTS_EXCEED_RESULT_CACHE_LIMIT;
fts_query_free_result(result);
- return(NULL);
+ DBUG_RETURN(NULL);
}
}
@@ -3543,7 +3547,7 @@ fts_query_prepare_result(
ranking->rank * word_freq->idf * word_freq->idf);
}
- return(result);
+ DBUG_RETURN(result);
}
ut_a(rbt_size(query->doc_ids) > 0);
@@ -3570,7 +3574,7 @@ fts_query_prepare_result(
if (query->total_size > fts_result_cache_limit) {
query->error = DB_FTS_EXCEED_RESULT_CACHE_LIMIT;
fts_query_free_result(result);
- return(NULL);
+ DBUG_RETURN(NULL);
}
}
}
@@ -3582,7 +3586,7 @@ fts_query_prepare_result(
query->doc_ids = NULL;
}
- return(result);
+ DBUG_RETURN(result);
}
/*****************************************************************//**
@@ -3594,6 +3598,8 @@ fts_query_get_result(
fts_query_t* query, /*!< in: query instance */
fts_result_t* result) /*!< in: result */
{
+ DBUG_ENTER("fts_query_get_result");
+
if (rbt_size(query->doc_ids) > 0 || query->flags == FTS_OPT_RANKING) {
/* Copy the doc ids to the result. */
result = fts_query_prepare_result(query, result);
@@ -3603,7 +3609,7 @@ fts_query_get_result(
memset(result, 0, sizeof(*result));
}
- return(result);
+ DBUG_RETURN(result);
}
/*****************************************************************//**
@@ -3681,6 +3687,7 @@ fts_query_parse(
int error;
fts_ast_state_t state;
bool mode = query->boolean_mode;
+ DBUG_ENTER("fts_query_parse");
memset(&state, 0x0, sizeof(state));
@@ -3699,7 +3706,7 @@ fts_query_parse(
query->root = state.root;
}
- return(state.root);
+ DBUG_RETURN(state.root);
}
/*******************************************************************//**
diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc
index 42a49e355e6..ef6aae7889e 100644
--- a/storage/xtradb/handler/ha_innodb.cc
+++ b/storage/xtradb/handler/ha_innodb.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2000, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2000, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, 2009 Google Inc.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2012, Facebook Inc.
@@ -355,7 +355,6 @@ static PSI_mutex_info all_innodb_mutexes[] = {
# ifndef PFS_SKIP_BUFFER_MUTEX_RWLOCK
{&buffer_block_mutex_key, "buffer_block_mutex", 0},
# endif /* !PFS_SKIP_BUFFER_MUTEX_RWLOCK */
- {&buf_pool_mutex_key, "buf_pool_mutex", 0},
{&buf_pool_zip_mutex_key, "buf_pool_zip_mutex", 0},
{&buf_pool_LRU_list_mutex_key, "buf_pool_LRU_list_mutex", 0},
{&buf_pool_free_list_mutex_key, "buf_pool_free_list_mutex", 0},
@@ -1890,6 +1889,15 @@ convert_error_code_to_mysql(
return(HA_ERR_TO_BIG_ROW);
}
+
+ case DB_TOO_BIG_FOR_REDO:
+ my_printf_error(ER_TOO_BIG_ROWSIZE, "%s" , MYF(0),
+ "The size of BLOB/TEXT data inserted"
+ " in one transaction is greater than"
+ " 10% of redo log size. Increase the"
+ " redo log size using innodb_log_file_size.");
+ return(HA_ERR_TO_BIG_ROW);
+
case DB_TOO_BIG_INDEX_COL:
my_error(ER_INDEX_COLUMN_TOO_LONG, MYF(0),
DICT_MAX_FIELD_LEN_BY_FORMAT_FLAG(flags));
@@ -3203,19 +3211,6 @@ trx_is_strict(
return(trx && trx->mysql_thd && THDVAR(trx->mysql_thd, strict_mode));
}
-/**********************************************************************//**
-Determines if the current MySQL thread is running in strict mode.
-If thd==NULL, THDVAR returns the global value of innodb-strict-mode.
-@return TRUE if strict */
-UNIV_INLINE
-ibool
-thd_is_strict(
-/*==========*/
- THD* thd) /*!< in: MySQL thread descriptor */
-{
- return(THDVAR(thd, strict_mode));
-}
-
/**************************************************************//**
Resets some fields of a prebuilt struct. The template is used in fast
retrieval of just those column values MySQL needs in its processing. */
@@ -4809,7 +4804,10 @@ innobase_release_savepoint(
DBUG_ASSERT(hton == innodb_hton_ptr);
trx = check_trx_exists(thd);
- trx_start_if_not_started(trx);
+
+ if (trx->state == TRX_STATE_NOT_STARTED) {
+ trx_start_if_not_started(trx);
+ }
/* TODO: use provided savepoint data area to store savepoint data */
@@ -5463,6 +5461,8 @@ innobase_match_index_columns(
if (innodb_idx_fld >= innodb_idx_fld_end) {
DBUG_RETURN(FALSE);
}
+
+ mtype = innodb_idx_fld->col->mtype;
}
if (col_type != mtype) {
@@ -7468,12 +7468,15 @@ ha_innobase::innobase_lock_autoinc(void)
break;
case AUTOINC_NEW_STYLE_LOCKING:
- /* For simple (single/multi) row INSERTs, we fallback to the
- old style only if another transaction has already acquired
- the AUTOINC lock on behalf of a LOAD FILE or INSERT ... SELECT
- etc. type of statement. */
+ /* For simple (single/multi) row INSERTs/REPLACEs and RBR
+ events, we fallback to the old style only if another
+ transaction has already acquired the AUTOINC lock on
+ behalf of a LOAD FILE or INSERT ... SELECT etc. type of
+ statement. */
if (thd_sql_command(user_thd) == SQLCOM_INSERT
- || thd_sql_command(user_thd) == SQLCOM_REPLACE) {
+ || thd_sql_command(user_thd) == SQLCOM_REPLACE
+ || thd_sql_command(user_thd) == SQLCOM_END // RBR event
+ ) {
dict_table_t* ib_table = prebuilt->table;
/* Acquire the AUTOINC mutex. */
@@ -7482,9 +7485,11 @@ ha_innobase::innobase_lock_autoinc(void)
/* We need to check that another transaction isn't
already holding the AUTOINC lock on the table. */
if (ib_table->n_waiting_or_granted_auto_inc_locks) {
- /* Release the mutex to avoid deadlocks. */
+ /* Release the mutex to avoid deadlocks and
+ fall back to old style locking. */
dict_table_autoinc_unlock(ib_table);
} else {
+ /* Do not fall back to old style locking. */
break;
}
}
@@ -8026,7 +8031,8 @@ calc_row_difference(
}
}
}
- innodb_idx++;
+ if (field->stored_in_db)
+ innodb_idx++;
}
/* If the update changes a column with an FTS index on it, we
@@ -8941,6 +8947,11 @@ ha_innobase::general_fetch(
DBUG_ENTER("general_fetch");
+ /* If transaction is not startted do not continue, instead return a error code. */
+ if(!(prebuilt->sql_stat_start || (prebuilt->trx && prebuilt->trx->state == 1))) {
+ DBUG_RETURN(HA_ERR_END_OF_FILE);
+ }
+
if (UNIV_UNLIKELY(srv_pass_corrupt_table <= 1 && share
&& share->ib_table && share->ib_table->is_corrupt)) {
DBUG_RETURN(HA_ERR_CRASHED);
@@ -9720,18 +9731,18 @@ create_table_def(
/* Adjust for the FTS hidden field */
if (!has_doc_id_col) {
table = dict_mem_table_create(table_name, 0, s_cols + 1,
- flags, flags2, false);
+ flags, flags2);
/* Set the hidden doc_id column. */
table->fts->doc_col = s_cols;
} else {
table = dict_mem_table_create(table_name, 0, s_cols,
- flags, flags2, false);
+ flags, flags2);
table->fts->doc_col = doc_id_col;
}
} else {
table = dict_mem_table_create(table_name, 0, s_cols,
- flags, flags2, false);
+ flags, flags2);
}
if (flags2 & DICT_TF2_TEMPORARY) {
@@ -10797,7 +10808,7 @@ ha_innobase::create(
DBUG_ASSERT(thd != NULL);
DBUG_ASSERT(create_info != NULL);
- if (form->s->fields > REC_MAX_N_USER_FIELDS) {
+ if (form->s->stored_fields > REC_MAX_N_USER_FIELDS) {
DBUG_RETURN(HA_ERR_TOO_MANY_FIELDS);
} else if (srv_read_only_mode) {
DBUG_RETURN(HA_ERR_TABLE_READONLY);
@@ -12184,18 +12195,6 @@ ha_innobase::info_low(
prebuilt->trx->op_info =
"returning various info to MySQL";
}
-
- my_snprintf(path, sizeof(path), "%s/%s%s",
- mysql_data_home, ib_table->name, reg_ext);
-
- unpack_filename(path,path);
-
- /* Note that we do not know the access time of the table,
- nor the CHECK TABLE time, nor the UPDATE or INSERT time. */
-
- if (os_file_get_status(path, &stat_info, false) == DB_SUCCESS) {
- stats.create_time = (ulong) stat_info.ctime;
- }
}
if (flag & HA_STATUS_VARIABLE) {
@@ -12481,6 +12480,20 @@ ha_innobase::info_low(
if (!(flag & HA_STATUS_NO_LOCK)) {
dict_table_stats_unlock(ib_table, RW_S_LATCH);
}
+
+ my_snprintf(path, sizeof(path), "%s/%s%s",
+ mysql_data_home,
+ table->s->normalized_path.str,
+ reg_ext);
+
+ unpack_filename(path,path);
+
+ /* Note that we do not know the access time of the table,
+ nor the CHECK TABLE time, nor the UPDATE or INSERT time. */
+
+ if (os_file_get_status(path, &stat_info, false) == DB_SUCCESS) {
+ stats.create_time = (ulong) stat_info.ctime;
+ }
}
if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) {
@@ -14819,10 +14832,8 @@ ha_innobase::cmp_ref(
len1 = innobase_read_from_2_little_endian(ref1);
len2 = innobase_read_from_2_little_endian(ref2);
- ref1 += 2;
- ref2 += 2;
result = ((Field_blob*) field)->cmp(
- ref1, len1, ref2, len2);
+ ref1 + 2, len1, ref2 + 2, len2);
} else {
result = field->key_cmp(ref1, ref2);
}
@@ -19341,6 +19352,7 @@ innodb_compression_algorithm_validate(
/**********************************************************************
Issue a warning that the row is too big. */
+UNIV_INTERN
void
ib_warn_row_too_big(const dict_table_t* table)
{
@@ -19354,6 +19366,10 @@ ib_warn_row_too_big(const dict_table_t* table)
THD* thd = current_thd;
+ if (thd == NULL) {
+ return;
+ }
+
push_warning_printf(
thd, Sql_condition::WARN_LEVEL_WARN, HA_ERR_TO_BIG_ROW,
"Row size too large (> %lu). Changing some columns to TEXT"
diff --git a/storage/xtradb/handler/handler0alter.cc b/storage/xtradb/handler/handler0alter.cc
index a6ec6e5465f..439c92b0638 100644
--- a/storage/xtradb/handler/handler0alter.cc
+++ b/storage/xtradb/handler/handler0alter.cc
@@ -129,6 +129,7 @@ my_error_innodb(
break;
case DB_OUT_OF_FILE_SPACE:
my_error(ER_RECORD_FILE_FULL, MYF(0), table);
+ ut_error;
break;
case DB_TEMP_FILE_WRITE_FAILURE:
my_error(ER_GET_ERRMSG, MYF(0),
@@ -1458,8 +1459,9 @@ innobase_create_index_field_def(
if a new clustered index is
not being created */
const KEY_PART_INFO* key_part, /*!< in: MySQL key definition */
- index_field_t* index_field) /*!< out: index field
+ index_field_t* index_field, /*!< out: index field
definition for key_part */
+ const Field** fields) /*!< in: MySQL table fields */
{
const Field* field;
ibool is_unsigned;
@@ -1476,6 +1478,7 @@ innobase_create_index_field_def(
ut_a(field);
index_field->col_no = key_part->fieldnr;
+ index_field->col_name = altered_table ? field->field_name : fields[key_part->fieldnr]->field_name;
col_type = get_innobase_type_from_mysql_type(&is_unsigned, field);
@@ -1510,8 +1513,9 @@ innobase_create_index_def(
bool key_clustered, /*!< in: true if this is
the new clustered index */
index_def_t* index, /*!< out: index definition */
- mem_heap_t* heap) /*!< in: heap where memory
+ mem_heap_t* heap, /*!< in: heap where memory
is allocated */
+ const Field** fields) /*!z in: MySQL table fields */
{
const KEY* key = &keys[key_number];
ulint i;
@@ -1525,6 +1529,8 @@ innobase_create_index_def(
index->fields = static_cast<index_field_t*>(
mem_heap_alloc(heap, n_fields * sizeof *index->fields));
+ memset(index->fields, 0, n_fields * sizeof *index->fields);
+
index->ind_type = 0;
index->key_number = key_number;
index->n_fields = n_fields;
@@ -1561,7 +1567,7 @@ innobase_create_index_def(
for (i = 0; i < n_fields; i++) {
innobase_create_index_field_def(
- altered_table, &key->key_part[i], &index->fields[i]);
+ altered_table, &key->key_part[i], &index->fields[i], fields);
}
DBUG_VOID_RETURN;
@@ -1892,7 +1898,7 @@ innobase_create_key_defs(
/* Create the PRIMARY key index definition */
innobase_create_index_def(
altered_table, key_info, primary_key_number,
- TRUE, TRUE, indexdef++, heap);
+ TRUE, TRUE, indexdef++, heap, (const Field **)altered_table->field);
created_clustered:
n_add = 1;
@@ -1904,7 +1910,7 @@ created_clustered:
/* Copy the index definitions. */
innobase_create_index_def(
altered_table, key_info, i, TRUE, FALSE,
- indexdef, heap);
+ indexdef, heap, (const Field **)altered_table->field);
if (indexdef->ind_type & DICT_FTS) {
n_fts_add++;
@@ -1949,7 +1955,7 @@ created_clustered:
for (ulint i = 0; i < n_add; i++) {
innobase_create_index_def(
altered_table, key_info, add[i], FALSE, FALSE,
- indexdef, heap);
+ indexdef, heap, (const Field **)altered_table->field);
if (indexdef->ind_type & DICT_FTS) {
n_fts_add++;
@@ -1966,6 +1972,7 @@ created_clustered:
index->fields = static_cast<index_field_t*>(
mem_heap_alloc(heap, sizeof *index->fields));
+ memset(index->fields, 0, sizeof *index->fields);
index->n_fields = 1;
index->fields->col_no = fts_doc_id_col;
index->fields->prefix_len = 0;
@@ -2821,7 +2828,7 @@ prepare_inplace_alter_table_dict(
/* The initial space id 0 may be overridden later. */
ctx->new_table = dict_mem_table_create(
- new_table_name, 0, n_cols, flags, flags2, false);
+ new_table_name, 0, n_cols, flags, flags2);
/* The rebuilt indexed_table will use the renamed
column names. */
ctx->col_names = NULL;
@@ -4479,11 +4486,15 @@ err_exit:
rename_foreign:
trx->op_info = "renaming column in SYS_FOREIGN_COLS";
+ std::list<dict_foreign_t*> fk_evict;
+ bool foreign_modified;
+
for (dict_foreign_set::const_iterator it = user_table->foreign_set.begin();
it != user_table->foreign_set.end();
++it) {
dict_foreign_t* foreign = *it;
+ foreign_modified = false;
for (unsigned i = 0; i < foreign->n_fields; i++) {
if (strcmp(foreign->foreign_col_names[i], from)) {
@@ -4511,6 +4522,11 @@ rename_foreign:
if (error != DB_SUCCESS) {
goto err_exit;
}
+ foreign_modified = true;
+ }
+
+ if (foreign_modified) {
+ fk_evict.push_back(foreign);
}
}
@@ -4519,7 +4535,9 @@ rename_foreign:
it != user_table->referenced_set.end();
++it) {
+ foreign_modified = false;
dict_foreign_t* foreign = *it;
+
for (unsigned i = 0; i < foreign->n_fields; i++) {
if (strcmp(foreign->referenced_col_names[i], from)) {
continue;
@@ -4546,7 +4564,17 @@ rename_foreign:
if (error != DB_SUCCESS) {
goto err_exit;
}
+ foreign_modified = true;
}
+
+ if (foreign_modified) {
+ fk_evict.push_back(foreign);
+ }
+ }
+
+ if (new_clustered) {
+ std::for_each(fk_evict.begin(), fk_evict.end(),
+ dict_foreign_remove_from_cache);
}
trx->op_info = "";
diff --git a/storage/xtradb/handler/i_s.cc b/storage/xtradb/handler/i_s.cc
index 962718e7049..af5a7467c8e 100644
--- a/storage/xtradb/handler/i_s.cc
+++ b/storage/xtradb/handler/i_s.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2007, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2007, 2015, 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
@@ -170,9 +170,12 @@ do { \
} \
} while (0)
-#if !defined __STRICT_ANSI__ && defined __GNUC__ && (__GNUC__) > 2 && \
- !defined __INTEL_COMPILER && !defined __clang__
+#if !defined __STRICT_ANSI__ && defined __GNUC__ && (__GNUC__) > 2 && !defined __INTEL_COMPILER && !defined __clang__
+#ifdef HAVE_C99_INITIALIZERS
+#define STRUCT_FLD(name, value) .name = value
+#else
#define STRUCT_FLD(name, value) name: value
+#endif /* HAVE_C99_INITIALIZERS */
#else
#define STRUCT_FLD(name, value) value
#endif
@@ -3254,8 +3257,6 @@ i_s_fts_index_cache_fill_one_index(
for (rbt_node = rbt_first(index_cache->words);
rbt_node;
rbt_node = rbt_next(index_cache->words, rbt_node)) {
- doc_id_t doc_id = 0;
-
fts_tokenizer_word_t* word;
word = rbt_value(fts_tokenizer_word_t, rbt_node);
@@ -3281,6 +3282,7 @@ i_s_fts_index_cache_fill_one_index(
fts_node_t* node;
byte* ptr;
ulint decoded = 0;
+ doc_id_t doc_id = 0;
node = static_cast<fts_node_t*> (ib_vector_get(
word->nodes, i));
@@ -3952,10 +3954,14 @@ i_s_fts_config_fill(
if (!user_table) {
DBUG_RETURN(0);
+ } else if (!dict_table_has_fts_index(user_table)) {
+ dict_table_close(user_table, FALSE, FALSE);
+
+ DBUG_RETURN(0);
}
trx = trx_allocate_for_background();
- trx->op_info = "Select for FTS DELETE TABLE";
+ trx->op_info = "Select for FTS CONFIG TABLE";
FTS_INIT_FTS_TABLE(&fts_table, "CONFIG", FTS_COMMON_TABLE, user_table);
@@ -5188,11 +5194,6 @@ i_s_innodb_fill_buffer_pool(
info_buffer = (buf_page_info_t*) mem_heap_zalloc(
heap, mem_size);
- /* Obtain appropriate mutexes. Since this is diagnostic
- buffer pool info printout, we are not required to
- preserve the overall consistency, so we can
- release mutex periodically */
-
/* GO through each block in the chunk */
for (n_blocks = num_to_process; n_blocks--; block++) {
i_s_innodb_buffer_page_get_info(
diff --git a/storage/xtradb/ibuf/ibuf0ibuf.cc b/storage/xtradb/ibuf/ibuf0ibuf.cc
index ef6c9c74558..972208c51bd 100644
--- a/storage/xtradb/ibuf/ibuf0ibuf.cc
+++ b/storage/xtradb/ibuf/ibuf0ibuf.cc
@@ -611,8 +611,7 @@ ibuf_init_at_db_start(void)
heap = mem_heap_create(450);
/* Use old-style record format for the insert buffer. */
- table = dict_mem_table_create(IBUF_TABLE_NAME, IBUF_SPACE_ID, 1, 0, 0,
- false);
+ table = dict_mem_table_create(IBUF_TABLE_NAME, IBUF_SPACE_ID, 1, 0, 0);
dict_mem_table_add_col(table, heap, "DUMMY_COLUMN", DATA_BINARY, 0, 0);
@@ -1573,7 +1572,7 @@ ibuf_dummy_index_create(
table = dict_mem_table_create("IBUF_DUMMY",
DICT_HDR_SPACE, n,
- comp ? DICT_TF_COMPACT : 0, 0, true);
+ comp ? DICT_TF_COMPACT : 0, 0);
index = dict_mem_index_create("IBUF_DUMMY", "IBUF_DUMMY",
DICT_HDR_SPACE, 0, n);
@@ -2879,6 +2878,12 @@ ibuf_contract_in_background(
mutex_exit(&ibuf_mutex);
}
+#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
+ if (ibuf_debug) {
+ return(0);
+ }
+#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
+
while (sum_pages < n_pages) {
ulint n_bytes;
@@ -3931,7 +3936,7 @@ check_watch:
{
buf_page_t* bpage;
buf_pool_t* buf_pool = buf_pool_get(space, page_no);
- bpage = buf_page_hash_get(buf_pool, space, page_no);
+ bpage = buf_page_get_also_watch(buf_pool, space, page_no);
if (UNIV_LIKELY_NULL(bpage)) {
/* A buffer pool watch has been set or the
diff --git a/storage/xtradb/include/buf0buf.h b/storage/xtradb/include/buf0buf.h
index 15f36e4343c..d8a3e77d820 100644
--- a/storage/xtradb/include/buf0buf.h
+++ b/storage/xtradb/include/buf0buf.h
@@ -1283,7 +1283,7 @@ page_hash lock is acquired in the specified lock mode. Otherwise,
mode value is ignored. It is up to the caller to release the
lock. If the block is found and the lock is NULL then the page_hash
lock is released by this function.
-@return block, NULL if not found */
+@return block, NULL if not found, or watch sentinel (if watch is true) */
UNIV_INLINE
buf_page_t*
buf_page_hash_get_locked(
@@ -1299,9 +1299,11 @@ buf_page_hash_get_locked(
found. NULL otherwise. If NULL
is passed then the hash_lock
is released by this function */
- ulint lock_mode); /*!< in: RW_LOCK_EX or
+ ulint lock_mode, /*!< in: RW_LOCK_EX or
RW_LOCK_SHARED. Ignored if
lock == NULL */
+ bool watch = false); /*!< in: if true, return watch
+ sentinel also. */
/******************************************************************//**
Returns the control block of a file page, NULL if not found.
If the block is found and lock is not NULL then the appropriate
@@ -1341,6 +1343,8 @@ buf_page_hash_get_low() function.
buf_page_hash_get_locked(b, s, o, l, RW_LOCK_EX)
#define buf_page_hash_get(b, s, o) \
buf_page_hash_get_locked(b, s, o, NULL, 0)
+#define buf_page_get_also_watch(b, s, o) \
+ buf_page_hash_get_locked(b, s, o, NULL, 0, true)
#define buf_block_hash_get_s_locked(b, s, o, l) \
buf_block_hash_get_locked(b, s, o, l, RW_LOCK_SHARED)
diff --git a/storage/xtradb/include/buf0buf.ic b/storage/xtradb/include/buf0buf.ic
index 10f0e02cb8f..b40285ae3f0 100644
--- a/storage/xtradb/include/buf0buf.ic
+++ b/storage/xtradb/include/buf0buf.ic
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2014, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@@ -1193,7 +1193,7 @@ page_hash lock is acquired in the specified lock mode. Otherwise,
mode value is ignored. It is up to the caller to release the
lock. If the block is found and the lock is NULL then the page_hash
lock is released by this function.
-@return block, NULL if not found */
+@return block, NULL if not found, or watch sentinel (if watch is true) */
UNIV_INLINE
buf_page_t*
buf_page_hash_get_locked(
@@ -1209,9 +1209,11 @@ buf_page_hash_get_locked(
found. NULL otherwise. If NULL
is passed then the hash_lock
is released by this function */
- ulint lock_mode) /*!< in: RW_LOCK_EX or
+ ulint lock_mode, /*!< in: RW_LOCK_EX or
RW_LOCK_SHARED. Ignored if
lock == NULL */
+ bool watch) /*!< in: if true, return watch
+ sentinel also. */
{
buf_page_t* bpage = NULL;
ulint fold;
@@ -1242,7 +1244,9 @@ buf_page_hash_get_locked(
bpage = buf_page_hash_get_low(buf_pool, space, offset, fold);
if (!bpage || buf_pool_watch_is_sentinel(buf_pool, bpage)) {
- bpage = NULL;
+ if (!watch) {
+ bpage = NULL;
+ }
goto unlock_and_exit;
}
diff --git a/storage/xtradb/include/buf0flu.h b/storage/xtradb/include/buf0flu.h
index ab5349901e9..5cc0eb9d4cf 100644
--- a/storage/xtradb/include/buf0flu.h
+++ b/storage/xtradb/include/buf0flu.h
@@ -85,8 +85,8 @@ buf_flush_init_for_writing(
# if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
/********************************************************************//**
Writes a flushable page asynchronously from the buffer pool to a file.
-NOTE: block->mutex must be held upon entering this function, and they will be
-released by this function after flushing. This is loosely based on
+NOTE: block and LRU list mutexes must be held upon entering this function, and
+they will be released by this function after flushing. This is loosely based on
buf_flush_batch() and buf_flush_page().
@return TRUE if the page was flushed and the mutexes released */
UNIV_INTERN
diff --git a/storage/xtradb/include/db0err.h b/storage/xtradb/include/db0err.h
index 744b80ecd05..dab917e18db 100644
--- a/storage/xtradb/include/db0err.h
+++ b/storage/xtradb/include/db0err.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2012, 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
@@ -130,7 +130,8 @@ enum dberr_t {
DB_TEMP_FILE_WRITE_FAILURE, /*!< Temp file write failure */
DB_FTS_TOO_MANY_WORDS_IN_PHRASE,
/*< Too many words in a phrase */
-
+ DB_TOO_BIG_FOR_REDO, /* Record length greater than 10%
+ of redo log */
/* The following are partial failure codes */
DB_FAIL = 1000,
DB_OVERFLOW,
diff --git a/storage/xtradb/include/dict0dict.h b/storage/xtradb/include/dict0dict.h
index c2bf55a1a16..43fa613e756 100644
--- a/storage/xtradb/include/dict0dict.h
+++ b/storage/xtradb/include/dict0dict.h
@@ -600,6 +600,17 @@ dict_table_get_col_name(
ulint col_nr) /*!< in: column number */
__attribute__((nonnull, warn_unused_result));
/**********************************************************************//**
+Returns a column's name.
+@return column name. NOTE: not guaranteed to stay valid if table is
+modified in any way (columns added, etc.). */
+UNIV_INTERN
+const char*
+dict_table_get_col_name_for_mysql(
+/*==============================*/
+ const dict_table_t* table, /*!< in: table */
+ const char* col_name)/*!< in: MySQL table column name */
+ __attribute__((nonnull, warn_unused_result));
+/**********************************************************************//**
Prints a table data. */
UNIV_INTERN
void
diff --git a/storage/xtradb/include/dict0mem.h b/storage/xtradb/include/dict0mem.h
index 7bec1499fd2..473aefec418 100644
--- a/storage/xtradb/include/dict0mem.h
+++ b/storage/xtradb/include/dict0mem.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
Copyright (c) 2013, SkySQL Ab. All Rights Reserved.
@@ -54,6 +54,7 @@ Created 1/8/1996 Heikki Tuuri
#include <set>
#include <algorithm>
#include <iterator>
+#include <ostream>
/* Forward declaration. */
struct ib_rbt_t;
@@ -313,10 +314,7 @@ dict_mem_table_create(
of the table is placed */
ulint n_cols, /*!< in: number of columns */
ulint flags, /*!< in: table flags */
- ulint flags2, /*!< in: table flags2 */
- bool nonshared);/*!< in: whether the table object is a dummy
- one that does not need the initialization of
- locking-related fields. */
+ ulint flags2); /*!< in: table flags2 */
/**********************************************************************//**
Determines if a table belongs to a system database
@return true if table belong to a system database */
@@ -608,11 +606,12 @@ extern ulong zip_failure_threshold_pct;
compression failures */
extern ulong zip_pad_max;
-/** Data structure to hold information about about how much space in
+/** Data structure to hold information about how much space in
an uncompressed page should be left as padding to avoid compression
failures. This estimate is based on a self-adapting heuristic. */
struct zip_pad_info_t {
- os_fast_mutex_t mutex; /*!< mutex protecting the info */
+ os_fast_mutex_t*
+ mutex; /*!< mutex protecting the info */
ulint pad; /*!< number of bytes used as pad */
ulint success;/*!< successful compression ops during
current round */
@@ -620,6 +619,9 @@ struct zip_pad_info_t {
current round */
ulint n_rounds;/*!< number of currently successful
rounds */
+ volatile os_once::state_t
+ mutex_created;
+ /*!< Creation state of mutex member */
};
/** Data structure for an index. Most fields will be
@@ -1098,8 +1100,7 @@ struct dict_table_t{
dict_table_t::indexes*::stat_index_size
dict_table_t::indexes*::stat_n_leaf_pages
(*) those are not always protected for
- performance reasons. NULL for dumy table
- objects. */
+ performance reasons. */
unsigned stat_initialized:1; /*!< TRUE if statistics have
been calculated the first time
after database startup or table creation */
@@ -1224,12 +1225,15 @@ struct dict_table_t{
and release it without a need to allocate
space from the lock heap of the trx:
otherwise the lock heap would grow rapidly
- if we do a large insert from a select. NULL
- for dummy table objects. */
- ib_mutex_t autoinc_mutex;
+ if we do a large insert from a select */
+ ib_mutex_t* autoinc_mutex;
/*!< mutex protecting the autoincrement
- counter. Not initialized for dummy table
- objects */
+ counter */
+
+ /** Creation state of autoinc_mutex member */
+ volatile os_once::state_t
+ autoinc_mutex_created;
+
ib_uint64_t autoinc;/*!< autoinc counter value to give to the
next inserted row */
ulong n_waiting_or_granted_auto_inc_locks;
@@ -1293,6 +1297,111 @@ struct dict_foreign_add_to_referenced_table {
}
};
+/** Destroy the autoinc latch of the given table.
+This function is only called from either single threaded environment
+or from a thread that has not shared the table object with other threads.
+@param[in,out] table table whose stats latch to destroy */
+inline
+void
+dict_table_autoinc_destroy(
+ dict_table_t* table)
+{
+ if (table->autoinc_mutex_created == os_once::DONE
+ && table->autoinc_mutex != NULL) {
+ mutex_free(table->autoinc_mutex);
+ delete table->autoinc_mutex;
+ }
+}
+
+/** Allocate and init the autoinc latch of a given table.
+This function must not be called concurrently on the same table object.
+@param[in,out] table_void table whose autoinc latch to create */
+void
+dict_table_autoinc_alloc(
+ void* table_void);
+
+/** Allocate and init the zip_pad_mutex of a given index.
+This function must not be called concurrently on the same index object.
+@param[in,out] index_void index whose zip_pad_mutex to create */
+void
+dict_index_zip_pad_alloc(
+ void* index_void);
+
+/** Request for lazy creation of the autoinc latch of a given table.
+This function is only called from either single threaded environment
+or from a thread that has not shared the table object with other threads.
+@param[in,out] table table whose autoinc latch is to be created. */
+inline
+void
+dict_table_autoinc_create_lazy(
+ dict_table_t* table)
+{
+#ifdef HAVE_ATOMIC_BUILTINS
+ table->autoinc_mutex = NULL;
+ table->autoinc_mutex_created = os_once::NEVER_DONE;
+#else /* HAVE_ATOMIC_BUILTINS */
+ dict_table_autoinc_alloc(table);
+ table->autoinc_mutex_created = os_once::DONE;
+#endif /* HAVE_ATOMIC_BUILTINS */
+}
+
+/** Request a lazy creation of dict_index_t::zip_pad::mutex.
+This function is only called from either single threaded environment
+or from a thread that has not shared the table object with other threads.
+@param[in,out] index index whose zip_pad mutex is to be created */
+inline
+void
+dict_index_zip_pad_mutex_create_lazy(
+ dict_index_t* index)
+{
+#ifdef HAVE_ATOMIC_BUILTINS
+ index->zip_pad.mutex = NULL;
+ index->zip_pad.mutex_created = os_once::NEVER_DONE;
+#else /* HAVE_ATOMIC_BUILTINS */
+ dict_index_zip_pad_alloc(index);
+ index->zip_pad.mutex_created = os_once::DONE;
+#endif /* HAVE_ATOMIC_BUILTINS */
+}
+
+/** Destroy the zip_pad_mutex of the given index.
+This function is only called from either single threaded environment
+or from a thread that has not shared the table object with other threads.
+@param[in,out] table table whose stats latch to destroy */
+inline
+void
+dict_index_zip_pad_mutex_destroy(
+ dict_index_t* index)
+{
+ if (index->zip_pad.mutex_created == os_once::DONE
+ && index->zip_pad.mutex != NULL) {
+ os_fast_mutex_free(index->zip_pad.mutex);
+ delete index->zip_pad.mutex;
+ }
+}
+
+/** Release the zip_pad_mutex of a given index.
+@param[in,out] index index whose zip_pad_mutex is to be released */
+inline
+void
+dict_index_zip_pad_unlock(
+ dict_index_t* index)
+{
+ os_fast_mutex_unlock(index->zip_pad.mutex);
+}
+
+#ifdef UNIV_DEBUG
+/** Check if the current thread owns the autoinc_mutex of a given table.
+@param[in] table the autoinc_mutex belongs to this table
+@return true, if the current thread owns the autoinc_mutex, false otherwise.*/
+inline
+bool
+dict_table_autoinc_own(
+ const dict_table_t* table)
+{
+ return(mutex_own(table->autoinc_mutex));
+}
+#endif /* UNIV_DEBUG */
+
#ifndef UNIV_NONINL
#include "dict0mem.ic"
#endif
diff --git a/storage/xtradb/include/fts0ast.h b/storage/xtradb/include/fts0ast.h
index 50ee587e282..b2380f78b39 100644
--- a/storage/xtradb/include/fts0ast.h
+++ b/storage/xtradb/include/fts0ast.h
@@ -329,4 +329,11 @@ struct fts_ast_state_t {
tokenization */
};
+#ifdef UNIV_DEBUG
+const char*
+fts_ast_oper_name_get(fts_ast_oper_t oper);
+const char*
+fts_ast_node_type_get(fts_ast_type_t type);
+#endif /* UNIV_DEBUG */
+
#endif /* INNOBASE_FSTS0AST_H */
diff --git a/storage/xtradb/include/ha_prototypes.h b/storage/xtradb/include/ha_prototypes.h
index 66a96282b69..3c14828989b 100644
--- a/storage/xtradb/include/ha_prototypes.h
+++ b/storage/xtradb/include/ha_prototypes.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2006, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2006, 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
diff --git a/storage/xtradb/include/lock0priv.h b/storage/xtradb/include/lock0priv.h
index e564387ec53..90d5dc994a4 100644
--- a/storage/xtradb/include/lock0priv.h
+++ b/storage/xtradb/include/lock0priv.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2007, 2011, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2015, MariaDB Corporation
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
@@ -72,6 +73,12 @@ struct lock_t {
hash_node_t hash; /*!< hash chain node for a record
lock */
dict_index_t* index; /*!< index for a record lock */
+
+ /* Statistics for how long lock has been held and time
+ how long this lock had to be waited before it was granted */
+ time_t requested_time; /*!< Lock request time */
+ ulint wait_time; /*!< Time waited this lock or 0 */
+
union {
lock_table_t tab_lock;/*!< table lock */
lock_rec_t rec_lock;/*!< record lock */
diff --git a/storage/xtradb/include/os0file.h b/storage/xtradb/include/os0file.h
index 89a1d8c0fe4..78af907c006 100644
--- a/storage/xtradb/include/os0file.h
+++ b/storage/xtradb/include/os0file.h
@@ -1,6 +1,6 @@
/***********************************************************************
-Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2014, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2013, SkySQL Ab. All Rights Reserved.
diff --git a/storage/xtradb/include/os0sync.h b/storage/xtradb/include/os0sync.h
index f968de7c6dd..3a7707ee130 100644
--- a/storage/xtradb/include/os0sync.h
+++ b/storage/xtradb/include/os0sync.h
@@ -452,7 +452,7 @@ Returns the old value of *ptr, atomically sets *ptr to new_val */
# define os_atomic_test_and_set_ulint(ptr, new_val) \
__sync_lock_test_and_set(ptr, new_val)
-#ifdef __powerpc__
+#if defined(__powerpc__) || defined(__aarch64__)
/*
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
@@ -531,7 +531,7 @@ amount of increment. */
os_atomic_increment_ulint((ulong_t*) ptr, amount)
# define os_atomic_increment_uint64(ptr, amount) \
- atomic_add_64_nv(ptr, amount)
+ atomic_add_64_nv((uint64_t *) ptr, amount)
/* Returns the resulting value, ptr is pointer to target, amount is the
amount to decrement. */
diff --git a/storage/xtradb/include/row0merge.h b/storage/xtradb/include/row0merge.h
index 390c0ce038b..de353d46202 100644
--- a/storage/xtradb/include/row0merge.h
+++ b/storage/xtradb/include/row0merge.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2005, 2013, 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 the Free Software
@@ -95,6 +95,7 @@ struct index_field_t {
ulint col_no; /*!< column offset */
ulint prefix_len; /*!< column prefix length, or 0
if indexing the whole column */
+ const char* col_name; /*!< column name or NULL */
};
/** Definition of an index being created */
diff --git a/storage/xtradb/include/sync0rw.ic b/storage/xtradb/include/sync0rw.ic
index 8aadc406132..d481d14009b 100644
--- a/storage/xtradb/include/sync0rw.ic
+++ b/storage/xtradb/include/sync0rw.ic
@@ -511,6 +511,7 @@ rw_lock_x_lock_func_nowait(
ulint line) /*!< in: line where requested */
{
ibool success;
+ ibool local_recursive= lock->recursive;
#ifdef INNODB_RW_LOCKS_USE_ATOMICS
success = os_compare_and_swap_lint(&lock->lock_word, X_LOCK_DECR, 0);
@@ -525,10 +526,14 @@ rw_lock_x_lock_func_nowait(
mutex_exit(&(lock->mutex));
#endif
+ /* Note: recursive must be loaded before writer_thread see
+ comment for rw_lock_set_writer_id_and_recursion_flag().
+ To achieve this we load it before os_compare_and_swap_lint(),
+ which implies full memory barrier in current implementation. */
if (success) {
rw_lock_set_writer_id_and_recursion_flag(lock, TRUE);
- } else if (lock->recursive
+ } else if (local_recursive
&& os_thread_eq(lock->writer_thread,
os_thread_get_curr_id())) {
/* Relock: this lock_word modification is safe since no other
diff --git a/storage/xtradb/include/sync0sync.h b/storage/xtradb/include/sync0sync.h
index 788f765f919..ffe2d635fbd 100644
--- a/storage/xtradb/include/sync0sync.h
+++ b/storage/xtradb/include/sync0sync.h
@@ -69,7 +69,6 @@ instrumentation due to their large number of instances. */
/* Key defines to register InnoDB mutexes with performance schema */
extern mysql_pfs_key_t autoinc_mutex_key;
extern mysql_pfs_key_t buffer_block_mutex_key;
-extern mysql_pfs_key_t buf_pool_mutex_key;
extern mysql_pfs_key_t buf_pool_zip_mutex_key;
extern mysql_pfs_key_t buf_pool_LRU_list_mutex_key;
extern mysql_pfs_key_t buf_pool_free_list_mutex_key;
diff --git a/storage/xtradb/include/trx0roll.h b/storage/xtradb/include/trx0roll.h
index aa3dbb1f6cd..629b41569f6 100644
--- a/storage/xtradb/include/trx0roll.h
+++ b/storage/xtradb/include/trx0roll.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2012, 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
@@ -33,6 +33,8 @@ Created 3/26/1996 Heikki Tuuri
#include "mtr0mtr.h"
#include "trx0sys.h"
+extern bool trx_rollback_or_clean_is_active;
+
/*******************************************************************//**
Determines if this transaction is rolling back an incomplete transaction
in crash recovery.
diff --git a/storage/xtradb/include/trx0trx.h b/storage/xtradb/include/trx0trx.h
index c97be0e4f03..fc1871d438e 100644
--- a/storage/xtradb/include/trx0trx.h
+++ b/storage/xtradb/include/trx0trx.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2015, MariaDB Corporation
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
@@ -1058,6 +1059,20 @@ struct trx_t{
#define DPAH_SIZE 8192
byte* distinct_page_access_hash;
ibool take_stats;
+
+ /* Lock wait statistics */
+ ulint n_rec_lock_waits;
+ /*!< Number of record lock waits,
+ might not be exactly correct. */
+ ulint n_table_lock_waits;
+ /*!< Number of table lock waits,
+ might not be exactly correct. */
+ ulint total_rec_lock_wait_time;
+ /*!< Total rec lock wait time up
+ to this moment. */
+ ulint total_table_lock_wait_time;
+ /*!< Total table lock wait time
+ up to this moment. */
};
/* Transaction isolation levels (trx->isolation_level) */
diff --git a/storage/xtradb/include/univ.i b/storage/xtradb/include/univ.i
index 24145d1cbb7..6b0c33df44c 100644
--- a/storage/xtradb/include/univ.i
+++ b/storage/xtradb/include/univ.i
@@ -45,10 +45,10 @@ Created 1/20/1994 Heikki Tuuri
#define INNODB_VERSION_MAJOR 5
#define INNODB_VERSION_MINOR 6
-#define INNODB_VERSION_BUGFIX 22
+#define INNODB_VERSION_BUGFIX 24
#ifndef PERCONA_INNODB_VERSION
-#define PERCONA_INNODB_VERSION 71.0
+#define PERCONA_INNODB_VERSION 72.2
#endif
/* Enable UNIV_LOG_ARCHIVE in XtraDB */
diff --git a/storage/xtradb/lock/lock0lock.cc b/storage/xtradb/lock/lock0lock.cc
index f8fc351aa92..e76bb0e2c62 100644
--- a/storage/xtradb/lock/lock0lock.cc
+++ b/storage/xtradb/lock/lock0lock.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
-Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2014, 2015, MariaDB Corporation
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
@@ -374,7 +375,7 @@ struct lock_stack_t {
ulint heap_no; /*!< heap number if rec lock */
};
-extern "C" void thd_report_wait_for(const MYSQL_THD thd, MYSQL_THD other_thd);
+extern "C" void thd_report_wait_for(MYSQL_THD thd, MYSQL_THD other_thd);
extern "C" int thd_need_wait_for(const MYSQL_THD thd);
extern "C"
int thd_need_ordering_with(const MYSQL_THD thd, const MYSQL_THD other_thd);
@@ -384,8 +385,10 @@ because there is no parallel deadlock check. This stack is protected by
the lock_sys_t::mutex. */
static lock_stack_t* lock_stack;
+#ifdef UNIV_DEBUG
/** The count of the types of locks. */
static const ulint lock_types = UT_ARR_SIZE(lock_compatibility_matrix);
+#endif /* UNIV_DEBUG */
#ifdef UNIV_PFS_MUTEX
/* Key to register mutex with performance schema */
@@ -1897,6 +1900,9 @@ lock_rec_create(
/* Set the bit corresponding to rec */
lock_rec_set_nth_bit(lock, heap_no);
+ lock->requested_time = ut_time();
+ lock->wait_time = 0;
+
index->table->n_rec_locks++;
ut_ad(index->table->n_ref_count > 0 || !index->table->can_be_evicted);
@@ -2055,6 +2061,8 @@ lock_rec_enqueue_waiting(
MONITOR_INC(MONITOR_LOCKREC_WAIT);
+ trx->n_rec_lock_waits++;
+
return(DB_LOCK_WAIT);
}
@@ -2087,7 +2095,8 @@ lock_rec_add_to_queue(
ut_ad(lock_mutex_own());
ut_ad(caller_owns_trx_mutex == trx_mutex_own(trx));
- ut_ad(dict_index_is_clust(index) || !dict_index_is_online_ddl(index));
+ ut_ad(dict_index_is_clust(index)
+ || dict_index_get_online_status(index) != ONLINE_INDEX_CREATION);
#ifdef UNIV_DEBUG
switch (type_mode & LOCK_MODE_MASK) {
case LOCK_X:
@@ -2474,6 +2483,17 @@ lock_grant(
}
}
+ /* Cumulate total lock wait time for statistics */
+ if (lock_get_type_low(lock) & LOCK_TABLE) {
+ lock->trx->total_table_lock_wait_time +=
+ (ulint)difftime(ut_time(), lock->trx->lock.wait_started);
+ } else {
+ lock->trx->total_rec_lock_wait_time +=
+ (ulint)difftime(ut_time(), lock->trx->lock.wait_started);
+ }
+
+ lock->wait_time = (ulint)difftime(ut_time(), lock->requested_time);
+
trx_mutex_exit(lock->trx);
}
@@ -4239,6 +4259,8 @@ lock_table_create(
lock->type_mode = type_mode | LOCK_TABLE;
lock->trx = trx;
+ lock->requested_time = ut_time();
+ lock->wait_time = 0;
lock->un_member.tab_lock.table = table;
@@ -4484,6 +4506,7 @@ lock_table_enqueue_waiting(
trx->lock.wait_started = ut_time();
trx->lock.was_chosen_as_deadlock_victim = FALSE;
+ trx->n_table_lock_waits++;
if (UNIV_UNLIKELY(trx->take_stats)) {
ut_usectime(&sec, &ms);
@@ -5168,6 +5191,10 @@ lock_table_print(
fputs(" waiting", file);
}
+ fprintf(file, " lock hold time %lu wait time before grant %lu ",
+ (ulint)difftime(ut_time(), lock->requested_time),
+ lock->wait_time);
+
putc('\n', file);
}
@@ -5199,7 +5226,14 @@ lock_rec_print(
fprintf(file, "RECORD LOCKS space id %lu page no %lu n bits %lu ",
(ulong) space, (ulong) page_no,
(ulong) lock_rec_get_n_bits(lock));
+
dict_index_name_print(file, lock->trx, lock->index);
+
+ /* Print number of table locks */
+ fprintf(file, " trx table locks %lu total table locks %lu ",
+ ib_vector_size(lock->trx->lock.table_locks),
+ UT_LIST_GET_LEN(lock->index->table->locks));
+
fprintf(file, " trx id " TRX_ID_FMT, lock->trx->id);
if (lock_get_mode(lock) == LOCK_S) {
@@ -5228,6 +5262,10 @@ lock_rec_print(
mtr_start(&mtr);
+ fprintf(file, " lock hold time %lu wait time before grant %lu ",
+ (ulint)difftime(ut_time(), lock->requested_time),
+ lock->wait_time);
+
putc('\n', file);
if ( srv_show_verbose_locks ) {
@@ -5488,6 +5526,14 @@ loop:
trx->read_view->up_limit_id);
}
+ /* Total trx lock waits and times */
+ fprintf(file, "Trx #rec lock waits %lu #table lock waits %lu\n",
+ trx->n_rec_lock_waits, trx->n_table_lock_waits);
+ fprintf(file, "Trx total rec lock wait time %lu SEC\n",
+ trx->total_rec_lock_wait_time);
+ fprintf(file, "Trx total table lock wait time %lu SEC\n",
+ trx->total_table_lock_wait_time);
+
if (trx->lock.que_state == TRX_QUE_LOCK_WAIT) {
fprintf(file,
@@ -5506,7 +5552,7 @@ loop:
}
}
- if (!srv_print_innodb_lock_monitor && !srv_show_locks_held) {
+ if (!srv_print_innodb_lock_monitor || !srv_show_locks_held) {
nth_trx++;
goto loop;
}
diff --git a/storage/xtradb/log/log0log.cc b/storage/xtradb/log/log0log.cc
index 031926fd91f..903bdab02ce 100644
--- a/storage/xtradb/log/log0log.cc
+++ b/storage/xtradb/log/log0log.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2014, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@@ -55,6 +55,7 @@ Created 12/9/1995 Heikki Tuuri
#include "srv0start.h"
#include "trx0sys.h"
#include "trx0trx.h"
+#include "trx0roll.h"
#include "srv0mon.h"
/*
@@ -3514,6 +3515,12 @@ logs_empty_and_mark_files_at_shutdown(void)
if (log_disable_checkpoint_active)
log_enable_checkpoint();
+ while (srv_fast_shutdown == 0 && trx_rollback_or_clean_is_active) {
+ /* we should wait until rollback after recovery end
+ for slow shutdown */
+ os_thread_sleep(100000);
+ }
+
/* Wait until the master thread and all other operations are idle: our
algorithm only works if the server is idle at shutdown */
diff --git a/storage/xtradb/log/log0recv.cc b/storage/xtradb/log/log0recv.cc
index 7bda744704b..42c238810e8 100644
--- a/storage/xtradb/log/log0recv.cc
+++ b/storage/xtradb/log/log0recv.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1997, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1997, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
Copyright (c) 2013, SkySQL Ab. All Rights Reserved.
@@ -1934,7 +1934,7 @@ loop:
goto loop;
}
- ut_ad(!allow_ibuf == mutex_own(&log_sys->mutex));
+ ut_ad((!allow_ibuf) == mutex_own(&log_sys->mutex));
if (!allow_ibuf) {
recv_no_ibuf_operations = TRUE;
@@ -3581,6 +3581,7 @@ recv_recovery_rollback_active(void)
/* Rollback the uncommitted transactions which have no user
session */
+ trx_rollback_or_clean_is_active = true;
os_thread_create(trx_rollback_or_clean_all_recovered, 0, 0);
}
}
diff --git a/storage/xtradb/mtr/mtr0log.cc b/storage/xtradb/mtr/mtr0log.cc
index 0660c819240..5335cb4c9ef 100644
--- a/storage/xtradb/mtr/mtr0log.cc
+++ b/storage/xtradb/mtr/mtr0log.cc
@@ -560,7 +560,7 @@ mlog_parse_index(
n = n_uniq = 1;
}
table = dict_mem_table_create("LOG_DUMMY", DICT_HDR_SPACE, n,
- comp ? DICT_TF_COMPACT : 0, 0, true);
+ comp ? DICT_TF_COMPACT : 0, 0);
ind = dict_mem_index_create("LOG_DUMMY", "LOG_DUMMY",
DICT_HDR_SPACE, 0, n);
ind->table = table;
diff --git a/storage/xtradb/os/os0file.cc b/storage/xtradb/os/os0file.cc
index be6f328aaac..28f1b156224 100644
--- a/storage/xtradb/os/os0file.cc
+++ b/storage/xtradb/os/os0file.cc
@@ -1,6 +1,6 @@
/***********************************************************************
-Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2014, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2013, 2015, MariaDB Corporation.
@@ -870,6 +870,7 @@ os_file_handle_error_cond_exit(
fflush(stderr);
+ ut_error;
return(FALSE);
case OS_FILE_AIO_RESOURCES_RESERVED:
@@ -3126,7 +3127,6 @@ try_again:
ret = os_file_pread(file, buf, n, offset, trx);
if ((ulint) ret == n) {
-
/* Note that InnoDB writes files that are not formated
as file spaces and they do not have FIL_PAGE_TYPE
field, thus we must use here information is the actual
@@ -3136,11 +3136,17 @@ try_again:
}
return(TRUE);
+ } else if (ret == -1) {
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Error in system call pread(). The operating"
+ " system error number is %lu.",(ulint) errno);
+ } else {
+ /* Partial read occured */
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Tried to read " ULINTPF " bytes at offset "
+ UINT64PF ". Was only able to read %ld.",
+ n, offset, (lint) ret);
}
-
- ib_logf(IB_LOG_LEVEL_ERROR,
- "Tried to read " ULINTPF " bytes at offset " UINT64PF ". "
- "Was only able to read %ld.", n, offset, (lint) ret);
#endif /* __WIN__ */
retry = os_file_handle_error(NULL, "read", __FILE__, __LINE__);
@@ -3244,7 +3250,6 @@ try_again:
ret = os_file_pread(file, buf, n, offset, NULL);
if ((ulint) ret == n) {
-
/* Note that InnoDB writes files that are not formated
as file spaces and they do not have FIL_PAGE_TYPE
field, thus we must use here information is the actual
@@ -3254,6 +3259,16 @@ try_again:
}
return(TRUE);
+ } else if (ret == -1) {
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Error in system call pread(). The operating"
+ " system error number is %lu.",(ulint) errno);
+ } else {
+ /* Partial read occured */
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Tried to read " ULINTPF " bytes at offset "
+ UINT64PF ". Was only able to read %ld.",
+ n, offset, (lint) ret);
}
#endif /* __WIN__ */
retry = os_file_handle_error_no_exit(NULL, "read", FALSE, __FILE__, __LINE__);
@@ -3434,18 +3449,26 @@ retry:
ut_print_timestamp(stderr);
- fprintf(stderr,
- " InnoDB: Error: Write to file %s failed"
- " at offset " UINT64PF ".\n"
- "InnoDB: %lu bytes should have been written,"
- " only %ld were written.\n"
- "InnoDB: Operating system error number %lu.\n"
- "InnoDB: Check that your OS and file system"
- " support files of this size.\n"
- "InnoDB: Check also that the disk is not full"
- " or a disk quota exceeded.\n",
- name, offset, n, (lint) ret,
- (ulint) errno);
+ if(ret == -1) {
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Failure of system call pwrite(). Operating"
+ " system error number is %lu.",
+ (ulint) errno);
+ } else {
+ fprintf(stderr,
+ " InnoDB: Error: Write to file %s failed"
+ " at offset " UINT64PF ".\n"
+ "InnoDB: %lu bytes should have been written,"
+ " only %ld were written.\n"
+ "InnoDB: Operating system error number %lu.\n"
+ "InnoDB: Check that your OS and file system"
+ " support files of this size.\n"
+ "InnoDB: Check also that the disk is not full"
+ " or a disk quota exceeded.\n",
+ name, offset, n, (lint) ret,
+ (ulint) errno);
+ }
+
if (strerror(errno) != NULL) {
fprintf(stderr,
"InnoDB: Error number %d means '%s'.\n",
@@ -5088,7 +5111,7 @@ os_aio_func(
mode = mode & (~OS_AIO_SIMULATED_WAKE_LATER);
DBUG_EXECUTE_IF("ib_os_aio_func_io_failure_28",
- mode = OS_AIO_SYNC;);
+ mode = OS_AIO_SYNC; os_has_said_disk_full = FALSE;);
if (mode == OS_AIO_SYNC) {
ibool ret;
@@ -5096,10 +5119,9 @@ os_aio_func(
no need to use an i/o-handler thread */
if (type == OS_FILE_READ) {
- ret = os_file_read_func(file, buf, offset, n, trx,
- page_compression);
- }
- else {
+ ret = os_file_read_func(file, buf, offset, n, trx, page_compression);
+
+ } else {
ut_ad(!srv_read_only_mode);
ut_a(type == OS_FILE_WRITE);
@@ -5108,6 +5130,9 @@ os_aio_func(
DBUG_EXECUTE_IF("ib_os_aio_func_io_failure_28",
os_has_said_disk_full = FALSE; ret = 0; errno = 28;);
+ if (!ret) {
+ os_file_handle_error_cond_exit(name, "os_file_write_func", TRUE, FALSE, __FILE__, __LINE__);
+ }
}
return ret;
@@ -5996,6 +6021,14 @@ consecutive_loop:
ret = os_file_write(
aio_slot->name, aio_slot->file, combined_buf,
aio_slot->offset, total_len);
+
+ DBUG_EXECUTE_IF("ib_os_aio_func_io_failure_28",
+ os_has_said_disk_full = FALSE; ret = 0; errno = 28;);
+
+ if (!ret) {
+ os_file_handle_error_cond_exit(aio_slot->name, "os_file_write_func", TRUE, FALSE, __FILE__, __LINE__);
+ }
+
} else {
ret = os_file_read(
aio_slot->file, combined_buf,
@@ -6003,11 +6036,6 @@ consecutive_loop:
aio_slot->page_compression);
}
- if (aio_slot->type == OS_FILE_WRITE) {
- DBUG_EXECUTE_IF("ib_os_aio_func_io_failure_28_2",
- os_has_said_disk_full = FALSE; ret = 0; errno = 28;);
- }
-
srv_set_io_thread_op_info(global_segment, "file i/o done");
if (aio_slot->type == OS_FILE_READ && n_consecutive > 1) {
diff --git a/storage/xtradb/os/os0sync.cc b/storage/xtradb/os/os0sync.cc
index 451ba5285e3..03c53848832 100644
--- a/storage/xtradb/os/os0sync.cc
+++ b/storage/xtradb/os/os0sync.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2011, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2015, 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
@@ -234,24 +234,6 @@ os_cond_broadcast(
}
/*********************************************************//**
-Wakes one thread waiting for condition variable */
-UNIV_INLINE
-void
-os_cond_signal(
-/*==========*/
- os_cond_t* cond) /*!< in: condition variable. */
-{
- ut_a(cond);
-
-#ifdef __WIN__
- ut_a(wake_condition_variable != NULL);
- wake_condition_variable(cond);
-#else
- ut_a(pthread_cond_signal(cond) == 0);
-#endif
-}
-
-/*********************************************************//**
Destroys condition variable */
UNIV_INLINE
void
diff --git a/storage/xtradb/page/page0zip.cc b/storage/xtradb/page/page0zip.cc
index 535497480b7..d3ac5b261a4 100644
--- a/storage/xtradb/page/page0zip.cc
+++ b/storage/xtradb/page/page0zip.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2005, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2005, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
Copyright (c) 2014, SkySQL Ab. All Rights Reserved.
@@ -1601,7 +1601,7 @@ page_zip_fields_free(
{
if (index) {
dict_table_t* table = index->table;
- os_fast_mutex_free(&index->zip_pad.mutex);
+ dict_index_zip_pad_mutex_destroy(index);
mem_heap_free(index->heap);
dict_mem_table_free(table);
@@ -1652,7 +1652,7 @@ page_zip_fields_decode(
}
table = dict_mem_table_create("ZIP_DUMMY", DICT_HDR_SPACE, n,
- DICT_TF_COMPACT, 0, true);
+ DICT_TF_COMPACT, 0);
index = dict_mem_index_create("ZIP_DUMMY", "ZIP_DUMMY",
DICT_HDR_SPACE, 0, n);
index->table = table;
diff --git a/storage/xtradb/pars/pars0pars.cc b/storage/xtradb/pars/pars0pars.cc
index f051481184b..655e5ba1324 100644
--- a/storage/xtradb/pars/pars0pars.cc
+++ b/storage/xtradb/pars/pars0pars.cc
@@ -1997,7 +1997,7 @@ pars_create_table(
n_cols = que_node_list_get_len(column_defs);
table = dict_mem_table_create(
- table_sym->name, 0, n_cols, flags, flags2, false);
+ table_sym->name, 0, n_cols, flags, flags2);
#ifdef UNIV_DEBUG
if (not_fit_in_memory != NULL) {
diff --git a/storage/xtradb/que/que0que.cc b/storage/xtradb/que/que0que.cc
index 8d9b8fac776..e2dc0239e13 100644
--- a/storage/xtradb/que/que0que.cc
+++ b/storage/xtradb/que/que0que.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1996, 2015, 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
@@ -390,32 +390,6 @@ que_fork_start_command(
return(thr);
}
-/****************************************************************//**
-Tests if all the query threads in the same fork have a given state.
-@return TRUE if all the query threads in the same fork were in the
-given state */
-UNIV_INLINE
-ibool
-que_fork_all_thrs_in_state(
-/*=======================*/
- que_fork_t* fork, /*!< in: query fork */
- ulint state) /*!< in: state */
-{
- que_thr_t* thr_node;
-
- for (thr_node = UT_LIST_GET_FIRST(fork->thrs);
- thr_node != NULL;
- thr_node = UT_LIST_GET_NEXT(thrs, thr_node)) {
-
- if (thr_node->state != state) {
-
- return(FALSE);
- }
- }
-
- return(TRUE);
-}
-
/**********************************************************************//**
Calls que_graph_free_recursive for statements in a statement list. */
static
diff --git a/storage/xtradb/rem/rem0rec.cc b/storage/xtradb/rem/rem0rec.cc
index 0d7b7c16785..c5cc9f02f04 100644
--- a/storage/xtradb/rem/rem0rec.cc
+++ b/storage/xtradb/rem/rem0rec.cc
@@ -842,7 +842,7 @@ rec_get_converted_size_comp_prefix_low(
}
ut_ad(len <= col->len || col->mtype == DATA_BLOB
- || (col->len == 0 && col->mtype == DATA_VARCHAR));
+ || (col->len == 0 && col->mtype == DATA_VARCHAR));
fixed_len = field->fixed_len;
if (temp && fixed_len
diff --git a/storage/xtradb/row/row0ftsort.cc b/storage/xtradb/row/row0ftsort.cc
index e27c4c2805a..e38d9ef6276 100644
--- a/storage/xtradb/row/row0ftsort.cc
+++ b/storage/xtradb/row/row0ftsort.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2010, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2010, 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
diff --git a/storage/xtradb/row/row0log.cc b/storage/xtradb/row/row0log.cc
index 42c0ae928d5..bba8c32b752 100644
--- a/storage/xtradb/row/row0log.cc
+++ b/storage/xtradb/row/row0log.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2011, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2011, 2015, 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
@@ -1382,6 +1382,27 @@ blob_done:
dfield_set_data(dfield, data, len);
}
+ if (len != UNIV_SQL_NULL && col->mtype == DATA_MYSQL
+ && col->len != len && !dict_table_is_comp(log->table)) {
+
+ ut_ad(col->len >= len);
+ if (dict_table_is_comp(index->table)) {
+ byte* buf = (byte*) mem_heap_alloc(heap,
+ col->len);
+ memcpy(buf, dfield->data, len);
+ memset(buf + len, 0x20, col->len - len);
+
+ dfield_set_data(dfield, buf, col->len);
+ } else {
+ /* field length mismatch should not happen
+ when rebuilding the redundant row format
+ table. */
+ ut_ad(0);
+ *error = DB_CORRUPTION;
+ return(NULL);
+ }
+ }
+
/* See if any columns were changed to NULL or NOT NULL. */
const dict_col_t* new_col
= dict_table_get_nth_col(log->table, col_no);
diff --git a/storage/xtradb/row/row0merge.cc b/storage/xtradb/row/row0merge.cc
index ae9ea0c4979..58c700f08e5 100644
--- a/storage/xtradb/row/row0merge.cc
+++ b/storage/xtradb/row/row0merge.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2005, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2005, 2015, 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
@@ -235,22 +235,88 @@ row_merge_buf_free(
mem_heap_free(buf->heap);
}
-/******************************************************//**
-Insert a data tuple into a sort buffer.
-@return number of rows added, 0 if out of space */
+/** Convert the field data from compact to redundant format.
+@param[in] row_field field to copy from
+@param[out] field field to copy to
+@param[in] len length of the field data
+@param[in] zip_size compressed BLOB page size,
+ zero for uncompressed BLOBs
+@param[in,out] heap memory heap where to allocate data when
+ converting to ROW_FORMAT=REDUNDANT, or NULL
+ when not to invoke
+ row_merge_buf_redundant_convert(). */
+static
+void
+row_merge_buf_redundant_convert(
+ const dfield_t* row_field,
+ dfield_t* field,
+ ulint len,
+ ulint zip_size,
+ mem_heap_t* heap,
+ trx_t* trx)
+{
+ ut_ad(DATA_MBMINLEN(field->type.mbminmaxlen) == 1);
+ ut_ad(DATA_MBMAXLEN(field->type.mbminmaxlen) > 1);
+
+ byte* buf = (byte*) mem_heap_alloc(heap, len);
+ ulint field_len = row_field->len;
+ ut_ad(field_len <= len);
+
+ if (row_field->ext) {
+ const byte* field_data = static_cast<byte*>(
+ dfield_get_data(row_field));
+ ulint ext_len;
+
+ ut_a(field_len >= BTR_EXTERN_FIELD_REF_SIZE);
+ ut_a(memcmp(field_data + field_len - BTR_EXTERN_FIELD_REF_SIZE,
+ field_ref_zero, BTR_EXTERN_FIELD_REF_SIZE));
+
+ byte* data = btr_copy_externally_stored_field(
+ &ext_len, field_data, zip_size, field_len, heap, trx);
+
+ ut_ad(ext_len < len);
+
+ memcpy(buf, data, ext_len);
+ field_len = ext_len;
+ } else {
+ memcpy(buf, row_field->data, field_len);
+ }
+
+ memset(buf + field_len, 0x20, len - field_len);
+
+ dfield_set_data(field, buf, len);
+}
+
+/** Insert a data tuple into a sort buffer.
+@param[in,out] buf sort buffer
+@param[in] fts_index fts index to be created
+@param[in] old_table original table
+@param[in,out] psort_info parallel sort info
+@param[in] row table row
+@param[in] ext cache of externally stored
+ column prefixes, or NULL
+@param[in,out] doc_id Doc ID if we are creating
+ FTS index
+@param[in,out] conv_heap memory heap where to allocate data when
+ converting to ROW_FORMAT=REDUNDANT, or NULL
+ when not to invoke
+ row_merge_buf_redundant_convert()
+@param[in,out] exceed_page set if the record size exceeds the page size
+ when converting to ROW_FORMAT=REDUNDANT
+@return number of rows added, 0 if out of space */
static
ulint
row_merge_buf_add(
-/*==============*/
- row_merge_buf_t* buf, /*!< in/out: sort buffer */
- dict_index_t* fts_index,/*!< in: fts index to be created */
- const dict_table_t* old_table,/*!< in: original table */
- fts_psort_t* psort_info, /*!< in: parallel sort info */
- const dtuple_t* row, /*!< in: table row */
- const row_ext_t* ext, /*!< in: cache of externally stored
- column prefixes, or NULL */
- doc_id_t* doc_id) /*!< in/out: Doc ID if we are
- creating FTS index */
+ row_merge_buf_t* buf,
+ dict_index_t* fts_index,
+ const dict_table_t* old_table,
+ fts_psort_t* psort_info,
+ const dtuple_t* row,
+ const row_ext_t* ext,
+ doc_id_t* doc_id,
+ mem_heap_t* conv_heap,
+ bool* exceed_page,
+ trx_t* trx)
{
ulint i;
const dict_index_t* index;
@@ -400,6 +466,23 @@ row_merge_buf_add(
n_row_added = 1;
continue;
}
+
+ if (field->len != UNIV_SQL_NULL
+ && col->mtype == DATA_MYSQL
+ && col->len != field->len) {
+
+ if (conv_heap != NULL) {
+ row_merge_buf_redundant_convert(
+ row_field, field, col->len,
+ dict_table_zip_size(old_table),
+ conv_heap, trx);
+ } else {
+ /* Field length mismatch should not
+ happen when rebuilding redundant row
+ format table. */
+ ut_ad(dict_table_is_comp(index->table));
+ }
+ }
}
len = dfield_get_len(field);
@@ -508,6 +591,14 @@ row_merge_buf_add(
of extra_size. */
data_size += (extra_size + 1) + ((extra_size + 1) >= 0x80);
+ /* Record size can exceed page size while converting to
+ redundant row format. But there is assert
+ ut_ad(size < UNIV_PAGE_SIZE) in rec_offs_data_size().
+ It may hit the assert before attempting to insert the row. */
+ if (conv_heap != NULL && data_size > UNIV_PAGE_SIZE) {
+ *exceed_page = true;
+ }
+
ut_ad(data_size < srv_sort_buf_size);
/* Reserve one byte for the end marker of row_merge_block_t. */
@@ -527,6 +618,10 @@ row_merge_buf_add(
dfield_dup(field++, buf->heap);
} while (--n_fields);
+ if (conv_heap != NULL) {
+ mem_heap_empty(conv_heap);
+ }
+
DBUG_RETURN(n_row_added);
}
@@ -1209,6 +1304,7 @@ row_merge_read_clustered_index(
os_event_t fts_parallel_sort_event = NULL;
ibool fts_pll_sort = FALSE;
ib_int64_t sig_count = 0;
+ mem_heap_t* conv_heap = NULL;
DBUG_ENTER("row_merge_read_clustered_index");
ut_ad((old_table == new_table) == !col_map);
@@ -1304,6 +1400,11 @@ row_merge_read_clustered_index(
row_heap = mem_heap_create(sizeof(mrec_buf_t));
+ if (dict_table_is_comp(old_table)
+ && !dict_table_is_comp(new_table)) {
+ conv_heap = mem_heap_create(sizeof(mrec_buf_t));
+ }
+
/* Scan the clustered index. */
for (;;) {
const rec_t* rec;
@@ -1588,16 +1689,24 @@ write_buffers:
row_merge_buf_t* buf = merge_buf[i];
merge_file_t* file = &files[i];
ulint rows_added = 0;
+ bool exceed_page = false;
if (UNIV_LIKELY
(row && (rows_added = row_merge_buf_add(
buf, fts_index, old_table,
- psort_info, row, ext, &doc_id)))) {
+ psort_info, row, ext, &doc_id,
+ conv_heap, &exceed_page, trx)))) {
/* If we are creating FTS index,
a single row can generate more
records for tokenized word */
file->n_rec += rows_added;
+
+ if (exceed_page) {
+ err = DB_TOO_BIG_RECORD;
+ break;
+ }
+
if (doc_id > max_doc_id) {
max_doc_id = doc_id;
}
@@ -1698,12 +1807,18 @@ write_buffers:
(!(rows_added = row_merge_buf_add(
buf, fts_index, old_table,
psort_info, row, ext,
- &doc_id)))) {
+ &doc_id, conv_heap,
+ &exceed_page, trx)))) {
/* An empty buffer should have enough
room for at least one record. */
ut_error;
}
+ if (exceed_page) {
+ err = DB_TOO_BIG_RECORD;
+ break;
+ }
+
file->n_rec += rows_added;
}
}
@@ -1728,6 +1843,10 @@ func_exit:
}
all_done:
+ if (conv_heap != NULL) {
+ mem_heap_free(conv_heap);
+ }
+
#ifdef FTS_INTERNAL_DIAG_PRINT
DEBUG_FTS_SORT_PRINT("FTS_SORT: Complete Scan Table\n");
#endif
@@ -2106,6 +2225,7 @@ row_merge(
/* Copy the last blocks, if there are any. */
while (foffs0 < ihalf) {
+
if (UNIV_UNLIKELY(trx_is_interrupted(trx))) {
return(DB_INTERRUPTED);
}
@@ -2122,6 +2242,7 @@ row_merge(
ut_ad(foffs0 == ihalf);
while (foffs1 < file->offset) {
+
if (trx_is_interrupted(trx)) {
return(DB_INTERRUPTED);
}
@@ -2181,6 +2302,7 @@ row_merge_sort(
{
const ulint half = file->offset / 2;
ulint num_runs;
+ ulint cur_run = 0;
ulint* run_offset;
dberr_t error = DB_SUCCESS;
DBUG_ENTER("row_merge_sort");
@@ -2204,11 +2326,19 @@ row_merge_sort(
of file marker). Thus, it must be at least one block. */
ut_ad(file->offset > 0);
+ thd_progress_init(trx->mysql_thd, num_runs);
+
/* Merge the runs until we have one big run */
do {
+ cur_run++;
+
error = row_merge(trx, dup, file, block, tmpfd,
&num_runs, run_offset);
+ /* Report progress of merge sort to MySQL for
+ show processlist progress field */
+ thd_progress_report(trx->mysql_thd, cur_run, num_runs);
+
if (error != DB_SUCCESS) {
break;
}
@@ -2218,6 +2348,8 @@ row_merge_sort(
mem_free(run_offset);
+ thd_progress_end(trx->mysql_thd);
+
DBUG_RETURN(error);
}
@@ -3343,9 +3475,13 @@ row_merge_create_index(
for (i = 0; i < n_fields; i++) {
index_field_t* ifield = &index_def->fields[i];
+ const char * col_name = ifield->col_name ?
+ dict_table_get_col_name_for_mysql(table, ifield->col_name) :
+ dict_table_get_col_name(table, ifield->col_no);
dict_mem_index_add_field(
- index, dict_table_get_col_name(table, ifield->col_no),
+ index,
+ col_name,
ifield->prefix_len);
}
diff --git a/storage/xtradb/row/row0mysql.cc b/storage/xtradb/row/row0mysql.cc
index 854ebd6f8cc..8dd84f15bea 100644
--- a/storage/xtradb/row/row0mysql.cc
+++ b/storage/xtradb/row/row0mysql.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2000, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2000, 2015, 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
@@ -609,6 +609,7 @@ handle_new_error:
case DB_DUPLICATE_KEY:
case DB_FOREIGN_DUPLICATE_KEY:
case DB_TOO_BIG_RECORD:
+ case DB_TOO_BIG_FOR_REDO:
case DB_UNDO_RECORD_TOO_BIG:
case DB_ROW_IS_REFERENCED:
case DB_NO_REFERENCED_ROW:
@@ -1455,6 +1456,11 @@ error_exit:
srv_stats.n_rows_inserted.add((size_t)trx->id, 1);
}
+ if (prebuilt->clust_index_was_generated) {
+ /* set row id to prebuilt */
+ ut_memcpy(prebuilt->row_id, node->row_id_buf, DATA_ROW_ID_LEN);
+ }
+
/* Not protected by dict_table_stats_lock() for performance
reasons, we would rather get garbage in stat_n_rows (which is
just an estimate anyway) than protecting the following code
@@ -3451,13 +3457,11 @@ row_truncate_table_for_mysql(
goto funct_exit;
}
- if (table->space && !table->dir_path_of_temp_table) {
+ if (table->space && !DICT_TF2_FLAG_IS_SET(table, DICT_TF2_TEMPORARY)) {
/* Discard and create the single-table tablespace. */
ulint space = table->space;
ulint flags = fil_space_get_flags(space);
- ut_a(!DICT_TF2_FLAG_IS_SET(table, DICT_TF2_TEMPORARY));
-
dict_get_and_save_data_dir_path(table, true);
if (flags != ULINT_UNDEFINED
@@ -4257,8 +4261,9 @@ row_drop_table_for_mysql(
is_temp = DICT_TF2_FLAG_IS_SET(table, DICT_TF2_TEMPORARY);
/* If there is a temp path then the temp flag is set.
- However, during recovery, we might have a temp flag but
- not know the temp path */
+ However, during recovery or reloading the table object
+ after eviction from data dictionary cache, we might
+ have a temp flag but not know the temp path */
ut_a(table->dir_path_of_temp_table == NULL || is_temp);
if (dict_table_is_discarded(table)
|| table->ibd_file_missing) {
@@ -4387,6 +4392,7 @@ row_drop_table_for_mysql(
case DB_OUT_OF_FILE_SPACE:
err = DB_MUST_GET_MORE_FILE_SPACE;
+ trx->error_state = err;
row_mysql_handle_errors(&err, trx, NULL, NULL);
/* raise error */
@@ -4826,6 +4832,7 @@ row_rename_table_for_mysql(
ibool old_is_tmp, new_is_tmp;
pars_info_t* info = NULL;
int retry;
+ bool aux_fts_rename = false;
ut_a(old_name != NULL);
ut_a(new_name != NULL);
@@ -5112,34 +5119,8 @@ row_rename_table_for_mysql(
if (dict_table_has_fts_index(table)
&& !dict_tables_have_same_db(old_name, new_name)) {
err = fts_rename_aux_tables(table, new_name, trx);
-
- if (err != DB_SUCCESS && (table->space != 0)) {
- char* orig_name = table->name;
- trx_t* trx_bg = trx_allocate_for_background();
-
- /* If the first fts_rename fails, the trx would
- be rolled back and committed, we can't use it any more,
- so we have to start a new background trx here. */
- ut_a(trx_state_eq(trx, TRX_STATE_NOT_STARTED));
- trx_bg->op_info = "Revert the failing rename "
- "for fts aux tables";
- trx_bg->dict_operation_lock_mode = RW_X_LATCH;
- trx_start_for_ddl(trx_bg, TRX_DICT_OP_TABLE);
-
- /* If rename fails and table has its own tablespace,
- we need to call fts_rename_aux_tables again to
- revert the ibd file rename, which is not under the
- control of trx. Also notice the parent table name
- in cache is not changed yet. If the reverting fails,
- the ibd data may be left in the new database, which
- can be fixed only manually. */
- table->name = const_cast<char*>(new_name);
- fts_rename_aux_tables(table, old_name, trx_bg);
- table->name = orig_name;
-
- trx_bg->dict_operation_lock_mode = 0;
- trx_commit_for_mysql(trx_bg);
- trx_free_for_background(trx_bg);
+ if (err != DB_TABLE_NOT_FOUND) {
+ aux_fts_rename = true;
}
}
@@ -5240,6 +5221,37 @@ end:
}
funct_exit:
+ if (aux_fts_rename && err != DB_SUCCESS
+ && table != NULL && (table->space != 0)) {
+
+ char* orig_name = table->name;
+ trx_t* trx_bg = trx_allocate_for_background();
+
+ /* If the first fts_rename fails, the trx would
+ be rolled back and committed, we can't use it any more,
+ so we have to start a new background trx here. */
+ ut_a(trx_state_eq(trx_bg, TRX_STATE_NOT_STARTED));
+ trx_bg->op_info = "Revert the failing rename "
+ "for fts aux tables";
+ trx_bg->dict_operation_lock_mode = RW_X_LATCH;
+ trx_start_for_ddl(trx_bg, TRX_DICT_OP_TABLE);
+
+ /* If rename fails and table has its own tablespace,
+ we need to call fts_rename_aux_tables again to
+ revert the ibd file rename, which is not under the
+ control of trx. Also notice the parent table name
+ in cache is not changed yet. If the reverting fails,
+ the ibd data may be left in the new database, which
+ can be fixed only manually. */
+ table->name = const_cast<char*>(new_name);
+ fts_rename_aux_tables(table, old_name, trx_bg);
+ table->name = orig_name;
+
+ trx_bg->dict_operation_lock_mode = 0;
+ trx_commit_for_mysql(trx_bg);
+ trx_free_for_background(trx_bg);
+ }
+
if (table != NULL) {
dict_table_close(table, dict_locked, FALSE);
}
diff --git a/storage/xtradb/row/row0quiesce.cc b/storage/xtradb/row/row0quiesce.cc
index 1d67d5a9717..ecd6f47947b 100644
--- a/storage/xtradb/row/row0quiesce.cc
+++ b/storage/xtradb/row/row0quiesce.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2012, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2012, 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
@@ -680,7 +680,6 @@ row_quiesce_set_state(
switch (state) {
case QUIESCE_START:
- ut_a(table->quiesce == QUIESCE_NONE);
break;
case QUIESCE_COMPLETE:
diff --git a/storage/xtradb/srv/srv0mon.cc b/storage/xtradb/srv/srv0mon.cc
index 57409243f5e..5e15dd15db2 100644
--- a/storage/xtradb/srv/srv0mon.cc
+++ b/storage/xtradb/srv/srv0mon.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2010, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2010, 2014, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
Copyright (c) 2013, 2014, MariaDB Corporation
@@ -1003,7 +1003,8 @@ static monitor_info_t innodb_counter_info[] =
{"adaptive_hash_searches_btree", "adaptive_hash_index",
"Number of searches using B-tree on an index search",
- MONITOR_NONE,
+ static_cast<monitor_type_t>(
+ MONITOR_EXISTING | MONITOR_DEFAULT_ON),
MONITOR_DEFAULT_START, MONITOR_OVLD_ADAPTIVE_HASH_SEARCH_BTREE},
{"adaptive_hash_pages_added", "adaptive_hash_index",
diff --git a/storage/xtradb/srv/srv0srv.cc b/storage/xtradb/srv/srv0srv.cc
index 961182fb9bf..92238cee405 100644
--- a/storage/xtradb/srv/srv0srv.cc
+++ b/storage/xtradb/srv/srv0srv.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2014, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, 2009 Google Inc.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2013, 2014, SkySQL Ab. All Rights Reserved.
@@ -3319,7 +3319,9 @@ srv_do_purge(
*n_total_purged += n_pages_purged;
- } while (!srv_purge_should_exit(n_pages_purged) && n_pages_purged > 0);
+ } while (!srv_purge_should_exit(n_pages_purged)
+ && n_pages_purged > 0
+ && purge_sys->state == PURGE_STATE_RUN);
return(rseg_history_len);
}
diff --git a/storage/xtradb/srv/srv0start.cc b/storage/xtradb/srv/srv0start.cc
index fd6ccfe75b1..248f1e4db89 100644
--- a/storage/xtradb/srv/srv0start.cc
+++ b/storage/xtradb/srv/srv0start.cc
@@ -133,23 +133,32 @@ UNIV_INTERN enum srv_shutdown_state srv_shutdown_state = SRV_SHUTDOWN_NONE;
static os_file_t files[1000];
/** io_handler_thread parameters for thread identification */
-static ulint n[SRV_MAX_N_IO_THREADS + 6];
-/** io_handler_thread identifiers, 32 is the maximum number of purge threads */
-/** 6 is the ? */
-#define START_OLD_THREAD_CNT (SRV_MAX_N_IO_THREADS + 6 + SRV_MAX_N_PURGE_THREADS)
-static os_thread_id_t thread_ids[SRV_MAX_N_IO_THREADS + 6 + SRV_MAX_N_PURGE_THREADS + MTFLUSH_MAX_WORKER];
+static ulint n[SRV_MAX_N_IO_THREADS];
+/** io_handler_thread identifiers, 32 is the maximum number of purge threads.
+The extra elements at the end are allocated as follows:
+SRV_MAX_N_IO_THREADS + 1: srv_master_thread
+SRV_MAX_N_IO_THREADS + 2: lock_wait_timeout_thread
+SRV_MAX_N_IO_THREADS + 3: srv_error_monitor_thread
+SRV_MAX_N_IO_THREADS + 4: srv_monitor_thread
+SRV_MAX_N_IO_THREADS + 5: srv_redo_log_follow_thread
+SRV_MAX_N_IO_THREADS + 6: srv_purge_coordinator_thread
+SRV_MAX_N_IO_THREADS + 7: srv_worker_thread
+...
+SRV_MAX_N_IO_THREADS + 7 + srv_n_purge_threads - 1: srv_worker_thread */
+static os_thread_id_t thread_ids[SRV_MAX_N_IO_THREADS + 7 + SRV_MAX_N_PURGE_THREADS + MTFLUSH_MAX_WORKER];
+
+/** Thead handles */
+static os_thread_t thread_handles[SRV_MAX_N_IO_THREADS + 7 + SRV_MAX_N_PURGE_THREADS+ MTFLUSH_MAX_WORKER];
/* Thread contex data for multi-threaded flush */
void *mtflush_ctx=NULL;
-/** Thead handles */
-static os_thread_t thread_handles[SRV_MAX_N_IO_THREADS + 6 + SRV_MAX_N_PURGE_THREADS];
static os_thread_t buf_flush_page_cleaner_thread_handle;
static os_thread_t buf_dump_thread_handle;
static os_thread_t dict_stats_thread_handle;
static os_thread_t buf_flush_lru_manager_thread_handle;
static os_thread_t srv_redo_log_follow_thread_handle;
/** Status variables, is thread started ?*/
-static bool thread_started[SRV_MAX_N_IO_THREADS + 6 + SRV_MAX_N_PURGE_THREADS] = {false};
+static bool thread_started[SRV_MAX_N_IO_THREADS + 7 + SRV_MAX_N_PURGE_THREADS] = {false};
static bool buf_flush_page_cleaner_thread_started = false;
static bool buf_dump_thread_started = false;
static bool dict_stats_thread_started = false;
@@ -1891,6 +1900,7 @@ innobase_start_or_create_for_mysql(void)
+ 1 /* srv_error_monitor_thread */
+ 1 /* srv_monitor_thread */
+ 1 /* srv_master_thread */
+ + 1 /* srv_redo_log_follow_thread */
+ 1 /* srv_purge_coordinator_thread */
+ 1 /* buf_dump_thread */
+ 1 /* dict_stats_thread */
@@ -2798,21 +2808,21 @@ files_checked:
if (!srv_read_only_mode
&& srv_force_recovery < SRV_FORCE_NO_BACKGROUND) {
- thread_handles[5 + SRV_MAX_N_IO_THREADS] = os_thread_create(
+ thread_handles[6 + SRV_MAX_N_IO_THREADS] = os_thread_create(
srv_purge_coordinator_thread,
- NULL, thread_ids + 5 + SRV_MAX_N_IO_THREADS);
+ NULL, thread_ids + 6 + SRV_MAX_N_IO_THREADS);
- thread_started[5 + SRV_MAX_N_IO_THREADS] = true;
+ thread_started[6 + SRV_MAX_N_IO_THREADS] = true;
ut_a(UT_ARR_SIZE(thread_ids)
- > 5 + srv_n_purge_threads + SRV_MAX_N_IO_THREADS);
+ > 6 + srv_n_purge_threads + SRV_MAX_N_IO_THREADS);
/* We've already created the purge coordinator thread above. */
for (i = 1; i < srv_n_purge_threads; ++i) {
- thread_handles[5 + i + SRV_MAX_N_IO_THREADS] = os_thread_create(
+ thread_handles[6 + i + SRV_MAX_N_IO_THREADS] = os_thread_create(
srv_worker_thread, NULL,
- thread_ids + 5 + i + SRV_MAX_N_IO_THREADS);
- thread_started[5 + i + SRV_MAX_N_IO_THREADS] = true;
+ thread_ids + 6 + i + SRV_MAX_N_IO_THREADS);
+ thread_started[6 + i + SRV_MAX_N_IO_THREADS] = true;
}
srv_start_wait_for_purge_to_start();
@@ -3219,9 +3229,9 @@ innobase_shutdown_for_mysql(void)
ibuf_close();
log_shutdown();
- lock_sys_close();
trx_sys_file_format_close();
trx_sys_close();
+ lock_sys_close();
/* We don't create these mutexes in RO mode because we don't create
the temp files that the cover. */
diff --git a/storage/xtradb/sync/sync0rw.cc b/storage/xtradb/sync/sync0rw.cc
index 3296e2e74a7..51bfba9950b 100644
--- a/storage/xtradb/sync/sync0rw.cc
+++ b/storage/xtradb/sync/sync0rw.cc
@@ -694,6 +694,8 @@ rw_lock_x_lock_low(
const char* file_name,/*!< in: file name where lock requested */
ulint line) /*!< in: line where requested */
{
+ ibool local_recursive= lock->recursive;
+
if (rw_lock_lock_word_decr(lock, X_LOCK_DECR)) {
/* lock->recursive also tells us if the writer_thread
@@ -715,12 +717,12 @@ rw_lock_x_lock_low(
} else {
os_thread_id_t thread_id = os_thread_get_curr_id();
- if (!pass) {
- os_rmb;
- }
-
- /* Decrement failed: relock or failed lock */
- if (!pass && lock->recursive
+ /* Decrement failed: relock or failed lock
+ Note: recursive must be loaded before writer_thread see
+ comment for rw_lock_set_writer_id_and_recursion_flag().
+ To achieve this we load it before rw_lock_lock_word_decr(),
+ which implies full memory barrier in current implementation. */
+ if (!pass && local_recursive
&& os_thread_eq(lock->writer_thread, thread_id)) {
/* Relock */
if (lock->lock_word == 0) {
diff --git a/storage/xtradb/sync/sync0sync.cc b/storage/xtradb/sync/sync0sync.cc
index d02a0df70ca..cfd8f27c389 100644
--- a/storage/xtradb/sync/sync0sync.cc
+++ b/storage/xtradb/sync/sync0sync.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@@ -48,6 +48,8 @@ Created 9/5/1995 Heikki Tuuri
#include "ha_prototypes.h"
#include "my_cpu.h"
+#include <vector>
+
/*
REASONS FOR IMPLEMENTING THE SPIN LOCK MUTEX
============================================
@@ -228,14 +230,8 @@ UNIV_INTERN ibool sync_order_checks_on = FALSE;
static const ulint SYNC_THREAD_N_LEVELS = 10000;
/** Array for tracking sync levels per thread. */
-struct sync_arr_t {
- ulint in_use; /*!< Number of active cells */
- ulint n_elems; /*!< Number of elements in the array */
- ulint max_elems; /*!< Maximum elements */
- ulint next_free; /*!< ULINT_UNDEFINED or index of next
- free slot */
- sync_level_t* elems; /*!< Array elements */
-};
+typedef std::vector<sync_level_t> sync_arr_t;
+
/** Mutexes or rw-locks held by a thread */
struct sync_thread_t{
@@ -952,10 +948,10 @@ sync_thread_levels_g(
{
ulint i;
- for (i = 0; i < arr->n_elems; i++) {
+ for (i = 0; i < arr->size(); i++) {
const sync_level_t* slot;
- slot = &arr->elems[i];
+ slot = (const sync_level_t*)&(arr->at(i));
if (slot->latch != NULL && slot->level <= limit) {
if (warn) {
@@ -987,10 +983,10 @@ sync_thread_levels_contain(
{
ulint i;
- for (i = 0; i < arr->n_elems; i++) {
+ for (i = 0; i < arr->size(); i++) {
const sync_level_t* slot;
- slot = &arr->elems[i];
+ slot = (const sync_level_t*)&(arr->at(i));
if (slot->latch != NULL && slot->level == level) {
@@ -1034,10 +1030,10 @@ sync_thread_levels_contains(
arr = thread_slot->levels;
- for (i = 0; i < arr->n_elems; i++) {
+ for (i = 0; i < arr->size(); i++) {
sync_level_t* slot;
- slot = &arr->elems[i];
+ slot = (sync_level_t*)&(arr->at(i));
if (slot->latch != NULL && slot->level == level) {
@@ -1083,10 +1079,10 @@ sync_thread_levels_nonempty_gen(
arr = thread_slot->levels;
- for (i = 0; i < arr->n_elems; ++i) {
+ for (i = 0; i < arr->size(); ++i) {
const sync_level_t* slot;
- slot = &arr->elems[i];
+ slot = (const sync_level_t*)&(arr->at(i));
if (slot->latch != NULL
&& (!dict_mutex_allowed
@@ -1143,10 +1139,10 @@ sync_thread_levels_nonempty_trx(
arr = thread_slot->levels;
- for (i = 0; i < arr->n_elems; ++i) {
+ for (i = 0; i < arr->size(); ++i) {
const sync_level_t* slot;
- slot = &arr->elems[i];
+ slot = (const sync_level_t*)&(arr->at(i));
if (slot->latch != NULL
&& (!has_search_latch
@@ -1177,10 +1173,9 @@ sync_thread_add_level(
SYNC_LEVEL_VARYING, nothing is done */
ibool relock) /*!< in: TRUE if re-entering an x-lock */
{
- ulint i;
- sync_level_t* slot;
sync_arr_t* array;
sync_thread_t* thread_slot;
+ sync_level_t sync_level;
if (!sync_order_checks_on) {
@@ -1205,21 +1200,11 @@ sync_thread_add_level(
thread_slot = sync_thread_level_arrays_find_slot();
if (thread_slot == NULL) {
- ulint sz;
-
- sz = sizeof(*array)
- + (sizeof(*array->elems) * SYNC_THREAD_N_LEVELS);
/* We have to allocate the level array for a new thread */
- array = static_cast<sync_arr_t*>(calloc(sz, sizeof(char)));
+ array = new sync_arr_t();
ut_a(array != NULL);
-
- array->next_free = ULINT_UNDEFINED;
- array->max_elems = SYNC_THREAD_N_LEVELS;
- array->elems = (sync_level_t*) &array[1];
-
thread_slot = sync_thread_level_arrays_find_free();
-
thread_slot->levels = array;
thread_slot->id = os_thread_get_curr_id();
}
@@ -1446,26 +1431,10 @@ sync_thread_add_level(
}
levels_ok:
- if (array->next_free == ULINT_UNDEFINED) {
- ut_a(array->n_elems < array->max_elems);
-
- i = array->n_elems++;
- } else {
- i = array->next_free;
- array->next_free = array->elems[i].level;
- }
-
- ut_a(i < array->n_elems);
- ut_a(i != ULINT_UNDEFINED);
-
- ++array->in_use;
- slot = &array->elems[i];
-
- ut_a(slot->latch == NULL);
-
- slot->latch = latch;
- slot->level = level;
+ sync_level.latch = latch;
+ sync_level.level = level;
+ array->push_back(sync_level);
mutex_exit(&sync_thread_mutex);
}
@@ -1483,7 +1452,6 @@ sync_thread_reset_level(
{
sync_arr_t* array;
sync_thread_t* thread_slot;
- ulint i;
if (!sync_order_checks_on) {
@@ -1512,36 +1480,15 @@ sync_thread_reset_level(
array = thread_slot->levels;
- for (i = 0; i < array->n_elems; i++) {
- sync_level_t* slot;
-
- slot = &array->elems[i];
+ for (std::vector<sync_level_t>::iterator it = array->begin(); it != array->end(); ++it) {
+ sync_level_t level = *it;
- if (slot->latch != latch) {
+ if (level.latch != latch) {
continue;
}
- slot->latch = NULL;
-
- /* Update the free slot list. See comment in sync_level_t
- for the level field. */
- slot->level = array->next_free;
- array->next_free = i;
-
- ut_a(array->in_use >= 1);
- --array->in_use;
-
- /* If all cells are idle then reset the free
- list. The assumption is that this will save
- time when we need to scan up to n_elems. */
-
- if (array->in_use == 0) {
- array->n_elems = 0;
- array->next_free = ULINT_UNDEFINED;
- }
-
+ array->erase(it);
mutex_exit(&sync_thread_mutex);
-
return(TRUE);
}
@@ -1628,8 +1575,7 @@ sync_thread_level_arrays_free(void)
/* If this slot was allocated then free the slot memory too. */
if (slot->levels != NULL) {
- free(slot->levels);
- slot->levels = NULL;
+ delete slot->levels;
}
}
diff --git a/storage/xtradb/trx/trx0roll.cc b/storage/xtradb/trx/trx0roll.cc
index a64367c4ba7..e2c3c0b949c 100644
--- a/storage/xtradb/trx/trx0roll.cc
+++ b/storage/xtradb/trx/trx0roll.cc
@@ -50,6 +50,9 @@ Created 3/26/1996 Heikki Tuuri
rollback */
#define TRX_ROLL_TRUNC_THRESHOLD 1
+/** true if trx_rollback_or_clean_all_recovered() thread is active */
+bool trx_rollback_or_clean_is_active;
+
/** In crash recovery, the current trx to be rolled back; NULL otherwise */
static const trx_t* trx_roll_crash_recv_trx = NULL;
@@ -492,7 +495,7 @@ trx_release_savepoint_for_mysql(
{
trx_named_savept_t* savep;
- ut_ad(trx_state_eq(trx, TRX_STATE_ACTIVE));
+ ut_ad(trx_state_eq(trx, TRX_STATE_ACTIVE) || trx_state_eq(trx, TRX_STATE_PREPARED));
ut_ad(trx->in_mysql_trx_list);
savep = trx_savepoint_find(trx, savepoint_name);
@@ -805,6 +808,8 @@ DECLARE_THREAD(trx_rollback_or_clean_all_recovered)(
trx_rollback_or_clean_recovered(TRUE);
+ trx_rollback_or_clean_is_active = false;
+
/* We count the number of threads in os_thread_exit(). A created
thread should always use that to exit and not use return() to exit. */
diff --git a/storage/xtradb/trx/trx0trx.cc b/storage/xtradb/trx/trx0trx.cc
index 5ea63295792..4986ee201f8 100644
--- a/storage/xtradb/trx/trx0trx.cc
+++ b/storage/xtradb/trx/trx0trx.cc
@@ -473,11 +473,12 @@ trx_free_prepared(
/*==============*/
trx_t* trx) /*!< in, own: trx object */
{
- ut_ad(mutex_own(&trx_sys->mutex));
-
ut_a(trx_state_eq(trx, TRX_STATE_PREPARED));
ut_a(trx->magic_n == TRX_MAGIC_N);
+ mutex_exit(&trx_sys->mutex);
+ lock_trx_release_locks(trx);
+ mutex_enter(&trx_sys->mutex);
trx_undo_free_prepared(trx);
assert_trx_in_rw_list(trx);
diff --git a/storage/xtradb/ut/ut0ut.cc b/storage/xtradb/ut/ut0ut.cc
index 15c7bb503cb..121cbdb7bc0 100644
--- a/storage/xtradb/ut/ut0ut.cc
+++ b/storage/xtradb/ut/ut0ut.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1994, 2012, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1994, 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
@@ -825,6 +825,8 @@ ut_strerr(
return("Temp file write failure");
case DB_FTS_TOO_MANY_WORDS_IN_PHRASE:
return("Too many words in a FTS phrase or proximity search");
+ case DB_TOO_BIG_FOR_REDO:
+ return("BLOB record length is greater than 10%% of redo log");
/* do not add default: in order to produce a warning if new code
is added to the enum but not added here */
diff --git a/strings/CMakeLists.txt b/strings/CMakeLists.txt
index 6291d107d90..1e364bc951b 100644
--- a/strings/CMakeLists.txt
+++ b/strings/CMakeLists.txt
@@ -26,7 +26,7 @@ SET(STRINGS_SOURCES bchange.c bmove_upp.c ctype-big5.c ctype-bin.c ctype-cp932.c
my_strchr.c strcont.c strappend.c)
IF(NOT HAVE_STRNLEN)
- # OSX does not have strnlen
+ # OSX below 10.7 did not have strnlen
SET(STRINGS_SOURCES ${STRINGS_SOURCES} strnlen.c)
ENDIF()
# Avoid dependencies on perschema data defined in mysys
diff --git a/strings/ctype-uca.c b/strings/ctype-uca.c
index 60de0a106a1..2351ee9d932 100644
--- a/strings/ctype-uca.c
+++ b/strings/ctype-uca.c
@@ -1,5 +1,5 @@
/* Copyright (c) 2004, 2013, Oracle and/or its affiliates.
- Copyright (c) 2009, 2014, SkySQL Ab.
+ Copyright (c) 2009, 2015, MariaDB
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -20583,7 +20583,25 @@ static int my_uca_scanner_next_any(my_uca_scanner *scanner)
if (((mblen= scanner->cs->cset->mb_wc(scanner->cs, wc,
scanner->sbeg,
scanner->send)) <= 0))
- return -1;
+ {
+ if (scanner->sbeg >= scanner->send)
+ return -1; /* No more bytes, end of line reached */
+ /*
+ There are some more bytes left. Non-positive mb_len means that
+ we got an incomplete or a bad byte sequence. Consume mbminlen bytes.
+ */
+ if ((scanner->sbeg+= scanner->cs->mbminlen) > scanner->send)
+ {
+ /* For safety purposes don't go beyond the string range. */
+ scanner->sbeg= scanner->send;
+ }
+ /*
+ Treat every complete or incomplete mbminlen unit as a weight which is
+ greater than weight for any possible normal character.
+ 0xFFFF is greater than any possible weight in the UCA weight table.
+ */
+ return 0xFFFF;
+ }
scanner->sbeg+= mblen;
if (wc[0] > scanner->level->maxchar)
diff --git a/strings/decimal.c b/strings/decimal.c
index 979f1b179f9..da47727bd9c 100644
--- a/strings/decimal.c
+++ b/strings/decimal.c
@@ -1024,7 +1024,11 @@ int ulonglong2decimal(ulonglong from, decimal_t *to)
int longlong2decimal(longlong from, decimal_t *to)
{
if ((to->sign= from < 0))
+ {
+ if (from == LONGLONG_MIN) // avoid undefined behavior
+ return ull2dec((ulonglong)LONGLONG_MIN, to);
return ull2dec(-from, to);
+ }
return ull2dec(from, to);
}
diff --git a/support-files/build-tags b/support-files/build-tags
index 44bd2a02593..4b76e01907a 100755
--- a/support-files/build-tags
+++ b/support-files/build-tags
@@ -1,9 +1,9 @@
#! /bin/sh
rm -f TAGS
-filter='\.cc$\|\.c$\|\.h$\|sql_yacc\.yy$\|\.ic$\|errmsg-utf8\.txt$'
+filter='\.cpp$\|\.cc$\|\.c$\|\.h$\|sql_yacc\.yy$\|\.hpp$\|\.ic$\|errmsg-utf8\.txt$'
list="find . -type f"
-bzr root >/dev/null 2>/dev/null && list="bzr ls --from-root -R --kind=file --versioned"
+git rev-parse >/dev/null 2>/dev/null && list="git ls-files"
$list |grep $filter | xargs etags -o TAGS --append
diff --git a/support-files/mysql.server.sh b/support-files/mysql.server.sh
index a19f09fc91f..e23b8373ec4 100644
--- a/support-files/mysql.server.sh
+++ b/support-files/mysql.server.sh
@@ -146,6 +146,9 @@ parse_server_arguments() {
--datadir=*) datadir=`echo "$arg" | sed -e 's/^[^=]*=//'`
datadir_set=1
;;
+ --log-basename=*|--hostname=*|--loose-log-basename=*)
+ mysqld_pid_file_path=`echo "$arg.pid" | sed -e 's/^[^=]*=//'`
+ ;;
--pid-file=*) mysqld_pid_file_path=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
--service-startup-timeout=*) service_startup_timeout=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
esac
diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh
index e45573a6d77..aaeed444e2f 100644
--- a/support-files/mysql.spec.sh
+++ b/support-files/mysql.spec.sh
@@ -1,4 +1,4 @@
-# Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 2015, 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
@@ -427,7 +427,7 @@ Obsoletes: MySQL-embedded-pro
Obsoletes: MySQL-embedded-classic MySQL-embedded-community MySQL-embedded-enterprise
Obsoletes: MySQL-embedded-advanced-gpl MySQL-embedded-enterprise-gpl
Provides: mysql-embedded = %{version}-%{release}
-Provides: mysql-emdedded%{?_isa} = %{version}-%{release}
+Provides: mysql-embedded%{?_isa} = %{version}-%{release}
%description -n MySQL-embedded%{product_suffix}
This package contains the MySQL server as an embedded library.
diff --git a/vio/vio.c b/vio/vio.c
index 97e3d49be21..e3bc8ca8ab8 100644
--- a/vio/vio.c
+++ b/vio/vio.c
@@ -227,12 +227,15 @@ my_bool vio_reset(Vio* vio, enum enum_vio_type type,
Propagate the timeout values. Necessary to also propagate
the underlying proprieties associated with the timeout,
such as the socket blocking mode.
+
+ note: old_vio.read_timeout/old_vio.write_timeout is stored in ms
+ but vio_timeout() takes seconds as argument, hence the / 1000
*/
if (old_vio.read_timeout >= 0)
- ret|= vio_timeout(vio, 0, old_vio.read_timeout);
+ ret|= vio_timeout(vio, 0, old_vio.read_timeout / 1000);
if (old_vio.write_timeout >= 0)
- ret|= vio_timeout(vio, 1, old_vio.write_timeout);
+ ret|= vio_timeout(vio, 1, old_vio.write_timeout / 1000);
DBUG_RETURN(MY_TEST(ret));
}
diff --git a/vio/viosocket.c b/vio/viosocket.c
index 5576dfc48d8..e724165612c 100644
--- a/vio/viosocket.c
+++ b/vio/viosocket.c
@@ -137,6 +137,9 @@ int vio_socket_io_wait(Vio *vio, enum enum_vio_io_event event)
#define VIO_DONTWAIT 0
#endif
+/*
+ returns number of bytes read or -1 in case of an error
+*/
size_t vio_read(Vio *vio, uchar *buf, size_t size)
{
ssize_t ret;
diff --git a/vio/viosslfactories.c b/vio/viosslfactories.c
index ee944c68f92..9a476eace71 100644
--- a/vio/viosslfactories.c
+++ b/vio/viosslfactories.c
@@ -1,4 +1,5 @@
-/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
+ Copyright (c) 2011, 2015, MariaDB
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
@@ -20,33 +21,33 @@
static my_bool ssl_algorithms_added = FALSE;
static my_bool ssl_error_strings_loaded= FALSE;
-static unsigned char dh512_p[]=
-{
- 0xDA,0x58,0x3C,0x16,0xD9,0x85,0x22,0x89,0xD0,0xE4,0xAF,0x75,
- 0x6F,0x4C,0xCA,0x92,0xDD,0x4B,0xE5,0x33,0xB8,0x04,0xFB,0x0F,
- 0xED,0x94,0xEF,0x9C,0x8A,0x44,0x03,0xED,0x57,0x46,0x50,0xD3,
- 0x69,0x99,0xDB,0x29,0xD7,0x76,0x27,0x6B,0xA2,0xD3,0xD4,0x12,
- 0xE2,0x18,0xF4,0xDD,0x1E,0x08,0x4C,0xF6,0xD8,0x00,0x3E,0x7C,
- 0x47,0x74,0xE8,0x33,
-};
-
-static unsigned char dh512_g[]={
- 0x02,
-};
-
-static DH *get_dh512(void)
+/* the function below was generated with "openssl dhparam -2 -C 1024" */
+static
+DH *get_dh1024()
{
+ static unsigned char dh1024_p[]={
+ 0xEC,0x46,0x7E,0xF9,0x4E,0x10,0x29,0xDC,0x44,0x97,0x71,0xFD,
+ 0x71,0xC6,0x9F,0x0D,0xD1,0x09,0xF6,0x58,0x6F,0xAD,0xCA,0xF4,
+ 0x37,0xD5,0xC3,0xBD,0xC3,0x9A,0x51,0x66,0x2C,0x58,0xBD,0x02,
+ 0xBD,0xBA,0xBA,0xFC,0xE7,0x0E,0x5A,0xE5,0x97,0x81,0xC3,0xF3,
+ 0x28,0x2D,0xAD,0x00,0x91,0xEF,0xF8,0xF0,0x5D,0xE9,0xE7,0x18,
+ 0xE2,0xAD,0xC4,0x70,0xC5,0x3C,0x12,0x8A,0x80,0x6A,0x9F,0x3B,
+ 0x00,0xA2,0x8F,0xA9,0x26,0xB0,0x0E,0x7F,0xED,0xF6,0xC2,0x03,
+ 0x81,0xB5,0xC5,0x41,0xD0,0x00,0x2B,0x21,0xD4,0x4B,0x74,0xA6,
+ 0xD7,0x1A,0x0E,0x82,0xC8,0xEE,0xD4,0xB1,0x6F,0xB4,0x79,0x01,
+ 0x8A,0xF1,0x12,0xD7,0x3C,0xFD,0xCB,0x9B,0xAE,0x1C,0xA9,0x0F,
+ 0x3D,0x0F,0xF8,0xD6,0x7D,0xDE,0xD6,0x0B,
+ };
+ static unsigned char dh1024_g[]={
+ 0x02,
+ };
DH *dh;
- if ((dh=DH_new()))
- {
- dh->p=BN_bin2bn(dh512_p,sizeof(dh512_p),NULL);
- dh->g=BN_bin2bn(dh512_g,sizeof(dh512_g),NULL);
- if (! dh->p || ! dh->g)
- {
- DH_free(dh);
- dh=0;
- }
- }
+
+ if ((dh=DH_new()) == NULL) return(NULL);
+ dh->p=BN_bin2bn(dh1024_p,sizeof(dh1024_p),NULL);
+ dh->g=BN_bin2bn(dh1024_g,sizeof(dh1024_g),NULL);
+ if ((dh->p == NULL) || (dh->g == NULL))
+ { DH_free(dh); return(NULL); }
return(dh);
}
@@ -60,7 +61,8 @@ ssl_error_string[] =
"Private key does not match the certificate public key",
"SSL_CTX_set_default_verify_paths failed",
"Failed to set ciphers to use",
- "SSL_CTX_new failed"
+ "SSL_CTX_new failed",
+ "SSL_CTX_set_tmp_dh failed"
};
const char*
@@ -153,6 +155,7 @@ new_VioSSLFd(const char *key_file, const char *cert_file,
{
DH *dh;
struct st_VioSSLFd *ssl_fd;
+ long ssl_ctx_options= SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3;
DBUG_ENTER("new_VioSSLFd");
DBUG_PRINT("enter",
("key_file: '%s' cert_file: '%s' ca_file: '%s' ca_path: '%s' "
@@ -169,19 +172,17 @@ new_VioSSLFd(const char *key_file, const char *cert_file,
if (!(ssl_fd= ((struct st_VioSSLFd*)
my_malloc(sizeof(struct st_VioSSLFd),MYF(0)))))
- DBUG_RETURN(0);
-
+ goto err0;
if (!(ssl_fd->ssl_context= SSL_CTX_new(is_client_method ?
SSLv23_client_method() :
SSLv23_server_method())))
{
*error= SSL_INITERR_MEMFAIL;
DBUG_PRINT("error", ("%s", sslGetErrString(*error)));
- my_free(ssl_fd);
- DBUG_RETURN(0);
+ goto err1;
}
- SSL_CTX_set_options(ssl_fd->ssl_context, SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3);
+ SSL_CTX_set_options(ssl_fd->ssl_context, ssl_ctx_options);
/*
Set the ciphers that can be used
@@ -193,9 +194,7 @@ new_VioSSLFd(const char *key_file, const char *cert_file,
{
*error= SSL_INITERR_CIPHERS;
DBUG_PRINT("error", ("%s", sslGetErrString(*error)));
- SSL_CTX_free(ssl_fd->ssl_context);
- my_free(ssl_fd);
- DBUG_RETURN(0);
+ goto err2;
}
/* Load certs from the trusted ca */
@@ -209,9 +208,7 @@ new_VioSSLFd(const char *key_file, const char *cert_file,
*error= SSL_INITERR_BAD_PATHS;
DBUG_PRINT("error", ("SSL_CTX_load_verify_locations failed : %s",
sslGetErrString(*error)));
- SSL_CTX_free(ssl_fd->ssl_context);
- my_free(ssl_fd);
- DBUG_RETURN(0);
+ goto err2;
}
/* otherwise go use the defaults */
@@ -219,9 +216,7 @@ new_VioSSLFd(const char *key_file, const char *cert_file,
{
*error= SSL_INITERR_BAD_PATHS;
DBUG_PRINT("error", ("%s", sslGetErrString(*error)));
- SSL_CTX_free(ssl_fd->ssl_context);
- my_free(ssl_fd);
- DBUG_RETURN(0);
+ goto err2;
}
}
@@ -241,9 +236,7 @@ new_VioSSLFd(const char *key_file, const char *cert_file,
DBUG_PRINT("warning", ("X509_STORE_load_locations for CRL failed"));
*error= SSL_INITERR_BAD_PATHS;
DBUG_PRINT("error", ("%s", sslGetErrString(*error)));
- SSL_CTX_free(ssl_fd->ssl_context);
- my_free(ssl_fd);
- DBUG_RETURN(0);
+ goto err2;
}
#endif
}
@@ -251,19 +244,32 @@ new_VioSSLFd(const char *key_file, const char *cert_file,
if (vio_set_cert_stuff(ssl_fd->ssl_context, cert_file, key_file, error))
{
DBUG_PRINT("error", ("vio_set_cert_stuff failed"));
- SSL_CTX_free(ssl_fd->ssl_context);
- my_free(ssl_fd);
- DBUG_RETURN(0);
+ goto err2;
}
/* DH stuff */
- dh=get_dh512();
- SSL_CTX_set_tmp_dh(ssl_fd->ssl_context, dh);
+ dh=get_dh1024();
+ if (!SSL_CTX_set_tmp_dh(ssl_fd->ssl_context, dh))
+ {
+ *error= SSL_INITERR_DH;
+ goto err3;
+ }
+
DH_free(dh);
DBUG_PRINT("exit", ("OK 1"));
DBUG_RETURN(ssl_fd);
+
+err3:
+ DH_free(dh);
+err2:
+ SSL_CTX_free(ssl_fd->ssl_context);
+err1:
+ my_free(ssl_fd);
+err0:
+ DBUG_EXECUTE("error", ERR_print_errors_fp(DBUG_FILE););
+ DBUG_RETURN(0);
}
diff --git a/win/packaging/COPYING.rtf b/win/packaging/COPYING.rtf
index de1f0bbefde..9370fbcaa0c 100644
--- a/win/packaging/COPYING.rtf
+++ b/win/packaging/COPYING.rtf
@@ -1,61 +1,61 @@
-{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 Arial;}{\f1\froman\fprq2\fcharset2 Symbol;}{\f2\fswiss\fcharset0 Arial;}}
-{\stylesheet{ Normal;}{\s1 heading 1;}{\s2 heading 2;}}
-\viewkind4\uc1\pard\s2\sb100\sa100\b\f0\fs24 GNU GENERAL PUBLIC LICENSE\par
-\pard\sb100\sa100\b0\fs20 Version 2, June 1991 \par
-\pard Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.\fs24 \par
-\pard\s2\sb100\sa100\b Preamble\par
-\pard\sb100\sa100\b0\fs20 The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. \par
-When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. \par
-To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. \par
-For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. \par
-We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. \par
-Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. \par
-Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. \par
-The precise terms and conditions for copying, distribution and modification follow.\fs24 \par
-\pard\s2\sb100\sa100\b TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\par
-\pard\sb100\sa100\b0\fs20 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". \par
-Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. \par
-1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. \par
-You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. \par
-2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: \par
-\pard\fi-360\li720\sb100\sa100\tx720\f1\'b7\tab\f0 a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. \par
-\pard\fi-360\li720\sb100\sa100\f1\'b7\tab\f0 b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. \par
-\f1\'b7\tab\f0 c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) \par
-\pard These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. \par
-\pard\sb100\sa100 Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. \par
-In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. \par
-3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: \par
-\pard\fi-360\li720\sb100\sa100\tx720\f1\'b7\tab\f0 a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, \par
-\pard\fi-360\li720\sb100\sa100\f1\'b7\tab\f0 b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, \par
-\f1\'b7\tab\f0 c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) \par
-\pard The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. \par
-\pard\sb100\sa100 If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. \par
-4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. \par
-5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. \par
-6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. \par
-7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. \par
-If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. \par
-It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. \par
-This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. \par
-8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. \par
-9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. \par
-Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. \par
-10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. \par
-NO WARRANTY \par
-11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. \par
-12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. \par
-\pard\s2\sb100\sa100\b\fs24 END OF TERMS AND CONDITIONS \par
-How to Apply These Terms to Your New Programs\fs20\par
-\pard\sb100\sa100\b0 If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. \par
-To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. \par
-\pard one line to give the program's name and an idea of what it does. Copyright (C) yyyy name of author This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. \par
-\pard\sb100\sa100 Also add information on how to contact you by electronic and paper mail. \par
-If the program is interactive, make it output a short notice like this when it starts in an interactive mode: \par
-\pard Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. \par
-\pard\sb100\sa100 The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c' ; they could even be mouse-clicks or menu items--whatever suits your program. \par
-You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: \par
-\pard Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. signature of Ty Coon , 1 April 1989 Ty Coon, President of Vice \par
-\pard\sb100\sa100 This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License.\par
-\pard\f2\par
-}
-
+{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 Arial;}{\f1\froman\fprq2\fcharset2 Symbol;}{\f2\fswiss\fcharset0 Arial;}}
+{\stylesheet{ Normal;}{\s1 heading 1;}{\s2 heading 2;}}
+\viewkind4\uc1\pard\s2\sb100\sa100\b\f0\fs24 GNU GENERAL PUBLIC LICENSE\par
+\pard\sb100\sa100\b0\fs20 Version 2, June 1991 \par
+\pard Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.\fs24 \par
+\pard\s2\sb100\sa100\b Preamble\par
+\pard\sb100\sa100\b0\fs20 The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. \par
+When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. \par
+To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. \par
+For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. \par
+We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. \par
+Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. \par
+Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. \par
+The precise terms and conditions for copying, distribution and modification follow.\fs24 \par
+\pard\s2\sb100\sa100\b TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\par
+\pard\sb100\sa100\b0\fs20 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". \par
+Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. \par
+1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. \par
+You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. \par
+2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: \par
+\pard\fi-360\li720\sb100\sa100\tx720\f1\'b7\tab\f0 a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. \par
+\pard\fi-360\li720\sb100\sa100\f1\'b7\tab\f0 b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. \par
+\f1\'b7\tab\f0 c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) \par
+\pard These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. \par
+\pard\sb100\sa100 Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. \par
+In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. \par
+3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: \par
+\pard\fi-360\li720\sb100\sa100\tx720\f1\'b7\tab\f0 a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, \par
+\pard\fi-360\li720\sb100\sa100\f1\'b7\tab\f0 b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, \par
+\f1\'b7\tab\f0 c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) \par
+\pard The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. \par
+\pard\sb100\sa100 If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. \par
+4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. \par
+5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. \par
+6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. \par
+7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. \par
+If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. \par
+It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. \par
+This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. \par
+8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. \par
+9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. \par
+Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. \par
+10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. \par
+NO WARRANTY \par
+11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. \par
+12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. \par
+\pard\s2\sb100\sa100\b\fs24 END OF TERMS AND CONDITIONS \par
+How to Apply These Terms to Your New Programs\fs20\par
+\pard\sb100\sa100\b0 If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. \par
+To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. \par
+\pard one line to give the program's name and an idea of what it does. Copyright (C) yyyy name of author This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. \par
+\pard\sb100\sa100 Also add information on how to contact you by electronic and paper mail. \par
+If the program is interactive, make it output a short notice like this when it starts in an interactive mode: \par
+\pard Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. \par
+\pard\sb100\sa100 The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c' ; they could even be mouse-clicks or menu items--whatever suits your program. \par
+You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: \par
+\pard Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. signature of Ty Coon , 1 April 1989 Ty Coon, President of Vice \par
+\pard\sb100\sa100 This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License.\par
+\pard\f2\par
+}
+
diff --git a/win/packaging/CPackWixConfig.cmake b/win/packaging/CPackWixConfig.cmake
index d6fcf963ce3..58a2ef44eef 100644
--- a/win/packaging/CPackWixConfig.cmake
+++ b/win/packaging/CPackWixConfig.cmake
@@ -1,121 +1,120 @@
-
-IF(ESSENTIALS)
- SET(CPACK_COMPONENTS_USED "Server;Client")
- SET(CPACK_WIX_UI "MyWixUI_Mondo")
- IF(CMAKE_SIZEOF_VOID_P MATCHES 8)
- SET(CPACK_PACKAGE_FILE_NAME "mariadb-essential-${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}-winx64")
- ELSE()
- SET(CPACK_PACKAGE_FILE_NAME "mariadb-essential-${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}-win32")
- ENDIF()
-ELSE()
- SET(CPACK_COMPONENTS_USED
- "Server;Client;Development;SharedLibraries;Embedded;Documentation;IniFiles;Readme;Debuginfo;Common;connect-engine")
-ENDIF()
-
-SET( WIX_FEATURE_MySQLServer_EXTRA_FEATURES "DBInstance;SharedClientServerComponents")
-# Some components like Embedded are optional
-# We will build MSI without embedded if it was not selected for build
-#(need to modify CPACK_COMPONENTS_ALL for that)
-SET(CPACK_ALL)
-FOREACH(comp1 ${CPACK_COMPONENTS_USED})
- SET(found)
- FOREACH(comp2 ${CPACK_COMPONENTS_ALL})
- IF(comp1 STREQUAL comp2)
- SET(found 1)
- BREAK()
- ENDIF()
- ENDFOREACH()
- IF(found)
- SET(CPACK_ALL ${CPACK_ALL} ${comp1})
- ENDIF()
-ENDFOREACH()
-SET(CPACK_COMPONENTS_ALL ${CPACK_ALL})
-
-# Always install (hidden), includes Readme files
-SET(CPACK_COMPONENT_GROUP_ALWAYSINSTALL_HIDDEN 1)
-SET(CPACK_COMPONENT_README_GROUP "AlwaysInstall")
-SET(CPACK_COMPONENT_COMMON_GROUP "AlwaysInstall")
-
-# Feature MySQL Server
-SET(CPACK_COMPONENT_GROUP_MYSQLSERVER_DISPLAY_NAME "MariaDB Server")
-SET(CPACK_COMPONENT_GROUP_MYSQLSERVER_EXPANDED "1")
-SET(CPACK_COMPONENT_GROUP_MYSQLSERVER_DESCRIPTION "Install server")
- # Subfeature "Server" (hidden)
- SET(CPACK_COMPONENT_SERVER_GROUP "MySQLServer")
- SET(CPACK_COMPONENT_SERVER_HIDDEN 1)
- # Subfeature "Client"
- SET(CPACK_COMPONENT_CLIENT_GROUP "MySQLServer")
- SET(CPACK_COMPONENT_CLIENT_DISPLAY_NAME "Client Programs")
- SET(CPACK_COMPONENT_CLIENT_DESCRIPTION
- "Various helpful (commandline) tools including the mysql command line client" )
- # Subfeature "Debug binaries"
- SET(CPACK_COMPONENT_DEBUGBINARIES_GROUP "MySQLServer")
- SET(CPACK_COMPONENT_DEBUGBINARIES_DISPLAY_NAME "Debug binaries")
- SET(CPACK_COMPONENT_DEBUGBINARIES_DESCRIPTION
- "Debug/trace versions of executables and libraries" )
- #SET(CPACK_COMPONENT_DEBUGBINARIES_WIX_LEVEL 2)
-
-
- #Subfeature "Data Files"
- SET(CPACK_COMPONENT_DATAFILES_GROUP "MySQLServer")
- SET(CPACK_COMPONENT_DATAFILES_DISPLAY_NAME "Server data files")
- SET(CPACK_COMPONENT_DATAFILES_DESCRIPTION "Server data files" )
- SET(CPACK_COMPONENT_DATAFILES_HIDDEN 1)
-
- #Subfeature "Connect Engine"
- SET(CPACK_COMPONENT_CONNECT-ENGINE_GROUP "MySQLServer")
- SET(CPACK_COMPONENT_CONNECT-ENGINE_DISPLAY_NAME "Server data files")
- SET(CPACK_COMPONENT_CONNECT-ENGINE_DESCRIPTION "Server data files" )
- SET(CPACK_COMPONENT_CONNECT-ENGINE_HIDDEN 1)
-
-
-#Feature "Devel"
-SET(CPACK_COMPONENT_GROUP_DEVEL_DISPLAY_NAME "Development Components")
-SET(CPACK_COMPONENT_GROUP_DEVEL_DESCRIPTION "Installs C/C++ header files and libraries")
- #Subfeature "Development"
- SET(CPACK_COMPONENT_DEVELOPMENT_GROUP "Devel")
- SET(CPACK_COMPONENT_DEVELOPMENT_HIDDEN 1)
-
- #Subfeature "Shared libraries"
- SET(CPACK_COMPONENT_SHAREDLIBRARIES_GROUP "Devel")
- SET(CPACK_COMPONENT_SHAREDLIBRARIES_DISPLAY_NAME "Client C API library (shared)")
- SET(CPACK_COMPONENT_SHAREDLIBRARIES_DESCRIPTION "Installs shared client library")
-
- #Subfeature "Embedded"
- SET(CPACK_COMPONENT_EMBEDDED_GROUP "Devel")
- SET(CPACK_COMPONENT_EMBEDDED_DISPLAY_NAME "Embedded server library")
- SET(CPACK_COMPONENT_EMBEDDED_DESCRIPTION "Installs embedded server library")
- SET(CPACK_COMPONENT_EMBEDDED_WIX_LEVEL 2)
-
-#Feature Debug Symbols
-SET(CPACK_COMPONENT_GROUP_DEBUGSYMBOLS_DISPLAY_NAME "Debug Symbols")
-SET(CPACK_COMPONENT_GROUP_DEBUGSYMBOLS_DESCRIPTION "Installs Debug Symbols")
-SET(CPACK_COMPONENT_DEBUGSYMBOLS_WIX_LEVEL 2)
- SET(CPACK_COMPONENT_DEBUGINFO_GROUP "DebugSymbols")
- SET(CPACK_COMPONENT_DEBUGINFO_HIDDEN 1)
-
-#Feature Documentation
-SET(CPACK_COMPONENT_DOCUMENTATION_DISPLAY_NAME "Documentation")
-SET(CPACK_COMPONENT_DOCUMENTATION_DESCRIPTION "Installs documentation")
-SET(CPACK_COMPONENT_DOCUMENTATION_WIX_LEVEL 2)
-
-#Feature tests
-SET(CPACK_COMPONENT_TEST_DISPLAY_NAME "Tests")
-SET(CPACK_COMPONENT_TEST_DESCRIPTION "Installs unittests (requires Perl to run)")
-SET(CPACK_COMPONENT_TEST_WIX_LEVEL 2)
-
-
-#Feature Misc (hidden, installs only if everything is installed)
-SET(CPACK_COMPONENT_GROUP_MISC_HIDDEN 1)
-SET(CPACK_COMPONENT_GROUP_MISC_WIX_LEVEL 100)
- SET(CPACK_COMPONENT_INIFILES_GROUP "Misc")
- SET(CPACK_COMPONENT_SERVER_SCRIPTS_GROUP "Misc")
-
-#Add Firewall exception for mysqld.exe
-SET(bin.mysqld.exe.FILE_EXTRA "
- <FirewallException Id='firewallexception.mysqld.exe' Name='[ProductName]' Scope='any'
- IgnoreFailure='yes' xmlns='http://schemas.microsoft.com/wix/FirewallExtension'
- />
- "
-)
-
+
+IF(ESSENTIALS)
+ SET(CPACK_COMPONENTS_USED "Server;Client")
+ SET(CPACK_WIX_UI "MyWixUI_Mondo")
+ IF(CMAKE_SIZEOF_VOID_P MATCHES 8)
+ SET(CPACK_PACKAGE_FILE_NAME "mariadb-essential-${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}-winx64")
+ ELSE()
+ SET(CPACK_PACKAGE_FILE_NAME "mariadb-essential-${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}-win32")
+ ENDIF()
+ELSE()
+ SET(CPACK_COMPONENTS_USED
+ "Server;Client;Development;SharedLibraries;Embedded;Documentation;IniFiles;Readme;Debuginfo;Common;connect-engine")
+ENDIF()
+
+SET( WIX_FEATURE_MySQLServer_EXTRA_FEATURES "DBInstance;SharedClientServerComponents")
+# Some components like Embedded are optional
+# We will build MSI without embedded if it was not selected for build
+#(need to modify CPACK_COMPONENTS_ALL for that)
+SET(CPACK_ALL)
+FOREACH(comp1 ${CPACK_COMPONENTS_USED})
+ SET(found)
+ FOREACH(comp2 ${CPACK_COMPONENTS_ALL})
+ IF(comp1 STREQUAL comp2)
+ SET(found 1)
+ BREAK()
+ ENDIF()
+ ENDFOREACH()
+ IF(found)
+ SET(CPACK_ALL ${CPACK_ALL} ${comp1})
+ ENDIF()
+ENDFOREACH()
+SET(CPACK_COMPONENTS_ALL ${CPACK_ALL})
+
+# Always install (hidden), includes Readme files
+SET(CPACK_COMPONENT_GROUP_ALWAYSINSTALL_HIDDEN 1)
+SET(CPACK_COMPONENT_README_GROUP "AlwaysInstall")
+SET(CPACK_COMPONENT_COMMON_GROUP "AlwaysInstall")
+
+# Feature MySQL Server
+SET(CPACK_COMPONENT_GROUP_MYSQLSERVER_DISPLAY_NAME "MariaDB Server")
+SET(CPACK_COMPONENT_GROUP_MYSQLSERVER_EXPANDED "1")
+SET(CPACK_COMPONENT_GROUP_MYSQLSERVER_DESCRIPTION "Install server")
+ # Subfeature "Server" (hidden)
+ SET(CPACK_COMPONENT_SERVER_GROUP "MySQLServer")
+ SET(CPACK_COMPONENT_SERVER_HIDDEN 1)
+ # Subfeature "Client"
+ SET(CPACK_COMPONENT_CLIENT_GROUP "MySQLServer")
+ SET(CPACK_COMPONENT_CLIENT_DISPLAY_NAME "Client Programs")
+ SET(CPACK_COMPONENT_CLIENT_DESCRIPTION
+ "Various helpful (commandline) tools including the mysql command line client" )
+ # Subfeature "Debug binaries"
+ SET(CPACK_COMPONENT_DEBUGBINARIES_GROUP "MySQLServer")
+ SET(CPACK_COMPONENT_DEBUGBINARIES_DISPLAY_NAME "Debug binaries")
+ SET(CPACK_COMPONENT_DEBUGBINARIES_DESCRIPTION
+ "Debug/trace versions of executables and libraries" )
+ #SET(CPACK_COMPONENT_DEBUGBINARIES_WIX_LEVEL 2)
+
+
+ #Subfeature "Data Files"
+ SET(CPACK_COMPONENT_DATAFILES_GROUP "MySQLServer")
+ SET(CPACK_COMPONENT_DATAFILES_DISPLAY_NAME "Server data files")
+ SET(CPACK_COMPONENT_DATAFILES_DESCRIPTION "Server data files" )
+ SET(CPACK_COMPONENT_DATAFILES_HIDDEN 1)
+
+ #Subfeature "Connect Engine"
+ SET(CPACK_COMPONENT_CONNECT-ENGINE_GROUP "MySQLServer")
+ SET(CPACK_COMPONENT_CONNECT-ENGINE_DISPLAY_NAME "Server data files")
+ SET(CPACK_COMPONENT_CONNECT-ENGINE_DESCRIPTION "Server data files" )
+ SET(CPACK_COMPONENT_CONNECT-ENGINE_HIDDEN 1)
+
+#Feature "Devel"
+SET(CPACK_COMPONENT_GROUP_DEVEL_DISPLAY_NAME "Development Components")
+SET(CPACK_COMPONENT_GROUP_DEVEL_DESCRIPTION "Installs C/C++ header files and libraries")
+ #Subfeature "Development"
+ SET(CPACK_COMPONENT_DEVELOPMENT_GROUP "Devel")
+ SET(CPACK_COMPONENT_DEVELOPMENT_HIDDEN 1)
+
+ #Subfeature "Shared libraries"
+ SET(CPACK_COMPONENT_SHAREDLIBRARIES_GROUP "Devel")
+ SET(CPACK_COMPONENT_SHAREDLIBRARIES_DISPLAY_NAME "Client C API library (shared)")
+ SET(CPACK_COMPONENT_SHAREDLIBRARIES_DESCRIPTION "Installs shared client library")
+
+ #Subfeature "Embedded"
+ SET(CPACK_COMPONENT_EMBEDDED_GROUP "Devel")
+ SET(CPACK_COMPONENT_EMBEDDED_DISPLAY_NAME "Embedded server library")
+ SET(CPACK_COMPONENT_EMBEDDED_DESCRIPTION "Installs embedded server library")
+ SET(CPACK_COMPONENT_EMBEDDED_WIX_LEVEL 2)
+
+#Feature Debug Symbols
+SET(CPACK_COMPONENT_GROUP_DEBUGSYMBOLS_DISPLAY_NAME "Debug Symbols")
+SET(CPACK_COMPONENT_GROUP_DEBUGSYMBOLS_DESCRIPTION "Installs Debug Symbols")
+SET(CPACK_COMPONENT_DEBUGSYMBOLS_WIX_LEVEL 2)
+ SET(CPACK_COMPONENT_DEBUGINFO_GROUP "DebugSymbols")
+ SET(CPACK_COMPONENT_DEBUGINFO_HIDDEN 1)
+
+#Feature Documentation
+SET(CPACK_COMPONENT_DOCUMENTATION_DISPLAY_NAME "Documentation")
+SET(CPACK_COMPONENT_DOCUMENTATION_DESCRIPTION "Installs documentation")
+SET(CPACK_COMPONENT_DOCUMENTATION_WIX_LEVEL 2)
+
+#Feature tests
+SET(CPACK_COMPONENT_TEST_DISPLAY_NAME "Tests")
+SET(CPACK_COMPONENT_TEST_DESCRIPTION "Installs unittests (requires Perl to run)")
+SET(CPACK_COMPONENT_TEST_WIX_LEVEL 2)
+
+
+#Feature Misc (hidden, installs only if everything is installed)
+SET(CPACK_COMPONENT_GROUP_MISC_HIDDEN 1)
+SET(CPACK_COMPONENT_GROUP_MISC_WIX_LEVEL 100)
+ SET(CPACK_COMPONENT_INIFILES_GROUP "Misc")
+ SET(CPACK_COMPONENT_SERVER_SCRIPTS_GROUP "Misc")
+
+#Add Firewall exception for mysqld.exe
+SET(bin.mysqld.exe.FILE_EXTRA "
+ <FirewallException Id='firewallexception.mysqld.exe' Name='[ProductName]' Scope='any'
+ IgnoreFailure='yes' xmlns='http://schemas.microsoft.com/wix/FirewallExtension'
+ />
+ "
+)
+
diff --git a/win/packaging/ca/CustomAction.cpp b/win/packaging/ca/CustomAction.cpp
index 67a17c2cc19..17bfca1debb 100644
--- a/win/packaging/ca/CustomAction.cpp
+++ b/win/packaging/ca/CustomAction.cpp
@@ -104,48 +104,48 @@ static void EscapeCommandLine(const wchar_t *in, wchar_t *out, size_t buflen)
}
pos= 0;
- for(int i = 0 ; ; i++)
- {
- size_t n_backslashes = 0;
- wchar_t c;
- while (in[i] == L'\\')
- {
- i++;
- n_backslashes++;
- }
-
- c= in[i];
- if (c == 0)
- {
- /*
- Escape all backslashes, but let the terminating double quotation mark
- that caller adds be interpreted as a metacharacter.
- */
- for(size_t j= 0; j < 2*n_backslashes;j++)
- {
- out[pos++]=L'\\';
- }
- break;
- }
- else if (c == L'"')
- {
- /*
- Escape all backslashes and the following double quotation mark.
- */
- for(size_t j= 0; j < 2*n_backslashes + 1; j++)
- {
- out[pos++]=L'\\';
- }
- out[pos++]= L'"';
- }
- else
- {
- /* Backslashes aren't special here. */
- for (size_t j=0; j < n_backslashes; j++)
- out[pos++] = L'\\';
-
- out[pos++]= c;
- }
+ for(int i = 0 ; ; i++)
+ {
+ size_t n_backslashes = 0;
+ wchar_t c;
+ while (in[i] == L'\\')
+ {
+ i++;
+ n_backslashes++;
+ }
+
+ c= in[i];
+ if (c == 0)
+ {
+ /*
+ Escape all backslashes, but let the terminating double quotation mark
+ that caller adds be interpreted as a metacharacter.
+ */
+ for(size_t j= 0; j < 2*n_backslashes;j++)
+ {
+ out[pos++]=L'\\';
+ }
+ break;
+ }
+ else if (c == L'"')
+ {
+ /*
+ Escape all backslashes and the following double quotation mark.
+ */
+ for(size_t j= 0; j < 2*n_backslashes + 1; j++)
+ {
+ out[pos++]=L'\\';
+ }
+ out[pos++]= L'"';
+ }
+ else
+ {
+ /* Backslashes aren't special here. */
+ for (size_t j=0; j < n_backslashes; j++)
+ out[pos++] = L'\\';
+
+ out[pos++]= c;
+ }
}
out[pos++]= 0;
}
diff --git a/win/packaging/custom_ui.wxs b/win/packaging/custom_ui.wxs
index 8a87fb4d246..70fa3ba3abd 100644
--- a/win/packaging/custom_ui.wxs
+++ b/win/packaging/custom_ui.wxs
@@ -1,183 +1,183 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-
-<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
- <Fragment>
- <Property Id="PortTemplate" Value="####" />
- <Property Id="PORT" Value="3306"></Property>
- <Property Id="MSIRESTARTMANAGERCONTROL" Value="Disable"/>
- <Property Id="CREATEDBINSTANCE"><![CDATA[&DBInstance=3 AND NOT !DBInstance=3]]></Property>
- <UI>
- <Dialog Id="DatabaseCreationDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
- <Control Id="ServiceNameLabel" Type="Text" X="20" Y="73" Width="70" Height="15" TabSkip="no" Text="Service Name:" />
- <Control Id="ServiceName" Type="Edit" X="90" Y="73" Width="120" Height="15" Property="SERVICENAME" Text="{20}" />
-
- <Control Id="RootPasswordLabel" Type="Text" X="20" Y="90" Width="120" Height="15" TabSkip="no" Text="&amp;Root password:" />
- <Control Id="RootPassword" Type="Edit" X="20" Y="105" Width="120" Height="18" Property="ROOT_PASSWORD" Password="yes" Text="{20}" />
-
- <Control Id="RootPasswordConfirmLabel" Type="Text" X="150" Y="90" Width="150" Height="15" TabSkip="no" Text="&amp;Confirm Root password:" />
- <Control Id="RootPasswordConfirm" Type="Edit" X="150" Y="105" Width="120" Height="18" Property="ROOT_PASSWORD_CONFIRM" Password="yes" Text="{20}" />
- <Control Id="BannerLine0" Type="Line" X="0" Y="128" Width="370" Height="0" />
-
- <Control Id="PortLabel" Type="Text" X="20" Y="137" Width="40" Height="15" TabSkip="no" Text="TCP port:" />
-
- <Control Id="Port" Type="MaskedEdit" X="60" Y="136" Width="30" Height="15" Property="PORT" Text="[PortTemplate]"/>
- <!--<Control Id="FirewallExceptionCheckBox" Type="CheckBox" X="150" Y="136" Height="15" Property="FIREWALL_EXCEPTION" Width="200" CheckBoxValue="1"
- Text="Create Firewall exception for this port"/>-->
-
- <Control Id="BannerLine2" Type="Line" X="0" Y="155" Width="370" Height="0" />
-
- <Control Id="FolderLabel" Type="Text" X="20" Y="181" Width="100" Height="15" TabSkip="no" Text="Database location:" />
- <Control Id="Folder" Type="PathEdit" X="20" Y="204" Width="200" Height="18" Property="DATABASELOCATION" Indirect="no" />
-
- <!-- Navigation buttons-->
- <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&amp;Back">
- <Publish Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
- </Control>
- <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="&amp;Next">
- <!--
- <Publish Event="ValidateProductID" Value="0">1</Publish>
- <Publish Event="SpawnWaitDialog" Value="WaitForCostingDlg">CostingComplete = 1</Publish>
- -->
- <!--<Publish Event="NewDialog" Value="SetupTypeDlg">ProductID</Publish>-->
- </Control>
- <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
- <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
- </Control>
- <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
- <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
- <Text>Create default [ProductName] instance</Text>
- </Control>
- <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
- <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
- <Text>{\WixUI_Font_Title}Default instance properties</Text>
- </Control>
- <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
- </Dialog>
-
- <Dialog Id="ConfirmDataCleanupDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
- <Control Id="ServiceRemoveText" Type="Text" X="20" Y="73" Width="300" Height="15" TabSkip="no">
- <Text>Service '[SERVICENAME]' will be removed</Text>
- </Control>
- <Control Id="CleanupDataCheckBox" Type="CheckBox" X="20" Y="100" Height="15" Property="CLEANUP_DATA" Width="15" CheckBoxValue="0"/>
- <Control Id="RemoveDataText" Type="Text" X="37" Y="101" Width="300" Height="200" TabSkip="no">
- <Text>Remove default database directory '[DATABASELOCATION]'</Text>
- </Control>
-
- <!-- Navigation buttons-->
- <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&amp;Back">
- <Publish Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
- </Control>
- <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="&amp;Next">
- <Publish Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
- </Control>
- <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
- <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
- </Control>
- <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
- <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
- <Text>Remove default [ProductName] database</Text>
- </Control>
- <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
- <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
- <Text>{\WixUI_Font_Title}Default instance properties</Text>
- </Control>
- <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
- </Dialog>
- </UI>
- <UI Id="MyWixUI_Mondo">
- <UIRef Id="WixUI_FeatureTree" />
- <UIRef Id="WixUI_ErrorProgressText" />
- <DialogRef Id="DatabaseCreationDlg" />
- <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="DatabaseCreationDlg" Order="999"><![CDATA[&DBInstance=3 AND NOT !DBInstance=3]]></Publish>
- <Publish Dialog="DatabaseCreationDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="3">1</Publish>
- <Publish Dialog="DatabaseCreationDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="3">1</Publish>
- <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="DatabaseCreationDlg" Order="3" ><![CDATA[&DBInstance=3 AND NOT !DBInstance=3]]></Publish>
- <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="ConfirmDataCleanupDlg" Order="3" ><![CDATA[(&DBInstance=2) AND (!DBInstance=3)]]></Publish>
- <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="ConfirmDataCleanupDlg" Order="999"><![CDATA[(&DBInstance=2) AND (!DBInstance=3)]]></Publish>
- <Publish Dialog="ConfirmDataCleanupDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg">WixUI_InstallMode = "Change"</Publish>
- <Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="ConfirmDataCleanupDlg" Order="999">!DBInstance=3</Publish>
- <Publish Dialog="ConfirmDataCleanupDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg">WixUI_InstallMode = "Remove"</Publish>
- </UI>
-
- <DirectoryRef Id='TARGETDIR'>
- <Directory Id="CommonAppDataFolder">
- <Directory Id="DatabasesRoot" Name="MariaDB">
- <Directory Id="DATABASELOCATION" Name="MariaDB Server 5.1">
- </Directory>
- </Directory>
- </Directory>
- </DirectoryRef>
-
- <Feature Id='DBInstance'
- Title='Database instance'
- Description='Install database instance'
- ConfigurableDirectory='DATABASELOCATION'
- AllowAdvertise='no'
- Level='1'>
- <Component Id="C.datadir" Guid="*" Directory="DATABASELOCATION">
- <RegistryValue Root='HKLM'
- Key='SOFTWARE\[Manufacturer]\[ProductName]'
- Name='DatabaseLocation' Value='[DATABASELOCATION]' Type='string' KeyPath='yes'/>
- <CreateFolder />
- </Component>
- <Component Id="C.service" Guid="*" Directory="DATABASELOCATION">
- <Condition>SERVICENAME</Condition>
- <RegistryValue Root='HKLM'
- Key='SOFTWARE\[Manufacturer]\[ProductName]'
- Name='ServiceName' Value='[SERVICENAME]' Type='string' KeyPath='yes'/>
- <ServiceControl Id='DBInstanceServiceStop' Name='[SERVICENAME]' Stop='uninstall' Wait='yes'></ServiceControl>
- <ServiceControl Id='DBInstanceServiceStart' Name='[SERVICENAME]' Start='install' Wait='no'></ServiceControl>
- <ServiceControl Id='DBInstanceServiceRemove' Name='[SERVICENAME]' Remove='uninstall' Wait='yes'></ServiceControl>
- </Component>
- </Feature>
-
- <CustomAction Id="QtExecDeferredExampleWithProperty_Cmd" Property="QtExecDeferredExampleWithProperty"
- Value="&quot;[#F.bin.mysql_install_db.exe]&quot; &quot;--service=[SERVICENAME]&quot; &quot;--password=[ROOT_PASSWORD]&quot; &quot;--datadir=[DATABASELOCATION]&quot;"
- Execute="immediate"/>
- <CustomAction Id="QtExecDeferredExampleWithProperty" BinaryKey="WixCA" DllEntry="CAQuietExec"
- Execute="deferred" Return="check" Impersonate="no"/>
-
- <UI>
- <ProgressText Action="QtExecDeferredExampleWithProperty">Running mysql_install_db.exe</ProgressText>
- </UI>
-
- <!-- Use Wix toolset "remember property" pattern to store properties between major upgrades etc -->
- <InstallExecuteSequence>
- <Custom Action="QtExecDeferredExampleWithProperty_Cmd" After="CostFinalize"><![CDATA[&DBInstance=3 AND NOT !DBInstance=3]]></Custom>
- <Custom Action="QtExecDeferredExampleWithProperty" After="InstallFiles"><![CDATA[&DBInstance=3 AND NOT !DBInstance=3]]></Custom>
- </InstallExecuteSequence>
-
- <Property Id='SERVICENAME'>
- <RegistrySearch Id='ServiceNameProperty' Root='HKLM'
- Key='SOFTWARE\[Manufacturer]\[ProductName]'
- Name='ServiceName' Type='raw' />
- </Property>
- <SetProperty After='AppSearch' Id="SERVICENAME" Value="MariaDB_51"><![CDATA[NOT SERVICENAME]]></SetProperty>
- <Property Id="DATABASELOCATION">
- <RegistrySearch Id='DatabaseLocationProperty' Root='HKLM'
- Key='SOFTWARE\[Manufacturer]\[ProductName]'
- Name='´DatabaseLocation' Type='raw' />
- </Property>
- <SetProperty After='AppSearch' Id="DATABASELOCATION" Value="[CommonAppDataFolder]\MariaDB\[ProductName]"><![CDATA[NOT DATABASELOCATION]]></SetProperty>
- <CustomAction Id='SaveCmdLineValue_SERVICENAME' Property='CMDLINE_SERVICENAME'
- Value='[SERVICENAME]' Execute='firstSequence' />
- <CustomAction Id='SetFromCmdLineValue_SERVICENAME' Property='SERVICENAME' Value='[CMDLINE_SERVICENAME]' Execute='firstSequence' />
- <CustomAction Id='SaveCmdLineValue_DATABASELOCATION' Property='CMDLINE_DATABASELOCATION'
- Value='[DATABASELOCATION]' Execute='firstSequence' />
- <CustomAction Id='SetFromCmdLineValue_DATABASELOCATION' Property='DATABASELOCATION' Value='[CMDLINE_DATABASELOCATION]' Execute='firstSequence' />
-
- <InstallUISequence>
- <Custom Action='SaveCmdLineValue_SERVICENAME' Before='AppSearch' />
- <Custom Action='SetFromCmdLineValue_SERVICENAME' After='AppSearch'>CMDLINE_SERVICENAME</Custom>
- <Custom Action='SaveCmdLineValue_DATABASELOCATION' Before='AppSearch' />
- <Custom Action='SetFromCmdLineValue_DATABASELOCATION' After='AppSearch'>CMDLINE_DATABASELOCATION</Custom>
- </InstallUISequence>
- <InstallExecuteSequence>
- <Custom Action='SaveCmdLineValue_SERVICENAME' Before='AppSearch' />
- <Custom Action='SetFromCmdLineValue_SERVICENAME' After='AppSearch'>CMDLINE_SERVICENAME</Custom>
- <Custom Action='SaveCmdLineValue_DATABASELOCATION' Before='AppSearch' />
- <Custom Action='SetFromCmdLineValue_DATABASELOCATION' After='AppSearch'>CMDLINE_DATABASELOCATION</Custom>
- </InstallExecuteSequence>
- </Fragment>
+<?xml version="1.0" encoding="UTF-8"?>
+
+
+<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
+ <Fragment>
+ <Property Id="PortTemplate" Value="####" />
+ <Property Id="PORT" Value="3306"></Property>
+ <Property Id="MSIRESTARTMANAGERCONTROL" Value="Disable"/>
+ <Property Id="CREATEDBINSTANCE"><![CDATA[&DBInstance=3 AND NOT !DBInstance=3]]></Property>
+ <UI>
+ <Dialog Id="DatabaseCreationDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
+ <Control Id="ServiceNameLabel" Type="Text" X="20" Y="73" Width="70" Height="15" TabSkip="no" Text="Service Name:" />
+ <Control Id="ServiceName" Type="Edit" X="90" Y="73" Width="120" Height="15" Property="SERVICENAME" Text="{20}" />
+
+ <Control Id="RootPasswordLabel" Type="Text" X="20" Y="90" Width="120" Height="15" TabSkip="no" Text="&amp;Root password:" />
+ <Control Id="RootPassword" Type="Edit" X="20" Y="105" Width="120" Height="18" Property="ROOT_PASSWORD" Password="yes" Text="{20}" />
+
+ <Control Id="RootPasswordConfirmLabel" Type="Text" X="150" Y="90" Width="150" Height="15" TabSkip="no" Text="&amp;Confirm Root password:" />
+ <Control Id="RootPasswordConfirm" Type="Edit" X="150" Y="105" Width="120" Height="18" Property="ROOT_PASSWORD_CONFIRM" Password="yes" Text="{20}" />
+ <Control Id="BannerLine0" Type="Line" X="0" Y="128" Width="370" Height="0" />
+
+ <Control Id="PortLabel" Type="Text" X="20" Y="137" Width="40" Height="15" TabSkip="no" Text="TCP port:" />
+
+ <Control Id="Port" Type="MaskedEdit" X="60" Y="136" Width="30" Height="15" Property="PORT" Text="[PortTemplate]"/>
+ <!--<Control Id="FirewallExceptionCheckBox" Type="CheckBox" X="150" Y="136" Height="15" Property="FIREWALL_EXCEPTION" Width="200" CheckBoxValue="1"
+ Text="Create Firewall exception for this port"/>-->
+
+ <Control Id="BannerLine2" Type="Line" X="0" Y="155" Width="370" Height="0" />
+
+ <Control Id="FolderLabel" Type="Text" X="20" Y="181" Width="100" Height="15" TabSkip="no" Text="Database location:" />
+ <Control Id="Folder" Type="PathEdit" X="20" Y="204" Width="200" Height="18" Property="DATABASELOCATION" Indirect="no" />
+
+ <!-- Navigation buttons-->
+ <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&amp;Back">
+ <Publish Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
+ </Control>
+ <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="&amp;Next">
+ <!--
+ <Publish Event="ValidateProductID" Value="0">1</Publish>
+ <Publish Event="SpawnWaitDialog" Value="WaitForCostingDlg">CostingComplete = 1</Publish>
+ -->
+ <!--<Publish Event="NewDialog" Value="SetupTypeDlg">ProductID</Publish>-->
+ </Control>
+ <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
+ <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
+ </Control>
+ <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
+ <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
+ <Text>Create default [ProductName] instance</Text>
+ </Control>
+ <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
+ <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
+ <Text>{\WixUI_Font_Title}Default instance properties</Text>
+ </Control>
+ <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
+ </Dialog>
+
+ <Dialog Id="ConfirmDataCleanupDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
+ <Control Id="ServiceRemoveText" Type="Text" X="20" Y="73" Width="300" Height="15" TabSkip="no">
+ <Text>Service '[SERVICENAME]' will be removed</Text>
+ </Control>
+ <Control Id="CleanupDataCheckBox" Type="CheckBox" X="20" Y="100" Height="15" Property="CLEANUP_DATA" Width="15" CheckBoxValue="0"/>
+ <Control Id="RemoveDataText" Type="Text" X="37" Y="101" Width="300" Height="200" TabSkip="no">
+ <Text>Remove default database directory '[DATABASELOCATION]'</Text>
+ </Control>
+
+ <!-- Navigation buttons-->
+ <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&amp;Back">
+ <Publish Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
+ </Control>
+ <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="&amp;Next">
+ <Publish Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
+ </Control>
+ <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
+ <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
+ </Control>
+ <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
+ <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
+ <Text>Remove default [ProductName] database</Text>
+ </Control>
+ <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
+ <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
+ <Text>{\WixUI_Font_Title}Default instance properties</Text>
+ </Control>
+ <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
+ </Dialog>
+ </UI>
+ <UI Id="MyWixUI_Mondo">
+ <UIRef Id="WixUI_FeatureTree" />
+ <UIRef Id="WixUI_ErrorProgressText" />
+ <DialogRef Id="DatabaseCreationDlg" />
+ <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="DatabaseCreationDlg" Order="999"><![CDATA[&DBInstance=3 AND NOT !DBInstance=3]]></Publish>
+ <Publish Dialog="DatabaseCreationDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="3">1</Publish>
+ <Publish Dialog="DatabaseCreationDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="3">1</Publish>
+ <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="DatabaseCreationDlg" Order="3" ><![CDATA[&DBInstance=3 AND NOT !DBInstance=3]]></Publish>
+ <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="ConfirmDataCleanupDlg" Order="3" ><![CDATA[(&DBInstance=2) AND (!DBInstance=3)]]></Publish>
+ <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="ConfirmDataCleanupDlg" Order="999"><![CDATA[(&DBInstance=2) AND (!DBInstance=3)]]></Publish>
+ <Publish Dialog="ConfirmDataCleanupDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg">WixUI_InstallMode = "Change"</Publish>
+ <Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="ConfirmDataCleanupDlg" Order="999">!DBInstance=3</Publish>
+ <Publish Dialog="ConfirmDataCleanupDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg">WixUI_InstallMode = "Remove"</Publish>
+ </UI>
+
+ <DirectoryRef Id='TARGETDIR'>
+ <Directory Id="CommonAppDataFolder">
+ <Directory Id="DatabasesRoot" Name="MariaDB">
+ <Directory Id="DATABASELOCATION" Name="MariaDB Server 5.1">
+ </Directory>
+ </Directory>
+ </Directory>
+ </DirectoryRef>
+
+ <Feature Id='DBInstance'
+ Title='Database instance'
+ Description='Install database instance'
+ ConfigurableDirectory='DATABASELOCATION'
+ AllowAdvertise='no'
+ Level='1'>
+ <Component Id="C.datadir" Guid="*" Directory="DATABASELOCATION">
+ <RegistryValue Root='HKLM'
+ Key='SOFTWARE\[Manufacturer]\[ProductName]'
+ Name='DatabaseLocation' Value='[DATABASELOCATION]' Type='string' KeyPath='yes'/>
+ <CreateFolder />
+ </Component>
+ <Component Id="C.service" Guid="*" Directory="DATABASELOCATION">
+ <Condition>SERVICENAME</Condition>
+ <RegistryValue Root='HKLM'
+ Key='SOFTWARE\[Manufacturer]\[ProductName]'
+ Name='ServiceName' Value='[SERVICENAME]' Type='string' KeyPath='yes'/>
+ <ServiceControl Id='DBInstanceServiceStop' Name='[SERVICENAME]' Stop='uninstall' Wait='yes'></ServiceControl>
+ <ServiceControl Id='DBInstanceServiceStart' Name='[SERVICENAME]' Start='install' Wait='no'></ServiceControl>
+ <ServiceControl Id='DBInstanceServiceRemove' Name='[SERVICENAME]' Remove='uninstall' Wait='yes'></ServiceControl>
+ </Component>
+ </Feature>
+
+ <CustomAction Id="QtExecDeferredExampleWithProperty_Cmd" Property="QtExecDeferredExampleWithProperty"
+ Value="&quot;[#F.bin.mysql_install_db.exe]&quot; &quot;--service=[SERVICENAME]&quot; &quot;--password=[ROOT_PASSWORD]&quot; &quot;--datadir=[DATABASELOCATION]&quot;"
+ Execute="immediate"/>
+ <CustomAction Id="QtExecDeferredExampleWithProperty" BinaryKey="WixCA" DllEntry="CAQuietExec"
+ Execute="deferred" Return="check" Impersonate="no"/>
+
+ <UI>
+ <ProgressText Action="QtExecDeferredExampleWithProperty">Running mysql_install_db.exe</ProgressText>
+ </UI>
+
+ <!-- Use Wix toolset "remember property" pattern to store properties between major upgrades etc -->
+ <InstallExecuteSequence>
+ <Custom Action="QtExecDeferredExampleWithProperty_Cmd" After="CostFinalize"><![CDATA[&DBInstance=3 AND NOT !DBInstance=3]]></Custom>
+ <Custom Action="QtExecDeferredExampleWithProperty" After="InstallFiles"><![CDATA[&DBInstance=3 AND NOT !DBInstance=3]]></Custom>
+ </InstallExecuteSequence>
+
+ <Property Id='SERVICENAME'>
+ <RegistrySearch Id='ServiceNameProperty' Root='HKLM'
+ Key='SOFTWARE\[Manufacturer]\[ProductName]'
+ Name='ServiceName' Type='raw' />
+ </Property>
+ <SetProperty After='AppSearch' Id="SERVICENAME" Value="MariaDB_51"><![CDATA[NOT SERVICENAME]]></SetProperty>
+ <Property Id="DATABASELOCATION">
+ <RegistrySearch Id='DatabaseLocationProperty' Root='HKLM'
+ Key='SOFTWARE\[Manufacturer]\[ProductName]'
+ Name='´DatabaseLocation' Type='raw' />
+ </Property>
+ <SetProperty After='AppSearch' Id="DATABASELOCATION" Value="[CommonAppDataFolder]\MariaDB\[ProductName]"><![CDATA[NOT DATABASELOCATION]]></SetProperty>
+ <CustomAction Id='SaveCmdLineValue_SERVICENAME' Property='CMDLINE_SERVICENAME'
+ Value='[SERVICENAME]' Execute='firstSequence' />
+ <CustomAction Id='SetFromCmdLineValue_SERVICENAME' Property='SERVICENAME' Value='[CMDLINE_SERVICENAME]' Execute='firstSequence' />
+ <CustomAction Id='SaveCmdLineValue_DATABASELOCATION' Property='CMDLINE_DATABASELOCATION'
+ Value='[DATABASELOCATION]' Execute='firstSequence' />
+ <CustomAction Id='SetFromCmdLineValue_DATABASELOCATION' Property='DATABASELOCATION' Value='[CMDLINE_DATABASELOCATION]' Execute='firstSequence' />
+
+ <InstallUISequence>
+ <Custom Action='SaveCmdLineValue_SERVICENAME' Before='AppSearch' />
+ <Custom Action='SetFromCmdLineValue_SERVICENAME' After='AppSearch'>CMDLINE_SERVICENAME</Custom>
+ <Custom Action='SaveCmdLineValue_DATABASELOCATION' Before='AppSearch' />
+ <Custom Action='SetFromCmdLineValue_DATABASELOCATION' After='AppSearch'>CMDLINE_DATABASELOCATION</Custom>
+ </InstallUISequence>
+ <InstallExecuteSequence>
+ <Custom Action='SaveCmdLineValue_SERVICENAME' Before='AppSearch' />
+ <Custom Action='SetFromCmdLineValue_SERVICENAME' After='AppSearch'>CMDLINE_SERVICENAME</Custom>
+ <Custom Action='SaveCmdLineValue_DATABASELOCATION' Before='AppSearch' />
+ <Custom Action='SetFromCmdLineValue_DATABASELOCATION' After='AppSearch'>CMDLINE_DATABASELOCATION</Custom>
+ </InstallExecuteSequence>
+ </Fragment>
</Wix> \ No newline at end of file
diff --git a/win/packaging/extra.wxs.in b/win/packaging/extra.wxs.in
index da4ac6aa9ac..3425a76427b 100644
--- a/win/packaging/extra.wxs.in
+++ b/win/packaging/extra.wxs.in
@@ -1,913 +1,913 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
- <Fragment>
- <!--
- Check, if upgrade wizard was built
- It currently requires MFC, which is not in SDK
- neither in express edítions of VS.
- -->
- <?ifndef HaveUpgradeWizard ?>
- <?define HaveUpgradeWizard="1"?>
- <?endif?>
-
- <!-- If Innodb is compiled in, enable "optimize for transactions" checkbox -->
- <?ifndef HaveInnodb ?>
- <?define HaveInnodb="0"?>
- <?endif?>
-
- <Property Id="PortTemplate" Value="#####" />
- <?if $(var.HaveInnodb) = "1" ?>
- <Property Id="BufferPoolSizeTemplate" Value="#######" />
- <?endif?>
- <!--
- Installation parameters that can be passed via msiexec command line
- For "booleans" (like skip networking), just providing any value means property set to "yes".
- -->
- <!-- instalation directory (default under program files)-->
- <!--- (defined elsewhere) <Property Id="INSTALLDIR" Secure="yes" /> -->
-
- <!-- Database data directory (default under INSTALLDIR\data) -->
- <!--- (defined elsewhere) <Property Id="DATADIR" Secure="yes"/> -->
-
- <!-- Service name of database instanced (default MySQL in GUI, nothing with command line) -->
- <!-- (defined elsewhere) <Property Id="SERVICENAME" Secure="yes" /> -->
-
- <!-- Root password -->
- <Property Id="PASSWORD" Hidden="yes" Secure="yes" />
- <Property Id="ESCAPEDPASSWORD" Hidden="yes" Secure="yes" />
- <!-- Database port -->
- <Property Id="PORT" Value="3306" Secure="yes"/>
- <!-- Whether to allow remote access for root user -->
- <Property Id="ALLOWREMOTEROOTACCESS" Secure="yes" />
- <!-- Skip networking. This will switch configuration to use named pipe-->
- <Property Id="SKIPNETWORKING" Secure="yes"/>
- <!-- Whether to keep default (unauthenticated) user. Default is no-->
- <Property Id="DEFAULTUSER" Secure="yes"/>
- <!-- Set server character set to UTF8 -->
- <Property Id="UTF8" Secure="yes"/>
- <!-- Whether to data on uninstall (default yes, after asking user consent) -->
- <Property Id="CLEANUPDATA" Secure="yes" Value="1"/>
- <!-- Force per machine installation -->
- <Property Id="ALLUSERS" Secure="yes" Value="1"/>
- <!-- Disable advertised shortcuts weirdness -->
- <Property Id="DISABLEADVTSHORTCUTS" Secure="yes" Value="1"/>
-
- <!-- Activate feedback plugin-->
- <Property Id="FEEDBACK" Secure="yes"/>
-
- <?if $(var.HaveInnodb) = "1" ?>
- <!-- Quick configuration : set default storage engine to innodb, use strict sql_mode -->
- <Property Id="STDCONFIG" Secure="yes" Value="1"/>
- <?endif?>
- <!-- Innodb Buffer pool size in MB-->
- <Property Id="BUFFERPOOLSIZE" Secure="yes"/>
-
-
- <CustomAction Id="LaunchUrl" BinaryKey="WixCA" DllEntry="WixShellExec" Execute="immediate" Return="check" Impersonate="yes" />
-
-
- <!--
- User interface dialogs
- -->
- <WixVariable Id='WixUIBannerBmp' Value='@CMAKE_CURRENT_SOURCE_DIR@\WixUIBannerBmp.jpg' />
- <WixVariable Id='WixUIDialogBmp' Value='@CMAKE_CURRENT_SOURCE_DIR@\WixUIDialogBmp.jpg' />
- <UI>
-
- <!-- Dialog on uninstall of the database -->
- <Dialog Id="ConfirmDataCleanupDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
-
- <!--<Control Id="CleanupDataCheckBox" Type="CheckBox" X="20" Y="100" Height="30" Property="CLEANUPDATA" Width="300" CheckBoxValue="1"
- Text="{\Font1}Remove default database directory &#xD;&#xA;'[DATADIR]'"/>
- -->
- <Control Id="RemoveDatadirButton" Type="PushButton" X="40" Y="65" Width="80" Height="18"
- Text="Remove data">
- <Publish Property="CLEANUPDATA" Value="1">1</Publish>
- <Publish Event="NewDialog" Value="VerifyReadyDlg">WixUI_InstallMode</Publish>
- <Publish Event="EndDialog" Value="Return">NOT WixUI_InstallMode</Publish>
-
- </Control>
- <Control Id="RemoveDatadirText" Type="Text" X="60" Y="85" Width="280" Height="20">
- <Text>Remove default database directory [DATADIR]. Ensures proper cleanup on uninstall.</Text>
- </Control>
-
- <Control Id="KeepDatadirButton" Type="PushButton" X="40" Y="118" Width="80" Height="18"
- Text="Keep data">
- <Publish Property="CLEANUPDATA">1</Publish>
- <Publish Event="NewDialog" Value="VerifyReadyDlg">WixUI_InstallMode</Publish>
- <Publish Event="EndDialog" Value="Return">NOT WixUI_InstallMode</Publish>
- </Control>
- <Control Id="KeepDataDirText" Type="Text" X="60" Y="138" Width="280" Height="70" >
- <Text>Do not remove [DATADIR]. Choose this option if you intend to use data in the future</Text>
- </Control>
-
-
- <!-- Navigation buttons-->
- <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&amp;Back">
- <Publish Event="NewDialog" Value="CustomizeDlg">WixUI_InstallMode="Change"</Publish>
- <Condition Action="disable">NOT WixUI_InstallMode</Condition>
- </Control>
- <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Disabled="yes" Text="&amp;Next">
- <Publish Event="NewDialog" Value="VerifyReadyDlg">WixUI_InstallMode</Publish>
- <Publish Event="EndDialog" Value="Return">NOT WixUI_InstallMode</Publish>
- </Control>
- <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
- <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
- </Control>
- <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
- <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
- <Text>Remove default [ProductName] database</Text>
- </Control>
- <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
- <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
- <Text>{\WixUI_Font_Title}Default instance properties</Text>
- </Control>
- <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
- </Dialog>
-
- <!-- Dialog new or upgrade instance -->
-
- <Property Id="CreateOrUpgradeChoice" Value="Create"/>
-
- <Dialog Id="NewOrUpgradeInstanceDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
- <Control Id="Text" Type="Text" X="40" Y="65" Width="270" Height="30">
- <Text>Setup found existing database instances that can be upgraded to [ProductName].You can create a new instance and/or upgrade existing one.
- </Text>
- </Control>
-
- <Control Id="CreateOrUpgradeButton"
- Type="RadioButtonGroup" X="40" Y="100" Width="300" Height="70"
- Property="CreateOrUpgradeChoice" Text="Specify what to do">
- <RadioButtonGroup Property="CreateOrUpgradeChoice">
- <RadioButton Value="Create" X="0" Y="0" Width="300" Height="25"
- Text="{\Font1}Create new database instance."/>
- <RadioButton Value="Upgrade" X="0" Y="30" Width="300" Height="25"
- Text="{\Font1}Do not create a new database. Optionally upgrade existing instances." />
- </RadioButtonGroup>
- </Control>
-
- <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&amp;Back">
- <Publish Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
- </Control>
- <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Text="&amp;Next">
- <Publish Event="Remove" Value="DBInstance">CreateOrUpgradeChoice = "Upgrade" </Publish>
- <Publish Event="AddLocal" Value="DBInstance">CreateOrUpgradeChoice = "Create"</Publish>
- <Publish Property="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Value="[NonExistentProperty]">CreateOrUpgradeChoice = "Create"</Publish>
- <Publish Property="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="[NonExistentProperty]">CreateOrUpgradeChoice = "Create"</Publish>
- <Publish Property="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Value="1">CreateOrUpgradeChoice = "Upgrade"</Publish>
- <Publish Event="NewDialog" Value="CustomizeDlg">1</Publish>
- </Control>
- <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
- <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
- </Control>
- <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
- <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
- <Text>Create or upgrade database instance</Text>
- </Control>
- <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
- <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
- <Text>{\WixUI_Font_Title}[ProductName] setup</Text>
- </Control>
- <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
- </Dialog>
-
- <!-- Feedback dialog -->
- <Dialog Id="Feedback" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
-
- <Control Id="CheckBoxFeedback" Type="CheckBox" X="8" Y="61" Width="360" Height="12" Property="FEEDBACK" CheckBoxValue="1" TabSkip="no">
- <Text>{\Font1}Enable the Feedback plugin and submit anonymous usage information</Text>
- </Control>
-
- <Control Id="Text" Type="Text" X="23" Y="82" Width="290" Height="55">
- <Text>Monty Program has created a Feedback plugin for MariaDB which, if enabled, collects basic anonymous statistical information. This information is used by the developers to improve MariaDB. Enabling this plugin is an easy way to help with MariaDB development. Collected statistics, and more information on the plugin, can be viewed at http://mariadb.org/feedback_plugin </Text>
- </Control>
-
- <Control Id="MoreInfo" Type="PushButton" X="23" Y="140" Width="56" Height="17" Text="More Info" ToolTip="http://mariadb.org/feedback_plugin" >
- <Publish Property="WixShellExecTarget" Value="http://mariadb.org/feedback_plugin" Order="1">1</Publish>
- <Publish Event="DoAction" Value="LaunchUrl" Order="2">1</Publish>
- </Control>
-
-
- <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&amp;Back">
- <Publish Event="NewDialog" Value="ServicePortDlg">1</Publish>
- </Control>
- <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Text="&amp;Next">
- <Publish Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
- </Control>
- <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
- <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
- </Control>
- <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
- <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
- <Text>Submit usage information</Text>
- </Control>
- <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
- <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
- <Text>{\WixUI_Font_Title}[ProductName] setup</Text>
- </Control>
- <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
- </Dialog>
-
- <!-- Error popup dialog -->
- <Dialog Id="WarningDlg" Width="320" Height="85" Title="[ProductName] Setup" NoMinimize="yes">
- <Control Id="Icon" Type="Icon" X="15" Y="15" Width="24" Height="24"
- ToolTip="Information icon" FixedSize="yes" IconSize="32" Text="WixUI_Ico_Info" />
- <Control Id="Ok" Type="PushButton" X="132" Y="57" Width="56" Height="17"
- Default="yes" Cancel="yes" Text="OK">
- <Publish Property="WarningText">1</Publish>
- <Publish Event="EndDialog" Value="Return">1</Publish>
- </Control>
- <Control Id="Text" Type="Text" X="48" Y="15" Width="260" Height="30">
- <Text>[WarningText]</Text>
- </Control>
- </Dialog>
-
-
- <Property Id="ModifyRootPassword" Value="1"/>
- <TextStyle Id="Font1" FaceName="Tahoma" Size="8" Red="0" Green="0" Blue="0" Bold="yes" />
-
- <!-- Root password plus default user dialog -->
- <Dialog Id="UserSettingsDlg" X="50" Y="50" Width="370" Height="270" Title="User settings">
- <Control Id="EditRootPassword" Type="Edit" X="104" Y="82" Width="91" Height="15" Property="PASSWORD" Password="yes" TabSkip="no">
- <Text>{100}</Text>
- <Condition Action="enable">ModifyRootPassword</Condition>
- <Condition Action="disable">NOT ModifyRootPassword</Condition>
- </Control>
- <Control Id="EditRootPasswordConfirm" Type="Edit" X="104" Y="103" Width="91" Height="15" Property="RootPasswordConfirm" Password="yes" TabSkip="no">
- <Text>{100}</Text>
- <Condition Action="enable">ModifyRootPassword</Condition>
- <Condition Action="disable">NOT ModifyRootPassword</Condition>
- </Control>
-
- <Control Id="CheckBoxModifyRootPassword" Type="CheckBox" X="8" Y="62" Width="222" Height="18" Property="ModifyRootPassword" CheckBoxValue="1" TabSkip="no">
- <Text>{\Font1}Modify password for database user 'root'</Text>
- <Publish Property="PASSWORD" >NOT ModifyRootPassword</Publish>
- <Publish Property="RootPasswordConfirm">NOT ModifyRootPassword</Publish>
- <Publish Property="ALLOWREMOTEROOTACCESS">NOT ModifyRootPassword</Publish>
- <Publish Property="ALLOWREMOTEROOTACCESS" Value="1">ModifyRootPassword</Publish>
- </Control>
-
- <Control Id="Text5" Type="Text" X="23" Y="82" Width="77" Height="14" TabSkip="yes">
- <Text>New root password:</Text>
- </Control>
- <Control Id="Text6" Type="Text" X="201" Y="85" Width="100" Height="17" TabSkip="yes">
- <Text>Enter new root password</Text>
- </Control>
- <Control Id="Text8" Type="Text" X="23" Y="105" Width="75" Height="17" TabSkip="yes">
- <Text>Confirm:</Text>
- </Control>
-
- <Control Id="Text10" Type="Text" X="201" Y="104" Width="100" Height="17" TabSkip="yes">
- <Text>Retype the password</Text>
- </Control>
- <Control Id="CheckBoxALLOWREMOTEROOTACCESS" Type="CheckBox" X="23" Y="122" Width="196" Height="18" Property="ALLOWREMOTEROOTACCESS"
- CheckBoxValue="--allow-remote-root-access" TabSkip="no">
- <Text>{\Font1}Enable access from remote machines for 'root' user</Text>
- <Condition Action="enable">ModifyRootPassword</Condition>
- <Condition Action="disable">NOT ModifyRootPassword</Condition>
- </Control>
-
- <Control Id="CheckBoxCreateDefaultUser" Type="CheckBox" X="8" Y="154" Width="200" Height="18" Property="DEFAULTUSER"
- CheckBoxValue="--default-user" TabSkip="no">
- <Text>{\Font1}Create An Anonymous Account</Text>
- </Control>
- <Control Id="Text14" Type="Text" X="21" Y="174" Width="268" Height="16" TabSkip="yes">
- <Text>This option will create an anonymous account on this server. </Text>
- </Control>
- <Control Id="Text13" Type="Text" X="21" Y="190" Width="254" Height="24" TabSkip="yes">
- <Text>Please note: this setting can lead to insecure systems.</Text>
- </Control>
-
- <Control Id="CheckBoxUTF8" Type="CheckBox" X="8" Y="215" Width="250" Height="18" Property="UTF8" CheckBoxValue="1" TabSkip="no">
- <Text>{\Font1}Use UTF8 as default server's character set</Text>
- </Control>
-
- <!-- Navigation buttons-->
- <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&amp;Back">
- <Publish Event="NewDialog" Value="CustomizeDlg">1</Publish>
- </Control>
- <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="&amp;Next">
- <Publish Property="WarningText" Value="Passwords do not match."><![CDATA[PASSWORD <> RootPasswordConfirm]]></Publish>
- <Publish Event="SpawnDialog" Value="WarningDlg"><![CDATA[WarningText <>""]]></Publish>
- <Publish Property="SERVICENAME" Value="MySQL">NOT SERVICENAME AND NOT WarningText</Publish>
- <Publish Event="NewDialog" Value="ServicePortDlg"><![CDATA[WarningText=""]]></Publish>
- <Condition Action="enable"><![CDATA[NOT ModifyRootPassword OR PASSWORD]]> </Condition>
- <Condition Action="disable"><![CDATA[ModifyRootPassword AND (NOT PASSWORD)]]> </Condition>
- </Control>
- <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
- <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
- </Control>
- <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
- <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
- <Text> [ProductName] database configuration</Text>
- </Control>
- <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
- <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
- <Text>{\WixUI_Font_Title}Default instance properties</Text>
- </Control>
- <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
- </Dialog>
-
- <Property Id="InstallService" Value="1"/>
- <Property Id="EnableNetworking" Value="1"/>
-
- <!-- Service and port configuration -->
- <Dialog Id="ServicePortDlg" Width="370" Height="270" Title="Database settings">
- <Control Id="InstallAsService" Type="CheckBox" X="9" Y="61" Width="222" Height="19" Property="InstallService" CheckBoxValue="1" TabSkip="no">
- <Text>{\Font1}Install as service</Text>
- </Control>
- <Control Id="EditServiceName" Type="Edit" X="104" Y="82" Width="91" Height="15" Property="SERVICENAME" TabSkip="no">
- <Text>{20}</Text>
- <Condition Action="enable">InstallService</Condition>
- <Condition Action="disable">Not InstallService</Condition>
- </Control>
- <Control Id="Text5" Type="Text" X="25" Y="82" Width="77" Height="14" TabSkip="yes">
- <Text>Service Name:</Text>
- </Control>
- <Control Id="CheckBoxEnableNetworking" Type="CheckBox" Height="18" Width="102" X="9" Y="117" Property="EnableNetworking" CheckBoxValue="1">
- <Text>{\Font1}Enable networking</Text>
- <!--<Publish Property="PORT">NOT EnableNetworking</Publish>-->
- <Publish Property="SKIPNETWORKING" Value="--skip-networking">NOT EnableNetworking</Publish>
- <Publish Property="SKIPNETWORKING">EnableNetworking</Publish>
- </Control>
- <Control Id="LabelTCPPort" Type="Text" Height="17" Width="75" X="25" Y="142" Text="TCP port:" />
- <Control Id="Port" Type="MaskedEdit" X="104" Y="140" Width="28" Height="15" Property="PORT" Sunken="yes" Text="[PortTemplate]">
- <Condition Action="enable" >EnableNetworking</Condition>
- <Condition Action="disable">Not EnableNetworking</Condition>
- </Control>
-
- <?if $(var.HaveInnodb) = "1" ?>
- <Control Id="CheckBoxStandardConfig" Type="CheckBox" Height="18" Width="220" X="9" Y="171" Property="STDCONFIG" CheckBoxValue="1">
- <Text>{\Font1}Optimize for transactions</Text>
- </Control>
-
- <Control Id="StandardConfigExplain" Type="Text" X="25" Y="190" Width="270" Height="14" TabSkip="yes">
- <Text>(Uses transactional storage engine and "strict" SQL mode)</Text>
- <Condition Action="enable" >STDCONFIG</Condition>
- <Condition Action="disable">Not STDCONFIG</Condition>
- </Control>
- <Control Id="LabelInnodbBufferpool" Type="Text" Height="17" Width="77" X="25" Y="210" Text="Buffer pool size:" >
- <Condition Action="enable" >STDCONFIG</Condition>
- <Condition Action="disable">Not STDCONFIG</Condition>
- </Control>
- <Control Id="BPSize" Type="MaskedEdit" X="104" Y="208" Width="40" Height="15" Property="BUFFERPOOLSIZE" Sunken="yes" Text="[BufferPoolSizeTemplate]">
- <Condition Action="enable" >STDCONFIG</Condition>
- <Condition Action="disable">Not STDCONFIG</Condition>
- </Control>
- <Control Id="LabelMB" Type="Text" Height="17" Width="15" X="150" Y="210" Text="MB" >
- <Condition Action="enable" >STDCONFIG</Condition>
- <Condition Action="disable">Not STDCONFIG</Condition>
- </Control>
- <?endif?>
-
- <!-- Navigation buttons-->
- <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&amp;Back">
- <Publish Event="NewDialog" Value="UserSettingsDlg">1</Publish>
- </Control>
- <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="no" Text="&amp;Next">
- <Publish Property="SERVICENAME">NOT InstallService</Publish>
- <Publish Property="WarningText" Value="Please enter valid port or uncheck 'Enable Networking' checkbox">
- <![CDATA[EnableNetworking AND NOT PORT AND NOT WarningText]]>
- </Publish>
- <Publish Property="WarningText" Value="Please enter valid service name port or uncheck 'Install Service' checkbox">
- <![CDATA[InstallService AND NOT SERVICENAME AND NOT WarningText]]>
- </Publish>
- <Publish Event="DoAction" Value="CheckDatabaseProperties">NOT WarningText</Publish>
- <Publish Event="SpawnDialog" Value="WarningDlg">WarningText</Publish>
- <Publish Event="NewDialog" Value="Feedback">Not WarningText</Publish>
- </Control>
- <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="no" Text="Cancel">
- <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
- </Control>
- <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
- <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
- <Text>[ProductName] database configuration</Text>
- </Control>
- <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="2" />
- <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
- <Text>{\WixUI_Font_Title}Default instance properties</Text>
- </Control>
- <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="2" />
- </Dialog>
- </UI>
-
- <Property Id="CRLF" Value="&#xD;&#xA;" />
- <CustomAction Id="CheckDataDirectoryEmpty" BinaryKey="wixca.dll" DllEntry="CheckDataDirectoryEmpty" Execute="immediate" Impersonate="yes"/>
- <!-- What to do when navigation buttons are clicked -->
- <UI Id="MyWixUI_Mondo">
- <UIRef Id="WixUI_FeatureTree" />
- <UIRef Id="WixUI_ErrorProgressText" />
- <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="999">
- OLDERVERSIONBEINGUPGRADED
- </Publish>
- <Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="NewOrUpgradeInstanceDlg" Order="999">
- NOT Installed AND UpgradableServiceFound
- </Publish>
-
- <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="Feedback" Order="3" ><![CDATA[&DBInstance=3 AND NOT !DBInstance=3]]></Publish>
- <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="3"> <![CDATA[OLDERVERSIONBEINGUPGRADED <>""]]></Publish>
- <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="ConfirmDataCleanupDlg" Order="1" ><![CDATA[(&DBInstance=2) AND (!DBInstance=3)]]></Publish>
-
-
- <Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="NewOrUpgradeInstanceDlg" Order="999">
- NOT Installed AND UpgradableServiceFound
- </Publish>
- <Publish Dialog="CustomizeDlg" Control="Next" Event="DoAction" Value="CheckDataDirectoryEmpty" Order="1"><![CDATA[&DBInstance=3 AND NOT !DBInstance=3]]></Publish>
- <Publish Dialog="CustomizeDlg" Property="DATADIRNOTEMPTY" Control="Next" Order="1"><![CDATA[NOT(&DBInstance=3 AND NOT !DBInstance=3)]]></Publish>
- <Publish Dialog="CustomizeDlg" Control="Next" Property="WarningText" Order="2"
- Value="Selected data directory [DATADIR] is not empty. Either clean it, or choose another location for 'Database Instance' feature.">
- DATADIRNOTEMPTY
- </Publish>
- <Publish Dialog="CustomizeDlg" Control="Next" Event="SpawnDialog" Value="WarningDlg" Order="3">WarningText</Publish>
- <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="ConfirmDataCleanupDlg" Order="4">
- <![CDATA[(&DBInstance=2) AND (!DBInstance=3)]]>
- </Publish>
- <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="UserSettingsDlg" Order="5">
- <![CDATA[&DBInstance=3 AND NOT !DBInstance=3 AND NOT WarningText]]>
- </Publish>
-
- <Publish Dialog="ConfirmDataCleanupDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg">WixUI_InstallMode = "Change"</Publish>
- <Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="ConfirmDataCleanupDlg" Order="999">
- !DBInstance=3 AND (CLEANUPDATA Or USECONFIRMDATACLEANUPDLG)
- </Publish>
- <Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Property="USECONFIRMDATACLEANUPDLG" Value="1" Order="999">
- !DBInstance=3 AND CLEANUPDATA
- </Publish>
- <Publish Dialog="ConfirmDataCleanupDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg">WixUI_InstallMode = "Remove"</Publish>
- </UI>
-
- <!-- End of UI section -->
-
- <!-- Extra folders we need (DATADIR and shortcut folder) -->
- <DirectoryRef Id='INSTALLDIR'>
- <Directory Id="DATADIR" Name="data">
- </Directory>
- <Directory Id="ProgramMenuFolder">
- <Directory Id="ShortcutFolder" Name="@CPACK_WIX_PACKAGE_NAME@">
- </Directory>
- </Directory>
- </DirectoryRef>
-
-
- <!-- Extra feature (database instance). This could be split to several subfeatures if desired (e.g firewall exception)-->
- <Feature Id='DBInstance'
- Title='Database instance'
- Description=
- 'Install database instance. Only new database can be installed with this feature.'
- ConfigurableDirectory='DATADIR'
- AllowAdvertise='no'
- Level='1'>
-
- <!-- Data directory with some reasonable security settings -->
- <Component Id="C.datadir" Guid="*" Directory="DATADIR">
- <RegistryValue Root='HKLM'
- Key='SOFTWARE\@MANUFACTURER@\@CPACK_WIX_PACKAGE_NAME@'
- Name='DATADIR' Value='[DATADIR]' Type='string' KeyPath='yes'/>
- <CreateFolder>
- <util:PermissionEx User="[LogonUser]" GenericAll="yes" />
- <util:PermissionEx User="NetworkService" GenericAll="yes" />
- </CreateFolder>
- </Component>
-
- <!-- Database service conditioned on SERVICENAME property-->
- <Component Id="C.service" Guid="*" Directory="DATADIR">
- <Condition>SERVICENAME</Condition>
- <RegistryValue Root='HKLM'
- Key='SOFTWARE\@MANUFACTURER@\@CPACK_WIX_PACKAGE_NAME@'
- Name='SERVICENAME' Value='[SERVICENAME]' Type='string' KeyPath='yes'/>
- <ServiceControl Id='DBInstanceServiceStop' Name='[SERVICENAME]' Stop='both' Remove='uninstall' Wait='yes'/>
- <ServiceControl Id='DBInstanceServiceStart' Name='[SERVICENAME]' Start='install' Wait='yes'/>
- </Component>
- <?if $(var.HaveInnodb) = "1" ?>
- <Component Id="C.myiniconfig" Guid="*" Directory="DATADIR">
- <Condition>STDCONFIG</Condition>
- <RegistryValue Root='HKLM'
- Key='SOFTWARE\@MANUFACTURER@\@CPACK_WIX_PACKAGE_NAME@'
- Name='STDCONFIG' Value='1' Type='string' KeyPath='yes'/>
- <IniFile Id="Ini1"
- Action="createLine"
- Directory="DATADIR"
- Section="mysqld"
- Name="my.ini"
- Key="sql_mode"
- Value="&quot;STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION&quot;" />
- <IniFile Id="Ini2"
- Action="createLine"
- Directory="DATADIR"
- Section="mysqld"
- Name="my.ini"
- Key="default_storage_engine"
- Value="innodb" />
- <IniFile Id="Ini3"
- Action="createLine"
- Directory="DATADIR"
- Section="mysqld"
- Name="my.ini"
- Key="innodb_buffer_pool_size"
- Value="[BUFFERPOOLSIZE]M" />
- <IniFile Id="Ini4"
- Action="createLine"
- Directory="DATADIR"
- Section="mysqld"
- Name="my.ini"
- Key="innodb_log_file_size"
- Value="[LOGFILESIZE]M" />
- </Component>
- <?endif?>
-
- <Component Id="C.feedback" Guid="*" Directory="DATADIR">
- <Condition>FEEDBACK</Condition>
- <RegistryValue Root='HKLM'
- Key='SOFTWARE\@MANUFACTURER@\@CPACK_WIX_PACKAGE_NAME@'
- Name='FEEDBACK' Value='1' Type='string' KeyPath='yes'/>
- <IniFile Id="Ini5"
- Action="createLine"
- Directory="DATADIR"
- Section="mysqld"
- Name="my.ini"
- Key="feedback"
- Value="ON" />
- </Component>
-
- <Component Id="C.utf8" Guid="*" Directory="DATADIR">
- <Condition>UTF8</Condition>
- <RegistryValue Root='HKLM'
- Key='SOFTWARE\@MANUFACTURER@\@CPACK_WIX_PACKAGE_NAME@'
- Name='UTF8' Value='1' Type='string' KeyPath='yes'/>
- <IniFile Id="Ini6"
- Action="createLine"
- Directory="DATADIR"
- Section="mysqld"
- Name="my.ini"
- Key="character-set-server"
- Value="utf8" />
- </Component>
-
- <!--- Grant service account permission to the database folder (Windows 7 and later) -->
- <Component Id="C.serviceaccount.permission" Guid="*" Directory='DATADIR' Transitive='yes'>
- <Condition><![CDATA[SERVICENAME AND (VersionNT > 600)]]></Condition>
- <RegistryValue Root='HKLM'
- Key='SOFTWARE\@MANUFACTURER@\@CPACK_WIX_PACKAGE_NAME@'
- Name='servicepermission' Value='1' Type='string' KeyPath='yes'/>
- <CreateFolder>
- <util:PermissionEx User="NT SERVICE\[SERVICENAME]" GenericAll="yes" />
- </CreateFolder>
- </Component>
-
- <!-- Shortcuts in program menu (mysql client etc) -->
- <Component Id="c.shortcuts" Guid="*" Directory="ShortcutFolder">
- <!-- shortcut to my.ini-->
- <RegistryValue Root="HKCU" Key="Software\@CPACK_WIX_PACKAGE_NAME@\Uninstall" Name="shortcuts" Value="1" Type="string" KeyPath="yes" />
- <RemoveFolder Id="RemoveShorcutFolder" On="uninstall" />
- <Shortcut Id="shortcut.my.ini"
- Name="my.ini (@CPACK_WIX_PACKAGE_NAME@)"
- Target="[System64Folder]notepad.exe"
- Arguments="&quot;[DATADIR]my.ini&quot;"
- Directory="ShortcutFolder"
- Description="Edit database configuration" />
- <Shortcut Id="shortcut.errorlog"
- Name="Error log (@CPACK_WIX_PACKAGE_NAME@)"
- Target="[System64Folder]notepad.exe"
- Arguments="&quot;[DATADIR][ComputerName].err&quot;"
- Directory="ShortcutFolder"
- Description="View Database Error log" />
- <Shortcut Id="shortcut.dbfolder" Name="Database directory (@CPACK_WIX_PACKAGE_NAME@)"
- Target="[DATADIR]" />
- </Component>
-
- <!-- add reference so mysql client won't get uninstalled and we have a shortcut pointing to nowhere-->
- <ComponentRef Id="C.bin.mysql.exe"/>
-
- <Component Id="c.shortcuts.commandline" Guid="*" Directory="ShortcutFolder">
- <RegistryValue
- Root="HKCU" Key="Software\@CPACK_WIX_PACKAGE_NAME@\Uninstall"
- Name="shortcuts.commandline"
- Value="1" Type="string" KeyPath="yes" />
- <!-- shortcut to client-->
- <Shortcut Id="shortcut.mysql.exe"
- Name="MySQL Client (@CPACK_WIX_PACKAGE_NAME@)"
- Target="[System64Folder]cmd.exe"
- Arguments="/k &quot; &quot;[D.bin]mysql.exe&quot; &quot;--defaults-file=[DATADIR]my.ini&quot; -uroot -p&quot;"
- Directory="ShortcutFolder"
- WorkingDirectory="D.bin"
- Description="Starts mysql.exe for root user" />
- </Component>
- <Component Id="c.shortcuts.commandprompt.db" Guid="*" Directory="ShortcutFolder" Transitive="yes">
- <Condition>SERVICENAME</Condition>
- <RegistryValue
- Root="HKCU" Key="Software\@CPACK_WIX_PACKAGE_NAME@\Uninstall"
- Name="shortcuts.commandprompt.db"
- Value="1" Type="string" KeyPath="yes" />
- <!-- just command prompt in the bin directory (so all utilities can be called) -->
- <Shortcut Id="shortcut.commandprompt.exe.db"
- Name="Command Prompt (@CPACK_WIX_PACKAGE_NAME@)"
- Target="[System64Folder]cmd.exe"
- Directory="ShortcutFolder"
- Arguments="/k &quot;set MYSQL_HOME=[DATADIR]&amp;&amp; set PATH=[D.bin];%PATH%;&amp;&amp;echo Setting environment for [ProductName] &quot;"
- Description="Opens command line in the installation bin directory" />
- </Component>
-
-
- </Feature>
-
- <Feature Id="SharedClientServerComponents"
- Title='Utilities used by both server and client.'
- Description=
- 'Client utilities that are also used with server.Required for upgrade.'
- ConfigurableDirectory='INSTALLDIR'
- AllowAdvertise='no'
- Level='1'
- Display='hidden'>
- <ComponentRef Id='C.bin.mysql.exe'/>
- <ComponentRef Id='C.bin.mysqladmin.exe'/>
- <ComponentRef Id='C.bin.mysql_upgrade.exe'/>
- <ComponentRef Id='C.bin.mysqlcheck.exe'/>
- <Component Id="c.shortcuts.commandprompt.nodb" Guid="*" Directory="ShortcutFolder" Transitive="yes">
- <Condition>NOT SERVICENAME</Condition>
- <RegistryValue
- Root="HKCU" Key="Software\@CPACK_WIX_PACKAGE_NAME@\Uninstall"
- Name="shortcuts.commandprompt.nodb"
- Value="1" Type="string" KeyPath="yes" />
- <!-- just command prompt in the bin directory (so all utilities can be called) -->
- <Shortcut Id="shortcut.commandprompt.exe.nodb"
- Name="Command Prompt (@CPACK_WIX_PACKAGE_NAME@)"
- Target="[System64Folder]cmd.exe"
- Directory="ShortcutFolder"
- Arguments="/k &quot;set PATH=[D.bin];%PATH%;&amp;&amp;echo Setting environment for [ProductName] &quot;"
- Description="Opens command line in the installation bin directory" />
- </Component>
- <?if $(var.HaveUpgradeWizard) != "0" ?>
- <ComponentRef Id='C.bin.mysql_upgrade_wizard.exe'/>
- <!--
- <Component Id="c.shortcuts.upgrade_wizard" Guid="*" Directory="ShortcutFolder" Transitive="yes">
- <RegistryValue
- Root="HKCU" Key="Software\@CPACK_WIX_PACKAGE_NAME@\Uninstall"
- Name="shortcuts.upgrade_wizard"
- Value="1" Type="string" KeyPath="yes" />
- <Shortcut Id="shortcut.upgrade_wizard"
- Name="Upgrade Wizard (@CPACK_WIX_PACKAGE_NAME@)"
- Target="[INSTALLDIR]bin\mysql_upgrade_wizard.exe"
- Directory="ShortcutFolder"
- Description="Upgrades older instances of MariaDB/MySQL services to version @MAJOR_VERSION@.@MINOR_VERSION@"
- Advertise="no"/>
- </Component>
- -->
- <?endif?>
- </Feature>
-
- <!-- Optional 3rd party tools -->
- <DirectoryRef Id='TARGETDIR'>
- <Directory Id='CommonFilesFolder'>
- <Directory Id='MariaDBShared' Name='MariaDBShared'/>
- </Directory>
- <Directory Id='DesktopFolder'/>
- </DirectoryRef>
-
-
- <?if "@WITH_THIRD_PARTY@" != "" ?>
-
- <!-- Include definition of 3party components -->
- <?foreach tool in @WITH_THIRD_PARTY@ ?>
- <?include "${CMAKE_CURRENT_BINARY_DIR}\$(var.tool).wxi" ?>
- <?endforeach ?>
-
- <Feature Id="ThirdPartyTools"
- Title='Third party tools'
- Description= 'Third party tools'
- AllowAdvertise='no'
- Level='1'
- Display='expand'>
- @THIRD_PARTY_FEATURE_CONDITION@
- <!-- Include definition of 3rd party features -->
- <?foreach tool in @WITH_THIRD_PARTY@ ?>
- <?include "${CMAKE_CURRENT_BINARY_DIR}\$(var.tool)_feature.wxi" ?>
- <?endforeach ?>
-
- </Feature>
-
- <?endif ?>
-
- <!-- Custom action, call mysql_install_db -->
- <SetProperty Sequence='execute' Before='CreateDatabaseCommand' Id="SKIPNETWORKING" Value="--skip-networking" >SKIPNETWORKING</SetProperty>
- <SetProperty Sequence='execute' Before='CreateDatabaseCommand' Id="ALLOWREMOTEROOTACCESS" Value="--allow-remote-root-access">ALLOWREMOTEROOTACCESS</SetProperty>
- <SetProperty Sequence='execute' Before='CreateDatabaseCommand' Id="DEFAULTUSER" Value="--default-user">DEFAULTUSER</SetProperty>
- <CustomAction Id='CheckDatabaseProperties' BinaryKey='wixca.dll' DllEntry='CheckDatabaseProperties' />
- <CustomAction Id='PresetDatabaseProperties' BinaryKey='wixca.dll' DllEntry='PresetDatabaseProperties' />
- <CustomAction Id="CreateDatabaseCommand" Property="CreateDatabase"
- Value=
- "&quot;[#F.bin.mysql_install_db.exe]&quot; &quot;--service=[SERVICENAME]&quot; --port=[PORT] &quot;--password=[ESCAPEDPASSWORD]&quot; &quot;--datadir=[DATADIR]\&quot; [SKIPNETWORKING] [ALLOWREMOTEROOTACCESS] [DEFAULTUSER] --verbose-bootstrap"
- Execute="immediate"
- HideTarget="yes"
- />
- <CustomAction Id="CreateDatabaseRollbackCommand" Property="CreateDatabaseRollback"
- Value="[SERVICENAME]\[DATADIR]"
- Execute="immediate"/>
- <CustomAction Id="CreateDatabase" BinaryKey="WixCA" DllEntry="CAQuietExec"
- Execute="deferred" Return="check" Impersonate="no" />
- <CustomAction Id="CreateDatabaseRollback" BinaryKey="wixca.dll" DllEntry="CreateDatabaseRollback"
- Execute="rollback" Return="check" Impersonate="no"/>
- <UI>
- <ProgressText Action="CreateDatabase">Running mysql_install_db.exe</ProgressText>
- </UI>
-
- <!-- Error injection script activated by TEST_FAIL=1 passed to msiexec (to see how good custom action rollback works) -->
- <Property Id="FailureProgram">
- <![CDATA[
- Function Main()
- Main = 3
- End Function
- ]]>
- </Property>
- <CustomAction Id="FakeFailure"
- VBScriptCall="Main"
- Property="FailureProgram"
- Execute="deferred" />
-
- <CustomAction Id='ErrorDataDirNotEmpty'
- Error='Chosen data directory [DATADIR] is not empty. It must be empty prior to installation.'/>
- <InstallExecuteSequence>
- <Custom Action="CheckDataDirectoryEmpty" After="CostFinalize">
- <![CDATA[&DBInstance=3 AND NOT !DBInstance=3 AND OLDERVERSIONBEINGUPGRADED=""]]>
- </Custom>
- <Custom Action="ErrorDataDirNotEmpty" After="CheckDataDirectoryEmpty" >DATADIRNOTEMPTY</Custom>
- <Custom Action="CheckDatabaseProperties" Before="CreateDatabaseCommand">SERVICENAME</Custom>
- <Custom Action="CreateDatabaseCommand" After="CostFinalize" >
- <![CDATA[&DBInstance=3 AND NOT !DBInstance=3 AND OLDERVERSIONBEINGUPGRADED=""]]>
- </Custom>
- <Custom Action="CreateDatabase" After="InstallFiles">
- <![CDATA[&DBInstance=3 AND NOT !DBInstance=3 AND OLDERVERSIONBEINGUPGRADED=""]]>
- </Custom>
- <Custom Action="CreateDatabaseRollbackCommand" After="CostFinalize">
- <![CDATA[&DBInstance=3 AND NOT !DBInstance=3 AND OLDERVERSIONBEINGUPGRADED=""]]>
- </Custom>
- <Custom Action="CreateDatabaseRollback" Before="CreateDatabase">
- <![CDATA[&DBInstance=3 AND NOT !DBInstance=3 AND OLDERVERSIONBEINGUPGRADED=""]]>
- </Custom>
- <Custom Action='FakeFailure' Before='InstallFinalize'>
- <![CDATA[&DBInstance=3 AND NOT !DBInstance=3 AND OLDERVERSIONBEINGUPGRADED="" AND TESTFAIL]]>
- </Custom>
- </InstallExecuteSequence>
-
-
- <!-- Custom action to remove data on uninstall -->
- <Binary Id='wixca.dll' SourceFile='@WIXCA_LOCATION@' />
- <CustomAction Id="RemoveDataDirectory.SetProperty" Return="check"
- Property="RemoveDataDirectory" Value="[DATADIR]" />
- <CustomAction Id="RemoveDataDirectory" BinaryKey="wixca.dll"
- DllEntry="RemoveDataDirectory"
- Execute="deferred"
- Impersonate="no"
- Return="ignore" />
- <InstallExecuteSequence>
- <Custom Action="RemoveDataDirectory.SetProperty" After="CreateDatabaseCommand" >
- <![CDATA[($C.datadir=2) AND (CLEANUPDATA) AND NOT UPGRADINGPRODUCTCODE]]>
- </Custom>
- <Custom Action="RemoveDataDirectory" Before="RemoveFiles">
- <![CDATA[($C.datadir=2) AND (CLEANUPDATA) AND NOT UPGRADINGPRODUCTCODE]]>
- </Custom>
- </InstallExecuteSequence>
-
- <InstallExecuteSequence>
- <StopServices>SERVICENAME</StopServices>
- <DeleteServices>SERVICENAME</DeleteServices>
- </InstallExecuteSequence>
- <CustomAction Id="CheckDBInUse" Return="ignore"
- BinaryKey="wixca.dll" DllEntry="CheckDBInUse" Execute="firstSequence"/>
- <InstallExecuteSequence>
- <Custom Action="CheckDBInUse" Before="LaunchConditions">Installed</Custom>
- <Custom Action="PresetDatabaseProperties" After="CheckDBInUse"></Custom>
- </InstallExecuteSequence>
- <InstallUISequence>
- <Custom Action="CheckDBInUse" Before="LaunchConditions">Installed</Custom>
- <Custom Action="PresetDatabaseProperties" After="CheckDBInUse"></Custom>
- </InstallUISequence>
-
- <!-- Store some properties persistently in registry, mainly for upgrades -->
-
- <Feature Id='StoreInstallLocation' Level='1' Absent='disallow' Display='hidden'>
- <Component Directory='INSTALLDIR' Guid='*' Id='C.storeinstalllocation'>
- <RegistryValue Root='HKLM' Key='SOFTWARE\@MANUFACTURER@\@CPACK_WIX_PACKAGE_NAME@'
- Name='INSTALLDIR' Value='[INSTALLDIR]' Type='string' KeyPath='yes'/>
- </Component>
- </Feature>
-
- <?foreach STOREDVAR in SERVICENAME;DATADIR;INSTALLDIR?>
-
- <Property Id='$(var.STOREDVAR)' Secure='yes'>
- <RegistrySearch Id='$(var.STOREDVAR)Property' Root='HKLM'
- Key='SOFTWARE\@MANUFACTURER@\@CPACK_WIX_PACKAGE_NAME@'
- Name='$(var.STOREDVAR)' Type='raw' />
- </Property>
- <CustomAction Id='SaveCmdLineValue_$(var.STOREDVAR)' Property='CMDLINE_$(var.STOREDVAR)'
- Value='[$(var.STOREDVAR)]' Execute='firstSequence' />
- <CustomAction Id='SetFromCmdLineValue_$(var.STOREDVAR)' Property='$(var.STOREDVAR)'
- Value='[CMDLINE_$(var.STOREDVAR)]' Execute='firstSequence' />
- <InstallUISequence>
- <Custom Action='SaveCmdLineValue_$(var.STOREDVAR)' Before='AppSearch' />
- <Custom Action='SetFromCmdLineValue_$(var.STOREDVAR)' After='AppSearch'>CMDLINE_$(var.STOREDVAR)</Custom>
- </InstallUISequence>
- <InstallExecuteSequence>
- <Custom Action='SaveCmdLineValue_$(var.STOREDVAR)' Before='AppSearch' />
- <Custom Action='SetFromCmdLineValue_$(var.STOREDVAR)' After='AppSearch'>CMDLINE_$(var.STOREDVAR)</Custom>
- </InstallExecuteSequence>
-
- <?endforeach?>
-
- <!--
- Optionally, start upgrade wizard on exit.
- -->
-
-
-
- <?if $(var.HaveUpgradeWizard) != "0" ?>
- <UI>
- <Publish Dialog="ExitDialog"
- Control="Finish"
- Event="DoAction"
- Value="LaunchApplication">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
- </UI>
- <Property
- Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT"
- Value="Launch wizard to upgrade existing MariaDB or MySQL services." />
- <Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Value="0"/>
- <Property Id="WixShellExecTarget" Value="[#F.bin.mysql_upgrade_wizard.exe]" />
- <CustomAction Id="LaunchApplication"
- BinaryKey="WixCA"
- DllEntry="WixShellExec"
- Impersonate="yes" />
- <CustomAction
- Id="CheckServiceUpgrades" Return="ignore" BinaryKey="wixca.dll"
- DllEntry="CheckServiceUpgrades"
- Execute="immediate" />
- <InstallUISequence>
- <Custom Action="CheckServiceUpgrades" After="CostFinalize">
- $C.bin.mysql_upgrade_wizard.exe = 3 AND NOT Installed AND NOT OLDERVERSIONBEINGUPGRADED
- </Custom>
- </InstallUISequence>
- <SetProperty Before="ExecuteAction" Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT"
- Sequence="ui" Value="[NonExistentProperty]">
- <![CDATA[($C.bin.mysql_upgrade_wizard.exe <> 3) AND NOT Installed OR OLDERVERSIONBEINGUPGRADED]]>
- </SetProperty>
- <SetProperty Before="ExecuteAction" Id="WIXUI_EXITDIALOGOPTIONALCHECKBOX"
- Sequence="ui" Value="[NonExistentProperty]">
- <![CDATA[($C.bin.mysql_upgrade_wizard.exe <> 3) AND NOT Installed OR OLDERVERSIONBEINGUPGRADED]]>
- </SetProperty>
-
- <?endif ?> <!-- HaveUpgradeWizard -->
-
- <!--
- Author the registry entries for "add or remove programs"
- We choose to define ARPSYSTEMCOMPONENT to 1 because we want to show
- "do you want to remove data directory" on uninstall
- -->
- <Property Id="ARPSYSTEMCOMPONENT" Value="1" Secure="yes" />
- <Property Id="ARPINSTALLLOCATION" Secure="yes"/>
- <SetProperty Id="ARPINSTALLLOCATION" Value="[INSTALLDIR]" After="InstallValidate" Sequence="execute"/>
- <Feature Id='ARPRegistryEntries'
- Title='Add or remove program entries'
- Description='Add or remove program entries'
- AllowAdvertise='no'
- Absent='disallow' Display='hidden'
- Level='1'>
- <Component Id="C.arp_entries" Guid="*" Directory="INSTALLDIR">
- <RemoveFolder Id="RemoveINSTALLDIR" On="uninstall"/>
- <RegistryValue Root='HKLM'
- Key='Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_WIX_PACKAGE_NAME@'
- Name='DisplayName' Value='[ProductName]' Type='string' KeyPath='yes'/>
- <RegistryValue Root='HKLM'
- Key='Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_WIX_PACKAGE_NAME@'
- Name='Publisher' Value='@MANUFACTURER@' Type='string'/>
- <RegistryValue Root='HKLM'
- Key='Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_WIX_PACKAGE_NAME@'
- Name='DisplayVersion' Value='[ProductVersion]' Type='string'/>
- <RegistryValue Root='HKLM'
- Key='Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_WIX_PACKAGE_NAME@'
- Name='InstallLocation' Value='[INSTALLDIR]' Type='string'/>
- <RegistryValue Root='HKLM'
- Key='Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_WIX_PACKAGE_NAME@'
- Name='UninstallString' Value='msiexec.exe /I [ProductCode]' Type='string'/>
- <RegistryValue Root='HKLM'
- Key='Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_WIX_PACKAGE_NAME@'
- Name='MajorVersion' Value='@MAJOR_VERSION@' Type='string'/>
- <RegistryValue Root='HKLM'
- Key='Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_WIX_PACKAGE_NAME@'
- Name='MinorVersion' Value='@MINOR_VERSION@' Type='string'/>
- </Component>
- </Feature>
-
- <!-- Extra condition to block the installer if NSIS based installation is detected-->
- <Property Id="NSISINSTALLKEY">
- <RegistrySearch Id='NSISKey' Type='raw'
- Root='HKLM' Key='Software\Microsoft\Windows\CurrentVersion\Uninstall\MariaDB' Name='DisplayName' />
- </Property>
- <Condition
- Message=
- 'Previous version of MariaDB was found, that used incompatible installer.&#xD;&#xA;Please remove &quot;[NSISINSTALLKEY]&quot; before you proceed with this installation.'
- >
- <![CDATA[ NOT(NSISINSTALLKEY << "MariaDB @MAJOR_VERSION@.@MINOR_VERSION@.") OR Installed]]>
- </Condition>
- <Condition Message=
- 'Setting the ALLUSERS property is not allowed because [ProductName] is a per-machine application. Setup will now exit.'>
- <![CDATA[ALLUSERS = "1"]]>
- </Condition>
- </Fragment>
-</Wix>
+<?xml version="1.0" encoding="utf-8"?>
+<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
+ <Fragment>
+ <!--
+ Check, if upgrade wizard was built
+ It currently requires MFC, which is not in SDK
+ neither in express edítions of VS.
+ -->
+ <?ifndef HaveUpgradeWizard ?>
+ <?define HaveUpgradeWizard="1"?>
+ <?endif?>
+
+ <!-- If Innodb is compiled in, enable "optimize for transactions" checkbox -->
+ <?ifndef HaveInnodb ?>
+ <?define HaveInnodb="0"?>
+ <?endif?>
+
+ <Property Id="PortTemplate" Value="#####" />
+ <?if $(var.HaveInnodb) = "1" ?>
+ <Property Id="BufferPoolSizeTemplate" Value="#######" />
+ <?endif?>
+ <!--
+ Installation parameters that can be passed via msiexec command line
+ For "booleans" (like skip networking), just providing any value means property set to "yes".
+ -->
+ <!-- instalation directory (default under program files)-->
+ <!--- (defined elsewhere) <Property Id="INSTALLDIR" Secure="yes" /> -->
+
+ <!-- Database data directory (default under INSTALLDIR\data) -->
+ <!--- (defined elsewhere) <Property Id="DATADIR" Secure="yes"/> -->
+
+ <!-- Service name of database instanced (default MySQL in GUI, nothing with command line) -->
+ <!-- (defined elsewhere) <Property Id="SERVICENAME" Secure="yes" /> -->
+
+ <!-- Root password -->
+ <Property Id="PASSWORD" Hidden="yes" Secure="yes" />
+ <Property Id="ESCAPEDPASSWORD" Hidden="yes" Secure="yes" />
+ <!-- Database port -->
+ <Property Id="PORT" Value="3306" Secure="yes"/>
+ <!-- Whether to allow remote access for root user -->
+ <Property Id="ALLOWREMOTEROOTACCESS" Secure="yes" />
+ <!-- Skip networking. This will switch configuration to use named pipe-->
+ <Property Id="SKIPNETWORKING" Secure="yes"/>
+ <!-- Whether to keep default (unauthenticated) user. Default is no-->
+ <Property Id="DEFAULTUSER" Secure="yes"/>
+ <!-- Set server character set to UTF8 -->
+ <Property Id="UTF8" Secure="yes"/>
+ <!-- Whether to data on uninstall (default yes, after asking user consent) -->
+ <Property Id="CLEANUPDATA" Secure="yes" Value="1"/>
+ <!-- Force per machine installation -->
+ <Property Id="ALLUSERS" Secure="yes" Value="1"/>
+ <!-- Disable advertised shortcuts weirdness -->
+ <Property Id="DISABLEADVTSHORTCUTS" Secure="yes" Value="1"/>
+
+ <!-- Activate feedback plugin-->
+ <Property Id="FEEDBACK" Secure="yes"/>
+
+ <?if $(var.HaveInnodb) = "1" ?>
+ <!-- Quick configuration : set default storage engine to innodb, use strict sql_mode -->
+ <Property Id="STDCONFIG" Secure="yes" Value="1"/>
+ <?endif?>
+ <!-- Innodb Buffer pool size in MB-->
+ <Property Id="BUFFERPOOLSIZE" Secure="yes"/>
+
+
+ <CustomAction Id="LaunchUrl" BinaryKey="WixCA" DllEntry="WixShellExec" Execute="immediate" Return="check" Impersonate="yes" />
+
+
+ <!--
+ User interface dialogs
+ -->
+ <WixVariable Id='WixUIBannerBmp' Value='@CMAKE_CURRENT_SOURCE_DIR@\WixUIBannerBmp.jpg' />
+ <WixVariable Id='WixUIDialogBmp' Value='@CMAKE_CURRENT_SOURCE_DIR@\WixUIDialogBmp.jpg' />
+ <UI>
+
+ <!-- Dialog on uninstall of the database -->
+ <Dialog Id="ConfirmDataCleanupDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
+
+ <!--<Control Id="CleanupDataCheckBox" Type="CheckBox" X="20" Y="100" Height="30" Property="CLEANUPDATA" Width="300" CheckBoxValue="1"
+ Text="{\Font1}Remove default database directory &#xD;&#xA;'[DATADIR]'"/>
+ -->
+ <Control Id="RemoveDatadirButton" Type="PushButton" X="40" Y="65" Width="80" Height="18"
+ Text="Remove data">
+ <Publish Property="CLEANUPDATA" Value="1">1</Publish>
+ <Publish Event="NewDialog" Value="VerifyReadyDlg">WixUI_InstallMode</Publish>
+ <Publish Event="EndDialog" Value="Return">NOT WixUI_InstallMode</Publish>
+
+ </Control>
+ <Control Id="RemoveDatadirText" Type="Text" X="60" Y="85" Width="280" Height="20">
+ <Text>Remove default database directory [DATADIR]. Ensures proper cleanup on uninstall.</Text>
+ </Control>
+
+ <Control Id="KeepDatadirButton" Type="PushButton" X="40" Y="118" Width="80" Height="18"
+ Text="Keep data">
+ <Publish Property="CLEANUPDATA">1</Publish>
+ <Publish Event="NewDialog" Value="VerifyReadyDlg">WixUI_InstallMode</Publish>
+ <Publish Event="EndDialog" Value="Return">NOT WixUI_InstallMode</Publish>
+ </Control>
+ <Control Id="KeepDataDirText" Type="Text" X="60" Y="138" Width="280" Height="70" >
+ <Text>Do not remove [DATADIR]. Choose this option if you intend to use data in the future</Text>
+ </Control>
+
+
+ <!-- Navigation buttons-->
+ <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&amp;Back">
+ <Publish Event="NewDialog" Value="CustomizeDlg">WixUI_InstallMode="Change"</Publish>
+ <Condition Action="disable">NOT WixUI_InstallMode</Condition>
+ </Control>
+ <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Disabled="yes" Text="&amp;Next">
+ <Publish Event="NewDialog" Value="VerifyReadyDlg">WixUI_InstallMode</Publish>
+ <Publish Event="EndDialog" Value="Return">NOT WixUI_InstallMode</Publish>
+ </Control>
+ <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
+ <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
+ </Control>
+ <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
+ <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
+ <Text>Remove default [ProductName] database</Text>
+ </Control>
+ <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
+ <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
+ <Text>{\WixUI_Font_Title}Default instance properties</Text>
+ </Control>
+ <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
+ </Dialog>
+
+ <!-- Dialog new or upgrade instance -->
+
+ <Property Id="CreateOrUpgradeChoice" Value="Create"/>
+
+ <Dialog Id="NewOrUpgradeInstanceDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
+ <Control Id="Text" Type="Text" X="40" Y="65" Width="270" Height="30">
+ <Text>Setup found existing database instances that can be upgraded to [ProductName].You can create a new instance and/or upgrade existing one.
+ </Text>
+ </Control>
+
+ <Control Id="CreateOrUpgradeButton"
+ Type="RadioButtonGroup" X="40" Y="100" Width="300" Height="70"
+ Property="CreateOrUpgradeChoice" Text="Specify what to do">
+ <RadioButtonGroup Property="CreateOrUpgradeChoice">
+ <RadioButton Value="Create" X="0" Y="0" Width="300" Height="25"
+ Text="{\Font1}Create new database instance."/>
+ <RadioButton Value="Upgrade" X="0" Y="30" Width="300" Height="25"
+ Text="{\Font1}Do not create a new database. Optionally upgrade existing instances." />
+ </RadioButtonGroup>
+ </Control>
+
+ <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&amp;Back">
+ <Publish Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
+ </Control>
+ <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Text="&amp;Next">
+ <Publish Event="Remove" Value="DBInstance">CreateOrUpgradeChoice = "Upgrade" </Publish>
+ <Publish Event="AddLocal" Value="DBInstance">CreateOrUpgradeChoice = "Create"</Publish>
+ <Publish Property="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Value="[NonExistentProperty]">CreateOrUpgradeChoice = "Create"</Publish>
+ <Publish Property="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="[NonExistentProperty]">CreateOrUpgradeChoice = "Create"</Publish>
+ <Publish Property="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Value="1">CreateOrUpgradeChoice = "Upgrade"</Publish>
+ <Publish Event="NewDialog" Value="CustomizeDlg">1</Publish>
+ </Control>
+ <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
+ <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
+ </Control>
+ <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
+ <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
+ <Text>Create or upgrade database instance</Text>
+ </Control>
+ <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
+ <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
+ <Text>{\WixUI_Font_Title}[ProductName] setup</Text>
+ </Control>
+ <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
+ </Dialog>
+
+ <!-- Feedback dialog -->
+ <Dialog Id="Feedback" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
+
+ <Control Id="CheckBoxFeedback" Type="CheckBox" X="8" Y="61" Width="360" Height="12" Property="FEEDBACK" CheckBoxValue="1" TabSkip="no">
+ <Text>{\Font1}Enable the Feedback plugin and submit anonymous usage information</Text>
+ </Control>
+
+ <Control Id="Text" Type="Text" X="23" Y="82" Width="290" Height="55">
+ <Text>Monty Program has created a Feedback plugin for MariaDB which, if enabled, collects basic anonymous statistical information. This information is used by the developers to improve MariaDB. Enabling this plugin is an easy way to help with MariaDB development. Collected statistics, and more information on the plugin, can be viewed at http://mariadb.org/feedback_plugin </Text>
+ </Control>
+
+ <Control Id="MoreInfo" Type="PushButton" X="23" Y="140" Width="56" Height="17" Text="More Info" ToolTip="http://mariadb.org/feedback_plugin" >
+ <Publish Property="WixShellExecTarget" Value="http://mariadb.org/feedback_plugin" Order="1">1</Publish>
+ <Publish Event="DoAction" Value="LaunchUrl" Order="2">1</Publish>
+ </Control>
+
+
+ <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&amp;Back">
+ <Publish Event="NewDialog" Value="ServicePortDlg">1</Publish>
+ </Control>
+ <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Text="&amp;Next">
+ <Publish Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
+ </Control>
+ <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
+ <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
+ </Control>
+ <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
+ <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
+ <Text>Submit usage information</Text>
+ </Control>
+ <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
+ <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
+ <Text>{\WixUI_Font_Title}[ProductName] setup</Text>
+ </Control>
+ <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
+ </Dialog>
+
+ <!-- Error popup dialog -->
+ <Dialog Id="WarningDlg" Width="320" Height="85" Title="[ProductName] Setup" NoMinimize="yes">
+ <Control Id="Icon" Type="Icon" X="15" Y="15" Width="24" Height="24"
+ ToolTip="Information icon" FixedSize="yes" IconSize="32" Text="WixUI_Ico_Info" />
+ <Control Id="Ok" Type="PushButton" X="132" Y="57" Width="56" Height="17"
+ Default="yes" Cancel="yes" Text="OK">
+ <Publish Property="WarningText">1</Publish>
+ <Publish Event="EndDialog" Value="Return">1</Publish>
+ </Control>
+ <Control Id="Text" Type="Text" X="48" Y="15" Width="260" Height="30">
+ <Text>[WarningText]</Text>
+ </Control>
+ </Dialog>
+
+
+ <Property Id="ModifyRootPassword" Value="1"/>
+ <TextStyle Id="Font1" FaceName="Tahoma" Size="8" Red="0" Green="0" Blue="0" Bold="yes" />
+
+ <!-- Root password plus default user dialog -->
+ <Dialog Id="UserSettingsDlg" X="50" Y="50" Width="370" Height="270" Title="User settings">
+ <Control Id="EditRootPassword" Type="Edit" X="104" Y="82" Width="91" Height="15" Property="PASSWORD" Password="yes" TabSkip="no">
+ <Text>{100}</Text>
+ <Condition Action="enable">ModifyRootPassword</Condition>
+ <Condition Action="disable">NOT ModifyRootPassword</Condition>
+ </Control>
+ <Control Id="EditRootPasswordConfirm" Type="Edit" X="104" Y="103" Width="91" Height="15" Property="RootPasswordConfirm" Password="yes" TabSkip="no">
+ <Text>{100}</Text>
+ <Condition Action="enable">ModifyRootPassword</Condition>
+ <Condition Action="disable">NOT ModifyRootPassword</Condition>
+ </Control>
+
+ <Control Id="CheckBoxModifyRootPassword" Type="CheckBox" X="8" Y="62" Width="222" Height="18" Property="ModifyRootPassword" CheckBoxValue="1" TabSkip="no">
+ <Text>{\Font1}Modify password for database user 'root'</Text>
+ <Publish Property="PASSWORD" >NOT ModifyRootPassword</Publish>
+ <Publish Property="RootPasswordConfirm">NOT ModifyRootPassword</Publish>
+ <Publish Property="ALLOWREMOTEROOTACCESS">NOT ModifyRootPassword</Publish>
+ <Publish Property="ALLOWREMOTEROOTACCESS" Value="1">ModifyRootPassword</Publish>
+ </Control>
+
+ <Control Id="Text5" Type="Text" X="23" Y="82" Width="77" Height="14" TabSkip="yes">
+ <Text>New root password:</Text>
+ </Control>
+ <Control Id="Text6" Type="Text" X="201" Y="85" Width="100" Height="17" TabSkip="yes">
+ <Text>Enter new root password</Text>
+ </Control>
+ <Control Id="Text8" Type="Text" X="23" Y="105" Width="75" Height="17" TabSkip="yes">
+ <Text>Confirm:</Text>
+ </Control>
+
+ <Control Id="Text10" Type="Text" X="201" Y="104" Width="100" Height="17" TabSkip="yes">
+ <Text>Retype the password</Text>
+ </Control>
+ <Control Id="CheckBoxALLOWREMOTEROOTACCESS" Type="CheckBox" X="23" Y="122" Width="196" Height="18" Property="ALLOWREMOTEROOTACCESS"
+ CheckBoxValue="--allow-remote-root-access" TabSkip="no">
+ <Text>{\Font1}Enable access from remote machines for 'root' user</Text>
+ <Condition Action="enable">ModifyRootPassword</Condition>
+ <Condition Action="disable">NOT ModifyRootPassword</Condition>
+ </Control>
+
+ <Control Id="CheckBoxCreateDefaultUser" Type="CheckBox" X="8" Y="154" Width="200" Height="18" Property="DEFAULTUSER"
+ CheckBoxValue="--default-user" TabSkip="no">
+ <Text>{\Font1}Create An Anonymous Account</Text>
+ </Control>
+ <Control Id="Text14" Type="Text" X="21" Y="174" Width="268" Height="16" TabSkip="yes">
+ <Text>This option will create an anonymous account on this server. </Text>
+ </Control>
+ <Control Id="Text13" Type="Text" X="21" Y="190" Width="254" Height="24" TabSkip="yes">
+ <Text>Please note: this setting can lead to insecure systems.</Text>
+ </Control>
+
+ <Control Id="CheckBoxUTF8" Type="CheckBox" X="8" Y="215" Width="250" Height="18" Property="UTF8" CheckBoxValue="1" TabSkip="no">
+ <Text>{\Font1}Use UTF8 as default server's character set</Text>
+ </Control>
+
+ <!-- Navigation buttons-->
+ <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&amp;Back">
+ <Publish Event="NewDialog" Value="CustomizeDlg">1</Publish>
+ </Control>
+ <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="&amp;Next">
+ <Publish Property="WarningText" Value="Passwords do not match."><![CDATA[PASSWORD <> RootPasswordConfirm]]></Publish>
+ <Publish Event="SpawnDialog" Value="WarningDlg"><![CDATA[WarningText <>""]]></Publish>
+ <Publish Property="SERVICENAME" Value="MySQL">NOT SERVICENAME AND NOT WarningText</Publish>
+ <Publish Event="NewDialog" Value="ServicePortDlg"><![CDATA[WarningText=""]]></Publish>
+ <Condition Action="enable"><![CDATA[NOT ModifyRootPassword OR PASSWORD]]> </Condition>
+ <Condition Action="disable"><![CDATA[ModifyRootPassword AND (NOT PASSWORD)]]> </Condition>
+ </Control>
+ <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
+ <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
+ </Control>
+ <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
+ <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
+ <Text> [ProductName] database configuration</Text>
+ </Control>
+ <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
+ <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
+ <Text>{\WixUI_Font_Title}Default instance properties</Text>
+ </Control>
+ <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
+ </Dialog>
+
+ <Property Id="InstallService" Value="1"/>
+ <Property Id="EnableNetworking" Value="1"/>
+
+ <!-- Service and port configuration -->
+ <Dialog Id="ServicePortDlg" Width="370" Height="270" Title="Database settings">
+ <Control Id="InstallAsService" Type="CheckBox" X="9" Y="61" Width="222" Height="19" Property="InstallService" CheckBoxValue="1" TabSkip="no">
+ <Text>{\Font1}Install as service</Text>
+ </Control>
+ <Control Id="EditServiceName" Type="Edit" X="104" Y="82" Width="91" Height="15" Property="SERVICENAME" TabSkip="no">
+ <Text>{20}</Text>
+ <Condition Action="enable">InstallService</Condition>
+ <Condition Action="disable">Not InstallService</Condition>
+ </Control>
+ <Control Id="Text5" Type="Text" X="25" Y="82" Width="77" Height="14" TabSkip="yes">
+ <Text>Service Name:</Text>
+ </Control>
+ <Control Id="CheckBoxEnableNetworking" Type="CheckBox" Height="18" Width="102" X="9" Y="117" Property="EnableNetworking" CheckBoxValue="1">
+ <Text>{\Font1}Enable networking</Text>
+ <!--<Publish Property="PORT">NOT EnableNetworking</Publish>-->
+ <Publish Property="SKIPNETWORKING" Value="--skip-networking">NOT EnableNetworking</Publish>
+ <Publish Property="SKIPNETWORKING">EnableNetworking</Publish>
+ </Control>
+ <Control Id="LabelTCPPort" Type="Text" Height="17" Width="75" X="25" Y="142" Text="TCP port:" />
+ <Control Id="Port" Type="MaskedEdit" X="104" Y="140" Width="28" Height="15" Property="PORT" Sunken="yes" Text="[PortTemplate]">
+ <Condition Action="enable" >EnableNetworking</Condition>
+ <Condition Action="disable">Not EnableNetworking</Condition>
+ </Control>
+
+ <?if $(var.HaveInnodb) = "1" ?>
+ <Control Id="CheckBoxStandardConfig" Type="CheckBox" Height="18" Width="220" X="9" Y="171" Property="STDCONFIG" CheckBoxValue="1">
+ <Text>{\Font1}Optimize for transactions</Text>
+ </Control>
+
+ <Control Id="StandardConfigExplain" Type="Text" X="25" Y="190" Width="270" Height="14" TabSkip="yes">
+ <Text>(Uses transactional storage engine and "strict" SQL mode)</Text>
+ <Condition Action="enable" >STDCONFIG</Condition>
+ <Condition Action="disable">Not STDCONFIG</Condition>
+ </Control>
+ <Control Id="LabelInnodbBufferpool" Type="Text" Height="17" Width="77" X="25" Y="210" Text="Buffer pool size:" >
+ <Condition Action="enable" >STDCONFIG</Condition>
+ <Condition Action="disable">Not STDCONFIG</Condition>
+ </Control>
+ <Control Id="BPSize" Type="MaskedEdit" X="104" Y="208" Width="40" Height="15" Property="BUFFERPOOLSIZE" Sunken="yes" Text="[BufferPoolSizeTemplate]">
+ <Condition Action="enable" >STDCONFIG</Condition>
+ <Condition Action="disable">Not STDCONFIG</Condition>
+ </Control>
+ <Control Id="LabelMB" Type="Text" Height="17" Width="15" X="150" Y="210" Text="MB" >
+ <Condition Action="enable" >STDCONFIG</Condition>
+ <Condition Action="disable">Not STDCONFIG</Condition>
+ </Control>
+ <?endif?>
+
+ <!-- Navigation buttons-->
+ <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&amp;Back">
+ <Publish Event="NewDialog" Value="UserSettingsDlg">1</Publish>
+ </Control>
+ <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="no" Text="&amp;Next">
+ <Publish Property="SERVICENAME">NOT InstallService</Publish>
+ <Publish Property="WarningText" Value="Please enter valid port or uncheck 'Enable Networking' checkbox">
+ <![CDATA[EnableNetworking AND NOT PORT AND NOT WarningText]]>
+ </Publish>
+ <Publish Property="WarningText" Value="Please enter valid service name port or uncheck 'Install Service' checkbox">
+ <![CDATA[InstallService AND NOT SERVICENAME AND NOT WarningText]]>
+ </Publish>
+ <Publish Event="DoAction" Value="CheckDatabaseProperties">NOT WarningText</Publish>
+ <Publish Event="SpawnDialog" Value="WarningDlg">WarningText</Publish>
+ <Publish Event="NewDialog" Value="Feedback">Not WarningText</Publish>
+ </Control>
+ <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="no" Text="Cancel">
+ <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
+ </Control>
+ <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
+ <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
+ <Text>[ProductName] database configuration</Text>
+ </Control>
+ <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="2" />
+ <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
+ <Text>{\WixUI_Font_Title}Default instance properties</Text>
+ </Control>
+ <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="2" />
+ </Dialog>
+ </UI>
+
+ <Property Id="CRLF" Value="&#xD;&#xA;" />
+ <CustomAction Id="CheckDataDirectoryEmpty" BinaryKey="wixca.dll" DllEntry="CheckDataDirectoryEmpty" Execute="immediate" Impersonate="yes"/>
+ <!-- What to do when navigation buttons are clicked -->
+ <UI Id="MyWixUI_Mondo">
+ <UIRef Id="WixUI_FeatureTree" />
+ <UIRef Id="WixUI_ErrorProgressText" />
+ <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="999">
+ OLDERVERSIONBEINGUPGRADED
+ </Publish>
+ <Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="NewOrUpgradeInstanceDlg" Order="999">
+ NOT Installed AND UpgradableServiceFound
+ </Publish>
+
+ <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="Feedback" Order="3" ><![CDATA[&DBInstance=3 AND NOT !DBInstance=3]]></Publish>
+ <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="3"> <![CDATA[OLDERVERSIONBEINGUPGRADED <>""]]></Publish>
+ <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="ConfirmDataCleanupDlg" Order="1" ><![CDATA[(&DBInstance=2) AND (!DBInstance=3)]]></Publish>
+
+
+ <Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="NewOrUpgradeInstanceDlg" Order="999">
+ NOT Installed AND UpgradableServiceFound
+ </Publish>
+ <Publish Dialog="CustomizeDlg" Control="Next" Event="DoAction" Value="CheckDataDirectoryEmpty" Order="1"><![CDATA[&DBInstance=3 AND NOT !DBInstance=3]]></Publish>
+ <Publish Dialog="CustomizeDlg" Property="DATADIRNOTEMPTY" Control="Next" Order="1"><![CDATA[NOT(&DBInstance=3 AND NOT !DBInstance=3)]]></Publish>
+ <Publish Dialog="CustomizeDlg" Control="Next" Property="WarningText" Order="2"
+ Value="Selected data directory [DATADIR] is not empty. Either clean it, or choose another location for 'Database Instance' feature.">
+ DATADIRNOTEMPTY
+ </Publish>
+ <Publish Dialog="CustomizeDlg" Control="Next" Event="SpawnDialog" Value="WarningDlg" Order="3">WarningText</Publish>
+ <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="ConfirmDataCleanupDlg" Order="4">
+ <![CDATA[(&DBInstance=2) AND (!DBInstance=3)]]>
+ </Publish>
+ <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="UserSettingsDlg" Order="5">
+ <![CDATA[&DBInstance=3 AND NOT !DBInstance=3 AND NOT WarningText]]>
+ </Publish>
+
+ <Publish Dialog="ConfirmDataCleanupDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg">WixUI_InstallMode = "Change"</Publish>
+ <Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="ConfirmDataCleanupDlg" Order="999">
+ !DBInstance=3 AND (CLEANUPDATA Or USECONFIRMDATACLEANUPDLG)
+ </Publish>
+ <Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Property="USECONFIRMDATACLEANUPDLG" Value="1" Order="999">
+ !DBInstance=3 AND CLEANUPDATA
+ </Publish>
+ <Publish Dialog="ConfirmDataCleanupDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg">WixUI_InstallMode = "Remove"</Publish>
+ </UI>
+
+ <!-- End of UI section -->
+
+ <!-- Extra folders we need (DATADIR and shortcut folder) -->
+ <DirectoryRef Id='INSTALLDIR'>
+ <Directory Id="DATADIR" Name="data">
+ </Directory>
+ <Directory Id="ProgramMenuFolder">
+ <Directory Id="ShortcutFolder" Name="@CPACK_WIX_PACKAGE_NAME@">
+ </Directory>
+ </Directory>
+ </DirectoryRef>
+
+
+ <!-- Extra feature (database instance). This could be split to several subfeatures if desired (e.g firewall exception)-->
+ <Feature Id='DBInstance'
+ Title='Database instance'
+ Description=
+ 'Install database instance. Only new database can be installed with this feature.'
+ ConfigurableDirectory='DATADIR'
+ AllowAdvertise='no'
+ Level='1'>
+
+ <!-- Data directory with some reasonable security settings -->
+ <Component Id="C.datadir" Guid="*" Directory="DATADIR">
+ <RegistryValue Root='HKLM'
+ Key='SOFTWARE\Monty Program AB\@CPACK_WIX_PACKAGE_NAME@'
+ Name='DATADIR' Value='[DATADIR]' Type='string' KeyPath='yes'/>
+ <CreateFolder>
+ <util:PermissionEx User="[LogonUser]" GenericAll="yes" />
+ <util:PermissionEx User="NetworkService" GenericAll="yes" />
+ </CreateFolder>
+ </Component>
+
+ <!-- Database service conditioned on SERVICENAME property-->
+ <Component Id="C.service" Guid="*" Directory="DATADIR">
+ <Condition>SERVICENAME</Condition>
+ <RegistryValue Root='HKLM'
+ Key='SOFTWARE\Monty Program AB\@CPACK_WIX_PACKAGE_NAME@'
+ Name='SERVICENAME' Value='[SERVICENAME]' Type='string' KeyPath='yes'/>
+ <ServiceControl Id='DBInstanceServiceStop' Name='[SERVICENAME]' Stop='both' Remove='uninstall' Wait='yes'/>
+ <ServiceControl Id='DBInstanceServiceStart' Name='[SERVICENAME]' Start='install' Wait='yes'/>
+ </Component>
+ <?if $(var.HaveInnodb) = "1" ?>
+ <Component Id="C.myiniconfig" Guid="*" Directory="DATADIR">
+ <Condition>STDCONFIG</Condition>
+ <RegistryValue Root='HKLM'
+ Key='SOFTWARE\Monty Program AB\@CPACK_WIX_PACKAGE_NAME@'
+ Name='STDCONFIG' Value='1' Type='string' KeyPath='yes'/>
+ <IniFile Id="Ini1"
+ Action="createLine"
+ Directory="DATADIR"
+ Section="mysqld"
+ Name="my.ini"
+ Key="sql_mode"
+ Value="&quot;STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION&quot;" />
+ <IniFile Id="Ini2"
+ Action="createLine"
+ Directory="DATADIR"
+ Section="mysqld"
+ Name="my.ini"
+ Key="default_storage_engine"
+ Value="innodb" />
+ <IniFile Id="Ini3"
+ Action="createLine"
+ Directory="DATADIR"
+ Section="mysqld"
+ Name="my.ini"
+ Key="innodb_buffer_pool_size"
+ Value="[BUFFERPOOLSIZE]M" />
+ <IniFile Id="Ini4"
+ Action="createLine"
+ Directory="DATADIR"
+ Section="mysqld"
+ Name="my.ini"
+ Key="innodb_log_file_size"
+ Value="[LOGFILESIZE]M" />
+ </Component>
+ <?endif?>
+
+ <Component Id="C.feedback" Guid="*" Directory="DATADIR">
+ <Condition>FEEDBACK</Condition>
+ <RegistryValue Root='HKLM'
+ Key='SOFTWARE\Monty Program AB\@CPACK_WIX_PACKAGE_NAME@'
+ Name='FEEDBACK' Value='1' Type='string' KeyPath='yes'/>
+ <IniFile Id="Ini5"
+ Action="createLine"
+ Directory="DATADIR"
+ Section="mysqld"
+ Name="my.ini"
+ Key="feedback"
+ Value="ON" />
+ </Component>
+
+ <Component Id="C.utf8" Guid="*" Directory="DATADIR">
+ <Condition>UTF8</Condition>
+ <RegistryValue Root='HKLM'
+ Key='SOFTWARE\Monty Program AB\@CPACK_WIX_PACKAGE_NAME@'
+ Name='UTF8' Value='1' Type='string' KeyPath='yes'/>
+ <IniFile Id="Ini6"
+ Action="createLine"
+ Directory="DATADIR"
+ Section="mysqld"
+ Name="my.ini"
+ Key="character-set-server"
+ Value="utf8" />
+ </Component>
+
+ <!--- Grant service account permission to the database folder (Windows 7 and later) -->
+ <Component Id="C.serviceaccount.permission" Guid="*" Directory='DATADIR' Transitive='yes'>
+ <Condition><![CDATA[SERVICENAME AND (VersionNT > 600)]]></Condition>
+ <RegistryValue Root='HKLM'
+ Key='SOFTWARE\Monty Program AB\@CPACK_WIX_PACKAGE_NAME@'
+ Name='servicepermission' Value='1' Type='string' KeyPath='yes'/>
+ <CreateFolder>
+ <util:PermissionEx User="NT SERVICE\[SERVICENAME]" GenericAll="yes" />
+ </CreateFolder>
+ </Component>
+
+ <!-- Shortcuts in program menu (mysql client etc) -->
+ <Component Id="c.shortcuts" Guid="*" Directory="ShortcutFolder">
+ <!-- shortcut to my.ini-->
+ <RegistryValue Root="HKCU" Key="Software\@CPACK_WIX_PACKAGE_NAME@\Uninstall" Name="shortcuts" Value="1" Type="string" KeyPath="yes" />
+ <RemoveFolder Id="RemoveShorcutFolder" On="uninstall" />
+ <Shortcut Id="shortcut.my.ini"
+ Name="my.ini (@CPACK_WIX_PACKAGE_NAME@)"
+ Target="[System64Folder]notepad.exe"
+ Arguments="&quot;[DATADIR]my.ini&quot;"
+ Directory="ShortcutFolder"
+ Description="Edit database configuration" />
+ <Shortcut Id="shortcut.errorlog"
+ Name="Error log (@CPACK_WIX_PACKAGE_NAME@)"
+ Target="[System64Folder]notepad.exe"
+ Arguments="&quot;[DATADIR][ComputerName].err&quot;"
+ Directory="ShortcutFolder"
+ Description="View Database Error log" />
+ <Shortcut Id="shortcut.dbfolder" Name="Database directory (@CPACK_WIX_PACKAGE_NAME@)"
+ Target="[DATADIR]" />
+ </Component>
+
+ <!-- add reference so mysql client won't get uninstalled and we have a shortcut pointing to nowhere-->
+ <ComponentRef Id="C.bin.mysql.exe"/>
+
+ <Component Id="c.shortcuts.commandline" Guid="*" Directory="ShortcutFolder">
+ <RegistryValue
+ Root="HKCU" Key="Software\@CPACK_WIX_PACKAGE_NAME@\Uninstall"
+ Name="shortcuts.commandline"
+ Value="1" Type="string" KeyPath="yes" />
+ <!-- shortcut to client-->
+ <Shortcut Id="shortcut.mysql.exe"
+ Name="MySQL Client (@CPACK_WIX_PACKAGE_NAME@)"
+ Target="[System64Folder]cmd.exe"
+ Arguments="/k &quot; &quot;[D.bin]mysql.exe&quot; &quot;--defaults-file=[DATADIR]my.ini&quot; -uroot -p&quot;"
+ Directory="ShortcutFolder"
+ WorkingDirectory="D.bin"
+ Description="Starts mysql.exe for root user" />
+ </Component>
+ <Component Id="c.shortcuts.commandprompt.db" Guid="*" Directory="ShortcutFolder" Transitive="yes">
+ <Condition>SERVICENAME</Condition>
+ <RegistryValue
+ Root="HKCU" Key="Software\@CPACK_WIX_PACKAGE_NAME@\Uninstall"
+ Name="shortcuts.commandprompt.db"
+ Value="1" Type="string" KeyPath="yes" />
+ <!-- just command prompt in the bin directory (so all utilities can be called) -->
+ <Shortcut Id="shortcut.commandprompt.exe.db"
+ Name="Command Prompt (@CPACK_WIX_PACKAGE_NAME@)"
+ Target="[System64Folder]cmd.exe"
+ Directory="ShortcutFolder"
+ Arguments="/k &quot;set MYSQL_HOME=[DATADIR]&amp;&amp; set PATH=[D.bin];%PATH%;&amp;&amp;echo Setting environment for [ProductName] &quot;"
+ Description="Opens command line in the installation bin directory" />
+ </Component>
+
+
+ </Feature>
+
+ <Feature Id="SharedClientServerComponents"
+ Title='Utilities used by both server and client.'
+ Description=
+ 'Client utilities that are also used with server.Required for upgrade.'
+ ConfigurableDirectory='INSTALLDIR'
+ AllowAdvertise='no'
+ Level='1'
+ Display='hidden'>
+ <ComponentRef Id='C.bin.mysql.exe'/>
+ <ComponentRef Id='C.bin.mysqladmin.exe'/>
+ <ComponentRef Id='C.bin.mysql_upgrade.exe'/>
+ <ComponentRef Id='C.bin.mysqlcheck.exe'/>
+ <Component Id="c.shortcuts.commandprompt.nodb" Guid="*" Directory="ShortcutFolder" Transitive="yes">
+ <Condition>NOT SERVICENAME</Condition>
+ <RegistryValue
+ Root="HKCU" Key="Software\@CPACK_WIX_PACKAGE_NAME@\Uninstall"
+ Name="shortcuts.commandprompt.nodb"
+ Value="1" Type="string" KeyPath="yes" />
+ <!-- just command prompt in the bin directory (so all utilities can be called) -->
+ <Shortcut Id="shortcut.commandprompt.exe.nodb"
+ Name="Command Prompt (@CPACK_WIX_PACKAGE_NAME@)"
+ Target="[System64Folder]cmd.exe"
+ Directory="ShortcutFolder"
+ Arguments="/k &quot;set PATH=[D.bin];%PATH%;&amp;&amp;echo Setting environment for [ProductName] &quot;"
+ Description="Opens command line in the installation bin directory" />
+ </Component>
+ <?if $(var.HaveUpgradeWizard) != "0" ?>
+ <ComponentRef Id='C.bin.mysql_upgrade_wizard.exe'/>
+ <!--
+ <Component Id="c.shortcuts.upgrade_wizard" Guid="*" Directory="ShortcutFolder" Transitive="yes">
+ <RegistryValue
+ Root="HKCU" Key="Software\@CPACK_WIX_PACKAGE_NAME@\Uninstall"
+ Name="shortcuts.upgrade_wizard"
+ Value="1" Type="string" KeyPath="yes" />
+ <Shortcut Id="shortcut.upgrade_wizard"
+ Name="Upgrade Wizard (@CPACK_WIX_PACKAGE_NAME@)"
+ Target="[INSTALLDIR]bin\mysql_upgrade_wizard.exe"
+ Directory="ShortcutFolder"
+ Description="Upgrades older instances of MariaDB/MySQL services to version @MAJOR_VERSION@.@MINOR_VERSION@"
+ Advertise="no"/>
+ </Component>
+ -->
+ <?endif?>
+ </Feature>
+
+ <!-- Optional 3rd party tools -->
+ <DirectoryRef Id='TARGETDIR'>
+ <Directory Id='CommonFilesFolder'>
+ <Directory Id='MariaDBShared' Name='MariaDBShared'/>
+ </Directory>
+ <Directory Id='DesktopFolder'/>
+ </DirectoryRef>
+
+
+ <?if "@WITH_THIRD_PARTY@" != "" ?>
+
+ <!-- Include definition of 3party components -->
+ <?foreach tool in @WITH_THIRD_PARTY@ ?>
+ <?include "${CMAKE_CURRENT_BINARY_DIR}\$(var.tool).wxi" ?>
+ <?endforeach ?>
+
+ <Feature Id="ThirdPartyTools"
+ Title='Third party tools'
+ Description= 'Third party tools'
+ AllowAdvertise='no'
+ Level='1'
+ Display='expand'>
+ @THIRD_PARTY_FEATURE_CONDITION@
+ <!-- Include definition of 3rd party features -->
+ <?foreach tool in @WITH_THIRD_PARTY@ ?>
+ <?include "${CMAKE_CURRENT_BINARY_DIR}\$(var.tool)_feature.wxi" ?>
+ <?endforeach ?>
+
+ </Feature>
+
+ <?endif ?>
+
+ <!-- Custom action, call mysql_install_db -->
+ <SetProperty Sequence='execute' Before='CreateDatabaseCommand' Id="SKIPNETWORKING" Value="--skip-networking" >SKIPNETWORKING</SetProperty>
+ <SetProperty Sequence='execute' Before='CreateDatabaseCommand' Id="ALLOWREMOTEROOTACCESS" Value="--allow-remote-root-access">ALLOWREMOTEROOTACCESS</SetProperty>
+ <SetProperty Sequence='execute' Before='CreateDatabaseCommand' Id="DEFAULTUSER" Value="--default-user">DEFAULTUSER</SetProperty>
+ <CustomAction Id='CheckDatabaseProperties' BinaryKey='wixca.dll' DllEntry='CheckDatabaseProperties' />
+ <CustomAction Id='PresetDatabaseProperties' BinaryKey='wixca.dll' DllEntry='PresetDatabaseProperties' />
+ <CustomAction Id="CreateDatabaseCommand" Property="CreateDatabase"
+ Value=
+ "&quot;[#F.bin.mysql_install_db.exe]&quot; &quot;--service=[SERVICENAME]&quot; --port=[PORT] &quot;--password=[ESCAPEDPASSWORD]&quot; &quot;--datadir=[DATADIR]\&quot; [SKIPNETWORKING] [ALLOWREMOTEROOTACCESS] [DEFAULTUSER] --verbose-bootstrap"
+ Execute="immediate"
+ HideTarget="yes"
+ />
+ <CustomAction Id="CreateDatabaseRollbackCommand" Property="CreateDatabaseRollback"
+ Value="[SERVICENAME]\[DATADIR]"
+ Execute="immediate"/>
+ <CustomAction Id="CreateDatabase" BinaryKey="WixCA" DllEntry="CAQuietExec"
+ Execute="deferred" Return="check" Impersonate="no" />
+ <CustomAction Id="CreateDatabaseRollback" BinaryKey="wixca.dll" DllEntry="CreateDatabaseRollback"
+ Execute="rollback" Return="check" Impersonate="no"/>
+ <UI>
+ <ProgressText Action="CreateDatabase">Running mysql_install_db.exe</ProgressText>
+ </UI>
+
+ <!-- Error injection script activated by TEST_FAIL=1 passed to msiexec (to see how good custom action rollback works) -->
+ <Property Id="FailureProgram">
+ <![CDATA[
+ Function Main()
+ Main = 3
+ End Function
+ ]]>
+ </Property>
+ <CustomAction Id="FakeFailure"
+ VBScriptCall="Main"
+ Property="FailureProgram"
+ Execute="deferred" />
+
+ <CustomAction Id='ErrorDataDirNotEmpty'
+ Error='Chosen data directory [DATADIR] is not empty. It must be empty prior to installation.'/>
+ <InstallExecuteSequence>
+ <Custom Action="CheckDataDirectoryEmpty" After="CostFinalize">
+ <![CDATA[&DBInstance=3 AND NOT !DBInstance=3 AND OLDERVERSIONBEINGUPGRADED=""]]>
+ </Custom>
+ <Custom Action="ErrorDataDirNotEmpty" After="CheckDataDirectoryEmpty" >DATADIRNOTEMPTY</Custom>
+ <Custom Action="CheckDatabaseProperties" Before="CreateDatabaseCommand">SERVICENAME</Custom>
+ <Custom Action="CreateDatabaseCommand" After="CostFinalize" >
+ <![CDATA[&DBInstance=3 AND NOT !DBInstance=3 AND OLDERVERSIONBEINGUPGRADED=""]]>
+ </Custom>
+ <Custom Action="CreateDatabase" After="InstallFiles">
+ <![CDATA[&DBInstance=3 AND NOT !DBInstance=3 AND OLDERVERSIONBEINGUPGRADED=""]]>
+ </Custom>
+ <Custom Action="CreateDatabaseRollbackCommand" After="CostFinalize">
+ <![CDATA[&DBInstance=3 AND NOT !DBInstance=3 AND OLDERVERSIONBEINGUPGRADED=""]]>
+ </Custom>
+ <Custom Action="CreateDatabaseRollback" Before="CreateDatabase">
+ <![CDATA[&DBInstance=3 AND NOT !DBInstance=3 AND OLDERVERSIONBEINGUPGRADED=""]]>
+ </Custom>
+ <Custom Action='FakeFailure' Before='InstallFinalize'>
+ <![CDATA[&DBInstance=3 AND NOT !DBInstance=3 AND OLDERVERSIONBEINGUPGRADED="" AND TESTFAIL]]>
+ </Custom>
+ </InstallExecuteSequence>
+
+
+ <!-- Custom action to remove data on uninstall -->
+ <Binary Id='wixca.dll' SourceFile='@WIXCA_LOCATION@' />
+ <CustomAction Id="RemoveDataDirectory.SetProperty" Return="check"
+ Property="RemoveDataDirectory" Value="[DATADIR]" />
+ <CustomAction Id="RemoveDataDirectory" BinaryKey="wixca.dll"
+ DllEntry="RemoveDataDirectory"
+ Execute="deferred"
+ Impersonate="no"
+ Return="ignore" />
+ <InstallExecuteSequence>
+ <Custom Action="RemoveDataDirectory.SetProperty" After="CreateDatabaseCommand" >
+ <![CDATA[($C.datadir=2) AND (CLEANUPDATA) AND NOT UPGRADINGPRODUCTCODE]]>
+ </Custom>
+ <Custom Action="RemoveDataDirectory" Before="RemoveFiles">
+ <![CDATA[($C.datadir=2) AND (CLEANUPDATA) AND NOT UPGRADINGPRODUCTCODE]]>
+ </Custom>
+ </InstallExecuteSequence>
+
+ <InstallExecuteSequence>
+ <StopServices>SERVICENAME</StopServices>
+ <DeleteServices>SERVICENAME</DeleteServices>
+ </InstallExecuteSequence>
+ <CustomAction Id="CheckDBInUse" Return="ignore"
+ BinaryKey="wixca.dll" DllEntry="CheckDBInUse" Execute="firstSequence"/>
+ <InstallExecuteSequence>
+ <Custom Action="CheckDBInUse" Before="LaunchConditions">Installed</Custom>
+ <Custom Action="PresetDatabaseProperties" After="CheckDBInUse"></Custom>
+ </InstallExecuteSequence>
+ <InstallUISequence>
+ <Custom Action="CheckDBInUse" Before="LaunchConditions">Installed</Custom>
+ <Custom Action="PresetDatabaseProperties" After="CheckDBInUse"></Custom>
+ </InstallUISequence>
+
+ <!-- Store some properties persistently in registry, mainly for upgrades -->
+
+ <Feature Id='StoreInstallLocation' Level='1' Absent='disallow' Display='hidden'>
+ <Component Directory='INSTALLDIR' Guid='*' Id='C.storeinstalllocation'>
+ <RegistryValue Root='HKLM' Key='SOFTWARE\Monty Program AB\@CPACK_WIX_PACKAGE_NAME@'
+ Name='INSTALLDIR' Value='[INSTALLDIR]' Type='string' KeyPath='yes'/>
+ </Component>
+ </Feature>
+
+ <?foreach STOREDVAR in SERVICENAME;DATADIR;INSTALLDIR?>
+
+ <Property Id='$(var.STOREDVAR)' Secure='yes'>
+ <RegistrySearch Id='$(var.STOREDVAR)Property' Root='HKLM'
+ Key='SOFTWARE\Monty Program AB\@CPACK_WIX_PACKAGE_NAME@'
+ Name='$(var.STOREDVAR)' Type='raw' />
+ </Property>
+ <CustomAction Id='SaveCmdLineValue_$(var.STOREDVAR)' Property='CMDLINE_$(var.STOREDVAR)'
+ Value='[$(var.STOREDVAR)]' Execute='firstSequence' />
+ <CustomAction Id='SetFromCmdLineValue_$(var.STOREDVAR)' Property='$(var.STOREDVAR)'
+ Value='[CMDLINE_$(var.STOREDVAR)]' Execute='firstSequence' />
+ <InstallUISequence>
+ <Custom Action='SaveCmdLineValue_$(var.STOREDVAR)' Before='AppSearch' />
+ <Custom Action='SetFromCmdLineValue_$(var.STOREDVAR)' After='AppSearch'>CMDLINE_$(var.STOREDVAR)</Custom>
+ </InstallUISequence>
+ <InstallExecuteSequence>
+ <Custom Action='SaveCmdLineValue_$(var.STOREDVAR)' Before='AppSearch' />
+ <Custom Action='SetFromCmdLineValue_$(var.STOREDVAR)' After='AppSearch'>CMDLINE_$(var.STOREDVAR)</Custom>
+ </InstallExecuteSequence>
+
+ <?endforeach?>
+
+ <!--
+ Optionally, start upgrade wizard on exit.
+ -->
+
+
+
+ <?if $(var.HaveUpgradeWizard) != "0" ?>
+ <UI>
+ <Publish Dialog="ExitDialog"
+ Control="Finish"
+ Event="DoAction"
+ Value="LaunchApplication">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
+ </UI>
+ <Property
+ Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT"
+ Value="Launch wizard to upgrade existing MariaDB or MySQL services." />
+ <Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Value="0"/>
+ <Property Id="WixShellExecTarget" Value="[#F.bin.mysql_upgrade_wizard.exe]" />
+ <CustomAction Id="LaunchApplication"
+ BinaryKey="WixCA"
+ DllEntry="WixShellExec"
+ Impersonate="yes" />
+ <CustomAction
+ Id="CheckServiceUpgrades" Return="ignore" BinaryKey="wixca.dll"
+ DllEntry="CheckServiceUpgrades"
+ Execute="immediate" />
+ <InstallUISequence>
+ <Custom Action="CheckServiceUpgrades" After="CostFinalize">
+ $C.bin.mysql_upgrade_wizard.exe = 3 AND NOT Installed AND NOT OLDERVERSIONBEINGUPGRADED
+ </Custom>
+ </InstallUISequence>
+ <SetProperty Before="ExecuteAction" Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT"
+ Sequence="ui" Value="[NonExistentProperty]">
+ <![CDATA[($C.bin.mysql_upgrade_wizard.exe <> 3) AND NOT Installed OR OLDERVERSIONBEINGUPGRADED]]>
+ </SetProperty>
+ <SetProperty Before="ExecuteAction" Id="WIXUI_EXITDIALOGOPTIONALCHECKBOX"
+ Sequence="ui" Value="[NonExistentProperty]">
+ <![CDATA[($C.bin.mysql_upgrade_wizard.exe <> 3) AND NOT Installed OR OLDERVERSIONBEINGUPGRADED]]>
+ </SetProperty>
+
+ <?endif ?> <!-- HaveUpgradeWizard -->
+
+ <!--
+ Author the registry entries for "add or remove programs"
+ We choose to define ARPSYSTEMCOMPONENT to 1 because we want to show
+ "do you want to remove data directory" on uninstall
+ -->
+ <Property Id="ARPSYSTEMCOMPONENT" Value="1" Secure="yes" />
+ <Property Id="ARPINSTALLLOCATION" Secure="yes"/>
+ <SetProperty Id="ARPINSTALLLOCATION" Value="[INSTALLDIR]" After="InstallValidate" Sequence="execute"/>
+ <Feature Id='ARPRegistryEntries'
+ Title='Add or remove program entries'
+ Description='Add or remove program entries'
+ AllowAdvertise='no'
+ Absent='disallow' Display='hidden'
+ Level='1'>
+ <Component Id="C.arp_entries" Guid="*" Directory="INSTALLDIR">
+ <RemoveFolder Id="RemoveINSTALLDIR" On="uninstall"/>
+ <RegistryValue Root='HKLM'
+ Key='Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_WIX_PACKAGE_NAME@'
+ Name='DisplayName' Value='[ProductName]' Type='string' KeyPath='yes'/>
+ <RegistryValue Root='HKLM'
+ Key='Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_WIX_PACKAGE_NAME@'
+ Name='Publisher' Value='@MANUFACTURER@' Type='string'/>
+ <RegistryValue Root='HKLM'
+ Key='Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_WIX_PACKAGE_NAME@'
+ Name='DisplayVersion' Value='[ProductVersion]' Type='string'/>
+ <RegistryValue Root='HKLM'
+ Key='Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_WIX_PACKAGE_NAME@'
+ Name='InstallLocation' Value='[INSTALLDIR]' Type='string'/>
+ <RegistryValue Root='HKLM'
+ Key='Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_WIX_PACKAGE_NAME@'
+ Name='UninstallString' Value='msiexec.exe /I [ProductCode]' Type='string'/>
+ <RegistryValue Root='HKLM'
+ Key='Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_WIX_PACKAGE_NAME@'
+ Name='MajorVersion' Value='@MAJOR_VERSION@' Type='string'/>
+ <RegistryValue Root='HKLM'
+ Key='Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_WIX_PACKAGE_NAME@'
+ Name='MinorVersion' Value='@MINOR_VERSION@' Type='string'/>
+ </Component>
+ </Feature>
+
+ <!-- Extra condition to block the installer if NSIS based installation is detected-->
+ <Property Id="NSISINSTALLKEY">
+ <RegistrySearch Id='NSISKey' Type='raw'
+ Root='HKLM' Key='Software\Microsoft\Windows\CurrentVersion\Uninstall\MariaDB' Name='DisplayName' />
+ </Property>
+ <Condition
+ Message=
+ 'Previous version of MariaDB was found, that used incompatible installer.&#xD;&#xA;Please remove &quot;[NSISINSTALLKEY]&quot; before you proceed with this installation.'
+ >
+ <![CDATA[ NOT(NSISINSTALLKEY << "MariaDB @MAJOR_VERSION@.@MINOR_VERSION@.") OR Installed]]>
+ </Condition>
+ <Condition Message=
+ 'Setting the ALLUSERS property is not allowed because [ProductName] is a per-machine application. Setup will now exit.'>
+ <![CDATA[ALLUSERS = "1"]]>
+ </Condition>
+ </Fragment>
+</Wix>
diff --git a/win/packaging/heidisql.cmake b/win/packaging/heidisql.cmake
index e429907cb2e..5b0cd07cea4 100644
--- a/win/packaging/heidisql.cmake
+++ b/win/packaging/heidisql.cmake
@@ -1,23 +1,23 @@
-SET(HEIDISQL_BASE_NAME "HeidiSQL_8.3_Portable")
-SET(HEIDISQL_ZIP "${HEIDISQL_BASE_NAME}.zip")
-SET(HEIDISQL_URL "http://www.heidisql.com/downloads/releases/${HEIDISQL_ZIP}")
-SET(HEIDISQL_DOWNLOAD_DIR ${THIRD_PARTY_DOWNLOAD_LOCATION}/${HEIDISQL_BASE_NAME})
-
-IF(NOT EXISTS ${HEIDISQL_DOWNLOAD_DIR}/${HEIDISQL_ZIP})
- MAKE_DIRECTORY(${HEIDISQL_DOWNLOAD_DIR})
- MESSAGE(STATUS "Downloading ${HEIDISQL_URL} to ${HEIDISQL_DOWNLOAD_DIR}/${HEIDISQL_ZIP}")
- FILE(DOWNLOAD ${HEIDISQL_URL} ${HEIDISQL_DOWNLOAD_DIR}/${HEIDISQL_ZIP} TIMEOUT 60)
- EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E chdir ${HEIDISQL_DOWNLOAD_DIR}
- ${CMAKE_COMMAND} -E tar xfz ${HEIDISQL_DOWNLOAD_DIR}/${HEIDISQL_ZIP}
- )
-ENDIF()
-
-SET(LIBMYSQLDLL_SOURCE ${HEIDISQL_DOWNLOAD_DIR}/libmysql.dll)
-IF(CMAKE_SIZEOF_VOID_P EQUAL 4)
- # Use our libmysql if it is 32 bit.
- IF(LIBMYSQL_LOCATION)
- SET(LIBMYSQLDLL_SOURCE "${LIBMYSQL_LOCATION}")
- ENDIF()
-ENDIF()
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/heidisql.wxi.in ${CMAKE_CURRENT_BINARY_DIR}/heidisql.wxi)
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/heidisql_feature.wxi.in ${CMAKE_CURRENT_BINARY_DIR}/heidisql_feature.wxi)
+SET(HEIDISQL_BASE_NAME "HeidiSQL_9.1_Portable")
+SET(HEIDISQL_ZIP "${HEIDISQL_BASE_NAME}.zip")
+SET(HEIDISQL_URL "http://www.heidisql.com/downloads/releases/${HEIDISQL_ZIP}")
+SET(HEIDISQL_DOWNLOAD_DIR ${THIRD_PARTY_DOWNLOAD_LOCATION}/${HEIDISQL_BASE_NAME})
+
+IF(NOT EXISTS ${HEIDISQL_DOWNLOAD_DIR}/${HEIDISQL_ZIP})
+ MAKE_DIRECTORY(${HEIDISQL_DOWNLOAD_DIR})
+ MESSAGE(STATUS "Downloading ${HEIDISQL_URL} to ${HEIDISQL_DOWNLOAD_DIR}/${HEIDISQL_ZIP}")
+ FILE(DOWNLOAD ${HEIDISQL_URL} ${HEIDISQL_DOWNLOAD_DIR}/${HEIDISQL_ZIP} TIMEOUT 60)
+ EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E chdir ${HEIDISQL_DOWNLOAD_DIR}
+ ${CMAKE_COMMAND} -E tar xfz ${HEIDISQL_DOWNLOAD_DIR}/${HEIDISQL_ZIP}
+ )
+ENDIF()
+
+SET(LIBMYSQLDLL_SOURCE ${HEIDISQL_DOWNLOAD_DIR}/libmysql.dll)
+IF(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ # Use our libmysql if it is 32 bit.
+ IF(LIBMYSQL_LOCATION)
+ SET(LIBMYSQLDLL_SOURCE "${LIBMYSQL_LOCATION}")
+ ENDIF()
+ENDIF()
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/heidisql.wxi.in ${CMAKE_CURRENT_BINARY_DIR}/heidisql.wxi)
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/heidisql_feature.wxi.in ${CMAKE_CURRENT_BINARY_DIR}/heidisql_feature.wxi)
diff --git a/win/packaging/heidisql.wxi.in b/win/packaging/heidisql.wxi.in
index 1e6e3d552a8..4f07a07627c 100644
--- a/win/packaging/heidisql.wxi.in
+++ b/win/packaging/heidisql.wxi.in
@@ -1,51 +1,77 @@
-<Include>
-<Property Id="HEIDISQLINSTALLED" Secure="yes">
-<RegistrySearch Id="HeidiSQL"
- Root="HKLM"
- Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\HeidiSQL_is1"
- Name="UninstallString"
- Type="raw"
- Win64="no"
-/>
-</Property>
-<DirectoryRef Id="MariaDBShared">
- <Directory Id="D.HeidiSQL" Name="HeidiSQL">
- <Component Id="component.HeidiSQL" Guid="96ea3879-5320-4098-8f26-2f655d2f716c" Win64="no">
-
- <File Id="heidisql.gpl.txt" Name="gpl.txt" Source="${HEIDISQL_DOWNLOAD_DIR}\gpl.txt" />
- <File Id="heidisql.heidisql.exe" Name="heidisql.exe" Source="${HEIDISQL_DOWNLOAD_DIR}\heidisql.exe" KeyPath="yes">
- <Shortcut Id="desktopHeidiSQL" Directory="DesktopFolder" Name="HeidiSQL" Advertise="yes"/>
- </File>
- <!--
- Forced file removal for heidisql.exe might be required.
- HeidiSQL is self-updating, thus the version that was installed by MSI not necessarily matches
- the version of the file on uninstall. MSI would not touch such file by default and leave it after
- uninstallation. We use RemoveFile to force delete in any case.
- -->
- <RemoveFile Id="Remove_HeidiSQL_exe" Name="heidisql.exe" On="uninstall" />
-
- <File Id="heidisql.license.txt" Name="license.txt" Source="${HEIDISQL_DOWNLOAD_DIR}\license.txt" />
- <File Id="heidisql.readme.txt" Name="readme.txt" Source="${HEIDISQL_DOWNLOAD_DIR}\readme.txt" />
- </Component>
- <Component Id="component.HeidiSQL_MenuShortcut" Guid="*" Win64="no">
- <RegistryValue Root="HKCU" Key="Software\@CPACK_WIX_PACKAGE_NAME@\Uninstall" Name="shortcuts.heidisql" Value="1" Type="string" KeyPath="yes" />
- <Shortcut Id="startmenuHeidiSQL" Directory="ShortcutFolder" Name="HeidiSQL" Target="[D.HeidiSQL]\heidisql.exe"/>
- </Component>
- <Component Id="component.HeidiSQL_libmysql.dll" Guid="*" Win64="no">
- <File Id="heidisql.libmysql.dll" Name="libmysql.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libmysql.dll" />
- </Component>
- <Component Id="component.HeidiSQL_CleanupSettings" Guid="*" Win64="no">
- <Condition>HEIDISQLINSTALLED</Condition>
- <RegistryValue Root="HKCU" Key="Software\@CPACK_WIX_PACKAGE_NAME@\UninstallCleanupHeidiSQLSettings" Name="cleanup.heidisql" Value="1" Type="string" KeyPath="yes" />
- <RemoveRegistryKey Id="HeidiSQL_RegistryCleanup" Root="HKCU" Key="SOFTWARE\HeidiSQL" Action="removeOnUninstall" />
- </Component>
- </Directory>
-</DirectoryRef>
-
-<ComponentGroup Id="HeidiSQL">
- <ComponentRef Id="component.HeidiSQL"/>
- <ComponentRef Id="component.HeidiSQL_MenuShortcut"/>
- <ComponentRef Id="component.HeidiSQL_libmysql.dll"/>
- <ComponentRef Id="component.HeidiSQL_CleanupSettings"/>
-</ComponentGroup>
-</Include>
+<Include>
+<Property Id="HEIDISQLINSTALLED" Secure="yes">
+<RegistrySearch Id="HeidiSQL"
+ Root="HKLM"
+ Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\HeidiSQL_is1"
+ Name="UninstallString"
+ Type="raw"
+ Win64="no"
+/>
+</Property>
+<DirectoryRef Id="MariaDBShared">
+ <Directory Id="D.HeidiSQL" Name="HeidiSQL">
+ <Component Id="component.HeidiSQL" Guid="96ea3879-5320-4098-8f26-2f655d2f716c" Win64="no">
+
+ <File Id="heidisql.gpl.txt" Name="gpl.txt" Source="${HEIDISQL_DOWNLOAD_DIR}\gpl.txt" />
+ <File Id="heidisql.heidisql.exe" Name="heidisql.exe" Source="${HEIDISQL_DOWNLOAD_DIR}\heidisql.exe" KeyPath="yes">
+ <Shortcut Id="desktopHeidiSQL" Directory="DesktopFolder" Name="HeidiSQL" Advertise="yes"/>
+ </File>
+ <!--
+ Forced file removal for heidisql.exe might be required.
+ HeidiSQL is self-updating, thus the version that was installed by MSI not necessarily matches
+ the version of the file on uninstall. MSI would not touch such file by default and leave it after
+ uninstallation. We use RemoveFile to force delete in any case.
+ -->
+ <RemoveFile Id="Remove_HeidiSQL_exe" Name="heidisql.exe" On="uninstall" />
+ <!-- remove readme.txt too, it's not included in HeidiSQL-9.1-Portable.zip -->
+ <RemoveFile Id="Remove_readme_txt" Name="readme.txt" On="uninstall" />
+
+ <File Id="heidisql.license.txt" Name="license.txt" Source="${HEIDISQL_DOWNLOAD_DIR}\license.txt" />
+ </Component>
+ <Component Id="component.HeidiSQL_MenuShortcut" Guid="*" Win64="no">
+ <RegistryValue Root="HKCU" Key="Software\@CPACK_WIX_PACKAGE_NAME@\Uninstall" Name="shortcuts.heidisql" Value="1" Type="string" KeyPath="yes" />
+ <Shortcut Id="startmenuHeidiSQL" Directory="ShortcutFolder" Name="HeidiSQL" Target="[D.HeidiSQL]\heidisql.exe"/>
+ </Component>
+ <Component Id="component.HeidiSQL_libmysql.dll" Guid="*" Win64="no">
+ <File Id="heidisql.libmysql.dll" Name="libmysql.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libmysql.dll" />
+ </Component>
+
+ <Component Id="component.HeidiSQL_libeay32.dll" Guid="*" Win64="no">
+ <File Id="heidisql.libeay32.dll" Name="libeay32.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libeay32.dll" />
+ </Component>
+ <Component Id="component.HeidiSQL_libpq.dll" Guid="*" Win64="no">
+ <File Id="heidisql.libpq.dll" Name="libpq.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libpq.dll" />
+ </Component>
+ <Component Id="component.HeidiSQL_ssleay32.dll" Guid="*" Win64="no">
+ <File Id="heidisql.ssleay32.dll" Name="ssleay32.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\ssleay32.dll" />
+ </Component>
+ <Component Id="component.HeidiSQL_libintl.dll" Guid="*" Win64="no">
+ <File Id="heidisql.libintl.dll" Name="libintl.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libintl.dll" />
+ </Component>
+
+ <Directory Id="D.HeidiSQL.plugins" Name="plugins">
+ <Component Id="component.HeidiSQL_dialog.dll" Guid="*" Win64="no">
+ <File Id="heidisql.dialog.dll" Name="dialog.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\plugins\dialog.dll" />
+ </Component>
+ </Directory>
+
+ <Component Id="component.HeidiSQL_CleanupSettings" Guid="*" Win64="no">
+ <Condition>HEIDISQLINSTALLED</Condition>
+ <RegistryValue Root="HKCU" Key="Software\@CPACK_WIX_PACKAGE_NAME@\UninstallCleanupHeidiSQLSettings" Name="cleanup.heidisql" Value="1" Type="string" KeyPath="yes" />
+ <RemoveRegistryKey Id="HeidiSQL_RegistryCleanup" Root="HKCU" Key="SOFTWARE\HeidiSQL" Action="removeOnUninstall" />
+ </Component>
+ </Directory>
+</DirectoryRef>
+
+<ComponentGroup Id="HeidiSQL">
+ <ComponentRef Id="component.HeidiSQL"/>
+ <ComponentRef Id="component.HeidiSQL_MenuShortcut"/>
+ <ComponentRef Id="component.HeidiSQL_libmysql.dll"/>
+ <ComponentRef Id="component.HeidiSQL_libeay32.dll" />
+ <ComponentRef Id="component.HeidiSQL_libpq.dll" />
+ <ComponentRef Id="component.HeidiSQL_ssleay32.dll" />
+ <ComponentRef Id="component.HeidiSQL_libintl.dll" />
+ <ComponentRef Id="component.HeidiSQL_dialog.dll" />
+ <ComponentRef Id="component.HeidiSQL_CleanupSettings"/>
+</ComponentGroup>
+</Include>
diff --git a/win/packaging/heidisql_feature.wxi.in b/win/packaging/heidisql_feature.wxi.in
index 3f60fcd8f27..241554e035a 100644
--- a/win/packaging/heidisql_feature.wxi.in
+++ b/win/packaging/heidisql_feature.wxi.in
@@ -1,10 +1,10 @@
-<Include>
-<Feature Id="HeidiSQL"
- Title='HeidiSQL'
- Description= 'Powerful, easy and free MySQL/MariaDB GUI client by Ansgar Becker'
- AllowAdvertise='no'
- Level='1'>
- <Condition Level="0">HEIDISQLINSTALLED AND NOT REMOVE ~= ALL</Condition>
- <ComponentGroupRef Id='HeidiSQL'/>
-</Feature>
-</Include>
+<Include>
+<Feature Id="HeidiSQL"
+ Title='HeidiSQL'
+ Description= 'Powerful, easy and free MySQL/MariaDB GUI client by Ansgar Becker'
+ AllowAdvertise='no'
+ Level='1'>
+ <Condition Level="0">HEIDISQLINSTALLED AND NOT REMOVE ~= ALL</Condition>
+ <ComponentGroupRef Id='HeidiSQL'/>
+</Feature>
+</Include>
diff --git a/win/packaging/mysql_server.wxs.in b/win/packaging/mysql_server.wxs.in
index 79fde801cf5..c10116830e7 100644
--- a/win/packaging/mysql_server.wxs.in
+++ b/win/packaging/mysql_server.wxs.in
@@ -1,89 +1,89 @@
-<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
- xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
- <Product
- Id="*"
- UpgradeCode="@CPACK_WIX_UPGRADE_CODE@"
- Name="@CPACK_WIX_PACKAGE_NAME@"
- Version="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@.@TINY_VERSION@"
- Language="1033"
- Manufacturer="@MANUFACTURER@">
-
- <Package Id='*'
- Keywords='Installer'
- Description='MariaDB Server'
- Manufacturer='@MANUFACTURER@'
- InstallerVersion='200'
- Languages='1033'
- Compressed='yes'
- SummaryCodepage='1252'
- Platform='@Platform@'/>
-
- <Media Id='1' Cabinet='product.cab' EmbedCab='yes' CompressionLevel='high' />
-
- <!-- Upgrade -->
- <Upgrade Id="@CPACK_WIX_UPGRADE_CODE@">
- <?if "@PATCH_VERSION@" != "0"?>
- <UpgradeVersion
- Minimum="@MAJOR_VERSION@.@MINOR_VERSION@.0"
- IncludeMinimum="yes"
- Maximum="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@.@TINY_VERSION@"
- IncludeMaximum="yes"
- Property="OLDERVERSIONBEINGUPGRADED"
- MigrateFeatures="yes"
- />
- <?endif?>
- <UpgradeVersion
- Minimum="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@.@TINY_VERSION@"
- Maximum="@MAJOR_VERSION@.@MINOR_VERSION@.999"
- IncludeMinimum="no"
- OnlyDetect="yes"
- Property="NEWERVERSIONDETECTED" />
- </Upgrade>
- <Condition Message="A more recent version of [ProductName] is already installed. Setup will now exit.">
- NOT NEWERVERSIONDETECTED OR Installed
- </Condition>
- <InstallExecuteSequence>
- <RemoveExistingProducts After="InstallFinalize"/>
- </InstallExecuteSequence>
-
-
- <InstallUISequence>
- <AppSearch After="FindRelatedProducts"/>
- </InstallUISequence>
-
- <!-- UI -->
- <Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR"></Property>
- <UIRef Id="WixUI_ErrorProgressText" />
- <UIRef Id="@CPACK_WIX_UI@" />
-
-
- <!-- License -->
- <WixVariable
- Id="WixUILicenseRtf"
- Value="@COPYING_RTF@"/>
-
- <!-- Installation root-->
- <Directory Id='TARGETDIR' Name='SourceDir'>
- <Directory Id='@PlatformProgramFilesFolder@'>
- <Directory Id='INSTALLDIR' Name='@CPACK_WIX_PACKAGE_BASE_NAME@ @MAJOR_VERSION@.@MINOR_VERSION@'>
- </Directory>
- </Directory>
- </Directory>
-
- <!-- CPACK_WIX_FEATURES -->
- @CPACK_WIX_FEATURES@
-
- <!-- CPACK_WIX_DIRECTORIES -->
- @CPACK_WIX_DIRECTORIES@
-
- <!--CPACK_WIX_COMPONENTS-->
- @CPACK_WIX_COMPONENTS@
-
- <!--CPACK_WIX_COMPONENTS_GROUPS -->
- @CPACK_WIX_COMPONENT_GROUPS@
-
- <!--CPACK_WIX_INCLUDES -->
- @CPACK_WIX_INCLUDES@
- </Product>
-
-</Wix>
+<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
+ xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
+ <Product
+ Id="*"
+ UpgradeCode="@CPACK_WIX_UPGRADE_CODE@"
+ Name="@CPACK_WIX_PACKAGE_NAME@"
+ Version="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@.@TINY_VERSION@"
+ Language="1033"
+ Manufacturer="@MANUFACTURER@">
+
+ <Package Id='*'
+ Keywords='Installer'
+ Description='MariaDB Server'
+ Manufacturer='@MANUFACTURER@'
+ InstallerVersion='200'
+ Languages='1033'
+ Compressed='yes'
+ SummaryCodepage='1252'
+ Platform='@Platform@'/>
+
+ <Media Id='1' Cabinet='product.cab' EmbedCab='yes' CompressionLevel='high' />
+
+ <!-- Upgrade -->
+ <Upgrade Id="@CPACK_WIX_UPGRADE_CODE@">
+ <?if "@PATCH_VERSION@" != "0"?>
+ <UpgradeVersion
+ Minimum="@MAJOR_VERSION@.@MINOR_VERSION@.0"
+ IncludeMinimum="yes"
+ Maximum="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@.@TINY_VERSION@"
+ IncludeMaximum="yes"
+ Property="OLDERVERSIONBEINGUPGRADED"
+ MigrateFeatures="yes"
+ />
+ <?endif?>
+ <UpgradeVersion
+ Minimum="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@.@TINY_VERSION@"
+ Maximum="@MAJOR_VERSION@.@MINOR_VERSION@.999"
+ IncludeMinimum="no"
+ OnlyDetect="yes"
+ Property="NEWERVERSIONDETECTED" />
+ </Upgrade>
+ <Condition Message="A more recent version of [ProductName] is already installed. Setup will now exit.">
+ NOT NEWERVERSIONDETECTED OR Installed
+ </Condition>
+ <InstallExecuteSequence>
+ <RemoveExistingProducts After="InstallFinalize"/>
+ </InstallExecuteSequence>
+
+
+ <InstallUISequence>
+ <AppSearch After="FindRelatedProducts"/>
+ </InstallUISequence>
+
+ <!-- UI -->
+ <Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR"></Property>
+ <UIRef Id="WixUI_ErrorProgressText" />
+ <UIRef Id="@CPACK_WIX_UI@" />
+
+
+ <!-- License -->
+ <WixVariable
+ Id="WixUILicenseRtf"
+ Value="@COPYING_RTF@"/>
+
+ <!-- Installation root-->
+ <Directory Id='TARGETDIR' Name='SourceDir'>
+ <Directory Id='@PlatformProgramFilesFolder@'>
+ <Directory Id='INSTALLDIR' Name='@CPACK_WIX_PACKAGE_BASE_NAME@ @MAJOR_VERSION@.@MINOR_VERSION@'>
+ </Directory>
+ </Directory>
+ </Directory>
+
+ <!-- CPACK_WIX_FEATURES -->
+ @CPACK_WIX_FEATURES@
+
+ <!-- CPACK_WIX_DIRECTORIES -->
+ @CPACK_WIX_DIRECTORIES@
+
+ <!--CPACK_WIX_COMPONENTS-->
+ @CPACK_WIX_COMPONENTS@
+
+ <!--CPACK_WIX_COMPONENTS_GROUPS -->
+ @CPACK_WIX_COMPONENT_GROUPS@
+
+ <!--CPACK_WIX_INCLUDES -->
+ @CPACK_WIX_INCLUDES@
+ </Product>
+
+</Wix>
diff --git a/win/upgrade_wizard/stdafx.h b/win/upgrade_wizard/stdafx.h
index 87db7036005..55f9e71ed70 100644
--- a/win/upgrade_wizard/stdafx.h
+++ b/win/upgrade_wizard/stdafx.h
@@ -1,47 +1,47 @@
-
-// stdafx.h : include file for standard system include files,
-// or project specific include files that are used frequently,
-// but are changed infrequently
-
-#pragma once
-
-#ifndef _SECURE_ATL
-#define _SECURE_ATL 1
-#endif
-
-#ifndef VC_EXTRALEAN
-#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
-#endif
-
-#include "targetver.h"
-
-#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
-
-// turns off MFC's hiding of some common and often safely ignored warning messages
-#define _AFX_ALL_WARNINGS
-
-#include <afxwin.h> // MFC core and standard components
-#include <afxext.h> // MFC extensions
-
-
-
-
-
-#ifndef _AFX_NO_OLE_SUPPORT
-#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
-#endif
-#ifndef _AFX_NO_AFXCMN_SUPPORT
-#include <afxcmn.h> // MFC support for Windows Common Controls
-#endif // _AFX_NO_AFXCMN_SUPPORT
-
-
-
-
-
-
-
-
-
-
-
-
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently,
+// but are changed infrequently
+
+#pragma once
+
+#ifndef _SECURE_ATL
+#define _SECURE_ATL 1
+#endif
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include "targetver.h"
+
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+// turns off MFC's hiding of some common and often safely ignored warning messages
+#define _AFX_ALL_WARNINGS
+
+#include <afxwin.h> // MFC core and standard components
+#include <afxext.h> // MFC extensions
+
+
+
+
+
+#ifndef _AFX_NO_OLE_SUPPORT
+#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
+#endif
+#ifndef _AFX_NO_AFXCMN_SUPPORT
+#include <afxcmn.h> // MFC support for Windows Common Controls
+#endif // _AFX_NO_AFXCMN_SUPPORT
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/win/upgrade_wizard/targetver.h b/win/upgrade_wizard/targetver.h
index 90e767bfce7..87c0086de75 100644
--- a/win/upgrade_wizard/targetver.h
+++ b/win/upgrade_wizard/targetver.h
@@ -1,8 +1,8 @@
-#pragma once
-
-// Including SDKDDKVer.h defines the highest available Windows platform.
-
-// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
-// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
-
-#include <SDKDDKVer.h>
+#pragma once
+
+// Including SDKDDKVer.h defines the highest available Windows platform.
+
+// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
+// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
+
+#include <SDKDDKVer.h>
diff --git a/win/upgrade_wizard/upgrade.cpp b/win/upgrade_wizard/upgrade.cpp
index aa9efa15ecc..ea2f894c73e 100644
--- a/win/upgrade_wizard/upgrade.cpp
+++ b/win/upgrade_wizard/upgrade.cpp
@@ -1,57 +1,57 @@
-
-// upgrade.cpp : Defines the class behaviors for the application.
-//
-
-#include "stdafx.h"
-#include "upgrade.h"
-#include "upgradeDlg.h"
-
-#ifdef _DEBUG
-#define new DEBUG_NEW
-#endif
-
-
-// CUpgradeApp
-
-BEGIN_MESSAGE_MAP(CUpgradeApp, CWinApp)
- ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
-END_MESSAGE_MAP()
-
-
-// CUpgradeApp construction
-
-CUpgradeApp::CUpgradeApp()
-{
- // TODO: add construction code here,
- // Place all significant initialization in InitInstance
-}
-
-
-// The one and only CUpgradeApp object
-
-CUpgradeApp theApp;
-
-
-// CUpgradeApp initialization
-
-BOOL CUpgradeApp::InitInstance()
-{
- // InitCommonControlsEx() is required on Windows XP if an application
- // manifest specifies use of ComCtl32.dll version 6 or later to enable
- // visual styles. Otherwise, any window creation will fail.
- INITCOMMONCONTROLSEX InitCtrls;
- InitCtrls.dwSize = sizeof(InitCtrls);
- // Set this to include all the common control classes you want to use
- // in your application.
- InitCtrls.dwICC = ICC_WIN95_CLASSES;
-
- InitCommonControlsEx(&InitCtrls);
- CWinApp::InitInstance();
- CUpgradeDlg dlg;
- m_pMainWnd = &dlg;
- dlg.DoModal();
- // Since the dialog has been closed, return FALSE so that we exit the
- // application, rather than start the application's message pump.
- return FALSE;
-}
-
+
+// upgrade.cpp : Defines the class behaviors for the application.
+//
+
+#include "stdafx.h"
+#include "upgrade.h"
+#include "upgradeDlg.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
+// CUpgradeApp
+
+BEGIN_MESSAGE_MAP(CUpgradeApp, CWinApp)
+ ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
+END_MESSAGE_MAP()
+
+
+// CUpgradeApp construction
+
+CUpgradeApp::CUpgradeApp()
+{
+ // TODO: add construction code here,
+ // Place all significant initialization in InitInstance
+}
+
+
+// The one and only CUpgradeApp object
+
+CUpgradeApp theApp;
+
+
+// CUpgradeApp initialization
+
+BOOL CUpgradeApp::InitInstance()
+{
+ // InitCommonControlsEx() is required on Windows XP if an application
+ // manifest specifies use of ComCtl32.dll version 6 or later to enable
+ // visual styles. Otherwise, any window creation will fail.
+ INITCOMMONCONTROLSEX InitCtrls;
+ InitCtrls.dwSize = sizeof(InitCtrls);
+ // Set this to include all the common control classes you want to use
+ // in your application.
+ InitCtrls.dwICC = ICC_WIN95_CLASSES;
+
+ InitCommonControlsEx(&InitCtrls);
+ CWinApp::InitInstance();
+ CUpgradeDlg dlg;
+ m_pMainWnd = &dlg;
+ dlg.DoModal();
+ // Since the dialog has been closed, return FALSE so that we exit the
+ // application, rather than start the application's message pump.
+ return FALSE;
+}
+
diff --git a/win/upgrade_wizard/upgrade.h b/win/upgrade_wizard/upgrade.h
index 26c107b6ee8..b5dd10e72e7 100644
--- a/win/upgrade_wizard/upgrade.h
+++ b/win/upgrade_wizard/upgrade.h
@@ -1,32 +1,32 @@
-
-// zzz.h : main header file for the PROJECT_NAME application
-//
-
-#pragma once
-
-#ifndef __AFXWIN_H__
- #error "include 'stdafx.h' before including this file for PCH"
-#endif
-
-#include "resource.h" // main symbols
-
-
-// CzzzApp:
-// See zzz.cpp for the implementation of this class
-//
-
-class CUpgradeApp : public CWinApp
-{
-public:
- CUpgradeApp();
-
-// Overrides
-public:
- virtual BOOL InitInstance();
-
-// Implementation
-
- DECLARE_MESSAGE_MAP()
-};
-
+
+// zzz.h : main header file for the PROJECT_NAME application
+//
+
+#pragma once
+
+#ifndef __AFXWIN_H__
+ #error "include 'stdafx.h' before including this file for PCH"
+#endif
+
+#include "resource.h" // main symbols
+
+
+// CzzzApp:
+// See zzz.cpp for the implementation of this class
+//
+
+class CUpgradeApp : public CWinApp
+{
+public:
+ CUpgradeApp();
+
+// Overrides
+public:
+ virtual BOOL InitInstance();
+
+// Implementation
+
+ DECLARE_MESSAGE_MAP()
+};
+
extern CUpgradeApp theApp; \ No newline at end of file
diff --git a/win/upgrade_wizard/upgrade.rc b/win/upgrade_wizard/upgrade.rc
index 30656651b79..dbba9f67e89 100644
--- a/win/upgrade_wizard/upgrade.rc
+++ b/win/upgrade_wizard/upgrade.rc
@@ -1,148 +1,148 @@
-// Microsoft Visual C++ generated resource script.
-//
-#include "resource.h"
-
-#define APSTUDIO_READONLY_SYMBOLS
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 2 resource.
-//
-#ifndef APSTUDIO_INVOKED
-#include "targetver.h"
-#endif
-#include "afxres.h"
-
-/////////////////////////////////////////////////////////////////////////////
-#undef APSTUDIO_READONLY_SYMBOLS
-
-/////////////////////////////////////////////////////////////////////////////
-// German (Germany) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU)
-LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
-
-#ifdef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// TEXTINCLUDE
-//
-
-1 TEXTINCLUDE
-BEGIN
- "resource.h\0"
-END
-
-2 TEXTINCLUDE
-BEGIN
- "#ifndef APSTUDIO_INVOKED\r\n"
- "#include ""targetver.h""\r\n"
- "#endif\r\n"
- "#include ""afxres.h""\r\n"
- "\0"
-END
-
-3 TEXTINCLUDE
-BEGIN
- "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
- "#define _AFX_NO_OLE_RESOURCES\r\n"
- "#define _AFX_NO_TRACKER_RESOURCES\r\n"
- "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
- "\r\n"
- "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
- "LANGUAGE 9, 1\r\n"
- "#include ""res\\upgrade.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
- "#include ""afxres.rc"" // Standard components\r\n"
- "#endif\r\n"
- "\0"
-END
-
-#endif // APSTUDIO_INVOKED
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Icon
-//
-
-// Icon with lowest ID value placed first to ensure application icon
-// remains consistent on all systems.
-IDR_MAINFRAME ICON "res\\upgrade.ico"
-#endif // German (Germany) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-/////////////////////////////////////////////////////////////////////////////
-// English (United States) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Dialog
-//
-
-IDD_UPGRADE_DIALOG DIALOGEX 0, 0, 320, 200
-STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
-EXSTYLE WS_EX_APPWINDOW
-CAPTION "MariaDB Upgrade Wizard"
-FONT 8, "MS Shell Dlg"
-BEGIN
- DEFPUSHBUTTON "OK",IDOK,113,169,50,14
- PUSHBUTTON "Cancel",IDCANCEL,191,169,50,14
- LISTBOX IDC_LIST1,24,39,216,80,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
- EDITTEXT IDC_EDIT1,97,124,193,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER
- EDITTEXT IDC_EDIT2,98,138,181,14,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER
- CONTROL "",IDC_PROGRESS1,"msctls_progress32",PBS_SMOOTH | WS_BORDER,26,153,243,14
- EDITTEXT IDC_EDIT3,98,151,40,14,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER
- EDITTEXT IDC_EDIT7,27,124,65,14,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER
- EDITTEXT IDC_EDIT8,27,137,62,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER
- EDITTEXT IDC_EDIT9,27,151,62,14,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER
- PUSHBUTTON "Select all",IDC_BUTTON1,245,61,50,14
- PUSHBUTTON "Clear all",IDC_BUTTON2,246,88,50,14
- LTEXT "Select services you want to upgrade and click on the [Upgrade] button.\nMake sure to backup data directories prior to upgrade.",IDC_STATIC,25,14,215,26
-END
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// DESIGNINFO
-//
-
-#ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO
-BEGIN
- IDD_UPGRADE_DIALOG, DIALOG
- BEGIN
- LEFTMARGIN, 7
- RIGHTMARGIN, 313
- TOPMARGIN, 7
- BOTTOMMARGIN, 193
- END
-END
-#endif // APSTUDIO_INVOKED
-
-#endif // English (United States) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-#define _AFX_NO_SPLITTER_RESOURCES
-#define _AFX_NO_OLE_RESOURCES
-#define _AFX_NO_TRACKER_RESOURCES
-#define _AFX_NO_PROPERTY_RESOURCES
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-LANGUAGE 9, 1
-#include "res\upgrade.rc2" // non-Microsoft Visual C++ edited resources
-#include "afxres.rc" // Standard components
-#endif
-
-/////////////////////////////////////////////////////////////////////////////
-#endif // not APSTUDIO_INVOKED
-
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#ifndef APSTUDIO_INVOKED
+#include "targetver.h"
+#endif
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// German (Germany) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU)
+LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#ifndef APSTUDIO_INVOKED\r\n"
+ "#include ""targetver.h""\r\n"
+ "#endif\r\n"
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
+ "#define _AFX_NO_OLE_RESOURCES\r\n"
+ "#define _AFX_NO_TRACKER_RESOURCES\r\n"
+ "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
+ "\r\n"
+ "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
+ "LANGUAGE 9, 1\r\n"
+ "#include ""res\\upgrade.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
+ "#include ""afxres.rc"" // Standard components\r\n"
+ "#endif\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDR_MAINFRAME ICON "res\\upgrade.ico"
+#endif // German (Germany) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (United States) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_UPGRADE_DIALOG DIALOGEX 0, 0, 320, 200
+STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+EXSTYLE WS_EX_APPWINDOW
+CAPTION "MariaDB Upgrade Wizard"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ DEFPUSHBUTTON "OK",IDOK,113,169,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,191,169,50,14
+ LISTBOX IDC_LIST1,24,39,216,80,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
+ EDITTEXT IDC_EDIT1,97,124,193,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER
+ EDITTEXT IDC_EDIT2,98,138,181,14,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER
+ CONTROL "",IDC_PROGRESS1,"msctls_progress32",PBS_SMOOTH | WS_BORDER,26,153,243,14
+ EDITTEXT IDC_EDIT3,98,151,40,14,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER
+ EDITTEXT IDC_EDIT7,27,124,65,14,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER
+ EDITTEXT IDC_EDIT8,27,137,62,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER
+ EDITTEXT IDC_EDIT9,27,151,62,14,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER
+ PUSHBUTTON "Select all",IDC_BUTTON1,245,61,50,14
+ PUSHBUTTON "Clear all",IDC_BUTTON2,246,88,50,14
+ LTEXT "Select services you want to upgrade and click on the [Upgrade] button.\nMake sure to backup data directories prior to upgrade.",IDC_STATIC,25,14,215,26
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO
+BEGIN
+ IDD_UPGRADE_DIALOG, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 313
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 193
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+#endif // English (United States) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+#define _AFX_NO_SPLITTER_RESOURCES
+#define _AFX_NO_OLE_RESOURCES
+#define _AFX_NO_TRACKER_RESOURCES
+#define _AFX_NO_PROPERTY_RESOURCES
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+LANGUAGE 9, 1
+#include "res\upgrade.rc2" // non-Microsoft Visual C++ edited resources
+#include "afxres.rc" // Standard components
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/win/upgrade_wizard/upgradeDlg.h b/win/upgrade_wizard/upgradeDlg.h
index 97243291748..636f94894a7 100644
--- a/win/upgrade_wizard/upgradeDlg.h
+++ b/win/upgrade_wizard/upgradeDlg.h
@@ -1,73 +1,73 @@
-
-// upgradeDlg.h : header file
-//
-
-#pragma once
-#include "afxcmn.h"
-#include "afxwin.h"
-#include <string>
-
-
-// CUpgradeDlg dialog
-class CUpgradeDlg : public CDialog
-{
- // Construction
-public:
- CUpgradeDlg(CWnd* pParent = NULL); // standard constructor
-
- // Dialog Data
- enum { IDD = IDD_UPGRADE_DIALOG };
-
-protected:
- virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
-
- // job object for current process and children
- HANDLE m_JobObject;
-
- // Services are being upgraded
- BOOL m_UpgradeRunning;
-
- // ProgressBar related: number of services to upgrade
- int m_ProgressTotal;
-
- //ProgressBar related: current service being upgraded
- int m_ProgressCurrent;
-
-protected:
- HICON m_hIcon;
-
- // Generated message map functions
- virtual BOOL OnInitDialog();
- void PopulateServicesList();
- afx_msg void OnPaint();
- afx_msg HCURSOR OnQueryDragIcon();
- DECLARE_MESSAGE_MAP()
-public:
- void SelectService(int index);
- void UpgradeServices();
- void UpgradeOneService(const std::string& name);
- void ErrorExit(const char *);
- std::string m_InstallDir;
- CCheckListBox m_Services;
- CProgressCtrl m_Progress;
- CButton m_Ok;
- CButton m_Cancel;
- CButton m_SelectAll;
- CButton m_ClearAll;
- int m_MajorVersion;
- int m_MinorVersion;
- int m_PatchVersion;
-
- CEdit m_IniFilePath;
- afx_msg void OnLbnSelchangeList1();
- afx_msg void OnChkChange();
- CEdit m_DataDir;
- CEdit m_Version;
- afx_msg void OnBnClickedOk();
- afx_msg void OnBnClickedCancel();
- afx_msg void OnBnSelectAll();
- afx_msg void OnBnClearAll();
- CEdit m_IniFileLabel;
- CEdit m_DataDirLabel;
- CEdit m_VersionLabel;
-};
+
+// upgradeDlg.h : header file
+//
+
+#pragma once
+#include "afxcmn.h"
+#include "afxwin.h"
+#include <string>
+
+
+// CUpgradeDlg dialog
+class CUpgradeDlg : public CDialog
+{
+ // Construction
+public:
+ CUpgradeDlg(CWnd* pParent = NULL); // standard constructor
+
+ // Dialog Data
+ enum { IDD = IDD_UPGRADE_DIALOG };
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+
+ // job object for current process and children
+ HANDLE m_JobObject;
+
+ // Services are being upgraded
+ BOOL m_UpgradeRunning;
+
+ // ProgressBar related: number of services to upgrade
+ int m_ProgressTotal;
+
+ //ProgressBar related: current service being upgraded
+ int m_ProgressCurrent;
+
+protected:
+ HICON m_hIcon;
+
+ // Generated message map functions
+ virtual BOOL OnInitDialog();
+ void PopulateServicesList();
+ afx_msg void OnPaint();
+ afx_msg HCURSOR OnQueryDragIcon();
+ DECLARE_MESSAGE_MAP()
+public:
+ void SelectService(int index);
+ void UpgradeServices();
+ void UpgradeOneService(const std::string& name);
+ void ErrorExit(const char *);
+ std::string m_InstallDir;
+ CCheckListBox m_Services;
+ CProgressCtrl m_Progress;
+ CButton m_Ok;
+ CButton m_Cancel;
+ CButton m_SelectAll;
+ CButton m_ClearAll;
+ int m_MajorVersion;
+ int m_MinorVersion;
+ int m_PatchVersion;
+
+ CEdit m_IniFilePath;
+ afx_msg void OnLbnSelchangeList1();
+ afx_msg void OnChkChange();
+ CEdit m_DataDir;
+ CEdit m_Version;
+ afx_msg void OnBnClickedOk();
+ afx_msg void OnBnClickedCancel();
+ afx_msg void OnBnSelectAll();
+ afx_msg void OnBnClearAll();
+ CEdit m_IniFileLabel;
+ CEdit m_DataDirLabel;
+ CEdit m_VersionLabel;
+};
diff --git a/win/upgrade_wizard/upgrade_wizard.exe.manifest b/win/upgrade_wizard/upgrade_wizard.exe.manifest
index 6b40eebcbd9..ca89deae5c9 100644
--- a/win/upgrade_wizard/upgrade_wizard.exe.manifest
+++ b/win/upgrade_wizard/upgrade_wizard.exe.manifest
@@ -1,15 +1,15 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
- <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
- <security>
- <requestedPrivileges>
- <requestedExecutionLevel level="requireAdministrator" uiAccess="false"></requestedExecutionLevel>
- </requestedPrivileges>
- </security>
- </trustInfo>
- <dependency>
- <dependentAssembly>
- <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"></assemblyIdentity>
- </dependentAssembly>
- </dependency>
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+ <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
+ <security>
+ <requestedPrivileges>
+ <requestedExecutionLevel level="requireAdministrator" uiAccess="false"></requestedExecutionLevel>
+ </requestedPrivileges>
+ </security>
+ </trustInfo>
+ <dependency>
+ <dependentAssembly>
+ <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"></assemblyIdentity>
+ </dependentAssembly>
+ </dependency>
</assembly> \ No newline at end of file